UNPKG

vue-2-img

Version:

An easy way to convert HTML sections and charts to JPG, PNG or PDF files

2 lines 16.2 kB
webpackJsonpVue2Img([1],{357:function(e,t,n){/*! @license DOMPurify | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.0.8/LICENSE */ !function(t,n){e.exports=n()}(0,function(){"use strict";function e(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function t(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return p(e,t,r)}}function n(e,t){l&&l(e,null);for(var n=t.length;n--;){var r=t[n];if("string"==typeof r){var o=v(r);o!==r&&(c(t)||(t[n]=o),r=o)}e[r]=!0}return e}function r(e){var t=d(null),n=void 0;for(n in e)p(a,e,[n])&&(t[n]=e[n]);return t}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:W(),t=function(e){return i(e)};if(t.version="2.2.2",t.removed=[],!e||!e.document||9!==e.document.nodeType)return t.isSupported=!1,t;var a=e.document,l=e.document,c=e.DocumentFragment,u=e.HTMLTemplateElement,d=e.Node,f=e.NodeFilter,p=e.NamedNodeMap,m=void 0===p?e.NamedNodeMap||e.MozNamedAttrMap:p,G=e.Text,q=e.Comment,V=e.DOMParser,K=e.trustedTypes;if("function"==typeof u){var Y=l.createElement("template");Y.content&&Y.content.ownerDocument&&(l=Y.content.ownerDocument)}var X=B(K,a),$=X&&Le?X.createHTML(""):"",J=l,Z=J.implementation,Q=J.createNodeIterator,ee=J.getElementsByTagName,te=J.createDocumentFragment,ne=a.importNode,re={};try{re=r(l).documentMode?l.documentMode:{}}catch(e){}var oe={};t.isSupported=Z&&void 0!==Z.createHTMLDocument&&9!==re;var ie=F,ae=C,le=H,ce=z,se=U,ue=j,de=I,fe=null,pe=n({},[].concat(o(_),o(E),o(D),o(L),o(w))),me=null,ye=n({},[].concat(o(M),o(N),o(O),o(R))),ge=null,he=null,ve=!0,be=!0,Te=!1,Ae=!1,xe=!1,Se=!1,ke=!1,_e=!1,Ee=!1,De=!0,Le=!1,we=!0,Me=!0,Ne=!1,Oe={},Re=n({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","plaintext","script","style","svg","template","thead","title","video","xmp"]),Fe=null,Ce=n({},["audio","video","img","source","image","track"]),He=null,ze=n({},["alt","class","for","id","label","name","pattern","placeholder","summary","title","value","style","xmlns"]),Ie=null,Ue=l.createElement("form"),je=function(e){Ie&&Ie===e||(e&&"object"===(void 0===e?"undefined":P(e))||(e={}),e=r(e),fe="ALLOWED_TAGS"in e?n({},e.ALLOWED_TAGS):pe,me="ALLOWED_ATTR"in e?n({},e.ALLOWED_ATTR):ye,He="ADD_URI_SAFE_ATTR"in e?n(r(ze),e.ADD_URI_SAFE_ATTR):ze,Fe="ADD_DATA_URI_TAGS"in e?n(r(Ce),e.ADD_DATA_URI_TAGS):Ce,ge="FORBID_TAGS"in e?n({},e.FORBID_TAGS):{},he="FORBID_ATTR"in e?n({},e.FORBID_ATTR):{},Oe="USE_PROFILES"in e&&e.USE_PROFILES,ve=!1!==e.ALLOW_ARIA_ATTR,be=!1!==e.ALLOW_DATA_ATTR,Te=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ae=e.SAFE_FOR_TEMPLATES||!1,xe=e.WHOLE_DOCUMENT||!1,_e=e.RETURN_DOM||!1,Ee=e.RETURN_DOM_FRAGMENT||!1,De=!1!==e.RETURN_DOM_IMPORT,Le=e.RETURN_TRUSTED_TYPE||!1,ke=e.FORCE_BODY||!1,we=!1!==e.SANITIZE_DOM,Me=!1!==e.KEEP_CONTENT,Ne=e.IN_PLACE||!1,de=e.ALLOWED_URI_REGEXP||de,Ae&&(be=!1),Ee&&(_e=!0),Oe&&(fe=n({},[].concat(o(w))),me=[],!0===Oe.html&&(n(fe,_),n(me,M)),!0===Oe.svg&&(n(fe,E),n(me,N),n(me,R)),!0===Oe.svgFilters&&(n(fe,D),n(me,N),n(me,R)),!0===Oe.mathMl&&(n(fe,L),n(me,O),n(me,R))),e.ADD_TAGS&&(fe===pe&&(fe=r(fe)),n(fe,e.ADD_TAGS)),e.ADD_ATTR&&(me===ye&&(me=r(me)),n(me,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&n(He,e.ADD_URI_SAFE_ATTR),Me&&(fe["#text"]=!0),xe&&n(fe,["html","head","body"]),fe.table&&(n(fe,["tbody"]),delete ge.tbody),s&&s(e),Ie=e)},Pe=function(e){h(t.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.outerHTML=$}},We=function(e,n){try{h(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch(e){h(t.removed,{attribute:null,from:n})}n.removeAttribute(e)},Be=function(e){var t=void 0,n=void 0;if(ke)e="<remove></remove>"+e;else{var r=b(e,/^[\r\n\t ]+/);n=r&&r[0]}var o=X?X.createHTML(e):e;try{t=(new V).parseFromString(o,"text/html")}catch(e){}if(!t||!t.documentElement){t=Z.createHTMLDocument("");var i=t,a=i.body;a.parentNode.removeChild(a.parentNode.firstElementChild),a.outerHTML=o}return e&&n&&t.body.insertBefore(l.createTextNode(n),t.body.childNodes[0]||null),ee.call(t,xe?"html":"body")[0]},Ge=function(e){return Q.call(e.ownerDocument||e,e,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT,function(){return f.FILTER_ACCEPT},!1)},qe=function(e){return!(e instanceof G||e instanceof q)&&!("string"==typeof e.nodeName&&"string"==typeof e.textContent&&"function"==typeof e.removeChild&&e.attributes instanceof m&&"function"==typeof e.removeAttribute&&"function"==typeof e.setAttribute&&"string"==typeof e.namespaceURI)},Ve=function(e){return"object"===(void 0===d?"undefined":P(d))?e instanceof d:e&&"object"===(void 0===e?"undefined":P(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Ke=function(e,n,r){oe[e]&&y(oe[e],function(e){e.call(t,n,r,Ie)})},Ye=function(e){var n=void 0;if(Ke("beforeSanitizeElements",e,null),qe(e))return Pe(e),!0;if(b(e.nodeName,/[\u0080-\uFFFF]/))return Pe(e),!0;var r=v(e.nodeName);if(Ke("uponSanitizeElement",e,{tagName:r,allowedTags:fe}),("svg"===r||"math"===r)&&0!==e.querySelectorAll("p, br, form, table").length)return Pe(e),!0;if(!Ve(e.firstElementChild)&&(!Ve(e.content)||!Ve(e.content.firstElementChild))&&S(/<[!\/\w]/g,e.innerHTML)&&S(/<[!\/\w]/g,e.textContent))return Pe(e),!0;if(!fe[r]||ge[r]){if(Me&&!Re[r]&&"function"==typeof e.insertAdjacentHTML)try{var o=e.innerHTML;e.insertAdjacentHTML("AfterEnd",X?X.createHTML(o):o)}catch(e){}return Pe(e),!0}return"noscript"!==r&&"noembed"!==r||!S(/<\/no(script|embed)/i,e.innerHTML)?(Ae&&3===e.nodeType&&(n=e.textContent,n=T(n,ie," "),n=T(n,ae," "),e.textContent!==n&&(h(t.removed,{element:e.cloneNode()}),e.textContent=n)),Ke("afterSanitizeElements",e,null),!1):(Pe(e),!0)},Xe=function(e,t,n){if(we&&("id"===t||"name"===t)&&(n in l||n in Ue))return!1;if(be&&S(le,t));else if(ve&&S(ce,t));else{if(!me[t]||he[t])return!1;if(He[t]);else if(S(de,T(n,ue,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==A(n,"data:")||!Fe[e]){if(Te&&!S(se,T(n,ue,"")));else if(n)return!1}else;}return!0},$e=function(e){var n=void 0,r=void 0,o=void 0,i=void 0;Ke("beforeSanitizeAttributes",e,null);var a=e.attributes;if(a){var l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:me};for(i=a.length;i--;){n=a[i];var c=n,s=c.name,u=c.namespaceURI;if(r=x(n.value),o=v(s),l.attrName=o,l.attrValue=r,l.keepAttr=!0,l.forceKeepAttr=void 0,Ke("uponSanitizeAttribute",e,l),r=l.attrValue,!l.forceKeepAttr&&(We(s,e),l.keepAttr))if(S(/\/>/i,r))We(s,e);else{Ae&&(r=T(r,ie," "),r=T(r,ae," "));var d=e.nodeName.toLowerCase();if(Xe(d,o,r))try{u?e.setAttributeNS(u,s,r):e.setAttribute(s,r),g(t.removed)}catch(e){}}}Ke("afterSanitizeAttributes",e,null)}},Je=function e(t){var n=void 0,r=Ge(t);for(Ke("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)Ke("uponSanitizeShadowNode",n,null),Ye(n)||(n.content instanceof c&&e(n.content),$e(n));Ke("afterSanitizeShadowDOM",t,null)};return t.sanitize=function(n,r){var o=void 0,i=void 0,l=void 0,s=void 0,u=void 0;if(n||(n="\x3c!--\x3e"),"string"!=typeof n&&!Ve(n)){if("function"!=typeof n.toString)throw k("toString is not a function");if("string"!=typeof(n=n.toString()))throw k("dirty is not a string, aborting")}if(!t.isSupported){if("object"===P(e.toStaticHTML)||"function"==typeof e.toStaticHTML){if("string"==typeof n)return e.toStaticHTML(n);if(Ve(n))return e.toStaticHTML(n.outerHTML)}return n}if(Se||je(r),t.removed=[],"string"==typeof n&&(Ne=!1),Ne);else if(n instanceof d)o=Be("\x3c!----\x3e"),i=o.ownerDocument.importNode(n,!0),1===i.nodeType&&"BODY"===i.nodeName?o=i:"HTML"===i.nodeName?o=i:o.appendChild(i);else{if(!_e&&!Ae&&!xe&&-1===n.indexOf("<"))return X&&Le?X.createHTML(n):n;if(!(o=Be(n)))return _e?null:$}o&&ke&&Pe(o.firstChild);for(var f=Ge(Ne?n:o);l=f.nextNode();)3===l.nodeType&&l===s||Ye(l)||(l.content instanceof c&&Je(l.content),$e(l),s=l);if(s=null,Ne)return n;if(_e){if(Ee)for(u=te.call(o.ownerDocument);o.firstChild;)u.appendChild(o.firstChild);else u=o;return De&&(u=ne.call(a,u,!0)),u}var p=xe?o.outerHTML:o.innerHTML;return Ae&&(p=T(p,ie," "),p=T(p,ae," ")),X&&Le?X.createHTML(p):p},t.setConfig=function(e){je(e),Se=!0},t.clearConfig=function(){Ie=null,Se=!1},t.isValidAttribute=function(e,t,n){Ie||je({});var r=v(e),o=v(t);return Xe(r,o,n)},t.addHook=function(e,t){"function"==typeof t&&(oe[e]=oe[e]||[],h(oe[e],t))},t.removeHook=function(e){oe[e]&&g(oe[e])},t.removeHooks=function(e){oe[e]&&(oe[e]=[])},t.removeAllHooks=function(){oe={}},t}var a=Object.hasOwnProperty,l=Object.setPrototypeOf,c=Object.isFrozen,s=Object.freeze,u=Object.seal,d=Object.create,f="undefined"!=typeof Reflect&&Reflect,p=f.apply,m=f.construct;p||(p=function(e,t,n){return e.apply(t,n)}),s||(s=function(e){return e}),u||(u=function(e){return e}),m||(m=function(t,n){return new(Function.prototype.bind.apply(t,[null].concat(e(n))))});var y=t(Array.prototype.forEach),g=t(Array.prototype.pop),h=t(Array.prototype.push),v=t(String.prototype.toLowerCase),b=t(String.prototype.match),T=t(String.prototype.replace),A=t(String.prototype.indexOf),x=t(String.prototype.trim),S=t(RegExp.prototype.test),k=function(e){return function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return m(e,n)}}(TypeError),_=s(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),E=s(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","audio","canvas","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","video","view","vkern"]),D=s(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),L=s(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),w=s(["#text"]),M=s(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns"]),N=s(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),O=s(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),R=s(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),F=u(/\{\{[\s\S]*|[\s\S]*\}\}/gm),C=u(/<%[\s\S]*|[\s\S]*%>/gm),H=u(/^data-[\-\w.\u00B7-\uFFFF]/),z=u(/^aria-[\-\w]+$/),I=u(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),U=u(/^(?:\w+script|data):/i),j=u(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},W=function(){return"undefined"==typeof window?null:window},B=function(e,t){if("object"!==(void 0===e?"undefined":P(e))||"function"!=typeof e.createPolicy)return null;var n=null;t.currentScript&&t.currentScript.hasAttribute("data-tt-policy-suffix")&&(n=t.currentScript.getAttribute("data-tt-policy-suffix"));var r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}};return i()})}});