url-sanitizer 5.2.0 → 5.2.2
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 +10 -12
- package/dist/url-sanitizer-wo-dompurify.min.js +1 -1
- package/dist/url-sanitizer-wo-dompurify.min.js.map +3 -3
- package/dist/url-sanitizer.min.js +3 -3
- package/dist/url-sanitizer.min.js.map +3 -3
- package/package.json +8 -8
- package/src/index.js +43 -18
- package/src/mjs/constant.js +16 -0
- package/src/mjs/dompurify.js +2 -2
- package/src/mjs/filter.js +48 -43
- package/src/mjs/sanitize.js +59 -94
- package/src/mjs/scheme.js +2 -2
- package/src/mjs/text-chars.js +1 -1
- package/types/index.d.ts +29 -14
- package/types/mjs/constant.d.ts +1 -0
- package/types/mjs/filter.d.ts +11 -7
- package/types/mjs/sanitize.d.ts +7 -41
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Br(r,t){return Fr(r)||Gr(r,t)||$r(r,t)||Hr()}function $r(r,t){if(r){if(typeof r=="string")return En(r,t);var n={}.toString.call(r).slice(8,-1);return n==="Object"&&r.constructor&&(n=r.constructor.name),n==="Map"||n==="Set"?Array.from(r):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?En(r,t):void 0}}var Dn=Object.entries,Tn=Object.setPrototypeOf,jr=Object.isFrozen,Wr=Object.getPrototypeOf,Yr=Object.getOwnPropertyDescriptor,x=Object.freeze,L=Object.seal,ge=Object.create,Un=typeof Reflect<"u"&&Reflect,Ct=Un.apply,It=Un.construct;x||(x=function(t){return t});L||(L=function(t){return t});Ct||(Ct=function(t,n){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(n,i)});It||(It=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});var te=w(Array.prototype.forEach),Xr=w(Array.prototype.lastIndexOf),_n=w(Array.prototype.pop),we=w(Array.prototype.push),Vr=w(Array.prototype.splice),Ee=Array.isArray,Oe=w(String.prototype.toLowerCase),St=w(String.prototype.toString),yn=w(String.prototype.match),xe=w(String.prototype.replace),bn=w(String.prototype.indexOf),qr=w(String.prototype.trim),Kr=w(Number.prototype.toString),Zr=w(Boolean.prototype.toString),Rn=typeof BigInt>"u"?null:w(BigInt.prototype.toString),An=typeof Symbol>"u"?null:w(Symbol.prototype.toString),v=w(Object.prototype.hasOwnProperty),Le=w(Object.prototype.toString),O=w(RegExp.prototype.test),ee=Qr(TypeError);function w(r){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return Ct(r,t,s)}}function Qr(r){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return It(r,n)}}function g(r,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Oe;if(Tn&&Tn(r,null),!Ee(t))return r;let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){let l=n(i);l!==i&&(jr(t)||(t[s]=l),i=l)}r[i]=!0}return r}function Jr(r){for(let t=0;t<r.length;t++)v(r,t)||(r[t]=null);return r}function k(r){let t=ge(null);for(let s of Dn(r)){var n=Br(s,2);let i=n[0],l=n[1];v(r,i)&&(Ee(l)?t[i]=Jr(l):l&&typeof l=="object"&&l.constructor===Object?t[i]=k(l):t[i]=l)}return t}function eo(r){switch(typeof r){case"string":return r;case"number":return Kr(r);case"boolean":return Zr(r);case"bigint":return Rn?Rn(r):"0";case"symbol":return An?An(r):"Symbol()";case"undefined":return Le(r);case"function":case"object":{if(r===null)return Le(r);let t=r,n=F(t,"toString");if(typeof n=="function"){let s=n(t);return typeof s=="string"?s:Le(s)}return Le(r)}default:return Le(r)}}function F(r,t){for(;r!==null;){let s=Yr(r,t);if(s){if(s.get)return w(s.get);if(typeof s.value=="function")return w(s.value)}r=Wr(r)}function n(){return null}return n}function to(r){try{return O(r,""),!0}catch{return!1}}var Sn=x(["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"]),wt=x(["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"]),xt=x(["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"]),no=x(["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=x(["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"]),ro=x(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),wn=x(["#text"]),xn=x(["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"]),Ot=x(["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","dominant-baseline","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","pointer-events","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-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","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"]),Ln=x(["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"]),Ye=x(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),oo=L(/{{[\w\W]*|^[\w\W]*}}/g),so=L(/<%[\w\W]*|^[\w\W]*%>/g),io=L(/\${[\w\W]*/g),ao=L(/^data-[\-\w.\u00B7-\uFFFF]+$/),co=L(/^aria-[\-\w]+$/),On=L(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),lo=L(/^(?:\w+script|data):/i),uo=L(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),fo=L(/^html$/i),po=L(/^[a-z][.\w]*(-[.\w]+)+$/i),Nn=L(/<[/\w!]/g),Cn=L(/<[/\w]/g),mo=L(/<\/no(script|embed|frames)/i),ho=L(/\/>/i),P={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Mn=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],go=x(g({},Mn)),Eo=(function(){let r={};return te(Mn,t=>{r[t]=L(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),x(r)})(),To=function(){return typeof window>"u"?null:window},_o=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null,i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.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}},In=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},V=function(t,n,s,i){return v(t,n)&&Ee(t[n])?g(i.base?k(i.base):{},t[n],i.transform):s},Nt=function(t,n,s){let i=v(t,n)?t[n]:void 0;return i&&typeof i=="object"?k(i):s()};function vn(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:To(),t=c=>vn(c);if(t.version="3.4.14",t.removed=[],!r||!r.document||r.document.nodeType!==P.document||!r.Element)return t.isSupported=!1,t;let n=r.document,s=n,i=s.currentScript;r.DocumentFragment;let l=r.HTMLTemplateElement,f=r.Node,m=r.Element,d=r.NodeFilter,E=r.NamedNodeMap;E===void 0&&(r.NamedNodeMap||r.MozNamedAttrMap),r.HTMLFormElement;let G=r.DOMParser,j=r.trustedTypes,I=m.prototype,ar=F(I,"cloneNode"),rt=F(I,"remove"),cr=F(I,"nextSibling"),oe=F(I,"childNodes"),se=F(I,"parentNode"),kt=F(I,"shadowRoot"),ot=F(I,"attributes"),q=f&&f.prototype?F(f.prototype,"nodeType"):null,ie=f&&f.prototype?F(f.prototype,"nodeName"):null,De=f&&f.prototype?F(f.prototype,"ownerDocument"):null,ye=function(e){return q?q(e):e.nodeType},st=function(e){return ie?ie(e):e.nodeName};if(typeof l=="function"){let c=n.createElement("template");c.content&&c.content.ownerDocument&&(n=c.content.ownerDocument)}let D,K="",it,zt=!1,be=0,Ft=function(){if(be>0)throw ee('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},ae=function(e){Ft(),be++;try{return D.createHTML(e)}finally{be--}},lr=function(e){Ft(),be++;try{return D.createScriptURL(e)}finally{be--}},ur=function(){return zt||(it=_o(j,i),zt=!0),it},Ue=n,at=Ue.implementation,Gt=Ue.createNodeIterator,fr=Ue.createDocumentFragment,pr=Ue.getElementsByTagName,mr=s.importNode,y=In();t.isSupported=typeof Dn=="function"&&typeof se=="function"&&at&&at.createHTMLDocument!==void 0;let dr=oo,hr=so,gr=io,Er=ao,Tr=co,_r=lo,Ht=uo,yr=po,Bt=On,b=null,ct=g({},[...Sn,...wt,...xt,...Lt,...wn]),R=null,lt=g({},[...xn,...Ot,...Ln,...Ye]),H=Object.seal(ge(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,$t=null,W=Object.seal(ge(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),jt=!0,ut=!0,Wt=!1,Yt=!0,Y=!1,Z=!0,Q=!1,ft=!1,Me=null,ve=null,pt=!1,ce=!1,Pe=!1,ke=!1,Xt=!0,Vt=!1,qt="user-content-",mt=!0,dt=!1,le={},ue=null,Kt=g({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),Zt=null,Qt=g({},["audio","video","img","source","image","track"]),Jt=null,en=g({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ze="http://www.w3.org/1998/Math/MathML",Fe="http://www.w3.org/2000/svg",B="http://www.w3.org/1999/xhtml",fe=B,ht=!1,gt=null,br=g({},[ze,Fe,B],St),tn=x(["mi","mo","mn","ms","mtext"]),Et=g({},tn),nn=x(["annotation-xml"]),Tt=g({},nn),Rr=g({},["title","style","font","a","script"]),Ae=null,Ar=["application/xhtml+xml","text/html"],Sr="text/html",S=null,pe=null,wr=n.createElement("form"),rn=function(e){return e instanceof RegExp||e instanceof Function},_t=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(pe&&pe===e)return;(!e||typeof e!="object")&&(e={}),e=k(e),Ae=Ar.indexOf(e.PARSER_MEDIA_TYPE)===-1?Sr:e.PARSER_MEDIA_TYPE,S=Ae==="application/xhtml+xml"?St:Oe,b=V(e,"ALLOWED_TAGS",ct,{transform:S}),R=V(e,"ALLOWED_ATTR",lt,{transform:S}),gt=V(e,"ALLOWED_NAMESPACES",br,{transform:St}),Jt=V(e,"ADD_URI_SAFE_ATTR",en,{transform:S,base:en}),Zt=V(e,"ADD_DATA_URI_TAGS",Qt,{transform:S,base:Qt}),ue=V(e,"FORBID_CONTENTS",Kt,{transform:S}),Re=V(e,"FORBID_TAGS",k({}),{transform:S}),$t=V(e,"FORBID_ATTR",k({}),{transform:S}),le=v(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?k(e.USE_PROFILES):e.USE_PROFILES:!1,jt=e.ALLOW_ARIA_ATTR!==!1,ut=e.ALLOW_DATA_ATTR!==!1,Wt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Yt=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Y=e.SAFE_FOR_TEMPLATES||!1,Z=e.SAFE_FOR_XML!==!1,Q=e.WHOLE_DOCUMENT||!1,ce=e.RETURN_DOM||!1,Pe=e.RETURN_DOM_FRAGMENT||!1,ke=e.RETURN_TRUSTED_TYPE||!1,pt=e.FORCE_BODY||!1,Xt=e.SANITIZE_DOM!==!1,Vt=e.SANITIZE_NAMED_PROPS||!1,mt=e.KEEP_CONTENT!==!1,dt=e.IN_PLACE||!1,Bt=to(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:On,fe=typeof e.NAMESPACE=="string"?e.NAMESPACE:B,Et=Nt(e,"MATHML_TEXT_INTEGRATION_POINTS",()=>g({},tn)),Tt=Nt(e,"HTML_INTEGRATION_POINTS",()=>g({},nn));let o=Nt(e,"CUSTOM_ELEMENT_HANDLING",()=>ge(null));if(H=ge(null),v(o,"tagNameCheck")&&rn(o.tagNameCheck)&&(H.tagNameCheck=o.tagNameCheck),v(o,"attributeNameCheck")&&rn(o.attributeNameCheck)&&(H.attributeNameCheck=o.attributeNameCheck),v(o,"allowCustomizedBuiltInElements")&&typeof o.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=o.allowCustomizedBuiltInElements),L(H),Y&&(ut=!1),Pe&&(ce=!0),le&&(b=g({},wn),R=ge(null),le.html===!0&&(g(b,Sn),g(R,xn)),le.svg===!0&&(g(b,wt),g(R,Ot),g(R,Ye)),le.svgFilters===!0&&(g(b,xt),g(R,Ot),g(R,Ye)),le.mathMl===!0&&(g(b,Lt),g(R,Ln),g(R,Ye))),W.tagCheck=null,W.attributeCheck=null,v(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?W.tagCheck=e.ADD_TAGS:Ee(e.ADD_TAGS)&&(b===ct&&(b=k(b)),g(b,e.ADD_TAGS,S))),v(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?W.attributeCheck=e.ADD_ATTR:Ee(e.ADD_ATTR)&&(R===lt&&(R=k(R)),g(R,e.ADD_ATTR,S))),v(e,"ADD_FORBID_CONTENTS")&&Ee(e.ADD_FORBID_CONTENTS)&&(ue===Kt&&(ue=k(ue)),g(ue,e.ADD_FORBID_CONTENTS,S)),mt&&(b["#text"]=!0),Q&&g(b,["html","head","body"]),b.table&&(g(b,["tbody"]),delete Re.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw ee('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ee('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let a=D;D=e.TRUSTED_TYPES_POLICY;try{K=ae("")}catch(u){throw D=a,u}}else e.TRUSTED_TYPES_POLICY===null?(D=void 0,K=""):(D===void 0&&(D=ur()),D&&typeof K=="string"&&(K=ae("")));x&&x(e),pe=e},on=g({},[...wt,...xt,...no]),sn=g({},[...Lt,...ro]),xr=function(e,o,a){return o.namespaceURI===B?e==="svg":o.namespaceURI===ze?e==="svg"&&(a==="annotation-xml"||Et[a]):!!on[e]},Lr=function(e,o,a){return o.namespaceURI===B?e==="math":o.namespaceURI===Fe?e==="math"&&Tt[a]:!!sn[e]},Or=function(e,o,a){return o.namespaceURI===Fe&&!Tt[a]||o.namespaceURI===ze&&!Et[a]?!1:!sn[e]&&(Rr[e]||!on[e])},Nr=function(e){let o=se(e);(!o||!o.tagName)&&(o={namespaceURI:fe,tagName:"template"});let a=Oe(e.tagName),u=Oe(o.tagName);return gt[e.namespaceURI]?e.namespaceURI===Fe?xr(a,o,u):e.namespaceURI===ze?Lr(a,o,u):e.namespaceURI===B?Or(a,o,u):!!(Ae==="application/xhtml+xml"&>[e.namespaceURI]):!1},X=function(e){we(t.removed,{element:e});try{se(e).removeChild(e)}catch{if(rt(e),!se(e))throw ee("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},an=function(e,o,a){try{e.removeAttributeNode(o)}catch{try{e.removeAttribute(a)}catch{}}},Ge=function(e){He(e);let o=oe(e);if(o){let u=[];te(o,p=>{we(u,p)}),te(u,p=>{try{rt(p)}catch{}})}let a=ot(e);if(a)for(let u=a.length-1;u>=0;--u){let p=a[u],h=p&&p.name;typeof h=="string"&&an(e,p,h)}},J=function(e,o,a){if(!a)try{a=o.getAttributeNode(e)}catch{a=null}we(t.removed,{attribute:a||null,from:o});try{a?o.removeAttributeNode(a):o.removeAttribute(e)}catch{try{o.removeAttribute(e)}catch{}}if(e==="is")if(ce||Pe)try{X(o)}catch{}else try{o.setAttribute(e,"")}catch{}},Cr=function(e){let o=ot(e);if(o)for(let a=o.length-1;a>=0;--a){let u=o[a],p=u&&u.name;typeof p!="string"||R[S(p)]||an(e,u,p)}},He=function(e){let o=[e];for(;o.length>0;){let a=o.pop();ye(a)===P.element&&Cr(a);let p=oe(a);if(p)for(let h=p.length-1;h>=0;--h)o.push(p[h])}},cn=function(e,o){return Z?e==="patchsrc"?!0:e==="for"&&o!=="label"&&o!=="output":!1},Ir=function(e){if(!Z)return;let o=[e];for(;o.length>0;){let a=o.pop(),u=ye(a);if(u===P.processingInstruction||u===P.comment&&O(Cn,a.data)){try{rt(a)}catch{}continue}if(u===P.element){let h=a,T=S(st(a));try{h.hasAttribute&&h.hasAttribute("patchsrc")&&h.removeAttribute("patchsrc"),h.hasAttribute&&h.hasAttribute("for")&&cn("for",T)&&h.removeAttribute("for")}catch{}}let p=oe(a);if(p)for(let h=p.length-1;h>=0;--h)o.push(p[h])}},ln=function(e){let o=null,a=null;if(pt)e="<remove></remove>"+e;else{let h=yn(e,/^[\r\n\t ]+/);a=h&&h[0]}Ae==="application/xhtml+xml"&&fe===B&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let u=D?ae(e):e;if(fe===B)try{o=new G().parseFromString(u,Ae)}catch{}if(!o||!o.documentElement){o=at.createDocument(fe,"template",null);try{o.documentElement.innerHTML=ht?K:u}catch{}}let p=o.body||o.documentElement;return e&&a&&p.insertBefore(n.createTextNode(a),p.childNodes[0]||null),fe===B?pr.call(o,Q?"html":"body")[0]:Q?o.documentElement:p},un=function(e){let o=De?De(e):e.ownerDocument;return Gt.call(o||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Be=function(e){return e=xe(e,dr," "),e=xe(e,hr," "),e=xe(e,gr," "),e},yt=function(e){var o;e.normalize();let a=De?De(e):e.ownerDocument,u=Gt.call(a||e,e,d.SHOW_TEXT|d.SHOW_COMMENT|d.SHOW_CDATA_SECTION|d.SHOW_PROCESSING_INSTRUCTION,null),p=u.nextNode();for(;p;)p.data=Be(p.data),p=u.nextNode();let h=(o=e.querySelectorAll)===null||o===void 0?void 0:o.call(e,"template");h&&te(h,T=>{me(T.content)&&yt(T.content)})},$e=function(e){let o=ie?ie(e):null;return typeof o!="string"||S(o)!=="form"?!1:typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||e.attributes!==ot(e)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function"||e.nodeType!==q(e)||e.childNodes!==oe(e)},me=function(e){if(!q||typeof e!="object"||e===null)return!1;try{return q(e)===P.documentFragment}catch{return!1}},Se=function(e){if(!q||typeof e!="object"||e===null)return!1;try{return typeof q(e)=="number"}catch{return!1}};function $(c,e,o){c.length!==0&&te(c,a=>{a.call(t,e,o,pe)})}let Dr=function(e,o){return!!(Z&&e.hasChildNodes()&&!Se(e.firstElementChild)&&O(Nn,e.textContent)&&O(Nn,e.innerHTML)||Z&&e.namespaceURI===B&&go[o]&&(Se(e.firstElementChild)||typeof e.textContent=="string"&&O(Eo[o],e.textContent))||e.nodeType===P.processingInstruction||Z&&e.nodeType===P.comment&&O(Cn,e.data))},je=function(e,o){if(e instanceof RegExp)return O(e,o);if(e instanceof Function){for(var a=arguments.length,u=new Array(a>2?a-2:0),p=2;p<a;p++)u[p-2]=arguments[p];return!!e(o,...u)}return!1},Ur=function(e,o,a){if(!Re[o]&&hn(o)&&je(H.tagNameCheck,o))return!1;if(mt&&!ue[o]){let u=se(e),p=oe(e);if(p&&u){let h=p.length;for(let T=h-1;T>=0;--T){let A=e===a?ar(p[T],!0):p[T];u.insertBefore(A,cr(e))}}}return X(e),!0},fn=function(e,o,a,u){return e.length===0?o:o===a||o===u?k(o):o},pn=function(e,o){return e===o||se(e)!==null?!1:(dt&&He(e),!0)},mn=function(e,o){if($(y.beforeSanitizeElements,e,null),pn(e,o))return!0;if($e(e))return X(e),!0;let a=S(st(e));if(b=fn(y.uponSanitizeElement,b,ct,Me),$(y.uponSanitizeElement,e,{tagName:a,allowedTags:b}),pn(e,o))return!0;if(Dr(e,a))return X(e),!0;if(Re[a]||!(W.tagCheck instanceof Function&&W.tagCheck(a))&&!b[a]){let p=Ur(e,a,o);return p===!1&&$(y.afterSanitizeElements,e,null),p}if(ye(e)===P.element&&!Nr(e)||(a==="noscript"||a==="noembed"||a==="noframes")&&O(mo,e.innerHTML))return X(e),!0;if(Y&&e.nodeType===P.text){let p=Be(e.textContent);e.textContent!==p&&(we(t.removed,{element:e.cloneNode()}),e.textContent=p)}return $(y.afterSanitizeElements,e,null),!1},dn=function(e,o,a){if($t[o]||cn(o,e)||Xt&&(o==="id"||o==="name")&&(a in n||a in wr))return!1;let u=R[o]||W.attributeCheck instanceof Function&&W.attributeCheck(o,e);return ut&&O(Er,o)||jt&&O(Tr,o)?!0:u?Jt[o]||O(Bt,xe(a,Ht,""))||(o==="src"||o==="xlink:href"||o==="href")&&e!=="script"&&bn(a,"data:")===0&&Zt[e]||Wt&&!O(_r,xe(a,Ht,""))?!0:!a:hn(e)&&je(H.tagNameCheck,e)&&je(H.attributeNameCheck,o,e)||o==="is"&&H.allowCustomizedBuiltInElements&&je(H.tagNameCheck,a)},Mr=g({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),hn=function(e){return!Mr[Oe(e)]&&O(yr,e)},vr=function(e,o,a,u){if(D&&typeof j=="object"&&typeof j.getAttributeType=="function"&&!a)switch(j.getAttributeType(e,o)){case"TrustedHTML":return ae(u);case"TrustedScriptURL":return lr(u)}return u},Pr=function(e,o,a,u){try{a?e.setAttributeNS(a,o,u):e.setAttribute(o,u),$e(e)?X(e):_n(t.removed)}catch{J(o,e)}},gn=function(e){$(y.beforeSanitizeAttributes,e,null);let o=e.attributes;if(!o||$e(e))return;R=fn(y.uponSanitizeAttribute,R,lt,ve);let a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0},u=o.length,p=S(e.nodeName);for(;u--;){let h=o[u],T=h.name,A=h.namespaceURI,U=h.value,M=S(T),Rt=U,N=T==="value"?Rt:qr(Rt);if(a.attrName=M,a.attrValue=N,a.keepAttr=!0,a.forceKeepAttr=void 0,$(y.uponSanitizeAttribute,e,a),N=a.attrValue,Vt&&(M==="id"||M==="name")&&bn(N,qt)!==0&&(J(T,e,h),N=qt+N),Z&&O(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,N)){J(T,e,h);continue}if(M==="attributename"&&yn(N,"href")){J(T,e,h);continue}if(!a.forceKeepAttr){if(!a.keepAttr){J(T,e,h);continue}if(!Yt&&O(ho,N)){J(T,e,h);continue}if(Y&&(N=Be(N)),!dn(p,M,N)){J(T,e,h);continue}N=vr(p,M,A,N),N!==Rt&&Pr(e,T,A,N)}}$(y.afterSanitizeAttributes,e,null)},We=function(e){let o=null,a=un(e);for($(y.beforeSanitizeShadowDOM,e,null);o=a.nextNode();)if($(y.uponSanitizeShadowNode,o,null),mn(o,e),gn(o),me(o.content)&&We(o.content),ye(o)===P.element){let u=kt(o);me(u)&&(bt(u),We(u))}$(y.afterSanitizeShadowDOM,e,null)},bt=function(e){let o=[{node:e,shadow:null}];for(;o.length>0;){let a=o.pop();if(a.shadow){We(a.shadow);continue}let u=a.node,h=ye(u)===P.element,T=oe(u);if(T)for(let A=T.length-1;A>=0;--A)o.push({node:T[A],shadow:null});if(h){let A=ie?ie(u):null;if(typeof A=="string"&&S(A)==="template"){let U=u.content;me(U)&&o.push({node:U,shadow:null})}}if(h){let A=kt(u);me(A)&&o.push({node:null,shadow:A},{node:A,shadow:null})}}};return t.sanitize=function(c){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=null,a=null,u=null,p=null;if(ht=!c,ht&&(c="<!-->"),typeof c!="string"&&!Se(c)&&(c=eo(c),typeof c!="string"))throw ee("dirty is not a string, aborting");if(!t.isSupported)return c;ft?(b=Me,R=ve):_t(e),(y.uponSanitizeElement.length>0||y.uponSanitizeAttribute.length>0)&&(b=k(b)),y.uponSanitizeAttribute.length>0&&(R=k(R)),t.removed=[];let h=dt&&typeof c!="string"&&Se(c);if(h){Ir(c);let U=st(c);if(typeof U=="string"){let M=S(U);if(!b[M]||Re[M])throw Ge(c),ee("root node is forbidden and cannot be sanitized in-place")}if($e(c))throw Ge(c),ee("root node is clobbered and cannot be sanitized in-place");try{bt(c)}catch(M){throw Ge(c),M}}else if(Se(c))o=ln("<!---->"),a=o.ownerDocument.importNode(c,!0),a.nodeType===P.element&&a.nodeName==="BODY"||a.nodeName==="HTML"?o=a:o.appendChild(a),bt(a);else{if(!ce&&!Y&&!Q&&c.indexOf("<")===-1)return D&&ke?ae(c):c;if(o=ln(c),!o)return ce?null:ke?K:""}o&&pt&&X(o.firstChild);let T=h?c:o;try{let U=un(T);for(;u=U.nextNode();)mn(u,T),gn(u),me(u.content)&&We(u.content)}catch(U){throw h&&(Ge(c),te(t.removed,M=>{M.element&&He(M.element)})),U}if(h)return te(t.removed,U=>{U.element&&He(U.element)}),Y&&yt(c),c;if(ce){if(Y&&yt(o),Pe)for(p=fr.call(o.ownerDocument);o.firstChild;)p.appendChild(o.firstChild);else p=o;return(R.shadowroot||R.shadowrootmode)&&(p=mr.call(s,p,!0)),p}let A=Q?o.outerHTML:o.innerHTML;return Q&&b["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&O(fo,o.ownerDocument.doctype.name)&&(A="<!DOCTYPE "+o.ownerDocument.doctype.name+`>
|
|
3
|
-
`+A),Y&&(A=Be(A)),D&&ke?ae(A):A},t.setConfig=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_t(c),ft=!0,Me=b,ve=R},t.clearConfig=function(){pe=null,ft=!1,Me=null,ve=null,D=it,K=""},t.isValidAttribute=function(c,e,o){pe||_t({});let a=S(c),u=S(e);return dn(a,u,o)},t.addHook=function(c,e){typeof e=="function"&&v(y,c)&&we(y[c],e)},t.removeHook=function(c,e){if(v(y,c)){if(e!==void 0){let o=Xr(y[c],e);return o===-1?void 0:Vr(y[c],o,1)[0]}return _n(y[c])}},t.removeHooks=function(c){v(y,c)&&(y[c]=[])},t.removeAllHooks=function(){y=In()},t}var Pn=vn();var Xe=Pn(globalThis.window);var kn=/&/gi,zn=/&(?=[#a-z0-9])(?![a-z0-9]+=)/i;var Fn=/#$/,Gn=/^(?:application\/(?:[\w.-]+\+)?xml|image\/svg\+xml|text\/(?:html|xml))(?:\s*;\s*|$)/i;var Hn=/\P{ASCII}/u,Bn=/&#(x0*[\dA-F]{1,2}|0*\d{1,3});?/gi,$n=/(?:%[\dA-F]{2})+/gi,jn=/^((?:[^#%]|%(?!23))*)\?$/,Ve=/^[a-z][\da-z+.-]*$/,Wn=/^(?:web\+[a-z]+|ext\+[a-z][\da-z.-]*)$/,ne=/^(?:java|vb)script$/i,Ne=/^(?:(?:java|vb)script|blob)$/i,Dt=/["'<>]|%(?:22|27|3C|3E)|&(?:apos|lt|gt|quot|#0*(?:34|39|60|62)|#x0*(?:22|27|3C|3E));/i,Yn=/^%[\dA-F]{2}$/i,Xn=/^(?:\/{2,}|\\|[a-z][a-z\d+\-.]*:[^/])/i;var Vn=[9,10,13,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,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 Ut=new Set(Vn),Mt=new Map([[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),bo=()=>{let r=new Map;for(let t=0;t<256;t++)!Ut.has(t)&&!Mt.has(t)&&r.set(t,`\\x${t.toString(16).padStart(2,"0").toUpperCase()}`);return r},vt=bo();var[Te,Ro,Ao,So,wo,xo]=["&","#","<",">",'"',"'"].map(r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`),Lo={[Te]:`${Te}amp;`,[Ao]:`${Te}lt;`,[So]:`${Te}gt;`,[wo]:`${Te}quot;`,[xo]:`${Te}${Ro}39;`},Qo=Array.from({length:256},(r,t)=>`%${t.toString(16).padStart(2,"0").toUpperCase()}`),Zn=globalThis.process?.versions?.node!==void 0,Qn=`[${[...vt.values()].join("")}]`,Oo=new RegExp(Qn),No=new RegExp(Qn,"g"),Co=new Uint8Array(65536),Jo=new TextEncoder,Io=new TextDecoder("utf-8",{fatal:!0}),C=(r,t=!1)=>{if(!_(r))return null;let n=Hn.test(r)?r.normalize("NFKC"):r;return t?n.trim().toLowerCase().replace(/:$/,""):n},z=(r,t,n=!1)=>{if(!_(r)||r==="")return null;let s=r,i=t&&_(t)?t:"";if(n&&(s=C(s),i&&(i=C(i))),typeof URL.parse=="function")return i?URL.parse(s,i):URL.parse(s);try{return i?new URL(s,i):new URL(s)}catch{return null}},Jn=r=>_(r)?r.replace(/:$/,"").split("+"):[];var er=r=>{if(!_(r))return r;let t=Yn.test(r)?r.toUpperCase():r;return Lo[t]??r},re=r=>{let t=_(r)?r:String(r);return t.length>64?`${t.slice(0,64)}...`:t},tr=r=>_(r)?r.replace(Fn,"").replace(jn,"$1"):r,Do=(r,t)=>{let n=/^x/i.test(t)?Number.parseInt(t.slice(1),16):Number.parseInt(t,10);if(!Number.isInteger(n)||n<0||n>=256)return r;if(vt.has(n))return"";if(Ut.has(n))return String.fromCharCode(n);let s=Mt.get(n);return String.fromCodePoint(s)},nr=(r,t=0)=>{if(!_(r))throw new TypeError(`Expected String but got ${de(r)}.`);if(!Number.isInteger(t))throw new TypeError(`Expected Number but got ${de(t)}.`);let n;try{n=decodeURIComponent(r)}catch{n=r.replace($n,i=>{try{return decodeURIComponent(i)}catch{return i}})}n=n.replace(No,"");let s=0;for(;s+t<16;s++){let i=n;if(n=n.replace(kn,"&").replace(Bn,Do),n===i)break}if(s+t>=16&&/&#/.test(n))throw new Error("Character references nested too deeply.");return n},Qe=(r,t="",n="")=>{if(!_(r))return{mediaType:"",mediaTypes:[],data:"",isBase64:!1};let s=r.indexOf(",");if(s===-1)return{mediaType:r,mediaTypes:r.split(";"),data:"",isBase64:!1};let i=r.substring(0,s),l=r.substring(s+1),f=t===""&&n===""?l:l+t+n,m=i.split(";"),d=m.at(-1),E=d!==void 0&&d.length===6&&d.toLowerCase()==="base64";return{mediaType:i,mediaTypes:m,data:f,isBase64:E}},rr=r=>{if(!_(r))throw new TypeError(`Expected String but got ${de(r)}.`);let t,n=r;try{t=atob(r)}catch{n=r.replace(/\s/g,"");try{t=atob(n)}catch{throw new Error(`Invalid base64 data: ${re(r)}`)}}let s;if(Zn&&globalThis.Buffer)s=globalThis.Buffer.from(t,"latin1");else{let i=t.length;i>65536?s=new Uint8Array(i):s=Co.subarray(0,i);for(let l=0;l<i;l++)s[l]=t.charCodeAt(l)}try{let i=Io.decode(s);return Oo.test(i)?n:i}catch{return n}},Je=r=>{if(Zn&&globalThis.Buffer)return globalThis.Buffer.from(r).toString("base64");let t=new Uint8Array(r);if(typeof t.toBase64=="function")return t.toBase64();let n=[];for(let s=0;s<t.length;s+=8192)n.push(String.fromCharCode(...t.subarray(s,s+8192)));return btoa(n.join(""))};var Ie=class{constructor(t,n){this.domPurify=n,this.nest=0,this.recurse=new Set,this.restrictScheme=!1,this.schemeMap=new Map([["blob",!1],["data",!1],["file",!1],["javascript",!1],["vbscript",!1]]),this.#e(t)}#e(t={}){let{allowRelative:n,debug:s,schemes:i,allow:l,deny:f,only:m}=t;if(this.allowRelative=!!n,this.debug=!!s,Array.isArray(m)&&m.length){this.schemes=new Set,this.restrictScheme=!0;for(let d of m)this.#t(d)}else{if(this.schemes=new Set(i||[]),Array.isArray(l)&&l.length)for(let d of l)this.#t(d);if(Array.isArray(f)&&f.length)for(let d of f){let E=C(d,!0);E&&this.schemeMap.set(E,!1)}}}#t(t){let n=C(t,!0);return!n||Ne.test(n)||!Ve.test(n)||n.includes("+")&&n.split("+").some(i=>ne.test(i))?!1:(this.schemeMap.set(n,!0),this.schemes.add(n),!0)}enter(t){return this.recurse.has(t)?(this.debug&&he(`Circular Data URL detected and skipped: ${re(t)}`),!1):(this.nest++,this.recurse.add(t),!0)}leave(t){this.nest--,this.recurse.delete(t)}},et=class{#e;constructor(t){this.#e=t}#t(t,n){if(n.nest>16)throw new Error("Data URLs nested too deeply.");let s=z(t,null,!0);if(!s){if(n.allowRelative&&!Xn.test(t)){let l=z(t,At);if(l){let{protocol:f,hostname:m,pathname:d,search:E,hash:G}=l;if(f==="http:"&&m==="dummy.local")return this.#r(`${d}${E}${G}`)}}return null}let i=C(s.protocol,!0);if(n.restrictScheme&&!n.schemeMap.has(i))return null;if(i.includes("+")){let l=i.split("+");if(n.schemeMap.get(i)===!1||l.some(f=>n.schemeMap.get(f)===!1))return null}else if(n.schemeMap.get(i)===!1)return null;return i==="data"?this.#n(s,n):this.#r(s.href)}#n(t,n){let{mediaType:s,mediaTypes:i,data:l,isBase64:f}=Qe(t.pathname,t.search,t.hash),m=l;if(f)try{m=rr(l)}catch(d){return n.debug&&he("Failed to parse base64 data.",d),null}try{let d=nr(m).trim(),E=z(d,At);if(!E||Jn(E.protocol).some(j=>Ne.test(j)))return null}catch(d){return n.debug&&he("Failed to parse inner data URL protocol.",d),null}return(!s||Gn.test(s))&&(m=this.#s(m,n)),m?(f&&m!==l&&i.pop(),`data:${i.join(";")},${m}`):null}#s(t,n){let s=t;try{s=decodeURIComponent(t)}catch{}let i;try{n.domPurify.addHook("uponSanitizeAttribute",(l,f)=>this.#o(l,f,n)),i=n.domPurify.sanitize(s)}finally{n.domPurify.removeHook("uponSanitizeAttribute")}i=tr(i);try{return encodeURI(i)}catch{return i}}#o(t,n,s){if(!n.attrValue||!/^\s*data:/i.test(n.attrValue))return;let i=z(n.attrValue,null,!0);if(!i||i.protocol!=="data:")return;let l=n.attrValue;if(!s.enter(l)){n.attrValue="";return}try{let f=this.#t(l,s);n.attrValue=f||""}finally{s.leave(l)}}#r(t){let n=t.length,s=n,i=Dt.exec(t);if(i&&(s=i.index),t.indexOf("&")>-1){let f=zn.exec(t);if(f){let m=f.index;m<s&&(s=m)}}if(s===n)return t;let l=t.charCodeAt(s-1);return(l===63||l===38)&&s--,t.substring(0,s)}sanitize(t,n=this.#e){if(!t||!_(t))return null;let{deny:s,maxLength:i,only:l,allowRelative:f}=n;if(Number.isInteger(i)&&t.length>i){let E=`URL length ${t.length} exceeds max length ${i}.`;throw new RangeError(E)}if(!(Array.isArray(s)&&s.length>0||Array.isArray(l)&&l.length>0||f)&&(t.startsWith("https://")||t.startsWith("http://"))&&!Dt.test(t)&&!t.includes("data:")){let E=z(t,null,!0);return E&&n.schemes.has(E.protocol.replace(/:$/,""))?E.href.replace(/%26/g,er):null}let d=new Ie(n,Xe);return this.#t(t,d)}async sanitizeBuffer(t,n,s=this.#e){if(!(t instanceof ArrayBuffer))return null;let i=Je(t),l=`data:${n?`${n};base64`:"base64"},${i}`;if(Number.isInteger(s.maxLength)&&l.length>s.maxLength)throw new RangeError(`URL length ${l.length} exceeds max length ${s.maxLength}.`);let f=new Ie(s,Xe);if(!f.schemeMap.get("data"))return null;let m=z(l);return m?this.#n(m,f):null}async sanitizeDataURL(t,n=this.#e){if(!t||!_(t))return null;let{maxLength:s}=n;if(Number.isInteger(s)&&t.length>s)throw new RangeError(`URL length ${t.length} exceeds max length ${s}.`);let i=z(t);if(!i)return null;let l=C(i.protocol,!0);if(l!=="data")return null;let f=new Ie(n,Xe);return f.schemeMap.get(l)?this.#n(i,f):null}};var or=["aaa","aaas","about","acap","acct","acd","acr","adiumxtra","adt","aet","afp","afs","agtp","aim","amss","android","appdata","apt","ar","ari","ark","ars","at","attachment","aw","barion","beshare","bitcoin","bitcoincash","bl","blob","bluetooth","bolo","brid","browserext","cabal","caip","calculator","callto","cap","cast","casts","chrome","chrome-extension","cid","cm","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","ez","facetime","feed","feedready","fido","file","finger","first-run-pen-experience","fish","fm","ftp","fuchsia-pkg","gcx","gdsi","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","interaction","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","mdoc","mdoc-openid4vp","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","musik","mvn","mvrp","mvrps","news","nfs","ni","nih","nntp","nostr","notes","npamp","num","ocf","oid","onenote","onenote-cmd","opaquelocktoken","openid","openpgp4fpr","otpauth","palm","paparazzi","payto","pkcs11","pkg","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","sss","starknet","steam","stun","stuns","submit","svn","swh","swid","swidpath","tag","taler","teamspeak","teapot","teapots","tel","teliaeid","telnet","tftp","things","thismessage","tip","tn3270","tool","tttps","turn","turns","tv","udp","unreal","upn","urn","ust","ut2004","uuaid","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 tt=class{#e=new Set(or);get(){return[...this.#e]}getScheme(t){if(!_(t))return null;let n=this.parse(t);return n?this.normalize(n.protocol,!0):null}has(t){let n=this.normalize(t,!0);return n?this.#e.has(n):!1}normalize(t,n=!1){return C(t,n)}normalizeSchemes(t){if(Array.isArray(t)){let n=[];for(let s of t){let i=C(s,!0);i&&n.push(i)}return n}return[]}parse(t,n,s=!1){return z(t,n,s)}verifyURI(t,n){if(!_(t))return!1;let s=this.parse(t);return s?this.verifyScheme(s.protocol,n,!0):!1}verifyScheme(t,n,s=!1){if(!_(t))return!1;let i=this.normalize(t,!0),l=n||this.#e;if(!i.includes("+"))return ne.test(i)?!1:l.has(i);let f=i.split("+");return f.some(d=>ne.test(d))?!1:l.has(i)?!0:s&&Wn.test(i)||f.every(d=>l.has(d))}};var Mo=Object.freeze(["href","origin","protocol","username","password","host","hostname","port","pathname","search","hash"]),vo=Object.freeze({allow:Object.freeze([]),deny:Object.freeze([]),only:Object.freeze([]),allowRelative:!1,debug:!1,revokeObjectURL:!1,maxBlobSize:16777216,maxLength:65536}),Po=async(r,t)=>{let n=r.body.getReader(),s=[];try{let i=0;for(;i<=t;){let{done:m,value:d}=await n.read();if(m)break;if(i+=d.byteLength,i>t)throw await n.cancel("Size limit exceeded"),new DOMException(`Payload (${i} bytes) exceeds max (${t} bytes).`,"NotReadableError");s.push(d)}let l=new Uint8Array(i),f=0;for(let m of s)l.set(m,f),f+=m.byteLength;return l.buffer}finally{n.releaseLock()}},sr=async(r,t)=>{let n=16777216;Number.isInteger(t)&&t>0&&(n=t);let s=await fetch(r);if(!s.ok){let d=`Failed to fetch ${re(r)}`;throw Number.isInteger(s.status)&&(s.statusText?d+=`: ${s.status} ${s.statusText}`:d+=`: ${s.status}`),new Error(d)}let i=s.headers.get("content-length");if(i){let m=Number.parseInt(i,10);if(Number.isInteger(m)&&m>n)throw new DOMException(`Payload (${m} bytes) exceeds max (${n} bytes).`,"NotReadableError")}let l=s.headers.get("content-type")||"",f;if(s.body)f=await Po(s,n);else{let m=await s.blob();if(m.size>n)throw new DOMException(`Payload (${m.size} bytes) exceeds max (${n} bytes).`,"NotReadableError");f=await m.arrayBuffer()}return{buffer:f,mimeType:l}},nt=class extends tt{#e;#t;#n;constructor(){super(),this.#e=new Set(super.get()),this.#t={...vo,schemes:this.#e},this.#n=new et(this.#t)}#s(t){return!_(t)||Ne.test(t)||t.includes("+")&&t.split("+").some(s=>ne.test(s))?!1:Ve.test(t)}#o(t,n={}){if(!t||!_(t))return{isValid:!1};let s={...this.#t,...n,allow:this.normalizeSchemes(n.allow),deny:this.normalizeSchemes(n.deny),only:this.normalizeSchemes(n.only),schemes:this.#e},i=this.getScheme(t);return i===null&&!s.allowRelative?{isValid:!1}:{options:s,scheme:i}}#r(t){let n={input:t,href:null,valid:!1};if(!_(t))return n.reason=`Invalid URL input: ${re(t)}`,n;if(t==="")return n.reason="Invalid URL input: (empty string)",n;let s,i=null;try{s=this.#n.sanitize(t,{...this.#t,allow:["data"],allowRelative:!0}),s||(i="Sanitization failed (blocked by allowed schemes or rules).")}catch(l){i=l.message}if(s){let l=z(s);if(n.valid=!0,l){if(C(l.protocol,!0)==="data"){let{mediaTypes:m,data:d,isBase64:E}=Qe(l.pathname,l.search,l.hash);E&&m.pop(),n.data={mime:m.join(";"),base64:E,data:d}}else n.data=null;for(let m of Mo){let d=l[m];_(d)&&(n[m]=d)}}else n.valid=!1,n.relative=!0,n.href=s,n.reason="Invalid as an absolute URL, but valid as a relative URL."}else n.reason=i;return n}get(){return[...this.#e]}has(t){let n=C(t,!0);return n?this.#e.has(n):!1}add(t){if(!_(t))throw new TypeError(`Expected String but got ${de(t)}.`);let n=C(t,!0);if(!this.#s(n))throw new Error(`Invalid scheme: ${t}`);return this.#e.add(n),[...this.#e]}remove(t){if(!_(t))return!1;let n=C(t,!0);return this.#e.delete(n)}reset(){this.#e=new Set(super.get())}async sanitizeURL(t,n){let{isValid:s,options:i,scheme:l}=this.#o(t,n);if(s===!1)return null;if(l==="blob"){let{allow:f,deny:m,only:d}=i,E=null;if(f.includes("blob")&&!m.includes("blob")||d.includes("blob")){let G=null,j="";try{let I=await sr(t,i.maxBlobSize);G=I.buffer,j=I.mimeType}catch(I){i.debug&&he(`Failed to fetch and convert blob URL: ${re(t)}`,I)}G&&(d.length?d.includes("data")||(i.only=[...d,"data"]):(f.includes("data")||(i.allow=[...f,"data"]),i.deny=m.filter(I=>I!=="data")),E=await this.#n.sanitizeBuffer(G,j,i))}return i.revokeObjectURL&&URL.revokeObjectURL(t),E}else if(l==="data")return this.#n.sanitizeDataURL(t,i);return this.#n.sanitize(t,i)}sanitizeURLSync(t,n){let{isValid:s,options:i,scheme:l}=this.#o(t,n);return s===!1?null:l==="blob"?(i.revokeObjectURL&&URL.revokeObjectURL(t),null):this.#n.sanitize(t,i)}async inspectURL(t){if(_(t)){let n=z(t,null,!0);if(n?.protocol==="blob:")try{let{buffer:s,mimeType:i}=await sr(n.href),l=Je(s),f=`data:${i?`${i};base64`:"base64"},${l}`,m=this.#r(f);return m.input=t,m}catch(s){return{input:t,valid:!1,reason:s.message}}}return this.#r(t)}isValidURI(t){return super.verifyURI(t,this.#e)}};var _e=new nt,bs=async(r,t)=>_e.sanitizeURL(r,t),Rs=(r,t)=>_e.sanitizeURLSync(r,t),As=async r=>_e.inspectURL(r),Ss=r=>_e.isValidURI(r),ws=r=>_e.isValidURI(r),xs=_e;export{nt as URLSanitizer,xs as default,As as inspectURL,ws as isURISync,Ss as isValidURI,bs as sanitizeURL,Rs as sanitizeURLSync};
|
|
1
|
+
var Rt="http://dummy.local",we={allow:Object.freeze([]),deny:Object.freeze([]),only:Object.freeze([]),allowRelative:!1,debug:!1,revokeObjectURL:!1,maxBlobSize:16777216,maxLength:65536,schemes:new Set};var de=r=>Object.prototype.toString.call(r).slice(8,-1),T=r=>typeof r=="string"||r instanceof String,he=(r,t)=>{console.warn(`[URLSanitizer Debug] ${r}`,t)};function En(r,t){(t==null||t>r.length)&&(t=r.length);for(var n=0,s=Array(t);n<t;n++)s[n]=r[n];return s}function Fr(r){if(Array.isArray(r))return r}function Gr(r,t){var n=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(n!=null){var s,i,l,f,p=[],d=!0,_=!1;try{if(l=(n=n.call(r)).next,t!==0)for(;!(d=(s=l.call(n)).done)&&(p.push(s.value),p.length!==t);d=!0);}catch(G){_=!0,i=G}finally{try{if(!d&&n.return!=null&&(f=n.return(),Object(f)!==f))return}finally{if(_)throw i}}return p}}function Hr(){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 Br(r,t){return Fr(r)||Gr(r,t)||$r(r,t)||Hr()}function $r(r,t){if(r){if(typeof r=="string")return En(r,t);var n={}.toString.call(r).slice(8,-1);return n==="Object"&&r.constructor&&(n=r.constructor.name),n==="Map"||n==="Set"?Array.from(r):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?En(r,t):void 0}}var Dn=Object.entries,Tn=Object.setPrototypeOf,jr=Object.isFrozen,Wr=Object.getPrototypeOf,Yr=Object.getOwnPropertyDescriptor,x=Object.freeze,L=Object.seal,ge=Object.create,Un=typeof Reflect<"u"&&Reflect,Ct=Un.apply,It=Un.construct;x||(x=function(t){return t});L||(L=function(t){return t});Ct||(Ct=function(t,n){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(n,i)});It||(It=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});var te=w(Array.prototype.forEach),Xr=w(Array.prototype.lastIndexOf),_n=w(Array.prototype.pop),xe=w(Array.prototype.push),Vr=w(Array.prototype.splice),Ee=Array.isArray,Ne=w(String.prototype.toLowerCase),St=w(String.prototype.toString),yn=w(String.prototype.match),Le=w(String.prototype.replace),bn=w(String.prototype.indexOf),qr=w(String.prototype.trim),Kr=w(Number.prototype.toString),Zr=w(Boolean.prototype.toString),An=typeof BigInt>"u"?null:w(BigInt.prototype.toString),Rn=typeof Symbol>"u"?null:w(Symbol.prototype.toString),v=w(Object.prototype.hasOwnProperty),Oe=w(Object.prototype.toString),O=w(RegExp.prototype.test),ee=Qr(TypeError);function w(r){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return Ct(r,t,s)}}function Qr(r){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return It(r,n)}}function g(r,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ne;if(Tn&&Tn(r,null),!Ee(t))return r;let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){let l=n(i);l!==i&&(jr(t)||(t[s]=l),i=l)}r[i]=!0}return r}function Jr(r){for(let t=0;t<r.length;t++)v(r,t)||(r[t]=null);return r}function k(r){let t=ge(null);for(let s of Dn(r)){var n=Br(s,2);let i=n[0],l=n[1];v(r,i)&&(Ee(l)?t[i]=Jr(l):l&&typeof l=="object"&&l.constructor===Object?t[i]=k(l):t[i]=l)}return t}function eo(r){switch(typeof r){case"string":return r;case"number":return Kr(r);case"boolean":return Zr(r);case"bigint":return An?An(r):"0";case"symbol":return Rn?Rn(r):"Symbol()";case"undefined":return Oe(r);case"function":case"object":{if(r===null)return Oe(r);let t=r,n=F(t,"toString");if(typeof n=="function"){let s=n(t);return typeof s=="string"?s:Oe(s)}return Oe(r)}default:return Oe(r)}}function F(r,t){for(;r!==null;){let s=Yr(r,t);if(s){if(s.get)return w(s.get);if(typeof s.value=="function")return w(s.value)}r=Wr(r)}function n(){return null}return n}function to(r){try{return O(r,""),!0}catch{return!1}}var Sn=x(["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"]),wt=x(["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"]),xt=x(["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"]),no=x(["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=x(["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"]),ro=x(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),wn=x(["#text"]),xn=x(["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"]),Ot=x(["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","dominant-baseline","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","pointer-events","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-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","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"]),Ln=x(["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"]),Xe=x(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),oo=L(/{{[\w\W]*|^[\w\W]*}}/g),so=L(/<%[\w\W]*|^[\w\W]*%>/g),io=L(/\${[\w\W]*/g),ao=L(/^data-[\-\w.\u00B7-\uFFFF]+$/),co=L(/^aria-[\-\w]+$/),On=L(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),lo=L(/^(?:\w+script|data):/i),uo=L(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),fo=L(/^html$/i),po=L(/^[a-z][.\w]*(-[.\w]+)+$/i),Nn=L(/<[/\w!]/g),Cn=L(/<[/\w]/g),mo=L(/<\/no(script|embed|frames)/i),ho=L(/\/>/i),P={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Mn=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],go=x(g({},Mn)),Eo=(function(){let r={};return te(Mn,t=>{r[t]=L(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),x(r)})(),To=function(){return typeof window>"u"?null:window},_o=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null,i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.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}},In=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},V=function(t,n,s,i){return v(t,n)&&Ee(t[n])?g(i.base?k(i.base):{},t[n],i.transform):s},Nt=function(t,n,s){let i=v(t,n)?t[n]:void 0;return i&&typeof i=="object"?k(i):s()};function vn(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:To(),t=c=>vn(c);if(t.version="3.4.14",t.removed=[],!r||!r.document||r.document.nodeType!==P.document||!r.Element)return t.isSupported=!1,t;let n=r.document,s=n,i=s.currentScript;r.DocumentFragment;let l=r.HTMLTemplateElement,f=r.Node,p=r.Element,d=r.NodeFilter,_=r.NamedNodeMap;_===void 0&&(r.NamedNodeMap||r.MozNamedAttrMap),r.HTMLFormElement;let G=r.DOMParser,j=r.trustedTypes,I=p.prototype,ar=F(I,"cloneNode"),rt=F(I,"remove"),cr=F(I,"nextSibling"),oe=F(I,"childNodes"),se=F(I,"parentNode"),kt=F(I,"shadowRoot"),ot=F(I,"attributes"),q=f&&f.prototype?F(f.prototype,"nodeType"):null,ie=f&&f.prototype?F(f.prototype,"nodeName"):null,Ue=f&&f.prototype?F(f.prototype,"ownerDocument"):null,ye=function(e){return q?q(e):e.nodeType},st=function(e){return ie?ie(e):e.nodeName};if(typeof l=="function"){let c=n.createElement("template");c.content&&c.content.ownerDocument&&(n=c.content.ownerDocument)}let D,K="",it,zt=!1,be=0,Ft=function(){if(be>0)throw ee('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},ae=function(e){Ft(),be++;try{return D.createHTML(e)}finally{be--}},lr=function(e){Ft(),be++;try{return D.createScriptURL(e)}finally{be--}},ur=function(){return zt||(it=_o(j,i),zt=!0),it},Me=n,at=Me.implementation,Gt=Me.createNodeIterator,fr=Me.createDocumentFragment,pr=Me.getElementsByTagName,mr=s.importNode,y=In();t.isSupported=typeof Dn=="function"&&typeof se=="function"&&at&&at.createHTMLDocument!==void 0;let dr=oo,hr=so,gr=io,Er=ao,Tr=co,_r=lo,Ht=uo,yr=po,Bt=On,b=null,ct=g({},[...Sn,...wt,...xt,...Lt,...wn]),A=null,lt=g({},[...xn,...Ot,...Ln,...Xe]),H=Object.seal(ge(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}})),Ae=null,$t=null,W=Object.seal(ge(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),jt=!0,ut=!0,Wt=!1,Yt=!0,Y=!1,Z=!0,Q=!1,ft=!1,ve=null,Pe=null,pt=!1,ce=!1,ke=!1,ze=!1,Xt=!0,Vt=!1,qt="user-content-",mt=!0,dt=!1,le={},ue=null,Kt=g({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),Zt=null,Qt=g({},["audio","video","img","source","image","track"]),Jt=null,en=g({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Fe="http://www.w3.org/1998/Math/MathML",Ge="http://www.w3.org/2000/svg",B="http://www.w3.org/1999/xhtml",fe=B,ht=!1,gt=null,br=g({},[Fe,Ge,B],St),tn=x(["mi","mo","mn","ms","mtext"]),Et=g({},tn),nn=x(["annotation-xml"]),Tt=g({},nn),Ar=g({},["title","style","font","a","script"]),Re=null,Rr=["application/xhtml+xml","text/html"],Sr="text/html",S=null,pe=null,wr=n.createElement("form"),rn=function(e){return e instanceof RegExp||e instanceof Function},_t=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(pe&&pe===e)return;(!e||typeof e!="object")&&(e={}),e=k(e),Re=Rr.indexOf(e.PARSER_MEDIA_TYPE)===-1?Sr:e.PARSER_MEDIA_TYPE,S=Re==="application/xhtml+xml"?St:Ne,b=V(e,"ALLOWED_TAGS",ct,{transform:S}),A=V(e,"ALLOWED_ATTR",lt,{transform:S}),gt=V(e,"ALLOWED_NAMESPACES",br,{transform:St}),Jt=V(e,"ADD_URI_SAFE_ATTR",en,{transform:S,base:en}),Zt=V(e,"ADD_DATA_URI_TAGS",Qt,{transform:S,base:Qt}),ue=V(e,"FORBID_CONTENTS",Kt,{transform:S}),Ae=V(e,"FORBID_TAGS",k({}),{transform:S}),$t=V(e,"FORBID_ATTR",k({}),{transform:S}),le=v(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?k(e.USE_PROFILES):e.USE_PROFILES:!1,jt=e.ALLOW_ARIA_ATTR!==!1,ut=e.ALLOW_DATA_ATTR!==!1,Wt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Yt=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Y=e.SAFE_FOR_TEMPLATES||!1,Z=e.SAFE_FOR_XML!==!1,Q=e.WHOLE_DOCUMENT||!1,ce=e.RETURN_DOM||!1,ke=e.RETURN_DOM_FRAGMENT||!1,ze=e.RETURN_TRUSTED_TYPE||!1,pt=e.FORCE_BODY||!1,Xt=e.SANITIZE_DOM!==!1,Vt=e.SANITIZE_NAMED_PROPS||!1,mt=e.KEEP_CONTENT!==!1,dt=e.IN_PLACE||!1,Bt=to(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:On,fe=typeof e.NAMESPACE=="string"?e.NAMESPACE:B,Et=Nt(e,"MATHML_TEXT_INTEGRATION_POINTS",()=>g({},tn)),Tt=Nt(e,"HTML_INTEGRATION_POINTS",()=>g({},nn));let o=Nt(e,"CUSTOM_ELEMENT_HANDLING",()=>ge(null));if(H=ge(null),v(o,"tagNameCheck")&&rn(o.tagNameCheck)&&(H.tagNameCheck=o.tagNameCheck),v(o,"attributeNameCheck")&&rn(o.attributeNameCheck)&&(H.attributeNameCheck=o.attributeNameCheck),v(o,"allowCustomizedBuiltInElements")&&typeof o.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=o.allowCustomizedBuiltInElements),L(H),Y&&(ut=!1),ke&&(ce=!0),le&&(b=g({},wn),A=ge(null),le.html===!0&&(g(b,Sn),g(A,xn)),le.svg===!0&&(g(b,wt),g(A,Ot),g(A,Xe)),le.svgFilters===!0&&(g(b,xt),g(A,Ot),g(A,Xe)),le.mathMl===!0&&(g(b,Lt),g(A,Ln),g(A,Xe))),W.tagCheck=null,W.attributeCheck=null,v(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?W.tagCheck=e.ADD_TAGS:Ee(e.ADD_TAGS)&&(b===ct&&(b=k(b)),g(b,e.ADD_TAGS,S))),v(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?W.attributeCheck=e.ADD_ATTR:Ee(e.ADD_ATTR)&&(A===lt&&(A=k(A)),g(A,e.ADD_ATTR,S))),v(e,"ADD_FORBID_CONTENTS")&&Ee(e.ADD_FORBID_CONTENTS)&&(ue===Kt&&(ue=k(ue)),g(ue,e.ADD_FORBID_CONTENTS,S)),mt&&(b["#text"]=!0),Q&&g(b,["html","head","body"]),b.table&&(g(b,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw ee('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ee('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let a=D;D=e.TRUSTED_TYPES_POLICY;try{K=ae("")}catch(u){throw D=a,u}}else e.TRUSTED_TYPES_POLICY===null?(D=void 0,K=""):(D===void 0&&(D=ur()),D&&typeof K=="string"&&(K=ae("")));x&&x(e),pe=e},on=g({},[...wt,...xt,...no]),sn=g({},[...Lt,...ro]),xr=function(e,o,a){return o.namespaceURI===B?e==="svg":o.namespaceURI===Fe?e==="svg"&&(a==="annotation-xml"||Et[a]):!!on[e]},Lr=function(e,o,a){return o.namespaceURI===B?e==="math":o.namespaceURI===Ge?e==="math"&&Tt[a]:!!sn[e]},Or=function(e,o,a){return o.namespaceURI===Ge&&!Tt[a]||o.namespaceURI===Fe&&!Et[a]?!1:!sn[e]&&(Ar[e]||!on[e])},Nr=function(e){let o=se(e);(!o||!o.tagName)&&(o={namespaceURI:fe,tagName:"template"});let a=Ne(e.tagName),u=Ne(o.tagName);return gt[e.namespaceURI]?e.namespaceURI===Ge?xr(a,o,u):e.namespaceURI===Fe?Lr(a,o,u):e.namespaceURI===B?Or(a,o,u):!!(Re==="application/xhtml+xml"&>[e.namespaceURI]):!1},X=function(e){xe(t.removed,{element:e});try{se(e).removeChild(e)}catch{if(rt(e),!se(e))throw ee("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},an=function(e,o,a){try{e.removeAttributeNode(o)}catch{try{e.removeAttribute(a)}catch{}}},He=function(e){Be(e);let o=oe(e);if(o){let u=[];te(o,m=>{xe(u,m)}),te(u,m=>{try{rt(m)}catch{}})}let a=ot(e);if(a)for(let u=a.length-1;u>=0;--u){let m=a[u],h=m&&m.name;typeof h=="string"&&an(e,m,h)}},J=function(e,o,a){if(!a)try{a=o.getAttributeNode(e)}catch{a=null}xe(t.removed,{attribute:a||null,from:o});try{a?o.removeAttributeNode(a):o.removeAttribute(e)}catch{try{o.removeAttribute(e)}catch{}}if(e==="is")if(ce||ke)try{X(o)}catch{}else try{o.setAttribute(e,"")}catch{}},Cr=function(e){let o=ot(e);if(o)for(let a=o.length-1;a>=0;--a){let u=o[a],m=u&&u.name;typeof m!="string"||A[S(m)]||an(e,u,m)}},Be=function(e){let o=[e];for(;o.length>0;){let a=o.pop();ye(a)===P.element&&Cr(a);let m=oe(a);if(m)for(let h=m.length-1;h>=0;--h)o.push(m[h])}},cn=function(e,o){return Z?e==="patchsrc"?!0:e==="for"&&o!=="label"&&o!=="output":!1},Ir=function(e){if(!Z)return;let o=[e];for(;o.length>0;){let a=o.pop(),u=ye(a);if(u===P.processingInstruction||u===P.comment&&O(Cn,a.data)){try{rt(a)}catch{}continue}if(u===P.element){let h=a,E=S(st(a));try{h.hasAttribute&&h.hasAttribute("patchsrc")&&h.removeAttribute("patchsrc"),h.hasAttribute&&h.hasAttribute("for")&&cn("for",E)&&h.removeAttribute("for")}catch{}}let m=oe(a);if(m)for(let h=m.length-1;h>=0;--h)o.push(m[h])}},ln=function(e){let o=null,a=null;if(pt)e="<remove></remove>"+e;else{let h=yn(e,/^[\r\n\t ]+/);a=h&&h[0]}Re==="application/xhtml+xml"&&fe===B&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let u=D?ae(e):e;if(fe===B)try{o=new G().parseFromString(u,Re)}catch{}if(!o||!o.documentElement){o=at.createDocument(fe,"template",null);try{o.documentElement.innerHTML=ht?K:u}catch{}}let m=o.body||o.documentElement;return e&&a&&m.insertBefore(n.createTextNode(a),m.childNodes[0]||null),fe===B?pr.call(o,Q?"html":"body")[0]:Q?o.documentElement:m},un=function(e){let o=Ue?Ue(e):e.ownerDocument;return Gt.call(o||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},$e=function(e){return e=Le(e,dr," "),e=Le(e,hr," "),e=Le(e,gr," "),e},yt=function(e){var o;e.normalize();let a=Ue?Ue(e):e.ownerDocument,u=Gt.call(a||e,e,d.SHOW_TEXT|d.SHOW_COMMENT|d.SHOW_CDATA_SECTION|d.SHOW_PROCESSING_INSTRUCTION,null),m=u.nextNode();for(;m;)m.data=$e(m.data),m=u.nextNode();let h=(o=e.querySelectorAll)===null||o===void 0?void 0:o.call(e,"template");h&&te(h,E=>{me(E.content)&&yt(E.content)})},je=function(e){let o=ie?ie(e):null;return typeof o!="string"||S(o)!=="form"?!1:typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||e.attributes!==ot(e)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function"||e.nodeType!==q(e)||e.childNodes!==oe(e)},me=function(e){if(!q||typeof e!="object"||e===null)return!1;try{return q(e)===P.documentFragment}catch{return!1}},Se=function(e){if(!q||typeof e!="object"||e===null)return!1;try{return typeof q(e)=="number"}catch{return!1}};function $(c,e,o){c.length!==0&&te(c,a=>{a.call(t,e,o,pe)})}let Dr=function(e,o){return!!(Z&&e.hasChildNodes()&&!Se(e.firstElementChild)&&O(Nn,e.textContent)&&O(Nn,e.innerHTML)||Z&&e.namespaceURI===B&&go[o]&&(Se(e.firstElementChild)||typeof e.textContent=="string"&&O(Eo[o],e.textContent))||e.nodeType===P.processingInstruction||Z&&e.nodeType===P.comment&&O(Cn,e.data))},We=function(e,o){if(e instanceof RegExp)return O(e,o);if(e instanceof Function){for(var a=arguments.length,u=new Array(a>2?a-2:0),m=2;m<a;m++)u[m-2]=arguments[m];return!!e(o,...u)}return!1},Ur=function(e,o,a){if(!Ae[o]&&hn(o)&&We(H.tagNameCheck,o))return!1;if(mt&&!ue[o]){let u=se(e),m=oe(e);if(m&&u){let h=m.length;for(let E=h-1;E>=0;--E){let R=e===a?ar(m[E],!0):m[E];u.insertBefore(R,cr(e))}}}return X(e),!0},fn=function(e,o,a,u){return e.length===0?o:o===a||o===u?k(o):o},pn=function(e,o){return e===o||se(e)!==null?!1:(dt&&Be(e),!0)},mn=function(e,o){if($(y.beforeSanitizeElements,e,null),pn(e,o))return!0;if(je(e))return X(e),!0;let a=S(st(e));if(b=fn(y.uponSanitizeElement,b,ct,ve),$(y.uponSanitizeElement,e,{tagName:a,allowedTags:b}),pn(e,o))return!0;if(Dr(e,a))return X(e),!0;if(Ae[a]||!(W.tagCheck instanceof Function&&W.tagCheck(a))&&!b[a]){let m=Ur(e,a,o);return m===!1&&$(y.afterSanitizeElements,e,null),m}if(ye(e)===P.element&&!Nr(e)||(a==="noscript"||a==="noembed"||a==="noframes")&&O(mo,e.innerHTML))return X(e),!0;if(Y&&e.nodeType===P.text){let m=$e(e.textContent);e.textContent!==m&&(xe(t.removed,{element:e.cloneNode()}),e.textContent=m)}return $(y.afterSanitizeElements,e,null),!1},dn=function(e,o,a){if($t[o]||cn(o,e)||Xt&&(o==="id"||o==="name")&&(a in n||a in wr))return!1;let u=A[o]||W.attributeCheck instanceof Function&&W.attributeCheck(o,e);return ut&&O(Er,o)||jt&&O(Tr,o)?!0:u?Jt[o]||O(Bt,Le(a,Ht,""))||(o==="src"||o==="xlink:href"||o==="href")&&e!=="script"&&bn(a,"data:")===0&&Zt[e]||Wt&&!O(_r,Le(a,Ht,""))?!0:!a:hn(e)&&We(H.tagNameCheck,e)&&We(H.attributeNameCheck,o,e)||o==="is"&&H.allowCustomizedBuiltInElements&&We(H.tagNameCheck,a)},Mr=g({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),hn=function(e){return!Mr[Ne(e)]&&O(yr,e)},vr=function(e,o,a,u){if(D&&typeof j=="object"&&typeof j.getAttributeType=="function"&&!a)switch(j.getAttributeType(e,o)){case"TrustedHTML":return ae(u);case"TrustedScriptURL":return lr(u)}return u},Pr=function(e,o,a,u){try{a?e.setAttributeNS(a,o,u):e.setAttribute(o,u),je(e)?X(e):_n(t.removed)}catch{J(o,e)}},gn=function(e){$(y.beforeSanitizeAttributes,e,null);let o=e.attributes;if(!o||je(e))return;A=fn(y.uponSanitizeAttribute,A,lt,Pe);let a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:A,forceKeepAttr:void 0},u=o.length,m=S(e.nodeName);for(;u--;){let h=o[u],E=h.name,R=h.namespaceURI,U=h.value,M=S(E),At=U,N=E==="value"?At:qr(At);if(a.attrName=M,a.attrValue=N,a.keepAttr=!0,a.forceKeepAttr=void 0,$(y.uponSanitizeAttribute,e,a),N=a.attrValue,Vt&&(M==="id"||M==="name")&&bn(N,qt)!==0&&(J(E,e,h),N=qt+N),Z&&O(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,N)){J(E,e,h);continue}if(M==="attributename"&&yn(N,"href")){J(E,e,h);continue}if(!a.forceKeepAttr){if(!a.keepAttr){J(E,e,h);continue}if(!Yt&&O(ho,N)){J(E,e,h);continue}if(Y&&(N=$e(N)),!dn(m,M,N)){J(E,e,h);continue}N=vr(m,M,R,N),N!==At&&Pr(e,E,R,N)}}$(y.afterSanitizeAttributes,e,null)},Ye=function(e){let o=null,a=un(e);for($(y.beforeSanitizeShadowDOM,e,null);o=a.nextNode();)if($(y.uponSanitizeShadowNode,o,null),mn(o,e),gn(o),me(o.content)&&Ye(o.content),ye(o)===P.element){let u=kt(o);me(u)&&(bt(u),Ye(u))}$(y.afterSanitizeShadowDOM,e,null)},bt=function(e){let o=[{node:e,shadow:null}];for(;o.length>0;){let a=o.pop();if(a.shadow){Ye(a.shadow);continue}let u=a.node,h=ye(u)===P.element,E=oe(u);if(E)for(let R=E.length-1;R>=0;--R)o.push({node:E[R],shadow:null});if(h){let R=ie?ie(u):null;if(typeof R=="string"&&S(R)==="template"){let U=u.content;me(U)&&o.push({node:U,shadow:null})}}if(h){let R=kt(u);me(R)&&o.push({node:null,shadow:R},{node:R,shadow:null})}}};return t.sanitize=function(c){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=null,a=null,u=null,m=null;if(ht=!c,ht&&(c="<!-->"),typeof c!="string"&&!Se(c)&&(c=eo(c),typeof c!="string"))throw ee("dirty is not a string, aborting");if(!t.isSupported)return c;ft?(b=ve,A=Pe):_t(e),(y.uponSanitizeElement.length>0||y.uponSanitizeAttribute.length>0)&&(b=k(b)),y.uponSanitizeAttribute.length>0&&(A=k(A)),t.removed=[];let h=dt&&typeof c!="string"&&Se(c);if(h){Ir(c);let U=st(c);if(typeof U=="string"){let M=S(U);if(!b[M]||Ae[M])throw He(c),ee("root node is forbidden and cannot be sanitized in-place")}if(je(c))throw He(c),ee("root node is clobbered and cannot be sanitized in-place");try{bt(c)}catch(M){throw He(c),M}}else if(Se(c))o=ln("<!---->"),a=o.ownerDocument.importNode(c,!0),a.nodeType===P.element&&a.nodeName==="BODY"||a.nodeName==="HTML"?o=a:o.appendChild(a),bt(a);else{if(!ce&&!Y&&!Q&&c.indexOf("<")===-1)return D&&ze?ae(c):c;if(o=ln(c),!o)return ce?null:ze?K:""}o&&pt&&X(o.firstChild);let E=h?c:o;try{let U=un(E);for(;u=U.nextNode();)mn(u,E),gn(u),me(u.content)&&Ye(u.content)}catch(U){throw h&&(He(c),te(t.removed,M=>{M.element&&Be(M.element)})),U}if(h)return te(t.removed,U=>{U.element&&Be(U.element)}),Y&&yt(c),c;if(ce){if(Y&&yt(o),ke)for(m=fr.call(o.ownerDocument);o.firstChild;)m.appendChild(o.firstChild);else m=o;return(A.shadowroot||A.shadowrootmode)&&(m=mr.call(s,m,!0)),m}let R=Q?o.outerHTML:o.innerHTML;return Q&&b["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&O(fo,o.ownerDocument.doctype.name)&&(R="<!DOCTYPE "+o.ownerDocument.doctype.name+`>
|
|
3
|
+
`+R),Y&&(R=$e(R)),D&&ze?ae(R):R},t.setConfig=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_t(c),ft=!0,ve=b,Pe=A},t.clearConfig=function(){pe=null,ft=!1,ve=null,Pe=null,D=it,K=""},t.isValidAttribute=function(c,e,o){pe||_t({});let a=S(c),u=S(e);return dn(a,u,o)},t.addHook=function(c,e){typeof e=="function"&&v(y,c)&&xe(y[c],e)},t.removeHook=function(c,e){if(v(y,c)){if(e!==void 0){let o=Xr(y[c],e);return o===-1?void 0:Vr(y[c],o,1)[0]}return _n(y[c])}},t.removeHooks=function(c){v(y,c)&&(y[c]=[])},t.removeAllHooks=function(){y=In()},t}var Pn=vn();var Ve=Pn(globalThis.window);var kn=/&/gi,zn=/&(?=[#a-z0-9])(?![a-z0-9]+=)/i;var Fn=/#$/,Gn=/^(?:application\/(?:[\w.-]+\+)?xml|image\/svg\+xml|text\/(?:html|xml))(?:\s*;\s*|$)/i;var Hn=/\P{ASCII}/u,Bn=/&#(x0*[\dA-F]{1,2}|0*\d{1,3});?/gi,$n=/(?:%[\dA-F]{2})+/gi,jn=/^((?:[^#%]|%(?!23))*)\?$/,qe=/^[a-z][\da-z+.-]*$/,Wn=/^(?:web\+[a-z]+|ext\+[a-z][\da-z.-]*)$/,ne=/^(?:java|vb)script$/i,Ce=/^(?:(?:java|vb)script|blob)$/i,Dt=/["'<>]|%(?:22|27|3C|3E)|&(?:apos|lt|gt|quot|#0*(?:34|39|60|62)|#x0*(?:22|27|3C|3E));/i,Yn=/^%[\dA-F]{2}$/i,Xn=/^(?:\/{2,}|\\|[a-z][a-z\d+\-.]*:[^/])/i;var Vn=[9,10,13,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,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 Ut=new Set(Vn),Mt=new Map([[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),bo=()=>{let r=new Map;for(let t=0;t<256;t++)!Ut.has(t)&&!Mt.has(t)&&r.set(t,`\\x${t.toString(16).padStart(2,"0").toUpperCase()}`);return r},vt=bo();var[Te,Ao,Ro,So,wo,xo]=["&","#","<",">",'"',"'"].map(r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`),Lo={[Te]:`${Te}amp;`,[Ro]:`${Te}lt;`,[So]:`${Te}gt;`,[wo]:`${Te}quot;`,[xo]:`${Te}${Ao}39;`},Qo=Array.from({length:256},(r,t)=>`%${t.toString(16).padStart(2,"0").toUpperCase()}`),Qn=globalThis.process?.versions?.node!==void 0,Jn=`[${[...vt.values()].join("")}]`,Oo=new RegExp(Jn),No=new RegExp(Jn,"g"),Co=new Uint8Array(65536),Jo=new TextEncoder,Io=new TextDecoder("utf-8",{fatal:!0}),C=(r,t=!1)=>{if(!T(r))return null;let n=Hn.test(r)?r.normalize("NFKC"):r;return t?n.trim().toLowerCase().replace(/:$/,""):n},z=(r,t,n=!1)=>{if(!T(r)||r==="")return null;let s=r,i=t&&T(t)?t:"";if(n&&(s=C(s),i&&(i=C(i))),typeof URL.parse=="function")return i?URL.parse(s,i):URL.parse(s);try{return i?new URL(s,i):new URL(s)}catch{return null}},er=r=>T(r)?r.replace(/:$/,"").split("+"):[];var tr=r=>{if(!T(r))return r;let t=Yn.test(r)?r.toUpperCase():r;return Lo[t]??r},re=r=>{let t=T(r)?r:String(r);return t.length>64?`${t.slice(0,64)}...`:t},nr=r=>T(r)?r.replace(Fn,"").replace(jn,"$1"):r,Do=(r,t)=>{let n=/^x/i.test(t)?Number.parseInt(t.slice(1),16):Number.parseInt(t,10);if(!Number.isInteger(n)||n<0||n>=256)return r;if(vt.has(n))return"";if(Ut.has(n))return String.fromCharCode(n);let s=Mt.get(n);return String.fromCodePoint(s)},rr=(r,t=0)=>{if(!T(r))throw new TypeError(`Expected String but got ${de(r)}.`);if(!Number.isInteger(t))throw new TypeError(`Expected Number but got ${de(t)}.`);let n;try{n=decodeURIComponent(r)}catch{n=r.replace($n,i=>{try{return decodeURIComponent(i)}catch{return i}})}n=n.replace(No,"");let s=0;for(;s+t<16;s++){let i=n;if(n=n.replace(kn,"&").replace(Bn,Do),n===i)break}if(s+t>=16&&/&#/.test(n))throw new Error("Character references nested too deeply.");return n},Qe=(r,t="",n="")=>{if(!T(r))return{mediaType:"",mediaTypes:[],data:"",isBase64:!1};let s=r.indexOf(",");if(s===-1)return{mediaType:r,mediaTypes:r.split(";"),data:"",isBase64:!1};let i=r.substring(0,s),l=r.substring(s+1),f=t===""&&n===""?l:l+t+n,p=i.split(";"),d=p.at(-1),_=d!==void 0&&d.length===6&&d.toLowerCase()==="base64";return{mediaType:i,mediaTypes:p,data:f,isBase64:_}},or=r=>{if(!T(r))throw new TypeError(`Expected String but got ${de(r)}.`);let t,n=r;try{t=atob(r)}catch{n=r.replace(/\s/g,"");try{t=atob(n)}catch{throw new Error(`Invalid base64 data: ${re(r)}`)}}let s;if(Qn&&globalThis.Buffer)s=globalThis.Buffer.from(t,"latin1");else{let i=t.length;i>65536?s=new Uint8Array(i):s=Co.subarray(0,i);for(let l=0;l<i;l++)s[l]=t.charCodeAt(l)}try{let i=Io.decode(s);return Oo.test(i)?n:i}catch{return n}},Je=r=>{if(Qn&&globalThis.Buffer)return globalThis.Buffer.from(r).toString("base64");let t=new Uint8Array(r);if(typeof t.toBase64=="function")return t.toBase64();let n=[];for(let s=0;s<t.length;s+=8192)n.push(String.fromCharCode(...t.subarray(s,s+8192)));return btoa(n.join(""))};var De=class{constructor(t,n=we){this.domPurify=t,this.nest=0,this.recurse=new Set,this.restrictScheme=!1,this.schemeMap=new Map([["blob",!1],["data",!1],["file",!1],["javascript",!1],["vbscript",!1]]),this.#e(n)}#e(t){let{allowRelative:n,debug:s,allow:i,deny:l,only:f}=t;if(this.allowRelative=!!n,this.debug=!!s,Array.isArray(f)&&f.length){this.restrictScheme=!0;for(let p of f)this.#t(p)}else{if(Array.isArray(i)&&i.length)for(let p of i)this.#t(p);if(Array.isArray(l)&&l.length)for(let p of l){let d=C(p,!0);d&&this.schemeMap.set(d,!1)}}}#t(t){let n=C(t,!0);return!n||Ce.test(n)||!qe.test(n)||n.includes("+")&&n.split("+").some(i=>ne.test(i))?!1:(this.schemeMap.set(n,!0),!0)}enter(t){return this.recurse.has(t)?(this.debug&&he(`Circular Data URL detected and skipped: ${re(t)}`),!1):(this.nest++,this.recurse.add(t),!0)}leave(t){this.nest--,this.recurse.delete(t)}},et=class{#e;constructor(t=we){this.#e=t}#t(t,n){if(n.nest>16)throw new Error("Data URLs nested too deeply.");let s=z(t,null,!0);if(!s){if(n.allowRelative&&!Xn.test(t)){let l=z(t,Rt);if(l){let{protocol:f,hostname:p,pathname:d,search:_,hash:G}=l;if(f==="http:"&&p==="dummy.local")return this.#r(`${d}${_}${G}`)}}return null}let i=C(s.protocol,!0);if(n.restrictScheme&&!n.schemeMap.has(i))return null;if(i.includes("+")){let l=i.split("+");if(n.schemeMap.get(i)===!1||l.some(f=>n.schemeMap.get(f)===!1))return null}else if(n.schemeMap.get(i)===!1)return null;return i==="data"?this.#n(s,n):this.#r(s.href)}#n(t,n){let{mediaType:s,mediaTypes:i,data:l,isBase64:f}=Qe(t.pathname,t.search,t.hash),p=l;if(f)try{p=or(l)}catch(d){return n.debug&&he("Failed to parse base64 data.",d),null}try{let d=rr(p).trim(),_=z(d,Rt);if(!_||er(_.protocol).some(j=>Ce.test(j)))return null}catch(d){return n.debug&&he("Failed to parse inner data URL protocol.",d),null}return(!s||Gn.test(s))&&(p=this.#s(p,n)),p?(f&&p!==l&&i.pop(),`data:${i.join(";")},${p}`):null}#s(t,n){let s="";try{s=decodeURIComponent(t)}catch{s=t}let i=(f,p)=>this.#o(f,p,n),l="";try{n.domPurify.addHook("uponSanitizeAttribute",i),l=n.domPurify.sanitize(s)}finally{n.domPurify.removeHook("uponSanitizeAttribute",i)}if(!l)return null;try{return encodeURI(nr(l))}catch{return null}}#o(t,n,s){if(!n.attrValue||!/^\s*data:/i.test(n.attrValue))return;let i=z(n.attrValue,null,!0);if(!i||i.protocol!=="data:")return;let l=n.attrValue;if(!s.enter(l)){n.attrValue="";return}try{let f=this.#t(l,s);n.attrValue=f||""}finally{s.leave(l)}}#r(t){let n=t.length,s=n,i=Dt.exec(t);if(i&&(s=i.index),t.indexOf("&")>-1){let f=zn.exec(t);if(f){let p=f.index;p<s&&(s=p)}}if(s===n)return t;let l=t.charCodeAt(s-1);return(l===63||l===38)&&s--,t.substring(0,s)}sanitize(t,n=this.#e){if(!t||!T(t))return null;let{deny:s,maxLength:i,only:l,allowRelative:f}=n;if(Number.isInteger(i)&&t.length>i){let _=`URL length ${t.length} exceeds max length ${i}.`;throw new RangeError(_)}if(!(Array.isArray(s)&&s.length>0||Array.isArray(l)&&l.length>0||f)&&/^https?:\/\//.test(t)&&!Dt.test(t)&&!t.includes("data:")){let _=z(t,null,!0);return _&&n.schemes.has(_.protocol.replace(/:$/,""))?_.href.replace(/%26/g,tr):null}let d=new De(Ve,n);return this.#t(t,d)}async sanitizeBuffer(t,n,s=this.#e){if(!(t instanceof ArrayBuffer))return null;let i=Je(t),f=`data:${n?`${n};base64`:"base64"},${i}`;if(Number.isInteger(s.maxLength)&&f.length>s.maxLength)throw new RangeError(`URL length ${f.length} exceeds max length ${s.maxLength}.`);let p=new De(Ve,s);if(!p.schemeMap.get("data"))return null;let d=z(f);return d?this.#n(d,p):null}async sanitizeDataURL(t,n=this.#e){if(!t||!T(t))return null;let{maxLength:s}=n;if(Number.isInteger(s)&&t.length>s)throw new RangeError(`URL length ${t.length} exceeds max length ${s}.`);let i=z(t);if(!i)return null;let l=C(i.protocol,!0);if(l!=="data")return null;let f=new De(Ve,n);return f.schemeMap.get(l)?this.#n(i,f):null}};var sr=["aaa","aaas","about","acap","acct","acd","acr","adiumxtra","adt","aet","afp","afs","agtp","aim","amss","android","appdata","apt","ar","ari","ark","ars","at","attachment","aw","barion","beshare","bitcoin","bitcoincash","bl","blob","bluetooth","bolo","brid","browserext","cabal","caip","calculator","callto","cap","cast","casts","chrome","chrome-extension","cid","cm","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","ez","facetime","feed","feedready","fido","file","finger","first-run-pen-experience","fish","fm","ftp","fuchsia-pkg","gcx","gdsi","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","interaction","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","mdoc","mdoc-openid4vp","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","musik","mvn","mvrp","mvrps","news","nfs","ni","nih","nntp","nostr","notes","npamp","num","ocf","oid","onenote","onenote-cmd","opaquelocktoken","openid","openpgp4fpr","otpauth","palm","paparazzi","payto","pkcs11","pkg","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","sss","starknet","steam","stun","stuns","submit","svn","swh","swid","swidpath","tag","taler","teamspeak","teapot","teapots","tel","teliaeid","telnet","tftp","things","thismessage","tip","tn3270","tool","tttps","turn","turns","tv","udp","unreal","upn","urn","ust","ut2004","uuaid","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 tt=class{#e=new Set(sr);get(){return[...this.#e]}getScheme(t){if(!T(t))return null;let n=this.parse(t);return n?this.normalize(n.protocol,!0):null}has(t){let n=this.normalize(t,!0);return n?this.#e.has(n):!1}normalize(t,n=!1){return C(t,n)}normalizeSchemes(t){if(Array.isArray(t)){let n=[];for(let s of t){let i=C(s,!0);i&&n.push(i)}return n}return[]}parse(t,n,s=!1){return z(t,n,s)}verifyURI(t,n){if(!T(t))return!1;let s=this.parse(t);return s?this.verifyScheme(s.protocol,n,!0):!1}verifyScheme(t,n,s=!1){let i=this.normalize(t,!0);if(!i)return!1;let l=n||this.#e;if(!i.includes("+"))return ne.test(i)?!1:l.has(i);let f=i.split("+");return f.some(d=>ne.test(d))?!1:l.has(i)?!0:s&&Wn.test(i)||f.every(d=>l.has(d))}};var vo=Object.freeze(["href","origin","protocol","username","password","host","hostname","port","pathname","search","hash"]),Po=async(r,t)=>{let n=r.body.getReader(),s=[];try{let i=0;for(;i<=t;){let{done:p,value:d}=await n.read();if(p)break;if(i+=d.byteLength,i>t)throw await n.cancel("Size limit exceeded"),new DOMException(`Payload (${i} bytes) exceeds max (${t} bytes).`,"NotReadableError");s.push(d)}let l=new Uint8Array(i),f=0;for(let p of s)l.set(p,f),f+=p.byteLength;return l.buffer}finally{n.releaseLock()}},ir=async(r,t)=>{let n=16777216;Number.isInteger(t)&&t>0&&(n=t);let s=await fetch(r);if(!s.ok){let d=`Failed to fetch ${re(r)}`;throw Number.isInteger(s.status)&&(s.statusText?d+=`: ${s.status} ${s.statusText}`:d+=`: ${s.status}`),new Error(d)}let i=s.headers.get("content-length");if(i){let p=Number.parseInt(i,10);if(Number.isInteger(p)&&p>n)throw new DOMException(`Payload (${p} bytes) exceeds max (${n} bytes).`,"NotReadableError")}let l=s.headers.get("content-type")||"",f;if(s.body)f=await Po(s,n);else{let p=await s.blob();if(p.size>n)throw new DOMException(`Payload (${p.size} bytes) exceeds max (${n} bytes).`,"NotReadableError");f=await p.arrayBuffer()}return{buffer:f,mimeType:l}},nt=class extends tt{#e;#t;#n;constructor(){super(),this.#e=new Set(super.get()),this.#t={...we,schemes:this.#e},this.#n=new et(this.#t)}#s(t){return!T(t)||Ce.test(t)||t.includes("+")&&t.split("+").some(s=>ne.test(s))?!1:qe.test(t)}#o(t,n={}){if(!T(t)||t==="")return{isValid:!1};let s={...this.#t,...n,allow:this.normalizeSchemes(n.allow),deny:this.normalizeSchemes(n.deny),only:this.normalizeSchemes(n.only),schemes:this.#e},i=this.getScheme(t);return i===null&&!s.allowRelative?{isValid:!1}:{options:s,scheme:i}}#r(t){let n={input:t,href:null,valid:!1};if(!T(t))return n.reason=`Invalid URL input: ${re(t)}`,n;if(t==="")return n.reason="Invalid URL input: (empty string)",n;let s,i=null;try{s=this.#n.sanitize(t,{...this.#t,allow:["data"],allowRelative:!0,schemes:this.#e}),s||(i="Sanitization failed (blocked by allowed schemes or rules).")}catch(l){i=l.message}if(s){let l=z(s);if(n.valid=!0,l){if(C(l.protocol,!0)==="data"){let{mediaTypes:p,data:d,isBase64:_}=Qe(l.pathname,l.search,l.hash);_&&p.pop(),n.data={mime:p.join(";"),base64:_,data:d}}else n.data=null;for(let p of vo){let d=l[p];T(d)&&(n[p]=d)}}else n.valid=!1,n.relative=!0,n.href=s,n.reason="Invalid as an absolute URL, but valid as a relative URL."}else n.reason=i;return n}get(){return[...this.#e]}has(t){let n=C(t,!0);return n?this.#e.has(n):!1}add(t){if(!T(t))throw new TypeError(`Expected String but got ${de(t)}.`);let n=C(t,!0);if(!this.#s(n))throw new Error(`Invalid scheme: ${t}`);return this.#e.add(n),[...this.#e]}remove(t){if(!T(t))return!1;let n=C(t,!0);return this.#e.delete(n)}reset(){this.#e.clear();for(let t of super.get())this.#e.add(t)}async sanitizeURL(t,n){let{isValid:s,options:i,scheme:l}=this.#o(t,n);if(s===!1)return null;if(l==="blob"){let{allow:f,deny:p,only:d}=i,_=null;try{if(f.includes("blob")&&!p.includes("blob")||d.includes("blob")){let G=null,j="";try{let I=await ir(t,i.maxBlobSize);G=I.buffer,j=I.mimeType}catch(I){i.debug&&he(`Failed to fetch and convert blob URL: ${re(t)}`,I)}G&&(d.length?d.includes("data")||(i.only=[...d,"data"]):(f.includes("data")||(i.allow=[...f,"data"]),i.deny=p.filter(I=>I!=="data")),_=await this.#n.sanitizeBuffer(G,j,i))}}finally{i.revokeObjectURL&&URL.revokeObjectURL(t)}return _}else if(l==="data")return this.#n.sanitizeDataURL(t,i);return this.#n.sanitize(t,i)}sanitizeURLSync(t,n){let{isValid:s,options:i,scheme:l}=this.#o(t,n);return s===!1?null:l==="blob"?(i.revokeObjectURL&&URL.revokeObjectURL(t),null):this.#n.sanitize(t,i)}async inspectURL(t){if(T(t)){let n=z(t,null,!0);if(n?.protocol==="blob:")try{let{buffer:s,mimeType:i}=await ir(n.href),l=Je(s),f=`data:${i?`${i};base64`:"base64"},${l}`,p=this.#r(f);return p.input=t,p}catch(s){return{input:t,valid:!1,reason:s.message}}}return this.#r(t)}isValidURI(t){return super.verifyURI(t,this.#e)}};var _e=new nt,bs=async(r,t)=>_e.sanitizeURL(r,t),As=(r,t)=>_e.sanitizeURLSync(r,t),Rs=async r=>_e.inspectURL(r),Ss=r=>_e.isValidURI(r),ws=r=>_e.isValidURI(r),xs=_e;export{nt as URLSanitizer,xs as default,Rs as inspectURL,ws as isURISync,Ss as isValidURI,bs as sanitizeURL,As as sanitizeURLSync};
|
|
4
4
|
/*!
|
|
5
5
|
* URL Sanitizer
|
|
6
6
|
*
|