@rohansguliani/mux-chat-ui 0.4.5 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/kit/build.json +1 -1
  2. package/kit/chunks/{abnfDiagram-VCTEODGH-Bfs5Gqvk.js → abnfDiagram-VCTEODGH-O29xLjUr.js} +1 -1
  3. package/kit/chunks/{app-chat-kit-Ck66xmNL.js → app-chat-kit-XCB_z28P.js} +165 -165
  4. package/kit/chunks/{arc-Dli4yqeF.js → arc-B2Qhy8pR.js} +1 -1
  5. package/kit/chunks/architecture-7GRP2DOG-BNrP3hN3.js +1 -0
  6. package/kit/chunks/{architectureDiagram-5GKGNRK7-fkZTSFnE.js → architectureDiagram-5GKGNRK7-CBR5yPbn.js} +1 -1
  7. package/kit/chunks/{blockDiagram-NRAW4CY4-DTa_uwng.js → blockDiagram-NRAW4CY4-BodcbQKZ.js} +1 -1
  8. package/kit/chunks/{c4Diagram-UCG6FXSJ-Bxungqmw.js → c4Diagram-UCG6FXSJ-Rozcet0y.js} +1 -1
  9. package/kit/chunks/channel-aHmXCIiU.js +1 -0
  10. package/kit/chunks/{chunk-2Q5K7J3B-BC9T3euC.js → chunk-2Q5K7J3B-CY_3ljIF.js} +1 -1
  11. package/kit/chunks/{chunk-5VM5RSS4-DglfV9WQ.js → chunk-5VM5RSS4-BDrrpFKq.js} +1 -1
  12. package/kit/chunks/{chunk-F27PBJKO-DjeLRSJB.js → chunk-F27PBJKO-Dr7tzwmR.js} +1 -1
  13. package/kit/chunks/{chunk-G27WJ6UU-BgJbAaZu.js → chunk-G27WJ6UU-COkl3qmH.js} +1 -1
  14. package/kit/chunks/{chunk-JWPE2WC7-AcX35oCq.js → chunk-JWPE2WC7-BYyWO7Tc.js} +1 -1
  15. package/kit/chunks/{chunk-LCL6LL3I-BwBMbUcf.js → chunk-LCL6LL3I-BF5vg3Mf.js} +1 -1
  16. package/kit/chunks/{chunk-POPQ4Y6H-C-hfwTbE.js → chunk-POPQ4Y6H-D86hrxcj.js} +1 -1
  17. package/kit/chunks/{chunk-RHFEMEQ7-DXgWUVaq.js → chunk-RHFEMEQ7-DXnQT_M1.js} +1 -1
  18. package/kit/chunks/{chunk-SVP7TREG-BRdZhE71.js → chunk-SVP7TREG-BXDVnpBT.js} +1 -1
  19. package/kit/chunks/{chunk-XXDRQBXY-CI7P87YE.js → chunk-XXDRQBXY-CryhtMeb.js} +1 -1
  20. package/kit/chunks/classDiagram-DTDB5LWJ-5TLvb6di.js +1 -0
  21. package/kit/chunks/classDiagram-v2-JRS7N3AN-5TLvb6di.js +1 -0
  22. package/kit/chunks/{cose-bilkent-JH36ORCC-Dqi19t_j.js → cose-bilkent-JH36ORCC-C-5wpksu.js} +1 -1
  23. package/kit/chunks/cynefin-OW5HDTMX-CvWOCxtf.js +1 -0
  24. package/kit/chunks/{cynefinDiagram-5FMLGOSQ-2eqttX2S.js → cynefinDiagram-5FMLGOSQ-DOxX4kCR.js} +1 -1
  25. package/kit/chunks/{dagre-3AP2YEHR-D1-Ji0Mz.js → dagre-3AP2YEHR-DAI36eWd.js} +1 -1
  26. package/kit/chunks/{diagram-S7CK7UJ4-Z689GD_k.js → diagram-S7CK7UJ4-oFHCbaGn.js} +1 -1
  27. package/kit/chunks/{diagram-UQ7AKVKN-6wH2UOiG.js → diagram-UQ7AKVKN-B7RApAiE.js} +1 -1
  28. package/kit/chunks/{diagram-VSXAHHWV-C7ceZTNp.js → diagram-VSXAHHWV-DZlhKhpq.js} +1 -1
  29. package/kit/chunks/{diagram-VX7I27RA-CQ0ngi2L.js → diagram-VX7I27RA-BgrIIrrA.js} +1 -1
  30. package/kit/chunks/{diagram-Z3DM3KII-rW7Ioaec.js → diagram-Z3DM3KII-PnjZjOyl.js} +1 -1
  31. package/kit/chunks/{ebnfDiagram-PWID7BFC-rdIb5LRV.js → ebnfDiagram-PWID7BFC-BvoPMD7s.js} +1 -1
  32. package/kit/chunks/{engine-compile-CLAWXunO.js → engine-compile-BuAlGbRx.js} +1 -1
  33. package/kit/chunks/{erDiagram-SSCWMZ5O-CrBH-qwy.js → erDiagram-SSCWMZ5O-Do7-AWeg.js} +1 -1
  34. package/kit/chunks/eventmodeling-NTZA5JFV-BVpnqLdL.js +1 -0
  35. package/kit/chunks/{file-4YaHcrma.js → file-BFdEpVsY.js} +2 -2
  36. package/kit/chunks/flowDiagram-A5DVABFB-DiRle5Xs.js +1 -0
  37. package/kit/chunks/{ganttDiagram-EL5Y4UJY-CohLIBwF.js → ganttDiagram-EL5Y4UJY-B2oqPnLi.js} +1 -1
  38. package/kit/chunks/gitGraph-4MIJSDKK-9ZoUw8Nn.js +1 -0
  39. package/kit/chunks/{gitGraphDiagram-WWUBYQGX-C3-dW0io.js → gitGraphDiagram-WWUBYQGX-W34a33PJ.js} +1 -1
  40. package/kit/chunks/{index-DCZ3hf3T.js → index-CwHpOKBC.js} +1 -1
  41. package/kit/chunks/{index-B1au7_iH.js → index-XbqsxSUS.js} +1 -1
  42. package/kit/chunks/info-A6RAGUB7-BxNGa8pZ.js +1 -0
  43. package/kit/chunks/{infoDiagram-RXCK75RN-KzC_PMCu.js → infoDiagram-RXCK75RN-CwCcH0M-.js} +1 -1
  44. package/kit/chunks/{ishikawaDiagram-5VMMS53U-BOkqSJeh.js → ishikawaDiagram-5VMMS53U-m2E5Pt4D.js} +1 -1
  45. package/kit/chunks/{journeyDiagram-EYS64GPL-puAvr0qD.js → journeyDiagram-EYS64GPL-MD4LmuBk.js} +1 -1
  46. package/kit/chunks/{kanban-definition-3QL26DDD-BBJwrZJC.js → kanban-definition-3QL26DDD-B0HvzYtj.js} +1 -1
  47. package/kit/chunks/{layout-CZyvCll6.js → layout-BE_8aISk.js} +1 -1
  48. package/kit/chunks/{linear-Ls7JLhyc.js → linear-CTZHOwzO.js} +1 -1
  49. package/kit/chunks/{markdown-leZ65Gnj.js → markdown-BOJLpTC-.js} +2 -2
  50. package/kit/chunks/{markdown-code-CXhO_kB-.js → markdown-code-CZu9SuDN.js} +1 -1
  51. package/kit/chunks/{markdown-mermaid-CWtlyPVU.js → markdown-mermaid-TH7RPyY4.js} +1 -1
  52. package/kit/chunks/{marked-parser-DJaHEhO4.js → marked-parser-CYuUjHtk.js} +1 -1
  53. package/kit/chunks/{mermaid-parser.core-ButbfTJL.js → mermaid-parser.core-BkeuOCk8.js} +2 -2
  54. package/kit/chunks/{mermaid.core-Den2NdAK.js → mermaid.core-ijN1rEqA.js} +4 -4
  55. package/kit/chunks/{mindmap-definition-FBJOCRG2-D7-THfgD.js → mindmap-definition-FBJOCRG2-DYm5h4PS.js} +1 -1
  56. package/kit/chunks/packet-AYTQ26CC-C9zPdvzj.js +1 -0
  57. package/kit/chunks/{pegDiagram-XKGWAZYB-CD1_OS6w.js → pegDiagram-XKGWAZYB-BvUrzgug.js} +1 -1
  58. package/kit/chunks/pie-WAS4IAKB-Y6UZsh6-.js +1 -0
  59. package/kit/chunks/{pieDiagram-E7YTZNPT-COgMyD7l.js → pieDiagram-E7YTZNPT-DcmXs3DE.js} +1 -1
  60. package/kit/chunks/{quadrantDiagram-AXDQQJYC-3pqJZoPE.js → quadrantDiagram-AXDQQJYC-By79fSoU.js} +1 -1
  61. package/kit/chunks/radar-RG4KPBEZ-DMryGW64.js +1 -0
  62. package/kit/chunks/railroad-74A4TZTK-D6VfkS5x.js +1 -0
  63. package/kit/chunks/railroad-abnf-HS5TGJTU-DDbbzDEL.js +1 -0
  64. package/kit/chunks/railroad-ebnf-LZEXJU2U-BWoDAcAM.js +1 -0
  65. package/kit/chunks/railroad-peg-WCYAUIDC-BzGVGj-K.js +1 -0
  66. package/kit/chunks/{railroadDiagram-O6MQD6OU-VOt2CEsx.js → railroadDiagram-O6MQD6OU-B6fqNB__.js} +1 -1
  67. package/kit/chunks/{requirementDiagram-EFPCY7ZU-vN2rPOmy.js → requirementDiagram-EFPCY7ZU-BdOt5-TZ.js} +1 -1
  68. package/kit/chunks/{sankeyDiagram-P5KCCOFB-BiwU-ryo.js → sankeyDiagram-P5KCCOFB-BPvTSvb2.js} +1 -1
  69. package/kit/chunks/{sequenceDiagram-WJ2MYXX4-B2rNhW13.js → sequenceDiagram-WJ2MYXX4-ChMjmEyH.js} +1 -1
  70. package/kit/chunks/{sizeCapture-X5ZJPWSS-C6_yXTuo.js → sizeCapture-X5ZJPWSS-DfSPnmmD.js} +1 -1
  71. package/kit/chunks/{stateDiagram-HBIQ2CUA-BvqZobNo.js → stateDiagram-HBIQ2CUA-CooDV5d_.js} +1 -1
  72. package/kit/chunks/stateDiagram-v2-4QOOHH4V-602JM_xo.js +1 -0
  73. package/kit/chunks/{swimlanes-XN3QIQJK-B3mCwXEY.js → swimlanes-XN3QIQJK-91_I34ue.js} +1 -1
  74. package/kit/chunks/swimlanesDiagram-VK2B7HYN-tltxsgIN.js +8 -0
  75. package/kit/chunks/{timeline-definition-24CTP7MA-DMIuMIxq.js → timeline-definition-24CTP7MA-B06rrwgf.js} +1 -1
  76. package/kit/chunks/treeView-Q6P3EWNA-Bn420wCk.js +1 -0
  77. package/kit/chunks/treemap-WGGIJYW6-BcNs_tH0.js +1 -0
  78. package/kit/chunks/{vennDiagram-4TSXK5OY-BwSRmgyd.js → vennDiagram-4TSXK5OY-BTFHDFT_.js} +1 -1
  79. package/kit/chunks/wardley-WFR3VGLG-85yncRcJ.js +1 -0
  80. package/kit/chunks/{wardleyDiagram-VM6X3IG4-B6z3die9.js → wardleyDiagram-VM6X3IG4-BFIeAko7.js} +1 -1
  81. package/kit/chunks/{xychartDiagram-S5SC5T6Z-JSywrnZk.js → xychartDiagram-S5SC5T6Z-TB52Dx7K.js} +1 -1
  82. package/kit/index.d.ts +25 -2
  83. package/kit/index.js +1 -1
  84. package/kit/mux-build.json +1 -1
  85. package/kit/style.css +1 -1
  86. package/package.json +1 -1
  87. package/kit/chunks/architecture-7GRP2DOG-DeMUlzil.js +0 -1
  88. package/kit/chunks/channel-J39uX_8L.js +0 -1
  89. package/kit/chunks/classDiagram-DTDB5LWJ-H1ejRJcX.js +0 -1
  90. package/kit/chunks/classDiagram-v2-JRS7N3AN-H1ejRJcX.js +0 -1
  91. package/kit/chunks/cynefin-OW5HDTMX-fH9d9mHi.js +0 -1
  92. package/kit/chunks/eventmodeling-NTZA5JFV-B6dfQZX5.js +0 -1
  93. package/kit/chunks/flowDiagram-A5DVABFB-Bnk2IjEI.js +0 -1
  94. package/kit/chunks/gitGraph-4MIJSDKK-D6QTJZzE.js +0 -1
  95. package/kit/chunks/info-A6RAGUB7-pEawYHxw.js +0 -1
  96. package/kit/chunks/packet-AYTQ26CC-DkYyila1.js +0 -1
  97. package/kit/chunks/pie-WAS4IAKB-DiDgpL5b.js +0 -1
  98. package/kit/chunks/radar-RG4KPBEZ-CBz73bz-.js +0 -1
  99. package/kit/chunks/railroad-74A4TZTK-BTsrRQQ1.js +0 -1
  100. package/kit/chunks/railroad-abnf-HS5TGJTU-DXJRXL-z.js +0 -1
  101. package/kit/chunks/railroad-ebnf-LZEXJU2U-BSgGdaL7.js +0 -1
  102. package/kit/chunks/railroad-peg-WCYAUIDC-liB6zpun.js +0 -1
  103. package/kit/chunks/stateDiagram-v2-4QOOHH4V-BgyB5xo0.js +0 -1
  104. package/kit/chunks/swimlanesDiagram-VK2B7HYN-B32zSYEj.js +0 -8
  105. package/kit/chunks/treeView-Q6P3EWNA-DsAWOfDH.js +0 -1
  106. package/kit/chunks/treemap-WGGIJYW6-BqtQKaeF.js +0 -1
  107. package/kit/chunks/wardley-WFR3VGLG-CB8g2VlV.js +0 -1
