gp-designer 1.0.115 → 1.0.116
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.
- package/dist/gp-designer.es.js +1375 -1375
- package/dist/gp-designer.umd.js +3 -3
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/gp-designer.umd.js
CHANGED
@@ -5,8 +5,8 @@
|
|
5
5
|
fieldset[disabled]:not(fieldset[disabled] legend:first-of-type *)
|
6
6
|
)`,enabled:":not(:disabled)",checked:":is(:is(input[type=radio], input[type=checkbox])[checked], option:selected)",required:":is(input, select, textarea)[required]",optional:":is(input, select, textarea):not([required])",selected:"option:is([selected], select:not([multiple]):not(:has(> option[selected])) > :first-of-type)",checkbox:"[type=checkbox]",file:"[type=file]",password:"[type=password]",radio:"[type=radio]",reset:"[type=reset]",image:"[type=image]",submit:"[type=submit]",parent:":not(:empty)",header:":is(h1, h2, h3, h4, h5, h6)",button:":is(button, input[type=button])",input:":is(input, textarea, select, button)",text:"input:is(:not([type!='']), [type=text])"},co={};function Wd(A,e){return A===Z.falseFunc?Z.falseFunc:t=>e.isTag(t)&&A(t)}function lo(A,e){const t=e.getSiblings(A);if(t.length<=1)return[];const r=t.indexOf(A);return r<0||r===t.length-1?[]:t.slice(r+1).filter(e.isTag)}function Ga(A){return{xmlMode:!!A.xmlMode,lowerCaseAttributeNames:!!A.lowerCaseAttributeNames,lowerCaseTags:!!A.lowerCaseTags,quirksMode:!!A.quirksMode,cacheResults:!!A.cacheResults,pseudos:A.pseudos,adapter:A.adapter,equals:A.equals}}const Ya=(A,e,t,r,n)=>{const a=n(e,Ga(t),r);return a===Z.trueFunc?A:a===Z.falseFunc?Z.falseFunc:i=>a(i)&&A(i)},Xa={is:Ya,matches:Ya,where:Ya,not(A,e,t,r,n){const a=n(e,Ga(t),r);return a===Z.falseFunc?A:a===Z.trueFunc?Z.falseFunc:i=>!a(i)&&A(i)},has(A,e,t,r,n){const{adapter:a}=t,i=Ga(t);i.relativeSelector=!0;const s=e.some(d=>d.some(Pa))?[co]:void 0,u=n(e,i,s);if(u===Z.falseFunc)return Z.falseFunc;const l=Wd(u,a);if(s&&u!==Z.trueFunc){const{shouldTestNextSiblings:d=!1}=u;return f=>{if(!A(f))return!1;s[0]=f;const h=a.getChildren(f),C=d?[...h,...lo(f,a)]:h;return a.existsOne(l,C)}}return d=>A(d)&&a.existsOne(l,a.getChildren(d))}};function Jd(A,e,t,r,n){var a;const{name:i,data:s}=e;if(Array.isArray(s)){if(!(i in Xa))throw new Error(`Unknown pseudo-class :${i}(${s})`);return Xa[i](A,s,t,r,n)}const u=(a=t.pseudos)===null||a===void 0?void 0:a[i],l=typeof u=="string"?u:Xd[i];if(typeof l=="string"){if(s!=null)throw new Error(`Pseudo ${i} doesn't have any arguments`);const d=An(l);return Xa.is(A,d,t,r,n)}if(typeof u=="function")return uo(u,i,s,1),d=>u(d,s)&&A(d);if(i in Ka)return Ka[i](A,s,t,r);if(i in oo){const d=oo[i];return uo(d,i,s,2),f=>d(f,t,s)&&A(f)}throw new Error(`Unknown pseudo-class :${i}`)}function Wa(A,e){const t=e.getParent(A);return t&&e.isTag(t)?t:null}function qd(A,e,t,r,n){const{adapter:a,equals:i}=t;switch(e.type){case Y.PseudoElement:throw new Error("Pseudo-elements are not supported by css-select");case Y.ColumnCombinator:throw new Error("Column combinators are not yet supported by css-select");case Y.Attribute:{if(e.namespace!=null)throw new Error("Namespaced attributes are not yet supported by css-select");return(!t.xmlMode||t.lowerCaseAttributeNames)&&(e.name=e.name.toLowerCase()),Pd[e.action](A,e,t)}case Y.Pseudo:return Jd(A,e,t,r,n);case Y.Tag:{if(e.namespace!=null)throw new Error("Namespaced tag names are not yet supported by css-select");let{name:s}=e;return(!t.xmlMode||t.lowerCaseTags)&&(s=s.toLowerCase()),function(l){return a.getName(l)===s&&A(l)}}case Y.Descendant:{if(t.cacheResults===!1||typeof WeakSet>"u")return function(l){let d=l;for(;d=Wa(d,a);)if(A(d))return!0;return!1};const s=new WeakSet;return function(l){let d=l;for(;d=Wa(d,a);)if(!s.has(d)){if(a.isTag(d)&&A(d))return!0;s.add(d)}return!1}}case"_flexibleDescendant":return function(u){let l=u;do if(A(l))return!0;while(l=Wa(l,a));return!1};case Y.Parent:return function(u){return a.getChildren(u).some(l=>a.isTag(l)&&A(l))};case Y.Child:return function(u){const l=a.getParent(u);return l!=null&&a.isTag(l)&&A(l)};case Y.Sibling:return function(u){const l=a.getSiblings(u);for(let d=0;d<l.length;d++){const f=l[d];if(i(u,f))break;if(a.isTag(f)&&A(f))return!0}return!1};case Y.Adjacent:return a.prevElementSibling?function(u){const l=a.prevElementSibling(u);return l!=null&&A(l)}:function(u){const l=a.getSiblings(u);let d;for(let f=0;f<l.length;f++){const h=l[f];if(i(u,h))break;a.isTag(h)&&(d=h)}return!!d&&A(d)};case Y.Universal:{if(e.namespace!=null&&e.namespace!=="*")throw new Error("Namespaced universal selectors are not yet supported by css-select");return A}}}function fo(A){return A.type===Y.Pseudo&&(A.name==="scope"||Array.isArray(A.data)&&A.data.some(e=>e.some(fo)))}const jd={type:Y.Descendant},zd={type:"_flexibleDescendant"},$d={type:Y.Pseudo,name:"scope",data:null};function Zd(A,{adapter:e},t){const r=!!(t!=null&&t.every(n=>{const a=e.isTag(n)&&e.getParent(n);return n===co||a&&e.isTag(a)}));for(const n of A){if(!(n.length>0&&Pa(n[0])&&n[0].type!==Y.Descendant))if(r&&!n.some(fo))n.unshift(jd);else continue;n.unshift($d)}}function ho(A,e,t){var r;A.forEach(Rd),t=(r=e.context)!==null&&r!==void 0?r:t;const n=Array.isArray(t),a=t&&(Array.isArray(t)?t:[t]);if(e.relativeSelector!==!1)Zd(A,e,a);else if(A.some(u=>u.length>0&&Pa(u[0])))throw new Error("Relative selectors are not allowed when the `relativeSelector` option is disabled");let i=!1;const s=A.map(u=>{if(u.length>=2){const[l,d]=u;l.type!==Y.Pseudo||l.name!=="scope"||(n&&d.type===Y.Descendant?u[1]=zd:(d.type===Y.Adjacent||d.type===Y.Sibling)&&(i=!0))}return Af(u,e,a)}).reduce(ef,Z.falseFunc);return s.shouldTestNextSiblings=i,s}function Af(A,e,t){var r;return A.reduce((n,a)=>n===Z.falseFunc?Z.falseFunc:qd(n,a,e,t,ho),(r=e.rootFunc)!==null&&r!==void 0?r:Z.trueFunc)}function ef(A,e){return e===Z.falseFunc||A===Z.trueFunc?A:A===Z.falseFunc||e===Z.trueFunc?e:function(r){return A(r)||e(r)}}const Bo=(A,e)=>A===e,tf={adapter:zr,equals:Bo};function rf(A){var e,t,r,n;const a=A??tf;return(e=a.adapter)!==null&&e!==void 0||(a.adapter=zr),(t=a.equals)!==null&&t!==void 0||(a.equals=(n=(r=a.adapter)===null||r===void 0?void 0:r.equals)!==null&&n!==void 0?n:Bo),a}function nf(A){return function(t,r,n){const a=rf(r);return A(t,a,n)}}const Ja=nf(ho);function go(A,e,t=!1){return t&&(A=af(A,e)),Array.isArray(A)?e.removeSubsets(A):e.getChildren(A)}function af(A,e){const t=Array.isArray(A)?A.slice(0):[A],r=t.length;for(let n=0;n<r;n++){const a=lo(t[n],e);t.push(...a)}return t}const sf=new Set(["first","last","eq","gt","nth","lt","even","odd"]);function nn(A){return A.type!=="pseudo"?!1:sf.has(A.name)?!0:A.name==="not"&&Array.isArray(A.data)?A.data.some(e=>e.some(nn)):!1}function of(A,e,t){const r=e!=null?parseInt(e,10):NaN;switch(A){case"first":return 1;case"nth":case"eq":return isFinite(r)?r>=0?r+1:1/0:0;case"lt":return isFinite(r)?r>=0?Math.min(r,t):1/0:0;case"gt":return isFinite(r)?1/0:0;case"odd":return 2*t;case"even":return 2*t-1;case"last":case"not":return 1/0}}function uf(A){for(;A.parent;)A=A.parent;return A}function qa(A){const e=[],t=[];for(const r of A)r.some(nn)?e.push(r):t.push(r);return[t,e]}const cf={type:Y.Universal,namespace:null},lf={type:Y.Pseudo,name:"scope",data:null};function po(A,e,t={}){return mo([A],e,t)}function mo(A,e,t={}){if(typeof e=="function")return A.some(e);const[r,n]=qa(An(e));return r.length>0&&A.some(Ja(r,t))||n.some(a=>wo(a,A,t).length>0)}function df(A,e,t,r){const n=typeof t=="string"?parseInt(t,10):NaN;switch(A){case"first":case"lt":return e;case"last":return e.length>0?[e[e.length-1]]:e;case"nth":case"eq":return isFinite(n)&&Math.abs(n)<e.length?[n<0?e[e.length+n]:e[n]]:[];case"gt":return isFinite(n)?e.slice(n+1):[];case"even":return e.filter((a,i)=>i%2===0);case"odd":return e.filter((a,i)=>i%2===1);case"not":{const a=new Set(Co(t,e,r));return e.filter(i=>!a.has(i))}}}function Eo(A,e,t={}){return Co(An(A),e,t)}function Co(A,e,t){if(e.length===0)return[];const[r,n]=qa(A);let a;if(r.length){const i=za(e,r,t);if(n.length===0)return i;i.length&&(a=new Set(i))}for(let i=0;i<n.length&&(a==null?void 0:a.size)!==e.length;i++){const s=n[i];if((a?e.filter(d=>q(d)&&!a.has(d)):e).length===0)break;const l=wo(s,e,t);if(l.length)if(a)l.forEach(d=>a.add(d));else{if(i===n.length-1)return l;a=new Set(l)}}return typeof a<"u"?a.size===e.length?e:e.filter(i=>a.has(i)):[]}function wo(A,e,t){var r;if(A.some(Zt)){const n=(r=t.root)!==null&&r!==void 0?r:uf(e[0]),a={...t,context:e,relativeSelector:!1};return A.push(lf),an(n,A,a,!0,e.length)}return an(e,A,t,!1,e.length)}function ff(A,e,t={},r=1/0){if(typeof A=="function")return bo(e,A);const[n,a]=qa(An(A)),i=a.map(s=>an(e,s,t,!0,r));return n.length&&i.push(ja(e,n,t,r)),i.length===0?[]:i.length===1?i[0]:Tt(i.reduce((s,u)=>[...s,...u]))}function an(A,e,t,r,n){const a=e.findIndex(nn),i=e.slice(0,a),s=e[a],u=e.length-1===a?n:1/0,l=of(s.name,s.data,u);if(l===0)return[];const f=(i.length===0&&!Array.isArray(A)?Wr(A).filter(q):i.length===0?(Array.isArray(A)?A:[A]).filter(q):r||i.some(Zt)?ja(A,[i],t,l):za(A,[i],t)).slice(0,l);let h=df(s.name,f,s.data,t);if(h.length===0||e.length===a+1)return h;const C=e.slice(a+1),E=C.some(Zt);if(E){if(Zt(C[0])){const{type:T}=C[0];(T===Y.Sibling||T===Y.Adjacent)&&(h=go(h,zr,!0)),C.unshift(cf)}t={...t,relativeSelector:!1,rootFunc:T=>h.includes(T)}}else t.rootFunc&&t.rootFunc!==en.trueFunc&&(t={...t,rootFunc:en.trueFunc});return C.some(nn)?an(h,C,t,!1,n):E?ja(h,[C],t,n):za(h,[C],t)}function ja(A,e,t,r){const n=Ja(e,t,A);return bo(A,n,r)}function bo(A,e,t=1/0){const r=go(A,zr,e.shouldTestNextSiblings);return Sa(n=>q(n)&&e(n),r,!0,t)}function za(A,e,t){const r=(Array.isArray(A)?A:[A]).filter(q);if(r.length===0)return r;const n=Ja(e,t);return n===en.trueFunc?r:r.filter(n)}const hf=/^\s*[+~]/;function Bf(A){if(!A)return this._make([]);if(typeof A!="string"){const e=ve(A)?A.toArray():[A],t=this.toArray();return this._make(e.filter(r=>t.some(n=>Xs(n,r))))}return this._findBySelector(A,Number.POSITIVE_INFINITY)}function gf(A,e){var t;const r=this.toArray(),n=hf.test(A)?r:this.children().toArray(),a={context:r,root:(t=this._root)===null||t===void 0?void 0:t[0],xmlMode:this.options.xmlMode,lowerCaseTags:this.options.lowerCaseTags,lowerCaseAttributeNames:this.options.lowerCaseAttributeNames,pseudos:this.options.pseudos,quirksMode:this.options.quirksMode};return this._make(ff(A,n,a,e))}function $a(A){return function(e,...t){return function(r){var n;let a=A(e,this);return r&&(a=ei(a,r,this.options.xmlMode,(n=this._root)===null||n===void 0?void 0:n[0])),this._make(this.length>1&&a.length>1?t.reduce((i,s)=>s(i),a):a)}}}const er=$a((A,e)=>{let t=[];for(let r=0;r<e.length;r++){const n=A(e[r]);n.length>0&&(t=t.concat(n))}return t}),Za=$a((A,e)=>{const t=[];for(let r=0;r<e.length;r++){const n=A(e[r]);n!==null&&t.push(n)}return t});function Ai(A,...e){let t=null;const r=$a((n,a)=>{const i=[];return bA(a,s=>{for(let u;(u=n(s))&&!(t!=null&&t(u,i.length));s=u)i.push(u)}),i})(A,...e);return function(n,a){t=typeof n=="string"?s=>po(s,n,this.options):n?tr(n):null;const i=r.call(this,a);return t=null,i}}function Qt(A){return A.length>1?Array.from(new Set(A)):A}const pf=Za(({parent:A})=>A&&!Re(A)?A:null,Qt),mf=er(A=>{const e=[];for(;A.parent&&!Re(A.parent);)e.push(A.parent),A=A.parent;return e},Tt,A=>A.reverse()),Ef=Ai(({parent:A})=>A&&!Re(A)?A:null,Tt,A=>A.reverse());function Cf(A){var e;const t=[];if(!A)return this._make(t);const r={xmlMode:this.options.xmlMode,root:(e=this._root)===null||e===void 0?void 0:e[0]},n=typeof A=="string"?a=>po(a,A,r):tr(A);return bA(this,a=>{for(a&&!Re(a)&&!q(a)&&(a=a.parent);a&&q(a);){if(n(a,0)){t.includes(a)||t.push(a);break}a=a.parent}}),this._make(t)}const wf=Za(A=>_a(A)),bf=er(A=>{const e=[];for(;A.next;)A=A.next,q(A)&&e.push(A);return e},Qt),Tf=Ai(A=>_a(A),Qt),Uf=Za(A=>Na(A)),Qf=er(A=>{const e=[];for(;A.prev;)A=A.prev,q(A)&&e.push(A);return e},Qt),Ff=Ai(A=>Na(A),Qt),If=er(A=>Ms(A).filter(e=>q(e)&&e!==A),Tt),yf=er(A=>Wr(A).filter(q),Qt);function xf(){const A=this.toArray().reduce((e,t)=>NA(t)?e.concat(t.children):e,[]);return this._make(A)}function vf(A){let e=0;const t=this.length;for(;e<t&&A.call(this[e],e,this[e])!==!1;)++e;return this}function _f(A){let e=[];for(let t=0;t<this.length;t++){const r=this[t],n=A.call(r,t,r);n!=null&&(e=e.concat(n))}return this._make(e)}function tr(A){return typeof A=="function"?(e,t)=>A.call(e,t,e):ve(A)?e=>Array.prototype.includes.call(A,e):function(e){return A===e}}function Nf(A){var e;return this._make(ei(this.toArray(),A,this.options.xmlMode,(e=this._root)===null||e===void 0?void 0:e[0]))}function ei(A,e,t,r){return typeof e=="string"?Eo(e,A,{xmlMode:t,root:r}):A.filter(tr(e))}function Sf(A){const e=this.toArray();return typeof A=="string"?mo(e.filter(q),A,this.options):A?e.some(tr(A)):!1}function Lf(A){let e=this.toArray();if(typeof A=="string"){const t=new Set(Eo(A,e,this.options));e=e.filter(r=>!t.has(r))}else{const t=tr(A);e=e.filter((r,n)=>!t(r,n))}return this._make(e)}function Hf(A){return this.filter(typeof A=="string"?`:has(${A})`:(e,t)=>this._make(t).find(A).length>0)}function Df(){return this.length>1?this._make(this[0]):this}function Of(){return this.length>0?this._make(this[this.length-1]):this}function Rf(A){var e;return A=+A,A===0&&this.length<=1?this:(A<0&&(A=this.length+A),this._make((e=this[A])!==null&&e!==void 0?e:[]))}function Mf(A){return A==null?this.toArray():this[A<0?this.length+A:A]}function kf(){return Array.prototype.slice.call(this)}function Pf(A){let e,t;return A==null?(e=this.parent().children(),t=this[0]):typeof A=="string"?(e=this._make(A),t=this[0]):(e=this,t=ve(A)?A[0]:A),Array.prototype.indexOf.call(e,t)}function Kf(A,e){return this._make(Array.prototype.slice.call(this,A,e))}function Vf(){var A;return(A=this.prevObject)!==null&&A!==void 0?A:this._make([])}function Gf(A,e){const t=this._make(A,e),r=Tt([...this.get(),...t.get()]);return this._make(r)}function Yf(A){return this.prevObject?this.add(A?this.prevObject.filter(A):this.prevObject):this}const Xf=Object.freeze(Object.defineProperty({__proto__:null,_findBySelector:gf,add:Gf,addBack:Yf,children:yf,closest:Cf,contents:xf,each:vf,end:Vf,eq:Rf,filter:Nf,filterArray:ei,find:Bf,first:Df,get:Mf,has:Hf,index:Pf,is:Sf,last:Of,map:_f,next:wf,nextAll:bf,nextUntil:Tf,not:Lf,parent:pf,parents:mf,parentsUntil:Ef,prev:Uf,prevAll:Qf,prevUntil:Ff,siblings:If,slice:Kf,toArray:kf},Symbol.toStringTag,{value:"Module"}));function Wf(A){return function(t,r,n,a){if(typeof Buffer<"u"&&Buffer.isBuffer(t)&&(t=t.toString()),typeof t=="string")return A(t,r,n,a);const i=t;if(!Array.isArray(i)&&Re(i))return i;const s=new nt([]);return ot(i,s),s}}function ot(A,e){const t=Array.isArray(A)?A:[A];e?e.children=t:e=null;for(let r=0;r<t.length;r++){const n=t[r];n.parent&&n.parent.children!==t&&at(n),e?(n.prev=t[r-1]||null,n.next=t[r+1]||null):n.prev=n.next=null,n.parent=e}return e}function Jf(A,e){if(A==null)return[];if(typeof A=="string")return this._parse(A,this.options,!1,null).children.slice(0);if("length"in A){if(A.length===1)return this._makeDomArray(A[0],e);const t=[];for(let r=0;r<A.length;r++){const n=A[r];if(typeof n=="object"){if(n==null)continue;if(!("length"in n)){t.push(e?qt(n,!0):n);continue}}t.push(...this._makeDomArray(n,e))}return t}return[e?qt(A,!0):A]}function To(A){return function(...e){const t=this.length-1;return bA(this,(r,n)=>{if(!NA(r))return;const a=typeof e[0]=="function"?e[0].call(r,n,this._render(r.children)):e,i=this._makeDomArray(a,n<t);A(i,r.children,r)})}}function Pe(A,e,t,r,n){var a,i;const s=[e,t,...r],u=e===0?null:A[e-1],l=e+t>=A.length?null:A[e+t];for(let d=0;d<r.length;++d){const f=r[d],h=f.parent;if(h){const E=h.children.indexOf(f);E>-1&&(h.children.splice(E,1),n===h&&e>E&&s[0]--)}f.parent=n,f.prev&&(f.prev.next=(a=f.next)!==null&&a!==void 0?a:null),f.next&&(f.next.prev=(i=f.prev)!==null&&i!==void 0?i:null),f.prev=d===0?u:r[d-1],f.next=d===r.length-1?l:r[d+1]}return u&&(u.next=r[0]),l&&(l.prev=r[r.length-1]),A.splice(...s)}function qf(A){return(ve(A)?A:this._make(A)).append(this),this}function jf(A){return(ve(A)?A:this._make(A)).prepend(this),this}const zf=To((A,e,t)=>{Pe(e,e.length,0,A,t)}),$f=To((A,e,t)=>{Pe(e,0,0,A,t)});function Uo(A){return function(e){const t=this.length-1,r=this.parents().last();for(let n=0;n<this.length;n++){const a=this[n],i=typeof e=="function"?e.call(a,n,a):typeof e=="string"&&!Da(e)?r.find(e).clone():e,[s]=this._makeDomArray(i,n<t);if(!s||!NA(s))continue;let u=s,l=0;for(;l<u.children.length;){const d=u.children[l];q(d)?(u=d,l=0):l++}A(a,u,[s])}return this}}const Zf=Uo((A,e,t)=>{const{parent:r}=A;if(!r)return;const n=r.children,a=n.indexOf(A);ot([A],e),Pe(n,a,0,t,r)}),Ah=Uo((A,e,t)=>{NA(A)&&(ot(A.children,e),ot(t,A))});function eh(A){return this.parent(A).not("body").each((e,t)=>{this._make(t).replaceWith(t.children)}),this}function th(A){const e=this[0];if(e){const t=this._make(typeof A=="function"?A.call(e,0,e):A).insertBefore(e);let r;for(let a=0;a<t.length;a++)t[a].type==="tag"&&(r=t[a]);let n=0;for(;r&&n<r.children.length;){const a=r.children[n];a.type==="tag"?(r=a,n=0):n++}r&&this._make(r).append(this)}return this}function rh(...A){const e=this.length-1;return bA(this,(t,r)=>{if(!NA(t)||!t.parent)return;const n=t.parent.children,a=n.indexOf(t);if(a<0)return;const i=typeof A[0]=="function"?A[0].call(t,r,this._render(t.children)):A,s=this._makeDomArray(i,r<e);Pe(n,a+1,0,s,t.parent)})}function nh(A){typeof A=="string"&&(A=this._make(A)),this.remove();const e=[];for(const t of this._makeDomArray(A)){const r=this.clone().toArray(),{parent:n}=t;if(!n)continue;const a=n.children,i=a.indexOf(t);i<0||(Pe(a,i+1,0,r,n),e.push(...r))}return this._make(e)}function ah(...A){const e=this.length-1;return bA(this,(t,r)=>{if(!NA(t)||!t.parent)return;const n=t.parent.children,a=n.indexOf(t);if(a<0)return;const i=typeof A[0]=="function"?A[0].call(t,r,this._render(t.children)):A,s=this._makeDomArray(i,r<e);Pe(n,a,0,s,t.parent)})}function ih(A){const e=this._make(A);this.remove();const t=[];return bA(e,r=>{const n=this.clone().toArray(),{parent:a}=r;if(!a)return;const i=a.children,s=i.indexOf(r);s<0||(Pe(i,s,0,n,a),t.push(...n))}),this._make(t)}function sh(A){const e=A?this.filter(A):this;return bA(e,t=>{at(t),t.prev=t.next=t.parent=null}),this}function oh(A){return bA(this,(e,t)=>{const{parent:r}=e;if(!r)return;const n=r.children,a=typeof A=="function"?A.call(e,t,e):A,i=this._makeDomArray(a);ot(i,null);const s=n.indexOf(e);Pe(n,s,1,i,r),i.includes(e)||(e.parent=e.prev=e.next=null)})}function uh(){return bA(this,A=>{if(NA(A)){for(const e of A.children)e.next=e.prev=e.parent=null;A.children.length=0}})}function ch(A){if(A===void 0){const e=this[0];return!e||!NA(e)?null:this._render(e.children)}return bA(this,e=>{if(!NA(e))return;for(const r of e.children)r.next=r.prev=r.parent=null;const t=ve(A)?A.toArray():this._parse(`${A}`,this.options,!1,e).children;ot(t,e)})}function lh(){return this._render(this)}function dh(A){return A===void 0?jt(this):typeof A=="function"?bA(this,(e,t)=>this._make(e).text(A.call(e,t,jt([e])))):bA(this,e=>{if(!NA(e))return;for(const r of e.children)r.next=r.prev=r.parent=null;const t=new Jt(`${A}`);ot(t,e)})}function fh(){const A=Array.prototype.map.call(this.get(),t=>qt(t,!0)),e=new nt(A);for(const t of A)t.parent=e;return this._make(A)}const hh=Object.freeze(Object.defineProperty({__proto__:null,_makeDomArray:Jf,after:rh,append:zf,appendTo:qf,before:ah,clone:fh,empty:uh,html:ch,insertAfter:nh,insertBefore:ih,prepend:$f,prependTo:jf,remove:sh,replaceWith:oh,text:dh,toString:lh,unwrap:eh,wrap:Zf,wrapAll:th,wrapInner:Ah},Symbol.toStringTag,{value:"Module"}));function Bh(A,e){if(A!=null&&e!=null||typeof A=="object"&&!Array.isArray(A))return bA(this,(t,r)=>{q(t)&&Qo(t,A,e,r)});if(this.length!==0)return Fo(this[0],A)}function Qo(A,e,t,r){if(typeof e=="string"){const n=Fo(A),a=typeof t=="function"?t.call(A,r,n[e]):t;a===""?delete n[e]:a!=null&&(n[e]=a),A.attribs.style=gh(n)}else if(typeof e=="object"){const n=Object.keys(e);for(let a=0;a<n.length;a++){const i=n[a];Qo(A,i,e[i],a)}}}function Fo(A,e){if(!A||!q(A))return;const t=ph(A.attribs.style);if(typeof e=="string")return t[e];if(Array.isArray(e)){const r={};for(const n of e)t[n]!=null&&(r[n]=t[n]);return r}return t}function gh(A){return Object.keys(A).reduce((e,t)=>`${e}${e?" ":""}${t}: ${A[t]};`,"")}function ph(A){if(A=(A||"").trim(),!A)return{};const e={};let t;for(const r of A.split(";")){const n=r.indexOf(":");if(n<1||n===r.length-1){const a=r.trimEnd();a.length>0&&t!==void 0&&(e[t]+=`;${a}`)}else t=r.slice(0,n).trim(),e[t]=r.slice(n+1).trim()}return e}const mh=Object.freeze(Object.defineProperty({__proto__:null,css:Bh},Symbol.toStringTag,{value:"Module"})),Io="input,select,textarea,keygen",Eh=/%20/g,yo=/\r?\n/g;function Ch(){return this.serializeArray().map(t=>`${encodeURIComponent(t.name)}=${encodeURIComponent(t.value)}`).join("&").replace(Eh,"+")}function wh(){return this.map((A,e)=>{const t=this._make(e);return q(e)&&e.name==="form"?t.find(Io).toArray():t.filter(Io).toArray()}).filter('[name!=""]:enabled:not(:submit, :button, :image, :reset, :file):matches([checked], :not(:checkbox, :radio))').map((A,e)=>{var t;const r=this._make(e),n=r.attr("name"),a=(t=r.val())!==null&&t!==void 0?t:"";return Array.isArray(a)?a.map(i=>({name:n,value:i.replace(yo,`\r
|
7
7
|
`)})):{name:n,value:a.replace(yo,`\r
|
8
|
-
`)}}).toArray()}const bh=Object.freeze(Object.defineProperty({__proto__:null,serialize:Ch,serializeArray:wh},Symbol.toStringTag,{value:"Module"}));function Th(A){var e;return typeof A=="string"?{selector:A,value:"textContent"}:{selector:A.selector,value:(e=A.value)!==null&&e!==void 0?e:"textContent"}}function Uh(A){const e={};for(const t in A){const r=A[t],n=Array.isArray(r),{selector:a,value:i}=Th(n?r[0]:r),s=typeof i=="function"?i:typeof i=="string"?u=>this._make(u).prop(i):u=>this._make(u).extract(i);if(n)e[t]=this._findBySelector(a,Number.POSITIVE_INFINITY).map((u,l)=>s(l,t,e)).get();else{const u=this._findBySelector(a,1);e[t]=u.length>0?s(u[0],t,e):void 0}}return e}const Qh=Object.freeze(Object.defineProperty({__proto__:null,extract:Uh},Symbol.toStringTag,{value:"Module"}));class rr{constructor(e,t,r){if(this.length=0,this.options=r,this._root=t,e){for(let n=0;n<e.length;n++)this[n]=e[n];this.length=e.length}}}rr.prototype.cheerio="[cheerio object]",rr.prototype.splice=Array.prototype.splice,rr.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator],Object.assign(rr.prototype,vd,Xf,hh,mh,bh,Qh);function Fh(A,e){return function t(r,n,a=!0){if(r==null)throw new Error("cheerio.load() expects a string");const i=Ha(n),s=A(r,i,a,null);class u extends rr{_make(f,h){const C=l(f,h);return C.prevObject=this,C}_parse(f,h,C,E){return A(f,h,C,E)}_render(f){return e(f,this.options)}}function l(d,f,h=s,C){if(d&&ve(d))return d;const E=Ha(C,i),T=typeof h=="string"?[A(h,E,!1,null)]:"length"in h?h:[h],v=ve(T)?T:new u(T,null,E);if(v._root=v,!d)return new u(void 0,v,E);const b=typeof d=="string"&&Da(d)?A(d,E,!1,null).children:Ih(d)?[d]:Array.isArray(d)?d:void 0,x=new u(b,v,E);if(b)return x;if(typeof d!="string")throw new TypeError("Unexpected type of selector");let D=d;const R=f?typeof f=="string"?Da(f)?new u([A(f,E,!1,null)],v,E):(D=`${f} ${D}`,v):ve(f)?f:new u(Array.isArray(f)?f:[f],v,E):v;return R?R.find(D):x}return Object.assign(l,md,{load:t,_root:s,_options:i,fn:u.prototype,prototype:u.prototype}),l}}function Ih(A){return!!A.name||A.type==="root"||A.type==="text"||A.type==="comment"}const yh=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]),pA="�";var B;(function(A){A[A.EOF=-1]="EOF",A[A.NULL=0]="NULL",A[A.TABULATION=9]="TABULATION",A[A.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",A[A.LINE_FEED=10]="LINE_FEED",A[A.FORM_FEED=12]="FORM_FEED",A[A.SPACE=32]="SPACE",A[A.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",A[A.QUOTATION_MARK=34]="QUOTATION_MARK",A[A.AMPERSAND=38]="AMPERSAND",A[A.APOSTROPHE=39]="APOSTROPHE",A[A.HYPHEN_MINUS=45]="HYPHEN_MINUS",A[A.SOLIDUS=47]="SOLIDUS",A[A.DIGIT_0=48]="DIGIT_0",A[A.DIGIT_9=57]="DIGIT_9",A[A.SEMICOLON=59]="SEMICOLON",A[A.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",A[A.EQUALS_SIGN=61]="EQUALS_SIGN",A[A.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",A[A.QUESTION_MARK=63]="QUESTION_MARK",A[A.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",A[A.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",A[A.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",A[A.GRAVE_ACCENT=96]="GRAVE_ACCENT",A[A.LATIN_SMALL_A=97]="LATIN_SMALL_A",A[A.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(B||(B={}));const ee={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function xo(A){return A>=55296&&A<=57343}function xh(A){return A>=56320&&A<=57343}function vh(A,e){return(A-55296)*1024+9216+e}function vo(A){return A!==32&&A!==10&&A!==13&&A!==9&&A!==12&&A>=1&&A<=31||A>=127&&A<=159}function _o(A){return A>=64976&&A<=65007||yh.has(A)}var U;(function(A){A.controlCharacterInInputStream="control-character-in-input-stream",A.noncharacterInInputStream="noncharacter-in-input-stream",A.surrogateInInputStream="surrogate-in-input-stream",A.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",A.endTagWithAttributes="end-tag-with-attributes",A.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",A.unexpectedSolidusInTag="unexpected-solidus-in-tag",A.unexpectedNullCharacter="unexpected-null-character",A.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",A.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",A.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",A.missingEndTagName="missing-end-tag-name",A.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",A.unknownNamedCharacterReference="unknown-named-character-reference",A.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",A.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",A.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",A.eofBeforeTagName="eof-before-tag-name",A.eofInTag="eof-in-tag",A.missingAttributeValue="missing-attribute-value",A.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",A.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",A.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",A.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",A.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",A.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",A.missingDoctypePublicIdentifier="missing-doctype-public-identifier",A.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",A.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",A.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",A.cdataInHtmlContent="cdata-in-html-content",A.incorrectlyOpenedComment="incorrectly-opened-comment",A.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",A.eofInDoctype="eof-in-doctype",A.nestedComment="nested-comment",A.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",A.eofInComment="eof-in-comment",A.incorrectlyClosedComment="incorrectly-closed-comment",A.eofInCdata="eof-in-cdata",A.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",A.nullCharacterReference="null-character-reference",A.surrogateCharacterReference="surrogate-character-reference",A.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",A.controlCharacterReference="control-character-reference",A.noncharacterCharacterReference="noncharacter-character-reference",A.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",A.missingDoctypeName="missing-doctype-name",A.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",A.duplicateAttribute="duplicate-attribute",A.nonConformingDoctype="non-conforming-doctype",A.missingDoctype="missing-doctype",A.misplacedDoctype="misplaced-doctype",A.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",A.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",A.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",A.openElementsLeftAfterEof="open-elements-left-after-eof",A.abandonedHeadElementChild="abandoned-head-element-child",A.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",A.nestedNoscriptInHead="nested-noscript-in-head",A.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(U||(U={}));const _h=65536;class Nh{constructor(e){this.handler=e,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=_h,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(e,t){const{line:r,col:n,offset:a}=this,i=n+t,s=a+t;return{code:e,startLine:r,endLine:r,startCol:i,endCol:i,startOffset:s,endOffset:s}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){const t=this.html.charCodeAt(this.pos+1);if(xh(t))return this.pos++,this._addGap(),vh(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,B.EOF;return this._err(U.surrogateInInputStream),e}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(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let r=0;r<e.length;r++)if((this.html.charCodeAt(this.pos+r)|32)!==e.charCodeAt(r))return!1;return!0}peek(e){const t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,B.EOF;const r=this.html.charCodeAt(t);return r===B.CARRIAGE_RETURN?B.LINE_FEED:r}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,B.EOF;let e=this.html.charCodeAt(this.pos);return e===B.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,B.LINE_FEED):e===B.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,xo(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===B.LINE_FEED||e===B.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){vo(e)?this._err(U.controlCharacterInInputStream):_o(e)&&this._err(U.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var tA;(function(A){A[A.CHARACTER=0]="CHARACTER",A[A.NULL_CHARACTER=1]="NULL_CHARACTER",A[A.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",A[A.START_TAG=3]="START_TAG",A[A.END_TAG=4]="END_TAG",A[A.COMMENT=5]="COMMENT",A[A.DOCTYPE=6]="DOCTYPE",A[A.EOF=7]="EOF",A[A.HIBERNATION=8]="HIBERNATION"})(tA||(tA={}));function No(A,e){for(let t=A.attrs.length-1;t>=0;t--)if(A.attrs[t].name===e)return A.attrs[t].value;return null}var I;(function(A){A.HTML="http://www.w3.org/1999/xhtml",A.MATHML="http://www.w3.org/1998/Math/MathML",A.SVG="http://www.w3.org/2000/svg",A.XLINK="http://www.w3.org/1999/xlink",A.XML="http://www.w3.org/XML/1998/namespace",A.XMLNS="http://www.w3.org/2000/xmlns/"})(I||(I={}));var ut;(function(A){A.TYPE="type",A.ACTION="action",A.ENCODING="encoding",A.PROMPT="prompt",A.NAME="name",A.COLOR="color",A.FACE="face",A.SIZE="size"})(ut||(ut={}));var se;(function(A){A.NO_QUIRKS="no-quirks",A.QUIRKS="quirks",A.LIMITED_QUIRKS="limited-quirks"})(se||(se={}));var w;(function(A){A.A="a",A.ADDRESS="address",A.ANNOTATION_XML="annotation-xml",A.APPLET="applet",A.AREA="area",A.ARTICLE="article",A.ASIDE="aside",A.B="b",A.BASE="base",A.BASEFONT="basefont",A.BGSOUND="bgsound",A.BIG="big",A.BLOCKQUOTE="blockquote",A.BODY="body",A.BR="br",A.BUTTON="button",A.CAPTION="caption",A.CENTER="center",A.CODE="code",A.COL="col",A.COLGROUP="colgroup",A.DD="dd",A.DESC="desc",A.DETAILS="details",A.DIALOG="dialog",A.DIR="dir",A.DIV="div",A.DL="dl",A.DT="dt",A.EM="em",A.EMBED="embed",A.FIELDSET="fieldset",A.FIGCAPTION="figcaption",A.FIGURE="figure",A.FONT="font",A.FOOTER="footer",A.FOREIGN_OBJECT="foreignObject",A.FORM="form",A.FRAME="frame",A.FRAMESET="frameset",A.H1="h1",A.H2="h2",A.H3="h3",A.H4="h4",A.H5="h5",A.H6="h6",A.HEAD="head",A.HEADER="header",A.HGROUP="hgroup",A.HR="hr",A.HTML="html",A.I="i",A.IMG="img",A.IMAGE="image",A.INPUT="input",A.IFRAME="iframe",A.KEYGEN="keygen",A.LABEL="label",A.LI="li",A.LINK="link",A.LISTING="listing",A.MAIN="main",A.MALIGNMARK="malignmark",A.MARQUEE="marquee",A.MATH="math",A.MENU="menu",A.META="meta",A.MGLYPH="mglyph",A.MI="mi",A.MO="mo",A.MN="mn",A.MS="ms",A.MTEXT="mtext",A.NAV="nav",A.NOBR="nobr",A.NOFRAMES="noframes",A.NOEMBED="noembed",A.NOSCRIPT="noscript",A.OBJECT="object",A.OL="ol",A.OPTGROUP="optgroup",A.OPTION="option",A.P="p",A.PARAM="param",A.PLAINTEXT="plaintext",A.PRE="pre",A.RB="rb",A.RP="rp",A.RT="rt",A.RTC="rtc",A.RUBY="ruby",A.S="s",A.SCRIPT="script",A.SEARCH="search",A.SECTION="section",A.SELECT="select",A.SOURCE="source",A.SMALL="small",A.SPAN="span",A.STRIKE="strike",A.STRONG="strong",A.STYLE="style",A.SUB="sub",A.SUMMARY="summary",A.SUP="sup",A.TABLE="table",A.TBODY="tbody",A.TEMPLATE="template",A.TEXTAREA="textarea",A.TFOOT="tfoot",A.TD="td",A.TH="th",A.THEAD="thead",A.TITLE="title",A.TR="tr",A.TRACK="track",A.TT="tt",A.U="u",A.UL="ul",A.SVG="svg",A.VAR="var",A.WBR="wbr",A.XMP="xmp"})(w||(w={}));var o;(function(A){A[A.UNKNOWN=0]="UNKNOWN",A[A.A=1]="A",A[A.ADDRESS=2]="ADDRESS",A[A.ANNOTATION_XML=3]="ANNOTATION_XML",A[A.APPLET=4]="APPLET",A[A.AREA=5]="AREA",A[A.ARTICLE=6]="ARTICLE",A[A.ASIDE=7]="ASIDE",A[A.B=8]="B",A[A.BASE=9]="BASE",A[A.BASEFONT=10]="BASEFONT",A[A.BGSOUND=11]="BGSOUND",A[A.BIG=12]="BIG",A[A.BLOCKQUOTE=13]="BLOCKQUOTE",A[A.BODY=14]="BODY",A[A.BR=15]="BR",A[A.BUTTON=16]="BUTTON",A[A.CAPTION=17]="CAPTION",A[A.CENTER=18]="CENTER",A[A.CODE=19]="CODE",A[A.COL=20]="COL",A[A.COLGROUP=21]="COLGROUP",A[A.DD=22]="DD",A[A.DESC=23]="DESC",A[A.DETAILS=24]="DETAILS",A[A.DIALOG=25]="DIALOG",A[A.DIR=26]="DIR",A[A.DIV=27]="DIV",A[A.DL=28]="DL",A[A.DT=29]="DT",A[A.EM=30]="EM",A[A.EMBED=31]="EMBED",A[A.FIELDSET=32]="FIELDSET",A[A.FIGCAPTION=33]="FIGCAPTION",A[A.FIGURE=34]="FIGURE",A[A.FONT=35]="FONT",A[A.FOOTER=36]="FOOTER",A[A.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",A[A.FORM=38]="FORM",A[A.FRAME=39]="FRAME",A[A.FRAMESET=40]="FRAMESET",A[A.H1=41]="H1",A[A.H2=42]="H2",A[A.H3=43]="H3",A[A.H4=44]="H4",A[A.H5=45]="H5",A[A.H6=46]="H6",A[A.HEAD=47]="HEAD",A[A.HEADER=48]="HEADER",A[A.HGROUP=49]="HGROUP",A[A.HR=50]="HR",A[A.HTML=51]="HTML",A[A.I=52]="I",A[A.IMG=53]="IMG",A[A.IMAGE=54]="IMAGE",A[A.INPUT=55]="INPUT",A[A.IFRAME=56]="IFRAME",A[A.KEYGEN=57]="KEYGEN",A[A.LABEL=58]="LABEL",A[A.LI=59]="LI",A[A.LINK=60]="LINK",A[A.LISTING=61]="LISTING",A[A.MAIN=62]="MAIN",A[A.MALIGNMARK=63]="MALIGNMARK",A[A.MARQUEE=64]="MARQUEE",A[A.MATH=65]="MATH",A[A.MENU=66]="MENU",A[A.META=67]="META",A[A.MGLYPH=68]="MGLYPH",A[A.MI=69]="MI",A[A.MO=70]="MO",A[A.MN=71]="MN",A[A.MS=72]="MS",A[A.MTEXT=73]="MTEXT",A[A.NAV=74]="NAV",A[A.NOBR=75]="NOBR",A[A.NOFRAMES=76]="NOFRAMES",A[A.NOEMBED=77]="NOEMBED",A[A.NOSCRIPT=78]="NOSCRIPT",A[A.OBJECT=79]="OBJECT",A[A.OL=80]="OL",A[A.OPTGROUP=81]="OPTGROUP",A[A.OPTION=82]="OPTION",A[A.P=83]="P",A[A.PARAM=84]="PARAM",A[A.PLAINTEXT=85]="PLAINTEXT",A[A.PRE=86]="PRE",A[A.RB=87]="RB",A[A.RP=88]="RP",A[A.RT=89]="RT",A[A.RTC=90]="RTC",A[A.RUBY=91]="RUBY",A[A.S=92]="S",A[A.SCRIPT=93]="SCRIPT",A[A.SEARCH=94]="SEARCH",A[A.SECTION=95]="SECTION",A[A.SELECT=96]="SELECT",A[A.SOURCE=97]="SOURCE",A[A.SMALL=98]="SMALL",A[A.SPAN=99]="SPAN",A[A.STRIKE=100]="STRIKE",A[A.STRONG=101]="STRONG",A[A.STYLE=102]="STYLE",A[A.SUB=103]="SUB",A[A.SUMMARY=104]="SUMMARY",A[A.SUP=105]="SUP",A[A.TABLE=106]="TABLE",A[A.TBODY=107]="TBODY",A[A.TEMPLATE=108]="TEMPLATE",A[A.TEXTAREA=109]="TEXTAREA",A[A.TFOOT=110]="TFOOT",A[A.TD=111]="TD",A[A.TH=112]="TH",A[A.THEAD=113]="THEAD",A[A.TITLE=114]="TITLE",A[A.TR=115]="TR",A[A.TRACK=116]="TRACK",A[A.TT=117]="TT",A[A.U=118]="U",A[A.UL=119]="UL",A[A.SVG=120]="SVG",A[A.VAR=121]="VAR",A[A.WBR=122]="WBR",A[A.XMP=123]="XMP"})(o||(o={}));const Sh=new Map([[w.A,o.A],[w.ADDRESS,o.ADDRESS],[w.ANNOTATION_XML,o.ANNOTATION_XML],[w.APPLET,o.APPLET],[w.AREA,o.AREA],[w.ARTICLE,o.ARTICLE],[w.ASIDE,o.ASIDE],[w.B,o.B],[w.BASE,o.BASE],[w.BASEFONT,o.BASEFONT],[w.BGSOUND,o.BGSOUND],[w.BIG,o.BIG],[w.BLOCKQUOTE,o.BLOCKQUOTE],[w.BODY,o.BODY],[w.BR,o.BR],[w.BUTTON,o.BUTTON],[w.CAPTION,o.CAPTION],[w.CENTER,o.CENTER],[w.CODE,o.CODE],[w.COL,o.COL],[w.COLGROUP,o.COLGROUP],[w.DD,o.DD],[w.DESC,o.DESC],[w.DETAILS,o.DETAILS],[w.DIALOG,o.DIALOG],[w.DIR,o.DIR],[w.DIV,o.DIV],[w.DL,o.DL],[w.DT,o.DT],[w.EM,o.EM],[w.EMBED,o.EMBED],[w.FIELDSET,o.FIELDSET],[w.FIGCAPTION,o.FIGCAPTION],[w.FIGURE,o.FIGURE],[w.FONT,o.FONT],[w.FOOTER,o.FOOTER],[w.FOREIGN_OBJECT,o.FOREIGN_OBJECT],[w.FORM,o.FORM],[w.FRAME,o.FRAME],[w.FRAMESET,o.FRAMESET],[w.H1,o.H1],[w.H2,o.H2],[w.H3,o.H3],[w.H4,o.H4],[w.H5,o.H5],[w.H6,o.H6],[w.HEAD,o.HEAD],[w.HEADER,o.HEADER],[w.HGROUP,o.HGROUP],[w.HR,o.HR],[w.HTML,o.HTML],[w.I,o.I],[w.IMG,o.IMG],[w.IMAGE,o.IMAGE],[w.INPUT,o.INPUT],[w.IFRAME,o.IFRAME],[w.KEYGEN,o.KEYGEN],[w.LABEL,o.LABEL],[w.LI,o.LI],[w.LINK,o.LINK],[w.LISTING,o.LISTING],[w.MAIN,o.MAIN],[w.MALIGNMARK,o.MALIGNMARK],[w.MARQUEE,o.MARQUEE],[w.MATH,o.MATH],[w.MENU,o.MENU],[w.META,o.META],[w.MGLYPH,o.MGLYPH],[w.MI,o.MI],[w.MO,o.MO],[w.MN,o.MN],[w.MS,o.MS],[w.MTEXT,o.MTEXT],[w.NAV,o.NAV],[w.NOBR,o.NOBR],[w.NOFRAMES,o.NOFRAMES],[w.NOEMBED,o.NOEMBED],[w.NOSCRIPT,o.NOSCRIPT],[w.OBJECT,o.OBJECT],[w.OL,o.OL],[w.OPTGROUP,o.OPTGROUP],[w.OPTION,o.OPTION],[w.P,o.P],[w.PARAM,o.PARAM],[w.PLAINTEXT,o.PLAINTEXT],[w.PRE,o.PRE],[w.RB,o.RB],[w.RP,o.RP],[w.RT,o.RT],[w.RTC,o.RTC],[w.RUBY,o.RUBY],[w.S,o.S],[w.SCRIPT,o.SCRIPT],[w.SEARCH,o.SEARCH],[w.SECTION,o.SECTION],[w.SELECT,o.SELECT],[w.SOURCE,o.SOURCE],[w.SMALL,o.SMALL],[w.SPAN,o.SPAN],[w.STRIKE,o.STRIKE],[w.STRONG,o.STRONG],[w.STYLE,o.STYLE],[w.SUB,o.SUB],[w.SUMMARY,o.SUMMARY],[w.SUP,o.SUP],[w.TABLE,o.TABLE],[w.TBODY,o.TBODY],[w.TEMPLATE,o.TEMPLATE],[w.TEXTAREA,o.TEXTAREA],[w.TFOOT,o.TFOOT],[w.TD,o.TD],[w.TH,o.TH],[w.THEAD,o.THEAD],[w.TITLE,o.TITLE],[w.TR,o.TR],[w.TRACK,o.TRACK],[w.TT,o.TT],[w.U,o.U],[w.UL,o.UL],[w.SVG,o.SVG],[w.VAR,o.VAR],[w.WBR,o.WBR],[w.XMP,o.XMP]]);function sn(A){var e;return(e=Sh.get(A))!==null&&e!==void 0?e:o.UNKNOWN}const S=o,Lh={[I.HTML]:new Set([S.ADDRESS,S.APPLET,S.AREA,S.ARTICLE,S.ASIDE,S.BASE,S.BASEFONT,S.BGSOUND,S.BLOCKQUOTE,S.BODY,S.BR,S.BUTTON,S.CAPTION,S.CENTER,S.COL,S.COLGROUP,S.DD,S.DETAILS,S.DIR,S.DIV,S.DL,S.DT,S.EMBED,S.FIELDSET,S.FIGCAPTION,S.FIGURE,S.FOOTER,S.FORM,S.FRAME,S.FRAMESET,S.H1,S.H2,S.H3,S.H4,S.H5,S.H6,S.HEAD,S.HEADER,S.HGROUP,S.HR,S.HTML,S.IFRAME,S.IMG,S.INPUT,S.LI,S.LINK,S.LISTING,S.MAIN,S.MARQUEE,S.MENU,S.META,S.NAV,S.NOEMBED,S.NOFRAMES,S.NOSCRIPT,S.OBJECT,S.OL,S.P,S.PARAM,S.PLAINTEXT,S.PRE,S.SCRIPT,S.SECTION,S.SELECT,S.SOURCE,S.STYLE,S.SUMMARY,S.TABLE,S.TBODY,S.TD,S.TEMPLATE,S.TEXTAREA,S.TFOOT,S.TH,S.THEAD,S.TITLE,S.TR,S.TRACK,S.UL,S.WBR,S.XMP]),[I.MATHML]:new Set([S.MI,S.MO,S.MN,S.MS,S.MTEXT,S.ANNOTATION_XML]),[I.SVG]:new Set([S.TITLE,S.FOREIGN_OBJECT,S.DESC]),[I.XLINK]:new Set,[I.XML]:new Set,[I.XMLNS]:new Set},ti=new Set([S.H1,S.H2,S.H3,S.H4,S.H5,S.H6]),Hh=new Set([w.STYLE,w.SCRIPT,w.XMP,w.IFRAME,w.NOEMBED,w.NOFRAMES,w.PLAINTEXT]);function Dh(A,e){return Hh.has(A)||e&&A===w.NOSCRIPT}var g;(function(A){A[A.DATA=0]="DATA",A[A.RCDATA=1]="RCDATA",A[A.RAWTEXT=2]="RAWTEXT",A[A.SCRIPT_DATA=3]="SCRIPT_DATA",A[A.PLAINTEXT=4]="PLAINTEXT",A[A.TAG_OPEN=5]="TAG_OPEN",A[A.END_TAG_OPEN=6]="END_TAG_OPEN",A[A.TAG_NAME=7]="TAG_NAME",A[A.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",A[A.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",A[A.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",A[A.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",A[A.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",A[A.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",A[A.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",A[A.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",A[A.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",A[A.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",A[A.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",A[A.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",A[A.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",A[A.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",A[A.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",A[A.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",A[A.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",A[A.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",A[A.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",A[A.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",A[A.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",A[A.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",A[A.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",A[A.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",A[A.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",A[A.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",A[A.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",A[A.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",A[A.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",A[A.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",A[A.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",A[A.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",A[A.BOGUS_COMMENT=40]="BOGUS_COMMENT",A[A.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",A[A.COMMENT_START=42]="COMMENT_START",A[A.COMMENT_START_DASH=43]="COMMENT_START_DASH",A[A.COMMENT=44]="COMMENT",A[A.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",A[A.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",A[A.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",A[A.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",A[A.COMMENT_END_DASH=49]="COMMENT_END_DASH",A[A.COMMENT_END=50]="COMMENT_END",A[A.COMMENT_END_BANG=51]="COMMENT_END_BANG",A[A.DOCTYPE=52]="DOCTYPE",A[A.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",A[A.DOCTYPE_NAME=54]="DOCTYPE_NAME",A[A.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",A[A.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",A[A.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",A[A.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",A[A.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",A[A.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",A[A.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",A[A.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",A[A.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",A[A.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",A[A.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",A[A.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",A[A.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",A[A.CDATA_SECTION=68]="CDATA_SECTION",A[A.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",A[A.CDATA_SECTION_END=70]="CDATA_SECTION_END",A[A.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",A[A.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(g||(g={}));const te={DATA:g.DATA,RCDATA:g.RCDATA,RAWTEXT:g.RAWTEXT,SCRIPT_DATA:g.SCRIPT_DATA,PLAINTEXT:g.PLAINTEXT,CDATA_SECTION:g.CDATA_SECTION};function Oh(A){return A>=B.DIGIT_0&&A<=B.DIGIT_9}function nr(A){return A>=B.LATIN_CAPITAL_A&&A<=B.LATIN_CAPITAL_Z}function Rh(A){return A>=B.LATIN_SMALL_A&&A<=B.LATIN_SMALL_Z}function Ke(A){return Rh(A)||nr(A)}function So(A){return Ke(A)||Oh(A)}function on(A){return A+32}function Lo(A){return A===B.SPACE||A===B.LINE_FEED||A===B.TABULATION||A===B.FORM_FEED}function Ho(A){return Lo(A)||A===B.SOLIDUS||A===B.GREATER_THAN_SIGN}function Mh(A){return A===B.NULL?U.nullCharacterReference:A>1114111?U.characterReferenceOutsideUnicodeRange:xo(A)?U.surrogateCharacterReference:_o(A)?U.noncharacterCharacterReference:vo(A)||A===B.CARRIAGE_RETURN?U.controlCharacterReference:null}let kh=class{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=g.DATA,this.returnState=g.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new Nh(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new va(Fa,(r,n)=>{this.preprocessor.pos=this.entityStartPos+n-1,this._flushCodePointConsumedAsCharacterReference(r)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(U.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(U.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const n=Mh(r);n&&this._err(n,1)}}:void 0)}_err(e,t=0){var r,n;(n=(r=this.handler).onParseError)===null||n===void 0||n.call(r,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e==null||e())}write(e,t,r){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||r==null||r()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),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(e){this.consumedAfterSnapshot+=e;for(let t=0;t<e;t++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,t){return this.preprocessor.startsWith(e,t)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:tA.START_TAG,tagName:"",tagID:o.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:tA.END_TAG,tagName:"",tagID:o.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:tA.COMMENT,data:"",location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:tA.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e,t;const r=this.currentToken;if(No(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const n=(e=(t=r.location).attrs)!==null&&e!==void 0?e:t.attrs=Object.create(null);n[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(U.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const e=this.currentToken;this.prepareToken(e),e.tagID=sn(e.tagName),e.type===tA.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(U.endTagWithAttributes),e.selfClosing&&this._err(U.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case tA.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case tA.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case tA.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:tA.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=t;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,t)}_emitCodePoint(e){const t=Lo(e)?tA.WHITESPACE_CHARACTER:e===B.NULL?tA.NULL_CHARACTER:tA.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(tA.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=g.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?ce.Attribute:ce.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===g.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===g.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===g.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case g.DATA:{this._stateData(e);break}case g.RCDATA:{this._stateRcdata(e);break}case g.RAWTEXT:{this._stateRawtext(e);break}case g.SCRIPT_DATA:{this._stateScriptData(e);break}case g.PLAINTEXT:{this._statePlaintext(e);break}case g.TAG_OPEN:{this._stateTagOpen(e);break}case g.END_TAG_OPEN:{this._stateEndTagOpen(e);break}case g.TAG_NAME:{this._stateTagName(e);break}case g.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(e);break}case g.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(e);break}case g.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(e);break}case g.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(e);break}case g.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(e);break}case g.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(e);break}case g.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(e);break}case g.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(e);break}case g.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(e);break}case g.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(e);break}case g.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(e);break}case g.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(e);break}case g.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(e);break}case g.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(e);break}case g.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(e);break}case g.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(e);break}case g.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(e);break}case g.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(e);break}case g.ATTRIBUTE_NAME:{this._stateAttributeName(e);break}case g.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(e);break}case g.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(e);break}case g.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(e);break}case g.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(e);break}case g.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(e);break}case g.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(e);break}case g.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(e);break}case g.BOGUS_COMMENT:{this._stateBogusComment(e);break}case g.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(e);break}case g.COMMENT_START:{this._stateCommentStart(e);break}case g.COMMENT_START_DASH:{this._stateCommentStartDash(e);break}case g.COMMENT:{this._stateComment(e);break}case g.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(e);break}case g.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(e);break}case g.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(e);break}case g.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(e);break}case g.COMMENT_END_DASH:{this._stateCommentEndDash(e);break}case g.COMMENT_END:{this._stateCommentEnd(e);break}case g.COMMENT_END_BANG:{this._stateCommentEndBang(e);break}case g.DOCTYPE:{this._stateDoctype(e);break}case g.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(e);break}case g.DOCTYPE_NAME:{this._stateDoctypeName(e);break}case g.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(e);break}case g.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(e);break}case g.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(e);break}case g.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(e);break}case g.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(e);break}case g.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(e);break}case g.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break}case g.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(e);break}case g.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(e);break}case g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(e);break}case g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(e);break}case g.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(e);break}case g.BOGUS_DOCTYPE:{this._stateBogusDoctype(e);break}case g.CDATA_SECTION:{this._stateCdataSection(e);break}case g.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(e);break}case g.CDATA_SECTION_END:{this._stateCdataSectionEnd(e);break}case g.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case g.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(e);break}default:throw new Error("Unknown state")}}_stateData(e){switch(e){case B.LESS_THAN_SIGN:{this.state=g.TAG_OPEN;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.NULL:{this._err(U.unexpectedNullCharacter),this._emitCodePoint(e);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case B.AMPERSAND:{this._startCharacterReference();break}case B.LESS_THAN_SIGN:{this.state=g.RCDATA_LESS_THAN_SIGN;break}case B.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(pA);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case B.LESS_THAN_SIGN:{this.state=g.RAWTEXT_LESS_THAN_SIGN;break}case B.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(pA);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_LESS_THAN_SIGN;break}case B.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(pA);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case B.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(pA);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateTagOpen(e){if(Ke(e))this._createStartTagToken(),this.state=g.TAG_NAME,this._stateTagName(e);else switch(e){case B.EXCLAMATION_MARK:{this.state=g.MARKUP_DECLARATION_OPEN;break}case B.SOLIDUS:{this.state=g.END_TAG_OPEN;break}case B.QUESTION_MARK:{this._err(U.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=g.BOGUS_COMMENT,this._stateBogusComment(e);break}case B.EOF:{this._err(U.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(U.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=g.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(Ke(e))this._createEndTagToken(),this.state=g.TAG_NAME,this._stateTagName(e);else switch(e){case B.GREATER_THAN_SIGN:{this._err(U.missingEndTagName),this.state=g.DATA;break}case B.EOF:{this._err(U.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(U.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=g.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BEFORE_ATTRIBUTE_NAME;break}case B.SOLIDUS:{this.state=g.SELF_CLOSING_START_TAG;break}case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentTagToken();break}case B.NULL:{this._err(U.unexpectedNullCharacter),t.tagName+=pA;break}case B.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:t.tagName+=String.fromCodePoint(nr(e)?on(e):e)}}_stateRcdataLessThanSign(e){e===B.SOLIDUS?this.state=g.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=g.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){Ke(e)?(this.state=g.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars("</"),this.state=g.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const t=this.currentToken;switch(t.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=g.BEFORE_ATTRIBUTE_NAME,!1;case B.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=g.SELF_CLOSING_START_TAG,!1;case B.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=g.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=g.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===B.SOLIDUS?this.state=g.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=g.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){Ke(e)?(this.state=g.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars("</"),this.state=g.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=g.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case B.SOLIDUS:{this.state=g.SCRIPT_DATA_END_TAG_OPEN;break}case B.EXCLAMATION_MARK:{this.state=g.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=g.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){Ke(e)?(this.state=g.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars("</"),this.state=g.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=g.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===B.HYPHEN_MINUS?(this.state=g.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=g.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===B.HYPHEN_MINUS?(this.state=g.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=g.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case B.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(pA);break}case B.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case B.NULL:{this._err(U.unexpectedNullCharacter),this.state=g.SCRIPT_DATA_ESCAPED,this._emitChars(pA);break}case B.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=g.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case B.HYPHEN_MINUS:{this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case B.GREATER_THAN_SIGN:{this.state=g.SCRIPT_DATA,this._emitChars(">");break}case B.NULL:{this._err(U.unexpectedNullCharacter),this.state=g.SCRIPT_DATA_ESCAPED,this._emitChars(pA);break}case B.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=g.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===B.SOLIDUS?this.state=g.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Ke(e)?(this._emitChars("<"),this.state=g.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars("<"),this.state=g.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){Ke(e)?(this.state=g.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars("</"),this.state=g.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=g.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(ee.SCRIPT,!1)&&Ho(this.preprocessor.peek(ee.SCRIPT.length))){this._emitCodePoint(e);for(let t=0;t<ee.SCRIPT.length;t++)this._emitCodePoint(this._consume());this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=g.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case B.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(pA);break}case B.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case B.NULL:{this._err(U.unexpectedNullCharacter),this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(pA);break}case B.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case B.HYPHEN_MINUS:{this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case B.GREATER_THAN_SIGN:{this.state=g.SCRIPT_DATA,this._emitChars(">");break}case B.NULL:{this._err(U.unexpectedNullCharacter),this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(pA);break}case B.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===B.SOLIDUS?(this.state=g.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(ee.SCRIPT,!1)&&Ho(this.preprocessor.peek(ee.SCRIPT.length))){this._emitCodePoint(e);for(let t=0;t<ee.SCRIPT.length;t++)this._emitCodePoint(this._consume());this.state=g.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.SOLIDUS:case B.GREATER_THAN_SIGN:case B.EOF:{this.state=g.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case B.EQUALS_SIGN:{this._err(U.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=g.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=g.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:case B.SOLIDUS:case B.GREATER_THAN_SIGN:case B.EOF:{this._leaveAttrName(),this.state=g.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case B.EQUALS_SIGN:{this._leaveAttrName(),this.state=g.BEFORE_ATTRIBUTE_VALUE;break}case B.QUOTATION_MARK:case B.APOSTROPHE:case B.LESS_THAN_SIGN:{this._err(U.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break}case B.NULL:{this._err(U.unexpectedNullCharacter),this.currentAttr.name+=pA;break}default:this.currentAttr.name+=String.fromCodePoint(nr(e)?on(e):e)}}_stateAfterAttributeName(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.SOLIDUS:{this.state=g.SELF_CLOSING_START_TAG;break}case B.EQUALS_SIGN:{this.state=g.BEFORE_ATTRIBUTE_VALUE;break}case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentTagToken();break}case B.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=g.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.QUOTATION_MARK:{this.state=g.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this.state=g.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(U.missingAttributeValue),this.state=g.DATA,this.emitCurrentTagToken();break}default:this.state=g.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case B.QUOTATION_MARK:{this.state=g.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.NULL:{this._err(U.unexpectedNullCharacter),this.currentAttr.value+=pA;break}case B.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case B.APOSTROPHE:{this.state=g.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.NULL:{this._err(U.unexpectedNullCharacter),this.currentAttr.value+=pA;break}case B.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this._leaveAttrValue(),this.state=g.BEFORE_ATTRIBUTE_NAME;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=g.DATA,this.emitCurrentTagToken();break}case B.NULL:{this._err(U.unexpectedNullCharacter),this.currentAttr.value+=pA;break}case B.QUOTATION_MARK:case B.APOSTROPHE:case B.LESS_THAN_SIGN:case B.EQUALS_SIGN:case B.GRAVE_ACCENT:{this._err(U.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break}case B.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this._leaveAttrValue(),this.state=g.BEFORE_ATTRIBUTE_NAME;break}case B.SOLIDUS:{this._leaveAttrValue(),this.state=g.SELF_CLOSING_START_TAG;break}case B.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=g.DATA,this.emitCurrentTagToken();break}case B.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:this._err(U.missingWhitespaceBetweenAttributes),this.state=g.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case B.GREATER_THAN_SIGN:{const t=this.currentToken;t.selfClosing=!0,this.state=g.DATA,this.emitCurrentTagToken();break}case B.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:this._err(U.unexpectedSolidusInTag),this.state=g.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){const t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentComment(t);break}case B.EOF:{this.emitCurrentComment(t),this._emitEOFToken();break}case B.NULL:{this._err(U.unexpectedNullCharacter),t.data+=pA;break}default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(ee.DASH_DASH,!0)?(this._createCommentToken(ee.DASH_DASH.length+1),this.state=g.COMMENT_START):this._consumeSequenceIfMatch(ee.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(ee.DOCTYPE.length+1),this.state=g.DOCTYPE):this._consumeSequenceIfMatch(ee.CDATA_START,!0)?this.inForeignNode?this.state=g.CDATA_SECTION:(this._err(U.cdataInHtmlContent),this._createCommentToken(ee.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=g.BOGUS_COMMENT):this._ensureHibernation()||(this._err(U.incorrectlyOpenedComment),this._createCommentToken(2),this.state=g.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.COMMENT_START_DASH;break}case B.GREATER_THAN_SIGN:{this._err(U.abruptClosingOfEmptyComment),this.state=g.DATA;const t=this.currentToken;this.emitCurrentComment(t);break}default:this.state=g.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){const t=this.currentToken;switch(e){case B.HYPHEN_MINUS:{this.state=g.COMMENT_END;break}case B.GREATER_THAN_SIGN:{this._err(U.abruptClosingOfEmptyComment),this.state=g.DATA,this.emitCurrentComment(t);break}case B.EOF:{this._err(U.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+="-",this.state=g.COMMENT,this._stateComment(e)}}_stateComment(e){const t=this.currentToken;switch(e){case B.HYPHEN_MINUS:{this.state=g.COMMENT_END_DASH;break}case B.LESS_THAN_SIGN:{t.data+="<",this.state=g.COMMENT_LESS_THAN_SIGN;break}case B.NULL:{this._err(U.unexpectedNullCharacter),t.data+=pA;break}case B.EOF:{this._err(U.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){const t=this.currentToken;switch(e){case B.EXCLAMATION_MARK:{t.data+="!",this.state=g.COMMENT_LESS_THAN_SIGN_BANG;break}case B.LESS_THAN_SIGN:{t.data+="<";break}default:this.state=g.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===B.HYPHEN_MINUS?this.state=g.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=g.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===B.HYPHEN_MINUS?this.state=g.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=g.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==B.GREATER_THAN_SIGN&&e!==B.EOF&&this._err(U.nestedComment),this.state=g.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){const t=this.currentToken;switch(e){case B.HYPHEN_MINUS:{this.state=g.COMMENT_END;break}case B.EOF:{this._err(U.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+="-",this.state=g.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){const t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentComment(t);break}case B.EXCLAMATION_MARK:{this.state=g.COMMENT_END_BANG;break}case B.HYPHEN_MINUS:{t.data+="-";break}case B.EOF:{this._err(U.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+="--",this.state=g.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){const t=this.currentToken;switch(e){case B.HYPHEN_MINUS:{t.data+="--!",this.state=g.COMMENT_END_DASH;break}case B.GREATER_THAN_SIGN:{this._err(U.incorrectlyClosedComment),this.state=g.DATA,this.emitCurrentComment(t);break}case B.EOF:{this._err(U.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+="--!",this.state=g.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BEFORE_DOCTYPE_NAME;break}case B.GREATER_THAN_SIGN:{this.state=g.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break}case B.EOF:{this._err(U.eofInDoctype),this._createDoctypeToken(null);const t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(U.missingWhitespaceBeforeDoctypeName),this.state=g.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(nr(e))this._createDoctypeToken(String.fromCharCode(on(e))),this.state=g.DOCTYPE_NAME;else switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.NULL:{this._err(U.unexpectedNullCharacter),this._createDoctypeToken(pA),this.state=g.DOCTYPE_NAME;break}case B.GREATER_THAN_SIGN:{this._err(U.missingDoctypeName),this._createDoctypeToken(null);const t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(U.eofInDoctype),this._createDoctypeToken(null);const t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=g.DOCTYPE_NAME}}_stateDoctypeName(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.AFTER_DOCTYPE_NAME;break}case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.NULL:{this._err(U.unexpectedNullCharacter),t.name+=pA;break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.name+=String.fromCodePoint(nr(e)?on(e):e)}}_stateAfterDoctypeName(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(ee.PUBLIC,!1)?this.state=g.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(ee.SYSTEM,!1)?this.state=g.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(U.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case B.QUOTATION_MARK:{this._err(U.missingWhitespaceAfterDoctypePublicKeyword),t.publicId="",this.state=g.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this._err(U.missingWhitespaceAfterDoctypePublicKeyword),t.publicId="",this.state=g.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(U.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(U.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.QUOTATION_MARK:{t.publicId="",this.state=g.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{t.publicId="",this.state=g.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(U.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(U.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){const t=this.currentToken;switch(e){case B.QUOTATION_MARK:{this.state=g.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case B.NULL:{this._err(U.unexpectedNullCharacter),t.publicId+=pA;break}case B.GREATER_THAN_SIGN:{this._err(U.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){const t=this.currentToken;switch(e){case B.APOSTROPHE:{this.state=g.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case B.NULL:{this._err(U.unexpectedNullCharacter),t.publicId+=pA;break}case B.GREATER_THAN_SIGN:{this._err(U.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.QUOTATION_MARK:{this._err(U.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this._err(U.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(U.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.GREATER_THAN_SIGN:{this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.QUOTATION_MARK:{t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(U.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case B.QUOTATION_MARK:{this._err(U.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this._err(U.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(U.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(U.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.QUOTATION_MARK:{t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(U.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(U.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){const t=this.currentToken;switch(e){case B.QUOTATION_MARK:{this.state=g.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case B.NULL:{this._err(U.unexpectedNullCharacter),t.systemId+=pA;break}case B.GREATER_THAN_SIGN:{this._err(U.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){const t=this.currentToken;switch(e){case B.APOSTROPHE:{this.state=g.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case B.NULL:{this._err(U.unexpectedNullCharacter),t.systemId+=pA;break}case B.GREATER_THAN_SIGN:{this._err(U.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.GREATER_THAN_SIGN:{this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(U.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){const t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:{this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.NULL:{this._err(U.unexpectedNullCharacter);break}case B.EOF:{this.emitCurrentDoctype(t),this._emitEOFToken();break}}}_stateCdataSection(e){switch(e){case B.RIGHT_SQUARE_BRACKET:{this.state=g.CDATA_SECTION_BRACKET;break}case B.EOF:{this._err(U.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===B.RIGHT_SQUARE_BRACKET?this.state=g.CDATA_SECTION_END:(this._emitChars("]"),this.state=g.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case B.GREATER_THAN_SIGN:{this.state=g.DATA;break}case B.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=g.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0)if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(B.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&So(this.preprocessor.peek(1))?g.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){So(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===B.SEMICOLON&&this._err(U.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}};const Do=new Set([o.DD,o.DT,o.LI,o.OPTGROUP,o.OPTION,o.P,o.RB,o.RP,o.RT,o.RTC]),Oo=new Set([...Do,o.CAPTION,o.COLGROUP,o.TBODY,o.TD,o.TFOOT,o.TH,o.THEAD,o.TR]),un=new Set([o.APPLET,o.CAPTION,o.HTML,o.MARQUEE,o.OBJECT,o.TABLE,o.TD,o.TEMPLATE,o.TH]),Ph=new Set([...un,o.OL,o.UL]),Kh=new Set([...un,o.BUTTON]),Ro=new Set([o.ANNOTATION_XML,o.MI,o.MN,o.MO,o.MS,o.MTEXT]),Mo=new Set([o.DESC,o.FOREIGN_OBJECT,o.TITLE]),Vh=new Set([o.TR,o.TEMPLATE,o.HTML]),Gh=new Set([o.TBODY,o.TFOOT,o.THEAD,o.TEMPLATE,o.HTML]),Yh=new Set([o.TABLE,o.TEMPLATE,o.HTML]),Xh=new Set([o.TD,o.TH]);class Wh{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,r){this.treeAdapter=t,this.handler=r,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=o.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===o.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===I.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){const e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){const r=this._indexOf(e);this.items[r]=t,r===this.stackTop&&(this.current=t)}insertAfter(e,t,r){const n=this._indexOf(e)+1;this.items.splice(n,0,t),this.tagIDs.splice(n,0,r),this.stackTop++,n===this.stackTop&&this._updateCurrentElement(),this.handler.onItemPush(this.current,this.currentTagId,n===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do t=this.tagIDs.lastIndexOf(e,t-1);while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==I.HTML);this.shortenToLength(t<0?0:t)}shortenToLength(e){for(;this.stackTop>=e;){const t=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){const t=this._indexOf(e);this.shortenToLength(t<0?0:t)}popUntilPopped(e,t){const r=this._indexOfTagNames(e,t);this.shortenToLength(r<0?0:r)}popUntilNumberedHeaderPopped(){this.popUntilPopped(ti,I.HTML)}popUntilTableCellPopped(){this.popUntilPopped(Xh,I.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let r=this.stackTop;r>=0;r--)if(e.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===t)return r;return-1}clearBackTo(e,t){const r=this._indexOfTagNames(e,t);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(Yh,I.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Gh,I.HTML)}clearBackToTableRowContext(){this.clearBackTo(Vh,I.HTML)}remove(e){const t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===o.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){const t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===o.HTML}hasInDynamicScope(e,t){for(let r=this.stackTop;r>=0;r--){const n=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case I.HTML:{if(n===e)return!0;if(t.has(n))return!1;break}case I.SVG:{if(Mo.has(n))return!1;break}case I.MATHML:{if(Ro.has(n))return!1;break}}}return!0}hasInScope(e){return this.hasInDynamicScope(e,un)}hasInListItemScope(e){return this.hasInDynamicScope(e,Ph)}hasInButtonScope(e){return this.hasInDynamicScope(e,Kh)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){const t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case I.HTML:{if(ti.has(t))return!0;if(un.has(t))return!1;break}case I.SVG:{if(Mo.has(t))return!1;break}case I.MATHML:{if(Ro.has(t))return!1;break}}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===I.HTML)switch(this.tagIDs[t]){case e:return!0;case o.TABLE:case o.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===I.HTML)switch(this.tagIDs[e]){case o.TBODY:case o.THEAD:case o.TFOOT:return!0;case o.TABLE:case o.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===I.HTML)switch(this.tagIDs[t]){case e:return!0;case o.OPTION:case o.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;Do.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;Oo.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==e&&Oo.has(this.currentTagId);)this.pop()}}const ri=3;var Te;(function(A){A[A.Marker=0]="Marker",A[A.Element=1]="Element"})(Te||(Te={}));const ko={type:Te.Marker};class Jh{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){const r=[],n=t.length,a=this.treeAdapter.getTagName(e),i=this.treeAdapter.getNamespaceURI(e);for(let s=0;s<this.entries.length;s++){const u=this.entries[s];if(u.type===Te.Marker)break;const{element:l}=u;if(this.treeAdapter.getTagName(l)===a&&this.treeAdapter.getNamespaceURI(l)===i){const d=this.treeAdapter.getAttrList(l);d.length===n&&r.push({idx:s,attrs:d})}}return r}_ensureNoahArkCondition(e){if(this.entries.length<ri)return;const t=this.treeAdapter.getAttrList(e),r=this._getNoahArkConditionCandidates(e,t);if(r.length<ri)return;const n=new Map(t.map(i=>[i.name,i.value]));let a=0;for(let i=0;i<r.length;i++){const s=r[i];s.attrs.every(u=>n.get(u.name)===u.value)&&(a+=1,a>=ri&&this.entries.splice(s.idx,1))}}insertMarker(){this.entries.unshift(ko)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:Te.Element,element:e,token:t})}insertElementAfterBookmark(e,t){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:Te.Element,element:e,token:t})}removeEntry(e){const t=this.entries.indexOf(e);t>=0&&this.entries.splice(t,1)}clearToLastMarker(){const e=this.entries.indexOf(ko);e>=0?this.entries.splice(0,e+1):this.entries.length=0}getElementEntryInScopeWithTagName(e){const t=this.entries.find(r=>r.type===Te.Marker||this.treeAdapter.getTagName(r.element)===e);return t&&t.type===Te.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===Te.Element&&t.element===e)}}const _e={createDocument(){return{nodeName:"#document",mode:se.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(A,e,t){return{nodeName:A,tagName:A,attrs:t,namespaceURI:e,childNodes:[],parentNode:null}},createCommentNode(A){return{nodeName:"#comment",data:A,parentNode:null}},createTextNode(A){return{nodeName:"#text",value:A,parentNode:null}},appendChild(A,e){A.childNodes.push(e),e.parentNode=A},insertBefore(A,e,t){const r=A.childNodes.indexOf(t);A.childNodes.splice(r,0,e),e.parentNode=A},setTemplateContent(A,e){A.content=e},getTemplateContent(A){return A.content},setDocumentType(A,e,t,r){const n=A.childNodes.find(a=>a.nodeName==="#documentType");if(n)n.name=e,n.publicId=t,n.systemId=r;else{const a={nodeName:"#documentType",name:e,publicId:t,systemId:r,parentNode:null};_e.appendChild(A,a)}},setDocumentMode(A,e){A.mode=e},getDocumentMode(A){return A.mode},detachNode(A){if(A.parentNode){const e=A.parentNode.childNodes.indexOf(A);A.parentNode.childNodes.splice(e,1),A.parentNode=null}},insertText(A,e){if(A.childNodes.length>0){const t=A.childNodes[A.childNodes.length-1];if(_e.isTextNode(t)){t.value+=e;return}}_e.appendChild(A,_e.createTextNode(e))},insertTextBefore(A,e,t){const r=A.childNodes[A.childNodes.indexOf(t)-1];r&&_e.isTextNode(r)?r.value+=e:_e.insertBefore(A,_e.createTextNode(e),t)},adoptAttributes(A,e){const t=new Set(A.attrs.map(r=>r.name));for(let r=0;r<e.length;r++)t.has(e[r].name)||A.attrs.push(e[r])},getFirstChild(A){return A.childNodes[0]},getChildNodes(A){return A.childNodes},getParentNode(A){return A.parentNode},getAttrList(A){return A.attrs},getTagName(A){return A.tagName},getNamespaceURI(A){return A.namespaceURI},getTextNodeContent(A){return A.value},getCommentNodeContent(A){return A.data},getDocumentTypeNodeName(A){return A.name},getDocumentTypeNodePublicId(A){return A.publicId},getDocumentTypeNodeSystemId(A){return A.systemId},isTextNode(A){return A.nodeName==="#text"},isCommentNode(A){return A.nodeName==="#comment"},isDocumentTypeNode(A){return A.nodeName==="#documentType"},isElementNode(A){return Object.prototype.hasOwnProperty.call(A,"tagName")},setNodeSourceCodeLocation(A,e){A.sourceCodeLocation=e},getNodeSourceCodeLocation(A){return A.sourceCodeLocation},updateNodeSourceCodeLocation(A,e){A.sourceCodeLocation={...A.sourceCodeLocation,...e}}},Po="html",qh="about:legacy-compat",jh="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",Ko=["+//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//"],zh=[...Ko,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],$h=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),Vo=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],Zh=[...Vo,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function Go(A,e){return e.some(t=>A.startsWith(t))}function AB(A){return A.name===Po&&A.publicId===null&&(A.systemId===null||A.systemId===qh)}function eB(A){if(A.name!==Po)return se.QUIRKS;const{systemId:e}=A;if(e&&e.toLowerCase()===jh)return se.QUIRKS;let{publicId:t}=A;if(t!==null){if(t=t.toLowerCase(),$h.has(t))return se.QUIRKS;let r=e===null?zh:Ko;if(Go(t,r))return se.QUIRKS;if(r=e===null?Vo:Zh,Go(t,r))return se.LIMITED_QUIRKS}return se.NO_QUIRKS}const Yo={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},tB="definitionurl",rB="definitionURL",nB=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(A=>[A.toLowerCase(),A])),aB=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:I.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:I.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:I.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:I.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:I.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:I.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:I.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:I.XML}],["xml:space",{prefix:"xml",name:"space",namespace:I.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:I.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:I.XMLNS}]]),iB=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(A=>[A.toLowerCase(),A])),sB=new Set([o.B,o.BIG,o.BLOCKQUOTE,o.BODY,o.BR,o.CENTER,o.CODE,o.DD,o.DIV,o.DL,o.DT,o.EM,o.EMBED,o.H1,o.H2,o.H3,o.H4,o.H5,o.H6,o.HEAD,o.HR,o.I,o.IMG,o.LI,o.LISTING,o.MENU,o.META,o.NOBR,o.OL,o.P,o.PRE,o.RUBY,o.S,o.SMALL,o.SPAN,o.STRONG,o.STRIKE,o.SUB,o.SUP,o.TABLE,o.TT,o.U,o.UL,o.VAR]);function oB(A){const e=A.tagID;return e===o.FONT&&A.attrs.some(({name:r})=>r===ut.COLOR||r===ut.SIZE||r===ut.FACE)||sB.has(e)}function Xo(A){for(let e=0;e<A.attrs.length;e++)if(A.attrs[e].name===tB){A.attrs[e].name=rB;break}}function Wo(A){for(let e=0;e<A.attrs.length;e++){const t=nB.get(A.attrs[e].name);t!=null&&(A.attrs[e].name=t)}}function ni(A){for(let e=0;e<A.attrs.length;e++){const t=aB.get(A.attrs[e].name);t&&(A.attrs[e].prefix=t.prefix,A.attrs[e].name=t.name,A.attrs[e].namespace=t.namespace)}}function uB(A){const e=iB.get(A.tagName);e!=null&&(A.tagName=e,A.tagID=sn(A.tagName))}function cB(A,e){return e===I.MATHML&&(A===o.MI||A===o.MO||A===o.MN||A===o.MS||A===o.MTEXT)}function lB(A,e,t){if(e===I.MATHML&&A===o.ANNOTATION_XML){for(let r=0;r<t.length;r++)if(t[r].name===ut.ENCODING){const n=t[r].value.toLowerCase();return n===Yo.TEXT_HTML||n===Yo.APPLICATION_XML}}return e===I.SVG&&(A===o.FOREIGN_OBJECT||A===o.DESC||A===o.TITLE)}function dB(A,e,t,r){return(!r||r===I.HTML)&&lB(A,e,t)||(!r||r===I.MATHML)&&cB(A,e)}const fB="hidden",hB=8,BB=3;var p;(function(A){A[A.INITIAL=0]="INITIAL",A[A.BEFORE_HTML=1]="BEFORE_HTML",A[A.BEFORE_HEAD=2]="BEFORE_HEAD",A[A.IN_HEAD=3]="IN_HEAD",A[A.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",A[A.AFTER_HEAD=5]="AFTER_HEAD",A[A.IN_BODY=6]="IN_BODY",A[A.TEXT=7]="TEXT",A[A.IN_TABLE=8]="IN_TABLE",A[A.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",A[A.IN_CAPTION=10]="IN_CAPTION",A[A.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",A[A.IN_TABLE_BODY=12]="IN_TABLE_BODY",A[A.IN_ROW=13]="IN_ROW",A[A.IN_CELL=14]="IN_CELL",A[A.IN_SELECT=15]="IN_SELECT",A[A.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",A[A.IN_TEMPLATE=17]="IN_TEMPLATE",A[A.AFTER_BODY=18]="AFTER_BODY",A[A.IN_FRAMESET=19]="IN_FRAMESET",A[A.AFTER_FRAMESET=20]="AFTER_FRAMESET",A[A.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",A[A.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(p||(p={}));const gB={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},Jo=new Set([o.TABLE,o.TBODY,o.TFOOT,o.THEAD,o.TR]),qo={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:_e,onParseError:null};let jo=class{constructor(e,t,r=null,n=null){this.fragmentContext=r,this.scriptHandler=n,this.currentToken=null,this.stopped=!1,this.insertionMode=p.INITIAL,this.originalInsertionMode=p.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={...qo,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=t??this.treeAdapter.createDocument(),this.tokenizer=new kh(this.options,this),this.activeFormattingElements=new Jh(this.treeAdapter),this.fragmentContextID=r?sn(this.treeAdapter.getTagName(r)):o.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new Wh(this.document,this.treeAdapter,this)}static parse(e,t){const r=new this(t);return r.tokenizer.write(e,!0),r.document}static getFragmentParser(e,t){const r={...qo,...t};e??(e=r.treeAdapter.createElement(w.TEMPLATE,I.HTML,[]));const n=r.treeAdapter.createElement("documentmock",I.HTML,[]),a=new this(r,n,e);return a.fragmentContextID===o.TEMPLATE&&a.tmplInsertionModeStack.unshift(p.IN_TEMPLATE),a._initTokenizerForFragmentParsing(),a._insertFakeRootElement(),a._resetInsertionMode(),a._findFormInFragmentContext(),a}getFragment(){const e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,r){var n;if(!this.onParseError)return;const a=(n=e.location)!==null&&n!==void 0?n:gB,i={code:t,startLine:a.startLine,startCol:a.startCol,startOffset:a.startOffset,endLine:r?a.startLine:a.endLine,endCol:r?a.startCol:a.endCol,endOffset:r?a.startOffset:a.endOffset};this.onParseError(i)}onItemPush(e,t,r){var n,a;(a=(n=this.treeAdapter).onItemPush)===null||a===void 0||a.call(n,e),r&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var r,n;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(n=(r=this.treeAdapter).onItemPop)===null||n===void 0||n.call(r,e,this.openElements.current),t){let a,i;this.openElements.stackTop===0&&this.fragmentContext?(a=this.fragmentContext,i=this.fragmentContextID):{current:a,currentTagId:i}=this.openElements,this._setContextModes(a,i)}}_setContextModes(e,t){const r=e===this.document||this.treeAdapter.getNamespaceURI(e)===I.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,I.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=p.TEXT}switchToPlaintextParsing(){this.insertionMode=p.TEXT,this.originalInsertionMode=p.IN_BODY,this.tokenizer.state=te.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===w.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==I.HTML))switch(this.fragmentContextID){case o.TITLE:case o.TEXTAREA:{this.tokenizer.state=te.RCDATA;break}case o.STYLE:case o.XMP:case o.IFRAME:case o.NOEMBED:case o.NOFRAMES:case o.NOSCRIPT:{this.tokenizer.state=te.RAWTEXT;break}case o.SCRIPT:{this.tokenizer.state=te.SCRIPT_DATA;break}case o.PLAINTEXT:{this.tokenizer.state=te.PLAINTEXT;break}}}_setDocumentType(e){const t=e.name||"",r=e.publicId||"",n=e.systemId||"";if(this.treeAdapter.setDocumentType(this.document,t,r,n),e.location){const i=this.treeAdapter.getChildNodes(this.document).find(s=>this.treeAdapter.isDocumentTypeNode(s));i&&this.treeAdapter.setNodeSourceCodeLocation(i,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){const r=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r,e)}}_appendElement(e,t){const r=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(r,e.location)}_insertElement(e,t){const r=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(r,e.location),this.openElements.push(r,e.tagID)}_insertFakeElement(e,t){const r=this.treeAdapter.createElement(e,I.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,t)}_insertTemplate(e){const t=this.treeAdapter.createElement(e.tagName,I.HTML,e.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,r),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const e=this.treeAdapter.createElement(w.HTML,I.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,o.HTML)}_appendCommentNode(e,t){const r=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,e.location)}_insertCharacters(e){let t,r;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(t,e.chars,r):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;const n=this.treeAdapter.getChildNodes(t),a=r?n.lastIndexOf(r):n.length,i=n[a-1];if(this.treeAdapter.getNodeSourceCodeLocation(i)){const{endLine:u,endCol:l,endOffset:d}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(i,{endLine:u,endCol:l,endOffset:d})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,e.location)}_adoptNodes(e,t){for(let r=this.treeAdapter.getFirstChild(e);r;r=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(t,r)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){const r=t.location,n=this.treeAdapter.getTagName(e),a=t.type===tA.END_TAG&&n===t.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,a)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,r;return this.openElements.stackTop===0&&this.fragmentContext?(t=this.fragmentContext,r=this.fragmentContextID):{current:t,currentTagId:r}=this.openElements,e.tagID===o.SVG&&this.treeAdapter.getTagName(t)===w.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===I.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===o.MGLYPH||e.tagID===o.MALIGNMARK)&&!this._isIntegrationPoint(r,t,I.HTML)}_processToken(e){switch(e.type){case tA.CHARACTER:{this.onCharacter(e);break}case tA.NULL_CHARACTER:{this.onNullCharacter(e);break}case tA.COMMENT:{this.onComment(e);break}case tA.DOCTYPE:{this.onDoctype(e);break}case tA.START_TAG:{this._processStartTag(e);break}case tA.END_TAG:{this.onEndTag(e);break}case tA.EOF:{this.onEof(e);break}case tA.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(e);break}}}_isIntegrationPoint(e,t,r){const n=this.treeAdapter.getNamespaceURI(t),a=this.treeAdapter.getAttrList(t);return dB(e,n,a,r)}_reconstructActiveFormattingElements(){const e=this.activeFormattingElements.entries.length;if(e){const t=this.activeFormattingElements.entries.findIndex(n=>n.type===Te.Marker||this.openElements.contains(n.element)),r=t<0?e-1:t-1;for(let n=r;n>=0;n--){const a=this.activeFormattingElements.entries[n];this._insertElement(a.token,this.treeAdapter.getNamespaceURI(a.element)),a.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=p.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(o.P),this.openElements.popUntilTagNamePopped(o.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case o.TR:{this.insertionMode=p.IN_ROW;return}case o.TBODY:case o.THEAD:case o.TFOOT:{this.insertionMode=p.IN_TABLE_BODY;return}case o.CAPTION:{this.insertionMode=p.IN_CAPTION;return}case o.COLGROUP:{this.insertionMode=p.IN_COLUMN_GROUP;return}case o.TABLE:{this.insertionMode=p.IN_TABLE;return}case o.BODY:{this.insertionMode=p.IN_BODY;return}case o.FRAMESET:{this.insertionMode=p.IN_FRAMESET;return}case o.SELECT:{this._resetInsertionModeForSelect(e);return}case o.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case o.HTML:{this.insertionMode=this.headElement?p.AFTER_HEAD:p.BEFORE_HEAD;return}case o.TD:case o.TH:{if(e>0){this.insertionMode=p.IN_CELL;return}break}case o.HEAD:{if(e>0){this.insertionMode=p.IN_HEAD;return}break}}this.insertionMode=p.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){const r=this.openElements.tagIDs[t];if(r===o.TEMPLATE)break;if(r===o.TABLE){this.insertionMode=p.IN_SELECT_IN_TABLE;return}}this.insertionMode=p.IN_SELECT}_isElementCausesFosterParenting(e){return Jo.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){const t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case o.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(t)===I.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break}case o.TABLE:{const r=this.treeAdapter.getParentNode(t);return r?{parent:r,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){const t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){const r=this.treeAdapter.getNamespaceURI(e);return Lh[r].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Xg(this,e);return}switch(this.insertionMode){case p.INITIAL:{ar(this,e);break}case p.BEFORE_HTML:{ir(this,e);break}case p.BEFORE_HEAD:{sr(this,e);break}case p.IN_HEAD:{or(this,e);break}case p.IN_HEAD_NO_SCRIPT:{ur(this,e);break}case p.AFTER_HEAD:{cr(this,e);break}case p.IN_BODY:case p.IN_CAPTION:case p.IN_CELL:case p.IN_TEMPLATE:{$o(this,e);break}case p.TEXT:case p.IN_SELECT:case p.IN_SELECT_IN_TABLE:{this._insertCharacters(e);break}case p.IN_TABLE:case p.IN_TABLE_BODY:case p.IN_ROW:{oi(this,e);break}case p.IN_TABLE_TEXT:{iu(this,e);break}case p.IN_COLUMN_GROUP:{dn(this,e);break}case p.AFTER_BODY:{Bn(this,e);break}case p.AFTER_AFTER_BODY:{gn(this,e);break}}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Yg(this,e);return}switch(this.insertionMode){case p.INITIAL:{ar(this,e);break}case p.BEFORE_HTML:{ir(this,e);break}case p.BEFORE_HEAD:{sr(this,e);break}case p.IN_HEAD:{or(this,e);break}case p.IN_HEAD_NO_SCRIPT:{ur(this,e);break}case p.AFTER_HEAD:{cr(this,e);break}case p.TEXT:{this._insertCharacters(e);break}case p.IN_TABLE:case p.IN_TABLE_BODY:case p.IN_ROW:{oi(this,e);break}case p.IN_COLUMN_GROUP:{dn(this,e);break}case p.AFTER_BODY:{Bn(this,e);break}case p.AFTER_AFTER_BODY:{gn(this,e);break}}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){ii(this,e);return}switch(this.insertionMode){case p.INITIAL:case p.BEFORE_HTML:case p.BEFORE_HEAD:case p.IN_HEAD:case p.IN_HEAD_NO_SCRIPT:case p.AFTER_HEAD:case p.IN_BODY:case p.IN_TABLE:case p.IN_CAPTION:case p.IN_COLUMN_GROUP:case p.IN_TABLE_BODY:case p.IN_ROW:case p.IN_CELL:case p.IN_SELECT:case p.IN_SELECT_IN_TABLE:case p.IN_TEMPLATE:case p.IN_FRAMESET:case p.AFTER_FRAMESET:{ii(this,e);break}case p.IN_TABLE_TEXT:{fr(this,e);break}case p.AFTER_BODY:{TB(this,e);break}case p.AFTER_AFTER_BODY:case p.AFTER_AFTER_FRAMESET:{UB(this,e);break}}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case p.INITIAL:{QB(this,e);break}case p.BEFORE_HEAD:case p.IN_HEAD:case p.IN_HEAD_NO_SCRIPT:case p.AFTER_HEAD:{this._err(e,U.misplacedDoctype);break}case p.IN_TABLE_TEXT:{fr(this,e);break}}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,U.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?Wg(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case p.INITIAL:{ar(this,e);break}case p.BEFORE_HTML:{FB(this,e);break}case p.BEFORE_HEAD:{yB(this,e);break}case p.IN_HEAD:{pe(this,e);break}case p.IN_HEAD_NO_SCRIPT:{_B(this,e);break}case p.AFTER_HEAD:{SB(this,e);break}case p.IN_BODY:{KA(this,e);break}case p.IN_TABLE:{Ft(this,e);break}case p.IN_TABLE_TEXT:{fr(this,e);break}case p.IN_CAPTION:{xg(this,e);break}case p.IN_COLUMN_GROUP:{ui(this,e);break}case p.IN_TABLE_BODY:{fn(this,e);break}case p.IN_ROW:{hn(this,e);break}case p.IN_CELL:{Ng(this,e);break}case p.IN_SELECT:{uu(this,e);break}case p.IN_SELECT_IN_TABLE:{Lg(this,e);break}case p.IN_TEMPLATE:{Dg(this,e);break}case p.AFTER_BODY:{Rg(this,e);break}case p.IN_FRAMESET:{Mg(this,e);break}case p.AFTER_FRAMESET:{Pg(this,e);break}case p.AFTER_AFTER_BODY:{Vg(this,e);break}case p.AFTER_AFTER_FRAMESET:{Gg(this,e);break}}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?Jg(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case p.INITIAL:{ar(this,e);break}case p.BEFORE_HTML:{IB(this,e);break}case p.BEFORE_HEAD:{xB(this,e);break}case p.IN_HEAD:{vB(this,e);break}case p.IN_HEAD_NO_SCRIPT:{NB(this,e);break}case p.AFTER_HEAD:{LB(this,e);break}case p.IN_BODY:{ln(this,e);break}case p.TEXT:{Eg(this,e);break}case p.IN_TABLE:{lr(this,e);break}case p.IN_TABLE_TEXT:{fr(this,e);break}case p.IN_CAPTION:{vg(this,e);break}case p.IN_COLUMN_GROUP:{_g(this,e);break}case p.IN_TABLE_BODY:{ci(this,e);break}case p.IN_ROW:{ou(this,e);break}case p.IN_CELL:{Sg(this,e);break}case p.IN_SELECT:{cu(this,e);break}case p.IN_SELECT_IN_TABLE:{Hg(this,e);break}case p.IN_TEMPLATE:{Og(this,e);break}case p.AFTER_BODY:{du(this,e);break}case p.IN_FRAMESET:{kg(this,e);break}case p.AFTER_FRAMESET:{Kg(this,e);break}case p.AFTER_AFTER_BODY:{gn(this,e);break}}}onEof(e){switch(this.insertionMode){case p.INITIAL:{ar(this,e);break}case p.BEFORE_HTML:{ir(this,e);break}case p.BEFORE_HEAD:{sr(this,e);break}case p.IN_HEAD:{or(this,e);break}case p.IN_HEAD_NO_SCRIPT:{ur(this,e);break}case p.AFTER_HEAD:{cr(this,e);break}case p.IN_BODY:case p.IN_TABLE:case p.IN_CAPTION:case p.IN_COLUMN_GROUP:case p.IN_TABLE_BODY:case p.IN_ROW:case p.IN_CELL:case p.IN_SELECT:case p.IN_SELECT_IN_TABLE:{nu(this,e);break}case p.TEXT:{Cg(this,e);break}case p.IN_TABLE_TEXT:{fr(this,e);break}case p.IN_TEMPLATE:{lu(this,e);break}case p.AFTER_BODY:case p.IN_FRAMESET:case p.AFTER_FRAMESET:case p.AFTER_AFTER_BODY:case p.AFTER_AFTER_FRAMESET:{si(this,e);break}}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===B.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);return}switch(this.insertionMode){case p.IN_HEAD:case p.IN_HEAD_NO_SCRIPT:case p.AFTER_HEAD:case p.TEXT:case p.IN_COLUMN_GROUP:case p.IN_SELECT:case p.IN_SELECT_IN_TABLE:case p.IN_FRAMESET:case p.AFTER_FRAMESET:{this._insertCharacters(e);break}case p.IN_BODY:case p.IN_CAPTION:case p.IN_CELL:case p.IN_TEMPLATE:case p.AFTER_BODY:case p.AFTER_AFTER_BODY:case p.AFTER_AFTER_FRAMESET:{zo(this,e);break}case p.IN_TABLE:case p.IN_TABLE_BODY:case p.IN_ROW:{oi(this,e);break}case p.IN_TABLE_TEXT:{au(this,e);break}}}};function pB(A,e){let t=A.activeFormattingElements.getElementEntryInScopeWithTagName(e.tagName);return t?A.openElements.contains(t.element)?A.openElements.hasInScope(e.tagID)||(t=null):(A.activeFormattingElements.removeEntry(t),t=null):ru(A,e),t}function mB(A,e){let t=null,r=A.openElements.stackTop;for(;r>=0;r--){const n=A.openElements.items[r];if(n===e.element)break;A._isSpecialElement(n,A.openElements.tagIDs[r])&&(t=n)}return t||(A.openElements.shortenToLength(r<0?0:r),A.activeFormattingElements.removeEntry(e)),t}function EB(A,e,t){let r=e,n=A.openElements.getCommonAncestor(e);for(let a=0,i=n;i!==t;a++,i=n){n=A.openElements.getCommonAncestor(i);const s=A.activeFormattingElements.getElementEntry(i),u=s&&a>=BB;!s||u?(u&&A.activeFormattingElements.removeEntry(s),A.openElements.remove(i)):(i=CB(A,s),r===e&&(A.activeFormattingElements.bookmark=s),A.treeAdapter.detachNode(r),A.treeAdapter.appendChild(i,r),r=i)}return r}function CB(A,e){const t=A.treeAdapter.getNamespaceURI(e.element),r=A.treeAdapter.createElement(e.token.tagName,t,e.token.attrs);return A.openElements.replace(e.element,r),e.element=r,r}function wB(A,e,t){const r=A.treeAdapter.getTagName(e),n=sn(r);if(A._isElementCausesFosterParenting(n))A._fosterParentElement(t);else{const a=A.treeAdapter.getNamespaceURI(e);n===o.TEMPLATE&&a===I.HTML&&(e=A.treeAdapter.getTemplateContent(e)),A.treeAdapter.appendChild(e,t)}}function bB(A,e,t){const r=A.treeAdapter.getNamespaceURI(t.element),{token:n}=t,a=A.treeAdapter.createElement(n.tagName,r,n.attrs);A._adoptNodes(e,a),A.treeAdapter.appendChild(e,a),A.activeFormattingElements.insertElementAfterBookmark(a,n),A.activeFormattingElements.removeEntry(t),A.openElements.remove(t.element),A.openElements.insertAfter(e,a,n.tagID)}function ai(A,e){for(let t=0;t<hB;t++){const r=pB(A,e);if(!r)break;const n=mB(A,r);if(!n)break;A.activeFormattingElements.bookmark=r;const a=EB(A,n,r.element),i=A.openElements.getCommonAncestor(r.element);A.treeAdapter.detachNode(a),i&&wB(A,i,a),bB(A,n,r)}}function ii(A,e){A._appendCommentNode(e,A.openElements.currentTmplContentOrNode)}function TB(A,e){A._appendCommentNode(e,A.openElements.items[0])}function UB(A,e){A._appendCommentNode(e,A.document)}function si(A,e){if(A.stopped=!0,e.location){const t=A.fragmentContext?0:2;for(let r=A.openElements.stackTop;r>=t;r--)A._setEndLocation(A.openElements.items[r],e);if(!A.fragmentContext&&A.openElements.stackTop>=0){const r=A.openElements.items[0],n=A.treeAdapter.getNodeSourceCodeLocation(r);if(n&&!n.endTag&&(A._setEndLocation(r,e),A.openElements.stackTop>=1)){const a=A.openElements.items[1],i=A.treeAdapter.getNodeSourceCodeLocation(a);i&&!i.endTag&&A._setEndLocation(a,e)}}}}function QB(A,e){A._setDocumentType(e);const t=e.forceQuirks?se.QUIRKS:eB(e);AB(e)||A._err(e,U.nonConformingDoctype),A.treeAdapter.setDocumentMode(A.document,t),A.insertionMode=p.BEFORE_HTML}function ar(A,e){A._err(e,U.missingDoctype,!0),A.treeAdapter.setDocumentMode(A.document,se.QUIRKS),A.insertionMode=p.BEFORE_HTML,A._processToken(e)}function FB(A,e){e.tagID===o.HTML?(A._insertElement(e,I.HTML),A.insertionMode=p.BEFORE_HEAD):ir(A,e)}function IB(A,e){const t=e.tagID;(t===o.HTML||t===o.HEAD||t===o.BODY||t===o.BR)&&ir(A,e)}function ir(A,e){A._insertFakeRootElement(),A.insertionMode=p.BEFORE_HEAD,A._processToken(e)}function yB(A,e){switch(e.tagID){case o.HTML:{KA(A,e);break}case o.HEAD:{A._insertElement(e,I.HTML),A.headElement=A.openElements.current,A.insertionMode=p.IN_HEAD;break}default:sr(A,e)}}function xB(A,e){const t=e.tagID;t===o.HEAD||t===o.BODY||t===o.HTML||t===o.BR?sr(A,e):A._err(e,U.endTagWithoutMatchingOpenElement)}function sr(A,e){A._insertFakeElement(w.HEAD,o.HEAD),A.headElement=A.openElements.current,A.insertionMode=p.IN_HEAD,A._processToken(e)}function pe(A,e){switch(e.tagID){case o.HTML:{KA(A,e);break}case o.BASE:case o.BASEFONT:case o.BGSOUND:case o.LINK:case o.META:{A._appendElement(e,I.HTML),e.ackSelfClosing=!0;break}case o.TITLE:{A._switchToTextParsing(e,te.RCDATA);break}case o.NOSCRIPT:{A.options.scriptingEnabled?A._switchToTextParsing(e,te.RAWTEXT):(A._insertElement(e,I.HTML),A.insertionMode=p.IN_HEAD_NO_SCRIPT);break}case o.NOFRAMES:case o.STYLE:{A._switchToTextParsing(e,te.RAWTEXT);break}case o.SCRIPT:{A._switchToTextParsing(e,te.SCRIPT_DATA);break}case o.TEMPLATE:{A._insertTemplate(e),A.activeFormattingElements.insertMarker(),A.framesetOk=!1,A.insertionMode=p.IN_TEMPLATE,A.tmplInsertionModeStack.unshift(p.IN_TEMPLATE);break}case o.HEAD:{A._err(e,U.misplacedStartTagForHeadElement);break}default:or(A,e)}}function vB(A,e){switch(e.tagID){case o.HEAD:{A.openElements.pop(),A.insertionMode=p.AFTER_HEAD;break}case o.BODY:case o.BR:case o.HTML:{or(A,e);break}case o.TEMPLATE:{ct(A,e);break}default:A._err(e,U.endTagWithoutMatchingOpenElement)}}function ct(A,e){A.openElements.tmplCount>0?(A.openElements.generateImpliedEndTagsThoroughly(),A.openElements.currentTagId!==o.TEMPLATE&&A._err(e,U.closingOfElementWithOpenChildElements),A.openElements.popUntilTagNamePopped(o.TEMPLATE),A.activeFormattingElements.clearToLastMarker(),A.tmplInsertionModeStack.shift(),A._resetInsertionMode()):A._err(e,U.endTagWithoutMatchingOpenElement)}function or(A,e){A.openElements.pop(),A.insertionMode=p.AFTER_HEAD,A._processToken(e)}function _B(A,e){switch(e.tagID){case o.HTML:{KA(A,e);break}case o.BASEFONT:case o.BGSOUND:case o.HEAD:case o.LINK:case o.META:case o.NOFRAMES:case o.STYLE:{pe(A,e);break}case o.NOSCRIPT:{A._err(e,U.nestedNoscriptInHead);break}default:ur(A,e)}}function NB(A,e){switch(e.tagID){case o.NOSCRIPT:{A.openElements.pop(),A.insertionMode=p.IN_HEAD;break}case o.BR:{ur(A,e);break}default:A._err(e,U.endTagWithoutMatchingOpenElement)}}function ur(A,e){const t=e.type===tA.EOF?U.openElementsLeftAfterEof:U.disallowedContentInNoscriptInHead;A._err(e,t),A.openElements.pop(),A.insertionMode=p.IN_HEAD,A._processToken(e)}function SB(A,e){switch(e.tagID){case o.HTML:{KA(A,e);break}case o.BODY:{A._insertElement(e,I.HTML),A.framesetOk=!1,A.insertionMode=p.IN_BODY;break}case o.FRAMESET:{A._insertElement(e,I.HTML),A.insertionMode=p.IN_FRAMESET;break}case o.BASE:case o.BASEFONT:case o.BGSOUND:case o.LINK:case o.META:case o.NOFRAMES:case o.SCRIPT:case o.STYLE:case o.TEMPLATE:case o.TITLE:{A._err(e,U.abandonedHeadElementChild),A.openElements.push(A.headElement,o.HEAD),pe(A,e),A.openElements.remove(A.headElement);break}case o.HEAD:{A._err(e,U.misplacedStartTagForHeadElement);break}default:cr(A,e)}}function LB(A,e){switch(e.tagID){case o.BODY:case o.HTML:case o.BR:{cr(A,e);break}case o.TEMPLATE:{ct(A,e);break}default:A._err(e,U.endTagWithoutMatchingOpenElement)}}function cr(A,e){A._insertFakeElement(w.BODY,o.BODY),A.insertionMode=p.IN_BODY,cn(A,e)}function cn(A,e){switch(e.type){case tA.CHARACTER:{$o(A,e);break}case tA.WHITESPACE_CHARACTER:{zo(A,e);break}case tA.COMMENT:{ii(A,e);break}case tA.START_TAG:{KA(A,e);break}case tA.END_TAG:{ln(A,e);break}case tA.EOF:{nu(A,e);break}}}function zo(A,e){A._reconstructActiveFormattingElements(),A._insertCharacters(e)}function $o(A,e){A._reconstructActiveFormattingElements(),A._insertCharacters(e),A.framesetOk=!1}function HB(A,e){A.openElements.tmplCount===0&&A.treeAdapter.adoptAttributes(A.openElements.items[0],e.attrs)}function DB(A,e){const t=A.openElements.tryPeekProperlyNestedBodyElement();t&&A.openElements.tmplCount===0&&(A.framesetOk=!1,A.treeAdapter.adoptAttributes(t,e.attrs))}function OB(A,e){const t=A.openElements.tryPeekProperlyNestedBodyElement();A.framesetOk&&t&&(A.treeAdapter.detachNode(t),A.openElements.popAllUpToHtmlElement(),A._insertElement(e,I.HTML),A.insertionMode=p.IN_FRAMESET)}function RB(A,e){A.openElements.hasInButtonScope(o.P)&&A._closePElement(),A._insertElement(e,I.HTML)}function MB(A,e){A.openElements.hasInButtonScope(o.P)&&A._closePElement(),ti.has(A.openElements.currentTagId)&&A.openElements.pop(),A._insertElement(e,I.HTML)}function kB(A,e){A.openElements.hasInButtonScope(o.P)&&A._closePElement(),A._insertElement(e,I.HTML),A.skipNextNewLine=!0,A.framesetOk=!1}function PB(A,e){const t=A.openElements.tmplCount>0;(!A.formElement||t)&&(A.openElements.hasInButtonScope(o.P)&&A._closePElement(),A._insertElement(e,I.HTML),t||(A.formElement=A.openElements.current))}function KB(A,e){A.framesetOk=!1;const t=e.tagID;for(let r=A.openElements.stackTop;r>=0;r--){const n=A.openElements.tagIDs[r];if(t===o.LI&&n===o.LI||(t===o.DD||t===o.DT)&&(n===o.DD||n===o.DT)){A.openElements.generateImpliedEndTagsWithExclusion(n),A.openElements.popUntilTagNamePopped(n);break}if(n!==o.ADDRESS&&n!==o.DIV&&n!==o.P&&A._isSpecialElement(A.openElements.items[r],n))break}A.openElements.hasInButtonScope(o.P)&&A._closePElement(),A._insertElement(e,I.HTML)}function VB(A,e){A.openElements.hasInButtonScope(o.P)&&A._closePElement(),A._insertElement(e,I.HTML),A.tokenizer.state=te.PLAINTEXT}function GB(A,e){A.openElements.hasInScope(o.BUTTON)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(o.BUTTON)),A._reconstructActiveFormattingElements(),A._insertElement(e,I.HTML),A.framesetOk=!1}function YB(A,e){const t=A.activeFormattingElements.getElementEntryInScopeWithTagName(w.A);t&&(ai(A,e),A.openElements.remove(t.element),A.activeFormattingElements.removeEntry(t)),A._reconstructActiveFormattingElements(),A._insertElement(e,I.HTML),A.activeFormattingElements.pushElement(A.openElements.current,e)}function XB(A,e){A._reconstructActiveFormattingElements(),A._insertElement(e,I.HTML),A.activeFormattingElements.pushElement(A.openElements.current,e)}function WB(A,e){A._reconstructActiveFormattingElements(),A.openElements.hasInScope(o.NOBR)&&(ai(A,e),A._reconstructActiveFormattingElements()),A._insertElement(e,I.HTML),A.activeFormattingElements.pushElement(A.openElements.current,e)}function JB(A,e){A._reconstructActiveFormattingElements(),A._insertElement(e,I.HTML),A.activeFormattingElements.insertMarker(),A.framesetOk=!1}function qB(A,e){A.treeAdapter.getDocumentMode(A.document)!==se.QUIRKS&&A.openElements.hasInButtonScope(o.P)&&A._closePElement(),A._insertElement(e,I.HTML),A.framesetOk=!1,A.insertionMode=p.IN_TABLE}function Zo(A,e){A._reconstructActiveFormattingElements(),A._appendElement(e,I.HTML),A.framesetOk=!1,e.ackSelfClosing=!0}function Au(A){const e=No(A,ut.TYPE);return e!=null&&e.toLowerCase()===fB}function jB(A,e){A._reconstructActiveFormattingElements(),A._appendElement(e,I.HTML),Au(e)||(A.framesetOk=!1),e.ackSelfClosing=!0}function zB(A,e){A._appendElement(e,I.HTML),e.ackSelfClosing=!0}function $B(A,e){A.openElements.hasInButtonScope(o.P)&&A._closePElement(),A._appendElement(e,I.HTML),A.framesetOk=!1,e.ackSelfClosing=!0}function ZB(A,e){e.tagName=w.IMG,e.tagID=o.IMG,Zo(A,e)}function Ag(A,e){A._insertElement(e,I.HTML),A.skipNextNewLine=!0,A.tokenizer.state=te.RCDATA,A.originalInsertionMode=A.insertionMode,A.framesetOk=!1,A.insertionMode=p.TEXT}function eg(A,e){A.openElements.hasInButtonScope(o.P)&&A._closePElement(),A._reconstructActiveFormattingElements(),A.framesetOk=!1,A._switchToTextParsing(e,te.RAWTEXT)}function tg(A,e){A.framesetOk=!1,A._switchToTextParsing(e,te.RAWTEXT)}function eu(A,e){A._switchToTextParsing(e,te.RAWTEXT)}function rg(A,e){A._reconstructActiveFormattingElements(),A._insertElement(e,I.HTML),A.framesetOk=!1,A.insertionMode=A.insertionMode===p.IN_TABLE||A.insertionMode===p.IN_CAPTION||A.insertionMode===p.IN_TABLE_BODY||A.insertionMode===p.IN_ROW||A.insertionMode===p.IN_CELL?p.IN_SELECT_IN_TABLE:p.IN_SELECT}function ng(A,e){A.openElements.currentTagId===o.OPTION&&A.openElements.pop(),A._reconstructActiveFormattingElements(),A._insertElement(e,I.HTML)}function ag(A,e){A.openElements.hasInScope(o.RUBY)&&A.openElements.generateImpliedEndTags(),A._insertElement(e,I.HTML)}function ig(A,e){A.openElements.hasInScope(o.RUBY)&&A.openElements.generateImpliedEndTagsWithExclusion(o.RTC),A._insertElement(e,I.HTML)}function sg(A,e){A._reconstructActiveFormattingElements(),Xo(e),ni(e),e.selfClosing?A._appendElement(e,I.MATHML):A._insertElement(e,I.MATHML),e.ackSelfClosing=!0}function og(A,e){A._reconstructActiveFormattingElements(),Wo(e),ni(e),e.selfClosing?A._appendElement(e,I.SVG):A._insertElement(e,I.SVG),e.ackSelfClosing=!0}function tu(A,e){A._reconstructActiveFormattingElements(),A._insertElement(e,I.HTML)}function KA(A,e){switch(e.tagID){case o.I:case o.S:case o.B:case o.U:case o.EM:case o.TT:case o.BIG:case o.CODE:case o.FONT:case o.SMALL:case o.STRIKE:case o.STRONG:{XB(A,e);break}case o.A:{YB(A,e);break}case o.H1:case o.H2:case o.H3:case o.H4:case o.H5:case o.H6:{MB(A,e);break}case o.P:case o.DL:case o.OL:case o.UL:case o.DIV:case o.DIR:case o.NAV:case o.MAIN:case o.MENU:case o.ASIDE:case o.CENTER:case o.FIGURE:case o.FOOTER:case o.HEADER:case o.HGROUP:case o.DIALOG:case o.DETAILS:case o.ADDRESS:case o.ARTICLE:case o.SEARCH:case o.SECTION:case o.SUMMARY:case o.FIELDSET:case o.BLOCKQUOTE:case o.FIGCAPTION:{RB(A,e);break}case o.LI:case o.DD:case o.DT:{KB(A,e);break}case o.BR:case o.IMG:case o.WBR:case o.AREA:case o.EMBED:case o.KEYGEN:{Zo(A,e);break}case o.HR:{$B(A,e);break}case o.RB:case o.RTC:{ag(A,e);break}case o.RT:case o.RP:{ig(A,e);break}case o.PRE:case o.LISTING:{kB(A,e);break}case o.XMP:{eg(A,e);break}case o.SVG:{og(A,e);break}case o.HTML:{HB(A,e);break}case o.BASE:case o.LINK:case o.META:case o.STYLE:case o.TITLE:case o.SCRIPT:case o.BGSOUND:case o.BASEFONT:case o.TEMPLATE:{pe(A,e);break}case o.BODY:{DB(A,e);break}case o.FORM:{PB(A,e);break}case o.NOBR:{WB(A,e);break}case o.MATH:{sg(A,e);break}case o.TABLE:{qB(A,e);break}case o.INPUT:{jB(A,e);break}case o.PARAM:case o.TRACK:case o.SOURCE:{zB(A,e);break}case o.IMAGE:{ZB(A,e);break}case o.BUTTON:{GB(A,e);break}case o.APPLET:case o.OBJECT:case o.MARQUEE:{JB(A,e);break}case o.IFRAME:{tg(A,e);break}case o.SELECT:{rg(A,e);break}case o.OPTION:case o.OPTGROUP:{ng(A,e);break}case o.NOEMBED:case o.NOFRAMES:{eu(A,e);break}case o.FRAMESET:{OB(A,e);break}case o.TEXTAREA:{Ag(A,e);break}case o.NOSCRIPT:{A.options.scriptingEnabled?eu(A,e):tu(A,e);break}case o.PLAINTEXT:{VB(A,e);break}case o.COL:case o.TH:case o.TD:case o.TR:case o.HEAD:case o.FRAME:case o.TBODY:case o.TFOOT:case o.THEAD:case o.CAPTION:case o.COLGROUP:break;default:tu(A,e)}}function ug(A,e){if(A.openElements.hasInScope(o.BODY)&&(A.insertionMode=p.AFTER_BODY,A.options.sourceCodeLocationInfo)){const t=A.openElements.tryPeekProperlyNestedBodyElement();t&&A._setEndLocation(t,e)}}function cg(A,e){A.openElements.hasInScope(o.BODY)&&(A.insertionMode=p.AFTER_BODY,du(A,e))}function lg(A,e){const t=e.tagID;A.openElements.hasInScope(t)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(t))}function dg(A){const e=A.openElements.tmplCount>0,{formElement:t}=A;e||(A.formElement=null),(t||e)&&A.openElements.hasInScope(o.FORM)&&(A.openElements.generateImpliedEndTags(),e?A.openElements.popUntilTagNamePopped(o.FORM):t&&A.openElements.remove(t))}function fg(A){A.openElements.hasInButtonScope(o.P)||A._insertFakeElement(w.P,o.P),A._closePElement()}function hg(A){A.openElements.hasInListItemScope(o.LI)&&(A.openElements.generateImpliedEndTagsWithExclusion(o.LI),A.openElements.popUntilTagNamePopped(o.LI))}function Bg(A,e){const t=e.tagID;A.openElements.hasInScope(t)&&(A.openElements.generateImpliedEndTagsWithExclusion(t),A.openElements.popUntilTagNamePopped(t))}function gg(A){A.openElements.hasNumberedHeaderInScope()&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilNumberedHeaderPopped())}function pg(A,e){const t=e.tagID;A.openElements.hasInScope(t)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(t),A.activeFormattingElements.clearToLastMarker())}function mg(A){A._reconstructActiveFormattingElements(),A._insertFakeElement(w.BR,o.BR),A.openElements.pop(),A.framesetOk=!1}function ru(A,e){const t=e.tagName,r=e.tagID;for(let n=A.openElements.stackTop;n>0;n--){const a=A.openElements.items[n],i=A.openElements.tagIDs[n];if(r===i&&(r!==o.UNKNOWN||A.treeAdapter.getTagName(a)===t)){A.openElements.generateImpliedEndTagsWithExclusion(r),A.openElements.stackTop>=n&&A.openElements.shortenToLength(n);break}if(A._isSpecialElement(a,i))break}}function ln(A,e){switch(e.tagID){case o.A:case o.B:case o.I:case o.S:case o.U:case o.EM:case o.TT:case o.BIG:case o.CODE:case o.FONT:case o.NOBR:case o.SMALL:case o.STRIKE:case o.STRONG:{ai(A,e);break}case o.P:{fg(A);break}case o.DL:case o.UL:case o.OL:case o.DIR:case o.DIV:case o.NAV:case o.PRE:case o.MAIN:case o.MENU:case o.ASIDE:case o.BUTTON:case o.CENTER:case o.FIGURE:case o.FOOTER:case o.HEADER:case o.HGROUP:case o.DIALOG:case o.ADDRESS:case o.ARTICLE:case o.DETAILS:case o.SEARCH:case o.SECTION:case o.SUMMARY:case o.LISTING:case o.FIELDSET:case o.BLOCKQUOTE:case o.FIGCAPTION:{lg(A,e);break}case o.LI:{hg(A);break}case o.DD:case o.DT:{Bg(A,e);break}case o.H1:case o.H2:case o.H3:case o.H4:case o.H5:case o.H6:{gg(A);break}case o.BR:{mg(A);break}case o.BODY:{ug(A,e);break}case o.HTML:{cg(A,e);break}case o.FORM:{dg(A);break}case o.APPLET:case o.OBJECT:case o.MARQUEE:{pg(A,e);break}case o.TEMPLATE:{ct(A,e);break}default:ru(A,e)}}function nu(A,e){A.tmplInsertionModeStack.length>0?lu(A,e):si(A,e)}function Eg(A,e){var t;e.tagID===o.SCRIPT&&((t=A.scriptHandler)===null||t===void 0||t.call(A,A.openElements.current)),A.openElements.pop(),A.insertionMode=A.originalInsertionMode}function Cg(A,e){A._err(e,U.eofInElementThatCanContainOnlyText),A.openElements.pop(),A.insertionMode=A.originalInsertionMode,A.onEof(e)}function oi(A,e){if(Jo.has(A.openElements.currentTagId))switch(A.pendingCharacterTokens.length=0,A.hasNonWhitespacePendingCharacterToken=!1,A.originalInsertionMode=A.insertionMode,A.insertionMode=p.IN_TABLE_TEXT,e.type){case tA.CHARACTER:{iu(A,e);break}case tA.WHITESPACE_CHARACTER:{au(A,e);break}}else dr(A,e)}function wg(A,e){A.openElements.clearBackToTableContext(),A.activeFormattingElements.insertMarker(),A._insertElement(e,I.HTML),A.insertionMode=p.IN_CAPTION}function bg(A,e){A.openElements.clearBackToTableContext(),A._insertElement(e,I.HTML),A.insertionMode=p.IN_COLUMN_GROUP}function Tg(A,e){A.openElements.clearBackToTableContext(),A._insertFakeElement(w.COLGROUP,o.COLGROUP),A.insertionMode=p.IN_COLUMN_GROUP,ui(A,e)}function Ug(A,e){A.openElements.clearBackToTableContext(),A._insertElement(e,I.HTML),A.insertionMode=p.IN_TABLE_BODY}function Qg(A,e){A.openElements.clearBackToTableContext(),A._insertFakeElement(w.TBODY,o.TBODY),A.insertionMode=p.IN_TABLE_BODY,fn(A,e)}function Fg(A,e){A.openElements.hasInTableScope(o.TABLE)&&(A.openElements.popUntilTagNamePopped(o.TABLE),A._resetInsertionMode(),A._processStartTag(e))}function Ig(A,e){Au(e)?A._appendElement(e,I.HTML):dr(A,e),e.ackSelfClosing=!0}function yg(A,e){!A.formElement&&A.openElements.tmplCount===0&&(A._insertElement(e,I.HTML),A.formElement=A.openElements.current,A.openElements.pop())}function Ft(A,e){switch(e.tagID){case o.TD:case o.TH:case o.TR:{Qg(A,e);break}case o.STYLE:case o.SCRIPT:case o.TEMPLATE:{pe(A,e);break}case o.COL:{Tg(A,e);break}case o.FORM:{yg(A,e);break}case o.TABLE:{Fg(A,e);break}case o.TBODY:case o.TFOOT:case o.THEAD:{Ug(A,e);break}case o.INPUT:{Ig(A,e);break}case o.CAPTION:{wg(A,e);break}case o.COLGROUP:{bg(A,e);break}default:dr(A,e)}}function lr(A,e){switch(e.tagID){case o.TABLE:{A.openElements.hasInTableScope(o.TABLE)&&(A.openElements.popUntilTagNamePopped(o.TABLE),A._resetInsertionMode());break}case o.TEMPLATE:{ct(A,e);break}case o.BODY:case o.CAPTION:case o.COL:case o.COLGROUP:case o.HTML:case o.TBODY:case o.TD:case o.TFOOT:case o.TH:case o.THEAD:case o.TR:break;default:dr(A,e)}}function dr(A,e){const t=A.fosterParentingEnabled;A.fosterParentingEnabled=!0,cn(A,e),A.fosterParentingEnabled=t}function au(A,e){A.pendingCharacterTokens.push(e)}function iu(A,e){A.pendingCharacterTokens.push(e),A.hasNonWhitespacePendingCharacterToken=!0}function fr(A,e){let t=0;if(A.hasNonWhitespacePendingCharacterToken)for(;t<A.pendingCharacterTokens.length;t++)dr(A,A.pendingCharacterTokens[t]);else for(;t<A.pendingCharacterTokens.length;t++)A._insertCharacters(A.pendingCharacterTokens[t]);A.insertionMode=A.originalInsertionMode,A._processToken(e)}const su=new Set([o.CAPTION,o.COL,o.COLGROUP,o.TBODY,o.TD,o.TFOOT,o.TH,o.THEAD,o.TR]);function xg(A,e){const t=e.tagID;su.has(t)?A.openElements.hasInTableScope(o.CAPTION)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(o.CAPTION),A.activeFormattingElements.clearToLastMarker(),A.insertionMode=p.IN_TABLE,Ft(A,e)):KA(A,e)}function vg(A,e){const t=e.tagID;switch(t){case o.CAPTION:case o.TABLE:{A.openElements.hasInTableScope(o.CAPTION)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(o.CAPTION),A.activeFormattingElements.clearToLastMarker(),A.insertionMode=p.IN_TABLE,t===o.TABLE&&lr(A,e));break}case o.BODY:case o.COL:case o.COLGROUP:case o.HTML:case o.TBODY:case o.TD:case o.TFOOT:case o.TH:case o.THEAD:case o.TR:break;default:ln(A,e)}}function ui(A,e){switch(e.tagID){case o.HTML:{KA(A,e);break}case o.COL:{A._appendElement(e,I.HTML),e.ackSelfClosing=!0;break}case o.TEMPLATE:{pe(A,e);break}default:dn(A,e)}}function _g(A,e){switch(e.tagID){case o.COLGROUP:{A.openElements.currentTagId===o.COLGROUP&&(A.openElements.pop(),A.insertionMode=p.IN_TABLE);break}case o.TEMPLATE:{ct(A,e);break}case o.COL:break;default:dn(A,e)}}function dn(A,e){A.openElements.currentTagId===o.COLGROUP&&(A.openElements.pop(),A.insertionMode=p.IN_TABLE,A._processToken(e))}function fn(A,e){switch(e.tagID){case o.TR:{A.openElements.clearBackToTableBodyContext(),A._insertElement(e,I.HTML),A.insertionMode=p.IN_ROW;break}case o.TH:case o.TD:{A.openElements.clearBackToTableBodyContext(),A._insertFakeElement(w.TR,o.TR),A.insertionMode=p.IN_ROW,hn(A,e);break}case o.CAPTION:case o.COL:case o.COLGROUP:case o.TBODY:case o.TFOOT:case o.THEAD:{A.openElements.hasTableBodyContextInTableScope()&&(A.openElements.clearBackToTableBodyContext(),A.openElements.pop(),A.insertionMode=p.IN_TABLE,Ft(A,e));break}default:Ft(A,e)}}function ci(A,e){const t=e.tagID;switch(e.tagID){case o.TBODY:case o.TFOOT:case o.THEAD:{A.openElements.hasInTableScope(t)&&(A.openElements.clearBackToTableBodyContext(),A.openElements.pop(),A.insertionMode=p.IN_TABLE);break}case o.TABLE:{A.openElements.hasTableBodyContextInTableScope()&&(A.openElements.clearBackToTableBodyContext(),A.openElements.pop(),A.insertionMode=p.IN_TABLE,lr(A,e));break}case o.BODY:case o.CAPTION:case o.COL:case o.COLGROUP:case o.HTML:case o.TD:case o.TH:case o.TR:break;default:lr(A,e)}}function hn(A,e){switch(e.tagID){case o.TH:case o.TD:{A.openElements.clearBackToTableRowContext(),A._insertElement(e,I.HTML),A.insertionMode=p.IN_CELL,A.activeFormattingElements.insertMarker();break}case o.CAPTION:case o.COL:case o.COLGROUP:case o.TBODY:case o.TFOOT:case o.THEAD:case o.TR:{A.openElements.hasInTableScope(o.TR)&&(A.openElements.clearBackToTableRowContext(),A.openElements.pop(),A.insertionMode=p.IN_TABLE_BODY,fn(A,e));break}default:Ft(A,e)}}function ou(A,e){switch(e.tagID){case o.TR:{A.openElements.hasInTableScope(o.TR)&&(A.openElements.clearBackToTableRowContext(),A.openElements.pop(),A.insertionMode=p.IN_TABLE_BODY);break}case o.TABLE:{A.openElements.hasInTableScope(o.TR)&&(A.openElements.clearBackToTableRowContext(),A.openElements.pop(),A.insertionMode=p.IN_TABLE_BODY,ci(A,e));break}case o.TBODY:case o.TFOOT:case o.THEAD:{(A.openElements.hasInTableScope(e.tagID)||A.openElements.hasInTableScope(o.TR))&&(A.openElements.clearBackToTableRowContext(),A.openElements.pop(),A.insertionMode=p.IN_TABLE_BODY,ci(A,e));break}case o.BODY:case o.CAPTION:case o.COL:case o.COLGROUP:case o.HTML:case o.TD:case o.TH:break;default:lr(A,e)}}function Ng(A,e){const t=e.tagID;su.has(t)?(A.openElements.hasInTableScope(o.TD)||A.openElements.hasInTableScope(o.TH))&&(A._closeTableCell(),hn(A,e)):KA(A,e)}function Sg(A,e){const t=e.tagID;switch(t){case o.TD:case o.TH:{A.openElements.hasInTableScope(t)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(t),A.activeFormattingElements.clearToLastMarker(),A.insertionMode=p.IN_ROW);break}case o.TABLE:case o.TBODY:case o.TFOOT:case o.THEAD:case o.TR:{A.openElements.hasInTableScope(t)&&(A._closeTableCell(),ou(A,e));break}case o.BODY:case o.CAPTION:case o.COL:case o.COLGROUP:case o.HTML:break;default:ln(A,e)}}function uu(A,e){switch(e.tagID){case o.HTML:{KA(A,e);break}case o.OPTION:{A.openElements.currentTagId===o.OPTION&&A.openElements.pop(),A._insertElement(e,I.HTML);break}case o.OPTGROUP:{A.openElements.currentTagId===o.OPTION&&A.openElements.pop(),A.openElements.currentTagId===o.OPTGROUP&&A.openElements.pop(),A._insertElement(e,I.HTML);break}case o.HR:{A.openElements.currentTagId===o.OPTION&&A.openElements.pop(),A.openElements.currentTagId===o.OPTGROUP&&A.openElements.pop(),A._appendElement(e,I.HTML),e.ackSelfClosing=!0;break}case o.INPUT:case o.KEYGEN:case o.TEXTAREA:case o.SELECT:{A.openElements.hasInSelectScope(o.SELECT)&&(A.openElements.popUntilTagNamePopped(o.SELECT),A._resetInsertionMode(),e.tagID!==o.SELECT&&A._processStartTag(e));break}case o.SCRIPT:case o.TEMPLATE:{pe(A,e);break}}}function cu(A,e){switch(e.tagID){case o.OPTGROUP:{A.openElements.stackTop>0&&A.openElements.currentTagId===o.OPTION&&A.openElements.tagIDs[A.openElements.stackTop-1]===o.OPTGROUP&&A.openElements.pop(),A.openElements.currentTagId===o.OPTGROUP&&A.openElements.pop();break}case o.OPTION:{A.openElements.currentTagId===o.OPTION&&A.openElements.pop();break}case o.SELECT:{A.openElements.hasInSelectScope(o.SELECT)&&(A.openElements.popUntilTagNamePopped(o.SELECT),A._resetInsertionMode());break}case o.TEMPLATE:{ct(A,e);break}}}function Lg(A,e){const t=e.tagID;t===o.CAPTION||t===o.TABLE||t===o.TBODY||t===o.TFOOT||t===o.THEAD||t===o.TR||t===o.TD||t===o.TH?(A.openElements.popUntilTagNamePopped(o.SELECT),A._resetInsertionMode(),A._processStartTag(e)):uu(A,e)}function Hg(A,e){const t=e.tagID;t===o.CAPTION||t===o.TABLE||t===o.TBODY||t===o.TFOOT||t===o.THEAD||t===o.TR||t===o.TD||t===o.TH?A.openElements.hasInTableScope(t)&&(A.openElements.popUntilTagNamePopped(o.SELECT),A._resetInsertionMode(),A.onEndTag(e)):cu(A,e)}function Dg(A,e){switch(e.tagID){case o.BASE:case o.BASEFONT:case o.BGSOUND:case o.LINK:case o.META:case o.NOFRAMES:case o.SCRIPT:case o.STYLE:case o.TEMPLATE:case o.TITLE:{pe(A,e);break}case o.CAPTION:case o.COLGROUP:case o.TBODY:case o.TFOOT:case o.THEAD:{A.tmplInsertionModeStack[0]=p.IN_TABLE,A.insertionMode=p.IN_TABLE,Ft(A,e);break}case o.COL:{A.tmplInsertionModeStack[0]=p.IN_COLUMN_GROUP,A.insertionMode=p.IN_COLUMN_GROUP,ui(A,e);break}case o.TR:{A.tmplInsertionModeStack[0]=p.IN_TABLE_BODY,A.insertionMode=p.IN_TABLE_BODY,fn(A,e);break}case o.TD:case o.TH:{A.tmplInsertionModeStack[0]=p.IN_ROW,A.insertionMode=p.IN_ROW,hn(A,e);break}default:A.tmplInsertionModeStack[0]=p.IN_BODY,A.insertionMode=p.IN_BODY,KA(A,e)}}function Og(A,e){e.tagID===o.TEMPLATE&&ct(A,e)}function lu(A,e){A.openElements.tmplCount>0?(A.openElements.popUntilTagNamePopped(o.TEMPLATE),A.activeFormattingElements.clearToLastMarker(),A.tmplInsertionModeStack.shift(),A._resetInsertionMode(),A.onEof(e)):si(A,e)}function Rg(A,e){e.tagID===o.HTML?KA(A,e):Bn(A,e)}function du(A,e){var t;if(e.tagID===o.HTML){if(A.fragmentContext||(A.insertionMode=p.AFTER_AFTER_BODY),A.options.sourceCodeLocationInfo&&A.openElements.tagIDs[0]===o.HTML){A._setEndLocation(A.openElements.items[0],e);const r=A.openElements.items[1];r&&!(!((t=A.treeAdapter.getNodeSourceCodeLocation(r))===null||t===void 0)&&t.endTag)&&A._setEndLocation(r,e)}}else Bn(A,e)}function Bn(A,e){A.insertionMode=p.IN_BODY,cn(A,e)}function Mg(A,e){switch(e.tagID){case o.HTML:{KA(A,e);break}case o.FRAMESET:{A._insertElement(e,I.HTML);break}case o.FRAME:{A._appendElement(e,I.HTML),e.ackSelfClosing=!0;break}case o.NOFRAMES:{pe(A,e);break}}}function kg(A,e){e.tagID===o.FRAMESET&&!A.openElements.isRootHtmlElementCurrent()&&(A.openElements.pop(),!A.fragmentContext&&A.openElements.currentTagId!==o.FRAMESET&&(A.insertionMode=p.AFTER_FRAMESET))}function Pg(A,e){switch(e.tagID){case o.HTML:{KA(A,e);break}case o.NOFRAMES:{pe(A,e);break}}}function Kg(A,e){e.tagID===o.HTML&&(A.insertionMode=p.AFTER_AFTER_FRAMESET)}function Vg(A,e){e.tagID===o.HTML?KA(A,e):gn(A,e)}function gn(A,e){A.insertionMode=p.IN_BODY,cn(A,e)}function Gg(A,e){switch(e.tagID){case o.HTML:{KA(A,e);break}case o.NOFRAMES:{pe(A,e);break}}}function Yg(A,e){e.chars=pA,A._insertCharacters(e)}function Xg(A,e){A._insertCharacters(e),A.framesetOk=!1}function fu(A){for(;A.treeAdapter.getNamespaceURI(A.openElements.current)!==I.HTML&&!A._isIntegrationPoint(A.openElements.currentTagId,A.openElements.current);)A.openElements.pop()}function Wg(A,e){if(oB(e))fu(A),A._startTagOutsideForeignContent(e);else{const t=A._getAdjustedCurrentElement(),r=A.treeAdapter.getNamespaceURI(t);r===I.MATHML?Xo(e):r===I.SVG&&(uB(e),Wo(e)),ni(e),e.selfClosing?A._appendElement(e,r):A._insertElement(e,r),e.ackSelfClosing=!0}}function Jg(A,e){if(e.tagID===o.P||e.tagID===o.BR){fu(A),A._endTagOutsideForeignContent(e);return}for(let t=A.openElements.stackTop;t>0;t--){const r=A.openElements.items[t];if(A.treeAdapter.getNamespaceURI(r)===I.HTML){A._endTagOutsideForeignContent(e);break}const n=A.treeAdapter.getTagName(r);if(n.toLowerCase()===e.tagName){e.tagName=n,A.openElements.shortenToLength(t);break}}}const qg=new Set([w.AREA,w.BASE,w.BASEFONT,w.BGSOUND,w.BR,w.COL,w.EMBED,w.FRAME,w.HR,w.IMG,w.INPUT,w.KEYGEN,w.LINK,w.META,w.PARAM,w.SOURCE,w.TRACK,w.WBR]);function jg(A,e){return e.treeAdapter.isElementNode(A)&&e.treeAdapter.getNamespaceURI(A)===I.HTML&&qg.has(e.treeAdapter.getTagName(A))}const zg={treeAdapter:_e,scriptingEnabled:!0};function $g(A,e){const t={...zg,...e};return hu(A,t)}function Zg(A,e){let t="";const r=e.treeAdapter.isElementNode(A)&&e.treeAdapter.getTagName(A)===w.TEMPLATE&&e.treeAdapter.getNamespaceURI(A)===I.HTML?e.treeAdapter.getTemplateContent(A):A,n=e.treeAdapter.getChildNodes(r);if(n)for(const a of n)t+=hu(a,e);return t}function hu(A,e){return e.treeAdapter.isElementNode(A)?Ap(A,e):e.treeAdapter.isTextNode(A)?tp(A,e):e.treeAdapter.isCommentNode(A)?rp(A,e):e.treeAdapter.isDocumentTypeNode(A)?np(A,e):""}function Ap(A,e){const t=e.treeAdapter.getTagName(A);return`<${t}${ep(A,e)}>${jg(A,e)?"":`${Zg(A,e)}</${t}>`}`}function ep(A,{treeAdapter:e}){let t="";for(const r of e.getAttrList(A)){if(t+=" ",r.namespace)switch(r.namespace){case I.XML:{t+=`xml:${r.name}`;break}case I.XMLNS:{r.name!=="xmlns"&&(t+="xmlns:"),t+=r.name;break}case I.XLINK:{t+=`xlink:${r.name}`;break}default:t+=`${r.prefix}:${r.name}`}else t+=r.name;t+=`="${Ls(r.value)}"`}return t}function tp(A,e){const{treeAdapter:t}=e,r=t.getTextNodeContent(A),n=t.getParentNode(A),a=n&&t.isElementNode(n)&&t.getTagName(n);return a&&t.getNamespaceURI(n)===I.HTML&&Dh(a,e.scriptingEnabled)?r:Hs(r)}function rp(A,{treeAdapter:e}){return`<!--${e.getCommentNodeContent(A)}-->`}function np(A,{treeAdapter:e}){return`<!DOCTYPE ${e.getDocumentTypeNodeName(A)}>`}function ap(A,e){return jo.parse(A,e)}function ip(A,e,t){typeof A=="string"&&(t=e,e=A,A=null);const r=jo.getFragmentParser(A,t);return r.tokenizer.write(e,!0),r.getFragment()}function Bu(A){const e=A.includes('"')?"'":'"';return e+A+e}function sp(A,e,t){let r="!DOCTYPE ";return A&&(r+=A),e?r+=` PUBLIC ${Bu(e)}`:t&&(r+=" SYSTEM"),t&&(r+=` ${Bu(t)}`),r}const Ve={isCommentNode:Vr,isElementNode:q,isTextNode:be,createDocument(){const A=new nt([]);return A["x-mode"]=se.NO_QUIRKS,A},createDocumentFragment(){return new nt([])},createElement(A,e,t){const r=Object.create(null),n=Object.create(null),a=Object.create(null);for(let s=0;s<t.length;s++){const u=t[s].name;r[u]=t[s].value,n[u]=t[s].namespace,a[u]=t[s].prefix}const i=new Ta(A,r,[]);return i.namespace=e,i["x-attribsNamespace"]=n,i["x-attribsPrefix"]=a,i},createCommentNode(A){return new Ca(A)},createTextNode(A){return new Jt(A)},appendChild(A,e){const t=A.children[A.children.length-1];t&&(t.next=e,e.prev=t),A.children.push(e),e.parent=A},insertBefore(A,e,t){const r=A.children.indexOf(t),{prev:n}=t;n&&(n.next=e,e.prev=n),t.prev=e,e.next=t,A.children.splice(r,0,e),e.parent=A},setTemplateContent(A,e){Ve.appendChild(A,e)},getTemplateContent(A){return A.children[0]},setDocumentType(A,e,t,r){const n=sp(e,t,r);let a=A.children.find(i=>Ua(i)&&i.name==="!doctype");a?a.data=n??null:(a=new wa("!doctype",n),Ve.appendChild(A,a)),a["x-name"]=e,a["x-publicId"]=t,a["x-systemId"]=r},setDocumentMode(A,e){A["x-mode"]=e},getDocumentMode(A){return A["x-mode"]},detachNode(A){if(A.parent){const e=A.parent.children.indexOf(A),{prev:t,next:r}=A;A.prev=null,A.next=null,t&&(t.next=r),r&&(r.prev=t),A.parent.children.splice(e,1),A.parent=null}},insertText(A,e){const t=A.children[A.children.length-1];t&&be(t)?t.data+=e:Ve.appendChild(A,Ve.createTextNode(e))},insertTextBefore(A,e,t){const r=A.children[A.children.indexOf(t)-1];r&&be(r)?r.data+=e:Ve.insertBefore(A,Ve.createTextNode(e),t)},adoptAttributes(A,e){for(let t=0;t<e.length;t++){const r=e[t].name;A.attribs[r]===void 0&&(A.attribs[r]=e[t].value,A["x-attribsNamespace"][r]=e[t].namespace,A["x-attribsPrefix"][r]=e[t].prefix)}},getFirstChild(A){return A.children[0]},getChildNodes(A){return A.children},getParentNode(A){return A.parent},getAttrList(A){return A.attributes},getTagName(A){return A.name},getNamespaceURI(A){return A.namespace},getTextNodeContent(A){return A.data},getCommentNodeContent(A){return A.data},getDocumentTypeNodeName(A){var e;return(e=A["x-name"])!==null&&e!==void 0?e:""},getDocumentTypeNodePublicId(A){var e;return(e=A["x-publicId"])!==null&&e!==void 0?e:""},getDocumentTypeNodeSystemId(A){var e;return(e=A["x-systemId"])!==null&&e!==void 0?e:""},isDocumentTypeNode(A){return Ua(A)&&A.name==="!doctype"},setNodeSourceCodeLocation(A,e){e&&(A.startIndex=e.startOffset,A.endIndex=e.endOffset),A.sourceCodeLocation=e},getNodeSourceCodeLocation(A){return A.sourceCodeLocation},updateNodeSourceCodeLocation(A,e){e.endOffset!=null&&(A.endIndex=e.endOffset),A.sourceCodeLocation={...A.sourceCodeLocation,...e}}};function op(A,e,t,r){var n;return(n=e.treeAdapter)!==null&&n!==void 0||(e.treeAdapter=Ve),e.scriptingEnabled!==!1&&(e.scriptingEnabled=!0),t?ap(A,e):ip(r,A,e)}const up={treeAdapter:Ve};function cp(A){const e="length"in A?A:[A];for(let r=0;r<e.length;r+=1){const n=e[r];Re(n)&&Array.prototype.splice.call(e,r,1,...n.children)}let t="";for(let r=0;r<e.length;r+=1){const n=e[r];t+=$g(n,up)}return t}var X;(function(A){A[A.Tab=9]="Tab",A[A.NewLine=10]="NewLine",A[A.FormFeed=12]="FormFeed",A[A.CarriageReturn=13]="CarriageReturn",A[A.Space=32]="Space",A[A.ExclamationMark=33]="ExclamationMark",A[A.Number=35]="Number",A[A.Amp=38]="Amp",A[A.SingleQuote=39]="SingleQuote",A[A.DoubleQuote=34]="DoubleQuote",A[A.Dash=45]="Dash",A[A.Slash=47]="Slash",A[A.Zero=48]="Zero",A[A.Nine=57]="Nine",A[A.Semi=59]="Semi",A[A.Lt=60]="Lt",A[A.Eq=61]="Eq",A[A.Gt=62]="Gt",A[A.Questionmark=63]="Questionmark",A[A.UpperA=65]="UpperA",A[A.LowerA=97]="LowerA",A[A.UpperF=70]="UpperF",A[A.LowerF=102]="LowerF",A[A.UpperZ=90]="UpperZ",A[A.LowerZ=122]="LowerZ",A[A.LowerX=120]="LowerX",A[A.OpeningSquareBracket=91]="OpeningSquareBracket"})(X||(X={}));var N;(function(A){A[A.Text=1]="Text",A[A.BeforeTagName=2]="BeforeTagName",A[A.InTagName=3]="InTagName",A[A.InSelfClosingTag=4]="InSelfClosingTag",A[A.BeforeClosingTagName=5]="BeforeClosingTagName",A[A.InClosingTagName=6]="InClosingTagName",A[A.AfterClosingTagName=7]="AfterClosingTagName",A[A.BeforeAttributeName=8]="BeforeAttributeName",A[A.InAttributeName=9]="InAttributeName",A[A.AfterAttributeName=10]="AfterAttributeName",A[A.BeforeAttributeValue=11]="BeforeAttributeValue",A[A.InAttributeValueDq=12]="InAttributeValueDq",A[A.InAttributeValueSq=13]="InAttributeValueSq",A[A.InAttributeValueNq=14]="InAttributeValueNq",A[A.BeforeDeclaration=15]="BeforeDeclaration",A[A.InDeclaration=16]="InDeclaration",A[A.InProcessingInstruction=17]="InProcessingInstruction",A[A.BeforeComment=18]="BeforeComment",A[A.CDATASequence=19]="CDATASequence",A[A.InSpecialComment=20]="InSpecialComment",A[A.InCommentLike=21]="InCommentLike",A[A.BeforeSpecialS=22]="BeforeSpecialS",A[A.BeforeSpecialT=23]="BeforeSpecialT",A[A.SpecialStartSequence=24]="SpecialStartSequence",A[A.InSpecialTag=25]="InSpecialTag",A[A.InEntity=26]="InEntity"})(N||(N={}));function Ne(A){return A===X.Space||A===X.NewLine||A===X.Tab||A===X.FormFeed||A===X.CarriageReturn}function pn(A){return A===X.Slash||A===X.Gt||Ne(A)}function lp(A){return A>=X.LowerA&&A<=X.LowerZ||A>=X.UpperA&&A<=X.UpperZ}var Ue;(function(A){A[A.NoValue=0]="NoValue",A[A.Unquoted=1]="Unquoted",A[A.Single=2]="Single",A[A.Double=3]="Double"})(Ue||(Ue={}));const RA={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97])};let dp=class{constructor({xmlMode:e=!1,decodeEntities:t=!0},r){this.cbs=r,this.state=N.Text,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=N.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.xmlMode=e,this.decodeEntities=t,this.entityDecoder=new va(e?xs:Fa,(n,a)=>this.emitCodePoint(n,a))}reset(){this.state=N.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=N.Text,this.currentSequence=void 0,this.running=!0,this.offset=0}write(e){this.offset+=this.buffer.length,this.buffer=e,this.parse()}end(){this.running&&this.finish()}pause(){this.running=!1}resume(){this.running=!0,this.index<this.buffer.length+this.offset&&this.parse()}stateText(e){e===X.Lt||!this.decodeEntities&&this.fastForwardTo(X.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=N.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&e===X.Amp&&this.startEntity()}stateSpecialStartSequence(e){const t=this.sequenceIndex===this.currentSequence.length;if(!(t?pn(e):(e|32)===this.currentSequence[this.sequenceIndex]))this.isSpecial=!1;else if(!t){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=N.InTagName,this.stateInTagName(e)}stateInSpecialTag(e){if(this.sequenceIndex===this.currentSequence.length){if(e===X.Gt||Ne(e)){const t=this.index-this.currentSequence.length;if(this.sectionStart<t){const r=this.index;this.index=t,this.cbs.ontext(this.sectionStart,t),this.index=r}this.isSpecial=!1,this.sectionStart=t+2,this.stateInClosingTagName(e);return}this.sequenceIndex=0}(e|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===RA.TitleEnd?this.decodeEntities&&e===X.Amp&&this.startEntity():this.fastForwardTo(X.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=+(e===X.Lt)}stateCDATASequence(e){e===RA.Cdata[this.sequenceIndex]?++this.sequenceIndex===RA.Cdata.length&&(this.state=N.InCommentLike,this.currentSequence=RA.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=N.InDeclaration,this.stateInDeclaration(e))}fastForwardTo(e){for(;++this.index<this.buffer.length+this.offset;)if(this.buffer.charCodeAt(this.index-this.offset)===e)return!0;return this.index=this.buffer.length+this.offset-1,!1}stateInCommentLike(e){e===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===RA.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index,2):this.cbs.oncomment(this.sectionStart,this.index,2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=N.Text):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):e!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}isTagStartChar(e){return this.xmlMode?!pn(e):lp(e)}startSpecial(e,t){this.isSpecial=!0,this.currentSequence=e,this.sequenceIndex=t,this.state=N.SpecialStartSequence}stateBeforeTagName(e){if(e===X.ExclamationMark)this.state=N.BeforeDeclaration,this.sectionStart=this.index+1;else if(e===X.Questionmark)this.state=N.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(e)){const t=e|32;this.sectionStart=this.index,this.xmlMode?this.state=N.InTagName:t===RA.ScriptEnd[2]?this.state=N.BeforeSpecialS:t===RA.TitleEnd[2]?this.state=N.BeforeSpecialT:this.state=N.InTagName}else e===X.Slash?this.state=N.BeforeClosingTagName:(this.state=N.Text,this.stateText(e))}stateInTagName(e){pn(e)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=N.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateBeforeClosingTagName(e){Ne(e)||(e===X.Gt?this.state=N.Text:(this.state=this.isTagStartChar(e)?N.InClosingTagName:N.InSpecialComment,this.sectionStart=this.index))}stateInClosingTagName(e){(e===X.Gt||Ne(e))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=N.AfterClosingTagName,this.stateAfterClosingTagName(e))}stateAfterClosingTagName(e){(e===X.Gt||this.fastForwardTo(X.Gt))&&(this.state=N.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(e){e===X.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=N.InSpecialTag,this.sequenceIndex=0):this.state=N.Text,this.sectionStart=this.index+1):e===X.Slash?this.state=N.InSelfClosingTag:Ne(e)||(this.state=N.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(e){e===X.Gt?(this.cbs.onselfclosingtag(this.index),this.state=N.Text,this.sectionStart=this.index+1,this.isSpecial=!1):Ne(e)||(this.state=N.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateInAttributeName(e){(e===X.Eq||pn(e))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=this.index,this.state=N.AfterAttributeName,this.stateAfterAttributeName(e))}stateAfterAttributeName(e){e===X.Eq?this.state=N.BeforeAttributeValue:e===X.Slash||e===X.Gt?(this.cbs.onattribend(Ue.NoValue,this.sectionStart),this.sectionStart=-1,this.state=N.BeforeAttributeName,this.stateBeforeAttributeName(e)):Ne(e)||(this.cbs.onattribend(Ue.NoValue,this.sectionStart),this.state=N.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(e){e===X.DoubleQuote?(this.state=N.InAttributeValueDq,this.sectionStart=this.index+1):e===X.SingleQuote?(this.state=N.InAttributeValueSq,this.sectionStart=this.index+1):Ne(e)||(this.sectionStart=this.index,this.state=N.InAttributeValueNq,this.stateInAttributeValueNoQuotes(e))}handleInAttributeValue(e,t){e===t||!this.decodeEntities&&this.fastForwardTo(t)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(t===X.DoubleQuote?Ue.Double:Ue.Single,this.index+1),this.state=N.BeforeAttributeName):this.decodeEntities&&e===X.Amp&&this.startEntity()}stateInAttributeValueDoubleQuotes(e){this.handleInAttributeValue(e,X.DoubleQuote)}stateInAttributeValueSingleQuotes(e){this.handleInAttributeValue(e,X.SingleQuote)}stateInAttributeValueNoQuotes(e){Ne(e)||e===X.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(Ue.Unquoted,this.index),this.state=N.BeforeAttributeName,this.stateBeforeAttributeName(e)):this.decodeEntities&&e===X.Amp&&this.startEntity()}stateBeforeDeclaration(e){e===X.OpeningSquareBracket?(this.state=N.CDATASequence,this.sequenceIndex=0):this.state=e===X.Dash?N.BeforeComment:N.InDeclaration}stateInDeclaration(e){(e===X.Gt||this.fastForwardTo(X.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=N.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(e){(e===X.Gt||this.fastForwardTo(X.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=N.Text,this.sectionStart=this.index+1)}stateBeforeComment(e){e===X.Dash?(this.state=N.InCommentLike,this.currentSequence=RA.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=N.InDeclaration}stateInSpecialComment(e){(e===X.Gt||this.fastForwardTo(X.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=N.Text,this.sectionStart=this.index+1)}stateBeforeSpecialS(e){const t=e|32;t===RA.ScriptEnd[3]?this.startSpecial(RA.ScriptEnd,4):t===RA.StyleEnd[3]?this.startSpecial(RA.StyleEnd,4):(this.state=N.InTagName,this.stateInTagName(e))}stateBeforeSpecialT(e){const t=e|32;t===RA.TitleEnd[3]?this.startSpecial(RA.TitleEnd,4):t===RA.TextareaEnd[3]?this.startSpecial(RA.TextareaEnd,4):(this.state=N.InTagName,this.stateInTagName(e))}startEntity(){this.baseState=this.state,this.state=N.InEntity,this.entityStart=this.index,this.entityDecoder.startEntity(this.xmlMode?ce.Strict:this.baseState===N.Text||this.baseState===N.InSpecialTag?ce.Legacy:ce.Attribute)}stateInEntity(){const e=this.entityDecoder.write(this.buffer,this.index-this.offset);e>=0?(this.state=this.baseState,e===0&&(this.index=this.entityStart)):this.index=this.offset+this.buffer.length-1}cleanup(){this.running&&this.sectionStart!==this.index&&(this.state===N.Text||this.state===N.InSpecialTag&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===N.InAttributeValueDq||this.state===N.InAttributeValueSq||this.state===N.InAttributeValueNq)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}shouldContinue(){return this.index<this.buffer.length+this.offset&&this.running}parse(){for(;this.shouldContinue();){const e=this.buffer.charCodeAt(this.index-this.offset);switch(this.state){case N.Text:{this.stateText(e);break}case N.SpecialStartSequence:{this.stateSpecialStartSequence(e);break}case N.InSpecialTag:{this.stateInSpecialTag(e);break}case N.CDATASequence:{this.stateCDATASequence(e);break}case N.InAttributeValueDq:{this.stateInAttributeValueDoubleQuotes(e);break}case N.InAttributeName:{this.stateInAttributeName(e);break}case N.InCommentLike:{this.stateInCommentLike(e);break}case N.InSpecialComment:{this.stateInSpecialComment(e);break}case N.BeforeAttributeName:{this.stateBeforeAttributeName(e);break}case N.InTagName:{this.stateInTagName(e);break}case N.InClosingTagName:{this.stateInClosingTagName(e);break}case N.BeforeTagName:{this.stateBeforeTagName(e);break}case N.AfterAttributeName:{this.stateAfterAttributeName(e);break}case N.InAttributeValueSq:{this.stateInAttributeValueSingleQuotes(e);break}case N.BeforeAttributeValue:{this.stateBeforeAttributeValue(e);break}case N.BeforeClosingTagName:{this.stateBeforeClosingTagName(e);break}case N.AfterClosingTagName:{this.stateAfterClosingTagName(e);break}case N.BeforeSpecialS:{this.stateBeforeSpecialS(e);break}case N.BeforeSpecialT:{this.stateBeforeSpecialT(e);break}case N.InAttributeValueNq:{this.stateInAttributeValueNoQuotes(e);break}case N.InSelfClosingTag:{this.stateInSelfClosingTag(e);break}case N.InDeclaration:{this.stateInDeclaration(e);break}case N.BeforeDeclaration:{this.stateBeforeDeclaration(e);break}case N.BeforeComment:{this.stateBeforeComment(e);break}case N.InProcessingInstruction:{this.stateInProcessingInstruction(e);break}case N.InEntity:{this.stateInEntity();break}}this.index++}this.cleanup()}finish(){this.state===N.InEntity&&(this.entityDecoder.end(),this.state=this.baseState),this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){const e=this.buffer.length+this.offset;this.sectionStart>=e||(this.state===N.InCommentLike?this.currentSequence===RA.CdataEnd?this.cbs.oncdata(this.sectionStart,e,0):this.cbs.oncomment(this.sectionStart,e,0):this.state===N.InTagName||this.state===N.BeforeAttributeName||this.state===N.BeforeAttributeValue||this.state===N.AfterAttributeName||this.state===N.InAttributeName||this.state===N.InAttributeValueSq||this.state===N.InAttributeValueDq||this.state===N.InAttributeValueNq||this.state===N.InClosingTagName||this.cbs.ontext(this.sectionStart,e))}emitCodePoint(e,t){this.baseState!==N.Text&&this.baseState!==N.InSpecialTag?(this.sectionStart<this.entityStart&&this.cbs.onattribdata(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+t,this.index=this.sectionStart-1,this.cbs.onattribentity(e)):(this.sectionStart<this.entityStart&&this.cbs.ontext(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+t,this.index=this.sectionStart-1,this.cbs.ontextentity(e,this.sectionStart))}};const It=new Set(["input","option","optgroup","select","button","datalist","textarea"]),oA=new Set(["p"]),gu=new Set(["thead","tbody"]),pu=new Set(["dd","dt"]),mu=new Set(["rt","rp"]),fp=new Map([["tr",new Set(["tr","th","td"])],["th",new Set(["th"])],["td",new Set(["thead","th","td"])],["body",new Set(["head","link","script"])],["li",new Set(["li"])],["p",oA],["h1",oA],["h2",oA],["h3",oA],["h4",oA],["h5",oA],["h6",oA],["select",It],["input",It],["output",It],["button",It],["datalist",It],["textarea",It],["option",new Set(["option"])],["optgroup",new Set(["optgroup","option"])],["dd",pu],["dt",pu],["address",oA],["article",oA],["aside",oA],["blockquote",oA],["details",oA],["div",oA],["dl",oA],["fieldset",oA],["figcaption",oA],["figure",oA],["footer",oA],["form",oA],["header",oA],["hr",oA],["main",oA],["nav",oA],["ol",oA],["pre",oA],["section",oA],["table",oA],["ul",oA],["rt",mu],["rp",mu],["tbody",gu],["tfoot",gu]]),hp=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),Eu=new Set(["math","svg"]),Cu=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignobject","desc","title"]),Bp=/\s|\//;let gp=class{constructor(e,t={}){var r,n,a,i,s,u;this.options=t,this.startIndex=0,this.endIndex=0,this.openTagStart=0,this.tagname="",this.attribname="",this.attribvalue="",this.attribs=null,this.stack=[],this.buffers=[],this.bufferOffset=0,this.writeIndex=0,this.ended=!1,this.cbs=e??{},this.htmlMode=!this.options.xmlMode,this.lowerCaseTagNames=(r=t.lowerCaseTags)!==null&&r!==void 0?r:this.htmlMode,this.lowerCaseAttributeNames=(n=t.lowerCaseAttributeNames)!==null&&n!==void 0?n:this.htmlMode,this.recognizeSelfClosing=(a=t.recognizeSelfClosing)!==null&&a!==void 0?a:!this.htmlMode,this.tokenizer=new((i=t.Tokenizer)!==null&&i!==void 0?i:dp)(this.options,this),this.foreignContext=[!this.htmlMode],(u=(s=this.cbs).onparserinit)===null||u===void 0||u.call(s,this)}ontext(e,t){var r,n;const a=this.getSlice(e,t);this.endIndex=t-1,(n=(r=this.cbs).ontext)===null||n===void 0||n.call(r,a),this.startIndex=t}ontextentity(e,t){var r,n;this.endIndex=t-1,(n=(r=this.cbs).ontext)===null||n===void 0||n.call(r,ya(e)),this.startIndex=t}isVoidElement(e){return this.htmlMode&&hp.has(e)}onopentagname(e,t){this.endIndex=t;let r=this.getSlice(e,t);this.lowerCaseTagNames&&(r=r.toLowerCase()),this.emitOpenTag(r)}emitOpenTag(e){var t,r,n,a;this.openTagStart=this.startIndex,this.tagname=e;const i=this.htmlMode&&fp.get(e);if(i)for(;this.stack.length>0&&i.has(this.stack[0]);){const s=this.stack.shift();(r=(t=this.cbs).onclosetag)===null||r===void 0||r.call(t,s,!0)}this.isVoidElement(e)||(this.stack.unshift(e),this.htmlMode&&(Eu.has(e)?this.foreignContext.unshift(!0):Cu.has(e)&&this.foreignContext.unshift(!1))),(a=(n=this.cbs).onopentagname)===null||a===void 0||a.call(n,e),this.cbs.onopentag&&(this.attribs={})}endOpenTag(e){var t,r;this.startIndex=this.openTagStart,this.attribs&&((r=(t=this.cbs).onopentag)===null||r===void 0||r.call(t,this.tagname,this.attribs,e),this.attribs=null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=""}onopentagend(e){this.endIndex=e,this.endOpenTag(!1),this.startIndex=e+1}onclosetag(e,t){var r,n,a,i,s,u,l,d;this.endIndex=t;let f=this.getSlice(e,t);if(this.lowerCaseTagNames&&(f=f.toLowerCase()),this.htmlMode&&(Eu.has(f)||Cu.has(f))&&this.foreignContext.shift(),this.isVoidElement(f))this.htmlMode&&f==="br"&&((i=(a=this.cbs).onopentagname)===null||i===void 0||i.call(a,"br"),(u=(s=this.cbs).onopentag)===null||u===void 0||u.call(s,"br",{},!0),(d=(l=this.cbs).onclosetag)===null||d===void 0||d.call(l,"br",!1));else{const h=this.stack.indexOf(f);if(h!==-1)for(let C=0;C<=h;C++){const E=this.stack.shift();(n=(r=this.cbs).onclosetag)===null||n===void 0||n.call(r,E,C!==h)}else this.htmlMode&&f==="p"&&(this.emitOpenTag("p"),this.closeCurrentTag(!0))}this.startIndex=t+1}onselfclosingtag(e){this.endIndex=e,this.recognizeSelfClosing||this.foreignContext[0]?(this.closeCurrentTag(!1),this.startIndex=e+1):this.onopentagend(e)}closeCurrentTag(e){var t,r;const n=this.tagname;this.endOpenTag(e),this.stack[0]===n&&((r=(t=this.cbs).onclosetag)===null||r===void 0||r.call(t,n,!e),this.stack.shift())}onattribname(e,t){this.startIndex=e;const r=this.getSlice(e,t);this.attribname=this.lowerCaseAttributeNames?r.toLowerCase():r}onattribdata(e,t){this.attribvalue+=this.getSlice(e,t)}onattribentity(e){this.attribvalue+=ya(e)}onattribend(e,t){var r,n;this.endIndex=t,(n=(r=this.cbs).onattribute)===null||n===void 0||n.call(r,this.attribname,this.attribvalue,e===Ue.Double?'"':e===Ue.Single?"'":e===Ue.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=""}getInstructionName(e){const t=e.search(Bp);let r=t<0?e:e.substr(0,t);return this.lowerCaseTagNames&&(r=r.toLowerCase()),r}ondeclaration(e,t){this.endIndex=t;const r=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){const n=this.getInstructionName(r);this.cbs.onprocessinginstruction(`!${n}`,`!${r}`)}this.startIndex=t+1}onprocessinginstruction(e,t){this.endIndex=t;const r=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){const n=this.getInstructionName(r);this.cbs.onprocessinginstruction(`?${n}`,`?${r}`)}this.startIndex=t+1}oncomment(e,t,r){var n,a,i,s;this.endIndex=t,(a=(n=this.cbs).oncomment)===null||a===void 0||a.call(n,this.getSlice(e,t-r)),(s=(i=this.cbs).oncommentend)===null||s===void 0||s.call(i),this.startIndex=t+1}oncdata(e,t,r){var n,a,i,s,u,l,d,f,h,C;this.endIndex=t;const E=this.getSlice(e,t-r);!this.htmlMode||this.options.recognizeCDATA?((a=(n=this.cbs).oncdatastart)===null||a===void 0||a.call(n),(s=(i=this.cbs).ontext)===null||s===void 0||s.call(i,E),(l=(u=this.cbs).oncdataend)===null||l===void 0||l.call(u)):((f=(d=this.cbs).oncomment)===null||f===void 0||f.call(d,`[CDATA[${E}]]`),(C=(h=this.cbs).oncommentend)===null||C===void 0||C.call(h)),this.startIndex=t+1}onend(){var e,t;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let r=0;r<this.stack.length;r++)this.cbs.onclosetag(this.stack[r],!0)}(t=(e=this.cbs).onend)===null||t===void 0||t.call(e)}reset(){var e,t,r,n;(t=(e=this.cbs).onreset)===null||t===void 0||t.call(e),this.tokenizer.reset(),this.tagname="",this.attribname="",this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,(n=(r=this.cbs).onparserinit)===null||n===void 0||n.call(r,this),this.buffers.length=0,this.foreignContext.length=0,this.foreignContext.unshift(!this.htmlMode),this.bufferOffset=0,this.writeIndex=0,this.ended=!1}parseComplete(e){this.reset(),this.end(e)}getSlice(e,t){for(;e-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();let r=this.buffers[0].slice(e-this.bufferOffset,t-this.bufferOffset);for(;t-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),r+=this.buffers[0].slice(0,t-this.bufferOffset);return r}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(e){var t,r;if(this.ended){(r=(t=this.cbs).onerror)===null||r===void 0||r.call(t,new Error(".write() after done!"));return}this.buffers.push(e),this.tokenizer.running&&(this.tokenizer.write(e),this.writeIndex++)}end(e){var t,r;if(this.ended){(r=(t=this.cbs).onerror)===null||r===void 0||r.call(t,new Error(".end() after done!"));return}e&&this.write(e),this.ended=!0,this.tokenizer.end()}pause(){this.tokenizer.pause()}resume(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex<this.buffers.length;)this.tokenizer.write(this.buffers[this.writeIndex++]);this.ended&&this.tokenizer.end()}parseChunk(e){this.write(e)}done(e){this.end(e)}};function pp(A,e){const t=new m0(void 0,e);return new gp(t,e).end(A),t.root}const mp=Wf((A,e,t,r)=>e._useHtmlParser2?pp(A,e):op(A,e,t,r)),wu=Fh(mp,(A,e)=>e._useHtmlParser2?Gr(A,e):cp(A));var G=(A=>(A[A.None=0]="None",A[A.Text=1]="Text",A[A.Image=2]="Image",A[A.Video=3]="Video",A[A.Icon=4]="Icon",A[A.Link=5]="Link",A[A.Button=6]="Button",A[A.Block=10]="Block",A))(G||{}),zA;(A=>{A.THEME_TEXT_COLOR_CLASS="gp-designer-theme-text",A.THEME_BUTTON_COLOR_CLASS="gp-designer-theme-button",A.THEME_ICON_COLOR_CLASS="gp-designer-theme-icon",A.THEME_COLOR="#3574e6",A.IMAGE_PREVIEW_CLASS="gp-designer-image-preview"})(zA||(zA={}));const Ep=c.defineComponent({name:"GpMessage",props:{message:{type:String,required:!0},type:{type:String,default:"info"},position:{type:String,default:"top-right"},duration:{type:Number,default:3e3},onClose:{type:Function,required:!0},icon:{type:Boolean,default:!0}},setup(A){const e=c.ref(!1),t=c.computed(()=>({success:"bg-green-100 text-green-800",error:"bg-red-100 text-red-800",info:"bg-blue-100 text-blue-800",warning:"bg-yellow-100 text-yellow-800"})[A.type]),r=()=>{e.value=!1,A.onClose()};return setTimeout(()=>{r()},A.duration),e.value=!0,{visible:e,typeClass:t,closeMessage:r}}}),Ge=(A,e)=>{const t=A.__vccOpts||A;for(const[r,n]of e)t[r]=n;return t},Cp={key:0,class:"gp-message"},wp={key:0,class:"mr-2"},bp={key:0,class:"text-green-500"},Tp={key:1,class:"text-red-500"},Up={key:2,class:"text-blue-500"},Qp={key:3,class:"text-yellow-500"};function Fp(A,e,t,r,n,a){return c.openBlock(),c.createBlock(c.Transition,{name:"fade"},{default:c.withCtx(()=>[A.visible?(c.openBlock(),c.createElementBlock("div",Cp,[c.createElementVNode("div",{class:c.normalizeClass([A.typeClass,"message-content"])},[A.icon?(c.openBlock(),c.createElementBlock("span",wp,[c.renderSlot(A.$slots,"icon",{},()=>[A.type==="success"?(c.openBlock(),c.createElementBlock("span",bp,"✔")):c.createCommentVNode("",!0),A.type==="error"?(c.openBlock(),c.createElementBlock("span",Tp,"✖")):c.createCommentVNode("",!0),A.type==="info"?(c.openBlock(),c.createElementBlock("span",Up,"ℹ")):c.createCommentVNode("",!0),A.type==="warning"?(c.openBlock(),c.createElementBlock("span",Qp,"⚠")):c.createCommentVNode("",!0)],!0)])):c.createCommentVNode("",!0),c.createElementVNode("span",null,c.toDisplayString(A.message),1),c.createElementVNode("button",{class:"close-btn hover:text-gray-800 font-bold",onClick:e[0]||(e[0]=(...i)=>A.closeMessage&&A.closeMessage(...i))}," × ")],2)])):c.createCommentVNode("",!0)]),_:3})}const Ip=Ge(Ep,[["render",Fp],["__scopeId","data-v-a234b03c"]]),yt=c.reactive([]);let li=null;const yp=()=>{const A=document.createElement("div");return A.id="global-message-container",document.body.appendChild(A),A},xp=()=>{if(li)return;const A=yp();li=c.createApp({setup(){return{messageQueue:yt}},render(){const e=c.computed(()=>{var r;return{"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4","top-center":"top-4 left-1/2 transform -translate-x-1/2","bottom-center":"bottom-4 left-1/2 transform -translate-x-1/2"}[((r=yt[0])==null?void 0:r.options.position)||"top-right"]});return c.h("div",{class:`fixed flex flex-col gap-2 ${e.value}`,style:{zIndex:999999}},yt.map(t=>c.h(Ip,{key:t.id,...t.options,onClose:()=>bu(t.id)})))}}),li.mount(A)},bu=A=>{const e=yt.findIndex(t=>t.id===A);e!==-1&&yt.splice(e,1)};let vp=0;const j=A=>{xp();const e=vp++;yt.push({id:e,options:A}),setTimeout(()=>{bu(e)},A.duration||3e3)};j.success=(A,e=3e3,t=!0)=>{j(typeof A=="string"?{message:A,type:"success",duration:e,icon:t}:{...A,type:"success"})},j.error=(A,e=3e3,t=!0)=>{j(typeof A=="string"?{message:A,type:"error",duration:e,icon:t}:{...A,type:"error"})},j.info=(A,e=3e3,t=!0)=>{j(typeof A=="string"?{message:A,type:"info",duration:e,icon:t}:{...A,type:"info"})},j.warning=(A,e=3e3,t=!0)=>{j(typeof A=="string"?{message:A,type:"warning",duration:e,icon:t}:{...A,type:"warning"})};const _p=["onClick"],Np={key:2,"date-action":"1",contenteditable:"false",class:"text-red-500 text-xs mt-1"},Sp=Ge(c.defineComponent({__name:"ElementRenderer",props:{element:{type:Object,required:!0},selectedElement:Object,hoveredElement:Object,uploadByFile:{type:Function,required:!1},icons:{type:Array,default:()=>[]},mode:{type:String,default:"edit"},cropper:{type:Object,required:!1},icon:{type:Object,required:!1},upload:{type:Object,required:!1},r:{type:String,required:!1},showMargin:{type:Boolean,default:!1},isCover:{type:Boolean,default:!1}},emits:["selectElement","hoverElement","updateText","contentUpdated","blockAction","addIcon","updateElementRule","getCoverHtml"],setup(A,{emit:e}){const t=A,r=e,n=c.computed(()=>{var _;const y=t.element.editText||t.element.text;return t.element.rule&&t.element.rule.allowWrap?(_=y==null?void 0:y.replace(/\n/g,"<br>"))==null?void 0:_.replace(/ /g," "):y}),a=c.computed(()=>t.selectedElement===t.element),i=c.computed(()=>t.hoveredElement===t.element),s=c.ref(!1),u=c.ref(!1),l=c.ref(""),d=c.computed(()=>t.element.rule.minText||0),f=c.computed(()=>t.element.rule.maxText||1/0),h=y=>{let _="";if(y.children&&y.children.length&&y.children[0].type===G.Block&&y.children[0].rule&&y.children[0].rule.flexColumns&&y.children[0].rule.flexColumns.length>0){if(!y.children[0].rule.flexColumns.includes(-1)){const J=y.children[0].rule.flexColumn;Math.min(J,y.children.length)>=1&&(_+=" pc:flex pc:justify-center pc:flex-wrap")}if(y.children[0].rule.mobileFlexColumn!==-1){const J=y.children[0].rule.mobileFlexColumn;(J>=1||!J)&&(_+=" mobile:flex mobile:justify-normal mobile:flex-wrap",J||(_+=" gp-designer-m-swiper swiper-wrapper "))}}if(y.type===G.Block){const J=y.rule.flexColumn,wA=y.rule.mobileFlexColumn;(wA>=1||J>=1)&&(_+=" box-border "),wA>1&&wA<=12?_+=` mobile:basis-1/${wA} `:wA==1?_+=" mobile:basis-full ":wA||(_+=" gp-designer-m-swiper-slide swiper-slide "),J>1&&J<=12?_+=` pc:basis-1/${J} `:J==1&&(_+=" pc:basis-full ")}if((y.type==G.Button||y.type==G.Link)&&y.rule.openMeiqia&&(_+=" gp-designer-meiqia "),y.rule.isThemeColor&&t.element.type===G.Text?_+=" "+zA.THEME_TEXT_COLOR_CLASS+" ":y.rule.isThemeColor&&t.element.type===G.Button?_+=" "+zA.THEME_BUTTON_COLOR_CLASS+" ":y.rule.isThemeColor&&t.element.type===G.Icon&&(_+=" "+zA.THEME_ICON_COLOR_CLASS+" "),y.attrs.class){var gA=y.attrs.class.split(" ").filter(J=>J);gA.length&&(_=_.split(" ").filter(J=>!gA.includes(J)).join(" "))}return y.type===G.Image&&y.rule.preview&&(_+=" "+zA.IMAGE_PREVIEW_CLASS+" "),_};c.watch(()=>t.r,()=>{r("contentUpdated",D())},{immediate:!0});function C(y){y.xpath!="/div[1]"&&t.mode!=="preview"&&(t.mode==="edit"?y.type===G.Text&&r("selectElement",y):r("selectElement",y),!y.rule.isReadOnly&&y.type===G.Text&&(s.value=!0))}function E(y){r("selectElement",y)}function T(y,_){r("hoverElement",y,_)}function v(y){r("hoverElement",y)}function b(y){y.currentTarget.contains(y.relatedTarget)?r("hoverElement",null):t.hoveredElement?r("hoverElement",null,t.hoveredElement.parentxpath):r("hoverElement",null)}function x(){s.value=!1,r("contentUpdated",D())}function D(){function y(gA){var ma;const J=gA;if(J.tag==="br")return"";const wA=J.rule.isThemeColor&&J.type==G.Text?zA.THEME_TEXT_COLOR_CLASS:J.rule.isThemeColor&&J.type==G.Button?zA.THEME_BUTTON_COLOR_CLASS:J.rule.isThemeColor&&J.type==G.Icon?zA.THEME_ICON_COLOR_CLASS:"";wA?J.attrs.class&&!J.attrs.class.includes(wA)?J.attrs.class=J.attrs.class?J.attrs.class+" "+wA:wA:J.attrs.class||(J.attrs.class=wA):J.attrs.class=(ma=J.attrs.class)==null?void 0:ma.replace(new RegExp(`${zA.THEME_TEXT_COLOR_CLASS}|${zA.THEME_BUTTON_COLOR_CLASS}|${zA.THEME_ICON_COLOR_CLASS}`,"g"),"");const OA={class:J.attrs.class||""};OA.class&&(OA.class=OA.class.replace(/pc:\S+/g,"").replace(/mobile:\S+/g,""),OA.class=OA.class.replace(/gp-designer-m-swiper/g,"").replace(/gp-designer-m-swiper-slide/g,"").replace(/swiper-wrapper/g,"").replace(/swiper-slide/g,"").replace(/gp-designer-meiqia/g,""));const Ct=h(J);Ct&&(OA.class+=" "+Ct),J.type===G.Image&&(J.rule.preview?OA.class.includes(zA.IMAGE_PREVIEW_CLASS)||(OA.class+=" "+zA.IMAGE_PREVIEW_CLASS+" "):OA.class=OA.class.replace(zA.IMAGE_PREVIEW_CLASS,""));let Xt=Object.entries(gA.attrs||{}).filter(([Q,F])=>Q!=="class").map(([Q,F])=>`${Q}="${F}"`).join(" ");const Wt=Object.entries(OA||{}).map(([Q,F])=>`${Q}="${F.trim()}"`).join(" ");Xt+=Wt;const Ba=`<${gA.tag}${Xt?" "+Xt:""}>`,ga=`</${gA.tag}>`,pa=(gA.children||[]).map(Q=>y(Q)).join("");let rt=gA.editText||gA.text||"";return rt=rt.replace(/\r\n/g,`
|
9
|
-
`).replace(/\n/g,"<br>"),`${Ba}${rt}${pa}${ga}`}return y(t.element)}function R(y){var wA,OA;y.preventDefault(),y.stopPropagation();let _=((wA=y.clipboardData)==null?void 0:wA.getData("text/plain"))||"";(OA=t.element.rule)!=null&&OA.allowWrap?(_=_==null?void 0:_.replace(/\n/g,"<br>"),document.execCommand("insertHTML",!1,_)):(_=_==null?void 0:_.replace(/\n/g," "),document.execCommand("insertText",!1,_));const gA=y.target,J=gA.innerText||gA.textContent||"";L(J)}function O(y){var _;y.key==="Enter"&&(y.preventDefault(),y.stopPropagation(),(_=t.element.rule)!=null&&_.allowWrap?document.execCommand("insertLineBreak"):j.error("当前节点不允许换行"))}function m(y){y.stopPropagation();const _=y.target,gA=_.innerText||_.textContent||"";L(gA)}function L(y){if(y.length<d.value){u.value=!0,l.value=`最少输入 ${d.value} 个字符`;return}else if(y.length>f.value){u.value=!0,l.value=`最多输入 ${f.value} 个字符`;return}else u.value=!1,l.value="";r("updateText",{element:t.element,newText:y}),r("contentUpdated",D());const _=c.toRaw(t.element);_.editText=y}function V(y){r("updateText",y),r("contentUpdated",D())}function k(){const y={...t.element};r("blockAction",{action:"add",element:t.element,newBlock:y})}function z(){aA(t.element),r("blockAction",{action:"moveUp",element:t.element})}function aA(y){y.children&&y.children.length>0&&y.children.forEach(_=>{_.type==G.Text&&(_.text!==_.editText&&(_.text=_.editText),aA(_))})}function cA(){aA(t.element),r("blockAction",{action:"moveDown",element:t.element})}function W(){r("blockAction",{action:"delete",element:t.element})}function rA(y){r("blockAction",y),r("contentUpdated",D())}function fA(y){yA.value.openModal(y)}function BA(y){XA.value.openModal(y)}function TA(y,_){r("addIcon",y,_),r("contentUpdated",D())}function YA(y){r("updateElementRule",y)}const yA=c.ref(t.icon);c.watch(()=>t.icon,y=>{yA.value=y},{immediate:!0});const XA=c.ref(t.upload);c.watch(()=>t.upload,y=>{XA.value=y},{immediate:!0});const WA=c.computed(()=>{const y=h(t.element);return t.element.css=y,y}),ie=(y,_)=>{_.children&&_.children.length&&_.children[0].type===G.Block&&_.children.map(gA=>{gA.rule.flexColumn=y}),r("updateElementRule",_)},PA=c.computed(()=>{let y="";if(t.mode==="design"){const _=t.element;if(_.type===G.Block){const gA=_.rule.flexColumn;gA>1&&gA<=12&&(y+=`flex-basis: calc(100% / ${gA} - 10px);`)}}return y}),JA=c.ref(null),ZA=async()=>{JA.value&&r("getCoverHtml",JA.value)};return c.watch(()=>t.isCover,y=>{y&&ZA()},{immediate:!0}),(y,_)=>{const gA=c.resolveComponent("ElementRenderer",!0);return c.openBlock(),c.createElementBlock(c.Fragment,null,[t.element.type==c.unref(G).Text?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(t.element.tag),c.mergeProps({key:0,class:["relative",A.mode==="design"?" border-dashed border-2":"",A.showMargin?"p-1 m-1":"",i.value?"border-dashed border-blue-500":"",a.value?"border-dashed border-green-500 z-5 border-2":"",u.value?"border-dashed border-red-500":"",(!i.value&&!a.value&&!u.value,""),t.element.rule&&t.element.rule.isReadOnly?"cursor-not-allowed":"",WA.value],style:PA.value},t.element.attrs,{contenteditable:s.value&&t.element.type==c.unref(G).Text&&a.value&&!t.element.rule.isReadOnly&&!t.element.rule.allowWrap,onClick:_[0]||(_[0]=c.withModifiers(()=>C(t.element),["stop"])),onMouseenter:_[1]||(_[1]=()=>v(t.element)),onMouseleave:b,onBlur:x,onInput:m,onPaste:R,onKeydown:c.withModifiers(O,["stop"]),ref_key:"elementRef",ref:JA,innerHTML:n.value}),null,16,["class","style","contenteditable","innerHTML"])):(c.openBlock(),c.createBlock(c.resolveDynamicComponent(t.element.tag),c.mergeProps({key:1,class:["relative",A.mode==="design"?" border-dashed border-2":"",A.showMargin?"p-1 m-1":"",i.value?"border-dashed border-blue-500":"",a.value?"border-dashed border-green-500 z-5 border-2":"",u.value?"border-dashed border-red-500":"",(!i.value&&!a.value&&!u.value,""),t.element.rule&&t.element.rule.isReadOnly?"cursor-not-allowed":"",t.element.type===c.unref(G).Icon?"icon-upload-box":"",WA.value],style:PA.value},t.element.attrs,{contenteditable:!1,onClick:_[5]||(_[5]=c.withModifiers(()=>C(t.element),["stop"])),onMouseenter:_[6]||(_[6]=()=>v(t.element)),onMouseleave:b,onBlur:x,onInput:m,onPaste:R,onKeydown:c.withModifiers(O,["stop"]),ref_key:"elementRef",ref:JA}),{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(n.value)+" ",1),t.element.children&&t.element.children.length?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(t.element.children,(J,wA)=>(c.openBlock(),c.createBlock(gA,{"show-margin":A.showMargin,key:wA,r:A.r,mode:A.mode,icons:A.icons,element:J,selectedElement:t.selectedElement,hoveredElement:t.hoveredElement,cropper:A.cropper,icon:A.icon,upload:A.upload,"upload-by-file":A.uploadByFile,onSelectElement:E,onHoverElement:T,onUpdateText:V,onBlockAction:rA,onAddIcon:TA,onUpdateElementRule:()=>YA(J)},null,8,["show-margin","r","mode","icons","element","selectedElement","hoveredElement","cropper","icon","upload","upload-by-file","onUpdateElementRule"]))),128)),t.element.type===c.unref(G).Block?(c.openBlock(),c.createElementBlock("div",{key:0,"date-action":"1",contenteditable:"false",onClick:_[2]||(_[2]=c.withModifiers(()=>{},["stop"])),class:"hover:z-10 z-9 flex space-x-1 flex-none flex-nowrap overflow-visible absolute left-2 top-2 text-sm"},[c.createElementVNode("button",{class:"flex-none content-center items-center p-1 bg-green-500/80 text-white rounded hover:bg-green-500",onClick:c.withModifiers(k,["stop"])},_[9]||(_[9]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("rect",{width:"336",height:"336",x:"128",y:"128",fill:"none",stroke:"white","stroke-linejoin":"round","stroke-width":"32",rx:"57",ry:"57"}),c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m383.5 128l.5-24a56.16 56.16 0 0 0-56-56H112a64.19 64.19 0 0 0-64 64v216a56.16 56.16 0 0 0 56 56h24"})],-1)])),c.createElementVNode("button",{class:"flex-none content-center items-center p-1 bg-blue-500/80 text-white rounded hover:bg-blue-500",onClick:c.withModifiers(z,["stop"])},_[10]||(_[10]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M244 400L100 256l144-144M120 256h292"})],-1)])),c.createElementVNode("button",{class:"flex-none content-center items-center p-1 bg-blue-500/80 text-white rounded hover:bg-blue-500",onClick:c.withModifiers(cA,["stop"])},_[11]||(_[11]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"m268 112l144 144l-144 144m124-144H100"})],-1)])),c.createElementVNode("button",{class:"flex-none content-center items-center p-1 bg-red-500/80 text-white rounded hover:bg-red-500",onClick:c.withModifiers(W,["stop"])},_[12]||(_[12]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M400 256H112"})],-1)]))])):c.createCommentVNode("",!0),t.element.children&&t.element.children.length&&t.element.children[0].type===c.unref(G).Block&&t.element.children[0].rule&&t.element.children[0].rule.flexColumns&&t.element.children[0].rule.flexColumns.length>0&&!t.element.children[0].rule.flexColumns.includes(-1)?(c.openBlock(),c.createElementBlock("div",{key:1,"date-action":"1",contenteditable:"false",onClick:_[3]||(_[3]=c.withModifiers(()=>{},["stop"])),class:"hover:z-10 z-9 flex space-x-1 flex-none flex-nowrap overflow-visible absolute right-0 -top-6 items-center"},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(t.element.children[0].rule.flexColumns,(J,wA)=>(c.openBlock(),c.createElementBlock("button",{class:c.normalizeClass(["text-xs w-6 h-6 flex-none content-center items-center justify-center bg-purple-400/80 text-white rounded hover:bg-purple-600",t.element.children[0].rule.flexColumn===J?"bg-purple-700":""]),onClick:c.withModifiers(()=>ie(J,t.element),["stop"])},c.toDisplayString(J),11,_p))),256))])):c.createCommentVNode("",!0)],64)):c.createCommentVNode("",!0),t.element.type===c.unref(G).Icon?(c.openBlock(),c.createElementBlock("div",{key:1,class:"icon-upload cursor-pointer rounded-sm w-5 h-5 justify-center items-center absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-sm text-gray-50 z-10 bg-black/80 hover:bg-black",contenteditable:"false",onClick:_[4]||(_[4]=c.withModifiers(()=>fA(t.element),["stop"]))},_[13]||(_[13]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 367.79h76c55 0 100-29.21 100-83.6s-53-81.47-96-83.6c-8.89-85.06-71-136.8-144-136.8c-69 0-113.44 45.79-128 91.2c-60 5.7-112 43.88-112 106.4s54 106.4 120 106.4h56"}),c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m320 255.79l-64-64l-64 64m64 192.42V207.79"})],-1)]))):c.createCommentVNode("",!0)]),_:1},16,["class","style"])),t.element.type==c.unref(G).Text&&u.value?(c.openBlock(),c.createElementBlock("div",Np,c.toDisplayString(l.value),1)):c.createCommentVNode("",!0),t.element.type===c.unref(G).Image?(c.openBlock(),c.createElementBlock("div",{key:3,class:"cursor-pointer rounded-sm flex justify-center items-center absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-sm text-gray-50 z-10 bg-black/80 hover:bg-black",onClick:_[8]||(_[8]=c.withModifiers(()=>{},["stop"])),contenteditable:"false"},[c.createElementVNode("div",{class:"p-1",onClick:_[7]||(_[7]=c.withModifiers(()=>BA(t.element),["stop"]))},_[14]||(_[14]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 367.79h76c55 0 100-29.21 100-83.6s-53-81.47-96-83.6c-8.89-85.06-71-136.8-144-136.8c-69 0-113.44 45.79-128 91.2c-60 5.7-112 43.88-112 106.4s54 106.4 120 106.4h56"}),c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m320 255.79l-64-64l-64 64m64 192.42V207.79"})],-1)]))])):c.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-de48901b"]]),Lp=c.defineComponent({name:"GpCheckbox",props:{modelValue:{type:Boolean,required:!0},label:{type:String,default:""}},emits:["update:modelValue"],setup(A,{emit:e}){return{updateValue:r=>{e("update:modelValue",r.target.checked)}}}}),Hp={class:"form-group"},Dp={class:"flex items-center space-x-2 cursor-pointer"},Op=["checked","aria-checked"],Rp={class:"checkbox-label text-sm text-gray-700"};function Mp(A,e,t,r,n,a){return c.openBlock(),c.createElementBlock("div",Hp,[c.createElementVNode("label",Dp,[c.createElementVNode("input",{type:"checkbox",checked:A.modelValue,onChange:e[0]||(e[0]=(...i)=>A.updateValue&&A.updateValue(...i)),class:"custom-checkbox","aria-checked":A.modelValue},null,40,Op),c.createElementVNode("span",Rp,c.toDisplayString(A.label),1)])])}const lt=Ge(Lp,[["render",Mp],["__scopeId","data-v-68b8f276"]]),kp={class:"text-sm"},Pp={key:0},Kp={key:0},Vp={class:"text-gray-500 my-2 truncate"},Gp={class:"text-gray-500 my-2 break-words"},Yp={key:1},Xp={key:2},Wp={key:3},Jp={key:4},qp={key:5},jp={key:6},zp={key:7},$p={key:8},Zp={key:9},Am={key:10},em={key:11},tm={key:12},rm={key:13},nm={key:14},am=Ge(c.defineComponent({__name:"EditorPanel",props:{element:Object},emits:["updateElement"],setup(A,{emit:e}){const t=A,r=e,n=c.ref({rule:{},...t.element});c.watch(()=>t.element,i=>{n.value={rule:{},...i}},{immediate:!0});function a(){var i;if(n.value.type===G.Icon&&!n.value.attrs.class.includes("iconfont")){j.error("图标仅支持 iconfont 图标");return}if(n.value.type===G.Image&&n.value.tag!=="img"){j.error("节点类型错误");return}if(n.value.type===G.Video&&n.value.tag!=="video"){j.error("节点类型错误");return}if(n.value.type===G.Link&&n.value.tag!=="a"){j.error("节点类型错误");return}if(n.value.type===G.Text){if(n.value.rule.maxText&&Number(n.value.rule.minText)>Number(n.value.rule.maxText)){j.error("最小文本长度不能大于最大文本长度");return}if(n.value.tag!=="p"&&n.value.tag!=="div"&&n.value.tag!=="span"&&n.value.tag!=="h1"&&n.value.tag!=="h2"&&n.value.tag!=="h3"&&n.value.tag!=="h4"&&n.value.tag!=="h5"&&n.value.tag!=="h6"&&n.value.tag!=="label"&&n.value.tag!=="strong"&&n.value.tag!=="em"&&n.value.tag!=="b"&&n.value.tag!=="i"&&n.value.tag!=="ul"&&n.value.tag!=="ol"&&n.value.tag!=="li"&&n.value.tag!=="dl"&&n.value.tag!=="dt"&&n.value.tag!=="dd"){j.error("节点类型错误");return}}if(n.value.type===G.Block){if(n.value.rule.maxBlock&&Number(n.value.rule.minBlock)>Number(n.value.rule.maxBlock)){j.error("最小块数量不能大于最大块数量");return}if(n.value.tag!=="div"&&n.value.tag!=="section"&&n.value.tag!=="article"&&n.value.tag!=="nav"&&n.value.tag!=="header"&&n.value.tag!=="footer"&&n.value.tag!=="span"&&n.value.tag!=="p"&&n.value.tag!=="img"){j.error("节点类型错误");return}if(!n.value.children||n.value.children.length<1){j.error("节点错误,必须包含子元素");return}((i=n.value.rule.flexColumns)==null?void 0:i.length)>0&&!n.value.rule.flexColumns.includes(-1)?n.value.rule.flexColumn=n.value.rule.flexColumns[0]:n.value.rule.flexColumn=void 0}n.value.rule.minText?n.value.rule.minText=Number(n.value.rule.minText):n.value.rule.minText=void 0,n.value.rule.maxText?n.value.rule.maxText=Number(n.value.rule.maxText):n.value.rule.maxText=void 0,n.value.rule.minBlock?n.value.rule.minBlock=Number(n.value.rule.minBlock):n.value.rule.minBlock=void 0,n.value.rule.maxBlock?n.value.rule.maxBlock=Number(n.value.rule.maxBlock):n.value.rule.maxBlock=void 0,n.value.rule.flexColumn?n.value.rule.flexColumn=Number(n.value.rule.flexColumn):n.value.rule.flexColumn=void 0,n.value.rule.mobileFlexColumn?n.value.rule.mobileFlexColumn=Number(n.value.rule.mobileFlexColumn):n.value.rule.mobileFlexColumn=void 0,r("updateElement",n.value)}return(i,s)=>(c.openBlock(),c.createElementBlock("div",kp,[n.value?(c.openBlock(),c.createElementBlock("div",Pp,[n.value.text!==void 0?(c.openBlock(),c.createElementBlock("div",Kp,[s[17]||(s[17]=c.createElementVNode("label",{class:"block"},"内容",-1)),c.createElementVNode("div",Vp,c.toDisplayString(n.value.text||"-"),1)])):c.createCommentVNode("",!0),c.createElementVNode("div",null,[s[18]||(s[18]=c.createElementVNode("label",{class:"block mt-4"},"节点",-1)),c.createElementVNode("div",Gp,c.toDisplayString(n.value.xpath),1)]),c.createElementVNode("div",null,[s[20]||(s[20]=c.createElementVNode("label",{class:"block mt-4"},"类型",-1)),c.withDirectives(c.createElementVNode("select",{"onUpdate:modelValue":s[0]||(s[0]=u=>n.value.type=u),class:"border rounded p-1 w-full"},s[19]||(s[19]=[c.createElementVNode("option",{value:0},"无",-1),c.createElementVNode("option",{value:1},"文本",-1),c.createElementVNode("option",{value:2},"图片",-1),c.createElementVNode("option",{value:3},"视频",-1),c.createElementVNode("option",{value:4},"图标",-1),c.createElementVNode("option",{value:5},"链接",-1),c.createElementVNode("option",{value:6},"按钮",-1),c.createElementVNode("option",{value:10},"块",-1)]),512),[[c.vModelSelect,n.value.type]])]),n.value.type==c.unref(G).Text?(c.openBlock(),c.createElementBlock("div",Yp,[s[21]||(s[21]=c.createElementVNode("label",{class:"block mt-4"},"最小文本长度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":s[1]||(s[1]=u=>n.value.rule.minText=u),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.minText]])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Text?(c.openBlock(),c.createElementBlock("div",Xp,[s[22]||(s[22]=c.createElementVNode("label",{class:"block mt-4"},"最大文本长度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":s[2]||(s[2]=u=>n.value.rule.maxText=u),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.maxText]])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Image?(c.openBlock(),c.createElementBlock("div",Wp,[s[23]||(s[23]=c.createElementVNode("label",{class:"block mt-4"},"是否裁剪",-1)),c.createVNode(lt,{class:"py-2",modelValue:n.value.rule.crop,"onUpdate:modelValue":s[3]||(s[3]=u=>n.value.rule.crop=u),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Image?(c.openBlock(),c.createElementBlock("div",Jp,[s[24]||(s[24]=c.createElementVNode("label",{class:"block mt-4"},"图片宽度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":s[4]||(s[4]=u=>n.value.rule.minImageWidth=u),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.minImageWidth]])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Image?(c.openBlock(),c.createElementBlock("div",qp,[s[25]||(s[25]=c.createElementVNode("label",{class:"block mt-4"},"图片高度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":s[5]||(s[5]=u=>n.value.rule.maxImageHeight=u),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.maxImageHeight]])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Block?(c.openBlock(),c.createElementBlock("div",jp,[s[26]||(s[26]=c.createElementVNode("label",{class:"block mt-4"},"块最小数量",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":s[6]||(s[6]=u=>n.value.rule.minBlock=u),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.minBlock]])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Block?(c.openBlock(),c.createElementBlock("div",zp,[s[27]||(s[27]=c.createElementVNode("label",{class:"block mt-4"},"块最大数量",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":s[7]||(s[7]=u=>n.value.rule.maxBlock=u),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.maxBlock]])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Block?(c.openBlock(),c.createElementBlock("div",$p,[s[29]||(s[29]=c.createElementVNode("label",{class:"block mt-4"},"PC端每行列数",-1)),c.withDirectives(c.createElementVNode("select",{multiple:"","onUpdate:modelValue":s[8]||(s[8]=u=>n.value.rule.flexColumns=u),class:"border rounded p-1 w-full h-32"},s[28]||(s[28]=[c.createElementVNode("option",{value:-1},"未配置",-1),c.createElementVNode("option",{value:1},"1",-1),c.createElementVNode("option",{value:2},"2",-1),c.createElementVNode("option",{value:3},"3",-1),c.createElementVNode("option",{value:4},"4",-1),c.createElementVNode("option",{value:5},"5",-1),c.createElementVNode("option",{value:6},"6",-1),c.createElementVNode("option",{value:7},"7",-1),c.createElementVNode("option",{value:8},"8",-1),c.createElementVNode("option",{value:9},"9",-1),c.createElementVNode("option",{value:10},"10",-1),c.createElementVNode("option",{value:11},"11",-1),c.createElementVNode("option",{value:12},"12",-1)]),512),[[c.vModelSelect,n.value.rule.flexColumns]])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Block?(c.openBlock(),c.createElementBlock("div",Zp,[s[31]||(s[31]=c.createElementVNode("label",{class:"block mt-4"},"移动端每行列数",-1)),c.withDirectives(c.createElementVNode("select",{"onUpdate:modelValue":s[9]||(s[9]=u=>n.value.rule.mobileFlexColumn=u),class:"border rounded p-1 w-full"},s[30]||(s[30]=[c.createElementVNode("option",{value:-1},"未配置",-1),c.createElementVNode("option",{value:void 0},"轮播",-1),c.createElementVNode("option",{value:1},"1",-1),c.createElementVNode("option",{value:2},"2",-1),c.createElementVNode("option",{value:3},"3",-1),c.createElementVNode("option",{value:4},"4",-1),c.createElementVNode("option",{value:5},"5",-1),c.createElementVNode("option",{value:6},"6",-1)]),512),[[c.vModelSelect,n.value.rule.mobileFlexColumn]])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Text||n.value.type==c.unref(G).Icon||n.value.type==c.unref(G).Button?(c.openBlock(),c.createElementBlock("div",Am,[s[32]||(s[32]=c.createElementVNode("label",{class:"block mt-4"},"主题色",-1)),c.createVNode(lt,{class:"py-2",modelValue:n.value.rule.isThemeColor,"onUpdate:modelValue":s[10]||(s[10]=u=>n.value.rule.isThemeColor=u),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),c.createElementVNode("div",null,[s[33]||(s[33]=c.createElementVNode("label",{class:"block mt-4"},"是否必填",-1)),c.createVNode(lt,{class:"py-2",modelValue:n.value.rule.isRequired,"onUpdate:modelValue":s[11]||(s[11]=u=>n.value.rule.isRequired=u),label:"是"},null,8,["modelValue"])]),c.createElementVNode("div",null,[s[34]||(s[34]=c.createElementVNode("label",{class:"block mt-4"},"是否只读",-1)),c.createVNode(lt,{class:"py-2",modelValue:n.value.rule.isReadOnly,"onUpdate:modelValue":s[12]||(s[12]=u=>n.value.rule.isReadOnly=u),label:"是"},null,8,["modelValue"])]),n.value.type==c.unref(G).Link||n.value.type==c.unref(G).Button?(c.openBlock(),c.createElementBlock("div",em,[s[35]||(s[35]=c.createElementVNode("label",{class:"block mt-4"},"打开美洽",-1)),c.createVNode(lt,{class:"py-2",modelValue:n.value.rule.openMeiqia,"onUpdate:modelValue":s[13]||(s[13]=u=>n.value.rule.openMeiqia=u),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Link||n.value.type==c.unref(G).Button?(c.openBlock(),c.createElementBlock("div",tm,[s[36]||(s[36]=c.createElementVNode("label",{class:"block mt-4"},"链接",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":s[14]||(s[14]=u=>n.value.rule.linkUrl=u),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.linkUrl]])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Text?(c.openBlock(),c.createElementBlock("div",rm,[s[37]||(s[37]=c.createElementVNode("label",{class:"block mt-4"},"允许换行(回车/粘贴多段文本等)",-1)),c.createVNode(lt,{class:"py-2",modelValue:n.value.rule.allowWrap,"onUpdate:modelValue":s[15]||(s[15]=u=>n.value.rule.allowWrap=u),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Image?(c.openBlock(),c.createElementBlock("div",nm,[s[38]||(s[38]=c.createElementVNode("label",{class:"block mt-4"},"预览(点击查看大图)",-1)),c.createVNode(lt,{class:"py-2",modelValue:n.value.rule.preview,"onUpdate:modelValue":s[16]||(s[16]=u=>n.value.rule.preview=u),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0),c.createElementVNode("button",{onClick:a,class:"mt-4 p-2 bg-green-500 text-white rounded"}," 保存 ")]))}}),[["__scopeId","data-v-c53c9169"]]);/*!
|
8
|
+
`)}}).toArray()}const bh=Object.freeze(Object.defineProperty({__proto__:null,serialize:Ch,serializeArray:wh},Symbol.toStringTag,{value:"Module"}));function Th(A){var e;return typeof A=="string"?{selector:A,value:"textContent"}:{selector:A.selector,value:(e=A.value)!==null&&e!==void 0?e:"textContent"}}function Uh(A){const e={};for(const t in A){const r=A[t],n=Array.isArray(r),{selector:a,value:i}=Th(n?r[0]:r),s=typeof i=="function"?i:typeof i=="string"?u=>this._make(u).prop(i):u=>this._make(u).extract(i);if(n)e[t]=this._findBySelector(a,Number.POSITIVE_INFINITY).map((u,l)=>s(l,t,e)).get();else{const u=this._findBySelector(a,1);e[t]=u.length>0?s(u[0],t,e):void 0}}return e}const Qh=Object.freeze(Object.defineProperty({__proto__:null,extract:Uh},Symbol.toStringTag,{value:"Module"}));class rr{constructor(e,t,r){if(this.length=0,this.options=r,this._root=t,e){for(let n=0;n<e.length;n++)this[n]=e[n];this.length=e.length}}}rr.prototype.cheerio="[cheerio object]",rr.prototype.splice=Array.prototype.splice,rr.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator],Object.assign(rr.prototype,vd,Xf,hh,mh,bh,Qh);function Fh(A,e){return function t(r,n,a=!0){if(r==null)throw new Error("cheerio.load() expects a string");const i=Ha(n),s=A(r,i,a,null);class u extends rr{_make(f,h){const C=l(f,h);return C.prevObject=this,C}_parse(f,h,C,E){return A(f,h,C,E)}_render(f){return e(f,this.options)}}function l(d,f,h=s,C){if(d&&ve(d))return d;const E=Ha(C,i),T=typeof h=="string"?[A(h,E,!1,null)]:"length"in h?h:[h],v=ve(T)?T:new u(T,null,E);if(v._root=v,!d)return new u(void 0,v,E);const b=typeof d=="string"&&Da(d)?A(d,E,!1,null).children:Ih(d)?[d]:Array.isArray(d)?d:void 0,x=new u(b,v,E);if(b)return x;if(typeof d!="string")throw new TypeError("Unexpected type of selector");let D=d;const R=f?typeof f=="string"?Da(f)?new u([A(f,E,!1,null)],v,E):(D=`${f} ${D}`,v):ve(f)?f:new u(Array.isArray(f)?f:[f],v,E):v;return R?R.find(D):x}return Object.assign(l,md,{load:t,_root:s,_options:i,fn:u.prototype,prototype:u.prototype}),l}}function Ih(A){return!!A.name||A.type==="root"||A.type==="text"||A.type==="comment"}const yh=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]),pA="�";var B;(function(A){A[A.EOF=-1]="EOF",A[A.NULL=0]="NULL",A[A.TABULATION=9]="TABULATION",A[A.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",A[A.LINE_FEED=10]="LINE_FEED",A[A.FORM_FEED=12]="FORM_FEED",A[A.SPACE=32]="SPACE",A[A.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",A[A.QUOTATION_MARK=34]="QUOTATION_MARK",A[A.AMPERSAND=38]="AMPERSAND",A[A.APOSTROPHE=39]="APOSTROPHE",A[A.HYPHEN_MINUS=45]="HYPHEN_MINUS",A[A.SOLIDUS=47]="SOLIDUS",A[A.DIGIT_0=48]="DIGIT_0",A[A.DIGIT_9=57]="DIGIT_9",A[A.SEMICOLON=59]="SEMICOLON",A[A.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",A[A.EQUALS_SIGN=61]="EQUALS_SIGN",A[A.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",A[A.QUESTION_MARK=63]="QUESTION_MARK",A[A.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",A[A.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",A[A.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",A[A.GRAVE_ACCENT=96]="GRAVE_ACCENT",A[A.LATIN_SMALL_A=97]="LATIN_SMALL_A",A[A.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(B||(B={}));const ee={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function xo(A){return A>=55296&&A<=57343}function xh(A){return A>=56320&&A<=57343}function vh(A,e){return(A-55296)*1024+9216+e}function vo(A){return A!==32&&A!==10&&A!==13&&A!==9&&A!==12&&A>=1&&A<=31||A>=127&&A<=159}function _o(A){return A>=64976&&A<=65007||yh.has(A)}var U;(function(A){A.controlCharacterInInputStream="control-character-in-input-stream",A.noncharacterInInputStream="noncharacter-in-input-stream",A.surrogateInInputStream="surrogate-in-input-stream",A.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",A.endTagWithAttributes="end-tag-with-attributes",A.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",A.unexpectedSolidusInTag="unexpected-solidus-in-tag",A.unexpectedNullCharacter="unexpected-null-character",A.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",A.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",A.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",A.missingEndTagName="missing-end-tag-name",A.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",A.unknownNamedCharacterReference="unknown-named-character-reference",A.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",A.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",A.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",A.eofBeforeTagName="eof-before-tag-name",A.eofInTag="eof-in-tag",A.missingAttributeValue="missing-attribute-value",A.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",A.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",A.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",A.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",A.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",A.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",A.missingDoctypePublicIdentifier="missing-doctype-public-identifier",A.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",A.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",A.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",A.cdataInHtmlContent="cdata-in-html-content",A.incorrectlyOpenedComment="incorrectly-opened-comment",A.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",A.eofInDoctype="eof-in-doctype",A.nestedComment="nested-comment",A.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",A.eofInComment="eof-in-comment",A.incorrectlyClosedComment="incorrectly-closed-comment",A.eofInCdata="eof-in-cdata",A.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",A.nullCharacterReference="null-character-reference",A.surrogateCharacterReference="surrogate-character-reference",A.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",A.controlCharacterReference="control-character-reference",A.noncharacterCharacterReference="noncharacter-character-reference",A.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",A.missingDoctypeName="missing-doctype-name",A.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",A.duplicateAttribute="duplicate-attribute",A.nonConformingDoctype="non-conforming-doctype",A.missingDoctype="missing-doctype",A.misplacedDoctype="misplaced-doctype",A.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",A.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",A.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",A.openElementsLeftAfterEof="open-elements-left-after-eof",A.abandonedHeadElementChild="abandoned-head-element-child",A.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",A.nestedNoscriptInHead="nested-noscript-in-head",A.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(U||(U={}));const _h=65536;class Nh{constructor(e){this.handler=e,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=_h,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(e,t){const{line:r,col:n,offset:a}=this,i=n+t,s=a+t;return{code:e,startLine:r,endLine:r,startCol:i,endCol:i,startOffset:s,endOffset:s}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){const t=this.html.charCodeAt(this.pos+1);if(xh(t))return this.pos++,this._addGap(),vh(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,B.EOF;return this._err(U.surrogateInInputStream),e}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(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let r=0;r<e.length;r++)if((this.html.charCodeAt(this.pos+r)|32)!==e.charCodeAt(r))return!1;return!0}peek(e){const t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,B.EOF;const r=this.html.charCodeAt(t);return r===B.CARRIAGE_RETURN?B.LINE_FEED:r}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,B.EOF;let e=this.html.charCodeAt(this.pos);return e===B.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,B.LINE_FEED):e===B.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,xo(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===B.LINE_FEED||e===B.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){vo(e)?this._err(U.controlCharacterInInputStream):_o(e)&&this._err(U.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var tA;(function(A){A[A.CHARACTER=0]="CHARACTER",A[A.NULL_CHARACTER=1]="NULL_CHARACTER",A[A.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",A[A.START_TAG=3]="START_TAG",A[A.END_TAG=4]="END_TAG",A[A.COMMENT=5]="COMMENT",A[A.DOCTYPE=6]="DOCTYPE",A[A.EOF=7]="EOF",A[A.HIBERNATION=8]="HIBERNATION"})(tA||(tA={}));function No(A,e){for(let t=A.attrs.length-1;t>=0;t--)if(A.attrs[t].name===e)return A.attrs[t].value;return null}var I;(function(A){A.HTML="http://www.w3.org/1999/xhtml",A.MATHML="http://www.w3.org/1998/Math/MathML",A.SVG="http://www.w3.org/2000/svg",A.XLINK="http://www.w3.org/1999/xlink",A.XML="http://www.w3.org/XML/1998/namespace",A.XMLNS="http://www.w3.org/2000/xmlns/"})(I||(I={}));var ut;(function(A){A.TYPE="type",A.ACTION="action",A.ENCODING="encoding",A.PROMPT="prompt",A.NAME="name",A.COLOR="color",A.FACE="face",A.SIZE="size"})(ut||(ut={}));var se;(function(A){A.NO_QUIRKS="no-quirks",A.QUIRKS="quirks",A.LIMITED_QUIRKS="limited-quirks"})(se||(se={}));var w;(function(A){A.A="a",A.ADDRESS="address",A.ANNOTATION_XML="annotation-xml",A.APPLET="applet",A.AREA="area",A.ARTICLE="article",A.ASIDE="aside",A.B="b",A.BASE="base",A.BASEFONT="basefont",A.BGSOUND="bgsound",A.BIG="big",A.BLOCKQUOTE="blockquote",A.BODY="body",A.BR="br",A.BUTTON="button",A.CAPTION="caption",A.CENTER="center",A.CODE="code",A.COL="col",A.COLGROUP="colgroup",A.DD="dd",A.DESC="desc",A.DETAILS="details",A.DIALOG="dialog",A.DIR="dir",A.DIV="div",A.DL="dl",A.DT="dt",A.EM="em",A.EMBED="embed",A.FIELDSET="fieldset",A.FIGCAPTION="figcaption",A.FIGURE="figure",A.FONT="font",A.FOOTER="footer",A.FOREIGN_OBJECT="foreignObject",A.FORM="form",A.FRAME="frame",A.FRAMESET="frameset",A.H1="h1",A.H2="h2",A.H3="h3",A.H4="h4",A.H5="h5",A.H6="h6",A.HEAD="head",A.HEADER="header",A.HGROUP="hgroup",A.HR="hr",A.HTML="html",A.I="i",A.IMG="img",A.IMAGE="image",A.INPUT="input",A.IFRAME="iframe",A.KEYGEN="keygen",A.LABEL="label",A.LI="li",A.LINK="link",A.LISTING="listing",A.MAIN="main",A.MALIGNMARK="malignmark",A.MARQUEE="marquee",A.MATH="math",A.MENU="menu",A.META="meta",A.MGLYPH="mglyph",A.MI="mi",A.MO="mo",A.MN="mn",A.MS="ms",A.MTEXT="mtext",A.NAV="nav",A.NOBR="nobr",A.NOFRAMES="noframes",A.NOEMBED="noembed",A.NOSCRIPT="noscript",A.OBJECT="object",A.OL="ol",A.OPTGROUP="optgroup",A.OPTION="option",A.P="p",A.PARAM="param",A.PLAINTEXT="plaintext",A.PRE="pre",A.RB="rb",A.RP="rp",A.RT="rt",A.RTC="rtc",A.RUBY="ruby",A.S="s",A.SCRIPT="script",A.SEARCH="search",A.SECTION="section",A.SELECT="select",A.SOURCE="source",A.SMALL="small",A.SPAN="span",A.STRIKE="strike",A.STRONG="strong",A.STYLE="style",A.SUB="sub",A.SUMMARY="summary",A.SUP="sup",A.TABLE="table",A.TBODY="tbody",A.TEMPLATE="template",A.TEXTAREA="textarea",A.TFOOT="tfoot",A.TD="td",A.TH="th",A.THEAD="thead",A.TITLE="title",A.TR="tr",A.TRACK="track",A.TT="tt",A.U="u",A.UL="ul",A.SVG="svg",A.VAR="var",A.WBR="wbr",A.XMP="xmp"})(w||(w={}));var o;(function(A){A[A.UNKNOWN=0]="UNKNOWN",A[A.A=1]="A",A[A.ADDRESS=2]="ADDRESS",A[A.ANNOTATION_XML=3]="ANNOTATION_XML",A[A.APPLET=4]="APPLET",A[A.AREA=5]="AREA",A[A.ARTICLE=6]="ARTICLE",A[A.ASIDE=7]="ASIDE",A[A.B=8]="B",A[A.BASE=9]="BASE",A[A.BASEFONT=10]="BASEFONT",A[A.BGSOUND=11]="BGSOUND",A[A.BIG=12]="BIG",A[A.BLOCKQUOTE=13]="BLOCKQUOTE",A[A.BODY=14]="BODY",A[A.BR=15]="BR",A[A.BUTTON=16]="BUTTON",A[A.CAPTION=17]="CAPTION",A[A.CENTER=18]="CENTER",A[A.CODE=19]="CODE",A[A.COL=20]="COL",A[A.COLGROUP=21]="COLGROUP",A[A.DD=22]="DD",A[A.DESC=23]="DESC",A[A.DETAILS=24]="DETAILS",A[A.DIALOG=25]="DIALOG",A[A.DIR=26]="DIR",A[A.DIV=27]="DIV",A[A.DL=28]="DL",A[A.DT=29]="DT",A[A.EM=30]="EM",A[A.EMBED=31]="EMBED",A[A.FIELDSET=32]="FIELDSET",A[A.FIGCAPTION=33]="FIGCAPTION",A[A.FIGURE=34]="FIGURE",A[A.FONT=35]="FONT",A[A.FOOTER=36]="FOOTER",A[A.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",A[A.FORM=38]="FORM",A[A.FRAME=39]="FRAME",A[A.FRAMESET=40]="FRAMESET",A[A.H1=41]="H1",A[A.H2=42]="H2",A[A.H3=43]="H3",A[A.H4=44]="H4",A[A.H5=45]="H5",A[A.H6=46]="H6",A[A.HEAD=47]="HEAD",A[A.HEADER=48]="HEADER",A[A.HGROUP=49]="HGROUP",A[A.HR=50]="HR",A[A.HTML=51]="HTML",A[A.I=52]="I",A[A.IMG=53]="IMG",A[A.IMAGE=54]="IMAGE",A[A.INPUT=55]="INPUT",A[A.IFRAME=56]="IFRAME",A[A.KEYGEN=57]="KEYGEN",A[A.LABEL=58]="LABEL",A[A.LI=59]="LI",A[A.LINK=60]="LINK",A[A.LISTING=61]="LISTING",A[A.MAIN=62]="MAIN",A[A.MALIGNMARK=63]="MALIGNMARK",A[A.MARQUEE=64]="MARQUEE",A[A.MATH=65]="MATH",A[A.MENU=66]="MENU",A[A.META=67]="META",A[A.MGLYPH=68]="MGLYPH",A[A.MI=69]="MI",A[A.MO=70]="MO",A[A.MN=71]="MN",A[A.MS=72]="MS",A[A.MTEXT=73]="MTEXT",A[A.NAV=74]="NAV",A[A.NOBR=75]="NOBR",A[A.NOFRAMES=76]="NOFRAMES",A[A.NOEMBED=77]="NOEMBED",A[A.NOSCRIPT=78]="NOSCRIPT",A[A.OBJECT=79]="OBJECT",A[A.OL=80]="OL",A[A.OPTGROUP=81]="OPTGROUP",A[A.OPTION=82]="OPTION",A[A.P=83]="P",A[A.PARAM=84]="PARAM",A[A.PLAINTEXT=85]="PLAINTEXT",A[A.PRE=86]="PRE",A[A.RB=87]="RB",A[A.RP=88]="RP",A[A.RT=89]="RT",A[A.RTC=90]="RTC",A[A.RUBY=91]="RUBY",A[A.S=92]="S",A[A.SCRIPT=93]="SCRIPT",A[A.SEARCH=94]="SEARCH",A[A.SECTION=95]="SECTION",A[A.SELECT=96]="SELECT",A[A.SOURCE=97]="SOURCE",A[A.SMALL=98]="SMALL",A[A.SPAN=99]="SPAN",A[A.STRIKE=100]="STRIKE",A[A.STRONG=101]="STRONG",A[A.STYLE=102]="STYLE",A[A.SUB=103]="SUB",A[A.SUMMARY=104]="SUMMARY",A[A.SUP=105]="SUP",A[A.TABLE=106]="TABLE",A[A.TBODY=107]="TBODY",A[A.TEMPLATE=108]="TEMPLATE",A[A.TEXTAREA=109]="TEXTAREA",A[A.TFOOT=110]="TFOOT",A[A.TD=111]="TD",A[A.TH=112]="TH",A[A.THEAD=113]="THEAD",A[A.TITLE=114]="TITLE",A[A.TR=115]="TR",A[A.TRACK=116]="TRACK",A[A.TT=117]="TT",A[A.U=118]="U",A[A.UL=119]="UL",A[A.SVG=120]="SVG",A[A.VAR=121]="VAR",A[A.WBR=122]="WBR",A[A.XMP=123]="XMP"})(o||(o={}));const Sh=new Map([[w.A,o.A],[w.ADDRESS,o.ADDRESS],[w.ANNOTATION_XML,o.ANNOTATION_XML],[w.APPLET,o.APPLET],[w.AREA,o.AREA],[w.ARTICLE,o.ARTICLE],[w.ASIDE,o.ASIDE],[w.B,o.B],[w.BASE,o.BASE],[w.BASEFONT,o.BASEFONT],[w.BGSOUND,o.BGSOUND],[w.BIG,o.BIG],[w.BLOCKQUOTE,o.BLOCKQUOTE],[w.BODY,o.BODY],[w.BR,o.BR],[w.BUTTON,o.BUTTON],[w.CAPTION,o.CAPTION],[w.CENTER,o.CENTER],[w.CODE,o.CODE],[w.COL,o.COL],[w.COLGROUP,o.COLGROUP],[w.DD,o.DD],[w.DESC,o.DESC],[w.DETAILS,o.DETAILS],[w.DIALOG,o.DIALOG],[w.DIR,o.DIR],[w.DIV,o.DIV],[w.DL,o.DL],[w.DT,o.DT],[w.EM,o.EM],[w.EMBED,o.EMBED],[w.FIELDSET,o.FIELDSET],[w.FIGCAPTION,o.FIGCAPTION],[w.FIGURE,o.FIGURE],[w.FONT,o.FONT],[w.FOOTER,o.FOOTER],[w.FOREIGN_OBJECT,o.FOREIGN_OBJECT],[w.FORM,o.FORM],[w.FRAME,o.FRAME],[w.FRAMESET,o.FRAMESET],[w.H1,o.H1],[w.H2,o.H2],[w.H3,o.H3],[w.H4,o.H4],[w.H5,o.H5],[w.H6,o.H6],[w.HEAD,o.HEAD],[w.HEADER,o.HEADER],[w.HGROUP,o.HGROUP],[w.HR,o.HR],[w.HTML,o.HTML],[w.I,o.I],[w.IMG,o.IMG],[w.IMAGE,o.IMAGE],[w.INPUT,o.INPUT],[w.IFRAME,o.IFRAME],[w.KEYGEN,o.KEYGEN],[w.LABEL,o.LABEL],[w.LI,o.LI],[w.LINK,o.LINK],[w.LISTING,o.LISTING],[w.MAIN,o.MAIN],[w.MALIGNMARK,o.MALIGNMARK],[w.MARQUEE,o.MARQUEE],[w.MATH,o.MATH],[w.MENU,o.MENU],[w.META,o.META],[w.MGLYPH,o.MGLYPH],[w.MI,o.MI],[w.MO,o.MO],[w.MN,o.MN],[w.MS,o.MS],[w.MTEXT,o.MTEXT],[w.NAV,o.NAV],[w.NOBR,o.NOBR],[w.NOFRAMES,o.NOFRAMES],[w.NOEMBED,o.NOEMBED],[w.NOSCRIPT,o.NOSCRIPT],[w.OBJECT,o.OBJECT],[w.OL,o.OL],[w.OPTGROUP,o.OPTGROUP],[w.OPTION,o.OPTION],[w.P,o.P],[w.PARAM,o.PARAM],[w.PLAINTEXT,o.PLAINTEXT],[w.PRE,o.PRE],[w.RB,o.RB],[w.RP,o.RP],[w.RT,o.RT],[w.RTC,o.RTC],[w.RUBY,o.RUBY],[w.S,o.S],[w.SCRIPT,o.SCRIPT],[w.SEARCH,o.SEARCH],[w.SECTION,o.SECTION],[w.SELECT,o.SELECT],[w.SOURCE,o.SOURCE],[w.SMALL,o.SMALL],[w.SPAN,o.SPAN],[w.STRIKE,o.STRIKE],[w.STRONG,o.STRONG],[w.STYLE,o.STYLE],[w.SUB,o.SUB],[w.SUMMARY,o.SUMMARY],[w.SUP,o.SUP],[w.TABLE,o.TABLE],[w.TBODY,o.TBODY],[w.TEMPLATE,o.TEMPLATE],[w.TEXTAREA,o.TEXTAREA],[w.TFOOT,o.TFOOT],[w.TD,o.TD],[w.TH,o.TH],[w.THEAD,o.THEAD],[w.TITLE,o.TITLE],[w.TR,o.TR],[w.TRACK,o.TRACK],[w.TT,o.TT],[w.U,o.U],[w.UL,o.UL],[w.SVG,o.SVG],[w.VAR,o.VAR],[w.WBR,o.WBR],[w.XMP,o.XMP]]);function sn(A){var e;return(e=Sh.get(A))!==null&&e!==void 0?e:o.UNKNOWN}const S=o,Lh={[I.HTML]:new Set([S.ADDRESS,S.APPLET,S.AREA,S.ARTICLE,S.ASIDE,S.BASE,S.BASEFONT,S.BGSOUND,S.BLOCKQUOTE,S.BODY,S.BR,S.BUTTON,S.CAPTION,S.CENTER,S.COL,S.COLGROUP,S.DD,S.DETAILS,S.DIR,S.DIV,S.DL,S.DT,S.EMBED,S.FIELDSET,S.FIGCAPTION,S.FIGURE,S.FOOTER,S.FORM,S.FRAME,S.FRAMESET,S.H1,S.H2,S.H3,S.H4,S.H5,S.H6,S.HEAD,S.HEADER,S.HGROUP,S.HR,S.HTML,S.IFRAME,S.IMG,S.INPUT,S.LI,S.LINK,S.LISTING,S.MAIN,S.MARQUEE,S.MENU,S.META,S.NAV,S.NOEMBED,S.NOFRAMES,S.NOSCRIPT,S.OBJECT,S.OL,S.P,S.PARAM,S.PLAINTEXT,S.PRE,S.SCRIPT,S.SECTION,S.SELECT,S.SOURCE,S.STYLE,S.SUMMARY,S.TABLE,S.TBODY,S.TD,S.TEMPLATE,S.TEXTAREA,S.TFOOT,S.TH,S.THEAD,S.TITLE,S.TR,S.TRACK,S.UL,S.WBR,S.XMP]),[I.MATHML]:new Set([S.MI,S.MO,S.MN,S.MS,S.MTEXT,S.ANNOTATION_XML]),[I.SVG]:new Set([S.TITLE,S.FOREIGN_OBJECT,S.DESC]),[I.XLINK]:new Set,[I.XML]:new Set,[I.XMLNS]:new Set},ti=new Set([S.H1,S.H2,S.H3,S.H4,S.H5,S.H6]),Hh=new Set([w.STYLE,w.SCRIPT,w.XMP,w.IFRAME,w.NOEMBED,w.NOFRAMES,w.PLAINTEXT]);function Dh(A,e){return Hh.has(A)||e&&A===w.NOSCRIPT}var g;(function(A){A[A.DATA=0]="DATA",A[A.RCDATA=1]="RCDATA",A[A.RAWTEXT=2]="RAWTEXT",A[A.SCRIPT_DATA=3]="SCRIPT_DATA",A[A.PLAINTEXT=4]="PLAINTEXT",A[A.TAG_OPEN=5]="TAG_OPEN",A[A.END_TAG_OPEN=6]="END_TAG_OPEN",A[A.TAG_NAME=7]="TAG_NAME",A[A.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",A[A.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",A[A.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",A[A.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",A[A.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",A[A.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",A[A.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",A[A.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",A[A.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",A[A.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",A[A.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",A[A.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",A[A.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",A[A.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",A[A.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",A[A.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",A[A.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",A[A.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",A[A.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",A[A.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",A[A.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",A[A.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",A[A.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",A[A.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",A[A.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",A[A.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",A[A.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",A[A.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",A[A.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",A[A.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",A[A.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",A[A.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",A[A.BOGUS_COMMENT=40]="BOGUS_COMMENT",A[A.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",A[A.COMMENT_START=42]="COMMENT_START",A[A.COMMENT_START_DASH=43]="COMMENT_START_DASH",A[A.COMMENT=44]="COMMENT",A[A.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",A[A.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",A[A.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",A[A.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",A[A.COMMENT_END_DASH=49]="COMMENT_END_DASH",A[A.COMMENT_END=50]="COMMENT_END",A[A.COMMENT_END_BANG=51]="COMMENT_END_BANG",A[A.DOCTYPE=52]="DOCTYPE",A[A.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",A[A.DOCTYPE_NAME=54]="DOCTYPE_NAME",A[A.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",A[A.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",A[A.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",A[A.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",A[A.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",A[A.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",A[A.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",A[A.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",A[A.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",A[A.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",A[A.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",A[A.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",A[A.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",A[A.CDATA_SECTION=68]="CDATA_SECTION",A[A.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",A[A.CDATA_SECTION_END=70]="CDATA_SECTION_END",A[A.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",A[A.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(g||(g={}));const te={DATA:g.DATA,RCDATA:g.RCDATA,RAWTEXT:g.RAWTEXT,SCRIPT_DATA:g.SCRIPT_DATA,PLAINTEXT:g.PLAINTEXT,CDATA_SECTION:g.CDATA_SECTION};function Oh(A){return A>=B.DIGIT_0&&A<=B.DIGIT_9}function nr(A){return A>=B.LATIN_CAPITAL_A&&A<=B.LATIN_CAPITAL_Z}function Rh(A){return A>=B.LATIN_SMALL_A&&A<=B.LATIN_SMALL_Z}function Ke(A){return Rh(A)||nr(A)}function So(A){return Ke(A)||Oh(A)}function on(A){return A+32}function Lo(A){return A===B.SPACE||A===B.LINE_FEED||A===B.TABULATION||A===B.FORM_FEED}function Ho(A){return Lo(A)||A===B.SOLIDUS||A===B.GREATER_THAN_SIGN}function Mh(A){return A===B.NULL?U.nullCharacterReference:A>1114111?U.characterReferenceOutsideUnicodeRange:xo(A)?U.surrogateCharacterReference:_o(A)?U.noncharacterCharacterReference:vo(A)||A===B.CARRIAGE_RETURN?U.controlCharacterReference:null}let kh=class{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=g.DATA,this.returnState=g.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new Nh(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new va(Fa,(r,n)=>{this.preprocessor.pos=this.entityStartPos+n-1,this._flushCodePointConsumedAsCharacterReference(r)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(U.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(U.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const n=Mh(r);n&&this._err(n,1)}}:void 0)}_err(e,t=0){var r,n;(n=(r=this.handler).onParseError)===null||n===void 0||n.call(r,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e==null||e())}write(e,t,r){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||r==null||r()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),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(e){this.consumedAfterSnapshot+=e;for(let t=0;t<e;t++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,t){return this.preprocessor.startsWith(e,t)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:tA.START_TAG,tagName:"",tagID:o.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:tA.END_TAG,tagName:"",tagID:o.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:tA.COMMENT,data:"",location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:tA.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e,t;const r=this.currentToken;if(No(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const n=(e=(t=r.location).attrs)!==null&&e!==void 0?e:t.attrs=Object.create(null);n[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(U.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const e=this.currentToken;this.prepareToken(e),e.tagID=sn(e.tagName),e.type===tA.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(U.endTagWithAttributes),e.selfClosing&&this._err(U.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case tA.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case tA.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case tA.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:tA.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=t;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,t)}_emitCodePoint(e){const t=Lo(e)?tA.WHITESPACE_CHARACTER:e===B.NULL?tA.NULL_CHARACTER:tA.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(tA.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=g.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?ce.Attribute:ce.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===g.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===g.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===g.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case g.DATA:{this._stateData(e);break}case g.RCDATA:{this._stateRcdata(e);break}case g.RAWTEXT:{this._stateRawtext(e);break}case g.SCRIPT_DATA:{this._stateScriptData(e);break}case g.PLAINTEXT:{this._statePlaintext(e);break}case g.TAG_OPEN:{this._stateTagOpen(e);break}case g.END_TAG_OPEN:{this._stateEndTagOpen(e);break}case g.TAG_NAME:{this._stateTagName(e);break}case g.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(e);break}case g.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(e);break}case g.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(e);break}case g.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(e);break}case g.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(e);break}case g.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(e);break}case g.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(e);break}case g.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(e);break}case g.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(e);break}case g.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(e);break}case g.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(e);break}case g.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(e);break}case g.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(e);break}case g.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(e);break}case g.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(e);break}case g.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(e);break}case g.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(e);break}case g.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(e);break}case g.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(e);break}case g.ATTRIBUTE_NAME:{this._stateAttributeName(e);break}case g.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(e);break}case g.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(e);break}case g.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(e);break}case g.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(e);break}case g.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(e);break}case g.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(e);break}case g.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(e);break}case g.BOGUS_COMMENT:{this._stateBogusComment(e);break}case g.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(e);break}case g.COMMENT_START:{this._stateCommentStart(e);break}case g.COMMENT_START_DASH:{this._stateCommentStartDash(e);break}case g.COMMENT:{this._stateComment(e);break}case g.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(e);break}case g.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(e);break}case g.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(e);break}case g.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(e);break}case g.COMMENT_END_DASH:{this._stateCommentEndDash(e);break}case g.COMMENT_END:{this._stateCommentEnd(e);break}case g.COMMENT_END_BANG:{this._stateCommentEndBang(e);break}case g.DOCTYPE:{this._stateDoctype(e);break}case g.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(e);break}case g.DOCTYPE_NAME:{this._stateDoctypeName(e);break}case g.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(e);break}case g.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(e);break}case g.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(e);break}case g.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(e);break}case g.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(e);break}case g.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(e);break}case g.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break}case g.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(e);break}case g.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(e);break}case g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(e);break}case g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(e);break}case g.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(e);break}case g.BOGUS_DOCTYPE:{this._stateBogusDoctype(e);break}case g.CDATA_SECTION:{this._stateCdataSection(e);break}case g.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(e);break}case g.CDATA_SECTION_END:{this._stateCdataSectionEnd(e);break}case g.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case g.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(e);break}default:throw new Error("Unknown state")}}_stateData(e){switch(e){case B.LESS_THAN_SIGN:{this.state=g.TAG_OPEN;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.NULL:{this._err(U.unexpectedNullCharacter),this._emitCodePoint(e);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case B.AMPERSAND:{this._startCharacterReference();break}case B.LESS_THAN_SIGN:{this.state=g.RCDATA_LESS_THAN_SIGN;break}case B.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(pA);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case B.LESS_THAN_SIGN:{this.state=g.RAWTEXT_LESS_THAN_SIGN;break}case B.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(pA);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_LESS_THAN_SIGN;break}case B.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(pA);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case B.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(pA);break}case B.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateTagOpen(e){if(Ke(e))this._createStartTagToken(),this.state=g.TAG_NAME,this._stateTagName(e);else switch(e){case B.EXCLAMATION_MARK:{this.state=g.MARKUP_DECLARATION_OPEN;break}case B.SOLIDUS:{this.state=g.END_TAG_OPEN;break}case B.QUESTION_MARK:{this._err(U.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=g.BOGUS_COMMENT,this._stateBogusComment(e);break}case B.EOF:{this._err(U.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(U.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=g.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(Ke(e))this._createEndTagToken(),this.state=g.TAG_NAME,this._stateTagName(e);else switch(e){case B.GREATER_THAN_SIGN:{this._err(U.missingEndTagName),this.state=g.DATA;break}case B.EOF:{this._err(U.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(U.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=g.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BEFORE_ATTRIBUTE_NAME;break}case B.SOLIDUS:{this.state=g.SELF_CLOSING_START_TAG;break}case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentTagToken();break}case B.NULL:{this._err(U.unexpectedNullCharacter),t.tagName+=pA;break}case B.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:t.tagName+=String.fromCodePoint(nr(e)?on(e):e)}}_stateRcdataLessThanSign(e){e===B.SOLIDUS?this.state=g.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=g.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){Ke(e)?(this.state=g.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars("</"),this.state=g.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const t=this.currentToken;switch(t.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=g.BEFORE_ATTRIBUTE_NAME,!1;case B.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=g.SELF_CLOSING_START_TAG,!1;case B.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=g.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=g.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===B.SOLIDUS?this.state=g.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=g.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){Ke(e)?(this.state=g.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars("</"),this.state=g.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=g.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case B.SOLIDUS:{this.state=g.SCRIPT_DATA_END_TAG_OPEN;break}case B.EXCLAMATION_MARK:{this.state=g.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=g.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){Ke(e)?(this.state=g.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars("</"),this.state=g.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=g.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===B.HYPHEN_MINUS?(this.state=g.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=g.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===B.HYPHEN_MINUS?(this.state=g.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=g.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case B.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(pA);break}case B.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case B.NULL:{this._err(U.unexpectedNullCharacter),this.state=g.SCRIPT_DATA_ESCAPED,this._emitChars(pA);break}case B.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=g.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case B.HYPHEN_MINUS:{this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case B.GREATER_THAN_SIGN:{this.state=g.SCRIPT_DATA,this._emitChars(">");break}case B.NULL:{this._err(U.unexpectedNullCharacter),this.state=g.SCRIPT_DATA_ESCAPED,this._emitChars(pA);break}case B.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=g.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===B.SOLIDUS?this.state=g.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Ke(e)?(this._emitChars("<"),this.state=g.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars("<"),this.state=g.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){Ke(e)?(this.state=g.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars("</"),this.state=g.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=g.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(ee.SCRIPT,!1)&&Ho(this.preprocessor.peek(ee.SCRIPT.length))){this._emitCodePoint(e);for(let t=0;t<ee.SCRIPT.length;t++)this._emitCodePoint(this._consume());this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=g.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case B.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(pA);break}case B.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case B.NULL:{this._err(U.unexpectedNullCharacter),this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(pA);break}case B.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case B.HYPHEN_MINUS:{this._emitChars("-");break}case B.LESS_THAN_SIGN:{this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case B.GREATER_THAN_SIGN:{this.state=g.SCRIPT_DATA,this._emitChars(">");break}case B.NULL:{this._err(U.unexpectedNullCharacter),this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(pA);break}case B.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===B.SOLIDUS?(this.state=g.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(ee.SCRIPT,!1)&&Ho(this.preprocessor.peek(ee.SCRIPT.length))){this._emitCodePoint(e);for(let t=0;t<ee.SCRIPT.length;t++)this._emitCodePoint(this._consume());this.state=g.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=g.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.SOLIDUS:case B.GREATER_THAN_SIGN:case B.EOF:{this.state=g.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case B.EQUALS_SIGN:{this._err(U.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=g.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=g.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:case B.SOLIDUS:case B.GREATER_THAN_SIGN:case B.EOF:{this._leaveAttrName(),this.state=g.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case B.EQUALS_SIGN:{this._leaveAttrName(),this.state=g.BEFORE_ATTRIBUTE_VALUE;break}case B.QUOTATION_MARK:case B.APOSTROPHE:case B.LESS_THAN_SIGN:{this._err(U.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break}case B.NULL:{this._err(U.unexpectedNullCharacter),this.currentAttr.name+=pA;break}default:this.currentAttr.name+=String.fromCodePoint(nr(e)?on(e):e)}}_stateAfterAttributeName(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.SOLIDUS:{this.state=g.SELF_CLOSING_START_TAG;break}case B.EQUALS_SIGN:{this.state=g.BEFORE_ATTRIBUTE_VALUE;break}case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentTagToken();break}case B.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=g.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.QUOTATION_MARK:{this.state=g.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this.state=g.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(U.missingAttributeValue),this.state=g.DATA,this.emitCurrentTagToken();break}default:this.state=g.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case B.QUOTATION_MARK:{this.state=g.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.NULL:{this._err(U.unexpectedNullCharacter),this.currentAttr.value+=pA;break}case B.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case B.APOSTROPHE:{this.state=g.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.NULL:{this._err(U.unexpectedNullCharacter),this.currentAttr.value+=pA;break}case B.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this._leaveAttrValue(),this.state=g.BEFORE_ATTRIBUTE_NAME;break}case B.AMPERSAND:{this._startCharacterReference();break}case B.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=g.DATA,this.emitCurrentTagToken();break}case B.NULL:{this._err(U.unexpectedNullCharacter),this.currentAttr.value+=pA;break}case B.QUOTATION_MARK:case B.APOSTROPHE:case B.LESS_THAN_SIGN:case B.EQUALS_SIGN:case B.GRAVE_ACCENT:{this._err(U.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break}case B.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this._leaveAttrValue(),this.state=g.BEFORE_ATTRIBUTE_NAME;break}case B.SOLIDUS:{this._leaveAttrValue(),this.state=g.SELF_CLOSING_START_TAG;break}case B.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=g.DATA,this.emitCurrentTagToken();break}case B.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:this._err(U.missingWhitespaceBetweenAttributes),this.state=g.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case B.GREATER_THAN_SIGN:{const t=this.currentToken;t.selfClosing=!0,this.state=g.DATA,this.emitCurrentTagToken();break}case B.EOF:{this._err(U.eofInTag),this._emitEOFToken();break}default:this._err(U.unexpectedSolidusInTag),this.state=g.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){const t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentComment(t);break}case B.EOF:{this.emitCurrentComment(t),this._emitEOFToken();break}case B.NULL:{this._err(U.unexpectedNullCharacter),t.data+=pA;break}default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(ee.DASH_DASH,!0)?(this._createCommentToken(ee.DASH_DASH.length+1),this.state=g.COMMENT_START):this._consumeSequenceIfMatch(ee.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(ee.DOCTYPE.length+1),this.state=g.DOCTYPE):this._consumeSequenceIfMatch(ee.CDATA_START,!0)?this.inForeignNode?this.state=g.CDATA_SECTION:(this._err(U.cdataInHtmlContent),this._createCommentToken(ee.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=g.BOGUS_COMMENT):this._ensureHibernation()||(this._err(U.incorrectlyOpenedComment),this._createCommentToken(2),this.state=g.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case B.HYPHEN_MINUS:{this.state=g.COMMENT_START_DASH;break}case B.GREATER_THAN_SIGN:{this._err(U.abruptClosingOfEmptyComment),this.state=g.DATA;const t=this.currentToken;this.emitCurrentComment(t);break}default:this.state=g.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){const t=this.currentToken;switch(e){case B.HYPHEN_MINUS:{this.state=g.COMMENT_END;break}case B.GREATER_THAN_SIGN:{this._err(U.abruptClosingOfEmptyComment),this.state=g.DATA,this.emitCurrentComment(t);break}case B.EOF:{this._err(U.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+="-",this.state=g.COMMENT,this._stateComment(e)}}_stateComment(e){const t=this.currentToken;switch(e){case B.HYPHEN_MINUS:{this.state=g.COMMENT_END_DASH;break}case B.LESS_THAN_SIGN:{t.data+="<",this.state=g.COMMENT_LESS_THAN_SIGN;break}case B.NULL:{this._err(U.unexpectedNullCharacter),t.data+=pA;break}case B.EOF:{this._err(U.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){const t=this.currentToken;switch(e){case B.EXCLAMATION_MARK:{t.data+="!",this.state=g.COMMENT_LESS_THAN_SIGN_BANG;break}case B.LESS_THAN_SIGN:{t.data+="<";break}default:this.state=g.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===B.HYPHEN_MINUS?this.state=g.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=g.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===B.HYPHEN_MINUS?this.state=g.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=g.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==B.GREATER_THAN_SIGN&&e!==B.EOF&&this._err(U.nestedComment),this.state=g.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){const t=this.currentToken;switch(e){case B.HYPHEN_MINUS:{this.state=g.COMMENT_END;break}case B.EOF:{this._err(U.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+="-",this.state=g.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){const t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentComment(t);break}case B.EXCLAMATION_MARK:{this.state=g.COMMENT_END_BANG;break}case B.HYPHEN_MINUS:{t.data+="-";break}case B.EOF:{this._err(U.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+="--",this.state=g.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){const t=this.currentToken;switch(e){case B.HYPHEN_MINUS:{t.data+="--!",this.state=g.COMMENT_END_DASH;break}case B.GREATER_THAN_SIGN:{this._err(U.incorrectlyClosedComment),this.state=g.DATA,this.emitCurrentComment(t);break}case B.EOF:{this._err(U.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break}default:t.data+="--!",this.state=g.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BEFORE_DOCTYPE_NAME;break}case B.GREATER_THAN_SIGN:{this.state=g.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break}case B.EOF:{this._err(U.eofInDoctype),this._createDoctypeToken(null);const t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(U.missingWhitespaceBeforeDoctypeName),this.state=g.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(nr(e))this._createDoctypeToken(String.fromCharCode(on(e))),this.state=g.DOCTYPE_NAME;else switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.NULL:{this._err(U.unexpectedNullCharacter),this._createDoctypeToken(pA),this.state=g.DOCTYPE_NAME;break}case B.GREATER_THAN_SIGN:{this._err(U.missingDoctypeName),this._createDoctypeToken(null);const t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(U.eofInDoctype),this._createDoctypeToken(null);const t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=g.DOCTYPE_NAME}}_stateDoctypeName(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.AFTER_DOCTYPE_NAME;break}case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.NULL:{this._err(U.unexpectedNullCharacter),t.name+=pA;break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.name+=String.fromCodePoint(nr(e)?on(e):e)}}_stateAfterDoctypeName(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(ee.PUBLIC,!1)?this.state=g.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(ee.SYSTEM,!1)?this.state=g.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(U.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case B.QUOTATION_MARK:{this._err(U.missingWhitespaceAfterDoctypePublicKeyword),t.publicId="",this.state=g.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this._err(U.missingWhitespaceAfterDoctypePublicKeyword),t.publicId="",this.state=g.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(U.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(U.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.QUOTATION_MARK:{t.publicId="",this.state=g.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{t.publicId="",this.state=g.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(U.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(U.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){const t=this.currentToken;switch(e){case B.QUOTATION_MARK:{this.state=g.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case B.NULL:{this._err(U.unexpectedNullCharacter),t.publicId+=pA;break}case B.GREATER_THAN_SIGN:{this._err(U.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){const t=this.currentToken;switch(e){case B.APOSTROPHE:{this.state=g.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case B.NULL:{this._err(U.unexpectedNullCharacter),t.publicId+=pA;break}case B.GREATER_THAN_SIGN:{this._err(U.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case B.GREATER_THAN_SIGN:{this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.QUOTATION_MARK:{this._err(U.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this._err(U.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(U.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.GREATER_THAN_SIGN:{this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.QUOTATION_MARK:{t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(U.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:{this.state=g.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case B.QUOTATION_MARK:{this._err(U.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{this._err(U.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(U.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(U.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.QUOTATION_MARK:{t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case B.APOSTROPHE:{t.systemId="",this.state=g.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case B.GREATER_THAN_SIGN:{this._err(U.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.DATA,this.emitCurrentDoctype(t);break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(U.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){const t=this.currentToken;switch(e){case B.QUOTATION_MARK:{this.state=g.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case B.NULL:{this._err(U.unexpectedNullCharacter),t.systemId+=pA;break}case B.GREATER_THAN_SIGN:{this._err(U.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){const t=this.currentToken;switch(e){case B.APOSTROPHE:{this.state=g.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case B.NULL:{this._err(U.unexpectedNullCharacter),t.systemId+=pA;break}case B.GREATER_THAN_SIGN:{this._err(U.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){const t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:break;case B.GREATER_THAN_SIGN:{this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.EOF:{this._err(U.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(U.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=g.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){const t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:{this.emitCurrentDoctype(t),this.state=g.DATA;break}case B.NULL:{this._err(U.unexpectedNullCharacter);break}case B.EOF:{this.emitCurrentDoctype(t),this._emitEOFToken();break}}}_stateCdataSection(e){switch(e){case B.RIGHT_SQUARE_BRACKET:{this.state=g.CDATA_SECTION_BRACKET;break}case B.EOF:{this._err(U.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===B.RIGHT_SQUARE_BRACKET?this.state=g.CDATA_SECTION_END:(this._emitChars("]"),this.state=g.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case B.GREATER_THAN_SIGN:{this.state=g.DATA;break}case B.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=g.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0)if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(B.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&So(this.preprocessor.peek(1))?g.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){So(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===B.SEMICOLON&&this._err(U.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}};const Do=new Set([o.DD,o.DT,o.LI,o.OPTGROUP,o.OPTION,o.P,o.RB,o.RP,o.RT,o.RTC]),Oo=new Set([...Do,o.CAPTION,o.COLGROUP,o.TBODY,o.TD,o.TFOOT,o.TH,o.THEAD,o.TR]),un=new Set([o.APPLET,o.CAPTION,o.HTML,o.MARQUEE,o.OBJECT,o.TABLE,o.TD,o.TEMPLATE,o.TH]),Ph=new Set([...un,o.OL,o.UL]),Kh=new Set([...un,o.BUTTON]),Ro=new Set([o.ANNOTATION_XML,o.MI,o.MN,o.MO,o.MS,o.MTEXT]),Mo=new Set([o.DESC,o.FOREIGN_OBJECT,o.TITLE]),Vh=new Set([o.TR,o.TEMPLATE,o.HTML]),Gh=new Set([o.TBODY,o.TFOOT,o.THEAD,o.TEMPLATE,o.HTML]),Yh=new Set([o.TABLE,o.TEMPLATE,o.HTML]),Xh=new Set([o.TD,o.TH]);class Wh{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,r){this.treeAdapter=t,this.handler=r,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=o.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===o.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===I.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){const e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){const r=this._indexOf(e);this.items[r]=t,r===this.stackTop&&(this.current=t)}insertAfter(e,t,r){const n=this._indexOf(e)+1;this.items.splice(n,0,t),this.tagIDs.splice(n,0,r),this.stackTop++,n===this.stackTop&&this._updateCurrentElement(),this.handler.onItemPush(this.current,this.currentTagId,n===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do t=this.tagIDs.lastIndexOf(e,t-1);while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==I.HTML);this.shortenToLength(t<0?0:t)}shortenToLength(e){for(;this.stackTop>=e;){const t=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){const t=this._indexOf(e);this.shortenToLength(t<0?0:t)}popUntilPopped(e,t){const r=this._indexOfTagNames(e,t);this.shortenToLength(r<0?0:r)}popUntilNumberedHeaderPopped(){this.popUntilPopped(ti,I.HTML)}popUntilTableCellPopped(){this.popUntilPopped(Xh,I.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let r=this.stackTop;r>=0;r--)if(e.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===t)return r;return-1}clearBackTo(e,t){const r=this._indexOfTagNames(e,t);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(Yh,I.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Gh,I.HTML)}clearBackToTableRowContext(){this.clearBackTo(Vh,I.HTML)}remove(e){const t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===o.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){const t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===o.HTML}hasInDynamicScope(e,t){for(let r=this.stackTop;r>=0;r--){const n=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case I.HTML:{if(n===e)return!0;if(t.has(n))return!1;break}case I.SVG:{if(Mo.has(n))return!1;break}case I.MATHML:{if(Ro.has(n))return!1;break}}}return!0}hasInScope(e){return this.hasInDynamicScope(e,un)}hasInListItemScope(e){return this.hasInDynamicScope(e,Ph)}hasInButtonScope(e){return this.hasInDynamicScope(e,Kh)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){const t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case I.HTML:{if(ti.has(t))return!0;if(un.has(t))return!1;break}case I.SVG:{if(Mo.has(t))return!1;break}case I.MATHML:{if(Ro.has(t))return!1;break}}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===I.HTML)switch(this.tagIDs[t]){case e:return!0;case o.TABLE:case o.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===I.HTML)switch(this.tagIDs[e]){case o.TBODY:case o.THEAD:case o.TFOOT:return!0;case o.TABLE:case o.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===I.HTML)switch(this.tagIDs[t]){case e:return!0;case o.OPTION:case o.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;Do.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;Oo.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==e&&Oo.has(this.currentTagId);)this.pop()}}const ri=3;var Te;(function(A){A[A.Marker=0]="Marker",A[A.Element=1]="Element"})(Te||(Te={}));const ko={type:Te.Marker};class Jh{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){const r=[],n=t.length,a=this.treeAdapter.getTagName(e),i=this.treeAdapter.getNamespaceURI(e);for(let s=0;s<this.entries.length;s++){const u=this.entries[s];if(u.type===Te.Marker)break;const{element:l}=u;if(this.treeAdapter.getTagName(l)===a&&this.treeAdapter.getNamespaceURI(l)===i){const d=this.treeAdapter.getAttrList(l);d.length===n&&r.push({idx:s,attrs:d})}}return r}_ensureNoahArkCondition(e){if(this.entries.length<ri)return;const t=this.treeAdapter.getAttrList(e),r=this._getNoahArkConditionCandidates(e,t);if(r.length<ri)return;const n=new Map(t.map(i=>[i.name,i.value]));let a=0;for(let i=0;i<r.length;i++){const s=r[i];s.attrs.every(u=>n.get(u.name)===u.value)&&(a+=1,a>=ri&&this.entries.splice(s.idx,1))}}insertMarker(){this.entries.unshift(ko)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:Te.Element,element:e,token:t})}insertElementAfterBookmark(e,t){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:Te.Element,element:e,token:t})}removeEntry(e){const t=this.entries.indexOf(e);t>=0&&this.entries.splice(t,1)}clearToLastMarker(){const e=this.entries.indexOf(ko);e>=0?this.entries.splice(0,e+1):this.entries.length=0}getElementEntryInScopeWithTagName(e){const t=this.entries.find(r=>r.type===Te.Marker||this.treeAdapter.getTagName(r.element)===e);return t&&t.type===Te.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===Te.Element&&t.element===e)}}const _e={createDocument(){return{nodeName:"#document",mode:se.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(A,e,t){return{nodeName:A,tagName:A,attrs:t,namespaceURI:e,childNodes:[],parentNode:null}},createCommentNode(A){return{nodeName:"#comment",data:A,parentNode:null}},createTextNode(A){return{nodeName:"#text",value:A,parentNode:null}},appendChild(A,e){A.childNodes.push(e),e.parentNode=A},insertBefore(A,e,t){const r=A.childNodes.indexOf(t);A.childNodes.splice(r,0,e),e.parentNode=A},setTemplateContent(A,e){A.content=e},getTemplateContent(A){return A.content},setDocumentType(A,e,t,r){const n=A.childNodes.find(a=>a.nodeName==="#documentType");if(n)n.name=e,n.publicId=t,n.systemId=r;else{const a={nodeName:"#documentType",name:e,publicId:t,systemId:r,parentNode:null};_e.appendChild(A,a)}},setDocumentMode(A,e){A.mode=e},getDocumentMode(A){return A.mode},detachNode(A){if(A.parentNode){const e=A.parentNode.childNodes.indexOf(A);A.parentNode.childNodes.splice(e,1),A.parentNode=null}},insertText(A,e){if(A.childNodes.length>0){const t=A.childNodes[A.childNodes.length-1];if(_e.isTextNode(t)){t.value+=e;return}}_e.appendChild(A,_e.createTextNode(e))},insertTextBefore(A,e,t){const r=A.childNodes[A.childNodes.indexOf(t)-1];r&&_e.isTextNode(r)?r.value+=e:_e.insertBefore(A,_e.createTextNode(e),t)},adoptAttributes(A,e){const t=new Set(A.attrs.map(r=>r.name));for(let r=0;r<e.length;r++)t.has(e[r].name)||A.attrs.push(e[r])},getFirstChild(A){return A.childNodes[0]},getChildNodes(A){return A.childNodes},getParentNode(A){return A.parentNode},getAttrList(A){return A.attrs},getTagName(A){return A.tagName},getNamespaceURI(A){return A.namespaceURI},getTextNodeContent(A){return A.value},getCommentNodeContent(A){return A.data},getDocumentTypeNodeName(A){return A.name},getDocumentTypeNodePublicId(A){return A.publicId},getDocumentTypeNodeSystemId(A){return A.systemId},isTextNode(A){return A.nodeName==="#text"},isCommentNode(A){return A.nodeName==="#comment"},isDocumentTypeNode(A){return A.nodeName==="#documentType"},isElementNode(A){return Object.prototype.hasOwnProperty.call(A,"tagName")},setNodeSourceCodeLocation(A,e){A.sourceCodeLocation=e},getNodeSourceCodeLocation(A){return A.sourceCodeLocation},updateNodeSourceCodeLocation(A,e){A.sourceCodeLocation={...A.sourceCodeLocation,...e}}},Po="html",qh="about:legacy-compat",jh="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",Ko=["+//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//"],zh=[...Ko,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],$h=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),Vo=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],Zh=[...Vo,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function Go(A,e){return e.some(t=>A.startsWith(t))}function AB(A){return A.name===Po&&A.publicId===null&&(A.systemId===null||A.systemId===qh)}function eB(A){if(A.name!==Po)return se.QUIRKS;const{systemId:e}=A;if(e&&e.toLowerCase()===jh)return se.QUIRKS;let{publicId:t}=A;if(t!==null){if(t=t.toLowerCase(),$h.has(t))return se.QUIRKS;let r=e===null?zh:Ko;if(Go(t,r))return se.QUIRKS;if(r=e===null?Vo:Zh,Go(t,r))return se.LIMITED_QUIRKS}return se.NO_QUIRKS}const Yo={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},tB="definitionurl",rB="definitionURL",nB=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(A=>[A.toLowerCase(),A])),aB=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:I.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:I.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:I.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:I.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:I.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:I.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:I.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:I.XML}],["xml:space",{prefix:"xml",name:"space",namespace:I.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:I.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:I.XMLNS}]]),iB=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(A=>[A.toLowerCase(),A])),sB=new Set([o.B,o.BIG,o.BLOCKQUOTE,o.BODY,o.BR,o.CENTER,o.CODE,o.DD,o.DIV,o.DL,o.DT,o.EM,o.EMBED,o.H1,o.H2,o.H3,o.H4,o.H5,o.H6,o.HEAD,o.HR,o.I,o.IMG,o.LI,o.LISTING,o.MENU,o.META,o.NOBR,o.OL,o.P,o.PRE,o.RUBY,o.S,o.SMALL,o.SPAN,o.STRONG,o.STRIKE,o.SUB,o.SUP,o.TABLE,o.TT,o.U,o.UL,o.VAR]);function oB(A){const e=A.tagID;return e===o.FONT&&A.attrs.some(({name:r})=>r===ut.COLOR||r===ut.SIZE||r===ut.FACE)||sB.has(e)}function Xo(A){for(let e=0;e<A.attrs.length;e++)if(A.attrs[e].name===tB){A.attrs[e].name=rB;break}}function Wo(A){for(let e=0;e<A.attrs.length;e++){const t=nB.get(A.attrs[e].name);t!=null&&(A.attrs[e].name=t)}}function ni(A){for(let e=0;e<A.attrs.length;e++){const t=aB.get(A.attrs[e].name);t&&(A.attrs[e].prefix=t.prefix,A.attrs[e].name=t.name,A.attrs[e].namespace=t.namespace)}}function uB(A){const e=iB.get(A.tagName);e!=null&&(A.tagName=e,A.tagID=sn(A.tagName))}function cB(A,e){return e===I.MATHML&&(A===o.MI||A===o.MO||A===o.MN||A===o.MS||A===o.MTEXT)}function lB(A,e,t){if(e===I.MATHML&&A===o.ANNOTATION_XML){for(let r=0;r<t.length;r++)if(t[r].name===ut.ENCODING){const n=t[r].value.toLowerCase();return n===Yo.TEXT_HTML||n===Yo.APPLICATION_XML}}return e===I.SVG&&(A===o.FOREIGN_OBJECT||A===o.DESC||A===o.TITLE)}function dB(A,e,t,r){return(!r||r===I.HTML)&&lB(A,e,t)||(!r||r===I.MATHML)&&cB(A,e)}const fB="hidden",hB=8,BB=3;var p;(function(A){A[A.INITIAL=0]="INITIAL",A[A.BEFORE_HTML=1]="BEFORE_HTML",A[A.BEFORE_HEAD=2]="BEFORE_HEAD",A[A.IN_HEAD=3]="IN_HEAD",A[A.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",A[A.AFTER_HEAD=5]="AFTER_HEAD",A[A.IN_BODY=6]="IN_BODY",A[A.TEXT=7]="TEXT",A[A.IN_TABLE=8]="IN_TABLE",A[A.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",A[A.IN_CAPTION=10]="IN_CAPTION",A[A.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",A[A.IN_TABLE_BODY=12]="IN_TABLE_BODY",A[A.IN_ROW=13]="IN_ROW",A[A.IN_CELL=14]="IN_CELL",A[A.IN_SELECT=15]="IN_SELECT",A[A.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",A[A.IN_TEMPLATE=17]="IN_TEMPLATE",A[A.AFTER_BODY=18]="AFTER_BODY",A[A.IN_FRAMESET=19]="IN_FRAMESET",A[A.AFTER_FRAMESET=20]="AFTER_FRAMESET",A[A.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",A[A.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(p||(p={}));const gB={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},Jo=new Set([o.TABLE,o.TBODY,o.TFOOT,o.THEAD,o.TR]),qo={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:_e,onParseError:null};let jo=class{constructor(e,t,r=null,n=null){this.fragmentContext=r,this.scriptHandler=n,this.currentToken=null,this.stopped=!1,this.insertionMode=p.INITIAL,this.originalInsertionMode=p.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={...qo,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=t??this.treeAdapter.createDocument(),this.tokenizer=new kh(this.options,this),this.activeFormattingElements=new Jh(this.treeAdapter),this.fragmentContextID=r?sn(this.treeAdapter.getTagName(r)):o.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new Wh(this.document,this.treeAdapter,this)}static parse(e,t){const r=new this(t);return r.tokenizer.write(e,!0),r.document}static getFragmentParser(e,t){const r={...qo,...t};e??(e=r.treeAdapter.createElement(w.TEMPLATE,I.HTML,[]));const n=r.treeAdapter.createElement("documentmock",I.HTML,[]),a=new this(r,n,e);return a.fragmentContextID===o.TEMPLATE&&a.tmplInsertionModeStack.unshift(p.IN_TEMPLATE),a._initTokenizerForFragmentParsing(),a._insertFakeRootElement(),a._resetInsertionMode(),a._findFormInFragmentContext(),a}getFragment(){const e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,r){var n;if(!this.onParseError)return;const a=(n=e.location)!==null&&n!==void 0?n:gB,i={code:t,startLine:a.startLine,startCol:a.startCol,startOffset:a.startOffset,endLine:r?a.startLine:a.endLine,endCol:r?a.startCol:a.endCol,endOffset:r?a.startOffset:a.endOffset};this.onParseError(i)}onItemPush(e,t,r){var n,a;(a=(n=this.treeAdapter).onItemPush)===null||a===void 0||a.call(n,e),r&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var r,n;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(n=(r=this.treeAdapter).onItemPop)===null||n===void 0||n.call(r,e,this.openElements.current),t){let a,i;this.openElements.stackTop===0&&this.fragmentContext?(a=this.fragmentContext,i=this.fragmentContextID):{current:a,currentTagId:i}=this.openElements,this._setContextModes(a,i)}}_setContextModes(e,t){const r=e===this.document||this.treeAdapter.getNamespaceURI(e)===I.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,I.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=p.TEXT}switchToPlaintextParsing(){this.insertionMode=p.TEXT,this.originalInsertionMode=p.IN_BODY,this.tokenizer.state=te.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===w.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==I.HTML))switch(this.fragmentContextID){case o.TITLE:case o.TEXTAREA:{this.tokenizer.state=te.RCDATA;break}case o.STYLE:case o.XMP:case o.IFRAME:case o.NOEMBED:case o.NOFRAMES:case o.NOSCRIPT:{this.tokenizer.state=te.RAWTEXT;break}case o.SCRIPT:{this.tokenizer.state=te.SCRIPT_DATA;break}case o.PLAINTEXT:{this.tokenizer.state=te.PLAINTEXT;break}}}_setDocumentType(e){const t=e.name||"",r=e.publicId||"",n=e.systemId||"";if(this.treeAdapter.setDocumentType(this.document,t,r,n),e.location){const i=this.treeAdapter.getChildNodes(this.document).find(s=>this.treeAdapter.isDocumentTypeNode(s));i&&this.treeAdapter.setNodeSourceCodeLocation(i,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){const r=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r,e)}}_appendElement(e,t){const r=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(r,e.location)}_insertElement(e,t){const r=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(r,e.location),this.openElements.push(r,e.tagID)}_insertFakeElement(e,t){const r=this.treeAdapter.createElement(e,I.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,t)}_insertTemplate(e){const t=this.treeAdapter.createElement(e.tagName,I.HTML,e.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,r),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const e=this.treeAdapter.createElement(w.HTML,I.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,o.HTML)}_appendCommentNode(e,t){const r=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,e.location)}_insertCharacters(e){let t,r;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(t,e.chars,r):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;const n=this.treeAdapter.getChildNodes(t),a=r?n.lastIndexOf(r):n.length,i=n[a-1];if(this.treeAdapter.getNodeSourceCodeLocation(i)){const{endLine:u,endCol:l,endOffset:d}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(i,{endLine:u,endCol:l,endOffset:d})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,e.location)}_adoptNodes(e,t){for(let r=this.treeAdapter.getFirstChild(e);r;r=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(t,r)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){const r=t.location,n=this.treeAdapter.getTagName(e),a=t.type===tA.END_TAG&&n===t.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,a)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,r;return this.openElements.stackTop===0&&this.fragmentContext?(t=this.fragmentContext,r=this.fragmentContextID):{current:t,currentTagId:r}=this.openElements,e.tagID===o.SVG&&this.treeAdapter.getTagName(t)===w.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===I.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===o.MGLYPH||e.tagID===o.MALIGNMARK)&&!this._isIntegrationPoint(r,t,I.HTML)}_processToken(e){switch(e.type){case tA.CHARACTER:{this.onCharacter(e);break}case tA.NULL_CHARACTER:{this.onNullCharacter(e);break}case tA.COMMENT:{this.onComment(e);break}case tA.DOCTYPE:{this.onDoctype(e);break}case tA.START_TAG:{this._processStartTag(e);break}case tA.END_TAG:{this.onEndTag(e);break}case tA.EOF:{this.onEof(e);break}case tA.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(e);break}}}_isIntegrationPoint(e,t,r){const n=this.treeAdapter.getNamespaceURI(t),a=this.treeAdapter.getAttrList(t);return dB(e,n,a,r)}_reconstructActiveFormattingElements(){const e=this.activeFormattingElements.entries.length;if(e){const t=this.activeFormattingElements.entries.findIndex(n=>n.type===Te.Marker||this.openElements.contains(n.element)),r=t<0?e-1:t-1;for(let n=r;n>=0;n--){const a=this.activeFormattingElements.entries[n];this._insertElement(a.token,this.treeAdapter.getNamespaceURI(a.element)),a.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=p.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(o.P),this.openElements.popUntilTagNamePopped(o.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case o.TR:{this.insertionMode=p.IN_ROW;return}case o.TBODY:case o.THEAD:case o.TFOOT:{this.insertionMode=p.IN_TABLE_BODY;return}case o.CAPTION:{this.insertionMode=p.IN_CAPTION;return}case o.COLGROUP:{this.insertionMode=p.IN_COLUMN_GROUP;return}case o.TABLE:{this.insertionMode=p.IN_TABLE;return}case o.BODY:{this.insertionMode=p.IN_BODY;return}case o.FRAMESET:{this.insertionMode=p.IN_FRAMESET;return}case o.SELECT:{this._resetInsertionModeForSelect(e);return}case o.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case o.HTML:{this.insertionMode=this.headElement?p.AFTER_HEAD:p.BEFORE_HEAD;return}case o.TD:case o.TH:{if(e>0){this.insertionMode=p.IN_CELL;return}break}case o.HEAD:{if(e>0){this.insertionMode=p.IN_HEAD;return}break}}this.insertionMode=p.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){const r=this.openElements.tagIDs[t];if(r===o.TEMPLATE)break;if(r===o.TABLE){this.insertionMode=p.IN_SELECT_IN_TABLE;return}}this.insertionMode=p.IN_SELECT}_isElementCausesFosterParenting(e){return Jo.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){const t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case o.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(t)===I.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break}case o.TABLE:{const r=this.treeAdapter.getParentNode(t);return r?{parent:r,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){const t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){const r=this.treeAdapter.getNamespaceURI(e);return Lh[r].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Xg(this,e);return}switch(this.insertionMode){case p.INITIAL:{ar(this,e);break}case p.BEFORE_HTML:{ir(this,e);break}case p.BEFORE_HEAD:{sr(this,e);break}case p.IN_HEAD:{or(this,e);break}case p.IN_HEAD_NO_SCRIPT:{ur(this,e);break}case p.AFTER_HEAD:{cr(this,e);break}case p.IN_BODY:case p.IN_CAPTION:case p.IN_CELL:case p.IN_TEMPLATE:{$o(this,e);break}case p.TEXT:case p.IN_SELECT:case p.IN_SELECT_IN_TABLE:{this._insertCharacters(e);break}case p.IN_TABLE:case p.IN_TABLE_BODY:case p.IN_ROW:{oi(this,e);break}case p.IN_TABLE_TEXT:{iu(this,e);break}case p.IN_COLUMN_GROUP:{dn(this,e);break}case p.AFTER_BODY:{Bn(this,e);break}case p.AFTER_AFTER_BODY:{gn(this,e);break}}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Yg(this,e);return}switch(this.insertionMode){case p.INITIAL:{ar(this,e);break}case p.BEFORE_HTML:{ir(this,e);break}case p.BEFORE_HEAD:{sr(this,e);break}case p.IN_HEAD:{or(this,e);break}case p.IN_HEAD_NO_SCRIPT:{ur(this,e);break}case p.AFTER_HEAD:{cr(this,e);break}case p.TEXT:{this._insertCharacters(e);break}case p.IN_TABLE:case p.IN_TABLE_BODY:case p.IN_ROW:{oi(this,e);break}case p.IN_COLUMN_GROUP:{dn(this,e);break}case p.AFTER_BODY:{Bn(this,e);break}case p.AFTER_AFTER_BODY:{gn(this,e);break}}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){ii(this,e);return}switch(this.insertionMode){case p.INITIAL:case p.BEFORE_HTML:case p.BEFORE_HEAD:case p.IN_HEAD:case p.IN_HEAD_NO_SCRIPT:case p.AFTER_HEAD:case p.IN_BODY:case p.IN_TABLE:case p.IN_CAPTION:case p.IN_COLUMN_GROUP:case p.IN_TABLE_BODY:case p.IN_ROW:case p.IN_CELL:case p.IN_SELECT:case p.IN_SELECT_IN_TABLE:case p.IN_TEMPLATE:case p.IN_FRAMESET:case p.AFTER_FRAMESET:{ii(this,e);break}case p.IN_TABLE_TEXT:{fr(this,e);break}case p.AFTER_BODY:{TB(this,e);break}case p.AFTER_AFTER_BODY:case p.AFTER_AFTER_FRAMESET:{UB(this,e);break}}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case p.INITIAL:{QB(this,e);break}case p.BEFORE_HEAD:case p.IN_HEAD:case p.IN_HEAD_NO_SCRIPT:case p.AFTER_HEAD:{this._err(e,U.misplacedDoctype);break}case p.IN_TABLE_TEXT:{fr(this,e);break}}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,U.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?Wg(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case p.INITIAL:{ar(this,e);break}case p.BEFORE_HTML:{FB(this,e);break}case p.BEFORE_HEAD:{yB(this,e);break}case p.IN_HEAD:{pe(this,e);break}case p.IN_HEAD_NO_SCRIPT:{_B(this,e);break}case p.AFTER_HEAD:{SB(this,e);break}case p.IN_BODY:{KA(this,e);break}case p.IN_TABLE:{Ft(this,e);break}case p.IN_TABLE_TEXT:{fr(this,e);break}case p.IN_CAPTION:{xg(this,e);break}case p.IN_COLUMN_GROUP:{ui(this,e);break}case p.IN_TABLE_BODY:{fn(this,e);break}case p.IN_ROW:{hn(this,e);break}case p.IN_CELL:{Ng(this,e);break}case p.IN_SELECT:{uu(this,e);break}case p.IN_SELECT_IN_TABLE:{Lg(this,e);break}case p.IN_TEMPLATE:{Dg(this,e);break}case p.AFTER_BODY:{Rg(this,e);break}case p.IN_FRAMESET:{Mg(this,e);break}case p.AFTER_FRAMESET:{Pg(this,e);break}case p.AFTER_AFTER_BODY:{Vg(this,e);break}case p.AFTER_AFTER_FRAMESET:{Gg(this,e);break}}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?Jg(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case p.INITIAL:{ar(this,e);break}case p.BEFORE_HTML:{IB(this,e);break}case p.BEFORE_HEAD:{xB(this,e);break}case p.IN_HEAD:{vB(this,e);break}case p.IN_HEAD_NO_SCRIPT:{NB(this,e);break}case p.AFTER_HEAD:{LB(this,e);break}case p.IN_BODY:{ln(this,e);break}case p.TEXT:{Eg(this,e);break}case p.IN_TABLE:{lr(this,e);break}case p.IN_TABLE_TEXT:{fr(this,e);break}case p.IN_CAPTION:{vg(this,e);break}case p.IN_COLUMN_GROUP:{_g(this,e);break}case p.IN_TABLE_BODY:{ci(this,e);break}case p.IN_ROW:{ou(this,e);break}case p.IN_CELL:{Sg(this,e);break}case p.IN_SELECT:{cu(this,e);break}case p.IN_SELECT_IN_TABLE:{Hg(this,e);break}case p.IN_TEMPLATE:{Og(this,e);break}case p.AFTER_BODY:{du(this,e);break}case p.IN_FRAMESET:{kg(this,e);break}case p.AFTER_FRAMESET:{Kg(this,e);break}case p.AFTER_AFTER_BODY:{gn(this,e);break}}}onEof(e){switch(this.insertionMode){case p.INITIAL:{ar(this,e);break}case p.BEFORE_HTML:{ir(this,e);break}case p.BEFORE_HEAD:{sr(this,e);break}case p.IN_HEAD:{or(this,e);break}case p.IN_HEAD_NO_SCRIPT:{ur(this,e);break}case p.AFTER_HEAD:{cr(this,e);break}case p.IN_BODY:case p.IN_TABLE:case p.IN_CAPTION:case p.IN_COLUMN_GROUP:case p.IN_TABLE_BODY:case p.IN_ROW:case p.IN_CELL:case p.IN_SELECT:case p.IN_SELECT_IN_TABLE:{nu(this,e);break}case p.TEXT:{Cg(this,e);break}case p.IN_TABLE_TEXT:{fr(this,e);break}case p.IN_TEMPLATE:{lu(this,e);break}case p.AFTER_BODY:case p.IN_FRAMESET:case p.AFTER_FRAMESET:case p.AFTER_AFTER_BODY:case p.AFTER_AFTER_FRAMESET:{si(this,e);break}}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===B.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);return}switch(this.insertionMode){case p.IN_HEAD:case p.IN_HEAD_NO_SCRIPT:case p.AFTER_HEAD:case p.TEXT:case p.IN_COLUMN_GROUP:case p.IN_SELECT:case p.IN_SELECT_IN_TABLE:case p.IN_FRAMESET:case p.AFTER_FRAMESET:{this._insertCharacters(e);break}case p.IN_BODY:case p.IN_CAPTION:case p.IN_CELL:case p.IN_TEMPLATE:case p.AFTER_BODY:case p.AFTER_AFTER_BODY:case p.AFTER_AFTER_FRAMESET:{zo(this,e);break}case p.IN_TABLE:case p.IN_TABLE_BODY:case p.IN_ROW:{oi(this,e);break}case p.IN_TABLE_TEXT:{au(this,e);break}}}};function pB(A,e){let t=A.activeFormattingElements.getElementEntryInScopeWithTagName(e.tagName);return t?A.openElements.contains(t.element)?A.openElements.hasInScope(e.tagID)||(t=null):(A.activeFormattingElements.removeEntry(t),t=null):ru(A,e),t}function mB(A,e){let t=null,r=A.openElements.stackTop;for(;r>=0;r--){const n=A.openElements.items[r];if(n===e.element)break;A._isSpecialElement(n,A.openElements.tagIDs[r])&&(t=n)}return t||(A.openElements.shortenToLength(r<0?0:r),A.activeFormattingElements.removeEntry(e)),t}function EB(A,e,t){let r=e,n=A.openElements.getCommonAncestor(e);for(let a=0,i=n;i!==t;a++,i=n){n=A.openElements.getCommonAncestor(i);const s=A.activeFormattingElements.getElementEntry(i),u=s&&a>=BB;!s||u?(u&&A.activeFormattingElements.removeEntry(s),A.openElements.remove(i)):(i=CB(A,s),r===e&&(A.activeFormattingElements.bookmark=s),A.treeAdapter.detachNode(r),A.treeAdapter.appendChild(i,r),r=i)}return r}function CB(A,e){const t=A.treeAdapter.getNamespaceURI(e.element),r=A.treeAdapter.createElement(e.token.tagName,t,e.token.attrs);return A.openElements.replace(e.element,r),e.element=r,r}function wB(A,e,t){const r=A.treeAdapter.getTagName(e),n=sn(r);if(A._isElementCausesFosterParenting(n))A._fosterParentElement(t);else{const a=A.treeAdapter.getNamespaceURI(e);n===o.TEMPLATE&&a===I.HTML&&(e=A.treeAdapter.getTemplateContent(e)),A.treeAdapter.appendChild(e,t)}}function bB(A,e,t){const r=A.treeAdapter.getNamespaceURI(t.element),{token:n}=t,a=A.treeAdapter.createElement(n.tagName,r,n.attrs);A._adoptNodes(e,a),A.treeAdapter.appendChild(e,a),A.activeFormattingElements.insertElementAfterBookmark(a,n),A.activeFormattingElements.removeEntry(t),A.openElements.remove(t.element),A.openElements.insertAfter(e,a,n.tagID)}function ai(A,e){for(let t=0;t<hB;t++){const r=pB(A,e);if(!r)break;const n=mB(A,r);if(!n)break;A.activeFormattingElements.bookmark=r;const a=EB(A,n,r.element),i=A.openElements.getCommonAncestor(r.element);A.treeAdapter.detachNode(a),i&&wB(A,i,a),bB(A,n,r)}}function ii(A,e){A._appendCommentNode(e,A.openElements.currentTmplContentOrNode)}function TB(A,e){A._appendCommentNode(e,A.openElements.items[0])}function UB(A,e){A._appendCommentNode(e,A.document)}function si(A,e){if(A.stopped=!0,e.location){const t=A.fragmentContext?0:2;for(let r=A.openElements.stackTop;r>=t;r--)A._setEndLocation(A.openElements.items[r],e);if(!A.fragmentContext&&A.openElements.stackTop>=0){const r=A.openElements.items[0],n=A.treeAdapter.getNodeSourceCodeLocation(r);if(n&&!n.endTag&&(A._setEndLocation(r,e),A.openElements.stackTop>=1)){const a=A.openElements.items[1],i=A.treeAdapter.getNodeSourceCodeLocation(a);i&&!i.endTag&&A._setEndLocation(a,e)}}}}function QB(A,e){A._setDocumentType(e);const t=e.forceQuirks?se.QUIRKS:eB(e);AB(e)||A._err(e,U.nonConformingDoctype),A.treeAdapter.setDocumentMode(A.document,t),A.insertionMode=p.BEFORE_HTML}function ar(A,e){A._err(e,U.missingDoctype,!0),A.treeAdapter.setDocumentMode(A.document,se.QUIRKS),A.insertionMode=p.BEFORE_HTML,A._processToken(e)}function FB(A,e){e.tagID===o.HTML?(A._insertElement(e,I.HTML),A.insertionMode=p.BEFORE_HEAD):ir(A,e)}function IB(A,e){const t=e.tagID;(t===o.HTML||t===o.HEAD||t===o.BODY||t===o.BR)&&ir(A,e)}function ir(A,e){A._insertFakeRootElement(),A.insertionMode=p.BEFORE_HEAD,A._processToken(e)}function yB(A,e){switch(e.tagID){case o.HTML:{KA(A,e);break}case o.HEAD:{A._insertElement(e,I.HTML),A.headElement=A.openElements.current,A.insertionMode=p.IN_HEAD;break}default:sr(A,e)}}function xB(A,e){const t=e.tagID;t===o.HEAD||t===o.BODY||t===o.HTML||t===o.BR?sr(A,e):A._err(e,U.endTagWithoutMatchingOpenElement)}function sr(A,e){A._insertFakeElement(w.HEAD,o.HEAD),A.headElement=A.openElements.current,A.insertionMode=p.IN_HEAD,A._processToken(e)}function pe(A,e){switch(e.tagID){case o.HTML:{KA(A,e);break}case o.BASE:case o.BASEFONT:case o.BGSOUND:case o.LINK:case o.META:{A._appendElement(e,I.HTML),e.ackSelfClosing=!0;break}case o.TITLE:{A._switchToTextParsing(e,te.RCDATA);break}case o.NOSCRIPT:{A.options.scriptingEnabled?A._switchToTextParsing(e,te.RAWTEXT):(A._insertElement(e,I.HTML),A.insertionMode=p.IN_HEAD_NO_SCRIPT);break}case o.NOFRAMES:case o.STYLE:{A._switchToTextParsing(e,te.RAWTEXT);break}case o.SCRIPT:{A._switchToTextParsing(e,te.SCRIPT_DATA);break}case o.TEMPLATE:{A._insertTemplate(e),A.activeFormattingElements.insertMarker(),A.framesetOk=!1,A.insertionMode=p.IN_TEMPLATE,A.tmplInsertionModeStack.unshift(p.IN_TEMPLATE);break}case o.HEAD:{A._err(e,U.misplacedStartTagForHeadElement);break}default:or(A,e)}}function vB(A,e){switch(e.tagID){case o.HEAD:{A.openElements.pop(),A.insertionMode=p.AFTER_HEAD;break}case o.BODY:case o.BR:case o.HTML:{or(A,e);break}case o.TEMPLATE:{ct(A,e);break}default:A._err(e,U.endTagWithoutMatchingOpenElement)}}function ct(A,e){A.openElements.tmplCount>0?(A.openElements.generateImpliedEndTagsThoroughly(),A.openElements.currentTagId!==o.TEMPLATE&&A._err(e,U.closingOfElementWithOpenChildElements),A.openElements.popUntilTagNamePopped(o.TEMPLATE),A.activeFormattingElements.clearToLastMarker(),A.tmplInsertionModeStack.shift(),A._resetInsertionMode()):A._err(e,U.endTagWithoutMatchingOpenElement)}function or(A,e){A.openElements.pop(),A.insertionMode=p.AFTER_HEAD,A._processToken(e)}function _B(A,e){switch(e.tagID){case o.HTML:{KA(A,e);break}case o.BASEFONT:case o.BGSOUND:case o.HEAD:case o.LINK:case o.META:case o.NOFRAMES:case o.STYLE:{pe(A,e);break}case o.NOSCRIPT:{A._err(e,U.nestedNoscriptInHead);break}default:ur(A,e)}}function NB(A,e){switch(e.tagID){case o.NOSCRIPT:{A.openElements.pop(),A.insertionMode=p.IN_HEAD;break}case o.BR:{ur(A,e);break}default:A._err(e,U.endTagWithoutMatchingOpenElement)}}function ur(A,e){const t=e.type===tA.EOF?U.openElementsLeftAfterEof:U.disallowedContentInNoscriptInHead;A._err(e,t),A.openElements.pop(),A.insertionMode=p.IN_HEAD,A._processToken(e)}function SB(A,e){switch(e.tagID){case o.HTML:{KA(A,e);break}case o.BODY:{A._insertElement(e,I.HTML),A.framesetOk=!1,A.insertionMode=p.IN_BODY;break}case o.FRAMESET:{A._insertElement(e,I.HTML),A.insertionMode=p.IN_FRAMESET;break}case o.BASE:case o.BASEFONT:case o.BGSOUND:case o.LINK:case o.META:case o.NOFRAMES:case o.SCRIPT:case o.STYLE:case o.TEMPLATE:case o.TITLE:{A._err(e,U.abandonedHeadElementChild),A.openElements.push(A.headElement,o.HEAD),pe(A,e),A.openElements.remove(A.headElement);break}case o.HEAD:{A._err(e,U.misplacedStartTagForHeadElement);break}default:cr(A,e)}}function LB(A,e){switch(e.tagID){case o.BODY:case o.HTML:case o.BR:{cr(A,e);break}case o.TEMPLATE:{ct(A,e);break}default:A._err(e,U.endTagWithoutMatchingOpenElement)}}function cr(A,e){A._insertFakeElement(w.BODY,o.BODY),A.insertionMode=p.IN_BODY,cn(A,e)}function cn(A,e){switch(e.type){case tA.CHARACTER:{$o(A,e);break}case tA.WHITESPACE_CHARACTER:{zo(A,e);break}case tA.COMMENT:{ii(A,e);break}case tA.START_TAG:{KA(A,e);break}case tA.END_TAG:{ln(A,e);break}case tA.EOF:{nu(A,e);break}}}function zo(A,e){A._reconstructActiveFormattingElements(),A._insertCharacters(e)}function $o(A,e){A._reconstructActiveFormattingElements(),A._insertCharacters(e),A.framesetOk=!1}function HB(A,e){A.openElements.tmplCount===0&&A.treeAdapter.adoptAttributes(A.openElements.items[0],e.attrs)}function DB(A,e){const t=A.openElements.tryPeekProperlyNestedBodyElement();t&&A.openElements.tmplCount===0&&(A.framesetOk=!1,A.treeAdapter.adoptAttributes(t,e.attrs))}function OB(A,e){const t=A.openElements.tryPeekProperlyNestedBodyElement();A.framesetOk&&t&&(A.treeAdapter.detachNode(t),A.openElements.popAllUpToHtmlElement(),A._insertElement(e,I.HTML),A.insertionMode=p.IN_FRAMESET)}function RB(A,e){A.openElements.hasInButtonScope(o.P)&&A._closePElement(),A._insertElement(e,I.HTML)}function MB(A,e){A.openElements.hasInButtonScope(o.P)&&A._closePElement(),ti.has(A.openElements.currentTagId)&&A.openElements.pop(),A._insertElement(e,I.HTML)}function kB(A,e){A.openElements.hasInButtonScope(o.P)&&A._closePElement(),A._insertElement(e,I.HTML),A.skipNextNewLine=!0,A.framesetOk=!1}function PB(A,e){const t=A.openElements.tmplCount>0;(!A.formElement||t)&&(A.openElements.hasInButtonScope(o.P)&&A._closePElement(),A._insertElement(e,I.HTML),t||(A.formElement=A.openElements.current))}function KB(A,e){A.framesetOk=!1;const t=e.tagID;for(let r=A.openElements.stackTop;r>=0;r--){const n=A.openElements.tagIDs[r];if(t===o.LI&&n===o.LI||(t===o.DD||t===o.DT)&&(n===o.DD||n===o.DT)){A.openElements.generateImpliedEndTagsWithExclusion(n),A.openElements.popUntilTagNamePopped(n);break}if(n!==o.ADDRESS&&n!==o.DIV&&n!==o.P&&A._isSpecialElement(A.openElements.items[r],n))break}A.openElements.hasInButtonScope(o.P)&&A._closePElement(),A._insertElement(e,I.HTML)}function VB(A,e){A.openElements.hasInButtonScope(o.P)&&A._closePElement(),A._insertElement(e,I.HTML),A.tokenizer.state=te.PLAINTEXT}function GB(A,e){A.openElements.hasInScope(o.BUTTON)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(o.BUTTON)),A._reconstructActiveFormattingElements(),A._insertElement(e,I.HTML),A.framesetOk=!1}function YB(A,e){const t=A.activeFormattingElements.getElementEntryInScopeWithTagName(w.A);t&&(ai(A,e),A.openElements.remove(t.element),A.activeFormattingElements.removeEntry(t)),A._reconstructActiveFormattingElements(),A._insertElement(e,I.HTML),A.activeFormattingElements.pushElement(A.openElements.current,e)}function XB(A,e){A._reconstructActiveFormattingElements(),A._insertElement(e,I.HTML),A.activeFormattingElements.pushElement(A.openElements.current,e)}function WB(A,e){A._reconstructActiveFormattingElements(),A.openElements.hasInScope(o.NOBR)&&(ai(A,e),A._reconstructActiveFormattingElements()),A._insertElement(e,I.HTML),A.activeFormattingElements.pushElement(A.openElements.current,e)}function JB(A,e){A._reconstructActiveFormattingElements(),A._insertElement(e,I.HTML),A.activeFormattingElements.insertMarker(),A.framesetOk=!1}function qB(A,e){A.treeAdapter.getDocumentMode(A.document)!==se.QUIRKS&&A.openElements.hasInButtonScope(o.P)&&A._closePElement(),A._insertElement(e,I.HTML),A.framesetOk=!1,A.insertionMode=p.IN_TABLE}function Zo(A,e){A._reconstructActiveFormattingElements(),A._appendElement(e,I.HTML),A.framesetOk=!1,e.ackSelfClosing=!0}function Au(A){const e=No(A,ut.TYPE);return e!=null&&e.toLowerCase()===fB}function jB(A,e){A._reconstructActiveFormattingElements(),A._appendElement(e,I.HTML),Au(e)||(A.framesetOk=!1),e.ackSelfClosing=!0}function zB(A,e){A._appendElement(e,I.HTML),e.ackSelfClosing=!0}function $B(A,e){A.openElements.hasInButtonScope(o.P)&&A._closePElement(),A._appendElement(e,I.HTML),A.framesetOk=!1,e.ackSelfClosing=!0}function ZB(A,e){e.tagName=w.IMG,e.tagID=o.IMG,Zo(A,e)}function Ag(A,e){A._insertElement(e,I.HTML),A.skipNextNewLine=!0,A.tokenizer.state=te.RCDATA,A.originalInsertionMode=A.insertionMode,A.framesetOk=!1,A.insertionMode=p.TEXT}function eg(A,e){A.openElements.hasInButtonScope(o.P)&&A._closePElement(),A._reconstructActiveFormattingElements(),A.framesetOk=!1,A._switchToTextParsing(e,te.RAWTEXT)}function tg(A,e){A.framesetOk=!1,A._switchToTextParsing(e,te.RAWTEXT)}function eu(A,e){A._switchToTextParsing(e,te.RAWTEXT)}function rg(A,e){A._reconstructActiveFormattingElements(),A._insertElement(e,I.HTML),A.framesetOk=!1,A.insertionMode=A.insertionMode===p.IN_TABLE||A.insertionMode===p.IN_CAPTION||A.insertionMode===p.IN_TABLE_BODY||A.insertionMode===p.IN_ROW||A.insertionMode===p.IN_CELL?p.IN_SELECT_IN_TABLE:p.IN_SELECT}function ng(A,e){A.openElements.currentTagId===o.OPTION&&A.openElements.pop(),A._reconstructActiveFormattingElements(),A._insertElement(e,I.HTML)}function ag(A,e){A.openElements.hasInScope(o.RUBY)&&A.openElements.generateImpliedEndTags(),A._insertElement(e,I.HTML)}function ig(A,e){A.openElements.hasInScope(o.RUBY)&&A.openElements.generateImpliedEndTagsWithExclusion(o.RTC),A._insertElement(e,I.HTML)}function sg(A,e){A._reconstructActiveFormattingElements(),Xo(e),ni(e),e.selfClosing?A._appendElement(e,I.MATHML):A._insertElement(e,I.MATHML),e.ackSelfClosing=!0}function og(A,e){A._reconstructActiveFormattingElements(),Wo(e),ni(e),e.selfClosing?A._appendElement(e,I.SVG):A._insertElement(e,I.SVG),e.ackSelfClosing=!0}function tu(A,e){A._reconstructActiveFormattingElements(),A._insertElement(e,I.HTML)}function KA(A,e){switch(e.tagID){case o.I:case o.S:case o.B:case o.U:case o.EM:case o.TT:case o.BIG:case o.CODE:case o.FONT:case o.SMALL:case o.STRIKE:case o.STRONG:{XB(A,e);break}case o.A:{YB(A,e);break}case o.H1:case o.H2:case o.H3:case o.H4:case o.H5:case o.H6:{MB(A,e);break}case o.P:case o.DL:case o.OL:case o.UL:case o.DIV:case o.DIR:case o.NAV:case o.MAIN:case o.MENU:case o.ASIDE:case o.CENTER:case o.FIGURE:case o.FOOTER:case o.HEADER:case o.HGROUP:case o.DIALOG:case o.DETAILS:case o.ADDRESS:case o.ARTICLE:case o.SEARCH:case o.SECTION:case o.SUMMARY:case o.FIELDSET:case o.BLOCKQUOTE:case o.FIGCAPTION:{RB(A,e);break}case o.LI:case o.DD:case o.DT:{KB(A,e);break}case o.BR:case o.IMG:case o.WBR:case o.AREA:case o.EMBED:case o.KEYGEN:{Zo(A,e);break}case o.HR:{$B(A,e);break}case o.RB:case o.RTC:{ag(A,e);break}case o.RT:case o.RP:{ig(A,e);break}case o.PRE:case o.LISTING:{kB(A,e);break}case o.XMP:{eg(A,e);break}case o.SVG:{og(A,e);break}case o.HTML:{HB(A,e);break}case o.BASE:case o.LINK:case o.META:case o.STYLE:case o.TITLE:case o.SCRIPT:case o.BGSOUND:case o.BASEFONT:case o.TEMPLATE:{pe(A,e);break}case o.BODY:{DB(A,e);break}case o.FORM:{PB(A,e);break}case o.NOBR:{WB(A,e);break}case o.MATH:{sg(A,e);break}case o.TABLE:{qB(A,e);break}case o.INPUT:{jB(A,e);break}case o.PARAM:case o.TRACK:case o.SOURCE:{zB(A,e);break}case o.IMAGE:{ZB(A,e);break}case o.BUTTON:{GB(A,e);break}case o.APPLET:case o.OBJECT:case o.MARQUEE:{JB(A,e);break}case o.IFRAME:{tg(A,e);break}case o.SELECT:{rg(A,e);break}case o.OPTION:case o.OPTGROUP:{ng(A,e);break}case o.NOEMBED:case o.NOFRAMES:{eu(A,e);break}case o.FRAMESET:{OB(A,e);break}case o.TEXTAREA:{Ag(A,e);break}case o.NOSCRIPT:{A.options.scriptingEnabled?eu(A,e):tu(A,e);break}case o.PLAINTEXT:{VB(A,e);break}case o.COL:case o.TH:case o.TD:case o.TR:case o.HEAD:case o.FRAME:case o.TBODY:case o.TFOOT:case o.THEAD:case o.CAPTION:case o.COLGROUP:break;default:tu(A,e)}}function ug(A,e){if(A.openElements.hasInScope(o.BODY)&&(A.insertionMode=p.AFTER_BODY,A.options.sourceCodeLocationInfo)){const t=A.openElements.tryPeekProperlyNestedBodyElement();t&&A._setEndLocation(t,e)}}function cg(A,e){A.openElements.hasInScope(o.BODY)&&(A.insertionMode=p.AFTER_BODY,du(A,e))}function lg(A,e){const t=e.tagID;A.openElements.hasInScope(t)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(t))}function dg(A){const e=A.openElements.tmplCount>0,{formElement:t}=A;e||(A.formElement=null),(t||e)&&A.openElements.hasInScope(o.FORM)&&(A.openElements.generateImpliedEndTags(),e?A.openElements.popUntilTagNamePopped(o.FORM):t&&A.openElements.remove(t))}function fg(A){A.openElements.hasInButtonScope(o.P)||A._insertFakeElement(w.P,o.P),A._closePElement()}function hg(A){A.openElements.hasInListItemScope(o.LI)&&(A.openElements.generateImpliedEndTagsWithExclusion(o.LI),A.openElements.popUntilTagNamePopped(o.LI))}function Bg(A,e){const t=e.tagID;A.openElements.hasInScope(t)&&(A.openElements.generateImpliedEndTagsWithExclusion(t),A.openElements.popUntilTagNamePopped(t))}function gg(A){A.openElements.hasNumberedHeaderInScope()&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilNumberedHeaderPopped())}function pg(A,e){const t=e.tagID;A.openElements.hasInScope(t)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(t),A.activeFormattingElements.clearToLastMarker())}function mg(A){A._reconstructActiveFormattingElements(),A._insertFakeElement(w.BR,o.BR),A.openElements.pop(),A.framesetOk=!1}function ru(A,e){const t=e.tagName,r=e.tagID;for(let n=A.openElements.stackTop;n>0;n--){const a=A.openElements.items[n],i=A.openElements.tagIDs[n];if(r===i&&(r!==o.UNKNOWN||A.treeAdapter.getTagName(a)===t)){A.openElements.generateImpliedEndTagsWithExclusion(r),A.openElements.stackTop>=n&&A.openElements.shortenToLength(n);break}if(A._isSpecialElement(a,i))break}}function ln(A,e){switch(e.tagID){case o.A:case o.B:case o.I:case o.S:case o.U:case o.EM:case o.TT:case o.BIG:case o.CODE:case o.FONT:case o.NOBR:case o.SMALL:case o.STRIKE:case o.STRONG:{ai(A,e);break}case o.P:{fg(A);break}case o.DL:case o.UL:case o.OL:case o.DIR:case o.DIV:case o.NAV:case o.PRE:case o.MAIN:case o.MENU:case o.ASIDE:case o.BUTTON:case o.CENTER:case o.FIGURE:case o.FOOTER:case o.HEADER:case o.HGROUP:case o.DIALOG:case o.ADDRESS:case o.ARTICLE:case o.DETAILS:case o.SEARCH:case o.SECTION:case o.SUMMARY:case o.LISTING:case o.FIELDSET:case o.BLOCKQUOTE:case o.FIGCAPTION:{lg(A,e);break}case o.LI:{hg(A);break}case o.DD:case o.DT:{Bg(A,e);break}case o.H1:case o.H2:case o.H3:case o.H4:case o.H5:case o.H6:{gg(A);break}case o.BR:{mg(A);break}case o.BODY:{ug(A,e);break}case o.HTML:{cg(A,e);break}case o.FORM:{dg(A);break}case o.APPLET:case o.OBJECT:case o.MARQUEE:{pg(A,e);break}case o.TEMPLATE:{ct(A,e);break}default:ru(A,e)}}function nu(A,e){A.tmplInsertionModeStack.length>0?lu(A,e):si(A,e)}function Eg(A,e){var t;e.tagID===o.SCRIPT&&((t=A.scriptHandler)===null||t===void 0||t.call(A,A.openElements.current)),A.openElements.pop(),A.insertionMode=A.originalInsertionMode}function Cg(A,e){A._err(e,U.eofInElementThatCanContainOnlyText),A.openElements.pop(),A.insertionMode=A.originalInsertionMode,A.onEof(e)}function oi(A,e){if(Jo.has(A.openElements.currentTagId))switch(A.pendingCharacterTokens.length=0,A.hasNonWhitespacePendingCharacterToken=!1,A.originalInsertionMode=A.insertionMode,A.insertionMode=p.IN_TABLE_TEXT,e.type){case tA.CHARACTER:{iu(A,e);break}case tA.WHITESPACE_CHARACTER:{au(A,e);break}}else dr(A,e)}function wg(A,e){A.openElements.clearBackToTableContext(),A.activeFormattingElements.insertMarker(),A._insertElement(e,I.HTML),A.insertionMode=p.IN_CAPTION}function bg(A,e){A.openElements.clearBackToTableContext(),A._insertElement(e,I.HTML),A.insertionMode=p.IN_COLUMN_GROUP}function Tg(A,e){A.openElements.clearBackToTableContext(),A._insertFakeElement(w.COLGROUP,o.COLGROUP),A.insertionMode=p.IN_COLUMN_GROUP,ui(A,e)}function Ug(A,e){A.openElements.clearBackToTableContext(),A._insertElement(e,I.HTML),A.insertionMode=p.IN_TABLE_BODY}function Qg(A,e){A.openElements.clearBackToTableContext(),A._insertFakeElement(w.TBODY,o.TBODY),A.insertionMode=p.IN_TABLE_BODY,fn(A,e)}function Fg(A,e){A.openElements.hasInTableScope(o.TABLE)&&(A.openElements.popUntilTagNamePopped(o.TABLE),A._resetInsertionMode(),A._processStartTag(e))}function Ig(A,e){Au(e)?A._appendElement(e,I.HTML):dr(A,e),e.ackSelfClosing=!0}function yg(A,e){!A.formElement&&A.openElements.tmplCount===0&&(A._insertElement(e,I.HTML),A.formElement=A.openElements.current,A.openElements.pop())}function Ft(A,e){switch(e.tagID){case o.TD:case o.TH:case o.TR:{Qg(A,e);break}case o.STYLE:case o.SCRIPT:case o.TEMPLATE:{pe(A,e);break}case o.COL:{Tg(A,e);break}case o.FORM:{yg(A,e);break}case o.TABLE:{Fg(A,e);break}case o.TBODY:case o.TFOOT:case o.THEAD:{Ug(A,e);break}case o.INPUT:{Ig(A,e);break}case o.CAPTION:{wg(A,e);break}case o.COLGROUP:{bg(A,e);break}default:dr(A,e)}}function lr(A,e){switch(e.tagID){case o.TABLE:{A.openElements.hasInTableScope(o.TABLE)&&(A.openElements.popUntilTagNamePopped(o.TABLE),A._resetInsertionMode());break}case o.TEMPLATE:{ct(A,e);break}case o.BODY:case o.CAPTION:case o.COL:case o.COLGROUP:case o.HTML:case o.TBODY:case o.TD:case o.TFOOT:case o.TH:case o.THEAD:case o.TR:break;default:dr(A,e)}}function dr(A,e){const t=A.fosterParentingEnabled;A.fosterParentingEnabled=!0,cn(A,e),A.fosterParentingEnabled=t}function au(A,e){A.pendingCharacterTokens.push(e)}function iu(A,e){A.pendingCharacterTokens.push(e),A.hasNonWhitespacePendingCharacterToken=!0}function fr(A,e){let t=0;if(A.hasNonWhitespacePendingCharacterToken)for(;t<A.pendingCharacterTokens.length;t++)dr(A,A.pendingCharacterTokens[t]);else for(;t<A.pendingCharacterTokens.length;t++)A._insertCharacters(A.pendingCharacterTokens[t]);A.insertionMode=A.originalInsertionMode,A._processToken(e)}const su=new Set([o.CAPTION,o.COL,o.COLGROUP,o.TBODY,o.TD,o.TFOOT,o.TH,o.THEAD,o.TR]);function xg(A,e){const t=e.tagID;su.has(t)?A.openElements.hasInTableScope(o.CAPTION)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(o.CAPTION),A.activeFormattingElements.clearToLastMarker(),A.insertionMode=p.IN_TABLE,Ft(A,e)):KA(A,e)}function vg(A,e){const t=e.tagID;switch(t){case o.CAPTION:case o.TABLE:{A.openElements.hasInTableScope(o.CAPTION)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(o.CAPTION),A.activeFormattingElements.clearToLastMarker(),A.insertionMode=p.IN_TABLE,t===o.TABLE&&lr(A,e));break}case o.BODY:case o.COL:case o.COLGROUP:case o.HTML:case o.TBODY:case o.TD:case o.TFOOT:case o.TH:case o.THEAD:case o.TR:break;default:ln(A,e)}}function ui(A,e){switch(e.tagID){case o.HTML:{KA(A,e);break}case o.COL:{A._appendElement(e,I.HTML),e.ackSelfClosing=!0;break}case o.TEMPLATE:{pe(A,e);break}default:dn(A,e)}}function _g(A,e){switch(e.tagID){case o.COLGROUP:{A.openElements.currentTagId===o.COLGROUP&&(A.openElements.pop(),A.insertionMode=p.IN_TABLE);break}case o.TEMPLATE:{ct(A,e);break}case o.COL:break;default:dn(A,e)}}function dn(A,e){A.openElements.currentTagId===o.COLGROUP&&(A.openElements.pop(),A.insertionMode=p.IN_TABLE,A._processToken(e))}function fn(A,e){switch(e.tagID){case o.TR:{A.openElements.clearBackToTableBodyContext(),A._insertElement(e,I.HTML),A.insertionMode=p.IN_ROW;break}case o.TH:case o.TD:{A.openElements.clearBackToTableBodyContext(),A._insertFakeElement(w.TR,o.TR),A.insertionMode=p.IN_ROW,hn(A,e);break}case o.CAPTION:case o.COL:case o.COLGROUP:case o.TBODY:case o.TFOOT:case o.THEAD:{A.openElements.hasTableBodyContextInTableScope()&&(A.openElements.clearBackToTableBodyContext(),A.openElements.pop(),A.insertionMode=p.IN_TABLE,Ft(A,e));break}default:Ft(A,e)}}function ci(A,e){const t=e.tagID;switch(e.tagID){case o.TBODY:case o.TFOOT:case o.THEAD:{A.openElements.hasInTableScope(t)&&(A.openElements.clearBackToTableBodyContext(),A.openElements.pop(),A.insertionMode=p.IN_TABLE);break}case o.TABLE:{A.openElements.hasTableBodyContextInTableScope()&&(A.openElements.clearBackToTableBodyContext(),A.openElements.pop(),A.insertionMode=p.IN_TABLE,lr(A,e));break}case o.BODY:case o.CAPTION:case o.COL:case o.COLGROUP:case o.HTML:case o.TD:case o.TH:case o.TR:break;default:lr(A,e)}}function hn(A,e){switch(e.tagID){case o.TH:case o.TD:{A.openElements.clearBackToTableRowContext(),A._insertElement(e,I.HTML),A.insertionMode=p.IN_CELL,A.activeFormattingElements.insertMarker();break}case o.CAPTION:case o.COL:case o.COLGROUP:case o.TBODY:case o.TFOOT:case o.THEAD:case o.TR:{A.openElements.hasInTableScope(o.TR)&&(A.openElements.clearBackToTableRowContext(),A.openElements.pop(),A.insertionMode=p.IN_TABLE_BODY,fn(A,e));break}default:Ft(A,e)}}function ou(A,e){switch(e.tagID){case o.TR:{A.openElements.hasInTableScope(o.TR)&&(A.openElements.clearBackToTableRowContext(),A.openElements.pop(),A.insertionMode=p.IN_TABLE_BODY);break}case o.TABLE:{A.openElements.hasInTableScope(o.TR)&&(A.openElements.clearBackToTableRowContext(),A.openElements.pop(),A.insertionMode=p.IN_TABLE_BODY,ci(A,e));break}case o.TBODY:case o.TFOOT:case o.THEAD:{(A.openElements.hasInTableScope(e.tagID)||A.openElements.hasInTableScope(o.TR))&&(A.openElements.clearBackToTableRowContext(),A.openElements.pop(),A.insertionMode=p.IN_TABLE_BODY,ci(A,e));break}case o.BODY:case o.CAPTION:case o.COL:case o.COLGROUP:case o.HTML:case o.TD:case o.TH:break;default:lr(A,e)}}function Ng(A,e){const t=e.tagID;su.has(t)?(A.openElements.hasInTableScope(o.TD)||A.openElements.hasInTableScope(o.TH))&&(A._closeTableCell(),hn(A,e)):KA(A,e)}function Sg(A,e){const t=e.tagID;switch(t){case o.TD:case o.TH:{A.openElements.hasInTableScope(t)&&(A.openElements.generateImpliedEndTags(),A.openElements.popUntilTagNamePopped(t),A.activeFormattingElements.clearToLastMarker(),A.insertionMode=p.IN_ROW);break}case o.TABLE:case o.TBODY:case o.TFOOT:case o.THEAD:case o.TR:{A.openElements.hasInTableScope(t)&&(A._closeTableCell(),ou(A,e));break}case o.BODY:case o.CAPTION:case o.COL:case o.COLGROUP:case o.HTML:break;default:ln(A,e)}}function uu(A,e){switch(e.tagID){case o.HTML:{KA(A,e);break}case o.OPTION:{A.openElements.currentTagId===o.OPTION&&A.openElements.pop(),A._insertElement(e,I.HTML);break}case o.OPTGROUP:{A.openElements.currentTagId===o.OPTION&&A.openElements.pop(),A.openElements.currentTagId===o.OPTGROUP&&A.openElements.pop(),A._insertElement(e,I.HTML);break}case o.HR:{A.openElements.currentTagId===o.OPTION&&A.openElements.pop(),A.openElements.currentTagId===o.OPTGROUP&&A.openElements.pop(),A._appendElement(e,I.HTML),e.ackSelfClosing=!0;break}case o.INPUT:case o.KEYGEN:case o.TEXTAREA:case o.SELECT:{A.openElements.hasInSelectScope(o.SELECT)&&(A.openElements.popUntilTagNamePopped(o.SELECT),A._resetInsertionMode(),e.tagID!==o.SELECT&&A._processStartTag(e));break}case o.SCRIPT:case o.TEMPLATE:{pe(A,e);break}}}function cu(A,e){switch(e.tagID){case o.OPTGROUP:{A.openElements.stackTop>0&&A.openElements.currentTagId===o.OPTION&&A.openElements.tagIDs[A.openElements.stackTop-1]===o.OPTGROUP&&A.openElements.pop(),A.openElements.currentTagId===o.OPTGROUP&&A.openElements.pop();break}case o.OPTION:{A.openElements.currentTagId===o.OPTION&&A.openElements.pop();break}case o.SELECT:{A.openElements.hasInSelectScope(o.SELECT)&&(A.openElements.popUntilTagNamePopped(o.SELECT),A._resetInsertionMode());break}case o.TEMPLATE:{ct(A,e);break}}}function Lg(A,e){const t=e.tagID;t===o.CAPTION||t===o.TABLE||t===o.TBODY||t===o.TFOOT||t===o.THEAD||t===o.TR||t===o.TD||t===o.TH?(A.openElements.popUntilTagNamePopped(o.SELECT),A._resetInsertionMode(),A._processStartTag(e)):uu(A,e)}function Hg(A,e){const t=e.tagID;t===o.CAPTION||t===o.TABLE||t===o.TBODY||t===o.TFOOT||t===o.THEAD||t===o.TR||t===o.TD||t===o.TH?A.openElements.hasInTableScope(t)&&(A.openElements.popUntilTagNamePopped(o.SELECT),A._resetInsertionMode(),A.onEndTag(e)):cu(A,e)}function Dg(A,e){switch(e.tagID){case o.BASE:case o.BASEFONT:case o.BGSOUND:case o.LINK:case o.META:case o.NOFRAMES:case o.SCRIPT:case o.STYLE:case o.TEMPLATE:case o.TITLE:{pe(A,e);break}case o.CAPTION:case o.COLGROUP:case o.TBODY:case o.TFOOT:case o.THEAD:{A.tmplInsertionModeStack[0]=p.IN_TABLE,A.insertionMode=p.IN_TABLE,Ft(A,e);break}case o.COL:{A.tmplInsertionModeStack[0]=p.IN_COLUMN_GROUP,A.insertionMode=p.IN_COLUMN_GROUP,ui(A,e);break}case o.TR:{A.tmplInsertionModeStack[0]=p.IN_TABLE_BODY,A.insertionMode=p.IN_TABLE_BODY,fn(A,e);break}case o.TD:case o.TH:{A.tmplInsertionModeStack[0]=p.IN_ROW,A.insertionMode=p.IN_ROW,hn(A,e);break}default:A.tmplInsertionModeStack[0]=p.IN_BODY,A.insertionMode=p.IN_BODY,KA(A,e)}}function Og(A,e){e.tagID===o.TEMPLATE&&ct(A,e)}function lu(A,e){A.openElements.tmplCount>0?(A.openElements.popUntilTagNamePopped(o.TEMPLATE),A.activeFormattingElements.clearToLastMarker(),A.tmplInsertionModeStack.shift(),A._resetInsertionMode(),A.onEof(e)):si(A,e)}function Rg(A,e){e.tagID===o.HTML?KA(A,e):Bn(A,e)}function du(A,e){var t;if(e.tagID===o.HTML){if(A.fragmentContext||(A.insertionMode=p.AFTER_AFTER_BODY),A.options.sourceCodeLocationInfo&&A.openElements.tagIDs[0]===o.HTML){A._setEndLocation(A.openElements.items[0],e);const r=A.openElements.items[1];r&&!(!((t=A.treeAdapter.getNodeSourceCodeLocation(r))===null||t===void 0)&&t.endTag)&&A._setEndLocation(r,e)}}else Bn(A,e)}function Bn(A,e){A.insertionMode=p.IN_BODY,cn(A,e)}function Mg(A,e){switch(e.tagID){case o.HTML:{KA(A,e);break}case o.FRAMESET:{A._insertElement(e,I.HTML);break}case o.FRAME:{A._appendElement(e,I.HTML),e.ackSelfClosing=!0;break}case o.NOFRAMES:{pe(A,e);break}}}function kg(A,e){e.tagID===o.FRAMESET&&!A.openElements.isRootHtmlElementCurrent()&&(A.openElements.pop(),!A.fragmentContext&&A.openElements.currentTagId!==o.FRAMESET&&(A.insertionMode=p.AFTER_FRAMESET))}function Pg(A,e){switch(e.tagID){case o.HTML:{KA(A,e);break}case o.NOFRAMES:{pe(A,e);break}}}function Kg(A,e){e.tagID===o.HTML&&(A.insertionMode=p.AFTER_AFTER_FRAMESET)}function Vg(A,e){e.tagID===o.HTML?KA(A,e):gn(A,e)}function gn(A,e){A.insertionMode=p.IN_BODY,cn(A,e)}function Gg(A,e){switch(e.tagID){case o.HTML:{KA(A,e);break}case o.NOFRAMES:{pe(A,e);break}}}function Yg(A,e){e.chars=pA,A._insertCharacters(e)}function Xg(A,e){A._insertCharacters(e),A.framesetOk=!1}function fu(A){for(;A.treeAdapter.getNamespaceURI(A.openElements.current)!==I.HTML&&!A._isIntegrationPoint(A.openElements.currentTagId,A.openElements.current);)A.openElements.pop()}function Wg(A,e){if(oB(e))fu(A),A._startTagOutsideForeignContent(e);else{const t=A._getAdjustedCurrentElement(),r=A.treeAdapter.getNamespaceURI(t);r===I.MATHML?Xo(e):r===I.SVG&&(uB(e),Wo(e)),ni(e),e.selfClosing?A._appendElement(e,r):A._insertElement(e,r),e.ackSelfClosing=!0}}function Jg(A,e){if(e.tagID===o.P||e.tagID===o.BR){fu(A),A._endTagOutsideForeignContent(e);return}for(let t=A.openElements.stackTop;t>0;t--){const r=A.openElements.items[t];if(A.treeAdapter.getNamespaceURI(r)===I.HTML){A._endTagOutsideForeignContent(e);break}const n=A.treeAdapter.getTagName(r);if(n.toLowerCase()===e.tagName){e.tagName=n,A.openElements.shortenToLength(t);break}}}const qg=new Set([w.AREA,w.BASE,w.BASEFONT,w.BGSOUND,w.BR,w.COL,w.EMBED,w.FRAME,w.HR,w.IMG,w.INPUT,w.KEYGEN,w.LINK,w.META,w.PARAM,w.SOURCE,w.TRACK,w.WBR]);function jg(A,e){return e.treeAdapter.isElementNode(A)&&e.treeAdapter.getNamespaceURI(A)===I.HTML&&qg.has(e.treeAdapter.getTagName(A))}const zg={treeAdapter:_e,scriptingEnabled:!0};function $g(A,e){const t={...zg,...e};return hu(A,t)}function Zg(A,e){let t="";const r=e.treeAdapter.isElementNode(A)&&e.treeAdapter.getTagName(A)===w.TEMPLATE&&e.treeAdapter.getNamespaceURI(A)===I.HTML?e.treeAdapter.getTemplateContent(A):A,n=e.treeAdapter.getChildNodes(r);if(n)for(const a of n)t+=hu(a,e);return t}function hu(A,e){return e.treeAdapter.isElementNode(A)?Ap(A,e):e.treeAdapter.isTextNode(A)?tp(A,e):e.treeAdapter.isCommentNode(A)?rp(A,e):e.treeAdapter.isDocumentTypeNode(A)?np(A,e):""}function Ap(A,e){const t=e.treeAdapter.getTagName(A);return`<${t}${ep(A,e)}>${jg(A,e)?"":`${Zg(A,e)}</${t}>`}`}function ep(A,{treeAdapter:e}){let t="";for(const r of e.getAttrList(A)){if(t+=" ",r.namespace)switch(r.namespace){case I.XML:{t+=`xml:${r.name}`;break}case I.XMLNS:{r.name!=="xmlns"&&(t+="xmlns:"),t+=r.name;break}case I.XLINK:{t+=`xlink:${r.name}`;break}default:t+=`${r.prefix}:${r.name}`}else t+=r.name;t+=`="${Ls(r.value)}"`}return t}function tp(A,e){const{treeAdapter:t}=e,r=t.getTextNodeContent(A),n=t.getParentNode(A),a=n&&t.isElementNode(n)&&t.getTagName(n);return a&&t.getNamespaceURI(n)===I.HTML&&Dh(a,e.scriptingEnabled)?r:Hs(r)}function rp(A,{treeAdapter:e}){return`<!--${e.getCommentNodeContent(A)}-->`}function np(A,{treeAdapter:e}){return`<!DOCTYPE ${e.getDocumentTypeNodeName(A)}>`}function ap(A,e){return jo.parse(A,e)}function ip(A,e,t){typeof A=="string"&&(t=e,e=A,A=null);const r=jo.getFragmentParser(A,t);return r.tokenizer.write(e,!0),r.getFragment()}function Bu(A){const e=A.includes('"')?"'":'"';return e+A+e}function sp(A,e,t){let r="!DOCTYPE ";return A&&(r+=A),e?r+=` PUBLIC ${Bu(e)}`:t&&(r+=" SYSTEM"),t&&(r+=` ${Bu(t)}`),r}const Ve={isCommentNode:Vr,isElementNode:q,isTextNode:be,createDocument(){const A=new nt([]);return A["x-mode"]=se.NO_QUIRKS,A},createDocumentFragment(){return new nt([])},createElement(A,e,t){const r=Object.create(null),n=Object.create(null),a=Object.create(null);for(let s=0;s<t.length;s++){const u=t[s].name;r[u]=t[s].value,n[u]=t[s].namespace,a[u]=t[s].prefix}const i=new Ta(A,r,[]);return i.namespace=e,i["x-attribsNamespace"]=n,i["x-attribsPrefix"]=a,i},createCommentNode(A){return new Ca(A)},createTextNode(A){return new Jt(A)},appendChild(A,e){const t=A.children[A.children.length-1];t&&(t.next=e,e.prev=t),A.children.push(e),e.parent=A},insertBefore(A,e,t){const r=A.children.indexOf(t),{prev:n}=t;n&&(n.next=e,e.prev=n),t.prev=e,e.next=t,A.children.splice(r,0,e),e.parent=A},setTemplateContent(A,e){Ve.appendChild(A,e)},getTemplateContent(A){return A.children[0]},setDocumentType(A,e,t,r){const n=sp(e,t,r);let a=A.children.find(i=>Ua(i)&&i.name==="!doctype");a?a.data=n??null:(a=new wa("!doctype",n),Ve.appendChild(A,a)),a["x-name"]=e,a["x-publicId"]=t,a["x-systemId"]=r},setDocumentMode(A,e){A["x-mode"]=e},getDocumentMode(A){return A["x-mode"]},detachNode(A){if(A.parent){const e=A.parent.children.indexOf(A),{prev:t,next:r}=A;A.prev=null,A.next=null,t&&(t.next=r),r&&(r.prev=t),A.parent.children.splice(e,1),A.parent=null}},insertText(A,e){const t=A.children[A.children.length-1];t&&be(t)?t.data+=e:Ve.appendChild(A,Ve.createTextNode(e))},insertTextBefore(A,e,t){const r=A.children[A.children.indexOf(t)-1];r&&be(r)?r.data+=e:Ve.insertBefore(A,Ve.createTextNode(e),t)},adoptAttributes(A,e){for(let t=0;t<e.length;t++){const r=e[t].name;A.attribs[r]===void 0&&(A.attribs[r]=e[t].value,A["x-attribsNamespace"][r]=e[t].namespace,A["x-attribsPrefix"][r]=e[t].prefix)}},getFirstChild(A){return A.children[0]},getChildNodes(A){return A.children},getParentNode(A){return A.parent},getAttrList(A){return A.attributes},getTagName(A){return A.name},getNamespaceURI(A){return A.namespace},getTextNodeContent(A){return A.data},getCommentNodeContent(A){return A.data},getDocumentTypeNodeName(A){var e;return(e=A["x-name"])!==null&&e!==void 0?e:""},getDocumentTypeNodePublicId(A){var e;return(e=A["x-publicId"])!==null&&e!==void 0?e:""},getDocumentTypeNodeSystemId(A){var e;return(e=A["x-systemId"])!==null&&e!==void 0?e:""},isDocumentTypeNode(A){return Ua(A)&&A.name==="!doctype"},setNodeSourceCodeLocation(A,e){e&&(A.startIndex=e.startOffset,A.endIndex=e.endOffset),A.sourceCodeLocation=e},getNodeSourceCodeLocation(A){return A.sourceCodeLocation},updateNodeSourceCodeLocation(A,e){e.endOffset!=null&&(A.endIndex=e.endOffset),A.sourceCodeLocation={...A.sourceCodeLocation,...e}}};function op(A,e,t,r){var n;return(n=e.treeAdapter)!==null&&n!==void 0||(e.treeAdapter=Ve),e.scriptingEnabled!==!1&&(e.scriptingEnabled=!0),t?ap(A,e):ip(r,A,e)}const up={treeAdapter:Ve};function cp(A){const e="length"in A?A:[A];for(let r=0;r<e.length;r+=1){const n=e[r];Re(n)&&Array.prototype.splice.call(e,r,1,...n.children)}let t="";for(let r=0;r<e.length;r+=1){const n=e[r];t+=$g(n,up)}return t}var X;(function(A){A[A.Tab=9]="Tab",A[A.NewLine=10]="NewLine",A[A.FormFeed=12]="FormFeed",A[A.CarriageReturn=13]="CarriageReturn",A[A.Space=32]="Space",A[A.ExclamationMark=33]="ExclamationMark",A[A.Number=35]="Number",A[A.Amp=38]="Amp",A[A.SingleQuote=39]="SingleQuote",A[A.DoubleQuote=34]="DoubleQuote",A[A.Dash=45]="Dash",A[A.Slash=47]="Slash",A[A.Zero=48]="Zero",A[A.Nine=57]="Nine",A[A.Semi=59]="Semi",A[A.Lt=60]="Lt",A[A.Eq=61]="Eq",A[A.Gt=62]="Gt",A[A.Questionmark=63]="Questionmark",A[A.UpperA=65]="UpperA",A[A.LowerA=97]="LowerA",A[A.UpperF=70]="UpperF",A[A.LowerF=102]="LowerF",A[A.UpperZ=90]="UpperZ",A[A.LowerZ=122]="LowerZ",A[A.LowerX=120]="LowerX",A[A.OpeningSquareBracket=91]="OpeningSquareBracket"})(X||(X={}));var N;(function(A){A[A.Text=1]="Text",A[A.BeforeTagName=2]="BeforeTagName",A[A.InTagName=3]="InTagName",A[A.InSelfClosingTag=4]="InSelfClosingTag",A[A.BeforeClosingTagName=5]="BeforeClosingTagName",A[A.InClosingTagName=6]="InClosingTagName",A[A.AfterClosingTagName=7]="AfterClosingTagName",A[A.BeforeAttributeName=8]="BeforeAttributeName",A[A.InAttributeName=9]="InAttributeName",A[A.AfterAttributeName=10]="AfterAttributeName",A[A.BeforeAttributeValue=11]="BeforeAttributeValue",A[A.InAttributeValueDq=12]="InAttributeValueDq",A[A.InAttributeValueSq=13]="InAttributeValueSq",A[A.InAttributeValueNq=14]="InAttributeValueNq",A[A.BeforeDeclaration=15]="BeforeDeclaration",A[A.InDeclaration=16]="InDeclaration",A[A.InProcessingInstruction=17]="InProcessingInstruction",A[A.BeforeComment=18]="BeforeComment",A[A.CDATASequence=19]="CDATASequence",A[A.InSpecialComment=20]="InSpecialComment",A[A.InCommentLike=21]="InCommentLike",A[A.BeforeSpecialS=22]="BeforeSpecialS",A[A.BeforeSpecialT=23]="BeforeSpecialT",A[A.SpecialStartSequence=24]="SpecialStartSequence",A[A.InSpecialTag=25]="InSpecialTag",A[A.InEntity=26]="InEntity"})(N||(N={}));function Ne(A){return A===X.Space||A===X.NewLine||A===X.Tab||A===X.FormFeed||A===X.CarriageReturn}function pn(A){return A===X.Slash||A===X.Gt||Ne(A)}function lp(A){return A>=X.LowerA&&A<=X.LowerZ||A>=X.UpperA&&A<=X.UpperZ}var Ue;(function(A){A[A.NoValue=0]="NoValue",A[A.Unquoted=1]="Unquoted",A[A.Single=2]="Single",A[A.Double=3]="Double"})(Ue||(Ue={}));const RA={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97])};let dp=class{constructor({xmlMode:e=!1,decodeEntities:t=!0},r){this.cbs=r,this.state=N.Text,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=N.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.xmlMode=e,this.decodeEntities=t,this.entityDecoder=new va(e?xs:Fa,(n,a)=>this.emitCodePoint(n,a))}reset(){this.state=N.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=N.Text,this.currentSequence=void 0,this.running=!0,this.offset=0}write(e){this.offset+=this.buffer.length,this.buffer=e,this.parse()}end(){this.running&&this.finish()}pause(){this.running=!1}resume(){this.running=!0,this.index<this.buffer.length+this.offset&&this.parse()}stateText(e){e===X.Lt||!this.decodeEntities&&this.fastForwardTo(X.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=N.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&e===X.Amp&&this.startEntity()}stateSpecialStartSequence(e){const t=this.sequenceIndex===this.currentSequence.length;if(!(t?pn(e):(e|32)===this.currentSequence[this.sequenceIndex]))this.isSpecial=!1;else if(!t){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=N.InTagName,this.stateInTagName(e)}stateInSpecialTag(e){if(this.sequenceIndex===this.currentSequence.length){if(e===X.Gt||Ne(e)){const t=this.index-this.currentSequence.length;if(this.sectionStart<t){const r=this.index;this.index=t,this.cbs.ontext(this.sectionStart,t),this.index=r}this.isSpecial=!1,this.sectionStart=t+2,this.stateInClosingTagName(e);return}this.sequenceIndex=0}(e|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===RA.TitleEnd?this.decodeEntities&&e===X.Amp&&this.startEntity():this.fastForwardTo(X.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=+(e===X.Lt)}stateCDATASequence(e){e===RA.Cdata[this.sequenceIndex]?++this.sequenceIndex===RA.Cdata.length&&(this.state=N.InCommentLike,this.currentSequence=RA.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=N.InDeclaration,this.stateInDeclaration(e))}fastForwardTo(e){for(;++this.index<this.buffer.length+this.offset;)if(this.buffer.charCodeAt(this.index-this.offset)===e)return!0;return this.index=this.buffer.length+this.offset-1,!1}stateInCommentLike(e){e===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===RA.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index,2):this.cbs.oncomment(this.sectionStart,this.index,2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=N.Text):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):e!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}isTagStartChar(e){return this.xmlMode?!pn(e):lp(e)}startSpecial(e,t){this.isSpecial=!0,this.currentSequence=e,this.sequenceIndex=t,this.state=N.SpecialStartSequence}stateBeforeTagName(e){if(e===X.ExclamationMark)this.state=N.BeforeDeclaration,this.sectionStart=this.index+1;else if(e===X.Questionmark)this.state=N.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(e)){const t=e|32;this.sectionStart=this.index,this.xmlMode?this.state=N.InTagName:t===RA.ScriptEnd[2]?this.state=N.BeforeSpecialS:t===RA.TitleEnd[2]?this.state=N.BeforeSpecialT:this.state=N.InTagName}else e===X.Slash?this.state=N.BeforeClosingTagName:(this.state=N.Text,this.stateText(e))}stateInTagName(e){pn(e)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=N.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateBeforeClosingTagName(e){Ne(e)||(e===X.Gt?this.state=N.Text:(this.state=this.isTagStartChar(e)?N.InClosingTagName:N.InSpecialComment,this.sectionStart=this.index))}stateInClosingTagName(e){(e===X.Gt||Ne(e))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=N.AfterClosingTagName,this.stateAfterClosingTagName(e))}stateAfterClosingTagName(e){(e===X.Gt||this.fastForwardTo(X.Gt))&&(this.state=N.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(e){e===X.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=N.InSpecialTag,this.sequenceIndex=0):this.state=N.Text,this.sectionStart=this.index+1):e===X.Slash?this.state=N.InSelfClosingTag:Ne(e)||(this.state=N.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(e){e===X.Gt?(this.cbs.onselfclosingtag(this.index),this.state=N.Text,this.sectionStart=this.index+1,this.isSpecial=!1):Ne(e)||(this.state=N.BeforeAttributeName,this.stateBeforeAttributeName(e))}stateInAttributeName(e){(e===X.Eq||pn(e))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=this.index,this.state=N.AfterAttributeName,this.stateAfterAttributeName(e))}stateAfterAttributeName(e){e===X.Eq?this.state=N.BeforeAttributeValue:e===X.Slash||e===X.Gt?(this.cbs.onattribend(Ue.NoValue,this.sectionStart),this.sectionStart=-1,this.state=N.BeforeAttributeName,this.stateBeforeAttributeName(e)):Ne(e)||(this.cbs.onattribend(Ue.NoValue,this.sectionStart),this.state=N.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(e){e===X.DoubleQuote?(this.state=N.InAttributeValueDq,this.sectionStart=this.index+1):e===X.SingleQuote?(this.state=N.InAttributeValueSq,this.sectionStart=this.index+1):Ne(e)||(this.sectionStart=this.index,this.state=N.InAttributeValueNq,this.stateInAttributeValueNoQuotes(e))}handleInAttributeValue(e,t){e===t||!this.decodeEntities&&this.fastForwardTo(t)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(t===X.DoubleQuote?Ue.Double:Ue.Single,this.index+1),this.state=N.BeforeAttributeName):this.decodeEntities&&e===X.Amp&&this.startEntity()}stateInAttributeValueDoubleQuotes(e){this.handleInAttributeValue(e,X.DoubleQuote)}stateInAttributeValueSingleQuotes(e){this.handleInAttributeValue(e,X.SingleQuote)}stateInAttributeValueNoQuotes(e){Ne(e)||e===X.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(Ue.Unquoted,this.index),this.state=N.BeforeAttributeName,this.stateBeforeAttributeName(e)):this.decodeEntities&&e===X.Amp&&this.startEntity()}stateBeforeDeclaration(e){e===X.OpeningSquareBracket?(this.state=N.CDATASequence,this.sequenceIndex=0):this.state=e===X.Dash?N.BeforeComment:N.InDeclaration}stateInDeclaration(e){(e===X.Gt||this.fastForwardTo(X.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=N.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(e){(e===X.Gt||this.fastForwardTo(X.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=N.Text,this.sectionStart=this.index+1)}stateBeforeComment(e){e===X.Dash?(this.state=N.InCommentLike,this.currentSequence=RA.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=N.InDeclaration}stateInSpecialComment(e){(e===X.Gt||this.fastForwardTo(X.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=N.Text,this.sectionStart=this.index+1)}stateBeforeSpecialS(e){const t=e|32;t===RA.ScriptEnd[3]?this.startSpecial(RA.ScriptEnd,4):t===RA.StyleEnd[3]?this.startSpecial(RA.StyleEnd,4):(this.state=N.InTagName,this.stateInTagName(e))}stateBeforeSpecialT(e){const t=e|32;t===RA.TitleEnd[3]?this.startSpecial(RA.TitleEnd,4):t===RA.TextareaEnd[3]?this.startSpecial(RA.TextareaEnd,4):(this.state=N.InTagName,this.stateInTagName(e))}startEntity(){this.baseState=this.state,this.state=N.InEntity,this.entityStart=this.index,this.entityDecoder.startEntity(this.xmlMode?ce.Strict:this.baseState===N.Text||this.baseState===N.InSpecialTag?ce.Legacy:ce.Attribute)}stateInEntity(){const e=this.entityDecoder.write(this.buffer,this.index-this.offset);e>=0?(this.state=this.baseState,e===0&&(this.index=this.entityStart)):this.index=this.offset+this.buffer.length-1}cleanup(){this.running&&this.sectionStart!==this.index&&(this.state===N.Text||this.state===N.InSpecialTag&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===N.InAttributeValueDq||this.state===N.InAttributeValueSq||this.state===N.InAttributeValueNq)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}shouldContinue(){return this.index<this.buffer.length+this.offset&&this.running}parse(){for(;this.shouldContinue();){const e=this.buffer.charCodeAt(this.index-this.offset);switch(this.state){case N.Text:{this.stateText(e);break}case N.SpecialStartSequence:{this.stateSpecialStartSequence(e);break}case N.InSpecialTag:{this.stateInSpecialTag(e);break}case N.CDATASequence:{this.stateCDATASequence(e);break}case N.InAttributeValueDq:{this.stateInAttributeValueDoubleQuotes(e);break}case N.InAttributeName:{this.stateInAttributeName(e);break}case N.InCommentLike:{this.stateInCommentLike(e);break}case N.InSpecialComment:{this.stateInSpecialComment(e);break}case N.BeforeAttributeName:{this.stateBeforeAttributeName(e);break}case N.InTagName:{this.stateInTagName(e);break}case N.InClosingTagName:{this.stateInClosingTagName(e);break}case N.BeforeTagName:{this.stateBeforeTagName(e);break}case N.AfterAttributeName:{this.stateAfterAttributeName(e);break}case N.InAttributeValueSq:{this.stateInAttributeValueSingleQuotes(e);break}case N.BeforeAttributeValue:{this.stateBeforeAttributeValue(e);break}case N.BeforeClosingTagName:{this.stateBeforeClosingTagName(e);break}case N.AfterClosingTagName:{this.stateAfterClosingTagName(e);break}case N.BeforeSpecialS:{this.stateBeforeSpecialS(e);break}case N.BeforeSpecialT:{this.stateBeforeSpecialT(e);break}case N.InAttributeValueNq:{this.stateInAttributeValueNoQuotes(e);break}case N.InSelfClosingTag:{this.stateInSelfClosingTag(e);break}case N.InDeclaration:{this.stateInDeclaration(e);break}case N.BeforeDeclaration:{this.stateBeforeDeclaration(e);break}case N.BeforeComment:{this.stateBeforeComment(e);break}case N.InProcessingInstruction:{this.stateInProcessingInstruction(e);break}case N.InEntity:{this.stateInEntity();break}}this.index++}this.cleanup()}finish(){this.state===N.InEntity&&(this.entityDecoder.end(),this.state=this.baseState),this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){const e=this.buffer.length+this.offset;this.sectionStart>=e||(this.state===N.InCommentLike?this.currentSequence===RA.CdataEnd?this.cbs.oncdata(this.sectionStart,e,0):this.cbs.oncomment(this.sectionStart,e,0):this.state===N.InTagName||this.state===N.BeforeAttributeName||this.state===N.BeforeAttributeValue||this.state===N.AfterAttributeName||this.state===N.InAttributeName||this.state===N.InAttributeValueSq||this.state===N.InAttributeValueDq||this.state===N.InAttributeValueNq||this.state===N.InClosingTagName||this.cbs.ontext(this.sectionStart,e))}emitCodePoint(e,t){this.baseState!==N.Text&&this.baseState!==N.InSpecialTag?(this.sectionStart<this.entityStart&&this.cbs.onattribdata(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+t,this.index=this.sectionStart-1,this.cbs.onattribentity(e)):(this.sectionStart<this.entityStart&&this.cbs.ontext(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+t,this.index=this.sectionStart-1,this.cbs.ontextentity(e,this.sectionStart))}};const It=new Set(["input","option","optgroup","select","button","datalist","textarea"]),oA=new Set(["p"]),gu=new Set(["thead","tbody"]),pu=new Set(["dd","dt"]),mu=new Set(["rt","rp"]),fp=new Map([["tr",new Set(["tr","th","td"])],["th",new Set(["th"])],["td",new Set(["thead","th","td"])],["body",new Set(["head","link","script"])],["li",new Set(["li"])],["p",oA],["h1",oA],["h2",oA],["h3",oA],["h4",oA],["h5",oA],["h6",oA],["select",It],["input",It],["output",It],["button",It],["datalist",It],["textarea",It],["option",new Set(["option"])],["optgroup",new Set(["optgroup","option"])],["dd",pu],["dt",pu],["address",oA],["article",oA],["aside",oA],["blockquote",oA],["details",oA],["div",oA],["dl",oA],["fieldset",oA],["figcaption",oA],["figure",oA],["footer",oA],["form",oA],["header",oA],["hr",oA],["main",oA],["nav",oA],["ol",oA],["pre",oA],["section",oA],["table",oA],["ul",oA],["rt",mu],["rp",mu],["tbody",gu],["tfoot",gu]]),hp=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),Eu=new Set(["math","svg"]),Cu=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignobject","desc","title"]),Bp=/\s|\//;let gp=class{constructor(e,t={}){var r,n,a,i,s,u;this.options=t,this.startIndex=0,this.endIndex=0,this.openTagStart=0,this.tagname="",this.attribname="",this.attribvalue="",this.attribs=null,this.stack=[],this.buffers=[],this.bufferOffset=0,this.writeIndex=0,this.ended=!1,this.cbs=e??{},this.htmlMode=!this.options.xmlMode,this.lowerCaseTagNames=(r=t.lowerCaseTags)!==null&&r!==void 0?r:this.htmlMode,this.lowerCaseAttributeNames=(n=t.lowerCaseAttributeNames)!==null&&n!==void 0?n:this.htmlMode,this.recognizeSelfClosing=(a=t.recognizeSelfClosing)!==null&&a!==void 0?a:!this.htmlMode,this.tokenizer=new((i=t.Tokenizer)!==null&&i!==void 0?i:dp)(this.options,this),this.foreignContext=[!this.htmlMode],(u=(s=this.cbs).onparserinit)===null||u===void 0||u.call(s,this)}ontext(e,t){var r,n;const a=this.getSlice(e,t);this.endIndex=t-1,(n=(r=this.cbs).ontext)===null||n===void 0||n.call(r,a),this.startIndex=t}ontextentity(e,t){var r,n;this.endIndex=t-1,(n=(r=this.cbs).ontext)===null||n===void 0||n.call(r,ya(e)),this.startIndex=t}isVoidElement(e){return this.htmlMode&&hp.has(e)}onopentagname(e,t){this.endIndex=t;let r=this.getSlice(e,t);this.lowerCaseTagNames&&(r=r.toLowerCase()),this.emitOpenTag(r)}emitOpenTag(e){var t,r,n,a;this.openTagStart=this.startIndex,this.tagname=e;const i=this.htmlMode&&fp.get(e);if(i)for(;this.stack.length>0&&i.has(this.stack[0]);){const s=this.stack.shift();(r=(t=this.cbs).onclosetag)===null||r===void 0||r.call(t,s,!0)}this.isVoidElement(e)||(this.stack.unshift(e),this.htmlMode&&(Eu.has(e)?this.foreignContext.unshift(!0):Cu.has(e)&&this.foreignContext.unshift(!1))),(a=(n=this.cbs).onopentagname)===null||a===void 0||a.call(n,e),this.cbs.onopentag&&(this.attribs={})}endOpenTag(e){var t,r;this.startIndex=this.openTagStart,this.attribs&&((r=(t=this.cbs).onopentag)===null||r===void 0||r.call(t,this.tagname,this.attribs,e),this.attribs=null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=""}onopentagend(e){this.endIndex=e,this.endOpenTag(!1),this.startIndex=e+1}onclosetag(e,t){var r,n,a,i,s,u,l,d;this.endIndex=t;let f=this.getSlice(e,t);if(this.lowerCaseTagNames&&(f=f.toLowerCase()),this.htmlMode&&(Eu.has(f)||Cu.has(f))&&this.foreignContext.shift(),this.isVoidElement(f))this.htmlMode&&f==="br"&&((i=(a=this.cbs).onopentagname)===null||i===void 0||i.call(a,"br"),(u=(s=this.cbs).onopentag)===null||u===void 0||u.call(s,"br",{},!0),(d=(l=this.cbs).onclosetag)===null||d===void 0||d.call(l,"br",!1));else{const h=this.stack.indexOf(f);if(h!==-1)for(let C=0;C<=h;C++){const E=this.stack.shift();(n=(r=this.cbs).onclosetag)===null||n===void 0||n.call(r,E,C!==h)}else this.htmlMode&&f==="p"&&(this.emitOpenTag("p"),this.closeCurrentTag(!0))}this.startIndex=t+1}onselfclosingtag(e){this.endIndex=e,this.recognizeSelfClosing||this.foreignContext[0]?(this.closeCurrentTag(!1),this.startIndex=e+1):this.onopentagend(e)}closeCurrentTag(e){var t,r;const n=this.tagname;this.endOpenTag(e),this.stack[0]===n&&((r=(t=this.cbs).onclosetag)===null||r===void 0||r.call(t,n,!e),this.stack.shift())}onattribname(e,t){this.startIndex=e;const r=this.getSlice(e,t);this.attribname=this.lowerCaseAttributeNames?r.toLowerCase():r}onattribdata(e,t){this.attribvalue+=this.getSlice(e,t)}onattribentity(e){this.attribvalue+=ya(e)}onattribend(e,t){var r,n;this.endIndex=t,(n=(r=this.cbs).onattribute)===null||n===void 0||n.call(r,this.attribname,this.attribvalue,e===Ue.Double?'"':e===Ue.Single?"'":e===Ue.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=""}getInstructionName(e){const t=e.search(Bp);let r=t<0?e:e.substr(0,t);return this.lowerCaseTagNames&&(r=r.toLowerCase()),r}ondeclaration(e,t){this.endIndex=t;const r=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){const n=this.getInstructionName(r);this.cbs.onprocessinginstruction(`!${n}`,`!${r}`)}this.startIndex=t+1}onprocessinginstruction(e,t){this.endIndex=t;const r=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){const n=this.getInstructionName(r);this.cbs.onprocessinginstruction(`?${n}`,`?${r}`)}this.startIndex=t+1}oncomment(e,t,r){var n,a,i,s;this.endIndex=t,(a=(n=this.cbs).oncomment)===null||a===void 0||a.call(n,this.getSlice(e,t-r)),(s=(i=this.cbs).oncommentend)===null||s===void 0||s.call(i),this.startIndex=t+1}oncdata(e,t,r){var n,a,i,s,u,l,d,f,h,C;this.endIndex=t;const E=this.getSlice(e,t-r);!this.htmlMode||this.options.recognizeCDATA?((a=(n=this.cbs).oncdatastart)===null||a===void 0||a.call(n),(s=(i=this.cbs).ontext)===null||s===void 0||s.call(i,E),(l=(u=this.cbs).oncdataend)===null||l===void 0||l.call(u)):((f=(d=this.cbs).oncomment)===null||f===void 0||f.call(d,`[CDATA[${E}]]`),(C=(h=this.cbs).oncommentend)===null||C===void 0||C.call(h)),this.startIndex=t+1}onend(){var e,t;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let r=0;r<this.stack.length;r++)this.cbs.onclosetag(this.stack[r],!0)}(t=(e=this.cbs).onend)===null||t===void 0||t.call(e)}reset(){var e,t,r,n;(t=(e=this.cbs).onreset)===null||t===void 0||t.call(e),this.tokenizer.reset(),this.tagname="",this.attribname="",this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,(n=(r=this.cbs).onparserinit)===null||n===void 0||n.call(r,this),this.buffers.length=0,this.foreignContext.length=0,this.foreignContext.unshift(!this.htmlMode),this.bufferOffset=0,this.writeIndex=0,this.ended=!1}parseComplete(e){this.reset(),this.end(e)}getSlice(e,t){for(;e-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();let r=this.buffers[0].slice(e-this.bufferOffset,t-this.bufferOffset);for(;t-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),r+=this.buffers[0].slice(0,t-this.bufferOffset);return r}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(e){var t,r;if(this.ended){(r=(t=this.cbs).onerror)===null||r===void 0||r.call(t,new Error(".write() after done!"));return}this.buffers.push(e),this.tokenizer.running&&(this.tokenizer.write(e),this.writeIndex++)}end(e){var t,r;if(this.ended){(r=(t=this.cbs).onerror)===null||r===void 0||r.call(t,new Error(".end() after done!"));return}e&&this.write(e),this.ended=!0,this.tokenizer.end()}pause(){this.tokenizer.pause()}resume(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex<this.buffers.length;)this.tokenizer.write(this.buffers[this.writeIndex++]);this.ended&&this.tokenizer.end()}parseChunk(e){this.write(e)}done(e){this.end(e)}};function pp(A,e){const t=new m0(void 0,e);return new gp(t,e).end(A),t.root}const mp=Wf((A,e,t,r)=>e._useHtmlParser2?pp(A,e):op(A,e,t,r)),wu=Fh(mp,(A,e)=>e._useHtmlParser2?Gr(A,e):cp(A));var G=(A=>(A[A.None=0]="None",A[A.Text=1]="Text",A[A.Image=2]="Image",A[A.Video=3]="Video",A[A.Icon=4]="Icon",A[A.Link=5]="Link",A[A.Button=6]="Button",A[A.Block=10]="Block",A))(G||{}),zA;(A=>{A.THEME_TEXT_COLOR_CLASS="gp-designer-theme-text",A.THEME_BUTTON_COLOR_CLASS="gp-designer-theme-button",A.THEME_ICON_COLOR_CLASS="gp-designer-theme-icon",A.THEME_COLOR="#3574e6",A.IMAGE_PREVIEW_CLASS="gp-designer-image-preview"})(zA||(zA={}));const Ep=c.defineComponent({name:"GpMessage",props:{message:{type:String,required:!0},type:{type:String,default:"info"},position:{type:String,default:"top-right"},duration:{type:Number,default:3e3},onClose:{type:Function,required:!0},icon:{type:Boolean,default:!0}},setup(A){const e=c.ref(!1),t=c.computed(()=>({success:"bg-green-100 text-green-800",error:"bg-red-100 text-red-800",info:"bg-blue-100 text-blue-800",warning:"bg-yellow-100 text-yellow-800"})[A.type]),r=()=>{e.value=!1,A.onClose()};return setTimeout(()=>{r()},A.duration),e.value=!0,{visible:e,typeClass:t,closeMessage:r}}}),Ge=(A,e)=>{const t=A.__vccOpts||A;for(const[r,n]of e)t[r]=n;return t},Cp={key:0,class:"gp-message"},wp={key:0,class:"mr-2"},bp={key:0,class:"text-green-500"},Tp={key:1,class:"text-red-500"},Up={key:2,class:"text-blue-500"},Qp={key:3,class:"text-yellow-500"};function Fp(A,e,t,r,n,a){return c.openBlock(),c.createBlock(c.Transition,{name:"fade"},{default:c.withCtx(()=>[A.visible?(c.openBlock(),c.createElementBlock("div",Cp,[c.createElementVNode("div",{class:c.normalizeClass([A.typeClass,"message-content"])},[A.icon?(c.openBlock(),c.createElementBlock("span",wp,[c.renderSlot(A.$slots,"icon",{},()=>[A.type==="success"?(c.openBlock(),c.createElementBlock("span",bp,"✔")):c.createCommentVNode("",!0),A.type==="error"?(c.openBlock(),c.createElementBlock("span",Tp,"✖")):c.createCommentVNode("",!0),A.type==="info"?(c.openBlock(),c.createElementBlock("span",Up,"ℹ")):c.createCommentVNode("",!0),A.type==="warning"?(c.openBlock(),c.createElementBlock("span",Qp,"⚠")):c.createCommentVNode("",!0)],!0)])):c.createCommentVNode("",!0),c.createElementVNode("span",null,c.toDisplayString(A.message),1),c.createElementVNode("button",{class:"close-btn hover:text-gray-800 font-bold",onClick:e[0]||(e[0]=(...i)=>A.closeMessage&&A.closeMessage(...i))}," × ")],2)])):c.createCommentVNode("",!0)]),_:3})}const Ip=Ge(Ep,[["render",Fp],["__scopeId","data-v-a234b03c"]]),yt=c.reactive([]);let li=null;const yp=()=>{const A=document.createElement("div");return A.id="global-message-container",document.body.appendChild(A),A},xp=()=>{if(li)return;const A=yp();li=c.createApp({setup(){return{messageQueue:yt}},render(){const e=c.computed(()=>{var r;return{"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4","top-center":"top-4 left-1/2 transform -translate-x-1/2","bottom-center":"bottom-4 left-1/2 transform -translate-x-1/2"}[((r=yt[0])==null?void 0:r.options.position)||"top-right"]});return c.h("div",{class:`fixed flex flex-col gap-2 ${e.value}`,style:{zIndex:999999}},yt.map(t=>c.h(Ip,{key:t.id,...t.options,onClose:()=>bu(t.id)})))}}),li.mount(A)},bu=A=>{const e=yt.findIndex(t=>t.id===A);e!==-1&&yt.splice(e,1)};let vp=0;const j=A=>{xp();const e=vp++;yt.push({id:e,options:A}),setTimeout(()=>{bu(e)},A.duration||3e3)};j.success=(A,e=3e3,t=!0)=>{j(typeof A=="string"?{message:A,type:"success",duration:e,icon:t}:{...A,type:"success"})},j.error=(A,e=3e3,t=!0)=>{j(typeof A=="string"?{message:A,type:"error",duration:e,icon:t}:{...A,type:"error"})},j.info=(A,e=3e3,t=!0)=>{j(typeof A=="string"?{message:A,type:"info",duration:e,icon:t}:{...A,type:"info"})},j.warning=(A,e=3e3,t=!0)=>{j(typeof A=="string"?{message:A,type:"warning",duration:e,icon:t}:{...A,type:"warning"})};const _p=["onClick"],Np={key:2,"date-action":"1",contenteditable:"false",class:"text-red-500 text-xs mt-1"},Sp=Ge(c.defineComponent({__name:"ElementRenderer",props:{element:{type:Object,required:!0},selectedElement:Object,hoveredElement:Object,uploadByFile:{type:Function,required:!1},icons:{type:Array,default:()=>[]},mode:{type:String,default:"edit"},cropper:{type:Object,required:!1},icon:{type:Object,required:!1},upload:{type:Object,required:!1},r:{type:String,required:!1},showMargin:{type:Boolean,default:!1},isCover:{type:Boolean,default:!1}},emits:["selectElement","hoverElement","updateText","contentUpdated","blockAction","addIcon","updateElementRule","getCoverHtml"],setup(A,{emit:e}){const t=A,r=e,n=c.computed(()=>{var _;const y=t.element.editText||t.element.text;return t.element.rule&&t.element.rule.allowWrap?(_=y==null?void 0:y.replace(/\n/g,"<br>"))==null?void 0:_.replace(/ /g," "):y}),a=c.computed(()=>t.selectedElement===t.element),i=c.computed(()=>t.hoveredElement===t.element),s=c.ref(!1),u=c.ref(!1),l=c.ref(""),d=c.computed(()=>t.element.rule.minText||0),f=c.computed(()=>t.element.rule.maxText||1/0),h=y=>{let _="";if(y.children&&y.children.length&&y.children[0].type===G.Block&&y.children[0].rule&&y.children[0].rule.flexColumns&&y.children[0].rule.flexColumns.length>0){if(!y.children[0].rule.flexColumns.includes(-1)){const J=y.children[0].rule.flexColumn;Math.min(J,y.children.length)>=1&&(_+=" pc:flex pc:justify-center pc:flex-wrap")}if(y.children[0].rule.mobileFlexColumn!==-1){const J=y.children[0].rule.mobileFlexColumn;J>=1?_+=" mobile:flex mobile:justify-normal mobile:flex-wrap":J||(_+=" mobile:flex mobile:justify-normal mobile:flex-nowrap gp-designer-m-swiper swiper-wrapper ")}}if(y.type===G.Block){const J=y.rule.flexColumn,wA=y.rule.mobileFlexColumn;(wA>=1||J>=1)&&(_+=" box-border "),wA>1&&wA<=12?_+=` mobile:basis-1/${wA} `:wA==1?_+=" mobile:basis-full ":wA||(_+=" gp-designer-m-swiper-slide swiper-slide "),J>1&&J<=12?_+=` pc:basis-1/${J} `:J==1&&(_+=" pc:basis-full ")}if((y.type==G.Button||y.type==G.Link)&&y.rule.openMeiqia&&(_+=" gp-designer-meiqia "),y.rule.isThemeColor&&t.element.type===G.Text?_+=" "+zA.THEME_TEXT_COLOR_CLASS+" ":y.rule.isThemeColor&&t.element.type===G.Button?_+=" "+zA.THEME_BUTTON_COLOR_CLASS+" ":y.rule.isThemeColor&&t.element.type===G.Icon&&(_+=" "+zA.THEME_ICON_COLOR_CLASS+" "),y.attrs.class){var gA=y.attrs.class.split(" ").filter(J=>J);gA.length&&(_=_.split(" ").filter(J=>!gA.includes(J)).join(" "))}return y.type===G.Image&&y.rule.preview&&(_+=" "+zA.IMAGE_PREVIEW_CLASS+" "),_};c.watch(()=>t.r,()=>{r("contentUpdated",D())},{immediate:!0});function C(y){y.xpath!="/div[1]"&&t.mode!=="preview"&&(t.mode==="edit"?y.type===G.Text&&r("selectElement",y):r("selectElement",y),!y.rule.isReadOnly&&y.type===G.Text&&(s.value=!0))}function E(y){r("selectElement",y)}function T(y,_){r("hoverElement",y,_)}function v(y){r("hoverElement",y)}function b(y){y.currentTarget.contains(y.relatedTarget)?r("hoverElement",null):t.hoveredElement?r("hoverElement",null,t.hoveredElement.parentxpath):r("hoverElement",null)}function x(){s.value=!1,r("contentUpdated",D())}function D(){function y(gA){var ma;const J=gA;if(J.tag==="br")return"";const wA=J.rule.isThemeColor&&J.type==G.Text?zA.THEME_TEXT_COLOR_CLASS:J.rule.isThemeColor&&J.type==G.Button?zA.THEME_BUTTON_COLOR_CLASS:J.rule.isThemeColor&&J.type==G.Icon?zA.THEME_ICON_COLOR_CLASS:"";wA?J.attrs.class&&!J.attrs.class.includes(wA)?J.attrs.class=J.attrs.class?J.attrs.class+" "+wA:wA:J.attrs.class||(J.attrs.class=wA):J.attrs.class=(ma=J.attrs.class)==null?void 0:ma.replace(new RegExp(`${zA.THEME_TEXT_COLOR_CLASS}|${zA.THEME_BUTTON_COLOR_CLASS}|${zA.THEME_ICON_COLOR_CLASS}`,"g"),"");const OA={class:J.attrs.class||""};OA.class&&(OA.class=OA.class.replace(/pc:\S+/g,"").replace(/mobile:\S+/g,""),OA.class=OA.class.replace(/gp-designer-m-swiper/g,"").replace(/gp-designer-m-swiper-slide/g,"").replace(/swiper-wrapper/g,"").replace(/swiper-slide/g,"").replace(/gp-designer-meiqia/g,""));const Ct=h(J);Ct&&(OA.class+=" "+Ct),J.type===G.Image&&(J.rule.preview?OA.class.includes(zA.IMAGE_PREVIEW_CLASS)||(OA.class+=" "+zA.IMAGE_PREVIEW_CLASS+" "):OA.class=OA.class.replace(zA.IMAGE_PREVIEW_CLASS,""));let Xt=Object.entries(gA.attrs||{}).filter(([Q,F])=>Q!=="class").map(([Q,F])=>`${Q}="${F}"`).join(" ");const Wt=Object.entries(OA||{}).map(([Q,F])=>`${Q}="${F.trim()}"`).join(" ");Xt+=Wt;const Ba=`<${gA.tag}${Xt?" "+Xt:""}>`,ga=`</${gA.tag}>`,pa=(gA.children||[]).map(Q=>y(Q)).join("");let rt=gA.editText||gA.text||"";return rt=rt.replace(/\r\n/g,`
|
9
|
+
`).replace(/\n/g,"<br>"),`${Ba}${rt}${pa}${ga}`}return y(t.element)}function R(y){var wA,OA;y.preventDefault(),y.stopPropagation();let _=((wA=y.clipboardData)==null?void 0:wA.getData("text/plain"))||"";(OA=t.element.rule)!=null&&OA.allowWrap?(_=_==null?void 0:_.replace(/\n/g,"<br>"),document.execCommand("insertHTML",!1,_)):(_=_==null?void 0:_.replace(/\n/g," "),document.execCommand("insertText",!1,_));const gA=y.target,J=gA.innerText||gA.textContent||"";L(J)}function O(y){var _;y.key==="Enter"&&(y.preventDefault(),y.stopPropagation(),(_=t.element.rule)!=null&&_.allowWrap?document.execCommand("insertLineBreak"):j.error("当前节点不允许换行"))}function m(y){y.stopPropagation();const _=y.target,gA=_.innerText||_.textContent||"";L(gA)}function L(y){if(y.length<d.value){u.value=!0,l.value=`最少输入 ${d.value} 个字符`;return}else if(y.length>f.value){u.value=!0,l.value=`最多输入 ${f.value} 个字符`;return}else u.value=!1,l.value="";r("updateText",{element:t.element,newText:y}),r("contentUpdated",D());const _=c.toRaw(t.element);_.editText=y}function V(y){r("updateText",y),r("contentUpdated",D())}function k(){const y={...t.element};r("blockAction",{action:"add",element:t.element,newBlock:y})}function z(){aA(t.element),r("blockAction",{action:"moveUp",element:t.element})}function aA(y){y.children&&y.children.length>0&&y.children.forEach(_=>{_.type==G.Text&&(_.text!==_.editText&&(_.text=_.editText),aA(_))})}function cA(){aA(t.element),r("blockAction",{action:"moveDown",element:t.element})}function W(){r("blockAction",{action:"delete",element:t.element})}function rA(y){r("blockAction",y),r("contentUpdated",D())}function fA(y){yA.value.openModal(y)}function BA(y){XA.value.openModal(y)}function TA(y,_){r("addIcon",y,_),r("contentUpdated",D())}function YA(y){r("updateElementRule",y)}const yA=c.ref(t.icon);c.watch(()=>t.icon,y=>{yA.value=y},{immediate:!0});const XA=c.ref(t.upload);c.watch(()=>t.upload,y=>{XA.value=y},{immediate:!0});const WA=c.computed(()=>{const y=h(t.element);return t.element.css=y,y}),ie=(y,_)=>{_.children&&_.children.length&&_.children[0].type===G.Block&&_.children.map(gA=>{gA.rule.flexColumn=y}),r("updateElementRule",_)},PA=c.computed(()=>{let y="";if(t.mode==="design"){const _=t.element;if(_.type===G.Block){const gA=_.rule.flexColumn;gA>1&&gA<=12&&(y+=`flex-basis: calc(100% / ${gA} - 10px);`)}}return y}),JA=c.ref(null),ZA=async()=>{JA.value&&r("getCoverHtml",JA.value)};return c.watch(()=>t.isCover,y=>{y&&ZA()},{immediate:!0}),(y,_)=>{const gA=c.resolveComponent("ElementRenderer",!0);return c.openBlock(),c.createElementBlock(c.Fragment,null,[t.element.type==c.unref(G).Text?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(t.element.tag),c.mergeProps({key:0,class:["relative",A.mode==="design"?" border-dashed border-2":"",A.showMargin?"p-1 m-1":"",i.value?"border-dashed border-blue-500":"",a.value?"border-dashed border-green-500 z-5 border-2":"",u.value?"border-dashed border-red-500":"",(!i.value&&!a.value&&!u.value,""),t.element.rule&&t.element.rule.isReadOnly?"cursor-not-allowed":"",WA.value],style:PA.value},t.element.attrs,{contenteditable:s.value&&t.element.type==c.unref(G).Text&&a.value&&!t.element.rule.isReadOnly&&!t.element.rule.allowWrap,onClick:_[0]||(_[0]=c.withModifiers(()=>C(t.element),["stop"])),onMouseenter:_[1]||(_[1]=()=>v(t.element)),onMouseleave:b,onBlur:x,onInput:m,onPaste:R,onKeydown:c.withModifiers(O,["stop"]),ref_key:"elementRef",ref:JA,innerHTML:n.value}),null,16,["class","style","contenteditable","innerHTML"])):(c.openBlock(),c.createBlock(c.resolveDynamicComponent(t.element.tag),c.mergeProps({key:1,class:["relative",A.mode==="design"?" border-dashed border-2":"",A.showMargin?"p-1 m-1":"",i.value?"border-dashed border-blue-500":"",a.value?"border-dashed border-green-500 z-5 border-2":"",u.value?"border-dashed border-red-500":"",(!i.value&&!a.value&&!u.value,""),t.element.rule&&t.element.rule.isReadOnly?"cursor-not-allowed":"",t.element.type===c.unref(G).Icon?"icon-upload-box":"",WA.value],style:PA.value},t.element.attrs,{contenteditable:!1,onClick:_[5]||(_[5]=c.withModifiers(()=>C(t.element),["stop"])),onMouseenter:_[6]||(_[6]=()=>v(t.element)),onMouseleave:b,onBlur:x,onInput:m,onPaste:R,onKeydown:c.withModifiers(O,["stop"]),ref_key:"elementRef",ref:JA}),{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(n.value)+" ",1),t.element.children&&t.element.children.length?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(t.element.children,(J,wA)=>(c.openBlock(),c.createBlock(gA,{"show-margin":A.showMargin,key:wA,r:A.r,mode:A.mode,icons:A.icons,element:J,selectedElement:t.selectedElement,hoveredElement:t.hoveredElement,cropper:A.cropper,icon:A.icon,upload:A.upload,"upload-by-file":A.uploadByFile,onSelectElement:E,onHoverElement:T,onUpdateText:V,onBlockAction:rA,onAddIcon:TA,onUpdateElementRule:()=>YA(J)},null,8,["show-margin","r","mode","icons","element","selectedElement","hoveredElement","cropper","icon","upload","upload-by-file","onUpdateElementRule"]))),128)),t.element.type===c.unref(G).Block?(c.openBlock(),c.createElementBlock("div",{key:0,"date-action":"1",contenteditable:"false",onClick:_[2]||(_[2]=c.withModifiers(()=>{},["stop"])),class:"hover:z-10 z-9 flex space-x-1 flex-none flex-nowrap overflow-visible absolute left-2 top-2 text-sm"},[c.createElementVNode("button",{class:"flex-none content-center items-center p-1 bg-green-500/80 text-white rounded hover:bg-green-500",onClick:c.withModifiers(k,["stop"])},_[9]||(_[9]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("rect",{width:"336",height:"336",x:"128",y:"128",fill:"none",stroke:"white","stroke-linejoin":"round","stroke-width":"32",rx:"57",ry:"57"}),c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m383.5 128l.5-24a56.16 56.16 0 0 0-56-56H112a64.19 64.19 0 0 0-64 64v216a56.16 56.16 0 0 0 56 56h24"})],-1)])),c.createElementVNode("button",{class:"flex-none content-center items-center p-1 bg-blue-500/80 text-white rounded hover:bg-blue-500",onClick:c.withModifiers(z,["stop"])},_[10]||(_[10]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M244 400L100 256l144-144M120 256h292"})],-1)])),c.createElementVNode("button",{class:"flex-none content-center items-center p-1 bg-blue-500/80 text-white rounded hover:bg-blue-500",onClick:c.withModifiers(cA,["stop"])},_[11]||(_[11]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"m268 112l144 144l-144 144m124-144H100"})],-1)])),c.createElementVNode("button",{class:"flex-none content-center items-center p-1 bg-red-500/80 text-white rounded hover:bg-red-500",onClick:c.withModifiers(W,["stop"])},_[12]||(_[12]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M400 256H112"})],-1)]))])):c.createCommentVNode("",!0),t.element.children&&t.element.children.length&&t.element.children[0].type===c.unref(G).Block&&t.element.children[0].rule&&t.element.children[0].rule.flexColumns&&t.element.children[0].rule.flexColumns.length>0&&!t.element.children[0].rule.flexColumns.includes(-1)?(c.openBlock(),c.createElementBlock("div",{key:1,"date-action":"1",contenteditable:"false",onClick:_[3]||(_[3]=c.withModifiers(()=>{},["stop"])),class:"hover:z-10 z-9 flex space-x-1 flex-none flex-nowrap overflow-visible absolute right-0 -top-6 items-center"},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(t.element.children[0].rule.flexColumns,(J,wA)=>(c.openBlock(),c.createElementBlock("button",{class:c.normalizeClass(["text-xs w-6 h-6 flex-none content-center items-center justify-center bg-purple-400/80 text-white rounded hover:bg-purple-600",t.element.children[0].rule.flexColumn===J?"bg-purple-700":""]),onClick:c.withModifiers(()=>ie(J,t.element),["stop"])},c.toDisplayString(J),11,_p))),256))])):c.createCommentVNode("",!0)],64)):c.createCommentVNode("",!0),t.element.type===c.unref(G).Icon?(c.openBlock(),c.createElementBlock("div",{key:1,class:"icon-upload cursor-pointer rounded-sm w-5 h-5 justify-center items-center absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-sm text-gray-50 z-10 bg-black/80 hover:bg-black",contenteditable:"false",onClick:_[4]||(_[4]=c.withModifiers(()=>fA(t.element),["stop"]))},_[13]||(_[13]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 367.79h76c55 0 100-29.21 100-83.6s-53-81.47-96-83.6c-8.89-85.06-71-136.8-144-136.8c-69 0-113.44 45.79-128 91.2c-60 5.7-112 43.88-112 106.4s54 106.4 120 106.4h56"}),c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m320 255.79l-64-64l-64 64m64 192.42V207.79"})],-1)]))):c.createCommentVNode("",!0)]),_:1},16,["class","style"])),t.element.type==c.unref(G).Text&&u.value?(c.openBlock(),c.createElementBlock("div",Np,c.toDisplayString(l.value),1)):c.createCommentVNode("",!0),t.element.type===c.unref(G).Image?(c.openBlock(),c.createElementBlock("div",{key:3,class:"cursor-pointer rounded-sm flex justify-center items-center absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-sm text-gray-50 z-10 bg-black/80 hover:bg-black",onClick:_[8]||(_[8]=c.withModifiers(()=>{},["stop"])),contenteditable:"false"},[c.createElementVNode("div",{class:"p-1",onClick:_[7]||(_[7]=c.withModifiers(()=>BA(t.element),["stop"]))},_[14]||(_[14]=[c.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 512 512"},[c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 367.79h76c55 0 100-29.21 100-83.6s-53-81.47-96-83.6c-8.89-85.06-71-136.8-144-136.8c-69 0-113.44 45.79-128 91.2c-60 5.7-112 43.88-112 106.4s54 106.4 120 106.4h56"}),c.createElementVNode("path",{fill:"none",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m320 255.79l-64-64l-64 64m64 192.42V207.79"})],-1)]))])):c.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-0d982615"]]),Lp=c.defineComponent({name:"GpCheckbox",props:{modelValue:{type:Boolean,required:!0},label:{type:String,default:""}},emits:["update:modelValue"],setup(A,{emit:e}){return{updateValue:r=>{e("update:modelValue",r.target.checked)}}}}),Hp={class:"form-group"},Dp={class:"flex items-center space-x-2 cursor-pointer"},Op=["checked","aria-checked"],Rp={class:"checkbox-label text-sm text-gray-700"};function Mp(A,e,t,r,n,a){return c.openBlock(),c.createElementBlock("div",Hp,[c.createElementVNode("label",Dp,[c.createElementVNode("input",{type:"checkbox",checked:A.modelValue,onChange:e[0]||(e[0]=(...i)=>A.updateValue&&A.updateValue(...i)),class:"custom-checkbox","aria-checked":A.modelValue},null,40,Op),c.createElementVNode("span",Rp,c.toDisplayString(A.label),1)])])}const lt=Ge(Lp,[["render",Mp],["__scopeId","data-v-68b8f276"]]),kp={class:"text-sm"},Pp={key:0},Kp={key:0},Vp={class:"text-gray-500 my-2 truncate"},Gp={class:"text-gray-500 my-2 break-words"},Yp={key:1},Xp={key:2},Wp={key:3},Jp={key:4},qp={key:5},jp={key:6},zp={key:7},$p={key:8},Zp={key:9},Am={key:10},em={key:11},tm={key:12},rm={key:13},nm={key:14},am=Ge(c.defineComponent({__name:"EditorPanel",props:{element:Object},emits:["updateElement"],setup(A,{emit:e}){const t=A,r=e,n=c.ref({rule:{},...t.element});c.watch(()=>t.element,i=>{n.value={rule:{},...i}},{immediate:!0});function a(){var i;if(n.value.type===G.Icon&&!n.value.attrs.class.includes("iconfont")){j.error("图标仅支持 iconfont 图标");return}if(n.value.type===G.Image&&n.value.tag!=="img"){j.error("节点类型错误");return}if(n.value.type===G.Video&&n.value.tag!=="video"){j.error("节点类型错误");return}if(n.value.type===G.Link&&n.value.tag!=="a"){j.error("节点类型错误");return}if(n.value.type===G.Text){if(n.value.rule.maxText&&Number(n.value.rule.minText)>Number(n.value.rule.maxText)){j.error("最小文本长度不能大于最大文本长度");return}if(n.value.tag!=="p"&&n.value.tag!=="div"&&n.value.tag!=="span"&&n.value.tag!=="h1"&&n.value.tag!=="h2"&&n.value.tag!=="h3"&&n.value.tag!=="h4"&&n.value.tag!=="h5"&&n.value.tag!=="h6"&&n.value.tag!=="label"&&n.value.tag!=="strong"&&n.value.tag!=="em"&&n.value.tag!=="b"&&n.value.tag!=="i"&&n.value.tag!=="ul"&&n.value.tag!=="ol"&&n.value.tag!=="li"&&n.value.tag!=="dl"&&n.value.tag!=="dt"&&n.value.tag!=="dd"){j.error("节点类型错误");return}}if(n.value.type===G.Block){if(n.value.rule.maxBlock&&Number(n.value.rule.minBlock)>Number(n.value.rule.maxBlock)){j.error("最小块数量不能大于最大块数量");return}if(n.value.tag!=="div"&&n.value.tag!=="section"&&n.value.tag!=="article"&&n.value.tag!=="nav"&&n.value.tag!=="header"&&n.value.tag!=="footer"&&n.value.tag!=="span"&&n.value.tag!=="p"&&n.value.tag!=="img"){j.error("节点类型错误");return}if(!n.value.children||n.value.children.length<1){j.error("节点错误,必须包含子元素");return}((i=n.value.rule.flexColumns)==null?void 0:i.length)>0&&!n.value.rule.flexColumns.includes(-1)?n.value.rule.flexColumn=n.value.rule.flexColumns[0]:n.value.rule.flexColumn=void 0}n.value.rule.minText?n.value.rule.minText=Number(n.value.rule.minText):n.value.rule.minText=void 0,n.value.rule.maxText?n.value.rule.maxText=Number(n.value.rule.maxText):n.value.rule.maxText=void 0,n.value.rule.minBlock?n.value.rule.minBlock=Number(n.value.rule.minBlock):n.value.rule.minBlock=void 0,n.value.rule.maxBlock?n.value.rule.maxBlock=Number(n.value.rule.maxBlock):n.value.rule.maxBlock=void 0,n.value.rule.flexColumn?n.value.rule.flexColumn=Number(n.value.rule.flexColumn):n.value.rule.flexColumn=void 0,n.value.rule.mobileFlexColumn?n.value.rule.mobileFlexColumn=Number(n.value.rule.mobileFlexColumn):n.value.rule.mobileFlexColumn=void 0,r("updateElement",n.value)}return(i,s)=>(c.openBlock(),c.createElementBlock("div",kp,[n.value?(c.openBlock(),c.createElementBlock("div",Pp,[n.value.text!==void 0?(c.openBlock(),c.createElementBlock("div",Kp,[s[17]||(s[17]=c.createElementVNode("label",{class:"block"},"内容",-1)),c.createElementVNode("div",Vp,c.toDisplayString(n.value.text||"-"),1)])):c.createCommentVNode("",!0),c.createElementVNode("div",null,[s[18]||(s[18]=c.createElementVNode("label",{class:"block mt-4"},"节点",-1)),c.createElementVNode("div",Gp,c.toDisplayString(n.value.xpath),1)]),c.createElementVNode("div",null,[s[20]||(s[20]=c.createElementVNode("label",{class:"block mt-4"},"类型",-1)),c.withDirectives(c.createElementVNode("select",{"onUpdate:modelValue":s[0]||(s[0]=u=>n.value.type=u),class:"border rounded p-1 w-full"},s[19]||(s[19]=[c.createElementVNode("option",{value:0},"无",-1),c.createElementVNode("option",{value:1},"文本",-1),c.createElementVNode("option",{value:2},"图片",-1),c.createElementVNode("option",{value:3},"视频",-1),c.createElementVNode("option",{value:4},"图标",-1),c.createElementVNode("option",{value:5},"链接",-1),c.createElementVNode("option",{value:6},"按钮",-1),c.createElementVNode("option",{value:10},"块",-1)]),512),[[c.vModelSelect,n.value.type]])]),n.value.type==c.unref(G).Text?(c.openBlock(),c.createElementBlock("div",Yp,[s[21]||(s[21]=c.createElementVNode("label",{class:"block mt-4"},"最小文本长度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":s[1]||(s[1]=u=>n.value.rule.minText=u),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.minText]])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Text?(c.openBlock(),c.createElementBlock("div",Xp,[s[22]||(s[22]=c.createElementVNode("label",{class:"block mt-4"},"最大文本长度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":s[2]||(s[2]=u=>n.value.rule.maxText=u),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.maxText]])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Image?(c.openBlock(),c.createElementBlock("div",Wp,[s[23]||(s[23]=c.createElementVNode("label",{class:"block mt-4"},"是否裁剪",-1)),c.createVNode(lt,{class:"py-2",modelValue:n.value.rule.crop,"onUpdate:modelValue":s[3]||(s[3]=u=>n.value.rule.crop=u),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Image?(c.openBlock(),c.createElementBlock("div",Jp,[s[24]||(s[24]=c.createElementVNode("label",{class:"block mt-4"},"图片宽度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":s[4]||(s[4]=u=>n.value.rule.minImageWidth=u),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.minImageWidth]])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Image?(c.openBlock(),c.createElementBlock("div",qp,[s[25]||(s[25]=c.createElementVNode("label",{class:"block mt-4"},"图片高度",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":s[5]||(s[5]=u=>n.value.rule.maxImageHeight=u),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.maxImageHeight]])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Block?(c.openBlock(),c.createElementBlock("div",jp,[s[26]||(s[26]=c.createElementVNode("label",{class:"block mt-4"},"块最小数量",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":s[6]||(s[6]=u=>n.value.rule.minBlock=u),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.minBlock]])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Block?(c.openBlock(),c.createElementBlock("div",zp,[s[27]||(s[27]=c.createElementVNode("label",{class:"block mt-4"},"块最大数量",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":s[7]||(s[7]=u=>n.value.rule.maxBlock=u),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.maxBlock]])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Block?(c.openBlock(),c.createElementBlock("div",$p,[s[29]||(s[29]=c.createElementVNode("label",{class:"block mt-4"},"PC端每行列数",-1)),c.withDirectives(c.createElementVNode("select",{multiple:"","onUpdate:modelValue":s[8]||(s[8]=u=>n.value.rule.flexColumns=u),class:"border rounded p-1 w-full h-32"},s[28]||(s[28]=[c.createElementVNode("option",{value:-1},"未配置",-1),c.createElementVNode("option",{value:1},"1",-1),c.createElementVNode("option",{value:2},"2",-1),c.createElementVNode("option",{value:3},"3",-1),c.createElementVNode("option",{value:4},"4",-1),c.createElementVNode("option",{value:5},"5",-1),c.createElementVNode("option",{value:6},"6",-1),c.createElementVNode("option",{value:7},"7",-1),c.createElementVNode("option",{value:8},"8",-1),c.createElementVNode("option",{value:9},"9",-1),c.createElementVNode("option",{value:10},"10",-1),c.createElementVNode("option",{value:11},"11",-1),c.createElementVNode("option",{value:12},"12",-1)]),512),[[c.vModelSelect,n.value.rule.flexColumns]])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Block?(c.openBlock(),c.createElementBlock("div",Zp,[s[31]||(s[31]=c.createElementVNode("label",{class:"block mt-4"},"移动端每行列数",-1)),c.withDirectives(c.createElementVNode("select",{"onUpdate:modelValue":s[9]||(s[9]=u=>n.value.rule.mobileFlexColumn=u),class:"border rounded p-1 w-full"},s[30]||(s[30]=[c.createElementVNode("option",{value:-1},"未配置",-1),c.createElementVNode("option",{value:void 0},"轮播",-1),c.createElementVNode("option",{value:1},"1",-1),c.createElementVNode("option",{value:2},"2",-1),c.createElementVNode("option",{value:3},"3",-1),c.createElementVNode("option",{value:4},"4",-1),c.createElementVNode("option",{value:5},"5",-1),c.createElementVNode("option",{value:6},"6",-1)]),512),[[c.vModelSelect,n.value.rule.mobileFlexColumn]])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Text||n.value.type==c.unref(G).Icon||n.value.type==c.unref(G).Button?(c.openBlock(),c.createElementBlock("div",Am,[s[32]||(s[32]=c.createElementVNode("label",{class:"block mt-4"},"主题色",-1)),c.createVNode(lt,{class:"py-2",modelValue:n.value.rule.isThemeColor,"onUpdate:modelValue":s[10]||(s[10]=u=>n.value.rule.isThemeColor=u),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),c.createElementVNode("div",null,[s[33]||(s[33]=c.createElementVNode("label",{class:"block mt-4"},"是否必填",-1)),c.createVNode(lt,{class:"py-2",modelValue:n.value.rule.isRequired,"onUpdate:modelValue":s[11]||(s[11]=u=>n.value.rule.isRequired=u),label:"是"},null,8,["modelValue"])]),c.createElementVNode("div",null,[s[34]||(s[34]=c.createElementVNode("label",{class:"block mt-4"},"是否只读",-1)),c.createVNode(lt,{class:"py-2",modelValue:n.value.rule.isReadOnly,"onUpdate:modelValue":s[12]||(s[12]=u=>n.value.rule.isReadOnly=u),label:"是"},null,8,["modelValue"])]),n.value.type==c.unref(G).Link||n.value.type==c.unref(G).Button?(c.openBlock(),c.createElementBlock("div",em,[s[35]||(s[35]=c.createElementVNode("label",{class:"block mt-4"},"打开美洽",-1)),c.createVNode(lt,{class:"py-2",modelValue:n.value.rule.openMeiqia,"onUpdate:modelValue":s[13]||(s[13]=u=>n.value.rule.openMeiqia=u),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Link||n.value.type==c.unref(G).Button?(c.openBlock(),c.createElementBlock("div",tm,[s[36]||(s[36]=c.createElementVNode("label",{class:"block mt-4"},"链接",-1)),c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":s[14]||(s[14]=u=>n.value.rule.linkUrl=u),class:"border rounded p-1 w-full"},null,512),[[c.vModelText,n.value.rule.linkUrl]])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Text?(c.openBlock(),c.createElementBlock("div",rm,[s[37]||(s[37]=c.createElementVNode("label",{class:"block mt-4"},"允许换行(回车/粘贴多段文本等)",-1)),c.createVNode(lt,{class:"py-2",modelValue:n.value.rule.allowWrap,"onUpdate:modelValue":s[15]||(s[15]=u=>n.value.rule.allowWrap=u),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0),n.value.type==c.unref(G).Image?(c.openBlock(),c.createElementBlock("div",nm,[s[38]||(s[38]=c.createElementVNode("label",{class:"block mt-4"},"预览(点击查看大图)",-1)),c.createVNode(lt,{class:"py-2",modelValue:n.value.rule.preview,"onUpdate:modelValue":s[16]||(s[16]=u=>n.value.rule.preview=u),label:"是"},null,8,["modelValue"])])):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0),c.createElementVNode("button",{onClick:a,class:"mt-4 p-2 bg-green-500 text-white rounded"}," 保存 ")]))}}),[["__scopeId","data-v-c53c9169"]]);/*!
|
10
10
|
* Cropper.js v1.6.2
|
11
11
|
* https://fengyuanchen.github.io/cropperjs
|
12
12
|
*
|
@@ -36,7 +36,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
36
36
|
content: "" !important;
|
37
37
|
display: none !important;
|
38
38
|
}`,CT=function(A){wT(A,"."+Cs+mT+Wl+`
|
39
|
-
.`+ws+ET+Wl)},wT=function(A,e){var t=A.ownerDocument;if(t){var r=t.createElement("style");r.textContent=e,A.appendChild(r)}},Jl=function(){function A(){}return A.getOrigin=function(e){var t=A._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},A.isSameOrigin=function(e){return A.getOrigin(e)===A._origin},A.setContext=function(e){A._link=e.document.createElement("a"),A._origin=A.getOrigin(e.location.href)},A._origin="about:blank",A}(),bT=function(){function A(e,t){this.context=e,this._options=t,this._cache={}}return A.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)||(Ts(e)||FT(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},A.prototype.match=function(e){return this._cache[e]},A.prototype.loadImage=function(e){return $A(this,void 0,void 0,function(){var t,r,n,a,i=this;return VA(this,function(s){switch(s.label){case 0:return t=Jl.isSameOrigin(e),r=!bs(e)&&this._options.useCORS===!0&&kA.SUPPORT_CORS_IMAGES&&!t,n=!bs(e)&&!t&&!Ts(e)&&typeof this._options.proxy=="string"&&kA.SUPPORT_CORS_XHR&&!r,!t&&this._options.allowTaint===!1&&!bs(e)&&!Ts(e)&&!n&&!r?[2]:(a=e,n?[4,this.proxy(a)]:[3,2]);case 1:a=s.sent(),s.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(u,l){var d=new Image;d.onload=function(){return u(d)},d.onerror=l,(IT(a)||r)&&(d.crossOrigin="anonymous"),d.src=a,d.complete===!0&&setTimeout(function(){return u(d)},500),i._options.imageTimeout>0&&setTimeout(function(){return l("Timed out ("+i._options.imageTimeout+"ms) loading image")},i._options.imageTimeout)})];case 3:return[2,s.sent()]}})})},A.prototype.has=function(e){return typeof this._cache[e]<"u"},A.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},A.prototype.proxy=function(e){var t=this,r=this._options.proxy;if(!r)throw new Error("No proxy defined");var n=e.substring(0,256);return new Promise(function(a,i){var s=kA.SUPPORT_RESPONSE_TYPE?"blob":"text",u=new XMLHttpRequest;u.onload=function(){if(u.status===200)if(s==="text")a(u.response);else{var f=new FileReader;f.addEventListener("load",function(){return a(f.result)},!1),f.addEventListener("error",function(h){return i(h)},!1),f.readAsDataURL(u.response)}else i("Failed to proxy resource "+n+" with status code "+u.status)},u.onerror=i;var l=r.indexOf("?")>-1?"&":"?";if(u.open("GET",""+r+l+"url="+encodeURIComponent(e)+"&responseType="+s),s!=="text"&&u instanceof XMLHttpRequest&&(u.responseType=s),t._options.imageTimeout){var d=t._options.imageTimeout;u.timeout=d,u.ontimeout=function(){return i("Timed out ("+d+"ms) proxying "+n)}}u.send()})},A}(),TT=/^data:image\/svg\+xml/i,UT=/^data:image\/.*;base64,/i,QT=/^data:image\/.*/i,FT=function(A){return kA.SUPPORT_SVG_DRAWING||!yT(A)},bs=function(A){return QT.test(A)},IT=function(A){return UT.test(A)},Ts=function(A){return A.substr(0,4)==="blob"},yT=function(A){return A.substr(-3).toLowerCase()==="svg"||TT.test(A)},M=function(){function A(e,t){this.type=0,this.x=e,this.y=t}return A.prototype.add=function(e,t){return new A(this.x+e,this.y+t)},A}(),Vt=function(A,e,t){return new M(A.x+(e.x-A.x)*t,A.y+(e.y-A.y)*t)},oa=function(){function A(e,t,r,n){this.type=1,this.start=e,this.startControl=t,this.endControl=r,this.end=n}return A.prototype.subdivide=function(e,t){var r=Vt(this.start,this.startControl,e),n=Vt(this.startControl,this.endControl,e),a=Vt(this.endControl,this.end,e),i=Vt(r,n,e),s=Vt(n,a,e),u=Vt(i,s,e);return t?new A(this.start,r,i,u):new A(u,s,a,this.end)},A.prototype.add=function(e,t){return new A(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A}(),Be=function(A){return A.type===1},xT=function(){function A(e){var t=e.styles,r=e.bounds,n=Lr(t.borderTopLeftRadius,r.width,r.height),a=n[0],i=n[1],s=Lr(t.borderTopRightRadius,r.width,r.height),u=s[0],l=s[1],d=Lr(t.borderBottomRightRadius,r.width,r.height),f=d[0],h=d[1],C=Lr(t.borderBottomLeftRadius,r.width,r.height),E=C[0],T=C[1],v=[];v.push((a+u)/r.width),v.push((E+f)/r.width),v.push((i+T)/r.height),v.push((l+h)/r.height);var b=Math.max.apply(Math,v);b>1&&(a/=b,i/=b,u/=b,l/=b,f/=b,h/=b,E/=b,T/=b);var x=r.width-u,D=r.height-h,R=r.width-f,O=r.height-T,m=t.borderTopWidth,L=t.borderRightWidth,V=t.borderBottomWidth,k=t.borderLeftWidth,z=hA(t.paddingTop,e.bounds.width),aA=hA(t.paddingRight,e.bounds.width),cA=hA(t.paddingBottom,e.bounds.width),W=hA(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=a>0||i>0?CA(r.left+k/3,r.top+m/3,a-k/3,i-m/3,sA.TOP_LEFT):new M(r.left+k/3,r.top+m/3),this.topRightBorderDoubleOuterBox=a>0||i>0?CA(r.left+x,r.top+m/3,u-L/3,l-m/3,sA.TOP_RIGHT):new M(r.left+r.width-L/3,r.top+m/3),this.bottomRightBorderDoubleOuterBox=f>0||h>0?CA(r.left+R,r.top+D,f-L/3,h-V/3,sA.BOTTOM_RIGHT):new M(r.left+r.width-L/3,r.top+r.height-V/3),this.bottomLeftBorderDoubleOuterBox=E>0||T>0?CA(r.left+k/3,r.top+O,E-k/3,T-V/3,sA.BOTTOM_LEFT):new M(r.left+k/3,r.top+r.height-V/3),this.topLeftBorderDoubleInnerBox=a>0||i>0?CA(r.left+k*2/3,r.top+m*2/3,a-k*2/3,i-m*2/3,sA.TOP_LEFT):new M(r.left+k*2/3,r.top+m*2/3),this.topRightBorderDoubleInnerBox=a>0||i>0?CA(r.left+x,r.top+m*2/3,u-L*2/3,l-m*2/3,sA.TOP_RIGHT):new M(r.left+r.width-L*2/3,r.top+m*2/3),this.bottomRightBorderDoubleInnerBox=f>0||h>0?CA(r.left+R,r.top+D,f-L*2/3,h-V*2/3,sA.BOTTOM_RIGHT):new M(r.left+r.width-L*2/3,r.top+r.height-V*2/3),this.bottomLeftBorderDoubleInnerBox=E>0||T>0?CA(r.left+k*2/3,r.top+O,E-k*2/3,T-V*2/3,sA.BOTTOM_LEFT):new M(r.left+k*2/3,r.top+r.height-V*2/3),this.topLeftBorderStroke=a>0||i>0?CA(r.left+k/2,r.top+m/2,a-k/2,i-m/2,sA.TOP_LEFT):new M(r.left+k/2,r.top+m/2),this.topRightBorderStroke=a>0||i>0?CA(r.left+x,r.top+m/2,u-L/2,l-m/2,sA.TOP_RIGHT):new M(r.left+r.width-L/2,r.top+m/2),this.bottomRightBorderStroke=f>0||h>0?CA(r.left+R,r.top+D,f-L/2,h-V/2,sA.BOTTOM_RIGHT):new M(r.left+r.width-L/2,r.top+r.height-V/2),this.bottomLeftBorderStroke=E>0||T>0?CA(r.left+k/2,r.top+O,E-k/2,T-V/2,sA.BOTTOM_LEFT):new M(r.left+k/2,r.top+r.height-V/2),this.topLeftBorderBox=a>0||i>0?CA(r.left,r.top,a,i,sA.TOP_LEFT):new M(r.left,r.top),this.topRightBorderBox=u>0||l>0?CA(r.left+x,r.top,u,l,sA.TOP_RIGHT):new M(r.left+r.width,r.top),this.bottomRightBorderBox=f>0||h>0?CA(r.left+R,r.top+D,f,h,sA.BOTTOM_RIGHT):new M(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=E>0||T>0?CA(r.left,r.top+O,E,T,sA.BOTTOM_LEFT):new M(r.left,r.top+r.height),this.topLeftPaddingBox=a>0||i>0?CA(r.left+k,r.top+m,Math.max(0,a-k),Math.max(0,i-m),sA.TOP_LEFT):new M(r.left+k,r.top+m),this.topRightPaddingBox=u>0||l>0?CA(r.left+Math.min(x,r.width-L),r.top+m,x>r.width+L?0:Math.max(0,u-L),Math.max(0,l-m),sA.TOP_RIGHT):new M(r.left+r.width-L,r.top+m),this.bottomRightPaddingBox=f>0||h>0?CA(r.left+Math.min(R,r.width-k),r.top+Math.min(D,r.height-V),Math.max(0,f-L),Math.max(0,h-V),sA.BOTTOM_RIGHT):new M(r.left+r.width-L,r.top+r.height-V),this.bottomLeftPaddingBox=E>0||T>0?CA(r.left+k,r.top+Math.min(O,r.height-V),Math.max(0,E-k),Math.max(0,T-V),sA.BOTTOM_LEFT):new M(r.left+k,r.top+r.height-V),this.topLeftContentBox=a>0||i>0?CA(r.left+k+W,r.top+m+z,Math.max(0,a-(k+W)),Math.max(0,i-(m+z)),sA.TOP_LEFT):new M(r.left+k+W,r.top+m+z),this.topRightContentBox=u>0||l>0?CA(r.left+Math.min(x,r.width+k+W),r.top+m+z,x>r.width+k+W?0:u-k+W,l-(m+z),sA.TOP_RIGHT):new M(r.left+r.width-(L+aA),r.top+m+z),this.bottomRightContentBox=f>0||h>0?CA(r.left+Math.min(R,r.width-(k+W)),r.top+Math.min(D,r.height+m+z),Math.max(0,f-(L+aA)),h-(V+cA),sA.BOTTOM_RIGHT):new M(r.left+r.width-(L+aA),r.top+r.height-(V+cA)),this.bottomLeftContentBox=E>0||T>0?CA(r.left+k+W,r.top+O,Math.max(0,E-(k+W)),T-(V+cA),sA.BOTTOM_LEFT):new M(r.left+k+W,r.top+r.height-(V+cA))}return A}(),sA;(function(A){A[A.TOP_LEFT=0]="TOP_LEFT",A[A.TOP_RIGHT=1]="TOP_RIGHT",A[A.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",A[A.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(sA||(sA={}));var CA=function(A,e,t,r,n){var a=4*((Math.sqrt(2)-1)/3),i=t*a,s=r*a,u=A+t,l=e+r;switch(n){case sA.TOP_LEFT:return new oa(new M(A,l),new M(A,l-s),new M(u-i,e),new M(u,e));case sA.TOP_RIGHT:return new oa(new M(A,e),new M(A+i,e),new M(u,l-s),new M(u,l));case sA.BOTTOM_RIGHT:return new oa(new M(u,e),new M(u,e+s),new M(A+i,l),new M(A,l));case sA.BOTTOM_LEFT:default:return new oa(new M(u,l),new M(u-i,l),new M(A,e+s),new M(A,e))}},ua=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},vT=function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]},ca=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},_T=function(){function A(e,t,r){this.offsetX=e,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return A}(),la=function(){function A(e,t){this.path=e,this.target=t,this.type=1}return A}(),NT=function(){function A(e){this.opacity=e,this.type=2,this.target=6}return A}(),ST=function(A){return A.type===0},ql=function(A){return A.type===1},LT=function(A){return A.type===2},jl=function(A,e){return A.length===e.length?A.some(function(t,r){return t===e[r]}):!1},HT=function(A,e,t,r,n){return A.map(function(a,i){switch(i){case 0:return a.add(e,t);case 1:return a.add(e+r,t);case 2:return a.add(e+r,t+n);case 3:return a.add(e,t+n)}return a})},zl=function(){function A(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return A}(),$l=function(){function A(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new xT(this.container),this.container.styles.opacity<1&&this.effects.push(new NT(this.container.styles.opacity)),this.container.styles.transform!==null){var r=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,a=this.container.styles.transform;this.effects.push(new _T(r,n,a))}if(this.container.styles.overflowX!==0){var i=ua(this.curves),s=ca(this.curves);jl(i,s)?this.effects.push(new la(i,6)):(this.effects.push(new la(i,2)),this.effects.push(new la(s,4)))}}return A.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,r=this.parent,n=this.effects.slice(0);r;){var a=r.effects.filter(function(u){return!ql(u)});if(t||r.container.styles.position!==0||!r.parent){if(n.unshift.apply(n,a),t=[2,3].indexOf(r.container.styles.position)===-1,r.container.styles.overflowX!==0){var i=ua(r.curves),s=ca(r.curves);jl(i,s)||n.unshift(new la(s,6))}}else n.unshift.apply(n,a);r=r.parent}return n.filter(function(u){return vA(u.target,e)})},A}(),Us=function(A,e,t,r){A.container.elements.forEach(function(n){var a=vA(n.flags,4),i=vA(n.flags,2),s=new $l(n,A);vA(n.styles.display,2048)&&r.push(s);var u=vA(n.flags,8)?[]:r;if(a||i){var l=a||n.styles.isPositioned()?t:e,d=new zl(s);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var f=n.styles.zIndex.order;if(f<0){var h=0;l.negativeZIndex.some(function(E,T){return f>E.element.container.styles.zIndex.order?(h=T,!1):h>0}),l.negativeZIndex.splice(h,0,d)}else if(f>0){var C=0;l.positiveZIndex.some(function(E,T){return f>=E.element.container.styles.zIndex.order?(C=T+1,!1):C>0}),l.positiveZIndex.splice(C,0,d)}else l.zeroOrAutoZIndexOrTransformedOrOpacity.push(d)}else n.styles.isFloating()?l.nonPositionedFloats.push(d):l.nonPositionedInlineLevel.push(d);Us(s,d,a?d:t,u)}else n.styles.isInlineLevel()?e.inlineLevel.push(s):e.nonInlineLevel.push(s),Us(s,e,t,u);vA(n.flags,8)&&Zl(n,u)})},Zl=function(A,e){for(var t=A instanceof fs?A.start:1,r=A instanceof fs?A.reversed:!1,n=0;n<e.length;n++){var a=e[n];a.container instanceof Ul&&typeof a.container.value=="number"&&a.container.value!==0&&(t=a.container.value),a.listValue=kr(t,a.container.styles.listStyleType,!0),t+=r?-1:1}},DT=function(A){var e=new $l(A,null),t=new zl(e),r=[];return Us(e,t,t,r),Zl(e.container,r),t},A0=function(A,e){switch(e){case 0:return ge(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return ge(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return ge(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);case 3:default:return ge(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}},OT=function(A,e){switch(e){case 0:return ge(A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox,A.topRightBorderBox,A.topRightBorderDoubleOuterBox);case 1:return ge(A.topRightBorderBox,A.topRightBorderDoubleOuterBox,A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox);case 2:return ge(A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox,A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox);case 3:default:return ge(A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox,A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox)}},RT=function(A,e){switch(e){case 0:return ge(A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox,A.topRightBorderDoubleInnerBox,A.topRightPaddingBox);case 1:return ge(A.topRightBorderDoubleInnerBox,A.topRightPaddingBox,A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox);case 2:return ge(A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox,A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox);case 3:default:return ge(A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox,A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox)}},MT=function(A,e){switch(e){case 0:return da(A.topLeftBorderStroke,A.topRightBorderStroke);case 1:return da(A.topRightBorderStroke,A.bottomRightBorderStroke);case 2:return da(A.bottomRightBorderStroke,A.bottomLeftBorderStroke);case 3:default:return da(A.bottomLeftBorderStroke,A.topLeftBorderStroke)}},da=function(A,e){var t=[];return Be(A)?t.push(A.subdivide(.5,!1)):t.push(A),Be(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},ge=function(A,e,t,r){var n=[];return Be(A)?n.push(A.subdivide(.5,!1)):n.push(A),Be(t)?n.push(t.subdivide(.5,!0)):n.push(t),Be(r)?n.push(r.subdivide(.5,!0).reverse()):n.push(r),Be(e)?n.push(e.subdivide(.5,!1).reverse()):n.push(e),n},e0=function(A){var e=A.bounds,t=A.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},fa=function(A){var e=A.styles,t=A.bounds,r=hA(e.paddingLeft,t.width),n=hA(e.paddingRight,t.width),a=hA(e.paddingTop,t.width),i=hA(e.paddingBottom,t.width);return t.add(r+e.borderLeftWidth,a+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+r+n),-(e.borderTopWidth+e.borderBottomWidth+a+i))},kT=function(A,e){return A===0?e.bounds:A===2?fa(e):e0(e)},PT=function(A,e){return A===0?e.bounds:A===2?fa(e):e0(e)},Qs=function(A,e,t){var r=kT(Yt(A.styles.backgroundOrigin,e),A),n=PT(Yt(A.styles.backgroundClip,e),A),a=KT(Yt(A.styles.backgroundSize,e),t,r),i=a[0],s=a[1],u=Lr(Yt(A.styles.backgroundPosition,e),r.width-i,r.height-s),l=VT(Yt(A.styles.backgroundRepeat,e),u,a,r,n),d=Math.round(r.left+u[0]),f=Math.round(r.top+u[1]);return[l,d,f,i,s]},Gt=function(A){return uA(A)&&A.value===Mt.AUTO},ha=function(A){return typeof A=="number"},KT=function(A,e,t){var r=e[0],n=e[1],a=e[2],i=A[0],s=A[1];if(!i)return[0,0];if(IA(i)&&s&&IA(s))return[hA(i,t.width),hA(s,t.height)];var u=ha(a);if(uA(i)&&(i.value===Mt.CONTAIN||i.value===Mt.COVER)){if(ha(a)){var l=t.width/t.height;return l<a!=(i.value===Mt.COVER)?[t.width,t.width/a]:[t.height*a,t.height]}return[t.width,t.height]}var d=ha(r),f=ha(n),h=d||f;if(Gt(i)&&(!s||Gt(s))){if(d&&f)return[r,n];if(!u&&!h)return[t.width,t.height];if(h&&u){var C=d?r:n*a,E=f?n:r/a;return[C,E]}var T=d?r:t.width,v=f?n:t.height;return[T,v]}if(u){var b=0,x=0;return IA(i)?b=hA(i,t.width):IA(s)&&(x=hA(s,t.height)),Gt(i)?b=x*a:(!s||Gt(s))&&(x=b/a),[b,x]}var D=null,R=null;if(IA(i)?D=hA(i,t.width):s&&IA(s)&&(R=hA(s,t.height)),D!==null&&(!s||Gt(s))&&(R=d&&f?D/r*n:t.height),R!==null&&Gt(i)&&(D=d&&f?R/n*r:t.width),D!==null&&R!==null)return[D,R];throw new Error("Unable to calculate background-size for element")},Yt=function(A,e){var t=A[e];return typeof t>"u"?A[0]:t},VT=function(A,e,t,r,n){var a=e[0],i=e[1],s=t[0],u=t[1];switch(A){case 2:return[new M(Math.round(r.left),Math.round(r.top+i)),new M(Math.round(r.left+r.width),Math.round(r.top+i)),new M(Math.round(r.left+r.width),Math.round(u+r.top+i)),new M(Math.round(r.left),Math.round(u+r.top+i))];case 3:return[new M(Math.round(r.left+a),Math.round(r.top)),new M(Math.round(r.left+a+s),Math.round(r.top)),new M(Math.round(r.left+a+s),Math.round(r.height+r.top)),new M(Math.round(r.left+a),Math.round(r.height+r.top))];case 1:return[new M(Math.round(r.left+a),Math.round(r.top+i)),new M(Math.round(r.left+a+s),Math.round(r.top+i)),new M(Math.round(r.left+a+s),Math.round(r.top+i+u)),new M(Math.round(r.left+a),Math.round(r.top+i+u))];default:return[new M(Math.round(n.left),Math.round(n.top)),new M(Math.round(n.left+n.width),Math.round(n.top)),new M(Math.round(n.left+n.width),Math.round(n.height+n.top)),new M(Math.round(n.left),Math.round(n.height+n.top))]}},GT="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",t0="Hidden Text",YT=function(){function A(e){this._data={},this._document=e}return A.prototype.parseMetrics=function(e,t){var r=this._document.createElement("div"),n=this._document.createElement("img"),a=this._document.createElement("span"),i=this._document.body;r.style.visibility="hidden",r.style.fontFamily=e,r.style.fontSize=t,r.style.margin="0",r.style.padding="0",r.style.whiteSpace="nowrap",i.appendChild(r),n.src=GT,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",a.style.fontFamily=e,a.style.fontSize=t,a.style.margin="0",a.style.padding="0",a.appendChild(this._document.createTextNode(t0)),r.appendChild(a),r.appendChild(n);var s=n.offsetTop-a.offsetTop+2;r.removeChild(a),r.appendChild(this._document.createTextNode(t0)),r.style.lineHeight="normal",n.style.verticalAlign="super";var u=n.offsetTop-r.offsetTop+2;return i.removeChild(r),{baseline:s,middle:u}},A.prototype.getMetrics=function(e,t){var r=e+" "+t;return typeof this._data[r]>"u"&&(this._data[r]=this.parseMetrics(e,t)),this._data[r]},A}(),r0=function(){function A(e,t){this.context=e,this.options=t}return A}(),XT=1e4,WT=function(A){Ee(e,A);function e(t,r){var n=A.call(this,t,r)||this;return n._activeEffects=[],n.canvas=r.canvas?r.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),r.canvas||(n.canvas.width=Math.floor(r.width*r.scale),n.canvas.height=Math.floor(r.height*r.scale),n.canvas.style.width=r.width+"px",n.canvas.style.height=r.height+"px"),n.fontMetrics=new YT(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-r.x,-r.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+r.width+"x"+r.height+") with scale "+r.scale),n}return e.prototype.applyEffects=function(t){for(var r=this;this._activeEffects.length;)this.popEffect();t.forEach(function(n){return r.applyEffect(n)})},e.prototype.applyEffect=function(t){this.ctx.save(),LT(t)&&(this.ctx.globalAlpha=t.opacity),ST(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),ql(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return $A(this,void 0,void 0,function(){var r;return VA(this,function(n){switch(n.label){case 0:return r=t.element.container.styles,r.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return $A(this,void 0,void 0,function(){return VA(this,function(r){switch(r.label){case 0:if(vA(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return r.sent(),[4,this.renderNodeContent(t)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,r,n){var a=this;if(r===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+n);else{var i=ds(t.text);i.reduce(function(s,u){return a.ctx.fillText(u,s,t.bounds.top+n),s+a.ctx.measureText(u).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var r=t.fontVariant.filter(function(i){return i==="normal"||i==="small-caps"}).join(""),n=$T(t.fontFamily).join(", "),a=Sr(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,r,t.fontWeight,a,n].join(" "),n,a]},e.prototype.renderTextNode=function(t,r){return $A(this,void 0,void 0,function(){var n,a,i,s,u,l,d,f,h=this;return VA(this,function(C){return n=this.createFontStyle(r),a=n[0],i=n[1],s=n[2],this.ctx.font=a,this.ctx.direction=r.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",u=this.fontMetrics.getMetrics(i,s),l=u.baseline,d=u.middle,f=r.paintOrder,t.textBounds.forEach(function(E){f.forEach(function(T){switch(T){case 0:h.ctx.fillStyle=DA(r.color),h.renderTextWithLetterSpacing(E,r.letterSpacing,l);var v=r.textShadow;v.length&&E.text.trim().length&&(v.slice(0).reverse().forEach(function(b){h.ctx.shadowColor=DA(b.color),h.ctx.shadowOffsetX=b.offsetX.number*h.options.scale,h.ctx.shadowOffsetY=b.offsetY.number*h.options.scale,h.ctx.shadowBlur=b.blur.number,h.renderTextWithLetterSpacing(E,r.letterSpacing,l)}),h.ctx.shadowColor="",h.ctx.shadowOffsetX=0,h.ctx.shadowOffsetY=0,h.ctx.shadowBlur=0),r.textDecorationLine.length&&(h.ctx.fillStyle=DA(r.textDecorationColor||r.color),r.textDecorationLine.forEach(function(b){switch(b){case 1:h.ctx.fillRect(E.bounds.left,Math.round(E.bounds.top+l),E.bounds.width,1);break;case 2:h.ctx.fillRect(E.bounds.left,Math.round(E.bounds.top),E.bounds.width,1);break;case 3:h.ctx.fillRect(E.bounds.left,Math.ceil(E.bounds.top+d),E.bounds.width,1);break}}));break;case 1:r.webkitTextStrokeWidth&&E.text.trim().length&&(h.ctx.strokeStyle=DA(r.webkitTextStrokeColor),h.ctx.lineWidth=r.webkitTextStrokeWidth,h.ctx.lineJoin=window.chrome?"miter":"round",h.ctx.strokeText(E.text,E.bounds.left,E.bounds.top+l)),h.ctx.strokeStyle="",h.ctx.lineWidth=0,h.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,r,n){if(n&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var a=fa(t),i=ca(r);this.path(i),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,t.intrinsicWidth,t.intrinsicHeight,a.left,a.top,a.width,a.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return $A(this,void 0,void 0,function(){var r,n,a,i,s,u,x,x,l,d,f,h,R,C,E,O,T,v,b,x,D,R,O;return VA(this,function(m){switch(m.label){case 0:this.applyEffects(t.getEffects(4)),r=t.container,n=t.curves,a=r.styles,i=0,s=r.textNodes,m.label=1;case 1:return i<s.length?(u=s[i],[4,this.renderTextNode(u,a)]):[3,4];case 2:m.sent(),m.label=3;case 3:return i++,[3,1];case 4:if(!(r instanceof wl))return[3,8];m.label=5;case 5:return m.trys.push([5,7,,8]),[4,this.context.cache.match(r.src)];case 6:return x=m.sent(),this.renderReplacedElement(r,n,x),[3,8];case 7:return m.sent(),this.context.logger.error("Error loading image "+r.src),[3,8];case 8:if(r instanceof bl&&this.renderReplacedElement(r,n,r.canvas),!(r instanceof Tl))return[3,12];m.label=9;case 9:return m.trys.push([9,11,,12]),[4,this.context.cache.match(r.svg)];case 10:return x=m.sent(),this.renderReplacedElement(r,n,x),[3,12];case 11:return m.sent(),this.context.logger.error("Error loading svg "+r.svg.substring(0,255)),[3,12];case 12:return r instanceof yl&&r.tree?(l=new e(this.context,{scale:this.options.scale,backgroundColor:r.backgroundColor,x:0,y:0,width:r.width,height:r.height}),[4,l.render(r.tree)]):[3,14];case 13:d=m.sent(),r.width&&r.height&&this.ctx.drawImage(d,0,0,r.width,r.height,r.bounds.left,r.bounds.top,r.bounds.width,r.bounds.height),m.label=14;case 14:if(r instanceof hs&&(f=Math.min(r.bounds.width,r.bounds.height),r.type===ta?r.checked&&(this.ctx.save(),this.path([new M(r.bounds.left+f*.39363,r.bounds.top+f*.79),new M(r.bounds.left+f*.16,r.bounds.top+f*.5549),new M(r.bounds.left+f*.27347,r.bounds.top+f*.44071),new M(r.bounds.left+f*.39694,r.bounds.top+f*.5649),new M(r.bounds.left+f*.72983,r.bounds.top+f*.23),new M(r.bounds.left+f*.84,r.bounds.top+f*.34085),new M(r.bounds.left+f*.39363,r.bounds.top+f*.79)]),this.ctx.fillStyle=DA(Ql),this.ctx.fill(),this.ctx.restore()):r.type===ra&&r.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(r.bounds.left+f/2,r.bounds.top+f/2,f/4,0,Math.PI*2,!0),this.ctx.fillStyle=DA(Ql),this.ctx.fill(),this.ctx.restore())),JT(r)&&r.value.length){switch(h=this.createFontStyle(a),R=h[0],C=h[1],E=this.fontMetrics.getMetrics(R,C).baseline,this.ctx.font=R,this.ctx.fillStyle=DA(a.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=jT(r.styles.textAlign),O=fa(r),T=0,r.styles.textAlign){case 1:T+=O.width/2;break;case 2:T+=O.width;break}v=O.add(T,0,0,-O.height/2+1),this.ctx.save(),this.path([new M(O.left,O.top),new M(O.left+O.width,O.top),new M(O.left+O.width,O.top+O.height),new M(O.left,O.top+O.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Rr(r.value,v),a.letterSpacing,E),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!vA(r.styles.display,2048))return[3,20];if(r.styles.listStyleImage===null)return[3,19];if(b=r.styles.listStyleImage,b.type!==0)return[3,18];x=void 0,D=b.url,m.label=15;case 15:return m.trys.push([15,17,,18]),[4,this.context.cache.match(D)];case 16:return x=m.sent(),this.ctx.drawImage(x,r.bounds.left-(x.width+10),r.bounds.top),[3,18];case 17:return m.sent(),this.context.logger.error("Error loading list-style-image "+D),[3,18];case 18:return[3,20];case 19:t.listValue&&r.styles.listStyleType!==-1&&(R=this.createFontStyle(a)[0],this.ctx.font=R,this.ctx.fillStyle=DA(a.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",O=new Se(r.bounds.left,r.bounds.top+hA(r.styles.paddingTop,r.bounds.width),r.bounds.width,tl(a.lineHeight,a.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Rr(t.listValue,O),a.letterSpacing,tl(a.lineHeight,a.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),m.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return $A(this,void 0,void 0,function(){var r,n,b,a,i,b,s,u,b,l,d,b,f,h,b,C,E,b,T,v,b;return VA(this,function(x){switch(x.label){case 0:if(vA(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:x.sent(),r=0,n=t.negativeZIndex,x.label=2;case 2:return r<n.length?(b=n[r],[4,this.renderStack(b)]):[3,5];case 3:x.sent(),x.label=4;case 4:return r++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:x.sent(),a=0,i=t.nonInlineLevel,x.label=7;case 7:return a<i.length?(b=i[a],[4,this.renderNode(b)]):[3,10];case 8:x.sent(),x.label=9;case 9:return a++,[3,7];case 10:s=0,u=t.nonPositionedFloats,x.label=11;case 11:return s<u.length?(b=u[s],[4,this.renderStack(b)]):[3,14];case 12:x.sent(),x.label=13;case 13:return s++,[3,11];case 14:l=0,d=t.nonPositionedInlineLevel,x.label=15;case 15:return l<d.length?(b=d[l],[4,this.renderStack(b)]):[3,18];case 16:x.sent(),x.label=17;case 17:return l++,[3,15];case 18:f=0,h=t.inlineLevel,x.label=19;case 19:return f<h.length?(b=h[f],[4,this.renderNode(b)]):[3,22];case 20:x.sent(),x.label=21;case 21:return f++,[3,19];case 22:C=0,E=t.zeroOrAutoZIndexOrTransformedOrOpacity,x.label=23;case 23:return C<E.length?(b=E[C],[4,this.renderStack(b)]):[3,26];case 24:x.sent(),x.label=25;case 25:return C++,[3,23];case 26:T=0,v=t.positiveZIndex,x.label=27;case 27:return T<v.length?(b=v[T],[4,this.renderStack(b)]):[3,30];case 28:x.sent(),x.label=29;case 29:return T++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(t){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(t.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},e.prototype.formatPath=function(t){var r=this;t.forEach(function(n,a){var i=Be(n)?n.start:n;a===0?r.ctx.moveTo(i.x,i.y):r.ctx.lineTo(i.x,i.y),Be(n)&&r.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},e.prototype.renderRepeat=function(t,r,n,a){this.path(t),this.ctx.fillStyle=r,this.ctx.translate(n,a),this.ctx.fill(),this.ctx.translate(-n,-a)},e.prototype.resizeImage=function(t,r,n){var a;if(t.width===r&&t.height===n)return t;var i=(a=this.canvas.ownerDocument)!==null&&a!==void 0?a:document,s=i.createElement("canvas");s.width=Math.max(1,r),s.height=Math.max(1,n);var u=s.getContext("2d");return u.drawImage(t,0,0,t.width,t.height,0,0,r,n),s},e.prototype.renderBackgroundImage=function(t){return $A(this,void 0,void 0,function(){var r,n,a,i,s,u;return VA(this,function(l){switch(l.label){case 0:r=t.styles.backgroundImage.length-1,n=function(d){var f,h,C,z,BA,TA,W,rA,V,E,z,BA,TA,W,rA,T,v,b,x,D,R,O,m,L,V,k,z,aA,cA,W,rA,fA,BA,TA,YA,yA,XA,WA,ie,PA,JA,ZA;return VA(this,function(y){switch(y.label){case 0:if(d.type!==0)return[3,5];f=void 0,h=d.url,y.label=1;case 1:return y.trys.push([1,3,,4]),[4,a.context.cache.match(h)];case 2:return f=y.sent(),[3,4];case 3:return y.sent(),a.context.logger.error("Error loading background-image "+h),[3,4];case 4:return f&&(C=Qs(t,r,[f.width,f.height,f.width/f.height]),z=C[0],BA=C[1],TA=C[2],W=C[3],rA=C[4],V=a.ctx.createPattern(a.resizeImage(f,W,rA),"repeat"),a.renderRepeat(z,V,BA,TA)),[3,6];case 5:SC(d)?(E=Qs(t,r,[null,null,null]),z=E[0],BA=E[1],TA=E[2],W=E[3],rA=E[4],T=yC(d.angle,W,rA),v=T[0],b=T[1],x=T[2],D=T[3],R=T[4],O=document.createElement("canvas"),O.width=W,O.height=rA,m=O.getContext("2d"),L=m.createLinearGradient(b,D,x,R),Yc(d.stops,v).forEach(function(_){return L.addColorStop(_.stop,DA(_.color))}),m.fillStyle=L,m.fillRect(0,0,W,rA),W>0&&rA>0&&(V=a.ctx.createPattern(O,"repeat"),a.renderRepeat(z,V,BA,TA))):LC(d)&&(k=Qs(t,r,[null,null,null]),z=k[0],aA=k[1],cA=k[2],W=k[3],rA=k[4],fA=d.position.length===0?[zi]:d.position,BA=hA(fA[0],W),TA=hA(fA[fA.length-1],rA),YA=xC(d,BA,TA,W,rA),yA=YA[0],XA=YA[1],yA>0&&XA>0&&(WA=a.ctx.createRadialGradient(aA+BA,cA+TA,0,aA+BA,cA+TA,yA),Yc(d.stops,yA*2).forEach(function(_){return WA.addColorStop(_.stop,DA(_.color))}),a.path(z),a.ctx.fillStyle=WA,yA!==XA?(ie=t.bounds.left+.5*t.bounds.width,PA=t.bounds.top+.5*t.bounds.height,JA=XA/yA,ZA=1/JA,a.ctx.save(),a.ctx.translate(ie,PA),a.ctx.transform(1,0,0,JA,0,0),a.ctx.translate(-ie,-PA),a.ctx.fillRect(aA,ZA*(cA-PA)+PA,W,rA*ZA),a.ctx.restore()):a.ctx.fill())),y.label=6;case 6:return r--,[2]}})},a=this,i=0,s=t.styles.backgroundImage.slice(0).reverse(),l.label=1;case 1:return i<s.length?(u=s[i],[5,n(u)]):[3,4];case 2:l.sent(),l.label=3;case 3:return i++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(t,r,n){return $A(this,void 0,void 0,function(){return VA(this,function(a){return this.path(A0(n,r)),this.ctx.fillStyle=DA(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,r,n,a){return $A(this,void 0,void 0,function(){var i,s;return VA(this,function(u){switch(u.label){case 0:return r<3?[4,this.renderSolidBorder(t,n,a)]:[3,2];case 1:return u.sent(),[2];case 2:return i=OT(a,n),this.path(i),this.ctx.fillStyle=DA(t),this.ctx.fill(),s=RT(a,n),this.path(s),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return $A(this,void 0,void 0,function(){var r,n,a,i,s,u,l,d,f=this;return VA(this,function(h){switch(h.label){case 0:return this.applyEffects(t.getEffects(2)),r=t.container.styles,n=!Ze(r.backgroundColor)||r.backgroundImage.length,a=[{style:r.borderTopStyle,color:r.borderTopColor,width:r.borderTopWidth},{style:r.borderRightStyle,color:r.borderRightColor,width:r.borderRightWidth},{style:r.borderBottomStyle,color:r.borderBottomColor,width:r.borderBottomWidth},{style:r.borderLeftStyle,color:r.borderLeftColor,width:r.borderLeftWidth}],i=qT(Yt(r.backgroundClip,0),t.curves),n||r.boxShadow.length?(this.ctx.save(),this.path(i),this.ctx.clip(),Ze(r.backgroundColor)||(this.ctx.fillStyle=DA(r.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:h.sent(),this.ctx.restore(),r.boxShadow.slice(0).reverse().forEach(function(C){f.ctx.save();var E=ua(t.curves),T=C.inset?0:XT,v=HT(E,-T+(C.inset?1:-1)*C.spread.number,(C.inset?1:-1)*C.spread.number,C.spread.number*(C.inset?-2:2),C.spread.number*(C.inset?-2:2));C.inset?(f.path(E),f.ctx.clip(),f.mask(v)):(f.mask(E),f.ctx.clip(),f.path(v)),f.ctx.shadowOffsetX=C.offsetX.number+T,f.ctx.shadowOffsetY=C.offsetY.number,f.ctx.shadowColor=DA(C.color),f.ctx.shadowBlur=C.blur.number,f.ctx.fillStyle=C.inset?DA(C.color):"rgba(0,0,0,1)",f.ctx.fill(),f.ctx.restore()}),h.label=2;case 2:s=0,u=0,l=a,h.label=3;case 3:return u<l.length?(d=l[u],d.style!==0&&!Ze(d.color)&&d.width>0?d.style!==2?[3,5]:[4,this.renderDashedDottedBorder(d.color,d.width,s,t.curves,2)]:[3,11]):[3,13];case 4:return h.sent(),[3,11];case 5:return d.style!==3?[3,7]:[4,this.renderDashedDottedBorder(d.color,d.width,s,t.curves,3)];case 6:return h.sent(),[3,11];case 7:return d.style!==4?[3,9]:[4,this.renderDoubleBorder(d.color,d.width,s,t.curves)];case 8:return h.sent(),[3,11];case 9:return[4,this.renderSolidBorder(d.color,s,t.curves)];case 10:h.sent(),h.label=11;case 11:s++,h.label=12;case 12:return u++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,r,n,a,i){return $A(this,void 0,void 0,function(){var s,u,l,d,f,h,C,E,T,v,b,x,D,R,O,m,O,m;return VA(this,function(L){return this.ctx.save(),s=MT(a,n),u=A0(a,n),i===2&&(this.path(u),this.ctx.clip()),Be(u[0])?(l=u[0].start.x,d=u[0].start.y):(l=u[0].x,d=u[0].y),Be(u[1])?(f=u[1].end.x,h=u[1].end.y):(f=u[1].x,h=u[1].y),n===0||n===2?C=Math.abs(l-f):C=Math.abs(d-h),this.ctx.beginPath(),i===3?this.formatPath(s):this.formatPath(u.slice(0,2)),E=r<3?r*3:r*2,T=r<3?r*2:r,i===3&&(E=r,T=r),v=!0,C<=E*2?v=!1:C<=E*2+T?(b=C/(2*E+T),E*=b,T*=b):(x=Math.floor((C+T)/(E+T)),D=(C-x*E)/(x-1),R=(C-(x+1)*E)/x,T=R<=0||Math.abs(T-D)<Math.abs(T-R)?D:R),v&&(i===3?this.ctx.setLineDash([0,E+T]):this.ctx.setLineDash([E,T])),i===3?(this.ctx.lineCap="round",this.ctx.lineWidth=r):this.ctx.lineWidth=r*2+1.1,this.ctx.strokeStyle=DA(t),this.ctx.stroke(),this.ctx.setLineDash([]),i===2&&(Be(u[0])&&(O=u[3],m=u[0],this.ctx.beginPath(),this.formatPath([new M(O.end.x,O.end.y),new M(m.start.x,m.start.y)]),this.ctx.stroke()),Be(u[1])&&(O=u[1],m=u[2],this.ctx.beginPath(),this.formatPath([new M(O.end.x,O.end.y),new M(m.start.x,m.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return $A(this,void 0,void 0,function(){var r;return VA(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=DA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),r=DT(t),[4,this.renderStack(r)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},e}(r0),JT=function(A){return A instanceof Il||A instanceof Fl?!0:A instanceof hs&&A.type!==ra&&A.type!==ta},qT=function(A,e){switch(A){case 0:return ua(e);case 2:return vT(e);case 1:default:return ca(e)}},jT=function(A){switch(A){case 1:return"center";case 2:return"right";case 0:default:return"left"}},zT=["-apple-system","system-ui"],$T=function(A){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?A.filter(function(e){return zT.indexOf(e)===-1}):A},ZT=function(A){Ee(e,A);function e(t,r){var n=A.call(this,t,r)||this;return n.canvas=r.canvas?r.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=r,n.canvas.width=Math.floor(r.width*r.scale),n.canvas.height=Math.floor(r.height*r.scale),n.canvas.style.width=r.width+"px",n.canvas.style.height=r.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-r.x,-r.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+r.width+"x"+r.height+" at "+r.x+","+r.y+") with scale "+r.scale),n}return e.prototype.render=function(t){return $A(this,void 0,void 0,function(){var r,n;return VA(this,function(a){switch(a.label){case 0:return r=ls(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,AU(r)];case 1:return n=a.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=DA(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e}(r0),AU=function(A){return new Promise(function(e,t){var r=new Image;r.onload=function(){e(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},eU=function(){function A(e){var t=e.id,r=e.enabled;this.id=t,this.enabled=r,this.start=Date.now()}return A.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,bn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.getTime=function(){return Date.now()-this.start},A.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,bn([this.id,this.getTime()+"ms"],e))},A.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,bn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,bn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.instances={},A}(),tU=function(){function A(e,t){var r;this.windowBounds=t,this.instanceName="#"+A.instanceCount++,this.logger=new eU({id:this.instanceName,enabled:e.logging}),this.cache=(r=e.cache)!==null&&r!==void 0?r:new bT(this,e)}return A.instanceCount=1,A}(),n0=function(A,e){return e===void 0&&(e={}),rU(A,e)};typeof window<"u"&&Jl.setContext(window);var rU=function(A,e){return $A(void 0,void 0,void 0,function(){var t,r,n,a,i,s,u,l,d,f,h,C,E,T,v,b,x,D,R,O,L,m,L,V,k,z,aA,cA,W,rA,fA,BA,TA,YA,yA,XA,WA,ie,PA,JA;return VA(this,function(ZA){switch(ZA.label){case 0:if(!A||typeof A!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=A.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(r=t.defaultView,!r)throw new Error("Document is not attached to a Window");return n={allowTaint:(V=e.allowTaint)!==null&&V!==void 0?V:!1,imageTimeout:(k=e.imageTimeout)!==null&&k!==void 0?k:15e3,proxy:e.proxy,useCORS:(z=e.useCORS)!==null&&z!==void 0?z:!1},a=vi({logging:(aA=e.logging)!==null&&aA!==void 0?aA:!0,cache:e.cache},n),i={windowWidth:(cA=e.windowWidth)!==null&&cA!==void 0?cA:r.innerWidth,windowHeight:(W=e.windowHeight)!==null&&W!==void 0?W:r.innerHeight,scrollX:(rA=e.scrollX)!==null&&rA!==void 0?rA:r.pageXOffset,scrollY:(fA=e.scrollY)!==null&&fA!==void 0?fA:r.pageYOffset},s=new Se(i.scrollX,i.scrollY,i.windowWidth,i.windowHeight),u=new tU(a,s),l=(BA=e.foreignObjectRendering)!==null&&BA!==void 0?BA:!1,d={allowTaint:(TA=e.allowTaint)!==null&&TA!==void 0?TA:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:l,copyStyles:l},u.logger.debug("Starting document clone with size "+s.width+"x"+s.height+" scrolled to "+-s.left+","+-s.top),f=new Xl(u,A,d),h=f.clonedReferenceElement,h?[4,f.toIFrame(t,s)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return C=ZA.sent(),E=gs(h)||aT(h)?HE(h.ownerDocument):Tn(u,h),T=E.width,v=E.height,b=E.left,x=E.top,D=nU(u,h,e.backgroundColor),R={canvas:e.canvas,backgroundColor:D,scale:(yA=(YA=e.scale)!==null&&YA!==void 0?YA:r.devicePixelRatio)!==null&&yA!==void 0?yA:1,x:((XA=e.x)!==null&&XA!==void 0?XA:0)+b,y:((WA=e.y)!==null&&WA!==void 0?WA:0)+x,width:(ie=e.width)!==null&&ie!==void 0?ie:Math.ceil(T),height:(PA=e.height)!==null&&PA!==void 0?PA:Math.ceil(v)},l?(u.logger.debug("Document cloned, using foreign object rendering"),L=new ZT(u,R),[4,L.render(h)]):[3,3];case 2:return O=ZA.sent(),[3,5];case 3:return u.logger.debug("Document cloned, element located at "+b+","+x+" with size "+T+"x"+v+" using computed rendering"),u.logger.debug("Starting DOM parsing"),m=vl(u,h),D===m.styles.backgroundColor&&(m.styles.backgroundColor=He.TRANSPARENT),u.logger.debug("Starting renderer for element at "+R.x+","+R.y+" with size "+R.width+"x"+R.height),L=new WT(u,R),[4,L.render(m)];case 4:O=ZA.sent(),ZA.label=5;case 5:return(!((JA=e.removeContainer)!==null&&JA!==void 0)||JA)&&(Xl.destroy(C)||u.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),u.logger.debug("Finished rendering"),[2,O]}})})},nU=function(A,e,t){var r=e.ownerDocument,n=r.documentElement?Hr(A,getComputedStyle(r.documentElement).backgroundColor):He.TRANSPARENT,a=r.body?Hr(A,getComputedStyle(r.body).backgroundColor):He.TRANSPARENT,i=typeof t=="string"?Hr(A,t):t===null?He.TRANSPARENT:4294967295;return e===r.documentElement?Ze(n)?Ze(a)?i:a:n:i};const aU=`.gp-message[data-v-a234b03c]{z-index:999999;transition:all .3s ease;max-width:300px;font-family:微软雅黑}.message-content[data-v-a234b03c]{display:flex;align-items:center;justify-content:space-between;padding:10px 20px;border-radius:4px;box-shadow:0 2px 8px #00000026;font-size:14px}.close-btn[data-v-a234b03c]{background:none;border:none;color:#4b5563;cursor:pointer;margin-left:10px;line-height:1;padding:0}.fade-enter-active[data-v-a234b03c],.fade-leave-active[data-v-a234b03c]{transition:opacity .3s}.fade-enter-from[data-v-a234b03c],.fade-leave-to[data-v-a234b03c]{opacity:0}[contenteditable=true][data-v-e0b66297]:focus{outline:none}[contenteditable=true][data-v-e0b66297]{outline:none}textarea[data-v-e0b66297]{resize:none;border:none;outline:none;background:transparent}.icon-upload[data-v-e0b66297]{display:none}.icon-upload-box:hover .icon-upload[data-v-e0b66297]{display:flex}.custom-checkbox[data-v-68b8f276]{width:16px;height:16px;border:2px solid #d1d5db;border-radius:4px;background-color:#fff;position:relative;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;cursor:pointer;transition:all .2s ease}.custom-checkbox[data-v-68b8f276]:checked{border-color:#3b82f6;background-color:#3b82f6}.custom-checkbox[data-v-68b8f276]:checked:after{content:"✓";color:#fff;font-size:12px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.checkbox-label[data-v-68b8f276]{line-height:1.2;font-size:14px;color:#4b5563}.border[data-v-c53c9169]{border:1px solid #ccc}.custom-checkbox[data-v-c53c9169]{width:18px;height:18px;border:2px solid #d1d5db;border-radius:4px;background-color:#fff;position:relative;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;cursor:pointer;transition:all .2s ease}.custom-checkbox[data-v-c53c9169]:checked{border-color:#3b82f6;background-color:#3b82f6}.custom-checkbox[data-v-c53c9169]:checked:after{content:"✓";color:#fff;font-size:12px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}/*!
|
39
|
+
.`+ws+ET+Wl)},wT=function(A,e){var t=A.ownerDocument;if(t){var r=t.createElement("style");r.textContent=e,A.appendChild(r)}},Jl=function(){function A(){}return A.getOrigin=function(e){var t=A._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},A.isSameOrigin=function(e){return A.getOrigin(e)===A._origin},A.setContext=function(e){A._link=e.document.createElement("a"),A._origin=A.getOrigin(e.location.href)},A._origin="about:blank",A}(),bT=function(){function A(e,t){this.context=e,this._options=t,this._cache={}}return A.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)||(Ts(e)||FT(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},A.prototype.match=function(e){return this._cache[e]},A.prototype.loadImage=function(e){return $A(this,void 0,void 0,function(){var t,r,n,a,i=this;return VA(this,function(s){switch(s.label){case 0:return t=Jl.isSameOrigin(e),r=!bs(e)&&this._options.useCORS===!0&&kA.SUPPORT_CORS_IMAGES&&!t,n=!bs(e)&&!t&&!Ts(e)&&typeof this._options.proxy=="string"&&kA.SUPPORT_CORS_XHR&&!r,!t&&this._options.allowTaint===!1&&!bs(e)&&!Ts(e)&&!n&&!r?[2]:(a=e,n?[4,this.proxy(a)]:[3,2]);case 1:a=s.sent(),s.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(u,l){var d=new Image;d.onload=function(){return u(d)},d.onerror=l,(IT(a)||r)&&(d.crossOrigin="anonymous"),d.src=a,d.complete===!0&&setTimeout(function(){return u(d)},500),i._options.imageTimeout>0&&setTimeout(function(){return l("Timed out ("+i._options.imageTimeout+"ms) loading image")},i._options.imageTimeout)})];case 3:return[2,s.sent()]}})})},A.prototype.has=function(e){return typeof this._cache[e]<"u"},A.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},A.prototype.proxy=function(e){var t=this,r=this._options.proxy;if(!r)throw new Error("No proxy defined");var n=e.substring(0,256);return new Promise(function(a,i){var s=kA.SUPPORT_RESPONSE_TYPE?"blob":"text",u=new XMLHttpRequest;u.onload=function(){if(u.status===200)if(s==="text")a(u.response);else{var f=new FileReader;f.addEventListener("load",function(){return a(f.result)},!1),f.addEventListener("error",function(h){return i(h)},!1),f.readAsDataURL(u.response)}else i("Failed to proxy resource "+n+" with status code "+u.status)},u.onerror=i;var l=r.indexOf("?")>-1?"&":"?";if(u.open("GET",""+r+l+"url="+encodeURIComponent(e)+"&responseType="+s),s!=="text"&&u instanceof XMLHttpRequest&&(u.responseType=s),t._options.imageTimeout){var d=t._options.imageTimeout;u.timeout=d,u.ontimeout=function(){return i("Timed out ("+d+"ms) proxying "+n)}}u.send()})},A}(),TT=/^data:image\/svg\+xml/i,UT=/^data:image\/.*;base64,/i,QT=/^data:image\/.*/i,FT=function(A){return kA.SUPPORT_SVG_DRAWING||!yT(A)},bs=function(A){return QT.test(A)},IT=function(A){return UT.test(A)},Ts=function(A){return A.substr(0,4)==="blob"},yT=function(A){return A.substr(-3).toLowerCase()==="svg"||TT.test(A)},M=function(){function A(e,t){this.type=0,this.x=e,this.y=t}return A.prototype.add=function(e,t){return new A(this.x+e,this.y+t)},A}(),Vt=function(A,e,t){return new M(A.x+(e.x-A.x)*t,A.y+(e.y-A.y)*t)},oa=function(){function A(e,t,r,n){this.type=1,this.start=e,this.startControl=t,this.endControl=r,this.end=n}return A.prototype.subdivide=function(e,t){var r=Vt(this.start,this.startControl,e),n=Vt(this.startControl,this.endControl,e),a=Vt(this.endControl,this.end,e),i=Vt(r,n,e),s=Vt(n,a,e),u=Vt(i,s,e);return t?new A(this.start,r,i,u):new A(u,s,a,this.end)},A.prototype.add=function(e,t){return new A(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A}(),Be=function(A){return A.type===1},xT=function(){function A(e){var t=e.styles,r=e.bounds,n=Lr(t.borderTopLeftRadius,r.width,r.height),a=n[0],i=n[1],s=Lr(t.borderTopRightRadius,r.width,r.height),u=s[0],l=s[1],d=Lr(t.borderBottomRightRadius,r.width,r.height),f=d[0],h=d[1],C=Lr(t.borderBottomLeftRadius,r.width,r.height),E=C[0],T=C[1],v=[];v.push((a+u)/r.width),v.push((E+f)/r.width),v.push((i+T)/r.height),v.push((l+h)/r.height);var b=Math.max.apply(Math,v);b>1&&(a/=b,i/=b,u/=b,l/=b,f/=b,h/=b,E/=b,T/=b);var x=r.width-u,D=r.height-h,R=r.width-f,O=r.height-T,m=t.borderTopWidth,L=t.borderRightWidth,V=t.borderBottomWidth,k=t.borderLeftWidth,z=hA(t.paddingTop,e.bounds.width),aA=hA(t.paddingRight,e.bounds.width),cA=hA(t.paddingBottom,e.bounds.width),W=hA(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=a>0||i>0?CA(r.left+k/3,r.top+m/3,a-k/3,i-m/3,sA.TOP_LEFT):new M(r.left+k/3,r.top+m/3),this.topRightBorderDoubleOuterBox=a>0||i>0?CA(r.left+x,r.top+m/3,u-L/3,l-m/3,sA.TOP_RIGHT):new M(r.left+r.width-L/3,r.top+m/3),this.bottomRightBorderDoubleOuterBox=f>0||h>0?CA(r.left+R,r.top+D,f-L/3,h-V/3,sA.BOTTOM_RIGHT):new M(r.left+r.width-L/3,r.top+r.height-V/3),this.bottomLeftBorderDoubleOuterBox=E>0||T>0?CA(r.left+k/3,r.top+O,E-k/3,T-V/3,sA.BOTTOM_LEFT):new M(r.left+k/3,r.top+r.height-V/3),this.topLeftBorderDoubleInnerBox=a>0||i>0?CA(r.left+k*2/3,r.top+m*2/3,a-k*2/3,i-m*2/3,sA.TOP_LEFT):new M(r.left+k*2/3,r.top+m*2/3),this.topRightBorderDoubleInnerBox=a>0||i>0?CA(r.left+x,r.top+m*2/3,u-L*2/3,l-m*2/3,sA.TOP_RIGHT):new M(r.left+r.width-L*2/3,r.top+m*2/3),this.bottomRightBorderDoubleInnerBox=f>0||h>0?CA(r.left+R,r.top+D,f-L*2/3,h-V*2/3,sA.BOTTOM_RIGHT):new M(r.left+r.width-L*2/3,r.top+r.height-V*2/3),this.bottomLeftBorderDoubleInnerBox=E>0||T>0?CA(r.left+k*2/3,r.top+O,E-k*2/3,T-V*2/3,sA.BOTTOM_LEFT):new M(r.left+k*2/3,r.top+r.height-V*2/3),this.topLeftBorderStroke=a>0||i>0?CA(r.left+k/2,r.top+m/2,a-k/2,i-m/2,sA.TOP_LEFT):new M(r.left+k/2,r.top+m/2),this.topRightBorderStroke=a>0||i>0?CA(r.left+x,r.top+m/2,u-L/2,l-m/2,sA.TOP_RIGHT):new M(r.left+r.width-L/2,r.top+m/2),this.bottomRightBorderStroke=f>0||h>0?CA(r.left+R,r.top+D,f-L/2,h-V/2,sA.BOTTOM_RIGHT):new M(r.left+r.width-L/2,r.top+r.height-V/2),this.bottomLeftBorderStroke=E>0||T>0?CA(r.left+k/2,r.top+O,E-k/2,T-V/2,sA.BOTTOM_LEFT):new M(r.left+k/2,r.top+r.height-V/2),this.topLeftBorderBox=a>0||i>0?CA(r.left,r.top,a,i,sA.TOP_LEFT):new M(r.left,r.top),this.topRightBorderBox=u>0||l>0?CA(r.left+x,r.top,u,l,sA.TOP_RIGHT):new M(r.left+r.width,r.top),this.bottomRightBorderBox=f>0||h>0?CA(r.left+R,r.top+D,f,h,sA.BOTTOM_RIGHT):new M(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=E>0||T>0?CA(r.left,r.top+O,E,T,sA.BOTTOM_LEFT):new M(r.left,r.top+r.height),this.topLeftPaddingBox=a>0||i>0?CA(r.left+k,r.top+m,Math.max(0,a-k),Math.max(0,i-m),sA.TOP_LEFT):new M(r.left+k,r.top+m),this.topRightPaddingBox=u>0||l>0?CA(r.left+Math.min(x,r.width-L),r.top+m,x>r.width+L?0:Math.max(0,u-L),Math.max(0,l-m),sA.TOP_RIGHT):new M(r.left+r.width-L,r.top+m),this.bottomRightPaddingBox=f>0||h>0?CA(r.left+Math.min(R,r.width-k),r.top+Math.min(D,r.height-V),Math.max(0,f-L),Math.max(0,h-V),sA.BOTTOM_RIGHT):new M(r.left+r.width-L,r.top+r.height-V),this.bottomLeftPaddingBox=E>0||T>0?CA(r.left+k,r.top+Math.min(O,r.height-V),Math.max(0,E-k),Math.max(0,T-V),sA.BOTTOM_LEFT):new M(r.left+k,r.top+r.height-V),this.topLeftContentBox=a>0||i>0?CA(r.left+k+W,r.top+m+z,Math.max(0,a-(k+W)),Math.max(0,i-(m+z)),sA.TOP_LEFT):new M(r.left+k+W,r.top+m+z),this.topRightContentBox=u>0||l>0?CA(r.left+Math.min(x,r.width+k+W),r.top+m+z,x>r.width+k+W?0:u-k+W,l-(m+z),sA.TOP_RIGHT):new M(r.left+r.width-(L+aA),r.top+m+z),this.bottomRightContentBox=f>0||h>0?CA(r.left+Math.min(R,r.width-(k+W)),r.top+Math.min(D,r.height+m+z),Math.max(0,f-(L+aA)),h-(V+cA),sA.BOTTOM_RIGHT):new M(r.left+r.width-(L+aA),r.top+r.height-(V+cA)),this.bottomLeftContentBox=E>0||T>0?CA(r.left+k+W,r.top+O,Math.max(0,E-(k+W)),T-(V+cA),sA.BOTTOM_LEFT):new M(r.left+k+W,r.top+r.height-(V+cA))}return A}(),sA;(function(A){A[A.TOP_LEFT=0]="TOP_LEFT",A[A.TOP_RIGHT=1]="TOP_RIGHT",A[A.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",A[A.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(sA||(sA={}));var CA=function(A,e,t,r,n){var a=4*((Math.sqrt(2)-1)/3),i=t*a,s=r*a,u=A+t,l=e+r;switch(n){case sA.TOP_LEFT:return new oa(new M(A,l),new M(A,l-s),new M(u-i,e),new M(u,e));case sA.TOP_RIGHT:return new oa(new M(A,e),new M(A+i,e),new M(u,l-s),new M(u,l));case sA.BOTTOM_RIGHT:return new oa(new M(u,e),new M(u,e+s),new M(A+i,l),new M(A,l));case sA.BOTTOM_LEFT:default:return new oa(new M(u,l),new M(u-i,l),new M(A,e+s),new M(A,e))}},ua=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},vT=function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]},ca=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},_T=function(){function A(e,t,r){this.offsetX=e,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return A}(),la=function(){function A(e,t){this.path=e,this.target=t,this.type=1}return A}(),NT=function(){function A(e){this.opacity=e,this.type=2,this.target=6}return A}(),ST=function(A){return A.type===0},ql=function(A){return A.type===1},LT=function(A){return A.type===2},jl=function(A,e){return A.length===e.length?A.some(function(t,r){return t===e[r]}):!1},HT=function(A,e,t,r,n){return A.map(function(a,i){switch(i){case 0:return a.add(e,t);case 1:return a.add(e+r,t);case 2:return a.add(e+r,t+n);case 3:return a.add(e,t+n)}return a})},zl=function(){function A(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return A}(),$l=function(){function A(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new xT(this.container),this.container.styles.opacity<1&&this.effects.push(new NT(this.container.styles.opacity)),this.container.styles.transform!==null){var r=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,a=this.container.styles.transform;this.effects.push(new _T(r,n,a))}if(this.container.styles.overflowX!==0){var i=ua(this.curves),s=ca(this.curves);jl(i,s)?this.effects.push(new la(i,6)):(this.effects.push(new la(i,2)),this.effects.push(new la(s,4)))}}return A.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,r=this.parent,n=this.effects.slice(0);r;){var a=r.effects.filter(function(u){return!ql(u)});if(t||r.container.styles.position!==0||!r.parent){if(n.unshift.apply(n,a),t=[2,3].indexOf(r.container.styles.position)===-1,r.container.styles.overflowX!==0){var i=ua(r.curves),s=ca(r.curves);jl(i,s)||n.unshift(new la(s,6))}}else n.unshift.apply(n,a);r=r.parent}return n.filter(function(u){return vA(u.target,e)})},A}(),Us=function(A,e,t,r){A.container.elements.forEach(function(n){var a=vA(n.flags,4),i=vA(n.flags,2),s=new $l(n,A);vA(n.styles.display,2048)&&r.push(s);var u=vA(n.flags,8)?[]:r;if(a||i){var l=a||n.styles.isPositioned()?t:e,d=new zl(s);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var f=n.styles.zIndex.order;if(f<0){var h=0;l.negativeZIndex.some(function(E,T){return f>E.element.container.styles.zIndex.order?(h=T,!1):h>0}),l.negativeZIndex.splice(h,0,d)}else if(f>0){var C=0;l.positiveZIndex.some(function(E,T){return f>=E.element.container.styles.zIndex.order?(C=T+1,!1):C>0}),l.positiveZIndex.splice(C,0,d)}else l.zeroOrAutoZIndexOrTransformedOrOpacity.push(d)}else n.styles.isFloating()?l.nonPositionedFloats.push(d):l.nonPositionedInlineLevel.push(d);Us(s,d,a?d:t,u)}else n.styles.isInlineLevel()?e.inlineLevel.push(s):e.nonInlineLevel.push(s),Us(s,e,t,u);vA(n.flags,8)&&Zl(n,u)})},Zl=function(A,e){for(var t=A instanceof fs?A.start:1,r=A instanceof fs?A.reversed:!1,n=0;n<e.length;n++){var a=e[n];a.container instanceof Ul&&typeof a.container.value=="number"&&a.container.value!==0&&(t=a.container.value),a.listValue=kr(t,a.container.styles.listStyleType,!0),t+=r?-1:1}},DT=function(A){var e=new $l(A,null),t=new zl(e),r=[];return Us(e,t,t,r),Zl(e.container,r),t},A0=function(A,e){switch(e){case 0:return ge(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return ge(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return ge(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);case 3:default:return ge(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}},OT=function(A,e){switch(e){case 0:return ge(A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox,A.topRightBorderBox,A.topRightBorderDoubleOuterBox);case 1:return ge(A.topRightBorderBox,A.topRightBorderDoubleOuterBox,A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox);case 2:return ge(A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox,A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox);case 3:default:return ge(A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox,A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox)}},RT=function(A,e){switch(e){case 0:return ge(A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox,A.topRightBorderDoubleInnerBox,A.topRightPaddingBox);case 1:return ge(A.topRightBorderDoubleInnerBox,A.topRightPaddingBox,A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox);case 2:return ge(A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox,A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox);case 3:default:return ge(A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox,A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox)}},MT=function(A,e){switch(e){case 0:return da(A.topLeftBorderStroke,A.topRightBorderStroke);case 1:return da(A.topRightBorderStroke,A.bottomRightBorderStroke);case 2:return da(A.bottomRightBorderStroke,A.bottomLeftBorderStroke);case 3:default:return da(A.bottomLeftBorderStroke,A.topLeftBorderStroke)}},da=function(A,e){var t=[];return Be(A)?t.push(A.subdivide(.5,!1)):t.push(A),Be(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},ge=function(A,e,t,r){var n=[];return Be(A)?n.push(A.subdivide(.5,!1)):n.push(A),Be(t)?n.push(t.subdivide(.5,!0)):n.push(t),Be(r)?n.push(r.subdivide(.5,!0).reverse()):n.push(r),Be(e)?n.push(e.subdivide(.5,!1).reverse()):n.push(e),n},e0=function(A){var e=A.bounds,t=A.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},fa=function(A){var e=A.styles,t=A.bounds,r=hA(e.paddingLeft,t.width),n=hA(e.paddingRight,t.width),a=hA(e.paddingTop,t.width),i=hA(e.paddingBottom,t.width);return t.add(r+e.borderLeftWidth,a+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+r+n),-(e.borderTopWidth+e.borderBottomWidth+a+i))},kT=function(A,e){return A===0?e.bounds:A===2?fa(e):e0(e)},PT=function(A,e){return A===0?e.bounds:A===2?fa(e):e0(e)},Qs=function(A,e,t){var r=kT(Yt(A.styles.backgroundOrigin,e),A),n=PT(Yt(A.styles.backgroundClip,e),A),a=KT(Yt(A.styles.backgroundSize,e),t,r),i=a[0],s=a[1],u=Lr(Yt(A.styles.backgroundPosition,e),r.width-i,r.height-s),l=VT(Yt(A.styles.backgroundRepeat,e),u,a,r,n),d=Math.round(r.left+u[0]),f=Math.round(r.top+u[1]);return[l,d,f,i,s]},Gt=function(A){return uA(A)&&A.value===Mt.AUTO},ha=function(A){return typeof A=="number"},KT=function(A,e,t){var r=e[0],n=e[1],a=e[2],i=A[0],s=A[1];if(!i)return[0,0];if(IA(i)&&s&&IA(s))return[hA(i,t.width),hA(s,t.height)];var u=ha(a);if(uA(i)&&(i.value===Mt.CONTAIN||i.value===Mt.COVER)){if(ha(a)){var l=t.width/t.height;return l<a!=(i.value===Mt.COVER)?[t.width,t.width/a]:[t.height*a,t.height]}return[t.width,t.height]}var d=ha(r),f=ha(n),h=d||f;if(Gt(i)&&(!s||Gt(s))){if(d&&f)return[r,n];if(!u&&!h)return[t.width,t.height];if(h&&u){var C=d?r:n*a,E=f?n:r/a;return[C,E]}var T=d?r:t.width,v=f?n:t.height;return[T,v]}if(u){var b=0,x=0;return IA(i)?b=hA(i,t.width):IA(s)&&(x=hA(s,t.height)),Gt(i)?b=x*a:(!s||Gt(s))&&(x=b/a),[b,x]}var D=null,R=null;if(IA(i)?D=hA(i,t.width):s&&IA(s)&&(R=hA(s,t.height)),D!==null&&(!s||Gt(s))&&(R=d&&f?D/r*n:t.height),R!==null&&Gt(i)&&(D=d&&f?R/n*r:t.width),D!==null&&R!==null)return[D,R];throw new Error("Unable to calculate background-size for element")},Yt=function(A,e){var t=A[e];return typeof t>"u"?A[0]:t},VT=function(A,e,t,r,n){var a=e[0],i=e[1],s=t[0],u=t[1];switch(A){case 2:return[new M(Math.round(r.left),Math.round(r.top+i)),new M(Math.round(r.left+r.width),Math.round(r.top+i)),new M(Math.round(r.left+r.width),Math.round(u+r.top+i)),new M(Math.round(r.left),Math.round(u+r.top+i))];case 3:return[new M(Math.round(r.left+a),Math.round(r.top)),new M(Math.round(r.left+a+s),Math.round(r.top)),new M(Math.round(r.left+a+s),Math.round(r.height+r.top)),new M(Math.round(r.left+a),Math.round(r.height+r.top))];case 1:return[new M(Math.round(r.left+a),Math.round(r.top+i)),new M(Math.round(r.left+a+s),Math.round(r.top+i)),new M(Math.round(r.left+a+s),Math.round(r.top+i+u)),new M(Math.round(r.left+a),Math.round(r.top+i+u))];default:return[new M(Math.round(n.left),Math.round(n.top)),new M(Math.round(n.left+n.width),Math.round(n.top)),new M(Math.round(n.left+n.width),Math.round(n.height+n.top)),new M(Math.round(n.left),Math.round(n.height+n.top))]}},GT="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",t0="Hidden Text",YT=function(){function A(e){this._data={},this._document=e}return A.prototype.parseMetrics=function(e,t){var r=this._document.createElement("div"),n=this._document.createElement("img"),a=this._document.createElement("span"),i=this._document.body;r.style.visibility="hidden",r.style.fontFamily=e,r.style.fontSize=t,r.style.margin="0",r.style.padding="0",r.style.whiteSpace="nowrap",i.appendChild(r),n.src=GT,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",a.style.fontFamily=e,a.style.fontSize=t,a.style.margin="0",a.style.padding="0",a.appendChild(this._document.createTextNode(t0)),r.appendChild(a),r.appendChild(n);var s=n.offsetTop-a.offsetTop+2;r.removeChild(a),r.appendChild(this._document.createTextNode(t0)),r.style.lineHeight="normal",n.style.verticalAlign="super";var u=n.offsetTop-r.offsetTop+2;return i.removeChild(r),{baseline:s,middle:u}},A.prototype.getMetrics=function(e,t){var r=e+" "+t;return typeof this._data[r]>"u"&&(this._data[r]=this.parseMetrics(e,t)),this._data[r]},A}(),r0=function(){function A(e,t){this.context=e,this.options=t}return A}(),XT=1e4,WT=function(A){Ee(e,A);function e(t,r){var n=A.call(this,t,r)||this;return n._activeEffects=[],n.canvas=r.canvas?r.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),r.canvas||(n.canvas.width=Math.floor(r.width*r.scale),n.canvas.height=Math.floor(r.height*r.scale),n.canvas.style.width=r.width+"px",n.canvas.style.height=r.height+"px"),n.fontMetrics=new YT(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-r.x,-r.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+r.width+"x"+r.height+") with scale "+r.scale),n}return e.prototype.applyEffects=function(t){for(var r=this;this._activeEffects.length;)this.popEffect();t.forEach(function(n){return r.applyEffect(n)})},e.prototype.applyEffect=function(t){this.ctx.save(),LT(t)&&(this.ctx.globalAlpha=t.opacity),ST(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),ql(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return $A(this,void 0,void 0,function(){var r;return VA(this,function(n){switch(n.label){case 0:return r=t.element.container.styles,r.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return $A(this,void 0,void 0,function(){return VA(this,function(r){switch(r.label){case 0:if(vA(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return r.sent(),[4,this.renderNodeContent(t)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,r,n){var a=this;if(r===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+n);else{var i=ds(t.text);i.reduce(function(s,u){return a.ctx.fillText(u,s,t.bounds.top+n),s+a.ctx.measureText(u).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var r=t.fontVariant.filter(function(i){return i==="normal"||i==="small-caps"}).join(""),n=$T(t.fontFamily).join(", "),a=Sr(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,r,t.fontWeight,a,n].join(" "),n,a]},e.prototype.renderTextNode=function(t,r){return $A(this,void 0,void 0,function(){var n,a,i,s,u,l,d,f,h=this;return VA(this,function(C){return n=this.createFontStyle(r),a=n[0],i=n[1],s=n[2],this.ctx.font=a,this.ctx.direction=r.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",u=this.fontMetrics.getMetrics(i,s),l=u.baseline,d=u.middle,f=r.paintOrder,t.textBounds.forEach(function(E){f.forEach(function(T){switch(T){case 0:h.ctx.fillStyle=DA(r.color),h.renderTextWithLetterSpacing(E,r.letterSpacing,l);var v=r.textShadow;v.length&&E.text.trim().length&&(v.slice(0).reverse().forEach(function(b){h.ctx.shadowColor=DA(b.color),h.ctx.shadowOffsetX=b.offsetX.number*h.options.scale,h.ctx.shadowOffsetY=b.offsetY.number*h.options.scale,h.ctx.shadowBlur=b.blur.number,h.renderTextWithLetterSpacing(E,r.letterSpacing,l)}),h.ctx.shadowColor="",h.ctx.shadowOffsetX=0,h.ctx.shadowOffsetY=0,h.ctx.shadowBlur=0),r.textDecorationLine.length&&(h.ctx.fillStyle=DA(r.textDecorationColor||r.color),r.textDecorationLine.forEach(function(b){switch(b){case 1:h.ctx.fillRect(E.bounds.left,Math.round(E.bounds.top+l),E.bounds.width,1);break;case 2:h.ctx.fillRect(E.bounds.left,Math.round(E.bounds.top),E.bounds.width,1);break;case 3:h.ctx.fillRect(E.bounds.left,Math.ceil(E.bounds.top+d),E.bounds.width,1);break}}));break;case 1:r.webkitTextStrokeWidth&&E.text.trim().length&&(h.ctx.strokeStyle=DA(r.webkitTextStrokeColor),h.ctx.lineWidth=r.webkitTextStrokeWidth,h.ctx.lineJoin=window.chrome?"miter":"round",h.ctx.strokeText(E.text,E.bounds.left,E.bounds.top+l)),h.ctx.strokeStyle="",h.ctx.lineWidth=0,h.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,r,n){if(n&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var a=fa(t),i=ca(r);this.path(i),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,t.intrinsicWidth,t.intrinsicHeight,a.left,a.top,a.width,a.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return $A(this,void 0,void 0,function(){var r,n,a,i,s,u,x,x,l,d,f,h,R,C,E,O,T,v,b,x,D,R,O;return VA(this,function(m){switch(m.label){case 0:this.applyEffects(t.getEffects(4)),r=t.container,n=t.curves,a=r.styles,i=0,s=r.textNodes,m.label=1;case 1:return i<s.length?(u=s[i],[4,this.renderTextNode(u,a)]):[3,4];case 2:m.sent(),m.label=3;case 3:return i++,[3,1];case 4:if(!(r instanceof wl))return[3,8];m.label=5;case 5:return m.trys.push([5,7,,8]),[4,this.context.cache.match(r.src)];case 6:return x=m.sent(),this.renderReplacedElement(r,n,x),[3,8];case 7:return m.sent(),this.context.logger.error("Error loading image "+r.src),[3,8];case 8:if(r instanceof bl&&this.renderReplacedElement(r,n,r.canvas),!(r instanceof Tl))return[3,12];m.label=9;case 9:return m.trys.push([9,11,,12]),[4,this.context.cache.match(r.svg)];case 10:return x=m.sent(),this.renderReplacedElement(r,n,x),[3,12];case 11:return m.sent(),this.context.logger.error("Error loading svg "+r.svg.substring(0,255)),[3,12];case 12:return r instanceof yl&&r.tree?(l=new e(this.context,{scale:this.options.scale,backgroundColor:r.backgroundColor,x:0,y:0,width:r.width,height:r.height}),[4,l.render(r.tree)]):[3,14];case 13:d=m.sent(),r.width&&r.height&&this.ctx.drawImage(d,0,0,r.width,r.height,r.bounds.left,r.bounds.top,r.bounds.width,r.bounds.height),m.label=14;case 14:if(r instanceof hs&&(f=Math.min(r.bounds.width,r.bounds.height),r.type===ta?r.checked&&(this.ctx.save(),this.path([new M(r.bounds.left+f*.39363,r.bounds.top+f*.79),new M(r.bounds.left+f*.16,r.bounds.top+f*.5549),new M(r.bounds.left+f*.27347,r.bounds.top+f*.44071),new M(r.bounds.left+f*.39694,r.bounds.top+f*.5649),new M(r.bounds.left+f*.72983,r.bounds.top+f*.23),new M(r.bounds.left+f*.84,r.bounds.top+f*.34085),new M(r.bounds.left+f*.39363,r.bounds.top+f*.79)]),this.ctx.fillStyle=DA(Ql),this.ctx.fill(),this.ctx.restore()):r.type===ra&&r.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(r.bounds.left+f/2,r.bounds.top+f/2,f/4,0,Math.PI*2,!0),this.ctx.fillStyle=DA(Ql),this.ctx.fill(),this.ctx.restore())),JT(r)&&r.value.length){switch(h=this.createFontStyle(a),R=h[0],C=h[1],E=this.fontMetrics.getMetrics(R,C).baseline,this.ctx.font=R,this.ctx.fillStyle=DA(a.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=jT(r.styles.textAlign),O=fa(r),T=0,r.styles.textAlign){case 1:T+=O.width/2;break;case 2:T+=O.width;break}v=O.add(T,0,0,-O.height/2+1),this.ctx.save(),this.path([new M(O.left,O.top),new M(O.left+O.width,O.top),new M(O.left+O.width,O.top+O.height),new M(O.left,O.top+O.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Rr(r.value,v),a.letterSpacing,E),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!vA(r.styles.display,2048))return[3,20];if(r.styles.listStyleImage===null)return[3,19];if(b=r.styles.listStyleImage,b.type!==0)return[3,18];x=void 0,D=b.url,m.label=15;case 15:return m.trys.push([15,17,,18]),[4,this.context.cache.match(D)];case 16:return x=m.sent(),this.ctx.drawImage(x,r.bounds.left-(x.width+10),r.bounds.top),[3,18];case 17:return m.sent(),this.context.logger.error("Error loading list-style-image "+D),[3,18];case 18:return[3,20];case 19:t.listValue&&r.styles.listStyleType!==-1&&(R=this.createFontStyle(a)[0],this.ctx.font=R,this.ctx.fillStyle=DA(a.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",O=new Se(r.bounds.left,r.bounds.top+hA(r.styles.paddingTop,r.bounds.width),r.bounds.width,tl(a.lineHeight,a.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Rr(t.listValue,O),a.letterSpacing,tl(a.lineHeight,a.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),m.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return $A(this,void 0,void 0,function(){var r,n,b,a,i,b,s,u,b,l,d,b,f,h,b,C,E,b,T,v,b;return VA(this,function(x){switch(x.label){case 0:if(vA(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:x.sent(),r=0,n=t.negativeZIndex,x.label=2;case 2:return r<n.length?(b=n[r],[4,this.renderStack(b)]):[3,5];case 3:x.sent(),x.label=4;case 4:return r++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:x.sent(),a=0,i=t.nonInlineLevel,x.label=7;case 7:return a<i.length?(b=i[a],[4,this.renderNode(b)]):[3,10];case 8:x.sent(),x.label=9;case 9:return a++,[3,7];case 10:s=0,u=t.nonPositionedFloats,x.label=11;case 11:return s<u.length?(b=u[s],[4,this.renderStack(b)]):[3,14];case 12:x.sent(),x.label=13;case 13:return s++,[3,11];case 14:l=0,d=t.nonPositionedInlineLevel,x.label=15;case 15:return l<d.length?(b=d[l],[4,this.renderStack(b)]):[3,18];case 16:x.sent(),x.label=17;case 17:return l++,[3,15];case 18:f=0,h=t.inlineLevel,x.label=19;case 19:return f<h.length?(b=h[f],[4,this.renderNode(b)]):[3,22];case 20:x.sent(),x.label=21;case 21:return f++,[3,19];case 22:C=0,E=t.zeroOrAutoZIndexOrTransformedOrOpacity,x.label=23;case 23:return C<E.length?(b=E[C],[4,this.renderStack(b)]):[3,26];case 24:x.sent(),x.label=25;case 25:return C++,[3,23];case 26:T=0,v=t.positiveZIndex,x.label=27;case 27:return T<v.length?(b=v[T],[4,this.renderStack(b)]):[3,30];case 28:x.sent(),x.label=29;case 29:return T++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(t){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(t.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},e.prototype.formatPath=function(t){var r=this;t.forEach(function(n,a){var i=Be(n)?n.start:n;a===0?r.ctx.moveTo(i.x,i.y):r.ctx.lineTo(i.x,i.y),Be(n)&&r.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},e.prototype.renderRepeat=function(t,r,n,a){this.path(t),this.ctx.fillStyle=r,this.ctx.translate(n,a),this.ctx.fill(),this.ctx.translate(-n,-a)},e.prototype.resizeImage=function(t,r,n){var a;if(t.width===r&&t.height===n)return t;var i=(a=this.canvas.ownerDocument)!==null&&a!==void 0?a:document,s=i.createElement("canvas");s.width=Math.max(1,r),s.height=Math.max(1,n);var u=s.getContext("2d");return u.drawImage(t,0,0,t.width,t.height,0,0,r,n),s},e.prototype.renderBackgroundImage=function(t){return $A(this,void 0,void 0,function(){var r,n,a,i,s,u;return VA(this,function(l){switch(l.label){case 0:r=t.styles.backgroundImage.length-1,n=function(d){var f,h,C,z,BA,TA,W,rA,V,E,z,BA,TA,W,rA,T,v,b,x,D,R,O,m,L,V,k,z,aA,cA,W,rA,fA,BA,TA,YA,yA,XA,WA,ie,PA,JA,ZA;return VA(this,function(y){switch(y.label){case 0:if(d.type!==0)return[3,5];f=void 0,h=d.url,y.label=1;case 1:return y.trys.push([1,3,,4]),[4,a.context.cache.match(h)];case 2:return f=y.sent(),[3,4];case 3:return y.sent(),a.context.logger.error("Error loading background-image "+h),[3,4];case 4:return f&&(C=Qs(t,r,[f.width,f.height,f.width/f.height]),z=C[0],BA=C[1],TA=C[2],W=C[3],rA=C[4],V=a.ctx.createPattern(a.resizeImage(f,W,rA),"repeat"),a.renderRepeat(z,V,BA,TA)),[3,6];case 5:SC(d)?(E=Qs(t,r,[null,null,null]),z=E[0],BA=E[1],TA=E[2],W=E[3],rA=E[4],T=yC(d.angle,W,rA),v=T[0],b=T[1],x=T[2],D=T[3],R=T[4],O=document.createElement("canvas"),O.width=W,O.height=rA,m=O.getContext("2d"),L=m.createLinearGradient(b,D,x,R),Yc(d.stops,v).forEach(function(_){return L.addColorStop(_.stop,DA(_.color))}),m.fillStyle=L,m.fillRect(0,0,W,rA),W>0&&rA>0&&(V=a.ctx.createPattern(O,"repeat"),a.renderRepeat(z,V,BA,TA))):LC(d)&&(k=Qs(t,r,[null,null,null]),z=k[0],aA=k[1],cA=k[2],W=k[3],rA=k[4],fA=d.position.length===0?[zi]:d.position,BA=hA(fA[0],W),TA=hA(fA[fA.length-1],rA),YA=xC(d,BA,TA,W,rA),yA=YA[0],XA=YA[1],yA>0&&XA>0&&(WA=a.ctx.createRadialGradient(aA+BA,cA+TA,0,aA+BA,cA+TA,yA),Yc(d.stops,yA*2).forEach(function(_){return WA.addColorStop(_.stop,DA(_.color))}),a.path(z),a.ctx.fillStyle=WA,yA!==XA?(ie=t.bounds.left+.5*t.bounds.width,PA=t.bounds.top+.5*t.bounds.height,JA=XA/yA,ZA=1/JA,a.ctx.save(),a.ctx.translate(ie,PA),a.ctx.transform(1,0,0,JA,0,0),a.ctx.translate(-ie,-PA),a.ctx.fillRect(aA,ZA*(cA-PA)+PA,W,rA*ZA),a.ctx.restore()):a.ctx.fill())),y.label=6;case 6:return r--,[2]}})},a=this,i=0,s=t.styles.backgroundImage.slice(0).reverse(),l.label=1;case 1:return i<s.length?(u=s[i],[5,n(u)]):[3,4];case 2:l.sent(),l.label=3;case 3:return i++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(t,r,n){return $A(this,void 0,void 0,function(){return VA(this,function(a){return this.path(A0(n,r)),this.ctx.fillStyle=DA(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,r,n,a){return $A(this,void 0,void 0,function(){var i,s;return VA(this,function(u){switch(u.label){case 0:return r<3?[4,this.renderSolidBorder(t,n,a)]:[3,2];case 1:return u.sent(),[2];case 2:return i=OT(a,n),this.path(i),this.ctx.fillStyle=DA(t),this.ctx.fill(),s=RT(a,n),this.path(s),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return $A(this,void 0,void 0,function(){var r,n,a,i,s,u,l,d,f=this;return VA(this,function(h){switch(h.label){case 0:return this.applyEffects(t.getEffects(2)),r=t.container.styles,n=!Ze(r.backgroundColor)||r.backgroundImage.length,a=[{style:r.borderTopStyle,color:r.borderTopColor,width:r.borderTopWidth},{style:r.borderRightStyle,color:r.borderRightColor,width:r.borderRightWidth},{style:r.borderBottomStyle,color:r.borderBottomColor,width:r.borderBottomWidth},{style:r.borderLeftStyle,color:r.borderLeftColor,width:r.borderLeftWidth}],i=qT(Yt(r.backgroundClip,0),t.curves),n||r.boxShadow.length?(this.ctx.save(),this.path(i),this.ctx.clip(),Ze(r.backgroundColor)||(this.ctx.fillStyle=DA(r.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:h.sent(),this.ctx.restore(),r.boxShadow.slice(0).reverse().forEach(function(C){f.ctx.save();var E=ua(t.curves),T=C.inset?0:XT,v=HT(E,-T+(C.inset?1:-1)*C.spread.number,(C.inset?1:-1)*C.spread.number,C.spread.number*(C.inset?-2:2),C.spread.number*(C.inset?-2:2));C.inset?(f.path(E),f.ctx.clip(),f.mask(v)):(f.mask(E),f.ctx.clip(),f.path(v)),f.ctx.shadowOffsetX=C.offsetX.number+T,f.ctx.shadowOffsetY=C.offsetY.number,f.ctx.shadowColor=DA(C.color),f.ctx.shadowBlur=C.blur.number,f.ctx.fillStyle=C.inset?DA(C.color):"rgba(0,0,0,1)",f.ctx.fill(),f.ctx.restore()}),h.label=2;case 2:s=0,u=0,l=a,h.label=3;case 3:return u<l.length?(d=l[u],d.style!==0&&!Ze(d.color)&&d.width>0?d.style!==2?[3,5]:[4,this.renderDashedDottedBorder(d.color,d.width,s,t.curves,2)]:[3,11]):[3,13];case 4:return h.sent(),[3,11];case 5:return d.style!==3?[3,7]:[4,this.renderDashedDottedBorder(d.color,d.width,s,t.curves,3)];case 6:return h.sent(),[3,11];case 7:return d.style!==4?[3,9]:[4,this.renderDoubleBorder(d.color,d.width,s,t.curves)];case 8:return h.sent(),[3,11];case 9:return[4,this.renderSolidBorder(d.color,s,t.curves)];case 10:h.sent(),h.label=11;case 11:s++,h.label=12;case 12:return u++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,r,n,a,i){return $A(this,void 0,void 0,function(){var s,u,l,d,f,h,C,E,T,v,b,x,D,R,O,m,O,m;return VA(this,function(L){return this.ctx.save(),s=MT(a,n),u=A0(a,n),i===2&&(this.path(u),this.ctx.clip()),Be(u[0])?(l=u[0].start.x,d=u[0].start.y):(l=u[0].x,d=u[0].y),Be(u[1])?(f=u[1].end.x,h=u[1].end.y):(f=u[1].x,h=u[1].y),n===0||n===2?C=Math.abs(l-f):C=Math.abs(d-h),this.ctx.beginPath(),i===3?this.formatPath(s):this.formatPath(u.slice(0,2)),E=r<3?r*3:r*2,T=r<3?r*2:r,i===3&&(E=r,T=r),v=!0,C<=E*2?v=!1:C<=E*2+T?(b=C/(2*E+T),E*=b,T*=b):(x=Math.floor((C+T)/(E+T)),D=(C-x*E)/(x-1),R=(C-(x+1)*E)/x,T=R<=0||Math.abs(T-D)<Math.abs(T-R)?D:R),v&&(i===3?this.ctx.setLineDash([0,E+T]):this.ctx.setLineDash([E,T])),i===3?(this.ctx.lineCap="round",this.ctx.lineWidth=r):this.ctx.lineWidth=r*2+1.1,this.ctx.strokeStyle=DA(t),this.ctx.stroke(),this.ctx.setLineDash([]),i===2&&(Be(u[0])&&(O=u[3],m=u[0],this.ctx.beginPath(),this.formatPath([new M(O.end.x,O.end.y),new M(m.start.x,m.start.y)]),this.ctx.stroke()),Be(u[1])&&(O=u[1],m=u[2],this.ctx.beginPath(),this.formatPath([new M(O.end.x,O.end.y),new M(m.start.x,m.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return $A(this,void 0,void 0,function(){var r;return VA(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=DA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),r=DT(t),[4,this.renderStack(r)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},e}(r0),JT=function(A){return A instanceof Il||A instanceof Fl?!0:A instanceof hs&&A.type!==ra&&A.type!==ta},qT=function(A,e){switch(A){case 0:return ua(e);case 2:return vT(e);case 1:default:return ca(e)}},jT=function(A){switch(A){case 1:return"center";case 2:return"right";case 0:default:return"left"}},zT=["-apple-system","system-ui"],$T=function(A){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?A.filter(function(e){return zT.indexOf(e)===-1}):A},ZT=function(A){Ee(e,A);function e(t,r){var n=A.call(this,t,r)||this;return n.canvas=r.canvas?r.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=r,n.canvas.width=Math.floor(r.width*r.scale),n.canvas.height=Math.floor(r.height*r.scale),n.canvas.style.width=r.width+"px",n.canvas.style.height=r.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-r.x,-r.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+r.width+"x"+r.height+" at "+r.x+","+r.y+") with scale "+r.scale),n}return e.prototype.render=function(t){return $A(this,void 0,void 0,function(){var r,n;return VA(this,function(a){switch(a.label){case 0:return r=ls(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,AU(r)];case 1:return n=a.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=DA(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e}(r0),AU=function(A){return new Promise(function(e,t){var r=new Image;r.onload=function(){e(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},eU=function(){function A(e){var t=e.id,r=e.enabled;this.id=t,this.enabled=r,this.start=Date.now()}return A.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,bn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.getTime=function(){return Date.now()-this.start},A.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,bn([this.id,this.getTime()+"ms"],e))},A.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,bn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,bn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.instances={},A}(),tU=function(){function A(e,t){var r;this.windowBounds=t,this.instanceName="#"+A.instanceCount++,this.logger=new eU({id:this.instanceName,enabled:e.logging}),this.cache=(r=e.cache)!==null&&r!==void 0?r:new bT(this,e)}return A.instanceCount=1,A}(),n0=function(A,e){return e===void 0&&(e={}),rU(A,e)};typeof window<"u"&&Jl.setContext(window);var rU=function(A,e){return $A(void 0,void 0,void 0,function(){var t,r,n,a,i,s,u,l,d,f,h,C,E,T,v,b,x,D,R,O,L,m,L,V,k,z,aA,cA,W,rA,fA,BA,TA,YA,yA,XA,WA,ie,PA,JA;return VA(this,function(ZA){switch(ZA.label){case 0:if(!A||typeof A!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=A.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(r=t.defaultView,!r)throw new Error("Document is not attached to a Window");return n={allowTaint:(V=e.allowTaint)!==null&&V!==void 0?V:!1,imageTimeout:(k=e.imageTimeout)!==null&&k!==void 0?k:15e3,proxy:e.proxy,useCORS:(z=e.useCORS)!==null&&z!==void 0?z:!1},a=vi({logging:(aA=e.logging)!==null&&aA!==void 0?aA:!0,cache:e.cache},n),i={windowWidth:(cA=e.windowWidth)!==null&&cA!==void 0?cA:r.innerWidth,windowHeight:(W=e.windowHeight)!==null&&W!==void 0?W:r.innerHeight,scrollX:(rA=e.scrollX)!==null&&rA!==void 0?rA:r.pageXOffset,scrollY:(fA=e.scrollY)!==null&&fA!==void 0?fA:r.pageYOffset},s=new Se(i.scrollX,i.scrollY,i.windowWidth,i.windowHeight),u=new tU(a,s),l=(BA=e.foreignObjectRendering)!==null&&BA!==void 0?BA:!1,d={allowTaint:(TA=e.allowTaint)!==null&&TA!==void 0?TA:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:l,copyStyles:l},u.logger.debug("Starting document clone with size "+s.width+"x"+s.height+" scrolled to "+-s.left+","+-s.top),f=new Xl(u,A,d),h=f.clonedReferenceElement,h?[4,f.toIFrame(t,s)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return C=ZA.sent(),E=gs(h)||aT(h)?HE(h.ownerDocument):Tn(u,h),T=E.width,v=E.height,b=E.left,x=E.top,D=nU(u,h,e.backgroundColor),R={canvas:e.canvas,backgroundColor:D,scale:(yA=(YA=e.scale)!==null&&YA!==void 0?YA:r.devicePixelRatio)!==null&&yA!==void 0?yA:1,x:((XA=e.x)!==null&&XA!==void 0?XA:0)+b,y:((WA=e.y)!==null&&WA!==void 0?WA:0)+x,width:(ie=e.width)!==null&&ie!==void 0?ie:Math.ceil(T),height:(PA=e.height)!==null&&PA!==void 0?PA:Math.ceil(v)},l?(u.logger.debug("Document cloned, using foreign object rendering"),L=new ZT(u,R),[4,L.render(h)]):[3,3];case 2:return O=ZA.sent(),[3,5];case 3:return u.logger.debug("Document cloned, element located at "+b+","+x+" with size "+T+"x"+v+" using computed rendering"),u.logger.debug("Starting DOM parsing"),m=vl(u,h),D===m.styles.backgroundColor&&(m.styles.backgroundColor=He.TRANSPARENT),u.logger.debug("Starting renderer for element at "+R.x+","+R.y+" with size "+R.width+"x"+R.height),L=new WT(u,R),[4,L.render(m)];case 4:O=ZA.sent(),ZA.label=5;case 5:return(!((JA=e.removeContainer)!==null&&JA!==void 0)||JA)&&(Xl.destroy(C)||u.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),u.logger.debug("Finished rendering"),[2,O]}})})},nU=function(A,e,t){var r=e.ownerDocument,n=r.documentElement?Hr(A,getComputedStyle(r.documentElement).backgroundColor):He.TRANSPARENT,a=r.body?Hr(A,getComputedStyle(r.body).backgroundColor):He.TRANSPARENT,i=typeof t=="string"?Hr(A,t):t===null?He.TRANSPARENT:4294967295;return e===r.documentElement?Ze(n)?Ze(a)?i:a:n:i};const aU=`.gp-message[data-v-a234b03c]{z-index:999999;transition:all .3s ease;max-width:300px;font-family:微软雅黑}.message-content[data-v-a234b03c]{display:flex;align-items:center;justify-content:space-between;padding:10px 20px;border-radius:4px;box-shadow:0 2px 8px #00000026;font-size:14px}.close-btn[data-v-a234b03c]{background:none;border:none;color:#4b5563;cursor:pointer;margin-left:10px;line-height:1;padding:0}.fade-enter-active[data-v-a234b03c],.fade-leave-active[data-v-a234b03c]{transition:opacity .3s}.fade-enter-from[data-v-a234b03c],.fade-leave-to[data-v-a234b03c]{opacity:0}[contenteditable=true][data-v-de48901b]:focus{outline:none}[contenteditable=true][data-v-de48901b]{outline:none}textarea[data-v-de48901b]{resize:none;border:none;outline:none;background:transparent}.icon-upload[data-v-de48901b]{display:none}.icon-upload-box:hover .icon-upload[data-v-de48901b]{display:flex}.custom-checkbox[data-v-68b8f276]{width:16px;height:16px;border:2px solid #d1d5db;border-radius:4px;background-color:#fff;position:relative;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;cursor:pointer;transition:all .2s ease}.custom-checkbox[data-v-68b8f276]:checked{border-color:#3b82f6;background-color:#3b82f6}.custom-checkbox[data-v-68b8f276]:checked:after{content:"✓";color:#fff;font-size:12px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.checkbox-label[data-v-68b8f276]{line-height:1.2;font-size:14px;color:#4b5563}.border[data-v-c53c9169]{border:1px solid #ccc}.custom-checkbox[data-v-c53c9169]{width:18px;height:18px;border:2px solid #d1d5db;border-radius:4px;background-color:#fff;position:relative;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;cursor:pointer;transition:all .2s ease}.custom-checkbox[data-v-c53c9169]:checked{border-color:#3b82f6;background-color:#3b82f6}.custom-checkbox[data-v-c53c9169]:checked:after{content:"✓";color:#fff;font-size:12px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}/*!
|
40
40
|
* Cropper.js v1.6.2
|
41
41
|
* https://fengyuanchen.github.io/cropperjs
|
42
42
|
*
|