@kabmo-labs/kabmo 0.38.1 → 0.38.2

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 (103) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +219 -219
  3. package/dist/client/static/js/{CsvGrid-t1n057vw.js → CsvGrid-4dpsfdrf.js} +1 -1
  4. package/dist/client/static/js/{DocxView-c9g6teks.js → DocxView-crdgc0jd.js} +1 -1
  5. package/dist/client/static/js/{DrawioView-gd14j54m.js → DrawioView-1ts9y0yk.js} +1 -1
  6. package/dist/client/static/js/{ImageView-57f1ecdp.js → ImageView-w2hyp129.js} +1 -1
  7. package/dist/client/static/js/{LayoutWrapper-x7srbpz1.js → LayoutWrapper-pdvfkncm.js} +1 -1
  8. package/dist/client/static/js/{Modal-0bn3f77b.js → Modal-2sx1tgqr.js} +1 -1
  9. package/dist/client/static/js/{PdfView-cybz0xbj.js → PdfView-72c123a9.js} +1 -1
  10. package/dist/client/static/js/{SessionsView-gx5q68tp.js → SessionsView-a8921ysr.js} +1 -1
  11. package/dist/client/static/js/{SheetView-1kk5y326.js → SheetView-8xh69wgk.js} +1 -1
  12. package/dist/client/static/js/{SvgPreview-mp4tk37p.js → SvgPreview-z3fm87h6.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-78qb3can.js → abnfDiagram-O67JEVCF-25r2p3vh.js} +1 -1
  14. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-n0fr4hb6.js → architectureDiagram-NJMV4G6O-z3n19xwk.js} +1 -1
  15. package/dist/client/static/js/{blockDiagram-BEXU5L5S-2xemfrzh.js → blockDiagram-BEXU5L5S-vzamgz9s.js} +1 -1
  16. package/dist/client/static/js/{c4Diagram-YGBWAQC7-zxfdx3eb.js → c4Diagram-YGBWAQC7-jejafgn0.js} +1 -1
  17. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-z9sasy3k.js → classDiagram-v2-NBCMYWYE-qfa6mj0q.js} +1 -1
  18. package/dist/client/static/js/{cose-bilkent-JH36ORCC-9byp0czh.js → cose-bilkent-JH36ORCC-9vzdgmk1.js} +1 -1
  19. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-gnm129fx.js → cynefinDiagram-VND7K2PF-a3k3w1t5.js} +1 -1
  20. package/dist/client/static/js/{dagre-6A5THRUB-sc5tfv1w.js → dagre-6A5THRUB-gf04dvxj.js} +1 -1
  21. package/dist/client/static/js/{diagram-22UHCM2B-hq11eek7.js → diagram-22UHCM2B-a9e0a684.js} +1 -1
  22. package/dist/client/static/js/{diagram-3UASUU5V-7bk532gd.js → diagram-3UASUU5V-fb73gfjd.js} +1 -1
  23. package/dist/client/static/js/{diagram-ATOU4E4O-yt8wxttm.js → diagram-ATOU4E4O-yb9n3t30.js} +1 -1
  24. package/dist/client/static/js/{diagram-CDSNMT55-n3978w6p.js → diagram-CDSNMT55-adhbhw28.js} +1 -1
  25. package/dist/client/static/js/{diagram-MLGK6HIB-004x4gyw.js → diagram-MLGK6HIB-v4yxyb8r.js} +1 -1
  26. package/dist/client/static/js/{diagram-MPIPVDR6-498nt489.js → diagram-MPIPVDR6-94ttsqy2.js} +1 -1
  27. package/dist/client/static/js/{dockerfile-6hbcmkc8.js → dockerfile-mrranatf.js} +1 -1
  28. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-5fkmymqn.js → ebnfDiagram-ZINNZB2B-jj4f3pyq.js} +1 -1
  29. package/dist/client/static/js/{elk-276RUBZZ-6xrfa2kd.js → elk-276RUBZZ-mtnkhyte.js} +1 -1
  30. package/dist/client/static/js/{erDiagram-OPXOYQCR-byz4zbkn.js → erDiagram-OPXOYQCR-18qdkhm5.js} +1 -1
  31. package/dist/client/static/js/flowDiagram-KWPJA3E3-zmz4grtx.js +1 -0
  32. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-4fkw1k01.js → ganttDiagram-FUAMR5RP-vz28h061.js} +1 -1
  33. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-19g84yw8.js → gitGraphDiagram-X574FWY7-cgq3r4rz.js} +1 -1
  34. package/dist/client/static/js/{index-3y6krykq.js → index-12p63902.js} +1 -1
  35. package/dist/client/static/js/{index-1j1s91c4.js → index-1c7294vk.js} +1 -1
  36. package/dist/client/static/js/{index-sjnnv1gd.js → index-2xb54jt3.js} +1 -1
  37. package/dist/client/static/js/{index-57z8mtmx.js → index-4hsxaa87.js} +1 -1
  38. package/dist/client/static/js/{index-zj45wj1x.js → index-5v9v41ap.js} +2 -2
  39. package/dist/client/static/js/{index-e99ec2f0.js → index-6d5qj0kb.js} +1 -1
  40. package/dist/client/static/js/{index-gxtgyya0.js → index-6j9h1fa7.js} +1 -1
  41. package/dist/client/static/js/{index-7kafzae0.js → index-6k2x281j.js} +2 -2
  42. package/dist/client/static/js/{index-j314me09.js → index-6rt7gs1j.js} +1 -1
  43. package/dist/client/static/js/{index-dd4q54y0.js → index-737w2mqf.js} +1 -1
  44. package/dist/client/static/js/{index-kdgcbt17.js → index-95t1hwr8.js} +1 -1
  45. package/dist/client/static/js/{index-fpf1jkwd.js → index-a5ptb956.js} +1 -1
  46. package/dist/client/static/js/{index-pfwd0160.js → index-aa6qdgmv.js} +1 -1
  47. package/dist/client/static/js/{index-jbwns6sc.js → index-ajtd1q1h.js} +1 -1
  48. package/dist/client/static/js/{index-m4bjsyj2.js → index-arvqarv3.js} +1 -1
  49. package/dist/client/static/js/{index-89a2702q.js → index-bgcp21ed.js} +1 -1
  50. package/dist/client/static/js/{index-epbqzayj.js → index-d146s9g3.js} +1 -1
  51. package/dist/client/static/js/{index-3wpsr2bc.js → index-d8kjsgpt.js} +7 -7
  52. package/dist/client/static/js/{index-rgdhyry3.js → index-dr7nhha9.js} +1 -1
  53. package/dist/client/static/js/{index-20vhkcb9.js → index-enxfdvdq.js} +1 -1
  54. package/dist/client/static/js/{index-e3w46vsc.js → index-fqhpxzyb.js} +1 -1
  55. package/dist/client/static/js/{index-cj9193d5.js → index-gbdvr4rt.js} +1 -1
  56. package/dist/client/static/js/{index-baet2nv8.js → index-hp8kfk9z.js} +1 -1
  57. package/dist/client/static/js/{index-5gn56236.js → index-kf9t3mzv.js} +1 -1
  58. package/dist/client/static/js/{index-0v8b5pzb.js → index-naz3px72.js} +1 -1
  59. package/dist/client/static/js/{index-4jbbdq6n.js → index-njqpkcvw.js} +1 -1
  60. package/dist/client/static/js/{index-qntytvt0.js → index-qxb8k6py.js} +1 -1
  61. package/dist/client/static/js/{index-bhng2dax.js → index-rtd9frp1.js} +1 -1
  62. package/dist/client/static/js/{index-ehnztdd2.js → index-s16h2nmv.js} +1 -1
  63. package/dist/client/static/js/{index-74scnfpk.js → index-s910y31q.js} +1 -1
  64. package/dist/client/static/js/{index-8j90mdgz.js → index-we2ezmn7.js} +1 -1
  65. package/dist/client/static/js/{index-zw7qjx65.js → index-y5y7smet.js} +1 -1
  66. package/dist/client/static/js/{index-4qt2e84b.js → index-z72wf7q4.js} +1 -1
  67. package/dist/client/static/js/{index-g252205p.js → index-zdbvm01f.js} +1 -1
  68. package/dist/client/static/js/{infoDiagram-VRGFBTTK-aw6ter0a.js → infoDiagram-VRGFBTTK-jjwckbr9.js} +1 -1
  69. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-62gst5wh.js → ishikawaDiagram-OU5B5YK6-qzk5gejf.js} +1 -1
  70. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-6kgv5a4j.js → journeyDiagram-ZHPQQLJL-maccpg3q.js} +1 -1
  71. package/dist/client/static/js/{kanban-definition-PNTS6WVX-8p3515b7.js → kanban-definition-PNTS6WVX-xv2azgws.js} +1 -1
  72. package/dist/client/static/js/{mermaid.core-b6ga2y8y.js → mermaid.core-e4ys760s.js} +2 -2
  73. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-na9e9b4a.js → mindmap-definition-NLK3R4M7-b779wz81.js} +1 -1
  74. package/dist/client/static/js/one-dark-pro-kckm8epj.js +1 -0
  75. package/dist/client/static/js/one-light-0v7rg9a7.js +1 -0
  76. package/dist/client/static/js/{pegDiagram-GJSIUBJH-d1hk7fnq.js → pegDiagram-GJSIUBJH-8sgdmhnw.js} +1 -1
  77. package/dist/client/static/js/{pieDiagram-5QR66LMP-7b9f4x0y.js → pieDiagram-5QR66LMP-nz6n95d6.js} +1 -1
  78. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-q4wxgmhg.js → quadrantDiagram-O4NWA36T-47dpygk5.js} +1 -1
  79. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-jngq1qx4.js → railroadDiagram-XR7U4H2S-wv0bvwve.js} +1 -1
  80. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-6xph3b72.js → requirementDiagram-PLB6GJNP-w3r8r837.js} +1 -1
  81. package/dist/client/static/js/{rust-w6hen2h4.js → rust-42c4h7e4.js} +1 -1
  82. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-ncfzgdj8.js → sankeyDiagram-IPEJSGJF-t55rjgad.js} +1 -1
  83. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-sqz0yfg0.js → sequenceDiagram-PO4LG4MO-yfwjwy37.js} +1 -1
  84. package/dist/client/static/js/{sizeCapture-INFHLROL-vt8qp04d.js → sizeCapture-INFHLROL-nq6hy7ce.js} +1 -1
  85. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-myjtrmfe.js → stateDiagram-v2-GCMORJYK-4xy0atqh.js} +1 -1
  86. package/dist/client/static/js/{swimlanes-2SLR337P-z9vx7z4j.js → swimlanes-2SLR337P-np47cy1q.js} +1 -1
  87. package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-5vha7thx.js → swimlanesDiagram-TC7HE7FX-56rk9kxv.js} +1 -1
  88. package/dist/client/static/js/{timeline-definition-EJHVYXUP-z815np57.js → timeline-definition-EJHVYXUP-rb0gnm35.js} +1 -1
  89. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-06ntggng.js → usecaseDiagram-POWQR4AR-gatkznan.js} +1 -1
  90. package/dist/client/static/js/{vennDiagram-UO4OBE2U-nmtaf5rp.js → vennDiagram-UO4OBE2U-r3f5xjjq.js} +1 -1
  91. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-zgsxmak8.js → wardleyDiagram-VNRHLVJA-tpass65t.js} +1 -1
  92. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-8bg9qdra.js → xychartDiagram-PMCCYNJV-8xkh67cw.js} +1 -1
  93. package/package.json +1 -1
  94. package/src/server/lib/changes/capture-fs.server.ts +0 -8
  95. package/src/server/lib/changes/capture.server.ts +1 -2
  96. package/src/server/lib/changes/classify-command.test.ts +20 -0
  97. package/src/server/lib/changes/classify-command.ts +46 -23
  98. package/src/server/lib/changes/classify-git.ts +12 -11
  99. package/src/server/lib/changes/classify-tokenize.ts +9 -1
  100. package/src/server/lib/changes/scan.server.ts +19 -14
  101. package/dist/client/static/js/flowDiagram-KWPJA3E3-s3fbfwrz.js +0 -1
  102. package/dist/client/static/js/one-dark-pro-xp6ssk4z.js +0 -1
  103. package/dist/client/static/js/one-light-xgab7b02.js +0 -1
