Files

4 lines
29 KiB
JavaScript

/*! @license DOMPurify 3.4.17 | (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.17/LICENSE */(function(ht,rt){typeof exports=="object"&&typeof module<"u"?module.exports=rt():typeof define=="function"&&define.amd?define([],rt):(ht=typeof globalThis<"u"?globalThis:ht||self,ht.DOMPurify=rt())})(this,function(){"use strict";function ht(r,i){this.v=r,this.k=i}function rt(r,i){(i==null||i>r.length)&&(i=r.length);for(var a=0,c=Array(i);a<i;a++)c[a]=r[a];return c}function _n(r){if(Array.isArray(r))return r}function On(r,i){var a=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(a!=null){var c,A,m,T,P=[],y=!0,U=!1;try{if(m=(a=a.call(r)).next,i===0){if(Object(a)!==a)return;y=!1}else for(;!(y=(c=m.call(a)).done)&&(P.push(c.value),P.length!==i);y=!0);}catch(O){U=!0,A=O}finally{try{if(!y&&a.return!=null&&(T=a.return(),Object(T)!==T))return}finally{if(U)throw A}}return P}}function Nn(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */function kn(r,i){return _n(r)||On(r,i)||Dn(r,i)||Nn()}function Dn(r,i){if(r){if(typeof r=="string")return rt(r,i);var a={}.toString.call(r).slice(8,-1);return a==="Object"&&r.constructor&&(a=r.constructor.name),a==="Map"||a==="Set"?Array.from(r):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?rt(r,i):void 0}}function Ot(r){var i,a;function c(m,T){try{var P=r[m](T),y=P.value,U=y instanceof ht;Promise.resolve(U?y.v:y).then(function(O){if(U){var I=m==="return"&&y.k?m:"next";if(!y.k||O.done)return c(I,O);O=r[I](O).value}A(!!P.done,O)},function(O){c("throw",O)})}catch(O){A(2,O)}}function A(m,T){m===2?i.reject(T):i.resolve({value:T,done:m}),(i=i.next)?c(i.key,i.arg):a=null}this._invoke=function(m,T){return new Promise(function(P,y){var U={key:m,arg:T,resolve:P,reject:y,next:null};a?a=a.next=U:(i=a=U,c(m,T))})},typeof r.return!="function"&&(this.return=void 0)}Ot.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Ot.prototype.next=function(r){return this._invoke("next",r)},Ot.prototype.throw=function(r){return this._invoke("throw",r)},Ot.prototype.return=function(r){return this._invoke("return",r)};let xe=Object.entries,_e=Object.setPrototypeOf,Cn=Object.isFrozen,Oe=Object.getPrototypeOf,Ne=Object.getOwnPropertyDescriptor,E=Object.freeze,w=Object.seal,ot=Object.create,ke=typeof Reflect<"u"&&Reflect,jt=ke.apply,Ht=ke.construct;E||(E=function(r){return r}),w||(w=function(r){return r}),jt||(jt=function(r,i){var a=[...arguments].slice(2);return r.apply(i,a)}),Ht||(Ht=function(r){return new r(...[...arguments].slice(1))});let B=d(Array.prototype.forEach);Array.prototype.indexOf;let Rn=d(Array.prototype.lastIndexOf),De=d(Array.prototype.pop),gt=d(Array.prototype.push),In=d(Array.prototype.slice),Ln=d(Array.prototype.splice),it=Array.isArray,Bt=Me(Set),Wt=d(Set.prototype.add),yt=d(Set.prototype.has),K=d(String.prototype.toLowerCase),Yt=d(String.prototype.toString),Ce=d(String.prototype.match),bt=d(String.prototype.replace),Re=d(String.prototype.indexOf),Mn=d(String.prototype.trim),zn=d(Number.prototype.toString),Pn=d(Boolean.prototype.toString),Ie=typeof BigInt>"u"?null:d(BigInt.prototype.toString),Le=typeof Symbol>"u"?null:d(Symbol.prototype.toString),N=d(Object.prototype.hasOwnProperty),Tt=d(Object.prototype.toString),x=d(RegExp.prototype.test),W=Me(TypeError);function d(r){return function(i){i instanceof RegExp&&(i.lastIndex=0);var a=[...arguments].slice(1);return jt(r,i,a)}}function Me(r){return function(){return Ht(r,[...arguments])}}function f(r,i){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:K;if(_e&&_e(r,null),!it(i))return r;let c=i.length;for(;c--;){let A=i[c];if(typeof A=="string"){let m=a(A);m!==A&&(Cn(i)||(i[c]=m),A=m)}r[A]=!0}return r}function Un(r){for(let i=0;i<r.length;i++)N(r,i)||(r[i]=null);return r}function C(r){let i=ot(null);for(let c of xe(r)){var a=kn(c,2);let A=a[0],m=a[1];N(r,A)&&(i[A]=it(m)?Un(m):m&&typeof m=="object"&&m.constructor===Object?C(m):m)}return i}function Fn(r){switch(typeof r){case"string":return r;case"number":return zn(r);case"boolean":return Pn(r);case"bigint":return Ie?Ie(r):"0";case"symbol":return Le?Le(r):"Symbol()";case"undefined":return Tt(r);case"function":case"object":{if(r===null)return Tt(r);let i=r,a=R(i,"toString");if(typeof a=="function"){let c=a(i);return typeof c=="string"?c:Tt(c)}return Tt(r)}default:return Tt(r)}}function R(r,i){for(;r!==null;){let c=Ne(r,i);if(c){if(c.get)return d(c.get);if(typeof c.value=="function")return d(c.value)}r=Oe(r)}function a(){return null}return a}function jn(r,i){for(;r!==null;){let a=Ne(r,i);if(a)return a.get?d(a.get):null;r=Oe(r)}return null}function Hn(r){try{return x(r,""),!0}catch(i){return!1}}let ze=E("a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr".split(".")),Gt=E("svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern".split(".")),qt=E(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Bn=E(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Xt=E("math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts".split(".")),Wn=E(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Pe=E(["#text"]),Ue=E("accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns".split(".")),$t=E("accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan".split(".")),Fe=E("accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns".split(".")),Nt=E(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Yn=w(/{{[\w\W]*|^[\w\W]*}}/g),Gn=w(/<%[\w\W]*|^[\w\W]*%>/g),qn=w(/\${[\w\W]*/g),Xn=w(/^data-[\-\w.\u00B7-\uFFFF]+$/),$n=w(/^aria-[\-\w]+$/),je=w(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Kn=w(/^(?:\w+script|data):/i),Vn=w(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Zn=w(/^html$/i),Jn=w(/^[a-z][.\w]*(-[.\w]+)+$/i),Kt=w(/<[/\w!]/g),He=w(/<[/\w]/g),Qn=w(/<\/no(script|embed|frames)/i),Be=w(/\/>/i),v={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},tr=E(f({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),er=function(){return typeof window>"u"?null:window},nr=function(r,i){if(typeof r!="object"||typeof r.createPolicy!="function")return null;let a=null,c="data-tt-policy-suffix";i&&i.hasAttribute(c)&&(a=i.getAttribute(c));let A="dompurify"+(a?"#"+a:"");try{return r.createPolicy(A,{createHTML(m){return m},createScriptURL(m){return m}})}catch(m){return console.warn("TrustedTypes policy "+A+" could not be created."),null}},We=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},G=function(r,i,a,c){return N(r,i)&&it(r[i])?f(c.base?C(c.base):{},r[i],c.transform):a},Vt=function(r,i,a){let c=N(r,i)?r[i]:void 0;return c&&typeof c=="object"?C(c):a()};function Ye(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:er(),i=t=>Ye(t);if(i.version="3.4.17",i.removed=[],!r||!r.document||r.document.nodeType!==v.document||!r.Element)return i.isSupported=!1,i;let a=r.document,c=a,A=c.currentScript;r.DocumentFragment;let m=r.HTMLTemplateElement,T=r.Node,P=r.Element,y=r.NodeFilter;r.NamedNodeMap===void 0&&(r.NamedNodeMap||r.MozNamedAttrMap),r.HTMLFormElement;let U=r.DOMParser,O=r.trustedTypes,I=P.prototype,rr=R(I,"cloneNode"),Zt=R(I,"remove"),Ge=R(I,"removeAttributeNode"),or=R(I,"nextSibling"),St=R(I,"childNodes"),at=R(I,"parentNode"),Jt=R(I,"shadowRoot"),Qt=R(I,"attributes"),V=T&&T.prototype?R(T.prototype,"nodeType"):null,lt=T&&T.prototype?R(T.prototype,"nodeName"):null,kt=T&&T.prototype?R(T.prototype,"ownerDocument"):null,L=function(t){return V?V(t):t.nodeType},vt=function(t){return lt?lt(t):t.nodeName},qe=jn(I,"namespaceURI"),te=function(t){return qe?qe(t):t.namespaceURI};if(typeof m=="function"){let t=a.createElement("template");t.content&&t.content.ownerDocument&&(a=t.content.ownerDocument)}let k,Z="",ee,Xe=!1,At=0,$e=function(){if(At>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.')},ut=function(t){$e(),At++;try{return k.createHTML(t)}finally{At--}},ir=function(t){$e(),At++;try{return k.createScriptURL(t)}finally{At--}},ar=function(){return Xe||(ee=nr(O,A),Xe=!0),ee},Dt=a,ne=Dt.implementation,Ke=Dt.createNodeIterator,lr=Dt.createDocumentFragment,ur=Dt.getElementsByTagName,cr=c.importNode,p=We();i.isSupported=typeof xe=="function"&&typeof at=="function"&&ne&&ne.createHTMLDocument!==void 0;let sr=Yn,fr=Gn,mr=qn,pr=Xn,dr=$n,hr=Kn,Ve=Vn,gr=Jn,Ze=je,h=null,re=f({},[...ze,...Gt,...qt,...Xt,...Pe]),g=null,oe=f({},[...Ue,...$t,...Fe,...Nt]),F=Object.seal(ot(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}})),Et=null,Je=null,q=Object.seal(ot(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Qe=!0,ie=!0,tn=!1,ae=!0,Y=!1,J=!0,Q=!1,le=!1,Ct=null,Rt=null,ue=!1,ct=!1,It=!1,Lt=!1,en=!0,nn=!1,rn="user-content-",ce=!0,se=!1,tt=null,st={},et=null,on=f({},"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(".")),an=null,ln=f({},["audio","video","img","source","image","track"]),un=null,cn=f({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Mt="http://www.w3.org/1998/Math/MathML",zt="http://www.w3.org/2000/svg",j="http://www.w3.org/1999/xhtml",ft=j,fe=!1,me=null,yr=f({},[Mt,zt,j],Yt),sn=E(["mi","mo","mn","ms","mtext"]),pe=f({},sn),fn=E(["annotation-xml"]),de=f({},fn),br=f({},["title","style","font","a","script"]),wt=null,Tr=["application/xhtml+xml","text/html"],S=null,mt=null,Sr=a.createElement("form"),mn=function(t){return t instanceof RegExp||t instanceof Function},he=function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(mt&&mt===t)return;(!t||typeof t!="object")&&(t={}),t=C(t),wt=Tr.indexOf(t.PARSER_MEDIA_TYPE)===-1?"text/html":t.PARSER_MEDIA_TYPE,S=wt==="application/xhtml+xml"?Yt:K,h=G(t,"ALLOWED_TAGS",re,{transform:S}),g=G(t,"ALLOWED_ATTR",oe,{transform:S}),me=G(t,"ALLOWED_NAMESPACES",yr,{transform:Yt}),un=G(t,"ADD_URI_SAFE_ATTR",cn,{transform:S,base:cn}),an=G(t,"ADD_DATA_URI_TAGS",ln,{transform:S,base:ln}),et=G(t,"FORBID_CONTENTS",on,{transform:S}),Et=G(t,"FORBID_TAGS",C({}),{transform:S}),Je=G(t,"FORBID_ATTR",C({}),{transform:S}),st=N(t,"USE_PROFILES")?t.USE_PROFILES&&typeof t.USE_PROFILES=="object"?C(t.USE_PROFILES):t.USE_PROFILES:!1,Qe=t.ALLOW_ARIA_ATTR!==!1,ie=t.ALLOW_DATA_ATTR!==!1,tn=t.ALLOW_UNKNOWN_PROTOCOLS||!1,ae=t.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Y=t.SAFE_FOR_TEMPLATES||!1,J=t.SAFE_FOR_XML!==!1,Q=t.WHOLE_DOCUMENT||!1,ct=t.RETURN_DOM||!1,It=t.RETURN_DOM_FRAGMENT||!1,Lt=t.RETURN_TRUSTED_TYPE||!1,ue=t.FORCE_BODY||!1,en=t.SANITIZE_DOM!==!1,nn=t.SANITIZE_NAMED_PROPS||!1,ce=t.KEEP_CONTENT!==!1,se=t.IN_PLACE||!1,Ze=Hn(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:je,ft=typeof t.NAMESPACE=="string"?t.NAMESPACE:j,pe=Vt(t,"MATHML_TEXT_INTEGRATION_POINTS",()=>f({},sn)),de=Vt(t,"HTML_INTEGRATION_POINTS",()=>f({},fn));let e=Vt(t,"CUSTOM_ELEMENT_HANDLING",()=>ot(null));if(F=ot(null),N(e,"tagNameCheck")&&mn(e.tagNameCheck)&&(F.tagNameCheck=e.tagNameCheck),N(e,"attributeNameCheck")&&mn(e.attributeNameCheck)&&(F.attributeNameCheck=e.attributeNameCheck),N(e,"allowCustomizedBuiltInElements")&&typeof e.allowCustomizedBuiltInElements=="boolean"&&(F.allowCustomizedBuiltInElements=e.allowCustomizedBuiltInElements),w(F),Y&&(ie=!1),It&&(ct=!0),st&&(h=f({},Pe),g=ot(null),st.html===!0&&(f(h,ze),f(g,Ue)),st.svg===!0&&(f(h,Gt),f(g,$t),f(g,Nt)),st.svgFilters===!0&&(f(h,qt),f(g,$t),f(g,Nt)),st.mathMl===!0&&(f(h,Xt),f(g,Fe),f(g,Nt))),q.tagCheck=null,q.attributeCheck=null,N(t,"ADD_TAGS")&&(typeof t.ADD_TAGS=="function"?q.tagCheck=t.ADD_TAGS:it(t.ADD_TAGS)&&(h===re&&(h=C(h)),f(h,t.ADD_TAGS,S))),N(t,"ADD_ATTR")&&(typeof t.ADD_ATTR=="function"?q.attributeCheck=t.ADD_ATTR:it(t.ADD_ATTR)&&(g===oe&&(g=C(g)),f(g,t.ADD_ATTR,S))),N(t,"ADD_FORBID_CONTENTS")&&it(t.ADD_FORBID_CONTENTS)&&(et===on&&(et=C(et)),f(et,t.ADD_FORBID_CONTENTS,S)),ce&&(h["#text"]=!0),Q&&f(h,["html","head","body"]),h.table&&(f(h,["tbody"]),delete Et.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 n=k;k=t.TRUSTED_TYPES_POLICY;try{Z=ut("")}catch(o){throw k=n,o}}else t.TRUSTED_TYPES_POLICY===null?(k=void 0,Z=""):(k===void 0&&(k=ar()),k&&typeof Z=="string"&&(Z=ut("")));E&&E(t),mt=t},pn=f({},[...Gt,...qt,...Bn]),dn=f({},[...Xt,...Wn]),vr=function(t,e,n){return e.namespaceURI===j?t==="svg":e.namespaceURI===Mt?t==="svg"&&(n==="annotation-xml"||pe[n]):!!pn[t]},Ar=function(t,e,n){return e.namespaceURI===j?t==="math":e.namespaceURI===zt?t==="math"&&de[n]:!!dn[t]},Er=function(t,e,n){return e.namespaceURI===zt&&!de[n]||e.namespaceURI===Mt&&!pe[n]?!1:!dn[t]&&(br[t]||!pn[t])},wr=function(t){let e=te(t),n=K(vt(t)),o=at(t),l,u;return o&&L(o)===v.element?(l={namespaceURI:te(o)},u=K(vt(o))):(l={namespaceURI:ft},u="template"),me[e]?e===zt?vr(n,l,u):e===Mt?Ar(n,l,u):e===j?Er(n,l,u):!!(wt==="application/xhtml+xml"&&me[e]):!1},nt=function(t){gt(i.removed,{element:t});try{at(t).removeChild(t)}catch(e){if(Zt(t),!at(t))throw W("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},hn=function(t,e,n){try{Ge(t,e)}catch(o){try{t.removeAttribute(n)}catch(l){}}},ge=function(t){be(t);let e=St(t);e&&B(In(e),o=>{try{Zt(o)}catch(l){}});let n=L(t)===v.element?Qt(t):null;if(n)for(let o=n.length-1;o>=0;--o){let l=n[o],u=l&&l.name;typeof u=="string"&&hn(t,l,u)}},pt=function(t,e,n){if(!n)try{n=e.getAttributeNode(t)}catch(o){n=null}gt(i.removed,{attribute:n||null,from:e});try{n?Ge(e,n):e.removeAttribute(t)}catch(o){try{e.removeAttribute(t)}catch(l){}}if(t==="is")if(ct||It)try{nt(e)}catch(o){}else try{e.setAttribute(t,"")}catch(o){}},gn=function(t){let e=Qt(t);if(e)for(let n=e.length-1;n>=0;--n){let o=e[n],l=o&&o.name;typeof l!="string"||g[S(l)]||hn(t,o,l)}},ye=function(t,e){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],o=[t];for(;o.length>0;){let l=o.pop();if(e(l)===!1)continue;if(n&&L(l)===v.element){let s=Jt(l);X(s)&&o.push(s)}let u=St(l);if(u)for(let s=u.length-1;s>=0;--s)o.push(u[s])}},be=function(t){ye(t,e=>{L(e)===v.element&&gn(e)})},Te=function(t){let e=[];return ye(t,n=>{e.push(n)},!0),e},xr=function(t,e){let n=Bt();B(Te(t),o=>{L(o)===v.element&&Wt(n,o)}),B(e,o=>{L(o)===v.element&&!yt(n,o)&&gn(o)})},yn=function(t,e){let n=!1;return B(i.removed,o=>{o.element&&(n=n||o.element===t,be(o.element))}),xr(t,e),n},_r=function(t,e){let n=tt,o=null,l=()=>(o||(o=Bt(),B(e,u=>{Wt(o,u)})),o);for(let u=0;;u++){let s=Te(t),b=[t],$=!1;if(B(s,M=>{L(M)===v.documentFragment?gt(b,M):!$&&!yt(n,M)&&($=yt(l(),M))}),!$)return;if(u>=8)throw W("the tree kept changing during in-place sanitization; refusing to return it");B(b,(M,D)=>{Or(M,D>0,t,l())})}},Or=function(t,e,n,o){let l=Se(t),u;for(;u=l.nextNode();)yt(o,u)&&!yt(tt,u)&&(e&&z(p.uponSanitizeShadowNode,u,null),Ae(u,n),Ee(u,n),X(u.content)&&_t(u.content))},Nr=function(t){tt&&Wt(tt,t)},bn=function(t,e){return J?t==="patchsrc"||t==="for"&&e!=="label"&&e!=="output":!1},kr=function(t){J&&ye(t,e=>{let n=L(e);if(n===v.processingInstruction||n===v.comment&&x(He,e.data)){try{Zt(e)}catch(o){}return!1}if(n===v.element){let o=e,l=S(vt(e));try{o.hasAttribute&&o.hasAttribute("patchsrc")&&o.removeAttribute("patchsrc"),o.hasAttribute&&o.hasAttribute("for")&&bn("for",l)&&o.removeAttribute("for")}catch(u){}}return!0})},Tn=function(t){let e=null,n=null;if(ue)t="<remove></remove>"+t;else{let u=Ce(t,/^[\r\n\t ]+/);n=u&&u[0]}wt==="application/xhtml+xml"&&ft===j&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");let o=k?ut(t):t;if(ft===j)try{e=new U().parseFromString(o,wt)}catch(u){}if(!e||!e.documentElement){e=ne.createDocument(ft,"template",null);try{e.documentElement.innerHTML=fe?Z:o}catch(u){}}let l=e.body||e.documentElement;return t&&n&&l.insertBefore(a.createTextNode(n),l.childNodes[0]||null),ft===j?ur.call(e,Q?"html":"body")[0]:Q?e.documentElement:l},Se=function(t){let e=kt?kt(t):t.ownerDocument;return Ke.call(e||t,t,y.SHOW_ELEMENT|y.SHOW_COMMENT|y.SHOW_TEXT|y.SHOW_PROCESSING_INSTRUCTION|y.SHOW_CDATA_SECTION,null)},Pt=function(t){return t=bt(t,sr," "),t=bt(t,fr," "),t=bt(t,mr," "),t},ve=function(t){var e;Sn(t);let n=(e=t.querySelectorAll)==null?void 0:e.call(t,"template");n&&B(n,o=>{X(o.content)&&ve(o.content)})},Sn=function(t){t.normalize();let e=kt?kt(t):t.ownerDocument,n=Ke.call(e||t,t,y.SHOW_TEXT|y.SHOW_COMMENT|y.SHOW_CDATA_SECTION|y.SHOW_PROCESSING_INSTRUCTION,null),o=n.nextNode();for(;o;)o.data=Pt(o.data),o=n.nextNode()},Ut=function(t){let e=lt?lt(t):null;return typeof e!="string"||S(e)!=="form"?!1:typeof t.nodeName!="string"||typeof t.textContent!="string"||typeof t.removeChild!="function"||t.attributes!==Qt(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!==V(t)||t.childNodes!==St(t)},X=function(t){if(!V||typeof t!="object"||!t)return!1;try{return V(t)===v.documentFragment}catch(e){return!1}},xt=function(t){if(!V||typeof t!="object"||!t)return!1;try{return typeof V(t)=="number"}catch(e){return!1}};function z(t,e,n){t.length!==0&&B(t,o=>{o.call(i,e,n,mt)})}let Dr=function(t,e){return!!(J&&t.hasChildNodes()&&!xt(t.firstElementChild)&&x(Kt,t.textContent)&&x(Kt,t.innerHTML)||J&&tr[e]&&L(t)===v.element&&te(t)===j&&(xt(t.firstElementChild)||typeof t.textContent=="string"&&x(Kt,t.textContent))||t.nodeType===v.processingInstruction||J&&t.nodeType===v.comment&&x(He,t.data))},Ft=function(t,e){return t instanceof RegExp?x(t,e):t instanceof Function&&!!t(e,...[...arguments].slice(2))},Cr=function(t,e,n){if(!Et[e]&&En(e)&&Ft(F.tagNameCheck,e))return!1;if(ce&&!et[e]&&!et[K(e)]){let o=at(t),l=St(t);if(l&&o){let u=l.length;for(let s=u-1;s>=0;--s){let b=t===n?rr(l[s],!0):l[s];o.insertBefore(b,or(t))}}}return nt(t),!0},vn=function(t,e,n,o){return t.length===0?e:e===n||e===o?C(e):e},dt=function(t,e){return t===e||at(t)!==null?!1:(se&&be(t),!0)},Ae=function(t,e){if(Nr(t),z(p.beforeSanitizeElements,t,null),dt(t,e))return!0;if(Ut(t))return nt(t),!0;let n=S(vt(t));if(h=vn(p.uponSanitizeElement,h,re,Ct),z(p.uponSanitizeElement,t,{tagName:n,allowedTags:h}),dt(t,e))return!0;if(Dr(t,n))return nt(t),!0;if(Et[n]||!(q.tagCheck instanceof Function&&q.tagCheck(n))&&!h[n]){let o=Cr(t,n,e);return o===!1&&(z(p.afterSanitizeElements,t,null),dt(t,e))?!0:o}if(L(t)===v.element&&!wr(t)||(n==="noscript"||n==="noembed"||n==="noframes")&&x(Qn,t.innerHTML))return nt(t),!0;if(Y&&t.nodeType===v.text){let o=Pt(t.textContent);t.textContent!==o&&(gt(i.removed,{element:t.cloneNode()}),t.textContent=o)}return z(p.afterSanitizeElements,t,null),dt(t,e)},An=function(t,e,n){if(Je[e]||bn(e,t)||en&&(e==="id"||e==="name")&&(n in a||n in Sr))return!1;let o=g[e]||q.attributeCheck instanceof Function&&q.attributeCheck(e,t);return ie&&x(pr,e)||Qe&&x(dr,e)?!0:o?un[e]||x(Ze,bt(n,Ve,""))||(e==="src"||e==="xlink:href"||e==="href")&&t!=="script"&&Re(n,"data:")===0&&an[t]||tn&&!x(hr,bt(n,Ve,""))?!0:!n:En(t)&&Ft(F.tagNameCheck,t)&&Ft(F.attributeNameCheck,e,t)||e==="is"&&F.allowCustomizedBuiltInElements&&Ft(F.tagNameCheck,n)},Rr=f({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),En=function(t){return!Rr[K(t)]&&x(gr,t)},Ir=function(t,e,n,o){if(k&&typeof O=="object"&&typeof O.getAttributeType=="function"&&!n)switch(O.getAttributeType(t,e)){case"TrustedHTML":return ut(o);case"TrustedScriptURL":return ir(o)}return o},Lr=function(t,e,n,o){try{return n?t.setAttributeNS(n,e,o):t.setAttribute(e,o),!Ut(t)||(nt(t),!1)}catch(l){return pt(e,t),!1}},wn=function(t,e){return J&&x(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,e)?!0:K(t)==="attributename"&&Ce(e,"href")!==null},Ee=function(t,e){if(z(p.beforeSanitizeAttributes,t,null),dt(t,e))return;let n=t.attributes;if(!n||Ut(t))return;g=vn(p.uponSanitizeAttribute,g,oe,Rt);let o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:g,forceKeepAttr:void 0},l=n.length,u=S(t.nodeName);for(;l--;){let s=n[l],b=s.name,$=s.namespaceURI,M=s.value,D=S(b),H=M,_=b==="value"?H:Mn(H),xn=!1;o.attrName=D,o.attrValue=_,o.keepAttr=!0,o.forceKeepAttr=void 0,z(p.uponSanitizeAttribute,t,o),_=o.attrValue,nn&&(D==="id"||D==="name")&&Re(_,rn)!==0&&(pt(b,t,s),_=rn+_,xn=!0),wn(b,_)?pt(b,t,s):o.forceKeepAttr||(o.keepAttr?!ae&&x(Be,_)?pt(b,t,s):(Y&&(_=Pt(_)),An(u,D,_)?(_=Ir(u,D,$,_),_!==H&&Lr(t,b,$,_)&&xn&&De(i.removed)):pt(b,t,s)):pt(b,t,s))}z(p.afterSanitizeAttributes,t,null),dt(t,e)},_t=function(t){let e=null,n=Se(t);for(z(p.beforeSanitizeShadowDOM,t,null);e=n.nextNode();)if(z(p.uponSanitizeShadowNode,e,null),Ae(e,t),Ee(e,t),X(e.content)&&_t(e.content),L(e)===v.element){let o=Jt(e);X(o)&&(we(o),_t(o))}Y&&Sn(t),z(p.afterSanitizeShadowDOM,t,null)},we=function(t){let e=[{node:t,shadow:null}];for(;e.length>0;){let n=e.pop();if(n.shadow){_t(n.shadow);continue}let o=n.node,l=L(o)===v.element,u=St(o);if(u)for(let s=u.length-1;s>=0;--s)e.push({node:u[s],shadow:null});if(l){let s=lt?lt(o):null;if(typeof s=="string"&&S(s)==="template"){let b=o.content;X(b)&&e.push({node:b,shadow:null})}}if(l){let s=Jt(o);X(s)&&e.push({node:null,shadow:s},{node:s,shadow:null})}}};return i.sanitize=function(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=null,o=null,l=null,u=null;if(fe=!t,fe&&(t="<!-->"),typeof t!="string"&&!xt(t)&&(t=Fn(t),typeof t!="string"))throw W("dirty is not a string, aborting");if(!i.isSupported)return t;le?(h=Ct,g=Rt):he(e),(p.uponSanitizeElement.length>0||p.uponSanitizeAttribute.length>0)&&(h=C(h)),p.uponSanitizeAttribute.length>0&&(g=C(g)),i.removed=[];let s=se&&typeof t!="string"&&xt(t),b=[],$=tt;if(s){kr(t);let H=vt(t);if(typeof H=="string"){let _=S(H);if(!h[_]||Et[_])throw ge(t),W("root node is forbidden and cannot be sanitized in-place")}if(Ut(t))throw ge(t),W("root node is clobbered and cannot be sanitized in-place");b=Te(t),tt=Bt()}else if(xt(t))n=Tn("<!---->"),o=n.ownerDocument.importNode(t,!0),o.nodeType===v.element&&o.nodeName==="BODY"||o.nodeName==="HTML"?n=o:n.appendChild(o),we(n);else{if(!ct&&!Y&&!Q&&t.indexOf("<")===-1)return k&&Lt?ut(t):t;if(n=Tn(t),!n)return ct?null:Lt?Z:""}n&&ue&&nt(n.firstChild);let M=s?t:n;try{s&&we(t);let H=Se(M);for(;l=H.nextNode();)Ae(l,M),Ee(l,M),X(l.content)&&_t(l.content);s&&_r(t,b)}catch(H){throw s&&(ge(t),yn(t,b)),H}finally{tt=$}if(s){if(yn(t,b))throw W("a node selected for removal could not be safely returned; refusing to sanitize in place");return Y&&ve(t),t}if(ct){if(Y&&ve(n),It)for(u=lr.call(n.ownerDocument);n.firstChild;)u.appendChild(n.firstChild);else u=n;return(g.shadowroot||g.shadowrootmode)&&(u=cr.call(c,u,!0)),u}let D=Q?n.outerHTML:n.innerHTML;return Q&&h["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&x(Zn,n.ownerDocument.doctype.name)&&(D="<!DOCTYPE "+n.ownerDocument.doctype.name+`>
`+D),Y&&(D=Pt(D)),k&&Lt?ut(D):D},i.setConfig=function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};he(t),le=!0,Ct=h,Rt=g},i.clearConfig=function(){mt=null,le=!1,Ct=null,Rt=null,k=ee,Z=""},i.isValidAttribute=function(t,e,n){mt||he({});let o=S(t),l=S(e);return typeof n=="string"&&(wn(e,n)||!ae&&x(Be,n))?!1:An(o,l,n)},i.addHook=function(t,e){typeof e=="function"&&N(p,t)&&gt(p[t],e)},i.removeHook=function(t,e){if(N(p,t)){if(e!==void 0){let n=Rn(p[t],e);return n===-1?void 0:Ln(p[t],n,1)[0]}return De(p[t])}},i.removeHooks=function(t){N(p,t)&&(p[t]=[])},i.removeAllHooks=function(){p=We()},i}return Ye()});