@kabmo-labs/kabmo 0.46.0 → 0.46.1

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 (111) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +1 -1
  3. package/dist/client/static/js/{CsvGrid-br4j001k.js → CsvGrid-qdkmv8bj.js} +1 -1
  4. package/dist/client/static/js/{DocxView-kmtkbmmw.js → DocxView-k84ns803.js} +1 -1
  5. package/dist/client/static/js/{DrawioView-3df0g3jr.js → DrawioView-r1n717f7.js} +1 -1
  6. package/dist/client/static/js/{ImageView-2r8p5z3y.js → ImageView-jkrdrq8v.js} +1 -1
  7. package/dist/client/static/js/{LayoutWrapper-rq3d2a4e.js → LayoutWrapper-sh634350.js} +2 -2
  8. package/dist/client/static/js/{Modal-tmxhxd6q.js → Modal-xe6h99jn.js} +1 -1
  9. package/dist/client/static/js/{PdfView-p5z7c7eg.js → PdfView-ffg4mccg.js} +1 -1
  10. package/dist/client/static/js/{SessionsView-t06h6zfx.js → SessionsView-cdcbsee9.js} +1 -1
  11. package/dist/client/static/js/{SheetView-agw459v2.js → SheetView-89sscpz6.js} +1 -1
  12. package/dist/client/static/js/{SvgPreview-b9rfy1h6.js → SvgPreview-68c0ccbv.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-wbnhzcnj.js → abnfDiagram-O67JEVCF-h3a5s259.js} +1 -1
  14. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-t2sgevea.js → architectureDiagram-NJMV4G6O-983p0jgn.js} +1 -1
  15. package/dist/client/static/js/{blockDiagram-BEXU5L5S-v2nzp54a.js → blockDiagram-BEXU5L5S-16pse5mh.js} +1 -1
  16. package/dist/client/static/js/{c4Diagram-YGBWAQC7-7h03146b.js → c4Diagram-YGBWAQC7-mvnb00zt.js} +1 -1
  17. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-m57e9kp1.js → classDiagram-v2-NBCMYWYE-kmpd91xb.js} +1 -1
  18. package/dist/client/static/js/{cose-bilkent-JH36ORCC-c4tnh4mg.js → cose-bilkent-JH36ORCC-3ek5r5se.js} +1 -1
  19. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-mjf6njey.js → cynefinDiagram-VND7K2PF-jkbh84zn.js} +1 -1
  20. package/dist/client/static/js/{dagre-6A5THRUB-6yma9ch3.js → dagre-6A5THRUB-4fdc0sgn.js} +1 -1
  21. package/dist/client/static/js/{diagram-22UHCM2B-1q4ce2gb.js → diagram-22UHCM2B-hbk61nq9.js} +1 -1
  22. package/dist/client/static/js/{diagram-3UASUU5V-0ttps29p.js → diagram-3UASUU5V-hfpbr9qh.js} +1 -1
  23. package/dist/client/static/js/{diagram-ATOU4E4O-1mzexgv1.js → diagram-ATOU4E4O-fn0nt71a.js} +1 -1
  24. package/dist/client/static/js/{diagram-CDSNMT55-4ae89t23.js → diagram-CDSNMT55-ssswxjeb.js} +1 -1
  25. package/dist/client/static/js/{diagram-MLGK6HIB-057jaqvh.js → diagram-MLGK6HIB-whnzxv6f.js} +1 -1
  26. package/dist/client/static/js/{diagram-MPIPVDR6-p6yyq5sx.js → diagram-MPIPVDR6-hk1chzxk.js} +1 -1
  27. package/dist/client/static/js/{dockerfile-00hqsk9c.js → dockerfile-zmsj8r4g.js} +1 -1
  28. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-bsk7dvm4.js → ebnfDiagram-ZINNZB2B-q1vkg5mr.js} +1 -1
  29. package/dist/client/static/js/{elk-276RUBZZ-dsq91er5.js → elk-276RUBZZ-kt98vg8j.js} +1 -1
  30. package/dist/client/static/js/{erDiagram-OPXOYQCR-p7p13mbh.js → erDiagram-OPXOYQCR-ey3avsn9.js} +1 -1
  31. package/dist/client/static/js/flowDiagram-KWPJA3E3-7gvtpn3d.js +1 -0
  32. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-bwgnttyk.js → ganttDiagram-FUAMR5RP-a9k1at43.js} +1 -1
  33. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-ca0gj5am.js → gitGraphDiagram-X574FWY7-gnekjfym.js} +1 -1
  34. package/dist/client/static/js/{index-jkay7aw7.js → index-1ax52p0q.js} +1 -1
  35. package/dist/client/static/js/{index-064vdkrs.js → index-2a6qp9y6.js} +1 -1
  36. package/dist/client/static/js/{index-j718pxb3.js → index-3x7h2eqj.js} +1 -1
  37. package/dist/client/static/js/{index-amys498v.js → index-4cag7w6k.js} +131 -131
  38. package/dist/client/static/js/{index-ta6gpcpw.js → index-5ka2tyf9.js} +2 -2
  39. package/dist/client/static/js/{index-x1fqhhpp.js → index-60v30k5h.js} +2 -2
  40. package/dist/client/static/js/{index-5gf52a6d.js → index-65afr75v.js} +1 -1
  41. package/dist/client/static/js/{index-4bqssvt6.js → index-83rkg916.js} +1 -1
  42. package/dist/client/static/js/{index-aagt3382.js → index-84fyq5a6.js} +1 -1
  43. package/dist/client/static/js/{index-dr5hca5b.js → index-8g7q8mz4.js} +1 -1
  44. package/dist/client/static/js/{index-bjv5ga2e.js → index-9vv7wr1n.js} +1 -1
  45. package/dist/client/static/js/{index-pwe6chtp.js → index-amsa0tfs.js} +1 -1
  46. package/dist/client/static/js/{index-red856x6.js → index-atq9q1s7.js} +1 -1
  47. package/dist/client/static/js/{index-f7te27n5.js → index-b2e5pwx7.js} +1 -1
  48. package/dist/client/static/js/{index-ex5dtdx2.js → index-b5dfvget.js} +1 -1
  49. package/dist/client/static/js/{index-zedt16w7.js → index-bsr7wmj2.js} +1 -1
  50. package/dist/client/static/js/{index-k5zfzgez.js → index-c9e417cs.js} +1 -1
  51. package/dist/client/static/js/{index-3bf7r7z4.js → index-dt6q3rws.js} +4 -4
  52. package/dist/client/static/js/{index-29npynva.js → index-e9cxje00.js} +1 -1
  53. package/dist/client/static/js/{index-zq0qxb17.js → index-fzngzhww.js} +1 -1
  54. package/dist/client/static/js/{index-16sd19f0.js → index-hgzntg2j.js} +1 -1
  55. package/dist/client/static/js/{index-bafe7hmd.js → index-kb14dhrx.js} +1 -1
  56. package/dist/client/static/js/{index-qn200x1b.js → index-kbhrvep8.js} +6 -6
  57. package/dist/client/static/js/{index-eqhjs1yv.js → index-m4k054wz.js} +3 -3
  58. package/dist/client/static/js/{index-8pksqzwq.js → index-pavvxrsz.js} +1 -1
  59. package/dist/client/static/js/{index-95kese1h.js → index-q9ytjey8.js} +1 -1
  60. package/dist/client/static/js/{index-3qnjdjg2.js → index-vkqb4dnt.js} +1 -1
  61. package/dist/client/static/js/{index-7055hdx1.js → index-wrcdc9vz.js} +1 -1
  62. package/dist/client/static/js/{index-ncpwteyt.js → index-x9r7zfp4.js} +1 -1
  63. package/dist/client/static/js/{index-y2z8nsvw.js → index-xq5f3nxa.js} +1 -1
  64. package/dist/client/static/js/{index-gq5w5w8x.js → index-xwjbq003.js} +1 -1
  65. package/dist/client/static/js/{index-twsbv1yn.js → index-yf93db65.js} +1 -1
  66. package/dist/client/static/js/{index-9d3n04vb.js → index-ykm7a3cp.js} +2 -2
  67. package/dist/client/static/js/{index-5h8y54t6.js → index-z25ss7xj.js} +1 -1
  68. package/dist/client/static/js/{infoDiagram-VRGFBTTK-7q58qdf1.js → infoDiagram-VRGFBTTK-r1p25738.js} +1 -1
  69. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-9jmeszag.js → ishikawaDiagram-OU5B5YK6-afgrqdrt.js} +1 -1
  70. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-0d7xe845.js → journeyDiagram-ZHPQQLJL-hepa4wk7.js} +1 -1
  71. package/dist/client/static/js/{kanban-definition-PNTS6WVX-7p83rwdn.js → kanban-definition-PNTS6WVX-jysft8ya.js} +1 -1
  72. package/dist/client/static/js/{mermaid.core-hwhzw0wv.js → mermaid.core-0m90b0s8.js} +2 -2
  73. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-hy0rtr7t.js → mindmap-definition-NLK3R4M7-x2rrzpvr.js} +1 -1
  74. package/dist/client/static/js/one-dark-pro-09d8p5vy.js +1 -0
  75. package/dist/client/static/js/one-light-g3ednt6p.js +1 -0
  76. package/dist/client/static/js/{pegDiagram-GJSIUBJH-kd8t53tx.js → pegDiagram-GJSIUBJH-z7vb7f1z.js} +1 -1
  77. package/dist/client/static/js/{pieDiagram-5QR66LMP-h3x03f80.js → pieDiagram-5QR66LMP-jqv6v4e6.js} +1 -1
  78. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-y2b1ncbg.js → quadrantDiagram-O4NWA36T-w2h8yxrv.js} +1 -1
  79. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-x188rcxf.js → railroadDiagram-XR7U4H2S-nd09yac3.js} +1 -1
  80. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-g5e9fk17.js → requirementDiagram-PLB6GJNP-t61zxh5v.js} +1 -1
  81. package/dist/client/static/js/{rust-1v8xbxn9.js → rust-avnkhh0p.js} +1 -1
  82. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-y9ht91gf.js → sankeyDiagram-IPEJSGJF-2f7h2cmw.js} +1 -1
  83. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-pp8s63rt.js → sequenceDiagram-PO4LG4MO-kfb5d7zd.js} +1 -1
  84. package/dist/client/static/js/{sizeCapture-INFHLROL-k6dhfxex.js → sizeCapture-INFHLROL-amfg19se.js} +1 -1
  85. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-y3akpsm4.js → stateDiagram-v2-GCMORJYK-k5hx7btx.js} +1 -1
  86. package/dist/client/static/js/{swimlanes-2SLR337P-89081dr3.js → swimlanes-2SLR337P-wv3rp8kk.js} +1 -1
  87. package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-3q2a15wc.js → swimlanesDiagram-TC7HE7FX-6y8zdbm4.js} +1 -1
  88. package/dist/client/static/js/{timeline-definition-EJHVYXUP-tz6r8g3q.js → timeline-definition-EJHVYXUP-0re95wtn.js} +1 -1
  89. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-yq2y1b09.js → usecaseDiagram-POWQR4AR-yrje14qp.js} +1 -1
  90. package/dist/client/static/js/{vennDiagram-UO4OBE2U-qdmjf6x3.js → vennDiagram-UO4OBE2U-jxkmrfy5.js} +1 -1
  91. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-3n2sm7rj.js → wardleyDiagram-VNRHLVJA-d3v2m9b1.js} +1 -1
  92. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-d7n2av2t.js → xychartDiagram-PMCCYNJV-9a1s1rjt.js} +1 -1
  93. package/package.json +1 -1
  94. package/src/client/components/layout/desktop-layout/LeftColumn.tsx +2 -1
  95. package/src/client/components/layout/desktop-layout/RightColumn.test.tsx +204 -0
  96. package/src/client/components/layout/desktop-layout/RightColumn.tsx +37 -16
  97. package/src/client/components/mobile/RightSidebar.tsx +10 -8
  98. package/src/client/components/mobile/mobile-session-sidebar/use-drawer-tabs.ts +2 -1
  99. package/src/client/components/workspace/chat-timeline/MessageList.test.ts +11 -0
  100. package/src/client/components/workspace/chat-timeline/MessageList.tsx +29 -21
  101. package/src/client/hooks/chat/timeline/row-measure.ts +75 -0
  102. package/src/client/hooks/chat/timeline/row-window.test.ts +41 -21
  103. package/src/client/hooks/chat/timeline/row-window.ts +6 -24
  104. package/src/client/hooks/workspace/panel-tabs-reveal.test.tsx +20 -17
  105. package/src/client/hooks/workspace/panel-tabs-reveal.ts +29 -17
  106. package/src/client/hooks/workspace/panel-tabs.ts +3 -2
  107. package/src/client/hooks/workspace/session-state/index.test.tsx +145 -0
  108. package/src/client/hooks/workspace/session-state/index.ts +28 -16
  109. package/dist/client/static/js/flowDiagram-KWPJA3E3-7b4w6phx.js +0 -1
  110. package/dist/client/static/js/one-dark-pro-4b8er03c.js +0 -1
  111. package/dist/client/static/js/one-light-e6r3vsz4.js +0 -1
