url-sanitizer 2.0.10 → 2.0.12

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:Nt,isFrozen:En,getPrototypeOf:Tn,getOwnPropertyDescriptor:_n}=Object,{freeze:C,seal:U,create:Bt}=Object,{apply:tt,construct:nt}=typeof Reflect<"u"&&Reflect;C||(C=function(t){return t});U||(U=function(t){return t});tt||(tt=function(t,o){for(var r=arguments.length,a=new Array(r>2?r-2:0),c=2;c<r;c++)a[c-2]=arguments[c];return t.apply(o,a)});nt||(nt=function(t){for(var o=arguments.length,r=new Array(o>1?o-1:0),a=1;a<o;a++)r[a-1]=arguments[a];return new t(...r)});var De=I(Array.prototype.forEach),An=I(Array.prototype.lastIndexOf),Ut=I(Array.prototype.pop),he=I(Array.prototype.push),yn=I(Array.prototype.splice),Ie=I(String.prototype.toLowerCase),Ve=I(String.prototype.toString),Ke=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),a=1;a<o;a++)r[a-1]=arguments[a];return tt(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 nt(n,o)}}function f(n,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ie;Nt&&Nt(n,null);let r=t.length;for(;r--;){let a=t[r];if(typeof a=="string"){let c=o(a);c!==a&&(En(t)||(t[r]=c),a=c)}n[a]=!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","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"]),Ze=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","slot","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Qe=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"]),Je=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","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"]),et=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]+$/),vn=U(/^aria-[\-\w]+$/),Wt=U(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Mn=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:vn,ATTR_WHITESPACE:Nn,CUSTOM_ELEMENT:Un,DATA_ATTR:In,DOCTYPE_NAME:jt,ERB_EXPR:Dn,IS_ALLOWED_URI:Wt,IS_SCRIPT_OR_DATA:Mn,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,a="data-tt-policy-suffix";o&&o.hasAttribute(a)&&(r=o.getAttribute(a));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=l=>Yt(l);if(t.version="3.2.7",t.removed=[],!n||!n.document||n.document.nodeType!==_e.document||!n.Element)return t.isSupported=!1,t;let{document:o}=n,r=o,a=r.currentScript,{DocumentFragment:c,HTMLTemplateElement:p,Node:u,Element:E,NodeFilter:L,NamedNodeMap:h=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:m,DOMParser:T,trustedTypes:$}=n,N=E.prototype,X=Te(N,"cloneNode"),pe=Te(N,"remove"),J=Te(N,"nextSibling"),P=Te(N,"childNodes"),k=Te(N,"parentNode");if(typeof p=="function"){let l=o.createElement("template");l.content&&l.content.ownerDocument&&(o=l.content.ownerDocument)}let d,F="",{implementation:V,createNodeIterator:ee,createDocumentFragment:te,getElementsByTagName:Ae}=o,{importNode:M}=r,y=Ht();t.isSupported=typeof $t=="function"&&typeof k=="function"&&V&&V.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:ne,ERB_EXPR:fe,TMPLIT_EXPR:ye,DATA_ATTR:ke,ARIA_ATTR:rn,IS_SCRIPT_OR_DATA:an,ATTR_WHITESPACE:ct,CUSTOM_ELEMENT:ln}=Gt,{IS_ALLOWED_URI:pt}=Gt,R=null,ft=f({},[...Pt,...Ze,...Qe,...Je,...kt]),S=null,mt=f({},[...Ft,...et,...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}})),me=null,Fe=null,ut=!0,ze=!0,dt=!1,ht=!0,se=!1,Re=!0,K=!1,Ge=!1,He=!1,oe=!1,be=!1,Se=!1,gt=!0,Et=!1,cn="user-content-",$e=!0,ue=!1,re={},ie=null,Tt=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"]),_t=null,At=f({},["audio","video","img","source","image","track"]),Be=null,yt=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",ae=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"]),de=null,mn=["application/xhtml+xml","text/html"],un="text/html",b=null,le=null,dn=o.createElement("form"),Rt=function(e){return e instanceof RegExp||e instanceof Function},Ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(le&&le===e)){if((!e||typeof e!="object")&&(e={}),e=Y(e),de=mn.indexOf(e.PARSER_MEDIA_TYPE)===-1?un:e.PARSER_MEDIA_TYPE,b=de==="application/xhtml+xml"?Ve:Ie,R=z(e,"ALLOWED_TAGS")?f({},e.ALLOWED_TAGS,b):ft,S=z(e,"ALLOWED_ATTR")?f({},e.ALLOWED_ATTR,b):mt,je=z(e,"ALLOWED_NAMESPACES")?f({},e.ALLOWED_NAMESPACES,Ve):pn,Be=z(e,"ADD_URI_SAFE_ATTR")?f(Y(yt),e.ADD_URI_SAFE_ATTR,b):yt,_t=z(e,"ADD_DATA_URI_TAGS")?f(Y(At),e.ADD_DATA_URI_TAGS,b):At,ie=z(e,"FORBID_CONTENTS")?f({},e.FORBID_CONTENTS,b):Tt,me=z(e,"FORBID_TAGS")?f({},e.FORBID_TAGS,b):Y({}),Fe=z(e,"FORBID_ATTR")?f({},e.FORBID_ATTR,b):Y({}),re=z(e,"USE_PROFILES")?e.USE_PROFILES:!1,ut=e.ALLOW_ARIA_ATTR!==!1,ze=e.ALLOW_DATA_ATTR!==!1,dt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ht=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,se=e.SAFE_FOR_TEMPLATES||!1,Re=e.SAFE_FOR_XML!==!1,K=e.WHOLE_DOCUMENT||!1,oe=e.RETURN_DOM||!1,be=e.RETURN_DOM_FRAGMENT||!1,Se=e.RETURN_TRUSTED_TYPE||!1,He=e.FORCE_BODY||!1,gt=e.SANITIZE_DOM!==!1,Et=e.SANITIZE_NAMED_PROPS||!1,$e=e.KEEP_CONTENT!==!1,ue=e.IN_PLACE||!1,pt=e.ALLOWED_URI_REGEXP||Wt,ae=e.NAMESPACE||B,Le=e.MATHML_TEXT_INTEGRATION_POINTS||Le,Oe=e.HTML_INTEGRATION_POINTS||Oe,_=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Rt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(_.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Rt(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),se&&(ze=!1),be&&(oe=!0),re&&(R=f({},kt),S=[],re.html===!0&&(f(R,Pt),f(S,Ft)),re.svg===!0&&(f(R,Ze),f(S,et),f(S,Ce)),re.svgFilters===!0&&(f(R,Qe),f(S,et),f(S,Ce)),re.mathMl===!0&&(f(R,Je),f(S,zt),f(S,Ce))),e.ADD_TAGS&&(R===ft&&(R=Y(R)),f(R,e.ADD_TAGS,b)),e.ADD_ATTR&&(S===mt&&(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&&(ie===Tt&&(ie=Y(ie)),f(ie,e.FORBID_CONTENTS,b)),$e&&(R["#text"]=!0),K&&f(R,["html","head","body"]),R.table&&(f(R,["tbody"]),delete me.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($,a)),d!==null&&typeof F=="string"&&(F=d.createHTML(""));C&&C(e),le=e}},bt=f({},[...Ze,...Qe,...xn]),St=f({},[...Je,...Ln]),hn=function(e){let s=k(e);(!s||!s.tagName)&&(s={namespaceURI:ae,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]):!!bt[i]:e.namespaceURI===we?s.namespaceURI===B?i==="math":s.namespaceURI===xe?i==="math"&&Oe[g]:!!St[i]:e.namespaceURI===B?s.namespaceURI===xe&&!Oe[g]||s.namespaceURI===we&&!Le[g]?!1:!St[i]&&(fn[i]||!bt[i]):!!(de==="application/xhtml+xml"&&je[e.namespaceURI]):!1},G=function(e){he(t.removed,{element:e});try{k(e).removeChild(e)}catch{pe(e)}},Z=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(oe||be)try{G(s)}catch{}else try{s.setAttribute(e,"")}catch{}},wt=function(e){let s=null,i=null;if(He)e="<remove></remove>"+e;else{let A=Ke(e,/^[\r\n\t ]+/);i=A&&A[0]}de==="application/xhtml+xml"&&ae===B&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let g=d?d.createHTML(e):e;if(ae===B)try{s=new T().parseFromString(g,de)}catch{}if(!s||!s.documentElement){s=V.createDocument(ae,"template",null);try{s.documentElement.innerHTML=We?F:g}catch{}}let O=s.body||s.documentElement;return e&&i&&O.insertBefore(o.createTextNode(i),O.childNodes[0]||null),ae===B?Ae.call(s,K?"html":"body")[0]:K?s.documentElement:O},xt=function(e){return ee.call(e.ownerDocument||e,e,L.SHOW_ELEMENT|L.SHOW_COMMENT|L.SHOW_TEXT|L.SHOW_PROCESSING_INSTRUCTION|L.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")},Lt=function(e){return typeof u=="function"&&e instanceof u};function W(l,e,s){De(l,i=>{i.call(t,e,s,le)})}let Ot=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()&&!Lt(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]||me[i]){if(!me[i]&&Ct(i)&&(_.tagNameCheck instanceof RegExp&&D(_.tagNameCheck,i)||_.tagNameCheck instanceof Function&&_.tagNameCheck(i)))return!1;if($e&&!ie[i]){let g=k(e)||e.parentNode,O=P(e)||e.childNodes;if(O&&g){let A=O.length;for(let v=A-1;v>=0;--v){let j=X(O[v],!0);j.__removalCount=(e.__removalCount||0)+1,g.insertBefore(j,J(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):(se&&e.nodeType===_e.text&&(s=e.textContent,De([ne,fe,ye],g=>{s=ge(s,g," ")}),e.textContent!==s&&(he(t.removed,{element:e.cloneNode()}),e.textContent=s)),W(y.afterSanitizeElements,e,null),!1)},Dt=function(e,s,i){if(gt&&(s==="id"||s==="name")&&(i in o||i in dn))return!1;if(!(ze&&!Fe[s]&&D(ke,s))){if(!(ut&&D(rn,s))){if(!S[s]||Fe[s]){if(!(Ct(e)&&(_.tagNameCheck instanceof RegExp&&D(_.tagNameCheck,e)||_.tagNameCheck instanceof Function&&_.tagNameCheck(e))&&(_.attributeNameCheck instanceof RegExp&&D(_.attributeNameCheck,s)||_.attributeNameCheck instanceof Function&&_.attributeNameCheck(s,e))||s==="is"&&_.allowCustomizedBuiltInElements&&(_.tagNameCheck instanceof RegExp&&D(_.tagNameCheck,i)||_.tagNameCheck instanceof Function&&_.tagNameCheck(i))))return!1}else if(!Be[s]){if(!D(pt,ge(i,ct,""))){if(!((s==="src"||s==="xlink:href"||s==="href")&&e!=="script"&&Rn(i,"data:")===0&&_t[e])){if(!(dt&&!D(an,ge(i,ct,"")))){if(i)return!1}}}}}}return!0},Ct=function(e){return e!=="annotation-xml"&&Ke(e,ln)},It=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 O=s[g],{name:A,namespaceURI:v,value:j}=O,ce=b(A),qe=j,w=A==="value"?qe:bn(qe);if(i.attrName=ce,i.attrValue=w,i.keepAttr=!0,i.forceKeepAttr=void 0,W(y.uponSanitizeAttribute,e,i),w=i.attrValue,Et&&(ce==="id"||ce==="name")&&(Z(A,e),w=cn+w),Re&&D(/((--!?|])>)|<\/(style|title|textarea)/i,w)){Z(A,e);continue}if(ce==="attributename"&&Ke(w,"href")){Z(A,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){Z(A,e);continue}if(!ht&&D(/\/>/i,w)){Z(A,e);continue}se&&De([ne,fe,ye],Mt=>{w=ge(w,Mt," ")});let vt=b(e.nodeName);if(!Dt(vt,ce,w)){Z(A,e);continue}if(d&&typeof $=="object"&&typeof $.getAttributeType=="function"&&!v)switch($.getAttributeType(vt,ce)){case"TrustedHTML":{w=d.createHTML(w);break}case"TrustedScriptURL":{w=d.createScriptURL(w);break}}if(w!==qe)try{v?e.setAttributeNS(v,A,w):e.setAttribute(A,w),Xe(e)?G(e):Ut(t.removed)}catch{Z(A,e)}}W(y.afterSanitizeAttributes,e,null)},gn=function l(e){let s=null,i=xt(e);for(W(y.beforeSanitizeShadowDOM,e,null);s=i.nextNode();)W(y.uponSanitizeShadowNode,s,null),Ot(s),It(s),s.content instanceof c&&l(s.content);W(y.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,O=null;if(We=!l,We&&(l="<!-->"),typeof l!="string"&&!Lt(l))if(typeof l.toString=="function"){if(l=l.toString(),typeof l!="string")throw Ee("dirty is not a string, aborting")}else throw Ee("toString is not a function");if(!t.isSupported)return l;if(Ge||Ye(e),t.removed=[],typeof l=="string"&&(ue=!1),ue){if(l.nodeName){let j=b(l.nodeName);if(!R[j]||me[j])throw Ee("root node is forbidden and cannot be sanitized in-place")}}else if(l instanceof u)s=wt("<!---->"),i=s.ownerDocument.importNode(l,!0),i.nodeType===_e.element&&i.nodeName==="BODY"||i.nodeName==="HTML"?s=i:s.appendChild(i);else{if(!oe&&!se&&!K&&l.indexOf("<")===-1)return d&&Se?d.createHTML(l):l;if(s=wt(l),!s)return oe?null:Se?F:""}s&&He&&G(s.firstChild);let A=xt(ue?l:s);for(;g=A.nextNode();)Ot(g),It(g),g.content instanceof c&&gn(g.content);if(ue)return l;if(oe){if(be)for(O=te.call(s.ownerDocument);s.firstChild;)O.appendChild(s.firstChild);else O=s;return(S.shadowroot||S.shadowrootmode)&&(O=M.call(r,O,!0)),O}let v=K?s.outerHTML:s.innerHTML;return K&&R["!doctype"]&&s.ownerDocument&&s.ownerDocument.doctype&&s.ownerDocument.doctype.name&&D(jt,s.ownerDocument.doctype.name)&&(v="<!DOCTYPE "+s.ownerDocument.doctype.name+`>
2
- `+v),se&&De([ne,fe,ye],j=>{v=ge(v,j," ")}),d&&Se?d.createHTML(v):v},t.setConfig=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ye(l),Ge=!0},t.clearConfig=function(){le=null,Ge=!1},t.isValidAttribute=function(l,e,s){le||Ye({});let i=b(l),g=b(e);return Dt(i,g,s)},t.addHook=function(l,e){typeof e=="function"&&he(y[l],e)},t.removeHook=function(l,e){if(e!==void 0){let s=An(y[l],e);return s===-1?void 0:yn(y[l],s,1)[0]}return Ut(y[l])},t.removeHooks=function(l){y[l]=[]},t.removeAllHooks=function(){y=Ht()},t}var st=Yt();var Xt=/^[\w+/=-]+$/;var ve=/data:[\w#&+./;=-]*,/,ot=/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]+$/,rt=/(?:java|vb)script/,Me=/(?:java|vb)script|blob/,it=/%(?:22|27|3C|3E)|[\x22\x27<>]/,Jt=/^%[\dA-F]{2}$/i;var H=n=>Object.prototype.toString.call(n).slice(8,-1),x=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","i0","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-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","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","wasm","wasm-js","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(!x(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=>{x(n)&&Jt.test(n)&&(n=n.toUpperCase());let[t,o,r,a,c,p]=["&","#","<",">",'"',"'"].map(tn),u;return n===t?u=`${t}amp;`:n===r?u=`${t}lt;`:n===a?u=`${t}gt;`:n===c?u=`${t}quot;`:n===p?u=`${t}${o}39;`:u=n,u},sn=n=>{if(x(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),a;return o.every(c=>r.has(c))?a=t.replace(/\s/g,tn):a=n,a},at=(n,t=0)=>{if(!x(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),a=[...o.matchAll(Vt)].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]=[o.substring(0,L),o.substring(L+p.length)];r.has(E)?(o=`${h}${String.fromCharCode(E)}${m}`,(/#x?$/.test(h)||/^#(?:x(?:00)?[2-7]|\d)/.test(m))&&(o=at(o,++t))):E<256&&(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(x(t)){if(rt.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(x(t))try{let{protocol:r}=new URL(t),a=r.replace(/:$/,""),c=a.split("+");o=!rt.test(a)&&Qt.test(a)||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 lt=class extends Pe{#e;#t;constructor(){super(),this.#e=0,this.#t=new Set}replace(t){if(!x(t))throw new TypeError(`Expected String but got ${H(t)}.`);let o=t;if(ve.test(o)){let a=[...o.matchAll(qt)].reverse();for(let c of a){let[p]=c;ot.test(p)&&([p]=ot.exec(p)),this.#e++,this.#t.add(p);let u=this.sanitize(p,{allow:["data"]}),{index:E}=c,[L,h]=[o.substring(0,E),o.substring(E+p.length)];u?o=`${L}${u}${h}`:o=`${L}${h}`}}return o}purify(t){if(!x(t))throw new TypeError(`Expected String but got ${H(t)}.`);let o=st.sanitize(decodeURIComponent(t));return o&&ve.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:a,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(x(T)&&(T=T.trim(),!Me.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(x(m)&&(m=m.trim(),!Me.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:$,search:N}=new URL(t),X=$.replace(/:$/,""),pe=X.split("+"),J;if(E)J=pe.every(P=>p.get(P));else for(let[P,k]of p.entries())if(J=k||X!==P&&pe.every(d=>d!==P),!J)break;if(J){let P=pe.includes("data"),k,d=m;if(P){let[F,...V]=T.split(","),ee=`${V.join(",")}${N}${h}`,te=F.split(";"),Ae=te[te.length-1]==="base64",M=ee;Ae&&(M=sn(ee));try{let ne=at(M).trim(),{protocol:fe}=new URL(ne);fe.replace(/:$/,"").split("+").some(ke=>Me.test(ke))&&(d="")}catch{}let y=ve.test(M);M!==ee||y?y?M=this.replace(M):this.#t.has(t)?this.#t.delete(t):k=!0:this.#t.has(t)?this.#t.delete(t):k=!0,(!F||Kt.test(F))&&(M=this.purify(M)),d&&M?(Ae&&M!==ee&&te.pop(),d=`${X}:${te.join(";")},${M}`):d=""}else k=!0;if(!P&&it.test(d)){let F=it.exec(d),{index:V}=F;d=d.substring(0,V).replace(/[?&]$/,"")}d?(L=d.replace(/%26/g,nn),k&&(this.#e=0)):this.#e=0}u.size&&u.forEach(P=>{super.remove(P)})}return L||null}parse(t,o){if(!x(t))throw new TypeError(`Expected String but got ${H(t)}.`);let r=new Map([["input",t]]),a;if(this.verify(t)){let{protocol:c}=new URL(t);c==="blob:"?a=t:a=this.sanitize(t,o??{allow:["data","file"]})}if(a){let c=new URL(a),{pathname:p,protocol:u}=c,L=u.replace(/:$/,"").split("+").includes("data");if(r.set("valid",!0),L){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];x(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 lt,$n=async(n,t={allow:[],deny:[],only:[]})=>{let o;if(n&&x(n)){let r;try{let{protocol:a}=new URL(n);r=a.replace(/:$/,"")}catch{}if(r==="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)}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&&x(n)){let r;try{let{protocol:a}=new URL(n);r=a.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:Zt,setPrototypeOf:zt,isFrozen:Sn,getPrototypeOf:wn,getOwnPropertyDescriptor:xn}=Object,{freeze:M,seal:z,create:de}=Object,{apply:it,construct:at}=typeof Reflect<"u"&&Reflect;M||(M=function(t){return t});z||(z=function(t){return t});it||(it=function(t,o){for(var r=arguments.length,a=new Array(r>2?r-2:0),c=2;c<r;c++)a[c-2]=arguments[c];return t.apply(o,a)});at||(at=function(t){for(var o=arguments.length,r=new Array(o>1?o-1:0),a=1;a<o;a++)r[a-1]=arguments[a];return new t(...r)});var Re=R(Array.prototype.forEach),Ln=R(Array.prototype.lastIndexOf),Gt=R(Array.prototype.pop),be=R(Array.prototype.push),On=R(Array.prototype.splice),N=Array.isArray,xe=R(String.prototype.toLowerCase),tt=R(String.prototype.toString),Ht=R(String.prototype.match),ue=R(String.prototype.replace),Bt=R(String.prototype.indexOf),Dn=R(String.prototype.trim),In=R(Number.prototype.toString),Cn=R(Boolean.prototype.toString),$t=typeof BigInt>"u"?null:R(BigInt.prototype.toString),Wt=typeof Symbol>"u"?null:R(Symbol.prototype.toString),E=R(Object.prototype.hasOwnProperty),Se=R(Object.prototype.toString),O=R(RegExp.prototype.test),Me=Nn(TypeError);function R(n){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var o=arguments.length,r=new Array(o>1?o-1:0),a=1;a<o;a++)r[a-1]=arguments[a];return it(n,t,r)}}function Nn(n){return function(){for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return at(n,o)}}function p(n,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xe;if(zt&&zt(n,null),!N(t))return n;let r=t.length;for(;r--;){let a=t[r];if(typeof a=="string"){let c=o(a);c!==a&&(Sn(t)||(t[r]=c),a=c)}n[a]=!0}return n}function Mn(n){for(let t=0;t<n.length;t++)E(n,t)||(n[t]=null);return n}function U(n){let t=de(null);for(let[o,r]of Zt(n))E(n,o)&&(N(r)?t[o]=Mn(r):r&&typeof r=="object"&&r.constructor===Object?t[o]=U(r):t[o]=r);return t}function vn(n){switch(typeof n){case"string":return n;case"number":return In(n);case"boolean":return Cn(n);case"bigint":return $t?$t(n):"0";case"symbol":return Wt?Wt(n):"Symbol()";case"undefined":return Se(n);case"function":case"object":{if(n===null)return Se(n);let t=n,o=he(t,"toString");if(typeof o=="function"){let r=o(t);return typeof r=="string"?r:Se(r)}return Se(n)}default:return Se(n)}}function he(n,t){for(;n!==null;){let r=xn(n,t);if(r){if(r.get)return R(r.get);if(typeof r.value=="function")return R(r.value)}n=wn(n)}function o(){return null}return o}function Un(n){try{return O(n,""),!0}catch{return!1}}var jt=M(["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"]),nt=M(["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"]),st=M(["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"]),Pn=M(["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"]),ot=M(["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"]),kn=M(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Yt=M(["#text"]),Xt=M(["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"]),rt=M(["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"]),qt=M(["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"]),ve=M(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Fn=z(/\{\{[\w\W]*|[\w\W]*\}\}/gm),zn=z(/<%[\w\W]*|[\w\W]*%>/gm),Gn=z(/\$\{[\w\W]*/gm),Hn=z(/^data-[\-\w.\u00B7-\uFFFF]+$/),Bn=z(/^aria-[\-\w]+$/),Qt=z(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),$n=z(/^(?:\w+script|data):/i),Wn=z(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Jt=z(/^html$/i),jn=z(/^[a-z][.\w]*(-[.\w]+)+$/i),Vt=Object.freeze({__proto__:null,ARIA_ATTR:Bn,ATTR_WHITESPACE:Wn,CUSTOM_ELEMENT:jn,DATA_ATTR:Hn,DOCTYPE_NAME:Jt,ERB_EXPR:zn,IS_ALLOWED_URI:Qt,IS_SCRIPT_OR_DATA:$n,MUSTACHE_EXPR:Fn,TMPLIT_EXPR:Gn}),we={element:1,text:3,progressingInstruction:7,comment:8,document:9},Yn=function(){return typeof window>"u"?null:window},Xn=function(t,o){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null,a="data-tt-policy-suffix";o&&o.hasAttribute(a)&&(r=o.getAttribute(a));let c="dompurify"+(r?"#"+r:"");try{return t.createPolicy(c,{createHTML(f){return f},createScriptURL(f){return f}})}catch{return console.warn("TrustedTypes policy "+c+" could not be created."),null}},Kt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function en(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Yn(),t=l=>en(l);if(t.version="3.4.2",t.removed=[],!n||!n.document||n.document.nodeType!==we.document||!n.Element)return t.isSupported=!1,t;let{document:o}=n,r=o,a=r.currentScript,{DocumentFragment:c,HTMLTemplateElement:f,Node:u,Element:T,NodeFilter:I,NamedNodeMap:g=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:m,DOMParser:_,trustedTypes:q}=n,k=T.prototype,K=he(k,"cloneNode"),ge=he(k,"remove"),re=he(k,"nextSibling"),G=he(k,"childNodes"),H=he(k,"parentNode");if(typeof f=="function"){let l=o.createElement("template");l.content&&l.content.ownerDocument&&(o=l.content.ownerDocument)}let d,B="",{implementation:J,createNodeIterator:ie,createDocumentFragment:ae,getElementsByTagName:Le}=o,{importNode:P}=r,S=Kt();t.isSupported=typeof Zt=="function"&&typeof H=="function"&&J&&J.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:ee,ERB_EXPR:le,TMPLIT_EXPR:Te,DATA_ATTR:Ge,ARIA_ATTR:dn,IS_SCRIPT_OR_DATA:hn,ATTR_WHITESPACE:dt,CUSTOM_ELEMENT:gn}=Vt,{IS_ALLOWED_URI:ht}=Vt,w=null,gt=p({},[...jt,...nt,...st,...ot,...Yt]),L=null,Tt=p({},[...Xt,...rt,...qt,...ve]),A=Object.seal(de(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}})),Ee=null,Oe=null,Z=Object.seal(de(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Et=!0,He=!0,_t=!1,At=!0,te=!1,_e=!0,ne=!1,Be=!1,$e=!1,ce=!1,De=!1,Ie=!1,yt=!0,Rt=!1,bt="user-content-",We=!0,Ae=!1,pe={},j=null,je=p({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),St=null,wt=p({},["audio","video","img","source","image","track"]),Ye=null,xt=p({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ce="http://www.w3.org/1998/Math/MathML",Ne="http://www.w3.org/2000/svg",Y="http://www.w3.org/1999/xhtml",fe=Y,Xe=!1,qe=null,Tn=p({},[Ce,Ne,Y],tt),Ve=p({},["mi","mo","mn","ms","mtext"]),Ke=p({},["annotation-xml"]),En=p({},["title","style","font","a","script"]),ye=null,_n=["application/xhtml+xml","text/html"],An="text/html",b=null,me=null,yn=o.createElement("form"),Lt=function(e){return e instanceof RegExp||e instanceof Function},Ze=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(me&&me===e)return;(!e||typeof e!="object")&&(e={}),e=U(e),ye=_n.indexOf(e.PARSER_MEDIA_TYPE)===-1?An:e.PARSER_MEDIA_TYPE,b=ye==="application/xhtml+xml"?tt:xe,w=E(e,"ALLOWED_TAGS")&&N(e.ALLOWED_TAGS)?p({},e.ALLOWED_TAGS,b):gt,L=E(e,"ALLOWED_ATTR")&&N(e.ALLOWED_ATTR)?p({},e.ALLOWED_ATTR,b):Tt,qe=E(e,"ALLOWED_NAMESPACES")&&N(e.ALLOWED_NAMESPACES)?p({},e.ALLOWED_NAMESPACES,tt):Tn,Ye=E(e,"ADD_URI_SAFE_ATTR")&&N(e.ADD_URI_SAFE_ATTR)?p(U(xt),e.ADD_URI_SAFE_ATTR,b):xt,St=E(e,"ADD_DATA_URI_TAGS")&&N(e.ADD_DATA_URI_TAGS)?p(U(wt),e.ADD_DATA_URI_TAGS,b):wt,j=E(e,"FORBID_CONTENTS")&&N(e.FORBID_CONTENTS)?p({},e.FORBID_CONTENTS,b):je,Ee=E(e,"FORBID_TAGS")&&N(e.FORBID_TAGS)?p({},e.FORBID_TAGS,b):U({}),Oe=E(e,"FORBID_ATTR")&&N(e.FORBID_ATTR)?p({},e.FORBID_ATTR,b):U({}),pe=E(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?U(e.USE_PROFILES):e.USE_PROFILES:!1,Et=e.ALLOW_ARIA_ATTR!==!1,He=e.ALLOW_DATA_ATTR!==!1,_t=e.ALLOW_UNKNOWN_PROTOCOLS||!1,At=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,te=e.SAFE_FOR_TEMPLATES||!1,_e=e.SAFE_FOR_XML!==!1,ne=e.WHOLE_DOCUMENT||!1,ce=e.RETURN_DOM||!1,De=e.RETURN_DOM_FRAGMENT||!1,Ie=e.RETURN_TRUSTED_TYPE||!1,$e=e.FORCE_BODY||!1,yt=e.SANITIZE_DOM!==!1,Rt=e.SANITIZE_NAMED_PROPS||!1,We=e.KEEP_CONTENT!==!1,Ae=e.IN_PLACE||!1,ht=Un(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Qt,fe=typeof e.NAMESPACE=="string"?e.NAMESPACE:Y,Ve=E(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS=="object"?U(e.MATHML_TEXT_INTEGRATION_POINTS):p({},["mi","mo","mn","ms","mtext"]),Ke=E(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS=="object"?U(e.HTML_INTEGRATION_POINTS):p({},["annotation-xml"]);let s=E(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING=="object"?U(e.CUSTOM_ELEMENT_HANDLING):de(null);if(A=de(null),E(s,"tagNameCheck")&&Lt(s.tagNameCheck)&&(A.tagNameCheck=s.tagNameCheck),E(s,"attributeNameCheck")&&Lt(s.attributeNameCheck)&&(A.attributeNameCheck=s.attributeNameCheck),E(s,"allowCustomizedBuiltInElements")&&typeof s.allowCustomizedBuiltInElements=="boolean"&&(A.allowCustomizedBuiltInElements=s.allowCustomizedBuiltInElements),te&&(He=!1),De&&(ce=!0),pe&&(w=p({},Yt),L=de(null),pe.html===!0&&(p(w,jt),p(L,Xt)),pe.svg===!0&&(p(w,nt),p(L,rt),p(L,ve)),pe.svgFilters===!0&&(p(w,st),p(L,rt),p(L,ve)),pe.mathMl===!0&&(p(w,ot),p(L,qt),p(L,ve))),Z.tagCheck=null,Z.attributeCheck=null,E(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?Z.tagCheck=e.ADD_TAGS:N(e.ADD_TAGS)&&(w===gt&&(w=U(w)),p(w,e.ADD_TAGS,b))),E(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?Z.attributeCheck=e.ADD_ATTR:N(e.ADD_ATTR)&&(L===Tt&&(L=U(L)),p(L,e.ADD_ATTR,b))),E(e,"ADD_URI_SAFE_ATTR")&&N(e.ADD_URI_SAFE_ATTR)&&p(Ye,e.ADD_URI_SAFE_ATTR,b),E(e,"FORBID_CONTENTS")&&N(e.FORBID_CONTENTS)&&(j===je&&(j=U(j)),p(j,e.FORBID_CONTENTS,b)),E(e,"ADD_FORBID_CONTENTS")&&N(e.ADD_FORBID_CONTENTS)&&(j===je&&(j=U(j)),p(j,e.ADD_FORBID_CONTENTS,b)),We&&(w["#text"]=!0),ne&&p(w,["html","head","body"]),w.table&&(p(w,["tbody"]),delete Ee.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw Me('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Me('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');d=e.TRUSTED_TYPES_POLICY,B=d.createHTML("")}else d===void 0&&(d=Xn(q,a)),d!==null&&typeof B=="string"&&(B=d.createHTML(""));M&&M(e),me=e},Ot=p({},[...nt,...st,...Pn]),Dt=p({},[...ot,...kn]),Rn=function(e){let s=H(e);(!s||!s.tagName)&&(s={namespaceURI:fe,tagName:"template"});let i=xe(e.tagName),h=xe(s.tagName);return qe[e.namespaceURI]?e.namespaceURI===Ne?s.namespaceURI===Y?i==="svg":s.namespaceURI===Ce?i==="svg"&&(h==="annotation-xml"||Ve[h]):!!Ot[i]:e.namespaceURI===Ce?s.namespaceURI===Y?i==="math":s.namespaceURI===Ne?i==="math"&&Ke[h]:!!Dt[i]:e.namespaceURI===Y?s.namespaceURI===Ne&&!Ke[h]||s.namespaceURI===Ce&&!Ve[h]?!1:!Dt[i]&&(En[i]||!Ot[i]):!!(ye==="application/xhtml+xml"&&qe[e.namespaceURI]):!1},$=function(e){be(t.removed,{element:e});try{H(e).removeChild(e)}catch{ge(e)}},se=function(e,s){try{be(t.removed,{attribute:s.getAttributeNode(e),from:s})}catch{be(t.removed,{attribute:null,from:s})}if(s.removeAttribute(e),e==="is")if(ce||De)try{$(s)}catch{}else try{s.setAttribute(e,"")}catch{}},It=function(e){let s=null,i=null;if($e)e="<remove></remove>"+e;else{let y=Ht(e,/^[\r\n\t ]+/);i=y&&y[0]}ye==="application/xhtml+xml"&&fe===Y&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let h=d?d.createHTML(e):e;if(fe===Y)try{s=new _().parseFromString(h,ye)}catch{}if(!s||!s.documentElement){s=J.createDocument(fe,"template",null);try{s.documentElement.innerHTML=Xe?B:h}catch{}}let C=s.body||s.documentElement;return e&&i&&C.insertBefore(o.createTextNode(i),C.childNodes[0]||null),fe===Y?Le.call(s,ne?"html":"body")[0]:ne?s.documentElement:C},Ct=function(e){return ie.call(e.ownerDocument||e,e,I.SHOW_ELEMENT|I.SHOW_COMMENT|I.SHOW_TEXT|I.SHOW_PROCESSING_INSTRUCTION|I.SHOW_CDATA_SECTION,null)},Qe=function(e){return e instanceof m&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof g)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},Je=function(e){return typeof u=="function"&&e instanceof u};function V(l,e,s){Re(l,i=>{i.call(t,e,s,me)})}let Nt=function(e){let s=null;if(V(S.beforeSanitizeElements,e,null),Qe(e))return $(e),!0;let i=b(e.nodeName);if(V(S.uponSanitizeElement,e,{tagName:i,allowedTags:w}),_e&&e.hasChildNodes()&&!Je(e.firstElementChild)&&O(/<[/\w!]/g,e.innerHTML)&&O(/<[/\w!]/g,e.textContent)||_e&&e.namespaceURI===Y&&i==="style"&&Je(e.firstElementChild)||e.nodeType===we.progressingInstruction||_e&&e.nodeType===we.comment&&O(/<[/\w]/g,e.data))return $(e),!0;if(Ee[i]||!(Z.tagCheck instanceof Function&&Z.tagCheck(i))&&!w[i]){if(!Ee[i]&&vt(i)&&(A.tagNameCheck instanceof RegExp&&O(A.tagNameCheck,i)||A.tagNameCheck instanceof Function&&A.tagNameCheck(i)))return!1;if(We&&!j[i]){let h=H(e)||e.parentNode,C=G(e)||e.childNodes;if(C&&h){let y=C.length;for(let v=y-1;v>=0;--v){let F=K(C[v],!0);h.insertBefore(F,re(e))}}}return $(e),!0}return e instanceof T&&!Rn(e)||(i==="noscript"||i==="noembed"||i==="noframes")&&O(/<\/no(script|embed|frames)/i,e.innerHTML)?($(e),!0):(te&&e.nodeType===we.text&&(s=e.textContent,Re([ee,le,Te],h=>{s=ue(s,h," ")}),e.textContent!==s&&(be(t.removed,{element:e.cloneNode()}),e.textContent=s)),V(S.afterSanitizeElements,e,null),!1)},Mt=function(e,s,i){if(Oe[s]||yt&&(s==="id"||s==="name")&&(i in o||i in yn))return!1;let h=L[s]||Z.attributeCheck instanceof Function&&Z.attributeCheck(s,e);if(!(He&&!Oe[s]&&O(Ge,s))){if(!(Et&&O(dn,s))){if(!h||Oe[s]){if(!(vt(e)&&(A.tagNameCheck instanceof RegExp&&O(A.tagNameCheck,e)||A.tagNameCheck instanceof Function&&A.tagNameCheck(e))&&(A.attributeNameCheck instanceof RegExp&&O(A.attributeNameCheck,s)||A.attributeNameCheck instanceof Function&&A.attributeNameCheck(s,e))||s==="is"&&A.allowCustomizedBuiltInElements&&(A.tagNameCheck instanceof RegExp&&O(A.tagNameCheck,i)||A.tagNameCheck instanceof Function&&A.tagNameCheck(i))))return!1}else if(!Ye[s]){if(!O(ht,ue(i,dt,""))){if(!((s==="src"||s==="xlink:href"||s==="href")&&e!=="script"&&Bt(i,"data:")===0&&St[e])){if(!(_t&&!O(hn,ue(i,dt,"")))){if(i)return!1}}}}}}return!0},bn=p({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),vt=function(e){return!bn[xe(e)]&&O(gn,e)},Ut=function(e){V(S.beforeSanitizeAttributes,e,null);let{attributes:s}=e;if(!s||Qe(e))return;let i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:L,forceKeepAttr:void 0},h=s.length;for(;h--;){let C=s[h],{name:y,namespaceURI:v,value:F}=C,W=b(y),et=F,x=y==="value"?et:Dn(et);if(i.attrName=W,i.attrValue=x,i.keepAttr=!0,i.forceKeepAttr=void 0,V(S.uponSanitizeAttribute,e,i),x=i.attrValue,Rt&&(W==="id"||W==="name")&&Bt(x,bt)!==0&&(se(y,e),x=bt+x),_e&&O(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,x)){se(y,e);continue}if(W==="attributename"&&Ht(x,"href")){se(y,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){se(y,e);continue}if(!At&&O(/\/>/i,x)){se(y,e);continue}te&&Re([ee,le,Te],Ft=>{x=ue(x,Ft," ")});let kt=b(e.nodeName);if(!Mt(kt,W,x)){se(y,e);continue}if(d&&typeof q=="object"&&typeof q.getAttributeType=="function"&&!v)switch(q.getAttributeType(kt,W)){case"TrustedHTML":{x=d.createHTML(x);break}case"TrustedScriptURL":{x=d.createScriptURL(x);break}}if(x!==et)try{v?e.setAttributeNS(v,y,x):e.setAttribute(y,x),Qe(e)?$(e):Gt(t.removed)}catch{se(y,e)}}V(S.afterSanitizeAttributes,e,null)},Pt=function(e){let s=null,i=Ct(e);for(V(S.beforeSanitizeShadowDOM,e,null);s=i.nextNode();)V(S.uponSanitizeShadowNode,s,null),Nt(s),Ut(s),s.content instanceof c&&Pt(s.content);V(S.afterSanitizeShadowDOM,e,null)};return t.sanitize=function(l){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=null,i=null,h=null,C=null;if(Xe=!l,Xe&&(l="<!-->"),typeof l!="string"&&!Je(l)&&(l=vn(l),typeof l!="string"))throw Me("dirty is not a string, aborting");if(!t.isSupported)return l;if(Be||Ze(e),t.removed=[],typeof l=="string"&&(Ae=!1),Ae){let F=l.nodeName;if(typeof F=="string"){let W=b(F);if(!w[W]||Ee[W])throw Me("root node is forbidden and cannot be sanitized in-place")}}else if(l instanceof u)s=It("<!---->"),i=s.ownerDocument.importNode(l,!0),i.nodeType===we.element&&i.nodeName==="BODY"||i.nodeName==="HTML"?s=i:s.appendChild(i);else{if(!ce&&!te&&!ne&&l.indexOf("<")===-1)return d&&Ie?d.createHTML(l):l;if(s=It(l),!s)return ce?null:Ie?B:""}s&&$e&&$(s.firstChild);let y=Ct(Ae?l:s);for(;h=y.nextNode();)Nt(h),Ut(h),h.content instanceof c&&Pt(h.content);if(Ae)return l;if(ce){if(te){s.normalize();let F=s.innerHTML;Re([ee,le,Te],W=>{F=ue(F,W," ")}),s.innerHTML=F}if(De)for(C=ae.call(s.ownerDocument);s.firstChild;)C.appendChild(s.firstChild);else C=s;return(L.shadowroot||L.shadowrootmode)&&(C=P.call(r,C,!0)),C}let v=ne?s.outerHTML:s.innerHTML;return ne&&w["!doctype"]&&s.ownerDocument&&s.ownerDocument.doctype&&s.ownerDocument.doctype.name&&O(Jt,s.ownerDocument.doctype.name)&&(v="<!DOCTYPE "+s.ownerDocument.doctype.name+`>
2
+ `+v),te&&Re([ee,le,Te],F=>{v=ue(v,F," ")}),d&&Ie?d.createHTML(v):v},t.setConfig=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ze(l),Be=!0},t.clearConfig=function(){me=null,Be=!1},t.isValidAttribute=function(l,e,s){me||Ze({});let i=b(l),h=b(e);return Mt(i,h,s)},t.addHook=function(l,e){typeof e=="function"&&be(S[l],e)},t.removeHook=function(l,e){if(e!==void 0){let s=Ln(S[l],e);return s===-1?void 0:On(S[l],s,1)[0]}return Gt(S[l])},t.removeHooks=function(l){S[l]=[]},t.removeAllHooks=function(){S=Kt()},t}var lt=en();var tn=/^[\w+/=-]+$/;var Ue=/data:[\w#&+./;=-]*,/,ct=/data:[\w#&+./;=^]*base64,[\w+/=-]+/i,nn=/data:[\w#&+./;=-]*,[^\x22]+/g,sn=/&#(x(?:00)?[\dA-F]{2}|0?\d{1,3});?/gi,on=/^(?:application\/(?:[\w#&.;-]+\+)?x|image\/svg\+x|text\/(?:ht|x))ml;?/;var rn=/^[a-z][\da-z+.-]*$/,an=/^(?:ext|web)\+[a-z]+$/,pt=/(?:java|vb)script/,Pe=/(?:java|vb)script|blob/,ft=/%(?:22|27|3C|3E)|[\x22\x27<>]/,ln=/^%[\dA-F]{2}$/i;var X=n=>Object.prototype.toString.call(n).slice(8,-1),D=n=>typeof n=="string"||n instanceof String;var{FileReader:cn}=globalThis;var ke=[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","agtp","aim","amss","android","appdata","apt","ar","ari","ark","at","attachment","aw","barion","beshare","bitcoin","bitcoincash","bl","blob","bluetooth","bolo","brid","browserext","cabal","caip","calculator","callto","cap","cast","casts","chrome","chrome-extension","cid","coap","coaps","com-eventbrite-attendee","content","content-type","crid","cstr","cvs","dab","dat","data","dav","dhttp","diaspora","dict","did","dilithium3","dis","dlna-playcontainer","dlna-playsingle","dnp","dns","dntp","doi","donau","dpp","drm","dtmi","dtn","dvb","dvx","dweb","ed2k","eid","elsi","embedded","ens","esim","ethereum","example","facetime","feed","feedready","fido","file","finger","first-run-pen-experience","fish","fm","ftp","fuchsia-pkg","geo","gg","git","gitoid","gizmoproject","go","gopher","graph","gtalk","h323","ham","hcap","hcp","hs20","http","https","hxxp","hxxps","hydrazone","hyper","i0","iax","ibi","ibi-","icap","icon","ilstring","im","imap","info","iotdisco","ipfs","ipn","ipns","ipp","ipps","irc","irc6","ircs","iris","iris.beep","iris.lwz","iris.xpc","iris.xpcs","isostore","itms","jabber","jar","jms","keyparc","lastfm","lbry","ldap","ldaps","leaptofrogans","lid","linkid","lorawan","lpa","lvlt","machineProvisioningProgressReporter","magnet","mailto","maps","market","matrix","message","microsoft.windows.camera","microsoft.windows.camera.multipicker","microsoft.windows.camera.picker","mid","mms","mongodb","moz","moz-extension","mqtt","mqtts","ms-access","ms-appinstaller","ms-browser-extension","ms-calculator","ms-drive-to","ms-enrollment","ms-excel","ms-eyecontrolspeech","ms-gamebarservices","ms-gamingoverlay","ms-getoffice","ms-help","ms-infopath","ms-inputapp","ms-launchremotedesktop","ms-lockscreencomponent-config","ms-media-stream-id","ms-meetnow","ms-mixedrealitycapture","ms-mobileplans","ms-newsandinterests","ms-officeapp","ms-people","ms-personacard","ms-powerpoint","ms-project","ms-publisher","ms-recall","ms-remotedesktop","ms-remotedesktop-launch","ms-restoretabcompanion","ms-screenclip","ms-screensketch","ms-search","ms-search-repair","ms-secondary-screen-controller","ms-secondary-screen-setup","ms-settings","ms-settings-airplanemode","ms-settings-bluetooth","ms-settings-camera","ms-settings-cellular","ms-settings-cloudstorage","ms-settings-connectabledevices","ms-settings-displays-topology","ms-settings-emailandaccounts","ms-settings-language","ms-settings-location","ms-settings-lock","ms-settings-nfctransactions","ms-settings-notifications","ms-settings-power","ms-settings-privacy","ms-settings-proximity","ms-settings-screenrotation","ms-settings-wifi","ms-settings-workplace","ms-spd","ms-stickers","ms-sttoverlay","ms-transit-to","ms-useractivityset","ms-uup","ms-virtualtouchpad","ms-visio","ms-walk-to","ms-whiteboard","ms-whiteboard-cmd","ms-widgetboard","ms-widgets","ms-word","msnim","msrp","msrps","mss","mt","mtqp","mtrust","mumble","mupdate","mvn","mvrp","mvrps","news","nfs","ni","nih","nntp","notes","num","ocf","oid","onenote","onenote-cmd","opaquelocktoken","openid","openpgp4fpr","otpauth","palm","paparazzi","payto","pkcs11","platform","pop","pres","proxy","psyc","pttp","pwid","qb","query","quic-transport","redis","rediss","reload","res","resource","rmi","rsync","rtmfp","rtmp","rtsp","rtsps","rtspu","sarif","secondlife","secret-token","service","session","sftp","sgn","shc","shelter","sieve","simpleledger","simplex","sip","sips","skype","smb","smp","sms","smtp","snmp","soap.beep","soap.beeps","soldat","spacify","spiffe","spotify","ssb","ssh","starknet","steam","stun","stuns","submit","svn","swh","swid","swidpath","tag","taler","teamspeak","teapot","teapots","tel","teliaeid","telnet","tftp","things","thismessage","tip","tn3270","tool","turn","turns","tv","udp","unreal","upn","urn","ut2004","uuid-in-package","v-event","vemmi","ventrilo","ves","view-source","vnc","vscode","vscode-insiders","vsls","w3","wasm","wasm-js","wcr","web3","webcal","wifi","ws","wss","wtai","wyciwyg","xcompute","xcon","xcon-userid","xfire","xftp","xmlrpc.beep","xmlrpc.beeps","xmpp","xrcp","xri","ymsgr","z39.50r","z39.50s"];var pn=n=>{if(!D(n))throw new TypeError(`Expected String but got ${X(n)}.`);let t=[];for(let o of n)t.push(`%${o.charCodeAt(0).toString(16).toUpperCase()}`);return t.join("")},fn=n=>{D(n)&&ln.test(n)&&(n=n.toUpperCase());let[t,o,r,a,c,f]=["&","#","<",">",'"',"'"].map(pn),u;return n===t?u=`${t}amp;`:n===r?u=`${t}lt;`:n===a?u=`${t}gt;`:n===c?u=`${t}quot;`:n===f?u=`${t}${o}39;`:u=n,u},mn=n=>{if(D(n)){if(!tn.test(n))throw new Error(`Invalid base64 data: ${n}`)}else throw new TypeError(`Expected String but got ${X(n)}.`);let t=atob(n),o=Uint8Array.from([...t].map(c=>c.charCodeAt(0))),r=new Set(ke),a;return o.every(c=>r.has(c))?a=t.replace(/\s/g,pn):a=n,a},mt=(n,t=0)=>{if(!D(n))throw new TypeError(`Expected String but got ${X(n)}.`);if(Number.isInteger(t)){if(t>16)throw new Error("Character references nested too deeply.")}else throw new TypeError(`Expected Number but got ${X(t)}.`);let o=decodeURIComponent(n);if(/&#/.test(o)){let r=new Set(ke),a=[...o.matchAll(sn)].reverse();for(let c of a){let[f,u]=c,T;if(/^x[\dA-F]+/i.test(u)?T=parseInt(`0${u}`,16):/^\d+/.test(u)&&(T=parseInt(u)),Number.isInteger(T)){let{index:I}=c,[g,m]=[o.substring(0,I),o.substring(I+f.length)];r.has(T)?(o=`${g}${String.fromCharCode(T)}${m}`,(/#x?$/.test(g)||/^#(?:x(?:00)?[2-7]|\d)/.test(m))&&(o=mt(o,++t))):T<256&&(o=`${g}${m}`)}}}return o},un=n=>new Promise((t,o)=>{let r=new cn;r.addEventListener("error",()=>o(r.error)),r.addEventListener("abort",()=>t(r.result)),r.addEventListener("load",()=>t(r.result)),r.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(D(t)){if(pt.test(t)||!rn.test(t))throw new Error(`Invalid scheme: ${t}`)}else throw new TypeError(`Expected String but got ${X(t)}.`);return this.#e.add(t),[...this.#e]}remove(t){return this.#e.delete(t)}verify(t){let o;if(D(t))try{let{protocol:r}=new URL(t),a=r.replace(/:$/,""),c=a.split("+");o=!pt.test(a)&&an.test(a)||c.every(f=>this.#e.has(f))}catch{o=!1}return!!o}reset(){this.#e.clear();for(let t of Fe)this.#e.add(t)}};var ut=class extends ze{#e;#t;constructor(){super(),this.#e=0,this.#t=new Set}replace(t){if(!D(t))throw new TypeError(`Expected String but got ${X(t)}.`);let o=t;if(Ue.test(o)){let a=[...o.matchAll(nn)].reverse();for(let c of a){let[f]=c;ct.test(f)&&([f]=ct.exec(f)),this.#e++,this.#t.add(f);let u=this.sanitize(f,{allow:["data"]}),{index:T}=c,[I,g]=[o.substring(0,T),o.substring(T+f.length)];u?o=`${I}${u}${g}`:o=`${I}${g}`}}return o}purify(t){if(!D(t))throw new TypeError(`Expected String but got ${X(t)}.`);let o=lt.sanitize(decodeURIComponent(t));return o&&Ue.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:a,only:c}=o??{},f=new Map([["blob",!1],["data",!1],["file",!1],["javascrpt",!1],["vbscript",!1]]),u=new Set,T=!1;if(Array.isArray(c)&&c.length){let g=super.get();for(let _ of g)f.set(_,!1);let m=Object.values(c);for(let _ of m)if(D(_)&&(_=_.trim(),!Pe.test(_))){if(super.has(_))f.set(_,!0);else{try{super.add(_)}catch{}super.has(_)&&(f.set(_,!0),u.add(_))}!T&&f.has(_)&&(T=f.get(_))}}else{if(Array.isArray(r)&&r.length){let g=Object.values(r);for(let m of g)if(D(m)&&(m=m.trim(),!Pe.test(m)))if(super.has(m))f.set(m,!0);else{try{super.add(m)}catch{}super.has(m)&&(f.set(m,!0),u.add(m))}}if(Array.isArray(a)&&a.length){let g=Object.values(a);for(let m of g)D(m)&&(m=m.trim(),m&&f.set(m,!1))}}let I;if(super.verify(t)){let{hash:g,href:m,pathname:_,protocol:q,search:k}=new URL(t),K=q.replace(/:$/,""),ge=K.split("+"),re;if(T)re=ge.every(G=>f.get(G));else for(let[G,H]of f.entries())if(re=H||K!==G&&ge.every(d=>d!==G),!re)break;if(re){let G=ge.includes("data"),H,d=m;if(G){let[B,...J]=_.split(","),ie=`${J.join(",")}${k}${g}`,ae=B.split(";"),Le=ae[ae.length-1]==="base64",P=ie;Le&&(P=mn(ie));try{let ee=mt(P).trim(),{protocol:le}=new URL(ee);le.replace(/:$/,"").split("+").some(Ge=>Pe.test(Ge))&&(d="")}catch{}let S=Ue.test(P);P!==ie||S?S?P=this.replace(P):this.#t.has(t)?this.#t.delete(t):H=!0:this.#t.has(t)?this.#t.delete(t):H=!0,(!B||on.test(B))&&(P=this.purify(P)),d&&P?(Le&&P!==ie&&ae.pop(),d=`${K}:${ae.join(";")},${P}`):d=""}else H=!0;if(!G&&ft.test(d)){let B=ft.exec(d),{index:J}=B;d=d.substring(0,J).replace(/[?&]$/,"")}d?(I=d.replace(/%26/g,fn),H&&(this.#e=0)):this.#e=0}u.size&&u.forEach(G=>{super.remove(G)})}return I||null}parse(t,o){if(!D(t))throw new TypeError(`Expected String but got ${X(t)}.`);let r=new Map([["input",t]]),a;if(this.verify(t)){let{protocol:c}=new URL(t);c==="blob:"?a=t:a=this.sanitize(t,o??{allow:["data","file"]})}if(a){let c=new URL(a),{pathname:f,protocol:u}=c,I=u.replace(/:$/,"").split("+").includes("data");if(r.set("valid",!0),I){let g=new Map,[m,..._]=f.split(","),q=`${_.join(",")}`,k=m.split(";"),K=k[k.length-1]==="base64";K&&k.pop(),g.set("mime",k.join(";")),g.set("base64",K),g.set("data",q),r.set("data",Object.fromEntries(g))}else r.set("data",null);for(let g in c){let m=c[g];D(m)&&r.set(g,m)}}else r.set("valid",!1);return Object.fromEntries(r)}reset(){super.reset(),this.#e=0,this.#t.clear()}},Q=new ut,Qn=async(n,t={allow:[],deny:[],only:[]})=>{let o;if(n&&D(n)){let r;try{let{protocol:a}=new URL(n);r=a.replace(/:$/,"")}catch{}if(r==="blob"){let{allow:a,deny:c,only:f}=t;if(Array.isArray(a)&&a.includes("blob")&&!(Array.isArray(c)&&c.includes("blob"))||Array.isArray(f)&&f.includes("blob")){let u;try{u=await fetch(n).then(T=>T.blob()).then(un)}catch{}if(u){if(Array.isArray(f))f.includes("data")||f.push("data");else if(Array.isArray(a)&&(a.includes("data")||a.push("data"),Array.isArray(c)&&c.includes("data"))){let T=c.indexOf("data");c.splice(T,1)}o=Q.sanitize(u,t)}}URL.revokeObjectURL(n)}else r&&(o=Q.sanitize(n,t))}return o||null},Jn=(n,t)=>{let o;if(n&&D(n)){let r;try{let{protocol:a}=new URL(n);r=a.replace(/:$/,"")}catch{}r==="blob"?URL.revokeObjectURL(n):r&&(o=Q.sanitize(n,t))}return o||null},es=async n=>Q.parse(n),ts=n=>Q.parse(n),ns=async n=>Q.verify(n),ss=n=>Q.verify(n),os=Q;export{os as default,ns as isURI,ss as isURISync,es as parseURL,ts as parseURLSync,Qn as sanitizeURL,Jn as sanitizeURLSync};
3
3
  /*!
4
4
  * URL Sanitizer
5
5
  *
@@ -10,6 +10,6 @@ var{entries:$t,setPrototypeOf:Nt,isFrozen:En,getPrototypeOf:Tn,getOwnPropertyDes
10
10
  /*! Bundled license information:
11
11
 
12
12
  dompurify/dist/purify.es.mjs:
13
- (*! @license DOMPurify 3.2.7 | (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.7/LICENSE *)
13
+ (*! @license DOMPurify 3.4.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.4.2/LICENSE *)
14
14
  */
15
15
  //# sourceMappingURL=url-sanitizer.min.js.map