url-sanitizer 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- function Bt(n,t){(t==null||t>n.length)&&(t=n.length);for(var s=0,r=Array(t);s<t;s++)r[s]=n[s];return r}function Dn(n){if(Array.isArray(n))return n}function In(n,t){var s=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(s!=null){var r,i,l,m,p=[],h=!0,E=!1;try{if(l=(s=s.call(n)).next,t!==0)for(;!(h=(r=l.call(s)).done)&&(p.push(r.value),p.length!==t);h=!0);}catch(d){E=!0,i=d}finally{try{if(!h&&s.return!=null&&(m=s.return(),Object(m)!==m))return}finally{if(E)throw i}}return p}}function Nn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cn(n,t){return Dn(n)||In(n,t)||Mn(n,t)||Nn()}function Mn(n,t){if(n){if(typeof n=="string")return Bt(n,t);var s={}.toString.call(n).slice(8,-1);return s==="Object"&&n.constructor&&(s=n.constructor.name),s==="Map"||s==="Set"?Array.from(n):s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?Bt(n,t):void 0}}var nn=Object.entries,jt=Object.setPrototypeOf,vn=Object.isFrozen,Un=Object.getPrototypeOf,Pn=Object.getOwnPropertyDescriptor,U=Object.freeze,$=Object.seal,Te=Object.create,sn=typeof Reflect<"u"&&Reflect,ft=sn.apply,mt=sn.construct;U||(U=function(t){return t});$||($=function(t){return t});ft||(ft=function(t,s){for(var r=arguments.length,i=new Array(r>2?r-2:0),l=2;l<r;l++)i[l-2]=arguments[l];return t.apply(s,i)});mt||(mt=function(t){for(var s=arguments.length,r=new Array(s>1?s-1:0),i=1;i<s;i++)r[i-1]=arguments[i];return new t(...r)});var ue=S(Array.prototype.forEach),kn=S(Array.prototype.lastIndexOf),Wt=S(Array.prototype.pop),de=S(Array.prototype.push),Fn=S(Array.prototype.splice),v=Array.isArray,Le=S(String.prototype.toLowerCase),it=S(String.prototype.toString),Yt=S(String.prototype.match),he=S(String.prototype.replace),Xt=S(String.prototype.indexOf),zn=S(String.prototype.trim),Gn=S(Number.prototype.toString),$n=S(Boolean.prototype.toString),qt=typeof BigInt>"u"?null:S(BigInt.prototype.toString),Vt=typeof Symbol>"u"?null:S(Symbol.prototype.toString),A=S(Object.prototype.hasOwnProperty),Oe=S(Object.prototype.toString),N=S(RegExp.prototype.test),ke=Hn(TypeError);function S(n){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var s=arguments.length,r=new Array(s>1?s-1:0),i=1;i<s;i++)r[i-1]=arguments[i];return ft(n,t,r)}}function Hn(n){return function(){for(var t=arguments.length,s=new Array(t),r=0;r<t;r++)s[r]=arguments[r];return mt(n,s)}}function f(n,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Le;if(jt&&jt(n,null),!v(t))return n;let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){let l=s(i);l!==i&&(vn(t)||(t[r]=l),i=l)}n[i]=!0}return n}function Bn(n){for(let t=0;t<n.length;t++)A(n,t)||(n[t]=null);return n}function k(n){let t=Te(null);for(let r of nn(n)){var s=Cn(r,2);let i=s[0],l=s[1];A(n,i)&&(v(l)?t[i]=Bn(l):l&&typeof l=="object"&&l.constructor===Object?t[i]=k(l):t[i]=l)}return t}function jn(n){switch(typeof n){case"string":return n;case"number":return Gn(n);case"boolean":return $n(n);case"bigint":return qt?qt(n):"0";case"symbol":return Vt?Vt(n):"Symbol()";case"undefined":return Oe(n);case"function":case"object":{if(n===null)return Oe(n);let t=n,s=Ee(t,"toString");if(typeof s=="function"){let r=s(t);return typeof r=="string"?r:Oe(r)}return Oe(n)}default:return Oe(n)}}function Ee(n,t){for(;n!==null;){let r=Pn(n,t);if(r){if(r.get)return S(r.get);if(typeof r.value=="function")return S(r.value)}n=Un(n)}function s(){return null}return s}function Wn(n){try{return N(n,""),!0}catch{return!1}}var Zt=U(["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","search","section","select","shadow","slot","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"]),at=U(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),lt=U(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Yn=U(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ct=U(["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","mprescripts"]),Xn=U(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Kt=U(["#text"]),Qt=U(["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","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),pt=U(["accent-height","accumulate","additive","alignment-baseline","amplitude","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","exponent","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","intercept","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","mask-type","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","slope","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","tablevalues","targetx","targety","transform","transform-origin","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"]),Jt=U(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),Fe=U(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),qn=$(/{{[\w\W]*|^[\w\W]*}}/g),Vn=$(/<%[\w\W]*|^[\w\W]*%>/g),Zn=$(/\${[\w\W]*/g),Kn=$(/^data-[\-\w.\u00B7-\uFFFF]+$/),Qn=$(/^aria-[\-\w]+$/),en=$(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Jn=$(/^(?:\w+script|data):/i),es=$(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ts=$(/^html$/i),ns=$(/^[a-z][.\w]*(-[.\w]+)+$/i),ge={element:1,text:3,progressingInstruction:7,comment:8,document:9},ss=function(){return typeof window>"u"?null:window},os=function(t,s){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null,i="data-tt-policy-suffix";s&&s.hasAttribute(i)&&(r=s.getAttribute(i));let l="dompurify"+(r?"#"+r:"");try{return t.createPolicy(l,{createHTML(m){return m},createScriptURL(m){return m}})}catch{return console.warn("TrustedTypes policy "+l+" could not be created."),null}},tn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function on(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ss(),t=c=>on(c);if(t.version="3.4.3",t.removed=[],!n||!n.document||n.document.nodeType!==ge.document||!n.Element)return t.isSupported=!1,t;let s=n.document,r=s,i=r.currentScript,l=n.DocumentFragment,m=n.HTMLTemplateElement,p=n.Node,h=n.Element,E=n.NodeFilter,d=n.NamedNodeMap,b=d===void 0?n.NamedNodeMap||n.MozNamedAttrMap:d,T=n.HTMLFormElement,_=n.DOMParser,M=n.trustedTypes,z=h.prototype,Ae=Ee(z,"cloneNode"),ye=Ee(z,"remove"),ie=Ee(z,"nextSibling"),H=Ee(z,"childNodes"),B=Ee(z,"parentNode");if(typeof m=="function"){let c=s.createElement("template");c.content&&c.content.ownerDocument&&(s=c.content.ownerDocument)}let g,j="",K=s,Q=K.implementation,ae=K.createNodeIterator,De=K.createDocumentFragment,F=K.getElementsByTagName,Ie=r.importNode,w=tn();t.isSupported=typeof nn=="function"&&typeof B=="function"&&Q&&Q.createHTMLDocument!==void 0;let te=qn,be=Vn,le=Zn,En=Kn,_n=Qn,An=Jn,_t=es,yn=ns,At=en,O=null,yt=f({},[...Zt,...at,...lt,...ct,...Kt]),I=null,bt=f({},[...Qt,...pt,...Jt,...Fe]),y=Object.seal(Te(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Re=null,Ne=null,J=Object.seal(Te(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Rt=!0,We=!0,St=!1,wt=!0,ne=!1,Se=!0,se=!1,Ye=!1,Xe=!1,ce=!1,Ce=!1,Me=!1,xt=!0,Ot=!1,Lt="user-content-",qe=!0,we=!1,pe={},X=null,Ve=f({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Dt=null,It=f({},["audio","video","img","source","image","track"]),Ze=null,Nt=f({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ve="http://www.w3.org/1998/Math/MathML",Ue="http://www.w3.org/2000/svg",q="http://www.w3.org/1999/xhtml",fe=q,Ke=!1,Qe=null,bn=f({},[ve,Ue,q],it),Je=f({},["mi","mo","mn","ms","mtext"]),et=f({},["annotation-xml"]),Rn=f({},["title","style","font","a","script"]),xe=null,Sn=["application/xhtml+xml","text/html"],wn="text/html",x=null,me=null,xn=s.createElement("form"),Ct=function(e){return e instanceof RegExp||e instanceof Function},tt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(me&&me===e)return;(!e||typeof e!="object")&&(e={}),e=k(e),xe=Sn.indexOf(e.PARSER_MEDIA_TYPE)===-1?wn:e.PARSER_MEDIA_TYPE,x=xe==="application/xhtml+xml"?it:Le,O=A(e,"ALLOWED_TAGS")&&v(e.ALLOWED_TAGS)?f({},e.ALLOWED_TAGS,x):yt,I=A(e,"ALLOWED_ATTR")&&v(e.ALLOWED_ATTR)?f({},e.ALLOWED_ATTR,x):bt,Qe=A(e,"ALLOWED_NAMESPACES")&&v(e.ALLOWED_NAMESPACES)?f({},e.ALLOWED_NAMESPACES,it):bn,Ze=A(e,"ADD_URI_SAFE_ATTR")&&v(e.ADD_URI_SAFE_ATTR)?f(k(Nt),e.ADD_URI_SAFE_ATTR,x):Nt,Dt=A(e,"ADD_DATA_URI_TAGS")&&v(e.ADD_DATA_URI_TAGS)?f(k(It),e.ADD_DATA_URI_TAGS,x):It,X=A(e,"FORBID_CONTENTS")&&v(e.FORBID_CONTENTS)?f({},e.FORBID_CONTENTS,x):Ve,Re=A(e,"FORBID_TAGS")&&v(e.FORBID_TAGS)?f({},e.FORBID_TAGS,x):k({}),Ne=A(e,"FORBID_ATTR")&&v(e.FORBID_ATTR)?f({},e.FORBID_ATTR,x):k({}),pe=A(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?k(e.USE_PROFILES):e.USE_PROFILES:!1,Rt=e.ALLOW_ARIA_ATTR!==!1,We=e.ALLOW_DATA_ATTR!==!1,St=e.ALLOW_UNKNOWN_PROTOCOLS||!1,wt=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ne=e.SAFE_FOR_TEMPLATES||!1,Se=e.SAFE_FOR_XML!==!1,se=e.WHOLE_DOCUMENT||!1,ce=e.RETURN_DOM||!1,Ce=e.RETURN_DOM_FRAGMENT||!1,Me=e.RETURN_TRUSTED_TYPE||!1,Xe=e.FORCE_BODY||!1,xt=e.SANITIZE_DOM!==!1,Ot=e.SANITIZE_NAMED_PROPS||!1,qe=e.KEEP_CONTENT!==!1,we=e.IN_PLACE||!1,At=Wn(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:en,fe=typeof e.NAMESPACE=="string"?e.NAMESPACE:q,Je=A(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS=="object"?k(e.MATHML_TEXT_INTEGRATION_POINTS):f({},["mi","mo","mn","ms","mtext"]),et=A(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS=="object"?k(e.HTML_INTEGRATION_POINTS):f({},["annotation-xml"]);let o=A(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING=="object"?k(e.CUSTOM_ELEMENT_HANDLING):Te(null);if(y=Te(null),A(o,"tagNameCheck")&&Ct(o.tagNameCheck)&&(y.tagNameCheck=o.tagNameCheck),A(o,"attributeNameCheck")&&Ct(o.attributeNameCheck)&&(y.attributeNameCheck=o.attributeNameCheck),A(o,"allowCustomizedBuiltInElements")&&typeof o.allowCustomizedBuiltInElements=="boolean"&&(y.allowCustomizedBuiltInElements=o.allowCustomizedBuiltInElements),ne&&(We=!1),Ce&&(ce=!0),pe&&(O=f({},Kt),I=Te(null),pe.html===!0&&(f(O,Zt),f(I,Qt)),pe.svg===!0&&(f(O,at),f(I,pt),f(I,Fe)),pe.svgFilters===!0&&(f(O,lt),f(I,pt),f(I,Fe)),pe.mathMl===!0&&(f(O,ct),f(I,Jt),f(I,Fe))),J.tagCheck=null,J.attributeCheck=null,A(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?J.tagCheck=e.ADD_TAGS:v(e.ADD_TAGS)&&(O===yt&&(O=k(O)),f(O,e.ADD_TAGS,x))),A(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?J.attributeCheck=e.ADD_ATTR:v(e.ADD_ATTR)&&(I===bt&&(I=k(I)),f(I,e.ADD_ATTR,x))),A(e,"ADD_URI_SAFE_ATTR")&&v(e.ADD_URI_SAFE_ATTR)&&f(Ze,e.ADD_URI_SAFE_ATTR,x),A(e,"FORBID_CONTENTS")&&v(e.FORBID_CONTENTS)&&(X===Ve&&(X=k(X)),f(X,e.FORBID_CONTENTS,x)),A(e,"ADD_FORBID_CONTENTS")&&v(e.ADD_FORBID_CONTENTS)&&(X===Ve&&(X=k(X)),f(X,e.ADD_FORBID_CONTENTS,x)),qe&&(O["#text"]=!0),se&&f(O,["html","head","body"]),O.table&&(f(O,["tbody"]),delete Re.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw ke('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ke('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');g=e.TRUSTED_TYPES_POLICY,j=g.createHTML("")}else g===void 0&&(g=os(M,i)),g!==null&&typeof j=="string"&&(j=g.createHTML(""));U&&U(e),me=e},Mt=f({},[...at,...lt,...Yn]),vt=f({},[...ct,...Xn]),On=function(e){let o=B(e);(!o||!o.tagName)&&(o={namespaceURI:fe,tagName:"template"});let a=Le(e.tagName),u=Le(o.tagName);return Qe[e.namespaceURI]?e.namespaceURI===Ue?o.namespaceURI===q?a==="svg":o.namespaceURI===ve?a==="svg"&&(u==="annotation-xml"||Je[u]):!!Mt[a]:e.namespaceURI===ve?o.namespaceURI===q?a==="math":o.namespaceURI===Ue?a==="math"&&et[u]:!!vt[a]:e.namespaceURI===q?o.namespaceURI===Ue&&!et[u]||o.namespaceURI===ve&&!Je[u]?!1:!vt[a]&&(Rn[a]||!Mt[a]):!!(xe==="application/xhtml+xml"&&Qe[e.namespaceURI]):!1},W=function(e){de(t.removed,{element:e});try{B(e).removeChild(e)}catch{ye(e)}},oe=function(e,o){try{de(t.removed,{attribute:o.getAttributeNode(e),from:o})}catch{de(t.removed,{attribute:null,from:o})}if(o.removeAttribute(e),e==="is")if(ce||Ce)try{W(o)}catch{}else try{o.setAttribute(e,"")}catch{}},Ut=function(e){let o=null,a=null;if(Xe)e="<remove></remove>"+e;else{let R=Yt(e,/^[\r\n\t ]+/);a=R&&R[0]}xe==="application/xhtml+xml"&&fe===q&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let u=g?g.createHTML(e):e;if(fe===q)try{o=new _().parseFromString(u,xe)}catch{}if(!o||!o.documentElement){o=Q.createDocument(fe,"template",null);try{o.documentElement.innerHTML=Ke?j:u}catch{}}let L=o.body||o.documentElement;return e&&a&&L.insertBefore(s.createTextNode(a),L.childNodes[0]||null),fe===q?F.call(o,se?"html":"body")[0]:se?o.documentElement:L},Pt=function(e){return ae.call(e.ownerDocument||e,e,E.SHOW_ELEMENT|E.SHOW_COMMENT|E.SHOW_TEXT|E.SHOW_PROCESSING_INSTRUCTION|E.SHOW_CDATA_SECTION,null)},nt=function(e){return e instanceof T&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof b)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},st=function(e){return typeof p=="function"&&e instanceof p};function Z(c,e,o){ue(c,a=>{a.call(t,e,o,me)})}let kt=function(e){let o=null;if(Z(w.beforeSanitizeElements,e,null),nt(e))return W(e),!0;let a=x(e.nodeName);if(Z(w.uponSanitizeElement,e,{tagName:a,allowedTags:O}),Se&&e.hasChildNodes()&&!st(e.firstElementChild)&&N(/<[/\w!]/g,e.innerHTML)&&N(/<[/\w!]/g,e.textContent)||Se&&e.namespaceURI===q&&a==="style"&&st(e.firstElementChild)||e.nodeType===ge.progressingInstruction||Se&&e.nodeType===ge.comment&&N(/<[/\w]/g,e.data))return W(e),!0;if(Re[a]||!(J.tagCheck instanceof Function&&J.tagCheck(a))&&!O[a]){if(!Re[a]&&zt(a)&&(y.tagNameCheck instanceof RegExp&&N(y.tagNameCheck,a)||y.tagNameCheck instanceof Function&&y.tagNameCheck(a)))return!1;if(qe&&!X[a]){let u=B(e)||e.parentNode,L=H(e)||e.childNodes;if(L&&u){let R=L.length;for(let P=R-1;P>=0;--P){let G=Ae(L[P],!0);u.insertBefore(G,ie(e))}}}return W(e),!0}return e instanceof h&&!On(e)||(a==="noscript"||a==="noembed"||a==="noframes")&&N(/<\/no(script|embed|frames)/i,e.innerHTML)?(W(e),!0):(ne&&e.nodeType===ge.text&&(o=e.textContent,ue([te,be,le],u=>{o=he(o,u," ")}),e.textContent!==o&&(de(t.removed,{element:e.cloneNode()}),e.textContent=o)),Z(w.afterSanitizeElements,e,null),!1)},Ft=function(e,o,a){if(Ne[o]||xt&&(o==="id"||o==="name")&&(a in s||a in xn))return!1;let u=I[o]||J.attributeCheck instanceof Function&&J.attributeCheck(o,e);if(!(We&&!Ne[o]&&N(En,o))){if(!(Rt&&N(_n,o))){if(!u||Ne[o]){if(!(zt(e)&&(y.tagNameCheck instanceof RegExp&&N(y.tagNameCheck,e)||y.tagNameCheck instanceof Function&&y.tagNameCheck(e))&&(y.attributeNameCheck instanceof RegExp&&N(y.attributeNameCheck,o)||y.attributeNameCheck instanceof Function&&y.attributeNameCheck(o,e))||o==="is"&&y.allowCustomizedBuiltInElements&&(y.tagNameCheck instanceof RegExp&&N(y.tagNameCheck,a)||y.tagNameCheck instanceof Function&&y.tagNameCheck(a))))return!1}else if(!Ze[o]){if(!N(At,he(a,_t,""))){if(!((o==="src"||o==="xlink:href"||o==="href")&&e!=="script"&&Xt(a,"data:")===0&&Dt[e])){if(!(St&&!N(An,he(a,_t,"")))){if(a)return!1}}}}}}return!0},Ln=f({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),zt=function(e){return!Ln[Le(e)]&&N(yn,e)},Gt=function(e){Z(w.beforeSanitizeAttributes,e,null);let o=e.attributes;if(!o||nt(e))return;let a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:I,forceKeepAttr:void 0},u=o.length;for(;u--;){let L=o[u],R=L.name,P=L.namespaceURI,G=L.value,Y=x(R),rt=G,D=R==="value"?rt:zn(rt);if(a.attrName=Y,a.attrValue=D,a.keepAttr=!0,a.forceKeepAttr=void 0,Z(w.uponSanitizeAttribute,e,a),D=a.attrValue,Ot&&(Y==="id"||Y==="name")&&Xt(D,Lt)!==0&&(oe(R,e),D=Lt+D),Se&&N(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,D)){oe(R,e);continue}if(Y==="attributename"&&Yt(D,"href")){oe(R,e);continue}if(a.forceKeepAttr)continue;if(!a.keepAttr){oe(R,e);continue}if(!wt&&N(/\/>/i,D)){oe(R,e);continue}ne&&ue([te,be,le],Ht=>{D=he(D,Ht," ")});let $t=x(e.nodeName);if(!Ft($t,Y,D)){oe(R,e);continue}if(g&&typeof M=="object"&&typeof M.getAttributeType=="function"&&!P)switch(M.getAttributeType($t,Y)){case"TrustedHTML":{D=g.createHTML(D);break}case"TrustedScriptURL":{D=g.createScriptURL(D);break}}if(D!==rt)try{P?e.setAttributeNS(P,R,D):e.setAttribute(R,D),nt(e)?W(e):Wt(t.removed)}catch{oe(R,e)}}Z(w.afterSanitizeAttributes,e,null)},ot=function(e){let o=null,a=Pt(e);for(Z(w.beforeSanitizeShadowDOM,e,null);o=a.nextNode();)Z(w.uponSanitizeShadowNode,o,null),kt(o),Gt(o),o.content instanceof l&&ot(o.content);Z(w.afterSanitizeShadowDOM,e,null)},Pe=function(e){if(e.nodeType===ge.element&&e.shadowRoot instanceof l){let u=e.shadowRoot;Pe(u),ot(u)}let o=e.childNodes;if(!o)return;let a=[];ue(o,u=>{de(a,u)});for(let u of a)Pe(u)};return t.sanitize=function(c){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=null,a=null,u=null,L=null;if(Ke=!c,Ke&&(c="<!-->"),typeof c!="string"&&!st(c)&&(c=jn(c),typeof c!="string"))throw ke("dirty is not a string, aborting");if(!t.isSupported)return c;if(Ye||tt(e),t.removed=[],typeof c=="string"&&(we=!1),we){let G=c.nodeName;if(typeof G=="string"){let Y=x(G);if(!O[Y]||Re[Y])throw ke("root node is forbidden and cannot be sanitized in-place")}Pe(c)}else if(c instanceof p)o=Ut("<!---->"),a=o.ownerDocument.importNode(c,!0),a.nodeType===ge.element&&a.nodeName==="BODY"||a.nodeName==="HTML"?o=a:o.appendChild(a),Pe(a);else{if(!ce&&!ne&&!se&&c.indexOf("<")===-1)return g&&Me?g.createHTML(c):c;if(o=Ut(c),!o)return ce?null:Me?j:""}o&&Xe&&W(o.firstChild);let R=Pt(we?c:o);for(;u=R.nextNode();)kt(u),Gt(u),u.content instanceof l&&ot(u.content);if(we)return c;if(ce){if(ne){o.normalize();let G=o.innerHTML;ue([te,be,le],Y=>{G=he(G,Y," ")}),o.innerHTML=G}if(Ce)for(L=De.call(o.ownerDocument);o.firstChild;)L.appendChild(o.firstChild);else L=o;return(I.shadowroot||I.shadowrootmode)&&(L=Ie.call(r,L,!0)),L}let P=se?o.outerHTML:o.innerHTML;return se&&O["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&N(ts,o.ownerDocument.doctype.name)&&(P="<!DOCTYPE "+o.ownerDocument.doctype.name+`>
3
- `+P),ne&&ue([te,be,le],G=>{P=he(P,G," ")}),g&&Me?g.createHTML(P):P},t.setConfig=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tt(c),Ye=!0},t.clearConfig=function(){me=null,Ye=!1},t.isValidAttribute=function(c,e,o){me||tt({});let a=x(c),u=x(e);return Ft(a,u,o)},t.addHook=function(c,e){typeof e=="function"&&de(w[c],e)},t.removeHook=function(c,e){if(e!==void 0){let o=kn(w[c],e);return o===-1?void 0:Fn(w[c],o,1)[0]}return Wt(w[c])},t.removeHooks=function(c){w[c]=[]},t.removeAllHooks=function(){w=tn()},t}var ut=on();var rn=/^[\w+/=-]+$/;var ze=/data:[\w#&+./;=-]*,/,dt=/data:[\w#&+./;=^]*base64,[\w+/=-]+/i,an=/data:[\w#&+./;=-]*,[^\x22]+/g,ln=/&#(x(?:00)?[\dA-F]{2}|0?\d{1,3});?/gi,cn=/^(?:application\/(?:[\w#&.;-]+\+)?x|image\/svg\+x|text\/(?:ht|x))ml;?/;var pn=/^[a-z][\da-z+.-]*$/,fn=/^(?:ext|web)\+[a-z]+$/,ht=/(?:java|vb)script/,Ge=/(?:java|vb)script|blob/,gt=/%(?:22|27|3C|3E)|[\x22\x27<>]/,mn=/^%[\dA-F]{2}$/i;var V=n=>Object.prototype.toString.call(n).slice(8,-1),C=n=>typeof n=="string"||n instanceof String;var{FileReader:un}=globalThis;var $e=[7,8,9,10,11,12,13,27,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255];var He=["aaa","aaas","about","acap","acct","acd","acr","adiumxtra","adt","afp","afs","agtp","aim","amss","android","appdata","apt","ar","ari","ark","at","attachment","aw","barion","beshare","bitcoin","bitcoincash","bl","blob","bluetooth","bolo","brid","browserext","cabal","caip","calculator","callto","cap","cast","casts","chrome","chrome-extension","cid","coap","coaps","com-eventbrite-attendee","content","content-type","crid","cstr","cttps","cvs","dab","dat","data","dav","dhttp","diaspora","dict","did","dilithium3","dis","dlna-playcontainer","dlna-playsingle","dnp","dns","dntp","doi","donau","dpp","drm","dtmi","dtn","dvb","dvx","dweb","ed2k","eid","elsi","embedded","ens","esim","ethereum","example","facetime","feed","feedready","fido","file","finger","first-run-pen-experience","fish","fm","ftp","fuchsia-pkg","geo","gg","git","gitoid","gizmoproject","go","gopher","graph","gtalk","h323","ham","hcap","hcp","hs20","http","https","hxxp","hxxps","hydrazone","hyper","i0","iax","ibi","ibi-","icap","icon","ilstring","im","imap","info","iotdisco","ipfs","ipn","ipns","ipp","ipps","irc","irc6","ircs","iris","iris.beep","iris.lwz","iris.xpc","iris.xpcs","isostore","itms","jabber","jar","jms","keyparc","lastfm","lbry","ldap","ldaps","leaptofrogans","lid","linkid","lorawan","lpa","lvlt","machineProvisioningProgressReporter","magnet","mailto","maps","market","matrix","message","microsoft.windows.camera","microsoft.windows.camera.multipicker","microsoft.windows.camera.picker","mid","mms","mongodb","moz","moz-extension","mqtt","mqtts","ms-access","ms-appinstaller","ms-browser-extension","ms-calculator","ms-drive-to","ms-enrollment","ms-excel","ms-eyecontrolspeech","ms-gamebarservices","ms-gamingoverlay","ms-getoffice","ms-help","ms-infopath","ms-inputapp","ms-launchremotedesktop","ms-lockscreencomponent-config","ms-media-stream-id","ms-meetnow","ms-mixedrealitycapture","ms-mobileplans","ms-newsandinterests","ms-officeapp","ms-people","ms-personacard","ms-powerpoint","ms-project","ms-publisher","ms-recall","ms-remotedesktop","ms-remotedesktop-launch","ms-restoretabcompanion","ms-screenclip","ms-screensketch","ms-search","ms-search-repair","ms-secondary-screen-controller","ms-secondary-screen-setup","ms-settings","ms-settings-airplanemode","ms-settings-bluetooth","ms-settings-camera","ms-settings-cellular","ms-settings-cloudstorage","ms-settings-connectabledevices","ms-settings-displays-topology","ms-settings-emailandaccounts","ms-settings-language","ms-settings-location","ms-settings-lock","ms-settings-nfctransactions","ms-settings-notifications","ms-settings-power","ms-settings-privacy","ms-settings-proximity","ms-settings-screenrotation","ms-settings-wifi","ms-settings-workplace","ms-spd","ms-stickers","ms-sttoverlay","ms-transit-to","ms-useractivityset","ms-uup","ms-virtualtouchpad","ms-visio","ms-walk-to","ms-whiteboard","ms-whiteboard-cmd","ms-widgetboard","ms-widgets","ms-word","msnim","msrp","msrps","mss","mt","mtqp","mtrust","mumble","mupdate","mvn","mvrp","mvrps","news","nfs","ni","nih","nntp","notes","num","ocf","oid","onenote","onenote-cmd","opaquelocktoken","openid","openpgp4fpr","otpauth","palm","paparazzi","payto","pkcs11","platform","pop","pres","proxy","psyc","pttp","pwid","qb","query","quic-transport","redis","rediss","reload","res","resource","rmi","rsync","rtmfp","rtmp","rtsp","rtsps","rtspu","sarif","secondlife","secret-token","service","session","sftp","sgn","shc","shelter","sieve","simpleledger","simplex","sip","sips","skype","smb","smp","sms","smtp","snmp","soap.beep","soap.beeps","soldat","spacify","spiffe","spotify","ssb","ssh","starknet","steam","stun","stuns","submit","svn","swh","swid","swidpath","tag","taler","teamspeak","teapot","teapots","tel","teliaeid","telnet","tftp","things","thismessage","tip","tn3270","tool","turn","turns","tv","udp","unreal","upn","urn","ut2004","uuid-in-package","v-event","vemmi","ventrilo","ves","view-source","vnc","vscode","vscode-insiders","vsls","w3","wasm","wasm-js","wcr","web3","webcal","wifi","ws","wss","wtai","wyciwyg","xcompute","xcon","xcon-userid","xfire","xftp","xmlrpc.beep","xmlrpc.beeps","xmpp","xrcp","xri","ymsgr","z39.50r","z39.50s","ztdnaid"];var dn=n=>{if(!C(n))throw new TypeError(`Expected String but got ${V(n)}.`);let t=[];for(let s of n)t.push(`%${s.charCodeAt(0).toString(16).toUpperCase()}`);return t.join("")},hn=n=>{C(n)&&mn.test(n)&&(n=n.toUpperCase());let[t,s,r,i,l,m]=["&","#","<",">",'"',"'"].map(dn),p;return n===t?p=`${t}amp;`:n===r?p=`${t}lt;`:n===i?p=`${t}gt;`:n===l?p=`${t}quot;`:n===m?p=`${t}${s}39;`:p=n,p},gn=n=>{if(C(n)){if(!rn.test(n))throw new Error(`Invalid base64 data: ${n}`)}else throw new TypeError(`Expected String but got ${V(n)}.`);let t=atob(n),s=Uint8Array.from([...t].map(l=>l.charCodeAt(0))),r=new Set($e),i;return s.every(l=>r.has(l))?i=t.replace(/\s/g,dn):i=n,i},Tt=(n,t=0)=>{if(!C(n))throw new TypeError(`Expected String but got ${V(n)}.`);if(Number.isInteger(t)){if(t>16)throw new Error("Character references nested too deeply.")}else throw new TypeError(`Expected Number but got ${V(t)}.`);let s=decodeURIComponent(n);if(/&#/.test(s)){let r=new Set($e),i=[...s.matchAll(ln)].reverse();for(let l of i){let[m,p]=l,h;if(/^x[\dA-F]+/i.test(p)?h=parseInt(`0${p}`,16):/^\d+/.test(p)&&(h=parseInt(p)),Number.isInteger(h)){let{index:E}=l,[d,b]=[s.substring(0,E),s.substring(E+m.length)];r.has(h)?(s=`${d}${String.fromCharCode(h)}${b}`,(/#x?$/.test(d)||/^#(?:x(?:00)?[2-7]|\d)/.test(b))&&(s=Tt(s,++t))):h<256&&(s=`${d}${b}`)}}}return s},Tn=(n,t=33554432)=>new Promise((s,r)=>{if(Number.isInteger(n?.size)){if(Number.isInteger(t)&&n.size>t)return r(new DOMException(`Blob size (${n.size} bytes) exceeds the maximum allowed size of ${t} bytes.`,"NotReadableError"))}else return s(null);let i=new un;i.addEventListener("error",()=>r(i.error)),i.addEventListener("abort",()=>s(i.result)),i.addEventListener("load",()=>s(i.result)),i.readAsDataURL(n)}),Be=class{#e;constructor(){this.#e=new Set(He)}get(){return[...this.#e]}has(t){return this.#e.has(t)}add(t){if(C(t)){if(ht.test(t)||!pn.test(t))throw new Error(`Invalid scheme: ${t}`)}else throw new TypeError(`Expected String but got ${V(t)}.`);return this.#e.add(t),[...this.#e]}remove(t){return this.#e.delete(t)}verify(t){let s;if(C(t))try{let{protocol:r}=new URL(t),i=r.replace(/:$/,""),l=i.split("+");s=!ht.test(i)&&fn.test(i)||l.every(m=>this.#e.has(m))}catch{s=!1}return!!s}reset(){this.#e.clear();for(let t of He)this.#e.add(t)}};var _e=(n,t,s)=>{n&&console.warn(`[URLSanitizer Debug] ${t}`,s?s.message:"")},Et=class extends Be{#e;#t=new Set;constructor(){super(),this.#e=0}replace(t){if(!C(t))throw new TypeError(`Expected String but got ${V(t)}.`);let s=t;if(ze.test(s)){let i=[...s.matchAll(an)].reverse();for(let l of i){let[m]=l;dt.test(m)&&([m]=dt.exec(m)),this.#e++,this.#t.add(m);let p=this.sanitize(m,{allow:["data"]}),{index:h}=l,[E,d]=[s.substring(0,h),s.substring(h+m.length)];p?s=`${E}${p}${d}`:s=`${E}${d}`}}return s}purify(t){if(!C(t))throw new TypeError(`Expected String but got ${V(t)}.`);let s=ut.sanitize(decodeURIComponent(t));return s&&ze.test(s)&&(s=this.replace(s)),s=s.replace(/(?:#|%23)$/,"").replace(/(?<!(?:#|%23).*)(?:\?|%3F)$/,""),encodeURI(s)}sanitize(t,s){if(this.#e>16)throw this.#e=0,new Error("Data URLs nested too deeply.");let{allow:r,deny:i,only:l,debug:m=!1}=s??{},p=new Map([["blob",!1],["data",!1],["file",!1],["javascrpt",!1],["vbscript",!1]]),h=new Set,E=!1;if(Array.isArray(l)&&l.length){let b=super.get();for(let _ of b)p.set(_,!1);let T=Object.values(l);for(let _ of T)if(C(_)&&(_=_.trim(),!Ge.test(_))){if(super.has(_))p.set(_,!0);else{try{super.add(_)}catch(M){let z=`Failed to add scheme '${_}' in 'only' list.`;_e(m,z,M)}super.has(_)&&(p.set(_,!0),h.add(_))}!E&&p.has(_)&&(E=p.get(_))}}else{if(Array.isArray(r)&&r.length){let b=Object.values(r);for(let T of b)if(C(T)&&(T=T.trim(),!Ge.test(T)))if(super.has(T))p.set(T,!0);else{try{super.add(T)}catch(_){let M=`Failed to add scheme '${T}' in 'allow' list.`;_e(m,M,_)}super.has(T)&&(p.set(T,!0),h.add(T))}}if(Array.isArray(i)&&i.length){let b=Object.values(i);for(let T of b)C(T)&&(T=T.trim(),T&&p.set(T,!1))}}let d;if(super.verify(t)){let{hash:b,href:T,pathname:_,protocol:M,search:z}=new URL(t),Ae=M.replace(/:$/,""),ye=Ae.split("+"),ie;if(E)ie=ye.every(H=>p.get(H));else for(let[H,B]of p.entries())if(ie=B||Ae!==H&&ye.every(g=>g!==H),!ie)break;if(ie){let H=ye.includes("data"),B,g=T;if(H){let[j,...K]=_.split(","),Q=`${K.join(",")}${z}${b}`,ae=j.split(";"),De=ae[ae.length-1]==="base64",F=Q;De&&(F=gn(Q));try{let w=Tt(F).trim(),{protocol:te}=new URL(w);te.replace(/:$/,"").split("+").some(le=>Ge.test(le))&&(g="")}catch(w){_e(m,"Failed to parse inner data URL protocol.",w)}let Ie=ze.test(F);F!==Q||Ie?Ie?F=this.replace(F):this.#t.has(t)?this.#t.delete(t):B=!0:this.#t.has(t)?this.#t.delete(t):B=!0,(!j||cn.test(j))&&(F=this.purify(F)),g&&F?(De&&F!==Q&&ae.pop(),g=`${Ae}:${ae.join(";")},${F}`):g=""}else B=!0;if(!H&&gt.test(g)){let j=gt.exec(g),{index:K}=j;g=g.substring(0,K).replace(/[?&]$/,"")}g?(d=g.replace(/%26/g,hn),B&&(this.#e=0)):this.#e=0}h.size&&h.forEach(H=>{super.remove(H)})}return d||null}parse(t,s){if(!C(t))throw new TypeError(`Expected String but got ${V(t)}.`);let r=new Map([["input",t]]),i;if(this.verify(t)){let{protocol:l}=new URL(t);l==="blob:"?i=t:i=this.sanitize(t,s??{allow:["data","file"]})}if(i){let l=new URL(i),{pathname:m,protocol:p}=l,E=p.replace(/:$/,"").split("+").includes("data");if(r.set("valid",!0),E){let d=new Map,[b,...T]=m.split(","),_=`${T.join(",")}`,M=b.split(";"),z=M[M.length-1]==="base64";z&&M.pop(),d.set("mime",M.join(";")),d.set("base64",z),d.set("data",_),r.set("data",Object.fromEntries(d))}else r.set("data",null);for(let d in l){let b=l[d];C(b)&&r.set(d,b)}}else r.set("valid",!1);return Object.fromEntries(r)}reset(){super.reset(),this.#e=0,this.#t.clear()}};var ee=new Et,cs=async(n,t={allow:[],deny:[],only:[],debug:!1,maxBlobSize:33554432})=>{let s=!!t?.debug,r=Number.isInteger(t?.maxBlobSize)&&t.maxBlobSize>0?t.maxBlobSize:33554432,i;if(n&&C(n)){let l;try{let{protocol:m}=new URL(n);l=m.replace(/:$/,"")}catch(m){_e(s,`Invalid URL input format: ${n}`,m)}if(l==="blob"){let{allow:m,deny:p,only:h}=t;if(Array.isArray(m)&&m.includes("blob")&&!(Array.isArray(p)&&p.includes("blob"))||Array.isArray(h)&&h.includes("blob")){let E;try{E=await fetch(n).then(d=>d.blob()).then(d=>Tn(d,r))}catch(d){let b=`Failed to fetch and convert blob URL: ${n}`;_e(s,b,d)}if(E){if(Array.isArray(h))h.includes("data")||h.push("data");else if(Array.isArray(m)&&(m.includes("data")||m.push("data"),Array.isArray(p)&&p.includes("data"))){let d=p.indexOf("data");p.splice(d,1)}i=ee.sanitize(E,t)}}URL.revokeObjectURL(n)}else l&&(i=ee.sanitize(n,t))}return i||null},ps=(n,t)=>{let s;if(n&&C(n)){let r;try{let{protocol:i}=new URL(n);r=i.replace(/:$/,"")}catch(i){let l=`Failed to parse URL: ${n}`;_e(t?.debug,l,i)}r==="blob"?URL.revokeObjectURL(n):r&&(s=ee.sanitize(n,t))}return s||null},fs=async n=>ee.parse(n),ms=n=>ee.parse(n),us=async n=>ee.verify(n),ds=n=>ee.verify(n),hs=ee;export{hs as default,us as isURI,ds as isURISync,fs as parseURL,ms as parseURLSync,cs as sanitizeURL,ps as sanitizeURLSync};
1
+ function Yt(n,t){(t==null||t>n.length)&&(t=n.length);for(var o=0,r=Array(t);o<t;o++)r[o]=n[o];return r}function Dn(n){if(Array.isArray(n))return n}function In(n,t){var o=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(o!=null){var r,i,l,f,m=[],u=!0,T=!1;try{if(l=(o=o.call(n)).next,t!==0)for(;!(u=(r=l.call(o)).done)&&(m.push(r.value),m.length!==t);u=!0);}catch(g){T=!0,i=g}finally{try{if(!u&&o.return!=null&&(f=o.return(),Object(f)!==f))return}finally{if(T)throw i}}return m}}function Nn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cn(n,t){return Dn(n)||In(n,t)||Mn(n,t)||Nn()}function Mn(n,t){if(n){if(typeof n=="string")return Yt(n,t);var o={}.toString.call(n).slice(8,-1);return o==="Object"&&n.constructor&&(o=n.constructor.name),o==="Map"||o==="Set"?Array.from(n):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?Yt(n,t):void 0}}var rn=Object.entries,Xt=Object.setPrototypeOf,vn=Object.isFrozen,Un=Object.getPrototypeOf,Pn=Object.getOwnPropertyDescriptor,k=Object.freeze,H=Object.seal,be=Object.create,an=typeof Reflect<"u"&&Reflect,ut=an.apply,dt=an.construct;k||(k=function(t){return t});H||(H=function(t){return t});ut||(ut=function(t,o){for(var r=arguments.length,i=new Array(r>2?r-2:0),l=2;l<r;l++)i[l-2]=arguments[l];return t.apply(o,i)});dt||(dt=function(t){for(var o=arguments.length,r=new Array(o>1?o-1:0),i=1;i<o;i++)r[i-1]=arguments[i];return new t(...r)});var Ee=S(Array.prototype.forEach),kn=S(Array.prototype.lastIndexOf),qt=S(Array.prototype.pop),_e=S(Array.prototype.push),Fn=S(Array.prototype.splice),P=Array.isArray,Ie=S(String.prototype.toLowerCase),lt=S(String.prototype.toString),Vt=S(String.prototype.match),Ae=S(String.prototype.replace),Zt=S(String.prototype.indexOf),zn=S(String.prototype.trim),Gn=S(Number.prototype.toString),$n=S(Boolean.prototype.toString),Kt=typeof BigInt>"u"?null:S(BigInt.prototype.toString),Qt=typeof Symbol>"u"?null:S(Symbol.prototype.toString),A=S(Object.prototype.hasOwnProperty),De=S(Object.prototype.toString),N=S(RegExp.prototype.test),Fe=Hn(TypeError);function S(n){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var o=arguments.length,r=new Array(o>1?o-1:0),i=1;i<o;i++)r[i-1]=arguments[i];return ut(n,t,r)}}function Hn(n){return function(){for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return dt(n,o)}}function p(n,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ie;if(Xt&&Xt(n,null),!P(t))return n;let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){let l=o(i);l!==i&&(vn(t)||(t[r]=l),i=l)}n[i]=!0}return n}function Bn(n){for(let t=0;t<n.length;t++)A(n,t)||(n[t]=null);return n}function G(n){let t=be(null);for(let r of rn(n)){var o=Cn(r,2);let i=o[0],l=o[1];A(n,i)&&(P(l)?t[i]=Bn(l):l&&typeof l=="object"&&l.constructor===Object?t[i]=G(l):t[i]=l)}return t}function jn(n){switch(typeof n){case"string":return n;case"number":return Gn(n);case"boolean":return $n(n);case"bigint":return Kt?Kt(n):"0";case"symbol":return Qt?Qt(n):"Symbol()";case"undefined":return De(n);case"function":case"object":{if(n===null)return De(n);let t=n,o=Re(t,"toString");if(typeof o=="function"){let r=o(t);return typeof r=="string"?r:De(r)}return De(n)}default:return De(n)}}function Re(n,t){for(;n!==null;){let r=Pn(n,t);if(r){if(r.get)return S(r.get);if(typeof r.value=="function")return S(r.value)}n=Un(n)}function o(){return null}return o}function Wn(n){try{return N(n,""),!0}catch{return!1}}var Jt=k(["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","search","section","select","shadow","slot","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"]),ct=k(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),pt=k(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Yn=k(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ft=k(["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","mprescripts"]),Xn=k(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),en=k(["#text"]),tn=k(["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","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),mt=k(["accent-height","accumulate","additive","alignment-baseline","amplitude","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","exponent","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","intercept","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","mask-type","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","slope","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","tablevalues","targetx","targety","transform","transform-origin","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"]),nn=k(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),ze=k(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),qn=H(/{{[\w\W]*|^[\w\W]*}}/g),Vn=H(/<%[\w\W]*|^[\w\W]*%>/g),Zn=H(/\${[\w\W]*/g),Kn=H(/^data-[\-\w.\u00B7-\uFFFF]+$/),Qn=H(/^aria-[\-\w]+$/),sn=H(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Jn=H(/^(?:\w+script|data):/i),es=H(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ts=H(/^html$/i),ns=H(/^[a-z][.\w]*(-[.\w]+)+$/i),ye={element:1,text:3,progressingInstruction:7,comment:8,document:9},ss=function(){return typeof window>"u"?null:window},os=function(t,o){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null,i="data-tt-policy-suffix";o&&o.hasAttribute(i)&&(r=o.getAttribute(i));let l="dompurify"+(r?"#"+r:"");try{return t.createPolicy(l,{createHTML(f){return f},createScriptURL(f){return f}})}catch{return console.warn("TrustedTypes policy "+l+" could not be created."),null}},on=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ln(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ss(),t=c=>ln(c);if(t.version="3.4.3",t.removed=[],!n||!n.document||n.document.nodeType!==ye.document||!n.Element)return t.isSupported=!1,t;let o=n.document,r=o,i=r.currentScript,l=n.DocumentFragment,f=n.HTMLTemplateElement,m=n.Node,u=n.Element,T=n.NodeFilter,g=n.NamedNodeMap,U=g===void 0?n.NamedNodeMap||n.MozNamedAttrMap:g,se=n.HTMLFormElement,Q=n.DOMParser,E=n.trustedTypes,d=u.prototype,_=Re(d,"cloneNode"),J=Re(d,"remove"),pe=Re(d,"nextSibling"),fe=Re(d,"childNodes"),V=Re(d,"parentNode");if(typeof f=="function"){let c=o.createElement("template");c.content&&c.content.ownerDocument&&(o=c.content.ownerDocument)}let y,B="",F=o,M=F.implementation,Z=F.createNodeIterator,Se=F.createDocumentFragment,me=F.getElementsByTagName,ue=r.importNode,x=on();t.isSupported=typeof rn=="function"&&typeof V=="function"&&M&&M.createHTMLDocument!==void 0;let v=qn,oe=Vn,ee=Zn,Ne=Kn,yt=Qn,Ye=Jn,bt=es,yn=ns,Rt=sn,O=null,St=p({},[...Jt,...ct,...pt,...ft,...en]),I=null,wt=p({},[...tn,...mt,...nn,...ze]),b=Object.seal(be(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),we=null,Ce=null,te=Object.seal(be(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),xt=!0,Xe=!0,Ot=!1,Lt=!0,re=!1,xe=!0,ie=!1,qe=!1,Ve=!1,de=!1,Me=!1,ve=!1,Dt=!0,It=!1,Nt="user-content-",Ze=!0,Oe=!1,he={},Y=null,Ke=p({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Ct=null,Mt=p({},["audio","video","img","source","image","track"]),Qe=null,vt=p({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ue="http://www.w3.org/1998/Math/MathML",Pe="http://www.w3.org/2000/svg",X="http://www.w3.org/1999/xhtml",ge=X,Je=!1,et=null,bn=p({},[Ue,Pe,X],lt),tt=p({},["mi","mo","mn","ms","mtext"]),nt=p({},["annotation-xml"]),Rn=p({},["title","style","font","a","script"]),Le=null,Sn=["application/xhtml+xml","text/html"],wn="text/html",w=null,Te=null,xn=o.createElement("form"),Ut=function(e){return e instanceof RegExp||e instanceof Function},st=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Te&&Te===e)return;(!e||typeof e!="object")&&(e={}),e=G(e),Le=Sn.indexOf(e.PARSER_MEDIA_TYPE)===-1?wn:e.PARSER_MEDIA_TYPE,w=Le==="application/xhtml+xml"?lt:Ie,O=A(e,"ALLOWED_TAGS")&&P(e.ALLOWED_TAGS)?p({},e.ALLOWED_TAGS,w):St,I=A(e,"ALLOWED_ATTR")&&P(e.ALLOWED_ATTR)?p({},e.ALLOWED_ATTR,w):wt,et=A(e,"ALLOWED_NAMESPACES")&&P(e.ALLOWED_NAMESPACES)?p({},e.ALLOWED_NAMESPACES,lt):bn,Qe=A(e,"ADD_URI_SAFE_ATTR")&&P(e.ADD_URI_SAFE_ATTR)?p(G(vt),e.ADD_URI_SAFE_ATTR,w):vt,Ct=A(e,"ADD_DATA_URI_TAGS")&&P(e.ADD_DATA_URI_TAGS)?p(G(Mt),e.ADD_DATA_URI_TAGS,w):Mt,Y=A(e,"FORBID_CONTENTS")&&P(e.FORBID_CONTENTS)?p({},e.FORBID_CONTENTS,w):Ke,we=A(e,"FORBID_TAGS")&&P(e.FORBID_TAGS)?p({},e.FORBID_TAGS,w):G({}),Ce=A(e,"FORBID_ATTR")&&P(e.FORBID_ATTR)?p({},e.FORBID_ATTR,w):G({}),he=A(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?G(e.USE_PROFILES):e.USE_PROFILES:!1,xt=e.ALLOW_ARIA_ATTR!==!1,Xe=e.ALLOW_DATA_ATTR!==!1,Ot=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Lt=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,re=e.SAFE_FOR_TEMPLATES||!1,xe=e.SAFE_FOR_XML!==!1,ie=e.WHOLE_DOCUMENT||!1,de=e.RETURN_DOM||!1,Me=e.RETURN_DOM_FRAGMENT||!1,ve=e.RETURN_TRUSTED_TYPE||!1,Ve=e.FORCE_BODY||!1,Dt=e.SANITIZE_DOM!==!1,It=e.SANITIZE_NAMED_PROPS||!1,Ze=e.KEEP_CONTENT!==!1,Oe=e.IN_PLACE||!1,Rt=Wn(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:sn,ge=typeof e.NAMESPACE=="string"?e.NAMESPACE:X,tt=A(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS=="object"?G(e.MATHML_TEXT_INTEGRATION_POINTS):p({},["mi","mo","mn","ms","mtext"]),nt=A(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS=="object"?G(e.HTML_INTEGRATION_POINTS):p({},["annotation-xml"]);let s=A(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING=="object"?G(e.CUSTOM_ELEMENT_HANDLING):be(null);if(b=be(null),A(s,"tagNameCheck")&&Ut(s.tagNameCheck)&&(b.tagNameCheck=s.tagNameCheck),A(s,"attributeNameCheck")&&Ut(s.attributeNameCheck)&&(b.attributeNameCheck=s.attributeNameCheck),A(s,"allowCustomizedBuiltInElements")&&typeof s.allowCustomizedBuiltInElements=="boolean"&&(b.allowCustomizedBuiltInElements=s.allowCustomizedBuiltInElements),re&&(Xe=!1),Me&&(de=!0),he&&(O=p({},en),I=be(null),he.html===!0&&(p(O,Jt),p(I,tn)),he.svg===!0&&(p(O,ct),p(I,mt),p(I,ze)),he.svgFilters===!0&&(p(O,pt),p(I,mt),p(I,ze)),he.mathMl===!0&&(p(O,ft),p(I,nn),p(I,ze))),te.tagCheck=null,te.attributeCheck=null,A(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?te.tagCheck=e.ADD_TAGS:P(e.ADD_TAGS)&&(O===St&&(O=G(O)),p(O,e.ADD_TAGS,w))),A(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?te.attributeCheck=e.ADD_ATTR:P(e.ADD_ATTR)&&(I===wt&&(I=G(I)),p(I,e.ADD_ATTR,w))),A(e,"ADD_URI_SAFE_ATTR")&&P(e.ADD_URI_SAFE_ATTR)&&p(Qe,e.ADD_URI_SAFE_ATTR,w),A(e,"FORBID_CONTENTS")&&P(e.FORBID_CONTENTS)&&(Y===Ke&&(Y=G(Y)),p(Y,e.FORBID_CONTENTS,w)),A(e,"ADD_FORBID_CONTENTS")&&P(e.ADD_FORBID_CONTENTS)&&(Y===Ke&&(Y=G(Y)),p(Y,e.ADD_FORBID_CONTENTS,w)),Ze&&(O["#text"]=!0),ie&&p(O,["html","head","body"]),O.table&&(p(O,["tbody"]),delete we.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw Fe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Fe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');y=e.TRUSTED_TYPES_POLICY,B=y.createHTML("")}else y===void 0&&(y=os(E,i)),y!==null&&typeof B=="string"&&(B=y.createHTML(""));k&&k(e),Te=e},Pt=p({},[...ct,...pt,...Yn]),kt=p({},[...ft,...Xn]),On=function(e){let s=V(e);(!s||!s.tagName)&&(s={namespaceURI:ge,tagName:"template"});let a=Ie(e.tagName),h=Ie(s.tagName);return et[e.namespaceURI]?e.namespaceURI===Pe?s.namespaceURI===X?a==="svg":s.namespaceURI===Ue?a==="svg"&&(h==="annotation-xml"||tt[h]):!!Pt[a]:e.namespaceURI===Ue?s.namespaceURI===X?a==="math":s.namespaceURI===Pe?a==="math"&&nt[h]:!!kt[a]:e.namespaceURI===X?s.namespaceURI===Pe&&!nt[h]||s.namespaceURI===Ue&&!tt[h]?!1:!kt[a]&&(Rn[a]||!Pt[a]):!!(Le==="application/xhtml+xml"&&et[e.namespaceURI]):!1},j=function(e){_e(t.removed,{element:e});try{V(e).removeChild(e)}catch{J(e)}},ae=function(e,s){try{_e(t.removed,{attribute:s.getAttributeNode(e),from:s})}catch{_e(t.removed,{attribute:null,from:s})}if(s.removeAttribute(e),e==="is")if(de||Me)try{j(s)}catch{}else try{s.setAttribute(e,"")}catch{}},Ft=function(e){let s=null,a=null;if(Ve)e="<remove></remove>"+e;else{let R=Vt(e,/^[\r\n\t ]+/);a=R&&R[0]}Le==="application/xhtml+xml"&&ge===X&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let h=y?y.createHTML(e):e;if(ge===X)try{s=new Q().parseFromString(h,Le)}catch{}if(!s||!s.documentElement){s=M.createDocument(ge,"template",null);try{s.documentElement.innerHTML=Je?B:h}catch{}}let L=s.body||s.documentElement;return e&&a&&L.insertBefore(o.createTextNode(a),L.childNodes[0]||null),ge===X?me.call(s,ie?"html":"body")[0]:ie?s.documentElement:L},zt=function(e){return Z.call(e.ownerDocument||e,e,T.SHOW_ELEMENT|T.SHOW_COMMENT|T.SHOW_TEXT|T.SHOW_PROCESSING_INSTRUCTION|T.SHOW_CDATA_SECTION,null)},ot=function(e){return e instanceof se&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof U)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},rt=function(e){return typeof m=="function"&&e instanceof m};function K(c,e,s){Ee(c,a=>{a.call(t,e,s,Te)})}let Gt=function(e){let s=null;if(K(x.beforeSanitizeElements,e,null),ot(e))return j(e),!0;let a=w(e.nodeName);if(K(x.uponSanitizeElement,e,{tagName:a,allowedTags:O}),xe&&e.hasChildNodes()&&!rt(e.firstElementChild)&&N(/<[/\w!]/g,e.innerHTML)&&N(/<[/\w!]/g,e.textContent)||xe&&e.namespaceURI===X&&a==="style"&&rt(e.firstElementChild)||e.nodeType===ye.progressingInstruction||xe&&e.nodeType===ye.comment&&N(/<[/\w]/g,e.data))return j(e),!0;if(we[a]||!(te.tagCheck instanceof Function&&te.tagCheck(a))&&!O[a]){if(!we[a]&&Ht(a)&&(b.tagNameCheck instanceof RegExp&&N(b.tagNameCheck,a)||b.tagNameCheck instanceof Function&&b.tagNameCheck(a)))return!1;if(Ze&&!Y[a]){let h=V(e)||e.parentNode,L=fe(e)||e.childNodes;if(L&&h){let R=L.length;for(let z=R-1;z>=0;--z){let $=_(L[z],!0);h.insertBefore($,pe(e))}}}return j(e),!0}return e instanceof u&&!On(e)||(a==="noscript"||a==="noembed"||a==="noframes")&&N(/<\/no(script|embed|frames)/i,e.innerHTML)?(j(e),!0):(re&&e.nodeType===ye.text&&(s=e.textContent,Ee([v,oe,ee],h=>{s=Ae(s,h," ")}),e.textContent!==s&&(_e(t.removed,{element:e.cloneNode()}),e.textContent=s)),K(x.afterSanitizeElements,e,null),!1)},$t=function(e,s,a){if(Ce[s]||Dt&&(s==="id"||s==="name")&&(a in o||a in xn))return!1;let h=I[s]||te.attributeCheck instanceof Function&&te.attributeCheck(s,e);if(!(Xe&&!Ce[s]&&N(Ne,s))){if(!(xt&&N(yt,s))){if(!h||Ce[s]){if(!(Ht(e)&&(b.tagNameCheck instanceof RegExp&&N(b.tagNameCheck,e)||b.tagNameCheck instanceof Function&&b.tagNameCheck(e))&&(b.attributeNameCheck instanceof RegExp&&N(b.attributeNameCheck,s)||b.attributeNameCheck instanceof Function&&b.attributeNameCheck(s,e))||s==="is"&&b.allowCustomizedBuiltInElements&&(b.tagNameCheck instanceof RegExp&&N(b.tagNameCheck,a)||b.tagNameCheck instanceof Function&&b.tagNameCheck(a))))return!1}else if(!Qe[s]){if(!N(Rt,Ae(a,bt,""))){if(!((s==="src"||s==="xlink:href"||s==="href")&&e!=="script"&&Zt(a,"data:")===0&&Ct[e])){if(!(Ot&&!N(Ye,Ae(a,bt,"")))){if(a)return!1}}}}}}return!0},Ln=p({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ht=function(e){return!Ln[Ie(e)]&&N(yn,e)},Bt=function(e){K(x.beforeSanitizeAttributes,e,null);let s=e.attributes;if(!s||ot(e))return;let a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:I,forceKeepAttr:void 0},h=s.length;for(;h--;){let L=s[h],R=L.name,z=L.namespaceURI,$=L.value,W=w(R),at=$,D=R==="value"?at:zn(at);if(a.attrName=W,a.attrValue=D,a.keepAttr=!0,a.forceKeepAttr=void 0,K(x.uponSanitizeAttribute,e,a),D=a.attrValue,It&&(W==="id"||W==="name")&&Zt(D,Nt)!==0&&(ae(R,e),D=Nt+D),xe&&N(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,D)){ae(R,e);continue}if(W==="attributename"&&Vt(D,"href")){ae(R,e);continue}if(a.forceKeepAttr)continue;if(!a.keepAttr){ae(R,e);continue}if(!Lt&&N(/\/>/i,D)){ae(R,e);continue}re&&Ee([v,oe,ee],Wt=>{D=Ae(D,Wt," ")});let jt=w(e.nodeName);if(!$t(jt,W,D)){ae(R,e);continue}if(y&&typeof E=="object"&&typeof E.getAttributeType=="function"&&!z)switch(E.getAttributeType(jt,W)){case"TrustedHTML":{D=y.createHTML(D);break}case"TrustedScriptURL":{D=y.createScriptURL(D);break}}if(D!==at)try{z?e.setAttributeNS(z,R,D):e.setAttribute(R,D),ot(e)?j(e):qt(t.removed)}catch{ae(R,e)}}K(x.afterSanitizeAttributes,e,null)},it=function(e){let s=null,a=zt(e);for(K(x.beforeSanitizeShadowDOM,e,null);s=a.nextNode();)K(x.uponSanitizeShadowNode,s,null),Gt(s),Bt(s),s.content instanceof l&&it(s.content);K(x.afterSanitizeShadowDOM,e,null)},ke=function(e){if(e.nodeType===ye.element&&e.shadowRoot instanceof l){let h=e.shadowRoot;ke(h),it(h)}let s=e.childNodes;if(!s)return;let a=[];Ee(s,h=>{_e(a,h)});for(let h of a)ke(h)};return t.sanitize=function(c){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=null,a=null,h=null,L=null;if(Je=!c,Je&&(c="<!-->"),typeof c!="string"&&!rt(c)&&(c=jn(c),typeof c!="string"))throw Fe("dirty is not a string, aborting");if(!t.isSupported)return c;if(qe||st(e),t.removed=[],typeof c=="string"&&(Oe=!1),Oe){let $=c.nodeName;if(typeof $=="string"){let W=w($);if(!O[W]||we[W])throw Fe("root node is forbidden and cannot be sanitized in-place")}ke(c)}else if(c instanceof m)s=Ft("<!---->"),a=s.ownerDocument.importNode(c,!0),a.nodeType===ye.element&&a.nodeName==="BODY"||a.nodeName==="HTML"?s=a:s.appendChild(a),ke(a);else{if(!de&&!re&&!ie&&c.indexOf("<")===-1)return y&&ve?y.createHTML(c):c;if(s=Ft(c),!s)return de?null:ve?B:""}s&&Ve&&j(s.firstChild);let R=zt(Oe?c:s);for(;h=R.nextNode();)Gt(h),Bt(h),h.content instanceof l&&it(h.content);if(Oe)return c;if(de){if(re){s.normalize();let $=s.innerHTML;Ee([v,oe,ee],W=>{$=Ae($,W," ")}),s.innerHTML=$}if(Me)for(L=Se.call(s.ownerDocument);s.firstChild;)L.appendChild(s.firstChild);else L=s;return(I.shadowroot||I.shadowrootmode)&&(L=ue.call(r,L,!0)),L}let z=ie?s.outerHTML:s.innerHTML;return ie&&O["!doctype"]&&s.ownerDocument&&s.ownerDocument.doctype&&s.ownerDocument.doctype.name&&N(ts,s.ownerDocument.doctype.name)&&(z="<!DOCTYPE "+s.ownerDocument.doctype.name+`>
3
+ `+z),re&&Ee([v,oe,ee],$=>{z=Ae(z,$," ")}),y&&ve?y.createHTML(z):z},t.setConfig=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};st(c),qe=!0},t.clearConfig=function(){Te=null,qe=!1},t.isValidAttribute=function(c,e,s){Te||st({});let a=w(c),h=w(e);return $t(a,h,s)},t.addHook=function(c,e){typeof e=="function"&&_e(x[c],e)},t.removeHook=function(c,e){if(e!==void 0){let s=kn(x[c],e);return s===-1?void 0:Fn(x[c],s,1)[0]}return qt(x[c])},t.removeHooks=function(c){x[c]=[]},t.removeAllHooks=function(){x=on()},t}var ht=ln();var cn=/^[\w+/=-]+$/;var Ge=/data:[\w#&+./;=-]*,/,gt=/data:[\w#&+./;=^]*base64,[\w+/=-]+/i,pn=/data:[\w#&+./;=-]*,[^\x22]+/g,fn=/&#(x(?:00)?[\dA-F]{2}|0?\d{1,3});?/gi,mn=/^(?:application\/(?:[\w#&.;-]+\+)?x|image\/svg\+x|text\/(?:ht|x))ml;?/;var un=/^[a-z][\da-z+.-]*$/,dn=/^(?:ext|web)\+[a-z]+$/,Tt=/(?:java|vb)script/,$e=/(?:java|vb)script|blob/,Et=/%(?:22|27|3C|3E)|[\x22\x27<>]/,hn=/^%[\dA-F]{2}$/i;var q=n=>Object.prototype.toString.call(n).slice(8,-1),C=n=>typeof n=="string"||n instanceof String;var{FileReader:gn}=globalThis;var He=[7,8,9,10,11,12,13,27,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255];var Be=["aaa","aaas","about","acap","acct","acd","acr","adiumxtra","adt","afp","afs","agtp","aim","amss","android","appdata","apt","ar","ari","ark","at","attachment","aw","barion","beshare","bitcoin","bitcoincash","bl","blob","bluetooth","bolo","brid","browserext","cabal","caip","calculator","callto","cap","cast","casts","chrome","chrome-extension","cid","coap","coaps","com-eventbrite-attendee","content","content-type","crid","cstr","cttps","cvs","dab","dat","data","dav","dhttp","diaspora","dict","did","dilithium3","dis","dlna-playcontainer","dlna-playsingle","dnp","dns","dntp","doi","donau","dpp","drm","dtmi","dtn","dvb","dvx","dweb","ed2k","eid","elsi","embedded","ens","esim","ethereum","example","facetime","feed","feedready","fido","file","finger","first-run-pen-experience","fish","fm","ftp","fuchsia-pkg","geo","gg","git","gitoid","gizmoproject","go","gopher","graph","gtalk","h323","ham","hcap","hcp","hs20","http","https","hxxp","hxxps","hydrazone","hyper","i0","iax","ibi","ibi-","icap","icon","ilstring","im","imap","info","iotdisco","ipfs","ipn","ipns","ipp","ipps","irc","irc6","ircs","iris","iris.beep","iris.lwz","iris.xpc","iris.xpcs","isostore","itms","jabber","jar","jms","keyparc","lastfm","lbry","ldap","ldaps","leaptofrogans","lid","linkid","lorawan","lpa","lvlt","machineProvisioningProgressReporter","magnet","mailto","maps","market","matrix","message","microsoft.windows.camera","microsoft.windows.camera.multipicker","microsoft.windows.camera.picker","mid","mms","mongodb","moz","moz-extension","mqtt","mqtts","ms-access","ms-appinstaller","ms-browser-extension","ms-calculator","ms-drive-to","ms-enrollment","ms-excel","ms-eyecontrolspeech","ms-gamebarservices","ms-gamingoverlay","ms-getoffice","ms-help","ms-infopath","ms-inputapp","ms-launchremotedesktop","ms-lockscreencomponent-config","ms-media-stream-id","ms-meetnow","ms-mixedrealitycapture","ms-mobileplans","ms-newsandinterests","ms-officeapp","ms-people","ms-personacard","ms-powerpoint","ms-project","ms-publisher","ms-recall","ms-remotedesktop","ms-remotedesktop-launch","ms-restoretabcompanion","ms-screenclip","ms-screensketch","ms-search","ms-search-repair","ms-secondary-screen-controller","ms-secondary-screen-setup","ms-settings","ms-settings-airplanemode","ms-settings-bluetooth","ms-settings-camera","ms-settings-cellular","ms-settings-cloudstorage","ms-settings-connectabledevices","ms-settings-displays-topology","ms-settings-emailandaccounts","ms-settings-language","ms-settings-location","ms-settings-lock","ms-settings-nfctransactions","ms-settings-notifications","ms-settings-power","ms-settings-privacy","ms-settings-proximity","ms-settings-screenrotation","ms-settings-wifi","ms-settings-workplace","ms-spd","ms-stickers","ms-sttoverlay","ms-transit-to","ms-useractivityset","ms-uup","ms-virtualtouchpad","ms-visio","ms-walk-to","ms-whiteboard","ms-whiteboard-cmd","ms-widgetboard","ms-widgets","ms-word","msnim","msrp","msrps","mss","mt","mtqp","mtrust","mumble","mupdate","mvn","mvrp","mvrps","news","nfs","ni","nih","nntp","notes","num","ocf","oid","onenote","onenote-cmd","opaquelocktoken","openid","openpgp4fpr","otpauth","palm","paparazzi","payto","pkcs11","platform","pop","pres","proxy","psyc","pttp","pwid","qb","query","quic-transport","redis","rediss","reload","res","resource","rmi","rsync","rtmfp","rtmp","rtsp","rtsps","rtspu","sarif","secondlife","secret-token","service","session","sftp","sgn","shc","shelter","sieve","simpleledger","simplex","sip","sips","skype","smb","smp","sms","smtp","snmp","soap.beep","soap.beeps","soldat","spacify","spiffe","spotify","ssb","ssh","starknet","steam","stun","stuns","submit","svn","swh","swid","swidpath","tag","taler","teamspeak","teapot","teapots","tel","teliaeid","telnet","tftp","things","thismessage","tip","tn3270","tool","turn","turns","tv","udp","unreal","upn","urn","ut2004","uuid-in-package","v-event","vemmi","ventrilo","ves","view-source","vnc","vscode","vscode-insiders","vsls","w3","wasm","wasm-js","wcr","web3","webcal","wifi","ws","wss","wtai","wyciwyg","xcompute","xcon","xcon-userid","xfire","xftp","xmlrpc.beep","xmlrpc.beeps","xmpp","xrcp","xri","ymsgr","z39.50r","z39.50s","ztdnaid"];var Tn=n=>{if(!C(n))throw new TypeError(`Expected String but got ${q(n)}.`);let t=[];for(let o of n)t.push(`%${o.charCodeAt(0).toString(16).toUpperCase()}`);return t.join("")},En=n=>{C(n)&&hn.test(n)&&(n=n.toUpperCase());let[t,o,r,i,l,f]=["&","#","<",">",'"',"'"].map(Tn),m;return n===t?m=`${t}amp;`:n===r?m=`${t}lt;`:n===i?m=`${t}gt;`:n===l?m=`${t}quot;`:n===f?m=`${t}${o}39;`:m=n,m},_n=n=>{if(C(n)){if(!cn.test(n))throw new Error(`Invalid base64 data: ${n}`)}else throw new TypeError(`Expected String but got ${q(n)}.`);let t=atob(n),o=Uint8Array.from([...t].map(l=>l.charCodeAt(0))),r=new Set(He),i;return o.every(l=>r.has(l))?i=t.replace(/\s/g,Tn):i=n,i},_t=(n,t=0)=>{if(!C(n))throw new TypeError(`Expected String but got ${q(n)}.`);if(Number.isInteger(t)){if(t>16)throw new Error("Character references nested too deeply.")}else throw new TypeError(`Expected Number but got ${q(t)}.`);let o=decodeURIComponent(n);if(/&#/.test(o)){let r=new Set(He),i=[...o.matchAll(fn)].reverse();for(let l of i){let[f,m]=l,u;if(/^x[\dA-F]+/i.test(m)?u=parseInt(`0${m}`,16):/^\d+/.test(m)&&(u=parseInt(m)),Number.isInteger(u)){let{index:T}=l,[g,U]=[o.substring(0,T),o.substring(T+f.length)];r.has(u)?(o=`${g}${String.fromCharCode(u)}${U}`,(/#x?$/.test(g)||/^#(?:x(?:00)?[2-7]|\d)/.test(U))&&(o=_t(o,++t))):u<256&&(o=`${g}${U}`)}}}return o},An=(n,t=33554432)=>new Promise((o,r)=>{if(Number.isInteger(n?.size)){if(Number.isInteger(t)&&n.size>t)return r(new DOMException(`Blob size (${n.size} bytes) exceeds the maximum allowed size of ${t} bytes.`,"NotReadableError"))}else return o(null);let i=new gn;i.addEventListener("error",()=>r(i.error)),i.addEventListener("abort",()=>o(i.result)),i.addEventListener("load",()=>o(i.result)),i.readAsDataURL(n)}),je=class{#e;constructor(){this.#e=new Set(Be)}get(){return[...this.#e]}has(t){return this.#e.has(t)}add(t){if(C(t)){if(Tt.test(t)||!un.test(t))throw new Error(`Invalid scheme: ${t}`)}else throw new TypeError(`Expected String but got ${q(t)}.`);return this.#e.add(t),[...this.#e]}remove(t){return this.#e.delete(t)}verify(t){let o;if(C(t))try{let{protocol:r}=new URL(t),i=r.replace(/:$/,""),l=i.split("+");o=!Tt.test(i)&&dn.test(i)||l.every(f=>this.#e.has(f))}catch{o=!1}return!!o}reset(){this.#e.clear();for(let t of Be)this.#e.add(t)}};var ce=(n,t,o)=>{n&&console.warn(`[URLSanitizer Debug] ${t}`,o?o.message:"")},At=class extends je{#e;#t=new Set;constructor(){super(),this.#e=0}replace(t){if(!C(t))throw new TypeError(`Expected String but got ${q(t)}.`);let o=t;if(Ge.test(o)){let i=[...o.matchAll(pn)].reverse();for(let l of i){let[f]=l;gt.test(f)&&([f]=gt.exec(f)),this.#e++,this.#t.add(f);let m=this.sanitize(f,{allow:["data"]}),{index:u}=l,[T,g]=[o.substring(0,u),o.substring(u+f.length)];m?o=`${T}${m}${g}`:o=`${T}${g}`}}return o}purify(t){if(!C(t))throw new TypeError(`Expected String but got ${q(t)}.`);let o=t;try{o=decodeURIComponent(t)}catch{}let r=ht.sanitize(o);r&&Ge.test(r)&&(r=this.replace(r)),r=r.replace(/(?:#|%23)$/,"").replace(/(?<!(?:#|%23).*)(?:\?|%3F)$/,"");try{return encodeURI(r)}catch{return r}}sanitize(t,o){if(this.#e>16)throw this.#e=0,new Error("Data URLs nested too deeply.");let{allow:r,deny:i,only:l,allowRelative:f=!1,debug:m=!1}=o??{},u=new Map([["blob",!1],["data",!1],["file",!1],["javascrpt",!1],["vbscript",!1]]),T=new Set,g=!1;if(Array.isArray(l)&&l.length){let E=super.get();for(let _ of E)u.set(_,!1);let d=Object.values(l);for(let _ of d)if(C(_)&&(_=_.trim(),!$e.test(_))){if(super.has(_))u.set(_,!0);else{try{super.add(_)}catch(J){let pe=`Failed to add scheme '${_}' in 'only' list.`;ce(m,pe,J)}super.has(_)&&(u.set(_,!0),T.add(_))}!g&&u.has(_)&&(g=u.get(_))}}else{if(Array.isArray(r)&&r.length){let E=Object.values(r);for(let d of E)if(C(d)&&(d=d.trim(),!$e.test(d)))if(super.has(d))u.set(d,!0);else{try{super.add(d)}catch(_){let J=`Failed to add scheme '${d}' in 'allow' list.`;ce(m,J,_)}super.has(d)&&(u.set(d,!0),T.add(d))}}if(Array.isArray(i)&&i.length){let E=Object.values(i);for(let d of E)C(d)&&(d=d.trim(),d&&u.set(d,!1))}}let U,se=super.verify(t),Q=!1;if(!se&&f)try{let{hostname:E,protocol:d}=new URL(t,"http://dummy.local");d==="http:"&&E==="dummy.local"&&(se=!0,Q=!0)}catch(E){ce(m,"Failed to parse relative URL.",E)}if(se){let E,d,_,J,pe,fe="",V=[],y=!1;if(Q)y=!0;else if({hash:E,href:d,pathname:_,protocol:J,search:pe}=new URL(t),fe=J.replace(/:$/,""),V=fe.split("+"),g)y=V.every(F=>u.get(F));else for(let[F,M]of u.entries())if(y=M||fe!==F&&V.every(Z=>Z!==F),!y)break;if(y){let B=Q?!1:V.includes("data"),F,M=Q?t:d;if(B){let[Z,...Se]=_.split(","),me=`${Se.join(",")}${pe}${E}`,ue=Z.split(";"),x=ue[ue.length-1]==="base64",v=me;x&&(v=_n(me));try{let ee=_t(v).trim(),{protocol:Ne}=new URL(ee);Ne.replace(/:$/,"").split("+").some(Ye=>$e.test(Ye))&&(M="")}catch(ee){ce(m,"Failed to parse inner data URL protocol.",ee)}let oe=Ge.test(v);v!==me||oe?oe?v=this.replace(v):this.#t.has(t)?this.#t.delete(t):F=!0:this.#t.has(t)?this.#t.delete(t):F=!0,(!Z||mn.test(Z))&&(v=this.purify(v)),M&&v?(x&&v!==me&&ue.pop(),M=`${fe}:${ue.join(";")},${v}`):M=""}else F=!0;if(!B&&Et.test(M)){let Z=Et.exec(M),{index:Se}=Z;M=M.substring(0,Se).replace(/[?&]$/,"")}M?(U=M.replace(/%26/g,En),F&&(this.#e=0)):this.#e=0}T.size&&T.forEach(B=>{super.remove(B)})}return U||null}parse(t,o){if(!C(t))throw new TypeError(`Expected String but got ${q(t)}.`);let r=new Map([["input",t]]),i;if(this.verify(t)){let{protocol:l}=new URL(t);l==="blob:"?i=t:i=this.sanitize(t,o??{allow:["data","file"]})}if(i){let l=new URL(i),{pathname:f,protocol:m}=l,T=m.replace(/:$/,"").split("+").includes("data");if(r.set("valid",!0),T){let g=new Map,[U,...se]=f.split(","),Q=`${se.join(",")}`,E=U.split(";"),d=E[E.length-1]==="base64";d&&E.pop(),g.set("mime",E.join(";")),g.set("base64",d),g.set("data",Q),r.set("data",Object.fromEntries(g))}else r.set("data",null);for(let g in l){let U=l[g];C(U)&&r.set(g,U)}}else r.set("valid",!1);return Object.fromEntries(r)}reset(){super.reset(),this.#e=0,this.#t.clear()}};var ne=new At,cs=async(n,t={allow:[],deny:[],only:[],allowRelative:!1,debug:!1,maxBlobSize:33554432})=>{let o=!!t?.debug,r=Number.isInteger(t?.maxBlobSize)&&t.maxBlobSize>0?t.maxBlobSize:33554432,i;if(n&&C(n)){let l;try{let{protocol:f}=new URL(n);l=f.replace(/:$/,"")}catch(f){ce(o,`Invalid URL input format: ${n}`,f)}if(l==="blob"){let{allow:f,deny:m,only:u}=t;if(Array.isArray(f)&&f.includes("blob")&&!(Array.isArray(m)&&m.includes("blob"))||Array.isArray(u)&&u.includes("blob")){let T;try{T=await fetch(n).then(g=>g.blob()).then(g=>An(g,r))}catch(g){let U=`Failed to fetch and convert blob URL: ${n}`;ce(o,U,g)}if(T){if(Array.isArray(u))u.includes("data")||u.push("data");else if(Array.isArray(f)&&(f.includes("data")||f.push("data"),Array.isArray(m)&&m.includes("data"))){let g=m.indexOf("data");m.splice(g,1)}i=ne.sanitize(T,t)}}URL.revokeObjectURL(n)}else(l||t.allowRelative)&&(i=ne.sanitize(n,t))}return i||null},ps=(n,t)=>{let o;if(n&&C(n)){let r;try{let{protocol:i}=new URL(n);r=i.replace(/:$/,"")}catch(i){let l=`Failed to parse URL: ${n}`;ce(t?.debug,l,i)}r==="blob"?URL.revokeObjectURL(n):(r||t?.allowRelative)&&(o=ne.sanitize(n,t))}return o||null},fs=async n=>ne.parse(n),ms=n=>ne.parse(n),us=async n=>ne.verify(n),ds=n=>ne.verify(n),hs=ne;export{hs as default,us as isURI,ds as isURISync,fs as parseURL,ms as parseURLSync,cs as sanitizeURL,ps as sanitizeURLSync};
4
4
  /*!
5
5
  * URL Sanitizer
6
6
  *