/*! @license DOMPurify 3.1.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.5/LICENSE */const{entries:pt,setPrototypeOf:at,isFrozen:zt,getPrototypeOf:Wt,getOwnPropertyDescriptor:Gt}=Object;let{freeze:A,seal:L,create:dt}=Object,{apply:be,construct:Ce}=typeof Reflect<"u"&&Reflect;A||(A=function(o){return o});L||(L=function(o){return o});be||(be=function(o,l,r){return o.apply(l,r)});Ce||(Ce=function(o,l){return new o(...l)});const oe=R(Array.prototype.forEach),rt=R(Array.prototype.pop),j=R(Array.prototype.push),re=R(String.prototype.toLowerCase),Le=R(String.prototype.toString),st=R(String.prototype.match),V=R(String.prototype.replace),Bt=R(String.prototype.indexOf),Yt=R(String.prototype.trim),O=R(Object.prototype.hasOwnProperty),h=R(RegExp.prototype.test),$=Xt(TypeError);function R(s){return function(o){for(var l=arguments.length,r=new Array(l>1?l-1:0),T=1;T<l;T++)r[T-1]=arguments[T];return be(s,o,r)}}function Xt(s){return function(){for(var o=arguments.length,l=new Array(o),r=0;r<o;r++)l[r]=arguments[r];return Ce(s,l)}}function a(s,o){let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:re;at&&at(s,null);let r=o.length;for(;r--;){let T=o[r];if(typeof T=="string"){const b=l(T);b!==T&&(zt(o)||(o[r]=b),T=b)}s[T]=!0}return s}function jt(s){for(let o=0;o<s.length;o++)O(s,o)||(s[o]=null);return s}function w(s){const o=dt(null);for(const[l,r]of pt(s))O(s,l)&&(Array.isArray(r)?o[l]=jt(r):r&&typeof r=="object"&&r.constructor===Object?o[l]=w(r):o[l]=r);return o}function ie(s,o){for(;s!==null;){const r=Gt(s,o);if(r){if(r.get)return R(r.get);if(typeof r.value=="function")return R(r.value)}s=Wt(s)}function l(){return null}return l}const lt=A(["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"]),Oe=A(["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"]),ye=A(["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"]),Vt=A(["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"]),De=A(["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"]),$t=A(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ct=A(["#text"]),ft=A(["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"]),Ne=A(["accent-height","accumulate","additive","alignment-baseline","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","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","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","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","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"]),ut=A(["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"]),ae=A(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),qt=L(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Kt=L(/<%[\w\W]*|[\w\W]*%>/gm),Zt=L(/\${[\w\W]*}/gm),Jt=L(/^data-[\-\w.\u00B7-\uFFFF]/),Qt=L(/^aria-[\-\w]+$/),Tt=L(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),en=L(/^(?:\w+script|data):/i),tn=L(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),_t=L(/^html$/i),nn=L(/^[a-z][.\w]*(-[.\w]+)+$/i);var mt=Object.freeze({__proto__:null,MUSTACHE_EXPR:qt,ERB_EXPR:Kt,TMPLIT_EXPR:Zt,DATA_ATTR:Jt,ARIA_ATTR:Qt,IS_ALLOWED_URI:Tt,IS_SCRIPT_OR_DATA:en,ATTR_WHITESPACE:tn,DOCTYPE_NAME:_t,CUSTOM_ELEMENT:nn});const q={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},on=function(){return typeof window>"u"?null:window},an=function(o,l){if(typeof o!="object"||typeof o.createPolicy!="function")return null;let r=null;const T="data-tt-policy-suffix";l&&l.hasAttribute(T)&&(r=l.getAttribute(T));const b="dompurify"+(r?"#"+r:"");try{return o.createPolicy(b,{createHTML(x){return x},createScriptURL(x){return x}})}catch{return console.warn("TrustedTypes policy "+b+" could not be created."),null}};function Et(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:on();const o=i=>Et(i);if(o.version="3.1.5",o.removed=[],!s||!s.document||s.document.nodeType!==q.document)return o.isSupported=!1,o;let{document:l}=s;const r=l,T=r.currentScript,{DocumentFragment:b,HTMLTemplateElement:x,Node:se,Element:Ie,NodeFilter:z,NamedNodeMap:gt=s.NamedNodeMap||s.MozNamedAttrMap,HTMLFormElement:ht,DOMParser:At,trustedTypes:K}=s,Z=Ie.prototype,St=ie(Z,"cloneNode"),Rt=ie(Z,"nextSibling"),Lt=ie(Z,"childNodes"),le=ie(Z,"parentNode");if(typeof x=="function"){const i=l.createElement("template");i.content&&i.content.ownerDocument&&(l=i.content.ownerDocument)}let E,W="";const{implementation:ce,createNodeIterator:Ot,createDocumentFragment:yt,getElementsByTagName:Dt}=l,{importNode:Nt}=r;let y={};o.isSupported=typeof pt=="function"&&typeof le=="function"&&ce&&ce.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:fe,ERB_EXPR:ue,TMPLIT_EXPR:me,DATA_ATTR:bt,ARIA_ATTR:Ct,IS_SCRIPT_OR_DATA:It,ATTR_WHITESPACE:Me,CUSTOM_ELEMENT:Mt}=mt;let{IS_ALLOWED_URI:we}=mt,u=null;const xe=a({},[...lt,...Oe,...ye,...De,...ct]);let m=null;const Pe=a({},[...ft,...Ne,...ut,...ae]);let f=Object.seal(dt(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}})),G=null,pe=null,ke=!0,de=!0,ve=!1,Ue=!0,P=!1,Te=!0,M=!1,_e=!1,Ee=!1,k=!1,J=!1,Q=!1,Fe=!0,He=!1;const wt="user-content-";let ge=!0,B=!1,v={},U=null;const ze=a({},["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"]);let We=null;const Ge=a({},["audio","video","img","source","image","track"]);let he=null;const Be=a({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ee="http://www.w3.org/1998/Math/MathML",te="http://www.w3.org/2000/svg",C="http://www.w3.org/1999/xhtml";let F=C,Ae=!1,Se=null;const xt=a({},[ee,te,C],Le);let Y=null;const Pt=["application/xhtml+xml","text/html"],kt="text/html";let p=null,H=null;const vt=l.createElement("form"),Ye=function(e){return e instanceof RegExp||e instanceof Function},Re=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(H&&H===e)){if((!e||typeof e!="object")&&(e={}),e=w(e),Y=Pt.indexOf(e.PARSER_MEDIA_TYPE)===-1?kt:e.PARSER_MEDIA_TYPE,p=Y==="application/xhtml+xml"?Le:re,u=O(e,"ALLOWED_TAGS")?a({},e.ALLOWED_TAGS,p):xe,m=O(e,"ALLOWED_ATTR")?a({},e.ALLOWED_ATTR,p):Pe,Se=O(e,"ALLOWED_NAMESPACES")?a({},e.ALLOWED_NAMESPACES,Le):xt,he=O(e,"ADD_URI_SAFE_ATTR")?a(w(Be),e.ADD_URI_SAFE_ATTR,p):Be,We=O(e,"ADD_DATA_URI_TAGS")?a(w(Ge),e.ADD_DATA_URI_TAGS,p):Ge,U=O(e,"FORBID_CONTENTS")?a({},e.FORBID_CONTENTS,p):ze,G=O(e,"FORBID_TAGS")?a({},e.FORBID_TAGS,p):{},pe=O(e,"FORBID_ATTR")?a({},e.FORBID_ATTR,p):{},v=O(e,"USE_PROFILES")?e.USE_PROFILES:!1,ke=e.ALLOW_ARIA_ATTR!==!1,de=e.ALLOW_DATA_ATTR!==!1,ve=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ue=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,P=e.SAFE_FOR_TEMPLATES||!1,Te=e.SAFE_FOR_XML!==!1,M=e.WHOLE_DOCUMENT||!1,k=e.RETURN_DOM||!1,J=e.RETURN_DOM_FRAGMENT||!1,Q=e.RETURN_TRUSTED_TYPE||!1,Ee=e.FORCE_BODY||!1,Fe=e.SANITIZE_DOM!==!1,He=e.SANITIZE_NAMED_PROPS||!1,ge=e.KEEP_CONTENT!==!1,B=e.IN_PLACE||!1,we=e.ALLOWED_URI_REGEXP||Tt,F=e.NAMESPACE||C,f=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ye(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(f.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ye(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(f.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(f.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),P&&(de=!1),J&&(k=!0),v&&(u=a({},ct),m=[],v.html===!0&&(a(u,lt),a(m,ft)),v.svg===!0&&(a(u,Oe),a(m,Ne),a(m,ae)),v.svgFilters===!0&&(a(u,ye),a(m,Ne),a(m,ae)),v.mathMl===!0&&(a(u,De),a(m,ut),a(m,ae))),e.ADD_TAGS&&(u===xe&&(u=w(u)),a(u,e.ADD_TAGS,p)),e.ADD_ATTR&&(m===Pe&&(m=w(m)),a(m,e.ADD_ATTR,p)),e.ADD_URI_SAFE_ATTR&&a(he,e.ADD_URI_SAFE_ATTR,p),e.FORBID_CONTENTS&&(U===ze&&(U=w(U)),a(U,e.FORBID_CONTENTS,p)),ge&&(u["#text"]=!0),M&&a(u,["html","head","body"]),u.table&&(a(u,["tbody"]),delete G.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw $('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw $('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=e.TRUSTED_TYPES_POLICY,W=E.createHTML("")}else E===void 0&&(E=an(K,T)),E!==null&&typeof W=="string"&&(W=E.createHTML(""));A&&A(e),H=e}},Xe=a({},["mi","mo","mn","ms","mtext"]),je=a({},["foreignobject","annotation-xml"]),Ut=a({},["title","style","font","a","script"]),Ve=a({},[...Oe,...ye,...Vt]),$e=a({},[...De,...$t]),Ft=function(e){let t=le(e);(!t||!t.tagName)&&(t={namespaceURI:F,tagName:"template"});const n=re(e.tagName),c=re(t.tagName);return Se[e.namespaceURI]?e.namespaceURI===te?t.namespaceURI===C?n==="svg":t.namespaceURI===ee?n==="svg"&&(c==="annotation-xml"||Xe[c]):!!Ve[n]:e.namespaceURI===ee?t.namespaceURI===C?n==="math":t.namespaceURI===te?n==="math"&&je[c]:!!$e[n]:e.namespaceURI===C?t.namespaceURI===te&&!je[c]||t.namespaceURI===ee&&!Xe[c]?!1:!$e[n]&&(Ut[n]||!Ve[n]):!!(Y==="application/xhtml+xml"&&Se[e.namespaceURI]):!1},D=function(e){j(o.removed,{element:e});try{e.parentNode.removeChild(e)}catch{e.remove()}},ne=function(e,t){try{j(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch{j(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e==="is"&&!m[e])if(k||J)try{D(t)}catch{}else try{t.setAttribute(e,"")}catch{}},qe=function(e){let t=null,n=null;if(Ee)e="<remove></remove>"+e;else{const d=st(e,/^[\r\n\t ]+/);n=d&&d[0]}Y==="application/xhtml+xml"&&F===C&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const c=E?E.createHTML(e):e;if(F===C)try{t=new At().parseFromString(c,Y)}catch{}if(!t||!t.documentElement){t=ce.createDocument(F,"template",null);try{t.documentElement.innerHTML=Ae?W:c}catch{}}const _=t.body||t.documentElement;return e&&n&&_.insertBefore(l.createTextNode(n),_.childNodes[0]||null),F===C?Dt.call(t,M?"html":"body")[0]:M?t.documentElement:_},Ke=function(e){return Ot.call(e.ownerDocument||e,e,z.SHOW_ELEMENT|z.SHOW_COMMENT|z.SHOW_TEXT|z.SHOW_PROCESSING_INSTRUCTION|z.SHOW_CDATA_SECTION,null)},Ze=function(e){return e instanceof ht&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof gt)||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 se=="function"&&e instanceof se},I=function(e,t,n){y[e]&&oe(y[e],c=>{c.call(o,t,n,H)})},Qe=function(e){let t=null;if(I("beforeSanitizeElements",e,null),Ze(e))return D(e),!0;const n=p(e.nodeName);if(I("uponSanitizeElement",e,{tagName:n,allowedTags:u}),e.hasChildNodes()&&!Je(e.firstElementChild)&&h(/<[/\w]/g,e.innerHTML)&&h(/<[/\w]/g,e.textContent)||e.nodeType===q.progressingInstruction||Te&&e.nodeType===q.comment&&h(/<[/\w]/g,e.data))return D(e),!0;if(!u[n]||G[n]){if(!G[n]&&tt(n)&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,n)||f.tagNameCheck instanceof Function&&f.tagNameCheck(n)))return!1;if(ge&&!U[n]){const c=le(e)||e.parentNode,_=Lt(e)||e.childNodes;if(_&&c){const d=_.length;for(let S=d-1;S>=0;--S){const N=St(_[S],!0);N.__removalCount=(e.__removalCount||0)+1,c.insertBefore(N,Rt(e))}}}return D(e),!0}return e instanceof Ie&&!Ft(e)||(n==="noscript"||n==="noembed"||n==="noframes")&&h(/<\/no(script|embed|frames)/i,e.innerHTML)?(D(e),!0):(P&&e.nodeType===q.text&&(t=e.textContent,oe([fe,ue,me],c=>{t=V(t,c," ")}),e.textContent!==t&&(j(o.removed,{element:e.cloneNode()}),e.textContent=t)),I("afterSanitizeElements",e,null),!1)},et=function(e,t,n){if(Fe&&(t==="id"||t==="name")&&(n in l||n in vt))return!1;if(!(de&&!pe[t]&&h(bt,t))){if(!(ke&&h(Ct,t))){if(!m[t]||pe[t]){if(!(tt(e)&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,e)||f.tagNameCheck instanceof Function&&f.tagNameCheck(e))&&(f.attributeNameCheck instanceof RegExp&&h(f.attributeNameCheck,t)||f.attributeNameCheck instanceof Function&&f.attributeNameCheck(t))||t==="is"&&f.allowCustomizedBuiltInElements&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,n)||f.tagNameCheck instanceof Function&&f.tagNameCheck(n))))return!1}else if(!he[t]){if(!h(we,V(n,Me,""))){if(!((t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&Bt(n,"data:")===0&&We[e])){if(!(ve&&!h(It,V(n,Me,"")))){if(n)return!1}}}}}}return!0},tt=function(e){return e!=="annotation-xml"&&st(e,Mt)},nt=function(e){I("beforeSanitizeAttributes",e,null);const{attributes:t}=e;if(!t)return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:m};let c=t.length;for(;c--;){const _=t[c],{name:d,namespaceURI:S,value:N}=_,X=p(d);let g=d==="value"?N:Yt(N);if(n.attrName=X,n.attrValue=g,n.keepAttr=!0,n.forceKeepAttr=void 0,I("uponSanitizeAttribute",e,n),g=n.attrValue,n.forceKeepAttr||(ne(d,e),!n.keepAttr))continue;if(!Ue&&h(/\/>/i,g)){ne(d,e);continue}if(Te&&h(/((--!?|])>)|<\/(style|title)/i,g)){ne(d,e);continue}P&&oe([fe,ue,me],it=>{g=V(g,it," ")});const ot=p(e.nodeName);if(et(ot,X,g)){if(He&&(X==="id"||X==="name")&&(ne(d,e),g=wt+g),E&&typeof K=="object"&&typeof K.getAttributeType=="function"&&!S)switch(K.getAttributeType(ot,X)){case"TrustedHTML":{g=E.createHTML(g);break}case"TrustedScriptURL":{g=E.createScriptURL(g);break}}try{S?e.setAttributeNS(S,d,g):e.setAttribute(d,g),Ze(e)?D(e):rt(o.removed)}catch{}}}I("afterSanitizeAttributes",e,null)},Ht=function i(e){let t=null;const n=Ke(e);for(I("beforeSanitizeShadowDOM",e,null);t=n.nextNode();)I("uponSanitizeShadowNode",t,null),!Qe(t)&&(t.content instanceof b&&i(t.content),nt(t));I("afterSanitizeShadowDOM",e,null)};return o.sanitize=function(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,n=null,c=null,_=null;if(Ae=!i,Ae&&(i="<!-->"),typeof i!="string"&&!Je(i))if(typeof i.toString=="function"){if(i=i.toString(),typeof i!="string")throw $("dirty is not a string, aborting")}else throw $("toString is not a function");if(!o.isSupported)return i;if(_e||Re(e),o.removed=[],typeof i=="string"&&(B=!1),B){if(i.nodeName){const N=p(i.nodeName);if(!u[N]||G[N])throw $("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof se)t=qe("<!---->"),n=t.ownerDocument.importNode(i,!0),n.nodeType===q.element&&n.nodeName==="BODY"||n.nodeName==="HTML"?t=n:t.appendChild(n);else{if(!k&&!P&&!M&&i.indexOf("<")===-1)return E&&Q?E.createHTML(i):i;if(t=qe(i),!t)return k?null:Q?W:""}t&&Ee&&D(t.firstChild);const d=Ke(B?i:t);for(;c=d.nextNode();)Qe(c)||(c.content instanceof b&&Ht(c.content),nt(c));if(B)return i;if(k){if(J)for(_=yt.call(t.ownerDocument);t.firstChild;)_.appendChild(t.firstChild);else _=t;return(m.shadowroot||m.shadowrootmode)&&(_=Nt.call(r,_,!0)),_}let S=M?t.outerHTML:t.innerHTML;return M&&u["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&h(_t,t.ownerDocument.doctype.name)&&(S="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
`+S),P&&oe([fe,ue,me],N=>{S=V(S,N," ")}),E&&Q?E.createHTML(S):S},o.setConfig=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Re(i),_e=!0},o.clearConfig=function(){H=null,_e=!1},o.isValidAttribute=function(i,e,t){H||Re({});const n=p(i),c=p(e);return et(n,c,t)},o.addHook=function(i,e){typeof e=="function"&&(y[i]=y[i]||[],j(y[i],e))},o.removeHook=function(i){if(y[i])return rt(y[i])},o.removeHooks=function(i){y[i]&&(y[i]=[])},o.removeAllHooks=function(){y={}},o}var rn=Et();export{rn as p};