@@ -1,4 +1,4 @@
1
- import{isServer as Di,createComponent as W,effect as Qe,setAttribute as le,insert as X,template as He,Portal as lo,use as _t,memo as _i,addEventListener as rt,setStyleProperty as Wn,delegateEvents as Pi,style as ho,classList as co}from"solid-js/web";import{getOwner as Fi,sharedConfig as uo,createRoot as zi,onCleanup as de,createMemo as Y,createEffect as Ee,on as fo,Switch as po,Match as mt,Show as ot,useContext as go,createContext as mo,onMount as Oi,createSignal as Pn,splitProps as Ni}from"solid-js";import{c as vo,m as bo,b as G,e as Ui,_ as E,C as Fn,H as zn,f as On,i as Nn,j as Vt,U as So,k as yo,l as Vi,T as Co,n as xo,E as Bi,o as Un,S as Lo,p as Fe,q as ce,r as Ne,s as Ue,v as ko,w as wo,a as $i,x as Eo,y as Ro,z as rn,A as on,F as To,G as Ao,I as Ho,J as vt,K as Mo,L as Io,N as Gn}from"./app-chat-kit-Ck66xmNL.js";import{L as te,y as Do}from"./core-CXDtDTdc.js";import{b as jn,l as _o,m as Po}from"./engine-compile-CLAWXunO.js";import{createOnigurumaEngine as Fo}from"./engine-oniguruma-C5ugeybA.js";import{createStore as zo}from"solid-js/store";function Oo(e,t=Fi()){let n=0,i,r;return()=>(n++,de(()=>{n--,queueMicrotask(()=>{!n&&r&&(r(),r=i=void 0)})}),r||zi(o=>i=e(r=o),t),i)}function No(e){const t=Fi(),n=Oo(e,t);return()=>Di||uo.context?zi(e,t):n()}function Wi(e,t=!1){if(Di)return()=>t;const n=window.matchMedia(e),[i,r]=vo(t,()=>n.matches);return bo(n,"change",()=>r(n.matches)),i}function Uo(e){return Wi("(prefers-color-scheme: dark)",e)}Uo.bind(void 0,!1);const Xe=new Set;let Ze=null;function Q(e){Xe.add(e),Ze??=requestAnimationFrame(Gi)}function Bt(e){Xe.delete(e)&&Xe.size===0&&Ze!=null&&(cancelAnimationFrame(Ze),Ze=null)}function Gi(e){const t=new Set(Xe);Xe.clear();for(const n of t)try{n(e)}catch(i){console.error(i)}Xe.size>0?Ze=requestAnimationFrame(Gi):Ze=null}function $t(e,t,n){if(e===t||e==null||t==null)return e===t;const i=new Set(n),r=Object.keys(e),o=new Set(Object.keys(t));for(const s of r)if(o.delete(s),!i.has(s)&&(!(s in t)||e[s]!==t[s]))return!1;for(const s of Array.from(o))if(!i.has(s))return!1;return!0}function pt(e,t){return e==null||t==null||typeof e=="string"||typeof t=="string"?e===t:e.dark===t.dark&&e.light===t.light}function ji(e,t){const n=e?.theme??G,i=t?.theme??G,r=qn(e),o=qn(t);return pt(n,i)&&$t(e,t,["theme","parseDiffOptions"])&&$t(r,o)}function qn(e){if(e!=null&&"parseDiffOptions"in e)return e.parseDiffOptions}function mn(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Kn({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:i=!1,fitPerfectlyOverscroll:r=0,overscrollSize:o}){const s=n+o*2,l=i?n+r*2:s;if(t=Math.max(t,l),s>=t||i){const d=Math.max(e-r,0),c=Math.min(e+l,t);return{top:d,bottom:Math.max(c,d)}}let a=e+n/2-s/2,h=a+s;return a<0&&(a=0),h>t&&(h=t),a=Math.floor(Math.max(a,0)),{top:a,bottom:Math.ceil(Math.max(Math.min(h,t),a))}}class Vo extends Ui{}const Bo=new Vo;function $o(e,t,n){return Bo.diff(e,t,n)}const Yn="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}";class Wo extends Ui{tokenize(t){const n=new RegExp(`(\\r?\\n)|[${Yn}]+|[^\\S\\n\\r]+|[^${Yn}]`,"ug");return t.match(n)||[]}}const Go=new Wo;function jo(e,t,n){return Go.diff(e,t,n)}function Se(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Ce(e){return{type:"text",value:e}}function F({tagName:e,children:t=[],properties:n={}}){return{type:"element",tagName:e,properties:n,children:t}}function Wt({name:e,width:t=16,height:n=16,properties:i}){return F({tagName:"svg",properties:{width:t,height:n,viewBox:"0 0 16 16",...i},children:[F({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function qo(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t;"children"in t?t=t.children[0]:t=null}}function Ke(e){return F({tagName:"div",properties:{"data-gutter":""},children:e})}function qi(e,t,n,i={}){return F({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...i},children:t!=null?[F({tagName:"span",properties:{"data-line-number-content":""},children:[Ce(`${t}`)]})]:void 0})}function oe(e,t,n){return F({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 Ko(){return F({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[Wt({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}function Yo(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function bt(e){for(const 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 Ki=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(),Bt(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();const{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){const n=!(e===this.selectedRange||mn(e??void 0,this.selectedRange??void 0)),i=t?.lineNumberOnly??!1,r=t?.activeLineSide!==this.selectedRangeHighlightSide||i!==this.selectedRangeLineNumberOnly;!this.isSelectionDirty()&&!n&&!r||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=i,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){const i=e!==this.editorActiveLine,r=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;!this.isSelectionDirty()&&!i&&!r||(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{const 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=>{const{onHunkExpand:t,onLineClick:n,onLineNumberClick:i,onTokenClick:r,onMergeConflictActionClick:o}=this.options;t==null&&n==null&&i==null&&o==null&&r==null||this.options.onGutterUtilityClick!=null&&bt(e.composedPath())||(xe(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))};handlePointerMove=e=>{if(e.pointerType!=="mouse")return;const{lineHoverHighlight:t="disabled",onLineEnter:n,onLineLeave:i,onTokenEnter:r,onTokenLeave:o,enableGutterUtility:s=!1}=this.options;t==="disabled"&&!s&&n==null&&i==null&&r==null&&o==null||(xe(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))};handlePointerLeave=e=>{const{__debugPointerEvents:t}=this.options;if(xe(t,"move","FileDiff.DEBUG.handlePointerLeave: no event"),this.hoveredLine==null&&this.hoveredToken==null){xe(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}){const{__debugPointerEvents:n}=this.options,i=t.composedPath();xe(n,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:i});const r=this.resolvePointerTarget(i);xe(n,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",r);const{onLineClick:o,onLineNumberClick:s,onLineEnter:l,onLineLeave:a,onTokenClick:h,onTokenEnter:d,onTokenLeave:c,onHunkExpand:u,onMergeConflictActionClick:p}=this.options;switch(e){case"move":{const g=sn(r)&&this.hoveredLine?.lineElement===r.lineElement;Pt(r)&&this.hoveredToken?.tokenElement===r.tokenElement||(this.hoveredToken!=null&&(c?.(this.hoveredToken,t),this.clearHoveredToken()),Pt(r)&&(this.setHoveredToken(this.toTokenEventBaseProps(r)),d?.(this.hoveredToken,t))),g||(this.hoveredLine!=null&&(a?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),sn(r)?(this.setHoveredLine(this.toEventBaseProps(r)),this.placeUtility(),l?.({...this.hoveredLine,event:t})):this.placeUtility());break}case"click":{if(r==null)break;if(Zo(r)&&p!=null){p(r);break}if(Xo(r)&&u!=null){u(r.hunkIndex,r.all||t.shiftKey?"both":r.direction,r.all||t.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!sn(r))break;Pt(r)&&h!=null&&h(this.toTokenEventBaseProps(r),t);const g=this.toEventBaseProps(r);s!=null&&r.numberColumn?s({...g,event:t}):o?.({...g,event:t});break}}}syncPointerListeners(e){const{__debugPointerEvents:t,lineHoverHighlight:n="disabled",onLineClick:i,onLineNumberClick:r,onLineEnter:o,onLineLeave:s,onTokenClick:l,onTokenEnter:a,onTokenLeave:h,onHunkExpand:d,onMergeConflictActionClick:c,enableGutterUtility:u=!1,enableLineSelection:p=!1,onGutterUtilityClick:g}=this.options,S=g!=null,C=n!=="disabled"||i!=null||r!=null||o!=null||s!=null||l!=null||a!=null||h!=null||d!=null||c!=null||u||p||S;C&&!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,xe(t,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{const m=[];return(t==="both"||t==="click")&&(i!=null&&m.push("onLineClick"),r!=null&&m.push("onLineNumberClick"),d!=null&&m.push("expandable hunk separators"),c!=null&&m.push("merge conflict actions")),m})()),xe(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),xe(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")):!C&&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);const b=this.pointerSession.mode==="selecting"||this.pointerSession.mode==="pendingSingleLineUnselect",f=this.pointerSession.mode==="gutterSelecting";(!p&&b||!S&&f)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;const{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,i=e!=null,r=t!=null||n;i&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!i&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),r&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!r&&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;const t=e.composedPath();bt(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!=="mouse"&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){const{enableLineSelection:t=!1}=this.options;if(!t)return;const n=this.resolveSelectionInfo(e,{source:"event-path",requireNumberColumn:!0});if(n==null)return;const{pre:i}=this;if(i==null)return;const{lineNumber:r,eventSide:o,lineIndex:s}=n;if(e.shiftKey&&this.selectedRange!=null){const l=this.getIndexesFromSelection(this.selectedRange,i.getAttribute("data-diff-type")==="split");if(l==null)return;const a=l.start<=l.end?s>=l.start:s<=l.end;this.selectionAnchor={lineNumber:a?this.selectedRange.start:this.selectedRange.end,side:a?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===r&&this.selectedRange?.end===r){const l={lineNumber:r,side:o};this.selectionAnchor=l,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:l,pending:l},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:r,side:o},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){const{onGutterUtilityClick:t}=this.options;if(t==null)return;const n=this.currentSelectionEnds(),i=n?.bottom??this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),r=n?.top??i;i==null||r==null||(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:r,current:i},this.selectionAnchor={lineNumber:r.lineNumber,side:r.side},this.updateSelection(i.lineNumber,i.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();const 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();const 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();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;const n={lineNumber:t.lineNumber,side:t.eventSide};if(Yo(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=>{const{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{const{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();const i=this.resolveSelectionPoint(e,{source:"coordinates-first"});i!=null&&(n.current=i,this.updateSelection(i.lineNumber,i.side));const r=this.buildSelectedLineRange(n.anchor,n.current);t?.({...r}),this.selectionAnchor=void 0,this.notifySelectionEnd(r),this.notifySelectionCommitted(r),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){const{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==null&&(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==null&&(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){const t=document.createElement("div");t.innerHTML=te(Ko());const n=t.firstElementChild;if(!(n instanceof HTMLButtonElement))throw new Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");n.remove(),this.gutterUtilityButton=n}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;const t=this.resolvePointerTarget(e);nt(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){const e=this.currentSelectionEnds();if(e==null)return!1;const 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(){const e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){const t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},i=this.selectionPointRowIndex(t),r=this.selectionPointRowIndex(n);if(!(i==null||r==null))return i>r?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){const t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;const t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;const n=this.mode==="diff"?`${t[0]},${t[1]}`:`${t[0]}`,i=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(const r of i){if(!(r instanceof HTMLElement))continue;const o=this.resolvePointerTarget(St(r));if(nt(o)&&!(this.mode==="diff"&&e.side!=null&&o.side!==e.side))return o}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){this.pointerSession.mode==="pendingSingleLineUnselect"&&(this.pointerSession={mode:"idle"})}selectionInfoFromPath(e,t){const n=this.resolvePointerTarget(e);if(nt(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){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionInfoFromPath(n,t.requireNumberColumn):void 0}selectionPointFromPath(e){const t=this.resolvePointerTarget(e);if(nt(t))return{lineNumber:t.lineNumber,side:this.mode==="diff"?t.side:void 0}}resolveSelectionPoint(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionPointFromPath(n):void 0}resolveSelectionPath(e,t){const n=t.excludeUtility!==!1;switch(t.source){case"event-path":return this.pathFromEventPath(e.composedPath(),n);case"coordinates-first":{const i=this.pathFromCoordinates(e,n);return i!==void 0?i??void 0:this.pathFromEventPath(e.composedPath(),n)}}}pathFromCoordinates(e,t){const n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&bt(e))){for(const n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){const n=St(e);if(t&&bt(n))return;const i=es(e);return i!=null?St(i):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){const t=ns(ts(e));if(t==null)return;const n=this.targetForSelectionPoint(t);return n!=null?St(n.lineElement):void 0}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;const t=this.pre?.getRootNode(),n=Xn(t)?t:Xn(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){const{getLineIndex:n}=this.options;return n!=null?n(e,t):[e-1,e-1]}getCurrentSelectionRange(){return this.proposedSelectedRange!==void 0?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){const i=this.getCurrentSelectionRange();let r;if(e==null)r=null;else{const o=this.selectionAnchor?.side??t,s=this.selectionAnchor?.lineNumber??e;r=this.buildSelectionRange(s,e,o,t)}mn(i??void 0,r??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=r:(this.selectedRange=r,Q(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;const n=this.getLineIndex(e.start,e.side),i=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&i!=null?{start:t?n[1]:n[0],end:t?i[1]:i[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;const i=this.getIndexesFromSelection(e.range,t);if(i==null)throw console.error({rowRange:i,range:e.range}),new Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return i}getLineRenderColumns(e,t,n,i){if(this.pre==null||t==null&&i==null)return[];const{children:r}=this.pre;if(r.length>2)throw console.error(r),new Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");const o=[];for(const s of r){const l=s.hasAttribute("data-deletions")?"deletions":s.hasAttribute("data-additions")?"additions":void 0,a=e!=null&&t!=null&&(e.highlightSide==null||l==null||e.highlightSide===l),h=n!=null&&i!=null&&(n.highlightSide==null||l==null||n.highlightSide===l);if(!a&&!h)continue;const[d,c]=s.children;if(!(d instanceof HTMLElement)||!(c instanceof HTMLElement))throw new Error("InteractionManager.renderSelection: missing gutter or content element");if(c.children.length!==d.children.length)throw new Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");o.push({content:c,gutter:d,renderEditorActiveLine:h,renderSelectedLines:a})}return o}renderSelection=()=>{Bt(this.renderSelection);const e=this.getSelectionRenderState();if(this.pre==null)return;const{editorActiveLine:t,selectedLines:n}=e,i=!Zn(this.renderedSelectedLinesState,n),r=!Zn(this.renderedEditorActiveLineState,t);if(!i&&!r)return;i&&(this.renderedSelectedLinesState=void 0),r&&(this.renderedEditorActiveLineState=void 0);const o=this.pre.getAttribute("data-diff-type")==="split",s=i?this.resolveLineRenderRange(n,o,"selected-lines"):void 0,l=r?this.resolveLineRenderRange(t,o,"editor-active-line"):void 0,a=this.getLineRenderColumns(i?n:void 0,s,r?t:void 0,l),h=n.range==null||a.some(S=>S.renderSelectedLines),d=t.range==null||a.some(S=>S.renderEditorActiveLine);if(i)for(const S of this.pre.querySelectorAll("[data-selected-line]"))S.removeAttribute("data-selected-line");if(r)for(const S of this.pre.querySelectorAll("[data-editor-active-line]"))S.removeAttribute("data-editor-active-line");const c=s==null?void 0:Math.min(s.start,s.end),u=s==null?void 0:Math.max(s.start,s.end),p=c===u,g=l?.start;for(const S of a){const{content:C,gutter:b,renderEditorActiveLine:f,renderSelectedLines:m}=S,y=Math.max(m?u??-1/0:-1/0,f?g??-1/0:-1/0),v=C.children.length;for(let k=0;k<v;k++){const x=C.children[k],T=b.children[k];if(!(x instanceof HTMLElement)||!(T instanceof HTMLElement))continue;const L=this.parseLineIndex(x,o);if((L??0)>y)break;if(L!=null){if(m&&c!=null&&u!=null&&L>=c&&L<=u){let A=p?"single":L===c?"first":L===u?"last":"";T.setAttribute("data-selected-line",A),n.lineNumberOnly||(x.setAttribute("data-selected-line",A),T.nextSibling instanceof HTMLElement&&x.nextSibling instanceof HTMLElement&&(x.nextSibling.hasAttribute("data-line-annotation")||x.nextSibling.hasAttribute("data-merge-conflict-actions"))&&(p?(A="last",x.setAttribute("data-selected-line","first")):L===c?A="":L===u&&x.setAttribute("data-selected-line",""),x.nextSibling.setAttribute("data-selected-line",A),T.nextSibling.setAttribute("data-selected-line",A)))}f&&L===g&&(T.setAttribute("data-editor-active-line",""),t.lineNumberOnly||x.setAttribute("data-editor-active-line",""))}}}i&&h&&(this.renderedSelectedLinesState=n),r&&d&&(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:i,tokenElement:r,tokenText:o}){return this.mode==="file"?{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:r,tokenText:o}:{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,side:i,tokenElement:r,tokenText:o}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,i){return{start:e,end:t,...n!=null?{side:n}:{},...n!==i&&i!=null?{endSide:i}:{}}}resolvePointerTarget(e){let t=!1,n,i,r,o,s,l,a,h,d,c;for(const p of e){if(!(p instanceof HTMLElement))continue;if(c==null&&p.hasAttribute("data-merge-conflict-action")){const b=p.getAttribute("data-merge-conflict-action")??void 0,f=p.getAttribute("data-merge-conflict-conflict-index")??void 0,m=f!=null?Number.parseInt(f,10):NaN;Jo(b)&&Number.isFinite(m)&&(c={kind:"merge-conflict-action",resolution:b,conflictIndex:m})}if(l==null&&p.hasAttribute("data-char")){l=p;const b=p.getAttribute("data-char");if(b!=null){const f=Number.parseInt(b,10);if(!Number.isNaN(f)){const m=p.textContent??"",y=f+m.length;(m.trim()!==""||this.options.enableTokenInteractionsOnWhitespace===!0)&&(a={tokenElement:l,lineCharStart:f,lineCharEnd:y,tokenText:m});continue}}}const g=s==null?p.getAttribute("data-column-number")??void 0:void 0;if(g!=null){s=p,d=Number.parseInt(g,10),t=!0,n=ei(p),o=p.getAttribute("data-line-index")??void 0;continue}const S=r==null?p.getAttribute("data-line")??void 0:void 0;if(S!=null){r=p,d=Number.parseInt(S,10),n=ei(p),o=p.getAttribute("data-line-index")??void 0;continue}if(h==null&&(p.hasAttribute("data-expand-button")||p.hasAttribute("data-unmodified-lines"))){h={hunkIndex:void 0,direction:p.hasAttribute("data-expand-up")?"up":p.hasAttribute("data-expand-down")?"down":"both",all:p.hasAttribute("data-expand-all-button")};continue}const C=h!=null?p.getAttribute("data-expand-index")??void 0:void 0;if(h!=null&&C!=null){const b=Number.parseInt(C,10);Number.isNaN(b)||(h.hunkIndex=b);continue}if(i==null&&p.hasAttribute("data-code")){i=p;break}}if(c!=null)return c;if(h?.hunkIndex!=null)return{type:"line-info",hunkIndex:h.hunkIndex,direction:h.direction,all:h.all};if(r??=o!=null?Qn(i,`[data-line][data-line-index="${o}"]`):void 0,s??=o!=null?Qn(i,`[data-column-number][data-line-index="${o}"]`):void 0,i==null||r==null||s==null||n==null||d==null||Number.isNaN(d))return;const u=this.parseLineIndex(r,this.isSplitDiff());return a!=null?this.mode==="file"?{kind:"token",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:void 0,splitLineIndex:u,...a}:{kind:"token",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:Jn(n,i),splitLineIndex:u,...a}:this.mode==="file"?{kind:"line",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:void 0,splitLineIndex:u}:{kind:"line",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:Jn(n,i),splitLineIndex:u}}isSplitDiff(){return this.pre?.getAttribute("data-diff-type")==="split"}parseLineIndex(e,t){const n=(e.getAttribute("data-line-index")??"").split(",").map(i=>Number.parseInt(i,10)).filter(i=>!Number.isNaN(i));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function Gt({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:i,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:h,onTokenLeave:d,renderGutterUtility:c,__debugPointerEvents:u,enableLineSelection:p,controlledSelection:g,onLineSelected:S,onLineSelectionStart:C,onLineSelectionChange:b,onLineSelectionEnd:f},m,y,v){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:Qo({enableGutterUtility:t,renderGutterUtility:c,onGutterUtilityClick:i}),usesCustomGutterUtility:c!=null,lineHoverHighlight:n,onGutterUtilityClick:i,onHunkExpand:m,onMergeConflictActionClick:v,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:h,onTokenLeave:d,__debugPointerEvents:u,enableLineSelection:p,controlledSelection:g,onLineSelected:S,onLineSelectionStart:C,onLineSelectionChange:b,onLineSelectionEnd:f,getLineIndex:y}}function Qo({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw new Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return e??!1}function nt(e){return e!=null&&"kind"in e&&e.kind==="line"}function Pt(e){return e!=null&&"kind"in e&&e.kind==="token"}function sn(e){return nt(e)||Pt(e)}function Xo(e){return"type"in e&&e.type==="line-info"}function Zo(e){return"kind"in e&&e.kind==="merge-conflict-action"}function Jo(e){return e==="current"||e==="incoming"||e==="both"}function Qn(e,t){const n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function St(e){const t=[];let n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function es(e){const t=e.closest("[data-line], [data-column-number]");if(t instanceof HTMLElement)return t;const n=e.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(n instanceof HTMLElement))return;const i=n.previousElementSibling;return i instanceof HTMLElement&&(i.hasAttribute("data-line")||i.hasAttribute("data-column-number"))?i:void 0}function ts(e){const t=e.closest('[slot^="annotation-"]');if(t instanceof HTMLElement)return t.getAttribute("slot")??void 0;if(e instanceof HTMLElement){const n=e.getAttribute("name")??void 0;return n!=null&&n.startsWith("annotation-")?n:void 0}}function ns(e){if(e==null)return;const t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;const n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function Xn(e){return e!=null&&typeof e.elementFromPoint=="function"}function is(e,t){return e===t||mn(e??void 0,t??void 0)}function Zn(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&is(e?.range??null,t.range)}function Jn(e,t){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return t.hasAttribute("data-deletions")?"deletions":"additions"}}function ei(e){const 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 xe(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;break}console.log(...n)}var Yi=class ke{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){const t=ke.resizeObserver??new ResizeObserver(ke.handleSharedResizeEntries);return ke.resizeObserver=t,t}static handleSharedResizeEntries(t){const n=new Map;for(const i of t){const r=ke.managersByElement.get(i.target);if(r==null)continue;const o=n.get(r);o==null?n.set(r,[i]):o.push(i)}for(const[i,r]of n)i.handleResizeEntries(r)}observedNodes=new Map;setup(t,{disableAnnotations:n,columnVariables:i="apply"}){const r=new Set,o=i==="apply";let s=0;const l=new Map(this.observedNodes);this.observedNodes.clear();for(const a of t.children){if(s===2)break;const h=(()=>{if(a instanceof HTMLElement&&a.tagName==="CODE")return a})();if(h==null)continue;s++;let d=l.get(h);if(d!=null&&d.type!=="code")throw new Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let c=h.firstElementChild;c instanceof HTMLElement||(c=null),d!=null?(this.observedNodes.set(h,d),l.delete(h),d.numberElement!==c?(d.numberElement!=null&&(this.unobserve(d.numberElement),l.delete(d.numberElement)),c!=null&&(this.observe(c),l.delete(c),this.observedNodes.set(c,d)),d.numberElement=c,d.numberWidth=0):d.numberElement!=null?(l.delete(d.numberElement),this.observedNodes.set(d.numberElement,d)):d.numberWidth=0,ss(d,o)):(d={type:"code",codeElement:h,numberElement:c,codeWidth:"auto",numberWidth:0,applyColumnVariables:o},this.observedNodes.set(h,d),this.observe(h),c!=null&&(this.observedNodes.set(c,d),this.observe(c)))}if(s>1&&!n){const a=t.querySelectorAll('[data-line-annotation*=","]'),h=new Map;for(const d of a){if(!(d instanceof HTMLElement))continue;const c=d.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(c)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:c,element:d});continue}let u=h.get(c);u==null&&(u=[],h.set(c,u)),u.push(d)}for(const[d,c]of h){if(c.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",d,c);continue}const[u,p]=c,g=u.firstElementChild,S=p.firstElementChild;if(!(u instanceof HTMLElement)||!(p instanceof HTMLElement)||!(g instanceof HTMLElement)||!(S instanceof HTMLElement))continue;let C=l.get(g);if(C!=null){this.observedNodes.set(g,C),this.observedNodes.set(S,C),l.delete(g),l.delete(S);continue}const b=g.getBoundingClientRect().height,f=S.getBoundingClientRect().height;C={type:"annotations",column1:{container:u,child:g,childHeight:b},column2:{container:p,child:S,childHeight:f},currentHeight:"auto"},r.add({child1:g,child2:S,item:C,newHeight:Math.max(b,f)})}for(const d of r)this.applyNewHeight(d.item,d.newHeight),this.observedNodes.set(d.child1,d.item),this.observedNodes.set(d.child2,d.item),this.observe(d.child1),this.observe(d.child2);r.clear()}for(const[a,h]of l)this.unobserve(a),h.type==="code"?as(h):ls(h);l.clear()}cleanUp(){for(const t of this.observedNodes.keys())this.unobserve(t);this.observedNodes.clear()}observe(t){const{managersByElement:n}=ke,i=n.get(t);if(i!==this){if(i!=null&&i!==this)throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");n.set(t,this),ke.getResizeObserver().observe(t)}}unobserve(t){const{managersByElement:n,resizeObserver:i}=ke,r=n.get(t);if(r!=null){if(r!==this)throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");n.delete(t),i?.unobserve(t),i!=null&&n.size===0&&(i.disconnect(),ke.resizeObserver=void 0)}}handleResizeEntries(t){const n=new Map,i=new Set;for(const r of t){const{target:o,borderBoxSize:s,contentBoxSize:l}=r;if(!(o instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",r);continue}const a=this.observedNodes.get(o);if(a==null){console.error("ResizeManager.handleResizeEntries: Not a valid observed node",r);continue}if(a.type==="annotations"){const h=(()=>{if(o===a.column1.child)return a.column1;if(o===a.column2.child)return a.column2})();if(h==null){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:a,target:o});continue}h.childHeight=s[0].blockSize,i.add(a)}else if(a.type==="code"){const h=n.get(a)??{},d=l[0].inlineSize;o===a.codeElement?h.codeInlineSize=d:o===a.numberElement&&(h.numberInlineSize=d),n.set(a,h)}}this.applyAnnotationUpdates(i),i.clear(),this.applyColumnUpdates(n),n.clear()}applyAnnotationUpdates(t){for(const n of t)this.applyNewHeight(n,Math.max(n.column1.childHeight,n.column2.childHeight))}applyColumnUpdates=t=>{for(const[n,i]of t){const r=i.codeInlineSize!=null?rs(i.codeInlineSize):n.codeWidth,o=i.numberInlineSize!=null?os(i.numberInlineSize):n.numberWidth,s=r!==n.codeWidth,l=o!==n.numberWidth;!s&&!l||(n.codeWidth=r,n.numberWidth=o,n.applyColumnVariables&&Qi(n,{codeWidthChanged:s,numberWidthChanged:l}))}};applyNewHeight(t,n){n!==t.currentHeight&&(t.currentHeight=Math.max(n,0),t.column1.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`),t.column2.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`))}};function rs(e){const t=Math.max(Math.floor(e),0);return t===0?"auto":t}function os(e){return Math.max(Math.ceil(e),0)}function ss(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?Qi(e,{codeWidthChanged:!0,numberWidthChanged:!0}):Xi(e))}function Qi(e,{codeWidthChanged:t,numberWidthChanged:n}){const{codeElement:i,codeWidth:r,numberWidth:o}=e;if(t&&i.style.setProperty("--diffs-column-width",`${typeof r=="number"?`${r}px`:"auto"}`),n&&i.style.setProperty("--diffs-column-number-width",`${o===0?"auto":`${o}px`}`),t||n&&r!=="auto"){const s=typeof r=="number"?Math.max(r-o,0):0;i.style.setProperty("--diffs-column-content-width",`${s>0?`${s}px`:"auto"}`)}}function Xi(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 as(e){e.codeElement.isConnected&&Xi(e)}function ls(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")}const lt=new Map,an=new Map,ds=new Map,vn=new Set;function jt(e){for(const t of Array.isArray(e)?e:[e])if(!(t==="text"||t==="ansi")&&!vn.has(t))return!1;return!0}function ti(e,t){e=Array.isArray(e)?e:[e];for(const n of e){if(vn.has(n.name))continue;let i=lt.get(n.name);i==null&&(i=n,lt.set(n.name,i)),vn.add(i.name),t.loadLanguageSync(i.data)}}function Zi(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}async function hs(e){if(Zi())throw new 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.`);const t=an.get(e);if(t!=null)return t;try{let n=ds.get(e);if(n==null&&Object.prototype.hasOwnProperty.call(jn,e)&&(n=jn[e]),n==null)throw new Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);const i=n().then(({default:r})=>{const o={name:e,data:r};return lt.has(e)||lt.set(e,o),o});return an.set(e,i),await i}finally{an.delete(e)}}function cs(e){return lt.get(e)??hs(e)}const bn=new Set;function dt(e){const t=[],n=new Set;for(const c of us(e.themes)){const u=Ji(c)?c.getThemes():[c];for(const p of u){if(n.has(p.name))throw new Error(`Theme collection already contains theme "${p.name}"`);n.add(p.name),t.push(p)}}const i=Object.freeze([...t]),r=Object.freeze(i.filter(c=>c.colorScheme==="light")),o=Object.freeze(i.filter(c=>c.colorScheme==="dark")),s=new Map(i.map(c=>[c.name,c])),l=Object.freeze(i.map(c=>c.name)),a=Object.freeze(r.map(c=>c.name)),h=Object.freeze(o.map(c=>c.name));function d(c){if(c==null)return i;const{colorScheme:u,collection:p}=c;return p==null?u==="light"?r:u==="dark"?o:i:i.filter(g=>g.collection!==p?!1:u==null||g.colorScheme===u)}return{getTheme(c){return s.get(c)},getThemes(c){return d(c)},getThemeNames(c){return c?.collection==null?c?.colorScheme==="light"?a:c?.colorScheme==="dark"?h:l:d(c).map(u=>u.name)},hasTheme(c){return s.has(c)},orderBy(c){return dt({themes:i.map((u,p)=>({descriptor:u,index:p})).sort((u,p)=>{const g=c(u.descriptor,p.descriptor);return g!==0?g:u.index-p.index}).map(u=>u.descriptor)})},pick(c){const u=[],p=new Set;for(const g of c){if(p.has(g))throw new Error(`Theme collection pick already includes theme "${g}"`);p.add(g);const S=s.get(g);if(S==null)throw new Error(`Theme collection does not contain theme "${g}"`);u.push(S)}return dt({themes:u})},registerInto(c){for(const u of i)c.registerThemeIfAbsent(u.name,u.load)}}}function us(e){return fs(e)?[e]:e}function fs(e){return Ji(e)||ps(e)}function ps(e){return typeof e.name=="string"&&typeof e.load=="function"}function Ji(e){return typeof e.getThemes=="function"}function er(e){return e!==null&&typeof e=="object"&&"default"in e?e.default:e}var gs=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name="DuplicateThemeError"}},ms=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name="UnregisteredThemeError"}},vs=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name="UnresolvedThemeError"}};function bs(){const e=new Map,t=new Map,n=new Map;let i=0;function r(b,f){if(e.has(b))throw new gs(b);e.set(b,f)}function o(b,f){return e.has(b)?!1:(e.set(b,f),!0)}function s(b){return e.has(b)}function l(b){const f=t.get(b);if(f!==void 0)return Promise.resolve(f);const m=n.get(b);if(m!==void 0)return m;const y=e.get(b);if(y===void 0)return Promise.reject(new ms(b));const v=i,k=y().then(x=>{const T=er(x);return v===i&&t.set(b,T),n.get(b)===k&&n.delete(b),T}).catch(x=>{throw n.get(b)===k&&n.delete(b),x});return n.set(b,k),k}function a(b){return Promise.all(b.map(f=>l(f)))}function h(b,f){t.set(b,f)}function d(b){for(const[f,m]of b)h(f,m)}function c(b){return t.get(b)}function u(b){const f=[];for(const m of b){const y=t.get(m);if(y===void 0)throw new vs(m);f.push(y)}return f}function p(b){return t.has(b)}function g(b){for(const f of b)if(!t.has(f))return!1;return!0}function S(b){const f=t.get(b);return f!==void 0?f:l(b)}function C(){i++,t.clear(),n.clear()}return{clearResolvedThemes:C,getResolvedOrResolveTheme:S,getResolvedTheme:c,getResolvedThemes:u,hasRegisteredTheme:s,hasResolvedTheme:p,hasResolvedThemes:g,registerTheme:r,registerThemeIfAbsent:o,resolveTheme:l,resolveThemes:a,seedResolvedTheme:h,seedResolvedThemes:d}}const we=bs();function ni(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let i;if(typeof n=="string"){if(i=we.getResolvedTheme(n),i==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else i=n,n=n.name,we.getResolvedTheme(n)==null&&we.seedResolvedTheme(n,i);bn.has(n)||(bn.add(n),t.loadThemeSync(i))}}function tr({name:e,load:t,colorScheme:n,collection:i,displayName:r}){return{name:e,colorScheme:n,collection:i,displayName:r,load:Ss(t)}}function Ss(e){return async()=>Do(er(await e()))}const ys="pierre",Cs=["pierre-dark","pierre-dark-soft","pierre-dark-vibrant","pierre-dark-protanopia-deuteranopia","pierre-dark-tritanopia"],nr=["pierre-light","pierre-light-soft","pierre-light-vibrant","pierre-light-protanopia-deuteranopia","pierre-light-tritanopia"],xs=[...nr,...Cs],Ls=new Set(nr);function ks(e){return Ls.has(e)?"light":"dark"}const ws={"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"},Es={"pierre-dark":()=>E(()=>import("./pierre-dark-CyvmCCZW.js"),[],import.meta.url),"pierre-dark-soft":()=>E(()=>import("./pierre-dark-soft-BHGpRqa4.js"),[],import.meta.url),"pierre-dark-vibrant":()=>E(()=>import("./pierre-dark-vibrant-BWBVywrn.js"),[],import.meta.url),"pierre-dark-protanopia-deuteranopia":()=>E(()=>import("./pierre-dark-protanopia-deuteranopia-Rgc0TwpF.js"),[],import.meta.url),"pierre-dark-tritanopia":()=>E(()=>import("./pierre-dark-tritanopia-Beq2gCRQ.js"),[],import.meta.url),"pierre-light":()=>E(()=>import("./pierre-light-480U9XYS.js"),[],import.meta.url),"pierre-light-soft":()=>E(()=>import("./pierre-light-soft-CVdyfjmI.js"),[],import.meta.url),"pierre-light-vibrant":()=>E(()=>import("./pierre-light-vibrant-DdTDNdfJ.js"),[],import.meta.url),"pierre-light-protanopia-deuteranopia":()=>E(()=>import("./pierre-light-protanopia-deuteranopia-CaVOBURG.js"),[],import.meta.url),"pierre-light-tritanopia":()=>E(()=>import("./pierre-light-tritanopia-B4_gpKOM.js"),[],import.meta.url)};function Rs(e){return tr({name:e,collection:ys,colorScheme:ks(e),displayName:ws[e],load:Es[e]})}const ir=dt({themes:xs.map(e=>Rs(e))}),Ts="shiki",rr=["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"],As=["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"],Hs=new Set(rr);function Ms(e){return Hs.has(e)?"light":"dark"}const Is={andromeeda:()=>E(()=>import("./andromeeda-C4gqWexZ.js"),[],import.meta.url),"aurora-x":()=>E(()=>import("./aurora-x-D-2ljcwZ.js"),[],import.meta.url),"ayu-dark":()=>E(()=>import("./ayu-dark-DYE7WIF3.js"),[],import.meta.url),"ayu-light":()=>E(()=>import("./ayu-light-BA47KaF1.js"),[],import.meta.url),"ayu-mirage":()=>E(()=>import("./ayu-mirage-32ctXXKs.js"),[],import.meta.url),"catppuccin-frappe":()=>E(()=>import("./catppuccin-frappe-CZL1YF0i.js"),[],import.meta.url),"catppuccin-latte":()=>E(()=>import("./catppuccin-latte-DH-8KZSZ.js"),[],import.meta.url),"catppuccin-macchiato":()=>E(()=>import("./catppuccin-macchiato-B7yYVSCf.js"),[],import.meta.url),"catppuccin-mocha":()=>E(()=>import("./catppuccin-mocha-Ct7hS0mc.js"),[],import.meta.url),"dark-plus":()=>E(()=>import("./dark-plus-C3mMm8J8.js"),[],import.meta.url),dracula:()=>E(()=>import("./dracula-BzJJZx-M.js"),[],import.meta.url),"dracula-soft":()=>E(()=>import("./dracula-soft-BXkSAIEj.js"),[],import.meta.url),"everforest-dark":()=>E(()=>import("./everforest-dark-BgDCqdQA.js"),[],import.meta.url),"everforest-light":()=>E(()=>import("./everforest-light-C8M2exoo.js"),[],import.meta.url),"github-dark":()=>E(()=>import("./github-dark-DHJKELXO.js"),[],import.meta.url),"github-dark-default":()=>E(()=>import("./github-dark-default-Cuk6v7N8.js"),[],import.meta.url),"github-dark-dimmed":()=>E(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[],import.meta.url),"github-dark-high-contrast":()=>E(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[],import.meta.url),"github-light":()=>E(()=>import("./github-light-DAi9KRSo.js"),[],import.meta.url),"github-light-default":()=>E(()=>import("./github-light-default-D7oLnXFd.js"),[],import.meta.url),"github-light-high-contrast":()=>E(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[],import.meta.url),"gruvbox-dark-hard":()=>E(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[],import.meta.url),"gruvbox-dark-medium":()=>E(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[],import.meta.url),"gruvbox-dark-soft":()=>E(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[],import.meta.url),"gruvbox-light-hard":()=>E(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[],import.meta.url),"gruvbox-light-medium":()=>E(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[],import.meta.url),"gruvbox-light-soft":()=>E(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[],import.meta.url),horizon:()=>E(()=>import("./horizon-BUw7H-hv.js"),[],import.meta.url),"horizon-bright":()=>E(()=>import("./horizon-bright-CUuTKBJd.js"),[],import.meta.url),houston:()=>E(()=>import("./houston-DnULxvSX.js"),[],import.meta.url),"kanagawa-dragon":()=>E(()=>import("./kanagawa-dragon-BuwD2xS4.js"),[],import.meta.url),"kanagawa-lotus":()=>E(()=>import("./kanagawa-lotus-C3DzagqV.js"),[],import.meta.url),"kanagawa-wave":()=>E(()=>import("./kanagawa-wave-DFGoQZhC.js"),[],import.meta.url),laserwave:()=>E(()=>import("./laserwave-DUszq2jm.js"),[],import.meta.url),"light-plus":()=>E(()=>import("./light-plus-B7mTdjB0.js"),[],import.meta.url),"material-theme":()=>E(()=>import("./material-theme-D5KoaKCx.js"),[],import.meta.url),"material-theme-darker":()=>E(()=>import("./material-theme-darker-BfHTSMKl.js"),[],import.meta.url),"material-theme-lighter":()=>E(()=>import("./material-theme-lighter-B0m2ddpp.js"),[],import.meta.url),"material-theme-ocean":()=>E(()=>import("./material-theme-ocean-CyktbL80.js"),[],import.meta.url),"material-theme-palenight":()=>E(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[],import.meta.url),"min-dark":()=>E(()=>import("./min-dark-CafNBF8u.js"),[],import.meta.url),"min-light":()=>E(()=>import("./min-light-CTRr51gU.js"),[],import.meta.url),monokai:()=>E(()=>import("./monokai-BRVnQi9A.js"),[],import.meta.url),"night-owl":()=>E(()=>import("./night-owl-C39BiMTA.js"),[],import.meta.url),"night-owl-light":()=>E(()=>import("./night-owl-light-CMTm3GFP.js"),[],import.meta.url),nord:()=>E(()=>import("./nord-Ddv68eIx.js"),[],import.meta.url),"one-dark-pro":()=>E(()=>import("./one-dark-pro-DVMEJ2y_.js"),[],import.meta.url),"one-light":()=>E(()=>import("./one-light-C3Wv6jpd.js"),[],import.meta.url),plastic:()=>E(()=>import("./plastic-3e1v2bzS.js"),[],import.meta.url),poimandres:()=>E(()=>import("./poimandres-CS3Unz2-.js"),[],import.meta.url),red:()=>E(()=>import("./red-hvxz__6c.js"),[],import.meta.url),"rose-pine":()=>E(()=>import("./rose-pine-5qJOZa0Y.js"),[],import.meta.url),"rose-pine-dawn":()=>E(()=>import("./rose-pine-dawn-zx0QlTCp.js"),[],import.meta.url),"rose-pine-moon":()=>E(()=>import("./rose-pine-moon-C9pEdX9L.js"),[],import.meta.url),"slack-dark":()=>E(()=>import("./slack-dark-BthQWCQV.js"),[],import.meta.url),"slack-ochin":()=>E(()=>import("./slack-ochin-DqwNpetd.js"),[],import.meta.url),"snazzy-light":()=>E(()=>import("./snazzy-light-Bw305WKR.js"),[],import.meta.url),"solarized-dark":()=>E(()=>import("./solarized-dark-CpvCGNkr.js"),[],import.meta.url),"solarized-light":()=>E(()=>import("./solarized-light-Dlz6yCKv.js"),[],import.meta.url),"synthwave-84":()=>E(()=>import("./synthwave-84-CbfX1IO0.js"),[],import.meta.url),"tokyo-night":()=>E(()=>import("./tokyo-night-hegEt444.js"),[],import.meta.url),vesper:()=>E(()=>import("./vesper-DRje8inN.js"),[],import.meta.url),"vitesse-black":()=>E(()=>import("./vitesse-black-Bkuqu6BP.js"),[],import.meta.url),"vitesse-dark":()=>E(()=>import("./vitesse-dark-D0r3Knsf.js"),[],import.meta.url),"vitesse-light":()=>E(()=>import("./vitesse-light-CVO1_9PV.js"),[],import.meta.url)};function ii(e){return tr({name:e,collection:Ts,colorScheme:Ms(e),load:Is[e]})}const or=dt({themes:Object.freeze([...rr.map(e=>ii(e)),...As.map(e=>ii(e))])});dt({themes:[ir,or]});function Ds(e){if(Zi())throw new 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(we.hasRegisteredTheme(e))return;const t=or.getTheme(e);if(t!=null){we.registerThemeIfAbsent(t.name,t.load);return}throw new Error(`No valid theme loader registered for "${e}"`)}function _s(e,t){if(t.name!==e)throw new Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function Ps(e){Ds(e);const t=await we.resolveTheme(e);return _s(e,t),t}function Fs(e){return we.getResolvedTheme(e)??Ps(e)}let be;async function sr({themes:e,langs:t,preferredHighlighter:n="shiki-js"}){be??=_o({themes:[],langs:["text"],engine:n==="shiki-wasm"?Fo(E(()=>import("./wasm-CG6Dc4jp.js"),[],import.meta.url)):Po()});const i=zs(be)?await be:be;be=i;const r=[];for(const s of t){if(s==="text"||s==="ansi")continue;const l=cs(s);"then"in l?r.push(l):ti(l,i)}const o=[];for(const s of e){const l=Fs(s);"then"in l?o.push(l):ni(l,be)}return(r.length>0||o.length>0)&&await Promise.all([Promise.all(r).then(s=>{ti(s,i)}),Promise.all(o).then(s=>{ni(s,i)})]),i}function ar(){if(be!=null&&!("then"in be))return be}function zs(e=be){return e!=null&&"then"in e}for(const e of ir.getThemes())we.registerThemeIfAbsent(e.name,e.load);function Vn(e=G){const t=[];return typeof e=="string"?t.push(e):(t.push(e.dark),t.push(e.light)),t}function st(e){for(const t of Vn(e))if(!bn.has(t))return!1;return!0}function Os(e){return we.hasResolvedThemes(e)}function Be(e,t){return pt(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function en(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 Sn(e){return F({tagName:"div",children:[F({tagName:"div",children:e.annotations?.map(t=>F({tagName:"slot",properties:{name:t}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function Ns(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 lr({fileOrDiff:e,mode:t,stickyHeader:n}){const i="type"in e?e:void 0,r={"data-diffs-header":t,"data-change-type":i?.type,"data-sticky":n?"":void 0};return F({tagName:"div",children:[t==="custom"?F({tagName:"slot",properties:{name:Fn}}):Us({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:i?.type??"file"}),...t==="custom"?[]:[Vs(i)]],properties:r})}function Us({name:e,prevName:t,iconType:n}){const i=[F({tagName:"slot",properties:{name:zn}}),Wt({name:Ns(n),properties:{"data-change-icon":n}})];return t!=null&&(i.push(F({tagName:"div",children:[F({tagName:"bdi",children:[Ce(t)]})],properties:{"data-prev-name":""}})),i.push(Wt({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),i.push(F({tagName:"div",children:[F({tagName:"bdi",children:[Ce(e)]})],properties:{"data-title":""}})),i.push(F({tagName:"slot",properties:{name:On}})),F({tagName:"div",children:i,properties:{"data-header-content":""}})}function Vs(e){const t=[];if(e!=null){let n=0,i=0;for(const r of e.hunks)n+=r.additionLines,i+=r.deletionLines;(i>0||n===0)&&t.push(F({tagName:"span",children:[Ce(`-${i}`)],properties:{"data-deletions-count":""}})),(n>0||i===0)&&t.push(F({tagName:"span",children:[Ce(`+${n}`)],properties:{"data-additions-count":""}}))}return t.push(F({tagName:"slot",properties:{name:Nn}})),F({tagName:"div",children:t,properties:{"data-metadata":""}})}function dr(e){return F({tagName:"pre",properties:Bs(e)})}function Bs({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:i,split:r,totalLines:o,type:s,customProperties:l}){return{...l,"data-diff":s==="diff"?"":void 0,"data-file":s==="file"?"":void 0,"data-diff-type":s==="diff"?r?"split":"single":void 0,"data-overflow":i,"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:${`${o}`.length}ch;`}}const $e=new Map,et={"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 he(e){if($e.has(e))return $e.get(e)??"text";if(et[e]!=null)return et[e];const t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if($e.has(t[1]))return $e.get(t[1])??"text";if(et[t[1]]!=null)return et[t[1]]??"text"}const n=e.match(/\.([^.]+)$/)?.[1]??"";return $e.has(n)?$e.get(n)??"text":et[n]??"text"}function hr(e,{theme:t,preferredHighlighter:n="shiki-js"}){return{langs:[e??"text"],themes:Vn(t),preferredHighlighter:n}}function Re(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function $s(e,t,n){const i=typeof n.lineInfo=="function"?n.lineInfo(t):n.lineInfo[t-1];if(i==null){const r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),new Error(r)}return e.tagName="div",e.properties["data-line"]=i.lineNumber,e.properties["data-alt-line"]=i.altLineNumber,e.properties["data-line-type"]=i.type,e.properties["data-line-index"]=i.lineIndex,e.children.length===0&&e.children.push(Ce(`
1
+ import{isServer as Di,createComponent as W,effect as Qe,setAttribute as le,insert as X,template as He,Portal as lo,use as _t,memo as _i,addEventListener as rt,setStyleProperty as Wn,delegateEvents as Pi,style as ho,classList as co}from"solid-js/web";import{getOwner as Fi,sharedConfig as uo,createRoot as zi,onCleanup as de,createMemo as Y,createEffect as Ee,on as fo,Switch as po,Match as mt,Show as ot,useContext as go,createContext as mo,onMount as Oi,createSignal as Pn,splitProps as Ni}from"solid-js";import{c as vo,m as bo,b as G,e as Ui,_ as E,C as Fn,H as zn,f as On,i as Nn,j as Vt,U as So,k as yo,l as Vi,T as Co,n as xo,E as Bi,o as Un,S as Lo,p as Fe,q as ce,r as Ne,s as Ue,v as ko,w as wo,a as $i,x as Eo,y as Ro,z as rn,A as on,F as To,G as Ao,I as Ho,J as vt,K as Mo,L as Io,N as Gn}from"./app-chat-kit-XCB_z28P.js";import{L as te,y as Do}from"./core-CXDtDTdc.js";import{b as jn,l as _o,m as Po}from"./engine-compile-BuAlGbRx.js";import{createOnigurumaEngine as Fo}from"./engine-oniguruma-C5ugeybA.js";import{createStore as zo}from"solid-js/store";function Oo(e,t=Fi()){let n=0,i,r;return()=>(n++,de(()=>{n--,queueMicrotask(()=>{!n&&r&&(r(),r=i=void 0)})}),r||zi(o=>i=e(r=o),t),i)}function No(e){const t=Fi(),n=Oo(e,t);return()=>Di||uo.context?zi(e,t):n()}function Wi(e,t=!1){if(Di)return()=>t;const n=window.matchMedia(e),[i,r]=vo(t,()=>n.matches);return bo(n,"change",()=>r(n.matches)),i}function Uo(e){return Wi("(prefers-color-scheme: dark)",e)}Uo.bind(void 0,!1);const Xe=new Set;let Ze=null;function Q(e){Xe.add(e),Ze??=requestAnimationFrame(Gi)}function Bt(e){Xe.delete(e)&&Xe.size===0&&Ze!=null&&(cancelAnimationFrame(Ze),Ze=null)}function Gi(e){const t=new Set(Xe);Xe.clear();for(const n of t)try{n(e)}catch(i){console.error(i)}Xe.size>0?Ze=requestAnimationFrame(Gi):Ze=null}function $t(e,t,n){if(e===t||e==null||t==null)return e===t;const i=new Set(n),r=Object.keys(e),o=new Set(Object.keys(t));for(const s of r)if(o.delete(s),!i.has(s)&&(!(s in t)||e[s]!==t[s]))return!1;for(const s of Array.from(o))if(!i.has(s))return!1;return!0}function pt(e,t){return e==null||t==null||typeof e=="string"||typeof t=="string"?e===t:e.dark===t.dark&&e.light===t.light}function ji(e,t){const n=e?.theme??G,i=t?.theme??G,r=qn(e),o=qn(t);return pt(n,i)&&$t(e,t,["theme","parseDiffOptions"])&&$t(r,o)}function qn(e){if(e!=null&&"parseDiffOptions"in e)return e.parseDiffOptions}function mn(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Kn({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:i=!1,fitPerfectlyOverscroll:r=0,overscrollSize:o}){const s=n+o*2,l=i?n+r*2:s;if(t=Math.max(t,l),s>=t||i){const d=Math.max(e-r,0),c=Math.min(e+l,t);return{top:d,bottom:Math.max(c,d)}}let a=e+n/2-s/2,h=a+s;return a<0&&(a=0),h>t&&(h=t),a=Math.floor(Math.max(a,0)),{top:a,bottom:Math.ceil(Math.max(Math.min(h,t),a))}}class Vo extends Ui{}const Bo=new Vo;function $o(e,t,n){return Bo.diff(e,t,n)}const Yn="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}";class Wo extends Ui{tokenize(t){const n=new RegExp(`(\\r?\\n)|[${Yn}]+|[^\\S\\n\\r]+|[^${Yn}]`,"ug");return t.match(n)||[]}}const Go=new Wo;function jo(e,t,n){return Go.diff(e,t,n)}function Se(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Ce(e){return{type:"text",value:e}}function F({tagName:e,children:t=[],properties:n={}}){return{type:"element",tagName:e,properties:n,children:t}}function Wt({name:e,width:t=16,height:n=16,properties:i}){return F({tagName:"svg",properties:{width:t,height:n,viewBox:"0 0 16 16",...i},children:[F({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function qo(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t;"children"in t?t=t.children[0]:t=null}}function Ke(e){return F({tagName:"div",properties:{"data-gutter":""},children:e})}function qi(e,t,n,i={}){return F({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...i},children:t!=null?[F({tagName:"span",properties:{"data-line-number-content":""},children:[Ce(`${t}`)]})]:void 0})}function oe(e,t,n){return F({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 Ko(){return F({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[Wt({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}function Yo(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function bt(e){for(const 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 Ki=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(),Bt(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();const{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){const n=!(e===this.selectedRange||mn(e??void 0,this.selectedRange??void 0)),i=t?.lineNumberOnly??!1,r=t?.activeLineSide!==this.selectedRangeHighlightSide||i!==this.selectedRangeLineNumberOnly;!this.isSelectionDirty()&&!n&&!r||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=i,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){const i=e!==this.editorActiveLine,r=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;!this.isSelectionDirty()&&!i&&!r||(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{const 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=>{const{onHunkExpand:t,onLineClick:n,onLineNumberClick:i,onTokenClick:r,onMergeConflictActionClick:o}=this.options;t==null&&n==null&&i==null&&o==null&&r==null||this.options.onGutterUtilityClick!=null&&bt(e.composedPath())||(xe(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))};handlePointerMove=e=>{if(e.pointerType!=="mouse")return;const{lineHoverHighlight:t="disabled",onLineEnter:n,onLineLeave:i,onTokenEnter:r,onTokenLeave:o,enableGutterUtility:s=!1}=this.options;t==="disabled"&&!s&&n==null&&i==null&&r==null&&o==null||(xe(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))};handlePointerLeave=e=>{const{__debugPointerEvents:t}=this.options;if(xe(t,"move","FileDiff.DEBUG.handlePointerLeave: no event"),this.hoveredLine==null&&this.hoveredToken==null){xe(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}){const{__debugPointerEvents:n}=this.options,i=t.composedPath();xe(n,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:i});const r=this.resolvePointerTarget(i);xe(n,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",r);const{onLineClick:o,onLineNumberClick:s,onLineEnter:l,onLineLeave:a,onTokenClick:h,onTokenEnter:d,onTokenLeave:c,onHunkExpand:u,onMergeConflictActionClick:p}=this.options;switch(e){case"move":{const g=sn(r)&&this.hoveredLine?.lineElement===r.lineElement;Pt(r)&&this.hoveredToken?.tokenElement===r.tokenElement||(this.hoveredToken!=null&&(c?.(this.hoveredToken,t),this.clearHoveredToken()),Pt(r)&&(this.setHoveredToken(this.toTokenEventBaseProps(r)),d?.(this.hoveredToken,t))),g||(this.hoveredLine!=null&&(a?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),sn(r)?(this.setHoveredLine(this.toEventBaseProps(r)),this.placeUtility(),l?.({...this.hoveredLine,event:t})):this.placeUtility());break}case"click":{if(r==null)break;if(Zo(r)&&p!=null){p(r);break}if(Xo(r)&&u!=null){u(r.hunkIndex,r.all||t.shiftKey?"both":r.direction,r.all||t.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!sn(r))break;Pt(r)&&h!=null&&h(this.toTokenEventBaseProps(r),t);const g=this.toEventBaseProps(r);s!=null&&r.numberColumn?s({...g,event:t}):o?.({...g,event:t});break}}}syncPointerListeners(e){const{__debugPointerEvents:t,lineHoverHighlight:n="disabled",onLineClick:i,onLineNumberClick:r,onLineEnter:o,onLineLeave:s,onTokenClick:l,onTokenEnter:a,onTokenLeave:h,onHunkExpand:d,onMergeConflictActionClick:c,enableGutterUtility:u=!1,enableLineSelection:p=!1,onGutterUtilityClick:g}=this.options,S=g!=null,C=n!=="disabled"||i!=null||r!=null||o!=null||s!=null||l!=null||a!=null||h!=null||d!=null||c!=null||u||p||S;C&&!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,xe(t,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{const m=[];return(t==="both"||t==="click")&&(i!=null&&m.push("onLineClick"),r!=null&&m.push("onLineNumberClick"),d!=null&&m.push("expandable hunk separators"),c!=null&&m.push("merge conflict actions")),m})()),xe(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),xe(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")):!C&&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);const b=this.pointerSession.mode==="selecting"||this.pointerSession.mode==="pendingSingleLineUnselect",f=this.pointerSession.mode==="gutterSelecting";(!p&&b||!S&&f)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;const{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,i=e!=null,r=t!=null||n;i&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!i&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),r&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!r&&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;const t=e.composedPath();bt(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!=="mouse"&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){const{enableLineSelection:t=!1}=this.options;if(!t)return;const n=this.resolveSelectionInfo(e,{source:"event-path",requireNumberColumn:!0});if(n==null)return;const{pre:i}=this;if(i==null)return;const{lineNumber:r,eventSide:o,lineIndex:s}=n;if(e.shiftKey&&this.selectedRange!=null){const l=this.getIndexesFromSelection(this.selectedRange,i.getAttribute("data-diff-type")==="split");if(l==null)return;const a=l.start<=l.end?s>=l.start:s<=l.end;this.selectionAnchor={lineNumber:a?this.selectedRange.start:this.selectedRange.end,side:a?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===r&&this.selectedRange?.end===r){const l={lineNumber:r,side:o};this.selectionAnchor=l,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:l,pending:l},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:r,side:o},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){const{onGutterUtilityClick:t}=this.options;if(t==null)return;const n=this.currentSelectionEnds(),i=n?.bottom??this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),r=n?.top??i;i==null||r==null||(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:r,current:i},this.selectionAnchor={lineNumber:r.lineNumber,side:r.side},this.updateSelection(i.lineNumber,i.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();const 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();const 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();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;const n={lineNumber:t.lineNumber,side:t.eventSide};if(Yo(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=>{const{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{const{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();const i=this.resolveSelectionPoint(e,{source:"coordinates-first"});i!=null&&(n.current=i,this.updateSelection(i.lineNumber,i.side));const r=this.buildSelectedLineRange(n.anchor,n.current);t?.({...r}),this.selectionAnchor=void 0,this.notifySelectionEnd(r),this.notifySelectionCommitted(r),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){const{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==null&&(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==null&&(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){const t=document.createElement("div");t.innerHTML=te(Ko());const n=t.firstElementChild;if(!(n instanceof HTMLButtonElement))throw new Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");n.remove(),this.gutterUtilityButton=n}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;const t=this.resolvePointerTarget(e);nt(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){const e=this.currentSelectionEnds();if(e==null)return!1;const 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(){const e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){const t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},i=this.selectionPointRowIndex(t),r=this.selectionPointRowIndex(n);if(!(i==null||r==null))return i>r?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){const t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;const t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;const n=this.mode==="diff"?`${t[0]},${t[1]}`:`${t[0]}`,i=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(const r of i){if(!(r instanceof HTMLElement))continue;const o=this.resolvePointerTarget(St(r));if(nt(o)&&!(this.mode==="diff"&&e.side!=null&&o.side!==e.side))return o}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){this.pointerSession.mode==="pendingSingleLineUnselect"&&(this.pointerSession={mode:"idle"})}selectionInfoFromPath(e,t){const n=this.resolvePointerTarget(e);if(nt(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){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionInfoFromPath(n,t.requireNumberColumn):void 0}selectionPointFromPath(e){const t=this.resolvePointerTarget(e);if(nt(t))return{lineNumber:t.lineNumber,side:this.mode==="diff"?t.side:void 0}}resolveSelectionPoint(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionPointFromPath(n):void 0}resolveSelectionPath(e,t){const n=t.excludeUtility!==!1;switch(t.source){case"event-path":return this.pathFromEventPath(e.composedPath(),n);case"coordinates-first":{const i=this.pathFromCoordinates(e,n);return i!==void 0?i??void 0:this.pathFromEventPath(e.composedPath(),n)}}}pathFromCoordinates(e,t){const n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&bt(e))){for(const n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){const n=St(e);if(t&&bt(n))return;const i=es(e);return i!=null?St(i):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){const t=ns(ts(e));if(t==null)return;const n=this.targetForSelectionPoint(t);return n!=null?St(n.lineElement):void 0}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;const t=this.pre?.getRootNode(),n=Xn(t)?t:Xn(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){const{getLineIndex:n}=this.options;return n!=null?n(e,t):[e-1,e-1]}getCurrentSelectionRange(){return this.proposedSelectedRange!==void 0?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){const i=this.getCurrentSelectionRange();let r;if(e==null)r=null;else{const o=this.selectionAnchor?.side??t,s=this.selectionAnchor?.lineNumber??e;r=this.buildSelectionRange(s,e,o,t)}mn(i??void 0,r??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=r:(this.selectedRange=r,Q(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;const n=this.getLineIndex(e.start,e.side),i=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&i!=null?{start:t?n[1]:n[0],end:t?i[1]:i[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;const i=this.getIndexesFromSelection(e.range,t);if(i==null)throw console.error({rowRange:i,range:e.range}),new Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return i}getLineRenderColumns(e,t,n,i){if(this.pre==null||t==null&&i==null)return[];const{children:r}=this.pre;if(r.length>2)throw console.error(r),new Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");const o=[];for(const s of r){const l=s.hasAttribute("data-deletions")?"deletions":s.hasAttribute("data-additions")?"additions":void 0,a=e!=null&&t!=null&&(e.highlightSide==null||l==null||e.highlightSide===l),h=n!=null&&i!=null&&(n.highlightSide==null||l==null||n.highlightSide===l);if(!a&&!h)continue;const[d,c]=s.children;if(!(d instanceof HTMLElement)||!(c instanceof HTMLElement))throw new Error("InteractionManager.renderSelection: missing gutter or content element");if(c.children.length!==d.children.length)throw new Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");o.push({content:c,gutter:d,renderEditorActiveLine:h,renderSelectedLines:a})}return o}renderSelection=()=>{Bt(this.renderSelection);const e=this.getSelectionRenderState();if(this.pre==null)return;const{editorActiveLine:t,selectedLines:n}=e,i=!Zn(this.renderedSelectedLinesState,n),r=!Zn(this.renderedEditorActiveLineState,t);if(!i&&!r)return;i&&(this.renderedSelectedLinesState=void 0),r&&(this.renderedEditorActiveLineState=void 0);const o=this.pre.getAttribute("data-diff-type")==="split",s=i?this.resolveLineRenderRange(n,o,"selected-lines"):void 0,l=r?this.resolveLineRenderRange(t,o,"editor-active-line"):void 0,a=this.getLineRenderColumns(i?n:void 0,s,r?t:void 0,l),h=n.range==null||a.some(S=>S.renderSelectedLines),d=t.range==null||a.some(S=>S.renderEditorActiveLine);if(i)for(const S of this.pre.querySelectorAll("[data-selected-line]"))S.removeAttribute("data-selected-line");if(r)for(const S of this.pre.querySelectorAll("[data-editor-active-line]"))S.removeAttribute("data-editor-active-line");const c=s==null?void 0:Math.min(s.start,s.end),u=s==null?void 0:Math.max(s.start,s.end),p=c===u,g=l?.start;for(const S of a){const{content:C,gutter:b,renderEditorActiveLine:f,renderSelectedLines:m}=S,y=Math.max(m?u??-1/0:-1/0,f?g??-1/0:-1/0),v=C.children.length;for(let k=0;k<v;k++){const x=C.children[k],T=b.children[k];if(!(x instanceof HTMLElement)||!(T instanceof HTMLElement))continue;const L=this.parseLineIndex(x,o);if((L??0)>y)break;if(L!=null){if(m&&c!=null&&u!=null&&L>=c&&L<=u){let A=p?"single":L===c?"first":L===u?"last":"";T.setAttribute("data-selected-line",A),n.lineNumberOnly||(x.setAttribute("data-selected-line",A),T.nextSibling instanceof HTMLElement&&x.nextSibling instanceof HTMLElement&&(x.nextSibling.hasAttribute("data-line-annotation")||x.nextSibling.hasAttribute("data-merge-conflict-actions"))&&(p?(A="last",x.setAttribute("data-selected-line","first")):L===c?A="":L===u&&x.setAttribute("data-selected-line",""),x.nextSibling.setAttribute("data-selected-line",A),T.nextSibling.setAttribute("data-selected-line",A)))}f&&L===g&&(T.setAttribute("data-editor-active-line",""),t.lineNumberOnly||x.setAttribute("data-editor-active-line",""))}}}i&&h&&(this.renderedSelectedLinesState=n),r&&d&&(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:i,tokenElement:r,tokenText:o}){return this.mode==="file"?{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:r,tokenText:o}:{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,side:i,tokenElement:r,tokenText:o}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,i){return{start:e,end:t,...n!=null?{side:n}:{},...n!==i&&i!=null?{endSide:i}:{}}}resolvePointerTarget(e){let t=!1,n,i,r,o,s,l,a,h,d,c;for(const p of e){if(!(p instanceof HTMLElement))continue;if(c==null&&p.hasAttribute("data-merge-conflict-action")){const b=p.getAttribute("data-merge-conflict-action")??void 0,f=p.getAttribute("data-merge-conflict-conflict-index")??void 0,m=f!=null?Number.parseInt(f,10):NaN;Jo(b)&&Number.isFinite(m)&&(c={kind:"merge-conflict-action",resolution:b,conflictIndex:m})}if(l==null&&p.hasAttribute("data-char")){l=p;const b=p.getAttribute("data-char");if(b!=null){const f=Number.parseInt(b,10);if(!Number.isNaN(f)){const m=p.textContent??"",y=f+m.length;(m.trim()!==""||this.options.enableTokenInteractionsOnWhitespace===!0)&&(a={tokenElement:l,lineCharStart:f,lineCharEnd:y,tokenText:m});continue}}}const g=s==null?p.getAttribute("data-column-number")??void 0:void 0;if(g!=null){s=p,d=Number.parseInt(g,10),t=!0,n=ei(p),o=p.getAttribute("data-line-index")??void 0;continue}const S=r==null?p.getAttribute("data-line")??void 0:void 0;if(S!=null){r=p,d=Number.parseInt(S,10),n=ei(p),o=p.getAttribute("data-line-index")??void 0;continue}if(h==null&&(p.hasAttribute("data-expand-button")||p.hasAttribute("data-unmodified-lines"))){h={hunkIndex:void 0,direction:p.hasAttribute("data-expand-up")?"up":p.hasAttribute("data-expand-down")?"down":"both",all:p.hasAttribute("data-expand-all-button")};continue}const C=h!=null?p.getAttribute("data-expand-index")??void 0:void 0;if(h!=null&&C!=null){const b=Number.parseInt(C,10);Number.isNaN(b)||(h.hunkIndex=b);continue}if(i==null&&p.hasAttribute("data-code")){i=p;break}}if(c!=null)return c;if(h?.hunkIndex!=null)return{type:"line-info",hunkIndex:h.hunkIndex,direction:h.direction,all:h.all};if(r??=o!=null?Qn(i,`[data-line][data-line-index="${o}"]`):void 0,s??=o!=null?Qn(i,`[data-column-number][data-line-index="${o}"]`):void 0,i==null||r==null||s==null||n==null||d==null||Number.isNaN(d))return;const u=this.parseLineIndex(r,this.isSplitDiff());return a!=null?this.mode==="file"?{kind:"token",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:void 0,splitLineIndex:u,...a}:{kind:"token",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:Jn(n,i),splitLineIndex:u,...a}:this.mode==="file"?{kind:"line",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:void 0,splitLineIndex:u}:{kind:"line",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:Jn(n,i),splitLineIndex:u}}isSplitDiff(){return this.pre?.getAttribute("data-diff-type")==="split"}parseLineIndex(e,t){const n=(e.getAttribute("data-line-index")??"").split(",").map(i=>Number.parseInt(i,10)).filter(i=>!Number.isNaN(i));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function Gt({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:i,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:h,onTokenLeave:d,renderGutterUtility:c,__debugPointerEvents:u,enableLineSelection:p,controlledSelection:g,onLineSelected:S,onLineSelectionStart:C,onLineSelectionChange:b,onLineSelectionEnd:f},m,y,v){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:Qo({enableGutterUtility:t,renderGutterUtility:c,onGutterUtilityClick:i}),usesCustomGutterUtility:c!=null,lineHoverHighlight:n,onGutterUtilityClick:i,onHunkExpand:m,onMergeConflictActionClick:v,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:h,onTokenLeave:d,__debugPointerEvents:u,enableLineSelection:p,controlledSelection:g,onLineSelected:S,onLineSelectionStart:C,onLineSelectionChange:b,onLineSelectionEnd:f,getLineIndex:y}}function Qo({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw new Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return e??!1}function nt(e){return e!=null&&"kind"in e&&e.kind==="line"}function Pt(e){return e!=null&&"kind"in e&&e.kind==="token"}function sn(e){return nt(e)||Pt(e)}function Xo(e){return"type"in e&&e.type==="line-info"}function Zo(e){return"kind"in e&&e.kind==="merge-conflict-action"}function Jo(e){return e==="current"||e==="incoming"||e==="both"}function Qn(e,t){const n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function St(e){const t=[];let n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function es(e){const t=e.closest("[data-line], [data-column-number]");if(t instanceof HTMLElement)return t;const n=e.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(n instanceof HTMLElement))return;const i=n.previousElementSibling;return i instanceof HTMLElement&&(i.hasAttribute("data-line")||i.hasAttribute("data-column-number"))?i:void 0}function ts(e){const t=e.closest('[slot^="annotation-"]');if(t instanceof HTMLElement)return t.getAttribute("slot")??void 0;if(e instanceof HTMLElement){const n=e.getAttribute("name")??void 0;return n!=null&&n.startsWith("annotation-")?n:void 0}}function ns(e){if(e==null)return;const t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;const n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function Xn(e){return e!=null&&typeof e.elementFromPoint=="function"}function is(e,t){return e===t||mn(e??void 0,t??void 0)}function Zn(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&is(e?.range??null,t.range)}function Jn(e,t){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return t.hasAttribute("data-deletions")?"deletions":"additions"}}function ei(e){const 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 xe(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;break}console.log(...n)}var Yi=class ke{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){const t=ke.resizeObserver??new ResizeObserver(ke.handleSharedResizeEntries);return ke.resizeObserver=t,t}static handleSharedResizeEntries(t){const n=new Map;for(const i of t){const r=ke.managersByElement.get(i.target);if(r==null)continue;const o=n.get(r);o==null?n.set(r,[i]):o.push(i)}for(const[i,r]of n)i.handleResizeEntries(r)}observedNodes=new Map;setup(t,{disableAnnotations:n,columnVariables:i="apply"}){const r=new Set,o=i==="apply";let s=0;const l=new Map(this.observedNodes);this.observedNodes.clear();for(const a of t.children){if(s===2)break;const h=(()=>{if(a instanceof HTMLElement&&a.tagName==="CODE")return a})();if(h==null)continue;s++;let d=l.get(h);if(d!=null&&d.type!=="code")throw new Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let c=h.firstElementChild;c instanceof HTMLElement||(c=null),d!=null?(this.observedNodes.set(h,d),l.delete(h),d.numberElement!==c?(d.numberElement!=null&&(this.unobserve(d.numberElement),l.delete(d.numberElement)),c!=null&&(this.observe(c),l.delete(c),this.observedNodes.set(c,d)),d.numberElement=c,d.numberWidth=0):d.numberElement!=null?(l.delete(d.numberElement),this.observedNodes.set(d.numberElement,d)):d.numberWidth=0,ss(d,o)):(d={type:"code",codeElement:h,numberElement:c,codeWidth:"auto",numberWidth:0,applyColumnVariables:o},this.observedNodes.set(h,d),this.observe(h),c!=null&&(this.observedNodes.set(c,d),this.observe(c)))}if(s>1&&!n){const a=t.querySelectorAll('[data-line-annotation*=","]'),h=new Map;for(const d of a){if(!(d instanceof HTMLElement))continue;const c=d.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(c)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:c,element:d});continue}let u=h.get(c);u==null&&(u=[],h.set(c,u)),u.push(d)}for(const[d,c]of h){if(c.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",d,c);continue}const[u,p]=c,g=u.firstElementChild,S=p.firstElementChild;if(!(u instanceof HTMLElement)||!(p instanceof HTMLElement)||!(g instanceof HTMLElement)||!(S instanceof HTMLElement))continue;let C=l.get(g);if(C!=null){this.observedNodes.set(g,C),this.observedNodes.set(S,C),l.delete(g),l.delete(S);continue}const b=g.getBoundingClientRect().height,f=S.getBoundingClientRect().height;C={type:"annotations",column1:{container:u,child:g,childHeight:b},column2:{container:p,child:S,childHeight:f},currentHeight:"auto"},r.add({child1:g,child2:S,item:C,newHeight:Math.max(b,f)})}for(const d of r)this.applyNewHeight(d.item,d.newHeight),this.observedNodes.set(d.child1,d.item),this.observedNodes.set(d.child2,d.item),this.observe(d.child1),this.observe(d.child2);r.clear()}for(const[a,h]of l)this.unobserve(a),h.type==="code"?as(h):ls(h);l.clear()}cleanUp(){for(const t of this.observedNodes.keys())this.unobserve(t);this.observedNodes.clear()}observe(t){const{managersByElement:n}=ke,i=n.get(t);if(i!==this){if(i!=null&&i!==this)throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");n.set(t,this),ke.getResizeObserver().observe(t)}}unobserve(t){const{managersByElement:n,resizeObserver:i}=ke,r=n.get(t);if(r!=null){if(r!==this)throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");n.delete(t),i?.unobserve(t),i!=null&&n.size===0&&(i.disconnect(),ke.resizeObserver=void 0)}}handleResizeEntries(t){const n=new Map,i=new Set;for(const r of t){const{target:o,borderBoxSize:s,contentBoxSize:l}=r;if(!(o instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",r);continue}const a=this.observedNodes.get(o);if(a==null){console.error("ResizeManager.handleResizeEntries: Not a valid observed node",r);continue}if(a.type==="annotations"){const h=(()=>{if(o===a.column1.child)return a.column1;if(o===a.column2.child)return a.column2})();if(h==null){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:a,target:o});continue}h.childHeight=s[0].blockSize,i.add(a)}else if(a.type==="code"){const h=n.get(a)??{},d=l[0].inlineSize;o===a.codeElement?h.codeInlineSize=d:o===a.numberElement&&(h.numberInlineSize=d),n.set(a,h)}}this.applyAnnotationUpdates(i),i.clear(),this.applyColumnUpdates(n),n.clear()}applyAnnotationUpdates(t){for(const n of t)this.applyNewHeight(n,Math.max(n.column1.childHeight,n.column2.childHeight))}applyColumnUpdates=t=>{for(const[n,i]of t){const r=i.codeInlineSize!=null?rs(i.codeInlineSize):n.codeWidth,o=i.numberInlineSize!=null?os(i.numberInlineSize):n.numberWidth,s=r!==n.codeWidth,l=o!==n.numberWidth;!s&&!l||(n.codeWidth=r,n.numberWidth=o,n.applyColumnVariables&&Qi(n,{codeWidthChanged:s,numberWidthChanged:l}))}};applyNewHeight(t,n){n!==t.currentHeight&&(t.currentHeight=Math.max(n,0),t.column1.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`),t.column2.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`))}};function rs(e){const t=Math.max(Math.floor(e),0);return t===0?"auto":t}function os(e){return Math.max(Math.ceil(e),0)}function ss(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?Qi(e,{codeWidthChanged:!0,numberWidthChanged:!0}):Xi(e))}function Qi(e,{codeWidthChanged:t,numberWidthChanged:n}){const{codeElement:i,codeWidth:r,numberWidth:o}=e;if(t&&i.style.setProperty("--diffs-column-width",`${typeof r=="number"?`${r}px`:"auto"}`),n&&i.style.setProperty("--diffs-column-number-width",`${o===0?"auto":`${o}px`}`),t||n&&r!=="auto"){const s=typeof r=="number"?Math.max(r-o,0):0;i.style.setProperty("--diffs-column-content-width",`${s>0?`${s}px`:"auto"}`)}}function Xi(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 as(e){e.codeElement.isConnected&&Xi(e)}function ls(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")}const lt=new Map,an=new Map,ds=new Map,vn=new Set;function jt(e){for(const t of Array.isArray(e)?e:[e])if(!(t==="text"||t==="ansi")&&!vn.has(t))return!1;return!0}function ti(e,t){e=Array.isArray(e)?e:[e];for(const n of e){if(vn.has(n.name))continue;let i=lt.get(n.name);i==null&&(i=n,lt.set(n.name,i)),vn.add(i.name),t.loadLanguageSync(i.data)}}function Zi(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}async function hs(e){if(Zi())throw new 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.`);const t=an.get(e);if(t!=null)return t;try{let n=ds.get(e);if(n==null&&Object.prototype.hasOwnProperty.call(jn,e)&&(n=jn[e]),n==null)throw new Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);const i=n().then(({default:r})=>{const o={name:e,data:r};return lt.has(e)||lt.set(e,o),o});return an.set(e,i),await i}finally{an.delete(e)}}function cs(e){return lt.get(e)??hs(e)}const bn=new Set;function dt(e){const t=[],n=new Set;for(const c of us(e.themes)){const u=Ji(c)?c.getThemes():[c];for(const p of u){if(n.has(p.name))throw new Error(`Theme collection already contains theme "${p.name}"`);n.add(p.name),t.push(p)}}const i=Object.freeze([...t]),r=Object.freeze(i.filter(c=>c.colorScheme==="light")),o=Object.freeze(i.filter(c=>c.colorScheme==="dark")),s=new Map(i.map(c=>[c.name,c])),l=Object.freeze(i.map(c=>c.name)),a=Object.freeze(r.map(c=>c.name)),h=Object.freeze(o.map(c=>c.name));function d(c){if(c==null)return i;const{colorScheme:u,collection:p}=c;return p==null?u==="light"?r:u==="dark"?o:i:i.filter(g=>g.collection!==p?!1:u==null||g.colorScheme===u)}return{getTheme(c){return s.get(c)},getThemes(c){return d(c)},getThemeNames(c){return c?.collection==null?c?.colorScheme==="light"?a:c?.colorScheme==="dark"?h:l:d(c).map(u=>u.name)},hasTheme(c){return s.has(c)},orderBy(c){return dt({themes:i.map((u,p)=>({descriptor:u,index:p})).sort((u,p)=>{const g=c(u.descriptor,p.descriptor);return g!==0?g:u.index-p.index}).map(u=>u.descriptor)})},pick(c){const u=[],p=new Set;for(const g of c){if(p.has(g))throw new Error(`Theme collection pick already includes theme "${g}"`);p.add(g);const S=s.get(g);if(S==null)throw new Error(`Theme collection does not contain theme "${g}"`);u.push(S)}return dt({themes:u})},registerInto(c){for(const u of i)c.registerThemeIfAbsent(u.name,u.load)}}}function us(e){return fs(e)?[e]:e}function fs(e){return Ji(e)||ps(e)}function ps(e){return typeof e.name=="string"&&typeof e.load=="function"}function Ji(e){return typeof e.getThemes=="function"}function er(e){return e!==null&&typeof e=="object"&&"default"in e?e.default:e}var gs=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name="DuplicateThemeError"}},ms=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name="UnregisteredThemeError"}},vs=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name="UnresolvedThemeError"}};function bs(){const e=new Map,t=new Map,n=new Map;let i=0;function r(b,f){if(e.has(b))throw new gs(b);e.set(b,f)}function o(b,f){return e.has(b)?!1:(e.set(b,f),!0)}function s(b){return e.has(b)}function l(b){const f=t.get(b);if(f!==void 0)return Promise.resolve(f);const m=n.get(b);if(m!==void 0)return m;const y=e.get(b);if(y===void 0)return Promise.reject(new ms(b));const v=i,k=y().then(x=>{const T=er(x);return v===i&&t.set(b,T),n.get(b)===k&&n.delete(b),T}).catch(x=>{throw n.get(b)===k&&n.delete(b),x});return n.set(b,k),k}function a(b){return Promise.all(b.map(f=>l(f)))}function h(b,f){t.set(b,f)}function d(b){for(const[f,m]of b)h(f,m)}function c(b){return t.get(b)}function u(b){const f=[];for(const m of b){const y=t.get(m);if(y===void 0)throw new vs(m);f.push(y)}return f}function p(b){return t.has(b)}function g(b){for(const f of b)if(!t.has(f))return!1;return!0}function S(b){const f=t.get(b);return f!==void 0?f:l(b)}function C(){i++,t.clear(),n.clear()}return{clearResolvedThemes:C,getResolvedOrResolveTheme:S,getResolvedTheme:c,getResolvedThemes:u,hasRegisteredTheme:s,hasResolvedTheme:p,hasResolvedThemes:g,registerTheme:r,registerThemeIfAbsent:o,resolveTheme:l,resolveThemes:a,seedResolvedTheme:h,seedResolvedThemes:d}}const we=bs();function ni(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let i;if(typeof n=="string"){if(i=we.getResolvedTheme(n),i==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else i=n,n=n.name,we.getResolvedTheme(n)==null&&we.seedResolvedTheme(n,i);bn.has(n)||(bn.add(n),t.loadThemeSync(i))}}function tr({name:e,load:t,colorScheme:n,collection:i,displayName:r}){return{name:e,colorScheme:n,collection:i,displayName:r,load:Ss(t)}}function Ss(e){return async()=>Do(er(await e()))}const ys="pierre",Cs=["pierre-dark","pierre-dark-soft","pierre-dark-vibrant","pierre-dark-protanopia-deuteranopia","pierre-dark-tritanopia"],nr=["pierre-light","pierre-light-soft","pierre-light-vibrant","pierre-light-protanopia-deuteranopia","pierre-light-tritanopia"],xs=[...nr,...Cs],Ls=new Set(nr);function ks(e){return Ls.has(e)?"light":"dark"}const ws={"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"},Es={"pierre-dark":()=>E(()=>import("./pierre-dark-CyvmCCZW.js"),[],import.meta.url),"pierre-dark-soft":()=>E(()=>import("./pierre-dark-soft-BHGpRqa4.js"),[],import.meta.url),"pierre-dark-vibrant":()=>E(()=>import("./pierre-dark-vibrant-BWBVywrn.js"),[],import.meta.url),"pierre-dark-protanopia-deuteranopia":()=>E(()=>import("./pierre-dark-protanopia-deuteranopia-Rgc0TwpF.js"),[],import.meta.url),"pierre-dark-tritanopia":()=>E(()=>import("./pierre-dark-tritanopia-Beq2gCRQ.js"),[],import.meta.url),"pierre-light":()=>E(()=>import("./pierre-light-480U9XYS.js"),[],import.meta.url),"pierre-light-soft":()=>E(()=>import("./pierre-light-soft-CVdyfjmI.js"),[],import.meta.url),"pierre-light-vibrant":()=>E(()=>import("./pierre-light-vibrant-DdTDNdfJ.js"),[],import.meta.url),"pierre-light-protanopia-deuteranopia":()=>E(()=>import("./pierre-light-protanopia-deuteranopia-CaVOBURG.js"),[],import.meta.url),"pierre-light-tritanopia":()=>E(()=>import("./pierre-light-tritanopia-B4_gpKOM.js"),[],import.meta.url)};function Rs(e){return tr({name:e,collection:ys,colorScheme:ks(e),displayName:ws[e],load:Es[e]})}const ir=dt({themes:xs.map(e=>Rs(e))}),Ts="shiki",rr=["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"],As=["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"],Hs=new Set(rr);function Ms(e){return Hs.has(e)?"light":"dark"}const Is={andromeeda:()=>E(()=>import("./andromeeda-C4gqWexZ.js"),[],import.meta.url),"aurora-x":()=>E(()=>import("./aurora-x-D-2ljcwZ.js"),[],import.meta.url),"ayu-dark":()=>E(()=>import("./ayu-dark-DYE7WIF3.js"),[],import.meta.url),"ayu-light":()=>E(()=>import("./ayu-light-BA47KaF1.js"),[],import.meta.url),"ayu-mirage":()=>E(()=>import("./ayu-mirage-32ctXXKs.js"),[],import.meta.url),"catppuccin-frappe":()=>E(()=>import("./catppuccin-frappe-CZL1YF0i.js"),[],import.meta.url),"catppuccin-latte":()=>E(()=>import("./catppuccin-latte-DH-8KZSZ.js"),[],import.meta.url),"catppuccin-macchiato":()=>E(()=>import("./catppuccin-macchiato-B7yYVSCf.js"),[],import.meta.url),"catppuccin-mocha":()=>E(()=>import("./catppuccin-mocha-Ct7hS0mc.js"),[],import.meta.url),"dark-plus":()=>E(()=>import("./dark-plus-C3mMm8J8.js"),[],import.meta.url),dracula:()=>E(()=>import("./dracula-BzJJZx-M.js"),[],import.meta.url),"dracula-soft":()=>E(()=>import("./dracula-soft-BXkSAIEj.js"),[],import.meta.url),"everforest-dark":()=>E(()=>import("./everforest-dark-BgDCqdQA.js"),[],import.meta.url),"everforest-light":()=>E(()=>import("./everforest-light-C8M2exoo.js"),[],import.meta.url),"github-dark":()=>E(()=>import("./github-dark-DHJKELXO.js"),[],import.meta.url),"github-dark-default":()=>E(()=>import("./github-dark-default-Cuk6v7N8.js"),[],import.meta.url),"github-dark-dimmed":()=>E(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[],import.meta.url),"github-dark-high-contrast":()=>E(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[],import.meta.url),"github-light":()=>E(()=>import("./github-light-DAi9KRSo.js"),[],import.meta.url),"github-light-default":()=>E(()=>import("./github-light-default-D7oLnXFd.js"),[],import.meta.url),"github-light-high-contrast":()=>E(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[],import.meta.url),"gruvbox-dark-hard":()=>E(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[],import.meta.url),"gruvbox-dark-medium":()=>E(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[],import.meta.url),"gruvbox-dark-soft":()=>E(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[],import.meta.url),"gruvbox-light-hard":()=>E(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[],import.meta.url),"gruvbox-light-medium":()=>E(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[],import.meta.url),"gruvbox-light-soft":()=>E(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[],import.meta.url),horizon:()=>E(()=>import("./horizon-BUw7H-hv.js"),[],import.meta.url),"horizon-bright":()=>E(()=>import("./horizon-bright-CUuTKBJd.js"),[],import.meta.url),houston:()=>E(()=>import("./houston-DnULxvSX.js"),[],import.meta.url),"kanagawa-dragon":()=>E(()=>import("./kanagawa-dragon-BuwD2xS4.js"),[],import.meta.url),"kanagawa-lotus":()=>E(()=>import("./kanagawa-lotus-C3DzagqV.js"),[],import.meta.url),"kanagawa-wave":()=>E(()=>import("./kanagawa-wave-DFGoQZhC.js"),[],import.meta.url),laserwave:()=>E(()=>import("./laserwave-DUszq2jm.js"),[],import.meta.url),"light-plus":()=>E(()=>import("./light-plus-B7mTdjB0.js"),[],import.meta.url),"material-theme":()=>E(()=>import("./material-theme-D5KoaKCx.js"),[],import.meta.url),"material-theme-darker":()=>E(()=>import("./material-theme-darker-BfHTSMKl.js"),[],import.meta.url),"material-theme-lighter":()=>E(()=>import("./material-theme-lighter-B0m2ddpp.js"),[],import.meta.url),"material-theme-ocean":()=>E(()=>import("./material-theme-ocean-CyktbL80.js"),[],import.meta.url),"material-theme-palenight":()=>E(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[],import.meta.url),"min-dark":()=>E(()=>import("./min-dark-CafNBF8u.js"),[],import.meta.url),"min-light":()=>E(()=>import("./min-light-CTRr51gU.js"),[],import.meta.url),monokai:()=>E(()=>import("./monokai-BRVnQi9A.js"),[],import.meta.url),"night-owl":()=>E(()=>import("./night-owl-C39BiMTA.js"),[],import.meta.url),"night-owl-light":()=>E(()=>import("./night-owl-light-CMTm3GFP.js"),[],import.meta.url),nord:()=>E(()=>import("./nord-Ddv68eIx.js"),[],import.meta.url),"one-dark-pro":()=>E(()=>import("./one-dark-pro-DVMEJ2y_.js"),[],import.meta.url),"one-light":()=>E(()=>import("./one-light-C3Wv6jpd.js"),[],import.meta.url),plastic:()=>E(()=>import("./plastic-3e1v2bzS.js"),[],import.meta.url),poimandres:()=>E(()=>import("./poimandres-CS3Unz2-.js"),[],import.meta.url),red:()=>E(()=>import("./red-hvxz__6c.js"),[],import.meta.url),"rose-pine":()=>E(()=>import("./rose-pine-5qJOZa0Y.js"),[],import.meta.url),"rose-pine-dawn":()=>E(()=>import("./rose-pine-dawn-zx0QlTCp.js"),[],import.meta.url),"rose-pine-moon":()=>E(()=>import("./rose-pine-moon-C9pEdX9L.js"),[],import.meta.url),"slack-dark":()=>E(()=>import("./slack-dark-BthQWCQV.js"),[],import.meta.url),"slack-ochin":()=>E(()=>import("./slack-ochin-DqwNpetd.js"),[],import.meta.url),"snazzy-light":()=>E(()=>import("./snazzy-light-Bw305WKR.js"),[],import.meta.url),"solarized-dark":()=>E(()=>import("./solarized-dark-CpvCGNkr.js"),[],import.meta.url),"solarized-light":()=>E(()=>import("./solarized-light-Dlz6yCKv.js"),[],import.meta.url),"synthwave-84":()=>E(()=>import("./synthwave-84-CbfX1IO0.js"),[],import.meta.url),"tokyo-night":()=>E(()=>import("./tokyo-night-hegEt444.js"),[],import.meta.url),vesper:()=>E(()=>import("./vesper-DRje8inN.js"),[],import.meta.url),"vitesse-black":()=>E(()=>import("./vitesse-black-Bkuqu6BP.js"),[],import.meta.url),"vitesse-dark":()=>E(()=>import("./vitesse-dark-D0r3Knsf.js"),[],import.meta.url),"vitesse-light":()=>E(()=>import("./vitesse-light-CVO1_9PV.js"),[],import.meta.url)};function ii(e){return tr({name:e,collection:Ts,colorScheme:Ms(e),load:Is[e]})}const or=dt({themes:Object.freeze([...rr.map(e=>ii(e)),...As.map(e=>ii(e))])});dt({themes:[ir,or]});function Ds(e){if(Zi())throw new 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(we.hasRegisteredTheme(e))return;const t=or.getTheme(e);if(t!=null){we.registerThemeIfAbsent(t.name,t.load);return}throw new Error(`No valid theme loader registered for "${e}"`)}function _s(e,t){if(t.name!==e)throw new Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function Ps(e){Ds(e);const t=await we.resolveTheme(e);return _s(e,t),t}function Fs(e){return we.getResolvedTheme(e)??Ps(e)}let be;async function sr({themes:e,langs:t,preferredHighlighter:n="shiki-js"}){be??=_o({themes:[],langs:["text"],engine:n==="shiki-wasm"?Fo(E(()=>import("./wasm-CG6Dc4jp.js"),[],import.meta.url)):Po()});const i=zs(be)?await be:be;be=i;const r=[];for(const s of t){if(s==="text"||s==="ansi")continue;const l=cs(s);"then"in l?r.push(l):ti(l,i)}const o=[];for(const s of e){const l=Fs(s);"then"in l?o.push(l):ni(l,be)}return(r.length>0||o.length>0)&&await Promise.all([Promise.all(r).then(s=>{ti(s,i)}),Promise.all(o).then(s=>{ni(s,i)})]),i}function ar(){if(be!=null&&!("then"in be))return be}function zs(e=be){return e!=null&&"then"in e}for(const e of ir.getThemes())we.registerThemeIfAbsent(e.name,e.load);function Vn(e=G){const t=[];return typeof e=="string"?t.push(e):(t.push(e.dark),t.push(e.light)),t}function st(e){for(const t of Vn(e))if(!bn.has(t))return!1;return!0}function Os(e){return we.hasResolvedThemes(e)}function Be(e,t){return pt(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function en(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 Sn(e){return F({tagName:"div",children:[F({tagName:"div",children:e.annotations?.map(t=>F({tagName:"slot",properties:{name:t}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function Ns(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 lr({fileOrDiff:e,mode:t,stickyHeader:n}){const i="type"in e?e:void 0,r={"data-diffs-header":t,"data-change-type":i?.type,"data-sticky":n?"":void 0};return F({tagName:"div",children:[t==="custom"?F({tagName:"slot",properties:{name:Fn}}):Us({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:i?.type??"file"}),...t==="custom"?[]:[Vs(i)]],properties:r})}function Us({name:e,prevName:t,iconType:n}){const i=[F({tagName:"slot",properties:{name:zn}}),Wt({name:Ns(n),properties:{"data-change-icon":n}})];return t!=null&&(i.push(F({tagName:"div",children:[F({tagName:"bdi",children:[Ce(t)]})],properties:{"data-prev-name":""}})),i.push(Wt({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),i.push(F({tagName:"div",children:[F({tagName:"bdi",children:[Ce(e)]})],properties:{"data-title":""}})),i.push(F({tagName:"slot",properties:{name:On}})),F({tagName:"div",children:i,properties:{"data-header-content":""}})}function Vs(e){const t=[];if(e!=null){let n=0,i=0;for(const r of e.hunks)n+=r.additionLines,i+=r.deletionLines;(i>0||n===0)&&t.push(F({tagName:"span",children:[Ce(`-${i}`)],properties:{"data-deletions-count":""}})),(n>0||i===0)&&t.push(F({tagName:"span",children:[Ce(`+${n}`)],properties:{"data-additions-count":""}}))}return t.push(F({tagName:"slot",properties:{name:Nn}})),F({tagName:"div",children:t,properties:{"data-metadata":""}})}function dr(e){return F({tagName:"pre",properties:Bs(e)})}function Bs({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:i,split:r,totalLines:o,type:s,customProperties:l}){return{...l,"data-diff":s==="diff"?"":void 0,"data-file":s==="file"?"":void 0,"data-diff-type":s==="diff"?r?"split":"single":void 0,"data-overflow":i,"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:${`${o}`.length}ch;`}}const $e=new Map,et={"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 he(e){if($e.has(e))return $e.get(e)??"text";if(et[e]!=null)return et[e];const t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if($e.has(t[1]))return $e.get(t[1])??"text";if(et[t[1]]!=null)return et[t[1]]??"text"}const n=e.match(/\.([^.]+)$/)?.[1]??"";return $e.has(n)?$e.get(n)??"text":et[n]??"text"}function hr(e,{theme:t,preferredHighlighter:n="shiki-js"}){return{langs:[e??"text"],themes:Vn(t),preferredHighlighter:n}}function Re(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function $s(e,t,n){const i=typeof n.lineInfo=="function"?n.lineInfo(t):n.lineInfo[t-1];if(i==null){const r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),new Error(r)}return e.tagName="div",e.properties["data-line"]=i.lineNumber,e.properties["data-alt-line"]=i.altLineNumber,e.properties["data-line-type"]=i.type,e.properties["data-line-index"]=i.lineIndex,e.children.length===0&&e.children.push(Ce(`
2
2
  `)),e}const yt=Symbol("no-token"),ln=Symbol("multiple-tokens");function cr(e){const t=Ws(e);if(t!=null)return t;let n=yt;const i=[];let r=[],o;const s=()=>{if(r.length===0||o==null){r=[],o=void 0;return}if(r.length===1){const a=r[0];if(a?.type==="element"){Gs(a,o);for(const h of a.children)Ft(h)}else Ft(a);i.push(a),r=[],o=void 0;return}for(const a of r)Ft(a);i.push(F({tagName:"span",properties:{"data-char":o},children:r})),r=[],o=void 0},l=a=>{if(a!==yt){if(a===ln){n=ln;return}if(n===yt){n=a;return}n!==a&&(n=ln)}};for(const a of e.children){const h=a.type==="element"?cr(a):yt;if(l(h),typeof h!="number"){s(),i.push(a);continue}o!=null&&o!==h&&s(),o??=h,r.push(a)}return s(),e.children=i,n}function Ws(e){const t=e.properties["data-char"];if(typeof t=="number")return t}function Ft(e){if(e.type==="element"){e.properties["data-char"]=void 0;for(const t of e.children)Ft(t)}}function Gs(e,t){e.properties["data-char"]=t}function js(e={}){const{classPrefix:t="__shiki_",classSuffix:n="",classReplacer:i=l=>l}=e,r=new Map;function o(l){return Object.entries(l).map(([a,h])=>`${a}:${h}`).join(";")}function s(l){const a=typeof l=="string"?l:o(l);let h=t+qs(a)+n;return h=i(h),r.has(h)||r.set(h,typeof l=="string"?l:{...l}),h}return{name:"@shikijs/transformers:style-to-class",pre(l){if(!l.properties.style)return;const a=s(l.properties.style);delete l.properties.style,this.addClassToHast(l,a)},tokens(l){for(const a of l)for(const h of a){if(!h.htmlStyle)continue;const d=s(h.htmlStyle);h.htmlStyle={},h.htmlAttrs||={},h.htmlAttrs.class?h.htmlAttrs.class+=` ${d}`:h.htmlAttrs.class=d}},getClassRegistry(){return r},getCSS(){let l="";for(const[a,h]of r.entries())l+=`.${a}{${typeof h=="string"?h:o(h)}}`;return l},clearRegistry(){r.clear()}}}function qs(e,t=0){let n=3735928559^t,i=1103547991^t;for(let r=0,o;r<e.length;r++)o=e.charCodeAt(r),n=Math.imul(n^o,2654435761),i=Math.imul(i^o,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&i)+(n>>>0)).toString(36).slice(0,6)}function ur(e=!1,t=!1){const n={lineInfo:[]},i=[{line(r){return delete r.properties.class,r},pre(r){const o=qo(r),s=[];if(o!=null){let l=1;for(const a of o.children)a.type==="element"&&(e&&cr(a),s.push($s(a,l,n)),l++);o.children=s}return r},...e?{tokens(r){for(const o of r){let s=0;for(const l of o){const a=l;a.__lineChar??=s,s+=l.content.length}}},preprocess(r,o){o.mergeWhitespaces="never"},span(r,o,s,l,a){if(a?.offset!=null&&a.content!=null){const h=a.__lineChar;return h!=null&&(r.properties["data-char"]=h),r}return r}}:null}];return t&&i.push(Ks,ri),e&&i.push({line:r=>(r.type==="element"&&r.children.length===0&&r.children.push({type:"element",tagName:"br",properties:{},children:[]}),r)}),{state:n,transformers:i,toClass:ri}}const ri=js({classPrefix:"hl-"}),Ks={name:"token-style-normalizer",tokens(e){for(const t of e)for(const n of t){if(n.htmlStyle!=null)continue;const i={};n.color!=null&&(i.color=n.color),n.bgColor!=null&&(i["background-color"]=n.bgColor),n.fontStyle!=null&&n.fontStyle!==0&&((n.fontStyle&1)!==0&&(i["font-style"]="italic"),(n.fontStyle&2)!==0&&(i["font-weight"]="bold"),(n.fontStyle&4)!==0&&(i["text-decoration"]="underline")),Object.keys(i).length>0&&(n.htmlStyle=i)}}};function se(e){return`--${e==="token"?"diffs-token":"diffs"}-`}const Ys=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Qs=/^0(?:\.0+)?%?$/;function Xs(e){const t=e.indexOf("(");if(t<=0||!e.endsWith(")"))return;const n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;const i=e.slice(t+1,-1).trim();if(i.length===0)return;const r=i.lastIndexOf("/");if(r!==-1)return i.slice(r+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){const o=i.split(",");if(o.length===4)return o[3]?.trim()}}function ht(e){const t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;const n=t[1];let i,r=1;return n.length===3?i=n.split("").map(o=>o+o).join(""):n.length===6?i=n:(i=n.slice(0,6),r=parseInt(n.slice(6,8),16)/255),[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),r]}function ge(e){if(e==null)return null;const t=ht(e);if(t==null)return null;const n=t[0]/255,i=t[1]/255,r=t[2]/255,o=s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4;return .2126*o(n)+.7152*o(i)+.0722*o(r)}function fr(e,t){const[n,i]=e>t?[e,t]:[t,e];return(n+.05)/(i+.05)}function dh(e,t){if(t==null)return;const n=ht(e),i=ht(t);if(n==null||i==null)return;const[r,o,s,l]=n,[a,h,d]=i;return"#"+[Math.round(r*l+a*(1-l)),Math.round(o*l+h*(1-l)),Math.round(s*l+d*(1-l))].map(c=>c.toString(16).padStart(2,"0")).join("")}function oi(e){if(e==null)return!1;const t=e.trim().toLowerCase();if(t==="transparent"||Ys.test(t))return!0;const n=Xs(t);return n!=null&&Qs.test(n)}function hh(e,t){const n=ge(e);if(n!=null)return n<.4;const i=ge(t);return i!=null?i>.6:!1}function ch(e,t){if(e==null||t==null)return!1;if(e.trim().toLowerCase()===t.trim().toLowerCase())return!0;const n=ge(e),i=ge(t);return n==null||i==null?!1:Math.abs(n-i)<.06}function Zs(e,t,n){if(t==null||n==null)return!1;const i=ge(e),r=ge(t),o=ge(n);return i==null||r==null||o==null?!1:Math.abs(i-o)<Math.abs(i-r)}function uh(e,t){const n=ge(e),i=t.find(s=>s!=null&&s!=="");if(n==null)return i;let r,o=-1;for(const s of t){if(s==null||s==="")continue;const l=ge(s);if(l==null)continue;const a=fr(n,l);if(a>=3)return s;a>o&&(r=s,o=a)}return r??i}function fh(e,t){if(t==null)return e;const n=ht(e),i=ht(t),r=ge(t);if(n==null||i==null||r==null)return`color-mix(in srgb, ${e} 70%, ${t})`;const[o,s,l]=n,[a,h,d]=i;for(const c of[.6,.7,.8,.9]){const u="#"+[Math.round(o*c+a*(1-c)),Math.round(s*c+h*(1-c)),Math.round(l*c+d*(1-c))].map(g=>g.toString(16).padStart(2,"0")).join(""),p=ge(u);if(p!=null&&fr(r,p)>=4.5)return u}return e}const si=new WeakMap;function dn(e){const t=si.get(e);if(t!=null)return t;const n=e.colors??{},i={...n},r=n["editor.background"]??e.bg,o=n["editor.foreground"]??e.fg,s=n["sideBar.background"]??r,l=n["sideBar.foreground"]??o;me(i,"editor.background",r),me(i,"editor.foreground",o),me(i,"sideBar.background",s),me(i,"sideBar.foreground",l),me(i,"input.background",n["input.background"]??s),me(i,"sideBarSectionHeader.foreground",n["sideBarSectionHeader.foreground"]??l),me(i,"list.activeSelectionForeground",n["list.activeSelectionForeground"]??l),me(i,"gitDecoration.addedResourceForeground",hn(n["gitDecoration.addedResourceForeground"],n["terminal.ansiGreen"],n["editorGutter.addedBackground"])),me(i,"gitDecoration.modifiedResourceForeground",hn(n["gitDecoration.modifiedResourceForeground"],n["terminal.ansiBlue"],n["editorGutter.modifiedBackground"])),me(i,"gitDecoration.deletedResourceForeground",hn(n["gitDecoration.deletedResourceForeground"],n["terminal.ansiRed"],n["editorGutter.deletedBackground"]));const a=(oi(n["list.focusOutline"])?void 0:n["list.focusOutline"])??(oi(n.focusBorder)?void 0:n.focusBorder);a!=null?i["list.focusOutline"]=a:delete i["list.focusOutline"];const h=n["list.hoverBackground"];h!=null&&(Js(h,s)||Zs(h,s,l))&&delete i["list.hoverBackground"];const d=Object.freeze({...e,colors:Object.freeze(i)});return si.set(e,d),d}function me(e,t,n){n!=null&&n!==""&&(e[t]=n)}function hn(...e){for(const t of e)if(t!=null&&t!=="")return t}function Js(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function pr({theme:e=G,highlighter:t,prefix:n}){let i="";if(typeof e=="string"){const r=t.getTheme(e),o=dn(r);i+=`color:${o.fg};`,i+=`background-color:${o.bg};`,i+=`${se("global")}fg:${o.fg};`,i+=`${se("global")}bg:${o.bg};`,i+=cn(r,n)}else{let r=t.getTheme(e.dark),o=dn(r);i+=`${se("global")}dark:${o.fg};`,i+=`${se("global")}dark-bg:${o.bg};`,i+=cn(r,"dark"),r=t.getTheme(e.light),o=dn(r),i+=`${se("global")}light:${o.fg};`,i+=`${se("global")}light-bg:${o.bg};`,i+=cn(r,"light")}return i}function cn(e,t){t=t!=null?`${t}-`:"";let n="";const i=e.colors?.["gitDecoration.addedResourceForeground"]??e.colors?.["terminal.ansiGreen"];i!=null&&(n+=`${se("global")}${t}addition-color:${i};`);const r=e.colors?.["gitDecoration.deletedResourceForeground"]??e.colors?.["terminal.ansiRed"];r!=null&&(n+=`${se("global")}${t}deletion-color:${r};`);const o=e.colors?.["gitDecoration.modifiedResourceForeground"]??e.colors?.["terminal.ansiBlue"];return o!=null&&(n+=`${se("global")}${t}modified-color:${o};`),n}function yn(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t.children;"children"in t?t=t.children[0]:t=null}throw console.error(e),new Error("getLineNodes: Unable to find children")}const qt=10,Kt=13,ea=4,ta=40;function na(e){const t=[0];let n=e.indexOf("\r"),i=e.indexOf(`
3
3
  `),r=0,o=0;for(;n!==-1||i!==-1;){let s;if(n!==-1&&(i===-1||n<i)?i===n+1?(s=i+1,n=e.indexOf("\r",s),i=e.indexOf(`
4
4
  `,s)):(s=n+1,n=e.indexOf("\r",s)):(s=i+1,i=e.indexOf(`
@@ -1521,4 +1521,4 @@ import{isServer as Di,createComponent as W,effect as Qe,setAttribute as le,inser
1521
1521
  `;function qr(e){return{theme:G,themeType:"system",disableLineNumbers:!1,overflow:"wrap",diffStyle:e??"unified",diffIndicators:"bars",lineHoverHighlight:"both",disableBackground:!1,expansionLineCount:20,hunkSeparators:"line-info-basic",lineDiffType:e==="split"?"word-alt":"none",maxLineDiffLength:1e3,maxLineLengthForHighlighting:1e3,disableFileHeader:!0,unsafeCSS:fd}}const pd={"--diffs-font-family":"var(--font-family-mono)","--diffs-font-size":"var(--file-font-size, var(--font-size-small))","--diffs-line-height":"calc(var(--file-font-size, var(--font-size-small)) * 1.65)","--diffs-tab-size":2,"--diffs-font-features":"var(--font-family-mono--font-feature-settings)","--diffs-header-font-family":"var(--font-family-sans)","--diffs-gap-block":0,"--diffs-min-number-column-width":"2ch","--diffs-light-bg":"var(--background-stronger)","--diffs-dark-bg":"var(--background-stronger)"};function Kr(e){const t=e.closest("[data-line], [data-alt-line]");if(t instanceof HTMLElement){const i=t.dataset.lineType;if(i==="change-deletion")return"deletions";if(i==="change-addition"||i==="change-additions")return"additions"}const n=e.closest("[data-code]");return n instanceof HTMLElement&&n.hasAttribute("data-deletions")?"deletions":"additions"}function wi(e,t){const n=t.dataset.lineIndex;if(!n)return;const i=n.split(",").map(r=>parseInt(r,10)).filter(r=>!Number.isNaN(r));if(i.length!==0)return e&&i.length===2?i[1]:i[0]}function Ei(e,t,n,i){const r=Array.from(e.querySelectorAll(`[data-line="${n}"], [data-alt-line="${n}"]`)).filter(s=>s instanceof HTMLElement);if(r.length===0)return;const o=i??"additions";for(const s of r)if(Kr(s)===o||parseInt(s.dataset.altLine??"",10)===n)return wi(t,s)}function Ri(e,t){if(!t)return t;if(!e)return;const n=e.querySelector("[data-diff]");if(!(n instanceof HTMLElement))return;const i=n.dataset.diffType==="split",r=Ei(e,i,t.start,t.side),o=Ei(e,i,t.end,t.endSide??t.side);if(r===void 0||o===void 0)return e.querySelector("[data-line], [data-alt-line]")==null?void 0:null;if(r<=o)return t;const s=t.endSide??t.side,l={start:t.end,end:t.start};return s&&(l.side=s),t.endSide&&t.side&&(l.endSide=t.side),l}function gd(e){return e?e.start===e.end&&(e.endSide==null||e.endSide===e.side):!1}function md(e){if(e instanceof Range)return e;const t=new Range;return t.setStart(e.startContainer,e.startOffset),t.setEnd(e.endContainer,e.endOffset),t}function Yr(e,t){!e||!t||requestAnimationFrame(()=>{const n=e.getSelection?.()??window.getSelection();if(n)try{n.removeAllRanges(),n.addRange(t)}catch{}})}function vd(){let e="none",t,n=!1,i=!1;const r=()=>{e="none",t=void 0,n=!1};return{begin(o,s){if(!o){e="text";return}e="numbers",t=s,n=!1},track(o,s){return e!=="numbers"?!1:(o&1)===0?(r(),!0):(s!==void 0&&t!==void 0&&s!==t&&(n=!0),!0)},finish(){const o=e;return i=o==="numbers"&&n,r(),o},consume(o){const s=i&&!gd(o);return i=!1,s},reset(){i=!1,r()}}}function nn(e){if(e)return e instanceof HTMLElement?e:e.parentElement??void 0}function bd(e){const t=nn(e);if(!t)return;const n=t.closest("[data-line]");if(!(n instanceof HTMLElement))return;const i=parseInt(n.dataset.line??"",10);if(!Number.isNaN(i))return i}function Ti(e){const t=nn(e);if(!t)return;const n=t.closest("[data-line], [data-alt-line]");if(!(n instanceof HTMLElement))return;const i=parseInt(n.dataset.line??"",10);if(!Number.isNaN(i))return i;const r=parseInt(n.dataset.altLine??"",10);if(!Number.isNaN(r))return r}function Sd(e){const t=nn(e);if(!t)return;const n=t.closest("[data-code]");if(n instanceof HTMLElement)return n.hasAttribute("data-deletions")?"deletions":"additions"}function Qr(e){const t=e.root.getSelection?.()??window.getSelection();if(!t||t.isCollapsed)return;const n=t.getComposedRanges?.({shadowRoots:[e.root]})?.[0]??(t.rangeCount>0?t.getRangeAt(0):void 0),i=n?.startContainer??t.anchorNode,r=n?.endContainer??t.focusNode;if(!i||!r||!e.root.contains(i)||!e.root.contains(r))return;const o=e.lineForNode(i),s=e.lineForNode(r);if(o===void 0||s===void 0)return;const l=e.sideForNode?.(i),a=e.sideForNode?.(r),h=l??a,d={start:o,end:s};return h&&(d.side=h),a&&h&&a!==h&&(d.endSide=a),{range:d,text:e.preserveTextSelection&&n?md(n).cloneRange():void 0}}const Dt=new WeakMap,yd={lineHeight:24,hunkSeparatorHeight:24,spacing:0,paddingTop:0,paddingBottom:0};function Cd(e){return e==="auto"||e==="scroll"||e==="overlay"}function Ai(e){let t=e.parentElement;for(;t;){const n=getComputedStyle(t);if(Cd(n.overflowY))return t;t=t.parentElement}}function xd(e){if(typeof document>"u")return;const t=e.closest("[data-component='session-review']");if(t instanceof HTMLElement){const i=Ai(e)??t,r=t.querySelector("[data-slot='session-review-container']");return{key:t,root:i,content:r instanceof HTMLElement?r:void 0}}const n=Ai(e);if(n){const i=n.querySelector("[role='log']");return{key:n,root:n,content:i instanceof HTMLElement?i:void 0}}return{key:document,root:document,content:void 0}}function Ld(e){const t=xd(e);if(!t)return;let n=Dt.get(t.key);if(!n){const r=new jr;r.setup(t.root,t.content),n={virtualizer:r,refs:0},Dt.set(t.key,n)}n.refs+=1;let i=!1;return{virtualizer:n.virtualizer,release(){if(i)return;i=!0;const r=Dt.get(t.key);r&&(r.refs-=1,!(r.refs>0)&&(r.virtualizer.cleanUp(),Dt.delete(t.key)))}}}const kd=mo();function Xr(e){return go(kd)?.get(e)}const Zr=["mode","media","class","classList","annotations","selectedLines","search","onLineSelected","onLineSelectionEnd","onLineNumberSelectionEnd","onRendered","virtualize","preloadedDiff"],wd=["file","edit",...Zr],Ed=["fileDiff","before","after",...Zr];function Rd(e){if(!e.dataset.line)return;const t=parseInt(e.dataset.line,10);if(!Number.isNaN(t))return t}function Jr(e,t,n){const i=e.composedPath();let r=!1,o,s;for(const l of i)if(l instanceof HTMLElement&&(r=r||l.dataset.columnNumber!=null,o===void 0&&(o=t(l)),s===void 0&&n&&(s=n(l)),r&&o!==void 0&&(n==null||s!==void 0)))break;return{line:o,numberColumn:r,side:s}}function Td(e){const t=e.dataset.lineType;if(t==="change-deletion")return"deletions";if(t==="change-addition"||t==="change-additions")return"additions";if(e.dataset.code!=null)return e.hasAttribute("data-deletions")?"deletions":"additions"}function Ad(e){const t=nn(e);if(t)return Kr(t)}function ft(e){let t=e.parentElement;for(;t;){const n=getComputedStyle(t);if(n.overflowY==="auto"||n.overflowY==="scroll")return t;t=t.parentElement}}function Hd(e,t){const n=()=>{},i=ft(e);if(!i)return n;const r=t.getBoundingClientRect().height;if(!r)return n;const o=i.scrollTop,s=e.getBoundingClientRect().top-i.getBoundingClientRect().top,l=t.style.minHeight;t.style.minHeight=`${Math.ceil(r)}px`;let a=!1;return()=>{if(a)return;a=!0;const h=i.scrollTop!==o;if(t.style.minHeight=l,h||i.scrollTop!==o)return;const c=e.getBoundingClientRect().top-i.getBoundingClientRect().top-s;c&&(i.scrollTop+=c)}}const Jt=new Set;let Pe,ae,Hi=!1;function Md(e){return e instanceof HTMLElement?e.closest("[data-prevent-autofocus]")||e.isContentEditable?!0:/^(INPUT|TEXTAREA|SELECT|BUTTON)$/.test(e.tagName):!1}function Mi(e){if(e instanceof Node)for(const t of Jt){const n=t.element();if(n&&n.isConnected&&n.contains(e))return t}}function Id(){Hi||typeof window>"u"||(Hi=!0,window.addEventListener("keydown",e=>{if(e.defaultPrevented||Md(e.target)||!(e.metaKey||e.ctrlKey))return;const n=e.key.toLowerCase();if(n==="g"){const o=ae;if(!o||!o.isOpen())return;e.preventDefault(),e.stopPropagation(),o.next(e.shiftKey?-1:1);return}if(n!=="f")return;const i=ae;if(i&&i.isOpen()){e.preventDefault(),e.stopPropagation(),i.open();return}const r=Mi(document.activeElement)??Mi(e.target)??Pe??Array.from(Jt)[0];r&&(e.preventDefault(),e.stopPropagation(),r.open())},{capture:!0}))}function je(){const e=globalThis.CSS?.highlights;e&&(e.delete("mux-find"),e.delete("mux-find-current"))}function Ii(){const e=globalThis;return typeof e.Highlight=="function"&&e.CSS?.highlights!=null}function Dd(e){let t,n,i=[],r="overlay",o=[];const[s,l]=zo({open:!1,query:"",index:0,count:0,pos:{top:8,right:8}}),a=()=>s.open,h=()=>s.query,d=()=>s.index,c=()=>s.count,u=()=>s.pos,p=()=>{for(const w of i)w.removeEventListener("scroll",C);i=[]},g=()=>{const w=e.overlay();w&&(n!==void 0&&(cancelAnimationFrame(n),n=void 0),w.innerHTML="")},S=()=>{if(r!=="overlay"){g();return}const w=e.wrapper(),R=e.overlay();if(!w||!R||(g(),o.length===0))return;const M=w.getBoundingClientRect(),D=d(),H=document.createDocumentFragment();for(let I=0;I<o.length;I++){const P=o[I],O=I===D;for(const _ of Array.from(P.getClientRects())){if(!_.width||!_.height)continue;const z=document.createElement("div");z.style.position="absolute",z.style.left=`${Math.round(_.left-M.left)}px`,z.style.top=`${Math.round(_.top-M.top)}px`,z.style.width=`${Math.round(_.width)}px`,z.style.height=`${Math.round(_.height)}px`,z.style.borderRadius="2px",z.style.backgroundColor=O?"var(--surface-warning-strong)":"var(--surface-warning-base)",z.style.opacity=O?"0.55":"0.35",O&&(z.style.boxShadow="inset 0 0 0 1px var(--border-warning-base)"),H.appendChild(z)}}R.appendChild(H)};function C(){r==="overlay"&&a()&&n===void 0&&(n=requestAnimationFrame(()=>{n=void 0,S()}))}const b=()=>{if(r!=="overlay")return;const w=e.getRoot(),R=w?Array.from(w.querySelectorAll("[data-code]")).filter(M=>M instanceof HTMLElement):[];if(!(R.length===i.length&&R.every((M,D)=>M===i[D]))){p(),i=R;for(const M of i)M.addEventListener("scroll",C,{passive:!0})}},f=()=>{je(),g(),p(),o=[],l("count",0),l("index",0)},m=()=>{if(typeof window>"u")return;const w=e.wrapper();if(!w)return;const R=ft(w)??w,M=R.getBoundingClientRect(),D=parseFloat(getComputedStyle(R).getPropertyValue("--session-title-height")),H=Number.isNaN(D)?0:D;l("pos",{top:Math.round(M.top)+H-4,right:Math.round(window.innerWidth-M.right)+8})},y=(w,R)=>{const M=R.toLowerCase(),D=[],H=Array.from(w.querySelectorAll("[data-content] [data-line], [data-column-content]")).filter(I=>I instanceof HTMLElement);for(const I of H){const P=I.textContent;if(!P)continue;const O=P.toLowerCase();let _=O.indexOf(M);if(_===-1)continue;const z=[],N=[],q=document.createTreeWalker(I,NodeFilter.SHOW_TEXT);let B=q.nextNode(),Z=0;for(;B;)B instanceof Text&&(Z+=B.data.length,z.push(B),N.push(Z)),B=q.nextNode();if(z.length===0)continue;const ne=j=>{let $=0,K=N.length-1;for(;$<K;){const ie=$+K>>1;N[ie]>=j?K=ie:$=ie+1}const Me=$===0?0:N[$-1];return{node:z[$],offset:j-Me}};for(;_!==-1;){const j=ne(_),$=ne(_+R.length),K=document.createRange();K.setStart(j.node,j.offset),K.setEnd($.node,$.offset),D.push(K),_=O.indexOf(M,_+R.length)}}return D},v=w=>{const R=w.startContainer;(R instanceof Element?R:R.parentElement)?.scrollIntoView({block:"center",inline:"center"})},k=(w,R)=>{const M=globalThis,D=M.CSS?.highlights,H=M.Highlight;if(!D||typeof H!="function")return!1;D.delete("mux-find"),D.delete("mux-find-current");const I=w[R];I&&D.set("mux-find-current",new H(I));const P=w.filter((O,_)=>_!==R);return P.length>0&&D.set("mux-find",new H(...P)),!0},x=w=>{if(!a())return;const R=h().trim();if(!R){f();return}const M=e.getRoot();if(!M)return;r=Ii()?"highlights":"overlay";const D=y(M,R),H=D.length,I=w?.reset?0:d(),P=H?Math.min(I,H-1):0;o=D,l("count",H),l("index",P);const O=D[P];if(r==="highlights"){g(),p(),k(D,P)||(r="overlay",je(),b(),C()),w?.scroll&&O&&v(O);return}je(),b(),w?.scroll&&O&&v(O),C()},T=()=>{l("open",!1),l("query",""),f(),ae===U&&(ae=void 0)},L=()=>{ae&&ae!==U&&ae.close(),ae=U,Pe=U,a()||l("open",!0),requestAnimationFrame(()=>{x({scroll:!0}),t?.focus(),t?.select()})},A=w=>{if(!a())return;const R=c();if(R<=0)return;const M=(d()+w+R)%R;l("index",M);const D=o[M];if(D){if(r==="highlights"){if(!k(o,M)){r="overlay",x({reset:!0,scroll:!0});return}v(D);return}je(),b(),v(D),C()}},U={element:e.wrapper,isOpen:()=>a(),next:A,open:L,close:T};return Oi(()=>{r=Ii()?"highlights":"overlay",Id(),Jt.add(U),Pe||(Pe=U),de(()=>{Jt.delete(U),ae===U&&(ae=void 0,je()),Pe===U&&(Pe=void 0)})}),Ee(()=>{if(!a())return;const w=()=>m();requestAnimationFrame(w),window.addEventListener("resize",w,{passive:!0});const R=e.wrapper();if(!R)return;const M=ft(R)??R,D=typeof ResizeObserver>"u"?void 0:new ResizeObserver(()=>w());D?.observe(M),de(()=>{window.removeEventListener("resize",w),D?.disconnect()})}),de(()=>{p(),g(),ae===U&&(ae=void 0,je())}),{open:a,query:h,count:c,index:d,pos:u,setInput:w=>{t=w},setQuery:w=>{l("query",w),l("index",0),x({reset:!0,scroll:!0})},focus:L,close:T,next:A,refresh:w=>x(w),onPointerDown:()=>{Pe=U,e.wrapper()?.focus({preventScroll:!0})},onFocus:()=>{Pe=U},onInputKeyDown:w=>{if(w.key==="Escape"){w.preventDefault(),T();return}w.key==="Enter"&&(w.preventDefault(),A(w.shiftKey?-1:1))}}}function _d(){return{token:0}}function at(e){e.observer?.disconnect(),e.observer=void 0}function eo(e){if(!e)return;const t=e.querySelector("diffs-container");if(t instanceof HTMLElement)return t}function Pd(e){return eo(e)?.shadowRoot??void 0}function _n(e){if(!e||typeof document>"u")return;const t=document.documentElement.dataset.colorScheme;if(t==="dark"||t==="light"){e.dataset.colorScheme=t;return}e.removeAttribute("data-color-scheme")}function Fd(e){if(typeof document>"u")return()=>{};if(_n(e()),typeof MutationObserver>"u")return()=>{};const t=document.documentElement,n=new MutationObserver(()=>_n(e()));return n.observe(t,{attributes:!0,attributeFilter:["data-color-scheme"]}),()=>n.disconnect()}function zd(e){at(e.state),e.state.token+=1;const t=e.state.token,n=Math.max(0,e.settleFrames??0),i=()=>{const s=l=>{if(t===e.state.token){if(l<=0){e.onReady();return}requestAnimationFrame(()=>s(l-1))}};requestAnimationFrame(()=>s(n))},r=s=>{if(e.isReady(s)){i();return}typeof MutationObserver>"u"||(at(e.state),e.state.observer=new MutationObserver(()=>{t===e.state.token&&e.isReady(s)&&(at(e.state),i())}),e.state.observer.observe(s,{childList:!0,subtree:!0}))},o=e.getRoot();if(!o){if(typeof MutationObserver>"u")return;e.state.observer=new MutationObserver(()=>{if(t!==e.state.token)return;const s=e.getRoot();s&&r(s)}),e.state.observer.observe(e.container,{childList:!0,subtree:!0});return}r(o)}function Od(e){return e.composedPath().some(t=>t instanceof HTMLElement&&t.isContentEditable)}function to(e){let t,n,i,r,o,s,l,a=!1,h=null,d=!1;const c=_d(),u=vd(),[p,g]=Pn(0),S=()=>Pd(n),C=()=>eo(n),b=Dd({wrapper:()=>t,overlay:()=>i,getRoot:S}),f=()=>{r===void 0&&(r=requestAnimationFrame(()=>{r=void 0;const L=d;e.updateSelection(L),d&&(d=!1,e.onLineSelectionEnd(h))}))},m=()=>{o===void 0&&(o=requestAnimationFrame(()=>{o=void 0;const L=e.buildDragSelection();L&&e.setSelectedLines(L)}))},y=()=>{s=void 0,l=void 0,a=!1,e.onDragReset()},v=L=>{if(!e.enableLineSelection()||L.button!==0)return;const A=e.lineFromMouseEvent(L);if(A.numberColumn){u.begin(!0,A.line);return}Od(L)||A.line!==void 0&&(u.begin(!1,A.line),s=A.line,l=A.line,a=!1,e.onDragStart(A))},k=L=>{if(!e.enableLineSelection())return;const A=e.lineFromMouseEvent(L);if(!u.track(L.buttons,A.line)&&s!==void 0){if((L.buttons&1)===0){y(),u.finish();return}A.line!==void 0&&(l=A.line,a=!0,e.onDragMove(A),m())}},x=()=>{if(e.enableLineSelection()&&u.finish()!=="numbers"&&s!==void 0){if(!a){d=!1;const L=e.buildClickSelection();L&&e.setSelectedLines(L),e.onLineSelectionEnd(h),y();return}d=!0,m(),f(),y()}},T=()=>{if(!e.enableLineSelection()||s===void 0)return;const L=window.getSelection();!L||L.isCollapsed||f()};return Oi(()=>{de(Fd(C))}),Ee(()=>{e.setSelectedLines(e.selectedLines()??null)}),Ee(()=>{e.enableLineSelection()&&(n.addEventListener("mousedown",v),n.addEventListener("mousemove",k),window.addEventListener("mouseup",x),document.addEventListener("selectionchange",T),de(()=>{n.removeEventListener("mousedown",v),n.removeEventListener("mousemove",k),window.removeEventListener("mouseup",x),document.removeEventListener("selectionchange",T)}))}),de(()=>{at(c),r!==void 0&&cancelAnimationFrame(r),o!==void 0&&cancelAnimationFrame(o),r=void 0,o=void 0,s=void 0,l=void 0,a=!1,u.reset(),h=null,d=!1}),{get wrapper(){return t},set wrapper(L){t=L},get container(){return n},set container(L){n=L},get overlay(){return i},set overlay(L){i=L},get dragStart(){return s},get dragEnd(){return l},get lastSelection(){return h},set lastSelection(L){h=L},ready:c,bridge:u,rendered:p,setRendered:g,getRoot:S,getHost:C,find:b,scheduleSelectionUpdate:f}}function no(e){Ee(()=>{const t=e.search();if(!t)return;const n={focus:()=>e.find.focus()};t.register(n),de(()=>t.register(null))})}function io(e){const t=n=>{if(!e.normalize)return n;const i=e.normalize(n);return i!==void 0?i:n};return{onLineSelected:n=>{const i=t(n);e.viewer.lastSelection=i,e.props.onLineSelected?.(i)},onLineSelectionEnd:n=>{const i=t(n);e.viewer.lastSelection=i,e.props.onLineSelectionEnd?.(i),e.viewer.bridge.consume(i)&&requestAnimationFrame(()=>e.props.onLineNumberSelectionEnd?.(i))}}}function ro(e){let t;Ee(()=>{const n=e.viewer.rendered(),i=e.annotations(),r=e.current();if(r){if(!Nd(t,n,i)){t={generation:n,annotations:i};return}t={generation:n,annotations:i},r.setLineAnnotations(i),r.rerender(),requestAnimationFrame(()=>e.viewer.find.refresh({reset:!0}))}})}function Nd(e,t,n){return!e||e.generation!==t?n.length>0:e.annotations===n?!1:e.annotations.length>0||n.length>0}function oo(e){zd({state:e.viewer.ready,container:e.viewer.container,getRoot:e.viewer.getRoot,isReady:e.isReady,settleFrames:e.settleFrames,onReady:e.onReady})}function so(e){at(e.viewer.ready),e.current?.cleanUp();const t=e.create();e.assign(t),e.viewer.container.innerHTML="",e.draw(t),_n(e.viewer.getHost()),e.viewer.setRendered(n=>n+1),e.onReady()}var Ud=He('<div class="fixed z-50 flex h-8 items-center gap-2 rounded-md border border-border-base bg-background-base px-3 shadow-md"><input class="w-40 bg-transparent outline-none text-14-regular text-text-strong placeholder:text-text-weak"><div class="shrink-0 text-12-regular text-text-weak tabular-nums text-right"style=width:10ch></div><div class="flex items-center"><button type=button class="size-6 grid place-items-center rounded text-text-weak hover:bg-surface-base-hover hover:text-text-strong disabled:opacity-40 disabled:pointer-events-none"></button><button type=button class="size-6 grid place-items-center rounded text-text-weak hover:bg-surface-base-hover hover:text-text-strong disabled:opacity-40 disabled:pointer-events-none"></button></div><button type=button class="size-6 grid place-items-center rounded text-text-weak hover:bg-surface-base-hover hover:text-text-strong">');function Vd(e){const t=$i();return W(lo,{get mount(){return Mo()},get children(){var n=Ud(),i=n.firstChild,r=i.nextSibling,o=r.nextSibling,s=o.firstChild,l=s.nextSibling,a=o.nextSibling;n.$$pointerdown=d=>d.stopPropagation(),X(n,W(vt,{name:"magnifying-glass",size:"small",class:"text-text-weak shrink-0"}),i),i.$$keydown=d=>e.onKeyDown(d),i.$$input=d=>e.onInput(d.currentTarget.value);var h=e.setInput;return typeof h=="function"?_t(h,i):e.setInput=i,X(r,(()=>{var d=_i(()=>!!e.count());return()=>d()?`${e.index()+1}/${e.count()}`:"0/0"})()),rt(s,"click",e.onPrev,!0),X(s,W(vt,{name:"chevron-down",size:"small",class:"rotate-180"})),rt(l,"click",e.onNext,!0),X(l,W(vt,{name:"chevron-down",size:"small"})),rt(a,"click",e.onClose,!0),X(a,W(vt,{name:"close-small",size:"small"})),Qe(d=>{var c=`${e.pos().top}px`,u=`${e.pos().right}px`,p=t.t("ui.fileSearch.placeholder"),g=e.count()===0,S=t.t("ui.fileSearch.previousMatch"),C=e.count()===0,b=t.t("ui.fileSearch.nextMatch"),f=t.t("ui.fileSearch.close");return c!==d.e&&Wn(n,"top",d.e=c),u!==d.t&&Wn(n,"right",d.t=u),p!==d.a&&le(i,"placeholder",d.a=p),g!==d.o&&(s.disabled=d.o=g),S!==d.i&&le(s,"aria-label",d.i=S),C!==d.n&&(l.disabled=d.n=C),b!==d.s&&le(l,"aria-label",d.s=b),f!==d.h&&le(a,"aria-label",d.h=f),d},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),Qe(()=>i.value=e.query()),n}})}Pi(["pointerdown","input","keydown","click"]);var Bd=He('<div class="absolute inset-0 z-20 cursor-progress"aria-hidden=true>'),$d=He('<div data-component=file class="relative outline-none"tabindex=0><div></div><div class="pointer-events-none absolute inset-0 z-0">');function ao(e){return(()=>{var t=$d(),n=t.firstChild,i=n.nextSibling;return rt(t,"focus",e.viewer.find.onFocus),rt(t,"pointerdown",e.viewer.find.onPointerDown,!0),_t(r=>e.viewer.wrapper=r,t),X(t,W(ot,{get when(){return e.busy},get children(){return Bd()}}),n),X(t,W(ot,{get when(){return e.viewer.find.open()},get children(){return W(Vd,{get pos(){return e.viewer.find.pos},get query(){return e.viewer.find.query},get count(){return e.viewer.find.count},get index(){return e.viewer.find.index},get setInput(){return e.viewer.find.setInput},get onInput(){return e.viewer.find.setQuery},get onKeyDown(){return e.viewer.find.onInputKeyDown},get onClose(){return e.viewer.find.close},onPrev:()=>e.viewer.find.next(-1),onNext:()=>e.viewer.find.next(1)})}}),n),_t(r=>e.viewer.container=r,n),_t(r=>e.viewer.overlay=r,i),Qe(r=>{var o=e.mode,s=pd,l={...e.classList||{},[e.class??""]:!!e.class},a=e.busy||void 0;return o!==r.e&&le(t,"data-mode",r.e=o),r.t=ho(t,s,r.t),r.a=co(t,l,r.a),a!==r.o&&le(t,"aria-busy",r.o=a),r},{e:void 0,t:void 0,a:void 0,o:void 0}),t})()}Pi(["pointerdown"]);function Wd(e,t){let n,i;const r=()=>{n?.cleanUp(),n=void 0,i=void 0};return{get:()=>{if(!t()){r();return}if(typeof document>"u")return;const o=e();if(!o)return;const s=ft(o)??document;return n&&i===s||(r(),n=new jr,i=s,n.setup(s,s instanceof Document?void 0:o)),n},cleanup:r}}function Gd(e){let t,n;const i=()=>{t?.release(),t=void 0,n=void 0};return{get:()=>{const r=e();if(!r){i();return}const o=ft(r)??document;if(t&&n===o)return t.virtualizer;i();const s=Ld(r);if(s)return n=o,t=s,s.virtualizer},cleanup:i}}const jd=5e5,qd={lineDiffType:"none",maxLineDiffLength:0,tokenizeMaxLineLength:1};function qe(e){return typeof e?.contents=="string"?e.contents:""}function Kd(e){const[t,n]=Pn(!0);Io(t);let i,r,o,s,l;const[a,h]=Ni(e,Ed),d=Wi("(width < 768px)"),c=(f,m)=>{const y=i;if(!y)return;const v=Ri(s.getRoot(),f);if(v===void 0){s.lastSelection=f;return}s.lastSelection=v,y.setSelectedLines(v),Yr(m?.root,m?.text)};s=to({enableLineSelection:()=>e.enableLineSelection===!0,selectedLines:()=>a.selectedLines,onLineSelectionEnd:f=>a.onLineSelectionEnd?.(f),...{lineFromMouseEvent:f=>Jr(f,Ti,Td),setSelectedLines:c,updateSelection:f=>{const m=s.getRoot();if(!m)return;const y=Qr({root:m,lineForNode:Ti,sideForNode:Ad,preserveTextSelection:f});if(y){if(y.text){c(y.range,{root:m,text:y.text});return}c(y.range)}},buildDragSelection:()=>{if(s.dragStart===void 0||s.dragEnd===void 0)return;const f={start:s.dragStart,end:s.dragEnd};return r&&(f.side=r),o&&r&&o!==r&&(f.endSide=o),f},buildClickSelection:()=>{if(s.dragStart===void 0)return;const f={start:s.dragStart,end:s.dragStart};return r&&(f.side=r),f},onDragStart:f=>{r=f.side,o=f.side},onDragMove:f=>{o=f.side},onDragReset:()=>{r=void 0,o=void 0}}});const p=Gd(()=>a.virtualize===!1?void 0:s.container),g=Y(()=>{const[f,m]=a.fileDiff?[a.fileDiff.deletionLines.join(""),a.fileDiff.additionLines.join("")]:[qe(a.before),qe(a.after)];return Math.max(f.length,m.length)>jd}),S=io({viewer:s,props:a,normalize:f=>Ri(s.getRoot(),f)}),C=Y(()=>{const f={...qr(e.diffStyle),...h,...S},m=g()?{...f,...qd}:f;return d()?{...m,disableLineNumbers:!0}:m}),b=f=>{oo({viewer:s,isReady:m=>m.querySelector("[data-line]")!=null||(a.fileDiff?a.fileDiff.hunks.length===0:qe(a.before)===qe(a.after)),settleFrames:1,onReady:()=>{n(!1),f?.(),c(s.lastSelection),s.find.refresh({reset:!0}),a.onRendered?.()}})};return no({search:()=>a.search,find:s.find}),Ee(()=>{const f=C();n(!0);const m=Xr(g()?"unified":e.diffStyle),y=p.get(),v=qe(a.before),k=qe(a.after),x=Hd(s.wrapper,s.container);de(x),l||(l=document.createElement("diffs-container"),s.container.appendChild(l));const T=L=>g()?Gn(L):Gn(L,L.length);so({viewer:s,current:i,create:()=>y?new jl(f,y,yd,m):new Wr(f,m),assign:L=>{i=L},draw:L=>{if(a.fileDiff){L.render({fileContainer:l,fileDiff:a.fileDiff,lineAnnotations:[],containerWrapper:s.container});return}!a.before||!a.after||L.render({fileContainer:l,oldFile:{...a.before,contents:v,cacheKey:T(v)},newFile:{...a.after,contents:k,cacheKey:T(k)},lineAnnotations:[],containerWrapper:s.container})},onReady:()=>b(x)})}),ro({viewer:s,current:()=>i,annotations:()=>a.annotations??[]}),de(()=>{i?.cleanUp(),i=void 0,l=void 0,p.cleanup(),r=void 0,o=void 0}),W(ao,{mode:"diff",viewer:s,get class(){return a.class},get classList(){return a.classList}})}const Yd=5e5,Qd={...Un,lineHeight:24,spacing:0,paddingTop:0,paddingBottom:0};function Xd(e){const t=e;return typeof t=="string"?t:Array.isArray(t)?t.join(`
1522
1522
  `):t==null?"":String(t)}function Zd(e){const t=e;return typeof t=="string"?t.length:Array.isArray(t)?t.reduce((n,i)=>n+(typeof i=="string"?i.length+1:String(i).length+1),0):t==null?0:String(t).length}function Jd(e){if(e==="")return 0;const t=e.split(`
1523
1523
  `).length-(e.endsWith(`
1524
- `)?1:0);return Math.max(1,t)}function eh(e){let t,n;const[i,r]=Ni(e,wd),o=()=>Xd(i.file.contents),s=()=>Jd(o()),l=Y(()=>Zd(i.file.contents)),a=Y(()=>l()>Yd),h=Wd(()=>n.wrapper,a),d=f=>{const m=t;if(!m)return!1;if(a())return m.setSelectedLines(f),!0;const y=n.getRoot();if(!y)return!1;const v=s();if(y.querySelectorAll("[data-line]").length<v)return!1;if(!f)return m.setSelectedLines(null),!0;const k=Math.min(f.start,f.end),x=Math.max(f.start,f.end);if(k<1||x>v||!y.querySelector(`[data-line="${k}"]`)||!y.querySelector(`[data-line="${x}"]`))return m.setSelectedLines(null),!0;const T=f.endSide!=null?{start:f.start,end:f.end}:f.side!=="deletions"||y.querySelector("[data-deletions]")!=null?f:{start:f.start,end:f.end};return m.setSelectedLines(T),!0},c=f=>{n.lastSelection=f,d(f)};n=to({enableLineSelection:()=>e.enableLineSelection===!0,selectedLines:()=>i.selectedLines,onLineSelectionEnd:f=>i.onLineSelectionEnd?.(f),...{lineFromMouseEvent:f=>Jr(f,Rd),setSelectedLines:c,updateSelection:f=>{const m=n.getRoot();if(!m)return;const y=Qr({root:m,lineForNode:bd,sideForNode:Sd,preserveTextSelection:f});y&&(c(y.range),!(!f||!y.text)&&Yr(m,y.text))},buildDragSelection:()=>{if(!(n.dragStart===void 0||n.dragEnd===void 0))return{start:Math.min(n.dragStart,n.dragEnd),end:Math.max(n.dragStart,n.dragEnd)}},buildClickSelection:()=>{if(n.dragStart!==void 0)return{start:n.dragStart,end:n.dragStart}},onDragStart:()=>{},onDragMove:()=>{},onDragReset:()=>{}}});const p=io({viewer:n,props:i}),g=Y(()=>({...qr("unified"),...r,...p})),S=()=>{oo({viewer:n,isReady:f=>a()?f.querySelector("[data-line]")!=null:f.querySelectorAll("[data-line]").length>=s(),onReady:()=>{d(n.lastSelection),n.find.refresh({reset:!0}),i.onRendered?.()}})};no({search:()=>i.search,find:n.find}),Ee(()=>{const f=g(),m=Xr("unified"),y=a(),v=h.get();so({viewer:n,current:t,create:()=>y&&v?new Ea(f,v,Qd,m):new Dr(f,m),assign:k=>{t=k},draw:k=>{const x=o();k.render({file:typeof i.file.contents=="string"?i.file:{...i.file,contents:x},lineAnnotations:[],containerWrapper:n.container})},onReady:S})}),ro({viewer:n,current:()=>t,annotations:()=>i.annotations??[]});const[C,b]=Pn(!1);return Ee(()=>{const f=i.edit,m=n.rendered();if(!f?.enabled){b(!1);return}const y=t;if(!y||m===0)return;b(!1);let v,k=!1;E(async()=>{const{Editor:x}=await import("./index-DCZ3hf3T.js");return{Editor:x}},[],import.meta.url).then(({Editor:x})=>{if(k)return;v=new x({roundedSelection:!1,onChange:L=>{const A=L.contents;typeof A=="string"&&f.onChange(A)},onBlur:()=>f.onBlur?.(),onAttach:L=>{if(k)return;const A=f.focusOnAttach;A&&L.focus(A.lineNumber===void 0?{preventScroll:!0}:{preventScroll:!0,lineNumber:A.lineNumber}),f.onAttached?.()}}).edit(y),b(!0)}).catch(x=>{const T=x instanceof Error?x.message:String(x);f.onError?.(T)}),de(()=>{k=!0,v?.()})}),de(()=>{t?.cleanUp(),t=void 0,h.cleanup()}),W(ao,{mode:"text",viewer:n,get class(){return i.class},get classList(){return i.classList},get busy(){return _i(()=>i.edit?.enabled===!0)()&&!C()}})}function th(e){return e.mode==="text"?W(ki,{get media(){return e.media},fallback:()=>eh(e)}):W(ki,{get media(){return e.media},fallback:()=>Kd(e)})}const vh=Object.freeze(Object.defineProperty({__proto__:null,File:th},Symbol.toStringTag,{value:"Module"}));export{hh as a,dh as b,fr as c,fh as d,na as e,ph as f,gh as g,Zs as h,oi as i,Re as j,Bt as k,he as l,Ir as m,bt as n,vh as o,uh as p,Q as q,ge as r,ch as s};
1524
+ `)?1:0);return Math.max(1,t)}function eh(e){let t,n;const[i,r]=Ni(e,wd),o=()=>Xd(i.file.contents),s=()=>Jd(o()),l=Y(()=>Zd(i.file.contents)),a=Y(()=>l()>Yd),h=Wd(()=>n.wrapper,a),d=f=>{const m=t;if(!m)return!1;if(a())return m.setSelectedLines(f),!0;const y=n.getRoot();if(!y)return!1;const v=s();if(y.querySelectorAll("[data-line]").length<v)return!1;if(!f)return m.setSelectedLines(null),!0;const k=Math.min(f.start,f.end),x=Math.max(f.start,f.end);if(k<1||x>v||!y.querySelector(`[data-line="${k}"]`)||!y.querySelector(`[data-line="${x}"]`))return m.setSelectedLines(null),!0;const T=f.endSide!=null?{start:f.start,end:f.end}:f.side!=="deletions"||y.querySelector("[data-deletions]")!=null?f:{start:f.start,end:f.end};return m.setSelectedLines(T),!0},c=f=>{n.lastSelection=f,d(f)};n=to({enableLineSelection:()=>e.enableLineSelection===!0,selectedLines:()=>i.selectedLines,onLineSelectionEnd:f=>i.onLineSelectionEnd?.(f),...{lineFromMouseEvent:f=>Jr(f,Rd),setSelectedLines:c,updateSelection:f=>{const m=n.getRoot();if(!m)return;const y=Qr({root:m,lineForNode:bd,sideForNode:Sd,preserveTextSelection:f});y&&(c(y.range),!(!f||!y.text)&&Yr(m,y.text))},buildDragSelection:()=>{if(!(n.dragStart===void 0||n.dragEnd===void 0))return{start:Math.min(n.dragStart,n.dragEnd),end:Math.max(n.dragStart,n.dragEnd)}},buildClickSelection:()=>{if(n.dragStart!==void 0)return{start:n.dragStart,end:n.dragStart}},onDragStart:()=>{},onDragMove:()=>{},onDragReset:()=>{}}});const p=io({viewer:n,props:i}),g=Y(()=>({...qr("unified"),...r,...p})),S=()=>{oo({viewer:n,isReady:f=>a()?f.querySelector("[data-line]")!=null:f.querySelectorAll("[data-line]").length>=s(),onReady:()=>{d(n.lastSelection),n.find.refresh({reset:!0}),i.onRendered?.()}})};no({search:()=>i.search,find:n.find}),Ee(()=>{const f=g(),m=Xr("unified"),y=a(),v=h.get();so({viewer:n,current:t,create:()=>y&&v?new Ea(f,v,Qd,m):new Dr(f,m),assign:k=>{t=k},draw:k=>{const x=o();k.render({file:typeof i.file.contents=="string"?i.file:{...i.file,contents:x},lineAnnotations:[],containerWrapper:n.container})},onReady:S})}),ro({viewer:n,current:()=>t,annotations:()=>i.annotations??[]});const[C,b]=Pn(!1);return Ee(()=>{const f=i.edit,m=n.rendered();if(!f?.enabled){b(!1);return}const y=t;if(!y||m===0)return;b(!1);let v,k=!1;E(async()=>{const{Editor:x}=await import("./index-CwHpOKBC.js");return{Editor:x}},[],import.meta.url).then(({Editor:x})=>{if(k)return;v=new x({roundedSelection:!1,onChange:L=>{const A=L.contents;typeof A=="string"&&f.onChange(A)},onBlur:()=>f.onBlur?.(),onAttach:L=>{if(k)return;const A=f.focusOnAttach;A&&L.focus(A.lineNumber===void 0?{preventScroll:!0}:{preventScroll:!0,lineNumber:A.lineNumber}),f.onAttached?.()}}).edit(y),b(!0)}).catch(x=>{const T=x instanceof Error?x.message:String(x);f.onError?.(T)}),de(()=>{k=!0,v?.()})}),de(()=>{t?.cleanUp(),t=void 0,h.cleanup()}),W(ao,{mode:"text",viewer:n,get class(){return i.class},get classList(){return i.classList},get busy(){return _i(()=>i.edit?.enabled===!0)()&&!C()}})}function th(e){return e.mode==="text"?W(ki,{get media(){return e.media},fallback:()=>eh(e)}):W(ki,{get media(){return e.media},fallback:()=>Kd(e)})}const vh=Object.freeze(Object.defineProperty({__proto__:null,File:th},Symbol.toStringTag,{value:"Module"}));export{hh as a,dh as b,fr as c,fh as d,na as e,ph as f,gh as g,Zs as h,oi as i,Re as j,Bt as k,he as l,Ir as m,bt as n,vh as o,uh as p,Q as q,ge as r,ch as s};
@@ -0,0 +1 @@
1
+ import{d as o}from"./chunk-RHFEMEQ7-DXnQT_M1.js";import{c as D}from"./chunk-RHFEMEQ7-DXnQT_M1.js";import"./mermaid.core-ijN1rEqA.js";import"./chunk-5VM5RSS4-BDrrpFKq.js";import"./chunk-XXDRQBXY-CryhtMeb.js";import"./chunk-POPQ4Y6H-D86hrxcj.js";import"./chunk-F27PBJKO-Dr7tzwmR.js";import"./markdown-BOJLpTC-.js";import"./app-chat-kit-XCB_z28P.js";import"solid-js";import"solid-js/store";import"solid-js/web";import"./markdown-code-CZu9SuDN.js";import"./channel-aHmXCIiU.js";export{D as createFlowDiagram,o as diagram};