@fabiofiorita/porcelain 0.65.2 → 0.65.3

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 (58) hide show
  1. package/README.md +12 -7
  2. package/package.json +1 -1
  3. package/server/src/cli/main.mjs +2699 -2564
  4. package/web/dist/assets/_paired-BGQByqTx.js +1 -0
  5. package/web/dist/assets/_paired-C-OPMHd_.js +1 -0
  6. package/web/dist/assets/_paired-DR1ndZmE.js +1 -0
  7. package/web/dist/assets/_paired-qSHXbKkl.js +1 -0
  8. package/web/dist/assets/_section-D25X_IP_.js +1 -0
  9. package/web/dist/assets/_worktreeId-2AckLnuR.js +1 -0
  10. package/web/dist/assets/_worktreeId-Cfr9rr3q.js +1 -0
  11. package/web/dist/assets/_worktreeId-DR1ndZmE.js +1 -0
  12. package/web/dist/assets/_worktreeId-qSHXbKkl.js +1 -0
  13. package/web/dist/assets/access-CnKxJMA6.js +1 -0
  14. package/web/dist/assets/connected-workspace-DDQUa7Bv.js +1 -0
  15. package/web/dist/assets/desktop-actions-C6IPObdg.js +11 -0
  16. package/web/dist/assets/{edit-file-DOZdUUk9.js → edit-file-CqSI_R_G.js} +35 -35
  17. package/web/dist/assets/{file-editor-DvHSzrST.js → file-editor-CY822nHE.js} +14 -14
  18. package/web/dist/assets/files-Dq4t9_xQ.js +17 -0
  19. package/web/dist/assets/git-actions-BrTzG9I2.js +1345 -0
  20. package/web/dist/assets/{index-Cia9YleJ.js → index-D5KKCKKt.js} +4 -4
  21. package/web/dist/assets/index-DddS8Xzd.css +2 -0
  22. package/web/dist/assets/lazyRouteComponent-BpzFu5o7.js +1 -0
  23. package/web/dist/assets/link-B0k0Dw1r.js +1 -0
  24. package/web/dist/assets/pair-D3O7jbtO.js +1 -0
  25. package/web/dist/assets/pair-DR1ndZmE.js +1 -0
  26. package/web/dist/assets/search-CVF8YG8C.js +1 -0
  27. package/web/dist/assets/useRouterState-GGrtXzjn.js +1 -0
  28. package/web/dist/assets/workspace-error-CpgoRLTX.js +1 -0
  29. package/web/dist/assets/workspace-pending-CSj0ENeH.js +1 -0
  30. package/web/dist/index.html +10 -13
  31. package/web/dist/assets/_paired-B3CMUVff.js +0 -1
  32. package/web/dist/assets/_paired-B8xCvrtN.js +0 -1
  33. package/web/dist/assets/_paired-YiNqIqrL.js +0 -1
  34. package/web/dist/assets/_paired-rl3uQlkr.js +0 -1
  35. package/web/dist/assets/_section-DJ3o28t3.js +0 -1
  36. package/web/dist/assets/_worktreeId-B3CMUVff.js +0 -1
  37. package/web/dist/assets/_worktreeId-B8xCvrtN.js +0 -1
  38. package/web/dist/assets/_worktreeId-DS7C0JfB.js +0 -1
  39. package/web/dist/assets/_worktreeId-DzWffY3l.js +0 -1
  40. package/web/dist/assets/access-yiNkcsHW.js +0 -1
  41. package/web/dist/assets/connected-workspace-HwRJynH2.js +0 -1
  42. package/web/dist/assets/desktop-UhAM-aem.js +0 -14
  43. package/web/dist/assets/desktop-actions-_GPqaBVU.js +0 -12
  44. package/web/dist/assets/files-DGG-rGAk.js +0 -4
  45. package/web/dist/assets/git-actions-PSyqF5Ms.js +0 -1345
  46. package/web/dist/assets/index-DUPxq0qw.css +0 -2
  47. package/web/dist/assets/lazyRouteComponent-C0cxtC0x.js +0 -1
  48. package/web/dist/assets/link-Cr7ETqcH.js +0 -1
  49. package/web/dist/assets/pair-B3CMUVff.js +0 -1
  50. package/web/dist/assets/pair-pADUBfPY.js +0 -1
  51. package/web/dist/assets/preferences-gCf_-ng1.js +0 -1
  52. package/web/dist/assets/review-diagram-CK76VybL.js +0 -7
  53. package/web/dist/assets/review-diagram-DLioOiRN.css +0 -1
  54. package/web/dist/assets/search-YI2tNMg7.js +0 -1
  55. package/web/dist/assets/server-CO1nBw31.js +0 -1
  56. package/web/dist/assets/useRouterState-DpORzQ8V.js +0 -1
  57. package/web/dist/assets/workspace-error-DILP6VTh.js +0 -1
  58. package/web/dist/assets/workspace-pending-6RKmflS9.js +0 -1
@@ -1,7 +1,7 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-B8mrqUL5.js","assets/rolldown-runtime-hePW80VL.js","assets/html-XwrE-1r6.js","assets/javascript-obGGvMPs.js","assets/css-CNuuLpMC.js","assets/angular-ts-Bzix210W.js","assets/scss-YesllqfO.js","assets/apl-Dhin1L29.js","assets/xml-BlnrEAEy.js","assets/java-DdHNQ9hk.js","assets/json-DAgxKhMr.js","assets/astro-B-4NNgOP.js","assets/typescript-BydbNFcO.js","assets/postcss-BXeXVLqQ.js","assets/tsx-CUOciP0b.js","assets/blade-C6Gedziy.js","assets/html-derivative-i4STDFnl.js","assets/sql-DdD7vxS4.js","assets/bsl-_VjlB9mv.js","assets/sdbl-bTVj8UrX.js","assets/c-iCihek07.js","assets/cairo-DLTphjLi.js","assets/python-gzcpVVnB.js","assets/chapel-DmtgEXO_.js","assets/cobol-Cw2-KvLW.js","assets/coffee-CiiSLhB6.js","assets/cpp-71xkOQct.js","assets/regexp-DR20uMnK.js","assets/glsl-D5MA2a_X.js","assets/crystal-DGPAtLeY.js","assets/shellscript-Da78Ox-3.js","assets/edge-DCY0a-ow.js","assets/elixir-DP304Xio.js","assets/elm-o4NJxfws.js","assets/erb-C7MPl934.js","assets/ruby-B8JcIHv0.js","assets/haml-CwEpbK1d.js","assets/graphql-Ctjuxyvl.js","assets/jsx-gTgmArGx.js","assets/lua-FONpmTUP.js","assets/yaml-Du_6cdrH.js","assets/erlang-Cphh6RMH.js","assets/markdown-BYOwaDjH.js","assets/fortran-fixed-form-DEKoE2YW.js","assets/fortran-free-form-CYNrtFtB.js","assets/fsharp-D13ZGOAj.js","assets/gdresource-xMC7jr7x.js","assets/gdshader-CBce3t8t.js","assets/gdscript-DYvRD3hg.js","assets/git-commit-BSykSTBG.js","assets/diff-woXpYk--.js","assets/git-rebase-BDPpS8w6.js","assets/glimmer-js-BONyzAsu.js","assets/glimmer-ts-f9c0GCOe.js","assets/hack-Dh_ZLRbs.js","assets/handlebars-ryMP1rBR.js","assets/http-kmH8AyfE.js","assets/hurl-DCZHXKU4.js","assets/csv-Dx-8-gkx.js","assets/hxml-Dcm88srW.js","assets/haxe-C8oCnwJJ.js","assets/jinja-B-tLrNsM.js","assets/jison-CBjhYtSs.js","assets/julia-CXJVy74_.js","assets/r-BHcO8Vjq.js","assets/just-B9Xn_Dp4.js","assets/perl-DEgXgjuC.js","assets/latex-o9DRzaEe.js","assets/tex-BK-H2Wn4.js","assets/liquid-G0MH4h_m.js","assets/marko-DV5GrDmo.js","assets/less-DVTAwKKz.js","assets/mdc-BKfPFPZw.js","assets/nextflow-BJtWHP5T.js","assets/nextflow-groovy-DJMQeKeT.js","assets/nginx-BTMw9COX.js","assets/nim-B6yJ_yaC.js","assets/org-Ddi8Gs6E.js","assets/clojure-DqKBuwfJ.js","assets/csharp-oqKa8noW.js","assets/dart-CnvKMtbv.js","assets/docker-IyjqRm3v.js","assets/go-rLFTqkRN.js","assets/groovy-CacY0gHj.js","assets/ini-B5eOa1yu.js","assets/make-Dixweg8N.js","assets/objective-c-D1A_Heim.js","assets/ocaml-O90oeIOV.js","assets/php-B9UPq-vz.js","assets/vb-DOwzaHZ0.js","assets/raku-B3gFvitq.js","assets/rust-Cfkwpbl8.js","assets/scala-BiFt_7mu.js","assets/zig-CMLA9XwU.js","assets/xsl-BOPS8gLt.js","assets/pug-DkgDHZci.js","assets/qml-_a-QhfPD.js","assets/razor-BMJ0eI3p.js","assets/rst-BQCbfb9V.js","assets/cmake-Bj61d0ZC.js","assets/sas-CBpMWA2M.js","assets/shaderlab-TOUzSsQk.js","assets/hlsl-Cvrh5tZx.js","assets/shellsession-CVsQGYfZ.js","assets/soy-DEd-qcad.js","assets/sparql-D_iOobhT.js","assets/turtle-ByJddavk.js","assets/stata-CMv7m7Gi.js","assets/surrealql-BZoq2lXR.js","assets/svelte-Bj3Hmc9F.js","assets/templ-TjxbArHn.js","assets/ts-tags-Cc5do7zu.js","assets/twig-BVSnuTf-.js","assets/typst-C40W_gC6.js","assets/bat-qdxAdBWQ.js","assets/bibtex-Ci_nEsc7.js","assets/jsonc-CYpm1nAK.js","assets/log-BNLmms1o.js","assets/powershell-CCSX75yM.js","assets/swift-CyEgAFGc.js","assets/system-verilog-Dh5ihWbf.js","assets/verilog-B2gwz-sJ.js","assets/vue-BNQF7r6F.js","assets/vue-html-DkKkQnZL.js","assets/vue-vine-DFaKYU4X.js","assets/stylus-B6D30XZt.js"])))=>i.map(i=>d[i]);
2
- import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{Dc as r,G as i,H as a,J as o,Mr as s,Ms as c,Q as l,Rr as u,U as d,V as f,Y as p,Z as m,bs as h,fo as g,mo as _,nt as v,rt as y,wc as b,xs as x}from"./desktop-UhAM-aem.js";import{At as S,Bn as C,Bt as w,Dn as T,E,En as ee,Et as te,Fn as ne,Ft as re,Gt as ie,Kt as ae,Lt as oe,On as se,Pn as ce,Q as le,Rn as ue,T as de,Vt as fe,Yn as pe,a as me,ar as D,at as he,c as ge,dr as _e,et as ve,fr as ye,gr as be,hn as xe,jt as Se,lr as Ce,nt as we,o as Te,or as Ee,ur as De,vn as Oe,zn as ke}from"./files-DGG-rGAk.js";import{f as Ae}from"./preferences-gCf_-ng1.js";import{t as O}from"./preload-helper-Czpn1I53.js";var k=t(y(),1),je=k.createContext(void 0);function Me(){let e=k.useContext(je);if(!e)throw Error(Ce(73));return e}var Ne=0;function Pe(e){return Ne+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${Ne}`}function Fe(e,t){if(typeof e==`string`)return{description:e};if(typeof e==`function`){let n=e(t);return typeof n==`string`?{description:n}:n}return e}function Ie(e){let t=new Map,n=0,r=0;return e.forEach((e,i)=>{let a=e.transitionStatus===`ending`;t.set(e.id,{value:e,domIndex:i,visibleIndex:a?-1:n,offsetY:r}),r+=e.height||0,a||(n+=1)}),t}function Le(e,t){let n=0;return e.map(e=>{if(e.transitionStatus===`ending`)return e;let r=n>=t;return n+=1,e.limited===r?e:{...e,limited:r}})}var A={toasts:e=>e.toasts,isEmpty:e=>e.toasts.length===0,toast:(e,t)=>e.toastMetadata.get(t)?.value,toastIndex:(e,t)=>e.toastMetadata.get(t)?.domIndex??-1,toastOffsetY:(e,t)=>e.toastMetadata.get(t)?.offsetY??0,toastVisibleIndex:(e,t)=>e.toastMetadata.get(t)?.visibleIndex??-1,focused:e=>e.focused,expanded:e=>e.hovering||e.focused,expandedOrOutOfFocus:e=>e.hovering||e.focused||!e.isWindowFocused,prevFocusElement:e=>e.prevFocusElement},Re=class extends D{timers=new Map;areTimersPaused=!1;constructor(e){super({...e,toastMetadata:Ie(e.toasts)},{},A)}setViewport=e=>{this.set(`viewport`,e)};syncProviderProps(e,t){let n=this.state.limit!==t;if(this.state.timeout===e&&!n)return;let r={timeout:e,limit:t};if(n){let e=Le(this.state.toasts,t);r.toasts=e,r.toastMetadata=Ie(e)}this.update(r)}disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e,t=!1){let n=A.toastIndex(this.state,e);if(n===-1)return;let r=this.state.toasts[n];t||r?.onRemove?.();let i=[...this.state.toasts];i.splice(n,1),this.setToasts(i)}addToast=e=>{let{timeout:t,limit:n}=this.state,r=e.id||Pe(`toast`);if(e.id){let t=A.toast(this.state,e.id);if(t){if(t.transitionStatus===`ending`)this.removeToast(e.id,!0);else{let{id:t,transitionStatus:n,...r}=e;return this.updateToastInternal(e.id,r,!0,!0),e.id}}}let i={...e,id:r,updateKey:0,transitionStatus:`starting`},a=[i,...this.state.toasts];this.setToasts(Le(a,n));let o=i.timeout??t;return i.type!==`loading`&&o>0&&this.scheduleTimer(r,o,()=>this.closeToast(r)),A.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),r};updateToast=(e,t)=>{let n=A.toast(this.state,e);n&&n.transitionStatus!==`ending`&&this.updateToastInternal(e,typeof t==`function`?t(n):t,!1,!0)};updateToastInternal=(e,t,n=!1,r=!1)=>{let{timeout:i,toasts:a}=this.state,o=A.toast(this.state,e);if(!o||o.transitionStatus===`ending`)return;let s={...o,...t,...r&&{updateKey:o.updateKey+1}};this.setToasts(a.map(t=>t.id===e?s:t));let c=s.timeout??i,l=o.timeout??i,u=Object.hasOwn(t,`timeout`),d=s.transitionStatus!==`ending`&&s.type!==`loading`&&c>0,f=this.timers.has(e),p=l!==c,m=o.type===`loading`;if(!d&&f){this.clearTimer(e);return}d&&(!f||p||u||m||n)&&(this.clearTimer(e),this.scheduleTimer(e,c,()=>this.closeToast(e)),A.expandedOrOutOfFocus(this.state)&&this.pauseTimers())};closeToast=e=>{let t=e===void 0,{limit:n,toasts:r}=this.state,i;if(t)i=r,this.clearTimers();else{let t=A.toast(this.state,e);if(!t)return;i=[t],this.clearTimer(e)}let a=Le(r.map(n=>t||n.id===e?{...n,transitionStatus:`ending`,height:0}:n),n);this.setToasts(a,!a.some(e=>e.transitionStatus!==`ending`)),i.forEach(e=>{e.transitionStatus!==`ending`&&e.onClose?.()}),this.handleFocusManagement(e)};promiseToast=(e,t)=>{let n=Fe(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=Fe(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=Fe(t.error,e);return this.updateToast(r,{...n,type:`error`,timeout:n.timeout}),Promise.reject(e)});return{}.hasOwnProperty.call(t,`setPromise`)&&t.setPromise(i),i};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{e.timeout&&(e.timeout.clear(),e.remaining=Math.max(e.remaining-(Date.now()-e.start),0))}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=ce.create(),e.timeout.start(e.remaining,()=>{this.handleTimerFired(t),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if(e.pointerType!==`touch`)return;let t=se(e);T(this.state.viewport,t)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,t,n){let r=Date.now(),i=A.expandedOrOutOfFocus(this.state)?void 0:ce.create();i?.start(t,()=>{this.handleTimerFired(e),n()}),this.timers.set(e,{timeout:i,start:r,delay:t,remaining:t,callback:n})}clearTimers(){this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear(),this.areTimersPaused=!1}clearTimer(e){this.timers.get(e)?.timeout?.clear(),this.timers.delete(e),this.resetPausedStateIfNoTimersRemain()}handleTimerFired(e){this.timers.delete(e),this.resetPausedStateIfNoTimersRemain()}resetPausedStateIfNoTimersRemain(){this.timers.size===0&&(this.areTimersPaused=!1)}setToasts(e,t=e.length===0){let n={toasts:e,toastMetadata:Ie(e)};t&&(n.hovering=!1,n.focused=!1),this.update(n)}handleFocusManagement(e){let t=ee(ke(this.state.viewport));if(!this.state.viewport||!T(this.state.viewport,t)||!xe(t))return;if(e===void 0){this.restoreFocusToPrevElement();return}let n=A.toasts(this.state),r=A.toastIndex(this.state,e),i=(e,t)=>{for(let r=e;r>=0&&r<n.length;r+=t)if(n[r].transitionStatus!==`ending`)return n[r];return null},a=i(r+1,1)??i(r-1,-1);a?a.ref?.current?.focus():this.restoreFocusToPrevElement()}},j=v(),ze=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=_e(()=>new Re({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return ye(a.disposeEffect),k.useEffect(function(){if(i)return i[` subscribe`](({action:e,options:t})=>{let n=t.id;e===`promise`&&t.promise?a.promiseToast(t.promise,t):e===`update`&&n?a.updateToast(n,t.updates):e===`close`?a.closeToast(n):a.addToast(t)})},[a,i]),(0,j.jsxs)(je.Provider,{value:a,children:[(0,j.jsx)(Be,{store:a,timeout:n,limit:r}),t]})};function Be(e){let{store:t,timeout:n,limit:r}=e;return De(()=>{t.syncProviderProps(n,r)},[t,n,r]),null}var Ve=`--toast-frontmost-height`,He=k.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=Me(),c=ne(),l=k.useRef(!1),u=k.useRef(!1),d=k.useRef(!1),f=s.useState(`isEmpty`),p=s.useState(`toasts`),m=s.useState(`focused`),h=s.useState(`expanded`),g=s.useState(`prevFocusElement`),_=p[0]?.height,v=p.some(e=>e.transitionStatus===`ending`),y=p.filter(e=>e.priority===`high`);k.useEffect(()=>{let e=s.state.viewport;if(!e||f)return;let t=pe(e),n=ke(e);function r(t){t.key===`F6`&&se(t)!==e&&(t.preventDefault(),s.set(`prevFocusElement`,ee(n)),e?.focus({preventScroll:!0}),s.pauseTimers(),s.set(`focused`,!0))}function i(e){se(e)===t&&(s.set(`isWindowFocused`,!1),s.pauseTimers())}function a(n){if(n.relatedTarget)return;let r=se(n),i=ee(ke(e));(r===t||!T(e,r)||!xe(i))&&s.resumeTimers(),c.start(0,()=>s.set(`isWindowFocused`,!0))}return C(ue(t,`keydown`,r),ue(t,`blur`,i,!0),ue(t,`focus`,a,!0),ue(n,`pointerdown`,s.handleDocumentPointerDown,!0))},[s,c,f]);function b(e){l.current=!0;let t=e.relatedTarget===s.state.viewport?p.find(e=>e.transitionStatus!==`ending`&&!e.limited):void 0;t?t.ref?.current?.focus():s.restoreFocusToPrevElement()}function x(e){e.key===`Tab`&&e.shiftKey&&se(e.nativeEvent)===s.state.viewport&&(e.preventDefault(),s.restoreFocusToPrevElement())}function S(){s.state.toasts.some(e=>e.transitionStatus===`ending`)||d.current||!u.current||(s.state.isWindowFocused&&s.resumeTimers(),s.set(`hovering`,!1),u.current=!1)}k.useEffect(S,[v,s]);function w(){s.pauseTimers(),s.set(`hovering`,!0),u.current=!1}function E(){s.state.isWindowFocused&&s.resumeTimers()}function te(){u.current=!0,S()}function re(e){e.pointerType===`touch`&&(d.current=!0)}function oe(e){e.pointerType===`touch`&&(d.current=!1,S())}function ce(){if(l.current){l.current=!1;return}m||xe(ee(ke(s.state.viewport)))&&(s.set(`focused`,!0),s.pauseTimers())}function le(e){m&&!T(s.state.viewport,e.relatedTarget)&&(s.set(`focused`,!1),E())}let de={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:w,onMouseMove:w,onMouseLeave:te,onFocus:ce,onBlur:le,onKeyDown:x,onClick:ce,onPointerDown:re,onPointerUp:oe,onPointerCancel:oe,style:{[Ve]:_?`${_}px`:void 0}},me={expanded:h},D=!f&&g&&(0,j.jsx)(ie,{onFocus:b}),he=fe(`div`,e,{ref:[t,s.setViewport],state:me,props:[de,o,{children:(0,j.jsxs)(k.Fragment,{children:[D,a,D]})}]});return(0,j.jsxs)(k.Fragment,{children:[D,he,!m&&y.length>0&&(0,j.jsx)(`div`,{style:ae,children:y.map(e=>(0,j.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,j.jsx)(`div`,{children:e.title}),(0,j.jsx)(`div`,{children:e.description})]},e.id))})]})}),Ue=t(l(),1),We=k.createContext(void 0);function Ge(){let e=k.useContext(We);if(!e)throw Error(Ce(66));return e}function Ke(e,t){let n=(t??pe(e).getComputedStyle(e)).transform,r=0,i=0,a=1;if(n&&n!==`none`){let e=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){let t=e[1].split(`, `).map(parseFloat);t.length===6?(r=t[4],i=t[5],a=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(r=t[12],i=t[13],a=t[0])}}return{x:r,y:i,scale:a}}function qe(e,t,n){switch(e){case`up`:return-n;case`down`:return n;case`left`:return-t;case`right`:return t;default:return 0}}var Je=`--toast-index`,Ye=`--toast-offset-y`,Xe=`--toast-height`,Ze=`--toast-swipe-movement-x`,Qe=`--toast-swipe-movement-y`,$e=`data-swipe-direction`,et={...Oe,swipeDirection(e){return e?{[$e]:e}:null}},tt=40,nt=10,rt=.5,it=1,at=`${Se},${re}`,ot=k.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],style:o,...s}=e,c=n.positionerProps?.anchor!==void 0,l=[];c||(l=Array.isArray(a)?a:[a]);let u=l.length>0,d=Me(),[f,p]=k.useState(void 0),[m,h]=k.useState(!1),[g,_]=k.useState(!1),[v,y]=k.useState({x:0,y:0}),[b,x]=k.useState({x:0,y:0,scale:1}),[S,C]=k.useState(),[E,te]=k.useState(),[ne,re]=k.useState(null),ie=k.useRef(null),ae=k.useRef(void 0),ce=k.useRef({x:0,y:0}),le=k.useRef({x:0,y:0,scale:1}),de=k.useRef(void 0),pe=k.useRef(0),me=k.useRef(!1),D=k.useRef({x:0,y:0}),he=k.useRef(!1),ge=k.useRef({x:0,y:0}),_e=k.useRef(null),ve=k.useRef(null),ye=d.useState(`toastIndex`,n.id),be=d.useState(`toastVisibleIndex`,n.id),xe=d.useState(`toastOffsetY`,n.id),Se=d.useState(`focused`),Ce=d.useState(`expanded`);oe({open:n.transitionStatus!==`ending`,ref:ie,onComplete(){n.transitionStatus===`ending`&&d.removeToast(n.id)}});let we=Ee((e=!1)=>{let t=ie.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){d.updateToastInternal(n.id,{ref:ie,height:i,transitionStatus:void 0})}e?Ue.flushSync(a):a()});De(()=>{let e=ae.current;(n.transitionStatus===`starting`||e!==n.id)&&(e!==void 0&&(p(void 0),x({x:0,y:0,scale:1}),Te({x:0,y:0})),ae.current=n.id,we())},[we,n.id,n.transitionStatus]);function Te(e){ge.current=e,y(e)}De(()=>()=>{ve.current?.abort()},[]);function Oe(e,t){let n=e=>e>0?e**rt:-(Math.abs(e)**rt),r=e>0&&!l.includes(`right`)||e<0&&!l.includes(`left`),i=t>0&&!l.includes(`down`)||t<0&&!l.includes(`up`);return{x:r?n(e):e,y:i?n(t):t}}let Ae=Ee(e=>{if(e.pointerId!==_e.current)return;_e.current=null,ve.current?.abort(),ve.current=null,h(!1),_(!1),re(null);let t=le.current;if(e.type===`pointercancel`||me.current){Te({x:t.x,y:t.y}),p(void 0);return}let r=ge.current,i=r.x-t.x,a=r.y-t.y,o;for(let e of l)if(qe(e,i,a)>tt){o=e;break}o?(p(o),d.closeToast(n.id)):(Te({x:t.x,y:t.y}),p(void 0))});function O(e){if(e.button!==0||(e.pointerType===`touch`&&d.pauseTimers(),se(e.nativeEvent)?.closest(`button,a,input,textarea,[role="button"],${at}`)))return;me.current=!1,de.current=void 0,pe.current=0,_e.current=e.pointerId,ce.current={x:e.clientX,y:e.clientY},D.current=ce.current;let t=e.currentTarget,n=Ke(t);le.current=n,x(n),Te({x:n.x,y:n.y}),d.set(`hovering`,!0),h(!0),_(!1),re(null),he.current=!0,ve.current?.abort();let r=new AbortController;ve.current=r;let i=ke(t);i.addEventListener(`pointerup`,Ae,{signal:r.signal}),i.addEventListener(`pointercancel`,Ae,{signal:r.signal}),t.setPointerCapture?.(e.pointerId)}function je(e){if(e.pointerId!==_e.current)return;e.preventDefault(),he.current&&=(ce.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>D.current.y||i>0&&t<D.current.y)&&(D.current={x:D.current.x,y:t}),(r<0&&n>D.current.x||r>0&&n<D.current.x)&&(D.current={x:n,y:D.current.y});let a=n-ce.current.x,o=t-ce.current.y,s=t-D.current.y,c=n-D.current.x,u=ne;if(!g&&Math.sqrt(a*a+o*o)>=it){_(!0);let e=l.includes(`left`)||l.includes(`right`),t=l.includes(`up`)||l.includes(`down`);e&&t&&(u=Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`,re(u))}let d;if(!de.current)u===`vertical`?o>0?d=`down`:o<0&&(d=`up`):u===`horizontal`?a>0?d=`right`:a<0&&(d=`left`):d=Math.abs(a)>=Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`,d&&l.includes(d)&&(de.current=d,pe.current=qe(d,a,o),p(d));else{let e=de.current,t=qe(e,c,s);t>tt?(me.current=!1,p(e)):!(l.includes(`left`)&&l.includes(`right`))&&!(l.includes(`up`)&&l.includes(`down`))&&pe.current-t>=nt&&(me.current=!0)}let f=Oe(a,o),m=le.current.x,h=le.current.y,v=l.includes(`left`)||l.includes(`right`),y=l.includes(`up`)||l.includes(`down`);u!==`vertical`&&v&&(m+=f.x),u!==`horizontal`&&y&&(h+=f.y),Te({x:m,y:h})}function Ne(e){if(e.key===`Escape`){if(!ie.current||!T(ie.current,ee(ke(ie.current))))return;d.closeToast(n.id)}}k.useEffect(()=>{let e=ie.current;if(!u||!e)return;function t(t){_e.current!==null&&T(e,se(t))&&t.preventDefault()}return ue(e,`touchmove`,t,{passive:!1})},[u]);function Pe(){let e=v.x-b.x,t=v.y-b.y;return{transition:m?`none`:void 0,transform:m?`translateX(${v.x}px) translateY(${v.y}px) scale(${b.scale})`:void 0,[Ze]:`${e}px`,[Qe]:`${t}px`}}let Fe=n.priority===`high`,Ie={role:Fe?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":S,"aria-describedby":E,"aria-hidden":Fe&&!Se?!0:void 0,onPointerDown:u?O:void 0,onPointerMove:u?je:void 0,onPointerUp:u?Ae:void 0,onPointerCancel:u?Ae:void 0,onKeyDown:Ne,inert:w(n.limited),style:{...Pe(),[Je]:n.transitionStatus===`ending`?ye:be,[Ye]:`${xe}px`,[Xe]:n.height?`${n.height}px`:void 0}},Le=k.useMemo(()=>({toast:n,setTitleId:C,setDescriptionId:te,recalculateHeight:we,visibleIndex:be,expanded:Ce}),[n,C,te,we,be,Ce]),A={transitionStatus:n.transitionStatus,expanded:Ce,limited:n.limited||!1,type:n.type,swiping:m,swipeDirection:f},Re=fe(`div`,e,{ref:[t,ie],state:A,stateAttributesMapping:et,props:[Ie,s]});return(0,j.jsx)(We.Provider,{value:Le,children:Re})}),st=k.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{visibleIndex:o,expanded:s,recalculateHeight:c}=Ge(),l=k.useRef(null);return De(()=>{c();let e=l.current;if(!e||typeof ResizeObserver!=`function`||typeof MutationObserver!=`function`)return;let t=new ResizeObserver(()=>c(!0)),n=new MutationObserver(()=>c(!0));return t.observe(e),n.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{t.disconnect(),n.disconnect()}},[c]),fe(`div`,e,{ref:[t,l],state:{expanded:s,behind:o>0},props:a})});function ct(e){return e==null||typeof e==`boolean`||e===``?!1:!Array.isArray(e)||e.some(ct)}function lt(e){return k.isValidElement(e)&&ct(e.props.children)}function ut(e,t,n){let{toast:r,setTitleId:i,setDescriptionId:a}=Ge(),o=n===`title`?i:a,s=t??(n===`title`?r.title:r.description);return{id:S(e),children:s,type:r.type,setId:o}}function dt(e,t,n){let r=lt(e);return De(()=>{if(r)return n(t),()=>{n(e=>e===t?void 0:e)}},[r,t,n]),r?e:null}var ft=k.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,children:o,...s}=e,{id:c,children:l,type:u,setId:d}=ut(a,o,`description`);return dt(fe(`p`,e,{ref:t,state:{type:u},props:{...s,id:c,children:l}}),c,d)}),pt=k.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,children:o,...s}=e,{id:c,children:l,type:u,setId:d}=ut(a,o,`title`);return dt(fe(`h2`,e,{ref:t,state:{type:u},props:{...s,id:c,children:l}}),c,d)}),mt=k.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a,nativeButton:o=!0,...s}=e,c=Me(),{toast:l,expanded:u}=Ge(),[d,f]=k.useState(!1),{getButtonProps:p,buttonRef:m}=te({disabled:a,native:o}),h={type:l.type};return fe(`button`,e,{ref:[t,m],state:h,props:[{"aria-hidden":!u&&!d,onClick(){c.closeToast(l.id)},onFocus(){f(!0)},onBlur(){f(!1)}},s,p]})}),ht=k.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a,nativeButton:o=!0,...s}=e,{toast:c}=Ge(),l=c.actionProps?.children??s.children,{getButtonProps:u,buttonRef:d}=te({disabled:a,native:o}),f={type:c.type},p=fe(`button`,e,{ref:[t,d],state:f,props:[s,c.actionProps,u,{children:l}]});return lt(p)?p:null}),gt=k.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=he({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,j.jsxs)(k.Fragment,{children:[l,c&&Ue.createPortal(n,c)]})}),_t=k.forwardRef(function(e,t){return(0,j.jsx)(gt,{ref:t,...e})});function vt(){let e=Me(),t=e.useState(`toasts`);return k.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function yt(){let e=new Set;function t(t){e.forEach(e=>e(t))}return{" subscribe":function(t){return e.add(t),()=>{e.delete(t)}},add(e){let n=e.id||Pe(`toast`);return t({action:`add`,options:{...e,id:n,transitionStatus:`starting`}}),n},close(e){t({action:`close`,options:{id:e}})},update(e,n){t({action:`update`,options:{id:e,updates:n}})},promise(e,n){let r=e;return t({action:`promise`,options:{...n,promise:e,setPromise(e){r=e}}}),r}}}var bt={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};bt.node;var xt=f(bt),St={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};St.node;var Ct=f(St),wt={name:`octagon-x`,size:24,node:[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-octagon`]};wt.node;var Tt=f(wt),Et={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};Et.node;var Dt=f(Et),Ot=yt();function kt({...e}){return(0,j.jsx)(ze,{...e})}function At({...e}){return(0,j.jsx)(_t,{"data-slot":`toast-portal`,...e})}function jt({className:e,...t}){return(0,j.jsx)(He,{"data-slot":`toast-viewport`,className:a(`pointer-events-none fixed inset-x-4 bottom-4 z-50 mx-auto w-auto max-w-sm outline-none sm:right-4 sm:left-auto sm:mx-0 sm:w-full`,e),...t})}function Mt({className:e,...t}){return(0,j.jsx)(ot,{"data-slot":`toast`,className:a(`group/toast pointer-events-auto absolute right-0 bottom-0 z-[calc(1000-var(--toast-index))] w-full origin-bottom rounded-2xl! border bg-popover text-popover-foreground shadow-lg will-change-transform outline-none select-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`[--gap:0.75rem] [--height:var(--toast-frontmost-height,var(--toast-height))] [--offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))] [--peek:0.75rem] [--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))]`,`h-(--height) [transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))] [transition:transform_500ms_cubic-bezier(0.22,1,0.36,1),opacity_500ms,height_150ms]`,`after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']`,`data-expanded:h-(--toast-height) data-expanded:[transform:translateX(var(--toast-swipe-movement-x))_translateY(var(--offset-y))]`,`data-limited:opacity-0 data-starting-style:[transform:translateY(150%)]`,`[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]`,`data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]`,`data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]`,`data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]`,`data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]`,`data-expanded:data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]`,`data-expanded:data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]`,`data-expanded:data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]`,`data-expanded:data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]`,e),...t})}function Nt({className:e,...t}){return(0,j.jsx)(st,{"data-slot":`toast-content`,className:a(`flex h-full items-center gap-3 overflow-hidden p-4 transition-opacity duration-250 ease-[cubic-bezier(0.22,1,0.36,1)] data-behind:opacity-0 data-expanded:opacity-100`,e),...t})}function Pt({className:e,...t}){return(0,j.jsx)(pt,{"data-slot":`toast-title`,className:a(`text-sm font-medium`,e),...t})}function Ft({className:e,...t}){return(0,j.jsx)(ft,{"data-slot":`toast-description`,className:a(`text-sm text-muted-foreground`,e),...t})}function It({className:e,render:t=(0,j.jsx)(we,{variant:`outline`,size:`sm`}),...n}){return(0,j.jsx)(ht,{"data-slot":`toast-action`,render:t,className:a(`shrink-0`,e),...n})}function Lt({className:e,children:t,render:n=(0,j.jsx)(we,{variant:`ghost`,size:`icon-sm`}),...r}){return(0,j.jsx)(mt,{"data-slot":`toast-close`,"aria-label":`Close toast`,render:n,className:a(`relative shrink-0 text-muted-foreground after:absolute after:-inset-2 after:content-[''] hover:text-foreground`,e),...r,children:t??(0,j.jsx)(Dt,{"aria-hidden":`true`})})}function Rt({type:e}){let t=null;return e===`success`&&(t=(0,j.jsx)(xt,{"aria-hidden":`true`})),e===`info`&&(t=(0,j.jsx)(Ct,{"aria-hidden":`true`})),e===`warning`&&(t=(0,j.jsx)(Ae,{"aria-hidden":`true`})),e===`error`&&(t=(0,j.jsx)(Tt,{className:`text-destructive`,"aria-hidden":`true`})),e===`loading`&&(t=(0,j.jsx)(ve,{className:`animate-spin`,"aria-hidden":`true`})),t?(0,j.jsx)(`span`,{"data-slot":`toast-icon`,className:`shrink-0 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,children:t}):null}function zt(){let{toasts:e}=vt();return e.map(e=>(0,j.jsx)(Mt,{toast:e,children:(0,j.jsxs)(Nt,{children:[(0,j.jsx)(Rt,{type:e.type}),(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,j.jsx)(Pt,{}),(0,j.jsx)(Ft,{})]}),(0,j.jsx)(It,{}),(0,j.jsx)(Lt,{})]})},e.id))}function Bt({children:e,toastManager:t=Ot,...n}){return(0,j.jsxs)(kt,{toastManager:t,...n,children:[e,(0,j.jsx)(At,{children:(0,j.jsx)(jt,{children:(0,j.jsx)(zt,{})})})]})}var Vt=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Ht=/^0(?:\.0+)?%?$/;function Ut(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function Wt(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;let n=t[1],r,i=1;return n.length===3?r=n.split(``).map(e=>e+e).join(``):n.length===6?r=n:(r=n.slice(0,6),i=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),i]}function M(e){if(e==null)return null;let t=Wt(e);if(t==null)return null;let n=t[0]/255,r=t[1]/255,i=t[2]/255,a=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*a(n)+.7152*a(r)+.0722*a(i)}function Gt(e,t){let[n,r]=e>t?[e,t]:[t,e];return(n+.05)/(r+.05)}function Kt(e,t){if(t==null)return;let n=Wt(e),r=Wt(t);if(n==null||r==null)return;let[i,a,o,s]=n,[c,l,u]=r;return`#`+[Math.round(i*s+c*(1-s)),Math.round(a*s+l*(1-s)),Math.round(o*s+u*(1-s))].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function qt(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||Vt.test(t))return!0;let n=Ut(t);return n!=null&&Ht.test(n)}function Jt(e,t){let n=M(e);if(n!=null)return n<.4;let r=M(t);return r!=null&&r>.6}function Yt(e,t){if(e==null||t==null)return!1;if(e.trim().toLowerCase()===t.trim().toLowerCase())return!0;let n=M(e),r=M(t);return n==null||r==null?!1:Math.abs(n-r)<.06}function Xt(e,t,n){if(t==null||n==null)return!1;let r=M(e),i=M(t),a=M(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}function Zt(e,t){let n=M(e),r=t.find(e=>e!=null&&e!==``);if(n==null)return r;let i,a=-1;for(let e of t){if(e==null||e===``)continue;let t=M(e);if(t==null)continue;let r=Gt(n,t);if(r>=3)return e;r>a&&(i=e,a=r)}return i??r}function Qt(e,t){if(t==null)return e;let n=Wt(e),r=Wt(t),i=M(t);if(n==null||r==null||i==null)return`color-mix(in srgb, ${e} 70%, ${t})`;let[a,o,s]=n,[c,l,u]=r;for(let e of[.6,.7,.8,.9]){let t=`#`+[Math.round(a*e+c*(1-e)),Math.round(o*e+l*(1-e)),Math.round(s*e+u*(1-e))].map(e=>e.toString(16).padStart(2,`0`)).join(``),n=M(t);if(n!=null&&Gt(i,n)>=4.5)return t}return e}var $t=new WeakMap;function en(e){let t=$t.get(e);if(t!=null)return t;let n=e.colors??{},r={...n},i=n[`editor.background`]??e.bg,a=n[`editor.foreground`]??e.fg,o=n[`sideBar.background`]??i,s=n[`sideBar.foreground`]??a;tn(r,`editor.background`,i),tn(r,`editor.foreground`,a),tn(r,`sideBar.background`,o),tn(r,`sideBar.foreground`,s),tn(r,`input.background`,n[`input.background`]??o),tn(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),tn(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),tn(r,`gitDecoration.addedResourceForeground`,nn(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),tn(r,`gitDecoration.modifiedResourceForeground`,nn(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),tn(r,`gitDecoration.deletedResourceForeground`,nn(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(qt(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(qt(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(rn(l,o)||Xt(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return $t.set(e,u),u}function tn(e,t,n){n!=null&&n!==``&&(e[t]=n)}function nn(...e){for(let t of e)if(t!=null&&t!==``)return t}function rn(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function an(e){return e instanceof Error?e.message:`This file could not be loaded. Try again.`}function on(e){return e instanceof Error&&e.name===`ConnectionError`?e.message:`This review surface could not be loaded. Try again.`}function sn(e){let t=(0,k.useRef)(e);return(0,k.useInsertionEffect)(()=>void(t.current=e)),(0,k.useCallback)((...e)=>t.current(...e),[])}var cn=(0,k.createContext)(void 0);function ln({children:e,createEditor:t}){let n=sn((e,n,r)=>t(e,n,r));return(0,j.jsx)(cn.Provider,{value:n,children:e})}function un(){return(0,k.useContext)(cn)}var dn={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},fn={display:`contents`};function pn(){return null}var mn=`diffs-container`,hn=(()=>{try{return!1}catch{return!1}})(),gn=/(?=^From [a-f0-9]+ .+$)/m,_n=/(?=^diff --git)/gm,vn=/(?<=\n)/,yn=/^(---|\+\+\+)\s+([^\t\r\n]+)/,bn=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,xn=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Sn=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Cn=`header-prefix`,wn=`header-filename-suffix`,Tn=`header-metadata`,En=`header-custom`,Dn={dark:`pierre-dark`,light:`pierre-light`},On=`data-theme-css`,kn=`data-unsafe-css`,An=`data-diffs-scrollbar-measure`,jn=`data-diffs-code-view-header`,Mn=`data-diffs-code-view-footer`,Nn=`--diffs-scrollbar-gutter-measured`,Pn=1e5,Fn={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},In={...Fn,hunkLineCount:1},Ln={paddingTop:8,paddingBottom:8,gap:8},Rn={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},zn=Object.freeze({fromStart:0,fromEnd:0}),Bn={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Vn={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function Hn(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function Un(e,t){return e-(t===0?0:1)}function Wn(e,t){return Un(e,t)+t}function Gn({file:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,lineAnnotations:o,renderGutterUtility:s,getHoveredLine:c,getAnnotationSlotName:l=Hn}){let u=t?.(e),d=n?.(e),f=r?.(e),p=i?.(e);return(0,j.jsxs)(j.Fragment,{children:[u==null?(0,j.jsxs)(j.Fragment,{children:[d!=null&&(0,j.jsx)(`div`,{slot:`header-prefix`,children:d}),f!=null&&(0,j.jsx)(`div`,{slot:`header-filename-suffix`,children:f}),p!=null&&(0,j.jsx)(`div`,{slot:`header-metadata`,children:p})]}):(0,j.jsx)(`div`,{slot:En,children:u}),a!=null&&o?.map((e,t)=>(0,j.jsx)(`div`,{slot:l(e),children:a(e)},t)),s!=null&&(0,j.jsx)(`div`,{slot:`gutter-utility-slot`,style:dn,children:s(c)})]})}var Kn=new Map,qn=new Map,Jn=new Map,Yn=new Set;function Xn(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!Yn.has(t))return!1;return!0}function Zn(e=Dn){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}var Qn=new Set;function $n(e){let t=[],n=new Set;for(let r of er(e.themes)){let e=rr(r)?r.getThemes():[r];for(let r of e){if(n.has(r.name))throw Error(`Theme collection already contains theme "${r.name}"`);n.add(r.name),t.push(r)}}let r=Object.freeze([...t]),i=Object.freeze(r.filter(e=>e.colorScheme===`light`)),a=Object.freeze(r.filter(e=>e.colorScheme===`dark`)),o=new Map(r.map(e=>[e.name,e])),s=Object.freeze(r.map(e=>e.name)),c=Object.freeze(i.map(e=>e.name)),l=Object.freeze(a.map(e=>e.name));function u(e){if(e==null)return r;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?i:t===`dark`?a:r:r.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return o.get(e)},getThemes(e){return u(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?c:e?.colorScheme===`dark`?l:s:u(e).map(e=>e.name)},hasTheme(e){return o.has(e)},orderBy(e){return $n({themes:r.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],n=new Set;for(let r of e){if(n.has(r))throw Error(`Theme collection pick already includes theme "${r}"`);n.add(r);let e=o.get(r);if(e==null)throw Error(`Theme collection does not contain theme "${r}"`);t.push(e)}return $n({themes:t})},registerInto(e){for(let t of r)e.registerThemeIfAbsent(t.name,t.load)}}}function er(e){return tr(e)?[e]:e}function tr(e){return rr(e)||nr(e)}function nr(e){return typeof e.name==`string`&&typeof e.load==`function`}function rr(e){return typeof e.getThemes==`function`}function ir(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var ar=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},or=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},sr=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function cr(){let e=new Map,t=new Map,n=new Map,r=0;function i(t,n){if(e.has(t))throw new ar(t);e.set(t,n)}function a(t,n){return!e.has(t)&&(e.set(t,n),!0)}function o(t){return e.has(t)}function s(i){let a=t.get(i);if(a!==void 0)return Promise.resolve(a);let o=n.get(i);if(o!==void 0)return o;let s=e.get(i);if(s===void 0)return Promise.reject(new or(i));let c=r,l=s().then(e=>{let a=ir(e);return c===r&&t.set(i,a),n.get(i)===l&&n.delete(i),a}).catch(e=>{throw n.get(i)===l&&n.delete(i),e});return n.set(i,l),l}function c(e){return Promise.all(e.map(e=>s(e)))}function l(e,n){t.set(e,n)}function u(e){for(let[t,n]of e)l(t,n)}function d(e){return t.get(e)}function f(e){let n=[];for(let r of e){let e=t.get(r);if(e===void 0)throw new sr(r);n.push(e)}return n}function p(e){return t.has(e)}function m(e){for(let n of e)if(!t.has(n))return!1;return!0}function h(e){let n=t.get(e);return n===void 0?s(e):n}function g(){r++,t.clear(),n.clear()}return{clearResolvedThemes:g,getResolvedOrResolveTheme:h,getResolvedTheme:d,getResolvedThemes:f,hasRegisteredTheme:o,hasResolvedTheme:p,hasResolvedThemes:m,registerTheme:i,registerThemeIfAbsent:a,resolveTheme:s,resolveThemes:c,seedResolvedTheme:l,seedResolvedThemes:u}}var lr=cr();function ur(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=lr.getResolvedTheme(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,lr.getResolvedTheme(n)??lr.seedResolvedTheme(n,e);Qn.has(n)||(Qn.add(n),t.loadThemeSync(e))}}function dr(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(Yn.has(n.name))continue;let e=Kn.get(n.name);e??(e=n,Kn.set(n.name,e)),Yn.add(e.name),t.loadLanguageSync(e.data)}}function fr(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var pr=Object.defineProperty,mr=Object.getOwnPropertyDescriptor,hr=Object.getOwnPropertyNames,gr=Object.prototype.hasOwnProperty,_r=(e,t)=>{let n={};for(var r in e)pr(n,r,{get:e[r],enumerable:!0});return t||pr(n,Symbol.toStringTag,{value:`Module`}),n},vr=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=hr(t),a=0,o=i.length,s;a<o;a++)s=i[a],!gr.call(e,s)&&s!==n&&pr(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=mr(t,s))||r.enumerable});return e},yr=(e,t,n)=>(vr(e,t,`default`),n&&vr(n,t,`default`)),br=[{id:`abap`,name:`ABAP`,import:(()=>O(()=>import(`./abap-CLvhMVsD.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,aliases:[`actionscript`,`as3`],import:(()=>O(()=>import(`./actionscript-3-Cs6JJXT5.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>O(()=>import(`./ada-C5qYipkI.js`),[]))},{id:`ahk`,name:`AutoHotkey`,aliases:[`ahk1`],import:(()=>O(()=>import(`./ahk-CA9gdOdF.js`),[]))},{id:`ahk2`,name:`AutoHotkey2`,import:(()=>O(()=>import(`./ahk2-_6rzW9BS.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>O(()=>import(`./angular-html-B8mrqUL5.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3,4])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>O(()=>import(`./angular-ts-Bzix210W.js`),__vite__mapDeps([5,0,1,2,3,4,6])))},{id:`apache`,name:`Apache Conf`,import:(()=>O(()=>import(`./apache-U0d_L8uA.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>O(()=>import(`./apex-KFGFyKwG.js`),[]))},{id:`apl`,name:`APL`,import:(()=>O(()=>import(`./apl-Dhin1L29.js`),__vite__mapDeps([7,3,1,4,2,8,9,10])))},{id:`applescript`,name:`AppleScript`,import:(()=>O(()=>import(`./applescript-CCn79oCD.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>O(()=>import(`./ara-4CJ0cIlV.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>O(()=>import(`./asciidoc-SCjQUq34.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>O(()=>import(`./asm-Cmm7eHzH.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>O(()=>import(`./astro-B-4NNgOP.js`),__vite__mapDeps([11,3,1,4,10,12,13,14])))},{id:`awk`,name:`AWK`,import:(()=>O(()=>import(`./awk-BWXHIvNe.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>O(()=>import(`./ballerina-B7ZEbQpA.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`,`cmd`],import:(()=>O(()=>import(`./bat-qdxAdBWQ.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>O(()=>import(`./beancount-D-usSTwE.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>O(()=>import(`./berry-DKpUyyne.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>O(()=>import(`./bibtex-Ci_nEsc7.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>O(()=>import(`./bicep-CUHmPFLl.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>O(()=>import(`./bird2-CYIUgYqB.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>O(()=>import(`./blade-C6Gedziy.js`),__vite__mapDeps([15,3,1,4,2,8,9,10,16,17])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>O(()=>import(`./bsl-_VjlB9mv.js`),__vite__mapDeps([18,19])))},{id:`c`,name:`C`,import:(()=>O(()=>import(`./c-iCihek07.js`).then(e=>e.n),__vite__mapDeps([20,1])))},{id:`c3`,name:`C3`,import:(()=>O(()=>import(`./c3-D0apG41V.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>O(()=>import(`./cadence-CQ2zXKGN.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>O(()=>import(`./cairo-DLTphjLi.js`),__vite__mapDeps([21,22])))},{id:`chapel`,name:`Chapel`,aliases:[`chpl`],import:(()=>O(()=>import(`./chapel-DmtgEXO_.js`),__vite__mapDeps([23,20,1])))},{id:`clarity`,name:`Clarity`,import:(()=>O(()=>import(`./clarity-CtfBBspg.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>O(()=>import(`./clojure-DqKBuwfJ.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>O(()=>import(`./cmake-Bj61d0ZC.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>O(()=>import(`./cobol-Cw2-KvLW.js`),__vite__mapDeps([24,2,1,3,4,9])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>O(()=>import(`./codeowners-C8r90Shi.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>O(()=>import(`./codeql-oeQT6MSM.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>O(()=>import(`./coffee-CiiSLhB6.js`),__vite__mapDeps([25,3,1])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>O(()=>import(`./common-lisp-Cv5bFMCO.js`),[]))},{id:`coq`,name:`Rocq`,import:(()=>O(()=>import(`./coq-DuBRPxYg.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>O(()=>import(`./cpp-71xkOQct.js`).then(e=>e.n),__vite__mapDeps([26,1,27,28,20])))},{id:`crystal`,name:`Crystal`,import:(()=>O(()=>import(`./crystal-DGPAtLeY.js`),__vite__mapDeps([29,3,1,4,2,17,20,30])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>O(()=>import(`./csharp-oqKa8noW.js`),[]))},{id:`css`,name:`CSS`,import:(()=>O(()=>import(`./css-CNuuLpMC.js`).then(e=>e.n),__vite__mapDeps([4,1])))},{id:`csv`,name:`CSV`,import:(()=>O(()=>import(`./csv-Dx-8-gkx.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>O(()=>import(`./cue-CE9AQfxI.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>O(()=>import(`./cypher-ClKdZ_lG.js`),[]))},{id:`d`,name:`D`,import:(()=>O(()=>import(`./d-qD-0Kul2.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>O(()=>import(`./dart-CnvKMtbv.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>O(()=>import(`./dax-BkyTk9wS.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>O(()=>import(`./desktop-Dlh5hvp9.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>O(()=>import(`./diff-woXpYk--.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>O(()=>import(`./docker-IyjqRm3v.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>O(()=>import(`./dotenv-_5a1GRtc.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>O(()=>import(`./dream-maker-DW3nJb8Q.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>O(()=>import(`./edge-DCY0a-ow.js`),__vite__mapDeps([31,2,1,3,4,12,16])))},{id:`elixir`,name:`Elixir`,import:(()=>O(()=>import(`./elixir-DP304Xio.js`),__vite__mapDeps([32,2,1,3,4])))},{id:`elm`,name:`Elm`,import:(()=>O(()=>import(`./elm-o4NJxfws.js`),__vite__mapDeps([33,28,1,20])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>O(()=>import(`./emacs-lisp-c_oH4hRZ.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>O(()=>import(`./erb-C7MPl934.js`),__vite__mapDeps([34,2,1,3,4,35,8,9,17,20,26,27,28,30,36,37,12,14,38,39,40])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>O(()=>import(`./erlang-Cphh6RMH.js`),__vite__mapDeps([41,42])))},{id:`fennel`,name:`Fennel`,import:(()=>O(()=>import(`./fennel-DQxkIbk2.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>O(()=>import(`./fish-BJitypiv.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>O(()=>import(`./fluent-C03EYrpw.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>O(()=>import(`./fortran-fixed-form-DEKoE2YW.js`),__vite__mapDeps([43,44])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>O(()=>import(`./fortran-free-form-CYNrtFtB.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>O(()=>import(`./fsharp-D13ZGOAj.js`),__vite__mapDeps([45,42])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>O(()=>import(`./gdresource-xMC7jr7x.js`),__vite__mapDeps([46,47,48])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>O(()=>import(`./gdscript-DYvRD3hg.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>O(()=>import(`./gdshader-CBce3t8t.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>O(()=>import(`./genie-CV2tkWYe.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>O(()=>import(`./gherkin-DExj1W_8.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>O(()=>import(`./git-commit-BSykSTBG.js`),__vite__mapDeps([49,50])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>O(()=>import(`./git-rebase-BDPpS8w6.js`),__vite__mapDeps([51,30,1])))},{id:`gleam`,name:`Gleam`,import:(()=>O(()=>import(`./gleam-CSRkHgEL.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>O(()=>import(`./glimmer-js-BONyzAsu.js`),__vite__mapDeps([52,3,1,4,2,12])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>O(()=>import(`./glimmer-ts-f9c0GCOe.js`),__vite__mapDeps([53,3,1,4,2,12])))},{id:`glsl`,name:`GLSL`,import:(()=>O(()=>import(`./glsl-D5MA2a_X.js`).then(e=>e.n),__vite__mapDeps([28,1,20])))},{id:`gn`,name:`GN`,import:(()=>O(()=>import(`./gn-ilITqXS6.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>O(()=>import(`./gnuplot-7GGW24-e.js`),[]))},{id:`go`,name:`Go`,import:(()=>O(()=>import(`./go-rLFTqkRN.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>O(()=>import(`./graphql-Ctjuxyvl.js`).then(e=>e.n),__vite__mapDeps([37,1,3,12,14,38])))},{id:`groovy`,name:`Groovy`,import:(()=>O(()=>import(`./groovy-CacY0gHj.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>O(()=>import(`./hack-Dh_ZLRbs.js`),__vite__mapDeps([54,2,1,3,4,17])))},{id:`haml`,name:`Ruby Haml`,import:(()=>O(()=>import(`./haml-CwEpbK1d.js`).then(e=>e.n),__vite__mapDeps([36,1,3,4])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>O(()=>import(`./handlebars-ryMP1rBR.js`),__vite__mapDeps([55,3,1,4,2,40])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>O(()=>import(`./haskell-D8IpX4py.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>O(()=>import(`./haxe-C8oCnwJJ.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>O(()=>import(`./hcl-Dh228itO.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>O(()=>import(`./hjson-CxZEssPk.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>O(()=>import(`./hlsl-Cvrh5tZx.js`),[]))},{id:`html`,name:`HTML`,import:(()=>O(()=>import(`./html-XwrE-1r6.js`).then(e=>e.n),__vite__mapDeps([2,1,3,4])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>O(()=>import(`./html-derivative-i4STDFnl.js`),__vite__mapDeps([16,2,1,3,4])))},{id:`http`,name:`HTTP`,import:(()=>O(()=>import(`./http-kmH8AyfE.js`),__vite__mapDeps([56,8,1,9,10,30,37,3,12,14,38])))},{id:`hurl`,name:`Hurl`,import:(()=>O(()=>import(`./hurl-DCZHXKU4.js`),__vite__mapDeps([57,8,1,9,58,37,3,12,14,38])))},{id:`hxml`,name:`HXML`,import:(()=>O(()=>import(`./hxml-Dcm88srW.js`),__vite__mapDeps([59,60])))},{id:`hy`,name:`Hy`,import:(()=>O(()=>import(`./hy-CZbG8q4J.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>O(()=>import(`./imba-DsUTQ-LC.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>O(()=>import(`./ini-B5eOa1yu.js`),[]))},{id:`java`,name:`Java`,import:(()=>O(()=>import(`./java-DdHNQ9hk.js`).then(e=>e.n),__vite__mapDeps([9,1])))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>O(()=>import(`./javascript-obGGvMPs.js`).then(e=>e.n),__vite__mapDeps([3,1])))},{id:`jinja`,name:`Jinja`,import:(()=>O(()=>import(`./jinja-B-tLrNsM.js`),__vite__mapDeps([61,2,1,3,4])))},{id:`jison`,name:`Jison`,import:(()=>O(()=>import(`./jison-CBjhYtSs.js`),__vite__mapDeps([62,3,1])))},{id:`json`,name:`JSON`,import:(()=>O(()=>import(`./json-DAgxKhMr.js`).then(e=>e.n),__vite__mapDeps([10,1])))},{id:`json5`,name:`JSON5`,import:(()=>O(()=>import(`./json5-BR5RXkoi.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>O(()=>import(`./jsonc-CYpm1nAK.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>O(()=>import(`./jsonl-CmCQp5Yx.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>O(()=>import(`./jsonnet-CJTPZ8u_.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>O(()=>import(`./jssm-DXw9l8Rf.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>O(()=>import(`./jsx-gTgmArGx.js`).then(e=>e.n),__vite__mapDeps([38,1])))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>O(()=>import(`./julia-CXJVy74_.js`),__vite__mapDeps([63,3,1,17,22,26,27,28,20,64])))},{id:`just`,name:`Just`,aliases:[`justfile`],import:(()=>O(()=>import(`./just-B9Xn_Dp4.js`),__vite__mapDeps([65,3,1,12,22,30,35,4,2,8,9,17,20,26,27,28,36,37,14,38,39,40,66])))},{id:`kdl`,name:`KDL`,import:(()=>O(()=>import(`./kdl-CsD5j6eV.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>O(()=>import(`./kotlin-DhhofPvG.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>O(()=>import(`./kusto-C7mF5XQf.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>O(()=>import(`./latex-o9DRzaEe.js`),__vite__mapDeps([67,68,1,64])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>O(()=>import(`./lean-CewbzKMR.js`),[]))},{id:`less`,name:`Less`,import:(()=>O(()=>import(`./less-DVTAwKKz.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>O(()=>import(`./liquid-G0MH4h_m.js`),__vite__mapDeps([69,3,1,4,2,10])))},{id:`llvm`,name:`LLVM IR`,import:(()=>O(()=>import(`./llvm-DqHOMS-s.js`),[]))},{id:`log`,name:`Log file`,import:(()=>O(()=>import(`./log-BNLmms1o.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>O(()=>import(`./logo-Cluzi2Zq.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>O(()=>import(`./lua-FONpmTUP.js`).then(e=>e.n),__vite__mapDeps([39,1,20])))},{id:`luau`,name:`Luau`,import:(()=>O(()=>import(`./luau-C2pBCSgt.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>O(()=>import(`./make-Dixweg8N.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>O(()=>import(`./markdown-BYOwaDjH.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>O(()=>import(`./marko-DV5GrDmo.js`),__vite__mapDeps([70,4,1,6,12,71])))},{id:`matlab`,name:`MATLAB`,import:(()=>O(()=>import(`./matlab-D7qyCx1q.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>O(()=>import(`./mdc-BKfPFPZw.js`),__vite__mapDeps([72,16,2,1,3,4,40,42])))},{id:`mdx`,name:`MDX`,import:(()=>O(()=>import(`./mdx-DQZ5AkYe.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>O(()=>import(`./mermaid-BxpfTIzt.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>O(()=>import(`./mipsasm-BMqwQI7S.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>O(()=>import(`./mojo-fg40_ntQ.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>O(()=>import(`./moonbit-DgjMoLWr.js`),[]))},{id:`move`,name:`Move`,import:(()=>O(()=>import(`./move-BYnGhZoM.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>O(()=>import(`./narrat-_X_XdTYD.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>O(()=>import(`./nextflow-BJtWHP5T.js`),__vite__mapDeps([73,74])))},{id:`nextflow-groovy`,name:`Nextflow Groovy`,import:(()=>O(()=>import(`./nextflow-groovy-DJMQeKeT.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>O(()=>import(`./nginx-BTMw9COX.js`),__vite__mapDeps([75,39,1,20])))},{id:`nim`,name:`Nim`,import:(()=>O(()=>import(`./nim-B6yJ_yaC.js`),__vite__mapDeps([76,3,1,4,2,8,9,20,28,42])))},{id:`nix`,name:`Nix`,import:(()=>O(()=>import(`./nix-IvuFDN5E.js`),[]))},{id:`nsis`,name:`NSIS`,import:(()=>O(()=>import(`./nsis-CjNLYCLg.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>O(()=>import(`./nushell-DHYfO66s.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>O(()=>import(`./objective-c-D1A_Heim.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>O(()=>import(`./objective-cpp-BsSzOQcm.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>O(()=>import(`./ocaml-O90oeIOV.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>O(()=>import(`./odin-B1RWQWA5.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>O(()=>import(`./openscad-BUDT5pXO.js`),[]))},{id:`org`,name:`Org Markup`,import:(()=>O(()=>import(`./org-Ddi8Gs6E.js`),__vite__mapDeps([77,3,1,4,2,6,9,8,10,12,14,17,20,22,78,25,27,26,28,30,79,80,50,81,32,39,40,35,36,37,38,42,41,49,51,82,83,84,64,66,67,68,71,85,76,86,87,88,89,90,91,92,93,94])))},{id:`pascal`,name:`Pascal`,import:(()=>O(()=>import(`./pascal-4ZHwLPI5.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>O(()=>import(`./perl-DEgXgjuC.js`),__vite__mapDeps([66,3,1,4,2,8,9,17])))},{id:`php`,name:`PHP`,import:(()=>O(()=>import(`./php-B9UPq-vz.js`),__vite__mapDeps([88,3,1,4,2,8,9,10,17])))},{id:`pkl`,name:`Pkl`,import:(()=>O(()=>import(`./pkl-ot-7Btpt.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>O(()=>import(`./plsql-DGHpHOYJ.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>O(()=>import(`./po-BiJDBrnU.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>O(()=>import(`./polar-C7UOKdEL.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>O(()=>import(`./postcss-BXeXVLqQ.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>O(()=>import(`./powerquery-DNMTfnFr.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`,`pwsh`],import:(()=>O(()=>import(`./powershell-CCSX75yM.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>O(()=>import(`./prisma-DMgNhnYS.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>O(()=>import(`./prolog-iXnhIJG7.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>O(()=>import(`./proto-DB4EqR-F.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>O(()=>import(`./pug-DkgDHZci.js`),__vite__mapDeps([95,3,1,4,2])))},{id:`puppet`,name:`Puppet`,import:(()=>O(()=>import(`./puppet-CDv2pdJW.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>O(()=>import(`./purescript-9MfHhQsQ.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>O(()=>import(`./python-gzcpVVnB.js`),[]))},{id:`qml`,name:`QML`,import:(()=>O(()=>import(`./qml-_a-QhfPD.js`),__vite__mapDeps([96,3,1])))},{id:`qmldir`,name:`QML Directory`,import:(()=>O(()=>import(`./qmldir-DCQb3MpD.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>O(()=>import(`./qss-Fe1Jh2GI.js`),[]))},{id:`r`,name:`R`,import:(()=>O(()=>import(`./r-BHcO8Vjq.js`).then(e=>e.n),__vite__mapDeps([64,1])))},{id:`racket`,name:`Racket`,import:(()=>O(()=>import(`./racket-DcIDlBhZ.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>O(()=>import(`./raku-B3gFvitq.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>O(()=>import(`./razor-BMJ0eI3p.js`),__vite__mapDeps([97,2,1,3,4,79])))},{id:`rbs`,name:`RBS`,aliases:[`ruby-signature`],import:(()=>O(()=>import(`./rbs-C0MpOrj4.js`),[]))},{id:`reg`,name:`Windows Registry Script`,import:(()=>O(()=>import(`./reg-CRGYupPL.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>O(()=>import(`./regexp-DR20uMnK.js`).then(e=>e.n),__vite__mapDeps([27,1])))},{id:`rel`,name:`Rel`,import:(()=>O(()=>import(`./rel-BtDbiS_P.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>O(()=>import(`./riscv-Ckw8ddFX.js`),[]))},{id:`ron`,name:`RON`,import:(()=>O(()=>import(`./ron-VUp2lXgN.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>O(()=>import(`./rosmsg-CAekHB0j.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>O(()=>import(`./rst-BQCbfb9V.js`),__vite__mapDeps([98,3,1,16,2,4,22,99,26,27,28,20,30,40,35,8,9,17,36,37,12,14,38,39])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>O(()=>import(`./ruby-B8JcIHv0.js`),__vite__mapDeps([35,3,1,4,2,8,9,17,20,26,27,28,30,36,37,12,14,38,39,40])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>O(()=>import(`./rust-Cfkwpbl8.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>O(()=>import(`./sas-CBpMWA2M.js`),__vite__mapDeps([100,17,1])))},{id:`sass`,name:`Sass`,import:(()=>O(()=>import(`./sass-DXrisJhu.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>O(()=>import(`./scala-BiFt_7mu.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>O(()=>import(`./scheme-DQCgrYNe.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>O(()=>import(`./scss-YesllqfO.js`).then(e=>e.n),__vite__mapDeps([6,1,4])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>O(()=>import(`./sdbl-bTVj8UrX.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>O(()=>import(`./shaderlab-TOUzSsQk.js`),__vite__mapDeps([101,102])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>O(()=>import(`./shellscript-Da78Ox-3.js`).then(e=>e.n),__vite__mapDeps([30,1])))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>O(()=>import(`./shellsession-CVsQGYfZ.js`),__vite__mapDeps([103,30,1])))},{id:`smalltalk`,name:`GNU Smalltalk`,import:(()=>O(()=>import(`./smalltalk-BHpQb5nM.js`),[]))},{id:`smithy`,name:`Smithy`,import:(()=>O(()=>import(`./smithy-Dgaz7aur.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>O(()=>import(`./solidity-Bj7E1mRn.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>O(()=>import(`./soy-DEd-qcad.js`),__vite__mapDeps([104,2,1,3,4])))},{id:`sparql`,name:`SPARQL`,import:(()=>O(()=>import(`./sparql-D_iOobhT.js`),__vite__mapDeps([105,106])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>O(()=>import(`./splunk-BC2Px7Mm.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>O(()=>import(`./sql-DdD7vxS4.js`).then(e=>e.n),__vite__mapDeps([17,1])))},{id:`ssh-config`,name:`SSH Config`,import:(()=>O(()=>import(`./ssh-config-BgfXC-Er.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>O(()=>import(`./stata-CMv7m7Gi.js`),__vite__mapDeps([107,17,1])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>O(()=>import(`./stylus-B6D30XZt.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>O(()=>import(`./surrealql-BZoq2lXR.js`),__vite__mapDeps([108,3,1])))},{id:`svelte`,name:`Svelte`,import:(()=>O(()=>import(`./svelte-Bj3Hmc9F.js`),__vite__mapDeps([109,3,1,4,12,13])))},{id:`swift`,name:`Swift`,import:(()=>O(()=>import(`./swift-CyEgAFGc.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>O(()=>import(`./system-verilog-Dh5ihWbf.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>O(()=>import(`./systemd-BxMlprV5.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>O(()=>import(`./talonscript-CohzipZa.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>O(()=>import(`./tasl-DMoTqEGO.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>O(()=>import(`./tcl-CZd0xW_V.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>O(()=>import(`./templ-TjxbArHn.js`),__vite__mapDeps([110,3,1,4,82])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>O(()=>import(`./terraform-DswuEJGm.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>O(()=>import(`./tex-BK-H2Wn4.js`).then(e=>e.n),__vite__mapDeps([68,1,64])))},{id:`toml`,name:`TOML`,import:(()=>O(()=>import(`./toml-CcmNWLt0.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>O(()=>import(`./ts-tags-Cc5do7zu.js`),__vite__mapDeps([111,3,1,4,2,8,9,12,17,28,20])))},{id:`tsv`,name:`TSV`,import:(()=>O(()=>import(`./tsv-sltzmVWM.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>O(()=>import(`./tsx-CUOciP0b.js`).then(e=>e.n),__vite__mapDeps([14,1])))},{id:`turtle`,name:`Turtle`,import:(()=>O(()=>import(`./turtle-ByJddavk.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>O(()=>import(`./twig-BVSnuTf-.js`),__vite__mapDeps([112,3,1,4,6,22,35,2,8,9,17,20,26,27,28,30,36,37,12,14,38,39,40,88,10])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>O(()=>import(`./typescript-BydbNFcO.js`).then(e=>e.n),__vite__mapDeps([12,1])))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>O(()=>import(`./typespec-BRdr0IET.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>O(()=>import(`./typst-C40W_gC6.js`),__vite__mapDeps([113,3,1,4,2,6,9,8,10,12,14,114,115,17,20,22,78,25,27,26,28,30,79,80,50,81,32,39,40,35,36,37,38,42,41,45,49,51,82,83,55,84,116,64,63,66,67,68,71,117,85,86,88,89,90,91,92,94,118,95,119,120,112,121])))},{id:`v`,name:`V`,import:(()=>O(()=>import(`./v-DBj4K9d_.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>O(()=>import(`./vala-zf12oZj6.js`),[]))},{id:`vb`,name:`Visual Basic`,import:(()=>O(()=>import(`./vb-DOwzaHZ0.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>O(()=>import(`./verilog-B2gwz-sJ.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>O(()=>import(`./vhdl-BroJfC0k.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>O(()=>import(`./viml-DvXPmvsu.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>O(()=>import(`./vue-BNQF7r6F.js`),__vite__mapDeps([122,3,1,4,2,10,12,16])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>O(()=>import(`./vue-html-DkKkQnZL.js`),__vite__mapDeps([123,3,1])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>O(()=>import(`./vue-vine-DFaKYU4X.js`),__vite__mapDeps([124,3,1,4,6,13,71,125])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>O(()=>import(`./vyper-CgoNMtux.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>O(()=>import(`./wasm-ByWQv1Qj.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>O(()=>import(`./wenyan-C8pVoKbM.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>O(()=>import(`./wgsl-BsKzXJz4.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>O(()=>import(`./wikitext-ClFFjSW2.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>O(()=>import(`./wit-DdvCle-K.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>O(()=>import(`./wolfram-DLL8P-h_.js`),[]))},{id:`xml`,name:`XML`,import:(()=>O(()=>import(`./xml-BlnrEAEy.js`).then(e=>e.n),__vite__mapDeps([8,1,9])))},{id:`xsl`,name:`XSL`,import:(()=>O(()=>import(`./xsl-BOPS8gLt.js`),__vite__mapDeps([94,8,1,9])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>O(()=>import(`./yaml-Du_6cdrH.js`).then(e=>e.n),__vite__mapDeps([40,1])))},{id:`zenscript`,name:`ZenScript`,import:(()=>O(()=>import(`./zenscript-BnlCZFoB.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>O(()=>import(`./zig-CMLA9XwU.js`),[]))}],xr=Object.fromEntries(br.map(e=>[e.id,e.import])),Sr=Object.fromEntries(br.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),Cr={...xr,...Sr},wr=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>O(()=>import(`./andromeeda-vGVdxbeo.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>O(()=>import(`./aurora-x-CDeNXAV0.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>O(()=>import(`./ayu-dark-DluEY0Gj.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>O(()=>import(`./ayu-light-C3h-C4tm.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>O(()=>import(`./ayu-mirage-Bqwy1Gya.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>O(()=>import(`./catppuccin-frappe-C9Q5zVZY.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>O(()=>import(`./catppuccin-latte-CtsyrtPq.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>O(()=>import(`./catppuccin-macchiato-R8nAf1vR.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>O(()=>import(`./catppuccin-mocha-DjuaAJKi.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>O(()=>import(`./dark-plus-Cs2F2srj.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>O(()=>import(`./dracula-BHWKrbxM.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>O(()=>import(`./dracula-soft-5eyTD99u.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>O(()=>import(`./everforest-dark-sB-x3p7T.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>O(()=>import(`./everforest-light-Df2xbC6M.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>O(()=>import(`./github-dark-C-LZuMrd.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>O(()=>import(`./github-dark-default-DXG-b-1a.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>O(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>O(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>O(()=>import(`./github-light-EUqPIrTm.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>O(()=>import(`./github-light-default-BXViO-2h.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>O(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>O(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>O(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>O(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>O(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>O(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>O(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>O(()=>import(`./horizon-CE9ld1lL.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`light`,import:(()=>O(()=>import(`./horizon-bright-DSNQnXHK.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>O(()=>import(`./houston-CsvMBhTu.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>O(()=>import(`./kanagawa-dragon-Bozd7klA.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>O(()=>import(`./kanagawa-lotus-BmuOG9ZW.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>O(()=>import(`./kanagawa-wave-BML5mF2J.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>O(()=>import(`./laserwave-C_8bwKvT.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>O(()=>import(`./light-plus-DVQuIRkW.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>O(()=>import(`./material-theme-Bm3Qr25_.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>O(()=>import(`./material-theme-darker-2IIEA8gg.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>O(()=>import(`./material-theme-lighter-uhdI0v04.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>O(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>O(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>O(()=>import(`./min-dark-BSWPekZh.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>O(()=>import(`./min-light-DDpmG2fV.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>O(()=>import(`./monokai-B_bV9PQ9.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>O(()=>import(`./night-owl-DhmEMT88.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>O(()=>import(`./night-owl-light-eJ-hLW7d.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>O(()=>import(`./nord-Cb4Vim4T.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>O(()=>import(`./one-dark-pro-CLwyXe_n.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>O(()=>import(`./one-light-D7Lr4KcI.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>O(()=>import(`./plastic-DQwYfKfQ.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>O(()=>import(`./poimandres-DRFjx7u4.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>O(()=>import(`./red-DX1BQOs8.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>O(()=>import(`./rose-pine-aMsaMD1D.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>O(()=>import(`./rose-pine-dawn-8PwUyIlP.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>O(()=>import(`./rose-pine-moon-DO-qXg-I.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>O(()=>import(`./slack-dark-DnToyrRv.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>O(()=>import(`./slack-ochin-B2OO5cIa.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>O(()=>import(`./snazzy-light-4G7pJPwS.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>O(()=>import(`./solarized-dark-UdsmMDCL.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>O(()=>import(`./solarized-light-C1IUL_tW.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>O(()=>import(`./synthwave-84-nFMaYfgc.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>O(()=>import(`./tokyo-night-oM2G3aXe.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>O(()=>import(`./vesper-DdrHHSXu.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>O(()=>import(`./vitesse-black-fwtXNY1n.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>O(()=>import(`./vitesse-dark-BZCL-v6S.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>O(()=>import(`./vitesse-light-VbXTXTou.js`),[]))}].map(e=>[e.id,e.import])),Tr=e({createOnigurumaEngine:()=>Zr,getDefaultWasmLoader:()=>Xr,loadWasm:()=>Wr,setDefaultWasmLoader:()=>Yr}),Er=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Dr(){return 2147483648}function Or(){return typeof performance<`u`?performance.now():Date.now()}var kr=(e,t)=>e+(t-e%t)%t;async function Ar(e){let t,n,r={};function i(e){n=e,r.HEAPU8=new Uint8Array(e),r.HEAPU32=new Uint32Array(e)}function a(e,t,n){r.HEAPU8.copyWithin(e,t,t+n)}function o(e){try{return t.grow(e-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function s(e){let t=r.HEAPU8.length;e>>>=0;let n=Dr();if(e>n)return!1;for(let r=1;r<=4;r*=2){let i=t*(1+.2/r);if(i=Math.min(i,e+100663296),o(Math.min(n,kr(Math.max(e,i),65536))))return!0}return!1}let c=typeof TextDecoder<`u`?new TextDecoder(`utf8`):void 0;function l(e,t,n=1024){let r=t+n,i=t;for(;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&c)return c.decode(e.subarray(t,i));let a=``;for(;t<i;){let n=e[t++];if(!(n&128)){a+=String.fromCharCode(n);continue}let r=e[t++]&63;if((n&224)==192){a+=String.fromCharCode((n&31)<<6|r);continue}let i=e[t++]&63;if(n=(n&240)==224?(n&15)<<12|r<<6|i:(n&7)<<18|r<<12|i<<6|e[t++]&63,n<65536)a+=String.fromCharCode(n);else{let e=n-65536;a+=String.fromCharCode(55296|e>>10,56320|e&1023)}}return a}function u(e,t){return e?l(r.HEAPU8,e,t):``}let d={emscripten_get_now:Or,emscripten_memcpy_big:a,emscripten_resize_heap:s,fd_write:()=>0};async function f(){let n=await e({env:d,wasi_snapshot_preview1:d});t=n.memory,i(t.buffer),Object.assign(r,n),r.UTF8ToString=u}return await f(),r}var jr=Object.defineProperty,Mr=(e,t,n)=>t in e?jr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,N=(e,t,n)=>Mr(e,typeof t==`symbol`?t:t+``,n),P=null;function Nr(e){throw new Er(e.UTF8ToString(e.getLastOnigError()))}var Pr=class e{constructor(t){N(this,`utf16Length`),N(this,`utf8Length`),N(this,`utf16Value`),N(this,`utf8Value`),N(this,`utf16OffsetToUtf8`),N(this,`utf8OffsetToUtf16`);let n=t.length,r=e._utf8ByteLength(t),i=r!==n,a=i?new Uint32Array(n+1):null;i&&(a[n]=r);let o=i?new Uint32Array(r+1):null;i&&(o[r]=n);let s=new Uint8Array(r),c=0;for(let e=0;e<n;e++){let r=t.charCodeAt(e),l=r,u=!1;if(r>=55296&&r<=56319&&e+1<n){let n=t.charCodeAt(e+1);n>=56320&&n<=57343&&(l=(r-55296<<10)+65536|n-56320,u=!0)}i&&(a[e]=c,u&&(a[e+1]=c),l<=127?o[c+0]=e:l<=2047?(o[c+0]=e,o[c+1]=e):l<=65535?(o[c+0]=e,o[c+1]=e,o[c+2]=e):(o[c+0]=e,o[c+1]=e,o[c+2]=e,o[c+3]=e)),l<=127?s[c++]=l:l<=2047?(s[c++]=192|(l&1984)>>>6,s[c++]=128|(l&63)>>>0):l<=65535?(s[c++]=224|(l&61440)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0):(s[c++]=240|(l&1835008)>>>18,s[c++]=128|(l&258048)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0),u&&e++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=a,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,r=e.length;n<r;n++){let i=e.charCodeAt(n),a=i,o=!1;if(i>=55296&&i<=56319&&n+1<r){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}t+=a<=127?1:a<=2047?2:a<=65535?3:4,o&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}},Fr=class e{constructor(t){if(N(this,`id`,++e.LAST_ID),N(this,`_onigBinding`),N(this,`content`),N(this,`utf16Length`),N(this,`utf8Length`),N(this,`utf16OffsetToUtf8`),N(this,`utf8OffsetToUtf16`),N(this,`ptr`),!P)throw new Er(`Must invoke loadWasm first.`);this._onigBinding=P,this.content=t;let n=new Pr(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=P.omalloc(1e4),e._sharedPtrInUse=!0,P.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(P)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};N(Fr,`LAST_ID`,0),N(Fr,`_sharedPtr`,0),N(Fr,`_sharedPtrInUse`,!1);var Ir=Fr,Lr=class{constructor(e){if(N(this,`_onigBinding`),N(this,`_ptr`),!P)throw new Er(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new Pr(e[r]);t[r]=i.createString(P),n[r]=i.utf8Length}let r=P.omalloc(4*e.length);P.HEAPU32.set(t,r/4);let i=P.omalloc(4*e.length);P.HEAPU32.set(n,i/4);let a=P.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)P.ofree(t[n]);P.ofree(i),P.ofree(r),a===0&&Nr(P),this._onigBinding=P,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let r=0;if(typeof n==`number`&&(r=n),typeof e==`string`){e=new Ir(e);let n=this._findNextMatchSync(e,t,!1,r);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,r)}_findNextMatchSync(e,t,n,r){let i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),r);if(a===0)return null;let o=i.HEAPU32,s=a/4,c=o[s++],l=o[s++],u=[];for(let t=0;t<l;t++){let n=e.convertUtf8OffsetToUtf16(o[s++]),r=e.convertUtf8OffsetToUtf16(o[s++]);u[t]={start:n,end:r,length:r-n}}return{index:c,captureIndices:u}}};function Rr(e){return typeof e.instantiator==`function`}function zr(e){return typeof e.default==`function`}function Br(e){return e.data!==void 0}function Vr(e){return typeof Response<`u`&&e instanceof Response}function Hr(e){return typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<`u`&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||typeof Uint32Array<`u`&&e instanceof Uint32Array}var Ur;function Wr(e){if(Ur)return Ur;async function t(){P=await Ar(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),Rr(n)?n=await n.instantiator(t):zr(n)?n=await n.default(t):(Br(n)&&(n=n.data),Vr(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await Kr(n)(t):await qr(n)(t):Hr(n)||n instanceof WebAssembly.Module?n=await Gr(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await Gr(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return Ur=t(),Ur}function Gr(e){return t=>WebAssembly.instantiate(e,t)}function Kr(e){return t=>WebAssembly.instantiateStreaming(e,t)}function qr(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}var Jr;function Yr(e){Jr=e}function Xr(){return Jr}async function Zr(e){return e&&await Wr(e),{createScanner(e){return new Lr(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new Ir(e)}}}var Qr=_r({});yr(Qr,Tr);var F=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function $r(e){return ei(e)}function ei(e){return Array.isArray(e)?ti(e):e instanceof RegExp?e:typeof e==`object`?ni(e):e}function ti(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=ei(e[n]);return t}function ni(e){let t={};for(let n in e)t[n]=ei(e[n]);return t}function ri(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function ii(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?ii(e.substring(0,e.length-1)):e.substr(~t+1)}var ai=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,oi=class{static hasCaptures(e){return e!==null&&(ai.lastIndex=0,ai.test(e))}static replaceCaptures(e,t,n){return e.replace(ai,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function si(e,t){return e<t?-1:+(e>t)}function ci(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=si(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function li(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function ui(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var di=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},fi=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(_i(e),t)}static createFromParsedTheme(e,t){return yi(e,t)}_cachedMatchRoot=new di(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>mi(e.parent,t.parentScopes));return n?new gi(n.fontStyle,n.foreground,n.background):null}},pi=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function mi(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!hi(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function hi(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var gi=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function _i(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8}}let s=null;typeof i.settings.foreground==`string`&&li(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&li(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new vi(l,u,e,o,s,c)}}return n}var vi=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},I=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(I||{});function yi(e,t){e.sort((e,t)=>{let n=si(e.scope,t.scope);return n!==0||(n=ci(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new bi(t),o=new gi(n,a.getId(r),a.getId(i)),s=new Ci(new Si(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new fi(a,o,s)}var bi=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},xi=Object.freeze([]),Si=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||xi,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},Ci=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),Si.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(ci(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Si(e,t,n,r,i))}},wi=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return!!(e&1024)}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=Ei(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function Ti(e){return e}function Ei(e){return e}function Di(e,t){let n=[],r=ki(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(Oi(i)){let e=[];do e.push(i),i=r.next();while(Oi(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function Oi(e){return!!e&&!!e.match(/[\w\.:]+/)}function ki(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function Ai(e){typeof e.dispose==`function`&&e.dispose()}var ji=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Mi=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Ni=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Pi=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new ji(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new Ni;for(let n of e)Fi(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof ji){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function Fi(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof ji?Li({baseGrammar:a,selfGrammar:i},r):Ii(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new ji(e))}function Ii(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];Ri([r],t,n)}}function Li(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Ri(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Ri(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Ri(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?ri({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&Ri(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=Wi(i);switch(a.kind){case 0:Li({...t,selfGrammar:t.baseGrammar},n);break;case 1:Li(t,n);break;case 2:Ii(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?Ii(a.ruleName,i,n):Li(i,n)}else a.kind===4?n.add(new Mi(a.scopeName,a.ruleName)):n.add(new ji(a.scopeName))}}}var zi=class{kind=0},Bi=class{kind=1},Vi=class{constructor(e){this.ruleName=e}kind=2},Hi=class{constructor(e){this.scopeName=e}kind=3},Ui=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Wi(e){if(e===`$base`)return new zi;if(e===`$self`)return new Bi;let t=e.indexOf(`#`);return t===-1?new Hi(e):t===0?new Vi(e.substring(1)):new Ui(e.substring(0,t),e.substring(t+1))}var Gi=/\\(\d+)/,Ki=/\\(\d+)/g,qi=-1,Ji=-2;function Yi(e){return e}function Xi(e){return e}var Zi=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=oi.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=oi.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${ii(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:oi.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:oi.replaceCaptures(this._contentName,e,t)}},Qi=class extends Zi{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},$i=class extends Zi{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new ia(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new aa,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ea=class extends Zi{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new aa,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ta=class extends Zi{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new ia(i,this.id),this.beginCaptures=a,this._end=new ia(o||`￿`,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new aa;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},na=class extends Zi{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new ia(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new ia(o,Ji),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new aa;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new aa,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||`￿`),this._cachedCompiledWhilePatterns}},ra=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new Qi(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new $i(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=ri({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new ea(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new na(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new ta(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=Wi(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l){if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof ea||e instanceof ta||e instanceof na)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},ia=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this._anchorCache=this.hasAnchor?this._buildAnchorCache():null,this.ruleId=t,this.hasBackReferences=typeof this.source==`string`&&Gi.test(this.source)}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return Ki.lastIndex=0,this.source.replace(Ki,(e,t)=>ui(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=`￿`,t[i+1]=`￿`,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=`￿`,t[i+1]=`G`,n[i+1]=`￿`,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},aa=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new oa(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new oa(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},oa=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
3
- `)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},sa=class{constructor(e,t){this.languageId=e,this.tokenType=t}},ca=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new sa(e,8),this._embeddedLanguagesMatcher=new la(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new sa(0,0);_getBasicScopeAttributes=new di(e=>new sa(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},la=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>ui(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var ua=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function da(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=fa(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new ua(i,!0);f()}return new ua(i,!1);function f(){let o=pa(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===qi){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),va(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof ta){let r=o;va(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof na){let r=o;va(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(va(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function fa(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof na&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=_a(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==Ji){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),va(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function pa(e,t,n,r,i,a){let o=ma(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=ha(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function ma(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=ga(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function ha(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=ga(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function ga(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function _a(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function va(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));da(e,p,n&&d.start===0,d.start,f,i,!1,0),Ai(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new ya(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var ya=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function ba(e,t,n,r,i,a,o,s){return new wa(e,t,n,r,i,a,o,s)}function xa(e,t,n,r,i){let a=Di(t,Sa),o=ra.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function Sa(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(Ca(t[r],e))return n=r+1,!0;return!1})}function Ca(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var wa=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new ca(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Ta(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=Di(e,Sa);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)xa(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&xa(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(Yi(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[Xi(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Ta(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=ra.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===Da.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=wi.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?Ea.createRootAndLookUpScopeName(a,r,this):Ea.createRoot(`unknown`,r),t=new Da(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
4
- `;let a=this.createOnigString(e),o=a.content.length,s=new ka(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=da(this,a,i,0,t,s,!0,r);return Ai(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Ta(e,t){return e=$r(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Ea=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=pi.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new pi(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new pi(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(1)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),wi.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},Da=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?Ea.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(1)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:Xi(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=Ea.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,Yi(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Ea.fromExtension(r,n.contentNameScopesList))}},Oa=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):Di(e,Sa).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Di(e,Sa).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},ka=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=wi.set(n,0,Ti(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=wi.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},Aa=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,ba(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},ja=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Aa(fi.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(fi.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new Oa(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new Pi(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},Ma=Da.NULL;function Na(e,t){let n=typeof e==`string`?{}:{...e.colorReplacements},r=typeof e==`string`?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))typeof i==`string`?n[e]=i:e===r&&Object.assign(n,i);return n}function Pa(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Fa(e){return Array.isArray(e)?e:[e]}async function Ia(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function La(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function Ra(e){return e===`ansi`||La(e)}function za(e){return e===`none`}function Ba(e){return za(e)}var Va=/(\r?\n)/g;function Ha(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(Va),r=0,i=[];for(let e=0;e<n.length;e+=2){let a=t?n[e]+(n[e+1]||``):n[e];i.push([a,r]),r+=n[e].length,r+=n[e+1]?.length||0}return i}var Ua={light:`#333333`,dark:`#bbbbbb`},Wa={light:`#fffffe`,dark:`#1e1e1e`},Ga=`__shiki_resolved`;function Ka(e){if(e?.[Ga])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||=`dark`,t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.[`editor.foreground`]&&(r=t.colors[`editor.foreground`]),!n&&t?.colors?.[`editor.background`]&&(n=t.colors[`editor.background`]),r||=t.type===`light`?Ua.light:Ua.dark,n||=t.type===`light`?Wa.light:Wa.dark,t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let n=`#${i.toString(16).padStart(8,`0`).toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(a.set(e,n),n)}t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith(`#`),r=e.settings?.background&&!e.settings.background.startsWith(`#`);if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i});for(let e of Object.keys(t.colors||{}))if((e===`editor.foreground`||e===`editor.background`||e.startsWith(`terminal.ansi`))&&!t.colors[e]?.startsWith(`#`)){let n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,Ga,{enumerable:!1,writable:!1,value:!0}),t}async function qa(e){return[...new Set((await Promise.all(e.filter(e=>!Ra(e)).map(async e=>await Ia(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function Ja(e){return(await Promise.all(e.map(async e=>Ba(e)?null:Ka(await Ia(e))))).filter(e=>!!e)}function Ya(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new F(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var Xa=class extends ja{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=Ka(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||=[...this._resolvedThemes.keys()],this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=fi.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=Ya(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=[...this._langGraph.entries()],n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t?(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e)):!1).filter(e=>!n.includes(e));throw new F(`Missing languages ${n.map(([e])=>`\`${e}\``).join(`, `)}, required by ${e.map(([e])=>`\`${e}\``).join(`, `)}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])],this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}},Za=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split(`.`),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(`.`);n=[...n,...this._injections.get(r)||[]]}return n}},Qa=0;function $a(e){Qa+=1,e.warnings!==!1&&Qa>=10&&Qa%10==0&&console.warn(`[Shiki] ${Qa} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new F("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Ka),i=new Xa(new Za(e.engine,n),r,n,e.langAlias),a;function o(t){return Ya(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new F(`Language \`${e}\` not found, you may need to load it first`);return t}function c(e){if(e===`none`)return{bg:``,fg:``,name:`none`,settings:[],type:`dark`};g();let t=i.getTheme(e);if(!t)throw new F(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(e){g();let t=c(e);return a!==e&&(i.setTheme(t),a=e),{theme:t,colorMap:i.getColorMap()}}function u(){return g(),i.getLoadedThemes()}function d(){return g(),i.getLoadedLanguages()}function f(...e){g(),i.loadLanguages(e.flat(1))}async function p(...e){return f(await qa(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await Ja(e))}function g(){if(t)throw new F(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--Qa)}return{setTheme:l,getTheme:c,getLanguage:s,getLoadedThemes:u,getLoadedLanguages:d,resolveLangAlias:o,loadLanguage:p,loadLanguageSync:f,loadTheme:h,loadThemeSync:m,dispose:_,[Symbol.dispose]:_}}async function eo(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([Ja(e.themes||[]),qa(e.langs||[]),e.engine]);return $a({...e,themes:t,langs:n,engine:r})}var to=new WeakMap;function no(e,t){to.set(e,t)}function ro(e){return to.get(e)}var io=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries(Fa(n).map(e=>[e,Ma])),t)}constructor(...e){if(e.length===2){let[t,n]=e;this.lang=n,this._stacks=t}else{let[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return ao(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function ao(e){let t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);let i=e?.nameScopesList?.scopeName;i&&t.push(i),e.parent&&r(e.parent)}return r(e),t}function oo(e,t){if(!(e instanceof io))throw new F(`Invalid grammar state`);return e.getInternalStack(t)}var so=/,/,co=/ /;function lo(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(La(e.resolveLangAlias(n.lang||`text`))||za(r))return Ha(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:i,colorMap:a}=e.setTheme(r),o=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==o.name)throw new F(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new F(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return fo(t,o,i,a,n)}function uo(...e){if(e.length===2)return ro(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(La(i)||za(a))throw new F(`Plain language does not have grammar state`);if(i===`ansi`)throw new F(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new io(po(n,c,o,s,r).stateStack,c.name,o.name)}function fo(e,t,n,r,i){let a=po(e,t,n,r,i),o=new io(a.stateStack,t.name,n.name);return no(a.tokens,o),a.tokens}function po(e,t,n,r,i){let a=Na(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500,includeExplanation:c=!1}=i,l=Ha(e),u=i.grammarState?oo(i.grammarState,n.name)??Ma:i.grammarContextCode==null?Ma:po(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,d=[],f=[];for(let e=0,i=l.length;e<i;e++){let[i,p]=l[e];if(i===``){d=[],f.push([]);continue}if(o>0&&i.length>=o){d=[],f.push([{content:i,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;c&&c!==`tokenType`&&(m=t.tokenizeLine(i,u,s),h=m.tokens,g=0);let _=t.tokenizeLine2(i,u,s),v=_.tokens.length/2;for(let e=0;e<v;e++){let t=_.tokens[2*e],o=e+1<v?_.tokens[2*e+2]:i.length;if(t===o)continue;let s=_.tokens[2*e+1],l=Pa(r[wi.getForeground(s)],a),u=wi.getFontStyle(s),f={content:i.substring(t,o),offset:p+t,color:l,fontStyle:u};if(c===`tokenType`)f.type=wi.getTokenType(s);else if(c){let e=[];if(c!==`scopeName`)for(let t of n.settings){let n;switch(typeof t.scope){case`string`:n=t.scope.split(so).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(co))})}f.explanation=[];let r=0;for(;t+r<o;){let t=h[g],n=i.substring(t.startIndex,t.endIndex);r+=n.length,f.explanation.push({content:n,scopes:c===`scopeName`?mo(t.scopes):ho(e,t.scopes)}),g+=1}}d.push(f)}f.push(d),d=[],u=_.ruleStack}return{tokens:f,stateStack:u}}function mo(e){return e.map(e=>({scopeName:e}))}function ho(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:vo(e,i,t.slice(0,r))}}return n}function go(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function _o(e,t,n){if(!go(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)go(e[r],n[i])&&--r,--i;return r===-1}function vo(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(_o(e,t,n)){r.push(a);break}return r}function yo(e,t,n,r=lo){let i=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),a=i.map(i=>{let a=r(e,t,{...n,theme:i.theme});return{tokens:a,state:ro(a),theme:typeof i.theme==`string`?i.theme:i.theme.name}}),o=bo(...a.map(e=>e.tokens)),s=o[0].map((e,t)=>e.map((e,r)=>{let a={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(a.explanation=e.explanation),o.forEach((e,n)=>{let{content:o,explanation:s,offset:c,...l}=e[t][r];a.variants[i[n].color]=l}),a})),c=a[0].state?new io(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&no(s,c),s}function bo(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let i=e.map(e=>e[r]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let o=i.map(()=>0),s=i.map(e=>e[0]);for(;s.every(e=>e);){let e=Math.min(...s.map(e=>e.content.length));for(let t=0;t<n;t++){let n=s[t];n.content.length===e?(a[t].push(n),o[t]+=1,s[t]=i[t][o[t]]):(a[t].push({...n,content:n.content.slice(0,e)}),s[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}var xo=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],So=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};So.prototype.normal={},So.prototype.property={},So.prototype.space=void 0;function Co(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new So(n,r,t)}function wo(e){return e.toLowerCase()}var L=class{constructor(e,t){this.attribute=t,this.property=e}};L.prototype.attribute=``,L.prototype.booleanish=!1,L.prototype.boolean=!1,L.prototype.commaOrSpaceSeparated=!1,L.prototype.commaSeparated=!1,L.prototype.defined=!1,L.prototype.mustUseProperty=!1,L.prototype.number=!1,L.prototype.overloadedBoolean=!1,L.prototype.property=``,L.prototype.spaceSeparated=!1,L.prototype.space=void 0;var To=e({boolean:()=>R,booleanish:()=>z,commaOrSpaceSeparated:()=>H,commaSeparated:()=>Oo,number:()=>B,overloadedBoolean:()=>Do,spaceSeparated:()=>V}),Eo=0,R=ko(),z=ko(),Do=ko(),B=ko(),V=ko(),Oo=ko(),H=ko();function ko(){return 2**++Eo}var Ao=Object.keys(To),jo=class extends L{constructor(e,t,n,r){let i=-1;if(super(e,t),Mo(this,`space`,r),typeof n==`number`)for(;++i<Ao.length;){let e=Ao[i];Mo(this,Ao[i],(n&To[e])===To[e])}}};jo.prototype.defined=!0;function Mo(e,t,n){n&&(e[t]=n)}function No(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new jo(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[wo(r)]=r,n[wo(a.attribute)]=r}return new So(t,n,e.space)}var Po=No({properties:{ariaActiveDescendant:null,ariaAtomic:z,ariaAutoComplete:null,ariaBusy:z,ariaChecked:z,ariaColCount:B,ariaColIndex:B,ariaColSpan:B,ariaControls:V,ariaCurrent:null,ariaDescribedBy:V,ariaDetails:null,ariaDisabled:z,ariaDropEffect:V,ariaErrorMessage:null,ariaExpanded:z,ariaFlowTo:V,ariaGrabbed:z,ariaHasPopup:null,ariaHidden:z,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:V,ariaLevel:B,ariaLive:null,ariaModal:z,ariaMultiLine:z,ariaMultiSelectable:z,ariaOrientation:null,ariaOwns:V,ariaPlaceholder:null,ariaPosInSet:B,ariaPressed:z,ariaReadOnly:z,ariaRelevant:null,ariaRequired:z,ariaRoleDescription:V,ariaRowCount:B,ariaRowIndex:B,ariaRowSpan:B,ariaSelected:z,ariaSetSize:B,ariaSort:null,ariaValueMax:B,ariaValueMin:B,ariaValueNow:B,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Fo(e,t){return t in e?e[t]:t}function Io(e,t){return Fo(e,t.toLowerCase())}var Lo=No({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Oo,acceptCharset:V,accessKey:V,action:null,allow:null,allowFullScreen:R,allowPaymentRequest:R,allowUserMedia:R,alpha:R,alt:null,as:null,async:R,autoCapitalize:null,autoComplete:V,autoFocus:R,autoPlay:R,blocking:V,capture:null,charSet:null,checked:R,cite:null,className:V,closedBy:null,colorSpace:null,cols:B,colSpan:B,command:null,commandFor:null,content:null,contentEditable:z,controls:R,controlsList:V,coords:B|Oo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:R,defer:R,dir:null,dirName:null,disabled:R,download:Do,draggable:z,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:R,formTarget:null,headers:V,height:B,hidden:Do,high:B,href:null,hrefLang:null,htmlFor:V,httpEquiv:V,id:null,imageSizes:null,imageSrcSet:null,inert:R,inputMode:null,integrity:null,is:null,isMap:R,itemId:null,itemProp:V,itemRef:V,itemScope:R,itemType:V,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:R,low:B,manifest:null,max:null,maxLength:B,media:null,method:null,min:null,minLength:B,multiple:R,muted:R,name:null,nonce:null,noModule:R,noValidate:R,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:R,optimum:B,pattern:null,ping:V,placeholder:null,playsInline:R,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:R,referrerPolicy:null,rel:V,required:R,reversed:R,rows:B,rowSpan:B,sandbox:V,scope:null,scoped:R,seamless:R,selected:R,shadowRootClonable:R,shadowRootCustomElementRegistry:R,shadowRootDelegatesFocus:R,shadowRootMode:null,shadowRootSerializable:R,shape:null,size:B,sizes:null,slot:null,span:B,spellCheck:z,src:null,srcDoc:null,srcLang:null,srcSet:null,start:B,step:null,style:null,tabIndex:B,target:null,title:null,translate:null,type:null,typeMustMatch:R,useMap:null,value:z,width:B,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:V,axis:null,background:null,bgColor:null,border:B,borderColor:null,bottomMargin:B,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:R,declare:R,event:null,face:null,frame:null,frameBorder:null,hSpace:B,leftMargin:B,link:null,longDesc:null,lowSrc:null,marginHeight:B,marginWidth:B,noResize:R,noHref:R,noShade:R,noWrap:R,object:null,profile:null,prompt:null,rev:null,rightMargin:B,rules:null,scheme:null,scrolling:z,standby:null,summary:null,text:null,topMargin:B,valueType:null,version:null,vAlign:null,vLink:null,vSpace:B,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:R,disablePictureInPicture:R,disableRemotePlayback:R,exportParts:Oo,part:V,prefix:null,property:null,results:B,security:null,unselectable:null},space:`html`,transform:Io}),Ro=No({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:H,accentHeight:B,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:B,amplitude:B,arabicForm:null,ascent:B,attributeName:null,attributeType:null,azimuth:B,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:B,by:null,calcMode:null,capHeight:B,className:V,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:B,diffuseConstant:B,direction:null,display:null,dur:null,divisor:B,dominantBaseline:null,download:R,dx:null,dy:null,edgeMode:null,editable:null,elevation:B,enableBackground:null,end:null,event:null,exponent:B,externalResourcesRequired:null,fill:null,fillOpacity:B,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Oo,g2:Oo,glyphName:Oo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:B,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:B,horizOriginX:B,horizOriginY:B,id:null,ideographic:B,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:B,k:B,k1:B,k2:B,k3:B,k4:B,kernelMatrix:H,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:B,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:B,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:B,overlineThickness:B,paintOrder:null,panose1:null,path:null,pathLength:B,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:V,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:B,pointsAtY:B,pointsAtZ:B,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:H,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:H,rev:H,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:H,requiredFeatures:H,requiredFonts:H,requiredFormats:H,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:B,specularExponent:B,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:B,strikethroughThickness:B,string:null,stroke:null,strokeDashArray:H,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:B,strokeOpacity:B,strokeWidth:null,style:null,surfaceScale:B,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:H,tabIndex:B,tableValues:null,target:null,targetX:B,targetY:B,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:H,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:B,underlineThickness:B,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:B,values:null,vAlphabetic:B,vMathematical:B,vectorEffect:null,vHanging:B,vIdeographic:B,version:null,vertAdvY:B,vertOriginX:B,vertOriginY:B,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:B,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Fo}),zo=No({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Bo=No({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Io}),Vo=No({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Ho=/[A-Z]/g,Uo=/-[a-z]/g,Wo=/^data[-\w.:]+$/i;function Go(e,t){let n=wo(t),r=t,i=L;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Wo.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Uo,qo);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Uo.test(e)){let n=e.replace(Ho,Ko);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=jo}return new i(r,t)}function Ko(e){return`-`+e.toLowerCase()}function qo(e){return e.charAt(1).toUpperCase()}var Jo=Co([Po,Lo,zo,Bo,Vo],`html`),Yo=Co([Po,Ro,zo,Bo,Vo],`svg`),Xo={}.hasOwnProperty;function Zo(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&Xo.call(t,e)){let n=String(t[e]);i=Xo.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var Qo=/["&'<>`]/g,$o=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,es=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,ts=/[|\\{}()[\]^$+*?.]/g,ns=new WeakMap;function rs(e,t){if(e=e.replace(t.subset?is(t.subset):Qo,r),t.subset||t.escapeOnly)return e;return e.replace($o,n).replace(es,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function is(e){let t=ns.get(e);return t||(t=as(e),ns.set(e,t)),t}function as(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(ts,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var os=/[\dA-Fa-f]/;function ss(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!os.test(String.fromCharCode(t))?r:r+`;`}var cs=/\d/;function ls(e,t,n){let r=`&#`+String(e);return n&&t&&!cs.test(String.fromCharCode(t))?r:r+`;`}var us=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),ds={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:`­`,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:`‌`,zwj:`‍`,lrm:`‎`,rlm:`‏`,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},fs=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],ps={}.hasOwnProperty,ms={},hs;for(hs in ds)ps.call(ds,hs)&&(ms[ds[hs]]=hs);var gs=/[^\dA-Za-z]/;function _s(e,t,n,r){let i=String.fromCharCode(e);if(ps.call(ms,i)){let e=ms[i],a=`&`+e;return n&&us.includes(e)&&!fs.includes(e)&&(!r||t&&t!==61&&gs.test(String.fromCharCode(t)))?a:a+`;`}return``}function vs(e,t,n){let r=ss(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=_s(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=ls(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function ys(e,t){return rs(e,Object.assign({format:vs},t))}var bs=/^>|^->|<!--|-->|--!>|<!-$/g,xs=[`>`],Ss=[`<`,`>`];function Cs(e,t,n,r){return r.settings.bogusComments?`<?`+ys(e.value,Object.assign({},r.settings.characterReferences,{subset:xs}))+`>`:`<!--`+e.value.replace(bs,i)+`-->`;function i(e){return ys(e,Object.assign({},r.settings.characterReferences,{subset:Ss}))}}function ws(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function Ts(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Es(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function Ds(e){return e.join(` `).trim()}var Os=/[ \t\n\f\r]/g;function ks(e){return typeof e==`object`?e.type===`text`&&As(e.value):As(e)}function As(e){return e.replace(Os,``)===``}var U=Ns(1),js=Ns(-1),Ms=[];function Ns(e){return t;function t(t,n,r){let i=t?t.children:Ms,a=(n||0)+e,o=i[a];if(!r)for(;o&&ks(o);)a+=e,o=i[a];return o}}var Ps={}.hasOwnProperty;function Fs(e){return t;function t(t,n,r){return Ps.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var Is=Fs({body:zs,caption:Ls,colgroup:Ls,dd:Us,dt:Hs,head:Ls,html:Rs,li:Vs,optgroup:Gs,option:Ks,p:Bs,rp:Ws,rt:Ws,tbody:Js,td:Zs,tfoot:Ys,th:Zs,thead:qs,tr:Xs});function Ls(e,t,n){let r=U(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&ks(r.value.charAt(0)))}function Rs(e,t,n){let r=U(n,t);return!r||r.type!==`comment`}function zs(e,t,n){let r=U(n,t);return!r||r.type!==`comment`}function Bs(e,t,n){let r=U(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||n.type!==`element`||n.tagName!==`a`&&n.tagName!==`audio`&&n.tagName!==`del`&&n.tagName!==`ins`&&n.tagName!==`map`&&n.tagName!==`noscript`&&n.tagName!==`video`}function Vs(e,t,n){let r=U(n,t);return!r||r.type===`element`&&r.tagName===`li`}function Hs(e,t,n){let r=U(n,t);return!(!r||r.type!==`element`||r.tagName!==`dt`&&r.tagName!==`dd`)}function Us(e,t,n){let r=U(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function Ws(e,t,n){let r=U(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function Gs(e,t,n){let r=U(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function Ks(e,t,n){let r=U(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function qs(e,t,n){let r=U(n,t);return!(!r||r.type!==`element`||r.tagName!==`tbody`&&r.tagName!==`tfoot`)}function Js(e,t,n){let r=U(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function Ys(e,t,n){return!U(n,t)}function Xs(e,t,n){let r=U(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function Zs(e,t,n){let r=U(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var Qs=Fs({body:tc,colgroup:nc,head:ec,html:$s,tbody:rc});function $s(e){let t=U(e,-1);return!t||t.type!==`comment`}function ec(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function tc(e){let t=U(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&ks(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function nc(e,t,n){let r=js(n,t),i=U(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&Is(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function rc(e,t,n){let r=js(n,t),i=U(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&Is(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var ic={name:[[`
2
+ import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{$a as r,$n as i,$r as a,Ar as o,Br as s,Bt as c,Dn as l,E as u,En as d,F as f,Ft as p,Gr as m,I as h,Io as g,It as _,Kr as v,Ni as y,Nt as b,Oo as x,Pi as S,Qs as C,Rt as w,Sn as T,Vr as E,Wa as ee,Wr as te,Xa as ne,Xn as re,Xs as D,Zi as ie,Zr as ae,a as oe,ai as se,br as ce,c as le,cr as ue,cu as de,di as O,dn as fe,do as pe,eu as me,fl as he,fn as ge,gn as _e,gr as ve,hi as ye,hr as be,ic as xe,il as Se,io as Ce,j as we,jt as Te,lr as Ee,ni as De,o as Oe,oi as ke,qr as Ae,ri as je,rl as Me,ru as Ne,sn as Pe,sr as Fe,ti as Ie,ui as Le,uo as Re,vn as ze,vo as Be,xn as Ve,xr as He,yr as Ue,zi as We}from"./files-Dq4t9_xQ.js";import{t as k}from"./preload-helper-Czpn1I53.js";var A=t(O(),1),Ge=A.createContext(void 0);function Ke(){let e=A.useContext(Ge);if(!e)throw Error(te(73));return e}var qe=0;function Je(e){return qe+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${qe}`}function Ye(e,t){if(typeof e==`string`)return{description:e};if(typeof e==`function`){let n=e(t);return typeof n==`string`?{description:n}:n}return e}function Xe(e){let t=new Map,n=0,r=0;return e.forEach((e,i)=>{let a=e.transitionStatus===`ending`;t.set(e.id,{value:e,domIndex:i,visibleIndex:a?-1:n,offsetY:r}),r+=e.height||0,a||(n+=1)}),t}function Ze(e,t){let n=0;return e.map(e=>{if(e.transitionStatus===`ending`)return e;let r=n>=t;return n+=1,e.limited===r?e:{...e,limited:r}})}var Qe={toasts:e=>e.toasts,isEmpty:e=>e.toasts.length===0,toast:(e,t)=>e.toastMetadata.get(t)?.value,toastIndex:(e,t)=>e.toastMetadata.get(t)?.domIndex??-1,toastOffsetY:(e,t)=>e.toastMetadata.get(t)?.offsetY??0,toastVisibleIndex:(e,t)=>e.toastMetadata.get(t)?.visibleIndex??-1,focused:e=>e.focused,expanded:e=>e.hovering||e.focused,expandedOrOutOfFocus:e=>e.hovering||e.focused||!e.isWindowFocused,prevFocusElement:e=>e.prevFocusElement},$e=class extends s{timers=new Map;areTimersPaused=!1;constructor(e){super({...e,toastMetadata:Xe(e.toasts)},{},Qe)}setViewport=e=>{this.set(`viewport`,e)};syncProviderProps(e,t){let n=this.state.limit!==t;if(this.state.timeout===e&&!n)return;let r={timeout:e,limit:t};if(n){let e=Ze(this.state.toasts,t);r.toasts=e,r.toastMetadata=Xe(e)}this.update(r)}disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e,t=!1){let n=Qe.toastIndex(this.state,e);if(n===-1)return;let r=this.state.toasts[n];t||r?.onRemove?.();let i=[...this.state.toasts];i.splice(n,1),this.setToasts(i)}addToast=e=>{let{timeout:t,limit:n}=this.state,r=e.id||Je(`toast`);if(e.id){let t=Qe.toast(this.state,e.id);if(t){if(t.transitionStatus===`ending`)this.removeToast(e.id,!0);else{let{id:t,transitionStatus:n,...r}=e;return this.updateToastInternal(e.id,r,!0,!0),e.id}}}let i={...e,id:r,updateKey:0,transitionStatus:`starting`},a=[i,...this.state.toasts];this.setToasts(Ze(a,n));let o=i.timeout??t;return i.type!==`loading`&&o>0&&this.scheduleTimer(r,o,()=>this.closeToast(r)),Qe.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),r};updateToast=(e,t)=>{let n=Qe.toast(this.state,e);n&&n.transitionStatus!==`ending`&&this.updateToastInternal(e,typeof t==`function`?t(n):t,!1,!0)};updateToastInternal=(e,t,n=!1,r=!1)=>{let{timeout:i,toasts:a}=this.state,o=Qe.toast(this.state,e);if(!o||o.transitionStatus===`ending`)return;let s={...o,...t,...r&&{updateKey:o.updateKey+1}};this.setToasts(a.map(t=>t.id===e?s:t));let c=s.timeout??i,l=o.timeout??i,u=Object.hasOwn(t,`timeout`),d=s.transitionStatus!==`ending`&&s.type!==`loading`&&c>0,f=this.timers.has(e),p=l!==c,m=o.type===`loading`;if(!d&&f){this.clearTimer(e);return}d&&(!f||p||u||m||n)&&(this.clearTimer(e),this.scheduleTimer(e,c,()=>this.closeToast(e)),Qe.expandedOrOutOfFocus(this.state)&&this.pauseTimers())};closeToast=e=>{let t=e===void 0,{limit:n,toasts:r}=this.state,i;if(t)i=r,this.clearTimers();else{let t=Qe.toast(this.state,e);if(!t)return;i=[t],this.clearTimer(e)}let a=Ze(r.map(n=>t||n.id===e?{...n,transitionStatus:`ending`,height:0}:n),n);this.setToasts(a,!a.some(e=>e.transitionStatus!==`ending`)),i.forEach(e=>{e.transitionStatus!==`ending`&&e.onClose?.()}),this.handleFocusManagement(e)};promiseToast=(e,t)=>{let n=Ye(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=Ye(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=Ye(t.error,e);return this.updateToast(r,{...n,type:`error`,timeout:n.timeout}),Promise.reject(e)});return{}.hasOwnProperty.call(t,`setPromise`)&&t.setPromise(i),i};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{e.timeout&&(e.timeout.clear(),e.remaining=Math.max(e.remaining-(Date.now()-e.start),0))}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=be.create(),e.timeout.start(e.remaining,()=>{this.handleTimerFired(t),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if(e.pointerType!==`touch`)return;let t=Ee(e);ue(this.state.viewport,t)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,t,n){let r=Date.now(),i=Qe.expandedOrOutOfFocus(this.state)?void 0:be.create();i?.start(t,()=>{this.handleTimerFired(e),n()}),this.timers.set(e,{timeout:i,start:r,delay:t,remaining:t,callback:n})}clearTimers(){this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear(),this.areTimersPaused=!1}clearTimer(e){this.timers.get(e)?.timeout?.clear(),this.timers.delete(e),this.resetPausedStateIfNoTimersRemain()}handleTimerFired(e){this.timers.delete(e),this.resetPausedStateIfNoTimersRemain()}resetPausedStateIfNoTimersRemain(){this.timers.size===0&&(this.areTimersPaused=!1)}setToasts(e,t=e.length===0){let n={toasts:e,toastMetadata:Xe(e)};t&&(n.hovering=!1,n.focused=!1),this.update(n)}handleFocusManagement(e){let t=Fe(ce(this.state.viewport));if(!this.state.viewport||!ue(this.state.viewport,t)||!re(t))return;if(e===void 0){this.restoreFocusToPrevElement();return}let n=Qe.toasts(this.state),r=Qe.toastIndex(this.state,e),i=(e,t)=>{for(let r=e;r>=0&&r<n.length;r+=t)if(n[r].transitionStatus!==`ending`)return n[r];return null},a=i(r+1,1)??i(r-1,-1);a?a.ref?.current?.focus():this.restoreFocusToPrevElement()}},j=Le(),et=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=v(()=>new $e({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return Ae(a.disposeEffect),A.useEffect(function(){if(i)return i[` subscribe`](({action:e,options:t})=>{let n=t.id;e===`promise`&&t.promise?a.promiseToast(t.promise,t):e===`update`&&n?a.updateToast(n,t.updates):e===`close`?a.closeToast(n):a.addToast(t)})},[a,i]),(0,j.jsxs)(Ge.Provider,{value:a,children:[(0,j.jsx)(tt,{store:a,timeout:n,limit:r}),t]})};function tt(e){let{store:t,timeout:n,limit:r}=e;return m(()=>{t.syncProviderProps(n,r)},[t,n,r]),null}var nt=`--toast-frontmost-height`,rt=A.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...s}=e,c=Ke(),u=ve(),f=A.useRef(!1),p=A.useRef(!1),m=A.useRef(!1),h=c.useState(`isEmpty`),g=c.useState(`toasts`),_=c.useState(`focused`),v=c.useState(`expanded`),y=c.useState(`prevFocusElement`),b=g[0]?.height,x=g.some(e=>e.transitionStatus===`ending`),S=g.filter(e=>e.priority===`high`);A.useEffect(()=>{let e=c.state.viewport;if(!e||h)return;let t=o(e),n=ce(e);function r(t){t.key===`F6`&&Ee(t)!==e&&(t.preventDefault(),c.set(`prevFocusElement`,Fe(n)),e?.focus({preventScroll:!0}),c.pauseTimers(),c.set(`focused`,!0))}function i(e){Ee(e)===t&&(c.set(`isWindowFocused`,!1),c.pauseTimers())}function a(n){if(n.relatedTarget)return;let r=Ee(n),i=Fe(ce(e));(r===t||!ue(e,r)||!re(i))&&c.resumeTimers(),u.start(0,()=>c.set(`isWindowFocused`,!0))}return He(Ue(t,`keydown`,r),Ue(t,`blur`,i,!0),Ue(t,`focus`,a,!0),Ue(n,`pointerdown`,c.handleDocumentPointerDown,!0))},[c,u,h]);function C(e){f.current=!0;let t=e.relatedTarget===c.state.viewport?g.find(e=>e.transitionStatus!==`ending`&&!e.limited):void 0;t?t.ref?.current?.focus():c.restoreFocusToPrevElement()}function w(e){e.key===`Tab`&&e.shiftKey&&Ee(e.nativeEvent)===c.state.viewport&&(e.preventDefault(),c.restoreFocusToPrevElement())}function E(){c.state.toasts.some(e=>e.transitionStatus===`ending`)||m.current||!p.current||(c.state.isWindowFocused&&c.resumeTimers(),c.set(`hovering`,!1),p.current=!1)}A.useEffect(E,[x,c]);function ee(){c.pauseTimers(),c.set(`hovering`,!0),p.current=!1}function te(){c.state.isWindowFocused&&c.resumeTimers()}function ne(){p.current=!0,E()}function D(e){e.pointerType===`touch`&&(m.current=!0)}function ie(e){e.pointerType===`touch`&&(m.current=!1,E())}function ae(){if(f.current){f.current=!1;return}_||re(Fe(ce(c.state.viewport)))&&(c.set(`focused`,!0),c.pauseTimers())}function oe(e){_&&!ue(c.state.viewport,e.relatedTarget)&&(c.set(`focused`,!1),te())}let se={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:ee,onMouseMove:ee,onMouseLeave:ne,onFocus:ae,onBlur:oe,onKeyDown:w,onClick:ae,onPointerDown:D,onPointerUp:ie,onPointerCancel:ie,style:{[nt]:b?`${b}px`:void 0}},le={expanded:v},de=!h&&y&&(0,j.jsx)(d,{onFocus:C}),O=T(`div`,e,{ref:[t,c.setViewport],state:le,props:[se,s,{children:(0,j.jsxs)(A.Fragment,{children:[de,a,de]})}]});return(0,j.jsxs)(A.Fragment,{children:[de,O,!_&&S.length>0&&(0,j.jsx)(`div`,{style:l,children:S.map(e=>(0,j.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,j.jsx)(`div`,{children:e.title}),(0,j.jsx)(`div`,{children:e.description})]},e.id))})]})}),it=t(ke(),1),at=A.createContext(void 0);function ot(){let e=A.useContext(at);if(!e)throw Error(te(66));return e}function st(e,t){let n=(t??o(e).getComputedStyle(e)).transform,r=0,i=0,a=1;if(n&&n!==`none`){let e=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){let t=e[1].split(`, `).map(parseFloat);t.length===6?(r=t[4],i=t[5],a=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(r=t[12],i=t[13],a=t[0])}}return{x:r,y:i,scale:a}}function ct(e,t,n){switch(e){case`up`:return-n;case`down`:return n;case`left`:return-t;case`right`:return t;default:return 0}}var lt=`--toast-index`,ut=`--toast-offset-y`,dt=`--toast-height`,ft=`--toast-swipe-movement-x`,pt=`--toast-swipe-movement-y`,mt=`data-swipe-direction`,ht={...i,swipeDirection(e){return e?{[mt]:e}:null}},gt=40,_t=10,vt=.5,yt=1,bt=`${ge},${_e}`,xt=A.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],style:o,...s}=e,c=n.positionerProps?.anchor!==void 0,l=[];c||(l=Array.isArray(a)?a:[a]);let u=l.length>0,d=Ke(),[f,p]=A.useState(void 0),[h,g]=A.useState(!1),[_,v]=A.useState(!1),[y,b]=A.useState({x:0,y:0}),[x,S]=A.useState({x:0,y:0,scale:1}),[C,w]=A.useState(),[ee,te]=A.useState(),[ne,re]=A.useState(null),D=A.useRef(null),ie=A.useRef(void 0),ae=A.useRef({x:0,y:0}),oe=A.useRef({x:0,y:0,scale:1}),se=A.useRef(void 0),le=A.useRef(0),de=A.useRef(!1),O=A.useRef({x:0,y:0}),fe=A.useRef(!1),pe=A.useRef({x:0,y:0}),me=A.useRef(null),he=A.useRef(null),ge=d.useState(`toastIndex`,n.id),_e=d.useState(`toastVisibleIndex`,n.id),ve=d.useState(`toastOffsetY`,n.id),ye=d.useState(`focused`),be=d.useState(`expanded`);ze({open:n.transitionStatus!==`ending`,ref:D,onComplete(){n.transitionStatus===`ending`&&d.removeToast(n.id)}});let xe=E((e=!1)=>{let t=D.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){d.updateToastInternal(n.id,{ref:D,height:i,transitionStatus:void 0})}e?it.flushSync(a):a()});m(()=>{let e=ie.current;(n.transitionStatus===`starting`||e!==n.id)&&(e!==void 0&&(p(void 0),S({x:0,y:0,scale:1}),Se({x:0,y:0})),ie.current=n.id,xe())},[xe,n.id,n.transitionStatus]);function Se(e){pe.current=e,b(e)}m(()=>()=>{he.current?.abort()},[]);function Ce(e,t){let n=e=>e>0?e**vt:-(Math.abs(e)**vt),r=e>0&&!l.includes(`right`)||e<0&&!l.includes(`left`),i=t>0&&!l.includes(`down`)||t<0&&!l.includes(`up`);return{x:r?n(e):e,y:i?n(t):t}}let we=E(e=>{if(e.pointerId!==me.current)return;me.current=null,he.current?.abort(),he.current=null,g(!1),v(!1),re(null);let t=oe.current;if(e.type===`pointercancel`||de.current){Se({x:t.x,y:t.y}),p(void 0);return}let r=pe.current,i=r.x-t.x,a=r.y-t.y,o;for(let e of l)if(ct(e,i,a)>gt){o=e;break}o?(p(o),d.closeToast(n.id)):(Se({x:t.x,y:t.y}),p(void 0))});function Te(e){if(e.button!==0||(e.pointerType===`touch`&&d.pauseTimers(),Ee(e.nativeEvent)?.closest(`button,a,input,textarea,[role="button"],${bt}`)))return;de.current=!1,se.current=void 0,le.current=0,me.current=e.pointerId,ae.current={x:e.clientX,y:e.clientY},O.current=ae.current;let t=e.currentTarget,n=st(t);oe.current=n,S(n),Se({x:n.x,y:n.y}),d.set(`hovering`,!0),g(!0),v(!1),re(null),fe.current=!0,he.current?.abort();let r=new AbortController;he.current=r;let i=ce(t);i.addEventListener(`pointerup`,we,{signal:r.signal}),i.addEventListener(`pointercancel`,we,{signal:r.signal}),t.setPointerCapture?.(e.pointerId)}function De(e){if(e.pointerId!==me.current)return;e.preventDefault(),fe.current&&=(ae.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>O.current.y||i>0&&t<O.current.y)&&(O.current={x:O.current.x,y:t}),(r<0&&n>O.current.x||r>0&&n<O.current.x)&&(O.current={x:n,y:O.current.y});let a=n-ae.current.x,o=t-ae.current.y,s=t-O.current.y,c=n-O.current.x,u=ne;if(!_&&Math.sqrt(a*a+o*o)>=yt){v(!0);let e=l.includes(`left`)||l.includes(`right`),t=l.includes(`up`)||l.includes(`down`);e&&t&&(u=Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`,re(u))}let d;if(!se.current)u===`vertical`?o>0?d=`down`:o<0&&(d=`up`):u===`horizontal`?a>0?d=`right`:a<0&&(d=`left`):d=Math.abs(a)>=Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`,d&&l.includes(d)&&(se.current=d,le.current=ct(d,a,o),p(d));else{let e=se.current,t=ct(e,c,s);t>gt?(de.current=!1,p(e)):!(l.includes(`left`)&&l.includes(`right`))&&!(l.includes(`up`)&&l.includes(`down`))&&le.current-t>=_t&&(de.current=!0)}let f=Ce(a,o),m=oe.current.x,h=oe.current.y,g=l.includes(`left`)||l.includes(`right`),y=l.includes(`up`)||l.includes(`down`);u!==`vertical`&&g&&(m+=f.x),u!==`horizontal`&&y&&(h+=f.y),Se({x:m,y:h})}function Oe(e){if(e.key===`Escape`){if(!D.current||!ue(D.current,Fe(ce(D.current))))return;d.closeToast(n.id)}}A.useEffect(()=>{let e=D.current;if(!u||!e)return;function t(t){me.current!==null&&ue(e,Ee(t))&&t.preventDefault()}return Ue(e,`touchmove`,t,{passive:!1})},[u]);function ke(){let e=y.x-x.x,t=y.y-x.y;return{transition:h?`none`:void 0,transform:h?`translateX(${y.x}px) translateY(${y.y}px) scale(${x.scale})`:void 0,[ft]:`${e}px`,[pt]:`${t}px`}}let Ae=n.priority===`high`,je={role:Ae?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":C,"aria-describedby":ee,"aria-hidden":Ae&&!ye?!0:void 0,onPointerDown:u?Te:void 0,onPointerMove:u?De:void 0,onPointerUp:u?we:void 0,onPointerCancel:u?we:void 0,onKeyDown:Oe,inert:Ve(n.limited),style:{...ke(),[lt]:n.transitionStatus===`ending`?ge:_e,[ut]:`${ve}px`,[dt]:n.height?`${n.height}px`:void 0}},Me=A.useMemo(()=>({toast:n,setTitleId:w,setDescriptionId:te,recalculateHeight:xe,visibleIndex:_e,expanded:be}),[n,w,te,xe,_e,be]),Ne={transitionStatus:n.transitionStatus,expanded:be,limited:n.limited||!1,type:n.type,swiping:h,swipeDirection:f},Pe=T(`div`,e,{ref:[t,D],state:Ne,stateAttributesMapping:ht,props:[je,s]});return(0,j.jsx)(at.Provider,{value:Me,children:Pe})}),St=A.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{visibleIndex:o,expanded:s,recalculateHeight:c}=ot(),l=A.useRef(null);return m(()=>{c();let e=l.current;if(!e||typeof ResizeObserver!=`function`||typeof MutationObserver!=`function`)return;let t=new ResizeObserver(()=>c(!0)),n=new MutationObserver(()=>c(!0));return t.observe(e),n.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{t.disconnect(),n.disconnect()}},[c]),T(`div`,e,{ref:[t,l],state:{expanded:s,behind:o>0},props:a})});function Ct(e){return e==null||typeof e==`boolean`||e===``?!1:!Array.isArray(e)||e.some(Ct)}function wt(e){return A.isValidElement(e)&&Ct(e.props.children)}function Tt(e,t,n){let{toast:r,setTitleId:i,setDescriptionId:a}=ot(),o=n===`title`?i:a,s=t??(n===`title`?r.title:r.description);return{id:fe(e),children:s,type:r.type,setId:o}}function Et(e,t,n){let r=wt(e);return m(()=>{if(r)return n(t),()=>{n(e=>e===t?void 0:e)}},[r,t,n]),r?e:null}var Dt=A.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,children:o,...s}=e,{id:c,children:l,type:u,setId:d}=Tt(a,o,`description`);return Et(T(`p`,e,{ref:t,state:{type:u},props:{...s,id:c,children:l}}),c,d)}),Ot=A.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,children:o,...s}=e,{id:c,children:l,type:u,setId:d}=Tt(a,o,`title`);return Et(T(`h2`,e,{ref:t,state:{type:u},props:{...s,id:c,children:l}}),c,d)}),kt=A.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a,nativeButton:o=!0,...s}=e,c=Ke(),{toast:l,expanded:u}=ot(),[d,f]=A.useState(!1),{getButtonProps:p,buttonRef:m}=Pe({disabled:a,native:o}),h={type:l.type};return T(`button`,e,{ref:[t,m],state:h,props:[{"aria-hidden":!u&&!d,onClick(){c.closeToast(l.id)},onFocus(){f(!0)},onBlur(){f(!1)}},s,p]})}),At=A.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a,nativeButton:o=!0,...s}=e,{toast:c}=ot(),l=c.actionProps?.children??s.children,{getButtonProps:u,buttonRef:d}=Pe({disabled:a,native:o}),f={type:c.type},p=T(`button`,e,{ref:[t,d],state:f,props:[s,c.actionProps,u,{children:l}]});return wt(p)?p:null}),jt=A.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:l,subtree:u}=c({container:r,ref:t,componentProps:e,elementProps:s});return!u&&!l?null:(0,j.jsxs)(A.Fragment,{children:[u,l&&it.createPortal(n,l)]})}),Mt=A.forwardRef(function(e,t){return(0,j.jsx)(jt,{ref:t,...e})});function Nt(){let e=Ke(),t=e.useState(`toasts`);return A.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function Pt(){let e=new Set;function t(t){e.forEach(e=>e(t))}return{" subscribe":function(t){return e.add(t),()=>{e.delete(t)}},add(e){let n=e.id||Je(`toast`);return t({action:`add`,options:{...e,id:n,transitionStatus:`starting`}}),n},close(e){t({action:`close`,options:{id:e}})},update(e,n){t({action:`update`,options:{id:e,updates:n}})},promise(e,n){let r=e;return t({action:`promise`,options:{...n,promise:e,setPromise(e){r=e}}}),r}}}var Ft={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};Ft.node;var It=p(Ft),Lt={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};Lt.node;var Rt=p(Lt),zt={name:`octagon-x`,size:24,node:[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-octagon`]};zt.node;var Bt=p(zt),Vt={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};Vt.node;var Ht=p(Vt),Ut={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};Ut.node;var Wt=p(Ut),Gt=Pt();function Kt({...e}){return(0,j.jsx)(et,{...e})}function qt({...e}){return(0,j.jsx)(Mt,{"data-slot":`toast-portal`,...e})}function Jt({className:e,...t}){return(0,j.jsx)(rt,{"data-slot":`toast-viewport`,className:w(`pointer-events-none fixed inset-x-4 bottom-4 z-50 mx-auto w-auto max-w-sm outline-none sm:right-4 sm:left-auto sm:mx-0 sm:w-full`,e),...t})}function Yt({className:e,...t}){return(0,j.jsx)(xt,{"data-slot":`toast`,className:w(`group/toast pointer-events-auto absolute right-0 bottom-0 z-[calc(1000-var(--toast-index))] w-full origin-bottom rounded-2xl! border bg-popover text-popover-foreground shadow-lg will-change-transform outline-none select-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`[--gap:0.75rem] [--height:var(--toast-frontmost-height,var(--toast-height))] [--offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))] [--peek:0.75rem] [--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))]`,`h-(--height) [transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))] [transition:transform_500ms_cubic-bezier(0.22,1,0.36,1),opacity_500ms,height_150ms]`,`after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']`,`data-expanded:h-(--toast-height) data-expanded:[transform:translateX(var(--toast-swipe-movement-x))_translateY(var(--offset-y))]`,`data-limited:opacity-0 data-starting-style:[transform:translateY(150%)]`,`[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]`,`data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]`,`data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]`,`data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]`,`data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]`,`data-expanded:data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]`,`data-expanded:data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]`,`data-expanded:data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]`,`data-expanded:data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]`,e),...t})}function Xt({className:e,...t}){return(0,j.jsx)(St,{"data-slot":`toast-content`,className:w(`flex h-full items-center gap-3 overflow-hidden p-4 transition-opacity duration-250 ease-[cubic-bezier(0.22,1,0.36,1)] data-behind:opacity-0 data-expanded:opacity-100`,e),...t})}function Zt({className:e,...t}){return(0,j.jsx)(Ot,{"data-slot":`toast-title`,className:w(`text-sm font-medium`,e),...t})}function Qt({className:e,...t}){return(0,j.jsx)(Dt,{"data-slot":`toast-description`,className:w(`text-sm text-muted-foreground`,e),...t})}function $t({className:e,render:t=(0,j.jsx)(_,{variant:`outline`,size:`sm`}),...n}){return(0,j.jsx)(At,{"data-slot":`toast-action`,render:t,className:w(`shrink-0`,e),...n})}function en({className:e,children:t,render:n=(0,j.jsx)(_,{variant:`ghost`,size:`icon-sm`}),...r}){return(0,j.jsx)(kt,{"data-slot":`toast-close`,"aria-label":`Close toast`,render:n,className:w(`relative shrink-0 text-muted-foreground after:absolute after:-inset-2 after:content-[''] hover:text-foreground`,e),...r,children:t??(0,j.jsx)(Wt,{"aria-hidden":`true`})})}function tn({type:e}){let t=null;return e===`success`&&(t=(0,j.jsx)(It,{"aria-hidden":`true`})),e===`info`&&(t=(0,j.jsx)(Rt,{"aria-hidden":`true`})),e===`warning`&&(t=(0,j.jsx)(Ht,{"aria-hidden":`true`})),e===`error`&&(t=(0,j.jsx)(Bt,{className:`text-destructive`,"aria-hidden":`true`})),e===`loading`&&(t=(0,j.jsx)(b,{className:`animate-spin`,"aria-hidden":`true`})),t?(0,j.jsx)(`span`,{"data-slot":`toast-icon`,className:`shrink-0 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,children:t}):null}function nn(){let{toasts:e}=Nt();return e.map(e=>(0,j.jsx)(Yt,{toast:e,children:(0,j.jsxs)(Xt,{children:[(0,j.jsx)(tn,{type:e.type}),(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,j.jsx)(Zt,{}),(0,j.jsx)(Qt,{})]}),(0,j.jsx)($t,{}),(0,j.jsx)(en,{})]})},e.id))}function rn({children:e,toastManager:t=Gt,...n}){return(0,j.jsxs)(Kt,{toastManager:t,...n,children:[e,(0,j.jsx)(qt,{children:(0,j.jsx)(Jt,{children:(0,j.jsx)(nn,{})})})]})}var an=ie(()=>globalThis.localStorage),on=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,sn=/^0(?:\.0+)?%?$/;function cn(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function ln(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;let n=t[1],r,i=1;return n.length===3?r=n.split(``).map(e=>e+e).join(``):n.length===6?r=n:(r=n.slice(0,6),i=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),i]}function M(e){if(e==null)return null;let t=ln(e);if(t==null)return null;let n=t[0]/255,r=t[1]/255,i=t[2]/255,a=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*a(n)+.7152*a(r)+.0722*a(i)}function un(e,t){let[n,r]=e>t?[e,t]:[t,e];return(n+.05)/(r+.05)}function dn(e,t){if(t==null)return;let n=ln(e),r=ln(t);if(n==null||r==null)return;let[i,a,o,s]=n,[c,l,u]=r;return`#`+[Math.round(i*s+c*(1-s)),Math.round(a*s+l*(1-s)),Math.round(o*s+u*(1-s))].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function fn(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||on.test(t))return!0;let n=cn(t);return n!=null&&sn.test(n)}function pn(e,t){let n=M(e);if(n!=null)return n<.4;let r=M(t);return r!=null&&r>.6}function mn(e,t){if(e==null||t==null)return!1;if(e.trim().toLowerCase()===t.trim().toLowerCase())return!0;let n=M(e),r=M(t);return n==null||r==null?!1:Math.abs(n-r)<.06}function hn(e,t,n){if(t==null||n==null)return!1;let r=M(e),i=M(t),a=M(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}function gn(e,t){let n=M(e),r=t.find(e=>e!=null&&e!==``);if(n==null)return r;let i,a=-1;for(let e of t){if(e==null||e===``)continue;let t=M(e);if(t==null)continue;let r=un(n,t);if(r>=3)return e;r>a&&(i=e,a=r)}return i??r}function _n(e,t){if(t==null)return e;let n=ln(e),r=ln(t),i=M(t);if(n==null||r==null||i==null)return`color-mix(in srgb, ${e} 70%, ${t})`;let[a,o,s]=n,[c,l,u]=r;for(let e of[.6,.7,.8,.9]){let t=`#`+[Math.round(a*e+c*(1-e)),Math.round(o*e+l*(1-e)),Math.round(s*e+u*(1-e))].map(e=>e.toString(16).padStart(2,`0`)).join(``),n=M(t);if(n!=null&&un(i,n)>=4.5)return t}return e}var vn=new WeakMap;function yn(e){let t=vn.get(e);if(t!=null)return t;let n=e.colors??{},r={...n},i=n[`editor.background`]??e.bg,a=n[`editor.foreground`]??e.fg,o=n[`sideBar.background`]??i,s=n[`sideBar.foreground`]??a;bn(r,`editor.background`,i),bn(r,`editor.foreground`,a),bn(r,`sideBar.background`,o),bn(r,`sideBar.foreground`,s),bn(r,`input.background`,n[`input.background`]??o),bn(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),bn(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),bn(r,`gitDecoration.addedResourceForeground`,xn(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),bn(r,`gitDecoration.modifiedResourceForeground`,xn(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),bn(r,`gitDecoration.deletedResourceForeground`,xn(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(fn(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(fn(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(Sn(l,o)||hn(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return vn.set(e,u),u}function bn(e,t,n){n!=null&&n!==``&&(e[t]=n)}function xn(...e){for(let t of e)if(t!=null&&t!==``)return t}function Sn(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function Cn(e){return e instanceof Error?e.message:`This file could not be loaded. Try again.`}function wn(e){return e instanceof Error&&e.name===`ConnectionError`?e.message:`This review surface could not be loaded. Try again.`}function Tn(e){let t=(0,A.useRef)(e);return(0,A.useInsertionEffect)(()=>void(t.current=e)),(0,A.useCallback)((...e)=>t.current(...e),[])}var En=(0,A.createContext)(void 0);function Dn({children:e,createEditor:t}){let n=Tn((e,n,r)=>t(e,n,r));return(0,j.jsx)(En.Provider,{value:n,children:e})}function On(){return(0,A.useContext)(En)}var kn={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},An={display:`contents`};function jn(){return null}var Mn=`diffs-container`,Nn=(()=>{try{return!1}catch{return!1}})(),Pn=/(?=^From [a-f0-9]+ .+$)/m,Fn=/(?=^diff --git)/gm,In=/(?<=\n)/,Ln=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Rn=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,zn=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Bn=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Vn=`header-prefix`,Hn=`header-filename-suffix`,Un=`header-metadata`,Wn=`header-custom`,Gn={dark:`pierre-dark`,light:`pierre-light`},Kn=`data-theme-css`,qn=`data-unsafe-css`,Jn=`data-diffs-scrollbar-measure`,Yn=`data-diffs-code-view-header`,Xn=`data-diffs-code-view-footer`,Zn=`--diffs-scrollbar-gutter-measured`,Qn=1e5,$n={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},er={...$n,hunkLineCount:1},tr={paddingTop:8,paddingBottom:8,gap:8},nr={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},rr=Object.freeze({fromStart:0,fromEnd:0}),ir={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},ar={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function or(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function sr(e,t){return e-(t===0?0:1)}function cr(e,t){return sr(e,t)+t}function lr({file:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,lineAnnotations:o,renderGutterUtility:s,getHoveredLine:c,getAnnotationSlotName:l=or}){let u=t?.(e),d=n?.(e),f=r?.(e),p=i?.(e);return(0,j.jsxs)(j.Fragment,{children:[u==null?(0,j.jsxs)(j.Fragment,{children:[d!=null&&(0,j.jsx)(`div`,{slot:`header-prefix`,children:d}),f!=null&&(0,j.jsx)(`div`,{slot:`header-filename-suffix`,children:f}),p!=null&&(0,j.jsx)(`div`,{slot:`header-metadata`,children:p})]}):(0,j.jsx)(`div`,{slot:Wn,children:u}),a!=null&&o?.map((e,t)=>(0,j.jsx)(`div`,{slot:l(e),children:a(e)},t)),s!=null&&(0,j.jsx)(`div`,{slot:`gutter-utility-slot`,style:kn,children:s(c)})]})}var ur=new Map,dr=new Map,fr=new Map,pr=new Set;function mr(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!pr.has(t))return!1;return!0}function hr(e=Gn){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}var gr=new Set;function _r(e){let t=[],n=new Set;for(let r of vr(e.themes)){let e=xr(r)?r.getThemes():[r];for(let r of e){if(n.has(r.name))throw Error(`Theme collection already contains theme "${r.name}"`);n.add(r.name),t.push(r)}}let r=Object.freeze([...t]),i=Object.freeze(r.filter(e=>e.colorScheme===`light`)),a=Object.freeze(r.filter(e=>e.colorScheme===`dark`)),o=new Map(r.map(e=>[e.name,e])),s=Object.freeze(r.map(e=>e.name)),c=Object.freeze(i.map(e=>e.name)),l=Object.freeze(a.map(e=>e.name));function u(e){if(e==null)return r;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?i:t===`dark`?a:r:r.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return o.get(e)},getThemes(e){return u(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?c:e?.colorScheme===`dark`?l:s:u(e).map(e=>e.name)},hasTheme(e){return o.has(e)},orderBy(e){return _r({themes:r.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],n=new Set;for(let r of e){if(n.has(r))throw Error(`Theme collection pick already includes theme "${r}"`);n.add(r);let e=o.get(r);if(e==null)throw Error(`Theme collection does not contain theme "${r}"`);t.push(e)}return _r({themes:t})},registerInto(e){for(let t of r)e.registerThemeIfAbsent(t.name,t.load)}}}function vr(e){return yr(e)?[e]:e}function yr(e){return xr(e)||br(e)}function br(e){return typeof e.name==`string`&&typeof e.load==`function`}function xr(e){return typeof e.getThemes==`function`}function Sr(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var Cr=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},wr=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},Tr=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function Er(){let e=new Map,t=new Map,n=new Map,r=0;function i(t,n){if(e.has(t))throw new Cr(t);e.set(t,n)}function a(t,n){return!e.has(t)&&(e.set(t,n),!0)}function o(t){return e.has(t)}function s(i){let a=t.get(i);if(a!==void 0)return Promise.resolve(a);let o=n.get(i);if(o!==void 0)return o;let s=e.get(i);if(s===void 0)return Promise.reject(new wr(i));let c=r,l=s().then(e=>{let a=Sr(e);return c===r&&t.set(i,a),n.get(i)===l&&n.delete(i),a}).catch(e=>{throw n.get(i)===l&&n.delete(i),e});return n.set(i,l),l}function c(e){return Promise.all(e.map(e=>s(e)))}function l(e,n){t.set(e,n)}function u(e){for(let[t,n]of e)l(t,n)}function d(e){return t.get(e)}function f(e){let n=[];for(let r of e){let e=t.get(r);if(e===void 0)throw new Tr(r);n.push(e)}return n}function p(e){return t.has(e)}function m(e){for(let n of e)if(!t.has(n))return!1;return!0}function h(e){let n=t.get(e);return n===void 0?s(e):n}function g(){r++,t.clear(),n.clear()}return{clearResolvedThemes:g,getResolvedOrResolveTheme:h,getResolvedTheme:d,getResolvedThemes:f,hasRegisteredTheme:o,hasResolvedTheme:p,hasResolvedThemes:m,registerTheme:i,registerThemeIfAbsent:a,resolveTheme:s,resolveThemes:c,seedResolvedTheme:l,seedResolvedThemes:u}}var Dr=Er();function Or(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=Dr.getResolvedTheme(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,Dr.getResolvedTheme(n)??Dr.seedResolvedTheme(n,e);gr.has(n)||(gr.add(n),t.loadThemeSync(e))}}function kr(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(pr.has(n.name))continue;let e=ur.get(n.name);e??(e=n,ur.set(n.name,e)),pr.add(e.name),t.loadLanguageSync(e.data)}}function Ar(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var jr=Object.defineProperty,Mr=Object.getOwnPropertyDescriptor,Nr=Object.getOwnPropertyNames,Pr=Object.prototype.hasOwnProperty,Fr=(e,t)=>{let n={};for(var r in e)jr(n,r,{get:e[r],enumerable:!0});return t||jr(n,Symbol.toStringTag,{value:`Module`}),n},Ir=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Nr(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Pr.call(e,s)&&s!==n&&jr(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Mr(t,s))||r.enumerable});return e},Lr=(e,t,n)=>(Ir(e,t,`default`),n&&Ir(n,t,`default`)),Rr=[{id:`abap`,name:`ABAP`,import:(()=>k(()=>import(`./abap-CLvhMVsD.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,aliases:[`actionscript`,`as3`],import:(()=>k(()=>import(`./actionscript-3-Cs6JJXT5.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>k(()=>import(`./ada-C5qYipkI.js`),[]))},{id:`ahk`,name:`AutoHotkey`,aliases:[`ahk1`],import:(()=>k(()=>import(`./ahk-CA9gdOdF.js`),[]))},{id:`ahk2`,name:`AutoHotkey2`,import:(()=>k(()=>import(`./ahk2-_6rzW9BS.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>k(()=>import(`./angular-html-B8mrqUL5.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3,4])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>k(()=>import(`./angular-ts-Bzix210W.js`),__vite__mapDeps([5,0,1,2,3,4,6])))},{id:`apache`,name:`Apache Conf`,import:(()=>k(()=>import(`./apache-U0d_L8uA.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>k(()=>import(`./apex-KFGFyKwG.js`),[]))},{id:`apl`,name:`APL`,import:(()=>k(()=>import(`./apl-Dhin1L29.js`),__vite__mapDeps([7,3,1,4,2,8,9,10])))},{id:`applescript`,name:`AppleScript`,import:(()=>k(()=>import(`./applescript-CCn79oCD.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>k(()=>import(`./ara-4CJ0cIlV.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>k(()=>import(`./asciidoc-SCjQUq34.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>k(()=>import(`./asm-Cmm7eHzH.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>k(()=>import(`./astro-B-4NNgOP.js`),__vite__mapDeps([11,3,1,4,10,12,13,14])))},{id:`awk`,name:`AWK`,import:(()=>k(()=>import(`./awk-BWXHIvNe.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>k(()=>import(`./ballerina-B7ZEbQpA.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`,`cmd`],import:(()=>k(()=>import(`./bat-qdxAdBWQ.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>k(()=>import(`./beancount-D-usSTwE.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>k(()=>import(`./berry-DKpUyyne.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>k(()=>import(`./bibtex-Ci_nEsc7.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>k(()=>import(`./bicep-CUHmPFLl.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>k(()=>import(`./bird2-CYIUgYqB.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>k(()=>import(`./blade-C6Gedziy.js`),__vite__mapDeps([15,3,1,4,2,8,9,10,16,17])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>k(()=>import(`./bsl-_VjlB9mv.js`),__vite__mapDeps([18,19])))},{id:`c`,name:`C`,import:(()=>k(()=>import(`./c-iCihek07.js`).then(e=>e.n),__vite__mapDeps([20,1])))},{id:`c3`,name:`C3`,import:(()=>k(()=>import(`./c3-D0apG41V.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>k(()=>import(`./cadence-CQ2zXKGN.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>k(()=>import(`./cairo-DLTphjLi.js`),__vite__mapDeps([21,22])))},{id:`chapel`,name:`Chapel`,aliases:[`chpl`],import:(()=>k(()=>import(`./chapel-DmtgEXO_.js`),__vite__mapDeps([23,20,1])))},{id:`clarity`,name:`Clarity`,import:(()=>k(()=>import(`./clarity-CtfBBspg.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>k(()=>import(`./clojure-DqKBuwfJ.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>k(()=>import(`./cmake-Bj61d0ZC.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>k(()=>import(`./cobol-Cw2-KvLW.js`),__vite__mapDeps([24,2,1,3,4,9])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>k(()=>import(`./codeowners-C8r90Shi.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>k(()=>import(`./codeql-oeQT6MSM.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>k(()=>import(`./coffee-CiiSLhB6.js`),__vite__mapDeps([25,3,1])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>k(()=>import(`./common-lisp-Cv5bFMCO.js`),[]))},{id:`coq`,name:`Rocq`,import:(()=>k(()=>import(`./coq-DuBRPxYg.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>k(()=>import(`./cpp-71xkOQct.js`).then(e=>e.n),__vite__mapDeps([26,1,27,28,20])))},{id:`crystal`,name:`Crystal`,import:(()=>k(()=>import(`./crystal-DGPAtLeY.js`),__vite__mapDeps([29,3,1,4,2,17,20,30])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>k(()=>import(`./csharp-oqKa8noW.js`),[]))},{id:`css`,name:`CSS`,import:(()=>k(()=>import(`./css-CNuuLpMC.js`).then(e=>e.n),__vite__mapDeps([4,1])))},{id:`csv`,name:`CSV`,import:(()=>k(()=>import(`./csv-Dx-8-gkx.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>k(()=>import(`./cue-CE9AQfxI.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>k(()=>import(`./cypher-ClKdZ_lG.js`),[]))},{id:`d`,name:`D`,import:(()=>k(()=>import(`./d-qD-0Kul2.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>k(()=>import(`./dart-CnvKMtbv.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>k(()=>import(`./dax-BkyTk9wS.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>k(()=>import(`./desktop-Dlh5hvp9.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>k(()=>import(`./diff-woXpYk--.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>k(()=>import(`./docker-IyjqRm3v.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>k(()=>import(`./dotenv-_5a1GRtc.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>k(()=>import(`./dream-maker-DW3nJb8Q.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>k(()=>import(`./edge-DCY0a-ow.js`),__vite__mapDeps([31,2,1,3,4,12,16])))},{id:`elixir`,name:`Elixir`,import:(()=>k(()=>import(`./elixir-DP304Xio.js`),__vite__mapDeps([32,2,1,3,4])))},{id:`elm`,name:`Elm`,import:(()=>k(()=>import(`./elm-o4NJxfws.js`),__vite__mapDeps([33,28,1,20])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>k(()=>import(`./emacs-lisp-c_oH4hRZ.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>k(()=>import(`./erb-C7MPl934.js`),__vite__mapDeps([34,2,1,3,4,35,8,9,17,20,26,27,28,30,36,37,12,14,38,39,40])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>k(()=>import(`./erlang-Cphh6RMH.js`),__vite__mapDeps([41,42])))},{id:`fennel`,name:`Fennel`,import:(()=>k(()=>import(`./fennel-DQxkIbk2.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>k(()=>import(`./fish-BJitypiv.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>k(()=>import(`./fluent-C03EYrpw.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>k(()=>import(`./fortran-fixed-form-DEKoE2YW.js`),__vite__mapDeps([43,44])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>k(()=>import(`./fortran-free-form-CYNrtFtB.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>k(()=>import(`./fsharp-D13ZGOAj.js`),__vite__mapDeps([45,42])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>k(()=>import(`./gdresource-xMC7jr7x.js`),__vite__mapDeps([46,47,48])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>k(()=>import(`./gdscript-DYvRD3hg.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>k(()=>import(`./gdshader-CBce3t8t.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>k(()=>import(`./genie-CV2tkWYe.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>k(()=>import(`./gherkin-DExj1W_8.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>k(()=>import(`./git-commit-BSykSTBG.js`),__vite__mapDeps([49,50])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>k(()=>import(`./git-rebase-BDPpS8w6.js`),__vite__mapDeps([51,30,1])))},{id:`gleam`,name:`Gleam`,import:(()=>k(()=>import(`./gleam-CSRkHgEL.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>k(()=>import(`./glimmer-js-BONyzAsu.js`),__vite__mapDeps([52,3,1,4,2,12])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>k(()=>import(`./glimmer-ts-f9c0GCOe.js`),__vite__mapDeps([53,3,1,4,2,12])))},{id:`glsl`,name:`GLSL`,import:(()=>k(()=>import(`./glsl-D5MA2a_X.js`).then(e=>e.n),__vite__mapDeps([28,1,20])))},{id:`gn`,name:`GN`,import:(()=>k(()=>import(`./gn-ilITqXS6.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>k(()=>import(`./gnuplot-7GGW24-e.js`),[]))},{id:`go`,name:`Go`,import:(()=>k(()=>import(`./go-rLFTqkRN.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>k(()=>import(`./graphql-Ctjuxyvl.js`).then(e=>e.n),__vite__mapDeps([37,1,3,12,14,38])))},{id:`groovy`,name:`Groovy`,import:(()=>k(()=>import(`./groovy-CacY0gHj.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>k(()=>import(`./hack-Dh_ZLRbs.js`),__vite__mapDeps([54,2,1,3,4,17])))},{id:`haml`,name:`Ruby Haml`,import:(()=>k(()=>import(`./haml-CwEpbK1d.js`).then(e=>e.n),__vite__mapDeps([36,1,3,4])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>k(()=>import(`./handlebars-ryMP1rBR.js`),__vite__mapDeps([55,3,1,4,2,40])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>k(()=>import(`./haskell-D8IpX4py.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>k(()=>import(`./haxe-C8oCnwJJ.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>k(()=>import(`./hcl-Dh228itO.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>k(()=>import(`./hjson-CxZEssPk.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>k(()=>import(`./hlsl-Cvrh5tZx.js`),[]))},{id:`html`,name:`HTML`,import:(()=>k(()=>import(`./html-XwrE-1r6.js`).then(e=>e.n),__vite__mapDeps([2,1,3,4])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>k(()=>import(`./html-derivative-i4STDFnl.js`),__vite__mapDeps([16,2,1,3,4])))},{id:`http`,name:`HTTP`,import:(()=>k(()=>import(`./http-kmH8AyfE.js`),__vite__mapDeps([56,8,1,9,10,30,37,3,12,14,38])))},{id:`hurl`,name:`Hurl`,import:(()=>k(()=>import(`./hurl-DCZHXKU4.js`),__vite__mapDeps([57,8,1,9,58,37,3,12,14,38])))},{id:`hxml`,name:`HXML`,import:(()=>k(()=>import(`./hxml-Dcm88srW.js`),__vite__mapDeps([59,60])))},{id:`hy`,name:`Hy`,import:(()=>k(()=>import(`./hy-CZbG8q4J.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>k(()=>import(`./imba-DsUTQ-LC.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>k(()=>import(`./ini-B5eOa1yu.js`),[]))},{id:`java`,name:`Java`,import:(()=>k(()=>import(`./java-DdHNQ9hk.js`).then(e=>e.n),__vite__mapDeps([9,1])))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>k(()=>import(`./javascript-obGGvMPs.js`).then(e=>e.n),__vite__mapDeps([3,1])))},{id:`jinja`,name:`Jinja`,import:(()=>k(()=>import(`./jinja-B-tLrNsM.js`),__vite__mapDeps([61,2,1,3,4])))},{id:`jison`,name:`Jison`,import:(()=>k(()=>import(`./jison-CBjhYtSs.js`),__vite__mapDeps([62,3,1])))},{id:`json`,name:`JSON`,import:(()=>k(()=>import(`./json-DAgxKhMr.js`).then(e=>e.n),__vite__mapDeps([10,1])))},{id:`json5`,name:`JSON5`,import:(()=>k(()=>import(`./json5-BR5RXkoi.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>k(()=>import(`./jsonc-CYpm1nAK.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>k(()=>import(`./jsonl-CmCQp5Yx.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>k(()=>import(`./jsonnet-CJTPZ8u_.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>k(()=>import(`./jssm-DXw9l8Rf.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>k(()=>import(`./jsx-gTgmArGx.js`).then(e=>e.n),__vite__mapDeps([38,1])))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>k(()=>import(`./julia-CXJVy74_.js`),__vite__mapDeps([63,3,1,17,22,26,27,28,20,64])))},{id:`just`,name:`Just`,aliases:[`justfile`],import:(()=>k(()=>import(`./just-B9Xn_Dp4.js`),__vite__mapDeps([65,3,1,12,22,30,35,4,2,8,9,17,20,26,27,28,36,37,14,38,39,40,66])))},{id:`kdl`,name:`KDL`,import:(()=>k(()=>import(`./kdl-CsD5j6eV.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>k(()=>import(`./kotlin-DhhofPvG.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>k(()=>import(`./kusto-C7mF5XQf.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>k(()=>import(`./latex-o9DRzaEe.js`),__vite__mapDeps([67,68,1,64])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>k(()=>import(`./lean-CewbzKMR.js`),[]))},{id:`less`,name:`Less`,import:(()=>k(()=>import(`./less-DVTAwKKz.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>k(()=>import(`./liquid-G0MH4h_m.js`),__vite__mapDeps([69,3,1,4,2,10])))},{id:`llvm`,name:`LLVM IR`,import:(()=>k(()=>import(`./llvm-DqHOMS-s.js`),[]))},{id:`log`,name:`Log file`,import:(()=>k(()=>import(`./log-BNLmms1o.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>k(()=>import(`./logo-Cluzi2Zq.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>k(()=>import(`./lua-FONpmTUP.js`).then(e=>e.n),__vite__mapDeps([39,1,20])))},{id:`luau`,name:`Luau`,import:(()=>k(()=>import(`./luau-C2pBCSgt.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>k(()=>import(`./make-Dixweg8N.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>k(()=>import(`./markdown-BYOwaDjH.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>k(()=>import(`./marko-DV5GrDmo.js`),__vite__mapDeps([70,4,1,6,12,71])))},{id:`matlab`,name:`MATLAB`,import:(()=>k(()=>import(`./matlab-D7qyCx1q.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>k(()=>import(`./mdc-BKfPFPZw.js`),__vite__mapDeps([72,16,2,1,3,4,40,42])))},{id:`mdx`,name:`MDX`,import:(()=>k(()=>import(`./mdx-DQZ5AkYe.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>k(()=>import(`./mermaid-BxpfTIzt.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>k(()=>import(`./mipsasm-BMqwQI7S.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>k(()=>import(`./mojo-fg40_ntQ.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>k(()=>import(`./moonbit-DgjMoLWr.js`),[]))},{id:`move`,name:`Move`,import:(()=>k(()=>import(`./move-BYnGhZoM.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>k(()=>import(`./narrat-_X_XdTYD.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>k(()=>import(`./nextflow-BJtWHP5T.js`),__vite__mapDeps([73,74])))},{id:`nextflow-groovy`,name:`Nextflow Groovy`,import:(()=>k(()=>import(`./nextflow-groovy-DJMQeKeT.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>k(()=>import(`./nginx-BTMw9COX.js`),__vite__mapDeps([75,39,1,20])))},{id:`nim`,name:`Nim`,import:(()=>k(()=>import(`./nim-B6yJ_yaC.js`),__vite__mapDeps([76,3,1,4,2,8,9,20,28,42])))},{id:`nix`,name:`Nix`,import:(()=>k(()=>import(`./nix-IvuFDN5E.js`),[]))},{id:`nsis`,name:`NSIS`,import:(()=>k(()=>import(`./nsis-CjNLYCLg.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>k(()=>import(`./nushell-DHYfO66s.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>k(()=>import(`./objective-c-D1A_Heim.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>k(()=>import(`./objective-cpp-BsSzOQcm.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>k(()=>import(`./ocaml-O90oeIOV.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>k(()=>import(`./odin-B1RWQWA5.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>k(()=>import(`./openscad-BUDT5pXO.js`),[]))},{id:`org`,name:`Org Markup`,import:(()=>k(()=>import(`./org-Ddi8Gs6E.js`),__vite__mapDeps([77,3,1,4,2,6,9,8,10,12,14,17,20,22,78,25,27,26,28,30,79,80,50,81,32,39,40,35,36,37,38,42,41,49,51,82,83,84,64,66,67,68,71,85,76,86,87,88,89,90,91,92,93,94])))},{id:`pascal`,name:`Pascal`,import:(()=>k(()=>import(`./pascal-4ZHwLPI5.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>k(()=>import(`./perl-DEgXgjuC.js`),__vite__mapDeps([66,3,1,4,2,8,9,17])))},{id:`php`,name:`PHP`,import:(()=>k(()=>import(`./php-B9UPq-vz.js`),__vite__mapDeps([88,3,1,4,2,8,9,10,17])))},{id:`pkl`,name:`Pkl`,import:(()=>k(()=>import(`./pkl-ot-7Btpt.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>k(()=>import(`./plsql-DGHpHOYJ.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>k(()=>import(`./po-BiJDBrnU.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>k(()=>import(`./polar-C7UOKdEL.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>k(()=>import(`./postcss-BXeXVLqQ.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>k(()=>import(`./powerquery-DNMTfnFr.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`,`pwsh`],import:(()=>k(()=>import(`./powershell-CCSX75yM.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>k(()=>import(`./prisma-DMgNhnYS.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>k(()=>import(`./prolog-iXnhIJG7.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>k(()=>import(`./proto-DB4EqR-F.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>k(()=>import(`./pug-DkgDHZci.js`),__vite__mapDeps([95,3,1,4,2])))},{id:`puppet`,name:`Puppet`,import:(()=>k(()=>import(`./puppet-CDv2pdJW.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>k(()=>import(`./purescript-9MfHhQsQ.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>k(()=>import(`./python-gzcpVVnB.js`),[]))},{id:`qml`,name:`QML`,import:(()=>k(()=>import(`./qml-_a-QhfPD.js`),__vite__mapDeps([96,3,1])))},{id:`qmldir`,name:`QML Directory`,import:(()=>k(()=>import(`./qmldir-DCQb3MpD.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>k(()=>import(`./qss-Fe1Jh2GI.js`),[]))},{id:`r`,name:`R`,import:(()=>k(()=>import(`./r-BHcO8Vjq.js`).then(e=>e.n),__vite__mapDeps([64,1])))},{id:`racket`,name:`Racket`,import:(()=>k(()=>import(`./racket-DcIDlBhZ.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>k(()=>import(`./raku-B3gFvitq.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>k(()=>import(`./razor-BMJ0eI3p.js`),__vite__mapDeps([97,2,1,3,4,79])))},{id:`rbs`,name:`RBS`,aliases:[`ruby-signature`],import:(()=>k(()=>import(`./rbs-C0MpOrj4.js`),[]))},{id:`reg`,name:`Windows Registry Script`,import:(()=>k(()=>import(`./reg-CRGYupPL.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>k(()=>import(`./regexp-DR20uMnK.js`).then(e=>e.n),__vite__mapDeps([27,1])))},{id:`rel`,name:`Rel`,import:(()=>k(()=>import(`./rel-BtDbiS_P.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>k(()=>import(`./riscv-Ckw8ddFX.js`),[]))},{id:`ron`,name:`RON`,import:(()=>k(()=>import(`./ron-VUp2lXgN.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>k(()=>import(`./rosmsg-CAekHB0j.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>k(()=>import(`./rst-BQCbfb9V.js`),__vite__mapDeps([98,3,1,16,2,4,22,99,26,27,28,20,30,40,35,8,9,17,36,37,12,14,38,39])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>k(()=>import(`./ruby-B8JcIHv0.js`),__vite__mapDeps([35,3,1,4,2,8,9,17,20,26,27,28,30,36,37,12,14,38,39,40])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>k(()=>import(`./rust-Cfkwpbl8.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>k(()=>import(`./sas-CBpMWA2M.js`),__vite__mapDeps([100,17,1])))},{id:`sass`,name:`Sass`,import:(()=>k(()=>import(`./sass-DXrisJhu.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>k(()=>import(`./scala-BiFt_7mu.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>k(()=>import(`./scheme-DQCgrYNe.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>k(()=>import(`./scss-YesllqfO.js`).then(e=>e.n),__vite__mapDeps([6,1,4])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>k(()=>import(`./sdbl-bTVj8UrX.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>k(()=>import(`./shaderlab-TOUzSsQk.js`),__vite__mapDeps([101,102])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>k(()=>import(`./shellscript-Da78Ox-3.js`).then(e=>e.n),__vite__mapDeps([30,1])))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>k(()=>import(`./shellsession-CVsQGYfZ.js`),__vite__mapDeps([103,30,1])))},{id:`smalltalk`,name:`GNU Smalltalk`,import:(()=>k(()=>import(`./smalltalk-BHpQb5nM.js`),[]))},{id:`smithy`,name:`Smithy`,import:(()=>k(()=>import(`./smithy-Dgaz7aur.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>k(()=>import(`./solidity-Bj7E1mRn.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>k(()=>import(`./soy-DEd-qcad.js`),__vite__mapDeps([104,2,1,3,4])))},{id:`sparql`,name:`SPARQL`,import:(()=>k(()=>import(`./sparql-D_iOobhT.js`),__vite__mapDeps([105,106])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>k(()=>import(`./splunk-BC2Px7Mm.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>k(()=>import(`./sql-DdD7vxS4.js`).then(e=>e.n),__vite__mapDeps([17,1])))},{id:`ssh-config`,name:`SSH Config`,import:(()=>k(()=>import(`./ssh-config-BgfXC-Er.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>k(()=>import(`./stata-CMv7m7Gi.js`),__vite__mapDeps([107,17,1])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>k(()=>import(`./stylus-B6D30XZt.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>k(()=>import(`./surrealql-BZoq2lXR.js`),__vite__mapDeps([108,3,1])))},{id:`svelte`,name:`Svelte`,import:(()=>k(()=>import(`./svelte-Bj3Hmc9F.js`),__vite__mapDeps([109,3,1,4,12,13])))},{id:`swift`,name:`Swift`,import:(()=>k(()=>import(`./swift-CyEgAFGc.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>k(()=>import(`./system-verilog-Dh5ihWbf.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>k(()=>import(`./systemd-BxMlprV5.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>k(()=>import(`./talonscript-CohzipZa.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>k(()=>import(`./tasl-DMoTqEGO.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>k(()=>import(`./tcl-CZd0xW_V.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>k(()=>import(`./templ-TjxbArHn.js`),__vite__mapDeps([110,3,1,4,82])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>k(()=>import(`./terraform-DswuEJGm.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>k(()=>import(`./tex-BK-H2Wn4.js`).then(e=>e.n),__vite__mapDeps([68,1,64])))},{id:`toml`,name:`TOML`,import:(()=>k(()=>import(`./toml-CcmNWLt0.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>k(()=>import(`./ts-tags-Cc5do7zu.js`),__vite__mapDeps([111,3,1,4,2,8,9,12,17,28,20])))},{id:`tsv`,name:`TSV`,import:(()=>k(()=>import(`./tsv-sltzmVWM.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>k(()=>import(`./tsx-CUOciP0b.js`).then(e=>e.n),__vite__mapDeps([14,1])))},{id:`turtle`,name:`Turtle`,import:(()=>k(()=>import(`./turtle-ByJddavk.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>k(()=>import(`./twig-BVSnuTf-.js`),__vite__mapDeps([112,3,1,4,6,22,35,2,8,9,17,20,26,27,28,30,36,37,12,14,38,39,40,88,10])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>k(()=>import(`./typescript-BydbNFcO.js`).then(e=>e.n),__vite__mapDeps([12,1])))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>k(()=>import(`./typespec-BRdr0IET.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>k(()=>import(`./typst-C40W_gC6.js`),__vite__mapDeps([113,3,1,4,2,6,9,8,10,12,14,114,115,17,20,22,78,25,27,26,28,30,79,80,50,81,32,39,40,35,36,37,38,42,41,45,49,51,82,83,55,84,116,64,63,66,67,68,71,117,85,86,88,89,90,91,92,94,118,95,119,120,112,121])))},{id:`v`,name:`V`,import:(()=>k(()=>import(`./v-DBj4K9d_.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>k(()=>import(`./vala-zf12oZj6.js`),[]))},{id:`vb`,name:`Visual Basic`,import:(()=>k(()=>import(`./vb-DOwzaHZ0.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>k(()=>import(`./verilog-B2gwz-sJ.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>k(()=>import(`./vhdl-BroJfC0k.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>k(()=>import(`./viml-DvXPmvsu.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>k(()=>import(`./vue-BNQF7r6F.js`),__vite__mapDeps([122,3,1,4,2,10,12,16])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>k(()=>import(`./vue-html-DkKkQnZL.js`),__vite__mapDeps([123,3,1])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>k(()=>import(`./vue-vine-DFaKYU4X.js`),__vite__mapDeps([124,3,1,4,6,13,71,125])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>k(()=>import(`./vyper-CgoNMtux.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>k(()=>import(`./wasm-ByWQv1Qj.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>k(()=>import(`./wenyan-C8pVoKbM.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>k(()=>import(`./wgsl-BsKzXJz4.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>k(()=>import(`./wikitext-ClFFjSW2.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>k(()=>import(`./wit-DdvCle-K.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>k(()=>import(`./wolfram-DLL8P-h_.js`),[]))},{id:`xml`,name:`XML`,import:(()=>k(()=>import(`./xml-BlnrEAEy.js`).then(e=>e.n),__vite__mapDeps([8,1,9])))},{id:`xsl`,name:`XSL`,import:(()=>k(()=>import(`./xsl-BOPS8gLt.js`),__vite__mapDeps([94,8,1,9])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>k(()=>import(`./yaml-Du_6cdrH.js`).then(e=>e.n),__vite__mapDeps([40,1])))},{id:`zenscript`,name:`ZenScript`,import:(()=>k(()=>import(`./zenscript-BnlCZFoB.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>k(()=>import(`./zig-CMLA9XwU.js`),[]))}],zr=Object.fromEntries(Rr.map(e=>[e.id,e.import])),Br=Object.fromEntries(Rr.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),Vr={...zr,...Br},Hr=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>k(()=>import(`./andromeeda-vGVdxbeo.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>k(()=>import(`./aurora-x-CDeNXAV0.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>k(()=>import(`./ayu-dark-DluEY0Gj.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>k(()=>import(`./ayu-light-C3h-C4tm.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>k(()=>import(`./ayu-mirage-Bqwy1Gya.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>k(()=>import(`./catppuccin-frappe-C9Q5zVZY.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>k(()=>import(`./catppuccin-latte-CtsyrtPq.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>k(()=>import(`./catppuccin-macchiato-R8nAf1vR.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>k(()=>import(`./catppuccin-mocha-DjuaAJKi.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>k(()=>import(`./dark-plus-Cs2F2srj.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>k(()=>import(`./dracula-BHWKrbxM.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>k(()=>import(`./dracula-soft-5eyTD99u.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>k(()=>import(`./everforest-dark-sB-x3p7T.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>k(()=>import(`./everforest-light-Df2xbC6M.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>k(()=>import(`./github-dark-C-LZuMrd.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>k(()=>import(`./github-dark-default-DXG-b-1a.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>k(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>k(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>k(()=>import(`./github-light-EUqPIrTm.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>k(()=>import(`./github-light-default-BXViO-2h.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>k(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>k(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>k(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>k(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>k(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>k(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>k(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>k(()=>import(`./horizon-CE9ld1lL.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`light`,import:(()=>k(()=>import(`./horizon-bright-DSNQnXHK.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>k(()=>import(`./houston-CsvMBhTu.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>k(()=>import(`./kanagawa-dragon-Bozd7klA.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>k(()=>import(`./kanagawa-lotus-BmuOG9ZW.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>k(()=>import(`./kanagawa-wave-BML5mF2J.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>k(()=>import(`./laserwave-C_8bwKvT.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>k(()=>import(`./light-plus-DVQuIRkW.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>k(()=>import(`./material-theme-Bm3Qr25_.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>k(()=>import(`./material-theme-darker-2IIEA8gg.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>k(()=>import(`./material-theme-lighter-uhdI0v04.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>k(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>k(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>k(()=>import(`./min-dark-BSWPekZh.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>k(()=>import(`./min-light-DDpmG2fV.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>k(()=>import(`./monokai-B_bV9PQ9.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>k(()=>import(`./night-owl-DhmEMT88.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>k(()=>import(`./night-owl-light-eJ-hLW7d.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>k(()=>import(`./nord-Cb4Vim4T.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>k(()=>import(`./one-dark-pro-CLwyXe_n.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>k(()=>import(`./one-light-D7Lr4KcI.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>k(()=>import(`./plastic-DQwYfKfQ.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>k(()=>import(`./poimandres-DRFjx7u4.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>k(()=>import(`./red-DX1BQOs8.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>k(()=>import(`./rose-pine-aMsaMD1D.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>k(()=>import(`./rose-pine-dawn-8PwUyIlP.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>k(()=>import(`./rose-pine-moon-DO-qXg-I.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>k(()=>import(`./slack-dark-DnToyrRv.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>k(()=>import(`./slack-ochin-B2OO5cIa.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>k(()=>import(`./snazzy-light-4G7pJPwS.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>k(()=>import(`./solarized-dark-UdsmMDCL.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>k(()=>import(`./solarized-light-C1IUL_tW.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>k(()=>import(`./synthwave-84-nFMaYfgc.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>k(()=>import(`./tokyo-night-oM2G3aXe.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>k(()=>import(`./vesper-DdrHHSXu.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>k(()=>import(`./vitesse-black-fwtXNY1n.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>k(()=>import(`./vitesse-dark-BZCL-v6S.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>k(()=>import(`./vitesse-light-VbXTXTou.js`),[]))}].map(e=>[e.id,e.import])),Ur=e({createOnigurumaEngine:()=>hi,getDefaultWasmLoader:()=>mi,loadWasm:()=>ci,setDefaultWasmLoader:()=>pi}),Wr=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Gr(){return 2147483648}function Kr(){return typeof performance<`u`?performance.now():Date.now()}var qr=(e,t)=>e+(t-e%t)%t;async function Jr(e){let t,n,r={};function i(e){n=e,r.HEAPU8=new Uint8Array(e),r.HEAPU32=new Uint32Array(e)}function a(e,t,n){r.HEAPU8.copyWithin(e,t,t+n)}function o(e){try{return t.grow(e-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function s(e){let t=r.HEAPU8.length;e>>>=0;let n=Gr();if(e>n)return!1;for(let r=1;r<=4;r*=2){let i=t*(1+.2/r);if(i=Math.min(i,e+100663296),o(Math.min(n,qr(Math.max(e,i),65536))))return!0}return!1}let c=typeof TextDecoder<`u`?new TextDecoder(`utf8`):void 0;function l(e,t,n=1024){let r=t+n,i=t;for(;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&c)return c.decode(e.subarray(t,i));let a=``;for(;t<i;){let n=e[t++];if(!(n&128)){a+=String.fromCharCode(n);continue}let r=e[t++]&63;if((n&224)==192){a+=String.fromCharCode((n&31)<<6|r);continue}let i=e[t++]&63;if(n=(n&240)==224?(n&15)<<12|r<<6|i:(n&7)<<18|r<<12|i<<6|e[t++]&63,n<65536)a+=String.fromCharCode(n);else{let e=n-65536;a+=String.fromCharCode(55296|e>>10,56320|e&1023)}}return a}function u(e,t){return e?l(r.HEAPU8,e,t):``}let d={emscripten_get_now:Kr,emscripten_memcpy_big:a,emscripten_resize_heap:s,fd_write:()=>0};async function f(){let n=await e({env:d,wasi_snapshot_preview1:d});t=n.memory,i(t.buffer),Object.assign(r,n),r.UTF8ToString=u}return await f(),r}var Yr=Object.defineProperty,Xr=(e,t,n)=>t in e?Yr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,N=(e,t,n)=>Xr(e,typeof t==`symbol`?t:t+``,n),P=null;function Zr(e){throw new Wr(e.UTF8ToString(e.getLastOnigError()))}var Qr=class e{constructor(t){N(this,`utf16Length`),N(this,`utf8Length`),N(this,`utf16Value`),N(this,`utf8Value`),N(this,`utf16OffsetToUtf8`),N(this,`utf8OffsetToUtf16`);let n=t.length,r=e._utf8ByteLength(t),i=r!==n,a=i?new Uint32Array(n+1):null;i&&(a[n]=r);let o=i?new Uint32Array(r+1):null;i&&(o[r]=n);let s=new Uint8Array(r),c=0;for(let e=0;e<n;e++){let r=t.charCodeAt(e),l=r,u=!1;if(r>=55296&&r<=56319&&e+1<n){let n=t.charCodeAt(e+1);n>=56320&&n<=57343&&(l=(r-55296<<10)+65536|n-56320,u=!0)}i&&(a[e]=c,u&&(a[e+1]=c),l<=127?o[c+0]=e:l<=2047?(o[c+0]=e,o[c+1]=e):l<=65535?(o[c+0]=e,o[c+1]=e,o[c+2]=e):(o[c+0]=e,o[c+1]=e,o[c+2]=e,o[c+3]=e)),l<=127?s[c++]=l:l<=2047?(s[c++]=192|(l&1984)>>>6,s[c++]=128|(l&63)>>>0):l<=65535?(s[c++]=224|(l&61440)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0):(s[c++]=240|(l&1835008)>>>18,s[c++]=128|(l&258048)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0),u&&e++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=a,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,r=e.length;n<r;n++){let i=e.charCodeAt(n),a=i,o=!1;if(i>=55296&&i<=56319&&n+1<r){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}t+=a<=127?1:a<=2047?2:a<=65535?3:4,o&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}},$r=class e{constructor(t){if(N(this,`id`,++e.LAST_ID),N(this,`_onigBinding`),N(this,`content`),N(this,`utf16Length`),N(this,`utf8Length`),N(this,`utf16OffsetToUtf8`),N(this,`utf8OffsetToUtf16`),N(this,`ptr`),!P)throw new Wr(`Must invoke loadWasm first.`);this._onigBinding=P,this.content=t;let n=new Qr(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=P.omalloc(1e4),e._sharedPtrInUse=!0,P.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(P)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};N($r,`LAST_ID`,0),N($r,`_sharedPtr`,0),N($r,`_sharedPtrInUse`,!1);var ei=$r,ti=class{constructor(e){if(N(this,`_onigBinding`),N(this,`_ptr`),!P)throw new Wr(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new Qr(e[r]);t[r]=i.createString(P),n[r]=i.utf8Length}let r=P.omalloc(4*e.length);P.HEAPU32.set(t,r/4);let i=P.omalloc(4*e.length);P.HEAPU32.set(n,i/4);let a=P.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)P.ofree(t[n]);P.ofree(i),P.ofree(r),a===0&&Zr(P),this._onigBinding=P,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let r=0;if(typeof n==`number`&&(r=n),typeof e==`string`){e=new ei(e);let n=this._findNextMatchSync(e,t,!1,r);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,r)}_findNextMatchSync(e,t,n,r){let i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),r);if(a===0)return null;let o=i.HEAPU32,s=a/4,c=o[s++],l=o[s++],u=[];for(let t=0;t<l;t++){let n=e.convertUtf8OffsetToUtf16(o[s++]),r=e.convertUtf8OffsetToUtf16(o[s++]);u[t]={start:n,end:r,length:r-n}}return{index:c,captureIndices:u}}};function ni(e){return typeof e.instantiator==`function`}function ri(e){return typeof e.default==`function`}function ii(e){return e.data!==void 0}function ai(e){return typeof Response<`u`&&e instanceof Response}function oi(e){return typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<`u`&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||typeof Uint32Array<`u`&&e instanceof Uint32Array}var si;function ci(e){if(si)return si;async function t(){P=await Jr(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),ni(n)?n=await n.instantiator(t):ri(n)?n=await n.default(t):(ii(n)&&(n=n.data),ai(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await ui(n)(t):await di(n)(t):oi(n)||n instanceof WebAssembly.Module?n=await li(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await li(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return si=t(),si}function li(e){return t=>WebAssembly.instantiate(e,t)}function ui(e){return t=>WebAssembly.instantiateStreaming(e,t)}function di(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}var fi;function pi(e){fi=e}function mi(){return fi}async function hi(e){return e&&await ci(e),{createScanner(e){return new ti(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new ei(e)}}}var gi=Fr({});Lr(gi,Ur);var F=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function _i(e){return vi(e)}function vi(e){return Array.isArray(e)?yi(e):e instanceof RegExp?e:typeof e==`object`?bi(e):e}function yi(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=vi(e[n]);return t}function bi(e){let t={};for(let n in e)t[n]=vi(e[n]);return t}function xi(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function Si(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?Si(e.substring(0,e.length-1)):e.substr(~t+1)}var Ci=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,wi=class{static hasCaptures(e){return e!==null&&(Ci.lastIndex=0,Ci.test(e))}static replaceCaptures(e,t,n){return e.replace(Ci,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function Ti(e,t){return e<t?-1:+(e>t)}function Ei(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=Ti(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function Di(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Oi(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var ki=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},Ai=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Fi(e),t)}static createFromParsedTheme(e,t){return Li(e,t)}_cachedMatchRoot=new ki(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>Mi(e.parent,t.parentScopes));return n?new Pi(n.fontStyle,n.foreground,n.background):null}},ji=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function Mi(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Ni(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Ni(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var Pi=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Fi(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8}}let s=null;typeof i.settings.foreground==`string`&&Di(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&Di(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new Ii(l,u,e,o,s,c)}}return n}var Ii=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},I=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(I||{});function Li(e,t){e.sort((e,t)=>{let n=Ti(e.scope,t.scope);return n!==0||(n=Ei(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new Ri(t),o=new Pi(n,a.getId(r),a.getId(i)),s=new Vi(new Bi(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new Ai(a,o,s)}var Ri=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},zi=Object.freeze([]),Bi=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||zi,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},Vi=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),Bi.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(Ei(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Bi(e,t,n,r,i))}},Hi=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return!!(e&1024)}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=Wi(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function Ui(e){return e}function Wi(e){return e}function Gi(e,t){let n=[],r=qi(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(Ki(i)){let e=[];do e.push(i),i=r.next();while(Ki(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function Ki(e){return!!e&&!!e.match(/[\w\.:]+/)}function qi(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function Ji(e){typeof e.dispose==`function`&&e.dispose()}var Yi=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Xi=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Zi=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Qi=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Yi(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new Zi;for(let n of e)$i(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof Yi){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function $i(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof Yi?ta({baseGrammar:a,selfGrammar:i},r):ea(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new Yi(e))}function ea(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];na([r],t,n)}}function ta(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&na(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&na(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function na(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?xi({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&na(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=ca(i);switch(a.kind){case 0:ta({...t,selfGrammar:t.baseGrammar},n);break;case 1:ta(t,n);break;case 2:ea(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?ea(a.ruleName,i,n):ta(i,n)}else a.kind===4?n.add(new Xi(a.scopeName,a.ruleName)):n.add(new Yi(a.scopeName))}}}var ra=class{kind=0},ia=class{kind=1},aa=class{constructor(e){this.ruleName=e}kind=2},oa=class{constructor(e){this.scopeName=e}kind=3},sa=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function ca(e){if(e===`$base`)return new ra;if(e===`$self`)return new ia;let t=e.indexOf(`#`);return t===-1?new oa(e):t===0?new aa(e.substring(1)):new sa(e.substring(0,t),e.substring(t+1))}var la=/\\(\d+)/,ua=/\\(\d+)/g,da=-1,fa=-2;function pa(e){return e}function ma(e){return e}var ha=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=wi.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=wi.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${Si(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:wi.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:wi.replaceCaptures(this._contentName,e,t)}},ga=class extends ha{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},_a=class extends ha{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new Sa(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ca,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},va=class extends ha{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ca,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ya=class extends ha{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new Sa(i,this.id),this.beginCaptures=a,this._end=new Sa(o||`￿`,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ca;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},ba=class extends ha{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new Sa(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new Sa(o,fa),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ca;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Ca,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||`￿`),this._cachedCompiledWhilePatterns}},xa=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new ga(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new _a(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=xi({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new va(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new ba(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new ya(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=ca(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l){if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof va||e instanceof ya||e instanceof ba)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},Sa=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this._anchorCache=this.hasAnchor?this._buildAnchorCache():null,this.ruleId=t,this.hasBackReferences=typeof this.source==`string`&&la.test(this.source)}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return ua.lastIndex=0,this.source.replace(ua,(e,t)=>Oi(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=`￿`,t[i+1]=`￿`,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=`￿`,t[i+1]=`G`,n[i+1]=`￿`,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Ca=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new wa(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new wa(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},wa=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
3
+ `)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Ta=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Ea=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Ta(e,8),this._embeddedLanguagesMatcher=new Da(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new Ta(0,0);_getBasicScopeAttributes=new ki(e=>new Ta(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Da=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>Oi(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var Oa=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function ka(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Aa(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new Oa(i,!0);f()}return new Oa(i,!1);function f(){let o=ja(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===da){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),Ia(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof ya){let r=o;Ia(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof ba){let r=o;Ia(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(Ia(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function Aa(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof ba&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=Fa(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==fa){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),Ia(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function ja(e,t,n,r,i,a){let o=Ma(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=Na(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function Ma(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=Pa(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Na(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=Pa(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Pa(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function Fa(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Ia(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));ka(e,p,n&&d.start===0,d.start,f,i,!1,0),Ji(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new La(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var La=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function Ra(e,t,n,r,i,a,o,s){return new Ha(e,t,n,r,i,a,o,s)}function za(e,t,n,r,i){let a=Gi(t,Ba),o=xa.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function Ba(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(Va(t[r],e))return n=r+1,!0;return!1})}function Va(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var Ha=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new Ea(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Ua(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=Gi(e,Ba);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)za(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&za(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(pa(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[ma(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Ua(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=xa.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===Ga.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=Hi.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?Wa.createRootAndLookUpScopeName(a,r,this):Wa.createRoot(`unknown`,r),t=new Ga(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
4
+ `;let a=this.createOnigString(e),o=a.content.length,s=new qa(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=ka(this,a,i,0,t,s,!0,r);return Ji(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Ua(e,t){return e=_i(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Wa=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=ji.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new ji(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new ji(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(1)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),Hi.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},Ga=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?Wa.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(1)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:ma(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=Wa.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,pa(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Wa.fromExtension(r,n.contentNameScopesList))}},Ka=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):Gi(e,Ba).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Gi(e,Ba).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},qa=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=Hi.set(n,0,Ui(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=Hi.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},Ja=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,Ra(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},Ya=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Ja(Ai.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(Ai.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new Ka(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new Qi(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},Xa=Ga.NULL;function Za(e,t){let n=typeof e==`string`?{}:{...e.colorReplacements},r=typeof e==`string`?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))typeof i==`string`?n[e]=i:e===r&&Object.assign(n,i);return n}function Qa(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function $a(e){return Array.isArray(e)?e:[e]}async function eo(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function to(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function no(e){return e===`ansi`||to(e)}function ro(e){return e===`none`}function io(e){return ro(e)}var ao=/(\r?\n)/g;function oo(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(ao),r=0,i=[];for(let e=0;e<n.length;e+=2){let a=t?n[e]+(n[e+1]||``):n[e];i.push([a,r]),r+=n[e].length,r+=n[e+1]?.length||0}return i}var so={light:`#333333`,dark:`#bbbbbb`},co={light:`#fffffe`,dark:`#1e1e1e`},lo=`__shiki_resolved`;function uo(e){if(e?.[lo])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||=`dark`,t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.[`editor.foreground`]&&(r=t.colors[`editor.foreground`]),!n&&t?.colors?.[`editor.background`]&&(n=t.colors[`editor.background`]),r||=t.type===`light`?so.light:so.dark,n||=t.type===`light`?co.light:co.dark,t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let n=`#${i.toString(16).padStart(8,`0`).toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(a.set(e,n),n)}t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith(`#`),r=e.settings?.background&&!e.settings.background.startsWith(`#`);if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i});for(let e of Object.keys(t.colors||{}))if((e===`editor.foreground`||e===`editor.background`||e.startsWith(`terminal.ansi`))&&!t.colors[e]?.startsWith(`#`)){let n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,lo,{enumerable:!1,writable:!1,value:!0}),t}async function fo(e){return[...new Set((await Promise.all(e.filter(e=>!no(e)).map(async e=>await eo(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function po(e){return(await Promise.all(e.map(async e=>io(e)?null:uo(await eo(e))))).filter(e=>!!e)}function mo(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new F(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var ho=class extends Ya{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=uo(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||=[...this._resolvedThemes.keys()],this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=Ai.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=mo(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=[...this._langGraph.entries()],n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t?(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e)):!1).filter(e=>!n.includes(e));throw new F(`Missing languages ${n.map(([e])=>`\`${e}\``).join(`, `)}, required by ${e.map(([e])=>`\`${e}\``).join(`, `)}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])],this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}},go=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split(`.`),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(`.`);n=[...n,...this._injections.get(r)||[]]}return n}},_o=0;function vo(e){_o+=1,e.warnings!==!1&&_o>=10&&_o%10==0&&console.warn(`[Shiki] ${_o} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new F("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(uo),i=new ho(new go(e.engine,n),r,n,e.langAlias),a;function o(t){return mo(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new F(`Language \`${e}\` not found, you may need to load it first`);return t}function c(e){if(e===`none`)return{bg:``,fg:``,name:`none`,settings:[],type:`dark`};g();let t=i.getTheme(e);if(!t)throw new F(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(e){g();let t=c(e);return a!==e&&(i.setTheme(t),a=e),{theme:t,colorMap:i.getColorMap()}}function u(){return g(),i.getLoadedThemes()}function d(){return g(),i.getLoadedLanguages()}function f(...e){g(),i.loadLanguages(e.flat(1))}async function p(...e){return f(await fo(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await po(e))}function g(){if(t)throw new F(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--_o)}return{setTheme:l,getTheme:c,getLanguage:s,getLoadedThemes:u,getLoadedLanguages:d,resolveLangAlias:o,loadLanguage:p,loadLanguageSync:f,loadTheme:h,loadThemeSync:m,dispose:_,[Symbol.dispose]:_}}async function yo(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([po(e.themes||[]),fo(e.langs||[]),e.engine]);return vo({...e,themes:t,langs:n,engine:r})}var bo=new WeakMap;function xo(e,t){bo.set(e,t)}function So(e){return bo.get(e)}var Co=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries($a(n).map(e=>[e,Xa])),t)}constructor(...e){if(e.length===2){let[t,n]=e;this.lang=n,this._stacks=t}else{let[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return wo(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function wo(e){let t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);let i=e?.nameScopesList?.scopeName;i&&t.push(i),e.parent&&r(e.parent)}return r(e),t}function To(e,t){if(!(e instanceof Co))throw new F(`Invalid grammar state`);return e.getInternalStack(t)}var Eo=/,/,Do=/ /;function Oo(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(to(e.resolveLangAlias(n.lang||`text`))||ro(r))return oo(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:i,colorMap:a}=e.setTheme(r),o=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==o.name)throw new F(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new F(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Ao(t,o,i,a,n)}function ko(...e){if(e.length===2)return So(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(to(i)||ro(a))throw new F(`Plain language does not have grammar state`);if(i===`ansi`)throw new F(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new Co(jo(n,c,o,s,r).stateStack,c.name,o.name)}function Ao(e,t,n,r,i){let a=jo(e,t,n,r,i),o=new Co(a.stateStack,t.name,n.name);return xo(a.tokens,o),a.tokens}function jo(e,t,n,r,i){let a=Za(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500,includeExplanation:c=!1}=i,l=oo(e),u=i.grammarState?To(i.grammarState,n.name)??Xa:i.grammarContextCode==null?Xa:jo(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,d=[],f=[];for(let e=0,i=l.length;e<i;e++){let[i,p]=l[e];if(i===``){d=[],f.push([]);continue}if(o>0&&i.length>=o){d=[],f.push([{content:i,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;c&&c!==`tokenType`&&(m=t.tokenizeLine(i,u,s),h=m.tokens,g=0);let _=t.tokenizeLine2(i,u,s),v=_.tokens.length/2;for(let e=0;e<v;e++){let t=_.tokens[2*e],o=e+1<v?_.tokens[2*e+2]:i.length;if(t===o)continue;let s=_.tokens[2*e+1],l=Qa(r[Hi.getForeground(s)],a),u=Hi.getFontStyle(s),f={content:i.substring(t,o),offset:p+t,color:l,fontStyle:u};if(c===`tokenType`)f.type=Hi.getTokenType(s);else if(c){let e=[];if(c!==`scopeName`)for(let t of n.settings){let n;switch(typeof t.scope){case`string`:n=t.scope.split(Eo).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(Do))})}f.explanation=[];let r=0;for(;t+r<o;){let t=h[g],n=i.substring(t.startIndex,t.endIndex);r+=n.length,f.explanation.push({content:n,scopes:c===`scopeName`?Mo(t.scopes):No(e,t.scopes)}),g+=1}}d.push(f)}f.push(d),d=[],u=_.ruleStack}return{tokens:f,stateStack:u}}function Mo(e){return e.map(e=>({scopeName:e}))}function No(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:Io(e,i,t.slice(0,r))}}return n}function Po(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function Fo(e,t,n){if(!Po(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)Po(e[r],n[i])&&--r,--i;return r===-1}function Io(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(Fo(e,t,n)){r.push(a);break}return r}function Lo(e,t,n,r=Oo){let i=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),a=i.map(i=>{let a=r(e,t,{...n,theme:i.theme});return{tokens:a,state:So(a),theme:typeof i.theme==`string`?i.theme:i.theme.name}}),o=Ro(...a.map(e=>e.tokens)),s=o[0].map((e,t)=>e.map((e,r)=>{let a={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(a.explanation=e.explanation),o.forEach((e,n)=>{let{content:o,explanation:s,offset:c,...l}=e[t][r];a.variants[i[n].color]=l}),a})),c=a[0].state?new Co(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&xo(s,c),s}function Ro(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let i=e.map(e=>e[r]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let o=i.map(()=>0),s=i.map(e=>e[0]);for(;s.every(e=>e);){let e=Math.min(...s.map(e=>e.content.length));for(let t=0;t<n;t++){let n=s[t];n.content.length===e?(a[t].push(n),o[t]+=1,s[t]=i[t][o[t]]):(a[t].push({...n,content:n.content.slice(0,e)}),s[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}var zo=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],Bo=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Bo.prototype.normal={},Bo.prototype.property={},Bo.prototype.space=void 0;function Vo(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Bo(n,r,t)}function Ho(e){return e.toLowerCase()}var L=class{constructor(e,t){this.attribute=t,this.property=e}};L.prototype.attribute=``,L.prototype.booleanish=!1,L.prototype.boolean=!1,L.prototype.commaOrSpaceSeparated=!1,L.prototype.commaSeparated=!1,L.prototype.defined=!1,L.prototype.mustUseProperty=!1,L.prototype.number=!1,L.prototype.overloadedBoolean=!1,L.prototype.property=``,L.prototype.spaceSeparated=!1,L.prototype.space=void 0;var Uo=e({boolean:()=>R,booleanish:()=>z,commaOrSpaceSeparated:()=>H,commaSeparated:()=>Ko,number:()=>B,overloadedBoolean:()=>Go,spaceSeparated:()=>V}),Wo=0,R=qo(),z=qo(),Go=qo(),B=qo(),V=qo(),Ko=qo(),H=qo();function qo(){return 2**++Wo}var Jo=Object.keys(Uo),Yo=class extends L{constructor(e,t,n,r){let i=-1;if(super(e,t),Xo(this,`space`,r),typeof n==`number`)for(;++i<Jo.length;){let e=Jo[i];Xo(this,Jo[i],(n&Uo[e])===Uo[e])}}};Yo.prototype.defined=!0;function Xo(e,t,n){n&&(e[t]=n)}function Zo(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Yo(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Ho(r)]=r,n[Ho(a.attribute)]=r}return new Bo(t,n,e.space)}var Qo=Zo({properties:{ariaActiveDescendant:null,ariaAtomic:z,ariaAutoComplete:null,ariaBusy:z,ariaChecked:z,ariaColCount:B,ariaColIndex:B,ariaColSpan:B,ariaControls:V,ariaCurrent:null,ariaDescribedBy:V,ariaDetails:null,ariaDisabled:z,ariaDropEffect:V,ariaErrorMessage:null,ariaExpanded:z,ariaFlowTo:V,ariaGrabbed:z,ariaHasPopup:null,ariaHidden:z,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:V,ariaLevel:B,ariaLive:null,ariaModal:z,ariaMultiLine:z,ariaMultiSelectable:z,ariaOrientation:null,ariaOwns:V,ariaPlaceholder:null,ariaPosInSet:B,ariaPressed:z,ariaReadOnly:z,ariaRelevant:null,ariaRequired:z,ariaRoleDescription:V,ariaRowCount:B,ariaRowIndex:B,ariaRowSpan:B,ariaSelected:z,ariaSetSize:B,ariaSort:null,ariaValueMax:B,ariaValueMin:B,ariaValueNow:B,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function $o(e,t){return t in e?e[t]:t}function es(e,t){return $o(e,t.toLowerCase())}var ts=Zo({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Ko,acceptCharset:V,accessKey:V,action:null,allow:null,allowFullScreen:R,allowPaymentRequest:R,allowUserMedia:R,alpha:R,alt:null,as:null,async:R,autoCapitalize:null,autoComplete:V,autoFocus:R,autoPlay:R,blocking:V,capture:null,charSet:null,checked:R,cite:null,className:V,closedBy:null,colorSpace:null,cols:B,colSpan:B,command:null,commandFor:null,content:null,contentEditable:z,controls:R,controlsList:V,coords:B|Ko,crossOrigin:null,data:null,dateTime:null,decoding:null,default:R,defer:R,dir:null,dirName:null,disabled:R,download:Go,draggable:z,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:R,formTarget:null,headers:V,height:B,hidden:Go,high:B,href:null,hrefLang:null,htmlFor:V,httpEquiv:V,id:null,imageSizes:null,imageSrcSet:null,inert:R,inputMode:null,integrity:null,is:null,isMap:R,itemId:null,itemProp:V,itemRef:V,itemScope:R,itemType:V,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:R,low:B,manifest:null,max:null,maxLength:B,media:null,method:null,min:null,minLength:B,multiple:R,muted:R,name:null,nonce:null,noModule:R,noValidate:R,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:R,optimum:B,pattern:null,ping:V,placeholder:null,playsInline:R,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:R,referrerPolicy:null,rel:V,required:R,reversed:R,rows:B,rowSpan:B,sandbox:V,scope:null,scoped:R,seamless:R,selected:R,shadowRootClonable:R,shadowRootCustomElementRegistry:R,shadowRootDelegatesFocus:R,shadowRootMode:null,shadowRootSerializable:R,shape:null,size:B,sizes:null,slot:null,span:B,spellCheck:z,src:null,srcDoc:null,srcLang:null,srcSet:null,start:B,step:null,style:null,tabIndex:B,target:null,title:null,translate:null,type:null,typeMustMatch:R,useMap:null,value:z,width:B,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:V,axis:null,background:null,bgColor:null,border:B,borderColor:null,bottomMargin:B,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:R,declare:R,event:null,face:null,frame:null,frameBorder:null,hSpace:B,leftMargin:B,link:null,longDesc:null,lowSrc:null,marginHeight:B,marginWidth:B,noResize:R,noHref:R,noShade:R,noWrap:R,object:null,profile:null,prompt:null,rev:null,rightMargin:B,rules:null,scheme:null,scrolling:z,standby:null,summary:null,text:null,topMargin:B,valueType:null,version:null,vAlign:null,vLink:null,vSpace:B,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:R,disablePictureInPicture:R,disableRemotePlayback:R,exportParts:Ko,part:V,prefix:null,property:null,results:B,security:null,unselectable:null},space:`html`,transform:es}),ns=Zo({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:H,accentHeight:B,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:B,amplitude:B,arabicForm:null,ascent:B,attributeName:null,attributeType:null,azimuth:B,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:B,by:null,calcMode:null,capHeight:B,className:V,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:B,diffuseConstant:B,direction:null,display:null,dur:null,divisor:B,dominantBaseline:null,download:R,dx:null,dy:null,edgeMode:null,editable:null,elevation:B,enableBackground:null,end:null,event:null,exponent:B,externalResourcesRequired:null,fill:null,fillOpacity:B,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ko,g2:Ko,glyphName:Ko,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:B,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:B,horizOriginX:B,horizOriginY:B,id:null,ideographic:B,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:B,k:B,k1:B,k2:B,k3:B,k4:B,kernelMatrix:H,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:B,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:B,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:B,overlineThickness:B,paintOrder:null,panose1:null,path:null,pathLength:B,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:V,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:B,pointsAtY:B,pointsAtZ:B,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:H,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:H,rev:H,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:H,requiredFeatures:H,requiredFonts:H,requiredFormats:H,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:B,specularExponent:B,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:B,strikethroughThickness:B,string:null,stroke:null,strokeDashArray:H,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:B,strokeOpacity:B,strokeWidth:null,style:null,surfaceScale:B,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:H,tabIndex:B,tableValues:null,target:null,targetX:B,targetY:B,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:H,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:B,underlineThickness:B,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:B,values:null,vAlphabetic:B,vMathematical:B,vectorEffect:null,vHanging:B,vIdeographic:B,version:null,vertAdvY:B,vertOriginX:B,vertOriginY:B,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:B,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:$o}),rs=Zo({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),is=Zo({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:es}),as=Zo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),os=/[A-Z]/g,ss=/-[a-z]/g,cs=/^data[-\w.:]+$/i;function ls(e,t){let n=Ho(t),r=t,i=L;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&cs.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(ss,ds);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!ss.test(e)){let n=e.replace(os,us);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Yo}return new i(r,t)}function us(e){return`-`+e.toLowerCase()}function ds(e){return e.charAt(1).toUpperCase()}var fs=Vo([Qo,ts,rs,is,as],`html`),ps=Vo([Qo,ns,rs,is,as],`svg`),ms={}.hasOwnProperty;function hs(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&ms.call(t,e)){let n=String(t[e]);i=ms.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var gs=/["&'<>`]/g,_s=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,vs=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,ys=/[|\\{}()[\]^$+*?.]/g,bs=new WeakMap;function xs(e,t){if(e=e.replace(t.subset?Ss(t.subset):gs,r),t.subset||t.escapeOnly)return e;return e.replace(_s,n).replace(vs,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function Ss(e){let t=bs.get(e);return t||(t=Cs(e),bs.set(e,t)),t}function Cs(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(ys,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var ws=/[\dA-Fa-f]/;function Ts(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!ws.test(String.fromCharCode(t))?r:r+`;`}var Es=/\d/;function Ds(e,t,n){let r=`&#`+String(e);return n&&t&&!Es.test(String.fromCharCode(t))?r:r+`;`}var Os=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),ks={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:`­`,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:`‌`,zwj:`‍`,lrm:`‎`,rlm:`‏`,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},As=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],js={}.hasOwnProperty,Ms={},Ns;for(Ns in ks)js.call(ks,Ns)&&(Ms[ks[Ns]]=Ns);var Ps=/[^\dA-Za-z]/;function Fs(e,t,n,r){let i=String.fromCharCode(e);if(js.call(Ms,i)){let e=Ms[i],a=`&`+e;return n&&Os.includes(e)&&!As.includes(e)&&(!r||t&&t!==61&&Ps.test(String.fromCharCode(t)))?a:a+`;`}return``}function Is(e,t,n){let r=Ts(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Fs(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=Ds(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function Ls(e,t){return xs(e,Object.assign({format:Is},t))}var Rs=/^>|^->|<!--|-->|--!>|<!-$/g,zs=[`>`],Bs=[`<`,`>`];function Vs(e,t,n,r){return r.settings.bogusComments?`<?`+Ls(e.value,Object.assign({},r.settings.characterReferences,{subset:zs}))+`>`:`<!--`+e.value.replace(Rs,i)+`-->`;function i(e){return Ls(e,Object.assign({},r.settings.characterReferences,{subset:Bs}))}}function Hs(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function Us(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Ws(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function Gs(e){return e.join(` `).trim()}var Ks=/[ \t\n\f\r]/g;function qs(e){return typeof e==`object`?e.type===`text`&&Js(e.value):Js(e)}function Js(e){return e.replace(Ks,``)===``}var U=Zs(1),Ys=Zs(-1),Xs=[];function Zs(e){return t;function t(t,n,r){let i=t?t.children:Xs,a=(n||0)+e,o=i[a];if(!r)for(;o&&qs(o);)a+=e,o=i[a];return o}}var Qs={}.hasOwnProperty;function $s(e){return t;function t(t,n,r){return Qs.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var ec=$s({body:rc,caption:tc,colgroup:tc,dd:sc,dt:oc,head:tc,html:nc,li:ac,optgroup:lc,option:uc,p:ic,rp:cc,rt:cc,tbody:fc,td:hc,tfoot:pc,th:hc,thead:dc,tr:mc});function tc(e,t,n){let r=U(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&qs(r.value.charAt(0)))}function nc(e,t,n){let r=U(n,t);return!r||r.type!==`comment`}function rc(e,t,n){let r=U(n,t);return!r||r.type!==`comment`}function ic(e,t,n){let r=U(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||n.type!==`element`||n.tagName!==`a`&&n.tagName!==`audio`&&n.tagName!==`del`&&n.tagName!==`ins`&&n.tagName!==`map`&&n.tagName!==`noscript`&&n.tagName!==`video`}function ac(e,t,n){let r=U(n,t);return!r||r.type===`element`&&r.tagName===`li`}function oc(e,t,n){let r=U(n,t);return!(!r||r.type!==`element`||r.tagName!==`dt`&&r.tagName!==`dd`)}function sc(e,t,n){let r=U(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function cc(e,t,n){let r=U(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function lc(e,t,n){let r=U(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function uc(e,t,n){let r=U(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function dc(e,t,n){let r=U(n,t);return!(!r||r.type!==`element`||r.tagName!==`tbody`&&r.tagName!==`tfoot`)}function fc(e,t,n){let r=U(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function pc(e,t,n){return!U(n,t)}function mc(e,t,n){let r=U(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function hc(e,t,n){let r=U(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var gc=$s({body:yc,colgroup:bc,head:vc,html:_c,tbody:xc});function _c(e){let t=U(e,-1);return!t||t.type!==`comment`}function vc(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function yc(e){let t=U(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&qs(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function bc(e,t,n){let r=Ys(n,t),i=U(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&ec(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function xc(e,t,n){let r=Ys(n,t),i=U(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&ec(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var Sc={name:[[`
5
5
  \f\r &/=>`.split(``),`
6
6
  \f\r "&'/=>\``.split(``)],[`\0
7
7
  \f\r "&'/<=>`.split(``),`\0
@@ -9,10 +9,10 @@ import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{Dc as r,
9
9
  \f\r &>`.split(``),`\0
10
10
  \f\r "&'<=>\``.split(``)],[`\0
11
11
  \f\r "&'<=>\``.split(``),`\0
12
- \f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function ac(e,t,n,r){let i=r.schema,a=i.space!==`svg`&&r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=Yo);let l=oc(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!Qs(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!Is(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function oc(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=sc(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function sc(e,t,n){let r=Go(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=ys(r.attribute,Object.assign({},e.settings.characterReferences,{subset:ic.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Es:Ds)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=ys(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:ic.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&Ts(n,o)>Ts(n,e.alternative)&&(o=e.alternative),s=o+ys(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?ic.single:ic.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var cc=[`<`,`&`];function lc(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:ys(e.value,Object.assign({},r.settings.characterReferences,{subset:cc}))}function uc(e,t,n,r){return r.settings.allowDangerousHtml?e.value:lc(e,t,n,r)}function dc(e,t,n,r){return r.all(e)}var fc=Zo(`type`,{invalid:pc,unknown:mc,handlers:{comment:Cs,doctype:ws,element:ac,raw:uc,root:dc,text:lc}});function pc(e){throw Error("Expected node, not `"+e+"`")}function mc(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var hc={},gc={},_c=[];function vc(e,t){let n=t||hc,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:yc,all:bc,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||xo,characterReferences:n.characterReferences||gc,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?Yo:Jo,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function yc(e,t,n){return fc(e,t,n,this)}function bc(e){let t=[],n=e&&e.children||_c,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var xc=/\s+/g;function Sc(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(xc)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(xc);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}var Cc=/:?lang=["']([^"']+)["']/g,wc=/(?:```|~~~)([\w-]+)/g,Tc=/\\begin\{([\w-]+)\}/g,Ec=/<script\s+(?:type|lang)=["']([^"']+)["']/gi,Dc=/^\s*---\r?\n[\s\S]*?\r?\n---(?:\r?\n|\s*$)/;function Oc(e){let t=Ha(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t.at(-1).length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}function kc(e,t,n){let r=new Set;for(let t of e.matchAll(Cc)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(wc)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(Tc)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(Ec)){let e=t[1].toLowerCase().trim(),n=e.includes(`/`)?e.split(`/`).pop():e;n&&r.add(n)}if(Dc.test(e)&&r.add(`yaml`),!n)return[...r];let i=n.getBundledLanguages();return[...r].filter(e=>e&&i[e])}var Ac=[`color`,`background-color`];function jc(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function Mc(e,t){let n=0,r=e.length;for(;n<r;){let i=n+(r-n>>1);e[i]<=t?n=i+1:r=i}return n}function Nc(e,t){let n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=e.offset+e.content.length,r=Mc(n,e.offset),i=r;for(;i<n.length&&n[i]<t;)i++;if(r===i)return e;let a=n.slice(r,i);for(let t=0;t<a.length;t++)a[t]-=e.offset;return jc(e,a)})):e}function Pc(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>Fc(e.variants[t])),s=new Set(o.flatMap(e=>Object.keys(e))),c={},l=(e,r)=>{let i=r===`color`?``:r===`background-color`?`-bg`:`-${r}`;return n+t[e]+(r===`color`?``:i)};return o.forEach((e,n)=>{for(let a of s){let s=e[a]||`inherit`;if(n===0&&r&&Ac.includes(a)){if(r===`light-dark()`&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new F('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let u=o[e][a]||`inherit`,d=o[r][a]||`inherit`;c[a]=`light-dark(${u}, ${d})`,i===`css-vars`&&(c[l(n,a)]=s)}else c[a]=s}else i===`css-vars`&&(c[l(n,a)]=s)}}),a.htmlStyle=c,a}function Fc(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&I.Italic&&(t[`font-style`]=`italic`),e.fontStyle&I.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&I.Underline&&n.push(`underline`),e.fontStyle&I.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function Ic(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function Lc(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=Oc(t.source);function r(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new F(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...n.indexToPos(e),offset:e}}{let t=n.lines[e.line];if(t===void 0)throw new F(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${n.lines.length}`);let r=e.character;if(r<0&&(r=t.length+r),r<0||r>t.length)throw new F(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:r,offset:n.posToIndex(e.line,r)}}}let i=(t.options.decorations||[]).map(e=>({...e,start:r(e.start),end:r(e.end)}));Rc(i),e.set(t.meta,{decorations:i,converter:n,source:t.source})}return e.get(t.meta)}return{name:`shiki:decorations`,tokens(e){if(this.options.decorations?.length)return Nc(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=[...e.children].filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new F(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function i(e,t,n,i){let a=r[e],s=``,c=-1,l=-1;if(t===0&&(c=0),n===0&&(l=0),n===1/0&&(l=a.children.length),c===-1||l===-1)for(let e=0;e<a.children.length;e++)s+=zc(a.children[e]),c===-1&&s.length===t&&(c=e+1),l===-1&&s.length===n&&(l=e+1);if(c===-1)throw new F(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(l===-1)throw new F(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let u=a.children.slice(c,l);if(!i.alwaysWrap&&u.length===a.children.length)o(a,i,`line`);else if(!i.alwaysWrap&&u.length===1&&u[0].type===`element`)o(u[0],i,`token`);else{let e={type:`element`,tagName:`span`,properties:{},children:u};o(e,i,`wrapper`),a.children.splice(c,u.length,e)}}function a(e,t){r[e]=o(r[e],t,`line`)}function o(e,t,n){let r=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||`span`,e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&Sc(e,t.properties.class),e=i(e,n)||e,e}let s=[],c=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(let e of c){let{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,1/0,e);for(let r=t.line+1;r<n.line;r++)s.unshift(()=>a(r,e));i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}function Rc(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new F(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){let t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,a=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,o=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,s=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||a||o||s){if(i&&a||o&&s||o&&n.start.offset===n.end.offset||a&&t.start.offset===t.end.offset)continue;throw new F(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}function zc(e){return e.type===`text`?e.value:e.type===`element`?e.children.map(zc).join(``):``}var Bc=[Lc()];function Vc(e){let t=Hc(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...Bc]}function Hc(e){let t=[],n=[],r=[];for(let i of e)switch(i.enforce){case`pre`:t.push(i);break;case`post`:n.push(i);break;default:r.push(i)}return{pre:t,post:n,normal:r}}var Uc=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],Wc={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`};function Gc(e,t){let n=e.indexOf(`\x1B`,t);if(n!==-1&&e[n+1]===`[`){let t=e.indexOf(`m`,n);if(t!==-1)return{sequence:e.substring(n+2,t).split(`;`),startPosition:n,position:t+1}}return{position:e.length}}function Kc(e){let t=e.shift();if(t===`2`){let t=e.splice(0,3).map(e=>Number.parseInt(e));return t.length!==3||t.some(e=>Number.isNaN(e))?void 0:{type:`rgb`,rgb:t}}if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function qc(e){let t=[];for(;e.length>0;){let n=e.shift();if(!n)continue;let r=Number.parseInt(n);if(!Number.isNaN(r)){if(r===0)t.push({type:`resetAll`});else if(r<=9)Wc[r]&&t.push({type:`setDecoration`,value:Wc[r]});else if(r<=29){let e=Wc[r-20];e&&(t.push({type:`resetDecoration`,value:e}),e===`dim`&&t.push({type:`resetDecoration`,value:`bold`}))}else if(r<=37)t.push({type:`setForegroundColor`,value:{type:`named`,name:Uc[r-30]}});else if(r===38){let n=Kc(e);n&&t.push({type:`setForegroundColor`,value:n})}else if(r===39)t.push({type:`resetForegroundColor`});else if(r<=47)t.push({type:`setBackgroundColor`,value:{type:`named`,name:Uc[r-40]}});else if(r===48){let n=Kc(e);n&&t.push({type:`setBackgroundColor`,value:n})}else r===49?t.push({type:`resetBackgroundColor`}):r===53?t.push({type:`setDecoration`,value:`overline`}):r===55?t.push({type:`resetDecoration`,value:`overline`}):r>=90&&r<=97?t.push({type:`setForegroundColor`,value:{type:`named`,name:Uc[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:Uc[r-100+8]}})}}return t}function Jc(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=Gc(r,a),s=o.sequence?r.substring(a,o.startPosition):r.substring(a);if(s.length>0&&i.push({value:s,foreground:e,background:t,decorations:new Set(n)}),o.sequence){let r=qc(o.sequence);for(let i of r)i.type===`resetAll`?(e=null,t=null,n.clear()):i.type===`resetForegroundColor`?e=null:i.type===`resetBackgroundColor`?t=null:i.type===`resetDecoration`&&n.delete(i.value);for(let i of r)i.type===`setForegroundColor`?e=i.value:i.type===`setBackgroundColor`?t=i.value:i.type===`setDecoration`&&n.add(i.value)}a=o.position}while(a<r.length);return i}}}var Yc={black:`#000000`,red:`#bb0000`,green:`#00bb00`,yellow:`#bbbb00`,blue:`#0000bb`,magenta:`#ff00ff`,cyan:`#00bbbb`,white:`#eeeeee`,brightBlack:`#555555`,brightRed:`#ff5555`,brightGreen:`#00ff00`,brightYellow:`#ffff55`,brightBlue:`#5555ff`,brightMagenta:`#ff55ff`,brightCyan:`#55ffff`,brightWhite:`#ffffff`};function Xc(e=Yc){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,`0`)).join(``)}`}let r;function i(){if(r)return r;r=[];for(let e=0;e<Uc.length;e++)r.push(t(Uc[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let i=0;i<6;i++)for(let a=0;a<6;a++)r.push(n([e[t],e[i],e[a]]));let i=8;for(let e=0;e<24;e++,i+=10)r.push(n([i,i,i]));return r}function a(e){return i()[e]}function o(e){switch(e.type){case`named`:return t(e.name);case`rgb`:return n(e.rgb);case`table`:return a(e.index)}}return{value:o}}var Zc=/#([0-9a-f]{3,8})/i,Qc=/var\((--[\w-]+-ansi-[\w-]+)\)/,$c={black:`#000000`,red:`#cd3131`,green:`#0DBC79`,yellow:`#E5E510`,blue:`#2472C8`,magenta:`#BC3FBC`,cyan:`#11A8CD`,white:`#E5E5E5`,brightBlack:`#666666`,brightRed:`#F14C4C`,brightGreen:`#23D18B`,brightYellow:`#F5F543`,brightBlue:`#3B8EEA`,brightMagenta:`#D670D6`,brightCyan:`#29B8DB`,brightWhite:`#FFFFFF`};function el(e,t,n){let r=Na(e,n),i=Ha(t),a=Xc(Object.fromEntries(Uc.map(t=>{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||$c[t]]}))),o=Jc();return i.map(t=>o.parse(t[0]).map(n=>{let i,o;n.decorations.has(`reverse`)?(i=n.background?a.value(n.background):e.bg,o=n.foreground?a.value(n.foreground):e.fg):(i=n.foreground?a.value(n.foreground):e.fg,o=n.background?a.value(n.background):void 0),i=Pa(i,r),o=Pa(o,r),n.decorations.has(`dim`)&&(i=tl(i));let s=I.None;return n.decorations.has(`bold`)&&(s|=I.Bold),n.decorations.has(`italic`)&&(s|=I.Italic),n.decorations.has(`underline`)&&(s|=I.Underline),n.decorations.has(`strikethrough`)&&(s|=I.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function tl(e){let t=e.match(Zc);if(t){let e=t[1];if(e.length===8){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,`0`);return`#${e.slice(0,6)}${t}`}if(e.length===6)return`#${e}80`;if(e.length===4){let t=e[0],n=e[1],r=e[2],i=e[3];return`#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,`0`)}`}if(e.length===3){let t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}let n=e.match(Qc);return n?`var(${n[1]}-dim)`:e}function nl(e,t,n={}){let r=e.resolveLangAlias(n.lang||`text`),{theme:i=e.getLoadedThemes()[0]}=n;if(!La(r)&&!za(i)&&r===`ansi`){let{theme:r}=e.setTheme(i);return el(r,t,n)}return lo(e,t,n)}function rl(e,t,n){let r,i,a,o,s,c;if(`themes`in n){let{defaultColor:l=`light`,cssVariablePrefix:u=`--shiki-`,colorsRendering:d=`css-vars`}=n,f=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===l?-1:+(t.color===l));if(f.length===0)throw new F("`themes` option must not be empty");let p=yo(e,t,n,nl);if(c=ro(p),l&&l!==`light-dark()`&&!f.some(e=>e.color===l))throw new F(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=f.map(t=>e.getTheme(t.theme)),h=f.map(e=>e.color);a=p.map(e=>e.map(e=>Pc(e,h,u,l,d))),c&&no(a,c);let g=f.map(e=>Na(e.theme,n));i=il(f,m,g,u,l,`fg`,d),r=il(f,m,g,u,l,`bg`,d),o=`shiki-themes ${m.map(e=>e.name).join(` `)}`,s=l?void 0:[i,r].join(`;`)}else if(`theme`in n){let s=Na(n.theme,n);a=nl(e,t,n);let l=e.getTheme(n.theme);r=Pa(l.bg,s),i=Pa(l.fg,s),o=l.name,c=ro(a)}else throw new F("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function il(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=Pa(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===`light-dark()`&&e.length>1){let r=e.findIndex(e=>e.color===`light`),i=e.findIndex(e=>e.color===`dark`);if(r===-1||i===-1)throw new F('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Pa(t[r][a],n[r])||`inherit`}, ${Pa(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}var al=/^\s+$/,ol=/^(\s*)(.*?)(\s*)$/;function sl(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>sl(e,t,n),codeToTokens:(t,n)=>rl(e,t,n)}){let i=t;for(let e of Vc(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=rl(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=ll(a):d===`never`&&(a=ul(a)),f&&(a=dl(a));let p={...r,get source(){return i}};for(let e of Vc(n))a=e.tokens?.call(p,a)||a;return cl(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function cl(e,t,n,r=ro(e)){let i=Vc(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={class:`shiki ${t.themeName||``}`};t.rootStyle!==!1&&(l.style=t.rootStyle==null?`background-color:${t.bg};color:${t.fg}`:t.rootStyle),c!==!1&&c!=null&&(l.tabindex=c.toString());for(let[e,n]of Object.entries(t.meta||{}))e.startsWith(`_`)||(l[e]=n);let u={type:`element`,tagName:`pre`,properties:l,children:[],data:t.data},d={type:`element`,tagName:`code`,properties:{},children:a},f=[],p={...n,structure:s,addClassToHast:Sc,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return u},get code(){return d},get lines(){return f}};if(e.forEach((e,t)=>{t&&(s===`inline`?o.children.push({type:`element`,tagName:`br`,properties:{},children:[]}):s===`classic`&&a.push({type:`text`,value:`
13
- `}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=Ic(a.htmlStyle||Fc(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&no(m,r),m}function ll(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&I.Underline||i.fontStyle&I.Strikethrough));o&&al.test(i.content)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function ul(e){return e.map(e=>e.flatMap(e=>{if(al.test(e.content))return e;let t=e.content.match(ol);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function dl(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t.at(-1),r=Ic(e.htmlStyle||Fc(e)),i=Ic(n.htmlStyle||Fc(n)),a=e.fontStyle&&(e.fontStyle&I.Underline||e.fontStyle&I.Strikethrough),o=n.fontStyle&&(n.fontStyle&I.Underline||n.fontStyle&I.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var fl=vc;function pl(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>sl(e,t,n),codeToTokens:(t,n)=>rl(e,t,n)},i=fl(sl(e,t,n,r));for(let e of Vc(n))i=e.postprocess?.call(r,i,n)||i;return i}async function ml(e){let t=await eo(e);return{getLastGrammarState:(...e)=>uo(t,...e),codeToTokensBase:(e,n)=>nl(t,e,n),codeToTokensWithThemes:(e,n)=>yo(t,e,n),codeToTokens:(e,n)=>rl(t,e,n),codeToHast:(e,n)=>sl(t,e,n),codeToHtml:(e,n)=>pl(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function hl(e){let t=e.langs,n=e.themes,r=e.engine;async function i(e){function i(n){if(typeof n==`string`){if(n=e.langAlias?.[n]||n,Ra(n))return[];let r=t[n];if(!r)throw new F(`Language \`${n}\` is not included in this bundle. You may want to load it from external source.`);return r}return n}function a(e){if(Ba(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new F(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let o=(e.themes??[]).map(e=>a(e)),s=(e.langs??[]).map(e=>i(e)),c=await ml({engine:e.engine??r(),...e,themes:o,langs:s});return{...c,loadLanguage(...e){return c.loadLanguage(...e.map(i))},loadTheme(...e){return c.loadTheme(...e.map(a))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return i}function gl(e){let t;async function n(n={}){if(t){let e=await t;return await Promise.all([e.loadTheme(...n.themes||[]),e.loadLanguage(...n.langs||[])]),e}{t=e({...n,themes:[],langs:[]});let r=await t;return await Promise.all([r.loadTheme(...n.themes||[]),r.loadLanguage(...n.langs||[])]),r}}return n}function _l(e,t){let n=gl(e);async function r(e,r){let i=await n({langs:[r.lang],themes:`theme`in r?[r.theme]:Object.values(r.themes)}),a=await t?.guessEmbeddedLanguages?.(e,r.lang,i);return a&&await i.loadLanguage(...a),i}return{getSingletonHighlighter(e){return n(e)},async codeToHtml(e,t){return(await r(e,t)).codeToHtml(e,t)},async codeToHast(e,t){return(await r(e,t)).codeToHast(e,t)},async codeToTokens(e,t){return(await r(e,t)).codeToTokens(e,t)},async codeToTokensBase(e,t){return(await r(e,t)).codeToTokensBase(e,t)},async codeToTokensWithThemes(e,t){return(await r(e,t)).codeToTokensWithThemes(e,t)},async getLastGrammarState(e,t){return(await n({langs:[t.lang],themes:[t.theme]})).getLastGrammarState(e,t)}}}var vl=hl({langs:Cr,themes:wr,engine:()=>(0,Qr.createOnigurumaEngine)(O(()=>import(`./wasm-BnjxR4X6.js`),[]))}),{codeToHtml:yl,codeToHast:bl,codeToTokens:xl,codeToTokensBase:Sl,codeToTokensWithThemes:Cl,getSingletonHighlighter:wl,getLastGrammarState:Tl}=_l(vl,{guessEmbeddedLanguages:kc}),El=4294967295,Dl=class{patterns;options;regexps;constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}})}findNextMatchSync(e,t,n){let r=typeof e==`string`?e:e.content,i=[];function a(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>e==null?{start:El,end:El,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{n.lastIndex=t;let o=n.exec(r);if(!o)continue;if(o.index===t)return a(e,o,0);i.push([e,o,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(i.length){let e=Math.min(...i.map(e=>e[1].index));for(let[t,n,r]of i)if(n.index===e)return a(t,n,r)}return null}};function Ol(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function kl(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var Al=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),W=String.raw;function jl(e,t){if(e==null)throw Error(t??`Value expected`);return e}var Ml=W`\[\^?`,Nl=`c.? | C(?:-.?)?|${W`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${W`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${W`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${W`o\{[^\}]*\}?`}|${W`\d{1,3}`}`,Pl=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Fl=new RegExp(W`
12
+ \f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function Cc(e,t,n,r){let i=r.schema,a=i.space!==`svg`&&r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=ps);let l=wc(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!gc(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!ec(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function wc(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=Tc(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function Tc(e,t,n){let r=ls(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=Ls(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Sc.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Ws:Gs)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=Ls(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Sc.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&Us(n,o)>Us(n,e.alternative)&&(o=e.alternative),s=o+Ls(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?Sc.single:Sc.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var Ec=[`<`,`&`];function Dc(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:Ls(e.value,Object.assign({},r.settings.characterReferences,{subset:Ec}))}function Oc(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Dc(e,t,n,r)}function kc(e,t,n,r){return r.all(e)}var Ac=hs(`type`,{invalid:jc,unknown:Mc,handlers:{comment:Vs,doctype:Hs,element:Cc,raw:Oc,root:kc,text:Dc}});function jc(e){throw Error("Expected node, not `"+e+"`")}function Mc(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var Nc={},Pc={},Fc=[];function Ic(e,t){let n=t||Nc,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Lc,all:Rc,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||zo,characterReferences:n.characterReferences||Pc,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?ps:fs,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function Lc(e,t,n){return Ac(e,t,n,this)}function Rc(e){let t=[],n=e&&e.children||Fc,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var zc=/\s+/g;function Bc(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(zc)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(zc);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}var Vc=/:?lang=["']([^"']+)["']/g,Hc=/(?:```|~~~)([\w-]+)/g,Uc=/\\begin\{([\w-]+)\}/g,Wc=/<script\s+(?:type|lang)=["']([^"']+)["']/gi,Gc=/^\s*---\r?\n[\s\S]*?\r?\n---(?:\r?\n|\s*$)/;function Kc(e){let t=oo(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t.at(-1).length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}function qc(e,t,n){let r=new Set;for(let t of e.matchAll(Vc)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(Hc)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(Uc)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(Wc)){let e=t[1].toLowerCase().trim(),n=e.includes(`/`)?e.split(`/`).pop():e;n&&r.add(n)}if(Gc.test(e)&&r.add(`yaml`),!n)return[...r];let i=n.getBundledLanguages();return[...r].filter(e=>e&&i[e])}var Jc=[`color`,`background-color`];function Yc(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function Xc(e,t){let n=0,r=e.length;for(;n<r;){let i=n+(r-n>>1);e[i]<=t?n=i+1:r=i}return n}function Zc(e,t){let n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=e.offset+e.content.length,r=Xc(n,e.offset),i=r;for(;i<n.length&&n[i]<t;)i++;if(r===i)return e;let a=n.slice(r,i);for(let t=0;t<a.length;t++)a[t]-=e.offset;return Yc(e,a)})):e}function Qc(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>$c(e.variants[t])),s=new Set(o.flatMap(e=>Object.keys(e))),c={},l=(e,r)=>{let i=r===`color`?``:r===`background-color`?`-bg`:`-${r}`;return n+t[e]+(r===`color`?``:i)};return o.forEach((e,n)=>{for(let a of s){let s=e[a]||`inherit`;if(n===0&&r&&Jc.includes(a)){if(r===`light-dark()`&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new F('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let u=o[e][a]||`inherit`,d=o[r][a]||`inherit`;c[a]=`light-dark(${u}, ${d})`,i===`css-vars`&&(c[l(n,a)]=s)}else c[a]=s}else i===`css-vars`&&(c[l(n,a)]=s)}}),a.htmlStyle=c,a}function $c(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&I.Italic&&(t[`font-style`]=`italic`),e.fontStyle&I.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&I.Underline&&n.push(`underline`),e.fontStyle&I.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function el(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function tl(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=Kc(t.source);function r(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new F(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...n.indexToPos(e),offset:e}}{let t=n.lines[e.line];if(t===void 0)throw new F(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${n.lines.length}`);let r=e.character;if(r<0&&(r=t.length+r),r<0||r>t.length)throw new F(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:r,offset:n.posToIndex(e.line,r)}}}let i=(t.options.decorations||[]).map(e=>({...e,start:r(e.start),end:r(e.end)}));nl(i),e.set(t.meta,{decorations:i,converter:n,source:t.source})}return e.get(t.meta)}return{name:`shiki:decorations`,tokens(e){if(this.options.decorations?.length)return Zc(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=[...e.children].filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new F(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function i(e,t,n,i){let a=r[e],s=``,c=-1,l=-1;if(t===0&&(c=0),n===0&&(l=0),n===1/0&&(l=a.children.length),c===-1||l===-1)for(let e=0;e<a.children.length;e++)s+=rl(a.children[e]),c===-1&&s.length===t&&(c=e+1),l===-1&&s.length===n&&(l=e+1);if(c===-1)throw new F(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(l===-1)throw new F(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let u=a.children.slice(c,l);if(!i.alwaysWrap&&u.length===a.children.length)o(a,i,`line`);else if(!i.alwaysWrap&&u.length===1&&u[0].type===`element`)o(u[0],i,`token`);else{let e={type:`element`,tagName:`span`,properties:{},children:u};o(e,i,`wrapper`),a.children.splice(c,u.length,e)}}function a(e,t){r[e]=o(r[e],t,`line`)}function o(e,t,n){let r=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||`span`,e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&Bc(e,t.properties.class),e=i(e,n)||e,e}let s=[],c=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(let e of c){let{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,1/0,e);for(let r=t.line+1;r<n.line;r++)s.unshift(()=>a(r,e));i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}function nl(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new F(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){let t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,a=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,o=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,s=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||a||o||s){if(i&&a||o&&s||o&&n.start.offset===n.end.offset||a&&t.start.offset===t.end.offset)continue;throw new F(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}function rl(e){return e.type===`text`?e.value:e.type===`element`?e.children.map(rl).join(``):``}var il=[tl()];function al(e){let t=ol(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...il]}function ol(e){let t=[],n=[],r=[];for(let i of e)switch(i.enforce){case`pre`:t.push(i);break;case`post`:n.push(i);break;default:r.push(i)}return{pre:t,post:n,normal:r}}var sl=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],cl={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`};function ll(e,t){let n=e.indexOf(`\x1B`,t);if(n!==-1&&e[n+1]===`[`){let t=e.indexOf(`m`,n);if(t!==-1)return{sequence:e.substring(n+2,t).split(`;`),startPosition:n,position:t+1}}return{position:e.length}}function ul(e){let t=e.shift();if(t===`2`){let t=e.splice(0,3).map(e=>Number.parseInt(e));return t.length!==3||t.some(e=>Number.isNaN(e))?void 0:{type:`rgb`,rgb:t}}if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function dl(e){let t=[];for(;e.length>0;){let n=e.shift();if(!n)continue;let r=Number.parseInt(n);if(!Number.isNaN(r)){if(r===0)t.push({type:`resetAll`});else if(r<=9)cl[r]&&t.push({type:`setDecoration`,value:cl[r]});else if(r<=29){let e=cl[r-20];e&&(t.push({type:`resetDecoration`,value:e}),e===`dim`&&t.push({type:`resetDecoration`,value:`bold`}))}else if(r<=37)t.push({type:`setForegroundColor`,value:{type:`named`,name:sl[r-30]}});else if(r===38){let n=ul(e);n&&t.push({type:`setForegroundColor`,value:n})}else if(r===39)t.push({type:`resetForegroundColor`});else if(r<=47)t.push({type:`setBackgroundColor`,value:{type:`named`,name:sl[r-40]}});else if(r===48){let n=ul(e);n&&t.push({type:`setBackgroundColor`,value:n})}else r===49?t.push({type:`resetBackgroundColor`}):r===53?t.push({type:`setDecoration`,value:`overline`}):r===55?t.push({type:`resetDecoration`,value:`overline`}):r>=90&&r<=97?t.push({type:`setForegroundColor`,value:{type:`named`,name:sl[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:sl[r-100+8]}})}}return t}function fl(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=ll(r,a),s=o.sequence?r.substring(a,o.startPosition):r.substring(a);if(s.length>0&&i.push({value:s,foreground:e,background:t,decorations:new Set(n)}),o.sequence){let r=dl(o.sequence);for(let i of r)i.type===`resetAll`?(e=null,t=null,n.clear()):i.type===`resetForegroundColor`?e=null:i.type===`resetBackgroundColor`?t=null:i.type===`resetDecoration`&&n.delete(i.value);for(let i of r)i.type===`setForegroundColor`?e=i.value:i.type===`setBackgroundColor`?t=i.value:i.type===`setDecoration`&&n.add(i.value)}a=o.position}while(a<r.length);return i}}}var pl={black:`#000000`,red:`#bb0000`,green:`#00bb00`,yellow:`#bbbb00`,blue:`#0000bb`,magenta:`#ff00ff`,cyan:`#00bbbb`,white:`#eeeeee`,brightBlack:`#555555`,brightRed:`#ff5555`,brightGreen:`#00ff00`,brightYellow:`#ffff55`,brightBlue:`#5555ff`,brightMagenta:`#ff55ff`,brightCyan:`#55ffff`,brightWhite:`#ffffff`};function ml(e=pl){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,`0`)).join(``)}`}let r;function i(){if(r)return r;r=[];for(let e=0;e<sl.length;e++)r.push(t(sl[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let i=0;i<6;i++)for(let a=0;a<6;a++)r.push(n([e[t],e[i],e[a]]));let i=8;for(let e=0;e<24;e++,i+=10)r.push(n([i,i,i]));return r}function a(e){return i()[e]}function o(e){switch(e.type){case`named`:return t(e.name);case`rgb`:return n(e.rgb);case`table`:return a(e.index)}}return{value:o}}var hl=/#([0-9a-f]{3,8})/i,gl=/var\((--[\w-]+-ansi-[\w-]+)\)/,_l={black:`#000000`,red:`#cd3131`,green:`#0DBC79`,yellow:`#E5E510`,blue:`#2472C8`,magenta:`#BC3FBC`,cyan:`#11A8CD`,white:`#E5E5E5`,brightBlack:`#666666`,brightRed:`#F14C4C`,brightGreen:`#23D18B`,brightYellow:`#F5F543`,brightBlue:`#3B8EEA`,brightMagenta:`#D670D6`,brightCyan:`#29B8DB`,brightWhite:`#FFFFFF`};function vl(e,t,n){let r=Za(e,n),i=oo(t),a=ml(Object.fromEntries(sl.map(t=>{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||_l[t]]}))),o=fl();return i.map(t=>o.parse(t[0]).map(n=>{let i,o;n.decorations.has(`reverse`)?(i=n.background?a.value(n.background):e.bg,o=n.foreground?a.value(n.foreground):e.fg):(i=n.foreground?a.value(n.foreground):e.fg,o=n.background?a.value(n.background):void 0),i=Qa(i,r),o=Qa(o,r),n.decorations.has(`dim`)&&(i=yl(i));let s=I.None;return n.decorations.has(`bold`)&&(s|=I.Bold),n.decorations.has(`italic`)&&(s|=I.Italic),n.decorations.has(`underline`)&&(s|=I.Underline),n.decorations.has(`strikethrough`)&&(s|=I.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function yl(e){let t=e.match(hl);if(t){let e=t[1];if(e.length===8){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,`0`);return`#${e.slice(0,6)}${t}`}if(e.length===6)return`#${e}80`;if(e.length===4){let t=e[0],n=e[1],r=e[2],i=e[3];return`#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,`0`)}`}if(e.length===3){let t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}let n=e.match(gl);return n?`var(${n[1]}-dim)`:e}function bl(e,t,n={}){let r=e.resolveLangAlias(n.lang||`text`),{theme:i=e.getLoadedThemes()[0]}=n;if(!to(r)&&!ro(i)&&r===`ansi`){let{theme:r}=e.setTheme(i);return vl(r,t,n)}return Oo(e,t,n)}function xl(e,t,n){let r,i,a,o,s,c;if(`themes`in n){let{defaultColor:l=`light`,cssVariablePrefix:u=`--shiki-`,colorsRendering:d=`css-vars`}=n,f=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===l?-1:+(t.color===l));if(f.length===0)throw new F("`themes` option must not be empty");let p=Lo(e,t,n,bl);if(c=So(p),l&&l!==`light-dark()`&&!f.some(e=>e.color===l))throw new F(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=f.map(t=>e.getTheme(t.theme)),h=f.map(e=>e.color);a=p.map(e=>e.map(e=>Qc(e,h,u,l,d))),c&&xo(a,c);let g=f.map(e=>Za(e.theme,n));i=Sl(f,m,g,u,l,`fg`,d),r=Sl(f,m,g,u,l,`bg`,d),o=`shiki-themes ${m.map(e=>e.name).join(` `)}`,s=l?void 0:[i,r].join(`;`)}else if(`theme`in n){let s=Za(n.theme,n);a=bl(e,t,n);let l=e.getTheme(n.theme);r=Qa(l.bg,s),i=Qa(l.fg,s),o=l.name,c=So(a)}else throw new F("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function Sl(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=Qa(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===`light-dark()`&&e.length>1){let r=e.findIndex(e=>e.color===`light`),i=e.findIndex(e=>e.color===`dark`);if(r===-1||i===-1)throw new F('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Qa(t[r][a],n[r])||`inherit`}, ${Qa(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}var Cl=/^\s+$/,wl=/^(\s*)(.*?)(\s*)$/;function Tl(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>Tl(e,t,n),codeToTokens:(t,n)=>xl(e,t,n)}){let i=t;for(let e of al(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=xl(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=Dl(a):d===`never`&&(a=Ol(a)),f&&(a=kl(a));let p={...r,get source(){return i}};for(let e of al(n))a=e.tokens?.call(p,a)||a;return El(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function El(e,t,n,r=So(e)){let i=al(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={class:`shiki ${t.themeName||``}`};t.rootStyle!==!1&&(l.style=t.rootStyle==null?`background-color:${t.bg};color:${t.fg}`:t.rootStyle),c!==!1&&c!=null&&(l.tabindex=c.toString());for(let[e,n]of Object.entries(t.meta||{}))e.startsWith(`_`)||(l[e]=n);let u={type:`element`,tagName:`pre`,properties:l,children:[],data:t.data},d={type:`element`,tagName:`code`,properties:{},children:a},f=[],p={...n,structure:s,addClassToHast:Bc,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return u},get code(){return d},get lines(){return f}};if(e.forEach((e,t)=>{t&&(s===`inline`?o.children.push({type:`element`,tagName:`br`,properties:{},children:[]}):s===`classic`&&a.push({type:`text`,value:`
13
+ `}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=el(a.htmlStyle||$c(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&xo(m,r),m}function Dl(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&I.Underline||i.fontStyle&I.Strikethrough));o&&Cl.test(i.content)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function Ol(e){return e.map(e=>e.flatMap(e=>{if(Cl.test(e.content))return e;let t=e.content.match(wl);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function kl(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t.at(-1),r=el(e.htmlStyle||$c(e)),i=el(n.htmlStyle||$c(n)),a=e.fontStyle&&(e.fontStyle&I.Underline||e.fontStyle&I.Strikethrough),o=n.fontStyle&&(n.fontStyle&I.Underline||n.fontStyle&I.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var Al=Ic;function jl(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>Tl(e,t,n),codeToTokens:(t,n)=>xl(e,t,n)},i=Al(Tl(e,t,n,r));for(let e of al(n))i=e.postprocess?.call(r,i,n)||i;return i}async function Ml(e){let t=await yo(e);return{getLastGrammarState:(...e)=>ko(t,...e),codeToTokensBase:(e,n)=>bl(t,e,n),codeToTokensWithThemes:(e,n)=>Lo(t,e,n),codeToTokens:(e,n)=>xl(t,e,n),codeToHast:(e,n)=>Tl(t,e,n),codeToHtml:(e,n)=>jl(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function Nl(e){let t=e.langs,n=e.themes,r=e.engine;async function i(e){function i(n){if(typeof n==`string`){if(n=e.langAlias?.[n]||n,no(n))return[];let r=t[n];if(!r)throw new F(`Language \`${n}\` is not included in this bundle. You may want to load it from external source.`);return r}return n}function a(e){if(io(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new F(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let o=(e.themes??[]).map(e=>a(e)),s=(e.langs??[]).map(e=>i(e)),c=await Ml({engine:e.engine??r(),...e,themes:o,langs:s});return{...c,loadLanguage(...e){return c.loadLanguage(...e.map(i))},loadTheme(...e){return c.loadTheme(...e.map(a))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return i}function Pl(e){let t;async function n(n={}){if(t){let e=await t;return await Promise.all([e.loadTheme(...n.themes||[]),e.loadLanguage(...n.langs||[])]),e}{t=e({...n,themes:[],langs:[]});let r=await t;return await Promise.all([r.loadTheme(...n.themes||[]),r.loadLanguage(...n.langs||[])]),r}}return n}function Fl(e,t){let n=Pl(e);async function r(e,r){let i=await n({langs:[r.lang],themes:`theme`in r?[r.theme]:Object.values(r.themes)}),a=await t?.guessEmbeddedLanguages?.(e,r.lang,i);return a&&await i.loadLanguage(...a),i}return{getSingletonHighlighter(e){return n(e)},async codeToHtml(e,t){return(await r(e,t)).codeToHtml(e,t)},async codeToHast(e,t){return(await r(e,t)).codeToHast(e,t)},async codeToTokens(e,t){return(await r(e,t)).codeToTokens(e,t)},async codeToTokensBase(e,t){return(await r(e,t)).codeToTokensBase(e,t)},async codeToTokensWithThemes(e,t){return(await r(e,t)).codeToTokensWithThemes(e,t)},async getLastGrammarState(e,t){return(await n({langs:[t.lang],themes:[t.theme]})).getLastGrammarState(e,t)}}}var Il=Nl({langs:Vr,themes:Hr,engine:()=>(0,gi.createOnigurumaEngine)(k(()=>import(`./wasm-BnjxR4X6.js`),[]))}),{codeToHtml:Ll,codeToHast:Rl,codeToTokens:zl,codeToTokensBase:Bl,codeToTokensWithThemes:Vl,getSingletonHighlighter:Hl,getLastGrammarState:Ul}=Fl(Il,{guessEmbeddedLanguages:qc}),Wl=4294967295,Gl=class{patterns;options;regexps;constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}})}findNextMatchSync(e,t,n){let r=typeof e==`string`?e:e.content,i=[];function a(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>e==null?{start:Wl,end:Wl,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{n.lastIndex=t;let o=n.exec(r);if(!o)continue;if(o.index===t)return a(e,o,0);i.push([e,o,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(i.length){let e=Math.min(...i.map(e=>e[1].index));for(let[t,n,r]of i)if(n.index===e)return a(t,n,r)}return null}};function Kl(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function ql(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var Jl=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),W=String.raw;function Yl(e,t){if(e==null)throw Error(t??`Value expected`);return e}var Xl=W`\[\^?`,Zl=`c.? | C(?:-.?)?|${W`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${W`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${W`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${W`o\{[^\}]*\}?`}|${W`\d{1,3}`}`,Ql=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,$l=new RegExp(W`
14
14
  \\ (?:
15
- ${Nl}
15
+ ${Zl}
16
16
  | [gk]<[^>]*>?
17
17
  | [gk]'[^']*'?
18
18
  | .
@@ -29,20 +29,20 @@ import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{Dc as r,
29
29
  )?
30
30
  | \*[^\)]*\)?
31
31
  )?
32
- | (?:${Pl.source})+
33
- | ${Ml}
32
+ | (?:${Ql.source})+
33
+ | ${Xl}
34
34
  | .
35
- `.replace(/\s+/g,``),`gsu`),Il=new RegExp(W`
35
+ `.replace(/\s+/g,``),`gsu`),eu=new RegExp(W`
36
36
  \\ (?:
37
- ${Nl}
37
+ ${Zl}
38
38
  | .
39
39
  )
40
40
  | \[:(?:\^?\p{Alpha}+|\^):\]
41
- | ${Ml}
41
+ | ${Xl}
42
42
  | &&
43
43
  | .
44
- `.replace(/\s+/g,``),`gsu`);function Ll(e,t={}){let n={flags:``,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!=`string`)throw Error(`String expected as pattern`);let r=pu(n.flags),i=[r.extended],a={captureGroup:n.rules.captureGroup,getCurrentModX(){return i.at(-1)},numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:n.rules.singleline},o=[],s;for(Fl.lastIndex=0;s=Fl.exec(e);){let t=Rl(a,e,s[0],Fl.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(Fl.lastIndex=t.lastIndex)}let c=[],l=0;o.filter(e=>e.type===`GroupOpen`).forEach(e=>{e.kind===`capturing`?e.number=++l:e.raw===`(`&&c.push(e)}),l||c.forEach((e,t)=>{e.kind=`capturing`,e.number=t+1});let u=l||c.length;return{tokens:o.map(e=>e.type===`EscapedNumber`?hu(e,u):e).flat(),flags:r}}function Rl(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=zl(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:Ul(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:ru(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:Wl(n)}}if(a===`K`)return{token:Zl(`keep`,n)};if(a===`N`||a===`R`)return{token:Xl(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:Xl(`any`,n)};if(a===`X`)return{token:Xl(`text_segment`,n)};let e=Vl(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:cu(n)};if(n===`(?{`)throw Error(`Unsupported callout "${n}"`);if(n.startsWith(`(?#`)){if(t[r]!==`)`)throw Error(`Unclosed comment group "(?#"`);return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:su(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:eu(`group`,n)};if(n===`(?>`)return{token:eu(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:eu(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:eu(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:eu(`absence_repeater`,n)}}throw Error(n===`(?(`?`Unsupported conditional "${n}"`:`Invalid or unsupported group option "${n}"`)}if(n===`)`){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error(`Unmatched ")"`);return{token:$l(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(`
45
- `,r);return{lastIndex:e===-1?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return n===`.`?{token:Xl(`dot`,n)}:n===`^`||n===`$`?{token:Ul(e.singleline?{"^":W`\A`,$:W`\Z`}[n]:n,n)}:n===`|`?{token:Hl(n)}:Pl.test(n)?{tokens:gu(n)}:{token:Gl(Ol(n),n)}}function zl(e,t,n){let r=[Yl(t[1]===`^`,t)],i=1,a;for(Il.lastIndex=n;a=Il.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(Yl(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(Gl(93,e));else if(i--,r.push(Kl(e)),!i)break}else{let t=Bl(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:Il.lastIndex||e.length}}function Bl(e){if(e[0]===`\\`)return Vl(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Al.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return Xl(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?ql(e):e===`&&`?Jl(e):Gl(Ol(e),e)}function Vl(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return ou(e);if(`dDhHsSwW`.includes(n))return uu(e);if(e.startsWith(W`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw Error(`Incomplete or invalid Unicode property "${e}"`);return du(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join(``);return Gl(Ol(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return Gl(mu(e),e);if(au.has(n))return Gl(au.get(n),e);if(/\d/.test(n))return Ql(t,e);if(e===`\\`)throw Error(W`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return Gl(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function Hl(e){return{type:`Alternator`,raw:e}}function Ul(e,t){return{type:`Assertion`,kind:e,raw:t}}function Wl(e){return{type:`Backreference`,raw:e}}function Gl(e,t){return{type:`Character`,value:e,raw:t}}function Kl(e){return{type:`CharacterClassClose`,raw:e}}function ql(e){return{type:`CharacterClassHyphen`,raw:e}}function Jl(e){return{type:`CharacterClassIntersector`,raw:e}}function Yl(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function Xl(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function Zl(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:jl(n.flags),raw:t}}function Ql(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function $l(e){return{type:`GroupClose`,raw:e}}function eu(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function tu(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function nu(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function ru(e){return{type:`Subroutine`,raw:e}}var iu=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),au=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function ou(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return Gl(Ol(t.toUpperCase())-64,e)}function su(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=fu(n),o=fu(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),Zl(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,eu(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function cu(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(r===``)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(`,`).filter(e=>e!==``).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,c]=a,l=iu.has(n)?n.toLowerCase():`custom`;switch(l){case`fail`:case`mismatch`:case`skip`:if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case`error`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(typeof o==`string`)throw Error(`Named callout argument must be a number "${o}"`);break;case`max`:if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof s==`number`||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case`count`:case`total_count`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(a.length===1&&(typeof o==`number`||!/^[<>X]$/.test(o)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case`cmp`:if(a.length!==3)throw Error(`Named callout must have three arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(typeof s==`number`||!/^(?:[<>!=]=|[<>])$/.test(s))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${s}"`);if(typeof c==`string`&&!/^[A-Za-z_]\w*$/.test(c))throw Error(`Named callout argument three must be a tag or number "${c}"`);break;case`custom`:throw Error(`Undefined callout name "${n}"`);default:throw Error(`Unexpected named callout kind "${l}"`)}return tu(l,r??null,i?.split(`,`)??null,e)}function lu(e){let t=null,n,r;if(e[0]===`{`){let{minStr:i,maxStr:a}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+i>o||a&&+a>o)throw Error(`Quantifier value unsupported in Oniguruma`);if(n=+i,r=a===void 0?+i:a===``?1/0:+a,n>r&&(t=`possessive`,[n,r]=[r,n]),e.endsWith(`?`)){if(t===`possessive`)throw Error(`Unsupported possessive interval quantifier chain with "?"`);t=`lazy`}else t||=`greedy`}else n=+(e[0]===`+`),r=e[0]===`?`?1:1/0,t=e[1]===`+`?`possessive`:e[1]===`?`?`lazy`:`greedy`;return nu(t,n,r,e)}function uu(e){let t=e[1].toLowerCase();return Xl({d:`digit`,h:`hex`,s:`space`,w:`word`}[t],e,{negate:e[1]!==t})}function du(e){let{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return Xl(`property`,e,{value:r,negate:t===`P`&&!n||t===`p`&&!!n})}function fu(e){let t={};return e.includes(`i`)&&(t.ignoreCase=!0),e.includes(`m`)&&(t.dotAll=!0),e.includes(`x`)&&(t.extended=!0),Object.keys(t).length?t:null}function pu(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){let r=e[n];if(!`imxDPSWy`.includes(r))throw Error(`Invalid flag "${r}"`);if(r===`y`){if(!/^y{[gw]}/.test(e.slice(n)))throw Error(`Invalid or unspecified flag "y" mode`);t.textSegmentMode=e[n+2]===`g`?`grapheme`:`word`,n+=3;continue}t[{i:`ignoreCase`,m:`dotAll`,x:`extended`,D:`digitIsAscii`,P:`posixIsAscii`,S:`spaceIsAscii`,W:`wordIsAscii`}[r]]=!0}return t}function mu(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw Error(`Incomplete or invalid escape "${e}"`);let t=e[2]===`{`?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function hu(e,t){let{raw:n,inCharClass:r}=e,i=n.slice(1);if(!r&&(i!==`0`&&i.length===1||i[0]!==`0`&&+i<=t))return[Wl(n)];let a=[],o=i.match(/^[0-7]+|\d/g);for(let e=0;e<o.length;e++){let t=o[e],r;if(e===0&&t!==`8`&&t!==`9`){if(r=parseInt(t,8),r>127)throw Error(W`Octal encoded byte above 177 unsupported "${n}"`)}else r=Ol(t);a.push(Gl(r,(e===0?`\\`:``)+t))}return a}function gu(e){let t=[],n=new RegExp(Pl,`gy`),r;for(;r=n.exec(e);){let e=r[0];if(e[0]===`{`){let r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(r){let{min:i,max:a}=r.groups;if(+i>+a&&e.endsWith(`?`)){n.lastIndex--,t.push(lu(e.slice(0,-1)));continue}}}t.push(lu(e))}return t}function _u(e,t){if(!Array.isArray(e.body))throw Error(`Expected node with body array`);if(e.body.length!==1)return!1;let n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}function vu(e){return yu.has(e.type)}var yu=new Set([`AbsenceFunction`,`Backreference`,`CapturingGroup`,`Character`,`CharacterClass`,`CharacterSet`,`Group`,`Quantifier`,`Subroutine`]);function bu(e,t={}){let n={flags:``,normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=Ll(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),i=(e,t)=>{let n=r.tokens[a.nextIndex];switch(a.parent=e,a.nextIndex++,n.type){case`Alternator`:return Au();case`Assertion`:return xu(n);case`Backreference`:return Su(n,a);case`Character`:return Pu(n.value,{useLastValid:!!t.isCheckingRangeEnd});case`CharacterClassHyphen`:return Cu(n,a,t);case`CharacterClassOpen`:return wu(n,a,t);case`CharacterSet`:return Tu(n,a);case`Directive`:return Ru(n.kind,{flags:n.flags});case`GroupOpen`:return Eu(n,a,t);case`NamedCallout`:return Hu(n.kind,n.tag,n.arguments);case`Quantifier`:return Du(n,a);case`Subroutine`:return Ou(n,a);default:throw Error(`Unexpected token type "${n.type}"`)}},a={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:i},o=Gu(zu(r.flags)),s=o.body[0];for(;a.nextIndex<r.tokens.length;){let e=i(s,{});e.type===`Alternative`?(o.body.push(e),s=e):s.body.push(e)}let{capturingGroups:c,hasNumberedRef:l,namedGroupsByName:u,subroutines:d}=a;if(l&&u.size&&!n.rules.captureGroup)throw Error(`Numbered backref/subroutine not allowed when using named capture`);for(let{ref:e}of d)if(typeof e==`number`){if(e>c.length)throw Error(`Subroutine uses a group number that's not defined`);e&&(c[e-1].isSubroutined=!0)}else if(u.has(e)){if(u.get(e).length>1)throw Error(W`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}else throw Error(W`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function xu({kind:e}){return ju(jl({"^":`line_start`,$:`line_end`,"\\A":`string_start`,"\\b":`word_boundary`,"\\B":`word_boundary`,"\\G":`search_start`,"\\y":`text_segment_boundary`,"\\Y":`text_segment_boundary`,"\\z":`string_end`,"\\Z":`string_end_newline`}[e],`Unexpected assertion kind "${e}"`),{negate:e===W`\B`||e===W`\Y`})}function Su({raw:e},t){let n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),i=(n,r=!1)=>{let i=t.capturingGroups.length,a=!1;if(n>i){if(t.skipBackrefValidation)a=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`)}return t.hasNumberedRef=!0,Mu(r?i+1-n:n,{orphan:a})};if(n){let n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(n)return i(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(r))throw Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw Error(`Group name not defined to the left "${e}"`);return Mu(r)}return i(+r)}function Cu(e,t,n){let{tokens:r,walk:i}=t,a=t.parent,o=a.body.at(-1),s=r[t.nextIndex];if(!n.isCheckingRangeEnd&&o&&o.type!==`CharacterClass`&&o.type!==`CharacterClassRange`&&s&&s.type!==`CharacterClassOpen`&&s.type!==`CharacterClassClose`&&s.type!==`CharacterClassIntersector`){let e=i(a,{...n,isCheckingRangeEnd:!0});if(o.type===`Character`&&e.type===`Character`)return a.body.pop(),Iu(o,e);throw Error(`Invalid character class range`)}return Pu(Ol(`-`))}function wu({negate:e},t,n){let{tokens:r,walk:i}=t,a=[Fu()],o=r[t.nextIndex],s=nd(o);for(;s.type!==`CharacterClassClose`;){if(s.type===`CharacterClassIntersector`)a.push(Fu()),t.nextIndex++;else{let e=a.at(-1);e.body.push(i(e,n))}s=nd(r[t.nextIndex],o)}let c=Fu({negate:e});return a.length===1?c.body=a[0].body:(c.kind=`intersection`,c.body=a.map(e=>e.body.length===1?e.body[0]:e)),t.nextIndex++,c}function Tu({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=r;if(e===`property`){let r=td(n);if(Al.has(r)&&!o?.has(r))e=`posix`,n=r;else return qu(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e===`posix`?Uu(n,{negate:t}):Lu(e,{negate:t})}function Eu(e,t,n){let{tokens:r,capturingGroups:i,namedGroupsByName:a,skipLookbehindValidation:o,walk:s}=t,c=Ju(e),l=c.type===`AbsenceFunction`,u=Qu(c),d=u&&c.negate;if(c.type===`CapturingGroup`&&(i.push(c),c.name&&kl(a,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw Error(`Nested absence function not supported by Oniguruma`);let f=rd(r[t.nextIndex]);for(;f.type!==`GroupClose`;){if(f.type===`Alternator`)c.body.push(Au()),t.nextIndex++;else{let e=c.body.at(-1),t=s(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||l,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||d});if(e.body.push(t),(u||n.isInLookbehind)&&!o){let e=`Lookbehind includes a pattern not allowed by Oniguruma`;if(d||n.isInNegLookbehind){if(Zu(t)||t.type===`CapturingGroup`)throw Error(e)}else if(Zu(t)||Qu(t)&&t.negate)throw Error(e)}}f=rd(r[t.nextIndex])}return t.nextIndex++,c}function Du({kind:e,min:t,max:n},r){let i=r.parent,a=i.body.at(-1);if(!a||!vu(a))throw Error(`Quantifier requires a repeatable token`);let o=Wu(e,t,n,a);return i.body.pop(),o}function Ou({raw:e},t){let{capturingGroups:n,subroutines:r}=t,i=e.slice(3,-1),a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(i);if(a){let e=+a.groups.num,r=n.length;if(t.hasNumberedRef=!0,i={"":e,"+":r+e,"-":r+1-e}[a.groups.sign],i<1)throw Error(`Invalid subroutine number`)}else i===`0`&&(i=0);let o=Ku(i);return r.push(o),o}function ku(e,t){if(e!==`repeater`)throw Error(`Unexpected absence function kind "${e}"`);return{type:`AbsenceFunction`,kind:e,body:Yu(t?.body)}}function Au(e){return{type:`Alternative`,body:Xu(e?.body)}}function ju(e,t){let n={type:`Assertion`,kind:e};return(e===`word_boundary`||e===`text_segment_boundary`)&&(n.negate=!!t?.negate),n}function Mu(e,t){let n=!!t?.orphan;return{type:`Backreference`,ref:e,...n&&{orphan:n}}}function Nu(e,t){let n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!$u(n.name))throw Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:`CapturingGroup`,number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:Yu(t?.body)}}function Pu(e,t){let n={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(n.useLastValid)e=1114111;else throw Error(e>1310719?`Invalid code point out of range "\\x{${t}}"`:`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:`Character`,value:e}}function Fu(e){let t={kind:`union`,negate:!1,...e};return{type:`CharacterClass`,kind:t.kind,negate:t.negate,body:Xu(e?.body)}}function Iu(e,t){if(t.value<e.value)throw Error(`Character class range out of order`);return{type:`CharacterClassRange`,min:e,max:t}}function Lu(e,t){let n=!!t?.negate,r={type:`CharacterSet`,kind:e};return(e===`digit`||e===`hex`||e===`newline`||e===`space`||e===`word`)&&(r.negate=n),(e===`text_segment`||e===`newline`&&!n)&&(r.variableLength=!0),r}function Ru(e,t={}){if(e===`keep`)return{type:`Directive`,kind:e};if(e===`flags`)return{type:`Directive`,kind:e,flags:jl(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}function zu(e){return{type:`Flags`,...e}}function Bu(e){let t=e?.atomic,n=e?.flags;if(t&&n)throw Error(`Atomic group cannot have flags`);return{type:`Group`,...t&&{atomic:t},...n&&{flags:n},body:Yu(e?.body)}}function Vu(e){let t={behind:!1,negate:!1,...e};return{type:`LookaroundAssertion`,kind:t.behind?`lookbehind`:`lookahead`,negate:t.negate,body:Yu(e?.body)}}function Hu(e,t,n){return{type:`NamedCallout`,kind:e,tag:t,arguments:n}}function Uu(e,t){let n=!!t?.negate;if(!Al.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:`CharacterSet`,kind:`posix`,value:e,negate:n}}function Wu(e,t,n,r){if(t>n)throw Error(`Invalid reversed quantifier range`);return{type:`Quantifier`,kind:e,min:t,max:n,body:r}}function Gu(e,t){return{type:`Regex`,body:Yu(t?.body),flags:e}}function Ku(e){return{type:`Subroutine`,ref:e}}function qu(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(td(e));if(!r){if(n.normalizeUnknownPropertyNames)r=ed(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(W`Invalid Unicode property "\p{${e}}"`)}return{type:`CharacterSet`,kind:`property`,value:r??e,negate:n.negate}}function Ju({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case`absence_repeater`:return ku(`repeater`);case`atomic`:return Bu({atomic:!0});case`capturing`:return Nu(i,{name:n});case`group`:return Bu({flags:e});case`lookahead`:case`lookbehind`:return Vu({behind:t===`lookbehind`,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}function Yu(e){if(e===void 0)e=[Au()];else if(!Array.isArray(e)||!e.length||!e.every(e=>e.type===`Alternative`))throw Error(`Invalid body; expected array of one or more Alternative nodes`);return e}function Xu(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error(`Invalid body; expected array of nodes`);return e}function Zu(e){return e.type===`LookaroundAssertion`&&e.kind===`lookahead`}function Qu(e){return e.type===`LookaroundAssertion`&&e.kind===`lookbehind`}function $u(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function ed(e){return e.trim().replace(/[- _]+/g,`_`).replace(/[A-Z][a-z]+(?=[A-Z])/g,`$&_`).replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function td(e){return e.replace(/[- _]+/g,``).toLowerCase()}function nd(e,t){let n=t;return jl(e,`Unclosed character class${n?.type===`Character`&&n.value===93&&n.raw===`]`?` (started with "]")`:``}`)}function rd(e){return jl(e,`Unclosed group`)}function id(e,t,n=null){function r(e,t){for(let n=0;n<e.length;n++){let r=i(e[n],t,n,e);n=Math.max(-1,n+r)}}function i(a,o=null,s=null,c=null){let l=0,u=!1,d={node:a,parent:o,key:s,container:c,root:e,remove(){ad(c).splice(Math.max(0,od(s)+l),1),l--,u=!0},removeAllNextSiblings(){return ad(c).splice(od(s)+1)},removeAllPrevSiblings(){let e=od(s)+l;return l-=e,ad(c).splice(0,Math.max(0,e))},replaceWith(e,t={}){let n=!!t.traverse;c?c[Math.max(0,od(s)+l)]=e:jl(o,`Can't replace root node`)[s]=e,n&&i(e,o,s,c),u=!0},replaceWithMultiple(e,t={}){let n=!!t.traverse;if(ad(c).splice(Math.max(0,od(s)+l),1,...e),l+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=i(e[n],o,od(s)+n+t,c)}u=!0},skip(){u=!0}},{type:f}=a,p=t[`*`],m=t[f],h=typeof p==`function`?p:p?.enter,g=typeof m==`function`?m:m?.enter;if(h?.(d,n),g?.(d,n),!u)switch(f){case`AbsenceFunction`:case`Alternative`:case`CapturingGroup`:case`CharacterClass`:case`Group`:case`LookaroundAssertion`:r(a.body,a);break;case`Assertion`:case`Backreference`:case`Character`:case`CharacterSet`:case`Directive`:case`Flags`:case`NamedCallout`:case`Subroutine`:break;case`CharacterClassRange`:i(a.min,a,`min`),i(a.max,a,`max`);break;case`Quantifier`:i(a.body,a,`body`);break;case`Regex`:r(a.body,a),i(a.flags,a,`flags`);break;default:throw Error(`Unexpected node type "${f}"`)}return m?.exit?.(d,n),p?.exit?.(d,n),l}return i(e),e}function ad(e){if(!Array.isArray(e))throw Error(`Container expected`);return e}function od(e){if(typeof e!=`number`)throw Error(`Numeric key expected`);return e}var sd=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function cd(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function ld(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var G=Object.freeze({DEFAULT:`DEFAULT`,CHAR_CLASS:`CHAR_CLASS`});function ud(e,t,n,r){let i=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,`gsu`),a=[!1],o=0,s=``;for(let t of e.matchAll(i)){let{0:e,groups:{$skip:i}}=t;if(!i&&(!r||r===G.DEFAULT==!o)){n instanceof Function?s+=n(t,{context:o?G.CHAR_CLASS:G.DEFAULT,negated:a[a.length-1]}):s+=n;continue}e[0]===`[`?(o++,a.push(e[1]===`^`)):e===`]`&&o&&(o--,a.pop()),s+=e}return s}function dd(e,t,n,r){ud(e,t,n,r)}function fd(e,t,n=0,r){if(!new RegExp(t,`su`).test(e))return null;let i=RegExp(`${t}|(?<$skip>\\\\?.)`,`gsu`);i.lastIndex=n;let a=0,o;for(;o=i.exec(e);){let{0:e,groups:{$skip:t}}=o;if(!t&&(!r||r===G.DEFAULT==!a))return o;e===`[`?a++:e===`]`&&a&&a--,i.lastIndex==o.index&&i.lastIndex++}return null}function pd(e,t,n){return!!fd(e,t,0,n)}function md(e,t){let n=/\\?./gsu;n.lastIndex=t;let r=e.length,i=0,a=1,o;for(;o=n.exec(e);){let[e]=o;if(e===`[`)i++;else if(i)e===`]`&&i--;else if(e===`(`)a++;else if(e===`)`&&(a--,!a)){r=o.index;break}}return e.slice(t,r)}var hd=new RegExp(String.raw`(?<noncapturingStart>${sd})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,`gsu`);function gd(e,t){let n=t?.hiddenCaptures??[],r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};let i=[0],a=[],o=0,s=0,c=NaN,l;do{l=!1;let t=0,u=0,d=!1,f;for(hd.lastIndex=Number.isNaN(c)?0:c+7;f=hd.exec(e);){let{0:p,index:m,groups:{capturingStart:h,noncapturingStart:g}}=f;if(p===`[`)t++;else if(t)p===`]`&&t--;else if(p===`(?>`&&!d)c=m,d=!0;else if(d&&g)u++;else if(h)d?u++:(o++,i.push(o+s));else if(p===`)`&&d){if(!u){s++;let t=o+s;if(e=`${e.slice(0,c)}(?:(?=(${e.slice(c+3,m)}))<$$${t}>)${e.slice(m+1)}`,l=!0,a.push(t),cd(n,t),r.size){let e=new Map;r.forEach((n,r)=>{e.set(r>=t?r+1:r,n.map(e=>e>=t?e+1:e))}),r=e}break}u--}}}while(l);return n.push(...a),e=ud(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){let n=+t;if(n>i.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${i[n]}`}return`\\${n}`},G.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}var _d=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,vd=new RegExp(String.raw`
44
+ `.replace(/\s+/g,``),`gsu`);function tu(e,t={}){let n={flags:``,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!=`string`)throw Error(`String expected as pattern`);let r=ju(n.flags),i=[r.extended],a={captureGroup:n.rules.captureGroup,getCurrentModX(){return i.at(-1)},numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:n.rules.singleline},o=[],s;for($l.lastIndex=0;s=$l.exec(e);){let t=nu(a,e,s[0],$l.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&($l.lastIndex=t.lastIndex)}let c=[],l=0;o.filter(e=>e.type===`GroupOpen`).forEach(e=>{e.kind===`capturing`?e.number=++l:e.raw===`(`&&c.push(e)}),l||c.forEach((e,t)=>{e.kind=`capturing`,e.number=t+1});let u=l||c.length;return{tokens:o.map(e=>e.type===`EscapedNumber`?Nu(e,u):e).flat(),flags:r}}function nu(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=ru(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:su(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:xu(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:cu(n)}}if(a===`K`)return{token:hu(`keep`,n)};if(a===`N`||a===`R`)return{token:mu(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:mu(`any`,n)};if(a===`X`)return{token:mu(`text_segment`,n)};let e=au(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:Eu(n)};if(n===`(?{`)throw Error(`Unsupported callout "${n}"`);if(n.startsWith(`(?#`)){if(t[r]!==`)`)throw Error(`Unclosed comment group "(?#"`);return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:Tu(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:vu(`group`,n)};if(n===`(?>`)return{token:vu(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:vu(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:vu(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:vu(`absence_repeater`,n)}}throw Error(n===`(?(`?`Unsupported conditional "${n}"`:`Invalid or unsupported group option "${n}"`)}if(n===`)`){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error(`Unmatched ")"`);return{token:_u(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(`
45
+ `,r);return{lastIndex:e===-1?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return n===`.`?{token:mu(`dot`,n)}:n===`^`||n===`$`?{token:su(e.singleline?{"^":W`\A`,$:W`\Z`}[n]:n,n)}:n===`|`?{token:ou(n)}:Ql.test(n)?{tokens:Pu(n)}:{token:lu(Kl(n),n)}}function ru(e,t,n){let r=[pu(t[1]===`^`,t)],i=1,a;for(eu.lastIndex=n;a=eu.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(pu(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(lu(93,e));else if(i--,r.push(uu(e)),!i)break}else{let t=iu(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:eu.lastIndex||e.length}}function iu(e){if(e[0]===`\\`)return au(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Jl.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return mu(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?du(e):e===`&&`?fu(e):lu(Kl(e),e)}function au(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return wu(e);if(`dDhHsSwW`.includes(n))return Ou(e);if(e.startsWith(W`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw Error(`Incomplete or invalid Unicode property "${e}"`);return ku(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join(``);return lu(Kl(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return lu(Mu(e),e);if(Cu.has(n))return lu(Cu.get(n),e);if(/\d/.test(n))return gu(t,e);if(e===`\\`)throw Error(W`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return lu(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function ou(e){return{type:`Alternator`,raw:e}}function su(e,t){return{type:`Assertion`,kind:e,raw:t}}function cu(e){return{type:`Backreference`,raw:e}}function lu(e,t){return{type:`Character`,value:e,raw:t}}function uu(e){return{type:`CharacterClassClose`,raw:e}}function du(e){return{type:`CharacterClassHyphen`,raw:e}}function fu(e){return{type:`CharacterClassIntersector`,raw:e}}function pu(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function mu(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function hu(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:Yl(n.flags),raw:t}}function gu(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function _u(e){return{type:`GroupClose`,raw:e}}function vu(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function yu(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function bu(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function xu(e){return{type:`Subroutine`,raw:e}}var Su=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),Cu=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function wu(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return lu(Kl(t.toUpperCase())-64,e)}function Tu(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=Au(n),o=Au(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),hu(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,vu(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function Eu(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(r===``)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(`,`).filter(e=>e!==``).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,c]=a,l=Su.has(n)?n.toLowerCase():`custom`;switch(l){case`fail`:case`mismatch`:case`skip`:if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case`error`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(typeof o==`string`)throw Error(`Named callout argument must be a number "${o}"`);break;case`max`:if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof s==`number`||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case`count`:case`total_count`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(a.length===1&&(typeof o==`number`||!/^[<>X]$/.test(o)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case`cmp`:if(a.length!==3)throw Error(`Named callout must have three arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(typeof s==`number`||!/^(?:[<>!=]=|[<>])$/.test(s))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${s}"`);if(typeof c==`string`&&!/^[A-Za-z_]\w*$/.test(c))throw Error(`Named callout argument three must be a tag or number "${c}"`);break;case`custom`:throw Error(`Undefined callout name "${n}"`);default:throw Error(`Unexpected named callout kind "${l}"`)}return yu(l,r??null,i?.split(`,`)??null,e)}function Du(e){let t=null,n,r;if(e[0]===`{`){let{minStr:i,maxStr:a}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+i>o||a&&+a>o)throw Error(`Quantifier value unsupported in Oniguruma`);if(n=+i,r=a===void 0?+i:a===``?1/0:+a,n>r&&(t=`possessive`,[n,r]=[r,n]),e.endsWith(`?`)){if(t===`possessive`)throw Error(`Unsupported possessive interval quantifier chain with "?"`);t=`lazy`}else t||=`greedy`}else n=+(e[0]===`+`),r=e[0]===`?`?1:1/0,t=e[1]===`+`?`possessive`:e[1]===`?`?`lazy`:`greedy`;return bu(t,n,r,e)}function Ou(e){let t=e[1].toLowerCase();return mu({d:`digit`,h:`hex`,s:`space`,w:`word`}[t],e,{negate:e[1]!==t})}function ku(e){let{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return mu(`property`,e,{value:r,negate:t===`P`&&!n||t===`p`&&!!n})}function Au(e){let t={};return e.includes(`i`)&&(t.ignoreCase=!0),e.includes(`m`)&&(t.dotAll=!0),e.includes(`x`)&&(t.extended=!0),Object.keys(t).length?t:null}function ju(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){let r=e[n];if(!`imxDPSWy`.includes(r))throw Error(`Invalid flag "${r}"`);if(r===`y`){if(!/^y{[gw]}/.test(e.slice(n)))throw Error(`Invalid or unspecified flag "y" mode`);t.textSegmentMode=e[n+2]===`g`?`grapheme`:`word`,n+=3;continue}t[{i:`ignoreCase`,m:`dotAll`,x:`extended`,D:`digitIsAscii`,P:`posixIsAscii`,S:`spaceIsAscii`,W:`wordIsAscii`}[r]]=!0}return t}function Mu(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw Error(`Incomplete or invalid escape "${e}"`);let t=e[2]===`{`?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function Nu(e,t){let{raw:n,inCharClass:r}=e,i=n.slice(1);if(!r&&(i!==`0`&&i.length===1||i[0]!==`0`&&+i<=t))return[cu(n)];let a=[],o=i.match(/^[0-7]+|\d/g);for(let e=0;e<o.length;e++){let t=o[e],r;if(e===0&&t!==`8`&&t!==`9`){if(r=parseInt(t,8),r>127)throw Error(W`Octal encoded byte above 177 unsupported "${n}"`)}else r=Kl(t);a.push(lu(r,(e===0?`\\`:``)+t))}return a}function Pu(e){let t=[],n=new RegExp(Ql,`gy`),r;for(;r=n.exec(e);){let e=r[0];if(e[0]===`{`){let r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(r){let{min:i,max:a}=r.groups;if(+i>+a&&e.endsWith(`?`)){n.lastIndex--,t.push(Du(e.slice(0,-1)));continue}}}t.push(Du(e))}return t}function Fu(e,t){if(!Array.isArray(e.body))throw Error(`Expected node with body array`);if(e.body.length!==1)return!1;let n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}function Iu(e){return Lu.has(e.type)}var Lu=new Set([`AbsenceFunction`,`Backreference`,`CapturingGroup`,`Character`,`CharacterClass`,`CharacterSet`,`Group`,`Quantifier`,`Subroutine`]);function Ru(e,t={}){let n={flags:``,normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=tu(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),i=(e,t)=>{let n=r.tokens[a.nextIndex];switch(a.parent=e,a.nextIndex++,n.type){case`Alternator`:return Ju();case`Assertion`:return zu(n);case`Backreference`:return Bu(n,a);case`Character`:return Qu(n.value,{useLastValid:!!t.isCheckingRangeEnd});case`CharacterClassHyphen`:return Vu(n,a,t);case`CharacterClassOpen`:return Hu(n,a,t);case`CharacterSet`:return Uu(n,a);case`Directive`:return nd(n.kind,{flags:n.flags});case`GroupOpen`:return Wu(n,a,t);case`NamedCallout`:return od(n.kind,n.tag,n.arguments);case`Quantifier`:return Gu(n,a);case`Subroutine`:return Ku(n,a);default:throw Error(`Unexpected token type "${n.type}"`)}},a={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:i},o=ld(rd(r.flags)),s=o.body[0];for(;a.nextIndex<r.tokens.length;){let e=i(s,{});e.type===`Alternative`?(o.body.push(e),s=e):s.body.push(e)}let{capturingGroups:c,hasNumberedRef:l,namedGroupsByName:u,subroutines:d}=a;if(l&&u.size&&!n.rules.captureGroup)throw Error(`Numbered backref/subroutine not allowed when using named capture`);for(let{ref:e}of d)if(typeof e==`number`){if(e>c.length)throw Error(`Subroutine uses a group number that's not defined`);e&&(c[e-1].isSubroutined=!0)}else if(u.has(e)){if(u.get(e).length>1)throw Error(W`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}else throw Error(W`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function zu({kind:e}){return Yu(Yl({"^":`line_start`,$:`line_end`,"\\A":`string_start`,"\\b":`word_boundary`,"\\B":`word_boundary`,"\\G":`search_start`,"\\y":`text_segment_boundary`,"\\Y":`text_segment_boundary`,"\\z":`string_end`,"\\Z":`string_end_newline`}[e],`Unexpected assertion kind "${e}"`),{negate:e===W`\B`||e===W`\Y`})}function Bu({raw:e},t){let n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),i=(n,r=!1)=>{let i=t.capturingGroups.length,a=!1;if(n>i){if(t.skipBackrefValidation)a=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`)}return t.hasNumberedRef=!0,Xu(r?i+1-n:n,{orphan:a})};if(n){let n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(n)return i(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(r))throw Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw Error(`Group name not defined to the left "${e}"`);return Xu(r)}return i(+r)}function Vu(e,t,n){let{tokens:r,walk:i}=t,a=t.parent,o=a.body.at(-1),s=r[t.nextIndex];if(!n.isCheckingRangeEnd&&o&&o.type!==`CharacterClass`&&o.type!==`CharacterClassRange`&&s&&s.type!==`CharacterClassOpen`&&s.type!==`CharacterClassClose`&&s.type!==`CharacterClassIntersector`){let e=i(a,{...n,isCheckingRangeEnd:!0});if(o.type===`Character`&&e.type===`Character`)return a.body.pop(),ed(o,e);throw Error(`Invalid character class range`)}return Qu(Kl(`-`))}function Hu({negate:e},t,n){let{tokens:r,walk:i}=t,a=[$u()],o=r[t.nextIndex],s=bd(o);for(;s.type!==`CharacterClassClose`;){if(s.type===`CharacterClassIntersector`)a.push($u()),t.nextIndex++;else{let e=a.at(-1);e.body.push(i(e,n))}s=bd(r[t.nextIndex],o)}let c=$u({negate:e});return a.length===1?c.body=a[0].body:(c.kind=`intersection`,c.body=a.map(e=>e.body.length===1?e.body[0]:e)),t.nextIndex++,c}function Uu({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=r;if(e===`property`){let r=yd(n);if(Jl.has(r)&&!o?.has(r))e=`posix`,n=r;else return dd(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e===`posix`?sd(n,{negate:t}):td(e,{negate:t})}function Wu(e,t,n){let{tokens:r,capturingGroups:i,namedGroupsByName:a,skipLookbehindValidation:o,walk:s}=t,c=fd(e),l=c.type===`AbsenceFunction`,u=gd(c),d=u&&c.negate;if(c.type===`CapturingGroup`&&(i.push(c),c.name&&ql(a,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw Error(`Nested absence function not supported by Oniguruma`);let f=xd(r[t.nextIndex]);for(;f.type!==`GroupClose`;){if(f.type===`Alternator`)c.body.push(Ju()),t.nextIndex++;else{let e=c.body.at(-1),t=s(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||l,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||d});if(e.body.push(t),(u||n.isInLookbehind)&&!o){let e=`Lookbehind includes a pattern not allowed by Oniguruma`;if(d||n.isInNegLookbehind){if(hd(t)||t.type===`CapturingGroup`)throw Error(e)}else if(hd(t)||gd(t)&&t.negate)throw Error(e)}}f=xd(r[t.nextIndex])}return t.nextIndex++,c}function Gu({kind:e,min:t,max:n},r){let i=r.parent,a=i.body.at(-1);if(!a||!Iu(a))throw Error(`Quantifier requires a repeatable token`);let o=cd(e,t,n,a);return i.body.pop(),o}function Ku({raw:e},t){let{capturingGroups:n,subroutines:r}=t,i=e.slice(3,-1),a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(i);if(a){let e=+a.groups.num,r=n.length;if(t.hasNumberedRef=!0,i={"":e,"+":r+e,"-":r+1-e}[a.groups.sign],i<1)throw Error(`Invalid subroutine number`)}else i===`0`&&(i=0);let o=ud(i);return r.push(o),o}function qu(e,t){if(e!==`repeater`)throw Error(`Unexpected absence function kind "${e}"`);return{type:`AbsenceFunction`,kind:e,body:pd(t?.body)}}function Ju(e){return{type:`Alternative`,body:md(e?.body)}}function Yu(e,t){let n={type:`Assertion`,kind:e};return(e===`word_boundary`||e===`text_segment_boundary`)&&(n.negate=!!t?.negate),n}function Xu(e,t){let n=!!t?.orphan;return{type:`Backreference`,ref:e,...n&&{orphan:n}}}function Zu(e,t){let n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!_d(n.name))throw Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:`CapturingGroup`,number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:pd(t?.body)}}function Qu(e,t){let n={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(n.useLastValid)e=1114111;else throw Error(e>1310719?`Invalid code point out of range "\\x{${t}}"`:`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:`Character`,value:e}}function $u(e){let t={kind:`union`,negate:!1,...e};return{type:`CharacterClass`,kind:t.kind,negate:t.negate,body:md(e?.body)}}function ed(e,t){if(t.value<e.value)throw Error(`Character class range out of order`);return{type:`CharacterClassRange`,min:e,max:t}}function td(e,t){let n=!!t?.negate,r={type:`CharacterSet`,kind:e};return(e===`digit`||e===`hex`||e===`newline`||e===`space`||e===`word`)&&(r.negate=n),(e===`text_segment`||e===`newline`&&!n)&&(r.variableLength=!0),r}function nd(e,t={}){if(e===`keep`)return{type:`Directive`,kind:e};if(e===`flags`)return{type:`Directive`,kind:e,flags:Yl(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}function rd(e){return{type:`Flags`,...e}}function id(e){let t=e?.atomic,n=e?.flags;if(t&&n)throw Error(`Atomic group cannot have flags`);return{type:`Group`,...t&&{atomic:t},...n&&{flags:n},body:pd(e?.body)}}function ad(e){let t={behind:!1,negate:!1,...e};return{type:`LookaroundAssertion`,kind:t.behind?`lookbehind`:`lookahead`,negate:t.negate,body:pd(e?.body)}}function od(e,t,n){return{type:`NamedCallout`,kind:e,tag:t,arguments:n}}function sd(e,t){let n=!!t?.negate;if(!Jl.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:`CharacterSet`,kind:`posix`,value:e,negate:n}}function cd(e,t,n,r){if(t>n)throw Error(`Invalid reversed quantifier range`);return{type:`Quantifier`,kind:e,min:t,max:n,body:r}}function ld(e,t){return{type:`Regex`,body:pd(t?.body),flags:e}}function ud(e){return{type:`Subroutine`,ref:e}}function dd(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(yd(e));if(!r){if(n.normalizeUnknownPropertyNames)r=vd(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(W`Invalid Unicode property "\p{${e}}"`)}return{type:`CharacterSet`,kind:`property`,value:r??e,negate:n.negate}}function fd({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case`absence_repeater`:return qu(`repeater`);case`atomic`:return id({atomic:!0});case`capturing`:return Zu(i,{name:n});case`group`:return id({flags:e});case`lookahead`:case`lookbehind`:return ad({behind:t===`lookbehind`,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}function pd(e){if(e===void 0)e=[Ju()];else if(!Array.isArray(e)||!e.length||!e.every(e=>e.type===`Alternative`))throw Error(`Invalid body; expected array of one or more Alternative nodes`);return e}function md(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error(`Invalid body; expected array of nodes`);return e}function hd(e){return e.type===`LookaroundAssertion`&&e.kind===`lookahead`}function gd(e){return e.type===`LookaroundAssertion`&&e.kind===`lookbehind`}function _d(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function vd(e){return e.trim().replace(/[- _]+/g,`_`).replace(/[A-Z][a-z]+(?=[A-Z])/g,`$&_`).replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function yd(e){return e.replace(/[- _]+/g,``).toLowerCase()}function bd(e,t){let n=t;return Yl(e,`Unclosed character class${n?.type===`Character`&&n.value===93&&n.raw===`]`?` (started with "]")`:``}`)}function xd(e){return Yl(e,`Unclosed group`)}function Sd(e,t,n=null){function r(e,t){for(let n=0;n<e.length;n++){let r=i(e[n],t,n,e);n=Math.max(-1,n+r)}}function i(a,o=null,s=null,c=null){let l=0,u=!1,d={node:a,parent:o,key:s,container:c,root:e,remove(){Cd(c).splice(Math.max(0,wd(s)+l),1),l--,u=!0},removeAllNextSiblings(){return Cd(c).splice(wd(s)+1)},removeAllPrevSiblings(){let e=wd(s)+l;return l-=e,Cd(c).splice(0,Math.max(0,e))},replaceWith(e,t={}){let n=!!t.traverse;c?c[Math.max(0,wd(s)+l)]=e:Yl(o,`Can't replace root node`)[s]=e,n&&i(e,o,s,c),u=!0},replaceWithMultiple(e,t={}){let n=!!t.traverse;if(Cd(c).splice(Math.max(0,wd(s)+l),1,...e),l+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=i(e[n],o,wd(s)+n+t,c)}u=!0},skip(){u=!0}},{type:f}=a,p=t[`*`],m=t[f],h=typeof p==`function`?p:p?.enter,g=typeof m==`function`?m:m?.enter;if(h?.(d,n),g?.(d,n),!u)switch(f){case`AbsenceFunction`:case`Alternative`:case`CapturingGroup`:case`CharacterClass`:case`Group`:case`LookaroundAssertion`:r(a.body,a);break;case`Assertion`:case`Backreference`:case`Character`:case`CharacterSet`:case`Directive`:case`Flags`:case`NamedCallout`:case`Subroutine`:break;case`CharacterClassRange`:i(a.min,a,`min`),i(a.max,a,`max`);break;case`Quantifier`:i(a.body,a,`body`);break;case`Regex`:r(a.body,a),i(a.flags,a,`flags`);break;default:throw Error(`Unexpected node type "${f}"`)}return m?.exit?.(d,n),p?.exit?.(d,n),l}return i(e),e}function Cd(e){if(!Array.isArray(e))throw Error(`Container expected`);return e}function wd(e){if(typeof e!=`number`)throw Error(`Numeric key expected`);return e}var Td=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Ed(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Dd(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var Od=Object.freeze({DEFAULT:`DEFAULT`,CHAR_CLASS:`CHAR_CLASS`});function kd(e,t,n,r){let i=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,`gsu`),a=[!1],o=0,s=``;for(let t of e.matchAll(i)){let{0:e,groups:{$skip:i}}=t;if(!i&&(!r||r===Od.DEFAULT==!o)){n instanceof Function?s+=n(t,{context:o?Od.CHAR_CLASS:Od.DEFAULT,negated:a[a.length-1]}):s+=n;continue}e[0]===`[`?(o++,a.push(e[1]===`^`)):e===`]`&&o&&(o--,a.pop()),s+=e}return s}function Ad(e,t,n,r){kd(e,t,n,r)}function jd(e,t,n=0,r){if(!new RegExp(t,`su`).test(e))return null;let i=RegExp(`${t}|(?<$skip>\\\\?.)`,`gsu`);i.lastIndex=n;let a=0,o;for(;o=i.exec(e);){let{0:e,groups:{$skip:t}}=o;if(!t&&(!r||r===Od.DEFAULT==!a))return o;e===`[`?a++:e===`]`&&a&&a--,i.lastIndex==o.index&&i.lastIndex++}return null}function Md(e,t,n){return!!jd(e,t,0,n)}function Nd(e,t){let n=/\\?./gsu;n.lastIndex=t;let r=e.length,i=0,a=1,o;for(;o=n.exec(e);){let[e]=o;if(e===`[`)i++;else if(i)e===`]`&&i--;else if(e===`(`)a++;else if(e===`)`&&(a--,!a)){r=o.index;break}}return e.slice(t,r)}var Pd=new RegExp(String.raw`(?<noncapturingStart>${Td})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,`gsu`);function Fd(e,t){let n=t?.hiddenCaptures??[],r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};let i=[0],a=[],o=0,s=0,c=NaN,l;do{l=!1;let t=0,u=0,d=!1,f;for(Pd.lastIndex=Number.isNaN(c)?0:c+7;f=Pd.exec(e);){let{0:p,index:m,groups:{capturingStart:h,noncapturingStart:g}}=f;if(p===`[`)t++;else if(t)p===`]`&&t--;else if(p===`(?>`&&!d)c=m,d=!0;else if(d&&g)u++;else if(h)d?u++:(o++,i.push(o+s));else if(p===`)`&&d){if(!u){s++;let t=o+s;if(e=`${e.slice(0,c)}(?:(?=(${e.slice(c+3,m)}))<$$${t}>)${e.slice(m+1)}`,l=!0,a.push(t),Ed(n,t),r.size){let e=new Map;r.forEach((n,r)=>{e.set(r>=t?r+1:r,n.map(e=>e>=t?e+1:e))}),r=e}break}u--}}}while(l);return n.push(...a),e=kd(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){let n=+t;if(n>i.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${i[n]}`}return`\\${n}`},Od.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}var Id=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Ld=new RegExp(String.raw`
46
46
  \\(?: \d+
47
47
  | c[A-Za-z]
48
48
  | [gk]<[^>]+>
@@ -55,9 +55,9 @@ import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{Dc as r,
55
55
  | [A-Za-z\-]+:
56
56
  | \(DEFINE\)
57
57
  ))?
58
- | (?<qBase>${_d})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
58
+ | (?<qBase>${Id})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
59
59
  | \\?.
60
- `.replace(/\s+/g,``),`gsu`);function yd(e){if(!RegExp(`${_d}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(vd.lastIndex=0;o=vd.exec(e);){let{0:s,index:c,groups:{qBase:l,qMod:u,invalidQ:d}}=o;if(s===`[`)a||(r=c),a++;else if(s===`]`)a?a--:r=null;else if(!a){if(u===`+`&&i&&!i.startsWith(`(`)){if(d)throw Error(`Invalid quantifier "${s}"`);let t=-1;if(/^\{\d+\}$/.test(l))e=ld(e,c+l.length,u,``);else{if(i===`)`||i===`]`){let t=i===`)`?n:r;if(t===null)throw Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${l})${e.slice(c+s.length)}`}else e=`${e.slice(0,c-i.length)}(?>${i}${l})${e.slice(c+s.length)}`;t+=4}vd.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null)}i=s}return{pattern:e}}var bd=String.raw,xd=bd`\(\?R=(?<rDepth>[^\)]+)\)|${bd`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,Sd=bd`\(\?<(?![=!])(?<captureName>[^>]+)>`,Cd=bd`${Sd}|(?<unnamed>\()(?!\?)`,wd=new RegExp(bd`${Sd}|${xd}|\(\?|\\?.`,`gsu`),Td=`Cannot use multiple overlapping recursions`;function Ed(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(xd,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&pd(e,bd`\(\?\(DEFINE\)`,G.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=pd(e,bd`\\[1-9]`,G.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(wd.lastIndex=0;f=wd.exec(e);){let{0:t,groups:{captureName:p,rDepth:m,gRNameOrNum:h,gRDepth:g}}=f;if(t===`[`)u++;else if(u)t===`]`&&u--;else{if(m){if(Dd(m),l)throw Error(Td);if(o)throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with global recursion`);let t=e.slice(0,f.index),s=e.slice(wd.lastIndex);if(pd(s,xd,G.DEFAULT))throw Error(Td);let c=m-1;e=Od(t,s,c,!1,n,a,d),i=jd(i,t,c,a.length,0,d);break}if(h){Dd(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(Td);break}if(!u)throw Error(bd`Recursive \g cannot be used outside the referenced group "${r===`external`?h:bd`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=md(e,p);if(o&&pd(m,bd`${Sd}|\((?!\?)`,G.DEFAULT))throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with recursion of capturing groups`);let _=e.slice(p,f.index),v=m.slice(_.length+t.length),y=a.length,b=g-1,x=Od(_,v,b,!0,n,a,d);i=jd(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,wd.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),wd.lastIndex),s.set(p,wd.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),wd.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function Dd(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e=+e,e<2||e>100))throw Error(t)}function Od(e,t,n,r,i,a,o){let s=new Set;r&&dd(e+t,Sd,({groups:{captureName:e}})=>{s.add(e)},G.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${kd(`(?:${e}`,`forward`,...c)}(?:)${kd(`${t})`,`backward`,...c)}${t}`}function kd(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t<n;t++){let n=s(t);c+=ud(e,bd`${Cd}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:s,backref:c}})=>{if(c&&r&&!r.has(c))return e;let l=`_$${n}`;if(s||t){let n=o+a.length+1;return a.push(n),Ad(i,n),s?e:`(?<${t}${l}>`}return bd`\k<${c}${l}>`},G.DEFAULT)}return c}function Ad(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function jd(e,t,n,r,i,a){if(e.size&&r){let o=0;dd(t,Cd,()=>o++,G.DEFAULT);let s=a-o+i,c=new Map;return e.forEach((e,t)=>{let i=(r-o*n)/n,a=o*n,l=t>s+o?t+r:t,u=[];for(let t of e)if(t<=s)u.push(t);else if(t>s+o+i)u.push(t+r);else if(t<=s+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+a+i*e);c.set(l,u)}),c}return e}var K=String.fromCodePoint,q=String.raw,Md={},Nd=globalThis.RegExp;Md.flagGroups=(()=>{try{new Nd(`(?i:)`)}catch{return!1}return!0})(),Md.unicodeSets=(()=>{try{new Nd(`[[]]`,`v`)}catch{return!1}return!0})(),Md.bugFlagVLiteralHyphenIsRange=Md.unicodeSets?(()=>{try{new Nd(q`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,Md.bugNestedClassIgnoresNegation=Md.unicodeSets&&new Nd(`[[^a]]`,`v`).test(`a`);function Pd(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function Fd(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function Id(e,t){return Rd[e]>=Rd[t]}function Ld(e,t){if(e==null)throw Error(t??`Value expected`);return e}var Rd={ES2025:2025,ES2024:2024,ES2018:2018},zd={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function Bd(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!zd[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:`default`,avoidSubclass:!1,flags:``,global:!1,hasIndices:!1,lazyCompileLength:1/0,target:`auto`,verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target===`auto`&&(t.target=Md.flagGroups?`ES2025`:Md.unicodeSets?`ES2024`:`ES2018`),t}var Vd=`[ -\r ]`,Hd=new Set([K(304),K(305)]),Ud=q`[\p{L}\p{M}\p{N}\p{Pc}]`;function Wd(e){if(Hd.has(e))return[e];let t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),i=Jd.get(n),a=Kd.get(n),o=qd.get(n);return[...r].length===1&&t.add(r),o&&t.add(o),i&&t.add(i),t.add(n),a&&t.add(a),[...t]}var Gd=new Map(`C Other
60
+ `.replace(/\s+/g,``),`gsu`);function Rd(e){if(!RegExp(`${Id}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(Ld.lastIndex=0;o=Ld.exec(e);){let{0:s,index:c,groups:{qBase:l,qMod:u,invalidQ:d}}=o;if(s===`[`)a||(r=c),a++;else if(s===`]`)a?a--:r=null;else if(!a){if(u===`+`&&i&&!i.startsWith(`(`)){if(d)throw Error(`Invalid quantifier "${s}"`);let t=-1;if(/^\{\d+\}$/.test(l))e=Dd(e,c+l.length,u,``);else{if(i===`)`||i===`]`){let t=i===`)`?n:r;if(t===null)throw Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${l})${e.slice(c+s.length)}`}else e=`${e.slice(0,c-i.length)}(?>${i}${l})${e.slice(c+s.length)}`;t+=4}Ld.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null)}i=s}return{pattern:e}}var zd=String.raw,Bd=zd`\(\?R=(?<rDepth>[^\)]+)\)|${zd`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,Vd=zd`\(\?<(?![=!])(?<captureName>[^>]+)>`,Hd=zd`${Vd}|(?<unnamed>\()(?!\?)`,Ud=new RegExp(zd`${Vd}|${Bd}|\(\?|\\?.`,`gsu`),Wd=`Cannot use multiple overlapping recursions`;function Gd(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(Bd,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&Md(e,zd`\(\?\(DEFINE\)`,Od.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=Md(e,zd`\\[1-9]`,Od.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(Ud.lastIndex=0;f=Ud.exec(e);){let{0:t,groups:{captureName:p,rDepth:m,gRNameOrNum:h,gRDepth:g}}=f;if(t===`[`)u++;else if(u)t===`]`&&u--;else{if(m){if(Kd(m),l)throw Error(Wd);if(o)throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with global recursion`);let t=e.slice(0,f.index),s=e.slice(Ud.lastIndex);if(Md(s,Bd,Od.DEFAULT))throw Error(Wd);let c=m-1;e=qd(t,s,c,!1,n,a,d),i=Xd(i,t,c,a.length,0,d);break}if(h){Kd(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(Wd);break}if(!u)throw Error(zd`Recursive \g cannot be used outside the referenced group "${r===`external`?h:zd`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=Nd(e,p);if(o&&Md(m,zd`${Vd}|\((?!\?)`,Od.DEFAULT))throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with recursion of capturing groups`);let _=e.slice(p,f.index),v=m.slice(_.length+t.length),y=a.length,b=g-1,x=qd(_,v,b,!0,n,a,d);i=Xd(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,Ud.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),Ud.lastIndex),s.set(p,Ud.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),Ud.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function Kd(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e=+e,e<2||e>100))throw Error(t)}function qd(e,t,n,r,i,a,o){let s=new Set;r&&Ad(e+t,Vd,({groups:{captureName:e}})=>{s.add(e)},Od.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${Jd(`(?:${e}`,`forward`,...c)}(?:)${Jd(`${t})`,`backward`,...c)}${t}`}function Jd(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t<n;t++){let n=s(t);c+=kd(e,zd`${Hd}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:s,backref:c}})=>{if(c&&r&&!r.has(c))return e;let l=`_$${n}`;if(s||t){let n=o+a.length+1;return a.push(n),Yd(i,n),s?e:`(?<${t}${l}>`}return zd`\k<${c}${l}>`},Od.DEFAULT)}return c}function Yd(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Xd(e,t,n,r,i,a){if(e.size&&r){let o=0;Ad(t,Hd,()=>o++,Od.DEFAULT);let s=a-o+i,c=new Map;return e.forEach((e,t)=>{let i=(r-o*n)/n,a=o*n,l=t>s+o?t+r:t,u=[];for(let t of e)if(t<=s)u.push(t);else if(t>s+o+i)u.push(t+r);else if(t<=s+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+a+i*e);c.set(l,u)}),c}return e}var G=String.fromCodePoint,K=String.raw,Zd={},Qd=globalThis.RegExp;Zd.flagGroups=(()=>{try{new Qd(`(?i:)`)}catch{return!1}return!0})(),Zd.unicodeSets=(()=>{try{new Qd(`[[]]`,`v`)}catch{return!1}return!0})(),Zd.bugFlagVLiteralHyphenIsRange=Zd.unicodeSets?(()=>{try{new Qd(K`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,Zd.bugNestedClassIgnoresNegation=Zd.unicodeSets&&new Qd(`[[^a]]`,`v`).test(`a`);function $d(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function ef(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function tf(e,t){return rf[e]>=rf[t]}function nf(e,t){if(e==null)throw Error(t??`Value expected`);return e}var rf={ES2025:2025,ES2024:2024,ES2018:2018},af={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function of(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!af[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:`default`,avoidSubclass:!1,flags:``,global:!1,hasIndices:!1,lazyCompileLength:1/0,target:`auto`,verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target===`auto`&&(t.target=Zd.flagGroups?`ES2025`:Zd.unicodeSets?`ES2024`:`ES2018`),t}var sf=`[ -\r ]`,cf=new Set([G(304),G(305)]),lf=K`[\p{L}\p{M}\p{N}\p{Pc}]`;function uf(e){if(cf.has(e))return[e];let t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),i=mf.get(n),a=ff.get(n),o=pf.get(n);return[...r].length===1&&t.add(r),o&&t.add(o),i&&t.add(i),t.add(n),a&&t.add(a),[...t]}var df=new Map(`C Other
61
61
  Cc Control cntrl
62
62
  Cf Format
63
63
  Cn Unassigned
@@ -147,31 +147,31 @@ Uppercase Upper
147
147
  Variation_Selector VS
148
148
  White_Space space
149
149
  XID_Continue XIDC
150
- XID_Start XIDS`.split(/\s/).map(e=>[td(e),e])),Kd=new Map([[`s`,K(383)],[K(383),`s`]]),qd=new Map([[K(223),K(7838)],[K(107),K(8490)],[K(229),K(8491)],[K(969),K(8486)]]),Jd=new Map([Zd(453),Zd(456),Zd(459),Zd(498),...Qd(8072,8079),...Qd(8088,8095),...Qd(8104,8111),Zd(8124),Zd(8140),Zd(8188)]),Yd=new Map([[`alnum`,q`[\p{Alpha}\p{Nd}]`],[`alpha`,q`\p{Alpha}`],[`ascii`,q`\p{ASCII}`],[`blank`,q`[\p{Zs}\t]`],[`cntrl`,q`\p{Cc}`],[`digit`,q`\p{Nd}`],[`graph`,q`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,q`\p{Lower}`],[`print`,q`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,q`[\p{P}\p{S}]`],[`space`,q`\p{space}`],[`upper`,q`\p{Upper}`],[`word`,q`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,q`\p{AHex}`]]);function Xd(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function Zd(e){let t=K(e);return[t.toLowerCase(),t]}function Qd(e,t){return Xd(e,t).map(e=>Zd(e))}var $d=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function ef(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};af(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:Id(n.bestEffortTarget,`ES2024`),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};id(e,tf,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return id(e,nf,a),id(e,rf,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var tf={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=Bu();e.body[0].body.push(Vu({negate:!0,body:r}),qu(`Any`));let i=Bu();i.body[0].body.push(Wu(`greedy`,0,1/0,e)),n(J(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];Fd(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=ff(t.get(e));if(n){let t=Bu({flags:n});t.body[0].body=e.body,e.body=[J(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o(J(Vu({body:[Au({body:[ju(`string_end`)]}),Au({body:[Pu(10)]})]}),t));else if(c===`line_start`)o(J(xf(q`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`){if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&vf(e))o(J(Vu({negate:!0}),t));else if(d)throw Error(q`Uses "\G" in a way that requires a subclass`);else o(Cf(ju(`string_start`),t)),s.strategy=`clip_search`}}else if(c!==`string_end`&&c!==`string_start`){if(c===`string_end_newline`)o(J(xf(q`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${Ud})(?!${Ud})|(?<!${Ud})(?=${Ud}))`,n=`(?:(?<=${Ud})(?=${Ud})|(?<!${Ud})(?!${Ud}))`;o(J(xf(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!bf(n)&&(n=df(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!bf(r)&&(r=df(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n(J(Fu({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`)){n(Cf(Lu(`digit`,{negate:l}),t));return}if(o&&(c===`space`||u===`space`)){n(J(Sf(xf(Vd),l),t));return}if(s&&(c===`word`||u===`word`)){n(Cf(Lu(`word`,{negate:l}),t));return}if(c===`any`)n(Cf(qu(`Any`),t));else if(c===`digit`)n(Cf(qu(`Nd`,{negate:l}),t));else if(c!==`dot`){if(c===`text_segment`){if(r===`strict`)throw Error(q`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=q`\p{RI}{2}|${e}(?:\u200D${e})*`;n(J(xf(q`(?>\r\n|${i?q`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(Cf(qu(`AHex`,{negate:l}),t));else if(c===`newline`)n(J(xf(l?`[^
150
+ XID_Start XIDS`.split(/\s/).map(e=>[yd(e),e])),ff=new Map([[`s`,G(383)],[G(383),`s`]]),pf=new Map([[G(223),G(7838)],[G(107),G(8490)],[G(229),G(8491)],[G(969),G(8486)]]),mf=new Map([_f(453),_f(456),_f(459),_f(498),...vf(8072,8079),...vf(8088,8095),...vf(8104,8111),_f(8124),_f(8140),_f(8188)]),hf=new Map([[`alnum`,K`[\p{Alpha}\p{Nd}]`],[`alpha`,K`\p{Alpha}`],[`ascii`,K`\p{ASCII}`],[`blank`,K`[\p{Zs}\t]`],[`cntrl`,K`\p{Cc}`],[`digit`,K`\p{Nd}`],[`graph`,K`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,K`\p{Lower}`],[`print`,K`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,K`[\p{P}\p{S}]`],[`space`,K`\p{space}`],[`upper`,K`\p{Upper}`],[`word`,K`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,K`\p{AHex}`]]);function gf(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function _f(e){let t=G(e);return[t.toLowerCase(),t]}function vf(e,t){return gf(e,t).map(e=>_f(e))}var yf=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function bf(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};wf(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:tf(n.bestEffortTarget,`ES2024`),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};Sd(e,xf,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return Sd(e,Sf,a),Sd(e,Cf,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var xf={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=id();e.body[0].body.push(ad({negate:!0,body:r}),dd(`Any`));let i=id();i.body[0].body.push(cd(`greedy`,0,1/0,e)),n(q(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];ef(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=jf(t.get(e));if(n){let t=id({flags:n});t.body[0].body=e.body,e.body=[q(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o(q(ad({body:[Ju({body:[Yu(`string_end`)]}),Ju({body:[Qu(10)]})]}),t));else if(c===`line_start`)o(q(Bf(K`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`){if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&Lf(e))o(q(ad({negate:!0}),t));else if(d)throw Error(K`Uses "\G" in a way that requires a subclass`);else o(Hf(Yu(`string_start`),t)),s.strategy=`clip_search`}}else if(c!==`string_end`&&c!==`string_start`){if(c===`string_end_newline`)o(q(Bf(K`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${lf})(?!${lf})|(?<!${lf})(?=${lf}))`,n=`(?:(?<=${lf})(?=${lf})|(?<!${lf})(?!${lf}))`;o(q(Bf(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!zf(n)&&(n=Af(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!zf(r)&&(r=Af(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n(q($u({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`)){n(Hf(td(`digit`,{negate:l}),t));return}if(o&&(c===`space`||u===`space`)){n(q(Vf(Bf(sf),l),t));return}if(s&&(c===`word`||u===`word`)){n(Hf(td(`word`,{negate:l}),t));return}if(c===`any`)n(Hf(dd(`Any`),t));else if(c===`digit`)n(Hf(dd(`Nd`,{negate:l}),t));else if(c!==`dot`){if(c===`text_segment`){if(r===`strict`)throw Error(K`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=K`\p{RI}{2}|${e}(?:\u200D${e})*`;n(q(Bf(K`(?>\r\n|${i?K`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(Hf(dd(`AHex`,{negate:l}),t));else if(c===`newline`)n(q(Bf(l?`[^
151
151
  ]`:`(?>\r
152
152
  ?|[
153
- \v\f…\u2028\u2029])`),t));else if(c===`posix`){if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${K(e.codePointAt(0)-1)}${K(e.codePointAt(2)+1)}-\u{10FFFF}`),n(J(xf(`[${e}]`),t))}else n(J(Sf(xf(Yd.get(u)),l),t))}else if(c===`property`)Gd.has(td(u))||(e.key=`sc`);else if(c===`space`)n(Cf(qu(`space`,{negate:l}),t));else if(c===`word`)n(J(Sf(xf(Ud),l),t));else throw Error(`Unexpected character set kind "${c}"`)}},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`){if(!c.enable&&!c.disable)r();else{let e=Bu({flags:c});e.body[0].body=o(),i(J(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&_u(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(q`Uses "\K" in a way that's unsupported`);let o=Vu({behind:!0});o.body[0].body=a(),i(J(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(J(Vu({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=Bu();t.body[0].body.push(e.body),e.body=J(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=hf(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(q`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!bf(n)&&(n=df(n,t),e.ref=n)}},nf={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=Cf(lf(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&Fd(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=Fd(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=Pd(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&(n.type!==`CapturingGroup`||n.name!==a&&n.number!==a););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?lf(0):cf(o,r.groupOriginByCopy,null),l=c;if(!s){let e=ff(uf(o,e=>e.type===`Group`&&!!e.flags)),t=e?Pd(r.globalFlags,e):r.globalFlags;of(t,r.currentFlags)||(l=Bu({flags:pf(t)}),l.body[0].body.push(c))}n(J(l,t),{traverse:!s})}},rf={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>sf(t,e));i.length?i.length>1?n(J(Bu({atomic:!0,body:i.reverse().map(e=>Au({body:[Mu(e.number)]}))}),t)):e.ref=i[0].number:n(J(Vu({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=Nu();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&e.ref!==0&&(e.ref=t.reffedNodesByReferencer.get(e).number)}};function af(e){id(e,{"*"({node:e,parent:t}){e.parent=t}})}function of(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function sf(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=mf(n.parent);for(let r of t){if(r===n)break;if(r===e||gf(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function cf(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=cf(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function lf(e){let t=Ku(e);return t.isRecursive=!0,t}function uf(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function df(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function ff(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function pf({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function mf(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function hf(e){let t=e.find(e=>e.kind===`search_start`||yf(e,{negate:!1})||!_f(e));if(!t)return null;if(t.kind===`search_start`)return t;if(t.type===`LookaroundAssertion`)return t.body[0].body[0];if(t.type===`CapturingGroup`||t.type===`Group`){let e=[];for(let n of t.body){let t=hf(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function gf(e,t){let n=mf(e)??[];for(let e of n)if(e===t||gf(e,t))return!0;return!1}function _f({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function vf(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function yf(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&_u(e.body[0],{type:`Assertion`,kind:`search_start`})}function bf(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function xf(e,t){let n=bu(e,{...t,unicodePropertyMap:Gd}).body;return n.length>1||n[0].body.length>1?Bu({body:n}):n[0].body[0]}function Sf(e,t){return e.negate=t,e}function Cf(e,t){return e.parent=t,e}function J(e,t){return af(e),e.parent=t,e}function wf(e,t){let n=Bd(t),r=Id(n.target,`ES2024`),i=Id(n.target,`ES2025`),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error(`Invalid recursionLimit; use 2-20`);let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];id(e,Tf,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!(!e.flags.ignoreCase&&!o||s)},l=e,u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:r,verbose:n.verbose};function d(e){return u.lastNode=l,l=e,Ld(Ef[e.type],`Unexpected node type "${e.type}"`)(e,u,d)}let f={pattern:e.body.map(d).join(`|`),flags:d(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&f._hiddenCaptures.push(t),e.transferTo&&Fd(f._captureTransfers,e.transferTo,[]).push(t)}),f}var Tf={"*":{enter({node:e},t){if(Rf(e)){let n=t.getCurrentModI();t.pushModI(e.flags?Pd({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){Rf(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){Mf(K(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),Nf(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&$d.has(e.value)&&t.setHasCasedChar()}},Ef={Alternative({body:e},t,n){return e.map(n).join(``)},Assertion({kind:e,negate:t}){if(e===`string_end`)return`$`;if(e===`string_start`)return`^`;if(e===`word_boundary`)return t?q`\B`:q`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!=`number`)throw Error(`Unexpected named backref in transformed AST`);if(!t.useFlagMods&&t.accuracy===`strict`&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error(`Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy`);return`\\`+e},CapturingGroup(e,t,n){let{body:r,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:``}${r.map(n).join(`|`)})`},Character({value:e},t){let n=K(e),r=Pf(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Mf(n)){let e=Wd(n);return t.inCharClass?e.join(``):e.length>1?`[${e.join(``)}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:a}=e,{body:o}=e;if(r===`intersection`&&!t.useFlagV)throw Error(`Use of character class intersection requires min target ES2024`);Md.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(Bf)&&(o=[Pu(45),...o.filter(e=>!Bf(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||Md.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=Bu(),i=r.body[0];return r.parent=a,i.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=Au({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=s();return t.inCharClass=!1,r}let c=o[0];if(r===`union`&&!i&&c&&((!t.useFlagV||!t.verbose)&&a.kind===`union`&&!(Md.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&a.kind===`intersection`&&o.length===1&&c.type!==`CharacterClassRange`))return o.map(n).join(``);if(!t.useFlagV&&a.type===`CharacterClass`)throw Error(`Uses nested character class in a way that requires min target ES2024`);return s()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=Pf(n,i),o=Pf(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Ff(Nf(e)).forEach(e=>{s.add(Array.isArray(e)?`${Pf(e[0],i)}-${Pf(e[1],i)}`:Pf(e,i))}),`${a}-${o}${[...s].join(``)}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if(e===`dot`)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?`.`:`[^]`:q`[^\n]`;if(e===`digit`)return t?q`\D`:q`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&$d.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?q`\P`:q`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?q`\W`:q`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?`i`:``)+(e.dotAll?`s`:``)+(e.sticky?`y`:``)},Group({atomic:e,body:t,flags:n,parent:r},i,a){let o=i.currentFlags;n&&(i.currentFlags=Pd(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${If(e,n,i.useFlagMods)}${s})`;return i.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,i){return`(?${`${t===`lookahead`?``:`<`}${n?`!`:`=`}`}${e.map(i).join(`|`)})`},Quantifier(e,t,n){return n(e.body)+Lf(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error(`Unexpected non-recursive subroutine in transformed AST`);let r=n.recursionLimit;return t===0?`(?R=${r})`:q`\g<${t}&R=${r}>`}},Df=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),Of=new Set([`-`,`\\`,`]`,`^`,`[`]),kf=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),Af=new Map([[9,q`\t`],[10,q`\n`],[11,q`\v`],[12,q`\f`],[13,q`\r`],[8232,q`\u2028`],[8233,q`\u2029`],[65279,q`\uFEFF`]]),jf=/^\p{Cased}$/u;function Mf(e){return jf.test(e)}function Nf(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,a=[];if(r<65&&(i===65535||i>=131071)||r===65536&&i>=131071)return a;for(let e=r;e<=i;e++){let t=K(e);if(!Mf(t))continue;let o=Wd(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function Pf(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(Af.has(e))return Af.get(e);if(e<32||e>126&&e<160||e>262143||t&&zf(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?kf:Of:Df,a=K(e);return(i.has(a)?`\\`:``)+a}function Ff(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:r===null?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}function If(e,t,n){if(e)return`>`;let r=``;if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?`i`:``)+(e?.dotAll?`s`:``)+(n?`-`:``)+(n?.ignoreCase?`i`:``)+(n?.dotAll?`s`:``)}return`${r}:`}function Lf({kind:e,max:t,min:n}){let r;return r=!n&&t===1?`?`:!n&&t===1/0?`*`:n===1&&t===1/0?`+`:n===t?`{${n}}`:`{${n},${t===1/0?``:t}}`,r+{greedy:``,lazy:`?`,possessive:`+`}[e]}function Rf({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function zf(e){return e>47&&e<58}function Bf({type:e,value:t}){return e===`Character`&&t===45}var Vf=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error(`Cannot provide options when copying a regexp`);let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=Uf(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(Hf(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#e.get(e)??{};if(a?i.push(null):(i.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&n[e]!==void 0){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(t[a]=n[e],this.hasIndices&&(t.indices[a]=r[e]),t.groups){this.#r||=Wf(this.source);let i=this.#r.get(o);i&&(t.groups[i]=n[e],this.hasIndices&&(t.indices.groups[i]=r[e]))}}}return t}};function Hf(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function Uf(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)Fd(n,t,{}).transferTo=e;return n}function Wf(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,i=0,a;for(;a=t.exec(e);){let{0:e,groups:{capture:t,name:o}}=a;e===`[`?r++:r?e===`]`&&r--:t&&(i++,o&&n.set(i,o))}return n}function Gf(e,t){let n=Kf(e,t);return n.options?new Vf(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function Kf(e,t){let n=Bd(t),r=ef(bu(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Gd}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=wf(r,n),a=Ed(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=gd(yd(a.pattern).pattern,{captureTransfers:a.captureTransfers,hiddenCaptures:a.hiddenCaptures}),s={pattern:o.pattern,flags:`${n.hasIndices?`d`:``}${n.global?`g`:``}${i.flags}${i.options.disable.v?`u`:`v`}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw Error(`Lazy compilation requires subclass`)}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=r._strategy,a=s.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||a)&&(s.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...a&&{lazyCompile:a}})}return s}function qf(e,t){return Gf(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function Jf(e={}){let t={target:`auto`,cache:new Map,...e};return t.regexConstructor||=e=>qf(e,{target:t.target}),{createScanner(e){return new Dl(e,t)},createString(e){return{content:e}}}}async function Yf(e){if(fr())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=qn.get(e);if(t!=null)return t;try{let t=Jn.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(Cr,e)&&(t=Cr[e]),t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let n=t().then(({default:t})=>{let n={name:e,data:t};return Kn.has(e)||Kn.set(e,n),n});return qn.set(e,n),await n}finally{qn.delete(e)}}function Xf(e){return Kn.get(e)??Yf(e)}function Zf(e){for(let t of Zn(e))if(!Qn.has(t))return!1;return!0}function Qf({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:$f(t)}}function $f(e){return async()=>Ka(ir(await e()))}var ep=`pierre`,tp=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],np=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],rp=[...np,...tp],ip=new Set(np);function ap(e){return ip.has(e)?`light`:`dark`}var op={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},sp={"pierre-dark":()=>O(()=>import(`./pierre-dark-CpLgRqie.js`),[]),"pierre-dark-soft":()=>O(()=>import(`./pierre-dark-soft-kZQmAZld.js`),[]),"pierre-dark-vibrant":()=>O(()=>import(`./pierre-dark-vibrant-CpQYzh95.js`),[]),"pierre-dark-protanopia-deuteranopia":()=>O(()=>import(`./pierre-dark-protanopia-deuteranopia-B35FxJx-.js`),[]),"pierre-dark-tritanopia":()=>O(()=>import(`./pierre-dark-tritanopia-CpjhbsIL.js`),[]),"pierre-light":()=>O(()=>import(`./pierre-light-CoaEpmwp.js`),[]),"pierre-light-soft":()=>O(()=>import(`./pierre-light-soft-lWLdNTOI.js`),[]),"pierre-light-vibrant":()=>O(()=>import(`./pierre-light-vibrant-D80Fkn33.js`),[]),"pierre-light-protanopia-deuteranopia":()=>O(()=>import(`./pierre-light-protanopia-deuteranopia-0fSaH845.js`),[]),"pierre-light-tritanopia":()=>O(()=>import(`./pierre-light-tritanopia-CEbqgOJL.js`),[])};function cp(e){return Qf({name:e,collection:ep,colorScheme:ap(e),displayName:op[e],load:sp[e]})}var lp=$n({themes:rp.map(e=>cp(e))}),up=`shiki`,dp=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],fp=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),pp=new Set(dp);function mp(e){return pp.has(e)?`light`:`dark`}var hp={andromeeda:()=>O(()=>import(`./andromeeda-vGVdxbeo.js`),[]),"aurora-x":()=>O(()=>import(`./aurora-x-CDeNXAV0.js`),[]),"ayu-dark":()=>O(()=>import(`./ayu-dark-DluEY0Gj.js`),[]),"ayu-light":()=>O(()=>import(`./ayu-light-C3h-C4tm.js`),[]),"ayu-mirage":()=>O(()=>import(`./ayu-mirage-Bqwy1Gya.js`),[]),"catppuccin-frappe":()=>O(()=>import(`./catppuccin-frappe-C9Q5zVZY.js`),[]),"catppuccin-latte":()=>O(()=>import(`./catppuccin-latte-CtsyrtPq.js`),[]),"catppuccin-macchiato":()=>O(()=>import(`./catppuccin-macchiato-R8nAf1vR.js`),[]),"catppuccin-mocha":()=>O(()=>import(`./catppuccin-mocha-DjuaAJKi.js`),[]),"dark-plus":()=>O(()=>import(`./dark-plus-Cs2F2srj.js`),[]),dracula:()=>O(()=>import(`./dracula-BHWKrbxM.js`),[]),"dracula-soft":()=>O(()=>import(`./dracula-soft-5eyTD99u.js`),[]),"everforest-dark":()=>O(()=>import(`./everforest-dark-sB-x3p7T.js`),[]),"everforest-light":()=>O(()=>import(`./everforest-light-Df2xbC6M.js`),[]),"github-dark":()=>O(()=>import(`./github-dark-C-LZuMrd.js`),[]),"github-dark-default":()=>O(()=>import(`./github-dark-default-DXG-b-1a.js`),[]),"github-dark-dimmed":()=>O(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[]),"github-dark-high-contrast":()=>O(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[]),"github-light":()=>O(()=>import(`./github-light-EUqPIrTm.js`),[]),"github-light-default":()=>O(()=>import(`./github-light-default-BXViO-2h.js`),[]),"github-light-high-contrast":()=>O(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[]),"gruvbox-dark-hard":()=>O(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[]),"gruvbox-dark-medium":()=>O(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[]),"gruvbox-dark-soft":()=>O(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[]),"gruvbox-light-hard":()=>O(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[]),"gruvbox-light-medium":()=>O(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[]),"gruvbox-light-soft":()=>O(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[]),horizon:()=>O(()=>import(`./horizon-CE9ld1lL.js`),[]),"horizon-bright":()=>O(()=>import(`./horizon-bright-DSNQnXHK.js`),[]),houston:()=>O(()=>import(`./houston-CsvMBhTu.js`),[]),"kanagawa-dragon":()=>O(()=>import(`./kanagawa-dragon-Bozd7klA.js`),[]),"kanagawa-lotus":()=>O(()=>import(`./kanagawa-lotus-BmuOG9ZW.js`),[]),"kanagawa-wave":()=>O(()=>import(`./kanagawa-wave-BML5mF2J.js`),[]),laserwave:()=>O(()=>import(`./laserwave-C_8bwKvT.js`),[]),"light-plus":()=>O(()=>import(`./light-plus-DVQuIRkW.js`),[]),"material-theme":()=>O(()=>import(`./material-theme-Bm3Qr25_.js`),[]),"material-theme-darker":()=>O(()=>import(`./material-theme-darker-2IIEA8gg.js`),[]),"material-theme-lighter":()=>O(()=>import(`./material-theme-lighter-uhdI0v04.js`),[]),"material-theme-ocean":()=>O(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[]),"material-theme-palenight":()=>O(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[]),"min-dark":()=>O(()=>import(`./min-dark-BSWPekZh.js`),[]),"min-light":()=>O(()=>import(`./min-light-DDpmG2fV.js`),[]),monokai:()=>O(()=>import(`./monokai-B_bV9PQ9.js`),[]),"night-owl":()=>O(()=>import(`./night-owl-DhmEMT88.js`),[]),"night-owl-light":()=>O(()=>import(`./night-owl-light-eJ-hLW7d.js`),[]),nord:()=>O(()=>import(`./nord-Cb4Vim4T.js`),[]),"one-dark-pro":()=>O(()=>import(`./one-dark-pro-CLwyXe_n.js`),[]),"one-light":()=>O(()=>import(`./one-light-D7Lr4KcI.js`),[]),plastic:()=>O(()=>import(`./plastic-DQwYfKfQ.js`),[]),poimandres:()=>O(()=>import(`./poimandres-DRFjx7u4.js`),[]),red:()=>O(()=>import(`./red-DX1BQOs8.js`),[]),"rose-pine":()=>O(()=>import(`./rose-pine-aMsaMD1D.js`),[]),"rose-pine-dawn":()=>O(()=>import(`./rose-pine-dawn-8PwUyIlP.js`),[]),"rose-pine-moon":()=>O(()=>import(`./rose-pine-moon-DO-qXg-I.js`),[]),"slack-dark":()=>O(()=>import(`./slack-dark-DnToyrRv.js`),[]),"slack-ochin":()=>O(()=>import(`./slack-ochin-B2OO5cIa.js`),[]),"snazzy-light":()=>O(()=>import(`./snazzy-light-4G7pJPwS.js`),[]),"solarized-dark":()=>O(()=>import(`./solarized-dark-UdsmMDCL.js`),[]),"solarized-light":()=>O(()=>import(`./solarized-light-C1IUL_tW.js`),[]),"synthwave-84":()=>O(()=>import(`./synthwave-84-nFMaYfgc.js`),[]),"tokyo-night":()=>O(()=>import(`./tokyo-night-oM2G3aXe.js`),[]),vesper:()=>O(()=>import(`./vesper-DdrHHSXu.js`),[]),"vitesse-black":()=>O(()=>import(`./vitesse-black-fwtXNY1n.js`),[]),"vitesse-dark":()=>O(()=>import(`./vitesse-dark-BZCL-v6S.js`),[]),"vitesse-light":()=>O(()=>import(`./vitesse-light-VbXTXTou.js`),[])};function gp(e){return Qf({name:e,collection:up,colorScheme:mp(e),load:hp[e]})}var _p=$n({themes:Object.freeze([...dp.map(e=>gp(e)),...fp.map(e=>gp(e))])});function vp(e){if(fr())throw Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(lr.hasRegisteredTheme(e))return;let t=_p.getTheme(e);if(t!=null){lr.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function yp(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function bp(e){vp(e);let t=await lr.resolveTheme(e);return yp(e,t),t}function xp(e){return lr.getResolvedTheme(e)??bp(e)}var Sp;async function Cp({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){Sp??=vl({themes:[],langs:[`text`],engine:n===`shiki-wasm`?Zr(O(()=>import(`./wasm-BnjxR4X6.js`),[])):Jf()});let r=Ep(Sp)?await Sp:Sp;Sp=r;let i=[];for(let e of Array.from(new Set(t))){if(e===`text`||e===`ansi`)continue;let t=Xf(e);`then`in t?i.push(t):dr(t,r)}let a=[];for(let t of e){let e=xp(t);`then`in e?a.push(e):ur(e,Sp)}return(i.length>0||a.length>0)&&await Promise.all([Promise.all(i).then(e=>{dr(e,r)}),Promise.all(a).then(e=>{ur(e,r)})]),r}function wp(e=Sp){return e!=null&&!(`then`in e)}function Tp(e){if(!(Sp==null||`then`in Sp)&&(e==null||Zf(e.theme)&&Xn(e.lang)))return Sp}function Ep(e=Sp){return e!=null&&`then`in e}async function Dp(e){await Cp(e)}for(let e of lp.getThemes())lr.registerThemeIfAbsent(e.name,e.load);function Op(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function kp(e){return lr.hasResolvedThemes(e)}function Ap(e,t){return Op(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}var jp=new Map,Mp=0,Np={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function Y(e){if(jp.has(e))return jp.get(e)??`text`;if(Np[e]!=null)return Np[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(jp.has(t[1]))return jp.get(t[1])??`text`;if(Np[t[1]]!=null)return Np[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return jp.has(n)?jp.get(n)??`text`:Np[n]??`text`}function Pp(){return Mp}function Fp(){return Object.fromEntries(jp)}function Ip(e){return(e.lang??Y(e.name))===`text`}var Lp=10,Rp=13,zp=4,Bp=40;function Vp(e){let t=[0],n=e.indexOf(`\r`),r=e.indexOf(`
153
+ \v\f…\u2028\u2029])`),t));else if(c===`posix`){if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${G(e.codePointAt(0)-1)}${G(e.codePointAt(2)+1)}-\u{10FFFF}`),n(q(Bf(`[${e}]`),t))}else n(q(Vf(Bf(hf.get(u)),l),t))}else if(c===`property`)df.has(yd(u))||(e.key=`sc`);else if(c===`space`)n(Hf(dd(`space`,{negate:l}),t));else if(c===`word`)n(q(Vf(Bf(lf),l),t));else throw Error(`Unexpected character set kind "${c}"`)}},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`){if(!c.enable&&!c.disable)r();else{let e=id({flags:c});e.body[0].body=o(),i(q(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&Fu(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(K`Uses "\K" in a way that's unsupported`);let o=ad({behind:!0});o.body[0].body=a(),i(q(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(q(ad({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=id();t.body[0].body.push(e.body),e.body=q(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=Pf(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(K`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!zf(n)&&(n=Af(n,t),e.ref=n)}},Sf={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=Hf(Of(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&ef(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=ef(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=$d(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&(n.type!==`CapturingGroup`||n.name!==a&&n.number!==a););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?Of(0):Df(o,r.groupOriginByCopy,null),l=c;if(!s){let e=jf(kf(o,e=>e.type===`Group`&&!!e.flags)),t=e?$d(r.globalFlags,e):r.globalFlags;Tf(t,r.currentFlags)||(l=id({flags:Mf(t)}),l.body[0].body.push(c))}n(q(l,t),{traverse:!s})}},Cf={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>Ef(t,e));i.length?i.length>1?n(q(id({atomic:!0,body:i.reverse().map(e=>Ju({body:[Xu(e.number)]}))}),t)):e.ref=i[0].number:n(q(ad({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=Zu();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&e.ref!==0&&(e.ref=t.reffedNodesByReferencer.get(e).number)}};function wf(e){Sd(e,{"*"({node:e,parent:t}){e.parent=t}})}function Tf(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function Ef(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=Nf(n.parent);for(let r of t){if(r===n)break;if(r===e||Ff(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function Df(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=Df(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function Of(e){let t=ud(e);return t.isRecursive=!0,t}function kf(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function Af(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function jf(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function Mf({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function Nf(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function Pf(e){let t=e.find(e=>e.kind===`search_start`||Rf(e,{negate:!1})||!If(e));if(!t)return null;if(t.kind===`search_start`)return t;if(t.type===`LookaroundAssertion`)return t.body[0].body[0];if(t.type===`CapturingGroup`||t.type===`Group`){let e=[];for(let n of t.body){let t=Pf(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function Ff(e,t){let n=Nf(e)??[];for(let e of n)if(e===t||Ff(e,t))return!0;return!1}function If({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function Lf(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function Rf(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&Fu(e.body[0],{type:`Assertion`,kind:`search_start`})}function zf(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function Bf(e,t){let n=Ru(e,{...t,unicodePropertyMap:df}).body;return n.length>1||n[0].body.length>1?id({body:n}):n[0].body[0]}function Vf(e,t){return e.negate=t,e}function Hf(e,t){return e.parent=t,e}function q(e,t){return wf(e),e.parent=t,e}function Uf(e,t){let n=of(t),r=tf(n.target,`ES2024`),i=tf(n.target,`ES2025`),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error(`Invalid recursionLimit; use 2-20`);let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];Sd(e,Wf,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!(!e.flags.ignoreCase&&!o||s)},l=e,u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:r,verbose:n.verbose};function d(e){return u.lastNode=l,l=e,nf(Gf[e.type],`Unexpected node type "${e.type}"`)(e,u,d)}let f={pattern:e.body.map(d).join(`|`),flags:d(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&f._hiddenCaptures.push(t),e.transferTo&&ef(f._captureTransfers,e.transferTo,[]).push(t)}),f}var Wf={"*":{enter({node:e},t){if(rp(e)){let n=t.getCurrentModI();t.pushModI(e.flags?$d({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){rp(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){Zf(G(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),Qf(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&yf.has(e.value)&&t.setHasCasedChar()}},Gf={Alternative({body:e},t,n){return e.map(n).join(``)},Assertion({kind:e,negate:t}){if(e===`string_end`)return`$`;if(e===`string_start`)return`^`;if(e===`word_boundary`)return t?K`\B`:K`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!=`number`)throw Error(`Unexpected named backref in transformed AST`);if(!t.useFlagMods&&t.accuracy===`strict`&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error(`Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy`);return`\\`+e},CapturingGroup(e,t,n){let{body:r,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:``}${r.map(n).join(`|`)})`},Character({value:e},t){let n=G(e),r=$f(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Zf(n)){let e=uf(n);return t.inCharClass?e.join(``):e.length>1?`[${e.join(``)}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:a}=e,{body:o}=e;if(r===`intersection`&&!t.useFlagV)throw Error(`Use of character class intersection requires min target ES2024`);Zd.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(ap)&&(o=[Qu(45),...o.filter(e=>!ap(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||Zd.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=id(),i=r.body[0];return r.parent=a,i.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=Ju({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=s();return t.inCharClass=!1,r}let c=o[0];if(r===`union`&&!i&&c&&((!t.useFlagV||!t.verbose)&&a.kind===`union`&&!(Zd.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&a.kind===`intersection`&&o.length===1&&c.type!==`CharacterClassRange`))return o.map(n).join(``);if(!t.useFlagV&&a.type===`CharacterClass`)throw Error(`Uses nested character class in a way that requires min target ES2024`);return s()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=$f(n,i),o=$f(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&ep(Qf(e)).forEach(e=>{s.add(Array.isArray(e)?`${$f(e[0],i)}-${$f(e[1],i)}`:$f(e,i))}),`${a}-${o}${[...s].join(``)}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if(e===`dot`)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?`.`:`[^]`:K`[^\n]`;if(e===`digit`)return t?K`\D`:K`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&yf.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?K`\P`:K`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?K`\W`:K`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?`i`:``)+(e.dotAll?`s`:``)+(e.sticky?`y`:``)},Group({atomic:e,body:t,flags:n,parent:r},i,a){let o=i.currentFlags;n&&(i.currentFlags=$d(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${tp(e,n,i.useFlagMods)}${s})`;return i.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,i){return`(?${`${t===`lookahead`?``:`<`}${n?`!`:`=`}`}${e.map(i).join(`|`)})`},Quantifier(e,t,n){return n(e.body)+np(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error(`Unexpected non-recursive subroutine in transformed AST`);let r=n.recursionLimit;return t===0?`(?R=${r})`:K`\g<${t}&R=${r}>`}},Kf=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),qf=new Set([`-`,`\\`,`]`,`^`,`[`]),Jf=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),Yf=new Map([[9,K`\t`],[10,K`\n`],[11,K`\v`],[12,K`\f`],[13,K`\r`],[8232,K`\u2028`],[8233,K`\u2029`],[65279,K`\uFEFF`]]),Xf=/^\p{Cased}$/u;function Zf(e){return Xf.test(e)}function Qf(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,a=[];if(r<65&&(i===65535||i>=131071)||r===65536&&i>=131071)return a;for(let e=r;e<=i;e++){let t=G(e);if(!Zf(t))continue;let o=uf(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function $f(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(Yf.has(e))return Yf.get(e);if(e<32||e>126&&e<160||e>262143||t&&ip(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?Jf:qf:Kf,a=G(e);return(i.has(a)?`\\`:``)+a}function ep(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:r===null?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}function tp(e,t,n){if(e)return`>`;let r=``;if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?`i`:``)+(e?.dotAll?`s`:``)+(n?`-`:``)+(n?.ignoreCase?`i`:``)+(n?.dotAll?`s`:``)}return`${r}:`}function np({kind:e,max:t,min:n}){let r;return r=!n&&t===1?`?`:!n&&t===1/0?`*`:n===1&&t===1/0?`+`:n===t?`{${n}}`:`{${n},${t===1/0?``:t}}`,r+{greedy:``,lazy:`?`,possessive:`+`}[e]}function rp({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function ip(e){return e>47&&e<58}function ap({type:e,value:t}){return e===`Character`&&t===45}var op=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error(`Cannot provide options when copying a regexp`);let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=cp(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(sp(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#e.get(e)??{};if(a?i.push(null):(i.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&n[e]!==void 0){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(t[a]=n[e],this.hasIndices&&(t.indices[a]=r[e]),t.groups){this.#r||=lp(this.source);let i=this.#r.get(o);i&&(t.groups[i]=n[e],this.hasIndices&&(t.indices.groups[i]=r[e]))}}}return t}};function sp(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function cp(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)ef(n,t,{}).transferTo=e;return n}function lp(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,i=0,a;for(;a=t.exec(e);){let{0:e,groups:{capture:t,name:o}}=a;e===`[`?r++:r?e===`]`&&r--:t&&(i++,o&&n.set(i,o))}return n}function up(e,t){let n=dp(e,t);return n.options?new op(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function dp(e,t){let n=of(t),r=bf(Ru(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:df}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=Uf(r,n),a=Gd(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=Fd(Rd(a.pattern).pattern,{captureTransfers:a.captureTransfers,hiddenCaptures:a.hiddenCaptures}),s={pattern:o.pattern,flags:`${n.hasIndices?`d`:``}${n.global?`g`:``}${i.flags}${i.options.disable.v?`u`:`v`}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw Error(`Lazy compilation requires subclass`)}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=r._strategy,a=s.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||a)&&(s.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...a&&{lazyCompile:a}})}return s}function fp(e,t){return up(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function pp(e={}){let t={target:`auto`,cache:new Map,...e};return t.regexConstructor||=e=>fp(e,{target:t.target}),{createScanner(e){return new Gl(e,t)},createString(e){return{content:e}}}}async function mp(e){if(Ar())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=dr.get(e);if(t!=null)return t;try{let t=fr.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(Vr,e)&&(t=Vr[e]),t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let n=t().then(({default:t})=>{let n={name:e,data:t};return ur.has(e)||ur.set(e,n),n});return dr.set(e,n),await n}finally{dr.delete(e)}}function hp(e){return ur.get(e)??mp(e)}function gp(e){for(let t of hr(e))if(!gr.has(t))return!1;return!0}function _p({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:vp(t)}}function vp(e){return async()=>uo(Sr(await e()))}var yp=`pierre`,bp=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],xp=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],Sp=[...xp,...bp],Cp=new Set(xp);function wp(e){return Cp.has(e)?`light`:`dark`}var Tp={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},Ep={"pierre-dark":()=>k(()=>import(`./pierre-dark-CpLgRqie.js`),[]),"pierre-dark-soft":()=>k(()=>import(`./pierre-dark-soft-kZQmAZld.js`),[]),"pierre-dark-vibrant":()=>k(()=>import(`./pierre-dark-vibrant-CpQYzh95.js`),[]),"pierre-dark-protanopia-deuteranopia":()=>k(()=>import(`./pierre-dark-protanopia-deuteranopia-B35FxJx-.js`),[]),"pierre-dark-tritanopia":()=>k(()=>import(`./pierre-dark-tritanopia-CpjhbsIL.js`),[]),"pierre-light":()=>k(()=>import(`./pierre-light-CoaEpmwp.js`),[]),"pierre-light-soft":()=>k(()=>import(`./pierre-light-soft-lWLdNTOI.js`),[]),"pierre-light-vibrant":()=>k(()=>import(`./pierre-light-vibrant-D80Fkn33.js`),[]),"pierre-light-protanopia-deuteranopia":()=>k(()=>import(`./pierre-light-protanopia-deuteranopia-0fSaH845.js`),[]),"pierre-light-tritanopia":()=>k(()=>import(`./pierre-light-tritanopia-CEbqgOJL.js`),[])};function Dp(e){return _p({name:e,collection:yp,colorScheme:wp(e),displayName:Tp[e],load:Ep[e]})}var Op=_r({themes:Sp.map(e=>Dp(e))}),kp=`shiki`,Ap=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],jp=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),Mp=new Set(Ap);function Np(e){return Mp.has(e)?`light`:`dark`}var Pp={andromeeda:()=>k(()=>import(`./andromeeda-vGVdxbeo.js`),[]),"aurora-x":()=>k(()=>import(`./aurora-x-CDeNXAV0.js`),[]),"ayu-dark":()=>k(()=>import(`./ayu-dark-DluEY0Gj.js`),[]),"ayu-light":()=>k(()=>import(`./ayu-light-C3h-C4tm.js`),[]),"ayu-mirage":()=>k(()=>import(`./ayu-mirage-Bqwy1Gya.js`),[]),"catppuccin-frappe":()=>k(()=>import(`./catppuccin-frappe-C9Q5zVZY.js`),[]),"catppuccin-latte":()=>k(()=>import(`./catppuccin-latte-CtsyrtPq.js`),[]),"catppuccin-macchiato":()=>k(()=>import(`./catppuccin-macchiato-R8nAf1vR.js`),[]),"catppuccin-mocha":()=>k(()=>import(`./catppuccin-mocha-DjuaAJKi.js`),[]),"dark-plus":()=>k(()=>import(`./dark-plus-Cs2F2srj.js`),[]),dracula:()=>k(()=>import(`./dracula-BHWKrbxM.js`),[]),"dracula-soft":()=>k(()=>import(`./dracula-soft-5eyTD99u.js`),[]),"everforest-dark":()=>k(()=>import(`./everforest-dark-sB-x3p7T.js`),[]),"everforest-light":()=>k(()=>import(`./everforest-light-Df2xbC6M.js`),[]),"github-dark":()=>k(()=>import(`./github-dark-C-LZuMrd.js`),[]),"github-dark-default":()=>k(()=>import(`./github-dark-default-DXG-b-1a.js`),[]),"github-dark-dimmed":()=>k(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[]),"github-dark-high-contrast":()=>k(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[]),"github-light":()=>k(()=>import(`./github-light-EUqPIrTm.js`),[]),"github-light-default":()=>k(()=>import(`./github-light-default-BXViO-2h.js`),[]),"github-light-high-contrast":()=>k(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[]),"gruvbox-dark-hard":()=>k(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[]),"gruvbox-dark-medium":()=>k(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[]),"gruvbox-dark-soft":()=>k(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[]),"gruvbox-light-hard":()=>k(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[]),"gruvbox-light-medium":()=>k(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[]),"gruvbox-light-soft":()=>k(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[]),horizon:()=>k(()=>import(`./horizon-CE9ld1lL.js`),[]),"horizon-bright":()=>k(()=>import(`./horizon-bright-DSNQnXHK.js`),[]),houston:()=>k(()=>import(`./houston-CsvMBhTu.js`),[]),"kanagawa-dragon":()=>k(()=>import(`./kanagawa-dragon-Bozd7klA.js`),[]),"kanagawa-lotus":()=>k(()=>import(`./kanagawa-lotus-BmuOG9ZW.js`),[]),"kanagawa-wave":()=>k(()=>import(`./kanagawa-wave-BML5mF2J.js`),[]),laserwave:()=>k(()=>import(`./laserwave-C_8bwKvT.js`),[]),"light-plus":()=>k(()=>import(`./light-plus-DVQuIRkW.js`),[]),"material-theme":()=>k(()=>import(`./material-theme-Bm3Qr25_.js`),[]),"material-theme-darker":()=>k(()=>import(`./material-theme-darker-2IIEA8gg.js`),[]),"material-theme-lighter":()=>k(()=>import(`./material-theme-lighter-uhdI0v04.js`),[]),"material-theme-ocean":()=>k(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[]),"material-theme-palenight":()=>k(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[]),"min-dark":()=>k(()=>import(`./min-dark-BSWPekZh.js`),[]),"min-light":()=>k(()=>import(`./min-light-DDpmG2fV.js`),[]),monokai:()=>k(()=>import(`./monokai-B_bV9PQ9.js`),[]),"night-owl":()=>k(()=>import(`./night-owl-DhmEMT88.js`),[]),"night-owl-light":()=>k(()=>import(`./night-owl-light-eJ-hLW7d.js`),[]),nord:()=>k(()=>import(`./nord-Cb4Vim4T.js`),[]),"one-dark-pro":()=>k(()=>import(`./one-dark-pro-CLwyXe_n.js`),[]),"one-light":()=>k(()=>import(`./one-light-D7Lr4KcI.js`),[]),plastic:()=>k(()=>import(`./plastic-DQwYfKfQ.js`),[]),poimandres:()=>k(()=>import(`./poimandres-DRFjx7u4.js`),[]),red:()=>k(()=>import(`./red-DX1BQOs8.js`),[]),"rose-pine":()=>k(()=>import(`./rose-pine-aMsaMD1D.js`),[]),"rose-pine-dawn":()=>k(()=>import(`./rose-pine-dawn-8PwUyIlP.js`),[]),"rose-pine-moon":()=>k(()=>import(`./rose-pine-moon-DO-qXg-I.js`),[]),"slack-dark":()=>k(()=>import(`./slack-dark-DnToyrRv.js`),[]),"slack-ochin":()=>k(()=>import(`./slack-ochin-B2OO5cIa.js`),[]),"snazzy-light":()=>k(()=>import(`./snazzy-light-4G7pJPwS.js`),[]),"solarized-dark":()=>k(()=>import(`./solarized-dark-UdsmMDCL.js`),[]),"solarized-light":()=>k(()=>import(`./solarized-light-C1IUL_tW.js`),[]),"synthwave-84":()=>k(()=>import(`./synthwave-84-nFMaYfgc.js`),[]),"tokyo-night":()=>k(()=>import(`./tokyo-night-oM2G3aXe.js`),[]),vesper:()=>k(()=>import(`./vesper-DdrHHSXu.js`),[]),"vitesse-black":()=>k(()=>import(`./vitesse-black-fwtXNY1n.js`),[]),"vitesse-dark":()=>k(()=>import(`./vitesse-dark-BZCL-v6S.js`),[]),"vitesse-light":()=>k(()=>import(`./vitesse-light-VbXTXTou.js`),[])};function Fp(e){return _p({name:e,collection:kp,colorScheme:Np(e),load:Pp[e]})}var Ip=_r({themes:Object.freeze([...Ap.map(e=>Fp(e)),...jp.map(e=>Fp(e))])});function Lp(e){if(Ar())throw Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(Dr.hasRegisteredTheme(e))return;let t=Ip.getTheme(e);if(t!=null){Dr.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function Rp(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function zp(e){Lp(e);let t=await Dr.resolveTheme(e);return Rp(e,t),t}function Bp(e){return Dr.getResolvedTheme(e)??zp(e)}var Vp;async function Hp({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){Vp??=Il({themes:[],langs:[`text`],engine:n===`shiki-wasm`?hi(k(()=>import(`./wasm-BnjxR4X6.js`),[])):pp()});let r=Gp(Vp)?await Vp:Vp;Vp=r;let i=[];for(let e of Array.from(new Set(t))){if(e===`text`||e===`ansi`)continue;let t=hp(e);`then`in t?i.push(t):kr(t,r)}let a=[];for(let t of e){let e=Bp(t);`then`in e?a.push(e):Or(e,Vp)}return(i.length>0||a.length>0)&&await Promise.all([Promise.all(i).then(e=>{kr(e,r)}),Promise.all(a).then(e=>{Or(e,r)})]),r}function Up(e=Vp){return e!=null&&!(`then`in e)}function Wp(e){if(!(Vp==null||`then`in Vp)&&(e==null||gp(e.theme)&&mr(e.lang)))return Vp}function Gp(e=Vp){return e!=null&&`then`in e}async function Kp(e){await Hp(e)}for(let e of Op.getThemes())Dr.registerThemeIfAbsent(e.name,e.load);function qp(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function Jp(e){return Dr.hasResolvedThemes(e)}function Yp(e,t){return qp(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}var Xp=new Map,Zp=0,Qp={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function J(e){if(Xp.has(e))return Xp.get(e)??`text`;if(Qp[e]!=null)return Qp[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(Xp.has(t[1]))return Xp.get(t[1])??`text`;if(Qp[t[1]]!=null)return Qp[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return Xp.has(n)?Xp.get(n)??`text`:Qp[n]??`text`}function $p(){return Zp}function em(){return Object.fromEntries(Xp)}function tm(e){return(e.lang??J(e.name))===`text`}var nm=10,rm=13,im=4,am=40;function om(e){let t=[0],n=e.indexOf(`\r`),r=e.indexOf(`
154
154
  `),i=0,a=0;for(;n!==-1||r!==-1;){let o;if(n!==-1&&(r===-1||n<r)?r===n+1?(o=r+1,n=e.indexOf(`\r`,o),r=e.indexOf(`
155
155
  `,o)):(o=n+1,n=e.indexOf(`\r`,o)):(o=r+1,r=e.indexOf(`
156
- `,o)),t.push(o),++a===zp){if(o-i<=Bp){for(let n=o;n<e.length;n++){let r=e.charCodeAt(n);(r===Lp||r===Rp)&&(r===Rp&&n+1<e.length&&e.charCodeAt(n+1)===Lp&&n++,t.push(n+1))}return t}i=o,a=0}}return t}function Hp(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);(r===Lp||r===Rp)&&(r===Rp&&n+1<e.length&&e.charCodeAt(n+1)===Lp&&n++,t++)}return t}function Up(e){let t=Vp(e);return Array.from({length:t.length},(n,r)=>{let i=t[r],a=t[r+1]??e.length;return e.slice(i,a)})}function Wp(e,t){for(let n of t)e.push(n)}function Gp(e){return{type:`text`,value:e}}function X({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function Kp({name:e,width:t=16,height:n=16,properties:r}){return X({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[X({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function qp(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function Jp(e){return X({tagName:`div`,properties:{"data-gutter":``},children:e})}function Yp(e,t,n,r={}){return X({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[X({tagName:`span`,properties:{"data-line-number-content":``},children:[Gp(`${t}`)]})]})}function Xp(e,t,n){return X({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function Zp(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(Gp(`
157
- `)),e}var Qp=Symbol(`no-token`),$p=Symbol(`multiple-tokens`);function em(e){let t=tm(e);if(t!=null)return t;let n=Qp,r=[],i=[],a,o=()=>{if(i.length===0||a==null){i=[],a=void 0;return}if(i.length===1){let e=i[0];if(e?.type===`element`){rm(e,a);for(let t of e.children)nm(t)}else nm(e);r.push(e),i=[],a=void 0;return}for(let e of i)nm(e);r.push(X({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==Qp){if(e===$p){n=$p;return}if(n===Qp){n=e;return}n!==e&&(n=$p)}};for(let t of e.children){let e=t.type===`element`?em(t):Qp;if(s(e),typeof e!=`number`){o(),r.push(t);continue}a!=null&&a!==e&&o(),a??=e,i.push(t)}return o(),e.children=r,n}function tm(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function nm(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)nm(t)}}function rm(e,t){e.properties[`data-char`]=t}function im(e={}){let{classPrefix:t=`__shiki_`,classSuffix:n=``,classReplacer:r=e=>e}=e,i=new Map;function a(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function o(e){let o=typeof e==`string`?e:a(e),s=t+am(o)+n;return s=r(s),i.has(s)||i.set(s,typeof e==`string`?e:{...e}),s}return{name:`@shikijs/transformers:style-to-class`,pre(e){if(!e.properties.style)return;let t=o(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=o(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry(){return i},getCSS(){let e=``;for(let[t,n]of i.entries())e+=`.${t}{${typeof n==`string`?n:a(n)}}`;return e},clearRegistry(){i.clear()}}}function am(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0,i;t<e.length;t++)i=e.charCodeAt(t),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}function om(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=qp(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&em(a),i.push(Zp(a,t,n)),t++);r.children=i}return t},...e?{tokens(e){for(let t of e){let e=0;for(let n of t){let t=n;t.__lineChar??=e,e+=n.content.length}}},preprocess(e,t){t.mergeWhitespaces=`never`},span(e,t,n,r,i){if(i?.offset!=null&&i.content!=null){let t=i.__lineChar;return t!=null&&(e.properties[`data-char`]=t),e}return e}}:null}];return t&&r.push(cm,sm),e&&r.push({line:e=>(e.type===`element`&&e.children.length===0&&e.children.push({type:`element`,tagName:`br`,properties:{},children:[]}),e)}),{state:n,transformers:r,toClass:sm}}var sm=im({classPrefix:`hl-`}),cm={name:`token-style-normalizer`,tokens(e){for(let t of e)for(let e of t){if(e.htmlStyle!=null)continue;let t={};e.color!=null&&(t.color=e.color),e.bgColor!=null&&(t[`background-color`]=e.bgColor),e.fontStyle!=null&&e.fontStyle!==0&&(e.fontStyle&1&&(t[`font-style`]=`italic`),e.fontStyle&2&&(t[`font-weight`]=`bold`),e.fontStyle&4&&(t[`text-decoration`]=`underline`)),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function Z(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}function lm({theme:e=Dn,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=en(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${Z(`global`)}fg:${a.fg};`,r+=`${Z(`global`)}bg:${a.bg};`,r+=um(i,n)}else{let n=t.getTheme(e.dark),i=en(n);r+=`${Z(`global`)}dark:${i.fg};`,r+=`${Z(`global`)}dark-bg:${i.bg};`,r+=um(n,`dark`),n=t.getTheme(e.light),i=en(n),r+=`${Z(`global`)}light:${i.fg};`,r+=`${Z(`global`)}light-bg:${i.bg};`,r+=um(n,`light`)}return r}function um(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${Z(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${Z(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${Z(`global`)}${t}modified-color:${a};`),n}function dm(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}var fm={forcePlainText:!1};function pm(e,t,{theme:n,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:a,startingLine:o,totalLines:s,lines:c}=fm){a?(o??=0,s??=1/0):(o=0,s=1/0);let l=o>0||s<1/0,{state:u,transformers:d}=om(i),f=a?`text`:e.lang??Y(e.name),p=typeof n==`string`?t.getTheme(n).type:void 0,m=lm({theme:n,highlighter:t});u.lineInfo=e=>({type:`context`,lineIndex:e-1+o,lineNumber:e+o});let h=typeof n==`string`?{lang:f,theme:n,transformers:d,defaultColor:!1,cssVariablePrefix:Z(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:f,themes:n,transformers:d,defaultColor:!1,cssVariablePrefix:Z(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},g=dm(t.codeToHast(mm(l?hm(c??Up(e.contents),o,s):e.contents),h)),_=l?Array(o):g;return l&&Wp(_,g),{code:_,themeStyles:m,baseThemeType:p}}function mm(e){return e.replace(/\r(?!\n)/g,`
158
- `)}function hm(e,t,n){if(e.length===0)return``;let r=Math.min(t+n,e.length);return e.slice(t,r).join(``)}function gm(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function _m(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function vm(e,t){return Op(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function ym(e){let t=e.lang??Y(e.name),n=e.lang??(e.prevName==null?`text`:Y(e.prevName));return t===`text`&&n===`text`}function bm(e){return{...Fn,...e}}function xm(e,t){let n=Sm(e,t);return t?n:e.diffHeaderHeight+n}function Sm(e,t){return e.paddingTop??(t?e.spacing:0)}function Cm(e){return e.paddingBottom??e.spacing}function wm(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}function Tm(e){return[Un(e.additionStart,e.additionCount)+1,Wn(e.additionStart,e.additionCount)+1]}function Em({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function Dm(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-Wn(t.additionStart,t.additionCount),r=e.deletionLines.length-Wn(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function Om({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-Wn(n.additionStart,n.additionCount),i=e.deletionLines.length-Wn(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function km({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=Om({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function Am({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=Tm(a);if(t<o){let s=Em({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=km({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=Tm(a);return t<o+i.fromStart||t>=o+i.rangeSize}function jm({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=Tm(n),l=Em({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=km({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t);return}for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function Mm({type:e,metrics:t}){return t.hunkSeparatorHeight??wm(e)}function Nm({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function Pm({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function Fm(e){return e!==`simple`&&e!==`metadata`}function Im({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!Pm({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=Mm({type:e,metrics:t}),a=Nm({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function Lm({type:e,metrics:t}){if(!Fm(e))return;let n=Mm({type:e,metrics:t}),r=Nm({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function Rm({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=zm({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=Un(r.deletionStart,r.deletionCount),s=Un(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=Em({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?km({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if(Hm(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,Hm(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if(Hm(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=Um(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(Wm({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if(Hm(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function zm({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=Bm({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function Bm({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=Em({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?km({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function Vm(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function Hm(e,t,n,r,i,a){let[o,s]=Vm(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function Um(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function Wm({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}function Gm(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var Km=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},qm=new class extends Km{};function Jm(e,t,n){return qm.diff(e,t,n)}function Ym(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function Xm(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function Zm(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function Qm(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function $m(e,t){return Zm(e,t,``)}function eh(e,t){return Qm(e,t,``)}function th(e,t){return t.slice(0,nh(e,t))}function nh(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function rh(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function ih(e,t){if(t)return oh(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function ah(e,t){if(t)return oh(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function oh(e,t){if(!t)return[ah(e),ih(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=rh(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var sh=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,ch=RegExp(`[${sh}]+|\\s+|[^${sh}]`,`ug`);new class extends Km{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=rh(e,r)}else n=e.match(ch)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&lh(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&lh(n,i,r,null,t.intlSegmenter),e}};function lh(e,t,n,r,i){if(t&&n){let[a,o]=oh(t.value,i),[s,c]=oh(n.value,i);if(e){let r=Ym(a,s);e.value=Qm(e.value,s,r),t.value=$m(t.value,r),n.value=$m(n.value,r)}if(r){let e=Xm(o,c);r.value=Zm(r.value,c,e),t.value=eh(t.value,e),n.value=eh(n.value,e)}}else if(n){if(e){let e=ah(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=ah(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=ah(r.value,i),[a,o]=oh(t.value,i),s=Ym(n,a);t.value=$m(t.value,s);let c=Xm($m(n,s),o);t.value=eh(t.value,c),r.value=Zm(r.value,n,c),e.value=Qm(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=ah(r.value,i),n=th(ih(t.value,i),e);t.value=eh(t.value,n)}else if(e){let n=th(ih(e.value,i),ah(t.value,i));t.value=$m(t.value,n)}}var uh=new class extends Km{tokenize(e){let t=RegExp(`(\\r?\\n)|[${sh}]+|[^\\S\\n\\r]+|[^${sh}]`,`ug`);return e.match(t)||[]}};function dh(e,t,n){return uh.diff(e,t,n)}var fh=new class extends Km{constructor(){super(...arguments),this.tokenize=mh}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
156
+ `,o)),t.push(o),++a===im){if(o-i<=am){for(let n=o;n<e.length;n++){let r=e.charCodeAt(n);(r===nm||r===rm)&&(r===rm&&n+1<e.length&&e.charCodeAt(n+1)===nm&&n++,t.push(n+1))}return t}i=o,a=0}}return t}function sm(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);(r===nm||r===rm)&&(r===rm&&n+1<e.length&&e.charCodeAt(n+1)===nm&&n++,t++)}return t}function cm(e){let t=om(e);return Array.from({length:t.length},(n,r)=>{let i=t[r],a=t[r+1]??e.length;return e.slice(i,a)})}function lm(e,t){for(let n of t)e.push(n)}function um(e){return{type:`text`,value:e}}function Y({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function dm({name:e,width:t=16,height:n=16,properties:r}){return Y({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[Y({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function fm(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function pm(e){return Y({tagName:`div`,properties:{"data-gutter":``},children:e})}function mm(e,t,n,r={}){return Y({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[Y({tagName:`span`,properties:{"data-line-number-content":``},children:[um(`${t}`)]})]})}function hm(e,t,n){return Y({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function gm(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(um(`
157
+ `)),e}var _m=Symbol(`no-token`),vm=Symbol(`multiple-tokens`);function ym(e){let t=bm(e);if(t!=null)return t;let n=_m,r=[],i=[],a,o=()=>{if(i.length===0||a==null){i=[],a=void 0;return}if(i.length===1){let e=i[0];if(e?.type===`element`){Sm(e,a);for(let t of e.children)xm(t)}else xm(e);r.push(e),i=[],a=void 0;return}for(let e of i)xm(e);r.push(Y({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==_m){if(e===vm){n=vm;return}if(n===_m){n=e;return}n!==e&&(n=vm)}};for(let t of e.children){let e=t.type===`element`?ym(t):_m;if(s(e),typeof e!=`number`){o(),r.push(t);continue}a!=null&&a!==e&&o(),a??=e,i.push(t)}return o(),e.children=r,n}function bm(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function xm(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)xm(t)}}function Sm(e,t){e.properties[`data-char`]=t}function Cm(e={}){let{classPrefix:t=`__shiki_`,classSuffix:n=``,classReplacer:r=e=>e}=e,i=new Map;function a(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function o(e){let o=typeof e==`string`?e:a(e),s=t+wm(o)+n;return s=r(s),i.has(s)||i.set(s,typeof e==`string`?e:{...e}),s}return{name:`@shikijs/transformers:style-to-class`,pre(e){if(!e.properties.style)return;let t=o(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=o(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry(){return i},getCSS(){let e=``;for(let[t,n]of i.entries())e+=`.${t}{${typeof n==`string`?n:a(n)}}`;return e},clearRegistry(){i.clear()}}}function wm(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0,i;t<e.length;t++)i=e.charCodeAt(t),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}function Tm(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=fm(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&ym(a),i.push(gm(a,t,n)),t++);r.children=i}return t},...e?{tokens(e){for(let t of e){let e=0;for(let n of t){let t=n;t.__lineChar??=e,e+=n.content.length}}},preprocess(e,t){t.mergeWhitespaces=`never`},span(e,t,n,r,i){if(i?.offset!=null&&i.content!=null){let t=i.__lineChar;return t!=null&&(e.properties[`data-char`]=t),e}return e}}:null}];return t&&r.push(Dm,Em),e&&r.push({line:e=>(e.type===`element`&&e.children.length===0&&e.children.push({type:`element`,tagName:`br`,properties:{},children:[]}),e)}),{state:n,transformers:r,toClass:Em}}var Em=Cm({classPrefix:`hl-`}),Dm={name:`token-style-normalizer`,tokens(e){for(let t of e)for(let e of t){if(e.htmlStyle!=null)continue;let t={};e.color!=null&&(t.color=e.color),e.bgColor!=null&&(t[`background-color`]=e.bgColor),e.fontStyle!=null&&e.fontStyle!==0&&(e.fontStyle&1&&(t[`font-style`]=`italic`),e.fontStyle&2&&(t[`font-weight`]=`bold`),e.fontStyle&4&&(t[`text-decoration`]=`underline`)),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function X(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}function Om({theme:e=Gn,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=yn(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${X(`global`)}fg:${a.fg};`,r+=`${X(`global`)}bg:${a.bg};`,r+=km(i,n)}else{let n=t.getTheme(e.dark),i=yn(n);r+=`${X(`global`)}dark:${i.fg};`,r+=`${X(`global`)}dark-bg:${i.bg};`,r+=km(n,`dark`),n=t.getTheme(e.light),i=yn(n),r+=`${X(`global`)}light:${i.fg};`,r+=`${X(`global`)}light-bg:${i.bg};`,r+=km(n,`light`)}return r}function km(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${X(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${X(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${X(`global`)}${t}modified-color:${a};`),n}function Am(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}var jm={forcePlainText:!1};function Mm(e,t,{theme:n,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:a,startingLine:o,totalLines:s,lines:c}=jm){a?(o??=0,s??=1/0):(o=0,s=1/0);let l=o>0||s<1/0,{state:u,transformers:d}=Tm(i),f=a?`text`:e.lang??J(e.name),p=typeof n==`string`?t.getTheme(n).type:void 0,m=Om({theme:n,highlighter:t});u.lineInfo=e=>({type:`context`,lineIndex:e-1+o,lineNumber:e+o});let h=typeof n==`string`?{lang:f,theme:n,transformers:d,defaultColor:!1,cssVariablePrefix:X(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:f,themes:n,transformers:d,defaultColor:!1,cssVariablePrefix:X(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},g=Am(t.codeToHast(Nm(l?Pm(c??cm(e.contents),o,s):e.contents),h)),_=l?Array(o):g;return l&&lm(_,g),{code:_,themeStyles:m,baseThemeType:p}}function Nm(e){return e.replace(/\r(?!\n)/g,`
158
+ `)}function Pm(e,t,n){if(e.length===0)return``;let r=Math.min(t+n,e.length);return e.slice(t,r).join(``)}function Fm(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function Im(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Lm(e,t){return qp(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Rm(e){let t=e.lang??J(e.name),n=e.lang??(e.prevName==null?`text`:J(e.prevName));return t===`text`&&n===`text`}function zm(e){return{...$n,...e}}function Bm(e,t){let n=Vm(e,t);return t?n:e.diffHeaderHeight+n}function Vm(e,t){return e.paddingTop??(t?e.spacing:0)}function Hm(e){return e.paddingBottom??e.spacing}function Um(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}function Wm(e){return[sr(e.additionStart,e.additionCount)+1,cr(e.additionStart,e.additionCount)+1]}function Gm({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function Km(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-cr(t.additionStart,t.additionCount),r=e.deletionLines.length-cr(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function qm({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-cr(n.additionStart,n.additionCount),i=e.deletionLines.length-cr(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function Jm({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=qm({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function Ym({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=Wm(a);if(t<o){let s=Gm({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=Jm({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=Wm(a);return t<o+i.fromStart||t>=o+i.rangeSize}function Xm({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=Wm(n),l=Gm({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=Jm({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t);return}for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function Zm({type:e,metrics:t}){return t.hunkSeparatorHeight??Um(e)}function Qm({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function $m({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function eh(e){return e!==`simple`&&e!==`metadata`}function th({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!$m({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=Zm({type:e,metrics:t}),a=Qm({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function nh({type:e,metrics:t}){if(!eh(e))return;let n=Zm({type:e,metrics:t}),r=Qm({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function rh({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=ih({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=sr(r.deletionStart,r.deletionCount),s=sr(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=Gm({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?Jm({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if(sh(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,sh(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if(sh(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=ch(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(lh({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if(sh(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function ih({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=ah({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function ah({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=Gm({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?Jm({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function oh(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function sh(e,t,n,r,i,a){let[o,s]=oh(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function ch(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function lh({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}function uh(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var dh=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},fh=new class extends dh{};function ph(e,t,n){return fh.diff(e,t,n)}function mh(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function hh(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function gh(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function _h(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function vh(e,t){return gh(e,t,``)}function yh(e,t){return _h(e,t,``)}function bh(e,t){return t.slice(0,xh(e,t))}function xh(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function Sh(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function Ch(e,t){if(t)return Th(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function wh(e,t){if(t)return Th(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Th(e,t){if(!t)return[wh(e),Ch(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Sh(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var Eh=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Dh=RegExp(`[${Eh}]+|\\s+|[^${Eh}]`,`ug`);new class extends dh{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=Sh(e,r)}else n=e.match(Dh)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&Oh(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Oh(n,i,r,null,t.intlSegmenter),e}};function Oh(e,t,n,r,i){if(t&&n){let[a,o]=Th(t.value,i),[s,c]=Th(n.value,i);if(e){let r=mh(a,s);e.value=_h(e.value,s,r),t.value=vh(t.value,r),n.value=vh(n.value,r)}if(r){let e=hh(o,c);r.value=gh(r.value,c,e),t.value=yh(t.value,e),n.value=yh(n.value,e)}}else if(n){if(e){let e=wh(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=wh(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=wh(r.value,i),[a,o]=Th(t.value,i),s=mh(n,a);t.value=vh(t.value,s);let c=hh(vh(n,s),o);t.value=yh(t.value,c),r.value=gh(r.value,n,c),e.value=_h(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=wh(r.value,i),n=bh(Ch(t.value,i),e);t.value=yh(t.value,n)}else if(e){let n=bh(Ch(e.value,i),wh(t.value,i));t.value=vh(t.value,n)}}var kh=new class extends dh{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Eh}]+|[^\\S\\n\\r]+|[^${Eh}]`,`ug`);return e.match(t)||[]}};function Ah(e,t,n){return kh.diff(e,t,n)}var jh=new class extends dh{constructor(){super(...arguments),this.tokenize=Nh}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
159
159
  `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
160
160
  `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
161
161
  `)&&(e=e.slice(0,-1)),t.endsWith(`
162
- `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function ph(e,t,n){return fh.diff(e,t,n)}function mh(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
163
- `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function hh(e){return e==`.`||e==`!`||e==`?`}new class extends Km{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(hh(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends Km{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends Km{constructor(){super(...arguments),this.tokenize=mh}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(gh(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function gh(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=gh(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=gh(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends Km{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function _h(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function vh(e){if(!_h(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r<n.length;){let e=n[r];t+=e===7?`\\a`:e===8?`\\b`:e===9?`\\t`:e===10?`\\n`:e===11?`\\v`:e===12?`\\f`:e===13?`\\r`:e===34?`\\"`:e===92?`\\\\`:e>=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var yh={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function bh(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;ph(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(ph(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||Ch(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
164
- `)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function xh(e,t){if(t||=yh,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>xh(e,t)).join(`
165
- `)}let n=[];if(e.isGit){if(t=yh,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+vh(r)+` `+vh(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+vh((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+vh((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+vh((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+vh((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+vh(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+vh(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t],i=r.oldLines===0?r.oldStart-1:r.oldStart,a=r.newLines===0?r.newStart-1:r.newStart;n.push(`@@ -`+i+`,`+r.oldLines+` +`+a+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
162
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function Mh(e,t,n){return jh.diff(e,t,n)}function Nh(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
163
+ `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function Ph(e){return e==`.`||e==`!`||e==`?`}new class extends dh{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(Ph(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends dh{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends dh{constructor(){super(...arguments),this.tokenize=Nh}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(Fh(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function Fh(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=Fh(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=Fh(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends dh{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function Ih(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function Lh(e){if(!Ih(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r<n.length;){let e=n[r];t+=e===7?`\\a`:e===8?`\\b`:e===9?`\\t`:e===10?`\\n`:e===11?`\\v`:e===12?`\\f`:e===13?`\\r`:e===34?`\\"`:e===92?`\\\\`:e>=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var Rh={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function zh(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;Mh(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(Mh(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||Hh(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
164
+ `)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function Bh(e,t){if(t||=Rh,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>Bh(e,t)).join(`
165
+ `)}let n=[];if(e.isGit){if(t=Rh,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+Lh(r)+` `+Lh(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+Lh((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+Lh((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+Lh((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+Lh((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+Lh(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+Lh(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t],i=r.oldLines===0?r.oldStart-1:r.oldStart,a=r.newLines===0?r.newStart-1:r.newStart;n.push(`@@ -`+i+`,`+r.oldLines+` +`+a+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
166
166
  `)+`
167
- `}function Sh(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;bh(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?xh(e,o.headerOptions):void 0)}}))}else{let s=bh(e,t,n,r,i,a,o);return s?xh(s,o?.headerOptions):void 0}}function Ch(e){let t=e.endsWith(`
167
+ `}function Vh(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;zh(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Bh(e,o.headerOptions):void 0)}}))}else{let s=zh(e,t,n,r,i,a,o);return s?Bh(s,o?.headerOptions):void 0}}function Hh(e){let t=e.endsWith(`
168
168
  `),n=e.split(`
169
169
  `).map(e=>e+`
170
- `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function wh({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":``},alwaysWrap:!0}}function Th({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;if(r===o||r&&e.value.length===1&&!o){a[1]+=e.value;return}t.push([+!r,e.value])}var Eh={forcePlainText:!1};function Dh(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=Eh){r?(i??=0,a??=1/0):(i=0,a=1/0);let c=i>0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=lm({theme:n.theme,highlighter:t}),d=r&&!c&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,m=!r&&!e.isPartial,h=r?o:void 0,g=new Map;function _(e){let t=m?0:e,n=g.get(t)??kh();return g.set(t,n),n}function v(e,t,n,r){if(c){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}Rm({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:!c||h,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&Oh({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:d,maxLineDiffLength:p}),r!=null&&(v(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(v(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let i of g.values()){if(i.deletionContent.length===0&&i.additionContent.length===0)continue;let a={name:e.prevName??e.name,contents:i.deletionContent.value},o={name:e.name,contents:i.additionContent.value},{deletionLines:s,additionLines:c}=Ah({deletionFile:a,deletionInfo:i.deletionInfo,deletionDecorations:i.deletionDecorations,additionFile:o,additionInfo:i.additionInfo,additionDecorations:i.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang});if(m){f.deletionLines=s,f.additionLines=c;continue}if(i.deletionSegments.length>0)for(let e of i.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else Wp(f.deletionLines,s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else Wp(f.additionLines,c)}return{code:f,themeStyles:u,baseThemeType:l}}function Oh({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=Gm(e),t=Gm(t),e.length>s||t.length>s))return;let c=o===`char`?Jm(e,t):dh(e,t),l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?(Th({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),Th({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?Th({item:e,arr:l,enableJoin:d,isLastItem:t}):Th({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(wh({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(wh({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function kh(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Ah({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c,...l}}){let u=s??Y(e.name),d=s??Y(t.name),{state:f,transformers:p}=om(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Z(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Z(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,dm(i.codeToHast(Gm(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,dm(i.codeToHast(Gm(t.contents),m)))}}function jh(e){let t=[];for(let n of e){let e=Kn.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function Mh(e){for(let t of Array.isArray(e)?e:[e])if(!Kn.has(t))return!1;return!0}async function Nh(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=Xf(r)??Yf(r);`then`in e?n.push(e):t.push(e)}return n.length>0&&await Promise.all(n).then(e=>{for(let n of e){if(n==null)throw Error(`resolvedLanguages: unable to resolve language`);t.push(n)}}),t}function Ph(e){return lr.getResolvedThemes(e)}async function Fh(e){for(let t of e)vp(t);let t=await lr.resolveThemes(e);for(let n=0;n<e.length;n++)yp(e[n],t[n]);return t}var Ih=n(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):r((n||=self).lru_map=n.lru_map||{})})(e,function(e){let t=Symbol(`newer`),n=Symbol(`older`);class r{constructor(e,t){typeof e!=`number`&&(t=e,e=0),this.size=0,this.limit=e,this.oldest=this.newest=void 0,this._keymap=new Map,t&&(this.assign(t),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[t]&&(e===this.oldest&&(this.oldest=e[t]),e[t][n]=e[n]),e[n]&&(e[n][t]=e[t]),e[t]=void 0,e[n]=this.newest,this.newest&&(this.newest[t]=e),this.newest=e)}assign(e){let r,a=this.limit||Number.MAX_VALUE;this._keymap.clear();let o=e[Symbol.iterator]();for(let e=o.next();!e.done;e=o.next()){let o=new i(e.value[0],e.value[1]);if(this._keymap.set(o.key,o),r?(r[t]=o,o[n]=r):this.oldest=o,r=o,a--==0)throw Error(`overflow`)}this.newest=r,this.size=this._keymap.size}get(e){var t=this._keymap.get(e);return t?(this._markEntryAsUsed(t),t.value):void 0}set(e,r){var a=this._keymap.get(e);return a?(a.value=r,this._markEntryAsUsed(a),this):(this._keymap.set(e,a=new i(e,r)),this.newest?(this.newest[t]=a,a[n]=this.newest):this.oldest=a,this.newest=a,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var e=this.oldest;if(e)return this.oldest[t]?(this.oldest=this.oldest[t],this.oldest[n]=void 0):(this.oldest=void 0,this.newest=void 0),e[t]=e[n]=void 0,this._keymap.delete(e.key),--this.size,[e.key,e.value]}find(e){let t=this._keymap.get(e);return t?t.value:void 0}has(e){return this._keymap.has(e)}delete(e){var r=this._keymap.get(e);return r?(this._keymap.delete(r.key),r[t]&&r[n]?(r[n][t]=r[t],r[t][n]=r[n]):r[t]?(r[t][n]=void 0,this.oldest=r[t]):r[n]?(r[n][t]=void 0,this.newest=r[n]):this.oldest=this.newest=void 0,this.size--,r.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new o(this.oldest)}values(){return new s(this.oldest)}entries(){return this}[Symbol.iterator](){return new a(this.oldest)}forEach(e,n){typeof n!=`object`&&(n=this);let r=this.oldest;for(;r;)e.call(n,r.value,r.key,this),r=r[t]}toJSON(){for(var e=Array(this.size),n=0,r=this.oldest;r;)e[n++]={key:r.key,value:r.value},r=r[t];return e}toString(){for(var e=``,n=this.oldest;n;)e+=String(n.key)+`:`+n.value,n=n[t],n&&(e+=` < `);return e}}e.LRUMap=r;function i(e,r){this.key=e,this.value=r,this[t]=void 0,this[n]=void 0}function a(e){this.entry=e}a.prototype[Symbol.iterator]=function(){return this},a.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}};function o(e){this.entry=e}o.prototype[Symbol.iterator]=function(){return this},o.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.key}):{done:!0,value:void 0}};function s(e){this.entry=e}s.prototype[Symbol.iterator]=function(){return this},s.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.value}):{done:!0,value:void 0}}})})),Lh=t(Ih(),1),Rh=Symbol(`IGNORE_RESPONSE`),zh=1e4,Bh=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled because the pool terminated`)}},Vh=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled before the task completed`)}},Hh=class{options;highlighter;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:n=Dn,useTokenTransformer:r=!1,lineDiffType:i=`word-alt`,maxLineDiffLength:a=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:s=`shiki-js`}){this.options=e,this.preferredHighlighter=s,this.renderOptions={theme:n,useTokenTransformer:r,lineDiffType:i,maxLineDiffLength:a,tokenizeMaxLineLength:o},this.fileCache=new Lh.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new Lh.default.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed}getFileResultCache(e){return e.cacheKey==null?void 0:this.fileCache.get(e.cacheKey)}getDiffResultCache(e){return e.cacheKey==null?void 0:this.diffCache.get(e.cacheKey)}inspectCaches(){let{fileCache:e,diffCache:t}=this;return{fileCache:e,diffCache:t}}evictFileFromCache(e){try{return this.fileCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(e){try{return this.diffCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:e=this.renderOptions.theme??Dn,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:n=this.renderOptions.lineDiffType??`word-alt`,maxLineDiffLength:r=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:i=this.renderOptions.tokenizeMaxLineLength??1e3}){let{lifecycleGeneration:a}=this,o=++this.renderOptionsRequestVersion,s=()=>this.isCurrentLifecycle(a)&&this.renderOptionsRequestVersion===o;try{let a={theme:e,useTokenTransformer:t,lineDiffType:n,maxLineDiffLength:r,tokenizeMaxLineLength:i};if(this.isInitialized()||await this.initialize(),!s()||vm(a,this.renderOptions))return;let o=Zn(e),c=[];if(Op(a.theme,this.renderOptions.theme)||(c=kp(o)?Ph(o):await Fh(o)),!s())return;if(this.highlighter!=null)ur(c,this.highlighter);else{let e=await Cp({themes:o,langs:[`text`],preferredHighlighter:this.preferredHighlighter});if(!s())return;this.highlighter=e}let l=this.setRenderOptionsOnWorkers(a,c);this.renderOptions=a,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(let e of this.themeSubscribers)e.onThemeChange();await l}catch(e){if(e instanceof Bh||!s())return;throw e}}getPreferredHighlighter(){return this.preferredHighlighter}getFileRenderOptions(){let{tokenizeMaxLineLength:e,theme:t,useTokenTransformer:n}=this.renderOptions;return{theme:t,useTokenTransformer:n,tokenizeMaxLineLength:e}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(e,t){if(this.workersFailed)return;this.isInitialized()||await this.initialize();let n=[];for(let r of this.workers){if(!r.initialized)throw console.log({managedWorker:r}),Error(`setRenderOptionsOnWorkers: Somehow we have an uninitialized worker`);n.push(new Promise((n,i)=>{let a=this.generateRequestId(),o={type:`set-render-options`,id:a,request:{type:`set-render-options`,id:a,renderOptions:e,resolvedThemes:t},resolve:n,reject:i,requestStart:Date.now()};this.activeTaskById.set(a,o),r.pendingSetupRequestId=a,r.worker.postMessage(o.request)}))}await Promise.all(n)}subscribeToThemeChanges(e){return this.themeSubscribers.add(e),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(e),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(e){this.themeSubscribers.delete(e),this.queueBroadcastStateChanges()}subscribeToStatChanges(e){return this.statSubscribers.add(e),e(this.getStats()),()=>{this.statSubscribers.delete(e)}}queueBroadcastStateChanges(){this._queuedBroadcast??=requestAnimationFrame(this._broadcastStateChanges)}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);let e=this.getStats();for(let t of this.statSubscribers)t(e)};cleanUpTasks(e){this.detachInstanceFromQueuedTasks(e);let t=this.activeRequestByInstance.get(e);if(t!=null){let n=this.activeTaskById.get(t);Gh(n)?(this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeActiveTask(n)):this.activeTaskById.delete(t)}this.activeRequestByInstance.delete(e),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(e=[]){if(this.initialized!==!0){if(this.initialized===!1){let{lifecycleGeneration:t}=this;this.initialized=new Promise((n,r)=>{(async()=>{try{let r=Zn(this.renderOptions.theme),i=[];if(i=kp(r)?Ph(r):await Fh(r),!this.isCurrentLifecycle(t)){n();return}let a=[];if(a=Mh(e)?jh(e):await Nh(e),!this.isCurrentLifecycle(t)){n();return}let[o]=await Promise.all([Cp({themes:r,langs:[`text`,...e],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(i,a)]);if(!this.isCurrentLifecycle(t)){this.terminateWorkers(),n();return}this.highlighter=o,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),n()}catch(e){if(e instanceof Bh||!this.isCurrentLifecycle(t)){n();return}this.initialized=!1,this.workersFailed=!0,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.activeTaskById.clear();for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,qh(e));this.queueBroadcastStateChanges(),r(e)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}}async initializeWorkers(e,t){this.workersFailed=!1;let n=[],r=Pp(),i=r>0?Fp():void 0;this.workers.length>0&&this.terminateWorkers();for(let a=0;a<(this.options.poolSize??8);a++){let a=this.options.workerFactory(),o={worker:a,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set([`text`,...t.map(({name:e})=>e)]),customExtensionsVersion:0};a.addEventListener(`message`,e=>{this.handleWorkerMessage(o,e.data)}),a.addEventListener(`error`,e=>this.handleWorkerError(o,e)),this.workers.push(o),n.push(new Promise((n,a)=>{let s=this.generateRequestId(),c={type:`initialize`,id:s,request:{type:`initialize`,id:s,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:e,resolvedLanguages:t,customExtensionsVersion:i==null?void 0:r,customExtensionMap:i},resolve(){o.initialized=!0,n()},reject:a,requestStart:Date.now()};o.pendingSetupRequestId=s,this.activeTaskById.set(s,c),this.executeTask(o,c)}))}let a=this.options.workerInitializationTimeout??zh,o;try{await Promise.race([Promise.all(n),new Promise((e,t)=>{o=setTimeout(()=>{t(Error(`WorkerPoolManager: worker initialization timed out after ${a}ms`))},a)})])}finally{o!=null&&clearTimeout(o)}}handleWorkerError(e,t){console.error(`Worker error:`,t,e);let{pendingSetupRequestId:n}=e;if(n==null)return;let r=this.activeTaskById.get(n);r?.type===`initialize`&&(r.reject(qh(t)),this.cleanWorkerAndTask(e,r))}drainQueue=()=>{if(this._queuedDrain=void 0,this.initialized===!0&&this.queuedTasks.length!==0){for(let e=0;e<this.queuedTasks.length;){let t=this.queuedTasks[e];if(this.hasActiveRequest(t)){e++;continue}let n=Wh(t),r=this.getAvailableWorker(n);if(r==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,r),this.resolveLanguagesAndExecuteTask(r,t,n)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){let n=this.getFileResultCache(t);Ip(t)||n!=null&&Ap(n.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:`file`,file:t})}primeFileHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeFileHighlightCache: worker pool is not working`));let t=this.getOrCreateFileHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateFileHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`);return}let t=this.getFileResultCache(e),n=this.getFileHighlightKey(e);if(n==null||Ip(e)||t!=null&&Ap(t.options,this.getFileRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`file`?r:void 0;{let t=this.submitCacheTask({type:`file`,file:e},n);return t.type===`file`?t:void 0}}getPlainFileAST(e,t,n,r){if(this.highlighter==null){this.queueInitialization();return}return pm(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);ym(t)||n!=null&&vm(n.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:`diff`,diff:t})}primeDiffHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeDiffHighlightCache: worker pool is not working`));let t=this.getOrCreateDiffHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateDiffHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`);return}let t=this.getDiffResultCache(e),n=this.getDiffHighlightKey(e);if(n==null||ym(e)||t!=null&&vm(t.options,this.getDiffRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`diff`?r:void 0;{let t=this.submitCacheTask({type:`diff`,diff:e},n);return t.type===`diff`?t:void 0}}getPlainDiffAST(e,t,n,r,i){return this.highlighter==null?void 0:Dh(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,expandedHunks:r,collapsedContextThreshold:i})}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers();let e=new Bh;for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,e);this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(e=>{console.error(e)})}cancelActiveWorkerTasks(){let e=new Bh;for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):Gh(t)&&this.rejectRenderTaskCallbacks(t,e)}terminateWorkers(){for(let e of this.workers)e.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?`waiting`:this.initialized===!0?`initialized`:`initializing`,totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(e=>e.requestId!=null||e.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.getHighlightKeyForRequest(t),r=n==null?void 0:this.getTaskByHighlightKey(n);if(r!=null){this.detachInstanceFromQueuedTasks(e,r),this.addInstanceToTask(r,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);let i=this.generateRequestId(),a=Date.now(),{renderOptionsVersion:o}=this,s=(()=>{switch(t.type){case`file`:return{type:`file`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a};case`diff`:return{type:`diff`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a}}})();this.enqueueRenderTask(s,e)}submitCacheTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.generateRequestId(),r=Date.now(),{renderOptionsVersion:i}=this,a=(()=>{switch(e.type){case`file`:return{type:`file`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r};case`diff`:return{type:`diff`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r}}})();return this.enqueueRenderTask(a),a}enqueueRenderTask(e,t){this.queuedTasks.push(e),t!=null&&this.queuedTaskByInstance.set(t,e),e.highlightKey!=null&&this.taskByHighlightKey.set(e.highlightKey,e),this.queueDrain()}async resolveLanguagesAndExecuteTask(e,t,n){try{let r=n.filter(e=>!Xn(e));r.length>0&&Cp({themes:Zn(this.renderOptions.theme),langs:[`text`,...r],preferredHighlighter:this.preferredHighlighter}).catch(e=>{console.error(e)});let i=n.filter(t=>!e.langs.has(t));if(i.length>0&&(Mh(i)?t.request.resolvedLanguages=jh(i):t.request.resolvedLanguages=await Nh(i)),!this.activeTaskById.has(t.id)){e.requestId===t.id&&(this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(e,t)}catch(n){this.rejectRenderTaskCallbacks(t,qh(n)),this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(e,t){let n=this.activeTaskById.get(t.id);try{if(n==null)throw Rh;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(Gh(n))this.notifyHighlightError(n,e),this.rejectRenderTaskCallbacks(n,e);else throw Error(`handleWorkerMessage: unknown task type`);throw e}switch(t.requestType){case`initialize`:if(n.type!==`initialize`)throw Error(`handleWorkerMessage: task/response dont match`);this.syncCustomExtensionVersion(e,n.request),n.resolve();break;case`set-render-options`:if(n.type!==`set-render-options`)throw Error(`handleWorkerMessage: task/response dont match`);n.resolve();break;case`file`:{if(n.type!==`file`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!Ap(i,this.getFileRenderOptions()))throw Rh;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.fileCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyFileInstances(n,r,i);break}case`diff`:{if(n.type!==`diff`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!vm(i,this.getDiffRenderOptions()))throw Rh;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.diffCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyDiffInstances(n,r,i);break}}}catch(e){e!==Rh&&console.error(e,n,t)}this.cleanWorkerAndTask(e,n,t.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain??(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(e,t){t.requestId=e.id,Gh(e)&&(this.clearQueuedInstanceRequests(e),this.trackInstanceRequests(e)),this.activeTaskById.set(e.id,e)}cleanWorkerAndTask(e,t,n=t?.id){e.requestId===n&&(e.requestId=void 0),e.pendingSetupRequestId===n&&(e.pendingSetupRequestId=void 0),t!=null&&(Gh(t)&&(this.rejectRenderTaskCallbacks(t,new Vh),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){Uh(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);for(let n of Wh(t))e.langs.add(n);try{t.type===`file`?t.cacheKeyAtDispatch=t.request.file.cacheKey:t.type===`diff`&&(t.cacheKeyAtDispatch=t.request.diff.cacheKey),e.worker.postMessage(t.request)}catch(n){console.error(`Failed to post message to worker:`,n),Gh(t)?(this.notifyHighlightError(t,n),this.rejectRenderTaskCallbacks(t,qh(n))):`reject`in t&&t.reject(n),this.cleanWorkerAndTask(e,t),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(e,t){if(t.customExtensionsVersion!=null)return;let n=Pp();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=Fp())}syncCustomExtensionVersion(e,t){t.customExtensionsVersion!=null&&(e.customExtensionsVersion=t.customExtensionsVersion)}getAvailableWorker(e){let t;for(let n of this.workers){if(n.requestId!=null||n.pendingSetupRequestId!=null||!n.initialized)continue;if(t=n,e.length===0)break;let r=!0;for(let t of e)if(!n.langs.has(t)){r=!1;break}if(r)break}return t}getFileHighlightKey(e){if(e.cacheKey!=null)return`file:${e.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(e){if(e.cacheKey!=null)return`diff:${e.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(e){switch(e.type){case`file`:return this.getFileHighlightKey(e.file);case`diff`:return this.getDiffHighlightKey(e.diff)}}hasActiveRequest(e){for(let t of Kh(e))if(this.activeRequestByInstance.has(t))return!0;return!1}addInstanceToTask(e,t){e.type,e.instances.add(t),this.activeTaskById.has(e.id)?this.activeRequestByInstance.set(t,e.id):this.queuedTaskByInstance.set(t,e)}detachInstanceFromQueuedTasks(e,t){let n=this.queuedTaskByInstance.get(e);n!=null&&n!==t&&(this.queuedTaskByInstance.delete(e),this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeQueuedTask(n))}detachInstanceFromRenderTask(e,t){e.type,e.instances.delete(t)}removeQueuedTask(e){let t=this.queuedTasks.indexOf(e);t!==-1&&this.queuedTasks.splice(t,1),this.rejectRenderTaskCallbacks(e,new Vh),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new Vh),this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}createRenderTaskCallbacks(e){return new Promise((t,n)=>{e.callbacks.add({resolve:t,reject:n})})}resolveRenderTaskCallbacks(e){for(let t of e.callbacks)t.resolve();e.callbacks.clear()}rejectRenderTaskCallbacks(e,t){for(let n of e.callbacks)n.reject(t);e.callbacks.clear()}invalidateRenderTasks(){for(let e=this.queuedTasks.length-1;e>=0;e--){let t=this.queuedTasks[e];t.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(t)}for(let e of Array.from(this.activeTaskById.values()))Gh(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of Kh(e))this.queuedTaskByInstance.get(t)===e&&this.queuedTaskByInstance.delete(t)}clearHighlightKey(e){e.highlightKey!=null&&this.taskByHighlightKey.get(e.highlightKey)===e&&this.taskByHighlightKey.delete(e.highlightKey)}trackInstanceRequests(e){for(let t of Kh(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of Kh(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.file,t,n)}notifyDiffInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.diff,t,n)}notifyHighlightError(e,t){for(let n of Kh(e))this.activeRequestByInstance.get(n)===e.id&&n.onHighlightError(t)}hasMatchingFileInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`file`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&_m(t,n.request.file))return!0;return!1}hasMatchingDiffInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`diff`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&gm(n.request.diff,t))return!0;return!1}getTaskByHighlightKey(e){let t=this.taskByHighlightKey.get(e);return t!=null&&this.isCurrentRenderTask(t)?t:void 0}isCurrentRenderTask(e){return e.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(let e of this.queuedTasks)yield e;for(let e of this.activeTaskById.values())Gh(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function Uh(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function Wh(e){let t=new Set;if(e.type===`initialize`||e.type===`set-render-options`)return[];switch(e.type){case`file`:t.add(e.request.file.lang??Y(e.request.file.name));break;case`diff`:t.add(e.request.diff.lang??Y(e.request.diff.name)),t.add(e.request.diff.lang??Y(e.request.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function Gh(e){return e?.type===`file`||e?.type===`diff`}function Kh(e){return e.instances}function qh(e){if(e instanceof Error)return e;if(typeof e==`object`&&e){if(`error`in e&&e.error instanceof Error)return e.error;if(`message`in e&&typeof e.message==`string`)return Error(e.message)}return Error(String(e))}var Jh;function Yh({poolOptions:e,highlighterOptions:t}){return Jh??=new Hh(e,t),Jh}function Xh(){Jh!=null&&(Jh.terminate(),Jh=void 0)}var Zh=(0,k.createContext)(void 0),Qh=0;function $h({children:e,poolOptions:t,highlighterOptions:n}){let[r]=(0,k.useState)(()=>{if(!(typeof window>`u`))return Yh({poolOptions:t,highlighterOptions:n})});return(0,k.useInsertionEffect)(()=>{if(r!=null)return Qh++,()=>{Qh--}},[r]),(0,k.useEffect)(()=>()=>{Qh===0&&Xh()},[]),(0,j.jsx)(Zh.Provider,{value:r,children:e})}function eg(e,t,n){if(e===t||e==null||t==null)return e===t;let r=new Set(n),i=Object.keys(e),a=new Set(Object.keys(t));for(let n of i)if(a.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(a))if(!r.has(e))return!1;return!0}function tg(e,t){let n=e?.theme??Dn,r=t?.theme??Dn,i=ng(e),a=ng(t);return Op(n,r)&&eg(e,t,[`theme`,`parseDiffOptions`])&&eg(i,a)}function ng(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}var rg=new Set,ig=null;function Q(e){rg.add(e),ig??=requestAnimationFrame(og)}function ag(e){rg.delete(e)&&rg.size===0&&ig!=null&&(cancelAnimationFrame(ig),ig=null)}function og(e){let t=new Set(rg);rg.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}ig=rg.size>0?requestAnimationFrame(og):null}function sg(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function cg({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:r=!1,fitPerfectlyOverscroll:i=0,overscrollSize:a}){let o=n+a*2,s=r?n+i*2:o;if(t=Math.max(t,s),o>=t||r){let n=Math.max(e-i,0),r=Math.min(e+s,t);return{top:n,bottom:Math.max(r,n)}}let c=e+n/2-o/2,l=c+o;return c<0&&(c=0),l>t&&(l=t),c=Math.floor(Math.max(c,0)),{top:c,bottom:Math.ceil(Math.max(Math.min(l,t),c))}}function lg(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function $(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}var ug=`-1,-1`;function dg(e){return e?.some(e=>e.lineNumber===0)??!1}function fg(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function pg(e){return e.startingLine===0&&e.totalLines>0}function mg(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function hg(){return X({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[Kp({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function gg(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}var _g=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),ag(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){let n=!(e===this.selectedRange||sg(e??void 0,this.selectedRange??void 0)),r=t?.lineNumberOnly??!1,i=t?.activeLineSide!==this.selectedRangeHighlightSide||r!==this.selectedRangeLineNumberOnly;(this.isSelectionDirty()||n||i)&&(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=r,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let r=e!==this.editorActiveLine,i=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;(this.isSelectionDirty()||r||i)&&(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;(t!=null||n!=null||r!=null||a!=null||i!=null)&&(this.options.onGutterUtilityClick!=null&&gg(e.composedPath())||(Lg(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e})))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;(t!==`disabled`||o||n!=null||r!=null||i!=null||a!=null)&&(Lg(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(Lg(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){Lg(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`);return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();Lg(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);Lg(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onHunkExpand:f,onMergeConflictActionClick:p}=this.options;switch(e){case`move`:{let e=Sg(i)&&this.hoveredLine?.lineElement===i.lineElement;xg(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),xg(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Sg(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(wg(i)&&p!=null){p(i);break}if(Cg(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!Sg(i))break;xg(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onHunkExpand:u,onMergeConflictActionClick:d,enableGutterUtility:f=!1,enableLineSelection:p=!1,onGutterUtilityClick:m}=this.options,h=m!=null,g=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f||p||h;g&&!this.hasPointerListeners?(e.addEventListener(`click`,this.handlePointerClick),e.addEventListener(`pointerdown`,this.handlePointerDown),e.addEventListener(`pointermove`,this.handlePointerMove),e.addEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!0,Lg(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),u!=null&&e.push(`expandable hunk separators`),d!=null&&e.push(`merge conflict actions`)),e})()),Lg(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),Lg(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!g&&this.hasPointerListeners&&(e.removeEventListener(`click`,this.handlePointerClick),e.removeEventListener(`pointerdown`,this.handlePointerDown),e.removeEventListener(`pointermove`,this.handlePointerMove),e.removeEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!1);let _=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,v=this.pointerSession.mode===`gutterSelecting`;(!p&&_||!h&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();gg(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let n=this.currentSelectionEnds(),r=n?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),i=n?.top??r;r!=null&&i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:r},this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(mg(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(n.current=r,this.updateSelection(r.lineNumber,r.side));let i=this.buildSelectedLineRange(n.anchor,n.current);t?.({...i}),this.selectionAnchor=void 0,this.notifySelectionEnd(i),this.notifySelectionCommitted(i),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=vc(hg());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);bg(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(r!=null&&i!=null)return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(Dg(t));if(bg(n)&&(this.mode!==`diff`||e.side==null||n.side===e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(bg(n)&&(!t||n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(bg(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&gg(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=Dg(e);if(t&&gg(n))return;let r=Og(e);return r==null?this.pathFromAnnotationSlot(e):Dg(r)}pathFromAnnotationSlot(e){let t=kg(e)?.previousElementSibling;if(t instanceof HTMLElement&&(t.hasAttribute(`data-line`)||t.hasAttribute(`data-column-number`)))return Dg(t);let n=jg(Ag(e));if(n==null)return;let r=this.targetForSelectionPoint(n);return r==null?void 0:Dg(r.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=Mg(t)?t:Mg(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}sg(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,Q(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;let r=this.getIndexesFromSelection(e.range,t);if(r==null)throw console.error({rowRange:r,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return r}getLineRenderColumns(e,t,n,r){if(this.pre==null||t==null&&r==null)return[];let{children:i}=this.pre;if(i.length>2)throw console.error(i),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let a=[];for(let o of i){let i=o.hasAttribute(`data-deletions`)?`deletions`:o.hasAttribute(`data-additions`)?`additions`:void 0,s=e!=null&&t!=null&&(e.highlightSide==null||i==null||e.highlightSide===i),c=n!=null&&r!=null&&(n.highlightSide==null||i==null||n.highlightSide===i);if(!s&&!c)continue;let[l,u]=o.children;if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error(`InteractionManager.renderSelection: missing gutter or content element`);if(u.children.length!==l.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);a.push({content:u,gutter:l,renderEditorActiveLine:c,renderSelectedLines:s})}return a}renderSelection=()=>{ag(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!Pg(this.renderedSelectedLinesState,n),i=!Pg(this.renderedEditorActiveLineState,t);if(!r&&!i)return;r&&(this.renderedSelectedLinesState=void 0),i&&(this.renderedEditorActiveLineState=void 0);let a=this.pre.getAttribute(`data-diff-type`)===`split`,o=r?this.resolveLineRenderRange(n,a,`selected-lines`):void 0,s=i?this.resolveLineRenderRange(t,a,`editor-active-line`):void 0,c=this.getLineRenderColumns(r?n:void 0,o,i?t:void 0,s),l=n.range==null||c.some(e=>e.renderSelectedLines),u=t.range==null||c.some(e=>e.renderEditorActiveLine);if(r)for(let e of this.pre.querySelectorAll(`[data-selected-line]`))e.removeAttribute(`data-selected-line`);if(i)for(let e of this.pre.querySelectorAll(`[data-editor-active-line]`))e.removeAttribute(`data-editor-active-line`);let d=o==null?void 0:Math.min(o.start,o.end),f=o==null?void 0:Math.max(o.start,o.end),p=d===f,m=s?.start;for(let e of c){let{content:r,gutter:i,renderEditorActiveLine:o,renderSelectedLines:s}=e,c=Math.max(s?f??-1/0:-1/0,o?m??-1/0:-1/0),l=r.children.length;for(let e=0;e<l;e++){let l=r.children[e],u=i.children[e];if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let h=this.parseLineIndex(l,a);if((h??0)>c)break;if(h!=null){if(s&&d!=null&&f!=null&&h>=d&&h<=f){let e=p?`single`:h===d?`first`:h===f?`last`:``;u.setAttribute(`data-selected-line`,e),n.lineNumberOnly||(l.setAttribute(`data-selected-line`,e),u.nextSibling instanceof HTMLElement&&l.nextSibling instanceof HTMLElement&&(l.nextSibling.hasAttribute(`data-line-annotation`)||l.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(p?(e=`last`,l.setAttribute(`data-selected-line`,`first`)):h===d?e=``:h===f&&l.setAttribute(`data-selected-line`,``),l.nextSibling.setAttribute(`data-selected-line`,e),u.nextSibling.setAttribute(`data-selected-line`,e)))}o&&h===m&&(u.setAttribute(`data-editor-active-line`,``),t.lineNumberOnly||l.setAttribute(`data-editor-active-line`,``))}}}r&&l&&(this.renderedSelectedLinesState=n),i&&u&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);Tg(e)&&Number.isFinite(n)&&(d={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&f.hasAttribute(`data-char`)){s=f;let e=f.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?f.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=f,u=Number.parseInt(e,10),t=!0,n=Ig(f),a=f.getAttribute(`data-line-index`)??void 0;continue}let p=i==null?f.getAttribute(`data-line`)??void 0:void 0;if(p!=null){i=f,u=Number.parseInt(p,10),n=Ig(f),a=f.getAttribute(`data-line-index`)??void 0;continue}if(l==null&&(f.hasAttribute(`data-expand-button`)||f.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:f.hasAttribute(`data-expand-up`)?`up`:f.hasAttribute(`data-expand-down`)?`down`:`both`,all:f.hasAttribute(`data-expand-all-button`)};continue}let m=l==null?void 0:f.getAttribute(`data-expand-index`)??void 0;if(l!=null&&m!=null){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e);continue}if(r==null&&f.hasAttribute(`data-code`)){r=f;break}}if(d!=null)return d;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:Eg(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:Eg(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||u==null||Number.isNaN(u))return;let f=this.parseLineIndex(i,this.isSplitDiff());return c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f}:{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:Fg(n,r),splitLineIndex:f}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:Fg(n,r),splitLineIndex:f,...c}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function vg({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:yg({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:y,onMergeConflictActionClick:x,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:b}}function yg({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function bg(e){return e!=null&&`kind`in e&&e.kind===`line`}function xg(e){return e!=null&&`kind`in e&&e.kind===`token`}function Sg(e){return bg(e)||xg(e)}function Cg(e){return`type`in e&&e.type===`line-info`}function wg(e){return`kind`in e&&e.kind===`merge-conflict-action`}function Tg(e){return e===`current`||e===`incoming`||e===`both`}function Eg(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Dg(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function Og(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function kg(e){let t=e.closest(`[slot^="annotation-"]`),n=(t instanceof HTMLElement&&t.assignedSlot!=null?t.assignedSlot:e.tagName===`SLOT`?e:void 0)?.closest(`[data-line-annotation]`);return n instanceof HTMLElement?n:void 0}function Ag(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function jg(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function Mg(e){return e!=null&&typeof e.elementFromPoint==`function`}function Ng(e,t){return e===t||sg(e??void 0,t??void 0)}function Pg(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&Ng(e?.range??null,t.range)}function Fg(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function Ig(e){let t=e.getAttribute(`data-line-type`);if(t!=null)switch(t){case`change-deletion`:case`change-addition`:case`context`:case`context-expanded`:return t;default:return}}function Lg(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return}console.log(...n)}var Rg=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n=`apply`}){let r=new Set,i=n===`apply`,a=0,o=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(a===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;a++;let n=o.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let r=e.firstElementChild;r instanceof HTMLElement||(r=null),n==null?(n={type:`code`,codeElement:e,numberElement:r,codeWidth:`auto`,numberWidth:0,applyColumnVariables:i},this.observedNodes.set(e,n),this.observe(e),r!=null&&(this.observedNodes.set(r,n),this.observe(r))):(this.observedNodes.set(e,n),o.delete(e),n.numberElement===r?n.numberElement==null?n.numberWidth=0:(o.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),o.delete(n.numberElement)),r!=null&&(this.observe(r),o.delete(r),this.observedNodes.set(r,n)),n.numberElement=r,n.numberWidth=0),Vg(n,i))}if(a>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=o.get(a);if(c!=null){this.observedNodes.set(a,c),this.observedNodes.set(s,c),o.delete(a),o.delete(s);continue}let l=a.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:n,child:a,childHeight:l},column2:{container:i,child:s,childHeight:u},currentHeight:`auto`},r.add({child1:a,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of r)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);r.clear()}for(let[e,t]of o)this.unobserve(e),t.type===`code`?Wg(t):Gg(t);o.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:zg(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:Bg(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;(i||a)&&(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&Hg(t,{codeWidthChanged:i,numberWidthChanged:a}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function zg(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function Bg(e){return Math.max(Math.ceil(e),0)}function Vg(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?Hg(e,{codeWidthChanged:!0,numberWidthChanged:!0}):Ug(e))}function Hg(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:r,codeWidth:i,numberWidth:a}=e;if(t&&r.style.setProperty(`--diffs-column-width`,`${typeof i==`number`?`${i}px`:`auto`}`),n&&r.style.setProperty(`--diffs-column-number-width`,`${a===0?`auto`:`${a}px`}`),t||n&&i!==`auto`){let e=typeof i==`number`?Math.max(i-a,0):0;r.style.setProperty(`--diffs-column-content-width`,`${e>0?`${e}px`:`auto`}`)}}function Ug(e){e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`)}function Wg(e){e.codeElement.isConnected&&Ug(e)}function Gg(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty(`--diffs-annotation-min-height`),e.column2.container.isConnected&&e.column2.container.style.removeProperty(`--diffs-annotation-min-height`)}function Kg(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function qg(e,t){return e.endsWith(`\r
170
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Uh({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":``},alwaysWrap:!0}}function Wh({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;if(r===o||r&&e.value.length===1&&!o){a[1]+=e.value;return}t.push([+!r,e.value])}var Gh={forcePlainText:!1};function Kh(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=Gh){r?(i??=0,a??=1/0):(i=0,a=1/0);let c=i>0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=Om({theme:n.theme,highlighter:t}),d=r&&!c&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,m=!r&&!e.isPartial,h=r?o:void 0,g=new Map;function _(e){let t=m?0:e,n=g.get(t)??Jh();return g.set(t,n),n}function v(e,t,n,r){if(c){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}rh({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:!c||h,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&qh({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:d,maxLineDiffLength:p}),r!=null&&(v(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(v(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let i of g.values()){if(i.deletionContent.length===0&&i.additionContent.length===0)continue;let a={name:e.prevName??e.name,contents:i.deletionContent.value},o={name:e.name,contents:i.additionContent.value},{deletionLines:s,additionLines:c}=Yh({deletionFile:a,deletionInfo:i.deletionInfo,deletionDecorations:i.deletionDecorations,additionFile:o,additionInfo:i.additionInfo,additionDecorations:i.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang});if(m){f.deletionLines=s,f.additionLines=c;continue}if(i.deletionSegments.length>0)for(let e of i.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else lm(f.deletionLines,s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else lm(f.additionLines,c)}return{code:f,themeStyles:u,baseThemeType:l}}function qh({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=uh(e),t=uh(t),e.length>s||t.length>s))return;let c=o===`char`?ph(e,t):Ah(e,t),l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?(Wh({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),Wh({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?Wh({item:e,arr:l,enableJoin:d,isLastItem:t}):Wh({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(Uh({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(Uh({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function Jh(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Yh({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c,...l}}){let u=s??J(e.name),d=s??J(t.name),{state:f,transformers:p}=Tm(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:X(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:X(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,Am(i.codeToHast(uh(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,Am(i.codeToHast(uh(t.contents),m)))}}function Xh(e){let t=[];for(let n of e){let e=ur.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function Zh(e){for(let t of Array.isArray(e)?e:[e])if(!ur.has(t))return!1;return!0}async function Qh(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=hp(r)??mp(r);`then`in e?n.push(e):t.push(e)}return n.length>0&&await Promise.all(n).then(e=>{for(let n of e){if(n==null)throw Error(`resolvedLanguages: unable to resolve language`);t.push(n)}}),t}function $h(e){return Dr.getResolvedThemes(e)}async function eg(e){for(let t of e)Lp(t);let t=await Dr.resolveThemes(e);for(let n=0;n<e.length;n++)Rp(e[n],t[n]);return t}var tg=n(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):r((n||=self).lru_map=n.lru_map||{})})(e,function(e){let t=Symbol(`newer`),n=Symbol(`older`);class r{constructor(e,t){typeof e!=`number`&&(t=e,e=0),this.size=0,this.limit=e,this.oldest=this.newest=void 0,this._keymap=new Map,t&&(this.assign(t),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[t]&&(e===this.oldest&&(this.oldest=e[t]),e[t][n]=e[n]),e[n]&&(e[n][t]=e[t]),e[t]=void 0,e[n]=this.newest,this.newest&&(this.newest[t]=e),this.newest=e)}assign(e){let r,a=this.limit||Number.MAX_VALUE;this._keymap.clear();let o=e[Symbol.iterator]();for(let e=o.next();!e.done;e=o.next()){let o=new i(e.value[0],e.value[1]);if(this._keymap.set(o.key,o),r?(r[t]=o,o[n]=r):this.oldest=o,r=o,a--==0)throw Error(`overflow`)}this.newest=r,this.size=this._keymap.size}get(e){var t=this._keymap.get(e);return t?(this._markEntryAsUsed(t),t.value):void 0}set(e,r){var a=this._keymap.get(e);return a?(a.value=r,this._markEntryAsUsed(a),this):(this._keymap.set(e,a=new i(e,r)),this.newest?(this.newest[t]=a,a[n]=this.newest):this.oldest=a,this.newest=a,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var e=this.oldest;if(e)return this.oldest[t]?(this.oldest=this.oldest[t],this.oldest[n]=void 0):(this.oldest=void 0,this.newest=void 0),e[t]=e[n]=void 0,this._keymap.delete(e.key),--this.size,[e.key,e.value]}find(e){let t=this._keymap.get(e);return t?t.value:void 0}has(e){return this._keymap.has(e)}delete(e){var r=this._keymap.get(e);return r?(this._keymap.delete(r.key),r[t]&&r[n]?(r[n][t]=r[t],r[t][n]=r[n]):r[t]?(r[t][n]=void 0,this.oldest=r[t]):r[n]?(r[n][t]=void 0,this.newest=r[n]):this.oldest=this.newest=void 0,this.size--,r.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new o(this.oldest)}values(){return new s(this.oldest)}entries(){return this}[Symbol.iterator](){return new a(this.oldest)}forEach(e,n){typeof n!=`object`&&(n=this);let r=this.oldest;for(;r;)e.call(n,r.value,r.key,this),r=r[t]}toJSON(){for(var e=Array(this.size),n=0,r=this.oldest;r;)e[n++]={key:r.key,value:r.value},r=r[t];return e}toString(){for(var e=``,n=this.oldest;n;)e+=String(n.key)+`:`+n.value,n=n[t],n&&(e+=` < `);return e}}e.LRUMap=r;function i(e,r){this.key=e,this.value=r,this[t]=void 0,this[n]=void 0}function a(e){this.entry=e}a.prototype[Symbol.iterator]=function(){return this},a.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}};function o(e){this.entry=e}o.prototype[Symbol.iterator]=function(){return this},o.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.key}):{done:!0,value:void 0}};function s(e){this.entry=e}s.prototype[Symbol.iterator]=function(){return this},s.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.value}):{done:!0,value:void 0}}})})),ng=t(tg(),1),rg=Symbol(`IGNORE_RESPONSE`),ig=1e4,ag=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled because the pool terminated`)}},og=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled before the task completed`)}},sg=class{options;highlighter;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:n=Gn,useTokenTransformer:r=!1,lineDiffType:i=`word-alt`,maxLineDiffLength:a=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:s=`shiki-js`}){this.options=e,this.preferredHighlighter=s,this.renderOptions={theme:n,useTokenTransformer:r,lineDiffType:i,maxLineDiffLength:a,tokenizeMaxLineLength:o},this.fileCache=new ng.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new ng.default.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed}getFileResultCache(e){return e.cacheKey==null?void 0:this.fileCache.get(e.cacheKey)}getDiffResultCache(e){return e.cacheKey==null?void 0:this.diffCache.get(e.cacheKey)}inspectCaches(){let{fileCache:e,diffCache:t}=this;return{fileCache:e,diffCache:t}}evictFileFromCache(e){try{return this.fileCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(e){try{return this.diffCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:e=this.renderOptions.theme??Gn,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:n=this.renderOptions.lineDiffType??`word-alt`,maxLineDiffLength:r=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:i=this.renderOptions.tokenizeMaxLineLength??1e3}){let{lifecycleGeneration:a}=this,o=++this.renderOptionsRequestVersion,s=()=>this.isCurrentLifecycle(a)&&this.renderOptionsRequestVersion===o;try{let a={theme:e,useTokenTransformer:t,lineDiffType:n,maxLineDiffLength:r,tokenizeMaxLineLength:i};if(this.isInitialized()||await this.initialize(),!s()||Lm(a,this.renderOptions))return;let o=hr(e),c=[];if(qp(a.theme,this.renderOptions.theme)||(c=Jp(o)?$h(o):await eg(o)),!s())return;if(this.highlighter!=null)Or(c,this.highlighter);else{let e=await Hp({themes:o,langs:[`text`],preferredHighlighter:this.preferredHighlighter});if(!s())return;this.highlighter=e}let l=this.setRenderOptionsOnWorkers(a,c);this.renderOptions=a,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(let e of this.themeSubscribers)e.onThemeChange();await l}catch(e){if(e instanceof ag||!s())return;throw e}}getPreferredHighlighter(){return this.preferredHighlighter}getFileRenderOptions(){let{tokenizeMaxLineLength:e,theme:t,useTokenTransformer:n}=this.renderOptions;return{theme:t,useTokenTransformer:n,tokenizeMaxLineLength:e}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(e,t){if(this.workersFailed)return;this.isInitialized()||await this.initialize();let n=[];for(let r of this.workers){if(!r.initialized)throw console.log({managedWorker:r}),Error(`setRenderOptionsOnWorkers: Somehow we have an uninitialized worker`);n.push(new Promise((n,i)=>{let a=this.generateRequestId(),o={type:`set-render-options`,id:a,request:{type:`set-render-options`,id:a,renderOptions:e,resolvedThemes:t},resolve:n,reject:i,requestStart:Date.now()};this.activeTaskById.set(a,o),r.pendingSetupRequestId=a,r.worker.postMessage(o.request)}))}await Promise.all(n)}subscribeToThemeChanges(e){return this.themeSubscribers.add(e),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(e),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(e){this.themeSubscribers.delete(e),this.queueBroadcastStateChanges()}subscribeToStatChanges(e){return this.statSubscribers.add(e),e(this.getStats()),()=>{this.statSubscribers.delete(e)}}queueBroadcastStateChanges(){this._queuedBroadcast??=requestAnimationFrame(this._broadcastStateChanges)}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);let e=this.getStats();for(let t of this.statSubscribers)t(e)};cleanUpTasks(e){this.detachInstanceFromQueuedTasks(e);let t=this.activeRequestByInstance.get(e);if(t!=null){let n=this.activeTaskById.get(t);ug(n)?(this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeActiveTask(n)):this.activeTaskById.delete(t)}this.activeRequestByInstance.delete(e),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(e=[]){if(this.initialized!==!0){if(this.initialized===!1){let{lifecycleGeneration:t}=this;this.initialized=new Promise((n,r)=>{(async()=>{try{let r=hr(this.renderOptions.theme),i=[];if(i=Jp(r)?$h(r):await eg(r),!this.isCurrentLifecycle(t)){n();return}let a=[];if(a=Zh(e)?Xh(e):await Qh(e),!this.isCurrentLifecycle(t)){n();return}let[o]=await Promise.all([Hp({themes:r,langs:[`text`,...e],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(i,a)]);if(!this.isCurrentLifecycle(t)){this.terminateWorkers(),n();return}this.highlighter=o,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),n()}catch(e){if(e instanceof ag||!this.isCurrentLifecycle(t)){n();return}this.initialized=!1,this.workersFailed=!0,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.activeTaskById.clear();for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,fg(e));this.queueBroadcastStateChanges(),r(e)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}}async initializeWorkers(e,t){this.workersFailed=!1;let n=[],r=$p(),i=r>0?em():void 0;this.workers.length>0&&this.terminateWorkers();for(let a=0;a<(this.options.poolSize??8);a++){let a=this.options.workerFactory(),o={worker:a,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set([`text`,...t.map(({name:e})=>e)]),customExtensionsVersion:0};a.addEventListener(`message`,e=>{this.handleWorkerMessage(o,e.data)}),a.addEventListener(`error`,e=>this.handleWorkerError(o,e)),this.workers.push(o),n.push(new Promise((n,a)=>{let s=this.generateRequestId(),c={type:`initialize`,id:s,request:{type:`initialize`,id:s,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:e,resolvedLanguages:t,customExtensionsVersion:i==null?void 0:r,customExtensionMap:i},resolve(){o.initialized=!0,n()},reject:a,requestStart:Date.now()};o.pendingSetupRequestId=s,this.activeTaskById.set(s,c),this.executeTask(o,c)}))}let a=this.options.workerInitializationTimeout??ig,o;try{await Promise.race([Promise.all(n),new Promise((e,t)=>{o=setTimeout(()=>{t(Error(`WorkerPoolManager: worker initialization timed out after ${a}ms`))},a)})])}finally{o!=null&&clearTimeout(o)}}handleWorkerError(e,t){console.error(`Worker error:`,t,e);let{pendingSetupRequestId:n}=e;if(n==null)return;let r=this.activeTaskById.get(n);r?.type===`initialize`&&(r.reject(fg(t)),this.cleanWorkerAndTask(e,r))}drainQueue=()=>{if(this._queuedDrain=void 0,this.initialized===!0&&this.queuedTasks.length!==0){for(let e=0;e<this.queuedTasks.length;){let t=this.queuedTasks[e];if(this.hasActiveRequest(t)){e++;continue}let n=lg(t),r=this.getAvailableWorker(n);if(r==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,r),this.resolveLanguagesAndExecuteTask(r,t,n)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){let n=this.getFileResultCache(t);tm(t)||n!=null&&Yp(n.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:`file`,file:t})}primeFileHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeFileHighlightCache: worker pool is not working`));let t=this.getOrCreateFileHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateFileHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`);return}let t=this.getFileResultCache(e),n=this.getFileHighlightKey(e);if(n==null||tm(e)||t!=null&&Yp(t.options,this.getFileRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`file`?r:void 0;{let t=this.submitCacheTask({type:`file`,file:e},n);return t.type===`file`?t:void 0}}getPlainFileAST(e,t,n,r){if(this.highlighter==null){this.queueInitialization();return}return Mm(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);Rm(t)||n!=null&&Lm(n.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:`diff`,diff:t})}primeDiffHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeDiffHighlightCache: worker pool is not working`));let t=this.getOrCreateDiffHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateDiffHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`);return}let t=this.getDiffResultCache(e),n=this.getDiffHighlightKey(e);if(n==null||Rm(e)||t!=null&&Lm(t.options,this.getDiffRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`diff`?r:void 0;{let t=this.submitCacheTask({type:`diff`,diff:e},n);return t.type===`diff`?t:void 0}}getPlainDiffAST(e,t,n,r,i){return this.highlighter==null?void 0:Kh(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,expandedHunks:r,collapsedContextThreshold:i})}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers();let e=new ag;for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,e);this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(e=>{console.error(e)})}cancelActiveWorkerTasks(){let e=new ag;for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):ug(t)&&this.rejectRenderTaskCallbacks(t,e)}terminateWorkers(){for(let e of this.workers)e.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?`waiting`:this.initialized===!0?`initialized`:`initializing`,totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(e=>e.requestId!=null||e.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.getHighlightKeyForRequest(t),r=n==null?void 0:this.getTaskByHighlightKey(n);if(r!=null){this.detachInstanceFromQueuedTasks(e,r),this.addInstanceToTask(r,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);let i=this.generateRequestId(),a=Date.now(),{renderOptionsVersion:o}=this,s=(()=>{switch(t.type){case`file`:return{type:`file`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a};case`diff`:return{type:`diff`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a}}})();this.enqueueRenderTask(s,e)}submitCacheTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.generateRequestId(),r=Date.now(),{renderOptionsVersion:i}=this,a=(()=>{switch(e.type){case`file`:return{type:`file`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r};case`diff`:return{type:`diff`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r}}})();return this.enqueueRenderTask(a),a}enqueueRenderTask(e,t){this.queuedTasks.push(e),t!=null&&this.queuedTaskByInstance.set(t,e),e.highlightKey!=null&&this.taskByHighlightKey.set(e.highlightKey,e),this.queueDrain()}async resolveLanguagesAndExecuteTask(e,t,n){try{let r=n.filter(e=>!mr(e));r.length>0&&Hp({themes:hr(this.renderOptions.theme),langs:[`text`,...r],preferredHighlighter:this.preferredHighlighter}).catch(e=>{console.error(e)});let i=n.filter(t=>!e.langs.has(t));if(i.length>0&&(Zh(i)?t.request.resolvedLanguages=Xh(i):t.request.resolvedLanguages=await Qh(i)),!this.activeTaskById.has(t.id)){e.requestId===t.id&&(this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(e,t)}catch(n){this.rejectRenderTaskCallbacks(t,fg(n)),this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(e,t){let n=this.activeTaskById.get(t.id);try{if(n==null)throw rg;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(ug(n))this.notifyHighlightError(n,e),this.rejectRenderTaskCallbacks(n,e);else throw Error(`handleWorkerMessage: unknown task type`);throw e}switch(t.requestType){case`initialize`:if(n.type!==`initialize`)throw Error(`handleWorkerMessage: task/response dont match`);this.syncCustomExtensionVersion(e,n.request),n.resolve();break;case`set-render-options`:if(n.type!==`set-render-options`)throw Error(`handleWorkerMessage: task/response dont match`);n.resolve();break;case`file`:{if(n.type!==`file`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!Yp(i,this.getFileRenderOptions()))throw rg;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.fileCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyFileInstances(n,r,i);break}case`diff`:{if(n.type!==`diff`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!Lm(i,this.getDiffRenderOptions()))throw rg;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.diffCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyDiffInstances(n,r,i);break}}}catch(e){e!==rg&&console.error(e,n,t)}this.cleanWorkerAndTask(e,n,t.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain??(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(e,t){t.requestId=e.id,ug(e)&&(this.clearQueuedInstanceRequests(e),this.trackInstanceRequests(e)),this.activeTaskById.set(e.id,e)}cleanWorkerAndTask(e,t,n=t?.id){e.requestId===n&&(e.requestId=void 0),e.pendingSetupRequestId===n&&(e.pendingSetupRequestId=void 0),t!=null&&(ug(t)&&(this.rejectRenderTaskCallbacks(t,new og),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){cg(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);for(let n of lg(t))e.langs.add(n);try{t.type===`file`?t.cacheKeyAtDispatch=t.request.file.cacheKey:t.type===`diff`&&(t.cacheKeyAtDispatch=t.request.diff.cacheKey),e.worker.postMessage(t.request)}catch(n){console.error(`Failed to post message to worker:`,n),ug(t)?(this.notifyHighlightError(t,n),this.rejectRenderTaskCallbacks(t,fg(n))):`reject`in t&&t.reject(n),this.cleanWorkerAndTask(e,t),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(e,t){if(t.customExtensionsVersion!=null)return;let n=$p();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=em())}syncCustomExtensionVersion(e,t){t.customExtensionsVersion!=null&&(e.customExtensionsVersion=t.customExtensionsVersion)}getAvailableWorker(e){let t;for(let n of this.workers){if(n.requestId!=null||n.pendingSetupRequestId!=null||!n.initialized)continue;if(t=n,e.length===0)break;let r=!0;for(let t of e)if(!n.langs.has(t)){r=!1;break}if(r)break}return t}getFileHighlightKey(e){if(e.cacheKey!=null)return`file:${e.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(e){if(e.cacheKey!=null)return`diff:${e.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(e){switch(e.type){case`file`:return this.getFileHighlightKey(e.file);case`diff`:return this.getDiffHighlightKey(e.diff)}}hasActiveRequest(e){for(let t of dg(e))if(this.activeRequestByInstance.has(t))return!0;return!1}addInstanceToTask(e,t){e.type,e.instances.add(t),this.activeTaskById.has(e.id)?this.activeRequestByInstance.set(t,e.id):this.queuedTaskByInstance.set(t,e)}detachInstanceFromQueuedTasks(e,t){let n=this.queuedTaskByInstance.get(e);n!=null&&n!==t&&(this.queuedTaskByInstance.delete(e),this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeQueuedTask(n))}detachInstanceFromRenderTask(e,t){e.type,e.instances.delete(t)}removeQueuedTask(e){let t=this.queuedTasks.indexOf(e);t!==-1&&this.queuedTasks.splice(t,1),this.rejectRenderTaskCallbacks(e,new og),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new og),this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}createRenderTaskCallbacks(e){return new Promise((t,n)=>{e.callbacks.add({resolve:t,reject:n})})}resolveRenderTaskCallbacks(e){for(let t of e.callbacks)t.resolve();e.callbacks.clear()}rejectRenderTaskCallbacks(e,t){for(let n of e.callbacks)n.reject(t);e.callbacks.clear()}invalidateRenderTasks(){for(let e=this.queuedTasks.length-1;e>=0;e--){let t=this.queuedTasks[e];t.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(t)}for(let e of Array.from(this.activeTaskById.values()))ug(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of dg(e))this.queuedTaskByInstance.get(t)===e&&this.queuedTaskByInstance.delete(t)}clearHighlightKey(e){e.highlightKey!=null&&this.taskByHighlightKey.get(e.highlightKey)===e&&this.taskByHighlightKey.delete(e.highlightKey)}trackInstanceRequests(e){for(let t of dg(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of dg(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.file,t,n)}notifyDiffInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.diff,t,n)}notifyHighlightError(e,t){for(let n of dg(e))this.activeRequestByInstance.get(n)===e.id&&n.onHighlightError(t)}hasMatchingFileInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`file`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&Im(t,n.request.file))return!0;return!1}hasMatchingDiffInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`diff`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&Fm(n.request.diff,t))return!0;return!1}getTaskByHighlightKey(e){let t=this.taskByHighlightKey.get(e);return t!=null&&this.isCurrentRenderTask(t)?t:void 0}isCurrentRenderTask(e){return e.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(let e of this.queuedTasks)yield e;for(let e of this.activeTaskById.values())ug(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function cg(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function lg(e){let t=new Set;if(e.type===`initialize`||e.type===`set-render-options`)return[];switch(e.type){case`file`:t.add(e.request.file.lang??J(e.request.file.name));break;case`diff`:t.add(e.request.diff.lang??J(e.request.diff.name)),t.add(e.request.diff.lang??J(e.request.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function ug(e){return e?.type===`file`||e?.type===`diff`}function dg(e){return e.instances}function fg(e){if(e instanceof Error)return e;if(typeof e==`object`&&e){if(`error`in e&&e.error instanceof Error)return e.error;if(`message`in e&&typeof e.message==`string`)return Error(e.message)}return Error(String(e))}var pg;function mg({poolOptions:e,highlighterOptions:t}){return pg??=new sg(e,t),pg}function hg(){pg!=null&&(pg.terminate(),pg=void 0)}var gg=(0,A.createContext)(void 0),_g=0;function vg({children:e,poolOptions:t,highlighterOptions:n}){let[r]=(0,A.useState)(()=>{if(!(typeof window>`u`))return mg({poolOptions:t,highlighterOptions:n})});return(0,A.useInsertionEffect)(()=>{if(r!=null)return _g++,()=>{_g--}},[r]),(0,A.useEffect)(()=>()=>{_g===0&&hg()},[]),(0,j.jsx)(gg.Provider,{value:r,children:e})}function yg(e,t,n){if(e===t||e==null||t==null)return e===t;let r=new Set(n),i=Object.keys(e),a=new Set(Object.keys(t));for(let n of i)if(a.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(a))if(!r.has(e))return!1;return!0}function bg(e,t){let n=e?.theme??Gn,r=t?.theme??Gn,i=xg(e),a=xg(t);return qp(n,r)&&yg(e,t,[`theme`,`parseDiffOptions`])&&yg(i,a)}function xg(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}var Sg=new Set,Cg=null;function Z(e){Sg.add(e),Cg??=requestAnimationFrame(Tg)}function wg(e){Sg.delete(e)&&Sg.size===0&&Cg!=null&&(cancelAnimationFrame(Cg),Cg=null)}function Tg(e){let t=new Set(Sg);Sg.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}Cg=Sg.size>0?requestAnimationFrame(Tg):null}function Eg(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Dg({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:r=!1,fitPerfectlyOverscroll:i=0,overscrollSize:a}){let o=n+a*2,s=r?n+i*2:o;if(t=Math.max(t,s),o>=t||r){let n=Math.max(e-i,0),r=Math.min(e+s,t);return{top:n,bottom:Math.max(r,n)}}let c=e+n/2-o/2,l=c+o;return c<0&&(c=0),l>t&&(l=t),c=Math.floor(Math.max(c,0)),{top:c,bottom:Math.ceil(Math.max(Math.min(l,t),c))}}function Og(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function Q(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}var kg=`-1,-1`;function Ag(e){return e?.some(e=>e.lineNumber===0)??!1}function jg(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function Mg(e){return e.startingLine===0&&e.totalLines>0}function Ng(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function Pg(){return Y({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[dm({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function Fg(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}var Ig=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),wg(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){let n=!(e===this.selectedRange||Eg(e??void 0,this.selectedRange??void 0)),r=t?.lineNumberOnly??!1,i=t?.activeLineSide!==this.selectedRangeHighlightSide||r!==this.selectedRangeLineNumberOnly;(this.isSelectionDirty()||n||i)&&(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=r,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let r=e!==this.editorActiveLine,i=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;(this.isSelectionDirty()||r||i)&&(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;(t!=null||n!=null||r!=null||a!=null||i!=null)&&(this.options.onGutterUtilityClick!=null&&Fg(e.composedPath())||(n_(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e})))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;(t!==`disabled`||o||n!=null||r!=null||i!=null||a!=null)&&(n_(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(n_(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){n_(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`);return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();n_(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);n_(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onHunkExpand:f,onMergeConflictActionClick:p}=this.options;switch(e){case`move`:{let e=Vg(i)&&this.hoveredLine?.lineElement===i.lineElement;Bg(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),Bg(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Vg(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(Ug(i)&&p!=null){p(i);break}if(Hg(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!Vg(i))break;Bg(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onHunkExpand:u,onMergeConflictActionClick:d,enableGutterUtility:f=!1,enableLineSelection:p=!1,onGutterUtilityClick:m}=this.options,h=m!=null,g=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f||p||h;g&&!this.hasPointerListeners?(e.addEventListener(`click`,this.handlePointerClick),e.addEventListener(`pointerdown`,this.handlePointerDown),e.addEventListener(`pointermove`,this.handlePointerMove),e.addEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!0,n_(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),u!=null&&e.push(`expandable hunk separators`),d!=null&&e.push(`merge conflict actions`)),e})()),n_(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),n_(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!g&&this.hasPointerListeners&&(e.removeEventListener(`click`,this.handlePointerClick),e.removeEventListener(`pointerdown`,this.handlePointerDown),e.removeEventListener(`pointermove`,this.handlePointerMove),e.removeEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!1);let _=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,v=this.pointerSession.mode===`gutterSelecting`;(!p&&_||!h&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();Fg(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let n=this.currentSelectionEnds(),r=n?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),i=n?.top??r;r!=null&&i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:r},this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(Ng(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(n.current=r,this.updateSelection(r.lineNumber,r.side));let i=this.buildSelectedLineRange(n.anchor,n.current);t?.({...i}),this.selectionAnchor=void 0,this.notifySelectionEnd(i),this.notifySelectionCommitted(i),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=Ic(Pg());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);zg(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(r!=null&&i!=null)return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(Kg(t));if(zg(n)&&(this.mode!==`diff`||e.side==null||n.side===e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(zg(n)&&(!t||n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(zg(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&Fg(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=Kg(e);if(t&&Fg(n))return;let r=qg(e);return r==null?this.pathFromAnnotationSlot(e):Kg(r)}pathFromAnnotationSlot(e){let t=Jg(e)?.previousElementSibling;if(t instanceof HTMLElement&&(t.hasAttribute(`data-line`)||t.hasAttribute(`data-column-number`)))return Kg(t);let n=Xg(Yg(e));if(n==null)return;let r=this.targetForSelectionPoint(n);return r==null?void 0:Kg(r.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=Zg(t)?t:Zg(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}Eg(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,Z(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;let r=this.getIndexesFromSelection(e.range,t);if(r==null)throw console.error({rowRange:r,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return r}getLineRenderColumns(e,t,n,r){if(this.pre==null||t==null&&r==null)return[];let{children:i}=this.pre;if(i.length>2)throw console.error(i),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let a=[];for(let o of i){let i=o.hasAttribute(`data-deletions`)?`deletions`:o.hasAttribute(`data-additions`)?`additions`:void 0,s=e!=null&&t!=null&&(e.highlightSide==null||i==null||e.highlightSide===i),c=n!=null&&r!=null&&(n.highlightSide==null||i==null||n.highlightSide===i);if(!s&&!c)continue;let[l,u]=o.children;if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error(`InteractionManager.renderSelection: missing gutter or content element`);if(u.children.length!==l.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);a.push({content:u,gutter:l,renderEditorActiveLine:c,renderSelectedLines:s})}return a}renderSelection=()=>{wg(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!$g(this.renderedSelectedLinesState,n),i=!$g(this.renderedEditorActiveLineState,t);if(!r&&!i)return;r&&(this.renderedSelectedLinesState=void 0),i&&(this.renderedEditorActiveLineState=void 0);let a=this.pre.getAttribute(`data-diff-type`)===`split`,o=r?this.resolveLineRenderRange(n,a,`selected-lines`):void 0,s=i?this.resolveLineRenderRange(t,a,`editor-active-line`):void 0,c=this.getLineRenderColumns(r?n:void 0,o,i?t:void 0,s),l=n.range==null||c.some(e=>e.renderSelectedLines),u=t.range==null||c.some(e=>e.renderEditorActiveLine);if(r)for(let e of this.pre.querySelectorAll(`[data-selected-line]`))e.removeAttribute(`data-selected-line`);if(i)for(let e of this.pre.querySelectorAll(`[data-editor-active-line]`))e.removeAttribute(`data-editor-active-line`);let d=o==null?void 0:Math.min(o.start,o.end),f=o==null?void 0:Math.max(o.start,o.end),p=d===f,m=s?.start;for(let e of c){let{content:r,gutter:i,renderEditorActiveLine:o,renderSelectedLines:s}=e,c=Math.max(s?f??-1/0:-1/0,o?m??-1/0:-1/0),l=r.children.length;for(let e=0;e<l;e++){let l=r.children[e],u=i.children[e];if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let h=this.parseLineIndex(l,a);if((h??0)>c)break;if(h!=null){if(s&&d!=null&&f!=null&&h>=d&&h<=f){let e=p?`single`:h===d?`first`:h===f?`last`:``;u.setAttribute(`data-selected-line`,e),n.lineNumberOnly||(l.setAttribute(`data-selected-line`,e),u.nextSibling instanceof HTMLElement&&l.nextSibling instanceof HTMLElement&&(l.nextSibling.hasAttribute(`data-line-annotation`)||l.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(p?(e=`last`,l.setAttribute(`data-selected-line`,`first`)):h===d?e=``:h===f&&l.setAttribute(`data-selected-line`,``),l.nextSibling.setAttribute(`data-selected-line`,e),u.nextSibling.setAttribute(`data-selected-line`,e)))}o&&h===m&&(u.setAttribute(`data-editor-active-line`,``),t.lineNumberOnly||l.setAttribute(`data-editor-active-line`,``))}}}r&&l&&(this.renderedSelectedLinesState=n),i&&u&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);Wg(e)&&Number.isFinite(n)&&(d={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&f.hasAttribute(`data-char`)){s=f;let e=f.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?f.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=f,u=Number.parseInt(e,10),t=!0,n=t_(f),a=f.getAttribute(`data-line-index`)??void 0;continue}let p=i==null?f.getAttribute(`data-line`)??void 0:void 0;if(p!=null){i=f,u=Number.parseInt(p,10),n=t_(f),a=f.getAttribute(`data-line-index`)??void 0;continue}if(l==null&&(f.hasAttribute(`data-expand-button`)||f.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:f.hasAttribute(`data-expand-up`)?`up`:f.hasAttribute(`data-expand-down`)?`down`:`both`,all:f.hasAttribute(`data-expand-all-button`)};continue}let m=l==null?void 0:f.getAttribute(`data-expand-index`)??void 0;if(l!=null&&m!=null){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e);continue}if(r==null&&f.hasAttribute(`data-code`)){r=f;break}}if(d!=null)return d;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:Gg(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:Gg(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||u==null||Number.isNaN(u))return;let f=this.parseLineIndex(i,this.isSplitDiff());return c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f}:{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:e_(n,r),splitLineIndex:f}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:e_(n,r),splitLineIndex:f,...c}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function Lg({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:Rg({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:y,onMergeConflictActionClick:x,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:b}}function Rg({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function zg(e){return e!=null&&`kind`in e&&e.kind===`line`}function Bg(e){return e!=null&&`kind`in e&&e.kind===`token`}function Vg(e){return zg(e)||Bg(e)}function Hg(e){return`type`in e&&e.type===`line-info`}function Ug(e){return`kind`in e&&e.kind===`merge-conflict-action`}function Wg(e){return e===`current`||e===`incoming`||e===`both`}function Gg(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Kg(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function qg(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function Jg(e){let t=e.closest(`[slot^="annotation-"]`),n=(t instanceof HTMLElement&&t.assignedSlot!=null?t.assignedSlot:e.tagName===`SLOT`?e:void 0)?.closest(`[data-line-annotation]`);return n instanceof HTMLElement?n:void 0}function Yg(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function Xg(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function Zg(e){return e!=null&&typeof e.elementFromPoint==`function`}function Qg(e,t){return e===t||Eg(e??void 0,t??void 0)}function $g(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&Qg(e?.range??null,t.range)}function e_(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function t_(e){let t=e.getAttribute(`data-line-type`);if(t!=null)switch(t){case`change-deletion`:case`change-addition`:case`context`:case`context-expanded`:return t;default:return}}function n_(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return}console.log(...n)}var r_=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n=`apply`}){let r=new Set,i=n===`apply`,a=0,o=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(a===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;a++;let n=o.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let r=e.firstElementChild;r instanceof HTMLElement||(r=null),n==null?(n={type:`code`,codeElement:e,numberElement:r,codeWidth:`auto`,numberWidth:0,applyColumnVariables:i},this.observedNodes.set(e,n),this.observe(e),r!=null&&(this.observedNodes.set(r,n),this.observe(r))):(this.observedNodes.set(e,n),o.delete(e),n.numberElement===r?n.numberElement==null?n.numberWidth=0:(o.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),o.delete(n.numberElement)),r!=null&&(this.observe(r),o.delete(r),this.observedNodes.set(r,n)),n.numberElement=r,n.numberWidth=0),o_(n,i))}if(a>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=o.get(a);if(c!=null){this.observedNodes.set(a,c),this.observedNodes.set(s,c),o.delete(a),o.delete(s);continue}let l=a.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:n,child:a,childHeight:l},column2:{container:i,child:s,childHeight:u},currentHeight:`auto`},r.add({child1:a,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of r)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);r.clear()}for(let[e,t]of o)this.unobserve(e),t.type===`code`?l_(t):u_(t);o.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:i_(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:a_(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;(i||a)&&(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&s_(t,{codeWidthChanged:i,numberWidthChanged:a}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function i_(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function a_(e){return Math.max(Math.ceil(e),0)}function o_(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?s_(e,{codeWidthChanged:!0,numberWidthChanged:!0}):c_(e))}function s_(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:r,codeWidth:i,numberWidth:a}=e;if(t&&r.style.setProperty(`--diffs-column-width`,`${typeof i==`number`?`${i}px`:`auto`}`),n&&r.style.setProperty(`--diffs-column-number-width`,`${a===0?`auto`:`${a}px`}`),t||n&&i!==`auto`){let e=typeof i==`number`?Math.max(i-a,0):0;r.style.setProperty(`--diffs-column-content-width`,`${e>0?`${e}px`:`auto`}`)}}function c_(e){e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`)}function l_(e){e.codeElement.isConnected&&c_(e)}function u_(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty(`--diffs-annotation-min-height`),e.column2.container.isConnected&&e.column2.container.style.removeProperty(`--diffs-annotation-min-height`)}function d_(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function f_(e,t){return e.endsWith(`\r
171
171
  `)?t+`\r
172
172
  `:e.endsWith(`\r`)?t+`\r`:e.endsWith(`
173
173
  `)?t+`
174
- `:t}function Jg(e){return X({tagName:`div`,children:[X({tagName:`div`,children:e.annotations?.map(e=>X({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function Yg(e,t){return X({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function Xg(e){switch(e){case`file`:return`diffs-icon-file-code`;case`change`:return`diffs-icon-symbol-modified`;case`new`:return`diffs-icon-symbol-added`;case`deleted`:return`diffs-icon-symbol-deleted`;case`rename-pure`:case`rename-changed`:return`diffs-icon-symbol-moved`}}function Zg({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return X({tagName:`div`,children:[t===`custom`?X({tagName:`slot`,properties:{name:En}}):Qg({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[$g(r)]],properties:i})}function Qg({name:e,prevName:t,iconType:n}){let r=[X({tagName:`slot`,properties:{name:Cn}}),Kp({name:Xg(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(X({tagName:`div`,children:[X({tagName:`bdi`,children:[Gp(t)]})],properties:{"data-prev-name":``}})),r.push(Kp({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(X({tagName:`div`,children:[X({tagName:`bdi`,children:[Gp(e)]})],properties:{"data-title":``}})),r.push(X({tagName:`slot`,properties:{name:wn}})),X({tagName:`div`,children:r,properties:{"data-header-content":``}})}function $g(e){let t=[];if(e!=null){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(X({tagName:`span`,children:[Gp(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(X({tagName:`span`,children:[Gp(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(X({tagName:`slot`,properties:{name:Tn}})),X({tagName:`div`,children:t,properties:{"data-metadata":``}})}function e_(e){return X({tagName:`pre`,properties:t_(e)})}function t_({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}function n_(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:Array.isArray(e)?e:[e??`text`],themes:Zn(t),preferredHighlighter:n}}function r_(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function i_(e,t){return t.cacheKey==null?e.file===t&&e.sourceContents===t.contents:e.cacheKey===t.cacheKey}var a_=-1,o_=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`file-renderer:${++a_}`;highlighter;file;renderCache;pendingHighlightResult;computedLang=`text`;lineAnnotations={};lineCache;pendingStructuralRows;textDocumentCache=new WeakMap;editSessionActive=!1;get fileCache(){return this.renderCache?.file}constructor(e={theme:Dn},t=Hn,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=Zf(e.theme??Dn)?Tp():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}beginEditSession(e,t){let{editSessionActive:n,renderCache:r}=this;if(this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.file=e,r==null||n&&r.file===e)return;let{options:i}=this.getRenderOptions(e),a=r.file===e,o=t!=null&&$(r.file,t),{result:s}=r;if(!r.highlighted||s==null||!Ap(r.options,i)||!a&&!o){this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap;return}if(a)return;this.renderCache={...r,file:e,result:{...s,code:[...s.code]}};let{lineCache:c}=this;this.lineCache=c!=null&&t!=null&&i_(c,t)?{cacheKey:void 0,file:e,sourceContents:e.contents,lines:c.lines}:void 0}endEditSession(e){this.editSessionActive=!1,this.pendingHighlightResult=void 0;let{renderCache:t}=this;e!=null&&t!=null&&t.file!==e&&$(t.file,e)&&(t.file=e)}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0,this.file=void 0,this.endEditSession(),this.textDocumentCache=new WeakMap}clearRenderCache(){this.pendingStructuralRows=void 0,this.renderCache=void 0,this.pendingHighlightResult=void 0}hydrate(e){this.file=e;let{options:t}=this.getRenderOptions(e),n=s_(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!Ap(t,r.options)&&(r=void 0),this.renderCache??={file:e,hydrated:!0,options:t,highlighted:!n&&!Ip(e),result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter??(this.computedLang=e.lang??Y(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??Dn}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getFileRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getFileRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{tokenizeMaxLineLength:e=1e3}=this.options;return{theme:this.getLocalHighlightTheme(),useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:e}})(),{renderCache:n}=this;return n?.result==null||!$(e,n.file)||!Ap(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getFileForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null)return e;let{renderCache:n}=this;if(n==null)return e;if($(n.file,e))return n.file;let r=Up(e.contents),i=e.contents.length===0||Ip(e)||s_(r.length,this.getTokenizeMaxLength());return this.canRenderFile(e,t,i)?e:n.file}canRenderFile(e,t,n){let{renderCache:r}=this;return r==null||$(r.file,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&Zf(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&Zf(t.theme)}getOrCreateLineCache(e){let{lineCache:t}=this;return(t==null||!i_(t,e))&&(t={cacheKey:e.cacheKey,file:e,sourceContents:e.contents,lines:Up(e.contents)}),this.lineCache=t,t.lines}getLineCount(e){let t=this.getOrCreateLineCache(e);return this.textDocumentCache.get(e)?.lineCount??t.length}updateRenderCache(e,t,n=!1){this.pendingStructuralRows=void 0;let{renderCache:r}=this;if(r==null)return;let{file:i,result:a}=r;if(a==null)return;let o=n?new Map:void 0;this.pendingStructuralRows=o;let s=this.lineCache!=null&&i_(this.lineCache,i)?this.lineCache:void 0;for(let[t,n]of e){if(o==null&&s!=null&&t<s.lines.length){let e=n.map(e=>e[2]).join(``);s.lines[t]=qg(s.lines[t]??``,e)}let e={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};o==null?a.code[t]=e:o.set(t,e)}a.baseThemeType=t,r.isDirty=!0,o==null&&s!=null&&(i.contents=s.lines.join(``),s.sourceContents=i.contents)}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;if(this.pendingStructuralRows=void 0,n==null)return;let{file:r,result:i}=n;if(i==null)return;let a=this.lineCache!=null&&i_(this.lineCache,r)?this.lineCache.lines:Up(r.contents),o=Up(e.getText());if(a.length!==o.length){let r=Math.min(a.length,o.length),s=0;for(;s<r&&a[s]===o[s];)s++;let c=0;for(;c<r-s&&a[a.length-1-c]===o[o.length-1-c];)c++;let l=i.code;i.code=Array(o.length);for(let e=0;e<s;e++)i.code[e]=l[e];for(let e=0;e<c;e++)i.code[o.length-1-e]=l[a.length-1-e];if(t!==void 0)for(let[e,n]of t)e<o.length&&(i.code[e]=n);for(let t=s;t<o.length-c;t++)i.code[t]??={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:e.getLineText(t)}]}]};for(let e=0;e<i.code.length;e++){let t=i.code[e];t?.type===`element`&&(t.properties[`data-line`]=e+1,t.properties[`data-line-index`]=e)}n.isDirty=!0}this.lineCache={cacheKey:r.cacheKey,file:r,sourceContents:r.contents,lines:o},this.textDocumentCache.set(r,e),r.contents=e.getText()}renderFile(e=this.file,t=Bn){if(this.file=e,e==null){this.pendingHighlightResult=void 0;return}let{options:n,forceHighlight:r}=this.getRenderOptions(e),i=this.getReadyRenderResult(e,n);this.pendingHighlightResult=void 0,i!=null&&(this.renderCache={...i,file:e,renderRange:void 0},r=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};let a=this.getOrCreateLineCache(e),o=e.contents.length>0,s=!o||Ip(e)||s_(a.length,this.getTokenizeMaxLength()),c=this.canRenderFile(e,n,s),l=!$(e,this.renderCache.file),u=!Kg(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let i=this.renderCache.result==null&&this.renderCache.highlighted&&!s&&!l&&r_(t);c&&!i&&(s||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||r)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,a)),this.renderCache.renderRange=t),!s&&o&&(!this.renderCache.highlighted||r)&&this.workerManager.highlightFileAST(this,e)}else{this.computedLang=e.lang??Y(e.name),this.highlighter??=Tp();let t=this.highlighter!=null&&Zf(n.theme),i=this.highlighter!=null&&Xn(this.computedLang),a=!s&&i;if(c&&this.highlighter!=null&&t&&(r||s||!this.renderCache.highlighted&&a||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,this.highlighter,s||!i);this.renderCache={file:e,options:n,highlighted:a,result:t,renderRange:void 0}}(!t||!s&&!i)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.applyHighlightResult(e,t,n,!s)})}return this.renderCache.result==null?void 0:this.processFileResult(this.renderCache.file,t,this.renderCache.result)}async asyncRender(e,t=Bn){this.file=e;let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){let t=s_(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??Y(e.name);let n=this.highlighter!=null&&kp(Zn(this.getLocalHighlightTheme())),r=t||this.highlighter!=null&&Xn(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e);return{result:pm(e,t,r,{forcePlainText:n}),options:r}}processFileResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let a=this.getLineCount(e),{disableFileHeader:o=!1}=this.options,s=[],c=Jp(),l=Math.min(t.startingLine+t.totalLines,a),u=0,d=pg(t)?fg(this.lineAnnotations):void 0;d!=null&&(c.children.push(Xp(`context`,`annotation`,1)),s.push(Jg({type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:d.map(e=>this.annotationSlotName(e))})),u++);for(let r=t.startingLine;r<l;r++){let t=r+1,i=n[r];if(i==null){let n=`FileRenderer.processFileResult: Line doesnt exist`;throw console.error(n,{name:e.name,lineIndex:r,lineNumber:t}),Error(n)}c.children.push(Yp(`context`,t,`${r}`)),s.push(i),u++;let a=this.lineAnnotations[t];a!=null&&(c.children.push(Xp(`context`,`annotation`,1)),s.push(Jg({type:`annotation`,hunkIndex:0,lineIndex:t,annotations:a.map(e=>this.annotationSlotName(e))})),u++)}return c.properties.style=`grid-row: span ${u}`,{file:e,gutterAST:c.children??[],contentAST:s,preAST:this.createPreElement(a),headerAST:o?void 0:this.renderHeader(e),totalLines:a,rowCount:u,themeStyles:r,baseThemeType:i,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderHeader(e){let{headerRenderMode:t=`default`,stickyHeader:n=!1}=this.options;return Zg({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return vc(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(X({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=Jp();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,Yg(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return vc(t?X({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await Cp(n_(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{file:i,renderCache:a}=this;i!=null&&a!=null&&$(e,i)&&Ap(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&Ap(a.options,n)&&$(a.file,i)||(this.pendingHighlightResult={file:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.()))}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getFileResultCache(e);if(n!=null&&Ap(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&$(n.file,e)&&Ap(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{file:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&$(e,n.file)&&Ap(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){let{disableLineNumbers:t=!1,overflow:n=`scroll`}=this.options;return e_({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function s_(e,t){return e>t}var c_=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
174
+ `:t}function p_(e){return Y({tagName:`div`,children:[Y({tagName:`div`,children:e.annotations?.map(e=>Y({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function m_(e,t){return Y({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function h_(e){switch(e){case`file`:return`diffs-icon-file-code`;case`change`:return`diffs-icon-symbol-modified`;case`new`:return`diffs-icon-symbol-added`;case`deleted`:return`diffs-icon-symbol-deleted`;case`rename-pure`:case`rename-changed`:return`diffs-icon-symbol-moved`}}function g_({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return Y({tagName:`div`,children:[t===`custom`?Y({tagName:`slot`,properties:{name:Wn}}):__({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[v_(r)]],properties:i})}function __({name:e,prevName:t,iconType:n}){let r=[Y({tagName:`slot`,properties:{name:Vn}}),dm({name:h_(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(Y({tagName:`div`,children:[Y({tagName:`bdi`,children:[um(t)]})],properties:{"data-prev-name":``}})),r.push(dm({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(Y({tagName:`div`,children:[Y({tagName:`bdi`,children:[um(e)]})],properties:{"data-title":``}})),r.push(Y({tagName:`slot`,properties:{name:Hn}})),Y({tagName:`div`,children:r,properties:{"data-header-content":``}})}function v_(e){let t=[];if(e!=null){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(Y({tagName:`span`,children:[um(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(Y({tagName:`span`,children:[um(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(Y({tagName:`slot`,properties:{name:Un}})),Y({tagName:`div`,children:t,properties:{"data-metadata":``}})}function y_(e){return Y({tagName:`pre`,properties:b_(e)})}function b_({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}function x_(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:Array.isArray(e)?e:[e??`text`],themes:hr(t),preferredHighlighter:n}}function S_(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function C_(e,t){return t.cacheKey==null?e.file===t&&e.sourceContents===t.contents:e.cacheKey===t.cacheKey}var w_=-1,T_=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`file-renderer:${++w_}`;highlighter;file;renderCache;pendingHighlightResult;computedLang=`text`;lineAnnotations={};lineCache;pendingStructuralRows;textDocumentCache=new WeakMap;editSessionActive=!1;get fileCache(){return this.renderCache?.file}constructor(e={theme:Gn},t=or,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=gp(e.theme??Gn)?Wp():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}beginEditSession(e,t){let{editSessionActive:n,renderCache:r}=this;if(this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.file=e,r==null||n&&r.file===e)return;let{options:i}=this.getRenderOptions(e),a=r.file===e,o=t!=null&&Q(r.file,t),{result:s}=r;if(!r.highlighted||s==null||!Yp(r.options,i)||!a&&!o){this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap;return}if(a)return;this.renderCache={...r,file:e,result:{...s,code:[...s.code]}};let{lineCache:c}=this;this.lineCache=c!=null&&t!=null&&C_(c,t)?{cacheKey:void 0,file:e,sourceContents:e.contents,lines:c.lines}:void 0}endEditSession(e){this.editSessionActive=!1,this.pendingHighlightResult=void 0;let{renderCache:t}=this;e!=null&&t!=null&&t.file!==e&&Q(t.file,e)&&(t.file=e)}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0,this.file=void 0,this.endEditSession(),this.textDocumentCache=new WeakMap}clearRenderCache(){this.pendingStructuralRows=void 0,this.renderCache=void 0,this.pendingHighlightResult=void 0}hydrate(e){this.file=e;let{options:t}=this.getRenderOptions(e),n=E_(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!Yp(t,r.options)&&(r=void 0),this.renderCache??={file:e,hydrated:!0,options:t,highlighted:!n&&!tm(e),result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter??(this.computedLang=e.lang??J(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??Gn}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getFileRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getFileRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{tokenizeMaxLineLength:e=1e3}=this.options;return{theme:this.getLocalHighlightTheme(),useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:e}})(),{renderCache:n}=this;return n?.result==null||!Q(e,n.file)||!Yp(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getFileForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null)return e;let{renderCache:n}=this;if(n==null)return e;if(Q(n.file,e))return n.file;let r=cm(e.contents),i=e.contents.length===0||tm(e)||E_(r.length,this.getTokenizeMaxLength());return this.canRenderFile(e,t,i)?e:n.file}canRenderFile(e,t,n){let{renderCache:r}=this;return r==null||Q(r.file,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&gp(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&gp(t.theme)}getOrCreateLineCache(e){let{lineCache:t}=this;return(t==null||!C_(t,e))&&(t={cacheKey:e.cacheKey,file:e,sourceContents:e.contents,lines:cm(e.contents)}),this.lineCache=t,t.lines}getLineCount(e){let t=this.getOrCreateLineCache(e);return this.textDocumentCache.get(e)?.lineCount??t.length}updateRenderCache(e,t,n=!1){this.pendingStructuralRows=void 0;let{renderCache:r}=this;if(r==null)return;let{file:i,result:a}=r;if(a==null)return;let o=n?new Map:void 0;this.pendingStructuralRows=o;let s=this.lineCache!=null&&C_(this.lineCache,i)?this.lineCache:void 0;for(let[t,n]of e){if(o==null&&s!=null&&t<s.lines.length){let e=n.map(e=>e[2]).join(``);s.lines[t]=f_(s.lines[t]??``,e)}let e={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};o==null?a.code[t]=e:o.set(t,e)}a.baseThemeType=t,r.isDirty=!0,o==null&&s!=null&&(i.contents=s.lines.join(``),s.sourceContents=i.contents)}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;if(this.pendingStructuralRows=void 0,n==null)return;let{file:r,result:i}=n;if(i==null)return;let a=this.lineCache!=null&&C_(this.lineCache,r)?this.lineCache.lines:cm(r.contents),o=cm(e.getText());if(a.length!==o.length){let r=Math.min(a.length,o.length),s=0;for(;s<r&&a[s]===o[s];)s++;let c=0;for(;c<r-s&&a[a.length-1-c]===o[o.length-1-c];)c++;let l=i.code;i.code=Array(o.length);for(let e=0;e<s;e++)i.code[e]=l[e];for(let e=0;e<c;e++)i.code[o.length-1-e]=l[a.length-1-e];if(t!==void 0)for(let[e,n]of t)e<o.length&&(i.code[e]=n);for(let t=s;t<o.length-c;t++)i.code[t]??={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:e.getLineText(t)}]}]};for(let e=0;e<i.code.length;e++){let t=i.code[e];t?.type===`element`&&(t.properties[`data-line`]=e+1,t.properties[`data-line-index`]=e)}n.isDirty=!0}this.lineCache={cacheKey:r.cacheKey,file:r,sourceContents:r.contents,lines:o},this.textDocumentCache.set(r,e),r.contents=e.getText()}renderFile(e=this.file,t=ir){if(this.file=e,e==null){this.pendingHighlightResult=void 0;return}let{options:n,forceHighlight:r}=this.getRenderOptions(e),i=this.getReadyRenderResult(e,n);this.pendingHighlightResult=void 0,i!=null&&(this.renderCache={...i,file:e,renderRange:void 0},r=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};let a=this.getOrCreateLineCache(e),o=e.contents.length>0,s=!o||tm(e)||E_(a.length,this.getTokenizeMaxLength()),c=this.canRenderFile(e,n,s),l=!Q(e,this.renderCache.file),u=!d_(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let i=this.renderCache.result==null&&this.renderCache.highlighted&&!s&&!l&&S_(t);c&&!i&&(s||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||r)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,a)),this.renderCache.renderRange=t),!s&&o&&(!this.renderCache.highlighted||r)&&this.workerManager.highlightFileAST(this,e)}else{this.computedLang=e.lang??J(e.name),this.highlighter??=Wp();let t=this.highlighter!=null&&gp(n.theme),i=this.highlighter!=null&&mr(this.computedLang),a=!s&&i;if(c&&this.highlighter!=null&&t&&(r||s||!this.renderCache.highlighted&&a||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,this.highlighter,s||!i);this.renderCache={file:e,options:n,highlighted:a,result:t,renderRange:void 0}}(!t||!s&&!i)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.applyHighlightResult(e,t,n,!s)})}return this.renderCache.result==null?void 0:this.processFileResult(this.renderCache.file,t,this.renderCache.result)}async asyncRender(e,t=ir){this.file=e;let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){let t=E_(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??J(e.name);let n=this.highlighter!=null&&Jp(hr(this.getLocalHighlightTheme())),r=t||this.highlighter!=null&&mr(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e);return{result:Mm(e,t,r,{forcePlainText:n}),options:r}}processFileResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let a=this.getLineCount(e),{disableFileHeader:o=!1}=this.options,s=[],c=pm(),l=Math.min(t.startingLine+t.totalLines,a),u=0,d=Mg(t)?jg(this.lineAnnotations):void 0;d!=null&&(c.children.push(hm(`context`,`annotation`,1)),s.push(p_({type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:d.map(e=>this.annotationSlotName(e))})),u++);for(let r=t.startingLine;r<l;r++){let t=r+1,i=n[r];if(i==null){let n=`FileRenderer.processFileResult: Line doesnt exist`;throw console.error(n,{name:e.name,lineIndex:r,lineNumber:t}),Error(n)}c.children.push(mm(`context`,t,`${r}`)),s.push(i),u++;let a=this.lineAnnotations[t];a!=null&&(c.children.push(hm(`context`,`annotation`,1)),s.push(p_({type:`annotation`,hunkIndex:0,lineIndex:t,annotations:a.map(e=>this.annotationSlotName(e))})),u++)}return c.properties.style=`grid-row: span ${u}`,{file:e,gutterAST:c.children??[],contentAST:s,preAST:this.createPreElement(a),headerAST:o?void 0:this.renderHeader(e),totalLines:a,rowCount:u,themeStyles:r,baseThemeType:i,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderHeader(e){let{headerRenderMode:t=`default`,stickyHeader:n=!1}=this.options;return g_({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return Ic(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(Y({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=pm();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,m_(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return Ic(t?Y({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await Hp(x_(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{file:i,renderCache:a}=this;i!=null&&a!=null&&Q(e,i)&&Yp(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&Yp(a.options,n)&&Q(a.file,i)||(this.pendingHighlightResult={file:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.()))}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getFileResultCache(e);if(n!=null&&Yp(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&Q(n.file,e)&&Yp(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{file:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&Q(e,n.file)&&Yp(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){let{disableLineNumbers:t=!1,overflow:n=`scroll`}=this.options;return y_({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function E_(e,t){return e>t}var D_=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
175
175
  <symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
176
176
  <path d="M8.47 4.22a.75.75 0 0 0 0 1.06l1.97 1.97H3.75a.75.75 0 0 0 0 1.5h6.69l-1.97 1.97a.75.75 0 1 0 1.06 1.06l3.25-3.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0"/>
177
177
  </symbol>
@@ -223,7 +223,7 @@ XID_Start XIDS`.split(/\s/).map(e=>[td(e),e])),Kd=new Map([[`s`,K(383)],[K(383),
223
223
  <symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
224
224
  <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706.286.286.71.54 1.41.73V1.86c-.7.19-1.124.444-1.41.73-.324.325-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8m4 6.397c.697.07 1.522.103 2.5.103 1.613 0 2.806-.088 3.704-.288.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5c-.978 0-1.803.033-2.5.103zM0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m7-2a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z"/>
225
225
  </symbol>
226
- </svg>`;function l_(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function u_(e,t){return e==null||t==null?e===t:f_(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}var d_={};function f_(e=d_,t=d_){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function p_(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function m_(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e.style.touchAction=`none`,e}function h_(){let e=document.createElement(`style`);return e.setAttribute(kn,``),e}var g_;function __(e){if(g_!=null)return g_;let t=e.host;if(typeof HTMLElement<`u`&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement(`div`);n.setAttribute(`data-code`,``),n.setAttribute(An,`true`);let r=document.createElement(`div`);return r.style.position=`relative`,r.style.width=`200%`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n),g_=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),g_}function v_(e){return`${Nn}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var y_=`@layer base {
226
+ </svg>`;function O_(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function k_(e,t){return e==null||t==null?e===t:j_(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}var A_={};function j_(e=A_,t=A_){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function M_(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function N_(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e.style.touchAction=`none`,e}function P_(){let e=document.createElement(`style`);return e.setAttribute(qn,``),e}var F_;function I_(e){if(F_!=null)return F_;let t=e.host;if(typeof HTMLElement<`u`&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement(`div`);n.setAttribute(`data-code`,``),n.setAttribute(Jn,`true`);let r=document.createElement(`div`);return r.style.position=`relative`,r.style.width=`200%`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n),F_=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),F_}function L_(e){return`${Zn}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var R_=`@layer base {
227
227
  :host {
228
228
  --diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",
229
229
  "Courier New", monospace;
@@ -1501,17 +1501,17 @@ XID_Start XIDS`.split(/\s/).map(e=>[td(e),e])),Kd=new Map([[`s`,K(383)],[K(383),
1501
1501
  }
1502
1502
 
1503
1503
  @layer theme, rendered, unsafe;
1504
- `,b_=`@layer base, theme, rendered, unsafe;`,x_=RegExp(`${T_(Nn)}\\s*:\\s*[^;]+;`);function S_(e){return`${b_}
1504
+ `,z_=`@layer base, theme, rendered, unsafe;`,B_=RegExp(`${W_(Zn)}\\s*:\\s*[^;]+;`);function V_(e){return`${z_}
1505
1505
  @layer unsafe {
1506
1506
  ${e}
1507
- }`}function C_(e,t=`system`,n){return`${b_}
1507
+ }`}function H_(e,t=`system`,n){return`${z_}
1508
1508
  @layer rendered {
1509
1509
  :host {${t===`system`?``:`
1510
1510
  color-scheme: ${t};`}
1511
- ${v_(n)}
1511
+ ${L_(n)}
1512
1512
  ${e}
1513
1513
  }
1514
- }`}function w_(e,t){let n=v_(t);return e.replace(x_,n)}function T_(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var E_=new WeakMap;function D_(e){return E_.get(e)??e}function O_(e,t){E_.set(e,t)}function k_(e,t,n){let r=new Map;for(let i of e){let e=D_(i);r.set(e,n?.slotNames.get(e)??t(i))}return{provided:e,current:e,slotNames:r}}function A_(e,t,n){for(let r of t){let t=D_(r);e.slotNames.has(t)||e.slotNames.set(t,n(r))}e.provided=t,e.current=t}function j_(e,t,n){if(e==null)return n(t);let r=D_(t),i=e.slotNames.get(r);return i??(i=n(t),e.slotNames.set(r,i)),i}function M_(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function N_(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:M_(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function P_({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function F_(e,t){let n=e?.offsetHeight??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}function I_({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=L_(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function L_(){let e=document.createElement(`style`);return e.setAttribute(On,``),e}var R_=void 0,z_=void 0;function B_(){return R_??=/macOS|MacIntel|iPhone|iPad|iPod/i.test(H_())}function V_(){return z_??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function H_(){let e=globalThis.navigator;return e?.platform??e?.userAgentData?.platform??`unknown`}function U_(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function W_(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}if(typeof HTMLElement<`u`&&customElements.get(`diffs-container`)==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync(y_)),t.adoptedStyleSheets=[e]}connectedCallback(){__(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(mn,t)}var G_=[``];function K_(e){let t={...e};return delete t.cacheKey,t}var q_=-1,J_=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++q_}`;type=`file`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;editSession;renderedFile;renderRange;enabled=!0;editor;constructor(e={theme:Dn},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new o_(e,this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager),this.resizeManager=new Rg,this.interactionManager=new _g(`file`,vg(e)),this.workerManager?.subscribeToThemeChanges(this)}getAnnotationSlotName=e=>j_(this.editSession?.annotations,e,Hn);handleHighlightRender=()=>{this.rerender()};rerender(){this.enabled&&this.file!=null&&this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}getTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??Dn}getLatestFile(e=this.file){return this.editSession?.file??e}getRenderedFile(){return this.renderedFile}getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.lineAnnotations?!1:t==null||e!==t.provided&&e!==t.current}updateExternalFile(e,t){if($(this.file,e))return!1;let n=this.editSession!=null;return this.file=e,n||this.editor!=null?this.installEditSession(e,n?void 0:this.editor?.__getDocumentContents(e),!0):this.editSession=void 0,this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=k_(t,Hn,this.editSession.annotations)),!0}installEditSession(e,t,n=!1){let r=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===e.contents,i=K_(t??e);this.editSession={file:i,externalReplacement:n&&r,annotations:this.editSession?.annotations??k_(this.lineAnnotations,Hn)},this.fileRenderer.beginEditSession(i,r?e:void 0)}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(vg(this.options))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!Op(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){let t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,A_(t,e,Hn))}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.fileRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}getCodeScrollLeft(){return this.code?.scrollLeft??0}setCodeScrollLeft(e){this.code!=null&&(this.code.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.fileRenderer.getEffectiveCodeOptions()}}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:e===`wrap`,columnVariables:this.shouldApplyColumnVariables(e)?`apply`:`measure`}),this.managersDirty=!1}shouldApplyColumnVariables(e){return e===`scroll`&&this.getLatestAnnotations().length>0}cleanUp(e=!1){let t=this.editor;this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.pre=void 0,this.code=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0,this.editSession=void 0,this.renderedFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;if(!this.enabled)throw Error(`File.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`File.hydrate: hydrate can only be called before the instance has rendered or hydrated`);this.hydrateElements(t,n);let o=this.editor!=null;o||Y_(this.pre,i,this.options.collapsed)||X_(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,forceRender:o||e.forceRender,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),U_(e,t);for(let t of Array.from(e.shadowRoot?.children??[])){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t,this.appliedPreAttributes=void 0;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}if(`diffsHeader`in t.dataset){this.headerElement=t,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(N_(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderedFile=e,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.getLatestFile()){return e==null?G_:this.fileRenderer.getOrCreateLineCache(e)}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}syncRenderViewToEditor(){let{editor:e,fileContainer:t,renderRange:n}=this,r=this.getLatestAnnotations(),i=this.getLatestFile();if(e==null||t==null||i==null)return;let a=a=>{this.enabled&&this.editor===e&&this.fileContainer===t&&this.getLatestFile()===i&&e.__syncRenderView({highlighter:a,fileContainer:t,file:i,lineAnnotations:r,renderRange:n,externalDocument:this.editSession?.externalReplacement===!0})},o=this.getTheme(),s=i.lang??Y(i.name),c=Tp({theme:o,lang:s});c==null?Cp({themes:Zn(o),langs:Array.from(new Set([`text`,s])),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(a):a(c)}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.externalReplacement=!1)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(){}__attachEditor(e){if(this.editor!=null)throw Error(`File.__attachEditor: an editor is already attached`);this.editor=e;let t=()=>{this.editor=void 0,this.fileRenderer.endEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`File.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){this.editSession==null?this.file!=null&&this.installEditSession(this.file,e.__getDocumentContents(this.file)):this.fileRenderer.beginEditSession(this.editSession.file);let t=this.editSession?.file;this.fileRenderer.editorRenderReady()?(this.fileRenderer.fileCache===t&&(this.renderedFile=t),this.syncRenderViewToEditor()):this.rerender()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n,file:r,lineAnnotations:i}=this;if(n==null||r==null)return;let{file:a,annotations:o}=n;if(this.editor!=null)throw Error(`File.__completeEditSession: detach the editor before completing the session`);let s=o?.current,c,l=!1,u;if(t==null)throw Error(`File.__completeEditSession: editor is required for completion`);let d={...a},f={file:d,editor:t,originalFile:r,lineAnnotations:s,originalLineAnnotations:i};Object.freeze(f);try{if(t.__emitEditComplete(f),this.options.onEditComplete?.(f)===`accept`){if(d.cacheKey!=null&&d.cacheKey===r.cacheKey)throw Error(`File.__completeEditSession: an accepted file must not reuse the replaced file cacheKey`);c=d}}catch(e){l=!0,u=e}e&&c!=null&&(this.file=c,s!=null&&(this.lineAnnotations=s)),this.editSession=void 0;let{renderedFile:p,file:m}=this;if(this.fileRenderer.endEditSession(m),p!=null&&m!=null&&p!==m&&$(p,m)&&(this.renderedFile=m),e&&this.fileContainer!=null&&this.rerender(),l)throw u}applyDocumentChange(e,t){let n=this.editSession?.file;if(n==null)throw Error(`File.applyDocumentChange: requires an active edit session`);this.fileRenderer.beginEditSession(n),this.fileRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}updateRenderCache(e,t,n){let r=this.editSession?.file;if(r==null)throw Error(`File.updateRenderCache: requires an active edit session`);this.fileRenderer.beginEditSession(r),this.fileRenderer.updateRenderCache(e,t,n?.lineCountChangeInFlight)}render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:c=!1,themeType:l=`system`}=this.options,u=c?void 0:s,d=this.renderRange,f=this.hasThemeChanged(),p=o!=null&&(o.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(o),m=!$(this.file,e);m&&this.updateExternalFile(e,o);let h=this.getLatestFile(e)??e;if(!c&&!n&&Kg(u,this.renderRange)&&!m&&!p&&!f){let e=this.applyCachedThemeState(l);return e&&this.finalizeRender(),e}this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.fileRenderer.setOptions(N_(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),this.fileRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:g=!1,disableFileHeader:_=!1}=this.options;if(_&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.fileRenderer.renderFile(h,Vn);e!=null&&this.applyThemeState(t,e.themeStyles,l,e.baseThemeType),e?.headerAST!=null&&this.applyHeaderToDOM(e.headerAST,t,e.file),this.renderedFile=e?.file??h,this.injectUnsafeCSS()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f||!$(this.renderedFile,h))||!this.applyPartialRender(h,d,u)){let n=this.fileRenderer.renderFile(h,u);if(n==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t,n.file),this.applyFullRender(n,e),this.renderedFile=n.file}this.applyBuffers(e,u),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,a||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.file){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||Ip(e))return;let n=this.options.tokenizeMaxLength??1e5;this.fileRenderer.getOrCreateLineCache(e).length>n||await t.primeFileHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,n=this.getLatestAnnotations();if(t!=null&&n.length>0)for(let[r,i]of n.entries()){let n=this.getAnnotationSlotName(i),a=`${r}-${n}`,o=this.annotationCache.get(a);if(o==null||!l_(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:p_(n),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(a,o)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=m_();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=h_(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=S_(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=__(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=I_({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:C_(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=w_(this.themeCSSStyle.textContent??``,__(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&V_()}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e);let n=this.code=P_({code:this.code}),r=this.fileRenderer.renderCodeAST(e);this.editor?.__captureFocusForDOMReplacement();let i=()=>{if(n.childElementCount>=2)for(let e=0;e<2;e++){let t=n.children[e],i=r[e];t.innerHTML=vc(i.children),t.style.cssText=i.properties.style}else n.innerHTML=vc(r);t.contains(n)||t.replaceChildren(n)};this.shouldGuardRebuildScroll()?F_(t,i):i(),this.lastRowCount=e.rowCount}applyPartialRender(e,t,n){if(t==null||n==null)return!1;let{code:r}=this,i=r==null?void 0:this.getColumns(r);if(r==null||i==null)return!1;let a=t.startingLine,o=n.startingLine,s=t.totalLines===1/0?1/0:a+t.totalLines,c=n.totalLines===1/0?1/0:o+n.totalLines,l=Math.max(a,o),u=Math.min(s,c);if(u<=l)return!1;if(!this.trimDOMToOverlap(i.gutter,l,u)||!this.trimDOMToOverlap(i.content,l,u))throw Error(`File.applyPartialRender: failed to trim to overlap`);let{length:d}=i.content.children,f=(t,n)=>{if(!(n<=0))return this.fileRenderer.renderFile(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},p=o<l?f(o,l-o):void 0;if(p===void 0&&o<l)return!1;let m=c===1/0?1/0:Math.max(0,c-u),h=c>u?f(u,m):void 0;return h===void 0&&c>u?!1:(this.cleanupErrorWrapper(),p!=null&&(i.gutter.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.gutterAST)),i.content.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.contentAST)),d+=p.rowCount),h!=null&&(i.gutter.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.gutterAST)),i.content.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.contentAST)),d+=h.rowCount),this.lastRowCount!==d&&(i.gutter.style.setProperty(`grid-row`,`span ${d}`),i.content.style.setProperty(`grid-row`,`span ${d}`),this.lastRowCount=d),!0)}getColumns(e){let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&t.dataset.gutter!=null&&n.dataset.content!=null)return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){let r=this.getDOMBoundaryIndices(e,[t,n]),i=r.get(t)??e.children.length,a=r.get(n)??e.children.length;if(i>a)return!1;for(let t=e.children.length-1;t>=a;--t)e.children[t]?.remove();for(let t=i-1;t>=0;--t)e.children[t]?.remove();return!0}getDOMBoundaryIndices(e,t){let n=[...new Set(t)].sort((e,t)=>e-t),r=new Map;if(n.length===0)return r;let i=0,a=n[i],{children:o}=e;a===0&&(r.set(0,0),i+=1,a=n[i]);for(let e=0;e<o.length;e+=1){let t=o[e];if(!(t instanceof HTMLElement))continue;let s=this.getLineIndexFromDOMNode(t);if(s!=null){for(;a!=null&&s>=a;)r.set(a,e),i+=1,a=n[i];if(i>=n.length)break}}for(let e of n)r.has(e)||r.set(e,o.length);return r}getLineIndexFromDOMNode(e){let t=e.dataset.lineIndex;if(t==null)return;let n=Number(t);return Number.isNaN(n)?void 0:n}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??vc(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged)return;let{renderHeaderPrefix:i,renderHeaderFilenameSuffix:a,renderCustomHeader:o,renderHeaderMetadata:s}=this.options;if(o!=null){let e=o(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,En,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{let e=i?.(n)??void 0,r=a?.(n)??void 0,o=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Cn,e),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,wn,r),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Tn,o),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}getOrCreateFileContainerNode(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:lg(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):lg(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=c_;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};u_(i,this.appliedPreAttributes)||(W_(e,i),this.appliedPreAttributes=i)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Y_(e,t,n=!1){return!n&&e==null&&t!=null}function X_(e,t,n=!1){return e==null&&t!=null&&!n}var Z_=5e3,Q_=new Map,$_=-1;function ev(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS}var tv=class extends J_{virtualizer;metrics;__id=`virtualized-file:${++$_}`;renderType=`virtualized`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0,ghostTextRows:Q_};pendingRender;isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=Fn,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){let n=bm(e);(t||!eg(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache())}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache()}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.resetLayoutCache(),!0):!1}hasLineAnnotations(){return this.getLatestAnnotations().some(e=>e.lineNumber>0)}hasUniformLineHeights(){let{overflow:e=`scroll`}=this.options;return e===`scroll`&&!this.hasLineAnnotations()&&this.cache.heights.size===0}getLineHeight(e,t=!1){let n=this.cache.heights.get(e);if(n!=null)return n;let r=t?2:1;return this.metrics.lineHeight*r}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!tg(t,e),r=ev(t,e);super.setOptions(e),r&&this.resetLayoutCache(!0),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache(e=!1,t=!0){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.ghostTextRows=Q_,this.renderRange!=null&&t&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}applyGhostTextRows(e){let{heights:t,ghostTextRows:n}=this.cache;if(n===e)return!1;let{lineHeight:r}=this.metrics,i=!1;for(let a of new Set([...n.keys(),...e.keys()])){let o=n.get(a)??0,s=e.get(a)??0;if(s===o)continue;let c=(t.get(a)??r)-o*r+s*r;c===r?t.delete(a):t.set(a,c),i=!0}return this.cache.ghostTextRows=e,i}reconcileHeights(){let e=!1;if(this.fileContainer==null||this.getLayoutFile()==null)return this.height!==0&&(e=!0),this.height=0,e;let{overflow:t=`scroll`}=this.options;this.top=this.getVirtualizedTop();let n=this.editor?.__getGhostTextRows()??Q_;if(e=this.applyGhostTextRows(n),t===`scroll`&&this.getLatestAnnotations().length===0&&!this.isResizeDebuggingEnabled())return e&&this.computeApproximateSize(!0),e;let{lineHeight:r}=this.metrics;if(this.code==null)return e;let i=this.code.children[1];if(!(i instanceof HTMLElement))return e;let a=dg(this.getLatestAnnotations());if(this.renderRange!=null&&a&&pg(this.renderRange)){let t=nv(i)??0;t!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=t,e=!0)}else!a&&this.cache.fileAnnotationHeight!==0&&(this.cache.fileAnnotationHeight=0,e=!0);for(let t of i.children){if(!(t instanceof HTMLElement))continue;let i=t.dataset.lineIndex;if(i==null)continue;let a=Number(i),o=t.getBoundingClientRect().height+(n.get(a)??0)*r,s=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(s=!0),o+=t.nextElementSibling.getBoundingClientRect().height);let c=this.getLineHeight(a,s);o!==c&&(e=!0,o===this.metrics.lineHeight*(s?2:1)?this.cache.heights.delete(a):this.cache.heights.set(a,o))}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null||this.file==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render({file:this.file}));updateCodeViewLayout(e,t,n,r){let i=!$(this.file,e);i&&this.updateExternalFile(e,r);let{pendingRenderFile:a,layoutFileChanged:o,renderedFileChanged:s,annotationsChanged:c}=this.updatePendingRender(e,r),l=n?.resetFileLayoutCache===!0||o||c;n?.metrics!=null&&(this.metrics=n.metrics,l=!0);let{collapsed:u=!1}=this.options;return this.currentCollapsed!==u&&(this.currentCollapsed=u,l=!0),l&&this.resetLayoutCache(),i&&(this.layoutDirty=!0),!this.forceRenderOverride&&(i||s||c)&&(this.forceRenderOverride=!0),this.top=t,this.computeApproximateSize(!1,a),this.height}getLayoutFile(){return this.pendingRender?.file??this.getRenderedFile()}getLinePosition(e){let t=this.getLayoutFile();if(t==null||e<1)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options,i=this.fileRenderer.getLineCount(t)-1,a=xm(this.metrics,n);if(r||i<0)return{top:a,height:0};let o=Math.min(Math.max(e-1,0),i),{lineHeight:s}=this.metrics;if(a+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())return{top:a+o*s,height:s};let c=this.getLayoutCheckpointBeforeLineIndex(o);a=c?.top??a;for(let e=c?.lineIndex??0;e<o;e++)a+=this.getLineHeight(e,!1);return{top:a,height:this.getLineHeight(o,!1)}}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutFile();if(t==null||this.renderRange==null)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options;if(r||this.renderRange.totalLines<=0)return;let i=this.fileRenderer.getLineCount(t)-1;if(i<0)return;let a=xm(this.metrics,n),o=Math.min(this.renderRange.startingLine,i),s=Math.min(o+this.renderRange.totalLines-1,i);if(s<o)return;let{fileAnnotationHeight:c}=this.cache;if(this.hasUniformLineHeights()){let{lineHeight:t}=this.metrics,n=a+(o===0?c:this.renderRange.bufferBefore),r=o+Math.max(Math.ceil((e-n)/t),0);return r>s?void 0:{lineNumber:r+1,top:a+c+r*t}}let l=a+(o===0?c:this.renderRange.bufferBefore);for(let t=o;t<=s;t++){if(l>=e)return{lineNumber:t+1,top:l};l+=this.getLineHeight(t)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutFile();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!$(this.getRenderedFile(),this.getLatestFile()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache(),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutFile()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(this.editor?.__getGhostTextRows()??Q_);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,{lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(t),c=xm(this.metrics,i),l=Cm(this.metrics);if(this.height+=c,a){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())this.height+=s*o;else for(let e=0;e<s;e++)this.addLayoutCheckpoint(e,this.height),this.height+=this.getLineHeight(e,!1);if(s>0&&(this.height+=l),this.fileContainer!=null&&n&&!r){let e=this.fileContainer.getBoundingClientRect();e.height===this.height?console.log(`VirtualizedFile.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFile.computeApproximateSize: computed height doesnt match`,{name:t.name,elementHeight:e.height,computedHeight:this.height})}this.layoutDirty=!1}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.file==null)return;let e=this.getLatestFile(),t=e==null?void 0:this.fileRenderer.getFileForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!$(this.getRenderedFile(),t))}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(this.isSimpleMode(),!1);let i=this.getRenderedFile();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&i!=null){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(i,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}render({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:r,...i}){let a=!$(this.file,t);a&&(this.updateExternalFile(t,r),this.cachedHeaderHTML=void 0);let{pendingRenderFile:o,layoutFileChanged:s,renderedFileChanged:c,annotationsChanged:l}=this.pendingRender!=null&&this.pendingRender.latestFile===(this.getLatestFile(t)??t)?{pendingRenderFile:this.pendingRender.file,layoutFileChanged:!1,renderedFileChanged:!1,annotationsChanged:!1}:this.updatePendingRender(t,r),{forceRenderOverride:u,isSetup:d}=this;if(this.forceRenderOverride=void 0,(l||s)&&this.resetLayoutCache(),e=this.getOrCreateFileContainerNode(e),d)this.top??=this.getVirtualizedTop(),s&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(!1),this.computeApproximateSize(!1,o));else{this.computeApproximateSize(!1,o);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFile.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!a||!d))return this.pendingRender=void 0,this.renderPlaceholder(this.height);let f=this.virtualizer.getWindowSpecs(),p=this.top??0,m=this.computeRenderRangeFromWindow(o,p,f);return super.render({file:t,fileContainer:e,renderRange:m,lineAnnotations:r,forceRender:(u??n)||l||c||a,...i})}finalizeRender(){if(this.getRenderedFile()!==this.pendingRender?.file)throw Error(`VirtualizedFile.render: rendered a different file than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestFile(e)??e,r=this.getRenderedFile(),i=this.pendingRender?.file??r,a=this.fileRenderer.getFileForNextRender(n);return this.pendingRender={latestFile:n,file:a},{pendingRenderFile:a,annotationsChanged:this.syncLineAnnotations(t),layoutFileChanged:!$(i,a),renderedFileChanged:!$(r,a)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}addLayoutCheckpoint(e,t){e%Z_===0&&this.cache.checkpoints.push({lineIndex:e,top:t})}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFile: invalid checkpoint index`);if(n.lineIndex%t===0)return n}}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1}=this.options,{hunkLineCount:a,lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(e),c=this.height,l=xm(this.metrics,i),u=s>0?Cm(this.metrics):0,{fileAnnotationHeight:d}=this.cache,f=l+d,p=Math.max(0,c-l-d-u),m=dg(this.getLatestAnnotations()),h=t+l,g=d>0&&m&&h<r&&h+d>n;if(t<n-c||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};if(s<=a)return{startingLine:0,totalLines:a,bufferBefore:0,bufferAfter:0};let _=Math.ceil(Math.max(r-n,0)/o),v=Math.ceil(_/a)*a+a,y=v/a,b=(n+r)/2;if(this.hasUniformLineHeights()){let e=t+f,i=e+p;if(!g&&!(e<r&&i>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};let m=Math.floor(g&&b<t+f?0:(b-(t+f))/o),h=Math.floor(m/a)-Math.floor(y/2),_=Math.ceil(s/a),x=Math.max(0,Math.min(h,_))*a,S=h<0?v+h*a:v,C=x===0?0:d+x*o,w=Math.min(S,s-x);return{startingLine:x,totalLines:S,bufferBefore:C,bufferAfter:Math.max(0,(s-x-w)*o)}}let x=y,S=[],C=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-v*o*2),a),w=t+(C?.top??f),T=C?.lineIndex??0,E,ee,te,ne=C?.lineIndex??0;for(let e=ne;e<s;e++){let i=T%a===0,o=Math.floor(T/a);if(i&&(S[o]=w-(t+f),te!=null)){if(te<=0)break;te--}let s=this.getLineHeight(e,!1);w>n-s&&w<r&&(E??=o),w+s>b&&(ee??=o),te==null&&w>=r&&i&&(te=x),T++,w+=s}if(E==null){if(g)E=0,ee=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u}}ee??=E;let re=Math.round(ee-y/2),ie=Math.max(0,Math.ceil(s/a)-y),ae=Math.max(0,Math.min(re,ie)),oe=ae*a,se=re<0?v+re*a:v,ce=S[ae]??0,le=oe===0?0:d+ce,ue=ae+se/a,de=ue<S.length?p-S[ue]:p-(w-t-f);return{startingLine:oe,totalLines:se,bufferBefore:le,bufferAfter:Math.max(0,de)}}};function nv(e){let t;for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===ug&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}function rv(e,t){return typeof window>`u`&&t!=null?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,j.jsx)(j.Fragment,{children:e})}function iv(e,t){return e==null||t==null?e===t:e.top===t.top&&e.bottom===t.bottom}var av=1e3,ov=av*4,sv=[0,1e-6,.99999,1],cv={overscrollSize:av,intersectionObserverMargin:ov,resizeDebugging:!1},lv=0,uv=-1,dv=class e{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++uv}`;config;type=`simple`;intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;reconcileQueue=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...cv,...e}}setup(t,n){if(this.root==null){this.root=t,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:sv,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),t instanceof Document?this.setupWindow():this.setupElement(n),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:e.__lastScrollPosition}),Q(this.computeRenderRangeAndEmit)):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)};for(let[e,t]of this.connectQueue.entries())this.connect(e,t);this.connectQueue.clear(),this.markDOMDirty(),Q(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),Q(this.computeRenderRangeAndEmit)}requestHeightReconcile(e){this.reconcileQueue.add(e),Q(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=cg({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}getRoot(){return this.root}isInstanceVisible(e,t){let n=this.getScrollTop(),r=this.getHeight(),i=this.config.intersectionObserverMargin,a=n-i,o=n+r+i;return!(e<a-t||e>o)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(let n of e){let e=n.borderBoxSize[0].blockSize;this.root instanceof Document?e!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log(`Virtualizer: content size change`,this.__id,{sizeChange:e-lv,newSize:e}),lv=e)):n.target===this.root?e!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log(`Virtualizer: scroller size change`,this.__id,{sizeChange:e-lv,newSize:e}),lv=e))}t&&Q(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw Error(`Virtualizer.setupWindow: Invalid setup method`);window.addEventListener(`scroll`,this.handleWindowScroll,{passive:!0}),window.addEventListener(`resize`,this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw Error(`Virtualizer.setupElement: Invalid setup method`);this.root.addEventListener(`scroll`,this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){ag(this.computeRenderRangeAndEmit),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleElementScroll),window.removeEventListener(`scroll`,this.handleWindowScroll),window.removeEventListener(`resize`,this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.reconcileQueue.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.scrollHeightDirty=!0}getOffsetInScrollContainer(e){return this.getScrollTop()+fv(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw Error(`Virtualizer.connect: instance is already connected...`);return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),Q(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){let t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.instancesChanged.delete(t),this.reconcileQueue.delete(t),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),Q(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{e.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,Q(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{!e.__STOP&&this.root!=null&&this.root instanceof Document&&(this.scrollDirty=!0,Q(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{e.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,Q(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(e.__STOP)return;let t=this.heightDirty||this.scrollHeightDirty,n=this.instancesChanged.size>0;if(this.instancesChanged.size===0){let e=cg({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!t&&iv(this.windowSpecs,e)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.reconcileQueue.size===0)return;this.windowSpecs=e}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;let r=this.getScrollAnchor(this.height),i=new Set;for(let e of t?this.observers.values():this.visibleInstances.values())e.onRender(t)&&i.add(e);for(let e of this.instancesChanged)i.has(e)||e.onRender(t)&&i.add(e);this.scrollFix(r);for(let e of i)this.reconcileQueue.delete(e),e.reconcileHeights();for(let e of this.reconcileQueue)e.reconcileHeights()&&(n=!0);this.reconcileQueue.clear(),n||=this.instancesChanged.size>0,n&&this.markDOMDirty(),(n||t)&&Q(this.computeRenderRangeAndEmit),i.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;let t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:r,fileElement:i,fileOffset:a,fileTypeOffset:o}=e;if(n!=null&&r!=null){let e=i.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(e instanceof HTMLElement){let n=fv(e,t);if(n!==r){let e=n-r;this.applyScrollFix(e)}return}}let s=fv(i,t);if(o===`top`)s!==a&&this.applyScrollFix(s-a);else{let e=s+i.getBoundingClientRect().height;e!==a&&this.applyScrollFix(e-a)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:`instant`}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:`instant`}),this.markDOMDirty()}getScrollAnchor(e){let t=this.getScrollContainerElement(),n;for(let[r]of this.visibleInstances.entries()){let i=fv(r,t),a=i+r.offsetHeight,o,s;a<=0?(o=a,s=`bottom`):(o=i,s=`top`);let c,l;if(a>0&&i<e)for(let e of r.shadowRoot?.querySelectorAll(`[data-line][data-line-index]`)??[]){if(!(e instanceof HTMLElement))continue;let n=e.dataset.lineIndex;if(n==null)continue;let r=fv(e,t);if(!(r<0)){c=n,l=r;break}}if(n?.lineOffset!=null&&l==null)continue;let u=!1;(n==null||l!=null&&(n.lineOffset==null||l<n.lineOffset)||l==null&&n.lineOffset==null&&(o>=0&&(n.fileOffset<0||o<n.fileOffset)||o<0&&n.fileOffset<0&&o>n.fileOffset))&&(u=!0),u&&(n={fileElement:r,fileTypeOffset:s,fileOffset:o,lineIndex:c,lineOffset:l})}return n}handleIntersectionChange=e=>{this.scrollDirty=!0;for(let{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw Error(`Virtualizer.handleIntersectionChange: target not an HTMLElement`);let e=this.observers.get(t);e!=null&&(n&&!this.visibleInstances.has(t)?(e.setVisibility(!0),this.visibleInstances.set(t,e),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(e.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&Q(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=this.clampScrollTop(e),this.scrollTop=e,e}scrollTo({top:e,behavior:t=`auto`}){let{root:n}=this;if(n==null)return;let r=this.clampScrollTop(e);n instanceof Document?window.scrollTo({top:r,behavior:t}):n.scrollTo({top:r,behavior:t}),this.scrollDirty=!0,Q(this.computeRenderRangeAndEmit)}clampScrollTop(e){return Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight()))}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function fv(e,t){let n=e.getBoundingClientRect(),r=t?.getBoundingClientRect().top??0;return n.top-r}var pv=(0,k.createContext)(void 0);function mv({children:e,config:t,className:n,style:r,contentClassName:i,contentStyle:a}){let[o]=(0,k.useState)(()=>typeof window<`u`?new dv(t):void 0),s=(0,k.useCallback)(e=>{e==null?o?.cleanUp():o?.setup(e)},[o]);return(0,j.jsx)(pv.Provider,{value:o,children:(0,j.jsx)(`div`,{className:n,style:r,ref:s,children:(0,j.jsx)(`div`,{className:i,style:a,children:e})})})}function hv(){return(0,k.useContext)(pv)}var gv=typeof window>`u`?k.useEffect:k.useLayoutEffect;function _v({file:e,options:t,editorOptions:n,editStateKey:r,lineAnnotations:i,selectedLines:a,prerenderedHTML:o,metrics:s,hasGutterRenderUtility:c,hasCustomHeader:l,disableWorkerPool:u,edit:d,onEditChange:f,onEditComplete:p}){let m=hv(),h=a!==void 0,g=(0,k.useContext)(Zh),_=un(),v=sn(e=>f?.(e)),y=f==null?void 0:v,b=(0,k.useRef)(null),x=sn(e=>{let t=p?.(e)??`reject`;return t===`accept`&&(b.current={file:{installed:e.file,stale:e.originalFile},annotations:{installed:e.lineAnnotations,stale:e.originalLineAnnotations}}),t}),S=p==null?void 0:x,C=(0,k.useRef)(null),w=(0,k.useRef)(null),T=sn(()=>{if(_==null)throw Error(`File: EditContext is not attached`);return _(`file`,n??{},r)}),E=sn(n=>{if(n!=null){if(C.current!=null)throw Error(`File: An instance should not already exist when a node is created`);m==null?C.current=new J_(yv({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),u?void 0:g,!0):C.current=new tv(yv({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),m,s,u?void 0:g,!0),d&&w.current==null&&(w.current=bv(C.current,T)),C.current.hydrate({file:e,fileContainer:n,lineAnnotations:i,prerenderedHTML:o})}else{if(C.current==null)throw Error(`File: A File instance should exist when unmounting`);C.current.cleanUp(),C.current=null,w.current=null}});return gv(()=>{let{current:n}=C;if(n==null)return;let r=yv({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),o=r!==void 0&&!tg(n.options,r);if(n.setOptions(r),!d&&w.current!=null){let{current:e}=w;w.current=null,e()}let s=vv(e,i,b);n.render({file:s.file,lineAnnotations:s.lineAnnotations,forceRender:o}),a!==void 0&&n.setSelectedLines(a),d&&w.current==null&&(w.current=bv(n,T))}),{ref:E,getHoveredLine:(0,k.useCallback)(()=>C.current?.getHoveredLine(),[]),getAnnotationSlotName:(0,k.useCallback)(e=>C.current?.getAnnotationSlotName(e)??Hn(e),[])}}function vv(e,t,n){let{current:r}=n;if(r==null)return{file:e,lineAnnotations:t};let{file:i,annotations:a}=r,o=e;i!=null&&($(e,i.stale)?o=i.installed:r.file=null);let s=t;return a!=null&&(t===a.stale?s=a.installed:r.annotations=null),r.file==null&&r.annotations==null&&(n.current=null),{file:o,lineAnnotations:s}}function yv({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return t||r||n||i!=null||a!=null?{...e,controlledSelection:t,renderCustomHeader:n?pn:e?.renderCustomHeader,renderGutterUtility:r?pn:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}:e}function bv(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function xv({file:e,lineAnnotations:t,selectedLines:n,options:r,editorOptions:i,editStateKey:a,metrics:o,className:s,style:c,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,prerenderedHTML:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1,onEditChange:v,onEditComplete:y}){let{ref:b,getHoveredLine:x,getAnnotationSlotName:S}=_v({file:e,options:r,editorOptions:i,editStateKey:a,metrics:o,lineAnnotations:t,selectedLines:n,prerenderedHTML:m,hasGutterRenderUtility:h!=null,hasCustomHeader:u!=null,disableWorkerPool:g,edit:_,onEditChange:v,onEditComplete:y}),C=Gn({file:e,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderGutterUtility:h,lineAnnotations:t,getHoveredLine:x,getAnnotationSlotName:S});return(0,j.jsx)(mn,{ref:b,className:s,style:c,children:rv(C,m)})}var Sv={light:`pierre-light`,dark:`pierre-dark`},Cv=`
1514
+ }`}function U_(e,t){let n=L_(t);return e.replace(B_,n)}function W_(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var G_=new WeakMap;function K_(e){return G_.get(e)??e}function q_(e,t){G_.set(e,t)}function J_(e,t,n){let r=new Map;for(let i of e){let e=K_(i);r.set(e,n?.slotNames.get(e)??t(i))}return{provided:e,current:e,slotNames:r}}function Y_(e,t,n){for(let r of t){let t=K_(r);e.slotNames.has(t)||e.slotNames.set(t,n(r))}e.provided=t,e.current=t}function X_(e,t,n){if(e==null)return n(t);let r=K_(t),i=e.slotNames.get(r);return i??(i=n(t),e.slotNames.set(r,i)),i}function Z_(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function Q_(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:Z_(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function $_({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function ev(e,t){let n=e?.offsetHeight??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}function tv({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=nv(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function nv(){let e=document.createElement(`style`);return e.setAttribute(Kn,``),e}var rv=void 0,iv=void 0;function av(){return rv??=/macOS|MacIntel|iPhone|iPad|iPod/i.test(sv())}function ov(){return iv??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function sv(){let e=globalThis.navigator;return e?.platform??e?.userAgentData?.platform??`unknown`}function cv(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function lv(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}if(typeof HTMLElement<`u`&&customElements.get(`diffs-container`)==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync(R_)),t.adoptedStyleSheets=[e]}connectedCallback(){I_(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(Mn,t)}var uv=[``];function dv(e){let t={...e};return delete t.cacheKey,t}var fv=-1,pv=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++fv}`;type=`file`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;editSession;renderedFile;renderRange;enabled=!0;editor;constructor(e={theme:Gn},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new T_(e,this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager),this.resizeManager=new r_,this.interactionManager=new Ig(`file`,Lg(e)),this.workerManager?.subscribeToThemeChanges(this)}getAnnotationSlotName=e=>X_(this.editSession?.annotations,e,or);handleHighlightRender=()=>{this.rerender()};rerender(){this.enabled&&this.file!=null&&this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}getTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??Gn}getLatestFile(e=this.file){return this.editSession?.file??e}getRenderedFile(){return this.renderedFile}getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.lineAnnotations?!1:t==null||e!==t.provided&&e!==t.current}updateExternalFile(e,t){if(Q(this.file,e))return!1;let n=this.editSession!=null;return this.file=e,n||this.editor!=null?this.installEditSession(e,n?void 0:this.editor?.__getDocumentContents(e),!0):this.editSession=void 0,this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=J_(t,or,this.editSession.annotations)),!0}installEditSession(e,t,n=!1){let r=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===e.contents,i=dv(t??e);this.editSession={file:i,externalReplacement:n&&r,annotations:this.editSession?.annotations??J_(this.lineAnnotations,or)},this.fileRenderer.beginEditSession(i,r?e:void 0)}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Lg(this.options))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!qp(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){let t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,Y_(t,e,or))}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.fileRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}getCodeScrollLeft(){return this.code?.scrollLeft??0}setCodeScrollLeft(e){this.code!=null&&(this.code.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.fileRenderer.getEffectiveCodeOptions()}}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:e===`wrap`,columnVariables:this.shouldApplyColumnVariables(e)?`apply`:`measure`}),this.managersDirty=!1}shouldApplyColumnVariables(e){return e===`scroll`&&this.getLatestAnnotations().length>0}cleanUp(e=!1){let t=this.editor;this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.pre=void 0,this.code=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0,this.editSession=void 0,this.renderedFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;if(!this.enabled)throw Error(`File.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`File.hydrate: hydrate can only be called before the instance has rendered or hydrated`);this.hydrateElements(t,n);let o=this.editor!=null;o||mv(this.pre,i,this.options.collapsed)||hv(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,forceRender:o||e.forceRender,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),cv(e,t);for(let t of Array.from(e.shadowRoot?.children??[])){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t,this.appliedPreAttributes=void 0;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}if(`diffsHeader`in t.dataset){this.headerElement=t,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(Q_(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderedFile=e,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.getLatestFile()){return e==null?uv:this.fileRenderer.getOrCreateLineCache(e)}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}syncRenderViewToEditor(){let{editor:e,fileContainer:t,renderRange:n}=this,r=this.getLatestAnnotations(),i=this.getLatestFile();if(e==null||t==null||i==null)return;let a=a=>{this.enabled&&this.editor===e&&this.fileContainer===t&&this.getLatestFile()===i&&e.__syncRenderView({highlighter:a,fileContainer:t,file:i,lineAnnotations:r,renderRange:n,externalDocument:this.editSession?.externalReplacement===!0})},o=this.getTheme(),s=i.lang??J(i.name),c=Wp({theme:o,lang:s});c==null?Hp({themes:hr(o),langs:Array.from(new Set([`text`,s])),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(a):a(c)}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.externalReplacement=!1)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(){}__attachEditor(e){if(this.editor!=null)throw Error(`File.__attachEditor: an editor is already attached`);this.editor=e;let t=()=>{this.editor=void 0,this.fileRenderer.endEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`File.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){this.editSession==null?this.file!=null&&this.installEditSession(this.file,e.__getDocumentContents(this.file)):this.fileRenderer.beginEditSession(this.editSession.file);let t=this.editSession?.file;this.fileRenderer.editorRenderReady()?(this.fileRenderer.fileCache===t&&(this.renderedFile=t),this.syncRenderViewToEditor()):this.rerender()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n,file:r,lineAnnotations:i}=this;if(n==null||r==null)return;let{file:a,annotations:o}=n;if(this.editor!=null)throw Error(`File.__completeEditSession: detach the editor before completing the session`);let s=o?.current,c,l=!1,u;if(t==null)throw Error(`File.__completeEditSession: editor is required for completion`);let d={...a},f={file:d,editor:t,originalFile:r,lineAnnotations:s,originalLineAnnotations:i};Object.freeze(f);try{if(t.__emitEditComplete(f),this.options.onEditComplete?.(f)===`accept`){if(d.cacheKey!=null&&d.cacheKey===r.cacheKey)throw Error(`File.__completeEditSession: an accepted file must not reuse the replaced file cacheKey`);c=d}}catch(e){l=!0,u=e}e&&c!=null&&(this.file=c,s!=null&&(this.lineAnnotations=s)),this.editSession=void 0;let{renderedFile:p,file:m}=this;if(this.fileRenderer.endEditSession(m),p!=null&&m!=null&&p!==m&&Q(p,m)&&(this.renderedFile=m),e&&this.fileContainer!=null&&this.rerender(),l)throw u}applyDocumentChange(e,t){let n=this.editSession?.file;if(n==null)throw Error(`File.applyDocumentChange: requires an active edit session`);this.fileRenderer.beginEditSession(n),this.fileRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}updateRenderCache(e,t,n){let r=this.editSession?.file;if(r==null)throw Error(`File.updateRenderCache: requires an active edit session`);this.fileRenderer.beginEditSession(r),this.fileRenderer.updateRenderCache(e,t,n?.lineCountChangeInFlight)}render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:c=!1,themeType:l=`system`}=this.options,u=c?void 0:s,d=this.renderRange,f=this.hasThemeChanged(),p=o!=null&&(o.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(o),m=!Q(this.file,e);m&&this.updateExternalFile(e,o);let h=this.getLatestFile(e)??e;if(!c&&!n&&d_(u,this.renderRange)&&!m&&!p&&!f){let e=this.applyCachedThemeState(l);return e&&this.finalizeRender(),e}this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.fileRenderer.setOptions(Q_(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),this.fileRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:g=!1,disableFileHeader:_=!1}=this.options;if(_&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.fileRenderer.renderFile(h,ar);e!=null&&this.applyThemeState(t,e.themeStyles,l,e.baseThemeType),e?.headerAST!=null&&this.applyHeaderToDOM(e.headerAST,t,e.file),this.renderedFile=e?.file??h,this.injectUnsafeCSS()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f||!Q(this.renderedFile,h))||!this.applyPartialRender(h,d,u)){let n=this.fileRenderer.renderFile(h,u);if(n==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t,n.file),this.applyFullRender(n,e),this.renderedFile=n.file}this.applyBuffers(e,u),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,a||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.file){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||tm(e))return;let n=this.options.tokenizeMaxLength??1e5;this.fileRenderer.getOrCreateLineCache(e).length>n||await t.primeFileHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,n=this.getLatestAnnotations();if(t!=null&&n.length>0)for(let[r,i]of n.entries()){let n=this.getAnnotationSlotName(i),a=`${r}-${n}`,o=this.annotationCache.get(a);if(o==null||!O_(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:M_(n),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(a,o)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=N_();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=P_(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=V_(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=I_(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=tv({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:H_(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=U_(this.themeCSSStyle.textContent??``,I_(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&ov()}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e);let n=this.code=$_({code:this.code}),r=this.fileRenderer.renderCodeAST(e);this.editor?.__captureFocusForDOMReplacement();let i=()=>{if(n.childElementCount>=2)for(let e=0;e<2;e++){let t=n.children[e],i=r[e];t.innerHTML=Ic(i.children),t.style.cssText=i.properties.style}else n.innerHTML=Ic(r);t.contains(n)||t.replaceChildren(n)};this.shouldGuardRebuildScroll()?ev(t,i):i(),this.lastRowCount=e.rowCount}applyPartialRender(e,t,n){if(t==null||n==null)return!1;let{code:r}=this,i=r==null?void 0:this.getColumns(r);if(r==null||i==null)return!1;let a=t.startingLine,o=n.startingLine,s=t.totalLines===1/0?1/0:a+t.totalLines,c=n.totalLines===1/0?1/0:o+n.totalLines,l=Math.max(a,o),u=Math.min(s,c);if(u<=l)return!1;if(!this.trimDOMToOverlap(i.gutter,l,u)||!this.trimDOMToOverlap(i.content,l,u))throw Error(`File.applyPartialRender: failed to trim to overlap`);let{length:d}=i.content.children,f=(t,n)=>{if(!(n<=0))return this.fileRenderer.renderFile(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},p=o<l?f(o,l-o):void 0;if(p===void 0&&o<l)return!1;let m=c===1/0?1/0:Math.max(0,c-u),h=c>u?f(u,m):void 0;return h===void 0&&c>u?!1:(this.cleanupErrorWrapper(),p!=null&&(i.gutter.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.gutterAST)),i.content.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.contentAST)),d+=p.rowCount),h!=null&&(i.gutter.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.gutterAST)),i.content.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.contentAST)),d+=h.rowCount),this.lastRowCount!==d&&(i.gutter.style.setProperty(`grid-row`,`span ${d}`),i.content.style.setProperty(`grid-row`,`span ${d}`),this.lastRowCount=d),!0)}getColumns(e){let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&t.dataset.gutter!=null&&n.dataset.content!=null)return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){let r=this.getDOMBoundaryIndices(e,[t,n]),i=r.get(t)??e.children.length,a=r.get(n)??e.children.length;if(i>a)return!1;for(let t=e.children.length-1;t>=a;--t)e.children[t]?.remove();for(let t=i-1;t>=0;--t)e.children[t]?.remove();return!0}getDOMBoundaryIndices(e,t){let n=[...new Set(t)].sort((e,t)=>e-t),r=new Map;if(n.length===0)return r;let i=0,a=n[i],{children:o}=e;a===0&&(r.set(0,0),i+=1,a=n[i]);for(let e=0;e<o.length;e+=1){let t=o[e];if(!(t instanceof HTMLElement))continue;let s=this.getLineIndexFromDOMNode(t);if(s!=null){for(;a!=null&&s>=a;)r.set(a,e),i+=1,a=n[i];if(i>=n.length)break}}for(let e of n)r.has(e)||r.set(e,o.length);return r}getLineIndexFromDOMNode(e){let t=e.dataset.lineIndex;if(t==null)return;let n=Number(t);return Number.isNaN(n)?void 0:n}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??Ic(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged)return;let{renderHeaderPrefix:i,renderHeaderFilenameSuffix:a,renderCustomHeader:o,renderHeaderMetadata:s}=this.options;if(o!=null){let e=o(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Wn,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{let e=i?.(n)??void 0,r=a?.(n)??void 0,o=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Vn,e),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Hn,r),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Un,o),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}getOrCreateFileContainerNode(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:Og(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):Og(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=D_;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};k_(i,this.appliedPreAttributes)||(lv(e,i),this.appliedPreAttributes=i)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function mv(e,t,n=!1){return!n&&e==null&&t!=null}function hv(e,t,n=!1){return e==null&&t!=null&&!n}var gv=5e3,_v=new Map,vv=-1;function yv(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS}var bv=class extends pv{virtualizer;metrics;__id=`virtualized-file:${++vv}`;renderType=`virtualized`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0,ghostTextRows:_v};pendingRender;isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=$n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){let n=zm(e);(t||!yg(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache())}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache()}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.resetLayoutCache(),!0):!1}hasLineAnnotations(){return this.getLatestAnnotations().some(e=>e.lineNumber>0)}hasUniformLineHeights(){let{overflow:e=`scroll`}=this.options;return e===`scroll`&&!this.hasLineAnnotations()&&this.cache.heights.size===0}getLineHeight(e,t=!1){let n=this.cache.heights.get(e);if(n!=null)return n;let r=t?2:1;return this.metrics.lineHeight*r}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!bg(t,e),r=yv(t,e);super.setOptions(e),r&&this.resetLayoutCache(!0),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache(e=!1,t=!0){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.ghostTextRows=_v,this.renderRange!=null&&t&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}applyGhostTextRows(e){let{heights:t,ghostTextRows:n}=this.cache;if(n===e)return!1;let{lineHeight:r}=this.metrics,i=!1;for(let a of new Set([...n.keys(),...e.keys()])){let o=n.get(a)??0,s=e.get(a)??0;if(s===o)continue;let c=(t.get(a)??r)-o*r+s*r;c===r?t.delete(a):t.set(a,c),i=!0}return this.cache.ghostTextRows=e,i}reconcileHeights(){let e=!1;if(this.fileContainer==null||this.getLayoutFile()==null)return this.height!==0&&(e=!0),this.height=0,e;let{overflow:t=`scroll`}=this.options;this.top=this.getVirtualizedTop();let n=this.editor?.__getGhostTextRows()??_v;if(e=this.applyGhostTextRows(n),t===`scroll`&&this.getLatestAnnotations().length===0&&!this.isResizeDebuggingEnabled())return e&&this.computeApproximateSize(!0),e;let{lineHeight:r}=this.metrics;if(this.code==null)return e;let i=this.code.children[1];if(!(i instanceof HTMLElement))return e;let a=Ag(this.getLatestAnnotations());if(this.renderRange!=null&&a&&Mg(this.renderRange)){let t=xv(i)??0;t!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=t,e=!0)}else!a&&this.cache.fileAnnotationHeight!==0&&(this.cache.fileAnnotationHeight=0,e=!0);for(let t of i.children){if(!(t instanceof HTMLElement))continue;let i=t.dataset.lineIndex;if(i==null)continue;let a=Number(i),o=t.getBoundingClientRect().height+(n.get(a)??0)*r,s=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(s=!0),o+=t.nextElementSibling.getBoundingClientRect().height);let c=this.getLineHeight(a,s);o!==c&&(e=!0,o===this.metrics.lineHeight*(s?2:1)?this.cache.heights.delete(a):this.cache.heights.set(a,o))}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null||this.file==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render({file:this.file}));updateCodeViewLayout(e,t,n,r){let i=!Q(this.file,e);i&&this.updateExternalFile(e,r);let{pendingRenderFile:a,layoutFileChanged:o,renderedFileChanged:s,annotationsChanged:c}=this.updatePendingRender(e,r),l=n?.resetFileLayoutCache===!0||o||c;n?.metrics!=null&&(this.metrics=n.metrics,l=!0);let{collapsed:u=!1}=this.options;return this.currentCollapsed!==u&&(this.currentCollapsed=u,l=!0),l&&this.resetLayoutCache(),i&&(this.layoutDirty=!0),!this.forceRenderOverride&&(i||s||c)&&(this.forceRenderOverride=!0),this.top=t,this.computeApproximateSize(!1,a),this.height}getLayoutFile(){return this.pendingRender?.file??this.getRenderedFile()}getLinePosition(e){let t=this.getLayoutFile();if(t==null||e<1)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options,i=this.fileRenderer.getLineCount(t)-1,a=Bm(this.metrics,n);if(r||i<0)return{top:a,height:0};let o=Math.min(Math.max(e-1,0),i),{lineHeight:s}=this.metrics;if(a+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())return{top:a+o*s,height:s};let c=this.getLayoutCheckpointBeforeLineIndex(o);a=c?.top??a;for(let e=c?.lineIndex??0;e<o;e++)a+=this.getLineHeight(e,!1);return{top:a,height:this.getLineHeight(o,!1)}}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutFile();if(t==null||this.renderRange==null)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options;if(r||this.renderRange.totalLines<=0)return;let i=this.fileRenderer.getLineCount(t)-1;if(i<0)return;let a=Bm(this.metrics,n),o=Math.min(this.renderRange.startingLine,i),s=Math.min(o+this.renderRange.totalLines-1,i);if(s<o)return;let{fileAnnotationHeight:c}=this.cache;if(this.hasUniformLineHeights()){let{lineHeight:t}=this.metrics,n=a+(o===0?c:this.renderRange.bufferBefore),r=o+Math.max(Math.ceil((e-n)/t),0);return r>s?void 0:{lineNumber:r+1,top:a+c+r*t}}let l=a+(o===0?c:this.renderRange.bufferBefore);for(let t=o;t<=s;t++){if(l>=e)return{lineNumber:t+1,top:l};l+=this.getLineHeight(t)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutFile();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!Q(this.getRenderedFile(),this.getLatestFile()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache(),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutFile()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(this.editor?.__getGhostTextRows()??_v);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,{lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(t),c=Bm(this.metrics,i),l=Hm(this.metrics);if(this.height+=c,a){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())this.height+=s*o;else for(let e=0;e<s;e++)this.addLayoutCheckpoint(e,this.height),this.height+=this.getLineHeight(e,!1);if(s>0&&(this.height+=l),this.fileContainer!=null&&n&&!r){let e=this.fileContainer.getBoundingClientRect();e.height===this.height?console.log(`VirtualizedFile.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFile.computeApproximateSize: computed height doesnt match`,{name:t.name,elementHeight:e.height,computedHeight:this.height})}this.layoutDirty=!1}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.file==null)return;let e=this.getLatestFile(),t=e==null?void 0:this.fileRenderer.getFileForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!Q(this.getRenderedFile(),t))}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(this.isSimpleMode(),!1);let i=this.getRenderedFile();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&i!=null){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(i,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}render({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:r,...i}){let a=!Q(this.file,t);a&&(this.updateExternalFile(t,r),this.cachedHeaderHTML=void 0);let{pendingRenderFile:o,layoutFileChanged:s,renderedFileChanged:c,annotationsChanged:l}=this.pendingRender!=null&&this.pendingRender.latestFile===(this.getLatestFile(t)??t)?{pendingRenderFile:this.pendingRender.file,layoutFileChanged:!1,renderedFileChanged:!1,annotationsChanged:!1}:this.updatePendingRender(t,r),{forceRenderOverride:u,isSetup:d}=this;if(this.forceRenderOverride=void 0,(l||s)&&this.resetLayoutCache(),e=this.getOrCreateFileContainerNode(e),d)this.top??=this.getVirtualizedTop(),s&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(!1),this.computeApproximateSize(!1,o));else{this.computeApproximateSize(!1,o);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFile.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!a||!d))return this.pendingRender=void 0,this.renderPlaceholder(this.height);let f=this.virtualizer.getWindowSpecs(),p=this.top??0,m=this.computeRenderRangeFromWindow(o,p,f);return super.render({file:t,fileContainer:e,renderRange:m,lineAnnotations:r,forceRender:(u??n)||l||c||a,...i})}finalizeRender(){if(this.getRenderedFile()!==this.pendingRender?.file)throw Error(`VirtualizedFile.render: rendered a different file than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestFile(e)??e,r=this.getRenderedFile(),i=this.pendingRender?.file??r,a=this.fileRenderer.getFileForNextRender(n);return this.pendingRender={latestFile:n,file:a},{pendingRenderFile:a,annotationsChanged:this.syncLineAnnotations(t),layoutFileChanged:!Q(i,a),renderedFileChanged:!Q(r,a)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}addLayoutCheckpoint(e,t){e%gv===0&&this.cache.checkpoints.push({lineIndex:e,top:t})}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFile: invalid checkpoint index`);if(n.lineIndex%t===0)return n}}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1}=this.options,{hunkLineCount:a,lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(e),c=this.height,l=Bm(this.metrics,i),u=s>0?Hm(this.metrics):0,{fileAnnotationHeight:d}=this.cache,f=l+d,p=Math.max(0,c-l-d-u),m=Ag(this.getLatestAnnotations()),h=t+l,g=d>0&&m&&h<r&&h+d>n;if(t<n-c||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};if(s<=a)return{startingLine:0,totalLines:a,bufferBefore:0,bufferAfter:0};let _=Math.ceil(Math.max(r-n,0)/o),v=Math.ceil(_/a)*a+a,y=v/a,b=(n+r)/2;if(this.hasUniformLineHeights()){let e=t+f,i=e+p;if(!g&&!(e<r&&i>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};let m=Math.floor(g&&b<t+f?0:(b-(t+f))/o),h=Math.floor(m/a)-Math.floor(y/2),_=Math.ceil(s/a),x=Math.max(0,Math.min(h,_))*a,S=h<0?v+h*a:v,C=x===0?0:d+x*o,w=Math.min(S,s-x);return{startingLine:x,totalLines:S,bufferBefore:C,bufferAfter:Math.max(0,(s-x-w)*o)}}let x=y,S=[],C=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-v*o*2),a),w=t+(C?.top??f),T=C?.lineIndex??0,E,ee,te,ne=C?.lineIndex??0;for(let e=ne;e<s;e++){let i=T%a===0,o=Math.floor(T/a);if(i&&(S[o]=w-(t+f),te!=null)){if(te<=0)break;te--}let s=this.getLineHeight(e,!1);w>n-s&&w<r&&(E??=o),w+s>b&&(ee??=o),te==null&&w>=r&&i&&(te=x),T++,w+=s}if(E==null){if(g)E=0,ee=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u}}ee??=E;let re=Math.round(ee-y/2),D=Math.max(0,Math.ceil(s/a)-y),ie=Math.max(0,Math.min(re,D)),ae=ie*a,oe=re<0?v+re*a:v,se=S[ie]??0,ce=ae===0?0:d+se,le=ie+oe/a,ue=le<S.length?p-S[le]:p-(w-t-f);return{startingLine:ae,totalLines:oe,bufferBefore:ce,bufferAfter:Math.max(0,ue)}}};function xv(e){let t;for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===kg&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}function Sv(e,t){return typeof window>`u`&&t!=null?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,j.jsx)(j.Fragment,{children:e})}function Cv(e,t){return e==null||t==null?e===t:e.top===t.top&&e.bottom===t.bottom}var wv=1e3,Tv=wv*4,Ev=[0,1e-6,.99999,1],Dv={overscrollSize:wv,intersectionObserverMargin:Tv,resizeDebugging:!1},Ov=0,kv=-1,Av=class e{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++kv}`;config;type=`simple`;intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;reconcileQueue=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...Dv,...e}}setup(t,n){if(this.root==null){this.root=t,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Ev,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),t instanceof Document?this.setupWindow():this.setupElement(n),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:e.__lastScrollPosition}),Z(this.computeRenderRangeAndEmit)):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)};for(let[e,t]of this.connectQueue.entries())this.connect(e,t);this.connectQueue.clear(),this.markDOMDirty(),Z(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),Z(this.computeRenderRangeAndEmit)}requestHeightReconcile(e){this.reconcileQueue.add(e),Z(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=Dg({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}getRoot(){return this.root}isInstanceVisible(e,t){let n=this.getScrollTop(),r=this.getHeight(),i=this.config.intersectionObserverMargin,a=n-i,o=n+r+i;return!(e<a-t||e>o)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(let n of e){let e=n.borderBoxSize[0].blockSize;this.root instanceof Document?e!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log(`Virtualizer: content size change`,this.__id,{sizeChange:e-Ov,newSize:e}),Ov=e)):n.target===this.root?e!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log(`Virtualizer: scroller size change`,this.__id,{sizeChange:e-Ov,newSize:e}),Ov=e))}t&&Z(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw Error(`Virtualizer.setupWindow: Invalid setup method`);window.addEventListener(`scroll`,this.handleWindowScroll,{passive:!0}),window.addEventListener(`resize`,this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw Error(`Virtualizer.setupElement: Invalid setup method`);this.root.addEventListener(`scroll`,this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){wg(this.computeRenderRangeAndEmit),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleElementScroll),window.removeEventListener(`scroll`,this.handleWindowScroll),window.removeEventListener(`resize`,this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.reconcileQueue.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.scrollHeightDirty=!0}getOffsetInScrollContainer(e){return this.getScrollTop()+jv(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw Error(`Virtualizer.connect: instance is already connected...`);return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),Z(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){let t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.instancesChanged.delete(t),this.reconcileQueue.delete(t),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),Z(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{e.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,Z(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{!e.__STOP&&this.root!=null&&this.root instanceof Document&&(this.scrollDirty=!0,Z(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{e.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,Z(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(e.__STOP)return;let t=this.heightDirty||this.scrollHeightDirty,n=this.instancesChanged.size>0;if(this.instancesChanged.size===0){let e=Dg({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!t&&Cv(this.windowSpecs,e)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.reconcileQueue.size===0)return;this.windowSpecs=e}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;let r=this.getScrollAnchor(this.height),i=new Set;for(let e of t?this.observers.values():this.visibleInstances.values())e.onRender(t)&&i.add(e);for(let e of this.instancesChanged)i.has(e)||e.onRender(t)&&i.add(e);this.scrollFix(r);for(let e of i)this.reconcileQueue.delete(e),e.reconcileHeights();for(let e of this.reconcileQueue)e.reconcileHeights()&&(n=!0);this.reconcileQueue.clear(),n||=this.instancesChanged.size>0,n&&this.markDOMDirty(),(n||t)&&Z(this.computeRenderRangeAndEmit),i.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;let t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:r,fileElement:i,fileOffset:a,fileTypeOffset:o}=e;if(n!=null&&r!=null){let e=i.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(e instanceof HTMLElement){let n=jv(e,t);if(n!==r){let e=n-r;this.applyScrollFix(e)}return}}let s=jv(i,t);if(o===`top`)s!==a&&this.applyScrollFix(s-a);else{let e=s+i.getBoundingClientRect().height;e!==a&&this.applyScrollFix(e-a)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:`instant`}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:`instant`}),this.markDOMDirty()}getScrollAnchor(e){let t=this.getScrollContainerElement(),n;for(let[r]of this.visibleInstances.entries()){let i=jv(r,t),a=i+r.offsetHeight,o,s;a<=0?(o=a,s=`bottom`):(o=i,s=`top`);let c,l;if(a>0&&i<e)for(let e of r.shadowRoot?.querySelectorAll(`[data-line][data-line-index]`)??[]){if(!(e instanceof HTMLElement))continue;let n=e.dataset.lineIndex;if(n==null)continue;let r=jv(e,t);if(!(r<0)){c=n,l=r;break}}if(n?.lineOffset!=null&&l==null)continue;let u=!1;(n==null||l!=null&&(n.lineOffset==null||l<n.lineOffset)||l==null&&n.lineOffset==null&&(o>=0&&(n.fileOffset<0||o<n.fileOffset)||o<0&&n.fileOffset<0&&o>n.fileOffset))&&(u=!0),u&&(n={fileElement:r,fileTypeOffset:s,fileOffset:o,lineIndex:c,lineOffset:l})}return n}handleIntersectionChange=e=>{this.scrollDirty=!0;for(let{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw Error(`Virtualizer.handleIntersectionChange: target not an HTMLElement`);let e=this.observers.get(t);e!=null&&(n&&!this.visibleInstances.has(t)?(e.setVisibility(!0),this.visibleInstances.set(t,e),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(e.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&Z(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=this.clampScrollTop(e),this.scrollTop=e,e}scrollTo({top:e,behavior:t=`auto`}){let{root:n}=this;if(n==null)return;let r=this.clampScrollTop(e);n instanceof Document?window.scrollTo({top:r,behavior:t}):n.scrollTo({top:r,behavior:t}),this.scrollDirty=!0,Z(this.computeRenderRangeAndEmit)}clampScrollTop(e){return Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight()))}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function jv(e,t){let n=e.getBoundingClientRect(),r=t?.getBoundingClientRect().top??0;return n.top-r}var Mv=(0,A.createContext)(void 0);function Nv({children:e,config:t,className:n,style:r,contentClassName:i,contentStyle:a}){let[o]=(0,A.useState)(()=>typeof window<`u`?new Av(t):void 0),s=(0,A.useCallback)(e=>{e==null?o?.cleanUp():o?.setup(e)},[o]);return(0,j.jsx)(Mv.Provider,{value:o,children:(0,j.jsx)(`div`,{className:n,style:r,ref:s,children:(0,j.jsx)(`div`,{className:i,style:a,children:e})})})}function Pv(){return(0,A.useContext)(Mv)}var Fv=typeof window>`u`?A.useEffect:A.useLayoutEffect;function Iv({file:e,options:t,editorOptions:n,editStateKey:r,lineAnnotations:i,selectedLines:a,prerenderedHTML:o,metrics:s,hasGutterRenderUtility:c,hasCustomHeader:l,disableWorkerPool:u,edit:d,onEditChange:f,onEditComplete:p}){let m=Pv(),h=a!==void 0,g=(0,A.useContext)(gg),_=On(),v=Tn(e=>f?.(e)),y=f==null?void 0:v,b=(0,A.useRef)(null),x=Tn(e=>{let t=p?.(e)??`reject`;return t===`accept`&&(b.current={file:{installed:e.file,stale:e.originalFile},annotations:{installed:e.lineAnnotations,stale:e.originalLineAnnotations}}),t}),S=p==null?void 0:x,C=(0,A.useRef)(null),w=(0,A.useRef)(null),T=Tn(()=>{if(_==null)throw Error(`File: EditContext is not attached`);return _(`file`,n??{},r)}),E=Tn(n=>{if(n!=null){if(C.current!=null)throw Error(`File: An instance should not already exist when a node is created`);m==null?C.current=new pv(Rv({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),u?void 0:g,!0):C.current=new bv(Rv({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),m,s,u?void 0:g,!0),d&&w.current==null&&(w.current=zv(C.current,T)),C.current.hydrate({file:e,fileContainer:n,lineAnnotations:i,prerenderedHTML:o})}else{if(C.current==null)throw Error(`File: A File instance should exist when unmounting`);C.current.cleanUp(),C.current=null,w.current=null}});return Fv(()=>{let{current:n}=C;if(n==null)return;let r=Rv({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),o=r!==void 0&&!bg(n.options,r);if(n.setOptions(r),!d&&w.current!=null){let{current:e}=w;w.current=null,e()}let s=Lv(e,i,b);n.render({file:s.file,lineAnnotations:s.lineAnnotations,forceRender:o}),a!==void 0&&n.setSelectedLines(a),d&&w.current==null&&(w.current=zv(n,T))}),{ref:E,getHoveredLine:(0,A.useCallback)(()=>C.current?.getHoveredLine(),[]),getAnnotationSlotName:(0,A.useCallback)(e=>C.current?.getAnnotationSlotName(e)??or(e),[])}}function Lv(e,t,n){let{current:r}=n;if(r==null)return{file:e,lineAnnotations:t};let{file:i,annotations:a}=r,o=e;i!=null&&(Q(e,i.stale)?o=i.installed:r.file=null);let s=t;return a!=null&&(t===a.stale?s=a.installed:r.annotations=null),r.file==null&&r.annotations==null&&(n.current=null),{file:o,lineAnnotations:s}}function Rv({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return t||r||n||i!=null||a!=null?{...e,controlledSelection:t,renderCustomHeader:n?jn:e?.renderCustomHeader,renderGutterUtility:r?jn:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}:e}function zv(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function Bv({file:e,lineAnnotations:t,selectedLines:n,options:r,editorOptions:i,editStateKey:a,metrics:o,className:s,style:c,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,prerenderedHTML:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1,onEditChange:v,onEditComplete:y}){let{ref:b,getHoveredLine:x,getAnnotationSlotName:S}=Iv({file:e,options:r,editorOptions:i,editStateKey:a,metrics:o,lineAnnotations:t,selectedLines:n,prerenderedHTML:m,hasGutterRenderUtility:h!=null,hasCustomHeader:u!=null,disableWorkerPool:g,edit:_,onEditChange:v,onEditComplete:y}),C=lr({file:e,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderGutterUtility:h,lineAnnotations:t,getHoveredLine:x,getAnnotationSlotName:S});return(0,j.jsx)(Mn,{ref:b,className:s,style:c,children:Sv(C,m)})}var Vv={light:`pierre-light`,dark:`pierre-dark`},Hv=`
1515
1515
  @media (max-width: 720px) {
1516
1516
  [data-header-content] {
1517
1517
  flex: 1 1 auto;
@@ -1524,7 +1524,7 @@ XID_Start XIDS`.split(/\s/).map(e=>[td(e),e])),Kd=new Map([[`s`,K(383)],[K(383),
1524
1524
  overflow: hidden;
1525
1525
  }
1526
1526
  }
1527
- `,wv=`
1527
+ `,Uv=`
1528
1528
  :host {
1529
1529
  --diffs-light-bg: var(--card) !important;
1530
1530
  --diffs-dark-bg: var(--card) !important;
@@ -1534,7 +1534,7 @@ XID_Start XIDS`.split(/\s/).map(e=>[td(e),e])),Kd=new Map([[`s`,K(383)],[K(383),
1534
1534
  scrollbar-width: thin;
1535
1535
  scrollbar-color: var(--border) transparent;
1536
1536
  }
1537
- `;function Tv(e,t={}){return{theme:Sv,themeType:e,overflow:t.overflow??`scroll`,disableFileHeader:!0,unsafeCSS:wv}}var Ev=`
1537
+ `;function Wv(e,t={}){return{theme:Vv,themeType:e,overflow:t.overflow??`scroll`,disableFileHeader:!0,unsafeCSS:Uv}}var Gv=`
1538
1538
  [data-line-annotation] {
1539
1539
  margin-left: calc(-1 * var(--diffs-column-number-width, 0px));
1540
1540
  position: relative;
@@ -1565,4 +1565,4 @@ XID_Start XIDS`.split(/\s/).map(e=>[td(e),e])),Kd=new Map([[`s`,K(383)],[K(383),
1565
1565
  inset: -2px -8px;
1566
1566
  }
1567
1567
  [data-column-number][data-hovered] [data-line-number-content] { visibility: hidden; }
1568
- `;function Dv(e){let t=de;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,E);return t>>>1}var Ov=m();function kv(e){let t=(0,Ov.c)(9),n=p(e),i;t[0]===n?i=t[1]:(i=r(u(n)),t[0]=n,t[1]=i);let a;t[2]===i?a=t[3]:(a={includeFailure:!0,suspendOnWaiting:i},t[2]=i,t[3]=a);let l=o(e,a),d;t[4]===l?d=t[5]:(d=b(u(l),()=>{throw s(l)?c(l.cause):Error(`The read has no confirmed value`)}),t[4]=l,t[5]=d);let f=d,m;return t[6]!==l||t[7]!==f?(m={result:l,value:f},t[6]=l,t[7]=f,t[8]=m):m=t[8],m}var Av=be(``);function jv(){let e=(0,Ov.c)(2),t=i(Av),n;return e[0]===t?n=e[1]:(n={query:t,setQuery:Mv},e[0]=t,e[1]=n),n}function Mv(e){Av.set(e)}function Nv(e){return i(e.state)}var Pv=new WeakMap;function Fv(e,t,n,r){let i=Pv.get(e);i||(i=new Map,Pv.set(e,i));let a=i.get(t);return a||(a={file:{name:n,contents:r},initialText:r},i.set(t,a)),a}function Iv(e,t,n){let r=Pv.get(e);(!n||r?.get(t)===n)&&r?.delete(t)}var Lv=e=>e.replace(/\/$/,``);function Rv(e,t){let n=(0,Ov.c)(15),r;n[0]!==e||n[1]!==t?(r=Te({connection:e,scope:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i=r,a;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(a={mode:`promiseExit`},n[3]=a):a=n[3];let[o,s]=d(i,a),l,u,f,p;n[4]===s?(l=n[5],u=n[6],f=n[7],p=n[8]):(l=(e,t,n)=>s({kind:`create`,path:Lv(e),entryKind:t}).then(r=>{if(h(r))throw c(r.cause);t===`file`&&n(e)}),u=(e,t)=>s({kind:`move`,path:Lv(e),destination:Lv(t)}).then(zv),f=(e,t,n)=>{s({kind:`copy`,path:e,destination:t}).then(e=>{x(e)&&n(t)})},p=(e,t)=>{s({kind:`trash`,path:Lv(e)}).then(e=>{x(e)&&t()})},n[4]=s,n[5]=l,n[6]=u,n[7]=f,n[8]=p);let m;return n[9]!==o||n[10]!==l||n[11]!==u||n[12]!==f||n[13]!==p?(m={result:o,create:l,move:u,duplicate:f,trash:p},n[9]=o,n[10]=l,n[11]=u,n[12]=f,n[13]=p,n[14]=m):m=n[14],m}function zv(e){if(h(e))throw c(e.cause)}function Bv(e,t,n,r,i){let a=(0,Ov.c)(12),o;a[0]!==e||a[1]!==i||a[2]!==n||a[3]!==t||a[4]!==r?(o=ge({connection:e,scope:t,path:n,text:r,fingerprint:i}),a[0]=e,a[1]=i,a[2]=n,a[3]=t,a[4]=r,a[5]=o):o=a[5];let{value:s}=kv(o),c=Nv(s),l;a[6]===s?l=a[7]:(l=(e,t)=>{g(s.reset(e,t))},a[6]=s,a[7]=l);let u;return a[8]!==s||a[9]!==c||a[10]!==l?(u={draft:s,state:c,reset:l},a[8]=s,a[9]=c,a[10]=l,a[11]=u):u=a[11],u}function Vv(e,t,n){return{changedOnDisk:t.blocked,change:e=>{g(t.change(e))},copyDraft:()=>le(t.state.value.text,`draft`),notifyUnsaved:e=>n({title:`${e} was not saved`,description:`Your draft is kept in this session. Reopen Edit to retry.`,type:`error`}),save:()=>_(t.save()),done:n=>_(me(t,()=>{Iv(t,e),n()})),discard:n=>{Iv(t,e),n()}}}export{dg as $,Un as $t,w_ as A,on as An,gm as At,n_ as B,Bt as Bn,Op as Bt,P_ as C,vn as Cn,Am as Ct,A_ as D,un as Dn,ym as Dt,j_ as E,ln as En,Cm as Et,m_ as F,Jt as Fn,Kp as Ft,qg as G,Zf as Gt,Zg as H,Dt as Hn,Cp as Ht,p_ as I,qt as In,Gp as It,_g as J,Ma as Jt,Kg as K,vc as Kt,u_ as L,Zt as Ln,Vp as Lt,S_ as M,Gt as Mn,Yp as Mt,__ as N,Qt as Nn,Jp as Nt,D_ as O,sn as On,vm as Ot,h_ as P,Xt as Pn,X as Pt,fg as Q,Wn as Qt,c_ as R,M as Rn,Hp as Rt,F_ as S,Sn,Dm as St,k_ as T,fn as Tn,xm as Tt,Yg as U,xt as Un,wp as Ut,e_ as V,Ot as Vn,Tp as Vt,Jg as W,Dp as Wt,gg as X,Xn as Xt,vg as Y,Zn as Yt,ug as Z,Gn as Zt,W_ as _,bn as _n,Im as _t,Fv as a,En as an,Q as at,V_ as b,Tn as bn,km as bt,Ev as c,zn as cn,Zh as ct,Sv as d,Dn as dn,Dh as dt,Hn as en,pg as et,Dv as f,Pn as fn,Sh as ft,tv as g,yn as gn,Tm as gt,mv as h,Vn as hn,Em as ht,Iv as i,gn as in,ag as it,C_ as j,Kt as jn,Xp as jt,O_ as k,an as kn,_m as kt,Cv as l,Bn as ln,$h as lt,xv as m,mn,Rm as mt,Bv as n,Mn as nn,cg as nt,jv as o,In as on,tg as ot,Tv as p,hn as pn,Gm as pt,Rg as q,wi as qt,Vv as r,jn as rn,sg as rt,kv as s,Ln as sn,eg as st,Rv as t,xn as tn,lg as tt,wv as u,Rn as un,Ih as ut,U_ as v,_n as vn,jm as vt,M_ as w,dn as wn,bm as wt,I_ as x,Cn as xn,Lm as xt,B_ as y,wn as yn,Om as yt,r_ as z,Yt as zn,Y as zt};
1568
+ `;function Kv(e){let t=f;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,h);return t>>>1}var qv=se(),Jv=We(an),Yv={commitModel:``,pullStrategy:`merge`,appearance:`system`,diffStyle:`unified`,lineOverflow:`scroll`,markdownDefault:`reader`,htmlDefault:`preview`,collapseSpecs:!1};function Xv(e,t){return e===`system`?t?`dark`:`light`:e}var Zv=[`system`,`light`,`dark`];function Qv(e){return Zv[(Zv.indexOf(e)+1)%Zv.length]??`system`}function $v(e,t){let n=Be(()=>xe(de(t)))(e);return g(xe(t))(n)}var ey=pe({commitModel:$v(Re.check(x(160)),``),pullStrategy:$v(Ce([`merge`,`rebase`]),`merge`),appearance:$v(Ce([`system`,`light`,`dark`]),`system`),diffStyle:$v(Ce([`unified`,`split`]),`unified`),lineOverflow:$v(Ce([`scroll`,`wrap`]),`scroll`),markdownDefault:$v(Ce([`reader`,`source`]),`reader`),htmlDefault:$v(Ce([`preview`,`source`]),`preview`),collapseSpecs:$v(r,!1)}).pipe(Be(()=>xe(de(Yv)))),ty=y({runtime:Jv,key:`porcelain.prototype.preferences`,schema:ey,defaultValue:()=>Yv}),ny=S(e=>{if(typeof window>`u`)return!1;let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=()=>e.setSelf(t.matches);return t.addEventListener(`change`,n),e.addFinalizer(()=>t.removeEventListener(`change`,n)),t.matches});function ry(){let e=(0,qv.c)(9),t=je(ty),n=Ie(ty),r=je(ny),i;e[0]===n?i=e[1]:(i=(e,t)=>n(n=>({...n,[e]:t})),e[0]=n,e[1]=i);let a;e[2]!==r||e[3]!==t.appearance?(a=Xv(t.appearance,r),e[2]=r,e[3]=t.appearance,e[4]=a):a=e[4];let o;return e[5]!==i||e[6]!==a||e[7]!==t?(o={preferences:t,setPreference:i,resolvedTheme:a},e[5]=i,e[6]=a,e[7]=t,e[8]=o):o=e[8],o}function iy(){let e=(0,qv.c)(2),{resolvedTheme:t}=ry(),n=t===`dark`,r;return e[0]===n?r=e[1]:(r={dark:n},e[0]=n,e[1]=r),r}var ay=(0,A.createContext)(null);function oy(){return(0,A.useContext)(ay)?.defaultOptions??{}}function sy(e){return typeof e==`object`&&!!e&&`current`in e}function cy(){if(typeof navigator>`u`)return`linux`;let e=navigator.platform?.toLowerCase()??``,t=navigator.userAgent?.toLowerCase()??``;return e.includes(`mac`)||t.includes(`mac`)?`mac`:e.includes(`win`)||t.includes(`win`)?`windows`:`linux`}var ly=[`Control`,`Alt`,`Shift`,`Meta`];new Set(ly);var uy={Control:`Control`,Ctrl:`Control`,control:`Control`,ctrl:`Control`,Shift:`Shift`,shift:`Shift`,Alt:`Alt`,Option:`Alt`,alt:`Alt`,option:`Alt`,Command:`Meta`,Cmd:`Meta`,Meta:`Meta`,command:`Meta`,cmd:`Meta`,meta:`Meta`,OS:`Meta`,os:`Meta`,Win:`Meta`,win:`Meta`,CommandOrControl:`Mod`,Mod:`Mod`,commandorcontrol:`Mod`,mod:`Mod`};function dy(e,t=cy()){return e===`Mod`?t===`mac`?`Meta`:`Control`:e}var fy=new Set(`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``)),py=new Set([`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`]),my=new Set([`F1`,`F2`,`F3`,`F4`,`F5`,`F6`,`F7`,`F8`,`F9`,`F10`,`F11`,`F12`]),hy=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`]),gy=new Set([`Enter`,`Escape`,`Space`,`Tab`,`Backspace`,`Delete`]),_y=new Set([`/`,`[`,`]`,`\\`,`=`,`-`,`,`,`.`,`;`,"`"]),vy={Backquote:"`",Backslash:`\\`,BracketLeft:`[`,BracketRight:`]`,Comma:`,`,Equal:`=`,Minus:`-`,Period:`.`,Semicolon:`;`,Slash:`/`};[...fy,...py,...my,...hy,...gy,..._y];var yy={Esc:`Escape`,esc:`Escape`,escape:`Escape`,Return:`Enter`,return:`Enter`,enter:`Enter`," ":`Space`,space:`Space`,Spacebar:`Space`,spacebar:`Space`,tab:`Tab`,backspace:`Backspace`,Del:`Delete`,del:`Delete`,delete:`Delete`,Up:`ArrowUp`,up:`ArrowUp`,arrowup:`ArrowUp`,Down:`ArrowDown`,down:`ArrowDown`,arrowdown:`ArrowDown`,Left:`ArrowLeft`,left:`ArrowLeft`,arrowleft:`ArrowLeft`,Right:`ArrowRight`,right:`ArrowRight`,arrowright:`ArrowRight`,home:`Home`,end:`End`,pageup:`PageUp`,pagedown:`PageDown`,PgUp:`PageUp`,PgDn:`PageDown`,pgup:`PageUp`,pgdn:`PageDown`};function by(e){return/^\p{Letter}$/u.test(e)}function xy(e){if(!e)return``;if(e in yy)return yy[e];if(by(e)){let t=e.toUpperCase();return t.length===1?t:e}let t=e.toUpperCase();return/^F([1-9]|1[0-2])$/.test(t)?t:e}var Sy={Control:`⌃`,Alt:`⌥`,Shift:`⇧`,Meta:`⌘`,Mod:`⌘`},Cy={Control:`Control`,Alt:`Option`,Shift:`Shift`,Meta:`Cmd`,Mod:`Cmd`},wy={Control:`Ctrl`,Alt:`Alt`,Shift:`Shift`,Meta:`Win`,Mod:`Ctrl`},Ty={...wy,Meta:`Super`},Ey={"`":`Backquote`,"\\":`Backslash`,"[":`Left Bracket`,"]":`Right Bracket`,",":`Comma`,"=":`Equal`,"-":`Minus`,".":`Period`,";":`Semicolon`},Dy={ArrowUp:`↑`,ArrowDown:`↓`,ArrowLeft:`←`,ArrowRight:`→`,Enter:`↵`,Escape:`Esc`,Backspace:`⌫`,Delete:`⌦`,Tab:`⇥`,Space:`␣`};function Oy(e,t=cy()){let n=e.split(`+`),r=new Set,i=``;for(let e=0;e<n.length;e++){let a=n[e].trim();if(e===n.length-1)i=xy(a);else{let e=uy[a]??uy[a.toLowerCase()];if(e){let n=dy(e,t);r.add(n)}else n.length===1&&(i=xy(a))}}return!i&&n.length>0&&(i=xy(n[n.length-1].trim())),{key:i,ctrl:r.has(`Control`),shift:r.has(`Shift`),alt:r.has(`Alt`),meta:r.has(`Meta`),modifiers:ly.filter(e=>r.has(e))}}function ky(e,t=cy()){let n=e.ctrl??!1,r=e.shift??!1,i=e.alt??!1,a=e.meta??!1;e.mod&&(dy(`Mod`,t)===`Control`?n=!0:a=!0);let o=ly.filter(e=>{switch(e){case`Control`:return n;case`Shift`:return r;case`Alt`:return i;case`Meta`:return a;default:return!1}});return{key:e.key,ctrl:n,shift:r,alt:i,meta:a,modifiers:o}}function Ay(e,t){let n=t===`mac`?e.meta&&!e.ctrl:e.ctrl&&!e.meta,r=[];if(n)r.push(`Mod`),e.alt&&r.push(`Alt`),e.shift&&r.push(`Shift`);else for(let t of ly)e.modifiers.includes(t)&&r.push(t);return r.push(xy(e.key)),r.join(`+`)}function jy(e,t=cy()){return Ay(Oy(e,t),t)}function My(e,t=cy()){return Ay(e,t)}function Ny(e,t=cy()){return typeof e==`string`?jy(e,t):My(ky(e,t),t)}function Py(e){return e in uy||e.toLowerCase()in uy}function Fy(e){let t=[];for(let n of ly)e.modifiers.includes(n)&&t.push(n);return t.push(e.key),t.join(`+`)}function Iy(e,t={}){let n=t.platform??cy(),r=t.useSymbols??!0,i=t.separatorToken??(n===`mac`&&r?` `:`+`);return Ny(e,n).split(`+`).map(e=>{if(Py(e)){let t=uy[e]??uy[e.toLowerCase()];return n===`mac`?r?Sy[t]:Cy[t]:n===`windows`?wy[t]:Ty[t]}return r&&Dy[e]||!r&&Ey[e]||e}).join(i)}function Ly(e,t,n=cy()){let r=typeof t==`string`?Oy(t,n):t;if(e.ctrlKey!==r.ctrl||e.shiftKey!==r.shift||e.altKey!==r.alt||e.metaKey!==r.meta)return!1;let i=xy(e.key),a=r.key;if(i!==`Dead`&&i.length===1&&a.length===1){if(i.toUpperCase()===a.toUpperCase())return!0;if(by(i)&&(/^[A-Za-z]$/.test(i)||!e.altKey))return!1}if(e.code&&(i===`Dead`||i.length===1&&a.length===1)){if(e.code.startsWith(`Key`)){let t=e.code.slice(3);if(t.length===1&&/^[A-Za-z]$/.test(t))return t.toUpperCase()===a.toUpperCase()}if(e.code.startsWith(`Digit`)){let t=e.code.slice(5);if(t.length===1&&/^[0-9]$/.test(t))return t===a}return e.code in vy&&vy[e.code]===a}return i===a}var Ry={preventDefault:!0,stopPropagation:!0,eventType:`keydown`,enabled:!0,ignoreInputs:!0,conflictBehavior:`warn`};function zy(e){return!(e.ctrl||e.meta||e.key===`Escape`)}function By(e){if(!e)return!1;if(e instanceof HTMLInputElement){let t=e.type.toLowerCase();return t!==`button`&&t!==`submit`&&t!==`reset`}return!!(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable)}function Vy(e){return typeof document>`u`?null:typeof Document<`u`&&e instanceof Document||typeof Node<`u`&&e.nodeType===Node.DOCUMENT_NODE?e.activeElement:typeof HTMLElement<`u`&&e instanceof HTMLElement?e.ownerDocument.activeElement??null:e.document.activeElement??null}function Hy(e,t,n){let r=Vy(t);return r&&By(r)&&r!==n||e.composedPath().some(e=>By(e)&&e!==n)?!0:By(e.target)&&e.target!==n}function Uy(e,t){return t===document||t===window?e.currentTarget===t||e.currentTarget===document.documentElement:t===window?e.currentTarget===window||e.currentTarget===document||e.currentTarget===document.documentElement:!!(t instanceof HTMLElement&&(e.currentTarget===t||e.target instanceof Node&&t.contains(e.target)))}function Wy(e,t,n,r){if(n!==`allow`){if(n===`warn`){console.warn(`'${t}' is already registered. Multiple handlers will be triggered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to suppress this warning.`);return}if(n===`error`)throw Error(`'${t}' is already registered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to allow multiple registrations.`);r(e)}}function Gy({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Ky(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var qy=[],Jy=0,{link:Yy,unlink:Xy,propagate:Zy,checkDirty:Qy,shallowPropagate:$y}=Gy({update(e){return e._update()},notify(e){qy[tb++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,ab(e))}}),eb=0,tb=0,nb,rb=0;function ib(e){try{++rb,e()}finally{--rb||ob()}}function ab(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Xy(n,e)}function ob(){if(!(rb>0)){for(;eb<tb;){let e=qy[eb];qy[eb++]=void 0,e.notify()}eb=0,tb=0}}function sb(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return nb!==void 0&&Yy(i,nb,Jy),i._snapshot},subscribe(e){let t=Ky(e),n={current:!1},r=cb(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=nb,o=t?.compare??Object.is;if(n)nb=i,++Jy,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{nb=a,n&&(i.flags&=-5),ab(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Qy(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&$y(e)}}else e&32&&(i.flags=e&-33);return nb!==void 0&&Yy(i,nb,Jy),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Zy(e),$y(e),ob())}},i}function cb(e){let t=()=>{let t=nb;nb=n,++Jy,n.depsTail=void 0,n.flags=6;try{return e()}finally{nb=t,n.flags&=-5,ab(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&Qy(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,ab(this)}};return t(),n}var lb=class{constructor(e,t){this.atom=sb(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(Ky(e))}},ub=class{constructor(e){this.atom=sb(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(Ky(e))}};function db(e,t){return typeof e==`function`?new ub(e):t?new lb(e,t):new lb(e)}var fb=0;function pb(){return`hotkey_${++fb}`}var mb=class e{static#e=null;#t;#n=new Map;#r=new Map;constructor(){this.registrations=new lb(new Map),this.#t=cy()}static getInstance(){return e.#e||=new e,e.#e}static resetInstance(){e.#e&&=(e.#e.destroy(),null)}register(e,t,n={}){if(typeof document>`u`&&!n.target){let e=t;return{id:pb(),unregister:()=>{},get callback(){return e},set callback(t){e=t},setOptions:()=>{},get isActive(){return!1}}}let r=pb(),i=n.platform??this.#t,a=typeof e==`string`?Oy(e,i):ky(e,i),o=typeof e==`string`?e:Fy(a),s=n.target??document,c=n.conflictBehavior??`warn`,l=this.#d(o,s);l&&Wy(l.id,o,c,e=>this.#i(e));let u=n.ignoreInputs??zy(a),d={id:r,hotkey:o,parsedHotkey:a,callback:t,options:{...Ry,requireReset:!1,...n,platform:i,ignoreInputs:u},hasFired:!1,triggerCount:0,target:s};this.registrations.setState(e=>new Map(e).set(r,d)),this.#r.has(s)||this.#r.set(s,new Set),this.#r.get(s).add(r),this.#a(s);let f=this;return{get id(){return r},unregister:()=>{f.#i(r)},get callback(){return f.registrations.state.get(r)?.callback??t},set callback(e){let t=f.registrations.state.get(r);t&&(t.callback=e)},setOptions:e=>{f.registrations.setState(t=>{let n=t.get(r);if(n){let i=new Map(t);return i.set(r,{...n,options:{...n.options,...e}}),i}return t})},get isActive(){return f.registrations.state.has(r)}}}#i(e){let t=this.registrations.state.get(e);if(!t)return;let n=t.target;this.registrations.setState(t=>{let n=new Map(t);return n.delete(e),n});let r=this.#r.get(n);r&&(r.delete(e),r.size===0&&this.#o(n))}#a(e){if(typeof document>`u`||this.#n.has(e))return;let t=this.#l(e),n=this.#u(e);e.addEventListener(`keydown`,t),e.addEventListener(`keyup`,n),this.#n.set(e,{keydown:t,keyup:n})}#o(e){if(typeof document>`u`)return;let t=this.#n.get(e);t&&(e.removeEventListener(`keydown`,t.keydown),e.removeEventListener(`keyup`,t.keyup),this.#n.delete(e),this.#r.delete(e))}#s(e,t,n){let r=this.#r.get(t);if(r)for(let i of r){let r=this.registrations.state.get(i);if(r&&Uy(e,t)&&r.options.enabled&&!(r.options.ignoreInputs!==!1&&Hy(e,t,r.target))){if(n===`keydown`){if(r.options.eventType!==`keydown`)continue;Ly(e,r.parsedHotkey,r.options.platform)&&(r.options.preventDefault&&e.preventDefault(),r.options.stopPropagation&&e.stopPropagation(),(!r.options.requireReset||!r.hasFired)&&(this.#c(r,e),r.options.requireReset&&(r.hasFired=!0)))}else r.options.eventType===`keyup`&&Ly(e,r.parsedHotkey,r.options.platform)&&this.#c(r,e),r.options.requireReset&&r.hasFired&&this.#f(r,e)&&(r.hasFired=!1)}}}#c(e,t){e.options.preventDefault&&t.preventDefault(),e.options.stopPropagation&&t.stopPropagation(),e.triggerCount++,this.registrations.setState(e=>new Map(e));let n={hotkey:e.hotkey,parsedHotkey:e.parsedHotkey};e.callback(t,n)}#l(e){return t=>{this.#s(t,e,`keydown`)}}#u(e){return t=>{this.#s(t,e,`keyup`)}}#d(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&n.target===t)return n;return null}#f(e,t){let n=e.parsedHotkey,r=xy(t.key),i=n.key.length===1?n.key.toUpperCase():n.key;return!!((r.length===1?r.toUpperCase():r)===i||n.ctrl&&r===`Control`||n.shift&&r===`Shift`||n.alt&&r===`Alt`||n.meta&&r===`Meta`)}triggerRegistration(e){let t=this.registrations.state.get(e);if(!t)return!1;let n=t.parsedHotkey,r=new KeyboardEvent(t.options.eventType??`keydown`,{key:n.key,ctrlKey:n.ctrl,shiftKey:n.shift,altKey:n.alt,metaKey:n.meta,bubbles:!0,cancelable:!0});return t.triggerCount++,this.registrations.setState(e=>new Map(e)),t.callback(r,{hotkey:t.hotkey,parsedHotkey:t.parsedHotkey}),!0}getRegistrationCount(){return this.registrations.state.size}isRegistered(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&(t===void 0||n.target===t))return!0;return!1}destroy(){for(let e of this.#n.keys())this.#o(e);this.registrations.setState(()=>new Map),this.#n.clear(),this.#r.clear()}};function hb(){return mb.getInstance()}function gb(e,t,n={}){let r={...oy().hotkey,...n},i=hb(),a=(0,A.useRef)(null),o=(0,A.useRef)(t),s=(0,A.useRef)(r),c=(0,A.useRef)(i);o.current=t,s.current=r,c.current=i;let l=(0,A.useRef)(null),u=(0,A.useRef)(null),d=Ny(e,r.platform??cy()),{target:f,...p}=r;(0,A.useEffect)(()=>{let e=sy(s.current.target)?s.current.target.current:s.current.target??(typeof document<`u`?document:null);if(!e){a.current?.isActive&&(a.current.unregister(),a.current=null),l.current=null,u.current=null;return}let t=l.current!==null&&l.current!==e,n=u.current!==null&&u.current!==d;return a.current?.isActive&&(t||n)&&(a.current.unregister(),a.current=null),(!a.current||!a.current.isActive)&&(a.current=c.current.register(d,o.current,{...s.current,target:e})),l.current=e,u.current=d,()=>{a.current?.isActive&&(a.current.unregister(),a.current=null)}},[d]),a.current?.isActive&&(a.current.callback=t,a.current.setOptions(p))}var $={saveFile:`Mod+S`,toggleNavigator:`Mod+B`,toggleSidebar:`Alt+Shift+R`,cycleAppearance:`Alt+Shift+D`,openSettings:`Alt+Shift+S`,openShortcuts:`Mod+/`,surfaceFiles:`Alt+1`,surfaceReview:`Alt+2`,surfaceHistory:`Alt+3`,nextFile:`J`,previousFile:`K`,toggleReviewed:`R`,nextStop:`N`,previousStop:`P`,commentOnFile:`C`,findInFile:`Mod+F`,duplicateFile:`Mod+D`,nextTab:`Alt+ArrowRight`,previousTab:`Alt+ArrowLeft`,closeTab:`Alt+W`,openToSide:`Alt+\\`},_b=[{title:`Workspace`,items:[{keys:$.toggleNavigator,label:`Show or hide projects`},{keys:$.toggleSidebar,label:`Show or hide the right sidebar`},{keys:$.surfaceFiles,label:`Go to Files`},{keys:$.surfaceReview,label:`Go to Changes / Review`},{keys:$.surfaceHistory,label:`Go to History`},{keys:$.openSettings,label:`Settings`},{keys:$.cycleAppearance,label:`Cycle appearance`},{keys:$.openShortcuts,label:`Keyboard shortcuts`}]},{title:`Code review`,items:[{keys:$.nextFile,label:`Next file`},{keys:$.previousFile,label:`Previous file`},{keys:$.toggleReviewed,label:`Toggle reviewed`},{keys:$.nextStop,label:`Next stop in the walkthrough`},{keys:$.previousStop,label:`Previous stop in the walkthrough`},{keys:$.commentOnFile,label:`Comment on file`},{keys:$.findInFile,label:`Find in file`},{keys:$.saveFile,label:`Save file edits`},{keys:$.duplicateFile,label:`Duplicate the open file`}]},{title:`Tabs`,items:[{keys:$.nextTab,label:`Next tab`},{keys:$.previousTab,label:`Previous tab`},{keys:$.closeTab,label:`Close tab`},{keys:$.openToSide,label:`Open the tab to the side`}]}];function vb(e){let t=(0,qv.c)(16),{children:n}=e,{preferences:r,resolvedTheme:i,setPreference:a}=ry(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],t[0]=o):o=t[0],(0,A.useEffect)(u,o);let s,c;t[1]===r.appearance?(s=t[2],c=t[3]):(s=()=>we(r.appearance),c=[r.appearance],t[1]=r.appearance,t[2]=s,t[3]=c),(0,A.useEffect)(s,c);let l,d;t[4]===i?(l=t[5],d=t[6]):(l=()=>{document.documentElement.classList.toggle(`dark`,i===`dark`)},d=[i],t[4]=i,t[5]=l,t[6]=d),(0,A.useEffect)(l,d);let f;t[7]!==r.appearance||t[8]!==a?(f=()=>a(`appearance`,Qv(r.appearance)),t[7]=r.appearance,t[8]=a,t[9]=f):f=t[9];let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p={ignoreInputs:!0},t[10]=p):p=t[10],gb($.cycleAppearance,f,p);let m=i===`dark`&&`dark`,h;t[11]===m?h=t[12]:(h=w(`min-h-svh bg-background text-foreground`,m),t[11]=m,t[12]=h);let g;return t[13]!==n||t[14]!==h?(g=(0,j.jsx)(`div`,{className:h,children:n}),t[13]=n,t[14]=h,t[15]=g):g=t[15],g}function yb(e){let t=(0,qv.c)(9),n=je(e),r;t[0]===n?r=t[1]:(r=Ne(ne(n)),t[0]=n,t[1]=r);let i;t[2]===r?i=t[3]:(i={includeFailure:!0,suspendOnWaiting:r},t[2]=r,t[3]=i);let a=De(e,i),o;t[4]===a?o=t[5]:(o=me(ne(a),()=>{throw ee(a)?he(a.cause):Error(`The read has no confirmed value`)}),t[4]=a,t[5]=o);let s=o,c;return t[6]!==a||t[7]!==s?(c={result:a,value:s},t[6]=a,t[7]=s,t[8]=c):c=t[8],c}var bb=ye(``);function xb(){let e=(0,qv.c)(2),t=a(bb),n;return e[0]===t?n=e[1]:(n={query:t,setQuery:Sb},e[0]=t,e[1]=n),n}function Sb(e){bb.set(e)}function Cb(e){return a(e.state)}var wb=new WeakMap;function Tb(e,t,n,r){let i=wb.get(e);i||(i=new Map,wb.set(e,i));let a=i.get(t);return a||(a={file:{name:n,contents:r},initialText:r},i.set(t,a)),a}function Eb(e,t,n){let r=wb.get(e);(!n||r?.get(t)===n)&&r?.delete(t)}var Db=e=>e.replace(/\/$/,``);function Ob(e,t){let n=(0,qv.c)(15),r;n[0]!==e||n[1]!==t?(r=Oe({connection:e,scope:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i=r,a;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(a={mode:`promiseExit`},n[3]=a):a=n[3];let[o,s]=ae(i,a),c,l,u,d;n[4]===s?(c=n[5],l=n[6],u=n[7],d=n[8]):(c=(e,t,n)=>s({kind:`create`,path:Db(e),entryKind:t}).then(r=>{if(Me(r))throw he(r.cause);t===`file`&&n(e)}),l=(e,t)=>s({kind:`move`,path:Db(e),destination:Db(t)}).then(kb),u=(e,t,n)=>{s({kind:`copy`,path:e,destination:t}).then(e=>{Se(e)&&n(t)})},d=(e,t)=>{s({kind:`trash`,path:Db(e)}).then(e=>{Se(e)&&t()})},n[4]=s,n[5]=c,n[6]=l,n[7]=u,n[8]=d);let f;return n[9]!==o||n[10]!==c||n[11]!==l||n[12]!==u||n[13]!==d?(f={result:o,create:c,move:l,duplicate:u,trash:d},n[9]=o,n[10]=c,n[11]=l,n[12]=u,n[13]=d,n[14]=f):f=n[14],f}function kb(e){if(Me(e))throw he(e.cause)}function Ab(e,t,n,r,i){let a=(0,qv.c)(12),o;a[0]!==e||a[1]!==i||a[2]!==n||a[3]!==t||a[4]!==r?(o=le({connection:e,scope:t,path:n,text:r,fingerprint:i}),a[0]=e,a[1]=i,a[2]=n,a[3]=t,a[4]=r,a[5]=o):o=a[5];let{value:s}=yb(o),c=Cb(s),l;a[6]===s?l=a[7]:(l=(e,t)=>{D(s.reset(e,t))},a[6]=s,a[7]=l);let u;return a[8]!==s||a[9]!==c||a[10]!==l?(u={draft:s,state:c,reset:l},a[8]=s,a[9]=c,a[10]=l,a[11]=u):u=a[11],u}function jb(e,t,n){return{changedOnDisk:t.blocked,change:e=>{D(t.change(e))},copyDraft:()=>Te(t.state.value.text,`draft`),notifyUnsaved:e=>n({title:`${e} was not saved`,description:`Your draft is kept in this session. Reopen Edit to retry.`,type:`error`}),save:()=>C(t.save()),done:n=>C(oe(t,()=>{Eb(t,e),n()})),discard:n=>{Eb(t,e),n()}}}export{g_ as $,Wt as $n,Hp as $t,av as A,Hn as An,qm as At,q_ as B,Cn as Bn,Im as Bt,Kv as C,Qn as Cn,Vh as Ct,bv as D,Ln as Dn,Wm as Dt,Nv as E,ar as En,Gm as Et,Z_ as F,kn as Fn,zm as Ft,P_ as G,hn as Gn,Y as Gt,H_ as H,dn as Hn,hm as Ht,J_ as I,An as In,Bm as It,k_ as J,gn as Jn,om as Jt,N_ as K,pn as Kn,dm as Kt,X_ as L,Dn as Ln,Hm as Lt,tv as M,Vn as Mn,nh as Mt,ev as N,Bn as Nn,Km as Nt,lv as O,Rn as On,th as Ot,$_ as P,In as Pn,Ym as Pt,y_ as Q,Gt as Qn,Wp as Qt,Y_ as R,On as Rn,Rm as Rt,Vv as S,Gn as Sn,Kh as St,Bv as T,Mn as Tn,rh as Tt,V_ as U,un as Un,mm as Ut,U_ as V,wn as Vn,Fm as Vt,I_ as W,_n as Wn,pm as Wt,S_ as X,mn as Xn,J as Xt,D_ as Y,M as Yn,sm as Yt,x_ as Z,rn as Zn,qp as Zt,iy as _,er as _n,bg as _t,Tb as a,Xa as an,Ig as at,Hv as b,ir as bn,vg as bt,vb as c,lr as cn,kg as ct,gb as d,or as dn,Mg as dt,Up as en,Ht as er,m_ as et,db as f,zn as fn,Og as ft,ry as g,Wn as gn,Z as gt,cy as h,Pn as hn,wg as ht,Eb as i,Hi as in,r_ as it,ov as j,Un as jn,Jm as jt,cv as k,Fn as kn,Xm as kt,$ as l,cr as ln,jg as lt,Iy as m,Yn as mn,Eg as mt,Ab as n,gp as nn,f_ as nt,xb as o,hr as on,Lg as ot,ib as p,Xn as pn,Dg as pt,M_ as q,fn as qn,um as qt,jb as r,Ic as rn,d_ as rt,yb as s,mr as sn,Fg as st,Ob as t,Kp as tn,It as tr,p_ as tt,_b as u,sr as un,Ag as ut,Jv as v,tr as vn,yg as vt,Wv as w,Nn as wn,uh as wt,Uv as x,nr as xn,tg as xt,Gv as y,rr as yn,gg as yt,K_ as z,Tn as zn,Lm as zt};