(function(a,b,c,d,e,f,g){functionh(a,b,c,d){returno(a,a,c,d,b).then(function(e){E("Document cloned");varf="["+Qb+"='true']";a.querySelector(f).removeAttribute(Qb);varg=e.contentWindow,h=g.document.querySelector(f),j=Promise.resolve("function"==typeofb.onclone?b.onclone(g.document):!0);returnj.then(function(){returni(h,e,b,c,d)})})}functioni(a,c,d,e,f){varg=c.contentWindow,h=newGb(g.document),i=newC(d,h),n=M(a),o="view"===d.type?e:l(g.document),p="view"===d.type?f:m(g.document),q=newOb(o,p,i,d,b),r=newO(a,q,h,i,d);returnr.ready.then(function(){E("Finished rendering");varb;returnb="view"===d.type?k(q.canvas,{width:q.canvas.width,height:q.canvas.height,top:0,left:0,x:0,y:0}):a===g.document.body||a===g.document.documentElement||null!=d.canvas?q.canvas:k(q.canvas,{width:null!=d.width?d.width:n.width,height:null!=d.height?d.height:n.height,top:n.top,left:n.left,x:g.pageXOffset,y:g.pageYOffset}),j(c,d),b})}functionj(a,b){b.removeContainer&&(a.parentNode.removeChild(a),E("Cleaned up container"))}functionk(a,c){vard=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));returnd.width=c.width,d.height=c.height,E("Cropping canvas at:","left:",c.left,"top:",c.top,"width:",f-e,"height:",h-g),E("Resulting crop with width",c.width,"and height",c.height," with x",e,"and y",g),d.getContext("2d").drawImage(a,e,g,f-e,h-g,c.x,c.y,f-e,h-g),d}functionl(a){returnMath.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))}functionm(a){returnMath.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))}functionn(){return"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"}functiono(a,b,c,d,e){r(a);varf=a.documentElement.cloneNode(!0),g=b.createElement("iframe");returng.className="html2canvas-container",g.style.visibility="hidden",g.style.position="absolute",g.style.left=g.style.top="-10000px",g.width=c,g.height=d,g.scrolling="no",b.body.appendChild(g),newPromise(function(b){varc=g.contentWindow.document;g.contentWindow.onload=g.onload=function(){varf=setInterval(function(){c.body.childNodes.length>0&&(s(a,c),clearInterval(f),"view"===e.type&&g.contentWindow.scrollTo(d,h),b(g))},50)};vard=a.defaultView.pageXOffset,h=a.defaultView.pageYOffset;c.open(),c.write("<!DOCTYPE html><html></html>"),(d!==a.defaultView.pageXOffset||h!==a.defaultView.pageYOffset)&&a.defaultView.scrollTo(d,h),c.replaceChild(e.javascriptEnabled===!0?c.adoptNode(f):t(c.adoptNode(f)),c.documentElement),c.close()})}functionp(b,c,d,e,f,g){returnnewxb(b,c,a.document).then(q(b)).then(function(a){returno(a,d,e,f,g)})}functionq(a){returnfunction(c){vard,e=newDOMParser;try{d=e.parseFromString(c,"text/html")}catch(f){E("DOMParser not supported, falling back to createHTMLDocument"),d=b.implementation.createHTMLDocument("");try{d.open(),d.write(c),d.close()}catch(g){E("createHTMLDocument write not supported, falling back to document.body.innerHTML"),d.body.innerHTML=c}}varh=d.querySelector("base");if(!h||!h.href.host){vari=d.createElement("base");i.href=a,d.head.insertBefore(i,d.head.firstChild)}returnd}}functionr(a){[].slice.call(a.querySelectorAll("canvas"),0).forEach(function(a){a.setAttribute(Rb,"canvas-"+Sb++)})}functions(a,b){[].slice.call(a.querySelectorAll("["+Rb+"]"),0).forEach(function(a){try{varc=b.querySelector("["+Rb+'="'+a.getAttribute(Rb)+'"]');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){E("Unable to copy canvas content from",a,d)}a.removeAttribute(Rb)})}functiont(a){return[].slice.call(a.childNodes,0).filter(u).forEach(function(b){"SCRIPT"===b.tagName?a.removeChild(b):t(b)}),a}functionu(a){returna.nodeTyp