/*! rasterizeHTML.js - v1.3.0 - 2018-03-18
* http://www.github.com/cburgmer/rasterizeHTML.js
* Copyright (c) 2018 Christoph Burgmer; Licensed MIT */
/* Integrated dependencies:
* url (MIT License),
* xmlserializer (MIT License),
* sane-domparser-error (BSD License),
* css-font-face-src (BSD License),
* inlineresources (MIT License) */
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).rasterizeHTML=e()}}(function(){return function a(s,i,u){function c(r,e){if(!i[r]){if(!s[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(l)return l(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var o=i[r]={exports:{}};s[r][0].call(o.exports,function(e){var t=s[r][1][e];return c(t||e)},o,o.exports,a,s,i,u)}return i[r].exports}for(var l="function"==typeof require&&require,e=0;e"),s.contentDocument.write(i),s.contentDocument.close()})};var v=function(e,t,r,n,o){var a,s,i,u,c,l,h,f,p,m,d,g=Math.max(e.scrollWidth,e.clientWidth),v=Math.max(e.scrollHeight,e.clientHeight);return t?(a=(l=function(e,t){var r=e.querySelector(t);if(r)return r;if(e.ownerDocument.querySelector(t)===e)return e;throw{message:"Clipping selector not found"}}(e,t).getBoundingClientRect()).top,s=l.left,i=l.width,u=l.height):(s=a=0,i=g,u=v),f={width:i,height:u},p=r,m=n,d=o,h={width:Math.max(f.width*d,p),height:Math.max(f.height*d,m)},c=y.getComputedStyle(e.ownerDocument.documentElement).fontSize,{left:s,top:a,width:h.width,height:h.height,viewportWidth:g,viewportHeight:v,rootFontSize:c}};e.calculateDocumentContentSize=function(d,g){return new Promise(function(o,a){var s,e,t,r,n,i,u,c,l,h,f,p,m=g.zoom||1;e=g.width,t=g.height,r=m,l=Math.floor(e/r),h=Math.floor(t/r),n=y.document,i=l,u=h,(c=n.createElement("iframe")).style.width=i+"px",c.style.height=u+"px",c.style.visibility="hidden",c.style.position="absolute",c.style.top=-1e4-u+"px",c.style.left=-1e4-i+"px",c.style.borderWidth=0,c.sandbox="allow-same-origin",c.scrolling="no",s=c,y.document.getElementsByTagName("body")[0].appendChild(s),s.onload=function(){var e,t,r,n=s.contentDocument;try{e=v((t=n,r=d.tagName,t.querySelector(r)),g.clip,g.width,g.height,m),o(e)}catch(e){a(e)}finally{y.document.getElementsByTagName("body")[0].removeChild(s)}},s.contentDocument.open(),s.contentDocument.write(""),s.contentDocument.write("html"===(p=(f=d).tagName.toLowerCase())||"body"===p?f.outerHTML:''+f.outerHTML+""),s.contentDocument.close()})},e.parseHtmlFragment=function(e){var t=y.document.implementation.createHTMLDocument("");t.documentElement.innerHTML=e;var r=t.querySelector("body").firstChild;if(!r)throw"Invalid source";return r};e.parseHTML=function(e){var t=y.document.implementation.createHTMLDocument("");return t.documentElement.innerHTML=e,function(e,t){var r,n,o,a,s=/]*)?)>/im.exec(t),i=y.document.implementation.createHTMLDocument("");if(s)for(r="",i.documentElement.innerHTML=r,o=i.querySelector("div"),n=0;n',i=function(o){return new Promise(function(t,e){var r=document.createElement("canvas"),n=new Image;n.onload=function(){var e=r.getContext("2d");try{e.drawImage(n,0,0),r.toDataURL("image/png"),t(!0)}catch(e){t(!1)}},n.onerror=e,n.src=o})},r=function(){return new Promise(function(t,e){var r;(function(){if(n.Blob)try{return new Blob([""],{type:"text/xml"}),!0}catch(e){}return!1})()&&n.URL?(r=o(a,!0),i(r).then(function(e){return s(r),!e&&i(o(a,!1)).then(function(e){return e})},function(){return!1})).then(function(e){t(!e)},function(){e()}):t(!1)})},u=function(t){return(void 0===e&&(e=r()),e).then(function(e){return o(t,e)})};return t.renderSvg=function(a){return new Promise(function(e,t){var r,n,o=function(){r&&s(r)};(n=new Image).onload=function(){n.onload=null,n.onerror=null,o(),e(n)},n.onerror=function(){o(),t()},u(a).then(function(e){r=e,n.src=r},t)})},t}(window);return function(h,i,f){"use strict";var u={};u.drawDocument=function(){var e,t,r,n,o,a,s,i=arguments[0],u=Array.prototype.slice.call(arguments,1),c=h.parseOptionalParameters(u),l=i.documentElement?i.documentElement:i;return f.rasterize(l,c.canvas,(r=(e=c).canvas,n=e.options,o=r?r.width:300,a=r?r.height:200,s={width:void 0!==n.width?n.width:o,height:void 0!==n.height?n.height:a},(t=h.clone(e.options)).width=s.width,t.height=s.height,t))};u.drawHTML=function(){var e,t,r,n,o=arguments[0],a=Array.prototype.slice.call(arguments,1),s=h.parseOptionalParameters(a);return e=o,t=s.canvas,r=s.options,n=i.parseHTML(e),u.drawDocument(n,t,r)};var n=function(r,n,o){return i.loadDocument(r,o).then(function(e){var t=function(e,t,r){var n=document.implementation.createHTMLDocument("");n.replaceChild(e.documentElement,n.documentElement);var o=r?h.clone(r):{};return r.baseUrl||(o.baseUrl=t),{document:n,options:o}}(e,r,o);return u.drawDocument(t.document,n,t.options)})};return u.drawURL=function(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1),r=h.parseOptionalParameters(t);return n(e,r.canvas,r.options)},u}(o,i,function(r,a,s,n,e,i){"use strict";var t={},o=function(e){return{message:"Error rendering page",originalError:e}},u=function(t){return e.renderSvg(t).then(function(e){return{image:e,svg:t}},function(e){throw o(e)})},c=function(e,t,r){return n.drawDocumentAsSvg(e,r).then(u).then(function(e){return t&&function(e,t){try{t.getContext("2d").drawImage(e,0,0)}catch(e){throw o(e)}}(e.image,t),e})};return t.rasterize=function(n,e,o){var t;return(t=r.clone(o)).inlineScripts=!0===o.executeJs,i.inlineReferences(n,t).then(function(t){return o.executeJs?(e=n,r=o,a.executeJavascript(e,r).then(function(e){var t=e.document;return s.persistInputValues(t),{document:t,errors:e.errors}})).then(function(e){return{element:e.document.documentElement,errors:t.concat(e.errors)}}):{element:n,errors:t};var e,r}).then(function(t){return c(t.element,e,o).then(function(e){return{image:e.image,svg:e.svg,errors:t.errors}})})},t}(o,i,s,function(e,p,n,m){"use strict";var o={},d=function(t){var e=Object.keys(t);return e.length?" "+e.map(function(e){return e+'="'+t[e]+'"'}).join(" "):""},a=function(e,t,r){var n=m.serializeToString(e);p.validateXHTML(n);var o,a,s,i,u,c,l,h,f=(o=t,a=Math.round(o.viewportWidth),s=Math.round(o.viewportHeight),{x:-o.left,y:-o.top,width:a,height:s});return u=(i=f).style||"",i.style=u+"float: left;",f.externalResourcesRequired=!0,'"};return o.getSvgForDocument=function(e,t,r){return n.rewriteTagNameSelectorsToLowerCase(e),a(e,t,r)},o.drawDocumentAsSvg=function(t,r){return["hover","active","focus","target"].forEach(function(e){r[e]&&n.fakeUserAction(t,r[e],e)}),p.calculateDocumentContentSize(t,r).then(function(e){return o.getSvgForDocument(t,e,r.zoom)})},o}(0,i,s,t),u,n))},void 0===(n=this)&&void 0!==window&&(n=window),"object"==typeof t&&t.exports?t.exports=o(e("url"),e("xmlserializer"),e("sane-domparser-error"),e("inlineresources")):n.rasterizeHTML=o(n.url,n.xmlserializer,n.sanedomparsererror,n.inlineresources)},{inlineresources:5,"sane-domparser-error":14,url:15,xmlserializer:17}],2:[function(h,r,n){(function(t){!function(e){"object"==typeof n&&void 0!==r?r.exports=e():("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:this).cssFontFaceSrc=e()}(function(){return function a(s,i,u){function c(r,e){if(!i[r]){if(!s[r]){var t="function"==typeof h&&h;if(!e&&t)return t(r,!0);if(l)return l(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var o=i[r]={exports:{}};s[r][0].call(o.exports,function(e){var t=s[r][1][e];return c(t||e)},o,o.exports,a,s,i,u)}return i[r].exports}for(var l="function"==typeof h&&h,e=0;e= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=y-w,R=Math.floor,A=String.fromCharCode;function U(e){throw RangeError(h[e])}function p(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function m(e,t){var r=e.split("@"),n="";return 1>>10&1023|55296),e=56320|1023&e),t+=A(e)}).join("")}function N(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function j(e,t,r){var n=0;for(e=r?R(e/i):e>>1,e+=R(e/t);f*x>>1R((v-m)/s))&&U("overflow"),m+=u*s,!(u<(c=i<=g?w:g+x<=i?x:i-g));i+=y)s>R(v/(l=y-c))&&U("overflow"),s*=l;g=j(m-a,t=f.length+1,0==a),R(m/t)>v-d&&U("overflow"),d+=R(m/t),m%=t,f.splice(m++,0,d)}return T(f)}function g(e){var t,r,n,o,a,s,i,u,c,l,h,f,p,m,d,g=[];for(f=(e=S(e)).length,t=C,a=b,s=r=0;sR((v-r)/(p=n+1))&&U("overflow"),r+=(i-t)*p,t=i,s=0;sv&&U("overflow"),h==t){for(u=r,c=y;!(u<(l=c<=a?w:a+x<=c?x:c-a));c+=y)d=u-l,m=y-l,g.push(A(N(l+d%m,0))),u=R(d/m);g.push(A(N(u,0))),a=j(r,p,n==o),r=0,++n}++r,++t}return g.join("")}if(o={version:"1.3.2",ucs2:{decode:S,encode:T},decode:d,encode:g,toASCII:function(e){return m(e,function(e){return c.test(e)?"xn--"+g(e):e})},toUnicode:function(e){return m(e,function(e){return u.test(e)?d(e.slice(4).toLowerCase()):e})}},t&&r)if(I.exports==t)r.exports=o;else for(a in o)o.hasOwnProperty(a)&&(t[a]=o[a]);else e.punycode=o}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],11:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){t=t||"&",r=r||"=";var o={};if("string"!=typeof e||0===e.length)return o;var a=/\+/g;e=e.split(t);var s=1e3;n&&"number"==typeof n.maxKeys&&(s=n.maxKeys);var i,u,c=e.length;0]*>This page contains the following errors:]*>(.+?)\n?
"),new RegExp("^(.+)\n")],o=function(e){var t,r,n,o,a=(t=e,r=new XMLSerializer,Array.prototype.map.call(t.childNodes,function(e){return r.serializeToString(e)}).join(""));for(n=0;n",'"',"`"," ","\r","\n","\t"]),k=["'"].concat(o),q=["%","/","?",";","#"].concat(k),M=["/","?","#"],H=/^[+a-z0-9A-Z_-]{0,63}$/,z=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,V={javascript:!0,"javascript:":!0},B={javascript:!0,"javascript:":!0},$={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},W=e("querystring");function a(e,t,r){if(e&&L.isObject(e)&&e instanceof S)return e;var n=new S;return n.parse(e,t,r),n}S.prototype.parse=function(e,t,r){if(!L.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),o=-1!==n&&n/g,">").replace(/"/g,""").replace(/'/g,"'")+'"')}),0",o+=s(e),o+=""+a(e)+">"):o+="/>",o},t=function(e,t){var r,n=t&&t.rootNode;return"#document"===e.nodeName||"#document-fragment"===e.nodeName?s(e):e.tagName?o(e,n):"#text"===e.nodeName?((r=e).nodeValue||r.value||"").replace(/&/g,"&").replace(//g,">"):"#comment"===e.nodeName?"\x3c!--"+e.data.replace(/-/g,"-")+"--\x3e":"#cdata-section"===e.nodeName?"":void 0};return{serializeToString:function(e){return t(e,{rootNode:!0}).replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g,"")}}},"object"==typeof t&&t.exports?t.exports=o():n.xmlserializer=o()},{}]},{},[1])(1)});