diff --git a/dist/html2canvas.js b/dist/html2canvas.js index ec04c84..7a69200 100644 --- a/dist/html2canvas.js +++ b/dist/html2canvas.js @@ -722,8 +722,22 @@ function loadUrlDocument(src, proxy, document, width, height, options) { function documentFromHTML(src) { return function(html) { - var parser = new DOMParser(); - var doc = parser.parseFromString(html, "text/html"); + var parser = new DOMParser(), doc; + try { + doc = parser.parseFromString(html, "text/html"); + } catch(e) { + log("DOMParser not supported, falling back to createHTMLDocument"); + doc = document.implementation.createHTMLDocument(""); + try { + doc.open(); + doc.write(html); + doc.close(); + } catch(ee) { + log("createHTMLDocument write not supported, falling back to document.body.innerHTML"); + doc.body.innerHTML = html; // ie9 doesnt support writing to documentElement + } + } + var b = doc.querySelector("base"); if (!b || !b.href.host) { var base = doc.createElement("base"); diff --git a/dist/html2canvas.min.js b/dist/html2canvas.min.js index 7fe873b..721572d 100644 --- a/dist/html2canvas.min.js +++ b/dist/html2canvas.min.js @@ -4,5 +4,5 @@ Released under MIT License */ -!function(a,b,c){function d(a,b,c,d){return k(a,a,c,d,b).then(function(f){A("Document cloned");var g="["+Kb+"='true']";a.querySelector(g).removeAttribute(Kb);var h=f.contentWindow,i=h.document.querySelector(g);return e(i,f,b,c,d)})}function e(a,c,d,e,j){var k=c.contentWindow,l=new Ab(k.document),m=new y(d,l),n=I(a),o=null!=d.width?d.width:"view"===d.type?Math.min(n.width,e):h(k.document),p=null!=d.height?d.height:"view"===d.type?Math.min(n.height,j):i(k.document),q=new Ib(o,p,m,d,b),r=new K(a,q,l,m,d);return r.ready.then(function(){A("Finished rendering");var b="view"===d.type||a!==k.document.body&&a!==k.document.documentElement?g(q.canvas,{width:o,height:p,top:n.top,left:n.left}):q.canvas;return f(c,d),b})}function f(a,b){b.removeContainer&&(a.parentNode.removeChild(a),A("Cleaned up container"))}function g(a,c){var d=b.createElement("canvas"),e=Math.min(a.width-1,Math.max(0,c.left)),f=Math.min(a.width,Math.max(1,c.left+c.width)),g=Math.min(a.height-1,Math.max(0,c.top)),h=Math.min(a.height,Math.max(1,c.top+c.height)),i=d.width=f-e,j=d.height=h-g;return A("Cropping canvas at:","left:",c.left,"top:",c.top,"width:",c.width,"height:",c.height),A("Resulting crop with width",i,"and height",j," with x",e,"and y",g),d.getContext("2d").drawImage(a,e,g,i,j,0,0,i,j),d}function h(a){return Math.max(Math.max(a.body.scrollWidth,a.documentElement.scrollWidth),Math.max(a.body.offsetWidth,a.documentElement.offsetWidth),Math.max(a.body.clientWidth,a.documentElement.clientWidth))}function i(a){return Math.max(Math.max(a.body.scrollHeight,a.documentElement.scrollHeight),Math.max(a.body.offsetHeight,a.documentElement.offsetHeight),Math.max(a.body.clientHeight,a.documentElement.clientHeight))}function j(){return"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"}function k(b,c,d,e,f){n(b);var g=b.documentElement.cloneNode(!0),h=c.createElement("iframe");return h.style.visibility="hidden",h.style.position="absolute",h.style.left=h.style.top="-10000px",h.width=d,h.height=e,h.scrolling="no",c.body.appendChild(h),new Promise(function(c){var d=h.contentWindow.document;h.contentWindow.onload=h.onload=function(){var a=setInterval(function(){d.body.childNodes.length>0&&(o(b,d),clearInterval(a),c(h))},50)},d.open(),d.write(""),d.close(),d.replaceChild(f.javascriptEnabled===!0?d.adoptNode(g):p(d.adoptNode(g)),d.documentElement),"view"===f.type&&h.contentWindow.scrollTo(a.pageXOffset,a.pageYOffset)})}function l(b,c,d,e,f,g){return new sb(b,c,a.document).then(m(b)).then(function(a){return k(a,d,e,f,g)})}function m(a){return function(b){var c=new DOMParser,d=c.parseFromString(b,"text/html"),e=d.querySelector("base");if(!e||!e.href.host){var f=d.createElement("base");f.href=a,d.head.insertBefore(f,d.head.firstChild)}return d}}function n(a){[].slice.call(a.querySelectorAll("canvas"),0).forEach(function(a){a.setAttribute(Lb,"canvas-"+Mb++)})}function o(a,b){[].slice.call(a.querySelectorAll("["+Lb+"]"),0).forEach(function(a){try{var c=b.querySelector("["+Lb+'="'+a.getAttribute(Lb)+'"]');c&&(c.width=a.width,c.height=a.height,c.getContext("2d").putImageData(a.getContext("2d").getImageData(0,0,a.width,a.height),0,0))}catch(d){A("Unable to copy canvas content from",a,d)}a.removeAttribute(Lb)})}function p(a){return[].slice.call(a.childNodes,0).filter(q).forEach(function(b){"SCRIPT"===b.tagName?a.removeChild(b):p(b)}),a}function q(a){return a.nodeType===Node.ELEMENT_NODE}function r(a){var c=b.createElement("a");return c.href=a,c.href=c.href,c}function s(a){if(this.src=a,A("DummyImageContainer for",a),!this.promise||!this.image){A("Initiating DummyImageContainer"),s.prototype.image=new Image;var b=this.image;s.prototype.promise=new Promise(function(a,c){b.onload=a,b.onerror=c,b.src=j(),b.complete===!0&&a(b)})}}function t(a,c){var d,e,f=b.createElement("div"),g=b.createElement("img"),h=b.createElement("span"),i="Hidden Text";f.style.visibility="hidden",f.style.fontFamily=a,f.style.fontSize=c,f.style.margin=0,f.style.padding=0,b.body.appendChild(f),g.src=j(),g.width=1,g.height=1,g.style.margin=0,g.style.padding=0,g.style.verticalAlign="baseline",h.style.fontFamily=a,h.style.fontSize=c,h.style.margin=0,h.style.padding=0,h.appendChild(b.createTextNode(i)),f.appendChild(h),f.appendChild(g),d=g.offsetTop-h.offsetTop+1,f.removeChild(h),f.appendChild(b.createTextNode(i)),f.style.lineHeight="normal",g.style.verticalAlign="super",e=g.offsetTop-f.offsetTop+1,b.body.removeChild(f),this.baseline=d,this.lineWidth=1,this.middle=e}function u(){this.data={}}function v(a,b,c){this.image=null,this.src=a;var d=this,e=I(a);this.promise=(b?new Promise(function(b){"about:blank"===a.contentWindow.document.URL||null==a.contentWindow.document.documentElement?a.contentWindow.onload=a.onload=function(){b(a)}:b(a)}):this.proxyLoad(c.proxy,e,c)).then(function(a){return html2canvas(a.contentWindow.document.documentElement,{type:"view",width:a.width,height:a.height,proxy:c.proxy,javascriptEnabled:c.javascriptEnabled,removeContainer:c.removeContainer,allowTaint:c.allowTaint,imageTimeout:c.imageTimeout/2})}).then(function(a){return d.image=a})}function w(a){this.src=a.value,this.colorStops=[],this.type=null,this.x0=.5,this.y0=.5,this.x1=.5,this.y1=.5,this.promise=Promise.resolve(!0)}function x(a,b){this.src=a,this.image=new Image;var c=this;this.tainted=null,this.promise=new Promise(function(d,e){c.image.onload=d,c.image.onerror=e,b&&(c.image.crossOrigin="anonymous"),c.image.src=a,c.image.complete===!0&&d(c.image)})}function y(b,c){this.link=null,this.options=b,this.support=c,this.origin=a.location.protocol+a.location.hostname+a.location.port}function z(a){w.apply(this,arguments),this.type=this.TYPES.LINEAR;var b=null===a.args[0].match(this.stepRegExp);b?a.args[0].split(" ").reverse().forEach(function(a){switch(a){case"left":this.x0=0,this.x1=1;break;case"top":this.y0=0,this.y1=1;break;case"right":this.x0=1,this.x1=0;break;case"bottom":this.y0=1,this.y1=0;break;case"to":var b=this.y0,c=this.x0;this.y0=this.y1,this.x0=this.x1,this.x1=c,this.y1=b}},this):(this.y0=0,this.y1=1),this.colorStops=a.args.slice(b?1:0).map(function(a){var b=a.match(this.stepRegExp);return{color:b[1],stop:"%"===b[3]?b[2]/100:null}},this),null===this.colorStops[0].stop&&(this.colorStops[0].stop=0),null===this.colorStops[this.colorStops.length-1].stop&&(this.colorStops[this.colorStops.length-1].stop=1),this.colorStops.forEach(function(a,b){null===a.stop&&this.colorStops.slice(b).some(function(c,d){return null!==c.stop?(a.stop=(c.stop-this.colorStops[b-1].stop)/(d+1)+this.colorStops[b-1].stop,!0):!1},this)},this)}function A(){a.html2canvas.logging&&a.console&&a.console.log&&Function.prototype.bind.call(a.console.log,a.console).apply(a.console,[Date.now()-a.html2canvas.start+"ms","html2canvas:"].concat([].slice.call(arguments,0)))}function B(a,b){this.node=a,this.parent=b,this.stack=null,this.bounds=null,this.borders=null,this.clip=[],this.backgroundClip=[],this.offsetBounds=null,this.visible=null,this.computedStyles=null,this.styles={},this.backgroundImages=null,this.transformData=null,this.transformMatrix=null}function C(a){var b=a.options[a.selectedIndex||0];return b?b.text||"":""}function D(a){return a&&"matrix"===a[1]?a[2].split(",").map(function(a){return parseFloat(a.trim())}):void 0}function E(a){return-1!==a.toString().indexOf("%")}function F(a){var b,c,d,e,f,g,h,i=" \r\n ",j=[],k=0,l=0,m=function(){b&&('"'===c.substr(0,1)&&(c=c.substr(1,c.length-2)),c&&h.push(c),"-"===b.substr(0,1)&&(e=b.indexOf("-",1)+1)>0&&(d=b.substr(0,e),b=b.substr(e)),j.push({prefix:d,method:b.toLowerCase(),value:f,args:h,image:null})),h=[],b=d=c=f=""};return h=[],b=d=c=f="",a.split("").forEach(function(a){if(!(0===k&&i.indexOf(a)>-1)){switch(a){case'"':g?g===a&&(g=null):g=a;break;case"(":if(g)break;if(0===k)return k=1,void(f+=a);l++;break;case")":if(g)break;if(1===k){if(0===l)return k=0,f+=a,void m();l--}break;case",":if(g)break;if(0===k)return void m();if(1===k&&0===l&&!b.match(/^url$/i))return h.push(c),c="",void(f+=a)}f+=a,0===k?b+=a:c+=a}}),m(),j}function G(a){return a.replace("px","")}function H(a){return parseFloat(a)}function I(a){if(a.getBoundingClientRect){var b=a.getBoundingClientRect(),c=null==a.offsetWidth?b.width:a.offsetWidth;return{top:b.top,bottom:b.bottom||b.top+b.height,right:b.left+c,left:b.left,width:c,height:null==a.offsetHeight?b.height:a.offsetHeight}}return{}}function J(a){var b=a.offsetParent?J(a.offsetParent):{top:0,left:0};return{top:a.offsetTop+b.top,bottom:a.offsetTop+a.offsetHeight+b.top,right:a.offsetLeft+b.left+a.offsetWidth,left:a.offsetLeft+b.left,width:a.offsetWidth,height:a.offsetHeight}}function K(a,b,c,d,e){A("Starting NodeParser"),this.renderer=b,this.options=e,this.range=null,this.support=c,this.renderQueue=[],this.stack=new zb(!0,1,a.ownerDocument,null);var f=new B(a,null);if(a===a.ownerDocument.documentElement){var g=new B(this.renderer.isTransparent(f.css("backgroundColor"))?a.ownerDocument.body:a.ownerDocument.documentElement,null);b.rectangle(0,0,b.width,b.height,g.css("backgroundColor"))}f.visibile=f.isElementVisible(),this.createPseudoHideStyles(a.ownerDocument),this.nodes=nb([f].concat(this.getChildren(f)).filter(function(a){return a.visible=a.isElementVisible()}).map(this.getPseudoElements,this)),this.fontMetrics=new u,A("Fetched nodes, total:",this.nodes.length),this.images=d.fetch(this.nodes.filter(fb)),this.ready=this.images.ready.then(jb(function(){return A("Images loaded, starting parsing"),A("Calculate overflow clips"),this.calculateOverflowClips(),A("Creating stacking contexts"),this.createStackingContexts(),A("Sorting stacking contexts"),this.sortStackingContexts(this.stack),this.parse(this.stack),A("Render queue created with "+this.renderQueue.length+" items"),new Promise(jb(function(a){e.async?"function"==typeof e.async?e.async.call(this,this.renderQueue,a):(this.renderIndex=0,this.asyncRenderer(this.renderQueue,a)):(this.renderQueue.forEach(this.paint,this),a())},this))},this))}function L(a){return a.parent&&a.parent.clip.length}function M(a){return a.replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")})}function N(){}function O(a,b,c,d){var e=4*((Math.sqrt(2)-1)/3),f=c*e,g=d*e,h=a+c,i=b+d;return{topLeft:Q({x:a,y:i},{x:a,y:i-g},{x:h-f,y:b},{x:h,y:b}),topRight:Q({x:a,y:b},{x:a+f,y:b},{x:h,y:i-g},{x:h,y:i}),bottomRight:Q({x:h,y:b},{x:h,y:b+g},{x:a+f,y:i},{x:a,y:i}),bottomLeft:Q({x:h,y:i},{x:h-f,y:i},{x:a,y:b+g},{x:a,y:b})}}function P(a,b,c){var d=a.left,e=a.top,f=a.width,g=a.height,h=b[0][0],i=b[0][1],j=b[1][0],k=b[1][1],l=b[2][0],m=b[2][1],n=b[3][0],o=b[3][1],p=f-j,q=g-m,r=f-l,s=g-o;return{topLeftOuter:O(d,e,h,i).topLeft.subdivide(.5),topLeftInner:O(d+c[3].width,e+c[0].width,Math.max(0,h-c[3].width),Math.max(0,i-c[0].width)).topLeft.subdivide(.5),topRightOuter:O(d+p,e,j,k).topRight.subdivide(.5),topRightInner:O(d+Math.min(p,f+c[3].width),e+c[0].width,p>f+c[3].width?0:j-c[3].width,k-c[0].width).topRight.subdivide(.5),bottomRightOuter:O(d+r,e+q,l,m).bottomRight.subdivide(.5),bottomRightInner:O(d+Math.min(r,f+c[3].width),e+Math.min(q,g+c[0].width),Math.max(0,l-c[1].width),Math.max(0,m-c[2].width)).bottomRight.subdivide(.5),bottomLeftOuter:O(d,e+s,n,o).bottomLeft.subdivide(.5),bottomLeftInner:O(d+c[3].width,e+s,Math.max(0,n-c[3].width),Math.max(0,o-c[2].width)).bottomLeft.subdivide(.5)}}function Q(a,b,c,d){var e=function(a,b,c){return{x:a.x+(b.x-a.x)*c,y:a.y+(b.y-a.y)*c}};return{start:a,startControl:b,endControl:c,end:d,subdivide:function(f){var g=e(a,b,f),h=e(b,c,f),i=e(c,d,f),j=e(g,h,f),k=e(h,i,f),l=e(j,k,f);return[Q(a,g,j,l),Q(l,k,i,d)]},curveTo:function(a){a.push(["bezierCurve",b.x,b.y,c.x,c.y,d.x,d.y])},curveToReversed:function(d){d.push(["bezierCurve",c.x,c.y,b.x,b.y,a.x,a.y])}}}function R(a,b,c,d,e,f,g){var h=[];return b[0]>0||b[1]>0?(h.push(["line",d[1].start.x,d[1].start.y]),d[1].curveTo(h)):h.push(["line",a.c1[0],a.c1[1]]),c[0]>0||c[1]>0?(h.push(["line",f[0].start.x,f[0].start.y]),f[0].curveTo(h),h.push(["line",g[0].end.x,g[0].end.y]),g[0].curveToReversed(h)):(h.push(["line",a.c2[0],a.c2[1]]),h.push(["line",a.c3[0],a.c3[1]])),b[0]>0||b[1]>0?(h.push(["line",e[1].end.x,e[1].end.y]),e[1].curveToReversed(h)):h.push(["line",a.c4[0],a.c4[1]]),h}function S(a,b,c,d,e,f,g){b[0]>0||b[1]>0?(a.push(["line",d[0].start.x,d[0].start.y]),d[0].curveTo(a),d[1].curveTo(a)):a.push(["line",f,g]),(c[0]>0||c[1]>0)&&a.push(["line",e[0].start.x,e[0].start.y])}function T(a){return a.cssInt("zIndex")<0}function U(a){return a.cssInt("zIndex")>0}function V(a){return 0===a.cssInt("zIndex")}function W(a){return-1!==["inline","inline-block","inline-table"].indexOf(a.css("display"))}function X(a){return a instanceof zb}function Y(a){return a.node.data.trim().length>0}function Z(a){return/^(normal|none|0px)$/.test(a.parent.css("letterSpacing"))}function $(a){return["TopLeft","TopRight","BottomRight","BottomLeft"].map(function(b){var c=a.css("border"+b+"Radius"),d=c.split(" ");return d.length<=1&&(d[1]=d[0]),d.map(kb)})}function _(a){return a.nodeType===Node.TEXT_NODE||a.nodeType===Node.ELEMENT_NODE}function ab(a){var b=a.css("position"),c=-1!==["absolute","relative","fixed"].indexOf(b)?a.css("zIndex"):"auto";return"auto"!==c}function bb(a){return"static"!==a.css("position")}function cb(a){return"none"!==a.css("float")}function db(a){return-1!==["inline-block","inline-table"].indexOf(a.css("display"))}function eb(a){var b=this;return function(){return!a.apply(b,arguments)}}function fb(a){return a.node.nodeType===Node.ELEMENT_NODE}function gb(a){return a.node.nodeType===Node.TEXT_NODE}function hb(a,b){return a.cssInt("zIndex")-b.cssInt("zIndex")}function ib(a){return a.css("opacity")<1}function jb(a,b){return function(){return a.apply(b,arguments)}}function kb(a){return parseInt(a,10)}function lb(a){return a.width}function mb(a){return a.node.nodeType!==Node.ELEMENT_NODE||-1===["SCRIPT","HEAD","TITLE","OBJECT","BR","OPTION"].indexOf(a.node.nodeName)}function nb(a){return[].concat.apply([],a)}function ob(a){var b=a.substr(0,1);return b===a.substr(a.length-1)&&b.match(/'|"/)?a.substr(1,a.length-2):a}function pb(b){for(var c,d=[],e=0,f=!1;b.length;)qb(b[e])===f?(c=b.splice(0,e),c.length&&d.push(a.html2canvas.punycode.ucs2.encode(c)),f=!f,e=0):e++,e>=b.length&&(c=b.splice(0,e),c.length&&d.push(a.html2canvas.punycode.ucs2.encode(c)));return d}function qb(a){return-1!==[32,13,10,9,45].indexOf(a)}function rb(a){return/[^\u0000-\u00ff]/.test(a)}function sb(a,b,c){var d=vb(Ob),e=wb(b,a,d);return Ob?Hb(e):ub(c,e,d).then(function(a){return Cb(a.content)})}function tb(a,b,c){var d=vb(Pb),e=wb(b,a,d);return Pb?Promise.resolve(e):ub(c,e,d).then(function(a){return"data:"+a.type+";base64,"+a.content})}function ub(b,c,d){return new Promise(function(e,f){var g=b.createElement("script"),h=function(){delete a.html2canvas.proxy[d],b.body.removeChild(g)};a.html2canvas.proxy[d]=function(a){h(),e(a)},g.src=c,g.onerror=function(a){h(),f(a)},b.body.appendChild(g)})}function vb(a){return a?"":"html2canvas_"+Date.now()+"_"+ ++Nb+"_"+Math.round(1e5*Math.random())}function wb(a,b,c){return a+"?url="+encodeURIComponent(b)+(c.length?"&callback=html2canvas.proxy."+c:"")}function xb(a,c){var d=(b.createElement("script"),b.createElement("a"));d.href=a,a=d.href,this.src=a,this.image=new Image;var e=this;this.promise=new Promise(function(d,f){e.image.crossOrigin="Anonymous",e.image.onload=d,e.image.onerror=f,new tb(a,c,b).then(function(a){e.image.src=a})["catch"](f)})}function yb(a,b,c,d,e){this.width=a,this.height=b,this.images=c,this.options=d,this.document=e}function zb(a,b,c,d){B.call(this,c,d),this.ownStacking=a,this.contexts=[],this.children=[],this.opacity=(this.parent?this.parent.stack.opacity:1)*b}function Ab(a){this.rangeBounds=this.testRangeBounds(a),this.cors=this.testCORS(),this.svg=this.testSVG()}function Bb(a){this.src=a,this.image=null;var b=this;this.promise=this.hasFabric().then(function(){return b.isInline(a)?Promise.resolve(b.inlineFormatting(a)):Hb(a)}).then(function(a){return new Promise(function(c){html2canvas.fabric.loadSVGFromString(a,b.createCanvas.call(b,c))})})}function Cb(a){var b,c,d,e,f,g,h,i,j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k=a.length,l="";for(b=0;k>b;b+=4)c=j.indexOf(a[b]),d=j.indexOf(a[b+1]),e=j.indexOf(a[b+2]),f=j.indexOf(a[b+3]),g=c<<2|d>>4,h=(15&d)<<4|e>>2,i=(3&e)<<6|f,l+=64===e?String.fromCharCode(g):64===f||-1===f?String.fromCharCode(g,h):String.fromCharCode(g,h,i);return l}function Db(a,b){this.src=a,this.image=null;var c=this;this.promise=b?new Promise(function(b,d){c.image=new Image,c.image.onload=b,c.image.onerror=d,c.image.src="data:image/svg+xml,"+(new XMLSerializer).serializeToString(a),c.image.complete===!0&&b(c.image)}):this.hasFabric().then(function(){return new Promise(function(b){html2canvas.fabric.parseSVGDocument(a,c.createCanvas.call(c,b))})})}function Eb(a,b){B.call(this,a,b)}function Fb(a,b,c){return a.length>0?b+c.toUpperCase():void 0}function Gb(a){w.apply(this,arguments),this.type="linear"===a.args[0]?this.TYPES.LINEAR:this.TYPES.RADIAL}function Hb(a){return new Promise(function(b,c){var d=new XMLHttpRequest;d.open("GET",a),d.onload=function(){200===d.status?b(d.responseText):c(new Error(d.statusText))},d.onerror=function(){c(new Error("Network Error"))},d.send()})}function Ib(a,b){yb.apply(this,arguments),this.canvas=this.document.createElement("canvas"),this.canvas.width=a,this.canvas.height=b,this.ctx=this.canvas.getContext("2d"),this.taintCtx=this.document.createElement("canvas").getContext("2d"),this.ctx.textBaseline="bottom",this.variables={},A("Initialized CanvasRenderer with size",a,"x",b)}function Jb(a){return a.length>0}if(!function(){var c,d,e,f;!function(){var a={},b={};c=function(b,c,d){a[b]={deps:c,callback:d}},f=e=d=function(c){function e(a){if("."!==a.charAt(0))return a;for(var b=a.split("/"),d=c.split("/").slice(0,-1),e=0,f=b.length;f>e;e++){var g=b[e];if(".."===g)d.pop();else{if("."===g)continue;d.push(g)}}return d.join("/")}if(f._eak_seen=a,b[c])return b[c];if(b[c]={},!a[c])throw new Error("Could not find module "+c);for(var g,h=a[c],i=h.deps,j=h.callback,k=[],l=0,m=i.length;m>l;l++)k.push("exports"===i[l]?g={}:d(e(i[l])));var n=j.apply(this,k);return b[c]=g||n}}(),c("promise/all",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to all.");return new b(function(b,c){function d(a){return function(b){f(a,b)}}function f(a,c){h[a]=c,0===--i&&b(h)}var g,h=[],i=a.length;0===i&&b([]);for(var j=0;j1&&(e=d[0]+"@",a=d[1]);var f=a.split(D),g=c(f,b).join(".");return e+g}function e(a){for(var b,c,d=[],e=0,f=a.length;f>e;)b=a.charCodeAt(e++),b>=55296&&56319>=b&&f>e?(c=a.charCodeAt(e++),56320==(64512&c)?d.push(((1023&b)<<10)+(1023&c)+65536):(d.push(b),e--)):d.push(b);return d}function f(a){return c(a,function(a){var b="";return a>65535&&(a-=65536,b+=H(a>>>10&1023|55296),a=56320|1023&a),b+=H(a)}).join("")}function g(a){return 10>a-48?a-22:26>a-65?a-65:26>a-97?a-97:t}function h(a,b){return a+22+75*(26>a)-((0!=b)<<5)}function i(a,b,c){var d=0;for(a=c?G(a/x):a>>1,a+=G(a/b);a>F*v>>1;d+=t)a=G(a/F);return G(d+(F+1)*a/(a+w))}function j(a){var c,d,e,h,j,k,l,m,n,o,p=[],q=a.length,r=0,w=z,x=y;for(d=a.lastIndexOf(A),0>d&&(d=0),e=0;d>e;++e)a.charCodeAt(e)>=128&&b("not-basic"),p.push(a.charCodeAt(e));for(h=d>0?d+1:0;q>h;){for(j=r,k=1,l=t;h>=q&&b("invalid-input"),m=g(a.charCodeAt(h++)),(m>=t||m>G((s-r)/k))&&b("overflow"),r+=m*k,n=x>=l?u:l>=x+v?v:l-x,!(n>m);l+=t)o=t-n,k>G(s/o)&&b("overflow"),k*=o;c=p.length+1,x=i(r-j,c,0==j),G(r/c)>s-w&&b("overflow"),w+=G(r/c),r%=c,p.splice(r++,0,w)}return f(p)}function k(a){var c,d,f,g,j,k,l,m,n,o,p,q,r,w,x,B=[];for(a=e(a),q=a.length,c=z,d=0,j=y,k=0;q>k;++k)p=a[k],128>p&&B.push(H(p));for(f=g=B.length,g&&B.push(A);q>f;){for(l=s,k=0;q>k;++k)p=a[k],p>=c&&l>p&&(l=p);for(r=f+1,l-c>G((s-d)/r)&&b("overflow"),d+=(l-c)*r,c=l,k=0;q>k;++k)if(p=a[k],c>p&&++d>s&&b("overflow"),p==c){for(m=d,n=t;o=j>=n?u:n>=j+v?v:n-j,!(o>m);n+=t)x=m-o,w=t-o,B.push(H(h(o+x%w,0))),m=G(x/w);B.push(H(h(m,0))),j=i(d,r,f==g),d=0,++f}++d,++c}return B.join("")}function l(a){return d(a,function(a){return B.test(a)?j(a.slice(4).toLowerCase()):a})}function m(a){return d(a,function(a){return C.test(a)?"xn--"+k(a):a})}var n="object"==typeof exports&&exports&&!exports.nodeType&&exports,o="object"==typeof module&&module&&!module.nodeType&&module,p="object"==typeof global&&global;(p.global===p||p.window===p||p.self===p)&&(a=p);var q,r,s=2147483647,t=36,u=1,v=26,w=38,x=700,y=72,z=128,A="-",B=/^xn--/,C=/[^\x20-\x7E]/,D=/[\x2E\u3002\uFF0E\uFF61]/g,E={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},F=t-u,G=Math.floor,H=String.fromCharCode;if(q={version:"1.3.1",ucs2:{decode:e,encode:f},decode:j,encode:k,toASCII:m,toUnicode:l},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return q});else if(n&&o)if(module.exports==n)o.exports=q;else for(r in q)q.hasOwnProperty(r)&&(n[r]=q[r]);else a.punycode=q}(this);var Kb="data-html2canvas-node",Lb="data-html2canvas-canvas-clone",Mb=0;a.html2canvas=function(f,g){if(g=g||{},g.logging&&(a.html2canvas.logging=!0,a.html2canvas.start=Date.now()),g.async="undefined"==typeof g.async?!0:g.async,g.allowTaint="undefined"==typeof g.allowTaint?!1:g.allowTaint,g.removeContainer="undefined"==typeof g.removeContainer?!0:g.removeContainer,g.javascriptEnabled="undefined"==typeof g.javascriptEnabled?!1:g.javascriptEnabled,g.imageTimeout="undefined"==typeof g.imageTimeout?1e4:g.imageTimeout,"string"==typeof f)return"string"!=typeof g.proxy?Promise.reject("Proxy must be used when rendering url"):l(r(f),g.proxy,b,a.innerWidth,a.innerHeight,g).then(function(b){return e(b.contentWindow.document.documentElement,b,g,a.innerWidth,a.innerHeight)});var h=(f===c?[b.documentElement]:f.length?f:[f])[0];return h.setAttribute(Kb,"true"),d(h.ownerDocument,g,h.ownerDocument.defaultView.innerWidth,h.ownerDocument.defaultView.innerHeight).then(function(a){return"function"==typeof g.onrendered&&(A("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas"),g.onrendered(a)),a})},a.html2canvas.punycode=this.punycode,a.html2canvas.proxy={},u.prototype.getMetrics=function(a,b){return this.data[a+"-"+b]===c&&(this.data[a+"-"+b]=new t(a,b)),this.data[a+"-"+b]},v.prototype.proxyLoad=function(a,b,c){var d=this.src;return l(d.src,a,d.ownerDocument,b.width,b.height,c)},w.prototype.TYPES={LINEAR:1,RADIAL:2},y.prototype.findImages=function(a){var b=[];return a.reduce(function(a,b){switch(b.node.nodeName){case"IMG":return a.concat([{args:[b.node.src],method:"url"}]);case"svg":case"IFRAME":return a.concat([{args:[b.node],method:b.node.nodeName}])}return a},[]).forEach(this.addImage(b,this.loadImage),this),b},y.prototype.findBackgroundImage=function(a,b){return b.parseBackgroundImages().filter(this.hasImageBackground).forEach(this.addImage(a,this.loadImage),this),a},y.prototype.addImage=function(a,b){return function(c){c.args.forEach(function(d){this.imageExists(a,d)||(a.splice(0,0,b.call(this,c)),A("Added image #"+a.length,"string"==typeof d?d.substring(0,100):d))},this)}},y.prototype.hasImageBackground=function(a){return"none"!==a.method},y.prototype.loadImage=function(a){if("url"===a.method){var b=a.args[0];return!this.isSVG(b)||this.support.svg||this.options.allowTaint?b.match(/data:image\/.*;base64,/i)?new x(b.replace(/url\(['"]{0,}|['"]{0,}\)$/gi,""),!1):this.isSameOrigin(b)||this.options.allowTaint===!0||this.isSVG(b)?new x(b,!1):this.support.cors&&!this.options.allowTaint&&this.options.useCORS?new x(b,!0):this.options.proxy?new xb(b,this.options.proxy):new s(b):new Bb(b)}return"linear-gradient"===a.method?new z(a):"gradient"===a.method?new Gb(a):"svg"===a.method?new Db(a.args[0],this.support.svg):"IFRAME"===a.method?new v(a.args[0],this.isSameOrigin(a.args[0].src),this.options):new s(a)},y.prototype.isSVG=function(a){return/(.+).svg$/i.test(a)||Bb.prototype.isInline(a)},y.prototype.imageExists=function(a,b){return a.some(function(a){return a.src===b})},y.prototype.isSameOrigin=function(a){var c=this.link||(this.link=b.createElement("a"));c.href=a,c.href=c.href;var d=c.protocol+c.hostname+c.port;return d===this.origin},y.prototype.getPromise=function(a){return this.timeout(a,this.options.imageTimeout)["catch"](function(){var b=new s(a.src);return b.promise.then(function(b){a.image=b})})},y.prototype.get=function(a){var b=null;return this.images.some(function(c){return(b=c).src===a})?b:null},y.prototype.fetch=function(a){return this.images=a.reduce(jb(this.findBackgroundImage,this),this.findImages(a)),this.images.forEach(function(a,b){a.promise.then(function(){A("Succesfully loaded image #"+(b+1),a)},function(c){A("Failed loading image #"+(b+1),a,c)})}),this.ready=Promise.all(this.images.map(this.getPromise,this)),A("Finished searching images"),this},y.prototype.timeout=function(a,b){var c;return Promise.race([a.promise,new Promise(function(d,e){c=setTimeout(function(){A("Timed out loading image",a),e(a)},b)})]).then(function(a){return clearTimeout(c),a})},z.prototype=Object.create(w.prototype),z.prototype.stepRegExp=/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\))\s*(\d{1,3})?(%|px)?/,B.prototype.assignStack=function(a){this.stack=a,a.children.push(this)},B.prototype.isElementVisible=function(){return this.node.nodeType===Node.TEXT_NODE?this.parent.visible:"none"!==this.css("display")&&"hidden"!==this.css("visibility")&&!this.node.hasAttribute("data-html2canvas-ignore")&&("INPUT"!==this.node.nodeName||"hidden"!==this.node.getAttribute("type"))},B.prototype.css=function(a){return this.computedStyles||(this.computedStyles=this.computedStyle(null)),this.styles[a]||(this.styles[a]=this.computedStyles[a])},B.prototype.prefixedCss=function(a){var b=["webkit","moz","ms","o"],d=this.css(a);return d===c&&b.some(function(b){return d=this.css(b+a.substr(0,1).toUpperCase()+a.substr(1)),d!==c},this),d===c?null:d},B.prototype.computedStyle=function(a){return this.node.ownerDocument.defaultView.getComputedStyle(this.node,a)},B.prototype.cssInt=function(a){var b=parseInt(this.css(a),10);return isNaN(b)?0:b},B.prototype.cssFloat=function(a){var b=parseFloat(this.css(a));return isNaN(b)?0:b},B.prototype.fontWeight=function(){var a=this.css("fontWeight");switch(parseInt(a,10)){case 401:a="bold";break;case 400:a="normal"}return a},B.prototype.parseBackgroundImages=function(){return this.backgroundImages||(this.backgroundImages=F(this.css("backgroundImage")))},B.prototype.cssList=function(a,b){var c=(this.css(a)||"").split(",");return c=c[b||0]||c[0]||"auto",c=c.trim().split(" "),1===c.length&&(c=[c[0],c[0]]),c},B.prototype.parseBackgroundSize=function(a,b,c){var d,e,f=this.cssList("backgroundSize",c);if(E(f[0]))d=a.width*parseFloat(f[0])/100;else{if(/contain|cover/.test(f[0])){var g=a.width/a.height,h=b.width/b.height;return h>g^"contain"===f[0]?{width:a.height*h,height:a.height}:{width:a.width,height:a.width/h}}d=parseInt(f[0],10)}return e="auto"===f[0]&&"auto"===f[1]?b.height:"auto"===f[1]?d/b.width*b.height:E(f[1])?a.height*parseFloat(f[1])/100:parseInt(f[1],10),"auto"===f[0]&&(d=e/b.height*b.width),{width:d,height:e}},B.prototype.parseBackgroundPosition=function(a,b,c,d){var e,f,g=this.cssList("backgroundPosition",c);return e=E(g[0])?(a.width-(d||b).width)*(parseFloat(g[0])/100):parseInt(g[0],10),f="auto"===g[1]?e/b.width*b.height:E(g[1])?(a.height-(d||b).height)*parseFloat(g[1])/100:parseInt(g[1],10),"auto"===g[0]&&(e=f/b.height*b.width),{left:e,top:f} -},B.prototype.parseBackgroundRepeat=function(a){return this.cssList("backgroundRepeat",a)[0]},B.prototype.parseTextShadows=function(){var a=this.css("textShadow"),b=[];if(a&&"none"!==a)for(var c=a.match(this.TEXT_SHADOW_PROPERTY),d=0;c&&dDate.now()?this.asyncRenderer(a,b,c):setTimeout(jb(function(){this.asyncRenderer(a,b)},this),0)},K.prototype.createPseudoHideStyles=function(a){var b=a.createElement("style");b.innerHTML="."+this.pseudoHideClass+':before { content: "" !important; display: none !important; }.'+this.pseudoHideClass+':after { content: "" !important; display: none !important; }',a.body.appendChild(b)},K.prototype.getPseudoElements=function(a){var b=[[a]];if(a.node.nodeType===Node.ELEMENT_NODE){var c=this.getPseudoElement(a,":before"),d=this.getPseudoElement(a,":after");c&&(a.node.insertBefore(c[0].node,a.node.firstChild),b.push(c)),d&&(a.node.appendChild(d[0].node),b.push(d)),(c||d)&&(a.node.className+=" "+this.pseudoHideClass)}return nb(b)},K.prototype.getPseudoElement=function(a,c){var d=a.computedStyle(c);if(!d||!d.content||"none"===d.content||"-moz-alt-content"===d.content||"none"===d.display)return null;for(var e=ob(d.content),f="url"===e.substr(0,3),g=b.createElement(f?"img":"html2canvaspseudoelement"),h=new B(g,a),i=d.length-1;i>=0;i--){var j=M(d.item(i));g.style[j]=d[j]}if(g.className=this.pseudoHideClass,f)return g.src=F(e)[0].args[0],[h];var k=b.createTextNode(e);return g.appendChild(k),[h,new Eb(k,h)]},K.prototype.getChildren=function(a){return nb([].filter.call(a.node.childNodes,_).map(function(b){var c=[b.nodeType===Node.TEXT_NODE?new Eb(b,a):new B(b,a)].filter(mb);return b.nodeType===Node.ELEMENT_NODE&&c.length&&"TEXTAREA"!==b.tagName?c[0].isElementVisible()?c.concat(this.getChildren(c[0])):[]:c},this))},K.prototype.newStackingContext=function(a,b){var c=new zb(b,a.cssFloat("opacity"),a.node,a.parent);c.visible=a.visible,c.borders=a.borders,c.bounds=a.bounds,c.clip=a.clip,c.backgroundClip=a.backgroundClip;var d=b?c.getParentStack(this):c.parent.stack;d.contexts.push(c),a.stack=c},K.prototype.createStackingContexts=function(){this.nodes.forEach(function(a){fb(a)&&(this.isRootElement(a)||ib(a)||ab(a)||this.isBodyWithTransparentRoot(a)||a.hasTransform())?this.newStackingContext(a,!0):fb(a)&&(bb(a)&&V(a)||db(a)||cb(a))?this.newStackingContext(a,!1):a.assignStack(a.parent.stack)},this)},K.prototype.isBodyWithTransparentRoot=function(a){return"BODY"===a.node.nodeName&&this.renderer.isTransparent(a.parent.css("backgroundColor"))},K.prototype.isRootElement=function(a){return null===a.parent},K.prototype.sortStackingContexts=function(a){a.contexts.sort(hb),a.contexts.forEach(this.sortStackingContexts,this)},K.prototype.parseTextBounds=function(a){return function(b,c,d){if("none"!==a.parent.css("textDecoration").substr(0,4)||0!==b.trim().length){if(this.support.rangeBounds&&!a.parent.hasTransform()){var e=d.slice(0,c).join("").length;return this.getRangeBounds(a.node,e,b.length)}if(a.node&&"string"==typeof a.node.data){var f=a.node.splitText(b.length),g=this.getWrapperBounds(a.node,a.parent.hasTransform());return a.node=f,g}}else(!this.support.rangeBounds||a.parent.hasTransform())&&(a.node=a.node.splitText(b.length));return{}}},K.prototype.getWrapperBounds=function(a,b){var c=a.ownerDocument.createElement("html2canvaswrapper"),d=a.parentNode,e=a.cloneNode(!0);c.appendChild(a.cloneNode(!0)),d.replaceChild(c,a);var f=b?J(c):I(c);return d.replaceChild(e,c),f},K.prototype.getRangeBounds=function(a,b,c){var d=this.range||(this.range=a.ownerDocument.createRange());return d.setStart(a,b),d.setEnd(a,b+c),d.getBoundingClientRect()},K.prototype.parse=function(a){var b=a.contexts.filter(T),c=a.children.filter(fb),d=c.filter(eb(cb)),e=d.filter(eb(bb)).filter(eb(W)),f=c.filter(eb(bb)).filter(cb),g=d.filter(eb(bb)).filter(W),h=a.contexts.concat(d.filter(bb)).filter(V),i=a.children.filter(gb).filter(Y),j=a.contexts.filter(U);b.concat(e).concat(f).concat(g).concat(h).concat(i).concat(j).forEach(function(a){this.renderQueue.push(a),X(a)&&(this.parse(a),this.renderQueue.push(new N))},this)},K.prototype.paint=function(a){try{a instanceof N?this.renderer.ctx.restore():gb(a)?this.paintText(a):this.paintNode(a)}catch(b){A(b)}},K.prototype.paintNode=function(a){X(a)&&(this.renderer.setOpacity(a.opacity),this.renderer.ctx.save(),a.hasTransform()&&this.renderer.setTransform(a.parseTransform()));var b=a.parseBounds();this.renderer.clip(a.backgroundClip,function(){this.renderer.renderBackground(a,b,a.borders.borders.map(lb))},this),this.renderer.clip(a.clip,function(){switch(this.renderer.renderBorders(a.borders.borders),a.node.nodeName){case"svg":case"IFRAME":var c=this.images.get(a.node);c?this.renderer.renderImage(a,b,a.borders,c):A("Error loading <"+a.node.nodeName+">",a.node);break;case"IMG":var d=this.images.get(a.node.src);d?this.renderer.renderImage(a,b,a.borders,d):A("Error loading ",a.node.src);break;case"CANVAS":this.renderer.renderImage(a,b,a.borders,{image:a.node});break;case"SELECT":case"INPUT":case"TEXTAREA":this.paintFormValue(a)}},this)},K.prototype.paintFormValue=function(a){if(a.getValue().length>0){var b=a.node.ownerDocument,c=b.createElement("html2canvaswrapper"),d=["lineHeight","textAlign","fontFamily","fontWeight","fontSize","color","paddingLeft","paddingTop","paddingRight","paddingBottom","width","height","borderLeftStyle","borderTopStyle","borderLeftWidth","borderTopWidth","boxSizing","whiteSpace","wordWrap"];d.forEach(function(b){try{c.style[b]=a.css(b)}catch(d){A("html2canvas: Parse: Exception caught in renderFormValue: "+d.message)}});var e=a.parseBounds();c.style.position="absolute",c.style.left=e.left+"px",c.style.top=e.top+"px",c.textContent=a.getValue(),b.body.appendChild(c),this.paintText(new Eb(c.firstChild,a)),b.body.removeChild(c)}},K.prototype.paintText=function(b){b.applyTextTransform();var c=a.html2canvas.punycode.ucs2.decode(b.node.data),d=this.options.letterRendering&&!Z(b)||rb(b.node.data)?c.map(function(b){return a.html2canvas.punycode.ucs2.encode([b])}):pb(c),e=b.parent.fontWeight(),f=b.parent.css("fontSize"),g=b.parent.css("fontFamily"),h=b.parent.parseTextShadows();this.renderer.font(b.parent.css("color"),b.parent.css("fontStyle"),b.parent.css("fontVariant"),e,f,g),h.length?this.renderer.fontShadow(h[0].color,h[0].offsetX,h[0].offsetY,h[0].blur):this.renderer.clearShadow(),this.renderer.clip(b.parent.clip,function(){d.map(this.parseTextBounds(b),this).forEach(function(a,c){a&&(this.renderer.text(d[c],a.left,a.bottom),this.renderTextDecoration(b.parent,a,this.fontMetrics.getMetrics(g,f)))},this)},this)},K.prototype.renderTextDecoration=function(a,b,c){switch(a.css("textDecoration").split(" ")[0]){case"underline":this.renderer.rectangle(b.left,Math.round(b.top+c.baseline+c.lineWidth),b.width,1,a.css("color"));break;case"overline":this.renderer.rectangle(b.left,Math.round(b.top),b.width,1,a.css("color"));break;case"line-through":this.renderer.rectangle(b.left,Math.ceil(b.top+c.middle+c.lineWidth),b.width,1,a.css("color"))}},K.prototype.parseBorders=function(a){var b=a.parseBounds(),c=$(a),d=["Top","Right","Bottom","Left"].map(function(b){return{width:a.cssInt("border"+b+"Width"),color:a.css("border"+b+"Color"),args:null}}),e=P(b,c,d);return{clip:this.parseBackgroundClip(a,e,d,c,b),borders:d.map(function(a,f){if(a.width>0){var g=b.left,h=b.top,i=b.width,j=b.height-d[2].width;switch(f){case 0:j=d[0].width,a.args=R({c1:[g,h],c2:[g+i,h],c3:[g+i-d[1].width,h+j],c4:[g+d[3].width,h+j]},c[0],c[1],e.topLeftOuter,e.topLeftInner,e.topRightOuter,e.topRightInner);break;case 1:g=b.left+b.width-d[1].width,i=d[1].width,a.args=R({c1:[g+i,h],c2:[g+i,h+j+d[2].width],c3:[g,h+j],c4:[g,h+d[0].width]},c[1],c[2],e.topRightOuter,e.topRightInner,e.bottomRightOuter,e.bottomRightInner);break;case 2:h=h+b.height-d[2].width,j=d[2].width,a.args=R({c1:[g+i,h+j],c2:[g,h+j],c3:[g+d[3].width,h],c4:[g+i-d[3].width,h]},c[2],c[3],e.bottomRightOuter,e.bottomRightInner,e.bottomLeftOuter,e.bottomLeftInner);break;case 3:i=d[3].width,a.args=R({c1:[g,h+j+d[2].width],c2:[g,h],c3:[g+i,h+d[0].width],c4:[g+i,h+j]},c[3],c[0],e.bottomLeftOuter,e.bottomLeftInner,e.topLeftOuter,e.topLeftInner)}}return a})}},K.prototype.parseBackgroundClip=function(a,b,c,d,e){var f=a.css("backgroundClip"),g=[];switch(f){case"content-box":case"padding-box":S(g,d[0],d[1],b.topLeftInner,b.topRightInner,e.left+c[3].width,e.top+c[0].width),S(g,d[1],d[2],b.topRightInner,b.bottomRightInner,e.left+e.width-c[1].width,e.top+c[0].width),S(g,d[2],d[3],b.bottomRightInner,b.bottomLeftInner,e.left+e.width-c[1].width,e.top+e.height-c[2].width),S(g,d[3],d[0],b.bottomLeftInner,b.topLeftInner,e.left+c[3].width,e.top+e.height-c[2].width);break;default:S(g,d[0],d[1],b.topLeftOuter,b.topRightOuter,e.left,e.top),S(g,d[1],d[2],b.topRightOuter,b.bottomRightOuter,e.left+e.width,e.top),S(g,d[2],d[3],b.bottomRightOuter,b.bottomLeftOuter,e.left+e.width,e.top+e.height),S(g,d[3],d[0],b.bottomLeftOuter,b.topLeftOuter,e.left,e.top+e.height)}return g},K.prototype.pseudoHideClass="___html2canvas___pseudoelement";var Nb=0,Ob="withCredentials"in new XMLHttpRequest,Pb="crossOrigin"in new Image;yb.prototype.renderImage=function(a,b,c,d){var e=a.cssInt("paddingLeft"),f=a.cssInt("paddingTop"),g=a.cssInt("paddingRight"),h=a.cssInt("paddingBottom"),i=c.borders,j=b.width-(i[1].width+i[3].width+e+g),k=b.height-(i[0].width+i[2].width+f+h);this.drawImage(d,0,0,d.image.width||j,d.image.height||k,b.left+e+i[3].width,b.top+f+i[0].width,j,k)},yb.prototype.renderBackground=function(a,b,c){b.height>0&&b.width>0&&(this.renderBackgroundColor(a,b),this.renderBackgroundImage(a,b,c))},yb.prototype.renderBackgroundColor=function(a,b){var c=a.css("backgroundColor");this.isTransparent(c)||this.rectangle(b.left,b.top,b.width,b.height,a.css("backgroundColor"))},yb.prototype.renderBorders=function(a){a.forEach(this.renderBorder,this)},yb.prototype.renderBorder=function(a){this.isTransparent(a.color)||null===a.args||this.drawShape(a.args,a.color)},yb.prototype.renderBackgroundImage=function(a,b,c){var d=a.parseBackgroundImages();d.reverse().forEach(function(d,e,f){switch(d.method){case"url":var g=this.images.get(d.args[0]);g?this.renderBackgroundRepeating(a,b,g,f.length-(e+1),c):A("Error loading background-image",d.args[0]);break;case"linear-gradient":case"gradient":var h=this.images.get(d.value);h?this.renderBackgroundGradient(h,b,c):A("Error loading background-image",d.args[0]);break;case"none":break;default:A("Unknown background-image type",d.args[0])}},this)},yb.prototype.renderBackgroundRepeating=function(a,b,c,d,e){var f=a.parseBackgroundSize(b,c.image,d),g=a.parseBackgroundPosition(b,c.image,d,f),h=a.parseBackgroundRepeat(d);switch(h){case"repeat-x":case"repeat no-repeat":this.backgroundRepeatShape(c,g,f,b,b.left+e[3],b.top+g.top+e[0],99999,f.height,e);break;case"repeat-y":case"no-repeat repeat":this.backgroundRepeatShape(c,g,f,b,b.left+g.left+e[3],b.top+e[0],f.width,99999,e);break;case"no-repeat":this.backgroundRepeatShape(c,g,f,b,b.left+g.left+e[3],b.top+g.top+e[0],f.width,f.height,e);break;default:this.renderBackgroundRepeat(c,g,f,{top:b.top,left:b.left},e[3],e[0])}},yb.prototype.isTransparent=function(a){return!a||"transparent"===a||"rgba(0, 0, 0, 0)"===a},zb.prototype=Object.create(B.prototype),zb.prototype.getParentStack=function(a){var b=this.parent?this.parent.stack:null;return b?b.ownStacking?b:b.getParentStack(a):a.stack},Ab.prototype.testRangeBounds=function(a){var b,c,d,e,f=!1;return a.createRange&&(b=a.createRange(),b.getBoundingClientRect&&(c=a.createElement("boundtest"),c.style.height="123px",c.style.display="block",a.body.appendChild(c),b.selectNode(c),d=b.getBoundingClientRect(),e=d.height,123===e&&(f=!0),a.body.removeChild(c))),f},Ab.prototype.testCORS=function(){return"undefined"!=typeof(new Image).crossOrigin},Ab.prototype.testSVG=function(){var a=new Image,c=b.createElement("canvas"),d=c.getContext("2d");a.src="data:image/svg+xml,";try{d.drawImage(a,0,0),c.toDataURL()}catch(e){return!1}return!0},Bb.prototype.hasFabric=function(){return html2canvas.fabric?Promise.resolve():Promise.reject(new Error("html2canvas.svg.js is not loaded, cannot render svg"))},Bb.prototype.inlineFormatting=function(a){return/^data:image\/svg\+xml;base64,/.test(a)?this.decode64(this.removeContentType(a)):this.removeContentType(a)},Bb.prototype.removeContentType=function(a){return a.replace(/^data:image\/svg\+xml(;base64)?,/,"")},Bb.prototype.isInline=function(a){return/^data:image\/svg\+xml/i.test(a)},Bb.prototype.createCanvas=function(a){var b=this;return function(c,d){var e=new html2canvas.fabric.StaticCanvas("c");b.image=e.lowerCanvasEl,e.setWidth(d.width).setHeight(d.height).add(html2canvas.fabric.util.groupSVGElements(c,d)).renderAll(),a(e.lowerCanvasEl)}},Bb.prototype.decode64=function(b){return"function"==typeof a.atob?a.atob(b):Cb(b)},Db.prototype=Object.create(Bb.prototype),Eb.prototype=Object.create(B.prototype),Eb.prototype.applyTextTransform=function(){this.node.data=this.transform(this.parent.css("textTransform"))},Eb.prototype.transform=function(a){var b=this.node.data;switch(a){case"lowercase":return b.toLowerCase();case"capitalize":return b.replace(/(^|\s|:|-|\(|\))([a-z])/g,Fb);case"uppercase":return b.toUpperCase();default:return b}},Gb.prototype=Object.create(w.prototype),Ib.prototype=Object.create(yb.prototype),Ib.prototype.setFillStyle=function(a){return this.ctx.fillStyle=a,this.ctx},Ib.prototype.rectangle=function(a,b,c,d,e){this.setFillStyle(e).fillRect(a,b,c,d)},Ib.prototype.drawShape=function(a,b){this.shape(a),this.setFillStyle(b).fill()},Ib.prototype.taints=function(a){if(null===a.tainted){this.taintCtx.drawImage(a.image,0,0);try{this.taintCtx.getImageData(0,0,1,1),a.tainted=!1}catch(c){this.taintCtx=b.createElement("canvas").getContext("2d"),a.tainted=!0}}return a.tainted},Ib.prototype.drawImage=function(a,b,c,d,e,f,g,h,i){(!this.taints(a)||this.options.allowTaint)&&this.ctx.drawImage(a.image,b,c,d,e,f,g,h,i)},Ib.prototype.clip=function(a,b,c){this.ctx.save(),a.filter(Jb).forEach(function(a){this.shape(a).clip()},this),b.call(c),this.ctx.restore()},Ib.prototype.shape=function(a){return this.ctx.beginPath(),a.forEach(function(a,b){this.ctx[0===b?"moveTo":a[0]+"To"].apply(this.ctx,a.slice(1))},this),this.ctx.closePath(),this.ctx},Ib.prototype.font=function(a,b,c,d,e,f){this.setFillStyle(a).font=[b,c,d,e,f].join(" ")},Ib.prototype.fontShadow=function(a,b,c,d){this.setVariable("shadowColor",a).setVariable("shadowOffsetY",b).setVariable("shadowOffsetX",c).setVariable("shadowBlur",d)},Ib.prototype.clearShadow=function(){this.setVariable("shadowColor","rgba(0,0,0,0)")},Ib.prototype.setOpacity=function(a){this.ctx.globalAlpha=a},Ib.prototype.setTransform=function(a){this.ctx.translate(a.origin[0],a.origin[1]),this.ctx.transform.apply(this.ctx,a.matrix),this.ctx.translate(-a.origin[0],-a.origin[1])},Ib.prototype.setVariable=function(a,b){return this.variables[a]!==b&&(this.variables[a]=this.ctx[a]=b),this},Ib.prototype.text=function(a,b,c){this.ctx.fillText(a,b,c)},Ib.prototype.backgroundRepeatShape=function(a,b,c,d,e,f,g,h,i){var j=[["line",Math.round(e),Math.round(f)],["line",Math.round(e+g),Math.round(f)],["line",Math.round(e+g),Math.round(h+f)],["line",Math.round(e),Math.round(h+f)]];this.clip([j],function(){this.renderBackgroundRepeat(a,b,c,d,i[3],i[0])},this)},Ib.prototype.renderBackgroundRepeat=function(a,b,c,d,e,f){var g=Math.round(d.left+b.left+e),h=Math.round(d.top+b.top+f);this.setFillStyle(this.ctx.createPattern(this.resizeImage(a,c),"repeat")),this.ctx.translate(g,h),this.ctx.fill(),this.ctx.translate(-g,-h)},Ib.prototype.renderBackgroundGradient=function(a,b){if(a instanceof z){var c=this.ctx.createLinearGradient(b.left+b.width*a.x0,b.top+b.height*a.y0,b.left+b.width*a.x1,b.top+b.height*a.y1);a.colorStops.forEach(function(a){c.addColorStop(a.stop,a.color)}),this.rectangle(b.left,b.top,b.width,b.height,c)}},Ib.prototype.resizeImage=function(a,c){var d=a.image;if(d.width===c.width&&d.height===c.height)return d;var e,f=b.createElement("canvas");return f.width=c.width,f.height=c.height,e=f.getContext("2d"),e.drawImage(d,0,0,d.width,d.height,0,0,c.width,c.height),f}}(window,document); \ No newline at end of file +!function(a,b,c){function d(a,b,c,d){return k(a,a,c,d,b).then(function(f){A("Document cloned");var g="["+Kb+"='true']";a.querySelector(g).removeAttribute(Kb);var h=f.contentWindow,i=h.document.querySelector(g);return e(i,f,b,c,d)})}function e(a,c,d,e,j){var k=c.contentWindow,l=new Ab(k.document),m=new y(d,l),n=I(a),o=null!=d.width?d.width:"view"===d.type?Math.min(n.width,e):h(k.document),p=null!=d.height?d.height:"view"===d.type?Math.min(n.height,j):i(k.document),q=new Ib(o,p,m,d,b),r=new K(a,q,l,m,d);return r.ready.then(function(){A("Finished rendering");var b="view"===d.type||a!==k.document.body&&a!==k.document.documentElement?g(q.canvas,{width:o,height:p,top:n.top,left:n.left}):q.canvas;return f(c,d),b})}function f(a,b){b.removeContainer&&(a.parentNode.removeChild(a),A("Cleaned up container"))}function g(a,c){var d=b.createElement("canvas"),e=Math.min(a.width-1,Math.max(0,c.left)),f=Math.min(a.width,Math.max(1,c.left+c.width)),g=Math.min(a.height-1,Math.max(0,c.top)),h=Math.min(a.height,Math.max(1,c.top+c.height)),i=d.width=f-e,j=d.height=h-g;return A("Cropping canvas at:","left:",c.left,"top:",c.top,"width:",c.width,"height:",c.height),A("Resulting crop with width",i,"and height",j," with x",e,"and y",g),d.getContext("2d").drawImage(a,e,g,i,j,0,0,i,j),d}function h(a){return Math.max(Math.max(a.body.scrollWidth,a.documentElement.scrollWidth),Math.max(a.body.offsetWidth,a.documentElement.offsetWidth),Math.max(a.body.clientWidth,a.documentElement.clientWidth))}function i(a){return Math.max(Math.max(a.body.scrollHeight,a.documentElement.scrollHeight),Math.max(a.body.offsetHeight,a.documentElement.offsetHeight),Math.max(a.body.clientHeight,a.documentElement.clientHeight))}function j(){return"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"}function k(b,c,d,e,f){n(b);var g=b.documentElement.cloneNode(!0),h=c.createElement("iframe");return h.style.visibility="hidden",h.style.position="absolute",h.style.left=h.style.top="-10000px",h.width=d,h.height=e,h.scrolling="no",c.body.appendChild(h),new Promise(function(c){var d=h.contentWindow.document;h.contentWindow.onload=h.onload=function(){var a=setInterval(function(){d.body.childNodes.length>0&&(o(b,d),clearInterval(a),c(h))},50)},d.open(),d.write(""),d.close(),d.replaceChild(f.javascriptEnabled===!0?d.adoptNode(g):p(d.adoptNode(g)),d.documentElement),"view"===f.type&&h.contentWindow.scrollTo(a.pageXOffset,a.pageYOffset)})}function l(b,c,d,e,f,g){return new sb(b,c,a.document).then(m(b)).then(function(a){return k(a,d,e,f,g)})}function m(a){return function(c){var d,e=new DOMParser;try{d=e.parseFromString(c,"text/html")}catch(f){A("DOMParser not supported, falling back to createHTMLDocument"),d=b.implementation.createHTMLDocument("");try{d.open(),d.write(c),d.close()}catch(g){A("createHTMLDocument write not supported, falling back to document.body.innerHTML"),d.body.innerHTML=c}}var h=d.querySelector("base");if(!h||!h.href.host){var i=d.createElement("base");i.href=a,d.head.insertBefore(i,d.head.firstChild)}return d}}function n(a){[].slice.call(a.querySelectorAll("canvas"),0).forEach(function(a){a.setAttribute(Lb,"canvas-"+Mb++)})}function o(a,b){[].slice.call(a.querySelectorAll("["+Lb+"]"),0).forEach(function(a){try{var c=b.querySelector("["+Lb+'="'+a.getAttribute(Lb)+'"]');c&&(c.width=a.width,c.height=a.height,c.getContext("2d").putImageData(a.getContext("2d").getImageData(0,0,a.width,a.height),0,0))}catch(d){A("Unable to copy canvas content from",a,d)}a.removeAttribute(Lb)})}function p(a){return[].slice.call(a.childNodes,0).filter(q).forEach(function(b){"SCRIPT"===b.tagName?a.removeChild(b):p(b)}),a}function q(a){return a.nodeType===Node.ELEMENT_NODE}function r(a){var c=b.createElement("a");return c.href=a,c.href=c.href,c}function s(a){if(this.src=a,A("DummyImageContainer for",a),!this.promise||!this.image){A("Initiating DummyImageContainer"),s.prototype.image=new Image;var b=this.image;s.prototype.promise=new Promise(function(a,c){b.onload=a,b.onerror=c,b.src=j(),b.complete===!0&&a(b)})}}function t(a,c){var d,e,f=b.createElement("div"),g=b.createElement("img"),h=b.createElement("span"),i="Hidden Text";f.style.visibility="hidden",f.style.fontFamily=a,f.style.fontSize=c,f.style.margin=0,f.style.padding=0,b.body.appendChild(f),g.src=j(),g.width=1,g.height=1,g.style.margin=0,g.style.padding=0,g.style.verticalAlign="baseline",h.style.fontFamily=a,h.style.fontSize=c,h.style.margin=0,h.style.padding=0,h.appendChild(b.createTextNode(i)),f.appendChild(h),f.appendChild(g),d=g.offsetTop-h.offsetTop+1,f.removeChild(h),f.appendChild(b.createTextNode(i)),f.style.lineHeight="normal",g.style.verticalAlign="super",e=g.offsetTop-f.offsetTop+1,b.body.removeChild(f),this.baseline=d,this.lineWidth=1,this.middle=e}function u(){this.data={}}function v(a,b,c){this.image=null,this.src=a;var d=this,e=I(a);this.promise=(b?new Promise(function(b){"about:blank"===a.contentWindow.document.URL||null==a.contentWindow.document.documentElement?a.contentWindow.onload=a.onload=function(){b(a)}:b(a)}):this.proxyLoad(c.proxy,e,c)).then(function(a){return html2canvas(a.contentWindow.document.documentElement,{type:"view",width:a.width,height:a.height,proxy:c.proxy,javascriptEnabled:c.javascriptEnabled,removeContainer:c.removeContainer,allowTaint:c.allowTaint,imageTimeout:c.imageTimeout/2})}).then(function(a){return d.image=a})}function w(a){this.src=a.value,this.colorStops=[],this.type=null,this.x0=.5,this.y0=.5,this.x1=.5,this.y1=.5,this.promise=Promise.resolve(!0)}function x(a,b){this.src=a,this.image=new Image;var c=this;this.tainted=null,this.promise=new Promise(function(d,e){c.image.onload=d,c.image.onerror=e,b&&(c.image.crossOrigin="anonymous"),c.image.src=a,c.image.complete===!0&&d(c.image)})}function y(b,c){this.link=null,this.options=b,this.support=c,this.origin=a.location.protocol+a.location.hostname+a.location.port}function z(a){w.apply(this,arguments),this.type=this.TYPES.LINEAR;var b=null===a.args[0].match(this.stepRegExp);b?a.args[0].split(" ").reverse().forEach(function(a){switch(a){case"left":this.x0=0,this.x1=1;break;case"top":this.y0=0,this.y1=1;break;case"right":this.x0=1,this.x1=0;break;case"bottom":this.y0=1,this.y1=0;break;case"to":var b=this.y0,c=this.x0;this.y0=this.y1,this.x0=this.x1,this.x1=c,this.y1=b}},this):(this.y0=0,this.y1=1),this.colorStops=a.args.slice(b?1:0).map(function(a){var b=a.match(this.stepRegExp);return{color:b[1],stop:"%"===b[3]?b[2]/100:null}},this),null===this.colorStops[0].stop&&(this.colorStops[0].stop=0),null===this.colorStops[this.colorStops.length-1].stop&&(this.colorStops[this.colorStops.length-1].stop=1),this.colorStops.forEach(function(a,b){null===a.stop&&this.colorStops.slice(b).some(function(c,d){return null!==c.stop?(a.stop=(c.stop-this.colorStops[b-1].stop)/(d+1)+this.colorStops[b-1].stop,!0):!1},this)},this)}function A(){a.html2canvas.logging&&a.console&&a.console.log&&Function.prototype.bind.call(a.console.log,a.console).apply(a.console,[Date.now()-a.html2canvas.start+"ms","html2canvas:"].concat([].slice.call(arguments,0)))}function B(a,b){this.node=a,this.parent=b,this.stack=null,this.bounds=null,this.borders=null,this.clip=[],this.backgroundClip=[],this.offsetBounds=null,this.visible=null,this.computedStyles=null,this.styles={},this.backgroundImages=null,this.transformData=null,this.transformMatrix=null}function C(a){var b=a.options[a.selectedIndex||0];return b?b.text||"":""}function D(a){return a&&"matrix"===a[1]?a[2].split(",").map(function(a){return parseFloat(a.trim())}):void 0}function E(a){return-1!==a.toString().indexOf("%")}function F(a){var b,c,d,e,f,g,h,i=" \r\n ",j=[],k=0,l=0,m=function(){b&&('"'===c.substr(0,1)&&(c=c.substr(1,c.length-2)),c&&h.push(c),"-"===b.substr(0,1)&&(e=b.indexOf("-",1)+1)>0&&(d=b.substr(0,e),b=b.substr(e)),j.push({prefix:d,method:b.toLowerCase(),value:f,args:h,image:null})),h=[],b=d=c=f=""};return h=[],b=d=c=f="",a.split("").forEach(function(a){if(!(0===k&&i.indexOf(a)>-1)){switch(a){case'"':g?g===a&&(g=null):g=a;break;case"(":if(g)break;if(0===k)return k=1,void(f+=a);l++;break;case")":if(g)break;if(1===k){if(0===l)return k=0,f+=a,void m();l--}break;case",":if(g)break;if(0===k)return void m();if(1===k&&0===l&&!b.match(/^url$/i))return h.push(c),c="",void(f+=a)}f+=a,0===k?b+=a:c+=a}}),m(),j}function G(a){return a.replace("px","")}function H(a){return parseFloat(a)}function I(a){if(a.getBoundingClientRect){var b=a.getBoundingClientRect(),c=null==a.offsetWidth?b.width:a.offsetWidth;return{top:b.top,bottom:b.bottom||b.top+b.height,right:b.left+c,left:b.left,width:c,height:null==a.offsetHeight?b.height:a.offsetHeight}}return{}}function J(a){var b=a.offsetParent?J(a.offsetParent):{top:0,left:0};return{top:a.offsetTop+b.top,bottom:a.offsetTop+a.offsetHeight+b.top,right:a.offsetLeft+b.left+a.offsetWidth,left:a.offsetLeft+b.left,width:a.offsetWidth,height:a.offsetHeight}}function K(a,b,c,d,e){A("Starting NodeParser"),this.renderer=b,this.options=e,this.range=null,this.support=c,this.renderQueue=[],this.stack=new zb(!0,1,a.ownerDocument,null);var f=new B(a,null);if(a===a.ownerDocument.documentElement){var g=new B(this.renderer.isTransparent(f.css("backgroundColor"))?a.ownerDocument.body:a.ownerDocument.documentElement,null);b.rectangle(0,0,b.width,b.height,g.css("backgroundColor"))}f.visibile=f.isElementVisible(),this.createPseudoHideStyles(a.ownerDocument),this.nodes=nb([f].concat(this.getChildren(f)).filter(function(a){return a.visible=a.isElementVisible()}).map(this.getPseudoElements,this)),this.fontMetrics=new u,A("Fetched nodes, total:",this.nodes.length),this.images=d.fetch(this.nodes.filter(fb)),this.ready=this.images.ready.then(jb(function(){return A("Images loaded, starting parsing"),A("Calculate overflow clips"),this.calculateOverflowClips(),A("Creating stacking contexts"),this.createStackingContexts(),A("Sorting stacking contexts"),this.sortStackingContexts(this.stack),this.parse(this.stack),A("Render queue created with "+this.renderQueue.length+" items"),new Promise(jb(function(a){e.async?"function"==typeof e.async?e.async.call(this,this.renderQueue,a):(this.renderIndex=0,this.asyncRenderer(this.renderQueue,a)):(this.renderQueue.forEach(this.paint,this),a())},this))},this))}function L(a){return a.parent&&a.parent.clip.length}function M(a){return a.replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")})}function N(){}function O(a,b,c,d){var e=4*((Math.sqrt(2)-1)/3),f=c*e,g=d*e,h=a+c,i=b+d;return{topLeft:Q({x:a,y:i},{x:a,y:i-g},{x:h-f,y:b},{x:h,y:b}),topRight:Q({x:a,y:b},{x:a+f,y:b},{x:h,y:i-g},{x:h,y:i}),bottomRight:Q({x:h,y:b},{x:h,y:b+g},{x:a+f,y:i},{x:a,y:i}),bottomLeft:Q({x:h,y:i},{x:h-f,y:i},{x:a,y:b+g},{x:a,y:b})}}function P(a,b,c){var d=a.left,e=a.top,f=a.width,g=a.height,h=b[0][0],i=b[0][1],j=b[1][0],k=b[1][1],l=b[2][0],m=b[2][1],n=b[3][0],o=b[3][1],p=f-j,q=g-m,r=f-l,s=g-o;return{topLeftOuter:O(d,e,h,i).topLeft.subdivide(.5),topLeftInner:O(d+c[3].width,e+c[0].width,Math.max(0,h-c[3].width),Math.max(0,i-c[0].width)).topLeft.subdivide(.5),topRightOuter:O(d+p,e,j,k).topRight.subdivide(.5),topRightInner:O(d+Math.min(p,f+c[3].width),e+c[0].width,p>f+c[3].width?0:j-c[3].width,k-c[0].width).topRight.subdivide(.5),bottomRightOuter:O(d+r,e+q,l,m).bottomRight.subdivide(.5),bottomRightInner:O(d+Math.min(r,f+c[3].width),e+Math.min(q,g+c[0].width),Math.max(0,l-c[1].width),Math.max(0,m-c[2].width)).bottomRight.subdivide(.5),bottomLeftOuter:O(d,e+s,n,o).bottomLeft.subdivide(.5),bottomLeftInner:O(d+c[3].width,e+s,Math.max(0,n-c[3].width),Math.max(0,o-c[2].width)).bottomLeft.subdivide(.5)}}function Q(a,b,c,d){var e=function(a,b,c){return{x:a.x+(b.x-a.x)*c,y:a.y+(b.y-a.y)*c}};return{start:a,startControl:b,endControl:c,end:d,subdivide:function(f){var g=e(a,b,f),h=e(b,c,f),i=e(c,d,f),j=e(g,h,f),k=e(h,i,f),l=e(j,k,f);return[Q(a,g,j,l),Q(l,k,i,d)]},curveTo:function(a){a.push(["bezierCurve",b.x,b.y,c.x,c.y,d.x,d.y])},curveToReversed:function(d){d.push(["bezierCurve",c.x,c.y,b.x,b.y,a.x,a.y])}}}function R(a,b,c,d,e,f,g){var h=[];return b[0]>0||b[1]>0?(h.push(["line",d[1].start.x,d[1].start.y]),d[1].curveTo(h)):h.push(["line",a.c1[0],a.c1[1]]),c[0]>0||c[1]>0?(h.push(["line",f[0].start.x,f[0].start.y]),f[0].curveTo(h),h.push(["line",g[0].end.x,g[0].end.y]),g[0].curveToReversed(h)):(h.push(["line",a.c2[0],a.c2[1]]),h.push(["line",a.c3[0],a.c3[1]])),b[0]>0||b[1]>0?(h.push(["line",e[1].end.x,e[1].end.y]),e[1].curveToReversed(h)):h.push(["line",a.c4[0],a.c4[1]]),h}function S(a,b,c,d,e,f,g){b[0]>0||b[1]>0?(a.push(["line",d[0].start.x,d[0].start.y]),d[0].curveTo(a),d[1].curveTo(a)):a.push(["line",f,g]),(c[0]>0||c[1]>0)&&a.push(["line",e[0].start.x,e[0].start.y])}function T(a){return a.cssInt("zIndex")<0}function U(a){return a.cssInt("zIndex")>0}function V(a){return 0===a.cssInt("zIndex")}function W(a){return-1!==["inline","inline-block","inline-table"].indexOf(a.css("display"))}function X(a){return a instanceof zb}function Y(a){return a.node.data.trim().length>0}function Z(a){return/^(normal|none|0px)$/.test(a.parent.css("letterSpacing"))}function $(a){return["TopLeft","TopRight","BottomRight","BottomLeft"].map(function(b){var c=a.css("border"+b+"Radius"),d=c.split(" ");return d.length<=1&&(d[1]=d[0]),d.map(kb)})}function _(a){return a.nodeType===Node.TEXT_NODE||a.nodeType===Node.ELEMENT_NODE}function ab(a){var b=a.css("position"),c=-1!==["absolute","relative","fixed"].indexOf(b)?a.css("zIndex"):"auto";return"auto"!==c}function bb(a){return"static"!==a.css("position")}function cb(a){return"none"!==a.css("float")}function db(a){return-1!==["inline-block","inline-table"].indexOf(a.css("display"))}function eb(a){var b=this;return function(){return!a.apply(b,arguments)}}function fb(a){return a.node.nodeType===Node.ELEMENT_NODE}function gb(a){return a.node.nodeType===Node.TEXT_NODE}function hb(a,b){return a.cssInt("zIndex")-b.cssInt("zIndex")}function ib(a){return a.css("opacity")<1}function jb(a,b){return function(){return a.apply(b,arguments)}}function kb(a){return parseInt(a,10)}function lb(a){return a.width}function mb(a){return a.node.nodeType!==Node.ELEMENT_NODE||-1===["SCRIPT","HEAD","TITLE","OBJECT","BR","OPTION"].indexOf(a.node.nodeName)}function nb(a){return[].concat.apply([],a)}function ob(a){var b=a.substr(0,1);return b===a.substr(a.length-1)&&b.match(/'|"/)?a.substr(1,a.length-2):a}function pb(b){for(var c,d=[],e=0,f=!1;b.length;)qb(b[e])===f?(c=b.splice(0,e),c.length&&d.push(a.html2canvas.punycode.ucs2.encode(c)),f=!f,e=0):e++,e>=b.length&&(c=b.splice(0,e),c.length&&d.push(a.html2canvas.punycode.ucs2.encode(c)));return d}function qb(a){return-1!==[32,13,10,9,45].indexOf(a)}function rb(a){return/[^\u0000-\u00ff]/.test(a)}function sb(a,b,c){var d=vb(Ob),e=wb(b,a,d);return Ob?Hb(e):ub(c,e,d).then(function(a){return Cb(a.content)})}function tb(a,b,c){var d=vb(Pb),e=wb(b,a,d);return Pb?Promise.resolve(e):ub(c,e,d).then(function(a){return"data:"+a.type+";base64,"+a.content})}function ub(b,c,d){return new Promise(function(e,f){var g=b.createElement("script"),h=function(){delete a.html2canvas.proxy[d],b.body.removeChild(g)};a.html2canvas.proxy[d]=function(a){h(),e(a)},g.src=c,g.onerror=function(a){h(),f(a)},b.body.appendChild(g)})}function vb(a){return a?"":"html2canvas_"+Date.now()+"_"+ ++Nb+"_"+Math.round(1e5*Math.random())}function wb(a,b,c){return a+"?url="+encodeURIComponent(b)+(c.length?"&callback=html2canvas.proxy."+c:"")}function xb(a,c){var d=(b.createElement("script"),b.createElement("a"));d.href=a,a=d.href,this.src=a,this.image=new Image;var e=this;this.promise=new Promise(function(d,f){e.image.crossOrigin="Anonymous",e.image.onload=d,e.image.onerror=f,new tb(a,c,b).then(function(a){e.image.src=a})["catch"](f)})}function yb(a,b,c,d,e){this.width=a,this.height=b,this.images=c,this.options=d,this.document=e}function zb(a,b,c,d){B.call(this,c,d),this.ownStacking=a,this.contexts=[],this.children=[],this.opacity=(this.parent?this.parent.stack.opacity:1)*b}function Ab(a){this.rangeBounds=this.testRangeBounds(a),this.cors=this.testCORS(),this.svg=this.testSVG()}function Bb(a){this.src=a,this.image=null;var b=this;this.promise=this.hasFabric().then(function(){return b.isInline(a)?Promise.resolve(b.inlineFormatting(a)):Hb(a)}).then(function(a){return new Promise(function(c){html2canvas.fabric.loadSVGFromString(a,b.createCanvas.call(b,c))})})}function Cb(a){var b,c,d,e,f,g,h,i,j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k=a.length,l="";for(b=0;k>b;b+=4)c=j.indexOf(a[b]),d=j.indexOf(a[b+1]),e=j.indexOf(a[b+2]),f=j.indexOf(a[b+3]),g=c<<2|d>>4,h=(15&d)<<4|e>>2,i=(3&e)<<6|f,l+=64===e?String.fromCharCode(g):64===f||-1===f?String.fromCharCode(g,h):String.fromCharCode(g,h,i);return l}function Db(a,b){this.src=a,this.image=null;var c=this;this.promise=b?new Promise(function(b,d){c.image=new Image,c.image.onload=b,c.image.onerror=d,c.image.src="data:image/svg+xml,"+(new XMLSerializer).serializeToString(a),c.image.complete===!0&&b(c.image)}):this.hasFabric().then(function(){return new Promise(function(b){html2canvas.fabric.parseSVGDocument(a,c.createCanvas.call(c,b))})})}function Eb(a,b){B.call(this,a,b)}function Fb(a,b,c){return a.length>0?b+c.toUpperCase():void 0}function Gb(a){w.apply(this,arguments),this.type="linear"===a.args[0]?this.TYPES.LINEAR:this.TYPES.RADIAL}function Hb(a){return new Promise(function(b,c){var d=new XMLHttpRequest;d.open("GET",a),d.onload=function(){200===d.status?b(d.responseText):c(new Error(d.statusText))},d.onerror=function(){c(new Error("Network Error"))},d.send()})}function Ib(a,b){yb.apply(this,arguments),this.canvas=this.document.createElement("canvas"),this.canvas.width=a,this.canvas.height=b,this.ctx=this.canvas.getContext("2d"),this.taintCtx=this.document.createElement("canvas").getContext("2d"),this.ctx.textBaseline="bottom",this.variables={},A("Initialized CanvasRenderer with size",a,"x",b)}function Jb(a){return a.length>0}if(!function(){var c,d,e,f;!function(){var a={},b={};c=function(b,c,d){a[b]={deps:c,callback:d}},f=e=d=function(c){function e(a){if("."!==a.charAt(0))return a;for(var b=a.split("/"),d=c.split("/").slice(0,-1),e=0,f=b.length;f>e;e++){var g=b[e];if(".."===g)d.pop();else{if("."===g)continue;d.push(g)}}return d.join("/")}if(f._eak_seen=a,b[c])return b[c];if(b[c]={},!a[c])throw new Error("Could not find module "+c);for(var g,h=a[c],i=h.deps,j=h.callback,k=[],l=0,m=i.length;m>l;l++)k.push("exports"===i[l]?g={}:d(e(i[l])));var n=j.apply(this,k);return b[c]=g||n}}(),c("promise/all",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to all.");return new b(function(b,c){function d(a){return function(b){f(a,b)}}function f(a,c){h[a]=c,0===--i&&b(h)}var g,h=[],i=a.length;0===i&&b([]);for(var j=0;j1&&(e=d[0]+"@",a=d[1]);var f=a.split(D),g=c(f,b).join(".");return e+g}function e(a){for(var b,c,d=[],e=0,f=a.length;f>e;)b=a.charCodeAt(e++),b>=55296&&56319>=b&&f>e?(c=a.charCodeAt(e++),56320==(64512&c)?d.push(((1023&b)<<10)+(1023&c)+65536):(d.push(b),e--)):d.push(b);return d}function f(a){return c(a,function(a){var b="";return a>65535&&(a-=65536,b+=H(a>>>10&1023|55296),a=56320|1023&a),b+=H(a)}).join("")}function g(a){return 10>a-48?a-22:26>a-65?a-65:26>a-97?a-97:t}function h(a,b){return a+22+75*(26>a)-((0!=b)<<5)}function i(a,b,c){var d=0;for(a=c?G(a/x):a>>1,a+=G(a/b);a>F*v>>1;d+=t)a=G(a/F);return G(d+(F+1)*a/(a+w))}function j(a){var c,d,e,h,j,k,l,m,n,o,p=[],q=a.length,r=0,w=z,x=y;for(d=a.lastIndexOf(A),0>d&&(d=0),e=0;d>e;++e)a.charCodeAt(e)>=128&&b("not-basic"),p.push(a.charCodeAt(e));for(h=d>0?d+1:0;q>h;){for(j=r,k=1,l=t;h>=q&&b("invalid-input"),m=g(a.charCodeAt(h++)),(m>=t||m>G((s-r)/k))&&b("overflow"),r+=m*k,n=x>=l?u:l>=x+v?v:l-x,!(n>m);l+=t)o=t-n,k>G(s/o)&&b("overflow"),k*=o;c=p.length+1,x=i(r-j,c,0==j),G(r/c)>s-w&&b("overflow"),w+=G(r/c),r%=c,p.splice(r++,0,w)}return f(p)}function k(a){var c,d,f,g,j,k,l,m,n,o,p,q,r,w,x,B=[];for(a=e(a),q=a.length,c=z,d=0,j=y,k=0;q>k;++k)p=a[k],128>p&&B.push(H(p));for(f=g=B.length,g&&B.push(A);q>f;){for(l=s,k=0;q>k;++k)p=a[k],p>=c&&l>p&&(l=p);for(r=f+1,l-c>G((s-d)/r)&&b("overflow"),d+=(l-c)*r,c=l,k=0;q>k;++k)if(p=a[k],c>p&&++d>s&&b("overflow"),p==c){for(m=d,n=t;o=j>=n?u:n>=j+v?v:n-j,!(o>m);n+=t)x=m-o,w=t-o,B.push(H(h(o+x%w,0))),m=G(x/w);B.push(H(h(m,0))),j=i(d,r,f==g),d=0,++f}++d,++c}return B.join("")}function l(a){return d(a,function(a){return B.test(a)?j(a.slice(4).toLowerCase()):a})}function m(a){return d(a,function(a){return C.test(a)?"xn--"+k(a):a})}var n="object"==typeof exports&&exports&&!exports.nodeType&&exports,o="object"==typeof module&&module&&!module.nodeType&&module,p="object"==typeof global&&global;(p.global===p||p.window===p||p.self===p)&&(a=p);var q,r,s=2147483647,t=36,u=1,v=26,w=38,x=700,y=72,z=128,A="-",B=/^xn--/,C=/[^\x20-\x7E]/,D=/[\x2E\u3002\uFF0E\uFF61]/g,E={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},F=t-u,G=Math.floor,H=String.fromCharCode;if(q={version:"1.3.1",ucs2:{decode:e,encode:f},decode:j,encode:k,toASCII:m,toUnicode:l},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return q});else if(n&&o)if(module.exports==n)o.exports=q;else for(r in q)q.hasOwnProperty(r)&&(n[r]=q[r]);else a.punycode=q}(this);var Kb="data-html2canvas-node",Lb="data-html2canvas-canvas-clone",Mb=0;a.html2canvas=function(f,g){if(g=g||{},g.logging&&(a.html2canvas.logging=!0,a.html2canvas.start=Date.now()),g.async="undefined"==typeof g.async?!0:g.async,g.allowTaint="undefined"==typeof g.allowTaint?!1:g.allowTaint,g.removeContainer="undefined"==typeof g.removeContainer?!0:g.removeContainer,g.javascriptEnabled="undefined"==typeof g.javascriptEnabled?!1:g.javascriptEnabled,g.imageTimeout="undefined"==typeof g.imageTimeout?1e4:g.imageTimeout,"string"==typeof f)return"string"!=typeof g.proxy?Promise.reject("Proxy must be used when rendering url"):l(r(f),g.proxy,b,a.innerWidth,a.innerHeight,g).then(function(b){return e(b.contentWindow.document.documentElement,b,g,a.innerWidth,a.innerHeight)});var h=(f===c?[b.documentElement]:f.length?f:[f])[0];return h.setAttribute(Kb,"true"),d(h.ownerDocument,g,h.ownerDocument.defaultView.innerWidth,h.ownerDocument.defaultView.innerHeight).then(function(a){return"function"==typeof g.onrendered&&(A("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas"),g.onrendered(a)),a})},a.html2canvas.punycode=this.punycode,a.html2canvas.proxy={},u.prototype.getMetrics=function(a,b){return this.data[a+"-"+b]===c&&(this.data[a+"-"+b]=new t(a,b)),this.data[a+"-"+b]},v.prototype.proxyLoad=function(a,b,c){var d=this.src;return l(d.src,a,d.ownerDocument,b.width,b.height,c)},w.prototype.TYPES={LINEAR:1,RADIAL:2},y.prototype.findImages=function(a){var b=[];return a.reduce(function(a,b){switch(b.node.nodeName){case"IMG":return a.concat([{args:[b.node.src],method:"url"}]);case"svg":case"IFRAME":return a.concat([{args:[b.node],method:b.node.nodeName}])}return a},[]).forEach(this.addImage(b,this.loadImage),this),b},y.prototype.findBackgroundImage=function(a,b){return b.parseBackgroundImages().filter(this.hasImageBackground).forEach(this.addImage(a,this.loadImage),this),a},y.prototype.addImage=function(a,b){return function(c){c.args.forEach(function(d){this.imageExists(a,d)||(a.splice(0,0,b.call(this,c)),A("Added image #"+a.length,"string"==typeof d?d.substring(0,100):d))},this)}},y.prototype.hasImageBackground=function(a){return"none"!==a.method},y.prototype.loadImage=function(a){if("url"===a.method){var b=a.args[0];return!this.isSVG(b)||this.support.svg||this.options.allowTaint?b.match(/data:image\/.*;base64,/i)?new x(b.replace(/url\(['"]{0,}|['"]{0,}\)$/gi,""),!1):this.isSameOrigin(b)||this.options.allowTaint===!0||this.isSVG(b)?new x(b,!1):this.support.cors&&!this.options.allowTaint&&this.options.useCORS?new x(b,!0):this.options.proxy?new xb(b,this.options.proxy):new s(b):new Bb(b)}return"linear-gradient"===a.method?new z(a):"gradient"===a.method?new Gb(a):"svg"===a.method?new Db(a.args[0],this.support.svg):"IFRAME"===a.method?new v(a.args[0],this.isSameOrigin(a.args[0].src),this.options):new s(a)},y.prototype.isSVG=function(a){return/(.+).svg$/i.test(a)||Bb.prototype.isInline(a)},y.prototype.imageExists=function(a,b){return a.some(function(a){return a.src===b})},y.prototype.isSameOrigin=function(a){var c=this.link||(this.link=b.createElement("a"));c.href=a,c.href=c.href;var d=c.protocol+c.hostname+c.port;return d===this.origin},y.prototype.getPromise=function(a){return this.timeout(a,this.options.imageTimeout)["catch"](function(){var b=new s(a.src);return b.promise.then(function(b){a.image=b})})},y.prototype.get=function(a){var b=null;return this.images.some(function(c){return(b=c).src===a})?b:null},y.prototype.fetch=function(a){return this.images=a.reduce(jb(this.findBackgroundImage,this),this.findImages(a)),this.images.forEach(function(a,b){a.promise.then(function(){A("Succesfully loaded image #"+(b+1),a)},function(c){A("Failed loading image #"+(b+1),a,c)})}),this.ready=Promise.all(this.images.map(this.getPromise,this)),A("Finished searching images"),this},y.prototype.timeout=function(a,b){var c;return Promise.race([a.promise,new Promise(function(d,e){c=setTimeout(function(){A("Timed out loading image",a),e(a)},b)})]).then(function(a){return clearTimeout(c),a})},z.prototype=Object.create(w.prototype),z.prototype.stepRegExp=/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\))\s*(\d{1,3})?(%|px)?/,B.prototype.assignStack=function(a){this.stack=a,a.children.push(this)},B.prototype.isElementVisible=function(){return this.node.nodeType===Node.TEXT_NODE?this.parent.visible:"none"!==this.css("display")&&"hidden"!==this.css("visibility")&&!this.node.hasAttribute("data-html2canvas-ignore")&&("INPUT"!==this.node.nodeName||"hidden"!==this.node.getAttribute("type"))},B.prototype.css=function(a){return this.computedStyles||(this.computedStyles=this.computedStyle(null)),this.styles[a]||(this.styles[a]=this.computedStyles[a])},B.prototype.prefixedCss=function(a){var b=["webkit","moz","ms","o"],d=this.css(a);return d===c&&b.some(function(b){return d=this.css(b+a.substr(0,1).toUpperCase()+a.substr(1)),d!==c},this),d===c?null:d},B.prototype.computedStyle=function(a){return this.node.ownerDocument.defaultView.getComputedStyle(this.node,a)},B.prototype.cssInt=function(a){var b=parseInt(this.css(a),10);return isNaN(b)?0:b},B.prototype.cssFloat=function(a){var b=parseFloat(this.css(a));return isNaN(b)?0:b},B.prototype.fontWeight=function(){var a=this.css("fontWeight");switch(parseInt(a,10)){case 401:a="bold";break;case 400:a="normal"}return a},B.prototype.parseBackgroundImages=function(){return this.backgroundImages||(this.backgroundImages=F(this.css("backgroundImage")))},B.prototype.cssList=function(a,b){var c=(this.css(a)||"").split(",");return c=c[b||0]||c[0]||"auto",c=c.trim().split(" "),1===c.length&&(c=[c[0],c[0]]),c},B.prototype.parseBackgroundSize=function(a,b,c){var d,e,f=this.cssList("backgroundSize",c);if(E(f[0]))d=a.width*parseFloat(f[0])/100;else{if(/contain|cover/.test(f[0])){var g=a.width/a.height,h=b.width/b.height;return h>g^"contain"===f[0]?{width:a.height*h,height:a.height}:{width:a.width,height:a.width/h}}d=parseInt(f[0],10)}return e="auto"===f[0]&&"auto"===f[1]?b.height:"auto"===f[1]?d/b.width*b.height:E(f[1])?a.height*parseFloat(f[1])/100:parseInt(f[1],10),"auto"===f[0]&&(d=e/b.height*b.width),{width:d,height:e} +},B.prototype.parseBackgroundPosition=function(a,b,c,d){var e,f,g=this.cssList("backgroundPosition",c);return e=E(g[0])?(a.width-(d||b).width)*(parseFloat(g[0])/100):parseInt(g[0],10),f="auto"===g[1]?e/b.width*b.height:E(g[1])?(a.height-(d||b).height)*parseFloat(g[1])/100:parseInt(g[1],10),"auto"===g[0]&&(e=f/b.height*b.width),{left:e,top:f}},B.prototype.parseBackgroundRepeat=function(a){return this.cssList("backgroundRepeat",a)[0]},B.prototype.parseTextShadows=function(){var a=this.css("textShadow"),b=[];if(a&&"none"!==a)for(var c=a.match(this.TEXT_SHADOW_PROPERTY),d=0;c&&dDate.now()?this.asyncRenderer(a,b,c):setTimeout(jb(function(){this.asyncRenderer(a,b)},this),0)},K.prototype.createPseudoHideStyles=function(a){var b=a.createElement("style");b.innerHTML="."+this.pseudoHideClass+':before { content: "" !important; display: none !important; }.'+this.pseudoHideClass+':after { content: "" !important; display: none !important; }',a.body.appendChild(b)},K.prototype.getPseudoElements=function(a){var b=[[a]];if(a.node.nodeType===Node.ELEMENT_NODE){var c=this.getPseudoElement(a,":before"),d=this.getPseudoElement(a,":after");c&&(a.node.insertBefore(c[0].node,a.node.firstChild),b.push(c)),d&&(a.node.appendChild(d[0].node),b.push(d)),(c||d)&&(a.node.className+=" "+this.pseudoHideClass)}return nb(b)},K.prototype.getPseudoElement=function(a,c){var d=a.computedStyle(c);if(!d||!d.content||"none"===d.content||"-moz-alt-content"===d.content||"none"===d.display)return null;for(var e=ob(d.content),f="url"===e.substr(0,3),g=b.createElement(f?"img":"html2canvaspseudoelement"),h=new B(g,a),i=d.length-1;i>=0;i--){var j=M(d.item(i));g.style[j]=d[j]}if(g.className=this.pseudoHideClass,f)return g.src=F(e)[0].args[0],[h];var k=b.createTextNode(e);return g.appendChild(k),[h,new Eb(k,h)]},K.prototype.getChildren=function(a){return nb([].filter.call(a.node.childNodes,_).map(function(b){var c=[b.nodeType===Node.TEXT_NODE?new Eb(b,a):new B(b,a)].filter(mb);return b.nodeType===Node.ELEMENT_NODE&&c.length&&"TEXTAREA"!==b.tagName?c[0].isElementVisible()?c.concat(this.getChildren(c[0])):[]:c},this))},K.prototype.newStackingContext=function(a,b){var c=new zb(b,a.cssFloat("opacity"),a.node,a.parent);c.visible=a.visible,c.borders=a.borders,c.bounds=a.bounds,c.clip=a.clip,c.backgroundClip=a.backgroundClip;var d=b?c.getParentStack(this):c.parent.stack;d.contexts.push(c),a.stack=c},K.prototype.createStackingContexts=function(){this.nodes.forEach(function(a){fb(a)&&(this.isRootElement(a)||ib(a)||ab(a)||this.isBodyWithTransparentRoot(a)||a.hasTransform())?this.newStackingContext(a,!0):fb(a)&&(bb(a)&&V(a)||db(a)||cb(a))?this.newStackingContext(a,!1):a.assignStack(a.parent.stack)},this)},K.prototype.isBodyWithTransparentRoot=function(a){return"BODY"===a.node.nodeName&&this.renderer.isTransparent(a.parent.css("backgroundColor"))},K.prototype.isRootElement=function(a){return null===a.parent},K.prototype.sortStackingContexts=function(a){a.contexts.sort(hb),a.contexts.forEach(this.sortStackingContexts,this)},K.prototype.parseTextBounds=function(a){return function(b,c,d){if("none"!==a.parent.css("textDecoration").substr(0,4)||0!==b.trim().length){if(this.support.rangeBounds&&!a.parent.hasTransform()){var e=d.slice(0,c).join("").length;return this.getRangeBounds(a.node,e,b.length)}if(a.node&&"string"==typeof a.node.data){var f=a.node.splitText(b.length),g=this.getWrapperBounds(a.node,a.parent.hasTransform());return a.node=f,g}}else(!this.support.rangeBounds||a.parent.hasTransform())&&(a.node=a.node.splitText(b.length));return{}}},K.prototype.getWrapperBounds=function(a,b){var c=a.ownerDocument.createElement("html2canvaswrapper"),d=a.parentNode,e=a.cloneNode(!0);c.appendChild(a.cloneNode(!0)),d.replaceChild(c,a);var f=b?J(c):I(c);return d.replaceChild(e,c),f},K.prototype.getRangeBounds=function(a,b,c){var d=this.range||(this.range=a.ownerDocument.createRange());return d.setStart(a,b),d.setEnd(a,b+c),d.getBoundingClientRect()},K.prototype.parse=function(a){var b=a.contexts.filter(T),c=a.children.filter(fb),d=c.filter(eb(cb)),e=d.filter(eb(bb)).filter(eb(W)),f=c.filter(eb(bb)).filter(cb),g=d.filter(eb(bb)).filter(W),h=a.contexts.concat(d.filter(bb)).filter(V),i=a.children.filter(gb).filter(Y),j=a.contexts.filter(U);b.concat(e).concat(f).concat(g).concat(h).concat(i).concat(j).forEach(function(a){this.renderQueue.push(a),X(a)&&(this.parse(a),this.renderQueue.push(new N))},this)},K.prototype.paint=function(a){try{a instanceof N?this.renderer.ctx.restore():gb(a)?this.paintText(a):this.paintNode(a)}catch(b){A(b)}},K.prototype.paintNode=function(a){X(a)&&(this.renderer.setOpacity(a.opacity),this.renderer.ctx.save(),a.hasTransform()&&this.renderer.setTransform(a.parseTransform()));var b=a.parseBounds();this.renderer.clip(a.backgroundClip,function(){this.renderer.renderBackground(a,b,a.borders.borders.map(lb))},this),this.renderer.clip(a.clip,function(){switch(this.renderer.renderBorders(a.borders.borders),a.node.nodeName){case"svg":case"IFRAME":var c=this.images.get(a.node);c?this.renderer.renderImage(a,b,a.borders,c):A("Error loading <"+a.node.nodeName+">",a.node);break;case"IMG":var d=this.images.get(a.node.src);d?this.renderer.renderImage(a,b,a.borders,d):A("Error loading ",a.node.src);break;case"CANVAS":this.renderer.renderImage(a,b,a.borders,{image:a.node});break;case"SELECT":case"INPUT":case"TEXTAREA":this.paintFormValue(a)}},this)},K.prototype.paintFormValue=function(a){if(a.getValue().length>0){var b=a.node.ownerDocument,c=b.createElement("html2canvaswrapper"),d=["lineHeight","textAlign","fontFamily","fontWeight","fontSize","color","paddingLeft","paddingTop","paddingRight","paddingBottom","width","height","borderLeftStyle","borderTopStyle","borderLeftWidth","borderTopWidth","boxSizing","whiteSpace","wordWrap"];d.forEach(function(b){try{c.style[b]=a.css(b)}catch(d){A("html2canvas: Parse: Exception caught in renderFormValue: "+d.message)}});var e=a.parseBounds();c.style.position="absolute",c.style.left=e.left+"px",c.style.top=e.top+"px",c.textContent=a.getValue(),b.body.appendChild(c),this.paintText(new Eb(c.firstChild,a)),b.body.removeChild(c)}},K.prototype.paintText=function(b){b.applyTextTransform();var c=a.html2canvas.punycode.ucs2.decode(b.node.data),d=this.options.letterRendering&&!Z(b)||rb(b.node.data)?c.map(function(b){return a.html2canvas.punycode.ucs2.encode([b])}):pb(c),e=b.parent.fontWeight(),f=b.parent.css("fontSize"),g=b.parent.css("fontFamily"),h=b.parent.parseTextShadows();this.renderer.font(b.parent.css("color"),b.parent.css("fontStyle"),b.parent.css("fontVariant"),e,f,g),h.length?this.renderer.fontShadow(h[0].color,h[0].offsetX,h[0].offsetY,h[0].blur):this.renderer.clearShadow(),this.renderer.clip(b.parent.clip,function(){d.map(this.parseTextBounds(b),this).forEach(function(a,c){a&&(this.renderer.text(d[c],a.left,a.bottom),this.renderTextDecoration(b.parent,a,this.fontMetrics.getMetrics(g,f)))},this)},this)},K.prototype.renderTextDecoration=function(a,b,c){switch(a.css("textDecoration").split(" ")[0]){case"underline":this.renderer.rectangle(b.left,Math.round(b.top+c.baseline+c.lineWidth),b.width,1,a.css("color"));break;case"overline":this.renderer.rectangle(b.left,Math.round(b.top),b.width,1,a.css("color"));break;case"line-through":this.renderer.rectangle(b.left,Math.ceil(b.top+c.middle+c.lineWidth),b.width,1,a.css("color"))}},K.prototype.parseBorders=function(a){var b=a.parseBounds(),c=$(a),d=["Top","Right","Bottom","Left"].map(function(b){return{width:a.cssInt("border"+b+"Width"),color:a.css("border"+b+"Color"),args:null}}),e=P(b,c,d);return{clip:this.parseBackgroundClip(a,e,d,c,b),borders:d.map(function(a,f){if(a.width>0){var g=b.left,h=b.top,i=b.width,j=b.height-d[2].width;switch(f){case 0:j=d[0].width,a.args=R({c1:[g,h],c2:[g+i,h],c3:[g+i-d[1].width,h+j],c4:[g+d[3].width,h+j]},c[0],c[1],e.topLeftOuter,e.topLeftInner,e.topRightOuter,e.topRightInner);break;case 1:g=b.left+b.width-d[1].width,i=d[1].width,a.args=R({c1:[g+i,h],c2:[g+i,h+j+d[2].width],c3:[g,h+j],c4:[g,h+d[0].width]},c[1],c[2],e.topRightOuter,e.topRightInner,e.bottomRightOuter,e.bottomRightInner);break;case 2:h=h+b.height-d[2].width,j=d[2].width,a.args=R({c1:[g+i,h+j],c2:[g,h+j],c3:[g+d[3].width,h],c4:[g+i-d[3].width,h]},c[2],c[3],e.bottomRightOuter,e.bottomRightInner,e.bottomLeftOuter,e.bottomLeftInner);break;case 3:i=d[3].width,a.args=R({c1:[g,h+j+d[2].width],c2:[g,h],c3:[g+i,h+d[0].width],c4:[g+i,h+j]},c[3],c[0],e.bottomLeftOuter,e.bottomLeftInner,e.topLeftOuter,e.topLeftInner)}}return a})}},K.prototype.parseBackgroundClip=function(a,b,c,d,e){var f=a.css("backgroundClip"),g=[];switch(f){case"content-box":case"padding-box":S(g,d[0],d[1],b.topLeftInner,b.topRightInner,e.left+c[3].width,e.top+c[0].width),S(g,d[1],d[2],b.topRightInner,b.bottomRightInner,e.left+e.width-c[1].width,e.top+c[0].width),S(g,d[2],d[3],b.bottomRightInner,b.bottomLeftInner,e.left+e.width-c[1].width,e.top+e.height-c[2].width),S(g,d[3],d[0],b.bottomLeftInner,b.topLeftInner,e.left+c[3].width,e.top+e.height-c[2].width);break;default:S(g,d[0],d[1],b.topLeftOuter,b.topRightOuter,e.left,e.top),S(g,d[1],d[2],b.topRightOuter,b.bottomRightOuter,e.left+e.width,e.top),S(g,d[2],d[3],b.bottomRightOuter,b.bottomLeftOuter,e.left+e.width,e.top+e.height),S(g,d[3],d[0],b.bottomLeftOuter,b.topLeftOuter,e.left,e.top+e.height)}return g},K.prototype.pseudoHideClass="___html2canvas___pseudoelement";var Nb=0,Ob="withCredentials"in new XMLHttpRequest,Pb="crossOrigin"in new Image;yb.prototype.renderImage=function(a,b,c,d){var e=a.cssInt("paddingLeft"),f=a.cssInt("paddingTop"),g=a.cssInt("paddingRight"),h=a.cssInt("paddingBottom"),i=c.borders,j=b.width-(i[1].width+i[3].width+e+g),k=b.height-(i[0].width+i[2].width+f+h);this.drawImage(d,0,0,d.image.width||j,d.image.height||k,b.left+e+i[3].width,b.top+f+i[0].width,j,k)},yb.prototype.renderBackground=function(a,b,c){b.height>0&&b.width>0&&(this.renderBackgroundColor(a,b),this.renderBackgroundImage(a,b,c))},yb.prototype.renderBackgroundColor=function(a,b){var c=a.css("backgroundColor");this.isTransparent(c)||this.rectangle(b.left,b.top,b.width,b.height,a.css("backgroundColor"))},yb.prototype.renderBorders=function(a){a.forEach(this.renderBorder,this)},yb.prototype.renderBorder=function(a){this.isTransparent(a.color)||null===a.args||this.drawShape(a.args,a.color)},yb.prototype.renderBackgroundImage=function(a,b,c){var d=a.parseBackgroundImages();d.reverse().forEach(function(d,e,f){switch(d.method){case"url":var g=this.images.get(d.args[0]);g?this.renderBackgroundRepeating(a,b,g,f.length-(e+1),c):A("Error loading background-image",d.args[0]);break;case"linear-gradient":case"gradient":var h=this.images.get(d.value);h?this.renderBackgroundGradient(h,b,c):A("Error loading background-image",d.args[0]);break;case"none":break;default:A("Unknown background-image type",d.args[0])}},this)},yb.prototype.renderBackgroundRepeating=function(a,b,c,d,e){var f=a.parseBackgroundSize(b,c.image,d),g=a.parseBackgroundPosition(b,c.image,d,f),h=a.parseBackgroundRepeat(d);switch(h){case"repeat-x":case"repeat no-repeat":this.backgroundRepeatShape(c,g,f,b,b.left+e[3],b.top+g.top+e[0],99999,f.height,e);break;case"repeat-y":case"no-repeat repeat":this.backgroundRepeatShape(c,g,f,b,b.left+g.left+e[3],b.top+e[0],f.width,99999,e);break;case"no-repeat":this.backgroundRepeatShape(c,g,f,b,b.left+g.left+e[3],b.top+g.top+e[0],f.width,f.height,e);break;default:this.renderBackgroundRepeat(c,g,f,{top:b.top,left:b.left},e[3],e[0])}},yb.prototype.isTransparent=function(a){return!a||"transparent"===a||"rgba(0, 0, 0, 0)"===a},zb.prototype=Object.create(B.prototype),zb.prototype.getParentStack=function(a){var b=this.parent?this.parent.stack:null;return b?b.ownStacking?b:b.getParentStack(a):a.stack},Ab.prototype.testRangeBounds=function(a){var b,c,d,e,f=!1;return a.createRange&&(b=a.createRange(),b.getBoundingClientRect&&(c=a.createElement("boundtest"),c.style.height="123px",c.style.display="block",a.body.appendChild(c),b.selectNode(c),d=b.getBoundingClientRect(),e=d.height,123===e&&(f=!0),a.body.removeChild(c))),f},Ab.prototype.testCORS=function(){return"undefined"!=typeof(new Image).crossOrigin},Ab.prototype.testSVG=function(){var a=new Image,c=b.createElement("canvas"),d=c.getContext("2d");a.src="data:image/svg+xml,";try{d.drawImage(a,0,0),c.toDataURL()}catch(e){return!1}return!0},Bb.prototype.hasFabric=function(){return html2canvas.fabric?Promise.resolve():Promise.reject(new Error("html2canvas.svg.js is not loaded, cannot render svg"))},Bb.prototype.inlineFormatting=function(a){return/^data:image\/svg\+xml;base64,/.test(a)?this.decode64(this.removeContentType(a)):this.removeContentType(a)},Bb.prototype.removeContentType=function(a){return a.replace(/^data:image\/svg\+xml(;base64)?,/,"")},Bb.prototype.isInline=function(a){return/^data:image\/svg\+xml/i.test(a)},Bb.prototype.createCanvas=function(a){var b=this;return function(c,d){var e=new html2canvas.fabric.StaticCanvas("c");b.image=e.lowerCanvasEl,e.setWidth(d.width).setHeight(d.height).add(html2canvas.fabric.util.groupSVGElements(c,d)).renderAll(),a(e.lowerCanvasEl)}},Bb.prototype.decode64=function(b){return"function"==typeof a.atob?a.atob(b):Cb(b)},Db.prototype=Object.create(Bb.prototype),Eb.prototype=Object.create(B.prototype),Eb.prototype.applyTextTransform=function(){this.node.data=this.transform(this.parent.css("textTransform"))},Eb.prototype.transform=function(a){var b=this.node.data;switch(a){case"lowercase":return b.toLowerCase();case"capitalize":return b.replace(/(^|\s|:|-|\(|\))([a-z])/g,Fb);case"uppercase":return b.toUpperCase();default:return b}},Gb.prototype=Object.create(w.prototype),Ib.prototype=Object.create(yb.prototype),Ib.prototype.setFillStyle=function(a){return this.ctx.fillStyle=a,this.ctx},Ib.prototype.rectangle=function(a,b,c,d,e){this.setFillStyle(e).fillRect(a,b,c,d)},Ib.prototype.drawShape=function(a,b){this.shape(a),this.setFillStyle(b).fill()},Ib.prototype.taints=function(a){if(null===a.tainted){this.taintCtx.drawImage(a.image,0,0);try{this.taintCtx.getImageData(0,0,1,1),a.tainted=!1}catch(c){this.taintCtx=b.createElement("canvas").getContext("2d"),a.tainted=!0}}return a.tainted},Ib.prototype.drawImage=function(a,b,c,d,e,f,g,h,i){(!this.taints(a)||this.options.allowTaint)&&this.ctx.drawImage(a.image,b,c,d,e,f,g,h,i)},Ib.prototype.clip=function(a,b,c){this.ctx.save(),a.filter(Jb).forEach(function(a){this.shape(a).clip()},this),b.call(c),this.ctx.restore()},Ib.prototype.shape=function(a){return this.ctx.beginPath(),a.forEach(function(a,b){this.ctx[0===b?"moveTo":a[0]+"To"].apply(this.ctx,a.slice(1))},this),this.ctx.closePath(),this.ctx},Ib.prototype.font=function(a,b,c,d,e,f){this.setFillStyle(a).font=[b,c,d,e,f].join(" ")},Ib.prototype.fontShadow=function(a,b,c,d){this.setVariable("shadowColor",a).setVariable("shadowOffsetY",b).setVariable("shadowOffsetX",c).setVariable("shadowBlur",d)},Ib.prototype.clearShadow=function(){this.setVariable("shadowColor","rgba(0,0,0,0)")},Ib.prototype.setOpacity=function(a){this.ctx.globalAlpha=a},Ib.prototype.setTransform=function(a){this.ctx.translate(a.origin[0],a.origin[1]),this.ctx.transform.apply(this.ctx,a.matrix),this.ctx.translate(-a.origin[0],-a.origin[1])},Ib.prototype.setVariable=function(a,b){return this.variables[a]!==b&&(this.variables[a]=this.ctx[a]=b),this},Ib.prototype.text=function(a,b,c){this.ctx.fillText(a,b,c)},Ib.prototype.backgroundRepeatShape=function(a,b,c,d,e,f,g,h,i){var j=[["line",Math.round(e),Math.round(f)],["line",Math.round(e+g),Math.round(f)],["line",Math.round(e+g),Math.round(h+f)],["line",Math.round(e),Math.round(h+f)]];this.clip([j],function(){this.renderBackgroundRepeat(a,b,c,d,i[3],i[0])},this)},Ib.prototype.renderBackgroundRepeat=function(a,b,c,d,e,f){var g=Math.round(d.left+b.left+e),h=Math.round(d.top+b.top+f);this.setFillStyle(this.ctx.createPattern(this.resizeImage(a,c),"repeat")),this.ctx.translate(g,h),this.ctx.fill(),this.ctx.translate(-g,-h)},Ib.prototype.renderBackgroundGradient=function(a,b){if(a instanceof z){var c=this.ctx.createLinearGradient(b.left+b.width*a.x0,b.top+b.height*a.y0,b.left+b.width*a.x1,b.top+b.height*a.y1);a.colorStops.forEach(function(a){c.addColorStop(a.stop,a.color)}),this.rectangle(b.left,b.top,b.width,b.height,c)}},Ib.prototype.resizeImage=function(a,c){var d=a.image;if(d.width===c.width&&d.height===c.height)return d;var e,f=b.createElement("canvas");return f.width=c.width,f.height=c.height,e=f.getContext("2d"),e.drawImage(d,0,0,d.width,d.height,0,0,c.width,c.height),f}}(window,document); \ No newline at end of file diff --git a/src/core.js b/src/core.js index 6357bbf..b3f94d5 100644 --- a/src/core.js +++ b/src/core.js @@ -154,8 +154,22 @@ function loadUrlDocument(src, proxy, document, width, height, options) { function documentFromHTML(src) { return function(html) { - var parser = new DOMParser(); - var doc = parser.parseFromString(html, "text/html"); + var parser = new DOMParser(), doc; + try { + doc = parser.parseFromString(html, "text/html"); + } catch(e) { + log("DOMParser not supported, falling back to createHTMLDocument"); + doc = document.implementation.createHTMLDocument(""); + try { + doc.open(); + doc.write(html); + doc.close(); + } catch(ee) { + log("createHTMLDocument write not supported, falling back to document.body.innerHTML"); + doc.body.innerHTML = html; // ie9 doesnt support writing to documentElement + } + } + var b = doc.querySelector("base"); if (!b || !b.href.host) { var base = doc.createElement("base");