@puddle-code/cli 0.3.4 → 0.3.6
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/CHANGELOG.md +4 -13
- package/dist/host-control.mjs +5 -1
- package/dist/index.js +10 -4
- package/dist/public/assets/{App-CwV0Dizo.js → App-Duewv-oi.js} +2 -2
- package/dist/public/assets/{Dashboard-fA7E3Mr1.js → Dashboard-7gBsrB7q.js} +1 -1
- package/dist/public/assets/{EditorTabClose-DNWGZZN8.js → EditorTabClose-BV-zQyHT.js} +1 -1
- package/dist/public/assets/{LazyTerminal-CAvxgexS.js → LazyTerminal-gX1-vBQf.js} +2 -2
- package/dist/public/assets/{ModelRefcount-CJK-g5rf.js → ModelRefcount-BasPzO4R.js} +1 -1
- package/dist/public/assets/{NewProjectDialog-eDAOcbIM.js → NewProjectDialog-CDYUPliQ.js} +1 -1
- package/dist/public/assets/{PaneEditorBody-Cxn0s84L.js → PaneEditorBody-CqLkAxM1.js} +3 -3
- package/dist/public/assets/{PdfViewer-BY5xRKk1.js → PdfViewer-DAAfA9OC.js} +1 -1
- package/dist/public/assets/{SettingsDialog-Sd6i7Plz.js → SettingsDialog-DiwhE5dK.js} +1 -1
- package/dist/public/assets/{Terminal-CqjwbNAI.js → Terminal-DmlEI-h7.js} +3 -3
- package/dist/public/assets/{Workspace-C-M1AjMn.js → Workspace-cfjpv0xU.js} +4 -4
- package/dist/public/assets/{auth-cjbSLnao.js → auth-BxExwqPW.js} +1 -1
- package/dist/public/assets/{buffer-store-BAQjeFXg.js → buffer-store-CYe-IdNO.js} +1 -1
- package/dist/public/assets/{copy-Df7qIcX6.js → copy-CjatFFf8.js} +1 -1
- package/dist/public/assets/{disclosure-C2uTs3Vm.js → disclosure-7lu23NnB.js} +1 -1
- package/dist/public/assets/{dist-Cl5AP2As.js → dist-7fft9rhQ.js} +1 -1
- package/dist/public/assets/{errors-BiS6nBXL.js → errors-DhRwiizF.js} +1 -1
- package/dist/public/assets/{index-CW1P_8TN.js → index-BRywm-gU.js} +3 -3
- package/dist/public/assets/{markdown-mermaid-JPAETK2Y.js → markdown-mermaid-CF9txXiK.js} +1 -1
- package/dist/public/assets/{media-refresh-store-CHnqDJWI.js → media-refresh-store-DLtYZTP9.js} +1 -1
- package/dist/public/assets/{notification-delivery-Lz-hnQG7.js → notification-delivery-CoCRZRSK.js} +1 -1
- package/dist/public/assets/{project-abbrev-Bz8ZEwrb.js → project-abbrev-DX_a_ySv.js} +1 -1
- package/dist/public/assets/{protocol-support-CJIxbQCB.js → protocol-support-gmAQBWF3.js} +1 -1
- package/dist/public/assets/{scroll-restoration-r--43sOx.js → scroll-restoration-hg7BYUz2.js} +1 -1
- package/dist/public/assets/{selection-actions-C2udLSyj.js → selection-actions-BZy4596m.js} +1 -1
- package/dist/public/assets/{switch-DwMO1AUH.js → switch-OD1b2aeq.js} +1 -1
- package/dist/public/assets/{use-ui-state-Crvfdw4F.js → use-ui-state-C2LCTPRw.js} +1 -1
- package/dist/public/assets/{ws-B1kcYo2j.js → ws-oU1ansI7.js} +1 -1
- package/dist/public/index.html +2 -2
- package/dist/pudl.js +6 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PdfViewer-
|
|
2
|
-
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{t as n}from"./react-CZI7_Jkm.js";import{t as r}from"./jsx-runtime-ffCh33zF.js";import{G as i,J as a,K as o,S as s,U as c,W as l,X as u,Y as d,Z as f,o as p,q as m}from"./auth-cjbSLnao.js";import{i as h,r as g,t as _}from"./client-settings-CwqpIric.js";import{t as v}from"./preload-helper-Czpn1I53.js";import{a as y,r as b}from"./index-CW1P_8TN.js";import{t as x}from"./purify.es-D8QhFVkO.js";import"./katex.min-ZqdHjttS.js";import{a as S,c as C,i as w,p as T,r as ee}from"./editor.api2-4X9Vh9Zw.js";import{a as te,i as ne,n as re,r as ie}from"./dist-Cl5AP2As.js";import{E as ae,It as oe,Nt as se,Y as ce,f as le,k as ue,u as de,x as fe}from"./protocol-support-CJIxbQCB.js";import{C as pe,E as me,H as he,I as ge,J as _e,K as ve,M as ye,R as be,S as xe,V as Se,W as Ce,Y as we,a as Te,at as Ee,et as De,f as Oe,g as ke,h as Ae,i as je,it as Me,k as Ne,n as Pe,nt as Fe,q as Ie,r as Le,rt as Re,tt as ze,u as Be,w as Ve,x as He}from"./media-refresh-store-CHnqDJWI.js";import{t as Ue}from"./x-DCpy1q13.js";import{n as We,r as Ge}from"./dist-BCwJL3w9.js";import{t as Ke}from"./createLucideIcon-DyMAgLa3.js";import{a as qe,i as Je,n as Ye,r as Xe,t as Ze}from"./select-YFIOZ3zx.js";import{a as Qe,i as $e,n as et,t as tt}from"./FindWidget-BSK2PIfO.js";import{t as nt}from"./code-DRWf9a5s.js";import{t as rt}from"./rotate-ccw-CNjR2LSi.js";import{n as it,r as at,t as ot}from"./popover-C-BfSLgw.js";import{a as st,i as ct,n as lt,o as ut,r as dt,t as ft}from"./preview-kind-CJ9RTgbs.js";import{t as pt}from"./debounce-B9DrqirV.js";import{i as mt,n as ht,r as gt,t as _t}from"./drafts-B_tChlzR.js";import{a as vt,c as yt,d as bt,f as xt,i as St,l as Ct,o as wt,p as Tt,r as Et,s as Dt,t as Ot,u as kt}from"./buffer-store-BAQjeFXg.js";import{r as At}from"./buffer-logic-BAkSBQT7.js";import{a as jt,i as Mt,n as Nt,o as Pt,r as Ft}from"./editor-sync-W1bamxAP.js";import{i as It,n as Lt,t as Rt}from"./scroll-restoration-r--43sOx.js";import{r as zt,t as Bt}from"./math-CSw6sgCC.js";import{n as Vt,r as Ht}from"./math-delimiters-BCnTi7Ii.js";import{n as Ut}from"./markdown-mermaid-JPAETK2Y.js";var Wt=Ke(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Gt=Ke(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),E=t(n(),1),Kt=new Map,qt=new Map,Jt=1;function Yt(e){for(let t of qt.get(e)??[])t()}function Xt(e,t){Kt.set(e,t),Yt(e)}function Zt(e){let t={phase:`unresolved`,revision:Jt++};return Xt(e,t),t}function Qt(e){let t=Kt.get(e);return!t||t.phase!==`unresolved`&&t.phase!==`load-error`?null:(Xt(e,{phase:`loading`,revision:t.revision}),t.revision)}function $t(e,t,n,r){let i=Kt.get(e);return!i||i.phase!==`loading`||i.revision!==t?!1:(Xt(e,{phase:`opening`,revision:t,content:n,mtimeMs:r}),!0)}function en(e,t){let n=Kt.get(e);return!n||n.phase!==`opening`||n.revision!==t?!1:(Xt(e,{...n,phase:`comparing`}),!0)}function tn(e,t,n){let r=Kt.get(e);return!r||r.phase!==`loading`||r.revision!==t?!1:(Xt(e,{phase:`load-error`,revision:t,message:n}),!0)}function nn(e,t){return t&&e?.phase===`unresolved`}function rn(e){return e?.phase===`comparing`?e.mtimeMs:void 0}function an(e){return e?.phase===`loading`||e?.phase===`load-error`||e?.phase===`opening`}function on(e){return e.phase===`opening`||e.phase===`comparing`}function sn(e){Kt.delete(e)&&Yt(e)}function cn(e){return Kt.get(e)??null}function ln(e,t){let n=qt.get(e);return n||(n=new Set,qt.set(e,n)),n.add(t),()=>n.delete(t)}function un(e){return{tabSize:e,insertSpaces:!0,detectIndentation:!1}}var dn=new Lt,fn=new Lt;function pn(e){let t={...e.contributionsState};return delete t[`editor.contrib.wordHighlighter`],{...e,contributionsState:t}}function mn(e,t){let n=(0,E.useRef)(null),r=(0,E.useRef)(null);return(0,E.useLayoutEffect)(()=>(n.current&&(r.current=t(n.current,e)),()=>{r.current?.(),r.current=null}),[e,t]),(0,E.useCallback)(i=>{r.current?.(),n.current=i,i.onDidDispose(()=>{n.current===i&&(n.current=null)}),r.current=t(i,e)},[e,t])}function hn(e,t){let n=dn.get(t);n&&e.restoreViewState(n);let r=()=>{if(!e.getModel())return;let n=e.saveViewState();n&&dn.set(t,pn(n))},i=[e.onDidScrollChange(r),e.onDidChangeCursorSelection(r)];return()=>{r(),i.forEach(e=>e.dispose())}}function gn(e,t){let n=fn.get(t),r=n!==void 0,i=()=>{if(r||!e.getModel())return;let n=e.saveViewState();n&&fn.set(t,{...n,original:n.original&&pn(n.original),modified:n.modified&&pn(n.modified)})};n&&e.restoreViewState(n);let a=[e.onDidUpdateDiff(()=>{r&&(r=!1,n&&e.restoreViewState(n))}),...[e.getOriginalEditor(),e.getModifiedEditor()].flatMap(e=>[e.onDidScrollChange(i),e.onDidChangeCursorSelection(i)])];return()=>{i(),a.forEach(e=>e.dispose())}}function _n(e){return mn(It(`code`,e),hn)}function vn(e){return mn(It(`diff`,e),gn)}var D=r();function yn({session:e,path:t,conflict:n,model:r,onTakeDisk:i,onKeepMine:a,onSave:o,onReady:s}){let c=h(),l=vn([`conflict`,r.uri.toString()]),u=(0,E.useId)(),d=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),f=(0,E.useRef)(o);f.current=o;let p=(0,E.useRef)(null),m=()=>{let e=p.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),p.current=null},g=(0,E.useRef)(m);return g.current=m,(0,E.useEffect)(()=>()=>g.current(),[]),(0,D.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3 bg-elevated px-3 py-1.5 text-xs text-fg-secondary`,children:[(0,D.jsx)(`span`,{children:`This file changed on disk. Yours is on the right — merge what you want, then save.`}),(0,D.jsx)(`button`,{type:`button`,onClick:i,className:`ml-auto shrink-0 text-fg-muted transition-colors hover:text-fg`,children:`Take the disk version`}),(0,D.jsx)(`button`,{type:`button`,onClick:a,disabled:n.phase!==`comparing`,className:`shrink-0 text-fg-muted transition-colors hover:text-fg`,children:`Keep mine`})]}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,D.jsx)(Tt,{modifiedModelPath:r.uri.toString(),originalModelPath:`puddle-disk://${encodeURIComponent(e)}/${n.mtimeMs}/${encodeURIComponent(u)}/${t.split(`/`).map(encodeURIComponent).join(`/`)}`,original:n.content,language:r.getLanguageId(),theme:bt,keepCurrentModifiedModel:!0,loading:(0,D.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),onMount:e=>{l(e),p.current=e,e.onDidDispose(()=>{p.current=null}),e.getModifiedEditor().addCommand(w.CtrlCmd|ee.KeyS,()=>f.current()),s?.(n.revision)},options:{readOnly:n.phase!==`comparing`,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:d,fontSize:c.editorFontSize,...un(c.editorTabSize),wordWrap:c.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}function bn({session:e,path:t,buffer:n,focused:r}){let i=n.conflict;return!i||i.phase===`unresolved`?null:on(i)&&n.model?(0,D.jsx)(yn,{session:e,path:t,conflict:i,model:n.model,onTakeDisk:n.takeDisk,onKeepMine:n.keepMine,onSave:n.save,onReady:r?n.comparisonReady:void 0}):i.phase===`load-error`?(0,D.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 bg-ground px-4 text-center text-sm text-fg-muted`,children:[(0,D.jsx)(`span`,{children:`The disk version could not be loaded.`}),(0,D.jsx)(`span`,{className:`max-w-lg text-xs text-fg-secondary`,children:i.message}),(0,D.jsx)(`button`,{type:`button`,onClick:n.compare,className:`rounded-md bg-elevated px-3 py-1.5 text-xs text-fg-secondary transition-colors hover:bg-border hover:text-fg`,children:`Retry compare`})]}):(0,D.jsx)(`div`,{className:`flex h-full items-center justify-center bg-ground text-sm text-fg-muted`,children:`Loading the disk version…`})}var xn=`data-puddle-source-line`,Sn=`data-puddle-source-end-line`,Cn=`data-puddle-source-line-count`;function wn(e){return Number.isFinite(e.line)&&Number.isFinite(e.offset)}function Tn(e){let t=e.filter(wn).map(({line:e,offset:t})=>({line:Math.max(1,e),offset:Math.max(0,t)})).sort((e,t)=>e.offset-t.offset||e.line-t.line),n=[];for(let e of t){let t=n.at(-1);t&&(e.line<t.line||e.offset<t.offset)||t&&(e.line===t.line||e.offset===t.offset)||n.push(e)}return n}function En(e,t,n,r,i){return n<=t?r:r+Math.min(1,Math.max(0,(e-t)/(n-t)))*(i-r)}function Dn(e,t,n){if(e.length===0)return null;if(t<=e[0][n])return[e[0],e[0]];let r=e.at(-1);if(t>=r[n])return[r,r];let i=0,a=e.length-1;for(;i+1<a;){let r=Math.floor((i+a)/2);e[r][n]<=t?i=r:a=r}return[e[i],e[a]]}function On(e,t){let n=Dn(e,t,`line`);return n?En(t,n[0].line,n[1].line,n[0].offset,n[1].offset):null}function kn(e,t){let n=Dn(e,t,`offset`);return n?En(t,n[0].offset,n[1].offset,n[0].line,n[1].line):null}function An(e,t){let n=Number(e.getAttribute(t));return Number.isFinite(n)&&n>=1?n:null}function jn(e,t,n){let r=e.getBoundingClientRect().top,i=[{line:1,offset:0}];for(let a of t.querySelectorAll(`[${xn}]`)){let t=An(a,xn);if(t===null||t>n+1||a.getClientRects().length===0)continue;let o=a.getBoundingClientRect(),s=o.top-r+e.scrollTop;i.push({line:t,offset:s});let c=An(a,Sn);c!==null&&c<=n+1&&c>t&&o.height>0&&i.push({line:c,offset:s+o.height})}return i.push({line:Math.max(1,n+1),offset:e.scrollHeight}),Tn(i)}function Mn(e){return e===``?1:e.split(/\r\n?|\n/).length}function Nn(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):0}function Pn(e,t,n){return Nn(e/Math.max(1,t-n))}function Fn(e,t,n){return Nn(e)*Math.max(0,t-n)}function In(e,t){return JSON.stringify([e,t.session,t.root??null,t.path])}var Ln=new class{positions=new Map;listeners=new Map;revision=0;publish(e,t,n,r=null){let i={ratio:Nn(n),sourceLine:r!==null&&Number.isFinite(r)?Math.max(1,r):null,revision:++this.revision},a=In(e,t);this.positions.set(a,i);for(let e of this.listeners.get(a)??[])e(i);return i}get(e,t){return this.positions.get(In(e,t))}subscribe(e,t,n){let r=In(e,t),i=this.listeners.get(r);i||(i=new Set,this.listeners.set(r,i)),i.add(n);let a=this.positions.get(r);return a&&n(a),()=>{i?.delete(n),i?.size===0&&this.listeners.delete(r)}}},Rn=new Lt;function zn(e){let t=null;return{schedule:()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))},dispose:()=>{t!==null&&cancelAnimationFrame(t),t=null}}}function Bn(e,t,n,r){let i=Math.max(0,t-n);if(e.ratio<=0)return 0;if(e.ratio>=1)return i;if(e.sourceLine!==null&&r){let t=On(r,e.sourceLine);if(t!==null)return Math.min(i,Math.max(0,t))}return Fn(e.ratio,t,n)}function Vn(e,t){if(t.driver&&t.receiver)throw Error(`a preview scroll surface cannot be both driver and receiver`);let n=t.store??Ln,r=t.viewKey?Rn.get(t.viewKey):void 0,i=t.sourceAnchors?.(),a=()=>void 0,o,s=n=>{r=n,t.viewKey&&Rn.set(t.viewKey,n),e.scrollTop=Bn(n,e.scrollHeight,e.clientHeight,i)};r&&s(r);let c=()=>{if(e.clientHeight<=0)return;let a=Pn(e.scrollTop,e.scrollHeight,e.clientHeight),o=i?kn(i,e.scrollTop):null;r={ratio:a,sourceLine:o,revision:0},t.viewKey&&Rn.set(t.viewKey,r),t.driver&&n.publish(t.channel,t.target,a,o)};t.receiver?a=n.subscribe(t.channel,t.target,s):(t.driver||t.viewKey)&&(o=zn(c),e.addEventListener(`scroll`,o.schedule,{passive:!0}),o.schedule());let l=new ResizeObserver(()=>{i=t.sourceAnchors?.(),r?s(r):o?.schedule()});for(let e of t.resizeElements??[])l.observe(e);return()=>{o&&(c(),e.removeEventListener(`scroll`,o.schedule)),a(),l.disconnect(),o?.dispose()}}function Hn(e,t){let n=e.getModel()?.getLineCount()??0;if(n===0)return null;let r=1,i=n;for(;r<i;){let n=Math.ceil((r+i)/2);e.getTopForLineNumber(n)<=t?r=n:i=n-1}let a=e.getTopForLineNumber(r),o=r<n?e.getTopForLineNumber(r+1):e.getScrollHeight();return o<=a?r:r+Math.min(1,Math.max(0,(t-a)/(o-a)))}function Un(e,t){let n=e.getModel()?.getLineCount()??0;if(n===0||!Number.isFinite(t))return null;let r=Math.min(n+1,Math.max(1,t)),i=Math.floor(r);if(i>n)return e.getScrollHeight();let a=i+1,o=e.getTopForLineNumber(i),s=a<=n?e.getTopForLineNumber(a):e.getScrollHeight();return o+(r-i)*(s-o)}function Wn(e,t,n){if(t.driver&&t.receiver)throw Error(`a Monaco scroll surface cannot be both driver and receiver`);let r=t.store??Ln,i=[],a,o=()=>void 0,s,c=()=>e.getLayoutInfo().height,l=t=>{a=t;let r=t.ratio>0&&t.ratio<1&&t.sourceLine!==null?Un(e,t.sourceLine):null;e.setScrollTop(r??Bn(t,e.getScrollHeight(),c()),n)};return t.receiver?(o=r.subscribe(t.channel,t.target,l),i.push(e.onDidChangeModel(()=>a&&l(a))),i.push(e.onDidLayoutChange(()=>a&&l(a))),i.push(e.onDidContentSizeChange(()=>a&&l(a)))):t.driver&&(s=zn(()=>{let n=Pn(e.getScrollTop(),e.getScrollHeight(),c());r.publish(t.channel,t.target,n,Hn(e,e.getScrollTop()))}),i.push(e.onDidScrollChange(s.schedule)),i.push(e.onDidChangeModel(s.schedule)),i.push(e.onDidChangeModelContent(s.schedule)),i.push(e.onDidLayoutChange(s.schedule)),i.push(e.onDidContentSizeChange(s.schedule)),s.schedule()),()=>{o();for(let e of i)e.dispose();s?.dispose()}}function Gn(e){return!e}function Kn(e){let t=e.split(`+`),n=t.pop()??``,r=0;for(let e of t)e===`meta`?r|=w.CtrlCmd:e===`ctrl`?r|=w.WinCtrl:e===`alt`?r|=w.Alt:e===`shift`&&(r|=w.Shift);let i=ee[/^Key[A-Z]$/.test(n)?`Key${n.slice(3)}`:/^Digit[0-9]$/.test(n)?`Digit${n.slice(5)}`:n];return typeof i==`number`?r|i:null}function qn(e,t){let n=Kn(fe(`editor.save`));n!==null&&e.addCommand(n,()=>t.onSave());let r=Kn(fe(`editor.wordWrap`));e.addAction({id:`puddle.toggleWordWrap`,label:`Toggle Word Wrap`,keybindings:r===null?[]:[r],run:()=>g({editorWordWrap:Gn(_().editorWordWrap)})})}var Jn=new WeakSet;function Yn(e){return Jn.has(e)?!1:(Jn.add(e),!0)}function Xn(e){return`file-conflict:${e}`}function Zn(e,t,n,r,i){let a=i?.passive===!0,o=i?.focused??!0,s=Ot(e,t,r),c=we(e,t,{root:r,live:i?.live}),l=Ie(e,r),[u,d]=(0,E.useState)(null),[f,p]=(0,E.useState)(!1),m=(0,E.useRef)(!1),h=(0,E.useRef)(null),g=(0,E.useRef)(null),_=(0,E.useRef)(n);_.current=n;let v=(0,E.useRef)(!1),y=(0,E.useCallback)((e,t)=>{g.current?.cancel(),v.current=!0;try{Dt(s,e,t)}finally{v.current=!1}},[s]),b=(0,E.useSyncExternalStore)((0,E.useCallback)(e=>kt(s,e),[s]),()=>St(s)),x=(0,E.useSyncExternalStore)((0,E.useCallback)(e=>Pt(s,e),[s]),()=>jt(s)),S=(0,E.useSyncExternalStore)((0,E.useCallback)(e=>ln(s,e),[s]),()=>cn(s));(0,E.useEffect)(()=>{let n=c.data;if(!n||n.binary||n.content===null||m.current)return;m.current=!0;let i=Ct(s)!==void 0,a=Et(e,t,n.content,n.mtime_ms,r),o=a.getValue();d(a),!i&&mt(e,t,r).then(i=>{if(!i)return;let s=ht(i,o,n.mtime_ms);s===`discard`?_t(e,t,r):s===`restore`?At(a,i.content)&&p(!0):re(`This file has an unsaved draft from an earlier version.`,{description:`The file changed on disk since the draft was saved.`,duration:12e3,action:{label:`Restore draft`,onClick:()=>{At(a,i.content)&&p(!0)}}})})},[c.data,s,e,t,r]),(0,E.useEffect)(()=>{if(!u||a)return;let n=gt(e,t,r);g.current=n;let i=u.onDidChangeContent(()=>{v.current||(n(u.getValue(),Ct(s)??0),Nt(e,t,r))});return()=>{n.flush(),i.dispose(),g.current=null}},[u,s,e,t,r,a]),(0,E.useEffect)(()=>{!u||!x.savedElsewhere||St(s)||c.refetch().then(e=>{St(s)||(e.data&&e.data.content!==null&&y(e.data.content,e.data.mtime_ms),Mt(s))})},[x.savedElsewhere,u,s]),(0,E.useEffect)(()=>{let e=c.data;!u||!e||e.content===null||!St(s)&&e.mtime_ms!==Ct(s)&&y(e.content,e.mtime_ms)},[c.data,u,s]);let C=(0,E.useCallback)((n,i)=>{vt(s,n,i),g.current?.cancel(),_t(e,t,r),Ft(e,t,i,r),p(!1),sn(s)},[s,e,t,r]),w=(0,E.useCallback)(()=>{let e=Qt(s);e!==null&&(re.dismiss(Xn(s)),c.refetch({throwOnError:!0}).then(t=>{let n=t.data;if(!n)throw Error(`The disk version did not load.`);if(n.content===null)throw Error(`The file on disk is binary and cannot be compared as text.`);$t(s,e,n.content,n.mtime_ms)}).catch(t=>{tn(s,e,t instanceof Error?t.message:`The disk version did not load.`)}))},[c,s]),T=(0,E.useRef)(w);T.current=w,(0,E.useEffect)(()=>{if(!nn(S,o))return;let e=Xn(s);return re(`File changed on disk`,{id:e,description:`Nothing was written — your unsaved version is intact.`,duration:1/0,closeButton:!0,action:{label:`Compare`,onClick:()=>T.current()}}),()=>{re.dismiss(e)}},[S,o,s]);let ee=(0,E.useCallback)(()=>{c.refetch().then(n=>{n.data&&n.data.content!==null&&y(n.data.content,n.data.mtime_ms),_t(e,t,r),p(!1),sn(s)})},[s,e,t,y]),te=(0,E.useCallback)((e,n)=>{l.mutate({path:t,content:e},{onSuccess:e=>C(n,e.mtime_ms),onError:e=>re.error(e instanceof Error?e.message:`Overwrite failed`)})},[l,t,C]),ne=(0,E.useCallback)(async()=>{if(!u||!St(s))return!0;let e=u.getValue(),n=u.getAlternativeVersionId();if(an(cn(s)))return!1;let r=rn(cn(s))??Ct(s);try{let i=await l.mutateAsync({path:t,content:e,expected_mtime_ms:r});return C(n,i.mtime_ms),!0}catch(e){return e instanceof ie&&e.status===409&&e.code===`stale_file`?Zt(s):re.error(e instanceof Error?e.message:`Save failed`),!1}},[u,s,l,t,C]),ae=(0,E.useRef)(ne);ae.current=ne,(0,E.useEffect)(()=>me(Ne(e,t,r),()=>ae.current(),{session:e,path:t,...r===void 0?{}:{root:r}}),[e,t,r]);let oe=(0,E.useCallback)(()=>{let n=h.current,i=_.current;!n||!i||!o||i.session!==e||i.path!==t||(i.root??void 0)!==(r??void 0)||Yn(i)&&(n.revealLineInCenter(i.line),n.setPosition({lineNumber:i.line,column:i.column??1}),n.focus())},[e,t,r,o]),se=(0,E.useCallback)(e=>{h.current=e,qn(e,{onSave:()=>ae.current()}),oe()},[oe]);(0,E.useEffect)(()=>{oe()},[n,u,oe]);let ce=(0,E.useCallback)(()=>{ee()},[ee]),le=(0,E.useCallback)(()=>{!u||cn(s)?.phase!==`comparing`||te(u.getValue(),u.getAlternativeVersionId())},[u,s,te]),ue=(0,E.useCallback)(e=>{en(s,e)},[s]),de,fe=null;c.data?.binary?de=`binary`:c.error?c.error instanceof ie&&c.error.status===413?de=`too-large`:(de=`error`,fe=c.error instanceof Error?c.error.message:`Failed to load file`):de=u?`ready`:`loading`;let pe=b&&x.savedElsewhere?`saved-elsewhere`:b&&x.dirtyElsewhere?`dirty-elsewhere`:null;return{status:de,errorMessage:fe,model:u,dirty:b,restoredNotice:f,discardRestore:ce,peerBadge:pe,conflict:S,takeDisk:ee,keepMine:le,compare:w,comparisonReady:ue,save:ne,onMount:se}}function Qn(e,t,n,r){for(let i of e)if(rr([i],n).some(e=>(r===void 0||e.kind===r)&&t>=e.startLineNumber&&t<=e.endLineNumber))return i;return null}function $n(e,t){return tr(e.modifiedStartLineNumber,e.modifiedEndLineNumber)>0?Math.min(t,e.modifiedEndLineNumber):Math.max(0,Math.min(t,e.modifiedStartLineNumber-1))}function er(e){let t=tr(e.originalStartLineNumber,e.originalEndLineNumber),n=tr(e.modifiedStartLineNumber,e.modifiedEndLineNumber);return Math.max(5,Math.min(14,t+n+4))}function tr(e,t){return t===0?0:Math.max(0,t-e+1)}function nr(e,t){if(e>t)return{startLineNumber:Math.max(1,t),endLineNumber:Math.max(1,t),kind:`deleted-after`};let n=Math.max(1,e);return{startLineNumber:n,endLineNumber:n,kind:`deleted-before`}}function rr(e,t){let n=[];for(let r of e){let e=tr(r.originalStartLineNumber,r.originalEndLineNumber),i=tr(r.modifiedStartLineNumber,r.modifiedEndLineNumber);if(e===0&&i>0){n.push({startLineNumber:r.modifiedStartLineNumber,endLineNumber:r.modifiedEndLineNumber,kind:`added`});continue}if(i===0&&e>0){n.push(nr(r.modifiedStartLineNumber,t));continue}let a=Math.min(e,i);a>0&&n.push({startLineNumber:r.modifiedStartLineNumber,endLineNumber:r.modifiedStartLineNumber+a-1,kind:`modified`}),i>a&&n.push({startLineNumber:r.modifiedStartLineNumber+a,endLineNumber:r.modifiedEndLineNumber,kind:`added`}),e>a&&n.push(nr(r.modifiedStartLineNumber+i,t))}return n}var ir=28,ar=[[`puddle-dirty-added`,`added`],[`puddle-dirty-modified`,`modified`],[`puddle-dirty-deleted-before`,`deleted-before`],[`puddle-dirty-deleted-after`,`deleted-after`]];function or(e){if(e){for(let[t,n]of ar)if(e.classList.contains(t)||e.closest(`.${t}`))return n}}function sr({editor:e,original:t,modified:n,path:r}){let i=[],a=null,o=!1,s=t=>{try{e.changeViewZones(e=>e.removeZone(t))}catch{}},c=()=>{let e=a;e&&(a=null,e.frame!==null&&cancelAnimationFrame(e.frame),e.diffEditor&&(e.diffEditor.setModel(null),e.diffEditor.dispose()),s(e.zoneId))},l=e=>{let t=e.diffEditor;if(!t)return;let r=Math.max(1,Math.min(n.getLineCount(),e.change.modifiedStartLineNumber));t.getModifiedEditor().revealLineInCenter(r,T.ScrollType.Immediate)},u=(i,s)=>{if(a?.anchorLine===i){c();return}c();let u=e.getOption(T.EditorOption.lineHeight),d=document.createElement(`div`);d.className=`puddle-dirty-peek`;let f=document.createElement(`div`);f.className=`puddle-dirty-peek-header`;let p=document.createElement(`span`);p.className=`puddle-dirty-peek-title`,p.textContent=`${r.split(`/`).pop()??r} · Local changes against HEAD`;let m=document.createElement(`button`);m.type=`button`,m.className=`puddle-dirty-peek-close`,m.setAttribute(`aria-label`,`Close inline change`),m.title=`Close inline change`,m.textContent=`×`,m.addEventListener(`pointerdown`,e=>{e.preventDefault(),e.stopPropagation(),c()}),m.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),c()});let h=document.createElement(`div`);h.className=`puddle-dirty-peek-editor`,f.append(p,m),d.append(f,h);let g=document.createElement(`div`);g.className=`puddle-dirty-peek-margin`;let _={afterLineNumber:$n(s,n.getLineCount()),heightInPx:ir+er(s)*u,domNode:d,marginDomNode:g,suppressMouseDown:!1},v=``;e.changeViewZones(e=>{v=e.addZone(_)});let y={anchorLine:i,change:s,zone:_,zoneId:v,frame:null,diffEditor:null};a=y,y.frame=requestAnimationFrame(()=>{if(y.frame=null,o||a!==y)return;let r=T.createDiffEditor(h,{readOnly:!0,domReadOnly:!0,originalEditable:!1,renderSideBySide:!1,renderMarginRevertIcon:!1,renderOverviewRuler:!1,enableSplitViewResizing:!1,isInEmbeddedEditor:!0,automaticLayout:!0,fontFamily:e.getOption(T.EditorOption.fontFamily),fontSize:e.getOption(T.EditorOption.fontSize),lineHeight:u,minimap:{enabled:!1},glyphMargin:!1,folding:!1,scrollBeyondLastLine:!1,fixedOverflowWidgets:!0,hideUnchangedRegions:{enabled:!0,minimumLineCount:0,contextLineCount:2,revealLineCount:3}});y.diffEditor=r,r.setModel({original:t,modified:n}),r.onDidUpdateDiff(()=>l(y)),l(y)}),e.revealLineInCenter(Math.max(1,Math.min(n.getLineCount(),s.modifiedStartLineNumber)))},d=e.onMouseDown(e=>{if(!e.event.leftButton||e.target.type!==T.MouseTargetType.GUTTER_LINE_DECORATIONS||e.target.position===null)return;let t=e.target.position.lineNumber,r=Qn(i,t,n.getLineCount(),or(e.target.element));r&&(e.event.preventDefault(),e.event.stopPropagation(),u(t,r))});return{update(t){if(i=t,!a)return;let r=a,o=Qn(t,r.anchorLine,n.getLineCount());if(!o){c();return}r.change=o,r.zone.afterLineNumber=$n(o,n.getLineCount()),r.zone.heightInPx=ir+er(o)*e.getOption(T.EditorOption.lineHeight);try{e.changeViewZones(e=>e.layoutZone(r.zoneId))}catch{c();return}l(r)},dispose(){o=!0,d.dispose(),c()}}}var cr={added:`puddle-dirty-added`,modified:`puddle-dirty-modified`,"deleted-before":`puddle-dirty-deleted-before`,"deleted-after":`puddle-dirty-deleted-after`};function lr(e,t,n,r){let i=ce(),a=Ce(e,t,{root:n,enabled:i.data!==void 0&&le(i.data.protocol)&&r!==null}),[o,s]=(0,E.useState)(null),c=(0,E.useCallback)(e=>{s(e)},[]);return(0,E.useEffect)(()=>{let e=a.data;if(!o||!r||!e||e.repository===null||e.ignored||e.binary)return;let n=document.createElement(`div`);n.className=`puddle-hidden-diff-controller`,document.body.appendChild(n);let i=T.createModel(e.exists?e.content??``:``,r.getLanguageId()),s=T.createDiffEditor(n,{readOnly:!0,automaticLayout:!1,renderSideBySide:!1,minimap:{enabled:!1}}),c=o.createDecorationsCollection();s.setModel({original:i,modified:r});let l=sr({editor:o,original:i,modified:r,path:t}),u=()=>{let e=s.getLineChanges();e&&(l.update(e),c.set(rr(e,r.getLineCount()).map(e=>({range:new C(e.startLineNumber,1,e.endLineNumber,1),options:{isWholeLine:!0,linesDecorationsClassName:cr[e.kind]}}))))},d=s.onDidUpdateDiff(u);return u(),()=>{d.dispose(),l.dispose(),c.clear(),s.setModel(null),s.dispose(),i.dispose(),n.remove()}},[o,r,a.data]),c}function ur({message:e,session:t,path:n,root:r,download:i}){return(0,D.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 bg-ground text-sm text-fg-muted`,children:[(0,D.jsx)(`span`,{children:e}),i&&(0,D.jsxs)(`button`,{type:`button`,onClick:()=>void ge(t,n,r).catch(e=>re.error(e instanceof Error?e.message:`Download failed`)),className:`flex items-center gap-1.5 text-fg-secondary transition-colors hover:text-fg`,children:[(0,D.jsx)(Re,{className:`size-4`}),`Download`]})]})}function dr({session:e,path:t,reveal:n,root:r,focused:i=!0,scrollDriver:a=!1,scrollReceiver:o=!1,scrollChannel:s=`profile`}){let c=h(),l=_n([e,r,t]),u=Zn(e,t,n,r,{focused:i}),d=ye(e,t,r),f=lr(e,t,r,u.model),p=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),[m,g]=(0,E.useState)(null),_=(0,E.useMemo)(()=>({session:e,path:t,root:r}),[e,t,r]),v=u.conflict!==null&&u.conflict.phase!==`unresolved`;if((0,E.useEffect)(()=>{if(!(!m||!u.model||v))return Wn(m,{channel:s,target:_,driver:a,receiver:o},T.ScrollType.Immediate)},[m,u.model,v,s,_,a,o]),(0,E.useEffect)(()=>{let e=u.model;e&&T.setModelMarkers(e,`puddle-compilation`,d.map(t=>{let n=Math.min(t.line,e.getLineCount()),r=e.getLineMaxColumn(n),i=Math.min(t.column??1,r),a=t.end_line??n,o=Math.max(n,Math.min(a,e.getLineCount())),s=e.getLineMaxColumn(o),c=Math.min(t.end_column??(t.column?i+1:s),s);return{severity:t.severity===`error`?S.Error:t.severity===`warning`?S.Warning:S.Info,message:t.message,source:`Puddle compilation`,startLineNumber:n,startColumn:i,endLineNumber:o,endColumn:Math.max(i,c)}}))},[u.model,d]),u.conflict&&u.conflict.phase!==`unresolved`)return(0,D.jsx)(bn,{session:e,path:t,buffer:u,focused:i});if(u.status===`binary`)return(0,D.jsx)(ur,{message:`Binary file — use Download`,session:e,path:t,root:r,download:!0});if(u.status===`too-large`)return(0,D.jsx)(ur,{message:`File too large to edit — use Download`,session:e,path:t,root:r,download:!0});if(u.status===`error`)return(0,D.jsx)(ur,{message:u.errorMessage??`Failed to load file`,session:e,path:t,root:r});let y=u.peerBadge===`saved-elsewhere`?`Saved in another window`:u.peerBadge===`dirty-elsewhere`?`Also being edited in another window`:null;return(0,D.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[u.restoredNotice&&(0,D.jsxs)(`div`,{className:`flex items-center gap-3 bg-elevated px-3 py-1.5 text-xs text-fg-secondary`,children:[(0,D.jsx)(`span`,{children:`Restored unsaved changes`}),(0,D.jsx)(`button`,{type:`button`,onClick:u.discardRestore,className:`text-fg-muted transition-colors hover:text-fg`,children:`Discard`})]}),y&&(0,D.jsx)(`div`,{className:`bg-surface px-3 py-1 text-xs text-fg-muted`,children:y}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:u.model&&(0,D.jsx)(xt,{path:u.model.uri.toString(),defaultValue:u.model.getValue(),theme:`puddle`,keepCurrentModel:!0,saveViewState:!1,onMount:e=>{l(e),u.onMount(e),f(e),g(e)},loading:(0,D.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),options:{automaticLayout:!0,fontFamily:p,fontSize:c.editorFontSize,...un(c.editorTabSize),wordWrap:c.editorWordWrap?`on`:`off`,minimap:{enabled:!1},glyphMargin:!1,lineDecorationsWidth:10,fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}function O({children:e}){return(0,D.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-xs text-fg-muted`,children:e})}function fr(e,t){let n=(0,E.useRef)(t);n.current=t,(0,E.useEffect)(()=>(yt(e),()=>{n.current?.(),wt(e)}),[e])}function pr(e,t,n,r){let i=r.split(`/`).map(encodeURIComponent).join(`/`);return`${e}://${encodeURIComponent(t)}/${encodeURIComponent(n)}/${i}`}function mr({session:e,refName:t,path:n,content:r}){let i=h(),a=_n([e,t,n]),o=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,D.jsx)(xt,{path:pr(`puddle-view`,e,t,n),defaultValue:r,theme:bt,saveViewState:!1,onMount:a,loading:(0,D.jsx)(O,{children:`…`}),options:{readOnly:!0,automaticLayout:!0,fontFamily:o,fontSize:i.editorFontSize,...un(i.editorTabSize),minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function hr({session:e,against:t,path:n,root:r,indexBase:i=!1}){let a=he(e,t,n,{root:r,enabled:!i}),o=ve(e,n,{root:r,enabled:i}),s=i?o:a;return s.isPending?(0,D.jsx)(O,{children:`…`}):s.error?(0,D.jsx)(O,{children:s.error instanceof Error?s.error.message:`Failed to load`}):s.data.binary?(0,D.jsx)(O,{children:`Binary file — deleted`}):(0,D.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,D.jsx)(`div`,{className:`bg-surface px-4 py-1 text-xs text-fg-muted`,children:`Deleted`}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,D.jsx)(mr,{session:e,refName:`${t}:${r??``}`,path:n,content:s.data.content??``})})]})}function gr({session:e,against:t,path:n,basePath:r,root:i,indexBase:a=!1,focused:o=!0}){let s=h(),c=vn([e,i,t,a,n]),l=Zn(e,n,null,i,{focused:o}),u=he(e,t,r,{root:i,enabled:!a}),d=ve(e,r,{root:i,enabled:a}),f=a?d:u,p=(0,E.useRef)(null);fr(Ot(e,n,i),()=>{let e=p.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),p.current=null});let m=(0,E.useRef)(l.save);m.current=l.save;let g=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),_=f.error instanceof ie&&f.error.status===404;return l.conflict&&l.conflict.phase!==`unresolved`?(0,D.jsx)(bn,{session:e,path:n,buffer:l,focused:o}):l.status===`binary`||f.data?.binary?(0,D.jsx)(O,{children:`Binary file`}):l.status===`too-large`?(0,D.jsx)(O,{children:`File too large to show`}):l.status===`error`?(0,D.jsx)(O,{children:l.errorMessage??`Failed to load file`}):_||a&&d.data&&!d.data.exists?(0,D.jsx)(dr,{session:e,path:n,reveal:null,root:i,focused:o}):f.isPending||!l.model?(0,D.jsx)(O,{children:`…`}):f.error?(0,D.jsx)(O,{children:f.error instanceof Error?f.error.message:`Failed to load base`}):(0,D.jsx)(Tt,{modifiedModelPath:l.model.uri.toString(),originalModelPath:pr(`puddle-base`,e,`${t}:${i??``}`,r),original:f.data.content??``,language:l.model.getLanguageId(),theme:bt,keepCurrentModifiedModel:!0,loading:(0,D.jsx)(O,{children:`…`}),onMount:e=>{c(e),p.current=e,e.onDidDispose(()=>{p.current=null}),e.getModifiedEditor().addCommand(w.CtrlCmd|ee.KeyS,()=>m.current())},options:{readOnly:!1,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:g,fontSize:s.editorFontSize,...un(s.editorTabSize),wordWrap:s.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function _r({session:e,against:t,entry:n,root:r}){let i=h(),a=vn([e,r,t,`staged`,n.path]),o=n.old_path??n.path,s=he(e,t,o,{root:r,enabled:n.status!==`added`}),c=ve(e,n.path,{root:r,enabled:n.status!==`deleted`}),l=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);if(n.status===`deleted`)return(0,D.jsx)(hr,{session:e,against:t,path:o,root:r});if(c.isPending||n.status!==`added`&&s.isPending)return(0,D.jsx)(O,{children:`…`});if(c.error||s.error){let e=c.error??s.error;return(0,D.jsx)(O,{children:e instanceof Error?e.message:`Failed to load staged content`})}return c.data.binary||s.data?.binary?(0,D.jsx)(O,{children:`Binary file`}):n.status===`added`?(0,D.jsx)(mr,{session:e,refName:`index:${r??``}`,path:n.path,content:c.data.content??``}):s.data?(0,D.jsx)(Tt,{originalModelPath:pr(`puddle-head`,e,`${t}:${r??``}`,o),modifiedModelPath:pr(`puddle-index`,e,`${t}:${r??``}`,n.path),original:s.data.content??``,modified:c.data.content??``,onMount:a,theme:bt,loading:(0,D.jsx)(O,{children:`…`}),options:{readOnly:!0,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:l,fontSize:i.editorFontSize,...un(i.editorTabSize),wordWrap:i.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}}):(0,D.jsx)(O,{children:`Failed to load HEAD content`})}function vr({session:e,path:t,root:n,focused:r}){return fr(Ot(e,t,n)),(0,D.jsx)(dr,{session:e,path:t,reveal:null,root:n,focused:r})}function yr({session:e,against:t,entry:n,root:r,area:i,focused:a=!0}){if(i===`staged`)return(0,D.jsx)(_r,{session:e,against:t,entry:n,root:r});switch(n.status){case`added`:return(0,D.jsx)(vr,{session:e,path:n.path,root:r,focused:a});case`deleted`:return(0,D.jsx)(hr,{session:e,against:t,path:n.path,root:r,indexBase:i===`unstaged`});case`modified`:case`renamed`:return(0,D.jsx)(gr,{session:e,against:t,path:n.path,basePath:n.old_path??n.path,root:r,indexBase:i===`unstaged`,focused:a});default:return null}}function br({session:e,sha:t,path:n,root:r}){let i=he(e,t,n,{root:r});return i.isPending?(0,D.jsx)(O,{children:`…`}):i.error?(0,D.jsx)(O,{children:i.error instanceof Error?i.error.message:`Failed to load file`}):i.data.binary?(0,D.jsx)(O,{children:`Binary file`}):(0,D.jsx)(mr,{session:e,refName:`${t}:${r??``}`,path:n,content:i.data.content??``})}function xr({session:e,originalRef:t,originalPath:n,originalContent:r,modifiedRef:i,modifiedPath:a,modifiedContent:o,root:s}){let c=h(),l=vn([e,s,t,n,i,a]),u=(0,E.useRef)(null),d=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,E.useEffect)(()=>()=>{let e=u.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),t?.modified.dispose(),u.current=null},[]),(0,D.jsx)(Tt,{originalModelPath:pr(`puddle-hist-orig`,e,`${t}:${s??``}`,n),modifiedModelPath:pr(`puddle-hist-mod`,e,`${i}:${s??``}`,a),original:r,modified:o,theme:bt,keepCurrentOriginalModel:!0,keepCurrentModifiedModel:!0,loading:(0,D.jsx)(O,{children:`…`}),onMount:e=>{l(e),u.current=e,e.onDidDispose(()=>{u.current=null})},options:{readOnly:!0,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:d,fontSize:c.editorFontSize,...un(c.editorTabSize),minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function Sr({session:e,sha:t,path:n,basePath:r,root:i}){let a=he(e,`${t}^`,r,{root:i}),o=he(e,t,n,{root:i});return a.error instanceof ie&&a.error.status===404?(0,D.jsx)(br,{session:e,sha:t,path:n,root:i}):a.isPending||o.isPending?(0,D.jsx)(O,{children:`…`}):a.error?(0,D.jsx)(O,{children:a.error instanceof Error?a.error.message:`Failed to load original`}):o.error?(0,D.jsx)(O,{children:o.error instanceof Error?o.error.message:`Failed to load file`}):a.data.binary||o.data.binary?(0,D.jsx)(O,{children:`Binary file`}):(0,D.jsx)(xr,{session:e,originalRef:`${t}^`,originalPath:r,originalContent:a.data.content??``,modifiedRef:t,modifiedPath:n,modifiedContent:o.data.content??``,root:i})}function Cr({session:e,sha:t,entry:n,isRootCommit:r,root:i}){switch(Ve(n.status,r)){case`added`:return(0,D.jsx)(br,{session:e,sha:t,path:n.path,root:i});case`deleted`:return(0,D.jsx)(hr,{session:e,against:`${t}^`,path:n.path,root:i});case`modified`:case`renamed`:return(0,D.jsx)(Sr,{session:e,sha:t,path:n.path,basePath:n.old_path??n.path,root:i});default:return null}}function wr({session:e,sha:t,path:n,root:r}){let i=Se(e,t,r);if(i.isPending)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading commit…`});if(i.error)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:i.error instanceof Error?i.error.message:`Failed to load commit`});let a=i.data.files.find(e=>e.path===n);return a?(0,D.jsx)(`div`,{className:`h-full`,children:(0,D.jsx)(Cr,{session:e,sha:t,entry:a,isRootCommit:i.data.parents.length===0,root:r})}):(0,D.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[(0,D.jsx)(`span`,{className:`text-fg-secondary`,children:n}),` is not part of`,` `,(0,D.jsx)(`span`,{className:`font-mono`,children:t.slice(0,7)}),`.`]})}function Tr({session:e,path:t,root:n,area:r,focused:i=!0}){let a=_e(e,{root:n,against:r===void 0?`base`:`head`,area:r});if(a.isPending)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading diff…`});if(a.error)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:a.error instanceof Error?a.error.message:`Failed to load diff`});let o=a.data.entries.find(e=>e.path===t);return o?(0,D.jsx)(`div`,{className:`h-full`,children:(0,D.jsx)(yr,{session:e,against:a.data.against,entry:o,root:n,area:r,focused:i})}):(0,D.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[`No changes to `,(0,D.jsx)(`span`,{className:`mx-1 text-fg-secondary`,children:t}),` against the base.`]})}var Er=800;function Dr({name:e}){let t=h(),n=ue(),r=_n([n,e]),i=pe(n,e),a=oe(),o=ae(`editor.save`),s=(0,E.useRef)(null),c=(0,E.useRef)(null),l=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);if((0,E.useEffect)(()=>{if(n===null)return;let t=pt(t=>{He(n,e,t).catch(e=>re.error(e instanceof Error?e.message:`Draft not saved`))},Er);return c.current=t,()=>{t.flush(),c.current=null}},[n,e]),n===null)return null;if(i.error)return(0,D.jsx)(`div`,{className:`flex h-full items-center justify-center bg-ground text-sm text-fg-muted`,children:i.error instanceof Error?i.error.message:`Failed to load the draft`});if(i.data===void 0)return(0,D.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`});let u=()=>{let t=s.current;t&&(c.current?.flush(),ke({name:e,content:t.getValue()}))};return(0,D.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[(0,D.jsxs)(`div`,{className:`bg-surface px-3 py-1 text-xs text-fg-muted`,children:[`Draft — not in any worktree; `,o,` saves it into one`]}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,D.jsx)(xt,{path:`puddle-untitled://${n}/${e}`,defaultValue:i.data.content,theme:bt,keepCurrentModel:!1,saveViewState:!1,loading:(0,D.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),onMount:t=>{r(t),s.current=t,Ae(e,t.getValue()),qn(t,{onSave:u})},onChange:t=>{let r=t??``;Ae(e,r),xe(a,n,e,r),c.current?.(r)},options:{automaticLayout:!0,fontFamily:l,fontSize:t.editorFontSize,...un(t.editorTabSize),minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1,wordWrap:t.editorWordWrap?`on`:`off`}})})]})}var Or=u([d(),l(d())]),kr=a(d(),f()),Ar=o({output_type:d(),text:Or.optional(),data:a(d(),f()).optional(),traceback:l(d()).optional(),ename:d().optional(),evalue:d().optional()}),jr=o({id:d().optional(),cell_type:c([`code`,`markdown`,`raw`]),metadata:kr,source:Or,outputs:l(Ar).optional(),execution_count:m().int().nullable().optional()}),Mr=o({nbformat:i(4),nbformat_minor:m().int().nonnegative(),metadata:kr,cells:l(jr).max(2e3)});function Nr(e){if(e.length>5*1024*1024)throw Error(`This notebook exceeds the 5 MiB editor limit.`);let t;try{t=JSON.parse(e)}catch{throw Error(`This notebook is not valid JSON. Switch to source to repair it.`)}let n=Mr.safeParse(t);if(!n.success)throw Error(`Expected a version 4 notebook with at most 2,000 valid cells. Switch to source to inspect it.`);return n.data}function k(e){return typeof e==`string`?e:Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(``):``}function Pr(e,t,n){return{...e,cells:e.cells.map((e,r)=>r===t?{...e,source:n.match(/[^\n]*\n|[^\n]+$/g)??[],...e.cell_type===`code`?{outputs:[],execution_count:null}:{}}:e)}}function Fr(e){return{id:crypto.randomUUID(),cell_type:e,metadata:{},source:[],...e===`code`?{outputs:[],execution_count:null}:{}}}function Ir(e){return(e.output_type===`error`?e.traceback?.join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PdfViewer-DAAfA9OC.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-ffCh33zF.js","assets/auth-BxExwqPW.js","assets/preload-helper-Czpn1I53.js","assets/dist-7fft9rhQ.js","assets/createLucideIcon-DyMAgLa3.js","assets/scroll-restoration-hg7BYUz2.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{t as n}from"./react-CZI7_Jkm.js";import{t as r}from"./jsx-runtime-ffCh33zF.js";import{G as i,J as a,K as o,S as s,U as c,W as l,X as u,Y as d,Z as f,o as p,q as m}from"./auth-BxExwqPW.js";import{i as h,r as g,t as _}from"./client-settings-CwqpIric.js";import{t as v}from"./preload-helper-Czpn1I53.js";import{a as y,r as b}from"./index-BRywm-gU.js";import{t as x}from"./purify.es-D8QhFVkO.js";import"./katex.min-ZqdHjttS.js";import{a as S,c as C,i as w,p as T,r as ee}from"./editor.api2-4X9Vh9Zw.js";import{a as te,i as ne,n as re,r as ie}from"./dist-7fft9rhQ.js";import{E as ae,It as oe,Nt as se,Y as ce,f as le,k as ue,u as de,x as fe}from"./protocol-support-gmAQBWF3.js";import{C as pe,E as me,H as he,I as ge,J as _e,K as ve,M as ye,R as be,S as xe,V as Se,W as Ce,Y as we,a as Te,at as Ee,et as De,f as Oe,g as ke,h as Ae,i as je,it as Me,k as Ne,n as Pe,nt as Fe,q as Ie,r as Le,rt as Re,tt as ze,u as Be,w as Ve,x as He}from"./media-refresh-store-DLtYZTP9.js";import{t as Ue}from"./x-DCpy1q13.js";import{n as We,r as Ge}from"./dist-BCwJL3w9.js";import{t as Ke}from"./createLucideIcon-DyMAgLa3.js";import{a as qe,i as Je,n as Ye,r as Xe,t as Ze}from"./select-YFIOZ3zx.js";import{a as Qe,i as $e,n as et,t as tt}from"./FindWidget-BSK2PIfO.js";import{t as nt}from"./code-DRWf9a5s.js";import{t as rt}from"./rotate-ccw-CNjR2LSi.js";import{n as it,r as at,t as ot}from"./popover-C-BfSLgw.js";import{a as st,i as ct,n as lt,o as ut,r as dt,t as ft}from"./preview-kind-CJ9RTgbs.js";import{t as pt}from"./debounce-B9DrqirV.js";import{i as mt,n as ht,r as gt,t as _t}from"./drafts-B_tChlzR.js";import{a as vt,c as yt,d as bt,f as xt,i as St,l as Ct,o as wt,p as Tt,r as Et,s as Dt,t as Ot,u as kt}from"./buffer-store-CYe-IdNO.js";import{r as At}from"./buffer-logic-BAkSBQT7.js";import{a as jt,i as Mt,n as Nt,o as Pt,r as Ft}from"./editor-sync-W1bamxAP.js";import{i as It,n as Lt,t as Rt}from"./scroll-restoration-hg7BYUz2.js";import{r as zt,t as Bt}from"./math-CSw6sgCC.js";import{n as Vt,r as Ht}from"./math-delimiters-BCnTi7Ii.js";import{n as Ut}from"./markdown-mermaid-CF9txXiK.js";var Wt=Ke(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Gt=Ke(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),E=t(n(),1),Kt=new Map,qt=new Map,Jt=1;function Yt(e){for(let t of qt.get(e)??[])t()}function Xt(e,t){Kt.set(e,t),Yt(e)}function Zt(e){let t={phase:`unresolved`,revision:Jt++};return Xt(e,t),t}function Qt(e){let t=Kt.get(e);return!t||t.phase!==`unresolved`&&t.phase!==`load-error`?null:(Xt(e,{phase:`loading`,revision:t.revision}),t.revision)}function $t(e,t,n,r){let i=Kt.get(e);return!i||i.phase!==`loading`||i.revision!==t?!1:(Xt(e,{phase:`opening`,revision:t,content:n,mtimeMs:r}),!0)}function en(e,t){let n=Kt.get(e);return!n||n.phase!==`opening`||n.revision!==t?!1:(Xt(e,{...n,phase:`comparing`}),!0)}function tn(e,t,n){let r=Kt.get(e);return!r||r.phase!==`loading`||r.revision!==t?!1:(Xt(e,{phase:`load-error`,revision:t,message:n}),!0)}function nn(e,t){return t&&e?.phase===`unresolved`}function rn(e){return e?.phase===`comparing`?e.mtimeMs:void 0}function an(e){return e?.phase===`loading`||e?.phase===`load-error`||e?.phase===`opening`}function on(e){return e.phase===`opening`||e.phase===`comparing`}function sn(e){Kt.delete(e)&&Yt(e)}function cn(e){return Kt.get(e)??null}function ln(e,t){let n=qt.get(e);return n||(n=new Set,qt.set(e,n)),n.add(t),()=>n.delete(t)}function un(e){return{tabSize:e,insertSpaces:!0,detectIndentation:!1}}var dn=new Lt,fn=new Lt;function pn(e){let t={...e.contributionsState};return delete t[`editor.contrib.wordHighlighter`],{...e,contributionsState:t}}function mn(e,t){let n=(0,E.useRef)(null),r=(0,E.useRef)(null);return(0,E.useLayoutEffect)(()=>(n.current&&(r.current=t(n.current,e)),()=>{r.current?.(),r.current=null}),[e,t]),(0,E.useCallback)(i=>{r.current?.(),n.current=i,i.onDidDispose(()=>{n.current===i&&(n.current=null)}),r.current=t(i,e)},[e,t])}function hn(e,t){let n=dn.get(t);n&&e.restoreViewState(n);let r=()=>{if(!e.getModel())return;let n=e.saveViewState();n&&dn.set(t,pn(n))},i=[e.onDidScrollChange(r),e.onDidChangeCursorSelection(r)];return()=>{r(),i.forEach(e=>e.dispose())}}function gn(e,t){let n=fn.get(t),r=n!==void 0,i=()=>{if(r||!e.getModel())return;let n=e.saveViewState();n&&fn.set(t,{...n,original:n.original&&pn(n.original),modified:n.modified&&pn(n.modified)})};n&&e.restoreViewState(n);let a=[e.onDidUpdateDiff(()=>{r&&(r=!1,n&&e.restoreViewState(n))}),...[e.getOriginalEditor(),e.getModifiedEditor()].flatMap(e=>[e.onDidScrollChange(i),e.onDidChangeCursorSelection(i)])];return()=>{i(),a.forEach(e=>e.dispose())}}function _n(e){return mn(It(`code`,e),hn)}function vn(e){return mn(It(`diff`,e),gn)}var D=r();function yn({session:e,path:t,conflict:n,model:r,onTakeDisk:i,onKeepMine:a,onSave:o,onReady:s}){let c=h(),l=vn([`conflict`,r.uri.toString()]),u=(0,E.useId)(),d=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),f=(0,E.useRef)(o);f.current=o;let p=(0,E.useRef)(null),m=()=>{let e=p.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),p.current=null},g=(0,E.useRef)(m);return g.current=m,(0,E.useEffect)(()=>()=>g.current(),[]),(0,D.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3 bg-elevated px-3 py-1.5 text-xs text-fg-secondary`,children:[(0,D.jsx)(`span`,{children:`This file changed on disk. Yours is on the right — merge what you want, then save.`}),(0,D.jsx)(`button`,{type:`button`,onClick:i,className:`ml-auto shrink-0 text-fg-muted transition-colors hover:text-fg`,children:`Take the disk version`}),(0,D.jsx)(`button`,{type:`button`,onClick:a,disabled:n.phase!==`comparing`,className:`shrink-0 text-fg-muted transition-colors hover:text-fg`,children:`Keep mine`})]}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,D.jsx)(Tt,{modifiedModelPath:r.uri.toString(),originalModelPath:`puddle-disk://${encodeURIComponent(e)}/${n.mtimeMs}/${encodeURIComponent(u)}/${t.split(`/`).map(encodeURIComponent).join(`/`)}`,original:n.content,language:r.getLanguageId(),theme:bt,keepCurrentModifiedModel:!0,loading:(0,D.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),onMount:e=>{l(e),p.current=e,e.onDidDispose(()=>{p.current=null}),e.getModifiedEditor().addCommand(w.CtrlCmd|ee.KeyS,()=>f.current()),s?.(n.revision)},options:{readOnly:n.phase!==`comparing`,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:d,fontSize:c.editorFontSize,...un(c.editorTabSize),wordWrap:c.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}function bn({session:e,path:t,buffer:n,focused:r}){let i=n.conflict;return!i||i.phase===`unresolved`?null:on(i)&&n.model?(0,D.jsx)(yn,{session:e,path:t,conflict:i,model:n.model,onTakeDisk:n.takeDisk,onKeepMine:n.keepMine,onSave:n.save,onReady:r?n.comparisonReady:void 0}):i.phase===`load-error`?(0,D.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 bg-ground px-4 text-center text-sm text-fg-muted`,children:[(0,D.jsx)(`span`,{children:`The disk version could not be loaded.`}),(0,D.jsx)(`span`,{className:`max-w-lg text-xs text-fg-secondary`,children:i.message}),(0,D.jsx)(`button`,{type:`button`,onClick:n.compare,className:`rounded-md bg-elevated px-3 py-1.5 text-xs text-fg-secondary transition-colors hover:bg-border hover:text-fg`,children:`Retry compare`})]}):(0,D.jsx)(`div`,{className:`flex h-full items-center justify-center bg-ground text-sm text-fg-muted`,children:`Loading the disk version…`})}var xn=`data-puddle-source-line`,Sn=`data-puddle-source-end-line`,Cn=`data-puddle-source-line-count`;function wn(e){return Number.isFinite(e.line)&&Number.isFinite(e.offset)}function Tn(e){let t=e.filter(wn).map(({line:e,offset:t})=>({line:Math.max(1,e),offset:Math.max(0,t)})).sort((e,t)=>e.offset-t.offset||e.line-t.line),n=[];for(let e of t){let t=n.at(-1);t&&(e.line<t.line||e.offset<t.offset)||t&&(e.line===t.line||e.offset===t.offset)||n.push(e)}return n}function En(e,t,n,r,i){return n<=t?r:r+Math.min(1,Math.max(0,(e-t)/(n-t)))*(i-r)}function Dn(e,t,n){if(e.length===0)return null;if(t<=e[0][n])return[e[0],e[0]];let r=e.at(-1);if(t>=r[n])return[r,r];let i=0,a=e.length-1;for(;i+1<a;){let r=Math.floor((i+a)/2);e[r][n]<=t?i=r:a=r}return[e[i],e[a]]}function On(e,t){let n=Dn(e,t,`line`);return n?En(t,n[0].line,n[1].line,n[0].offset,n[1].offset):null}function kn(e,t){let n=Dn(e,t,`offset`);return n?En(t,n[0].offset,n[1].offset,n[0].line,n[1].line):null}function An(e,t){let n=Number(e.getAttribute(t));return Number.isFinite(n)&&n>=1?n:null}function jn(e,t,n){let r=e.getBoundingClientRect().top,i=[{line:1,offset:0}];for(let a of t.querySelectorAll(`[${xn}]`)){let t=An(a,xn);if(t===null||t>n+1||a.getClientRects().length===0)continue;let o=a.getBoundingClientRect(),s=o.top-r+e.scrollTop;i.push({line:t,offset:s});let c=An(a,Sn);c!==null&&c<=n+1&&c>t&&o.height>0&&i.push({line:c,offset:s+o.height})}return i.push({line:Math.max(1,n+1),offset:e.scrollHeight}),Tn(i)}function Mn(e){return e===``?1:e.split(/\r\n?|\n/).length}function Nn(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):0}function Pn(e,t,n){return Nn(e/Math.max(1,t-n))}function Fn(e,t,n){return Nn(e)*Math.max(0,t-n)}function In(e,t){return JSON.stringify([e,t.session,t.root??null,t.path])}var Ln=new class{positions=new Map;listeners=new Map;revision=0;publish(e,t,n,r=null){let i={ratio:Nn(n),sourceLine:r!==null&&Number.isFinite(r)?Math.max(1,r):null,revision:++this.revision},a=In(e,t);this.positions.set(a,i);for(let e of this.listeners.get(a)??[])e(i);return i}get(e,t){return this.positions.get(In(e,t))}subscribe(e,t,n){let r=In(e,t),i=this.listeners.get(r);i||(i=new Set,this.listeners.set(r,i)),i.add(n);let a=this.positions.get(r);return a&&n(a),()=>{i?.delete(n),i?.size===0&&this.listeners.delete(r)}}},Rn=new Lt;function zn(e){let t=null;return{schedule:()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))},dispose:()=>{t!==null&&cancelAnimationFrame(t),t=null}}}function Bn(e,t,n,r){let i=Math.max(0,t-n);if(e.ratio<=0)return 0;if(e.ratio>=1)return i;if(e.sourceLine!==null&&r){let t=On(r,e.sourceLine);if(t!==null)return Math.min(i,Math.max(0,t))}return Fn(e.ratio,t,n)}function Vn(e,t){if(t.driver&&t.receiver)throw Error(`a preview scroll surface cannot be both driver and receiver`);let n=t.store??Ln,r=t.viewKey?Rn.get(t.viewKey):void 0,i=t.sourceAnchors?.(),a=()=>void 0,o,s=n=>{r=n,t.viewKey&&Rn.set(t.viewKey,n),e.scrollTop=Bn(n,e.scrollHeight,e.clientHeight,i)};r&&s(r);let c=()=>{if(e.clientHeight<=0)return;let a=Pn(e.scrollTop,e.scrollHeight,e.clientHeight),o=i?kn(i,e.scrollTop):null;r={ratio:a,sourceLine:o,revision:0},t.viewKey&&Rn.set(t.viewKey,r),t.driver&&n.publish(t.channel,t.target,a,o)};t.receiver?a=n.subscribe(t.channel,t.target,s):(t.driver||t.viewKey)&&(o=zn(c),e.addEventListener(`scroll`,o.schedule,{passive:!0}),o.schedule());let l=new ResizeObserver(()=>{i=t.sourceAnchors?.(),r?s(r):o?.schedule()});for(let e of t.resizeElements??[])l.observe(e);return()=>{o&&(c(),e.removeEventListener(`scroll`,o.schedule)),a(),l.disconnect(),o?.dispose()}}function Hn(e,t){let n=e.getModel()?.getLineCount()??0;if(n===0)return null;let r=1,i=n;for(;r<i;){let n=Math.ceil((r+i)/2);e.getTopForLineNumber(n)<=t?r=n:i=n-1}let a=e.getTopForLineNumber(r),o=r<n?e.getTopForLineNumber(r+1):e.getScrollHeight();return o<=a?r:r+Math.min(1,Math.max(0,(t-a)/(o-a)))}function Un(e,t){let n=e.getModel()?.getLineCount()??0;if(n===0||!Number.isFinite(t))return null;let r=Math.min(n+1,Math.max(1,t)),i=Math.floor(r);if(i>n)return e.getScrollHeight();let a=i+1,o=e.getTopForLineNumber(i),s=a<=n?e.getTopForLineNumber(a):e.getScrollHeight();return o+(r-i)*(s-o)}function Wn(e,t,n){if(t.driver&&t.receiver)throw Error(`a Monaco scroll surface cannot be both driver and receiver`);let r=t.store??Ln,i=[],a,o=()=>void 0,s,c=()=>e.getLayoutInfo().height,l=t=>{a=t;let r=t.ratio>0&&t.ratio<1&&t.sourceLine!==null?Un(e,t.sourceLine):null;e.setScrollTop(r??Bn(t,e.getScrollHeight(),c()),n)};return t.receiver?(o=r.subscribe(t.channel,t.target,l),i.push(e.onDidChangeModel(()=>a&&l(a))),i.push(e.onDidLayoutChange(()=>a&&l(a))),i.push(e.onDidContentSizeChange(()=>a&&l(a)))):t.driver&&(s=zn(()=>{let n=Pn(e.getScrollTop(),e.getScrollHeight(),c());r.publish(t.channel,t.target,n,Hn(e,e.getScrollTop()))}),i.push(e.onDidScrollChange(s.schedule)),i.push(e.onDidChangeModel(s.schedule)),i.push(e.onDidChangeModelContent(s.schedule)),i.push(e.onDidLayoutChange(s.schedule)),i.push(e.onDidContentSizeChange(s.schedule)),s.schedule()),()=>{o();for(let e of i)e.dispose();s?.dispose()}}function Gn(e){return!e}function Kn(e){let t=e.split(`+`),n=t.pop()??``,r=0;for(let e of t)e===`meta`?r|=w.CtrlCmd:e===`ctrl`?r|=w.WinCtrl:e===`alt`?r|=w.Alt:e===`shift`&&(r|=w.Shift);let i=ee[/^Key[A-Z]$/.test(n)?`Key${n.slice(3)}`:/^Digit[0-9]$/.test(n)?`Digit${n.slice(5)}`:n];return typeof i==`number`?r|i:null}function qn(e,t){let n=Kn(fe(`editor.save`));n!==null&&e.addCommand(n,()=>t.onSave());let r=Kn(fe(`editor.wordWrap`));e.addAction({id:`puddle.toggleWordWrap`,label:`Toggle Word Wrap`,keybindings:r===null?[]:[r],run:()=>g({editorWordWrap:Gn(_().editorWordWrap)})})}var Jn=new WeakSet;function Yn(e){return Jn.has(e)?!1:(Jn.add(e),!0)}function Xn(e){return`file-conflict:${e}`}function Zn(e,t,n,r,i){let a=i?.passive===!0,o=i?.focused??!0,s=Ot(e,t,r),c=we(e,t,{root:r,live:i?.live}),l=Ie(e,r),[u,d]=(0,E.useState)(null),[f,p]=(0,E.useState)(!1),m=(0,E.useRef)(!1),h=(0,E.useRef)(null),g=(0,E.useRef)(null),_=(0,E.useRef)(n);_.current=n;let v=(0,E.useRef)(!1),y=(0,E.useCallback)((e,t)=>{g.current?.cancel(),v.current=!0;try{Dt(s,e,t)}finally{v.current=!1}},[s]),b=(0,E.useSyncExternalStore)((0,E.useCallback)(e=>kt(s,e),[s]),()=>St(s)),x=(0,E.useSyncExternalStore)((0,E.useCallback)(e=>Pt(s,e),[s]),()=>jt(s)),S=(0,E.useSyncExternalStore)((0,E.useCallback)(e=>ln(s,e),[s]),()=>cn(s));(0,E.useEffect)(()=>{let n=c.data;if(!n||n.binary||n.content===null||m.current)return;m.current=!0;let i=Ct(s)!==void 0,a=Et(e,t,n.content,n.mtime_ms,r),o=a.getValue();d(a),!i&&mt(e,t,r).then(i=>{if(!i)return;let s=ht(i,o,n.mtime_ms);s===`discard`?_t(e,t,r):s===`restore`?At(a,i.content)&&p(!0):re(`This file has an unsaved draft from an earlier version.`,{description:`The file changed on disk since the draft was saved.`,duration:12e3,action:{label:`Restore draft`,onClick:()=>{At(a,i.content)&&p(!0)}}})})},[c.data,s,e,t,r]),(0,E.useEffect)(()=>{if(!u||a)return;let n=gt(e,t,r);g.current=n;let i=u.onDidChangeContent(()=>{v.current||(n(u.getValue(),Ct(s)??0),Nt(e,t,r))});return()=>{n.flush(),i.dispose(),g.current=null}},[u,s,e,t,r,a]),(0,E.useEffect)(()=>{!u||!x.savedElsewhere||St(s)||c.refetch().then(e=>{St(s)||(e.data&&e.data.content!==null&&y(e.data.content,e.data.mtime_ms),Mt(s))})},[x.savedElsewhere,u,s]),(0,E.useEffect)(()=>{let e=c.data;!u||!e||e.content===null||!St(s)&&e.mtime_ms!==Ct(s)&&y(e.content,e.mtime_ms)},[c.data,u,s]);let C=(0,E.useCallback)((n,i)=>{vt(s,n,i),g.current?.cancel(),_t(e,t,r),Ft(e,t,i,r),p(!1),sn(s)},[s,e,t,r]),w=(0,E.useCallback)(()=>{let e=Qt(s);e!==null&&(re.dismiss(Xn(s)),c.refetch({throwOnError:!0}).then(t=>{let n=t.data;if(!n)throw Error(`The disk version did not load.`);if(n.content===null)throw Error(`The file on disk is binary and cannot be compared as text.`);$t(s,e,n.content,n.mtime_ms)}).catch(t=>{tn(s,e,t instanceof Error?t.message:`The disk version did not load.`)}))},[c,s]),T=(0,E.useRef)(w);T.current=w,(0,E.useEffect)(()=>{if(!nn(S,o))return;let e=Xn(s);return re(`File changed on disk`,{id:e,description:`Nothing was written — your unsaved version is intact.`,duration:1/0,closeButton:!0,action:{label:`Compare`,onClick:()=>T.current()}}),()=>{re.dismiss(e)}},[S,o,s]);let ee=(0,E.useCallback)(()=>{c.refetch().then(n=>{n.data&&n.data.content!==null&&y(n.data.content,n.data.mtime_ms),_t(e,t,r),p(!1),sn(s)})},[s,e,t,y]),te=(0,E.useCallback)((e,n)=>{l.mutate({path:t,content:e},{onSuccess:e=>C(n,e.mtime_ms),onError:e=>re.error(e instanceof Error?e.message:`Overwrite failed`)})},[l,t,C]),ne=(0,E.useCallback)(async()=>{if(!u||!St(s))return!0;let e=u.getValue(),n=u.getAlternativeVersionId();if(an(cn(s)))return!1;let r=rn(cn(s))??Ct(s);try{let i=await l.mutateAsync({path:t,content:e,expected_mtime_ms:r});return C(n,i.mtime_ms),!0}catch(e){return e instanceof ie&&e.status===409&&e.code===`stale_file`?Zt(s):re.error(e instanceof Error?e.message:`Save failed`),!1}},[u,s,l,t,C]),ae=(0,E.useRef)(ne);ae.current=ne,(0,E.useEffect)(()=>me(Ne(e,t,r),()=>ae.current(),{session:e,path:t,...r===void 0?{}:{root:r}}),[e,t,r]);let oe=(0,E.useCallback)(()=>{let n=h.current,i=_.current;!n||!i||!o||i.session!==e||i.path!==t||(i.root??void 0)!==(r??void 0)||Yn(i)&&(n.revealLineInCenter(i.line),n.setPosition({lineNumber:i.line,column:i.column??1}),n.focus())},[e,t,r,o]),se=(0,E.useCallback)(e=>{h.current=e,qn(e,{onSave:()=>ae.current()}),oe()},[oe]);(0,E.useEffect)(()=>{oe()},[n,u,oe]);let ce=(0,E.useCallback)(()=>{ee()},[ee]),le=(0,E.useCallback)(()=>{!u||cn(s)?.phase!==`comparing`||te(u.getValue(),u.getAlternativeVersionId())},[u,s,te]),ue=(0,E.useCallback)(e=>{en(s,e)},[s]),de,fe=null;c.data?.binary?de=`binary`:c.error?c.error instanceof ie&&c.error.status===413?de=`too-large`:(de=`error`,fe=c.error instanceof Error?c.error.message:`Failed to load file`):de=u?`ready`:`loading`;let pe=b&&x.savedElsewhere?`saved-elsewhere`:b&&x.dirtyElsewhere?`dirty-elsewhere`:null;return{status:de,errorMessage:fe,model:u,dirty:b,restoredNotice:f,discardRestore:ce,peerBadge:pe,conflict:S,takeDisk:ee,keepMine:le,compare:w,comparisonReady:ue,save:ne,onMount:se}}function Qn(e,t,n,r){for(let i of e)if(rr([i],n).some(e=>(r===void 0||e.kind===r)&&t>=e.startLineNumber&&t<=e.endLineNumber))return i;return null}function $n(e,t){return tr(e.modifiedStartLineNumber,e.modifiedEndLineNumber)>0?Math.min(t,e.modifiedEndLineNumber):Math.max(0,Math.min(t,e.modifiedStartLineNumber-1))}function er(e){let t=tr(e.originalStartLineNumber,e.originalEndLineNumber),n=tr(e.modifiedStartLineNumber,e.modifiedEndLineNumber);return Math.max(5,Math.min(14,t+n+4))}function tr(e,t){return t===0?0:Math.max(0,t-e+1)}function nr(e,t){if(e>t)return{startLineNumber:Math.max(1,t),endLineNumber:Math.max(1,t),kind:`deleted-after`};let n=Math.max(1,e);return{startLineNumber:n,endLineNumber:n,kind:`deleted-before`}}function rr(e,t){let n=[];for(let r of e){let e=tr(r.originalStartLineNumber,r.originalEndLineNumber),i=tr(r.modifiedStartLineNumber,r.modifiedEndLineNumber);if(e===0&&i>0){n.push({startLineNumber:r.modifiedStartLineNumber,endLineNumber:r.modifiedEndLineNumber,kind:`added`});continue}if(i===0&&e>0){n.push(nr(r.modifiedStartLineNumber,t));continue}let a=Math.min(e,i);a>0&&n.push({startLineNumber:r.modifiedStartLineNumber,endLineNumber:r.modifiedStartLineNumber+a-1,kind:`modified`}),i>a&&n.push({startLineNumber:r.modifiedStartLineNumber+a,endLineNumber:r.modifiedEndLineNumber,kind:`added`}),e>a&&n.push(nr(r.modifiedStartLineNumber+i,t))}return n}var ir=28,ar=[[`puddle-dirty-added`,`added`],[`puddle-dirty-modified`,`modified`],[`puddle-dirty-deleted-before`,`deleted-before`],[`puddle-dirty-deleted-after`,`deleted-after`]];function or(e){if(e){for(let[t,n]of ar)if(e.classList.contains(t)||e.closest(`.${t}`))return n}}function sr({editor:e,original:t,modified:n,path:r}){let i=[],a=null,o=!1,s=t=>{try{e.changeViewZones(e=>e.removeZone(t))}catch{}},c=()=>{let e=a;e&&(a=null,e.frame!==null&&cancelAnimationFrame(e.frame),e.diffEditor&&(e.diffEditor.setModel(null),e.diffEditor.dispose()),s(e.zoneId))},l=e=>{let t=e.diffEditor;if(!t)return;let r=Math.max(1,Math.min(n.getLineCount(),e.change.modifiedStartLineNumber));t.getModifiedEditor().revealLineInCenter(r,T.ScrollType.Immediate)},u=(i,s)=>{if(a?.anchorLine===i){c();return}c();let u=e.getOption(T.EditorOption.lineHeight),d=document.createElement(`div`);d.className=`puddle-dirty-peek`;let f=document.createElement(`div`);f.className=`puddle-dirty-peek-header`;let p=document.createElement(`span`);p.className=`puddle-dirty-peek-title`,p.textContent=`${r.split(`/`).pop()??r} · Local changes against HEAD`;let m=document.createElement(`button`);m.type=`button`,m.className=`puddle-dirty-peek-close`,m.setAttribute(`aria-label`,`Close inline change`),m.title=`Close inline change`,m.textContent=`×`,m.addEventListener(`pointerdown`,e=>{e.preventDefault(),e.stopPropagation(),c()}),m.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),c()});let h=document.createElement(`div`);h.className=`puddle-dirty-peek-editor`,f.append(p,m),d.append(f,h);let g=document.createElement(`div`);g.className=`puddle-dirty-peek-margin`;let _={afterLineNumber:$n(s,n.getLineCount()),heightInPx:ir+er(s)*u,domNode:d,marginDomNode:g,suppressMouseDown:!1},v=``;e.changeViewZones(e=>{v=e.addZone(_)});let y={anchorLine:i,change:s,zone:_,zoneId:v,frame:null,diffEditor:null};a=y,y.frame=requestAnimationFrame(()=>{if(y.frame=null,o||a!==y)return;let r=T.createDiffEditor(h,{readOnly:!0,domReadOnly:!0,originalEditable:!1,renderSideBySide:!1,renderMarginRevertIcon:!1,renderOverviewRuler:!1,enableSplitViewResizing:!1,isInEmbeddedEditor:!0,automaticLayout:!0,fontFamily:e.getOption(T.EditorOption.fontFamily),fontSize:e.getOption(T.EditorOption.fontSize),lineHeight:u,minimap:{enabled:!1},glyphMargin:!1,folding:!1,scrollBeyondLastLine:!1,fixedOverflowWidgets:!0,hideUnchangedRegions:{enabled:!0,minimumLineCount:0,contextLineCount:2,revealLineCount:3}});y.diffEditor=r,r.setModel({original:t,modified:n}),r.onDidUpdateDiff(()=>l(y)),l(y)}),e.revealLineInCenter(Math.max(1,Math.min(n.getLineCount(),s.modifiedStartLineNumber)))},d=e.onMouseDown(e=>{if(!e.event.leftButton||e.target.type!==T.MouseTargetType.GUTTER_LINE_DECORATIONS||e.target.position===null)return;let t=e.target.position.lineNumber,r=Qn(i,t,n.getLineCount(),or(e.target.element));r&&(e.event.preventDefault(),e.event.stopPropagation(),u(t,r))});return{update(t){if(i=t,!a)return;let r=a,o=Qn(t,r.anchorLine,n.getLineCount());if(!o){c();return}r.change=o,r.zone.afterLineNumber=$n(o,n.getLineCount()),r.zone.heightInPx=ir+er(o)*e.getOption(T.EditorOption.lineHeight);try{e.changeViewZones(e=>e.layoutZone(r.zoneId))}catch{c();return}l(r)},dispose(){o=!0,d.dispose(),c()}}}var cr={added:`puddle-dirty-added`,modified:`puddle-dirty-modified`,"deleted-before":`puddle-dirty-deleted-before`,"deleted-after":`puddle-dirty-deleted-after`};function lr(e,t,n,r){let i=ce(),a=Ce(e,t,{root:n,enabled:i.data!==void 0&&le(i.data.protocol)&&r!==null}),[o,s]=(0,E.useState)(null),c=(0,E.useCallback)(e=>{s(e)},[]);return(0,E.useEffect)(()=>{let e=a.data;if(!o||!r||!e||e.repository===null||e.ignored||e.binary)return;let n=document.createElement(`div`);n.className=`puddle-hidden-diff-controller`,document.body.appendChild(n);let i=T.createModel(e.exists?e.content??``:``,r.getLanguageId()),s=T.createDiffEditor(n,{readOnly:!0,automaticLayout:!1,renderSideBySide:!1,minimap:{enabled:!1}}),c=o.createDecorationsCollection();s.setModel({original:i,modified:r});let l=sr({editor:o,original:i,modified:r,path:t}),u=()=>{let e=s.getLineChanges();e&&(l.update(e),c.set(rr(e,r.getLineCount()).map(e=>({range:new C(e.startLineNumber,1,e.endLineNumber,1),options:{isWholeLine:!0,linesDecorationsClassName:cr[e.kind]}}))))},d=s.onDidUpdateDiff(u);return u(),()=>{d.dispose(),l.dispose(),c.clear(),s.setModel(null),s.dispose(),i.dispose(),n.remove()}},[o,r,a.data]),c}function ur({message:e,session:t,path:n,root:r,download:i}){return(0,D.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 bg-ground text-sm text-fg-muted`,children:[(0,D.jsx)(`span`,{children:e}),i&&(0,D.jsxs)(`button`,{type:`button`,onClick:()=>void ge(t,n,r).catch(e=>re.error(e instanceof Error?e.message:`Download failed`)),className:`flex items-center gap-1.5 text-fg-secondary transition-colors hover:text-fg`,children:[(0,D.jsx)(Re,{className:`size-4`}),`Download`]})]})}function dr({session:e,path:t,reveal:n,root:r,focused:i=!0,scrollDriver:a=!1,scrollReceiver:o=!1,scrollChannel:s=`profile`}){let c=h(),l=_n([e,r,t]),u=Zn(e,t,n,r,{focused:i}),d=ye(e,t,r),f=lr(e,t,r,u.model),p=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),[m,g]=(0,E.useState)(null),_=(0,E.useMemo)(()=>({session:e,path:t,root:r}),[e,t,r]),v=u.conflict!==null&&u.conflict.phase!==`unresolved`;if((0,E.useEffect)(()=>{if(!(!m||!u.model||v))return Wn(m,{channel:s,target:_,driver:a,receiver:o},T.ScrollType.Immediate)},[m,u.model,v,s,_,a,o]),(0,E.useEffect)(()=>{let e=u.model;e&&T.setModelMarkers(e,`puddle-compilation`,d.map(t=>{let n=Math.min(t.line,e.getLineCount()),r=e.getLineMaxColumn(n),i=Math.min(t.column??1,r),a=t.end_line??n,o=Math.max(n,Math.min(a,e.getLineCount())),s=e.getLineMaxColumn(o),c=Math.min(t.end_column??(t.column?i+1:s),s);return{severity:t.severity===`error`?S.Error:t.severity===`warning`?S.Warning:S.Info,message:t.message,source:`Puddle compilation`,startLineNumber:n,startColumn:i,endLineNumber:o,endColumn:Math.max(i,c)}}))},[u.model,d]),u.conflict&&u.conflict.phase!==`unresolved`)return(0,D.jsx)(bn,{session:e,path:t,buffer:u,focused:i});if(u.status===`binary`)return(0,D.jsx)(ur,{message:`Binary file — use Download`,session:e,path:t,root:r,download:!0});if(u.status===`too-large`)return(0,D.jsx)(ur,{message:`File too large to edit — use Download`,session:e,path:t,root:r,download:!0});if(u.status===`error`)return(0,D.jsx)(ur,{message:u.errorMessage??`Failed to load file`,session:e,path:t,root:r});let y=u.peerBadge===`saved-elsewhere`?`Saved in another window`:u.peerBadge===`dirty-elsewhere`?`Also being edited in another window`:null;return(0,D.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[u.restoredNotice&&(0,D.jsxs)(`div`,{className:`flex items-center gap-3 bg-elevated px-3 py-1.5 text-xs text-fg-secondary`,children:[(0,D.jsx)(`span`,{children:`Restored unsaved changes`}),(0,D.jsx)(`button`,{type:`button`,onClick:u.discardRestore,className:`text-fg-muted transition-colors hover:text-fg`,children:`Discard`})]}),y&&(0,D.jsx)(`div`,{className:`bg-surface px-3 py-1 text-xs text-fg-muted`,children:y}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:u.model&&(0,D.jsx)(xt,{path:u.model.uri.toString(),defaultValue:u.model.getValue(),theme:`puddle`,keepCurrentModel:!0,saveViewState:!1,onMount:e=>{l(e),u.onMount(e),f(e),g(e)},loading:(0,D.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),options:{automaticLayout:!0,fontFamily:p,fontSize:c.editorFontSize,...un(c.editorTabSize),wordWrap:c.editorWordWrap?`on`:`off`,minimap:{enabled:!1},glyphMargin:!1,lineDecorationsWidth:10,fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}function O({children:e}){return(0,D.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-xs text-fg-muted`,children:e})}function fr(e,t){let n=(0,E.useRef)(t);n.current=t,(0,E.useEffect)(()=>(yt(e),()=>{n.current?.(),wt(e)}),[e])}function pr(e,t,n,r){let i=r.split(`/`).map(encodeURIComponent).join(`/`);return`${e}://${encodeURIComponent(t)}/${encodeURIComponent(n)}/${i}`}function mr({session:e,refName:t,path:n,content:r}){let i=h(),a=_n([e,t,n]),o=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,D.jsx)(xt,{path:pr(`puddle-view`,e,t,n),defaultValue:r,theme:bt,saveViewState:!1,onMount:a,loading:(0,D.jsx)(O,{children:`…`}),options:{readOnly:!0,automaticLayout:!0,fontFamily:o,fontSize:i.editorFontSize,...un(i.editorTabSize),minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function hr({session:e,against:t,path:n,root:r,indexBase:i=!1}){let a=he(e,t,n,{root:r,enabled:!i}),o=ve(e,n,{root:r,enabled:i}),s=i?o:a;return s.isPending?(0,D.jsx)(O,{children:`…`}):s.error?(0,D.jsx)(O,{children:s.error instanceof Error?s.error.message:`Failed to load`}):s.data.binary?(0,D.jsx)(O,{children:`Binary file — deleted`}):(0,D.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,D.jsx)(`div`,{className:`bg-surface px-4 py-1 text-xs text-fg-muted`,children:`Deleted`}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,D.jsx)(mr,{session:e,refName:`${t}:${r??``}`,path:n,content:s.data.content??``})})]})}function gr({session:e,against:t,path:n,basePath:r,root:i,indexBase:a=!1,focused:o=!0}){let s=h(),c=vn([e,i,t,a,n]),l=Zn(e,n,null,i,{focused:o}),u=he(e,t,r,{root:i,enabled:!a}),d=ve(e,r,{root:i,enabled:a}),f=a?d:u,p=(0,E.useRef)(null);fr(Ot(e,n,i),()=>{let e=p.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),p.current=null});let m=(0,E.useRef)(l.save);m.current=l.save;let g=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),_=f.error instanceof ie&&f.error.status===404;return l.conflict&&l.conflict.phase!==`unresolved`?(0,D.jsx)(bn,{session:e,path:n,buffer:l,focused:o}):l.status===`binary`||f.data?.binary?(0,D.jsx)(O,{children:`Binary file`}):l.status===`too-large`?(0,D.jsx)(O,{children:`File too large to show`}):l.status===`error`?(0,D.jsx)(O,{children:l.errorMessage??`Failed to load file`}):_||a&&d.data&&!d.data.exists?(0,D.jsx)(dr,{session:e,path:n,reveal:null,root:i,focused:o}):f.isPending||!l.model?(0,D.jsx)(O,{children:`…`}):f.error?(0,D.jsx)(O,{children:f.error instanceof Error?f.error.message:`Failed to load base`}):(0,D.jsx)(Tt,{modifiedModelPath:l.model.uri.toString(),originalModelPath:pr(`puddle-base`,e,`${t}:${i??``}`,r),original:f.data.content??``,language:l.model.getLanguageId(),theme:bt,keepCurrentModifiedModel:!0,loading:(0,D.jsx)(O,{children:`…`}),onMount:e=>{c(e),p.current=e,e.onDidDispose(()=>{p.current=null}),e.getModifiedEditor().addCommand(w.CtrlCmd|ee.KeyS,()=>m.current())},options:{readOnly:!1,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:g,fontSize:s.editorFontSize,...un(s.editorTabSize),wordWrap:s.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function _r({session:e,against:t,entry:n,root:r}){let i=h(),a=vn([e,r,t,`staged`,n.path]),o=n.old_path??n.path,s=he(e,t,o,{root:r,enabled:n.status!==`added`}),c=ve(e,n.path,{root:r,enabled:n.status!==`deleted`}),l=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);if(n.status===`deleted`)return(0,D.jsx)(hr,{session:e,against:t,path:o,root:r});if(c.isPending||n.status!==`added`&&s.isPending)return(0,D.jsx)(O,{children:`…`});if(c.error||s.error){let e=c.error??s.error;return(0,D.jsx)(O,{children:e instanceof Error?e.message:`Failed to load staged content`})}return c.data.binary||s.data?.binary?(0,D.jsx)(O,{children:`Binary file`}):n.status===`added`?(0,D.jsx)(mr,{session:e,refName:`index:${r??``}`,path:n.path,content:c.data.content??``}):s.data?(0,D.jsx)(Tt,{originalModelPath:pr(`puddle-head`,e,`${t}:${r??``}`,o),modifiedModelPath:pr(`puddle-index`,e,`${t}:${r??``}`,n.path),original:s.data.content??``,modified:c.data.content??``,onMount:a,theme:bt,loading:(0,D.jsx)(O,{children:`…`}),options:{readOnly:!0,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:l,fontSize:i.editorFontSize,...un(i.editorTabSize),wordWrap:i.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}}):(0,D.jsx)(O,{children:`Failed to load HEAD content`})}function vr({session:e,path:t,root:n,focused:r}){return fr(Ot(e,t,n)),(0,D.jsx)(dr,{session:e,path:t,reveal:null,root:n,focused:r})}function yr({session:e,against:t,entry:n,root:r,area:i,focused:a=!0}){if(i===`staged`)return(0,D.jsx)(_r,{session:e,against:t,entry:n,root:r});switch(n.status){case`added`:return(0,D.jsx)(vr,{session:e,path:n.path,root:r,focused:a});case`deleted`:return(0,D.jsx)(hr,{session:e,against:t,path:n.path,root:r,indexBase:i===`unstaged`});case`modified`:case`renamed`:return(0,D.jsx)(gr,{session:e,against:t,path:n.path,basePath:n.old_path??n.path,root:r,indexBase:i===`unstaged`,focused:a});default:return null}}function br({session:e,sha:t,path:n,root:r}){let i=he(e,t,n,{root:r});return i.isPending?(0,D.jsx)(O,{children:`…`}):i.error?(0,D.jsx)(O,{children:i.error instanceof Error?i.error.message:`Failed to load file`}):i.data.binary?(0,D.jsx)(O,{children:`Binary file`}):(0,D.jsx)(mr,{session:e,refName:`${t}:${r??``}`,path:n,content:i.data.content??``})}function xr({session:e,originalRef:t,originalPath:n,originalContent:r,modifiedRef:i,modifiedPath:a,modifiedContent:o,root:s}){let c=h(),l=vn([e,s,t,n,i,a]),u=(0,E.useRef)(null),d=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,E.useEffect)(()=>()=>{let e=u.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),t?.modified.dispose(),u.current=null},[]),(0,D.jsx)(Tt,{originalModelPath:pr(`puddle-hist-orig`,e,`${t}:${s??``}`,n),modifiedModelPath:pr(`puddle-hist-mod`,e,`${i}:${s??``}`,a),original:r,modified:o,theme:bt,keepCurrentOriginalModel:!0,keepCurrentModifiedModel:!0,loading:(0,D.jsx)(O,{children:`…`}),onMount:e=>{l(e),u.current=e,e.onDidDispose(()=>{u.current=null})},options:{readOnly:!0,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:d,fontSize:c.editorFontSize,...un(c.editorTabSize),minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function Sr({session:e,sha:t,path:n,basePath:r,root:i}){let a=he(e,`${t}^`,r,{root:i}),o=he(e,t,n,{root:i});return a.error instanceof ie&&a.error.status===404?(0,D.jsx)(br,{session:e,sha:t,path:n,root:i}):a.isPending||o.isPending?(0,D.jsx)(O,{children:`…`}):a.error?(0,D.jsx)(O,{children:a.error instanceof Error?a.error.message:`Failed to load original`}):o.error?(0,D.jsx)(O,{children:o.error instanceof Error?o.error.message:`Failed to load file`}):a.data.binary||o.data.binary?(0,D.jsx)(O,{children:`Binary file`}):(0,D.jsx)(xr,{session:e,originalRef:`${t}^`,originalPath:r,originalContent:a.data.content??``,modifiedRef:t,modifiedPath:n,modifiedContent:o.data.content??``,root:i})}function Cr({session:e,sha:t,entry:n,isRootCommit:r,root:i}){switch(Ve(n.status,r)){case`added`:return(0,D.jsx)(br,{session:e,sha:t,path:n.path,root:i});case`deleted`:return(0,D.jsx)(hr,{session:e,against:`${t}^`,path:n.path,root:i});case`modified`:case`renamed`:return(0,D.jsx)(Sr,{session:e,sha:t,path:n.path,basePath:n.old_path??n.path,root:i});default:return null}}function wr({session:e,sha:t,path:n,root:r}){let i=Se(e,t,r);if(i.isPending)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading commit…`});if(i.error)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:i.error instanceof Error?i.error.message:`Failed to load commit`});let a=i.data.files.find(e=>e.path===n);return a?(0,D.jsx)(`div`,{className:`h-full`,children:(0,D.jsx)(Cr,{session:e,sha:t,entry:a,isRootCommit:i.data.parents.length===0,root:r})}):(0,D.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[(0,D.jsx)(`span`,{className:`text-fg-secondary`,children:n}),` is not part of`,` `,(0,D.jsx)(`span`,{className:`font-mono`,children:t.slice(0,7)}),`.`]})}function Tr({session:e,path:t,root:n,area:r,focused:i=!0}){let a=_e(e,{root:n,against:r===void 0?`base`:`head`,area:r});if(a.isPending)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading diff…`});if(a.error)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:a.error instanceof Error?a.error.message:`Failed to load diff`});let o=a.data.entries.find(e=>e.path===t);return o?(0,D.jsx)(`div`,{className:`h-full`,children:(0,D.jsx)(yr,{session:e,against:a.data.against,entry:o,root:n,area:r,focused:i})}):(0,D.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[`No changes to `,(0,D.jsx)(`span`,{className:`mx-1 text-fg-secondary`,children:t}),` against the base.`]})}var Er=800;function Dr({name:e}){let t=h(),n=ue(),r=_n([n,e]),i=pe(n,e),a=oe(),o=ae(`editor.save`),s=(0,E.useRef)(null),c=(0,E.useRef)(null),l=(0,E.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);if((0,E.useEffect)(()=>{if(n===null)return;let t=pt(t=>{He(n,e,t).catch(e=>re.error(e instanceof Error?e.message:`Draft not saved`))},Er);return c.current=t,()=>{t.flush(),c.current=null}},[n,e]),n===null)return null;if(i.error)return(0,D.jsx)(`div`,{className:`flex h-full items-center justify-center bg-ground text-sm text-fg-muted`,children:i.error instanceof Error?i.error.message:`Failed to load the draft`});if(i.data===void 0)return(0,D.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`});let u=()=>{let t=s.current;t&&(c.current?.flush(),ke({name:e,content:t.getValue()}))};return(0,D.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[(0,D.jsxs)(`div`,{className:`bg-surface px-3 py-1 text-xs text-fg-muted`,children:[`Draft — not in any worktree; `,o,` saves it into one`]}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,D.jsx)(xt,{path:`puddle-untitled://${n}/${e}`,defaultValue:i.data.content,theme:bt,keepCurrentModel:!1,saveViewState:!1,loading:(0,D.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),onMount:t=>{r(t),s.current=t,Ae(e,t.getValue()),qn(t,{onSave:u})},onChange:t=>{let r=t??``;Ae(e,r),xe(a,n,e,r),c.current?.(r)},options:{automaticLayout:!0,fontFamily:l,fontSize:t.editorFontSize,...un(t.editorTabSize),minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1,wordWrap:t.editorWordWrap?`on`:`off`}})})]})}var Or=u([d(),l(d())]),kr=a(d(),f()),Ar=o({output_type:d(),text:Or.optional(),data:a(d(),f()).optional(),traceback:l(d()).optional(),ename:d().optional(),evalue:d().optional()}),jr=o({id:d().optional(),cell_type:c([`code`,`markdown`,`raw`]),metadata:kr,source:Or,outputs:l(Ar).optional(),execution_count:m().int().nullable().optional()}),Mr=o({nbformat:i(4),nbformat_minor:m().int().nonnegative(),metadata:kr,cells:l(jr).max(2e3)});function Nr(e){if(e.length>5*1024*1024)throw Error(`This notebook exceeds the 5 MiB editor limit.`);let t;try{t=JSON.parse(e)}catch{throw Error(`This notebook is not valid JSON. Switch to source to repair it.`)}let n=Mr.safeParse(t);if(!n.success)throw Error(`Expected a version 4 notebook with at most 2,000 valid cells. Switch to source to inspect it.`);return n.data}function k(e){return typeof e==`string`?e:Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(``):``}function Pr(e,t,n){return{...e,cells:e.cells.map((e,r)=>r===t?{...e,source:n.match(/[^\n]*\n|[^\n]+$/g)??[],...e.cell_type===`code`?{outputs:[],execution_count:null}:{}}:e)}}function Fr(e){return{id:crypto.randomUUID(),cell_type:e,metadata:{},source:[],...e===`code`?{outputs:[],execution_count:null}:{}}}function Ir(e){return(e.output_type===`error`?e.traceback?.join(`
|
|
3
3
|
`)??`${e.ename??`Error`}: ${e.evalue??``}`:k(e.text??e.data?.[`text/plain`])).replace(/\u001b\[[0-?]*[ -/]*[@-~]/g,``)}function Lr(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;let r=e.length,i=t.length;for(;r>n&&i>n&&e[r-1]===t[i-1];)r--,i--;return{start:n,end:r,text:t.slice(n,i)}}function Rr(e){return{...e,cells:e.cells.map(e=>e.cell_type===`code`?{...e,outputs:[],execution_count:null}:e)}}function zr(e){return e.cells.map((e,t)=>{let n=k(e.source).split(`
|
|
4
4
|
`).find(e=>e.trim())?.trim()??``;return{index:t,label:(e.cell_type===`markdown`?n.replace(/^#{1,6}\s+/,``):n).slice(0,100)||`${e.cell_type===`code`?`Code`:e.cell_type===`markdown`?`Markdown`:`Raw`} cell`}})}function Br(e){return se({queryKey:[`notebook-kernels`],queryFn:()=>ne(`GET`,`/api/notebooks/kernels`),enabled:e,staleTime:3e4})}function Vr(e,t){return se({queryKey:[`notebook-kernel`,e],queryFn:()=>ne(`POST`,`/api/notebooks/status`,{source:e}),enabled:t,refetchInterval:1500,retry:!1})}function Hr(e){return ne(`POST`,`/api/notebooks/kernel`,e)}var Ur=`flex cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-sm px-2 py-1.5 text-xs text-fg-secondary transition-colors hover:bg-surface hover:text-fg disabled:cursor-default disabled:opacity-40`;function Wr({notebook:e,source:t,onChange:n,onAdd:r,onRevealCell:i,onRun:a,running:o=!1}){let[s,c]=(0,E.useState)(!1),l=ce(),u=Vr(t,!!a&&de(l.data?.protocol)),d=o||u.data?.state===`busy`||u.data?.state===`starting`,f=zr(e),p=e.cells.some(e=>e.cell_type===`code`&&((e.outputs?.length??0)>0||e.execution_count!=null));return(0,D.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 bg-ground px-3 py-2`,role:`toolbar`,"aria-label":`Notebook`,children:[n&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`button`,{type:`button`,className:Ur,disabled:e.cells.length>=2e3,onClick:()=>r(`code`),"aria-label":`Add code cell`,children:[(0,D.jsx)(Ge,{className:`size-3.5`}),`Code`]}),(0,D.jsxs)(`button`,{type:`button`,className:Ur,disabled:e.cells.length>=2e3,onClick:()=>r(`markdown`),"aria-label":`Add Markdown cell`,children:[(0,D.jsx)(Ge,{className:`size-3.5`}),`Markdown`]})]}),a&&(0,D.jsxs)(`button`,{type:`button`,className:Ur,disabled:d,onClick:a,children:[(0,D.jsx)(ze,{className:`size-3.5`}),d?`Running…`:`Run All`]}),n&&(0,D.jsxs)(`button`,{type:`button`,className:Ur,disabled:!p,onClick:()=>n(Rr(e)),children:[(0,D.jsx)(We,{className:`size-3.5`}),`Clear All Outputs`]}),(0,D.jsxs)(ot,{open:s,onOpenChange:c,children:[(0,D.jsx)(at,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`button`,className:Ur,disabled:f.length===0,children:[(0,D.jsx)(Gt,{className:`size-3.5`}),`Outline`]})}),(0,D.jsx)(it,{align:`start`,className:`max-h-72 w-72 overflow-y-auto p-1`,children:(0,D.jsx)(`nav`,{"aria-label":`Notebook outline`,className:`flex flex-col`,children:f.map(e=>(0,D.jsxs)(`button`,{type:`button`,className:`${Ur} text-left`,onClick:()=>{i(e.index),c(!1)},children:[(0,D.jsx)(`span`,{className:`w-5 shrink-0 text-fg-muted`,children:e.index+1}),(0,D.jsx)(`span`,{className:`truncate`,children:e.label})]},e.index))})})]}),n&&(0,D.jsxs)(Le,{children:[(0,D.jsx)(Be,{asChild:!0,children:(0,D.jsx)(`button`,{type:`button`,className:Ur,"aria-label":`More notebook actions`,children:(0,D.jsx)(Fe,{className:`size-3.5`})})}),(0,D.jsx)(je,{align:`start`,children:(0,D.jsxs)(Te,{disabled:e.cells.length>=2e3,onSelect:()=>r(`raw`),children:[(0,D.jsx)(Ge,{}),`Add raw cell`]})})]}),n&&a&&(0,D.jsx)(Gr,{source:t,notebook:e,onSelect:t=>n({...e,metadata:{...e.metadata,kernelspec:t}})})]})}function Gr({source:e,notebook:t,onSelect:n}){let r=(0,E.useRef)(n);r.current=n;let i=(0,E.useRef)(!0);(0,E.useEffect)(()=>(i.current=!0,()=>{i.current=!1}),[]);let a=de(ce().data?.protocol),o=Br(a),s=Vr(e,a),c=oe(),[l,u]=(0,E.useState)(!1),[d,f]=(0,E.useState)(null);if(!a)return null;let p=t.metadata.kernelspec,m=s.data?.kernel??(typeof p?.name==`string`?p.name:``),h=o.data?.kernels??[],g=h.find(e=>e.name===m),_=s.data&&s.data.state!==`stopped`&&s.data.state!==`dead`,v=s.data?.state===`busy`||s.data?.state===`starting`,y=async t=>{u(!0),f(null);try{let n=await Hr(t);if(c.setQueryData([`notebook-kernel`,e],n),t.action===`select`){let e=h.find(e=>e.name===t.kernel);e&&i.current&&r.current(e)}}catch(e){f(e instanceof Error?e.message:`Kernel operation failed`)}finally{u(!1)}};return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[v&&(0,D.jsxs)(`button`,{type:`button`,className:Ur,disabled:l,onClick:()=>void y({source:e,action:`interrupt`}),children:[(0,D.jsx)(De,{className:`size-3.5`}),`Interrupt`]}),(0,D.jsx)(`span`,{className:`text-xs text-fg-muted`,role:`status`,children:l?`Updating…`:s.data?.state===`dead`?`Kernel exited`:v?`Busy`:_?`Idle`:``}),(0,D.jsxs)(Ze,{value:g?.name??``,disabled:l||!o.data?.available||h.length===0,onValueChange:t=>void y({source:e,action:`select`,kernel:t}),children:[(0,D.jsxs)(Je,{className:`h-7 max-w-52 gap-1.5 bg-transparent text-xs hover:bg-surface`,"aria-label":`Select kernel`,title:`Kernels stay alive until shut down. Changing kernels starts fresh.`,children:[(0,D.jsx)(Wt,{className:`size-3.5 shrink-0`}),(0,D.jsx)(qe,{placeholder:m?`${m} (not installed)`:`Select Kernel`})]}),(0,D.jsx)(Ye,{children:h.map(e=>(0,D.jsx)(Xe,{value:e.name,detail:e.language,children:(0,D.jsx)(`span`,{children:e.display_name})},e.name))})]}),(0,D.jsxs)(Le,{children:[(0,D.jsx)(Be,{asChild:!0,children:(0,D.jsx)(`button`,{type:`button`,className:Ur,disabled:l,"aria-label":`Kernel actions`,children:(0,D.jsx)(Fe,{className:`size-3.5`})})}),(0,D.jsxs)(je,{align:`end`,children:[(0,D.jsxs)(Te,{disabled:!g,onSelect:()=>void y({source:e,action:`restart`}),children:[(0,D.jsx)(rt,{}),`Restart kernel`]}),(0,D.jsxs)(Te,{disabled:!_,onSelect:()=>void y({source:e,action:`shutdown`}),children:[(0,D.jsx)(Ue,{}),`Shut down kernel`]})]})]})]}),(d||s.data?.error||o.data?.error||o.isError||s.isError)&&(0,D.jsx)(`p`,{role:`alert`,className:`w-full px-2 text-xs text-danger`,children:d??s.data?.error??o.data?.error??`Couldn’t load notebook kernels`}),o.data&&!o.data.available&&!o.data.error&&(0,D.jsx)(`p`,{className:`w-full px-2 text-xs text-fg-muted`,children:`Install Jupyter and a language kernel on this host to run notebooks.`})]})}var Kr={};function qr(e){let t=Kr[e];if(t)return t;t=Kr[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);t.push(n)}for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[r]=`%`+(`0`+r.toString(16).toUpperCase()).slice(-2)}return t}function Jr(e,t){typeof t!=`string`&&(t=Jr.defaultChars);let n=qr(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(e){let t=``;for(let r=0,i=e.length;r<i;r+=3){let a=parseInt(e.slice(r+1,r+3),16);if(a<128){t+=n[a];continue}if((a&224)==192&&r+3<i){let n=parseInt(e.slice(r+4,r+6),16);if((n&192)==128){let e=a<<6&1984|n&63;e<128?t+=`��`:t+=String.fromCharCode(e),r+=3;continue}}if((a&240)==224&&r+6<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16);if((n&192)==128&&(i&192)==128){let e=a<<12&61440|n<<6&4032|i&63;e<2048||e>=55296&&e<=57343?t+=`���`:t+=String.fromCharCode(e),r+=6;continue}}if((a&248)==240&&r+9<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16),o=parseInt(e.slice(r+10,r+12),16);if((n&192)==128&&(i&192)==128&&(o&192)==128){let e=a<<18&1835008|n<<12&258048|i<<6&4032|o&63;e<65536||e>1114111?t+=`����`:(e-=65536,t+=String.fromCharCode(55296+(e>>10),56320+(e&1023))),r+=9;continue}}t+=`�`}return t})}Jr.defaultChars=`;/?:@&=+$,#`,Jr.componentChars=``;var Yr={};function Xr(e){let t=Yr[e];if(t)return t;t=Yr[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);/^[0-9a-z]$/i.test(n)?t.push(n):t.push(`%`+(`0`+e.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=e[n];return t}function Zr(e,t,n){typeof t!=`string`&&(n=t,t=Zr.defaultChars),n===void 0&&(n=!0);let r=Xr(t),i=``;for(let t=0,a=e.length;t<a;t++){let o=e.charCodeAt(t);if(n&&o===37&&t+2<a&&/^[0-9a-f]{2}$/i.test(e.slice(t+1,t+3))){i+=e.slice(t,t+3),t+=2;continue}if(o<128){i+=r[o];continue}if(o>=55296&&o<=57343){if(o>=55296&&o<=56319&&t+1<a){let n=e.charCodeAt(t+1);if(n>=56320&&n<=57343){i+=encodeURIComponent(e[t]+e[t+1]),t++;continue}}i+=`%EF%BF%BD`;continue}i+=encodeURIComponent(e[t])}return i}Zr.defaultChars=`;/?:@&=+$,-_.!~*'()#`,Zr.componentChars=`-_.!~*'()`;function Qr(e){let t=``;return t+=e.protocol||``,t+=e.slashes?`//`:``,t+=e.auth?e.auth+`@`:``,e.hostname&&e.hostname.indexOf(`:`)!==-1?t+=`[`+e.hostname+`]`:t+=e.hostname||``,t+=e.port?`:`+e.port:``,t+=e.pathname||``,t+=e.search||``,t+=e.hash||``,t}function $r(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var ei=/^([a-z0-9.+-]+:)/i,ti=/:[0-9]*$/,ni=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,ri=[`%`,`/`,`?`,`;`,`#`,`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,`
|
|
5
5
|
`,` `],ii=[`/`,`?`,`#`],ai=255,oi=/^[+a-z0-9A-Z_-]{0,63}$/,si=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ci={javascript:!0,"javascript:":!0},li={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function ui(e,t){if(e&&e instanceof $r)return e;let n=new $r;return n.parse(e,t),n}$r.prototype.parse=function(e,t){let n,r,i,a=e;if(a=a.trim(),!t&&e.split(`#`).length===1){let e=ni.exec(a);if(e)return this.pathname=e[1],e[2]&&(this.search=e[2]),this}let o=ei.exec(a);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,a=a.substr(o.length)),(t||o||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=a.substr(0,2)===`//`,i&&!(o&&ci[o])&&(a=a.substr(2),this.slashes=!0)),!ci[o]&&(i||o&&!li[o])){let e=-1;for(let t=0;t<ii.length;t++)r=a.indexOf(ii[t]),r!==-1&&(e===-1||r<e)&&(e=r);let t,n;n=e===-1?a.lastIndexOf(`@`):a.lastIndexOf(`@`,e),n!==-1&&(t=a.slice(0,n),a=a.slice(n+1),this.auth=t),e=-1;for(let t=0;t<ri.length;t++)r=a.indexOf(ri[t]),r!==-1&&(e===-1||r<e)&&(e=r);e===-1&&(e=a.length),a[e-1]===`:`&&e--;let i=a.slice(0,e);a=a.slice(e),this.parseHost(i),this.hostname=this.hostname||``;let o=this.hostname[0]===`[`&&this.hostname[this.hostname.length-1]===`]`;if(!o){let e=this.hostname.split(/\./);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n&&!n.match(oi)){let r=``;for(let e=0,t=n.length;e<t;e++)n.charCodeAt(e)>127?r+=`x`:r+=n[e];if(!r.match(oi)){let r=e.slice(0,t),i=e.slice(t+1),o=n.match(si);o&&(r.push(o[1]),i.unshift(o[2])),i.length&&(a=i.join(`.`)+a),this.hostname=r.join(`.`);break}}}}this.hostname.length>ai&&(this.hostname=``),o&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let s=a.indexOf(`#`);s!==-1&&(this.hash=a.substr(s),a=a.slice(0,s));let c=a.indexOf(`?`);return c!==-1&&(this.search=a.substr(c),a=a.slice(0,c)),a&&(this.pathname=a),li[n]&&this.hostname&&!this.pathname&&(this.pathname=``),this},$r.prototype.parseHost=function(e){let t=ti.exec(e);t&&(t=t[0],t!==`:`&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var di=e({decode:()=>Jr,encode:()=>Zr,format:()=>Qr,parse:()=>ui}),fi=e({Any:()=>pi,Cc:()=>mi,Cf:()=>hi,P:()=>gi,S:()=>_i,Z:()=>vi}),pi=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,mi=/[\0-\x1F\x7F-\x9F]/,hi=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,gi=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B4E\u1B4F\u1B5A-\u1B60\u1B7D-\u1B7F\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDD6E\uDEAD\uDED0\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9\uDFD4\uDFD5\uDFD7\uDFD8]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09\uDFE1]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDD6D-\uDD6F\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD839\uDDFF|\uD83A[\uDD5E\uDD5F]/,_i=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C1\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2429\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E5\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD803[\uDD8E\uDD8F\uDED1-\uDED8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDC00-\uDCEF\uDCFA-\uDCFC\uDD00-\uDEB3\uDEBA-\uDED0\uDEE0-\uDEF0\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED8\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0-\uDCBB\uDCC0\uDCC1\uDCD0-\uDCD8\uDD00-\uDE57\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8\uDF00-\uDF92\uDF94-\uDFEF\uDFFA]/,vi=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,yi=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function bi(e){return e>=55296&&e<=57343||e>1114111?65533:yi.get(e)??e}function xi(e){let t=atob(e),n=t.length&-2,r=new Uint16Array(n/2);for(let e=0,i=0;e<n;e+=2){let n=t.charCodeAt(e),a=t.charCodeAt(e+1);r[i++]=n|a<<8}return r}var Si=xi(`QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdABlADuAwQDBQHIiZXZ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S5yAPIA4AJyAPIAjAdhAPAAeh5pAHMAAKD7IoABZHB0APgReS6DLgABZmx9LoAuAOA12GnddQDzAP8RaQBtAOUABBIAAUFhiy6OLnIA8gDuAnIA8gCaBwABY3GVLgoScgAA4DXYzdwAAXB0nS6hLmwAdQDzACUScgDpACASAARhY2VmaW9zdbEuvC7ELsguzC7PLtQu2S5jAAABdXm2LrsudABlADuA/QD9QE9kAAFpecAuwy5yAGMAd2FLZG4AO4ClAKVAcgAA4DXYNt1jAHkAV2RwAGYAAOA12GrdYwByAADgNdjO3AABY23dLt8ueQBOZGwAO4D/AP9AAAVhY2RlZmhpb3N38y73Lv8uAi8MLxAvEy8YLx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg`),A;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.FLAG13=8192]=`FLAG13`,e[e.BRANCH_LENGTH=8064]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(A||={});var j;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(j||={});var Ci=32;function wi(e){return e>=j.ZERO&&e<=j.NINE}function Ti(e){return e>=j.UPPER_A&&e<=j.UPPER_F||e>=j.LOWER_A&&e<=j.LOWER_F}function Ei(e){return e>=j.UPPER_A&&e<=j.UPPER_Z||e>=j.LOWER_A&&e<=j.LOWER_Z||wi(e)}function Di(e){return e===j.EQUALS||Ei(e)}var M;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(M||={});var Oi;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(Oi||={});var ki=class{decodeTree;emitCodePoint;errors;constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n}state=M.EntityStart;consumed=1;result=0;treeIndex=0;excess=1;decodeMode=Oi.Strict;runConsumed=0;startEntity(e){this.decodeMode=e,this.state=M.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(e,t){switch(this.state){case M.EntityStart:return e.charCodeAt(t)===j.NUM?(this.state=M.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=M.NamedEntity,this.stateNamedEntity(e,t));case M.NumericStart:return this.stateNumericStart(e,t);case M.NumericDecimal:return this.stateNumericDecimal(e,t);case M.NumericHex:return this.stateNumericHex(e,t);case M.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|Ci)===j.LOWER_X?(this.state=M.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=M.NumericDecimal,this.stateNumericDecimal(e,t))}stateNumericHex(e,t){for(;t<e.length;){let n=e.charCodeAt(t);if(wi(n)||Ti(n)){let e=n<=j.NINE?n-j.ZERO:(n|Ci)-j.LOWER_A+10;this.result=this.result*16+e,this.consumed++,t++}else return this.emitNumericEntity(n,3)}return-1}stateNumericDecimal(e,t){for(;t<e.length;){let n=e.charCodeAt(t);if(wi(n))this.result=this.result*10+(n-j.ZERO),this.consumed++,t++;else return this.emitNumericEntity(n,2)}return-1}emitNumericEntity(e,t){if(this.consumed<=t)return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===j.SEMI)this.consumed+=1;else if(this.decodeMode===Oi.Strict)return 0;return this.emitCodePoint(bi(this.result),this.consumed),this.errors&&(e!==j.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&A.VALUE_LENGTH)>>14;for(;t<e.length;){if(i===0&&(r&A.FLAG13)!==0){let a=(r&A.BRANCH_LENGTH)>>7;if(this.runConsumed===0){let n=r&A.JUMP_TABLE;if(e.charCodeAt(t)!==n)return this.result===0?0:this.emitNotTerminatedNamedEntity();t++,this.excess++,this.runConsumed++}for(;this.runConsumed<a;){if(t>=e.length)return-1;let r=this.runConsumed-1,i=n[this.treeIndex+1+(r>>1)],a=r%2==0?i&255:i>>8&255;if(e.charCodeAt(t)!==a)return this.runConsumed=0,this.result===0?0:this.emitNotTerminatedNamedEntity();t++,this.excess++,this.runConsumed++}this.runConsumed=0,this.treeIndex+=1+(a>>1),r=n[this.treeIndex],i=(r&A.VALUE_LENGTH)>>14}if(t>=e.length)break;let a=e.charCodeAt(t);if(a===j.SEMI&&i!==0&&(r&A.FLAG13)!==0)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);if(this.treeIndex=ji(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===Oi.Attribute&&(i===0||Di(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&A.VALUE_LENGTH)>>14,i!==0){if(a===j.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==Oi.Strict&&(r&A.FLAG13)===0&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}t++,this.excess++}return-1}emitNotTerminatedNamedEntity(){let{result:e,decodeTree:t}=this,n=(t[e]&A.VALUE_LENGTH)>>14;return this.emitNamedEntityData(e,n,this.consumed),this.errors?.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~(A.VALUE_LENGTH|A.FLAG13):r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){switch(this.state){case M.NamedEntity:return this.result!==0&&(this.decodeMode!==Oi.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case M.NumericDecimal:return this.emitNumericEntity(0,2);case M.NumericHex:return this.emitNumericEntity(0,3);case M.NumericStart:return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case M.EntityStart:return 0}}};function Ai(e){let t=``,n=new ki(e,e=>t+=String.fromCodePoint(e));return function(e,r){let i=0,a=0;for(;(a=e.indexOf(`&`,a))>=0;){t+=e.slice(i,a),n.startEntity(r);let o=n.write(e,a+1);if(o<0){i=a+n.end();break}i=a+o,a=o===0?i+1:i}let o=t+e.slice(i);return t=``,o}}function ji(e,t,n,r){let i=(t&A.BRANCH_LENGTH)>>7,a=t&A.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=i+1>>1,s=0,c=i-1;for(;s<=c;){let t=s+c>>>1,i=e[n+(t>>1)]>>(t&1)*8&255;if(i<r)s=t+1;else if(i>r)c=t-1;else return e[n+o+t]}return-1}var Mi=Ai(Si);function Ni(e){return Mi(e,Oi.Strict)}String.prototype.codePointAt;function Pi(e,t){return function(n){let r,i=0,a=``;for(;r=e.exec(n);)i!==r.index&&(a+=n.substring(i,r.index)),a+=t.get(r[0].charCodeAt(0)),i=r.index+1;return a+n.substring(i)}}var Fi=Pi(/["&\u00A0]/g,new Map([[34,`"`],[38,`&`],[160,` `]])),Ii=Pi(/[&<>\u00A0]/g,new Map([[38,`&`],[60,`<`],[62,`>`],[160,` `]])),Li=class{src_Any=pi.source;src_Cc=mi.source;src_Z=vi.source;src_P=gi.source;src_ZPCc=[this.src_Z,this.src_P,this.src_Cc].join(`|`);src_ZCc=[this.src_Z,this.src_Cc].join(`|`);cache={};opts={maxLength:1e4,urlAuth:!1,schema_names:[]};constructor(e={}){this.opts={...this.opts,...e}}set(e={}){return this.opts={...this.opts,...e},this.cache={},this}escapeRE(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}nestedPairRE(e,t,n=4){let r=this.escapeRE(e),i=this.escapeRE(t),a=`(?:(?!${this.src_ZCc}|${r}|${i}).)`,o=`${r}${a}{0,1000}${i}`;for(let e=2;e<=n;e++)o=`${r}(?:${a}|${o}){0,1000}${i}`;return o}get_text_separators(){return this.cache.text_separators??=/[><\uff5c]/}get_pseudo_letter(){return this.cache.src_pseudo_letter??=RegExp(`(?:(?!${this.get_text_separators().source}|${this.src_ZPCc})${this.src_Any})`)}get_ipv4_addr(){return this.cache.src_ip4??=RegExp(`(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])[.]){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])`)}get_ipv6_addr(){let e=`[0-9A-Fa-f]{1,4}`,t=`(?:(?:${e}:${e})|${this.get_ipv4_addr().source})`;return this.cache.src_ip6_addr??=RegExp(`(?:(?:${e}:){6}${t}|::(?:${e}:){5}${t}|(?:${e})?::(?:${e}:){4}${t}|(?:(?:${e}:){0,1}${e})?::(?:${e}:){3}${t}|(?:(?:${e}:){0,2}${e})?::(?:${e}:){2}${t}|(?:(?:${e}:){0,3}${e})?::${e}:${t}|(?:(?:${e}:){0,4}${e})?::${t}|(?:(?:${e}:){0,5}${e})?::${e}|(?:(?:${e}:){0,6}${e})?::)`)}get_ipv6_url_host(){return this.cache.src_ip6_host??=RegExp(`\\[${this.get_ipv6_addr().source}\\]`)}get_ipv6_mail_host(){return this.cache.src_ipv6_mail_host??=RegExp(`\\[IPv6:${this.get_ipv6_addr().source}\\]`)}get_auth(){return this.cache.src_auth??=RegExp(`(?:(?:(?!${this.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`)}get_port(){return this.cache.src_port??=RegExp(`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`)}get_host_terminator(){return this.cache.src_host_terminator??=RegExp(`(?=$|${this.get_text_separators().source}|${this.src_ZPCc})(?!${this.opts[`---`]?`-(?!--)|`:`-|`}_|:\\d|\\.-|\\.(?!$|${this.src_ZPCc}))`)}get_path_terminator(){return this.cache.src_path_terminator??=RegExp(`${this.src_ZPCc}|${this.get_text_separators().source}`)}get_path(){return this.cache.src_path??=RegExp(`(?:[/?#](?:${this.nestedPairRE(`[`,`]`)}|${this.nestedPairRE(`(`,`)`)}|${this.nestedPairRE(`{`,`}`)}|\\"(?:(?!${this.src_ZCc}|["]).){1,100}\\"|\\'(?:(?!${this.src_ZCc}|[']).){1,100}\\'|\\'(?=${this.get_pseudo_letter().source}|[-])|\\.{2,20}[:]?[a-zA-Z0-9%/&]|\\.(?!${this.src_ZCc}|[.]|$)|`+(this.opts[`---`]?`\\-(?!--(?:[^-]|$))(?:-{0,19})|`:`\\-{1,20}|`)+`,(?!${this.src_ZCc}|$)|;(?!${this.src_ZCc}|$)|\\!{1,20}(?!${this.src_ZCc}|[!]|$)|\\?(?!${this.src_ZCc}|[?]|$)|`+this.get_path_extra().source+`[\\\\/:%@#&=_~*]|(?!${this.get_path_terminator().source}).){1,${this.opts.maxLength}}|\\/)?`)}get_mail_name(){return this.cache.src_mail_name??=RegExp("[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9](?:[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9]|[.](?=[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9])){0,63}")}get_xn(){return this.cache.src_xn??=RegExp(`xn--[a-z0-9\\-]{1,59}`)}get_tld(){if(this.cache.tld)return this.cache.tld;let e=[...new Set(this.opts.tlds||[])].sort().reverse().join(`|`);return this.cache.tld=RegExp(`${e||`$#none#$`}|${this.get_xn().source}`),this.cache.tld}get_domain_root(){return this.cache.src_domain_root??=RegExp(`(?:`+this.get_xn().source+`|${this.get_pseudo_letter().source}{1,63})`)}get_domain(){return this.cache.src_domain??=RegExp(`(?:`+this.get_xn().source+`|(?:${this.get_pseudo_letter().source})|(?:${this.get_pseudo_letter().source}(?:-|${this.get_pseudo_letter().source}){0,61}${this.get_pseudo_letter().source}))`)}get_url_host_port(){return this.cache.url_host_port??=RegExp(`(?:`+this.get_ipv6_url_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,10}${this.get_domain().source}))`+this.get_port().source+this.get_host_terminator().source)}get_fuzzy_url_host_port(){return this.cache.fuzzy_url_host_port??=RegExp(`(?:`+(this.opts.fuzzyIP?this.get_ipv4_addr().source+`|`:``)+`(?:(?:(?:${this.get_domain().source})\\.){1,10}(?:${this.get_tld().source})))`+this.get_host_terminator().source)}get_mail_host(){return this.cache.src_mail_host??=RegExp(`(?:`+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,4}${this.get_domain().source}))`+this.get_host_terminator().source)}get_fuzzy_mail_host(){return this.cache.src_fuzzy_mail_host??=RegExp(`(?:`+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})[.]){1,4}${this.get_domain_root().source}))`+this.get_host_terminator().source)}get_path_extra(){return this.cache.src_path_extra??=RegExp(``)}get_fuzzy_mail_host_search(){return this.cache.mail_fuzzy_host_search??=RegExp(`@${this.get_fuzzy_mail_host().source}`,`ig`)}get_fuzzy_link_search(){return this.cache.link_fuzzy_search??=RegExp(`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uff5c]|${this.src_ZPCc}))(?:(?![$+<=>^\`|\uff5c])${this.get_fuzzy_url_host_port().source}${this.get_path().source})`,`ig`)}get_http_validator(){return this.cache.http_validator??=RegExp(`\\/\\/`+(this.opts.urlAuth?this.get_auth().source:``)+this.get_url_host_port().source+this.get_path().source,`iy`)}get_relative_proto_validator(){return this.cache.relative_proto_validator??=RegExp((this.opts.urlAuth?this.get_auth().source:``)+`(?:localhost|${this.get_ipv6_url_host().source}|(?:(?:${this.get_domain().source})[.]){1,10}${this.get_domain_root().source})`+this.get_port().source+this.get_host_terminator().source+this.get_path().source,`iy`)}get_mail_name_validator(){return this.cache.mail_name_validator??=RegExp(`(?:^|${this.get_text_separators().source}|"|\\(|${this.src_ZCc})(${this.get_mail_name().source})$`)}get_mailto_validator(){return this.cache.mailto_validator??=RegExp(`${this.get_mail_name().source}@${this.get_mail_host().source}`,`iy`)}get_schema_names(){return this.cache.schema_names??=new RegExp((this.opts.schema_names||[]).map(e=>this.escapeRE(e)).join(`|`))}get_schema_search(){return this.cache.schema_search??=RegExp(`(^|(?!_)(?:[><\uff5c]|${this.src_ZPCc}))(${this.get_schema_names().source})`,`ig`)}get_schema_at_start(){return this.cache.schema_at_start??=RegExp(`^${this.get_schema_search().source}`,`i`)}},Ri={validate:(e,t,n)=>{let r=n.re.get_http_validator();r.lastIndex=t;let i=r.exec(e);return i?i[0].length:0},normalize:(e,t)=>t.normalize(e)},zi={"http:":Ri,"https:":Ri,"ftp:":Ri,"//":{validate:function(e,t,n){let r=n.re.get_relative_proto_validator();r.lastIndex=t;let i=r.exec(e);return i?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:i[0].length:0},normalize:(e,t)=>t.normalize(e)},"mailto:":{validate:function(e,t,n){let r=n.re.get_mailto_validator();r.lastIndex=t;let i=r.exec(e);return i?i[0].length:0},normalize:(e,t)=>t.normalize(e)}},Bi=`a:cdefgilmnoqrstuwxz|b:abdefghijmnorstvwyz|c:acdfghiklmnoruvwxyz|d:ejkmoz|e:cegrstu|f:ijkmor|g:abdefghilmnpqrstuwy|h:kmnrtu|i:delmnoqrst|j:emop|k:eghimnprwyz|l:abcikrstuvy|m:acdeghklmnopqrstuvwxyz|n:acefgilopruz|o:m|p:aefghklmnrstwy|q:a|r:eosuw|s:abcdeghijklmnortuvxyz|t:cdfghjklmnortvwz|u:agksyz|v:aceginu|w:fs|y:et|z:amw`,Vi=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`;function Hi(){let e=Vi.split(`|`);return Bi.split(`|`).forEach(t=>{let n=t.indexOf(`:`),r=t.slice(0,n);for(let i of t.slice(n+1))e.push(r+i)}),e}var Ui={fuzzyLink:!1,fuzzyEmail:!0,fuzzyIP:!1,"---":!1,tlds:Hi(),urlAuth:!1,maxLength:1e4},Wi=class{schema;index;lastIndex;raw;text;url;constructor(e,t,n,r){let i=e.slice(n,r);this.schema=t.toLowerCase(),this.index=n,this.lastIndex=r,this.raw=i,this.text=i,this.url=i}},Gi=class{__opts__;__schemas__;re;constructor(e={}){let{rebuilder:t,...n}=e;this.__opts__={...Ui,...n},this.__schemas__={...zi},this.re=t||new Li,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)})}add(e,t=null){if(!t)delete this.__schemas__[e];else{let n={normalize:(e,t)=>t.normalize(e),...t};this.__schemas__[e]=n}return this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}set(e={}){return this.__opts__={...this.__opts__,...e},this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}test(e){if(!e.length)return!1;let t,n;for(n=this.re.get_schema_search(),n.lastIndex=0;(t=n.exec(e))!==null;)if(this.testSchemaAt(e,t[2],n.lastIndex))return!0;if(this.__opts__.fuzzyLink&&this.__schemas__[`http:`]&&(n=this.re.get_fuzzy_link_search(),n.lastIndex=0,n.exec(e)!==null))return!0;if(this.__opts__.fuzzyEmail&&this.__schemas__[`mailto:`]&&e.indexOf(`@`)>=0){let n=this.re.get_fuzzy_mail_host_search(),r=this.re.get_mail_name_validator();for(n.lastIndex=0;(t=n.exec(e))!==null;){let n=e.slice(Math.max(0,t.index-65),t.index);if(r.test(n))return!0}}return!1}testSchemaAt(e,t,n){return this.__schemas__[t.toLowerCase()]?this.__schemas__[t.toLowerCase()].validate(e.slice(0,n+this.__opts__.maxLength),n,this):0}match(e){let t=[],n=this.re.get_schema_search(),r,i,a,o,s,c,l=!1,u=!1,d=!1,f=0;if(!e.length)return null;for(n.lastIndex=0,this.__opts__.fuzzyLink&&this.__schemas__[`http:`]&&(r=this.re.get_fuzzy_link_search(),r.lastIndex=0),this.__opts__.fuzzyEmail&&this.__schemas__[`mailto:`]&&(i=this.re.get_fuzzy_mail_host_search(),i.lastIndex=0,a=this.re.get_mail_name_validator());;){let p=Math.max(f-1,0);if(i&&a&&!d&&(!s||s.index<f))for(i.lastIndex<p&&(i.lastIndex=p);;){let t=i.exec(e);if(!t){d=!0,s=void 0;break}let n=a.exec(e.slice(Math.max(0,t.index-65),t.index));if(n){if(s={schema:`mailto:`,index:t.index-n[1].length,lastIndex:t.index+t[0].length},s.index>=f)break;i.lastIndex<p&&(i.lastIndex=p)}}if(r&&!u&&(!o||o.index<f))for(r.lastIndex<p&&(r.lastIndex=p);;){let t=r.exec(e);if(!t){u=!0,o=void 0;break}if(o={schema:``,index:t.index+t[1].length,lastIndex:t.index+t[0].length},o.index>=f)break;r.lastIndex<p&&(r.lastIndex=p)}let m=s;(!m||o&&(o.index<m.index||o.index===m.index&&o.lastIndex>m.lastIndex))&&(m=o);let h;if(!l)for(;;){if(!c){n.lastIndex<p&&(n.lastIndex=p);let t=n.exec(e);if(!t){l=!0;break}c={schema:t[2],index:t.index+t[1].length,lastIndex:t.index+t[0].length}}if(c.index<f){c=void 0;continue}if(m&&c.index>m.index)break;let t=c;c=void 0;let r=this.testSchemaAt(e,t.schema,t.lastIndex);if(r){h={schema:t.schema,index:t.index,lastIndex:t.lastIndex+r};break}}let g=h;if((!g||s&&(s.index<g.index||s.index===g.index&&s.lastIndex>g.lastIndex))&&(g=s),(!g||o&&(o.index<g.index||o.index===g.index&&o.lastIndex>g.lastIndex))&&(g=o),!g)break;g===s?s=void 0:g===o&&(o=void 0);let _=new Wi(e,g.schema,g.index,g.lastIndex);_.schema?this.__schemas__[_.schema].normalize(_,this):this.normalize(_),t.push(_),f=g.lastIndex}return t.length?t:null}matchAtStart(e){if(!e.length)return null;let t=this.re.get_schema_at_start().exec(e);if(!t)return null;let n=this.testSchemaAt(e,t[2],t[0].length);if(!n)return null;let r=new Wi(e,t[2],t.index+t[1].length,t.index+t[0].length+n);return this.__schemas__[r.schema].normalize(r,this),r}tlds(e,t=!1){return e=Array.isArray(e)?e:[e],t?this.__opts__.tlds=this.__opts__.tlds.concat(e):this.__opts__.tlds=e,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}normalize(e){e.schema||(e.url=`http://${e.url}`),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:${e.url}`)}},Ki=2147483647,N=36,qi=1,Ji=26,Yi=38,Xi=700,Zi=72,Qi=128,$i=`-`,ea=/^xn--/,ta=/[^\0-\x7F]/,na=/[\x2E\u3002\uFF0E\uFF61]/g,ra={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},ia=N-qi,P=Math.floor,aa=String.fromCharCode;function oa(e){throw RangeError(ra[e])}function sa(e,t){let n=[],r=e.length;for(;r--;)n[r]=t(e[r]);return n}function ca(e,t){let n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(na,`.`);let i=sa(e.split(`.`),t).join(`.`);return r+i}function la(e){let t=[],n=0,r=e.length;for(;n<r;){let i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){let r=e.charCodeAt(n++);(r&64512)==56320?t.push(((i&1023)<<10)+(r&1023)+65536):(t.push(i),n--)}else t.push(i)}return t}var ua=e=>String.fromCodePoint(...e),da=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:N},fa=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},pa=function(e,t,n){let r=0;for(e=n?P(e/Xi):e>>1,e+=P(e/t);e>455;r+=N)e=P(e/ia);return P(r+36*e/(e+Yi))},ma=function(e){let t=[],n=e.length,r=0,i=Qi,a=Zi,o=e.lastIndexOf($i);o<0&&(o=0);for(let n=0;n<o;++n)e.charCodeAt(n)>=128&&oa(`not-basic`),t.push(e.charCodeAt(n));for(let s=o>0?o+1:0;s<n;){let o=r;for(let t=1,i=N;;i+=N){s>=n&&oa(`invalid-input`);let o=da(e.charCodeAt(s++));o>=N&&oa(`invalid-input`),o>P((Ki-r)/t)&&oa(`overflow`),r+=o*t;let c=i<=a?qi:i>=a+Ji?Ji:i-a;if(o<c)break;let l=N-c;t>P(Ki/l)&&oa(`overflow`),t*=l}let c=t.length+1;a=pa(r-o,c,o==0),P(r/c)>Ki-i&&oa(`overflow`),i+=P(r/c),r%=c,t.splice(r++,0,i)}return String.fromCodePoint(...t)},ha=function(e){let t=[];e=la(e);let n=e.length,r=Qi,i=0,a=Zi;for(let n of e)n<128&&t.push(aa(n));let o=t.length,s=o;for(o&&t.push($i);s<n;){let n=Ki;for(let t of e)t>=r&&t<n&&(n=t);let c=s+1;n-r>P((Ki-i)/c)&&oa(`overflow`),i+=(n-r)*c,r=n;for(let n of e)if(n<r&&++i>Ki&&oa(`overflow`),n===r){let e=i;for(let n=N;;n+=N){let r=n<=a?qi:n>=a+Ji?Ji:n-a;if(e<r)break;let i=e-r,o=N-r;t.push(aa(fa(r+i%o,0))),e=P(i/o)}t.push(aa(fa(e,0))),a=pa(i,c,s===o),i=0,++s}++i,++r}return t.join(``)},ga={version:`2.3.1`,ucs2:{decode:la,encode:ua},decode:ma,encode:ha,toASCII:function(e){return ca(e,function(e){return ta.test(e)?`xn--`+ha(e):e})},toUnicode:function(e){return ca(e,function(e){return ea.test(e)?ma(e.slice(4).toLowerCase()):e})}},_a=Object.defineProperty,va=(e,t)=>{let n={};for(var r in e)_a(n,r,{get:e[r],enumerable:!0});return t||_a(n,Symbol.toStringTag,{value:`Module`}),n},ya=va({arrayReplaceAt:()=>xa,asciiTrim:()=>Ua,callable:()=>ba,escapeHtml:()=>Pa,escapeRE:()=>Ia,fromCodePoint:()=>Ca,isMdAsciiPunct:()=>Ba,isPunctChar:()=>Ra,isPunctCharCode:()=>za,isSpace:()=>F,isValidEntityCode:()=>Sa,isWhiteSpace:()=>La,lib:()=>Wa,normalizeReference:()=>Va,unescapeAll:()=>ka,unescapeMd:()=>Oa});function ba(e){let t=function(...n){return Reflect.construct(e,n,new.target&&new.target!==t?new.target:e)};return Object.defineProperty(t,"name",{value:e.name}),Object.setPrototypeOf(t,e),t.prototype=e.prototype,t}function xa(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function Sa(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function Ca(e){if(e>65535){e-=65536;let t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var wa=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,Ta=RegExp(`${wa.source}|&([a-z#][a-z0-9]{1,31});`,`gi`),Ea=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function Da(e,t){if(t.charCodeAt(0)===35&&Ea.test(t)){let n=t[1].toLowerCase()===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Sa(n)?Ca(n):e}let n=Ni(e);return n===e?e:n}function Oa(e){return e.indexOf(`\\`)<0?e:e.replace(wa,`$1`)}function ka(e){return e.indexOf(`\\`)<0&&e.indexOf(`&`)<0?e:e.replace(Ta,function(e,t,n){return t||Da(e,n)})}var Aa=/[&<>"]/,ja=/[&<>"]/g,Ma={"&":`&`,"<":`<`,">":`>`,'"':`"`};function Na(e){return Ma[e]}function Pa(e){return Aa.test(e)?e.replace(ja,Na):e}var Fa=/[.?*+^$[\]\\(){}|-]/g;function Ia(e){return e.replace(Fa,`\\$&`)}function F(e){switch(e){case 9:case 32:return!0}return!1}function La(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function Ra(e){return gi.test(e)||_i.test(e)}function za(e){return Ra(Ca(e))}function Ba(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function Va(e){return e=e.trim().replace(/\s+/g,` `),e.toLowerCase().toUpperCase()}function Ha(e){return e===32||e===9||e===10||e===13}function Ua(e){let t=0;for(;t<e.length&&Ha(e.charCodeAt(t));t++);let n=e.length-1;for(;n>=t&&Ha(e.charCodeAt(n));n--);return e.slice(t,n+1)}var Wa={mdurl:di,ucmicro:fi};function Ga(e,t,n){let r,i,a,o,s=e.posMax,c=e.pos;for(e.pos=t+1,r=1;e.pos<s;){if(a=e.src.charCodeAt(e.pos),a===93&&(r--,r===0)){i=!0;break}if(o=e.pos,e.md.inline.skipToken(e),a===91){if(o===e.pos-1)r++;else if(n)return e.pos=c,-1}}let l=-1;return i&&(l=e.pos),e.pos=c,l}function Ka(e,t,n){let r,i=t,a={ok:!1,pos:0,str:``};if(e.charCodeAt(i)===60){for(i++;i<n;){if(r=e.charCodeAt(i),r===10||r===60)return a;if(r===62)return a.pos=i+1,a.str=ka(e.slice(t+1,i)),a.ok=!0,a;if(r===92&&i+1<n){i+=2;continue}i++}return a}let o=0;for(;i<n&&(r=e.charCodeAt(i),!(r===32||r<32||r===127));){if(r===92&&i+1<n){if(e.charCodeAt(i+1)===32){i++;continue}i+=2;continue}if(r===40&&(o++,o>32))return a;if(r===41){if(o===0)break;o--}i++}return t===i||o!==0?a:(a.str=ka(e.slice(t,i)),a.pos=i,a.ok=!0,a)}function qa(e,t,n,r){let i,a=t,o={ok:!1,can_continue:!1,pos:0,str:``,marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(a>=n)return o;let r=e.charCodeAt(a);if(r!==34&&r!==39&&r!==40)return o;t++,a++,r===40&&(r=41),o.marker=r}for(;a<n;){if(i=e.charCodeAt(a),i===o.marker)return o.pos=a+1,o.str+=ka(e.slice(t,a)),o.ok=!0,o;if(i===40&&o.marker===41)return o;i===92&&a+1<n&&a++,a++}return o.can_continue=!0,o.str+=ka(e.slice(t,a)),o}var Ja=va({parseLinkDestination:()=>Ka,parseLinkLabel:()=>Ga,parseLinkTitle:()=>qa});function Ya(e){"@babel/helpers - typeof";return Ya=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Ya(e)}function Xa(e,t){if(Ya(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Ya(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Za(e){var t=Xa(e,`string`);return Ya(t)==`symbol`?t:t+``}function I(e,t,n){return(t=Za(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Qa=class{constructor(e,t,n){I(this,`map`,null),I(this,`level`,0),I(this,`children`,null),I(this,`content`,``),I(this,`markup`,``),I(this,`info`,``),I(this,`block`,!1),I(this,`hidden`,!1),this.type=e,this.tag=t,this.attrs=null,this.nesting=n,this.meta=null}attrIndex(e){if(!this.attrs)return-1;let t=this.attrs;for(let n=0,r=t.length;n<r;n++)if(t[n][0]===e)return n;return-1}attrPush(e){this.attrs?this.attrs.push(e):this.attrs=[e]}attrSet(e,t){let n=this.attrIndex(e),r=[e,t];n<0?this.attrPush(r):this.attrs[n]=r}attrGet(e){let t=this.attrIndex(e),n=null;return t>=0&&(n=this.attrs[t][1]),n}attrJoin(e,t){let n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=`${this.attrs[n][1]} ${t}`}},$a=class{constructor(){I(this,`__rules__`,[]),I(this,`__cache__`,null)}__find__(e){for(let t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return-1}__compile__(){let e=new Set;this.__rules__.forEach(t=>{t.enabled&&t.alt.forEach(t=>{t&&e.add(t)})}),this.__cache__=Object.create(null),this.__cache__[``]=[],this.__rules__.forEach(e=>{e.enabled&&this.__cache__[``].push(e.fn)}),e.forEach(e=>{this.__cache__[e]=[],this.__rules__.forEach(t=>{t.enabled&&t.alt.indexOf(e)>=0&&this.__cache__[e].push(t.fn)})})}at(e,t,n={}){let r=this.__find__(e);if(r===-1)throw Error(`Parser rule not found: ${e}`);this.__rules__[r].fn=t,this.__rules__[r].alt=n.alt||[],this.__cache__=null}before(e,t,n,r={}){let i=this.__find__(e);if(i===-1)throw Error(`Parser rule not found: ${e}`);this.__rules__.splice(i,0,{name:t,enabled:!0,fn:n,alt:r.alt||[]}),this.__cache__=null}after(e,t,n,r={}){let i=this.__find__(e);if(i===-1)throw Error(`Parser rule not found: ${e}`);this.__rules__.splice(i+1,0,{name:t,enabled:!0,fn:n,alt:r.alt||[]}),this.__cache__=null}push(e,t,n={}){this.__rules__.push({name:e,enabled:!0,fn:t,alt:n.alt||[]}),this.__cache__=null}enable(e,t=!1){Array.isArray(e)||(e=[e]);let n=[];return e.forEach(e=>{let r=this.__find__(e);if(r<0){if(t)return;throw Error(`Rules manager: invalid rule name ${e}`)}this.__rules__[r].enabled=!0,n.push(e)}),this.__cache__=null,n}enableOnly(e,t=!1){Array.isArray(e)||(e=[e]),this.__rules__.forEach(e=>{e.enabled=!1}),this.enable(e,t)}disable(e,t=!1){Array.isArray(e)||(e=[e]);let n=[];return e.forEach(e=>{let r=this.__find__(e);if(r<0){if(t)return;throw Error(`Rules manager: invalid rule name ${e}`)}this.__rules__[r].enabled=!1,n.push(e)}),this.__cache__=null,n}getRules(e){return this.__cache__||this.__compile__(),this.__cache__[e]||[]}},L={};L.code_inline=function(e,t,n,r,i){let a=e[t];return`<code${i.renderAttrs(a)}>${Pa(a.content)}</code>`},L.code_block=function(e,t,n,r,i){let a=e[t];return`<pre${i.renderAttrs(a)}><code>${Pa(e[t].content)}</code></pre>\n`},L.fence=function(e,t,n,r,i){let a=e[t],o=a.info?ka(a.info).trim():``,s=``,c=``;if(o){let e=o.split(/(\s+)/g);s=e[0],c=e.slice(2).join(``)}let l;if(l=n.highlight&&n.highlight(a.content,s,c)||Pa(a.content),l.indexOf(`<pre`)===0)return l+`
|
|
@@ -299,4 +299,4 @@ import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{t as n}from"./r
|
|
|
299
299
|
else paint();
|
|
300
300
|
report(invalid);
|
|
301
301
|
});
|
|
302
|
-
})();`}function Yc(e,t){let n=e.createElement(`script`);n.textContent=Jc(t),(e.body??e.documentElement).appendChild(n)}var Xc=`script, style, pre, code, kbd, samp, textarea, math, svg, .katex`,Zc=/\bmathjax\b|\bkatex\b/i;function Qc(e){if($c(e))return!1;let t=e.body??e.documentElement;if(!t)return!1;let n=e.createTreeWalker(t,NodeFilter.SHOW_TEXT),r=[];for(;n.nextNode();){let e=n.currentNode;/[$\\]/.test(e.data)&&(e.parentElement?.closest(Xc)||r.push(e))}let i={},a=!1;for(let t of r)el(e,t,i)&&(a=!0);return a}function $c(e){if(e.querySelector(`.katex, math`))return!0;for(let t of e.querySelectorAll(`script`))if(Zc.test(t.getAttribute(`src`)??``)||Zc.test(t.textContent??``))return!0;return!1}function el(e,t,n){let r=t.data;if(!Vt(r))return!1;let i=e.createDocumentFragment(),a=e.createElement(`span`),o=0;for(let t=Vt(r,0);t;t=Vt(r,o)){for(t.start>o&&i.appendChild(e.createTextNode(r.slice(o,t.start))),a.innerHTML=zt(t.tex,t.display,n);a.firstChild;)i.appendChild(a.firstChild);o=t.start+t.length}return o<r.length&&i.appendChild(e.createTextNode(r.slice(o))),t.replaceWith(i),!0}var tl=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]),B;(function(e){e[e.EOF=-1]=`EOF`,e[e.NULL=0]=`NULL`,e[e.TABULATION=9]=`TABULATION`,e[e.CARRIAGE_RETURN=13]=`CARRIAGE_RETURN`,e[e.LINE_FEED=10]=`LINE_FEED`,e[e.FORM_FEED=12]=`FORM_FEED`,e[e.SPACE=32]=`SPACE`,e[e.EXCLAMATION_MARK=33]=`EXCLAMATION_MARK`,e[e.QUOTATION_MARK=34]=`QUOTATION_MARK`,e[e.AMPERSAND=38]=`AMPERSAND`,e[e.APOSTROPHE=39]=`APOSTROPHE`,e[e.HYPHEN_MINUS=45]=`HYPHEN_MINUS`,e[e.SOLIDUS=47]=`SOLIDUS`,e[e.DIGIT_0=48]=`DIGIT_0`,e[e.DIGIT_9=57]=`DIGIT_9`,e[e.SEMICOLON=59]=`SEMICOLON`,e[e.LESS_THAN_SIGN=60]=`LESS_THAN_SIGN`,e[e.EQUALS_SIGN=61]=`EQUALS_SIGN`,e[e.GREATER_THAN_SIGN=62]=`GREATER_THAN_SIGN`,e[e.QUESTION_MARK=63]=`QUESTION_MARK`,e[e.LATIN_CAPITAL_A=65]=`LATIN_CAPITAL_A`,e[e.LATIN_CAPITAL_Z=90]=`LATIN_CAPITAL_Z`,e[e.RIGHT_SQUARE_BRACKET=93]=`RIGHT_SQUARE_BRACKET`,e[e.GRAVE_ACCENT=96]=`GRAVE_ACCENT`,e[e.LATIN_SMALL_A=97]=`LATIN_SMALL_A`,e[e.LATIN_SMALL_Z=122]=`LATIN_SMALL_Z`})(B||={});var V={DASH_DASH:`--`,CDATA_START:`[CDATA[`,DOCTYPE:`doctype`,SCRIPT:`script`,PUBLIC:`public`,SYSTEM:`system`};function nl(e){return e>=55296&&e<=57343}function rl(e){return e>=56320&&e<=57343}function il(e,t){return(e-55296)*1024+9216+t}function al(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function ol(e){return e>=64976&&e<=65007||tl.has(e)}var H;(function(e){e.controlCharacterInInputStream=`control-character-in-input-stream`,e.noncharacterInInputStream=`noncharacter-in-input-stream`,e.surrogateInInputStream=`surrogate-in-input-stream`,e.nonVoidHtmlElementStartTagWithTrailingSolidus=`non-void-html-element-start-tag-with-trailing-solidus`,e.endTagWithAttributes=`end-tag-with-attributes`,e.endTagWithTrailingSolidus=`end-tag-with-trailing-solidus`,e.unexpectedSolidusInTag=`unexpected-solidus-in-tag`,e.unexpectedNullCharacter=`unexpected-null-character`,e.unexpectedQuestionMarkInsteadOfTagName=`unexpected-question-mark-instead-of-tag-name`,e.invalidFirstCharacterOfTagName=`invalid-first-character-of-tag-name`,e.unexpectedEqualsSignBeforeAttributeName=`unexpected-equals-sign-before-attribute-name`,e.missingEndTagName=`missing-end-tag-name`,e.unexpectedCharacterInAttributeName=`unexpected-character-in-attribute-name`,e.unknownNamedCharacterReference=`unknown-named-character-reference`,e.missingSemicolonAfterCharacterReference=`missing-semicolon-after-character-reference`,e.unexpectedCharacterAfterDoctypeSystemIdentifier=`unexpected-character-after-doctype-system-identifier`,e.unexpectedCharacterInUnquotedAttributeValue=`unexpected-character-in-unquoted-attribute-value`,e.eofBeforeTagName=`eof-before-tag-name`,e.eofInTag=`eof-in-tag`,e.missingAttributeValue=`missing-attribute-value`,e.missingWhitespaceBetweenAttributes=`missing-whitespace-between-attributes`,e.missingWhitespaceAfterDoctypePublicKeyword=`missing-whitespace-after-doctype-public-keyword`,e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers=`missing-whitespace-between-doctype-public-and-system-identifiers`,e.missingWhitespaceAfterDoctypeSystemKeyword=`missing-whitespace-after-doctype-system-keyword`,e.missingQuoteBeforeDoctypePublicIdentifier=`missing-quote-before-doctype-public-identifier`,e.missingQuoteBeforeDoctypeSystemIdentifier=`missing-quote-before-doctype-system-identifier`,e.missingDoctypePublicIdentifier=`missing-doctype-public-identifier`,e.missingDoctypeSystemIdentifier=`missing-doctype-system-identifier`,e.abruptDoctypePublicIdentifier=`abrupt-doctype-public-identifier`,e.abruptDoctypeSystemIdentifier=`abrupt-doctype-system-identifier`,e.cdataInHtmlContent=`cdata-in-html-content`,e.incorrectlyOpenedComment=`incorrectly-opened-comment`,e.eofInScriptHtmlCommentLikeText=`eof-in-script-html-comment-like-text`,e.eofInDoctype=`eof-in-doctype`,e.nestedComment=`nested-comment`,e.abruptClosingOfEmptyComment=`abrupt-closing-of-empty-comment`,e.eofInComment=`eof-in-comment`,e.incorrectlyClosedComment=`incorrectly-closed-comment`,e.eofInCdata=`eof-in-cdata`,e.absenceOfDigitsInNumericCharacterReference=`absence-of-digits-in-numeric-character-reference`,e.nullCharacterReference=`null-character-reference`,e.surrogateCharacterReference=`surrogate-character-reference`,e.characterReferenceOutsideUnicodeRange=`character-reference-outside-unicode-range`,e.controlCharacterReference=`control-character-reference`,e.noncharacterCharacterReference=`noncharacter-character-reference`,e.missingWhitespaceBeforeDoctypeName=`missing-whitespace-before-doctype-name`,e.missingDoctypeName=`missing-doctype-name`,e.invalidCharacterSequenceAfterDoctypeName=`invalid-character-sequence-after-doctype-name`,e.duplicateAttribute=`duplicate-attribute`,e.nonConformingDoctype=`non-conforming-doctype`,e.missingDoctype=`missing-doctype`,e.misplacedDoctype=`misplaced-doctype`,e.endTagWithoutMatchingOpenElement=`end-tag-without-matching-open-element`,e.closingOfElementWithOpenChildElements=`closing-of-element-with-open-child-elements`,e.disallowedContentInNoscriptInHead=`disallowed-content-in-noscript-in-head`,e.openElementsLeftAfterEof=`open-elements-left-after-eof`,e.abandonedHeadElementChild=`abandoned-head-element-child`,e.misplacedStartTagForHeadElement=`misplaced-start-tag-for-head-element`,e.nestedNoscriptInHead=`nested-noscript-in-head`,e.eofInElementThatCanContainOnlyText=`eof-in-element-that-can-contain-only-text`})(H||={});var sl=65536,cl=class{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=sl,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,t){let{line:n,col:r,offset:i}=this,a=r+t,o=i+t;return{code:e,startLine:n,endLine:n,startCol:a,endCol:a,startOffset:o,endOffset:o}}_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){let t=this.html.charCodeAt(this.pos+1);if(rl(t))return this.pos++,this._addGap(),il(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,B.EOF;return this._err(H.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 t=0;t<e.length;t++)if((this.html.charCodeAt(this.pos+t)|32)!==e.charCodeAt(t))return!1;return!0}peek(e){let t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,B.EOF;let n=this.html.charCodeAt(t);return n===B.CARRIAGE_RETURN?B.LINE_FEED:n}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,nl(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){al(e)?this._err(H.controlCharacterInInputStream):ol(e)&&this._err(H.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}},U;(function(e){e[e.CHARACTER=0]=`CHARACTER`,e[e.NULL_CHARACTER=1]=`NULL_CHARACTER`,e[e.WHITESPACE_CHARACTER=2]=`WHITESPACE_CHARACTER`,e[e.START_TAG=3]=`START_TAG`,e[e.END_TAG=4]=`END_TAG`,e[e.COMMENT=5]=`COMMENT`,e[e.DOCTYPE=6]=`DOCTYPE`,e[e.EOF=7]=`EOF`,e[e.HIBERNATION=8]=`HIBERNATION`})(U||={});function ll(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}var W;(function(e){e.HTML=`http://www.w3.org/1999/xhtml`,e.MATHML=`http://www.w3.org/1998/Math/MathML`,e.SVG=`http://www.w3.org/2000/svg`,e.XLINK=`http://www.w3.org/1999/xlink`,e.XML=`http://www.w3.org/XML/1998/namespace`,e.XMLNS=`http://www.w3.org/2000/xmlns/`})(W||={});var ul;(function(e){e.TYPE=`type`,e.ACTION=`action`,e.ENCODING=`encoding`,e.PROMPT=`prompt`,e.NAME=`name`,e.COLOR=`color`,e.FACE=`face`,e.SIZE=`size`})(ul||={});var G;(function(e){e.NO_QUIRKS=`no-quirks`,e.QUIRKS=`quirks`,e.LIMITED_QUIRKS=`limited-quirks`})(G||={});var K;(function(e){e.A=`a`,e.ADDRESS=`address`,e.ANNOTATION_XML=`annotation-xml`,e.APPLET=`applet`,e.AREA=`area`,e.ARTICLE=`article`,e.ASIDE=`aside`,e.B=`b`,e.BASE=`base`,e.BASEFONT=`basefont`,e.BGSOUND=`bgsound`,e.BIG=`big`,e.BLOCKQUOTE=`blockquote`,e.BODY=`body`,e.BR=`br`,e.BUTTON=`button`,e.CAPTION=`caption`,e.CENTER=`center`,e.CODE=`code`,e.COL=`col`,e.COLGROUP=`colgroup`,e.DD=`dd`,e.DESC=`desc`,e.DETAILS=`details`,e.DIALOG=`dialog`,e.DIR=`dir`,e.DIV=`div`,e.DL=`dl`,e.DT=`dt`,e.EM=`em`,e.EMBED=`embed`,e.FIELDSET=`fieldset`,e.FIGCAPTION=`figcaption`,e.FIGURE=`figure`,e.FONT=`font`,e.FOOTER=`footer`,e.FOREIGN_OBJECT=`foreignObject`,e.FORM=`form`,e.FRAME=`frame`,e.FRAMESET=`frameset`,e.H1=`h1`,e.H2=`h2`,e.H3=`h3`,e.H4=`h4`,e.H5=`h5`,e.H6=`h6`,e.HEAD=`head`,e.HEADER=`header`,e.HGROUP=`hgroup`,e.HR=`hr`,e.HTML=`html`,e.I=`i`,e.IMG=`img`,e.IMAGE=`image`,e.INPUT=`input`,e.IFRAME=`iframe`,e.KEYGEN=`keygen`,e.LABEL=`label`,e.LI=`li`,e.LINK=`link`,e.LISTING=`listing`,e.MAIN=`main`,e.MALIGNMARK=`malignmark`,e.MARQUEE=`marquee`,e.MATH=`math`,e.MENU=`menu`,e.META=`meta`,e.MGLYPH=`mglyph`,e.MI=`mi`,e.MO=`mo`,e.MN=`mn`,e.MS=`ms`,e.MTEXT=`mtext`,e.NAV=`nav`,e.NOBR=`nobr`,e.NOFRAMES=`noframes`,e.NOEMBED=`noembed`,e.NOSCRIPT=`noscript`,e.OBJECT=`object`,e.OL=`ol`,e.OPTGROUP=`optgroup`,e.OPTION=`option`,e.P=`p`,e.PARAM=`param`,e.PLAINTEXT=`plaintext`,e.PRE=`pre`,e.RB=`rb`,e.RP=`rp`,e.RT=`rt`,e.RTC=`rtc`,e.RUBY=`ruby`,e.S=`s`,e.SCRIPT=`script`,e.SEARCH=`search`,e.SECTION=`section`,e.SELECT=`select`,e.SOURCE=`source`,e.SMALL=`small`,e.SPAN=`span`,e.STRIKE=`strike`,e.STRONG=`strong`,e.STYLE=`style`,e.SUB=`sub`,e.SUMMARY=`summary`,e.SUP=`sup`,e.TABLE=`table`,e.TBODY=`tbody`,e.TEMPLATE=`template`,e.TEXTAREA=`textarea`,e.TFOOT=`tfoot`,e.TD=`td`,e.TH=`th`,e.THEAD=`thead`,e.TITLE=`title`,e.TR=`tr`,e.TRACK=`track`,e.TT=`tt`,e.U=`u`,e.UL=`ul`,e.SVG=`svg`,e.VAR=`var`,e.WBR=`wbr`,e.XMP=`xmp`})(K||={});var q;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.A=1]=`A`,e[e.ADDRESS=2]=`ADDRESS`,e[e.ANNOTATION_XML=3]=`ANNOTATION_XML`,e[e.APPLET=4]=`APPLET`,e[e.AREA=5]=`AREA`,e[e.ARTICLE=6]=`ARTICLE`,e[e.ASIDE=7]=`ASIDE`,e[e.B=8]=`B`,e[e.BASE=9]=`BASE`,e[e.BASEFONT=10]=`BASEFONT`,e[e.BGSOUND=11]=`BGSOUND`,e[e.BIG=12]=`BIG`,e[e.BLOCKQUOTE=13]=`BLOCKQUOTE`,e[e.BODY=14]=`BODY`,e[e.BR=15]=`BR`,e[e.BUTTON=16]=`BUTTON`,e[e.CAPTION=17]=`CAPTION`,e[e.CENTER=18]=`CENTER`,e[e.CODE=19]=`CODE`,e[e.COL=20]=`COL`,e[e.COLGROUP=21]=`COLGROUP`,e[e.DD=22]=`DD`,e[e.DESC=23]=`DESC`,e[e.DETAILS=24]=`DETAILS`,e[e.DIALOG=25]=`DIALOG`,e[e.DIR=26]=`DIR`,e[e.DIV=27]=`DIV`,e[e.DL=28]=`DL`,e[e.DT=29]=`DT`,e[e.EM=30]=`EM`,e[e.EMBED=31]=`EMBED`,e[e.FIELDSET=32]=`FIELDSET`,e[e.FIGCAPTION=33]=`FIGCAPTION`,e[e.FIGURE=34]=`FIGURE`,e[e.FONT=35]=`FONT`,e[e.FOOTER=36]=`FOOTER`,e[e.FOREIGN_OBJECT=37]=`FOREIGN_OBJECT`,e[e.FORM=38]=`FORM`,e[e.FRAME=39]=`FRAME`,e[e.FRAMESET=40]=`FRAMESET`,e[e.H1=41]=`H1`,e[e.H2=42]=`H2`,e[e.H3=43]=`H3`,e[e.H4=44]=`H4`,e[e.H5=45]=`H5`,e[e.H6=46]=`H6`,e[e.HEAD=47]=`HEAD`,e[e.HEADER=48]=`HEADER`,e[e.HGROUP=49]=`HGROUP`,e[e.HR=50]=`HR`,e[e.HTML=51]=`HTML`,e[e.I=52]=`I`,e[e.IMG=53]=`IMG`,e[e.IMAGE=54]=`IMAGE`,e[e.INPUT=55]=`INPUT`,e[e.IFRAME=56]=`IFRAME`,e[e.KEYGEN=57]=`KEYGEN`,e[e.LABEL=58]=`LABEL`,e[e.LI=59]=`LI`,e[e.LINK=60]=`LINK`,e[e.LISTING=61]=`LISTING`,e[e.MAIN=62]=`MAIN`,e[e.MALIGNMARK=63]=`MALIGNMARK`,e[e.MARQUEE=64]=`MARQUEE`,e[e.MATH=65]=`MATH`,e[e.MENU=66]=`MENU`,e[e.META=67]=`META`,e[e.MGLYPH=68]=`MGLYPH`,e[e.MI=69]=`MI`,e[e.MO=70]=`MO`,e[e.MN=71]=`MN`,e[e.MS=72]=`MS`,e[e.MTEXT=73]=`MTEXT`,e[e.NAV=74]=`NAV`,e[e.NOBR=75]=`NOBR`,e[e.NOFRAMES=76]=`NOFRAMES`,e[e.NOEMBED=77]=`NOEMBED`,e[e.NOSCRIPT=78]=`NOSCRIPT`,e[e.OBJECT=79]=`OBJECT`,e[e.OL=80]=`OL`,e[e.OPTGROUP=81]=`OPTGROUP`,e[e.OPTION=82]=`OPTION`,e[e.P=83]=`P`,e[e.PARAM=84]=`PARAM`,e[e.PLAINTEXT=85]=`PLAINTEXT`,e[e.PRE=86]=`PRE`,e[e.RB=87]=`RB`,e[e.RP=88]=`RP`,e[e.RT=89]=`RT`,e[e.RTC=90]=`RTC`,e[e.RUBY=91]=`RUBY`,e[e.S=92]=`S`,e[e.SCRIPT=93]=`SCRIPT`,e[e.SEARCH=94]=`SEARCH`,e[e.SECTION=95]=`SECTION`,e[e.SELECT=96]=`SELECT`,e[e.SOURCE=97]=`SOURCE`,e[e.SMALL=98]=`SMALL`,e[e.SPAN=99]=`SPAN`,e[e.STRIKE=100]=`STRIKE`,e[e.STRONG=101]=`STRONG`,e[e.STYLE=102]=`STYLE`,e[e.SUB=103]=`SUB`,e[e.SUMMARY=104]=`SUMMARY`,e[e.SUP=105]=`SUP`,e[e.TABLE=106]=`TABLE`,e[e.TBODY=107]=`TBODY`,e[e.TEMPLATE=108]=`TEMPLATE`,e[e.TEXTAREA=109]=`TEXTAREA`,e[e.TFOOT=110]=`TFOOT`,e[e.TD=111]=`TD`,e[e.TH=112]=`TH`,e[e.THEAD=113]=`THEAD`,e[e.TITLE=114]=`TITLE`,e[e.TR=115]=`TR`,e[e.TRACK=116]=`TRACK`,e[e.TT=117]=`TT`,e[e.U=118]=`U`,e[e.UL=119]=`UL`,e[e.SVG=120]=`SVG`,e[e.VAR=121]=`VAR`,e[e.WBR=122]=`WBR`,e[e.XMP=123]=`XMP`})(q||={});var dl=new Map([[K.A,q.A],[K.ADDRESS,q.ADDRESS],[K.ANNOTATION_XML,q.ANNOTATION_XML],[K.APPLET,q.APPLET],[K.AREA,q.AREA],[K.ARTICLE,q.ARTICLE],[K.ASIDE,q.ASIDE],[K.B,q.B],[K.BASE,q.BASE],[K.BASEFONT,q.BASEFONT],[K.BGSOUND,q.BGSOUND],[K.BIG,q.BIG],[K.BLOCKQUOTE,q.BLOCKQUOTE],[K.BODY,q.BODY],[K.BR,q.BR],[K.BUTTON,q.BUTTON],[K.CAPTION,q.CAPTION],[K.CENTER,q.CENTER],[K.CODE,q.CODE],[K.COL,q.COL],[K.COLGROUP,q.COLGROUP],[K.DD,q.DD],[K.DESC,q.DESC],[K.DETAILS,q.DETAILS],[K.DIALOG,q.DIALOG],[K.DIR,q.DIR],[K.DIV,q.DIV],[K.DL,q.DL],[K.DT,q.DT],[K.EM,q.EM],[K.EMBED,q.EMBED],[K.FIELDSET,q.FIELDSET],[K.FIGCAPTION,q.FIGCAPTION],[K.FIGURE,q.FIGURE],[K.FONT,q.FONT],[K.FOOTER,q.FOOTER],[K.FOREIGN_OBJECT,q.FOREIGN_OBJECT],[K.FORM,q.FORM],[K.FRAME,q.FRAME],[K.FRAMESET,q.FRAMESET],[K.H1,q.H1],[K.H2,q.H2],[K.H3,q.H3],[K.H4,q.H4],[K.H5,q.H5],[K.H6,q.H6],[K.HEAD,q.HEAD],[K.HEADER,q.HEADER],[K.HGROUP,q.HGROUP],[K.HR,q.HR],[K.HTML,q.HTML],[K.I,q.I],[K.IMG,q.IMG],[K.IMAGE,q.IMAGE],[K.INPUT,q.INPUT],[K.IFRAME,q.IFRAME],[K.KEYGEN,q.KEYGEN],[K.LABEL,q.LABEL],[K.LI,q.LI],[K.LINK,q.LINK],[K.LISTING,q.LISTING],[K.MAIN,q.MAIN],[K.MALIGNMARK,q.MALIGNMARK],[K.MARQUEE,q.MARQUEE],[K.MATH,q.MATH],[K.MENU,q.MENU],[K.META,q.META],[K.MGLYPH,q.MGLYPH],[K.MI,q.MI],[K.MO,q.MO],[K.MN,q.MN],[K.MS,q.MS],[K.MTEXT,q.MTEXT],[K.NAV,q.NAV],[K.NOBR,q.NOBR],[K.NOFRAMES,q.NOFRAMES],[K.NOEMBED,q.NOEMBED],[K.NOSCRIPT,q.NOSCRIPT],[K.OBJECT,q.OBJECT],[K.OL,q.OL],[K.OPTGROUP,q.OPTGROUP],[K.OPTION,q.OPTION],[K.P,q.P],[K.PARAM,q.PARAM],[K.PLAINTEXT,q.PLAINTEXT],[K.PRE,q.PRE],[K.RB,q.RB],[K.RP,q.RP],[K.RT,q.RT],[K.RTC,q.RTC],[K.RUBY,q.RUBY],[K.S,q.S],[K.SCRIPT,q.SCRIPT],[K.SEARCH,q.SEARCH],[K.SECTION,q.SECTION],[K.SELECT,q.SELECT],[K.SOURCE,q.SOURCE],[K.SMALL,q.SMALL],[K.SPAN,q.SPAN],[K.STRIKE,q.STRIKE],[K.STRONG,q.STRONG],[K.STYLE,q.STYLE],[K.SUB,q.SUB],[K.SUMMARY,q.SUMMARY],[K.SUP,q.SUP],[K.TABLE,q.TABLE],[K.TBODY,q.TBODY],[K.TEMPLATE,q.TEMPLATE],[K.TEXTAREA,q.TEXTAREA],[K.TFOOT,q.TFOOT],[K.TD,q.TD],[K.TH,q.TH],[K.THEAD,q.THEAD],[K.TITLE,q.TITLE],[K.TR,q.TR],[K.TRACK,q.TRACK],[K.TT,q.TT],[K.U,q.U],[K.UL,q.UL],[K.SVG,q.SVG],[K.VAR,q.VAR],[K.WBR,q.WBR],[K.XMP,q.XMP]]);function fl(e){return dl.get(e)??q.UNKNOWN}var J=q,pl={[W.HTML]:new Set([J.ADDRESS,J.APPLET,J.AREA,J.ARTICLE,J.ASIDE,J.BASE,J.BASEFONT,J.BGSOUND,J.BLOCKQUOTE,J.BODY,J.BR,J.BUTTON,J.CAPTION,J.CENTER,J.COL,J.COLGROUP,J.DD,J.DETAILS,J.DIR,J.DIV,J.DL,J.DT,J.EMBED,J.FIELDSET,J.FIGCAPTION,J.FIGURE,J.FOOTER,J.FORM,J.FRAME,J.FRAMESET,J.H1,J.H2,J.H3,J.H4,J.H5,J.H6,J.HEAD,J.HEADER,J.HGROUP,J.HR,J.HTML,J.IFRAME,J.IMG,J.INPUT,J.LI,J.LINK,J.LISTING,J.MAIN,J.MARQUEE,J.MENU,J.META,J.NAV,J.NOEMBED,J.NOFRAMES,J.NOSCRIPT,J.OBJECT,J.OL,J.P,J.PARAM,J.PLAINTEXT,J.PRE,J.SCRIPT,J.SECTION,J.SELECT,J.SOURCE,J.STYLE,J.SUMMARY,J.TABLE,J.TBODY,J.TD,J.TEMPLATE,J.TEXTAREA,J.TFOOT,J.TH,J.THEAD,J.TITLE,J.TR,J.TRACK,J.UL,J.WBR,J.XMP]),[W.MATHML]:new Set([J.MI,J.MO,J.MN,J.MS,J.MTEXT,J.ANNOTATION_XML]),[W.SVG]:new Set([J.TITLE,J.FOREIGN_OBJECT,J.DESC]),[W.XLINK]:new Set,[W.XML]:new Set,[W.XMLNS]:new Set},ml=new Set([J.H1,J.H2,J.H3,J.H4,J.H5,J.H6]),hl=new Set([K.STYLE,K.SCRIPT,K.XMP,K.IFRAME,K.NOEMBED,K.NOFRAMES,K.PLAINTEXT]);function gl(e,t){return hl.has(e)||t&&e===K.NOSCRIPT}var Y;(function(e){e[e.DATA=0]=`DATA`,e[e.RCDATA=1]=`RCDATA`,e[e.RAWTEXT=2]=`RAWTEXT`,e[e.SCRIPT_DATA=3]=`SCRIPT_DATA`,e[e.PLAINTEXT=4]=`PLAINTEXT`,e[e.TAG_OPEN=5]=`TAG_OPEN`,e[e.END_TAG_OPEN=6]=`END_TAG_OPEN`,e[e.TAG_NAME=7]=`TAG_NAME`,e[e.RCDATA_LESS_THAN_SIGN=8]=`RCDATA_LESS_THAN_SIGN`,e[e.RCDATA_END_TAG_OPEN=9]=`RCDATA_END_TAG_OPEN`,e[e.RCDATA_END_TAG_NAME=10]=`RCDATA_END_TAG_NAME`,e[e.RAWTEXT_LESS_THAN_SIGN=11]=`RAWTEXT_LESS_THAN_SIGN`,e[e.RAWTEXT_END_TAG_OPEN=12]=`RAWTEXT_END_TAG_OPEN`,e[e.RAWTEXT_END_TAG_NAME=13]=`RAWTEXT_END_TAG_NAME`,e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]=`SCRIPT_DATA_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_END_TAG_OPEN=15]=`SCRIPT_DATA_END_TAG_OPEN`,e[e.SCRIPT_DATA_END_TAG_NAME=16]=`SCRIPT_DATA_END_TAG_NAME`,e[e.SCRIPT_DATA_ESCAPE_START=17]=`SCRIPT_DATA_ESCAPE_START`,e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]=`SCRIPT_DATA_ESCAPE_START_DASH`,e[e.SCRIPT_DATA_ESCAPED=19]=`SCRIPT_DATA_ESCAPED`,e[e.SCRIPT_DATA_ESCAPED_DASH=20]=`SCRIPT_DATA_ESCAPED_DASH`,e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]=`SCRIPT_DATA_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]=`SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]=`SCRIPT_DATA_ESCAPED_END_TAG_OPEN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]=`SCRIPT_DATA_ESCAPED_END_TAG_NAME`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]=`SCRIPT_DATA_DOUBLE_ESCAPE_START`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]=`SCRIPT_DATA_DOUBLE_ESCAPED`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]=`SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]=`SCRIPT_DATA_DOUBLE_ESCAPE_END`,e[e.BEFORE_ATTRIBUTE_NAME=31]=`BEFORE_ATTRIBUTE_NAME`,e[e.ATTRIBUTE_NAME=32]=`ATTRIBUTE_NAME`,e[e.AFTER_ATTRIBUTE_NAME=33]=`AFTER_ATTRIBUTE_NAME`,e[e.BEFORE_ATTRIBUTE_VALUE=34]=`BEFORE_ATTRIBUTE_VALUE`,e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]=`ATTRIBUTE_VALUE_DOUBLE_QUOTED`,e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]=`ATTRIBUTE_VALUE_SINGLE_QUOTED`,e[e.ATTRIBUTE_VALUE_UNQUOTED=37]=`ATTRIBUTE_VALUE_UNQUOTED`,e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]=`AFTER_ATTRIBUTE_VALUE_QUOTED`,e[e.SELF_CLOSING_START_TAG=39]=`SELF_CLOSING_START_TAG`,e[e.BOGUS_COMMENT=40]=`BOGUS_COMMENT`,e[e.MARKUP_DECLARATION_OPEN=41]=`MARKUP_DECLARATION_OPEN`,e[e.COMMENT_START=42]=`COMMENT_START`,e[e.COMMENT_START_DASH=43]=`COMMENT_START_DASH`,e[e.COMMENT=44]=`COMMENT`,e[e.COMMENT_LESS_THAN_SIGN=45]=`COMMENT_LESS_THAN_SIGN`,e[e.COMMENT_LESS_THAN_SIGN_BANG=46]=`COMMENT_LESS_THAN_SIGN_BANG`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]=`COMMENT_LESS_THAN_SIGN_BANG_DASH`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]=`COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH`,e[e.COMMENT_END_DASH=49]=`COMMENT_END_DASH`,e[e.COMMENT_END=50]=`COMMENT_END`,e[e.COMMENT_END_BANG=51]=`COMMENT_END_BANG`,e[e.DOCTYPE=52]=`DOCTYPE`,e[e.BEFORE_DOCTYPE_NAME=53]=`BEFORE_DOCTYPE_NAME`,e[e.DOCTYPE_NAME=54]=`DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_NAME=55]=`AFTER_DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]=`AFTER_DOCTYPE_PUBLIC_KEYWORD`,e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]=`BEFORE_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]=`DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]=`DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]=`AFTER_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]=`BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS`,e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]=`AFTER_DOCTYPE_SYSTEM_KEYWORD`,e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]=`BEFORE_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]=`DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]=`DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]=`AFTER_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.BOGUS_DOCTYPE=67]=`BOGUS_DOCTYPE`,e[e.CDATA_SECTION=68]=`CDATA_SECTION`,e[e.CDATA_SECTION_BRACKET=69]=`CDATA_SECTION_BRACKET`,e[e.CDATA_SECTION_END=70]=`CDATA_SECTION_END`,e[e.CHARACTER_REFERENCE=71]=`CHARACTER_REFERENCE`,e[e.AMBIGUOUS_AMPERSAND=72]=`AMBIGUOUS_AMPERSAND`})(Y||={});var X={DATA:Y.DATA,RCDATA:Y.RCDATA,RAWTEXT:Y.RAWTEXT,SCRIPT_DATA:Y.SCRIPT_DATA,PLAINTEXT:Y.PLAINTEXT,CDATA_SECTION:Y.CDATA_SECTION};function _l(e){return e>=B.DIGIT_0&&e<=B.DIGIT_9}function vl(e){return e>=B.LATIN_CAPITAL_A&&e<=B.LATIN_CAPITAL_Z}function yl(e){return e>=B.LATIN_SMALL_A&&e<=B.LATIN_SMALL_Z}function bl(e){return yl(e)||vl(e)}function xl(e){return bl(e)||_l(e)}function Sl(e){return e+32}function Cl(e){return e===B.SPACE||e===B.LINE_FEED||e===B.TABULATION||e===B.FORM_FEED}function wl(e){return Cl(e)||e===B.SOLIDUS||e===B.GREATER_THAN_SIGN}function Tl(e){return e===B.NULL?H.nullCharacterReference:e>1114111?H.characterReferenceOutsideUnicodeRange:nl(e)?H.surrogateCharacterReference:ol(e)?H.noncharacterCharacterReference:al(e)||e===B.CARRIAGE_RETURN?H.controlCharacterReference:null}var El=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=Y.DATA,this.returnState=Y.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:``,value:``},this.preprocessor=new cl(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new ki(Si,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(H.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(H.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{let t=Tl(e);t&&this._err(t,1)}}:void 0)}_err(e,t=0){var n,r;(r=(n=this.handler).onParseError)==null||r.call(n,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;let e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw Error(`Parser was already resumed`);this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e?.())}write(e,t,n){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||n?.()}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:U.START_TAG,tagName:``,tagID:q.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:U.END_TAG,tagName:``,tagID:q.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:U.COMMENT,data:``,location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:U.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;let t=this.currentToken;if(ll(t,this.currentAttr.name)===null){if(t.attrs.push(this.currentAttr),t.location&&this.currentLocation){let n=(e=t.location).attrs??(e.attrs=Object.create(null));n[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(H.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(){let e=this.currentToken;this.prepareToken(e),e.tagID=fl(e.tagName),e.type===U.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(H.endTagWithAttributes),e.selfClosing&&this._err(H.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 U.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case U.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case U.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}this.currentCharacterToken=null}}_emitEOFToken(){let e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:U.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){let t=Cl(e)?U.WHITESPACE_CHARACTER:e===B.NULL?U.NULL_CHARACTER:U.CHARACTER;this._appendCharToCurrentCharacterToken(t,e<65536?String.fromCharCode(e):String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(U.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=Y.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Oi.Attribute:Oi.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===Y.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===Y.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===Y.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case Y.DATA:this._stateData(e);break;case Y.RCDATA:this._stateRcdata(e);break;case Y.RAWTEXT:this._stateRawtext(e);break;case Y.SCRIPT_DATA:this._stateScriptData(e);break;case Y.PLAINTEXT:this._statePlaintext(e);break;case Y.TAG_OPEN:this._stateTagOpen(e);break;case Y.END_TAG_OPEN:this._stateEndTagOpen(e);break;case Y.TAG_NAME:this._stateTagName(e);break;case Y.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case Y.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case Y.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case Y.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case Y.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case Y.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case Y.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case Y.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case Y.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case Y.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case Y.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case Y.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case Y.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case Y.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case Y.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case Y.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case Y.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case Y.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case Y.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case Y.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case Y.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case Y.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case Y.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case Y.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case Y.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case Y.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case Y.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case Y.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case Y.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case Y.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case Y.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case Y.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case Y.BOGUS_COMMENT:this._stateBogusComment(e);break;case Y.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case Y.COMMENT_START:this._stateCommentStart(e);break;case Y.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case Y.COMMENT:this._stateComment(e);break;case Y.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case Y.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case Y.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case Y.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case Y.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case Y.COMMENT_END:this._stateCommentEnd(e);break;case Y.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case Y.DOCTYPE:this._stateDoctype(e);break;case Y.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case Y.DOCTYPE_NAME:this._stateDoctypeName(e);break;case Y.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case Y.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case Y.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case Y.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case Y.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case Y.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case Y.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case Y.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case Y.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case Y.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case Y.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case Y.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case Y.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case Y.CDATA_SECTION:this._stateCdataSection(e);break;case Y.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case Y.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case Y.CHARACTER_REFERENCE:this._stateCharacterReference();break;case Y.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw Error(`Unknown state`)}}_stateData(e){switch(e){case B.LESS_THAN_SIGN:this.state=Y.TAG_OPEN;break;case B.AMPERSAND:this._startCharacterReference();break;case B.NULL:this._err(H.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=Y.RCDATA_LESS_THAN_SIGN;break;case B.NULL:this._err(H.unexpectedNullCharacter),this._emitChars(`�`);break;case B.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case B.LESS_THAN_SIGN:this.state=Y.RAWTEXT_LESS_THAN_SIGN;break;case B.NULL:this._err(H.unexpectedNullCharacter),this._emitChars(`�`);break;case B.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case B.LESS_THAN_SIGN:this.state=Y.SCRIPT_DATA_LESS_THAN_SIGN;break;case B.NULL:this._err(H.unexpectedNullCharacter),this._emitChars(`�`);break;case B.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case B.NULL:this._err(H.unexpectedNullCharacter),this._emitChars(`�`);break;case B.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if(bl(e))this._createStartTagToken(),this.state=Y.TAG_NAME,this._stateTagName(e);else switch(e){case B.EXCLAMATION_MARK:this.state=Y.MARKUP_DECLARATION_OPEN;break;case B.SOLIDUS:this.state=Y.END_TAG_OPEN;break;case B.QUESTION_MARK:this._err(H.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=Y.BOGUS_COMMENT,this._stateBogusComment(e);break;case B.EOF:this._err(H.eofBeforeTagName),this._emitChars(`<`),this._emitEOFToken();break;default:this._err(H.invalidFirstCharacterOfTagName),this._emitChars(`<`),this.state=Y.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(bl(e))this._createEndTagToken(),this.state=Y.TAG_NAME,this._stateTagName(e);else switch(e){case B.GREATER_THAN_SIGN:this._err(H.missingEndTagName),this.state=Y.DATA;break;case B.EOF:this._err(H.eofBeforeTagName),this._emitChars(`</`),this._emitEOFToken();break;default:this._err(H.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=Y.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this.state=Y.BEFORE_ATTRIBUTE_NAME;break;case B.SOLIDUS:this.state=Y.SELF_CLOSING_START_TAG;break;case B.GREATER_THAN_SIGN:this.state=Y.DATA,this.emitCurrentTagToken();break;case B.NULL:this._err(H.unexpectedNullCharacter),t.tagName+=`�`;break;case B.EOF:this._err(H.eofInTag),this._emitEOFToken();break;default:t.tagName+=String.fromCodePoint(vl(e)?Sl(e):e)}}_stateRcdataLessThanSign(e){e===B.SOLIDUS?this.state=Y.RCDATA_END_TAG_OPEN:(this._emitChars(`<`),this.state=Y.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){bl(e)?(this.state=Y.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars(`</`),this.state=Y.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();let 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=Y.BEFORE_ATTRIBUTE_NAME,!1;case B.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=Y.SELF_CLOSING_START_TAG,!1;case B.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=Y.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Y.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===B.SOLIDUS?this.state=Y.RAWTEXT_END_TAG_OPEN:(this._emitChars(`<`),this.state=Y.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){bl(e)?(this.state=Y.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars(`</`),this.state=Y.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Y.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case B.SOLIDUS:this.state=Y.SCRIPT_DATA_END_TAG_OPEN;break;case B.EXCLAMATION_MARK:this.state=Y.SCRIPT_DATA_ESCAPE_START,this._emitChars(`<!`);break;default:this._emitChars(`<`),this.state=Y.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){bl(e)?(this.state=Y.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars(`</`),this.state=Y.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Y.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===B.HYPHEN_MINUS?(this.state=Y.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars(`-`)):(this.state=Y.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===B.HYPHEN_MINUS?(this.state=Y.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`)):(this.state=Y.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case B.HYPHEN_MINUS:this.state=Y.SCRIPT_DATA_ESCAPED_DASH,this._emitChars(`-`);break;case B.LESS_THAN_SIGN:this.state=Y.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case B.NULL:this._err(H.unexpectedNullCharacter),this._emitChars(`�`);break;case B.EOF:this._err(H.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case B.HYPHEN_MINUS:this.state=Y.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case B.LESS_THAN_SIGN:this.state=Y.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case B.NULL:this._err(H.unexpectedNullCharacter),this.state=Y.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case B.EOF:this._err(H.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Y.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case B.HYPHEN_MINUS:this._emitChars(`-`);break;case B.LESS_THAN_SIGN:this.state=Y.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case B.GREATER_THAN_SIGN:this.state=Y.SCRIPT_DATA,this._emitChars(`>`);break;case B.NULL:this._err(H.unexpectedNullCharacter),this.state=Y.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case B.EOF:this._err(H.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Y.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===B.SOLIDUS?this.state=Y.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:bl(e)?(this._emitChars(`<`),this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars(`<`),this.state=Y.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){bl(e)?(this.state=Y.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars(`</`),this.state=Y.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Y.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(V.SCRIPT,!1)&&wl(this.preprocessor.peek(V.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<V.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=Y.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case B.HYPHEN_MINUS:this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars(`-`);break;case B.LESS_THAN_SIGN:this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case B.NULL:this._err(H.unexpectedNullCharacter),this._emitChars(`�`);break;case B.EOF:this._err(H.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case B.HYPHEN_MINUS:this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case B.LESS_THAN_SIGN:this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case B.NULL:this._err(H.unexpectedNullCharacter),this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case B.EOF:this._err(H.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Y.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=Y.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case B.GREATER_THAN_SIGN:this.state=Y.SCRIPT_DATA,this._emitChars(`>`);break;case B.NULL:this._err(H.unexpectedNullCharacter),this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case B.EOF:this._err(H.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===B.SOLIDUS?(this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars(`/`)):(this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(V.SCRIPT,!1)&&wl(this.preprocessor.peek(V.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<V.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Y.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=Y.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=Y.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case B.EQUALS_SIGN:this._err(H.unexpectedEqualsSignBeforeAttributeName),this._createAttr(`=`),this.state=Y.ATTRIBUTE_NAME;break;default:this._createAttr(``),this.state=Y.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=Y.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case B.EQUALS_SIGN:this._leaveAttrName(),this.state=Y.BEFORE_ATTRIBUTE_VALUE;break;case B.QUOTATION_MARK:case B.APOSTROPHE:case B.LESS_THAN_SIGN:this._err(H.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break;case B.NULL:this._err(H.unexpectedNullCharacter),this.currentAttr.name+=`�`;break;default:this.currentAttr.name+=String.fromCodePoint(vl(e)?Sl(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=Y.SELF_CLOSING_START_TAG;break;case B.EQUALS_SIGN:this.state=Y.BEFORE_ATTRIBUTE_VALUE;break;case B.GREATER_THAN_SIGN:this.state=Y.DATA,this.emitCurrentTagToken();break;case B.EOF:this._err(H.eofInTag),this._emitEOFToken();break;default:this._createAttr(``),this.state=Y.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=Y.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case B.APOSTROPHE:this.state=Y.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case B.GREATER_THAN_SIGN:this._err(H.missingAttributeValue),this.state=Y.DATA,this.emitCurrentTagToken();break;default:this.state=Y.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case B.QUOTATION_MARK:this.state=Y.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case B.AMPERSAND:this._startCharacterReference();break;case B.NULL:this._err(H.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case B.EOF:this._err(H.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case B.APOSTROPHE:this.state=Y.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case B.AMPERSAND:this._startCharacterReference();break;case B.NULL:this._err(H.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case B.EOF:this._err(H.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=Y.BEFORE_ATTRIBUTE_NAME;break;case B.AMPERSAND:this._startCharacterReference();break;case B.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Y.DATA,this.emitCurrentTagToken();break;case B.NULL:this._err(H.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case B.QUOTATION_MARK:case B.APOSTROPHE:case B.LESS_THAN_SIGN:case B.EQUALS_SIGN:case B.GRAVE_ACCENT:this._err(H.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break;case B.EOF:this._err(H.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=Y.BEFORE_ATTRIBUTE_NAME;break;case B.SOLIDUS:this._leaveAttrValue(),this.state=Y.SELF_CLOSING_START_TAG;break;case B.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Y.DATA,this.emitCurrentTagToken();break;case B.EOF:this._err(H.eofInTag),this._emitEOFToken();break;default:this._err(H.missingWhitespaceBetweenAttributes),this.state=Y.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case B.GREATER_THAN_SIGN:{let e=this.currentToken;e.selfClosing=!0,this.state=Y.DATA,this.emitCurrentTagToken();break}case B.EOF:this._err(H.eofInTag),this._emitEOFToken();break;default:this._err(H.unexpectedSolidusInTag),this.state=Y.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){let t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:this.state=Y.DATA,this.emitCurrentComment(t);break;case B.EOF:this.emitCurrentComment(t),this._emitEOFToken();break;case B.NULL:this._err(H.unexpectedNullCharacter),t.data+=`�`;break;default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(V.DASH_DASH,!0)?(this._createCommentToken(V.DASH_DASH.length+1),this.state=Y.COMMENT_START):this._consumeSequenceIfMatch(V.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(V.DOCTYPE.length+1),this.state=Y.DOCTYPE):this._consumeSequenceIfMatch(V.CDATA_START,!0)?this.inForeignNode?this.state=Y.CDATA_SECTION:(this._err(H.cdataInHtmlContent),this._createCommentToken(V.CDATA_START.length+1),this.currentToken.data=`[CDATA[`,this.state=Y.BOGUS_COMMENT):this._ensureHibernation()||(this._err(H.incorrectlyOpenedComment),this._createCommentToken(2),this.state=Y.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case B.HYPHEN_MINUS:this.state=Y.COMMENT_START_DASH;break;case B.GREATER_THAN_SIGN:{this._err(H.abruptClosingOfEmptyComment),this.state=Y.DATA;let e=this.currentToken;this.emitCurrentComment(e);break}default:this.state=Y.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){let t=this.currentToken;switch(e){case B.HYPHEN_MINUS:this.state=Y.COMMENT_END;break;case B.GREATER_THAN_SIGN:this._err(H.abruptClosingOfEmptyComment),this.state=Y.DATA,this.emitCurrentComment(t);break;case B.EOF:this._err(H.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Y.COMMENT,this._stateComment(e)}}_stateComment(e){let t=this.currentToken;switch(e){case B.HYPHEN_MINUS:this.state=Y.COMMENT_END_DASH;break;case B.LESS_THAN_SIGN:t.data+=`<`,this.state=Y.COMMENT_LESS_THAN_SIGN;break;case B.NULL:this._err(H.unexpectedNullCharacter),t.data+=`�`;break;case B.EOF:this._err(H.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){let t=this.currentToken;switch(e){case B.EXCLAMATION_MARK:t.data+=`!`,this.state=Y.COMMENT_LESS_THAN_SIGN_BANG;break;case B.LESS_THAN_SIGN:t.data+=`<`;break;default:this.state=Y.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===B.HYPHEN_MINUS?this.state=Y.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=Y.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===B.HYPHEN_MINUS?this.state=Y.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=Y.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==B.GREATER_THAN_SIGN&&e!==B.EOF&&this._err(H.nestedComment),this.state=Y.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){let t=this.currentToken;switch(e){case B.HYPHEN_MINUS:this.state=Y.COMMENT_END;break;case B.EOF:this._err(H.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Y.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){let t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:this.state=Y.DATA,this.emitCurrentComment(t);break;case B.EXCLAMATION_MARK:this.state=Y.COMMENT_END_BANG;break;case B.HYPHEN_MINUS:t.data+=`-`;break;case B.EOF:this._err(H.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--`,this.state=Y.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){let t=this.currentToken;switch(e){case B.HYPHEN_MINUS:t.data+=`--!`,this.state=Y.COMMENT_END_DASH;break;case B.GREATER_THAN_SIGN:this._err(H.incorrectlyClosedComment),this.state=Y.DATA,this.emitCurrentComment(t);break;case B.EOF:this._err(H.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--!`,this.state=Y.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this.state=Y.BEFORE_DOCTYPE_NAME;break;case B.GREATER_THAN_SIGN:this.state=Y.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break;case B.EOF:{this._err(H.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._err(H.missingWhitespaceBeforeDoctypeName),this.state=Y.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(vl(e))this._createDoctypeToken(String.fromCharCode(Sl(e))),this.state=Y.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(H.unexpectedNullCharacter),this._createDoctypeToken(`�`),this.state=Y.DOCTYPE_NAME;break;case B.GREATER_THAN_SIGN:{this._err(H.missingDoctypeName),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=Y.DATA;break}case B.EOF:{this._err(H.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=Y.DOCTYPE_NAME}}_stateDoctypeName(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this.state=Y.AFTER_DOCTYPE_NAME;break;case B.GREATER_THAN_SIGN:this.state=Y.DATA,this.emitCurrentDoctype(t);break;case B.NULL:this._err(H.unexpectedNullCharacter),t.name+=`�`;break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.name+=String.fromCodePoint(vl(e)?Sl(e):e)}}_stateAfterDoctypeName(e){let 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=Y.DATA,this.emitCurrentDoctype(t);break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._consumeSequenceIfMatch(V.PUBLIC,!1)?this.state=Y.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(V.SYSTEM,!1)?this.state=Y.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(H.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=Y.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this.state=Y.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case B.QUOTATION_MARK:this._err(H.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Y.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case B.APOSTROPHE:this._err(H.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Y.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case B.GREATER_THAN_SIGN:this._err(H.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Y.DATA,this.emitCurrentDoctype(t);break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(H.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Y.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){let 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=Y.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case B.APOSTROPHE:t.publicId=``,this.state=Y.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case B.GREATER_THAN_SIGN:this._err(H.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Y.DATA,this.emitCurrentDoctype(t);break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(H.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Y.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case B.QUOTATION_MARK:this.state=Y.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case B.NULL:this._err(H.unexpectedNullCharacter),t.publicId+=`�`;break;case B.GREATER_THAN_SIGN:this._err(H.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Y.DATA;break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case B.APOSTROPHE:this.state=Y.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case B.NULL:this._err(H.unexpectedNullCharacter),t.publicId+=`�`;break;case B.GREATER_THAN_SIGN:this._err(H.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Y.DATA;break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this.state=Y.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case B.GREATER_THAN_SIGN:this.state=Y.DATA,this.emitCurrentDoctype(t);break;case B.QUOTATION_MARK:this._err(H.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Y.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case B.APOSTROPHE:this._err(H.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Y.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(H.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Y.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){let 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=Y.DATA;break;case B.QUOTATION_MARK:t.systemId=``,this.state=Y.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case B.APOSTROPHE:t.systemId=``,this.state=Y.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(H.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Y.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this.state=Y.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case B.QUOTATION_MARK:this._err(H.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Y.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case B.APOSTROPHE:this._err(H.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Y.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case B.GREATER_THAN_SIGN:this._err(H.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Y.DATA,this.emitCurrentDoctype(t);break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(H.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Y.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){let 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=Y.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case B.APOSTROPHE:t.systemId=``,this.state=Y.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case B.GREATER_THAN_SIGN:this._err(H.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Y.DATA,this.emitCurrentDoctype(t);break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(H.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Y.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case B.QUOTATION_MARK:this.state=Y.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case B.NULL:this._err(H.unexpectedNullCharacter),t.systemId+=`�`;break;case B.GREATER_THAN_SIGN:this._err(H.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Y.DATA;break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case B.APOSTROPHE:this.state=Y.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case B.NULL:this._err(H.unexpectedNullCharacter),t.systemId+=`�`;break;case B.GREATER_THAN_SIGN:this._err(H.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Y.DATA;break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){let 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=Y.DATA;break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(H.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=Y.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){let t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Y.DATA;break;case B.NULL:this._err(H.unexpectedNullCharacter);break;case B.EOF:this.emitCurrentDoctype(t),this._emitEOFToken();break;default:}}_stateCdataSection(e){switch(e){case B.RIGHT_SQUARE_BRACKET:this.state=Y.CDATA_SECTION_BRACKET;break;case B.EOF:this._err(H.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===B.RIGHT_SQUARE_BRACKET?this.state=Y.CDATA_SECTION_END:(this._emitChars(`]`),this.state=Y.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case B.GREATER_THAN_SIGN:this.state=Y.DATA;break;case B.RIGHT_SQUARE_BRACKET:this._emitChars(`]`);break;default:this._emitChars(`]]`),this.state=Y.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()&&xl(this.preprocessor.peek(1))?Y.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){xl(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===B.SEMICOLON&&this._err(H.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}},Dl=new Set([q.DD,q.DT,q.LI,q.OPTGROUP,q.OPTION,q.P,q.RB,q.RP,q.RT,q.RTC]),Ol=new Set([...Dl,q.CAPTION,q.COLGROUP,q.TBODY,q.TD,q.TFOOT,q.TH,q.THEAD,q.TR]),kl=new Set([q.APPLET,q.CAPTION,q.HTML,q.MARQUEE,q.OBJECT,q.TABLE,q.TD,q.TEMPLATE,q.TH]),Al=new Set([...kl,q.OL,q.UL]),jl=new Set([...kl,q.BUTTON]),Ml=new Set([q.ANNOTATION_XML,q.MI,q.MN,q.MO,q.MS,q.MTEXT]),Nl=new Set([q.DESC,q.FOREIGN_OBJECT,q.TITLE]),Pl=new Set([q.TR,q.TEMPLATE,q.HTML]),Fl=new Set([q.TBODY,q.TFOOT,q.THEAD,q.TEMPLATE,q.HTML]),Il=new Set([q.TABLE,q.TEMPLATE,q.HTML]),Ll=new Set([q.TD,q.TH]),Rl=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,n){this.treeAdapter=t,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=q.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===q.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===W.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(){let e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){let n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&(this.current=t)}insertAfter(e,t,n){let r=this._indexOf(e)+1;this.items.splice(r,0,t),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,r===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])!==W.HTML);this.shortenToLength(Math.max(t,0))}shortenToLength(e){for(;this.stackTop>=e;){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&--this.tmplCount,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){let t=this._indexOf(e);this.shortenToLength(Math.max(t,0))}popUntilPopped(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(ml,W.HTML)}popUntilTableCellPopped(){this.popUntilPopped(Ll,W.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let n=this.stackTop;n>=0;n--)if(e.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===t)return n;return-1}clearBackTo(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(Il,W.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Fl,W.HTML)}clearBackToTableRowContext(){this.clearBackTo(Pl,W.HTML)}remove(e){let 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]===q.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===q.HTML}hasInDynamicScope(e,t){for(let n=this.stackTop;n>=0;n--){let r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case W.HTML:if(r===e)return!0;if(t.has(r))return!1;break;case W.SVG:if(Nl.has(r))return!1;break;case W.MATHML:if(Ml.has(r))return!1;break}}return!0}hasInScope(e){return this.hasInDynamicScope(e,kl)}hasInListItemScope(e){return this.hasInDynamicScope(e,Al)}hasInButtonScope(e){return this.hasInDynamicScope(e,jl)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case W.HTML:if(ml.has(t))return!0;if(kl.has(t))return!1;break;case W.SVG:if(Nl.has(t))return!1;break;case W.MATHML:if(Ml.has(t))return!1;break}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===W.HTML)switch(this.tagIDs[t]){case e:return!0;case q.TABLE:case q.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===W.HTML)switch(this.tagIDs[e]){case q.TBODY:case q.THEAD:case q.TFOOT:return!0;case q.TABLE:case q.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===W.HTML)switch(this.tagIDs[t]){case e:return!0;case q.OPTION:case q.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&Dl.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&Ol.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&Ol.has(this.currentTagId);)this.pop()}},zl=3,Bl;(function(e){e[e.Marker=0]=`Marker`,e[e.Element=1]=`Element`})(Bl||={});var Vl={type:Bl.Marker},Hl=class{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){let n=[],r=t.length,i=this.treeAdapter.getTagName(e),a=this.treeAdapter.getNamespaceURI(e);for(let e=0;e<this.entries.length;e++){let t=this.entries[e];if(t.type===Bl.Marker)break;let{element:o}=t;if(this.treeAdapter.getTagName(o)===i&&this.treeAdapter.getNamespaceURI(o)===a){let t=this.treeAdapter.getAttrList(o);t.length===r&&n.push({idx:e,attrs:t})}}return n}_ensureNoahArkCondition(e){if(this.entries.length<zl)return;let t=this.treeAdapter.getAttrList(e),n=this._getNoahArkConditionCandidates(e,t);if(n.length<zl)return;let r=new Map(t.map(e=>[e.name,e.value])),i=0;for(let e=0;e<n.length;e++){let t=n[e];t.attrs.every(e=>r.get(e.name)===e.value)&&(i+=1,i>=zl&&this.entries.splice(t.idx,1))}}insertMarker(){this.entries.unshift(Vl)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:Bl.Element,element:e,token:t})}insertElementAfterBookmark(e,t){let n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:Bl.Element,element:e,token:t})}removeEntry(e){let t=this.entries.indexOf(e);t!==-1&&this.entries.splice(t,1)}clearToLastMarker(){let e=this.entries.indexOf(Vl);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){let t=this.entries.find(t=>t.type===Bl.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===Bl.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===Bl.Element&&t.element===e)}},Ul={createDocument(){return{nodeName:`#document`,mode:G.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:`#document-fragment`,childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:`#comment`,data:e,parentNode:null}},createTextNode(e){return{nodeName:`#text`,value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){let r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){let i=e.childNodes.find(e=>e.nodeName===`#documentType`);if(i)i.name=t,i.publicId=n,i.systemId=r;else{let i={nodeName:`#documentType`,name:t,publicId:n,systemId:r,parentNode:null};Ul.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let n=e.childNodes[e.childNodes.length-1];if(Ul.isTextNode(n)){n.value+=t;return}}Ul.appendChild(e,Ul.createTextNode(t))},insertTextBefore(e,t,n){let r=e.childNodes[e.childNodes.indexOf(n)-1];r&&Ul.isTextNode(r)?r.value+=t:Ul.insertBefore(e,Ul.createTextNode(t),n)},adoptAttributes(e,t){let n=new Set(e.attrs.map(e=>e.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName===`#text`},isCommentNode(e){return e.nodeName===`#comment`},isDocumentTypeNode(e){return e.nodeName===`#documentType`},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,`tagName`)},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},Wl=`html`,Gl=`about:legacy-compat`,Kl=`http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd`,ql=`+//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//`.split(`,`),Jl=[...ql,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`],Yl=new Set([`-//w3o//dtd w3 html strict 3.0//en//`,`-/w3c/dtd html 4.0 transitional/en`,`html`]),Xl=[`-//w3c//dtd xhtml 1.0 frameset//`,`-//w3c//dtd xhtml 1.0 transitional//`],Zl=[...Xl,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`];function Ql(e,t){return t.some(t=>e.startsWith(t))}function $l(e){return e.name===Wl&&e.publicId===null&&(e.systemId===null||e.systemId===Gl)}function eu(e){if(e.name!==Wl)return G.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===Kl)return G.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),Yl.has(n))return G.QUIRKS;let e=t===null?Jl:ql;if(Ql(n,e))return G.QUIRKS;if(e=t===null?Xl:Zl,Ql(n,e))return G.LIMITED_QUIRKS}return G.NO_QUIRKS}var tu={TEXT_HTML:`text/html`,APPLICATION_XML:`application/xhtml+xml`},nu=`definitionurl`,ru=`definitionURL`,iu=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`.split(`.`).map(e=>[e.toLowerCase(),e])),au=new Map([[`xlink:actuate`,{prefix:`xlink`,name:`actuate`,namespace:W.XLINK}],[`xlink:arcrole`,{prefix:`xlink`,name:`arcrole`,namespace:W.XLINK}],[`xlink:href`,{prefix:`xlink`,name:`href`,namespace:W.XLINK}],[`xlink:role`,{prefix:`xlink`,name:`role`,namespace:W.XLINK}],[`xlink:show`,{prefix:`xlink`,name:`show`,namespace:W.XLINK}],[`xlink:title`,{prefix:`xlink`,name:`title`,namespace:W.XLINK}],[`xlink:type`,{prefix:`xlink`,name:`type`,namespace:W.XLINK}],[`xml:lang`,{prefix:`xml`,name:`lang`,namespace:W.XML}],[`xml:space`,{prefix:`xml`,name:`space`,namespace:W.XML}],[`xmlns`,{prefix:``,name:`xmlns`,namespace:W.XMLNS}],[`xmlns:xlink`,{prefix:`xmlns`,name:`xlink`,namespace:W.XMLNS}]]),ou=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`.split(`.`).map(e=>[e.toLowerCase(),e])),su=new Set([q.B,q.BIG,q.BLOCKQUOTE,q.BODY,q.BR,q.CENTER,q.CODE,q.DD,q.DIV,q.DL,q.DT,q.EM,q.EMBED,q.H1,q.H2,q.H3,q.H4,q.H5,q.H6,q.HEAD,q.HR,q.I,q.IMG,q.LI,q.LISTING,q.MENU,q.META,q.NOBR,q.OL,q.P,q.PRE,q.RUBY,q.S,q.SMALL,q.SPAN,q.STRONG,q.STRIKE,q.SUB,q.SUP,q.TABLE,q.TT,q.U,q.UL,q.VAR]);function cu(e){let t=e.tagID;return t===q.FONT&&e.attrs.some(({name:e})=>e===ul.COLOR||e===ul.SIZE||e===ul.FACE)||su.has(t)}function lu(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===nu){e.attrs[t].name=ru;break}}function uu(e){for(let t=0;t<e.attrs.length;t++){let n=iu.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function du(e){for(let t=0;t<e.attrs.length;t++){let n=au.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}function fu(e){let t=ou.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=fl(e.tagName))}function pu(e,t){return t===W.MATHML&&(e===q.MI||e===q.MO||e===q.MN||e===q.MS||e===q.MTEXT)}function mu(e,t,n){if(t===W.MATHML&&e===q.ANNOTATION_XML){for(let e=0;e<n.length;e++)if(n[e].name===ul.ENCODING){let t=n[e].value.toLowerCase();return t===tu.TEXT_HTML||t===tu.APPLICATION_XML}}return t===W.SVG&&(e===q.FOREIGN_OBJECT||e===q.DESC||e===q.TITLE)}function hu(e,t,n,r){return(!r||r===W.HTML)&&mu(e,t,n)||(!r||r===W.MATHML)&&pu(e,t)}var gu=`hidden`,_u=8,vu=3,Z;(function(e){e[e.INITIAL=0]=`INITIAL`,e[e.BEFORE_HTML=1]=`BEFORE_HTML`,e[e.BEFORE_HEAD=2]=`BEFORE_HEAD`,e[e.IN_HEAD=3]=`IN_HEAD`,e[e.IN_HEAD_NO_SCRIPT=4]=`IN_HEAD_NO_SCRIPT`,e[e.AFTER_HEAD=5]=`AFTER_HEAD`,e[e.IN_BODY=6]=`IN_BODY`,e[e.TEXT=7]=`TEXT`,e[e.IN_TABLE=8]=`IN_TABLE`,e[e.IN_TABLE_TEXT=9]=`IN_TABLE_TEXT`,e[e.IN_CAPTION=10]=`IN_CAPTION`,e[e.IN_COLUMN_GROUP=11]=`IN_COLUMN_GROUP`,e[e.IN_TABLE_BODY=12]=`IN_TABLE_BODY`,e[e.IN_ROW=13]=`IN_ROW`,e[e.IN_CELL=14]=`IN_CELL`,e[e.IN_SELECT=15]=`IN_SELECT`,e[e.IN_SELECT_IN_TABLE=16]=`IN_SELECT_IN_TABLE`,e[e.IN_TEMPLATE=17]=`IN_TEMPLATE`,e[e.AFTER_BODY=18]=`AFTER_BODY`,e[e.IN_FRAMESET=19]=`IN_FRAMESET`,e[e.AFTER_FRAMESET=20]=`AFTER_FRAMESET`,e[e.AFTER_AFTER_BODY=21]=`AFTER_AFTER_BODY`,e[e.AFTER_AFTER_FRAMESET=22]=`AFTER_AFTER_FRAMESET`})(Z||={});var yu={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},bu=new Set([q.TABLE,q.TBODY,q.TFOOT,q.THEAD,q.TR]),xu={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:Ul,onParseError:null},Su=class{constructor(e,t,n=null,r=null){this.fragmentContext=n,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=Z.INITIAL,this.originalInsertionMode=Z.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={...xu,...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 El(this.options,this),this.activeFormattingElements=new Hl(this.treeAdapter),this.fragmentContextID=n?fl(this.treeAdapter.getTagName(n)):q.UNKNOWN,this._setContextModes(n??this.document,this.fragmentContextID),this.openElements=new Rl(this.document,this.treeAdapter,this)}static parse(e,t){let n=new this(t);return n.tokenizer.write(e,!0),n.document}static getFragmentParser(e,t){let n={...xu,...t};e??=n.treeAdapter.createElement(K.TEMPLATE,W.HTML,[]);let r=n.treeAdapter.createElement(`documentmock`,W.HTML,[]),i=new this(n,r,e);return i.fragmentContextID===q.TEMPLATE&&i.tmplInsertionModeStack.unshift(Z.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){let e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,n){if(!this.onParseError)return;let r=e.location??yu,i={code:t,startLine:r.startLine,startCol:r.startCol,startOffset:r.startOffset,endLine:n?r.startLine:r.endLine,endCol:n?r.startCol:r.endCol,endOffset:n?r.startOffset:r.endOffset};this.onParseError(i)}onItemPush(e,t,n){var r,i;(i=(r=this.treeAdapter).onItemPush)==null||i.call(r,e),n&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(r=(n=this.treeAdapter).onItemPop)==null||r.call(n,e,this.openElements.current),t){let e,t;this.openElements.stackTop===0&&this.fragmentContext?(e=this.fragmentContext,t=this.fragmentContextID):{current:e,currentTagId:t}=this.openElements,this._setContextModes(e,t)}}_setContextModes(e,t){let n=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===W.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&e!==void 0&&t!==void 0&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,W.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=Z.TEXT}switchToPlaintextParsing(){this.insertionMode=Z.TEXT,this.originalInsertionMode=Z.IN_BODY,this.tokenizer.state=X.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)===K.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==W.HTML))switch(this.fragmentContextID){case q.TITLE:case q.TEXTAREA:this.tokenizer.state=X.RCDATA;break;case q.STYLE:case q.XMP:case q.IFRAME:case q.NOEMBED:case q.NOFRAMES:case q.NOSCRIPT:this.tokenizer.state=X.RAWTEXT;break;case q.SCRIPT:this.tokenizer.state=X.SCRIPT_DATA;break;case q.PLAINTEXT:this.tokenizer.state=X.PLAINTEXT;break;default:}}_setDocumentType(e){let t=e.name||``,n=e.publicId||``,r=e.systemId||``;if(this.treeAdapter.setDocumentType(this.document,t,n,r),e.location){let t=this.treeAdapter.getChildNodes(this.document).find(e=>this.treeAdapter.isDocumentTypeNode(e));t&&this.treeAdapter.setNodeSourceCodeLocation(t,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){let n=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{let t=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(t??this.document,e)}}_appendElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location)}_insertElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID)}_insertFakeElement(e,t){let n=this.treeAdapter.createElement(e,W.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,t)}_insertTemplate(e){let t=this.treeAdapter.createElement(e.tagName,W.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){let e=this.treeAdapter.createElement(K.HTML,W.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,q.HTML)}_appendCommentNode(e,t){let n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,e.location)}_insertCharacters(e){let t,n;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(t,e.chars,n):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;let r=this.treeAdapter.getChildNodes(t),i=r[(n?r.lastIndexOf(n):r.length)-1];if(this.treeAdapter.getNodeSourceCodeLocation(i)){let{endLine:t,endCol:n,endOffset:r}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(i,{endLine:t,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,e.location)}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){let n=t.location,r=this.treeAdapter.getTagName(e),i=t.type===U.END_TAG&&r===t.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,i)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,n;return this.openElements.stackTop===0&&this.fragmentContext?(t=this.fragmentContext,n=this.fragmentContextID):{current:t,currentTagId:n}=this.openElements,e.tagID===q.SVG&&this.treeAdapter.getTagName(t)===K.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===W.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===q.MGLYPH||e.tagID===q.MALIGNMARK)&&n!==void 0&&!this._isIntegrationPoint(n,t,W.HTML)}_processToken(e){switch(e.type){case U.CHARACTER:this.onCharacter(e);break;case U.NULL_CHARACTER:this.onNullCharacter(e);break;case U.COMMENT:this.onComment(e);break;case U.DOCTYPE:this.onDoctype(e);break;case U.START_TAG:this._processStartTag(e);break;case U.END_TAG:this.onEndTag(e);break;case U.EOF:this.onEof(e);break;case U.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e);break}}_isIntegrationPoint(e,t,n){return hu(e,this.treeAdapter.getNamespaceURI(t),this.treeAdapter.getAttrList(t),n)}_reconstructActiveFormattingElements(){let e=this.activeFormattingElements.entries.length;if(e){let t=this.activeFormattingElements.entries.findIndex(e=>e.type===Bl.Marker||this.openElements.contains(e.element)),n=t===-1?e-1:t-1;for(let e=n;e>=0;e--){let t=this.activeFormattingElements.entries[e];this._insertElement(t.token,this.treeAdapter.getNamespaceURI(t.element)),t.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=Z.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(q.P),this.openElements.popUntilTagNamePopped(q.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case q.TR:this.insertionMode=Z.IN_ROW;return;case q.TBODY:case q.THEAD:case q.TFOOT:this.insertionMode=Z.IN_TABLE_BODY;return;case q.CAPTION:this.insertionMode=Z.IN_CAPTION;return;case q.COLGROUP:this.insertionMode=Z.IN_COLUMN_GROUP;return;case q.TABLE:this.insertionMode=Z.IN_TABLE;return;case q.BODY:this.insertionMode=Z.IN_BODY;return;case q.FRAMESET:this.insertionMode=Z.IN_FRAMESET;return;case q.SELECT:this._resetInsertionModeForSelect(e);return;case q.TEMPLATE:this.insertionMode=this.tmplInsertionModeStack[0];return;case q.HTML:this.insertionMode=this.headElement?Z.AFTER_HEAD:Z.BEFORE_HEAD;return;case q.TD:case q.TH:if(e>0){this.insertionMode=Z.IN_CELL;return}break;case q.HEAD:if(e>0){this.insertionMode=Z.IN_HEAD;return}break}this.insertionMode=Z.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){let e=this.openElements.tagIDs[t];if(e===q.TEMPLATE)break;if(e===q.TABLE){this.insertionMode=Z.IN_SELECT_IN_TABLE;return}}this.insertionMode=Z.IN_SELECT}_isElementCausesFosterParenting(e){return bu.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){let t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case q.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===W.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case q.TABLE:{let n=this.treeAdapter.getParentNode(t);return n?{parent:n,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}default:}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){let t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){return pl[this.treeAdapter.getNamespaceURI(e)].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){zf(this,e);return}switch(this.insertionMode){case Z.INITIAL:Fu(this,e);break;case Z.BEFORE_HTML:Ru(this,e);break;case Z.BEFORE_HEAD:Vu(this,e);break;case Z.IN_HEAD:Wu(this,e);break;case Z.IN_HEAD_NO_SCRIPT:qu(this,e);break;case Z.AFTER_HEAD:Xu(this,e);break;case Z.IN_BODY:case Z.IN_CAPTION:case Z.IN_CELL:case Z.IN_TEMPLATE:$u(this,e);break;case Z.TEXT:case Z.IN_SELECT:case Z.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case Z.IN_TABLE:case Z.IN_TABLE_BODY:case Z.IN_ROW:qd(this,e);break;case Z.IN_TABLE_TEXT:sf(this,e);break;case Z.IN_COLUMN_GROUP:mf(this,e);break;case Z.AFTER_BODY:Af(this,e);break;case Z.AFTER_AFTER_BODY:If(this,e);break;default:}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Rf(this,e);return}switch(this.insertionMode){case Z.INITIAL:Fu(this,e);break;case Z.BEFORE_HTML:Ru(this,e);break;case Z.BEFORE_HEAD:Vu(this,e);break;case Z.IN_HEAD:Wu(this,e);break;case Z.IN_HEAD_NO_SCRIPT:qu(this,e);break;case Z.AFTER_HEAD:Xu(this,e);break;case Z.TEXT:this._insertCharacters(e);break;case Z.IN_TABLE:case Z.IN_TABLE_BODY:case Z.IN_ROW:qd(this,e);break;case Z.IN_COLUMN_GROUP:mf(this,e);break;case Z.AFTER_BODY:Af(this,e);break;case Z.AFTER_AFTER_BODY:If(this,e);break;default:}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){Au(this,e);return}switch(this.insertionMode){case Z.INITIAL:case Z.BEFORE_HTML:case Z.BEFORE_HEAD:case Z.IN_HEAD:case Z.IN_HEAD_NO_SCRIPT:case Z.AFTER_HEAD:case Z.IN_BODY:case Z.IN_TABLE:case Z.IN_CAPTION:case Z.IN_COLUMN_GROUP:case Z.IN_TABLE_BODY:case Z.IN_ROW:case Z.IN_CELL:case Z.IN_SELECT:case Z.IN_SELECT_IN_TABLE:case Z.IN_TEMPLATE:case Z.IN_FRAMESET:case Z.AFTER_FRAMESET:Au(this,e);break;case Z.IN_TABLE_TEXT:cf(this,e);break;case Z.AFTER_BODY:ju(this,e);break;case Z.AFTER_AFTER_BODY:case Z.AFTER_AFTER_FRAMESET:Mu(this,e);break;default:}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case Z.INITIAL:Pu(this,e);break;case Z.BEFORE_HEAD:case Z.IN_HEAD:case Z.IN_HEAD_NO_SCRIPT:case Z.AFTER_HEAD:this._err(e,H.misplacedDoctype);break;case Z.IN_TABLE_TEXT:cf(this,e);break;default:}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,H.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?Vf(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case Z.INITIAL:Fu(this,e);break;case Z.BEFORE_HTML:Iu(this,e);break;case Z.BEFORE_HEAD:zu(this,e);break;case Z.IN_HEAD:Q(this,e);break;case Z.IN_HEAD_NO_SCRIPT:Gu(this,e);break;case Z.AFTER_HEAD:Ju(this,e);break;case Z.IN_BODY:$(this,e);break;case Z.IN_TABLE:nf(this,e);break;case Z.IN_TABLE_TEXT:cf(this,e);break;case Z.IN_CAPTION:uf(this,e);break;case Z.IN_COLUMN_GROUP:ff(this,e);break;case Z.IN_TABLE_BODY:hf(this,e);break;case Z.IN_ROW:_f(this,e);break;case Z.IN_CELL:yf(this,e);break;case Z.IN_SELECT:xf(this,e);break;case Z.IN_SELECT_IN_TABLE:Cf(this,e);break;case Z.IN_TEMPLATE:Tf(this,e);break;case Z.AFTER_BODY:Of(this,e);break;case Z.IN_FRAMESET:jf(this,e);break;case Z.AFTER_FRAMESET:Nf(this,e);break;case Z.AFTER_AFTER_BODY:Ff(this,e);break;case Z.AFTER_AFTER_FRAMESET:Lf(this,e);break;default:}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?Hf(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case Z.INITIAL:Fu(this,e);break;case Z.BEFORE_HTML:Lu(this,e);break;case Z.BEFORE_HEAD:Bu(this,e);break;case Z.IN_HEAD:Hu(this,e);break;case Z.IN_HEAD_NO_SCRIPT:Ku(this,e);break;case Z.AFTER_HEAD:Yu(this,e);break;case Z.IN_BODY:Ud(this,e);break;case Z.TEXT:Gd(this,e);break;case Z.IN_TABLE:rf(this,e);break;case Z.IN_TABLE_TEXT:cf(this,e);break;case Z.IN_CAPTION:df(this,e);break;case Z.IN_COLUMN_GROUP:pf(this,e);break;case Z.IN_TABLE_BODY:gf(this,e);break;case Z.IN_ROW:vf(this,e);break;case Z.IN_CELL:bf(this,e);break;case Z.IN_SELECT:Sf(this,e);break;case Z.IN_SELECT_IN_TABLE:wf(this,e);break;case Z.IN_TEMPLATE:Ef(this,e);break;case Z.AFTER_BODY:kf(this,e);break;case Z.IN_FRAMESET:Mf(this,e);break;case Z.AFTER_FRAMESET:Pf(this,e);break;case Z.AFTER_AFTER_BODY:If(this,e);break;default:}}onEof(e){switch(this.insertionMode){case Z.INITIAL:Fu(this,e);break;case Z.BEFORE_HTML:Ru(this,e);break;case Z.BEFORE_HEAD:Vu(this,e);break;case Z.IN_HEAD:Wu(this,e);break;case Z.IN_HEAD_NO_SCRIPT:qu(this,e);break;case Z.AFTER_HEAD:Xu(this,e);break;case Z.IN_BODY:case Z.IN_TABLE:case Z.IN_CAPTION:case Z.IN_COLUMN_GROUP:case Z.IN_TABLE_BODY:case Z.IN_ROW:case Z.IN_CELL:case Z.IN_SELECT:case Z.IN_SELECT_IN_TABLE:Wd(this,e);break;case Z.TEXT:Kd(this,e);break;case Z.IN_TABLE_TEXT:cf(this,e);break;case Z.IN_TEMPLATE:Df(this,e);break;case Z.AFTER_BODY:case Z.IN_FRAMESET:case Z.AFTER_FRAMESET:case Z.AFTER_AFTER_BODY:case Z.AFTER_AFTER_FRAMESET:Nu(this,e);break;default:}}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 Z.IN_HEAD:case Z.IN_HEAD_NO_SCRIPT:case Z.AFTER_HEAD:case Z.TEXT:case Z.IN_COLUMN_GROUP:case Z.IN_SELECT:case Z.IN_SELECT_IN_TABLE:case Z.IN_FRAMESET:case Z.AFTER_FRAMESET:this._insertCharacters(e);break;case Z.IN_BODY:case Z.IN_CAPTION:case Z.IN_CELL:case Z.IN_TEMPLATE:case Z.AFTER_BODY:case Z.AFTER_AFTER_BODY:case Z.AFTER_AFTER_FRAMESET:Qu(this,e);break;case Z.IN_TABLE:case Z.IN_TABLE_BODY:case Z.IN_ROW:qd(this,e);break;case Z.IN_TABLE_TEXT:of(this,e);break;default:}}};function Cu(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):Hd(e,t),n}function wu(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){let i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function Tu(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let a=0,o=i;o!==n;a++,o=i){i=e.openElements.getCommonAncestor(o);let n=e.activeFormattingElements.getElementEntry(o),s=n&&a>=vu;!n||s?(s&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(o)):(o=Eu(e,n),r===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}function Eu(e,t){let n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function Du(e,t,n){let r=fl(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{let i=e.treeAdapter.getNamespaceURI(t);r===q.TEMPLATE&&i===W.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function Ou(e,t,n){let r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,a=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,a,i.tagID)}function ku(e,t){for(let n=0;n<_u;n++){let n=Cu(e,t);if(!n)break;let r=wu(e,n);if(!r)break;e.activeFormattingElements.bookmark=n;let i=Tu(e,r,n.element),a=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(i),a&&Du(e,a,i),Ou(e,r,n)}}function Au(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function ju(e,t){e._appendCommentNode(t,e.openElements.items[0])}function Mu(e,t){e._appendCommentNode(t,e.document)}function Nu(e,t){if(e.stopped=!0,t.location){let n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let n=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){let n=e.openElements.items[1],r=e.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&e._setEndLocation(n,t)}}}}function Pu(e,t){e._setDocumentType(t);let n=t.forceQuirks?G.QUIRKS:eu(t);$l(t)||e._err(t,H.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=Z.BEFORE_HTML}function Fu(e,t){e._err(t,H.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,G.QUIRKS),e.insertionMode=Z.BEFORE_HTML,e._processToken(t)}function Iu(e,t){t.tagID===q.HTML?(e._insertElement(t,W.HTML),e.insertionMode=Z.BEFORE_HEAD):Ru(e,t)}function Lu(e,t){let n=t.tagID;(n===q.HTML||n===q.HEAD||n===q.BODY||n===q.BR)&&Ru(e,t)}function Ru(e,t){e._insertFakeRootElement(),e.insertionMode=Z.BEFORE_HEAD,e._processToken(t)}function zu(e,t){switch(t.tagID){case q.HTML:$(e,t);break;case q.HEAD:e._insertElement(t,W.HTML),e.headElement=e.openElements.current,e.insertionMode=Z.IN_HEAD;break;default:Vu(e,t)}}function Bu(e,t){let n=t.tagID;n===q.HEAD||n===q.BODY||n===q.HTML||n===q.BR?Vu(e,t):e._err(t,H.endTagWithoutMatchingOpenElement)}function Vu(e,t){e._insertFakeElement(K.HEAD,q.HEAD),e.headElement=e.openElements.current,e.insertionMode=Z.IN_HEAD,e._processToken(t)}function Q(e,t){switch(t.tagID){case q.HTML:$(e,t);break;case q.BASE:case q.BASEFONT:case q.BGSOUND:case q.LINK:case q.META:e._appendElement(t,W.HTML),t.ackSelfClosing=!0;break;case q.TITLE:e._switchToTextParsing(t,X.RCDATA);break;case q.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,X.RAWTEXT):(e._insertElement(t,W.HTML),e.insertionMode=Z.IN_HEAD_NO_SCRIPT);break;case q.NOFRAMES:case q.STYLE:e._switchToTextParsing(t,X.RAWTEXT);break;case q.SCRIPT:e._switchToTextParsing(t,X.SCRIPT_DATA);break;case q.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=Z.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(Z.IN_TEMPLATE);break;case q.HEAD:e._err(t,H.misplacedStartTagForHeadElement);break;default:Wu(e,t)}}function Hu(e,t){switch(t.tagID){case q.HEAD:e.openElements.pop(),e.insertionMode=Z.AFTER_HEAD;break;case q.BODY:case q.BR:case q.HTML:Wu(e,t);break;case q.TEMPLATE:Uu(e,t);break;default:e._err(t,H.endTagWithoutMatchingOpenElement)}}function Uu(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==q.TEMPLATE&&e._err(t,H.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(q.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,H.endTagWithoutMatchingOpenElement)}function Wu(e,t){e.openElements.pop(),e.insertionMode=Z.AFTER_HEAD,e._processToken(t)}function Gu(e,t){switch(t.tagID){case q.HTML:$(e,t);break;case q.BASEFONT:case q.BGSOUND:case q.HEAD:case q.LINK:case q.META:case q.NOFRAMES:case q.STYLE:Q(e,t);break;case q.NOSCRIPT:e._err(t,H.nestedNoscriptInHead);break;default:qu(e,t)}}function Ku(e,t){switch(t.tagID){case q.NOSCRIPT:e.openElements.pop(),e.insertionMode=Z.IN_HEAD;break;case q.BR:qu(e,t);break;default:e._err(t,H.endTagWithoutMatchingOpenElement)}}function qu(e,t){let n=t.type===U.EOF?H.openElementsLeftAfterEof:H.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=Z.IN_HEAD,e._processToken(t)}function Ju(e,t){switch(t.tagID){case q.HTML:$(e,t);break;case q.BODY:e._insertElement(t,W.HTML),e.framesetOk=!1,e.insertionMode=Z.IN_BODY;break;case q.FRAMESET:e._insertElement(t,W.HTML),e.insertionMode=Z.IN_FRAMESET;break;case q.BASE:case q.BASEFONT:case q.BGSOUND:case q.LINK:case q.META:case q.NOFRAMES:case q.SCRIPT:case q.STYLE:case q.TEMPLATE:case q.TITLE:e._err(t,H.abandonedHeadElementChild),e.openElements.push(e.headElement,q.HEAD),Q(e,t),e.openElements.remove(e.headElement);break;case q.HEAD:e._err(t,H.misplacedStartTagForHeadElement);break;default:Xu(e,t)}}function Yu(e,t){switch(t.tagID){case q.BODY:case q.HTML:case q.BR:Xu(e,t);break;case q.TEMPLATE:Uu(e,t);break;default:e._err(t,H.endTagWithoutMatchingOpenElement)}}function Xu(e,t){e._insertFakeElement(K.BODY,q.BODY),e.insertionMode=Z.IN_BODY,Zu(e,t)}function Zu(e,t){switch(t.type){case U.CHARACTER:$u(e,t);break;case U.WHITESPACE_CHARACTER:Qu(e,t);break;case U.COMMENT:Au(e,t);break;case U.START_TAG:$(e,t);break;case U.END_TAG:Ud(e,t);break;case U.EOF:Wd(e,t);break;default:}}function Qu(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function $u(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function ed(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function td(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function nd(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,W.HTML),e.insertionMode=Z.IN_FRAMESET)}function rd(e,t){e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,W.HTML)}function id(e,t){e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&ml.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,W.HTML)}function ad(e,t){e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,W.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function od(e,t){let n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,W.HTML),n||(e.formElement=e.openElements.current))}function sd(e,t){e.framesetOk=!1;let n=t.tagID;for(let t=e.openElements.stackTop;t>=0;t--){let r=e.openElements.tagIDs[t];if(n===q.LI&&r===q.LI||(n===q.DD||n===q.DT)&&(r===q.DD||r===q.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==q.ADDRESS&&r!==q.DIV&&r!==q.P&&e._isSpecialElement(e.openElements.items[t],r))break}e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,W.HTML)}function cd(e,t){e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,W.HTML),e.tokenizer.state=X.PLAINTEXT}function ld(e,t){e.openElements.hasInScope(q.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(q.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,W.HTML),e.framesetOk=!1}function ud(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(K.A);n&&(ku(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,W.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function dd(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,W.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function fd(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(q.NOBR)&&(ku(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,W.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function pd(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,W.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function md(e,t){e.treeAdapter.getDocumentMode(e.document)!==G.QUIRKS&&e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,W.HTML),e.framesetOk=!1,e.insertionMode=Z.IN_TABLE}function hd(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,W.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function gd(e){let t=ll(e,ul.TYPE);return t!=null&&t.toLowerCase()===gu}function _d(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,W.HTML),gd(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function vd(e,t){e._appendElement(t,W.HTML),t.ackSelfClosing=!0}function yd(e,t){e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._appendElement(t,W.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function bd(e,t){t.tagName=K.IMG,t.tagID=q.IMG,hd(e,t)}function xd(e,t){e._insertElement(t,W.HTML),e.skipNextNewLine=!0,e.tokenizer.state=X.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=Z.TEXT}function Sd(e,t){e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,X.RAWTEXT)}function Cd(e,t){e.framesetOk=!1,e._switchToTextParsing(t,X.RAWTEXT)}function wd(e,t){e._switchToTextParsing(t,X.RAWTEXT)}function Td(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,W.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===Z.IN_TABLE||e.insertionMode===Z.IN_CAPTION||e.insertionMode===Z.IN_TABLE_BODY||e.insertionMode===Z.IN_ROW||e.insertionMode===Z.IN_CELL?Z.IN_SELECT_IN_TABLE:Z.IN_SELECT}function Ed(e,t){e.openElements.currentTagId===q.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,W.HTML)}function Dd(e,t){e.openElements.hasInScope(q.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,W.HTML)}function Od(e,t){e.openElements.hasInScope(q.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(q.RTC),e._insertElement(t,W.HTML)}function kd(e,t){e._reconstructActiveFormattingElements(),lu(t),du(t),t.selfClosing?e._appendElement(t,W.MATHML):e._insertElement(t,W.MATHML),t.ackSelfClosing=!0}function Ad(e,t){e._reconstructActiveFormattingElements(),uu(t),du(t),t.selfClosing?e._appendElement(t,W.SVG):e._insertElement(t,W.SVG),t.ackSelfClosing=!0}function jd(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,W.HTML)}function $(e,t){switch(t.tagID){case q.I:case q.S:case q.B:case q.U:case q.EM:case q.TT:case q.BIG:case q.CODE:case q.FONT:case q.SMALL:case q.STRIKE:case q.STRONG:dd(e,t);break;case q.A:ud(e,t);break;case q.H1:case q.H2:case q.H3:case q.H4:case q.H5:case q.H6:id(e,t);break;case q.P:case q.DL:case q.OL:case q.UL:case q.DIV:case q.DIR:case q.NAV:case q.MAIN:case q.MENU:case q.ASIDE:case q.CENTER:case q.FIGURE:case q.FOOTER:case q.HEADER:case q.HGROUP:case q.DIALOG:case q.DETAILS:case q.ADDRESS:case q.ARTICLE:case q.SEARCH:case q.SECTION:case q.SUMMARY:case q.FIELDSET:case q.BLOCKQUOTE:case q.FIGCAPTION:rd(e,t);break;case q.LI:case q.DD:case q.DT:sd(e,t);break;case q.BR:case q.IMG:case q.WBR:case q.AREA:case q.EMBED:case q.KEYGEN:hd(e,t);break;case q.HR:yd(e,t);break;case q.RB:case q.RTC:Dd(e,t);break;case q.RT:case q.RP:Od(e,t);break;case q.PRE:case q.LISTING:ad(e,t);break;case q.XMP:Sd(e,t);break;case q.SVG:Ad(e,t);break;case q.HTML:ed(e,t);break;case q.BASE:case q.LINK:case q.META:case q.STYLE:case q.TITLE:case q.SCRIPT:case q.BGSOUND:case q.BASEFONT:case q.TEMPLATE:Q(e,t);break;case q.BODY:td(e,t);break;case q.FORM:od(e,t);break;case q.NOBR:fd(e,t);break;case q.MATH:kd(e,t);break;case q.TABLE:md(e,t);break;case q.INPUT:_d(e,t);break;case q.PARAM:case q.TRACK:case q.SOURCE:vd(e,t);break;case q.IMAGE:bd(e,t);break;case q.BUTTON:ld(e,t);break;case q.APPLET:case q.OBJECT:case q.MARQUEE:pd(e,t);break;case q.IFRAME:Cd(e,t);break;case q.SELECT:Td(e,t);break;case q.OPTION:case q.OPTGROUP:Ed(e,t);break;case q.NOEMBED:case q.NOFRAMES:wd(e,t);break;case q.FRAMESET:nd(e,t);break;case q.TEXTAREA:xd(e,t);break;case q.NOSCRIPT:e.options.scriptingEnabled?wd(e,t):jd(e,t);break;case q.PLAINTEXT:cd(e,t);break;case q.COL:case q.TH:case q.TD:case q.TR:case q.HEAD:case q.FRAME:case q.TBODY:case q.TFOOT:case q.THEAD:case q.CAPTION:case q.COLGROUP:break;default:jd(e,t)}}function Md(e,t){if(e.openElements.hasInScope(q.BODY)&&(e.insertionMode=Z.AFTER_BODY,e.options.sourceCodeLocationInfo)){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function Nd(e,t){e.openElements.hasInScope(q.BODY)&&(e.insertionMode=Z.AFTER_BODY,kf(e,t))}function Pd(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function Fd(e){let t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(q.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(q.FORM):n&&e.openElements.remove(n))}function Id(e){e.openElements.hasInButtonScope(q.P)||e._insertFakeElement(K.P,q.P),e._closePElement()}function Ld(e){e.openElements.hasInListItemScope(q.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(q.LI),e.openElements.popUntilTagNamePopped(q.LI))}function Rd(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function zd(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function Bd(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function Vd(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(K.BR,q.BR),e.openElements.pop(),e.framesetOk=!1}function Hd(e,t){let n=t.tagName,r=t.tagID;for(let t=e.openElements.stackTop;t>0;t--){let i=e.openElements.items[t],a=e.openElements.tagIDs[t];if(r===a&&(r!==q.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=t&&e.openElements.shortenToLength(t);break}if(e._isSpecialElement(i,a))break}}function Ud(e,t){switch(t.tagID){case q.A:case q.B:case q.I:case q.S:case q.U:case q.EM:case q.TT:case q.BIG:case q.CODE:case q.FONT:case q.NOBR:case q.SMALL:case q.STRIKE:case q.STRONG:ku(e,t);break;case q.P:Id(e);break;case q.DL:case q.UL:case q.OL:case q.DIR:case q.DIV:case q.NAV:case q.PRE:case q.MAIN:case q.MENU:case q.ASIDE:case q.BUTTON:case q.CENTER:case q.FIGURE:case q.FOOTER:case q.HEADER:case q.HGROUP:case q.DIALOG:case q.ADDRESS:case q.ARTICLE:case q.DETAILS:case q.SEARCH:case q.SECTION:case q.SUMMARY:case q.LISTING:case q.FIELDSET:case q.BLOCKQUOTE:case q.FIGCAPTION:Pd(e,t);break;case q.LI:Ld(e);break;case q.DD:case q.DT:Rd(e,t);break;case q.H1:case q.H2:case q.H3:case q.H4:case q.H5:case q.H6:zd(e);break;case q.BR:Vd(e);break;case q.BODY:Md(e,t);break;case q.HTML:Nd(e,t);break;case q.FORM:Fd(e);break;case q.APPLET:case q.OBJECT:case q.MARQUEE:Bd(e,t);break;case q.TEMPLATE:Uu(e,t);break;default:Hd(e,t)}}function Wd(e,t){e.tmplInsertionModeStack.length>0?Df(e,t):Nu(e,t)}function Gd(e,t){var n;t.tagID===q.SCRIPT&&((n=e.scriptHandler)==null||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function Kd(e,t){e._err(t,H.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function qd(e,t){if(e.openElements.currentTagId!==void 0&&bu.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=Z.IN_TABLE_TEXT,t.type){case U.CHARACTER:sf(e,t);break;case U.WHITESPACE_CHARACTER:of(e,t);break}else af(e,t)}function Jd(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,W.HTML),e.insertionMode=Z.IN_CAPTION}function Yd(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,W.HTML),e.insertionMode=Z.IN_COLUMN_GROUP}function Xd(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(K.COLGROUP,q.COLGROUP),e.insertionMode=Z.IN_COLUMN_GROUP,ff(e,t)}function Zd(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,W.HTML),e.insertionMode=Z.IN_TABLE_BODY}function Qd(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(K.TBODY,q.TBODY),e.insertionMode=Z.IN_TABLE_BODY,hf(e,t)}function $d(e,t){e.openElements.hasInTableScope(q.TABLE)&&(e.openElements.popUntilTagNamePopped(q.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function ef(e,t){gd(t)?e._appendElement(t,W.HTML):af(e,t),t.ackSelfClosing=!0}function tf(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,W.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function nf(e,t){switch(t.tagID){case q.TD:case q.TH:case q.TR:Qd(e,t);break;case q.STYLE:case q.SCRIPT:case q.TEMPLATE:Q(e,t);break;case q.COL:Xd(e,t);break;case q.FORM:tf(e,t);break;case q.TABLE:$d(e,t);break;case q.TBODY:case q.TFOOT:case q.THEAD:Zd(e,t);break;case q.INPUT:ef(e,t);break;case q.CAPTION:Jd(e,t);break;case q.COLGROUP:Yd(e,t);break;default:af(e,t)}}function rf(e,t){switch(t.tagID){case q.TABLE:e.openElements.hasInTableScope(q.TABLE)&&(e.openElements.popUntilTagNamePopped(q.TABLE),e._resetInsertionMode());break;case q.TEMPLATE:Uu(e,t);break;case q.BODY:case q.CAPTION:case q.COL:case q.COLGROUP:case q.HTML:case q.TBODY:case q.TD:case q.TFOOT:case q.TH:case q.THEAD:case q.TR:break;default:af(e,t)}}function af(e,t){let n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,Zu(e,t),e.fosterParentingEnabled=n}function of(e,t){e.pendingCharacterTokens.push(t)}function sf(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function cf(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)af(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}var lf=new Set([q.CAPTION,q.COL,q.COLGROUP,q.TBODY,q.TD,q.TFOOT,q.TH,q.THEAD,q.TR]);function uf(e,t){let n=t.tagID;lf.has(n)?e.openElements.hasInTableScope(q.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(q.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Z.IN_TABLE,nf(e,t)):$(e,t)}function df(e,t){let n=t.tagID;switch(n){case q.CAPTION:case q.TABLE:e.openElements.hasInTableScope(q.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(q.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Z.IN_TABLE,n===q.TABLE&&rf(e,t));break;case q.BODY:case q.COL:case q.COLGROUP:case q.HTML:case q.TBODY:case q.TD:case q.TFOOT:case q.TH:case q.THEAD:case q.TR:break;default:Ud(e,t)}}function ff(e,t){switch(t.tagID){case q.HTML:$(e,t);break;case q.COL:e._appendElement(t,W.HTML),t.ackSelfClosing=!0;break;case q.TEMPLATE:Q(e,t);break;default:mf(e,t)}}function pf(e,t){switch(t.tagID){case q.COLGROUP:e.openElements.currentTagId===q.COLGROUP&&(e.openElements.pop(),e.insertionMode=Z.IN_TABLE);break;case q.TEMPLATE:Uu(e,t);break;case q.COL:break;default:mf(e,t)}}function mf(e,t){e.openElements.currentTagId===q.COLGROUP&&(e.openElements.pop(),e.insertionMode=Z.IN_TABLE,e._processToken(t))}function hf(e,t){switch(t.tagID){case q.TR:e.openElements.clearBackToTableBodyContext(),e._insertElement(t,W.HTML),e.insertionMode=Z.IN_ROW;break;case q.TH:case q.TD:e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(K.TR,q.TR),e.insertionMode=Z.IN_ROW,_f(e,t);break;case q.CAPTION:case q.COL:case q.COLGROUP:case q.TBODY:case q.TFOOT:case q.THEAD:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE,nf(e,t));break;default:nf(e,t)}}function gf(e,t){let n=t.tagID;switch(t.tagID){case q.TBODY:case q.TFOOT:case q.THEAD:e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE);break;case q.TABLE:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE,rf(e,t));break;case q.BODY:case q.CAPTION:case q.COL:case q.COLGROUP:case q.HTML:case q.TD:case q.TH:case q.TR:break;default:rf(e,t)}}function _f(e,t){switch(t.tagID){case q.TH:case q.TD:e.openElements.clearBackToTableRowContext(),e._insertElement(t,W.HTML),e.insertionMode=Z.IN_CELL,e.activeFormattingElements.insertMarker();break;case q.CAPTION:case q.COL:case q.COLGROUP:case q.TBODY:case q.TFOOT:case q.THEAD:case q.TR:e.openElements.hasInTableScope(q.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE_BODY,hf(e,t));break;default:nf(e,t)}}function vf(e,t){switch(t.tagID){case q.TR:e.openElements.hasInTableScope(q.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE_BODY);break;case q.TABLE:e.openElements.hasInTableScope(q.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE_BODY,gf(e,t));break;case q.TBODY:case q.TFOOT:case q.THEAD:(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(q.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE_BODY,gf(e,t));break;case q.BODY:case q.CAPTION:case q.COL:case q.COLGROUP:case q.HTML:case q.TD:case q.TH:break;default:rf(e,t)}}function yf(e,t){let n=t.tagID;lf.has(n)?(e.openElements.hasInTableScope(q.TD)||e.openElements.hasInTableScope(q.TH))&&(e._closeTableCell(),_f(e,t)):$(e,t)}function bf(e,t){let n=t.tagID;switch(n){case q.TD:case q.TH:e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Z.IN_ROW);break;case q.TABLE:case q.TBODY:case q.TFOOT:case q.THEAD:case q.TR:e.openElements.hasInTableScope(n)&&(e._closeTableCell(),vf(e,t));break;case q.BODY:case q.CAPTION:case q.COL:case q.COLGROUP:case q.HTML:break;default:Ud(e,t)}}function xf(e,t){switch(t.tagID){case q.HTML:$(e,t);break;case q.OPTION:e.openElements.currentTagId===q.OPTION&&e.openElements.pop(),e._insertElement(t,W.HTML);break;case q.OPTGROUP:e.openElements.currentTagId===q.OPTION&&e.openElements.pop(),e.openElements.currentTagId===q.OPTGROUP&&e.openElements.pop(),e._insertElement(t,W.HTML);break;case q.HR:e.openElements.currentTagId===q.OPTION&&e.openElements.pop(),e.openElements.currentTagId===q.OPTGROUP&&e.openElements.pop(),e._appendElement(t,W.HTML),t.ackSelfClosing=!0;break;case q.INPUT:case q.KEYGEN:case q.TEXTAREA:case q.SELECT:e.openElements.hasInSelectScope(q.SELECT)&&(e.openElements.popUntilTagNamePopped(q.SELECT),e._resetInsertionMode(),t.tagID!==q.SELECT&&e._processStartTag(t));break;case q.SCRIPT:case q.TEMPLATE:Q(e,t);break;default:}}function Sf(e,t){switch(t.tagID){case q.OPTGROUP:e.openElements.stackTop>0&&e.openElements.currentTagId===q.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===q.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===q.OPTGROUP&&e.openElements.pop();break;case q.OPTION:e.openElements.currentTagId===q.OPTION&&e.openElements.pop();break;case q.SELECT:e.openElements.hasInSelectScope(q.SELECT)&&(e.openElements.popUntilTagNamePopped(q.SELECT),e._resetInsertionMode());break;case q.TEMPLATE:Uu(e,t);break;default:}}function Cf(e,t){let n=t.tagID;n===q.CAPTION||n===q.TABLE||n===q.TBODY||n===q.TFOOT||n===q.THEAD||n===q.TR||n===q.TD||n===q.TH?(e.openElements.popUntilTagNamePopped(q.SELECT),e._resetInsertionMode(),e._processStartTag(t)):xf(e,t)}function wf(e,t){let n=t.tagID;n===q.CAPTION||n===q.TABLE||n===q.TBODY||n===q.TFOOT||n===q.THEAD||n===q.TR||n===q.TD||n===q.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(q.SELECT),e._resetInsertionMode(),e.onEndTag(t)):Sf(e,t)}function Tf(e,t){switch(t.tagID){case q.BASE:case q.BASEFONT:case q.BGSOUND:case q.LINK:case q.META:case q.NOFRAMES:case q.SCRIPT:case q.STYLE:case q.TEMPLATE:case q.TITLE:Q(e,t);break;case q.CAPTION:case q.COLGROUP:case q.TBODY:case q.TFOOT:case q.THEAD:e.tmplInsertionModeStack[0]=Z.IN_TABLE,e.insertionMode=Z.IN_TABLE,nf(e,t);break;case q.COL:e.tmplInsertionModeStack[0]=Z.IN_COLUMN_GROUP,e.insertionMode=Z.IN_COLUMN_GROUP,ff(e,t);break;case q.TR:e.tmplInsertionModeStack[0]=Z.IN_TABLE_BODY,e.insertionMode=Z.IN_TABLE_BODY,hf(e,t);break;case q.TD:case q.TH:e.tmplInsertionModeStack[0]=Z.IN_ROW,e.insertionMode=Z.IN_ROW,_f(e,t);break;default:e.tmplInsertionModeStack[0]=Z.IN_BODY,e.insertionMode=Z.IN_BODY,$(e,t)}}function Ef(e,t){t.tagID===q.TEMPLATE&&Uu(e,t)}function Df(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(q.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):Nu(e,t)}function Of(e,t){t.tagID===q.HTML?$(e,t):Af(e,t)}function kf(e,t){if(t.tagID===q.HTML){if(e.fragmentContext||(e.insertionMode=Z.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===q.HTML){e._setEndLocation(e.openElements.items[0],t);let n=e.openElements.items[1];n&&!e.treeAdapter.getNodeSourceCodeLocation(n)?.endTag&&e._setEndLocation(n,t)}}else Af(e,t)}function Af(e,t){e.insertionMode=Z.IN_BODY,Zu(e,t)}function jf(e,t){switch(t.tagID){case q.HTML:$(e,t);break;case q.FRAMESET:e._insertElement(t,W.HTML);break;case q.FRAME:e._appendElement(t,W.HTML),t.ackSelfClosing=!0;break;case q.NOFRAMES:Q(e,t);break;default:}}function Mf(e,t){t.tagID===q.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==q.FRAMESET&&(e.insertionMode=Z.AFTER_FRAMESET))}function Nf(e,t){switch(t.tagID){case q.HTML:$(e,t);break;case q.NOFRAMES:Q(e,t);break;default:}}function Pf(e,t){t.tagID===q.HTML&&(e.insertionMode=Z.AFTER_AFTER_FRAMESET)}function Ff(e,t){t.tagID===q.HTML?$(e,t):If(e,t)}function If(e,t){e.insertionMode=Z.IN_BODY,Zu(e,t)}function Lf(e,t){switch(t.tagID){case q.HTML:$(e,t);break;case q.NOFRAMES:Q(e,t);break;default:}}function Rf(e,t){t.chars=`�`,e._insertCharacters(t)}function zf(e,t){e._insertCharacters(t),e.framesetOk=!1}function Bf(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==W.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function Vf(e,t){if(cu(t))Bf(e),e._startTagOutsideForeignContent(t);else{let n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===W.MATHML?lu(t):r===W.SVG&&(fu(t),uu(t)),du(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function Hf(e,t){if(t.tagID===q.P||t.tagID===q.BR){Bf(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){let r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===W.HTML){e._endTagOutsideForeignContent(t);break}let i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}var Uf=new Set([K.AREA,K.BASE,K.BASEFONT,K.BGSOUND,K.BR,K.COL,K.EMBED,K.FRAME,K.HR,K.IMG,K.INPUT,K.KEYGEN,K.LINK,K.META,K.PARAM,K.SOURCE,K.TRACK,K.WBR]);function Wf(e,t){return t.treeAdapter.isElementNode(e)&&t.treeAdapter.getNamespaceURI(e)===W.HTML&&Uf.has(t.treeAdapter.getTagName(e))}var Gf={treeAdapter:Ul,scriptingEnabled:!0};function Kf(e,t){let n={...Gf,...t};return Wf(e,n)?``:qf(e,n)}function qf(e,t){let n=``,r=t.treeAdapter.isElementNode(e)&&t.treeAdapter.getTagName(e)===K.TEMPLATE&&t.treeAdapter.getNamespaceURI(e)===W.HTML?t.treeAdapter.getTemplateContent(e):e,i=t.treeAdapter.getChildNodes(r);if(i)for(let e of i)n+=Jf(e,t);return n}function Jf(e,t){return t.treeAdapter.isElementNode(e)?Yf(e,t):t.treeAdapter.isTextNode(e)?Zf(e,t):t.treeAdapter.isCommentNode(e)?Qf(e,t):t.treeAdapter.isDocumentTypeNode(e)?$f(e,t):``}function Yf(e,t){let n=t.treeAdapter.getTagName(e);return`<${n}${Xf(e,t)}>${Wf(e,t)?``:`${qf(e,t)}</${n}>`}`}function Xf(e,{treeAdapter:t}){let n=``;for(let r of t.getAttrList(e)){if(n+=` `,r.namespace)switch(r.namespace){case W.XML:n+=`xml:${r.name}`;break;case W.XMLNS:r.name!==`xmlns`&&(n+=`xmlns:`),n+=r.name;break;case W.XLINK:n+=`xlink:${r.name}`;break;default:n+=`${r.prefix}:${r.name}`}else n+=r.name;n+=`="${Fi(r.value)}"`}return n}function Zf(e,t){let{treeAdapter:n}=t,r=n.getTextNodeContent(e),i=n.getParentNode(e),a=i&&n.isElementNode(i)&&n.getTagName(i);return a&&n.getNamespaceURI(i)===W.HTML&&gl(a,t.scriptingEnabled)?r:Ii(r)}function Qf(e,{treeAdapter:t}){return`<!--${t.getCommentNodeContent(e)}-->`}function $f(e,{treeAdapter:t}){return`<!DOCTYPE ${t.getDocumentTypeNodeName(e)}>`}function ep(e,t){return Su.parse(e,t)}function tp(e){return`attrs`in e&&`tagName`in e}function np(e){return tp(e)&&e.nodeName===`template`}function rp(e,t,n){e.attrs=e.attrs.filter(e=>e.name!==t),n!==void 0&&e.attrs.push({name:t,value:n})}function ip(e){if(tp(e)){rp(e,xn),rp(e,Sn);let t=e.sourceCodeLocation;t&&(rp(e,xn,String(t.startLine)),rp(e,Sn,String(t.endLine)))}if(`childNodes`in e)for(let t of e.childNodes)ip(t);np(e)&&ip(e.content)}function ap(e){let t=ep(e,{sourceCodeLocationInfo:!0});ip(t);let n=t.childNodes.find(e=>tp(e)&&e.tagName===`html`);return n&&rp(n,Cn,String(Mn(e))),Kf(t)}var op=[[`img`,`src`],[`script`,`src`],[`link[rel~="stylesheet" i]`,`href`],[`link[rel~="icon" i]`,`href`],[`source`,`src`],[`video`,`src`],[`video`,`poster`],[`audio`,`src`]],sp=[`img[srcset]`,`source[srcset]`],cp=20*1024*1024;async function lp(e,t,n,r,i,a,o,s){let c=new DOMParser().parseFromString(ap(n),`text/html`);if(i!==void 0){let e=c.createElement(`style`);e.textContent=`:where(html) { font-size: ${i}px; }`;let t=c.head??c.documentElement;t.insertBefore(e,t.firstChild)}Qc(c)&&await up(c);let l=[];for(let[n,i]of op)for(let o of c.querySelectorAll(n)){let n=dt(t,o.getAttribute(i)??``);n&&(o.removeAttribute(i),l.push(dp(e,n,r,a).then(e=>{e&&o.setAttribute(i,e)})))}for(let n of sp)for(let i of c.querySelectorAll(n)){let n=ft(i.getAttribute(`srcset`)??``),o=n.map(({ref:e})=>dt(t,e));o.some(e=>e!==null)&&(i.removeAttribute(`srcset`),l.push(Promise.all(n.map(async(t,n)=>{let i=o[n];if(!i)return t;let s=await dp(e,i,r,a);return s?{...t,ref:s}:null})).then(e=>{let t=e.filter(e=>e!==null);t.length>0&&i.setAttribute(`srcset`,ct(t))})))}return await Promise.all(l),o&&Bc(c,o),s&&Yc(c,s),`<!doctype html>${c.documentElement.outerHTML}`}async function up(e){let{default:t}=await v(async()=>{let{default:e}=await import(`./_virtual_katex-inline-css-DN-_JSKR.js`);return{default:e}},[]),n=e.createElement(`style`);n.textContent=`${t}\n${Bt}`,(e.head??e.documentElement).appendChild(n)}function dp(e,t,n,r){let i=n.get(t);if(i)return i;let a=wc(e,t,r).then(async e=>e.size>cp?null:`data:${fp(t,e.type)};base64,${pp(await e.arrayBuffer())}`).catch(()=>null);return n.set(t,a),a}function fp(e,t){let n=(e.split(`/`).pop()??``).split(`.`).pop()?.toLowerCase()??``;return n===`css`?`text/css`:n===`js`||n===`mjs`?`text/javascript`:t!==``&&t!==`application/octet-stream`?t:`application/octet-stream`}function pp(e){let t=new Uint8Array(e),n=``,r=32768;for(let e=0;e<t.length;e+=r)n+=String.fromCharCode(...t.subarray(e,e+r));return btoa(n)}function mp({session:e,path:t,text:n,root:r,scrollDriver:i=!1,scrollReceiver:a=!1,scrollChannel:o=`profile`,focused:s=!0,onRevealSource:c,mobile:l=!1}){let u=It(`html`,[e,r,t]),[d,f]=(0,E.useState)(null),p=(0,E.useRef)(new Map),m=h().editorFontSize,g=(0,E.useRef)(null),[_]=(0,E.useState)(Pc),[v]=(0,E.useState)(Pc),y=et({shortcutEnabled:s,onFind:(e,t,n)=>Kc(g.current?.contentWindow??null,v,e,t,n),onClear:()=>qc(g.current?.contentWindow??null,v),onCloseFocus:()=>g.current?.focus()}),b=(0,E.useMemo)(()=>({session:e,path:t,root:r}),[e,t,r]),x=(0,E.useMemo)(()=>Mn(n),[n]);return(0,E.useEffect)(()=>{let i=!1;return lp(e,t,n,p.current,m,r,_,v).then(e=>{i||f(e)}),()=>{i=!0}},[e,t,n,m,r,_,v,l]),(0,E.useEffect)(()=>{let e=e=>{let t=Gc(e,g.current?.contentWindow??null,v);t?.kind===`puddle-preview-find-open`?y.openFind():t?.kind===`puddle-preview-find-result`&&y.setResult(t)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[y.openFind,y.setResult,v]),(0,E.useEffect)(()=>{if(a)return Ln.subscribe(o,b,e=>{Rc(g.current?.contentWindow??null,_,e)})},[a,o,b,_]),(0,E.useEffect)(()=>{let e=e=>{let t=Ic(e,g.current?.contentWindow??null,_);if(t)if(t.layout&&(a||!t.scrolled)){let e=(a?Ln.get(o,b):void 0)??Rn.get(u);if(e&&Rc(g.current?.contentWindow??null,_,e),i){let n=e??t;Ln.publish(o,b,n.ratio,n.sourceLine)}}else Rn.set(u,{ratio:t.ratio,sourceLine:t.sourceLine,revision:0}),i&&Ln.publish(o,b,t.ratio,t.sourceLine);let n=c?Lc(e,g.current?.contentWindow??null,_):null;n&&c?.({line:Oc(n.line,x)})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[i,a,o,b,_,c,x,u]),d===null?null:(0,D.jsxs)(`div`,{className:`relative size-full bg-paper`,children:[(0,D.jsx)(`iframe`,{ref:g,sandbox:`allow-scripts`,src:l?`/preview.html`:void 0,srcDoc:l?void 0:d,title:t,className:`size-full bg-paper`,onLoad:()=>{let e=g.current;l&&e&&!e.dataset.delivered&&(e.dataset.delivered=`true`,e.contentWindow?.postMessage({kind:`puddle-preview-document`,html:d},`*`));{let e=(a?Ln.get(o,b):void 0)??Rn.get(u);e&&Rc(g.current?.contentWindow??null,_,e)}y.refresh()}},l?d:void 0),(0,D.jsx)(Dc,{controls:y})]})}function hp({kind:e,...t}){return e===`notebook`?(0,D.jsx)(_c,{...t}):e===`markdown`?(0,D.jsx)(kc,{...t}):(0,D.jsx)(mp,{...t})}function gp({session:e,path:t,kind:n,root:r,focused:i=!0,scrollDriver:a=!1,scrollReceiver:o=!1,scrollChannel:s=`profile`,onRevealSource:c,onRunCompilation:l,compilationRunning:u}){let{openFile:d}=Oe(),f=Zn(e,t,null,r,{passive:n!==`notebook`,live:!0,focused:i}),p=f.model,m=(0,E.useSyncExternalStore)(n=>kt(Ot(e,t,r),n),()=>p?.getValue()??null);return f.conflict&&f.conflict.phase!==`unresolved`?(0,D.jsx)(bn,{session:e,path:t,buffer:f,focused:i}):m===null?(0,D.jsx)(`p`,{className:`p-6 text-sm text-fg-muted`,children:f.status===`loading`?`Loading…`:f.errorMessage??`This file cannot be previewed.`}):n===`notebook`?(0,D.jsx)(_c,{session:e,path:t,root:r,text:m,onRun:l,running:u,onChange:e=>{let t=f.model;if(!t)return;let n=Lr(t.getValue(),e),r=t.getPositionAt(n.start),i=t.getPositionAt(n.end);t.pushStackElement(),t.pushEditOperations([],[{range:{startLineNumber:r.lineNumber,startColumn:r.column,endLineNumber:i.lineNumber,endColumn:i.column},text:n.text}],()=>null),t.pushStackElement()}}):(0,D.jsx)(hp,{session:e,path:t,kind:n,text:m,root:r,scrollDriver:a,scrollReceiver:o,scrollChannel:s,focused:i,onRevealSource:c,onOpenFile:t=>d(e,t,void 0,{...lt(t)?{view:`preview`}:{},...r===void 0?{}:{root:r}})})}var _p={png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,webp:`image`,bmp:`image`,ico:`image`,avif:`image`,svg:`image`,mp4:`video`,m4v:`video`,webm:`video`,mov:`video`,mkv:`video`,avi:`video`,mp3:`audio`,wav:`audio`,ogg:`audio`,m4a:`audio`,flac:`audio`,aac:`audio`,pdf:`pdf`};function vp(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0?null:_p[t.slice(n+1).toLowerCase()]??null}var yp=(0,E.lazy)(()=>v(()=>import(`./PdfViewer-BY5xRKk1.js`).then(e=>({default:e.PdfViewer})),__vite__mapDeps([0,1,2,3,4,5,6,7,8])));function bp({session:e,path:t,kind:n,root:r,generatedBy:i,refreshKey:a,onRevealSource:o,readOnly:s=!1}){let{asset:c,error:l}=Cp(e,t,r,Pe(e,t,r),a);if(l)return(0,D.jsxs)(xp,{children:[(0,D.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:l}),!s&&(0,D.jsx)(Sp,{session:e,path:t,root:r})]});if(!c)return(0,D.jsx)(xp,{children:(0,D.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`…`})});let{url:u,blob:d}=c;return n===`image`?(0,D.jsx)(xp,{children:(0,D.jsx)(`img`,{src:u,alt:t,className:`max-h-full max-w-full object-contain`})}):n===`video`?(0,D.jsx)(xp,{children:(0,D.jsx)(`video`,{src:u,controls:!0,className:`max-h-full max-w-full`})}):n===`audio`?(0,D.jsx)(xp,{children:(0,D.jsx)(`audio`,{src:u,controls:!0,className:`w-full max-w-xl`})}):(0,D.jsx)(E.Suspense,{fallback:(0,D.jsx)(xp,{children:(0,D.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Loading PDF…`})}),children:(0,D.jsx)(yp,{blob:d,session:e,path:t,root:r,onRevealSource:!s&&Tp(t,r,i)?o:void 0,onDownload:s?void 0:()=>void wp(e,t,r)})})}function xp({children:e}){return(0,D.jsx)(`div`,{className:`flex h-full w-full flex-col items-center justify-center gap-3 overflow-auto bg-ground p-4`,children:e})}function Sp({session:e,path:t,root:n}){return(0,D.jsx)(`button`,{type:`button`,onClick:()=>void wp(e,t,n),className:`rounded-md bg-elevated px-3 py-1.5 text-sm text-fg transition-colors hover:bg-border/70`,children:`Download`})}function Cp(e,t,n,r=0,i){let[a,o]=(0,E.useState)(null),[s,c]=(0,E.useState)(null);return(0,E.useEffect)(()=>{let r=null,i=!1;return o(null),c(null),wc(e,t,n).then(e=>{i||(r=URL.createObjectURL(e),o({url:r,blob:e}))}).catch(e=>{i||c(e instanceof Error?e.message:`Couldn’t load this file.`)}),()=>{i=!0,r&&URL.revokeObjectURL(r)}},[e,t,n,r,i]),{asset:a,error:s}}function wp(e,t,n){return ge(e,t,n).catch(e=>{re.error(e instanceof Error?e.message:`Download failed`)})}function Tp(e,t,n){if(!t||!e.toLowerCase().endsWith(`.pdf`))return!1;if(n===`latex`)return!0;let r=t.replaceAll(`\\`,`/`).replaceAll(/\/{2,}/g,`/`);return`${r}/${e.replaceAll(`\\`,`/`)}`.includes(`/.puddle/latex/`)||/(?:^|\/)latex\/[a-f\d]{24}\/current\/?$/i.test(r)}function Ep({tab:e,reveal:t,focused:n,scrollDriver:r,scrollReceiver:i,scrollChannel:a,onRevealSource:o,onRevealCompiledSource:s,onRunCompilation:c,compilationRunning:l}){let u=ut(e),d=e.view===`preview`||e.view===`linked`||e.view===`locked`,f=e.view===`linked`||e.view===`locked`?`${e.view}:${e.session}:${e.root??``}:${e.path}`:st(e);if(u===`diff`)return(0,D.jsx)(Tr,{session:e.session,path:e.path,root:e.root,area:e.git_area,focused:n},st(e));if(u===`commit`&&e.sha)return(0,D.jsx)(wr,{session:e.session,sha:e.sha,path:e.path,root:e.root},st(e));if(u===`external`&&e.root!==void 0){let u=vp(e.path);if(u)return(0,D.jsx)(bp,{session:e.session,path:e.path,kind:u,root:e.root,generatedBy:e.generated_by,onRevealSource:s},st(e));let p=d?lt(e.path):null;return p?(0,D.jsx)(gp,{session:e.session,path:e.path,kind:p,onRunCompilation:e.generated_by?void 0:c,compilationRunning:l,root:e.root,focused:n,scrollDriver:r,scrollReceiver:i,scrollChannel:a,onRevealSource:o},f):(0,D.jsx)(dr,{session:e.session,path:e.path,reveal:t,root:e.root,focused:n,scrollDriver:r,scrollReceiver:i,scrollChannel:a},st(e))}if(u===`untitled`)return(0,D.jsx)(Dr,{name:e.path},st(e));let p=vp(e.path);if(p)return(0,D.jsx)(bp,{session:e.session,path:e.path,kind:p,generatedBy:e.generated_by,onRevealSource:s},st(e));let m=d?lt(e.path):null;return m?(0,D.jsx)(gp,{session:e.session,path:e.path,kind:m,onRunCompilation:e.generated_by?void 0:c,compilationRunning:l,focused:n,scrollDriver:r,scrollReceiver:i,scrollChannel:a,onRevealSource:o},f):(0,D.jsx)(dr,{session:e.session,path:e.path,reveal:t,focused:n,scrollDriver:r,scrollReceiver:i,scrollChannel:a},st(e))}export{Ep as PaneEditorBody};
|
|
302
|
+
})();`}function Yc(e,t){let n=e.createElement(`script`);n.textContent=Jc(t),(e.body??e.documentElement).appendChild(n)}var Xc=`script, style, pre, code, kbd, samp, textarea, math, svg, .katex`,Zc=/\bmathjax\b|\bkatex\b/i;function Qc(e){if($c(e))return!1;let t=e.body??e.documentElement;if(!t)return!1;let n=e.createTreeWalker(t,NodeFilter.SHOW_TEXT),r=[];for(;n.nextNode();){let e=n.currentNode;/[$\\]/.test(e.data)&&(e.parentElement?.closest(Xc)||r.push(e))}let i={},a=!1;for(let t of r)el(e,t,i)&&(a=!0);return a}function $c(e){if(e.querySelector(`.katex, math`))return!0;for(let t of e.querySelectorAll(`script`))if(Zc.test(t.getAttribute(`src`)??``)||Zc.test(t.textContent??``))return!0;return!1}function el(e,t,n){let r=t.data;if(!Vt(r))return!1;let i=e.createDocumentFragment(),a=e.createElement(`span`),o=0;for(let t=Vt(r,0);t;t=Vt(r,o)){for(t.start>o&&i.appendChild(e.createTextNode(r.slice(o,t.start))),a.innerHTML=zt(t.tex,t.display,n);a.firstChild;)i.appendChild(a.firstChild);o=t.start+t.length}return o<r.length&&i.appendChild(e.createTextNode(r.slice(o))),t.replaceWith(i),!0}var tl=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]),B;(function(e){e[e.EOF=-1]=`EOF`,e[e.NULL=0]=`NULL`,e[e.TABULATION=9]=`TABULATION`,e[e.CARRIAGE_RETURN=13]=`CARRIAGE_RETURN`,e[e.LINE_FEED=10]=`LINE_FEED`,e[e.FORM_FEED=12]=`FORM_FEED`,e[e.SPACE=32]=`SPACE`,e[e.EXCLAMATION_MARK=33]=`EXCLAMATION_MARK`,e[e.QUOTATION_MARK=34]=`QUOTATION_MARK`,e[e.AMPERSAND=38]=`AMPERSAND`,e[e.APOSTROPHE=39]=`APOSTROPHE`,e[e.HYPHEN_MINUS=45]=`HYPHEN_MINUS`,e[e.SOLIDUS=47]=`SOLIDUS`,e[e.DIGIT_0=48]=`DIGIT_0`,e[e.DIGIT_9=57]=`DIGIT_9`,e[e.SEMICOLON=59]=`SEMICOLON`,e[e.LESS_THAN_SIGN=60]=`LESS_THAN_SIGN`,e[e.EQUALS_SIGN=61]=`EQUALS_SIGN`,e[e.GREATER_THAN_SIGN=62]=`GREATER_THAN_SIGN`,e[e.QUESTION_MARK=63]=`QUESTION_MARK`,e[e.LATIN_CAPITAL_A=65]=`LATIN_CAPITAL_A`,e[e.LATIN_CAPITAL_Z=90]=`LATIN_CAPITAL_Z`,e[e.RIGHT_SQUARE_BRACKET=93]=`RIGHT_SQUARE_BRACKET`,e[e.GRAVE_ACCENT=96]=`GRAVE_ACCENT`,e[e.LATIN_SMALL_A=97]=`LATIN_SMALL_A`,e[e.LATIN_SMALL_Z=122]=`LATIN_SMALL_Z`})(B||={});var V={DASH_DASH:`--`,CDATA_START:`[CDATA[`,DOCTYPE:`doctype`,SCRIPT:`script`,PUBLIC:`public`,SYSTEM:`system`};function nl(e){return e>=55296&&e<=57343}function rl(e){return e>=56320&&e<=57343}function il(e,t){return(e-55296)*1024+9216+t}function al(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function ol(e){return e>=64976&&e<=65007||tl.has(e)}var H;(function(e){e.controlCharacterInInputStream=`control-character-in-input-stream`,e.noncharacterInInputStream=`noncharacter-in-input-stream`,e.surrogateInInputStream=`surrogate-in-input-stream`,e.nonVoidHtmlElementStartTagWithTrailingSolidus=`non-void-html-element-start-tag-with-trailing-solidus`,e.endTagWithAttributes=`end-tag-with-attributes`,e.endTagWithTrailingSolidus=`end-tag-with-trailing-solidus`,e.unexpectedSolidusInTag=`unexpected-solidus-in-tag`,e.unexpectedNullCharacter=`unexpected-null-character`,e.unexpectedQuestionMarkInsteadOfTagName=`unexpected-question-mark-instead-of-tag-name`,e.invalidFirstCharacterOfTagName=`invalid-first-character-of-tag-name`,e.unexpectedEqualsSignBeforeAttributeName=`unexpected-equals-sign-before-attribute-name`,e.missingEndTagName=`missing-end-tag-name`,e.unexpectedCharacterInAttributeName=`unexpected-character-in-attribute-name`,e.unknownNamedCharacterReference=`unknown-named-character-reference`,e.missingSemicolonAfterCharacterReference=`missing-semicolon-after-character-reference`,e.unexpectedCharacterAfterDoctypeSystemIdentifier=`unexpected-character-after-doctype-system-identifier`,e.unexpectedCharacterInUnquotedAttributeValue=`unexpected-character-in-unquoted-attribute-value`,e.eofBeforeTagName=`eof-before-tag-name`,e.eofInTag=`eof-in-tag`,e.missingAttributeValue=`missing-attribute-value`,e.missingWhitespaceBetweenAttributes=`missing-whitespace-between-attributes`,e.missingWhitespaceAfterDoctypePublicKeyword=`missing-whitespace-after-doctype-public-keyword`,e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers=`missing-whitespace-between-doctype-public-and-system-identifiers`,e.missingWhitespaceAfterDoctypeSystemKeyword=`missing-whitespace-after-doctype-system-keyword`,e.missingQuoteBeforeDoctypePublicIdentifier=`missing-quote-before-doctype-public-identifier`,e.missingQuoteBeforeDoctypeSystemIdentifier=`missing-quote-before-doctype-system-identifier`,e.missingDoctypePublicIdentifier=`missing-doctype-public-identifier`,e.missingDoctypeSystemIdentifier=`missing-doctype-system-identifier`,e.abruptDoctypePublicIdentifier=`abrupt-doctype-public-identifier`,e.abruptDoctypeSystemIdentifier=`abrupt-doctype-system-identifier`,e.cdataInHtmlContent=`cdata-in-html-content`,e.incorrectlyOpenedComment=`incorrectly-opened-comment`,e.eofInScriptHtmlCommentLikeText=`eof-in-script-html-comment-like-text`,e.eofInDoctype=`eof-in-doctype`,e.nestedComment=`nested-comment`,e.abruptClosingOfEmptyComment=`abrupt-closing-of-empty-comment`,e.eofInComment=`eof-in-comment`,e.incorrectlyClosedComment=`incorrectly-closed-comment`,e.eofInCdata=`eof-in-cdata`,e.absenceOfDigitsInNumericCharacterReference=`absence-of-digits-in-numeric-character-reference`,e.nullCharacterReference=`null-character-reference`,e.surrogateCharacterReference=`surrogate-character-reference`,e.characterReferenceOutsideUnicodeRange=`character-reference-outside-unicode-range`,e.controlCharacterReference=`control-character-reference`,e.noncharacterCharacterReference=`noncharacter-character-reference`,e.missingWhitespaceBeforeDoctypeName=`missing-whitespace-before-doctype-name`,e.missingDoctypeName=`missing-doctype-name`,e.invalidCharacterSequenceAfterDoctypeName=`invalid-character-sequence-after-doctype-name`,e.duplicateAttribute=`duplicate-attribute`,e.nonConformingDoctype=`non-conforming-doctype`,e.missingDoctype=`missing-doctype`,e.misplacedDoctype=`misplaced-doctype`,e.endTagWithoutMatchingOpenElement=`end-tag-without-matching-open-element`,e.closingOfElementWithOpenChildElements=`closing-of-element-with-open-child-elements`,e.disallowedContentInNoscriptInHead=`disallowed-content-in-noscript-in-head`,e.openElementsLeftAfterEof=`open-elements-left-after-eof`,e.abandonedHeadElementChild=`abandoned-head-element-child`,e.misplacedStartTagForHeadElement=`misplaced-start-tag-for-head-element`,e.nestedNoscriptInHead=`nested-noscript-in-head`,e.eofInElementThatCanContainOnlyText=`eof-in-element-that-can-contain-only-text`})(H||={});var sl=65536,cl=class{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=sl,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,t){let{line:n,col:r,offset:i}=this,a=r+t,o=i+t;return{code:e,startLine:n,endLine:n,startCol:a,endCol:a,startOffset:o,endOffset:o}}_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){let t=this.html.charCodeAt(this.pos+1);if(rl(t))return this.pos++,this._addGap(),il(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,B.EOF;return this._err(H.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 t=0;t<e.length;t++)if((this.html.charCodeAt(this.pos+t)|32)!==e.charCodeAt(t))return!1;return!0}peek(e){let t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,B.EOF;let n=this.html.charCodeAt(t);return n===B.CARRIAGE_RETURN?B.LINE_FEED:n}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,nl(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){al(e)?this._err(H.controlCharacterInInputStream):ol(e)&&this._err(H.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}},U;(function(e){e[e.CHARACTER=0]=`CHARACTER`,e[e.NULL_CHARACTER=1]=`NULL_CHARACTER`,e[e.WHITESPACE_CHARACTER=2]=`WHITESPACE_CHARACTER`,e[e.START_TAG=3]=`START_TAG`,e[e.END_TAG=4]=`END_TAG`,e[e.COMMENT=5]=`COMMENT`,e[e.DOCTYPE=6]=`DOCTYPE`,e[e.EOF=7]=`EOF`,e[e.HIBERNATION=8]=`HIBERNATION`})(U||={});function ll(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}var W;(function(e){e.HTML=`http://www.w3.org/1999/xhtml`,e.MATHML=`http://www.w3.org/1998/Math/MathML`,e.SVG=`http://www.w3.org/2000/svg`,e.XLINK=`http://www.w3.org/1999/xlink`,e.XML=`http://www.w3.org/XML/1998/namespace`,e.XMLNS=`http://www.w3.org/2000/xmlns/`})(W||={});var ul;(function(e){e.TYPE=`type`,e.ACTION=`action`,e.ENCODING=`encoding`,e.PROMPT=`prompt`,e.NAME=`name`,e.COLOR=`color`,e.FACE=`face`,e.SIZE=`size`})(ul||={});var G;(function(e){e.NO_QUIRKS=`no-quirks`,e.QUIRKS=`quirks`,e.LIMITED_QUIRKS=`limited-quirks`})(G||={});var K;(function(e){e.A=`a`,e.ADDRESS=`address`,e.ANNOTATION_XML=`annotation-xml`,e.APPLET=`applet`,e.AREA=`area`,e.ARTICLE=`article`,e.ASIDE=`aside`,e.B=`b`,e.BASE=`base`,e.BASEFONT=`basefont`,e.BGSOUND=`bgsound`,e.BIG=`big`,e.BLOCKQUOTE=`blockquote`,e.BODY=`body`,e.BR=`br`,e.BUTTON=`button`,e.CAPTION=`caption`,e.CENTER=`center`,e.CODE=`code`,e.COL=`col`,e.COLGROUP=`colgroup`,e.DD=`dd`,e.DESC=`desc`,e.DETAILS=`details`,e.DIALOG=`dialog`,e.DIR=`dir`,e.DIV=`div`,e.DL=`dl`,e.DT=`dt`,e.EM=`em`,e.EMBED=`embed`,e.FIELDSET=`fieldset`,e.FIGCAPTION=`figcaption`,e.FIGURE=`figure`,e.FONT=`font`,e.FOOTER=`footer`,e.FOREIGN_OBJECT=`foreignObject`,e.FORM=`form`,e.FRAME=`frame`,e.FRAMESET=`frameset`,e.H1=`h1`,e.H2=`h2`,e.H3=`h3`,e.H4=`h4`,e.H5=`h5`,e.H6=`h6`,e.HEAD=`head`,e.HEADER=`header`,e.HGROUP=`hgroup`,e.HR=`hr`,e.HTML=`html`,e.I=`i`,e.IMG=`img`,e.IMAGE=`image`,e.INPUT=`input`,e.IFRAME=`iframe`,e.KEYGEN=`keygen`,e.LABEL=`label`,e.LI=`li`,e.LINK=`link`,e.LISTING=`listing`,e.MAIN=`main`,e.MALIGNMARK=`malignmark`,e.MARQUEE=`marquee`,e.MATH=`math`,e.MENU=`menu`,e.META=`meta`,e.MGLYPH=`mglyph`,e.MI=`mi`,e.MO=`mo`,e.MN=`mn`,e.MS=`ms`,e.MTEXT=`mtext`,e.NAV=`nav`,e.NOBR=`nobr`,e.NOFRAMES=`noframes`,e.NOEMBED=`noembed`,e.NOSCRIPT=`noscript`,e.OBJECT=`object`,e.OL=`ol`,e.OPTGROUP=`optgroup`,e.OPTION=`option`,e.P=`p`,e.PARAM=`param`,e.PLAINTEXT=`plaintext`,e.PRE=`pre`,e.RB=`rb`,e.RP=`rp`,e.RT=`rt`,e.RTC=`rtc`,e.RUBY=`ruby`,e.S=`s`,e.SCRIPT=`script`,e.SEARCH=`search`,e.SECTION=`section`,e.SELECT=`select`,e.SOURCE=`source`,e.SMALL=`small`,e.SPAN=`span`,e.STRIKE=`strike`,e.STRONG=`strong`,e.STYLE=`style`,e.SUB=`sub`,e.SUMMARY=`summary`,e.SUP=`sup`,e.TABLE=`table`,e.TBODY=`tbody`,e.TEMPLATE=`template`,e.TEXTAREA=`textarea`,e.TFOOT=`tfoot`,e.TD=`td`,e.TH=`th`,e.THEAD=`thead`,e.TITLE=`title`,e.TR=`tr`,e.TRACK=`track`,e.TT=`tt`,e.U=`u`,e.UL=`ul`,e.SVG=`svg`,e.VAR=`var`,e.WBR=`wbr`,e.XMP=`xmp`})(K||={});var q;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.A=1]=`A`,e[e.ADDRESS=2]=`ADDRESS`,e[e.ANNOTATION_XML=3]=`ANNOTATION_XML`,e[e.APPLET=4]=`APPLET`,e[e.AREA=5]=`AREA`,e[e.ARTICLE=6]=`ARTICLE`,e[e.ASIDE=7]=`ASIDE`,e[e.B=8]=`B`,e[e.BASE=9]=`BASE`,e[e.BASEFONT=10]=`BASEFONT`,e[e.BGSOUND=11]=`BGSOUND`,e[e.BIG=12]=`BIG`,e[e.BLOCKQUOTE=13]=`BLOCKQUOTE`,e[e.BODY=14]=`BODY`,e[e.BR=15]=`BR`,e[e.BUTTON=16]=`BUTTON`,e[e.CAPTION=17]=`CAPTION`,e[e.CENTER=18]=`CENTER`,e[e.CODE=19]=`CODE`,e[e.COL=20]=`COL`,e[e.COLGROUP=21]=`COLGROUP`,e[e.DD=22]=`DD`,e[e.DESC=23]=`DESC`,e[e.DETAILS=24]=`DETAILS`,e[e.DIALOG=25]=`DIALOG`,e[e.DIR=26]=`DIR`,e[e.DIV=27]=`DIV`,e[e.DL=28]=`DL`,e[e.DT=29]=`DT`,e[e.EM=30]=`EM`,e[e.EMBED=31]=`EMBED`,e[e.FIELDSET=32]=`FIELDSET`,e[e.FIGCAPTION=33]=`FIGCAPTION`,e[e.FIGURE=34]=`FIGURE`,e[e.FONT=35]=`FONT`,e[e.FOOTER=36]=`FOOTER`,e[e.FOREIGN_OBJECT=37]=`FOREIGN_OBJECT`,e[e.FORM=38]=`FORM`,e[e.FRAME=39]=`FRAME`,e[e.FRAMESET=40]=`FRAMESET`,e[e.H1=41]=`H1`,e[e.H2=42]=`H2`,e[e.H3=43]=`H3`,e[e.H4=44]=`H4`,e[e.H5=45]=`H5`,e[e.H6=46]=`H6`,e[e.HEAD=47]=`HEAD`,e[e.HEADER=48]=`HEADER`,e[e.HGROUP=49]=`HGROUP`,e[e.HR=50]=`HR`,e[e.HTML=51]=`HTML`,e[e.I=52]=`I`,e[e.IMG=53]=`IMG`,e[e.IMAGE=54]=`IMAGE`,e[e.INPUT=55]=`INPUT`,e[e.IFRAME=56]=`IFRAME`,e[e.KEYGEN=57]=`KEYGEN`,e[e.LABEL=58]=`LABEL`,e[e.LI=59]=`LI`,e[e.LINK=60]=`LINK`,e[e.LISTING=61]=`LISTING`,e[e.MAIN=62]=`MAIN`,e[e.MALIGNMARK=63]=`MALIGNMARK`,e[e.MARQUEE=64]=`MARQUEE`,e[e.MATH=65]=`MATH`,e[e.MENU=66]=`MENU`,e[e.META=67]=`META`,e[e.MGLYPH=68]=`MGLYPH`,e[e.MI=69]=`MI`,e[e.MO=70]=`MO`,e[e.MN=71]=`MN`,e[e.MS=72]=`MS`,e[e.MTEXT=73]=`MTEXT`,e[e.NAV=74]=`NAV`,e[e.NOBR=75]=`NOBR`,e[e.NOFRAMES=76]=`NOFRAMES`,e[e.NOEMBED=77]=`NOEMBED`,e[e.NOSCRIPT=78]=`NOSCRIPT`,e[e.OBJECT=79]=`OBJECT`,e[e.OL=80]=`OL`,e[e.OPTGROUP=81]=`OPTGROUP`,e[e.OPTION=82]=`OPTION`,e[e.P=83]=`P`,e[e.PARAM=84]=`PARAM`,e[e.PLAINTEXT=85]=`PLAINTEXT`,e[e.PRE=86]=`PRE`,e[e.RB=87]=`RB`,e[e.RP=88]=`RP`,e[e.RT=89]=`RT`,e[e.RTC=90]=`RTC`,e[e.RUBY=91]=`RUBY`,e[e.S=92]=`S`,e[e.SCRIPT=93]=`SCRIPT`,e[e.SEARCH=94]=`SEARCH`,e[e.SECTION=95]=`SECTION`,e[e.SELECT=96]=`SELECT`,e[e.SOURCE=97]=`SOURCE`,e[e.SMALL=98]=`SMALL`,e[e.SPAN=99]=`SPAN`,e[e.STRIKE=100]=`STRIKE`,e[e.STRONG=101]=`STRONG`,e[e.STYLE=102]=`STYLE`,e[e.SUB=103]=`SUB`,e[e.SUMMARY=104]=`SUMMARY`,e[e.SUP=105]=`SUP`,e[e.TABLE=106]=`TABLE`,e[e.TBODY=107]=`TBODY`,e[e.TEMPLATE=108]=`TEMPLATE`,e[e.TEXTAREA=109]=`TEXTAREA`,e[e.TFOOT=110]=`TFOOT`,e[e.TD=111]=`TD`,e[e.TH=112]=`TH`,e[e.THEAD=113]=`THEAD`,e[e.TITLE=114]=`TITLE`,e[e.TR=115]=`TR`,e[e.TRACK=116]=`TRACK`,e[e.TT=117]=`TT`,e[e.U=118]=`U`,e[e.UL=119]=`UL`,e[e.SVG=120]=`SVG`,e[e.VAR=121]=`VAR`,e[e.WBR=122]=`WBR`,e[e.XMP=123]=`XMP`})(q||={});var dl=new Map([[K.A,q.A],[K.ADDRESS,q.ADDRESS],[K.ANNOTATION_XML,q.ANNOTATION_XML],[K.APPLET,q.APPLET],[K.AREA,q.AREA],[K.ARTICLE,q.ARTICLE],[K.ASIDE,q.ASIDE],[K.B,q.B],[K.BASE,q.BASE],[K.BASEFONT,q.BASEFONT],[K.BGSOUND,q.BGSOUND],[K.BIG,q.BIG],[K.BLOCKQUOTE,q.BLOCKQUOTE],[K.BODY,q.BODY],[K.BR,q.BR],[K.BUTTON,q.BUTTON],[K.CAPTION,q.CAPTION],[K.CENTER,q.CENTER],[K.CODE,q.CODE],[K.COL,q.COL],[K.COLGROUP,q.COLGROUP],[K.DD,q.DD],[K.DESC,q.DESC],[K.DETAILS,q.DETAILS],[K.DIALOG,q.DIALOG],[K.DIR,q.DIR],[K.DIV,q.DIV],[K.DL,q.DL],[K.DT,q.DT],[K.EM,q.EM],[K.EMBED,q.EMBED],[K.FIELDSET,q.FIELDSET],[K.FIGCAPTION,q.FIGCAPTION],[K.FIGURE,q.FIGURE],[K.FONT,q.FONT],[K.FOOTER,q.FOOTER],[K.FOREIGN_OBJECT,q.FOREIGN_OBJECT],[K.FORM,q.FORM],[K.FRAME,q.FRAME],[K.FRAMESET,q.FRAMESET],[K.H1,q.H1],[K.H2,q.H2],[K.H3,q.H3],[K.H4,q.H4],[K.H5,q.H5],[K.H6,q.H6],[K.HEAD,q.HEAD],[K.HEADER,q.HEADER],[K.HGROUP,q.HGROUP],[K.HR,q.HR],[K.HTML,q.HTML],[K.I,q.I],[K.IMG,q.IMG],[K.IMAGE,q.IMAGE],[K.INPUT,q.INPUT],[K.IFRAME,q.IFRAME],[K.KEYGEN,q.KEYGEN],[K.LABEL,q.LABEL],[K.LI,q.LI],[K.LINK,q.LINK],[K.LISTING,q.LISTING],[K.MAIN,q.MAIN],[K.MALIGNMARK,q.MALIGNMARK],[K.MARQUEE,q.MARQUEE],[K.MATH,q.MATH],[K.MENU,q.MENU],[K.META,q.META],[K.MGLYPH,q.MGLYPH],[K.MI,q.MI],[K.MO,q.MO],[K.MN,q.MN],[K.MS,q.MS],[K.MTEXT,q.MTEXT],[K.NAV,q.NAV],[K.NOBR,q.NOBR],[K.NOFRAMES,q.NOFRAMES],[K.NOEMBED,q.NOEMBED],[K.NOSCRIPT,q.NOSCRIPT],[K.OBJECT,q.OBJECT],[K.OL,q.OL],[K.OPTGROUP,q.OPTGROUP],[K.OPTION,q.OPTION],[K.P,q.P],[K.PARAM,q.PARAM],[K.PLAINTEXT,q.PLAINTEXT],[K.PRE,q.PRE],[K.RB,q.RB],[K.RP,q.RP],[K.RT,q.RT],[K.RTC,q.RTC],[K.RUBY,q.RUBY],[K.S,q.S],[K.SCRIPT,q.SCRIPT],[K.SEARCH,q.SEARCH],[K.SECTION,q.SECTION],[K.SELECT,q.SELECT],[K.SOURCE,q.SOURCE],[K.SMALL,q.SMALL],[K.SPAN,q.SPAN],[K.STRIKE,q.STRIKE],[K.STRONG,q.STRONG],[K.STYLE,q.STYLE],[K.SUB,q.SUB],[K.SUMMARY,q.SUMMARY],[K.SUP,q.SUP],[K.TABLE,q.TABLE],[K.TBODY,q.TBODY],[K.TEMPLATE,q.TEMPLATE],[K.TEXTAREA,q.TEXTAREA],[K.TFOOT,q.TFOOT],[K.TD,q.TD],[K.TH,q.TH],[K.THEAD,q.THEAD],[K.TITLE,q.TITLE],[K.TR,q.TR],[K.TRACK,q.TRACK],[K.TT,q.TT],[K.U,q.U],[K.UL,q.UL],[K.SVG,q.SVG],[K.VAR,q.VAR],[K.WBR,q.WBR],[K.XMP,q.XMP]]);function fl(e){return dl.get(e)??q.UNKNOWN}var J=q,pl={[W.HTML]:new Set([J.ADDRESS,J.APPLET,J.AREA,J.ARTICLE,J.ASIDE,J.BASE,J.BASEFONT,J.BGSOUND,J.BLOCKQUOTE,J.BODY,J.BR,J.BUTTON,J.CAPTION,J.CENTER,J.COL,J.COLGROUP,J.DD,J.DETAILS,J.DIR,J.DIV,J.DL,J.DT,J.EMBED,J.FIELDSET,J.FIGCAPTION,J.FIGURE,J.FOOTER,J.FORM,J.FRAME,J.FRAMESET,J.H1,J.H2,J.H3,J.H4,J.H5,J.H6,J.HEAD,J.HEADER,J.HGROUP,J.HR,J.HTML,J.IFRAME,J.IMG,J.INPUT,J.LI,J.LINK,J.LISTING,J.MAIN,J.MARQUEE,J.MENU,J.META,J.NAV,J.NOEMBED,J.NOFRAMES,J.NOSCRIPT,J.OBJECT,J.OL,J.P,J.PARAM,J.PLAINTEXT,J.PRE,J.SCRIPT,J.SECTION,J.SELECT,J.SOURCE,J.STYLE,J.SUMMARY,J.TABLE,J.TBODY,J.TD,J.TEMPLATE,J.TEXTAREA,J.TFOOT,J.TH,J.THEAD,J.TITLE,J.TR,J.TRACK,J.UL,J.WBR,J.XMP]),[W.MATHML]:new Set([J.MI,J.MO,J.MN,J.MS,J.MTEXT,J.ANNOTATION_XML]),[W.SVG]:new Set([J.TITLE,J.FOREIGN_OBJECT,J.DESC]),[W.XLINK]:new Set,[W.XML]:new Set,[W.XMLNS]:new Set},ml=new Set([J.H1,J.H2,J.H3,J.H4,J.H5,J.H6]),hl=new Set([K.STYLE,K.SCRIPT,K.XMP,K.IFRAME,K.NOEMBED,K.NOFRAMES,K.PLAINTEXT]);function gl(e,t){return hl.has(e)||t&&e===K.NOSCRIPT}var Y;(function(e){e[e.DATA=0]=`DATA`,e[e.RCDATA=1]=`RCDATA`,e[e.RAWTEXT=2]=`RAWTEXT`,e[e.SCRIPT_DATA=3]=`SCRIPT_DATA`,e[e.PLAINTEXT=4]=`PLAINTEXT`,e[e.TAG_OPEN=5]=`TAG_OPEN`,e[e.END_TAG_OPEN=6]=`END_TAG_OPEN`,e[e.TAG_NAME=7]=`TAG_NAME`,e[e.RCDATA_LESS_THAN_SIGN=8]=`RCDATA_LESS_THAN_SIGN`,e[e.RCDATA_END_TAG_OPEN=9]=`RCDATA_END_TAG_OPEN`,e[e.RCDATA_END_TAG_NAME=10]=`RCDATA_END_TAG_NAME`,e[e.RAWTEXT_LESS_THAN_SIGN=11]=`RAWTEXT_LESS_THAN_SIGN`,e[e.RAWTEXT_END_TAG_OPEN=12]=`RAWTEXT_END_TAG_OPEN`,e[e.RAWTEXT_END_TAG_NAME=13]=`RAWTEXT_END_TAG_NAME`,e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]=`SCRIPT_DATA_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_END_TAG_OPEN=15]=`SCRIPT_DATA_END_TAG_OPEN`,e[e.SCRIPT_DATA_END_TAG_NAME=16]=`SCRIPT_DATA_END_TAG_NAME`,e[e.SCRIPT_DATA_ESCAPE_START=17]=`SCRIPT_DATA_ESCAPE_START`,e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]=`SCRIPT_DATA_ESCAPE_START_DASH`,e[e.SCRIPT_DATA_ESCAPED=19]=`SCRIPT_DATA_ESCAPED`,e[e.SCRIPT_DATA_ESCAPED_DASH=20]=`SCRIPT_DATA_ESCAPED_DASH`,e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]=`SCRIPT_DATA_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]=`SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]=`SCRIPT_DATA_ESCAPED_END_TAG_OPEN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]=`SCRIPT_DATA_ESCAPED_END_TAG_NAME`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]=`SCRIPT_DATA_DOUBLE_ESCAPE_START`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]=`SCRIPT_DATA_DOUBLE_ESCAPED`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]=`SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]=`SCRIPT_DATA_DOUBLE_ESCAPE_END`,e[e.BEFORE_ATTRIBUTE_NAME=31]=`BEFORE_ATTRIBUTE_NAME`,e[e.ATTRIBUTE_NAME=32]=`ATTRIBUTE_NAME`,e[e.AFTER_ATTRIBUTE_NAME=33]=`AFTER_ATTRIBUTE_NAME`,e[e.BEFORE_ATTRIBUTE_VALUE=34]=`BEFORE_ATTRIBUTE_VALUE`,e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]=`ATTRIBUTE_VALUE_DOUBLE_QUOTED`,e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]=`ATTRIBUTE_VALUE_SINGLE_QUOTED`,e[e.ATTRIBUTE_VALUE_UNQUOTED=37]=`ATTRIBUTE_VALUE_UNQUOTED`,e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]=`AFTER_ATTRIBUTE_VALUE_QUOTED`,e[e.SELF_CLOSING_START_TAG=39]=`SELF_CLOSING_START_TAG`,e[e.BOGUS_COMMENT=40]=`BOGUS_COMMENT`,e[e.MARKUP_DECLARATION_OPEN=41]=`MARKUP_DECLARATION_OPEN`,e[e.COMMENT_START=42]=`COMMENT_START`,e[e.COMMENT_START_DASH=43]=`COMMENT_START_DASH`,e[e.COMMENT=44]=`COMMENT`,e[e.COMMENT_LESS_THAN_SIGN=45]=`COMMENT_LESS_THAN_SIGN`,e[e.COMMENT_LESS_THAN_SIGN_BANG=46]=`COMMENT_LESS_THAN_SIGN_BANG`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]=`COMMENT_LESS_THAN_SIGN_BANG_DASH`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]=`COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH`,e[e.COMMENT_END_DASH=49]=`COMMENT_END_DASH`,e[e.COMMENT_END=50]=`COMMENT_END`,e[e.COMMENT_END_BANG=51]=`COMMENT_END_BANG`,e[e.DOCTYPE=52]=`DOCTYPE`,e[e.BEFORE_DOCTYPE_NAME=53]=`BEFORE_DOCTYPE_NAME`,e[e.DOCTYPE_NAME=54]=`DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_NAME=55]=`AFTER_DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]=`AFTER_DOCTYPE_PUBLIC_KEYWORD`,e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]=`BEFORE_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]=`DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]=`DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]=`AFTER_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]=`BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS`,e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]=`AFTER_DOCTYPE_SYSTEM_KEYWORD`,e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]=`BEFORE_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]=`DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]=`DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]=`AFTER_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.BOGUS_DOCTYPE=67]=`BOGUS_DOCTYPE`,e[e.CDATA_SECTION=68]=`CDATA_SECTION`,e[e.CDATA_SECTION_BRACKET=69]=`CDATA_SECTION_BRACKET`,e[e.CDATA_SECTION_END=70]=`CDATA_SECTION_END`,e[e.CHARACTER_REFERENCE=71]=`CHARACTER_REFERENCE`,e[e.AMBIGUOUS_AMPERSAND=72]=`AMBIGUOUS_AMPERSAND`})(Y||={});var X={DATA:Y.DATA,RCDATA:Y.RCDATA,RAWTEXT:Y.RAWTEXT,SCRIPT_DATA:Y.SCRIPT_DATA,PLAINTEXT:Y.PLAINTEXT,CDATA_SECTION:Y.CDATA_SECTION};function _l(e){return e>=B.DIGIT_0&&e<=B.DIGIT_9}function vl(e){return e>=B.LATIN_CAPITAL_A&&e<=B.LATIN_CAPITAL_Z}function yl(e){return e>=B.LATIN_SMALL_A&&e<=B.LATIN_SMALL_Z}function bl(e){return yl(e)||vl(e)}function xl(e){return bl(e)||_l(e)}function Sl(e){return e+32}function Cl(e){return e===B.SPACE||e===B.LINE_FEED||e===B.TABULATION||e===B.FORM_FEED}function wl(e){return Cl(e)||e===B.SOLIDUS||e===B.GREATER_THAN_SIGN}function Tl(e){return e===B.NULL?H.nullCharacterReference:e>1114111?H.characterReferenceOutsideUnicodeRange:nl(e)?H.surrogateCharacterReference:ol(e)?H.noncharacterCharacterReference:al(e)||e===B.CARRIAGE_RETURN?H.controlCharacterReference:null}var El=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=Y.DATA,this.returnState=Y.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:``,value:``},this.preprocessor=new cl(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new ki(Si,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(H.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(H.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{let t=Tl(e);t&&this._err(t,1)}}:void 0)}_err(e,t=0){var n,r;(r=(n=this.handler).onParseError)==null||r.call(n,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;let e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw Error(`Parser was already resumed`);this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e?.())}write(e,t,n){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||n?.()}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:U.START_TAG,tagName:``,tagID:q.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:U.END_TAG,tagName:``,tagID:q.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:U.COMMENT,data:``,location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:U.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;let t=this.currentToken;if(ll(t,this.currentAttr.name)===null){if(t.attrs.push(this.currentAttr),t.location&&this.currentLocation){let n=(e=t.location).attrs??(e.attrs=Object.create(null));n[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(H.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(){let e=this.currentToken;this.prepareToken(e),e.tagID=fl(e.tagName),e.type===U.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(H.endTagWithAttributes),e.selfClosing&&this._err(H.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 U.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case U.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case U.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}this.currentCharacterToken=null}}_emitEOFToken(){let e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:U.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){let t=Cl(e)?U.WHITESPACE_CHARACTER:e===B.NULL?U.NULL_CHARACTER:U.CHARACTER;this._appendCharToCurrentCharacterToken(t,e<65536?String.fromCharCode(e):String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(U.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=Y.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Oi.Attribute:Oi.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===Y.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===Y.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===Y.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case Y.DATA:this._stateData(e);break;case Y.RCDATA:this._stateRcdata(e);break;case Y.RAWTEXT:this._stateRawtext(e);break;case Y.SCRIPT_DATA:this._stateScriptData(e);break;case Y.PLAINTEXT:this._statePlaintext(e);break;case Y.TAG_OPEN:this._stateTagOpen(e);break;case Y.END_TAG_OPEN:this._stateEndTagOpen(e);break;case Y.TAG_NAME:this._stateTagName(e);break;case Y.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case Y.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case Y.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case Y.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case Y.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case Y.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case Y.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case Y.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case Y.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case Y.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case Y.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case Y.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case Y.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case Y.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case Y.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case Y.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case Y.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case Y.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case Y.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case Y.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case Y.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case Y.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case Y.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case Y.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case Y.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case Y.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case Y.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case Y.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case Y.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case Y.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case Y.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case Y.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case Y.BOGUS_COMMENT:this._stateBogusComment(e);break;case Y.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case Y.COMMENT_START:this._stateCommentStart(e);break;case Y.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case Y.COMMENT:this._stateComment(e);break;case Y.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case Y.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case Y.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case Y.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case Y.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case Y.COMMENT_END:this._stateCommentEnd(e);break;case Y.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case Y.DOCTYPE:this._stateDoctype(e);break;case Y.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case Y.DOCTYPE_NAME:this._stateDoctypeName(e);break;case Y.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case Y.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case Y.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case Y.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case Y.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case Y.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case Y.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case Y.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case Y.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case Y.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case Y.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case Y.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case Y.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case Y.CDATA_SECTION:this._stateCdataSection(e);break;case Y.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case Y.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case Y.CHARACTER_REFERENCE:this._stateCharacterReference();break;case Y.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw Error(`Unknown state`)}}_stateData(e){switch(e){case B.LESS_THAN_SIGN:this.state=Y.TAG_OPEN;break;case B.AMPERSAND:this._startCharacterReference();break;case B.NULL:this._err(H.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=Y.RCDATA_LESS_THAN_SIGN;break;case B.NULL:this._err(H.unexpectedNullCharacter),this._emitChars(`�`);break;case B.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case B.LESS_THAN_SIGN:this.state=Y.RAWTEXT_LESS_THAN_SIGN;break;case B.NULL:this._err(H.unexpectedNullCharacter),this._emitChars(`�`);break;case B.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case B.LESS_THAN_SIGN:this.state=Y.SCRIPT_DATA_LESS_THAN_SIGN;break;case B.NULL:this._err(H.unexpectedNullCharacter),this._emitChars(`�`);break;case B.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case B.NULL:this._err(H.unexpectedNullCharacter),this._emitChars(`�`);break;case B.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if(bl(e))this._createStartTagToken(),this.state=Y.TAG_NAME,this._stateTagName(e);else switch(e){case B.EXCLAMATION_MARK:this.state=Y.MARKUP_DECLARATION_OPEN;break;case B.SOLIDUS:this.state=Y.END_TAG_OPEN;break;case B.QUESTION_MARK:this._err(H.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=Y.BOGUS_COMMENT,this._stateBogusComment(e);break;case B.EOF:this._err(H.eofBeforeTagName),this._emitChars(`<`),this._emitEOFToken();break;default:this._err(H.invalidFirstCharacterOfTagName),this._emitChars(`<`),this.state=Y.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(bl(e))this._createEndTagToken(),this.state=Y.TAG_NAME,this._stateTagName(e);else switch(e){case B.GREATER_THAN_SIGN:this._err(H.missingEndTagName),this.state=Y.DATA;break;case B.EOF:this._err(H.eofBeforeTagName),this._emitChars(`</`),this._emitEOFToken();break;default:this._err(H.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=Y.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this.state=Y.BEFORE_ATTRIBUTE_NAME;break;case B.SOLIDUS:this.state=Y.SELF_CLOSING_START_TAG;break;case B.GREATER_THAN_SIGN:this.state=Y.DATA,this.emitCurrentTagToken();break;case B.NULL:this._err(H.unexpectedNullCharacter),t.tagName+=`�`;break;case B.EOF:this._err(H.eofInTag),this._emitEOFToken();break;default:t.tagName+=String.fromCodePoint(vl(e)?Sl(e):e)}}_stateRcdataLessThanSign(e){e===B.SOLIDUS?this.state=Y.RCDATA_END_TAG_OPEN:(this._emitChars(`<`),this.state=Y.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){bl(e)?(this.state=Y.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars(`</`),this.state=Y.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();let 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=Y.BEFORE_ATTRIBUTE_NAME,!1;case B.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=Y.SELF_CLOSING_START_TAG,!1;case B.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=Y.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Y.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===B.SOLIDUS?this.state=Y.RAWTEXT_END_TAG_OPEN:(this._emitChars(`<`),this.state=Y.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){bl(e)?(this.state=Y.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars(`</`),this.state=Y.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Y.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case B.SOLIDUS:this.state=Y.SCRIPT_DATA_END_TAG_OPEN;break;case B.EXCLAMATION_MARK:this.state=Y.SCRIPT_DATA_ESCAPE_START,this._emitChars(`<!`);break;default:this._emitChars(`<`),this.state=Y.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){bl(e)?(this.state=Y.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars(`</`),this.state=Y.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Y.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===B.HYPHEN_MINUS?(this.state=Y.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars(`-`)):(this.state=Y.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===B.HYPHEN_MINUS?(this.state=Y.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`)):(this.state=Y.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case B.HYPHEN_MINUS:this.state=Y.SCRIPT_DATA_ESCAPED_DASH,this._emitChars(`-`);break;case B.LESS_THAN_SIGN:this.state=Y.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case B.NULL:this._err(H.unexpectedNullCharacter),this._emitChars(`�`);break;case B.EOF:this._err(H.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case B.HYPHEN_MINUS:this.state=Y.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case B.LESS_THAN_SIGN:this.state=Y.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case B.NULL:this._err(H.unexpectedNullCharacter),this.state=Y.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case B.EOF:this._err(H.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Y.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case B.HYPHEN_MINUS:this._emitChars(`-`);break;case B.LESS_THAN_SIGN:this.state=Y.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case B.GREATER_THAN_SIGN:this.state=Y.SCRIPT_DATA,this._emitChars(`>`);break;case B.NULL:this._err(H.unexpectedNullCharacter),this.state=Y.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case B.EOF:this._err(H.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Y.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===B.SOLIDUS?this.state=Y.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:bl(e)?(this._emitChars(`<`),this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars(`<`),this.state=Y.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){bl(e)?(this.state=Y.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars(`</`),this.state=Y.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Y.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(V.SCRIPT,!1)&&wl(this.preprocessor.peek(V.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<V.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=Y.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case B.HYPHEN_MINUS:this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars(`-`);break;case B.LESS_THAN_SIGN:this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case B.NULL:this._err(H.unexpectedNullCharacter),this._emitChars(`�`);break;case B.EOF:this._err(H.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case B.HYPHEN_MINUS:this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case B.LESS_THAN_SIGN:this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case B.NULL:this._err(H.unexpectedNullCharacter),this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case B.EOF:this._err(H.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Y.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=Y.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case B.GREATER_THAN_SIGN:this.state=Y.SCRIPT_DATA,this._emitChars(`>`);break;case B.NULL:this._err(H.unexpectedNullCharacter),this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case B.EOF:this._err(H.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===B.SOLIDUS?(this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars(`/`)):(this.state=Y.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(V.SCRIPT,!1)&&wl(this.preprocessor.peek(V.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<V.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Y.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=Y.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=Y.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case B.EQUALS_SIGN:this._err(H.unexpectedEqualsSignBeforeAttributeName),this._createAttr(`=`),this.state=Y.ATTRIBUTE_NAME;break;default:this._createAttr(``),this.state=Y.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=Y.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case B.EQUALS_SIGN:this._leaveAttrName(),this.state=Y.BEFORE_ATTRIBUTE_VALUE;break;case B.QUOTATION_MARK:case B.APOSTROPHE:case B.LESS_THAN_SIGN:this._err(H.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break;case B.NULL:this._err(H.unexpectedNullCharacter),this.currentAttr.name+=`�`;break;default:this.currentAttr.name+=String.fromCodePoint(vl(e)?Sl(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=Y.SELF_CLOSING_START_TAG;break;case B.EQUALS_SIGN:this.state=Y.BEFORE_ATTRIBUTE_VALUE;break;case B.GREATER_THAN_SIGN:this.state=Y.DATA,this.emitCurrentTagToken();break;case B.EOF:this._err(H.eofInTag),this._emitEOFToken();break;default:this._createAttr(``),this.state=Y.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=Y.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case B.APOSTROPHE:this.state=Y.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case B.GREATER_THAN_SIGN:this._err(H.missingAttributeValue),this.state=Y.DATA,this.emitCurrentTagToken();break;default:this.state=Y.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case B.QUOTATION_MARK:this.state=Y.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case B.AMPERSAND:this._startCharacterReference();break;case B.NULL:this._err(H.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case B.EOF:this._err(H.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case B.APOSTROPHE:this.state=Y.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case B.AMPERSAND:this._startCharacterReference();break;case B.NULL:this._err(H.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case B.EOF:this._err(H.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=Y.BEFORE_ATTRIBUTE_NAME;break;case B.AMPERSAND:this._startCharacterReference();break;case B.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Y.DATA,this.emitCurrentTagToken();break;case B.NULL:this._err(H.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case B.QUOTATION_MARK:case B.APOSTROPHE:case B.LESS_THAN_SIGN:case B.EQUALS_SIGN:case B.GRAVE_ACCENT:this._err(H.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break;case B.EOF:this._err(H.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=Y.BEFORE_ATTRIBUTE_NAME;break;case B.SOLIDUS:this._leaveAttrValue(),this.state=Y.SELF_CLOSING_START_TAG;break;case B.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Y.DATA,this.emitCurrentTagToken();break;case B.EOF:this._err(H.eofInTag),this._emitEOFToken();break;default:this._err(H.missingWhitespaceBetweenAttributes),this.state=Y.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case B.GREATER_THAN_SIGN:{let e=this.currentToken;e.selfClosing=!0,this.state=Y.DATA,this.emitCurrentTagToken();break}case B.EOF:this._err(H.eofInTag),this._emitEOFToken();break;default:this._err(H.unexpectedSolidusInTag),this.state=Y.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){let t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:this.state=Y.DATA,this.emitCurrentComment(t);break;case B.EOF:this.emitCurrentComment(t),this._emitEOFToken();break;case B.NULL:this._err(H.unexpectedNullCharacter),t.data+=`�`;break;default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(V.DASH_DASH,!0)?(this._createCommentToken(V.DASH_DASH.length+1),this.state=Y.COMMENT_START):this._consumeSequenceIfMatch(V.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(V.DOCTYPE.length+1),this.state=Y.DOCTYPE):this._consumeSequenceIfMatch(V.CDATA_START,!0)?this.inForeignNode?this.state=Y.CDATA_SECTION:(this._err(H.cdataInHtmlContent),this._createCommentToken(V.CDATA_START.length+1),this.currentToken.data=`[CDATA[`,this.state=Y.BOGUS_COMMENT):this._ensureHibernation()||(this._err(H.incorrectlyOpenedComment),this._createCommentToken(2),this.state=Y.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case B.HYPHEN_MINUS:this.state=Y.COMMENT_START_DASH;break;case B.GREATER_THAN_SIGN:{this._err(H.abruptClosingOfEmptyComment),this.state=Y.DATA;let e=this.currentToken;this.emitCurrentComment(e);break}default:this.state=Y.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){let t=this.currentToken;switch(e){case B.HYPHEN_MINUS:this.state=Y.COMMENT_END;break;case B.GREATER_THAN_SIGN:this._err(H.abruptClosingOfEmptyComment),this.state=Y.DATA,this.emitCurrentComment(t);break;case B.EOF:this._err(H.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Y.COMMENT,this._stateComment(e)}}_stateComment(e){let t=this.currentToken;switch(e){case B.HYPHEN_MINUS:this.state=Y.COMMENT_END_DASH;break;case B.LESS_THAN_SIGN:t.data+=`<`,this.state=Y.COMMENT_LESS_THAN_SIGN;break;case B.NULL:this._err(H.unexpectedNullCharacter),t.data+=`�`;break;case B.EOF:this._err(H.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){let t=this.currentToken;switch(e){case B.EXCLAMATION_MARK:t.data+=`!`,this.state=Y.COMMENT_LESS_THAN_SIGN_BANG;break;case B.LESS_THAN_SIGN:t.data+=`<`;break;default:this.state=Y.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===B.HYPHEN_MINUS?this.state=Y.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=Y.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===B.HYPHEN_MINUS?this.state=Y.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=Y.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==B.GREATER_THAN_SIGN&&e!==B.EOF&&this._err(H.nestedComment),this.state=Y.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){let t=this.currentToken;switch(e){case B.HYPHEN_MINUS:this.state=Y.COMMENT_END;break;case B.EOF:this._err(H.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Y.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){let t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:this.state=Y.DATA,this.emitCurrentComment(t);break;case B.EXCLAMATION_MARK:this.state=Y.COMMENT_END_BANG;break;case B.HYPHEN_MINUS:t.data+=`-`;break;case B.EOF:this._err(H.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--`,this.state=Y.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){let t=this.currentToken;switch(e){case B.HYPHEN_MINUS:t.data+=`--!`,this.state=Y.COMMENT_END_DASH;break;case B.GREATER_THAN_SIGN:this._err(H.incorrectlyClosedComment),this.state=Y.DATA,this.emitCurrentComment(t);break;case B.EOF:this._err(H.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--!`,this.state=Y.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this.state=Y.BEFORE_DOCTYPE_NAME;break;case B.GREATER_THAN_SIGN:this.state=Y.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break;case B.EOF:{this._err(H.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._err(H.missingWhitespaceBeforeDoctypeName),this.state=Y.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(vl(e))this._createDoctypeToken(String.fromCharCode(Sl(e))),this.state=Y.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(H.unexpectedNullCharacter),this._createDoctypeToken(`�`),this.state=Y.DOCTYPE_NAME;break;case B.GREATER_THAN_SIGN:{this._err(H.missingDoctypeName),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=Y.DATA;break}case B.EOF:{this._err(H.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=Y.DOCTYPE_NAME}}_stateDoctypeName(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this.state=Y.AFTER_DOCTYPE_NAME;break;case B.GREATER_THAN_SIGN:this.state=Y.DATA,this.emitCurrentDoctype(t);break;case B.NULL:this._err(H.unexpectedNullCharacter),t.name+=`�`;break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.name+=String.fromCodePoint(vl(e)?Sl(e):e)}}_stateAfterDoctypeName(e){let 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=Y.DATA,this.emitCurrentDoctype(t);break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._consumeSequenceIfMatch(V.PUBLIC,!1)?this.state=Y.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(V.SYSTEM,!1)?this.state=Y.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(H.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=Y.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this.state=Y.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case B.QUOTATION_MARK:this._err(H.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Y.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case B.APOSTROPHE:this._err(H.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Y.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case B.GREATER_THAN_SIGN:this._err(H.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Y.DATA,this.emitCurrentDoctype(t);break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(H.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Y.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){let 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=Y.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case B.APOSTROPHE:t.publicId=``,this.state=Y.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case B.GREATER_THAN_SIGN:this._err(H.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Y.DATA,this.emitCurrentDoctype(t);break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(H.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Y.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case B.QUOTATION_MARK:this.state=Y.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case B.NULL:this._err(H.unexpectedNullCharacter),t.publicId+=`�`;break;case B.GREATER_THAN_SIGN:this._err(H.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Y.DATA;break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case B.APOSTROPHE:this.state=Y.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case B.NULL:this._err(H.unexpectedNullCharacter),t.publicId+=`�`;break;case B.GREATER_THAN_SIGN:this._err(H.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Y.DATA;break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this.state=Y.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case B.GREATER_THAN_SIGN:this.state=Y.DATA,this.emitCurrentDoctype(t);break;case B.QUOTATION_MARK:this._err(H.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Y.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case B.APOSTROPHE:this._err(H.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Y.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(H.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Y.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){let 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=Y.DATA;break;case B.QUOTATION_MARK:t.systemId=``,this.state=Y.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case B.APOSTROPHE:t.systemId=``,this.state=Y.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(H.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Y.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){let t=this.currentToken;switch(e){case B.SPACE:case B.LINE_FEED:case B.TABULATION:case B.FORM_FEED:this.state=Y.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case B.QUOTATION_MARK:this._err(H.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Y.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case B.APOSTROPHE:this._err(H.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Y.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case B.GREATER_THAN_SIGN:this._err(H.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Y.DATA,this.emitCurrentDoctype(t);break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(H.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Y.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){let 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=Y.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case B.APOSTROPHE:t.systemId=``,this.state=Y.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case B.GREATER_THAN_SIGN:this._err(H.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Y.DATA,this.emitCurrentDoctype(t);break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(H.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Y.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case B.QUOTATION_MARK:this.state=Y.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case B.NULL:this._err(H.unexpectedNullCharacter),t.systemId+=`�`;break;case B.GREATER_THAN_SIGN:this._err(H.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Y.DATA;break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case B.APOSTROPHE:this.state=Y.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case B.NULL:this._err(H.unexpectedNullCharacter),t.systemId+=`�`;break;case B.GREATER_THAN_SIGN:this._err(H.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Y.DATA;break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){let 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=Y.DATA;break;case B.EOF:this._err(H.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(H.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=Y.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){let t=this.currentToken;switch(e){case B.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Y.DATA;break;case B.NULL:this._err(H.unexpectedNullCharacter);break;case B.EOF:this.emitCurrentDoctype(t),this._emitEOFToken();break;default:}}_stateCdataSection(e){switch(e){case B.RIGHT_SQUARE_BRACKET:this.state=Y.CDATA_SECTION_BRACKET;break;case B.EOF:this._err(H.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===B.RIGHT_SQUARE_BRACKET?this.state=Y.CDATA_SECTION_END:(this._emitChars(`]`),this.state=Y.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case B.GREATER_THAN_SIGN:this.state=Y.DATA;break;case B.RIGHT_SQUARE_BRACKET:this._emitChars(`]`);break;default:this._emitChars(`]]`),this.state=Y.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()&&xl(this.preprocessor.peek(1))?Y.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){xl(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===B.SEMICOLON&&this._err(H.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}},Dl=new Set([q.DD,q.DT,q.LI,q.OPTGROUP,q.OPTION,q.P,q.RB,q.RP,q.RT,q.RTC]),Ol=new Set([...Dl,q.CAPTION,q.COLGROUP,q.TBODY,q.TD,q.TFOOT,q.TH,q.THEAD,q.TR]),kl=new Set([q.APPLET,q.CAPTION,q.HTML,q.MARQUEE,q.OBJECT,q.TABLE,q.TD,q.TEMPLATE,q.TH]),Al=new Set([...kl,q.OL,q.UL]),jl=new Set([...kl,q.BUTTON]),Ml=new Set([q.ANNOTATION_XML,q.MI,q.MN,q.MO,q.MS,q.MTEXT]),Nl=new Set([q.DESC,q.FOREIGN_OBJECT,q.TITLE]),Pl=new Set([q.TR,q.TEMPLATE,q.HTML]),Fl=new Set([q.TBODY,q.TFOOT,q.THEAD,q.TEMPLATE,q.HTML]),Il=new Set([q.TABLE,q.TEMPLATE,q.HTML]),Ll=new Set([q.TD,q.TH]),Rl=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,n){this.treeAdapter=t,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=q.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===q.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===W.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(){let e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){let n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&(this.current=t)}insertAfter(e,t,n){let r=this._indexOf(e)+1;this.items.splice(r,0,t),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,r===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])!==W.HTML);this.shortenToLength(Math.max(t,0))}shortenToLength(e){for(;this.stackTop>=e;){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&--this.tmplCount,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){let t=this._indexOf(e);this.shortenToLength(Math.max(t,0))}popUntilPopped(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(ml,W.HTML)}popUntilTableCellPopped(){this.popUntilPopped(Ll,W.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let n=this.stackTop;n>=0;n--)if(e.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===t)return n;return-1}clearBackTo(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(Il,W.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Fl,W.HTML)}clearBackToTableRowContext(){this.clearBackTo(Pl,W.HTML)}remove(e){let 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]===q.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===q.HTML}hasInDynamicScope(e,t){for(let n=this.stackTop;n>=0;n--){let r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case W.HTML:if(r===e)return!0;if(t.has(r))return!1;break;case W.SVG:if(Nl.has(r))return!1;break;case W.MATHML:if(Ml.has(r))return!1;break}}return!0}hasInScope(e){return this.hasInDynamicScope(e,kl)}hasInListItemScope(e){return this.hasInDynamicScope(e,Al)}hasInButtonScope(e){return this.hasInDynamicScope(e,jl)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case W.HTML:if(ml.has(t))return!0;if(kl.has(t))return!1;break;case W.SVG:if(Nl.has(t))return!1;break;case W.MATHML:if(Ml.has(t))return!1;break}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===W.HTML)switch(this.tagIDs[t]){case e:return!0;case q.TABLE:case q.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===W.HTML)switch(this.tagIDs[e]){case q.TBODY:case q.THEAD:case q.TFOOT:return!0;case q.TABLE:case q.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===W.HTML)switch(this.tagIDs[t]){case e:return!0;case q.OPTION:case q.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&Dl.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&Ol.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&Ol.has(this.currentTagId);)this.pop()}},zl=3,Bl;(function(e){e[e.Marker=0]=`Marker`,e[e.Element=1]=`Element`})(Bl||={});var Vl={type:Bl.Marker},Hl=class{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){let n=[],r=t.length,i=this.treeAdapter.getTagName(e),a=this.treeAdapter.getNamespaceURI(e);for(let e=0;e<this.entries.length;e++){let t=this.entries[e];if(t.type===Bl.Marker)break;let{element:o}=t;if(this.treeAdapter.getTagName(o)===i&&this.treeAdapter.getNamespaceURI(o)===a){let t=this.treeAdapter.getAttrList(o);t.length===r&&n.push({idx:e,attrs:t})}}return n}_ensureNoahArkCondition(e){if(this.entries.length<zl)return;let t=this.treeAdapter.getAttrList(e),n=this._getNoahArkConditionCandidates(e,t);if(n.length<zl)return;let r=new Map(t.map(e=>[e.name,e.value])),i=0;for(let e=0;e<n.length;e++){let t=n[e];t.attrs.every(e=>r.get(e.name)===e.value)&&(i+=1,i>=zl&&this.entries.splice(t.idx,1))}}insertMarker(){this.entries.unshift(Vl)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:Bl.Element,element:e,token:t})}insertElementAfterBookmark(e,t){let n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:Bl.Element,element:e,token:t})}removeEntry(e){let t=this.entries.indexOf(e);t!==-1&&this.entries.splice(t,1)}clearToLastMarker(){let e=this.entries.indexOf(Vl);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){let t=this.entries.find(t=>t.type===Bl.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===Bl.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===Bl.Element&&t.element===e)}},Ul={createDocument(){return{nodeName:`#document`,mode:G.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:`#document-fragment`,childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:`#comment`,data:e,parentNode:null}},createTextNode(e){return{nodeName:`#text`,value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){let r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){let i=e.childNodes.find(e=>e.nodeName===`#documentType`);if(i)i.name=t,i.publicId=n,i.systemId=r;else{let i={nodeName:`#documentType`,name:t,publicId:n,systemId:r,parentNode:null};Ul.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let n=e.childNodes[e.childNodes.length-1];if(Ul.isTextNode(n)){n.value+=t;return}}Ul.appendChild(e,Ul.createTextNode(t))},insertTextBefore(e,t,n){let r=e.childNodes[e.childNodes.indexOf(n)-1];r&&Ul.isTextNode(r)?r.value+=t:Ul.insertBefore(e,Ul.createTextNode(t),n)},adoptAttributes(e,t){let n=new Set(e.attrs.map(e=>e.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName===`#text`},isCommentNode(e){return e.nodeName===`#comment`},isDocumentTypeNode(e){return e.nodeName===`#documentType`},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,`tagName`)},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},Wl=`html`,Gl=`about:legacy-compat`,Kl=`http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd`,ql=`+//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//`.split(`,`),Jl=[...ql,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`],Yl=new Set([`-//w3o//dtd w3 html strict 3.0//en//`,`-/w3c/dtd html 4.0 transitional/en`,`html`]),Xl=[`-//w3c//dtd xhtml 1.0 frameset//`,`-//w3c//dtd xhtml 1.0 transitional//`],Zl=[...Xl,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`];function Ql(e,t){return t.some(t=>e.startsWith(t))}function $l(e){return e.name===Wl&&e.publicId===null&&(e.systemId===null||e.systemId===Gl)}function eu(e){if(e.name!==Wl)return G.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===Kl)return G.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),Yl.has(n))return G.QUIRKS;let e=t===null?Jl:ql;if(Ql(n,e))return G.QUIRKS;if(e=t===null?Xl:Zl,Ql(n,e))return G.LIMITED_QUIRKS}return G.NO_QUIRKS}var tu={TEXT_HTML:`text/html`,APPLICATION_XML:`application/xhtml+xml`},nu=`definitionurl`,ru=`definitionURL`,iu=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`.split(`.`).map(e=>[e.toLowerCase(),e])),au=new Map([[`xlink:actuate`,{prefix:`xlink`,name:`actuate`,namespace:W.XLINK}],[`xlink:arcrole`,{prefix:`xlink`,name:`arcrole`,namespace:W.XLINK}],[`xlink:href`,{prefix:`xlink`,name:`href`,namespace:W.XLINK}],[`xlink:role`,{prefix:`xlink`,name:`role`,namespace:W.XLINK}],[`xlink:show`,{prefix:`xlink`,name:`show`,namespace:W.XLINK}],[`xlink:title`,{prefix:`xlink`,name:`title`,namespace:W.XLINK}],[`xlink:type`,{prefix:`xlink`,name:`type`,namespace:W.XLINK}],[`xml:lang`,{prefix:`xml`,name:`lang`,namespace:W.XML}],[`xml:space`,{prefix:`xml`,name:`space`,namespace:W.XML}],[`xmlns`,{prefix:``,name:`xmlns`,namespace:W.XMLNS}],[`xmlns:xlink`,{prefix:`xmlns`,name:`xlink`,namespace:W.XMLNS}]]),ou=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`.split(`.`).map(e=>[e.toLowerCase(),e])),su=new Set([q.B,q.BIG,q.BLOCKQUOTE,q.BODY,q.BR,q.CENTER,q.CODE,q.DD,q.DIV,q.DL,q.DT,q.EM,q.EMBED,q.H1,q.H2,q.H3,q.H4,q.H5,q.H6,q.HEAD,q.HR,q.I,q.IMG,q.LI,q.LISTING,q.MENU,q.META,q.NOBR,q.OL,q.P,q.PRE,q.RUBY,q.S,q.SMALL,q.SPAN,q.STRONG,q.STRIKE,q.SUB,q.SUP,q.TABLE,q.TT,q.U,q.UL,q.VAR]);function cu(e){let t=e.tagID;return t===q.FONT&&e.attrs.some(({name:e})=>e===ul.COLOR||e===ul.SIZE||e===ul.FACE)||su.has(t)}function lu(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===nu){e.attrs[t].name=ru;break}}function uu(e){for(let t=0;t<e.attrs.length;t++){let n=iu.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function du(e){for(let t=0;t<e.attrs.length;t++){let n=au.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}function fu(e){let t=ou.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=fl(e.tagName))}function pu(e,t){return t===W.MATHML&&(e===q.MI||e===q.MO||e===q.MN||e===q.MS||e===q.MTEXT)}function mu(e,t,n){if(t===W.MATHML&&e===q.ANNOTATION_XML){for(let e=0;e<n.length;e++)if(n[e].name===ul.ENCODING){let t=n[e].value.toLowerCase();return t===tu.TEXT_HTML||t===tu.APPLICATION_XML}}return t===W.SVG&&(e===q.FOREIGN_OBJECT||e===q.DESC||e===q.TITLE)}function hu(e,t,n,r){return(!r||r===W.HTML)&&mu(e,t,n)||(!r||r===W.MATHML)&&pu(e,t)}var gu=`hidden`,_u=8,vu=3,Z;(function(e){e[e.INITIAL=0]=`INITIAL`,e[e.BEFORE_HTML=1]=`BEFORE_HTML`,e[e.BEFORE_HEAD=2]=`BEFORE_HEAD`,e[e.IN_HEAD=3]=`IN_HEAD`,e[e.IN_HEAD_NO_SCRIPT=4]=`IN_HEAD_NO_SCRIPT`,e[e.AFTER_HEAD=5]=`AFTER_HEAD`,e[e.IN_BODY=6]=`IN_BODY`,e[e.TEXT=7]=`TEXT`,e[e.IN_TABLE=8]=`IN_TABLE`,e[e.IN_TABLE_TEXT=9]=`IN_TABLE_TEXT`,e[e.IN_CAPTION=10]=`IN_CAPTION`,e[e.IN_COLUMN_GROUP=11]=`IN_COLUMN_GROUP`,e[e.IN_TABLE_BODY=12]=`IN_TABLE_BODY`,e[e.IN_ROW=13]=`IN_ROW`,e[e.IN_CELL=14]=`IN_CELL`,e[e.IN_SELECT=15]=`IN_SELECT`,e[e.IN_SELECT_IN_TABLE=16]=`IN_SELECT_IN_TABLE`,e[e.IN_TEMPLATE=17]=`IN_TEMPLATE`,e[e.AFTER_BODY=18]=`AFTER_BODY`,e[e.IN_FRAMESET=19]=`IN_FRAMESET`,e[e.AFTER_FRAMESET=20]=`AFTER_FRAMESET`,e[e.AFTER_AFTER_BODY=21]=`AFTER_AFTER_BODY`,e[e.AFTER_AFTER_FRAMESET=22]=`AFTER_AFTER_FRAMESET`})(Z||={});var yu={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},bu=new Set([q.TABLE,q.TBODY,q.TFOOT,q.THEAD,q.TR]),xu={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:Ul,onParseError:null},Su=class{constructor(e,t,n=null,r=null){this.fragmentContext=n,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=Z.INITIAL,this.originalInsertionMode=Z.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={...xu,...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 El(this.options,this),this.activeFormattingElements=new Hl(this.treeAdapter),this.fragmentContextID=n?fl(this.treeAdapter.getTagName(n)):q.UNKNOWN,this._setContextModes(n??this.document,this.fragmentContextID),this.openElements=new Rl(this.document,this.treeAdapter,this)}static parse(e,t){let n=new this(t);return n.tokenizer.write(e,!0),n.document}static getFragmentParser(e,t){let n={...xu,...t};e??=n.treeAdapter.createElement(K.TEMPLATE,W.HTML,[]);let r=n.treeAdapter.createElement(`documentmock`,W.HTML,[]),i=new this(n,r,e);return i.fragmentContextID===q.TEMPLATE&&i.tmplInsertionModeStack.unshift(Z.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){let e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,n){if(!this.onParseError)return;let r=e.location??yu,i={code:t,startLine:r.startLine,startCol:r.startCol,startOffset:r.startOffset,endLine:n?r.startLine:r.endLine,endCol:n?r.startCol:r.endCol,endOffset:n?r.startOffset:r.endOffset};this.onParseError(i)}onItemPush(e,t,n){var r,i;(i=(r=this.treeAdapter).onItemPush)==null||i.call(r,e),n&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(r=(n=this.treeAdapter).onItemPop)==null||r.call(n,e,this.openElements.current),t){let e,t;this.openElements.stackTop===0&&this.fragmentContext?(e=this.fragmentContext,t=this.fragmentContextID):{current:e,currentTagId:t}=this.openElements,this._setContextModes(e,t)}}_setContextModes(e,t){let n=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===W.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&e!==void 0&&t!==void 0&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,W.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=Z.TEXT}switchToPlaintextParsing(){this.insertionMode=Z.TEXT,this.originalInsertionMode=Z.IN_BODY,this.tokenizer.state=X.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)===K.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==W.HTML))switch(this.fragmentContextID){case q.TITLE:case q.TEXTAREA:this.tokenizer.state=X.RCDATA;break;case q.STYLE:case q.XMP:case q.IFRAME:case q.NOEMBED:case q.NOFRAMES:case q.NOSCRIPT:this.tokenizer.state=X.RAWTEXT;break;case q.SCRIPT:this.tokenizer.state=X.SCRIPT_DATA;break;case q.PLAINTEXT:this.tokenizer.state=X.PLAINTEXT;break;default:}}_setDocumentType(e){let t=e.name||``,n=e.publicId||``,r=e.systemId||``;if(this.treeAdapter.setDocumentType(this.document,t,n,r),e.location){let t=this.treeAdapter.getChildNodes(this.document).find(e=>this.treeAdapter.isDocumentTypeNode(e));t&&this.treeAdapter.setNodeSourceCodeLocation(t,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){let n=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{let t=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(t??this.document,e)}}_appendElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location)}_insertElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID)}_insertFakeElement(e,t){let n=this.treeAdapter.createElement(e,W.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,t)}_insertTemplate(e){let t=this.treeAdapter.createElement(e.tagName,W.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){let e=this.treeAdapter.createElement(K.HTML,W.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,q.HTML)}_appendCommentNode(e,t){let n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,e.location)}_insertCharacters(e){let t,n;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(t,e.chars,n):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;let r=this.treeAdapter.getChildNodes(t),i=r[(n?r.lastIndexOf(n):r.length)-1];if(this.treeAdapter.getNodeSourceCodeLocation(i)){let{endLine:t,endCol:n,endOffset:r}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(i,{endLine:t,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,e.location)}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){let n=t.location,r=this.treeAdapter.getTagName(e),i=t.type===U.END_TAG&&r===t.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,i)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,n;return this.openElements.stackTop===0&&this.fragmentContext?(t=this.fragmentContext,n=this.fragmentContextID):{current:t,currentTagId:n}=this.openElements,e.tagID===q.SVG&&this.treeAdapter.getTagName(t)===K.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===W.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===q.MGLYPH||e.tagID===q.MALIGNMARK)&&n!==void 0&&!this._isIntegrationPoint(n,t,W.HTML)}_processToken(e){switch(e.type){case U.CHARACTER:this.onCharacter(e);break;case U.NULL_CHARACTER:this.onNullCharacter(e);break;case U.COMMENT:this.onComment(e);break;case U.DOCTYPE:this.onDoctype(e);break;case U.START_TAG:this._processStartTag(e);break;case U.END_TAG:this.onEndTag(e);break;case U.EOF:this.onEof(e);break;case U.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e);break}}_isIntegrationPoint(e,t,n){return hu(e,this.treeAdapter.getNamespaceURI(t),this.treeAdapter.getAttrList(t),n)}_reconstructActiveFormattingElements(){let e=this.activeFormattingElements.entries.length;if(e){let t=this.activeFormattingElements.entries.findIndex(e=>e.type===Bl.Marker||this.openElements.contains(e.element)),n=t===-1?e-1:t-1;for(let e=n;e>=0;e--){let t=this.activeFormattingElements.entries[e];this._insertElement(t.token,this.treeAdapter.getNamespaceURI(t.element)),t.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=Z.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(q.P),this.openElements.popUntilTagNamePopped(q.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case q.TR:this.insertionMode=Z.IN_ROW;return;case q.TBODY:case q.THEAD:case q.TFOOT:this.insertionMode=Z.IN_TABLE_BODY;return;case q.CAPTION:this.insertionMode=Z.IN_CAPTION;return;case q.COLGROUP:this.insertionMode=Z.IN_COLUMN_GROUP;return;case q.TABLE:this.insertionMode=Z.IN_TABLE;return;case q.BODY:this.insertionMode=Z.IN_BODY;return;case q.FRAMESET:this.insertionMode=Z.IN_FRAMESET;return;case q.SELECT:this._resetInsertionModeForSelect(e);return;case q.TEMPLATE:this.insertionMode=this.tmplInsertionModeStack[0];return;case q.HTML:this.insertionMode=this.headElement?Z.AFTER_HEAD:Z.BEFORE_HEAD;return;case q.TD:case q.TH:if(e>0){this.insertionMode=Z.IN_CELL;return}break;case q.HEAD:if(e>0){this.insertionMode=Z.IN_HEAD;return}break}this.insertionMode=Z.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){let e=this.openElements.tagIDs[t];if(e===q.TEMPLATE)break;if(e===q.TABLE){this.insertionMode=Z.IN_SELECT_IN_TABLE;return}}this.insertionMode=Z.IN_SELECT}_isElementCausesFosterParenting(e){return bu.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){let t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case q.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===W.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case q.TABLE:{let n=this.treeAdapter.getParentNode(t);return n?{parent:n,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}default:}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){let t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){return pl[this.treeAdapter.getNamespaceURI(e)].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){zf(this,e);return}switch(this.insertionMode){case Z.INITIAL:Fu(this,e);break;case Z.BEFORE_HTML:Ru(this,e);break;case Z.BEFORE_HEAD:Vu(this,e);break;case Z.IN_HEAD:Wu(this,e);break;case Z.IN_HEAD_NO_SCRIPT:qu(this,e);break;case Z.AFTER_HEAD:Xu(this,e);break;case Z.IN_BODY:case Z.IN_CAPTION:case Z.IN_CELL:case Z.IN_TEMPLATE:$u(this,e);break;case Z.TEXT:case Z.IN_SELECT:case Z.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case Z.IN_TABLE:case Z.IN_TABLE_BODY:case Z.IN_ROW:qd(this,e);break;case Z.IN_TABLE_TEXT:sf(this,e);break;case Z.IN_COLUMN_GROUP:mf(this,e);break;case Z.AFTER_BODY:Af(this,e);break;case Z.AFTER_AFTER_BODY:If(this,e);break;default:}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Rf(this,e);return}switch(this.insertionMode){case Z.INITIAL:Fu(this,e);break;case Z.BEFORE_HTML:Ru(this,e);break;case Z.BEFORE_HEAD:Vu(this,e);break;case Z.IN_HEAD:Wu(this,e);break;case Z.IN_HEAD_NO_SCRIPT:qu(this,e);break;case Z.AFTER_HEAD:Xu(this,e);break;case Z.TEXT:this._insertCharacters(e);break;case Z.IN_TABLE:case Z.IN_TABLE_BODY:case Z.IN_ROW:qd(this,e);break;case Z.IN_COLUMN_GROUP:mf(this,e);break;case Z.AFTER_BODY:Af(this,e);break;case Z.AFTER_AFTER_BODY:If(this,e);break;default:}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){Au(this,e);return}switch(this.insertionMode){case Z.INITIAL:case Z.BEFORE_HTML:case Z.BEFORE_HEAD:case Z.IN_HEAD:case Z.IN_HEAD_NO_SCRIPT:case Z.AFTER_HEAD:case Z.IN_BODY:case Z.IN_TABLE:case Z.IN_CAPTION:case Z.IN_COLUMN_GROUP:case Z.IN_TABLE_BODY:case Z.IN_ROW:case Z.IN_CELL:case Z.IN_SELECT:case Z.IN_SELECT_IN_TABLE:case Z.IN_TEMPLATE:case Z.IN_FRAMESET:case Z.AFTER_FRAMESET:Au(this,e);break;case Z.IN_TABLE_TEXT:cf(this,e);break;case Z.AFTER_BODY:ju(this,e);break;case Z.AFTER_AFTER_BODY:case Z.AFTER_AFTER_FRAMESET:Mu(this,e);break;default:}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case Z.INITIAL:Pu(this,e);break;case Z.BEFORE_HEAD:case Z.IN_HEAD:case Z.IN_HEAD_NO_SCRIPT:case Z.AFTER_HEAD:this._err(e,H.misplacedDoctype);break;case Z.IN_TABLE_TEXT:cf(this,e);break;default:}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,H.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?Vf(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case Z.INITIAL:Fu(this,e);break;case Z.BEFORE_HTML:Iu(this,e);break;case Z.BEFORE_HEAD:zu(this,e);break;case Z.IN_HEAD:Q(this,e);break;case Z.IN_HEAD_NO_SCRIPT:Gu(this,e);break;case Z.AFTER_HEAD:Ju(this,e);break;case Z.IN_BODY:$(this,e);break;case Z.IN_TABLE:nf(this,e);break;case Z.IN_TABLE_TEXT:cf(this,e);break;case Z.IN_CAPTION:uf(this,e);break;case Z.IN_COLUMN_GROUP:ff(this,e);break;case Z.IN_TABLE_BODY:hf(this,e);break;case Z.IN_ROW:_f(this,e);break;case Z.IN_CELL:yf(this,e);break;case Z.IN_SELECT:xf(this,e);break;case Z.IN_SELECT_IN_TABLE:Cf(this,e);break;case Z.IN_TEMPLATE:Tf(this,e);break;case Z.AFTER_BODY:Of(this,e);break;case Z.IN_FRAMESET:jf(this,e);break;case Z.AFTER_FRAMESET:Nf(this,e);break;case Z.AFTER_AFTER_BODY:Ff(this,e);break;case Z.AFTER_AFTER_FRAMESET:Lf(this,e);break;default:}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?Hf(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case Z.INITIAL:Fu(this,e);break;case Z.BEFORE_HTML:Lu(this,e);break;case Z.BEFORE_HEAD:Bu(this,e);break;case Z.IN_HEAD:Hu(this,e);break;case Z.IN_HEAD_NO_SCRIPT:Ku(this,e);break;case Z.AFTER_HEAD:Yu(this,e);break;case Z.IN_BODY:Ud(this,e);break;case Z.TEXT:Gd(this,e);break;case Z.IN_TABLE:rf(this,e);break;case Z.IN_TABLE_TEXT:cf(this,e);break;case Z.IN_CAPTION:df(this,e);break;case Z.IN_COLUMN_GROUP:pf(this,e);break;case Z.IN_TABLE_BODY:gf(this,e);break;case Z.IN_ROW:vf(this,e);break;case Z.IN_CELL:bf(this,e);break;case Z.IN_SELECT:Sf(this,e);break;case Z.IN_SELECT_IN_TABLE:wf(this,e);break;case Z.IN_TEMPLATE:Ef(this,e);break;case Z.AFTER_BODY:kf(this,e);break;case Z.IN_FRAMESET:Mf(this,e);break;case Z.AFTER_FRAMESET:Pf(this,e);break;case Z.AFTER_AFTER_BODY:If(this,e);break;default:}}onEof(e){switch(this.insertionMode){case Z.INITIAL:Fu(this,e);break;case Z.BEFORE_HTML:Ru(this,e);break;case Z.BEFORE_HEAD:Vu(this,e);break;case Z.IN_HEAD:Wu(this,e);break;case Z.IN_HEAD_NO_SCRIPT:qu(this,e);break;case Z.AFTER_HEAD:Xu(this,e);break;case Z.IN_BODY:case Z.IN_TABLE:case Z.IN_CAPTION:case Z.IN_COLUMN_GROUP:case Z.IN_TABLE_BODY:case Z.IN_ROW:case Z.IN_CELL:case Z.IN_SELECT:case Z.IN_SELECT_IN_TABLE:Wd(this,e);break;case Z.TEXT:Kd(this,e);break;case Z.IN_TABLE_TEXT:cf(this,e);break;case Z.IN_TEMPLATE:Df(this,e);break;case Z.AFTER_BODY:case Z.IN_FRAMESET:case Z.AFTER_FRAMESET:case Z.AFTER_AFTER_BODY:case Z.AFTER_AFTER_FRAMESET:Nu(this,e);break;default:}}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 Z.IN_HEAD:case Z.IN_HEAD_NO_SCRIPT:case Z.AFTER_HEAD:case Z.TEXT:case Z.IN_COLUMN_GROUP:case Z.IN_SELECT:case Z.IN_SELECT_IN_TABLE:case Z.IN_FRAMESET:case Z.AFTER_FRAMESET:this._insertCharacters(e);break;case Z.IN_BODY:case Z.IN_CAPTION:case Z.IN_CELL:case Z.IN_TEMPLATE:case Z.AFTER_BODY:case Z.AFTER_AFTER_BODY:case Z.AFTER_AFTER_FRAMESET:Qu(this,e);break;case Z.IN_TABLE:case Z.IN_TABLE_BODY:case Z.IN_ROW:qd(this,e);break;case Z.IN_TABLE_TEXT:of(this,e);break;default:}}};function Cu(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):Hd(e,t),n}function wu(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){let i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function Tu(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let a=0,o=i;o!==n;a++,o=i){i=e.openElements.getCommonAncestor(o);let n=e.activeFormattingElements.getElementEntry(o),s=n&&a>=vu;!n||s?(s&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(o)):(o=Eu(e,n),r===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}function Eu(e,t){let n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function Du(e,t,n){let r=fl(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{let i=e.treeAdapter.getNamespaceURI(t);r===q.TEMPLATE&&i===W.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function Ou(e,t,n){let r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,a=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,a,i.tagID)}function ku(e,t){for(let n=0;n<_u;n++){let n=Cu(e,t);if(!n)break;let r=wu(e,n);if(!r)break;e.activeFormattingElements.bookmark=n;let i=Tu(e,r,n.element),a=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(i),a&&Du(e,a,i),Ou(e,r,n)}}function Au(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function ju(e,t){e._appendCommentNode(t,e.openElements.items[0])}function Mu(e,t){e._appendCommentNode(t,e.document)}function Nu(e,t){if(e.stopped=!0,t.location){let n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let n=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){let n=e.openElements.items[1],r=e.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&e._setEndLocation(n,t)}}}}function Pu(e,t){e._setDocumentType(t);let n=t.forceQuirks?G.QUIRKS:eu(t);$l(t)||e._err(t,H.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=Z.BEFORE_HTML}function Fu(e,t){e._err(t,H.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,G.QUIRKS),e.insertionMode=Z.BEFORE_HTML,e._processToken(t)}function Iu(e,t){t.tagID===q.HTML?(e._insertElement(t,W.HTML),e.insertionMode=Z.BEFORE_HEAD):Ru(e,t)}function Lu(e,t){let n=t.tagID;(n===q.HTML||n===q.HEAD||n===q.BODY||n===q.BR)&&Ru(e,t)}function Ru(e,t){e._insertFakeRootElement(),e.insertionMode=Z.BEFORE_HEAD,e._processToken(t)}function zu(e,t){switch(t.tagID){case q.HTML:$(e,t);break;case q.HEAD:e._insertElement(t,W.HTML),e.headElement=e.openElements.current,e.insertionMode=Z.IN_HEAD;break;default:Vu(e,t)}}function Bu(e,t){let n=t.tagID;n===q.HEAD||n===q.BODY||n===q.HTML||n===q.BR?Vu(e,t):e._err(t,H.endTagWithoutMatchingOpenElement)}function Vu(e,t){e._insertFakeElement(K.HEAD,q.HEAD),e.headElement=e.openElements.current,e.insertionMode=Z.IN_HEAD,e._processToken(t)}function Q(e,t){switch(t.tagID){case q.HTML:$(e,t);break;case q.BASE:case q.BASEFONT:case q.BGSOUND:case q.LINK:case q.META:e._appendElement(t,W.HTML),t.ackSelfClosing=!0;break;case q.TITLE:e._switchToTextParsing(t,X.RCDATA);break;case q.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,X.RAWTEXT):(e._insertElement(t,W.HTML),e.insertionMode=Z.IN_HEAD_NO_SCRIPT);break;case q.NOFRAMES:case q.STYLE:e._switchToTextParsing(t,X.RAWTEXT);break;case q.SCRIPT:e._switchToTextParsing(t,X.SCRIPT_DATA);break;case q.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=Z.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(Z.IN_TEMPLATE);break;case q.HEAD:e._err(t,H.misplacedStartTagForHeadElement);break;default:Wu(e,t)}}function Hu(e,t){switch(t.tagID){case q.HEAD:e.openElements.pop(),e.insertionMode=Z.AFTER_HEAD;break;case q.BODY:case q.BR:case q.HTML:Wu(e,t);break;case q.TEMPLATE:Uu(e,t);break;default:e._err(t,H.endTagWithoutMatchingOpenElement)}}function Uu(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==q.TEMPLATE&&e._err(t,H.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(q.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,H.endTagWithoutMatchingOpenElement)}function Wu(e,t){e.openElements.pop(),e.insertionMode=Z.AFTER_HEAD,e._processToken(t)}function Gu(e,t){switch(t.tagID){case q.HTML:$(e,t);break;case q.BASEFONT:case q.BGSOUND:case q.HEAD:case q.LINK:case q.META:case q.NOFRAMES:case q.STYLE:Q(e,t);break;case q.NOSCRIPT:e._err(t,H.nestedNoscriptInHead);break;default:qu(e,t)}}function Ku(e,t){switch(t.tagID){case q.NOSCRIPT:e.openElements.pop(),e.insertionMode=Z.IN_HEAD;break;case q.BR:qu(e,t);break;default:e._err(t,H.endTagWithoutMatchingOpenElement)}}function qu(e,t){let n=t.type===U.EOF?H.openElementsLeftAfterEof:H.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=Z.IN_HEAD,e._processToken(t)}function Ju(e,t){switch(t.tagID){case q.HTML:$(e,t);break;case q.BODY:e._insertElement(t,W.HTML),e.framesetOk=!1,e.insertionMode=Z.IN_BODY;break;case q.FRAMESET:e._insertElement(t,W.HTML),e.insertionMode=Z.IN_FRAMESET;break;case q.BASE:case q.BASEFONT:case q.BGSOUND:case q.LINK:case q.META:case q.NOFRAMES:case q.SCRIPT:case q.STYLE:case q.TEMPLATE:case q.TITLE:e._err(t,H.abandonedHeadElementChild),e.openElements.push(e.headElement,q.HEAD),Q(e,t),e.openElements.remove(e.headElement);break;case q.HEAD:e._err(t,H.misplacedStartTagForHeadElement);break;default:Xu(e,t)}}function Yu(e,t){switch(t.tagID){case q.BODY:case q.HTML:case q.BR:Xu(e,t);break;case q.TEMPLATE:Uu(e,t);break;default:e._err(t,H.endTagWithoutMatchingOpenElement)}}function Xu(e,t){e._insertFakeElement(K.BODY,q.BODY),e.insertionMode=Z.IN_BODY,Zu(e,t)}function Zu(e,t){switch(t.type){case U.CHARACTER:$u(e,t);break;case U.WHITESPACE_CHARACTER:Qu(e,t);break;case U.COMMENT:Au(e,t);break;case U.START_TAG:$(e,t);break;case U.END_TAG:Ud(e,t);break;case U.EOF:Wd(e,t);break;default:}}function Qu(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function $u(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function ed(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function td(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function nd(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,W.HTML),e.insertionMode=Z.IN_FRAMESET)}function rd(e,t){e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,W.HTML)}function id(e,t){e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&ml.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,W.HTML)}function ad(e,t){e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,W.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function od(e,t){let n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,W.HTML),n||(e.formElement=e.openElements.current))}function sd(e,t){e.framesetOk=!1;let n=t.tagID;for(let t=e.openElements.stackTop;t>=0;t--){let r=e.openElements.tagIDs[t];if(n===q.LI&&r===q.LI||(n===q.DD||n===q.DT)&&(r===q.DD||r===q.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==q.ADDRESS&&r!==q.DIV&&r!==q.P&&e._isSpecialElement(e.openElements.items[t],r))break}e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,W.HTML)}function cd(e,t){e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,W.HTML),e.tokenizer.state=X.PLAINTEXT}function ld(e,t){e.openElements.hasInScope(q.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(q.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,W.HTML),e.framesetOk=!1}function ud(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(K.A);n&&(ku(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,W.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function dd(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,W.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function fd(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(q.NOBR)&&(ku(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,W.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function pd(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,W.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function md(e,t){e.treeAdapter.getDocumentMode(e.document)!==G.QUIRKS&&e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._insertElement(t,W.HTML),e.framesetOk=!1,e.insertionMode=Z.IN_TABLE}function hd(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,W.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function gd(e){let t=ll(e,ul.TYPE);return t!=null&&t.toLowerCase()===gu}function _d(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,W.HTML),gd(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function vd(e,t){e._appendElement(t,W.HTML),t.ackSelfClosing=!0}function yd(e,t){e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._appendElement(t,W.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function bd(e,t){t.tagName=K.IMG,t.tagID=q.IMG,hd(e,t)}function xd(e,t){e._insertElement(t,W.HTML),e.skipNextNewLine=!0,e.tokenizer.state=X.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=Z.TEXT}function Sd(e,t){e.openElements.hasInButtonScope(q.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,X.RAWTEXT)}function Cd(e,t){e.framesetOk=!1,e._switchToTextParsing(t,X.RAWTEXT)}function wd(e,t){e._switchToTextParsing(t,X.RAWTEXT)}function Td(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,W.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===Z.IN_TABLE||e.insertionMode===Z.IN_CAPTION||e.insertionMode===Z.IN_TABLE_BODY||e.insertionMode===Z.IN_ROW||e.insertionMode===Z.IN_CELL?Z.IN_SELECT_IN_TABLE:Z.IN_SELECT}function Ed(e,t){e.openElements.currentTagId===q.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,W.HTML)}function Dd(e,t){e.openElements.hasInScope(q.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,W.HTML)}function Od(e,t){e.openElements.hasInScope(q.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(q.RTC),e._insertElement(t,W.HTML)}function kd(e,t){e._reconstructActiveFormattingElements(),lu(t),du(t),t.selfClosing?e._appendElement(t,W.MATHML):e._insertElement(t,W.MATHML),t.ackSelfClosing=!0}function Ad(e,t){e._reconstructActiveFormattingElements(),uu(t),du(t),t.selfClosing?e._appendElement(t,W.SVG):e._insertElement(t,W.SVG),t.ackSelfClosing=!0}function jd(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,W.HTML)}function $(e,t){switch(t.tagID){case q.I:case q.S:case q.B:case q.U:case q.EM:case q.TT:case q.BIG:case q.CODE:case q.FONT:case q.SMALL:case q.STRIKE:case q.STRONG:dd(e,t);break;case q.A:ud(e,t);break;case q.H1:case q.H2:case q.H3:case q.H4:case q.H5:case q.H6:id(e,t);break;case q.P:case q.DL:case q.OL:case q.UL:case q.DIV:case q.DIR:case q.NAV:case q.MAIN:case q.MENU:case q.ASIDE:case q.CENTER:case q.FIGURE:case q.FOOTER:case q.HEADER:case q.HGROUP:case q.DIALOG:case q.DETAILS:case q.ADDRESS:case q.ARTICLE:case q.SEARCH:case q.SECTION:case q.SUMMARY:case q.FIELDSET:case q.BLOCKQUOTE:case q.FIGCAPTION:rd(e,t);break;case q.LI:case q.DD:case q.DT:sd(e,t);break;case q.BR:case q.IMG:case q.WBR:case q.AREA:case q.EMBED:case q.KEYGEN:hd(e,t);break;case q.HR:yd(e,t);break;case q.RB:case q.RTC:Dd(e,t);break;case q.RT:case q.RP:Od(e,t);break;case q.PRE:case q.LISTING:ad(e,t);break;case q.XMP:Sd(e,t);break;case q.SVG:Ad(e,t);break;case q.HTML:ed(e,t);break;case q.BASE:case q.LINK:case q.META:case q.STYLE:case q.TITLE:case q.SCRIPT:case q.BGSOUND:case q.BASEFONT:case q.TEMPLATE:Q(e,t);break;case q.BODY:td(e,t);break;case q.FORM:od(e,t);break;case q.NOBR:fd(e,t);break;case q.MATH:kd(e,t);break;case q.TABLE:md(e,t);break;case q.INPUT:_d(e,t);break;case q.PARAM:case q.TRACK:case q.SOURCE:vd(e,t);break;case q.IMAGE:bd(e,t);break;case q.BUTTON:ld(e,t);break;case q.APPLET:case q.OBJECT:case q.MARQUEE:pd(e,t);break;case q.IFRAME:Cd(e,t);break;case q.SELECT:Td(e,t);break;case q.OPTION:case q.OPTGROUP:Ed(e,t);break;case q.NOEMBED:case q.NOFRAMES:wd(e,t);break;case q.FRAMESET:nd(e,t);break;case q.TEXTAREA:xd(e,t);break;case q.NOSCRIPT:e.options.scriptingEnabled?wd(e,t):jd(e,t);break;case q.PLAINTEXT:cd(e,t);break;case q.COL:case q.TH:case q.TD:case q.TR:case q.HEAD:case q.FRAME:case q.TBODY:case q.TFOOT:case q.THEAD:case q.CAPTION:case q.COLGROUP:break;default:jd(e,t)}}function Md(e,t){if(e.openElements.hasInScope(q.BODY)&&(e.insertionMode=Z.AFTER_BODY,e.options.sourceCodeLocationInfo)){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function Nd(e,t){e.openElements.hasInScope(q.BODY)&&(e.insertionMode=Z.AFTER_BODY,kf(e,t))}function Pd(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function Fd(e){let t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(q.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(q.FORM):n&&e.openElements.remove(n))}function Id(e){e.openElements.hasInButtonScope(q.P)||e._insertFakeElement(K.P,q.P),e._closePElement()}function Ld(e){e.openElements.hasInListItemScope(q.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(q.LI),e.openElements.popUntilTagNamePopped(q.LI))}function Rd(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function zd(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function Bd(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function Vd(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(K.BR,q.BR),e.openElements.pop(),e.framesetOk=!1}function Hd(e,t){let n=t.tagName,r=t.tagID;for(let t=e.openElements.stackTop;t>0;t--){let i=e.openElements.items[t],a=e.openElements.tagIDs[t];if(r===a&&(r!==q.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=t&&e.openElements.shortenToLength(t);break}if(e._isSpecialElement(i,a))break}}function Ud(e,t){switch(t.tagID){case q.A:case q.B:case q.I:case q.S:case q.U:case q.EM:case q.TT:case q.BIG:case q.CODE:case q.FONT:case q.NOBR:case q.SMALL:case q.STRIKE:case q.STRONG:ku(e,t);break;case q.P:Id(e);break;case q.DL:case q.UL:case q.OL:case q.DIR:case q.DIV:case q.NAV:case q.PRE:case q.MAIN:case q.MENU:case q.ASIDE:case q.BUTTON:case q.CENTER:case q.FIGURE:case q.FOOTER:case q.HEADER:case q.HGROUP:case q.DIALOG:case q.ADDRESS:case q.ARTICLE:case q.DETAILS:case q.SEARCH:case q.SECTION:case q.SUMMARY:case q.LISTING:case q.FIELDSET:case q.BLOCKQUOTE:case q.FIGCAPTION:Pd(e,t);break;case q.LI:Ld(e);break;case q.DD:case q.DT:Rd(e,t);break;case q.H1:case q.H2:case q.H3:case q.H4:case q.H5:case q.H6:zd(e);break;case q.BR:Vd(e);break;case q.BODY:Md(e,t);break;case q.HTML:Nd(e,t);break;case q.FORM:Fd(e);break;case q.APPLET:case q.OBJECT:case q.MARQUEE:Bd(e,t);break;case q.TEMPLATE:Uu(e,t);break;default:Hd(e,t)}}function Wd(e,t){e.tmplInsertionModeStack.length>0?Df(e,t):Nu(e,t)}function Gd(e,t){var n;t.tagID===q.SCRIPT&&((n=e.scriptHandler)==null||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function Kd(e,t){e._err(t,H.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function qd(e,t){if(e.openElements.currentTagId!==void 0&&bu.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=Z.IN_TABLE_TEXT,t.type){case U.CHARACTER:sf(e,t);break;case U.WHITESPACE_CHARACTER:of(e,t);break}else af(e,t)}function Jd(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,W.HTML),e.insertionMode=Z.IN_CAPTION}function Yd(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,W.HTML),e.insertionMode=Z.IN_COLUMN_GROUP}function Xd(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(K.COLGROUP,q.COLGROUP),e.insertionMode=Z.IN_COLUMN_GROUP,ff(e,t)}function Zd(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,W.HTML),e.insertionMode=Z.IN_TABLE_BODY}function Qd(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(K.TBODY,q.TBODY),e.insertionMode=Z.IN_TABLE_BODY,hf(e,t)}function $d(e,t){e.openElements.hasInTableScope(q.TABLE)&&(e.openElements.popUntilTagNamePopped(q.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function ef(e,t){gd(t)?e._appendElement(t,W.HTML):af(e,t),t.ackSelfClosing=!0}function tf(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,W.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function nf(e,t){switch(t.tagID){case q.TD:case q.TH:case q.TR:Qd(e,t);break;case q.STYLE:case q.SCRIPT:case q.TEMPLATE:Q(e,t);break;case q.COL:Xd(e,t);break;case q.FORM:tf(e,t);break;case q.TABLE:$d(e,t);break;case q.TBODY:case q.TFOOT:case q.THEAD:Zd(e,t);break;case q.INPUT:ef(e,t);break;case q.CAPTION:Jd(e,t);break;case q.COLGROUP:Yd(e,t);break;default:af(e,t)}}function rf(e,t){switch(t.tagID){case q.TABLE:e.openElements.hasInTableScope(q.TABLE)&&(e.openElements.popUntilTagNamePopped(q.TABLE),e._resetInsertionMode());break;case q.TEMPLATE:Uu(e,t);break;case q.BODY:case q.CAPTION:case q.COL:case q.COLGROUP:case q.HTML:case q.TBODY:case q.TD:case q.TFOOT:case q.TH:case q.THEAD:case q.TR:break;default:af(e,t)}}function af(e,t){let n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,Zu(e,t),e.fosterParentingEnabled=n}function of(e,t){e.pendingCharacterTokens.push(t)}function sf(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function cf(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)af(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}var lf=new Set([q.CAPTION,q.COL,q.COLGROUP,q.TBODY,q.TD,q.TFOOT,q.TH,q.THEAD,q.TR]);function uf(e,t){let n=t.tagID;lf.has(n)?e.openElements.hasInTableScope(q.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(q.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Z.IN_TABLE,nf(e,t)):$(e,t)}function df(e,t){let n=t.tagID;switch(n){case q.CAPTION:case q.TABLE:e.openElements.hasInTableScope(q.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(q.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Z.IN_TABLE,n===q.TABLE&&rf(e,t));break;case q.BODY:case q.COL:case q.COLGROUP:case q.HTML:case q.TBODY:case q.TD:case q.TFOOT:case q.TH:case q.THEAD:case q.TR:break;default:Ud(e,t)}}function ff(e,t){switch(t.tagID){case q.HTML:$(e,t);break;case q.COL:e._appendElement(t,W.HTML),t.ackSelfClosing=!0;break;case q.TEMPLATE:Q(e,t);break;default:mf(e,t)}}function pf(e,t){switch(t.tagID){case q.COLGROUP:e.openElements.currentTagId===q.COLGROUP&&(e.openElements.pop(),e.insertionMode=Z.IN_TABLE);break;case q.TEMPLATE:Uu(e,t);break;case q.COL:break;default:mf(e,t)}}function mf(e,t){e.openElements.currentTagId===q.COLGROUP&&(e.openElements.pop(),e.insertionMode=Z.IN_TABLE,e._processToken(t))}function hf(e,t){switch(t.tagID){case q.TR:e.openElements.clearBackToTableBodyContext(),e._insertElement(t,W.HTML),e.insertionMode=Z.IN_ROW;break;case q.TH:case q.TD:e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(K.TR,q.TR),e.insertionMode=Z.IN_ROW,_f(e,t);break;case q.CAPTION:case q.COL:case q.COLGROUP:case q.TBODY:case q.TFOOT:case q.THEAD:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE,nf(e,t));break;default:nf(e,t)}}function gf(e,t){let n=t.tagID;switch(t.tagID){case q.TBODY:case q.TFOOT:case q.THEAD:e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE);break;case q.TABLE:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE,rf(e,t));break;case q.BODY:case q.CAPTION:case q.COL:case q.COLGROUP:case q.HTML:case q.TD:case q.TH:case q.TR:break;default:rf(e,t)}}function _f(e,t){switch(t.tagID){case q.TH:case q.TD:e.openElements.clearBackToTableRowContext(),e._insertElement(t,W.HTML),e.insertionMode=Z.IN_CELL,e.activeFormattingElements.insertMarker();break;case q.CAPTION:case q.COL:case q.COLGROUP:case q.TBODY:case q.TFOOT:case q.THEAD:case q.TR:e.openElements.hasInTableScope(q.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE_BODY,hf(e,t));break;default:nf(e,t)}}function vf(e,t){switch(t.tagID){case q.TR:e.openElements.hasInTableScope(q.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE_BODY);break;case q.TABLE:e.openElements.hasInTableScope(q.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE_BODY,gf(e,t));break;case q.TBODY:case q.TFOOT:case q.THEAD:(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(q.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE_BODY,gf(e,t));break;case q.BODY:case q.CAPTION:case q.COL:case q.COLGROUP:case q.HTML:case q.TD:case q.TH:break;default:rf(e,t)}}function yf(e,t){let n=t.tagID;lf.has(n)?(e.openElements.hasInTableScope(q.TD)||e.openElements.hasInTableScope(q.TH))&&(e._closeTableCell(),_f(e,t)):$(e,t)}function bf(e,t){let n=t.tagID;switch(n){case q.TD:case q.TH:e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Z.IN_ROW);break;case q.TABLE:case q.TBODY:case q.TFOOT:case q.THEAD:case q.TR:e.openElements.hasInTableScope(n)&&(e._closeTableCell(),vf(e,t));break;case q.BODY:case q.CAPTION:case q.COL:case q.COLGROUP:case q.HTML:break;default:Ud(e,t)}}function xf(e,t){switch(t.tagID){case q.HTML:$(e,t);break;case q.OPTION:e.openElements.currentTagId===q.OPTION&&e.openElements.pop(),e._insertElement(t,W.HTML);break;case q.OPTGROUP:e.openElements.currentTagId===q.OPTION&&e.openElements.pop(),e.openElements.currentTagId===q.OPTGROUP&&e.openElements.pop(),e._insertElement(t,W.HTML);break;case q.HR:e.openElements.currentTagId===q.OPTION&&e.openElements.pop(),e.openElements.currentTagId===q.OPTGROUP&&e.openElements.pop(),e._appendElement(t,W.HTML),t.ackSelfClosing=!0;break;case q.INPUT:case q.KEYGEN:case q.TEXTAREA:case q.SELECT:e.openElements.hasInSelectScope(q.SELECT)&&(e.openElements.popUntilTagNamePopped(q.SELECT),e._resetInsertionMode(),t.tagID!==q.SELECT&&e._processStartTag(t));break;case q.SCRIPT:case q.TEMPLATE:Q(e,t);break;default:}}function Sf(e,t){switch(t.tagID){case q.OPTGROUP:e.openElements.stackTop>0&&e.openElements.currentTagId===q.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===q.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===q.OPTGROUP&&e.openElements.pop();break;case q.OPTION:e.openElements.currentTagId===q.OPTION&&e.openElements.pop();break;case q.SELECT:e.openElements.hasInSelectScope(q.SELECT)&&(e.openElements.popUntilTagNamePopped(q.SELECT),e._resetInsertionMode());break;case q.TEMPLATE:Uu(e,t);break;default:}}function Cf(e,t){let n=t.tagID;n===q.CAPTION||n===q.TABLE||n===q.TBODY||n===q.TFOOT||n===q.THEAD||n===q.TR||n===q.TD||n===q.TH?(e.openElements.popUntilTagNamePopped(q.SELECT),e._resetInsertionMode(),e._processStartTag(t)):xf(e,t)}function wf(e,t){let n=t.tagID;n===q.CAPTION||n===q.TABLE||n===q.TBODY||n===q.TFOOT||n===q.THEAD||n===q.TR||n===q.TD||n===q.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(q.SELECT),e._resetInsertionMode(),e.onEndTag(t)):Sf(e,t)}function Tf(e,t){switch(t.tagID){case q.BASE:case q.BASEFONT:case q.BGSOUND:case q.LINK:case q.META:case q.NOFRAMES:case q.SCRIPT:case q.STYLE:case q.TEMPLATE:case q.TITLE:Q(e,t);break;case q.CAPTION:case q.COLGROUP:case q.TBODY:case q.TFOOT:case q.THEAD:e.tmplInsertionModeStack[0]=Z.IN_TABLE,e.insertionMode=Z.IN_TABLE,nf(e,t);break;case q.COL:e.tmplInsertionModeStack[0]=Z.IN_COLUMN_GROUP,e.insertionMode=Z.IN_COLUMN_GROUP,ff(e,t);break;case q.TR:e.tmplInsertionModeStack[0]=Z.IN_TABLE_BODY,e.insertionMode=Z.IN_TABLE_BODY,hf(e,t);break;case q.TD:case q.TH:e.tmplInsertionModeStack[0]=Z.IN_ROW,e.insertionMode=Z.IN_ROW,_f(e,t);break;default:e.tmplInsertionModeStack[0]=Z.IN_BODY,e.insertionMode=Z.IN_BODY,$(e,t)}}function Ef(e,t){t.tagID===q.TEMPLATE&&Uu(e,t)}function Df(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(q.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):Nu(e,t)}function Of(e,t){t.tagID===q.HTML?$(e,t):Af(e,t)}function kf(e,t){if(t.tagID===q.HTML){if(e.fragmentContext||(e.insertionMode=Z.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===q.HTML){e._setEndLocation(e.openElements.items[0],t);let n=e.openElements.items[1];n&&!e.treeAdapter.getNodeSourceCodeLocation(n)?.endTag&&e._setEndLocation(n,t)}}else Af(e,t)}function Af(e,t){e.insertionMode=Z.IN_BODY,Zu(e,t)}function jf(e,t){switch(t.tagID){case q.HTML:$(e,t);break;case q.FRAMESET:e._insertElement(t,W.HTML);break;case q.FRAME:e._appendElement(t,W.HTML),t.ackSelfClosing=!0;break;case q.NOFRAMES:Q(e,t);break;default:}}function Mf(e,t){t.tagID===q.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==q.FRAMESET&&(e.insertionMode=Z.AFTER_FRAMESET))}function Nf(e,t){switch(t.tagID){case q.HTML:$(e,t);break;case q.NOFRAMES:Q(e,t);break;default:}}function Pf(e,t){t.tagID===q.HTML&&(e.insertionMode=Z.AFTER_AFTER_FRAMESET)}function Ff(e,t){t.tagID===q.HTML?$(e,t):If(e,t)}function If(e,t){e.insertionMode=Z.IN_BODY,Zu(e,t)}function Lf(e,t){switch(t.tagID){case q.HTML:$(e,t);break;case q.NOFRAMES:Q(e,t);break;default:}}function Rf(e,t){t.chars=`�`,e._insertCharacters(t)}function zf(e,t){e._insertCharacters(t),e.framesetOk=!1}function Bf(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==W.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function Vf(e,t){if(cu(t))Bf(e),e._startTagOutsideForeignContent(t);else{let n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===W.MATHML?lu(t):r===W.SVG&&(fu(t),uu(t)),du(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function Hf(e,t){if(t.tagID===q.P||t.tagID===q.BR){Bf(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){let r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===W.HTML){e._endTagOutsideForeignContent(t);break}let i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}var Uf=new Set([K.AREA,K.BASE,K.BASEFONT,K.BGSOUND,K.BR,K.COL,K.EMBED,K.FRAME,K.HR,K.IMG,K.INPUT,K.KEYGEN,K.LINK,K.META,K.PARAM,K.SOURCE,K.TRACK,K.WBR]);function Wf(e,t){return t.treeAdapter.isElementNode(e)&&t.treeAdapter.getNamespaceURI(e)===W.HTML&&Uf.has(t.treeAdapter.getTagName(e))}var Gf={treeAdapter:Ul,scriptingEnabled:!0};function Kf(e,t){let n={...Gf,...t};return Wf(e,n)?``:qf(e,n)}function qf(e,t){let n=``,r=t.treeAdapter.isElementNode(e)&&t.treeAdapter.getTagName(e)===K.TEMPLATE&&t.treeAdapter.getNamespaceURI(e)===W.HTML?t.treeAdapter.getTemplateContent(e):e,i=t.treeAdapter.getChildNodes(r);if(i)for(let e of i)n+=Jf(e,t);return n}function Jf(e,t){return t.treeAdapter.isElementNode(e)?Yf(e,t):t.treeAdapter.isTextNode(e)?Zf(e,t):t.treeAdapter.isCommentNode(e)?Qf(e,t):t.treeAdapter.isDocumentTypeNode(e)?$f(e,t):``}function Yf(e,t){let n=t.treeAdapter.getTagName(e);return`<${n}${Xf(e,t)}>${Wf(e,t)?``:`${qf(e,t)}</${n}>`}`}function Xf(e,{treeAdapter:t}){let n=``;for(let r of t.getAttrList(e)){if(n+=` `,r.namespace)switch(r.namespace){case W.XML:n+=`xml:${r.name}`;break;case W.XMLNS:r.name!==`xmlns`&&(n+=`xmlns:`),n+=r.name;break;case W.XLINK:n+=`xlink:${r.name}`;break;default:n+=`${r.prefix}:${r.name}`}else n+=r.name;n+=`="${Fi(r.value)}"`}return n}function Zf(e,t){let{treeAdapter:n}=t,r=n.getTextNodeContent(e),i=n.getParentNode(e),a=i&&n.isElementNode(i)&&n.getTagName(i);return a&&n.getNamespaceURI(i)===W.HTML&&gl(a,t.scriptingEnabled)?r:Ii(r)}function Qf(e,{treeAdapter:t}){return`<!--${t.getCommentNodeContent(e)}-->`}function $f(e,{treeAdapter:t}){return`<!DOCTYPE ${t.getDocumentTypeNodeName(e)}>`}function ep(e,t){return Su.parse(e,t)}function tp(e){return`attrs`in e&&`tagName`in e}function np(e){return tp(e)&&e.nodeName===`template`}function rp(e,t,n){e.attrs=e.attrs.filter(e=>e.name!==t),n!==void 0&&e.attrs.push({name:t,value:n})}function ip(e){if(tp(e)){rp(e,xn),rp(e,Sn);let t=e.sourceCodeLocation;t&&(rp(e,xn,String(t.startLine)),rp(e,Sn,String(t.endLine)))}if(`childNodes`in e)for(let t of e.childNodes)ip(t);np(e)&&ip(e.content)}function ap(e){let t=ep(e,{sourceCodeLocationInfo:!0});ip(t);let n=t.childNodes.find(e=>tp(e)&&e.tagName===`html`);return n&&rp(n,Cn,String(Mn(e))),Kf(t)}var op=[[`img`,`src`],[`script`,`src`],[`link[rel~="stylesheet" i]`,`href`],[`link[rel~="icon" i]`,`href`],[`source`,`src`],[`video`,`src`],[`video`,`poster`],[`audio`,`src`]],sp=[`img[srcset]`,`source[srcset]`],cp=20*1024*1024;async function lp(e,t,n,r,i,a,o,s){let c=new DOMParser().parseFromString(ap(n),`text/html`);if(i!==void 0){let e=c.createElement(`style`);e.textContent=`:where(html) { font-size: ${i}px; }`;let t=c.head??c.documentElement;t.insertBefore(e,t.firstChild)}Qc(c)&&await up(c);let l=[];for(let[n,i]of op)for(let o of c.querySelectorAll(n)){let n=dt(t,o.getAttribute(i)??``);n&&(o.removeAttribute(i),l.push(dp(e,n,r,a).then(e=>{e&&o.setAttribute(i,e)})))}for(let n of sp)for(let i of c.querySelectorAll(n)){let n=ft(i.getAttribute(`srcset`)??``),o=n.map(({ref:e})=>dt(t,e));o.some(e=>e!==null)&&(i.removeAttribute(`srcset`),l.push(Promise.all(n.map(async(t,n)=>{let i=o[n];if(!i)return t;let s=await dp(e,i,r,a);return s?{...t,ref:s}:null})).then(e=>{let t=e.filter(e=>e!==null);t.length>0&&i.setAttribute(`srcset`,ct(t))})))}return await Promise.all(l),o&&Bc(c,o),s&&Yc(c,s),`<!doctype html>${c.documentElement.outerHTML}`}async function up(e){let{default:t}=await v(async()=>{let{default:e}=await import(`./_virtual_katex-inline-css-DN-_JSKR.js`);return{default:e}},[]),n=e.createElement(`style`);n.textContent=`${t}\n${Bt}`,(e.head??e.documentElement).appendChild(n)}function dp(e,t,n,r){let i=n.get(t);if(i)return i;let a=wc(e,t,r).then(async e=>e.size>cp?null:`data:${fp(t,e.type)};base64,${pp(await e.arrayBuffer())}`).catch(()=>null);return n.set(t,a),a}function fp(e,t){let n=(e.split(`/`).pop()??``).split(`.`).pop()?.toLowerCase()??``;return n===`css`?`text/css`:n===`js`||n===`mjs`?`text/javascript`:t!==``&&t!==`application/octet-stream`?t:`application/octet-stream`}function pp(e){let t=new Uint8Array(e),n=``,r=32768;for(let e=0;e<t.length;e+=r)n+=String.fromCharCode(...t.subarray(e,e+r));return btoa(n)}function mp({session:e,path:t,text:n,root:r,scrollDriver:i=!1,scrollReceiver:a=!1,scrollChannel:o=`profile`,focused:s=!0,onRevealSource:c,mobile:l=!1}){let u=It(`html`,[e,r,t]),[d,f]=(0,E.useState)(null),p=(0,E.useRef)(new Map),m=h().editorFontSize,g=(0,E.useRef)(null),[_]=(0,E.useState)(Pc),[v]=(0,E.useState)(Pc),y=et({shortcutEnabled:s,onFind:(e,t,n)=>Kc(g.current?.contentWindow??null,v,e,t,n),onClear:()=>qc(g.current?.contentWindow??null,v),onCloseFocus:()=>g.current?.focus()}),b=(0,E.useMemo)(()=>({session:e,path:t,root:r}),[e,t,r]),x=(0,E.useMemo)(()=>Mn(n),[n]);return(0,E.useEffect)(()=>{let i=!1;return lp(e,t,n,p.current,m,r,_,v).then(e=>{i||f(e)}),()=>{i=!0}},[e,t,n,m,r,_,v,l]),(0,E.useEffect)(()=>{let e=e=>{let t=Gc(e,g.current?.contentWindow??null,v);t?.kind===`puddle-preview-find-open`?y.openFind():t?.kind===`puddle-preview-find-result`&&y.setResult(t)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[y.openFind,y.setResult,v]),(0,E.useEffect)(()=>{if(a)return Ln.subscribe(o,b,e=>{Rc(g.current?.contentWindow??null,_,e)})},[a,o,b,_]),(0,E.useEffect)(()=>{let e=e=>{let t=Ic(e,g.current?.contentWindow??null,_);if(t)if(t.layout&&(a||!t.scrolled)){let e=(a?Ln.get(o,b):void 0)??Rn.get(u);if(e&&Rc(g.current?.contentWindow??null,_,e),i){let n=e??t;Ln.publish(o,b,n.ratio,n.sourceLine)}}else Rn.set(u,{ratio:t.ratio,sourceLine:t.sourceLine,revision:0}),i&&Ln.publish(o,b,t.ratio,t.sourceLine);let n=c?Lc(e,g.current?.contentWindow??null,_):null;n&&c?.({line:Oc(n.line,x)})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[i,a,o,b,_,c,x,u]),d===null?null:(0,D.jsxs)(`div`,{className:`relative size-full bg-paper`,children:[(0,D.jsx)(`iframe`,{ref:g,sandbox:`allow-scripts`,src:l?`/preview.html`:void 0,srcDoc:l?void 0:d,title:t,className:`size-full bg-paper`,onLoad:()=>{let e=g.current;l&&e&&!e.dataset.delivered&&(e.dataset.delivered=`true`,e.contentWindow?.postMessage({kind:`puddle-preview-document`,html:d},`*`));{let e=(a?Ln.get(o,b):void 0)??Rn.get(u);e&&Rc(g.current?.contentWindow??null,_,e)}y.refresh()}},l?d:void 0),(0,D.jsx)(Dc,{controls:y})]})}function hp({kind:e,...t}){return e===`notebook`?(0,D.jsx)(_c,{...t}):e===`markdown`?(0,D.jsx)(kc,{...t}):(0,D.jsx)(mp,{...t})}function gp({session:e,path:t,kind:n,root:r,focused:i=!0,scrollDriver:a=!1,scrollReceiver:o=!1,scrollChannel:s=`profile`,onRevealSource:c,onRunCompilation:l,compilationRunning:u}){let{openFile:d}=Oe(),f=Zn(e,t,null,r,{passive:n!==`notebook`,live:!0,focused:i}),p=f.model,m=(0,E.useSyncExternalStore)(n=>kt(Ot(e,t,r),n),()=>p?.getValue()??null);return f.conflict&&f.conflict.phase!==`unresolved`?(0,D.jsx)(bn,{session:e,path:t,buffer:f,focused:i}):m===null?(0,D.jsx)(`p`,{className:`p-6 text-sm text-fg-muted`,children:f.status===`loading`?`Loading…`:f.errorMessage??`This file cannot be previewed.`}):n===`notebook`?(0,D.jsx)(_c,{session:e,path:t,root:r,text:m,onRun:l,running:u,onChange:e=>{let t=f.model;if(!t)return;let n=Lr(t.getValue(),e),r=t.getPositionAt(n.start),i=t.getPositionAt(n.end);t.pushStackElement(),t.pushEditOperations([],[{range:{startLineNumber:r.lineNumber,startColumn:r.column,endLineNumber:i.lineNumber,endColumn:i.column},text:n.text}],()=>null),t.pushStackElement()}}):(0,D.jsx)(hp,{session:e,path:t,kind:n,text:m,root:r,scrollDriver:a,scrollReceiver:o,scrollChannel:s,focused:i,onRevealSource:c,onOpenFile:t=>d(e,t,void 0,{...lt(t)?{view:`preview`}:{},...r===void 0?{}:{root:r}})})}var _p={png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,webp:`image`,bmp:`image`,ico:`image`,avif:`image`,svg:`image`,mp4:`video`,m4v:`video`,webm:`video`,mov:`video`,mkv:`video`,avi:`video`,mp3:`audio`,wav:`audio`,ogg:`audio`,m4a:`audio`,flac:`audio`,aac:`audio`,pdf:`pdf`};function vp(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0?null:_p[t.slice(n+1).toLowerCase()]??null}var yp=(0,E.lazy)(()=>v(()=>import(`./PdfViewer-DAAfA9OC.js`).then(e=>({default:e.PdfViewer})),__vite__mapDeps([0,1,2,3,4,5,6,7,8])));function bp({session:e,path:t,kind:n,root:r,generatedBy:i,refreshKey:a,onRevealSource:o,readOnly:s=!1}){let{asset:c,error:l}=Cp(e,t,r,Pe(e,t,r),a);if(l)return(0,D.jsxs)(xp,{children:[(0,D.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:l}),!s&&(0,D.jsx)(Sp,{session:e,path:t,root:r})]});if(!c)return(0,D.jsx)(xp,{children:(0,D.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`…`})});let{url:u,blob:d}=c;return n===`image`?(0,D.jsx)(xp,{children:(0,D.jsx)(`img`,{src:u,alt:t,className:`max-h-full max-w-full object-contain`})}):n===`video`?(0,D.jsx)(xp,{children:(0,D.jsx)(`video`,{src:u,controls:!0,className:`max-h-full max-w-full`})}):n===`audio`?(0,D.jsx)(xp,{children:(0,D.jsx)(`audio`,{src:u,controls:!0,className:`w-full max-w-xl`})}):(0,D.jsx)(E.Suspense,{fallback:(0,D.jsx)(xp,{children:(0,D.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Loading PDF…`})}),children:(0,D.jsx)(yp,{blob:d,session:e,path:t,root:r,onRevealSource:!s&&Tp(t,r,i)?o:void 0,onDownload:s?void 0:()=>void wp(e,t,r)})})}function xp({children:e}){return(0,D.jsx)(`div`,{className:`flex h-full w-full flex-col items-center justify-center gap-3 overflow-auto bg-ground p-4`,children:e})}function Sp({session:e,path:t,root:n}){return(0,D.jsx)(`button`,{type:`button`,onClick:()=>void wp(e,t,n),className:`rounded-md bg-elevated px-3 py-1.5 text-sm text-fg transition-colors hover:bg-border/70`,children:`Download`})}function Cp(e,t,n,r=0,i){let[a,o]=(0,E.useState)(null),[s,c]=(0,E.useState)(null);return(0,E.useEffect)(()=>{let r=null,i=!1;return o(null),c(null),wc(e,t,n).then(e=>{i||(r=URL.createObjectURL(e),o({url:r,blob:e}))}).catch(e=>{i||c(e instanceof Error?e.message:`Couldn’t load this file.`)}),()=>{i=!0,r&&URL.revokeObjectURL(r)}},[e,t,n,r,i]),{asset:a,error:s}}function wp(e,t,n){return ge(e,t,n).catch(e=>{re.error(e instanceof Error?e.message:`Download failed`)})}function Tp(e,t,n){if(!t||!e.toLowerCase().endsWith(`.pdf`))return!1;if(n===`latex`)return!0;let r=t.replaceAll(`\\`,`/`).replaceAll(/\/{2,}/g,`/`);return`${r}/${e.replaceAll(`\\`,`/`)}`.includes(`/.puddle/latex/`)||/(?:^|\/)latex\/[a-f\d]{24}\/current\/?$/i.test(r)}function Ep({tab:e,reveal:t,focused:n,scrollDriver:r,scrollReceiver:i,scrollChannel:a,onRevealSource:o,onRevealCompiledSource:s,onRunCompilation:c,compilationRunning:l}){let u=ut(e),d=e.view===`preview`||e.view===`linked`||e.view===`locked`,f=e.view===`linked`||e.view===`locked`?`${e.view}:${e.session}:${e.root??``}:${e.path}`:st(e);if(u===`diff`)return(0,D.jsx)(Tr,{session:e.session,path:e.path,root:e.root,area:e.git_area,focused:n},st(e));if(u===`commit`&&e.sha)return(0,D.jsx)(wr,{session:e.session,sha:e.sha,path:e.path,root:e.root},st(e));if(u===`external`&&e.root!==void 0){let u=vp(e.path);if(u)return(0,D.jsx)(bp,{session:e.session,path:e.path,kind:u,root:e.root,generatedBy:e.generated_by,onRevealSource:s},st(e));let p=d?lt(e.path):null;return p?(0,D.jsx)(gp,{session:e.session,path:e.path,kind:p,onRunCompilation:e.generated_by?void 0:c,compilationRunning:l,root:e.root,focused:n,scrollDriver:r,scrollReceiver:i,scrollChannel:a,onRevealSource:o},f):(0,D.jsx)(dr,{session:e.session,path:e.path,reveal:t,root:e.root,focused:n,scrollDriver:r,scrollReceiver:i,scrollChannel:a},st(e))}if(u===`untitled`)return(0,D.jsx)(Dr,{name:e.path},st(e));let p=vp(e.path);if(p)return(0,D.jsx)(bp,{session:e.session,path:e.path,kind:p,generatedBy:e.generated_by,onRevealSource:s},st(e));let m=d?lt(e.path):null;return m?(0,D.jsx)(gp,{session:e.session,path:e.path,kind:m,onRunCompilation:e.generated_by?void 0:c,compilationRunning:l,focused:n,scrollDriver:r,scrollReceiver:i,scrollChannel:a,onRevealSource:o},f):(0,D.jsx)(dr,{session:e.session,path:e.path,reveal:t,focused:n,scrollDriver:r,scrollReceiver:i,scrollChannel:a},st(e))}export{Ep as PaneEditorBody};
|