url-sanitizer 2.3.0 → 2.3.1
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
|
|
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};
|
|
1
|
+
function Wt(n,t){(t==null||t>n.length)&&(t=n.length);for(var r=0,s=Array(t);r<t;r++)s[r]=n[r];return s}function Dn(n){if(Array.isArray(n))return n}function In(n,t){var r=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(r!=null){var s,i,l,f,m=[],u=!0,E=!1;try{if(l=(r=r.call(n)).next,t!==0)for(;!(u=(s=l.call(r)).done)&&(m.push(s.value),m.length!==t);u=!0);}catch(g){E=!0,i=g}finally{try{if(!u&&r.return!=null&&(f=r.return(),Object(f)!==f))return}finally{if(E)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 Wt(n,t);var r={}.toString.call(n).slice(8,-1);return r==="Object"&&n.constructor&&(r=n.constructor.name),r==="Map"||r==="Set"?Array.from(n):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Wt(n,t):void 0}}var rn=Object.entries,Yt=Object.setPrototypeOf,vn=Object.isFrozen,Un=Object.getPrototypeOf,Pn=Object.getOwnPropertyDescriptor,P=Object.freeze,G=Object.seal,be=Object.create,sn=typeof Reflect<"u"&&Reflect,mt=sn.apply,ut=sn.construct;P||(P=function(t){return t});G||(G=function(t){return t});mt||(mt=function(t,r){for(var s=arguments.length,i=new Array(s>2?s-2:0),l=2;l<s;l++)i[l-2]=arguments[l];return t.apply(r,i)});ut||(ut=function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];return new t(...s)});var Ee=x(Array.prototype.forEach),kn=x(Array.prototype.lastIndexOf),Xt=x(Array.prototype.pop),_e=x(Array.prototype.push),Fn=x(Array.prototype.splice),U=Array.isArray,De=x(String.prototype.toLowerCase),at=x(String.prototype.toString),qt=x(String.prototype.match),Ae=x(String.prototype.replace),Vt=x(String.prototype.indexOf),zn=x(String.prototype.trim),Gn=x(Number.prototype.toString),$n=x(Boolean.prototype.toString),Zt=typeof BigInt>"u"?null:x(BigInt.prototype.toString),Kt=typeof Symbol>"u"?null:x(Symbol.prototype.toString),y=x(Object.prototype.hasOwnProperty),Le=x(Object.prototype.toString),C=x(RegExp.prototype.test),ke=Hn(TypeError);function x(n){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];return mt(n,t,s)}}function Hn(n){return function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return ut(n,r)}}function p(n,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:De;if(Yt&&Yt(n,null),!U(t))return n;let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){let l=r(i);l!==i&&(vn(t)||(t[s]=l),i=l)}n[i]=!0}return n}function Bn(n){for(let t=0;t<n.length;t++)y(n,t)||(n[t]=null);return n}function F(n){let t=be(null);for(let s of rn(n)){var r=Cn(s,2);let i=r[0],l=r[1];y(n,i)&&(U(l)?t[i]=Bn(l):l&&typeof l=="object"&&l.constructor===Object?t[i]=F(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 Zt?Zt(n):"0";case"symbol":return Kt?Kt(n):"Symbol()";case"undefined":return Le(n);case"function":case"object":{if(n===null)return Le(n);let t=n,r=Re(t,"toString");if(typeof r=="function"){let s=r(t);return typeof s=="string"?s:Le(s)}return Le(n)}default:return Le(n)}}function Re(n,t){for(;n!==null;){let s=Pn(n,t);if(s){if(s.get)return x(s.get);if(typeof s.value=="function")return x(s.value)}n=Un(n)}function r(){return null}return r}function Wn(n){try{return C(n,""),!0}catch{return!1}}var Qt=P(["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"]),lt=P(["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"]),ct=P(["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=P(["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"]),pt=P(["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=P(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Jt=P(["#text"]),en=P(["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"]),ft=P(["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"]),tn=P(["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=P(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),qn=G(/{{[\w\W]*|^[\w\W]*}}/g),Vn=G(/<%[\w\W]*|^[\w\W]*%>/g),Zn=G(/\${[\w\W]*/g),Kn=G(/^data-[\-\w.\u00B7-\uFFFF]+$/),Qn=G(/^aria-[\-\w]+$/),nn=G(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Jn=G(/^(?:\w+script|data):/i),eo=G(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),to=G(/^html$/i),no=G(/^[a-z][.\w]*(-[.\w]+)+$/i),ye={element:1,text:3,progressingInstruction:7,comment:8,document:9},oo=function(){return typeof window>"u"?null:window},ro=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null,i="data-tt-policy-suffix";r&&r.hasAttribute(i)&&(s=r.getAttribute(i));let l="dompurify"+(s?"#"+s:"");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 an(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:oo(),t=c=>an(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 r=n.document,s=r,i=s.currentScript,l=n.DocumentFragment,f=n.HTMLTemplateElement,m=n.Node,u=n.Element,E=n.NodeFilter,g=n.NamedNodeMap,v=g===void 0?n.NamedNodeMap||n.MozNamedAttrMap:g,te=n.HTMLFormElement,Z=n.DOMParser,_=n.trustedTypes,d=u.prototype,A=Re(d,"cloneNode"),K=Re(d,"remove"),pe=Re(d,"nextSibling"),fe=Re(d,"childNodes"),q=Re(d,"parentNode");if(typeof f=="function"){let c=r.createElement("template");c.content&&c.content.ownerDocument&&(r=c.content.ownerDocument)}let b,$="",S=r,H=S.implementation,ne=S.createNodeIterator,me=S.createDocumentFragment,ue=S.getElementsByTagName,Ie=s.importNode,T=on();t.isSupported=typeof rn=="function"&&typeof q=="function"&&H&&H.createHTMLDocument!==void 0;let oe=qn,Q=Vn,re=Zn,At=Kn,We=Qn,An=Jn,yt=eo,yn=no,bt=nn,L=null,Rt=p({},[...Qt,...lt,...ct,...pt,...Jt]),N=null,St=p({},[...en,...ft,...tn,...Fe]),R=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}})),Se=null,Ne=null,J=Object.seal(be(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),wt=!0,Ye=!0,xt=!1,Ot=!0,se=!1,we=!0,ie=!1,Xe=!1,qe=!1,de=!1,Ce=!1,Me=!1,Lt=!0,Dt=!1,It="user-content-",Ve=!0,xe=!1,he={},W=null,Ze=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"]),Nt=null,Ct=p({},["audio","video","img","source","image","track"]),Ke=null,Mt=p({},["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",Y="http://www.w3.org/1999/xhtml",ge=Y,Qe=!1,Je=null,bn=p({},[ve,Ue,Y],at),et=p({},["mi","mo","mn","ms","mtext"]),tt=p({},["annotation-xml"]),Rn=p({},["title","style","font","a","script"]),Oe=null,Sn=["application/xhtml+xml","text/html"],wn="text/html",O=null,Te=null,xn=r.createElement("form"),vt=function(e){return e instanceof RegExp||e instanceof Function},nt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Te&&Te===e)return;(!e||typeof e!="object")&&(e={}),e=F(e),Oe=Sn.indexOf(e.PARSER_MEDIA_TYPE)===-1?wn:e.PARSER_MEDIA_TYPE,O=Oe==="application/xhtml+xml"?at:De,L=y(e,"ALLOWED_TAGS")&&U(e.ALLOWED_TAGS)?p({},e.ALLOWED_TAGS,O):Rt,N=y(e,"ALLOWED_ATTR")&&U(e.ALLOWED_ATTR)?p({},e.ALLOWED_ATTR,O):St,Je=y(e,"ALLOWED_NAMESPACES")&&U(e.ALLOWED_NAMESPACES)?p({},e.ALLOWED_NAMESPACES,at):bn,Ke=y(e,"ADD_URI_SAFE_ATTR")&&U(e.ADD_URI_SAFE_ATTR)?p(F(Mt),e.ADD_URI_SAFE_ATTR,O):Mt,Nt=y(e,"ADD_DATA_URI_TAGS")&&U(e.ADD_DATA_URI_TAGS)?p(F(Ct),e.ADD_DATA_URI_TAGS,O):Ct,W=y(e,"FORBID_CONTENTS")&&U(e.FORBID_CONTENTS)?p({},e.FORBID_CONTENTS,O):Ze,Se=y(e,"FORBID_TAGS")&&U(e.FORBID_TAGS)?p({},e.FORBID_TAGS,O):F({}),Ne=y(e,"FORBID_ATTR")&&U(e.FORBID_ATTR)?p({},e.FORBID_ATTR,O):F({}),he=y(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?F(e.USE_PROFILES):e.USE_PROFILES:!1,wt=e.ALLOW_ARIA_ATTR!==!1,Ye=e.ALLOW_DATA_ATTR!==!1,xt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ot=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,se=e.SAFE_FOR_TEMPLATES||!1,we=e.SAFE_FOR_XML!==!1,ie=e.WHOLE_DOCUMENT||!1,de=e.RETURN_DOM||!1,Ce=e.RETURN_DOM_FRAGMENT||!1,Me=e.RETURN_TRUSTED_TYPE||!1,qe=e.FORCE_BODY||!1,Lt=e.SANITIZE_DOM!==!1,Dt=e.SANITIZE_NAMED_PROPS||!1,Ve=e.KEEP_CONTENT!==!1,xe=e.IN_PLACE||!1,bt=Wn(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:nn,ge=typeof e.NAMESPACE=="string"?e.NAMESPACE:Y,et=y(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS=="object"?F(e.MATHML_TEXT_INTEGRATION_POINTS):p({},["mi","mo","mn","ms","mtext"]),tt=y(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS=="object"?F(e.HTML_INTEGRATION_POINTS):p({},["annotation-xml"]);let o=y(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING=="object"?F(e.CUSTOM_ELEMENT_HANDLING):be(null);if(R=be(null),y(o,"tagNameCheck")&&vt(o.tagNameCheck)&&(R.tagNameCheck=o.tagNameCheck),y(o,"attributeNameCheck")&&vt(o.attributeNameCheck)&&(R.attributeNameCheck=o.attributeNameCheck),y(o,"allowCustomizedBuiltInElements")&&typeof o.allowCustomizedBuiltInElements=="boolean"&&(R.allowCustomizedBuiltInElements=o.allowCustomizedBuiltInElements),se&&(Ye=!1),Ce&&(de=!0),he&&(L=p({},Jt),N=be(null),he.html===!0&&(p(L,Qt),p(N,en)),he.svg===!0&&(p(L,lt),p(N,ft),p(N,Fe)),he.svgFilters===!0&&(p(L,ct),p(N,ft),p(N,Fe)),he.mathMl===!0&&(p(L,pt),p(N,tn),p(N,Fe))),J.tagCheck=null,J.attributeCheck=null,y(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?J.tagCheck=e.ADD_TAGS:U(e.ADD_TAGS)&&(L===Rt&&(L=F(L)),p(L,e.ADD_TAGS,O))),y(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?J.attributeCheck=e.ADD_ATTR:U(e.ADD_ATTR)&&(N===St&&(N=F(N)),p(N,e.ADD_ATTR,O))),y(e,"ADD_URI_SAFE_ATTR")&&U(e.ADD_URI_SAFE_ATTR)&&p(Ke,e.ADD_URI_SAFE_ATTR,O),y(e,"FORBID_CONTENTS")&&U(e.FORBID_CONTENTS)&&(W===Ze&&(W=F(W)),p(W,e.FORBID_CONTENTS,O)),y(e,"ADD_FORBID_CONTENTS")&&U(e.ADD_FORBID_CONTENTS)&&(W===Ze&&(W=F(W)),p(W,e.ADD_FORBID_CONTENTS,O)),Ve&&(L["#text"]=!0),ie&&p(L,["html","head","body"]),L.table&&(p(L,["tbody"]),delete Se.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.');b=e.TRUSTED_TYPES_POLICY,$=b.createHTML("")}else b===void 0&&(b=ro(_,i)),b!==null&&typeof $=="string"&&($=b.createHTML(""));P&&P(e),Te=e},Ut=p({},[...lt,...ct,...Yn]),Pt=p({},[...pt,...Xn]),On=function(e){let o=q(e);(!o||!o.tagName)&&(o={namespaceURI:ge,tagName:"template"});let a=De(e.tagName),h=De(o.tagName);return Je[e.namespaceURI]?e.namespaceURI===Ue?o.namespaceURI===Y?a==="svg":o.namespaceURI===ve?a==="svg"&&(h==="annotation-xml"||et[h]):!!Ut[a]:e.namespaceURI===ve?o.namespaceURI===Y?a==="math":o.namespaceURI===Ue?a==="math"&&tt[h]:!!Pt[a]:e.namespaceURI===Y?o.namespaceURI===Ue&&!tt[h]||o.namespaceURI===ve&&!et[h]?!1:!Pt[a]&&(Rn[a]||!Ut[a]):!!(Oe==="application/xhtml+xml"&&Je[e.namespaceURI]):!1},B=function(e){_e(t.removed,{element:e});try{q(e).removeChild(e)}catch{K(e)}},ae=function(e,o){try{_e(t.removed,{attribute:o.getAttributeNode(e),from:o})}catch{_e(t.removed,{attribute:null,from:o})}if(o.removeAttribute(e),e==="is")if(de||Ce)try{B(o)}catch{}else try{o.setAttribute(e,"")}catch{}},kt=function(e){let o=null,a=null;if(qe)e="<remove></remove>"+e;else{let w=qt(e,/^[\r\n\t ]+/);a=w&&w[0]}Oe==="application/xhtml+xml"&&ge===Y&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let h=b?b.createHTML(e):e;if(ge===Y)try{o=new Z().parseFromString(h,Oe)}catch{}if(!o||!o.documentElement){o=H.createDocument(ge,"template",null);try{o.documentElement.innerHTML=Qe?$:h}catch{}}let D=o.body||o.documentElement;return e&&a&&D.insertBefore(r.createTextNode(a),D.childNodes[0]||null),ge===Y?ue.call(o,ie?"html":"body")[0]:ie?o.documentElement:D},Ft=function(e){return ne.call(e.ownerDocument||e,e,E.SHOW_ELEMENT|E.SHOW_COMMENT|E.SHOW_TEXT|E.SHOW_PROCESSING_INSTRUCTION|E.SHOW_CDATA_SECTION,null)},ot=function(e){return e instanceof te&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof v)||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 V(c,e,o){Ee(c,a=>{a.call(t,e,o,Te)})}let zt=function(e){let o=null;if(V(T.beforeSanitizeElements,e,null),ot(e))return B(e),!0;let a=O(e.nodeName);if(V(T.uponSanitizeElement,e,{tagName:a,allowedTags:L}),we&&e.hasChildNodes()&&!rt(e.firstElementChild)&&C(/<[/\w!]/g,e.innerHTML)&&C(/<[/\w!]/g,e.textContent)||we&&e.namespaceURI===Y&&a==="style"&&rt(e.firstElementChild)||e.nodeType===ye.progressingInstruction||we&&e.nodeType===ye.comment&&C(/<[/\w]/g,e.data))return B(e),!0;if(Se[a]||!(J.tagCheck instanceof Function&&J.tagCheck(a))&&!L[a]){if(!Se[a]&&$t(a)&&(R.tagNameCheck instanceof RegExp&&C(R.tagNameCheck,a)||R.tagNameCheck instanceof Function&&R.tagNameCheck(a)))return!1;if(Ve&&!W[a]){let h=q(e)||e.parentNode,D=fe(e)||e.childNodes;if(D&&h){let w=D.length;for(let k=w-1;k>=0;--k){let z=A(D[k],!0);h.insertBefore(z,pe(e))}}}return B(e),!0}return e instanceof u&&!On(e)||(a==="noscript"||a==="noembed"||a==="noframes")&&C(/<\/no(script|embed|frames)/i,e.innerHTML)?(B(e),!0):(se&&e.nodeType===ye.text&&(o=e.textContent,Ee([oe,Q,re],h=>{o=Ae(o,h," ")}),e.textContent!==o&&(_e(t.removed,{element:e.cloneNode()}),e.textContent=o)),V(T.afterSanitizeElements,e,null),!1)},Gt=function(e,o,a){if(Ne[o]||Lt&&(o==="id"||o==="name")&&(a in r||a in xn))return!1;let h=N[o]||J.attributeCheck instanceof Function&&J.attributeCheck(o,e);if(!(Ye&&!Ne[o]&&C(At,o))){if(!(wt&&C(We,o))){if(!h||Ne[o]){if(!($t(e)&&(R.tagNameCheck instanceof RegExp&&C(R.tagNameCheck,e)||R.tagNameCheck instanceof Function&&R.tagNameCheck(e))&&(R.attributeNameCheck instanceof RegExp&&C(R.attributeNameCheck,o)||R.attributeNameCheck instanceof Function&&R.attributeNameCheck(o,e))||o==="is"&&R.allowCustomizedBuiltInElements&&(R.tagNameCheck instanceof RegExp&&C(R.tagNameCheck,a)||R.tagNameCheck instanceof Function&&R.tagNameCheck(a))))return!1}else if(!Ke[o]){if(!C(bt,Ae(a,yt,""))){if(!((o==="src"||o==="xlink:href"||o==="href")&&e!=="script"&&Vt(a,"data:")===0&&Nt[e])){if(!(xt&&!C(An,Ae(a,yt,"")))){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"]),$t=function(e){return!Ln[De(e)]&&C(yn,e)},Ht=function(e){V(T.beforeSanitizeAttributes,e,null);let o=e.attributes;if(!o||ot(e))return;let a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:N,forceKeepAttr:void 0},h=o.length;for(;h--;){let D=o[h],w=D.name,k=D.namespaceURI,z=D.value,j=O(w),it=z,I=w==="value"?it:zn(it);if(a.attrName=j,a.attrValue=I,a.keepAttr=!0,a.forceKeepAttr=void 0,V(T.uponSanitizeAttribute,e,a),I=a.attrValue,Dt&&(j==="id"||j==="name")&&Vt(I,It)!==0&&(ae(w,e),I=It+I),we&&C(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,I)){ae(w,e);continue}if(j==="attributename"&&qt(I,"href")){ae(w,e);continue}if(a.forceKeepAttr)continue;if(!a.keepAttr){ae(w,e);continue}if(!Ot&&C(/\/>/i,I)){ae(w,e);continue}se&&Ee([oe,Q,re],jt=>{I=Ae(I,jt," ")});let Bt=O(e.nodeName);if(!Gt(Bt,j,I)){ae(w,e);continue}if(b&&typeof _=="object"&&typeof _.getAttributeType=="function"&&!k)switch(_.getAttributeType(Bt,j)){case"TrustedHTML":{I=b.createHTML(I);break}case"TrustedScriptURL":{I=b.createScriptURL(I);break}}if(I!==it)try{k?e.setAttributeNS(k,w,I):e.setAttribute(w,I),ot(e)?B(e):Xt(t.removed)}catch{ae(w,e)}}V(T.afterSanitizeAttributes,e,null)},st=function(e){let o=null,a=Ft(e);for(V(T.beforeSanitizeShadowDOM,e,null);o=a.nextNode();)V(T.uponSanitizeShadowNode,o,null),zt(o),Ht(o),o.content instanceof l&&st(o.content);V(T.afterSanitizeShadowDOM,e,null)},Pe=function(e){if(e.nodeType===ye.element&&e.shadowRoot instanceof l){let h=e.shadowRoot;Pe(h),st(h)}let o=e.childNodes;if(!o)return;let a=[];Ee(o,h=>{_e(a,h)});for(let h of a)Pe(h)};return t.sanitize=function(c){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=null,a=null,h=null,D=null;if(Qe=!c,Qe&&(c="<!-->"),typeof c!="string"&&!rt(c)&&(c=jn(c),typeof c!="string"))throw ke("dirty is not a string, aborting");if(!t.isSupported)return c;if(Xe||nt(e),t.removed=[],typeof c=="string"&&(xe=!1),xe){let z=c.nodeName;if(typeof z=="string"){let j=O(z);if(!L[j]||Se[j])throw ke("root node is forbidden and cannot be sanitized in-place")}Pe(c)}else if(c instanceof m)o=kt("<!---->"),a=o.ownerDocument.importNode(c,!0),a.nodeType===ye.element&&a.nodeName==="BODY"||a.nodeName==="HTML"?o=a:o.appendChild(a),Pe(a);else{if(!de&&!se&&!ie&&c.indexOf("<")===-1)return b&&Me?b.createHTML(c):c;if(o=kt(c),!o)return de?null:Me?$:""}o&&qe&&B(o.firstChild);let w=Ft(xe?c:o);for(;h=w.nextNode();)zt(h),Ht(h),h.content instanceof l&&st(h.content);if(xe)return c;if(de){if(se){o.normalize();let z=o.innerHTML;Ee([oe,Q,re],j=>{z=Ae(z,j," ")}),o.innerHTML=z}if(Ce)for(D=me.call(o.ownerDocument);o.firstChild;)D.appendChild(o.firstChild);else D=o;return(N.shadowroot||N.shadowrootmode)&&(D=Ie.call(s,D,!0)),D}let k=ie?o.outerHTML:o.innerHTML;return ie&&L["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&C(to,o.ownerDocument.doctype.name)&&(k="<!DOCTYPE "+o.ownerDocument.doctype.name+`>
|
|
3
|
+
`+k),se&&Ee([oe,Q,re],z=>{k=Ae(k,z," ")}),b&&Me?b.createHTML(k):k},t.setConfig=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};nt(c),Xe=!0},t.clearConfig=function(){Te=null,Xe=!1},t.isValidAttribute=function(c,e,o){Te||nt({});let a=O(c),h=O(e);return Gt(a,h,o)},t.addHook=function(c,e){typeof e=="function"&&_e(T[c],e)},t.removeHook=function(c,e){if(e!==void 0){let o=kn(T[c],e);return o===-1?void 0:Fn(T[c],o,1)[0]}return Xt(T[c])},t.removeHooks=function(c){T[c]=[]},t.removeAllHooks=function(){T=on()},t}var dt=an();var ln=/^[\w+/=-]+$/;var ze=/data:[\w#&+./;=-]*,/,ht=/data:[\w#&+./;=^]*base64,[\w+/=-]+/i,cn=/data:[\w#&+./;=-]*,[^\x22]+/g,pn=/&#(x(?:00)?[\dA-F]{2}|0?\d{1,3});?/gi,fn=/^(?:application\/(?:[\w#&.;-]+\+)?x|image\/svg\+x|text\/(?:ht|x))ml;?/;var mn=/^[a-z][\da-z+.-]*$/,un=/^(?:ext|web)\+[a-z]+$/,gt=/(?:java|vb)script/,Ge=/(?:java|vb)script|blob/,Tt=/%(?:22|27|3C|3E)|[\x22\x27<>]/,dn=/^%[\dA-F]{2}$/i;var X=n=>Object.prototype.toString.call(n).slice(8,-1),M=n=>typeof n=="string"||n instanceof String;var{FileReader:hn}=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 gn=n=>{if(!M(n))throw new TypeError(`Expected String but got ${X(n)}.`);let t=[];for(let r of n)t.push(`%${r.charCodeAt(0).toString(16).toUpperCase()}`);return t.join("")},Tn=n=>{M(n)&&dn.test(n)&&(n=n.toUpperCase());let[t,r,s,i,l,f]=["&","#","<",">",'"',"'"].map(gn),m;return n===t?m=`${t}amp;`:n===s?m=`${t}lt;`:n===i?m=`${t}gt;`:n===l?m=`${t}quot;`:n===f?m=`${t}${r}39;`:m=n,m},En=n=>{if(M(n)){if(!ln.test(n))throw new Error(`Invalid base64 data: ${n}`)}else throw new TypeError(`Expected String but got ${X(n)}.`);let t=atob(n),r=Uint8Array.from([...t].map(l=>l.charCodeAt(0))),s=new Set($e),i;return r.every(l=>s.has(l))?i=t.replace(/\s/g,gn):i=n,i},Et=(n,t=0)=>{if(!M(n))throw new TypeError(`Expected String but got ${X(n)}.`);if(Number.isInteger(t)){if(t>16)throw new Error("Character references nested too deeply.")}else throw new TypeError(`Expected Number but got ${X(t)}.`);let r=decodeURIComponent(n);if(/&#/.test(r)){let s=new Set($e),i=[...r.matchAll(pn)].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:E}=l,[g,v]=[r.substring(0,E),r.substring(E+f.length)];s.has(u)?(r=`${g}${String.fromCharCode(u)}${v}`,(/#x?$/.test(g)||/^#(?:x(?:00)?[2-7]|\d)/.test(v))&&(r=Et(r,++t))):u<256&&(r=`${g}${v}`)}}}return r},_n=(n,t=33554432)=>new Promise((r,s)=>{if(Number.isInteger(n?.size)){if(Number.isInteger(t)&&n.size>t)return s(new DOMException(`Blob size (${n.size} bytes) exceeds the maximum allowed size of ${t} bytes.`,"NotReadableError"))}else return r(null);let i=new hn;i.addEventListener("error",()=>s(i.error)),i.addEventListener("abort",()=>r(i.result)),i.addEventListener("load",()=>r(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(M(t)){if(gt.test(t)||!mn.test(t))throw new Error(`Invalid scheme: ${t}`)}else throw new TypeError(`Expected String but got ${X(t)}.`);return this.#e.add(t),[...this.#e]}remove(t){return this.#e.delete(t)}verify(t){let r;if(M(t))try{let{protocol:s}=new URL(t),i=s.replace(/:$/,""),l=i.split("+");r=!gt.test(i)&&un.test(i)||l.every(f=>this.#e.has(f))}catch{r=!1}return!!r}reset(){this.#e.clear();for(let t of He)this.#e.add(t)}};var ce=(n,t,r)=>{n&&console.warn(`[URLSanitizer Debug] ${t}`,r?r.message:"")},_t=class extends Be{#e;#t=new Set;constructor(){super(),this.#e=0}replace(t){if(!M(t))throw new TypeError(`Expected String but got ${X(t)}.`);let r=t;if(ze.test(r)){let i=[...r.matchAll(cn)].reverse();for(let l of i){let[f]=l;ht.test(f)&&([f]=ht.exec(f)),this.#e++,this.#t.add(f);let m;try{m=this.sanitize(f,{allow:["data"]})}finally{this.#e--,this.#t.delete(f)}let{index:u}=l,[E,g]=[r.substring(0,u),r.substring(u+f.length)];m?r=`${E}${m}${g}`:r=`${E}${g}`}}return r}purify(t){if(!M(t))throw new TypeError(`Expected String but got ${X(t)}.`);let r=t;try{r=decodeURIComponent(t)}catch{}let s=dt.sanitize(r);s&&ze.test(s)&&(s=this.replace(s)),s=s.replace(/(?:#|%23)$/,"").replace(/(?<!(?:#|%23).*)(?:\?|%3F)$/,"");try{return encodeURI(s)}catch{return s}}sanitize(t,r){if(this.#e>16)throw new Error("Data URLs nested too deeply.");let{allow:s,deny:i,only:l,allowRelative:f=!1,debug:m=!1}=r??{},u=new Map([["blob",!1],["data",!1],["file",!1],["javascript",!1],["vbscript",!1]]),E=new Set,g=!1;if(Array.isArray(l)&&l.length){let _=super.get();for(let A of _)u.set(A,!1);let d=Object.values(l);for(let A of d)if(M(A)&&(A=A.trim(),!Ge.test(A))){if(super.has(A))u.set(A,!0);else{try{super.add(A)}catch(K){let pe=`Failed to add scheme '${A}' in 'only' list.`;ce(m,pe,K)}super.has(A)&&(u.set(A,!0),E.add(A))}!g&&u.has(A)&&(g=u.get(A))}}else{if(Array.isArray(s)&&s.length){let _=Object.values(s);for(let d of _)if(M(d)&&(d=d.trim(),!Ge.test(d)))if(super.has(d))u.set(d,!0);else{try{super.add(d)}catch(A){let K=`Failed to add scheme '${d}' in 'allow' list.`;ce(m,K,A)}super.has(d)&&(u.set(d,!0),E.add(d))}}if(Array.isArray(i)&&i.length){let _=Object.values(i);for(let d of _)M(d)&&(d=d.trim(),d&&u.set(d,!1))}}let v,te=super.verify(t),Z=!1;if(!te&&f)try{let{hostname:_,protocol:d}=new URL(t,"http://dummy.local");d==="http:"&&_==="dummy.local"&&(te=!0,Z=!0)}catch(_){ce(m,"Failed to parse relative URL.",_)}if(te){let _,d,A,K,pe,fe="",q=[],b=!1;if(Z)b=!0;else if({hash:_,href:d,pathname:A,protocol:K,search:pe}=new URL(t),fe=K.replace(/:$/,""),q=fe.split("+"),g)b=q.every(S=>u.get(S));else for(let[S,H]of u.entries())if(b=H||fe!==S&&q.every(ne=>ne!==S),!b)break;if(b){let $=Z?!1:q.includes("data"),S=Z?t:d;if($){let[H,...ne]=A.split(","),me=`${ne.join(",")}${pe}${_}`,ue=H.split(";"),Ie=ue[ue.length-1]==="base64",T=me;Ie&&(T=En(me));try{let Q=Et(T).trim(),{protocol:re}=new URL(Q);re.replace(/:$/,"").split("+").some(We=>Ge.test(We))&&(S="")}catch(Q){ce(m,"Failed to parse inner data URL protocol.",Q)}let oe=ze.test(T);(T!==me||oe)&&oe&&(T=this.replace(T)),(!H||fn.test(H))&&(T=this.purify(T)),S&&T?(Ie&&T!==me&&ue.pop(),S=`${fe}:${ue.join(";")},${T}`):S=""}if(!$&&Tt.test(S)){let H=Tt.exec(S),{index:ne}=H;S=S.substring(0,ne).replace(/[?&]$/,"")}S&&(v=S.replace(/%26/g,Tn))}E.size&&E.forEach($=>{super.remove($)})}return v||null}parse(t,r){if(!M(t))throw new TypeError(`Expected String but got ${X(t)}.`);let s=new Map([["input",t]]),i;if(this.verify(t)){let{protocol:l}=new URL(t);l==="blob:"?i=t:i=this.sanitize(t,r??{allow:["data","file"]})}if(i){let l=new URL(i),{pathname:f,protocol:m}=l,E=m.replace(/:$/,"").split("+").includes("data");if(s.set("valid",!0),E){let g=new Map,[v,...te]=f.split(","),Z=`${te.join(",")}`,_=v.split(";"),d=_[_.length-1]==="base64";d&&_.pop(),g.set("mime",_.join(";")),g.set("base64",d),g.set("data",Z),s.set("data",Object.fromEntries(g))}else s.set("data",null);for(let g in l){let v=l[g];M(v)&&s.set(g,v)}}else s.set("valid",!1);return Object.fromEntries(s)}reset(){super.reset(),this.#e=0,this.#t.clear()}};var ee=new _t,co=async(n,t={allow:[],deny:[],only:[],allowRelative:!1,debug:!1,maxBlobSize:33554432})=>{let r=!!t?.debug,s=Number.isInteger(t?.maxBlobSize)&&t.maxBlobSize>0?t.maxBlobSize:33554432,i;if(n&&M(n)){let l;try{let{protocol:f}=new URL(n);l=f.replace(/:$/,"")}catch(f){ce(r,`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 E;try{E=await fetch(n).then(g=>g.blob()).then(g=>_n(g,s))}catch(g){let v=`Failed to fetch and convert blob URL: ${n}`;ce(r,v,g)}if(E){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=ee.sanitize(E,t)}}URL.revokeObjectURL(n)}else(l||t.allowRelative)&&(i=ee.sanitize(n,t))}return i||null},po=(n,t)=>{let r;if(n&&M(n)){let s;try{let{protocol:i}=new URL(n);s=i.replace(/:$/,"")}catch(i){let l=`Failed to parse URL: ${n}`;ce(t?.debug,l,i)}s==="blob"?URL.revokeObjectURL(n):(s||t?.allowRelative)&&(r=ee.sanitize(n,t))}return r||null},fo=async n=>ee.parse(n),mo=n=>ee.parse(n),uo=async n=>ee.verify(n),ho=n=>ee.verify(n),go=ee;export{go as default,uo as isURI,ho as isURISync,fo as parseURL,mo as parseURLSync,co as sanitizeURL,po as sanitizeURLSync};
|
|
4
4
|
/*!
|
|
5
5
|
* URL Sanitizer
|
|
6
6
|
*
|