url-sanitizer 2.0.9 → 2.0.11

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