@@ -1,4 +1,4 @@
1
- import{d,en,n,o,i,u,a,ht,oe,Ot,ba,Gi,fA,e,s,yo,E,ne,De,Ua,yn,Mn,Tn,m,nn,Se,rn,L,_,Js,an,ya,vn,Zs,va,on,Ze,Cr,f,B,se,vo,ri,Wr,oi,re,Xe,Kr,fe,Be,Tt,We,Vt,xt,me,Fe,ja,ce,xo,ka,Vr,Jr,mn,sn,xa,li,Hi,wa,Zn,zn,ci,Br,Wi,P,Co,Ir,D,wt,U,Ba,Eo,mr,fr,Xn,$t,Ne,Zr,Ji,b,x,kA,Xi,Kp,dc,Vp,xA,gn,ui,tl,R,wA,it,hr,Te,bg,Xu,tr,CA,Dt,st,ue,lt,es,Z,Ct,Yt,xg,ge,il,He,be,sl,is,cn,zA,UA,tm,GA,jA,nm,qA,rm,am,_o,HA,WA,om,wg,im,J,Et,Qt,dt,Ka,mm,Cg,ZA,XA,eh,th,nh,rh,ah,bc,oh,ih,Eg,fi,sh,lh,fm,ss,ch,uh,yc,dh,gm,ph,mh,Am,fh,gh,Ah,hm,hh,vc,id,ea,kc,bm,To,Va,na,_a,ym,sd,vm,km,yh,vh,kh,Sg,xh,Tg,Dg,xm,Ke,tt,dl,wh,Ng,un,ls,Ya,xc,Cm,cs,Bt,No,Em,Qg,Eh,Rg,cd,Bm,Cc,Bh,ra,Ec,Bc,Ih,_h,Im,_m,Fg,Sm,Sh,Ic,_c,Tm,Sc,us,Dm,Ve,Tc,ds,Dc,ps,Ja,Nc,Qc,Rc,Nm}from"./index-amys498v.js";import{Ff}from"./index-gq5w5w8x.js";import{mt,Rd,Fd,Ld,fu,Md,Pd,Dl,hu,Is,Nl,Ei}from"./index-4bqssvt6.js";import{ia,Su,zs,Yg,Tu,Du}from"./index-16sd19f0.js";function Qo(t,r,l){let c={},p=typeof l==="function"?Object.keys(r):Object.keys(l);for(let g of p)if(r[g]!==t[g])c[g]=r[g];return c}var Zo="color";var er=["color","monochrome"];function gp(t){return t==="color"||t==="monochrome"}function nr(t){return gp(t)?t:"color"}var or={color:{label:"Full colour",description:"The shipped app icon, plate and all. Matches the icon in the Dock, the taskbar and the launcher.",caption:"App icon"},monochrome:{label:"Monochrome",description:"A greyscale conversion of the app icon: the green plate and the cream strokes swap luminance with the theme, and the orange arm becomes the middle grey.",caption:"Greyscale"}};var rr={theme:sl,editorFont:id,editorTheme:kc,autoSessionTitle:!0,commitMessageMode:"auto",commitMessageHarness:"",commitMessageModel:"",commitMessagePrompt:"",gitIdentities:[],soundAlerts:!0,chatCompletionSound:!0,notifyDesktopEnabled:!0,notifyMobileEnabled:!0,notifyOnFinish:!1,notifyOnAsk:!1,notifyOnError:!1,goalAuditEnabled:!0,goalAuditModel:"",goalDefaultBudget:null,chatWidthMode:mm,chatColumnWidth:ZA,toolRenderStyle:eh,showChangedFiles:!0,sidebarStyle:rh,leftPanelNav:Eg,rightPanelNav:Eg,mobileLeftPanelNav:fm,mobileRightPanelNav:fm,composerStyle:uh,surfaceStyle:ph,borderStyle:gh,iconStyle:GA,trayIconStyle:Zo,followUpBehavior:"queue",keybindingSend:"Enter",keybindingNewLine:"Shift + Enter",keybindingSteering:"Ctrl / Cmd + Enter"};function ir(){let[t,r]=n(!1),l=a(async()=>{r(!0);try{let c=await fetch("/api/omp/reload-engine",{method:"POST"}),p=await c.json().catch(()=>null);if(!c.ok||!p?.success)return{ok:!1,message:p?.error??`Reload failed (HTTP ${c.status})`};To(),na();let g=p.utility??0,h=p.prewarmed??0;return{ok:!0,message:g+h===0?"No standby omp processes were running — the next command starts the current build.":`Reloaded omp engine — ${g} utility, ${h} prewarmed process${g+h===1?"":"es"} recycled.`}}catch(c){return{ok:!1,message:c instanceof Error?c.message:"Failed to reload the omp engine."}}finally{r(!1)}},[]);return{isReloading:t,reload:l}}function ar(t={}){let{restart:r}=t,[l,c]=n(!1),p=a(async()=>{c(!0);try{let g=await sd(r),h=await fetch("/api/console/restart",{method:"POST"}),v=await h.json().catch(()=>null);if(!h.ok||!v?.success)return{ok:!1,message:v?.error??`Restart failed (HTTP ${h.status})`};if(!v.restarting)return{ok:!1,message:v.message??"This instance cannot be restarted from the console."};let y=await vm(g,r);if(y==="restarted")return window.location.reload(),{ok:!0,message:v.message??"Restarting — this page reloads on its own."};if(y==="timeout")return{ok:!1,message:`The server did not come back within ${Math.round((r?.timeoutMs??ym)/1000)} seconds — reload this page once it is up.`};return{ok:!1,message:"The restart was cancelled."}}catch(g){return{ok:!1,message:g instanceof Error?g.message:"Failed to restart Kabmo."}}finally{c(!1)}},[r]);return{isRestarting:l,restart:p}}function sr(t,r){if(typeof document<"u"&&r.theme)im(r.theme);if(typeof window<"u"&&r.editorFont!==t.editorFont)window.dispatchEvent(new CustomEvent(xm,{detail:r.editorFont}));if(typeof window<"u"&&r.editorTheme!==t.editorTheme)window.dispatchEvent(new CustomEvent(Rd,{detail:r.editorTheme}));if(r.chatWidthMode!==t.chatWidthMode)km(r.chatWidthMode,r.chatColumnWidth);if(r.toolRenderStyle!==t.toolRenderStyle)yh(r.toolRenderStyle);if(r.showChangedFiles!==t.showChangedFiles)vh(r.showChangedFiles);if(r.sidebarStyle!==t.sidebarStyle)kh(r.sidebarStyle);if(r.leftPanelNav!==t.leftPanelNav)Sg("left",r.leftPanelNav);if(r.rightPanelNav!==t.rightPanelNav)Sg("right",r.rightPanelNav);if(r.mobileLeftPanelNav!==t.mobileLeftPanelNav){if(Ff("left",r.mobileLeftPanelNav),r.mobileLeftPanelNav==="tabs")CA()}if(r.mobileRightPanelNav!==t.mobileRightPanelNav)Ff("right",r.mobileRightPanelNav);if(r.composerStyle!==t.composerStyle)xh(r.composerStyle);if(r.surfaceStyle!==t.surfaceStyle)Tg(r.surfaceStyle);if(r.borderStyle!==t.borderStyle)Dg(r.borderStyle);if(r.iconStyle!==t.iconStyle)wg(r.iconStyle)}var bp={name:"sliders-vertical",size:24,node:[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],aliases:["sliders"]},lr=s(bp);var fp={name:"square-check-big",size:24,node:[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],aliases:["check-square"]},dr=s(fp);var hp={name:"arrow-down-to-line",size:24,node:[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]},ot=s(hp);var vp={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]},cr=s(vp);var xp={name:"calendar-range",size:24,node:[["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M16 2v3",key:"otl347"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M17 13h-6",key:"1qbiup"}],["path",{d:"M13 17H7",key:"1x38vv"}],["path",{d:"M7 13h.01",key:"1vezk1"}],["path",{d:"M17 17h.01",key:"1sd3ek"}]]},pr=s(xp);var yp={name:"cloud",size:24,node:[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]},ur=s(yp);var kp={name:"compass",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]]},qt=s(kp);var wp={name:"dice-5",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 16h.01",key:"18s6g9"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]},gr=s(wp);var Sp={name:"dollar-sign",size:24,node:[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]},br=s(Sp);var Np={name:"file-diff",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]},vr=s(Np);var Pp={name:"folder-git",size:24,node:[["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M14 13h3",key:"1dgedf"}],["path",{d:"M7 13h3",key:"1pygq7"}]]},xr=s(Pp);var Cp={name:"folder-input",size:24,node:[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]},yr=s(Cp);var Tp={name:"hammer",size:24,node:[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]]},kr=s(Tp);var Ip={name:"image",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]},wr=s(Ip);var Ap={name:"key",size:24,node:[["path",{d:"m2 21 9.6-9.6",key:"9l79m3"}],["path",{d:"m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19",key:"fw8biw"}],["circle",{cx:"15.5",cy:"7.5",r:"5.5",key:"4wxmhb"}]]},yt=s(Ap);var Rp={name:"library",size:24,node:[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]},Sr=s(Rp);var Ep={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]},Jt=s(Ep);var Mp={name:"log-in",size:24,node:[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]},Nr=s(Mp);var Lp={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]},Xt=s(Lp);var Op={name:"pipette",size:24,node:[["path",{d:"m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12",key:"1y3wsu"}],["path",{d:"m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z",key:"110lr1"}],["path",{d:"m2 22 .414-.414",key:"jhxm08"}]]},Pr=s(Op);var Dp={name:"power",size:24,node:[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]},Tr=s(Dp);var Up={name:"store",size:24,node:[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]]},gt=s(Up);var $p={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]},Zt=s($p);var Fp={name:"volume-2",size:24,node:[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]},Wn=s(Fp);var jp={name:"volume-x",size:24,node:[["path",{d:"M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z",key:"1p7khw"}],["path",{d:"m16.5 14.5 5-5",key:"cul3yw"}],["path",{d:"m16.5 9.5 5 5",key:"1akey5"}]]},Ar=s(jp);var Bp={name:"waypoints",size:24,node:[["path",{d:"m10.586 5.414-5.172 5.172",key:"4mc350"}],["path",{d:"m18.586 13.414-5.172 5.172",key:"8c96vv"}],["path",{d:"M6 12h12",key:"8npq4p"}],["circle",{cx:"12",cy:"20",r:"2",key:"144qzu"}],["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}],["circle",{cx:"20",cy:"12",r:"2",key:"1xzzfp"}],["circle",{cx:"4",cy:"12",r:"2",key:"1hvhnz"}]]},qn=s(Bp);var Rr=["KABMO","CONNECT","WORKSPACE","OMP","HARNESSES"];var we="4rem",Er="calc(4rem + env(safe-area-inset-top, 0px))",xe="flex items-center flex-shrink-0 border-b border-ink/10";var Mr=[{id:"appearance",label:"Appearance",icon:wa,section:"KABMO",description:"Palette, shell layout, icons, and the code editor’s face, theme and behaviour."},{id:"chats",label:"Chats",icon:mn,section:"KABMO",description:"Chat width, composer style, tool call rendering, session titles, and goal mode."},{id:"keyboard",label:"Keyboard",icon:ka,section:"KABMO",description:"Every command shortcut, the composer Enter keys, and chord conflicts."},{id:"notifications",label:"Notifications",icon:va,section:"KABMO",description:"Completion sound, separate Desktop and Mobile delivery switches, and the finished, waiting-for-you and failed run triggers."},{id:"usage",label:"Usage",icon:yo,section:"KABMO",description:"Build minutes quota, storage, and general usage."},{id:"token-usage",label:"Token Usage",icon:oi,section:"KABMO",description:"Token telemetry, cache, and cost breakdown."},{id:"panel-plugins",label:"Plugins Kabmo",icon:Co,section:"KABMO",description:"Plugins installed into Kabmo: panels, background services, and the MCP servers they register."},{id:"connect",label:"Connect",icon:Ir,section:"CONNECT",description:"Tunnels, addresses, and the devices paired to this server."},{id:"projects",label:"Projects",icon:xr,section:"WORKSPACE",description:"Workspace directories, roots, and ignored paths."},{id:"git",label:"Git",icon:me,section:"WORKSPACE",description:"Commit message generation, the agent that writes it, and the prompt template."},{id:"omp",label:"OMP Engine",icon:Kr,section:"OMP",description:"Live agent state and native omp config keys."},{id:"providers",label:"Providers",icon:ur,section:"OMP",description:"AI model engines, endpoints, and credentials."},{id:"agents",label:"Agents",icon:Ze,section:"OMP",description:"Autonomous agent persona, self-healing, and reasoning."},{id:"behavior",label:"Behavior",icon:lr,section:"OMP",description:"Native AGENTS.md and RULES.md: global instructions, permission gates, and safety filters."},{id:"commands",label:"Commands",icon:Ne,section:"OMP",description:"Slash command macros and terminal shortcuts."},{id:"mcp",label:"MCP",icon:Cr,section:"OMP",description:"Model Context Protocol servers and dynamic tools."},{id:"plugins",label:"Plugins",icon:Wi,section:"OMP",description:"Installed omp plugins, marketplaces, features, and plugin settings."},{id:"skills",label:"Skills",icon:Sr,section:"OMP",description:"Manage downloaded skills and scripts."},{id:"skills-catalog",label:"Skills Catalog",icon:on,section:"OMP",description:"Browse and install new skills."},...Ng().map((t)=>({id:t.id,label:t.label,icon:qn,section:"HARNESSES",...t.harness?{harness:t.harness}:{},description:t.description}))];function Lr(t){let r=Ng(t&&t.length>0?t:void 0).map((c)=>({id:c.id,label:c.label,icon:qn,section:"HARNESSES",...c.harness?{harness:c.harness}:{},description:c.description}));return[...Mr.filter((c)=>c.section!=="HARNESSES"),...r]}function Vn({activeCategory:t,onSelectCategory:r,searchQuery:l,onSearchChange:c,onReloadOmp:p,isReloading:g,onRestartKabmo:h,isRestarting:v,disabledHarnesses:y=[],categories:w=Mr,className:k=""}){let C=w.filter((N)=>{if(N.harness&&y.includes(N.harness))return!1;if(!l.trim())return!0;let A=l.toLowerCase();return N.label.toLowerCase().includes(A)||N.section.toLowerCase().includes(A)||N.description.toLowerCase().includes(A)});return e("div",{className:`flex flex-col h-full bg-canvas border-r border-ink/10 text-ink select-none ${k}`,children:[e("div",{className:`${xe} px-3`,style:{height:we},children:e("div",{className:"relative flex w-full items-center",children:[e(U,{size:14,className:"absolute left-2.5 text-ink/40 pointer-events-none"}),e("input",{type:"text",placeholder:"Search settings",value:l,onChange:(N)=>c(N.currentTarget.value),className:"w-full bg-paper border border-ink/15 rounded-lg pl-8 pr-7 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors"}),l&&e("button",{type:"button",onClick:()=>c(""),className:"absolute right-2 text-ink/40 hover:text-ink p-0.5",children:e(b,{size:12})})]})}),e("div",{className:"flex-1 scrollbar-overlay-container p-2 space-y-4",children:C.length===0?e("div",{className:"text-center py-8 text-xs text-ink/50 italic",children:"No matching settings found"}):Rr.map((N)=>{let A=C.filter((T)=>T.section===N);if(A.length===0)return null;return e("div",{className:"space-y-1",children:[e("div",{className:"px-2.5 py-1 text-[10px] font-bold text-ink/40 tracking-wider font-mono uppercase",children:N}),e("div",{className:"space-y-0.5",children:A.map((T)=>{let F=T.icon,S=t===T.id;return e("button",{type:"button",onClick:()=>r(T.id),className:`w-full flex items-center justify-between px-2.5 py-1.5 rounded-lg text-xs transition-all text-left ${S?"bg-ink/10 font-semibold text-ink shadow-2xs":"text-ink/75 hover:bg-ink/5 hover:text-ink"}`,children:[e("div",{className:"flex items-center space-x-2.5 truncate",children:[T.harness?e("span",{className:"flex w-[14px] shrink-0 items-center justify-center",children:e(Ke,{harness:T.harness,size:14})}):e(F,{size:14,className:S?"text-ink":"text-ink/60"}),e("span",{className:"truncate",children:T.label})]}),T.badge&&e("span",{className:"px-1.5 py-0.2 text-[10px] font-mono font-medium rounded border border-warning/30 bg-warning/15 text-warning",children:T.badge})]},T.id)})})]},N)})}),e("div",{className:"p-2 border-t border-ink/10 flex-shrink-0 bg-canvas flex items-center gap-0.5",children:[e("button",{type:"button",onClick:p,disabled:g||v,title:"Recycle the standby omp processes so the next command uses the installed binary","aria-label":"Reload OMP",className:"shrink-0 flex items-center space-x-1 px-1 py-1.5 text-[11px] text-ink/75 hover:text-ink hover:bg-ink/5 rounded-lg transition-colors font-medium cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed",children:[e(D,{size:12,className:`shrink-0 ${g?"animate-spin text-warning":"text-ink/60"}`}),e("span",{className:"whitespace-nowrap",children:g?"Reloading…":"Reload OMP"})]}),e("button",{type:"button",onClick:h,disabled:g||v,title:"Stop and start this Kabmo instance","aria-label":"Restart Kabmo",className:"flex-1 min-w-0 flex items-center space-x-1 px-1 py-1.5 text-[11px] text-ink/75 hover:text-ink hover:bg-ink/5 rounded-lg transition-colors font-medium cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed",children:[e(Tr,{size:12,className:`shrink-0 ${v?"animate-pulse text-warning":"text-ink/60"}`}),e("span",{className:"truncate",children:v?"Restarting…":"Restart Kabmo"})]})]})]})}function Pe(){let[t,r]=n("list"),l=a(()=>r("detail"),[]),c=a(()=>r("list"),[]);return{pane:t,openDetail:l,back:c}}var Or=en(null);function Dr({register:t,children:r}){return e(Or.Provider,{value:t,children:r})}function Ur(t){let r=ht(Or),l=t?.label,c=t?.description,p=t?.back,g=t?.backLabel;o(()=>{if(!r)return;if(!l||!p||!g){r(null);return}return r({label:l,description:c,back:p,backLabel:g}),()=>r(null)},[r,l,c,p,g])}function $r(){let[t,r]=n(null);return{register:u(()=>(c)=>r((p)=>{if(c===null)return p===null?p:null;if(p&&p.label===c.label&&p.description===c.description&&p.back===c.back&&p.backLabel===c.backLabel)return p;return c}),[]),drill:t}}function Ce({pane:t,onBack:r,list:l,detail:c,listLabel:p,detailLabel:g,detailDescription:h,className:v=""}){return Ur(t==="detail"?{label:g??p,description:h,back:r,backLabel:`Back to ${p}`}:null),e("div",{className:`flex-1 flex flex-col md:flex-row h-full w-full min-w-0 overflow-hidden bg-paper text-ink ${v}`,children:[e("div",{className:`${t==="list"?"flex":"hidden"} md:flex flex-1 md:flex-none md:w-auto min-h-0 min-w-0 flex-col`,children:l}),e("div",{className:`${t==="detail"?"flex":"hidden"} md:flex flex-1 min-h-0 min-w-0 flex-col`,children:c})]})}function tn({groups:t,activeGroupId:r,onSelectGroup:l}){return e("div",{className:"w-full md:w-64 md:border-r border-ink/10 h-full flex flex-col bg-paper/50 flex-shrink-0 select-none",children:[e("div",{className:`${xe} hidden md:flex px-3.5 justify-between`,style:{height:we},children:e("span",{className:"text-xs font-semibold text-ink",children:[t.length," group",t.length===1?"":"s"]})}),e("div",{className:"flex-1 scrollbar-overlay-container p-1.5 text-xs",children:e("div",{className:"space-y-0.5",children:t.map((c)=>{let p=c.id===r,g=c.icon;return e("button",{type:"button",onClick:()=>l(c.id),"aria-current":p?"true":void 0,"aria-label":`${c.label}: ${c.hint}`,className:`w-full text-left px-2.5 py-2 rounded-lg transition-colors cursor-pointer flex flex-col gap-0.5 ${p?"bg-ink/10 text-ink font-medium shadow-2xs":"text-ink/80 hover:bg-ink/5 hover:text-ink"}`,children:[e("span",{className:"flex items-center gap-1.5 min-w-0",children:[e("span",{"aria-hidden":!0,className:`w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0 ${p?"bg-ink/10 text-ink":"bg-ink/5 text-ink/70"}`,children:e(g,{size:12})}),e("span",{className:"font-semibold text-xs text-ink truncate",children:c.label})]}),e("span",{className:"text-[11px] text-ink/60 line-clamp-1 leading-snug pl-[26px]",children:c.hint})]},c.id)})})})]})}function ln({group:t,children:r}){return e("div",{className:"flex-1 h-full overflow-hidden flex flex-col text-xs text-ink",children:[e("div",{className:`${xe} hidden md:flex items-start flex-col justify-center px-3.5`,style:{height:we},children:[e("span",{className:"text-xs font-semibold text-ink/75",children:t.label}),e("p",{className:"w-full text-[11px] text-ink/60 leading-snug mt-0.5 truncate",children:t.description})]}),e("div",{className:"flex-1 overflow-y-auto scrollbar-overlay-container p-3.5 space-y-7 pb-6",children:r})]})}var Mt=[{id:"palette",label:"Palette",hint:"The console’s colours",description:"The palette every surface, row and dialog is painted from.",icon:wa,sections:["theme"]},{id:"shell",label:"Shell",hint:"Sidebar, panels, material, rules, icons",description:"The shape of the console around the conversation: the session sidebar, how each desktop panel column is navigated, what the windows are made of, whether the hairlines are drawn, and how glyphs and marks are painted.",icon:nn,sections:["sidebar","panel-nav","surface","border","icons","tray"]},{id:"editor",label:"Editor",hint:"Typeface and colour theme",description:"The code editor’s own two axes, independent of the console palette: the face it is set in, and the TextMate theme it paints with.",icon:yn,sections:["editor-font","editor-theme"]},{id:"editor-behaviour",label:"Editor behaviour",hint:"Indentation, typing, line blame",description:"What the editor does as you type, rather than how it looks. Each one reaches an editor that is already open without a reload.",icon:Ba,sections:["editor-indent","editor-typing","editor-blame"]}];function Fr({theme:t,selected:r,onSelect:l}){return e("button",{type:"button",onClick:()=>l(t.id),"aria-pressed":r,className:`group flex w-full flex-col gap-2.5 rounded-lg border p-2.5 text-left transition-all cursor-pointer ${r?"border-ink bg-ink/5 ring-1 ring-ink/20":"border-ink/20 bg-paper hover:border-ink/40 hover:bg-ink/5"}`,children:[e("div",{className:"flex items-center gap-2",children:[e("span",{className:"truncate font-semibold text-ink",title:t.name,children:t.name}),e("span",{className:"shrink-0 rounded-full border border-ink/15 px-1.5 py-px text-[10px] font-semibold uppercase tracking-wider text-ink/50",children:t.variant}),r&&e(f,{size:14,className:"ml-auto shrink-0 text-ink"})]}),e("div",{className:"flex items-center gap-1",children:UA.map((c)=>e("span",{title:`${c.label} · ${t[c.key]}`,style:{backgroundColor:t[c.key]},className:"h-5 flex-1 rounded-[3px] border border-ink/10"},c.key))})]})}var _p=[{id:"all",label:"All"},{id:"light",label:"Light"},{id:"dark",label:"Dark"}];function Hp(t){return t==="all"?is:is.filter((r)=>r.variant===t)}function jr({selectedId:t,onSelect:r}){let[l,c]=n("all"),p=u(()=>Hp(l),[l]);return e("div",{className:"space-y-3 pb-6",children:[e("div",{className:"flex items-center gap-1.5",children:[_p.map((g)=>e("button",{type:"button",onClick:()=>c(g.id),className:`rounded-full border px-2.5 py-1 text-[11px] font-medium transition-colors cursor-pointer ${l===g.id?"border-ink bg-ink text-paper":"border-ink/20 bg-paper text-ink/70 hover:border-ink/40 hover:text-ink"}`,children:[g.id==="light"&&e(Zt,{size:11,className:"mr-1 inline align-[-1px]"}),g.id==="dark"&&e(Xt,{size:11,className:"mr-1 inline align-[-1px]"}),g.label]},g.id)),e("span",{className:"ml-auto font-mono text-[11px] text-ink/50",children:[p.length," themes"]})]}),e("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2 lg:grid-cols-3",children:p.map((g)=>e(Fr,{theme:g,selected:g.id===t,onSelect:r},g.id))})]})}function _r({settings:t,onUpdate:r}){return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Console palette"}),e("p",{className:"mt-0.5 text-[11px] text-ink/60",children:"The colours every surface, row and dialog is painted from. The code editor has its own theme, in the Editor group."})]}),e(jr,{selectedId:t.theme,onSelect:(l)=>r({theme:zA(l)})})]})}function bt({width:t,active:r=!1,trailing:l=!1}){return e("span",{className:"flex h-[9px] items-center gap-1 px-1",children:[e("span",{className:`h-[5px] w-[5px] shrink-0 rounded-full ${r?"bg-ink":"bg-ink/25"}`}),e("span",{className:`h-[3px] rounded-full ${r?"bg-ink/70":"bg-ink/25"}`,style:{width:`${t}%`}}),l&&e("span",{className:"ml-auto h-[3px] w-[6px] rounded-full bg-ink/20"})]})}function zp(){return e("span",{className:"flex h-full flex-col gap-1 rounded-md border border-ink/10 bg-paper p-1","aria-hidden":"true",children:[e("span",{className:"flex items-center gap-0.5",children:[e("span",{className:"h-[7px] w-[30%] rounded-sm bg-ink/80"}),e("span",{className:"h-[7px] w-[7px] rounded-sm border border-ink/20 bg-paper"}),e("span",{className:"h-[7px] w-[7px] rounded-sm border border-ink/20 bg-paper"}),e("span",{className:"ml-auto h-[7px] w-[7px] rounded-sm border border-ink/20 bg-paper"}),e("span",{className:"h-[7px] w-[7px] rounded-sm border border-ink/20 bg-paper"})]}),e("span",{className:"flex h-[7px] items-center gap-1 px-1",children:e("span",{className:"h-[3px] w-[45%] rounded-full bg-ink/45"})}),e(bt,{width:62,trailing:!0}),e(bt,{width:50,active:!0,trailing:!0}),e(bt,{width:44,trailing:!0}),e(bt,{width:56,trailing:!0})]})}function Gp(){return e("span",{className:"flex h-full flex-col gap-1 rounded-md border border-ink/10 bg-paper p-1","aria-hidden":"true",children:[e("span",{className:"flex h-[7px] items-center rounded-sm bg-ink/5 px-1",children:e("span",{className:"h-[3px] w-[38%] rounded-full bg-ink/30"})}),e("span",{className:"flex items-center gap-0.5",children:[e("span",{className:"h-[6px] w-[16%] rounded-full bg-ink/80"}),e("span",{className:"h-[6px] w-[22%] rounded-full border border-ink/20"}),e("span",{className:"h-[6px] w-[12%] rounded-full border border-ink/20"})]}),e("span",{className:"flex h-[9px] items-center gap-1 px-1",children:[e("span",{className:"h-[5px] w-[5px] shrink-0 rounded-full bg-ink/50"}),e("span",{className:"h-[3px] w-[40%] rounded-full bg-ink/45"}),e("span",{className:"ml-auto h-[3px] w-[5px] rounded-full bg-ink/20"})]}),e(bt,{width:62,active:!0,trailing:!0}),e(bt,{width:50,trailing:!0}),e(bt,{width:44,trailing:!0})]})}var Wp={classic:zp,modern:Gp};function Hr({settings:t,onUpdate:r}){let l=bc(t.sidebarStyle);return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Session sidebar"}),e("p",{className:"mt-0.5 text-[11px] text-ink/60",children:"How the left column draws its workspaces and chats. Both styles list the same workspaces and offer the same actions; the choice applies to desktop and phone, and takes effect immediately."})]}),e("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",role:"group","aria-label":"Session sidebar style",children:ah.map((c)=>{let p=oh[c],g=c===l,h=Wp[c];return e("button",{type:"button",onClick:()=>r({sidebarStyle:c}),"aria-pressed":g,"aria-label":`${p.label} sidebar — ${p.description}`,className:`flex flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors cursor-pointer ${g?"border-ink/40 bg-ink/5":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5"}`,children:[e("span",{className:"block h-[86px]",children:e(h,{})}),e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:"text-xs font-semibold text-ink",children:p.label}),e("span",{className:"font-mono text-[10px] text-ink/40",children:p.caption}),g&&e("span",{className:"ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[10px] font-semibold text-paper",children:"active"})]}),e("span",{className:"text-[11px] leading-relaxed text-ink/60",children:p.description})]},c)})})]})}function zr(){return e("span",{className:"flex h-full gap-1 rounded-md border border-ink/10 bg-paper p-1","aria-hidden":"true",children:[e("span",{className:"flex w-[9px] flex-col items-center gap-1 border-r border-ink/10 pr-1",children:[e("span",{className:"h-[5px] w-[5px] rounded-sm bg-ink/70"}),e("span",{className:"h-[5px] w-[5px] rounded-sm bg-ink/25"}),e("span",{className:"h-[5px] w-[5px] rounded-sm bg-ink/25"})]}),e("span",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[e("span",{className:"h-[3px] w-[46%] rounded-full bg-ink/45"}),e("span",{className:"h-[3px] w-[62%] rounded-full bg-ink/25"}),e("span",{className:"h-[3px] w-[54%] rounded-full bg-ink/25"}),e("span",{className:"h-[3px] w-[40%] rounded-full bg-ink/20"})]})]})}function Gr(){return e("span",{className:"flex h-full flex-col gap-1 rounded-md border border-ink/10 bg-paper p-1","aria-hidden":"true",children:[e("span",{className:"flex items-center gap-1 border-b border-ink/10 pb-1",children:[e("span",{className:"h-[6px] w-[6px] rounded-sm border border-ink/20"}),e("span",{className:"h-[6px] w-[28%] rounded-sm bg-ink/70"}),e("span",{className:"h-[6px] w-[24%] rounded-sm border border-ink/20"})]}),e("span",{className:"flex gap-1",children:[e("span",{className:"h-[16px] w-[22%] rounded border border-ink/15"}),e("span",{className:"h-[16px] w-[22%] rounded border border-ink/15"}),e("span",{className:"h-[16px] w-[22%] rounded border border-ink/15"})]})]})}function qr(){return e("span",{className:"flex h-full flex-col gap-1 rounded-md border border-ink/10 bg-paper p-1","aria-hidden":"true",children:[e("span",{className:"flex h-[7px] items-center gap-1 border-b border-ink/10 pb-1",children:[e("span",{className:"h-[6px] w-[16%] rounded-sm bg-ink/70"}),e("span",{className:"h-[6px] w-[16%] rounded-sm border border-ink/20"}),e("span",{className:"h-[6px] w-[16%] rounded-sm border border-ink/20"}),e("span",{className:"h-[6px] w-[16%] rounded-sm border border-ink/20"})]}),e("span",{className:"h-[3px] w-[62%] rounded-full bg-ink/25"}),e("span",{className:"h-[3px] w-[54%] rounded-full bg-ink/25"}),e("span",{className:"h-[3px] w-[40%] rounded-full bg-ink/20"})]})}function Yr({pinned:t=!1}){return e("span",{className:"flex h-full flex-col gap-1 rounded-md border border-ink/10 bg-paper p-1","aria-hidden":"true",children:[e("span",{className:"flex h-[7px] items-center gap-1 border-b border-ink/10 pb-1",children:[e("span",{className:"h-[6px] w-[6px] rounded-sm border border-ink/20"}),t?e("span",{className:"h-[6px] w-[20%] rounded-sm bg-ink/70"}):null,e("span",{className:`h-[6px] rounded-sm ${t?"w-[18%]":"w-[24%]"} bg-ink/70`}),e("span",{className:"h-[6px] w-[20%] rounded-sm border border-ink/20"})]}),e("span",{className:"flex gap-1",children:[e("span",{className:"h-[16px] w-[24%] rounded border border-ink/15"}),e("span",{className:"h-[16px] w-[24%] rounded border border-ink/15"}),e("span",{className:"h-[16px] w-[24%] rounded border border-ink/15"})]})]})}function qp(t){return t==="rail"?e(zr,{}):e(Gr,{})}var Yp={classic:{label:"Classic",description:"The strip lists every view; tapping one swaps the drawer body.",caption:"All views · one tap"},tabs:{label:"Tabs",description:"The strip holds only the views you opened, over a home page that lists them all. The drawer reopens where you left it.",caption:"Opened views · home page"}},Jp={classic:{label:"Classic",description:"The strip lists every view the left dock holds; tapping one swaps the drawer body.",caption:"All views · one tap"},tabs:{label:"Tabs",description:"The strip holds the views you opened, with Sessions pinned first, over a home page that lists the rest. The drawer reopens where you left it.",caption:"Opened views · Sessions pinned"}};function Xr({styles:t,copy:r,miniature:l,current:c,onPick:p,label:g}){return e("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",role:"group","aria-label":g,children:t.map((h)=>{let v=r[h],y=h===c;return e("button",{type:"button",onClick:()=>p(h),"aria-pressed":y,"aria-label":`${v.label} — ${v.description}`,className:`flex cursor-pointer flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors ${y?"border-ink/40 bg-ink/5":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5"}`,children:[e("span",{className:"block h-[54px]",children:l(h)}),e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:"text-xs font-semibold text-ink",children:v.label}),e("span",{className:"font-mono text-[10px] text-ink/40",children:v.caption}),y&&e("span",{className:"ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[10px] font-semibold text-paper",children:"active"})]}),e("span",{className:"text-[11px] leading-relaxed text-ink/60",children:v.description})]},h)})})}function Yn({current:t,onPick:r}){return e(Xr,{styles:ih,copy:sh,miniature:qp,current:t,onPick:r,label:"Panel navigation"})}function Jn({side:t,current:r,onPick:l}){let c=t==="left";return e(Xr,{styles:lh,copy:c?Jp:Yp,miniature:(p)=>p==="classic"?e(qr,{}):e(Yr,{pinned:c}),current:r,onPick:l,label:c?"Phone left drawer":"Phone right drawer"})}function Qr({settings:t,onUpdate:r}){return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Panel navigation"}),e("p",{className:"mt-0.5 text-[11px] text-ink/60",children:"How each panel surface is navigated. Everything is chosen independently: the desktop columns do not set each other, and each phone drawer has its own answer."})]}),e("div",{className:"space-y-2",children:[e("div",{children:[e("h5",{className:"text-[11px] font-semibold text-ink/70",children:"Left column"}),e("div",{className:"mt-1.5",children:e(Yn,{current:fi(t.leftPanelNav),onPick:(l)=>r({leftPanelNav:l})})})]}),e("div",{children:[e("h5",{className:"text-[11px] font-semibold text-ink/70",children:"Right column"}),e("div",{className:"mt-1.5",children:e(Yn,{current:fi(t.rightPanelNav),onPick:(l)=>r({rightPanelNav:l})})})]}),e("div",{children:[e("h5",{className:"text-[11px] font-semibold text-ink/70",children:"Phone · left drawer"}),e("p",{className:"mt-0.5 text-[11px] text-ink/50",children:"The drawer is one screen, so it has no rail to put beside it. This chooses what its strip lists instead. Under Tabs the session list stays the first, pinned chip."}),e("div",{className:"mt-1.5",children:e(Jn,{side:"left",current:ss(t.mobileLeftPanelNav),onPick:(l)=>r({mobileLeftPanelNav:l})})})]}),e("div",{children:[e("h5",{className:"text-[11px] font-semibold text-ink/70",children:"Phone · right drawer"}),e("p",{className:"mt-0.5 text-[11px] text-ink/50",children:"A drawer is one screen, so it has no rail to put beside it. This chooses what its strip lists instead."}),e("div",{className:"mt-1.5",children:e(Jn,{side:"right",current:ss(t.mobileRightPanelNav),onPick:(l)=>r({mobileRightPanelNav:l})})})]})]})]})}function ei({backdropFilter:t,reducedTransparency:r}){let l=[];if(!t)l.push("no-backdrop-filter");if(r)l.push("reduced-transparency");return l}var ti={"no-backdrop-filter":"This engine reports no backdrop blur, so the frost falls back to opaque panels here — the window keeps the glass colours but loses the blur.","reduced-transparency":"Your system asks apps to reduce transparency, so the frost is switched off. Turn that system setting off to see the glass material."};var ni="(prefers-reduced-transparency: reduce)";function Xp(){if(typeof CSS>"u"||typeof CSS.supports!=="function")return!1;return CSS.supports("backdrop-filter","blur(1px)")||CSS.supports("-webkit-backdrop-filter","blur(1px)")}function ii(){let[t,r]=n(()=>typeof window>"u"?!1:window.matchMedia(ni).matches);return o(()=>{let l=window.matchMedia(ni),c=()=>r(l.matches);return c(),l.addEventListener("change",c),()=>l.removeEventListener("change",c)},[]),ei({backdropFilter:Xp(),reducedTransparency:t})}function ai(){return e("span",{className:"flex h-full flex-col gap-1 p-1",children:[e("span",{className:"flex items-center gap-1",children:[e("span",{className:"h-[3px] w-[38%] rounded-full bg-ink/40"}),e("span",{className:"ml-auto h-[6px] w-[10%] rounded-[2px] border border-ink/20"})]}),e("span",{className:"h-[2px] w-full rounded-full bg-ink/15"}),e("span",{className:"flex items-center gap-1",children:[e("span",{className:"h-[3px] w-[52%] rounded-full bg-ink/30"}),e("span",{className:"h-[3px] w-[18%] rounded-full bg-ink/15"})]}),e("span",{className:"flex items-center gap-1",children:[e("span",{className:"h-[3px] w-[44%] rounded-full bg-ink/30"}),e("span",{className:"h-[3px] w-[22%] rounded-full bg-ink/15"})]})]})}function Qp(){return e("span",{className:"block h-full rounded-md border border-ink/15 bg-paper","aria-hidden":"true",children:[e("span",{className:"block h-[13px] rounded-t-[5px] border-b border-ink/10 bg-paper",children:e("span",{className:"mx-1 mt-[4px] block h-[3px] w-[40%] rounded-full bg-ink/35"})}),e(ai,{})]})}function Zp(){return e("span",{className:"relative block h-full overflow-hidden rounded-md border border-ink/15 bg-canvas","aria-hidden":"true",children:[e("span",{className:"pointer-events-none absolute inset-0",children:[e("span",{className:"absolute -left-2 top-2 h-[70%] w-[55%] rounded-full bg-info/40 blur-md"}),e("span",{className:"absolute -right-2 -top-2 h-[60%] w-[50%] rounded-full bg-meta/35 blur-md"}),e("span",{className:"absolute -bottom-2 right-3 h-[45%] w-[45%] rounded-full bg-success/30 blur-md"})]}),e("span",{className:"relative block h-[13px] border-b border-ink/10 bg-paper/40",children:e("span",{className:"mx-1 mt-[4px] block h-[3px] w-[40%] rounded-full bg-ink/40"})}),e("span",{className:"relative block h-[calc(100%-13px)] bg-paper/50",children:e(ai,{})})]})}var eu={classic:Qp,glass:Zp};function tu(){let t=ii();if(t.length===0)return null;return e("ul",{className:"space-y-1 rounded-lg border border-ink/15 bg-ink/[0.03] p-2.5","aria-live":"polite",children:t.map((r)=>e("li",{className:"flex gap-1.5 text-[11px] leading-relaxed text-ink/60",children:[e("span",{"aria-hidden":"true",className:"mt-[5px] h-1 w-1 shrink-0 rounded-full bg-ink/40"}),e("span",{children:ti[r]})]},r))})}function si({settings:t,onUpdate:r}){let l=Am(t.surfaceStyle);return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Surfaces"}),e("p",{className:"mt-0.5 text-[11px] text-ink/60",children:"What the windows are made of. Both styles draw the same panels, rows and dialogs; the frost is one blur pass per window, and it follows the palette — there is no separate glass colour to tune."})]}),e("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",role:"group","aria-label":"Surface style",children:mh.map((c)=>{let p=fh[c],g=c===l,h=eu[c];return e("button",{type:"button",onClick:()=>r({surfaceStyle:c}),"aria-pressed":g,"aria-label":`${p.label} surfaces — ${p.description}`,className:`flex flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors cursor-pointer ${g?"border-ink/40 bg-ink/5":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5"}`,children:[e("span",{className:"block h-[78px]",children:e(h,{})}),e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:"text-xs font-semibold text-ink",children:p.label}),e("span",{className:"font-mono text-[10px] text-ink/40",children:p.caption}),g&&e("span",{className:"ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[10px] font-semibold text-paper",children:"active"})]}),e("span",{className:"text-[11px] leading-relaxed text-ink/60",children:p.description})]},c)})}),l==="glass"&&e(tu,{})]})}function nu({ruled:t}){let r=t?"border-b border-ink/10":"";return e("span",{className:"flex h-full flex-col",children:[0,1,2].map((l)=>e("span",{className:`flex items-center gap-1 px-1 py-[3px] ${r}`,children:[e("span",{className:"h-[3px] w-[26%] rounded-full bg-ink/35"}),e("span",{className:"h-[3px] w-[14%] rounded-full bg-ink/15"})]},l))})}function di({ruled:t}){return e("span",{className:"flex h-full overflow-hidden rounded-md border border-ink/15 bg-paper","aria-hidden":"true",children:[e("span",{className:`flex w-[34%] flex-col gap-1 p-1 ${t?"border-r border-ink/10":""}`,children:[e("span",{className:"h-[3px] w-[70%] rounded-full bg-ink/35"}),e("span",{className:"h-[3px] w-[52%] rounded-full bg-ink/20"}),e("span",{className:"h-[3px] w-[62%] rounded-full bg-ink/20"})]}),e("span",{className:"flex min-w-0 flex-1 flex-col",children:[e("span",{className:`flex h-[12px] flex-shrink-0 items-center px-1 ${t?"border-b border-ink/10":""}`,children:e("span",{className:"h-[3px] w-[40%] rounded-full bg-ink/30"})}),e(nu,{ruled:t})]})]})}var ou={hairline:()=>e(di,{ruled:!0}),borderless:()=>e(di,{ruled:!1})};function pi({settings:t,onUpdate:r}){let l=hm(t.borderStyle);return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Rules"}),e("p",{className:"mt-0.5 text-[11px] text-ink/60",children:"Whether the 1px rules between panels, columns and rows are painted. Controls keep their edge either way, and so do validation colours, drop zones and the focus ring."})]}),e("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",role:"group","aria-label":"Border style",children:Ah.map((c)=>{let p=hh[c],g=c===l,h=ou[c];return e("button",{type:"button",onClick:()=>r({borderStyle:c}),"aria-pressed":g,"aria-label":`${p.label} rules — ${p.description}`,className:`flex flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors cursor-pointer ${g?"border-ink/40 bg-ink/5":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5"}`,children:[e("span",{className:"block h-[62px]",children:e(h,{})}),e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:"text-xs font-semibold text-ink",children:p.label}),e("span",{className:"font-mono text-[10px] text-ink/40",children:p.caption}),g&&e("span",{className:"ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[10px] font-semibold text-paper",children:"active"})]}),e("span",{className:"text-[11px] leading-relaxed text-ink/60",children:p.description})]},c)})})]})}function ru(t){return cn(t).paper}function Qn({name:t,Icon:r,colored:l,paper:c}){let p=HA(t),g=!l?void 0:p?am[p]:_o(WA(t),"light",c);return e(r,{size:13,strokeWidth:2,style:g?{color:g}:void 0,"aria-hidden":"true"})}function mi({name:t,base:r,colored:l}){let c=l?r:void 0;return e("span",{className:"flex h-5 w-5 items-center justify-center rounded-[5px] border border-ink/10",style:c?{backgroundColor:`${c}22`,color:c}:void 0,title:t,"aria-hidden":"true",children:e("span",{className:`block h-2 w-2 rounded-full ${l?"":"bg-ink/60"}`,style:c?{backgroundColor:c}:void 0})})}function gi({colored:t,paper:r}){return e("span",{className:"flex h-full items-center gap-1.5 rounded-md border border-ink/10 bg-canvas/60 px-2",children:[e(Qn,{name:"Trash2",Icon:L,colored:t,paper:r}),e(Qn,{name:"Check",Icon:f,colored:t,paper:r}),e(Qn,{name:"Sparkles",Icon:Se,colored:t,paper:r}),e("span",{className:"mx-0.5 h-4 w-px bg-ink/10"}),e(mi,{name:"claude",base:rm.claude.light,colored:t}),e(mi,{name:"Typescript",base:om.Typescript.light,colored:t})]})}function bi({settings:t,onUpdate:r}){let l=nm(t.iconStyle),c=ru(t.theme),p={monochrome:()=>e(gi,{colored:!1,paper:c}),color:()=>e(gi,{colored:!0,paper:c})};return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Icons"}),e("p",{className:"mt-0.5 text-[11px] text-ink/60",children:"Every icon: toolbar and panel glyphs, provider logos and file-type marks. Full colour gives each glyph its own hue and keeps the palette’s red, green, amber and blue for signals; a colour that would disappear on the active theme falls back to the ink. A control that sets its own colour keeps it."})]}),e("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",role:"group","aria-label":"Icon style",children:jA.map((g)=>{let h=qA[g],v=g===l,y=p[g];return e("button",{type:"button",onClick:()=>r({iconStyle:g}),"aria-pressed":v,"aria-label":`${h.label} icons — ${h.description}`,className:`flex flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors cursor-pointer ${v?"border-ink/40 bg-ink/5":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5"}`,children:[e("span",{className:"block h-[42px]",children:e(y,{})}),e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:"text-xs font-semibold text-ink",children:h.label}),e("span",{className:"font-mono text-[10px] text-ink/40",children:h.caption}),v&&e("span",{className:"ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[10px] font-semibold text-paper",children:"active"})]}),e("span",{className:"text-[11px] leading-relaxed text-ink/60",children:h.description})]},g)})})]})}function iu(){return e("span",{className:"flex h-full items-center justify-center rounded-md border border-ink/10 bg-canvas/60",children:e("img",{src:"/icon.svg",alt:"",width:26,height:26,className:"rounded-[6px]","aria-hidden":"true"})})}function au({variant:t}){return e("span",{className:"flex h-full items-center justify-center rounded-md border border-ink/10 bg-canvas/60",children:e("img",{src:`/tray-monochrome-${t}.png`,alt:"",width:26,height:26,"aria-hidden":"true"})})}function hi({settings:t,onUpdate:r}){let l=nr(t.trayIconStyle),c=cn(t.theme).variant,p={color:iu,monochrome:()=>e(au,{variant:c})};return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Tray icon"}),e("p",{className:"mt-0.5 text-[11px] text-ink/60",children:"The menu-bar (macOS) or notification-area (Windows, Linux) icon. Full colour is the shipped app icon, orange arm and all; monochrome is a greyscale conversion: the green plate and the cream strokes swap luminance with the theme, and the orange arm becomes the middle grey. Applies the next time the tray starts, or immediately when it is already running."})]}),e("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",role:"group","aria-label":"Tray icon style",children:er.map((g)=>{let h=or[g],v=g===l,y=p[g];return e("button",{type:"button",onClick:()=>r({trayIconStyle:g}),"aria-pressed":v,"aria-label":`${h.label} tray icon — ${h.description}`,className:`flex flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors cursor-pointer ${v?"border-ink/40 bg-ink/5":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5"}`,children:[e("span",{className:"block h-[42px]",children:e(y,{})}),e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:"text-xs font-semibold text-ink",children:h.label}),e("span",{className:"font-mono text-[10px] text-ink/40",children:h.caption}),v&&e("span",{className:"ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[10px] font-semibold text-paper",children:"active"})]}),e("span",{className:"text-[11px] leading-relaxed text-ink/60",children:h.description})]},g)})})]})}function vi({settings:t,onUpdate:r}){let l=t.editorFont||vc[0].id;return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"flex items-center gap-2 text-sm font-semibold text-ink",children:[e(Zr,{size:15,className:"text-ink/60"}),"Editor font"]}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"Typeface for the code editor and its line numbers, in both the desktop panel and the phone's full-screen editor. Only Fira Code ships with the app; the others are used when your device has them, and fall back to Fira Code when it does not."})]}),e("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:vc.map((c)=>{let p=l===c.id;return e("button",{type:"button",onClick:()=>r({editorFont:c.id}),"aria-pressed":p,className:`flex items-center justify-between gap-3 rounded-lg border px-3 py-2 text-left transition-colors ${p?"border-ink/40 bg-ink/5":"border-ink/12 hover:bg-ink/5"}`,children:[e("span",{className:"min-w-0",children:[e("span",{className:"block truncate text-xs text-ink",style:{fontFamily:`"${c.id}", monospace`},children:"const greet = () => 'hi'"}),e("span",{className:"mt-0.5 flex items-center gap-1.5 text-[10px] text-ink/50",children:[e("span",{children:c.label}),c.bundled&&e("span",{className:"rounded bg-ink/8 px-1 py-px text-[10px] uppercase tracking-wide",children:"Bundled"})]})]}),p&&e(f,{size:14,className:"text-ink flex-shrink-0"})]},c.id)})})]})}var su=[{id:"all",label:"All"},{id:"light",label:"Light"},{id:"dark",label:"Dark"}];function lu(t){return`"${vc.find((l)=>l.id===t)?.id??vc[0].id}", monospace`}function du({theme:t,face:r}){return e("span",{className:"block overflow-hidden rounded border border-ink/10",style:{backgroundColor:t.bg,color:t.fg},children:e("span",{className:"block px-1.5 py-1 font-mono text-[10px] leading-[1.4]",style:{fontFamily:r},children:[e("span",{style:{color:t.keyword},children:"const"})," ",e("span",{children:"answer"})," ",e("span",{style:{color:t.keyword},children:"="})," ",e("span",{style:{color:t.string},children:"42"}),e("span",{children:";"}),e("span",{className:"block truncate",style:{color:t.comment},children:["// ",t.label]})]})})}function xi({settings:t,onUpdate:r}){let l=t.editorTheme||ea,[c,p]=n("all"),g=lu(t.editorFont),h=u(()=>c==="all"?bm:bm.filter((v)=>v.variant===c),[c]);return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"flex items-center gap-2 text-sm font-semibold text-ink",children:[e(wa,{size:15,className:"text-ink/60"}),"Editor theme"]}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:["Colours for the code editor only: the console keeps the palette in the Palette group. ",e("strong",{children:"Auto"})," ","follows the app palette; any other choice paints the editor's own surface, gutter, selection and syntax, and applies to every open editor without a reload."]})]}),e("div",{className:"flex items-center gap-1.5",children:[su.map((v)=>e("button",{type:"button",onClick:()=>p(v.id),className:`rounded-full border px-2.5 py-1 text-[11px] font-medium transition-colors cursor-pointer ${c===v.id?"border-ink bg-ink text-paper":"border-ink/20 bg-paper text-ink/70 hover:border-ink/40 hover:text-ink"}`,children:[v.id==="light"&&e(Zt,{size:11,className:"mr-1 inline align-[-1px]"}),v.id==="dark"&&e(Xt,{size:11,className:"mr-1 inline align-[-1px]"}),v.label]},v.id)),e("span",{className:"ml-auto font-mono text-[11px] text-ink/50",children:c==="all"?`${h.length} themes`:`${h.length} shown`})]}),e("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:[e("button",{type:"button",onClick:()=>r({editorTheme:ea}),"aria-pressed":l===ea,className:`flex w-full flex-col gap-2 rounded-lg border p-2 text-left transition-colors cursor-pointer ${l===ea?"border-ink bg-ink/5 ring-1 ring-ink/20":"border-ink/20 bg-paper hover:border-ink/40 hover:bg-ink/5"}`,children:[e("span",{className:"flex items-center gap-2",children:[e("span",{className:"truncate font-semibold text-ink",children:"Auto"}),e("span",{className:"shrink-0 rounded-full border border-ink/15 px-1.5 py-px text-[10px] font-semibold uppercase tracking-wider text-ink/50",children:"app palette"}),l===ea&&e(f,{size:14,className:"ml-auto shrink-0 text-ink"})]}),e("span",{className:"flex h-8 items-center justify-center rounded border border-dashed border-ink/20 text-[10px] text-ink/50",children:"Follows the theme above"})]}),h.map((v)=>{let y=l===v.id;return e("button",{type:"button",onClick:()=>r({editorTheme:v.id}),"aria-pressed":y,className:`flex w-full flex-col gap-2 rounded-lg border p-2 text-left transition-colors cursor-pointer ${y?"border-ink bg-ink/5 ring-1 ring-ink/20":"border-ink/20 bg-paper hover:border-ink/40 hover:bg-ink/5"}`,children:[e("span",{className:"flex items-center gap-2",children:[e("span",{className:"truncate font-semibold text-ink",title:v.label,children:v.label}),e("span",{className:"shrink-0 rounded-full border border-ink/15 px-1.5 py-px text-[10px] font-semibold uppercase tracking-wider text-ink/50",children:v.variant}),y&&e(f,{size:14,className:"ml-auto shrink-0 text-ink"})]}),e(du,{theme:v,face:g})]},v.id)})]})]})}function yi({settings:t,onUpdate:r}){let l=R("editorIndentWidth"),c=typeof l==="number"&&Ld.includes(l)?l:fu.width,p=(g)=>{if(g===c)return;let h={...Md(),width:g};hr({editorIndentWidth:g,editorInsertSpaces:!0}),r((v)=>({...v})),window.dispatchEvent(new CustomEvent(Fd,{detail:h}))};return e("section",{className:"space-y-3",children:e("div",{className:"flex items-center justify-between gap-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Editor indentation"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"One level, in spaces. Enter, Tab and the auto-indent rules all use it."})]}),e("div",{className:"flex items-center gap-1",role:"group","aria-label":"Indentation width",children:Ld.map((g)=>e("button",{type:"button",onClick:()=>p(g),"aria-pressed":g===c,"aria-label":`${g} spaces`,className:`px-2.5 py-1 rounded border text-[11px] font-mono transition-colors cursor-pointer ${g===c?"border-ink/40 bg-ink/10 text-ink":"border-ink/15 text-ink/60 hover:bg-ink/5 hover:text-ink"}`,children:g},g))})]})})}function ki({label:t,hint:r,checked:l,onChange:c}){return e("label",{className:"flex items-start justify-between gap-3 cursor-pointer",children:[e("span",{className:"min-w-0",children:[e("span",{className:"block text-xs text-ink",children:t}),e("span",{className:"block text-[11px] text-ink/50 mt-0.5",children:r})]}),e("input",{type:"checkbox",checked:l,onChange:(p)=>c(p.currentTarget.checked),"aria-label":t,className:`${be} mt-0.5 accent-ink flex-shrink-0`})]})}function wi({settings:t,onUpdate:r}){let l=hu(),c=R("editorAutoCloseBrackets"),p=R("editorAutocomplete"),g=(h)=>{let v={...hu(),...h};hr(h),r((y)=>({...y})),window.dispatchEvent(new CustomEvent(Pd,{detail:v}))};return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Editor typing"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"Both change what typing does, which is why they are switches rather than always-on."})]}),e("div",{className:"space-y-2.5 rounded-lg border border-ink/10 p-3",children:[e(ki,{label:"Auto-close brackets",hint:"Typing ( or { inserts the matching closer, and typing it again steps over it.",checked:typeof c==="boolean"?c:Dl.autoCloseBrackets,onChange:(h)=>g({editorAutoCloseBrackets:h})}),e(ki,{label:"Suggest words from the file",hint:`Offers identifiers already near the caret (${l.autocomplete?"on":"off"}). Words only — this is not a language server.`,checked:typeof p==="boolean"?p:Dl.autocomplete,onChange:(h)=>g({editorAutocomplete:h})})]})]})}function Si({label:t,hint:r,checked:l,onChange:c}){return e("label",{className:"flex items-start justify-between gap-3 cursor-pointer",children:[e("span",{className:"min-w-0",children:[e("span",{className:"block text-xs text-ink",children:t}),e("span",{className:"block text-[11px] text-ink/50 mt-0.5",children:r})]}),e("input",{type:"checkbox",checked:l,onChange:(p)=>c(p.target.checked),className:`${be} mt-0.5 shrink-0 accent-ink`})]})}function Ni({settings:t,onUpdate:r}){let l=R("editorBlame"),c=R("editorBlameInline"),p=Ei(),g=(h)=>{let v={...Ei(),...h};hr(h),r((y)=>({...y})),window.dispatchEvent(new CustomEvent(Is,{detail:v}))};return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Line blame"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"Who last touched a line, and which commit. Read from git, so it needs a committed file."})]}),e("div",{className:"space-y-2.5 rounded-lg border border-ink/10 p-3",children:[e(Si,{label:"Show blame on hover",hint:"Hover a line number — or the label, when it is on — to see the author, the commit and the line's own history.",checked:typeof l==="boolean"?l:Nl.enabled,onChange:(h)=>g({editorBlame:h})}),e(Si,{label:"Show the label in the editor",hint:`Puts “author · age” at the end of each block. It costs horizontal room, so it is off on a narrow panel by default (${p.inline?"on":"off"}).`,checked:typeof c==="boolean"?c:Nl.inline,onChange:(h)=>g({editorBlameInline:h})})]})]})}var cu={theme:_r,sidebar:Hr,"panel-nav":Qr,surface:si,border:pi,icons:bi,tray:hi,"editor-font":vi,"editor-theme":xi,"editor-indent":yi,"editor-typing":wi,"editor-blame":Ni};function Pi({settings:t,onUpdate:r}){let l=Pe(),[c,p]=n(Mt[0].id),g=Mt.find((h)=>h.id===c)??Mt[0];return e(Ce,{pane:l.pane,onBack:l.back,listLabel:"Appearance settings",detailLabel:g.label,detailDescription:g.description,list:e(tn,{groups:Mt,activeGroupId:g.id,onSelectGroup:(h)=>{p(h),l.openDetail()}}),detail:e(ln,{group:g,children:g.sections.map((h)=>{let v=cu[h];return e(v,{settings:t,onUpdate:r},h)})})})}var Lt=[{id:"layout",label:"Layout",hint:"Chat width and composer shape",description:"How wide the conversation is drawn, and the shape of the box you type into.",icon:nn,sections:["width","composer"]},{id:"transcript",label:"Transcript",hint:"Tool calls, changed files and follow-up dispatch",description:"How a tool call is drawn, whether a run lists the files it changed, and what happens to a prompt sent while the agent is still running.",icon:Vr,sections:["tool-calls","changed-files","follow-up"]},{id:"sessions",label:"Sessions",hint:"Titles and goal mode",description:"How a session gets its name, and the defaults a new goal starts with.",icon:mn,sections:["titles","goal"]}];var pu={compact:"60%",wide:"85%",full:"100%",custom:"80%"};function Ci({settings:t,onUpdate:r}){let l=t.chatWidthMode;return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Chat Width"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"How wide the conversation is drawn. The composer follows the transcript, and no mode hides a panel. Drag the right edge of the transcript for any width in between."})]}),e("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-3",role:"group","aria-label":"Chat width",children:[...Cg,"custom"].map((c)=>{let p=XA[c],g=l===c;return e("div",{onClick:()=>r({chatWidthMode:c}),role:"button",tabIndex:0,"aria-pressed":g,onKeyDown:(h)=>{if(h.key==="Enter"||h.key===" ")h.preventDefault(),r({chatWidthMode:c})},className:`p-3.5 rounded-lg border text-left transition-all cursor-pointer flex flex-col justify-between select-none ${g?"border-ink bg-ink/5 ring-1 ring-ink/20 shadow-xs":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/[0.02]"}`,children:e("div",{children:[e("div",{className:"flex items-center justify-between mb-2",children:[e("span",{className:"font-semibold text-xs text-ink",children:[p.label,c==="custom"&&e("span",{className:"ml-1.5 font-mono font-normal text-[10px] text-ink/55",children:[t.chatColumnWidth,"px"]})]}),e("div",{className:`w-4 h-4 rounded-full border flex items-center justify-center ${g?"border-ink bg-ink text-paper":"border-ink/30 bg-transparent"}`,children:g&&e(f,{size:10,strokeWidth:3})})]}),e("div",{"aria-hidden":!0,className:"h-1.5 rounded-full bg-ink/10 mb-2.5 overflow-hidden",children:e("div",{className:`h-full rounded-full ${g?"bg-ink":"bg-ink/35"}`,style:{width:pu[c]}})}),e("p",{className:"text-[11px] text-ink/65 leading-relaxed",children:p.description})]})},c)})}),e("p",{className:"text-[10px] text-ink/45 font-mono",children:"On a phone the column already fills the screen, so the mode and the drag have no visible effect."})]})}function Ti({active:t=!1}){return e("span",{className:`h-[6px] w-[16px] rounded-sm border ${t?"border-ink/40 bg-ink/15":"border-ink/20 bg-ink/5"}`})}function uu({hero:t=!1}){return e("span",{className:`flex flex-col gap-[3px] rounded-md border border-ink/15 bg-paper px-1.5 py-1 ${t?"flex-1 justify-center":""}`,children:[e("span",{className:"h-[2.5px] w-[72%] rounded-full bg-ink/25"}),e("span",{className:"h-[2.5px] w-[54%] rounded-full bg-ink/20"}),e("span",{className:"h-[2.5px] w-[30%] rounded-full bg-ink/15"})]})}function mu({rail:t=!1}){if(t)return e("span",{className:"flex items-center gap-1 border-t border-ink/10 px-1 pt-1 font-mono",children:[e("span",{className:"h-[2.5px] w-[14px] rounded-full bg-ink/30"}),e("span",{className:"h-[2.5px] w-[9px] rounded-full bg-ink/20"}),e("span",{className:"h-[2.5px] w-[11px] rounded-full bg-ink/20"}),e("span",{className:"ml-auto h-[7px] w-[7px] rounded-sm bg-ink/80"})]});return e("span",{className:"flex items-center gap-1 px-1",children:[e("span",{className:"h-[6px] w-[20px] rounded-sm bg-ink/15"}),e("span",{className:"h-[6px] w-[10px] rounded-sm bg-ink/10"}),e("span",{className:"ml-auto h-[7px] w-[7px] rounded-full border border-ink/25"}),e("span",{className:"h-[7px] w-[7px] rounded-sm bg-ink/80"})]})}var gu={classic:"rounded-md bg-paper border-ink/10",calm:"rounded-lg bg-paper border-ink/10",console:"rounded-sm bg-paper border-ink/10",stage:"rounded-md bg-paper border-ink/15",glass:"rounded-xl border-ink/15 bg-gradient-to-b from-ink/[0.06] to-transparent"};function bu({style:t}){let r=gm({style:t,hero:t==="stage"});return e("span",{className:`flex h-full flex-col gap-1 border p-1 ${gu[t]}`,"aria-hidden":"true",children:r.wire.map((l,c)=>l==="draft"?e(uu,{hero:t==="stage"},c):l==="chip"?e("span",{className:"flex items-center gap-1 px-1",children:[e(Ti,{active:t!=="calm"}),e(Ti,{})]},c):e(mu,{rail:r.toolbarTone==="rail"},c))})}function Ii({settings:t,onUpdate:r}){let l=yc(t.composerStyle);return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Composer"}),e("p",{className:"mt-0.5 text-[11px] text-ink/60",children:"The shape of the box you type into. Every style offers the same controls — attachments, plan and goal, access mode, model, thinking, voice, send — and only their order and frame change. Applies to desktop and phone, and takes effect immediately."})]}),e("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",role:"group","aria-label":"Composer style",children:ch.map((c)=>{let p=dh[c],g=c===l;return e("button",{type:"button",onClick:()=>r({composerStyle:c}),"aria-pressed":g,"aria-label":`${p.label} composer — ${p.description}`,className:`flex flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors cursor-pointer ${g?"border-ink/40 bg-ink/5":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5"}`,children:[e("span",{className:"block h-[92px]",children:e(bu,{style:c})}),e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:"text-xs font-semibold text-ink",children:p.label}),g&&e("span",{className:"ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[10px] font-semibold text-paper",children:"active"})]}),e("span",{className:"text-[11px] leading-relaxed text-ink/60",children:p.description})]},c)})})]})}function vu({mode:t}){if(t==="card")return e("div",{"aria-hidden":!0,className:"space-y-1 rounded-md border border-ink/15 bg-paper px-2 py-1.5",children:[e("div",{className:"flex items-center gap-1",children:[e("span",{className:"h-1.5 w-1.5 rounded-full bg-ink/50"}),e("span",{className:"h-1 w-10 rounded-full bg-ink/35"}),e("span",{className:"ml-auto h-1 w-5 rounded-full bg-ink/20"})]}),e("div",{className:"h-1 w-16 rounded-full bg-ink/15"})]});if(t==="compact")return e("div",{"aria-hidden":!0,className:"space-y-1.5 rounded-md border border-transparent px-1 py-1",children:[0,1].map((r)=>e("div",{className:"flex items-center gap-1",children:[e("span",{className:"h-1.5 w-1.5 rounded-full bg-ink/40"}),e("span",{className:"h-1 w-8 rounded-full bg-ink/30"}),e("span",{className:"ml-auto h-1 w-6 rounded-full bg-ink/15"})]},r))});if(t==="trace")return e("div",{"aria-hidden":!0,className:"relative ml-1 pl-3 py-1",children:[e("span",{className:"absolute left-[3px] top-1 bottom-1 w-px bg-ink/20"}),[0,1,2].map((r)=>e("div",{className:"flex items-center gap-1 py-0.5",children:[e("span",{className:"h-1.5 w-1.5 rounded-full bg-ink/40"}),e("span",{className:"h-1 w-10 rounded-full bg-ink/25"})]},r))]});if(t==="tui")return e("div",{"aria-hidden":!0,className:"space-y-1 px-1 py-1 font-mono",children:[0,1].map((r)=>e("div",{className:"flex items-baseline gap-1",children:[e("span",{className:"text-[6px] text-success",children:"✔"}),e("span",{className:"h-1 w-3 rounded-full bg-info/70"}),e("span",{className:"h-1 w-6 rounded-full bg-meta/70"}),e("span",{className:"ml-auto h-1 w-2 rounded-full bg-ink/25"})]},r))});return e("div",{"aria-hidden":!0,className:"space-y-1.5 px-1 py-1",children:[e("div",{className:"h-1 w-20 rounded-full bg-ink/25"}),e("div",{className:"h-1 w-14 rounded-full bg-ink/15"})]})}function Ai({settings:t,onUpdate:r}){let l=t.toolRenderStyle;return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Tool Calls"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"How a tool call is drawn in the transcript. Every style shows the same outcome, facts and body."})]}),e("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:th.map((c)=>{let p=nh[c],g=l===c;return e("div",{onClick:()=>r({toolRenderStyle:c}),role:"button",tabIndex:0,"aria-pressed":g,onKeyDown:(h)=>{if(h.key==="Enter"||h.key===" ")h.preventDefault(),r({toolRenderStyle:c})},className:`p-3.5 rounded-lg border text-left transition-all cursor-pointer flex flex-col justify-between select-none ${g?"border-ink bg-ink/5 ring-1 ring-ink/20 shadow-xs":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/[0.02]"}`,children:e("div",{children:[e("div",{className:"flex items-center justify-between mb-2",children:[e("span",{className:"font-semibold text-xs text-ink",children:p.label}),e("div",{className:`w-4 h-4 rounded-full border flex items-center justify-center ${g?"border-ink bg-ink text-paper":"border-ink/30 bg-transparent"}`,children:g&&e(f,{size:10,strokeWidth:3})})]}),e("div",{className:"mb-2.5 h-12 rounded-md bg-canvas/50 px-1 py-1",children:e(vu,{mode:c})}),e("p",{className:"text-[11px] text-ink/65 leading-relaxed",children:p.description})]})},c)})}),e("p",{className:"text-[10px] text-ink/45 font-mono",children:"The style is global: it applies to every session, and the composer keeps its own frame."})]})}function xu({label:t,enabled:r,onToggle:l}){return e("button",{type:"button",role:"switch","aria-checked":r,"aria-label":`${r?"Disable":"Enable"} ${t}`,onClick:l,className:`relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none ${r?"bg-ink":"bg-ink/20"}`,children:e("span",{"aria-hidden":"true",className:`pointer-events-none inline-block h-5 w-5 transform rounded-full bg-paper shadow ring-0 transition duration-200 ease-in-out ${r?"translate-x-5":"translate-x-0"}`})})}function Ri({settings:t,onUpdate:r}){let l=t.showChangedFiles;return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Changed Files"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"A collapsed list of the files a run changed, above its footer. Clicking a file opens the agent's own diff — the content it wrote, not the current worktree."})]}),e("div",{className:"flex items-start justify-between gap-4 py-3",children:[e("div",{className:"flex items-start gap-3",children:[e("div",{className:"w-8 h-8 rounded-md bg-ink/5 border border-ink/10 flex items-center justify-center flex-shrink-0 mt-0.5",children:e(vr,{size:16,className:l?"text-ink":"text-ink/40"})}),e("div",{children:[e("div",{className:"text-sm font-semibold text-ink",children:"Show changed files"}),e("p",{className:"text-ink/65 text-[11px] mt-1 leading-relaxed",children:"Read from the session's change journal. Sessions recorded before omp 18.20.1 have no journal, so the list stays empty there."})]})]}),e(xu,{label:"Show changed files",enabled:l,onToggle:()=>r({showChangedFiles:!l})})]})]})}function Mi({settings:t,onUpdate:r}){return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Follow-up Dispatch"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"Choose how new user prompts are handled while the AI agent is actively executing."})]}),e("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e("div",{onClick:()=>r({followUpBehavior:"queue"}),role:"button",tabIndex:0,onKeyDown:(l)=>l.key==="Enter"&&r({followUpBehavior:"queue"}),className:`p-3.5 rounded-lg border text-left transition-all cursor-pointer flex flex-col justify-between select-none ${t.followUpBehavior==="queue"?"border-ink bg-ink/5 ring-1 ring-ink/20 shadow-xs":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/[0.02]"}`,children:[e("div",{children:[e("div",{className:"flex items-center justify-between mb-2",children:[e("div",{className:"flex items-center gap-2",children:[e("div",{className:`w-7 h-7 rounded-md flex items-center justify-center ${t.followUpBehavior==="queue"?"bg-ink text-paper":"bg-ink/5 text-ink/70"}`,children:e(Vr,{size:15})}),e("span",{className:"font-semibold text-xs text-ink",children:"Queue Mode"})]}),e("span",{className:"text-[10px] font-mono uppercase px-1.5 py-0.5 rounded bg-ink/10 text-ink/70 font-medium",children:"Sequential"})]}),e("p",{className:"text-[11px] text-ink/65 leading-relaxed",children:"Messages wait in an execution queue and run in succession once current inference completes."})]}),e("div",{className:"mt-3 pt-2.5 border-t border-ink/10 flex items-center justify-between text-[11px]",children:[e("span",{className:"text-ink/50 text-[10px]",children:"Recommended for batch operations"}),e("div",{className:`w-4 h-4 rounded-full border flex items-center justify-center ${t.followUpBehavior==="queue"?"border-ink bg-ink text-paper":"border-ink/30 bg-transparent"}`,children:t.followUpBehavior==="queue"&&e(f,{size:10,strokeWidth:3})})]})]}),e("div",{onClick:()=>r({followUpBehavior:"steering"}),role:"button",tabIndex:0,onKeyDown:(l)=>l.key==="Enter"&&r({followUpBehavior:"steering"}),className:`p-3.5 rounded-lg border text-left transition-all cursor-pointer flex flex-col justify-between select-none ${t.followUpBehavior==="steering"?"border-ink bg-ink/5 ring-1 ring-ink/20 shadow-xs":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/[0.02]"}`,children:[e("div",{children:[e("div",{className:"flex items-center justify-between mb-2",children:[e("div",{className:"flex items-center gap-2",children:[e("div",{className:`w-7 h-7 rounded-md flex items-center justify-center ${t.followUpBehavior==="steering"?"bg-ink text-paper":"bg-ink/5 text-ink/70"}`,children:e(qt,{size:15})}),e("span",{className:"font-semibold text-xs text-ink",children:"Steering Mode"})]}),e("span",{className:"text-[10px] font-mono uppercase px-1.5 py-0.5 rounded bg-ink/10 text-ink/70 font-medium",children:"Intervention"})]}),e("p",{className:"text-[11px] text-ink/65 leading-relaxed",children:"Immediately redirects current agent trajectory and focuses runtime resources onto the new instruction."})]}),e("div",{className:"mt-3 pt-2.5 border-t border-ink/10 flex items-center justify-between text-[11px]",children:[e("span",{className:"text-ink/50 text-[10px]",children:"Recommended for active debugging"}),e("div",{className:`w-4 h-4 rounded-full border flex items-center justify-center ${t.followUpBehavior==="steering"?"border-ink bg-ink text-paper":"border-ink/30 bg-transparent"}`,children:t.followUpBehavior==="steering"&&e(f,{size:10,strokeWidth:3})})]})]})]})]})}var yu=[{enabled:!0,label:"Generate Automatically",badge:"Default",icon:Se,description:`As soon as your first message lands, the session is named from it using omp's own tiny title model — retried once when the run ends if that first attempt came back empty. Sessions stop showing "New Session - <timestamp>" in the sidebar.`,note:"One small model call per session"},{enabled:!1,label:"Manual Only",badge:"Opt-out",icon:Zr,description:"Sessions keep their timestamp placeholder until you rename them from the sidebar. Choose this when every title should be deliberate, or to avoid the extra model call.",note:"No background model calls"}];function Li({settings:t,onUpdate:r}){let l=t.autoSessionTitle??!0;return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Session Titles"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"How a session gets its display name. A name you set yourself is never replaced."})]}),e("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:yu.map(({enabled:c,label:p,badge:g,icon:h,description:v,note:y})=>{let w=l===c,k=()=>r({autoSessionTitle:c});return e("div",{onClick:k,role:"button",tabIndex:0,onKeyDown:(C)=>C.key==="Enter"&&k(),className:`p-3.5 rounded-lg border text-left transition-all cursor-pointer flex flex-col justify-between select-none ${w?"border-ink bg-ink/5 ring-1 ring-ink/20 shadow-xs":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/[0.02]"}`,children:[e("div",{children:[e("div",{className:"flex items-center justify-between mb-2",children:[e("div",{className:"flex items-center gap-2",children:[e("div",{className:`w-7 h-7 rounded-md flex items-center justify-center ${w?"bg-ink text-paper":"bg-ink/5 text-ink/70"}`,children:e(h,{size:15})}),e("span",{className:"font-semibold text-xs text-ink",children:p})]}),e("span",{className:"text-[10px] font-mono uppercase px-1.5 py-0.5 rounded bg-ink/10 text-ink/70 font-medium",children:g})]}),e("p",{className:"text-[11px] text-ink/70 leading-relaxed",children:v})]}),e("div",{className:"mt-3 pt-2.5 border-t border-ink/10 flex items-center justify-between text-[11px]",children:[e("span",{className:"text-ink/50",children:y}),w&&e("span",{className:"flex items-center gap-1 text-ink font-medium",children:[e(f,{size:12})," Active"]})]})]},p)})})]})}var ku="flex w-full min-w-0 items-center justify-between gap-2 rounded-md border border-ink/20 bg-paper px-2 py-1.5 text-left font-mono text-[11px] text-ink transition-colors hover:border-ink/40 focus:border-ink/50 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50";function Ue({value:t,options:r,placeholder:l,ariaLabel:c,onChange:p,disabled:g,className:h,searchable:v=!0}){let[y,w]=n(null),[k,C]=n(""),[N,A]=n(0),T=i(null),F=i(null),S=i([]),M=i(`search-select-${Math.random().toString(36).slice(2,9)}`).current,I=r.find((q)=>q.value===t),O=y!==null,j=u(()=>{let q=k.trim();if(!q)return r;return r.filter((z)=>cs(`${z.label} ${z.value} ${z.hint??""}`,q))},[r,k]),H=u(()=>{let q=[];for(let z of j){let V=z.group??"",X=q.find((ee)=>ee.name===V);if(X)X.rows.push(z);else q.push({name:V,rows:[z]})}return q},[j]),K=(q=!1)=>{if(w(null),C(""),q)T.current?.focus()},Y=()=>{if(g||!T.current)return;let q=Math.max(0,r.findIndex((z)=>z.value===t));C(""),A(q),w(Et(T.current))},G=(q)=>{if(q!==t)p(q);K(!0)};o(()=>{A(0)},[k]),o(()=>{if(!O)return;S.current[N]?.scrollIntoView({block:"nearest"})},[O,N]),o(()=>{if(O)F.current?.focus()},[O]);let W=(q)=>{if(q.key==="ArrowDown")q.preventDefault(),A((z)=>Math.max(0,Math.min(j.length-1,z+1)));else if(q.key==="ArrowUp")q.preventDefault(),A((z)=>Math.max(0,z-1));else if(q.key==="Home")q.preventDefault(),A(0);else if(q.key==="End")q.preventDefault(),A(Math.max(0,j.length-1));else if(q.key==="Enter"){q.preventDefault();let z=j[N];if(z)G(z.value)}};return e(d,{children:[e("button",{ref:T,type:"button",role:"combobox","aria-label":c,"aria-haspopup":"listbox","aria-expanded":O,"aria-controls":O?M:void 0,disabled:g,title:I?.label??l,onClick:()=>O?K():Y(),onKeyDown:(q)=>{if(q.key==="ArrowDown"||q.key==="Enter"||q.key===" ")q.preventDefault(),Y()},className:`${ku} ${h??""}`,children:[e("span",{className:`truncate ${I?"":"text-ink/40"}`,children:I?.label??(t?`${t} (not listed)`:l)}),e(B,{size:12,className:`flex-shrink-0 text-ink/40 transition-transform ${O?"rotate-180":""}`})]}),e(Qt,{anchor:y,align:"start",className:"w-72 max-w-[calc(100vw-2rem)] rounded-md border border-ink/15 bg-paper py-1 text-xs shadow-lg",...{"aria-label":c},onClose:()=>K(!0),children:e("div",{onKeyDown:W,children:[v&&e("div",{className:"flex items-center gap-1.5 border-b border-ink/10 px-2 py-1.5",children:[e(U,{size:11,className:"flex-shrink-0 text-ink/40"}),e("input",{ref:F,type:"text",value:k,"aria-label":`Search ${c}`,placeholder:"Search…",onInput:(q)=>C(q.currentTarget.value),className:"w-full min-w-0 bg-transparent text-xs text-ink outline-none placeholder:text-ink/35"})]}),e("div",{id:M,role:"listbox","aria-label":c,className:"max-h-56 overflow-y-auto py-1",children:[e("button",{type:"button",role:"option","aria-selected":t==="",ref:(q)=>{S.current[0]=q},onClick:()=>G(""),onMouseEnter:()=>A(0),className:`flex w-full items-center justify-between gap-2 px-3 py-1.5 text-left ${t===""?"text-ink":"text-ink/60"} hover:bg-ink/5`,children:[e("span",{className:"truncate italic",children:l}),t===""&&e(f,{size:11,className:"flex-shrink-0"})]}),t!==""&&!I&&e("button",{type:"button",role:"option","aria-selected":!0,onClick:()=>G(t),className:"flex w-full items-center justify-between gap-2 px-3 py-1.5 text-left text-ink",children:[e("span",{className:"truncate",children:[t," (not listed)"]}),e(f,{size:11,className:"flex-shrink-0"})]}),j.length===0?e("div",{className:"px-3 py-2 italic text-ink/40",children:["No match for “",k.trim(),"”"]}):H.map((q)=>e("div",{children:[q.name&&e("div",{className:"px-3 pb-0.5 pt-2 text-[9px] font-semibold uppercase tracking-wider text-ink/35",children:q.name}),q.rows.map((z)=>{let V=j.indexOf(z),X=z.value===t;return e("button",{type:"button",role:"option","aria-selected":X,ref:(ee)=>{S.current[V+1]=ee},onClick:()=>G(z.value),onMouseEnter:()=>A(V),title:z.hint??z.value,className:`flex w-full items-start justify-between gap-2 px-3 py-1.5 text-left transition-colors ${V===N?"bg-ink/5":""} ${X?"font-medium text-ink":"text-ink/75"}`,children:[e("span",{className:"min-w-0",children:[e("span",{className:"block truncate",children:z.label}),z.hint&&e("span",{className:"block truncate font-mono text-[10px] text-ink/40",children:z.hint})]}),X&&e(f,{size:11,className:"mt-0.5 flex-shrink-0"})]},z.value)})]},q.name||"__flat"))]})]})})]})}var wu=[{enabled:!0,label:"Independent auditor",badge:"Default",description:"After every finished turn a separate model reads the objective and the agent's own report and decides: keep going, done, or needs you. Without it nothing advances a goal on its own.",note:"One extra model call per turn"},{enabled:!1,label:"Manual only",badge:"Opt-out",description:"Goals still exist — objective, pause, resume and the token budget all work — but the loop never continues by itself. Use it when a goal should only ever run the turns you ask for.",note:"No background model calls"}];function Oi({settings:t,onUpdate:r}){let l=xc(),[c,p]=n([]),[g,h]=n(!0),v=t.goalAuditEnabled??!0,y=t.goalAuditModel??"",w=t.goalDefaultBudget??null,[k,C]=n(w===null?"":String(w));o(()=>{C(w===null?"":String(w))},[w]);let N=()=>{let A=Cm(k);if(C(A===null?"":String(A)),A!==w)r({goalDefaultBudget:A})};return o(()=>{let A=!0;return Va().then((T)=>{if(!A)return;p(Array.isArray(T.modelList)?T.modelList.map((F)=>({id:F.id,name:F.name,provider:F.provider})):[])}).catch(()=>{}).finally(()=>{if(A)h(!1)}),()=>{A=!1}},[]),e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Goal Mode"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"A goal keeps a session working toward one objective until it is done, out of budget, or the auditor says it needs you."})]}),e("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:wu.map(({enabled:A,label:T,badge:F,description:S,note:M})=>{let I=v===A,O=()=>r({goalAuditEnabled:A});return e("div",{onClick:O,role:"button",tabIndex:0,onKeyDown:(j)=>j.key==="Enter"&&O(),className:`p-3.5 rounded-lg border text-left transition-all cursor-pointer flex flex-col justify-between select-none ${I?"border-ink bg-ink/5 ring-1 ring-ink/20 shadow-xs":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/[0.02]"}`,children:[e("div",{children:[e("div",{className:"flex items-center justify-between mb-2",children:[e("div",{className:"flex items-center gap-2",children:[e("div",{className:`w-7 h-7 rounded-md flex items-center justify-center ${I?"bg-ink text-paper":"bg-ink/5 text-ink/70"}`,children:e(Eo,{size:15})}),e("span",{className:"font-semibold text-xs text-ink",children:T})]}),e("span",{className:"text-[10px] font-mono uppercase px-1.5 py-0.5 rounded bg-ink/10 text-ink/70 font-medium",children:F})]}),e("p",{className:"text-[11px] text-ink/65 leading-relaxed",children:S})]}),e("div",{className:"mt-3 pt-2.5 border-t border-ink/10 flex items-center justify-between text-[11px]",children:[e("span",{className:"text-ink/50 text-[10px]",children:M}),e("div",{className:`w-4 h-4 rounded-full border flex items-center justify-center ${I?"border-ink bg-ink text-paper":"border-ink/30 bg-transparent"}`,children:I&&e(f,{size:10,strokeWidth:3})})]})]},T)})}),v&&e("div",{className:"rounded-lg border border-ink/15 bg-paper p-3.5 space-y-3",children:e("div",{children:[e("label",{className:"mb-1 block text-[10px] font-semibold uppercase tracking-wider text-ink/45",children:"Auditor model"}),e(Ue,{ariaLabel:"Auditor model",value:y,onChange:(A)=>r({goalAuditModel:A}),disabled:g,placeholder:"Session model (default)",className:"w-full py-1.5 text-[11.5px]",options:c.map((A)=>({value:`${A.provider}/${A.id}`,label:A.name,hint:`${A.provider}/${A.id}`,group:ls(A.provider,l)}))}),e("p",{className:"mt-1 text-[10.5px] text-ink/45",children:"The audit is a classification, not a task: it runs with thinking off, one small call per turn."})]})}),e("div",{className:"rounded-lg border border-ink/15 bg-paper p-3.5",children:[e("label",{className:"mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wider text-ink/45",children:[e(oi,{size:11})," Default token budget"]}),e("div",{className:"flex items-center gap-2",children:[e("input",{value:k,onChange:(A)=>C(A.currentTarget.value),onBlur:N,onKeyDown:(A)=>{if(A.key==="Enter")N()},placeholder:"none: the turn ceiling is then the only stop",inputMode:"numeric","aria-label":"Default goal token budget",className:"w-56 rounded border border-ink/15 bg-paper px-2 py-1.5 font-mono text-[11.5px] outline-none focus:border-ink"}),e("span",{className:"text-[10.5px] text-ink/45",children:"New goals start with this budget; a goal you set explicitly keeps its own."})]})]}),e("div",{className:"flex items-start gap-2 rounded-lg border border-ink/10 bg-canvas/40 p-3 text-[11px] text-ink/60",children:[e($t,{size:12,className:"mt-0.5 shrink-0"}),e("span",{children:"The objective is set per goal from the composer's target button. The auditor judges progress from the objective and the agent's own report only — write an objective that says what finished looks like."})]})]})}var Nu={width:Ci,composer:Ii,"tool-calls":Ai,"changed-files":Ri,"follow-up":Mi,titles:Li,goal:Oi};function Di({settings:t,onUpdate:r}){let l=Pe(),[c,p]=n(Lt[0].id),g=Lt.find((h)=>h.id===c)??Lt[0];return e(Ce,{pane:l.pane,onBack:l.back,listLabel:"Chat settings",detailLabel:g.label,detailDescription:g.description,list:e(tn,{groups:Lt,activeGroupId:g.id,onSelectGroup:(h)=>{p(h),l.openDetail()}}),detail:e(ln,{group:g,children:g.sections.map((h)=>{let v=Nu[h];return e(v,{settings:t,onUpdate:r},h)})})})}function Ui(t){let r=new Map;for(let c of t){let p=Eh(c.chord),g=r.get(p);if(g)g.push(c);else r.set(p,[c])}let l=[];for(let c of r.values())for(let p=0;p<c.length;p+=1)for(let g=p+1;g<c.length;g+=1){let h=c[p],v=c[g];if(h.command===v.command)continue;l.push({chord:h.chord,a:h,b:v,certain:!h.when||!v.when||h.when===v.when})}return l}var Pu={Shift:!0,Control:!0,Alt:!0,Meta:!0,OS:!0,Super:!0,Hyper:!0,CapsLock:!0,Fn:!0},Cu={ShiftLeft:!0,ShiftRight:!0,ControlLeft:!0,ControlRight:!0,AltLeft:!0,AltRight:!0,MetaLeft:!0,MetaRight:!0,OSLeft:!0,OSRight:!0,CapsLock:!0};function $i(t){return Pu[t.key]===!0||Cu[t.code]===!0}function Fi({chord:t,onCommit:r}){let[l,c]=n(!1),[p,g]=n([]),h=i(null);o(()=>{if(l)h.current?.focus()},[l]);let v=()=>{c(!1),g([])},y=(k)=>{if(!l)return;if(k.preventDefault(),k.stopPropagation(),k.key==="Escape"){v();return}if(k.key==="Backspace"||k.key==="Delete"){if(p.length===0)r(null),v();else g([]);return}if(k.key==="Enter"&&p.length===1){r(Qg(p)),v();return}if($i(k))return;let C=Em(k);if(p.length===0){g([C]);return}r(Qg([p[0],C])),v()},w=l?p.length>0?`${No(p,Bt())} …`:"Press keys…":t||"Unassigned";return e("button",{ref:h,type:"button",onClick:()=>{c(!0),g([])},onBlur:()=>{if(l)v()},onKeyDown:y,"aria-label":l?"Recording shortcut, press keys":`Shortcut ${t||"unassigned"}, click to change`,className:`min-w-[7rem] px-2 py-1 rounded-md border text-[11px] font-mono transition-colors ${l?"border-ink/60 bg-ink/5 text-ink":"border-ink/20 text-ink/70 hover:border-ink/40 hover:text-ink"}`,children:w})}function ji(){let{commands:t,chords:r,rules:l}=Cc(),[c,p]=n(()=>Bm()),[g,h]=n(""),v=u(()=>Ui(l),[l]),y=Bt(),w=(T)=>t.find((F)=>F.id===T)?.title??T,k=(T,F)=>{let S={...c,[T]:F};p(S),cd(S),Rg(S)},C=(T)=>{let F={...c};delete F[T],p(F),cd(F),Rg(F)},N=g.trim().toLowerCase(),A=t.filter((T)=>!N||T.title.toLowerCase().includes(N)||(r.get(T.id)??"").toLowerCase().includes(N)).sort((T,F)=>T.category.localeCompare(F.category)||T.title.localeCompare(F.title));return e("section",{className:"space-y-3",children:[e("div",{className:"flex items-center justify-between gap-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Shortcuts"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"Click a chord to record a new one. Two strokes are allowed; Enter keeps a single stroke."})]}),e("div",{className:"flex items-center gap-2 px-2.5 py-1.5 border border-ink/15 rounded-md bg-canvas",children:[e(U,{size:13,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:g,onInput:(T)=>h(T.currentTarget.value),placeholder:"Filter","aria-label":"Filter shortcuts",className:"w-32 bg-transparent text-xs text-ink focus:outline-none placeholder-ink/40"})]})]}),v.length>0?e("div",{className:"border border-ink/15 rounded-lg p-3 space-y-1.5 bg-ink/[0.02]",children:[e("p",{className:"text-[11px] font-semibold text-ink/75",children:[v.length," chord ",v.length===1?"conflict":"conflicts"]}),v.map((T)=>e("p",{className:"text-[11px] text-ink/60",children:[e("span",{className:"font-mono text-ink/80",children:No(T.chord,y)})," ","— ",w(T.a.command)," and ",w(T.b.command),T.certain?"":" (may not overlap)"]},`${T.a.command}-${T.b.command}`))]}):null,e("div",{className:"bg-paper border border-ink/15 rounded-lg divide-y divide-ink/10 shadow-xs overflow-hidden",children:A.length===0?e("p",{className:"px-3 py-4 text-center text-xs text-ink/50",children:"No command matches that filter."}):A.map((T)=>{let F=c[T.id]!==void 0;return e("div",{className:"px-3 py-2 flex items-center justify-between gap-3",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-xs font-medium text-ink truncate",children:T.title}),e("div",{className:"text-[10px] text-ink/45",children:[T.category,T.pluginId?` · ${T.pluginId}`:"",F?" · custom":""]})]}),e("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e(Fi,{chord:r.get(T.id)??"",onCommit:(S)=>k(T.id,S)}),F?e("button",{type:"button",onClick:()=>C(T.id),title:"Reset to default","aria-label":`Reset ${T.title} to its default shortcut`,className:"p-1 rounded text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors",children:e(wt,{size:12})}):null]})]},T.id)})})]})}function Bi({settings:t,onUpdate:r}){let l=["Enter","Shift + Enter","Ctrl / Cmd + Enter"],c=(g,h)=>{r((v)=>{let y={[g]:h},w=["keybindingSend","keybindingNewLine","keybindingSteering"].filter((k)=>k!==g);for(let k of w)if(v[k]===h)y[k]=v[g];return{...v,...y}})},p=[{id:"keybindingSend",label:"Send Message",desc:"Submit prompt and initiate agent reasoning",icon:Xe,value:t.keybindingSend||"Enter"},{id:"keybindingNewLine",label:"Line Break",desc:"Insert newline inside input box without dispatching",icon:rn,value:t.keybindingNewLine||"Shift + Enter"},{id:"keybindingSteering",label:"Steering Intervention",desc:"Send prompt with steering interruption priority",icon:qt,value:t.keybindingSteering||"Ctrl / Cmd + Enter"}];return e("section",{className:"space-y-3",children:[e("div",{className:"flex items-center justify-between",children:[e("div",{className:"flex items-center gap-2",children:[e(ka,{size:15,className:"text-ink/70"}),e("h4",{className:"text-sm font-semibold text-ink",children:"Keyboard Shortcuts"})]}),e("span",{className:"text-[10px] text-ink/50 font-mono",children:"Auto-conflict resolution"})]}),e("div",{className:"bg-paper border border-ink/15 rounded-lg divide-y divide-ink/10 shadow-xs overflow-hidden",children:p.map((g)=>e("div",{className:"p-3.5 flex flex-col sm:flex-row sm:items-center justify-between gap-3 hover:bg-ink/[0.015] transition-colors",children:[e("div",{className:"flex items-start gap-3",children:[e("div",{className:"w-7 h-7 rounded-md bg-ink/5 flex items-center justify-center text-ink/70 flex-shrink-0 mt-0.5",children:e(g.icon,{size:14})}),e("div",{children:[e("div",{className:"font-semibold text-xs text-ink",children:g.label}),e("div",{className:"text-[11px] text-ink/60 mt-0.5",children:g.desc})]})]}),e("div",{className:"flex items-center gap-2 self-end sm:self-center",children:e("select",{value:g.value,onChange:(h)=>c(g.id,h.currentTarget.value),className:"bg-paper border border-ink/20 rounded-md px-2.5 py-1.5 outline-none focus:border-ink text-[11px] font-medium text-ink cursor-pointer hover:border-ink/40 transition-colors",children:l.map((h)=>e("option",{value:h,children:h},h))})})]},g.id))})]})}function _i({settings:t,onUpdate:r}){return e("div",{className:"flex-1 h-full overflow-y-auto scrollbar-overlay-container p-4 md:p-6 space-y-8 pb-8",children:[e(ji,{}),e(Bi,{settings:t,onUpdate:r})]})}function Ki({projects:t,selectedProjectId:r,onSelectProject:l,onAddProject:c,onTogglePin:p,isAdding:g=!1,folderFacts:h=[],loadError:v=null}){let y=new Map(h.map((w)=>[w.id,w.totalSessions]));return e("div",{className:"w-full md:w-64 md:border-r border-ink/10 h-full flex flex-col bg-paper/50 flex-shrink-0",children:[e("div",{className:`${xe} px-3.5 justify-between`,style:{height:we},children:[e("span",{className:"text-xs font-semibold text-ink",children:[t.length," project",t.length===1?"":"s"]}),e("button",{type:"button",onClick:c,disabled:g,"aria-label":"Add project",title:"Add project",className:"p-1 rounded text-ink/60 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer disabled:opacity-50",children:e(P,{size:15,strokeWidth:2.2})})]}),e("div",{className:"flex-1 scrollbar-overlay-container p-1.5 space-y-0.5",children:[v&&e("p",{className:"px-2 py-2 text-[11px] text-error",title:v,children:["Projects could not be read: ",v]}),!v&&t.length===0&&e("div",{className:"px-2 py-3 space-y-1.5",children:[e("p",{className:"text-[11.5px] text-ink/60",children:"No projects yet."}),e("button",{type:"button",onClick:c,className:"text-[11px] font-medium text-ink underline underline-offset-2 hover:no-underline cursor-pointer",children:"Add the first one"})]}),t.map((w)=>{let k=w.id===r,C=ra(w.icon),N=w.folderId===void 0?void 0:y.get(w.folderId);return e("div",{className:`group flex items-center rounded-md transition-colors ${k?"bg-ink/10 shadow-2xs":"hover:bg-ink/5"}`,children:[e("button",{type:"button",onClick:()=>l(w.id),"aria-current":k?"true":void 0,className:"flex-1 min-w-0 flex items-center gap-2 px-2.5 py-1.5 text-left cursor-pointer",children:[w.customIconUrl?e("img",{src:w.customIconUrl,alt:"",className:"w-3.5 h-3.5 rounded-xs object-contain flex-shrink-0",referrerPolicy:"no-referrer"}):e(C,{size:14,className:"flex-shrink-0",style:{color:w.accentColor||"currentColor"}}),e("span",{className:`text-[11.5px] truncate flex-1 ${k?"font-medium text-ink":"text-ink/80"}`,children:w.name}),typeof N==="number"&&N>0&&e("span",{className:"shrink-0 font-mono text-[10px] text-ink/40",children:N})]}),e("button",{type:"button",onClick:()=>p(w),"aria-label":w.isPinned?`Unpin ${w.name}`:`Pin ${w.name}`,title:w.isPinned?"Unpin (stop sorting first)":"Pin (sort first in the sidebar)",className:`shrink-0 mr-1 p-1 rounded transition-colors cursor-pointer ${w.isPinned?"text-ink/70 hover:text-ink hover:bg-ink/10":"text-ink/30 hover:text-ink/70 hover:bg-ink/10 opacity-0 group-hover:opacity-100 focus-visible:opacity-100"}`,children:w.isPinned?e(Br,{size:12}):e(ci,{size:12})})]},w.id)})]})]})}function zi({project:t,canDelete:r,isDeleting:l=!1,onDelete:c}){return e("div",{className:"flex items-start justify-between gap-4 pb-4 border-b border-ink/10",children:[e("div",{className:"min-w-0 flex-1",children:[e("h2",{className:"text-xl font-bold tracking-tight text-ink truncate",children:t.name}),e("p",{className:"text-[11px] font-mono text-ink/50 truncate mt-0.5 select-all",children:t.path||"Not bound to a directory"})]}),r&&e("button",{type:"button",onClick:c,disabled:l,title:"Delete this project",className:"inline-flex items-center gap-1.5 shrink-0 px-2.5 py-1.5 text-[11px] font-medium text-ink/50 hover:text-error hover:bg-error/10 rounded-md transition-colors cursor-pointer disabled:opacity-50",children:[e(L,{size:13}),e("span",{children:"Delete"})]})]})}function qi({name:t,disabled:r=!1,onCommit:l}){let[c,p]=n(t);return o(()=>{p(t)},[t]),e("div",{className:"space-y-2",children:[e("label",{htmlFor:"project-name-input",className:"block text-xs font-semibold text-ink",children:"Project name"}),e("input",{id:"project-name-input",type:"text",value:c,disabled:r,onChange:(h)=>p(h.currentTarget.value),onBlur:()=>{let h=c.trim();if(!h){p(t);return}if(h===t)return;l(h)},onKeyDown:(h)=>{if(h.key==="Enter")h.preventDefault(),h.currentTarget.blur();if(h.key==="Escape")p(t),h.currentTarget.blur()},placeholder:"Enter project name…",className:"w-full bg-paper border border-ink/20 rounded-md px-3 py-2 text-xs font-medium text-ink outline-none focus:border-ink/60 transition-colors shadow-2xs disabled:opacity-60"}),e("p",{className:"text-[11px] text-ink/50",children:"Names are unique: the sidebar identifies a project by it."})]})}function Vi({path:t,disabled:r=!1,onCommit:l,onReveal:c,isRevealing:p=!1}){let[g,h]=n(t),[v,y]=n(!1);o(()=>{h(t)},[t]);let w=(k)=>{let C=k.trim();if(C===t)return;l(C)};return e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("label",{htmlFor:"project-path-input",className:"block text-xs font-semibold text-ink",children:"Project directory"}),e("div",{className:"flex items-center gap-1",children:[e("button",{type:"button",onClick:()=>y(!0),disabled:r,className:"inline-flex items-center gap-1 px-2 py-1 rounded-md border border-ink/20 hover:border-ink/40 text-[11px] font-medium text-ink transition-colors cursor-pointer disabled:opacity-50",children:[e(zn,{size:11}),e("span",{children:"Browse…"})]}),e("button",{type:"button",onClick:c,disabled:r||!t||p,title:t?"Reveal in the file manager":"This project is not bound to a directory",className:"inline-flex items-center gap-1 px-2 py-1 rounded-md border border-ink/20 hover:border-ink/40 text-[11px] font-medium text-ink transition-colors cursor-pointer disabled:opacity-40",children:[e(Vt,{size:11}),e("span",{children:"Reveal"})]})]})]}),e("input",{id:"project-path-input",type:"text",value:g,disabled:r,onChange:(k)=>h(k.currentTarget.value),onBlur:()=>w(g),onKeyDown:(k)=>{if(k.key==="Enter")k.preventDefault(),k.currentTarget.blur();if(k.key==="Escape")h(t),k.currentTarget.blur()},placeholder:"~ or /absolute/path, or leave empty for an unbound grouping",spellcheck:!1,className:"w-full bg-paper border border-ink/20 rounded-md px-3 py-2 text-[11.5px] font-mono text-ink outline-none focus:border-ink/60 transition-colors shadow-2xs disabled:opacity-60"}),e("p",{className:"text-[11px] text-ink/50",children:t?"Sessions found under this directory appear in the project. One directory can belong to one project.":"Not bound to a directory: this project groups chats only and discovers no sessions."}),v&&e(Ec,{initialPath:t||void 0,onSelect:(k)=>{y(!1),h(k),w(k)},onClose:()=>y(!1)})]})}function Yi({model:t,models:r,onSelectModel:l,disabled:c=!1}){let[p,g]=n(!1),[h,v]=n(""),y=i(null);ue(y,()=>g(!1));let w=_h(t,r)??"Inherit Kabmo’s default",k=u(()=>{let N=h.trim().toLowerCase();if(!N)return r;return r.filter((A)=>A.name.toLowerCase().includes(N)||A.id.toLowerCase().includes(N)||A.provider.toLowerCase().includes(N))},[r,h]),C=(N)=>{l(N),g(!1),v("")};return e("div",{className:"space-y-2.5",children:[e("div",{className:"flex items-center gap-1.5",children:[e("h4",{className:"text-xs font-semibold text-ink",children:"Defaults for new chats"}),e("span",{className:"inline-flex text-ink/40 hover:text-ink/70 transition-colors cursor-help",title:"The model a chat started in this project uses until you pick another one in the composer.",children:e(ce,{size:12})})]}),e("div",{className:"flex items-center justify-between gap-4 p-3 bg-paper border border-ink/15 rounded-lg",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-xs font-medium text-ink",children:"Project model"}),e("div",{className:"text-[11px] text-ink/50",children:r.length===0?"No model catalog yet — connect a provider first.":"Applied when the project starts a chat."})]}),e("div",{className:"relative shrink-0",ref:y,children:[e("button",{type:"button",onClick:()=>g((N)=>!N),disabled:c,className:"flex items-center gap-2 px-3 py-1.5 rounded-md border border-ink/20 hover:border-ink/40 bg-paper text-ink text-xs font-medium transition-colors cursor-pointer shadow-2xs max-w-[248px] disabled:opacity-50",children:[e(Se,{size:13,className:"text-ink/70 shrink-0"}),e("span",{className:"truncate",children:w}),e(B,{size:13,className:"text-ink/50 shrink-0"})]}),p&&e("div",{className:"glass-popover absolute right-0 mt-1 w-[288px] bg-paper border border-ink/15 rounded-lg shadow-xl z-50 overflow-hidden",children:[e("div",{className:"flex items-center gap-1.5 px-2.5 py-2 border-b border-ink/10",children:[e(U,{size:12,className:"text-ink/40 shrink-0"}),e("input",{autoFocus:!0,value:h,onInput:(N)=>v(N.currentTarget.value),placeholder:"Search models…",className:"flex-1 bg-transparent text-xs text-ink outline-none placeholder:text-ink/35"})]}),e("div",{className:"max-h-64 scrollbar-overlay-container py-1",children:[e("button",{type:"button",onClick:()=>C(Bc),className:"w-full flex items-center justify-between gap-2 px-3 py-1.5 text-left text-xs hover:bg-ink/5 transition-colors cursor-pointer",children:[e("span",{className:t===Bc?"font-semibold text-ink":"text-ink/80",children:"Inherit Kabmo’s default"}),t===Bc&&e(f,{size:13,className:"text-ink"})]}),k.length===0?e("p",{className:"px-3 py-2 text-[11px] text-ink/50",children:r.length===0?"The catalog is empty.":`No model matches “${h.trim()}”.`}):k.map((N)=>{let A=Ih({provider:N.provider,modelId:N.id}),T=t===A;return e("button",{type:"button",onClick:()=>C(A),className:"w-full flex items-center justify-between gap-2 px-3 py-1.5 text-left hover:bg-ink/5 transition-colors cursor-pointer",children:[e("span",{className:"min-w-0 flex flex-col",children:[e("span",{className:`truncate text-xs ${T?"font-semibold text-ink":"text-ink/85"}`,children:N.name}),e("span",{className:"truncate text-[10.5px] text-ink/45",children:N.provider})]}),T&&e(f,{size:13,className:"text-ink shrink-0"})]},A)})]}),t!==Bc&&e("button",{type:"button",onClick:()=>C(Bc),className:"w-full flex items-center gap-1.5 px-3 py-2 border-t border-ink/10 text-[11px] text-ink/60 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer",children:[e(b,{size:11}),e("span",{children:"Clear the project model"})]})]})]})]})]})}function Qi({accentColor:t,onSelectColor:r,options:l=Fg,disabled:c=!1}){let p=l.length>0?l:Fg,g=t.trim().toLowerCase(),h=p.some((F)=>F.value!==""&&F.value.toLowerCase()===g),v=g!==""&&!h,y=_m(g)??Im,[w,k]=n(y);o(()=>k(y),[y]);let C=(F)=>{let S=_m(F);if(S===null){k(y);return}if(k(S),S!==g)r(S)},N=i(null),A=i(null),T=i({commit:C,clear:()=>r("")});return T.current={commit:C,clear:()=>r("")},o(()=>{let F=N.current,S=A.current;if(!F||!S)return;let M=(H)=>k(H.target.value.toLowerCase()),I=(H)=>T.current.commit(H.target.value),O=()=>{let H=S.value.trim();if(H==="")T.current.clear();else T.current.commit(H)},j=(H)=>{if(H.key==="Enter")H.preventDefault(),O();if(H.key==="Escape")k(y)};return F.addEventListener("input",M),F.addEventListener("change",I),S.addEventListener("blur",O),S.addEventListener("keydown",j),()=>{F.removeEventListener("input",M),F.removeEventListener("change",I),S.removeEventListener("blur",O),S.removeEventListener("keydown",j)}},[y]),e("div",{className:"space-y-2.5",children:[e("h4",{className:"text-xs font-semibold text-ink",children:"Accent colour"}),e("div",{className:"flex flex-wrap items-center gap-2.5",children:p.map((F)=>{let S=g===F.value.toLowerCase();if(F.value==="")return e("button",{type:"button",onClick:()=>r(""),disabled:c,"aria-label":"No accent colour","aria-pressed":S,title:"No accent colour",className:`w-7 h-7 rounded-full border flex items-center justify-center transition-all cursor-pointer disabled:opacity-50 ${S?"border-ink bg-ink/10 ring-2 ring-ink/30 ring-offset-2 ring-offset-paper":"border-ink/25 bg-paper hover:border-ink/50 text-ink/60"}`,children:e(b,{size:12,strokeWidth:2.2})},"none");return e("button",{type:"button",onClick:()=>r(F.value),disabled:c,"aria-label":F.label,"aria-pressed":S,title:F.label,style:{backgroundColor:F.bgHex},className:`w-7 h-7 rounded-full transition-all cursor-pointer shadow-2xs disabled:opacity-50 ${S?"ring-2 ring-ink ring-offset-2 ring-offset-paper scale-105":"hover:scale-105 opacity-90 hover:opacity-100"}`},F.value)})}),e("div",{className:"flex items-center gap-2 pt-0.5",children:[e("label",{title:"Pick a custom accent colour",className:`relative w-7 h-7 shrink-0 rounded-full border overflow-hidden cursor-pointer transition-all ${v?"ring-2 ring-ink ring-offset-2 ring-offset-paper":"border-ink/25 hover:border-ink/50"} ${c?"opacity-50 pointer-events-none":""}`,children:[e("span",{"aria-hidden":"true",className:"absolute inset-0",style:{backgroundColor:w}}),e(Pr,{size:12,strokeWidth:2.2,"aria-hidden":"true",className:"absolute inset-0 m-auto text-white/90 mix-blend-difference pointer-events-none"}),e("input",{ref:N,type:"color",value:_m(w)??Im,disabled:c,"aria-label":"Custom accent colour",className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer"})]}),e("input",{ref:A,type:"text",value:w,disabled:c,spellcheck:!1,"aria-label":"Custom accent colour hex",placeholder:Im,onInput:(F)=>k(F.currentTarget.value),className:"w-[86px] bg-paper border border-ink/20 rounded-md px-2 py-1 text-[11px] font-mono text-ink outline-none focus:border-ink/60 transition-colors disabled:opacity-50"}),e("span",{className:"text-[11px] text-ink/45",children:v?"Custom accent":"Pick any colour"})]})]})}var eo=128,Iu=700000;async function Au(t){let r=Promise.withResolvers(),l=new FileReader;l.onload=(A)=>{let T=A.target?.result;if(typeof T==="string"&&T)r.resolve(T);else r.reject(Error("That file could not be read as an image."))},l.onerror=()=>r.reject(Error("That file could not be read as an image.")),l.readAsDataURL(t);let c=await r.promise;if(t.type==="image/svg+xml")return c;let p=Promise.withResolvers(),g=new Image;g.onload=()=>p.resolve(g),g.onerror=()=>p.reject(Error("That file is not an image Kabmo can read.")),g.src=c;let h=await p.promise,v=Math.min(1,eo/Math.max(h.naturalWidth,h.naturalHeight)),y=Math.max(1,Math.round(h.naturalWidth*v)),w=Math.max(1,Math.round(h.naturalHeight*v)),k=document.createElement("canvas");k.width=y,k.height=w;let C=k.getContext("2d");if(!C)return c;C.drawImage(h,0,0,y,w);let N=k.toDataURL("image/png");return N.length>0&&N.length<c.length?N:c}function Zi({currentIcon:t,customIconUrl:r,projectName:l,onSelectIcon:c,onSetCustomIcon:p,disabled:g=!1}){let h=i(null),[v,y]=n(!1),[w,k]=n(!1),[C,N]=n(null),A=async(S)=>{let M=S.currentTarget.files?.[0];if(S.currentTarget.value="",!M)return;N(null),k(!0);try{let I=await Au(M);if(I.length>Iu){N("That image is too detailed to store as a mark — try a PNG or SVG.");return}p(I)}catch(I){N(I instanceof Error?I.message:String(I))}finally{k(!1)}},T=()=>{let M=`https://api.dicebear.com/7.x/identicon/svg?seed=${l.toLowerCase().replace(/[^a-z0-9]/g,"")||"project"}&radius=50&size=${eo}`;N(null),y(!0);let I=new Image;I.onload=()=>{y(!1),p(M)},I.onerror=()=>{y(!1),N("The generated icon could not be loaded — check your connection.")},I.src=M},F=g||w||v;return e("div",{className:"space-y-3",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("h4",{className:"text-xs font-semibold text-ink",children:"Project icon"}),r&&e("button",{type:"button",onClick:()=>p(void 0),disabled:F,className:"text-[11px] text-ink/50 hover:text-error transition-colors cursor-pointer disabled:opacity-50",children:"Use a standard icon"})]}),e("div",{className:"flex flex-wrap gap-1.5",children:Bh.map((S)=>{let M=!r&&t===S.id,I=S.icon;return e("button",{type:"button",onClick:()=>c(S.id),disabled:F,"aria-label":S.label,"aria-pressed":M,title:S.label,className:`w-7 h-7 rounded-md flex items-center justify-center transition-all cursor-pointer disabled:opacity-50 ${M?"border border-ink/40 bg-ink/5 text-ink shadow-2xs":"border border-transparent text-ink/60 hover:text-ink hover:bg-ink/5"}`,children:e(I,{size:14,strokeWidth:1.8})},S.id)})}),e("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[e("input",{type:"file",ref:h,onChange:(S)=>void A(S),accept:"image/png,image/jpeg,image/svg+xml,image/webp,image/gif",className:"hidden"}),e("button",{type:"button",onClick:()=>h.current?.click(),disabled:F,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-ink/20 hover:border-ink/40 bg-paper text-ink text-xs font-medium transition-colors cursor-pointer shadow-2xs disabled:opacity-50",children:[w?e(m,{size:13,className:"animate-spin text-ink/60"}):e(Ji,{size:13,className:"text-ink/60"}),e("span",{children:w?"Reading…":"Upload image"})]}),e("button",{type:"button",onClick:T,disabled:F,title:"Generate a stable identicon from the project name",className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-ink/20 hover:border-ink/40 bg-paper text-ink text-xs font-medium transition-colors cursor-pointer shadow-2xs disabled:opacity-50",children:[v?e(m,{size:13,className:"animate-spin text-ink/60"}):e(gr,{size:13,className:"text-ink/60"}),e("span",{children:v?"Generating…":"Generate mark"})]}),r&&e("div",{className:"flex items-center gap-2 ml-1 pl-2 border-l border-ink/10",children:[e("img",{src:r,alt:"Current custom icon",className:"w-5 h-5 rounded-xs object-contain border border-ink/15",referrerPolicy:"no-referrer"}),e("span",{className:"text-[11px] text-ink/60",children:"Custom icon in use"}),e("button",{type:"button",onClick:()=>p(void 0),disabled:F,"aria-label":"Remove the custom icon",className:"p-0.5 rounded text-ink/40 hover:text-error transition-colors cursor-pointer disabled:opacity-50",children:e(b,{size:12})})]})]}),e("p",{className:"text-[11px] text-ink/50",children:["Any image works — it is scaled down to a ",eo,"px mark. PNG, JPEG, WebP, GIF or SVG."]}),C&&e("p",{className:"text-[11px] text-error",children:C})]})}function ta({project:t,canDelete:r,isDeleting:l=!1,isRevealing:c=!1,models:p,accentColorOptions:g,onUpdateField:h,onUpdateFields:v,onReveal:y,onDeleteProject:w}){return e("div",{className:"p-6 md:p-8 space-y-7",children:[e(zi,{project:t,canDelete:r,isDeleting:l,onDelete:w}),e(qi,{name:t.name,onCommit:(k)=>h("name",k)}),e(Vi,{path:t.path,onCommit:(k)=>h("path",k),onReveal:y,isRevealing:c}),e(Yi,{model:t.model,models:p,onSelectModel:(k)=>h("model",k)}),e(Qi,{accentColor:t.accentColor,onSelectColor:(k)=>h("accentColor",k),...g&&g.length>0?{options:g}:{}}),e(Zi,{currentIcon:t.icon,customIconUrl:t.customIconUrl,projectName:t.name,onSelectIcon:(k)=>v({icon:k,customIconUrl:void 0}),onSetCustomIcon:(k)=>v({customIconUrl:k,icon:k===void 0?"default":"custom"})})]})}function Ru(t){return(t.replace(/[\\/]+$/,"").split(/[\\/]/).pop()??"").toLowerCase()}function Eu({isSaving:t,onClose:r,onSubmit:l}){let[c,p]=n(""),[g,h]=n(""),[v,y]=n(!1),[w,k]=n(!0),[C,N]=n(null),A=(F)=>{if(h(F),w||!c.trim())p(Ru(F)),k(!0)},T=async()=>{let F=c.trim();if(!F){N("Enter a project name.");return}N(null);try{await l({name:F,path:g.trim()}),r()}catch(S){N(S instanceof Error?S.message:String(S))}};return e(d,{children:e(Z,{onClose:t?()=>{}:r,ariaLabel:"Add project",maxWidthClass:"max-w-[480px]",header:e("div",{className:"min-w-0",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Add project"}),e("p",{className:"text-[11px] text-ink/50",children:"A name, and the directory its chats run in."})]}),footer:e("div",{className:"flex items-center justify-end gap-2 px-5 py-3.5 border-t border-ink/10",children:[e("button",{type:"button",onClick:r,disabled:t,className:"px-3.5 py-1.5 rounded-md border border-ink/20 text-xs font-medium text-ink hover:bg-ink/5 transition-colors cursor-pointer disabled:opacity-50",children:"Cancel"}),e("button",{type:"button",onClick:()=>void T(),disabled:t,className:"px-3.5 py-1.5 rounded-md bg-ink text-canvas text-xs font-medium hover:opacity-90 transition-opacity cursor-pointer disabled:opacity-50 inline-flex items-center gap-1.5",children:[t&&e(m,{size:13,className:"animate-spin"}),e("span",{children:t?"Adding…":"Add project"})]})]}),children:[e("div",{className:"px-5 py-4 space-y-4",children:[e("div",{className:"space-y-1.5",children:[e("label",{htmlFor:"add-project-name",className:"block text-xs font-semibold text-ink",children:"Name"}),e("input",{id:"add-project-name",type:"text",value:c,onInput:(F)=>{p(F.currentTarget.value),k(!1)},placeholder:"e.g. kabmo",className:"w-full bg-paper border border-ink/20 rounded-md px-3 py-2 text-xs text-ink outline-none focus:border-ink/60 transition-colors"}),e("p",{className:"text-[11px] text-ink/50",children:"Unique: the sidebar identifies a workspace by it."})]}),e("div",{className:"space-y-1.5",children:[e("label",{htmlFor:"add-project-path",className:"block text-xs font-semibold text-ink",children:["Directory ",e("span",{className:"text-ink/40 font-normal",children:"(optional)"})]}),e("div",{className:"flex items-center gap-2",children:[e("input",{id:"add-project-path",type:"text",value:g,onInput:(F)=>h(F.currentTarget.value),placeholder:"~ or /absolute/path",spellcheck:!1,className:"flex-1 min-w-0 bg-paper border border-ink/20 rounded-md px-3 py-2 text-[11.5px] font-mono text-ink outline-none focus:border-ink/60 transition-colors"}),e("button",{type:"button",onClick:()=>y(!0),className:"shrink-0 inline-flex items-center gap-1 px-2.5 py-2 rounded-md border border-ink/20 hover:border-ink/40 text-[11px] font-medium text-ink transition-colors cursor-pointer",children:[e(Vt,{size:12}),e("span",{children:"Browse…"})]})]}),e("p",{className:"text-[11px] text-ink/50",children:"Sessions under this directory are listed in the project. Leave it empty for a grouping with no directory behind it."})]}),C&&e("p",{className:"text-[11px] text-error",children:C})]}),v&&e(Ec,{initialPath:g||void 0,onSelect:(F)=>{A(F),y(!1)},onClose:()=>y(!1)})]})})}function oa({isOpen:t,isSaving:r,onClose:l,onSubmit:c}){if(!t)return null;return e(Eu,{isSaving:r,onClose:l,onSubmit:c})}function aa({project:t,isDeleting:r,error:l,onClose:c,onConfirm:p}){if(o(()=>{let g=(h)=>{if(h.key!=="Escape"||r)return;h.preventDefault(),c()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[c,r]),!t)return null;return e(Z,{onClose:r?()=>{}:c,zClass:"z-[70]",maxWidthClass:"max-w-[440px]",ariaLabel:"Delete project",header:e("div",{className:"flex items-center gap-3 min-w-0",children:[e(L,{size:16,className:"text-error shrink-0"}),e("div",{className:"min-w-0",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Delete project?"}),e("p",{className:"text-[11px] text-ink/50 truncate",children:t.name})]})]}),footer:e("div",{className:"flex items-center justify-end gap-2 px-5 py-3.5 border-t border-ink/10",children:[e("button",{type:"button",onClick:c,disabled:r,className:"px-3.5 py-1.5 rounded-md border border-ink/20 text-xs font-medium text-ink hover:bg-ink/5 transition-colors cursor-pointer disabled:opacity-50",children:"Cancel"}),e("button",{type:"button",onClick:p,disabled:r,className:"px-3.5 py-1.5 rounded-md bg-error text-canvas text-xs font-medium hover:opacity-90 transition-opacity cursor-pointer disabled:opacity-50 flex items-center gap-1.5",children:[r?e(m,{size:13,className:"animate-spin"}):e(L,{size:13}),e("span",{children:r?"Deleting…":"Delete project"})]})]}),children:e("div",{className:"px-5 py-4 space-y-3",children:[e("ul",{className:"text-[11.5px] leading-relaxed text-ink/70 space-y-1.5",children:[e("li",{children:"The workspace is unregistered from Kabmo — its place in the sidebar, its chats' grouping and its settings go."}),e("li",{children:t.path?"The directory itself is NOT deleted; a tombstone keeps omp discovery from re-adding it on the next boot.":"It has no directory, so nothing on disk is touched."}),e("li",{children:"Chat transcripts stay on disk under ~/.omp/agent/sessions."})]}),l&&e("div",{className:"flex items-start gap-2 px-3 py-2 rounded-md border border-error/30 bg-error/5 text-[11px] text-ink/75",children:[e(_,{size:13,className:"mt-0.5 shrink-0 text-error"}),e("span",{children:l})]})]})})}var to="worktreeDirectory",no="worktreeCarryIgnored";function sa(t){if(t.missing)return"folder is missing — its chats still open";let r=t.detached?`detached @ ${t.head.slice(0,7)||"unknown"}`:`${t.branch} checked out here`,l=t.sessions===1?"1 chat":`${t.sessions} chats`,c=t.dirty===0?"clean":`${t.dirty} changed`;return`${r} · ${l} · ${c}`}function la(t){return!t.detached&&Boolean(t.branch)&&t.aheadOfStart===0}function oo(t){if(t.isPrimary)return"The main checkout cannot be removed.";if(t.dirty>0)return`${t.dirty} uncommitted file${t.dirty===1?"":"s"} here would be lost.`;return null}function da({root:t,folderId:r,onReport:l}){let{worktrees:c,base:p,loading:g,error:h,isRepo:v,refresh:y}=Sm({root:t,folderId:r},Boolean(t)),[w,k]=n(()=>{let S=R(to);return typeof S==="string"?S:""}),[C,N]=n(()=>R(no)!==!1),[A,T]=n(null);if(!t)return e("p",{className:"text-xs text-ink/50",children:"Bind this workspace to a repository to manage its worktrees."});let F=c.filter((S)=>!S.isPrimary);return e("div",{className:"flex flex-col gap-4",children:[e("section",{className:"flex flex-col gap-1",children:[e("h3",{className:"text-xs font-semibold text-ink",children:"Worktrees"}),g&&e("p",{className:"text-[11px] text-ink/50",children:"Reading worktrees…"}),h&&e("p",{className:"text-[11px] text-error",title:h,children:["Worktrees could not be read: ",h]}),!g&&!h&&v===!1&&e("p",{className:"text-[11px] text-ink/50",children:"Worktrees need a Git repository."}),!g&&!h&&v!==!1&&F.length===0&&e("p",{className:"text-[11px] text-ink/50",children:"No worktrees yet."}),F.map((S)=>e("div",{className:"group flex items-center gap-2 rounded-md px-1 py-1.5 hover:bg-ink/5",children:[e("div",{className:"min-w-0 flex-1",children:[e("p",{className:"truncate text-xs text-ink",children:S.branch||"detached"}),e("p",{className:"truncate text-[10.5px] text-ink/50",title:S.path,children:sa(S)})]}),e("button",{type:"button",disabled:A===S.path||oo(S)!==null,"aria-label":`Remove worktree ${S.branch||S.path}`,title:oo(S)??"Remove worktree",onClick:()=>{T(S.path),Sh({root:t,folderId:r},S.path,{deleteBranch:la(S)}).then((M)=>(l(M.branchDeleted?`Removed ${S.branch} and its branch`:`Removed ${S.branch}${M.branchKept?" (branch kept)":""}`,"success"),y())).catch((M)=>l(M instanceof Error?M.message:String(M),"error")).finally(()=>T(null))},className:"shrink-0 rounded px-2 py-1 text-[11px] text-ink/60 hover:bg-error/10 hover:text-error disabled:opacity-40",children:"Remove"})]},S.path))]}),e("label",{className:"flex flex-col gap-1",children:[e("span",{className:"text-xs font-semibold text-ink",children:"Worktree location"}),e("input",{value:w,onChange:(S)=>k(S.currentTarget.value),onBlur:()=>it(to,w.trim()),placeholder:p,className:"h-8 rounded-md border border-ink/15 bg-paper px-2 text-xs text-ink outline-none focus:border-ink/40"}),e("span",{className:"text-[10.5px] text-ink/50",children:["Where new worktrees are created. Relative paths are resolved against the project; ~ is your home directory. Empty uses ",p,"."]})]}),e("label",{className:"flex items-start gap-2",children:[e("input",{type:"checkbox",checked:C,onChange:(S)=>{let M=S.currentTarget.checked;N(M),it(no,M)},className:`${be} mt-0.5`}),e("span",{className:"flex flex-col gap-0.5",children:[e("span",{className:"text-xs font-semibold text-ink",children:"Copy ignored files into new worktrees"}),e("span",{className:"text-[10.5px] text-ink/50",children:"A new worktree gets the project's ignored build folders (node_modules, .venv, target) copied in, so it works without reinstalling."})]})]})]})}var Mu={full:"flex h-full w-full items-center justify-center text-xs text-ink/40",fill:"flex-1 flex items-center justify-center text-xs text-ink/40"},Le=({variant:t="full",children:r})=>e("div",{className:Mu[t],children:r});var dn="";function ca(t){if(!x(t))return!1;return typeof t.id==="string"&&typeof t.name==="string"&&typeof t.path==="string"}function Lu(t){if(!x(t))return!1;return typeof t.label==="string"&&typeof t.value==="string"&&typeof t.bgHex==="string"}function Ou(t,r){return t.some((c)=>c.id===r.id)?t.map((c)=>c.id===r.id?r:c):[...t,r]}function pa(t){let[r,l]=n([]),[c,p]=n([]),[g,h]=n(dn),[v,y]=n(!0),[w,k]=n(null),[C,N]=n(!1),[A,T]=n(!1),F=i(t);F.current=t;let S=a((z)=>{if(!x(z))return;let V=Array.isArray(z.projects)?z.projects.filter(ca):null;if(V)l(V),h((X)=>V.some((ee)=>ee.id===X)?X:V[0]?.id??dn);if(Array.isArray(z.accentColorOptions))p(z.accentColorOptions.filter(Lu))},[]),M=a(async()=>{try{let z=await fetch("/api/settings/projects"),V=await z.json();if(!z.ok){let X=x(V)&&typeof V.error==="string"?V.error:`HTTP ${z.status}`;k(X);return}k(null),S(V)}catch(z){k(z instanceof Error?z.message:String(z))}},[S]);o(()=>{let z=!0;return(async()=>{if(await M(),z)y(!1)})(),()=>{z=!1}},[M]);let I=Ve().folders,O=u(()=>I.map((z)=>`${z.id}:${z.name}:${z.model??""}:${z.icon??""}:${z.accentColor??""}:${z.project_path??""}:${z.isPinned?1:0}`).join("|"),[I]);o(()=>{if(!O)return;M()},[O,M]);let j=a(async(z,V)=>{if(z.folderId===void 0)return F.current("This project has no workspace row to save to."),!1;let X=r;l((ie)=>ie.map((te)=>te.id===z.id?{...te,...V}:te));let ee={folderId:z.folderId};for(let[ie,te]of Object.entries(V))ee[ie]=te===void 0?null:te;try{let ie=await fetch("/api/settings/projects",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:ee})}),te=await ie.json().catch(()=>null);if(!ie.ok){let Q=x(te)&&typeof te.error==="string"?te.error:`HTTP ${ie.status}`;throw Error(Q)}let ae=x(te)&&ca(te.project)?te.project:null;if(ae)l((Q)=>Ou(Q,ae));return!0}catch(ie){return l(X),F.current(ie instanceof Error?ie.message:String(ie)),!1}},[r]),H=a((z,V,X)=>j(z,{[V]:X}),[j]),K=a((z,V)=>j(z,V),[j]),Y=a(async(z)=>{N(!0);try{let V=await fetch("/api/folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:z.name,path:z.path})}),X=await V.json().catch(()=>null),ee=x(X)?X.folder:null,ie=x(ee)&&typeof ee.id==="number"?ee.id:null;if(!V.ok||!x(X)||X.success!==!0||ie===null){let te=x(X)&&typeof X.error==="string"?X.error:`HTTP ${V.status}`;throw Error(te)}await M(),h(`folder-${ie}`)}catch(V){throw F.current(V instanceof Error?V.message:String(V)),V}finally{N(!1)}},[M]),G=a(async(z)=>{T(!0);try{let V=await fetch(`/api/settings/projects?id=${encodeURIComponent(z.id)}`,{method:"DELETE"}),X=await V.json().catch(()=>null);if(!V.ok||!x(X)||X.success!==!0){let ee=x(X)&&typeof X.error==="string"?X.error:`HTTP ${V.status}`;throw Error(ee)}l((ee)=>{let ie=ee.filter((te)=>te.id!==z.id);return h((te)=>te===z.id?ie[0]?.id??dn:te),ie})}catch(V){throw F.current(V instanceof Error?V.message:String(V)),V}finally{T(!1)}},[]),W=Ya((z)=>Array.isArray(z.modelList)&&z.modelList.length>0?z.modelList.map((V)=>({provider:V.provider,id:V.id,name:V.name||V.id})):void 0)??[],q=r.find((z)=>z.id===g)??r[0]??null;return{projects:r,selected:q,selectedId:q?.id??dn,select:h,accentColorOptions:c,models:W,isLoading:v,loadError:w,refresh:M,updateField:H,updateFields:K,isAdding:C,addProject:Y,isDeleting:A,deleteProject:G,onError:t}}function ua(){let t=Pe(),{pushToast:r}=He(),[l,c]=n(!1),[p,g]=n(null),[h,v]=n(null),[y,w]=n(null),k=pa((F)=>r(F,"error",{duration:7000})),{folders:C}=Ve(),N=async(F)=>{if(!F.path||F.folderId===void 0){r("This project is not bound to a directory.","error");return}w(F.id);try{let S=await fetch(`/api/folders/${F.folderId}/open`,{method:"POST"}),M=await S.json().catch(()=>null);if(!S.ok){let I=M&&typeof M==="object"&&"error"in M&&typeof M.error==="string"?M.error:`HTTP ${S.status}`;throw Error(I)}}catch(S){r(S instanceof Error?S.message:String(S),"error")}finally{w(null)}},A=async()=>{if(!p)return;v(null);try{await k.deleteProject(p),g(null),t.back()}catch(F){v(F instanceof Error?F.message:String(F))}};if(k.isLoading)return e(Le,{children:"Loading projects…"});let T=k.selected;return e("div",{className:"w-full h-full flex flex-col overflow-hidden bg-paper text-ink",children:[e(Ce,{pane:t.pane,onBack:t.back,listLabel:"Projects",list:e(Ki,{projects:k.projects,selectedProjectId:T?.id??"",onSelectProject:(F)=>{k.select(F),t.openDetail()},onAddProject:()=>c(!0),onTogglePin:(F)=>{k.updateField(F,"isPinned",!F.isPinned)},isAdding:k.isAdding,folderFacts:C,loadError:k.loadError}),detail:T?e("div",{className:"flex-1 min-h-0 scrollbar-overlay-container flex flex-col",children:[e(ta,{project:T,canDelete:k.projects.length>1,isDeleting:k.isDeleting&&p?.id===T.id,isRevealing:y===T.id,models:k.models,accentColorOptions:k.accentColorOptions,onUpdateField:(F,S)=>{k.updateField(T,F,S)},onUpdateFields:(F)=>{k.updateFields(T,F)},onReveal:()=>void N(T),onDeleteProject:()=>{v(null),g(T)}}),e("div",{className:"border-t border-ink/10 px-6 md:px-8 py-4",children:e(da,{root:T.path||null,folderId:T.folderId??null,onReport:(F,S)=>r(F,S??"success",{duration:6000})})})]}):e("div",{className:"flex-1 flex items-center justify-center px-6 text-center",children:e("div",{className:"space-y-2",children:[e("p",{className:"text-xs text-ink/60",children:"No project selected."}),e("button",{type:"button",onClick:()=>c(!0),className:"text-[11px] font-medium text-ink underline underline-offset-2 hover:no-underline cursor-pointer",children:"Add a project"})]})})}),e(oa,{isOpen:l,isSaving:k.isAdding,onClose:()=>c(!1),onSubmit:async(F)=>{await k.addProject(F),t.openDetail()}}),e(aa,{project:p,isDeleting:k.isDeleting,error:h,onClose:()=>{g(null),v(null)},onConfirm:()=>void A()})]})}var Uu=/^[A-Za-z0-9_-]{1,64}$/,ma=/[<>\n\r]/;function ga(t){if(!t||typeof t!=="object"||Array.isArray(t))return!1;let r=t;return typeof r.id==="string"&&Uu.test(r.id)&&typeof r.name==="string"&&r.name.trim().length>0&&r.name.length<=128&&!ma.test(r.name)&&typeof r.email==="string"&&r.email.trim().length>0&&r.email.length<=254&&r.email.includes("@")&&!ma.test(r.email)}var fa="w-full bg-paper border border-ink/20 rounded-md px-2.5 py-1.5 text-[11px] text-ink placeholder-ink/40 outline-none focus:border-ink/40 transition-colors";function ha({settings:t,onUpdate:r}){let l=t.gitIdentities??[],[c,p]=n(null),[g,h]=n(!0),[v,y]=n(null),[w,k]=n(null),[C,N]=n(""),[A,T]=n("");o(()=>{let j=!0;return h(!0),fetch("/api/settings/git-identity").then(async(H)=>{let K=await H.json().catch(()=>null);if(!H.ok||!K)throw Error(K?.error||`Request failed (HTTP ${H.status})`);if(j)p({global:K.global,appliedId:K.appliedId})}).catch((H)=>{if(j)k(H instanceof Error?H.message:String(H))}).finally(()=>{if(j)h(!1)}),()=>{j=!1}},[]);let F=async(j)=>{y(j||"global"),k(null);try{let H=await fetch("/api/settings/git-identity",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identityId:j})}),K=await H.json().catch(()=>null);if(!H.ok||!K)throw Error(K?.error||`Request failed (HTTP ${H.status})`);p({global:K.global,appliedId:K.appliedId})}catch(H){k(H instanceof Error?H.message:String(H))}finally{y(null)}},S=()=>{let j={id:typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`id-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:C.trim(),email:A.trim()};if(!ga(j)){k("Enter a name and a valid email address.");return}r({gitIdentities:[...l,j]}),N(""),T(""),k(null)},M=async(j)=>{if(c?.appliedId===j)await F("");r({gitIdentities:l.filter((H)=>H.id!==j)})},I=c?.appliedId??"",O=c?.global??null;return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Commit Identity"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"The name and email a commit carries. Applying an identity writes it to your global git config."})]}),e("div",{className:"rounded-lg border border-ink/15 bg-paper p-3.5 space-y-2",children:[e("label",{className:"block text-[10px] font-semibold uppercase tracking-wider text-ink/45",children:"Commit as"}),e(Ue,{ariaLabel:"Commit identity",value:I,onChange:(j)=>void F(j),disabled:g||v!==null,placeholder:"Global config",searchable:l.length>8,options:[{value:"",label:"Global config",hint:"git's own user.name / user.email"},...l.map((j)=>({value:j.id,label:j.name,hint:j.email}))]}),e("p",{className:"text-[10px] text-ink/50",children:[g?"Reading git config…":O?`Current: ${O.name} <${O.email}>`:"No identity configured",v?" · applying…":""]})]}),l.length>0&&e("details",{className:"rounded-lg border border-ink/15 bg-paper",children:[e("summary",{className:"px-3.5 py-2.5 text-[10px] font-semibold uppercase tracking-wider text-ink/45 cursor-pointer select-none",children:["Manage saved identities (",l.length,")"]}),e("div",{className:"divide-y divide-ink/10 border-t border-ink/10 max-h-48 overflow-y-auto",children:l.map((j)=>e("div",{className:"flex items-center gap-3 px-3.5 py-2.5",children:[e("div",{className:"min-w-0 flex-1",children:[e("div",{className:"text-xs font-semibold text-ink truncate",children:j.name}),e("div",{className:"text-[10px] text-ink/50 truncate",children:j.email})]}),e("button",{type:"button",onClick:()=>void M(j.id),"aria-label":`Remove ${j.name}`,className:"p-1.5 rounded text-ink/40 hover:text-error hover:bg-ink/5 transition-colors cursor-pointer",children:e(L,{size:12})})]},j.id))})]}),w&&e("p",{className:"text-[10px] text-error",children:w}),e("div",{className:"rounded-lg border border-ink/15 bg-paper p-3.5 space-y-3",children:[e("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[e("input",{type:"text",value:C,onChange:(j)=>{N(j.currentTarget.value),k(null)},placeholder:"User name",className:fa}),e("input",{type:"text",value:A,onChange:(j)=>{T(j.currentTarget.value),k(null)},onKeyDown:(j)=>{if(j.key==="Enter")j.preventDefault(),S()},placeholder:"Email address",className:fa})]}),e("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e("p",{className:"text-[10px] text-ink/50",children:"Saved identities are a library; pick one above to apply it globally."}),e("button",{type:"button",onClick:S,className:"flex items-center gap-1.5 px-2.5 py-1 rounded bg-ink text-canvas text-[10px] font-medium hover:bg-ink/90 transition-colors cursor-pointer",children:[e(P,{size:11})," Add identity"]})]})]}),e("p",{className:"text-[10px] text-ink/45 leading-relaxed",children:"Applying writes `user.name` and `user.email` to your global git config. Global config restores what was there before Kabmo wrote."})]})}var Sa=[{key:"scope",description:"“the staged change set”, or “the commit being amended”."},{key:"branch",description:"The current branch name."},{key:"recent_commits",description:"The last ten subjects, newest first."},{key:"files",description:"The files in this commit."},{key:"diff",description:"The staged patch. Required."},{key:"truncated",description:"A note when the diff was cut to fit the model."}],kt=`You write git commit messages. Return only the commit message, no prose, no code fences.
1
+ import{d,en,n,o,i,u,a,ht,oe,Ot,ba,Gi,fA,e,s,yo,E,ne,De,Ua,yn,Mn,Tn,m,nn,Se,rn,L,_,Js,an,ya,vn,Zs,va,on,Ze,Cr,f,B,se,vo,ri,Wr,oi,re,Xe,Kr,fe,Be,Tt,We,Vt,xt,me,Fe,ja,ce,xo,ka,Vr,Jr,mn,sn,xa,li,Hi,wa,Zn,zn,ci,Br,Wi,P,Co,Ir,D,wt,U,Ba,Eo,mr,fr,Xn,$t,Ne,Zr,Ji,b,x,kA,Xi,Kp,dc,Vp,xA,gn,ui,tl,R,wA,it,hr,Te,bg,Xu,tr,CA,Dt,st,ue,lt,es,Z,Ct,Yt,xg,ge,il,He,be,sl,is,cn,zA,UA,tm,GA,jA,nm,qA,rm,am,_o,HA,WA,om,wg,im,J,Et,Qt,dt,Ka,mm,Cg,ZA,XA,eh,th,nh,rh,ah,bc,oh,ih,Eg,fi,sh,lh,fm,ss,ch,uh,yc,dh,gm,ph,mh,Am,fh,gh,Ah,hm,hh,vc,id,ea,kc,bm,To,Va,na,_a,ym,sd,vm,km,yh,vh,kh,Sg,xh,Tg,Dg,xm,Ke,tt,dl,wh,Ng,un,ls,Ya,xc,Cm,cs,Bt,No,Em,Qg,Eh,Rg,cd,Bm,Cc,Bh,ra,Ec,Bc,Ih,_h,Im,_m,Fg,Sm,Sh,Ic,_c,Tm,Sc,us,Dm,Ve,Tc,ds,Dc,ps,Ja,Nc,Qc,Rc,Nm}from"./index-4cag7w6k.js";import{Ff}from"./index-xwjbq003.js";import{mt,Rd,Fd,Ld,fu,Md,Pd,Dl,hu,Is,Nl,Ei}from"./index-83rkg916.js";import{ia,Su,zs,Yg,Tu,Du}from"./index-hgzntg2j.js";function Qo(t,r,l){let c={},p=typeof l==="function"?Object.keys(r):Object.keys(l);for(let g of p)if(r[g]!==t[g])c[g]=r[g];return c}var Zo="color";var er=["color","monochrome"];function gp(t){return t==="color"||t==="monochrome"}function nr(t){return gp(t)?t:"color"}var or={color:{label:"Full colour",description:"The shipped app icon, plate and all. Matches the icon in the Dock, the taskbar and the launcher.",caption:"App icon"},monochrome:{label:"Monochrome",description:"A greyscale conversion of the app icon: the green plate and the cream strokes swap luminance with the theme, and the orange arm becomes the middle grey.",caption:"Greyscale"}};var rr={theme:sl,editorFont:id,editorTheme:kc,autoSessionTitle:!0,commitMessageMode:"auto",commitMessageHarness:"",commitMessageModel:"",commitMessagePrompt:"",gitIdentities:[],soundAlerts:!0,chatCompletionSound:!0,notifyDesktopEnabled:!0,notifyMobileEnabled:!0,notifyOnFinish:!1,notifyOnAsk:!1,notifyOnError:!1,goalAuditEnabled:!0,goalAuditModel:"",goalDefaultBudget:null,chatWidthMode:mm,chatColumnWidth:ZA,toolRenderStyle:eh,showChangedFiles:!0,sidebarStyle:rh,leftPanelNav:Eg,rightPanelNav:Eg,mobileLeftPanelNav:fm,mobileRightPanelNav:fm,composerStyle:uh,surfaceStyle:ph,borderStyle:gh,iconStyle:GA,trayIconStyle:Zo,followUpBehavior:"queue",keybindingSend:"Enter",keybindingNewLine:"Shift + Enter",keybindingSteering:"Ctrl / Cmd + Enter"};function ir(){let[t,r]=n(!1),l=a(async()=>{r(!0);try{let c=await fetch("/api/omp/reload-engine",{method:"POST"}),p=await c.json().catch(()=>null);if(!c.ok||!p?.success)return{ok:!1,message:p?.error??`Reload failed (HTTP ${c.status})`};To(),na();let g=p.utility??0,h=p.prewarmed??0;return{ok:!0,message:g+h===0?"No standby omp processes were running — the next command starts the current build.":`Reloaded omp engine — ${g} utility, ${h} prewarmed process${g+h===1?"":"es"} recycled.`}}catch(c){return{ok:!1,message:c instanceof Error?c.message:"Failed to reload the omp engine."}}finally{r(!1)}},[]);return{isReloading:t,reload:l}}function ar(t={}){let{restart:r}=t,[l,c]=n(!1),p=a(async()=>{c(!0);try{let g=await sd(r),h=await fetch("/api/console/restart",{method:"POST"}),v=await h.json().catch(()=>null);if(!h.ok||!v?.success)return{ok:!1,message:v?.error??`Restart failed (HTTP ${h.status})`};if(!v.restarting)return{ok:!1,message:v.message??"This instance cannot be restarted from the console."};let y=await vm(g,r);if(y==="restarted")return window.location.reload(),{ok:!0,message:v.message??"Restarting — this page reloads on its own."};if(y==="timeout")return{ok:!1,message:`The server did not come back within ${Math.round((r?.timeoutMs??ym)/1000)} seconds — reload this page once it is up.`};return{ok:!1,message:"The restart was cancelled."}}catch(g){return{ok:!1,message:g instanceof Error?g.message:"Failed to restart Kabmo."}}finally{c(!1)}},[r]);return{isRestarting:l,restart:p}}function sr(t,r){if(typeof document<"u"&&r.theme)im(r.theme);if(typeof window<"u"&&r.editorFont!==t.editorFont)window.dispatchEvent(new CustomEvent(xm,{detail:r.editorFont}));if(typeof window<"u"&&r.editorTheme!==t.editorTheme)window.dispatchEvent(new CustomEvent(Rd,{detail:r.editorTheme}));if(r.chatWidthMode!==t.chatWidthMode)km(r.chatWidthMode,r.chatColumnWidth);if(r.toolRenderStyle!==t.toolRenderStyle)yh(r.toolRenderStyle);if(r.showChangedFiles!==t.showChangedFiles)vh(r.showChangedFiles);if(r.sidebarStyle!==t.sidebarStyle)kh(r.sidebarStyle);if(r.leftPanelNav!==t.leftPanelNav)Sg("left",r.leftPanelNav);if(r.rightPanelNav!==t.rightPanelNav)Sg("right",r.rightPanelNav);if(r.mobileLeftPanelNav!==t.mobileLeftPanelNav){if(Ff("left",r.mobileLeftPanelNav),r.mobileLeftPanelNav==="tabs")CA()}if(r.mobileRightPanelNav!==t.mobileRightPanelNav)Ff("right",r.mobileRightPanelNav);if(r.composerStyle!==t.composerStyle)xh(r.composerStyle);if(r.surfaceStyle!==t.surfaceStyle)Tg(r.surfaceStyle);if(r.borderStyle!==t.borderStyle)Dg(r.borderStyle);if(r.iconStyle!==t.iconStyle)wg(r.iconStyle)}var bp={name:"sliders-vertical",size:24,node:[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],aliases:["sliders"]},lr=s(bp);var fp={name:"square-check-big",size:24,node:[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],aliases:["check-square"]},dr=s(fp);var hp={name:"arrow-down-to-line",size:24,node:[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]},ot=s(hp);var vp={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]},cr=s(vp);var xp={name:"calendar-range",size:24,node:[["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M16 2v3",key:"otl347"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M17 13h-6",key:"1qbiup"}],["path",{d:"M13 17H7",key:"1x38vv"}],["path",{d:"M7 13h.01",key:"1vezk1"}],["path",{d:"M17 17h.01",key:"1sd3ek"}]]},pr=s(xp);var yp={name:"cloud",size:24,node:[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]},ur=s(yp);var kp={name:"compass",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]]},qt=s(kp);var wp={name:"dice-5",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 16h.01",key:"18s6g9"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]},gr=s(wp);var Sp={name:"dollar-sign",size:24,node:[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]},br=s(Sp);var Np={name:"file-diff",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]},vr=s(Np);var Pp={name:"folder-git",size:24,node:[["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M14 13h3",key:"1dgedf"}],["path",{d:"M7 13h3",key:"1pygq7"}]]},xr=s(Pp);var Cp={name:"folder-input",size:24,node:[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]},yr=s(Cp);var Tp={name:"hammer",size:24,node:[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]]},kr=s(Tp);var Ip={name:"image",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]},wr=s(Ip);var Ap={name:"key",size:24,node:[["path",{d:"m2 21 9.6-9.6",key:"9l79m3"}],["path",{d:"m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19",key:"fw8biw"}],["circle",{cx:"15.5",cy:"7.5",r:"5.5",key:"4wxmhb"}]]},yt=s(Ap);var Rp={name:"library",size:24,node:[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]},Sr=s(Rp);var Ep={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]},Jt=s(Ep);var Mp={name:"log-in",size:24,node:[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]},Nr=s(Mp);var Lp={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]},Xt=s(Lp);var Op={name:"pipette",size:24,node:[["path",{d:"m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12",key:"1y3wsu"}],["path",{d:"m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z",key:"110lr1"}],["path",{d:"m2 22 .414-.414",key:"jhxm08"}]]},Pr=s(Op);var Dp={name:"power",size:24,node:[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]},Tr=s(Dp);var Up={name:"store",size:24,node:[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]]},gt=s(Up);var $p={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]},Zt=s($p);var Fp={name:"volume-2",size:24,node:[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]},Wn=s(Fp);var jp={name:"volume-x",size:24,node:[["path",{d:"M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z",key:"1p7khw"}],["path",{d:"m16.5 14.5 5-5",key:"cul3yw"}],["path",{d:"m16.5 9.5 5 5",key:"1akey5"}]]},Ar=s(jp);var Bp={name:"waypoints",size:24,node:[["path",{d:"m10.586 5.414-5.172 5.172",key:"4mc350"}],["path",{d:"m18.586 13.414-5.172 5.172",key:"8c96vv"}],["path",{d:"M6 12h12",key:"8npq4p"}],["circle",{cx:"12",cy:"20",r:"2",key:"144qzu"}],["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}],["circle",{cx:"20",cy:"12",r:"2",key:"1xzzfp"}],["circle",{cx:"4",cy:"12",r:"2",key:"1hvhnz"}]]},qn=s(Bp);var Rr=["KABMO","CONNECT","WORKSPACE","OMP","HARNESSES"];var we="4rem",Er="calc(4rem + env(safe-area-inset-top, 0px))",xe="flex items-center flex-shrink-0 border-b border-ink/10";var Mr=[{id:"appearance",label:"Appearance",icon:wa,section:"KABMO",description:"Palette, shell layout, icons, and the code editor’s face, theme and behaviour."},{id:"chats",label:"Chats",icon:mn,section:"KABMO",description:"Chat width, composer style, tool call rendering, session titles, and goal mode."},{id:"keyboard",label:"Keyboard",icon:ka,section:"KABMO",description:"Every command shortcut, the composer Enter keys, and chord conflicts."},{id:"notifications",label:"Notifications",icon:va,section:"KABMO",description:"Completion sound, separate Desktop and Mobile delivery switches, and the finished, waiting-for-you and failed run triggers."},{id:"usage",label:"Usage",icon:yo,section:"KABMO",description:"Build minutes quota, storage, and general usage."},{id:"token-usage",label:"Token Usage",icon:oi,section:"KABMO",description:"Token telemetry, cache, and cost breakdown."},{id:"panel-plugins",label:"Plugins Kabmo",icon:Co,section:"KABMO",description:"Plugins installed into Kabmo: panels, background services, and the MCP servers they register."},{id:"connect",label:"Connect",icon:Ir,section:"CONNECT",description:"Tunnels, addresses, and the devices paired to this server."},{id:"projects",label:"Projects",icon:xr,section:"WORKSPACE",description:"Workspace directories, roots, and ignored paths."},{id:"git",label:"Git",icon:me,section:"WORKSPACE",description:"Commit message generation, the agent that writes it, and the prompt template."},{id:"omp",label:"OMP Engine",icon:Kr,section:"OMP",description:"Live agent state and native omp config keys."},{id:"providers",label:"Providers",icon:ur,section:"OMP",description:"AI model engines, endpoints, and credentials."},{id:"agents",label:"Agents",icon:Ze,section:"OMP",description:"Autonomous agent persona, self-healing, and reasoning."},{id:"behavior",label:"Behavior",icon:lr,section:"OMP",description:"Native AGENTS.md and RULES.md: global instructions, permission gates, and safety filters."},{id:"commands",label:"Commands",icon:Ne,section:"OMP",description:"Slash command macros and terminal shortcuts."},{id:"mcp",label:"MCP",icon:Cr,section:"OMP",description:"Model Context Protocol servers and dynamic tools."},{id:"plugins",label:"Plugins",icon:Wi,section:"OMP",description:"Installed omp plugins, marketplaces, features, and plugin settings."},{id:"skills",label:"Skills",icon:Sr,section:"OMP",description:"Manage downloaded skills and scripts."},{id:"skills-catalog",label:"Skills Catalog",icon:on,section:"OMP",description:"Browse and install new skills."},...Ng().map((t)=>({id:t.id,label:t.label,icon:qn,section:"HARNESSES",...t.harness?{harness:t.harness}:{},description:t.description}))];function Lr(t){let r=Ng(t&&t.length>0?t:void 0).map((c)=>({id:c.id,label:c.label,icon:qn,section:"HARNESSES",...c.harness?{harness:c.harness}:{},description:c.description}));return[...Mr.filter((c)=>c.section!=="HARNESSES"),...r]}function Vn({activeCategory:t,onSelectCategory:r,searchQuery:l,onSearchChange:c,onReloadOmp:p,isReloading:g,onRestartKabmo:h,isRestarting:v,disabledHarnesses:y=[],categories:w=Mr,className:k=""}){let C=w.filter((N)=>{if(N.harness&&y.includes(N.harness))return!1;if(!l.trim())return!0;let A=l.toLowerCase();return N.label.toLowerCase().includes(A)||N.section.toLowerCase().includes(A)||N.description.toLowerCase().includes(A)});return e("div",{className:`flex flex-col h-full bg-canvas border-r border-ink/10 text-ink select-none ${k}`,children:[e("div",{className:`${xe} px-3`,style:{height:we},children:e("div",{className:"relative flex w-full items-center",children:[e(U,{size:14,className:"absolute left-2.5 text-ink/40 pointer-events-none"}),e("input",{type:"text",placeholder:"Search settings",value:l,onChange:(N)=>c(N.currentTarget.value),className:"w-full bg-paper border border-ink/15 rounded-lg pl-8 pr-7 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors"}),l&&e("button",{type:"button",onClick:()=>c(""),className:"absolute right-2 text-ink/40 hover:text-ink p-0.5",children:e(b,{size:12})})]})}),e("div",{className:"flex-1 scrollbar-overlay-container p-2 space-y-4",children:C.length===0?e("div",{className:"text-center py-8 text-xs text-ink/50 italic",children:"No matching settings found"}):Rr.map((N)=>{let A=C.filter((T)=>T.section===N);if(A.length===0)return null;return e("div",{className:"space-y-1",children:[e("div",{className:"px-2.5 py-1 text-[10px] font-bold text-ink/40 tracking-wider font-mono uppercase",children:N}),e("div",{className:"space-y-0.5",children:A.map((T)=>{let F=T.icon,S=t===T.id;return e("button",{type:"button",onClick:()=>r(T.id),className:`w-full flex items-center justify-between px-2.5 py-1.5 rounded-lg text-xs transition-all text-left ${S?"bg-ink/10 font-semibold text-ink shadow-2xs":"text-ink/75 hover:bg-ink/5 hover:text-ink"}`,children:[e("div",{className:"flex items-center space-x-2.5 truncate",children:[T.harness?e("span",{className:"flex w-[14px] shrink-0 items-center justify-center",children:e(Ke,{harness:T.harness,size:14})}):e(F,{size:14,className:S?"text-ink":"text-ink/60"}),e("span",{className:"truncate",children:T.label})]}),T.badge&&e("span",{className:"px-1.5 py-0.2 text-[10px] font-mono font-medium rounded border border-warning/30 bg-warning/15 text-warning",children:T.badge})]},T.id)})})]},N)})}),e("div",{className:"p-2 border-t border-ink/10 flex-shrink-0 bg-canvas flex items-center gap-0.5",children:[e("button",{type:"button",onClick:p,disabled:g||v,title:"Recycle the standby omp processes so the next command uses the installed binary","aria-label":"Reload OMP",className:"shrink-0 flex items-center space-x-1 px-1 py-1.5 text-[11px] text-ink/75 hover:text-ink hover:bg-ink/5 rounded-lg transition-colors font-medium cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed",children:[e(D,{size:12,className:`shrink-0 ${g?"animate-spin text-warning":"text-ink/60"}`}),e("span",{className:"whitespace-nowrap",children:g?"Reloading…":"Reload OMP"})]}),e("button",{type:"button",onClick:h,disabled:g||v,title:"Stop and start this Kabmo instance","aria-label":"Restart Kabmo",className:"flex-1 min-w-0 flex items-center space-x-1 px-1 py-1.5 text-[11px] text-ink/75 hover:text-ink hover:bg-ink/5 rounded-lg transition-colors font-medium cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed",children:[e(Tr,{size:12,className:`shrink-0 ${v?"animate-pulse text-warning":"text-ink/60"}`}),e("span",{className:"truncate",children:v?"Restarting…":"Restart Kabmo"})]})]})]})}function Pe(){let[t,r]=n("list"),l=a(()=>r("detail"),[]),c=a(()=>r("list"),[]);return{pane:t,openDetail:l,back:c}}var Or=en(null);function Dr({register:t,children:r}){return e(Or.Provider,{value:t,children:r})}function Ur(t){let r=ht(Or),l=t?.label,c=t?.description,p=t?.back,g=t?.backLabel;o(()=>{if(!r)return;if(!l||!p||!g){r(null);return}return r({label:l,description:c,back:p,backLabel:g}),()=>r(null)},[r,l,c,p,g])}function $r(){let[t,r]=n(null);return{register:u(()=>(c)=>r((p)=>{if(c===null)return p===null?p:null;if(p&&p.label===c.label&&p.description===c.description&&p.back===c.back&&p.backLabel===c.backLabel)return p;return c}),[]),drill:t}}function Ce({pane:t,onBack:r,list:l,detail:c,listLabel:p,detailLabel:g,detailDescription:h,className:v=""}){return Ur(t==="detail"?{label:g??p,description:h,back:r,backLabel:`Back to ${p}`}:null),e("div",{className:`flex-1 flex flex-col md:flex-row h-full w-full min-w-0 overflow-hidden bg-paper text-ink ${v}`,children:[e("div",{className:`${t==="list"?"flex":"hidden"} md:flex flex-1 md:flex-none md:w-auto min-h-0 min-w-0 flex-col`,children:l}),e("div",{className:`${t==="detail"?"flex":"hidden"} md:flex flex-1 min-h-0 min-w-0 flex-col`,children:c})]})}function tn({groups:t,activeGroupId:r,onSelectGroup:l}){return e("div",{className:"w-full md:w-64 md:border-r border-ink/10 h-full flex flex-col bg-paper/50 flex-shrink-0 select-none",children:[e("div",{className:`${xe} hidden md:flex px-3.5 justify-between`,style:{height:we},children:e("span",{className:"text-xs font-semibold text-ink",children:[t.length," group",t.length===1?"":"s"]})}),e("div",{className:"flex-1 scrollbar-overlay-container p-1.5 text-xs",children:e("div",{className:"space-y-0.5",children:t.map((c)=>{let p=c.id===r,g=c.icon;return e("button",{type:"button",onClick:()=>l(c.id),"aria-current":p?"true":void 0,"aria-label":`${c.label}: ${c.hint}`,className:`w-full text-left px-2.5 py-2 rounded-lg transition-colors cursor-pointer flex flex-col gap-0.5 ${p?"bg-ink/10 text-ink font-medium shadow-2xs":"text-ink/80 hover:bg-ink/5 hover:text-ink"}`,children:[e("span",{className:"flex items-center gap-1.5 min-w-0",children:[e("span",{"aria-hidden":!0,className:`w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0 ${p?"bg-ink/10 text-ink":"bg-ink/5 text-ink/70"}`,children:e(g,{size:12})}),e("span",{className:"font-semibold text-xs text-ink truncate",children:c.label})]}),e("span",{className:"text-[11px] text-ink/60 line-clamp-1 leading-snug pl-[26px]",children:c.hint})]},c.id)})})})]})}function ln({group:t,children:r}){return e("div",{className:"flex-1 h-full overflow-hidden flex flex-col text-xs text-ink",children:[e("div",{className:`${xe} hidden md:flex items-start flex-col justify-center px-3.5`,style:{height:we},children:[e("span",{className:"text-xs font-semibold text-ink/75",children:t.label}),e("p",{className:"w-full text-[11px] text-ink/60 leading-snug mt-0.5 truncate",children:t.description})]}),e("div",{className:"flex-1 overflow-y-auto scrollbar-overlay-container p-3.5 space-y-7 pb-6",children:r})]})}var Mt=[{id:"palette",label:"Palette",hint:"The console’s colours",description:"The palette every surface, row and dialog is painted from.",icon:wa,sections:["theme"]},{id:"shell",label:"Shell",hint:"Sidebar, panels, material, rules, icons",description:"The shape of the console around the conversation: the session sidebar, how each desktop panel column is navigated, what the windows are made of, whether the hairlines are drawn, and how glyphs and marks are painted.",icon:nn,sections:["sidebar","panel-nav","surface","border","icons","tray"]},{id:"editor",label:"Editor",hint:"Typeface and colour theme",description:"The code editor’s own two axes, independent of the console palette: the face it is set in, and the TextMate theme it paints with.",icon:yn,sections:["editor-font","editor-theme"]},{id:"editor-behaviour",label:"Editor behaviour",hint:"Indentation, typing, line blame",description:"What the editor does as you type, rather than how it looks. Each one reaches an editor that is already open without a reload.",icon:Ba,sections:["editor-indent","editor-typing","editor-blame"]}];function Fr({theme:t,selected:r,onSelect:l}){return e("button",{type:"button",onClick:()=>l(t.id),"aria-pressed":r,className:`group flex w-full flex-col gap-2.5 rounded-lg border p-2.5 text-left transition-all cursor-pointer ${r?"border-ink bg-ink/5 ring-1 ring-ink/20":"border-ink/20 bg-paper hover:border-ink/40 hover:bg-ink/5"}`,children:[e("div",{className:"flex items-center gap-2",children:[e("span",{className:"truncate font-semibold text-ink",title:t.name,children:t.name}),e("span",{className:"shrink-0 rounded-full border border-ink/15 px-1.5 py-px text-[10px] font-semibold uppercase tracking-wider text-ink/50",children:t.variant}),r&&e(f,{size:14,className:"ml-auto shrink-0 text-ink"})]}),e("div",{className:"flex items-center gap-1",children:UA.map((c)=>e("span",{title:`${c.label} · ${t[c.key]}`,style:{backgroundColor:t[c.key]},className:"h-5 flex-1 rounded-[3px] border border-ink/10"},c.key))})]})}var _p=[{id:"all",label:"All"},{id:"light",label:"Light"},{id:"dark",label:"Dark"}];function Hp(t){return t==="all"?is:is.filter((r)=>r.variant===t)}function jr({selectedId:t,onSelect:r}){let[l,c]=n("all"),p=u(()=>Hp(l),[l]);return e("div",{className:"space-y-3 pb-6",children:[e("div",{className:"flex items-center gap-1.5",children:[_p.map((g)=>e("button",{type:"button",onClick:()=>c(g.id),className:`rounded-full border px-2.5 py-1 text-[11px] font-medium transition-colors cursor-pointer ${l===g.id?"border-ink bg-ink text-paper":"border-ink/20 bg-paper text-ink/70 hover:border-ink/40 hover:text-ink"}`,children:[g.id==="light"&&e(Zt,{size:11,className:"mr-1 inline align-[-1px]"}),g.id==="dark"&&e(Xt,{size:11,className:"mr-1 inline align-[-1px]"}),g.label]},g.id)),e("span",{className:"ml-auto font-mono text-[11px] text-ink/50",children:[p.length," themes"]})]}),e("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2 lg:grid-cols-3",children:p.map((g)=>e(Fr,{theme:g,selected:g.id===t,onSelect:r},g.id))})]})}function _r({settings:t,onUpdate:r}){return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Console palette"}),e("p",{className:"mt-0.5 text-[11px] text-ink/60",children:"The colours every surface, row and dialog is painted from. The code editor has its own theme, in the Editor group."})]}),e(jr,{selectedId:t.theme,onSelect:(l)=>r({theme:zA(l)})})]})}function bt({width:t,active:r=!1,trailing:l=!1}){return e("span",{className:"flex h-[9px] items-center gap-1 px-1",children:[e("span",{className:`h-[5px] w-[5px] shrink-0 rounded-full ${r?"bg-ink":"bg-ink/25"}`}),e("span",{className:`h-[3px] rounded-full ${r?"bg-ink/70":"bg-ink/25"}`,style:{width:`${t}%`}}),l&&e("span",{className:"ml-auto h-[3px] w-[6px] rounded-full bg-ink/20"})]})}function zp(){return e("span",{className:"flex h-full flex-col gap-1 rounded-md border border-ink/10 bg-paper p-1","aria-hidden":"true",children:[e("span",{className:"flex items-center gap-0.5",children:[e("span",{className:"h-[7px] w-[30%] rounded-sm bg-ink/80"}),e("span",{className:"h-[7px] w-[7px] rounded-sm border border-ink/20 bg-paper"}),e("span",{className:"h-[7px] w-[7px] rounded-sm border border-ink/20 bg-paper"}),e("span",{className:"ml-auto h-[7px] w-[7px] rounded-sm border border-ink/20 bg-paper"}),e("span",{className:"h-[7px] w-[7px] rounded-sm border border-ink/20 bg-paper"})]}),e("span",{className:"flex h-[7px] items-center gap-1 px-1",children:e("span",{className:"h-[3px] w-[45%] rounded-full bg-ink/45"})}),e(bt,{width:62,trailing:!0}),e(bt,{width:50,active:!0,trailing:!0}),e(bt,{width:44,trailing:!0}),e(bt,{width:56,trailing:!0})]})}function Gp(){return e("span",{className:"flex h-full flex-col gap-1 rounded-md border border-ink/10 bg-paper p-1","aria-hidden":"true",children:[e("span",{className:"flex h-[7px] items-center rounded-sm bg-ink/5 px-1",children:e("span",{className:"h-[3px] w-[38%] rounded-full bg-ink/30"})}),e("span",{className:"flex items-center gap-0.5",children:[e("span",{className:"h-[6px] w-[16%] rounded-full bg-ink/80"}),e("span",{className:"h-[6px] w-[22%] rounded-full border border-ink/20"}),e("span",{className:"h-[6px] w-[12%] rounded-full border border-ink/20"})]}),e("span",{className:"flex h-[9px] items-center gap-1 px-1",children:[e("span",{className:"h-[5px] w-[5px] shrink-0 rounded-full bg-ink/50"}),e("span",{className:"h-[3px] w-[40%] rounded-full bg-ink/45"}),e("span",{className:"ml-auto h-[3px] w-[5px] rounded-full bg-ink/20"})]}),e(bt,{width:62,active:!0,trailing:!0}),e(bt,{width:50,trailing:!0}),e(bt,{width:44,trailing:!0})]})}var Wp={classic:zp,modern:Gp};function Hr({settings:t,onUpdate:r}){let l=bc(t.sidebarStyle);return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Session sidebar"}),e("p",{className:"mt-0.5 text-[11px] text-ink/60",children:"How the left column draws its workspaces and chats. Both styles list the same workspaces and offer the same actions; the choice applies to desktop and phone, and takes effect immediately."})]}),e("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",role:"group","aria-label":"Session sidebar style",children:ah.map((c)=>{let p=oh[c],g=c===l,h=Wp[c];return e("button",{type:"button",onClick:()=>r({sidebarStyle:c}),"aria-pressed":g,"aria-label":`${p.label} sidebar — ${p.description}`,className:`flex flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors cursor-pointer ${g?"border-ink/40 bg-ink/5":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5"}`,children:[e("span",{className:"block h-[86px]",children:e(h,{})}),e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:"text-xs font-semibold text-ink",children:p.label}),e("span",{className:"font-mono text-[10px] text-ink/40",children:p.caption}),g&&e("span",{className:"ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[10px] font-semibold text-paper",children:"active"})]}),e("span",{className:"text-[11px] leading-relaxed text-ink/60",children:p.description})]},c)})})]})}function zr(){return e("span",{className:"flex h-full gap-1 rounded-md border border-ink/10 bg-paper p-1","aria-hidden":"true",children:[e("span",{className:"flex w-[9px] flex-col items-center gap-1 border-r border-ink/10 pr-1",children:[e("span",{className:"h-[5px] w-[5px] rounded-sm bg-ink/70"}),e("span",{className:"h-[5px] w-[5px] rounded-sm bg-ink/25"}),e("span",{className:"h-[5px] w-[5px] rounded-sm bg-ink/25"})]}),e("span",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[e("span",{className:"h-[3px] w-[46%] rounded-full bg-ink/45"}),e("span",{className:"h-[3px] w-[62%] rounded-full bg-ink/25"}),e("span",{className:"h-[3px] w-[54%] rounded-full bg-ink/25"}),e("span",{className:"h-[3px] w-[40%] rounded-full bg-ink/20"})]})]})}function Gr(){return e("span",{className:"flex h-full flex-col gap-1 rounded-md border border-ink/10 bg-paper p-1","aria-hidden":"true",children:[e("span",{className:"flex items-center gap-1 border-b border-ink/10 pb-1",children:[e("span",{className:"h-[6px] w-[6px] rounded-sm border border-ink/20"}),e("span",{className:"h-[6px] w-[28%] rounded-sm bg-ink/70"}),e("span",{className:"h-[6px] w-[24%] rounded-sm border border-ink/20"})]}),e("span",{className:"flex gap-1",children:[e("span",{className:"h-[16px] w-[22%] rounded border border-ink/15"}),e("span",{className:"h-[16px] w-[22%] rounded border border-ink/15"}),e("span",{className:"h-[16px] w-[22%] rounded border border-ink/15"})]})]})}function qr(){return e("span",{className:"flex h-full flex-col gap-1 rounded-md border border-ink/10 bg-paper p-1","aria-hidden":"true",children:[e("span",{className:"flex h-[7px] items-center gap-1 border-b border-ink/10 pb-1",children:[e("span",{className:"h-[6px] w-[16%] rounded-sm bg-ink/70"}),e("span",{className:"h-[6px] w-[16%] rounded-sm border border-ink/20"}),e("span",{className:"h-[6px] w-[16%] rounded-sm border border-ink/20"}),e("span",{className:"h-[6px] w-[16%] rounded-sm border border-ink/20"})]}),e("span",{className:"h-[3px] w-[62%] rounded-full bg-ink/25"}),e("span",{className:"h-[3px] w-[54%] rounded-full bg-ink/25"}),e("span",{className:"h-[3px] w-[40%] rounded-full bg-ink/20"})]})}function Yr({pinned:t=!1}){return e("span",{className:"flex h-full flex-col gap-1 rounded-md border border-ink/10 bg-paper p-1","aria-hidden":"true",children:[e("span",{className:"flex h-[7px] items-center gap-1 border-b border-ink/10 pb-1",children:[e("span",{className:"h-[6px] w-[6px] rounded-sm border border-ink/20"}),t?e("span",{className:"h-[6px] w-[20%] rounded-sm bg-ink/70"}):null,e("span",{className:`h-[6px] rounded-sm ${t?"w-[18%]":"w-[24%]"} bg-ink/70`}),e("span",{className:"h-[6px] w-[20%] rounded-sm border border-ink/20"})]}),e("span",{className:"flex gap-1",children:[e("span",{className:"h-[16px] w-[24%] rounded border border-ink/15"}),e("span",{className:"h-[16px] w-[24%] rounded border border-ink/15"}),e("span",{className:"h-[16px] w-[24%] rounded border border-ink/15"})]})]})}function qp(t){return t==="rail"?e(zr,{}):e(Gr,{})}var Yp={classic:{label:"Classic",description:"The strip lists every view; tapping one swaps the drawer body.",caption:"All views · one tap"},tabs:{label:"Tabs",description:"The strip holds only the views you opened, over a home page that lists them all. The drawer reopens where you left it.",caption:"Opened views · home page"}},Jp={classic:{label:"Classic",description:"The strip lists every view the left dock holds; tapping one swaps the drawer body.",caption:"All views · one tap"},tabs:{label:"Tabs",description:"The strip holds the views you opened, with Sessions pinned first, over a home page that lists the rest. The drawer reopens where you left it.",caption:"Opened views · Sessions pinned"}};function Xr({styles:t,copy:r,miniature:l,current:c,onPick:p,label:g}){return e("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",role:"group","aria-label":g,children:t.map((h)=>{let v=r[h],y=h===c;return e("button",{type:"button",onClick:()=>p(h),"aria-pressed":y,"aria-label":`${v.label} — ${v.description}`,className:`flex cursor-pointer flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors ${y?"border-ink/40 bg-ink/5":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5"}`,children:[e("span",{className:"block h-[54px]",children:l(h)}),e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:"text-xs font-semibold text-ink",children:v.label}),e("span",{className:"font-mono text-[10px] text-ink/40",children:v.caption}),y&&e("span",{className:"ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[10px] font-semibold text-paper",children:"active"})]}),e("span",{className:"text-[11px] leading-relaxed text-ink/60",children:v.description})]},h)})})}function Yn({current:t,onPick:r}){return e(Xr,{styles:ih,copy:sh,miniature:qp,current:t,onPick:r,label:"Panel navigation"})}function Jn({side:t,current:r,onPick:l}){let c=t==="left";return e(Xr,{styles:lh,copy:c?Jp:Yp,miniature:(p)=>p==="classic"?e(qr,{}):e(Yr,{pinned:c}),current:r,onPick:l,label:c?"Phone left drawer":"Phone right drawer"})}function Qr({settings:t,onUpdate:r}){return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Panel navigation"}),e("p",{className:"mt-0.5 text-[11px] text-ink/60",children:"How each panel surface is navigated. Everything is chosen independently: the desktop columns do not set each other, and each phone drawer has its own answer."})]}),e("div",{className:"space-y-2",children:[e("div",{children:[e("h5",{className:"text-[11px] font-semibold text-ink/70",children:"Left column"}),e("div",{className:"mt-1.5",children:e(Yn,{current:fi(t.leftPanelNav),onPick:(l)=>r({leftPanelNav:l})})})]}),e("div",{children:[e("h5",{className:"text-[11px] font-semibold text-ink/70",children:"Right column"}),e("div",{className:"mt-1.5",children:e(Yn,{current:fi(t.rightPanelNav),onPick:(l)=>r({rightPanelNav:l})})})]}),e("div",{children:[e("h5",{className:"text-[11px] font-semibold text-ink/70",children:"Phone · left drawer"}),e("p",{className:"mt-0.5 text-[11px] text-ink/50",children:"The drawer is one screen, so it has no rail to put beside it. This chooses what its strip lists instead. Under Tabs the session list stays the first, pinned chip."}),e("div",{className:"mt-1.5",children:e(Jn,{side:"left",current:ss(t.mobileLeftPanelNav),onPick:(l)=>r({mobileLeftPanelNav:l})})})]}),e("div",{children:[e("h5",{className:"text-[11px] font-semibold text-ink/70",children:"Phone · right drawer"}),e("p",{className:"mt-0.5 text-[11px] text-ink/50",children:"A drawer is one screen, so it has no rail to put beside it. This chooses what its strip lists instead."}),e("div",{className:"mt-1.5",children:e(Jn,{side:"right",current:ss(t.mobileRightPanelNav),onPick:(l)=>r({mobileRightPanelNav:l})})})]})]})]})}function ei({backdropFilter:t,reducedTransparency:r}){let l=[];if(!t)l.push("no-backdrop-filter");if(r)l.push("reduced-transparency");return l}var ti={"no-backdrop-filter":"This engine reports no backdrop blur, so the frost falls back to opaque panels here — the window keeps the glass colours but loses the blur.","reduced-transparency":"Your system asks apps to reduce transparency, so the frost is switched off. Turn that system setting off to see the glass material."};var ni="(prefers-reduced-transparency: reduce)";function Xp(){if(typeof CSS>"u"||typeof CSS.supports!=="function")return!1;return CSS.supports("backdrop-filter","blur(1px)")||CSS.supports("-webkit-backdrop-filter","blur(1px)")}function ii(){let[t,r]=n(()=>typeof window>"u"?!1:window.matchMedia(ni).matches);return o(()=>{let l=window.matchMedia(ni),c=()=>r(l.matches);return c(),l.addEventListener("change",c),()=>l.removeEventListener("change",c)},[]),ei({backdropFilter:Xp(),reducedTransparency:t})}function ai(){return e("span",{className:"flex h-full flex-col gap-1 p-1",children:[e("span",{className:"flex items-center gap-1",children:[e("span",{className:"h-[3px] w-[38%] rounded-full bg-ink/40"}),e("span",{className:"ml-auto h-[6px] w-[10%] rounded-[2px] border border-ink/20"})]}),e("span",{className:"h-[2px] w-full rounded-full bg-ink/15"}),e("span",{className:"flex items-center gap-1",children:[e("span",{className:"h-[3px] w-[52%] rounded-full bg-ink/30"}),e("span",{className:"h-[3px] w-[18%] rounded-full bg-ink/15"})]}),e("span",{className:"flex items-center gap-1",children:[e("span",{className:"h-[3px] w-[44%] rounded-full bg-ink/30"}),e("span",{className:"h-[3px] w-[22%] rounded-full bg-ink/15"})]})]})}function Qp(){return e("span",{className:"block h-full rounded-md border border-ink/15 bg-paper","aria-hidden":"true",children:[e("span",{className:"block h-[13px] rounded-t-[5px] border-b border-ink/10 bg-paper",children:e("span",{className:"mx-1 mt-[4px] block h-[3px] w-[40%] rounded-full bg-ink/35"})}),e(ai,{})]})}function Zp(){return e("span",{className:"relative block h-full overflow-hidden rounded-md border border-ink/15 bg-canvas","aria-hidden":"true",children:[e("span",{className:"pointer-events-none absolute inset-0",children:[e("span",{className:"absolute -left-2 top-2 h-[70%] w-[55%] rounded-full bg-info/40 blur-md"}),e("span",{className:"absolute -right-2 -top-2 h-[60%] w-[50%] rounded-full bg-meta/35 blur-md"}),e("span",{className:"absolute -bottom-2 right-3 h-[45%] w-[45%] rounded-full bg-success/30 blur-md"})]}),e("span",{className:"relative block h-[13px] border-b border-ink/10 bg-paper/40",children:e("span",{className:"mx-1 mt-[4px] block h-[3px] w-[40%] rounded-full bg-ink/40"})}),e("span",{className:"relative block h-[calc(100%-13px)] bg-paper/50",children:e(ai,{})})]})}var eu={classic:Qp,glass:Zp};function tu(){let t=ii();if(t.length===0)return null;return e("ul",{className:"space-y-1 rounded-lg border border-ink/15 bg-ink/[0.03] p-2.5","aria-live":"polite",children:t.map((r)=>e("li",{className:"flex gap-1.5 text-[11px] leading-relaxed text-ink/60",children:[e("span",{"aria-hidden":"true",className:"mt-[5px] h-1 w-1 shrink-0 rounded-full bg-ink/40"}),e("span",{children:ti[r]})]},r))})}function si({settings:t,onUpdate:r}){let l=Am(t.surfaceStyle);return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Surfaces"}),e("p",{className:"mt-0.5 text-[11px] text-ink/60",children:"What the windows are made of. Both styles draw the same panels, rows and dialogs; the frost is one blur pass per window, and it follows the palette — there is no separate glass colour to tune."})]}),e("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",role:"group","aria-label":"Surface style",children:mh.map((c)=>{let p=fh[c],g=c===l,h=eu[c];return e("button",{type:"button",onClick:()=>r({surfaceStyle:c}),"aria-pressed":g,"aria-label":`${p.label} surfaces — ${p.description}`,className:`flex flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors cursor-pointer ${g?"border-ink/40 bg-ink/5":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5"}`,children:[e("span",{className:"block h-[78px]",children:e(h,{})}),e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:"text-xs font-semibold text-ink",children:p.label}),e("span",{className:"font-mono text-[10px] text-ink/40",children:p.caption}),g&&e("span",{className:"ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[10px] font-semibold text-paper",children:"active"})]}),e("span",{className:"text-[11px] leading-relaxed text-ink/60",children:p.description})]},c)})}),l==="glass"&&e(tu,{})]})}function nu({ruled:t}){let r=t?"border-b border-ink/10":"";return e("span",{className:"flex h-full flex-col",children:[0,1,2].map((l)=>e("span",{className:`flex items-center gap-1 px-1 py-[3px] ${r}`,children:[e("span",{className:"h-[3px] w-[26%] rounded-full bg-ink/35"}),e("span",{className:"h-[3px] w-[14%] rounded-full bg-ink/15"})]},l))})}function di({ruled:t}){return e("span",{className:"flex h-full overflow-hidden rounded-md border border-ink/15 bg-paper","aria-hidden":"true",children:[e("span",{className:`flex w-[34%] flex-col gap-1 p-1 ${t?"border-r border-ink/10":""}`,children:[e("span",{className:"h-[3px] w-[70%] rounded-full bg-ink/35"}),e("span",{className:"h-[3px] w-[52%] rounded-full bg-ink/20"}),e("span",{className:"h-[3px] w-[62%] rounded-full bg-ink/20"})]}),e("span",{className:"flex min-w-0 flex-1 flex-col",children:[e("span",{className:`flex h-[12px] flex-shrink-0 items-center px-1 ${t?"border-b border-ink/10":""}`,children:e("span",{className:"h-[3px] w-[40%] rounded-full bg-ink/30"})}),e(nu,{ruled:t})]})]})}var ou={hairline:()=>e(di,{ruled:!0}),borderless:()=>e(di,{ruled:!1})};function pi({settings:t,onUpdate:r}){let l=hm(t.borderStyle);return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Rules"}),e("p",{className:"mt-0.5 text-[11px] text-ink/60",children:"Whether the 1px rules between panels, columns and rows are painted. Controls keep their edge either way, and so do validation colours, drop zones and the focus ring."})]}),e("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",role:"group","aria-label":"Border style",children:Ah.map((c)=>{let p=hh[c],g=c===l,h=ou[c];return e("button",{type:"button",onClick:()=>r({borderStyle:c}),"aria-pressed":g,"aria-label":`${p.label} rules — ${p.description}`,className:`flex flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors cursor-pointer ${g?"border-ink/40 bg-ink/5":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5"}`,children:[e("span",{className:"block h-[62px]",children:e(h,{})}),e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:"text-xs font-semibold text-ink",children:p.label}),e("span",{className:"font-mono text-[10px] text-ink/40",children:p.caption}),g&&e("span",{className:"ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[10px] font-semibold text-paper",children:"active"})]}),e("span",{className:"text-[11px] leading-relaxed text-ink/60",children:p.description})]},c)})})]})}function ru(t){return cn(t).paper}function Qn({name:t,Icon:r,colored:l,paper:c}){let p=HA(t),g=!l?void 0:p?am[p]:_o(WA(t),"light",c);return e(r,{size:13,strokeWidth:2,style:g?{color:g}:void 0,"aria-hidden":"true"})}function mi({name:t,base:r,colored:l}){let c=l?r:void 0;return e("span",{className:"flex h-5 w-5 items-center justify-center rounded-[5px] border border-ink/10",style:c?{backgroundColor:`${c}22`,color:c}:void 0,title:t,"aria-hidden":"true",children:e("span",{className:`block h-2 w-2 rounded-full ${l?"":"bg-ink/60"}`,style:c?{backgroundColor:c}:void 0})})}function gi({colored:t,paper:r}){return e("span",{className:"flex h-full items-center gap-1.5 rounded-md border border-ink/10 bg-canvas/60 px-2",children:[e(Qn,{name:"Trash2",Icon:L,colored:t,paper:r}),e(Qn,{name:"Check",Icon:f,colored:t,paper:r}),e(Qn,{name:"Sparkles",Icon:Se,colored:t,paper:r}),e("span",{className:"mx-0.5 h-4 w-px bg-ink/10"}),e(mi,{name:"claude",base:rm.claude.light,colored:t}),e(mi,{name:"Typescript",base:om.Typescript.light,colored:t})]})}function bi({settings:t,onUpdate:r}){let l=nm(t.iconStyle),c=ru(t.theme),p={monochrome:()=>e(gi,{colored:!1,paper:c}),color:()=>e(gi,{colored:!0,paper:c})};return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Icons"}),e("p",{className:"mt-0.5 text-[11px] text-ink/60",children:"Every icon: toolbar and panel glyphs, provider logos and file-type marks. Full colour gives each glyph its own hue and keeps the palette’s red, green, amber and blue for signals; a colour that would disappear on the active theme falls back to the ink. A control that sets its own colour keeps it."})]}),e("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",role:"group","aria-label":"Icon style",children:jA.map((g)=>{let h=qA[g],v=g===l,y=p[g];return e("button",{type:"button",onClick:()=>r({iconStyle:g}),"aria-pressed":v,"aria-label":`${h.label} icons — ${h.description}`,className:`flex flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors cursor-pointer ${v?"border-ink/40 bg-ink/5":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5"}`,children:[e("span",{className:"block h-[42px]",children:e(y,{})}),e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:"text-xs font-semibold text-ink",children:h.label}),e("span",{className:"font-mono text-[10px] text-ink/40",children:h.caption}),v&&e("span",{className:"ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[10px] font-semibold text-paper",children:"active"})]}),e("span",{className:"text-[11px] leading-relaxed text-ink/60",children:h.description})]},g)})})]})}function iu(){return e("span",{className:"flex h-full items-center justify-center rounded-md border border-ink/10 bg-canvas/60",children:e("img",{src:"/icon.svg",alt:"",width:26,height:26,className:"rounded-[6px]","aria-hidden":"true"})})}function au({variant:t}){return e("span",{className:"flex h-full items-center justify-center rounded-md border border-ink/10 bg-canvas/60",children:e("img",{src:`/tray-monochrome-${t}.png`,alt:"",width:26,height:26,"aria-hidden":"true"})})}function hi({settings:t,onUpdate:r}){let l=nr(t.trayIconStyle),c=cn(t.theme).variant,p={color:iu,monochrome:()=>e(au,{variant:c})};return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Tray icon"}),e("p",{className:"mt-0.5 text-[11px] text-ink/60",children:"The menu-bar (macOS) or notification-area (Windows, Linux) icon. Full colour is the shipped app icon, orange arm and all; monochrome is a greyscale conversion: the green plate and the cream strokes swap luminance with the theme, and the orange arm becomes the middle grey. Applies the next time the tray starts, or immediately when it is already running."})]}),e("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2",role:"group","aria-label":"Tray icon style",children:er.map((g)=>{let h=or[g],v=g===l,y=p[g];return e("button",{type:"button",onClick:()=>r({trayIconStyle:g}),"aria-pressed":v,"aria-label":`${h.label} tray icon — ${h.description}`,className:`flex flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors cursor-pointer ${v?"border-ink/40 bg-ink/5":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5"}`,children:[e("span",{className:"block h-[42px]",children:e(y,{})}),e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:"text-xs font-semibold text-ink",children:h.label}),e("span",{className:"font-mono text-[10px] text-ink/40",children:h.caption}),v&&e("span",{className:"ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[10px] font-semibold text-paper",children:"active"})]}),e("span",{className:"text-[11px] leading-relaxed text-ink/60",children:h.description})]},g)})})]})}function vi({settings:t,onUpdate:r}){let l=t.editorFont||vc[0].id;return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"flex items-center gap-2 text-sm font-semibold text-ink",children:[e(Zr,{size:15,className:"text-ink/60"}),"Editor font"]}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"Typeface for the code editor and its line numbers, in both the desktop panel and the phone's full-screen editor. Only Fira Code ships with the app; the others are used when your device has them, and fall back to Fira Code when it does not."})]}),e("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:vc.map((c)=>{let p=l===c.id;return e("button",{type:"button",onClick:()=>r({editorFont:c.id}),"aria-pressed":p,className:`flex items-center justify-between gap-3 rounded-lg border px-3 py-2 text-left transition-colors ${p?"border-ink/40 bg-ink/5":"border-ink/12 hover:bg-ink/5"}`,children:[e("span",{className:"min-w-0",children:[e("span",{className:"block truncate text-xs text-ink",style:{fontFamily:`"${c.id}", monospace`},children:"const greet = () => 'hi'"}),e("span",{className:"mt-0.5 flex items-center gap-1.5 text-[10px] text-ink/50",children:[e("span",{children:c.label}),c.bundled&&e("span",{className:"rounded bg-ink/8 px-1 py-px text-[10px] uppercase tracking-wide",children:"Bundled"})]})]}),p&&e(f,{size:14,className:"text-ink flex-shrink-0"})]},c.id)})})]})}var su=[{id:"all",label:"All"},{id:"light",label:"Light"},{id:"dark",label:"Dark"}];function lu(t){return`"${vc.find((l)=>l.id===t)?.id??vc[0].id}", monospace`}function du({theme:t,face:r}){return e("span",{className:"block overflow-hidden rounded border border-ink/10",style:{backgroundColor:t.bg,color:t.fg},children:e("span",{className:"block px-1.5 py-1 font-mono text-[10px] leading-[1.4]",style:{fontFamily:r},children:[e("span",{style:{color:t.keyword},children:"const"})," ",e("span",{children:"answer"})," ",e("span",{style:{color:t.keyword},children:"="})," ",e("span",{style:{color:t.string},children:"42"}),e("span",{children:";"}),e("span",{className:"block truncate",style:{color:t.comment},children:["// ",t.label]})]})})}function xi({settings:t,onUpdate:r}){let l=t.editorTheme||ea,[c,p]=n("all"),g=lu(t.editorFont),h=u(()=>c==="all"?bm:bm.filter((v)=>v.variant===c),[c]);return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"flex items-center gap-2 text-sm font-semibold text-ink",children:[e(wa,{size:15,className:"text-ink/60"}),"Editor theme"]}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:["Colours for the code editor only: the console keeps the palette in the Palette group. ",e("strong",{children:"Auto"})," ","follows the app palette; any other choice paints the editor's own surface, gutter, selection and syntax, and applies to every open editor without a reload."]})]}),e("div",{className:"flex items-center gap-1.5",children:[su.map((v)=>e("button",{type:"button",onClick:()=>p(v.id),className:`rounded-full border px-2.5 py-1 text-[11px] font-medium transition-colors cursor-pointer ${c===v.id?"border-ink bg-ink text-paper":"border-ink/20 bg-paper text-ink/70 hover:border-ink/40 hover:text-ink"}`,children:[v.id==="light"&&e(Zt,{size:11,className:"mr-1 inline align-[-1px]"}),v.id==="dark"&&e(Xt,{size:11,className:"mr-1 inline align-[-1px]"}),v.label]},v.id)),e("span",{className:"ml-auto font-mono text-[11px] text-ink/50",children:c==="all"?`${h.length} themes`:`${h.length} shown`})]}),e("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:[e("button",{type:"button",onClick:()=>r({editorTheme:ea}),"aria-pressed":l===ea,className:`flex w-full flex-col gap-2 rounded-lg border p-2 text-left transition-colors cursor-pointer ${l===ea?"border-ink bg-ink/5 ring-1 ring-ink/20":"border-ink/20 bg-paper hover:border-ink/40 hover:bg-ink/5"}`,children:[e("span",{className:"flex items-center gap-2",children:[e("span",{className:"truncate font-semibold text-ink",children:"Auto"}),e("span",{className:"shrink-0 rounded-full border border-ink/15 px-1.5 py-px text-[10px] font-semibold uppercase tracking-wider text-ink/50",children:"app palette"}),l===ea&&e(f,{size:14,className:"ml-auto shrink-0 text-ink"})]}),e("span",{className:"flex h-8 items-center justify-center rounded border border-dashed border-ink/20 text-[10px] text-ink/50",children:"Follows the theme above"})]}),h.map((v)=>{let y=l===v.id;return e("button",{type:"button",onClick:()=>r({editorTheme:v.id}),"aria-pressed":y,className:`flex w-full flex-col gap-2 rounded-lg border p-2 text-left transition-colors cursor-pointer ${y?"border-ink bg-ink/5 ring-1 ring-ink/20":"border-ink/20 bg-paper hover:border-ink/40 hover:bg-ink/5"}`,children:[e("span",{className:"flex items-center gap-2",children:[e("span",{className:"truncate font-semibold text-ink",title:v.label,children:v.label}),e("span",{className:"shrink-0 rounded-full border border-ink/15 px-1.5 py-px text-[10px] font-semibold uppercase tracking-wider text-ink/50",children:v.variant}),y&&e(f,{size:14,className:"ml-auto shrink-0 text-ink"})]}),e(du,{theme:v,face:g})]},v.id)})]})]})}function yi({settings:t,onUpdate:r}){let l=R("editorIndentWidth"),c=typeof l==="number"&&Ld.includes(l)?l:fu.width,p=(g)=>{if(g===c)return;let h={...Md(),width:g};hr({editorIndentWidth:g,editorInsertSpaces:!0}),r((v)=>({...v})),window.dispatchEvent(new CustomEvent(Fd,{detail:h}))};return e("section",{className:"space-y-3",children:e("div",{className:"flex items-center justify-between gap-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Editor indentation"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"One level, in spaces. Enter, Tab and the auto-indent rules all use it."})]}),e("div",{className:"flex items-center gap-1",role:"group","aria-label":"Indentation width",children:Ld.map((g)=>e("button",{type:"button",onClick:()=>p(g),"aria-pressed":g===c,"aria-label":`${g} spaces`,className:`px-2.5 py-1 rounded border text-[11px] font-mono transition-colors cursor-pointer ${g===c?"border-ink/40 bg-ink/10 text-ink":"border-ink/15 text-ink/60 hover:bg-ink/5 hover:text-ink"}`,children:g},g))})]})})}function ki({label:t,hint:r,checked:l,onChange:c}){return e("label",{className:"flex items-start justify-between gap-3 cursor-pointer",children:[e("span",{className:"min-w-0",children:[e("span",{className:"block text-xs text-ink",children:t}),e("span",{className:"block text-[11px] text-ink/50 mt-0.5",children:r})]}),e("input",{type:"checkbox",checked:l,onChange:(p)=>c(p.currentTarget.checked),"aria-label":t,className:`${be} mt-0.5 accent-ink flex-shrink-0`})]})}function wi({settings:t,onUpdate:r}){let l=hu(),c=R("editorAutoCloseBrackets"),p=R("editorAutocomplete"),g=(h)=>{let v={...hu(),...h};hr(h),r((y)=>({...y})),window.dispatchEvent(new CustomEvent(Pd,{detail:v}))};return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Editor typing"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"Both change what typing does, which is why they are switches rather than always-on."})]}),e("div",{className:"space-y-2.5 rounded-lg border border-ink/10 p-3",children:[e(ki,{label:"Auto-close brackets",hint:"Typing ( or { inserts the matching closer, and typing it again steps over it.",checked:typeof c==="boolean"?c:Dl.autoCloseBrackets,onChange:(h)=>g({editorAutoCloseBrackets:h})}),e(ki,{label:"Suggest words from the file",hint:`Offers identifiers already near the caret (${l.autocomplete?"on":"off"}). Words only — this is not a language server.`,checked:typeof p==="boolean"?p:Dl.autocomplete,onChange:(h)=>g({editorAutocomplete:h})})]})]})}function Si({label:t,hint:r,checked:l,onChange:c}){return e("label",{className:"flex items-start justify-between gap-3 cursor-pointer",children:[e("span",{className:"min-w-0",children:[e("span",{className:"block text-xs text-ink",children:t}),e("span",{className:"block text-[11px] text-ink/50 mt-0.5",children:r})]}),e("input",{type:"checkbox",checked:l,onChange:(p)=>c(p.target.checked),className:`${be} mt-0.5 shrink-0 accent-ink`})]})}function Ni({settings:t,onUpdate:r}){let l=R("editorBlame"),c=R("editorBlameInline"),p=Ei(),g=(h)=>{let v={...Ei(),...h};hr(h),r((y)=>({...y})),window.dispatchEvent(new CustomEvent(Is,{detail:v}))};return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Line blame"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"Who last touched a line, and which commit. Read from git, so it needs a committed file."})]}),e("div",{className:"space-y-2.5 rounded-lg border border-ink/10 p-3",children:[e(Si,{label:"Show blame on hover",hint:"Hover a line number — or the label, when it is on — to see the author, the commit and the line's own history.",checked:typeof l==="boolean"?l:Nl.enabled,onChange:(h)=>g({editorBlame:h})}),e(Si,{label:"Show the label in the editor",hint:`Puts “author · age” at the end of each block. It costs horizontal room, so it is off on a narrow panel by default (${p.inline?"on":"off"}).`,checked:typeof c==="boolean"?c:Nl.inline,onChange:(h)=>g({editorBlameInline:h})})]})]})}var cu={theme:_r,sidebar:Hr,"panel-nav":Qr,surface:si,border:pi,icons:bi,tray:hi,"editor-font":vi,"editor-theme":xi,"editor-indent":yi,"editor-typing":wi,"editor-blame":Ni};function Pi({settings:t,onUpdate:r}){let l=Pe(),[c,p]=n(Mt[0].id),g=Mt.find((h)=>h.id===c)??Mt[0];return e(Ce,{pane:l.pane,onBack:l.back,listLabel:"Appearance settings",detailLabel:g.label,detailDescription:g.description,list:e(tn,{groups:Mt,activeGroupId:g.id,onSelectGroup:(h)=>{p(h),l.openDetail()}}),detail:e(ln,{group:g,children:g.sections.map((h)=>{let v=cu[h];return e(v,{settings:t,onUpdate:r},h)})})})}var Lt=[{id:"layout",label:"Layout",hint:"Chat width and composer shape",description:"How wide the conversation is drawn, and the shape of the box you type into.",icon:nn,sections:["width","composer"]},{id:"transcript",label:"Transcript",hint:"Tool calls, changed files and follow-up dispatch",description:"How a tool call is drawn, whether a run lists the files it changed, and what happens to a prompt sent while the agent is still running.",icon:Vr,sections:["tool-calls","changed-files","follow-up"]},{id:"sessions",label:"Sessions",hint:"Titles and goal mode",description:"How a session gets its name, and the defaults a new goal starts with.",icon:mn,sections:["titles","goal"]}];var pu={compact:"60%",wide:"85%",full:"100%",custom:"80%"};function Ci({settings:t,onUpdate:r}){let l=t.chatWidthMode;return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Chat Width"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"How wide the conversation is drawn. The composer follows the transcript, and no mode hides a panel. Drag the right edge of the transcript for any width in between."})]}),e("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-3",role:"group","aria-label":"Chat width",children:[...Cg,"custom"].map((c)=>{let p=XA[c],g=l===c;return e("div",{onClick:()=>r({chatWidthMode:c}),role:"button",tabIndex:0,"aria-pressed":g,onKeyDown:(h)=>{if(h.key==="Enter"||h.key===" ")h.preventDefault(),r({chatWidthMode:c})},className:`p-3.5 rounded-lg border text-left transition-all cursor-pointer flex flex-col justify-between select-none ${g?"border-ink bg-ink/5 ring-1 ring-ink/20 shadow-xs":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/[0.02]"}`,children:e("div",{children:[e("div",{className:"flex items-center justify-between mb-2",children:[e("span",{className:"font-semibold text-xs text-ink",children:[p.label,c==="custom"&&e("span",{className:"ml-1.5 font-mono font-normal text-[10px] text-ink/55",children:[t.chatColumnWidth,"px"]})]}),e("div",{className:`w-4 h-4 rounded-full border flex items-center justify-center ${g?"border-ink bg-ink text-paper":"border-ink/30 bg-transparent"}`,children:g&&e(f,{size:10,strokeWidth:3})})]}),e("div",{"aria-hidden":!0,className:"h-1.5 rounded-full bg-ink/10 mb-2.5 overflow-hidden",children:e("div",{className:`h-full rounded-full ${g?"bg-ink":"bg-ink/35"}`,style:{width:pu[c]}})}),e("p",{className:"text-[11px] text-ink/65 leading-relaxed",children:p.description})]})},c)})}),e("p",{className:"text-[10px] text-ink/45 font-mono",children:"On a phone the column already fills the screen, so the mode and the drag have no visible effect."})]})}function Ti({active:t=!1}){return e("span",{className:`h-[6px] w-[16px] rounded-sm border ${t?"border-ink/40 bg-ink/15":"border-ink/20 bg-ink/5"}`})}function uu({hero:t=!1}){return e("span",{className:`flex flex-col gap-[3px] rounded-md border border-ink/15 bg-paper px-1.5 py-1 ${t?"flex-1 justify-center":""}`,children:[e("span",{className:"h-[2.5px] w-[72%] rounded-full bg-ink/25"}),e("span",{className:"h-[2.5px] w-[54%] rounded-full bg-ink/20"}),e("span",{className:"h-[2.5px] w-[30%] rounded-full bg-ink/15"})]})}function mu({rail:t=!1}){if(t)return e("span",{className:"flex items-center gap-1 border-t border-ink/10 px-1 pt-1 font-mono",children:[e("span",{className:"h-[2.5px] w-[14px] rounded-full bg-ink/30"}),e("span",{className:"h-[2.5px] w-[9px] rounded-full bg-ink/20"}),e("span",{className:"h-[2.5px] w-[11px] rounded-full bg-ink/20"}),e("span",{className:"ml-auto h-[7px] w-[7px] rounded-sm bg-ink/80"})]});return e("span",{className:"flex items-center gap-1 px-1",children:[e("span",{className:"h-[6px] w-[20px] rounded-sm bg-ink/15"}),e("span",{className:"h-[6px] w-[10px] rounded-sm bg-ink/10"}),e("span",{className:"ml-auto h-[7px] w-[7px] rounded-full border border-ink/25"}),e("span",{className:"h-[7px] w-[7px] rounded-sm bg-ink/80"})]})}var gu={classic:"rounded-md bg-paper border-ink/10",calm:"rounded-lg bg-paper border-ink/10",console:"rounded-sm bg-paper border-ink/10",stage:"rounded-md bg-paper border-ink/15",glass:"rounded-xl border-ink/15 bg-gradient-to-b from-ink/[0.06] to-transparent"};function bu({style:t}){let r=gm({style:t,hero:t==="stage"});return e("span",{className:`flex h-full flex-col gap-1 border p-1 ${gu[t]}`,"aria-hidden":"true",children:r.wire.map((l,c)=>l==="draft"?e(uu,{hero:t==="stage"},c):l==="chip"?e("span",{className:"flex items-center gap-1 px-1",children:[e(Ti,{active:t!=="calm"}),e(Ti,{})]},c):e(mu,{rail:r.toolbarTone==="rail"},c))})}function Ii({settings:t,onUpdate:r}){let l=yc(t.composerStyle);return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Composer"}),e("p",{className:"mt-0.5 text-[11px] text-ink/60",children:"The shape of the box you type into. Every style offers the same controls — attachments, plan and goal, access mode, model, thinking, voice, send — and only their order and frame change. Applies to desktop and phone, and takes effect immediately."})]}),e("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",role:"group","aria-label":"Composer style",children:ch.map((c)=>{let p=dh[c],g=c===l;return e("button",{type:"button",onClick:()=>r({composerStyle:c}),"aria-pressed":g,"aria-label":`${p.label} composer — ${p.description}`,className:`flex flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors cursor-pointer ${g?"border-ink/40 bg-ink/5":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5"}`,children:[e("span",{className:"block h-[92px]",children:e(bu,{style:c})}),e("span",{className:"flex items-center gap-1.5",children:[e("span",{className:"text-xs font-semibold text-ink",children:p.label}),g&&e("span",{className:"ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[10px] font-semibold text-paper",children:"active"})]}),e("span",{className:"text-[11px] leading-relaxed text-ink/60",children:p.description})]},c)})})]})}function vu({mode:t}){if(t==="card")return e("div",{"aria-hidden":!0,className:"space-y-1 rounded-md border border-ink/15 bg-paper px-2 py-1.5",children:[e("div",{className:"flex items-center gap-1",children:[e("span",{className:"h-1.5 w-1.5 rounded-full bg-ink/50"}),e("span",{className:"h-1 w-10 rounded-full bg-ink/35"}),e("span",{className:"ml-auto h-1 w-5 rounded-full bg-ink/20"})]}),e("div",{className:"h-1 w-16 rounded-full bg-ink/15"})]});if(t==="compact")return e("div",{"aria-hidden":!0,className:"space-y-1.5 rounded-md border border-transparent px-1 py-1",children:[0,1].map((r)=>e("div",{className:"flex items-center gap-1",children:[e("span",{className:"h-1.5 w-1.5 rounded-full bg-ink/40"}),e("span",{className:"h-1 w-8 rounded-full bg-ink/30"}),e("span",{className:"ml-auto h-1 w-6 rounded-full bg-ink/15"})]},r))});if(t==="trace")return e("div",{"aria-hidden":!0,className:"relative ml-1 pl-3 py-1",children:[e("span",{className:"absolute left-[3px] top-1 bottom-1 w-px bg-ink/20"}),[0,1,2].map((r)=>e("div",{className:"flex items-center gap-1 py-0.5",children:[e("span",{className:"h-1.5 w-1.5 rounded-full bg-ink/40"}),e("span",{className:"h-1 w-10 rounded-full bg-ink/25"})]},r))]});if(t==="tui")return e("div",{"aria-hidden":!0,className:"space-y-1 px-1 py-1 font-mono",children:[0,1].map((r)=>e("div",{className:"flex items-baseline gap-1",children:[e("span",{className:"text-[6px] text-success",children:"✔"}),e("span",{className:"h-1 w-3 rounded-full bg-info/70"}),e("span",{className:"h-1 w-6 rounded-full bg-meta/70"}),e("span",{className:"ml-auto h-1 w-2 rounded-full bg-ink/25"})]},r))});return e("div",{"aria-hidden":!0,className:"space-y-1.5 px-1 py-1",children:[e("div",{className:"h-1 w-20 rounded-full bg-ink/25"}),e("div",{className:"h-1 w-14 rounded-full bg-ink/15"})]})}function Ai({settings:t,onUpdate:r}){let l=t.toolRenderStyle;return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Tool Calls"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"How a tool call is drawn in the transcript. Every style shows the same outcome, facts and body."})]}),e("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:th.map((c)=>{let p=nh[c],g=l===c;return e("div",{onClick:()=>r({toolRenderStyle:c}),role:"button",tabIndex:0,"aria-pressed":g,onKeyDown:(h)=>{if(h.key==="Enter"||h.key===" ")h.preventDefault(),r({toolRenderStyle:c})},className:`p-3.5 rounded-lg border text-left transition-all cursor-pointer flex flex-col justify-between select-none ${g?"border-ink bg-ink/5 ring-1 ring-ink/20 shadow-xs":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/[0.02]"}`,children:e("div",{children:[e("div",{className:"flex items-center justify-between mb-2",children:[e("span",{className:"font-semibold text-xs text-ink",children:p.label}),e("div",{className:`w-4 h-4 rounded-full border flex items-center justify-center ${g?"border-ink bg-ink text-paper":"border-ink/30 bg-transparent"}`,children:g&&e(f,{size:10,strokeWidth:3})})]}),e("div",{className:"mb-2.5 h-12 rounded-md bg-canvas/50 px-1 py-1",children:e(vu,{mode:c})}),e("p",{className:"text-[11px] text-ink/65 leading-relaxed",children:p.description})]})},c)})}),e("p",{className:"text-[10px] text-ink/45 font-mono",children:"The style is global: it applies to every session, and the composer keeps its own frame."})]})}function xu({label:t,enabled:r,onToggle:l}){return e("button",{type:"button",role:"switch","aria-checked":r,"aria-label":`${r?"Disable":"Enable"} ${t}`,onClick:l,className:`relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none ${r?"bg-ink":"bg-ink/20"}`,children:e("span",{"aria-hidden":"true",className:`pointer-events-none inline-block h-5 w-5 transform rounded-full bg-paper shadow ring-0 transition duration-200 ease-in-out ${r?"translate-x-5":"translate-x-0"}`})})}function Ri({settings:t,onUpdate:r}){let l=t.showChangedFiles;return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Changed Files"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"A collapsed list of the files a run changed, above its footer. Clicking a file opens the agent's own diff — the content it wrote, not the current worktree."})]}),e("div",{className:"flex items-start justify-between gap-4 py-3",children:[e("div",{className:"flex items-start gap-3",children:[e("div",{className:"w-8 h-8 rounded-md bg-ink/5 border border-ink/10 flex items-center justify-center flex-shrink-0 mt-0.5",children:e(vr,{size:16,className:l?"text-ink":"text-ink/40"})}),e("div",{children:[e("div",{className:"text-sm font-semibold text-ink",children:"Show changed files"}),e("p",{className:"text-ink/65 text-[11px] mt-1 leading-relaxed",children:"Read from the session's change journal. Sessions recorded before omp 18.20.1 have no journal, so the list stays empty there."})]})]}),e(xu,{label:"Show changed files",enabled:l,onToggle:()=>r({showChangedFiles:!l})})]})]})}function Mi({settings:t,onUpdate:r}){return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Follow-up Dispatch"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"Choose how new user prompts are handled while the AI agent is actively executing."})]}),e("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e("div",{onClick:()=>r({followUpBehavior:"queue"}),role:"button",tabIndex:0,onKeyDown:(l)=>l.key==="Enter"&&r({followUpBehavior:"queue"}),className:`p-3.5 rounded-lg border text-left transition-all cursor-pointer flex flex-col justify-between select-none ${t.followUpBehavior==="queue"?"border-ink bg-ink/5 ring-1 ring-ink/20 shadow-xs":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/[0.02]"}`,children:[e("div",{children:[e("div",{className:"flex items-center justify-between mb-2",children:[e("div",{className:"flex items-center gap-2",children:[e("div",{className:`w-7 h-7 rounded-md flex items-center justify-center ${t.followUpBehavior==="queue"?"bg-ink text-paper":"bg-ink/5 text-ink/70"}`,children:e(Vr,{size:15})}),e("span",{className:"font-semibold text-xs text-ink",children:"Queue Mode"})]}),e("span",{className:"text-[10px] font-mono uppercase px-1.5 py-0.5 rounded bg-ink/10 text-ink/70 font-medium",children:"Sequential"})]}),e("p",{className:"text-[11px] text-ink/65 leading-relaxed",children:"Messages wait in an execution queue and run in succession once current inference completes."})]}),e("div",{className:"mt-3 pt-2.5 border-t border-ink/10 flex items-center justify-between text-[11px]",children:[e("span",{className:"text-ink/50 text-[10px]",children:"Recommended for batch operations"}),e("div",{className:`w-4 h-4 rounded-full border flex items-center justify-center ${t.followUpBehavior==="queue"?"border-ink bg-ink text-paper":"border-ink/30 bg-transparent"}`,children:t.followUpBehavior==="queue"&&e(f,{size:10,strokeWidth:3})})]})]}),e("div",{onClick:()=>r({followUpBehavior:"steering"}),role:"button",tabIndex:0,onKeyDown:(l)=>l.key==="Enter"&&r({followUpBehavior:"steering"}),className:`p-3.5 rounded-lg border text-left transition-all cursor-pointer flex flex-col justify-between select-none ${t.followUpBehavior==="steering"?"border-ink bg-ink/5 ring-1 ring-ink/20 shadow-xs":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/[0.02]"}`,children:[e("div",{children:[e("div",{className:"flex items-center justify-between mb-2",children:[e("div",{className:"flex items-center gap-2",children:[e("div",{className:`w-7 h-7 rounded-md flex items-center justify-center ${t.followUpBehavior==="steering"?"bg-ink text-paper":"bg-ink/5 text-ink/70"}`,children:e(qt,{size:15})}),e("span",{className:"font-semibold text-xs text-ink",children:"Steering Mode"})]}),e("span",{className:"text-[10px] font-mono uppercase px-1.5 py-0.5 rounded bg-ink/10 text-ink/70 font-medium",children:"Intervention"})]}),e("p",{className:"text-[11px] text-ink/65 leading-relaxed",children:"Immediately redirects current agent trajectory and focuses runtime resources onto the new instruction."})]}),e("div",{className:"mt-3 pt-2.5 border-t border-ink/10 flex items-center justify-between text-[11px]",children:[e("span",{className:"text-ink/50 text-[10px]",children:"Recommended for active debugging"}),e("div",{className:`w-4 h-4 rounded-full border flex items-center justify-center ${t.followUpBehavior==="steering"?"border-ink bg-ink text-paper":"border-ink/30 bg-transparent"}`,children:t.followUpBehavior==="steering"&&e(f,{size:10,strokeWidth:3})})]})]})]})]})}var yu=[{enabled:!0,label:"Generate Automatically",badge:"Default",icon:Se,description:`As soon as your first message lands, the session is named from it using omp's own tiny title model — retried once when the run ends if that first attempt came back empty. Sessions stop showing "New Session - <timestamp>" in the sidebar.`,note:"One small model call per session"},{enabled:!1,label:"Manual Only",badge:"Opt-out",icon:Zr,description:"Sessions keep their timestamp placeholder until you rename them from the sidebar. Choose this when every title should be deliberate, or to avoid the extra model call.",note:"No background model calls"}];function Li({settings:t,onUpdate:r}){let l=t.autoSessionTitle??!0;return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Session Titles"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"How a session gets its display name. A name you set yourself is never replaced."})]}),e("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:yu.map(({enabled:c,label:p,badge:g,icon:h,description:v,note:y})=>{let w=l===c,k=()=>r({autoSessionTitle:c});return e("div",{onClick:k,role:"button",tabIndex:0,onKeyDown:(C)=>C.key==="Enter"&&k(),className:`p-3.5 rounded-lg border text-left transition-all cursor-pointer flex flex-col justify-between select-none ${w?"border-ink bg-ink/5 ring-1 ring-ink/20 shadow-xs":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/[0.02]"}`,children:[e("div",{children:[e("div",{className:"flex items-center justify-between mb-2",children:[e("div",{className:"flex items-center gap-2",children:[e("div",{className:`w-7 h-7 rounded-md flex items-center justify-center ${w?"bg-ink text-paper":"bg-ink/5 text-ink/70"}`,children:e(h,{size:15})}),e("span",{className:"font-semibold text-xs text-ink",children:p})]}),e("span",{className:"text-[10px] font-mono uppercase px-1.5 py-0.5 rounded bg-ink/10 text-ink/70 font-medium",children:g})]}),e("p",{className:"text-[11px] text-ink/70 leading-relaxed",children:v})]}),e("div",{className:"mt-3 pt-2.5 border-t border-ink/10 flex items-center justify-between text-[11px]",children:[e("span",{className:"text-ink/50",children:y}),w&&e("span",{className:"flex items-center gap-1 text-ink font-medium",children:[e(f,{size:12})," Active"]})]})]},p)})})]})}var ku="flex w-full min-w-0 items-center justify-between gap-2 rounded-md border border-ink/20 bg-paper px-2 py-1.5 text-left font-mono text-[11px] text-ink transition-colors hover:border-ink/40 focus:border-ink/50 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50";function Ue({value:t,options:r,placeholder:l,ariaLabel:c,onChange:p,disabled:g,className:h,searchable:v=!0}){let[y,w]=n(null),[k,C]=n(""),[N,A]=n(0),T=i(null),F=i(null),S=i([]),M=i(`search-select-${Math.random().toString(36).slice(2,9)}`).current,I=r.find((q)=>q.value===t),O=y!==null,j=u(()=>{let q=k.trim();if(!q)return r;return r.filter((z)=>cs(`${z.label} ${z.value} ${z.hint??""}`,q))},[r,k]),H=u(()=>{let q=[];for(let z of j){let V=z.group??"",X=q.find((ee)=>ee.name===V);if(X)X.rows.push(z);else q.push({name:V,rows:[z]})}return q},[j]),K=(q=!1)=>{if(w(null),C(""),q)T.current?.focus()},Y=()=>{if(g||!T.current)return;let q=Math.max(0,r.findIndex((z)=>z.value===t));C(""),A(q),w(Et(T.current))},G=(q)=>{if(q!==t)p(q);K(!0)};o(()=>{A(0)},[k]),o(()=>{if(!O)return;S.current[N]?.scrollIntoView({block:"nearest"})},[O,N]),o(()=>{if(O)F.current?.focus()},[O]);let W=(q)=>{if(q.key==="ArrowDown")q.preventDefault(),A((z)=>Math.max(0,Math.min(j.length-1,z+1)));else if(q.key==="ArrowUp")q.preventDefault(),A((z)=>Math.max(0,z-1));else if(q.key==="Home")q.preventDefault(),A(0);else if(q.key==="End")q.preventDefault(),A(Math.max(0,j.length-1));else if(q.key==="Enter"){q.preventDefault();let z=j[N];if(z)G(z.value)}};return e(d,{children:[e("button",{ref:T,type:"button",role:"combobox","aria-label":c,"aria-haspopup":"listbox","aria-expanded":O,"aria-controls":O?M:void 0,disabled:g,title:I?.label??l,onClick:()=>O?K():Y(),onKeyDown:(q)=>{if(q.key==="ArrowDown"||q.key==="Enter"||q.key===" ")q.preventDefault(),Y()},className:`${ku} ${h??""}`,children:[e("span",{className:`truncate ${I?"":"text-ink/40"}`,children:I?.label??(t?`${t} (not listed)`:l)}),e(B,{size:12,className:`flex-shrink-0 text-ink/40 transition-transform ${O?"rotate-180":""}`})]}),e(Qt,{anchor:y,align:"start",className:"w-72 max-w-[calc(100vw-2rem)] rounded-md border border-ink/15 bg-paper py-1 text-xs shadow-lg",...{"aria-label":c},onClose:()=>K(!0),children:e("div",{onKeyDown:W,children:[v&&e("div",{className:"flex items-center gap-1.5 border-b border-ink/10 px-2 py-1.5",children:[e(U,{size:11,className:"flex-shrink-0 text-ink/40"}),e("input",{ref:F,type:"text",value:k,"aria-label":`Search ${c}`,placeholder:"Search…",onInput:(q)=>C(q.currentTarget.value),className:"w-full min-w-0 bg-transparent text-xs text-ink outline-none placeholder:text-ink/35"})]}),e("div",{id:M,role:"listbox","aria-label":c,className:"max-h-56 overflow-y-auto py-1",children:[e("button",{type:"button",role:"option","aria-selected":t==="",ref:(q)=>{S.current[0]=q},onClick:()=>G(""),onMouseEnter:()=>A(0),className:`flex w-full items-center justify-between gap-2 px-3 py-1.5 text-left ${t===""?"text-ink":"text-ink/60"} hover:bg-ink/5`,children:[e("span",{className:"truncate italic",children:l}),t===""&&e(f,{size:11,className:"flex-shrink-0"})]}),t!==""&&!I&&e("button",{type:"button",role:"option","aria-selected":!0,onClick:()=>G(t),className:"flex w-full items-center justify-between gap-2 px-3 py-1.5 text-left text-ink",children:[e("span",{className:"truncate",children:[t," (not listed)"]}),e(f,{size:11,className:"flex-shrink-0"})]}),j.length===0?e("div",{className:"px-3 py-2 italic text-ink/40",children:["No match for “",k.trim(),"”"]}):H.map((q)=>e("div",{children:[q.name&&e("div",{className:"px-3 pb-0.5 pt-2 text-[9px] font-semibold uppercase tracking-wider text-ink/35",children:q.name}),q.rows.map((z)=>{let V=j.indexOf(z),X=z.value===t;return e("button",{type:"button",role:"option","aria-selected":X,ref:(ee)=>{S.current[V+1]=ee},onClick:()=>G(z.value),onMouseEnter:()=>A(V),title:z.hint??z.value,className:`flex w-full items-start justify-between gap-2 px-3 py-1.5 text-left transition-colors ${V===N?"bg-ink/5":""} ${X?"font-medium text-ink":"text-ink/75"}`,children:[e("span",{className:"min-w-0",children:[e("span",{className:"block truncate",children:z.label}),z.hint&&e("span",{className:"block truncate font-mono text-[10px] text-ink/40",children:z.hint})]}),X&&e(f,{size:11,className:"mt-0.5 flex-shrink-0"})]},z.value)})]},q.name||"__flat"))]})]})})]})}var wu=[{enabled:!0,label:"Independent auditor",badge:"Default",description:"After every finished turn a separate model reads the objective and the agent's own report and decides: keep going, done, or needs you. Without it nothing advances a goal on its own.",note:"One extra model call per turn"},{enabled:!1,label:"Manual only",badge:"Opt-out",description:"Goals still exist — objective, pause, resume and the token budget all work — but the loop never continues by itself. Use it when a goal should only ever run the turns you ask for.",note:"No background model calls"}];function Oi({settings:t,onUpdate:r}){let l=xc(),[c,p]=n([]),[g,h]=n(!0),v=t.goalAuditEnabled??!0,y=t.goalAuditModel??"",w=t.goalDefaultBudget??null,[k,C]=n(w===null?"":String(w));o(()=>{C(w===null?"":String(w))},[w]);let N=()=>{let A=Cm(k);if(C(A===null?"":String(A)),A!==w)r({goalDefaultBudget:A})};return o(()=>{let A=!0;return Va().then((T)=>{if(!A)return;p(Array.isArray(T.modelList)?T.modelList.map((F)=>({id:F.id,name:F.name,provider:F.provider})):[])}).catch(()=>{}).finally(()=>{if(A)h(!1)}),()=>{A=!1}},[]),e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Goal Mode"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"A goal keeps a session working toward one objective until it is done, out of budget, or the auditor says it needs you."})]}),e("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:wu.map(({enabled:A,label:T,badge:F,description:S,note:M})=>{let I=v===A,O=()=>r({goalAuditEnabled:A});return e("div",{onClick:O,role:"button",tabIndex:0,onKeyDown:(j)=>j.key==="Enter"&&O(),className:`p-3.5 rounded-lg border text-left transition-all cursor-pointer flex flex-col justify-between select-none ${I?"border-ink bg-ink/5 ring-1 ring-ink/20 shadow-xs":"border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/[0.02]"}`,children:[e("div",{children:[e("div",{className:"flex items-center justify-between mb-2",children:[e("div",{className:"flex items-center gap-2",children:[e("div",{className:`w-7 h-7 rounded-md flex items-center justify-center ${I?"bg-ink text-paper":"bg-ink/5 text-ink/70"}`,children:e(Eo,{size:15})}),e("span",{className:"font-semibold text-xs text-ink",children:T})]}),e("span",{className:"text-[10px] font-mono uppercase px-1.5 py-0.5 rounded bg-ink/10 text-ink/70 font-medium",children:F})]}),e("p",{className:"text-[11px] text-ink/65 leading-relaxed",children:S})]}),e("div",{className:"mt-3 pt-2.5 border-t border-ink/10 flex items-center justify-between text-[11px]",children:[e("span",{className:"text-ink/50 text-[10px]",children:M}),e("div",{className:`w-4 h-4 rounded-full border flex items-center justify-center ${I?"border-ink bg-ink text-paper":"border-ink/30 bg-transparent"}`,children:I&&e(f,{size:10,strokeWidth:3})})]})]},T)})}),v&&e("div",{className:"rounded-lg border border-ink/15 bg-paper p-3.5 space-y-3",children:e("div",{children:[e("label",{className:"mb-1 block text-[10px] font-semibold uppercase tracking-wider text-ink/45",children:"Auditor model"}),e(Ue,{ariaLabel:"Auditor model",value:y,onChange:(A)=>r({goalAuditModel:A}),disabled:g,placeholder:"Session model (default)",className:"w-full py-1.5 text-[11.5px]",options:c.map((A)=>({value:`${A.provider}/${A.id}`,label:A.name,hint:`${A.provider}/${A.id}`,group:ls(A.provider,l)}))}),e("p",{className:"mt-1 text-[10.5px] text-ink/45",children:"The audit is a classification, not a task: it runs with thinking off, one small call per turn."})]})}),e("div",{className:"rounded-lg border border-ink/15 bg-paper p-3.5",children:[e("label",{className:"mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wider text-ink/45",children:[e(oi,{size:11})," Default token budget"]}),e("div",{className:"flex items-center gap-2",children:[e("input",{value:k,onChange:(A)=>C(A.currentTarget.value),onBlur:N,onKeyDown:(A)=>{if(A.key==="Enter")N()},placeholder:"none: the turn ceiling is then the only stop",inputMode:"numeric","aria-label":"Default goal token budget",className:"w-56 rounded border border-ink/15 bg-paper px-2 py-1.5 font-mono text-[11.5px] outline-none focus:border-ink"}),e("span",{className:"text-[10.5px] text-ink/45",children:"New goals start with this budget; a goal you set explicitly keeps its own."})]})]}),e("div",{className:"flex items-start gap-2 rounded-lg border border-ink/10 bg-canvas/40 p-3 text-[11px] text-ink/60",children:[e($t,{size:12,className:"mt-0.5 shrink-0"}),e("span",{children:"The objective is set per goal from the composer's target button. The auditor judges progress from the objective and the agent's own report only — write an objective that says what finished looks like."})]})]})}var Nu={width:Ci,composer:Ii,"tool-calls":Ai,"changed-files":Ri,"follow-up":Mi,titles:Li,goal:Oi};function Di({settings:t,onUpdate:r}){let l=Pe(),[c,p]=n(Lt[0].id),g=Lt.find((h)=>h.id===c)??Lt[0];return e(Ce,{pane:l.pane,onBack:l.back,listLabel:"Chat settings",detailLabel:g.label,detailDescription:g.description,list:e(tn,{groups:Lt,activeGroupId:g.id,onSelectGroup:(h)=>{p(h),l.openDetail()}}),detail:e(ln,{group:g,children:g.sections.map((h)=>{let v=Nu[h];return e(v,{settings:t,onUpdate:r},h)})})})}function Ui(t){let r=new Map;for(let c of t){let p=Eh(c.chord),g=r.get(p);if(g)g.push(c);else r.set(p,[c])}let l=[];for(let c of r.values())for(let p=0;p<c.length;p+=1)for(let g=p+1;g<c.length;g+=1){let h=c[p],v=c[g];if(h.command===v.command)continue;l.push({chord:h.chord,a:h,b:v,certain:!h.when||!v.when||h.when===v.when})}return l}var Pu={Shift:!0,Control:!0,Alt:!0,Meta:!0,OS:!0,Super:!0,Hyper:!0,CapsLock:!0,Fn:!0},Cu={ShiftLeft:!0,ShiftRight:!0,ControlLeft:!0,ControlRight:!0,AltLeft:!0,AltRight:!0,MetaLeft:!0,MetaRight:!0,OSLeft:!0,OSRight:!0,CapsLock:!0};function $i(t){return Pu[t.key]===!0||Cu[t.code]===!0}function Fi({chord:t,onCommit:r}){let[l,c]=n(!1),[p,g]=n([]),h=i(null);o(()=>{if(l)h.current?.focus()},[l]);let v=()=>{c(!1),g([])},y=(k)=>{if(!l)return;if(k.preventDefault(),k.stopPropagation(),k.key==="Escape"){v();return}if(k.key==="Backspace"||k.key==="Delete"){if(p.length===0)r(null),v();else g([]);return}if(k.key==="Enter"&&p.length===1){r(Qg(p)),v();return}if($i(k))return;let C=Em(k);if(p.length===0){g([C]);return}r(Qg([p[0],C])),v()},w=l?p.length>0?`${No(p,Bt())} …`:"Press keys…":t||"Unassigned";return e("button",{ref:h,type:"button",onClick:()=>{c(!0),g([])},onBlur:()=>{if(l)v()},onKeyDown:y,"aria-label":l?"Recording shortcut, press keys":`Shortcut ${t||"unassigned"}, click to change`,className:`min-w-[7rem] px-2 py-1 rounded-md border text-[11px] font-mono transition-colors ${l?"border-ink/60 bg-ink/5 text-ink":"border-ink/20 text-ink/70 hover:border-ink/40 hover:text-ink"}`,children:w})}function ji(){let{commands:t,chords:r,rules:l}=Cc(),[c,p]=n(()=>Bm()),[g,h]=n(""),v=u(()=>Ui(l),[l]),y=Bt(),w=(T)=>t.find((F)=>F.id===T)?.title??T,k=(T,F)=>{let S={...c,[T]:F};p(S),cd(S),Rg(S)},C=(T)=>{let F={...c};delete F[T],p(F),cd(F),Rg(F)},N=g.trim().toLowerCase(),A=t.filter((T)=>!N||T.title.toLowerCase().includes(N)||(r.get(T.id)??"").toLowerCase().includes(N)).sort((T,F)=>T.category.localeCompare(F.category)||T.title.localeCompare(F.title));return e("section",{className:"space-y-3",children:[e("div",{className:"flex items-center justify-between gap-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Shortcuts"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"Click a chord to record a new one. Two strokes are allowed; Enter keeps a single stroke."})]}),e("div",{className:"flex items-center gap-2 px-2.5 py-1.5 border border-ink/15 rounded-md bg-canvas",children:[e(U,{size:13,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:g,onInput:(T)=>h(T.currentTarget.value),placeholder:"Filter","aria-label":"Filter shortcuts",className:"w-32 bg-transparent text-xs text-ink focus:outline-none placeholder-ink/40"})]})]}),v.length>0?e("div",{className:"border border-ink/15 rounded-lg p-3 space-y-1.5 bg-ink/[0.02]",children:[e("p",{className:"text-[11px] font-semibold text-ink/75",children:[v.length," chord ",v.length===1?"conflict":"conflicts"]}),v.map((T)=>e("p",{className:"text-[11px] text-ink/60",children:[e("span",{className:"font-mono text-ink/80",children:No(T.chord,y)})," ","— ",w(T.a.command)," and ",w(T.b.command),T.certain?"":" (may not overlap)"]},`${T.a.command}-${T.b.command}`))]}):null,e("div",{className:"bg-paper border border-ink/15 rounded-lg divide-y divide-ink/10 shadow-xs overflow-hidden",children:A.length===0?e("p",{className:"px-3 py-4 text-center text-xs text-ink/50",children:"No command matches that filter."}):A.map((T)=>{let F=c[T.id]!==void 0;return e("div",{className:"px-3 py-2 flex items-center justify-between gap-3",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-xs font-medium text-ink truncate",children:T.title}),e("div",{className:"text-[10px] text-ink/45",children:[T.category,T.pluginId?` · ${T.pluginId}`:"",F?" · custom":""]})]}),e("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e(Fi,{chord:r.get(T.id)??"",onCommit:(S)=>k(T.id,S)}),F?e("button",{type:"button",onClick:()=>C(T.id),title:"Reset to default","aria-label":`Reset ${T.title} to its default shortcut`,className:"p-1 rounded text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors",children:e(wt,{size:12})}):null]})]},T.id)})})]})}function Bi({settings:t,onUpdate:r}){let l=["Enter","Shift + Enter","Ctrl / Cmd + Enter"],c=(g,h)=>{r((v)=>{let y={[g]:h},w=["keybindingSend","keybindingNewLine","keybindingSteering"].filter((k)=>k!==g);for(let k of w)if(v[k]===h)y[k]=v[g];return{...v,...y}})},p=[{id:"keybindingSend",label:"Send Message",desc:"Submit prompt and initiate agent reasoning",icon:Xe,value:t.keybindingSend||"Enter"},{id:"keybindingNewLine",label:"Line Break",desc:"Insert newline inside input box without dispatching",icon:rn,value:t.keybindingNewLine||"Shift + Enter"},{id:"keybindingSteering",label:"Steering Intervention",desc:"Send prompt with steering interruption priority",icon:qt,value:t.keybindingSteering||"Ctrl / Cmd + Enter"}];return e("section",{className:"space-y-3",children:[e("div",{className:"flex items-center justify-between",children:[e("div",{className:"flex items-center gap-2",children:[e(ka,{size:15,className:"text-ink/70"}),e("h4",{className:"text-sm font-semibold text-ink",children:"Keyboard Shortcuts"})]}),e("span",{className:"text-[10px] text-ink/50 font-mono",children:"Auto-conflict resolution"})]}),e("div",{className:"bg-paper border border-ink/15 rounded-lg divide-y divide-ink/10 shadow-xs overflow-hidden",children:p.map((g)=>e("div",{className:"p-3.5 flex flex-col sm:flex-row sm:items-center justify-between gap-3 hover:bg-ink/[0.015] transition-colors",children:[e("div",{className:"flex items-start gap-3",children:[e("div",{className:"w-7 h-7 rounded-md bg-ink/5 flex items-center justify-center text-ink/70 flex-shrink-0 mt-0.5",children:e(g.icon,{size:14})}),e("div",{children:[e("div",{className:"font-semibold text-xs text-ink",children:g.label}),e("div",{className:"text-[11px] text-ink/60 mt-0.5",children:g.desc})]})]}),e("div",{className:"flex items-center gap-2 self-end sm:self-center",children:e("select",{value:g.value,onChange:(h)=>c(g.id,h.currentTarget.value),className:"bg-paper border border-ink/20 rounded-md px-2.5 py-1.5 outline-none focus:border-ink text-[11px] font-medium text-ink cursor-pointer hover:border-ink/40 transition-colors",children:l.map((h)=>e("option",{value:h,children:h},h))})})]},g.id))})]})}function _i({settings:t,onUpdate:r}){return e("div",{className:"flex-1 h-full overflow-y-auto scrollbar-overlay-container p-4 md:p-6 space-y-8 pb-8",children:[e(ji,{}),e(Bi,{settings:t,onUpdate:r})]})}function Ki({projects:t,selectedProjectId:r,onSelectProject:l,onAddProject:c,onTogglePin:p,isAdding:g=!1,folderFacts:h=[],loadError:v=null}){let y=new Map(h.map((w)=>[w.id,w.totalSessions]));return e("div",{className:"w-full md:w-64 md:border-r border-ink/10 h-full flex flex-col bg-paper/50 flex-shrink-0",children:[e("div",{className:`${xe} px-3.5 justify-between`,style:{height:we},children:[e("span",{className:"text-xs font-semibold text-ink",children:[t.length," project",t.length===1?"":"s"]}),e("button",{type:"button",onClick:c,disabled:g,"aria-label":"Add project",title:"Add project",className:"p-1 rounded text-ink/60 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer disabled:opacity-50",children:e(P,{size:15,strokeWidth:2.2})})]}),e("div",{className:"flex-1 scrollbar-overlay-container p-1.5 space-y-0.5",children:[v&&e("p",{className:"px-2 py-2 text-[11px] text-error",title:v,children:["Projects could not be read: ",v]}),!v&&t.length===0&&e("div",{className:"px-2 py-3 space-y-1.5",children:[e("p",{className:"text-[11.5px] text-ink/60",children:"No projects yet."}),e("button",{type:"button",onClick:c,className:"text-[11px] font-medium text-ink underline underline-offset-2 hover:no-underline cursor-pointer",children:"Add the first one"})]}),t.map((w)=>{let k=w.id===r,C=ra(w.icon),N=w.folderId===void 0?void 0:y.get(w.folderId);return e("div",{className:`group flex items-center rounded-md transition-colors ${k?"bg-ink/10 shadow-2xs":"hover:bg-ink/5"}`,children:[e("button",{type:"button",onClick:()=>l(w.id),"aria-current":k?"true":void 0,className:"flex-1 min-w-0 flex items-center gap-2 px-2.5 py-1.5 text-left cursor-pointer",children:[w.customIconUrl?e("img",{src:w.customIconUrl,alt:"",className:"w-3.5 h-3.5 rounded-xs object-contain flex-shrink-0",referrerPolicy:"no-referrer"}):e(C,{size:14,className:"flex-shrink-0",style:{color:w.accentColor||"currentColor"}}),e("span",{className:`text-[11.5px] truncate flex-1 ${k?"font-medium text-ink":"text-ink/80"}`,children:w.name}),typeof N==="number"&&N>0&&e("span",{className:"shrink-0 font-mono text-[10px] text-ink/40",children:N})]}),e("button",{type:"button",onClick:()=>p(w),"aria-label":w.isPinned?`Unpin ${w.name}`:`Pin ${w.name}`,title:w.isPinned?"Unpin (stop sorting first)":"Pin (sort first in the sidebar)",className:`shrink-0 mr-1 p-1 rounded transition-colors cursor-pointer ${w.isPinned?"text-ink/70 hover:text-ink hover:bg-ink/10":"text-ink/30 hover:text-ink/70 hover:bg-ink/10 opacity-0 group-hover:opacity-100 focus-visible:opacity-100"}`,children:w.isPinned?e(Br,{size:12}):e(ci,{size:12})})]},w.id)})]})]})}function zi({project:t,canDelete:r,isDeleting:l=!1,onDelete:c}){return e("div",{className:"flex items-start justify-between gap-4 pb-4 border-b border-ink/10",children:[e("div",{className:"min-w-0 flex-1",children:[e("h2",{className:"text-xl font-bold tracking-tight text-ink truncate",children:t.name}),e("p",{className:"text-[11px] font-mono text-ink/50 truncate mt-0.5 select-all",children:t.path||"Not bound to a directory"})]}),r&&e("button",{type:"button",onClick:c,disabled:l,title:"Delete this project",className:"inline-flex items-center gap-1.5 shrink-0 px-2.5 py-1.5 text-[11px] font-medium text-ink/50 hover:text-error hover:bg-error/10 rounded-md transition-colors cursor-pointer disabled:opacity-50",children:[e(L,{size:13}),e("span",{children:"Delete"})]})]})}function qi({name:t,disabled:r=!1,onCommit:l}){let[c,p]=n(t);return o(()=>{p(t)},[t]),e("div",{className:"space-y-2",children:[e("label",{htmlFor:"project-name-input",className:"block text-xs font-semibold text-ink",children:"Project name"}),e("input",{id:"project-name-input",type:"text",value:c,disabled:r,onChange:(h)=>p(h.currentTarget.value),onBlur:()=>{let h=c.trim();if(!h){p(t);return}if(h===t)return;l(h)},onKeyDown:(h)=>{if(h.key==="Enter")h.preventDefault(),h.currentTarget.blur();if(h.key==="Escape")p(t),h.currentTarget.blur()},placeholder:"Enter project name…",className:"w-full bg-paper border border-ink/20 rounded-md px-3 py-2 text-xs font-medium text-ink outline-none focus:border-ink/60 transition-colors shadow-2xs disabled:opacity-60"}),e("p",{className:"text-[11px] text-ink/50",children:"Names are unique: the sidebar identifies a project by it."})]})}function Vi({path:t,disabled:r=!1,onCommit:l,onReveal:c,isRevealing:p=!1}){let[g,h]=n(t),[v,y]=n(!1);o(()=>{h(t)},[t]);let w=(k)=>{let C=k.trim();if(C===t)return;l(C)};return e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("label",{htmlFor:"project-path-input",className:"block text-xs font-semibold text-ink",children:"Project directory"}),e("div",{className:"flex items-center gap-1",children:[e("button",{type:"button",onClick:()=>y(!0),disabled:r,className:"inline-flex items-center gap-1 px-2 py-1 rounded-md border border-ink/20 hover:border-ink/40 text-[11px] font-medium text-ink transition-colors cursor-pointer disabled:opacity-50",children:[e(zn,{size:11}),e("span",{children:"Browse…"})]}),e("button",{type:"button",onClick:c,disabled:r||!t||p,title:t?"Reveal in the file manager":"This project is not bound to a directory",className:"inline-flex items-center gap-1 px-2 py-1 rounded-md border border-ink/20 hover:border-ink/40 text-[11px] font-medium text-ink transition-colors cursor-pointer disabled:opacity-40",children:[e(Vt,{size:11}),e("span",{children:"Reveal"})]})]})]}),e("input",{id:"project-path-input",type:"text",value:g,disabled:r,onChange:(k)=>h(k.currentTarget.value),onBlur:()=>w(g),onKeyDown:(k)=>{if(k.key==="Enter")k.preventDefault(),k.currentTarget.blur();if(k.key==="Escape")h(t),k.currentTarget.blur()},placeholder:"~ or /absolute/path, or leave empty for an unbound grouping",spellcheck:!1,className:"w-full bg-paper border border-ink/20 rounded-md px-3 py-2 text-[11.5px] font-mono text-ink outline-none focus:border-ink/60 transition-colors shadow-2xs disabled:opacity-60"}),e("p",{className:"text-[11px] text-ink/50",children:t?"Sessions found under this directory appear in the project. One directory can belong to one project.":"Not bound to a directory: this project groups chats only and discovers no sessions."}),v&&e(Ec,{initialPath:t||void 0,onSelect:(k)=>{y(!1),h(k),w(k)},onClose:()=>y(!1)})]})}function Yi({model:t,models:r,onSelectModel:l,disabled:c=!1}){let[p,g]=n(!1),[h,v]=n(""),y=i(null);ue(y,()=>g(!1));let w=_h(t,r)??"Inherit Kabmo’s default",k=u(()=>{let N=h.trim().toLowerCase();if(!N)return r;return r.filter((A)=>A.name.toLowerCase().includes(N)||A.id.toLowerCase().includes(N)||A.provider.toLowerCase().includes(N))},[r,h]),C=(N)=>{l(N),g(!1),v("")};return e("div",{className:"space-y-2.5",children:[e("div",{className:"flex items-center gap-1.5",children:[e("h4",{className:"text-xs font-semibold text-ink",children:"Defaults for new chats"}),e("span",{className:"inline-flex text-ink/40 hover:text-ink/70 transition-colors cursor-help",title:"The model a chat started in this project uses until you pick another one in the composer.",children:e(ce,{size:12})})]}),e("div",{className:"flex items-center justify-between gap-4 p-3 bg-paper border border-ink/15 rounded-lg",children:[e("div",{className:"min-w-0",children:[e("div",{className:"text-xs font-medium text-ink",children:"Project model"}),e("div",{className:"text-[11px] text-ink/50",children:r.length===0?"No model catalog yet — connect a provider first.":"Applied when the project starts a chat."})]}),e("div",{className:"relative shrink-0",ref:y,children:[e("button",{type:"button",onClick:()=>g((N)=>!N),disabled:c,className:"flex items-center gap-2 px-3 py-1.5 rounded-md border border-ink/20 hover:border-ink/40 bg-paper text-ink text-xs font-medium transition-colors cursor-pointer shadow-2xs max-w-[248px] disabled:opacity-50",children:[e(Se,{size:13,className:"text-ink/70 shrink-0"}),e("span",{className:"truncate",children:w}),e(B,{size:13,className:"text-ink/50 shrink-0"})]}),p&&e("div",{className:"glass-popover absolute right-0 mt-1 w-[288px] bg-paper border border-ink/15 rounded-lg shadow-xl z-50 overflow-hidden",children:[e("div",{className:"flex items-center gap-1.5 px-2.5 py-2 border-b border-ink/10",children:[e(U,{size:12,className:"text-ink/40 shrink-0"}),e("input",{autoFocus:!0,value:h,onInput:(N)=>v(N.currentTarget.value),placeholder:"Search models…",className:"flex-1 bg-transparent text-xs text-ink outline-none placeholder:text-ink/35"})]}),e("div",{className:"max-h-64 scrollbar-overlay-container py-1",children:[e("button",{type:"button",onClick:()=>C(Bc),className:"w-full flex items-center justify-between gap-2 px-3 py-1.5 text-left text-xs hover:bg-ink/5 transition-colors cursor-pointer",children:[e("span",{className:t===Bc?"font-semibold text-ink":"text-ink/80",children:"Inherit Kabmo’s default"}),t===Bc&&e(f,{size:13,className:"text-ink"})]}),k.length===0?e("p",{className:"px-3 py-2 text-[11px] text-ink/50",children:r.length===0?"The catalog is empty.":`No model matches “${h.trim()}”.`}):k.map((N)=>{let A=Ih({provider:N.provider,modelId:N.id}),T=t===A;return e("button",{type:"button",onClick:()=>C(A),className:"w-full flex items-center justify-between gap-2 px-3 py-1.5 text-left hover:bg-ink/5 transition-colors cursor-pointer",children:[e("span",{className:"min-w-0 flex flex-col",children:[e("span",{className:`truncate text-xs ${T?"font-semibold text-ink":"text-ink/85"}`,children:N.name}),e("span",{className:"truncate text-[10.5px] text-ink/45",children:N.provider})]}),T&&e(f,{size:13,className:"text-ink shrink-0"})]},A)})]}),t!==Bc&&e("button",{type:"button",onClick:()=>C(Bc),className:"w-full flex items-center gap-1.5 px-3 py-2 border-t border-ink/10 text-[11px] text-ink/60 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer",children:[e(b,{size:11}),e("span",{children:"Clear the project model"})]})]})]})]})]})}function Qi({accentColor:t,onSelectColor:r,options:l=Fg,disabled:c=!1}){let p=l.length>0?l:Fg,g=t.trim().toLowerCase(),h=p.some((F)=>F.value!==""&&F.value.toLowerCase()===g),v=g!==""&&!h,y=_m(g)??Im,[w,k]=n(y);o(()=>k(y),[y]);let C=(F)=>{let S=_m(F);if(S===null){k(y);return}if(k(S),S!==g)r(S)},N=i(null),A=i(null),T=i({commit:C,clear:()=>r("")});return T.current={commit:C,clear:()=>r("")},o(()=>{let F=N.current,S=A.current;if(!F||!S)return;let M=(H)=>k(H.target.value.toLowerCase()),I=(H)=>T.current.commit(H.target.value),O=()=>{let H=S.value.trim();if(H==="")T.current.clear();else T.current.commit(H)},j=(H)=>{if(H.key==="Enter")H.preventDefault(),O();if(H.key==="Escape")k(y)};return F.addEventListener("input",M),F.addEventListener("change",I),S.addEventListener("blur",O),S.addEventListener("keydown",j),()=>{F.removeEventListener("input",M),F.removeEventListener("change",I),S.removeEventListener("blur",O),S.removeEventListener("keydown",j)}},[y]),e("div",{className:"space-y-2.5",children:[e("h4",{className:"text-xs font-semibold text-ink",children:"Accent colour"}),e("div",{className:"flex flex-wrap items-center gap-2.5",children:p.map((F)=>{let S=g===F.value.toLowerCase();if(F.value==="")return e("button",{type:"button",onClick:()=>r(""),disabled:c,"aria-label":"No accent colour","aria-pressed":S,title:"No accent colour",className:`w-7 h-7 rounded-full border flex items-center justify-center transition-all cursor-pointer disabled:opacity-50 ${S?"border-ink bg-ink/10 ring-2 ring-ink/30 ring-offset-2 ring-offset-paper":"border-ink/25 bg-paper hover:border-ink/50 text-ink/60"}`,children:e(b,{size:12,strokeWidth:2.2})},"none");return e("button",{type:"button",onClick:()=>r(F.value),disabled:c,"aria-label":F.label,"aria-pressed":S,title:F.label,style:{backgroundColor:F.bgHex},className:`w-7 h-7 rounded-full transition-all cursor-pointer shadow-2xs disabled:opacity-50 ${S?"ring-2 ring-ink ring-offset-2 ring-offset-paper scale-105":"hover:scale-105 opacity-90 hover:opacity-100"}`},F.value)})}),e("div",{className:"flex items-center gap-2 pt-0.5",children:[e("label",{title:"Pick a custom accent colour",className:`relative w-7 h-7 shrink-0 rounded-full border overflow-hidden cursor-pointer transition-all ${v?"ring-2 ring-ink ring-offset-2 ring-offset-paper":"border-ink/25 hover:border-ink/50"} ${c?"opacity-50 pointer-events-none":""}`,children:[e("span",{"aria-hidden":"true",className:"absolute inset-0",style:{backgroundColor:w}}),e(Pr,{size:12,strokeWidth:2.2,"aria-hidden":"true",className:"absolute inset-0 m-auto text-white/90 mix-blend-difference pointer-events-none"}),e("input",{ref:N,type:"color",value:_m(w)??Im,disabled:c,"aria-label":"Custom accent colour",className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer"})]}),e("input",{ref:A,type:"text",value:w,disabled:c,spellcheck:!1,"aria-label":"Custom accent colour hex",placeholder:Im,onInput:(F)=>k(F.currentTarget.value),className:"w-[86px] bg-paper border border-ink/20 rounded-md px-2 py-1 text-[11px] font-mono text-ink outline-none focus:border-ink/60 transition-colors disabled:opacity-50"}),e("span",{className:"text-[11px] text-ink/45",children:v?"Custom accent":"Pick any colour"})]})]})}var eo=128,Iu=700000;async function Au(t){let r=Promise.withResolvers(),l=new FileReader;l.onload=(A)=>{let T=A.target?.result;if(typeof T==="string"&&T)r.resolve(T);else r.reject(Error("That file could not be read as an image."))},l.onerror=()=>r.reject(Error("That file could not be read as an image.")),l.readAsDataURL(t);let c=await r.promise;if(t.type==="image/svg+xml")return c;let p=Promise.withResolvers(),g=new Image;g.onload=()=>p.resolve(g),g.onerror=()=>p.reject(Error("That file is not an image Kabmo can read.")),g.src=c;let h=await p.promise,v=Math.min(1,eo/Math.max(h.naturalWidth,h.naturalHeight)),y=Math.max(1,Math.round(h.naturalWidth*v)),w=Math.max(1,Math.round(h.naturalHeight*v)),k=document.createElement("canvas");k.width=y,k.height=w;let C=k.getContext("2d");if(!C)return c;C.drawImage(h,0,0,y,w);let N=k.toDataURL("image/png");return N.length>0&&N.length<c.length?N:c}function Zi({currentIcon:t,customIconUrl:r,projectName:l,onSelectIcon:c,onSetCustomIcon:p,disabled:g=!1}){let h=i(null),[v,y]=n(!1),[w,k]=n(!1),[C,N]=n(null),A=async(S)=>{let M=S.currentTarget.files?.[0];if(S.currentTarget.value="",!M)return;N(null),k(!0);try{let I=await Au(M);if(I.length>Iu){N("That image is too detailed to store as a mark — try a PNG or SVG.");return}p(I)}catch(I){N(I instanceof Error?I.message:String(I))}finally{k(!1)}},T=()=>{let M=`https://api.dicebear.com/7.x/identicon/svg?seed=${l.toLowerCase().replace(/[^a-z0-9]/g,"")||"project"}&radius=50&size=${eo}`;N(null),y(!0);let I=new Image;I.onload=()=>{y(!1),p(M)},I.onerror=()=>{y(!1),N("The generated icon could not be loaded — check your connection.")},I.src=M},F=g||w||v;return e("div",{className:"space-y-3",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("h4",{className:"text-xs font-semibold text-ink",children:"Project icon"}),r&&e("button",{type:"button",onClick:()=>p(void 0),disabled:F,className:"text-[11px] text-ink/50 hover:text-error transition-colors cursor-pointer disabled:opacity-50",children:"Use a standard icon"})]}),e("div",{className:"flex flex-wrap gap-1.5",children:Bh.map((S)=>{let M=!r&&t===S.id,I=S.icon;return e("button",{type:"button",onClick:()=>c(S.id),disabled:F,"aria-label":S.label,"aria-pressed":M,title:S.label,className:`w-7 h-7 rounded-md flex items-center justify-center transition-all cursor-pointer disabled:opacity-50 ${M?"border border-ink/40 bg-ink/5 text-ink shadow-2xs":"border border-transparent text-ink/60 hover:text-ink hover:bg-ink/5"}`,children:e(I,{size:14,strokeWidth:1.8})},S.id)})}),e("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[e("input",{type:"file",ref:h,onChange:(S)=>void A(S),accept:"image/png,image/jpeg,image/svg+xml,image/webp,image/gif",className:"hidden"}),e("button",{type:"button",onClick:()=>h.current?.click(),disabled:F,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-ink/20 hover:border-ink/40 bg-paper text-ink text-xs font-medium transition-colors cursor-pointer shadow-2xs disabled:opacity-50",children:[w?e(m,{size:13,className:"animate-spin text-ink/60"}):e(Ji,{size:13,className:"text-ink/60"}),e("span",{children:w?"Reading…":"Upload image"})]}),e("button",{type:"button",onClick:T,disabled:F,title:"Generate a stable identicon from the project name",className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-ink/20 hover:border-ink/40 bg-paper text-ink text-xs font-medium transition-colors cursor-pointer shadow-2xs disabled:opacity-50",children:[v?e(m,{size:13,className:"animate-spin text-ink/60"}):e(gr,{size:13,className:"text-ink/60"}),e("span",{children:v?"Generating…":"Generate mark"})]}),r&&e("div",{className:"flex items-center gap-2 ml-1 pl-2 border-l border-ink/10",children:[e("img",{src:r,alt:"Current custom icon",className:"w-5 h-5 rounded-xs object-contain border border-ink/15",referrerPolicy:"no-referrer"}),e("span",{className:"text-[11px] text-ink/60",children:"Custom icon in use"}),e("button",{type:"button",onClick:()=>p(void 0),disabled:F,"aria-label":"Remove the custom icon",className:"p-0.5 rounded text-ink/40 hover:text-error transition-colors cursor-pointer disabled:opacity-50",children:e(b,{size:12})})]})]}),e("p",{className:"text-[11px] text-ink/50",children:["Any image works — it is scaled down to a ",eo,"px mark. PNG, JPEG, WebP, GIF or SVG."]}),C&&e("p",{className:"text-[11px] text-error",children:C})]})}function ta({project:t,canDelete:r,isDeleting:l=!1,isRevealing:c=!1,models:p,accentColorOptions:g,onUpdateField:h,onUpdateFields:v,onReveal:y,onDeleteProject:w}){return e("div",{className:"p-6 md:p-8 space-y-7",children:[e(zi,{project:t,canDelete:r,isDeleting:l,onDelete:w}),e(qi,{name:t.name,onCommit:(k)=>h("name",k)}),e(Vi,{path:t.path,onCommit:(k)=>h("path",k),onReveal:y,isRevealing:c}),e(Yi,{model:t.model,models:p,onSelectModel:(k)=>h("model",k)}),e(Qi,{accentColor:t.accentColor,onSelectColor:(k)=>h("accentColor",k),...g&&g.length>0?{options:g}:{}}),e(Zi,{currentIcon:t.icon,customIconUrl:t.customIconUrl,projectName:t.name,onSelectIcon:(k)=>v({icon:k,customIconUrl:void 0}),onSetCustomIcon:(k)=>v({customIconUrl:k,icon:k===void 0?"default":"custom"})})]})}function Ru(t){return(t.replace(/[\\/]+$/,"").split(/[\\/]/).pop()??"").toLowerCase()}function Eu({isSaving:t,onClose:r,onSubmit:l}){let[c,p]=n(""),[g,h]=n(""),[v,y]=n(!1),[w,k]=n(!0),[C,N]=n(null),A=(F)=>{if(h(F),w||!c.trim())p(Ru(F)),k(!0)},T=async()=>{let F=c.trim();if(!F){N("Enter a project name.");return}N(null);try{await l({name:F,path:g.trim()}),r()}catch(S){N(S instanceof Error?S.message:String(S))}};return e(d,{children:e(Z,{onClose:t?()=>{}:r,ariaLabel:"Add project",maxWidthClass:"max-w-[480px]",header:e("div",{className:"min-w-0",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Add project"}),e("p",{className:"text-[11px] text-ink/50",children:"A name, and the directory its chats run in."})]}),footer:e("div",{className:"flex items-center justify-end gap-2 px-5 py-3.5 border-t border-ink/10",children:[e("button",{type:"button",onClick:r,disabled:t,className:"px-3.5 py-1.5 rounded-md border border-ink/20 text-xs font-medium text-ink hover:bg-ink/5 transition-colors cursor-pointer disabled:opacity-50",children:"Cancel"}),e("button",{type:"button",onClick:()=>void T(),disabled:t,className:"px-3.5 py-1.5 rounded-md bg-ink text-canvas text-xs font-medium hover:opacity-90 transition-opacity cursor-pointer disabled:opacity-50 inline-flex items-center gap-1.5",children:[t&&e(m,{size:13,className:"animate-spin"}),e("span",{children:t?"Adding…":"Add project"})]})]}),children:[e("div",{className:"px-5 py-4 space-y-4",children:[e("div",{className:"space-y-1.5",children:[e("label",{htmlFor:"add-project-name",className:"block text-xs font-semibold text-ink",children:"Name"}),e("input",{id:"add-project-name",type:"text",value:c,onInput:(F)=>{p(F.currentTarget.value),k(!1)},placeholder:"e.g. kabmo",className:"w-full bg-paper border border-ink/20 rounded-md px-3 py-2 text-xs text-ink outline-none focus:border-ink/60 transition-colors"}),e("p",{className:"text-[11px] text-ink/50",children:"Unique: the sidebar identifies a workspace by it."})]}),e("div",{className:"space-y-1.5",children:[e("label",{htmlFor:"add-project-path",className:"block text-xs font-semibold text-ink",children:["Directory ",e("span",{className:"text-ink/40 font-normal",children:"(optional)"})]}),e("div",{className:"flex items-center gap-2",children:[e("input",{id:"add-project-path",type:"text",value:g,onInput:(F)=>h(F.currentTarget.value),placeholder:"~ or /absolute/path",spellcheck:!1,className:"flex-1 min-w-0 bg-paper border border-ink/20 rounded-md px-3 py-2 text-[11.5px] font-mono text-ink outline-none focus:border-ink/60 transition-colors"}),e("button",{type:"button",onClick:()=>y(!0),className:"shrink-0 inline-flex items-center gap-1 px-2.5 py-2 rounded-md border border-ink/20 hover:border-ink/40 text-[11px] font-medium text-ink transition-colors cursor-pointer",children:[e(Vt,{size:12}),e("span",{children:"Browse…"})]})]}),e("p",{className:"text-[11px] text-ink/50",children:"Sessions under this directory are listed in the project. Leave it empty for a grouping with no directory behind it."})]}),C&&e("p",{className:"text-[11px] text-error",children:C})]}),v&&e(Ec,{initialPath:g||void 0,onSelect:(F)=>{A(F),y(!1)},onClose:()=>y(!1)})]})})}function oa({isOpen:t,isSaving:r,onClose:l,onSubmit:c}){if(!t)return null;return e(Eu,{isSaving:r,onClose:l,onSubmit:c})}function aa({project:t,isDeleting:r,error:l,onClose:c,onConfirm:p}){if(o(()=>{let g=(h)=>{if(h.key!=="Escape"||r)return;h.preventDefault(),c()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[c,r]),!t)return null;return e(Z,{onClose:r?()=>{}:c,zClass:"z-[70]",maxWidthClass:"max-w-[440px]",ariaLabel:"Delete project",header:e("div",{className:"flex items-center gap-3 min-w-0",children:[e(L,{size:16,className:"text-error shrink-0"}),e("div",{className:"min-w-0",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Delete project?"}),e("p",{className:"text-[11px] text-ink/50 truncate",children:t.name})]})]}),footer:e("div",{className:"flex items-center justify-end gap-2 px-5 py-3.5 border-t border-ink/10",children:[e("button",{type:"button",onClick:c,disabled:r,className:"px-3.5 py-1.5 rounded-md border border-ink/20 text-xs font-medium text-ink hover:bg-ink/5 transition-colors cursor-pointer disabled:opacity-50",children:"Cancel"}),e("button",{type:"button",onClick:p,disabled:r,className:"px-3.5 py-1.5 rounded-md bg-error text-canvas text-xs font-medium hover:opacity-90 transition-opacity cursor-pointer disabled:opacity-50 flex items-center gap-1.5",children:[r?e(m,{size:13,className:"animate-spin"}):e(L,{size:13}),e("span",{children:r?"Deleting…":"Delete project"})]})]}),children:e("div",{className:"px-5 py-4 space-y-3",children:[e("ul",{className:"text-[11.5px] leading-relaxed text-ink/70 space-y-1.5",children:[e("li",{children:"The workspace is unregistered from Kabmo — its place in the sidebar, its chats' grouping and its settings go."}),e("li",{children:t.path?"The directory itself is NOT deleted; a tombstone keeps omp discovery from re-adding it on the next boot.":"It has no directory, so nothing on disk is touched."}),e("li",{children:"Chat transcripts stay on disk under ~/.omp/agent/sessions."})]}),l&&e("div",{className:"flex items-start gap-2 px-3 py-2 rounded-md border border-error/30 bg-error/5 text-[11px] text-ink/75",children:[e(_,{size:13,className:"mt-0.5 shrink-0 text-error"}),e("span",{children:l})]})]})})}var to="worktreeDirectory",no="worktreeCarryIgnored";function sa(t){if(t.missing)return"folder is missing — its chats still open";let r=t.detached?`detached @ ${t.head.slice(0,7)||"unknown"}`:`${t.branch} checked out here`,l=t.sessions===1?"1 chat":`${t.sessions} chats`,c=t.dirty===0?"clean":`${t.dirty} changed`;return`${r} · ${l} · ${c}`}function la(t){return!t.detached&&Boolean(t.branch)&&t.aheadOfStart===0}function oo(t){if(t.isPrimary)return"The main checkout cannot be removed.";if(t.dirty>0)return`${t.dirty} uncommitted file${t.dirty===1?"":"s"} here would be lost.`;return null}function da({root:t,folderId:r,onReport:l}){let{worktrees:c,base:p,loading:g,error:h,isRepo:v,refresh:y}=Sm({root:t,folderId:r},Boolean(t)),[w,k]=n(()=>{let S=R(to);return typeof S==="string"?S:""}),[C,N]=n(()=>R(no)!==!1),[A,T]=n(null);if(!t)return e("p",{className:"text-xs text-ink/50",children:"Bind this workspace to a repository to manage its worktrees."});let F=c.filter((S)=>!S.isPrimary);return e("div",{className:"flex flex-col gap-4",children:[e("section",{className:"flex flex-col gap-1",children:[e("h3",{className:"text-xs font-semibold text-ink",children:"Worktrees"}),g&&e("p",{className:"text-[11px] text-ink/50",children:"Reading worktrees…"}),h&&e("p",{className:"text-[11px] text-error",title:h,children:["Worktrees could not be read: ",h]}),!g&&!h&&v===!1&&e("p",{className:"text-[11px] text-ink/50",children:"Worktrees need a Git repository."}),!g&&!h&&v!==!1&&F.length===0&&e("p",{className:"text-[11px] text-ink/50",children:"No worktrees yet."}),F.map((S)=>e("div",{className:"group flex items-center gap-2 rounded-md px-1 py-1.5 hover:bg-ink/5",children:[e("div",{className:"min-w-0 flex-1",children:[e("p",{className:"truncate text-xs text-ink",children:S.branch||"detached"}),e("p",{className:"truncate text-[10.5px] text-ink/50",title:S.path,children:sa(S)})]}),e("button",{type:"button",disabled:A===S.path||oo(S)!==null,"aria-label":`Remove worktree ${S.branch||S.path}`,title:oo(S)??"Remove worktree",onClick:()=>{T(S.path),Sh({root:t,folderId:r},S.path,{deleteBranch:la(S)}).then((M)=>(l(M.branchDeleted?`Removed ${S.branch} and its branch`:`Removed ${S.branch}${M.branchKept?" (branch kept)":""}`,"success"),y())).catch((M)=>l(M instanceof Error?M.message:String(M),"error")).finally(()=>T(null))},className:"shrink-0 rounded px-2 py-1 text-[11px] text-ink/60 hover:bg-error/10 hover:text-error disabled:opacity-40",children:"Remove"})]},S.path))]}),e("label",{className:"flex flex-col gap-1",children:[e("span",{className:"text-xs font-semibold text-ink",children:"Worktree location"}),e("input",{value:w,onChange:(S)=>k(S.currentTarget.value),onBlur:()=>it(to,w.trim()),placeholder:p,className:"h-8 rounded-md border border-ink/15 bg-paper px-2 text-xs text-ink outline-none focus:border-ink/40"}),e("span",{className:"text-[10.5px] text-ink/50",children:["Where new worktrees are created. Relative paths are resolved against the project; ~ is your home directory. Empty uses ",p,"."]})]}),e("label",{className:"flex items-start gap-2",children:[e("input",{type:"checkbox",checked:C,onChange:(S)=>{let M=S.currentTarget.checked;N(M),it(no,M)},className:`${be} mt-0.5`}),e("span",{className:"flex flex-col gap-0.5",children:[e("span",{className:"text-xs font-semibold text-ink",children:"Copy ignored files into new worktrees"}),e("span",{className:"text-[10.5px] text-ink/50",children:"A new worktree gets the project's ignored build folders (node_modules, .venv, target) copied in, so it works without reinstalling."})]})]})]})}var Mu={full:"flex h-full w-full items-center justify-center text-xs text-ink/40",fill:"flex-1 flex items-center justify-center text-xs text-ink/40"},Le=({variant:t="full",children:r})=>e("div",{className:Mu[t],children:r});var dn="";function ca(t){if(!x(t))return!1;return typeof t.id==="string"&&typeof t.name==="string"&&typeof t.path==="string"}function Lu(t){if(!x(t))return!1;return typeof t.label==="string"&&typeof t.value==="string"&&typeof t.bgHex==="string"}function Ou(t,r){return t.some((c)=>c.id===r.id)?t.map((c)=>c.id===r.id?r:c):[...t,r]}function pa(t){let[r,l]=n([]),[c,p]=n([]),[g,h]=n(dn),[v,y]=n(!0),[w,k]=n(null),[C,N]=n(!1),[A,T]=n(!1),F=i(t);F.current=t;let S=a((z)=>{if(!x(z))return;let V=Array.isArray(z.projects)?z.projects.filter(ca):null;if(V)l(V),h((X)=>V.some((ee)=>ee.id===X)?X:V[0]?.id??dn);if(Array.isArray(z.accentColorOptions))p(z.accentColorOptions.filter(Lu))},[]),M=a(async()=>{try{let z=await fetch("/api/settings/projects"),V=await z.json();if(!z.ok){let X=x(V)&&typeof V.error==="string"?V.error:`HTTP ${z.status}`;k(X);return}k(null),S(V)}catch(z){k(z instanceof Error?z.message:String(z))}},[S]);o(()=>{let z=!0;return(async()=>{if(await M(),z)y(!1)})(),()=>{z=!1}},[M]);let I=Ve().folders,O=u(()=>I.map((z)=>`${z.id}:${z.name}:${z.model??""}:${z.icon??""}:${z.accentColor??""}:${z.project_path??""}:${z.isPinned?1:0}`).join("|"),[I]);o(()=>{if(!O)return;M()},[O,M]);let j=a(async(z,V)=>{if(z.folderId===void 0)return F.current("This project has no workspace row to save to."),!1;let X=r;l((ie)=>ie.map((te)=>te.id===z.id?{...te,...V}:te));let ee={folderId:z.folderId};for(let[ie,te]of Object.entries(V))ee[ie]=te===void 0?null:te;try{let ie=await fetch("/api/settings/projects",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:ee})}),te=await ie.json().catch(()=>null);if(!ie.ok){let Q=x(te)&&typeof te.error==="string"?te.error:`HTTP ${ie.status}`;throw Error(Q)}let ae=x(te)&&ca(te.project)?te.project:null;if(ae)l((Q)=>Ou(Q,ae));return!0}catch(ie){return l(X),F.current(ie instanceof Error?ie.message:String(ie)),!1}},[r]),H=a((z,V,X)=>j(z,{[V]:X}),[j]),K=a((z,V)=>j(z,V),[j]),Y=a(async(z)=>{N(!0);try{let V=await fetch("/api/folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:z.name,path:z.path})}),X=await V.json().catch(()=>null),ee=x(X)?X.folder:null,ie=x(ee)&&typeof ee.id==="number"?ee.id:null;if(!V.ok||!x(X)||X.success!==!0||ie===null){let te=x(X)&&typeof X.error==="string"?X.error:`HTTP ${V.status}`;throw Error(te)}await M(),h(`folder-${ie}`)}catch(V){throw F.current(V instanceof Error?V.message:String(V)),V}finally{N(!1)}},[M]),G=a(async(z)=>{T(!0);try{let V=await fetch(`/api/settings/projects?id=${encodeURIComponent(z.id)}`,{method:"DELETE"}),X=await V.json().catch(()=>null);if(!V.ok||!x(X)||X.success!==!0){let ee=x(X)&&typeof X.error==="string"?X.error:`HTTP ${V.status}`;throw Error(ee)}l((ee)=>{let ie=ee.filter((te)=>te.id!==z.id);return h((te)=>te===z.id?ie[0]?.id??dn:te),ie})}catch(V){throw F.current(V instanceof Error?V.message:String(V)),V}finally{T(!1)}},[]),W=Ya((z)=>Array.isArray(z.modelList)&&z.modelList.length>0?z.modelList.map((V)=>({provider:V.provider,id:V.id,name:V.name||V.id})):void 0)??[],q=r.find((z)=>z.id===g)??r[0]??null;return{projects:r,selected:q,selectedId:q?.id??dn,select:h,accentColorOptions:c,models:W,isLoading:v,loadError:w,refresh:M,updateField:H,updateFields:K,isAdding:C,addProject:Y,isDeleting:A,deleteProject:G,onError:t}}function ua(){let t=Pe(),{pushToast:r}=He(),[l,c]=n(!1),[p,g]=n(null),[h,v]=n(null),[y,w]=n(null),k=pa((F)=>r(F,"error",{duration:7000})),{folders:C}=Ve(),N=async(F)=>{if(!F.path||F.folderId===void 0){r("This project is not bound to a directory.","error");return}w(F.id);try{let S=await fetch(`/api/folders/${F.folderId}/open`,{method:"POST"}),M=await S.json().catch(()=>null);if(!S.ok){let I=M&&typeof M==="object"&&"error"in M&&typeof M.error==="string"?M.error:`HTTP ${S.status}`;throw Error(I)}}catch(S){r(S instanceof Error?S.message:String(S),"error")}finally{w(null)}},A=async()=>{if(!p)return;v(null);try{await k.deleteProject(p),g(null),t.back()}catch(F){v(F instanceof Error?F.message:String(F))}};if(k.isLoading)return e(Le,{children:"Loading projects…"});let T=k.selected;return e("div",{className:"w-full h-full flex flex-col overflow-hidden bg-paper text-ink",children:[e(Ce,{pane:t.pane,onBack:t.back,listLabel:"Projects",list:e(Ki,{projects:k.projects,selectedProjectId:T?.id??"",onSelectProject:(F)=>{k.select(F),t.openDetail()},onAddProject:()=>c(!0),onTogglePin:(F)=>{k.updateField(F,"isPinned",!F.isPinned)},isAdding:k.isAdding,folderFacts:C,loadError:k.loadError}),detail:T?e("div",{className:"flex-1 min-h-0 scrollbar-overlay-container flex flex-col",children:[e(ta,{project:T,canDelete:k.projects.length>1,isDeleting:k.isDeleting&&p?.id===T.id,isRevealing:y===T.id,models:k.models,accentColorOptions:k.accentColorOptions,onUpdateField:(F,S)=>{k.updateField(T,F,S)},onUpdateFields:(F)=>{k.updateFields(T,F)},onReveal:()=>void N(T),onDeleteProject:()=>{v(null),g(T)}}),e("div",{className:"border-t border-ink/10 px-6 md:px-8 py-4",children:e(da,{root:T.path||null,folderId:T.folderId??null,onReport:(F,S)=>r(F,S??"success",{duration:6000})})})]}):e("div",{className:"flex-1 flex items-center justify-center px-6 text-center",children:e("div",{className:"space-y-2",children:[e("p",{className:"text-xs text-ink/60",children:"No project selected."}),e("button",{type:"button",onClick:()=>c(!0),className:"text-[11px] font-medium text-ink underline underline-offset-2 hover:no-underline cursor-pointer",children:"Add a project"})]})})}),e(oa,{isOpen:l,isSaving:k.isAdding,onClose:()=>c(!1),onSubmit:async(F)=>{await k.addProject(F),t.openDetail()}}),e(aa,{project:p,isDeleting:k.isDeleting,error:h,onClose:()=>{g(null),v(null)},onConfirm:()=>void A()})]})}var Uu=/^[A-Za-z0-9_-]{1,64}$/,ma=/[<>\n\r]/;function ga(t){if(!t||typeof t!=="object"||Array.isArray(t))return!1;let r=t;return typeof r.id==="string"&&Uu.test(r.id)&&typeof r.name==="string"&&r.name.trim().length>0&&r.name.length<=128&&!ma.test(r.name)&&typeof r.email==="string"&&r.email.trim().length>0&&r.email.length<=254&&r.email.includes("@")&&!ma.test(r.email)}var fa="w-full bg-paper border border-ink/20 rounded-md px-2.5 py-1.5 text-[11px] text-ink placeholder-ink/40 outline-none focus:border-ink/40 transition-colors";function ha({settings:t,onUpdate:r}){let l=t.gitIdentities??[],[c,p]=n(null),[g,h]=n(!0),[v,y]=n(null),[w,k]=n(null),[C,N]=n(""),[A,T]=n("");o(()=>{let j=!0;return h(!0),fetch("/api/settings/git-identity").then(async(H)=>{let K=await H.json().catch(()=>null);if(!H.ok||!K)throw Error(K?.error||`Request failed (HTTP ${H.status})`);if(j)p({global:K.global,appliedId:K.appliedId})}).catch((H)=>{if(j)k(H instanceof Error?H.message:String(H))}).finally(()=>{if(j)h(!1)}),()=>{j=!1}},[]);let F=async(j)=>{y(j||"global"),k(null);try{let H=await fetch("/api/settings/git-identity",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identityId:j})}),K=await H.json().catch(()=>null);if(!H.ok||!K)throw Error(K?.error||`Request failed (HTTP ${H.status})`);p({global:K.global,appliedId:K.appliedId})}catch(H){k(H instanceof Error?H.message:String(H))}finally{y(null)}},S=()=>{let j={id:typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`id-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:C.trim(),email:A.trim()};if(!ga(j)){k("Enter a name and a valid email address.");return}r({gitIdentities:[...l,j]}),N(""),T(""),k(null)},M=async(j)=>{if(c?.appliedId===j)await F("");r({gitIdentities:l.filter((H)=>H.id!==j)})},I=c?.appliedId??"",O=c?.global??null;return e("section",{className:"space-y-3",children:[e("div",{children:[e("h4",{className:"text-sm font-semibold text-ink",children:"Commit Identity"}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:"The name and email a commit carries. Applying an identity writes it to your global git config."})]}),e("div",{className:"rounded-lg border border-ink/15 bg-paper p-3.5 space-y-2",children:[e("label",{className:"block text-[10px] font-semibold uppercase tracking-wider text-ink/45",children:"Commit as"}),e(Ue,{ariaLabel:"Commit identity",value:I,onChange:(j)=>void F(j),disabled:g||v!==null,placeholder:"Global config",searchable:l.length>8,options:[{value:"",label:"Global config",hint:"git's own user.name / user.email"},...l.map((j)=>({value:j.id,label:j.name,hint:j.email}))]}),e("p",{className:"text-[10px] text-ink/50",children:[g?"Reading git config…":O?`Current: ${O.name} <${O.email}>`:"No identity configured",v?" · applying…":""]})]}),l.length>0&&e("details",{className:"rounded-lg border border-ink/15 bg-paper",children:[e("summary",{className:"px-3.5 py-2.5 text-[10px] font-semibold uppercase tracking-wider text-ink/45 cursor-pointer select-none",children:["Manage saved identities (",l.length,")"]}),e("div",{className:"divide-y divide-ink/10 border-t border-ink/10 max-h-48 overflow-y-auto",children:l.map((j)=>e("div",{className:"flex items-center gap-3 px-3.5 py-2.5",children:[e("div",{className:"min-w-0 flex-1",children:[e("div",{className:"text-xs font-semibold text-ink truncate",children:j.name}),e("div",{className:"text-[10px] text-ink/50 truncate",children:j.email})]}),e("button",{type:"button",onClick:()=>void M(j.id),"aria-label":`Remove ${j.name}`,className:"p-1.5 rounded text-ink/40 hover:text-error hover:bg-ink/5 transition-colors cursor-pointer",children:e(L,{size:12})})]},j.id))})]}),w&&e("p",{className:"text-[10px] text-error",children:w}),e("div",{className:"rounded-lg border border-ink/15 bg-paper p-3.5 space-y-3",children:[e("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[e("input",{type:"text",value:C,onChange:(j)=>{N(j.currentTarget.value),k(null)},placeholder:"User name",className:fa}),e("input",{type:"text",value:A,onChange:(j)=>{T(j.currentTarget.value),k(null)},onKeyDown:(j)=>{if(j.key==="Enter")j.preventDefault(),S()},placeholder:"Email address",className:fa})]}),e("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e("p",{className:"text-[10px] text-ink/50",children:"Saved identities are a library; pick one above to apply it globally."}),e("button",{type:"button",onClick:S,className:"flex items-center gap-1.5 px-2.5 py-1 rounded bg-ink text-canvas text-[10px] font-medium hover:bg-ink/90 transition-colors cursor-pointer",children:[e(P,{size:11})," Add identity"]})]})]}),e("p",{className:"text-[10px] text-ink/45 leading-relaxed",children:"Applying writes `user.name` and `user.email` to your global git config. Global config restores what was there before Kabmo wrote."})]})}var Sa=[{key:"scope",description:"“the staged change set”, or “the commit being amended”."},{key:"branch",description:"The current branch name."},{key:"recent_commits",description:"The last ten subjects, newest first."},{key:"files",description:"The files in this commit."},{key:"diff",description:"The staged patch. Required."},{key:"truncated",description:"A note when the diff was cut to fit the model."}],kt=`You write git commit messages. Return only the commit message, no prose, no code fences.
2
2
 
3
3
  The diff below is {{scope}} — exactly what this commit will contain. Do not describe unstaged or untracked changes; they are not part of this commit.
4
4