@puddle-code/cli 0.3.9 → 0.3.10

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +7 -11
  2. package/dist/host-control.mjs +228 -171
  3. package/dist/index.js +258 -200
  4. package/dist/public/assets/App-CNB4a07v.js +2 -0
  5. package/dist/public/assets/Dashboard-v3OproVW.js +1 -0
  6. package/dist/public/assets/{EditorTabClose-BolUnwz9.js → EditorTabClose-DwhahpvS.js} +1 -1
  7. package/dist/public/assets/{FindWidget-BUmuGtbd.js → FindWidget-CVH9U-_P.js} +1 -1
  8. package/dist/public/assets/{LazyTerminal-BRPy9Nm5.js → LazyTerminal-CgQryH0p.js} +2 -2
  9. package/dist/public/assets/{ModelRefcount-DdSmsCyg.js → ModelRefcount-njA_f4bS.js} +1 -1
  10. package/dist/public/assets/NewProjectDialog-BT8rR4yn.js +1 -0
  11. package/dist/public/assets/NotebookWidget-Cwd77EGL.js +7 -0
  12. package/dist/public/assets/PaneEditorBody-RaUBrZPu.js +303 -0
  13. package/dist/public/assets/PdfViewer-Bppu4-0-.js +2 -0
  14. package/dist/public/assets/SettingsDialog-CaHklYzG.js +8 -0
  15. package/dist/public/assets/{Terminal-WzMZyNl-.js → Terminal-_10Xyj1h.js} +5 -5
  16. package/dist/public/assets/Workspace-GgVr1uYN.js +20 -0
  17. package/dist/public/assets/_virtual_notebook-widget-runtime-Dro422xS.js +6966 -0
  18. package/dist/public/assets/api-i6xNY3bF.js +1 -0
  19. package/dist/public/assets/auth-GfOuXpIe.js +64 -0
  20. package/dist/public/assets/{buffer-store-BcKRO2bQ.js → buffer-store-eMnMxbpI.js} +1 -1
  21. package/dist/public/assets/{button-Chvl9hcE.js → button-BgeBH2Uc.js} +1 -1
  22. package/dist/public/assets/{command-CaE1P1RF.js → command-D7m0dmA-.js} +1 -1
  23. package/dist/public/assets/context-DW21k43a.js +1 -0
  24. package/dist/public/assets/{context-menu-BTe3xVbd.js → context-menu-CMWkmDu6.js} +1 -1
  25. package/dist/public/assets/dialog-BMWRC2HO.js +41 -0
  26. package/dist/public/assets/disclosure-CHXbNzgZ.js +1 -0
  27. package/dist/public/assets/dist-BOS6OKSE.js +1 -0
  28. package/dist/public/assets/{dist-BYGE8AQe.js → dist-C_x5-hi8.js} +1 -1
  29. package/dist/public/assets/{dist-CYLjuW55.js → dist-Cde1E3eV.js} +1 -1
  30. package/dist/public/assets/{dist-gLP0NXk8.js → dist-Ds3438NL.js} +1 -1
  31. package/dist/public/assets/errors-O9DWXa3f.js +1 -0
  32. package/dist/public/assets/forward-link-RM7_5Shu.js +1 -0
  33. package/dist/public/assets/hotkeys-1uTWFYAL.js +1 -0
  34. package/dist/public/assets/index-CPHfr3MU.css +2 -0
  35. package/dist/public/assets/{index-Dp8dqiUy.js → index-np8JXeG6.js} +3 -3
  36. package/dist/public/assets/input-CxgRsoVg.js +1 -0
  37. package/dist/public/assets/jsx-runtime-By8HlURe.js +1 -0
  38. package/dist/public/assets/{markdown-mermaid-BX4brFyy.js → markdown-mermaid-CNYDlgGt.js} +1 -1
  39. package/dist/public/assets/media-refresh-store-Bu4kWCGq.js +1 -0
  40. package/dist/public/assets/notification-delivery-Dfvdt_1U.js +1 -0
  41. package/dist/public/assets/{popover-C20E0SGw.js → popover-CCHRaCvX.js} +1 -1
  42. package/dist/public/assets/protocol-support-BGmIChNK.js +1 -0
  43. package/dist/public/assets/{jsx-runtime-ffCh33zF.js → react-dom-cJyBB_A4.js} +1 -1
  44. package/dist/public/assets/{scroll-restoration-DTBzWrDT.js → scroll-restoration-OVgiE4G9.js} +1 -1
  45. package/dist/public/assets/select-Bg0rWqco.js +1 -0
  46. package/dist/public/assets/selection-actions-D875GPFU.js +1 -0
  47. package/dist/public/assets/{session-order-iDEtZwje.js → session-order-f7QxTbVD.js} +1 -1
  48. package/dist/public/assets/{switch-B1uGC2PW.js → switch-DhNyUV8C.js} +1 -1
  49. package/dist/public/assets/use-ui-state-CHqXhyx4.js +1 -0
  50. package/dist/public/assets/{ws-DfRorDqa.js → ws-CMPCIzY4.js} +1 -1
  51. package/dist/public/index.html +5 -4
  52. package/dist/pudl.js +245 -188
  53. package/package.json +1 -1
  54. package/dist/public/assets/App-BaLhdtWg.js +0 -2
  55. package/dist/public/assets/Dashboard-LVU8bCcQ.js +0 -1
  56. package/dist/public/assets/NewProjectDialog-BFguzZCI.js +0 -1
  57. package/dist/public/assets/PaneEditorBody-DBW-O4q7.js +0 -303
  58. package/dist/public/assets/PdfViewer-Q6yROHsM.js +0 -2
  59. package/dist/public/assets/SettingsDialog-DoVdLwtQ.js +0 -8
  60. package/dist/public/assets/Workspace-BxGgvBCU.js +0 -20
  61. package/dist/public/assets/auth-ngM0Ffss.js +0 -64
  62. package/dist/public/assets/dialog-yvLGI8FJ.js +0 -41
  63. package/dist/public/assets/disclosure-0ZiECVHr.js +0 -1
  64. package/dist/public/assets/dist-CwwiP1WN.js +0 -1
  65. package/dist/public/assets/errors-yaab6YK_.js +0 -1
  66. package/dist/public/assets/forward-link-kfVuUsZP.js +0 -1
  67. package/dist/public/assets/index-CItoWyyj.css +0 -2
  68. package/dist/public/assets/input-DDhYsCUG.js +0 -1
  69. package/dist/public/assets/media-refresh-store-D3rBSq4q.js +0 -1
  70. package/dist/public/assets/notification-delivery-B__ASJZR.js +0 -1
  71. package/dist/public/assets/protocol-support-BNUfFPAF.js +0 -1
  72. package/dist/public/assets/select-DQmSVYUL.js +0 -1
  73. package/dist/public/assets/selection-actions-JLWPcaUH.js +0 -1
  74. package/dist/public/assets/use-ui-state-jAfsiEpt.js +0 -1
