url-sanitizer 5.2.3 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- 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 _n(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 Hr(r){if(Array.isArray(r))return r}function Br(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 $r(){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 jr(r,t){return Hr(r)||Br(r,t)||Wr(r,t)||$r()}function Wr(r,t){if(r){if(typeof r=="string")return _n(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)?_n(r,t):void 0}}var Mn=Object.entries,yn=Object.setPrototypeOf,Yr=Object.isFrozen,Xr=Object.getPrototypeOf,Vr=Object.getOwnPropertyDescriptor,x=Object.freeze,L=Object.seal,ge=Object.create,vn=typeof Reflect<"u"&&Reflect,Ct=vn.apply,It=vn.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),qr=w(Array.prototype.lastIndexOf),bn=w(Array.prototype.pop),xe=w(Array.prototype.push),Kr=w(Array.prototype.splice),Ee=Array.isArray,Ne=w(String.prototype.toLowerCase),St=w(String.prototype.toString),An=w(String.prototype.match),Le=w(String.prototype.replace),Rn=w(String.prototype.indexOf),Zr=w(String.prototype.trim),Qr=w(Number.prototype.toString),Jr=w(Boolean.prototype.toString),Sn=typeof BigInt>"u"?null:w(BigInt.prototype.toString),wn=typeof Symbol>"u"?null:w(Symbol.prototype.toString),v=w(Object.prototype.hasOwnProperty),Oe=w(Object.prototype.toString),O=w(RegExp.prototype.test),ee=eo(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 eo(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(yn&&yn(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&&(Yr(t)||(t[s]=l),i=l)}r[i]=!0}return r}function to(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 Mn(r)){var n=jr(s,2);let i=n[0],l=n[1];v(r,i)&&(Ee(l)?t[i]=to(l):l&&typeof l=="object"&&l.constructor===Object?t[i]=k(l):t[i]=l)}return t}function no(r){switch(typeof r){case"string":return r;case"number":return Qr(r);case"boolean":return Jr(r);case"bigint":return Sn?Sn(r):"0";case"symbol":return wn?wn(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=Vr(r,t);if(s){if(s.get)return w(s.get);if(typeof s.value=="function")return w(s.value)}r=Xr(r)}function n(){return null}return n}function ro(r){try{return O(r,""),!0}catch{return!1}}var xn=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"]),oo=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"]),so=x(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ln=x(["#text"]),On=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"]),Nn=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"]),io=L(/{{[\w\W]*|^[\w\W]*}}/g),ao=L(/<%[\w\W]*|^[\w\W]*%>/g),co=L(/\${[\w\W]*/g),lo=L(/^data-[\-\w.\u00B7-\uFFFF]+$/),uo=L(/^aria-[\-\w]+$/),Cn=L(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),fo=L(/^(?:\w+script|data):/i),po=L(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),mo=L(/^html$/i),ho=L(/^[a-z][.\w]*(-[.\w]+)+$/i),In=L(/<[/\w!]/g),Dn=L(/<[/\w]/g),go=L(/<\/no(script|embed|frames)/i),Eo=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},Pn=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],To=x(g({},Pn)),_o=(function(){let r={};return te(Pn,t=>{r[t]=L(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),x(r)})(),yo=function(){return typeof window>"u"?null:window},bo=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}},Un=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 kn(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:yo(),t=c=>kn(c);if(t.version="3.4.15",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,N=p.prototype,lr=F(N,"cloneNode"),rt=F(N,"remove"),kt=F(N,"removeAttributeNode"),ur=F(N,"nextSibling"),oe=F(N,"childNodes"),se=F(N,"parentNode"),zt=F(N,"shadowRoot"),ot=F(N,"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,Ft=!1,be=0,Gt=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){Gt(),be++;try{return D.createHTML(e)}finally{be--}},fr=function(e){Gt(),be++;try{return D.createScriptURL(e)}finally{be--}},pr=function(){return Ft||(it=bo(j,i),Ft=!0),it},Me=n,at=Me.implementation,Ht=Me.createNodeIterator,mr=Me.createDocumentFragment,dr=Me.getElementsByTagName,hr=s.importNode,y=Un();t.isSupported=typeof Mn=="function"&&typeof se=="function"&&at&&at.createHTMLDocument!==void 0;let gr=io,Er=ao,Tr=co,_r=lo,yr=uo,br=fo,Bt=po,Ar=ho,$t=Cn,b=null,ct=g({},[...xn,...wt,...xt,...Lt,...Ln]),A=null,lt=g({},[...On,...Ot,...Nn,...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,jt=null,W=Object.seal(ge(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Wt=!0,ut=!0,Yt=!1,Xt=!0,Y=!1,Z=!0,Q=!1,ft=!1,ve=null,Pe=null,pt=!1,ce=!1,ke=!1,ze=!1,Vt=!0,qt=!1,Kt="user-content-",mt=!0,dt=!1,le={},ue=null,Zt=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"]),Qt=null,Jt=g({},["audio","video","img","source","image","track"]),en=null,tn=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,Rr=g({},[Fe,Ge,B],St),nn=x(["mi","mo","mn","ms","mtext"]),Et=g({},nn),rn=x(["annotation-xml"]),Tt=g({},rn),Sr=g({},["title","style","font","a","script"]),Re=null,wr=["application/xhtml+xml","text/html"],xr="text/html",S=null,pe=null,Lr=n.createElement("form"),on=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=wr.indexOf(e.PARSER_MEDIA_TYPE)===-1?xr: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",Rr,{transform:St}),en=V(e,"ADD_URI_SAFE_ATTR",tn,{transform:S,base:tn}),Qt=V(e,"ADD_DATA_URI_TAGS",Jt,{transform:S,base:Jt}),ue=V(e,"FORBID_CONTENTS",Zt,{transform:S}),Ae=V(e,"FORBID_TAGS",k({}),{transform:S}),jt=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,Wt=e.ALLOW_ARIA_ATTR!==!1,ut=e.ALLOW_DATA_ATTR!==!1,Yt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Xt=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,Vt=e.SANITIZE_DOM!==!1,qt=e.SANITIZE_NAMED_PROPS||!1,mt=e.KEEP_CONTENT!==!1,dt=e.IN_PLACE||!1,$t=ro(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Cn,fe=typeof e.NAMESPACE=="string"?e.NAMESPACE:B,Et=Nt(e,"MATHML_TEXT_INTEGRATION_POINTS",()=>g({},nn)),Tt=Nt(e,"HTML_INTEGRATION_POINTS",()=>g({},rn));let o=Nt(e,"CUSTOM_ELEMENT_HANDLING",()=>ge(null));if(H=ge(null),v(o,"tagNameCheck")&&on(o.tagNameCheck)&&(H.tagNameCheck=o.tagNameCheck),v(o,"attributeNameCheck")&&on(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({},Ln),A=ge(null),le.html===!0&&(g(b,xn),g(A,On)),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,Nn),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===Zt&&(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=pr()),D&&typeof K=="string"&&(K=ae("")));x&&x(e),pe=e},sn=g({},[...wt,...xt,...oo]),an=g({},[...Lt,...so]),Or=function(e,o,a){return o.namespaceURI===B?e==="svg":o.namespaceURI===Fe?e==="svg"&&(a==="annotation-xml"||Et[a]):!!sn[e]},Nr=function(e,o,a){return o.namespaceURI===B?e==="math":o.namespaceURI===Ge?e==="math"&&Tt[a]:!!an[e]},Cr=function(e,o,a){return o.namespaceURI===Ge&&!Tt[a]||o.namespaceURI===Fe&&!Et[a]?!1:!an[e]&&(Sr[e]||!sn[e])},Ir=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?Or(a,o,u):e.namespaceURI===Fe?Nr(a,o,u):e.namespaceURI===B?Cr(a,o,u):!!(Re==="application/xhtml+xml"&&gt[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")}},cn=function(e,o,a){try{kt(e,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"&&cn(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?kt(o,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{}},Dr=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)]||cn(e,u,m)}},Be=function(e){let o=[e];for(;o.length>0;){let a=o.pop();ye(a)===P.element&&Dr(a);let m=oe(a);if(m)for(let h=m.length-1;h>=0;--h)o.push(m[h])}},ln=function(e,o){return Z?e==="patchsrc"?!0:e==="for"&&o!=="label"&&o!=="output":!1},Ur=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(Dn,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")&&ln("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])}},un=function(e){let o=null,a=null;if(pt)e="<remove></remove>"+e;else{let h=An(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?dr.call(o,Q?"html":"body")[0]:Q?o.documentElement:m},fn=function(e){let o=Ue?Ue(e):e.ownerDocument;return Ht.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,gr," "),e=Le(e,Er," "),e=Le(e,Tr," "),e},yt=function(e){var o;e.normalize();let a=Ue?Ue(e):e.ownerDocument,u=Ht.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.removeAttributeNode!="function"||typeof e.getAttributeNode!="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 Mr=function(e,o){return!!(Z&&e.hasChildNodes()&&!Se(e.firstElementChild)&&O(In,e.textContent)&&O(In,e.innerHTML)||Z&&e.namespaceURI===B&&To[o]&&(Se(e.firstElementChild)||typeof e.textContent=="string"&&O(_o[o],e.textContent))||e.nodeType===P.processingInstruction||Z&&e.nodeType===P.comment&&O(Dn,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},vr=function(e,o,a){if(!Ae[o]&&gn(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?lr(m[E],!0):m[E];u.insertBefore(R,ur(e))}}}return X(e),!0},pn=function(e,o,a,u){return e.length===0?o:o===a||o===u?k(o):o},mn=function(e,o){return e===o||se(e)!==null?!1:(dt&&Be(e),!0)},dn=function(e,o){if($(y.beforeSanitizeElements,e,null),mn(e,o))return!0;if(je(e))return X(e),!0;let a=S(st(e));if(b=pn(y.uponSanitizeElement,b,ct,ve),$(y.uponSanitizeElement,e,{tagName:a,allowedTags:b}),mn(e,o))return!0;if(Mr(e,a))return X(e),!0;if(Ae[a]||!(W.tagCheck instanceof Function&&W.tagCheck(a))&&!b[a]){let m=vr(e,a,o);return m===!1&&$(y.afterSanitizeElements,e,null),m}if(ye(e)===P.element&&!Ir(e)||(a==="noscript"||a==="noembed"||a==="noframes")&&O(go,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},hn=function(e,o,a){if(jt[o]||ln(o,e)||Vt&&(o==="id"||o==="name")&&(a in n||a in Lr))return!1;let u=A[o]||W.attributeCheck instanceof Function&&W.attributeCheck(o,e);return ut&&O(_r,o)||Wt&&O(yr,o)?!0:u?en[o]||O($t,Le(a,Bt,""))||(o==="src"||o==="xlink:href"||o==="href")&&e!=="script"&&Rn(a,"data:")===0&&Qt[e]||Yt&&!O(br,Le(a,Bt,""))?!0:!a:gn(e)&&We(H.tagNameCheck,e)&&We(H.attributeNameCheck,o,e)||o==="is"&&H.allowCustomizedBuiltInElements&&We(H.tagNameCheck,a)},Pr=g({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),gn=function(e){return!Pr[Ne(e)]&&O(Ar,e)},kr=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 fr(u)}return u},zr=function(e,o,a,u){try{return a?e.setAttributeNS(a,o,u):e.setAttribute(o,u),je(e)?(X(e),!1):!0}catch{return J(o,e),!1}},En=function(e){$(y.beforeSanitizeAttributes,e,null);let o=e.attributes;if(!o||je(e))return;A=pn(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,C=E==="value"?At:Zr(At),Tn=!1;if(a.attrName=M,a.attrValue=C,a.keepAttr=!0,a.forceKeepAttr=void 0,$(y.uponSanitizeAttribute,e,a),C=a.attrValue,qt&&(M==="id"||M==="name")&&Rn(C,Kt)!==0&&(J(E,e,h),C=Kt+C,Tn=!0),Z&&O(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,C)){J(E,e,h);continue}if(M==="attributename"&&An(C,"href")){J(E,e,h);continue}if(!a.forceKeepAttr){if(!a.keepAttr){J(E,e,h);continue}if(!Xt&&O(Eo,C)){J(E,e,h);continue}if(Y&&(C=$e(C)),!hn(m,M,C)){J(E,e,h);continue}C=kr(m,M,R,C),C!==At&&zr(e,E,R,C)&&Tn&&bn(t.removed)}}$(y.afterSanitizeAttributes,e,null)},Ye=function(e){let o=null,a=fn(e);for($(y.beforeSanitizeShadowDOM,e,null);o=a.nextNode();)if($(y.uponSanitizeShadowNode,o,null),dn(o,e),En(o),me(o.content)&&Ye(o.content),ye(o)===P.element){let u=zt(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=zt(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=no(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){Ur(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=un("<!---->"),a=o.ownerDocument.importNode(c,!0),a.nodeType===P.element&&a.nodeName==="BODY"||a.nodeName==="HTML"?o=a:o.appendChild(a),bt(o);else{if(!ce&&!Y&&!Q&&c.indexOf("<")===-1)return D&&ze?ae(c):c;if(o=un(c),!o)return ce?null:ze?K:""}o&&pt&&X(o.firstChild);let E=h?c:o;try{let U=fn(E);for(;u=U.nextNode();)dn(u,E),En(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=mr.call(o.ownerDocument);o.firstChild;)m.appendChild(o.firstChild);else m=o;return(A.shadowroot||A.shadowrootmode)&&(m=hr.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(mo,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 hn(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=qr(y[c],e);return o===-1?void 0:Kr(y[c],o,1)[0]}return bn(y[c])}},t.removeHooks=function(c){v(y,c)&&(y[c]=[])},t.removeAllHooks=function(){y=Un()},t}var zn=kn();var Ve=zn(globalThis.window);var Fn=/&amp;/gi,Gn=/&(?=[#a-z0-9])(?![a-z0-9]+=)/i;var Hn=/#$/,Bn=/^(?:application\/(?:[\w.-]+\+)?xml|image\/svg\+xml|text\/(?:html|xml))(?:\s*;\s*|$)/i;var $n=/\P{ASCII}/u,jn=/&#(x0*[\dA-F]{1,2}|0*\d{1,3});?/gi,Wn=/(?:%[\dA-F]{2})+/gi,Yn=/^((?:[^#%]|%(?!23))*)\?$/,qe=/^[a-z][\da-z+.-]*$/,Xn=/^(?: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,Vn=/^%[\dA-F]{2}$/i,qn=/^(?:\/{2,}|\\|[a-z][a-z\d+\-.]*:[^/])/i;var Kn=[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(Kn),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]]),Ro=()=>{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=Ro();var[Te,So,wo,xo,Lo,Oo]=["&","#","<",">",'"',"'"].map(r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`),No={[Te]:`${Te}amp;`,[wo]:`${Te}lt;`,[xo]:`${Te}gt;`,[Lo]:`${Te}quot;`,[Oo]:`${Te}${So}39;`},ts=Array.from({length:256},(r,t)=>`%${t.toString(16).padStart(2,"0").toUpperCase()}`),er=globalThis.process?.versions?.node!==void 0,tr=`[${[...vt.values()].join("")}]`,Co=new RegExp(tr),Io=new RegExp(tr,"g"),Do=new Uint8Array(65536),ns=new TextEncoder,Uo=new TextDecoder("utf-8",{fatal:!0}),I=(r,t=!1)=>{if(!T(r))return null;let n=$n.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=I(s),i&&(i=I(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}},nr=r=>T(r)?r.replace(/:$/,"").split("+"):[];var rr=r=>{if(!T(r))return r;let t=Vn.test(r)?r.toUpperCase():r;return No[t]??r},re=r=>{let t=T(r)?r:String(r);return t.length>64?`${t.slice(0,64)}...`:t},or=r=>T(r)?r.replace(Hn,"").replace(Yn,"$1"):r,Mo=(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)},sr=(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(Wn,i=>{try{return decodeURIComponent(i)}catch{return i}})}n=n.replace(Io,"");let s=0;for(;s+t<16;s++){let i=n;if(n=n.replace(Fn,"&").replace(jn,Mo),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:_}},ir=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(er&&globalThis.Buffer)s=globalThis.Buffer.from(t,"latin1");else{let i=t.length;i>65536?s=new Uint8Array(i):s=Do.subarray(0,i);for(let l=0;l<i;l++)s[l]=t.charCodeAt(l)}try{let i=Uo.decode(s);return Co.test(i)?n:i}catch{return n}},Je=r=>{if(er&&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=I(p,!0);d&&this.schemeMap.set(d,!1)}}}#t(t){let n=I(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&&!qn.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=I(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=ir(l)}catch(d){return n.debug&&he("Failed to parse base64 data.",d),null}try{let d=sr(p).trim(),_=z(d,Rt);if(!_||nr(_.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||Bn.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(or(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=Gn.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,rr):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=I(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 ar=["aaa","aaas","about","acap","acct","acd","ace","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","seki","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","tii","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(ar);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 I(t,n)}normalizeSchemes(t){if(Array.isArray(t)){let n=[];for(let s of t){let i=I(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&&Xn.test(i)||f.every(d=>l.has(d))}};var ko=Object.freeze(["href","origin","protocol","username","password","host","hostname","port","pathname","search","hash"]),zo=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()}},cr=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 zo(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(I(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 ko){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=I(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=I(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=I(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 N=await cr(t,i.maxBlobSize);G=N.buffer,j=N.mimeType}catch(N){i.debug&&he(`Failed to fetch and convert blob URL: ${re(t)}`,N)}G&&(d.length?d.includes("data")||(i.only=[...d,"data"]):(f.includes("data")||(i.allow=[...f,"data"]),i.deny=p.filter(N=>N!=="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 cr(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,Ss=async(r,t)=>_e.sanitizeURL(r,t),ws=(r,t)=>_e.sanitizeURLSync(r,t),xs=async r=>_e.inspectURL(r),Ls=r=>_e.isValidURI(r),Os=r=>_e.isValidURI(r),Ns=_e;export{nt as URLSanitizer,Ns as default,xs as inspectURL,Os as isURISync,Ls as isValidURI,Ss as sanitizeURL,ws as sanitizeURLSync};
1
+ var xt="http://dummy.local",Le={allow:Object.freeze([]),deny:Object.freeze([]),only:Object.freeze([]),allowRelative:!1,debug:!1,revokeObjectURL:!1,maxBlobSize:16777216,maxLength:65536,schemes:new Set};var Ee=r=>Object.prototype.toString.call(r).slice(8,-1),R=r=>typeof r=="string"||r instanceof String,ne=(r,t)=>{console.warn(`[URLSanitizer Debug] ${r}`,t)};function Hr(r,t){this.v=r,this.k=t}function bn(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 $r(r){if(Array.isArray(r))return r}function jr(r,t){var n=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(n!=null){var s,i,a,f,m=[],p=!0,g=!1;try{if(a=(n=n.call(r)).next,t===0){if(Object(n)!==n)return;p=!1}else for(;!(p=(s=a.call(n)).done)&&(m.push(s.value),m.length!==t);p=!0);}catch(T){g=!0,i=T}finally{try{if(!p&&n.return!=null&&(f=n.return(),Object(f)!==f))return}finally{if(g)throw i}}return m}}function Wr(){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 Yr(r,t){return $r(r)||jr(r,t)||Xr(r,t)||Wr()}function Xr(r,t){if(r){if(typeof r=="string")return bn(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)?bn(r,t):void 0}}function qe(r){var t,n;function s(a,f){try{var m=r[a](f),p=m.value,g=p instanceof Hr;Promise.resolve(g?p.v:p).then(function(T){if(g){var L=a==="return"&&p.k?a:"next";if(!p.k||T.done)return s(L,T);T=r[L](T).value}i(!!m.done,T)},function(T){s("throw",T)})}catch(T){i(2,T)}}function i(a,f){a===2?t.reject(f):t.resolve({value:f,done:a}),(t=t.next)?s(t.key,t.arg):n=null}this._invoke=function(a,f){return new Promise(function(m,p){var g={key:a,arg:f,resolve:m,reject:p,next:null};n?n=n.next=g:(t=n=g,s(a,f))})},typeof r.return!="function"&&(this.return=void 0)}qe.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},qe.prototype.next=function(r){return this._invoke("next",r)},qe.prototype.throw=function(r){return this._invoke("throw",r)},qe.prototype.return=function(r){return this._invoke("return",r)};var Pn=Object.entries,An=Object.setPrototypeOf,Vr=Object.isFrozen,qr=Object.getPrototypeOf,Kr=Object.getOwnPropertyDescriptor,O=Object.freeze,N=Object.seal,_e=Object.create,kn=typeof Reflect<"u"&&Reflect,Dt=kn.apply,Ut=kn.construct;O||(O=function(t){return t});N||(N=function(t){return t});Dt||(Dt=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];return t.apply(n,i)});Ut||(Ut=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 re=x(Array.prototype.forEach);Array.prototype.indexOf;var Zr=x(Array.prototype.lastIndexOf),Rn=x(Array.prototype.pop),Oe=x(Array.prototype.push);Array.prototype.slice;var Qr=x(Array.prototype.splice),Te=Array.isArray,Ie=x(String.prototype.toLowerCase),Lt=x(String.prototype.toString),Sn=x(String.prototype.match),Ne=x(String.prototype.replace),wn=x(String.prototype.indexOf),Jr=x(String.prototype.trim),eo=x(Number.prototype.toString),to=x(Boolean.prototype.toString),xn=typeof BigInt>"u"?null:x(BigInt.prototype.toString),Ln=typeof Symbol>"u"?null:x(Symbol.prototype.toString),U=x(Object.prototype.hasOwnProperty),Ce=x(Object.prototype.toString),C=x(RegExp.prototype.test),V=no(TypeError);function x(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 Dt(r,t,s)}}function no(r){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return Ut(r,n)}}function _(r,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ie;if(An&&An(r,null),!Te(t))return r;let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){let a=n(i);a!==i&&(Vr(t)||(t[s]=a),i=a)}r[i]=!0}return r}function ro(r){for(let t=0;t<r.length;t++)U(r,t)||(r[t]=null);return r}function k(r){let t=_e(null);for(let s of Pn(r)){var n=Yr(s,2);let i=n[0],a=n[1];U(r,i)&&(Te(a)?t[i]=ro(a):a&&typeof a=="object"&&a.constructor===Object?t[i]=k(a):t[i]=a)}return t}function oo(r){switch(typeof r){case"string":return r;case"number":return eo(r);case"boolean":return to(r);case"bigint":return xn?xn(r):"0";case"symbol":return Ln?Ln(r):"Symbol()";case"undefined":return Ce(r);case"function":case"object":{if(r===null)return Ce(r);let t=r,n=F(t,"toString");if(typeof n=="function"){let s=n(t);return typeof s=="string"?s:Ce(s)}return Ce(r)}default:return Ce(r)}}function F(r,t){for(;r!==null;){let s=Kr(r,t);if(s){if(s.get)return x(s.get);if(typeof s.value=="function")return x(s.value)}r=qr(r)}function n(){return null}return n}function so(r){try{return C(r,""),!0}catch{return!1}}var On=O(["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"]),Ot=O(["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"]),Nt=O(["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"]),io=O(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ct=O(["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"]),ao=O(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Nn=O(["#text"]),Cn=O(["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"]),It=O(["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"]),In=O(["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"]),Ke=O(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),co=N(/{{[\w\W]*|^[\w\W]*}}/g),lo=N(/<%[\w\W]*|^[\w\W]*%>/g),uo=N(/\${[\w\W]*/g),fo=N(/^data-[\-\w.\u00B7-\uFFFF]+$/),po=N(/^aria-[\-\w]+$/),vn=N(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),mo=N(/^(?:\w+script|data):/i),ho=N(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),go=N(/^html$/i),Eo=N(/^[a-z][.\w]*(-[.\w]+)+$/i),Dn=N(/<[/\w!]/g),Un=N(/<[/\w]/g),_o=N(/<\/no(script|embed|frames)/i),To=N(/\/>/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},zn=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],yo=O(_({},zn)),bo=(function(){let r={};return re(zn,t=>{r[t]=N(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),O(r)})(),Ao=function(){return typeof window>"u"?null:window},Ro=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 a="dompurify"+(s?"#"+s:"");try{return t.createPolicy(a,{createHTML(f){return f},createScriptURL(f){return f}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},Mn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},q=function(t,n,s,i){return U(t,n)&&Te(t[n])?_(i.base?k(i.base):{},t[n],i.transform):s},vt=function(t,n,s){let i=U(t,n)?t[n]:void 0;return i&&typeof i=="object"?k(i):s()};function Fn(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ao(),t=l=>Fn(l);if(t.version="3.4.16",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 a=r.HTMLTemplateElement,f=r.Node,m=r.Element,p=r.NodeFilter;r.NamedNodeMap===void 0&&(r.NamedNodeMap||r.MozNamedAttrMap),r.HTMLFormElement;let g=r.DOMParser,T=r.trustedTypes,L=m.prototype,B=F(L,"cloneNode"),it=F(L,"remove"),Gt=F(L,"removeAttributeNode"),fr=F(L,"nextSibling"),se=F(L,"childNodes"),ie=F(L,"parentNode"),Bt=F(L,"shadowRoot"),at=F(L,"attributes"),Z=f&&f.prototype?F(f.prototype,"nodeType"):null,ae=f&&f.prototype?F(f.prototype,"nodeName"):null,Me=f&&f.prototype?F(f.prototype,"ownerDocument"):null,Ae=function(e){return Z?Z(e):e.nodeType},ct=function(e){return ae?ae(e):e.nodeName};if(typeof a=="function"){let l=n.createElement("template");l.content&&l.content.ownerDocument&&(n=l.content.ownerDocument)}let D,Q="",lt,Ht=!1,Re=0,$t=function(){if(Re>0)throw V('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.')},ce=function(e){$t(),Re++;try{return D.createHTML(e)}finally{Re--}},pr=function(e){$t(),Re++;try{return D.createScriptURL(e)}finally{Re--}},mr=function(){return Ht||(lt=Ro(T,i),Ht=!0),lt},Pe=n,ut=Pe.implementation,jt=Pe.createNodeIterator,dr=Pe.createDocumentFragment,hr=Pe.getElementsByTagName,gr=s.importNode,y=Mn();t.isSupported=typeof Pn=="function"&&typeof ie=="function"&&ut&&ut.createHTMLDocument!==void 0;let Er=co,_r=lo,Tr=uo,yr=fo,br=po,Ar=mo,Wt=ho,Rr=Eo,Yt=vn,b=null,ft=_({},[...On,...Ot,...Nt,...Ct,...Nn]),A=null,pt=_({},[...Cn,...It,...In,...Ke]),H=Object.seal(_e(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Se=null,Xt=null,W=Object.seal(_e(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Vt=!0,mt=!0,qt=!1,Kt=!0,Y=!1,J=!0,ee=!1,dt=!1,ke=null,ze=null,ht=!1,le=!1,Fe=!1,Ge=!1,Zt=!0,Qt=!1,Jt="user-content-",gt=!0,Et=!1,ue={},fe=null,en=_({},["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"]),tn=null,nn=_({},["audio","video","img","source","image","track"]),rn=null,on=_({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Be="http://www.w3.org/1998/Math/MathML",He="http://www.w3.org/2000/svg",$="http://www.w3.org/1999/xhtml",pe=$,_t=!1,Tt=null,Sr=_({},[Be,He,$],Lt),sn=O(["mi","mo","mn","ms","mtext"]),yt=_({},sn),an=O(["annotation-xml"]),bt=_({},an),wr=_({},["title","style","font","a","script"]),we=null,xr=["application/xhtml+xml","text/html"],Lr="text/html",w=null,me=null,Or=n.createElement("form"),cn=function(e){return e instanceof RegExp||e instanceof Function},At=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(me&&me===e)return;(!e||typeof e!="object")&&(e={}),e=k(e),we=xr.indexOf(e.PARSER_MEDIA_TYPE)===-1?Lr:e.PARSER_MEDIA_TYPE,w=we==="application/xhtml+xml"?Lt:Ie,b=q(e,"ALLOWED_TAGS",ft,{transform:w}),A=q(e,"ALLOWED_ATTR",pt,{transform:w}),Tt=q(e,"ALLOWED_NAMESPACES",Sr,{transform:Lt}),rn=q(e,"ADD_URI_SAFE_ATTR",on,{transform:w,base:on}),tn=q(e,"ADD_DATA_URI_TAGS",nn,{transform:w,base:nn}),fe=q(e,"FORBID_CONTENTS",en,{transform:w}),Se=q(e,"FORBID_TAGS",k({}),{transform:w}),Xt=q(e,"FORBID_ATTR",k({}),{transform:w}),ue=U(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?k(e.USE_PROFILES):e.USE_PROFILES:!1,Vt=e.ALLOW_ARIA_ATTR!==!1,mt=e.ALLOW_DATA_ATTR!==!1,qt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Kt=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Y=e.SAFE_FOR_TEMPLATES||!1,J=e.SAFE_FOR_XML!==!1,ee=e.WHOLE_DOCUMENT||!1,le=e.RETURN_DOM||!1,Fe=e.RETURN_DOM_FRAGMENT||!1,Ge=e.RETURN_TRUSTED_TYPE||!1,ht=e.FORCE_BODY||!1,Zt=e.SANITIZE_DOM!==!1,Qt=e.SANITIZE_NAMED_PROPS||!1,gt=e.KEEP_CONTENT!==!1,Et=e.IN_PLACE||!1,Yt=so(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:vn,pe=typeof e.NAMESPACE=="string"?e.NAMESPACE:$,yt=vt(e,"MATHML_TEXT_INTEGRATION_POINTS",()=>_({},sn)),bt=vt(e,"HTML_INTEGRATION_POINTS",()=>_({},an));let o=vt(e,"CUSTOM_ELEMENT_HANDLING",()=>_e(null));if(H=_e(null),U(o,"tagNameCheck")&&cn(o.tagNameCheck)&&(H.tagNameCheck=o.tagNameCheck),U(o,"attributeNameCheck")&&cn(o.attributeNameCheck)&&(H.attributeNameCheck=o.attributeNameCheck),U(o,"allowCustomizedBuiltInElements")&&typeof o.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=o.allowCustomizedBuiltInElements),N(H),Y&&(mt=!1),Fe&&(le=!0),ue&&(b=_({},Nn),A=_e(null),ue.html===!0&&(_(b,On),_(A,Cn)),ue.svg===!0&&(_(b,Ot),_(A,It),_(A,Ke)),ue.svgFilters===!0&&(_(b,Nt),_(A,It),_(A,Ke)),ue.mathMl===!0&&(_(b,Ct),_(A,In),_(A,Ke))),W.tagCheck=null,W.attributeCheck=null,U(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?W.tagCheck=e.ADD_TAGS:Te(e.ADD_TAGS)&&(b===ft&&(b=k(b)),_(b,e.ADD_TAGS,w))),U(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?W.attributeCheck=e.ADD_ATTR:Te(e.ADD_ATTR)&&(A===pt&&(A=k(A)),_(A,e.ADD_ATTR,w))),U(e,"ADD_FORBID_CONTENTS")&&Te(e.ADD_FORBID_CONTENTS)&&(fe===en&&(fe=k(fe)),_(fe,e.ADD_FORBID_CONTENTS,w)),gt&&(b["#text"]=!0),ee&&_(b,["html","head","body"]),b.table&&(_(b,["tbody"]),delete Se.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw V('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw V('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let c=D;D=e.TRUSTED_TYPES_POLICY;try{Q=ce("")}catch(u){throw D=c,u}}else e.TRUSTED_TYPES_POLICY===null?(D=void 0,Q=""):(D===void 0&&(D=mr()),D&&typeof Q=="string"&&(Q=ce("")));O&&O(e),me=e},ln=_({},[...Ot,...Nt,...io]),un=_({},[...Ct,...ao]),Nr=function(e,o,c){return o.namespaceURI===$?e==="svg":o.namespaceURI===Be?e==="svg"&&(c==="annotation-xml"||yt[c]):!!ln[e]},Cr=function(e,o,c){return o.namespaceURI===$?e==="math":o.namespaceURI===He?e==="math"&&bt[c]:!!un[e]},Ir=function(e,o,c){return o.namespaceURI===He&&!bt[c]||o.namespaceURI===Be&&!yt[c]?!1:!un[e]&&(wr[e]||!ln[e])},vr=function(e){let o=ie(e);(!o||!o.tagName)&&(o={namespaceURI:pe,tagName:"template"});let c=Ie(e.tagName),u=Ie(o.tagName);return Tt[e.namespaceURI]?e.namespaceURI===He?Nr(c,o,u):e.namespaceURI===Be?Cr(c,o,u):e.namespaceURI===$?Ir(c,o,u):!!(we==="application/xhtml+xml"&&Tt[e.namespaceURI]):!1},X=function(e){Oe(t.removed,{element:e});try{ie(e).removeChild(e)}catch{if(it(e),!ie(e))throw V("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},fn=function(e,o,c){try{Gt(e,o)}catch{try{e.removeAttribute(c)}catch{}}},$e=function(e){je(e);let o=se(e);if(o){let u=[];re(o,d=>{Oe(u,d)}),re(u,d=>{try{it(d)}catch{}})}let c=at(e);if(c)for(let u=c.length-1;u>=0;--u){let d=c[u],h=d&&d.name;typeof h=="string"&&fn(e,d,h)}},te=function(e,o,c){if(!c)try{c=o.getAttributeNode(e)}catch{c=null}Oe(t.removed,{attribute:c||null,from:o});try{c?Gt(o,c):o.removeAttribute(e)}catch{try{o.removeAttribute(e)}catch{}}if(e==="is")if(le||Fe)try{X(o)}catch{}else try{o.setAttribute(e,"")}catch{}},Dr=function(e){let o=at(e);if(o)for(let c=o.length-1;c>=0;--c){let u=o[c],d=u&&u.name;typeof d!="string"||A[w(d)]||fn(e,u,d)}},je=function(e){let o=[e];for(;o.length>0;){let c=o.pop();Ae(c)===P.element&&Dr(c);let u=se(c);if(u)for(let d=u.length-1;d>=0;--d)o.push(u[d])}},pn=function(e,o){return J?e==="patchsrc"?!0:e==="for"&&o!=="label"&&o!=="output":!1},Ur=function(e){if(!J)return;let o=[e];for(;o.length>0;){let c=o.pop(),u=Ae(c);if(u===P.processingInstruction||u===P.comment&&C(Un,c.data)){try{it(c)}catch{}continue}if(u===P.element){let h=c,E=w(ct(c));try{h.hasAttribute&&h.hasAttribute("patchsrc")&&h.removeAttribute("patchsrc"),h.hasAttribute&&h.hasAttribute("for")&&pn("for",E)&&h.removeAttribute("for")}catch{}}let d=se(c);if(d)for(let h=d.length-1;h>=0;--h)o.push(d[h])}},mn=function(e){let o=null,c=null;if(ht)e="<remove></remove>"+e;else{let h=Sn(e,/^[\r\n\t ]+/);c=h&&h[0]}we==="application/xhtml+xml"&&pe===$&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let u=D?ce(e):e;if(pe===$)try{o=new g().parseFromString(u,we)}catch{}if(!o||!o.documentElement){o=ut.createDocument(pe,"template",null);try{o.documentElement.innerHTML=_t?Q:u}catch{}}let d=o.body||o.documentElement;return e&&c&&d.insertBefore(n.createTextNode(c),d.childNodes[0]||null),pe===$?hr.call(o,ee?"html":"body")[0]:ee?o.documentElement:d},dn=function(e){let o=Me?Me(e):e.ownerDocument;return jt.call(o||e,e,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},We=function(e){return e=Ne(e,Er," "),e=Ne(e,_r," "),e=Ne(e,Tr," "),e},Rt=function(e){var o;e.normalize();let c=Me?Me(e):e.ownerDocument,u=jt.call(c||e,e,p.SHOW_TEXT|p.SHOW_COMMENT|p.SHOW_CDATA_SECTION|p.SHOW_PROCESSING_INSTRUCTION,null),d=u.nextNode();for(;d;)d.data=We(d.data),d=u.nextNode();let h=(o=e.querySelectorAll)===null||o===void 0?void 0:o.call(e,"template");h&&re(h,E=>{de(E.content)&&Rt(E.content)})},Ye=function(e){let o=ae?ae(e):null;return typeof o!="string"||w(o)!=="form"?!1:typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||e.attributes!==at(e)||typeof e.removeAttribute!="function"||typeof e.removeAttributeNode!="function"||typeof e.getAttributeNode!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function"||e.nodeType!==Z(e)||e.childNodes!==se(e)},de=function(e){if(!Z||typeof e!="object"||e===null)return!1;try{return Z(e)===P.documentFragment}catch{return!1}},xe=function(e){if(!Z||typeof e!="object"||e===null)return!1;try{return typeof Z(e)=="number"}catch{return!1}};function j(l,e,o){l.length!==0&&re(l,c=>{c.call(t,e,o,me)})}let Mr=function(e,o){return!!(J&&e.hasChildNodes()&&!xe(e.firstElementChild)&&C(Dn,e.textContent)&&C(Dn,e.innerHTML)||J&&e.namespaceURI===$&&yo[o]&&(xe(e.firstElementChild)||typeof e.textContent=="string"&&C(bo[o],e.textContent))||e.nodeType===P.processingInstruction||J&&e.nodeType===P.comment&&C(Un,e.data))},Xe=function(e,o){if(e instanceof RegExp)return C(e,o);if(e instanceof Function){for(var c=arguments.length,u=new Array(c>2?c-2:0),d=2;d<c;d++)u[d-2]=arguments[d];return!!e(o,...u)}return!1},Pr=function(e,o,c){if(!Se[o]&&_n(o)&&Xe(H.tagNameCheck,o))return!1;if(gt&&!fe[o]){let u=ie(e),d=se(e);if(d&&u){let h=d.length;for(let E=h-1;E>=0;--E){let S=e===c?B(d[E],!0):d[E];u.insertBefore(S,fr(e))}}}return X(e),!0},hn=function(e,o,c,u){return e.length===0?o:o===c||o===u?k(o):o},he=function(e,o){return e===o||ie(e)!==null?!1:(Et&&je(e),!0)},gn=function(e,o){if(j(y.beforeSanitizeElements,e,null),he(e,o))return!0;if(Ye(e))return X(e),!0;let c=w(ct(e));if(b=hn(y.uponSanitizeElement,b,ft,ke),j(y.uponSanitizeElement,e,{tagName:c,allowedTags:b}),he(e,o))return!0;if(Mr(e,c))return X(e),!0;if(Se[c]||!(W.tagCheck instanceof Function&&W.tagCheck(c))&&!b[c]){let u=Pr(e,c,o);return u===!1&&(j(y.afterSanitizeElements,e,null),he(e,o))?!0:u}if(Ae(e)===P.element&&!vr(e)||(c==="noscript"||c==="noembed"||c==="noframes")&&C(_o,e.innerHTML))return X(e),!0;if(Y&&e.nodeType===P.text){let u=We(e.textContent);e.textContent!==u&&(Oe(t.removed,{element:e.cloneNode()}),e.textContent=u)}return j(y.afterSanitizeElements,e,null),he(e,o)},En=function(e,o,c){if(Xt[o]||pn(o,e)||Zt&&(o==="id"||o==="name")&&(c in n||c in Or))return!1;let u=A[o]||W.attributeCheck instanceof Function&&W.attributeCheck(o,e);return mt&&C(yr,o)||Vt&&C(br,o)?!0:u?rn[o]||C(Yt,Ne(c,Wt,""))||(o==="src"||o==="xlink:href"||o==="href")&&e!=="script"&&wn(c,"data:")===0&&tn[e]||qt&&!C(Ar,Ne(c,Wt,""))?!0:!c:_n(e)&&Xe(H.tagNameCheck,e)&&Xe(H.attributeNameCheck,o,e)||o==="is"&&H.allowCustomizedBuiltInElements&&Xe(H.tagNameCheck,c)},kr=_({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),_n=function(e){return!kr[Ie(e)]&&C(Rr,e)},zr=function(e,o,c,u){if(D&&typeof T=="object"&&typeof T.getAttributeType=="function"&&!c)switch(T.getAttributeType(e,o)){case"TrustedHTML":return ce(u);case"TrustedScriptURL":return pr(u)}return u},Fr=function(e,o,c,u){try{return c?e.setAttributeNS(c,o,u):e.setAttribute(o,u),Ye(e)?(X(e),!1):!0}catch{return te(o,e),!1}},Tn=function(e,o){if(j(y.beforeSanitizeAttributes,e,null),he(e,o))return;let c=e.attributes;if(!c||Ye(e))return;A=hn(y.uponSanitizeAttribute,A,pt,ze);let u={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:A,forceKeepAttr:void 0},d=c.length,h=w(e.nodeName);for(;d--;){let E=c[d],S=E.name,z=E.namespaceURI,M=E.value,ge=w(S),wt=M,I=S==="value"?wt:Jr(wt),yn=!1;if(u.attrName=ge,u.attrValue=I,u.keepAttr=!0,u.forceKeepAttr=void 0,j(y.uponSanitizeAttribute,e,u),I=u.attrValue,Qt&&(ge==="id"||ge==="name")&&wn(I,Jt)!==0&&(te(S,e,E),I=Jt+I,yn=!0),J&&C(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,I)){te(S,e,E);continue}if(ge==="attributename"&&Sn(I,"href")){te(S,e,E);continue}if(!u.forceKeepAttr){if(!u.keepAttr){te(S,e,E);continue}if(!Kt&&C(To,I)){te(S,e,E);continue}if(Y&&(I=We(I)),!En(h,ge,I)){te(S,e,E);continue}I=zr(h,ge,z,I),I!==wt&&Fr(e,S,z,I)&&yn&&Rn(t.removed)}}j(y.afterSanitizeAttributes,e,null),he(e,o)},Ve=function(e){let o=null,c=dn(e);for(j(y.beforeSanitizeShadowDOM,e,null);o=c.nextNode();)if(j(y.uponSanitizeShadowNode,o,null),gn(o,e),Tn(o,e),de(o.content)&&Ve(o.content),Ae(o)===P.element){let u=Bt(o);de(u)&&(St(u),Ve(u))}j(y.afterSanitizeShadowDOM,e,null)},St=function(e){let o=[{node:e,shadow:null}];for(;o.length>0;){let c=o.pop();if(c.shadow){Ve(c.shadow);continue}let u=c.node,d=Ae(u)===P.element,h=se(u);if(h)for(let E=h.length-1;E>=0;--E)o.push({node:h[E],shadow:null});if(d){let E=ae?ae(u):null;if(typeof E=="string"&&w(E)==="template"){let S=u.content;de(S)&&o.push({node:S,shadow:null})}}if(d){let E=Bt(u);de(E)&&o.push({node:null,shadow:E},{node:E,shadow:null})}}};return t.sanitize=function(l){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=null,c=null,u=null,d=null;if(_t=!l,_t&&(l="<!-->"),typeof l!="string"&&!xe(l)&&(l=oo(l),typeof l!="string"))throw V("dirty is not a string, aborting");if(!t.isSupported)return l;dt?(b=ke,A=ze):At(e),(y.uponSanitizeElement.length>0||y.uponSanitizeAttribute.length>0)&&(b=k(b)),y.uponSanitizeAttribute.length>0&&(A=k(A)),t.removed=[];let h=Et&&typeof l!="string"&&xe(l);if(h){Ur(l);let z=ct(l);if(typeof z=="string"){let M=w(z);if(!b[M]||Se[M])throw $e(l),V("root node is forbidden and cannot be sanitized in-place")}if(Ye(l))throw $e(l),V("root node is clobbered and cannot be sanitized in-place");try{St(l)}catch(M){throw $e(l),M}}else if(xe(l))o=mn("<!---->"),c=o.ownerDocument.importNode(l,!0),c.nodeType===P.element&&c.nodeName==="BODY"||c.nodeName==="HTML"?o=c:o.appendChild(c),St(o);else{if(!le&&!Y&&!ee&&l.indexOf("<")===-1)return D&&Ge?ce(l):l;if(o=mn(l),!o)return le?null:Ge?Q:""}o&&ht&&X(o.firstChild);let E=h?l:o;try{let z=dn(E);for(;u=z.nextNode();)gn(u,E),Tn(u,E),de(u.content)&&Ve(u.content)}catch(z){throw h&&($e(l),re(t.removed,M=>{M.element&&je(M.element)})),z}if(h){let z=!1;if(re(t.removed,M=>{M.element&&(M.element===l&&(z=!0),je(M.element))}),z)throw V("a node selected for removal could not be safely returned; refusing to sanitize in place");return Y&&Rt(l),l}if(le){if(Y&&Rt(o),Fe)for(d=dr.call(o.ownerDocument);o.firstChild;)d.appendChild(o.firstChild);else d=o;return(A.shadowroot||A.shadowrootmode)&&(d=gr.call(s,d,!0)),d}let S=ee?o.outerHTML:o.innerHTML;return ee&&b["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&C(go,o.ownerDocument.doctype.name)&&(S="<!DOCTYPE "+o.ownerDocument.doctype.name+`>
3
+ `+S),Y&&(S=We(S)),D&&Ge?ce(S):S},t.setConfig=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};At(l),dt=!0,ke=b,ze=A},t.clearConfig=function(){me=null,dt=!1,ke=null,ze=null,D=lt,Q=""},t.isValidAttribute=function(l,e,o){me||At({});let c=w(l),u=w(e);return En(c,u,o)},t.addHook=function(l,e){typeof e=="function"&&U(y,l)&&Oe(y[l],e)},t.removeHook=function(l,e){if(U(y,l)){if(e!==void 0){let o=Zr(y[l],e);return o===-1?void 0:Qr(y[l],o,1)[0]}return Rn(y[l])}},t.removeHooks=function(l){U(y,l)&&(y[l]=[])},t.removeAllHooks=function(){y=Mn()},t}var Gn=Fn();var Ze=Gn(globalThis.window);var Bn=/&amp;/gi,Hn=/&(?=[#a-z0-9])(?![a-z0-9]+=)/i;var $n=/#$/,jn=/^(?:application\/(?:[\w.-]+\+)?xml|image\/svg\+xml|text\/(?:html|xml))(?:\s*;\s*|$)/i;var Wn=/\P{ASCII}/u,Yn=/&#(x0*[\dA-F]{1,2}|0*\d{1,3});?/gi,Xn=/(?:%[\dA-F]{2})+/gi,Vn=/^((?:[^#%]|%(?!23))*)\?$/,Qe=/^[a-z][\da-z+.-]*$/,qn=/^(?:web\+[a-z]+|ext\+[a-z][\da-z.-]*)$/,oe=/^(?:java|vb)script$/i,ve=/^(?:(?:java|vb)script|blob)$/i,Mt=/["'<>]|%(?:22|27|3C|3E)|&(?:apos|lt|gt|quot|#0*(?:34|39|60|62)|#x0*(?:22|27|3C|3E));/i,Kn=/^%[\dA-F]{2}$/i,Zn=/^(?:\/{2,}|\\|[a-z][a-z\d+\-.]*:[^/])/i;var Qn=[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 Pt=new Set(Qn),kt=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]]),wo=()=>{let r=new Map;for(let t=0;t<256;t++)!Pt.has(t)&&!kt.has(t)&&r.set(t,`\\x${t.toString(16).padStart(2,"0").toUpperCase()}`);return r},zt=wo();var[ye,Lo,Oo,No,Co,Io]=["&","#","<",">",'"',"'"].map(r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`),vo={[ye]:`${ye}amp;`,[Oo]:`${ye}lt;`,[No]:`${ye}gt;`,[Co]:`${ye}quot;`,[Io]:`${ye}${Lo}39;`},ns=Array.from({length:256},(r,t)=>`%${t.toString(16).padStart(2,"0").toUpperCase()}`),rr=globalThis.process?.versions?.node!==void 0,or=`[${[...zt.values()].join("")}]`,Do=new RegExp(or),Uo=new RegExp(or,"g"),Mo=new Uint8Array(65536),rs=new TextEncoder,Po=new TextDecoder("utf-8",{fatal:!0}),v=(r,t=!1)=>{if(!R(r))return null;let n=Wn.test(r)?r.normalize("NFKC"):r;return t?n.trim().toLowerCase().replace(/:$/,""):n},G=(r,t,n=!1)=>{if(!R(r)||r==="")return null;let s=r,i=t&&R(t)?t:"";if(n&&(s=v(s),i&&(i=v(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}},sr=r=>R(r)?r.replace(/:$/,"").split("+"):[];var ir=r=>{if(!R(r))return r;let t=Kn.test(r)?r.toUpperCase():r;return vo[t]??r},K=r=>{let t=R(r)?r:String(r);return t.length>64?`${t.slice(0,64)}...`:t},ar=r=>R(r)?r.replace($n,"").replace(Vn,"$1"):r,ko=(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(zt.has(n))return"";if(Pt.has(n))return String.fromCharCode(n);let s=kt.get(n);return String.fromCodePoint(s)},cr=(r,t=0)=>{if(!R(r))throw new TypeError(`Expected String but got ${Ee(r)}.`);if(!Number.isInteger(t))throw new TypeError(`Expected Number but got ${Ee(t)}.`);let n;try{n=decodeURIComponent(r)}catch{n=r.replace(Xn,i=>{try{return decodeURIComponent(i)}catch{return i}})}n=n.replace(Uo,"");let s=0;for(;s+t<16;s++){let i=n;if(n=n.replace(Bn,"&").replace(Yn,ko),n===i)break}if(s+t>=16&&/&#/.test(n))throw new Error("Character references nested too deeply.");return n},tt=(r,t="",n="")=>{if(!R(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),a=r.substring(s+1),f=t===""&&n===""?a:a+t+n,m=i.split(";"),p=m.at(-1),g=p!==void 0&&p.length===6&&p.toLowerCase()==="base64";return{mediaType:i,mediaTypes:m,data:f,isBase64:g}},lr=r=>{if(!R(r))throw new TypeError(`Expected String but got ${Ee(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: ${K(r)}`)}}let s;if(rr&&globalThis.Buffer)s=globalThis.Buffer.from(t,"latin1");else{let i=t.length;i>65536?s=new Uint8Array(i):s=Mo.subarray(0,i);for(let a=0;a<i;a++)s[a]=t.charCodeAt(a)}try{let i=Po.decode(s);return Do.test(i)?n:i}catch{return n}},nt=r=>{if(rr&&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(""))},zo=async(r,t,n)=>{let s=r.body.getReader(),i=[],a="Operation aborted";if(n?.aborted)throw await s.cancel(a),s.releaseLock(),n.reason;let f=()=>{s.cancel(a).catch(()=>{})};n?.addEventListener("abort",f,{once:!0});try{let m=0;for(;m<=t;){if(n?.aborted)throw await s.cancel(a),n.reason;let{done:T,value:L}=await s.read();if(n?.aborted)throw n.reason;if(T)break;if(m+=L.byteLength,m>t)throw await s.cancel("Size limit exceeded"),new DOMException(`Payload (${m} bytes) exceeds max (${t} bytes).`,"NotReadableError");i.push(L)}let p=new Uint8Array(m),g=0;for(let T of i)p.set(T,g),g+=T.byteLength;return p.buffer}finally{n?.removeEventListener("abort",f),s.releaseLock()}},Ft=async(r,t,n)=>{let s=16777216;Number.isInteger(t)&&t>0&&(s=t);let i=await fetch(r,{signal:n});if(!i.ok){let g=`Failed to fetch ${K(r)}`;throw Number.isInteger(i.status)&&(i.statusText?g+=`: ${i.status} ${i.statusText}`:g+=`: ${i.status}`),new Error(g)}let a=i.headers.get("content-length");if(a){let p=Number.parseInt(a,10);if(Number.isInteger(p)&&p>s)throw new DOMException(`Payload (${p} bytes) exceeds max (${s} bytes).`,"NotReadableError")}let f=i.headers.get("content-type")||"",m;if(i.body)m=await zo(i,s,n);else{let p=await i.blob();if(p.size>s)throw new DOMException(`Payload (${p.size} bytes) exceeds max (${s} bytes).`,"NotReadableError");m=await p.arrayBuffer()}return{buffer:m,mimeType:f}};var Ue=class{constructor(t,n=Le){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:a,only:f}=t;if(this.allowRelative=!!n,this.debug=!!s,Array.isArray(f)&&f.length){this.restrictScheme=!0;for(let m of f)this.#t(m)}else{if(Array.isArray(i)&&i.length)for(let m of i)this.#t(m);if(Array.isArray(a)&&a.length)for(let m of a){let p=v(m,!0);p&&this.schemeMap.set(p,!1)}}}#t(t){let n=v(t,!0);return!n||ve.test(n)||!Qe.test(n)||n.includes("+")&&n.split("+").some(i=>oe.test(i))?!1:(this.schemeMap.set(n,!0),!0)}enter(t){return this.recurse.has(t)?(this.debug&&ne(`Circular Data URL detected and skipped: ${K(t)}`),!1):(this.nest++,this.recurse.add(t),!0)}leave(t){this.nest--,this.recurse.delete(t)}},rt=class{#e;constructor(t=Le){this.#e=t}#t(t,n){if(n.nest>16)throw new Error("Data URLs nested too deeply.");let s=G(t,null,!0);if(!s){if(n.allowRelative&&!Zn.test(t)){let a=G(t,xt);if(a){let{protocol:f,hostname:m,pathname:p,search:g,hash:T}=a;if(f==="http:"&&m==="dummy.local")return this.#o(`${p}${g}${T}`)}}return null}let i=v(s.protocol,!0);if(n.restrictScheme&&!n.schemeMap.has(i))return null;if(i.includes("+")){let a=i.split("+");if(n.schemeMap.get(i)===!1||a.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.#o(s.href)}#n(t,n){let{mediaType:s,mediaTypes:i,data:a,isBase64:f}=tt(t.pathname,t.search,t.hash),m=a;if(f)try{m=lr(a)}catch(p){return n.debug&&ne("Failed to parse base64 data.",p),null}try{let p=cr(m).trim(),g=G(p,xt);if(!g||sr(g.protocol).some(L=>ve.test(L)))return null}catch(p){return n.debug&&ne("Failed to parse inner data URL protocol.",p),null}return(!s||jn.test(s))&&(m=this.#s(m,n)),m?(f&&m!==a&&i.pop(),`data:${i.join(";")},${m}`):null}#s(t,n){let s="";try{s=decodeURIComponent(t)}catch{s=t}let i=(f,m)=>this.#r(f,m,n),a="";try{n.domPurify.addHook("uponSanitizeAttribute",i),a=n.domPurify.sanitize(s)}finally{n.domPurify.removeHook("uponSanitizeAttribute",i)}if(!a)return null;try{return encodeURI(ar(a))}catch{return null}}#r(t,n,s){if(!n.attrValue||!/^\s*data:/i.test(n.attrValue))return;let i=G(n.attrValue,null,!0);if(!i||i.protocol!=="data:")return;let a=n.attrValue;if(!s.enter(a)){n.attrValue="";return}try{let f=this.#t(a,s);n.attrValue=f||""}finally{s.leave(a)}}#o(t){let n=t.length,s=n,i=Mt.exec(t);if(i&&(s=i.index),t.indexOf("&")>-1){let f=Hn.exec(t);if(f){let m=f.index;m<s&&(s=m)}}if(s===n)return t;let a=t.charCodeAt(s-1);return(a===63||a===38)&&s--,t.substring(0,s)}sanitize(t,n=this.#e){if(!t||!R(t))return null;let{deny:s,maxLength:i,only:a,allowRelative:f}=n;if(Number.isInteger(i)&&t.length>i){let g=`URL length ${t.length} exceeds max length ${i}.`;throw new RangeError(g)}if(!(Array.isArray(s)&&s.length>0||Array.isArray(a)&&a.length>0||f)&&/^https?:\/\//.test(t)&&!Mt.test(t)&&!t.includes("data:")){let g=G(t,null,!0);return g&&n.schemes.has(g.protocol.replace(/:$/,""))?g.href.replace(/%26/g,ir):null}let p=new Ue(Ze,n);return this.#t(t,p)}async sanitizeBuffer(t,n,s=this.#e){if(!(t instanceof ArrayBuffer))return null;let i=nt(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 m=new Ue(Ze,s);if(!m.schemeMap.get("data"))return null;let p=G(f);return p?this.#n(p,m):null}async sanitizeDataURL(t,n=this.#e){if(!t||!R(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=G(t);if(!i)return null;let a=v(i.protocol,!0);if(a!=="data")return null;let f=new Ue(Ze,n);return f.schemeMap.get(a)?this.#n(i,f):null}};var ur=["aaa","aaas","about","acap","acct","acd","ace","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","rttp","sarif","secondlife","secret-token","seki","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","tii","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 ot=class{#e=new Set(ur);get(){return[...this.#e]}getScheme(t){if(!R(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 v(t,n)}normalizeSchemes(t){if(Array.isArray(t)){let n=[];for(let s of t){let i=v(s,!0);i&&n.push(i)}return n}return[]}parse(t,n,s=!1){return G(t,n,s)}verifyURI(t,n){if(!R(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 a=n||this.#e;if(!i.includes("+"))return oe.test(i)?!1:a.has(i);let f=i.split("+");return f.some(p=>oe.test(p))?!1:a.has(i)?!0:s&&qn.test(i)||f.every(p=>a.has(p))}};var Go=Object.freeze(["href","origin","protocol","username","password","host","hostname","port","pathname","search","hash"]),st=class extends ot{#e;#t;#n;constructor(){super(),this.#e=new Set(super.get()),this.#t={...Le,schemes:this.#e},this.#n=new rt(this.#t)}#s(t){return!R(t)||ve.test(t)||t.includes("+")&&t.split("+").some(s=>oe.test(s))?!1:Qe.test(t)}#r(t,n={}){if(!R(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}}#o(t){let n={input:t,href:null,valid:!1};if(!R(t))return n.reason=`Invalid URL input: ${K(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(a){i=a.message}if(s){let a=G(s);if(n.valid=!0,a){if(v(a.protocol,!0)==="data"){let{mediaTypes:m,data:p,isBase64:g}=tt(a.pathname,a.search,a.hash);g&&m.pop(),n.data={mime:m.join(";"),base64:g,data:p}}else n.data=null;for(let m of Go){let p=a[m];R(p)&&(n[m]=p)}}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}async#i(t,n){try{let{buffer:s,mimeType:i}=await Ft(t,n.maxBlobSize,n.signal),a=nt(s),f=`data:${i?`${i};base64`:"base64"},${a}`,m=this.#o(f,n);return m.input=t,m}catch(s){if(s.name==="AbortError"||n.signal?.aborted)throw s;return n.debug&&ne(`Failed to inspect blob URL: ${K(t)}`,s),{input:t,valid:!1,reason:s.message}}finally{n.revokeObjectURL&&URL.revokeObjectURL(t)}}get(){return[...this.#e]}has(t){let n=v(t,!0);return n?this.#e.has(n):!1}add(t){if(!R(t))throw new TypeError(`Expected String but got ${Ee(t)}.`);let n=v(t,!0);if(!this.#s(n))throw new Error(`Invalid scheme: ${t}`);return this.#e.add(n),[...this.#e]}remove(t){if(!R(t))return!1;let n=v(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:a}=this.#r(t,n);if(s===!1)return null;if(a==="blob"){let{allow:f,deny:m,only:p}=i,g=null;try{if(f.includes("blob")&&!m.includes("blob")||p.includes("blob")){let T=null,L="";try{let B=await Ft(t,i.maxBlobSize,i.signal);T=B.buffer,L=B.mimeType}catch(B){if(B.name==="AbortError"||i.signal?.aborted)throw B;i.debug&&ne(`Failed to fetch and convert blob URL: ${K(t)}`,B)}T&&(p.length?p.includes("data")||(i.only=[...p,"data"]):(f.includes("data")||(i.allow=[...f,"data"]),i.deny=m.filter(B=>B!=="data")),g=await this.#n.sanitizeBuffer(T,L,i))}}finally{i.revokeObjectURL&&URL.revokeObjectURL(t)}return g}else if(a==="data")return this.#n.sanitizeDataURL(t,i);return this.#n.sanitize(t,i)}sanitizeURLSync(t,n){let{isValid:s,options:i,scheme:a}=this.#r(t,n);return s===!1?null:a==="blob"?(i.revokeObjectURL&&URL.revokeObjectURL(t),null):this.#n.sanitize(t,i)}async inspectURL(t,n){let{options:s,scheme:i}=this.#r(t,n);return i==="blob"?this.#i(t,s):this.#o(t,s)}isValidURI(t){return super.verifyURI(t,this.#e)}};var be=new st,ws=async(r,t)=>be.sanitizeURL(r,t),xs=(r,t)=>be.sanitizeURLSync(r,t),Ls=async r=>be.inspectURL(r),Os=r=>be.isValidURI(r),Ns=r=>be.isValidURI(r),Cs=be;export{st as URLSanitizer,Cs as default,Ls as inspectURL,Ns as isURISync,Os as isValidURI,ws as sanitizeURL,xs as sanitizeURLSync};
4
4
  /*!
5
5
  * URL Sanitizer
6
6
  *
@@ -11,6 +11,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
11
11
  /*! Bundled license information:
12
12
 
13
13
  dompurify/dist/purify.es.mjs:
14
- (*! @license DOMPurify 3.4.15 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.15/LICENSE *)
14
+ (*! @license DOMPurify 3.4.16 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.16/LICENSE *)
15
+ (*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE *)
15
16
  */
16
17
  //# sourceMappingURL=url-sanitizer.min.js.map