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