url-sanitizer 5.3.7 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
- var Pt="http://dummy.local",Ce={allow:Object.freeze([]),deny:Object.freeze([]),only:null,allowRelative:!1,debug:!1,revokeObjectURL:!1,maxBlobSize:16777216,maxLength:65536,schemes:new Set};var ye=o=>Object.prototype.toString.call(o).slice(8,-1),R=o=>typeof o=="string"||o instanceof String,X=(o,t)=>{console.warn(`[URLSanitizer Debug] ${o}`,t)};function ao(o,t){this.v=o,this.k=t}function Un(o,t){(t==null||t>o.length)&&(t=o.length);for(var n=0,s=Array(t);n<t;n++)s[n]=o[n];return s}function co(o){if(Array.isArray(o))return o}function lo(o,t){var n=o==null?null:typeof Symbol<"u"&&o[Symbol.iterator]||o["@@iterator"];if(n!=null){var s,i,u,f,d=[],p=!0,g=!1;try{if(u=(n=n.call(o)).next,t===0){if(Object(n)!==n)return;p=!1}else for(;!(p=(s=u.call(n)).done)&&(d.push(s.value),d.length!==t);p=!0);}catch(E){g=!0,i=E}finally{try{if(!p&&n.return!=null&&(f=n.return(),Object(f)!==f))return}finally{if(g)throw i}}return d}}function uo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fo(o,t){return co(o)||lo(o,t)||po(o,t)||uo()}function po(o,t){if(o){if(typeof o=="string")return Un(o,t);var n={}.toString.call(o).slice(8,-1);return n==="Object"&&o.constructor&&(n=o.constructor.name),n==="Map"||n==="Set"?Array.from(o):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Un(o,t):void 0}}function Ze(o){var t,n;function s(u,f){try{var d=o[u](f),p=d.value,g=p instanceof ao;Promise.resolve(g?p.v:p).then(function(E){if(g){var x=u==="return"&&p.k?u:"next";if(!p.k||E.done)return s(x,E);E=o[x](E).value}i(!!d.done,E)},function(E){s("throw",E)})}catch(E){i(2,E)}}function i(u,f){u===2?t.reject(f):t.resolve({value:f,done:u}),(t=t.next)?s(t.key,t.arg):n=null}this._invoke=function(u,f){return new Promise(function(d,p){var g={key:u,arg:f,resolve:d,reject:p,next:null};n?n=n.next=g:(t=n=g,s(u,f))})},typeof o.return!="function"&&(this.return=void 0)}Ze.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Ze.prototype.next=function(o){return this._invoke("next",o)},Ze.prototype.throw=function(o){return this._invoke("throw",o)},Ze.prototype.return=function(o){return this._invoke("return",o)};var qn=Object.entries,Mn=Object.setPrototypeOf,mo=Object.isFrozen,Kn=Object.getPrototypeOf,Zn=Object.getOwnPropertyDescriptor,N=Object.freeze,v=Object.seal,be=Object.create,Qn=typeof Reflect<"u"&&Reflect,Yt=Qn.apply,Vt=Qn.construct;N||(N=function(t){return t});v||(v=function(t){return t});Yt||(Yt=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),u=2;u<s;u++)i[u-2]=arguments[u];return t.apply(n,i)});Vt||(Vt=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});var K=S(Array.prototype.forEach);Array.prototype.indexOf;var ho=S(Array.prototype.lastIndexOf),Pn=S(Array.prototype.pop),De=S(Array.prototype.push),go=S(Array.prototype.slice),_o=S(Array.prototype.splice),Ae=Array.isArray,kt=Jn(Set),zt=S(Set.prototype.add),Ue=S(Set.prototype.has),ce=S(String.prototype.toLowerCase),Ft=S(String.prototype.toString),kn=S(String.prototype.match),Me=S(String.prototype.replace),zn=S(String.prototype.indexOf),Eo=S(String.prototype.trim),To=S(Number.prototype.toString),yo=S(Boolean.prototype.toString),Fn=typeof BigInt>"u"?null:S(BigInt.prototype.toString),Gn=typeof Symbol>"u"?null:S(Symbol.prototype.toString),k=S(Object.prototype.hasOwnProperty),Pe=S(Object.prototype.toString),I=S(RegExp.prototype.test),Z=Jn(TypeError);function S(o){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return Yt(o,t,s)}}function Jn(o){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return Vt(o,n)}}function T(o,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ce;if(Mn&&Mn(o,null),!Ae(t))return o;let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){let u=n(i);u!==i&&(mo(t)||(t[s]=u),i=u)}o[i]=!0}return o}function bo(o){for(let t=0;t<o.length;t++)k(o,t)||(o[t]=null);return o}function z(o){let t=be(null);for(let s of qn(o)){var n=fo(s,2);let i=n[0],u=n[1];k(o,i)&&(Ae(u)?t[i]=bo(u):u&&typeof u=="object"&&u.constructor===Object?t[i]=z(u):t[i]=u)}return t}function Ao(o){switch(typeof o){case"string":return o;case"number":return To(o);case"boolean":return yo(o);case"bigint":return Fn?Fn(o):"0";case"symbol":return Gn?Gn(o):"Symbol()";case"undefined":return Pe(o);case"function":case"object":{if(o===null)return Pe(o);let t=o,n=G(t,"toString");if(typeof n=="function"){let s=n(t);return typeof s=="string"?s:Pe(s)}return Pe(o)}default:return Pe(o)}}function G(o,t){for(;o!==null;){let s=Zn(o,t);if(s){if(s.get)return S(s.get);if(typeof s.value=="function")return S(s.value)}o=Kn(o)}function n(){return null}return n}function Ro(o,t){for(;o!==null;){let n=Zn(o,t);if(n)return n.get?S(n.get):null;o=Kn(o)}return null}function So(o){try{return I(o,""),!0}catch{return!1}}var Bn=N(["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"]),Gt=N(["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"]),Bt=N(["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"]),wo=N(["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"]),Ht=N(["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"]),xo=N(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Hn=N(["#text"]),$n=N(["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"]),$t=N(["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"]),jn=N(["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"]),Qe=N(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Lo=v(/{{[\w\W]*|^[\w\W]*}}/g),Oo=v(/<%[\w\W]*|^[\w\W]*%>/g),No=v(/\${[\w\W]*/g),Io=v(/^data-[\-\w.\u00B7-\uFFFF]+$/),vo=v(/^aria-[\-\w]+$/),Wn=v(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Co=v(/^(?:\w+script|data):/i),Do=v(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Uo=v(/^html$/i),Mo=v(/^[a-z][.\w]*(-[.\w]+)+$/i),jt=v(/<[/\w!]/g),Yn=v(/<[/\w]/g),Po=v(/<\/no(script|embed|frames)/i),Vn=v(/\/>/i),L={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},ko=N(T({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),zo=function(){return typeof window>"u"?null:window},Fo=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null,i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.getAttribute(i));let u="dompurify"+(s?"#"+s:"");try{return t.createPolicy(u,{createHTML(f){return f},createScriptURL(f){return f}})}catch{return console.warn("TrustedTypes policy "+u+" could not be created."),null}},Xn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},te=function(t,n,s,i){return k(t,n)&&Ae(t[n])?T(i.base?z(i.base):{},t[n],i.transform):s},Wt=function(t,n,s){let i=k(t,n)?t[n]:void 0;return i&&typeof i=="object"?z(i):s()};function er(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:zo(),t=l=>er(l);if(t.version="3.4.17",t.removed=[],!o||!o.document||o.document.nodeType!==L.document||!o.Element)return t.isSupported=!1,t;let n=o.document,s=n,i=s.currentScript;o.DocumentFragment;let u=o.HTMLTemplateElement,f=o.Node,d=o.Element,p=o.NodeFilter;o.NamedNodeMap===void 0&&(o.NamedNodeMap||o.MozNamedAttrMap),o.HTMLFormElement;let g=o.DOMParser,E=o.trustedTypes,x=d.prototype,j=G(x,"cloneNode"),ct=G(x,"remove"),Jt=G(x,"removeAttributeNode"),xr=G(x,"nextSibling"),we=G(x,"childNodes"),ue=G(x,"parentNode"),lt=G(x,"shadowRoot"),ut=G(x,"attributes"),ne=f&&f.prototype?G(f.prototype,"nodeType"):null,fe=f&&f.prototype?G(f.prototype,"nodeName"):null,Ge=f&&f.prototype?G(f.prototype,"ownerDocument"):null,F=function(e){return ne?ne(e):e.nodeType},xe=function(e){return fe?fe(e):e.nodeName},en=Ro(x,"namespaceURI"),ft=function(e){return en?en(e):e.namespaceURI};if(typeof u=="function"){let l=n.createElement("template");l.content&&l.content.ownerDocument&&(n=l.content.ownerDocument)}let U,re="",pt,tn=!1,Le=0,nn=function(){if(Le>0)throw Z('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.')},pe=function(e){nn(),Le++;try{return U.createHTML(e)}finally{Le--}},Lr=function(e){nn(),Le++;try{return U.createScriptURL(e)}finally{Le--}},Or=function(){return tn||(pt=Fo(E,i),tn=!0),pt},Be=n,mt=Be.implementation,rn=Be.createNodeIterator,Nr=Be.createDocumentFragment,Ir=Be.getElementsByTagName,vr=s.importNode,y=Xn();t.isSupported=typeof qn=="function"&&typeof ue=="function"&&mt&&mt.createHTMLDocument!==void 0;let Cr=Lo,Dr=Oo,Ur=No,Mr=Io,Pr=vo,kr=Co,on=Do,zr=Mo,sn=Wn,b=null,dt=T({},[...Bn,...Gt,...Bt,...Ht,...Hn]),A=null,ht=T({},[...$n,...$t,...jn,...Qe]),W=Object.seal(be(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}})),Oe=null,an=null,Q=Object.seal(be(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),cn=!0,gt=!0,ln=!1,_t=!0,q=!1,oe=!0,se=!1,Et=!1,He=null,$e=null,Tt=!1,me=!1,je=!1,We=!1,un=!0,fn=!1,pn="user-content-",yt=!0,bt=!1,ie=null,de={},ae=null,mn=T({},["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"]),dn=null,hn=T({},["audio","video","img","source","image","track"]),gn=null,_n=T({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ye="http://www.w3.org/1998/Math/MathML",Ve="http://www.w3.org/2000/svg",Y="http://www.w3.org/1999/xhtml",he=Y,At=!1,Rt=null,Fr=T({},[Ye,Ve,Y],Ft),En=N(["mi","mo","mn","ms","mtext"]),St=T({},En),Tn=N(["annotation-xml"]),wt=T({},Tn),Gr=T({},["title","style","font","a","script"]),Ne=null,Br=["application/xhtml+xml","text/html"],Hr="text/html",w=null,ge=null,$r=n.createElement("form"),yn=function(e){return e instanceof RegExp||e instanceof Function},xt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ge&&ge===e)return;(!e||typeof e!="object")&&(e={}),e=z(e),Ne=Br.indexOf(e.PARSER_MEDIA_TYPE)===-1?Hr:e.PARSER_MEDIA_TYPE,w=Ne==="application/xhtml+xml"?Ft:ce,b=te(e,"ALLOWED_TAGS",dt,{transform:w}),A=te(e,"ALLOWED_ATTR",ht,{transform:w}),Rt=te(e,"ALLOWED_NAMESPACES",Fr,{transform:Ft}),gn=te(e,"ADD_URI_SAFE_ATTR",_n,{transform:w,base:_n}),dn=te(e,"ADD_DATA_URI_TAGS",hn,{transform:w,base:hn}),ae=te(e,"FORBID_CONTENTS",mn,{transform:w}),Oe=te(e,"FORBID_TAGS",z({}),{transform:w}),an=te(e,"FORBID_ATTR",z({}),{transform:w}),de=k(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?z(e.USE_PROFILES):e.USE_PROFILES:!1,cn=e.ALLOW_ARIA_ATTR!==!1,gt=e.ALLOW_DATA_ATTR!==!1,ln=e.ALLOW_UNKNOWN_PROTOCOLS||!1,_t=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,q=e.SAFE_FOR_TEMPLATES||!1,oe=e.SAFE_FOR_XML!==!1,se=e.WHOLE_DOCUMENT||!1,me=e.RETURN_DOM||!1,je=e.RETURN_DOM_FRAGMENT||!1,We=e.RETURN_TRUSTED_TYPE||!1,Tt=e.FORCE_BODY||!1,un=e.SANITIZE_DOM!==!1,fn=e.SANITIZE_NAMED_PROPS||!1,yt=e.KEEP_CONTENT!==!1,bt=e.IN_PLACE||!1,sn=So(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Wn,he=typeof e.NAMESPACE=="string"?e.NAMESPACE:Y,St=Wt(e,"MATHML_TEXT_INTEGRATION_POINTS",()=>T({},En)),wt=Wt(e,"HTML_INTEGRATION_POINTS",()=>T({},Tn));let r=Wt(e,"CUSTOM_ELEMENT_HANDLING",()=>be(null));if(W=be(null),k(r,"tagNameCheck")&&yn(r.tagNameCheck)&&(W.tagNameCheck=r.tagNameCheck),k(r,"attributeNameCheck")&&yn(r.attributeNameCheck)&&(W.attributeNameCheck=r.attributeNameCheck),k(r,"allowCustomizedBuiltInElements")&&typeof r.allowCustomizedBuiltInElements=="boolean"&&(W.allowCustomizedBuiltInElements=r.allowCustomizedBuiltInElements),v(W),q&&(gt=!1),je&&(me=!0),de&&(b=T({},Hn),A=be(null),de.html===!0&&(T(b,Bn),T(A,$n)),de.svg===!0&&(T(b,Gt),T(A,$t),T(A,Qe)),de.svgFilters===!0&&(T(b,Bt),T(A,$t),T(A,Qe)),de.mathMl===!0&&(T(b,Ht),T(A,jn),T(A,Qe))),Q.tagCheck=null,Q.attributeCheck=null,k(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?Q.tagCheck=e.ADD_TAGS:Ae(e.ADD_TAGS)&&(b===dt&&(b=z(b)),T(b,e.ADD_TAGS,w))),k(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?Q.attributeCheck=e.ADD_ATTR:Ae(e.ADD_ATTR)&&(A===ht&&(A=z(A)),T(A,e.ADD_ATTR,w))),k(e,"ADD_FORBID_CONTENTS")&&Ae(e.ADD_FORBID_CONTENTS)&&(ae===mn&&(ae=z(ae)),T(ae,e.ADD_FORBID_CONTENTS,w)),yt&&(b["#text"]=!0),se&&T(b,["html","head","body"]),b.table&&(T(b,["tbody"]),delete Oe.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw Z('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Z('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let a=U;U=e.TRUSTED_TYPES_POLICY;try{re=pe("")}catch(c){throw U=a,c}}else e.TRUSTED_TYPES_POLICY===null?(U=void 0,re=""):(U===void 0&&(U=Or()),U&&typeof re=="string"&&(re=pe("")));N&&N(e),ge=e},bn=T({},[...Gt,...Bt,...wo]),An=T({},[...Ht,...xo]),jr=function(e,r,a){return r.namespaceURI===Y?e==="svg":r.namespaceURI===Ye?e==="svg"&&(a==="annotation-xml"||St[a]):!!bn[e]},Wr=function(e,r,a){return r.namespaceURI===Y?e==="math":r.namespaceURI===Ve?e==="math"&&wt[a]:!!An[e]},Yr=function(e,r,a){return r.namespaceURI===Ve&&!wt[a]||r.namespaceURI===Ye&&!St[a]?!1:!An[e]&&(Gr[e]||!bn[e])},Vr=function(e){let r=ft(e),a=ce(xe(e)),c=ue(e),m,h;return c&&F(c)===L.element?(m={namespaceURI:ft(c)},h=ce(xe(c))):(m={namespaceURI:he},h="template"),Rt[r]?r===Ve?jr(a,m,h):r===Ye?Wr(a,m,h):r===Y?Yr(a,m,h):!!(Ne==="application/xhtml+xml"&&Rt[r]):!1},J=function(e){De(t.removed,{element:e});try{ue(e).removeChild(e)}catch{if(ct(e),!ue(e))throw Z("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Rn=function(e,r,a){try{Jt(e,r)}catch{try{e.removeAttribute(a)}catch{}}},Lt=function(e){Nt(e);let r=we(e);r&&K(go(r),c=>{try{ct(c)}catch{}});let a=F(e)===L.element?ut(e):null;if(a)for(let c=a.length-1;c>=0;--c){let m=a[c],h=m&&m.name;typeof h=="string"&&Rn(e,m,h)}},_e=function(e,r,a){if(!a)try{a=r.getAttributeNode(e)}catch{a=null}De(t.removed,{attribute:a||null,from:r});try{a?Jt(r,a):r.removeAttribute(e)}catch{try{r.removeAttribute(e)}catch{}}if(e==="is")if(me||je)try{J(r)}catch{}else try{r.setAttribute(e,"")}catch{}},Sn=function(e){let r=ut(e);if(r)for(let a=r.length-1;a>=0;--a){let c=r[a],m=c&&c.name;typeof m!="string"||A[w(m)]||Rn(e,c,m)}},Ot=function(e,r){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,c=[e];for(;c.length>0;){let m=c.pop();if(r(m)===!1)continue;if(a&&F(m)===L.element){let _=lt(m);ee(_)&&c.push(_)}let h=we(m);if(h)for(let _=h.length-1;_>=0;--_)c.push(h[_])}},Nt=function(e){Ot(e,r=>{F(r)===L.element&&Sn(r)})},It=function(e){let r=[];return Ot(e,a=>{r.push(a)},!0),r},Xr=function(e,r){let a=kt();K(It(e),c=>{F(c)===L.element&&zt(a,c)}),K(r,c=>{F(c)===L.element&&!Ue(a,c)&&Sn(c)})},wn=function(e,r){let a=!1;return K(t.removed,c=>{c.element&&(a=a||c.element===e,Nt(c.element))}),Xr(e,r),a},qr=8,Kr=function(e,r){let a=ie,c=null,m=()=>(c||(c=kt(),K(r,h=>{zt(c,h)})),c);for(let h=0;;h++){let _=It(e),O=[e],V=!1;if(K(_,C=>{F(C)===L.documentFragment?De(O,C):!V&&!Ue(a,C)&&(V=Ue(m(),C))}),!V)return;if(h>=qr)throw Z("the tree kept changing during in-place sanitization; refusing to return it");K(O,(C,M)=>{Zr(C,M>0,e,m())})}},Zr=function(e,r,a,c){let m=vt(e),h;for(;h=m.nextNode();)!Ue(c,h)||Ue(ie,h)||(r&&H(y.uponSanitizeShadowNode,h,null),Dt(h,a),Ut(h,a),ee(h.content)&&ve(h.content))},Qr=function(e){ie&&zt(ie,e)},xn=function(e,r){return oe?e==="patchsrc"?!0:e==="for"&&r!=="label"&&r!=="output":!1},Jr=function(e){oe&&Ot(e,r=>{let a=F(r);if(a===L.processingInstruction||a===L.comment&&I(Yn,r.data)){try{ct(r)}catch{}return!1}if(a===L.element){let c=r,m=w(xe(r));try{c.hasAttribute&&c.hasAttribute("patchsrc")&&c.removeAttribute("patchsrc"),c.hasAttribute&&c.hasAttribute("for")&&xn("for",m)&&c.removeAttribute("for")}catch{}}return!0})},Ln=function(e){let r=null,a=null;if(Tt)e="<remove></remove>"+e;else{let h=kn(e,/^[\r\n\t ]+/);a=h&&h[0]}Ne==="application/xhtml+xml"&&he===Y&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let c=U?pe(e):e;if(he===Y)try{r=new g().parseFromString(c,Ne)}catch{}if(!r||!r.documentElement){r=mt.createDocument(he,"template",null);try{r.documentElement.innerHTML=At?re:c}catch{}}let m=r.body||r.documentElement;return e&&a&&m.insertBefore(n.createTextNode(a),m.childNodes[0]||null),he===Y?Ir.call(r,se?"html":"body")[0]:se?r.documentElement:m},vt=function(e){let r=Ge?Ge(e):e.ownerDocument;return rn.call(r||e,e,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Xe=function(e){return e=Me(e,Cr," "),e=Me(e,Dr," "),e=Me(e,Ur," "),e},Ct=function(e){var r;On(e);let a=(r=e.querySelectorAll)===null||r===void 0?void 0:r.call(e,"template");a&&K(a,c=>{ee(c.content)&&Ct(c.content)})},On=function(e){e.normalize();let r=Ge?Ge(e):e.ownerDocument,a=rn.call(r||e,e,p.SHOW_TEXT|p.SHOW_COMMENT|p.SHOW_CDATA_SECTION|p.SHOW_PROCESSING_INSTRUCTION,null),c=a.nextNode();for(;c;)c.data=Xe(c.data),c=a.nextNode()},qe=function(e){let r=fe?fe(e):null;return typeof r!="string"||w(r)!=="form"?!1:typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||e.attributes!==ut(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!==ne(e)||e.childNodes!==we(e)},ee=function(e){if(!ne||typeof e!="object"||e===null)return!1;try{return ne(e)===L.documentFragment}catch{return!1}},Ie=function(e){if(!ne||typeof e!="object"||e===null)return!1;try{return typeof ne(e)=="number"}catch{return!1}};function H(l,e,r){l.length!==0&&K(l,a=>{a.call(t,e,r,ge)})}let eo=function(e,r){return!!(oe&&e.hasChildNodes()&&!Ie(e.firstElementChild)&&I(jt,e.textContent)&&I(jt,e.innerHTML)||oe&&ko[r]&&F(e)===L.element&&ft(e)===Y&&(Ie(e.firstElementChild)||typeof e.textContent=="string"&&I(jt,e.textContent))||e.nodeType===L.processingInstruction||oe&&e.nodeType===L.comment&&I(Yn,e.data))},Ke=function(e,r){if(e instanceof RegExp)return I(e,r);if(e instanceof Function){for(var a=arguments.length,c=new Array(a>2?a-2:0),m=2;m<a;m++)c[m-2]=arguments[m];return!!e(r,...c)}return!1},to=function(e,r,a){if(!Oe[r]&&vn(r)&&Ke(W.tagNameCheck,r))return!1;if(yt&&!ae[r]&&!ae[ce(r)]){let c=ue(e),m=we(e);if(m&&c){let h=m.length;for(let _=h-1;_>=0;--_){let O=e===a?j(m[_],!0):m[_];c.insertBefore(O,xr(e))}}}return J(e),!0},Nn=function(e,r,a,c){return e.length===0?r:r===a||r===c?z(r):r},Ee=function(e,r){return e===r||ue(e)!==null?!1:(bt&&Nt(e),!0)},Dt=function(e,r){if(Qr(e),H(y.beforeSanitizeElements,e,null),Ee(e,r))return!0;if(qe(e))return J(e),!0;let a=w(xe(e));if(b=Nn(y.uponSanitizeElement,b,dt,He),H(y.uponSanitizeElement,e,{tagName:a,allowedTags:b}),Ee(e,r))return!0;if(eo(e,a))return J(e),!0;if(Oe[a]||!(Q.tagCheck instanceof Function&&Q.tagCheck(a))&&!b[a]){let c=to(e,a,r);return c===!1&&(H(y.afterSanitizeElements,e,null),Ee(e,r))?!0:c}if(F(e)===L.element&&!Vr(e)||(a==="noscript"||a==="noembed"||a==="noframes")&&I(Po,e.innerHTML))return J(e),!0;if(q&&e.nodeType===L.text){let c=Xe(e.textContent);e.textContent!==c&&(De(t.removed,{element:e.cloneNode()}),e.textContent=c)}return H(y.afterSanitizeElements,e,null),Ee(e,r)},In=function(e,r,a){if(an[r]||xn(r,e)||un&&(r==="id"||r==="name")&&(a in n||a in $r))return!1;let c=A[r]||Q.attributeCheck instanceof Function&&Q.attributeCheck(r,e);return gt&&I(Mr,r)||cn&&I(Pr,r)?!0:c?gn[r]||I(sn,Me(a,on,""))||(r==="src"||r==="xlink:href"||r==="href")&&e!=="script"&&zn(a,"data:")===0&&dn[e]||ln&&!I(kr,Me(a,on,""))?!0:!a:vn(e)&&Ke(W.tagNameCheck,e)&&Ke(W.attributeNameCheck,r,e)||r==="is"&&W.allowCustomizedBuiltInElements&&Ke(W.tagNameCheck,a)},no=T({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),vn=function(e){return!no[ce(e)]&&I(zr,e)},ro=function(e,r,a,c){if(U&&typeof E=="object"&&typeof E.getAttributeType=="function"&&!a)switch(E.getAttributeType(e,r)){case"TrustedHTML":return pe(c);case"TrustedScriptURL":return Lr(c)}return c},oo=function(e,r,a,c){try{return a?e.setAttributeNS(a,r,c):e.setAttribute(r,c),qe(e)?(J(e),!1):!0}catch{return _e(r,e),!1}},Cn=function(e,r){return oe&&I(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,r)?!0:ce(e)==="attributename"&&kn(r,"href")!==null},Ut=function(e,r){if(H(y.beforeSanitizeAttributes,e,null),Ee(e,r))return;let a=e.attributes;if(!a||qe(e))return;A=Nn(y.uponSanitizeAttribute,A,ht,$e);let c={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:A,forceKeepAttr:void 0},m=a.length,h=w(e.nodeName);for(;m--;){let _=a[m],O=_.name,V=_.namespaceURI,C=_.value,M=w(O),Te=C,P=O==="value"?Te:Eo(Te),Dn=!1;if(c.attrName=M,c.attrValue=P,c.keepAttr=!0,c.forceKeepAttr=void 0,H(y.uponSanitizeAttribute,e,c),P=c.attrValue,fn&&(M==="id"||M==="name")&&zn(P,pn)!==0&&(_e(O,e,_),P=pn+P,Dn=!0),Cn(O,P)){_e(O,e,_);continue}if(!c.forceKeepAttr){if(!c.keepAttr){_e(O,e,_);continue}if(!_t&&I(Vn,P)){_e(O,e,_);continue}if(q&&(P=Xe(P)),!In(h,M,P)){_e(O,e,_);continue}P=ro(h,M,V,P),P!==Te&&oo(e,O,V,P)&&Dn&&Pn(t.removed)}}H(y.afterSanitizeAttributes,e,null),Ee(e,r)},ve=function(e){let r=null,a=vt(e);for(H(y.beforeSanitizeShadowDOM,e,null);r=a.nextNode();)if(H(y.uponSanitizeShadowNode,r,null),Dt(r,e),Ut(r,e),ee(r.content)&&ve(r.content),F(r)===L.element){let c=lt(r);ee(c)&&(Mt(c),ve(c))}q&&On(e),H(y.afterSanitizeShadowDOM,e,null)},Mt=function(e){let r=[{node:e,shadow:null}];for(;r.length>0;){let a=r.pop();if(a.shadow){ve(a.shadow);continue}let c=a.node,m=F(c)===L.element,h=we(c);if(h)for(let _=h.length-1;_>=0;--_)r.push({node:h[_],shadow:null});if(m){let _=fe?fe(c):null;if(typeof _=="string"&&w(_)==="template"){let O=c.content;ee(O)&&r.push({node:O,shadow:null})}}if(m){let _=lt(c);ee(_)&&r.push({node:null,shadow:_},{node:_,shadow:null})}}};return t.sanitize=function(l){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=null,a=null,c=null,m=null;if(At=!l,At&&(l="<!-->"),typeof l!="string"&&!Ie(l)&&(l=Ao(l),typeof l!="string"))throw Z("dirty is not a string, aborting");if(!t.isSupported)return l;Et?(b=He,A=$e):xt(e),(y.uponSanitizeElement.length>0||y.uponSanitizeAttribute.length>0)&&(b=z(b)),y.uponSanitizeAttribute.length>0&&(A=z(A)),t.removed=[];let h=bt&&typeof l!="string"&&Ie(l),_=[],O=ie;if(h){Jr(l);let M=xe(l);if(typeof M=="string"){let Te=w(M);if(!b[Te]||Oe[Te])throw Lt(l),Z("root node is forbidden and cannot be sanitized in-place")}if(qe(l))throw Lt(l),Z("root node is clobbered and cannot be sanitized in-place");_=It(l),ie=kt()}else if(Ie(l))r=Ln("<!---->"),a=r.ownerDocument.importNode(l,!0),a.nodeType===L.element&&a.nodeName==="BODY"||a.nodeName==="HTML"?r=a:r.appendChild(a),Mt(r);else{if(!me&&!q&&!se&&l.indexOf("<")===-1)return U&&We?pe(l):l;if(r=Ln(l),!r)return me?null:We?re:""}r&&Tt&&J(r.firstChild);let V=h?l:r;try{h&&Mt(l);let M=vt(V);for(;c=M.nextNode();)Dt(c,V),Ut(c,V),ee(c.content)&&ve(c.content);h&&Kr(l,_)}catch(M){throw h&&(Lt(l),wn(l,_)),M}finally{ie=O}if(h){if(wn(l,_))throw Z("a node selected for removal could not be safely returned; refusing to sanitize in place");return q&&Ct(l),l}if(me){if(q&&Ct(r),je)for(m=Nr.call(r.ownerDocument);r.firstChild;)m.appendChild(r.firstChild);else m=r;return(A.shadowroot||A.shadowrootmode)&&(m=vr.call(s,m,!0)),m}let C=se?r.outerHTML:r.innerHTML;return se&&b["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&I(Uo,r.ownerDocument.doctype.name)&&(C="<!DOCTYPE "+r.ownerDocument.doctype.name+`>
3
- `+C),q&&(C=Xe(C)),U&&We?pe(C):C},t.setConfig=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};xt(l),Et=!0,He=b,$e=A},t.clearConfig=function(){ge=null,Et=!1,He=null,$e=null,U=pt,re=""},t.isValidAttribute=function(l,e,r){ge||xt({});let a=w(l),c=w(e);return typeof r=="string"&&(Cn(e,r)||!_t&&I(Vn,r))?!1:In(a,c,r)},t.addHook=function(l,e){typeof e=="function"&&k(y,l)&&De(y[l],e)},t.removeHook=function(l,e){if(k(y,l)){if(e!==void 0){let r=ho(y[l],e);return r===-1?void 0:_o(y[l],r,1)[0]}return Pn(y[l])}},t.removeHooks=function(l){k(y,l)&&(y[l]=[])},t.removeAllHooks=function(){y=Xn()},t}var tr=er();var Je=tr(globalThis.window);var nr=/&amp;/gi,rr=/&(?=[#a-z0-9])(?![a-z0-9]+=)/i;var or=/#$/,sr=/^(?:application\/(?:[\w.-]+\+)?xml|image\/svg\+xml|text\/(?:html|xml))(?:\s*;\s*|$)/i;var ir=/\P{ASCII}/u,ar=/&#(x0*[\dA-F]{1,2}|0*\d{1,3});?/gi,cr=/(?:%[\dA-F]{2})+/gi,lr=/^((?:[^#%]|%(?!23))*)\?$/,et=/^[a-z][\da-z+.-]*$/,ur=/^(?:web\+[a-z]+|ext\+[a-z][\da-z.-]*)$/,le=/^(?:java|vb)script$/i,ke=/^(?:(?:java|vb)script|blob)$/i,Xt=/["'<>]|%(?:22|27|3C|3E)|&(?:apos|lt|gt|quot|#0*(?:34|39|60|62)|#x0*(?:22|27|3C|3E));/i,fr=/^%[\dA-F]{2}$/i,pr=/^(?:\/{2,}|\\|[a-z][a-z\d+\-.]*:[^/])/i;var mr=[9,10,13,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255];var qt=new Set(mr),Kt=new Map([[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),Bo=()=>{let o=new Map;for(let t=0;t<256;t++)!qt.has(t)&&!Kt.has(t)&&o.set(t,`\\x${t.toString(16).padStart(2,"0").toUpperCase()}`);return o},Zt=Bo();var[Re,$o,jo,Wo,Yo,Vo]=["&","#","<",">",'"',"'"].map(o=>`%${o.charCodeAt(0).toString(16).toUpperCase()}`),Xo={[Re]:`${Re}amp;`,[jo]:`${Re}lt;`,[Wo]:`${Re}gt;`,[Yo]:`${Re}quot;`,[Vo]:`${Re}${$o}39;`},Es=Array.from({length:256},(o,t)=>`%${t.toString(16).padStart(2,"0").toUpperCase()}`),Er=globalThis.process?.versions?.node!==void 0,Tr=`[${[...Zt.values()].join("")}]`,qo=new RegExp(Tr),Ko=new RegExp(Tr,"g"),Zo=new Uint8Array(65536),Ts=new TextEncoder,Qo=new TextDecoder("utf-8",{fatal:!0}),D=(o,t=!1)=>{if(!R(o))return null;let n=ir.test(o)?o.normalize("NFKC"):o;return t?n.trim().toLowerCase().replace(/:$/,""):n},B=(o,t,n=!1)=>{if(!R(o)||o==="")return null;let s=o,i=t&&R(t)?t:"";if(n&&(s=D(s),i&&(i=D(i))),typeof URL.parse=="function")return i?URL.parse(s,i):URL.parse(s);try{return i?new URL(s,i):new URL(s)}catch{return null}},yr=o=>R(o)?o.replace(/:$/,"").split("+"):[];var br=o=>{if(!R(o))return o;let t=fr.test(o)?o.toUpperCase():o;return Xo[t]??o},$=o=>{let t=R(o)?o:String(o);return t.length>64?`${t.slice(0,64)}...`:t},Ar=o=>R(o)?o.replace(or,"").replace(lr,"$1"):o,Jo=(o,t)=>{let n=/^x/i.test(t)?Number.parseInt(t.slice(1),16):Number.parseInt(t,10);if(!Number.isInteger(n)||n<0||n>=256)return o;if(Zt.has(n))return"";if(qt.has(n))return String.fromCharCode(n);let s=Kt.get(n);return String.fromCodePoint(s)},Rr=(o,t=0)=>{if(!R(o))throw new TypeError(`Expected String but got ${ye(o)}.`);if(!Number.isInteger(t))throw new TypeError(`Expected Number but got ${ye(t)}.`);let n;try{n=decodeURIComponent(o)}catch{n=o.replace(cr,i=>{try{return decodeURIComponent(i)}catch{return i}})}n=n.replace(Ko,"");let s=0;for(;s+t<16;s++){let i=n;if(n=n.replace(nr,"&").replace(ar,Jo),n===i)break}if(s+t>=16&&/&#/.test(n))throw new Error("Character references nested too deeply.");return n},rt=(o,t="",n="")=>{if(!R(o))return{mediaType:"",mediaTypes:[],data:"",isBase64:!1};let s=o.indexOf(",");if(s===-1)return{mediaType:o,mediaTypes:o.split(";"),data:"",isBase64:!1};let i=o.substring(0,s),u=o.substring(s+1),f=t===""&&n===""?u:u+t+n,d=i.split(";"),p=d.at(-1),g=p!==void 0&&p.length===6&&p.toLowerCase()==="base64";return{mediaType:i,mediaTypes:d,data:f,isBase64:g}},Sr=o=>{if(!R(o))throw new TypeError(`Expected String but got ${ye(o)}.`);let t,n=o;try{t=atob(o)}catch{n=o.replace(/\s/g,"");try{t=atob(n)}catch{throw new Error(`Invalid base64 data: ${$(o)}`)}}let s;if(Er&&globalThis.Buffer)s=globalThis.Buffer.from(t,"latin1");else{let i=t.length;i>65536?s=new Uint8Array(i):s=Zo.subarray(0,i);for(let u=0;u<i;u++)s[u]=t.charCodeAt(u)}try{let i=Qo.decode(s);return qo.test(i)?n:i}catch{return n}},ot=o=>{if(Er&&globalThis.Buffer)return globalThis.Buffer.from(o).toString("base64");let t=new Uint8Array(o);if(typeof t.toBase64=="function")return t.toBase64();let n=[];for(let s=0;s<t.length;s+=8192)n.push(String.fromCharCode(...t.subarray(s,s+8192)));return btoa(n.join(""))},es=async(o,t,n)=>{let s=o.body.getReader(),i=[],u="Operation aborted";if(n?.aborted)throw await s.cancel(u),s.releaseLock(),n.reason;let f=()=>{s.cancel(u).catch(()=>{})};n?.addEventListener("abort",f,{once:!0});try{let d=0;for(;d<=t;){if(n?.aborted)throw await s.cancel(u),n.reason;let{done:E,value:x}=await s.read();if(n?.aborted)throw n.reason;if(E)break;if(d+=x.byteLength,d>t)throw await s.cancel("Size limit exceeded"),new DOMException(`Payload (${d} bytes) exceeds max (${t} bytes).`,"NotReadableError");i.push(x)}let p=new Uint8Array(d),g=0;for(let E of i)p.set(E,g),g+=E.byteLength;return p.buffer}finally{n?.removeEventListener("abort",f),s.releaseLock()}},Qt=async(o,t,n)=>{let s=16777216;Number.isInteger(t)&&t>0&&(s=t);let i=await fetch(o,{signal:n});if(!i.ok){let g=`Failed to fetch ${$(o)}`;throw Number.isInteger(i.status)&&(i.statusText?g+=`: ${i.status} ${i.statusText}`:g+=`: ${i.status}`),new Error(g)}let u=i.headers.get("content-length");if(u){let p=Number.parseInt(u,10);if(Number.isInteger(p)&&p>s)throw new DOMException(`Payload (${p} bytes) exceeds max (${s} bytes).`,"NotReadableError")}let f=i.headers.get("content-type")||"",d;if(i.body)d=await es(i,s,n);else{let p=await i.blob();if(p.size>s)throw new DOMException(`Payload (${p.size} bytes) exceeds max (${s} bytes).`,"NotReadableError");d=await p.arrayBuffer()}return{buffer:d,mimeType:f}};var Fe=class{constructor(t,n=Ce){this.domPurify=t,this.nest=0,this.recurse=new Set,this.restrictScheme=!1,this.schemeMap=new Map([["blob",!1],["data",!1],["file",!1],["javascript",!1],["vbscript",!1]]),this.#e(n)}#e(t){let{allowRelative:n,debug:s,allow:i,deny:u,only:f,schemes:d}=t;if(this.allowRelative=!!n,this.debug=!!s,this.schemes=d,Array.isArray(f)){this.restrictScheme=!0;for(let p of f)this.#t(p)}else{if(Array.isArray(i)&&i.length)for(let p of i)this.#t(p);if(Array.isArray(u)&&u.length)for(let p of u){let g=D(p,!0);g&&this.schemeMap.set(g,!1)}}}#t(t){let n=D(t,!0);return!n||ke.test(n)||!et.test(n)||n.includes("+")&&n.split("+").some(i=>le.test(i))?!1:(this.schemeMap.set(n,!0),!0)}enter(t){return this.recurse.has(t)?(this.debug&&X(`Circular Data URL detected and skipped: ${$(t)}`),!1):(this.nest++,this.recurse.add(t),!0)}leave(t){this.nest--,this.recurse.delete(t)}},st=class{#e;constructor(t=Ce){this.#e=t}#t(t,n){if(n.nest>16)throw new Error("Data URLs nested too deeply.");let s=B(t,null,!0);if(!s){if(n.allowRelative&&!pr.test(t)){let u=B(t,Pt);if(u){let{protocol:f,hostname:d,pathname:p,search:g,hash:E}=u;if(f==="http:"&&d==="dummy.local")return this.#o(`${p}${g}${E}`)}}return null}let i=D(s.protocol,!0);if(n.restrictScheme&&!n.schemeMap.has(i))return null;if(i.includes("+")){let u=i.split("+");if(n.schemeMap.get(i)===!1||u.some(f=>n.schemeMap.get(f)===!1))return null}else if(n.schemeMap.has(i)){if(n.schemeMap.get(i)===!1)return null}else if(!n.schemes.has(i))return null;return i==="data"?this.#n(s,n):this.#o(s.href)}#n(t,n){let{mediaType:s,mediaTypes:i,data:u,isBase64:f}=rt(t.pathname,t.search,t.hash),d=u;if(f)try{d=Sr(u)}catch(p){return n.debug&&X("Failed to parse base64 data.",p),null}try{let p=Rr(d).trim(),g=B(p,Pt);if(!g||yr(g.protocol).some(x=>ke.test(x)))return null}catch(p){return n.debug&&X("Failed to parse inner data URL protocol.",p),null}return(!s||sr.test(s))&&(d=this.#s(d,n)),d?(f&&d!==u&&i.pop(),`data:${i.join(";")},${d}`):null}#s(t,n){let s="";try{s=decodeURIComponent(t)}catch{s=t}let i=(f,d)=>this.#r(f,d,n),u="";try{n.domPurify.addHook("uponSanitizeAttribute",i),u=n.domPurify.sanitize(s)}finally{n.domPurify.removeHook("uponSanitizeAttribute",i)}if(!u)return null;try{return encodeURI(Ar(u))}catch{return null}}#r(t,n,s){if(!n.attrValue||!/^\s*data:/i.test(n.attrValue))return;let i=B(n.attrValue,null,!0);if(!i||i.protocol!=="data:")return;let u=n.attrValue;if(!s.enter(u)){n.attrValue="";return}try{let f=this.#t(u,s);n.attrValue=f||""}finally{s.leave(u)}}#o(t){let n=t.length,s=n,i=Xt.exec(t);if(i&&(s=i.index),t.indexOf("&")>-1){let f=rr.exec(t);if(f){let d=f.index;d<s&&(s=d)}}if(s===n)return t;let u=t.charCodeAt(s-1);return(u===63||u===38)&&s--,t.substring(0,s)}sanitize(t,n=this.#e){if(!t||!R(t))return null;let{deny:s,maxLength:i,only:u,allowRelative:f}=n;if(Number.isInteger(i)&&t.length>i){let g=`URL length ${t.length} exceeds max length ${i}.`;throw new RangeError(g)}if(!(Array.isArray(s)&&s.length>0||Array.isArray(u)||f)&&/^https?:\/\//.test(t)&&!Xt.test(t)&&!t.includes("data:")){let g=B(t,null,!0);return g&&n.schemes.has(g.protocol.replace(/:$/,""))?g.href.replace(/%26/g,br):null}let p=new Fe(Je,n);return this.#t(t,p)}async sanitizeBuffer(t,n,s=this.#e){if(!(t instanceof ArrayBuffer))return null;let i=ot(t),f=`data:${n?`${n};base64`:"base64"},${i}`;if(Number.isInteger(s.maxLength)&&f.length>s.maxLength)throw new RangeError(`URL length ${f.length} exceeds max length ${s.maxLength}.`);let d=new Fe(Je,s);if(!d.schemeMap.get("data"))return null;let p=B(f);return p?this.#n(p,d):null}async sanitizeDataURL(t,n=this.#e){if(!t||!R(t))return null;let{maxLength:s}=n;if(Number.isInteger(s)&&t.length>s)throw new RangeError(`URL length ${t.length} exceeds max length ${s}.`);let i=B(t);if(!i)return null;let u=D(i.protocol,!0);if(u!=="data")return null;let f=new Fe(Je,n);return f.schemeMap.get(u)?this.#n(i,f):null}};var wr=["aaa","aaas","about","acap","acct","acd","ace","aceap","acedp","aceep","acelp","aceup","acr","adiumxtra","adt","aet","afp","afs","agtp","aim","alter","amss","android","appdata","apt","ar","ari","ark","ars","arv","at","attachment","aw","barion","beshare","bitcoin","bitcoincash","bl","blob","bluetooth","bolo","brid","browserext","cabal","caip","calculator","callto","canactid","cap","cast","casts","chrome","chrome-extension","cid","cm","coap","coaps","com-eventbrite-attendee","content","content-type","crid","cstr","cttps","cvs","dab","dat","data","dav","dhttp","diaspora","dict","did","dilithium3","dis","dlna-playcontainer","dlna-playsingle","dnp","dns","dntp","doi","donau","dpp","drm","dtmi","dtn","dvb","dvx","dweb","ed2k","eid","elsi","embedded","ens","esim","ethereum","example","ez","facetime","feed","feedready","fido","file","finger","first-run-pen-experience","fish","fm","ftp","fuchsia-pkg","gcx","gdsi","geo","gg","git","gitoid","gizmoproject","go","gopher","graph","gsos","gtalk","h323","haie","ham","hcap","hcp","hs20","http","https","hxxp","hxxps","hydrazone","hyper","i0","iax","ibi","ibi-","icap","icon","ilstring","im","imap","info","interaction","iotdisco","ipfs","ipn","ipns","ipp","ipps","iqa","irc","irc6","ircs","iris","iris.beep","iris.lwz","iris.xpc","iris.xpcs","isostore","itms","jabber","jar","jms","keyparc","lastfm","lbry","ldap","ldaps","leaptofrogans","lid","linkid","locus","lorawan","lpa","lvlt","machineProvisioningProgressReporter","magnet","mailto","maps","market","matrix","mdoc","mdoc-openid4vp","message","microsoft.windows.camera","microsoft.windows.camera.multipicker","microsoft.windows.camera.picker","mid","mms","mongodb","moz","moz-extension","mqtt","mqtts","ms-access","ms-appinstaller","ms-browser-extension","ms-calculator","ms-drive-to","ms-enrollment","ms-excel","ms-eyecontrolspeech","ms-gamebarservices","ms-gamingoverlay","ms-getoffice","ms-help","ms-infopath","ms-inputapp","ms-launchremotedesktop","ms-lockscreencomponent-config","ms-media-stream-id","ms-meetnow","ms-mixedrealitycapture","ms-mobileplans","ms-newsandinterests","ms-officeapp","ms-people","ms-personacard","ms-powerpoint","ms-project","ms-publisher","ms-recall","ms-remotedesktop","ms-remotedesktop-launch","ms-restoretabcompanion","ms-screenclip","ms-screensketch","ms-search","ms-search-repair","ms-secondary-screen-controller","ms-secondary-screen-setup","ms-settings","ms-settings-airplanemode","ms-settings-bluetooth","ms-settings-camera","ms-settings-cellular","ms-settings-cloudstorage","ms-settings-connectabledevices","ms-settings-displays-topology","ms-settings-emailandaccounts","ms-settings-language","ms-settings-location","ms-settings-lock","ms-settings-nfctransactions","ms-settings-notifications","ms-settings-power","ms-settings-privacy","ms-settings-proximity","ms-settings-screenrotation","ms-settings-wifi","ms-settings-workplace","ms-spd","ms-stickers","ms-sttoverlay","ms-transit-to","ms-useractivityset","ms-uup","ms-virtualtouchpad","ms-visio","ms-walk-to","ms-whiteboard","ms-whiteboard-cmd","ms-widgetboard","ms-widgets","ms-word","msnim","msrp","msrps","mss","mt","mtqp","mtrust","mumble","mupdate","musik","mvn","mvrp","mvrps","news","nfs","ni","nih","nntp","nostr","notes","npamp","num","ocf","oid","onenote","onenote-cmd","op","opaquelocktoken","openid","openpgp4fpr","opns","ord","ordmail","otpauth","palm","paparazzi","payto","pkcs11","pkg","platform","pop","pres","proxy","psyc","pttp","pwid","qb","query","quic-transport","redis","rediss","reload","res","resource","rmi","rsync","rtmfp","rtmp","rtsp","rtsps","rtspu","rttp","sarif","secondlife","secret-token","seki","service","session","sftp","sgn","shc","shelter","sieve","simpleledger","simplex","sip","sips","skype","smb","smp","sms","smtp","snmp","sns","soap.beep","soap.beeps","soldat","spacify","spiffe","spotify","ssb","ssh","sss","starknet","steam","stun","stuns","submit","svn","swh","swid","swidpath","tag","taler","tcxp","teamspeak","teapot","teapots","tel","teliaeid","telnet","tftp","things","thismessage","tii","tip","tn3270","tool","tttps","turn","turns","tv","udp","unreal","upn","urn","ust","ut2004","uuaid","uuid-in-package","v-event","vemmi","ventrilo","ves","view-source","vnc","vscode","vscode-insiders","vsls","w3","wasm","wasm-js","wcr","web3","webcal","wifi","ws","wss","wtai","wyciwyg","xcompute","xcon","xcon-userid","xfire","xftp","xmlrpc.beep","xmlrpc.beeps","xmpp","xrcp","xri","ymsgr","z39.50r","z39.50s","ztdnaid"];var it=class{#e=new Set(wr);get(){return[...this.#e]}getScheme(t){if(!R(t))return null;let n=this.parse(t);return n?this.normalize(n.protocol,!0):null}has(t){let n=this.normalize(t,!0);return n?this.#e.has(n):!1}normalize(t,n=!1){return D(t,n)}normalizeSchemes(t){if(Array.isArray(t)){let n=[];for(let s of t){let i=D(s,!0);i&&n.push(i)}return n}return[]}parse(t,n,s=!1){return B(t,n,s)}verifyURI(t,n){if(!R(t))return!1;let s=this.parse(t);return s?this.verifyScheme(s.protocol,n,!0):!1}verifyScheme(t,n,s=!1){let i=this.normalize(t,!0);if(!i)return!1;let u=n||this.#e;if(!i.includes("+"))return le.test(i)?!1:u.has(i);let f=i.split("+");return f.some(p=>le.test(p))?!1:u.has(i)?!0:s&&ur.test(i)||f.every(p=>u.has(p))}};var ns=Object.freeze(["href","origin","protocol","username","password","host","hostname","port","pathname","search","hash"]),at=class extends it{#e;#t;#n;constructor(){super(),this.#e=new Set(super.get()),this.#t={...Ce,schemes:this.#e},this.#n=new st(this.#t)}#s(t){return!R(t)||ke.test(t)||t.includes("+")&&t.split("+").some(s=>le.test(s))?!1:et.test(t)}#r(t,n={}){if(!R(t)||t==="")return{isValid:!1};let s={...this.#t,...n,allow:this.normalizeSchemes(n.allow),deny:this.normalizeSchemes(n.deny),only:Object.hasOwn(n,"only")?this.normalizeSchemes(n.only):this.#t.only,schemes:this.#e},i=this.getScheme(t);return i===null&&!s.allowRelative?{isValid:!1}:{options:s,scheme:i}}#o(t,n){let s={input:t,href:null,valid:!1};if(!R(t))return s.reason=`Invalid URL input: ${$(t)}`,s;if(t==="")return s.reason="Invalid URL input: (empty string)",s;let i,u=null;try{i=this.#n.sanitize(t,n),i||(u="Sanitization failed (blocked by allowed schemes or rules).")}catch(f){u=f.message}if(i){let f=B(i);if(s.valid=!0,f){if(D(f.protocol,!0)==="data"){let{mediaTypes:p,data:g,isBase64:E}=rt(f.pathname,f.search,f.hash);E&&p.pop(),s.data={mime:p.join(";"),base64:E,data:g}}else s.data=null;for(let p of ns){let g=f[p];R(g)&&(s[p]=g)}}else s.valid=!1,s.relative=!0,s.href=i,s.reason="Invalid as an absolute URL, but valid as a relative URL."}else s.reason=u;return s}async#a(t,n){try{let{buffer:s,mimeType:i}=await Qt(t,n.maxBlobSize,n.signal),u=ot(s),f=`data:${i?`${i};base64`:"base64"},${u}`,d=this.#o(f,n);return d.input=t,d}catch(s){if(s.name==="AbortError"||n.signal?.aborted)throw s;return n.debug&&X(`Failed to inspect blob URL: ${$(t)}`,s),{input:t,valid:!1,reason:s.message}}finally{n.revokeObjectURL&&URL.revokeObjectURL(t)}}#i(t,n){if(t instanceof TypeError||t.name==="AbortError"||n.signal?.aborted)throw t}get(){return[...this.#e]}has(t){let n=D(t,!0);return n?this.#e.has(n):!1}add(t){if(!R(t))throw new TypeError(`Expected String but got ${ye(t)}.`);let n=D(t,!0);if(!this.#s(n))throw new Error(`Invalid scheme: ${t}`);return this.#e.add(n),[...this.#e]}remove(t){if(!R(t))return!1;let n=D(t,!0);return this.#e.delete(n)}reset(){this.#e.clear();for(let t of super.get())this.#e.add(t)}async sanitizeURL(t,n){let{isValid:s,options:i,scheme:u}=this.#r(t,n);if(s===!1)return null;if(u==="blob"){let{allow:f,deny:d,only:p}=i,g=null;try{if(f.includes("blob")&&!d.includes("blob")||Array.isArray(p)&&p.includes("blob")){let E=null,x="";try{let j=await Qt(t,i.maxBlobSize,i.signal);E=j.buffer,x=j.mimeType}catch(j){if(j.name==="AbortError"||i.signal?.aborted)throw j;i.debug&&X(`Failed to fetch and convert blob URL: ${$(t)}`,j)}E&&(p?.length?p.includes("data")||(i.only=[...p,"data"]):(f.includes("data")||(i.allow=[...f,"data"]),i.deny=d.filter(j=>j!=="data")),g=await this.#n.sanitizeBuffer(E,x,i))}}catch(E){return this.#i(E,i),i.debug&&X(`Failed to sanitize URL: ${$(t)}`,E),null}finally{i.revokeObjectURL&&URL.revokeObjectURL(t)}return g}try{return u==="data"?this.#n.sanitizeDataURL(t,i):this.#n.sanitize(t,i)}catch(f){return this.#i(f,i),i.debug&&X(`Failed to sanitize URL: ${$(t)}`,f),null}}sanitizeURLSync(t,n){let{isValid:s,options:i,scheme:u}=this.#r(t,n);if(s===!1)return null;if(u==="blob")return i.revokeObjectURL&&URL.revokeObjectURL(t),null;try{return this.#n.sanitize(t,i)}catch(f){return this.#i(f,i),i.debug&&X(`Failed to sanitize URL: ${$(t)}`,f),null}}async inspectURL(t,n={}){let{options:s,scheme:i}=this.#r(t,n);return i==="blob"?this.#a(t,s):this.#o(t,s)}isValidURI(t){return super.verifyURI(t,this.#e)}};var Se=new at,Bs=async(o,t)=>Se.sanitizeURL(o,t),Hs=(o,t)=>Se.sanitizeURLSync(o,t),$s=async(o,t={})=>Se.inspectURL(o,t),js=o=>Se.isValidURI(o),Ws=o=>Se.isValidURI(o),Ys=Se;export{at as URLSanitizer,Ys as default,$s as inspectURL,Ws as isURISync,js as isValidURI,Bs as sanitizeURL,Hs as sanitizeURLSync};
1
+ var Ln="http://dummy.local",Ut={allow:Object.freeze([]),deny:Object.freeze([]),only:null,allowRelative:!1,debug:!1,revokeObjectURL:!1,maxBlobSize:16777216,maxLength:65536,schemes:new Set};var At=e=>Object.prototype.toString.call(e).slice(8,-1),G=e=>typeof e=="string"||e instanceof String,Be=(e,t)=>{console.warn(`[URLSanitizer Debug] ${e}`,t)};function Bo(e,t){this.v=e,this.k=t}function za(e,t){(t==null||t>e.length)&&(t=e.length);for(var s=0,a=Array(t);s<t;s++)a[s]=e[s];return a}function Uo(e){if(Array.isArray(e))return e}function ko(e,t){var s=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(s!=null){var a,r,c,h,_=[],m=!0,f=!1;try{if(c=(s=s.call(e)).next,t===0){if(Object(s)!==s)return;m=!1}else for(;!(m=(a=c.call(s)).done)&&(_.push(a.value),_.length!==t);m=!0);}catch(I){f=!0,r=I}finally{try{if(!m&&s.return!=null&&(h=s.return(),Object(h)!==h))return}finally{if(f)throw r}}return _}}function Fo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vo(e,t){return Uo(e)||ko(e,t)||Ho(e,t)||Fo()}function Ho(e,t){if(e){if(typeof e=="string")return za(e,t);var s={}.toString.call(e).slice(8,-1);return s==="Object"&&e.constructor&&(s=e.constructor.name),s==="Map"||s==="Set"?Array.from(e):s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?za(e,t):void 0}}function Rs(e){var t,s;function a(c,h){try{var _=e[c](h),m=_.value,f=m instanceof Bo;Promise.resolve(f?m.v:m).then(function(I){if(f){var w=c==="return"&&m.k?c:"next";if(!m.k||I.done)return a(w,I);I=e[w](I).value}r(!!_.done,I)},function(I){a("throw",I)})}catch(I){r(2,I)}}function r(c,h){c===2?t.reject(h):t.resolve({value:h,done:c}),(t=t.next)?a(t.key,t.arg):s=null}this._invoke=function(c,h){return new Promise(function(_,m){var f={key:c,arg:h,resolve:_,reject:m,next:null};s?s=s.next=f:(t=s=f,a(c,h))})},typeof e.return!="function"&&(this.return=void 0)}Rs.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Rs.prototype.next=function(e){return this._invoke("next",e)},Rs.prototype.throw=function(e){return this._invoke("throw",e)},Rs.prototype.return=function(e){return this._invoke("return",e)};var rr=Object.entries,Xa=Object.setPrototypeOf,Yo=Object.isFrozen,ir=Object.getPrototypeOf,or=Object.getOwnPropertyDescriptor,ee=Object.freeze,ae=Object.seal,Rt=Object.create,cr=typeof Reflect<"u"&&Reflect,Fn=cr.apply,vn=cr.construct;ee||(ee=function(t){return t});ae||(ae=function(t){return t});Fn||(Fn=function(t,s){for(var a=arguments.length,r=new Array(a>2?a-2:0),c=2;c<a;c++)r[c-2]=arguments[c];return t.apply(s,r)});vn||(vn=function(t){for(var s=arguments.length,a=new Array(s>1?s-1:0),r=1;r<s;r++)a[r-1]=arguments[r];return new t(...a)});var Ye=j(Array.prototype.forEach);Array.prototype.indexOf;var Wo=j(Array.prototype.lastIndexOf),ja=j(Array.prototype.pop),kt=j(Array.prototype.push),Go=j(Array.prototype.slice),zo=j(Array.prototype.splice),Nt=Array.isArray,Dn=lr(Set),Pn=j(Set.prototype.add),Ft=j(Set.prototype.has),at=j(String.prototype.toLowerCase),Mn=j(String.prototype.toString),Ka=j(String.prototype.match),vt=j(String.prototype.replace),Ja=j(String.prototype.indexOf),Xo=j(String.prototype.trim),jo=j(Number.prototype.toString),Ko=j(Boolean.prototype.toString),Va=typeof BigInt>"u"?null:j(BigInt.prototype.toString),Qa=typeof Symbol>"u"?null:j(Symbol.prototype.toString),_e=j(Object.prototype.hasOwnProperty),Ht=j(Object.prototype.toString),ne=j(RegExp.prototype.test),We=lr(TypeError);function j(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var s=arguments.length,a=new Array(s>1?s-1:0),r=1;r<s;r++)a[r-1]=arguments[r];return Fn(e,t,a)}}function lr(e){return function(){for(var t=arguments.length,s=new Array(t),a=0;a<t;a++)s[a]=arguments[a];return vn(e,s)}}function k(e,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:at;if(Xa&&Xa(e,null),!Nt(t))return e;let a=t.length;for(;a--;){let r=t[a];if(typeof r=="string"){let c=s(r);c!==r&&(Yo(t)||(t[a]=c),r=c)}e[r]=!0}return e}function Jo(e){for(let t=0;t<e.length;t++)_e(e,t)||(e[t]=null);return e}function Ae(e){let t=Rt(null);for(let a of rr(e)){var s=vo(a,2);let r=s[0],c=s[1];_e(e,r)&&(Nt(c)?t[r]=Jo(c):c&&typeof c=="object"&&c.constructor===Object?t[r]=Ae(c):t[r]=c)}return t}function Vo(e){switch(typeof e){case"string":return e;case"number":return jo(e);case"boolean":return Ko(e);case"bigint":return Va?Va(e):"0";case"symbol":return Qa?Qa(e):"Symbol()";case"undefined":return Ht(e);case"function":case"object":{if(e===null)return Ht(e);let t=e,s=ge(t,"toString");if(typeof s=="function"){let a=s(t);return typeof a=="string"?a:Ht(a)}return Ht(e)}default:return Ht(e)}}function ge(e,t){for(;e!==null;){let a=or(e,t);if(a){if(a.get)return j(a.get);if(typeof a.value=="function")return j(a.value)}e=ir(e)}function s(){return null}return s}function Qo(e,t){for(;e!==null;){let s=or(e,t);if(s)return s.get?j(s.get):null;e=ir(e)}return null}function qo(e){try{return ne(e,""),!0}catch{return!1}}var qa=ee(["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"]),wn=ee(["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"]),yn=ee(["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"]),Zo=ee(["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"]),xn=ee(["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"]),$o=ee(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Za=ee(["#text"]),$a=ee(["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"]),Bn=ee(["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"]),er=ee(["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"]),Ns=ee(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ec=ae(/{{[\w\W]*|^[\w\W]*}}/g),tc=ae(/<%[\w\W]*|^[\w\W]*%>/g),sc=ae(/\${[\w\W]*/g),nc=ae(/^data-[\-\w.\u00B7-\uFFFF]+$/),ac=ae(/^aria-[\-\w]+$/),tr=ae(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),rc=ae(/^(?:\w+script|data):/i),ic=ae(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),oc=ae(/^html$/i),cc=ae(/^[a-z][.\w]*(-[.\w]+)+$/i),Un=ae(/<[/\w!]/g),sr=ae(/<[/\w]/g),lc=ae(/<\/no(script|embed|frames)/i),nr=ae(/\/>/i),Q={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},uc=ee(k({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),hc=function(){return typeof window>"u"?null:window},Ec=function(t,s){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let a=null,r="data-tt-policy-suffix";s&&s.hasAttribute(r)&&(a=s.getAttribute(r));let c="dompurify"+(a?"#"+a:"");try{return t.createPolicy(c,{createHTML(h){return h},createScriptURL(h){return h}})}catch{return console.warn("TrustedTypes policy "+c+" could not be created."),null}},ar=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Je=function(t,s,a,r){return _e(t,s)&&Nt(t[s])?k(r.base?Ae(r.base):{},t[s],r.transform):a},kn=function(t,s,a){let r=_e(t,s)?t[s]:void 0;return r&&typeof r=="object"?Ae(r):a()};function ur(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:hc(),t=N=>ur(N);if(t.version="3.4.17",t.removed=[],!e||!e.document||e.document.nodeType!==Q.document||!e.Element)return t.isSupported=!1,t;let s=e.document,a=s,r=a.currentScript;e.DocumentFragment;let c=e.HTMLTemplateElement,h=e.Node,_=e.Element,m=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let f=e.DOMParser,I=e.trustedTypes,w=_.prototype,v=ge(w,"cloneNode"),C=ge(w,"remove"),O=ge(w,"removeAttributeNode"),S=ge(w,"nextSibling"),P=ge(w,"childNodes"),F=ge(w,"parentNode"),pe=ge(w,"shadowRoot"),re=ge(w,"attributes"),ue=h&&h.prototype?ge(h.prototype,"nodeType"):null,se=h&&h.prototype?ge(h.prototype,"nodeName"):null,ve=h&&h.prototype?ge(h.prototype,"ownerDocument"):null,J=function(i){return ue?ue(i):i.nodeType},Se=function(i){return se?se(i):i.nodeName},M=Qo(w,"namespaceURI"),H=function(i){return M?M(i):i.namespaceURI};if(typeof c=="function"){let N=s.createElement("template");N.content&&N.content.ownerDocument&&(s=N.content.ownerDocument)}let D,U="",q,V=!1,$=0,Ta=function(){if($>0)throw We('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.')},ht=function(i){Ta(),$++;try{return D.createHTML(i)}finally{$--}},eo=function(i){Ta(),$++;try{return D.createScriptURL(i)}finally{$--}},to=function(){return V||(q=Ec(I,r),V=!0),q},us=s,an=us.implementation,da=us.createNodeIterator,so=us.createDocumentFragment,no=us.getElementsByTagName,ao=a.importNode,W=ar();t.isSupported=typeof rr=="function"&&typeof F=="function"&&an&&an.createHTMLDocument!==void 0;let ro=ec,io=tc,oo=sc,co=nc,lo=ac,uo=rc,ma=ic,ho=cc,fa=tr,z=null,rn=k({},[...qa,...wn,...yn,...xn,...Za]),X=null,on=k({},[...$a,...Bn,...er,...Ns]),we=Object.seal(Rt(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}})),wt=null,_a=null,Xe=Object.seal(Rt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),pa=!0,cn=!0,Aa=!1,ln=!0,He=!1,et=!0,tt=!1,un=!1,hs=null,Es=null,hn=!1,Et=!1,Ts=!1,ds=!1,Ra=!0,Na=!1,ga="user-content-",En=!0,Tn=!1,st=null,Tt={},nt=null,Ca=k({},["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"]),Ia=null,Sa=k({},["audio","video","img","source","image","track"]),Oa=null,ba=k({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ms="http://www.w3.org/1998/Math/MathML",fs="http://www.w3.org/2000/svg",ye="http://www.w3.org/1999/xhtml",dt=ye,dn=!1,mn=null,Eo=k({},[ms,fs,ye],Mn),La=ee(["mi","mo","mn","ms","mtext"]),fn=k({},La),Da=ee(["annotation-xml"]),_n=k({},Da),To=k({},["title","style","font","a","script"]),yt=null,mo=["application/xhtml+xml","text/html"],fo="text/html",K=null,mt=null,_o=s.createElement("form"),Pa=function(i){return i instanceof RegExp||i instanceof Function},pn=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(mt&&mt===i)return;(!i||typeof i!="object")&&(i={}),i=Ae(i),yt=mo.indexOf(i.PARSER_MEDIA_TYPE)===-1?fo:i.PARSER_MEDIA_TYPE,K=yt==="application/xhtml+xml"?Mn:at,z=Je(i,"ALLOWED_TAGS",rn,{transform:K}),X=Je(i,"ALLOWED_ATTR",on,{transform:K}),mn=Je(i,"ALLOWED_NAMESPACES",Eo,{transform:Mn}),Oa=Je(i,"ADD_URI_SAFE_ATTR",ba,{transform:K,base:ba}),Ia=Je(i,"ADD_DATA_URI_TAGS",Sa,{transform:K,base:Sa}),nt=Je(i,"FORBID_CONTENTS",Ca,{transform:K}),wt=Je(i,"FORBID_TAGS",Ae({}),{transform:K}),_a=Je(i,"FORBID_ATTR",Ae({}),{transform:K}),Tt=_e(i,"USE_PROFILES")?i.USE_PROFILES&&typeof i.USE_PROFILES=="object"?Ae(i.USE_PROFILES):i.USE_PROFILES:!1,pa=i.ALLOW_ARIA_ATTR!==!1,cn=i.ALLOW_DATA_ATTR!==!1,Aa=i.ALLOW_UNKNOWN_PROTOCOLS||!1,ln=i.ALLOW_SELF_CLOSE_IN_ATTR!==!1,He=i.SAFE_FOR_TEMPLATES||!1,et=i.SAFE_FOR_XML!==!1,tt=i.WHOLE_DOCUMENT||!1,Et=i.RETURN_DOM||!1,Ts=i.RETURN_DOM_FRAGMENT||!1,ds=i.RETURN_TRUSTED_TYPE||!1,hn=i.FORCE_BODY||!1,Ra=i.SANITIZE_DOM!==!1,Na=i.SANITIZE_NAMED_PROPS||!1,En=i.KEEP_CONTENT!==!1,Tn=i.IN_PLACE||!1,fa=qo(i.ALLOWED_URI_REGEXP)?i.ALLOWED_URI_REGEXP:tr,dt=typeof i.NAMESPACE=="string"?i.NAMESPACE:ye,fn=kn(i,"MATHML_TEXT_INTEGRATION_POINTS",()=>k({},La)),_n=kn(i,"HTML_INTEGRATION_POINTS",()=>k({},Da));let E=kn(i,"CUSTOM_ELEMENT_HANDLING",()=>Rt(null));if(we=Rt(null),_e(E,"tagNameCheck")&&Pa(E.tagNameCheck)&&(we.tagNameCheck=E.tagNameCheck),_e(E,"attributeNameCheck")&&Pa(E.attributeNameCheck)&&(we.attributeNameCheck=E.attributeNameCheck),_e(E,"allowCustomizedBuiltInElements")&&typeof E.allowCustomizedBuiltInElements=="boolean"&&(we.allowCustomizedBuiltInElements=E.allowCustomizedBuiltInElements),ae(we),He&&(cn=!1),Ts&&(Et=!0),Tt&&(z=k({},Za),X=Rt(null),Tt.html===!0&&(k(z,qa),k(X,$a)),Tt.svg===!0&&(k(z,wn),k(X,Bn),k(X,Ns)),Tt.svgFilters===!0&&(k(z,yn),k(X,Bn),k(X,Ns)),Tt.mathMl===!0&&(k(z,xn),k(X,er),k(X,Ns))),Xe.tagCheck=null,Xe.attributeCheck=null,_e(i,"ADD_TAGS")&&(typeof i.ADD_TAGS=="function"?Xe.tagCheck=i.ADD_TAGS:Nt(i.ADD_TAGS)&&(z===rn&&(z=Ae(z)),k(z,i.ADD_TAGS,K))),_e(i,"ADD_ATTR")&&(typeof i.ADD_ATTR=="function"?Xe.attributeCheck=i.ADD_ATTR:Nt(i.ADD_ATTR)&&(X===on&&(X=Ae(X)),k(X,i.ADD_ATTR,K))),_e(i,"ADD_FORBID_CONTENTS")&&Nt(i.ADD_FORBID_CONTENTS)&&(nt===Ca&&(nt=Ae(nt)),k(nt,i.ADD_FORBID_CONTENTS,K)),En&&(z["#text"]=!0),tt&&k(z,["html","head","body"]),z.table&&(k(z,["tbody"]),delete wt.tbody),i.TRUSTED_TYPES_POLICY){if(typeof i.TRUSTED_TYPES_POLICY.createHTML!="function")throw We('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof i.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw We('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let p=D;D=i.TRUSTED_TYPES_POLICY;try{U=ht("")}catch(A){throw D=p,A}}else i.TRUSTED_TYPES_POLICY===null?(D=void 0,U=""):(D===void 0&&(D=to()),D&&typeof U=="string"&&(U=ht("")));ee&&ee(i),mt=i},Ma=k({},[...wn,...yn,...Zo]),wa=k({},[...xn,...$o]),po=function(i,E,p){return E.namespaceURI===ye?i==="svg":E.namespaceURI===ms?i==="svg"&&(p==="annotation-xml"||fn[p]):!!Ma[i]},Ao=function(i,E,p){return E.namespaceURI===ye?i==="math":E.namespaceURI===fs?i==="math"&&_n[p]:!!wa[i]},Ro=function(i,E,p){return E.namespaceURI===fs&&!_n[p]||E.namespaceURI===ms&&!fn[p]?!1:!wa[i]&&(To[i]||!Ma[i])},No=function(i){let E=H(i),p=at(Se(i)),A=F(i),b,L;return A&&J(A)===Q.element?(b={namespaceURI:H(A)},L=at(Se(A))):(b={namespaceURI:dt},L="template"),mn[E]?E===fs?po(p,b,L):E===ms?Ao(p,b,L):E===ye?Ro(p,b,L):!!(yt==="application/xhtml+xml"&&mn[E]):!1},je=function(i){kt(t.removed,{element:i});try{F(i).removeChild(i)}catch{if(C(i),!F(i))throw We("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},ya=function(i,E,p){try{O(i,E)}catch{try{i.removeAttribute(p)}catch{}}},An=function(i){Nn(i);let E=P(i);E&&Ye(Go(E),A=>{try{C(A)}catch{}});let p=J(i)===Q.element?re(i):null;if(p)for(let A=p.length-1;A>=0;--A){let b=p[A],L=b&&b.name;typeof L=="string"&&ya(i,b,L)}},ft=function(i,E,p){if(!p)try{p=E.getAttributeNode(i)}catch{p=null}kt(t.removed,{attribute:p||null,from:E});try{p?O(E,p):E.removeAttribute(i)}catch{try{E.removeAttribute(i)}catch{}}if(i==="is")if(Et||Ts)try{je(E)}catch{}else try{E.setAttribute(i,"")}catch{}},xa=function(i){let E=re(i);if(E)for(let p=E.length-1;p>=0;--p){let A=E[p],b=A&&A.name;typeof b!="string"||X[K(b)]||ya(i,A,b)}},Rn=function(i,E){let p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,A=[i];for(;A.length>0;){let b=A.pop();if(E(b)===!1)continue;if(p&&J(b)===Q.element){let y=pe(b);Ke(y)&&A.push(y)}let L=P(b);if(L)for(let y=L.length-1;y>=0;--y)A.push(L[y])}},Nn=function(i){Rn(i,E=>{J(E)===Q.element&&xa(E)})},gn=function(i){let E=[];return Rn(i,p=>{E.push(p)},!0),E},go=function(i,E){let p=Dn();Ye(gn(i),A=>{J(A)===Q.element&&Pn(p,A)}),Ye(E,A=>{J(A)===Q.element&&!Ft(p,A)&&xa(A)})},Ba=function(i,E){let p=!1;return Ye(t.removed,A=>{A.element&&(p=p||A.element===i,Nn(A.element))}),go(i,E),p},Co=8,Io=function(i,E){let p=st,A=null,b=()=>(A||(A=Dn(),Ye(E,L=>{Pn(A,L)})),A);for(let L=0;;L++){let y=gn(i),Z=[i],xe=!1;if(Ye(y,he=>{J(he)===Q.documentFragment?kt(Z,he):!xe&&!Ft(p,he)&&(xe=Ft(b(),he))}),!xe)return;if(L>=Co)throw We("the tree kept changing during in-place sanitization; refusing to return it");Ye(Z,(he,me)=>{So(he,me>0,i,b())})}},So=function(i,E,p,A){let b=Cn(i),L;for(;L=b.nextNode();)!Ft(A,L)||Ft(st,L)||(E&&Oe(W.uponSanitizeShadowNode,L,null),Sn(L,p),On(L,p),Ke(L.content)&&Bt(L.content))},Oo=function(i){st&&Pn(st,i)},Ua=function(i,E){return et?i==="patchsrc"?!0:i==="for"&&E!=="label"&&E!=="output":!1},bo=function(i){et&&Rn(i,E=>{let p=J(E);if(p===Q.processingInstruction||p===Q.comment&&ne(sr,E.data)){try{C(E)}catch{}return!1}if(p===Q.element){let A=E,b=K(Se(E));try{A.hasAttribute&&A.hasAttribute("patchsrc")&&A.removeAttribute("patchsrc"),A.hasAttribute&&A.hasAttribute("for")&&Ua("for",b)&&A.removeAttribute("for")}catch{}}return!0})},ka=function(i){let E=null,p=null;if(hn)i="<remove></remove>"+i;else{let L=Ka(i,/^[\r\n\t ]+/);p=L&&L[0]}yt==="application/xhtml+xml"&&dt===ye&&(i='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+i+"</body></html>");let A=D?ht(i):i;if(dt===ye)try{E=new f().parseFromString(A,yt)}catch{}if(!E||!E.documentElement){E=an.createDocument(dt,"template",null);try{E.documentElement.innerHTML=dn?U:A}catch{}}let b=E.body||E.documentElement;return i&&p&&b.insertBefore(s.createTextNode(p),b.childNodes[0]||null),dt===ye?no.call(E,tt?"html":"body")[0]:tt?E.documentElement:b},Cn=function(i){let E=ve?ve(i):i.ownerDocument;return da.call(E||i,i,m.SHOW_ELEMENT|m.SHOW_COMMENT|m.SHOW_TEXT|m.SHOW_PROCESSING_INSTRUCTION|m.SHOW_CDATA_SECTION,null)},_s=function(i){return i=vt(i,ro," "),i=vt(i,io," "),i=vt(i,oo," "),i},In=function(i){var E;Fa(i);let p=(E=i.querySelectorAll)===null||E===void 0?void 0:E.call(i,"template");p&&Ye(p,A=>{Ke(A.content)&&In(A.content)})},Fa=function(i){i.normalize();let E=ve?ve(i):i.ownerDocument,p=da.call(E||i,i,m.SHOW_TEXT|m.SHOW_COMMENT|m.SHOW_CDATA_SECTION|m.SHOW_PROCESSING_INSTRUCTION,null),A=p.nextNode();for(;A;)A.data=_s(A.data),A=p.nextNode()},ps=function(i){let E=se?se(i):null;return typeof E!="string"||K(E)!=="form"?!1:typeof i.nodeName!="string"||typeof i.textContent!="string"||typeof i.removeChild!="function"||i.attributes!==re(i)||typeof i.removeAttribute!="function"||typeof i.removeAttributeNode!="function"||typeof i.getAttributeNode!="function"||typeof i.setAttribute!="function"||typeof i.namespaceURI!="string"||typeof i.insertBefore!="function"||typeof i.hasChildNodes!="function"||i.nodeType!==ue(i)||i.childNodes!==P(i)},Ke=function(i){if(!ue||typeof i!="object"||i===null)return!1;try{return ue(i)===Q.documentFragment}catch{return!1}},xt=function(i){if(!ue||typeof i!="object"||i===null)return!1;try{return typeof ue(i)=="number"}catch{return!1}};function Oe(N,i,E){N.length!==0&&Ye(N,p=>{p.call(t,i,E,mt)})}let Lo=function(i,E){return!!(et&&i.hasChildNodes()&&!xt(i.firstElementChild)&&ne(Un,i.textContent)&&ne(Un,i.innerHTML)||et&&uc[E]&&J(i)===Q.element&&H(i)===ye&&(xt(i.firstElementChild)||typeof i.textContent=="string"&&ne(Un,i.textContent))||i.nodeType===Q.processingInstruction||et&&i.nodeType===Q.comment&&ne(sr,i.data))},As=function(i,E){if(i instanceof RegExp)return ne(i,E);if(i instanceof Function){for(var p=arguments.length,A=new Array(p>2?p-2:0),b=2;b<p;b++)A[b-2]=arguments[b];return!!i(E,...A)}return!1},Do=function(i,E,p){if(!wt[E]&&Ya(E)&&As(we.tagNameCheck,E))return!1;if(En&&!nt[E]&&!nt[at(E)]){let A=F(i),b=P(i);if(b&&A){let L=b.length;for(let y=L-1;y>=0;--y){let Z=i===p?v(b[y],!0):b[y];A.insertBefore(Z,S(i))}}}return je(i),!0},va=function(i,E,p,A){return i.length===0?E:E===p||E===A?Ae(E):E},_t=function(i,E){return i===E||F(i)!==null?!1:(Tn&&Nn(i),!0)},Sn=function(i,E){if(Oo(i),Oe(W.beforeSanitizeElements,i,null),_t(i,E))return!0;if(ps(i))return je(i),!0;let p=K(Se(i));if(z=va(W.uponSanitizeElement,z,rn,hs),Oe(W.uponSanitizeElement,i,{tagName:p,allowedTags:z}),_t(i,E))return!0;if(Lo(i,p))return je(i),!0;if(wt[p]||!(Xe.tagCheck instanceof Function&&Xe.tagCheck(p))&&!z[p]){let A=Do(i,p,E);return A===!1&&(Oe(W.afterSanitizeElements,i,null),_t(i,E))?!0:A}if(J(i)===Q.element&&!No(i)||(p==="noscript"||p==="noembed"||p==="noframes")&&ne(lc,i.innerHTML))return je(i),!0;if(He&&i.nodeType===Q.text){let A=_s(i.textContent);i.textContent!==A&&(kt(t.removed,{element:i.cloneNode()}),i.textContent=A)}return Oe(W.afterSanitizeElements,i,null),_t(i,E)},Ha=function(i,E,p){if(_a[E]||Ua(E,i)||Ra&&(E==="id"||E==="name")&&(p in s||p in _o))return!1;let A=X[E]||Xe.attributeCheck instanceof Function&&Xe.attributeCheck(E,i);return cn&&ne(co,E)||pa&&ne(lo,E)?!0:A?Oa[E]||ne(fa,vt(p,ma,""))||(E==="src"||E==="xlink:href"||E==="href")&&i!=="script"&&Ja(p,"data:")===0&&Ia[i]||Aa&&!ne(uo,vt(p,ma,""))?!0:!p:Ya(i)&&As(we.tagNameCheck,i)&&As(we.attributeNameCheck,E,i)||E==="is"&&we.allowCustomizedBuiltInElements&&As(we.tagNameCheck,p)},Po=k({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ya=function(i){return!Po[at(i)]&&ne(ho,i)},Mo=function(i,E,p,A){if(D&&typeof I=="object"&&typeof I.getAttributeType=="function"&&!p)switch(I.getAttributeType(i,E)){case"TrustedHTML":return ht(A);case"TrustedScriptURL":return eo(A)}return A},wo=function(i,E,p,A){try{return p?i.setAttributeNS(p,E,A):i.setAttribute(E,A),ps(i)?(je(i),!1):!0}catch{return ft(E,i),!1}},Wa=function(i,E){return et&&ne(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,E)?!0:at(i)==="attributename"&&Ka(E,"href")!==null},On=function(i,E){if(Oe(W.beforeSanitizeAttributes,i,null),_t(i,E))return;let p=i.attributes;if(!p||ps(i))return;X=va(W.uponSanitizeAttribute,X,on,Es);let A={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:X,forceKeepAttr:void 0},b=p.length,L=K(i.nodeName);for(;b--;){let y=p[b],Z=y.name,xe=y.namespaceURI,he=y.value,me=K(Z),pt=he,fe=Z==="value"?pt:Xo(pt),Ga=!1;if(A.attrName=me,A.attrValue=fe,A.keepAttr=!0,A.forceKeepAttr=void 0,Oe(W.uponSanitizeAttribute,i,A),fe=A.attrValue,Na&&(me==="id"||me==="name")&&Ja(fe,ga)!==0&&(ft(Z,i,y),fe=ga+fe,Ga=!0),Wa(Z,fe)){ft(Z,i,y);continue}if(!A.forceKeepAttr){if(!A.keepAttr){ft(Z,i,y);continue}if(!ln&&ne(nr,fe)){ft(Z,i,y);continue}if(He&&(fe=_s(fe)),!Ha(L,me,fe)){ft(Z,i,y);continue}fe=Mo(L,me,xe,fe),fe!==pt&&wo(i,Z,xe,fe)&&Ga&&ja(t.removed)}}Oe(W.afterSanitizeAttributes,i,null),_t(i,E)},Bt=function(i){let E=null,p=Cn(i);for(Oe(W.beforeSanitizeShadowDOM,i,null);E=p.nextNode();)if(Oe(W.uponSanitizeShadowNode,E,null),Sn(E,i),On(E,i),Ke(E.content)&&Bt(E.content),J(E)===Q.element){let A=pe(E);Ke(A)&&(bn(A),Bt(A))}He&&Fa(i),Oe(W.afterSanitizeShadowDOM,i,null)},bn=function(i){let E=[{node:i,shadow:null}];for(;E.length>0;){let p=E.pop();if(p.shadow){Bt(p.shadow);continue}let A=p.node,b=J(A)===Q.element,L=P(A);if(L)for(let y=L.length-1;y>=0;--y)E.push({node:L[y],shadow:null});if(b){let y=se?se(A):null;if(typeof y=="string"&&K(y)==="template"){let Z=A.content;Ke(Z)&&E.push({node:Z,shadow:null})}}if(b){let y=pe(A);Ke(y)&&E.push({node:null,shadow:y},{node:y,shadow:null})}}};return t.sanitize=function(N){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=null,p=null,A=null,b=null;if(dn=!N,dn&&(N="<!-->"),typeof N!="string"&&!xt(N)&&(N=Vo(N),typeof N!="string"))throw We("dirty is not a string, aborting");if(!t.isSupported)return N;un?(z=hs,X=Es):pn(i),(W.uponSanitizeElement.length>0||W.uponSanitizeAttribute.length>0)&&(z=Ae(z)),W.uponSanitizeAttribute.length>0&&(X=Ae(X)),t.removed=[];let L=Tn&&typeof N!="string"&&xt(N),y=[],Z=st;if(L){bo(N);let me=Se(N);if(typeof me=="string"){let pt=K(me);if(!z[pt]||wt[pt])throw An(N),We("root node is forbidden and cannot be sanitized in-place")}if(ps(N))throw An(N),We("root node is clobbered and cannot be sanitized in-place");y=gn(N),st=Dn()}else if(xt(N))E=ka("<!---->"),p=E.ownerDocument.importNode(N,!0),p.nodeType===Q.element&&p.nodeName==="BODY"||p.nodeName==="HTML"?E=p:E.appendChild(p),bn(E);else{if(!Et&&!He&&!tt&&N.indexOf("<")===-1)return D&&ds?ht(N):N;if(E=ka(N),!E)return Et?null:ds?U:""}E&&hn&&je(E.firstChild);let xe=L?N:E;try{L&&bn(N);let me=Cn(xe);for(;A=me.nextNode();)Sn(A,xe),On(A,xe),Ke(A.content)&&Bt(A.content);L&&Io(N,y)}catch(me){throw L&&(An(N),Ba(N,y)),me}finally{st=Z}if(L){if(Ba(N,y))throw We("a node selected for removal could not be safely returned; refusing to sanitize in place");return He&&In(N),N}if(Et){if(He&&In(E),Ts)for(b=so.call(E.ownerDocument);E.firstChild;)b.appendChild(E.firstChild);else b=E;return(X.shadowroot||X.shadowrootmode)&&(b=ao.call(a,b,!0)),b}let he=tt?E.outerHTML:E.innerHTML;return tt&&z["!doctype"]&&E.ownerDocument&&E.ownerDocument.doctype&&E.ownerDocument.doctype.name&&ne(oc,E.ownerDocument.doctype.name)&&(he="<!DOCTYPE "+E.ownerDocument.doctype.name+`>
3
+ `+he),He&&(he=_s(he)),D&&ds?ht(he):he},t.setConfig=function(){let N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};pn(N),un=!0,hs=z,Es=X},t.clearConfig=function(){mt=null,un=!1,hs=null,Es=null,D=q,U=""},t.isValidAttribute=function(N,i,E){mt||pn({});let p=K(N),A=K(i);return typeof E=="string"&&(Wa(i,E)||!ln&&ne(nr,E))?!1:Ha(p,A,E)},t.addHook=function(N,i){typeof i=="function"&&_e(W,N)&&kt(W[N],i)},t.removeHook=function(N,i){if(_e(W,N)){if(i!==void 0){let E=Wo(W[N],i);return E===-1?void 0:zo(W[N],E,1)[0]}return ja(W[N])}},t.removeHooks=function(N){_e(W,N)&&(W[N]=[])},t.removeAllHooks=function(){W=ar()},t}var hr=ur();var Tc=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),Y="\uFFFD",o;(function(e){e[e.EOF=-1]="EOF",e[e.NULL=0]="NULL",e[e.TABULATION=9]="TABULATION",e[e.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",e[e.LINE_FEED=10]="LINE_FEED",e[e.FORM_FEED=12]="FORM_FEED",e[e.SPACE=32]="SPACE",e[e.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",e[e.QUOTATION_MARK=34]="QUOTATION_MARK",e[e.AMPERSAND=38]="AMPERSAND",e[e.APOSTROPHE=39]="APOSTROPHE",e[e.HYPHEN_MINUS=45]="HYPHEN_MINUS",e[e.SOLIDUS=47]="SOLIDUS",e[e.DIGIT_0=48]="DIGIT_0",e[e.DIGIT_9=57]="DIGIT_9",e[e.SEMICOLON=59]="SEMICOLON",e[e.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",e[e.EQUALS_SIGN=61]="EQUALS_SIGN",e[e.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",e[e.QUESTION_MARK=63]="QUESTION_MARK",e[e.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",e[e.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",e[e.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",e[e.GRAVE_ACCENT=96]="GRAVE_ACCENT",e[e.LATIN_SMALL_A=97]="LATIN_SMALL_A",e[e.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(o||(o={}));var Ee={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function gs(e){return e>=55296&&e<=57343}function Er(e){return e>=56320&&e<=57343}function Tr(e,t){return(e-55296)*1024+9216+t}function Cs(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function Is(e){return e>=64976&&e<=65007||Tc.has(e)}var d;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(d||(d={}));var mc=65536,Ss=class{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=mc,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,s){let{line:a,col:r,offset:c}=this,h=r+s,_=c+s;return{code:t,startLine:a,endLine:a,startCol:h,endCol:h,startOffset:_,endOffset:_}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){let s=this.html.charCodeAt(this.pos+1);if(Er(s))return this.pos++,this._addGap(),Tr(t,s)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,o.EOF;return this._err(d.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,s){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=s}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,s){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(s)return this.html.startsWith(t,this.pos);for(let a=0;a<t.length;a++)if((this.html.charCodeAt(this.pos+a)|32)!==t.charCodeAt(a))return!1;return!0}peek(t){let s=this.pos+t;if(s>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,o.EOF;let a=this.html.charCodeAt(s);return a===o.CARRIAGE_RETURN?o.LINE_FEED:a}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,o.EOF;let t=this.html.charCodeAt(this.pos);return t===o.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,o.LINE_FEED):t===o.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,gs(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===o.LINE_FEED||t===o.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){Cs(t)?this._err(d.controlCharacterInInputStream):Is(t)&&this._err(d.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}};var x;(function(e){e[e.CHARACTER=0]="CHARACTER",e[e.NULL_CHARACTER=1]="NULL_CHARACTER",e[e.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",e[e.START_TAG=3]="START_TAG",e[e.END_TAG=4]="END_TAG",e[e.COMMENT=5]="COMMENT",e[e.DOCTYPE=6]="DOCTYPE",e[e.EOF=7]="EOF",e[e.HIBERNATION=8]="HIBERNATION"})(x||(x={}));function Os(e,t){for(let s=e.attrs.length-1;s>=0;s--)if(e.attrs[s].name===t)return e.attrs[s].value;return null}var _c=[8364,0,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,0,381,0,0,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,0,382,376];function dr(e){return e===0||e>=55296&&e<=57343||e>1114111}function mr(e){return dr(e)?65533:e>=128&&e<=159&&_c[e-128]||e}function fr(e){return dr(e)?65533:e}var be=(()=>{let e=new Uint8Array(127),t=0;for(let s=33;s<=126;s++)s!==34&&s!==36&&s!==92&&(e[s]=t++);return e})();function _r(e,t,s,a,r,c){let _=e.length,m=c*90,f=0,I=()=>{let M=be[e.charCodeAt(f++)];return M<c?M:M*91-m+be[e.charCodeAt(f++)]},w=s-a,v=s+r,C=new Int32Array(v);C.fill(-1,a,c),C.fill(-1,c+w,v);let O=new Int32Array(v),S=new Int32Array(v);function P(M,H){let D=0,U=H,q=H+M;for(;U<q;){let V=be[e.charCodeAt(f++)];if(V<89)D+=V,C[U++]=D;else if(V===89){let $=be[e.charCodeAt(f++)]+2;for(;$--;)C[U++]=++D}else{let $=be[e.charCodeAt(f++)];D+=89+($<90?$*91+be[e.charCodeAt(f++)]:be[e.charCodeAt(f++)]*8281+be[e.charCodeAt(f++)]*91+be[e.charCodeAt(f++)]),C[U++]=D}}}P(a,0),P(w,c);let F=new Int32Array(r*2),pe=0,re=0;function ue(M,H){for(let D=0;D<M;D++){let U=H+D,q=I(),V=I();F[re*2]=q,F[re*2+1]=V,re+=1,O[U]=pe;let $=(C[q]<0?S[q]:1)+(C[V]<0?S[V]:1);S[U]=$,pe+=$}}ue(r-c+a,c+w),ue(c-a,a);let se=new Uint16Array(pe),ve=0;for(let M=0;M<re;M++)for(let H=0;H<2;H++){let D=F[M*2+H],U=C[D];if(U<0){let q=O[D],V=q+S[D];for(;q<V;)se[ve++]=se[q++]}else se[ve++]=U}let J=new Uint16Array(t),Se=0;for(;f<_;){let M=be[e.charCodeAt(f++)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?C2F|.5Jvk!a)javYrquJu3x4ia#T)2@SmYM?C2F|HAxPhH(!a#U#`a*-5Abb|4~@:RhJ9:4E|R@52B5G|F:2<BaY?C2F|Sc^#Xa2j=Qq5CJvB!-g<v{z;hhM?C2F|Zi[vrv{z;hiM?C2F|XKsA>!a)-g<v{z;h[eb?C2F|]i[vrv{z;h]eb?C2F|^iZu.vix,hZq3ah!.(?C2F|QOu!5ShXM:2<BaY?C2F|P",13494,2713,49,25,61);var pr=new Uint16Array([512,26465,29036,7,0,2,4,116,24638,116,24636,8693,29807,24610,621,1,0,0,3,112,24614,111,115,24615]);var te;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.FLAG13=8192]="FLAG13",e[e.BRANCH_LENGTH=8064]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE",e[e.VALUE_MASK=8191]="VALUE_MASK"})(te||(te={}));var oe;(function(e){e[e.AMP=38]="AMP",e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_X=120]="LOWER_X"})(oe||(oe={}));var bs=32;function Ar(e){return e-oe.ZERO>>>0<=9}function pc(e){return(e|bs)-oe.LOWER_A>>>0<=5}function Ac(e){return(e|bs)-oe.LOWER_A>>>0<=25}function Rc(e){return e===oe.EQUALS||Ac(e)||Ar(e)}var ie;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(ie||(ie={}));var Ue;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Ue||(Ue={}));var Ls=class{decodeTree;emitCodePoint;errors;state=ie.EntityStart;consumed=1;result=0;treeIndex=0;excess=1;decodeMode=Ue.Strict;runConsumed=0;constructor(t,s,a){this.decodeTree=t,this.emitCodePoint=s,this.errors=a}startEntity(t){this.decodeMode=t,this.state=ie.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(t,s){switch(this.state){case ie.EntityStart:return t.charCodeAt(s)===oe.NUM?(this.state=ie.NumericStart,this.consumed+=1,this.stateNumericStart(t,s+1)):(this.state=ie.NamedEntity,this.stateNamedEntity(t,s));case ie.NumericStart:return this.stateNumericStart(t,s);case ie.NumericDecimal:return this.stateNumericDecimal(t,s);case ie.NumericHex:return this.stateNumericHex(t,s);default:return this.stateNamedEntity(t,s)}}stateNumericStart(t,s){return s>=t.length?-1:(t.charCodeAt(s)|bs)===oe.LOWER_X?(this.state=ie.NumericHex,this.consumed+=1,this.stateNumericHex(t,s+1)):(this.state=ie.NumericDecimal,this.stateNumericDecimal(t,s))}stateNumericHex(t,s){let a=t.length,{result:r}=this,{consumed:c}=this;for(;s<a;){let h=t.charCodeAt(s);if(Ar(h)||pc(h)){let _=h<=oe.NINE?h-oe.ZERO:(h|bs)-oe.LOWER_A+10;r=r*16+_,c+=1,s+=1}else return this.result=r,this.consumed=c,this.emitNumericEntity(h,3)}return this.result=r,this.consumed=c,-1}stateNumericDecimal(t,s){let a=t.length,{result:r}=this,{consumed:c}=this;for(;s<a;){let h=t.charCodeAt(s)-oe.ZERO;if(h>>>0>9)return this.result=r,this.consumed=c,this.emitNumericEntity(h+oe.ZERO,2);r=r*10+h,c+=1,s+=1}return this.result=r,this.consumed=c,-1}emitNumericEntity(t,s){if(this.consumed<=s)return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===oe.SEMI)this.consumed+=1;else if(this.decodeMode===Ue.Strict)return 0;return this.emitCodePoint((this.decodeTree===pr?fr:mr)(this.result),this.consumed),this.errors&&(t!==oe.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}flushAndEmitLegacyOrReject(t,s,a,r){return this.consumed=t,this.excess=s,this.result===0||this.decodeMode===Ue.Attribute&&(r===0||s>1||Rc(a))?0:this.emitNotTerminatedNamedEntity()}stateNamedEntity(t,s){let{decodeTree:a}=this,r=t.length,c=this.decodeMode===Ue.Strict,{treeIndex:h}=this,{excess:_}=this,{consumed:m}=this,f=a[h];for(;s<r;){for(;(f&(te.VALUE_LENGTH|te.FLAG13))===0&&(f&te.JUMP_TABLE)!==0;){let C=t.charCodeAt(s),O=f&te.JUMP_TABLE,S=(f&te.BRANCH_LENGTH)>>7;if(S===0){if(C!==O)return this.flushAndEmitLegacyOrReject(m,_,C,0);h+=1}else{let P=C-O;if(P>>>0>=S)return this.flushAndEmitLegacyOrReject(m,_,C,0);let F=a[h+1+P];if(F===0)return this.flushAndEmitLegacyOrReject(m,_,C,0);h=h+S+F&65535}if(f=a[h],s+=1,_+=1,s>=r)break}if(s>=r)break;if((f&(te.VALUE_LENGTH|te.FLAG13))===te.FLAG13){let C=(f&te.BRANCH_LENGTH)>>7,{runConsumed:O}=this;if(O===0){let S=t.charCodeAt(s);if(S!==(f&te.JUMP_TABLE))return this.flushAndEmitLegacyOrReject(m,_,S,0);s+=1,_+=1,O=1}for(;O<C;){if(s>=r)return this.treeIndex=h,this.excess=_,this.consumed=m,this.runConsumed=O,-1;let S=O-1,F=a[h+1+(S>>1)]>>((S&1)<<3)&255,pe=t.charCodeAt(s);if(pe!==F)return this.runConsumed=0,this.flushAndEmitLegacyOrReject(m,_,pe,0);s+=1,_+=1,O+=1}this.runConsumed=0,h+=1+(C>>1),f=a[h];continue}let I=f>>>14,w=t.charCodeAt(s);if(I!==0){if(!c&&(f&te.FLAG13)===0&&(this.result=h,m+=_-1,_=1),w===oe.SEMI)return this.emitNamedEntityData(h,I,m+_);if(I===1)return this.flushAndEmitLegacyOrReject(m,_,w,I)}let v=Nc(a,f,h+(I||1),w);if(v<0)return this.flushAndEmitLegacyOrReject(m,_,w,I);h=v,f=a[h],s+=1,_+=1}return!c&&f>>>14&&(f&te.FLAG13)===0&&(this.result=h,m+=_-1,_=1),this.treeIndex=h,this.excess=_,this.consumed=m,-1}emitNotTerminatedNamedEntity(){let{result:t,decodeTree:s}=this,a=s[t]>>>14;return this.emitNamedEntityData(t,a,this.consumed),this.errors?.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,s,a){let{decodeTree:r}=this;return this.emitCodePoint(s===1?r[t]&te.VALUE_MASK:r[t+1],a),s===3&&this.emitCodePoint(r[t+2],a),a}end(){switch(this.state){case ie.NamedEntity:return this.result!==0&&(this.decodeMode!==Ue.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case ie.NumericDecimal:return this.emitNumericEntity(0,2);case ie.NumericHex:return this.emitNumericEntity(0,3);case ie.NumericStart:return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;default:return 0}}};function Nc(e,t,s,a){let r=(t&te.BRANCH_LENGTH)>>7,c=t&te.JUMP_TABLE;if(c){if(r===0)return a===c?s:-1;let m=a-c;if(m>>>0>=r)return-1;let f=e[s+m];return f===0?-1:s+r+f-1&65535}if(r===0)return-1;let h=r+1>>1,_=s+h+r;for(let m=0;m<r;m++){let I=e[s+(m>>1)]>>((m&1)<<3)&255;if(I===a){let w=s+h+m;return _+e[w]&65535}if(I>a)return-1}return-1}var R;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(R||(R={}));var Ge;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(Ge||(Ge={}));var Te;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Te||(Te={}));var T;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(T||(T={}));var n;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(n||(n={}));var gc=new Map([[T.A,n.A],[T.ADDRESS,n.ADDRESS],[T.ANNOTATION_XML,n.ANNOTATION_XML],[T.APPLET,n.APPLET],[T.AREA,n.AREA],[T.ARTICLE,n.ARTICLE],[T.ASIDE,n.ASIDE],[T.B,n.B],[T.BASE,n.BASE],[T.BASEFONT,n.BASEFONT],[T.BGSOUND,n.BGSOUND],[T.BIG,n.BIG],[T.BLOCKQUOTE,n.BLOCKQUOTE],[T.BODY,n.BODY],[T.BR,n.BR],[T.BUTTON,n.BUTTON],[T.CAPTION,n.CAPTION],[T.CENTER,n.CENTER],[T.CODE,n.CODE],[T.COL,n.COL],[T.COLGROUP,n.COLGROUP],[T.DD,n.DD],[T.DESC,n.DESC],[T.DETAILS,n.DETAILS],[T.DIALOG,n.DIALOG],[T.DIR,n.DIR],[T.DIV,n.DIV],[T.DL,n.DL],[T.DT,n.DT],[T.EM,n.EM],[T.EMBED,n.EMBED],[T.FIELDSET,n.FIELDSET],[T.FIGCAPTION,n.FIGCAPTION],[T.FIGURE,n.FIGURE],[T.FONT,n.FONT],[T.FOOTER,n.FOOTER],[T.FOREIGN_OBJECT,n.FOREIGN_OBJECT],[T.FORM,n.FORM],[T.FRAME,n.FRAME],[T.FRAMESET,n.FRAMESET],[T.H1,n.H1],[T.H2,n.H2],[T.H3,n.H3],[T.H4,n.H4],[T.H5,n.H5],[T.H6,n.H6],[T.HEAD,n.HEAD],[T.HEADER,n.HEADER],[T.HGROUP,n.HGROUP],[T.HR,n.HR],[T.HTML,n.HTML],[T.I,n.I],[T.IMG,n.IMG],[T.IMAGE,n.IMAGE],[T.INPUT,n.INPUT],[T.IFRAME,n.IFRAME],[T.KEYGEN,n.KEYGEN],[T.LABEL,n.LABEL],[T.LI,n.LI],[T.LINK,n.LINK],[T.LISTING,n.LISTING],[T.MAIN,n.MAIN],[T.MALIGNMARK,n.MALIGNMARK],[T.MARQUEE,n.MARQUEE],[T.MATH,n.MATH],[T.MENU,n.MENU],[T.META,n.META],[T.MGLYPH,n.MGLYPH],[T.MI,n.MI],[T.MO,n.MO],[T.MN,n.MN],[T.MS,n.MS],[T.MTEXT,n.MTEXT],[T.NAV,n.NAV],[T.NOBR,n.NOBR],[T.NOFRAMES,n.NOFRAMES],[T.NOEMBED,n.NOEMBED],[T.NOSCRIPT,n.NOSCRIPT],[T.OBJECT,n.OBJECT],[T.OL,n.OL],[T.OPTGROUP,n.OPTGROUP],[T.OPTION,n.OPTION],[T.P,n.P],[T.PARAM,n.PARAM],[T.PLAINTEXT,n.PLAINTEXT],[T.PRE,n.PRE],[T.RB,n.RB],[T.RP,n.RP],[T.RT,n.RT],[T.RTC,n.RTC],[T.RUBY,n.RUBY],[T.S,n.S],[T.SCRIPT,n.SCRIPT],[T.SEARCH,n.SEARCH],[T.SECTION,n.SECTION],[T.SELECT,n.SELECT],[T.SOURCE,n.SOURCE],[T.SMALL,n.SMALL],[T.SPAN,n.SPAN],[T.STRIKE,n.STRIKE],[T.STRONG,n.STRONG],[T.STYLE,n.STYLE],[T.SUB,n.SUB],[T.SUMMARY,n.SUMMARY],[T.SUP,n.SUP],[T.TABLE,n.TABLE],[T.TBODY,n.TBODY],[T.TEMPLATE,n.TEMPLATE],[T.TEXTAREA,n.TEXTAREA],[T.TFOOT,n.TFOOT],[T.TD,n.TD],[T.TH,n.TH],[T.THEAD,n.THEAD],[T.TITLE,n.TITLE],[T.TR,n.TR],[T.TRACK,n.TRACK],[T.TT,n.TT],[T.U,n.U],[T.UL,n.UL],[T.SVG,n.SVG],[T.VAR,n.VAR],[T.WBR,n.WBR],[T.XMP,n.XMP]]);function rt(e){var t;return(t=gc.get(e))!==null&&t!==void 0?t:n.UNKNOWN}var g=n,Rr={[R.HTML]:new Set([g.ADDRESS,g.APPLET,g.AREA,g.ARTICLE,g.ASIDE,g.BASE,g.BASEFONT,g.BGSOUND,g.BLOCKQUOTE,g.BODY,g.BR,g.BUTTON,g.CAPTION,g.CENTER,g.COL,g.COLGROUP,g.DD,g.DETAILS,g.DIR,g.DIV,g.DL,g.DT,g.EMBED,g.FIELDSET,g.FIGCAPTION,g.FIGURE,g.FOOTER,g.FORM,g.FRAME,g.FRAMESET,g.H1,g.H2,g.H3,g.H4,g.H5,g.H6,g.HEAD,g.HEADER,g.HGROUP,g.HR,g.HTML,g.IFRAME,g.IMG,g.INPUT,g.LI,g.LINK,g.LISTING,g.MAIN,g.MARQUEE,g.MENU,g.META,g.NAV,g.NOEMBED,g.NOFRAMES,g.NOSCRIPT,g.OBJECT,g.OL,g.P,g.PARAM,g.PLAINTEXT,g.PRE,g.SCRIPT,g.SECTION,g.SELECT,g.SOURCE,g.STYLE,g.SUMMARY,g.TABLE,g.TBODY,g.TD,g.TEMPLATE,g.TEXTAREA,g.TFOOT,g.TH,g.THEAD,g.TITLE,g.TR,g.TRACK,g.UL,g.WBR,g.XMP]),[R.MATHML]:new Set([g.MI,g.MO,g.MN,g.MS,g.MTEXT,g.ANNOTATION_XML]),[R.SVG]:new Set([g.TITLE,g.FOREIGN_OBJECT,g.DESC]),[R.XLINK]:new Set,[R.XML]:new Set,[R.XMLNS]:new Set},Yt=new Set([g.H1,g.H2,g.H3,g.H4,g.H5,g.H6]),Cc=new Set([T.STYLE,T.SCRIPT,T.XMP,T.IFRAME,T.NOEMBED,T.NOFRAMES,T.PLAINTEXT]);function Nr(e,t){return Cc.has(e)||t&&e===T.NOSCRIPT}var l;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(l||(l={}));var ce={DATA:l.DATA,RCDATA:l.RCDATA,RAWTEXT:l.RAWTEXT,SCRIPT_DATA:l.SCRIPT_DATA,PLAINTEXT:l.PLAINTEXT,CDATA_SECTION:l.CDATA_SECTION};function Sc(e){return e>=o.DIGIT_0&&e<=o.DIGIT_9}function Wt(e){return e>=o.LATIN_CAPITAL_A&&e<=o.LATIN_CAPITAL_Z}function Oc(e){return e>=o.LATIN_SMALL_A&&e<=o.LATIN_SMALL_Z}function Ve(e){return Oc(e)||Wt(e)}function gr(e){return Ve(e)||Sc(e)}function Ds(e){return e+32}function Ir(e){return e===o.SPACE||e===o.LINE_FEED||e===o.TABULATION||e===o.FORM_FEED}function Cr(e){return Ir(e)||e===o.SOLIDUS||e===o.GREATER_THAN_SIGN}function bc(e){return e===o.NULL?d.nullCharacterReference:e>1114111?d.characterReferenceOutsideUnicodeRange:gs(e)?d.surrogateCharacterReference:Is(e)?d.noncharacterCharacterReference:Cs(e)||e===o.CARRIAGE_RETURN?d.controlCharacterReference:null}var Gt=class{constructor(t,s){this.options=t,this.handler=s,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=l.DATA,this.returnState=l.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new Ss(s),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Ls(Hn,(a,r)=>{this.preprocessor.pos=this.entityStartPos+r-1,this._flushCodePointConsumedAsCharacterReference(a)},s.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(d.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:a=>{this._err(d.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+a)},validateNumericCharacterReference:a=>{let r=bc(a);r&&this._err(r,1)}}:void 0)}_err(t,s=0){var a,r;(r=(a=this.handler).onParseError)===null||r===void 0||r.call(a,this.preprocessor.getError(t,s))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t?.())}write(t,s,a){this.active=!0,this.preprocessor.write(t,s),this._runParsingLoop(),this.paused||a?.()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let s=0;s<t;s++)this.preprocessor.advance()}_consumeSequenceIfMatch(t,s){return this.preprocessor.startsWith(t,s)?(this._advanceBy(t.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:x.START_TAG,tagName:"",tagID:n.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:x.END_TAG,tagName:"",tagID:n.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(t){this.currentToken={type:x.COMMENT,data:"",location:this.getCurrentLocation(t)}}_createDoctypeToken(t){this.currentToken={type:x.DOCTYPE,name:t,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(t,s){this.currentCharacterToken={type:t,chars:s,location:this.currentLocation}}_createAttr(t){this.currentAttr={name:t,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var t,s;let a=this.currentToken;if(Os(a,this.currentAttr.name)===null){if(a.attrs.push(this.currentAttr),a.location&&this.currentLocation){let r=(t=(s=a.location).attrs)!==null&&t!==void 0?t:s.attrs=Object.create(null);r[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(d.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(t){this._emitCurrentCharacterToken(t.location),this.currentToken=null,t.location&&(t.location.endLine=this.preprocessor.line,t.location.endCol=this.preprocessor.col+1,t.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){let t=this.currentToken;this.prepareToken(t),t.tagID=rt(t.tagName),t.type===x.START_TAG?(this.lastStartTagName=t.tagName,this.handler.onStartTag(t)):(t.attrs.length>0&&this._err(d.endTagWithAttributes),t.selfClosing&&this._err(d.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case x.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case x.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case x.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){let t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:x.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,s){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=s;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,s)}_emitCodePoint(t){let s=Ir(t)?x.WHITESPACE_CHARACTER:t===o.NULL?x.NULL_CHARACTER:x.CHARACTER;this._appendCharToCurrentCharacterToken(s,t<65536?String.fromCharCode(t):String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(x.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=l.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Ue.Attribute:Ue.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===l.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===l.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===l.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case l.DATA:{this._stateData(t);break}case l.RCDATA:{this._stateRcdata(t);break}case l.RAWTEXT:{this._stateRawtext(t);break}case l.SCRIPT_DATA:{this._stateScriptData(t);break}case l.PLAINTEXT:{this._statePlaintext(t);break}case l.TAG_OPEN:{this._stateTagOpen(t);break}case l.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case l.TAG_NAME:{this._stateTagName(t);break}case l.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case l.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case l.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case l.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case l.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case l.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case l.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case l.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case l.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case l.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case l.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case l.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case l.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case l.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case l.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case l.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case l.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case l.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case l.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case l.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case l.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case l.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case l.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case l.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case l.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case l.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case l.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case l.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case l.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case l.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case l.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case l.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case l.BOGUS_COMMENT:{this._stateBogusComment(t);break}case l.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case l.COMMENT_START:{this._stateCommentStart(t);break}case l.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case l.COMMENT:{this._stateComment(t);break}case l.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case l.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case l.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case l.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case l.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case l.COMMENT_END:{this._stateCommentEnd(t);break}case l.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case l.DOCTYPE:{this._stateDoctype(t);break}case l.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case l.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case l.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case l.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case l.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case l.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case l.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case l.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case l.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case l.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case l.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case l.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case l.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case l.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case l.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case l.CDATA_SECTION:{this._stateCdataSection(t);break}case l.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case l.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case l.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case l.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case o.LESS_THAN_SIGN:{this.state=l.TAG_OPEN;break}case o.AMPERSAND:{this._startCharacterReference();break}case o.NULL:{this._err(d.unexpectedNullCharacter),this._emitCodePoint(t);break}case o.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case o.AMPERSAND:{this._startCharacterReference();break}case o.LESS_THAN_SIGN:{this.state=l.RCDATA_LESS_THAN_SIGN;break}case o.NULL:{this._err(d.unexpectedNullCharacter),this._emitChars(Y);break}case o.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case o.LESS_THAN_SIGN:{this.state=l.RAWTEXT_LESS_THAN_SIGN;break}case o.NULL:{this._err(d.unexpectedNullCharacter),this._emitChars(Y);break}case o.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case o.LESS_THAN_SIGN:{this.state=l.SCRIPT_DATA_LESS_THAN_SIGN;break}case o.NULL:{this._err(d.unexpectedNullCharacter),this._emitChars(Y);break}case o.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case o.NULL:{this._err(d.unexpectedNullCharacter),this._emitChars(Y);break}case o.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(Ve(t))this._createStartTagToken(),this.state=l.TAG_NAME,this._stateTagName(t);else switch(t){case o.EXCLAMATION_MARK:{this.state=l.MARKUP_DECLARATION_OPEN;break}case o.SOLIDUS:{this.state=l.END_TAG_OPEN;break}case o.QUESTION_MARK:{this._err(d.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=l.BOGUS_COMMENT,this._stateBogusComment(t);break}case o.EOF:{this._err(d.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(d.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=l.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(Ve(t))this._createEndTagToken(),this.state=l.TAG_NAME,this._stateTagName(t);else switch(t){case o.GREATER_THAN_SIGN:{this._err(d.missingEndTagName),this.state=l.DATA;break}case o.EOF:{this._err(d.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(d.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=l.BOGUS_COMMENT,this._stateBogusComment(t)}}_stateTagName(t){let s=this.currentToken;switch(t){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:{this.state=l.BEFORE_ATTRIBUTE_NAME;break}case o.SOLIDUS:{this.state=l.SELF_CLOSING_START_TAG;break}case o.GREATER_THAN_SIGN:{this.state=l.DATA,this.emitCurrentTagToken();break}case o.NULL:{this._err(d.unexpectedNullCharacter),s.tagName+=Y;break}case o.EOF:{this._err(d.eofInTag),this._emitEOFToken();break}default:s.tagName+=String.fromCodePoint(Wt(t)?Ds(t):t)}}_stateRcdataLessThanSign(t){t===o.SOLIDUS?this.state=l.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=l.RCDATA,this._stateRcdata(t))}_stateRcdataEndTagOpen(t){Ve(t)?(this.state=l.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(t)):(this._emitChars("</"),this.state=l.RCDATA,this._stateRcdata(t))}handleSpecialEndTag(t){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();let s=this.currentToken;switch(s.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=l.BEFORE_ATTRIBUTE_NAME,!1;case o.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=l.SELF_CLOSING_START_TAG,!1;case o.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=l.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=l.RCDATA,this._stateRcdata(t))}_stateRawtextLessThanSign(t){t===o.SOLIDUS?this.state=l.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=l.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagOpen(t){Ve(t)?(this.state=l.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(t)):(this._emitChars("</"),this.state=l.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=l.RAWTEXT,this._stateRawtext(t))}_stateScriptDataLessThanSign(t){switch(t){case o.SOLIDUS:{this.state=l.SCRIPT_DATA_END_TAG_OPEN;break}case o.EXCLAMATION_MARK:{this.state=l.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=l.SCRIPT_DATA,this._stateScriptData(t)}}_stateScriptDataEndTagOpen(t){Ve(t)?(this.state=l.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(t)):(this._emitChars("</"),this.state=l.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=l.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStart(t){t===o.HYPHEN_MINUS?(this.state=l.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=l.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStartDash(t){t===o.HYPHEN_MINUS?(this.state=l.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=l.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscaped(t){switch(t){case o.HYPHEN_MINUS:{this.state=l.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case o.LESS_THAN_SIGN:{this.state=l.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case o.NULL:{this._err(d.unexpectedNullCharacter),this._emitChars(Y);break}case o.EOF:{this._err(d.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataEscapedDash(t){switch(t){case o.HYPHEN_MINUS:{this.state=l.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case o.LESS_THAN_SIGN:{this.state=l.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case o.NULL:{this._err(d.unexpectedNullCharacter),this.state=l.SCRIPT_DATA_ESCAPED,this._emitChars(Y);break}case o.EOF:{this._err(d.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=l.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedDashDash(t){switch(t){case o.HYPHEN_MINUS:{this._emitChars("-");break}case o.LESS_THAN_SIGN:{this.state=l.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case o.GREATER_THAN_SIGN:{this.state=l.SCRIPT_DATA,this._emitChars(">");break}case o.NULL:{this._err(d.unexpectedNullCharacter),this.state=l.SCRIPT_DATA_ESCAPED,this._emitChars(Y);break}case o.EOF:{this._err(d.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=l.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===o.SOLIDUS?this.state=l.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Ve(t)?(this._emitChars("<"),this.state=l.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=l.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){Ve(t)?(this.state=l.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("</"),this.state=l.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=l.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscapeStart(t){if(this.preprocessor.startsWith(Ee.SCRIPT,!1)&&Cr(this.preprocessor.peek(Ee.SCRIPT.length))){this._emitCodePoint(t);for(let s=0;s<Ee.SCRIPT.length;s++)this._emitCodePoint(this._consume());this.state=l.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=l.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscaped(t){switch(t){case o.HYPHEN_MINUS:{this.state=l.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case o.LESS_THAN_SIGN:{this.state=l.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case o.NULL:{this._err(d.unexpectedNullCharacter),this._emitChars(Y);break}case o.EOF:{this._err(d.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDash(t){switch(t){case o.HYPHEN_MINUS:{this.state=l.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case o.LESS_THAN_SIGN:{this.state=l.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case o.NULL:{this._err(d.unexpectedNullCharacter),this.state=l.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Y);break}case o.EOF:{this._err(d.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=l.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDashDash(t){switch(t){case o.HYPHEN_MINUS:{this._emitChars("-");break}case o.LESS_THAN_SIGN:{this.state=l.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case o.GREATER_THAN_SIGN:{this.state=l.SCRIPT_DATA,this._emitChars(">");break}case o.NULL:{this._err(d.unexpectedNullCharacter),this.state=l.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Y);break}case o.EOF:{this._err(d.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=l.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===o.SOLIDUS?(this.state=l.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=l.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(Ee.SCRIPT,!1)&&Cr(this.preprocessor.peek(Ee.SCRIPT.length))){this._emitCodePoint(t);for(let s=0;s<Ee.SCRIPT.length;s++)this._emitCodePoint(this._consume());this.state=l.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=l.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateBeforeAttributeName(t){switch(t){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:break;case o.SOLIDUS:case o.GREATER_THAN_SIGN:case o.EOF:{this.state=l.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case o.EQUALS_SIGN:{this._err(d.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=l.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=l.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateAttributeName(t){switch(t){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:case o.SOLIDUS:case o.GREATER_THAN_SIGN:case o.EOF:{this._leaveAttrName(),this.state=l.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case o.EQUALS_SIGN:{this._leaveAttrName(),this.state=l.BEFORE_ATTRIBUTE_VALUE;break}case o.QUOTATION_MARK:case o.APOSTROPHE:case o.LESS_THAN_SIGN:{this._err(d.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(t);break}case o.NULL:{this._err(d.unexpectedNullCharacter),this.currentAttr.name+=Y;break}default:this.currentAttr.name+=String.fromCodePoint(Wt(t)?Ds(t):t)}}_stateAfterAttributeName(t){switch(t){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:break;case o.SOLIDUS:{this.state=l.SELF_CLOSING_START_TAG;break}case o.EQUALS_SIGN:{this.state=l.BEFORE_ATTRIBUTE_VALUE;break}case o.GREATER_THAN_SIGN:{this.state=l.DATA,this.emitCurrentTagToken();break}case o.EOF:{this._err(d.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=l.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateBeforeAttributeValue(t){switch(t){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:break;case o.QUOTATION_MARK:{this.state=l.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case o.APOSTROPHE:{this.state=l.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case o.GREATER_THAN_SIGN:{this._err(d.missingAttributeValue),this.state=l.DATA,this.emitCurrentTagToken();break}default:this.state=l.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(t)}}_stateAttributeValueDoubleQuoted(t){switch(t){case o.QUOTATION_MARK:{this.state=l.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case o.AMPERSAND:{this._startCharacterReference();break}case o.NULL:{this._err(d.unexpectedNullCharacter),this.currentAttr.value+=Y;break}case o.EOF:{this._err(d.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueSingleQuoted(t){switch(t){case o.APOSTROPHE:{this.state=l.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case o.AMPERSAND:{this._startCharacterReference();break}case o.NULL:{this._err(d.unexpectedNullCharacter),this.currentAttr.value+=Y;break}case o.EOF:{this._err(d.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueUnquoted(t){switch(t){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:{this._leaveAttrValue(),this.state=l.BEFORE_ATTRIBUTE_NAME;break}case o.AMPERSAND:{this._startCharacterReference();break}case o.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=l.DATA,this.emitCurrentTagToken();break}case o.NULL:{this._err(d.unexpectedNullCharacter),this.currentAttr.value+=Y;break}case o.QUOTATION_MARK:case o.APOSTROPHE:case o.LESS_THAN_SIGN:case o.EQUALS_SIGN:case o.GRAVE_ACCENT:{this._err(d.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(t);break}case o.EOF:{this._err(d.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAfterAttributeValueQuoted(t){switch(t){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:{this._leaveAttrValue(),this.state=l.BEFORE_ATTRIBUTE_NAME;break}case o.SOLIDUS:{this._leaveAttrValue(),this.state=l.SELF_CLOSING_START_TAG;break}case o.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=l.DATA,this.emitCurrentTagToken();break}case o.EOF:{this._err(d.eofInTag),this._emitEOFToken();break}default:this._err(d.missingWhitespaceBetweenAttributes),this.state=l.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateSelfClosingStartTag(t){switch(t){case o.GREATER_THAN_SIGN:{let s=this.currentToken;s.selfClosing=!0,this.state=l.DATA,this.emitCurrentTagToken();break}case o.EOF:{this._err(d.eofInTag),this._emitEOFToken();break}default:this._err(d.unexpectedSolidusInTag),this.state=l.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateBogusComment(t){let s=this.currentToken;switch(t){case o.GREATER_THAN_SIGN:{this.state=l.DATA,this.emitCurrentComment(s);break}case o.EOF:{this.emitCurrentComment(s),this._emitEOFToken();break}case o.NULL:{this._err(d.unexpectedNullCharacter),s.data+=Y;break}default:s.data+=String.fromCodePoint(t)}}_stateMarkupDeclarationOpen(t){this._consumeSequenceIfMatch(Ee.DASH_DASH,!0)?(this._createCommentToken(Ee.DASH_DASH.length+1),this.state=l.COMMENT_START):this._consumeSequenceIfMatch(Ee.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(Ee.DOCTYPE.length+1),this.state=l.DOCTYPE):this._consumeSequenceIfMatch(Ee.CDATA_START,!0)?this.inForeignNode?this.state=l.CDATA_SECTION:(this._err(d.cdataInHtmlContent),this._createCommentToken(Ee.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=l.BOGUS_COMMENT):this._ensureHibernation()||(this._err(d.incorrectlyOpenedComment),this._createCommentToken(2),this.state=l.BOGUS_COMMENT,this._stateBogusComment(t))}_stateCommentStart(t){switch(t){case o.HYPHEN_MINUS:{this.state=l.COMMENT_START_DASH;break}case o.GREATER_THAN_SIGN:{this._err(d.abruptClosingOfEmptyComment),this.state=l.DATA;let s=this.currentToken;this.emitCurrentComment(s);break}default:this.state=l.COMMENT,this._stateComment(t)}}_stateCommentStartDash(t){let s=this.currentToken;switch(t){case o.HYPHEN_MINUS:{this.state=l.COMMENT_END;break}case o.GREATER_THAN_SIGN:{this._err(d.abruptClosingOfEmptyComment),this.state=l.DATA,this.emitCurrentComment(s);break}case o.EOF:{this._err(d.eofInComment),this.emitCurrentComment(s),this._emitEOFToken();break}default:s.data+="-",this.state=l.COMMENT,this._stateComment(t)}}_stateComment(t){let s=this.currentToken;switch(t){case o.HYPHEN_MINUS:{this.state=l.COMMENT_END_DASH;break}case o.LESS_THAN_SIGN:{s.data+="<",this.state=l.COMMENT_LESS_THAN_SIGN;break}case o.NULL:{this._err(d.unexpectedNullCharacter),s.data+=Y;break}case o.EOF:{this._err(d.eofInComment),this.emitCurrentComment(s),this._emitEOFToken();break}default:s.data+=String.fromCodePoint(t)}}_stateCommentLessThanSign(t){let s=this.currentToken;switch(t){case o.EXCLAMATION_MARK:{s.data+="!",this.state=l.COMMENT_LESS_THAN_SIGN_BANG;break}case o.LESS_THAN_SIGN:{s.data+="<";break}default:this.state=l.COMMENT,this._stateComment(t)}}_stateCommentLessThanSignBang(t){t===o.HYPHEN_MINUS?this.state=l.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=l.COMMENT,this._stateComment(t))}_stateCommentLessThanSignBangDash(t){t===o.HYPHEN_MINUS?this.state=l.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=l.COMMENT_END_DASH,this._stateCommentEndDash(t))}_stateCommentLessThanSignBangDashDash(t){t!==o.GREATER_THAN_SIGN&&t!==o.EOF&&this._err(d.nestedComment),this.state=l.COMMENT_END,this._stateCommentEnd(t)}_stateCommentEndDash(t){let s=this.currentToken;switch(t){case o.HYPHEN_MINUS:{this.state=l.COMMENT_END;break}case o.EOF:{this._err(d.eofInComment),this.emitCurrentComment(s),this._emitEOFToken();break}default:s.data+="-",this.state=l.COMMENT,this._stateComment(t)}}_stateCommentEnd(t){let s=this.currentToken;switch(t){case o.GREATER_THAN_SIGN:{this.state=l.DATA,this.emitCurrentComment(s);break}case o.EXCLAMATION_MARK:{this.state=l.COMMENT_END_BANG;break}case o.HYPHEN_MINUS:{s.data+="-";break}case o.EOF:{this._err(d.eofInComment),this.emitCurrentComment(s),this._emitEOFToken();break}default:s.data+="--",this.state=l.COMMENT,this._stateComment(t)}}_stateCommentEndBang(t){let s=this.currentToken;switch(t){case o.HYPHEN_MINUS:{s.data+="--!",this.state=l.COMMENT_END_DASH;break}case o.GREATER_THAN_SIGN:{this._err(d.incorrectlyClosedComment),this.state=l.DATA,this.emitCurrentComment(s);break}case o.EOF:{this._err(d.eofInComment),this.emitCurrentComment(s),this._emitEOFToken();break}default:s.data+="--!",this.state=l.COMMENT,this._stateComment(t)}}_stateDoctype(t){switch(t){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:{this.state=l.BEFORE_DOCTYPE_NAME;break}case o.GREATER_THAN_SIGN:{this.state=l.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t);break}case o.EOF:{this._err(d.eofInDoctype),this._createDoctypeToken(null);let s=this.currentToken;s.forceQuirks=!0,this.emitCurrentDoctype(s),this._emitEOFToken();break}default:this._err(d.missingWhitespaceBeforeDoctypeName),this.state=l.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t)}}_stateBeforeDoctypeName(t){if(Wt(t))this._createDoctypeToken(String.fromCharCode(Ds(t))),this.state=l.DOCTYPE_NAME;else switch(t){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:break;case o.NULL:{this._err(d.unexpectedNullCharacter),this._createDoctypeToken(Y),this.state=l.DOCTYPE_NAME;break}case o.GREATER_THAN_SIGN:{this._err(d.missingDoctypeName),this._createDoctypeToken(null);let s=this.currentToken;s.forceQuirks=!0,this.emitCurrentDoctype(s),this.state=l.DATA;break}case o.EOF:{this._err(d.eofInDoctype),this._createDoctypeToken(null);let s=this.currentToken;s.forceQuirks=!0,this.emitCurrentDoctype(s),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(t)),this.state=l.DOCTYPE_NAME}}_stateDoctypeName(t){let s=this.currentToken;switch(t){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:{this.state=l.AFTER_DOCTYPE_NAME;break}case o.GREATER_THAN_SIGN:{this.state=l.DATA,this.emitCurrentDoctype(s);break}case o.NULL:{this._err(d.unexpectedNullCharacter),s.name+=Y;break}case o.EOF:{this._err(d.eofInDoctype),s.forceQuirks=!0,this.emitCurrentDoctype(s),this._emitEOFToken();break}default:s.name+=String.fromCodePoint(Wt(t)?Ds(t):t)}}_stateAfterDoctypeName(t){let s=this.currentToken;switch(t){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:break;case o.GREATER_THAN_SIGN:{this.state=l.DATA,this.emitCurrentDoctype(s);break}case o.EOF:{this._err(d.eofInDoctype),s.forceQuirks=!0,this.emitCurrentDoctype(s),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(Ee.PUBLIC,!1)?this.state=l.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(Ee.SYSTEM,!1)?this.state=l.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(d.invalidCharacterSequenceAfterDoctypeName),s.forceQuirks=!0,this.state=l.BOGUS_DOCTYPE,this._stateBogusDoctype(t))}}_stateAfterDoctypePublicKeyword(t){let s=this.currentToken;switch(t){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:{this.state=l.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case o.QUOTATION_MARK:{this._err(d.missingWhitespaceAfterDoctypePublicKeyword),s.publicId="",this.state=l.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case o.APOSTROPHE:{this._err(d.missingWhitespaceAfterDoctypePublicKeyword),s.publicId="",this.state=l.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case o.GREATER_THAN_SIGN:{this._err(d.missingDoctypePublicIdentifier),s.forceQuirks=!0,this.state=l.DATA,this.emitCurrentDoctype(s);break}case o.EOF:{this._err(d.eofInDoctype),s.forceQuirks=!0,this.emitCurrentDoctype(s),this._emitEOFToken();break}default:this._err(d.missingQuoteBeforeDoctypePublicIdentifier),s.forceQuirks=!0,this.state=l.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypePublicIdentifier(t){let s=this.currentToken;switch(t){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:break;case o.QUOTATION_MARK:{s.publicId="",this.state=l.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case o.APOSTROPHE:{s.publicId="",this.state=l.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case o.GREATER_THAN_SIGN:{this._err(d.missingDoctypePublicIdentifier),s.forceQuirks=!0,this.state=l.DATA,this.emitCurrentDoctype(s);break}case o.EOF:{this._err(d.eofInDoctype),s.forceQuirks=!0,this.emitCurrentDoctype(s),this._emitEOFToken();break}default:this._err(d.missingQuoteBeforeDoctypePublicIdentifier),s.forceQuirks=!0,this.state=l.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypePublicIdentifierDoubleQuoted(t){let s=this.currentToken;switch(t){case o.QUOTATION_MARK:{this.state=l.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case o.NULL:{this._err(d.unexpectedNullCharacter),s.publicId+=Y;break}case o.GREATER_THAN_SIGN:{this._err(d.abruptDoctypePublicIdentifier),s.forceQuirks=!0,this.emitCurrentDoctype(s),this.state=l.DATA;break}case o.EOF:{this._err(d.eofInDoctype),s.forceQuirks=!0,this.emitCurrentDoctype(s),this._emitEOFToken();break}default:s.publicId+=String.fromCodePoint(t)}}_stateDoctypePublicIdentifierSingleQuoted(t){let s=this.currentToken;switch(t){case o.APOSTROPHE:{this.state=l.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case o.NULL:{this._err(d.unexpectedNullCharacter),s.publicId+=Y;break}case o.GREATER_THAN_SIGN:{this._err(d.abruptDoctypePublicIdentifier),s.forceQuirks=!0,this.emitCurrentDoctype(s),this.state=l.DATA;break}case o.EOF:{this._err(d.eofInDoctype),s.forceQuirks=!0,this.emitCurrentDoctype(s),this._emitEOFToken();break}default:s.publicId+=String.fromCodePoint(t)}}_stateAfterDoctypePublicIdentifier(t){let s=this.currentToken;switch(t){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:{this.state=l.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case o.GREATER_THAN_SIGN:{this.state=l.DATA,this.emitCurrentDoctype(s);break}case o.QUOTATION_MARK:{this._err(d.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),s.systemId="",this.state=l.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case o.APOSTROPHE:{this._err(d.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),s.systemId="",this.state=l.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case o.EOF:{this._err(d.eofInDoctype),s.forceQuirks=!0,this.emitCurrentDoctype(s),this._emitEOFToken();break}default:this._err(d.missingQuoteBeforeDoctypeSystemIdentifier),s.forceQuirks=!0,this.state=l.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBetweenDoctypePublicAndSystemIdentifiers(t){let s=this.currentToken;switch(t){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:break;case o.GREATER_THAN_SIGN:{this.emitCurrentDoctype(s),this.state=l.DATA;break}case o.QUOTATION_MARK:{s.systemId="",this.state=l.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case o.APOSTROPHE:{s.systemId="",this.state=l.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case o.EOF:{this._err(d.eofInDoctype),s.forceQuirks=!0,this.emitCurrentDoctype(s),this._emitEOFToken();break}default:this._err(d.missingQuoteBeforeDoctypeSystemIdentifier),s.forceQuirks=!0,this.state=l.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateAfterDoctypeSystemKeyword(t){let s=this.currentToken;switch(t){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:{this.state=l.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case o.QUOTATION_MARK:{this._err(d.missingWhitespaceAfterDoctypeSystemKeyword),s.systemId="",this.state=l.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case o.APOSTROPHE:{this._err(d.missingWhitespaceAfterDoctypeSystemKeyword),s.systemId="",this.state=l.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case o.GREATER_THAN_SIGN:{this._err(d.missingDoctypeSystemIdentifier),s.forceQuirks=!0,this.state=l.DATA,this.emitCurrentDoctype(s);break}case o.EOF:{this._err(d.eofInDoctype),s.forceQuirks=!0,this.emitCurrentDoctype(s),this._emitEOFToken();break}default:this._err(d.missingQuoteBeforeDoctypeSystemIdentifier),s.forceQuirks=!0,this.state=l.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypeSystemIdentifier(t){let s=this.currentToken;switch(t){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:break;case o.QUOTATION_MARK:{s.systemId="",this.state=l.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case o.APOSTROPHE:{s.systemId="",this.state=l.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case o.GREATER_THAN_SIGN:{this._err(d.missingDoctypeSystemIdentifier),s.forceQuirks=!0,this.state=l.DATA,this.emitCurrentDoctype(s);break}case o.EOF:{this._err(d.eofInDoctype),s.forceQuirks=!0,this.emitCurrentDoctype(s),this._emitEOFToken();break}default:this._err(d.missingQuoteBeforeDoctypeSystemIdentifier),s.forceQuirks=!0,this.state=l.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypeSystemIdentifierDoubleQuoted(t){let s=this.currentToken;switch(t){case o.QUOTATION_MARK:{this.state=l.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case o.NULL:{this._err(d.unexpectedNullCharacter),s.systemId+=Y;break}case o.GREATER_THAN_SIGN:{this._err(d.abruptDoctypeSystemIdentifier),s.forceQuirks=!0,this.emitCurrentDoctype(s),this.state=l.DATA;break}case o.EOF:{this._err(d.eofInDoctype),s.forceQuirks=!0,this.emitCurrentDoctype(s),this._emitEOFToken();break}default:s.systemId+=String.fromCodePoint(t)}}_stateDoctypeSystemIdentifierSingleQuoted(t){let s=this.currentToken;switch(t){case o.APOSTROPHE:{this.state=l.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case o.NULL:{this._err(d.unexpectedNullCharacter),s.systemId+=Y;break}case o.GREATER_THAN_SIGN:{this._err(d.abruptDoctypeSystemIdentifier),s.forceQuirks=!0,this.emitCurrentDoctype(s),this.state=l.DATA;break}case o.EOF:{this._err(d.eofInDoctype),s.forceQuirks=!0,this.emitCurrentDoctype(s),this._emitEOFToken();break}default:s.systemId+=String.fromCodePoint(t)}}_stateAfterDoctypeSystemIdentifier(t){let s=this.currentToken;switch(t){case o.SPACE:case o.LINE_FEED:case o.TABULATION:case o.FORM_FEED:break;case o.GREATER_THAN_SIGN:{this.emitCurrentDoctype(s),this.state=l.DATA;break}case o.EOF:{this._err(d.eofInDoctype),s.forceQuirks=!0,this.emitCurrentDoctype(s),this._emitEOFToken();break}default:this._err(d.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=l.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBogusDoctype(t){let s=this.currentToken;switch(t){case o.GREATER_THAN_SIGN:{this.emitCurrentDoctype(s),this.state=l.DATA;break}case o.NULL:{this._err(d.unexpectedNullCharacter);break}case o.EOF:{this.emitCurrentDoctype(s),this._emitEOFToken();break}default:}}_stateCdataSection(t){switch(t){case o.RIGHT_SQUARE_BRACKET:{this.state=l.CDATA_SECTION_BRACKET;break}case o.EOF:{this._err(d.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateCdataSectionBracket(t){t===o.RIGHT_SQUARE_BRACKET?this.state=l.CDATA_SECTION_END:(this._emitChars("]"),this.state=l.CDATA_SECTION,this._stateCdataSection(t))}_stateCdataSectionEnd(t){switch(t){case o.GREATER_THAN_SIGN:{this.state=l.DATA;break}case o.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=l.CDATA_SECTION,this._stateCdataSection(t)}}_stateCharacterReference(){let t=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(t<0)if(this.preprocessor.lastChunkWritten)t=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}t===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(o.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&gr(this.preprocessor.peek(1))?l.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(t){gr(t)?this._flushCodePointConsumedAsCharacterReference(t):(t===o.SEMICOLON&&this._err(d.unknownNamedCharacterReference),this.state=this.returnState,this._callState(t))}};var Lr=new Set([n.DD,n.DT,n.LI,n.OPTGROUP,n.OPTION,n.P,n.RB,n.RP,n.RT,n.RTC]),Sr=new Set([...Lr,n.CAPTION,n.COLGROUP,n.TBODY,n.TD,n.TFOOT,n.TH,n.THEAD,n.TR]),Ps=new Set([n.APPLET,n.CAPTION,n.HTML,n.MARQUEE,n.OBJECT,n.TABLE,n.TD,n.TEMPLATE,n.TH]),Lc=new Set([...Ps,n.OL,n.UL]),Dc=new Set([...Ps,n.BUTTON]),Or=new Set([n.ANNOTATION_XML,n.MI,n.MN,n.MO,n.MS,n.MTEXT]),br=new Set([n.DESC,n.FOREIGN_OBJECT,n.TITLE]),Pc=new Set([n.TR,n.TEMPLATE,n.HTML]),Mc=new Set([n.TBODY,n.TFOOT,n.THEAD,n.TEMPLATE,n.HTML]),wc=new Set([n.TABLE,n.TEMPLATE,n.HTML]),yc=new Set([n.TD,n.TH]),Ms=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(t,s,a){this.treeAdapter=s,this.handler=a,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=n.UNKNOWN,this.current=t}_indexOf(t){return this.items.lastIndexOf(t,this.stackTop)}_isInTemplate(){return this.currentTagId===n.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===R.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(t,s){this.stackTop++,this.items[this.stackTop]=t,this.current=t,this.tagIDs[this.stackTop]=s,this.currentTagId=s,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(t,s,!0)}pop(){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,s){let a=this._indexOf(t);this.items[a]=s,a===this.stackTop&&(this.current=s)}insertAfter(t,s,a){let r=this._indexOf(t)+1;this.items.splice(r,0,s),this.tagIDs.splice(r,0,a),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(t){let s=this.stackTop+1;do s=this.tagIDs.lastIndexOf(t,s-1);while(s>0&&this.treeAdapter.getNamespaceURI(this.items[s])!==R.HTML);this.shortenToLength(Math.max(s,0))}shortenToLength(t){for(;this.stackTop>=t;){let s=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(s,this.stackTop<t)}}popUntilElementPopped(t){let s=this._indexOf(t);this.shortenToLength(Math.max(s,0))}popUntilPopped(t,s){let a=this._indexOfTagNames(t,s);this.shortenToLength(Math.max(a,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(Yt,R.HTML)}popUntilTableCellPopped(){this.popUntilPopped(yc,R.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(t,s){for(let a=this.stackTop;a>=0;a--)if(t.has(this.tagIDs[a])&&this.treeAdapter.getNamespaceURI(this.items[a])===s)return a;return-1}clearBackTo(t,s){let a=this._indexOfTagNames(t,s);this.shortenToLength(a+1)}clearBackToTableContext(){this.clearBackTo(wc,R.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Mc,R.HTML)}clearBackToTableRowContext(){this.clearBackTo(Pc,R.HTML)}remove(t){let s=this._indexOf(t);s>=0&&(s===this.stackTop?this.pop():(this.items.splice(s,1),this.tagIDs.splice(s,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===n.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){let s=this._indexOf(t)-1;return s>=0?this.items[s]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===n.HTML}hasInDynamicScope(t,s){for(let a=this.stackTop;a>=0;a--){let r=this.tagIDs[a];switch(this.treeAdapter.getNamespaceURI(this.items[a])){case R.HTML:{if(r===t)return!0;if(s.has(r))return!1;break}case R.SVG:{if(br.has(r))return!1;break}case R.MATHML:{if(Or.has(r))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,Ps)}hasInListItemScope(t){return this.hasInDynamicScope(t,Lc)}hasInButtonScope(t){return this.hasInDynamicScope(t,Dc)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){let s=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case R.HTML:{if(Yt.has(s))return!0;if(Ps.has(s))return!1;break}case R.SVG:{if(br.has(s))return!1;break}case R.MATHML:{if(Or.has(s))return!1;break}}}return!0}hasInTableScope(t){for(let s=this.stackTop;s>=0;s--)if(this.treeAdapter.getNamespaceURI(this.items[s])===R.HTML)switch(this.tagIDs[s]){case t:return!0;case n.TABLE:case n.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===R.HTML)switch(this.tagIDs[t]){case n.TBODY:case n.THEAD:case n.TFOOT:return!0;case n.TABLE:case n.HTML:return!1}return!0}hasInSelectScope(t){for(let s=this.stackTop;s>=0;s--)if(this.treeAdapter.getNamespaceURI(this.items[s])===R.HTML)switch(this.tagIDs[s]){case t:return!0;case n.OPTION:case n.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&Lr.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&Sr.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&Sr.has(this.currentTagId);)this.pop()}};var Le;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(Le||(Le={}));var Dr={type:Le.Marker},ws=class{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,s){let a=[],r=s.length,c=this.treeAdapter.getTagName(t),h=this.treeAdapter.getNamespaceURI(t);for(let _=0;_<this.entries.length;_++){let m=this.entries[_];if(m.type===Le.Marker)break;let{element:f}=m;if(this.treeAdapter.getTagName(f)===c&&this.treeAdapter.getNamespaceURI(f)===h){let I=this.treeAdapter.getAttrList(f);I.length===r&&a.push({idx:_,attrs:I})}}return a}_ensureNoahArkCondition(t){if(this.entries.length<3)return;let s=this.treeAdapter.getAttrList(t),a=this._getNoahArkConditionCandidates(t,s);if(a.length<3)return;let r=new Map(s.map(h=>[h.name,h.value])),c=0;for(let h=0;h<a.length;h++){let _=a[h];_.attrs.every(m=>r.get(m.name)===m.value)&&(c+=1,c>=3&&this.entries.splice(_.idx,1))}}insertMarker(){this.entries.unshift(Dr)}pushElement(t,s){this._ensureNoahArkCondition(t),this.entries.unshift({type:Le.Element,element:t,token:s})}insertElementAfterBookmark(t,s){let a=this.entries.indexOf(this.bookmark);this.entries.splice(a,0,{type:Le.Element,element:t,token:s})}removeEntry(t){let s=this.entries.indexOf(t);s!==-1&&this.entries.splice(s,1)}clearToLastMarker(){let t=this.entries.indexOf(Dr);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){let s=this.entries.find(a=>a.type===Le.Marker||this.treeAdapter.getTagName(a.element)===t);return s&&s.type===Le.Element?s:null}getElementEntry(t){return this.entries.find(s=>s.type===Le.Element&&s.element===t)}};var Ce={createDocument(){return{nodeName:"#document",mode:Te.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,s){return{nodeName:e,tagName:e,attrs:s,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,s){let a=e.childNodes.indexOf(s);e.childNodes.splice(a,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,s,a){let r=e.childNodes.find(c=>c.nodeName==="#documentType");if(r)r.name=t,r.publicId=s,r.systemId=a;else{let c={nodeName:"#documentType",name:t,publicId:s,systemId:a,parentNode:null};Ce.appendChild(e,c)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let s=e.childNodes[e.childNodes.length-1];if(Ce.isTextNode(s)){s.value+=t;return}}Ce.appendChild(e,Ce.createTextNode(t))},insertTextBefore(e,t,s){let a=e.childNodes[e.childNodes.indexOf(s)-1];a&&Ce.isTextNode(a)?a.value+=t:Ce.insertBefore(e,Ce.createTextNode(t),s)},adoptAttributes(e,t){let s=new Set(e.attrs.map(a=>a.name));for(let a=0;a<t.length;a++)s.has(t[a].name)||e.attrs.push(t[a])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName==="#text"},isCommentNode(e){return e.nodeName==="#comment"},isDocumentTypeNode(e){return e.nodeName==="#documentType"},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,"tagName")},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}};var Mr="html",xc="about:legacy-compat",Bc="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",wr=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],Uc=[...wr,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],kc=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),yr=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],Fc=[...yr,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function Pr(e,t){return t.some(s=>e.startsWith(s))}function xr(e){return e.name===Mr&&e.publicId===null&&(e.systemId===null||e.systemId===xc)}function Br(e){if(e.name!==Mr)return Te.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===Bc)return Te.QUIRKS;let{publicId:s}=e;if(s!==null){if(s=s.toLowerCase(),kc.has(s))return Te.QUIRKS;let a=t===null?Uc:wr;if(Pr(s,a))return Te.QUIRKS;if(a=t===null?yr:Fc,Pr(s,a))return Te.LIMITED_QUIRKS}return Te.NO_QUIRKS}var Ur={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},Hc="definitionurl",Yc="definitionURL",Wc=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),Gc=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:R.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:R.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:R.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:R.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:R.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:R.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:R.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:R.XML}],["xml:space",{prefix:"xml",name:"space",namespace:R.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:R.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:R.XMLNS}]]),zc=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),Xc=new Set([n.B,n.BIG,n.BLOCKQUOTE,n.BODY,n.BR,n.CENTER,n.CODE,n.DD,n.DIV,n.DL,n.DT,n.EM,n.EMBED,n.H1,n.H2,n.H3,n.H4,n.H5,n.H6,n.HEAD,n.HR,n.I,n.IMG,n.LI,n.LISTING,n.MENU,n.META,n.NOBR,n.OL,n.P,n.PRE,n.RUBY,n.S,n.SMALL,n.SPAN,n.STRONG,n.STRIKE,n.SUB,n.SUP,n.TABLE,n.TT,n.U,n.UL,n.VAR]);function kr(e){let t=e.tagID;return t===n.FONT&&e.attrs.some(({name:a})=>a===Ge.COLOR||a===Ge.SIZE||a===Ge.FACE)||Xc.has(t)}function Yn(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===Hc){e.attrs[t].name=Yc;break}}function Wn(e){for(let t=0;t<e.attrs.length;t++){let s=Wc.get(e.attrs[t].name);s!=null&&(e.attrs[t].name=s)}}function ys(e){for(let t=0;t<e.attrs.length;t++){let s=Gc.get(e.attrs[t].name);s&&(e.attrs[t].prefix=s.prefix,e.attrs[t].name=s.name,e.attrs[t].namespace=s.namespace)}}function Fr(e){let t=zc.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=rt(e.tagName))}function jc(e,t){return t===R.MATHML&&(e===n.MI||e===n.MO||e===n.MN||e===n.MS||e===n.MTEXT)}function Kc(e,t,s){if(t===R.MATHML&&e===n.ANNOTATION_XML){for(let a=0;a<s.length;a++)if(s[a].name===Ge.ENCODING){let r=s[a].value.toLowerCase();return r===Ur.TEXT_HTML||r===Ur.APPLICATION_XML}}return t===R.SVG&&(e===n.FOREIGN_OBJECT||e===n.DESC||e===n.TITLE)}function vr(e,t,s,a){return(!a||a===R.HTML)&&Kc(e,t,s)||(!a||a===R.MATHML)&&jc(e,t)}var Jc="hidden",Vc=8,Qc=3,u;(function(e){e[e.INITIAL=0]="INITIAL",e[e.BEFORE_HTML=1]="BEFORE_HTML",e[e.BEFORE_HEAD=2]="BEFORE_HEAD",e[e.IN_HEAD=3]="IN_HEAD",e[e.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",e[e.AFTER_HEAD=5]="AFTER_HEAD",e[e.IN_BODY=6]="IN_BODY",e[e.TEXT=7]="TEXT",e[e.IN_TABLE=8]="IN_TABLE",e[e.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",e[e.IN_CAPTION=10]="IN_CAPTION",e[e.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",e[e.IN_TABLE_BODY=12]="IN_TABLE_BODY",e[e.IN_ROW=13]="IN_ROW",e[e.IN_CELL=14]="IN_CELL",e[e.IN_SELECT=15]="IN_SELECT",e[e.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",e[e.IN_TEMPLATE=17]="IN_TEMPLATE",e[e.AFTER_BODY=18]="AFTER_BODY",e[e.IN_FRAMESET=19]="IN_FRAMESET",e[e.AFTER_FRAMESET=20]="AFTER_FRAMESET",e[e.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",e[e.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(u||(u={}));var qc={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},zr=new Set([n.TABLE,n.TBODY,n.TFOOT,n.THEAD,n.TR]),Yr={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:Ce,onParseError:null},gt=class{constructor(t,s,a=null,r=null){this.fragmentContext=a,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=u.INITIAL,this.originalInsertionMode=u.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...Yr,...t},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=s??this.treeAdapter.createDocument(),this.tokenizer=new Gt(this.options,this),this.activeFormattingElements=new ws(this.treeAdapter),this.fragmentContextID=a?rt(this.treeAdapter.getTagName(a)):n.UNKNOWN,this._setContextModes(a??this.document,this.fragmentContextID),this.openElements=new Ms(this.document,this.treeAdapter,this)}static parse(t,s){let a=new this(s);return a.tokenizer.write(t,!0),a.document}static getFragmentParser(t,s){let a={...Yr,...s};t??(t=a.treeAdapter.createElement(T.TEMPLATE,R.HTML,[]));let r=a.treeAdapter.createElement("documentmock",R.HTML,[]),c=new this(a,r,t);return c.fragmentContextID===n.TEMPLATE&&c.tmplInsertionModeStack.unshift(u.IN_TEMPLATE),c._initTokenizerForFragmentParsing(),c._insertFakeRootElement(),c._resetInsertionMode(),c._findFormInFragmentContext(),c}getFragment(){let t=this.treeAdapter.getFirstChild(this.document),s=this.treeAdapter.createDocumentFragment();return this._adoptNodes(t,s),s}_err(t,s,a){var r;if(!this.onParseError)return;let c=(r=t.location)!==null&&r!==void 0?r:qc,h={code:s,startLine:c.startLine,startCol:c.startCol,startOffset:c.startOffset,endLine:a?c.startLine:c.endLine,endCol:a?c.startCol:c.endCol,endOffset:a?c.startOffset:c.endOffset};this.onParseError(h)}onItemPush(t,s,a){var r,c;(c=(r=this.treeAdapter).onItemPush)===null||c===void 0||c.call(r,t),a&&this.openElements.stackTop>0&&this._setContextModes(t,s)}onItemPop(t,s){var a,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(r=(a=this.treeAdapter).onItemPop)===null||r===void 0||r.call(a,t,this.openElements.current),s){let c,h;this.openElements.stackTop===0&&this.fragmentContext?(c=this.fragmentContext,h=this.fragmentContextID):{current:c,currentTagId:h}=this.openElements,this._setContextModes(c,h)}}_setContextModes(t,s){let a=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===R.HTML;this.currentNotInHTML=!a,this.tokenizer.inForeignNode=!a&&t!==void 0&&s!==void 0&&!this._isIntegrationPoint(s,t)}_switchToTextParsing(t,s){this._insertElement(t,R.HTML),this.tokenizer.state=s,this.originalInsertionMode=this.insertionMode,this.insertionMode=u.TEXT}switchToPlaintextParsing(){this.insertionMode=u.TEXT,this.originalInsertionMode=u.IN_BODY,this.tokenizer.state=ce.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===T.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==R.HTML))switch(this.fragmentContextID){case n.TITLE:case n.TEXTAREA:{this.tokenizer.state=ce.RCDATA;break}case n.STYLE:case n.XMP:case n.IFRAME:case n.NOEMBED:case n.NOFRAMES:case n.NOSCRIPT:{this.tokenizer.state=ce.RAWTEXT;break}case n.SCRIPT:{this.tokenizer.state=ce.SCRIPT_DATA;break}case n.PLAINTEXT:{this.tokenizer.state=ce.PLAINTEXT;break}default:}}_setDocumentType(t){let s=t.name||"",a=t.publicId||"",r=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,s,a,r),t.location){let h=this.treeAdapter.getChildNodes(this.document).find(_=>this.treeAdapter.isDocumentTypeNode(_));h&&this.treeAdapter.setNodeSourceCodeLocation(h,t.location)}}_attachElementToTree(t,s){if(this.options.sourceCodeLocationInfo){let a=s&&{...s,startTag:s};this.treeAdapter.setNodeSourceCodeLocation(t,a)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{let a=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(a??this.document,t)}}_appendElement(t,s){let a=this.treeAdapter.createElement(t.tagName,s,t.attrs);this._attachElementToTree(a,t.location)}_insertElement(t,s){let a=this.treeAdapter.createElement(t.tagName,s,t.attrs);this._attachElementToTree(a,t.location),this.openElements.push(a,t.tagID)}_insertFakeElement(t,s){let a=this.treeAdapter.createElement(t,R.HTML,[]);this._attachElementToTree(a,null),this.openElements.push(a,s)}_insertTemplate(t){let s=this.treeAdapter.createElement(t.tagName,R.HTML,t.attrs),a=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(s,a),this._attachElementToTree(s,t.location),this.openElements.push(s,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,null)}_insertFakeRootElement(){let t=this.treeAdapter.createElement(T.HTML,R.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,n.HTML)}_appendCommentNode(t,s){let a=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(s,a),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}_insertCharacters(t){let s,a;if(this._shouldFosterParentOnInsertion()?({parent:s,beforeElement:a}=this._findFosterParentingLocation(),a?this.treeAdapter.insertTextBefore(s,t.chars,a):this.treeAdapter.insertText(s,t.chars)):(s=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(s,t.chars)),!t.location)return;let r=this.treeAdapter.getChildNodes(s),c=a?r.lastIndexOf(a):r.length,h=r[c-1];if(this.treeAdapter.getNodeSourceCodeLocation(h)){let{endLine:m,endCol:f,endOffset:I}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(h,{endLine:m,endCol:f,endOffset:I})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(h,t.location)}_adoptNodes(t,s){for(let a=this.treeAdapter.getFirstChild(t);a;a=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(a),this.treeAdapter.appendChild(s,a)}_setEndLocation(t,s){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&s.location){let a=s.location,r=this.treeAdapter.getTagName(t),c=s.type===x.END_TAG&&r===s.tagName?{endTag:{...a},endLine:a.endLine,endCol:a.endCol,endOffset:a.endOffset}:{endLine:a.startLine,endCol:a.startCol,endOffset:a.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,c)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let s,a;return this.openElements.stackTop===0&&this.fragmentContext?(s=this.fragmentContext,a=this.fragmentContextID):{current:s,currentTagId:a}=this.openElements,t.tagID===n.SVG&&this.treeAdapter.getTagName(s)===T.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(s)===R.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===n.MGLYPH||t.tagID===n.MALIGNMARK)&&a!==void 0&&!this._isIntegrationPoint(a,s,R.HTML)}_processToken(t){switch(t.type){case x.CHARACTER:{this.onCharacter(t);break}case x.NULL_CHARACTER:{this.onNullCharacter(t);break}case x.COMMENT:{this.onComment(t);break}case x.DOCTYPE:{this.onDoctype(t);break}case x.START_TAG:{this._processStartTag(t);break}case x.END_TAG:{this.onEndTag(t);break}case x.EOF:{this.onEof(t);break}case x.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,s,a){let r=this.treeAdapter.getNamespaceURI(s),c=this.treeAdapter.getAttrList(s);return vr(t,r,c,a)}_reconstructActiveFormattingElements(){let t=this.activeFormattingElements.entries.length;if(t){let s=this.activeFormattingElements.entries.findIndex(r=>r.type===Le.Marker||this.openElements.contains(r.element)),a=s===-1?t-1:s-1;for(let r=a;r>=0;r--){let c=this.activeFormattingElements.entries[r];this._insertElement(c.token,this.treeAdapter.getNamespaceURI(c.element)),c.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=u.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(n.P),this.openElements.popUntilTagNamePopped(n.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case n.TR:{this.insertionMode=u.IN_ROW;return}case n.TBODY:case n.THEAD:case n.TFOOT:{this.insertionMode=u.IN_TABLE_BODY;return}case n.CAPTION:{this.insertionMode=u.IN_CAPTION;return}case n.COLGROUP:{this.insertionMode=u.IN_COLUMN_GROUP;return}case n.TABLE:{this.insertionMode=u.IN_TABLE;return}case n.BODY:{this.insertionMode=u.IN_BODY;return}case n.FRAMESET:{this.insertionMode=u.IN_FRAMESET;return}case n.SELECT:{this._resetInsertionModeForSelect(t);return}case n.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case n.HTML:{this.insertionMode=this.headElement?u.AFTER_HEAD:u.BEFORE_HEAD;return}case n.TD:case n.TH:{if(t>0){this.insertionMode=u.IN_CELL;return}break}case n.HEAD:{if(t>0){this.insertionMode=u.IN_HEAD;return}break}}this.insertionMode=u.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let s=t-1;s>0;s--){let a=this.openElements.tagIDs[s];if(a===n.TEMPLATE)break;if(a===n.TABLE){this.insertionMode=u.IN_SELECT_IN_TABLE;return}}this.insertionMode=u.IN_SELECT}_isElementCausesFosterParenting(t){return zr.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){let s=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case n.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(s)===R.HTML)return{parent:this.treeAdapter.getTemplateContent(s),beforeElement:null};break}case n.TABLE:{let a=this.treeAdapter.getParentNode(s);return a?{parent:a,beforeElement:s}:{parent:this.openElements.items[t-1],beforeElement:null}}default:}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){let s=this._findFosterParentingLocation();s.beforeElement?this.treeAdapter.insertBefore(s.parent,t,s.beforeElement):this.treeAdapter.appendChild(s.parent,t)}_isSpecialElement(t,s){let a=this.treeAdapter.getNamespaceURI(t);return Rr[a].has(s)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){bu(this,t);return}switch(this.insertionMode){case u.INITIAL:{zt(this,t);break}case u.BEFORE_HTML:{jt(this,t);break}case u.BEFORE_HEAD:{Kt(this,t);break}case u.IN_HEAD:{Jt(this,t);break}case u.IN_HEAD_NO_SCRIPT:{Vt(this,t);break}case u.AFTER_HEAD:{Qt(this,t);break}case u.IN_BODY:case u.IN_CAPTION:case u.IN_CELL:case u.IN_TEMPLATE:{jr(this,t);break}case u.TEXT:case u.IN_SELECT:case u.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case u.IN_TABLE:case u.IN_TABLE_BODY:case u.IN_ROW:{Gn(this,t);break}case u.IN_TABLE_TEXT:{Zr(this,t);break}case u.IN_COLUMN_GROUP:{Bs(this,t);break}case u.AFTER_BODY:{Us(this,t);break}case u.AFTER_AFTER_BODY:{xs(this,t);break}default:}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Ou(this,t);return}switch(this.insertionMode){case u.INITIAL:{zt(this,t);break}case u.BEFORE_HTML:{jt(this,t);break}case u.BEFORE_HEAD:{Kt(this,t);break}case u.IN_HEAD:{Jt(this,t);break}case u.IN_HEAD_NO_SCRIPT:{Vt(this,t);break}case u.AFTER_HEAD:{Qt(this,t);break}case u.TEXT:{this._insertCharacters(t);break}case u.IN_TABLE:case u.IN_TABLE_BODY:case u.IN_ROW:{Gn(this,t);break}case u.IN_COLUMN_GROUP:{Bs(this,t);break}case u.AFTER_BODY:{Us(this,t);break}case u.AFTER_AFTER_BODY:{xs(this,t);break}default:}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){zn(this,t);return}switch(this.insertionMode){case u.INITIAL:case u.BEFORE_HTML:case u.BEFORE_HEAD:case u.IN_HEAD:case u.IN_HEAD_NO_SCRIPT:case u.AFTER_HEAD:case u.IN_BODY:case u.IN_TABLE:case u.IN_CAPTION:case u.IN_COLUMN_GROUP:case u.IN_TABLE_BODY:case u.IN_ROW:case u.IN_CELL:case u.IN_SELECT:case u.IN_SELECT_IN_TABLE:case u.IN_TEMPLATE:case u.IN_FRAMESET:case u.AFTER_FRAMESET:{zn(this,t);break}case u.IN_TABLE_TEXT:{Xt(this,t);break}case u.AFTER_BODY:{al(this,t);break}case u.AFTER_AFTER_BODY:case u.AFTER_AFTER_FRAMESET:{rl(this,t);break}default:}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case u.INITIAL:{il(this,t);break}case u.BEFORE_HEAD:case u.IN_HEAD:case u.IN_HEAD_NO_SCRIPT:case u.AFTER_HEAD:{this._err(t,d.misplacedDoctype);break}case u.IN_TABLE_TEXT:{Xt(this,t);break}default:}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,d.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?Lu(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case u.INITIAL:{zt(this,t);break}case u.BEFORE_HTML:{ol(this,t);break}case u.BEFORE_HEAD:{ll(this,t);break}case u.IN_HEAD:{De(this,t);break}case u.IN_HEAD_NO_SCRIPT:{El(this,t);break}case u.AFTER_HEAD:{dl(this,t);break}case u.IN_BODY:{le(this,t);break}case u.IN_TABLE:{Ct(this,t);break}case u.IN_TABLE_TEXT:{Xt(this,t);break}case u.IN_CAPTION:{uu(this,t);break}case u.IN_COLUMN_GROUP:{Jn(this,t);break}case u.IN_TABLE_BODY:{vs(this,t);break}case u.IN_ROW:{Hs(this,t);break}case u.IN_CELL:{Tu(this,t);break}case u.IN_SELECT:{ti(this,t);break}case u.IN_SELECT_IN_TABLE:{mu(this,t);break}case u.IN_TEMPLATE:{_u(this,t);break}case u.AFTER_BODY:{Au(this,t);break}case u.IN_FRAMESET:{Ru(this,t);break}case u.AFTER_FRAMESET:{gu(this,t);break}case u.AFTER_AFTER_BODY:{Iu(this,t);break}case u.AFTER_AFTER_FRAMESET:{Su(this,t);break}default:}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?Du(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case u.INITIAL:{zt(this,t);break}case u.BEFORE_HTML:{cl(this,t);break}case u.BEFORE_HEAD:{ul(this,t);break}case u.IN_HEAD:{hl(this,t);break}case u.IN_HEAD_NO_SCRIPT:{Tl(this,t);break}case u.AFTER_HEAD:{ml(this,t);break}case u.IN_BODY:{Fs(this,t);break}case u.TEXT:{eu(this,t);break}case u.IN_TABLE:{qt(this,t);break}case u.IN_TABLE_TEXT:{Xt(this,t);break}case u.IN_CAPTION:{hu(this,t);break}case u.IN_COLUMN_GROUP:{Eu(this,t);break}case u.IN_TABLE_BODY:{Xn(this,t);break}case u.IN_ROW:{ei(this,t);break}case u.IN_CELL:{du(this,t);break}case u.IN_SELECT:{si(this,t);break}case u.IN_SELECT_IN_TABLE:{fu(this,t);break}case u.IN_TEMPLATE:{pu(this,t);break}case u.AFTER_BODY:{ai(this,t);break}case u.IN_FRAMESET:{Nu(this,t);break}case u.AFTER_FRAMESET:{Cu(this,t);break}case u.AFTER_AFTER_BODY:{xs(this,t);break}default:}}onEof(t){switch(this.insertionMode){case u.INITIAL:{zt(this,t);break}case u.BEFORE_HTML:{jt(this,t);break}case u.BEFORE_HEAD:{Kt(this,t);break}case u.IN_HEAD:{Jt(this,t);break}case u.IN_HEAD_NO_SCRIPT:{Vt(this,t);break}case u.AFTER_HEAD:{Qt(this,t);break}case u.IN_BODY:case u.IN_TABLE:case u.IN_CAPTION:case u.IN_COLUMN_GROUP:case u.IN_TABLE_BODY:case u.IN_ROW:case u.IN_CELL:case u.IN_SELECT:case u.IN_SELECT_IN_TABLE:{Qr(this,t);break}case u.TEXT:{tu(this,t);break}case u.IN_TABLE_TEXT:{Xt(this,t);break}case u.IN_TEMPLATE:{ni(this,t);break}case u.AFTER_BODY:case u.IN_FRAMESET:case u.AFTER_FRAMESET:case u.AFTER_AFTER_BODY:case u.AFTER_AFTER_FRAMESET:{Kn(this,t);break}default:}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===o.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case u.IN_HEAD:case u.IN_HEAD_NO_SCRIPT:case u.AFTER_HEAD:case u.TEXT:case u.IN_COLUMN_GROUP:case u.IN_SELECT:case u.IN_SELECT_IN_TABLE:case u.IN_FRAMESET:case u.AFTER_FRAMESET:{this._insertCharacters(t);break}case u.IN_BODY:case u.IN_CAPTION:case u.IN_CELL:case u.IN_TEMPLATE:case u.AFTER_BODY:case u.AFTER_AFTER_BODY:case u.AFTER_AFTER_FRAMESET:{Xr(this,t);break}case u.IN_TABLE:case u.IN_TABLE_BODY:case u.IN_ROW:{Gn(this,t);break}case u.IN_TABLE_TEXT:{qr(this,t);break}default:}}};function Zc(e,t){let s=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return s?e.openElements.contains(s.element)?e.openElements.hasInScope(t.tagID)||(s=null):(e.activeFormattingElements.removeEntry(s),s=null):Vr(e,t),s}function $c(e,t){let s=null,a=e.openElements.stackTop;for(;a>=0;a--){let r=e.openElements.items[a];if(r===t.element)break;e._isSpecialElement(r,e.openElements.tagIDs[a])&&(s=r)}return s||(e.openElements.shortenToLength(Math.max(a,0)),e.activeFormattingElements.removeEntry(t)),s}function el(e,t,s){let a=t,r=e.openElements.getCommonAncestor(t);for(let c=0,h=r;h!==s;c++,h=r){r=e.openElements.getCommonAncestor(h);let _=e.activeFormattingElements.getElementEntry(h),m=_&&c>=Qc;!_||m?(m&&e.activeFormattingElements.removeEntry(_),e.openElements.remove(h)):(h=tl(e,_),a===t&&(e.activeFormattingElements.bookmark=_),e.treeAdapter.detachNode(a),e.treeAdapter.appendChild(h,a),a=h)}return a}function tl(e,t){let s=e.treeAdapter.getNamespaceURI(t.element),a=e.treeAdapter.createElement(t.token.tagName,s,t.token.attrs);return e.openElements.replace(t.element,a),t.element=a,a}function sl(e,t,s){let a=e.treeAdapter.getTagName(t),r=rt(a);if(e._isElementCausesFosterParenting(r))e._fosterParentElement(s);else{let c=e.treeAdapter.getNamespaceURI(t);r===n.TEMPLATE&&c===R.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,s)}}function nl(e,t,s){let a=e.treeAdapter.getNamespaceURI(s.element),{token:r}=s,c=e.treeAdapter.createElement(r.tagName,a,r.attrs);e._adoptNodes(t,c),e.treeAdapter.appendChild(t,c),e.activeFormattingElements.insertElementAfterBookmark(c,r),e.activeFormattingElements.removeEntry(s),e.openElements.remove(s.element),e.openElements.insertAfter(t,c,r.tagID)}function jn(e,t){for(let s=0;s<Vc;s++){let a=Zc(e,t);if(!a)break;let r=$c(e,a);if(!r)break;e.activeFormattingElements.bookmark=a;let c=el(e,r,a.element),h=e.openElements.getCommonAncestor(a.element);e.treeAdapter.detachNode(c),h&&sl(e,h,c),nl(e,r,a)}}function zn(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function al(e,t){e._appendCommentNode(t,e.openElements.items[0])}function rl(e,t){e._appendCommentNode(t,e.document)}function Kn(e,t){if(e.stopped=!0,t.location){let s=e.fragmentContext?0:2;for(let a=e.openElements.stackTop;a>=s;a--)e._setEndLocation(e.openElements.items[a],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let a=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(a);if(r&&!r.endTag&&(e._setEndLocation(a,t),e.openElements.stackTop>=1)){let c=e.openElements.items[1],h=e.treeAdapter.getNodeSourceCodeLocation(c);h&&!h.endTag&&e._setEndLocation(c,t)}}}}function il(e,t){e._setDocumentType(t);let s=t.forceQuirks?Te.QUIRKS:Br(t);xr(t)||e._err(t,d.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,s),e.insertionMode=u.BEFORE_HTML}function zt(e,t){e._err(t,d.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Te.QUIRKS),e.insertionMode=u.BEFORE_HTML,e._processToken(t)}function ol(e,t){t.tagID===n.HTML?(e._insertElement(t,R.HTML),e.insertionMode=u.BEFORE_HEAD):jt(e,t)}function cl(e,t){let s=t.tagID;(s===n.HTML||s===n.HEAD||s===n.BODY||s===n.BR)&&jt(e,t)}function jt(e,t){e._insertFakeRootElement(),e.insertionMode=u.BEFORE_HEAD,e._processToken(t)}function ll(e,t){switch(t.tagID){case n.HTML:{le(e,t);break}case n.HEAD:{e._insertElement(t,R.HTML),e.headElement=e.openElements.current,e.insertionMode=u.IN_HEAD;break}default:Kt(e,t)}}function ul(e,t){let s=t.tagID;s===n.HEAD||s===n.BODY||s===n.HTML||s===n.BR?Kt(e,t):e._err(t,d.endTagWithoutMatchingOpenElement)}function Kt(e,t){e._insertFakeElement(T.HEAD,n.HEAD),e.headElement=e.openElements.current,e.insertionMode=u.IN_HEAD,e._processToken(t)}function De(e,t){switch(t.tagID){case n.HTML:{le(e,t);break}case n.BASE:case n.BASEFONT:case n.BGSOUND:case n.LINK:case n.META:{e._appendElement(t,R.HTML),t.ackSelfClosing=!0;break}case n.TITLE:{e._switchToTextParsing(t,ce.RCDATA);break}case n.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,ce.RAWTEXT):(e._insertElement(t,R.HTML),e.insertionMode=u.IN_HEAD_NO_SCRIPT);break}case n.NOFRAMES:case n.STYLE:{e._switchToTextParsing(t,ce.RAWTEXT);break}case n.SCRIPT:{e._switchToTextParsing(t,ce.SCRIPT_DATA);break}case n.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=u.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(u.IN_TEMPLATE);break}case n.HEAD:{e._err(t,d.misplacedStartTagForHeadElement);break}default:Jt(e,t)}}function hl(e,t){switch(t.tagID){case n.HEAD:{e.openElements.pop(),e.insertionMode=u.AFTER_HEAD;break}case n.BODY:case n.BR:case n.HTML:{Jt(e,t);break}case n.TEMPLATE:{it(e,t);break}default:e._err(t,d.endTagWithoutMatchingOpenElement)}}function it(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==n.TEMPLATE&&e._err(t,d.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(n.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,d.endTagWithoutMatchingOpenElement)}function Jt(e,t){e.openElements.pop(),e.insertionMode=u.AFTER_HEAD,e._processToken(t)}function El(e,t){switch(t.tagID){case n.HTML:{le(e,t);break}case n.BASEFONT:case n.BGSOUND:case n.HEAD:case n.LINK:case n.META:case n.NOFRAMES:case n.STYLE:{De(e,t);break}case n.NOSCRIPT:{e._err(t,d.nestedNoscriptInHead);break}default:Vt(e,t)}}function Tl(e,t){switch(t.tagID){case n.NOSCRIPT:{e.openElements.pop(),e.insertionMode=u.IN_HEAD;break}case n.BR:{Vt(e,t);break}default:e._err(t,d.endTagWithoutMatchingOpenElement)}}function Vt(e,t){let s=t.type===x.EOF?d.openElementsLeftAfterEof:d.disallowedContentInNoscriptInHead;e._err(t,s),e.openElements.pop(),e.insertionMode=u.IN_HEAD,e._processToken(t)}function dl(e,t){switch(t.tagID){case n.HTML:{le(e,t);break}case n.BODY:{e._insertElement(t,R.HTML),e.framesetOk=!1,e.insertionMode=u.IN_BODY;break}case n.FRAMESET:{e._insertElement(t,R.HTML),e.insertionMode=u.IN_FRAMESET;break}case n.BASE:case n.BASEFONT:case n.BGSOUND:case n.LINK:case n.META:case n.NOFRAMES:case n.SCRIPT:case n.STYLE:case n.TEMPLATE:case n.TITLE:{e._err(t,d.abandonedHeadElementChild),e.openElements.push(e.headElement,n.HEAD),De(e,t),e.openElements.remove(e.headElement);break}case n.HEAD:{e._err(t,d.misplacedStartTagForHeadElement);break}default:Qt(e,t)}}function ml(e,t){switch(t.tagID){case n.BODY:case n.HTML:case n.BR:{Qt(e,t);break}case n.TEMPLATE:{it(e,t);break}default:e._err(t,d.endTagWithoutMatchingOpenElement)}}function Qt(e,t){e._insertFakeElement(T.BODY,n.BODY),e.insertionMode=u.IN_BODY,ks(e,t)}function ks(e,t){switch(t.type){case x.CHARACTER:{jr(e,t);break}case x.WHITESPACE_CHARACTER:{Xr(e,t);break}case x.COMMENT:{zn(e,t);break}case x.START_TAG:{le(e,t);break}case x.END_TAG:{Fs(e,t);break}case x.EOF:{Qr(e,t);break}default:}}function Xr(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function jr(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function fl(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function _l(e,t){let s=e.openElements.tryPeekProperlyNestedBodyElement();s&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(s,t.attrs))}function pl(e,t){let s=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&s&&(e.treeAdapter.detachNode(s),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,R.HTML),e.insertionMode=u.IN_FRAMESET)}function Al(e,t){e.openElements.hasInButtonScope(n.P)&&e._closePElement(),e._insertElement(t,R.HTML)}function Rl(e,t){e.openElements.hasInButtonScope(n.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&Yt.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,R.HTML)}function Nl(e,t){e.openElements.hasInButtonScope(n.P)&&e._closePElement(),e._insertElement(t,R.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function gl(e,t){let s=e.openElements.tmplCount>0;(!e.formElement||s)&&(e.openElements.hasInButtonScope(n.P)&&e._closePElement(),e._insertElement(t,R.HTML),s||(e.formElement=e.openElements.current))}function Cl(e,t){e.framesetOk=!1;let s=t.tagID;for(let a=e.openElements.stackTop;a>=0;a--){let r=e.openElements.tagIDs[a];if(s===n.LI&&r===n.LI||(s===n.DD||s===n.DT)&&(r===n.DD||r===n.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==n.ADDRESS&&r!==n.DIV&&r!==n.P&&e._isSpecialElement(e.openElements.items[a],r))break}e.openElements.hasInButtonScope(n.P)&&e._closePElement(),e._insertElement(t,R.HTML)}function Il(e,t){e.openElements.hasInButtonScope(n.P)&&e._closePElement(),e._insertElement(t,R.HTML),e.tokenizer.state=ce.PLAINTEXT}function Sl(e,t){e.openElements.hasInScope(n.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,R.HTML),e.framesetOk=!1}function Ol(e,t){let s=e.activeFormattingElements.getElementEntryInScopeWithTagName(T.A);s&&(jn(e,t),e.openElements.remove(s.element),e.activeFormattingElements.removeEntry(s)),e._reconstructActiveFormattingElements(),e._insertElement(t,R.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function bl(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,R.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Ll(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(n.NOBR)&&(jn(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,R.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Dl(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,R.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function Pl(e,t){e.treeAdapter.getDocumentMode(e.document)!==Te.QUIRKS&&e.openElements.hasInButtonScope(n.P)&&e._closePElement(),e._insertElement(t,R.HTML),e.framesetOk=!1,e.insertionMode=u.IN_TABLE}function Kr(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,R.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Jr(e){let t=Os(e,Ge.TYPE);return t!=null&&t.toLowerCase()===Jc}function Ml(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,R.HTML),Jr(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function wl(e,t){e._appendElement(t,R.HTML),t.ackSelfClosing=!0}function yl(e,t){e.openElements.hasInButtonScope(n.P)&&e._closePElement(),e._appendElement(t,R.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function xl(e,t){t.tagName=T.IMG,t.tagID=n.IMG,Kr(e,t)}function Bl(e,t){e._insertElement(t,R.HTML),e.skipNextNewLine=!0,e.tokenizer.state=ce.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=u.TEXT}function Ul(e,t){e.openElements.hasInButtonScope(n.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,ce.RAWTEXT)}function kl(e,t){e.framesetOk=!1,e._switchToTextParsing(t,ce.RAWTEXT)}function Wr(e,t){e._switchToTextParsing(t,ce.RAWTEXT)}function Fl(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,R.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===u.IN_TABLE||e.insertionMode===u.IN_CAPTION||e.insertionMode===u.IN_TABLE_BODY||e.insertionMode===u.IN_ROW||e.insertionMode===u.IN_CELL?u.IN_SELECT_IN_TABLE:u.IN_SELECT}function vl(e,t){e.openElements.currentTagId===n.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,R.HTML)}function Hl(e,t){e.openElements.hasInScope(n.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,R.HTML)}function Yl(e,t){e.openElements.hasInScope(n.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(n.RTC),e._insertElement(t,R.HTML)}function Wl(e,t){e._reconstructActiveFormattingElements(),Yn(t),ys(t),t.selfClosing?e._appendElement(t,R.MATHML):e._insertElement(t,R.MATHML),t.ackSelfClosing=!0}function Gl(e,t){e._reconstructActiveFormattingElements(),Wn(t),ys(t),t.selfClosing?e._appendElement(t,R.SVG):e._insertElement(t,R.SVG),t.ackSelfClosing=!0}function Gr(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,R.HTML)}function le(e,t){switch(t.tagID){case n.I:case n.S:case n.B:case n.U:case n.EM:case n.TT:case n.BIG:case n.CODE:case n.FONT:case n.SMALL:case n.STRIKE:case n.STRONG:{bl(e,t);break}case n.A:{Ol(e,t);break}case n.H1:case n.H2:case n.H3:case n.H4:case n.H5:case n.H6:{Rl(e,t);break}case n.P:case n.DL:case n.OL:case n.UL:case n.DIV:case n.DIR:case n.NAV:case n.MAIN:case n.MENU:case n.ASIDE:case n.CENTER:case n.FIGURE:case n.FOOTER:case n.HEADER:case n.HGROUP:case n.DIALOG:case n.DETAILS:case n.ADDRESS:case n.ARTICLE:case n.SEARCH:case n.SECTION:case n.SUMMARY:case n.FIELDSET:case n.BLOCKQUOTE:case n.FIGCAPTION:{Al(e,t);break}case n.LI:case n.DD:case n.DT:{Cl(e,t);break}case n.BR:case n.IMG:case n.WBR:case n.AREA:case n.EMBED:case n.KEYGEN:{Kr(e,t);break}case n.HR:{yl(e,t);break}case n.RB:case n.RTC:{Hl(e,t);break}case n.RT:case n.RP:{Yl(e,t);break}case n.PRE:case n.LISTING:{Nl(e,t);break}case n.XMP:{Ul(e,t);break}case n.SVG:{Gl(e,t);break}case n.HTML:{fl(e,t);break}case n.BASE:case n.LINK:case n.META:case n.STYLE:case n.TITLE:case n.SCRIPT:case n.BGSOUND:case n.BASEFONT:case n.TEMPLATE:{De(e,t);break}case n.BODY:{_l(e,t);break}case n.FORM:{gl(e,t);break}case n.NOBR:{Ll(e,t);break}case n.MATH:{Wl(e,t);break}case n.TABLE:{Pl(e,t);break}case n.INPUT:{Ml(e,t);break}case n.PARAM:case n.TRACK:case n.SOURCE:{wl(e,t);break}case n.IMAGE:{xl(e,t);break}case n.BUTTON:{Sl(e,t);break}case n.APPLET:case n.OBJECT:case n.MARQUEE:{Dl(e,t);break}case n.IFRAME:{kl(e,t);break}case n.SELECT:{Fl(e,t);break}case n.OPTION:case n.OPTGROUP:{vl(e,t);break}case n.NOEMBED:case n.NOFRAMES:{Wr(e,t);break}case n.FRAMESET:{pl(e,t);break}case n.TEXTAREA:{Bl(e,t);break}case n.NOSCRIPT:{e.options.scriptingEnabled?Wr(e,t):Gr(e,t);break}case n.PLAINTEXT:{Il(e,t);break}case n.COL:case n.TH:case n.TD:case n.TR:case n.HEAD:case n.FRAME:case n.TBODY:case n.TFOOT:case n.THEAD:case n.CAPTION:case n.COLGROUP:break;default:Gr(e,t)}}function zl(e,t){if(e.openElements.hasInScope(n.BODY)&&(e.insertionMode=u.AFTER_BODY,e.options.sourceCodeLocationInfo)){let s=e.openElements.tryPeekProperlyNestedBodyElement();s&&e._setEndLocation(s,t)}}function Xl(e,t){e.openElements.hasInScope(n.BODY)&&(e.insertionMode=u.AFTER_BODY,ai(e,t))}function jl(e,t){let s=t.tagID;e.openElements.hasInScope(s)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(s))}function Kl(e){let t=e.openElements.tmplCount>0,{formElement:s}=e;t||(e.formElement=null),(s||t)&&e.openElements.hasInScope(n.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(n.FORM):s&&e.openElements.remove(s))}function Jl(e){e.openElements.hasInButtonScope(n.P)||e._insertFakeElement(T.P,n.P),e._closePElement()}function Vl(e){e.openElements.hasInListItemScope(n.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(n.LI),e.openElements.popUntilTagNamePopped(n.LI))}function Ql(e,t){let s=t.tagID;e.openElements.hasInScope(s)&&(e.openElements.generateImpliedEndTagsWithExclusion(s),e.openElements.popUntilTagNamePopped(s))}function ql(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function Zl(e,t){let s=t.tagID;e.openElements.hasInScope(s)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(s),e.activeFormattingElements.clearToLastMarker())}function $l(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(T.BR,n.BR),e.openElements.pop(),e.framesetOk=!1}function Vr(e,t){let s=t.tagName,a=t.tagID;for(let r=e.openElements.stackTop;r>0;r--){let c=e.openElements.items[r],h=e.openElements.tagIDs[r];if(a===h&&(a!==n.UNKNOWN||e.treeAdapter.getTagName(c)===s)){e.openElements.generateImpliedEndTagsWithExclusion(a),e.openElements.stackTop>=r&&e.openElements.shortenToLength(r);break}if(e._isSpecialElement(c,h))break}}function Fs(e,t){switch(t.tagID){case n.A:case n.B:case n.I:case n.S:case n.U:case n.EM:case n.TT:case n.BIG:case n.CODE:case n.FONT:case n.NOBR:case n.SMALL:case n.STRIKE:case n.STRONG:{jn(e,t);break}case n.P:{Jl(e);break}case n.DL:case n.UL:case n.OL:case n.DIR:case n.DIV:case n.NAV:case n.PRE:case n.MAIN:case n.MENU:case n.ASIDE:case n.BUTTON:case n.CENTER:case n.FIGURE:case n.FOOTER:case n.HEADER:case n.HGROUP:case n.DIALOG:case n.ADDRESS:case n.ARTICLE:case n.DETAILS:case n.SEARCH:case n.SECTION:case n.SUMMARY:case n.LISTING:case n.FIELDSET:case n.BLOCKQUOTE:case n.FIGCAPTION:{jl(e,t);break}case n.LI:{Vl(e);break}case n.DD:case n.DT:{Ql(e,t);break}case n.H1:case n.H2:case n.H3:case n.H4:case n.H5:case n.H6:{ql(e);break}case n.BR:{$l(e);break}case n.BODY:{zl(e,t);break}case n.HTML:{Xl(e,t);break}case n.FORM:{Kl(e);break}case n.APPLET:case n.OBJECT:case n.MARQUEE:{Zl(e,t);break}case n.TEMPLATE:{it(e,t);break}default:Vr(e,t)}}function Qr(e,t){e.tmplInsertionModeStack.length>0?ni(e,t):Kn(e,t)}function eu(e,t){var s;t.tagID===n.SCRIPT&&((s=e.scriptHandler)===null||s===void 0||s.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function tu(e,t){e._err(t,d.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function Gn(e,t){if(e.openElements.currentTagId!==void 0&&zr.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=u.IN_TABLE_TEXT,t.type){case x.CHARACTER:{Zr(e,t);break}case x.WHITESPACE_CHARACTER:{qr(e,t);break}}else Zt(e,t)}function su(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,R.HTML),e.insertionMode=u.IN_CAPTION}function nu(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,R.HTML),e.insertionMode=u.IN_COLUMN_GROUP}function au(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(T.COLGROUP,n.COLGROUP),e.insertionMode=u.IN_COLUMN_GROUP,Jn(e,t)}function ru(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,R.HTML),e.insertionMode=u.IN_TABLE_BODY}function iu(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(T.TBODY,n.TBODY),e.insertionMode=u.IN_TABLE_BODY,vs(e,t)}function ou(e,t){e.openElements.hasInTableScope(n.TABLE)&&(e.openElements.popUntilTagNamePopped(n.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function cu(e,t){Jr(t)?e._appendElement(t,R.HTML):Zt(e,t),t.ackSelfClosing=!0}function lu(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,R.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Ct(e,t){switch(t.tagID){case n.TD:case n.TH:case n.TR:{iu(e,t);break}case n.STYLE:case n.SCRIPT:case n.TEMPLATE:{De(e,t);break}case n.COL:{au(e,t);break}case n.FORM:{lu(e,t);break}case n.TABLE:{ou(e,t);break}case n.TBODY:case n.TFOOT:case n.THEAD:{ru(e,t);break}case n.INPUT:{cu(e,t);break}case n.CAPTION:{su(e,t);break}case n.COLGROUP:{nu(e,t);break}default:Zt(e,t)}}function qt(e,t){switch(t.tagID){case n.TABLE:{e.openElements.hasInTableScope(n.TABLE)&&(e.openElements.popUntilTagNamePopped(n.TABLE),e._resetInsertionMode());break}case n.TEMPLATE:{it(e,t);break}case n.BODY:case n.CAPTION:case n.COL:case n.COLGROUP:case n.HTML:case n.TBODY:case n.TD:case n.TFOOT:case n.TH:case n.THEAD:case n.TR:break;default:Zt(e,t)}}function Zt(e,t){let s=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,ks(e,t),e.fosterParentingEnabled=s}function qr(e,t){e.pendingCharacterTokens.push(t)}function Zr(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function Xt(e,t){let s=0;if(e.hasNonWhitespacePendingCharacterToken)for(;s<e.pendingCharacterTokens.length;s++)Zt(e,e.pendingCharacterTokens[s]);else for(;s<e.pendingCharacterTokens.length;s++)e._insertCharacters(e.pendingCharacterTokens[s]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}var $r=new Set([n.CAPTION,n.COL,n.COLGROUP,n.TBODY,n.TD,n.TFOOT,n.TH,n.THEAD,n.TR]);function uu(e,t){let s=t.tagID;$r.has(s)?e.openElements.hasInTableScope(n.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=u.IN_TABLE,Ct(e,t)):le(e,t)}function hu(e,t){let s=t.tagID;switch(s){case n.CAPTION:case n.TABLE:{e.openElements.hasInTableScope(n.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=u.IN_TABLE,s===n.TABLE&&qt(e,t));break}case n.BODY:case n.COL:case n.COLGROUP:case n.HTML:case n.TBODY:case n.TD:case n.TFOOT:case n.TH:case n.THEAD:case n.TR:break;default:Fs(e,t)}}function Jn(e,t){switch(t.tagID){case n.HTML:{le(e,t);break}case n.COL:{e._appendElement(t,R.HTML),t.ackSelfClosing=!0;break}case n.TEMPLATE:{De(e,t);break}default:Bs(e,t)}}function Eu(e,t){switch(t.tagID){case n.COLGROUP:{e.openElements.currentTagId===n.COLGROUP&&(e.openElements.pop(),e.insertionMode=u.IN_TABLE);break}case n.TEMPLATE:{it(e,t);break}case n.COL:break;default:Bs(e,t)}}function Bs(e,t){e.openElements.currentTagId===n.COLGROUP&&(e.openElements.pop(),e.insertionMode=u.IN_TABLE,e._processToken(t))}function vs(e,t){switch(t.tagID){case n.TR:{e.openElements.clearBackToTableBodyContext(),e._insertElement(t,R.HTML),e.insertionMode=u.IN_ROW;break}case n.TH:case n.TD:{e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(T.TR,n.TR),e.insertionMode=u.IN_ROW,Hs(e,t);break}case n.CAPTION:case n.COL:case n.COLGROUP:case n.TBODY:case n.TFOOT:case n.THEAD:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=u.IN_TABLE,Ct(e,t));break}default:Ct(e,t)}}function Xn(e,t){let s=t.tagID;switch(t.tagID){case n.TBODY:case n.TFOOT:case n.THEAD:{e.openElements.hasInTableScope(s)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=u.IN_TABLE);break}case n.TABLE:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=u.IN_TABLE,qt(e,t));break}case n.BODY:case n.CAPTION:case n.COL:case n.COLGROUP:case n.HTML:case n.TD:case n.TH:case n.TR:break;default:qt(e,t)}}function Hs(e,t){switch(t.tagID){case n.TH:case n.TD:{e.openElements.clearBackToTableRowContext(),e._insertElement(t,R.HTML),e.insertionMode=u.IN_CELL,e.activeFormattingElements.insertMarker();break}case n.CAPTION:case n.COL:case n.COLGROUP:case n.TBODY:case n.TFOOT:case n.THEAD:case n.TR:{e.openElements.hasInTableScope(n.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=u.IN_TABLE_BODY,vs(e,t));break}default:Ct(e,t)}}function ei(e,t){switch(t.tagID){case n.TR:{e.openElements.hasInTableScope(n.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=u.IN_TABLE_BODY);break}case n.TABLE:{e.openElements.hasInTableScope(n.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=u.IN_TABLE_BODY,Xn(e,t));break}case n.TBODY:case n.TFOOT:case n.THEAD:{(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(n.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=u.IN_TABLE_BODY,Xn(e,t));break}case n.BODY:case n.CAPTION:case n.COL:case n.COLGROUP:case n.HTML:case n.TD:case n.TH:break;default:qt(e,t)}}function Tu(e,t){let s=t.tagID;$r.has(s)?(e.openElements.hasInTableScope(n.TD)||e.openElements.hasInTableScope(n.TH))&&(e._closeTableCell(),Hs(e,t)):le(e,t)}function du(e,t){let s=t.tagID;switch(s){case n.TD:case n.TH:{e.openElements.hasInTableScope(s)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(s),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=u.IN_ROW);break}case n.TABLE:case n.TBODY:case n.TFOOT:case n.THEAD:case n.TR:{e.openElements.hasInTableScope(s)&&(e._closeTableCell(),ei(e,t));break}case n.BODY:case n.CAPTION:case n.COL:case n.COLGROUP:case n.HTML:break;default:Fs(e,t)}}function ti(e,t){switch(t.tagID){case n.HTML:{le(e,t);break}case n.OPTION:{e.openElements.currentTagId===n.OPTION&&e.openElements.pop(),e._insertElement(t,R.HTML);break}case n.OPTGROUP:{e.openElements.currentTagId===n.OPTION&&e.openElements.pop(),e.openElements.currentTagId===n.OPTGROUP&&e.openElements.pop(),e._insertElement(t,R.HTML);break}case n.HR:{e.openElements.currentTagId===n.OPTION&&e.openElements.pop(),e.openElements.currentTagId===n.OPTGROUP&&e.openElements.pop(),e._appendElement(t,R.HTML),t.ackSelfClosing=!0;break}case n.INPUT:case n.KEYGEN:case n.TEXTAREA:case n.SELECT:{e.openElements.hasInSelectScope(n.SELECT)&&(e.openElements.popUntilTagNamePopped(n.SELECT),e._resetInsertionMode(),t.tagID!==n.SELECT&&e._processStartTag(t));break}case n.SCRIPT:case n.TEMPLATE:{De(e,t);break}default:}}function si(e,t){switch(t.tagID){case n.OPTGROUP:{e.openElements.stackTop>0&&e.openElements.currentTagId===n.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===n.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===n.OPTGROUP&&e.openElements.pop();break}case n.OPTION:{e.openElements.currentTagId===n.OPTION&&e.openElements.pop();break}case n.SELECT:{e.openElements.hasInSelectScope(n.SELECT)&&(e.openElements.popUntilTagNamePopped(n.SELECT),e._resetInsertionMode());break}case n.TEMPLATE:{it(e,t);break}default:}}function mu(e,t){let s=t.tagID;s===n.CAPTION||s===n.TABLE||s===n.TBODY||s===n.TFOOT||s===n.THEAD||s===n.TR||s===n.TD||s===n.TH?(e.openElements.popUntilTagNamePopped(n.SELECT),e._resetInsertionMode(),e._processStartTag(t)):ti(e,t)}function fu(e,t){let s=t.tagID;s===n.CAPTION||s===n.TABLE||s===n.TBODY||s===n.TFOOT||s===n.THEAD||s===n.TR||s===n.TD||s===n.TH?e.openElements.hasInTableScope(s)&&(e.openElements.popUntilTagNamePopped(n.SELECT),e._resetInsertionMode(),e.onEndTag(t)):si(e,t)}function _u(e,t){switch(t.tagID){case n.BASE:case n.BASEFONT:case n.BGSOUND:case n.LINK:case n.META:case n.NOFRAMES:case n.SCRIPT:case n.STYLE:case n.TEMPLATE:case n.TITLE:{De(e,t);break}case n.CAPTION:case n.COLGROUP:case n.TBODY:case n.TFOOT:case n.THEAD:{e.tmplInsertionModeStack[0]=u.IN_TABLE,e.insertionMode=u.IN_TABLE,Ct(e,t);break}case n.COL:{e.tmplInsertionModeStack[0]=u.IN_COLUMN_GROUP,e.insertionMode=u.IN_COLUMN_GROUP,Jn(e,t);break}case n.TR:{e.tmplInsertionModeStack[0]=u.IN_TABLE_BODY,e.insertionMode=u.IN_TABLE_BODY,vs(e,t);break}case n.TD:case n.TH:{e.tmplInsertionModeStack[0]=u.IN_ROW,e.insertionMode=u.IN_ROW,Hs(e,t);break}default:e.tmplInsertionModeStack[0]=u.IN_BODY,e.insertionMode=u.IN_BODY,le(e,t)}}function pu(e,t){t.tagID===n.TEMPLATE&&it(e,t)}function ni(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(n.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):Kn(e,t)}function Au(e,t){t.tagID===n.HTML?le(e,t):Us(e,t)}function ai(e,t){var s;if(t.tagID===n.HTML){if(e.fragmentContext||(e.insertionMode=u.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===n.HTML){e._setEndLocation(e.openElements.items[0],t);let a=e.openElements.items[1];a&&!(!((s=e.treeAdapter.getNodeSourceCodeLocation(a))===null||s===void 0)&&s.endTag)&&e._setEndLocation(a,t)}}else Us(e,t)}function Us(e,t){e.insertionMode=u.IN_BODY,ks(e,t)}function Ru(e,t){switch(t.tagID){case n.HTML:{le(e,t);break}case n.FRAMESET:{e._insertElement(t,R.HTML);break}case n.FRAME:{e._appendElement(t,R.HTML),t.ackSelfClosing=!0;break}case n.NOFRAMES:{De(e,t);break}default:}}function Nu(e,t){t.tagID===n.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==n.FRAMESET&&(e.insertionMode=u.AFTER_FRAMESET))}function gu(e,t){switch(t.tagID){case n.HTML:{le(e,t);break}case n.NOFRAMES:{De(e,t);break}default:}}function Cu(e,t){t.tagID===n.HTML&&(e.insertionMode=u.AFTER_AFTER_FRAMESET)}function Iu(e,t){t.tagID===n.HTML?le(e,t):xs(e,t)}function xs(e,t){e.insertionMode=u.IN_BODY,ks(e,t)}function Su(e,t){switch(t.tagID){case n.HTML:{le(e,t);break}case n.NOFRAMES:{De(e,t);break}default:}}function Ou(e,t){t.chars=Y,e._insertCharacters(t)}function bu(e,t){e._insertCharacters(t),e.framesetOk=!1}function ri(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==R.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function Lu(e,t){if(kr(t))ri(e),e._startTagOutsideForeignContent(t);else{let s=e._getAdjustedCurrentElement(),a=e.treeAdapter.getNamespaceURI(s);a===R.MATHML?Yn(t):a===R.SVG&&(Fr(t),Wn(t)),ys(t),t.selfClosing?e._appendElement(t,a):e._insertElement(t,a),t.ackSelfClosing=!0}}function Du(e,t){if(t.tagID===n.P||t.tagID===n.BR){ri(e),e._endTagOutsideForeignContent(t);return}for(let s=e.openElements.stackTop;s>0;s--){let a=e.openElements.items[s];if(e.treeAdapter.getNamespaceURI(a)===R.HTML){e._endTagOutsideForeignContent(t);break}let r=e.treeAdapter.getTagName(a);if(r.toLowerCase()===t.tagName){t.tagName=r,e.openElements.shortenToLength(s);break}}}function Pu(e){return e===34?"&quot;":e===38?"&amp;":e===39?"&apos;":e===60?"&lt;":e===62?"&gt;":"&nbsp;"}function ii(e,t){if(e.lastIndex=0,!e.test(t))return t;let s="",a=0;do{let r=e.lastIndex-1;a!==r&&(s+=t.substring(a,r));let c=t.charCodeAt(r);s+=Pu(c),a=r+1}while(e.test(t));return s+t.substring(a)}var Mu=/["&\u{A0}]/gu;function oi(e){return ii(Mu,e)}var wu=/[&<>\u{A0}]/gu;function ci(e){return ii(wu,e)}var yu=new Set([T.AREA,T.BASE,T.BASEFONT,T.BGSOUND,T.BR,T.COL,T.EMBED,T.FRAME,T.HR,T.IMG,T.INPUT,T.KEYGEN,T.LINK,T.META,T.PARAM,T.SOURCE,T.TRACK,T.WBR]);function li(e,t){return t.treeAdapter.isElementNode(e)&&t.treeAdapter.getNamespaceURI(e)===R.HTML&&yu.has(t.treeAdapter.getTagName(e))}var ui={treeAdapter:Ce,scriptingEnabled:!0};function Vn(e,t){let s={...ui,...t};return li(e,s)?"":hi(e,s)}function Qn(e,t){let s={...ui,...t};return Ei(e,s)}function hi(e,t){let s="",a=t.treeAdapter.isElementNode(e)&&t.treeAdapter.getTagName(e)===T.TEMPLATE&&t.treeAdapter.getNamespaceURI(e)===R.HTML?t.treeAdapter.getTemplateContent(e):e,r=t.treeAdapter.getChildNodes(a);if(r)for(let c of r)s+=Ei(c,t);return s}function Ei(e,t){return t.treeAdapter.isElementNode(e)?xu(e,t):t.treeAdapter.isTextNode(e)?Uu(e,t):t.treeAdapter.isCommentNode(e)?ku(e,t):t.treeAdapter.isDocumentTypeNode(e)?Fu(e,t):""}function xu(e,t){let s=t.treeAdapter.getTagName(e);return`<${s}${Bu(e,t)}>${li(e,t)?"":`${hi(e,t)}</${s}>`}`}function Bu(e,{treeAdapter:t}){let s="";for(let a of t.getAttrList(e)){if(s+=" ",a.namespace)switch(a.namespace){case R.XML:{s+=`xml:${a.name}`;break}case R.XMLNS:{a.name!=="xmlns"&&(s+="xmlns:"),s+=a.name;break}case R.XLINK:{s+=`xlink:${a.name}`;break}default:s+=`${a.prefix}:${a.name}`}else s+=a.name;s+=`="${oi(a.value)}"`}return s}function Uu(e,t){let{treeAdapter:s}=t,a=s.getTextNodeContent(e),r=s.getParentNode(e),c=r&&s.isElementNode(r)&&s.getTagName(r);return c&&s.getNamespaceURI(r)===R.HTML&&Nr(c,t.scriptingEnabled)?a:ci(a)}function ku(e,{treeAdapter:t}){return`<!--${t.getCommentNodeContent(e)}-->`}function Fu(e,{treeAdapter:t}){return`<!DOCTYPE ${t.getDocumentTypeNodeName(e)}>`}function Ti(e,t){return gt.parse(e,t)}function di(e,t,s){typeof e=="string"&&(s=t,t=e,e=null);let a=gt.getFragmentParser(e,s);return a.tokenizer.write(t,!0),a.getFragment()}var mi=["location","getElementsByTagName","getElementsByTagNameNS","getElementsByClassName","createElement","createElementNS","createDocumentFragment","createTextNode","createCDATASection","createComment","createProcessingInstruction","importNode","adoptNode","createAttribute","createAttributeNS","createEvent","createRange","createNodeIterator","createTreeWalker","getElementsByName","open","close","write","writeln","hasFocus","clear","captureEvents","releaseEvents","getSelection","getElementById","prepend","append","replaceChildren","querySelector","querySelectorAll","implementation","URL","documentURI","compatMode","characterSet","charset","inputEncoding","contentType","doctype","documentElement","referrer","cookie","lastModified","readyState","title","dir","body","head","images","embeds","plugins","links","forms","scripts","currentScript","defaultView","onreadystatechange","anchors","applets","styleSheets","hidden","visibilityState","onvisibilitychange","onabort","onauxclick","onbeforeinput","onbeforematch","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onpaste","onpause","onplay","onplaying","onprogress","onratechange","onreset","onresize","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","onvolumechange","onwaiting","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel","ontouchstart","ontouchend","ontouchmove","ontouchcancel","onpointerover","onpointerenter","onpointerdown","onpointermove","onpointerrawupdate","onpointerup","onpointercancel","onpointerout","onpointerleave","ongotpointercapture","onlostpointercapture","activeElement","children","firstElementChild","lastElementChild","childElementCount","createExpression","createNSResolver","evaluate","getRootNode","hasChildNodes","normalize","cloneNode","isEqualNode","isSameNode","compareDocumentPosition","contains","lookupPrefix","lookupNamespaceURI","isDefaultNamespace","insertBefore","appendChild","replaceChild","removeChild","nodeType","nodeName","baseURI","isConnected","ownerDocument","parentNode","parentElement","childNodes","firstChild","lastChild","previousSibling","nextSibling","nodeValue","textContent","ELEMENT_NODE","ATTRIBUTE_NODE","TEXT_NODE","CDATA_SECTION_NODE","ENTITY_REFERENCE_NODE","ENTITY_NODE","PROCESSING_INSTRUCTION_NODE","COMMENT_NODE","DOCUMENT_NODE","DOCUMENT_TYPE_NODE","DOCUMENT_FRAGMENT_NODE","NOTATION_NODE","DOCUMENT_POSITION_DISCONNECTED","DOCUMENT_POSITION_PRECEDING","DOCUMENT_POSITION_FOLLOWING","DOCUMENT_POSITION_CONTAINS","DOCUMENT_POSITION_CONTAINED_BY","DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC","addEventListener","removeEventListener","dispatchEvent"],fi=["submit","requestSubmit","reset","checkValidity","reportValidity","acceptCharset","action","enctype","method","name","noValidate","target","elements","length","click","attachInternals","focus","blur","title","lang","translate","dir","hidden","accessKey","draggable","offsetParent","offsetTop","offsetLeft","offsetWidth","offsetHeight","style","onabort","onauxclick","onbeforeinput","onbeforematch","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onpaste","onpause","onplay","onplaying","onprogress","onratechange","onreset","onresize","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","onvolumechange","onwaiting","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel","ontouchstart","ontouchend","ontouchmove","ontouchcancel","onpointerover","onpointerenter","onpointerdown","onpointermove","onpointerrawupdate","onpointerup","onpointercancel","onpointerout","onpointerleave","ongotpointercapture","onlostpointercapture","dataset","nonce","tabIndex","hasAttributes","getAttributeNames","getAttribute","getAttributeNS","setAttribute","setAttributeNS","removeAttribute","removeAttributeNS","toggleAttribute","hasAttribute","hasAttributeNS","getAttributeNode","getAttributeNodeNS","setAttributeNode","setAttributeNodeNS","removeAttributeNode","attachShadow","closest","matches","webkitMatchesSelector","getElementsByTagName","getElementsByTagNameNS","getElementsByClassName","insertAdjacentElement","insertAdjacentText","insertAdjacentHTML","getClientRects","getBoundingClientRect","before","after","replaceWith","remove","prepend","append","replaceChildren","querySelector","querySelectorAll","namespaceURI","prefix","localName","tagName","id","className","classList","slot","attributes","shadowRoot","outerHTML","scrollTop","scrollLeft","scrollWidth","scrollHeight","clientTop","clientLeft","clientWidth","clientHeight","innerHTML","role","ariaAtomic","ariaAutoComplete","ariaBusy","ariaChecked","ariaColCount","ariaColIndex","ariaColIndexText","ariaColSpan","ariaCurrent","ariaDescription","ariaDisabled","ariaExpanded","ariaHasPopup","ariaHidden","ariaInvalid","ariaKeyShortcuts","ariaLabel","ariaLevel","ariaLive","ariaModal","ariaMultiLine","ariaMultiSelectable","ariaOrientation","ariaPlaceholder","ariaPosInSet","ariaPressed","ariaReadOnly","ariaRequired","ariaRoleDescription","ariaRowCount","ariaRowIndex","ariaRowIndexText","ariaRowSpan","ariaSelected","ariaSetSize","ariaSort","ariaValueMax","ariaValueMin","ariaValueNow","ariaValueText","ariaRelevant","previousElementSibling","nextElementSibling","children","firstElementChild","lastElementChild","childElementCount","assignedSlot","getRootNode","hasChildNodes","normalize","cloneNode","isEqualNode","isSameNode","compareDocumentPosition","contains","lookupPrefix","lookupNamespaceURI","isDefaultNamespace","insertBefore","appendChild","replaceChild","removeChild","nodeType","nodeName","baseURI","isConnected","ownerDocument","parentNode","parentElement","childNodes","firstChild","lastChild","previousSibling","nextSibling","nodeValue","textContent","ELEMENT_NODE","ATTRIBUTE_NODE","TEXT_NODE","CDATA_SECTION_NODE","ENTITY_REFERENCE_NODE","ENTITY_NODE","PROCESSING_INSTRUCTION_NODE","COMMENT_NODE","DOCUMENT_NODE","DOCUMENT_TYPE_NODE","DOCUMENT_FRAGMENT_NODE","NOTATION_NODE","DOCUMENT_POSITION_DISCONNECTED","DOCUMENT_POSITION_PRECEDING","DOCUMENT_POSITION_FOLLOWING","DOCUMENT_POSITION_CONTAINS","DOCUMENT_POSITION_CONTAINED_BY","DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC","addEventListener","removeEventListener","dispatchEvent"];var ot=class extends Error{},qe="http://www.w3.org/XML/1998/namespace",It="http://www.w3.org/2000/xmlns/",_i=":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u{10000}-\\u{EFFFF}",es=new RegExp(`^[${_i}][${_i}\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`,"u"),Ys=/^(?:[\t\n\r -\uD7FF\uE000-\uFFFD]|[\uD800-\uDBFF][\uDC00-\uDFFF])*$/,qn=/^(?:[\t\n\r\u0020-\uD7FF\uE000-\uFFFD]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF]))*$/,vu=Object.assign(Object.create(null),{amp:"&",lt:"<",gt:">",quot:'"',apos:"'"}),B=e=>{throw new ot(e)};function $n(e,t,s,{fragment:a=!1,scope:r={}}={}){let c=e.replace(/\r\n?/g,`
4
+ `),h=c.length,_=Object.assign(Object.create(null),vu),m=[{node:s,qn:null,scope:Object.assign(Object.create(null),{xml:qe,xmlns:It},r)}],f=0,I=!1,w=!1,v=()=>m[m.length-1],C=O=>(/&(?!(?:#x[0-9a-fA-F]+|#[0-9]+|[A-Za-z_:][\w.:-]*);)/.test(O)&&B("malformed entity reference"),O.replace(/&(#x[0-9a-fA-F]+|#[0-9]+|[A-Za-z_:][\w.:-]*);/g,(S,P)=>{if(P[0]==="#"){let F=P[1]==="x"?parseInt(P.slice(2),16):parseInt(P.slice(1),10);return(F>1114111||!Ys.test(String.fromCodePoint(F)))&&B("malformed character entity"),String.fromCodePoint(F)}return Object.hasOwn(_,P)||B("unknown entity: &"+P+";"),_[P]}));for(;f<h;){if(c[f]!=="<"){let O=c.indexOf("<",f);O<0&&(O=h);let S=c.slice(f,O);if(S.includes("]]>")&&B("the string ]]> is not allowed in text"),m.length===1&&!a)/[^ \t\n\r]/.test(S)&&B("text data outside of root node");else{let P=C(S);qn.test(P)||B("disallowed character"),t.append(v().node,t.text(P))}f=O;continue}if(c.startsWith("<!--",f)){let O=c.indexOf("-->",f+4);O<0&&B("unterminated comment");let S=c.slice(f+4,O);(S.includes("--")||S.endsWith("-")||!qn.test(S))&&B("malformed comment"),t.append(v().node,t.comment(S)),f=O+3}else if(c.startsWith("<![CDATA[",f)){m.length===1&&!a&&B("cdata outside of root node");let O=c.indexOf("]]>",f);O<0&&B("unterminated CDATA"),t.append(v().node,t.cdata(c.slice(f+9,O))),f=O+3}else if(c.startsWith("<?",f)){let O=c.indexOf("?>",f);O<0&&B("unterminated processing instruction");let S=/^([^ \t\n\r?]+)(?:[ \t\n\r]+([\s\S]*))?$/.exec(c.slice(f+2,O));(!S||!es.test(S[1])||S[1].includes(":"))&&B("malformed processing instruction"),S[1].toLowerCase()==="xml"?(f!==0||a)&&B("xml declaration is only allowed at the start"):t.append(v().node,t.pi(S[1],S[2]||"")),f=O+2}else if(c.startsWith("<!DOCTYPE",f)||c.startsWith("<!doctype",f)){(a||m.length>1||I)&&B("doctype not allowed here");let O=f+9,S=0;for(;O<h;O++){let F=c[O];if(F==="[")S++;else if(F==="]")S--;else if(F===">"&&S<=0)break}O>=h&&B("unterminated doctype");let P=c.slice(f+9,O);for(let F of P.matchAll(/<!ENTITY[ \t\n\r]+([^ \t\n\r%]+)[ \t\n\r]+"([^"]*)"/g))Object.hasOwn(_,F[1])||(_[F[1]]=F[2]);t.append(s,t.doctype(P)),f=O+1}else if(c.startsWith("</",f)){let O=c.indexOf(">",f);O<0&&B("unterminated end tag");let S=c.slice(f+2,O).replace(/[ \t\n\r]+$/,"");(m.length===1||v().qn!==S)&&B("unexpected close tag: "+S),m.pop(),f=O+1,m.length===1&&!a&&(w=!0)}else{m.length===1&&!a&&(I||w)&&B("documents may contain only one root.");let O=/^<([^ \t\n\r/>=]+)/.exec(c.slice(f,f+4096))||B("malformed start tag"),S=O[1];(!es.test(S)||S.split(":").length>2||S.startsWith(":")||S.endsWith(":"))&&B("invalid element name: "+S);let P=f+O[0].length,F=[];for(;;){let M=/^[ \t\n\r]*/.exec(c.slice(P,P+4096))[0].length,H=c[P+M];if(H===">"||H==="/"||H===void 0){P+=M;break}M||B("attributes must be separated by whitespace");let D=/^([^ \t\n\r=/>]+)[ \t\n\r]*=[ \t\n\r]*("([^"]*)"|'([^']*)')/.exec(c.slice(P+M,P+M+1e6))||B("malformed attribute"),U=D[1],q=D[3]??D[4];(!es.test(U)||U.split(":").length>2)&&B("invalid attribute name: "+U),q.includes("<")&&B("< not allowed in attribute values"),F.some($=>$[0]===U)&&B("duplicate attribute: "+U);let V=C(q.replace(/[\t\n]/g," "));qn.test(V)||B("disallowed character"),F.push([U,V]),P+=M+D[0].length}let pe=c[P]==="/";pe&&(P++,c[P]!==">"&&B("malformed empty-element tag")),c[P]!==">"&&B("unterminated start tag"),P++;let re=Object.assign(Object.create(null),v().scope);for(let[M,H]of F)if(M==="xmlns")re[""]=H;else if(M.startsWith("xmlns:")){let D=M.slice(6);(D==="xmlns"||D==="xml"&&H!==qe||H===qe&&D!=="xml"||H===It)&&B("reserved namespace use"),H||B("cannot undeclare a prefix"),re[D]=H}let ue=S.indexOf(":"),se=ue<0?"":S.slice(0,ue),ve=ue<0?S:S.slice(ue+1);se&&!Object.hasOwn(re,se)&&B("unbound namespace prefix: "+se);let J=t.element(re[se]||null,se||null,ve),Se=new Set;for(let[M,H]of F){let D=M.indexOf(":"),U=D<0?"":M.slice(0,D),q=D<0?M:M.slice(D+1),V=null;M==="xmlns"||U==="xmlns"?V=It:U&&(Object.hasOwn(re,U)||B("unbound namespace prefix: "+U),V=re[U]);let $=V+"|"+q;Se.has($)&&B("duplicate attribute: "+M),Se.add($),t.attr(J,V,U||null,q,H)}t.append(v().node,J),pe?m.length===1&&!a&&(w=!0):m.push({node:J,qn:S,scope:re}),I=!0,f=P}}m.length>1&&B("unclosed tag: "+v().qn),!a&&!I&&B("document must contain a root element.")}var Hu=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),Zn="http://www.w3.org/1999/xhtml",$t=(e,t)=>{let s=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return t&&(s=s.replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;")),s},Qe=e=>{throw new ot("Failed to serialize XML: "+e)};function ea(e){let t=Object.assign(Object.create(null),{[qe]:["xml"]});return ta(e,null,t,{idx:1})}function ta(e,t,s,a){switch(e.nodeType){case 1:return Yu(e,t,s,a);case 9:case 11:{let r="";for(let c of e.childNodes)r+=ta(c,t,s,a);return r}case 3:return Ys.test(e.data)||Qe("text node data is not well-formed."),$t(e.data);case 4:return`<![CDATA[${e.data}]]>`;case 8:return(!Ys.test(e.data)||e.data.includes("--")||e.data.endsWith("-"))&&Qe("comment node data is not well-formed."),`<!--${e.data}-->`;case 7:return(e.target.includes(":")||e.target.toLowerCase()==="xml"||!Ys.test(e.data)||e.data.includes("?>"))&&Qe("processing instruction is not well-formed."),`<?${e.target} ${e.data}?>`;case 10:{let r=`<!DOCTYPE ${e.name}`;return e.publicId?r+=` PUBLIC "${e.publicId}"`:e.systemId&&(r+=" SYSTEM"),(e.systemId?r+` "${e.systemId}"`:r)+">"}default:return""}}function pi(e,t,s){let a=e[t];return a?a.includes(s)?s:a[a.length-1]:null}function Yu(e,t,s,a){(e.localName.includes(":")||!es.test(e.localName))&&Qe("element node localName is not a valid XML name.");let r=Object.assign(Object.create(null),s),c=Object.create(null),h=null,_=!1,m,f="<";for(let C of e.attributes)if(C.namespaceURI===It){if(C.prefix===null){h=C.value;continue}if(C.value===qe||r[C.value]?.includes(C.localName))continue;(r[C.value]||=[]).push(C.localName),c[C.localName]=C.value}let I=e.namespaceURI;if(t===I)h!==null&&(_=!0),m=I===qe?"xml:"+e.localName:e.localName,f+=m;else{let C=e.prefix,O=pi(r,I,C);C==="xmlns"&&Qe(`element nodes can't have a prefix of "xmlns".`),O!==null?(m=O+":"+e.localName,h!==null&&h!==qe&&(t=h===""?null:h),f+=m):C!==null?(C in c&&(C="ns"+a.idx++,r[I]=[C]),(r[I]||=[]).push(C),m=C+":"+e.localName,f+=`${m} xmlns:${C}="${$t(I??"",!0)}"`,h!==null&&(t=h===""?null:h)):h===null||h!==I?(_=!0,m=e.localName,t=I,f+=`${m} xmlns="${$t(I??"",!0)}"`):(m=e.localName,t=I,f+=m)}let w=new Set;for(let C of e.attributes){let O=C.namespaceURI+"|"+C.localName;w.has(O)&&Qe("duplicate attribute"),w.add(O);let S=null;if(C.namespaceURI!==null)if(S=pi(r,C.namespaceURI,C.prefix),C.namespaceURI===It){if(C.value===qe||C.prefix===null&&_||C.prefix!==null&&c[C.localName]!==C.value&&r[C.value]?.includes(C.localName))continue;(C.value===It||C.value==="")&&Qe("invalid namespace declaration"),C.prefix==="xmlns"&&(S="xmlns")}else S===null&&(S="ns"+a.idx++,r[C.namespaceURI]=[S],f+=` xmlns:${S}="${$t(C.namespaceURI,!0)}"`);(C.localName.includes(":")||!es.test(C.localName)||C.localName==="xmlns"&&C.namespaceURI===null)&&Qe("invalid attribute localName"),f+=` ${S!==null?S+":":""}${C.localName}="${$t(C.value,!0)}"`}let v=I===Zn&&e.localName==="template"?e.content.childNodes:e.childNodes;if(I===Zn&&!v.length&&Hu.has(e.localName))return f+" />";if(I!==Zn&&!v.length)return f+"/>";f+=">";for(let C of v)f+=ta(C,t,r,a);return f+`</${m}>`}var Re="http://www.w3.org/1999/xhtml",Wu="http://www.w3.org/2000/svg",gi="http://www.w3.org/2000/xmlns/",Ai=":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u{10000}-\\u{EFFFF}",Gu=new RegExp(`^[${Ai}][${Ai}\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`,"u"),Ks=e=>e.replace(/[A-Z]+/g,t=>t.toLowerCase()),zu=e=>e.replace(/[a-z]+/g,t=>t.toUpperCase());function Ne(e,t){let s=new Error(t);return s.name=e,s}function Ws(e){if(!Gu.test(e))throw Ne("InvalidCharacterError","invalid name: "+e)}var Xu={FILTER_ACCEPT:1,FILTER_REJECT:2,FILTER_SKIP:3,SHOW_ALL:4294967295,SHOW_ELEMENT:1,SHOW_ATTRIBUTE:2,SHOW_TEXT:4,SHOW_CDATA_SECTION:8,SHOW_ENTITY_REFERENCE:16,SHOW_ENTITY:32,SHOW_PROCESSING_INSTRUCTION:64,SHOW_COMMENT:128,SHOW_DOCUMENT:256,SHOW_DOCUMENT_TYPE:512,SHOW_DOCUMENT_FRAGMENT:1024,SHOW_NOTATION:2048},$e=class{constructor(t){this._doc=t,this._parent=null,this._prev=null,this._next=null,this._first=null,this._last=null,this._kids=null}get nodeType(){return this._t}get nodeName(){return this._n}get ownerDocument(){return this._doc}get parentNode(){return this._parent}get parentElement(){let t=this._parent;return t&&t.nodeType===1?t:null}get firstChild(){return this._first}get lastChild(){return this._last}get nextSibling(){return this._next}get previousSibling(){return this._prev}get nodeValue(){return null}get childNodes(){if(!this._kids){let t=[];for(let s=this._first;s;s=s._next)t.push(s);this._kids=t}return this._kids}get firstElementChild(){for(let t=this._first;t;t=t._next)if(t.nodeType===1)return t;return null}hasChildNodes(){return this._first!==null}contains(t){for(;t;t=t._parent)if(t===this)return!0;return!1}get isConnected(){let t=this;for(;t._parent;)t=t._parent;return t.nodeType===9}_link(t,s){t._parent=this,s===null?(t._prev=this._last,t._next=null,this._last?this._last._next=t:this._first=t,this._last=t):(t._next=s,t._prev=s._prev,s._prev?s._prev._next=t:this._first=t,s._prev=t),this._kids=null}_unlink(t){let s=t._doc,a=rs.size&&t.isConnected;if(s&&s._iters.length)for(let r of s._iters.slice())r._preRemove(t);t._prev?t._prev._next=t._next:this._first=t._next,t._next?t._next._prev=t._prev:this._last=t._prev,t._parent=null,t._prev=null,t._next=null,this._kids=null,a&&Ri(t,"disconnectedCallback")}_setDoc(t){let s=[this];for(;s.length;){let a=s.pop();a._doc=t,a._content&&(a._content._doc=t._inertDoc(),s.push(a._content));for(let r=a._first;r;r=r._next)s.push(r)}}insertBefore(t,s){if(s===void 0&&(s=null),s!==null&&s._parent!==this)throw Ne("NotFoundError","ref is not a child");if(t.nodeType===11){let r=t.childNodes.slice();for(let c of r)this.insertBefore(c,s);return t}if(t.contains(this))throw Ne("HierarchyRequestError","cycle");s===t&&(s=t._next),t._parent&&t._parent._unlink(t);let a=this.nodeType===9?this:this._doc;return t._doc!==a&&t._setDoc(a),this._link(t,s),rs.size&&this.isConnected&&Ri(t,"connectedCallback",!0),t}appendChild(t){return this.insertBefore(t,null)}removeChild(t){if(t._parent!==this)throw Ne("NotFoundError","not a child");return this._unlink(t),t}get textContent(){let t=[],s=[this];for(;s.length;){let a=s.pop();if(a.nodeType===3||a.nodeType===4)t.push(a.data);else if(a.nodeType===1||a.nodeType===11)for(let r=a._last;r;r=r._prev)s.push(r)}return t.join("")}set textContent(t){for(t=t==null?"":String(t);this._first;)this._unlink(this._first);t&&this.appendChild(this._doc.createTextNode(t))}normalize(){let t=[this];for(;t.length;){let s=t.pop();for(let a=s._first;a;){let r=a._next;if(a.nodeType===3)if(a.data==="")s._unlink(a);else{let c=a._prev;c&&c.nodeType===3&&(c.data+=a.data,s._unlink(a))}else a.nodeType===1&&t.push(a);a=r}}}cloneNode(t){return this._cloneInto(this._doc,!!t)}_cloneInto(t,s){let a=this._shallow(t);if(s){for(let r=this._first;r;r=r._next)a._link(r._cloneInto(t,!0),null);if(this._content)for(let r=this._content._first;r;r=r._next)a.content._link(r._cloneInto(a.content._doc,!0),null)}return a}},ts=class extends $e{constructor(t,s){super(t),this.data=s}remove(){this._parent&&this._parent._unlink(this)}get nodeValue(){return this.data}set nodeValue(t){this.data=String(t)}get textContent(){return this.data}set textContent(t){this.data=t==null?"":String(t)}get length(){return this.data.length}},ke=class e extends ts{_shallow(t){return new e(t,this.data)}},lt=class e extends ts{_shallow(t){return new e(t,this.data)}},bt=class e extends ke{_shallow(t){return new e(t,this.data)}},ss=class e extends ts{constructor(t,s,a){super(t,a),this.target=s,this._n=s}_shallow(t){return new e(t,this.target,this.data)}},ns=class e extends $e{constructor(t,s,a,r){super(t),this.name=s,this.publicId=a,this.systemId=r,this._n=s}_shallow(t){return new e(t,this.name,this.publicId,this.systemId)}};function ju(e){let t=String(e).split(",").map(s=>s.trim()).map(s=>{let a=/^(\*|[a-zA-Z][\w-]*)?((?:#[\w-]+|\[[\w:-]+\])*)$/.exec(s);if(!s||!a)throw Ne("SyntaxError","shim selector subset only: "+e);let r=a[1]&&a[1]!=="*"?a[1]:null,c=a[2].match(/#[\w-]+|\[[\w:-]+\]/g)||[];return h=>(!r||h.localName===r||h.namespaceURI===Re&&h._doc._html&&h.localName===Ks(r))&&c.every(_=>_[0]==="#"?h.getAttribute("id")===_.slice(1):h.hasAttribute(_.slice(1,-1)))});return s=>t.some(a=>a(s))}function ct(e,t,s){let a=ju(t),r=[],c=[];for(let h=e._last;h;h=h._prev)c.push(h);for(;c.length;){let h=c.pop();if(h.nodeType===1){if(a(h)&&(r.push(h),s))return r;for(let _=h._last;_;_=_._prev)c.push(_)}}return r}var Fe=class e extends $e{_shallow(t){return new e(t)}querySelectorAll(t){return ct(this,t)}querySelector(t){return ct(this,t,!0)[0]||null}append(...t){Si(this,t)}},Ci=function(){if(this._doc._html)return Vn(this,bi);try{return this.childNodes.map(e=>ea(e)).join("")}catch(e){throw Ne("InvalidStateError",e.message)}};function Ku(e,t){for(;e&&e.nodeType===1;e=e._parent){if((e.prefix||"")===(t||"")&&e.namespaceURI)return e.namespaceURI;for(let s of e._attrs)if(s.namespaceURI===gi&&(t?s.prefix==="xmlns"&&s.localName===t:s.prefix===null&&s.localName==="xmlns"))return s.value||null}return null}var Ii=function(e){let t=this.nodeType===11?this.host:this,s=this._content||this;St=s._doc,ra=!0;let a;try{if(s._doc._html)a=di(t,String(e),{treeAdapter:oa,scriptingEnabled:!1});else{a=new Fe(s._doc);let r={"":Ku(t,"")||void 0};for(let c=t;c&&c.nodeType===1;c=c._parent)for(let h of c._attrs)h.namespaceURI===gi&&h.prefix==="xmlns"&&!(h.localName in r)&&(r[h.localName]=h.value);r[""]===void 0&&delete r[""];try{$n(String(e),Li(s._doc),a,{fragment:!0,scope:r})}catch(c){throw c instanceof ot?Ne("SyntaxError",c.message):c}}}finally{ra=!1}for(;s._first;)s._unlink(s._first);for(;a._first;)s.appendChild(a._first)};function Si(e,t){for(let s of t)e.appendChild(typeof s=="string"?e._doc.createTextNode(s):s)}var sa=class extends Fe{constructor(t,s,a){super(t),this.host=s,this.mode=a}get innerHTML(){return Ci.call(this)}set innerHTML(t){Ii.call(this,t)}},Ze=class{constructor(t,s,a,r){this.localName=t,this.prefix=s||null,this.namespaceURI=a||null,this.value=r,this.ownerElement=null}get name(){return this.prefix?this.prefix+":"+this.localName:this.localName}get nodeName(){return this.name}},Lt=class extends $e{constructor(t,s,a){super(t),this.namespaceURI=s,this.localName=a,this.prefix=null,this._attrs=[],this._nsAttr=!1,this._n=s===Re&&t._html?zu(a):a}get tagName(){return this._n}get attributes(){return this._attrs}get shadowRoot(){return this._shadow&&this._shadow.mode==="open"?this._shadow:null}attachShadow({mode:t}){if(!(this.namespaceURI===Re&&(Vu.has(this.localName)||/^[a-z][^A-Z\s]*-[^A-Z\s]*$/.test(this.localName)&&!Qu.has(this.localName)))||this._shadow)throw Ne("NotSupportedError","cannot attach a shadow root here");return this._shadow=new sa(this._doc,this,t)}get id(){return this.getAttribute("id")??""}set id(t){this.setAttribute("id",t)}get className(){return this.getAttribute("class")??""}set className(t){this.setAttribute("class",t)}get classList(){let t=this,s=()=>(t.getAttribute("class")||"").split(/\s+/).filter(Boolean),a=r=>t.setAttribute("class",r.join(" "));return{add:(...r)=>a([...new Set([...s(),...r])]),remove:(...r)=>a(s().filter(c=>!r.includes(c))),contains:r=>s().includes(r),toggle(r){let c=s().includes(r);return c?this.remove(r):this.add(r),!c},get length(){return s().length},toString:()=>s().join(" ")}}remove(){if(this.nodeType!==1)throw new TypeError("Illegal invocation");this._parent&&this._parent._unlink(this)}getAttributeNames(){return this._attrs.map(t=>t.name)}append(...t){Si(this,t)}querySelector(t){return ct(this,t,!0)[0]||null}_norm(t){return this.namespaceURI===Re&&this._doc._html?Ks(t):t}_find(t){let s=this._attrs;for(let a=0;a<s.length;a++)if(s[a].name===t)return s[a];return null}_add(t){t.ownerElement=this,t.namespaceURI&&(this._nsAttr=!0),this._attrs.push(t)}getAttribute(t){let s=this._find(this._norm(String(t)));return s?s.value:null}getAttributeNode(t){return this._find(this._norm(String(t)))}hasAttribute(t){return this._find(this._norm(String(t)))!==null}hasAttributes(){return this._attrs.length>0}setAttribute(t,s){t=String(t),Ws(t),t=this._norm(t);let a=this._find(t);a?a.value=String(s):this._add(new Ze(t,null,null,String(s)))}setAttributeNS(t,s,a){s=String(s),Ws(s),t=t||null;let r=s.indexOf(":"),c=r<0?null:s.slice(0,r),h=r<0?s:s.slice(r+1);for(let _ of this._attrs)if(_.namespaceURI===t&&_.localName===h){_.value=String(a);return}this._add(new Ze(h,c,t,String(a)))}removeAttribute(t){let s=this._find(this._norm(String(t)));s&&this.removeAttributeNode(s)}removeAttributeNode(t){let s=this._attrs.indexOf(t);if(s<0)throw Ne("NotFoundError","attr not on element");return this._attrs.splice(s,1),t.ownerElement=null,t}querySelectorAll(t){return ct(this,t)}get innerHTML(){return Ci.call(this)}set innerHTML(t){Ii.call(this,t)}get outerHTML(){if(this._doc._html)return Qn(this,bi);try{return ea(this)}catch(t){throw Ne("InvalidStateError",t.message)}}_shallow(t){let s=Ot(t,this.namespaceURI,this.localName);for(let a of this._attrs)s._add(new Ze(a.localName,a.prefix,a.namespaceURI,a.value));return s._isValue=this._isValue,s}},Pe=class extends Lt{},as=class extends Pe{get content(){return this._content||(this._content=new Fe(this._doc._inertDoc()))}},Dt=class extends Pe{},Gs=class extends Pe{},zs=class extends Pe{},Xs=class extends Pe{},js=class extends Pe{};function is(e,...t){for(let s of t)Object.defineProperty(e.prototype,s,{get(){return this.getAttribute(s)??""},set(a){this.setAttribute(s,a)},configurable:!0})}is(Gs,"href","target","rel","download","hreflang","type");is(zs,"href","target","rel","download","alt");is(Xs,"href","target");is(js,"href","rel","type","media","hreflang");is(Dt,"target","action","method","name");var na=class extends Pe{get contentDocument(){return this.isConnected?this._frameDoc||(this._frameDoc=Ju()):null}},Ju=()=>new ze(!0);var Vu=new Set(["article","aside","blockquote","body","div","footer","h1","h2","h3","h4","h5","h6","header","main","nav","p","section","span"]),Qu=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]),rs=new Map;function Ri(e,t,s){let a=[e];for(;a.length;){let r=a.pop();if(r.nodeType!==1){for(let h=r._last;h;h=h._prev)a.push(h);continue}let c=r.namespaceURI===Re&&rs.get(r.localName);c&&(s&&!r._upgraded&&(Object.setPrototypeOf(r,c.prototype),r._upgraded=!0),r._upgraded&&typeof r[t]=="function"&&r[t]());for(let h=r._last;h;h=h._prev)a.push(h)}}var qu={define(e,t){rs.set(e,t)},get(e){return rs.get(e)}};function Ot(e,t,s){if(t===Re){switch(s){case"template":return new as(e,t,s);case"form":return new Dt(e,t,s);case"a":return new Gs(e,t,s);case"area":return new zs(e,t,s);case"base":return new Xs(e,t,s);case"link":return new js(e,t,s);case"iframe":return new na(e,t,s)}return new Pe(e,t,s)}return new Lt(e,t,s)}var aa=class{constructor(t,s,a){this.root=t,this.whatToShow=s>>>0,this.filter=a,this._ref=t,this._before=!0,t._doc._iters.push(this),this._d=t._doc}_next(t){if(t._first)return t._first;for(;t&&t!==this.root;t=t._parent)if(t._next)return t._next;return null}nextNode(){let t=this._ref,s=this._before;for(;;){if(s)s=!1;else if(t=this._next(t),!t)return this._done(),null;if(this.whatToShow&1<<t.nodeType-1){let a=!0;if(this.filter){let r=this.filter;a=(typeof r=="function"?r(t):r.acceptNode(t))===1}if(a)return this._ref=t,this._before=!1,t}}}_done(){let t=this._d._iters.indexOf(this);t>=0&&this._d._iters.splice(t,1)}detach(){this._done()}_preRemove(t){if(!(t===this.root||!t.contains(this._ref))){if(this._before){let s=t;for(;s&&s!==this.root&&!s._next;)s=s._parent;if(s&&s!==this.root){this._ref=s._next;return}this._before=!1}if(t._prev){let s=t._prev;for(;s._last;)s=s._last;this._ref=s}else this._ref=t._parent}}},ze=class e extends $e{constructor(t=!0,s=!1){super(null),this._html=t,this._iters=[],this._inert=s?this:null,this.documentURI="about:blank"}get ownerDocument(){return null}get currentScript(){return null}get implementation(){let t=this;return this._impl||(this._impl={createHTMLDocument(s){let a=new e(!0),r=a.createElement("html");a.appendChild(r);let c=a.createElement("head");if(r.appendChild(c),s!==void 0){let h=a.createElement("title");h.appendChild(a.createTextNode(String(s))),c.appendChild(h)}return r.appendChild(a.createElement("body")),a},createDocument(s,a){let r=new e(!1);return r._xhtml=s===Re,a&&r.appendChild(r.createElementNS(s,a)),r}})}_inertDoc(){return this._inert||(this._inert=new e(this._html,!0))}get documentElement(){for(let t=this._first;t;t=t._next)if(t.nodeType===1)return t;return null}get doctype(){for(let t=this._first;t;t=t._next)if(t.nodeType===10)return t;return null}get head(){return this._htmlChild("head")}get body(){return this._htmlChild("body")||this._htmlChild("frameset")}_htmlChild(t){let s=this.documentElement;if(!s||s.localName!=="html"||s.namespaceURI!==Re)return null;for(let a=s._first;a;a=a._next)if(a.nodeType===1&&a.localName===t&&a.namespaceURI===Re)return a;return null}createElement(t){return t=String(t),Ws(t),this._html?Ot(this,Re,Ks(t)):Ot(this,this._xhtml?Re:null,t)}createElementNS(t,s){s=String(s),Ws(s);let a=s.indexOf(":"),r=Ot(this,t||null,a<0?s:s.slice(a+1));return a>=0&&(r.prefix=s.slice(0,a),r._n=s),r}createTextNode(t){return new ke(this,String(t))}createCDATASection(t){if(this._html)throw Ne("NotSupportedError","HTML documents have no CDATA sections");return new bt(this,String(t))}createProcessingInstruction(t,s){return new ss(this,String(t),String(s))}createComment(t){return new lt(this,String(t))}createDocumentFragment(){return new Fe(this)}createNodeIterator(t,s=4294967295,a=null){return new aa(t,s,a)}importNode(t,s){if(t.nodeType===9)throw Ne("NotSupportedError","cannot import a document");return t._cloneInto(this,!!s)}getElementsByTagName(t){if(t=String(t),this._html&&(t==="html"||t==="body"||t==="head")){let s=this.documentElement;if(t==="html")return s&&s.localName==="html"?[s]:Ni(this,t);let a=this._htmlChild(t);if(a)return[a]}return Ni(this,t)}querySelectorAll(t){return ct(this,t)}querySelector(t){return ct(this,t,!0)[0]||null}getElementById(t){return ct(this,"*").find(s=>s.getAttribute("id")===t)||null}get textContent(){return null}set textContent(t){}};function Ni(e,t){let s=[],a=[],r=Ks(t);for(let c=e._last;c;c=c._prev)a.push(c);for(;a.length;){let c=a.pop();if(c.nodeType===1){(t==="*"||c.localName===t||c.namespaceURI===Re&&(e._html??e._doc._html)&&c.localName===r)&&s.push(c);for(let h=c._last;h;h=h._prev)a.push(h)}}return s}ke.prototype._t=3;ke.prototype._n="#text";lt.prototype._t=8;lt.prototype._n="#comment";bt.prototype._t=4;bt.prototype._n="#cdata-section";ss.prototype._t=7;ns.prototype._t=10;Fe.prototype._t=11;Fe.prototype._n="#document-fragment";Lt.prototype._t=1;ze.prototype._t=9;ze.prototype._n="#document";function Oi(e,t){for(let s of t)s in e||Object.defineProperty(e,s,{value:void 0,writable:!0,configurable:!0})}Oi(ze.prototype,mi);Oi(Dt.prototype,fi);var St=null,ra=!1,oa={createDocument(){let e=new ze(!0);return ra||(St=e),e},createDocumentFragment(){return new Fe(St)},createElement(e,t,s){let a=Ot(St,t,e);for(let r=0;r<s.length;r++){let c=s[r];a._add(new Ze(c.name,c.prefix,c.namespace,c.value)),c.name==="is"&&!c.namespace&&c.value&&(a._isValue=c.value)}return a},createCommentNode(e){return new lt(St,e)},createTextNode(e){return new ke(St,e)},appendChild(e,t){e.insertBefore(t,null)},insertBefore(e,t,s){e.insertBefore(t,s)},setTemplateContent(e,t){t._doc=e._doc._inertDoc(),e._content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,s,a){for(let r=e._first;r;r=r._next)if(r.nodeType===10){r.name=r._n=t,r.publicId=s,r.systemId=a;return}e.insertBefore(new ns(e,t,s,a),e._first)},setDocumentMode(e,t){e._mode=t},getDocumentMode(e){return e._mode},detachNode(e){e._parent&&e._parent._unlink(e)},insertText(e,t){let s=e._last;s&&s.nodeType===3?s.data+=t:e.insertBefore(new ke(e.nodeType===9?e:e._doc,t),null)},insertTextBefore(e,t,s){let a=s._prev;a&&a.nodeType===3?a.data+=t:e.insertBefore(new ke(e._doc,t),s)},adoptAttributes(e,t){for(let s of t){let a=s.prefix?s.prefix+":"+s.name:s.name;e._find(a)||e._add(new Ze(s.name,s.prefix,s.namespace,s.value))}},getFirstChild:e=>e._first,getChildNodes:e=>e.childNodes,getParentNode:e=>e._parent,getAttrList:e=>e._isValue!=null&&!e._find("is")?[{name:"is",value:e._isValue},...e._nsAttr?e._attrs.map(t=>({name:t.localName,namespace:t.namespaceURI||void 0,prefix:t.prefix||void 0,value:t.value})):e._attrs]:e._nsAttr?e._attrs.map(t=>({name:t.localName,namespace:t.namespaceURI||void 0,prefix:t.prefix||void 0,value:t.value})):e._attrs,getTagName:e=>e.localName,getNamespaceURI:e=>e.namespaceURI,getTextNodeContent:e=>e.data,getCommentNodeContent:e=>e.data,getDocumentTypeNodeName:e=>e.name,getDocumentTypeNodePublicId:e=>e.publicId,getDocumentTypeNodeSystemId:e=>e.systemId,isTextNode:e=>e.nodeType===3,isCommentNode:e=>e.nodeType===8,isDocumentTypeNode:e=>e.nodeType===10,isElementNode:e=>e.nodeType===1,setNodeSourceCodeLocation(){},getNodeSourceCodeLocation(){return null},updateNodeSourceCodeLocation(){}},bi={treeAdapter:oa};function Li(e){return{element:(t,s,a)=>{let r=Ot(e,t,a);return s&&(r.prefix=s,r._n=s+":"+a),r},attr:(t,s,a,r,c)=>t._add(new Ze(r,a,s,c)),text:t=>new ke(e,t),cdata:t=>new bt(e,t),comment:t=>new lt(e,t),pi:(t,s)=>new ss(e,t,s),doctype:t=>{let s=/^\s*([^\s>\[]+)(?:\s+PUBLIC\s+"([^"]*)"\s+"([^"]*)"|\s+SYSTEM\s+"([^"]*)")?/i.exec(t);return new ns(e,s?s[1]:"html",s&&s[2]||"",s&&(s[3]||s[4])||"")},append:(t,s)=>(t instanceof as?t.content:t).appendChild(s)}}var Zu={"application/xhtml+xml":Re,"application/xml":null,"text/xml":null,"image/svg+xml":Wu},ia=class{parseFromString(t,s){if(s==="text/html")return Ti(String(t),{treeAdapter:oa,scriptingEnabled:!1});if(!(s in Zu))throw Ne("TypeError","unsupported parser type "+s);let a=new ze(!1);a._xhtml=s==="application/xhtml+xml";try{$n(String(t),Li(a),a)}catch(r){if(!(r instanceof ot))throw r;for(;a._first;)a._unlink(a._first);let c=a.createElementNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror");c.appendChild(a.createTextNode(r.message)),a.appendChild(c)}return a}};function Di(){return{document:new ze(!0),Node:$e,Element:Lt,HTMLElement:Pe,DocumentFragment:Fe,HTMLTemplateElement:as,HTMLFormElement:Dt,NodeFilter:Xu,DOMParser:ia,customElements:qu}}var $u=Di();function ca(e=$u){return hr(e)}var SE=ca();var Js=ca();var Pi=/&amp;/gi,Mi=/&(?=[#a-z0-9])(?![a-z0-9]+=)/i;var wi=/#$/,yi=/^(?:application\/(?:[\w.-]+\+)?xml|image\/svg\+xml|text\/(?:html|xml))(?:\s*;\s*|$)/i;var xi=/\P{ASCII}/u,Bi=/&#(x0*[\dA-F]{1,2}|0*\d{1,3});?/gi,Ui=/(?:%[\dA-F]{2})+/gi,ki=/^((?:[^#%]|%(?!23))*)\?$/,Vs=/^[a-z][\da-z+.-]*$/,Fi=/^(?:web\+[a-z]+|ext\+[a-z][\da-z.-]*)$/,ut=/^(?:java|vb)script$/i,os=/^(?:(?:java|vb)script|blob)$/i,Qs=/["'<>]|%(?:22|27|3C|3E)|&(?:apos|lt|gt|quot|#0*(?:34|39|60|62)|#x0*(?:22|27|3C|3E));/i,vi=/^%[\dA-F]{2}$/i,Hi=/^(?:\/{2,}|\\|[a-z][a-z\d+\-.]*:[^/])/i;var Yi=[9,10,13,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255];var la=new Set(Yi),ua=new Map([[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),th=()=>{let e=new Map;for(let t=0;t<256;t++)!la.has(t)&&!ua.has(t)&&e.set(t,`\\x${t.toString(16).padStart(2,"0").toUpperCase()}`);return e},ha=th();var[Pt,nh,ah,rh,ih,oh]=["&","#","<",">",'"',"'"].map(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),ch={[Pt]:`${Pt}amp;`,[ah]:`${Pt}lt;`,[rh]:`${Pt}gt;`,[ih]:`${Pt}quot;`,[oh]:`${Pt}${nh}39;`},FE=Array.from({length:256},(e,t)=>`%${t.toString(16).padStart(2,"0").toUpperCase()}`),ji=globalThis.process?.versions?.node!==void 0,Ki=`[${[...ha.values()].join("")}]`,lh=new RegExp(Ki),uh=new RegExp(Ki,"g"),hh=new Uint8Array(65536),vE=new TextEncoder,Eh=new TextDecoder("utf-8",{fatal:!0}),de=(e,t=!1)=>{if(!G(e))return null;let s=xi.test(e)?e.normalize("NFKC"):e;return t?s.trim().toLowerCase().replace(/:$/,""):s},Ie=(e,t,s=!1)=>{if(!G(e)||e==="")return null;let a=e,r=t&&G(t)?t:"";if(s&&(a=de(a),r&&(r=de(r))),typeof URL.parse=="function")return r?URL.parse(a,r):URL.parse(a);try{return r?new URL(a,r):new URL(a)}catch{return null}},Ji=e=>G(e)?e.replace(/:$/,"").split("+"):[];var Vi=e=>{if(!G(e))return e;let t=vi.test(e)?e.toUpperCase():e;return ch[t]??e},Me=e=>{let t=G(e)?e:String(e);return t.length>64?`${t.slice(0,64)}...`:t},Qi=e=>G(e)?e.replace(wi,"").replace(ki,"$1"):e,Th=(e,t)=>{let s=/^x/i.test(t)?Number.parseInt(t.slice(1),16):Number.parseInt(t,10);if(!Number.isInteger(s)||s<0||s>=256)return e;if(ha.has(s))return"";if(la.has(s))return String.fromCharCode(s);let a=ua.get(s);return String.fromCodePoint(a)},qi=(e,t=0)=>{if(!G(e))throw new TypeError(`Expected String but got ${At(e)}.`);if(!Number.isInteger(t))throw new TypeError(`Expected Number but got ${At(t)}.`);let s;try{s=decodeURIComponent(e)}catch{s=e.replace(Ui,r=>{try{return decodeURIComponent(r)}catch{return r}})}s=s.replace(uh,"");let a=0;for(;a+t<16;a++){let r=s;if(s=s.replace(Pi,"&").replace(Bi,Th),s===r)break}if(a+t>=16&&/&#/.test(s))throw new Error("Character references nested too deeply.");return s},$s=(e,t="",s="")=>{if(!G(e))return{mediaType:"",mediaTypes:[],data:"",isBase64:!1};let a=e.indexOf(",");if(a===-1)return{mediaType:e,mediaTypes:e.split(";"),data:"",isBase64:!1};let r=e.substring(0,a),c=e.substring(a+1),h=t===""&&s===""?c:c+t+s,_=r.split(";"),m=_.at(-1),f=m!==void 0&&m.length===6&&m.toLowerCase()==="base64";return{mediaType:r,mediaTypes:_,data:h,isBase64:f}},Zi=e=>{if(!G(e))throw new TypeError(`Expected String but got ${At(e)}.`);let t,s=e;try{t=atob(e)}catch{s=e.replace(/\s/g,"");try{t=atob(s)}catch{throw new Error(`Invalid base64 data: ${Me(e)}`)}}let a;if(ji&&globalThis.Buffer)a=globalThis.Buffer.from(t,"latin1");else{let r=t.length;r>65536?a=new Uint8Array(r):a=hh.subarray(0,r);for(let c=0;c<r;c++)a[c]=t.charCodeAt(c)}try{let r=Eh.decode(a);return lh.test(r)?s:r}catch{return s}},en=e=>{if(ji&&globalThis.Buffer)return globalThis.Buffer.from(e).toString("base64");let t=new Uint8Array(e);if(typeof t.toBase64=="function")return t.toBase64();let s=[];for(let a=0;a<t.length;a+=8192)s.push(String.fromCharCode(...t.subarray(a,a+8192)));return btoa(s.join(""))},dh=async(e,t,s)=>{let a=e.body.getReader(),r=[],c="Operation aborted";if(s?.aborted)throw await a.cancel(c),a.releaseLock(),s.reason;let h=()=>{a.cancel(c).catch(()=>{})};s?.addEventListener("abort",h,{once:!0});try{let _=0;for(;_<=t;){if(s?.aborted)throw await a.cancel(c),s.reason;let{done:I,value:w}=await a.read();if(s?.aborted)throw s.reason;if(I)break;if(_+=w.byteLength,_>t)throw await a.cancel("Size limit exceeded"),new DOMException(`Payload (${_} bytes) exceeds max (${t} bytes).`,"NotReadableError");r.push(w)}let m=new Uint8Array(_),f=0;for(let I of r)m.set(I,f),f+=I.byteLength;return m.buffer}finally{s?.removeEventListener("abort",h),a.releaseLock()}},Ea=async(e,t,s)=>{let a=16777216;Number.isInteger(t)&&t>0&&(a=t);let r=await fetch(e,{signal:s});if(!r.ok){let f=`Failed to fetch ${Me(e)}`;throw Number.isInteger(r.status)&&(r.statusText?f+=`: ${r.status} ${r.statusText}`:f+=`: ${r.status}`),new Error(f)}let c=r.headers.get("content-length");if(c){let m=Number.parseInt(c,10);if(Number.isInteger(m)&&m>a)throw new DOMException(`Payload (${m} bytes) exceeds max (${a} bytes).`,"NotReadableError")}let h=r.headers.get("content-type")||"",_;if(r.body)_=await dh(r,a,s);else{let m=await r.blob();if(m.size>a)throw new DOMException(`Payload (${m.size} bytes) exceeds max (${a} bytes).`,"NotReadableError");_=await m.arrayBuffer()}return{buffer:_,mimeType:h}};var Mt=class{constructor(t,s=Ut){this.domPurify=t??null,this.nest=0,this.recurse=new Set,this.restrictScheme=!1,this.schemeMap=new Map([["blob",!1],["data",!1],["file",!1],["javascript",!1],["vbscript",!1]]),this.#e(s)}#e(t){let{allowRelative:s,debug:a,allow:r,deny:c,only:h,schemes:_}=t;if(this.allowRelative=!!s,this.debug=!!a,this.schemes=_,Array.isArray(h)){this.restrictScheme=!0;for(let m of h)this.#t(m)}else{if(Array.isArray(r)&&r.length)for(let m of r)this.#t(m);if(Array.isArray(c)&&c.length)for(let m of c){let f=de(m,!0);f&&this.schemeMap.set(f,!1)}}}#t(t){let s=de(t,!0);return!s||os.test(s)||!Vs.test(s)||s.includes("+")&&s.split("+").some(r=>ut.test(r))?!1:(this.schemeMap.set(s,!0),!0)}enter(t){return this.recurse.has(t)?(this.debug&&Be(`Circular Data URL detected and skipped: ${Me(t)}`),!1):(this.nest++,this.recurse.add(t),!0)}leave(t){this.nest--,this.recurse.delete(t)}},tn=class{#e;constructor(t=Ut){this.#e=t}#t(t,s){if(s.nest>16)throw new Error("Data URLs nested too deeply.");let a=Ie(t,null,!0);if(!a){if(s.allowRelative&&!Hi.test(t)){let c=Ie(t,Ln);if(c){let{protocol:h,hostname:_,pathname:m,search:f,hash:I}=c;if(h==="http:"&&_==="dummy.local")return this.#r(`${m}${f}${I}`)}}return null}let r=de(a.protocol,!0);if(s.restrictScheme&&!s.schemeMap.has(r))return null;if(r.includes("+")){let c=r.split("+");if(s.schemeMap.get(r)===!1||c.some(h=>s.schemeMap.get(h)===!1))return null}else if(s.schemeMap.has(r)){if(s.schemeMap.get(r)===!1)return null}else if(!s.schemes.has(r))return null;return r==="data"?this.#s(a,s):this.#r(a.href)}#s(t,s){let{mediaType:a,mediaTypes:r,data:c,isBase64:h}=$s(t.pathname,t.search,t.hash),_=c;if(h)try{_=Zi(c)}catch(m){return s.debug&&Be("Failed to parse base64 data.",m),null}try{let m=qi(_).trim(),f=Ie(m,Ln);if(!f||Ji(f.protocol).some(w=>os.test(w)))return null}catch(m){return s.debug&&Be("Failed to parse inner data URL protocol.",m),null}return(!a||yi.test(a))&&(_=this.#o(_,s)),_?(h&&_!==c&&r.pop(),`data:${r.join(";")},${_}`):null}#o(t,s){let a="";try{a=decodeURIComponent(t)}catch{a=t}let r=(h,_)=>this.#a(h,_,s),c="";try{s.domPurify.addHook("uponSanitizeAttribute",r),c=s.domPurify.sanitize(a)}finally{s.domPurify.removeHook("uponSanitizeAttribute",r)}return c?encodeURI(Qi(c)):null}#a(t,s,a){if(!s.attrValue||!/^\s*data:/i.test(s.attrValue))return;let r=Ie(s.attrValue,null,!0);if(!r||r.protocol!=="data:")return;let c=s.attrValue;if(!a.enter(c)){s.attrValue="";return}try{let h=this.#t(c,a);s.attrValue=h||""}finally{a.leave(c)}}#r(t){let s=t.length,a=s,r=Qs.exec(t);if(r&&(a=r.index),t.indexOf("&")>-1){let h=Mi.exec(t);if(h){let _=h.index;_<a&&(a=_)}}if(a===s)return t;let c=t.charCodeAt(a-1);return(c===63||c===38)&&a--,t.substring(0,a)}#i(t,s){if(Number.isInteger(s)&&t.length>s)throw new RangeError(`URL length ${t.length} exceeds max length ${s}.`)}#n(t){let{deny:s,only:a,allowRelative:r}=t;return Array.isArray(s)&&s.length>0||Array.isArray(a)||!!r}#c(t,s){let a=Ie(t,null,!0);return a&&s.schemes.has(a.protocol.replace(/:$/,""))?a.href.replace(/%26/g,Vi):null}async sanitizeBuffer(t,s,a=this.#e){if(!(t instanceof ArrayBuffer))return null;let r=en(t),h=`data:${s?`${s};base64`:"base64"},${r}`;if(Number.isInteger(a.maxLength)&&h.length>a.maxLength)throw new RangeError(`URL length ${h.length} exceeds max length ${a.maxLength}.`);let _=new Mt(Js,a);if(!_.schemeMap.get("data"))return null;let m=Ie(h);return m?this.#s(m,_):null}async sanitizeDataURL(t,s=this.#e){if(!t||!G(t))return null;let{maxLength:a}=s;if(Number.isInteger(a)&&t.length>a)throw new RangeError(`URL length ${t.length} exceeds max length ${a}.`);let r=Ie(t);if(!r)return null;let c=de(r.protocol,!0);if(c!=="data")return null;let h=new Mt(Js,s);return h.schemeMap.get(c)?this.#s(r,h):null}async sanitizeURL(t,s,a=this.#e){if(!t||!G(t))return null;if(this.#i(t,a.maxLength),/^https?$/.test(s)&&!Qs.test(t)&&!this.#n(a)&&!t.includes("data:"))return this.#c(t,a);let r=new Mt(Js,a);return this.#t(t,r)}sanitizeURLSync(t,s,a=this.#e){if(!t||!G(t)||s==="data")return null;if(this.#i(t,a.maxLength),/^https?$/.test(s)&&!Qs.test(t)&&!this.#n(a))return this.#c(t,a);let r=new Mt(null,a);return this.#t(t,r)}};var $i=["aaa","aaas","about","acap","acct","acd","ace","aceap","acedp","aceep","acelp","aceup","acr","adiumxtra","adt","aet","afp","afs","agtp","aim","alter","amss","android","appdata","apt","ar","ari","ark","ars","arv","at","attachment","aw","barion","beshare","bitcoin","bitcoincash","bl","blob","bluetooth","bolo","brid","browserext","cabal","caip","calculator","callto","canactid","cap","cast","casts","chrome","chrome-extension","cid","cm","coap","coaps","com-eventbrite-attendee","content","content-type","crid","cstr","cttps","cvs","dab","dat","data","dav","dhttp","diaspora","dict","did","dilithium3","dis","dlna-playcontainer","dlna-playsingle","dnp","dns","dntp","doi","donau","dpp","drm","dtmi","dtn","dvb","dvx","dweb","ed2k","eid","elsi","embedded","ens","esim","ethereum","example","ez","facetime","feed","feedready","fido","file","finger","first-run-pen-experience","fish","fm","ftp","fuchsia-pkg","gcx","gdsi","geo","gg","git","gitoid","gizmoproject","go","gopher","graph","gsos","gtalk","h323","haie","ham","hcap","hcp","hs20","http","https","hxxp","hxxps","hydrazone","hyper","i0","iax","ibi","ibi-","icap","icon","ilstring","im","imap","info","interaction","iotdisco","ipfs","ipn","ipns","ipp","ipps","iqa","irc","irc6","ircs","iris","iris.beep","iris.lwz","iris.xpc","iris.xpcs","isostore","itms","jabber","jar","jms","keyparc","lastfm","lbry","ldap","ldaps","leaptofrogans","lid","linkid","locus","lorawan","lpa","lvlt","machineProvisioningProgressReporter","magnet","mailto","maps","market","matrix","mdoc","mdoc-openid4vp","message","microsoft.windows.camera","microsoft.windows.camera.multipicker","microsoft.windows.camera.picker","mid","mms","mongodb","moz","moz-extension","mqtt","mqtts","ms-access","ms-appinstaller","ms-browser-extension","ms-calculator","ms-drive-to","ms-enrollment","ms-excel","ms-eyecontrolspeech","ms-gamebarservices","ms-gamingoverlay","ms-getoffice","ms-help","ms-infopath","ms-inputapp","ms-launchremotedesktop","ms-lockscreencomponent-config","ms-media-stream-id","ms-meetnow","ms-mixedrealitycapture","ms-mobileplans","ms-newsandinterests","ms-officeapp","ms-people","ms-personacard","ms-powerpoint","ms-project","ms-publisher","ms-recall","ms-remotedesktop","ms-remotedesktop-launch","ms-restoretabcompanion","ms-screenclip","ms-screensketch","ms-search","ms-search-repair","ms-secondary-screen-controller","ms-secondary-screen-setup","ms-settings","ms-settings-airplanemode","ms-settings-bluetooth","ms-settings-camera","ms-settings-cellular","ms-settings-cloudstorage","ms-settings-connectabledevices","ms-settings-displays-topology","ms-settings-emailandaccounts","ms-settings-language","ms-settings-location","ms-settings-lock","ms-settings-nfctransactions","ms-settings-notifications","ms-settings-power","ms-settings-privacy","ms-settings-proximity","ms-settings-screenrotation","ms-settings-wifi","ms-settings-workplace","ms-spd","ms-stickers","ms-sttoverlay","ms-transit-to","ms-useractivityset","ms-uup","ms-virtualtouchpad","ms-visio","ms-walk-to","ms-whiteboard","ms-whiteboard-cmd","ms-widgetboard","ms-widgets","ms-word","msnim","msrp","msrps","mss","mt","mtqp","mtrust","mumble","mupdate","musik","mvn","mvrp","mvrps","news","nfs","ni","nih","nntp","nostr","notes","npamp","num","ocf","oid","onenote","onenote-cmd","op","opaquelocktoken","openid","openpgp4fpr","opns","ord","ordmail","otpauth","palm","paparazzi","payto","pkcs11","pkg","platform","pop","pres","proxy","psyc","pttp","pwid","qb","query","quic-transport","redis","rediss","reload","res","resource","rmi","rsync","rtmfp","rtmp","rtsp","rtsps","rtspu","rttp","sarif","secondlife","secret-token","seki","service","session","sftp","sgn","shc","shelter","sieve","simpleledger","simplex","sip","sips","skype","smb","smp","sms","smtp","snmp","sns","soap.beep","soap.beeps","soldat","spacify","spiffe","spotify","ssb","ssh","sss","starknet","steam","stun","stuns","submit","svn","swh","swid","swidpath","tag","taler","tcxp","teamspeak","teapot","teapots","tel","teliaeid","telnet","tftp","things","thismessage","tii","tip","tn3270","tool","tttps","turn","turns","tv","udp","unreal","upn","urn","ust","ut2004","uuaid","uuid-in-package","v-event","vemmi","ventrilo","ves","view-source","vnc","vscode","vscode-insiders","vsls","w3","wasm","wasm-js","wcr","web3","webcal","wifi","ws","wss","wtai","wyciwyg","xcompute","xcon","xcon-userid","xfire","xftp","xmlrpc.beep","xmlrpc.beeps","xmpp","xrcp","xri","ymsgr","z39.50r","z39.50s","ztdnaid"];var sn=class{#e=new Set($i);get(){return[...this.#e]}getScheme(t){if(!G(t))return null;let s=this.parse(t);return s?this.normalize(s.protocol,!0):null}has(t){let s=this.normalize(t,!0);return s?this.#e.has(s):!1}normalize(t,s=!1){return de(t,s)}normalizeSchemes(t){if(Array.isArray(t)){let s=[];for(let a of t){let r=de(a,!0);r&&s.push(r)}return s}return[]}parse(t,s,a=!1){return Ie(t,s,a)}verifyURI(t,s){if(!G(t))return!1;let a=this.parse(t);return a?this.verifyScheme(a.protocol,s,!0):!1}verifyScheme(t,s,a=!1){let r=this.normalize(t,!0);if(!r)return!1;let c=s||this.#e;if(!r.includes("+"))return ut.test(r)?!1:c.has(r);let h=r.split("+");return h.some(m=>ut.test(m))?!1:c.has(r)?!0:a&&Fi.test(r)||h.every(m=>c.has(m))}};var fh=Object.freeze(["href","origin","protocol","username","password","host","hostname","port","pathname","search","hash"]),nn=class extends sn{#e;#t;#s;constructor(){super(),this.#e=new Set(super.get()),this.#t={...Ut,schemes:this.#e},this.#s=new tn(this.#t)}#o(t){return!G(t)||os.test(t)||t.includes("+")&&t.split("+").some(a=>ut.test(a))?!1:Vs.test(t)}#a(t,s={}){if(!G(t)||t==="")return{isValid:!1};let a={...this.#t,...s,allow:this.normalizeSchemes(s.allow),deny:this.normalizeSchemes(s.deny),only:Object.hasOwn(s,"only")?this.normalizeSchemes(s.only):this.#t.only,schemes:this.#e},r=this.getScheme(t);return r===null&&!a.allowRelative?{isValid:!1}:{options:a,scheme:r}}async#r(t,s){let a={input:t,href:null,valid:!1};if(!G(t))return a.reason=`Invalid URL input: ${Me(t)}`,a;if(t==="")return a.reason="Invalid URL input: (empty string)",a;let r,c=null;try{let h=this.getScheme(t,!0);r=await this.#s.sanitizeURL(t,h,s),r||(c="Sanitization failed (blocked by allowed schemes or rules).")}catch(h){c=h.message}if(r){let h=Ie(r);if(a.valid=!0,h){if(de(h.protocol,!0)==="data"){let{mediaTypes:m,data:f,isBase64:I}=$s(h.pathname,h.search,h.hash);I&&m.pop(),a.data={mime:m.join(";"),base64:I,data:f}}else a.data=null;for(let m of fh){let f=h[m];G(f)&&(a[m]=f)}}else a.valid=!1,a.relative=!0,a.href=r,a.reason="Invalid as an absolute URL, but valid as a relative URL."}else a.reason=c;return a}async#i(t,s){try{let{buffer:a,mimeType:r}=await Ea(t,s.maxBlobSize,s.signal),c=en(a),h=`data:${r?`${r};base64`:"base64"},${c}`,_=await this.#r(h,s);return _.input=t,_}catch(a){if(a.name==="AbortError"||s.signal?.aborted)throw a;return s.debug&&Be(`Failed to inspect blob URL: ${Me(t)}`,a),{input:t,valid:!1,reason:a.message}}finally{s.revokeObjectURL&&URL.revokeObjectURL(t)}}#n(t,s){if(t instanceof TypeError||t.name==="AbortError"||s.signal?.aborted)throw t}get(){return[...this.#e]}has(t){let s=de(t,!0);return s?this.#e.has(s):!1}add(t){if(!G(t))throw new TypeError(`Expected String but got ${At(t)}.`);let s=de(t,!0);if(!this.#o(s))throw new Error(`Invalid scheme: ${t}`);return this.#e.add(s),[...this.#e]}remove(t){if(!G(t))return!1;let s=de(t,!0);return this.#e.delete(s)}reset(){this.#e.clear();for(let t of super.get())this.#e.add(t)}async sanitizeURL(t,s){let{isValid:a,options:r,scheme:c}=this.#a(t,s);if(a===!1)return null;if(c==="blob"){let{allow:h,deny:_,only:m}=r,f=null;try{if(h.includes("blob")&&!_.includes("blob")||Array.isArray(m)&&m.includes("blob")){let I=null,w="";try{let v=await Ea(t,r.maxBlobSize,r.signal);I=v.buffer,w=v.mimeType}catch(v){if(v.name==="AbortError"||r.signal?.aborted)throw v;r.debug&&Be(`Failed to fetch and convert blob URL: ${Me(t)}`,v)}I&&(m?.length?m.includes("data")||(r.only=[...m,"data"]):(h.includes("data")||(r.allow=[...h,"data"]),r.deny=_.filter(v=>v!=="data")),f=await this.#s.sanitizeBuffer(I,w,r))}}catch(I){return this.#n(I,r),r.debug&&Be(`Failed to sanitize URL: ${Me(t)}`,I),null}finally{r.revokeObjectURL&&URL.revokeObjectURL(t)}return f}try{return c==="data"?await this.#s.sanitizeDataURL(t,r):await this.#s.sanitizeURL(t,c,r)}catch(h){return this.#n(h,r),r.debug&&Be(`Failed to sanitize URL: ${Me(t)}`,h),null}}sanitizeURLSync(t,s){let{isValid:a,options:r,scheme:c}=this.#a(t,s);if(a===!1||c==="data")return null;if(c==="blob")return r.revokeObjectURL&&URL.revokeObjectURL(t),null;try{return this.#s.sanitizeURLSync(t,c,r)}catch(h){return this.#n(h,r),r.debug&&Be(`Failed to sanitize URL: ${Me(t)}`,h),null}}async inspectURL(t,s={}){let{options:a,scheme:r}=this.#a(t,s);return r==="blob"?this.#i(t,a):this.#r(t,a)}isValidURI(t){return super.verifyURI(t,this.#e)}};var ls=new nn,oT=async(e,t)=>ls.sanitizeURL(e,t),cT=(e,t)=>ls.sanitizeURLSync(e,t),lT=async(e,t={})=>ls.inspectURL(e,t),uT=e=>ls.isValidURI(e),hT=ls;export{nn as URLSanitizer,hT as default,lT as inspectURL,uT as isValidURI,oT as sanitizeURL,cT as sanitizeURLSync};
4
5
  /*!
5
6
  * URL Sanitizer
6
7
  *