function e(e,t){this.v=e,this.k=t}function t(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n`u`?null:T(BigInt.prototype.toString),_e=typeof Symbol>`u`?null:T(Symbol.prototype.toString),x=T(Object.prototype.hasOwnProperty),S=T(Object.prototype.toString),C=T(RegExp.prototype.test),w=E(TypeError);function T(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return te(e,t,n)}}function E(e){return function(){return ne(e,[...arguments])}}function D(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:v;if(l&&l(e,null),!_(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(u(t)||(t[r]=e),i=e)}e[i]=!0}return e}function ve(e){for(let t=0;t/g),Fe=m(/\${[\w\W]*/g),Ie=m(/^data-[\-\w.\u00B7-\uFFFF]+$/),Le=m(/^aria-[\-\w]+$/),Re=m(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ze=m(/^(?:\w+script|data):/i),Be=m(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ve=m(/^html$/i),He=m(/^[a-z][.\w]*(-[.\w]+)+$/i),Ue=m(/<[/\w!]/g),We=m(/<[/\w]/g),Ge=m(/<\/no(script|embed|frames)/i),Ke=m(/\/>/i),A={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},qe=p(D({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),Je=function(){return typeof window>`u`?null:window},Ye=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Xe=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},j=function(e,t,n,r){return x(e,t)&&_(e[t])?D(r.base?O(r.base):{},e[t],r.transform):n},Ze=function(e,t,n){let r=x(e,t)?e[t]:void 0;return r&&typeof r==`object`?O(r):n()};function Qe(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Je(),t=e=>Qe(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==A.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,l=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let u=e.DOMParser,d=e.trustedTypes,f=s.prototype,ee=k(f,`cloneNode`),te=k(f,`remove`),ne=k(f,`removeAttributeNode`),ge=k(f,`nextSibling`),y=k(f,`childNodes`),b=k(f,`parentNode`),_e=k(f,`shadowRoot`),S=k(f,`attributes`),T=o&&o.prototype?k(o.prototype,`nodeType`):null,E=o&&o.prototype?k(o.prototype,`nodeName`):null,ve=o&&o.prototype?k(o.prototype,`ownerDocument`):null,M=function(e){return T?T(e):e.nodeType},$e=function(e){return E?E(e):e.nodeName},et=be(f,`namespaceURI`),tt=function(e){return et?et(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let N,P=``,nt,rt=!1,it=0,at=function(){if(it>0)throw w(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},F=function(e){at(),it++;try{return N.createHTML(e)}finally{it--}},ot=function(e){at(),it++;try{return N.createScriptURL(e)}finally{it--}},st=function(){return rt||=(nt=Ye(d,i),!0),nt},ct=n,lt=ct.implementation,ut=ct.createNodeIterator,dt=ct.createDocumentFragment,ft=ct.getElementsByTagName,pt=r.importNode,I=Xe();t.isSupported=typeof c==`function`&&typeof b==`function`&<&<.createHTMLDocument!==void 0;let mt=Ne,ht=Pe,gt=Fe,_t=Ie,vt=Le,yt=ze,bt=Be,xt=He,St=Re,L=null,Ct=D({},[...Se,...Ce,...we,...Ee,...Oe]),R=null,wt=D({},[...ke,...Ae,...je,...Me]),z=Object.seal(h(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}})),Tt=null,Et=null,B=Object.seal(h(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Dt=!0,Ot=!0,kt=!1,At=!0,V=!1,H=!0,U=!1,jt=!1,Mt=null,Nt=null,Pt=!1,W=!1,Ft=!1,It=!1,Lt=!0,Rt=!1,zt=`user-content-`,Bt=!0,Vt=!1,G=null,K={},q=null,Ht=D({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ut=null,Wt=D({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Gt=null,Kt=D({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),qt=`http://www.w3.org/1998/Math/MathML`,Jt=`http://www.w3.org/2000/svg`,J=`http://www.w3.org/1999/xhtml`,Y=J,Yt=!1,Xt=null,Zt=D({},[qt,Jt,J],de),Qt=p([`mi`,`mo`,`mn`,`ms`,`mtext`]),$t=D({},Qt),en=p([`annotation-xml`]),tn=D({},en),nn=D({},[`title`,`style`,`font`,`a`,`script`]),rn=null,an=[`application/xhtml+xml`,`text/html`],X=null,on=null,sn=n.createElement(`form`),cn=function(e){return e instanceof RegExp||e instanceof Function},ln=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(on&&on===e)return;(!e||typeof e!=`object`)&&(e={}),e=O(e),rn=an.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,X=rn===`application/xhtml+xml`?de:v,L=j(e,`ALLOWED_TAGS`,Ct,{transform:X}),R=j(e,`ALLOWED_ATTR`,wt,{transform:X}),Xt=j(e,`ALLOWED_NAMESPACES`,Zt,{transform:de}),Gt=j(e,`ADD_URI_SAFE_ATTR`,Kt,{transform:X,base:Kt}),Ut=j(e,`ADD_DATA_URI_TAGS`,Wt,{transform:X,base:Wt}),q=j(e,`FORBID_CONTENTS`,Ht,{transform:X}),Tt=j(e,`FORBID_TAGS`,O({}),{transform:X}),Et=j(e,`FORBID_ATTR`,O({}),{transform:X}),K=x(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?O(e.USE_PROFILES):e.USE_PROFILES:!1,Dt=e.ALLOW_ARIA_ATTR!==!1,Ot=e.ALLOW_DATA_ATTR!==!1,kt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,At=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,V=e.SAFE_FOR_TEMPLATES||!1,H=e.SAFE_FOR_XML!==!1,U=e.WHOLE_DOCUMENT||!1,W=e.RETURN_DOM||!1,Ft=e.RETURN_DOM_FRAGMENT||!1,It=e.RETURN_TRUSTED_TYPE||!1,Pt=e.FORCE_BODY||!1,Lt=e.SANITIZE_DOM!==!1,Rt=e.SANITIZE_NAMED_PROPS||!1,Bt=e.KEEP_CONTENT!==!1,Vt=e.IN_PLACE||!1,St=xe(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Re,Y=typeof e.NAMESPACE==`string`?e.NAMESPACE:J,$t=Ze(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>D({},Qt)),tn=Ze(e,`HTML_INTEGRATION_POINTS`,()=>D({},en));let t=Ze(e,`CUSTOM_ELEMENT_HANDLING`,()=>h(null));if(z=h(null),x(t,`tagNameCheck`)&&cn(t.tagNameCheck)&&(z.tagNameCheck=t.tagNameCheck),x(t,`attributeNameCheck`)&&cn(t.attributeNameCheck)&&(z.attributeNameCheck=t.attributeNameCheck),x(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(z.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),m(z),V&&(Ot=!1),Ft&&(W=!0),K&&(L=D({},Oe),R=h(null),K.html===!0&&(D(L,Se),D(R,ke)),K.svg===!0&&(D(L,Ce),D(R,Ae),D(R,Me)),K.svgFilters===!0&&(D(L,we),D(R,Ae),D(R,Me)),K.mathMl===!0&&(D(L,Ee),D(R,je),D(R,Me))),B.tagCheck=null,B.attributeCheck=null,x(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?B.tagCheck=e.ADD_TAGS:_(e.ADD_TAGS)&&(L===Ct&&(L=O(L)),D(L,e.ADD_TAGS,X))),x(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?B.attributeCheck=e.ADD_ATTR:_(e.ADD_ATTR)&&(R===wt&&(R=O(R)),D(R,e.ADD_ATTR,X))),x(e,`ADD_FORBID_CONTENTS`)&&_(e.ADD_FORBID_CONTENTS)&&(q===Ht&&(q=O(q)),D(q,e.ADD_FORBID_CONTENTS,X)),Bt&&(L[`#text`]=!0),U&&D(L,[`html`,`head`,`body`]),L.table&&(D(L,[`tbody`]),delete Tt.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw w(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw w(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=N;N=e.TRUSTED_TYPES_POLICY;try{P=F(``)}catch(e){throw N=t,e}}else e.TRUSTED_TYPES_POLICY===null?(N=void 0,P=``):(N===void 0&&(N=st()),N&&typeof P==`string`&&(P=F(``)));p&&p(e),on=e},un=D({},[...Ce,...we,...Te]),dn=D({},[...Ee,...De]),fn=function(e,t,n){return t.namespaceURI===J?e===`svg`:t.namespaceURI===qt?e===`svg`&&(n===`annotation-xml`||$t[n]):!!un[e]},pn=function(e,t,n){return t.namespaceURI===J?e===`math`:t.namespaceURI===Jt?e===`math`&&tn[n]:!!dn[e]},mn=function(e,t,n){return t.namespaceURI===Jt&&!tn[n]||t.namespaceURI===qt&&!$t[n]?!1:!dn[e]&&(nn[e]||!un[e])},hn=function(e){let t=tt(e),n=v($e(e)),r=b(e),i,a;return r&&M(r)===A.element?(i={namespaceURI:tt(r)},a=v($e(r))):(i={namespaceURI:Y},a=`template`),Xt[t]?t===Jt?fn(n,i,a):t===qt?pn(n,i,a):t===J?mn(n,i,a):!!(rn===`application/xhtml+xml`&&Xt[t]):!1},Z=function(e){ae(t.removed,{element:e});try{b(e).removeChild(e)}catch{if(te(e),!b(e))throw w(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},gn=function(e,t,n){try{ne(e,t)}catch{try{e.removeAttribute(n)}catch{}}},_n=function(e){xn(e);let t=y(e);t&&g(oe(t),e=>{try{te(e)}catch{}});let n=M(e)===A.element?S(e):null;if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&gn(e,r,i)}},vn=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}ae(t.removed,{attribute:r||null,from:n});try{r?ne(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`)if(W||Ft)try{Z(n)}catch{}else try{n.setAttribute(e,``)}catch{}},yn=function(e){let t=S(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||R[X(i)]||gn(e,r,i)}},bn=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&M(e)===A.element){let t=_e(e);Q(t)&&r.push(t)}let i=y(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},xn=function(e){bn(e,e=>{M(e)===A.element&&yn(e)})},Sn=function(e){let t=[];return bn(e,e=>{t.push(e)},!0),t},Cn=function(e,t){let n=ce();g(Sn(e),e=>{M(e)===A.element&&le(n,e)}),g(t,e=>{M(e)===A.element&&!ue(n,e)&&yn(e)})},wn=function(e,n){let r=!1;return g(t.removed,t=>{t.element&&(r||=t.element===e,xn(t.element))}),Cn(e,n),r},Tn=function(e,t){let n=G,r=null,i=()=>(r||(r=ce(),g(t,e=>{le(r,e)})),r);for(let t=0;;t++){let r=Sn(e),a=[e],o=!1;if(g(r,e=>{M(e)===A.documentFragment?ae(a,e):!o&&!ue(n,e)&&(o=ue(i(),e))}),!o)return;if(t>=8)throw w(`the tree kept changing during in-place sanitization; refusing to return it`);g(a,(t,n)=>{En(t,n>0,e,i())})}},En=function(e,t,n,r){let i=jn(e),a;for(;a=i.nextNode();)!ue(r,a)||ue(G,a)||(t&&$(I.uponSanitizeShadowNode,a,null),Hn(a,n),Yn(a,n),Q(a.content)&&Xn(a.content))},Dn=function(e){G&&le(G,e)},On=function(e,t){return H?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},kn=function(e){H&&bn(e,e=>{let t=M(e);if(t===A.processingInstruction||t===A.comment&&C(We,e.data)){try{te(e)}catch{}return!1}if(t===A.element){let t=e,n=X($e(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&On(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},An=function(e){let t=null,r=null;if(Pt)e=``+e;else{let t=fe(e,/^[\r\n\t ]+/);r=t&&t[0]}rn===`application/xhtml+xml`&&Y===J&&(e=``+e+``);let i=N?F(e):e;if(Y===J)try{t=new u().parseFromString(i,rn)}catch{}if(!t||!t.documentElement){t=lt.createDocument(Y,`template`,null);try{t.documentElement.innerHTML=Yt?P:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Y===J?ft.call(t,U?`html`:`body`)[0]:U?t.documentElement:a},jn=function(e){let t=ve?ve(e):e.ownerDocument;return ut.call(t||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Mn=function(e){return e=pe(e,mt,` `),e=pe(e,ht,` `),e=pe(e,gt,` `),e},Nn=function(e){Pn(e);let t=e.querySelectorAll?.call(e,`template`);t&&g(t,e=>{Q(e.content)&&Nn(e.content)})},Pn=function(e){e.normalize();let t=ve?ve(e):e.ownerDocument,n=ut.call(t||e,e,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=Mn(r.data),r=n.nextNode()},Fn=function(e){let t=E?E(e):null;return typeof t!=`string`||X(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==S(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==T(e)||e.childNodes!==y(e)},Q=function(e){if(!T||typeof e!=`object`||!e)return!1;try{return T(e)===A.documentFragment}catch{return!1}},In=function(e){if(!T||typeof e!=`object`||!e)return!1;try{return typeof T(e)==`number`}catch{return!1}};function $(e,n,r){e.length!==0&&g(e,e=>{e.call(t,n,r,on)})}let Ln=function(e,t){return!!(H&&e.hasChildNodes()&&!In(e.firstElementChild)&&C(Ue,e.textContent)&&C(Ue,e.innerHTML)||H&&qe[t]&&M(e)===A.element&&tt(e)===J&&(In(e.firstElementChild)||typeof e.textContent==`string`&&C(Ue,e.textContent))||e.nodeType===A.processingInstruction||H&&e.nodeType===A.comment&&C(We,e.data))},Rn=function(e,t){return e instanceof RegExp?C(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},zn=function(e,t,n){if(!Tt[t]&&Gn(t)&&Rn(z.tagNameCheck,t))return!1;if(Bt&&!q[t]&&!q[v(t)]){let t=b(e),r=y(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?ee(r[a],!0):r[a];t.insertBefore(i,ge(e))}}}return Z(e),!0},Bn=function(e,t,n,r){return e.length===0?t:t===n||t===r?O(t):t},Vn=function(e,t){return e===t||b(e)!==null?!1:(Vt&&xn(e),!0)},Hn=function(e,n){if(Dn(e),$(I.beforeSanitizeElements,e,null),Vn(e,n))return!0;if(Fn(e))return Z(e),!0;let r=X($e(e));if(L=Bn(I.uponSanitizeElement,L,Ct,Mt),$(I.uponSanitizeElement,e,{tagName:r,allowedTags:L}),Vn(e,n))return!0;if(Ln(e,r))return Z(e),!0;if(Tt[r]||!(B.tagCheck instanceof Function&&B.tagCheck(r))&&!L[r]){let t=zn(e,r,n);return t===!1&&($(I.afterSanitizeElements,e,null),Vn(e,n))?!0:t}if(M(e)===A.element&&!hn(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&C(Ge,e.innerHTML))return Z(e),!0;if(V&&e.nodeType===A.text){let n=Mn(e.textContent);e.textContent!==n&&(ae(t.removed,{element:e.cloneNode()}),e.textContent=n)}return $(I.afterSanitizeElements,e,null),Vn(e,n)},Un=function(e,t,r){if(Et[t]||On(t,e)||Lt&&(t===`id`||t===`name`)&&(r in n||r in sn))return!1;let i=R[t]||B.attributeCheck instanceof Function&&B.attributeCheck(t,e);return Ot&&C(_t,t)||Dt&&C(vt,t)?!0:i?Gt[t]||C(St,pe(r,bt,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&me(r,`data:`)===0&&Ut[e]||kt&&!C(yt,pe(r,bt,``))?!0:!r:Gn(e)&&Rn(z.tagNameCheck,e)&&Rn(z.attributeNameCheck,t,e)||t===`is`&&z.allowCustomizedBuiltInElements&&Rn(z.tagNameCheck,r)},Wn=D({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Gn=function(e){return!Wn[v(e)]&&C(xt,e)},Kn=function(e,t,n,r){if(N&&typeof d==`object`&&typeof d.getAttributeType==`function`&&!n)switch(d.getAttributeType(e,t)){case`TrustedHTML`:return F(r);case`TrustedScriptURL`:return ot(r)}return r},qn=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),Fn(e)?(Z(e),!1):!0}catch{return vn(t,e),!1}},Jn=function(e,t){return H&&C(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:v(e)===`attributename`&&fe(t,`href`)!==null},Yn=function(e,n){if($(I.beforeSanitizeAttributes,e,null),Vn(e,n))return;let r=e.attributes;if(!r||Fn(e))return;R=Bn(I.uponSanitizeAttribute,R,wt,Nt);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0},a=r.length,o=X(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=X(s),d=l,f=s===`value`?d:he(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,$(I.uponSanitizeAttribute,e,i),f=i.attrValue,Rt&&(u===`id`||u===`name`)&&me(f,zt)!==0&&(vn(s,e,n),f=zt+f,p=!0),Jn(s,f)){vn(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){vn(s,e,n);continue}if(!At&&C(Ke,f)){vn(s,e,n);continue}if(V&&(f=Mn(f)),!Un(o,u,f)){vn(s,e,n);continue}f=Kn(o,u,c,f),f!==d&&qn(e,s,c,f)&&p&&ie(t.removed)}}$(I.afterSanitizeAttributes,e,null),Vn(e,n)},Xn=function(e){let t=null,n=jn(e);for($(I.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if($(I.uponSanitizeShadowNode,t,null),Hn(t,e),Yn(t,e),Q(t.content)&&Xn(t.content),M(t)===A.element){let e=_e(t);Q(e)&&(Zn(e),Xn(e))}V&&Pn(e),$(I.afterSanitizeShadowDOM,e,null)},Zn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Xn(e.shadow);continue}let n=e.node,r=M(n)===A.element,i=y(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=E?E(n):null;if(typeof e==`string`&&X(e)===`template`){let e=n.content;Q(e)&&t.push({node:e,shadow:null})}}if(r){let e=_e(n);Q(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Yt=!e,Yt&&(e=``),typeof e!=`string`&&!In(e)&&(e=ye(e),typeof e!=`string`))throw w(`dirty is not a string, aborting`);if(!t.isSupported)return e;jt?(L=Mt,R=Nt):ln(n),(I.uponSanitizeElement.length>0||I.uponSanitizeAttribute.length>0)&&(L=O(L)),I.uponSanitizeAttribute.length>0&&(R=O(R)),t.removed=[];let c=Vt&&typeof e!=`string`&&In(e),l=[],u=G;if(c){kn(e);let t=$e(e);if(typeof t==`string`){let n=X(t);if(!L[n]||Tt[n])throw _n(e),w(`root node is forbidden and cannot be sanitized in-place`)}if(Fn(e))throw _n(e),w(`root node is clobbered and cannot be sanitized in-place`);l=Sn(e),G=ce()}else if(In(e))i=An(``),a=i.ownerDocument.importNode(e,!0),a.nodeType===A.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Zn(i);else{if(!W&&!V&&!U&&e.indexOf(`<`)===-1)return N&&It?F(e):e;if(i=An(e),!i)return W?null:It?P:``}i&&Pt&&Z(i.firstChild);let d=c?e:i;try{c&&Zn(e);let t=jn(d);for(;o=t.nextNode();)Hn(o,d),Yn(o,d),Q(o.content)&&Xn(o.content);c&&Tn(e,l)}catch(t){throw c&&(_n(e),wn(e,l)),t}finally{G=u}if(c){if(wn(e,l))throw w(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return V&&Nn(e),e}if(W){if(V&&Nn(i),Ft)for(s=dt.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(R.shadowroot||R.shadowrootmode)&&(s=pt.call(r,s,!0)),s}let f=U?i.outerHTML:i.innerHTML;return U&&L[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&C(Ve,i.ownerDocument.doctype.name)&&(f=` `+f),V&&(f=Mn(f)),N&&It?F(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ln(e),jt=!0,Mt=L,Nt=R},t.clearConfig=function(){on=null,jt=!1,Mt=null,Nt=null,N=nt,P=``},t.isValidAttribute=function(e,t,n){on||ln({});let r=X(e),i=X(t);return typeof n==`string`&&(Jn(t,n)||!At&&C(Ke,n))?!1:Un(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&x(I,e)&&ae(I[e],t)},t.removeHook=function(e,t){if(x(I,e)){if(t!==void 0){let n=re(I[e],t);return n===-1?void 0:se(I[e],n,1)[0]}return ie(I[e])}},t.removeHooks=function(e){x(I,e)&&(I[e]=[])},t.removeAllHooks=function(){I=Xe()},t}var M=Qe();export{M as t};