From c3009186465c2d7c72c555428caaba2e3356c9ff Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Thu, 24 Sep 2026 16:40:52 +0000 Subject: [PATCH] Update dompurify to version 3.4.16 --- config/importmap.rb | 2 +- vendor/javascript/dompurify.js | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/config/importmap.rb b/config/importmap.rb index 6be5ca4f..e0e48094 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -47,7 +47,7 @@ # render markdown pin "marked", preload: false # @18.0.14 # https://github.com/cure53/DOMPurify, strips scripts and event handlers from rendered markdown -pin "dompurify", preload: false # @3.4.15 +pin "dompurify", preload: false # @3.4.16 # https://github.com/mapbox/mapbox-gl-draw # Unminified + locally patched, see the header of the vendored file diff --git a/vendor/javascript/dompurify.js b/vendor/javascript/dompurify.js index 88b63bfb..b2811141 100644 --- a/vendor/javascript/dompurify.js +++ b/vendor/javascript/dompurify.js @@ -1,10 +1,7 @@ -// dompurify@3.4.15 downloaded from https://cdn.jsdelivr.net/npm/dompurify@3.4.15/dist/purify.es.min.mjs +/*! @license DOMPurify 3.4.16 | (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.16/LICENSE */ +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),pe=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 g(e,t,n)}}function E(e){return function(){return te(e,[...arguments])}}function D(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:oe;if(l&&l(e,null),!v(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 me(e){for(let t=0;t/g),Ae=m(/\${[\w\W]*/g),je=m(/^data-[\-\w.\u00B7-\uFFFF]+$/),Me=m(/^aria-[\-\w]+$/),Ne=m(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Pe=m(/^(?:\w+script|data):/i),Fe=m(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ie=m(/^html$/i),Le=m(/^[a-z][.\w]*(-[.\w]+)+$/i),Re=m(/<[/\w!]/g),ze=m(/<[/\w]/g),Be=m(/<\/no(script|embed|frames)/i),Ve=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},j=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],He=p(D({},j)),Ue=function(){let e={};return _(j,t=>{e[t]=m(RegExp(`])`,`i`))}),p(e)}(),We=function e(){return typeof window>`u`?null:window},Ge=function e(t,n){if(typeof t!=`object`||typeof t.createPolicy!=`function`)return null;let r=null,i=`data-tt-policy-suffix`;n&&n.hasAttribute(i)&&(r=n.getAttribute(i));let a=`dompurify`+(r?`#`+r:``);try{return t.createPolicy(a,{createHTML(e){return e},createScriptURL(e){return e}})}catch(e){return console.warn(`TrustedTypes policy `+a+` could not be created.`),null}},Ke=function e(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},M=function e(t,n,r,i){return x(t,n)&&v(t[n])?D(i.base?O(i.base):{},t[n],i.transform):r},qe=function e(t,n,r){let i=x(t,n)?t[n]:void 0;return i&&typeof i==`object`?O(i):r()};function Je(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:We(),t=e=>Je(e);if(t.version=`3.4.16`,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`),g=k(f,`remove`),te=k(f,`removeAttributeNode`),fe=k(f,`nextSibling`),y=k(f,`childNodes`),b=k(f,`parentNode`),pe=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,me=o&&o.prototype?k(o.prototype,`ownerDocument`):null,j=function e(t){return T?T(t):t.nodeType},Ye=function e(t){return E?E(t):t.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let N,P=``,Xe,Ze=!1,Qe=0,$e=function e(){if(Qe>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(t){$e(),Qe++;try{return N.createHTML(t)}finally{Qe--}},et=function e(t){$e(),Qe++;try{return N.createScriptURL(t)}finally{Qe--}},tt=function e(){return Ze||(Xe=Ge(d,i),Ze=!0),Xe},nt=n,rt=nt.implementation,it=nt.createNodeIterator,at=nt.createDocumentFragment,ot=nt.getElementsByTagName,st=r.importNode,I=Ke();t.isSupported=typeof c==`function`&&typeof b==`function`&&rt&&rt.createHTMLDocument!==void 0;let ct=Oe,lt=ke,ut=Ae,dt=je,ft=Me,pt=Pe,mt=Fe,ht=Le,gt=Ne,L=null,_t=D({},[..._e,...ve,...ye,...xe,...Ce]),R=null,vt=D({},[...we,...Te,...Ee,...De]),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}})),yt=null,bt=null,B=Object.seal(h(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),xt=!0,St=!0,Ct=!1,wt=!0,V=!1,H=!0,U=!1,Tt=!1,Et=null,Dt=null,Ot=!1,W=!1,kt=!1,At=!1,jt=!0,Mt=!1,Nt=`user-content-`,Pt=!0,Ft=!1,G={},K=null,It=D({},/* @__PURE__ */ `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(`.`)),Lt=null,Rt=D({},[`audio`,`video`,`img`,`source`,`image`,`track`]),zt=null,Bt=D({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Vt=`http://www.w3.org/1998/Math/MathML`,Ht=`http://www.w3.org/2000/svg`,q=`http://www.w3.org/1999/xhtml`,J=q,Ut=!1,Wt=null,Gt=D({},[Vt,Ht,q],se),Kt=p([`mi`,`mo`,`mn`,`ms`,`mtext`]),qt=D({},Kt),Jt=p([`annotation-xml`]),Yt=D({},Jt),Xt=D({},[`title`,`style`,`font`,`a`,`script`]),Zt=null,Qt=[`application/xhtml+xml`,`text/html`],$t=`text/html`,Y=null,X=null,en=n.createElement(`form`),tn=function e(t){return t instanceof RegExp||t instanceof Function},nn=function e(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(X&&X===t)return;(!t||typeof t!=`object`)&&(t={}),t=O(t),Zt=Qt.indexOf(t.PARSER_MEDIA_TYPE)===-1?`text/html`:t.PARSER_MEDIA_TYPE,Y=Zt===`application/xhtml+xml`?se:oe,L=M(t,`ALLOWED_TAGS`,_t,{transform:Y}),R=M(t,`ALLOWED_ATTR`,vt,{transform:Y}),Wt=M(t,`ALLOWED_NAMESPACES`,Gt,{transform:se}),zt=M(t,`ADD_URI_SAFE_ATTR`,Bt,{transform:Y,base:Bt}),Lt=M(t,`ADD_DATA_URI_TAGS`,Rt,{transform:Y,base:Rt}),K=M(t,`FORBID_CONTENTS`,It,{transform:Y}),yt=M(t,`FORBID_TAGS`,O({}),{transform:Y}),bt=M(t,`FORBID_ATTR`,O({}),{transform:Y}),G=x(t,`USE_PROFILES`)?t.USE_PROFILES&&typeof t.USE_PROFILES==`object`?O(t.USE_PROFILES):t.USE_PROFILES:!1,xt=t.ALLOW_ARIA_ATTR!==!1,St=t.ALLOW_DATA_ATTR!==!1,Ct=t.ALLOW_UNKNOWN_PROTOCOLS||!1,wt=t.ALLOW_SELF_CLOSE_IN_ATTR!==!1,V=t.SAFE_FOR_TEMPLATES||!1,H=t.SAFE_FOR_XML!==!1,U=t.WHOLE_DOCUMENT||!1,W=t.RETURN_DOM||!1,kt=t.RETURN_DOM_FRAGMENT||!1,At=t.RETURN_TRUSTED_TYPE||!1,Ot=t.FORCE_BODY||!1,jt=t.SANITIZE_DOM!==!1,Mt=t.SANITIZE_NAMED_PROPS||!1,Pt=t.KEEP_CONTENT!==!1,Ft=t.IN_PLACE||!1,gt=ge(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:Ne,J=typeof t.NAMESPACE==`string`?t.NAMESPACE:q,qt=qe(t,`MATHML_TEXT_INTEGRATION_POINTS`,()=>D({},Kt)),Yt=qe(t,`HTML_INTEGRATION_POINTS`,()=>D({},Jt));let n=qe(t,`CUSTOM_ELEMENT_HANDLING`,()=>h(null));if(z=h(null),x(n,`tagNameCheck`)&&tn(n.tagNameCheck)&&(z.tagNameCheck=n.tagNameCheck),x(n,`attributeNameCheck`)&&tn(n.attributeNameCheck)&&(z.attributeNameCheck=n.attributeNameCheck),x(n,`allowCustomizedBuiltInElements`)&&typeof n.allowCustomizedBuiltInElements==`boolean`&&(z.allowCustomizedBuiltInElements=n.allowCustomizedBuiltInElements),m(z),V&&(St=!1),kt&&(W=!0),G&&(L=D({},Ce),R=h(null),G.html===!0&&(D(L,_e),D(R,we)),G.svg===!0&&(D(L,ve),D(R,Te),D(R,De)),G.svgFilters===!0&&(D(L,ye),D(R,Te),D(R,De)),G.mathMl===!0&&(D(L,xe),D(R,Ee),D(R,De))),B.tagCheck=null,B.attributeCheck=null,x(t,`ADD_TAGS`)&&(typeof t.ADD_TAGS==`function`?B.tagCheck=t.ADD_TAGS:v(t.ADD_TAGS)&&(L===_t&&(L=O(L)),D(L,t.ADD_TAGS,Y))),x(t,`ADD_ATTR`)&&(typeof t.ADD_ATTR==`function`?B.attributeCheck=t.ADD_ATTR:v(t.ADD_ATTR)&&(R===vt&&(R=O(R)),D(R,t.ADD_ATTR,Y))),x(t,`ADD_FORBID_CONTENTS`)&&v(t.ADD_FORBID_CONTENTS)&&(K===It&&(K=O(K)),D(K,t.ADD_FORBID_CONTENTS,Y)),Pt&&(L[`#text`]=!0),U&&D(L,[`html`,`head`,`body`]),L.table&&(D(L,[`tbody`]),delete yt.tbody),t.TRUSTED_TYPES_POLICY){if(typeof t.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw w(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof t.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw w(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let e=N;N=t.TRUSTED_TYPES_POLICY;try{P=F(``)}catch(t){throw N=e,t}}else t.TRUSTED_TYPES_POLICY===null?(N=void 0,P=``):(N===void 0&&(N=tt()),N&&typeof P==`string`&&(P=F(``)));p&&p(t),X=t},rn=D({},[...ve,...ye,...be]),an=D({},[...xe,...Se]),on=function e(t,n,r){return n.namespaceURI===q?t===`svg`:n.namespaceURI===Vt?t===`svg`&&(r===`annotation-xml`||qt[r]):!!rn[t]},sn=function e(t,n,r){return n.namespaceURI===q?t===`math`:n.namespaceURI===Ht?t===`math`&&Yt[r]:!!an[t]},cn=function e(t,n,r){return n.namespaceURI===Ht&&!Yt[r]||n.namespaceURI===Vt&&!qt[r]?!1:!an[t]&&(Xt[t]||!rn[t])},ln=function e(t){let n=b(t);(!n||!n.tagName)&&(n={namespaceURI:J,tagName:`template`});let r=oe(t.tagName),i=oe(n.tagName);return Wt[t.namespaceURI]?t.namespaceURI===Ht?on(r,n,i):t.namespaceURI===Vt?sn(r,n,i):t.namespaceURI===q?cn(r,n,i):!!(Zt===`application/xhtml+xml`&&Wt[t.namespaceURI]):!1},Z=function e(n){ie(t.removed,{element:n});try{b(n).removeChild(n)}catch(e){if(g(n),!b(n))throw w(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},un=function e(t,n,r){try{te(t,n)}catch(e){try{t.removeAttribute(r)}catch(e){}}},dn=function e(t){pn(t);let n=y(t);if(n){let e=[];_(n,t=>{ie(e,t)}),_(e,e=>{try{g(e)}catch(e){}})}let r=S(t);if(r)for(let e=r.length-1;e>=0;--e){let n=r[e],i=n&&n.name;typeof i==`string`&&un(t,n,i)}},Q=function e(n,r,i){if(!i)try{i=r.getAttributeNode(n)}catch(e){i=null}ie(t.removed,{attribute:i||null,from:r});try{i?te(r,i):r.removeAttribute(n)}catch(e){try{r.removeAttribute(n)}catch(e){}}if(n===`is`)if(W||kt)try{Z(r)}catch(e){}else try{r.setAttribute(n,``)}catch(e){}},fn=function e(t){let n=S(t);if(n)for(let e=n.length-1;e>=0;--e){let r=n[e],i=r&&r.name;typeof i!=`string`||R[Y(i)]||un(t,r,i)}},pn=function e(t){let n=[t];for(;n.length>0;){let e=n.pop();j(e)===A.element&&fn(e);let t=y(e);if(t)for(let e=t.length-1;e>=0;--e)n.push(t[e])}},mn=function e(t,n){return H?t===`patchsrc`?!0:t===`for`&&n!==`label`&&n!==`output`:!1},hn=function e(t){if(!H)return;let n=[t];for(;n.length>0;){let e=n.pop(),t=j(e);if(t===A.processingInstruction||t===A.comment&&C(ze,e.data)){try{g(e)}catch(e){}continue}if(t===A.element){let t=e,n=Y(Ye(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&mn(`for`,n)&&t.removeAttribute(`for`)}catch(e){}}let r=y(e);if(r)for(let e=r.length-1;e>=0;--e)n.push(r[e])}},gn=function e(t){let r=null,i=null;if(Ot)t=``+t;else{let e=ce(t,/^[\r\n\t ]+/);i=e&&e[0]}Zt===`application/xhtml+xml`&&J===q&&(t=``+t+``);let a=N?F(t):t;if(J===q)try{r=new u().parseFromString(a,Zt)}catch(e){}if(!r||!r.documentElement){r=rt.createDocument(J,`template`,null);try{r.documentElement.innerHTML=Ut?P:a}catch(e){}}let o=r.body||r.documentElement;return t&&i&&o.insertBefore(n.createTextNode(i),o.childNodes[0]||null),J===q?ot.call(r,U?`html`:`body`)[0]:U?r.documentElement:o},_n=function e(t){let n=me?me(t):t.ownerDocument;return it.call(n||t,t,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},vn=function e(t){return t=le(t,ct,` `),t=le(t,lt,` `),t=le(t,ut,` `),t},yn=function e(t){var n;t.normalize();let r=me?me(t):t.ownerDocument,i=it.call(r||t,t,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null),a=i.nextNode();for(;a;)a.data=vn(a.data),a=i.nextNode();let o=(n=t.querySelectorAll)==null?void 0:n.call(t,`template`);o&&_(o,e=>{xn(e.content)&&yn(e.content)})},bn=function e(t){let n=E?E(t):null;return typeof n!=`string`||Y(n)!==`form`?!1:typeof t.nodeName!=`string`||typeof t.textContent!=`string`||typeof t.removeChild!=`function`||t.attributes!==S(t)||typeof t.removeAttribute!=`function`||typeof t.removeAttributeNode!=`function`||typeof t.getAttributeNode!=`function`||typeof t.setAttribute!=`function`||typeof t.namespaceURI!=`string`||typeof t.insertBefore!=`function`||typeof t.hasChildNodes!=`function`||t.nodeType!==T(t)||t.childNodes!==y(t)},xn=function e(t){if(!T||typeof t!=`object`||!t)return!1;try{return T(t)===A.documentFragment}catch(e){return!1}},Sn=function e(t){if(!T||typeof t!=`object`||!t)return!1;try{return typeof T(t)==`number`}catch(e){return!1}};function $(e,n,r){e.length!==0&&_(e,e=>{e.call(t,n,r,X)})}let Cn=function e(t,n){return!!(H&&t.hasChildNodes()&&!Sn(t.firstElementChild)&&C(Re,t.textContent)&&C(Re,t.innerHTML)||H&&t.namespaceURI===q&&He[n]&&(Sn(t.firstElementChild)||typeof t.textContent==`string`&&C(Ue[n],t.textContent))||t.nodeType===A.processingInstruction||H&&t.nodeType===A.comment&&C(ze,t.data))},wn=function e(t,n){return t instanceof RegExp?C(t,n):t instanceof Function?!!t(n,...[...arguments].slice(2)):!1},Tn=function e(t,n,r){if(!yt[n]&&jn(n)&&wn(z.tagNameCheck,n))return!1;if(Pt&&!K[n]){let e=b(t),n=y(t);if(n&&e){let i=n.length;for(let a=i-1;a>=0;--a){let i=t===r?ee(n[a],!0):n[a];e.insertBefore(i,fe(t))}}}return Z(t),!0},En=function e(t,n,r,i){return t.length===0?n:n===r||n===i?O(n):n},Dn=function e(t,n){return t===n||b(t)!==null?!1:(Ft&&pn(t),!0)},On=function e(n,r){if($(I.beforeSanitizeElements,n,null),Dn(n,r))return!0;if(bn(n))return Z(n),!0;let i=Y(Ye(n));if(L=En(I.uponSanitizeElement,L,_t,Et),$(I.uponSanitizeElement,n,{tagName:i,allowedTags:L}),Dn(n,r))return!0;if(Cn(n,i))return Z(n),!0;if(yt[i]||!(B.tagCheck instanceof Function&&B.tagCheck(i))&&!L[i]){let e=Tn(n,i,r);return e===!1&&($(I.afterSanitizeElements,n,null),Dn(n,r))?!0:e}if(j(n)===A.element&&!ln(n)||(i===`noscript`||i===`noembed`||i===`noframes`)&&C(Be,n.innerHTML))return Z(n),!0;if(V&&n.nodeType===A.text){let e=vn(n.textContent);n.textContent!==e&&(ie(t.removed,{element:n.cloneNode()}),n.textContent=e)}return $(I.afterSanitizeElements,n,null),Dn(n,r)},kn=function e(t,r,i){if(bt[r]||mn(r,t)||jt&&(r===`id`||r===`name`)&&(i in n||i in en))return!1;let a=R[r]||B.attributeCheck instanceof Function&&B.attributeCheck(r,t);return St&&C(dt,r)||xt&&C(ft,r)?!0:a?zt[r]||C(gt,le(i,mt,``))||(r===`src`||r===`xlink:href`||r===`href`)&&t!==`script`&&ue(i,`data:`)===0&&Lt[t]||Ct&&!C(pt,le(i,mt,``))?!0:!i:jn(t)&&wn(z.tagNameCheck,t)&&wn(z.attributeNameCheck,r,t)||r===`is`&&z.allowCustomizedBuiltInElements&&wn(z.tagNameCheck,i)},An=D({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),jn=function e(t){return!An[oe(t)]&&C(ht,t)},Mn=function e(t,n,r,i){if(N&&typeof d==`object`&&typeof d.getAttributeType==`function`&&!r)switch(d.getAttributeType(t,n)){case`TrustedHTML`:return F(i);case`TrustedScriptURL`:return et(i)}return i},Nn=function e(t,n,r,i){try{return r?t.setAttributeNS(r,n,i):t.setAttribute(n,i),bn(t)?(Z(t),!1):!0}catch(e){return Q(n,t),!1}},Pn=function e(n,r){if($(I.beforeSanitizeAttributes,n,null),Dn(n,r))return;let i=n.attributes;if(!i||bn(n))return;R=En(I.uponSanitizeAttribute,R,vt,Dt);let a={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0},o=i.length,s=Y(n.nodeName);for(;o--;){let e=i[o],r=e.name,c=e.namespaceURI,l=e.value,u=Y(r),d=l,f=r===`value`?d:de(d),p=!1;if(a.attrName=u,a.attrValue=f,a.keepAttr=!0,a.forceKeepAttr=void 0,$(I.uponSanitizeAttribute,n,a),f=a.attrValue,Mt&&(u===`id`||u===`name`)&&ue(f,Nt)!==0&&(Q(r,n,e),f=Nt+f,p=!0),H&&C(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){Q(r,n,e);continue}if(u===`attributename`&&ce(f,`href`)){Q(r,n,e);continue}if(!a.forceKeepAttr){if(!a.keepAttr){Q(r,n,e);continue}if(!wt&&C(Ve,f)){Q(r,n,e);continue}if(V&&(f=vn(f)),!kn(s,u,f)){Q(r,n,e);continue}f=Mn(s,u,c,f),f!==d&&Nn(n,r,c,f)&&p&&re(t.removed)}}$(I.afterSanitizeAttributes,n,null),Dn(n,r)},Fn=function e(t){let n=null,r=_n(t);for($(I.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)if($(I.uponSanitizeShadowNode,n,null),On(n,t),Pn(n,t),xn(n.content)&&Fn(n.content),j(n)===A.element){let e=pe(n);xn(e)&&(In(e),Fn(e))}$(I.afterSanitizeShadowDOM,t,null)},In=function e(t){let n=[{node:t,shadow:null}];for(;n.length>0;){let e=n.pop();if(e.shadow){Fn(e.shadow);continue}let t=e.node,r=j(t)===A.element,i=y(t);if(i)for(let e=i.length-1;e>=0;--e)n.push({node:i[e],shadow:null});if(r){let e=E?E(t):null;if(typeof e==`string`&&Y(e)===`template`){let e=t.content;xn(e)&&n.push({node:e,shadow:null})}}if(r){let e=pe(t);xn(e)&&n.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(Ut=!e,Ut&&(e=``),typeof e!=`string`&&!Sn(e)&&(e=he(e),typeof e!=`string`))throw w(`dirty is not a string, aborting`);if(!t.isSupported)return e;Tt?(L=Et,R=Dt):nn(n),(I.uponSanitizeElement.length>0||I.uponSanitizeAttribute.length>0)&&(L=O(L)),I.uponSanitizeAttribute.length>0&&(R=O(R)),t.removed=[];let c=Ft&&typeof e!=`string`&&Sn(e);if(c){hn(e);let t=Ye(e);if(typeof t==`string`){let n=Y(t);if(!L[n]||yt[n])throw dn(e),w(`root node is forbidden and cannot be sanitized in-place`)}if(bn(e))throw dn(e),w(`root node is clobbered and cannot be sanitized in-place`);try{In(e)}catch(t){throw dn(e),t}}else if(Sn(e))i=gn(``),a=i.ownerDocument.importNode(e,!0),a.nodeType===A.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),In(i);else{if(!W&&!V&&!U&&e.indexOf(`<`)===-1)return N&&At?F(e):e;if(i=gn(e),!i)return W?null:At?P:``}i&&Ot&&Z(i.firstChild);let l=c?e:i;try{let e=_n(l);for(;o=e.nextNode();)On(o,l),Pn(o,l),xn(o.content)&&Fn(o.content)}catch(n){throw c&&(dn(e),_(t.removed,e=>{e.element&&pn(e.element)})),n}if(c){let n=!1;if(_(t.removed,t=>{t.element&&(t.element===e&&(n=!0),pn(t.element))}),n)throw w(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return V&&yn(e),e}if(W){if(V&&yn(i),kt)for(s=at.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(R.shadowroot||R.shadowrootmode)&&(s=st.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&&C(Ie,i.ownerDocument.doctype.name)&&(u=` +`+u),V&&(u=vn(u)),N&&At?F(u):u},t.setConfig=function(){nn(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),Tt=!0,Et=L,Dt=R},t.clearConfig=function(){X=null,Tt=!1,Et=null,Dt=null,N=Xe,P=``},t.isValidAttribute=function(e,t,n){return X||nn({}),kn(Y(e),Y(t),n)},t.addHook=function(e,t){typeof t==`function`&&x(I,e)&&ie(I[e],t)},t.removeHook=function(e,t){if(x(I,e)){if(t!==void 0){let n=ne(I[e],t);return n===-1?void 0:ae(I[e],n,1)[0]}return re(I[e])}},t.removeHooks=function(e){x(I,e)&&(I[e]=[])},t.removeAllHooks=function(){I=Ke()},t}var Ye=Je();export{Ye as default}; -/** - * Minified by jsDelivr using Terser v5.48.0. - * Original file: /npm/dompurify@3.4.15/dist/purify.es.mjs - * - * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files - */ -/*! @license DOMPurify 3.4.15 | (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.15/LICENSE */ -function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n2?n-2:0),o=2;o1?t-1:0),r=1;r1?n-1:0),o=1;o2&&void 0!==arguments[2]?arguments[2]:stringToLowerCase;if(setPrototypeOf&&setPrototypeOf(e,null),!arrayIsArray(t))return e;let r=t.length;for(;r--;){let o=t[r];if("string"==typeof o){const e=n(o);e!==o&&(isFrozen(t)||(t[r]=e),o=e)}e[o]=!0}return e}function cleanArray(e){for(let t=0;t/g),TMPLIT_EXPR=seal(/\${[\w\W]*/g),DATA_ATTR=seal(/^data-[\-\w.\u00B7-\uFFFF]+$/),ARIA_ATTR=seal(/^aria-[\-\w]+$/),IS_ALLOWED_URI=seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),IS_SCRIPT_OR_DATA=seal(/^(?:\w+script|data):/i),ATTR_WHITESPACE=seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),DOCTYPE_NAME=seal(/^html$/i),CUSTOM_ELEMENT=seal(/^[a-z][.\w]*(-[.\w]+)+$/i),ELEMENT_MARKUP_PROBE=seal(/<[/\w!]/g),COMMENT_MARKUP_PROBE=seal(/<[/\w]/g),FALLBACK_TAG_CLOSE=seal(/<\/no(script|embed|frames)/i),SELF_CLOSING_TAG=seal(/\/>/i),NODE_TYPE={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},LITERAL_TEXT_ELEMENT_NAMES=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],LITERAL_TEXT_ELEMENTS=freeze(addToSet({},LITERAL_TEXT_ELEMENT_NAMES)),LITERAL_TEXT_CLOSE=function(){const e={};return arrayForEach(LITERAL_TEXT_ELEMENT_NAMES,t=>{e[t]=seal(new RegExp("])","i"))}),freeze(e)}(),getGlobal=function(){return"undefined"==typeof window?null:window},_createTrustedTypesPolicy=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}},_createHooksMap=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},_resolveSetOption=function(e,t,n,r){return objectHasOwnProperty(e,t)&&arrayIsArray(e[t])?addToSet(r.base?clone(r.base):{},e[t],r.transform):n},_resolveObjectOption=function(e,t,n){const r=objectHasOwnProperty(e,t)?e[t]:void 0;return r&&"object"==typeof r?clone(r):n()};function createDOMPurify(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:getGlobal();const t=e=>createDOMPurify(e);if(t.version="3.4.15",t.removed=[],!e||!e.document||e.document.nodeType!==NODE_TYPE.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,o=r.currentScript;e.DocumentFragment;const a=e.HTMLTemplateElement,i=e.Node,l=e.Element,s=e.NodeFilter,c=e.NamedNodeMap;void 0===c&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const u=e.DOMParser,p=e.trustedTypes,f=l.prototype,m=lookupGetter(f,"cloneNode"),d=lookupGetter(f,"remove"),y=lookupGetter(f,"removeAttributeNode"),g=lookupGetter(f,"nextSibling"),h=lookupGetter(f,"childNodes"),T=lookupGetter(f,"parentNode"),E=lookupGetter(f,"shadowRoot"),b=lookupGetter(f,"attributes"),S=i&&i.prototype?lookupGetter(i.prototype,"nodeType"):null,_=i&&i.prototype?lookupGetter(i.prototype,"nodeName"):null,A=i&&i.prototype?lookupGetter(i.prototype,"ownerDocument"):null,O=function(e){return S?S(e):e.nodeType},w=function(e){return _?_(e):e.nodeName};if("function"==typeof a){const e=n.createElement("template");e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let v,R,N="",x=!1,P=0;const D=function(){if(P>0)throw typeErrorCreate('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.')},L=function(e){D(),P++;try{return v.createHTML(e)}finally{P--}},C=n,I=C.implementation,M=C.createNodeIterator,k=C.createDocumentFragment,z=C.getElementsByTagName,U=r.importNode;let F=_createHooksMap();t.isSupported="function"==typeof entries&&"function"==typeof T&&I&&void 0!==I.createHTMLDocument;const H=MUSTACHE_EXPR,j=ERB_EXPR,Y=TMPLIT_EXPR,G=DATA_ATTR,B=ARIA_ATTR,W=IS_SCRIPT_OR_DATA,X=ATTR_WHITESPACE,$=CUSTOM_ELEMENT;let K=IS_ALLOWED_URI,q=null;const V=addToSet({},[...html$1,...svg$1,...svgFilters,...mathMl$1,...text]);let Z=null;const J=addToSet({},[...html,...svg,...mathMl,...xml]);let Q=Object.seal(create(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,te=null;const ne=Object.seal(create(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let re=!0,oe=!0,ae=!1,ie=!0,le=!1,se=!0,ce=!1,ue=!1,pe=null,fe=null,me=!1,de=!1,ye=!1,ge=!1,he=!0,Te=!1;const Ee="user-content-";let be=!0,Se=!1,_e={},Ae=null;const Oe=addToSet({},["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"]);let we=null;const ve=addToSet({},["audio","video","img","source","image","track"]);let Re=null;const Ne=addToSet({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),xe="http://www.w3.org/1998/Math/MathML",Pe="http://www.w3.org/2000/svg",De="http://www.w3.org/1999/xhtml";let Le=De,Ce=!1,Ie=null;const Me=addToSet({},[xe,Pe,De],stringToString),ke=freeze(["mi","mo","mn","ms","mtext"]);let ze=addToSet({},ke);const Ue=freeze(["annotation-xml"]);let Fe=addToSet({},Ue);const He=addToSet({},["title","style","font","a","script"]);let je=null;const Ye=["application/xhtml+xml","text/html"];let Ge=null,Be=null;const We=n.createElement("form"),Xe=function(e){return e instanceof RegExp||e instanceof Function},$e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Be&&Be===e)return;e&&"object"==typeof e||(e={}),e=clone(e),je=-1===Ye.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Ge="application/xhtml+xml"===je?stringToString:stringToLowerCase,q=_resolveSetOption(e,"ALLOWED_TAGS",V,{transform:Ge}),Z=_resolveSetOption(e,"ALLOWED_ATTR",J,{transform:Ge}),Ie=_resolveSetOption(e,"ALLOWED_NAMESPACES",Me,{transform:stringToString}),Re=_resolveSetOption(e,"ADD_URI_SAFE_ATTR",Ne,{transform:Ge,base:Ne}),we=_resolveSetOption(e,"ADD_DATA_URI_TAGS",ve,{transform:Ge,base:ve}),Ae=_resolveSetOption(e,"FORBID_CONTENTS",Oe,{transform:Ge}),ee=_resolveSetOption(e,"FORBID_TAGS",clone({}),{transform:Ge}),te=_resolveSetOption(e,"FORBID_ATTR",clone({}),{transform:Ge}),_e=!!objectHasOwnProperty(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?clone(e.USE_PROFILES):e.USE_PROFILES),re=!1!==e.ALLOW_ARIA_ATTR,oe=!1!==e.ALLOW_DATA_ATTR,ae=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ie=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,le=e.SAFE_FOR_TEMPLATES||!1,se=!1!==e.SAFE_FOR_XML,ce=e.WHOLE_DOCUMENT||!1,de=e.RETURN_DOM||!1,ye=e.RETURN_DOM_FRAGMENT||!1,ge=e.RETURN_TRUSTED_TYPE||!1,me=e.FORCE_BODY||!1,he=!1!==e.SANITIZE_DOM,Te=e.SANITIZE_NAMED_PROPS||!1,be=!1!==e.KEEP_CONTENT,Se=e.IN_PLACE||!1,K=isRegex(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:IS_ALLOWED_URI,Le="string"==typeof e.NAMESPACE?e.NAMESPACE:De,ze=_resolveObjectOption(e,"MATHML_TEXT_INTEGRATION_POINTS",()=>addToSet({},ke)),Fe=_resolveObjectOption(e,"HTML_INTEGRATION_POINTS",()=>addToSet({},Ue));const t=_resolveObjectOption(e,"CUSTOM_ELEMENT_HANDLING",()=>create(null));if(Q=create(null),objectHasOwnProperty(t,"tagNameCheck")&&Xe(t.tagNameCheck)&&(Q.tagNameCheck=t.tagNameCheck),objectHasOwnProperty(t,"attributeNameCheck")&&Xe(t.attributeNameCheck)&&(Q.attributeNameCheck=t.attributeNameCheck),objectHasOwnProperty(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(Q.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),seal(Q),le&&(oe=!1),ye&&(de=!0),_e&&(q=addToSet({},text),Z=create(null),!0===_e.html&&(addToSet(q,html$1),addToSet(Z,html)),!0===_e.svg&&(addToSet(q,svg$1),addToSet(Z,svg),addToSet(Z,xml)),!0===_e.svgFilters&&(addToSet(q,svgFilters),addToSet(Z,svg),addToSet(Z,xml)),!0===_e.mathMl&&(addToSet(q,mathMl$1),addToSet(Z,mathMl),addToSet(Z,xml))),ne.tagCheck=null,ne.attributeCheck=null,objectHasOwnProperty(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?ne.tagCheck=e.ADD_TAGS:arrayIsArray(e.ADD_TAGS)&&(q===V&&(q=clone(q)),addToSet(q,e.ADD_TAGS,Ge))),objectHasOwnProperty(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?ne.attributeCheck=e.ADD_ATTR:arrayIsArray(e.ADD_ATTR)&&(Z===J&&(Z=clone(Z)),addToSet(Z,e.ADD_ATTR,Ge))),objectHasOwnProperty(e,"ADD_FORBID_CONTENTS")&&arrayIsArray(e.ADD_FORBID_CONTENTS)&&(Ae===Oe&&(Ae=clone(Ae)),addToSet(Ae,e.ADD_FORBID_CONTENTS,Ge)),be&&(q["#text"]=!0),ce&&addToSet(q,["html","head","body"]),q.table&&(addToSet(q,["tbody"]),delete ee.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const t=v;v=e.TRUSTED_TYPES_POLICY;try{N=L("")}catch(e){throw v=t,e}}else null===e.TRUSTED_TYPES_POLICY?(v=void 0,N=""):(void 0===v&&(x||(R=_createTrustedTypesPolicy(p,o),x=!0),v=R),v&&"string"==typeof N&&(N=L("")));freeze&&freeze(e),Be=e},Ke=addToSet({},[...svg$1,...svgFilters,...svgDisallowed]),qe=addToSet({},[...mathMl$1,...mathMlDisallowed]),Ve=function(e){let t=T(e);t&&t.tagName||(t={namespaceURI:Le,tagName:"template"});const n=stringToLowerCase(e.tagName),r=stringToLowerCase(t.tagName);return!!Ie[e.namespaceURI]&&(e.namespaceURI===Pe?function(e,t,n){return t.namespaceURI===De?"svg"===e:t.namespaceURI===xe?"svg"===e&&("annotation-xml"===n||ze[n]):Boolean(Ke[e])}(n,t,r):e.namespaceURI===xe?function(e,t,n){return t.namespaceURI===De?"math"===e:t.namespaceURI===Pe?"math"===e&&Fe[n]:Boolean(qe[e])}(n,t,r):e.namespaceURI===De?function(e,t,n){return!(t.namespaceURI===Pe&&!Fe[n])&&!(t.namespaceURI===xe&&!ze[n])&&!qe[e]&&(He[e]||!Ke[e])}(n,t,r):!("application/xhtml+xml"!==je||!Ie[e.namespaceURI]))},Ze=function(e){arrayPush(t.removed,{element:e});try{T(e).removeChild(e)}catch(t){if(d(e),!T(e))throw typeErrorCreate("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Je=function(e,t,n){try{y(e,t)}catch(t){try{e.removeAttribute(n)}catch(e){}}},Qe=function(e){nt(e);const t=h(e);if(t){const e=[];arrayForEach(t,t=>{arrayPush(e,t)}),arrayForEach(e,e=>{try{d(e)}catch(e){}})}const n=b(e);if(n)for(let t=n.length-1;t>=0;--t){const r=n[t],o=r&&r.name;"string"==typeof o&&Je(e,r,o)}},et=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch(e){r=null}arrayPush(t.removed,{attribute:r||null,from:n});try{r?y(n,r):n.removeAttribute(e)}catch(t){try{n.removeAttribute(e)}catch(e){}}if("is"===e)if(de||ye)try{Ze(n)}catch(e){}else try{n.setAttribute(e,"")}catch(e){}},tt=function(e){const t=b(e);if(t)for(let n=t.length-1;n>=0;--n){const r=t[n],o=r&&r.name;"string"!=typeof o||Z[Ge(o)]||Je(e,r,o)}},nt=function(e){const t=[e];for(;t.length>0;){const e=t.pop();O(e)===NODE_TYPE.element&&tt(e);const n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},rt=function(e,t){return!!se&&("patchsrc"===e||"for"===e&&"label"!==t&&"output"!==t)},ot=function(e){let t=null,r=null;if(me)e=""+e;else{const t=stringMatch(e,/^[\r\n\t ]+/);r=t&&t[0]}"application/xhtml+xml"===je&&Le===De&&(e=''+e+"");const o=v?L(e):e;if(Le===De)try{t=(new u).parseFromString(o,je)}catch(e){}if(!t||!t.documentElement){t=I.createDocument(Le,"template",null);try{t.documentElement.innerHTML=Ce?N:o}catch(e){}}const a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Le===De?z.call(t,ce?"html":"body")[0]:ce?t.documentElement:a},at=function(e){const t=A?A(e):e.ownerDocument;return M.call(t||e,e,s.SHOW_ELEMENT|s.SHOW_COMMENT|s.SHOW_TEXT|s.SHOW_PROCESSING_INSTRUCTION|s.SHOW_CDATA_SECTION,null)},it=function(e){return e=stringReplace(e,H," "),e=stringReplace(e,j," "),e=stringReplace(e,Y," ")},lt=function(e){var t;e.normalize();const n=A?A(e):e.ownerDocument,r=M.call(n||e,e,s.SHOW_TEXT|s.SHOW_COMMENT|s.SHOW_CDATA_SECTION|s.SHOW_PROCESSING_INSTRUCTION,null);let o=r.nextNode();for(;o;)o.data=it(o.data),o=r.nextNode();const a=null===(t=e.querySelectorAll)||void 0===t?void 0:t.call(e,"template");a&&arrayForEach(a,e=>{ct(e.content)&<(e.content)})},st=function(e){const t=_?_(e):null;return"string"==typeof t&&("form"===Ge(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==b(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.removeAttributeNode||"function"!=typeof e.getAttributeNode||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==S(e)||e.childNodes!==h(e)))},ct=function(e){if(!S||"object"!=typeof e||null===e)return!1;try{return S(e)===NODE_TYPE.documentFragment}catch(e){return!1}},ut=function(e){if(!S||"object"!=typeof e||null===e)return!1;try{return"number"==typeof S(e)}catch(e){return!1}};function pt(e,n,r){0!==e.length&&arrayForEach(e,e=>{e.call(t,n,r,Be)})}const ft=function(e,t){if(e instanceof RegExp)return regExpTest(e,t);if(e instanceof Function){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o=0;--o){const a=e===n?m(r[o],!0):r[o];t.insertBefore(a,g(e))}}return Ze(e),!0}(e,r,n);return!1===t&&pt(F.afterSanitizeElements,e,null),t}if(O(e)===NODE_TYPE.element&&!Ve(e))return Ze(e),!0;if(("noscript"===r||"noembed"===r||"noframes"===r)&®ExpTest(FALLBACK_TAG_CLOSE,e.innerHTML))return Ze(e),!0;if(le&&e.nodeType===NODE_TYPE.text){const n=it(e.textContent);e.textContent!==n&&(arrayPush(t.removed,{element:e.cloneNode()}),e.textContent=n)}return pt(F.afterSanitizeElements,e,null),!1},gt=function(e,t,r){if(te[t])return!1;if(rt(t,e))return!1;if(he&&("id"===t||"name"===t)&&(r in n||r in We))return!1;const o=Z[t]||ne.attributeCheck instanceof Function&&ne.attributeCheck(t,e);return!(!oe||!regExpTest(G,t))||(!(!re||!regExpTest(B,t))||(o?!!Re[t]||(!!regExpTest(K,stringReplace(r,X,""))||(!("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==stringIndexOf(r,"data:")||!we[e])||(!(!ae||regExpTest(W,stringReplace(r,X,"")))||!r))):Tt(e)&&ft(Q.tagNameCheck,e)&&ft(Q.attributeNameCheck,t,e)||"is"===t&&Q.allowCustomizedBuiltInElements&&ft(Q.tagNameCheck,r)))},ht=addToSet({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Tt=function(e){return!ht[stringToLowerCase(e)]&®ExpTest($,e)},Et=function(e,t,n,r){if(v&&"object"==typeof p&&"function"==typeof p.getAttributeType&&!n)switch(p.getAttributeType(e,t)){case"TrustedHTML":return L(r);case"TrustedScriptURL":return function(e){D(),P++;try{return v.createScriptURL(e)}finally{P--}}(r)}return r},bt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!st(e)||(Ze(e),!1)}catch(n){return et(t,e),!1}},St=function(e){pt(F.beforeSanitizeAttributes,e,null);const n=e.attributes;if(!n||st(e))return;Z=mt(F.uponSanitizeAttribute,Z,J,fe);const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Z,forceKeepAttr:void 0};let o=n.length;const a=Ge(e.nodeName);for(;o--;){const i=n[o],l=i.name,s=i.namespaceURI,c=i.value,u=Ge(l),p=c;let f="value"===l?p:stringTrim(p),m=!1;if(r.attrName=u,r.attrValue=f,r.keepAttr=!0,r.forceKeepAttr=void 0,pt(F.uponSanitizeAttribute,e,r),f=r.attrValue,!Te||"id"!==u&&"name"!==u||0===stringIndexOf(f,Ee)||(et(l,e,i),f=Ee+f,m=!0),se&®ExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f))et(l,e,i);else if("attributename"===u&&stringMatch(f,"href"))et(l,e,i);else if(!r.forceKeepAttr)if(r.keepAttr)if(ie||!regExpTest(SELF_CLOSING_TAG,f))if(le&&(f=it(f)),gt(a,u,f)){if(f=Et(a,u,s,f),f!==p){bt(e,l,s,f)&&m&&arrayPop(t.removed)}}else et(l,e,i);else et(l,e,i);else et(l,e,i)}pt(F.afterSanitizeAttributes,e,null)},_t=function(e){let t=null;const n=at(e);for(pt(F.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(pt(F.uponSanitizeShadowNode,t,null),yt(t,e),St(t),ct(t.content)&&_t(t.content),O(t)===NODE_TYPE.element){const e=E(t);ct(e)&&(At(e),_t(e))}pt(F.afterSanitizeShadowDOM,e,null)},At=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const e=t.pop();if(e.shadow){_t(e.shadow);continue}const n=e.node,r=O(n)===NODE_TYPE.element,o=h(n);if(o)for(let e=o.length-1;e>=0;--e)t.push({node:o[e],shadow:null});if(r){const e=_?_(n):null;if("string"==typeof e&&"template"===Ge(e)){const e=n.content;ct(e)&&t.push({node:e,shadow:null})}}if(r){const e=E(n);ct(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=null,a=null,i=null,l=null;if(Ce=!e,Ce&&(e="\x3c!--\x3e"),"string"!=typeof e&&!ut(e)&&"string"!=typeof(e=stringifyValue(e)))throw typeErrorCreate("dirty is not a string, aborting");if(!t.isSupported)return e;ue?(q=pe,Z=fe):$e(n),(F.uponSanitizeElement.length>0||F.uponSanitizeAttribute.length>0)&&(q=clone(q)),F.uponSanitizeAttribute.length>0&&(Z=clone(Z)),t.removed=[];const s=Se&&"string"!=typeof e&&ut(e);if(s){!function(e){if(!se)return;const t=[e];for(;t.length>0;){const e=t.pop(),n=O(e);if(n===NODE_TYPE.processingInstruction||n===NODE_TYPE.comment&®ExpTest(COMMENT_MARKUP_PROBE,e.data)){try{d(e)}catch(e){}continue}if(n===NODE_TYPE.element){const t=e,n=Ge(w(e));try{t.hasAttribute&&t.hasAttribute("patchsrc")&&t.removeAttribute("patchsrc"),t.hasAttribute&&t.hasAttribute("for")&&rt("for",n)&&t.removeAttribute("for")}catch(e){}}const r=h(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}}(e);const t=w(e);if("string"==typeof t){const n=Ge(t);if(!q[n]||ee[n])throw Qe(e),typeErrorCreate("root node is forbidden and cannot be sanitized in-place")}if(st(e))throw Qe(e),typeErrorCreate("root node is clobbered and cannot be sanitized in-place");try{At(e)}catch(t){throw Qe(e),t}}else if(ut(e))o=ot("\x3c!----\x3e"),a=o.ownerDocument.importNode(e,!0),a.nodeType===NODE_TYPE.element&&"BODY"===a.nodeName||"HTML"===a.nodeName?o=a:o.appendChild(a),At(o);else{if(!de&&!le&&!ce&&-1===e.indexOf("<"))return v&&ge?L(e):e;if(o=ot(e),!o)return de?null:ge?N:""}o&&me&&Ze(o.firstChild);const c=s?e:o;try{const e=at(c);for(;i=e.nextNode();)yt(i,c),St(i),ct(i.content)&&_t(i.content)}catch(n){throw s&&(Qe(e),arrayForEach(t.removed,e=>{e.element&&nt(e.element)})),n}if(s)return arrayForEach(t.removed,e=>{e.element&&nt(e.element)}),le&<(e),e;if(de){if(le&<(o),ye)for(l=k.call(o.ownerDocument);o.firstChild;)l.appendChild(o.firstChild);else l=o;return(Z.shadowroot||Z.shadowrootmode)&&(l=U.call(r,l,!0)),l}let u=ce?o.outerHTML:o.innerHTML;return ce&&q["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&®ExpTest(DOCTYPE_NAME,o.ownerDocument.doctype.name)&&(u="\n"+u),le&&(u=it(u)),v&&ge?L(u):u},t.setConfig=function(){$e(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ue=!0,pe=q,fe=Z},t.clearConfig=function(){Be=null,ue=!1,pe=null,fe=null,v=R,N=""},t.isValidAttribute=function(e,t,n){Be||$e({});const r=Ge(e),o=Ge(t);return gt(r,o,n)},t.addHook=function(e,t){"function"==typeof t&&objectHasOwnProperty(F,e)&&arrayPush(F[e],t)},t.removeHook=function(e,t){if(objectHasOwnProperty(F,e)){if(void 0!==t){const n=arrayLastIndexOf(F[e],t);return-1===n?void 0:arraySplice(F[e],n,1)[0]}return arrayPop(F[e])}},t.removeHooks=function(e){objectHasOwnProperty(F,e)&&(F[e]=[])},t.removeAllHooks=function(){F=_createHooksMap()},t}var purify=createDOMPurify();export{purify as default};