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