@@ -0,0 +1,303 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NotebookWidget-Cwd77EGL.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/auth-GfOuXpIe.js","assets/context-DW21k43a.js","assets/api-i6xNY3bF.js","assets/protocol-support-BGmIChNK.js","assets/jsx-runtime-By8HlURe.js","assets/preload-helper-Czpn1I53.js","assets/index-np8JXeG6.js","assets/react-dom-cJyBB_A4.js","assets/client-settings-CwqpIric.js","assets/index-CPHfr3MU.css","assets/PdfViewer-Bppu4-0-.js","assets/dist-BOS6OKSE.js","assets/createLucideIcon-DyMAgLa3.js","assets/scroll-restoration-OVgiE4G9.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{$ as r,J as i,K as a,Q as o,T as s,X as c,Y as l,Z as u,et as d,o as f,q as p}from"./auth-GfOuXpIe.js";import{n as m,t as h}from"./context-DW21k43a.js";import{i as g,r as _,t as v}from"./client-settings-CwqpIric.js";import{t as y}from"./jsx-runtime-By8HlURe.js";import{t as b}from"./preload-helper-Czpn1I53.js";import{a as x,r as S}from"./index-np8JXeG6.js";import{t as C}from"./purify.es-D8QhFVkO.js";import"./katex.min-ZqdHjttS.js";import{a as w,c as ee,h as T,i as E,p as D,r as O}from"./editor.api2-4X9Vh9Zw.js";import{n as k,r as A,t as j}from"./api-i6xNY3bF.js";import{c as te,g as M,p as ne}from"./hotkeys-1uTWFYAL.js";import{L as re,d as ie,f as ae,g as oe,p as se,u as ce,wt as le,xt as ue}from"./protocol-support-BGmIChNK.js";import{B as de,C as fe,E as pe,J as me,K as he,O as ge,P as _e,R as ve,T as ye,U as be,W as xe,X as Se,Y as Ce,Z as we,_ as Te,a as Ee,at as De,d as Oe,i as ke,it as Ae,j as je,k as Me,m as Ne,n as Pe,nt as Fe,ot as Ie,r as Le,rt as Re,st as ze,u as Be,v as Ve,w as He}from"./media-refresh-store-Bu4kWCGq.js";import{n as Ue}from"./dist-BOS6OKSE.js";import{t as We}from"./x-DCpy1q13.js";import{t as Ge}from"./input-CxgRsoVg.js";import{n as Ke,r as qe}from"./dist-Cde1E3eV.js";import{t as Je}from"./createLucideIcon-DyMAgLa3.js";import{a as Ye,i as Xe,n as Ze,o as Qe,r as $e,t as et}from"./select-Bg0rWqco.js";import{t as tt}from"./chevron-down--sjpQEHH.js";import{r as nt}from"./dist-Ds3438NL.js";import{a as rt,n as it,o as at,r as ot,t as st}from"./FindWidget-CVH9U-_P.js";import{t as ct}from"./copy-CGsu8426.js";import{t as lt}from"./rotate-ccw-CNjR2LSi.js";import{a as ut,i as dt,n as ft,o as pt,r as mt,t as ht}from"./preview-kind-DiWpvEc0.js";import{a as gt,o as _t,r as vt,s as yt,t as bt}from"./command-D7m0dmA-.js";import{n as xt,r as St,t as Ct}from"./popover-CCHRaCvX.js";import{t as wt}from"./debounce-B9DrqirV.js";import{i as Tt,n as Et,r as Dt,t as Ot}from"./drafts-B_tChlzR.js";import{a as kt,c as At,d as jt,f as Mt,i as Nt,l as Pt,o as Ft,p as It,r as Lt,s as Rt,t as zt,u as Bt}from"./buffer-store-eMnMxbpI.js";import{r as Vt}from"./buffer-logic-BAkSBQT7.js";import{a as Ht,i as Ut,n as Wt,o as Gt,r as Kt}from"./editor-sync-W1bamxAP.js";import{i as qt,n as Jt,t as Yt}from"./scroll-restoration-OVgiE4G9.js";import{r as Xt,t as Zt}from"./math-CSw6sgCC.js";import{n as Qt,r as $t}from"./math-delimiters-BCnTi7Ii.js";import{n as en}from"./markdown-mermaid-CNYDlgGt.js";var tn=Je(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),nn=Je(`arrow-up-to-line`,[[`path`,{d:`M5 3h14`,key:`7usisc`}],[`path`,{d:`m18 13-6-6-6 6`,key:`1kf1n9`}],[`path`,{d:`M12 7v14`,key:`1akyts`}]]),rn=Je(`combine`,[[`path`,{d:`M14 3a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`,key:`1l7d7l`}],[`path`,{d:`M19 3a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`,key:`9955pe`}],[`path`,{d:`m7 15 3 3`,key:`4hkfgk`}],[`path`,{d:`m7 21 3-3H5a2 2 0 0 1-2-2v-2`,key:`1xljwe`}],[`rect`,{x:`14`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1cdgtw`}],[`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1`,key:`zi3rio`}]]),an=Je(`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`}]]),on=Je(`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`}]]),N=t(n(),1),sn=new Map,cn=new Map,ln=1;function un(e){for(let t of cn.get(e)??[])t()}function dn(e,t){sn.set(e,t),un(e)}function fn(e){let t={phase:`unresolved`,revision:ln++};return dn(e,t),t}function pn(e){let t=sn.get(e);return!t||t.phase!==`unresolved`&&t.phase!==`load-error`?null:(dn(e,{phase:`loading`,revision:t.revision}),t.revision)}function mn(e,t,n,r){let i=sn.get(e);return!i||i.phase!==`loading`||i.revision!==t?!1:(dn(e,{phase:`opening`,revision:t,content:n,mtimeMs:r}),!0)}function hn(e,t){let n=sn.get(e);return!n||n.phase!==`opening`||n.revision!==t?!1:(dn(e,{...n,phase:`comparing`}),!0)}function gn(e,t,n){let r=sn.get(e);return!r||r.phase!==`loading`||r.revision!==t?!1:(dn(e,{phase:`load-error`,revision:t,message:n}),!0)}function _n(e,t){return t&&e?.phase===`unresolved`}function vn(e){return e?.phase===`comparing`?e.mtimeMs:void 0}function yn(e){return e?.phase===`loading`||e?.phase===`load-error`||e?.phase===`opening`}function bn(e){return e.phase===`opening`||e.phase===`comparing`}function xn(e){sn.delete(e)&&un(e)}function Sn(e){return sn.get(e)??null}function Cn(e,t){let n=cn.get(e);return n||(n=new Set,cn.set(e,n)),n.add(t),()=>n.delete(t)}function wn(e){return{tabSize:e,insertSpaces:!0,detectIndentation:!1}}var Tn=new Jt,En=new Jt;function Dn(e){let t={...e.contributionsState};return delete t[`editor.contrib.wordHighlighter`],{...e,contributionsState:t}}function On(e,t){let n=(0,N.useRef)(null),r=(0,N.useRef)(null);return(0,N.useLayoutEffect)(()=>(n.current&&(r.current=t(n.current,e)),()=>{r.current?.(),r.current=null}),[e,t]),(0,N.useCallback)(i=>{r.current?.(),n.current=i,i.onDidDispose(()=>{n.current===i&&(n.current=null)}),r.current=t(i,e)},[e,t])}function kn(e,t){let n=Tn.get(t);n&&e.restoreViewState(n);let r=()=>{if(!e.getModel())return;let n=e.saveViewState();n&&Tn.set(t,Dn(n))},i=[e.onDidScrollChange(r),e.onDidChangeCursorSelection(r)];return()=>{r(),i.forEach(e=>e.dispose())}}function An(e,t){let n=En.get(t),r=n!==void 0,i=()=>{if(r||!e.getModel())return;let n=e.saveViewState();n&&En.set(t,{...n,original:n.original&&Dn(n.original),modified:n.modified&&Dn(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 jn(e){return On(qt(`code`,e),kn)}function Mn(e){return On(qt(`diff`,e),An)}var P=y();function Nn({session:e,path:t,conflict:n,model:r,onTakeDisk:i,onKeepMine:a,onSave:o,onReady:s}){let c=g(),l=Mn([`conflict`,r.uri.toString()]),u=(0,N.useId)(),d=(0,N.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),f=(0,N.useRef)(o);f.current=o;let p=(0,N.useRef)(null),m=()=>{let e=p.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),p.current=null},h=(0,N.useRef)(m);return h.current=m,(0,N.useEffect)(()=>()=>h.current(),[]),(0,P.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-3 bg-elevated px-3 py-1.5 text-xs text-fg-secondary`,children:[(0,P.jsx)(`span`,{children:`This file changed on disk. Yours is on the right — merge what you want, then save.`}),(0,P.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,P.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,P.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,P.jsx)(It,{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:jt,keepCurrentModifiedModel:!0,loading:(0,P.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(E.CtrlCmd|O.KeyS,()=>f.current()),s?.(n.revision)},options:{readOnly:n.phase!==`comparing`,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:d,fontSize:c.editorFontSize,...wn(c.editorTabSize),wordWrap:c.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}function Pn({session:e,path:t,buffer:n,focused:r}){let i=n.conflict;return!i||i.phase===`unresolved`?null:bn(i)&&n.model?(0,P.jsx)(Nn,{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,P.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,P.jsx)(`span`,{children:`The disk version could not be loaded.`}),(0,P.jsx)(`span`,{className:`max-w-lg text-xs text-fg-secondary`,children:i.message}),(0,P.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,P.jsx)(`div`,{className:`flex h-full items-center justify-center bg-ground text-sm text-fg-muted`,children:`Loading the disk version…`})}var Fn=`data-puddle-source-line`,In=`data-puddle-source-end-line`,Ln=`data-puddle-source-line-count`;function Rn(e){return Number.isFinite(e.line)&&Number.isFinite(e.offset)}function zn(e){let t=e.filter(Rn).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 Bn(e,t,n,r,i){return n<=t?r:r+Math.min(1,Math.max(0,(e-t)/(n-t)))*(i-r)}function Vn(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 Hn(e,t){let n=Vn(e,t,`line`);return n?Bn(t,n[0].line,n[1].line,n[0].offset,n[1].offset):null}function Un(e,t){let n=Vn(e,t,`offset`);return n?Bn(t,n[0].offset,n[1].offset,n[0].line,n[1].line):null}function Wn(e,t){let n=Number(e.getAttribute(t));return Number.isFinite(n)&&n>=1?n:null}function Gn(e,t,n){let r=e.getBoundingClientRect().top,i=[{line:1,offset:0}];for(let a of t.querySelectorAll(`[${Fn}]`)){let t=Wn(a,Fn);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=Wn(a,In);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}),zn(i)}function Kn(e){return e===``?1:e.split(/\r\n?|\n/).length}function qn(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):0}function Jn(e,t,n){return qn(e/Math.max(1,t-n))}function Yn(e,t,n){return qn(e)*Math.max(0,t-n)}function Xn(e,t){return JSON.stringify([e,t.session,t.root??null,t.path])}var Zn=new class{positions=new Map;listeners=new Map;revision=0;publish(e,t,n,r=null){let i={ratio:qn(n),sourceLine:r!==null&&Number.isFinite(r)?Math.max(1,r):null,revision:++this.revision},a=Xn(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(Xn(e,t))}subscribe(e,t,n){let r=Xn(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)}}},Qn=new Jt;function $n(e){let t=null;return{schedule:()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))},dispose:()=>{t!==null&&cancelAnimationFrame(t),t=null}}}function er(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=Hn(r,e.sourceLine);if(t!==null)return Math.min(i,Math.max(0,t))}return Yn(e.ratio,t,n)}function tr(e,t){if(t.driver&&t.receiver)throw Error(`a preview scroll surface cannot be both driver and receiver`);let n=t.store??Zn,r=t.viewKey?Qn.get(t.viewKey):void 0,i=t.sourceAnchors?.(),a=()=>void 0,o,s=n=>{r=n,t.viewKey&&Qn.set(t.viewKey,n),e.scrollTop=er(n,e.scrollHeight,e.clientHeight,i)};r&&s(r);let c=()=>{if(e.clientHeight<=0)return;let a=Jn(e.scrollTop,e.scrollHeight,e.clientHeight),o=i?Un(i,e.scrollTop):null;r={ratio:a,sourceLine:o,revision:0},t.viewKey&&Qn.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=$n(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 nr(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 rr(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 ir(e,t,n){if(t.driver&&t.receiver)throw Error(`a Monaco scroll surface cannot be both driver and receiver`);let r=t.store??Zn,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?rr(e,t.sourceLine):null;e.setScrollTop(r??er(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=$n(()=>{let n=Jn(e.getScrollTop(),e.getScrollHeight(),c());r.publish(t.channel,t.target,n,nr(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 ar(e){return!e}function or(e){let t=e.split(`+`),n=t.pop()??``,r=0;for(let e of t)e===`meta`?r|=E.CtrlCmd:e===`ctrl`?r|=E.WinCtrl:e===`alt`?r|=E.Alt:e===`shift`&&(r|=E.Shift);let i=O[/^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 sr(e,t){let n=or(te(`editor.save`));n!==null&&e.addCommand(n,()=>t.onSave());let r=or(te(`editor.wordWrap`));e.addAction({id:`puddle.toggleWordWrap`,label:`Toggle Word Wrap`,keybindings:r===null?[]:[r],run:()=>_({editorWordWrap:ar(v().editorWordWrap)})})}var cr=new WeakSet;function lr(e){return cr.has(e)?!1:(cr.add(e),!0)}function ur(e){return`file-conflict:${e}`}function dr(e,t,n,r,i){let a=i?.passive===!0,o=i?.focused??!0,s=zt(e,t,r),c=we(e,t,{root:r,live:i?.live}),l=Ce(e,r),[u,d]=(0,N.useState)(null),[f,p]=(0,N.useState)(!1),m=(0,N.useRef)(!1),h=(0,N.useRef)(null),g=(0,N.useRef)(null),_=(0,N.useRef)(n);_.current=n;let v=(0,N.useRef)(!1),y=(0,N.useCallback)((e,t)=>{g.current?.cancel(),v.current=!0;try{Rt(s,e,t)}finally{v.current=!1}},[s]),b=(0,N.useSyncExternalStore)((0,N.useCallback)(e=>Bt(s,e),[s]),()=>Nt(s)),x=(0,N.useSyncExternalStore)((0,N.useCallback)(e=>Gt(s,e),[s]),()=>Ht(s)),S=(0,N.useSyncExternalStore)((0,N.useCallback)(e=>Cn(s,e),[s]),()=>Sn(s));(0,N.useEffect)(()=>{let n=c.data;if(!n||n.binary||n.content===null||m.current)return;m.current=!0;let i=Pt(s)!==void 0,a=Lt(e,t,n.content,n.mtime_ms,r),o=a.getValue();d(a),!i&&Tt(e,t,r).then(i=>{if(!i)return;let s=Et(i,o,n.mtime_ms);s===`discard`?Ot(e,t,r):s===`restore`?Vt(a,i.content)&&p(!0):Ue(`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:()=>{Vt(a,i.content)&&p(!0)}}})})},[c.data,s,e,t,r]),(0,N.useEffect)(()=>{if(!u||a)return;let n=Dt(e,t,r);g.current=n;let i=u.onDidChangeContent(()=>{v.current||(n(u.getValue(),Pt(s)??0),Wt(e,t,r))});return()=>{n.flush(),i.dispose(),g.current=null}},[u,s,e,t,r,a]),(0,N.useEffect)(()=>{!u||!x.savedElsewhere||Nt(s)||c.refetch().then(e=>{Nt(s)||(e.data&&e.data.content!==null&&y(e.data.content,e.data.mtime_ms),Ut(s))})},[x.savedElsewhere,u,s]),(0,N.useEffect)(()=>{let e=c.data;!u||!e||e.content===null||!Nt(s)&&e.mtime_ms!==Pt(s)&&y(e.content,e.mtime_ms)},[c.data,u,s]);let C=(0,N.useCallback)((n,i)=>{kt(s,n,i),g.current?.cancel(),Ot(e,t,r),Kt(e,t,i,r),p(!1),xn(s)},[s,e,t,r]),w=(0,N.useCallback)(()=>{let e=pn(s);e!==null&&(Ue.dismiss(ur(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.`);mn(s,e,n.content,n.mtime_ms)}).catch(t=>{gn(s,e,t instanceof Error?t.message:`The disk version did not load.`)}))},[c,s]),ee=(0,N.useRef)(w);ee.current=w,(0,N.useEffect)(()=>{if(!_n(S,o))return;let e=ur(s);return Ue(`File changed on disk`,{id:e,description:`Nothing was written — your unsaved version is intact.`,duration:1/0,closeButton:!0,action:{label:`Compare`,onClick:()=>ee.current()}}),()=>{Ue.dismiss(e)}},[S,o,s]);let T=(0,N.useCallback)(()=>{c.refetch().then(n=>{n.data&&n.data.content!==null&&y(n.data.content,n.data.mtime_ms),Ot(e,t,r),p(!1),xn(s)})},[s,e,t,y]),E=(0,N.useCallback)((e,n)=>{l.mutate({path:t,content:e},{onSuccess:e=>C(n,e.mtime_ms),onError:e=>Ue.error(e instanceof Error?e.message:`Overwrite failed`)})},[l,t,C]),D=(0,N.useCallback)(async()=>{if(!u||!Nt(s))return!0;let e=u.getValue(),n=u.getAlternativeVersionId();if(yn(Sn(s)))return!1;let r=vn(Sn(s))??Pt(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 j&&e.status===409&&e.code===`stale_file`?fn(s):Ue.error(e instanceof Error?e.message:`Save failed`),!1}},[u,s,l,t,C]),O=(0,N.useRef)(D);O.current=D,(0,N.useEffect)(()=>ge(je(e,t,r),()=>O.current(),{session:e,path:t,...r===void 0?{}:{root:r}}),[e,t,r]);let k=(0,N.useCallback)(()=>{let n=h.current,i=_.current;!n||!i||!o||i.session!==e||i.path!==t||(i.root??void 0)!==(r??void 0)||lr(i)&&(n.revealLineInCenter(i.line),n.setPosition({lineNumber:i.line,column:i.column??1}),n.focus())},[e,t,r,o]),A=(0,N.useCallback)(e=>{h.current=e,sr(e,{onSave:()=>O.current()}),k()},[k]);(0,N.useEffect)(()=>{k()},[n,u,k]);let te=(0,N.useCallback)(()=>{T()},[T]),M=(0,N.useCallback)(()=>{!u||Sn(s)?.phase!==`comparing`||E(u.getValue(),u.getAlternativeVersionId())},[u,s,E]),ne=(0,N.useCallback)(e=>{hn(s,e)},[s]),re,ie=null;c.data?.binary?re=`binary`:c.error?c.error instanceof j&&c.error.status===413?re=`too-large`:(re=`error`,ie=c.error instanceof Error?c.error.message:`Failed to load file`):re=u?`ready`:`loading`;let ae=b&&x.savedElsewhere?`saved-elsewhere`:b&&x.dirtyElsewhere?`dirty-elsewhere`:null;return{status:re,errorMessage:ie,model:u,dirty:b,restoredNotice:f,discardRestore:te,peerBadge:ae,conflict:S,takeDisk:T,keepMine:M,compare:w,comparisonReady:ne,save:D,onMount:A}}function fr(e,t,n,r){for(let i of e)if(_r([i],n).some(e=>(r===void 0||e.kind===r)&&t>=e.startLineNumber&&t<=e.endLineNumber))return i;return null}function pr(e,t){return hr(e.modifiedStartLineNumber,e.modifiedEndLineNumber)>0?Math.min(t,e.modifiedEndLineNumber):Math.max(0,Math.min(t,e.modifiedStartLineNumber-1))}function mr(e){let t=hr(e.originalStartLineNumber,e.originalEndLineNumber),n=hr(e.modifiedStartLineNumber,e.modifiedEndLineNumber);return Math.max(5,Math.min(14,t+n+4))}function hr(e,t){return t===0?0:Math.max(0,t-e+1)}function gr(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 _r(e,t){let n=[];for(let r of e){let e=hr(r.originalStartLineNumber,r.originalEndLineNumber),i=hr(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(gr(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(gr(r.modifiedStartLineNumber+i,t))}return n}var vr=28,yr=[[`puddle-dirty-added`,`added`],[`puddle-dirty-modified`,`modified`],[`puddle-dirty-deleted-before`,`deleted-before`],[`puddle-dirty-deleted-after`,`deleted-after`]];function br(e){if(e){for(let[t,n]of yr)if(e.classList.contains(t)||e.closest(`.${t}`))return n}}function xr({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,D.ScrollType.Immediate)},u=(i,s)=>{if(a?.anchorLine===i){c();return}c();let u=e.getOption(D.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:pr(s,n.getLineCount()),heightInPx:vr+mr(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=D.createDiffEditor(h,{readOnly:!0,domReadOnly:!0,originalEditable:!1,renderSideBySide:!1,renderMarginRevertIcon:!1,renderOverviewRuler:!1,enableSplitViewResizing:!1,isInEmbeddedEditor:!0,automaticLayout:!0,fontFamily:e.getOption(D.EditorOption.fontFamily),fontSize:e.getOption(D.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!==D.MouseTargetType.GUTTER_LINE_DECORATIONS||e.target.position===null)return;let t=e.target.position.lineNumber,r=fr(i,t,n.getLineCount(),br(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=fr(t,r.anchorLine,n.getLineCount());if(!o){c();return}r.change=o,r.zone.afterLineNumber=pr(o,n.getLineCount()),r.zone.heightInPx=vr+mr(o)*e.getOption(D.EditorOption.lineHeight);try{e.changeViewZones(e=>e.layoutZone(r.zoneId))}catch{c();return}l(r)},dispose(){o=!0,d.dispose(),c()}}}var Sr={added:`puddle-dirty-added`,modified:`puddle-dirty-modified`,"deleted-before":`puddle-dirty-deleted-before`,"deleted-after":`puddle-dirty-deleted-after`};function Cr(e,t,n,r){let i=re(),a=he(e,t,{root:n,enabled:i.data!==void 0&&oe(i.data.protocol)&&r!==null}),[o,s]=(0,N.useState)(null),c=(0,N.useCallback)(e=>{s(e)},[]);return(0,N.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=D.createModel(e.exists?e.content??``:``,r.getLanguageId()),s=D.createDiffEditor(n,{readOnly:!0,automaticLayout:!1,renderSideBySide:!1,minimap:{enabled:!1}}),c=o.createDecorationsCollection();s.setModel({original:i,modified:r});let l=xr({editor:o,original:i,modified:r,path:t}),u=()=>{let e=s.getLineChanges();e&&(l.update(e),c.set(_r(e,r.getLineCount()).map(e=>({range:new ee(e.startLineNumber,1,e.endLineNumber,1),options:{isWholeLine:!0,linesDecorationsClassName:Sr[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 wr({message:e,session:t,path:n,root:r,download:i}){return(0,P.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 bg-ground text-sm text-fg-muted`,children:[(0,P.jsx)(`span`,{children:e}),i&&(0,P.jsxs)(`button`,{type:`button`,onClick:()=>void ve(t,n,r).catch(e=>Ue.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,P.jsx)(De,{className:`size-4`}),`Download`]})]})}function Tr({session:e,path:t,reveal:n,root:r,focused:i=!0,scrollDriver:a=!1,scrollReceiver:o=!1,scrollChannel:s=`profile`}){let c=g(),l=jn([e,r,t]),u=dr(e,t,n,r,{focused:i}),d=_e(e,t,r),f=Cr(e,t,r,u.model),p=(0,N.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),[m,h]=(0,N.useState)(null),_=(0,N.useMemo)(()=>({session:e,path:t,root:r}),[e,t,r]),v=u.conflict!==null&&u.conflict.phase!==`unresolved`;if((0,N.useEffect)(()=>{if(!(!m||!u.model||v))return ir(m,{channel:s,target:_,driver:a,receiver:o},D.ScrollType.Immediate)},[m,u.model,v,s,_,a,o]),(0,N.useEffect)(()=>{let e=u.model;e&&D.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`?w.Error:t.severity===`warning`?w.Warning:w.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,P.jsx)(Pn,{session:e,path:t,buffer:u,focused:i});if(u.status===`binary`)return(0,P.jsx)(wr,{message:`Binary file — use Download`,session:e,path:t,root:r,download:!0});if(u.status===`too-large`)return(0,P.jsx)(wr,{message:`File too large to edit — use Download`,session:e,path:t,root:r,download:!0});if(u.status===`error`)return(0,P.jsx)(wr,{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,P.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[u.restoredNotice&&(0,P.jsxs)(`div`,{className:`flex items-center gap-3 bg-elevated px-3 py-1.5 text-xs text-fg-secondary`,children:[(0,P.jsx)(`span`,{children:`Restored unsaved changes`}),(0,P.jsx)(`button`,{type:`button`,onClick:u.discardRestore,className:`text-fg-muted transition-colors hover:text-fg`,children:`Discard`})]}),y&&(0,P.jsx)(`div`,{className:`bg-surface px-3 py-1 text-xs text-fg-muted`,children:y}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1`,children:u.model&&(0,P.jsx)(Mt,{path:u.model.uri.toString(),defaultValue:u.model.getValue(),theme:`puddle`,keepCurrentModel:!0,saveViewState:!1,onMount:e=>{l(e),u.onMount(e),f(e),h(e)},loading:(0,P.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),options:{automaticLayout:!0,fontFamily:p,fontSize:c.editorFontSize,...wn(c.editorTabSize),wordWrap:c.editorWordWrap?`on`:`off`,minimap:{enabled:!1},glyphMargin:!1,lineDecorationsWidth:10,fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}function F({children:e}){return(0,P.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-xs text-fg-muted`,children:e})}function Er(e,t){let n=(0,N.useRef)(t);n.current=t,(0,N.useEffect)(()=>(At(e),()=>{n.current?.(),Ft(e)}),[e])}function Dr(e,t,n,r){let i=r.split(`/`).map(encodeURIComponent).join(`/`);return`${e}://${encodeURIComponent(t)}/${encodeURIComponent(n)}/${i}`}function Or({session:e,refName:t,path:n,content:r}){let i=g(),a=jn([e,t,n]),o=(0,N.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,P.jsx)(Mt,{path:Dr(`puddle-view`,e,t,n),defaultValue:r,theme:jt,saveViewState:!1,onMount:a,loading:(0,P.jsx)(F,{children:`…`}),options:{readOnly:!0,automaticLayout:!0,fontFamily:o,fontSize:i.editorFontSize,...wn(i.editorTabSize),minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function kr({session:e,against:t,path:n,root:r,indexBase:i=!1}){let a=xe(e,t,n,{root:r,enabled:!i}),o=me(e,n,{root:r,enabled:i}),s=i?o:a;return s.isPending?(0,P.jsx)(F,{children:`…`}):s.error?(0,P.jsx)(F,{children:s.error instanceof Error?s.error.message:`Failed to load`}):s.data.binary?(0,P.jsx)(F,{children:`Binary file — deleted`}):(0,P.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,P.jsx)(`div`,{className:`bg-surface px-4 py-1 text-xs text-fg-muted`,children:`Deleted`}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,P.jsx)(Or,{session:e,refName:`${t}:${r??``}`,path:n,content:s.data.content??``})})]})}function Ar({session:e,against:t,path:n,basePath:r,root:i,indexBase:a=!1,focused:o=!0}){let s=g(),c=Mn([e,i,t,a,n]),l=dr(e,n,null,i,{focused:o}),u=xe(e,t,r,{root:i,enabled:!a}),d=me(e,r,{root:i,enabled:a}),f=a?d:u,p=(0,N.useRef)(null);Er(zt(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,N.useRef)(l.save);m.current=l.save;let h=(0,N.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),_=f.error instanceof j&&f.error.status===404;return l.conflict&&l.conflict.phase!==`unresolved`?(0,P.jsx)(Pn,{session:e,path:n,buffer:l,focused:o}):l.status===`binary`||f.data?.binary?(0,P.jsx)(F,{children:`Binary file`}):l.status===`too-large`?(0,P.jsx)(F,{children:`File too large to show`}):l.status===`error`?(0,P.jsx)(F,{children:l.errorMessage??`Failed to load file`}):_||a&&d.data&&!d.data.exists?(0,P.jsx)(Tr,{session:e,path:n,reveal:null,root:i,focused:o}):f.isPending||!l.model?(0,P.jsx)(F,{children:`…`}):f.error?(0,P.jsx)(F,{children:f.error instanceof Error?f.error.message:`Failed to load base`}):(0,P.jsx)(It,{modifiedModelPath:l.model.uri.toString(),originalModelPath:Dr(`puddle-base`,e,`${t}:${i??``}`,r),original:f.data.content??``,language:l.model.getLanguageId(),theme:jt,keepCurrentModifiedModel:!0,loading:(0,P.jsx)(F,{children:`…`}),onMount:e=>{c(e),p.current=e,e.onDidDispose(()=>{p.current=null}),e.getModifiedEditor().addCommand(E.CtrlCmd|O.KeyS,()=>m.current())},options:{readOnly:!1,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:h,fontSize:s.editorFontSize,...wn(s.editorTabSize),wordWrap:s.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function jr({session:e,against:t,entry:n,root:r}){let i=g(),a=Mn([e,r,t,`staged`,n.path]),o=n.old_path??n.path,s=xe(e,t,o,{root:r,enabled:n.status!==`added`}),c=me(e,n.path,{root:r,enabled:n.status!==`deleted`}),l=(0,N.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);if(n.status===`deleted`)return(0,P.jsx)(kr,{session:e,against:t,path:o,root:r});if(c.isPending||n.status!==`added`&&s.isPending)return(0,P.jsx)(F,{children:`…`});if(c.error||s.error){let e=c.error??s.error;return(0,P.jsx)(F,{children:e instanceof Error?e.message:`Failed to load staged content`})}return c.data.binary||s.data?.binary?(0,P.jsx)(F,{children:`Binary file`}):n.status===`added`?(0,P.jsx)(Or,{session:e,refName:`index:${r??``}`,path:n.path,content:c.data.content??``}):s.data?(0,P.jsx)(It,{originalModelPath:Dr(`puddle-head`,e,`${t}:${r??``}`,o),modifiedModelPath:Dr(`puddle-index`,e,`${t}:${r??``}`,n.path),original:s.data.content??``,modified:c.data.content??``,onMount:a,theme:jt,loading:(0,P.jsx)(F,{children:`…`}),options:{readOnly:!0,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:l,fontSize:i.editorFontSize,...wn(i.editorTabSize),wordWrap:i.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}}):(0,P.jsx)(F,{children:`Failed to load HEAD content`})}function Mr({session:e,path:t,root:n,focused:r}){return Er(zt(e,t,n)),(0,P.jsx)(Tr,{session:e,path:t,reveal:null,root:n,focused:r})}function Nr({session:e,against:t,entry:n,root:r,area:i,focused:a=!0}){if(i===`staged`)return(0,P.jsx)(jr,{session:e,against:t,entry:n,root:r});switch(n.status){case`added`:return(0,P.jsx)(Mr,{session:e,path:n.path,root:r,focused:a});case`deleted`:return(0,P.jsx)(kr,{session:e,against:t,path:n.path,root:r,indexBase:i===`unstaged`});case`modified`:case`renamed`:return(0,P.jsx)(Ar,{session:e,against:t,path:n.path,basePath:n.old_path??n.path,root:r,indexBase:i===`unstaged`,focused:a});default:return null}}function Pr({session:e,sha:t,path:n,root:r}){let i=xe(e,t,n,{root:r});return i.isPending?(0,P.jsx)(F,{children:`…`}):i.error?(0,P.jsx)(F,{children:i.error instanceof Error?i.error.message:`Failed to load file`}):i.data.binary?(0,P.jsx)(F,{children:`Binary file`}):(0,P.jsx)(Or,{session:e,refName:`${t}:${r??``}`,path:n,content:i.data.content??``})}function Fr({session:e,originalRef:t,originalPath:n,originalContent:r,modifiedRef:i,modifiedPath:a,modifiedContent:o,root:s}){let c=g(),l=Mn([e,s,t,n,i,a]),u=(0,N.useRef)(null),d=(0,N.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,N.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,P.jsx)(It,{originalModelPath:Dr(`puddle-hist-orig`,e,`${t}:${s??``}`,n),modifiedModelPath:Dr(`puddle-hist-mod`,e,`${i}:${s??``}`,a),original:r,modified:o,theme:jt,keepCurrentOriginalModel:!0,keepCurrentModifiedModel:!0,loading:(0,P.jsx)(F,{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,...wn(c.editorTabSize),minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function Ir({session:e,sha:t,path:n,basePath:r,root:i}){let a=xe(e,`${t}^`,r,{root:i}),o=xe(e,t,n,{root:i});return a.error instanceof j&&a.error.status===404?(0,P.jsx)(Pr,{session:e,sha:t,path:n,root:i}):a.isPending||o.isPending?(0,P.jsx)(F,{children:`…`}):a.error?(0,P.jsx)(F,{children:a.error instanceof Error?a.error.message:`Failed to load original`}):o.error?(0,P.jsx)(F,{children:o.error instanceof Error?o.error.message:`Failed to load file`}):a.data.binary||o.data.binary?(0,P.jsx)(F,{children:`Binary file`}):(0,P.jsx)(Fr,{session:e,originalRef:`${t}^`,originalPath:r,originalContent:a.data.content??``,modifiedRef:t,modifiedPath:n,modifiedContent:o.data.content??``,root:i})}function Lr({session:e,sha:t,entry:n,isRootCommit:r,root:i}){switch(pe(n.status,r)){case`added`:return(0,P.jsx)(Pr,{session:e,sha:t,path:n.path,root:i});case`deleted`:return(0,P.jsx)(kr,{session:e,against:`${t}^`,path:n.path,root:i});case`modified`:case`renamed`:return(0,P.jsx)(Ir,{session:e,sha:t,path:n.path,basePath:n.old_path??n.path,root:i});default:return null}}function Rr({session:e,sha:t,path:n,root:r}){let i=be(e,t,r);if(i.isPending)return(0,P.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading commit…`});if(i.error)return(0,P.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,P.jsx)(`div`,{className:`h-full`,children:(0,P.jsx)(Lr,{session:e,sha:t,entry:a,isRootCommit:i.data.parents.length===0,root:r})}):(0,P.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[(0,P.jsx)(`span`,{className:`text-fg-secondary`,children:n}),` is not part of`,` `,(0,P.jsx)(`span`,{className:`font-mono`,children:t.slice(0,7)}),`.`]})}function zr({session:e,path:t,root:n,area:r,focused:i=!0}){let a=Se(e,{root:n,against:r===void 0?`base`:`head`,area:r});if(a.isPending)return(0,P.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading diff…`});if(a.error)return(0,P.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,P.jsx)(`div`,{className:`h-full`,children:(0,P.jsx)(Nr,{session:e,against:a.data.against,entry:o,root:n,area:r,focused:i})}):(0,P.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[`No changes to `,(0,P.jsx)(`span`,{className:`mx-1 text-fg-secondary`,children:t}),` against the base.`]})}var Br=800;function Vr({name:e}){let t=g(),n=M(),r=jn([n,e]),i=ye(n,e),a=le(),o=ne(`editor.save`),s=(0,N.useRef)(null),c=(0,N.useRef)(null),l=(0,N.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);if((0,N.useEffect)(()=>{if(n===null)return;let t=wt(t=>{fe(n,e,t).catch(e=>Ue.error(e instanceof Error?e.message:`Draft not saved`))},Br);return c.current=t,()=>{t.flush(),c.current=null}},[n,e]),n===null)return null;if(i.error)return(0,P.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,P.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`});let u=()=>{let t=s.current;t&&(c.current?.flush(),Ve({name:e,content:t.getValue()}))};return(0,P.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[(0,P.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,P.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,P.jsx)(Mt,{path:`puddle-untitled://${n}/${e}`,defaultValue:i.data.content,theme:jt,keepCurrentModel:!1,saveViewState:!1,loading:(0,P.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),onMount:t=>{r(t),s.current=t,Te(e,t.getValue()),sr(t,{onSave:u})},onChange:t=>{let r=t??``;Te(e,r),He(a,n,e,r),c.current?.(r)},options:{automaticLayout:!0,fontFamily:l,fontSize:t.editorFontSize,...wn(t.editorTabSize),minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1,wordWrap:t.editorWordWrap?`on`:`off`}})})]})}var Hr=r([o(),p(o())]),Ur=u(o(),d()),Wr=l({output_type:o(),text:Hr.optional(),data:u(o(),d()).optional(),traceback:p(o()).optional(),ename:o().optional(),evalue:o().optional()}),Gr=l({id:o().optional(),cell_type:a([`code`,`markdown`,`raw`]),metadata:Ur,source:Hr,outputs:p(Wr).optional(),execution_count:c().int().nullable().optional()}),Kr=l({nbformat:i(4),nbformat_minor:c().int().nonnegative(),metadata:Ur,cells:p(Gr).max(2e3)});function qr(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=Kr.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 I(e){return typeof e==`string`?e:Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(``):``}function Jr(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`&&e.outputs?.length&&!e.metadata.puddle_execution?{metadata:{...e.metadata,puddle_execution:{id:`saved`,revision:0,source:I(e.source),state:`saved`}}}:{}}:e)}}function Yr(e){let t=new Set;return{...e,cells:e.cells.map((n,r)=>{let i=n.id;if(!i||t.has(i))for(i=`puddle-${r}`;t.has(i)||e.cells.some(e=>e.id===i);)i+=`-`;return t.add(i),n.id===i?n:{...n,id:i}})}}function Xr(e,t){if(e.cell_type!==`code`)return e.cell_type===`raw`?`plaintext`:`markdown`;let n=e.metadata.vscode,r=t.metadata.language_info,i=t.metadata.kernelspec,a=n?.languageId??r?.name??i?.language??`python`;return typeof a==`string`?a:`python`}function Zr(e,t){let n=t===`markdown`||t===`raw`?t:`code`,r={...e,cell_type:n};return n===`code`?(r.metadata={...e.metadata,vscode:{...e.metadata.vscode??{},languageId:t}},r.outputs??=[],r.execution_count??=null):(delete r.outputs,delete r.execution_count),r}function Qr(e){return{id:crypto.randomUUID(),cell_type:e,metadata:{},source:[],...e===`code`?{outputs:[],execution_count:null}:{}}}function $r(e){return(e.output_type===`error`?e.traceback?.join(`
3
+ `)??`${e.ename??`Error`}: ${e.evalue??``}`:I(e.text??e.data?.[`text/plain`])).replace(/\u001b\[[0-?]*[ -/]*[@-~]/g,``)}function ei(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 ti(e){return{...e,cells:e.cells.map(e=>e.cell_type===`code`?{...e,outputs:[],execution_count:null}:e)}}function ni(e){return e.cells.map((e,t)=>{let n=I(e.source).split(`
4
+ `).find(e=>e.trim())?.trim()??``;return{index:t,level:e.cell_type===`markdown`?/^(#{1,6})\s/.exec(n)?.[1]?.length??0:0,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 ri(e,t){let n=ni(e),r=n[t]?.level;if(!r)return[t];let i=n.find(e=>e.index>t&&e.level>0&&e.level<=r);return Array.from({length:(i?.index??e.cells.length)-t},(e,n)=>t+n)}function ii(e,t){let n=!1,r=new Map(t.cells.map(e=>[e.id,e])),i=e.cells.map(e=>{let i=r.get(e.id);if(e.cell_type!==`code`||!i||i.state===`queued`)return e;let a=e.metadata.puddle_execution;return a?.id===t.id&&typeof a.revision==`number`&&a.revision>=i.revision||i.state===`cancelled`&&i.elapsed_ms===void 0?e:(n=!0,{...e,outputs:i.outputs,execution_count:i.execution_count,metadata:{...e.metadata,puddle_execution:{id:t.id,revision:i.revision,source:i.source,state:i.state,elapsed_ms:i.elapsed_ms}}})});return n?{...e,cells:i}:e}function ai(e){let t=e.metadata.puddle_execution;if(!(!t||typeof t!=`object`||!(`source`in t)||typeof t.source!=`string`||!(`state`in t)||typeof t.state!=`string`))return{source:t.source,state:t.state===`running`||t.state===`queued`?`saved`:t.state,...`elapsed_ms`in t&&typeof t.elapsed_ms==`number`?{elapsed_ms:t.elapsed_ms}:{}}}function oi({notebook:e,active:t,selected:n,update:r,choose:i,setEditing:a,run:o,onUndo:s,onRedo:c}){let l=(n,a=e.cells.findIndex(e=>e.id===t)+1)=>{if(e.cells.length>=2e3)return;let o=Qr(n),s=[...e.cells];s.splice(t===null?s.length:a,0,o),r({...e,cells:s}),i(o.id,!0)},u=(t,n)=>r({...e,cells:e.cells.map((e,r)=>r===t?n:e)}),d=(t,n)=>{e.cells[t]?.cell_type===`code`&&o([t]),a(null),n===`insert`||n===`next`&&t===e.cells.length-1?l(e.cells[t].cell_type,t+1):n===`next`&&i(e.cells[t+1].id)};return{add:l,replace:u,execute:d,operation:(t,n)=>{let a=[...e.cells],o=a[t];if(n===`insert`){l(`code`,t+1);return}if(n===`clear`){u(t,{...o,outputs:[],execution_count:null});return}if(n===`delete`&&(a.splice(t,1),a.length&&i(a[Math.min(t,a.length-1)].id)),n===`up`||n===`down`){let e=t+(n===`up`?-1:1);if(e<0||e>=a.length)return;[a[t],a[e]]=[a[e],o],i(o.id)}if(n===`duplicate`){if(a.length>=2e3)return;let e={...structuredClone(o),id:crypto.randomUUID()};a.splice(t+1,0,e),i(e.id,!0)}if(n===`merge`){let e=a[t+1];if(!e||e.cell_type!==o.cell_type)return;a[t]={...o,source:`${I(o.source)}\n${I(e.source)}`},a.splice(t+1,1),i(o.id,!0)}r({...e,cells:a})},keyDown:f=>{if(f.target.closest(`.monaco-editor,input,textarea,[role=dialog],[role=menu],[cmdk-root]`))return;let p=e.cells.findIndex(e=>e.id===t);if((f.metaKey||f.ctrlKey)&&f.key.toLowerCase()===`z`){f.preventDefault(),f.shiftKey?c?.():s?.();return}if(f.key===`Enter`&&(f.metaKey||f.ctrlKey)&&n.length>1){f.preventDefault(),o(e.cells.flatMap((e,t)=>n.includes(e.id)?[t]:[]));return}if(f.key===`Enter`&&p>=0)f.preventDefault(),f.metaKey||f.ctrlKey||f.shiftKey||f.altKey?d(p,f.shiftKey?`next`:f.altKey?`insert`:`stay`):a(t);else if(f.key===`ArrowDown`||f.key===`ArrowUp`){f.preventDefault();let t=Math.max(0,Math.min(e.cells.length-1,p+(f.key===`ArrowDown`?1:-1)));e.cells[t]&&i(e.cells[t].id,!1,f.shiftKey)}else!f.metaKey&&!f.ctrlKey&&!f.altKey&&((f.key===`a`||f.key===`b`)&&(f.preventDefault(),l(`code`,Math.max(0,p+ +(f.key===`b`)))),(f.key===`m`||f.key===`y`)&&p>=0&&(f.preventDefault(),u(p,Zr(e.cells[p],f.key===`m`?`markdown`:`python`))),(f.key===`Delete`||f.key===`Backspace`)&&(f.preventDefault(),r({...e,cells:e.cells.filter(e=>!n.includes(e.id))})))}}}function si(e,t,n,r,i){if(!(e.target.closest(`.monaco-editor,input,textarea`)||!r.length)&&!(t!==`paste`&&window.getSelection()?.toString()))if(t===`paste`){let t=e.clipboardData.getData(`text/plain`);if(t.length>5*1024*1024)return;try{let a=JSON.parse(t);if(!a||typeof a!=`object`||!(`puddle_notebook_cells`in a))return;let o=qr(JSON.stringify({nbformat:4,nbformat_minor:5,metadata:{},cells:a.puddle_notebook_cells})).cells;if(e.preventDefault(),n.cells.length+o.length>2e3){Ue.error(`A notebook can contain at most 2,000 cells`);return}let s=[...n.cells],c=Math.max(...s.flatMap((e,t)=>r.includes(e.id)?[t]:[]));s.splice(c+1,0,...o.map(e=>({...e,id:crypto.randomUUID()}))),i({...n,cells:s})}catch{}}else{let a=n.cells.filter(e=>r.includes(e.id));e.clipboardData.setData(`text/plain`,JSON.stringify({puddle_notebook_cells:a})),e.preventDefault(),t===`cut`&&i({...n,cells:n.cells.filter(e=>!r.includes(e.id))})}}function ci({controls:e}){return e.open?(0,P.jsx)(st,{query:e.query,focusKey:e.focusKey,options:e.options,result:e.result,onQueryChange:e.setQuery,onOptionsChange:e.setOptions,onNext:e.next,onPrevious:e.previous,onClose:e.close}):null}function li(e,t){return Math.min(t,Math.max(1,Math.floor(e)))}function ui({notebook:e,focused:t,onReveal:n,onChange:r}){let[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(``),c=(0,N.useRef)(null),l=(0,N.useRef)([]),u=(0,N.useRef)(-1),d=(0,N.useRef)(!1),f=rt({shortcutEnabled:t,onFind:(t,r,a)=>{let o=c.current;if(a===`reset`){l.current=[],u.current=-1;for(let n of e.cells){let e=[{text:I(n.source),output:!1},...i?[{text:(n.outputs??[]).map($r).join(`
5
+ `),output:!0}]:[]];for(let i of e){let e=ot(i.text,t,r,Math.max(0,1e3-l.current.length));if(e.invalid)return{index:-1,count:0,invalid:!0};if(l.current.push(...e.matches.map(e=>({...e,id:n.id,output:i.output}))),l.current.length>=1e3)break}if(l.current.length>=1e3)break}if(d.current&&o){let e=l.current.findIndex(e=>e.id===o.id&&e.output===o.output&&e.start>=o.start);u.current=e>=0?e-1:-1}}let s=l.current.length;return u.current=s?(u.current+(a===`previous`?-1:1)+s)%s:-1,c.current=l.current[u.current]??null,d.current||n(c.current),{index:u.current,count:s,limited:s>=1e3}},onClear:()=>{c.current=null,n(null)}});(0,N.useEffect)(()=>{f.refresh()},[i,f.refresh]);let p=t=>{let n=it(f.query,f.options);if(!n||!r)return;let i=e;e.cells.forEach((e,r)=>{let a=I(e.source),s=c.current;t?i=Jr(i,r,a.replace(n,o)):s&&!s.output&&s.id===e.id&&(i=Jr(i,r,a.slice(0,s.start)+a.slice(s.start,s.end).replace(n,o)+a.slice(s.end)))}),r(i),l.current=[],c.current=null};return(0,N.useEffect)(()=>{d.current=c.current!==null,f.open&&f.refresh(),d.current=!1},[e,f.open,f.refresh]),(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(ci,{controls:f}),f.open&&(0,P.jsxs)(`div`,{className:`absolute right-2 top-10 z-30 flex max-w-full flex-wrap items-center gap-2 rounded-b-md bg-surface px-2 py-1.5 text-xs text-fg-secondary`,children:[(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>a(e.target.checked)}),`Include output`]}),r&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`input`,{"aria-label":`Replace in notebook`,value:o,onChange:e=>s(e.target.value),placeholder:`Replace`,className:`min-w-0 bg-ground px-2 py-1 outline-none`}),(0,P.jsx)(`button`,{type:`button`,className:`cursor-pointer hover:text-fg`,disabled:!f.query||!!c.current?.output,onClick:()=>p(!1),children:`Replace`}),(0,P.jsx)(`button`,{type:`button`,className:`cursor-pointer hover:text-fg`,disabled:!f.query,onClick:()=>p(!0),children:`Replace all`})]})]})]})}function di(e){return ue({queryKey:[`notebook-kernels`],queryFn:()=>k(`GET`,`/api/notebooks/kernels`),enabled:e,staleTime:3e4})}function fi(e,t){return ue({queryKey:[`notebook-kernel`,e],queryFn:()=>k(`POST`,`/api/notebooks/status`,{source:e}),enabled:t,refetchInterval:1500,retry:!1})}function pi(e){return k(`POST`,`/api/notebooks/kernel`,e)}function mi(e,t){return ue({queryKey:[`notebook-environments`,e],queryFn:()=>k(`POST`,`/api/notebooks/environments`,{source:e}),enabled:t,staleTime:3e4,retry:!1})}function hi(e,t,n,r){let i=re(),a=r&&!f()&&ie(i.data?.protocol),o=(0,N.useRef)({notebook:t,onChange:n});o.current={notebook:t,onChange:n};let s=le(),[c,l]=(0,N.useState)(!1),u=(0,N.useRef)(!1),[d,p]=(0,N.useState)(null),m=(0,N.useRef)(!0);(0,N.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let h=[`notebook-execution`,e],g=ue({queryKey:h,queryFn:()=>k(`POST`,`/api/notebooks/execution`,{source:e}),enabled:a,retry:!1,refetchInterval:e=>e.state.data?.execution?.state===`running`?250:1500}),_=g.data?.execution;(0,N.useEffect)(()=>{if(!_||!o.current.notebook||!o.current.onChange)return;let e=ii(o.current.notebook,_);e!==o.current.notebook&&o.current.onChange(e)},[_]);let v=async t=>{let n=o.current.notebook;if(!a||!n||u.current||_?.state===`running`)return;let r=n.cells.flatMap((e,n)=>e.cell_type===`code`&&I(e.source).trim()&&(!t||t.includes(n))?[{id:e.id,source:I(e.source)}]:[]);if(r.length){u.current=!0,l(!0),p(null),o.current.onChange?.(n);try{let t=n.metadata.kernelspec,i=await k(`POST`,`/api/notebooks/execute`,{source:e,cells:r,...t?.name?{kernel:t.name}:{}});m.current&&s.setQueryData(h,i)}catch(e){m.current&&p(e instanceof Error?e.message:`Notebook execution failed`)}finally{u.current=!1,m.current&&(l(!1),s.invalidateQueries({queryKey:h}))}}},y=(0,N.useRef)(v);return y.current=v,(0,N.useEffect)(()=>a?Oe(e,()=>{y.current()}):void 0,[a,e.session,e.path,e.root]),{supported:a,intelligenceSupported:a&&ae(i.data?.protocol),run:v,interrupt:async()=>{try{await pi({source:e,action:`interrupt`})}catch(e){m.current&&p(e instanceof Error?e.message:`Interrupt failed`)}finally{s.invalidateQueries({queryKey:h})}},execution:_,busy:c||_?.state===`running`,error:d??(g.error instanceof Error?g.error.message:_?.error)}}var gi=(0,N.createContext)(null);function _i({source:e,environment:t,current:n,kernels:r,pending:i,onAction:a}){let[o,s]=(0,N.useState)(!1),[c,l]=(0,N.useState)(``),u=(0,N.useId)(),d=mi(e,o),f=[...d.data?.environments??[]];t&&!f.some(e=>e.python===t.python)&&f.unshift(t);let p=e=>{s(!1),a(e)};return(0,P.jsxs)(Ct,{open:o,onOpenChange:s,children:[(0,P.jsx)(St,{asChild:!0,children:(0,P.jsxs)(`button`,{type:`button`,disabled:i,"aria-label":`Select Python environment`,title:t?.python??`Changing environments starts a fresh kernel`,className:`flex max-w-64 cursor-pointer items-center gap-1.5 rounded-sm px-2 py-1.5 text-xs text-fg-secondary hover:bg-surface hover:text-fg disabled:cursor-default disabled:opacity-40`,children:[(0,P.jsx)(an,{className:`size-3.5 shrink-0`}),(0,P.jsx)(`span`,{className:`truncate`,children:t?.label??n?.display_name??`Select environment`})]})}),(0,P.jsxs)(xt,{align:`end`,className:`w-96 max-w-[calc(100vw-2rem)] p-3`,children:[(0,P.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:`Python environments on this host`}),(0,P.jsxs)(`div`,{className:`max-h-64 overflow-y-auto`,"aria-label":`Python environments`,children:[d.isLoading&&(0,P.jsx)(`p`,{role:`status`,className:`py-2 text-xs text-fg-muted`,children:`Looking for environments…`}),d.isError&&(0,P.jsx)(`p`,{role:`alert`,className:`py-2 text-xs text-danger`,children:`Couldn’t discover environments. You can enter a path below.`}),d.data&&!f.length&&(0,P.jsx)(`p`,{className:`py-2 text-xs text-fg-muted`,children:`No Python environments found. Enter a path below.`}),f.map(n=>(0,P.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>p({source:e,action:`select-python`,python:n.python}),className:`flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-2 text-left hover:bg-surface disabled:cursor-default disabled:opacity-40`,children:[(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`p`,{className:`text-xs text-fg`,children:n.label}),(0,P.jsx)(`p`,{className:`break-all text-xs text-fg-muted`,children:n.python}),(n.error||!n.ipykernel||!n.nbconvert)&&(0,P.jsx)(`p`,{className:`text-xs text-fg-secondary`,children:n.error?`Couldn’t inspect this Python`:n.ipykernel?`nbconvert not installed`:`ipykernel not installed`})]}),t?.python===n.python&&(0,P.jsx)(Qe,{className:`size-3.5 shrink-0 text-accent`})]},n.python)),r.length>0&&(0,P.jsx)(`p`,{className:`mb-1 mt-3 text-xs text-fg-muted`,children:`Registered Jupyter kernels`}),r.map(r=>(0,P.jsxs)(`button`,{type:`button`,disabled:i,className:`flex w-full cursor-pointer items-center justify-between rounded-sm px-2 py-2 text-left text-xs text-fg-secondary hover:bg-surface hover:text-fg`,onClick:()=>p({source:e,action:`select`,kernel:r.name}),children:[r.display_name,!t&&n?.name===r.name&&(0,P.jsx)(Qe,{className:`size-3.5`})]},r.name))]}),(0,P.jsxs)(`form`,{className:`mt-3 flex flex-col gap-2`,onSubmit:t=>{t.preventDefault(),c.trim()&&p({source:e,action:`select-python`,python:c.trim()})},children:[(0,P.jsx)(`label`,{htmlFor:u,className:`text-xs text-fg-secondary`,children:`Environment folder or Python executable`}),(0,P.jsx)(Ge,{id:u,value:c,onChange:e=>l(e.target.value),placeholder:`.venv, ~/miniforge3/envs/analysis, /path/to/python`,disabled:i}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Relative paths start beside this notebook. Switching starts fresh.`}),(0,P.jsx)(`button`,{type:`submit`,disabled:i||!c.trim(),className:`cursor-pointer self-end rounded-sm px-2 py-1.5 text-xs text-fg-secondary hover:bg-surface hover:text-fg disabled:cursor-default disabled:opacity-40`,children:`Use path`})]})]})]})}var vi=`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 yi({source:e,notebook:t,onSelect:n}){let r=(0,N.useRef)(n);r.current=n;let i=(0,N.useRef)(!0);(0,N.useEffect)(()=>(i.current=!0,()=>{i.current=!1}),[]);let a=re(),o=se(a.data?.protocol),s=ce(a.data?.protocol),c=di(o),l=fi(e,o),u=le(),[d,f]=(0,N.useState)(null),p=d!==null,[m,h]=(0,N.useState)(null);if(!o)return null;let g=t.metadata.kernelspec,_=l.data?.kernel??(typeof g?.name==`string`?g.name:``),v=c.data?.kernels??[],y=v.find(e=>e.name===_),b=l.data?.environment,x=b&&!b.error?[!b.ipykernel&&`ipykernel`,!b.nbconvert&&`nbconvert`].filter(Boolean).join(` and `):``,S=l.data&&l.data.state!==`stopped`&&l.data.state!==`dead`,C=l.data?.state===`busy`||l.data?.state===`starting`,w=async t=>{f(t.action),h(null);try{let n=await pi(t);if(u.setQueryData([`notebook-kernel`,e],n),(t.action===`select-python`||t.action===`install-python`)&&(u.invalidateQueries({queryKey:[`notebook-environments`]}),i.current&&r.current({name:`python3`,display_name:`Python 3`,language:`python`})),t.action===`select`){let e=v.find(e=>e.name===t.kernel);e&&i.current&&r.current(e)}}catch(e){h(e instanceof Error?e.message:`Kernel operation failed`)}finally{f(null)}};return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[C&&(0,P.jsxs)(`button`,{type:`button`,className:vi,disabled:p,onClick:()=>void w({source:e,action:`interrupt`}),children:[(0,P.jsx)(Fe,{className:`size-3.5`}),`Interrupt`]}),(0,P.jsx)(`span`,{className:`text-xs text-fg-muted`,role:`status`,children:p?d===`install-python`?`Installing…`:`Updating…`:l.data?.state===`dead`?`Kernel exited`:C?`Busy`:S?`Idle`:``}),s?(0,P.jsx)(_i,{source:e,environment:b,current:y,kernels:v,pending:p,onAction:w}):(0,P.jsxs)(et,{value:y?.name??``,disabled:p||!c.data?.available||v.length===0,onValueChange:t=>void w({source:e,action:`select`,kernel:t}),children:[(0,P.jsxs)(Xe,{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,P.jsx)(an,{className:`size-3.5 shrink-0`}),(0,P.jsx)(Ye,{placeholder:_?`${_} (not installed)`:`Select Kernel`})]}),(0,P.jsx)(Ze,{children:v.map(e=>(0,P.jsx)($e,{value:e.name,detail:e.language,children:(0,P.jsx)(`span`,{children:e.display_name})},e.name))})]}),(0,P.jsxs)(Le,{children:[(0,P.jsx)(Be,{asChild:!0,children:(0,P.jsx)(`button`,{type:`button`,className:vi,disabled:p,"aria-label":`Kernel actions`,children:(0,P.jsx)(Ae,{className:`size-3.5`})})}),(0,P.jsxs)(ke,{align:`end`,children:[(0,P.jsxs)(Ee,{disabled:!y&&!b,onSelect:()=>void w({source:e,action:`restart`}),children:[(0,P.jsx)(lt,{}),`Restart kernel`]}),(0,P.jsxs)(Ee,{disabled:!S,onSelect:()=>void w({source:e,action:`shutdown`}),children:[(0,P.jsx)(We,{}),`Shut down kernel`]})]})]})]}),x&&(0,P.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-2 px-2 text-xs text-fg-muted`,children:[(0,P.jsxs)(`span`,{className:`break-all`,children:[x,` missing from `,b?.python,`.`]}),(0,P.jsxs)(`button`,{type:`button`,className:vi,disabled:p,onClick:()=>{b&&w({source:e,action:`install-python`,python:b.python})},children:[`Install `,x]})]}),(m||l.data?.error||!s&&(c.data?.error||c.isError)||l.isError)&&(0,P.jsx)(`p`,{role:`alert`,className:`w-full px-2 text-xs text-danger`,children:m??l.data?.error??c.data?.error??`Couldn’t load notebook kernels`}),!s&&c.data&&!c.data.available&&!c.data.error&&(0,P.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 bi=`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 xi({notebook:e,source:t,onChange:n,onAdd:r,onRevealCell:i,onRun:a,onRunCopy:o,onRunSection:s,running:c=!1}){let[l,u]=(0,N.useState)(!1),d=re(),f=fi(t,!!a&&se(d.data?.protocol)),p=c||f.data?.state===`busy`||f.data?.state===`starting`,m=f.data?.environment,h=m&&(!m.ipykernel||!m.nbconvert),g=ni(e),_=e.cells.some(e=>e.cell_type===`code`&&((e.outputs?.length??0)>0||e.execution_count!=null));return(0,P.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,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,className:bi,disabled:e.cells.length>=2e3,onClick:()=>r(`code`),"aria-label":`Add code cell`,children:[(0,P.jsx)(qe,{className:`size-3.5`}),`Code`]}),(0,P.jsxs)(`button`,{type:`button`,className:bi,disabled:e.cells.length>=2e3,onClick:()=>r(`markdown`),"aria-label":`Add Markdown cell`,children:[(0,P.jsx)(qe,{className:`size-3.5`}),`Markdown`]})]}),a&&(0,P.jsxs)(`button`,{type:`button`,className:bi,disabled:p||h,onClick:a,children:[(0,P.jsx)(Re,{className:`size-3.5`}),p?`Running…`:`Run All`]}),n&&(0,P.jsxs)(`button`,{type:`button`,className:bi,disabled:!_,onClick:()=>n(ti(e)),children:[(0,P.jsx)(Ke,{className:`size-3.5`}),`Clear All Outputs`]}),(0,P.jsxs)(Ct,{open:l,onOpenChange:u,children:[(0,P.jsx)(St,{asChild:!0,children:(0,P.jsxs)(`button`,{type:`button`,className:bi,disabled:g.length===0,children:[(0,P.jsx)(on,{className:`size-3.5`}),`Outline`]})}),(0,P.jsx)(xt,{align:`start`,className:`max-h-72 w-72 overflow-y-auto p-1`,children:(0,P.jsx)(`nav`,{"aria-label":`Notebook outline`,className:`flex flex-col`,children:g.map(e=>(0,P.jsxs)(`div`,{className:`group/outline flex items-center`,style:{paddingLeft:`calc(var(--spacing) * ${Math.max(0,e.level-1)*3})`},children:[(0,P.jsxs)(`button`,{type:`button`,className:`${bi} min-w-0 flex-1 text-left`,onClick:()=>{i(e.index),u(!1)},children:[(0,P.jsx)(`span`,{className:`w-5 shrink-0 text-fg-muted`,children:e.index+1}),(0,P.jsx)(`span`,{className:`truncate`,children:e.label})]}),!!e.level&&s&&(0,P.jsx)(`button`,{type:`button`,disabled:p,title:`Run Section`,"aria-label":`Run section ${e.label}`,className:`${bi} opacity-0 group-hover/outline:opacity-100 focus:opacity-100 pointer-coarse:opacity-100`,onClick:()=>{s(e.index),u(!1)},children:(0,P.jsx)(Re,{className:`size-3.5`})})]},e.index))})})]}),n&&(0,P.jsxs)(Le,{children:[(0,P.jsx)(Be,{asChild:!0,children:(0,P.jsx)(`button`,{type:`button`,className:bi,"aria-label":`More notebook actions`,children:(0,P.jsx)(Ae,{className:`size-3.5`})})}),(0,P.jsxs)(ke,{align:`start`,children:[o&&(0,P.jsx)(Ee,{disabled:p,onSelect:o,children:`Run to Executed Copy`}),(0,P.jsxs)(Ee,{disabled:e.cells.length>=2e3,onSelect:()=>r(`raw`),children:[(0,P.jsx)(qe,{}),`Add raw cell`]})]})]}),n&&a&&(0,P.jsx)(yi,{source:t,notebook:e,onSelect:t=>n({...e,metadata:{...e.metadata,kernelspec:t}})},JSON.stringify(t))]})}function Si({code:e,onRun:t,busy:n,index:r,count:i,canMerge:a,onOperation:o}){let s=(e,t,n,r=!1)=>(0,P.jsx)(`button`,{type:`button`,className:`cursor-pointer rounded-sm p-1 text-fg-muted hover:bg-surface hover:text-fg disabled:cursor-default disabled:opacity-40`,title:e,"aria-label":e,onClick:n,disabled:r,children:t});return(0,P.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center opacity-0 focus-within:opacity-100 group-hover/cell:opacity-100 pointer-coarse:opacity-100`,children:[e&&t&&(0,P.jsxs)(P.Fragment,{children:[s(`Run Cell`,(0,P.jsx)(Re,{className:`size-3.5`}),()=>t(`cell`),n),s(`Run Above`,(0,P.jsx)(nn,{className:`size-3.5`}),()=>t(`above`),n||r===0),s(`Run Cell and Below`,(0,P.jsx)(tn,{className:`size-3.5`}),()=>t(`below`),n)]}),s(`Insert cell below`,(0,P.jsx)(qe,{className:`size-3.5`}),()=>o(`insert`),i>=2e3),s(`Duplicate cell`,(0,P.jsx)(ct,{className:`size-3.5`}),()=>o(`duplicate`),i>=2e3),s(`Merge with next cell`,(0,P.jsx)(rn,{className:`size-3.5`}),()=>o(`merge`),!a),s(`Move cell up`,(0,P.jsx)(Ie,{className:`size-3.5`}),()=>o(`up`),r===0),s(`Move cell down`,(0,P.jsx)(ze,{className:`size-3.5`}),()=>o(`down`),r===i-1),s(`Delete cell`,(0,P.jsx)(Ke,{className:`size-3.5`}),()=>o(`delete`))]})}function Ci(e,t){let n=async(n,r,i)=>{let a=e.getValue();if(a.length>65536||i.isCancellationRequested)return null;let o=e.getVersionId();try{let s=await k(`POST`,`/api/notebooks/intelligence`,{source:t,kind:n,code:a,cursor:[...a.slice(0,e.getOffsetAt(r))].length});return i.isCancellationRequested||e.isDisposed()||o!==e.getVersionId()?null:{response:s,code:a}}catch{return null}},r=()=>{let t=e.getLanguageId();return t===`markdown`||t===`plaintext`?[]:[T.registerCompletionItemProvider(t,{triggerCharacters:[`.`],async provideCompletionItems(t,r,i,a){if(t!==e)return{suggestions:[]};let o=await n(`complete`,r,a);if(!o)return{suggestions:[]};let{response:s,code:c}=o,l=e.getPositionAt([...c].slice(0,s.start).join(``).length),u=e.getPositionAt([...c].slice(0,s.end).join(``).length),d=new ee(l.lineNumber,l.column,u.lineNumber,u.column);return{suggestions:s.matches.map(e=>({label:e,insertText:e,kind:T.CompletionItemKind.Text,range:d}))}}}),T.registerHoverProvider(t,{async provideHover(t,r,i){if(t!==e)return null;let a=await n(`inspect`,r,i);return a?.response.documentation?{contents:[{value:a.response.documentation.replace(/\u001b\[[0-?]*[ -/]*[@-~]/g,``).replace(/[\\`*_{}[\]()#+.!<>-]/g,`\\$&`),isTrusted:!1,supportHtml:!1}]}:null}})]},i=r(),a=e.onDidChangeLanguage(()=>{i.forEach(e=>e.dispose()),i=r()});return{dispose(){a.dispose(),i.forEach(e=>e.dispose())}}}function wi({value:e,language:t,label:n,focus:r,onChange:i,onExecute:a,onEscape:o,onSplit:s,onSave:c,match:l}){let u=g(),d=(0,N.useContext)(gi),[f,p]=(0,N.useState)(null);(0,N.useEffect)(()=>{if(!f||!d?.intelligence)return;let e=Ci(f,{session:d.session,path:d.path,...d.root?{root:d.root}:{}});return()=>e.dispose()},[f,d?.intelligence,d?.session,d?.path,d?.root]);let m=(0,N.useRef)(null),h=(0,N.useRef)(null),_=(0,N.useRef)(null),v=(0,N.useRef)(!1),y=(0,N.useRef)(null),b=(0,N.useRef)({onChange:i,onExecute:a,onEscape:o,onSplit:s,onSave:c});b.current={onChange:i,onExecute:a,onEscape:o,onSplit:s,onSave:c};let x=(0,N.useRef)(l);x.current=l;let S=e=>{let t=e.getModel(),n=x.current;if(!t||!n)return;let r=t.getPositionAt(n.start),i=t.getPositionAt(n.end);e.setSelection(new ee(r.lineNumber,r.column,i.lineNumber,i.column)),e.revealPositionInCenter(r)};(0,N.useEffect)(()=>{h.current&&S(h.current)},[l]);let[C,w]=(0,N.useState)(!1),[T,k]=(0,N.useState)(Math.max(64,e.split(`
6
+ `).length*22+24));return(0,N.useEffect)(()=>{let e=new IntersectionObserver(([e])=>w(!!e?.isIntersecting),{rootMargin:`600px`});return m.current&&e.observe(m.current),()=>e.disconnect()},[]),(0,N.useEffect)(()=>()=>{_.current?.dispose()},[]),(0,N.useEffect)(()=>{let n=_.current;n&&n.getValue()!==e&&(v.current=!0,n.pushEditOperations([],[{range:n.getFullModelRange(),text:e}],()=>null),v.current=!1),n&&D.setModelLanguage(n,t)},[e,t]),(0,N.useEffect)(()=>{r&&h.current?.focus()},[r]),(0,P.jsx)(`div`,{ref:m,style:{height:T},className:`min-w-0 rounded-md bg-surface`,children:(C||r)&&(0,P.jsx)(Mt,{theme:`puddle`,defaultValue:e,defaultLanguage:t,keepCurrentModel:!0,saveViewState:!1,onMount:e=>{if(_.current){let t=e.getModel();e.setModel(_.current),t!==_.current&&t?.dispose()}else _.current=e.getModel();h.current=e,p(e.getModel()),sr(e,{onSave:()=>b.current.onSave()}),y.current&&e.restoreViewState(y.current);let t=()=>k(Math.max(64,e.getContentHeight())),n=e.onDidContentSizeChange(t),i=e.onDidChangeModelContent(()=>{v.current||b.current.onChange(e.getValue())}),a=e.onDidScrollChange(()=>{y.current=e.saveViewState()}),o=e.onDidChangeCursorSelection(()=>{y.current=e.saveViewState()});e.addCommand(E.CtrlCmd|O.Enter,()=>b.current.onExecute(`stay`)),e.addCommand(E.Shift|O.Enter,()=>b.current.onExecute(`next`)),e.addCommand(E.Alt|O.Enter,()=>b.current.onExecute(`insert`)),e.addCommand(O.Escape,()=>b.current.onEscape(),`!suggestWidgetVisible && !findWidgetVisible`),e.addCommand(E.CtrlCmd|E.Shift|O.Minus,()=>{let t=e.getPosition();t&&b.current.onSplit(e.getModel().getOffsetAt(t))}),e.onDidDispose(()=>{n.dispose(),a.dispose(),o.dispose(),i.dispose(),h.current=null,p(null)}),t(),S(e),r&&e.focus()},beforeMount:()=>{_.current&&D.setModelLanguage(_.current,t)},options:{ariaLabel:n,automaticLayout:!0,fontFamily:getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim(),fontSize:u.editorFontSize,...wn(u.editorTabSize),wordWrap:u.editorWordWrap?`on`:`off`,minimap:{enabled:!1},glyphMargin:!1,folding:!0,lineNumbers:`off`,lineDecorationsWidth:8,lineNumbersMinChars:3,scrollBeyondLastLine:!1,fixedOverflowWidgets:!0,padding:{top:12,bottom:12},renderLineHighlight:`none`,occurrencesHighlight:`off`,scrollbar:{alwaysConsumeMouseWheel:!1}},onChange:()=>{h.current&&(y.current=h.current.saveViewState())}})})}function Ti({language:e,onChange:t}){let[n,r]=(0,N.useState)(!1),i=[`markdown`,`raw`,...T.getLanguages().map(e=>e.id).filter(e=>e!==`markdown`).sort()];return(0,P.jsxs)(Ct,{open:n,onOpenChange:r,children:[(0,P.jsx)(St,{asChild:!0,children:(0,P.jsxs)(`button`,{type:`button`,"aria-label":`Cell language: ${e}`,className:`flex cursor-pointer items-center gap-1 font-mono text-xs text-fg-muted hover:text-fg`,children:[e,(0,P.jsx)(tt,{className:`size-3`})]})}),(0,P.jsxs)(xt,{align:`start`,className:`w-56 p-0`,children:[(0,P.jsxs)(bt,{children:[(0,P.jsx)(gt,{placeholder:`Find a language…`}),(0,P.jsxs)(yt,{children:[(0,P.jsx)(vt,{children:`No matching languages`}),i.map(e=>(0,P.jsx)(_t,{onSelect:()=>{t(e),r(!1)},children:e},e))]})]}),(0,P.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Code languages set highlighting. Execution uses the notebook kernel.`})]})]})}var Ei={};function Di(e){let t=Ei[e];if(t)return t;t=Ei[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 Oi(e,t){typeof t!=`string`&&(t=Oi.defaultChars);let n=Di(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})}Oi.defaultChars=`;/?:@&=+$,#`,Oi.componentChars=``;var ki={};function Ai(e){let t=ki[e];if(t)return t;t=ki[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 ji(e,t,n){typeof t!=`string`&&(n=t,t=ji.defaultChars),n===void 0&&(n=!0);let r=Ai(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}ji.defaultChars=`;/?:@&=+$,-_.!~*'()#`,ji.componentChars=`-_.!~*'()`;function Mi(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 Ni(){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 Pi=/^([a-z0-9.+-]+:)/i,Fi=/:[0-9]*$/,Ii=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Li=[`%`,`/`,`?`,`;`,`#`,`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,`
7
+ `,` `],Ri=[`/`,`?`,`#`],zi=255,Bi=/^[+a-z0-9A-Z_-]{0,63}$/,Vi=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Hi={javascript:!0,"javascript:":!0},Ui={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Wi(e,t){if(e&&e instanceof Ni)return e;let n=new Ni;return n.parse(e,t),n}Ni.prototype.parse=function(e,t){let n,r,i,a=e;if(a=a.trim(),!t&&e.split(`#`).length===1){let e=Ii.exec(a);if(e)return this.pathname=e[1],e[2]&&(this.search=e[2]),this}let o=Pi.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&&Hi[o])&&(a=a.substr(2),this.slashes=!0)),!Hi[o]&&(i||o&&!Ui[o])){let e=-1;for(let t=0;t<Ri.length;t++)r=a.indexOf(Ri[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<Li.length;t++)r=a.indexOf(Li[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(Bi)){let r=``;for(let e=0,t=n.length;e<t;e++)n.charCodeAt(e)>127?r+=`x`:r+=n[e];if(!r.match(Bi)){let r=e.slice(0,t),i=e.slice(t+1),o=n.match(Vi);o&&(r.push(o[1]),i.unshift(o[2])),i.length&&(a=i.join(`.`)+a),this.hostname=r.join(`.`);break}}}}this.hostname.length>zi&&(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),Ui[n]&&this.hostname&&!this.pathname&&(this.pathname=``),this},Ni.prototype.parseHost=function(e){let t=Fi.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 Gi=e({decode:()=>Oi,encode:()=>ji,format:()=>Mi,parse:()=>Wi}),Ki=e({Any:()=>qi,Cc:()=>Ji,Cf:()=>Yi,P:()=>Xi,S:()=>Zi,Z:()=>Qi}),qi=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Ji=/[\0-\x1F\x7F-\x9F]/,Yi=/[\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]/,Xi=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\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\u2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F1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDD6D-\uDD6F\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD839\uDDFF|\uD83A[\uDD5E\uDD5F]/,Zi=/[\$\+<->\^`\|~\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]/,Qi=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,$i=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 ea(e){return e>=55296&&e<=57343||e>1114111?65533:$i.get(e)??e}function ta(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 na=ta(`QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdAB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gCTB75jAAFBYWYuaS5yAPIA4AJyAPIAjAdhAPAAeh5pAHMAAKD7IoABZHB0APgReS6DLgABZmx9LoAuAOA12GnddQDzAP8RaQBtAOUABBIAAUFhiy6OLnIA8gDuAnIA8gCaBwABY3GVLgoScgAA4DXYzdwAAXB0nS6hLmwAdQDzACUScgDpACASAARhY2VmaW9zdbEuvC7ELsguzC7PLtQu2S5jAAABdXm2LrsudABlADuA/QD9QE9kAAFpecAuwy5yAGMAd2FLZG4AO4ClAKVAcgAA4DXYNt1jAHkAV2RwAGYAAOA12GrdYwByAADgNdjO3AABY23dLt8ueQBOZGwAO4D/AP9AAAVhY2RlZmhpb3N38y73Lv8uAi8MLxAvEy8YLx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg`),L;(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`})(L||={});var R;(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`})(R||={});var ra=32;function ia(e){return e>=R.ZERO&&e<=R.NINE}function aa(e){return e>=R.UPPER_A&&e<=R.UPPER_F||e>=R.LOWER_A&&e<=R.LOWER_F}function oa(e){return e>=R.UPPER_A&&e<=R.UPPER_Z||e>=R.LOWER_A&&e<=R.LOWER_Z||ia(e)}function sa(e){return e===R.EQUALS||oa(e)}var z;(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`})(z||={});var ca;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(ca||={});var la=class{decodeTree;emitCodePoint;errors;constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n}state=z.EntityStart;consumed=1;result=0;treeIndex=0;excess=1;decodeMode=ca.Strict;runConsumed=0;startEntity(e){this.decodeMode=e,this.state=z.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(e,t){switch(this.state){case z.EntityStart:return e.charCodeAt(t)===R.NUM?(this.state=z.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=z.NamedEntity,this.stateNamedEntity(e,t));case z.NumericStart:return this.stateNumericStart(e,t);case z.NumericDecimal:return this.stateNumericDecimal(e,t);case z.NumericHex:return this.stateNumericHex(e,t);case z.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|ra)===R.LOWER_X?(this.state=z.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=z.NumericDecimal,this.stateNumericDecimal(e,t))}stateNumericHex(e,t){for(;t<e.length;){let n=e.charCodeAt(t);if(ia(n)||aa(n)){let e=n<=R.NINE?n-R.ZERO:(n|ra)-R.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(ia(n))this.result=this.result*10+(n-R.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===R.SEMI)this.consumed+=1;else if(this.decodeMode===ca.Strict)return 0;return this.emitCodePoint(ea(this.result),this.consumed),this.errors&&(e!==R.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&L.VALUE_LENGTH)>>14;for(;t<e.length;){if(i===0&&(r&L.FLAG13)!==0){let a=(r&L.BRANCH_LENGTH)>>7;if(this.runConsumed===0){let n=r&L.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&L.VALUE_LENGTH)>>14}if(t>=e.length)break;let a=e.charCodeAt(t);if(a===R.SEMI&&i!==0&&(r&L.FLAG13)!==0)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);if(this.treeIndex=da(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===ca.Attribute&&(i===0||sa(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&L.VALUE_LENGTH)>>14,i!==0){if(a===R.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==ca.Strict&&(r&L.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]&L.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]&~(L.VALUE_LENGTH|L.FLAG13):r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){switch(this.state){case z.NamedEntity:return this.result!==0&&(this.decodeMode!==ca.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case z.NumericDecimal:return this.emitNumericEntity(0,2);case z.NumericHex:return this.emitNumericEntity(0,3);case z.NumericStart:return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case z.EntityStart:return 0}}};function ua(e){let t=``,n=new la(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 da(e,t,n,r){let i=(t&L.BRANCH_LENGTH)>>7,a=t&L.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 fa=ua(na);function pa(e){return fa(e,ca.Strict)}String.prototype.codePointAt;function ma(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 ha=ma(/["&\u00A0]/g,new Map([[34,`&quot;`],[38,`&amp;`],[160,`&nbsp;`]])),ga=ma(/[&<>\u00A0]/g,new Map([[38,`&amp;`],[60,`&lt;`],[62,`&gt;`],[160,`&nbsp;`]])),_a=class{src_Any=qi.source;src_Cc=Ji.source;src_Z=Qi.source;src_P=Xi.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`)}},va={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)},ya={"http:":va,"https:":va,"ftp:":va,"//":{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)}},ba=`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`,xa=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`;function Sa(){let e=xa.split(`|`);return ba.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 Ca={fuzzyLink:!1,fuzzyEmail:!0,fuzzyIP:!1,"---":!1,tlds:Sa(),urlAuth:!1,maxLength:1e4},wa=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}},Ta=class{__opts__;__schemas__;re;constructor(e={}){let{rebuilder:t,...n}=e;this.__opts__={...Ca,...n},this.__schemas__={...ya},this.re=t||new _a,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 wa(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 wa(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}`)}},Ea=2147483647,Da=36,Oa=1,ka=26,Aa=38,ja=700,Ma=72,Na=128,Pa=`-`,Fa=/^xn--/,Ia=/[^\0-\x7F]/,La=/[\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`},za=Da-Oa,Ba=Math.floor,Va=String.fromCharCode;function Ha(e){throw RangeError(Ra[e])}function Ua(e,t){let n=[],r=e.length;for(;r--;)n[r]=t(e[r]);return n}function Wa(e,t){let n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(La,`.`);let i=Ua(e.split(`.`),t).join(`.`);return r+i}function Ga(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 Ka=e=>String.fromCodePoint(...e),qa=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:Da},Ja=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},Ya=function(e,t,n){let r=0;for(e=n?Ba(e/ja):e>>1,e+=Ba(e/t);e>455;r+=Da)e=Ba(e/za);return Ba(r+36*e/(e+Aa))},Xa=function(e){let t=[],n=e.length,r=0,i=Na,a=Ma,o=e.lastIndexOf(Pa);o<0&&(o=0);for(let n=0;n<o;++n)e.charCodeAt(n)>=128&&Ha(`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=Da;;i+=Da){s>=n&&Ha(`invalid-input`);let o=qa(e.charCodeAt(s++));o>=Da&&Ha(`invalid-input`),o>Ba((Ea-r)/t)&&Ha(`overflow`),r+=o*t;let c=i<=a?Oa:i>=a+ka?ka:i-a;if(o<c)break;let l=Da-c;t>Ba(Ea/l)&&Ha(`overflow`),t*=l}let c=t.length+1;a=Ya(r-o,c,o==0),Ba(r/c)>Ea-i&&Ha(`overflow`),i+=Ba(r/c),r%=c,t.splice(r++,0,i)}return String.fromCodePoint(...t)},Za=function(e){let t=[];e=Ga(e);let n=e.length,r=Na,i=0,a=Ma;for(let n of e)n<128&&t.push(Va(n));let o=t.length,s=o;for(o&&t.push(Pa);s<n;){let n=Ea;for(let t of e)t>=r&&t<n&&(n=t);let c=s+1;n-r>Ba((Ea-i)/c)&&Ha(`overflow`),i+=(n-r)*c,r=n;for(let n of e)if(n<r&&++i>Ea&&Ha(`overflow`),n===r){let e=i;for(let n=Da;;n+=Da){let r=n<=a?Oa:n>=a+ka?ka:n-a;if(e<r)break;let i=e-r,o=Da-r;t.push(Va(Ja(r+i%o,0))),e=Ba(i/o)}t.push(Va(Ja(e,0))),a=Ya(i,c,s===o),i=0,++s}++i,++r}return t.join(``)},Qa={version:`2.3.1`,ucs2:{decode:Ga,encode:Ka},decode:Xa,encode:Za,toASCII:function(e){return Wa(e,function(e){return Ia.test(e)?`xn--`+Za(e):e})},toUnicode:function(e){return Wa(e,function(e){return Fa.test(e)?Xa(e.slice(4).toLowerCase()):e})}},$a=Object.defineProperty,eo=(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},to=eo({arrayReplaceAt:()=>ro,asciiTrim:()=>Eo,callable:()=>no,escapeHtml:()=>_o,escapeRE:()=>yo,fromCodePoint:()=>ao,isMdAsciiPunct:()=>Co,isPunctChar:()=>xo,isPunctCharCode:()=>So,isSpace:()=>B,isValidEntityCode:()=>io,isWhiteSpace:()=>bo,lib:()=>Do,normalizeReference:()=>wo,unescapeAll:()=>fo,unescapeMd:()=>uo});function no(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 ro(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function io(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 ao(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 oo=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,so=RegExp(`${oo.source}|&([a-z#][a-z0-9]{1,31});`,`gi`),co=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function lo(e,t){if(t.charCodeAt(0)===35&&co.test(t)){let n=t[1].toLowerCase()===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return io(n)?ao(n):e}let n=pa(e);return n===e?e:n}function uo(e){return e.indexOf(`\\`)<0?e:e.replace(oo,`$1`)}function fo(e){return e.indexOf(`\\`)<0&&e.indexOf(`&`)<0?e:e.replace(so,function(e,t,n){return t||lo(e,n)})}var po=/[&<>"]/,mo=/[&<>"]/g,ho={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`};function go(e){return ho[e]}function _o(e){return po.test(e)?e.replace(mo,go):e}var vo=/[.?*+^$[\]\\(){}|-]/g;function yo(e){return e.replace(vo,`\\$&`)}function B(e){switch(e){case 9:case 32:return!0}return!1}function bo(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 xo(e){return Xi.test(e)||Zi.test(e)}function So(e){return xo(ao(e))}function Co(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 wo(e){return e=e.trim().replace(/\s+/g,` `),e.toLowerCase().toUpperCase()}function To(e){return e===32||e===9||e===10||e===13}function Eo(e){let t=0;for(;t<e.length&&To(e.charCodeAt(t));t++);let n=e.length-1;for(;n>=t&&To(e.charCodeAt(n));n--);return e.slice(t,n+1)}var Do={mdurl:Gi,ucmicro:Ki};function Oo(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 ko(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=fo(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=fo(e.slice(t,i)),a.pos=i,a.ok=!0,a)}function Ao(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+=fo(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+=fo(e.slice(t,a)),o}var jo=eo({parseLinkDestination:()=>ko,parseLinkLabel:()=>Oo,parseLinkTitle:()=>Ao});function Mo(e){"@babel/helpers - typeof";return Mo=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},Mo(e)}function No(e,t){if(Mo(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Mo(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Po(e){var t=No(e,`string`);return Mo(t)==`symbol`?t:t+``}function V(e,t,n){return(t=Po(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Fo=class{constructor(e,t,n){V(this,`map`,null),V(this,`level`,0),V(this,`children`,null),V(this,`content`,``),V(this,`markup`,``),V(this,`info`,``),V(this,`block`,!1),V(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}`}},Io=class{constructor(){V(this,`__rules__`,[]),V(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]||[]}},Lo={};Lo.code_inline=function(e,t,n,r,i){let a=e[t];return`<code${i.renderAttrs(a)}>${_o(a.content)}</code>`},Lo.code_block=function(e,t,n,r,i){let a=e[t];return`<pre${i.renderAttrs(a)}><code>${_o(e[t].content)}</code></pre>\n`},Lo.fence=function(e,t,n,r,i){let a=e[t],o=a.info?fo(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)||_o(a.content),l.indexOf(`<pre`)===0)return l+`
8
+ `;if(o){let e=a.attrIndex(`class`),t=a.attrs?a.attrs.slice():[];e<0?t.push([`class`,`${n.langPrefix}${s}`]):(t[e]=[t[e][0],t[e][1]],t[e][1]+=` ${n.langPrefix}${s}`);let r={attrs:t};return`<pre><code${i.renderAttrs(r)}>${l}</code></pre>\n`}return`<pre><code${i.renderAttrs(a)}>${l}</code></pre>\n`},Lo.image=function(e,t,n,r,i){let a=e[t];return a.attrs[a.attrIndex(`alt`)][1]=i.renderInlineAsText(a.children,n,r),i.renderToken(e,t,n)},Lo.hardbreak=function(e,t,n){return n.xhtmlOut?`<br />
9
+ `:`<br>
10
+ `},Lo.softbreak=function(e,t,n){return n.breaks?n.xhtmlOut?`<br />
11
+ `:`<br>
12
+ `:`
13
+ `},Lo.text=function(e,t){return _o(e[t].content)},Lo.html_block=function(e,t){return e[t].content},Lo.html_inline=function(e,t){return e[t].content};var Ro=class{constructor(){V(this,`rules`,Object.assign({},Lo))}renderAttrs(e){let t,n,r;if(!e.attrs)return``;for(r=``,t=0,n=e.attrs.length;t<n;t++)r+=` ${_o(e.attrs[t][0])}="${_o(String(e.attrs[t][1]))}"`;return r}renderToken(e,t,n){let r=e[t],i=``;if(r.hidden)return``;let a=t-1;for(;a>=0&&e[a].hidden&&e[a].nesting===0;)a--;r.block&&r.nesting!==-1&&a>=0&&e[a].hidden&&e[a].nesting===-1&&(i+=`
14
+ `),i+=(r.nesting===-1?`</`:`<`)+r.tag,i+=this.renderAttrs(r),r.nesting===0&&n.xhtmlOut&&(i+=` /`);let o=!1;if(r.block&&(o=!0,r.nesting===1)){let n=t+1;for(;n<e.length&&e[n].hidden&&e[n].nesting===0;)n++;if(n<e.length){let t=e[n];(t.type===`inline`||t.hidden||t.nesting===-1&&t.tag===r.tag)&&(o=!1)}}return i+=o?`>
15
+ `:`>`,i}renderInline(e,t,n){let r=``,i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;i[o]===void 0?r+=this.renderToken(e,a,t):r+=i[o](e,a,t,n,this)}return r}renderInlineAsText(e,t,n){let r=``;for(let i=0,a=e.length;i<a;i++)switch(e[i].type){case`text`:case`code_inline`:r+=e[i].content;break;case`image`:r+=this.renderInlineAsText(e[i].children,t,n);break;case`html_inline`:case`html_block`:r+=e[i].content;break;case`softbreak`:case`hardbreak`:r+=`
16
+ `}return r}render(e,t,n){let r=``,i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;o===`inline`?r+=this.renderInline(e[a].children,t,n):i[o]===void 0?r+=this.renderToken(e,a,t):r+=i[o](e,a,t,n,this)}return r}},zo=class{constructor(e,t,n){V(this,`tokens`,[]),V(this,`inlineMode`,!1),V(this,`Token`,Fo),this.src=e,this.env=n,this.md=t}},Bo=/\r\n?|\n/g,Vo=/\0/g;function Ho(e){let t;t=e.src.replace(Bo,`
17
+ `),t=t.replace(Vo,`�`),e.src=t}function Uo(e){let t;e.inlineMode?(t=new e.Token(`inline`,``,0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function Wo(e){let t=e.tokens,n=0;for(let e=0;e<t.length;e++)t[e].type!==`reference_definition`&&(e!==n&&(t[n]=t[e]),n++);t.length!==n&&(t.length=n)}function Go(e){let t=e.tokens;for(let n=0,r=t.length;n<r;n++){let r=t[n];r.type===`inline`&&e.md.inline.parse(r.content,e.md,e.env,r.children)}}function Ko(e){return/^<a[>\s]/i.test(e)}function qo(e){return/^<\/a\s*>/i.test(e)}function Jo(e){let t=e.tokens;if(e.md.options.linkify)for(let n=0,r=t.length;n<r;n++){if(t[n].type!==`inline`||!e.md.linkify.test(t[n].content))continue;let r=t[n].children,i=0;for(let a=r.length-1;a>=0;a--){let o=r[a];if(o.type===`link_close`){for(a--;r[a].level!==o.level&&r[a].type!==`link_open`;)a--;continue}if(o.type===`html_inline`&&(Ko(o.content)&&i>0&&i--,qo(o.content)&&i++),!(i>0)&&o.type===`text`&&e.md.linkify.test(o.content)){let i=o.content,s=e.md.linkify.match(i),c=[],l=o.level,u=0;s.length>0&&s[0].index===0&&a>0&&r[a-1].type===`text_special`&&(s=s.slice(1));for(let t=0;t<s.length;t++){let n=s[t].url,r=e.md.normalizeLink(n);if(!e.md.validateLink(r))continue;let a=s[t].text;a=s[t].schema?s[t].schema===`mailto:`&&!/^mailto:/i.test(a)?e.md.normalizeLinkText(`mailto:${a}`).replace(/^mailto:/,``):e.md.normalizeLinkText(a):e.md.normalizeLinkText(`http://${a}`).replace(/^http:\/\//,``);let o=s[t].index;if(o>u){let t=new e.Token(`text`,``,0);t.content=i.slice(u,o),t.level=l,c.push(t)}let d=new e.Token(`link_open`,`a`,1);d.attrs=[[`href`,r]],d.level=l++,d.markup=`linkify`,d.info=`auto`,c.push(d);let f=new e.Token(`text`,``,0);f.content=a,f.level=l,c.push(f);let p=new e.Token(`link_close`,`a`,-1);p.level=--l,p.markup=`linkify`,p.info=`auto`,c.push(p),u=s[t].lastIndex}if(u<i.length){let t=new e.Token(`text`,``,0);t.content=i.slice(u),t.level=l,c.push(t)}t[n].children=r=ro(r,a,c)}}}}var Yo=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,Xo=/\((c|tm|r)\)/i,Zo=/\((c|tm|r)\)/gi,Qo={c:`©`,r:`®`,tm:`™`};function $o(e,t){return Qo[t.toLowerCase()]}function es(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&(r.content=r.content.replace(Zo,$o)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function ts(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&Yo.test(r.content)&&(r.content=r.content.replace(/\+-/g,`±`).replace(/\.{2,}/g,`…`).replace(/([?!])…/g,`$1..`).replace(/([?!]){4,}/g,`$1$1$1`).replace(/,{2,}/g,`,`).replace(/(^|[^-])---(?=[^-]|$)/gm,`$1—`).replace(/(^|\s)--(?=\s|$)/gm,`$1–`).replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,`$1–`)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function ns(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type===`inline`&&(Xo.test(e.tokens[t].content)&&es(e.tokens[t].children),Yo.test(e.tokens[t].content)&&ts(e.tokens[t].children))}var rs=/['"]/,is=/['"]/g,as=`’`;function os(e,t,n,r){e[t]||(e[t]=[]),e[t].push({pos:n,ch:r})}function ss(e,t){let n=``,r=0;t.sort((e,t)=>e.pos-t.pos);for(let i=0;i<t.length;i++){let a=t[i];n+=e.slice(r,a.pos)+a.ch,r=a.pos+1}return n+e.slice(r)}function cs(e,t){let n,r=[],i={};for(let a=0;a<e.length;a++){let o=e[a],s=e[a].level;for(n=r.length-1;n>=0&&!(r[n].level<=s);n--);if(r.length=n+1,o.type!==`text`)continue;let c=o.content,l=0,u=c.length;OUTER:for(;l<u;){is.lastIndex=l;let o=is.exec(c);if(!o)break;let d=!0,f=!0;l=o.index+1;let p=o[0]===`'`,m=32;if(o.index-1>=0)m=c.charCodeAt(o.index-1);else for(n=a-1;n>=0&&!(e[n].type===`softbreak`||e[n].type===`hardbreak`);n--)if(e[n].content){m=e[n].content.charCodeAt(e[n].content.length-1);break}let h=32;if(l<u)h=c.charCodeAt(l);else for(n=a+1;n<e.length&&!(e[n].type===`softbreak`||e[n].type===`hardbreak`);n++)if(e[n].content){h=e[n].content.charCodeAt(0);break}let g=Co(m)||So(m),_=Co(h)||So(h),v=bo(m),y=bo(h);if(y?d=!1:_&&(v||g||(d=!1)),v?f=!1:g&&(y||_||(f=!1)),h===34&&o[0]===`"`&&m>=48&&m<=57&&(f=d=!1),d&&f&&(d=g,f=_),!d&&!f){p&&os(i,a,o.index,as);continue}if(f)for(n=r.length-1;n>=0;n--){let e=r[n];if(r[n].level<s)break;if(e.single===p&&r[n].level===s){e=r[n];let s,c;p?(s=t.md.options.quotes[2],c=t.md.options.quotes[3]):(s=t.md.options.quotes[0],c=t.md.options.quotes[1]),os(i,a,o.index,c),os(i,e.token,e.pos,s),r.length=n;continue OUTER}}d?r.push({token:a,pos:o.index,single:p,level:s}):f&&p&&os(i,a,o.index,as)}}Object.keys(i).forEach(function(t){let n=Number(t);e[n].content=ss(e[n].content,i[t])})}function ls(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!==`inline`||!rs.test(e.tokens[t].content)||cs(e.tokens[t].children,e)}function us(e){let t,n,r=e.length;for(t=0;t<r;t++)e[t].type===`text_special`&&(e[t].type=`text`);for(t=n=0;t<r;t++)e[t].type===`text`&&t+1<r&&e[t+1].type===`text`?e[t+1].content=e[t].content+e[t+1].content:(t!==n&&(e[n]=e[t]),n++);t!==n&&(e.length=n)}function ds(e){let t,n,r=e.tokens,i=r.length;for(let e=0;e<i;e++){if(r[e].type!==`inline`)continue;let i=r[e].children,a=i.length;for(t=0;t<a;t++)i[t].type===`text_special`&&(i[t].type=`text`),i[t].children&&us(i[t].children);for(t=n=0;t<a;t++)i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}}var fs=[[`normalize`,Ho],[`block`,Uo],[`strip_references`,Wo],[`inline`,Go],[`linkify`,Jo],[`replacements`,ns],[`smartquotes`,ls],[`text_join`,ds]],ps=class{constructor(){V(this,`ruler`,new Io),V(this,`State`,zo);for(let e=0;e<fs.length;e++)this.ruler.push(fs[e][0],fs[e][1])}process(e){let t=this.ruler.getRules(``);for(let n=0,r=t.length;n<r;n++)t[n](e)}},ms=class{constructor(e,t,n,r){V(this,`bMarks`,[]),V(this,`eMarks`,[]),V(this,`tShift`,[]),V(this,`sCount`,[]),V(this,`bsCount`,[]),V(this,`blkIndent`,0),V(this,`line`,0),V(this,`lineMax`,0),V(this,`tight`,!1),V(this,`listIndent`,-1),V(this,`parentType`,`root`),V(this,`level`,0),V(this,`Token`,Fo),this.src=e,this.md=t,this.env=n,this.tokens=r;let i=this.src;for(let e=0,t=0,n=0,r=0,a=i.length,o=!1;t<a;t++){let s=i.charCodeAt(t);if(!o)if(B(s)){n++,s===9?r+=4-r%4:r++;continue}else o=!0;(s===10||t===a-1)&&(s!==10&&t++,this.bMarks.push(e),this.eMarks.push(t),this.tShift.push(n),this.sCount.push(r),this.bsCount.push(0),o=!1,n=0,r=0,e=t+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}push(e,t,n){let r=new Fo(e,t,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r}isEmpty(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]}skipEmptyLines(e){for(let t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e}skipSpaces(e){for(let t=this.src.length;e<t&&B(this.src.charCodeAt(e));e++);return e}skipSpacesBack(e,t){if(e<=t)return e;for(;e>t;)if(!B(this.src.charCodeAt(--e)))return e+1;return e}skipChars(e,t){for(let n=this.src.length;e<n&&this.src.charCodeAt(e)===t;e++);return e}skipCharsBack(e,t,n){if(e<=n)return e;for(;e>n;)if(t!==this.src.charCodeAt(--e))return e+1;return e}getLines(e,t,n,r){if(e>=t)return``;let i=Array(t-e);for(let a=0,o=e;o<t;o++,a++){let e=0,s=this.bMarks[o],c=s,l;for(l=o+1<t||r?this.eMarks[o]+1:this.eMarks[o];c<l&&e<n;){let t=this.src.charCodeAt(c);if(B(t))t===9?e+=4-(e+this.bsCount[o])%4:e++;else if(c-s<this.tShift[o])e++;else break;c++}e>n?i[a]=Array(e-n+1).join(` `)+this.src.slice(c,l):i[a]=this.src.slice(c,l)}return i.join(``)}},hs=65536;function gs(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function _s(e){let t=[],n=e.length,r=0,i=e.charCodeAt(r),a=!1,o=0,s=``;for(;r<n;)i===124&&(a?(s+=e.substring(o,r-1),o=r):(t.push(s+e.substring(o,r)),s=``,o=r+1)),a=i===92,r++,i=e.charCodeAt(r);return t.push(s+e.substring(o)),t}function vs(e,t,n,r){if(t+2>n)return!1;let i=t+1;if(e.sCount[i]<e.blkIndent||e.sCount[i]-e.blkIndent>=4)return!1;let a=e.bMarks[i]+e.tShift[i];if(a>=e.eMarks[i])return!1;let o=e.src.charCodeAt(a++);if(o!==124&&o!==45&&o!==58||a>=e.eMarks[i])return!1;let s=e.src.charCodeAt(a++);if(s!==124&&s!==45&&s!==58&&!B(s)||o===45&&B(s))return!1;for(;a<e.eMarks[i];){let t=e.src.charCodeAt(a);if(t!==124&&t!==45&&t!==58&&!B(t))return!1;a++}let c=gs(e,t+1),l=c.split(`|`),u=[];for(let e=0;e<l.length;e++){let t=l[e].trim();if(!t){if(e===0||e===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(t))return!1;t.charCodeAt(t.length-1)===58?u.push(t.charCodeAt(0)===58?`center`:`right`):t.charCodeAt(0)===58?u.push(`left`):u.push(``)}if(c=gs(e,t).trim(),c.indexOf(`|`)===-1||e.sCount[t]-e.blkIndent>=4)return!1;l=_s(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop();let d=l.length;if(d===0||d!==u.length)return!1;if(r)return!0;let f=e.parentType;e.parentType=`table`;let p=e.md.block.ruler.getRules(`blockquote`),m=e.push(`table_open`,`table`,1),h=[t,0];m.map=h;let g=e.push(`thead_open`,`thead`,1);g.map=[t,t+1];let _=e.push(`tr_open`,`tr`,1);_.map=[t,t+1];for(let t=0;t<l.length;t++){let n=e.push(`th_open`,`th`,1);u[t]&&(n.attrs=[[`style`,`text-align:${u[t]}`]]);let r=e.push(`inline`,``,0);r.content=l[t].trim(),r.children=[],e.push(`th_close`,`th`,-1)}e.push(`tr_close`,`tr`,-1),e.push(`thead_close`,`thead`,-1);let v,y=0;for(i=t+2;i<n&&!(e.sCount[i]<e.blkIndent);i++){let r=!1;for(let t=0,a=p.length;t<a;t++)if(p[t](e,i,n,!0)){r=!0;break}if(r||(c=gs(e,i).trim(),!c)||e.sCount[i]-e.blkIndent>=4||(l=_s(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop(),y+=d-l.length,y>hs))break;if(i===t+2){let n=e.push(`tbody_open`,`tbody`,1);n.map=v=[t+2,0]}let a=e.push(`tr_open`,`tr`,1);a.map=[i,i+1];for(let t=0;t<d;t++){let n=e.push(`td_open`,`td`,1);u[t]&&(n.attrs=[[`style`,`text-align:${u[t]}`]]);let r=e.push(`inline`,``,0);r.content=l[t]?l[t].trim():``,r.children=[],e.push(`td_close`,`td`,-1)}e.push(`tr_close`,`tr`,-1)}return v&&(e.push(`tbody_close`,`tbody`,-1),v[1]=i),e.push(`table_close`,`table`,-1),h[1]=i,e.parentType=f,e.line=i,!0}function ys(e,t,n){if(e.sCount[t]-e.blkIndent<4)return!1;let r=t+1,i=r;for(;r<n;){if(e.isEmpty(r)){r++;continue}if(e.sCount[r]-e.blkIndent>=4){r++,i=r;continue}break}e.line=i;let a=e.push(`code_block`,`code`,0);return a.content=e.getLines(t,i,4+e.blkIndent,!1)+`
18
+ `,a.map=[t,e.line],!0}function bs(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>a)return!1;let o=e.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let s=i;i=e.skipChars(i,o);let c=i-s;if(c<3)return!1;let l=e.src.slice(s,i),u=e.src.slice(i,a);if(o===96&&u.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;let d=t,f=!1;for(;d++,!(d>=n||(i=s=e.bMarks[d]+e.tShift[d],a=e.eMarks[d],i<a&&e.sCount[d]<e.blkIndent));)if(e.src.charCodeAt(i)===o&&!(e.sCount[d]-e.blkIndent>=4)&&(i=e.skipChars(i,o),!(i-s<c)&&(i=e.skipSpaces(i),!(i<a)))){f=!0;break}c=e.sCount[t],e.line=d+ +!!f;let p=e.push(`fence`,`code`,0);return p.info=u,p.content=e.getLines(t+1,d,c,!0),p.markup=l,p.map=[t,e.line],!0}function xs(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;let s=[],c=[],l=[],u=[],d=e.md.block.ruler.getRules(`blockquote`),f=e.parentType;e.parentType=`blockquote`;let p=!1,m;for(m=t;m<n;m++){let t=e.sCount[m]<e.blkIndent;if(i=e.bMarks[m]+e.tShift[m],a=e.eMarks[m],i>=a)break;if(e.src.charCodeAt(i++)===62&&!t){let t=e.sCount[m]+1,n,r;e.src.charCodeAt(i)===32?(i++,t++,r=!1,n=!0):e.src.charCodeAt(i)===9?(n=!0,(e.bsCount[m]+t)%4==3?(i++,t++,r=!1):r=!0):n=!1;let o=t;for(s.push(e.bMarks[m]),e.bMarks[m]=i;i<a;){let t=e.src.charCodeAt(i);if(B(t))t===9?o+=4-(o+e.bsCount[m]+ +!!r)%4:o++;else break;i++}p=i>=a,c.push(e.bsCount[m]),e.bsCount[m]=e.sCount[m]+1+ +!!n,l.push(e.sCount[m]),e.sCount[m]=o-t,u.push(e.tShift[m]),e.tShift[m]=i-e.bMarks[m];continue}if(p)break;let r=!1;for(let t=0,i=d.length;t<i;t++)if(d[t](e,m,n,!0)){r=!0;break}if(r){e.lineMax=m,e.blkIndent!==0&&(s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]-=e.blkIndent);break}s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]=-1}let h=e.blkIndent;e.blkIndent=0;let g=e.push(`blockquote_open`,`blockquote`,1);g.markup=`>`;let _=[t,0];g.map=_,e.md.block.tokenize(e,t,m);let v=e.push(`blockquote_close`,`blockquote`,-1);v.markup=`>`,e.lineMax=o,e.parentType=f,_[1]=e.line;for(let n=0;n<u.length;n++)e.bMarks[n+t]=s[n],e.tShift[n+t]=u[n],e.sCount[n+t]=l[n],e.bsCount[n+t]=c[n];return e.blkIndent=h,!0}function Ss(e,t,n,r){let i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let a=e.bMarks[t]+e.tShift[t],o=e.src.charCodeAt(a++);if(o!==42&&o!==45&&o!==95)return!1;let s=1;for(;a<i;){let t=e.src.charCodeAt(a++);if(t!==o&&!B(t))return!1;t===o&&s++}if(s<3)return!1;if(r)return!0;e.line=t+1;let c=e.push(`hr`,`hr`,0);return c.map=[t,e.line],c.markup=Array(s+1).join(String.fromCharCode(o)),!0}function Cs(e,t){let n=e.eMarks[t],r=e.bMarks[t]+e.tShift[t],i=e.src.charCodeAt(r++);return i!==42&&i!==45&&i!==43||r<n&&!B(e.src.charCodeAt(r))?-1:r}function ws(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t],i=n;if(i+1>=r)return-1;let a=e.src.charCodeAt(i++);if(a<48||a>57)return-1;for(;;){if(i>=r)return-1;if(a=e.src.charCodeAt(i++),a>=48&&a<=57){if(i-n>=10)return-1;continue}if(a===41||a===46)break;return-1}return i<r&&(a=e.src.charCodeAt(i),!B(a))?-1:i}function Ts(e,t){let n=e.level+2;for(let r=t+2,i=e.tokens.length-2;r<i;r++)e.tokens[r].level===n&&e.tokens[r].type===`paragraph_open`&&(e.tokens[r+2].hidden=!0,e.tokens[r].hidden=!0,r+=2)}function Es(e,t,n,r){let i,a,o,s,c=t,l=!0;if(e.sCount[c]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[c]-e.listIndent>=4&&e.sCount[c]<e.blkIndent)return!1;let u=!1;r&&e.parentType===`paragraph`&&e.sCount[c]>=e.blkIndent&&(u=!0);let d,f,p;if((p=ws(e,c))>=0){if(d=!0,o=e.bMarks[c]+e.tShift[c],f=Number(e.src.slice(o,p-1)),u&&f!==1)return!1}else if((p=Cs(e,c))>=0)d=!1;else return!1;if(u&&e.skipSpaces(p)>=e.eMarks[c])return!1;if(r)return!0;let m=e.src.charCodeAt(p-1),h=e.tokens.length;d?(s=e.push(`ordered_list_open`,`ol`,1),f!==1&&(s.attrs=[[`start`,f]])):s=e.push(`bullet_list_open`,`ul`,1);let g=[c,0];s.map=g,s.markup=String.fromCharCode(m);let _=!1,v=e.md.block.ruler.getRules(`list`),y=e.parentType;for(e.parentType=`list`;c<n;){a=p,i=e.eMarks[c];let t=e.sCount[c]+p-(e.bMarks[c]+e.tShift[c]),r=t;for(;a<i;){let t=e.src.charCodeAt(a);if(t===9)r+=4-(r+e.bsCount[c])%4;else if(t===32)r++;else break;a++}let u=a,f;f=u>=i?1:r-t,f>4&&(f=1);let h=t+f;s=e.push(`list_item_open`,`li`,1),s.markup=String.fromCharCode(m);let g=[c,0];s.map=g,d&&(s.info=e.src.slice(o,p-1));let y=e.tight,b=e.tShift[c],x=e.sCount[c],S=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=h,e.tight=!0,e.tShift[c]=u-e.bMarks[c],e.sCount[c]=r,u>=i&&e.isEmpty(c+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,c,n),(!e.tight||_)&&(l=!1),_=e.line-c>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=S,e.tShift[c]=b,e.sCount[c]=x,e.tight=y,s=e.push(`list_item_close`,`li`,-1),s.markup=String.fromCharCode(m),c=e.line,g[1]=c,c>=n||e.sCount[c]<e.blkIndent||e.sCount[c]-e.blkIndent>=4)break;let C=!1;for(let t=0,r=v.length;t<r;t++)if(v[t](e,c,n,!0)){C=!0;break}if(C)break;if(d){if(p=ws(e,c),p<0)break;o=e.bMarks[c]+e.tShift[c]}else if(p=Cs(e,c),p<0)break;if(m!==e.src.charCodeAt(p-1))break}return s=d?e.push(`ordered_list_close`,`ol`,-1):e.push(`bullet_list_close`,`ul`,-1),s.markup=String.fromCharCode(m),g[1]=c,e.line=c,e.parentType=y,l&&Ts(e,h),!0}function Ds(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=t+1;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==91)return!1;function s(t){let n=e.lineMax;if(t>=n||e.isEmpty(t))return null;let r=!1;if(e.sCount[t]-e.blkIndent>3&&(r=!0),e.sCount[t]<0&&(r=!0),!r){let r=e.md.block.ruler.getRules(`reference`),i=e.parentType;e.parentType=`reference`;let a=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,t,n,!0)){a=!0;break}if(e.parentType=i,a)return null}let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];return e.src.slice(i,a+1)}let c=e.src.slice(i,a+1);a=c.length;let l=-1;for(i=1;i<a;i++){let e=c.charCodeAt(i);if(e===91)return!1;if(e===93){l=i;break}else if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(e===92&&(i++,i<a&&c.charCodeAt(i)===10)){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}}if(l<0||c.charCodeAt(l+1)!==58)return!1;for(i=l+2;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!B(e))break}let u=e.md.helpers.parseLinkDestination(c,i,a);if(!u.ok)return!1;let d=e.md.normalizeLink(u.str);if(!e.md.validateLink(d))return!1;i=u.pos;let f=i,p=o,m=i;for(;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!B(e))break}let h=e.md.helpers.parseLinkTitle(c,i,a);for(;h.can_continue;){let t=s(o);if(t===null)break;c+=t,i=a,a=c.length,o++,h=e.md.helpers.parseLinkTitle(c,i,a,h)}let g;for(i<a&&m!==i&&h.ok?(g=h.str,i=h.pos):(g=``,i=f,o=p);i<a&&B(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10&&g)for(g=``,i=f,o=p;i<a&&B(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10)return!1;let _=wo(c.slice(1,l));if(!_)return!1;if(r)return!0;e.env.references===void 0&&(e.env.references={}),e.env.references[_]===void 0&&(e.env.references[_]={title:g,href:d});let v=e.push(`reference_definition`,``,0);v.map=[t,o],v.hidden=!0;let y=Object.create(null);return y.label=_,v.meta=y,e.line=o,!0}var Os=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),ks=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,As=`<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>`,js=RegExp(`^(?:${ks}|${As}|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),Ms=RegExp(`^(?:${ks}|${As})`),Ns=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Za-z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[RegExp(`^</?(${Os.join(`|`)})(?=(\\s|/?>|$))`,`i`),/^$/,!0],[RegExp(`${Ms.source}\\s*$`),/^$/,!1]];function Ps(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let o=e.src.slice(i,a),s=0;for(;s<Ns.length&&!Ns[s][0].test(o);s++);if(s===Ns.length)return!1;if(r)return Ns[s][2];let c=t+1,l=Ns[s][1].test(``);if(!Ns[s][1].test(o)){for(;c<n&&!(e.sCount[c]<e.blkIndent&&(l||!e.isEmpty(c)));c++)if(i=e.bMarks[c]+e.tShift[c],a=e.eMarks[c],o=e.src.slice(i,a),Ns[s][1].test(o)){o.length!==0&&c++;break}}e.line=c;let u=e.push(`html_block`,``,0);return u.map=[t,c],u.content=e.getLines(t,c,e.blkIndent,!0),!0}function Fs(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let o=e.src.charCodeAt(i);if(o!==35||i>=a)return!1;let s=1;for(o=e.src.charCodeAt(++i);o===35&&i<a&&s<=6;)s++,o=e.src.charCodeAt(++i);if(s>6||i<a&&!B(o))return!1;if(r)return!0;a=e.skipSpacesBack(a,i);let c=e.skipCharsBack(a,35,i);c>i&&B(e.src.charCodeAt(c-1))&&(a=c),e.line=t+1;let l=e.push(`heading_open`,`h${s}`,1);l.markup=`########`.slice(0,s),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=Eo(e.src.slice(i,a)),u.map=[t,e.line],u.children=[];let d=e.push(`heading_close`,`h${s}`,-1);return d.markup=`########`.slice(0,s),!0}function Is(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`);if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.parentType;e.parentType=`paragraph`;let a=0,o,s=t+1;for(;s<n&&!e.isEmpty(s);s++){if(e.sCount[s]-e.blkIndent>3)continue;if(e.sCount[s]>=e.blkIndent){let t=e.bMarks[s]+e.tShift[s],n=e.eMarks[s];if(t<n&&(o=e.src.charCodeAt(t),(o===45||o===61)&&(t=e.skipChars(t,o),t=e.skipSpaces(t),t>=n))){a=o===61?1:2;break}}if(e.sCount[s]<0)continue;let t=!1;for(let i=0,a=r.length;i<a;i++)if(r[i](e,s,n,!0)){t=!0;break}if(t)break}if(!a)return e.parentType=i,!1;let c=Eo(e.getLines(t,s,e.blkIndent,!1));e.line=s+1;let l=e.push(`heading_open`,`h${a}`,1);l.markup=String.fromCharCode(o),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=c,u.map=[t,e.line-1],u.children=[];let d=e.push(`heading_close`,`h${a}`,-1);return d.markup=String.fromCharCode(o),e.parentType=i,!0}function Ls(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`),i=e.parentType,a=t+1;for(e.parentType=`paragraph`;a<n&&!e.isEmpty(a);a++){if(e.sCount[a]-e.blkIndent>3||e.sCount[a]<0)continue;let t=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,a,n,!0)){t=!0;break}if(t)break}let o=Eo(e.getLines(t,a,e.blkIndent,!1));e.line=a;let s=e.push(`paragraph_open`,`p`,1);s.map=[t,e.line];let c=e.push(`inline`,``,0);return c.content=o,c.map=[t,e.line],c.children=[],e.push(`paragraph_close`,`p`,-1),e.parentType=i,!0}var Rs=[[`table`,vs,[`paragraph`,`reference`]],[`code`,ys],[`fence`,bs,[`paragraph`,`reference`,`blockquote`,`list`]],[`blockquote`,xs,[`paragraph`,`reference`,`blockquote`,`list`]],[`hr`,Ss,[`paragraph`,`reference`,`blockquote`,`list`]],[`list`,Es,[`paragraph`,`reference`,`blockquote`]],[`reference`,Ds],[`html_block`,Ps,[`paragraph`,`reference`,`blockquote`]],[`heading`,Fs,[`paragraph`,`reference`,`blockquote`]],[`lheading`,Is],[`paragraph`,Ls]],zs=class{constructor(){V(this,`ruler`,new Io),V(this,`State`,ms);for(let e=0;e<Rs.length;e++)this.ruler.push(Rs[e][0],Rs[e][1],{alt:(Rs[e][2]||[]).slice()})}tokenize(e,t,n){let r=this.ruler.getRules(``),i=r.length,a=e.md.options.maxNesting,o=t,s=!1;for(;o<n&&(e.line=o=e.skipEmptyLines(o),!(o>=n||e.sCount[o]<e.blkIndent));){if(e.level>=a){e.line=n;break}let t=e.line,c=!1;for(let a=0;a<i;a++)if(c=r[a](e,o,n,!1),c){if(t>=e.line)throw Error(`block rule didn't increment state.line`);break}if(!c)throw Error(`none of the block rules matched`);e.tight=!s,e.isEmpty(e.line-1)&&(s=!0),o=e.line,o<n&&e.isEmpty(o)&&(s=!0,o++,e.line=o)}}parse(e,t,n,r){if(!e)return;let i=new this.State(e,t,n,r);this.tokenize(i,i.line,i.lineMax)}},Bs=class{constructor(e,t,n,r){V(this,`pos`,0),V(this,`level`,0),V(this,`pending`,``),V(this,`pendingLevel`,0),V(this,`cache`,{}),V(this,`backticks`,{}),V(this,`backticksScanned`,!1),V(this,`linkLevel`,0),V(this,`delimiters`,[]),V(this,`_prev_delimiters`,[]),V(this,`Token`,Fo),this.src=e,this.env=n,this.md=t,this.tokens=r,this.tokens_meta=Array(r.length),this.posMax=this.src.length}pushPending(){let e=new Fo(`text`,``,0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending=``,e}push(e,t,n){this.pending&&this.pushPending();let r=new Fo(e,t,n),i;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r}scanDelims(e,t){let n=this.posMax,r=this.src.charCodeAt(e),i;if(e===0)i=32;else if(e===1)i=this.src.charCodeAt(0),(i&63488)==55296&&(i=65533);else if(i=this.src.charCodeAt(e-1),(i&64512)==56320){let t=this.src.charCodeAt(e-2);i=(t&64512)==55296?65536+(t-55296<<10)+(i-56320):65533}else(i&64512)==55296&&(i=65533);let a=e;for(;a<n&&this.src.charCodeAt(a)===r;)a++;let o=a-e,s=a<n?this.src.charCodeAt(a):32;if((s&64512)==55296){let e=this.src.charCodeAt(a+1);s=(e&64512)==56320?65536+(s-55296<<10)+(e-56320):65533}else(s&64512)==56320&&(s=65533);let c=Co(i)||So(i),l=Co(s)||So(s),u=bo(i),d=bo(s),f=!d&&(!l||u||c),p=!u&&(!c||d||l);return{can_open:f&&(t||!p||c),can_close:p&&(t||!f||l),length:o}}};function Vs(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function Hs(e,t){let n=e.pos;for(;n<e.posMax&&!Vs(e.src.charCodeAt(n));)n++;return n===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}var Us=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function Ws(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;let n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;let i=e.pending.match(Us);if(!i)return!1;let a=i[1],o=e.md.linkify.matchAtStart(e.src.slice(n-a.length));if(!o)return!1;let s=o.url;if(s.length<=a.length)return!1;let c=s.length;for(;c>0&&s.charCodeAt(c-1)===42;)c--;c!==s.length&&(s=s.slice(0,c));let l=e.md.normalizeLink(s);if(!e.md.validateLink(l))return!1;if(!t){e.pending=e.pending.slice(0,-a.length);let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,l]],t.markup=`linkify`,t.info=`auto`;let n=e.push(`text`,``,0);n.content=e.md.normalizeLinkText(s);let r=e.push(`link_close`,`a`,-1);r.markup=`linkify`,r.info=`auto`}return e.pos+=s.length-a.length,!0}function Gs(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;let r=e.pending.length-1,i=e.posMax;if(!t)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let t=r-1;for(;t>=1&&e.pending.charCodeAt(t-1)===32;)t--;e.pending=e.pending.slice(0,t),e.push(`hardbreak`,`br`,0)}else e.pending=e.pending.slice(0,-1),e.push(`softbreak`,`br`,0);else e.push(`softbreak`,`br`,0);for(n++;n<i&&B(e.src.charCodeAt(n));)n++;return e.pos=n,!0}var Ks=[];for(let e=0;e<256;e++)Ks.push(0);`\\!"#$%&'()*+,./:;<=>?@[]^_\`{|}~-`.split(``).forEach(function(e){Ks[e.charCodeAt(0)]=1});function qs(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=e.src.charCodeAt(n);if(i===10){for(t||e.push(`hardbreak`,`br`,0),n++;n<r&&(i=e.src.charCodeAt(n),B(i));)n++;return e.pos=n,!0}if(i===32){if(!t){let t=e.push(`text_special`,``,0);t.content=`\\`,t.markup=`\\`,t.info=`escape`}return e.pos=n,!0}let a=e.src[n];if(i>=55296&&i<=56319&&n+1<r){let t=e.src.charCodeAt(n+1);t>=56320&&t<=57343&&(a+=e.src[n+1],n++)}let o=`\\`+a;if(!t){let t=e.push(`text_special`,``,0);i<256&&Ks[i]!==0?t.content=a:t.content=o,t.markup=o,t.info=`escape`}return e.pos=n+1,!0}function Js(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==96)return!1;let r=n;n++;let i=e.posMax;for(;n<i&&e.src.charCodeAt(n)===96;)n++;let a=e.src.slice(r,n),o=a.length;if(e.backticksScanned&&(e.backticks[o]||0)<=r)return t||(e.pending+=a),e.pos+=o,!0;let s=n,c;for(;(c=e.src.indexOf("`",s))!==-1;){for(s=c+1;s<i&&e.src.charCodeAt(s)===96;)s++;let r=s-c;if(r===o){if(!t){let t=e.push(`code_inline`,`code`,0);t.markup=a,t.content=e.src.slice(n,c).replace(/\n/g,` `).replace(/^ (.+) $/,`$1`)}return e.pos=s,!0}e.backticks[r]=c}return e.backticksScanned=!0,t||(e.pending+=a),e.pos+=o,!0}function Ys(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==126)return!1;let i=e.scanDelims(e.pos,!0),a=i.length,o=String.fromCharCode(r);if(a<2)return!1;let s;a%2&&(s=e.push(`text`,``,0),s.content=o,a--);for(let t=0;t<a;t+=2)s=e.push(`text`,``,0),s.content=o+o,e.delimiters.push({marker:r,length:0,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return e.pos+=i.length,!0}function Xs(e,t){let n,r=[],i=t.length;for(let a=0;a<i;a++){let i=t[a];if(i.marker!==126||i.end===-1)continue;let o=t[i.end];n=e.tokens[i.token],n.type=`s_open`,n.tag=`s`,n.nesting=1,n.markup=`~~`,n.content=``,n=e.tokens[o.token],n.type=`s_close`,n.tag=`s`,n.nesting=-1,n.markup=`~~`,n.content=``,e.tokens[o.token-1].type===`text`&&e.tokens[o.token-1].content===`~`&&r.push(o.token-1)}for(;r.length;){let t=r.pop(),i=t+1;for(;i<e.tokens.length&&e.tokens[i].type===`s_close`;)i++;i--,t!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[t],e.tokens[t]=n)}}function Zs(e){let t=e.tokens_meta,n=e.tokens_meta.length;Xs(e,e.delimiters);for(let r=0;r<n;r++){let n=t[r]?.delimiters;n&&Xs(e,n)}}var Qs={tokenize:Ys,postProcess:Zs};function $s(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==95&&r!==42)return!1;let i=e.scanDelims(e.pos,r===42);for(let t=0;t<i.length;t++){let t=e.push(`text`,``,0);t.content=String.fromCharCode(r),e.delimiters.push({marker:r,length:i.length,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return e.pos+=i.length,!0}function ec(e,t){let n=t.length;for(let r=n-1;r>=0;r--){let n=t[r];if(n.marker!==95&&n.marker!==42||n.end===-1)continue;let i=t[n.end],a=r>0&&t[r-1].end===n.end+1&&t[r-1].marker===n.marker&&t[r-1].token===n.token-1&&t[n.end+1].token===i.token+1,o=String.fromCharCode(n.marker),s=e.tokens[n.token];s.type=a?`strong_open`:`em_open`,s.tag=a?`strong`:`em`,s.nesting=1,s.markup=a?o+o:o,s.content=``;let c=e.tokens[i.token];c.type=a?`strong_close`:`em_close`,c.tag=a?`strong`:`em`,c.nesting=-1,c.markup=a?o+o:o,c.content=``,a&&(e.tokens[t[r-1].token].content=``,e.tokens[t[n.end+1].token].content=``,r--)}}function tc(e){let t=e.tokens_meta,n=e.tokens_meta.length;ec(e,e.delimiters);for(let r=0;r<n;r++){let n=t[r]?.delimiters;n&&ec(e,n)}}var nc={tokenize:$s,postProcess:tc};function rc(e,t){let n,r,i,a,o=``,s=``,c=e.pos,l=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;let u=e.pos,d=e.posMax,f=e.pos+1,p=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(p<0)return!1;let m=p+1;if(m<d&&e.src.charCodeAt(m)===40){for(l=!1,m++;m<d&&(n=e.src.charCodeAt(m),!(!B(n)&&n!==10));m++);if(m>=d)return!1;if(c=m,i=e.md.helpers.parseLinkDestination(e.src,m,e.posMax),i.ok){for(o=e.md.normalizeLink(i.str),e.md.validateLink(o)?m=i.pos:o=``,c=m;m<d&&(n=e.src.charCodeAt(m),!(!B(n)&&n!==10));m++);if(i=e.md.helpers.parseLinkTitle(e.src,m,e.posMax),m<d&&c!==m&&i.ok)for(s=i.str,m=i.pos;m<d&&(n=e.src.charCodeAt(m),!(!B(n)&&n!==10));m++);}(m>=d||e.src.charCodeAt(m)!==41)&&(l=!0),m++}if(l){if(e.env.references===void 0)return!1;if(m<d&&e.src.charCodeAt(m)===91?(c=m+1,m=e.md.helpers.parseLinkLabel(e,m),m>=0?r=e.src.slice(c,m++):m=p+1):m=p+1,r||=e.src.slice(f,p),r=wo(r),a=e.env.references[r],!a)return e.pos=u,!1;o=a.href,s=a.title}if(!t){e.pos=f,e.posMax=p;let t=e.push(`link_open`,`a`,1),n=[[`href`,o]];if(t.attrs=n,s&&n.push([`title`,s]),r){let e=Object.create(null);e.label=r,t.meta=e}e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push(`link_close`,`a`,-1)}return e.pos=m,e.posMax=d,!0}function ic(e,t){let n,r,i,a,o,s,c,l,u=``,d=e.pos,f=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let p=e.pos+2,m=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(m<0)return!1;if(a=m+1,a<f&&e.src.charCodeAt(a)===40){for(a++;a<f&&(n=e.src.charCodeAt(a),!(!B(n)&&n!==10));a++);if(a>=f)return!1;for(l=a,s=e.md.helpers.parseLinkDestination(e.src,a,e.posMax),s.ok&&(u=e.md.normalizeLink(s.str),e.md.validateLink(u)?a=s.pos:u=``),l=a;a<f&&(n=e.src.charCodeAt(a),!(!B(n)&&n!==10));a++);if(s=e.md.helpers.parseLinkTitle(e.src,a,e.posMax),a<f&&l!==a&&s.ok)for(c=s.str,a=s.pos;a<f&&(n=e.src.charCodeAt(a),!(!B(n)&&n!==10));a++);else c=``;if(a>=f||e.src.charCodeAt(a)!==41)return e.pos=d,!1;a++}else{if(e.env.references===void 0)return!1;if(a<f&&e.src.charCodeAt(a)===91?(l=a+1,a=e.md.helpers.parseLinkLabel(e,a),a>=0?i=e.src.slice(l,a++):a=m+1):a=m+1,i||=e.src.slice(p,m),i=wo(i),o=e.env.references[i],!o)return e.pos=d,!1;u=o.href,c=o.title}if(!t){r=e.src.slice(p,m);let t=[];e.md.inline.parse(r,e.md,e.env,t);let n=e.push(`image`,`img`,0),a=[[`src`,u],[`alt`,``]];if(n.attrs=a,n.children=t,n.content=r,c&&a.push([`title`,c]),i){let e=Object.create(null);e.label=i,n.meta=e}}return e.pos=a,e.posMax=f,!0}var ac=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,oc=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function sc(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;let r=e.pos,i=e.posMax;for(;;){if(++n>=i)return!1;let t=e.src.charCodeAt(n);if(t===60)return!1;if(t===62)break}let a=e.src.slice(r+1,n);if(oc.test(a)){let n=e.md.normalizeLink(a);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}if(ac.test(a)){let n=e.md.normalizeLink(`mailto:${a}`);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}return!1}function cc(e){return/^<a[>\s]/i.test(e)}function lc(e){return/^<\/a\s*>/i.test(e)}function uc(e){let t=e|32;return t>=97&&t<=122}function dc(e,t){if(!e.md.options.html)return!1;let n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=n)return!1;let i=e.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!uc(i))return!1;let a=e.src.slice(r).match(js);if(!a)return!1;if(!t){let t=e.push(`html_inline`,``,0);t.content=a[0],cc(t.content)&&e.linkLevel++,lc(t.content)&&e.linkLevel--}return e.pos+=a[0].length,!0}var fc=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,pc=/^&([a-z][a-z0-9]{1,31});/i;function mc(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){let r=e.src.slice(n).match(fc);if(r){if(!t){let t=r[1][0].toLowerCase()===`x`?parseInt(r[1].slice(1),16):parseInt(r[1],10),n=e.push(`text_special`,``,0);n.content=io(t)?ao(t):ao(65533),n.markup=r[0],n.info=`entity`}return e.pos+=r[0].length,!0}}else{let r=e.src.slice(n).match(pc);if(r){let n=pa(r[0]);if(n!==r[0]){if(!t){let t=e.push(`text_special`,``,0);t.content=n,t.markup=r[0],t.info=`entity`}return e.pos+=r[0].length,!0}}}return!1}function hc(e){let t={},n=e.length;if(!n)return;let r=0,i=-2,a=[];for(let o=0;o<n;o++){let n=e[o];if(a.push(0),(e[r].marker!==n.marker||i!==n.token-1)&&(r=o),i=n.token,n.length=n.length||0,!n.close)continue;t.hasOwnProperty(n.marker)||(t[n.marker]=[-1,-1,-1,-1,-1,-1]);let s=t[n.marker][(n.open?3:0)+n.length%3],c=r-a[r]-1,l=c;for(;c>s;c-=a[c]+1){let t=e[c];if(t.marker===n.marker&&t.open&&t.end<0){let r=!1;if((t.close||n.open)&&(t.length+n.length)%3==0&&(t.length%3!=0||n.length%3!=0)&&(r=!0),!r){let r=c>0&&!e[c-1].open?a[c-1]+1:0;a[o]=o-c+r,a[c]=r,n.open=!1,t.end=o,t.close=!1,l=-1,i=-2;break}}}l!==-1&&(t[n.marker][(n.open?3:0)+(n.length||0)%3]=l)}}function gc(e){let t=e.tokens_meta,n=e.tokens_meta.length;hc(e.delimiters);for(let e=0;e<n;e++){let n=t[e]?.delimiters;n&&hc(n)}}function _c(e){let t,n,r=0,i=e.tokens,a=e.tokens.length;for(t=n=0;t<a;t++)i[t].nesting<0&&r--,i[t].level=r,i[t].nesting>0&&r++,i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}var vc=[[`text`,Hs],[`linkify`,Ws],[`newline`,Gs],[`escape`,qs],[`backticks`,Js],[`strikethrough`,Qs.tokenize],[`emphasis`,nc.tokenize],[`link`,rc],[`image`,ic],[`autolink`,sc],[`html_inline`,dc],[`entity`,mc]],yc=[[`balance_pairs`,gc],[`strikethrough`,Qs.postProcess],[`emphasis`,nc.postProcess],[`fragments_join`,_c]],bc=class{constructor(){V(this,`ruler`,new Io),V(this,`ruler2`,new Io),V(this,`State`,Bs);for(let e=0;e<vc.length;e++)this.ruler.push(vc[e][0],vc[e][1]);for(let e=0;e<yc.length;e++)this.ruler2.push(yc[e][0],yc[e][1])}skipToken(e){let t=e.pos,n=this.ruler.getRules(``),r=n.length,i=e.md.options.maxNesting,a=e.cache;if(a[t]!==void 0){e.pos=a[t];return}let o=!1;if(e.level<i){for(let i=0;i<r;i++)if(e.level++,o=n[i](e,!0),e.level--,o){if(t>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}else e.pos=e.posMax;o||e.pos++,a[t]=e.pos}tokenize(e){let t=this.ruler.getRules(``),n=t.length,r=e.posMax,i=e.md.options.maxNesting;for(;e.pos<r;){let a=e.pos,o=!1;if(e.level<i){for(let r=0;r<n;r++)if(o=t[r](e,!1),o){if(a>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}if(o){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()}parse(e,t,n,r){let i=new this.State(e,t,n,r);this.tokenize(i);let a=this.ruler2.getRules(``),o=a.length;for(let e=0;e<o;e++)a[e](i)}},xc={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`strip_references`,`inline`,`text_join`]},block:{rules:[`paragraph`]},inline:{rules:[`text`],rules2:[`balance_pairs`,`fragments_join`]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`strip_references`,`inline`,`text_join`]},block:{rules:[`blockquote`,`code`,`fence`,`heading`,`hr`,`html_block`,`lheading`,`list`,`reference`,`paragraph`]},inline:{rules:[`autolink`,`backticks`,`emphasis`,`entity`,`escape`,`html_inline`,`image`,`link`,`newline`,`text`],rules2:[`balance_pairs`,`emphasis`,`fragments_join`]}}}},Sc=/^(vbscript|javascript|file|data):/,Cc=/^data:image\/(gif|png|jpeg|webp);/,wc=[`http:`,`https:`,`mailto:`],Tc=class{validateLink(e){let t=e.trim().toLowerCase();return!Sc.test(t)||Cc.test(t)}normalizeLink(e){let t=Wi(e,!0);if(t.hostname&&(!t.protocol||wc.indexOf(t.protocol)>=0))try{t.hostname=Qa.toASCII(t.hostname)}catch{}return ji(Mi(t))}normalizeLinkText(e){let t=Wi(e,!0);if(t.hostname&&(!t.protocol||wc.indexOf(t.protocol)>=0))try{t.hostname=Qa.toUnicode(t.hostname)}catch{}return Oi(Mi(t),Oi.defaultChars+`%`)}constructor(...e){V(this,`inline`,new bc),V(this,`block`,new zs),V(this,`core`,new ps),V(this,`renderer`,new Ro),V(this,`linkify`,new Ta),V(this,`utils`,to),V(this,`helpers`,Object.assign({},jo));let[t,n]=e;typeof t==`string`?(this.configure(t),n&&this.set(n)):(this.configure(`default`),this.set(t||{}))}set(e){return Object.assign(this.options,e),this}configure(e){let t;if(typeof e==`string`){let n=e;if(t=xc[n],!t)throw Error(`Wrong 'markdown-it' preset "${n}", check name`)}else t=e;if(!t)throw Error("Wrong `markdown-it` preset, can't be empty");t.options&&(this.options={...t.options});let n=t.components;if(n){[`core`,`block`,`inline`].forEach(e=>{let t=n[e]?.rules;t&&this[e].ruler.enableOnly(t)});let e=n.inline?.rules2;e&&this.inline.ruler2.enableOnly(e)}return this}enable(e,t=!1){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(t=>{n=n.concat(this[t].ruler.enable(e,!0))}),n=n.concat(this.inline.ruler2.enable(e,!0));let r=e.filter(e=>n.indexOf(e)<0);if(r.length&&!t)throw Error(`MarkdownIt. Failed to enable unknown rule(s): ${r}`);return this}disable(e,t=!1){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(t=>{n=n.concat(this[t].ruler.disable(e,!0))}),n=n.concat(this.inline.ruler2.disable(e,!0));let r=e.filter(e=>n.indexOf(e)<0);if(r.length&&!t)throw Error(`MarkdownIt. Failed to disable unknown rule(s): ${r}`);return this}use(e,...t){return e.apply(e,[this,...t]),this}parse(e,t){if(typeof e!=`string`)throw Error(`Input data should be a String`);let n=new this.core.State(e,this,t);return this.core.process(n),n.tokens}render(e,t={}){return this.renderer.render(this.parse(e,t),this.options,t)}parseInline(e,t){let n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens}renderInline(e,t={}){return this.renderer.render(this.parseInline(e,t),this.options,t)}};V(Tc,`Token`,Fo),V(Tc,`Ruler`,Io),V(Tc,`Renderer`,Ro),V(Tc,`ParserCore`,ps),V(Tc,`StateCore`,zo),V(Tc,`ParserBlock`,zs),V(Tc,`StateBlock`,ms),V(Tc,`ParserInline`,bc),V(Tc,`StateInline`,Bs);var Ec=no(Tc);function Dc(e,t,n,r){let i=Number(e[t].meta.id+1).toString(),a=``;return typeof r.docId==`string`&&(a=`-${r.docId}-`),a+i}function Oc(e,t){let n=Number(e[t].meta.id+1).toString();return e[t].meta.subId>0&&(n+=`:${e[t].meta.subId}`),`[${n}]`}function kc(e,t,n,r,i){let a=i.rules.footnote_anchor_name(e,t,n,r,i),o=i.rules.footnote_caption(e,t,n,r,i),s=a;return e[t].meta.subId>0&&(s+=`:${e[t].meta.subId}`),`<sup class="footnote-ref"><a href="#fn${a}" id="fnref${s}">${o}</a></sup>`}function Ac(e,t,n){return(n.xhtmlOut?`<hr class="footnotes-sep" />
19
+ `:`<hr class="footnotes-sep">
20
+ `)+`<section class="footnotes">
21
+ <ol class="footnotes-list">
22
+ `}function jc(){return`</ol>
23
+ </section>
24
+ `}function Mc(e,t,n,r,i){let a=i.rules.footnote_anchor_name(e,t,n,r,i);return e[t].meta.subId>0&&(a+=`:${e[t].meta.subId}`),`<li id="fn${a}" class="footnote-item">`}function Nc(){return`</li>
25
+ `}function Pc(e,t,n,r,i){let a=i.rules.footnote_anchor_name(e,t,n,r,i);return e[t].meta.subId>0&&(a+=`:${e[t].meta.subId}`),` <a href="#fnref${a}" class="footnote-backref">\u21a9\uFE0E</a>`}function Fc(e){let t=e.helpers.parseLinkLabel,n=e.utils.isSpace;e.renderer.rules.footnote_ref=kc,e.renderer.rules.footnote_block_open=Ac,e.renderer.rules.footnote_block_close=jc,e.renderer.rules.footnote_open=Mc,e.renderer.rules.footnote_close=Nc,e.renderer.rules.footnote_anchor=Pc,e.renderer.rules.footnote_caption=Oc,e.renderer.rules.footnote_anchor_name=Dc;function r(e,t,r,i){let a=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];if(a+4>o||e.src.charCodeAt(a)!==91||e.src.charCodeAt(a+1)!==94)return!1;let s;for(s=a+2;s<o;s++){if(e.src.charCodeAt(s)===32)return!1;if(e.src.charCodeAt(s)===93)break}if(s===a+2||s+1>=o||e.src.charCodeAt(++s)!==58)return!1;if(i)return!0;s++,e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.refs||(e.env.footnotes.refs={});let c=e.src.slice(a+2,s-2);e.env.footnotes.refs[`:${c}`]=-1;let l=new e.Token(`footnote_reference_open`,``,1);l.meta={label:c},l.level=e.level++,e.tokens.push(l);let u=e.bMarks[t],d=e.tShift[t],f=e.sCount[t],p=e.parentType,m=s,h=e.sCount[t]+s-(e.bMarks[t]+e.tShift[t]),g=h;for(;s<o;){let t=e.src.charCodeAt(s);if(n(t))t===9?g+=4-g%4:g++;else break;s++}e.tShift[t]=s-m,e.sCount[t]=g-h,e.bMarks[t]=m,e.blkIndent+=4,e.parentType=`footnote`,e.sCount[t]<e.blkIndent&&(e.sCount[t]+=e.blkIndent),e.md.block.tokenize(e,t,r,!0),e.parentType=p,e.blkIndent-=4,e.tShift[t]=d,e.sCount[t]=f,e.bMarks[t]=u;let _=new e.Token(`footnote_reference_close`,``,-1);return _.level=--e.level,e.tokens.push(_),!0}function i(e,n){let r=e.posMax,i=e.pos;if(i+2>=r||e.src.charCodeAt(i)!==94||e.src.charCodeAt(i+1)!==91)return!1;let a=i+2,o=t(e,i+1);if(o<0)return!1;if(!n){e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.list||(e.env.footnotes.list=[]);let t=e.env.footnotes.list.length,n=[];e.md.inline.parse(e.src.slice(a,o),e.md,e.env,n);let r=e.push(`footnote_ref`,``,0);r.meta={id:t},e.env.footnotes.list[t]={content:e.src.slice(a,o),tokens:n}}return e.pos=o+1,e.posMax=r,!0}function a(e,t){let n=e.posMax,r=e.pos;if(r+3>n||!e.env.footnotes||!e.env.footnotes.refs||e.src.charCodeAt(r)!==91||e.src.charCodeAt(r+1)!==94)return!1;let i;for(i=r+2;i<n;i++){if(e.src.charCodeAt(i)===32||e.src.charCodeAt(i)===10)return!1;if(e.src.charCodeAt(i)===93)break}if(i===r+2||i>=n)return!1;i++;let a=e.src.slice(r+2,i-1);if(e.env.footnotes.refs[`:${a}`]===void 0)return!1;if(!t){e.env.footnotes.list||(e.env.footnotes.list=[]);let t;e.env.footnotes.refs[`:${a}`]<0?(t=e.env.footnotes.list.length,e.env.footnotes.list[t]={label:a,count:0},e.env.footnotes.refs[`:${a}`]=t):t=e.env.footnotes.refs[`:${a}`];let n=e.env.footnotes.list[t].count;e.env.footnotes.list[t].count++;let r=e.push(`footnote_ref`,``,0);r.meta={id:t,subId:n,label:a}}return e.pos=i,e.posMax=n,!0}function o(e){let t,n,r,i=!1,a={};if(!e.env.footnotes||(e.tokens=e.tokens.filter(function(e){return e.type===`footnote_reference_open`?(i=!0,n=[],r=e.meta.label,!1):e.type===`footnote_reference_close`?(i=!1,a[`:`+r]=n,!1):(i&&n.push(e),!i)}),!e.env.footnotes.list))return;let o=e.env.footnotes.list;e.tokens.push(new e.Token(`footnote_block_open`,``,1));for(let n=0,r=o.length;n<r;n++){let r=new e.Token(`footnote_open`,``,1);if(r.meta={id:n,label:o[n].label},e.tokens.push(r),o[n].tokens){t=[];let r=new e.Token(`paragraph_open`,`p`,1);r.block=!0,t.push(r);let i=new e.Token(`inline`,``,0);i.children=o[n].tokens,i.content=o[n].content,t.push(i);let a=new e.Token(`paragraph_close`,`p`,-1);a.block=!0,t.push(a)}else o[n].label&&(t=a[`:${o[n].label}`]);t&&(e.tokens=e.tokens.concat(t));let i;i=e.tokens[e.tokens.length-1].type===`paragraph_close`?e.tokens.pop():null;let s=o[n].count>0?o[n].count:1;for(let t=0;t<s;t++){let r=new e.Token(`footnote_anchor`,``,0);r.meta={id:n,subId:t,label:o[n].label},e.tokens.push(r)}i&&e.tokens.push(i),e.tokens.push(new e.Token(`footnote_close`,``,-1))}e.tokens.push(new e.Token(`footnote_block_close`,``,-1))}e.block.ruler.before(`reference`,`footnote_def`,r,{alt:[`paragraph`,`reference`]}),e.inline.ruler.after(`image`,`footnote_inline`,i),e.inline.ruler.after(`footnote_inline`,`footnote_ref`,a),e.core.ruler.after(`inline`,`footnote_tail`,o)}var Ic={note:`<svg class="octicon octicon-info mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>`,tip:`<svg class="octicon octicon-light-bulb mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z"></path></svg>`,important:`<svg class="octicon octicon-report mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>`,warning:`<svg class="octicon octicon-alert mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>`,caution:`<svg class="octicon octicon-stop mr-2" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>`},Lc=(e,t={})=>{let{markers:n=[`TIP`,`NOTE`,`IMPORTANT`,`WARNING`,`CAUTION`],icons:r=Ic,matchCaseSensitive:i=!1,titles:a={},classPrefix:o=`markdown-alert`}=t,s=n===`*`?`\\w+`:n.join(`|`),c=RegExp(`^\\\\?\\[\\!(${s})\\]([^\\n\\r]*)`,i?``:`i`);e.core.ruler.after(`block`,`github-alerts`,e=>{let t=e.tokens;for(let e=0;e<t.length;e++)if(t[e].type===`blockquote_open`){let n=t[e],i=e;for(;t[e]?.type!==`blockquote_close`&&e<=t.length;)e+=1;let o=t[e],s=e,l=t.slice(i,s+1).find(e=>e.type===`inline`);if(!l)continue;let u=l.content.match(c);if(!u)continue;let d=u[1].toLowerCase(),f=u[2].trim()||(a[d]??Rc(d)),p=r[d]??``;l.content=l.content.slice(u[0].length).trimStart(),n.type=`alert_open`,n.tag=`div`,n.meta={title:f,type:d,icon:p},o.type=`alert_close`,o.tag=`div`}}),e.renderer.rules.alert_open=function(e,t){let{title:n,type:r,icon:i}=e[t].meta;return`<div class="${o} ${o}-${r}"><p class="${o}-title">${i}${n}</p>`}};function Rc(e){return e.charAt(0).toUpperCase()+e.slice(1)}function zc(e){function t(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==61)return!1;let i=e.scanDelims(e.pos,!0),a=i.length,o=String.fromCharCode(r);if(a<2)return!1;if(a%2){let t=e.push(`text`,``,0);t.content=o,a--}for(let t=0;t<a;t+=2){let n=e.push(`text`,``,0);n.content=o+o,!(!i.can_open&&!i.can_close)&&e.delimiters.push({marker:r,length:0,jump:t/2,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return e.pos+=i.length,!0}function n(e,t){let n=[],r=t.length;for(let i=0;i<r;i++){let r=t[i];if(r.marker!==61||r.end===-1)continue;let a=t[r.end],o=e.tokens[r.token];o.type=`mark_open`,o.tag=`mark`,o.nesting=1,o.markup=`==`,o.content=``;let s=e.tokens[a.token];s.type=`mark_close`,s.tag=`mark`,s.nesting=-1,s.markup=`==`,s.content=``,e.tokens[a.token-1].type===`text`&&e.tokens[a.token-1].content===`=`&&n.push(a.token-1)}for(;n.length;){let t=n.pop(),r=t+1;for(;r<e.tokens.length&&e.tokens[r].type===`mark_close`;)r++;if(r--,t!==r){let n=e.tokens[r];e.tokens[r]=e.tokens[t],e.tokens[t]=n}}}e.inline.ruler.before(`emphasis`,`mark`,t),e.inline.ruler2.before(`emphasis`,`mark`,function(e){let t,r=e.tokens_meta,i=(e.tokens_meta||[]).length;for(n(e,e.delimiters),t=0;t<i;t++)r[t]&&r[t].delimiters&&n(e,r[t].delimiters)})}var Bc=126,Vc=65662;function Hc(e,t){if(t||e.src.charCodeAt(e.pos)!==Bc)return!1;let n=e.scanDelims(e.pos,!0),r=e.push(`text`,``,0);return r.content=`~`.repeat(n.length),e.pos+=n.length,n.length>2||e.delimiters.push({marker:n.length===1?Vc:Bc,length:0,token:e.tokens.length-1,end:-1,open:n.can_open,close:n.can_close}),!0}function Uc(e,t){for(let n of t){if(n.marker!==Bc&&n.marker!==Vc||n.end===-1)continue;let r=t[n.end];if(!r)continue;let i=n.marker===Bc?`~~`:`~`,a=e.tokens[n.token],o=e.tokens[r.token];!a||!o||(a.type=`s_open`,a.tag=`s`,a.nesting=1,a.markup=i,a.content=``,o.type=`s_close`,o.tag=`s`,o.nesting=-1,o.markup=i,o.content=``)}}function Wc(e){Uc(e,e.delimiters);for(let t of e.tokens_meta)t?.delimiters&&Uc(e,t.delimiters)}function Gc(e){e.inline.ruler.at(`strikethrough`,Hc),e.inline.ruler2.at(`strikethrough`,Wc)}function Kc(e){return e&&`mathMacros`in e?e:{mathMacros:{}}}function qc(e,t){let n=$t(e.src,e.pos);if(!n||e.pos+n.length>e.posMax)return!1;if(!t){let t=e.push(`math`,``,0);t.content=n.tex,t.meta={display:n.display}}return e.pos+=n.length,!0}function Jc(e){return typeof e.meta==`object`&&e.meta!==null&&`display`in e.meta&&e.meta.display===!0}var H=new Ec({breaks:!1,html:!0,linkify:!0,typographer:!1});H.use(Fc),H.inline.ruler.disable(`footnote_inline`),H.renderer.rules.footnote_caption=(e,t)=>{let n=e[t]?.meta?.id;return String((typeof n==`number`?n:0)+1)};var Yc=H.renderer.rules.footnote_ref;H.renderer.rules.footnote_ref=(e,t,n,r,i)=>(Yc?.(e,t,n,r,i)??``).replace(`<a `,`<a data-footnote-ref `);var Xc=H.renderer.rules.footnote_anchor;H.renderer.rules.footnote_anchor=(e,t,n,r,i)=>{let a=e[t],o=a?.meta?.id,s=a?.meta?.subId,c=(typeof o==`number`?o:0)+1,l=(typeof s==`number`?s:0)+1;return(Xc?.(e,t,n,r,i)??``).replace(`<a `,`<a data-footnote-backref data-footnote-backref-idx="${l}" aria-label="Back to reference ${c}" `)},H.use(Lc,{matchCaseSensitive:!0}),H.use(zc),Gc(H),H.inline.ruler.before(`escape`,`puddle_math`,qc),H.renderer.rules.math=(e,t,n,r)=>{let i=e[t];return Xt(i.content,Jc(i),Kc(r).mathMacros)};var Zc=H.renderer.rules.fence;H.renderer.rules.fence=(e,t,n,r,i)=>{let a=e[t],o=a.info.trim().split(/\s+/)[0]?.toLowerCase();return o===`mermaid`?(a.attrJoin(`class`,`mermaid-diagram`),a.attrSet(`data-puddle-mermaid`,``),`<div${i.renderAttrs(a)}><pre><code>${H.utils.escapeHtml(a.content)}</code></pre></div>\n`):o===`math`?`<div${i.renderAttrs(a)}>${Xt(a.content,!0,Kc(r).mathMacros)}</div>\n`:Zc?Zc(e,t,n,r,i):i.renderToken(e,t,n)},H.core.ruler.after(`github-alerts`,`puddle_source_lines`,e=>{for(let t of e.tokens)!t.map||t.hidden||t.tag===``||t.nesting<0||(t.attrSet(Fn,String(t.map[0]+1)),t.attrSet(In,String(t.map[1]+1)))});var Qc=H.renderer.rules.alert_open;H.renderer.rules.alert_open=(e,t,n,r,i)=>(Qc?.(e,t,n,r,i)??``).replace(`<div`,`<div${i.renderAttrs(e[t])}`),H.core.ruler.after(`inline`,`puddle_task_lists`,e=>{let t=0;for(let n of e.tokens)if(n.type===`list_item_open`)t+=1;else if(n.type===`list_item_close`)--t;else if(n.type===`inline`&&t>0){let t=n.children?.[0],r=t?.type===`text`?/^\[([ xX])\]\s+/.exec(t.content):null;if(!t||!r)continue;t.content=t.content.slice(r[0].length);let i=new e.Token(`html_inline`,``,0);i.content=`<input type="checkbox" disabled${r[1].toLowerCase()===`x`?` checked`:``}> `,n.children.unshift(i)}});function $c(e,t){return H.render(e,{mathMacros:{},...t?{docId:t}:{}})}async function el(e,t,n){let r=`path=${encodeURIComponent(t)}${de(n)}`,i=f();return i?nl(i,async()=>{if(f()!==i)throw Error(`Preview host changed`);let t=s.parse(await k(`GET`,`/api/worktrees/${e}/preview-asset?${r}`));return new Blob([Uint8Array.from(atob(t.data),e=>e.charCodeAt(0))],{type:t.mime})}):(await A(`GET`,`/api/worktrees/${e}/media?${r}`)).blob()}var tl=new WeakMap;async function nl(e,t){let n=tl.get(e);if(n||(n={active:0,waiting:[]},tl.set(e,n)),n.waiting.length>=128)throw Error(`Too many preview assets`);n.active>=2?await new Promise(e=>n.waiting.push(e)):n.active+=1;try{return await t()}finally{let e=n.waiting.shift();e?e():--n.active}}function rl(e,t,n,r,i){(0,N.useEffect)(()=>{let t=e.current;if(!t)return;let a=!1,o=[],s=async e=>{try{let t=await el(n,e,i);if(a)return null;let r=URL.createObjectURL(t);return o.push(r),r}catch{return null}};for(let e of t.querySelectorAll(`img[src], source[src]`)){let t=mt(r,e.getAttribute(`src`)??``);t&&(e.removeAttribute(`src`),s(t).then(t=>{!a&&t&&e.setAttribute(`src`,t)}))}for(let e of t.querySelectorAll(`img[srcset], source[srcset]`)){let t=ht(e.getAttribute(`srcset`)??``),n=t.map(({ref:e})=>mt(r,e));n.some(e=>e!==null)&&(e.removeAttribute(`srcset`),Promise.all(t.map(async(e,t)=>{let r=n[t];if(!r)return e;let i=await s(r);return i?{...e,ref:i}:null})).then(t=>{if(a)return;let n=t.filter(e=>e!==null);n.length>0&&e.setAttribute(`srcset`,dt(n))}))}return()=>{a=!0;for(let e of o)URL.revokeObjectURL(e)}},[t,e,n,r,i])}function il(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);try{r.href=n,r.download=t,document.body.appendChild(r),r.click()}finally{r.remove(),setTimeout(()=>URL.revokeObjectURL(n),6e4)}}var al=(0,N.lazy)(()=>b(()=>import(`./NotebookWidget-Cwd77EGL.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])));function ol(e,t){return!t||typeof t!=`object`?e:e.replace(/attachment:([^\s"')>]+)/g,(e,n)=>{try{let r=t[decodeURIComponent(n)];if(!r||typeof r!=`object`)return e;for(let e of[`image/png`,`image/jpeg`,`image/gif`,`image/webp`]){let t=I(r[e]).replace(/\s/g,``);if(t&&/^[A-Za-z0-9+/]*={0,2}$/.test(t))return`data:${e};base64,${t}`}}catch{}return e})}function sl({text:e,markdown:t=!1,attachments:n}){let r=(0,N.useContext)(gi),i=(0,N.useRef)(null),a=(0,N.useId)().replace(/[^a-zA-Z0-9_-]/g,``),o=(0,N.useSyncExternalStore)(x,S,S),s=(0,N.useMemo)(()=>C.sanitize(t?$c(ol(e,n),a):e,{FORBID_TAGS:[`style`,`iframe`,`form`,`input`,`button`],...t?{}:{FORBID_ATTR:[`style`]}}),[e,t,n,a]),c=(0,N.useMemo)(()=>({__html:s}),[s,o]);return rl(i,s,r?.session??``,r?.path??``,r?.root),(0,N.useEffect)(()=>{let e=new AbortController;return i.current&&t&&en(i.current,o,e.signal),()=>e.abort()},[s,o,t]),(0,P.jsx)(`div`,{ref:i,className:`md-preview overflow-x-auto text-sm`,dangerouslySetInnerHTML:c,onClick:e=>{let t=e.target.closest(`a`);if(!t)return;let n=t.getAttribute(`href`)??``;if(/^https?:/i.test(n)){e.preventDefault(),window.open(n,`_blank`,`noopener,noreferrer`);return}if(n.startsWith(`#`)){e.preventDefault();try{i.current?.querySelector(`#${CSS.escape(decodeURIComponent(n.slice(1)))}`)?.scrollIntoView({block:`nearest`})}catch{}return}let a=r?mt(r.path,n):null;a&&(e.preventDefault(),(e.metaKey||e.ctrlKey)&&r?.onOpenFile?.(a))}})}var cl=`cursor-pointer rounded-sm p-1 text-fg-muted hover:bg-surface hover:text-fg`;function ll({output:e}){let t=null;for(let n of[`image/png`,`image/jpeg`,`image/gif`,`image/webp`]){let r=I(e.data?.[n]).replace(/\s/g,``);if(r&&/^[A-Za-z0-9+/]*={0,2}$/.test(r)){try{t={src:`data:${n};base64,${r}`,blob:new Blob([Uint8Array.from(atob(r),e=>e.charCodeAt(0))],{type:n}),extension:n.split(`/`)[1]}}catch{}if(t)break}}let n=I(e.data?.[`image/svg+xml`]),r=n?C.sanitize(n,{USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_TAGS:[`style`,`foreignObject`,`image`,`use`],FORBID_ATTR:[`style`,`href`,`xlink:href`]}):``,i=I(e.data?.[`text/html`]),a=I(e.data?.[`text/markdown`]),o=e.data?.[`application/json`],s=e.data?.[`application/vnd.jupyter.widget-view+json`],c=s&&typeof s==`object`&&`model_id`in s&&typeof s.model_id==`string`?s.model_id:null,l=$r(e)||(o===void 0?``:JSON.stringify(o,null,2))||`This output format cannot be displayed.`;return(0,P.jsxs)(`div`,{className:`group/output relative`,children:[(0,P.jsxs)(`div`,{className:`absolute right-1 top-0 z-10 flex gap-1 bg-ground opacity-0 group-hover/output:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100`,children:[(0,P.jsx)(`button`,{type:`button`,title:`Copy output`,"aria-label":`Copy output`,className:cl,onClick:()=>{navigator.clipboard.writeText(l).catch(()=>Ue.error(`Could not copy output`))},children:(0,P.jsx)(ct,{className:`size-3.5`})}),(t||r)&&(0,P.jsx)(`button`,{type:`button`,title:`Save image`,"aria-label":`Save image`,className:cl,onClick:()=>il(t?.blob??new Blob([r],{type:`image/svg+xml`}),`notebook-output.${t?.extension??`svg`}`),children:(0,P.jsx)(De,{className:`size-3.5`})})]}),c?(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Loading widget…`}),children:(0,P.jsx)(al,{modelId:c,fallback:$r(e)})}):t?(0,P.jsx)(`img`,{src:t.src,alt:`Notebook output`,className:`max-w-full`}):r?(0,P.jsx)(`div`,{dangerouslySetInnerHTML:{__html:r}}):i?(0,P.jsx)(sl,{text:i}):a?(0,P.jsx)(sl,{text:a,markdown:!0}):(0,P.jsx)(`pre`,{className:`overflow-x-auto whitespace-pre-wrap font-mono text-sm ${e.output_type===`error`?`text-danger`:`text-fg-secondary`}`,children:l})]})}function ul({source:e,execution:t,onInterrupt:n}){let r=(0,N.useRef)(null),i=(0,N.useRef)(!1),[a,o]=(0,N.useState)(``),[s,c]=(0,N.useState)(!1),[l,u]=(0,N.useState)(null),d=t.input;return(0,N.useEffect)(()=>{r.current?.focus({preventScroll:!0}),r.current?.scrollIntoView({block:`nearest`})},[]),d?(0,P.jsxs)(`form`,{className:`mt-2 font-mono text-sm text-fg-secondary`,"aria-busy":s,onSubmit:n=>{n.preventDefault(),!i.current&&(i.current=!0,c(!0),u(null),k(`POST`,`/api/notebooks/input`,{source:e,run_id:t.id,input_id:d.id,value:a}).then(()=>{d.password&&o(``)}).catch(e=>{u(e instanceof Error?e.message:`Input failed`),i.current=!1,c(!1)}))},children:[(0,P.jsxs)(`label`,{className:`flex min-w-0 flex-wrap items-baseline`,children:[(0,P.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:d.prompt}),(0,P.jsx)(`input`,{ref:r,"aria-label":d.prompt||`Kernel input`,type:d.password?`password`:`text`,value:a,readOnly:s,maxLength:65536,autoComplete:`off`,autoCapitalize:`off`,spellCheck:!1,onChange:e=>o(e.target.value),onKeyDown:e=>{n&&e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`c`&&e.currentTarget.selectionStart===e.currentTarget.selectionEnd&&(e.preventDefault(),e.stopPropagation(),n())},className:`min-w-16 flex-1 cursor-text bg-transparent p-0 text-fg outline-none read-only:opacity-60`})]}),l&&(0,P.jsx)(`p`,{role:`alert`,className:`mt-1 text-xs text-danger`,children:l})]}):null}var dl=`cursor-pointer rounded-sm p-1 text-fg-muted transition-colors hover:bg-surface hover:text-fg disabled:cursor-default disabled:opacity-40`;function fl({cell:e,notebook:t,index:n,active:r,editing:i,selected:a,editable:o,onSelect:s,onEdit:c,onSource:l,onLanguage:u,onExecute:d,onRun:f,onInterrupt:p,onOperation:m,onSplit:h,onSave:g,execution:_,inputExecution:v,inputSource:y,match:b,onToggleSection:x,sectionCollapsed:S}){let C=(0,N.useRef)(null),[w,ee]=(0,N.useState)(!1),T=y?v?.input:void 0;(0,N.useEffect)(()=>{(b?.output||T)&&ee(!1)},[b,T]);let E=w&&!T,D=e.cell_type===`code`,O=I(e.source),k=_?.state===`running`||_?.state===`queued`,A=Xr(e,t),j=(e,t,n,r=!1)=>(0,P.jsx)(`button`,{type:`button`,className:dl,title:e,"aria-label":e,onClick:n,disabled:r,children:t});return(0,P.jsxs)(`section`,{ref:C,"data-notebook-cell":n,"data-cell-id":e.id,tabIndex:r?0:-1,"aria-label":`Cell ${n+1}`,"aria-current":r||void 0,className:`group/cell relative min-w-0 outline-none ${a?`bg-surface`:``}`,onMouseDown:e=>{e.shiftKey&&!e.target.closest(`.monaco-editor,input,button`)&&e.preventDefault()},onFocus:()=>{r||s(!1)},onClick:e=>{if((e.metaKey||e.ctrlKey)&&D&&!e.target.closest(`.monaco-editor,a,button,input`)){e.preventDefault(),f?.(`cell`);return}e.target.closest(`button,input,[role=option]`)||s(e.shiftKey&&!e.target.closest(`.monaco-editor`))},children:[(0,P.jsx)(`div`,{className:`absolute -left-10 top-9 w-9 text-center font-mono text-xs text-fg-muted`,children:(0,P.jsxs)(`button`,{type:`button`,className:`${dl} group/run relative w-full`,disabled:!o||D&&(!f||!k&&!O.trim()),title:D?k?`Interrupt execution`:`Run Cell (⌘/Ctrl+Enter)`:i?`Show rendered cell`:`Edit cell source`,"aria-label":D?k?`Interrupt execution`:`Run Cell`:i?`Show rendered cell`:`Edit cell source`,onClick:()=>{D?k?p?.():f?.(`cell`):c(!i)},children:[(0,P.jsx)(`span`,{className:D&&f?`group-hover/run:invisible group-focus-visible/run:invisible`:``,children:D?`[${k?`*`:e.execution_count??` `}]`:i?`[›]`:`[ ]`}),D&&f&&(k?(0,P.jsx)(Fe,{className:`absolute inset-0 m-auto hidden size-3.5 group-hover/run:block group-focus-visible/run:block`}):(0,P.jsx)(Re,{className:`absolute inset-0 m-auto hidden size-3.5 group-hover/run:block group-focus-visible/run:block`}))]})}),(0,P.jsxs)(`div`,{className:`mb-2 flex min-h-7 items-center gap-2 text-xs text-fg-muted`,children:[x&&j(S?`Expand section`:`Fold section`,S?(0,P.jsx)(nt,{className:`size-3`}):(0,P.jsx)(tt,{className:`size-3`}),x),o?(0,P.jsx)(Ti,{language:e.cell_type===`raw`?`raw`:A,onChange:u}):(0,P.jsx)(`span`,{className:`font-mono`,children:e.cell_type===`raw`?`raw`:A}),_&&(0,P.jsxs)(`span`,{role:`status`,children:[_.state,_.elapsed_ms===void 0?``:` · ${(_.elapsed_ms/1e3).toFixed(1)}s`]}),_&&_.source!==O&&(0,P.jsx)(`span`,{title:`The source changed after this execution`,children:`Source changed`}),o&&(0,P.jsx)(Si,{code:D,onRun:f,busy:k,index:n,count:t.cells.length,canMerge:e.cell_type===t.cells[n+1]?.cell_type,onOperation:m})]}),o&&(D||i)?(0,P.jsx)(wi,{value:O,match:b&&!b.output?b:void 0,language:A,label:`Cell ${n+1} source`,focus:r&&i&&!b,onChange:e=>{e!==O&&l(e)},onExecute:d,onEscape:()=>{c(!1),C.current?.focus()},onSave:g,onSplit:h}):e.cell_type===`markdown`?(0,P.jsx)(`div`,{onDoubleClick:()=>{o&&c(!0)},className:o?`cursor-text`:``,children:(0,P.jsx)(sl,{text:O,markdown:!0,attachments:e.attachments})}):(0,P.jsx)(`pre`,{className:`overflow-x-auto whitespace-pre-wrap font-mono text-sm`,onDoubleClick:()=>{o&&c(!0)},children:O}),(!!e.outputs?.length||T)&&(0,P.jsxs)(`div`,{className:`mt-2`,role:`group`,"aria-label":`Cell ${n+1} output`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[j(E?`Expand output`:`Collapse output`,E?(0,P.jsx)(nt,{className:`size-3`}):(0,P.jsx)(tt,{className:`size-3`}),()=>ee(!w),!!T),(0,P.jsx)(`span`,{children:`Output`}),o&&j(`Clear cell output`,(0,P.jsx)(Ke,{className:`size-3`}),()=>m(`clear`))]}),!E&&(0,P.jsxs)(`div`,{className:`max-h-96 overflow-auto`,children:[e.outputs?.map((e,t)=>(0,P.jsx)(`div`,{className:`mt-2`,children:(0,P.jsx)(ll,{output:e})},t)),T&&v&&y&&(0,P.jsx)(ul,{source:y,execution:v,onInterrupt:p},`${v.id}:${T.id}`)]})]})]})}function pl({text:e,session:t,path:n,root:r,onChange:i,onRun:a,running:o,onUndo:s,onRedo:c,onOpenFile:l,focused:u=!0}){let d=(0,N.useMemo)(()=>{try{return{notebook:Yr(qr(e)),error:null}}catch(e){return{notebook:null,error:e instanceof Error?e.message:`Invalid notebook`}}},[e]),[f,p]=(0,N.useState)([]),[g,_]=(0,N.useState)(null),v=(0,N.useRef)(!0),[y,b]=(0,N.useState)(null),[x,S]=(0,N.useState)(null),C=(0,N.useRef)(null),[w,ee]=(0,N.useState)([]),T=(0,N.useRef)(null),E=(0,N.useRef)(null),D=(0,N.useRef)(null),O=qt(`notebook`,[t,r,n]),k=d.notebook!==null;(0,N.useLayoutEffect)(()=>{if(!T.current||!E.current||!k)return;let e=Yt(T.current,E.current,O);return()=>e.dispose()},[O,k]),(0,N.useLayoutEffect)(()=>{if(!D.current)return;let e=E.current?.querySelector(`[data-cell-id="${CSS.escape(D.current)}"]`);e&&(e.scrollIntoView({block:`nearest`}),v.current&&e.focus({preventScroll:!0}),v.current=!0,D.current=null)});let A=e=>i?.(`${JSON.stringify(e,null,1)}\n`),j=d.notebook,te=(0,N.useMemo)(()=>({session:t,path:n,...r===void 0?{}:{root:r}}),[t,n,r]),M=hi(te,j,i?A:void 0,!!a),ne=m(te,j,i?A:void 0,!!a),re=M.execution?.input?M.execution.cells.find(e=>e.state===`running`)?.id:void 0;if((0,N.useLayoutEffect)(()=>{if(!j||!re||!f.length)return;let e=j.cells.findIndex(e=>e.id===re),t=f.filter(t=>{let n=j.cells.findIndex(e=>e.id===t);return n<0||!ri(j,n).includes(e)});t.length!==f.length&&p(t)},[j,re,f]),!j)return(0,P.jsx)(`p`,{className:`p-6 text-sm text-danger`,role:`alert`,children:d.error});let ie=(e,t=!1)=>{let n=C.current??y??e,r=j.cells.findIndex(e=>e.id===n),i=j.cells.findIndex(t=>t.id===e);ee(t?j.cells.slice(Math.min(r,i),Math.max(r,i)+1).map(e=>e.id):[e]),t||(C.current=e),b(e)},ae=(e,t=!1,n=!1)=>{ie(e,n),S(t?e:null),D.current=e},oe=ni(j),se=new Set(j.cells.flatMap((e,t)=>f.includes(e.id)?ri(j,t).slice(1):[])),{add:ce,replace:le,execute:ue,operation:de,keyDown:fe}=oi({notebook:j,active:y,selected:w,update:A,choose:ae,setEditing:S,run:M.run,onUndo:s,onRedo:c});return(0,P.jsx)(h.Provider,{value:ne,children:(0,P.jsx)(gi.Provider,{value:{...te,onOpenFile:l,intelligence:M.intelligenceSupported},children:(0,P.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col bg-ground`,onKeyDown:i?fe:void 0,onCopy:e=>{i&&si(e,`copy`,j,w,A)},onCut:e=>{i&&si(e,`cut`,j,w,A)},onPaste:e=>{i&&si(e,`paste`,j,w,A)},children:[(0,P.jsx)(ui,{notebook:j,focused:u,onChange:i?A:void 0,onReveal:e=>{_(e),e&&(p([]),b(e.id),e.output||S(e.id),D.current=e.id,v.current=!1)}}),(0,P.jsx)(xi,{notebook:j,source:{session:t,path:n,...r===void 0?{}:{root:r}},onChange:i?A:void 0,onAdd:ce,onRun:M.supported?()=>{M.run()}:a,onRunCopy:M.supported?a:void 0,running:o||M.busy,onRevealCell:e=>{p([]),ae(j.cells[e].id)},onRunSection:M.supported?e=>{M.run(ri(j,e))}:void 0}),(0,P.jsx)(`div`,{ref:T,className:`min-h-0 flex-1 overflow-auto bg-ground text-fg`,children:(0,P.jsxs)(`div`,{ref:E,className:`mx-auto flex max-w-4xl flex-col gap-7 py-6 pr-6 pl-14`,children:[(0,P.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[j.cells.length,` cells`]}),ne.saveWarning&&(0,P.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:ne.saveWarning}),M.error&&(0,P.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:M.error}),j.cells.map((e,a)=>se.has(a)?null:(0,P.jsx)(fl,{cell:e,match:g&&g.id===e.id?g:void 0,sectionCollapsed:f.includes(e.id),onToggleSection:oe[a]?.level?()=>p(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id]):void 0,notebook:j,index:a,active:y===e.id,editing:x===e.id,selected:w.length>1&&w.includes(e.id),editable:!!i,onSelect:t=>ie(e.id,t),onEdit:t=>{b(e.id),S(t?e.id:null)},onSource:e=>A(Jr(j,a,e)),onLanguage:t=>le(a,Zr(e,t)),onInterrupt:()=>{M.interrupt()},execution:M.execution?.cells.find(t=>t.id===e.id)??ai(e),inputExecution:re===e.id?M.execution??void 0:void 0,inputSource:te,onRun:M.supported?e=>{M.run(j.cells.flatMap((t,n)=>(e===`cell`?n===a:e===`above`?n<a:n>=a)?[n]:[]))}:void 0,onExecute:e=>ue(a,e),onOperation:e=>de(a,e),onSave:()=>{Me(je(t,n,r))},onSplit:t=>{if(j.cells.length>=2e3)return;let n=I(e.source),r={...Qr(e.cell_type),source:n.slice(t)},i=[...j.cells];i.splice(a,1,{...e,source:n.slice(0,t)},r),A({...j,cells:i}),ae(r.id,!0)}},e.id)),i&&(0,P.jsx)(`div`,{className:`flex gap-3`,children:[`code`,`markdown`,`raw`].map(e=>(0,P.jsxs)(`button`,{disabled:j.cells.length>=2e3,className:`cursor-pointer rounded-sm p-1 text-fg-muted transition-colors hover:bg-surface hover:text-fg disabled:cursor-default disabled:opacity-40 flex items-center gap-1.5 text-xs`,onClick:()=>ce(e,j.cells.length),children:[(0,P.jsx)(qe,{className:`size-3.5`}),e===`code`?`Code`:e===`markdown`?`Markdown`:`Raw`,` cell`]},e))})]})})]})})})}var ml=0;function hl(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){let t=e.parentElement;return!e.textContent||t?.closest(`script, style, noscript, [hidden], [aria-hidden="true"]`)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),n=[],r=``,i;for(;i=t.nextNode();){let e=i.textContent??``,t=r.length;r+=e,n.push({node:i,start:t,end:r.length})}return{text:r,nodes:n}}function gl(e,t){let n=t.find(t=>t.end>e.start),r=t.findLast(t=>t.start<e.end);if(!n||!r)return null;let i=document.createRange();return i.setStart(n.node,e.start-n.start),i.setEnd(r.node,e.end-r.start),i}var _l=class{root;matchName=`puddle-find-${++ml}-match`;activeName=`puddle-find-${ml}-active`;style;signature=``;ranges=[];index=-1;limited=!1;constructor(e){this.root=e,this.style=document.createElement(`style`),this.style.textContent=`
26
+ ::highlight(${this.matchName}) { background: var(--selection); }
27
+ ::highlight(${this.activeName}) { background: var(--accent); color: var(--action-ink); }
28
+ `,document.head.appendChild(this.style)}find(e,t,n){let r=JSON.stringify([e,t]);if(r!==this.signature||n===`reset`){this.signature=r;let n=hl(this.root),i=ot(n.text,e,t);if(this.ranges=i.matches.map(e=>gl(e,n.nodes)).filter(e=>e!==null),this.limited=i.limited,this.index=this.ranges.length>0?0:-1,i.invalid)return this.clearHighlights(),{index:-1,count:0,invalid:!0}}else this.ranges.length>0&&(this.index=n===`previous`?(this.index-1+this.ranges.length)%this.ranges.length:(this.index+1)%this.ranges.length);return this.paint(),{index:this.index,count:this.ranges.length,limited:this.limited}}clear(){this.signature=``,this.ranges=[],this.index=-1,this.limited=!1,this.clearHighlights()}dispose(){this.clear(),this.style.remove()}clearHighlights(){CSS.highlights.delete(this.matchName),CSS.highlights.delete(this.activeName)}paint(){if(this.clearHighlights(),this.ranges.length===0)return;CSS.highlights.set(this.matchName,new Highlight(...this.ranges));let e=this.ranges[this.index];e&&(CSS.highlights.set(this.activeName,new Highlight(e)),e.startContainer.parentElement?.scrollIntoView({block:`center`,inline:`nearest`}))}};C.addHook(`afterSanitizeAttributes`,e=>{e.tagName===`A`&&/^https?:/i.test(e.getAttribute(`href`)??``)&&(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`))});function vl({session:e,path:t,text:n,root:r,scrollDriver:i=!1,scrollReceiver:a=!1,scrollChannel:o=`profile`,focused:s=!0,onRevealSource:c,onOpenFile:l,mobile:u=!1}){let d=qt(`markdown`,[e,r,t]),f=(0,N.useId)().replace(/[^A-Za-z0-9_-]/g,``),p=(0,N.useSyncExternalStore)(e=>x(e),S,S),m=(0,N.useMemo)(()=>C.sanitize($c(n,f)),[n,f]),h=(0,N.useMemo)(()=>Kn(n),[n]),_=(0,N.useMemo)(()=>({__html:m}),[m,p]),v=(0,N.useRef)(null),y=(0,N.useRef)(null),b=(0,N.useRef)(null);(0,N.useEffect)(()=>{let e=y.current;if(!e)return;let t=new _l(e);return b.current=t,()=>{t.dispose(),b.current=null}},[]);let w=rt({shortcutEnabled:s,onFind:(e,t,n)=>b.current?.find(e,t,n)??at,onClear:()=>b.current?.clear(),onCloseFocus:()=>v.current?.focus({preventScroll:!0})});(0,N.useEffect)(()=>w.refresh(),[m,p,w.refresh]),(0,N.useEffect)(()=>{let e=y.current;if(!e)return;let t=new AbortController;return en(e,p,t.signal).then(()=>{t.signal.aborted||w.refresh()}),()=>t.abort()},[m,p,w.refresh]),(0,N.useLayoutEffect)(()=>{let n=v.current,s=y.current;if(!(!n||!s))return tr(n,{viewKey:d,channel:o,target:{session:e,path:t,root:r},driver:i,receiver:a,resizeElements:[n,s],sourceAnchors:()=>Gn(n,s,h)})},[m,h,e,t,r,o,i,a,d]),rl(y,m,e,t,r);let ee=e=>{let n=e.target.closest(`a`);if(n){let r=n.getAttribute(`href`)??``;if(/^https?:/i.test(r))return;if(e.preventDefault(),r.startsWith(`#`)){let e=yl(r);(e?y.current?.querySelector(`#${CSS.escape(e)}`):null)?.scrollIntoView({block:`nearest`});return}if(!u&&!e.metaKey&&!e.ctrlKey)return;let i=mt(t,r);if(!i)return;l?.(i);return}if(!e.metaKey&&!e.ctrlKey||!c)return;let r=v.current,i=y.current;if(!r||!i)return;let a=e.clientY-r.getBoundingClientRect().top+r.scrollTop,o=Un(Gn(r,i,h),a);o!==null&&(e.preventDefault(),c({line:li(o,h)}))},T=g().editorFontSize;return(0,P.jsxs)(`div`,{className:`relative size-full bg-ground`,children:[(0,P.jsx)(`div`,{ref:v,tabIndex:-1,className:`h-full overflow-auto overscroll-contain outline-none`,children:(0,P.jsx)(`div`,{ref:y,onClick:ee,style:{fontSize:T},className:`md-preview mx-auto max-w-3xl px-6 py-5 text-fg-secondary`,dangerouslySetInnerHTML:_})}),(0,P.jsx)(ci,{controls:w})]})}function yl(e){try{return decodeURIComponent(e.slice(1))}catch{return null}}var bl=`puddle-preview-scroll-report`,xl=`puddle-preview-scroll-apply`,Sl=`puddle-preview-source-reveal`;function Cl(){return crypto.randomUUID()}function wl(e,t,n){if(e.source!==t||t===null||typeof e.data!=`object`||e.data===null)return null;let r=e.data;return r.channel===n?r:null}function Tl(e,t,n){let r=wl(e,t,n);return!r||r.kind!==`puddle-preview-scroll-report`||typeof r.ratio!=`number`||!Number.isFinite(r.ratio)||r.sourceLine!==null&&(typeof r.sourceLine!=`number`||!Number.isFinite(r.sourceLine))||typeof r.layout!=`boolean`||typeof r.scrolled!=`boolean`?null:{kind:bl,channel:n,ratio:qn(r.ratio),sourceLine:r.sourceLine===null?null:Math.max(1,r.sourceLine),layout:r.layout,scrolled:r.scrolled}}function El(e,t,n){let r=wl(e,t,n);return!r||r.kind!==`puddle-preview-source-reveal`||typeof r.line!=`number`||!Number.isFinite(r.line)?null:{kind:Sl,channel:n,line:Math.max(1,r.line)}}function Dl(e,t,n){e?.postMessage({kind:xl,channel:t,ratio:qn(n.ratio),sourceLine:n.sourceLine!==null&&Number.isFinite(n.sourceLine)?Math.max(1,n.sourceLine):null},`*`)}function Ol(e){return`(() => {
29
+ const channel = ${JSON.stringify(e)};
30
+ const reportKind = ${JSON.stringify(bl)};
31
+ const applyKind = ${JSON.stringify(xl)};
32
+ const revealKind = ${JSON.stringify(Sl)};
33
+ const lineAttribute = ${JSON.stringify(Fn)};
34
+ const endLineAttribute = ${JSON.stringify(In)};
35
+ const countAttribute = ${JSON.stringify(Ln)};
36
+ let frame = 0;
37
+ let layoutChanged = false;
38
+ let scrolled = false;
39
+ let sourceAnchors = [];
40
+ const scrolling = () => document.scrollingElement || document.documentElement;
41
+ const clamp = (value, lower, upper) => Math.min(upper, Math.max(lower, value));
42
+ const numberAttribute = (element, attribute) => {
43
+ const value = Number(element.getAttribute(attribute));
44
+ return Number.isFinite(value) && value >= 1 ? value : null;
45
+ };
46
+ const measureAnchors = () => {
47
+ const root = scrolling();
48
+ const lineCount = numberAttribute(document.documentElement, countAttribute);
49
+ if (lineCount === null) {
50
+ sourceAnchors = [];
51
+ return;
52
+ }
53
+ const values = [{ line: 1, offset: 0 }];
54
+ for (const element of document.querySelectorAll('[' + lineAttribute + ']')) {
55
+ const line = numberAttribute(element, lineAttribute);
56
+ if (line === null || line > lineCount + 1 || element.getClientRects().length === 0) continue;
57
+ const rect = element.getBoundingClientRect();
58
+ const top = rect.top + root.scrollTop;
59
+ values.push({ line, offset: top });
60
+ const endLine = numberAttribute(element, endLineAttribute);
61
+ if (endLine !== null && endLine <= lineCount + 1 && endLine > line && rect.height > 0) {
62
+ values.push({ line: endLine, offset: top + rect.height });
63
+ }
64
+ }
65
+ values.push({ line: lineCount + 1, offset: root.scrollHeight });
66
+ values.sort((a, b) => a.offset - b.offset || a.line - b.line);
67
+ const result = [];
68
+ for (const value of values) {
69
+ const previous = result[result.length - 1];
70
+ if (previous && (value.line <= previous.line || value.offset <= previous.offset)) continue;
71
+ result.push(value);
72
+ }
73
+ sourceAnchors = result;
74
+ };
75
+ const interpolate = (value, lowerInput, upperInput, lowerOutput, upperOutput) => {
76
+ if (upperInput <= lowerInput) return lowerOutput;
77
+ const progress = clamp((value - lowerInput) / (upperInput - lowerInput), 0, 1);
78
+ return lowerOutput + progress * (upperOutput - lowerOutput);
79
+ };
80
+ const mapped = (value, input, output) => {
81
+ const values = sourceAnchors;
82
+ if (!values.length) return null;
83
+ if (value <= values[0][input]) return values[0][output];
84
+ const last = values[values.length - 1];
85
+ if (value >= last[input]) return last[output];
86
+ let low = 0;
87
+ let high = values.length - 1;
88
+ while (low + 1 < high) {
89
+ const middle = Math.floor((low + high) / 2);
90
+ if (values[middle][input] <= value) low = middle;
91
+ else high = middle;
92
+ }
93
+ return interpolate(value, values[low][input], values[high][input],
94
+ values[low][output], values[high][output]);
95
+ };
96
+ const report = () => {
97
+ frame = 0;
98
+ if (layoutChanged) measureAnchors();
99
+ const root = scrolling();
100
+ const ratio = clamp(root.scrollTop / Math.max(1, root.scrollHeight - innerHeight), 0, 1);
101
+ const sourceLine = mapped(root.scrollTop, 'offset', 'line');
102
+ parent.postMessage({ kind: reportKind, channel, ratio, sourceLine, layout: layoutChanged, scrolled }, '*');
103
+ layoutChanged = false;
104
+ scrolled = false;
105
+ };
106
+ const schedule = (layout = false) => {
107
+ layoutChanged = layoutChanged || layout;
108
+ if (!frame) frame = requestAnimationFrame(report);
109
+ };
110
+ addEventListener('scroll', () => { scrolled = true; schedule(false); }, { passive: true });
111
+ addEventListener('load', () => schedule(true));
112
+ const resizeObserver = new ResizeObserver(() => schedule(true));
113
+ resizeObserver.observe(document.documentElement);
114
+ if (document.body) resizeObserver.observe(document.body);
115
+ const mutationObserver = new MutationObserver(() => schedule(true));
116
+ mutationObserver.observe(document.documentElement, { subtree: true, childList: true, attributes: true });
117
+ addEventListener('click', (event) => {
118
+ if ((!event.metaKey && !event.ctrlKey) || event.button !== 0) return;
119
+ const target = event.target instanceof Element ? event.target : null;
120
+ if (target && target.closest('a[href]')) return;
121
+ if (layoutChanged) measureAnchors();
122
+ const root = scrolling();
123
+ const line = mapped(event.clientY + root.scrollTop, 'offset', 'line');
124
+ if (line === null) return;
125
+ event.preventDefault();
126
+ event.stopPropagation();
127
+ parent.postMessage({ kind: revealKind, channel, line }, '*');
128
+ }, true);
129
+ addEventListener('message', (event) => {
130
+ const data = event.data;
131
+ if (event.source !== parent || !data || data.kind !== applyKind ||
132
+ data.channel !== channel || typeof data.ratio !== 'number' ||
133
+ !Number.isFinite(data.ratio) ||
134
+ (data.sourceLine !== null &&
135
+ (typeof data.sourceLine !== 'number' || !Number.isFinite(data.sourceLine)))) return;
136
+ if (layoutChanged) measureAnchors();
137
+ const root = scrolling();
138
+ const ratio = clamp(data.ratio, 0, 1);
139
+ const maximum = Math.max(0, root.scrollHeight - innerHeight);
140
+ const semantic = ratio > 0 && ratio < 1 && data.sourceLine !== null
141
+ ? mapped(data.sourceLine, 'line', 'offset')
142
+ : null;
143
+ scrollTo(0, semantic === null ? ratio * maximum : clamp(semantic, 0, maximum));
144
+ });
145
+ schedule(true);
146
+ })();`}function kl(e,t){let n=e.createElement(`script`);n.textContent=Ol(t),(e.body??e.documentElement).appendChild(n)}var Al=`puddle-preview-find-open`,jl=`puddle-preview-find-apply`,Ml=`puddle-preview-find-result`,Nl=`puddle-preview-find-clear`;function Pl(e,t,n){if(e.source!==t||t===null||typeof e.data!=`object`||e.data===null)return null;let r=e.data;return r.channel===n?r.kind===`puddle-preview-find-open`?{kind:Al,channel:n}:r.kind!==`puddle-preview-find-result`||typeof r.index!=`number`||!Number.isInteger(r.index)||r.index<-1||typeof r.count!=`number`||!Number.isInteger(r.count)||r.count<0||r.invalid!==void 0&&typeof r.invalid!=`boolean`||r.limited!==void 0&&typeof r.limited!=`boolean`?null:{kind:Ml,channel:n,index:r.index,count:r.count,...r.invalid===void 0?{}:{invalid:r.invalid},...r.limited===void 0?{}:{limited:r.limited}}:null}function Fl(e,t,n,r,i){e?.postMessage({kind:jl,channel:t,query:n,options:r,direction:i},`*`)}function Il(e,t){e?.postMessage({kind:Nl,channel:t},`*`)}function Ll(e){return`(() => {
147
+ const channel = ${JSON.stringify(e)};
148
+ const openKind = ${JSON.stringify(Al)};
149
+ const applyKind = ${JSON.stringify(jl)};
150
+ const resultKind = ${JSON.stringify(Ml)};
151
+ const clearKind = ${JSON.stringify(Nl)};
152
+ const matchName = 'puddle-find-match';
153
+ const activeName = 'puddle-find-active';
154
+ const limit = 1000;
155
+ let signature = '';
156
+ let ranges = [];
157
+ let index = -1;
158
+ let limited = false;
159
+
160
+ const style = document.createElement('style');
161
+ style.textContent =
162
+ '::highlight(' + matchName + ') { background: Mark; color: MarkText; }' +
163
+ '::highlight(' + activeName + ') { background: Highlight; color: HighlightText; }';
164
+ (document.head || document.documentElement).appendChild(style);
165
+
166
+ const clearHighlights = () => {
167
+ CSS.highlights.delete(matchName);
168
+ CSS.highlights.delete(activeName);
169
+ };
170
+ const clear = () => {
171
+ signature = '';
172
+ ranges = [];
173
+ index = -1;
174
+ limited = false;
175
+ clearHighlights();
176
+ };
177
+ const report = (invalid = false) => {
178
+ parent.postMessage({
179
+ kind: resultKind,
180
+ channel,
181
+ index,
182
+ count: ranges.length,
183
+ invalid,
184
+ limited,
185
+ }, '*');
186
+ };
187
+ const textNodes = () => {
188
+ const walker = document.createTreeWalker(document.body || document.documentElement,
189
+ NodeFilter.SHOW_TEXT, {
190
+ acceptNode(node) {
191
+ const parent = node.parentElement;
192
+ if (!node.textContent || (parent && parent.closest(
193
+ 'script, style, noscript, [hidden], [aria-hidden="true"]'
194
+ ))) return NodeFilter.FILTER_REJECT;
195
+ return NodeFilter.FILTER_ACCEPT;
196
+ }
197
+ });
198
+ const nodes = [];
199
+ let text = '';
200
+ let node;
201
+ while (node = walker.nextNode()) {
202
+ const value = node.textContent || '';
203
+ const start = text.length;
204
+ text += value;
205
+ nodes.push({ node, start, end: text.length });
206
+ }
207
+ return { text, nodes };
208
+ };
209
+ const compile = (query, options) => {
210
+ const slash = String.fromCharCode(92);
211
+ const specials = new Set(['.', '*', '+', '?', '^', '$', '{', '}', '(', ')', '|', '[', ']', slash]);
212
+ let pattern = options.regex
213
+ ? query
214
+ : Array.from(query, (character) => specials.has(character) ? slash + character : character).join('');
215
+ if (options.wholeWord) pattern = slash + 'b(?:' + pattern + ')' + slash + 'b';
216
+ return new RegExp(pattern, options.caseSensitive ? 'g' : 'gi');
217
+ };
218
+ const rangeFor = (match, nodes) => {
219
+ const first = nodes.find((entry) => entry.end > match.start);
220
+ const last = nodes.findLast((entry) => entry.start < match.end);
221
+ if (!first || !last) return null;
222
+ const range = document.createRange();
223
+ range.setStart(first.node, match.start - first.start);
224
+ range.setEnd(last.node, match.end - last.start);
225
+ return range;
226
+ };
227
+ const rebuild = (query, options) => {
228
+ ranges = [];
229
+ limited = false;
230
+ index = -1;
231
+ if (!query) return false;
232
+ let matcher;
233
+ try {
234
+ matcher = compile(query, options);
235
+ } catch {
236
+ return true;
237
+ }
238
+ const content = textNodes();
239
+ let match;
240
+ while (match = matcher.exec(content.text)) {
241
+ if (!match[0].length) {
242
+ matcher.lastIndex++;
243
+ continue;
244
+ }
245
+ if (ranges.length === limit) {
246
+ limited = true;
247
+ break;
248
+ }
249
+ const range = rangeFor(
250
+ { start: match.index, end: match.index + match[0].length },
251
+ content.nodes,
252
+ );
253
+ if (range) ranges.push(range);
254
+ }
255
+ index = ranges.length ? 0 : -1;
256
+ return false;
257
+ };
258
+ const paint = () => {
259
+ clearHighlights();
260
+ if (!ranges.length) return;
261
+ CSS.highlights.set(matchName, new Highlight(...ranges));
262
+ const active = ranges[index];
263
+ if (!active) return;
264
+ CSS.highlights.set(activeName, new Highlight(active));
265
+ const element = active.startContainer.parentElement;
266
+ if (element) element.scrollIntoView({ block: 'center', inline: 'nearest' });
267
+ };
268
+
269
+ addEventListener('keydown', (event) => {
270
+ const mac = /Mac|iPhone|iPad/.test(navigator.platform);
271
+ const modifier = mac
272
+ ? event.metaKey && !event.ctrlKey
273
+ : event.ctrlKey && !event.metaKey;
274
+ if (event.key.toLowerCase() !== 'f' || !modifier || event.altKey || event.shiftKey) return;
275
+ event.preventDefault();
276
+ event.stopPropagation();
277
+ parent.postMessage({ kind: openKind, channel }, '*');
278
+ }, true);
279
+
280
+ addEventListener('message', (event) => {
281
+ const data = event.data;
282
+ if (event.source !== parent || !data || data.channel !== channel) return;
283
+ if (data.kind === clearKind) {
284
+ clear();
285
+ return;
286
+ }
287
+ if (data.kind !== applyKind || typeof data.query !== 'string' ||
288
+ !data.options || typeof data.options !== 'object') return;
289
+ const nextSignature = JSON.stringify([data.query, data.options]);
290
+ let invalid = false;
291
+ if (nextSignature !== signature || data.direction === 'reset') {
292
+ signature = nextSignature;
293
+ invalid = rebuild(data.query, data.options);
294
+ } else if (ranges.length) {
295
+ index = data.direction === 'previous'
296
+ ? (index - 1 + ranges.length) % ranges.length
297
+ : (index + 1) % ranges.length;
298
+ }
299
+ if (invalid) clearHighlights();
300
+ else paint();
301
+ report(invalid);
302
+ });
303
+ })();`}function Rl(e,t){let n=e.createElement(`script`);n.textContent=Ll(t),(e.body??e.documentElement).appendChild(n)}var zl=`script, style, pre, code, kbd, samp, textarea, math, svg, .katex`,Bl=/\bmathjax\b|\bkatex\b/i;function Vl(e){if(Ul(e))return!1;let t=e.body??e.documentElement;return t?Hl(t):!1}function Hl(e){let t=e.ownerDocument,n=t.createTreeWalker(e,NodeFilter.SHOW_TEXT),r=[];for(;n.nextNode();){let e=n.currentNode;/[$\\]/.test(e.data)&&(e.parentElement?.closest(zl)||r.push(e))}let i={},a=!1;for(let e of r)Wl(t,e,i)&&(a=!0);return a}function Ul(e){if(e.querySelector(`.katex, math`))return!0;for(let t of e.querySelectorAll(`script`))if(Bl.test(t.getAttribute(`src`)??``)||Bl.test(t.textContent??``))return!0;return!1}function Wl(e,t,n){let r=t.data;if(!Qt(r))return!1;let i=e.createDocumentFragment(),a=e.createElement(`span`),o=0;for(let t=Qt(r,0);t;t=Qt(r,o)){for(t.start>o&&i.appendChild(e.createTextNode(r.slice(o,t.start))),a.innerHTML=Xt(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 Gl=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]),U;(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`})(U||={});var W={DASH_DASH:`--`,CDATA_START:`[CDATA[`,DOCTYPE:`doctype`,SCRIPT:`script`,PUBLIC:`public`,SYSTEM:`system`};function Kl(e){return e>=55296&&e<=57343}function ql(e){return e>=56320&&e<=57343}function Jl(e,t){return(e-55296)*1024+9216+t}function Yl(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function Xl(e){return e>=64976&&e<=65007||Gl.has(e)}var G;(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`})(G||={});var Zl=65536,Ql=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=Zl,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(ql(t))return this.pos++,this._addGap(),Jl(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,U.EOF;return this._err(G.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,U.EOF;let n=this.html.charCodeAt(t);return n===U.CARRIAGE_RETURN?U.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,U.EOF;let e=this.html.charCodeAt(this.pos);return e===U.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,U.LINE_FEED):e===U.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,Kl(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===U.LINE_FEED||e===U.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){Yl(e)?this._err(G.controlCharacterInInputStream):Xl(e)&&this._err(G.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}},K;(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`})(K||={});function $l(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 q;(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/`})(q||={});var eu;(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`})(eu||={});var tu;(function(e){e.NO_QUIRKS=`no-quirks`,e.QUIRKS=`quirks`,e.LIMITED_QUIRKS=`limited-quirks`})(tu||={});var J;(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`})(J||={});var Y;(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`})(Y||={});var nu=new Map([[J.A,Y.A],[J.ADDRESS,Y.ADDRESS],[J.ANNOTATION_XML,Y.ANNOTATION_XML],[J.APPLET,Y.APPLET],[J.AREA,Y.AREA],[J.ARTICLE,Y.ARTICLE],[J.ASIDE,Y.ASIDE],[J.B,Y.B],[J.BASE,Y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.NAV],[J.NOBR,Y.NOBR],[J.NOFRAMES,Y.NOFRAMES],[J.NOEMBED,Y.NOEMBED],[J.NOSCRIPT,Y.NOSCRIPT],[J.OBJECT,Y.OBJECT],[J.OL,Y.OL],[J.OPTGROUP,Y.OPTGROUP],[J.OPTION,Y.OPTION],[J.P,Y.P],[J.PARAM,Y.PARAM],[J.PLAINTEXT,Y.PLAINTEXT],[J.PRE,Y.PRE],[J.RB,Y.RB],[J.RP,Y.RP],[J.RT,Y.RT],[J.RTC,Y.RTC],[J.RUBY,Y.RUBY],[J.S,Y.S],[J.SCRIPT,Y.SCRIPT],[J.SEARCH,Y.SEARCH],[J.SECTION,Y.SECTION],[J.SELECT,Y.SELECT],[J.SOURCE,Y.SOURCE],[J.SMALL,Y.SMALL],[J.SPAN,Y.SPAN],[J.STRIKE,Y.STRIKE],[J.STRONG,Y.STRONG],[J.STYLE,Y.STYLE],[J.SUB,Y.SUB],[J.SUMMARY,Y.SUMMARY],[J.SUP,Y.SUP],[J.TABLE,Y.TABLE],[J.TBODY,Y.TBODY],[J.TEMPLATE,Y.TEMPLATE],[J.TEXTAREA,Y.TEXTAREA],[J.TFOOT,Y.TFOOT],[J.TD,Y.TD],[J.TH,Y.TH],[J.THEAD,Y.THEAD],[J.TITLE,Y.TITLE],[J.TR,Y.TR],[J.TRACK,Y.TRACK],[J.TT,Y.TT],[J.U,Y.U],[J.UL,Y.UL],[J.SVG,Y.SVG],[J.VAR,Y.VAR],[J.WBR,Y.WBR],[J.XMP,Y.XMP]]);function ru(e){return nu.get(e)??Y.UNKNOWN}var X=Y,iu={[q.HTML]:new Set([X.ADDRESS,X.APPLET,X.AREA,X.ARTICLE,X.ASIDE,X.BASE,X.BASEFONT,X.BGSOUND,X.BLOCKQUOTE,X.BODY,X.BR,X.BUTTON,X.CAPTION,X.CENTER,X.COL,X.COLGROUP,X.DD,X.DETAILS,X.DIR,X.DIV,X.DL,X.DT,X.EMBED,X.FIELDSET,X.FIGCAPTION,X.FIGURE,X.FOOTER,X.FORM,X.FRAME,X.FRAMESET,X.H1,X.H2,X.H3,X.H4,X.H5,X.H6,X.HEAD,X.HEADER,X.HGROUP,X.HR,X.HTML,X.IFRAME,X.IMG,X.INPUT,X.LI,X.LINK,X.LISTING,X.MAIN,X.MARQUEE,X.MENU,X.META,X.NAV,X.NOEMBED,X.NOFRAMES,X.NOSCRIPT,X.OBJECT,X.OL,X.P,X.PARAM,X.PLAINTEXT,X.PRE,X.SCRIPT,X.SECTION,X.SELECT,X.SOURCE,X.STYLE,X.SUMMARY,X.TABLE,X.TBODY,X.TD,X.TEMPLATE,X.TEXTAREA,X.TFOOT,X.TH,X.THEAD,X.TITLE,X.TR,X.TRACK,X.UL,X.WBR,X.XMP]),[q.MATHML]:new Set([X.MI,X.MO,X.MN,X.MS,X.MTEXT,X.ANNOTATION_XML]),[q.SVG]:new Set([X.TITLE,X.FOREIGN_OBJECT,X.DESC]),[q.XLINK]:new Set,[q.XML]:new Set,[q.XMLNS]:new Set},au=new Set([X.H1,X.H2,X.H3,X.H4,X.H5,X.H6]),ou=new Set([J.STYLE,J.SCRIPT,J.XMP,J.IFRAME,J.NOEMBED,J.NOFRAMES,J.PLAINTEXT]);function su(e,t){return ou.has(e)||t&&e===J.NOSCRIPT}var Z;(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`})(Z||={});var cu={DATA:Z.DATA,RCDATA:Z.RCDATA,RAWTEXT:Z.RAWTEXT,SCRIPT_DATA:Z.SCRIPT_DATA,PLAINTEXT:Z.PLAINTEXT,CDATA_SECTION:Z.CDATA_SECTION};function lu(e){return e>=U.DIGIT_0&&e<=U.DIGIT_9}function uu(e){return e>=U.LATIN_CAPITAL_A&&e<=U.LATIN_CAPITAL_Z}function du(e){return e>=U.LATIN_SMALL_A&&e<=U.LATIN_SMALL_Z}function fu(e){return du(e)||uu(e)}function pu(e){return fu(e)||lu(e)}function mu(e){return e+32}function hu(e){return e===U.SPACE||e===U.LINE_FEED||e===U.TABULATION||e===U.FORM_FEED}function gu(e){return hu(e)||e===U.SOLIDUS||e===U.GREATER_THAN_SIGN}function _u(e){return e===U.NULL?G.nullCharacterReference:e>1114111?G.characterReferenceOutsideUnicodeRange:Kl(e)?G.surrogateCharacterReference:Xl(e)?G.noncharacterCharacterReference:Yl(e)||e===U.CARRIAGE_RETURN?G.controlCharacterReference:null}var vu=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=Z.DATA,this.returnState=Z.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:``,value:``},this.preprocessor=new Ql(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new la(na,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(G.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(G.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{let t=_u(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:K.START_TAG,tagName:``,tagID:Y.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:K.END_TAG,tagName:``,tagID:Y.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:K.COMMENT,data:``,location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:K.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($l(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(G.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=ru(e.tagName),e.type===K.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(G.endTagWithAttributes),e.selfClosing&&this._err(G.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 K.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case K.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case K.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:K.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=hu(e)?K.WHITESPACE_CHARACTER:e===U.NULL?K.NULL_CHARACTER:K.CHARACTER;this._appendCharToCurrentCharacterToken(t,e<65536?String.fromCharCode(e):String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(K.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=Z.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?ca.Attribute:ca.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===Z.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===Z.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case Z.DATA:this._stateData(e);break;case Z.RCDATA:this._stateRcdata(e);break;case Z.RAWTEXT:this._stateRawtext(e);break;case Z.SCRIPT_DATA:this._stateScriptData(e);break;case Z.PLAINTEXT:this._statePlaintext(e);break;case Z.TAG_OPEN:this._stateTagOpen(e);break;case Z.END_TAG_OPEN:this._stateEndTagOpen(e);break;case Z.TAG_NAME:this._stateTagName(e);break;case Z.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case Z.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case Z.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case Z.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case Z.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case Z.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case Z.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case Z.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case Z.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case Z.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case Z.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case Z.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case Z.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case Z.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case Z.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case Z.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case Z.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case Z.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case Z.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case Z.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case Z.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case Z.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case Z.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case Z.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case Z.BOGUS_COMMENT:this._stateBogusComment(e);break;case Z.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case Z.COMMENT_START:this._stateCommentStart(e);break;case Z.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case Z.COMMENT:this._stateComment(e);break;case Z.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case Z.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case Z.COMMENT_END:this._stateCommentEnd(e);break;case Z.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case Z.DOCTYPE:this._stateDoctype(e);break;case Z.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case Z.DOCTYPE_NAME:this._stateDoctypeName(e);break;case Z.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case Z.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case Z.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case Z.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case Z.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case Z.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case Z.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case Z.CDATA_SECTION:this._stateCdataSection(e);break;case Z.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case Z.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case Z.CHARACTER_REFERENCE:this._stateCharacterReference();break;case Z.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw Error(`Unknown state`)}}_stateData(e){switch(e){case U.LESS_THAN_SIGN:this.state=Z.TAG_OPEN;break;case U.AMPERSAND:this._startCharacterReference();break;case U.NULL:this._err(G.unexpectedNullCharacter),this._emitCodePoint(e);break;case U.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case U.AMPERSAND:this._startCharacterReference();break;case U.LESS_THAN_SIGN:this.state=Z.RCDATA_LESS_THAN_SIGN;break;case U.NULL:this._err(G.unexpectedNullCharacter),this._emitChars(`�`);break;case U.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case U.LESS_THAN_SIGN:this.state=Z.RAWTEXT_LESS_THAN_SIGN;break;case U.NULL:this._err(G.unexpectedNullCharacter),this._emitChars(`�`);break;case U.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case U.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_LESS_THAN_SIGN;break;case U.NULL:this._err(G.unexpectedNullCharacter),this._emitChars(`�`);break;case U.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case U.NULL:this._err(G.unexpectedNullCharacter),this._emitChars(`�`);break;case U.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if(fu(e))this._createStartTagToken(),this.state=Z.TAG_NAME,this._stateTagName(e);else switch(e){case U.EXCLAMATION_MARK:this.state=Z.MARKUP_DECLARATION_OPEN;break;case U.SOLIDUS:this.state=Z.END_TAG_OPEN;break;case U.QUESTION_MARK:this._err(G.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=Z.BOGUS_COMMENT,this._stateBogusComment(e);break;case U.EOF:this._err(G.eofBeforeTagName),this._emitChars(`<`),this._emitEOFToken();break;default:this._err(G.invalidFirstCharacterOfTagName),this._emitChars(`<`),this.state=Z.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(fu(e))this._createEndTagToken(),this.state=Z.TAG_NAME,this._stateTagName(e);else switch(e){case U.GREATER_THAN_SIGN:this._err(G.missingEndTagName),this.state=Z.DATA;break;case U.EOF:this._err(G.eofBeforeTagName),this._emitChars(`</`),this._emitEOFToken();break;default:this._err(G.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=Z.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){let t=this.currentToken;switch(e){case U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:this.state=Z.BEFORE_ATTRIBUTE_NAME;break;case U.SOLIDUS:this.state=Z.SELF_CLOSING_START_TAG;break;case U.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentTagToken();break;case U.NULL:this._err(G.unexpectedNullCharacter),t.tagName+=`�`;break;case U.EOF:this._err(G.eofInTag),this._emitEOFToken();break;default:t.tagName+=String.fromCodePoint(uu(e)?mu(e):e)}}_stateRcdataLessThanSign(e){e===U.SOLIDUS?this.state=Z.RCDATA_END_TAG_OPEN:(this._emitChars(`<`),this.state=Z.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){fu(e)?(this.state=Z.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars(`</`),this.state=Z.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 U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=Z.BEFORE_ATTRIBUTE_NAME,!1;case U.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=Z.SELF_CLOSING_START_TAG,!1;case U.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=Z.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===U.SOLIDUS?this.state=Z.RAWTEXT_END_TAG_OPEN:(this._emitChars(`<`),this.state=Z.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){fu(e)?(this.state=Z.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars(`</`),this.state=Z.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case U.SOLIDUS:this.state=Z.SCRIPT_DATA_END_TAG_OPEN;break;case U.EXCLAMATION_MARK:this.state=Z.SCRIPT_DATA_ESCAPE_START,this._emitChars(`<!`);break;default:this._emitChars(`<`),this.state=Z.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){fu(e)?(this.state=Z.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars(`</`),this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===U.HYPHEN_MINUS?(this.state=Z.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars(`-`)):(this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===U.HYPHEN_MINUS?(this.state=Z.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`)):(this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case U.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_ESCAPED_DASH,this._emitChars(`-`);break;case U.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case U.NULL:this._err(G.unexpectedNullCharacter),this._emitChars(`�`);break;case U.EOF:this._err(G.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case U.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case U.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case U.NULL:this._err(G.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case U.EOF:this._err(G.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case U.HYPHEN_MINUS:this._emitChars(`-`);break;case U.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case U.GREATER_THAN_SIGN:this.state=Z.SCRIPT_DATA,this._emitChars(`>`);break;case U.NULL:this._err(G.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case U.EOF:this._err(G.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===U.SOLIDUS?this.state=Z.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:fu(e)?(this._emitChars(`<`),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars(`<`),this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){fu(e)?(this.state=Z.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars(`</`),this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(W.SCRIPT,!1)&&gu(this.preprocessor.peek(W.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<W.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case U.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars(`-`);break;case U.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case U.NULL:this._err(G.unexpectedNullCharacter),this._emitChars(`�`);break;case U.EOF:this._err(G.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case U.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case U.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case U.NULL:this._err(G.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case U.EOF:this._err(G.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case U.HYPHEN_MINUS:this._emitChars(`-`);break;case U.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case U.GREATER_THAN_SIGN:this.state=Z.SCRIPT_DATA,this._emitChars(`>`);break;case U.NULL:this._err(G.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case U.EOF:this._err(G.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===U.SOLIDUS?(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars(`/`)):(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(W.SCRIPT,!1)&&gu(this.preprocessor.peek(W.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<W.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Z.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:break;case U.SOLIDUS:case U.GREATER_THAN_SIGN:case U.EOF:this.state=Z.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case U.EQUALS_SIGN:this._err(G.unexpectedEqualsSignBeforeAttributeName),this._createAttr(`=`),this.state=Z.ATTRIBUTE_NAME;break;default:this._createAttr(``),this.state=Z.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:case U.SOLIDUS:case U.GREATER_THAN_SIGN:case U.EOF:this._leaveAttrName(),this.state=Z.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case U.EQUALS_SIGN:this._leaveAttrName(),this.state=Z.BEFORE_ATTRIBUTE_VALUE;break;case U.QUOTATION_MARK:case U.APOSTROPHE:case U.LESS_THAN_SIGN:this._err(G.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break;case U.NULL:this._err(G.unexpectedNullCharacter),this.currentAttr.name+=`�`;break;default:this.currentAttr.name+=String.fromCodePoint(uu(e)?mu(e):e)}}_stateAfterAttributeName(e){switch(e){case U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:break;case U.SOLIDUS:this.state=Z.SELF_CLOSING_START_TAG;break;case U.EQUALS_SIGN:this.state=Z.BEFORE_ATTRIBUTE_VALUE;break;case U.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentTagToken();break;case U.EOF:this._err(G.eofInTag),this._emitEOFToken();break;default:this._createAttr(``),this.state=Z.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:break;case U.QUOTATION_MARK:this.state=Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case U.APOSTROPHE:this.state=Z.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case U.GREATER_THAN_SIGN:this._err(G.missingAttributeValue),this.state=Z.DATA,this.emitCurrentTagToken();break;default:this.state=Z.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case U.QUOTATION_MARK:this.state=Z.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case U.AMPERSAND:this._startCharacterReference();break;case U.NULL:this._err(G.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case U.EOF:this._err(G.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case U.APOSTROPHE:this.state=Z.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case U.AMPERSAND:this._startCharacterReference();break;case U.NULL:this._err(G.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case U.EOF:this._err(G.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:this._leaveAttrValue(),this.state=Z.BEFORE_ATTRIBUTE_NAME;break;case U.AMPERSAND:this._startCharacterReference();break;case U.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Z.DATA,this.emitCurrentTagToken();break;case U.NULL:this._err(G.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case U.QUOTATION_MARK:case U.APOSTROPHE:case U.LESS_THAN_SIGN:case U.EQUALS_SIGN:case U.GRAVE_ACCENT:this._err(G.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break;case U.EOF:this._err(G.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:this._leaveAttrValue(),this.state=Z.BEFORE_ATTRIBUTE_NAME;break;case U.SOLIDUS:this._leaveAttrValue(),this.state=Z.SELF_CLOSING_START_TAG;break;case U.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Z.DATA,this.emitCurrentTagToken();break;case U.EOF:this._err(G.eofInTag),this._emitEOFToken();break;default:this._err(G.missingWhitespaceBetweenAttributes),this.state=Z.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case U.GREATER_THAN_SIGN:{let e=this.currentToken;e.selfClosing=!0,this.state=Z.DATA,this.emitCurrentTagToken();break}case U.EOF:this._err(G.eofInTag),this._emitEOFToken();break;default:this._err(G.unexpectedSolidusInTag),this.state=Z.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){let t=this.currentToken;switch(e){case U.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentComment(t);break;case U.EOF:this.emitCurrentComment(t),this._emitEOFToken();break;case U.NULL:this._err(G.unexpectedNullCharacter),t.data+=`�`;break;default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(W.DASH_DASH,!0)?(this._createCommentToken(W.DASH_DASH.length+1),this.state=Z.COMMENT_START):this._consumeSequenceIfMatch(W.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(W.DOCTYPE.length+1),this.state=Z.DOCTYPE):this._consumeSequenceIfMatch(W.CDATA_START,!0)?this.inForeignNode?this.state=Z.CDATA_SECTION:(this._err(G.cdataInHtmlContent),this._createCommentToken(W.CDATA_START.length+1),this.currentToken.data=`[CDATA[`,this.state=Z.BOGUS_COMMENT):this._ensureHibernation()||(this._err(G.incorrectlyOpenedComment),this._createCommentToken(2),this.state=Z.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case U.HYPHEN_MINUS:this.state=Z.COMMENT_START_DASH;break;case U.GREATER_THAN_SIGN:{this._err(G.abruptClosingOfEmptyComment),this.state=Z.DATA;let e=this.currentToken;this.emitCurrentComment(e);break}default:this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){let t=this.currentToken;switch(e){case U.HYPHEN_MINUS:this.state=Z.COMMENT_END;break;case U.GREATER_THAN_SIGN:this._err(G.abruptClosingOfEmptyComment),this.state=Z.DATA,this.emitCurrentComment(t);break;case U.EOF:this._err(G.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Z.COMMENT,this._stateComment(e)}}_stateComment(e){let t=this.currentToken;switch(e){case U.HYPHEN_MINUS:this.state=Z.COMMENT_END_DASH;break;case U.LESS_THAN_SIGN:t.data+=`<`,this.state=Z.COMMENT_LESS_THAN_SIGN;break;case U.NULL:this._err(G.unexpectedNullCharacter),t.data+=`�`;break;case U.EOF:this._err(G.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){let t=this.currentToken;switch(e){case U.EXCLAMATION_MARK:t.data+=`!`,this.state=Z.COMMENT_LESS_THAN_SIGN_BANG;break;case U.LESS_THAN_SIGN:t.data+=`<`;break;default:this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===U.HYPHEN_MINUS?this.state=Z.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=Z.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===U.HYPHEN_MINUS?this.state=Z.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=Z.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==U.GREATER_THAN_SIGN&&e!==U.EOF&&this._err(G.nestedComment),this.state=Z.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){let t=this.currentToken;switch(e){case U.HYPHEN_MINUS:this.state=Z.COMMENT_END;break;case U.EOF:this._err(G.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){let t=this.currentToken;switch(e){case U.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentComment(t);break;case U.EXCLAMATION_MARK:this.state=Z.COMMENT_END_BANG;break;case U.HYPHEN_MINUS:t.data+=`-`;break;case U.EOF:this._err(G.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--`,this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){let t=this.currentToken;switch(e){case U.HYPHEN_MINUS:t.data+=`--!`,this.state=Z.COMMENT_END_DASH;break;case U.GREATER_THAN_SIGN:this._err(G.incorrectlyClosedComment),this.state=Z.DATA,this.emitCurrentComment(t);break;case U.EOF:this._err(G.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--!`,this.state=Z.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:this.state=Z.BEFORE_DOCTYPE_NAME;break;case U.GREATER_THAN_SIGN:this.state=Z.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break;case U.EOF:{this._err(G.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._err(G.missingWhitespaceBeforeDoctypeName),this.state=Z.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(uu(e))this._createDoctypeToken(String.fromCharCode(mu(e))),this.state=Z.DOCTYPE_NAME;else switch(e){case U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:break;case U.NULL:this._err(G.unexpectedNullCharacter),this._createDoctypeToken(`�`),this.state=Z.DOCTYPE_NAME;break;case U.GREATER_THAN_SIGN:{this._err(G.missingDoctypeName),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=Z.DATA;break}case U.EOF:{this._err(G.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=Z.DOCTYPE_NAME}}_stateDoctypeName(e){let t=this.currentToken;switch(e){case U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:this.state=Z.AFTER_DOCTYPE_NAME;break;case U.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentDoctype(t);break;case U.NULL:this._err(G.unexpectedNullCharacter),t.name+=`�`;break;case U.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.name+=String.fromCodePoint(uu(e)?mu(e):e)}}_stateAfterDoctypeName(e){let t=this.currentToken;switch(e){case U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:break;case U.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentDoctype(t);break;case U.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._consumeSequenceIfMatch(W.PUBLIC,!1)?this.state=Z.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(W.SYSTEM,!1)?this.state=Z.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(G.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){let t=this.currentToken;switch(e){case U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:this.state=Z.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case U.QUOTATION_MARK:this._err(G.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case U.APOSTROPHE:this._err(G.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case U.GREATER_THAN_SIGN:this._err(G.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case U.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(G.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:break;case U.QUOTATION_MARK:t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case U.APOSTROPHE:t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case U.GREATER_THAN_SIGN:this._err(G.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case U.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(G.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case U.QUOTATION_MARK:this.state=Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case U.NULL:this._err(G.unexpectedNullCharacter),t.publicId+=`�`;break;case U.GREATER_THAN_SIGN:this._err(G.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case U.EOF:this._err(G.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 U.APOSTROPHE:this.state=Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case U.NULL:this._err(G.unexpectedNullCharacter),t.publicId+=`�`;break;case U.GREATER_THAN_SIGN:this._err(G.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case U.EOF:this._err(G.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 U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:this.state=Z.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case U.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentDoctype(t);break;case U.QUOTATION_MARK:this._err(G.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case U.APOSTROPHE:this._err(G.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case U.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(G.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){let t=this.currentToken;switch(e){case U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:break;case U.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Z.DATA;break;case U.QUOTATION_MARK:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case U.APOSTROPHE:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case U.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(G.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){let t=this.currentToken;switch(e){case U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:this.state=Z.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case U.QUOTATION_MARK:this._err(G.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case U.APOSTROPHE:this._err(G.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case U.GREATER_THAN_SIGN:this._err(G.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case U.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(G.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:break;case U.QUOTATION_MARK:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case U.APOSTROPHE:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case U.GREATER_THAN_SIGN:this._err(G.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case U.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(G.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case U.QUOTATION_MARK:this.state=Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case U.NULL:this._err(G.unexpectedNullCharacter),t.systemId+=`�`;break;case U.GREATER_THAN_SIGN:this._err(G.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case U.EOF:this._err(G.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 U.APOSTROPHE:this.state=Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case U.NULL:this._err(G.unexpectedNullCharacter),t.systemId+=`�`;break;case U.GREATER_THAN_SIGN:this._err(G.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case U.EOF:this._err(G.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 U.SPACE:case U.LINE_FEED:case U.TABULATION:case U.FORM_FEED:break;case U.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Z.DATA;break;case U.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(G.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){let t=this.currentToken;switch(e){case U.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Z.DATA;break;case U.NULL:this._err(G.unexpectedNullCharacter);break;case U.EOF:this.emitCurrentDoctype(t),this._emitEOFToken();break;default:}}_stateCdataSection(e){switch(e){case U.RIGHT_SQUARE_BRACKET:this.state=Z.CDATA_SECTION_BRACKET;break;case U.EOF:this._err(G.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===U.RIGHT_SQUARE_BRACKET?this.state=Z.CDATA_SECTION_END:(this._emitChars(`]`),this.state=Z.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case U.GREATER_THAN_SIGN:this.state=Z.DATA;break;case U.RIGHT_SQUARE_BRACKET:this._emitChars(`]`);break;default:this._emitChars(`]]`),this.state=Z.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(U.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&pu(this.preprocessor.peek(1))?Z.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){pu(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===U.SEMICOLON&&this._err(G.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}},yu=new Set([Y.DD,Y.DT,Y.LI,Y.OPTGROUP,Y.OPTION,Y.P,Y.RB,Y.RP,Y.RT,Y.RTC]),bu=new Set([...yu,Y.CAPTION,Y.COLGROUP,Y.TBODY,Y.TD,Y.TFOOT,Y.TH,Y.THEAD,Y.TR]),xu=new Set([Y.APPLET,Y.CAPTION,Y.HTML,Y.MARQUEE,Y.OBJECT,Y.TABLE,Y.TD,Y.TEMPLATE,Y.TH]),Su=new Set([...xu,Y.OL,Y.UL]),Cu=new Set([...xu,Y.BUTTON]),wu=new Set([Y.ANNOTATION_XML,Y.MI,Y.MN,Y.MO,Y.MS,Y.MTEXT]),Tu=new Set([Y.DESC,Y.FOREIGN_OBJECT,Y.TITLE]),Eu=new Set([Y.TR,Y.TEMPLATE,Y.HTML]),Du=new Set([Y.TBODY,Y.TFOOT,Y.THEAD,Y.TEMPLATE,Y.HTML]),Ou=new Set([Y.TABLE,Y.TEMPLATE,Y.HTML]),ku=new Set([Y.TD,Y.TH]),Au=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=Y.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===Y.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===q.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])!==q.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(au,q.HTML)}popUntilTableCellPopped(){this.popUntilPopped(ku,q.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(Ou,q.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Du,q.HTML)}clearBackToTableRowContext(){this.clearBackTo(Eu,q.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]===Y.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]===Y.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 q.HTML:if(r===e)return!0;if(t.has(r))return!1;break;case q.SVG:if(Tu.has(r))return!1;break;case q.MATHML:if(wu.has(r))return!1;break}}return!0}hasInScope(e){return this.hasInDynamicScope(e,xu)}hasInListItemScope(e){return this.hasInDynamicScope(e,Su)}hasInButtonScope(e){return this.hasInDynamicScope(e,Cu)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case q.HTML:if(au.has(t))return!0;if(xu.has(t))return!1;break;case q.SVG:if(Tu.has(t))return!1;break;case q.MATHML:if(wu.has(t))return!1;break}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===q.HTML)switch(this.tagIDs[t]){case e:return!0;case Y.TABLE:case Y.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===q.HTML)switch(this.tagIDs[e]){case Y.TBODY:case Y.THEAD:case Y.TFOOT:return!0;case Y.TABLE:case Y.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===q.HTML)switch(this.tagIDs[t]){case e:return!0;case Y.OPTION:case Y.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&yu.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&bu.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&bu.has(this.currentTagId);)this.pop()}},ju=3,Mu;(function(e){e[e.Marker=0]=`Marker`,e[e.Element=1]=`Element`})(Mu||={});var Nu={type:Mu.Marker},Pu=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===Mu.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<ju)return;let t=this.treeAdapter.getAttrList(e),n=this._getNoahArkConditionCandidates(e,t);if(n.length<ju)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>=ju&&this.entries.splice(t.idx,1))}}insertMarker(){this.entries.unshift(Nu)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:Mu.Element,element:e,token:t})}insertElementAfterBookmark(e,t){let n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:Mu.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(Nu);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){let t=this.entries.find(t=>t.type===Mu.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===Mu.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===Mu.Element&&t.element===e)}},Fu={createDocument(){return{nodeName:`#document`,mode:tu.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};Fu.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(Fu.isTextNode(n)){n.value+=t;return}}Fu.appendChild(e,Fu.createTextNode(t))},insertTextBefore(e,t,n){let r=e.childNodes[e.childNodes.indexOf(n)-1];r&&Fu.isTextNode(r)?r.value+=t:Fu.insertBefore(e,Fu.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}}},Iu=`html`,Lu=`about:legacy-compat`,Ru=`http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd`,zu=`+//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(`,`),Bu=[...zu,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`],Vu=new Set([`-//w3o//dtd w3 html strict 3.0//en//`,`-/w3c/dtd html 4.0 transitional/en`,`html`]),Hu=[`-//w3c//dtd xhtml 1.0 frameset//`,`-//w3c//dtd xhtml 1.0 transitional//`],Uu=[...Hu,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`];function Wu(e,t){return t.some(t=>e.startsWith(t))}function Gu(e){return e.name===Iu&&e.publicId===null&&(e.systemId===null||e.systemId===Lu)}function Ku(e){if(e.name!==Iu)return tu.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===Ru)return tu.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),Vu.has(n))return tu.QUIRKS;let e=t===null?Bu:zu;if(Wu(n,e))return tu.QUIRKS;if(e=t===null?Hu:Uu,Wu(n,e))return tu.LIMITED_QUIRKS}return tu.NO_QUIRKS}var qu={TEXT_HTML:`text/html`,APPLICATION_XML:`application/xhtml+xml`},Ju=`definitionurl`,Yu=`definitionURL`,Xu=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])),Zu=new Map([[`xlink:actuate`,{prefix:`xlink`,name:`actuate`,namespace:q.XLINK}],[`xlink:arcrole`,{prefix:`xlink`,name:`arcrole`,namespace:q.XLINK}],[`xlink:href`,{prefix:`xlink`,name:`href`,namespace:q.XLINK}],[`xlink:role`,{prefix:`xlink`,name:`role`,namespace:q.XLINK}],[`xlink:show`,{prefix:`xlink`,name:`show`,namespace:q.XLINK}],[`xlink:title`,{prefix:`xlink`,name:`title`,namespace:q.XLINK}],[`xlink:type`,{prefix:`xlink`,name:`type`,namespace:q.XLINK}],[`xml:lang`,{prefix:`xml`,name:`lang`,namespace:q.XML}],[`xml:space`,{prefix:`xml`,name:`space`,namespace:q.XML}],[`xmlns`,{prefix:``,name:`xmlns`,namespace:q.XMLNS}],[`xmlns:xlink`,{prefix:`xmlns`,name:`xlink`,namespace:q.XMLNS}]]),Qu=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])),$u=new Set([Y.B,Y.BIG,Y.BLOCKQUOTE,Y.BODY,Y.BR,Y.CENTER,Y.CODE,Y.DD,Y.DIV,Y.DL,Y.DT,Y.EM,Y.EMBED,Y.H1,Y.H2,Y.H3,Y.H4,Y.H5,Y.H6,Y.HEAD,Y.HR,Y.I,Y.IMG,Y.LI,Y.LISTING,Y.MENU,Y.META,Y.NOBR,Y.OL,Y.P,Y.PRE,Y.RUBY,Y.S,Y.SMALL,Y.SPAN,Y.STRONG,Y.STRIKE,Y.SUB,Y.SUP,Y.TABLE,Y.TT,Y.U,Y.UL,Y.VAR]);function ed(e){let t=e.tagID;return t===Y.FONT&&e.attrs.some(({name:e})=>e===eu.COLOR||e===eu.SIZE||e===eu.FACE)||$u.has(t)}function td(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===Ju){e.attrs[t].name=Yu;break}}function nd(e){for(let t=0;t<e.attrs.length;t++){let n=Xu.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function rd(e){for(let t=0;t<e.attrs.length;t++){let n=Zu.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 id(e){let t=Qu.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=ru(e.tagName))}function ad(e,t){return t===q.MATHML&&(e===Y.MI||e===Y.MO||e===Y.MN||e===Y.MS||e===Y.MTEXT)}function od(e,t,n){if(t===q.MATHML&&e===Y.ANNOTATION_XML){for(let e=0;e<n.length;e++)if(n[e].name===eu.ENCODING){let t=n[e].value.toLowerCase();return t===qu.TEXT_HTML||t===qu.APPLICATION_XML}}return t===q.SVG&&(e===Y.FOREIGN_OBJECT||e===Y.DESC||e===Y.TITLE)}function sd(e,t,n,r){return(!r||r===q.HTML)&&od(e,t,n)||(!r||r===q.MATHML)&&ad(e,t)}var cd=`hidden`,ld=8,ud=3,Q;(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`})(Q||={});var dd={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},fd=new Set([Y.TABLE,Y.TBODY,Y.TFOOT,Y.THEAD,Y.TR]),pd={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:Fu,onParseError:null},md=class{constructor(e,t,n=null,r=null){this.fragmentContext=n,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=Q.INITIAL,this.originalInsertionMode=Q.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={...pd,...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 vu(this.options,this),this.activeFormattingElements=new Pu(this.treeAdapter),this.fragmentContextID=n?ru(this.treeAdapter.getTagName(n)):Y.UNKNOWN,this._setContextModes(n??this.document,this.fragmentContextID),this.openElements=new Au(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={...pd,...t};e??=n.treeAdapter.createElement(J.TEMPLATE,q.HTML,[]);let r=n.treeAdapter.createElement(`documentmock`,q.HTML,[]),i=new this(n,r,e);return i.fragmentContextID===Y.TEMPLATE&&i.tmplInsertionModeStack.unshift(Q.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??dd,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)===q.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&e!==void 0&&t!==void 0&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,q.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=Q.TEXT}switchToPlaintextParsing(){this.insertionMode=Q.TEXT,this.originalInsertionMode=Q.IN_BODY,this.tokenizer.state=cu.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)===J.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==q.HTML))switch(this.fragmentContextID){case Y.TITLE:case Y.TEXTAREA:this.tokenizer.state=cu.RCDATA;break;case Y.STYLE:case Y.XMP:case Y.IFRAME:case Y.NOEMBED:case Y.NOFRAMES:case Y.NOSCRIPT:this.tokenizer.state=cu.RAWTEXT;break;case Y.SCRIPT:this.tokenizer.state=cu.SCRIPT_DATA;break;case Y.PLAINTEXT:this.tokenizer.state=cu.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,q.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,t)}_insertTemplate(e){let t=this.treeAdapter.createElement(e.tagName,q.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(J.HTML,q.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,Y.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===K.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===Y.SVG&&this.treeAdapter.getTagName(t)===J.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===q.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===Y.MGLYPH||e.tagID===Y.MALIGNMARK)&&n!==void 0&&!this._isIntegrationPoint(n,t,q.HTML)}_processToken(e){switch(e.type){case K.CHARACTER:this.onCharacter(e);break;case K.NULL_CHARACTER:this.onNullCharacter(e);break;case K.COMMENT:this.onComment(e);break;case K.DOCTYPE:this.onDoctype(e);break;case K.START_TAG:this._processStartTag(e);break;case K.END_TAG:this.onEndTag(e);break;case K.EOF:this.onEof(e);break;case K.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e);break}}_isIntegrationPoint(e,t,n){return sd(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===Mu.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=Q.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(Y.P),this.openElements.popUntilTagNamePopped(Y.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case Y.TR:this.insertionMode=Q.IN_ROW;return;case Y.TBODY:case Y.THEAD:case Y.TFOOT:this.insertionMode=Q.IN_TABLE_BODY;return;case Y.CAPTION:this.insertionMode=Q.IN_CAPTION;return;case Y.COLGROUP:this.insertionMode=Q.IN_COLUMN_GROUP;return;case Y.TABLE:this.insertionMode=Q.IN_TABLE;return;case Y.BODY:this.insertionMode=Q.IN_BODY;return;case Y.FRAMESET:this.insertionMode=Q.IN_FRAMESET;return;case Y.SELECT:this._resetInsertionModeForSelect(e);return;case Y.TEMPLATE:this.insertionMode=this.tmplInsertionModeStack[0];return;case Y.HTML:this.insertionMode=this.headElement?Q.AFTER_HEAD:Q.BEFORE_HEAD;return;case Y.TD:case Y.TH:if(e>0){this.insertionMode=Q.IN_CELL;return}break;case Y.HEAD:if(e>0){this.insertionMode=Q.IN_HEAD;return}break}this.insertionMode=Q.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){let e=this.openElements.tagIDs[t];if(e===Y.TEMPLATE)break;if(e===Y.TABLE){this.insertionMode=Q.IN_SELECT_IN_TABLE;return}}this.insertionMode=Q.IN_SELECT}_isElementCausesFosterParenting(e){return fd.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 Y.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===q.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case Y.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 iu[this.treeAdapter.getNamespaceURI(e)].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Mp(this,e);return}switch(this.insertionMode){case Q.INITIAL:Dd(this,e);break;case Q.BEFORE_HTML:Ad(this,e);break;case Q.BEFORE_HEAD:Nd(this,e);break;case Q.IN_HEAD:Ld(this,e);break;case Q.IN_HEAD_NO_SCRIPT:Bd(this,e);break;case Q.AFTER_HEAD:Ud(this,e);break;case Q.IN_BODY:case Q.IN_CAPTION:case Q.IN_CELL:case Q.IN_TEMPLATE:Kd(this,e);break;case Q.TEXT:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:Vf(this,e);break;case Q.IN_TABLE_TEXT:ep(this,e);break;case Q.IN_COLUMN_GROUP:sp(this,e);break;case Q.AFTER_BODY:Cp(this,e);break;case Q.AFTER_AFTER_BODY:kp(this,e);break;default:}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){jp(this,e);return}switch(this.insertionMode){case Q.INITIAL:Dd(this,e);break;case Q.BEFORE_HTML:Ad(this,e);break;case Q.BEFORE_HEAD:Nd(this,e);break;case Q.IN_HEAD:Ld(this,e);break;case Q.IN_HEAD_NO_SCRIPT:Bd(this,e);break;case Q.AFTER_HEAD:Ud(this,e);break;case Q.TEXT:this._insertCharacters(e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:Vf(this,e);break;case Q.IN_COLUMN_GROUP:sp(this,e);break;case Q.AFTER_BODY:Cp(this,e);break;case Q.AFTER_AFTER_BODY:kp(this,e);break;default:}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){Sd(this,e);return}switch(this.insertionMode){case Q.INITIAL:case Q.BEFORE_HTML:case Q.BEFORE_HEAD:case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:case Q.IN_BODY:case Q.IN_TABLE:case Q.IN_CAPTION:case Q.IN_COLUMN_GROUP:case Q.IN_TABLE_BODY:case Q.IN_ROW:case Q.IN_CELL:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:case Q.IN_TEMPLATE:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:Sd(this,e);break;case Q.IN_TABLE_TEXT:tp(this,e);break;case Q.AFTER_BODY:Cd(this,e);break;case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:wd(this,e);break;default:}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case Q.INITIAL:Ed(this,e);break;case Q.BEFORE_HEAD:case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:this._err(e,G.misplacedDoctype);break;case Q.IN_TABLE_TEXT:tp(this,e);break;default:}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,G.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?Pp(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case Q.INITIAL:Dd(this,e);break;case Q.BEFORE_HTML:Od(this,e);break;case Q.BEFORE_HEAD:jd(this,e);break;case Q.IN_HEAD:Pd(this,e);break;case Q.IN_HEAD_NO_SCRIPT:Rd(this,e);break;case Q.AFTER_HEAD:Vd(this,e);break;case Q.IN_BODY:$(this,e);break;case Q.IN_TABLE:Xf(this,e);break;case Q.IN_TABLE_TEXT:tp(this,e);break;case Q.IN_CAPTION:rp(this,e);break;case Q.IN_COLUMN_GROUP:ap(this,e);break;case Q.IN_TABLE_BODY:cp(this,e);break;case Q.IN_ROW:up(this,e);break;case Q.IN_CELL:fp(this,e);break;case Q.IN_SELECT:mp(this,e);break;case Q.IN_SELECT_IN_TABLE:gp(this,e);break;case Q.IN_TEMPLATE:vp(this,e);break;case Q.AFTER_BODY:xp(this,e);break;case Q.IN_FRAMESET:wp(this,e);break;case Q.AFTER_FRAMESET:Ep(this,e);break;case Q.AFTER_AFTER_BODY:Op(this,e);break;case Q.AFTER_AFTER_FRAMESET:Ap(this,e);break;default:}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?Fp(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case Q.INITIAL:Dd(this,e);break;case Q.BEFORE_HTML:kd(this,e);break;case Q.BEFORE_HEAD:Md(this,e);break;case Q.IN_HEAD:Fd(this,e);break;case Q.IN_HEAD_NO_SCRIPT:zd(this,e);break;case Q.AFTER_HEAD:Hd(this,e);break;case Q.IN_BODY:Lf(this,e);break;case Q.TEXT:zf(this,e);break;case Q.IN_TABLE:Zf(this,e);break;case Q.IN_TABLE_TEXT:tp(this,e);break;case Q.IN_CAPTION:ip(this,e);break;case Q.IN_COLUMN_GROUP:op(this,e);break;case Q.IN_TABLE_BODY:lp(this,e);break;case Q.IN_ROW:dp(this,e);break;case Q.IN_CELL:pp(this,e);break;case Q.IN_SELECT:hp(this,e);break;case Q.IN_SELECT_IN_TABLE:_p(this,e);break;case Q.IN_TEMPLATE:yp(this,e);break;case Q.AFTER_BODY:Sp(this,e);break;case Q.IN_FRAMESET:Tp(this,e);break;case Q.AFTER_FRAMESET:Dp(this,e);break;case Q.AFTER_AFTER_BODY:kp(this,e);break;default:}}onEof(e){switch(this.insertionMode){case Q.INITIAL:Dd(this,e);break;case Q.BEFORE_HTML:Ad(this,e);break;case Q.BEFORE_HEAD:Nd(this,e);break;case Q.IN_HEAD:Ld(this,e);break;case Q.IN_HEAD_NO_SCRIPT:Bd(this,e);break;case Q.AFTER_HEAD:Ud(this,e);break;case Q.IN_BODY:case Q.IN_TABLE:case Q.IN_CAPTION:case Q.IN_COLUMN_GROUP:case Q.IN_TABLE_BODY:case Q.IN_ROW:case Q.IN_CELL:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:Rf(this,e);break;case Q.TEXT:Bf(this,e);break;case Q.IN_TABLE_TEXT:tp(this,e);break;case Q.IN_TEMPLATE:bp(this,e);break;case Q.AFTER_BODY:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:Td(this,e);break;default:}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===U.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 Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:case Q.TEXT:case Q.IN_COLUMN_GROUP:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:this._insertCharacters(e);break;case Q.IN_BODY:case Q.IN_CAPTION:case Q.IN_CELL:case Q.IN_TEMPLATE:case Q.AFTER_BODY:case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:Gd(this,e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:Vf(this,e);break;case Q.IN_TABLE_TEXT:$f(this,e);break;default:}}};function hd(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):If(e,t),n}function gd(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 _d(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>=ud;!n||s?(s&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(o)):(o=vd(e,n),r===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}function vd(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 yd(e,t,n){let r=ru(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{let i=e.treeAdapter.getNamespaceURI(t);r===Y.TEMPLATE&&i===q.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function bd(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 xd(e,t){for(let n=0;n<ld;n++){let n=hd(e,t);if(!n)break;let r=gd(e,n);if(!r)break;e.activeFormattingElements.bookmark=n;let i=_d(e,r,n.element),a=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(i),a&&yd(e,a,i),bd(e,r,n)}}function Sd(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function Cd(e,t){e._appendCommentNode(t,e.openElements.items[0])}function wd(e,t){e._appendCommentNode(t,e.document)}function Td(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 Ed(e,t){e._setDocumentType(t);let n=t.forceQuirks?tu.QUIRKS:Ku(t);Gu(t)||e._err(t,G.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=Q.BEFORE_HTML}function Dd(e,t){e._err(t,G.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,tu.QUIRKS),e.insertionMode=Q.BEFORE_HTML,e._processToken(t)}function Od(e,t){t.tagID===Y.HTML?(e._insertElement(t,q.HTML),e.insertionMode=Q.BEFORE_HEAD):Ad(e,t)}function kd(e,t){let n=t.tagID;(n===Y.HTML||n===Y.HEAD||n===Y.BODY||n===Y.BR)&&Ad(e,t)}function Ad(e,t){e._insertFakeRootElement(),e.insertionMode=Q.BEFORE_HEAD,e._processToken(t)}function jd(e,t){switch(t.tagID){case Y.HTML:$(e,t);break;case Y.HEAD:e._insertElement(t,q.HTML),e.headElement=e.openElements.current,e.insertionMode=Q.IN_HEAD;break;default:Nd(e,t)}}function Md(e,t){let n=t.tagID;n===Y.HEAD||n===Y.BODY||n===Y.HTML||n===Y.BR?Nd(e,t):e._err(t,G.endTagWithoutMatchingOpenElement)}function Nd(e,t){e._insertFakeElement(J.HEAD,Y.HEAD),e.headElement=e.openElements.current,e.insertionMode=Q.IN_HEAD,e._processToken(t)}function Pd(e,t){switch(t.tagID){case Y.HTML:$(e,t);break;case Y.BASE:case Y.BASEFONT:case Y.BGSOUND:case Y.LINK:case Y.META:e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.TITLE:e._switchToTextParsing(t,cu.RCDATA);break;case Y.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,cu.RAWTEXT):(e._insertElement(t,q.HTML),e.insertionMode=Q.IN_HEAD_NO_SCRIPT);break;case Y.NOFRAMES:case Y.STYLE:e._switchToTextParsing(t,cu.RAWTEXT);break;case Y.SCRIPT:e._switchToTextParsing(t,cu.SCRIPT_DATA);break;case Y.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=Q.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(Q.IN_TEMPLATE);break;case Y.HEAD:e._err(t,G.misplacedStartTagForHeadElement);break;default:Ld(e,t)}}function Fd(e,t){switch(t.tagID){case Y.HEAD:e.openElements.pop(),e.insertionMode=Q.AFTER_HEAD;break;case Y.BODY:case Y.BR:case Y.HTML:Ld(e,t);break;case Y.TEMPLATE:Id(e,t);break;default:e._err(t,G.endTagWithoutMatchingOpenElement)}}function Id(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==Y.TEMPLATE&&e._err(t,G.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(Y.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,G.endTagWithoutMatchingOpenElement)}function Ld(e,t){e.openElements.pop(),e.insertionMode=Q.AFTER_HEAD,e._processToken(t)}function Rd(e,t){switch(t.tagID){case Y.HTML:$(e,t);break;case Y.BASEFONT:case Y.BGSOUND:case Y.HEAD:case Y.LINK:case Y.META:case Y.NOFRAMES:case Y.STYLE:Pd(e,t);break;case Y.NOSCRIPT:e._err(t,G.nestedNoscriptInHead);break;default:Bd(e,t)}}function zd(e,t){switch(t.tagID){case Y.NOSCRIPT:e.openElements.pop(),e.insertionMode=Q.IN_HEAD;break;case Y.BR:Bd(e,t);break;default:e._err(t,G.endTagWithoutMatchingOpenElement)}}function Bd(e,t){let n=t.type===K.EOF?G.openElementsLeftAfterEof:G.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=Q.IN_HEAD,e._processToken(t)}function Vd(e,t){switch(t.tagID){case Y.HTML:$(e,t);break;case Y.BODY:e._insertElement(t,q.HTML),e.framesetOk=!1,e.insertionMode=Q.IN_BODY;break;case Y.FRAMESET:e._insertElement(t,q.HTML),e.insertionMode=Q.IN_FRAMESET;break;case Y.BASE:case Y.BASEFONT:case Y.BGSOUND:case Y.LINK:case Y.META:case Y.NOFRAMES:case Y.SCRIPT:case Y.STYLE:case Y.TEMPLATE:case Y.TITLE:e._err(t,G.abandonedHeadElementChild),e.openElements.push(e.headElement,Y.HEAD),Pd(e,t),e.openElements.remove(e.headElement);break;case Y.HEAD:e._err(t,G.misplacedStartTagForHeadElement);break;default:Ud(e,t)}}function Hd(e,t){switch(t.tagID){case Y.BODY:case Y.HTML:case Y.BR:Ud(e,t);break;case Y.TEMPLATE:Id(e,t);break;default:e._err(t,G.endTagWithoutMatchingOpenElement)}}function Ud(e,t){e._insertFakeElement(J.BODY,Y.BODY),e.insertionMode=Q.IN_BODY,Wd(e,t)}function Wd(e,t){switch(t.type){case K.CHARACTER:Kd(e,t);break;case K.WHITESPACE_CHARACTER:Gd(e,t);break;case K.COMMENT:Sd(e,t);break;case K.START_TAG:$(e,t);break;case K.END_TAG:Lf(e,t);break;case K.EOF:Rf(e,t);break;default:}}function Gd(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function Kd(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function qd(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function Jd(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function Yd(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_FRAMESET)}function Xd(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML)}function Zd(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&au.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,q.HTML)}function Qd(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function $d(e,t){let n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),n||(e.formElement=e.openElements.current))}function ef(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===Y.LI&&r===Y.LI||(n===Y.DD||n===Y.DT)&&(r===Y.DD||r===Y.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==Y.ADDRESS&&r!==Y.DIV&&r!==Y.P&&e._isSpecialElement(e.openElements.items[t],r))break}e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML)}function tf(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),e.tokenizer.state=cu.PLAINTEXT}function nf(e,t){e.openElements.hasInScope(Y.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(Y.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.framesetOk=!1}function rf(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(J.A);n&&(xd(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function af(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function of(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(Y.NOBR)&&(xd(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,q.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function sf(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function cf(e,t){e.treeAdapter.getDocumentMode(e.document)!==tu.QUIRKS&&e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),e.framesetOk=!1,e.insertionMode=Q.IN_TABLE}function lf(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,q.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function uf(e){let t=$l(e,eu.TYPE);return t!=null&&t.toLowerCase()===cd}function df(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,q.HTML),uf(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function ff(e,t){e._appendElement(t,q.HTML),t.ackSelfClosing=!0}function pf(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._appendElement(t,q.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function mf(e,t){t.tagName=J.IMG,t.tagID=Y.IMG,lf(e,t)}function hf(e,t){e._insertElement(t,q.HTML),e.skipNextNewLine=!0,e.tokenizer.state=cu.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=Q.TEXT}function gf(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,cu.RAWTEXT)}function _f(e,t){e.framesetOk=!1,e._switchToTextParsing(t,cu.RAWTEXT)}function vf(e,t){e._switchToTextParsing(t,cu.RAWTEXT)}function yf(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===Q.IN_TABLE||e.insertionMode===Q.IN_CAPTION||e.insertionMode===Q.IN_TABLE_BODY||e.insertionMode===Q.IN_ROW||e.insertionMode===Q.IN_CELL?Q.IN_SELECT_IN_TABLE:Q.IN_SELECT}function bf(e,t){e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML)}function xf(e,t){e.openElements.hasInScope(Y.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,q.HTML)}function Sf(e,t){e.openElements.hasInScope(Y.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(Y.RTC),e._insertElement(t,q.HTML)}function Cf(e,t){e._reconstructActiveFormattingElements(),td(t),rd(t),t.selfClosing?e._appendElement(t,q.MATHML):e._insertElement(t,q.MATHML),t.ackSelfClosing=!0}function wf(e,t){e._reconstructActiveFormattingElements(),nd(t),rd(t),t.selfClosing?e._appendElement(t,q.SVG):e._insertElement(t,q.SVG),t.ackSelfClosing=!0}function Tf(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML)}function $(e,t){switch(t.tagID){case Y.I:case Y.S:case Y.B:case Y.U:case Y.EM:case Y.TT:case Y.BIG:case Y.CODE:case Y.FONT:case Y.SMALL:case Y.STRIKE:case Y.STRONG:af(e,t);break;case Y.A:rf(e,t);break;case Y.H1:case Y.H2:case Y.H3:case Y.H4:case Y.H5:case Y.H6:Zd(e,t);break;case Y.P:case Y.DL:case Y.OL:case Y.UL:case Y.DIV:case Y.DIR:case Y.NAV:case Y.MAIN:case Y.MENU:case Y.ASIDE:case Y.CENTER:case Y.FIGURE:case Y.FOOTER:case Y.HEADER:case Y.HGROUP:case Y.DIALOG:case Y.DETAILS:case Y.ADDRESS:case Y.ARTICLE:case Y.SEARCH:case Y.SECTION:case Y.SUMMARY:case Y.FIELDSET:case Y.BLOCKQUOTE:case Y.FIGCAPTION:Xd(e,t);break;case Y.LI:case Y.DD:case Y.DT:ef(e,t);break;case Y.BR:case Y.IMG:case Y.WBR:case Y.AREA:case Y.EMBED:case Y.KEYGEN:lf(e,t);break;case Y.HR:pf(e,t);break;case Y.RB:case Y.RTC:xf(e,t);break;case Y.RT:case Y.RP:Sf(e,t);break;case Y.PRE:case Y.LISTING:Qd(e,t);break;case Y.XMP:gf(e,t);break;case Y.SVG:wf(e,t);break;case Y.HTML:qd(e,t);break;case Y.BASE:case Y.LINK:case Y.META:case Y.STYLE:case Y.TITLE:case Y.SCRIPT:case Y.BGSOUND:case Y.BASEFONT:case Y.TEMPLATE:Pd(e,t);break;case Y.BODY:Jd(e,t);break;case Y.FORM:$d(e,t);break;case Y.NOBR:of(e,t);break;case Y.MATH:Cf(e,t);break;case Y.TABLE:cf(e,t);break;case Y.INPUT:df(e,t);break;case Y.PARAM:case Y.TRACK:case Y.SOURCE:ff(e,t);break;case Y.IMAGE:mf(e,t);break;case Y.BUTTON:nf(e,t);break;case Y.APPLET:case Y.OBJECT:case Y.MARQUEE:sf(e,t);break;case Y.IFRAME:_f(e,t);break;case Y.SELECT:yf(e,t);break;case Y.OPTION:case Y.OPTGROUP:bf(e,t);break;case Y.NOEMBED:case Y.NOFRAMES:vf(e,t);break;case Y.FRAMESET:Yd(e,t);break;case Y.TEXTAREA:hf(e,t);break;case Y.NOSCRIPT:e.options.scriptingEnabled?vf(e,t):Tf(e,t);break;case Y.PLAINTEXT:tf(e,t);break;case Y.COL:case Y.TH:case Y.TD:case Y.TR:case Y.HEAD:case Y.FRAME:case Y.TBODY:case Y.TFOOT:case Y.THEAD:case Y.CAPTION:case Y.COLGROUP:break;default:Tf(e,t)}}function Ef(e,t){if(e.openElements.hasInScope(Y.BODY)&&(e.insertionMode=Q.AFTER_BODY,e.options.sourceCodeLocationInfo)){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function Df(e,t){e.openElements.hasInScope(Y.BODY)&&(e.insertionMode=Q.AFTER_BODY,Sp(e,t))}function Of(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function kf(e){let t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(Y.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(Y.FORM):n&&e.openElements.remove(n))}function Af(e){e.openElements.hasInButtonScope(Y.P)||e._insertFakeElement(J.P,Y.P),e._closePElement()}function jf(e){e.openElements.hasInListItemScope(Y.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(Y.LI),e.openElements.popUntilTagNamePopped(Y.LI))}function Mf(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function Nf(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function Pf(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function Ff(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(J.BR,Y.BR),e.openElements.pop(),e.framesetOk=!1}function If(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!==Y.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 Lf(e,t){switch(t.tagID){case Y.A:case Y.B:case Y.I:case Y.S:case Y.U:case Y.EM:case Y.TT:case Y.BIG:case Y.CODE:case Y.FONT:case Y.NOBR:case Y.SMALL:case Y.STRIKE:case Y.STRONG:xd(e,t);break;case Y.P:Af(e);break;case Y.DL:case Y.UL:case Y.OL:case Y.DIR:case Y.DIV:case Y.NAV:case Y.PRE:case Y.MAIN:case Y.MENU:case Y.ASIDE:case Y.BUTTON:case Y.CENTER:case Y.FIGURE:case Y.FOOTER:case Y.HEADER:case Y.HGROUP:case Y.DIALOG:case Y.ADDRESS:case Y.ARTICLE:case Y.DETAILS:case Y.SEARCH:case Y.SECTION:case Y.SUMMARY:case Y.LISTING:case Y.FIELDSET:case Y.BLOCKQUOTE:case Y.FIGCAPTION:Of(e,t);break;case Y.LI:jf(e);break;case Y.DD:case Y.DT:Mf(e,t);break;case Y.H1:case Y.H2:case Y.H3:case Y.H4:case Y.H5:case Y.H6:Nf(e);break;case Y.BR:Ff(e);break;case Y.BODY:Ef(e,t);break;case Y.HTML:Df(e,t);break;case Y.FORM:kf(e);break;case Y.APPLET:case Y.OBJECT:case Y.MARQUEE:Pf(e,t);break;case Y.TEMPLATE:Id(e,t);break;default:If(e,t)}}function Rf(e,t){e.tmplInsertionModeStack.length>0?bp(e,t):Td(e,t)}function zf(e,t){var n;t.tagID===Y.SCRIPT&&((n=e.scriptHandler)==null||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function Bf(e,t){e._err(t,G.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function Vf(e,t){if(e.openElements.currentTagId!==void 0&&fd.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=Q.IN_TABLE_TEXT,t.type){case K.CHARACTER:ep(e,t);break;case K.WHITESPACE_CHARACTER:$f(e,t);break}else Qf(e,t)}function Hf(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_CAPTION}function Uf(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_COLUMN_GROUP}function Wf(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(J.COLGROUP,Y.COLGROUP),e.insertionMode=Q.IN_COLUMN_GROUP,ap(e,t)}function Gf(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_TABLE_BODY}function Kf(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(J.TBODY,Y.TBODY),e.insertionMode=Q.IN_TABLE_BODY,cp(e,t)}function qf(e,t){e.openElements.hasInTableScope(Y.TABLE)&&(e.openElements.popUntilTagNamePopped(Y.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function Jf(e,t){uf(t)?e._appendElement(t,q.HTML):Qf(e,t),t.ackSelfClosing=!0}function Yf(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,q.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Xf(e,t){switch(t.tagID){case Y.TD:case Y.TH:case Y.TR:Kf(e,t);break;case Y.STYLE:case Y.SCRIPT:case Y.TEMPLATE:Pd(e,t);break;case Y.COL:Wf(e,t);break;case Y.FORM:Yf(e,t);break;case Y.TABLE:qf(e,t);break;case Y.TBODY:case Y.TFOOT:case Y.THEAD:Gf(e,t);break;case Y.INPUT:Jf(e,t);break;case Y.CAPTION:Hf(e,t);break;case Y.COLGROUP:Uf(e,t);break;default:Qf(e,t)}}function Zf(e,t){switch(t.tagID){case Y.TABLE:e.openElements.hasInTableScope(Y.TABLE)&&(e.openElements.popUntilTagNamePopped(Y.TABLE),e._resetInsertionMode());break;case Y.TEMPLATE:Id(e,t);break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TBODY:case Y.TD:case Y.TFOOT:case Y.TH:case Y.THEAD:case Y.TR:break;default:Qf(e,t)}}function Qf(e,t){let n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,Wd(e,t),e.fosterParentingEnabled=n}function $f(e,t){e.pendingCharacterTokens.push(t)}function ep(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function tp(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)Qf(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}var np=new Set([Y.CAPTION,Y.COL,Y.COLGROUP,Y.TBODY,Y.TD,Y.TFOOT,Y.TH,Y.THEAD,Y.TR]);function rp(e,t){let n=t.tagID;np.has(n)?e.openElements.hasInTableScope(Y.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(Y.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Q.IN_TABLE,Xf(e,t)):$(e,t)}function ip(e,t){let n=t.tagID;switch(n){case Y.CAPTION:case Y.TABLE:e.openElements.hasInTableScope(Y.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(Y.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Q.IN_TABLE,n===Y.TABLE&&Zf(e,t));break;case Y.BODY:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TBODY:case Y.TD:case Y.TFOOT:case Y.TH:case Y.THEAD:case Y.TR:break;default:Lf(e,t)}}function ap(e,t){switch(t.tagID){case Y.HTML:$(e,t);break;case Y.COL:e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.TEMPLATE:Pd(e,t);break;default:sp(e,t)}}function op(e,t){switch(t.tagID){case Y.COLGROUP:e.openElements.currentTagId===Y.COLGROUP&&(e.openElements.pop(),e.insertionMode=Q.IN_TABLE);break;case Y.TEMPLATE:Id(e,t);break;case Y.COL:break;default:sp(e,t)}}function sp(e,t){e.openElements.currentTagId===Y.COLGROUP&&(e.openElements.pop(),e.insertionMode=Q.IN_TABLE,e._processToken(t))}function cp(e,t){switch(t.tagID){case Y.TR:e.openElements.clearBackToTableBodyContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_ROW;break;case Y.TH:case Y.TD:e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(J.TR,Y.TR),e.insertionMode=Q.IN_ROW,up(e,t);break;case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.TBODY:case Y.TFOOT:case Y.THEAD:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE,Xf(e,t));break;default:Xf(e,t)}}function lp(e,t){let n=t.tagID;switch(t.tagID){case Y.TBODY:case Y.TFOOT:case Y.THEAD:e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE);break;case Y.TABLE:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE,Zf(e,t));break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TD:case Y.TH:case Y.TR:break;default:Zf(e,t)}}function up(e,t){switch(t.tagID){case Y.TH:case Y.TD:e.openElements.clearBackToTableRowContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_CELL,e.activeFormattingElements.insertMarker();break;case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.TBODY:case Y.TFOOT:case Y.THEAD:case Y.TR:e.openElements.hasInTableScope(Y.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY,cp(e,t));break;default:Xf(e,t)}}function dp(e,t){switch(t.tagID){case Y.TR:e.openElements.hasInTableScope(Y.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY);break;case Y.TABLE:e.openElements.hasInTableScope(Y.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY,lp(e,t));break;case Y.TBODY:case Y.TFOOT:case Y.THEAD:(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(Y.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY,lp(e,t));break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TD:case Y.TH:break;default:Zf(e,t)}}function fp(e,t){let n=t.tagID;np.has(n)?(e.openElements.hasInTableScope(Y.TD)||e.openElements.hasInTableScope(Y.TH))&&(e._closeTableCell(),up(e,t)):$(e,t)}function pp(e,t){let n=t.tagID;switch(n){case Y.TD:case Y.TH:e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Q.IN_ROW);break;case Y.TABLE:case Y.TBODY:case Y.TFOOT:case Y.THEAD:case Y.TR:e.openElements.hasInTableScope(n)&&(e._closeTableCell(),dp(e,t));break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:break;default:Lf(e,t)}}function mp(e,t){switch(t.tagID){case Y.HTML:$(e,t);break;case Y.OPTION:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e._insertElement(t,q.HTML);break;case Y.OPTGROUP:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e.openElements.currentTagId===Y.OPTGROUP&&e.openElements.pop(),e._insertElement(t,q.HTML);break;case Y.HR:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e.openElements.currentTagId===Y.OPTGROUP&&e.openElements.pop(),e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.INPUT:case Y.KEYGEN:case Y.TEXTAREA:case Y.SELECT:e.openElements.hasInSelectScope(Y.SELECT)&&(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode(),t.tagID!==Y.SELECT&&e._processStartTag(t));break;case Y.SCRIPT:case Y.TEMPLATE:Pd(e,t);break;default:}}function hp(e,t){switch(t.tagID){case Y.OPTGROUP:e.openElements.stackTop>0&&e.openElements.currentTagId===Y.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===Y.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===Y.OPTGROUP&&e.openElements.pop();break;case Y.OPTION:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop();break;case Y.SELECT:e.openElements.hasInSelectScope(Y.SELECT)&&(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode());break;case Y.TEMPLATE:Id(e,t);break;default:}}function gp(e,t){let n=t.tagID;n===Y.CAPTION||n===Y.TABLE||n===Y.TBODY||n===Y.TFOOT||n===Y.THEAD||n===Y.TR||n===Y.TD||n===Y.TH?(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode(),e._processStartTag(t)):mp(e,t)}function _p(e,t){let n=t.tagID;n===Y.CAPTION||n===Y.TABLE||n===Y.TBODY||n===Y.TFOOT||n===Y.THEAD||n===Y.TR||n===Y.TD||n===Y.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode(),e.onEndTag(t)):hp(e,t)}function vp(e,t){switch(t.tagID){case Y.BASE:case Y.BASEFONT:case Y.BGSOUND:case Y.LINK:case Y.META:case Y.NOFRAMES:case Y.SCRIPT:case Y.STYLE:case Y.TEMPLATE:case Y.TITLE:Pd(e,t);break;case Y.CAPTION:case Y.COLGROUP:case Y.TBODY:case Y.TFOOT:case Y.THEAD:e.tmplInsertionModeStack[0]=Q.IN_TABLE,e.insertionMode=Q.IN_TABLE,Xf(e,t);break;case Y.COL:e.tmplInsertionModeStack[0]=Q.IN_COLUMN_GROUP,e.insertionMode=Q.IN_COLUMN_GROUP,ap(e,t);break;case Y.TR:e.tmplInsertionModeStack[0]=Q.IN_TABLE_BODY,e.insertionMode=Q.IN_TABLE_BODY,cp(e,t);break;case Y.TD:case Y.TH:e.tmplInsertionModeStack[0]=Q.IN_ROW,e.insertionMode=Q.IN_ROW,up(e,t);break;default:e.tmplInsertionModeStack[0]=Q.IN_BODY,e.insertionMode=Q.IN_BODY,$(e,t)}}function yp(e,t){t.tagID===Y.TEMPLATE&&Id(e,t)}function bp(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(Y.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):Td(e,t)}function xp(e,t){t.tagID===Y.HTML?$(e,t):Cp(e,t)}function Sp(e,t){if(t.tagID===Y.HTML){if(e.fragmentContext||(e.insertionMode=Q.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===Y.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 Cp(e,t)}function Cp(e,t){e.insertionMode=Q.IN_BODY,Wd(e,t)}function wp(e,t){switch(t.tagID){case Y.HTML:$(e,t);break;case Y.FRAMESET:e._insertElement(t,q.HTML);break;case Y.FRAME:e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.NOFRAMES:Pd(e,t);break;default:}}function Tp(e,t){t.tagID===Y.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==Y.FRAMESET&&(e.insertionMode=Q.AFTER_FRAMESET))}function Ep(e,t){switch(t.tagID){case Y.HTML:$(e,t);break;case Y.NOFRAMES:Pd(e,t);break;default:}}function Dp(e,t){t.tagID===Y.HTML&&(e.insertionMode=Q.AFTER_AFTER_FRAMESET)}function Op(e,t){t.tagID===Y.HTML?$(e,t):kp(e,t)}function kp(e,t){e.insertionMode=Q.IN_BODY,Wd(e,t)}function Ap(e,t){switch(t.tagID){case Y.HTML:$(e,t);break;case Y.NOFRAMES:Pd(e,t);break;default:}}function jp(e,t){t.chars=`�`,e._insertCharacters(t)}function Mp(e,t){e._insertCharacters(t),e.framesetOk=!1}function Np(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==q.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function Pp(e,t){if(ed(t))Np(e),e._startTagOutsideForeignContent(t);else{let n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===q.MATHML?td(t):r===q.SVG&&(id(t),nd(t)),rd(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function Fp(e,t){if(t.tagID===Y.P||t.tagID===Y.BR){Np(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)===q.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 Ip=new Set([J.AREA,J.BASE,J.BASEFONT,J.BGSOUND,J.BR,J.COL,J.EMBED,J.FRAME,J.HR,J.IMG,J.INPUT,J.KEYGEN,J.LINK,J.META,J.PARAM,J.SOURCE,J.TRACK,J.WBR]);function Lp(e,t){return t.treeAdapter.isElementNode(e)&&t.treeAdapter.getNamespaceURI(e)===q.HTML&&Ip.has(t.treeAdapter.getTagName(e))}var Rp={treeAdapter:Fu,scriptingEnabled:!0};function zp(e,t){let n={...Rp,...t};return Lp(e,n)?``:Bp(e,n)}function Bp(e,t){let n=``,r=t.treeAdapter.isElementNode(e)&&t.treeAdapter.getTagName(e)===J.TEMPLATE&&t.treeAdapter.getNamespaceURI(e)===q.HTML?t.treeAdapter.getTemplateContent(e):e,i=t.treeAdapter.getChildNodes(r);if(i)for(let e of i)n+=Vp(e,t);return n}function Vp(e,t){return t.treeAdapter.isElementNode(e)?Hp(e,t):t.treeAdapter.isTextNode(e)?Wp(e,t):t.treeAdapter.isCommentNode(e)?Gp(e,t):t.treeAdapter.isDocumentTypeNode(e)?Kp(e,t):``}function Hp(e,t){let n=t.treeAdapter.getTagName(e);return`<${n}${Up(e,t)}>${Lp(e,t)?``:`${Bp(e,t)}</${n}>`}`}function Up(e,{treeAdapter:t}){let n=``;for(let r of t.getAttrList(e)){if(n+=` `,r.namespace)switch(r.namespace){case q.XML:n+=`xml:${r.name}`;break;case q.XMLNS:r.name!==`xmlns`&&(n+=`xmlns:`),n+=r.name;break;case q.XLINK:n+=`xlink:${r.name}`;break;default:n+=`${r.prefix}:${r.name}`}else n+=r.name;n+=`="${ha(r.value)}"`}return n}function Wp(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)===q.HTML&&su(a,t.scriptingEnabled)?r:ga(r)}function Gp(e,{treeAdapter:t}){return`<!--${t.getCommentNodeContent(e)}-->`}function Kp(e,{treeAdapter:t}){return`<!DOCTYPE ${t.getDocumentTypeNodeName(e)}>`}function qp(e,t){return md.parse(e,t)}function Jp(e){return`attrs`in e&&`tagName`in e}function Yp(e){return Jp(e)&&e.nodeName===`template`}function Xp(e,t,n){e.attrs=e.attrs.filter(e=>e.name!==t),n!==void 0&&e.attrs.push({name:t,value:n})}function Zp(e){if(Jp(e)){Xp(e,Fn),Xp(e,In);let t=e.sourceCodeLocation;t&&(Xp(e,Fn,String(t.startLine)),Xp(e,In,String(t.endLine)))}if(`childNodes`in e)for(let t of e.childNodes)Zp(t);Yp(e)&&Zp(e.content)}function Qp(e){let t=qp(e,{sourceCodeLocationInfo:!0});Zp(t);let n=t.childNodes.find(e=>Jp(e)&&e.tagName===`html`);return n&&Xp(n,Ln,String(Kn(e))),zp(t)}var $p=[[`img`,`src`],[`script`,`src`],[`link[rel~="stylesheet" i]`,`href`],[`link[rel~="icon" i]`,`href`],[`source`,`src`],[`video`,`src`],[`video`,`poster`],[`audio`,`src`]],em=[`img[srcset]`,`source[srcset]`],tm=20*1024*1024;async function nm(e,t,n,r,i,a,o,s){let c=new DOMParser().parseFromString(Qp(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)}Vl(c)&&await rm(c);let l=[];for(let[n,i]of $p)for(let o of c.querySelectorAll(n)){let n=mt(t,o.getAttribute(i)??``);n&&(o.removeAttribute(i),l.push(im(e,n,r,a).then(e=>{e&&o.setAttribute(i,e)})))}for(let n of em)for(let i of c.querySelectorAll(n)){let n=ht(i.getAttribute(`srcset`)??``),o=n.map(({ref:e})=>mt(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 im(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`,dt(t))})))}return await Promise.all(l),o&&kl(c,o),s&&Rl(c,s),`<!doctype html>${c.documentElement.outerHTML}`}async function rm(e){let{default:t}=await b(async()=>{let{default:e}=await import(`./_virtual_katex-inline-css-DN-_JSKR.js`);return{default:e}},[]),n=e.createElement(`style`);n.textContent=`${t}\n${Zt}`,(e.head??e.documentElement).appendChild(n)}function im(e,t,n,r){let i=n.get(t);if(i)return i;let a=el(e,t,r).then(async e=>e.size>tm?null:`data:${am(t,e.type)};base64,${om(await e.arrayBuffer())}`).catch(()=>null);return n.set(t,a),a}function am(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 om(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 sm({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=qt(`html`,[e,r,t]),[d,f]=(0,N.useState)(null),p=(0,N.useRef)(new Map),m=g().editorFontSize,h=(0,N.useRef)(null),[_]=(0,N.useState)(Cl),[v]=(0,N.useState)(Cl),y=rt({shortcutEnabled:s,onFind:(e,t,n)=>Fl(h.current?.contentWindow??null,v,e,t,n),onClear:()=>Il(h.current?.contentWindow??null,v),onCloseFocus:()=>h.current?.focus()}),b=(0,N.useMemo)(()=>({session:e,path:t,root:r}),[e,t,r]),x=(0,N.useMemo)(()=>Kn(n),[n]);return(0,N.useEffect)(()=>{let i=!1;return nm(e,t,n,p.current,m,r,_,v).then(e=>{i||f(e)}),()=>{i=!0}},[e,t,n,m,r,_,v,l]),(0,N.useEffect)(()=>{let e=e=>{let t=Pl(e,h.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,N.useEffect)(()=>{if(a)return Zn.subscribe(o,b,e=>{Dl(h.current?.contentWindow??null,_,e)})},[a,o,b,_]),(0,N.useEffect)(()=>{let e=e=>{let t=Tl(e,h.current?.contentWindow??null,_);if(t)if(t.layout&&(a||!t.scrolled)){let e=(a?Zn.get(o,b):void 0)??Qn.get(u);if(e&&Dl(h.current?.contentWindow??null,_,e),i){let n=e??t;Zn.publish(o,b,n.ratio,n.sourceLine)}}else Qn.set(u,{ratio:t.ratio,sourceLine:t.sourceLine,revision:0}),i&&Zn.publish(o,b,t.ratio,t.sourceLine);let n=c?El(e,h.current?.contentWindow??null,_):null;n&&c?.({line:li(n.line,x)})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[i,a,o,b,_,c,x,u]),d===null?null:(0,P.jsxs)(`div`,{className:`relative size-full bg-paper`,children:[(0,P.jsx)(`iframe`,{ref:h,sandbox:`allow-scripts`,src:l?`/preview.html`:void 0,srcDoc:l?void 0:d,title:t,className:`size-full bg-paper`,onLoad:()=>{let e=h.current;l&&e&&!e.dataset.delivered&&(e.dataset.delivered=`true`,e.contentWindow?.postMessage({kind:`puddle-preview-document`,html:d},`*`));{let e=(a?Zn.get(o,b):void 0)??Qn.get(u);e&&Dl(h.current?.contentWindow??null,_,e)}y.refresh()}},l?d:void 0),(0,P.jsx)(ci,{controls:y})]})}function cm({kind:e,...t}){return e===`notebook`?(0,P.jsx)(pl,{...t}):e===`markdown`?(0,P.jsx)(vl,{...t}):(0,P.jsx)(sm,{...t})}function lm({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}=Ne(),f=dr(e,t,null,r,{passive:n!==`notebook`,live:!0,focused:i}),p=f.model,m=(0,N.useSyncExternalStore)(n=>Bt(zt(e,t,r),n),()=>p?.getValue()??null);return f.conflict&&f.conflict.phase!==`unresolved`?(0,P.jsx)(Pn,{session:e,path:t,buffer:f,focused:i}):m===null?(0,P.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,P.jsx)(pl,{session:e,path:t,root:r,text:m,focused:i,onOpenFile:t=>d(e,t,void 0,{...ft(t)?{view:`preview`}:{},...r===void 0?{}:{root:r}}),onRun:l?()=>l(!0):void 0,running:u,onUndo:()=>{p?.undo()},onRedo:()=>{p?.redo()},onChange:e=>{let t=f.model;if(!t)return;let n=ei(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,P.jsx)(cm,{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,{...ft(t)?{view:`preview`}:{},...r===void 0?{}:{root:r}})})}var um={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 dm(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0?null:um[t.slice(n+1).toLowerCase()]??null}var fm=(0,N.lazy)(()=>b(()=>import(`./PdfViewer-Bppu4-0-.js`).then(e=>({default:e.PdfViewer})),__vite__mapDeps([13,1,2,3,7,8,5,14,10,15,16])));function pm({session:e,path:t,kind:n,root:r,generatedBy:i,refreshKey:a,onRevealSource:o,readOnly:s=!1}){let{asset:c,error:l}=gm(e,t,r,Pe(e,t,r),a);if(l)return(0,P.jsxs)(mm,{children:[(0,P.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:l}),!s&&(0,P.jsx)(hm,{session:e,path:t,root:r})]});if(!c)return(0,P.jsx)(mm,{children:(0,P.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`…`})});let{url:u,blob:d}=c;return n===`image`?(0,P.jsx)(mm,{children:(0,P.jsx)(`img`,{src:u,alt:t,className:`max-h-full max-w-full object-contain`})}):n===`video`?(0,P.jsx)(mm,{children:(0,P.jsx)(`video`,{src:u,controls:!0,className:`max-h-full max-w-full`})}):n===`audio`?(0,P.jsx)(mm,{children:(0,P.jsx)(`audio`,{src:u,controls:!0,className:`w-full max-w-xl`})}):(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(mm,{children:(0,P.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Loading PDF…`})}),children:(0,P.jsx)(fm,{blob:d,session:e,path:t,root:r,onRevealSource:!s&&vm(t,r,i)?o:void 0,onDownload:s?void 0:()=>void _m(e,t,r)})})}function mm({children:e}){return(0,P.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 hm({session:e,path:t,root:n}){return(0,P.jsx)(`button`,{type:`button`,onClick:()=>void _m(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 gm(e,t,n,r=0,i){let[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)(null);return(0,N.useEffect)(()=>{let r=null,i=!1;return o(null),c(null),el(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 _m(e,t,n){return ve(e,t,n).catch(e=>{Ue.error(e instanceof Error?e.message:`Download failed`)})}function vm(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 ym({tab:e,reveal:t,focused:n,scrollDriver:r,scrollReceiver:i,scrollChannel:a,onRevealSource:o,onRevealCompiledSource:s,onRunCompilation:c,compilationRunning:l}){let u=pt(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}`:ut(e);if(u===`diff`)return(0,P.jsx)(zr,{session:e.session,path:e.path,root:e.root,area:e.git_area,focused:n},ut(e));if(u===`commit`&&e.sha)return(0,P.jsx)(Rr,{session:e.session,sha:e.sha,path:e.path,root:e.root},ut(e));if(u===`external`&&e.root!==void 0){let u=dm(e.path);if(u)return(0,P.jsx)(pm,{session:e.session,path:e.path,kind:u,root:e.root,generatedBy:e.generated_by,onRevealSource:s},ut(e));let p=d?ft(e.path):null;return p?(0,P.jsx)(lm,{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,P.jsx)(Tr,{session:e.session,path:e.path,reveal:t,root:e.root,focused:n,scrollDriver:r,scrollReceiver:i,scrollChannel:a},ut(e))}if(u===`untitled`)return(0,P.jsx)(Vr,{name:e.path},ut(e));let p=dm(e.path);if(p)return(0,P.jsx)(pm,{session:e.session,path:e.path,kind:p,generatedBy:e.generated_by,onRevealSource:s},ut(e));let m=d?ft(e.path):null;return m?(0,P.jsx)(lm,{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,P.jsx)(Tr,{session:e.session,path:e.path,reveal:t,focused:n,scrollDriver:r,scrollReceiver:i,scrollChannel:a},ut(e))}export{ym as PaneEditorBody};