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