@@ -1 +1 @@
1
- import{Mn,Ri,Sm,ts,so,Zs,qu,Xs,Hf,Hu,Tm,Dm,Qm,Nm,Jg,el,Wu,Zg,Ku,Br,Xg}from"./index-3wpsr2bc.js";export{Xs as IndentContext,Xg as StreamLanguage,Ku as bracketMatching,el as codeFolding,Qm as foldAll,Tm as foldCode,Wu as foldGutter,Jg as foldKeymap,Hu as foldService,so as getIndentUnit,qu as getIndentation,Zg as highlightingFor,Hf as indentOnInput,Sm as indentService,Zs as indentString,ts as indentUnit,Ri as language,Br as matchBrackets,Mn as syntaxTree,Nm as unfoldAll,Dm as unfoldCode};
1
+ import{Mn,Ri,Sm,ts,so,Zs,qu,Xs,Hf,Hu,Tm,Dm,Qm,Nm,Jg,el,Wu,Zg,Ku,Br,Xg}from"./index-d8kjsgpt.js";export{Xs as IndentContext,Xg as StreamLanguage,Ku as bracketMatching,el as codeFolding,Qm as foldAll,Tm as foldCode,Wu as foldGutter,Jg as foldKeymap,Hu as foldService,so as getIndentUnit,qu as getIndentation,Zg as highlightingFor,Hf as indentOnInput,Sm as indentService,Zs as indentString,ts as indentUnit,Ri as language,Br as matchBrackets,Mn as syntaxTree,Nm as unfoldAll,Dm as unfoldCode};
@@ -1 +1 @@
1
- import{n,i,u,le,e,_A,we,I,m,Vt,Se,C,F,Fs,ee}from"./index-3wpsr2bc.js";function w(a){if(!Number.isFinite(a)||a<=0)return"";return new Date(a).toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}function N({files:a,selected:f,onSelect:h}){let[t,c]=n(""),p=u(()=>{let l=t.trim().toLowerCase();if(!l)return a;return a.filter((o)=>o.title.toLowerCase().includes(l))},[a,t]);return e("div",{className:"flex h-full min-h-0 w-full flex-col bg-canvas/40",children:[e("div",{className:"flex flex-shrink-0 items-center gap-1.5 border-b border-ink/10 px-2 py-1.5",children:[e(F,{size:12,className:"flex-shrink-0 text-ink/40"}),e("input",{type:"search",value:t,onChange:(l)=>c(l.target.value),placeholder:"Filter plans…","aria-label":"Filter plans",className:"min-w-0 flex-1 bg-transparent text-[11px] text-ink outline-none placeholder:text-ink/35"})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-overlay-container",children:p.length===0?e("p",{className:"px-3 py-2 text-[11px] text-ink/40 italic",children:a.length===0?"No plan yet":"No plan matches the filter"}):e("ul",{className:"py-1",children:p.map((l)=>{let o=l.path===f,r=w(l.modifiedAt);return e("li",{children:e("button",{type:"button",onClick:()=>h(l.path),"aria-current":o?"true":void 0,title:`${l.path}${r?` · ${r}`:""}`,className:`flex w-full items-start gap-1.5 px-2.5 py-1.5 text-left transition-colors ${o?"bg-ink/10 font-semibold text-ink":"text-ink/80 hover:bg-ink/5 hover:text-ink"}`,children:[e(Se,{size:12,className:`mt-0.5 flex-shrink-0 ${o?"text-ink":"text-ink/40"}`}),e("span",{className:"min-w-0 flex-1",children:[e("span",{className:"block truncate text-[11.5px]",children:l.title}),r&&e("span",{className:"block truncate font-mono text-[10px] text-ink/40",children:r})]})]})},l.path)})})})]})}function g({file:a,content:f,isLoading:h,error:t,truncated:c,onBack:p}){return e("div",{className:"flex h-full min-h-0 w-full flex-col bg-paper",children:[e("div",{className:"flex flex-shrink-0 items-center gap-1.5 border-b border-ink/10 px-2.5 py-1.5",children:[e("button",{type:"button",onClick:p,title:"Back to the plan list","aria-label":"Back to the plan list",className:"flex-shrink-0 rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink @[520px]:hidden",children:e(Vt,{size:13})}),e("span",{className:"min-w-0 flex-1 truncate text-[11px] text-ink/50",title:a?.path??"",children:a?.path??"Plan"}),h&&e(m,{size:12,className:"flex-shrink-0 animate-spin text-ink/40"})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-overlay-container",children:t?e("div",{className:"flex flex-col items-center gap-2 px-6 py-8 text-center",children:[e(I,{size:16,className:"text-error"}),e("p",{className:"text-xs text-error",children:t})]}):!f?e("div",{className:"px-6 py-8 text-center text-xs text-ink/40",children:h?"Reading the plan…":"This plan is empty."}):e("article",{className:"mx-auto max-w-4xl px-5 py-4",children:[e(ee,{content:f,className:"max-w-none"}),c&&e("p",{className:"mt-4 border-t border-ink/10 pt-2 text-[11px] text-ink/50",children:"This plan is longer than the reader's budget and was cut off."})]})})]})}function J({className:a="",active:f=!0}){let[h]=le(),t=h.get("sessionId"),[c,p]=Fs("plan.selectedFile",null),[l,o]=n(!1),r=c&&c.sessionId===t?c.path:null,s=we(t?_A(t):null,{enabled:f}),x=s.data?.files??[],b=s.data?.current??null,d=u(()=>{if(r&&x.some((k)=>k.path===r))return r;return b},[r,x,b]),P=u(()=>x.find((k)=>k.path===d)??null,[x,d]);i(()=>{if(!t||!d||d===r)return;p({sessionId:t,path:d})},[t,d,r,p]),i(()=>{o(!1)},[t]);let y=(k)=>{if(t)p({sessionId:t,path:k});o(!0)};if(!t)return e("div",{className:`flex h-full flex-col items-center justify-center bg-paper text-ink/40 ${a}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});let v=x.length>0;return e("div",{className:`@container flex h-full min-h-0 w-full flex-col bg-paper text-xs text-ink ${a}`,children:[e("div",{className:"flex flex-shrink-0 items-center justify-between gap-2 border-b border-ink/10 px-2 py-1.5",children:[e("div",{className:"flex min-w-0 items-center gap-1.5",children:[e(Se,{size:12,className:"flex-shrink-0 text-ink/50"}),e("span",{className:"truncate text-[11px] font-medium text-ink/70",children:"Plan mode"}),v&&e("span",{className:"flex-shrink-0 rounded border border-ink/15 bg-ink/5 px-1.5 py-0.5 font-mono text-[10px] text-ink/60",children:x.length})]}),e("button",{type:"button",onClick:s.refresh,disabled:s.isLoading,title:"Re-read the plan","aria-label":"Re-read the plan",className:"flex-shrink-0 rounded p-1 text-ink/60 transition-colors hover:bg-ink/5 hover:text-ink disabled:opacity-50",children:e(C,{size:13,className:s.isLoading||s.refreshing?"animate-spin":""})})]}),s.stale&&!s.data?e("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[e(I,{size:16,className:"text-error"}),e("p",{className:"text-error",children:"The plan could not be read."}),e("button",{type:"button",onClick:s.refresh,className:"text-[11px] font-semibold text-ink/70 underline underline-offset-2 hover:text-ink",children:"Try again"})]}):!s.data?e("div",{className:"flex flex-1 items-center justify-center gap-2 text-ink/40",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Reading the plan…"})]}):!v?e("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[e(Se,{size:18,className:"text-ink/30"}),e("p",{className:"max-w-sm text-[11px] leading-relaxed text-ink/60",children:"No plan yet. Turn on Plan mode in the composer, and the plan this session writes will appear here."})]}):e("div",{className:"flex min-h-0 flex-1 flex-col @[520px]:flex-row-reverse",children:[e("div",{className:`min-h-0 w-full @[520px]:w-52 @[520px]:flex-shrink-0 border-b border-ink/10 @[520px]:border-b-0 @[520px]:border-l ${l?"hidden @[520px]:flex":"flex"} flex-col`,children:e(N,{files:x,selected:d,onSelect:y})}),e("div",{className:`min-w-0 min-h-0 flex-1 ${l?"flex":"hidden @[520px]:flex"} flex-col`,children:e(g,{file:P,content:s.data.content,isLoading:s.isLoading,error:s.stale?"The plan could not be read.":null,truncated:s.data.truncated,onBack:()=>o(!1)})})]})]})}export{J as PlanPanel};
1
+ import{n,i,u,le,e,_A,we,I,m,Vt,Se,C,F,Fs,ee}from"./index-d8kjsgpt.js";function w(a){if(!Number.isFinite(a)||a<=0)return"";return new Date(a).toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}function N({files:a,selected:f,onSelect:h}){let[t,c]=n(""),p=u(()=>{let l=t.trim().toLowerCase();if(!l)return a;return a.filter((o)=>o.title.toLowerCase().includes(l))},[a,t]);return e("div",{className:"flex h-full min-h-0 w-full flex-col bg-canvas/40",children:[e("div",{className:"flex flex-shrink-0 items-center gap-1.5 border-b border-ink/10 px-2 py-1.5",children:[e(F,{size:12,className:"flex-shrink-0 text-ink/40"}),e("input",{type:"search",value:t,onChange:(l)=>c(l.target.value),placeholder:"Filter plans…","aria-label":"Filter plans",className:"min-w-0 flex-1 bg-transparent text-[11px] text-ink outline-none placeholder:text-ink/35"})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-overlay-container",children:p.length===0?e("p",{className:"px-3 py-2 text-[11px] text-ink/40 italic",children:a.length===0?"No plan yet":"No plan matches the filter"}):e("ul",{className:"py-1",children:p.map((l)=>{let o=l.path===f,r=w(l.modifiedAt);return e("li",{children:e("button",{type:"button",onClick:()=>h(l.path),"aria-current":o?"true":void 0,title:`${l.path}${r?` · ${r}`:""}`,className:`flex w-full items-start gap-1.5 px-2.5 py-1.5 text-left transition-colors ${o?"bg-ink/10 font-semibold text-ink":"text-ink/80 hover:bg-ink/5 hover:text-ink"}`,children:[e(Se,{size:12,className:`mt-0.5 flex-shrink-0 ${o?"text-ink":"text-ink/40"}`}),e("span",{className:"min-w-0 flex-1",children:[e("span",{className:"block truncate text-[11.5px]",children:l.title}),r&&e("span",{className:"block truncate font-mono text-[10px] text-ink/40",children:r})]})]})},l.path)})})})]})}function g({file:a,content:f,isLoading:h,error:t,truncated:c,onBack:p}){return e("div",{className:"flex h-full min-h-0 w-full flex-col bg-paper",children:[e("div",{className:"flex flex-shrink-0 items-center gap-1.5 border-b border-ink/10 px-2.5 py-1.5",children:[e("button",{type:"button",onClick:p,title:"Back to the plan list","aria-label":"Back to the plan list",className:"flex-shrink-0 rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink @[520px]:hidden",children:e(Vt,{size:13})}),e("span",{className:"min-w-0 flex-1 truncate text-[11px] text-ink/50",title:a?.path??"",children:a?.path??"Plan"}),h&&e(m,{size:12,className:"flex-shrink-0 animate-spin text-ink/40"})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-overlay-container",children:t?e("div",{className:"flex flex-col items-center gap-2 px-6 py-8 text-center",children:[e(I,{size:16,className:"text-error"}),e("p",{className:"text-xs text-error",children:t})]}):!f?e("div",{className:"px-6 py-8 text-center text-xs text-ink/40",children:h?"Reading the plan…":"This plan is empty."}):e("article",{className:"mx-auto max-w-4xl px-5 py-4",children:[e(ee,{content:f,className:"max-w-none"}),c&&e("p",{className:"mt-4 border-t border-ink/10 pt-2 text-[11px] text-ink/50",children:"This plan is longer than the reader's budget and was cut off."})]})})]})}function J({className:a="",active:f=!0}){let[h]=le(),t=h.get("sessionId"),[c,p]=Fs("plan.selectedFile",null),[l,o]=n(!1),r=c&&c.sessionId===t?c.path:null,s=we(t?_A(t):null,{enabled:f}),x=s.data?.files??[],b=s.data?.current??null,d=u(()=>{if(r&&x.some((k)=>k.path===r))return r;return b},[r,x,b]),P=u(()=>x.find((k)=>k.path===d)??null,[x,d]);i(()=>{if(!t||!d||d===r)return;p({sessionId:t,path:d})},[t,d,r,p]),i(()=>{o(!1)},[t]);let y=(k)=>{if(t)p({sessionId:t,path:k});o(!0)};if(!t)return e("div",{className:`flex h-full flex-col items-center justify-center bg-paper text-ink/40 ${a}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});let v=x.length>0;return e("div",{className:`@container flex h-full min-h-0 w-full flex-col bg-paper text-xs text-ink ${a}`,children:[e("div",{className:"flex flex-shrink-0 items-center justify-between gap-2 border-b border-ink/10 px-2 py-1.5",children:[e("div",{className:"flex min-w-0 items-center gap-1.5",children:[e(Se,{size:12,className:"flex-shrink-0 text-ink/50"}),e("span",{className:"truncate text-[11px] font-medium text-ink/70",children:"Plan mode"}),v&&e("span",{className:"flex-shrink-0 rounded border border-ink/15 bg-ink/5 px-1.5 py-0.5 font-mono text-[10px] text-ink/60",children:x.length})]}),e("button",{type:"button",onClick:s.refresh,disabled:s.isLoading,title:"Re-read the plan","aria-label":"Re-read the plan",className:"flex-shrink-0 rounded p-1 text-ink/60 transition-colors hover:bg-ink/5 hover:text-ink disabled:opacity-50",children:e(C,{size:13,className:s.isLoading||s.refreshing?"animate-spin":""})})]}),s.stale&&!s.data?e("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[e(I,{size:16,className:"text-error"}),e("p",{className:"text-error",children:"The plan could not be read."}),e("button",{type:"button",onClick:s.refresh,className:"text-[11px] font-semibold text-ink/70 underline underline-offset-2 hover:text-ink",children:"Try again"})]}):!s.data?e("div",{className:"flex flex-1 items-center justify-center gap-2 text-ink/40",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Reading the plan…"})]}):!v?e("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[e(Se,{size:18,className:"text-ink/30"}),e("p",{className:"max-w-sm text-[11px] leading-relaxed text-ink/60",children:"No plan yet. Turn on Plan mode in the composer, and the plan this session writes will appear here."})]}):e("div",{className:"flex min-h-0 flex-1 flex-col @[520px]:flex-row-reverse",children:[e("div",{className:`min-h-0 w-full @[520px]:w-52 @[520px]:flex-shrink-0 border-b border-ink/10 @[520px]:border-b-0 @[520px]:border-l ${l?"hidden @[520px]:flex":"flex"} flex-col`,children:e(N,{files:x,selected:d,onSelect:y})}),e("div",{className:`min-w-0 min-h-0 flex-1 ${l?"flex":"hidden @[520px]:flex"} flex-col`,children:e(g,{file:P,content:s.data.content,isLoading:s.isLoading,error:s.stale?"The plan could not be read.":null,truncated:s.data.truncated,onBack:()=>o(!1)})})]})]})}export{J as PlanPanel};
@@ -1,2 +1,2 @@
1
- import{t,ws,h,Bs}from"./index-zj45wj1x.js";import{on}from"./index-b9b2nwdd.js";var o=on(Bs(),1);var $i=t((s,e)=>{let r=s.append("rect");if(r.attr("x",e.x),r.attr("y",e.y),r.attr("fill",e.fill),r.attr("stroke",e.stroke),r.attr("width",e.width),r.attr("height",e.height),e.name)r.attr("name",e.name);if(e.rx)r.attr("rx",e.rx);if(e.ry)r.attr("ry",e.ry);if(e.attrs!==void 0)for(let a in e.attrs)r.attr(a,e.attrs[a]);if(e.class)r.attr("class",e.class);return r},"drawRect"),fu=t((s,e)=>{let r={x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,stroke:e.stroke,class:"rect"};$i(s,r).lower()},"drawBackgroundRect"),uA=t((s,e)=>{let r=e.text.replace(ws," "),a=s.append("text");if(a.attr("x",e.x),a.attr("y",e.y),a.attr("class","legend"),a.style("text-anchor",e.anchor),e.class)a.attr("class",e.class);let i=a.append("tspan");return i.attr("x",e.x+e.textMargin*2),i.text(r),a},"drawText"),Qd=t((s,e,r,a)=>{let i=s.append("image");i.attr("x",e),i.attr("y",r);let n=o.sanitizeUrl(a);i.attr("xlink:href",n)},"drawImage"),Nd=t((s,e,r,a)=>{let i=s.append("use");i.attr("x",e),i.attr("y",r);let n=o.sanitizeUrl(a);i.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),tr=t(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),Rd=t(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),Ra=t(()=>{let s=h(".mermaidTooltip");if(s.empty())s=h("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100");return s},"createTooltip");
1
+ import{t,ws,h,Bs}from"./index-5v9v41ap.js";import{on}from"./index-b9b2nwdd.js";var o=on(Bs(),1);var $i=t((s,e)=>{let r=s.append("rect");if(r.attr("x",e.x),r.attr("y",e.y),r.attr("fill",e.fill),r.attr("stroke",e.stroke),r.attr("width",e.width),r.attr("height",e.height),e.name)r.attr("name",e.name);if(e.rx)r.attr("rx",e.rx);if(e.ry)r.attr("ry",e.ry);if(e.attrs!==void 0)for(let a in e.attrs)r.attr(a,e.attrs[a]);if(e.class)r.attr("class",e.class);return r},"drawRect"),fu=t((s,e)=>{let r={x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,stroke:e.stroke,class:"rect"};$i(s,r).lower()},"drawBackgroundRect"),uA=t((s,e)=>{let r=e.text.replace(ws," "),a=s.append("text");if(a.attr("x",e.x),a.attr("y",e.y),a.attr("class","legend"),a.style("text-anchor",e.anchor),e.class)a.attr("class",e.class);let i=a.append("tspan");return i.attr("x",e.x+e.textMargin*2),i.text(r),a},"drawText"),Qd=t((s,e,r,a)=>{let i=s.append("image");i.attr("x",e),i.attr("y",r);let n=o.sanitizeUrl(a);i.attr("xlink:href",n)},"drawImage"),Nd=t((s,e,r,a)=>{let i=s.append("use");i.attr("x",e),i.attr("y",r);let n=o.sanitizeUrl(a);i.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),tr=t(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),Rd=t(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),Ra=t(()=>{let s=h(".mermaidTooltip");if(s.empty())s=h("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100");return s},"createTooltip");
2
2
  export{$i,fu,uA,Qd,Nd,tr,Rd,Ra};
@@ -1,3 +1,3 @@
1
- import{d,n,i,V,o,u,a,He,se,e,Gn,Ze,ze,S,s,I,m,Kt,D,f,B,ae,tt,he,wt,Ge,Zi,en,qr,C,F,b,Wr,Ke,ce,dr,J,at,$s,xi,zs,Us,Ci,Eg,Pg,Ys,Ne,re,jt,T,ye,Fi,lo,Um,Vf}from"./index-3wpsr2bc.js";import{yt,uo,Gc,jc,Hc,os,po,cd}from"./index-bhng2dax.js";import{Cc,ed,td,eA,tA,Ec,Zn,ns,Bc,Ic,_c,Sc,Tc,rs,Li,as,Qc,al,il,Nc,Rc,Fc,Lc,Mc,Pc,Oc,$c,zc}from"./index-7kafzae0.js";import{Sa,Ta,fo}from"./index-epbqzayj.js";var fn={name:"git-commit-vertical",size:24,node:[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]},Le=s(fn);var bn={name:"maximize",size:24,node:[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]},xe=s(bn);var gn={name:"minimize",size:24,node:[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]},we=s(gn);var hn={name:"save-all",size:24,node:[["path",{d:"M10 2v3a1 1 0 0 0 1 1h5",key:"1xspal"}],["path",{d:"M18 18v-6a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6",key:"1ra60u"}],["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"M8 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9.172a2 2 0 0 1 1.414.586l2.828 2.828A2 2 0 0 1 22 6.828V16a2 2 0 0 1-2.01 2z",key:"1yve0x"}]]},ke=s(hn);var oe=new Set,Be=new Set,Fe=new Set;function $e(){Fe=new Set(oe);for(let t of[...Be])t()}function Ve(t){let r=new Set(t);if(r.size===oe.size){let l=!0;for(let c of r)if(!oe.has(c)){l=!1;break}if(l)return}oe.clear();for(let l of r)oe.add(l);$e()}function We(t){let r=new Set(t),l=!1;for(let c of[...oe])if(!r.has(c))oe.delete(c),l=!0;if(l)$e()}function Ue(t){return oe.has(t)}function _e(){return oe.size>0}function vn(t){return Be.add(t),()=>{Be.delete(t)}}var yn=vn;function qe(){return He(yn,()=>Fe)}function Xe({x:t,y:r,rows:l,onAction:c,onClose:p}){let g=o(null),[h,v]=n({left:t,top:r});return V(()=>{let x=g.current;if(!x)return;let{width:y,height:w}=x.getBoundingClientRect();v({left:Math.min(t,Math.max(0,window.innerWidth-y-8)),top:Math.min(r,Math.max(0,window.innerHeight-w-8))})},[t,r,l.length]),se(e("div",{className:"fixed inset-0 z-[70]",onClick:p,onContextMenu:(x)=>{x.preventDefault(),p()},children:e("div",{ref:g,role:"menu","aria-label":"Tab actions",className:"glass-popover absolute w-52 bg-paper border border-ink/15 rounded-md shadow-xl py-1 text-xs text-ink",style:{left:`${h.left}px`,top:`${h.top}px`},onClick:(x)=>x.stopPropagation(),children:l.map((x)=>e("button",{type:"button",role:"menuitem",onClick:()=>{c(x.action),p()},className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 transition-colors cursor-pointer",children:x.label},x.action))})}),document.body)}var be={rightFileId:null,fraction:0.5};function Se(t,r,l){if(t===null)return!1;if(t===r)return!1;return l.includes(t)}function Ye(t,r){for(let l=r.length-1;l>=0;l-=1){let c=r[l];if(c!==t)return c}return null}function je(t,r){if(t.rightFileId===null)return t;if(t.rightFileId!==r)return t;return{...t,rightFileId:null}}function pe(t){if(!Number.isFinite(t))return be.fraction;return Math.max(0.2,Math.min(0.8,t))}function Je(t,r){if(typeof t!=="object"||t===null)return be;let l=t,c=typeof l.fraction==="number"?pe(l.fraction):be.fraction,p=typeof l.rightFileId==="string"||typeof l.rightFileId==="number"?l.rightFileId:null;if(p===null||!r.includes(p))return{rightFileId:null,fraction:c};return{rightFileId:p,fraction:c}}function Qe({tab:t,openedFiles:r,dirtyIds:l,reopenable:c,activeFileId:p,splitRightFileId:g}){let h=r.filter((w)=>w.id!==t.id),v=r.filter((w)=>!l.has(w.id)),x=r.map((w)=>w.id);return[{action:"split-right",label:"Split right",enabled:Se(t.id,p,x)},{action:"unsplit",label:"Unsplit",enabled:g!==null},{action:"close",label:"Close",enabled:!0},{action:"close-others",label:"Close others",enabled:h.length>0},{action:"close-all",label:"Close all",enabled:r.length>0},{action:"close-saved",label:"Close saved",enabled:v.some((w)=>w.id!==t.id)},{action:"copy-path",label:"Copy path",enabled:Boolean(t.path)},{action:"reveal-in-files",label:"Reveal in Files",enabled:Boolean(t.path)&&!t.isDiff},{action:"reopen-closed",label:"Reopen closed tab",enabled:c>0}].filter((w)=>w.enabled)}function nt({openedFiles:t,activeFileId:r,onSelectFile:l,onCloseFile:c,missingIds:p,onCopyPath:g,onRevealInFiles:h,onReopenClosed:v,reopenableCount:x,onSplitTo:y,onUnsplit:w,splitRightFileId:k=null}){let A=qe(),E=o(null),M=o(null),[H,K]=n(5),[W,z]=n(!1),[L,_]=n(null);ce(M,()=>z(!1)),i(()=>{let N=new ResizeObserver((R)=>{for(let P of R){let Q=P.contentRect.width,X=Math.max(1,Math.floor((Q-60)/150));K(X)}});if(E.current)N.observe(E.current);return()=>N.disconnect()},[]);let O=Ye(r,t.map((N)=>N.id)),G=[],Z=[];if(t.length<=H)G=t;else{let N=t.findIndex((P)=>P.id===r),R=new Set;if(N!==-1&&r!==null)R.add(r);for(let P=t.length-1;P>=0;P--){if(R.size>=H)break;R.add(t[P].id)}G=t.filter((P)=>R.has(P.id)),Z=t.filter((P)=>!R.has(P.id))}return e("div",{className:"flex bg-ink/10 w-full relative border-b border-ink/10",ref:E,children:[e("div",{className:"flex overflow-hidden",children:G.map((N)=>{let R=N.id===r,P=Boolean(N.isDiff),Q=P?Gn(N.diffStatus||"M",N.diffStaged):null,X=Boolean(p?.has(N.id));return e("div",{onClick:()=>l(N.id),onContextMenu:(j)=>{j.preventDefault(),_({tab:N,x:j.clientX,y:j.clientY})},className:`flex items-center space-x-1.5 px-3 py-1.5 cursor-pointer border-r border-ink/10 min-w-[120px] max-w-[210px] group ${R?"bg-paper border-t-2 border-t-ink text-ink":"bg-transparent border-t-2 border-t-transparent text-ink/60 hover:bg-paper/50"}`,title:X?`${N.path} — file no longer exists`:N.path,children:[P?e(Zi,{size:14,className:R?"text-info flex-shrink-0":"text-info/70 flex-shrink-0"}):e(at,{name:N.name,size:14,className:`flex-shrink-0${R||X?"":" opacity-60"}${X?" text-error":""}`}),e("span",{className:`text-xs font-mono truncate flex-1${X?" text-error line-through":""}`,children:N.name}),Q&&e("span",{className:`px-1 text-[10px] font-mono font-bold rounded ${Q.badgeBgClass}`,children:Q.charStatus}),e(et,{dirty:A.has(N.id),active:R,label:`Close ${N.name}`,onClose:()=>c(N.id)})]},N.id)})}),L?e(Xe,{x:L.x,y:L.y,rows:Qe({tab:L.tab,openedFiles:t,dirtyIds:A,reopenable:x?.()??0,activeFileId:r,splitRightFileId:k}),onAction:(N)=>{let R=L.tab;switch(N){case"close":c(R.id);return;case"close-others":for(let P of[...t].reverse())if(P.id!==R.id)c(P.id);l(R.id);return;case"close-all":for(let P of[...t].reverse())c(P.id);return;case"close-saved":for(let P of[...t].reverse())if(!A.has(P.id))c(P.id);return;case"copy-path":g?.(R);return;case"reveal-in-files":h?.(R);return;case"reopen-closed":v?.();return;case"split-right":y?.(R.id);return;case"unsplit":w?.();return}},onClose:()=>_(null)}):null,e("div",{className:"ml-auto flex items-center",children:e("button",{type:"button",onClick:()=>k!==null?w?.():y?.(O),disabled:k===null&&O===null,"aria-pressed":k!==null,"aria-label":"Split editor",title:k!==null?"Close the split pane (the tab stays open)":O===null?"Open another file to split the editor":"Split the editor and show the newest other file",className:`p-1.5 mx-1 rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-default ${k!==null?"bg-ink/10 text-ink":"text-ink/60 hover:bg-ink/10"}`,children:e(qr,{size:14})})}),Z.length>0&&e("div",{className:"relative flex items-center bg-ink/10",ref:M,children:[e("button",{className:`p-1.5 mx-1 rounded hover:bg-ink/10 text-ink/60 ${W?"bg-ink/10 text-ink":""}`,onClick:()=>z(!W),title:"More open files",children:e(B,{size:14})}),W&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-52 bg-paper border border-ink/10 rounded shadow-lg z-50 py-1",children:[e("div",{className:"px-3 py-1 text-[10px] uppercase font-mono text-ink/40 border-b border-ink/10 mb-1",children:"Older Tabs"}),Z.map((N)=>{let R=Boolean(p?.has(N.id));return e("div",{onClick:()=>{l(N.id),z(!1)},className:"flex items-center space-x-2 px-3 py-1.5 hover:bg-ink/5 cursor-pointer group",children:[N.isDiff?e(Zi,{size:14,className:"text-info/80"}):e(at,{name:N.name,size:14,className:R?"text-error":"opacity-60"}),e("span",{className:`text-xs font-mono truncate flex-1 ${R?"text-error line-through":"text-ink/80"}`,children:N.name}),e(et,{dirty:A.has(N.id),active:!1,label:`Close ${N.name}`,onClose:()=>{if(c(N.id),Z.length===1)z(!1)}})]},N.id)})]})]})]})}function et({dirty:t,active:r,label:l,onClose:c}){return e("div",{role:"button",tabIndex:-1,"aria-label":l,title:t?`${l} — unsaved changes`:l,className:`p-0.5 rounded hover:bg-ink/10 touch-visible ${r||t?"opacity-100":"opacity-0 group-hover:opacity-100"}`,onClick:(p)=>{p.stopPropagation(),c()},children:t?e("span",{className:"block w-2 h-2 rounded-full bg-current mx-0.5","data-tab-dirty":"","aria-hidden":"true"}):e(b,{size:12})})}function xn(t){if(t===null)return null;let r=new Date(t);if(Number.isNaN(r.getTime()))return null;return r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Ce({diskMtimeMs:t,fileName:r,onReload:l,onKeepMine:c}){let p=xn(t);return e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-warning/30 bg-warning/10 text-[11px] text-ink flex-shrink-0",role:"alert","data-conflict-strip":"",children:[e(D,{size:13,className:"text-warning flex-shrink-0 mt-0.5"}),e("div",{className:"min-w-0 flex-1",children:[e("div",{className:"font-medium",children:[e("span",{className:"font-mono",children:r})," changed on disk",p?e("span",{className:"text-ink/60",children:[" at ",p]}):null,"."]}),e("div",{className:"text-ink/60 mt-0.5",children:"Your save was refused so nothing was overwritten."})]}),e("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e("button",{type:"button",onClick:l,className:"px-2 py-1 rounded border border-ink/20 hover:bg-ink/5 transition-colors cursor-pointer",title:"Discard my changes and take the file from disk",children:"Reload"}),e("button",{type:"button",onClick:c,className:"px-2 py-1 rounded border border-warning/50 text-warning hover:bg-warning/10 transition-colors cursor-pointer",title:"Write my buffer over the file on disk",children:"Keep mine"})]})]})}function ot(t){if(t.byteViewer)return[];return[{id:"save",pinned:!0,actions:[{label:"Save file",icon:ke,onSelect:t.onSave,disabled:t.saveDisabled}],children:t.saveButton},{id:"save-as",actions:[{label:"Save as…",icon:ke,onSelect:t.onSaveAs}],children:e("button",{type:"button",onClick:t.onSaveAs,className:`${Zn} hover:bg-ink/5 hover:text-ink`,title:"Save the buffer to a new file","aria-label":"Save as",children:e(ke,{size:14})})}]}function rt(t){if(!t.hasReview)return[];let r=t.isReviewing?"Exit review mode":"Review this document";return[{id:"review",actions:[{label:r,icon:en,onSelect:t.onToggleReview,active:t.isReviewing}],children:e(ns,{label:r,pressed:t.isReviewing,title:t.isReviewing?"Review mode is on — click a block to judge it":"Review: click blocks to mark them good or needing work",onClick:t.onToggleReview,children:e(en,{size:14})})}]}function it(t){if(!t.hasPreview)return[];return[{id:"preview",actions:[{label:t.previewLabel,icon:t.isPreview?wt:Ge,onSelect:t.onTogglePreview,active:t.isPreview}],children:e(ns,{label:t.previewLabel,pressed:t.isPreview,onClick:t.onTogglePreview,children:t.isPreview?e(wt,{size:14}):e(Ge,{size:14})})}]}function st(t){let r=[];if(r.push(...ot(t),...rt(t),...it(t)),!t.byteViewer)r.push({id:"find",actions:[{label:t.findLabel,icon:F,onSelect:t.onToggleFind,active:t.findOpen}],children:e(ns,{label:t.findLabel,pressed:t.findOpen,title:`${t.findLabel} (Ctrl+F)`,onClick:t.onToggleFind,children:e(F,{size:14})})}),r.push({id:"wrap",actions:[{label:t.wordWrapLabel,icon:Kt,onSelect:t.onToggleWordWrap,active:t.wordWrap}],children:e(ns,{label:t.wordWrapLabel,pressed:t.wordWrap,onClick:t.onToggleWordWrap,children:e(Kt,{size:14})})}),r.push({id:"blame",actions:[{label:t.blameInline?"Hide line blame":"Show line blame",icon:Le,onSelect:t.onToggleBlameInline,active:t.blameInline}],children:e(ns,{label:t.blameInline?"Hide line blame":"Show line blame",pressed:t.blameInline,title:"Who last changed each block, from git (hover a line for the commit)",onClick:t.onToggleBlameInline,children:e(Le,{size:14})})}),r.push({id:"zoom",actions:[{label:"Decrease font size",icon:Ta,onSelect:t.onZoomOut},{label:"Increase font size",icon:Sa,onSelect:t.onZoomIn}],children:e(d,{children:[e("button",{type:"button",onClick:t.onZoomOut,className:`${Zn} hover:bg-ink/5 hover:text-ink`,title:"Decrease font size","aria-label":"Decrease font size",children:e(Ta,{size:14})}),e("button",{type:"button",onClick:t.onZoomIn,className:`${Zn} hover:bg-ink/5 hover:text-ink`,title:"Increase font size","aria-label":"Increase font size",children:e(Sa,{size:14})})]})}),r.push({id:"reload",actions:[{label:"Reload from disk",icon:C,onSelect:t.onReload,disabled:!t.canReload}],children:e("button",{type:"button",onClick:t.onReload,disabled:!t.canReload||t.refreshing,"aria-busy":t.refreshing,className:`${Zn} hover:bg-ink/5 hover:text-ink`,title:!t.canReload?"Nothing to reload — this tab has no file on disk":t.reloadDiscardsEdits?"Discard my changes and reload from disk":"Reload from disk","aria-label":"Reload from disk",children:e(C,{size:14,className:t.refreshing?"animate-spin":void 0})})});return r.push({id:"copy",actions:[{label:t.copyLabel,icon:ae,onSelect:t.onCopy},{label:"Download file",icon:he,onSelect:t.onDownload}],children:e(d,{children:[e("button",{type:"button",onClick:t.onCopy,className:`${Zn} hover:bg-ink/5 hover:text-ink`,title:t.copyLabel,"aria-label":t.copyLabel,children:t.copied?e(ae,{size:14,className:"text-success"}):e(ae,{size:14})}),e("button",{type:"button",onClick:t.onDownload,className:`${Zn} hover:bg-ink/5 hover:text-ink`,title:"Download file","aria-label":"Download file",children:e(he,{size:14})})]})}),r.push({id:"view-modes",pinned:!0,actions:t.viewModeActions,children:t.viewModeButtons}),r.push({id:"maximize",pinned:!0,actions:[{label:t.maximizeLabel,icon:t.isMaximized?we:xe,onSelect:t.onToggleMaximize,active:t.isMaximized}],children:t.maximizeButton}),r}function lt({path:t,saveStatus:r,wordWrap:l,hasPreview:c,isPreview:p,hasReview:g,isReviewing:h,copied:v,byteViewer:x=!1,saveDisabled:y=!1,unsupported:w=!1,handleMissing:k=!1,readOnly:A=!1,isMaximized:E=!1,findOpen:M=!1,onToggleFind:H,onSave:K,onTogglePreview:W,onToggleReview:z,onToggleWordWrap:L,onZoomIn:_,onZoomOut:O,onCopy:G,onDownload:Z,onReload:N,canReload:R,refreshing:P=!1,reloadDiscardsEdits:Q,onSaveAs:X,onToggleMaximize:j}){let ne=y?A?"Read-only — this file was opened from the phone, not from a workspace":k?"Cannot save — reopen the file from the system to restore write access":w?"Nothing to save — this file cannot be opened as a document":"Nothing to save — this file could not be read":r==="needs-permission"?"Click Save to allow writing this file":r==="saving"?"Saving…":r==="error"?"Save failed — the file on disk was not changed":"Save file (Ctrl+S)",me=e("button",{type:"button",onClick:K,disabled:y||r==="saving",className:`${Zn} hover:bg-ink/5`,title:ne,"aria-label":ne,children:r==="saving"?e(yt,{size:14,className:"text-warning animate-pulse"}):r==="saved"?e(f,{size:14,className:"text-success"}):r==="error"?e(I,{size:14,className:"text-error"}):r==="needs-permission"?e(yt,{size:14,className:"text-warning"}):e(yt,{size:14,className:"hover:text-ink"})}),ee=E?"Exit full screen":"Full screen",te=e("button",{type:"button",onClick:j,className:`${Zn} hover:bg-ink/5 hover:text-ink ${E?"text-ink":""}`,title:ee,"aria-label":ee,"aria-pressed":E,children:E?e(we,{size:14}):e(xe,{size:14})}),ue=cd(),ie=ed(),le=st({byteViewer:x,hasPreview:c,isPreview:p,wordWrap:l,hasReview:g,isReviewing:h,blameInline:ue.inline,findOpen:M,copied:v,isMaximized:E,saveDisabled:y,canReload:R,refreshing:P,reloadDiscardsEdits:Q,saveButton:me,maximizeButton:te,viewModeButtons:e(td,{size:14}),viewModeActions:ie,previewLabel:p?"Show source":"Show preview",findLabel:"Find and replace",wordWrapLabel:l?"Word wrap on":"Word wrap off",copyLabel:v?"Copied":x?"Copy image":"Copy content",maximizeLabel:ee,onTogglePreview:W,onToggleReview:z,onToggleFind:H,onToggleWordWrap:L,onToggleBlameInline:()=>{let fe={...po(),inline:!ue.inline};Wr({editorBlameInline:fe.inline}),window.dispatchEvent(new CustomEvent(os,{detail:fe}))},onZoomIn:_,onZoomOut:O,onCopy:G,onDownload:Z,onReload:N,onSaveAs:X,onToggleMaximize:j,onSave:K});return e("div",{className:"@container flex items-center justify-between gap-2 px-3 py-2 border-b border-ink/10 bg-paper flex-shrink-0",children:[e("div",{className:"hidden @[420px]:flex items-center space-x-2 text-xs font-mono text-ink/40 min-w-0",children:e("span",{className:"truncate max-w-[300px]",title:t,children:t})}),e(fo,{clusters:le,className:"text-ink/40 ml-auto"})]})}function dt({content:t,file:r,zoomLevel:l,reviewActive:c,onExitReview:p,scrollRef:g,onScroll:h}){return e("div",{ref:g,onScroll:h,"data-testid":"editor-scroller",className:"flex-1 overflow-auto bg-paper flex",children:e("div",{className:"p-6 max-w-4xl mx-auto font-sans flex-1",style:{fontSize:`${l}px`},children:e(Bc,{content:t,file:r,active:c,onExit:p})})})}function wn(t,r){return r?`Spaces: ${t}`:"Tabs"}function ct({caret:t,eol:r,onSetEol:l,indentWidth:c,insertSpaces:p,language:g,byteViewer:h,viewerKind:v,lineCount:x,conflicts:y=0}){return e("footer",{className:"flex bg-canvas border-t border-ink/10 px-3 items-center justify-between text-[10px] text-ink/50 flex-shrink-0 font-mono h-6","data-editor-status-bar":"",children:[e("div",{className:"flex items-center gap-3 min-w-0",children:h?e("span",{className:"uppercase",children:Li[v]}):e(d,{children:[e("span",{className:"tabular-nums",children:t?`Ln ${t.line}, Col ${t.column}`:"Ln —, Col —"}),e("span",{children:wn(c,p)}),e("button",{type:"button",onClick:()=>l(r==="lf"?"crlf":"lf"),className:"uppercase hover:text-ink transition-colors cursor-pointer",title:`Line endings: ${r.toUpperCase()} — click to switch`,"aria-label":`Line endings ${r.toUpperCase()}, switch`,children:r}),e("span",{children:[x," lines"]})]})}),e("div",{className:"flex items-center gap-3 min-w-0",children:[y>0&&e("span",{className:"text-error font-semibold tabular-nums",title:`${y} unresolved conflict${y===1?"":"s"} — markers are highlighted in the file`,children:["⚠ ",y," conflict",y===1?"":"s"]}),e("span",{className:"uppercase text-ink/40",children:g})]})]})}function kn(t){if(t===0)return 0;return Math.max(-1,Math.min(1,-Math.sign(t)))}function Sn(t,r,l=zs,c=Us){return Math.max(l,Math.min(c,t+r))}function Cn(t,r){let l=t instanceof HTMLElement?t:null;while(l&&l!==r){let c=getComputedStyle(l);if(/(auto|scroll)/.test(c.overflowY)&&l.scrollHeight>l.clientHeight)return!0;l=l.parentElement}return!1}function mt(t,r){i(()=>{if(!t)return;let l=t.closest("[data-code-surface]"),c=l instanceof HTMLElement?l:t,p=(g)=>{if(!g.ctrlKey&&!g.metaKey)return;if(g.preventDefault(),Cn(g.target,c))return;let h=kn(g.deltaY);if(h===0)return;r((v)=>Sn(v,h))};return t.addEventListener("wheel",p,{passive:!1}),()=>t.removeEventListener("wheel",p)},[t,r])}function ut(t,r){let l=t.trim();if(!/^\d+$/.test(l))return null;let c=Number(l);if(c<1)return null;return Math.min(c,Math.max(r,1))}function pt({lineCount:t,onGo:r,onClose:l}){let[c,p]=n(""),g=o(null);i(()=>{g.current?.focus(),g.current?.select()},[]);let h=()=>{let y=ut(c,t);if(y===null)return;r(y)},v=(y)=>{if(y.key==="Enter"){y.preventDefault(),h();return}if(y.key==="Escape")y.preventDefault(),l()},x=ut(c,t);return e(J,{onClose:l,maxWidthClass:"max-w-xs",header:e("span",{className:"text-sm font-semibold text-ink",children:"Go to line"}),children:e("div",{className:"px-4 py-3 space-y-2",children:[e("div",{className:"flex items-center gap-2",children:[e("input",{ref:g,value:c,onInput:(y)=>p(y.target.value),onKeyDown:v,inputMode:"numeric",placeholder:"1","aria-label":"Line number",className:"flex-1 bg-paper border border-ink/20 rounded px-2 py-1 text-xs font-mono text-ink outline-none focus:border-ink/40"}),e("span",{className:"text-[10px] font-mono text-ink/40",children:["/ ",t]}),e("button",{type:"button",onClick:h,disabled:x===null,className:"flex items-center gap-1 px-2 py-1 rounded bg-ink text-paper text-xs disabled:opacity-40 disabled:cursor-default cursor-pointer",children:[e(tt,{size:12}),"Go"]})]}),c&&x!==null&&String(x)!==c.trim()?e("div",{className:"text-[10px] text-ink/50 font-mono",children:["line ",x," (the last line)"]}):null,c&&x===null?e("div",{className:"text-[10px] text-error font-mono",children:"Enter a line number"}):null]})})}var ft={status:"idle",payload:null,message:null};function bt(t){if(!t?.path)return"";return`${t.root??""}\x00${t.repo??""}\x00${t.path}`}function gt(t,r={}){let l=r.enabled!==!1&&Boolean(t?.path)&&t?.deviceFile!==!0,c=r.dirty===!0,p=bt(t),[g,h]=n({key:"",value:ft}),v=o(t);v.current=t;let x=o(p);x.current=p;let y=o(l);y.current=l;let w=o(c);w.current=c;let k=o(g);k.current=g;let A=o(0),E=o(""),M=o(new Map),H=o(new Set),K=a(async()=>{let O=v.current;if(!O?.path)return;let G=bt(O),Z=++A.current;E.current=G,h((R)=>({key:G,value:{status:"loading",payload:R.key===G?R.value.payload:null,message:null}}));let N=new URLSearchParams({blame:"1",file:O.path,repo:O.repo||"."});if(O.root)N.set("root",O.root);try{let R=await fetch(`/api/fs/git?${N.toString()}`),P=await R.json().catch(()=>null);if(Z!==A.current)return;if(!R.ok||!P){h({key:G,value:{status:"error",payload:null,message:P?.error??`Blame request failed (HTTP ${R.status})`}});return}h({key:G,value:P.available?{status:"ready",payload:P,message:null}:{status:"unavailable",payload:P,message:P.message??null}})}catch(R){if(Z!==A.current)return;h({key:G,value:{status:"error",payload:null,message:R instanceof Error?R.message:"Blame failed"}})}finally{if(E.current===G)E.current=""}},[]),W=a(async(O)=>{let G=M.current.get(O);if(G)return G;let Z=v.current;if(!Z?.path)return{entries:[],truncated:!1};let N=new URLSearchParams({blameHistory:"1",file:Z.path,line:String(O),repo:Z.repo||"."});if(Z.root)N.set("root",Z.root);try{let P=await(await fetch(`/api/fs/git?${N.toString()}`)).json().catch(()=>null),Q={entries:Array.isArray(P?.entries)?P.entries:[],truncated:P?.truncated===!0};return M.current.set(O,Q),Q}catch{return{entries:[],truncated:!1}}},[]),z=o(null);if(!z.current)z.current={ensure:()=>{if(!y.current||w.current)return;let O=k.current;if(O.key===x.current&&O.value.status!=="idle")return;if(E.current===x.current)return;K()},reload:()=>{M.current.clear(),K()},history:W,snapshot:()=>{let O=k.current;return O.key===x.current?O.value:ft},stale:()=>w.current,subscribe:(O)=>(H.current.add(O),()=>{H.current.delete(O)})};i(()=>{if(!l||c||!p)return;M.current.clear(),K()},[l,c,p,K]);let L=o(c);return i(()=>{if(L.current===c)return;L.current=c;for(let O of H.current)O()},[c]),i(()=>{for(let O of H.current)O()},[g]),z.current}var En="0".repeat(40);function Ee(t){return t===En}function ge(t,r=Date.now()){let l=Math.max(0,Math.floor(r/1000)-t);if(l<60)return"just now";let c=Math.floor(l/60);if(c<60)return`${c}m ago`;let p=Math.floor(c/60);if(p<24)return`${p}h ago`;let g=Math.floor(p/24);if(g<30)return`${g}d ago`;let h=Math.floor(g/30);if(h<12)return`${h}mo ago`;return`${Math.floor(g/365)}y ago`}function ht(t,r){switch(t){case"not-repo":return"This folder is not a git repository.";case"no-commit":return"This repository has no commits yet.";case"untracked":return"This file has never been committed, so it has no history.";case"too-large":return r??"This file is too large to blame.";case"empty":return"This file is empty.";default:return r??"git could not read this file."}}var St="fixed z-50 w-[min(340px,92vw)] rounded-xl border border-ink/20 bg-paper p-3 shadow-xl font-sans text-xs text-ink",vt="flex items-baseline justify-between gap-2",xt="truncate text-xs font-semibold text-ink",Tn="shrink-0 font-mono text-[10px] text-ink/40",Mn="mt-1 line-clamp-2 text-[11px] leading-snug text-ink/80",Nn="mt-2 border-t border-ink/10 pt-2",Rn="flex items-center gap-2 font-mono text-[10px] text-ink/40",kt="mt-1 text-[10px] leading-snug text-ink/50",Pn="mt-2 flex w-full items-center gap-1.5 text-left text-[10px] text-ink/50 hover:text-ink cursor-pointer",Ln="mt-1.5 space-y-1 border-t border-ink/10 pt-1.5",Te="flex items-center gap-1.5 font-mono text-[10px]";function q(t,r,l){let c=document.createElement(t);if(c.className=r,l!==void 0)c.textContent=l;return c}function Bn(t){return new Date(t*1000).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function Dn(t){let r=t.payload;if(t.status==="error")return{title:"Blame failed",body:t.message??"git could not read this file."};if(t.status==="unavailable")return{title:r?.reason==="untracked"?"Not tracked":"No history",body:ht(r?.reason??"error",t.message??void 0)};if(!r)return null;if(t.stale)return{title:"Not committed yet",body:"This line changed in the editor. Save the file to see its blame."};if(t.line>r.lines)return{title:"Not committed yet",body:`Line ${t.line} is past the end of the file at HEAD (${r.lines} lines).`};let l=r.runs.length>0?Ct(r,t.line):null;if(!l)return{title:"Not committed yet",body:`git has no attribution for line ${t.line}.`};if(Ee(l.sha))return{title:"Not committed yet",body:"This line differs from the last commit."};return null}function Ct(t,r){for(let l of t.runs)if(r>=l.from&&r<=l.to)return t.commits[l.sha]??null;return null}function On(t,r){t.replaceChildren(),t.className=St;let l=Dn(r);if(l){let y=q("div",vt);if(y.append(q("span",xt,l.title)),r.status==="error"&&r.message){let w=q("button","shrink-0 cursor-pointer text-[10px] text-ink/50 hover:text-ink","Try again");w.type="button",w.setAttribute("aria-label","Read the blame again"),y.append(w)}t.append(y,q("p",kt,l.body));return}let c=r.payload;if(!c){t.append(q("p",kt,"Reading blame…"));return}let p=Ct(c,r.line),g=q("div",vt);if(g.append(q("span",xt,p.author.trim()||"Unknown"),q("span",Tn,ge(p.time))),t.append(g),p.summary)t.append(q("p",Mn,p.summary));let h=q("div",`${Rn} ${Nn}`);if(h.append(q("code","truncate",p.sha.slice(0,7)),q("span","",Bn(p.time))),p.mail){let y=q("span","truncate",p.mail);y.title=p.mail,h.append(y)}t.append(h);let v=q("button",Pn);if(v.type="button",v.setAttribute("aria-expanded",r.historyOpen?"true":"false"),v.textContent=`${r.historyOpen?"▾":"▸"} Line history`,t.append(v),!r.historyOpen)return;let x=q("ol",Ln);if(r.historyLoading)x.append(q("li",`${Te} text-ink/40`,"Reading history…"));else if(!r.history||r.history.entries.length===0)x.append(q("li",`${Te} text-ink/40`,"No commits touched this line."));else{let y=r.history.entries;if(y.forEach((w,k)=>{let A=q("li",Te),E=k===y.length-1?"new":"edit";A.append(q("span","text-ink/40",k===0?"●":"○"),q("code","text-ink/60",w.sha.slice(0,7)),q("span","truncate text-ink/80",w.author.trim()||"Unknown"),q("span","ml-auto shrink-0 text-ink/40",ge(w.time)),q("span","shrink-0 rounded bg-ink/5 px-1 text-[8.5px] uppercase tracking-wider text-ink/45",E)),x.append(A)}),r.history.truncated)x.append(q("li",`${Te} text-ink/40`,"Older commits are not shown."))}t.append(x)}function Et(t,r,l){let c=q("div",St);c.setAttribute("role","dialog"),c.setAttribute("aria-label","Line blame"),c.addEventListener("mousedown",(w)=>w.stopPropagation());let p=null,g=!1,h=!1,v=()=>{let w=r.snapshot();return{line:t,status:w.status,payload:w.payload,message:w.message,stale:r.stale(),history:p,historyOpen:g,historyLoading:h}},x=()=>{On(c,v());let w=c.querySelector('[aria-label="Read the blame again"]');if(w)w.addEventListener("click",(k)=>{k.stopPropagation(),l()});c.querySelector("button[aria-expanded]")?.addEventListener("click",(k)=>{if(k.stopPropagation(),g=!g,x(),!g||p||h)return;h=!0,x(),r.history(t).then((A)=>{p=A,h=!1,x()})})};x();let y=r.subscribe(x);return{element:c,place(w){let k=c.ownerDocument.defaultView,A=k?.innerWidth??1024,E=k?.innerHeight??768,M=c.offsetWidth||340,H=c.offsetHeight||120,K=8,W=Math.max(8,Math.min(w.left,A-M-8)),z=w.bottom+6,L=w.top-H-6,_=z+H>E-8&&L>8?L:z;c.style.left=`${W}px`,c.style.top=`${Math.max(8,_)}px`},destroy(){y(),c.remove()}}}function Tt(t){return ye.define((r)=>{let l=null,c=0,p,g=()=>{clearTimeout(p),p=void 0,l?.destroy(),l=null,c=0},h=(E,M)=>{let H=E.getBoundingClientRect();if(H.width>0)return{left:H.left,top:H.top,bottom:H.bottom};let K=r.state.doc.line(Math.min(M,r.state.doc.lines)),W=null;try{W=r.coordsAtPos(K.from)}catch{W=null}if(W)return W;let z=r.scrollDOM.getBoundingClientRect();return{left:z.left,top:z.top+24,bottom:z.top+24}},v=(E,M)=>{if(c===E&&l)return;g(),c=E,l=Et(E,t,()=>{t.reload(),g()}),document.body.append(l.element),l.place(M)},x=(E)=>{let M=E.target,H=M?.closest?.(".cm-blame-label");if(H){let z=Number(H.dataset.blameLine);return Number.isInteger(z)&&z>0?{line:z,anchor:H}:null}let K=M?.closest?.(".cm-lineNumbers .cm-gutterElement");if(!K)return null;let W=Number((K.textContent??"").trim());return Number.isInteger(W)&&W>0?{line:W,anchor:K}:null},y=(E)=>{let M=x(E);if(!M)return;v(M.line,h(M.anchor,M.line))},w=(E)=>{let M=x(E);if(M){E.preventDefault(),v(M.line,h(M.anchor,M.line));return}if(l&&!l.element.contains(E.target))g()},k=(E)=>{if(E.key==="Escape"&&l)g(),E.stopPropagation()},A=(E)=>{if(!l)return;let M=E.relatedTarget;if(M&&(l.element.contains(M)||r.scrollDOM.contains(M)))return;p=setTimeout(g,200)};return r.scrollDOM.addEventListener("mouseover",y),r.scrollDOM.addEventListener("mouseleave",A),r.scrollDOM.addEventListener("mousedown",w),document.addEventListener("mousedown",w),document.addEventListener("keydown",k,!0),{update(E){if(E.docChanged&&l)g()},destroy(){g(),r.scrollDOM.removeEventListener("mouseover",y),r.scrollDOM.removeEventListener("mouseleave",A),r.scrollDOM.removeEventListener("mousedown",w),document.removeEventListener("mousedown",w),document.removeEventListener("keydown",k,!0)}}})}var Mt=40,Rt=re.define();function An(t){return Ne.define({create:()=>({payload:t.snapshot().payload,stale:!1}),update(r,l){let c=r;for(let p of l.effects){if(!p.is(Rt))continue;c=p.value.payload!==r.payload?{payload:p.value.payload,stale:!1}:{payload:r.payload,stale:r.stale}}if(l.docChanged&&!c.stale)c={payload:c.payload,stale:!0};return c}})}function In(t,r,l){let c=t.commits[r];if(!c||Ee(r))return null;let p=c.author.trim()||"Unknown";return l?p:`${p} · ${ge(c.time)}`}class Pt extends jt{constructor(t,r,l){super();this.line=t;this.text=r;this.title=l}eq(t){return t.line===this.line&&t.text===this.text&&t.title===this.title}toDOM(){let t=document.createElement("span");return t.className="cm-blame-label",t.dataset.blameLine=String(this.line),t.title=this.title,t.textContent=this.text,t}}function Nt(t,r,l){let{payload:c,stale:p}=t;if(!c?.available||p)return T.none;let g=Math.min(c.lines,r.state.doc.lines);if(g<1)return T.none;let h=r.state.doc.lineAt(Math.max(0,Math.min(r.viewport.from,r.state.doc.length))).number,v=r.state.doc.lineAt(Math.max(0,Math.min(r.viewport.to,r.state.doc.length))).number,x=Math.max(1,h-Mt),y=Math.min(g,v+Mt),w=[];for(let k of c.runs){let A=Math.max(k.from,x);if(A>k.to||A>y)continue;let E=In(c,k.sha,l);if(!E)continue;let M=c.commits[k.sha],H=r.state.doc.line(A);w.push({from:H.to,deco:T.widget({widget:new Pt(H.number,E,M.summary||M.sha),side:1})})}return T.set(w.map((k)=>k.deco.range(k.from)),!0)}function Fn(t,r){return ye.fromClass(class{constructor(l){this.view=l;this.decorations=Nt(l.state.field(t),l,r)}update(l){if(l.startState.field(t)===l.state.field(t)&&!l.docChanged&&!l.viewportChanged)return;this.decorations=Nt(l.state.field(t),l.view,r)}},{decorations:(l)=>l.decorations})}function zn(t){return ye.define((r)=>{let l=!0,c=()=>{if(!l)return;let g=t.snapshot();r.dispatch({effects:Rt.of({payload:g.payload,stale:!1})})},p=t.subscribe(c);return{destroy(){l=!1,p()}}})}function Lt({controller:t,inline:r=!0,compact:l=!1}){let c=An(t);return[c,zn(t),r?Fn(c,l):[],Tt(t)]}function Bt({activeFile:t,editor:r,find:l,surfaceRef:c,goToLineRequest:p,rootPath:g=null,repoPath:h=null,onRunCommand:v,wordWrap:x,zoomLevel:y,setZoomLevel:w,editorFontFamily:k,editorTheme:A,viewerKind:E,isPreview:M,reviewActive:H,onToggleReview:K,revealActive:W}){let z=E==="markdown",L=jc(),_=Hc(),O=cd(),G=gt({name:t.name,path:t.path,root:t.root??g??void 0,repo:t.repo??h??"."},{enabled:O.enabled,dirty:r.isDirty}),Z=u(()=>O.enabled?Lt({controller:G,inline:O.inline}):null,[O.enabled,O.inline,G]),[N,R]=n(null),P=u(()=>Ic(r.content),[r.content]),[Q,X]=n(!1);i(()=>{if(p>0)X(!0)},[p]);let[j,ne]=n(null),[me,ee]=n(null);mt(j,w);let te=Ys({tabKey:String(t.id),surface:z&&M?"rendered":"code",ready:r.loaded,element:z&&M?void 0:j}),ue=a((ie)=>{te.ref(ie),ee(ie)},[te.ref]);return Tc({path:t.path,scroller:me,preview:z&&M}),e("div",{className:"relative flex-1 min-h-0 flex flex-col",children:[l.open?e(Sc,{find:l}):null,Q?e(pt,{lineCount:r.content?r.content.split(`
1
+ import{d,n,i,V,o,u,a,He,se,e,Gn,Ze,ze,S,s,I,m,Kt,D,f,B,ae,tt,he,wt,Ge,Zi,en,qr,C,F,b,Wr,Ke,ce,dr,J,at,$s,xi,zs,Us,Ci,Eg,Pg,Ys,Ne,re,jt,T,ye,Fi,lo,Um,Vf}from"./index-d8kjsgpt.js";import{yt,uo,Gc,jc,Hc,os,po,cd}from"./index-rtd9frp1.js";import{Cc,ed,td,eA,tA,Ec,Zn,ns,Bc,Ic,_c,Sc,Tc,rs,Li,as,Qc,al,il,Nc,Rc,Fc,Lc,Mc,Pc,Oc,$c,zc}from"./index-6k2x281j.js";import{Sa,Ta,fo}from"./index-d146s9g3.js";var fn={name:"git-commit-vertical",size:24,node:[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]},Le=s(fn);var bn={name:"maximize",size:24,node:[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]},xe=s(bn);var gn={name:"minimize",size:24,node:[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]},we=s(gn);var hn={name:"save-all",size:24,node:[["path",{d:"M10 2v3a1 1 0 0 0 1 1h5",key:"1xspal"}],["path",{d:"M18 18v-6a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6",key:"1ra60u"}],["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"M8 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9.172a2 2 0 0 1 1.414.586l2.828 2.828A2 2 0 0 1 22 6.828V16a2 2 0 0 1-2.01 2z",key:"1yve0x"}]]},ke=s(hn);var oe=new Set,Be=new Set,Fe=new Set;function $e(){Fe=new Set(oe);for(let t of[...Be])t()}function Ve(t){let r=new Set(t);if(r.size===oe.size){let l=!0;for(let c of r)if(!oe.has(c)){l=!1;break}if(l)return}oe.clear();for(let l of r)oe.add(l);$e()}function We(t){let r=new Set(t),l=!1;for(let c of[...oe])if(!r.has(c))oe.delete(c),l=!0;if(l)$e()}function Ue(t){return oe.has(t)}function _e(){return oe.size>0}function vn(t){return Be.add(t),()=>{Be.delete(t)}}var yn=vn;function qe(){return He(yn,()=>Fe)}function Xe({x:t,y:r,rows:l,onAction:c,onClose:p}){let g=o(null),[h,v]=n({left:t,top:r});return V(()=>{let x=g.current;if(!x)return;let{width:y,height:w}=x.getBoundingClientRect();v({left:Math.min(t,Math.max(0,window.innerWidth-y-8)),top:Math.min(r,Math.max(0,window.innerHeight-w-8))})},[t,r,l.length]),se(e("div",{className:"fixed inset-0 z-[70]",onClick:p,onContextMenu:(x)=>{x.preventDefault(),p()},children:e("div",{ref:g,role:"menu","aria-label":"Tab actions",className:"glass-popover absolute w-52 bg-paper border border-ink/15 rounded-md shadow-xl py-1 text-xs text-ink",style:{left:`${h.left}px`,top:`${h.top}px`},onClick:(x)=>x.stopPropagation(),children:l.map((x)=>e("button",{type:"button",role:"menuitem",onClick:()=>{c(x.action),p()},className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 transition-colors cursor-pointer",children:x.label},x.action))})}),document.body)}var be={rightFileId:null,fraction:0.5};function Se(t,r,l){if(t===null)return!1;if(t===r)return!1;return l.includes(t)}function Ye(t,r){for(let l=r.length-1;l>=0;l-=1){let c=r[l];if(c!==t)return c}return null}function je(t,r){if(t.rightFileId===null)return t;if(t.rightFileId!==r)return t;return{...t,rightFileId:null}}function pe(t){if(!Number.isFinite(t))return be.fraction;return Math.max(0.2,Math.min(0.8,t))}function Je(t,r){if(typeof t!=="object"||t===null)return be;let l=t,c=typeof l.fraction==="number"?pe(l.fraction):be.fraction,p=typeof l.rightFileId==="string"||typeof l.rightFileId==="number"?l.rightFileId:null;if(p===null||!r.includes(p))return{rightFileId:null,fraction:c};return{rightFileId:p,fraction:c}}function Qe({tab:t,openedFiles:r,dirtyIds:l,reopenable:c,activeFileId:p,splitRightFileId:g}){let h=r.filter((w)=>w.id!==t.id),v=r.filter((w)=>!l.has(w.id)),x=r.map((w)=>w.id);return[{action:"split-right",label:"Split right",enabled:Se(t.id,p,x)},{action:"unsplit",label:"Unsplit",enabled:g!==null},{action:"close",label:"Close",enabled:!0},{action:"close-others",label:"Close others",enabled:h.length>0},{action:"close-all",label:"Close all",enabled:r.length>0},{action:"close-saved",label:"Close saved",enabled:v.some((w)=>w.id!==t.id)},{action:"copy-path",label:"Copy path",enabled:Boolean(t.path)},{action:"reveal-in-files",label:"Reveal in Files",enabled:Boolean(t.path)&&!t.isDiff},{action:"reopen-closed",label:"Reopen closed tab",enabled:c>0}].filter((w)=>w.enabled)}function nt({openedFiles:t,activeFileId:r,onSelectFile:l,onCloseFile:c,missingIds:p,onCopyPath:g,onRevealInFiles:h,onReopenClosed:v,reopenableCount:x,onSplitTo:y,onUnsplit:w,splitRightFileId:k=null}){let A=qe(),E=o(null),M=o(null),[H,K]=n(5),[W,z]=n(!1),[L,_]=n(null);ce(M,()=>z(!1)),i(()=>{let N=new ResizeObserver((R)=>{for(let P of R){let Q=P.contentRect.width,X=Math.max(1,Math.floor((Q-60)/150));K(X)}});if(E.current)N.observe(E.current);return()=>N.disconnect()},[]);let O=Ye(r,t.map((N)=>N.id)),G=[],Z=[];if(t.length<=H)G=t;else{let N=t.findIndex((P)=>P.id===r),R=new Set;if(N!==-1&&r!==null)R.add(r);for(let P=t.length-1;P>=0;P--){if(R.size>=H)break;R.add(t[P].id)}G=t.filter((P)=>R.has(P.id)),Z=t.filter((P)=>!R.has(P.id))}return e("div",{className:"flex bg-ink/10 w-full relative border-b border-ink/10",ref:E,children:[e("div",{className:"flex overflow-hidden",children:G.map((N)=>{let R=N.id===r,P=Boolean(N.isDiff),Q=P?Gn(N.diffStatus||"M",N.diffStaged):null,X=Boolean(p?.has(N.id));return e("div",{onClick:()=>l(N.id),onContextMenu:(j)=>{j.preventDefault(),_({tab:N,x:j.clientX,y:j.clientY})},className:`flex items-center space-x-1.5 px-3 py-1.5 cursor-pointer border-r border-ink/10 min-w-[120px] max-w-[210px] group ${R?"bg-paper border-t-2 border-t-ink text-ink":"bg-transparent border-t-2 border-t-transparent text-ink/60 hover:bg-paper/50"}`,title:X?`${N.path} — file no longer exists`:N.path,children:[P?e(Zi,{size:14,className:R?"text-info flex-shrink-0":"text-info/70 flex-shrink-0"}):e(at,{name:N.name,size:14,className:`flex-shrink-0${R||X?"":" opacity-60"}${X?" text-error":""}`}),e("span",{className:`text-xs font-mono truncate flex-1${X?" text-error line-through":""}`,children:N.name}),Q&&e("span",{className:`px-1 text-[10px] font-mono font-bold rounded ${Q.badgeBgClass}`,children:Q.charStatus}),e(et,{dirty:A.has(N.id),active:R,label:`Close ${N.name}`,onClose:()=>c(N.id)})]},N.id)})}),L?e(Xe,{x:L.x,y:L.y,rows:Qe({tab:L.tab,openedFiles:t,dirtyIds:A,reopenable:x?.()??0,activeFileId:r,splitRightFileId:k}),onAction:(N)=>{let R=L.tab;switch(N){case"close":c(R.id);return;case"close-others":for(let P of[...t].reverse())if(P.id!==R.id)c(P.id);l(R.id);return;case"close-all":for(let P of[...t].reverse())c(P.id);return;case"close-saved":for(let P of[...t].reverse())if(!A.has(P.id))c(P.id);return;case"copy-path":g?.(R);return;case"reveal-in-files":h?.(R);return;case"reopen-closed":v?.();return;case"split-right":y?.(R.id);return;case"unsplit":w?.();return}},onClose:()=>_(null)}):null,e("div",{className:"ml-auto flex items-center",children:e("button",{type:"button",onClick:()=>k!==null?w?.():y?.(O),disabled:k===null&&O===null,"aria-pressed":k!==null,"aria-label":"Split editor",title:k!==null?"Close the split pane (the tab stays open)":O===null?"Open another file to split the editor":"Split the editor and show the newest other file",className:`p-1.5 mx-1 rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-default ${k!==null?"bg-ink/10 text-ink":"text-ink/60 hover:bg-ink/10"}`,children:e(qr,{size:14})})}),Z.length>0&&e("div",{className:"relative flex items-center bg-ink/10",ref:M,children:[e("button",{className:`p-1.5 mx-1 rounded hover:bg-ink/10 text-ink/60 ${W?"bg-ink/10 text-ink":""}`,onClick:()=>z(!W),title:"More open files",children:e(B,{size:14})}),W&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-52 bg-paper border border-ink/10 rounded shadow-lg z-50 py-1",children:[e("div",{className:"px-3 py-1 text-[10px] uppercase font-mono text-ink/40 border-b border-ink/10 mb-1",children:"Older Tabs"}),Z.map((N)=>{let R=Boolean(p?.has(N.id));return e("div",{onClick:()=>{l(N.id),z(!1)},className:"flex items-center space-x-2 px-3 py-1.5 hover:bg-ink/5 cursor-pointer group",children:[N.isDiff?e(Zi,{size:14,className:"text-info/80"}):e(at,{name:N.name,size:14,className:R?"text-error":"opacity-60"}),e("span",{className:`text-xs font-mono truncate flex-1 ${R?"text-error line-through":"text-ink/80"}`,children:N.name}),e(et,{dirty:A.has(N.id),active:!1,label:`Close ${N.name}`,onClose:()=>{if(c(N.id),Z.length===1)z(!1)}})]},N.id)})]})]})]})}function et({dirty:t,active:r,label:l,onClose:c}){return e("div",{role:"button",tabIndex:-1,"aria-label":l,title:t?`${l} — unsaved changes`:l,className:`p-0.5 rounded hover:bg-ink/10 touch-visible ${r||t?"opacity-100":"opacity-0 group-hover:opacity-100"}`,onClick:(p)=>{p.stopPropagation(),c()},children:t?e("span",{className:"block w-2 h-2 rounded-full bg-current mx-0.5","data-tab-dirty":"","aria-hidden":"true"}):e(b,{size:12})})}function xn(t){if(t===null)return null;let r=new Date(t);if(Number.isNaN(r.getTime()))return null;return r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Ce({diskMtimeMs:t,fileName:r,onReload:l,onKeepMine:c}){let p=xn(t);return e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-warning/30 bg-warning/10 text-[11px] text-ink flex-shrink-0",role:"alert","data-conflict-strip":"",children:[e(D,{size:13,className:"text-warning flex-shrink-0 mt-0.5"}),e("div",{className:"min-w-0 flex-1",children:[e("div",{className:"font-medium",children:[e("span",{className:"font-mono",children:r})," changed on disk",p?e("span",{className:"text-ink/60",children:[" at ",p]}):null,"."]}),e("div",{className:"text-ink/60 mt-0.5",children:"Your save was refused so nothing was overwritten."})]}),e("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e("button",{type:"button",onClick:l,className:"px-2 py-1 rounded border border-ink/20 hover:bg-ink/5 transition-colors cursor-pointer",title:"Discard my changes and take the file from disk",children:"Reload"}),e("button",{type:"button",onClick:c,className:"px-2 py-1 rounded border border-warning/50 text-warning hover:bg-warning/10 transition-colors cursor-pointer",title:"Write my buffer over the file on disk",children:"Keep mine"})]})]})}function ot(t){if(t.byteViewer)return[];return[{id:"save",pinned:!0,actions:[{label:"Save file",icon:ke,onSelect:t.onSave,disabled:t.saveDisabled}],children:t.saveButton},{id:"save-as",actions:[{label:"Save as…",icon:ke,onSelect:t.onSaveAs}],children:e("button",{type:"button",onClick:t.onSaveAs,className:`${Zn} hover:bg-ink/5 hover:text-ink`,title:"Save the buffer to a new file","aria-label":"Save as",children:e(ke,{size:14})})}]}function rt(t){if(!t.hasReview)return[];let r=t.isReviewing?"Exit review mode":"Review this document";return[{id:"review",actions:[{label:r,icon:en,onSelect:t.onToggleReview,active:t.isReviewing}],children:e(ns,{label:r,pressed:t.isReviewing,title:t.isReviewing?"Review mode is on — click a block to judge it":"Review: click blocks to mark them good or needing work",onClick:t.onToggleReview,children:e(en,{size:14})})}]}function it(t){if(!t.hasPreview)return[];return[{id:"preview",actions:[{label:t.previewLabel,icon:t.isPreview?wt:Ge,onSelect:t.onTogglePreview,active:t.isPreview}],children:e(ns,{label:t.previewLabel,pressed:t.isPreview,onClick:t.onTogglePreview,children:t.isPreview?e(wt,{size:14}):e(Ge,{size:14})})}]}function st(t){let r=[];if(r.push(...ot(t),...rt(t),...it(t)),!t.byteViewer)r.push({id:"find",actions:[{label:t.findLabel,icon:F,onSelect:t.onToggleFind,active:t.findOpen}],children:e(ns,{label:t.findLabel,pressed:t.findOpen,title:`${t.findLabel} (Ctrl+F)`,onClick:t.onToggleFind,children:e(F,{size:14})})}),r.push({id:"wrap",actions:[{label:t.wordWrapLabel,icon:Kt,onSelect:t.onToggleWordWrap,active:t.wordWrap}],children:e(ns,{label:t.wordWrapLabel,pressed:t.wordWrap,onClick:t.onToggleWordWrap,children:e(Kt,{size:14})})}),r.push({id:"blame",actions:[{label:t.blameInline?"Hide line blame":"Show line blame",icon:Le,onSelect:t.onToggleBlameInline,active:t.blameInline}],children:e(ns,{label:t.blameInline?"Hide line blame":"Show line blame",pressed:t.blameInline,title:"Who last changed each block, from git (hover a line for the commit)",onClick:t.onToggleBlameInline,children:e(Le,{size:14})})}),r.push({id:"zoom",actions:[{label:"Decrease font size",icon:Ta,onSelect:t.onZoomOut},{label:"Increase font size",icon:Sa,onSelect:t.onZoomIn}],children:e(d,{children:[e("button",{type:"button",onClick:t.onZoomOut,className:`${Zn} hover:bg-ink/5 hover:text-ink`,title:"Decrease font size","aria-label":"Decrease font size",children:e(Ta,{size:14})}),e("button",{type:"button",onClick:t.onZoomIn,className:`${Zn} hover:bg-ink/5 hover:text-ink`,title:"Increase font size","aria-label":"Increase font size",children:e(Sa,{size:14})})]})}),r.push({id:"reload",actions:[{label:"Reload from disk",icon:C,onSelect:t.onReload,disabled:!t.canReload}],children:e("button",{type:"button",onClick:t.onReload,disabled:!t.canReload||t.refreshing,"aria-busy":t.refreshing,className:`${Zn} hover:bg-ink/5 hover:text-ink`,title:!t.canReload?"Nothing to reload — this tab has no file on disk":t.reloadDiscardsEdits?"Discard my changes and reload from disk":"Reload from disk","aria-label":"Reload from disk",children:e(C,{size:14,className:t.refreshing?"animate-spin":void 0})})});return r.push({id:"copy",actions:[{label:t.copyLabel,icon:ae,onSelect:t.onCopy},{label:"Download file",icon:he,onSelect:t.onDownload}],children:e(d,{children:[e("button",{type:"button",onClick:t.onCopy,className:`${Zn} hover:bg-ink/5 hover:text-ink`,title:t.copyLabel,"aria-label":t.copyLabel,children:t.copied?e(ae,{size:14,className:"text-success"}):e(ae,{size:14})}),e("button",{type:"button",onClick:t.onDownload,className:`${Zn} hover:bg-ink/5 hover:text-ink`,title:"Download file","aria-label":"Download file",children:e(he,{size:14})})]})}),r.push({id:"view-modes",pinned:!0,actions:t.viewModeActions,children:t.viewModeButtons}),r.push({id:"maximize",pinned:!0,actions:[{label:t.maximizeLabel,icon:t.isMaximized?we:xe,onSelect:t.onToggleMaximize,active:t.isMaximized}],children:t.maximizeButton}),r}function lt({path:t,saveStatus:r,wordWrap:l,hasPreview:c,isPreview:p,hasReview:g,isReviewing:h,copied:v,byteViewer:x=!1,saveDisabled:y=!1,unsupported:w=!1,handleMissing:k=!1,readOnly:A=!1,isMaximized:E=!1,findOpen:M=!1,onToggleFind:H,onSave:K,onTogglePreview:W,onToggleReview:z,onToggleWordWrap:L,onZoomIn:_,onZoomOut:O,onCopy:G,onDownload:Z,onReload:N,canReload:R,refreshing:P=!1,reloadDiscardsEdits:Q,onSaveAs:X,onToggleMaximize:j}){let ne=y?A?"Read-only — this file was opened from the phone, not from a workspace":k?"Cannot save — reopen the file from the system to restore write access":w?"Nothing to save — this file cannot be opened as a document":"Nothing to save — this file could not be read":r==="needs-permission"?"Click Save to allow writing this file":r==="saving"?"Saving…":r==="error"?"Save failed — the file on disk was not changed":"Save file (Ctrl+S)",me=e("button",{type:"button",onClick:K,disabled:y||r==="saving",className:`${Zn} hover:bg-ink/5`,title:ne,"aria-label":ne,children:r==="saving"?e(yt,{size:14,className:"text-warning animate-pulse"}):r==="saved"?e(f,{size:14,className:"text-success"}):r==="error"?e(I,{size:14,className:"text-error"}):r==="needs-permission"?e(yt,{size:14,className:"text-warning"}):e(yt,{size:14,className:"hover:text-ink"})}),ee=E?"Exit full screen":"Full screen",te=e("button",{type:"button",onClick:j,className:`${Zn} hover:bg-ink/5 hover:text-ink ${E?"text-ink":""}`,title:ee,"aria-label":ee,"aria-pressed":E,children:E?e(we,{size:14}):e(xe,{size:14})}),ue=cd(),ie=ed(),le=st({byteViewer:x,hasPreview:c,isPreview:p,wordWrap:l,hasReview:g,isReviewing:h,blameInline:ue.inline,findOpen:M,copied:v,isMaximized:E,saveDisabled:y,canReload:R,refreshing:P,reloadDiscardsEdits:Q,saveButton:me,maximizeButton:te,viewModeButtons:e(td,{size:14}),viewModeActions:ie,previewLabel:p?"Show source":"Show preview",findLabel:"Find and replace",wordWrapLabel:l?"Word wrap on":"Word wrap off",copyLabel:v?"Copied":x?"Copy image":"Copy content",maximizeLabel:ee,onTogglePreview:W,onToggleReview:z,onToggleFind:H,onToggleWordWrap:L,onToggleBlameInline:()=>{let fe={...po(),inline:!ue.inline};Wr({editorBlameInline:fe.inline}),window.dispatchEvent(new CustomEvent(os,{detail:fe}))},onZoomIn:_,onZoomOut:O,onCopy:G,onDownload:Z,onReload:N,onSaveAs:X,onToggleMaximize:j,onSave:K});return e("div",{className:"@container flex items-center justify-between gap-2 px-3 py-2 border-b border-ink/10 bg-paper flex-shrink-0",children:[e("div",{className:"hidden @[420px]:flex items-center space-x-2 text-xs font-mono text-ink/40 min-w-0",children:e("span",{className:"truncate max-w-[300px]",title:t,children:t})}),e(fo,{clusters:le,className:"text-ink/40 ml-auto"})]})}function dt({content:t,file:r,zoomLevel:l,reviewActive:c,onExitReview:p,scrollRef:g,onScroll:h}){return e("div",{ref:g,onScroll:h,"data-testid":"editor-scroller",className:"flex-1 overflow-auto bg-paper flex",children:e("div",{className:"p-6 max-w-4xl mx-auto font-sans flex-1",style:{fontSize:`${l}px`},children:e(Bc,{content:t,file:r,active:c,onExit:p})})})}function wn(t,r){return r?`Spaces: ${t}`:"Tabs"}function ct({caret:t,eol:r,onSetEol:l,indentWidth:c,insertSpaces:p,language:g,byteViewer:h,viewerKind:v,lineCount:x,conflicts:y=0}){return e("footer",{className:"flex bg-canvas border-t border-ink/10 px-3 items-center justify-between text-[10px] text-ink/50 flex-shrink-0 font-mono h-6","data-editor-status-bar":"",children:[e("div",{className:"flex items-center gap-3 min-w-0",children:h?e("span",{className:"uppercase",children:Li[v]}):e(d,{children:[e("span",{className:"tabular-nums",children:t?`Ln ${t.line}, Col ${t.column}`:"Ln —, Col —"}),e("span",{children:wn(c,p)}),e("button",{type:"button",onClick:()=>l(r==="lf"?"crlf":"lf"),className:"uppercase hover:text-ink transition-colors cursor-pointer",title:`Line endings: ${r.toUpperCase()} — click to switch`,"aria-label":`Line endings ${r.toUpperCase()}, switch`,children:r}),e("span",{children:[x," lines"]})]})}),e("div",{className:"flex items-center gap-3 min-w-0",children:[y>0&&e("span",{className:"text-error font-semibold tabular-nums",title:`${y} unresolved conflict${y===1?"":"s"} — markers are highlighted in the file`,children:["⚠ ",y," conflict",y===1?"":"s"]}),e("span",{className:"uppercase text-ink/40",children:g})]})]})}function kn(t){if(t===0)return 0;return Math.max(-1,Math.min(1,-Math.sign(t)))}function Sn(t,r,l=zs,c=Us){return Math.max(l,Math.min(c,t+r))}function Cn(t,r){let l=t instanceof HTMLElement?t:null;while(l&&l!==r){let c=getComputedStyle(l);if(/(auto|scroll)/.test(c.overflowY)&&l.scrollHeight>l.clientHeight)return!0;l=l.parentElement}return!1}function mt(t,r){i(()=>{if(!t)return;let l=t.closest("[data-code-surface]"),c=l instanceof HTMLElement?l:t,p=(g)=>{if(!g.ctrlKey&&!g.metaKey)return;if(g.preventDefault(),Cn(g.target,c))return;let h=kn(g.deltaY);if(h===0)return;r((v)=>Sn(v,h))};return t.addEventListener("wheel",p,{passive:!1}),()=>t.removeEventListener("wheel",p)},[t,r])}function ut(t,r){let l=t.trim();if(!/^\d+$/.test(l))return null;let c=Number(l);if(c<1)return null;return Math.min(c,Math.max(r,1))}function pt({lineCount:t,onGo:r,onClose:l}){let[c,p]=n(""),g=o(null);i(()=>{g.current?.focus(),g.current?.select()},[]);let h=()=>{let y=ut(c,t);if(y===null)return;r(y)},v=(y)=>{if(y.key==="Enter"){y.preventDefault(),h();return}if(y.key==="Escape")y.preventDefault(),l()},x=ut(c,t);return e(J,{onClose:l,maxWidthClass:"max-w-xs",header:e("span",{className:"text-sm font-semibold text-ink",children:"Go to line"}),children:e("div",{className:"px-4 py-3 space-y-2",children:[e("div",{className:"flex items-center gap-2",children:[e("input",{ref:g,value:c,onInput:(y)=>p(y.target.value),onKeyDown:v,inputMode:"numeric",placeholder:"1","aria-label":"Line number",className:"flex-1 bg-paper border border-ink/20 rounded px-2 py-1 text-xs font-mono text-ink outline-none focus:border-ink/40"}),e("span",{className:"text-[10px] font-mono text-ink/40",children:["/ ",t]}),e("button",{type:"button",onClick:h,disabled:x===null,className:"flex items-center gap-1 px-2 py-1 rounded bg-ink text-paper text-xs disabled:opacity-40 disabled:cursor-default cursor-pointer",children:[e(tt,{size:12}),"Go"]})]}),c&&x!==null&&String(x)!==c.trim()?e("div",{className:"text-[10px] text-ink/50 font-mono",children:["line ",x," (the last line)"]}):null,c&&x===null?e("div",{className:"text-[10px] text-error font-mono",children:"Enter a line number"}):null]})})}var ft={status:"idle",payload:null,message:null};function bt(t){if(!t?.path)return"";return`${t.root??""}\x00${t.repo??""}\x00${t.path}`}function gt(t,r={}){let l=r.enabled!==!1&&Boolean(t?.path)&&t?.deviceFile!==!0,c=r.dirty===!0,p=bt(t),[g,h]=n({key:"",value:ft}),v=o(t);v.current=t;let x=o(p);x.current=p;let y=o(l);y.current=l;let w=o(c);w.current=c;let k=o(g);k.current=g;let A=o(0),E=o(""),M=o(new Map),H=o(new Set),K=a(async()=>{let O=v.current;if(!O?.path)return;let G=bt(O),Z=++A.current;E.current=G,h((R)=>({key:G,value:{status:"loading",payload:R.key===G?R.value.payload:null,message:null}}));let N=new URLSearchParams({blame:"1",file:O.path,repo:O.repo||"."});if(O.root)N.set("root",O.root);try{let R=await fetch(`/api/fs/git?${N.toString()}`),P=await R.json().catch(()=>null);if(Z!==A.current)return;if(!R.ok||!P){h({key:G,value:{status:"error",payload:null,message:P?.error??`Blame request failed (HTTP ${R.status})`}});return}h({key:G,value:P.available?{status:"ready",payload:P,message:null}:{status:"unavailable",payload:P,message:P.message??null}})}catch(R){if(Z!==A.current)return;h({key:G,value:{status:"error",payload:null,message:R instanceof Error?R.message:"Blame failed"}})}finally{if(E.current===G)E.current=""}},[]),W=a(async(O)=>{let G=M.current.get(O);if(G)return G;let Z=v.current;if(!Z?.path)return{entries:[],truncated:!1};let N=new URLSearchParams({blameHistory:"1",file:Z.path,line:String(O),repo:Z.repo||"."});if(Z.root)N.set("root",Z.root);try{let P=await(await fetch(`/api/fs/git?${N.toString()}`)).json().catch(()=>null),Q={entries:Array.isArray(P?.entries)?P.entries:[],truncated:P?.truncated===!0};return M.current.set(O,Q),Q}catch{return{entries:[],truncated:!1}}},[]),z=o(null);if(!z.current)z.current={ensure:()=>{if(!y.current||w.current)return;let O=k.current;if(O.key===x.current&&O.value.status!=="idle")return;if(E.current===x.current)return;K()},reload:()=>{M.current.clear(),K()},history:W,snapshot:()=>{let O=k.current;return O.key===x.current?O.value:ft},stale:()=>w.current,subscribe:(O)=>(H.current.add(O),()=>{H.current.delete(O)})};i(()=>{if(!l||c||!p)return;M.current.clear(),K()},[l,c,p,K]);let L=o(c);return i(()=>{if(L.current===c)return;L.current=c;for(let O of H.current)O()},[c]),i(()=>{for(let O of H.current)O()},[g]),z.current}var En="0".repeat(40);function Ee(t){return t===En}function ge(t,r=Date.now()){let l=Math.max(0,Math.floor(r/1000)-t);if(l<60)return"just now";let c=Math.floor(l/60);if(c<60)return`${c}m ago`;let p=Math.floor(c/60);if(p<24)return`${p}h ago`;let g=Math.floor(p/24);if(g<30)return`${g}d ago`;let h=Math.floor(g/30);if(h<12)return`${h}mo ago`;return`${Math.floor(g/365)}y ago`}function ht(t,r){switch(t){case"not-repo":return"This folder is not a git repository.";case"no-commit":return"This repository has no commits yet.";case"untracked":return"This file has never been committed, so it has no history.";case"too-large":return r??"This file is too large to blame.";case"empty":return"This file is empty.";default:return r??"git could not read this file."}}var St="fixed z-50 w-[min(340px,92vw)] rounded-xl border border-ink/20 bg-paper p-3 shadow-xl font-sans text-xs text-ink",vt="flex items-baseline justify-between gap-2",xt="truncate text-xs font-semibold text-ink",Tn="shrink-0 font-mono text-[10px] text-ink/40",Mn="mt-1 line-clamp-2 text-[11px] leading-snug text-ink/80",Nn="mt-2 border-t border-ink/10 pt-2",Rn="flex items-center gap-2 font-mono text-[10px] text-ink/40",kt="mt-1 text-[10px] leading-snug text-ink/50",Pn="mt-2 flex w-full items-center gap-1.5 text-left text-[10px] text-ink/50 hover:text-ink cursor-pointer",Ln="mt-1.5 space-y-1 border-t border-ink/10 pt-1.5",Te="flex items-center gap-1.5 font-mono text-[10px]";function q(t,r,l){let c=document.createElement(t);if(c.className=r,l!==void 0)c.textContent=l;return c}function Bn(t){return new Date(t*1000).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function Dn(t){let r=t.payload;if(t.status==="error")return{title:"Blame failed",body:t.message??"git could not read this file."};if(t.status==="unavailable")return{title:r?.reason==="untracked"?"Not tracked":"No history",body:ht(r?.reason??"error",t.message??void 0)};if(!r)return null;if(t.stale)return{title:"Not committed yet",body:"This line changed in the editor. Save the file to see its blame."};if(t.line>r.lines)return{title:"Not committed yet",body:`Line ${t.line} is past the end of the file at HEAD (${r.lines} lines).`};let l=r.runs.length>0?Ct(r,t.line):null;if(!l)return{title:"Not committed yet",body:`git has no attribution for line ${t.line}.`};if(Ee(l.sha))return{title:"Not committed yet",body:"This line differs from the last commit."};return null}function Ct(t,r){for(let l of t.runs)if(r>=l.from&&r<=l.to)return t.commits[l.sha]??null;return null}function On(t,r){t.replaceChildren(),t.className=St;let l=Dn(r);if(l){let y=q("div",vt);if(y.append(q("span",xt,l.title)),r.status==="error"&&r.message){let w=q("button","shrink-0 cursor-pointer text-[10px] text-ink/50 hover:text-ink","Try again");w.type="button",w.setAttribute("aria-label","Read the blame again"),y.append(w)}t.append(y,q("p",kt,l.body));return}let c=r.payload;if(!c){t.append(q("p",kt,"Reading blame…"));return}let p=Ct(c,r.line),g=q("div",vt);if(g.append(q("span",xt,p.author.trim()||"Unknown"),q("span",Tn,ge(p.time))),t.append(g),p.summary)t.append(q("p",Mn,p.summary));let h=q("div",`${Rn} ${Nn}`);if(h.append(q("code","truncate",p.sha.slice(0,7)),q("span","",Bn(p.time))),p.mail){let y=q("span","truncate",p.mail);y.title=p.mail,h.append(y)}t.append(h);let v=q("button",Pn);if(v.type="button",v.setAttribute("aria-expanded",r.historyOpen?"true":"false"),v.textContent=`${r.historyOpen?"▾":"▸"} Line history`,t.append(v),!r.historyOpen)return;let x=q("ol",Ln);if(r.historyLoading)x.append(q("li",`${Te} text-ink/40`,"Reading history…"));else if(!r.history||r.history.entries.length===0)x.append(q("li",`${Te} text-ink/40`,"No commits touched this line."));else{let y=r.history.entries;if(y.forEach((w,k)=>{let A=q("li",Te),E=k===y.length-1?"new":"edit";A.append(q("span","text-ink/40",k===0?"●":"○"),q("code","text-ink/60",w.sha.slice(0,7)),q("span","truncate text-ink/80",w.author.trim()||"Unknown"),q("span","ml-auto shrink-0 text-ink/40",ge(w.time)),q("span","shrink-0 rounded bg-ink/5 px-1 text-[8.5px] uppercase tracking-wider text-ink/45",E)),x.append(A)}),r.history.truncated)x.append(q("li",`${Te} text-ink/40`,"Older commits are not shown."))}t.append(x)}function Et(t,r,l){let c=q("div",St);c.setAttribute("role","dialog"),c.setAttribute("aria-label","Line blame"),c.addEventListener("mousedown",(w)=>w.stopPropagation());let p=null,g=!1,h=!1,v=()=>{let w=r.snapshot();return{line:t,status:w.status,payload:w.payload,message:w.message,stale:r.stale(),history:p,historyOpen:g,historyLoading:h}},x=()=>{On(c,v());let w=c.querySelector('[aria-label="Read the blame again"]');if(w)w.addEventListener("click",(k)=>{k.stopPropagation(),l()});c.querySelector("button[aria-expanded]")?.addEventListener("click",(k)=>{if(k.stopPropagation(),g=!g,x(),!g||p||h)return;h=!0,x(),r.history(t).then((A)=>{p=A,h=!1,x()})})};x();let y=r.subscribe(x);return{element:c,place(w){let k=c.ownerDocument.defaultView,A=k?.innerWidth??1024,E=k?.innerHeight??768,M=c.offsetWidth||340,H=c.offsetHeight||120,K=8,W=Math.max(8,Math.min(w.left,A-M-8)),z=w.bottom+6,L=w.top-H-6,_=z+H>E-8&&L>8?L:z;c.style.left=`${W}px`,c.style.top=`${Math.max(8,_)}px`},destroy(){y(),c.remove()}}}function Tt(t){return ye.define((r)=>{let l=null,c=0,p,g=()=>{clearTimeout(p),p=void 0,l?.destroy(),l=null,c=0},h=(E,M)=>{let H=E.getBoundingClientRect();if(H.width>0)return{left:H.left,top:H.top,bottom:H.bottom};let K=r.state.doc.line(Math.min(M,r.state.doc.lines)),W=null;try{W=r.coordsAtPos(K.from)}catch{W=null}if(W)return W;let z=r.scrollDOM.getBoundingClientRect();return{left:z.left,top:z.top+24,bottom:z.top+24}},v=(E,M)=>{if(c===E&&l)return;g(),c=E,l=Et(E,t,()=>{t.reload(),g()}),document.body.append(l.element),l.place(M)},x=(E)=>{let M=E.target,H=M?.closest?.(".cm-blame-label");if(H){let z=Number(H.dataset.blameLine);return Number.isInteger(z)&&z>0?{line:z,anchor:H}:null}let K=M?.closest?.(".cm-lineNumbers .cm-gutterElement");if(!K)return null;let W=Number((K.textContent??"").trim());return Number.isInteger(W)&&W>0?{line:W,anchor:K}:null},y=(E)=>{let M=x(E);if(!M)return;v(M.line,h(M.anchor,M.line))},w=(E)=>{let M=x(E);if(M){E.preventDefault(),v(M.line,h(M.anchor,M.line));return}if(l&&!l.element.contains(E.target))g()},k=(E)=>{if(E.key==="Escape"&&l)g(),E.stopPropagation()},A=(E)=>{if(!l)return;let M=E.relatedTarget;if(M&&(l.element.contains(M)||r.scrollDOM.contains(M)))return;p=setTimeout(g,200)};return r.scrollDOM.addEventListener("mouseover",y),r.scrollDOM.addEventListener("mouseleave",A),r.scrollDOM.addEventListener("mousedown",w),document.addEventListener("mousedown",w),document.addEventListener("keydown",k,!0),{update(E){if(E.docChanged&&l)g()},destroy(){g(),r.scrollDOM.removeEventListener("mouseover",y),r.scrollDOM.removeEventListener("mouseleave",A),r.scrollDOM.removeEventListener("mousedown",w),document.removeEventListener("mousedown",w),document.removeEventListener("keydown",k,!0)}}})}var Mt=40,Rt=re.define();function An(t){return Ne.define({create:()=>({payload:t.snapshot().payload,stale:!1}),update(r,l){let c=r;for(let p of l.effects){if(!p.is(Rt))continue;c=p.value.payload!==r.payload?{payload:p.value.payload,stale:!1}:{payload:r.payload,stale:r.stale}}if(l.docChanged&&!c.stale)c={payload:c.payload,stale:!0};return c}})}function In(t,r,l){let c=t.commits[r];if(!c||Ee(r))return null;let p=c.author.trim()||"Unknown";return l?p:`${p} · ${ge(c.time)}`}class Pt extends jt{constructor(t,r,l){super();this.line=t;this.text=r;this.title=l}eq(t){return t.line===this.line&&t.text===this.text&&t.title===this.title}toDOM(){let t=document.createElement("span");return t.className="cm-blame-label",t.dataset.blameLine=String(this.line),t.title=this.title,t.textContent=this.text,t}}function Nt(t,r,l){let{payload:c,stale:p}=t;if(!c?.available||p)return T.none;let g=Math.min(c.lines,r.state.doc.lines);if(g<1)return T.none;let h=r.state.doc.lineAt(Math.max(0,Math.min(r.viewport.from,r.state.doc.length))).number,v=r.state.doc.lineAt(Math.max(0,Math.min(r.viewport.to,r.state.doc.length))).number,x=Math.max(1,h-Mt),y=Math.min(g,v+Mt),w=[];for(let k of c.runs){let A=Math.max(k.from,x);if(A>k.to||A>y)continue;let E=In(c,k.sha,l);if(!E)continue;let M=c.commits[k.sha],H=r.state.doc.line(A);w.push({from:H.to,deco:T.widget({widget:new Pt(H.number,E,M.summary||M.sha),side:1})})}return T.set(w.map((k)=>k.deco.range(k.from)),!0)}function Fn(t,r){return ye.fromClass(class{constructor(l){this.view=l;this.decorations=Nt(l.state.field(t),l,r)}update(l){if(l.startState.field(t)===l.state.field(t)&&!l.docChanged&&!l.viewportChanged)return;this.decorations=Nt(l.state.field(t),l.view,r)}},{decorations:(l)=>l.decorations})}function zn(t){return ye.define((r)=>{let l=!0,c=()=>{if(!l)return;let g=t.snapshot();r.dispatch({effects:Rt.of({payload:g.payload,stale:!1})})},p=t.subscribe(c);return{destroy(){l=!1,p()}}})}function Lt({controller:t,inline:r=!0,compact:l=!1}){let c=An(t);return[c,zn(t),r?Fn(c,l):[],Tt(t)]}function Bt({activeFile:t,editor:r,find:l,surfaceRef:c,goToLineRequest:p,rootPath:g=null,repoPath:h=null,onRunCommand:v,wordWrap:x,zoomLevel:y,setZoomLevel:w,editorFontFamily:k,editorTheme:A,viewerKind:E,isPreview:M,reviewActive:H,onToggleReview:K,revealActive:W}){let z=E==="markdown",L=jc(),_=Hc(),O=cd(),G=gt({name:t.name,path:t.path,root:t.root??g??void 0,repo:t.repo??h??"."},{enabled:O.enabled,dirty:r.isDirty}),Z=u(()=>O.enabled?Lt({controller:G,inline:O.inline}):null,[O.enabled,O.inline,G]),[N,R]=n(null),P=u(()=>Ic(r.content),[r.content]),[Q,X]=n(!1);i(()=>{if(p>0)X(!0)},[p]);let[j,ne]=n(null),[me,ee]=n(null);mt(j,w);let te=Ys({tabKey:String(t.id),surface:z&&M?"rendered":"code",ready:r.loaded,element:z&&M?void 0:j}),ue=a((ie)=>{te.ref(ie),ee(ie)},[te.ref]);return Tc({path:t.path,scroller:me,preview:z&&M}),e("div",{className:"relative flex-1 min-h-0 flex flex-col",children:[l.open?e(Sc,{find:l}):null,Q?e(pt,{lineCount:r.content?r.content.split(`
2
2
  `).length:1,onGo:(ie)=>{X(!1);let le=dr(r.content,ie-1);c.current?.select(le,le,!0),c.current?.revealOffset(le)},onClose:()=>X(!1)}):null,z&&M?e(dt,{content:r.content,file:{name:t.name,path:t.path,root:t.root,repo:t.repo},zoomLevel:y,reviewActive:H,onExitReview:K,scrollRef:ue,onScroll:te.onScroll}):e(_c,{ref:c,value:r.content,onValueChange:r.onChange,language:r.language,wordWrap:x,documentKey:String(t.id),marks:l.open||W?l.matches:void 0,currentMark:l.currentIndex,onCommand:v,onScroller:ne,onCaret:R,scrollTestId:"editor-scroller",className:"flex-1 min-h-0 text-ink select-text",blame:Z,themeVars:A.vars,themes:A.themes,indentUnitText:Gc(L),typing:_,padding:16,placeholder:"This file is empty",style:{fontFamily:k,fontSize:`${y}px`,lineHeight:$s}}),!z||!M?e(ct,{caret:N,eol:r.eol,onSetEol:r.setEol,indentWidth:L.width,insertSpaces:L.insertSpaces,language:r.language,byteViewer:r.isBinaryViewer,viewerKind:E,lineCount:r.content?r.content.split(`
3
3
  `).length:0,conflicts:P}):null]})}function Dt({activeFile:t,editor:r,find:l,surfaceRef:c,pluginFileView:p,wordWrap:g,setWordWrap:h,viewerKind:v,isPreview:x,isReviewing:y,onToggleReview:w,isMaximized:k,setIsMaximized:A,zoomLevel:E,setZoomLevel:M,goToLineRequest:H,onSaveAs:K,rootPath:W=null,repoPath:z=null,runCommand:L,editorFontFamily:_,editorTheme:O,togglePreview:G,revealActive:Z,missing:N}){let R=v==="image"||v==="pdf"||v==="docx"||v==="spreadsheet",P=rs[v]===!0,Q=a(async(X)=>{let j=await Rc(t,X,{interactive:!0,baseMtimeMs:r.baseMtimeMs});if(j.status==="written")return{ok:!0};if(j.status==="conflict")return{ok:!1,error:"This file changed on disk since it was opened."};if(j.status==="needs-permission")return{ok:!1,error:"Click Save again to grant write access."};return{ok:!1,error:j.error}},[t,r.baseMtimeMs]);return e(d,{children:[e(lt,{path:t.path,saveStatus:r.saveStatus,wordWrap:g,hasPreview:P,isPreview:x,hasReview:v==="markdown"&&x,isReviewing:y,copied:r.copied,byteViewer:R,saveDisabled:Boolean(r.loadError)||r.handleMissing||r.deviceBacked,unsupported:Boolean(r.unsupported),handleMissing:r.handleMissing,readOnly:r.deviceBacked,isMaximized:k,findOpen:l.open,onToggleFind:()=>l.open?l.close():l.openFind(),onSave:r.saveNow,onTogglePreview:G,onToggleReview:w,onToggleWordWrap:()=>h(!g),onZoomIn:()=>M((X)=>Math.min(Us,X+1)),onZoomOut:()=>M((X)=>Math.max(zs,X-1)),onCopy:r.copy,onDownload:r.download,onReload:r.reloadFromDisk,onSaveAs:K,canReload:il(t)&&!r.loadError&&!r.unsupported,refreshing:r.isReading,reloadDiscardsEdits:r.isDirty,onToggleMaximize:()=>A(!k)}),N&&e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-error/30 bg-error/10 text-error",children:[e(D,{size:14,className:"shrink-0 mt-0.5"}),e("div",{className:"min-w-0",children:[e("div",{className:"text-[11.5px] font-sans",children:"This file was deleted from disk."}),e("div",{className:"text-[11px] font-sans text-error/80",children:"The buffer is still here. Saving recreates the file — autosave is off until then."})]})]}),r.conflict&&e(Ce,{diskMtimeMs:r.conflict.diskMtimeMs,fileName:t.name,onReload:r.resolveConflictByReload,onKeepMine:r.resolveConflictByKeepingMine}),r.handleMissing&&e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-warning/30 bg-warning/10 text-warning",children:[e(D,{size:14,className:"shrink-0 mt-0.5"}),e("div",{className:"min-w-0",children:[e("div",{className:"text-[11.5px] font-sans",children:"This file was opened by the system, not from a workspace."}),e("div",{className:"text-[11px] font-sans text-warning/80",children:"Its write permission ended with the last page load. Reopen the file from the OS to edit it again."})]})]}),r.deviceBacked&&e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-ink/20 bg-ink/5 text-ink/70",children:[e(D,{size:14,className:"shrink-0 mt-0.5"}),e("div",{className:"min-w-0",children:[e("div",{className:"text-[11.5px] font-sans",children:r.deviceMissing?"The bytes for this file did not survive the reload.":"Opened from this device, so it is read-only here."}),e("div",{className:"text-[11px] font-sans text-ink/50",children:r.deviceMissing?"A phone's file lives only on the phone, so it cannot be re-read. Open it again from the app that shared it.":"The console cannot reach a file on your phone. Copy it into a workspace to edit it."})]})]}),r.isImage&&r.imageUrl?e(Fi,{src:r.imageUrl,name:t.name,className:"flex-1 min-h-0"}):r.isImage?e(al,{kind:"image",path:t.path,name:t.name,source:r.byteSource,content:r.content,revision:r.revision}):r.isLoading?e("div",{className:"flex-1 flex items-center justify-center gap-2 text-ink/40 text-xs font-mono",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Loading file content…"})]}):r.unsupported?e("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 px-6 text-center",children:[e(Cc,{size:20,className:"text-ink/40"}),e("span",{className:"text-xs text-ink/70 font-sans",children:[t.name," cannot be opened here"]}),e("span",{className:"text-[11px] text-ink/50 font-sans max-w-[42ch]",children:r.unsupported})]}):r.loadError?e("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 px-6 text-center",children:[e(D,{size:20,className:"text-error"}),e("span",{className:"text-xs text-error font-sans",children:["Could not read ",t.name]}),e("span",{className:"text-[11px] text-ink/50 font-mono break-all",children:r.loadError})]}):p&&!r.isImage?e(tA,{view:p}):Qc(v)&&(R||x)?e(al,{kind:v,path:t.path,name:t.name,source:r.byteSource,content:r.content,revision:r.revision,onContentChange:r.onChange,onSaveBytes:r.deviceBacked?void 0:Q,onDirtyChange:r.setBinaryDirty}):e(Bt,{activeFile:t,editor:r,find:l,surfaceRef:c,goToLineRequest:H,rootPath:W,repoPath:z,onRunCommand:L,wordWrap:g,zoomLevel:E,setZoomLevel:M,editorFontFamily:_,editorTheme:O,isPreview:x,reviewActive:y,onToggleReview:w,viewerKind:v,revealActive:Z})]})}function Ot({activeFile:t,editor:r,find:l,surfaceRef:c,pluginFileView:p,wordWrap:g,setWordWrap:h,viewerKind:v,isPreview:x,isReviewing:y,onToggleReview:w,isMaximized:k,setIsMaximized:A,zoomLevel:E,setZoomLevel:M,goToLineRequest:H,onSaveAs:K,rootPath:W=null,repoPath:z=null,runCommand:L,editorFontFamily:_,editorTheme:O,togglePreview:G,revealActive:Z,missing:N,onConvertDiffToEditor:R,onFileSaved:P}){if(!t)return e("div",{className:"flex-1 flex items-center justify-center text-ink/40",children:e("p",{className:"font-mono text-sm",children:"Select a tab to view content"})});if(t.isDiff)return e(Ec,{filePath:t.path,status:t.diffStatus||"M",isStaged:Boolean(t.diffStaged),root:t.root,repo:t.repo||".",journalDiff:t.journalDiff,readOnly:t.diffSource==="journal",onOpenInEditor:()=>R(t.id),onFileSaved:P,className:"flex-1",tabKey:String(t.id)});return e(Dt,{activeFile:t,editor:r,find:l,surfaceRef:c,pluginFileView:p,wordWrap:g,setWordWrap:h,viewerKind:v,isPreview:x,isReviewing:y,onToggleReview:w,isMaximized:k,setIsMaximized:A,zoomLevel:E,setZoomLevel:M,goToLineRequest:H,onSaveAs:K,rootPath:W,repoPath:z,runCommand:L,editorFontFamily:_,editorTheme:O,togglePreview:G,revealActive:Z,missing:N})}function At({pluginId:t,Component:r,sessionId:l,className:c=""}){return e("div",{className:`flex flex-col h-full bg-canvas ${c}`,children:e(Ke,{pluginId:t,children:e(r,{sessionId:l,workspacePath:null})})})}function It({className:t=""}){return e("div",{className:`flex flex-col h-full bg-canvas items-center justify-center text-muted ${t}`,children:[e(at,{name:"placeholder.txt",size:48,className:"mb-4 opacity-20"}),e("p",{className:"font-mono text-sm",children:"Select a file to open"})]})}function Ft({searchReveal:t,revealMatch:r}){let l=o(r);l.current=r;let c=o(null);i(()=>{if(!t||c.current===t.request)return;c.current=t.request,l.current({query:t.request.query,options:t.request.options,line:t.request.line})},[t])}function zt({openedFiles:t,dirtyKeys:r,activeFile:l,previewReady:c,setPreviewMode:p,sessionId:g}){i(()=>{let h=new Set(t.filter((v)=>!v.isDiff&&v.content===void 0).map((v)=>v.id));Ve([...r].filter((v)=>h.has(v)))},[r,t]),i(()=>{if(!c)return;let h=l?.id;if(!l||h===void 0||h===null)return;if(!rs[as(l.name)])return;let v=ze(g,"editor.previewMode");if(v&&v[h]!==void 0)return;p((x)=>x[h]===void 0?{...x,[h]:!0}:x)},[c,l])}function Ht({activeFile:t,externalChange:r,conflict:l,onReload:c,onKeepMine:p}){if(!t)return null;if(l)return e(Ce,{diskMtimeMs:l.diskMtimeMs,fileName:t.name,onReload:c,onKeepMine:p});if(r)return e(Oc,{fileName:t.name,onReload:c,onKeepMine:p});return null}async function $t(t){let r=t.name.trim();if(!r)return{status:"failed",reason:"Enter a file name."};let l=new FormData;if(l.append("actionType","saveAs"),l.append("path",t.parent),l.append("name",r),l.append("content",t.content),l.append("eol",t.eol),t.root)l.append("root",t.root);if(t.repo&&t.repo!==".")l.append("repo",t.repo);try{let c=await fetch("/api/fs/action",{method:"POST",body:l}),p=await c.json().catch(()=>null),g=typeof p?.error==="string"?p.error:null;if(c.status===409)return{status:"exists",reason:g??`${r} already exists.`};if(c.ok&&p?.success&&typeof p.path==="string")return{status:"written",path:p.path};return{status:"failed",reason:g??"The file could not be written."}}catch{return{status:"failed",reason:"The file could not be written."}}}function Vt(t){let r=t.lastIndexOf(".");if(r<=0)return`${t} copy`;return`${t.slice(0,r)} copy${t.slice(r)}`}function Wt(t){let r=t.trim();if(!r)return!1;if(r==="."||r==="..")return!1;return!r.includes("/")&&!r.includes("\\")}function Hn(t){let r=t.lastIndexOf("/");return r===-1?"":t.slice(0,r)}function Ut({fileName:t,filePath:r,content:l,eol:c,root:p,repo:g,onSaved:h,onClose:v}){let[x,y]=n(()=>Hn(r)),[w,k]=n(()=>Vt(t)),[A,E]=n(!1),[M,H]=n(null),K=o(null);i(()=>{K.current?.focus(),K.current?.select()},[]);let W=Wt(w),z=async()=>{if(!W||A)return;E(!0),H(null);let _=await $t({parent:x,name:w,content:l,eol:c,root:p,repo:g});if(E(!1),_.status==="written"){h({path:_.path});return}H(_.reason)},L=(_)=>{if(_.key==="Enter"){_.preventDefault(),z();return}if(_.key==="Escape")_.preventDefault(),v()};return e(J,{onClose:v,maxWidthClass:"max-w-md",header:e("span",{className:"text-sm font-semibold text-ink",children:"Save as"}),footer:e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:v,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer",children:"Cancel"}),e("button",{type:"button",onClick:()=>void z(),disabled:!W||A,className:"flex items-center gap-1.5 px-3 py-1.5 rounded bg-ink text-paper disabled:opacity-40 disabled:cursor-default cursor-pointer",children:[A?e(m,{size:12,className:"animate-spin"}):e(tt,{size:12}),"Save"]})]}),children:e("div",{className:"px-4 py-3 space-y-2 text-xs",children:[e("label",{className:"block",children:[e("span",{className:"block text-[10px] uppercase tracking-wide text-ink/50 mb-1",children:"Folder"}),e("input",{value:x,onInput:(_)=>y(_.target.value),onKeyDown:L,placeholder:"(workspace root)","aria-label":"Destination folder",className:"w-full bg-paper border border-ink/20 rounded px-2 py-1 font-mono text-ink outline-none focus:border-ink/40"})]}),e("label",{className:"block",children:[e("span",{className:"block text-[10px] uppercase tracking-wide text-ink/50 mb-1",children:"Name"}),e("input",{ref:K,value:w,onInput:(_)=>k(_.target.value),onKeyDown:L,"aria-label":"File name","aria-invalid":!W,className:`w-full bg-paper border rounded px-2 py-1 font-mono text-ink outline-none ${W?"border-ink/20 focus:border-ink/40":"border-error text-error"}`})]}),!W?e("div",{className:"text-[10px] text-error font-mono",children:"Enter a file name without a path separator"}):null,M?e("div",{className:"text-[10px] text-error font-mono",children:M}):null,e("div",{className:"text-[10px] text-ink/40",children:"The original file stays where it is, and its tab stays open."})]})})}function _t(){i(()=>{let t=(r)=>{if(!_e())return;r.preventDefault(),r.returnValue=""};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[])}function Gt({fileName:t,onAnswer:r}){return e(J,{onClose:()=>r("cancel"),header:e("div",{className:"flex items-center gap-2",children:[e(D,{size:15,className:"text-warning"}),e("span",{className:"text-sm font-semibold text-ink",children:"Unsaved changes"})]}),footer:e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:()=>r("cancel"),className:"px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer",children:"Cancel"}),e("button",{type:"button",onClick:()=>r("discard"),className:"px-3 py-1.5 rounded border border-error/40 text-error hover:bg-error/10 transition-colors cursor-pointer",children:"Discard"}),e("button",{type:"button",onClick:()=>r("save"),className:"px-3 py-1.5 rounded bg-ink text-paper hover:bg-ink/90 transition-colors cursor-pointer",children:"Save & close"})]}),children:e("div",{className:"px-4 py-3 text-xs text-ink/80",children:[e("span",{className:"font-mono text-ink",children:t})," has changes that are not on disk.",e("div",{className:"mt-1 text-ink/50",children:"Discarding them cannot be undone."})]})})}function qt({closeGuard:t,activeFile:r,saveMissingConfirm:l,onCancelSaveMissing:c,onConfirmSaveMissing:p}){if(t.pending)return e(Gt,{fileName:t.pending.name,onAnswer:t.answer});if(l&&r)return e($c,{fileName:r.name,filePath:r.path,onClose:c,onConfirm:p});return null}function Zt({className:t="",isMaximized:r,onKeyDownCapture:l,onFocusCapture:c,asSplitPane:p,tabs:g,activeFile:h,editor:v,externalChange:x,conflict:y,onReload:w,onKeepMine:k,body:A,saveAsOpen:E,onSaveAsClose:M,onSavedAs:H,closeGuard:K}){let W=r?"fixed inset-0 z-50 flex flex-col bg-canvas":`flex flex-col h-full bg-canvas ${t}`;return e("div",{className:W,onKeyDownCapture:l,onFocusCapture:c,children:[p?null:g,e(Ht,{activeFile:h,externalChange:x,conflict:y,onReload:w,onKeepMine:k}),A,E&&h?e(Ut,{fileName:h.name,filePath:h.path,content:v.content,eol:v.eol,root:h.root,repo:h.repo,onSaved:({path:z})=>H(z),onClose:M}):null,e(qt,{closeGuard:K,activeFile:h,saveMissingConfirm:v.saveMissingConfirm,onCancelSaveMissing:v.cancelSaveMissing,onConfirmSaveMissing:v.confirmSaveMissing})]})}function Xt({fileName:t,onClose:r,children:l}){return e("div",{className:"flex flex-col h-full min-w-0","data-split-pane":"",children:[e("div",{className:"flex items-center justify-between gap-2 px-3 py-1 border-b border-ink/10 bg-canvas flex-shrink-0",children:[e("span",{className:"text-[11px] font-mono text-ink/60 truncate",title:t,children:t}),e("button",{type:"button",onClick:r,className:"p-0.5 rounded hover:bg-ink/10 text-ink/50 hover:text-ink transition-colors cursor-pointer flex-shrink-0",title:"Close this pane (the tab stays open)","aria-label":"Close split pane",children:e(b,{size:12})})]}),e("div",{className:"flex-1 min-h-0",children:l})]})}function Yt({fraction:t,onFraction:r,rightPaneName:l,onClosePane:c,rightPane:p,children:g}){let h=o(null),v=(x)=>{let y=x.currentTarget,w=h.current;if(!y||!w)return;y.setPointerCapture(x.pointerId);let k=(E)=>{let M=w.getBoundingClientRect();if(M.width===0)return;r(pe((E.clientX-M.left)/M.width))},A=()=>{y.releasePointerCapture(x.pointerId),y.removeEventListener("pointermove",k),y.removeEventListener("pointerup",A)};y.addEventListener("pointermove",k),y.addEventListener("pointerup",A)};return e("div",{ref:h,className:"flex w-full h-full","data-split-column":"",children:[e("div",{className:"flex flex-col min-w-0 h-full",style:{width:`${Math.round(pe(t)*100)}%`},children:g}),e("div",{className:"w-[3px] flex-shrink-0 cursor-col-resize bg-ink/10 hover:bg-ink/40 transition-colors",role:"separator","aria-orientation":"vertical","aria-label":"Resize split panes",onPointerDown:v}),e("div",{className:"flex-1 min-w-0 h-full",children:e(Xt,{fileName:l,onClose:c,children:p})})]})}function Jt({openedFiles:t,activeFileId:r,enabled:l}){let[c,p]=S("editor.split",be),g=t.map((k)=>k.id),h=je(Je(c,g),r),v=l&&h.rightFileId!==null?t.find((k)=>k.id===h.rightFileId)??null:null,x=a((k)=>{if(k!==null&&!Se(k,r,g))return;p({...h,rightFileId:k})},[h,p,r,g]),y=a(()=>p({...h,rightFileId:null}),[h,p]),w=a((k)=>p({...h,fraction:pe(k)}),[h,p]);return{rightFile:v,fraction:h.fraction,splitTo:x,close:y,setFraction:w}}function Qt({find:t,runCommand:r,reopenClosed:l}){let c=o(t);c.current=t;let p=o(r);p.current=r;let g=o(l);return g.current=l,{onKeyDownCapture:a((v)=>{let x=c.current;if(v.key==="Escape"){if(!x.open)return;v.preventDefault(),v.stopPropagation(),x.close();return}if((v.metaKey||v.ctrlKey)&&v.shiftKey&&v.code==="KeyT"){if(g.current?.())v.preventDefault(),v.stopPropagation();return}let y=Eg(lo,v);if(!y||!Um(y))return;v.preventDefault(),v.stopPropagation(),p.current(y)},[])}}function tn(t){let r=o(t);r.current=t;let l=o(null);if(!l.current)l.current={saveNow:()=>r.current.saveNow(),runCommand:(p)=>r.current.runCommand(p)};return i(()=>{let p=l.current;if(!p)return;return Vf(p)},[]),{onFocusCapture:a(()=>{if(l.current)Vf(l.current)},[])}}function nn({openedFiles:t,activeFileId:r,onSelectFile:l,onCloseFile:c,saveNow:p}){let[g,h]=n(null);_t();let v=a((y)=>{let w=t.find((k)=>k.id===y);if(w&&Ue(y)){h(w);return}c(y)},[t,c]),x=a((y)=>{let w=g;if(!w)return;if(y==="cancel"){h(null);return}if(y==="save"){if(w.id!==r)l(w.id);p()}h(null),c(w.id)},[g,r,l,p,c]);return{requestClose:v,pending:g,answer:x}}function on(){let[t,r]=n(0),[l,c]=n(!1),p=a(()=>r((g)=>g+1),[]);return{goToLineRequest:t,openGoToLine:p,saveAsOpen:l,setSaveAsOpen:c}}function $n({className:t="",openedFiles:r,activeFileId:l,onSelectFile:c,onCloseFile:p,onConvertDiffToEditor:g,refreshKey:h=0,onFileSaved:v,onOpenPath:x,onReopenClosed:y,reopenableCount:w,onCopyPath:k,onRevealInFiles:A,rootPath:E=null,repoPath:M=null,activeEditorPanelKey:H=null,forcedActiveFileId:K=null,asSplitPane:W=!1}){let z=W?K:l,L=r.find((U)=>U.id===z),[_,O,G]=S("editor.previewMode",{}),Z=zc(String(z??"")),[N,R]=S("editor.zoomLevel",xi),[P,Q]=n(!1),[X,j]=S("editor.wordWrap",!0),ne=on(),{sessionId:me}=Ze(),ee=Jt({openedFiles:r,activeFileId:z,enabled:!W}),te=o(null),ue=Ci(),ie=uo(),le=Nc(r,h),fe=Boolean(L&&le.has(L.id)),Y=Fc(L??null,{reportSaveError:!0,onFileSaved:v,missing:fe}),rn=eA({path:L?.path??"",content:Y.content,language:Y.language}),an=Y.diskChange,De=nn({openedFiles:r,activeFileId:z,onSelectFile:c,onCloseFile:p,saveNow:Y.saveNow}),ve=Lc({text:Y.content,documentKey:`${L?.id??""}\x00${Y.language}`,readSelection:()=>te.current?.getSelection()??null,select:(U,de,Pe=!0)=>te.current?.select(U,de,Pe),reveal:(U)=>te.current?.revealOffset(U),applyDocument:(U,de,Pe)=>te.current?.applyDocument(U,de,Pe),toggleWordWrap:()=>j((U)=>!U)}),Oe=Mc(L?.path??null,Y.content,Y.loaded&&!Y.loadError);Ft({searchReveal:Oe,revealMatch:ve.revealMatch}),Pc({file:L,editor:Y,surfaceRef:te,isPreview:L?_[L.id]===!0:!1,exitPreview:()=>{let U=L?.id;if(U===void 0||U===null)return;O((de)=>({...de,[U]:!1}))}}),i(()=>{if(h>0)Y.reset()},[h]),i(()=>{Y.retain(r.map((U)=>U.id)),We(r.map((U)=>U.id))},[r]),zt({openedFiles:r,dirtyKeys:Y.dirtyKeys,activeFile:L,previewReady:G,setPreviewMode:O,sessionId:me});let sn=()=>{if(!L)return;O((U)=>({...U,[L.id]:!U[L.id]}))},Me=(U)=>{if(Um(U)){ve.runCommand(U);return}if(U==="toggleWordWrap"){j((de)=>!de);return}if(U==="goToLine"){ne.openGoToLine();return}te.current?.runCommand(U)},ln=Qt({find:ve,runCommand:Me,reopenClosed:y}),dn=tn({saveNow:Y.saveNow,runCommand:Me}),Re=Pg(H);if(Re)return e(At,{pluginId:Re.pluginId,Component:Re.Component,sessionId:me,className:t});if(r.length===0)return e(It,{className:t});let cn=Y.viewerKind,Ae=L?_[L.id]:!1,mn={activeFile:L,editor:Y,find:ve,surfaceRef:te,pluginFileView:rn,wordWrap:X,setWordWrap:j,viewerKind:cn,isPreview:Boolean(Ae),isReviewing:Boolean(Ae)&&Z.active,onToggleReview:Z.toggle,isMaximized:P,setIsMaximized:Q,zoomLevel:N,setZoomLevel:R,goToLineRequest:ne.goToLineRequest,onSaveAs:()=>ne.setSaveAsOpen(!0),onOpenPath:x,rootPath:E,repoPath:M,runCommand:Me,editorFontFamily:ue,editorTheme:ie,togglePreview:sn,revealActive:Boolean(Oe),missing:fe,onConvertDiffToEditor:g,onFileSaved:v},un=(U)=>({openedFiles:r,activeFileId:l,onSelectFile:c,onCloseFile:p,onConvertDiffToEditor:g,refreshKey:h,onFileSaved:v,onOpenPath:x,rootPath:E,repoPath:M,forcedActiveFileId:U,asSplitPane:!0}),pn=e(nt,{openedFiles:r,activeFileId:l,onSelectFile:c,onCloseFile:De.requestClose,missingIds:le,onCopyPath:k,onRevealInFiles:A,onReopenClosed:y,reopenableCount:w,onSplitTo:ee.splitTo,onUnsplit:ee.close,splitRightFileId:ee.rightFile?.id??null}),Ie=e(Zt,{className:t,isMaximized:P,onKeyDownCapture:ln.onKeyDownCapture,onFocusCapture:dn.onFocusCapture,asSplitPane:W,tabs:pn,activeFile:L,editor:Y,externalChange:an,conflict:Y.conflict,onReload:Y.resolveConflictByReload,onKeepMine:Y.keepMineAgainstDisk,body:e(Ot,{...mn}),saveAsOpen:ne.saveAsOpen,onSaveAsClose:()=>ne.setSaveAsOpen(!1),onSavedAs:(U)=>{ne.setSaveAsOpen(!1),x?.(U)},closeGuard:De});if(!ee.rightFile)return Ie;return e(Yt,{fraction:ee.fraction,onFraction:ee.setFraction,rightPaneName:ee.rightFile.name,onClosePane:ee.close,rightPane:e($n,{...un(ee.rightFile.id)}),children:Ie})}export{$n as Editor};
@@ -1 +1 @@
1
- import{d,u,le,e,IA,we,I,B,ie,vr,C,Fs,Fu,Lp,lg,Mp,Pp}from"./index-3wpsr2bc.js";function k({phase:t,index:o,collapsed:a,currentKey:i,onToggle:x}){let m=Mp(t),r=t.tasks.length>0&&m===t.tasks.length;return e("div",{className:"overflow-hidden rounded-lg border border-ink/10 bg-paper",children:[e("button",{type:"button",onClick:x,"aria-expanded":!a,className:"flex w-full items-center gap-1.5 border-b border-ink/8 bg-canvas/40 px-2.5 py-1.5 text-left hover:bg-ink/5",children:[a?e(ie,{size:12,className:"shrink-0 text-ink/40"}):e(B,{size:12,className:"shrink-0 text-ink/40"}),e("span",{className:`min-w-0 flex-1 truncate text-[10px] font-semibold uppercase tracking-wider ${r?"text-ink/35":"text-ink/60"}`,title:t.name,children:[o+1,". ",t.name]}),e("span",{className:"shrink-0 font-mono text-[10px] text-ink/40",children:[m,"/",t.tasks.length]})]}),!a&&e("div",{className:"divide-y divide-ink/[0.05] p-0.5",children:t.tasks.length===0?e("div",{className:"px-2.5 py-1.5 text-[11px] text-ink/40",children:"No tasks in this phase"}):t.tasks.map((l,f)=>e(Pp,{task:l,current:i===`${o}:${f}`},`${f}-${l.content}`))})]})}function j({className:t="",active:o=!0}){let[a]=le(),i=a.get("sessionId"),[x,m]=Fs("todo.collapsedPhases",{}),{data:r,isLoading:l,refreshing:f,stale:g,refresh:b}=we(i?IA(i):null,{enabled:o}),s=r?.snapshot??null,p=r?.progress??null,v=u(()=>{let n=lg(s?.phases??[]);return n?`${n.phase}:${n.task}`:null},[s]);if(!i)return e("div",{className:`flex h-full flex-col items-center justify-center bg-paper text-ink/40 ${t}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e("div",{className:`flex h-full w-full min-w-0 flex-col overflow-hidden bg-paper text-ink ${t}`,children:[e("div",{className:"flex flex-shrink-0 items-center justify-between gap-3 border-b border-ink/10 px-3.5 py-2.5",children:[e("div",{className:"flex min-w-0 items-center gap-2",children:[e("h2",{className:"text-xs font-semibold uppercase tracking-wider text-ink",children:"Todos"}),s&&e("span",{className:"truncate font-mono text-[10.5px] text-ink/50",title:Fu(p),children:Fu(p)}),r?.isMock&&e("span",{className:"flex-shrink-0 rounded border border-ink/15 bg-ink/5 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-ink/60",children:"Mock"})]}),e("button",{type:"button",onClick:b,disabled:l,title:"Refresh todos","aria-label":"Refresh todos",className:"flex-shrink-0 rounded-md border border-ink/15 bg-paper p-1.5 text-ink/80 transition-colors hover:bg-ink/5 disabled:opacity-50",children:e(C,{size:12,className:l||f?"animate-spin text-ink":""})})]}),p&&p.total>0&&e("div",{className:"flex-shrink-0 border-b border-ink/10 px-3.5 py-2.5",children:e("div",{className:"h-1.5 overflow-hidden rounded-full bg-ink/8",children:e("div",{className:"h-full rounded-full bg-success transition-all duration-300",style:{width:`${Lp(p)}%`}})})}),e("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto scrollbar-overlay-container p-3.5",children:[g&&e("div",{className:"flex items-start gap-2 rounded-lg border border-ink/15 bg-ink/5 px-3 py-2 text-[11px] text-ink/60",children:[e(I,{size:13,className:"mt-[1px] shrink-0"}),e("span",{className:"min-w-0 break-words",children:"Reconnecting: this list may be out of date."})]}),!s?e("div",{className:"flex flex-col items-center justify-center gap-2 py-12 text-center text-ink/40",children:[e(vr,{size:20}),e("p",{className:"max-w-[240px] text-[11.5px] leading-relaxed",children:["No todo list in this session. The agent writes one with the ",e("span",{className:"font-mono",children:"todo"})," tool when a task is worth planning."]})]}):e(d,{children:[s.phases.map((n,c)=>e(k,{phase:n,index:c,collapsed:Boolean(x[String(c)]),currentKey:v,onToggle:()=>m((h)=>({...h,[String(c)]:!h[String(c)]}))},`${c}-${n.name}`)),e("p",{className:"pt-1 text-[10.5px] leading-relaxed text-ink/35",children:["Read from this session's transcript",s.updatedAt?` · updated ${N(s.updatedAt)}`:"",s.source==="custom"?" · edited by hand":"","."]})]})]})]})}function N(t){let o=new Date(t);if(Number.isNaN(o.getTime()))return t;return o.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}export{j as TodoPanel};
1
+ import{d,u,le,e,IA,we,I,B,ie,vr,C,Fs,Fu,Lp,lg,Mp,Pp}from"./index-d8kjsgpt.js";function k({phase:t,index:o,collapsed:a,currentKey:i,onToggle:x}){let m=Mp(t),r=t.tasks.length>0&&m===t.tasks.length;return e("div",{className:"overflow-hidden rounded-lg border border-ink/10 bg-paper",children:[e("button",{type:"button",onClick:x,"aria-expanded":!a,className:"flex w-full items-center gap-1.5 border-b border-ink/8 bg-canvas/40 px-2.5 py-1.5 text-left hover:bg-ink/5",children:[a?e(ie,{size:12,className:"shrink-0 text-ink/40"}):e(B,{size:12,className:"shrink-0 text-ink/40"}),e("span",{className:`min-w-0 flex-1 truncate text-[10px] font-semibold uppercase tracking-wider ${r?"text-ink/35":"text-ink/60"}`,title:t.name,children:[o+1,". ",t.name]}),e("span",{className:"shrink-0 font-mono text-[10px] text-ink/40",children:[m,"/",t.tasks.length]})]}),!a&&e("div",{className:"divide-y divide-ink/[0.05] p-0.5",children:t.tasks.length===0?e("div",{className:"px-2.5 py-1.5 text-[11px] text-ink/40",children:"No tasks in this phase"}):t.tasks.map((l,f)=>e(Pp,{task:l,current:i===`${o}:${f}`},`${f}-${l.content}`))})]})}function j({className:t="",active:o=!0}){let[a]=le(),i=a.get("sessionId"),[x,m]=Fs("todo.collapsedPhases",{}),{data:r,isLoading:l,refreshing:f,stale:g,refresh:b}=we(i?IA(i):null,{enabled:o}),s=r?.snapshot??null,p=r?.progress??null,v=u(()=>{let n=lg(s?.phases??[]);return n?`${n.phase}:${n.task}`:null},[s]);if(!i)return e("div",{className:`flex h-full flex-col items-center justify-center bg-paper text-ink/40 ${t}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e("div",{className:`flex h-full w-full min-w-0 flex-col overflow-hidden bg-paper text-ink ${t}`,children:[e("div",{className:"flex flex-shrink-0 items-center justify-between gap-3 border-b border-ink/10 px-3.5 py-2.5",children:[e("div",{className:"flex min-w-0 items-center gap-2",children:[e("h2",{className:"text-xs font-semibold uppercase tracking-wider text-ink",children:"Todos"}),s&&e("span",{className:"truncate font-mono text-[10.5px] text-ink/50",title:Fu(p),children:Fu(p)}),r?.isMock&&e("span",{className:"flex-shrink-0 rounded border border-ink/15 bg-ink/5 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-ink/60",children:"Mock"})]}),e("button",{type:"button",onClick:b,disabled:l,title:"Refresh todos","aria-label":"Refresh todos",className:"flex-shrink-0 rounded-md border border-ink/15 bg-paper p-1.5 text-ink/80 transition-colors hover:bg-ink/5 disabled:opacity-50",children:e(C,{size:12,className:l||f?"animate-spin text-ink":""})})]}),p&&p.total>0&&e("div",{className:"flex-shrink-0 border-b border-ink/10 px-3.5 py-2.5",children:e("div",{className:"h-1.5 overflow-hidden rounded-full bg-ink/8",children:e("div",{className:"h-full rounded-full bg-success transition-all duration-300",style:{width:`${Lp(p)}%`}})})}),e("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto scrollbar-overlay-container p-3.5",children:[g&&e("div",{className:"flex items-start gap-2 rounded-lg border border-ink/15 bg-ink/5 px-3 py-2 text-[11px] text-ink/60",children:[e(I,{size:13,className:"mt-[1px] shrink-0"}),e("span",{className:"min-w-0 break-words",children:"Reconnecting: this list may be out of date."})]}),!s?e("div",{className:"flex flex-col items-center justify-center gap-2 py-12 text-center text-ink/40",children:[e(vr,{size:20}),e("p",{className:"max-w-[240px] text-[11.5px] leading-relaxed",children:["No todo list in this session. The agent writes one with the ",e("span",{className:"font-mono",children:"todo"})," tool when a task is worth planning."]})]}):e(d,{children:[s.phases.map((n,c)=>e(k,{phase:n,index:c,collapsed:Boolean(x[String(c)]),currentKey:v,onToggle:()=>m((h)=>({...h,[String(c)]:!h[String(c)]}))},`${c}-${n.name}`)),e("p",{className:"pt-1 text-[10.5px] leading-relaxed text-ink/35",children:["Read from this session's transcript",s.updatedAt?` · updated ${N(s.updatedAt)}`:"",s.source==="custom"?" · edited by hand":"","."]})]})]})]})}function N(t){let o=new Date(t);if(Number.isNaN(o.getTime()))return t;return o.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}export{j as TodoPanel};
@@ -1,2 +1,2 @@
1
- import{t}from"./index-zj45wj1x.js";var Ao=class{constructor(i){this.init=i,this.records=this.init()}static{t(this,"ImperativeState")}reset(){this.records=this.init()}};
1
+ import{t}from"./index-5v9v41ap.js";var Ao=class{constructor(i){this.init=i,this.records=this.init()}static{t(this,"ImperativeState")}reset(){this.records=this.init()}};
2
2
  export{Ao};
@@ -1,4 +1,4 @@
1
- import{d,n,i,V,o,u,a,Ar,e,gr,ui,Gn,gp,we,S,bp,Rf,ir,or,s,Pa,Be,Oa,m,In,M,D,Xe,f,B,ie,et,ae,he,fe,Tn,Jt,Dn,Y,C,ut,va,F,gi,tn,b,ce,Tu,ro,J,at,it,pt,Ve,ge}from"./index-3wpsr2bc.js";import{pp,fr}from"./index-4qt2e84b.js";var Tt={name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]},_e=s(Tt);var At={name:"list",size:24,node:[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]},je=s(At);function Ue({message:t,hasStagedChanges:c,isBusy:l=!1,amend:r=!1,seeded:p=!1,onToggleAmend:h,onChangeMessage:g,onCommit:v}){let y=t.trim().length>0&&!l&&(r||c),L=r?"Rewrite the previous commit with this message":c?"Commit staged changes":"Stage changes first";return e("div",{className:"border-t border-ink/10 bg-canvas/50 p-3 flex flex-col gap-2",children:[e("textarea",{value:t,onChange:(N)=>g(N.currentTarget.value),onKeyDown:(N)=>{if(N.key==="Enter"&&(N.metaKey||N.ctrlKey)&&y)N.preventDefault(),v()},placeholder:r?"New message for the previous commit (⌘/Ctrl+Enter to commit)":"Commit message (⌘/Ctrl+Enter to commit)",rows:5,className:"w-full resize-y min-h-[100px] max-h-[200px] bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),e("div",{className:"flex items-center gap-2",children:[e("label",{className:"flex items-center gap-1.5 text-[11px] text-ink/70 cursor-pointer select-none",children:[e("input",{type:"checkbox",checked:r,onChange:(N)=>h?.(N.currentTarget.checked),className:`${ge} accent-ink cursor-pointer`}),"Amend"]}),r&&p&&e("span",{className:"text-[10px] text-ink/40",title:"The previous commit's message, loaded as an editable starting point",children:"previous message loaded"}),e("button",{type:"button",onClick:v,disabled:!y,title:L,className:"ml-auto flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(f,{size:12}),r?"Amend commit":"Commit"]})]})]})}function We({operation:t,conflicts:c,isBusy:l,onAbort:r,onContinue:p}){let h=ui[t],g=c.length,v=g===0,y=t!=="stash-pop";return e("div",{className:"border-t border-warning/30 bg-warning/5 p-3 flex flex-col gap-2",children:[e("div",{className:"flex items-center gap-2 text-xs text-ink",children:[e(D,{size:13,className:"text-warning flex-shrink-0"}),e("span",{className:"font-medium",children:[h.charAt(0).toUpperCase()+h.slice(1)," in progress"]}),e("span",{className:`font-mono tabular-nums text-[10px] ${v?"text-success":"text-warning"}`,children:v?"all conflicts resolved":`${g} conflict${g===1?"":"s"} left`})]}),!v&&e("div",{className:"max-h-20 overflow-y-auto scrollbar-overlay-container font-mono text-[10px] text-warning/90 space-y-0.5",children:c.map((L)=>e("div",{className:"truncate",title:L,children:L},L))}),e("div",{className:"flex items-stretch gap-2",children:[e("button",{type:"button",onClick:r,disabled:l,title:`Abort the ${h} and restore the previous state`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-error/40 text-error hover:bg-error/10 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(tn,{size:12}),"Abort ",h]}),y&&e("button",{type:"button",onClick:p,disabled:l||!v,title:v?`Conclude the ${h}`:`Resolve all ${g} conflict(s) first`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-transparent bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(Tn,{size:12}),"Continue ",h]})]})]})}function qe({branchRef:t,showBranchMenu:c,setShowBranchMenu:l,branch:r,branches:p,remoteBranches:h,onCheckout:g,onMerge:v,onOpenBranchPrompt:y,onManageBranches:L,optionsRef:N,showOptions:G,setShowOptions:R,onHistory:P,onGraph:T,viewMode:k,setViewMode:x,isBusy:w=!1,syncCount:E={ahead:0,behind:0},syncing:z=!1,onSync:I,onFetch:A,detached:H=!1}){return e("div",{className:"p-3 border-b border-ink/10 bg-canvas/50 flex items-center justify-between",children:[e("div",{className:"relative",ref:t,children:[e("button",{onClick:()=>l(!c),className:"flex items-center space-x-1.5 hover:bg-ink/5 px-2 py-1 -ml-2 rounded transition-colors text-[11px] text-ink/80 font-medium",title:H?`Detached HEAD at ${r}`:`On branch ${r}`,children:[e(fe,{size:12,className:H?"text-warning":"text-ink/60"}),e("span",{className:`truncate max-w-[140px] ${H?"font-mono text-warning":""}`,children:r}),e(B,{size:12,className:"text-ink/40"})]}),c&&e("div",{className:"glass-popover absolute top-full left-0 mt-1 w-56 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:e("div",{className:"max-h-48 scrollbar-overlay-container py-1",children:[p.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Local"}),p.map((O)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(O),l(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:O}),r===O&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==O&&e("button",{type:"button",onClick:()=>{v(O),l(!1)},title:`Merge ${O} into ${r}`,"aria-label":`Merge ${O} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e(Tn,{size:12})})]},O))]}),h.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Remote"}),h.map((O)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(O),l(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:O}),r===O&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==O&&e("button",{type:"button",onClick:()=>{v(O),l(!1)},title:`Merge ${O} into ${r}`,"aria-label":`Merge ${O} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e(Tn,{size:12})})]},O))]}),e("div",{className:"w-full h-px bg-ink/10 my-1"}),e("button",{onClick:()=>{y(),l(!1)},className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80 italic",children:[e(Y,{size:12}),e("span",{children:"Create new branch..."})]}),e("button",{onClick:L,className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80",children:[e(gi,{size:12}),e("span",{children:"Manage branches..."})]})]})})]}),e("div",{className:"flex items-center space-x-2 text-ink/40 relative",ref:N,children:[e("button",{type:"button",onClick:A,disabled:w,title:"Fetch from all remotes and prune deleted branches","aria-label":"Fetch",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e(Pa,{size:13})}),e("button",{type:"button",onClick:I,disabled:w,title:z?"Syncing with upstream…":E.ahead>0&&E.behind>0?`Pull ${E.behind} then push ${E.ahead} commit(s)`:E.ahead>0?`Push ${E.ahead} commit(s)`:E.behind>0?`Pull ${E.behind} commit(s)`:"Up to date — sync anyway","aria-label":"Sync with upstream","aria-busy":z,className:`flex items-center gap-1 p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:cursor-not-allowed ${z?"":"disabled:opacity-40"}`,children:[e(C,{size:13,className:z?"animate-spin":"","aria-hidden":"true"}),e("span",{className:"font-mono tabular-nums text-[10px]",children:["↑",E.ahead," ↓",E.behind]})]}),e("button",{type:"button",onClick:P,title:"Commit History","aria-label":"Commit History",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(In,{size:13})}),e("button",{type:"button",onClick:T,title:"Git Graph","aria-label":"Git Graph",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Tn,{size:13})}),e("button",{type:"button",onClick:()=>R(!G),title:"View Options","aria-label":"View Options","aria-expanded":G,className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Be,{size:13})}),G&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-36 bg-paper border border-ink/15 rounded-md shadow-lg z-50 py-1 font-mono text-xs",children:[e("button",{type:"button",onClick:()=>{x("flat"),R(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(je,{size:12,className:"text-ink/60"}),e("span",{children:"View as List"})]}),k==="flat"&&e(f,{size:12,className:"text-ink"})]}),e("button",{type:"button",onClick:()=>{x("tree"),R(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(_e,{size:12,className:"text-ink/60"}),e("span",{children:"View as Tree"})]}),k==="tree"&&e(f,{size:12,className:"text-ink"})]})]})]})]})}function Ke({activeRepo:t,repos:c,isRefreshing:l,rootPath:r,reposScanning:p,onSelectRepo:h,onRefresh:g,onRefreshRepos:v}){return e("div",{className:"p-3 border-b border-ink/10 flex items-center justify-between",children:[e("div",{className:"flex items-center gap-1.5 min-w-0",children:[e(pp,{size:12,className:"text-ink/50 flex-shrink-0","aria-hidden":!0}),e(fr,{rootPath:r,activeRepo:t,onSelectRepo:h,repos:c,scanning:p,onRefreshRepos:v})]}),e("div",{className:"flex space-x-2 text-ink/40",children:e("button",{type:"button",onClick:g,title:"Refresh","aria-label":"Refresh",className:"hover:text-ink cursor-pointer inline-flex",children:e(ut,{size:14,className:l?"animate-spin":""})})})]})}function Te({change:t,isStaged:c,repo:l,rootPath:r,onAction:p}){let h=Gn(t.status,c),{charStatus:g,colorClass:v}=h,y=t.file.split("/"),L=y.pop()||t.file,N=y.length>0?y.join("/"):"";return e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-ink/5 cursor-pointer group text-[11px] transition-colors",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:c,status:g,repo:l||".",root:r}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e("span",{className:`font-bold font-mono text-[10px] w-3 flex-shrink-0 text-center ${v}`,title:`Status: ${h.label}`,children:g}),e(at,{name:L,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${v}`,title:t.file,children:L}),N&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:N})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:[!c&&e(d,{children:[e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),p("revert",t.file)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(tn,{size:11})}),e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),p("stage",t.file)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:11})})]}),c&&e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),p("unstage",t.file)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Jt,{size:11})})]})})]})}function Ye({change:t,repo:c,rootPath:l,onResolve:r}){let[p,h]=n(!1),[g,v]=n(null),y=t.file.split("/"),L=y.pop()||t.file,N=y.length>0?y.join("/"):"",G=()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:!1,status:t.status,repo:c,root:l}}))},R=async()=>{let k=!p;if(h(k),k&&g===null){let x=new URLSearchParams({conflictMarkers:"1",file:t.file,repo:c||"."});if(l)x.set("root",l);try{let E=await(await fetch(`/api/fs/git?${x.toString()}`)).json();v(E.markers??{})}catch{v({})}}},P=g?.ours||"ours",T=g?.theirs||"theirs";return e("div",{className:"border-b border-warning/20 last:border-b-0",children:[e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-warning/5 cursor-pointer group text-[11px] transition-colors",onClick:G,children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e(Oa,{size:11,className:"text-warning flex-shrink-0"}),e(at,{name:L,size:12,className:"flex-shrink-0"}),e("span",{className:"truncate text-warning",title:t.file,children:L}),N&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:N}),gr(t.status)&&e("span",{className:"text-[10px] text-warning/70 font-mono flex-shrink-0",children:t.status})]}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),R()},title:p?"Hide resolve actions":"Show resolve actions","aria-label":p?"Hide resolve actions":"Show resolve actions","aria-expanded":p,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors flex-shrink-0",children:p?e(et,{size:11}):e(B,{size:11})})]}),p&&e("div",{className:"px-3 pb-2 pt-0.5 flex flex-wrap items-center gap-1.5",children:[e("button",{type:"button",onClick:()=>r(t.file,"ours"),title:`Take ${P} — \`git checkout --ours\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",P]}),e("button",{type:"button",onClick:()=>r(t.file,"theirs"),title:`Take ${T} — \`git checkout --theirs\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",T]}),e("button",{type:"button",onClick:()=>r(t.file,""),title:"Mark resolved: the file was edited by hand, this stages it",className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer flex items-center gap-1",children:[e(f,{size:10}),"mark resolved"]})]})]})}function Bt(t){let c={id:"",name:"",path:"",type:"folder",children:[],changeCount:0};for(let r of t){let p=r.file.replace(/^[./]+/,""),h=p.endsWith("/"),g=p.replace(/\/$/,"").split("/").filter(Boolean),v=c,y="";for(let L=0;L<g.length;L++){let N=g[L];y=y?`${y}/${N}`:N;let G=L===g.length-1;if(G&&!h)v.children.push({id:y,name:N,path:y,type:"file",change:r,children:[],changeCount:1});else{let P=v.children.find((T)=>T.type==="folder"&&T.name===N);if(!P)P={id:y,name:N,path:y,type:"folder",children:[],changeCount:0,change:G&&h?r:void 0},v.children.push(P);v=P}}}function l(r){if(r.type==="file")return 1;let p=r.change?1:0;for(let h of r.children)p+=l(h);return r.changeCount=p,r.children.sort((h,g)=>{if(h.type==="folder"&&g.type==="file")return-1;if(h.type==="file"&&g.type==="folder")return 1;return h.name.localeCompare(g.name)}),p}return l(c),c.children}function Ze(t){let{sessionId:c,ready:l,read:r}=bp(),p=u(()=>Bt(t),[t]),h=u(()=>{let R=new Set;function P(T){for(let k of T)if(k.type==="folder"){if(R.add(k.id),k.children&&k.children.length>0)P(k.children)}}return P(p),R},[p]),[g,v]=S("git.expandedFolders",[]),y=u(()=>new Set(g),[g]),L=o(null);i(()=>{if(!l||L.current===c)return;if(h.size===0)return;if(L.current=c,r("git.expandedFolders",[]).length>0)return;v(Array.from(h))},[l,c,h,r,v]);let N=a((R)=>{v((P)=>{let T=new Set(P);if(T.has(R))T.delete(R);else T.add(R);return Array.from(T)})},[v]),G=a((R)=>y.has(R),[y]);return{tree:p,expandedFolders:y,toggleFolder:N,isFolderOpen:G,expandAll:()=>v(Array.from(h)),collapseAll:()=>v([])}}function Ae({node:t,isStaged:c,isFolderOpen:l,toggleFolder:r,onAction:p,repo:h,rootPath:g}){let v=t.type==="folder",y=v?l(t.id):!1;if(v)return e("div",{className:"select-none",children:[e("div",{className:"flex items-center justify-between px-2 py-1 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>r(t.id),children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center text-ink/40 flex-shrink-0",children:y?e(B,{size:12}):e(ie,{size:12})}),e(at,{name:t.name,isFolder:!0,isOpen:y,size:13,className:"flex-shrink-0"}),e("span",{className:"font-medium text-ink truncate",children:t.name}),e("span",{className:"text-[10px] text-ink/40 font-normal px-1 py-0.2 bg-ink/5 rounded-full ml-1",children:t.changeCount})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!c?e(d,{children:[e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("revert",t.path)},title:`Discard changes in ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(tn,{size:11})}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("stage",t.path)},title:`Stage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:11})})]}):e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("unstage",t.path)},title:`Unstage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Jt,{size:11})})})})]}),y&&t.children&&t.children.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:t.children.map((k)=>e(Ae,{node:k,isStaged:c,isFolderOpen:l,toggleFolder:r,onAction:p,repo:h,rootPath:g},k.id))})]});let L=t.change,N=Gn(L?.status||"M",c),{charStatus:G,colorClass:R}=N,P=L?L.file:t.path;return e("div",{className:"flex items-center justify-between px-2 py-0.5 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:P,staged:c,status:G,repo:h||".",root:g}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center flex-shrink-0",children:e("span",{className:`font-bold font-mono text-[10px] ${R}`,title:`Status: ${N.label}`,children:G})}),e(at,{name:t.name,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${R}`,title:P,children:t.name})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!c?e(d,{children:[e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("revert",P)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(tn,{size:11})}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("stage",P)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:11})})]}):e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("unstage",P)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Jt,{size:11})})})})]})}function Fe({changes:t,isStaged:c,repo:l,rootPath:r,onAction:p}){let{tree:h,isFolderOpen:g,toggleFolder:v}=Ze(t);if(h.length===0)return null;return e("div",{className:"py-0.5",children:h.map((y)=>e(Ae,{node:y,isStaged:c,isFolderOpen:g,toggleFolder:v,onAction:p,repo:l,rootPath:r},y.id))})}function Qe({changes:t,isLoading:c,viewMode:l,repo:r,rootPath:p,onAction:h,onResolve:g}){let[v,y]=S("git.stagedExpanded",!0),[L,N]=S("git.unstagedExpanded",!0),[G,R]=S("git.conflictsExpanded",!0),P=t.filter((x)=>gr(x.status)),T=t.filter((x)=>{if(gr(x.status))return!1;let w=x.status;return w&&w[0]!==" "&&w[0]!=="?"}),k=t.filter((x)=>{if(gr(x.status))return!1;let w=x.status;return w&&w[1]!==" "&&w[1]!=="?"||w==="??"});if(c&&t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"Loading..."})});if(t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"No changes found."})});return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"py-1",children:[P.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-warning/5 cursor-pointer transition-colors",onClick:()=>R(!G),children:e("div",{className:"flex items-center space-x-1 font-semibold text-warning text-xs",children:[e("span",{className:"w-3 text-center",children:G?"▾":"▸"}),e("span",{children:"Conflicts"}),e("span",{className:"text-warning/70 font-normal ml-1 border border-warning/30 rounded-full px-1.5 text-[10px] bg-paper",children:P.length})]})}),G&&P.map((x)=>e(Ye,{change:x,repo:r,rootPath:p,onResolve:g??(()=>{})},`conflict-${x.file}`))]}),T.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>y(!v),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:v?"▾":"▸"}),e("span",{children:"Staged Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:T.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("unstage_all")},title:"Unstage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Jt,{size:12})})})]}),v&&(l==="tree"?e(Fe,{changes:T,isStaged:!0,repo:r,rootPath:p,onAction:h}):T.map((x)=>e(Te,{change:x,isStaged:!0,repo:r,rootPath:p,onAction:h},x.file+"staged")))]}),k.length>0&&e("div",{children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>N(!L),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:L?"▾":"▸"}),e("span",{children:"Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:k.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:[e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("revert_all")},title:"Discard All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(tn,{size:12})}),e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("stage_all")},title:"Stage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:12})})]})]}),L&&(l==="tree"?e(Fe,{changes:k,isStaged:!1,repo:r,rootPath:p,onAction:h}):k.map((x)=>e(Te,{change:x,isStaged:!1,repo:r,rootPath:p,onAction:h},x.file+"unstaged")))]})]})})}function Je({matches:t,loaded:c,total:l,hasMore:r,isFiltering:p}){if(p)return`${t} of ${c} loaded`;if(typeof l==="number"&&l>0)return r||c<l?`${c} of ${l}`:`${l} commits`;return r?`${c}+ commits`:`${c} commits`}function tt({isGraphMode:t,onToggleMode:c,searchQuery:l,onSearchChange:r,onRefresh:p,onClose:h,isRefreshing:g,totalCommits:v,loadedCount:y,totalCount:L,hasMore:N}){let G=Je({matches:v,loaded:y,total:L,hasMore:N,isFiltering:l.trim().length>0});return e("div",{className:`flex flex-col gap-2 px-3 lg:px-5 py-3 border-b border-ink/10 bg-paper select-none
1
+ import{d,n,i,V,o,u,a,Ar,e,gr,ui,Gn,gp,we,S,bp,Rf,ir,or,s,Pa,Be,Oa,m,In,M,D,Xe,f,B,ie,et,ae,he,fe,Tn,Jt,Dn,Y,C,ut,va,F,gi,tn,b,ce,Tu,ro,J,at,it,pt,Ve,ge}from"./index-d8kjsgpt.js";import{pp,fr}from"./index-z72wf7q4.js";var Tt={name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]},_e=s(Tt);var At={name:"list",size:24,node:[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]},je=s(At);function Ue({message:t,hasStagedChanges:c,isBusy:l=!1,amend:r=!1,seeded:p=!1,onToggleAmend:h,onChangeMessage:g,onCommit:v}){let y=t.trim().length>0&&!l&&(r||c),L=r?"Rewrite the previous commit with this message":c?"Commit staged changes":"Stage changes first";return e("div",{className:"border-t border-ink/10 bg-canvas/50 p-3 flex flex-col gap-2",children:[e("textarea",{value:t,onChange:(N)=>g(N.currentTarget.value),onKeyDown:(N)=>{if(N.key==="Enter"&&(N.metaKey||N.ctrlKey)&&y)N.preventDefault(),v()},placeholder:r?"New message for the previous commit (⌘/Ctrl+Enter to commit)":"Commit message (⌘/Ctrl+Enter to commit)",rows:5,className:"w-full resize-y min-h-[100px] max-h-[200px] bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),e("div",{className:"flex items-center gap-2",children:[e("label",{className:"flex items-center gap-1.5 text-[11px] text-ink/70 cursor-pointer select-none",children:[e("input",{type:"checkbox",checked:r,onChange:(N)=>h?.(N.currentTarget.checked),className:`${ge} accent-ink cursor-pointer`}),"Amend"]}),r&&p&&e("span",{className:"text-[10px] text-ink/40",title:"The previous commit's message, loaded as an editable starting point",children:"previous message loaded"}),e("button",{type:"button",onClick:v,disabled:!y,title:L,className:"ml-auto flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(f,{size:12}),r?"Amend commit":"Commit"]})]})]})}function We({operation:t,conflicts:c,isBusy:l,onAbort:r,onContinue:p}){let h=ui[t],g=c.length,v=g===0,y=t!=="stash-pop";return e("div",{className:"border-t border-warning/30 bg-warning/5 p-3 flex flex-col gap-2",children:[e("div",{className:"flex items-center gap-2 text-xs text-ink",children:[e(D,{size:13,className:"text-warning flex-shrink-0"}),e("span",{className:"font-medium",children:[h.charAt(0).toUpperCase()+h.slice(1)," in progress"]}),e("span",{className:`font-mono tabular-nums text-[10px] ${v?"text-success":"text-warning"}`,children:v?"all conflicts resolved":`${g} conflict${g===1?"":"s"} left`})]}),!v&&e("div",{className:"max-h-20 overflow-y-auto scrollbar-overlay-container font-mono text-[10px] text-warning/90 space-y-0.5",children:c.map((L)=>e("div",{className:"truncate",title:L,children:L},L))}),e("div",{className:"flex items-stretch gap-2",children:[e("button",{type:"button",onClick:r,disabled:l,title:`Abort the ${h} and restore the previous state`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-error/40 text-error hover:bg-error/10 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(tn,{size:12}),"Abort ",h]}),y&&e("button",{type:"button",onClick:p,disabled:l||!v,title:v?`Conclude the ${h}`:`Resolve all ${g} conflict(s) first`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-transparent bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(Tn,{size:12}),"Continue ",h]})]})]})}function qe({branchRef:t,showBranchMenu:c,setShowBranchMenu:l,branch:r,branches:p,remoteBranches:h,onCheckout:g,onMerge:v,onOpenBranchPrompt:y,onManageBranches:L,optionsRef:N,showOptions:G,setShowOptions:R,onHistory:P,onGraph:T,viewMode:k,setViewMode:x,isBusy:w=!1,syncCount:E={ahead:0,behind:0},syncing:z=!1,onSync:I,onFetch:A,detached:H=!1}){return e("div",{className:"p-3 border-b border-ink/10 bg-canvas/50 flex items-center justify-between",children:[e("div",{className:"relative",ref:t,children:[e("button",{onClick:()=>l(!c),className:"flex items-center space-x-1.5 hover:bg-ink/5 px-2 py-1 -ml-2 rounded transition-colors text-[11px] text-ink/80 font-medium",title:H?`Detached HEAD at ${r}`:`On branch ${r}`,children:[e(fe,{size:12,className:H?"text-warning":"text-ink/60"}),e("span",{className:`truncate max-w-[140px] ${H?"font-mono text-warning":""}`,children:r}),e(B,{size:12,className:"text-ink/40"})]}),c&&e("div",{className:"glass-popover absolute top-full left-0 mt-1 w-56 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:e("div",{className:"max-h-48 scrollbar-overlay-container py-1",children:[p.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Local"}),p.map((O)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(O),l(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:O}),r===O&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==O&&e("button",{type:"button",onClick:()=>{v(O),l(!1)},title:`Merge ${O} into ${r}`,"aria-label":`Merge ${O} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e(Tn,{size:12})})]},O))]}),h.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Remote"}),h.map((O)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(O),l(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:O}),r===O&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==O&&e("button",{type:"button",onClick:()=>{v(O),l(!1)},title:`Merge ${O} into ${r}`,"aria-label":`Merge ${O} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e(Tn,{size:12})})]},O))]}),e("div",{className:"w-full h-px bg-ink/10 my-1"}),e("button",{onClick:()=>{y(),l(!1)},className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80 italic",children:[e(Y,{size:12}),e("span",{children:"Create new branch..."})]}),e("button",{onClick:L,className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80",children:[e(gi,{size:12}),e("span",{children:"Manage branches..."})]})]})})]}),e("div",{className:"flex items-center space-x-2 text-ink/40 relative",ref:N,children:[e("button",{type:"button",onClick:A,disabled:w,title:"Fetch from all remotes and prune deleted branches","aria-label":"Fetch",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e(Pa,{size:13})}),e("button",{type:"button",onClick:I,disabled:w,title:z?"Syncing with upstream…":E.ahead>0&&E.behind>0?`Pull ${E.behind} then push ${E.ahead} commit(s)`:E.ahead>0?`Push ${E.ahead} commit(s)`:E.behind>0?`Pull ${E.behind} commit(s)`:"Up to date — sync anyway","aria-label":"Sync with upstream","aria-busy":z,className:`flex items-center gap-1 p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:cursor-not-allowed ${z?"":"disabled:opacity-40"}`,children:[e(C,{size:13,className:z?"animate-spin":"","aria-hidden":"true"}),e("span",{className:"font-mono tabular-nums text-[10px]",children:["↑",E.ahead," ↓",E.behind]})]}),e("button",{type:"button",onClick:P,title:"Commit History","aria-label":"Commit History",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(In,{size:13})}),e("button",{type:"button",onClick:T,title:"Git Graph","aria-label":"Git Graph",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Tn,{size:13})}),e("button",{type:"button",onClick:()=>R(!G),title:"View Options","aria-label":"View Options","aria-expanded":G,className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Be,{size:13})}),G&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-36 bg-paper border border-ink/15 rounded-md shadow-lg z-50 py-1 font-mono text-xs",children:[e("button",{type:"button",onClick:()=>{x("flat"),R(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(je,{size:12,className:"text-ink/60"}),e("span",{children:"View as List"})]}),k==="flat"&&e(f,{size:12,className:"text-ink"})]}),e("button",{type:"button",onClick:()=>{x("tree"),R(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(_e,{size:12,className:"text-ink/60"}),e("span",{children:"View as Tree"})]}),k==="tree"&&e(f,{size:12,className:"text-ink"})]})]})]})]})}function Ke({activeRepo:t,repos:c,isRefreshing:l,rootPath:r,reposScanning:p,onSelectRepo:h,onRefresh:g,onRefreshRepos:v}){return e("div",{className:"p-3 border-b border-ink/10 flex items-center justify-between",children:[e("div",{className:"flex items-center gap-1.5 min-w-0",children:[e(pp,{size:12,className:"text-ink/50 flex-shrink-0","aria-hidden":!0}),e(fr,{rootPath:r,activeRepo:t,onSelectRepo:h,repos:c,scanning:p,onRefreshRepos:v})]}),e("div",{className:"flex space-x-2 text-ink/40",children:e("button",{type:"button",onClick:g,title:"Refresh","aria-label":"Refresh",className:"hover:text-ink cursor-pointer inline-flex",children:e(ut,{size:14,className:l?"animate-spin":""})})})]})}function Te({change:t,isStaged:c,repo:l,rootPath:r,onAction:p}){let h=Gn(t.status,c),{charStatus:g,colorClass:v}=h,y=t.file.split("/"),L=y.pop()||t.file,N=y.length>0?y.join("/"):"";return e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-ink/5 cursor-pointer group text-[11px] transition-colors",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:c,status:g,repo:l||".",root:r}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e("span",{className:`font-bold font-mono text-[10px] w-3 flex-shrink-0 text-center ${v}`,title:`Status: ${h.label}`,children:g}),e(at,{name:L,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${v}`,title:t.file,children:L}),N&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:N})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:[!c&&e(d,{children:[e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),p("revert",t.file)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(tn,{size:11})}),e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),p("stage",t.file)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:11})})]}),c&&e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),p("unstage",t.file)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Jt,{size:11})})]})})]})}function Ye({change:t,repo:c,rootPath:l,onResolve:r}){let[p,h]=n(!1),[g,v]=n(null),y=t.file.split("/"),L=y.pop()||t.file,N=y.length>0?y.join("/"):"",G=()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:!1,status:t.status,repo:c,root:l}}))},R=async()=>{let k=!p;if(h(k),k&&g===null){let x=new URLSearchParams({conflictMarkers:"1",file:t.file,repo:c||"."});if(l)x.set("root",l);try{let E=await(await fetch(`/api/fs/git?${x.toString()}`)).json();v(E.markers??{})}catch{v({})}}},P=g?.ours||"ours",T=g?.theirs||"theirs";return e("div",{className:"border-b border-warning/20 last:border-b-0",children:[e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-warning/5 cursor-pointer group text-[11px] transition-colors",onClick:G,children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e(Oa,{size:11,className:"text-warning flex-shrink-0"}),e(at,{name:L,size:12,className:"flex-shrink-0"}),e("span",{className:"truncate text-warning",title:t.file,children:L}),N&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:N}),gr(t.status)&&e("span",{className:"text-[10px] text-warning/70 font-mono flex-shrink-0",children:t.status})]}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),R()},title:p?"Hide resolve actions":"Show resolve actions","aria-label":p?"Hide resolve actions":"Show resolve actions","aria-expanded":p,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors flex-shrink-0",children:p?e(et,{size:11}):e(B,{size:11})})]}),p&&e("div",{className:"px-3 pb-2 pt-0.5 flex flex-wrap items-center gap-1.5",children:[e("button",{type:"button",onClick:()=>r(t.file,"ours"),title:`Take ${P} — \`git checkout --ours\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",P]}),e("button",{type:"button",onClick:()=>r(t.file,"theirs"),title:`Take ${T} — \`git checkout --theirs\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",T]}),e("button",{type:"button",onClick:()=>r(t.file,""),title:"Mark resolved: the file was edited by hand, this stages it",className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer flex items-center gap-1",children:[e(f,{size:10}),"mark resolved"]})]})]})}function Bt(t){let c={id:"",name:"",path:"",type:"folder",children:[],changeCount:0};for(let r of t){let p=r.file.replace(/^[./]+/,""),h=p.endsWith("/"),g=p.replace(/\/$/,"").split("/").filter(Boolean),v=c,y="";for(let L=0;L<g.length;L++){let N=g[L];y=y?`${y}/${N}`:N;let G=L===g.length-1;if(G&&!h)v.children.push({id:y,name:N,path:y,type:"file",change:r,children:[],changeCount:1});else{let P=v.children.find((T)=>T.type==="folder"&&T.name===N);if(!P)P={id:y,name:N,path:y,type:"folder",children:[],changeCount:0,change:G&&h?r:void 0},v.children.push(P);v=P}}}function l(r){if(r.type==="file")return 1;let p=r.change?1:0;for(let h of r.children)p+=l(h);return r.changeCount=p,r.children.sort((h,g)=>{if(h.type==="folder"&&g.type==="file")return-1;if(h.type==="file"&&g.type==="folder")return 1;return h.name.localeCompare(g.name)}),p}return l(c),c.children}function Ze(t){let{sessionId:c,ready:l,read:r}=bp(),p=u(()=>Bt(t),[t]),h=u(()=>{let R=new Set;function P(T){for(let k of T)if(k.type==="folder"){if(R.add(k.id),k.children&&k.children.length>0)P(k.children)}}return P(p),R},[p]),[g,v]=S("git.expandedFolders",[]),y=u(()=>new Set(g),[g]),L=o(null);i(()=>{if(!l||L.current===c)return;if(h.size===0)return;if(L.current=c,r("git.expandedFolders",[]).length>0)return;v(Array.from(h))},[l,c,h,r,v]);let N=a((R)=>{v((P)=>{let T=new Set(P);if(T.has(R))T.delete(R);else T.add(R);return Array.from(T)})},[v]),G=a((R)=>y.has(R),[y]);return{tree:p,expandedFolders:y,toggleFolder:N,isFolderOpen:G,expandAll:()=>v(Array.from(h)),collapseAll:()=>v([])}}function Ae({node:t,isStaged:c,isFolderOpen:l,toggleFolder:r,onAction:p,repo:h,rootPath:g}){let v=t.type==="folder",y=v?l(t.id):!1;if(v)return e("div",{className:"select-none",children:[e("div",{className:"flex items-center justify-between px-2 py-1 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>r(t.id),children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center text-ink/40 flex-shrink-0",children:y?e(B,{size:12}):e(ie,{size:12})}),e(at,{name:t.name,isFolder:!0,isOpen:y,size:13,className:"flex-shrink-0"}),e("span",{className:"font-medium text-ink truncate",children:t.name}),e("span",{className:"text-[10px] text-ink/40 font-normal px-1 py-0.2 bg-ink/5 rounded-full ml-1",children:t.changeCount})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!c?e(d,{children:[e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("revert",t.path)},title:`Discard changes in ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(tn,{size:11})}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("stage",t.path)},title:`Stage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:11})})]}):e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("unstage",t.path)},title:`Unstage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Jt,{size:11})})})})]}),y&&t.children&&t.children.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:t.children.map((k)=>e(Ae,{node:k,isStaged:c,isFolderOpen:l,toggleFolder:r,onAction:p,repo:h,rootPath:g},k.id))})]});let L=t.change,N=Gn(L?.status||"M",c),{charStatus:G,colorClass:R}=N,P=L?L.file:t.path;return e("div",{className:"flex items-center justify-between px-2 py-0.5 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:P,staged:c,status:G,repo:h||".",root:g}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center flex-shrink-0",children:e("span",{className:`font-bold font-mono text-[10px] ${R}`,title:`Status: ${N.label}`,children:G})}),e(at,{name:t.name,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${R}`,title:P,children:t.name})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!c?e(d,{children:[e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("revert",P)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(tn,{size:11})}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("stage",P)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:11})})]}):e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("unstage",P)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Jt,{size:11})})})})]})}function Fe({changes:t,isStaged:c,repo:l,rootPath:r,onAction:p}){let{tree:h,isFolderOpen:g,toggleFolder:v}=Ze(t);if(h.length===0)return null;return e("div",{className:"py-0.5",children:h.map((y)=>e(Ae,{node:y,isStaged:c,isFolderOpen:g,toggleFolder:v,onAction:p,repo:l,rootPath:r},y.id))})}function Qe({changes:t,isLoading:c,viewMode:l,repo:r,rootPath:p,onAction:h,onResolve:g}){let[v,y]=S("git.stagedExpanded",!0),[L,N]=S("git.unstagedExpanded",!0),[G,R]=S("git.conflictsExpanded",!0),P=t.filter((x)=>gr(x.status)),T=t.filter((x)=>{if(gr(x.status))return!1;let w=x.status;return w&&w[0]!==" "&&w[0]!=="?"}),k=t.filter((x)=>{if(gr(x.status))return!1;let w=x.status;return w&&w[1]!==" "&&w[1]!=="?"||w==="??"});if(c&&t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"Loading..."})});if(t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"No changes found."})});return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"py-1",children:[P.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-warning/5 cursor-pointer transition-colors",onClick:()=>R(!G),children:e("div",{className:"flex items-center space-x-1 font-semibold text-warning text-xs",children:[e("span",{className:"w-3 text-center",children:G?"▾":"▸"}),e("span",{children:"Conflicts"}),e("span",{className:"text-warning/70 font-normal ml-1 border border-warning/30 rounded-full px-1.5 text-[10px] bg-paper",children:P.length})]})}),G&&P.map((x)=>e(Ye,{change:x,repo:r,rootPath:p,onResolve:g??(()=>{})},`conflict-${x.file}`))]}),T.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>y(!v),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:v?"▾":"▸"}),e("span",{children:"Staged Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:T.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("unstage_all")},title:"Unstage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Jt,{size:12})})})]}),v&&(l==="tree"?e(Fe,{changes:T,isStaged:!0,repo:r,rootPath:p,onAction:h}):T.map((x)=>e(Te,{change:x,isStaged:!0,repo:r,rootPath:p,onAction:h},x.file+"staged")))]}),k.length>0&&e("div",{children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>N(!L),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:L?"▾":"▸"}),e("span",{children:"Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:k.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:[e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("revert_all")},title:"Discard All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(tn,{size:12})}),e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("stage_all")},title:"Stage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:12})})]})]}),L&&(l==="tree"?e(Fe,{changes:k,isStaged:!1,repo:r,rootPath:p,onAction:h}):k.map((x)=>e(Te,{change:x,isStaged:!1,repo:r,rootPath:p,onAction:h},x.file+"unstaged")))]})]})})}function Je({matches:t,loaded:c,total:l,hasMore:r,isFiltering:p}){if(p)return`${t} of ${c} loaded`;if(typeof l==="number"&&l>0)return r||c<l?`${c} of ${l}`:`${l} commits`;return r?`${c}+ commits`:`${c} commits`}function tt({isGraphMode:t,onToggleMode:c,searchQuery:l,onSearchChange:r,onRefresh:p,onClose:h,isRefreshing:g,totalCommits:v,loadedCount:y,totalCount:L,hasMore:N}){let G=Je({matches:v,loaded:y,total:L,hasMore:N,isFiltering:l.trim().length>0});return e("div",{className:`flex flex-col gap-2 px-3 lg:px-5 py-3 border-b border-ink/10 bg-paper select-none
2
2
  pl-[max(0.75rem,env(safe-area-inset-left,0px))] pr-[max(0.75rem,env(safe-area-inset-right,0px))]`,children:[e("div",{className:"flex items-center justify-between gap-2 lg:gap-4",children:[e("div",{className:"flex flex-col min-w-0",children:[e("div",{className:"flex items-center gap-2.5 min-w-0",children:[e("h2",{className:"text-base font-semibold text-ink tracking-tight",children:t?"Graph":"History"}),e("span",{className:"text-[11px] font-mono px-2 py-0.5 rounded-full bg-ink/5 text-ink/50 border border-ink/10 whitespace-nowrap",children:G})]}),e("p",{className:"text-xs text-ink/50 mt-0.5 hidden lg:block",children:"Browse recent commits and inspect changed files."})]}),e("div",{className:"flex items-center gap-1.5 lg:gap-2 flex-shrink-0",children:[e("div",{className:"flex items-center bg-ink/5 p-0.5 rounded-lg border border-ink/10 text-xs",children:[e("button",{type:"button",onClick:()=>c(!1),title:"History view",className:`flex items-center gap-1.5 px-2.5 py-1 rounded-md font-medium transition-colors cursor-pointer ${!t?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink hover:bg-ink/5"}`,children:[e(In,{size:13}),e("span",{className:"hidden lg:inline",children:"History"})]}),e("button",{type:"button",onClick:()=>c(!0),title:"Graph view",className:`flex items-center gap-1.5 px-2.5 py-1 rounded-md font-medium transition-colors cursor-pointer ${t?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink hover:bg-ink/5"}`,children:[e(Tn,{size:13}),e("span",{className:"hidden lg:inline",children:"Graph"})]})]}),e("button",{type:"button",onClick:p,disabled:g,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md border border-ink/15 hover:bg-ink/5 text-ink/70 hover:text-ink transition-colors cursor-pointer text-xs disabled:opacity-40",title:"Refresh commit history",children:[e(va,{size:13,className:g?"animate-spin text-ink":""}),e("span",{className:"hidden lg:inline",children:"refresh"})]}),e("button",{type:"button",onClick:h,className:"p-2 -mr-1 rounded-md hover:bg-ink/5 text-ink/60 hover:text-ink transition-colors cursor-pointer",title:"Close modal",children:e(b,{size:16})})]})]}),e("div",{className:"relative mt-1",children:[e(F,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-ink/40"}),e("input",{type:"text",value:l,onChange:(R)=>r(R.currentTarget.value),placeholder:"Filter commits by message, author, or hash...",className:"w-full bg-ink/[0.03] border border-ink/15 rounded-md pl-8 pr-3 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),l&&e("button",{type:"button",onClick:()=>r(""),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-ink/40 hover:text-ink cursor-pointer",children:e(b,{size:12})})]})]})}var le=["#38bdf8","#f97316","#a855f7","#10b981","#ec4899","#eab308","#06b6d4","#6366f1"];function Ee(t,c){if(!t||!c)return!1;if(t===c)return!0;let l=Math.min(t.length,c.length);if(l>=4)return t.substring(0,l)===c.substring(0,l);return!1}function Re(t){let c=new Map,l=[];for(let r of t){if(typeof r.lane==="number"){c.set(r.hash,r.lane);continue}let p=l.findIndex((g)=>Ee(g,r.hash)||Ee(g,r.shortHash));if(p===-1)if(p=l.indexOf(null),p===-1)p=l.length,l.push(r.hash);else l[p]=r.hash;c.set(r.hash,p);let h=r.parents&&r.parents[0];if(h)l[p]=h;else l[p]=null;if(r.parents&&r.parents.length>1)for(let g=1;g<r.parents.length;g++){let v=r.parents[g];if(!l.some((L)=>Ee(L,v))){let L=l.indexOf(null);if(L===-1)l.push(v);else l[L]=v}}}return c}function nt(t,c,l,r){let p=[],h=new Map;t.forEach((g,v)=>{if(h.set(g.hash,v),g.shortHash)h.set(g.shortHash,v);if(g.hash.length>=7)h.set(g.hash.substring(0,7),v)});for(let g of t){let v=c.get(g.hash)??0,y=l[g.hash]??0,L=le[v%le.length];if(!g.parents||g.parents.length===0)continue;for(let N of g.parents){let G=h.get(N);if(typeof G!=="number"&&N.length>=7)G=h.get(N.substring(0,7));if(typeof G==="number"){let R=t[G],P=c.get(R.hash)??v,T=l[R.hash]??y+60;p.push({fromHash:g.hash,toHash:R.hash,fromLane:v,toLane:P,fromY:y,toY:T,color:le[v%le.length]})}else p.push({fromHash:g.hash,toHash:"tail-"+g.hash,fromLane:v,toLane:v,fromY:y,toY:Math.max(y+80,r),color:L})}}return p}function ot(t,c,l,r){if(Math.abs(t-l)<1)return`M ${t} ${c} L ${l} ${r}`;let p=r-c,h=c+p*0.45,g=r-p*0.45;return`M ${t} ${c} C ${t} ${h}, ${l} ${g}, ${l} ${r}`}function st({commits:t,nodePositions:c,selectedHash:l,hoveredHash:r,isGraphMode:p,laneWidth:h=18,paddingLeft:g=16,totalHeight:v}){let y=u(()=>{if(!p){let R=new Map;return t.forEach((P)=>R.set(P.hash,0)),R}return Re(t)},[t,p]),L=u(()=>{let R=0;return y.forEach((P)=>{if(P>R)R=P}),R},[y]),N=p?(L+1)*h+g*2:36,G=u(()=>{if(!p){let R=[];for(let P=0;P<t.length-1;P++){let T=c[t[P].hash]??P*60+20,k=c[t[P+1].hash]??(P+1)*60+20;R.push({fromHash:t[P].hash,toHash:t[P+1].hash,fromLane:0,toLane:0,fromY:T,toY:k,color:"var(--theme-ink)"})}return R}return nt(t,y,c,v)},[t,y,c,v,p]);return e("div",{className:"absolute top-0 left-0 pointer-events-none z-10",style:{width:N,height:v},children:e("svg",{className:"w-full h-full overflow-visible",style:{width:N,height:v},children:[e("defs",{children:e("filter",{id:"node-glow",x:"-20%",y:"-20%",width:"140%",height:"140%",children:e("feDropShadow",{dx:"0",dy:"0",stdDeviation:"2",floodOpacity:"0.35"})})}),G.map((R)=>{let P=p?g+R.fromLane*h:16,T=p?g+R.toLane*h:16,k=p?R.color:"currentColor",x=p?0.95:0.25,w=ot(P,R.fromY,T,R.toY);return e("path",{d:w,fill:"none",stroke:k,strokeWidth:p?2.25:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:x},`${R.fromHash}->${R.toHash}`)}),t.map((R)=>{let P=y.get(R.hash)??0,T=p?g+P*h:16,k=c[R.hash]??20,x=l===R.hash||l===R.shortHash,w=r===R.hash||r===R.shortHash,E=p?le[P%le.length]:"var(--theme-success)";return e("g",{"data-commit-node":R.hash,children:[(x||w)&&e("circle",{cx:T,cy:k,r:8,fill:E,fillOpacity:x?0.35:0.2,stroke:E,strokeWidth:1}),e("circle",{"data-commit-dot":"",cx:T,cy:k,r:p?4:4.5,fill:p?"var(--theme-paper)":E,stroke:E,strokeWidth:p?2.5:1.5,filter:"url(#node-glow)"}),p&&e("circle",{cx:T,cy:k,r:1.8,fill:E})]},`node-${R.hash}`)})]})})}function rt({commit:t,onAction:c}){return e("div",{className:"flex flex-wrap items-center gap-1.5 pt-1.5 pb-2",children:[e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("checkout",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"checkout"}),e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("create_branch_here",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"create branch here"}),e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("cherry_pick",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"cherry-pick"}),e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("revert",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"revert"}),e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("reset",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"reset..."}),e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("merge",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"merge into current"}),e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("rebase",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"rebase onto this"})]})}var Ge=3;function Ft(t){let c=[];for(let l=0;l<t.length;l+=1){if(t[l].type!=="context"){c.push({row:t[l],index:l});continue}let r=l;while(r<t.length&&t[r].type==="context")r+=1;let p=r-l;if(p>Ge*2+1){for(let h=l;h<l+Ge;h+=1)c.push({row:t[h],index:h});c.push({row:{type:"elided",count:p-Ge*2},index:-1});for(let h=r-Ge;h<r;h+=1)c.push({row:t[h],index:h})}else for(let h=l;h<r;h+=1)c.push({row:t[h],index:h});l=r-1}return c}function lt({diffText:t,isLoading:c,filePath:l,fullContext:r=!1,onToggleContext:p}){let h=ro(),g=u(()=>{if(!t)return[];let N=[],G=1,R=1,P=t.split(/\r?\n/),k=P.some((x)=>x.startsWith("@@"))?P:[`@@ -0,0 +1,${P.length} @@`,...P.map((x)=>x.startsWith("+")||x.startsWith("-")?x:`+${x}`)];for(let x of k){if(x.startsWith("diff --git")||x.startsWith("index ")||x.startsWith("---")||x.startsWith("+++")||x.startsWith("new file mode")||x.startsWith("deleted file mode")||x.startsWith("similarity index")||x.startsWith("old mode")||x.startsWith("new mode")||x.startsWith("\\ No newline"))continue;if(x.startsWith("@@")){let w=x.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(w)G=parseInt(w[1],10),R=parseInt(w[2],10);N.push({type:"meta",text:x})}else if(x.startsWith("+"))N.push({type:"add",text:x.slice(1),newNum:R++});else if(x.startsWith("-"))N.push({type:"del",text:x.slice(1),oldNum:G++});else{let w=x.startsWith(" ")?x.slice(1):x;N.push({type:"context",text:w,oldNum:G++,newNum:R++})}}return N},[t]),v=pt(l),y=u(()=>{let N=Array(g.length).fill(""),G=-1,R=(P)=>{if(G<0)return;let T=Tu(g.slice(G,P).map((k)=>k.text).join(`
3
3
  `),v);for(let k=G;k<P;k++)N[k]=T[k-G]??"";G=-1};return g.forEach((P,T)=>{if(P.type==="meta")R(T);else if(G<0)G=T}),R(g.length),N},[g,v,h]),L=u(()=>r?g.map((N,G)=>({row:N,index:G})):Ft(g),[g,r]);if(c)return e("div",{className:"my-2 p-4 rounded bg-canvas border border-ink/10 text-ink/40 font-mono text-xs flex items-center justify-center",children:"Loading commit diff..."});if(!t||g.length===0)return e("div",{className:"my-2 p-3 rounded bg-canvas border border-ink/10 text-ink/40 font-mono text-xs text-center",children:"No diff content available for this file."});return e("div",{className:"my-2 rounded border border-ink/15 bg-paper overflow-hidden text-[11px] font-mono leading-relaxed shadow-xs text-ink",children:[e("div",{className:"flex items-center justify-between px-3 py-1.5 bg-canvas border-b border-ink/10 text-ink/70 text-[10.5px]",children:[e("span",{className:"font-semibold text-meta",children:"Diff preview"}),e("button",{type:"button",onClick:p,disabled:!p,className:"hover:text-ink flex items-center gap-1 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-default",title:r?"Show only the changed hunks":"Read the whole file around the change","aria-pressed":r,children:r?e(d,{children:[e(et,{size:12})," Collapse context"]}):e(d,{children:[e(B,{size:12})," Expand all context"]})})]}),e("div",{className:"overflow-x-auto max-h-72 select-text",children:e("div",{className:"w-max min-w-full divide-y divide-ink/[0.04]",children:L.map(({row:N,index:G},R)=>{if(N.type==="elided")return e("div",{className:"px-3 py-1 bg-canvas text-ink/40 text-[10px] text-center select-none",title:`${N.count} unchanged line(s) hidden`,children:["⋯ ",N.count," unchanged line",N.count===1?"":"s"," hidden ⋯"]},`elided-${R}`);let P=N,T=G;if(P.type==="meta")return e("div",{className:"flex items-center gap-2 px-3 py-1 bg-canvas border-y border-ink/10 text-meta text-[10px] font-semibold",children:[e("span",{children:"↕"}),e("span",{children:P.text})]},T);let k=P.type==="add",x=P.type==="del";return e("div",{className:`flex items-start font-mono ${k?"bg-success/10 hover:bg-success/15":x?"bg-error/10 hover:bg-error/15":"text-ink hover:bg-ink/[0.02]"}`,children:[e("div",{className:`w-10 flex-shrink-0 text-right pr-2 py-0.5 select-none border-r border-ink/10 text-[10px] tabular-nums font-mono ${x?"bg-error/15 text-error font-semibold":k?"bg-success/15 text-success/70":"bg-canvas/50 text-ink/40"}`,children:P.oldNum??(k?"+":"")}),e("div",{className:`w-10 flex-shrink-0 text-right pr-2 py-0.5 select-none border-r border-ink/10 text-[10px] tabular-nums font-mono ${k?"bg-success/15 text-success font-semibold":x?"bg-error/15 text-error/70":"bg-canvas/50 text-ink/40"}`,children:P.newNum??(x?"-":"")}),e("div",{className:`w-4 flex-shrink-0 text-center py-0.5 select-none font-bold ${k?"text-success":x?"text-error":"opacity-0"}`,children:k?"+":x?"-":" "}),e("div",{className:"flex-1 py-0.5 pr-3 whitespace-pre text-ink",children:P.text?e("span",{className:"shiki",dangerouslySetInnerHTML:{__html:y[T]}}):" "})]},T)})})})]})}function ct({commit:t,isSelected:c,isGraphMode:l,onSelect:r,onAction:p,onToggleFile:h,isExpandedFile:g,isLoadingFile:v,isFullContextFile:y,onToggleContext:L,fileDiffs:N,headerRef:G}){let[R,P]=n(!1),[T,k]=n(!1),x=t.body?.trim()??"",w=x.length>0,E=(A)=>{A.stopPropagation(),navigator.clipboard.writeText(t.hash),P(!0),setTimeout(()=>P(!1),2000)},z=(A,H)=>{A.stopPropagation(),h(t.hash,H)};return e("div",{onClick:()=>{if(r(t),!w)return;let A=globalThis.getSelection?.();if(A&&!A.isCollapsed)return;k((H)=>!H)},"data-testid":"commit-row","data-commit-hash":t.hash,className:`border-b border-ink/5 transition-colors cursor-pointer ${c?"bg-ink/[0.03]":"hover:bg-ink/[0.015]"}`,children:e("div",{className:"py-2.5 pr-4 pl-1 flex flex-col",children:[e("div",{className:"flex flex-col gap-1",children:[t.refs&&t.refs.length>0&&e("div",{className:"flex flex-wrap items-center gap-1.5 pb-0.5",children:t.refs.map((A,H)=>{let O=A.includes("stash"),X=A.includes("HEAD")||A.includes("main")||A.includes("master");return e("span",{className:`px-2 py-0.5 rounded text-[10px] font-mono border ${O?"bg-warning/10 text-warning border-warning/25 font-semibold":X?"bg-ink/10 text-ink font-semibold border-ink/20":"bg-canvas text-meta border-ink/10 font-medium"}`,children:A},H)})}),e("div",{ref:G,className:"flex items-start gap-1.5",children:[e("span",{"data-commit-title":"",className:"text-[13px] font-semibold text-ink leading-snug break-words flex-1 min-w-0",children:t.message}),w&&e("span",{className:"text-ink/40 flex-shrink-0 mt-0.5","aria-hidden":"true",children:T?e(B,{size:13}):e(ie,{size:13})})]}),w&&T&&e("div",{className:"text-[12px] text-ink/70 leading-relaxed whitespace-pre-wrap break-words border-l-2 border-ink/15 pl-2.5 py-0.5 font-mono",children:x}),e("div",{className:"flex items-center gap-2 text-[11px] text-ink/50 font-mono flex-wrap",children:[e("span",{children:t.author}),e("span",{children:"•"}),e("span",{children:t.date}),e("span",{children:"•"}),e("button",{type:"button",onClick:E,title:"Copy commit hash",className:"inline-flex items-center gap-1 hover:text-ink transition-colors cursor-pointer text-ink/70",children:[e("span",{children:t.shortHash}),R?e(f,{size:11,className:"text-success"}):e(ae,{size:11})]})]})]}),(c||l)&&e("div",{className:"mt-2",children:e(rt,{commit:t,onAction:p})}),t.files&&t.files.length>0&&e("div",{className:"mt-2 flex flex-col gap-1",children:t.files.map((A,H)=>{let O=g(t.hash,A.file),X=`${t.hash}:${A.file}`,te=N[X]!==void 0?N[X]:A.diff,j=v(t.hash,A.file),K=A.status==="A"?"text-success font-bold":A.status==="D"?"text-error font-bold":A.status==="R"?"text-meta font-bold":"text-info font-bold";return e("div",{className:"flex flex-col",children:[e("div",{onClick:(W)=>z(W,A),className:"flex items-center gap-2 py-1 px-2 rounded hover:bg-ink/5 text-[11.5px] font-mono text-ink/80 transition-colors group cursor-pointer border border-transparent hover:border-ink/10",children:[e("span",{className:`w-3.5 text-center flex-shrink-0 text-[11px] ${K}`,children:A.status||"M"}),e("span",{className:"truncate flex-1 min-w-0 text-ink/90 group-hover:text-ink font-medium",children:A.file}),e("span",{className:"flex items-center gap-1 text-[10.5px] tabular-nums flex-shrink-0 font-medium",children:[e("span",{className:"text-success",children:["+",A.additions]}),e("span",{className:"text-ink/30",children:"/"}),e("span",{className:"text-error",children:["-",A.deletions]})]}),e("span",{className:"text-ink/40 group-hover:text-ink flex-shrink-0",children:O?e(B,{size:13}):e(ie,{size:13})})]}),O&&e("div",{className:"pl-4 pr-1",children:e(lt,{diffText:te,isLoading:j,filePath:A.file,fullContext:y(t.hash,A.file),onToggleContext:()=>L(t.hash,A)})})]},H)})})]})})}var xe=50;function Et(t){if(!Array.isArray(t))return[];let c=[];for(let l of t){if(!l||typeof l!=="object")continue;let r=l;if(typeof r.file!=="string"||!r.file)continue;c.push({file:r.file,status:typeof r.status==="string"?r.status:"M",additions:typeof r.additions==="number"&&Number.isFinite(r.additions)?r.additions:0,deletions:typeof r.deletions==="number"&&Number.isFinite(r.deletions)?r.deletions:0,diff:typeof r.diff==="string"?r.diff:void 0})}return c}function ze(t){if(!Array.isArray(t))return[];let c=[];for(let l of t){if(!l||typeof l!=="object")continue;let r=l,p=typeof r.hash==="string"&&r.hash?r.hash:"";if(!p)continue;c.push({hash:p,shortHash:typeof r.shortHash==="string"&&r.shortHash?r.shortHash:p.slice(0,8),author:typeof r.author==="string"?r.author:"Unknown",date:typeof r.date==="string"?r.date:typeof r.time==="string"?r.time:"",message:typeof r.message==="string"?r.message:"",body:typeof r.body==="string"?r.body:void 0,parents:Array.isArray(r.parents)?r.parents.filter((h)=>typeof h==="string"):[],refs:Array.isArray(r.refs)?r.refs.filter((h)=>typeof h==="string"):[],files:Et(r.files),lane:typeof r.lane==="number"?r.lane:void 0})}return c}function dt({output:t,isGraphMode:c,rootPath:l,activeRepo:r}){let[p,h]=n(!1),[g,v]=n(t?.hasMore??t?.data?.length===xe),[y,L]=n(t?.total),N=u(()=>ze(t?.data),[t?.data]),G=Array.isArray(t?.data)?t.data.length:0,[R,P]=n(N),[T,k]=n(G);i(()=>{if(P(N),k(G),v(t?.hasMore??G===xe),typeof t?.total==="number")L(t.total)},[N,G,t?.hasMore,t?.total]);let x=a(async()=>{if(p||!g)return;h(!0);try{let w=new FormData;if(w.set("actionType",c?"graph":"history"),w.set("limit",String(xe)),w.set("skip",String(T)),l)w.set("root",l);if(r)w.set("repo",r);let z=await(await fetch("/api/fs/git",{method:"POST",body:w})).json();if(z.success&&Array.isArray(z.data)){let I=ze(z.data),A=z.data.length;if(P((H)=>{let O=new Set(H.map((te)=>te.hash)),X=I.filter((te)=>!O.has(te.hash));return[...H,...X]}),k((H)=>H+A),v(Boolean(z.hasMore??A===xe)),typeof z.total==="number")L(z.total)}else v(!1)}catch(w){console.error("Failed to load more commits:",w)}finally{h(!1)}},[p,g,c,T,l,r]);return{commits:R,hasMore:g,totalCount:y,isLoadingMore:p,handleLoadMore:x}}function mt({onExecuteAction:t,rootPath:c,activeRepo:l}){let[r,p]=n({}),[h,g]=n(new Set),[v,y]=n(new Set),[L,N]=n(new Set),G=a(async(k,x,w)=>{let E=`${k}:${x.file}`;y((z)=>new Set(z).add(E));try{let z=new FormData;if(z.set("actionType","commit_diff"),z.set("hash",k),z.set("file",x.file),w)z.set("full","1");if(c)z.set("root",c);if(l&&l!==".")z.set("repo",l);let A=await(await fetch("/api/fs/git",{method:"POST",body:z})).json();if(A&&typeof A.diff==="string")p((H)=>({...H,[E]:A.diff}));else if(A&&A.error)p((H)=>({...H,[E]:`// Error: ${A.error}`}))}catch(z){console.error("Failed to load file diff:",z);let I=z instanceof Error?z.message:"Network error";p((A)=>({...A,[E]:`// Error loading diff: ${I}`}))}finally{y((z)=>{let I=new Set(z);return I.delete(E),I})}},[c,l]),R=a(async(k,x)=>{let w=`${k}:${x.file}`,E=!h.has(w);if(g((z)=>{let I=new Set(z);if(I.has(w))I.delete(w);else I.add(w);return I}),E&&r[w]===void 0&&!x.diff)await G(k,x,!1)},[h,r,G]),P=a(async(k,x)=>{let w=`${k}:${x.file}`,E=!L.has(w);N((z)=>{let I=new Set(z);if(I.has(w))I.delete(w);else I.add(w);return I}),await G(k,x,E)},[L,G]),T=a((k,x)=>{if(!t)return;if(k==="checkout")t("checkout",void 0,{branch:x.hash});else if(k==="create_branch_here"){let w=window.prompt(`Create new branch at commit ${x.shortHash}:`,`branch-${x.shortHash}`);if(w?.trim())t("create_branch_at",void 0,{branch:w.trim(),hash:x.hash})}else if(k==="cherry_pick"){if(window.confirm(`Cherry-pick commit ${x.shortHash} onto current branch?`))t("cherry_pick",void 0,{hash:x.hash})}else if(k==="revert"){if(window.confirm(`Revert commit ${x.shortHash}?`))t("revert_commit",void 0,{hash:x.hash})}else if(k==="reset"){let w=window.prompt(`Reset current branch to ${x.shortHash} (soft, mixed, hard):`,"soft");if(w&&["soft","mixed","hard"].includes(w.toLowerCase()))t("reset_commit",void 0,{hash:x.hash,mode:w.toLowerCase()})}else if(k==="merge"){if(window.confirm(`Merge commit ${x.shortHash} into current branch?`))t("merge_commit",void 0,{hash:x.hash})}else if(k==="rebase"){if(window.confirm(`Rebase current branch onto commit ${x.shortHash}?`))t("rebase_commit",void 0,{hash:x.hash})}},[t]);return{fileDiffs:r,expandedFiles:h,loadingFiles:v,fullContextFiles:L,handleToggleFile:R,handleToggleContext:P,handleCommitAction:T}}function He({output:t,onClose:c,onRefresh:l,onExecuteAction:r,rootPath:p,activeRepo:h}){if(!t)return null;let[g,v]=n(()=>({title:t.title,graph:t.title.toLowerCase().includes("graph")}));if(g.title!==t.title)v({title:t.title,graph:t.title.toLowerCase().includes("graph")});let y=g.graph,L=(U)=>v((_)=>({..._,graph:U})),[N,G]=n(""),[R,P]=n(""),[T,k]=n(!1),{commits:x,hasMore:w,totalCount:E,isLoadingMore:z,handleLoadMore:I}=dt({output:t,isGraphMode:y,rootPath:p,activeRepo:h}),{fileDiffs:A,expandedFiles:H,loadingFiles:O,fullContextFiles:X,handleToggleFile:te,handleToggleContext:j,handleCommitAction:K}=mt({onExecuteAction:r,rootPath:p,activeRepo:h});i(()=>{if(x.length>0&&!R)P(x[0].hash)},[x,R]);let W=u(()=>{if(!N.trim())return x;let U=N.toLowerCase().trim();return x.filter((_)=>_.message.toLowerCase().includes(U)||_.author.toLowerCase().includes(U)||_.shortHash.toLowerCase().includes(U)||_.hash.toLowerCase().includes(U)||_.refs?.some((ee)=>ee.toLowerCase().includes(U)))},[x,N]),ne=o(null),se=o(null),be=o(null),de=o({}),[pe,ve]=n({}),[Se,Pe]=n(800);i(()=>{let U=be.current;if(!U||!w||z||N.trim())return;let _=new IntersectionObserver((ee)=>{if(ee[0].isIntersecting)I()},{root:ne.current,threshold:0.1});return _.observe(U),()=>_.disconnect()},[w,z,N,I]);let re=a(()=>{if(!ne.current||!se.current)return;let U=ne.current.getBoundingClientRect(),_=ne.current.scrollTop,ee={};W.forEach((me,Le)=>{let ue=de.current[me.hash];if(ue){let oe=ue.getBoundingClientRect();ee[me.hash]=oe.top+oe.height/2-U.top+_}else ee[me.hash]=Le*60+20}),ve(ee);let Ce=se.current.offsetHeight;Pe(Math.max(Ce,ne.current.clientHeight,600))},[W]);V(()=>{re();let U=requestAnimationFrame(()=>{re()});return()=>cancelAnimationFrame(U)},[re,W,A,H,y,R]),i(()=>{let U=se.current;if(!U)return;let _=new ResizeObserver(()=>{re()});_.observe(U);for(let ee of Array.from(U.children))_.observe(ee);return()=>_.disconnect()},[re,W]);let Z=u(()=>Re(W),[W]),$e=u(()=>{let U=0;return Z.forEach((_)=>{if(_>U)U=_}),U},[Z]),ye=18,ke=16,Me=y?($e+1)*ye+ke*2:36;return e("div",{className:"fixed inset-0 z-50 modal-scrim backdrop-blur-xs flex items-center justify-center p-0 lg:p-5",onClick:c,role:"dialog","aria-modal":"true",children:e("div",{className:`glass-overlay bg-paper border-ink/20 shadow-2xl flex flex-col overflow-hidden
4
4
  w-full h-full rounded-none border-0