purify.es-F_7NWVtX.js 27 KB

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