blade-code 0.10.206 → 0.11.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.
- package/dist/blade.js +2 -2
- package/dist/{chunk-erhaedch.js → chunk-06hkf59s.js} +1 -1
- package/dist/{chunk-dnpkf5mv.js → chunk-0b83mt1c.js} +2 -2
- package/dist/{chunk-3crwyd2r.js → chunk-0wcnkxe8.js} +2 -2
- package/dist/{chunk-gz84aewr.js → chunk-1beqtjsw.js} +1 -1
- package/dist/chunk-1kxpnt9q.js +1 -0
- package/dist/{chunk-az3rehz9.js → chunk-25s0c8km.js} +399 -392
- package/dist/{chunk-v5vx6nz9.js → chunk-27bjk35b.js} +1 -1
- package/dist/{chunk-65wc1h38.js → chunk-2ftyzk83.js} +1 -1
- package/dist/chunk-2g3v9qpz.js +1 -0
- package/dist/{chunk-q6abav45.js → chunk-2vrsfb8p.js} +59 -59
- package/dist/{chunk-h6ahwwpa.js → chunk-30p7aff1.js} +1 -1
- package/dist/{chunk-ewwrss2w.js → chunk-3kszepm6.js} +1 -1
- package/dist/{chunk-28tzj187.js → chunk-3y2x6fb6.js} +1 -1
- package/dist/chunk-43gg1wdc.js +1 -0
- package/dist/{chunk-67wy9mm7.js → chunk-447ps2te.js} +2 -2
- package/dist/{chunk-9kj19a8t.js → chunk-4cdk4mds.js} +1 -1
- package/dist/{chunk-nj6kpdte.js → chunk-5034apfz.js} +2 -2
- package/dist/{chunk-28n945me.js → chunk-5bc4hwt9.js} +2 -2
- package/dist/{chunk-t0gm0pn1.js → chunk-5yyp6njq.js} +1 -1
- package/dist/chunk-72wn385d.js +1 -0
- package/dist/{chunk-n5jzmwhy.js → chunk-7eset766.js} +2 -2
- package/dist/{chunk-793wjhvz.js → chunk-7vzz3rsx.js} +5 -5
- package/dist/{chunk-h4k69z1b.js → chunk-80946c9a.js} +1 -1
- package/dist/chunk-8emp6ysb.js +1 -0
- package/dist/chunk-8evyh5t0.js +1 -0
- package/dist/chunk-8hdtssvs.js +1 -0
- package/dist/{chunk-5k8k56f2.js → chunk-8n3jythp.js} +11 -9
- package/dist/{chunk-870szc6v.js → chunk-8sth12hd.js} +1 -1
- package/dist/{chunk-1n4v80hy.js → chunk-9qxch6sy.js} +1 -1
- package/dist/{chunk-09kqfdpa.js → chunk-9ydrwcpy.js} +2 -2
- package/dist/{chunk-p8vpvx07.js → chunk-9yn01a90.js} +1 -1
- package/dist/chunk-a1tt14a2.js +2 -0
- package/dist/{chunk-tsm8rhmd.js → chunk-a731hdwa.js} +1 -1
- package/dist/{chunk-pga8gxtf.js → chunk-a74ynw4t.js} +1 -1
- package/dist/chunk-b36egepz.js +1 -0
- package/dist/{chunk-yjjxv7fn.js → chunk-dxq7462e.js} +2 -2
- package/dist/{chunk-gmpsfkgg.js → chunk-f552hzcx.js} +1 -1
- package/dist/{chunk-ebpg1srd.js → chunk-f6hc7t65.js} +2 -2
- package/dist/{chunk-vx2g1faw.js → chunk-fqxzzsgr.js} +1 -1
- package/dist/{chunk-p2y1zqsb.js → chunk-g0hhqxpg.js} +2 -2
- package/dist/{chunk-ed2hdrwe.js → chunk-gzbb747a.js} +1 -1
- package/dist/{chunk-pdna2qvv.js → chunk-h8w3ahnk.js} +2 -2
- package/dist/{chunk-sbfe9vh3.js → chunk-hmw99nm1.js} +7 -7
- package/dist/chunk-hrtf7dba.js +2 -0
- package/dist/chunk-j7dx054r.js +1 -0
- package/dist/chunk-j9ppeg6v.js +1 -0
- package/dist/chunk-jemb0vwa.js +1 -0
- package/dist/{chunk-6xzk4hsg.js → chunk-m30qwpe9.js} +1 -1
- package/dist/{chunk-v4cxk10d.js → chunk-m70cnaeg.js} +1 -1
- package/dist/{chunk-826xegd8.js → chunk-m8te4s8f.js} +2 -2
- package/dist/chunk-ms0wve9g.js +14 -0
- package/dist/{chunk-n34qsnks.js → chunk-n8qg68y2.js} +1 -1
- package/dist/{chunk-e45r1a8r.js → chunk-pm5ssr7m.js} +2 -2
- package/dist/chunk-r9m3b170.js +1 -0
- package/dist/{chunk-1j39te3t.js → chunk-rt3f4xjz.js} +1 -1
- package/dist/{chunk-9sf1t8gw.js → chunk-s1cch8tt.js} +1 -1
- package/dist/{chunk-tzvb0nd2.js → chunk-sa9fxss4.js} +1 -1
- package/dist/{chunk-e0ft3vwg.js → chunk-ta99scbr.js} +1 -1
- package/dist/chunk-tf1qz4q6.js +1 -0
- package/dist/{chunk-0ef47wgr.js → chunk-tqt5c2f5.js} +2 -2
- package/dist/{chunk-fd0a8h55.js → chunk-ts5xzefm.js} +2 -2
- package/dist/{chunk-g7tphxme.js → chunk-v17q4bsd.js} +2 -2
- package/dist/{chunk-fnmqxhv1.js → chunk-v1k6nvth.js} +1 -1
- package/dist/{chunk-hv8nt7wj.js → chunk-vbjgcn49.js} +1 -1
- package/dist/{chunk-53vh6vpt.js → chunk-wcps5gjm.js} +1 -1
- package/dist/{chunk-av799ng5.js → chunk-xcj23spc.js} +2 -2
- package/dist/chunk-xcy45yxx.js +8 -0
- package/dist/{chunk-fc1gz532.js → chunk-xseh3f4m.js} +2 -2
- package/dist/{chunk-9tpzmy8v.js → chunk-xz7dddaj.js} +1 -1
- package/dist/{chunk-xcq0cehr.js → chunk-xzva8y4e.js} +3 -3
- package/dist/chunk-y0wc0hef.js +10 -0
- package/dist/{chunk-sqk8cnej.js → chunk-yrr9mdjn.js} +2 -2
- package/dist/{chunk-50vwafn5.js → chunk-zfxcef0z.js} +1 -1
- package/dist/{chunk-asgmmaec.js → chunk-zjezws85.js} +2 -2
- package/dist/web/assets/ChatView-BA3kB_z1.js +17 -0
- package/dist/web/assets/CodeBlockHighlighter-B5kcdVCA.js +8 -0
- package/dist/web/assets/FilePreview-BQid6G2-.js +8 -0
- package/dist/web/assets/KanbanBoard-CTR7bMLa.js +1 -0
- package/dist/web/assets/MarkdownRenderer-d7DdyYdx.js +30 -0
- package/dist/web/assets/ScrollArea-D1tPWHKZ.js +1 -0
- package/dist/web/assets/SessionHistorySurface-Cv_jRoJr.js +1 -0
- package/dist/web/assets/SettingsModal-CFa2uCzI.js +5 -0
- package/dist/web/assets/Sidebar-DrRNJOgU.js +1 -0
- package/dist/web/assets/TaskSwitcher-C9AKJrl-.js +1 -0
- package/dist/web/assets/TerminalPanel-BxBGcuB9.js +1 -0
- package/dist/web/assets/archive-DNa9b1YE.js +1 -0
- package/dist/web/assets/arrow-left-BQh8jlfT.js +1 -0
- package/dist/web/assets/calendar-clock-CC7FeYTg.js +1 -0
- package/dist/web/assets/chevron-right-6ZTOJE0p.js +1 -0
- package/dist/web/assets/clock-3-P2q6i6vm.js +1 -0
- package/dist/web/assets/copy-C-KvzjCC.js +1 -0
- package/dist/web/assets/dist-DiQNoDMg.js +11 -0
- package/dist/web/assets/download-CJHn20x1.js +1 -0
- package/dist/web/assets/folder-DmyFehXD.js +1 -0
- package/dist/web/assets/index-BVEiHNFk.css +1 -0
- package/dist/web/assets/index-D-oma3Je.js +11 -0
- package/dist/web/assets/message-square-plus-CKu9bFq3.js +1 -0
- package/dist/web/assets/pause-D2FxNG-w.js +1 -0
- package/dist/web/assets/pencil-D6HI7KC8.js +1 -0
- package/dist/web/assets/play-4jKCDYR-.js +1 -0
- package/dist/web/assets/plus-C4p8E1Nk.js +1 -0
- package/dist/web/assets/preload-helper-BC9Zf9qO.js +1 -0
- package/dist/web/assets/rolldown-runtime-hePW80VL.js +1 -0
- package/dist/web/assets/session-events-CvFfHkFA.js +23 -0
- package/dist/web/assets/settings-fWlqCZ-U.js +1 -0
- package/dist/web/assets/team-qGS2kixH.js +1 -0
- package/dist/web/assets/teamService-DfIvlI2_.js +1 -0
- package/dist/web/assets/terminal-DZkEoiSb.js +1 -0
- package/dist/web/assets/triangle-alert-Detl9fRQ.js +1 -0
- package/dist/web/assets/vendor-radix-CHeA_3Pt.js +41 -0
- package/dist/web/assets/vendor-react-hNfZDUf2.js +9 -0
- package/dist/web/assets/vendor-xterm-CANZO_wP.js +16 -0
- package/dist/web/assets/vendor-xterm-CHOd7Rch.css +1 -0
- package/dist/web/index.html +6 -4
- package/package.json +11 -10
- package/dist/chunk-514va7ce.js +0 -2
- package/dist/chunk-6p0hkf4f.js +0 -1
- package/dist/chunk-867bpjzg.js +0 -1
- package/dist/chunk-983hqzat.js +0 -1
- package/dist/chunk-af0m5227.js +0 -1
- package/dist/chunk-dpg006xj.js +0 -1
- package/dist/chunk-gpnkxh4c.js +0 -1
- package/dist/chunk-hpge30p8.js +0 -8
- package/dist/chunk-mtvbm7xe.js +0 -1
- package/dist/chunk-mys9mmcp.js +0 -1
- package/dist/chunk-new78c3h.js +0 -1
- package/dist/chunk-nng1xbsm.js +0 -10
- package/dist/chunk-pt0y4zrg.js +0 -14
- package/dist/chunk-r4em0ha7.js +0 -1
- package/dist/chunk-rdzbd5vk.js +0 -1
- package/dist/chunk-w6zat4v4.js +0 -1
- package/dist/chunk-wsd3rn0q.js +0 -1
- package/dist/chunk-yzf2jpam.js +0 -2
- package/dist/web/assets/ChatView-lUD-61n0.js +0 -70
- package/dist/web/assets/CodeBlockHighlighter--TbfcBxW.js +0 -8
- package/dist/web/assets/FilePreview-R6OKQPf2.js +0 -55
- package/dist/web/assets/KanbanBoard-BHOKtiv5.js +0 -16
- package/dist/web/assets/MarkdownRenderer-DqxNq8pa.js +0 -30
- package/dist/web/assets/ScrollArea-Dhu0B-zB.js +0 -1
- package/dist/web/assets/SessionHistorySurface-aZvoj3ma.js +0 -6
- package/dist/web/assets/SettingsModal-C7QBnIqa.js +0 -20
- package/dist/web/assets/Sidebar-Bznnq91x.js +0 -31
- package/dist/web/assets/TaskSwitcher-DJczhDRp.js +0 -26
- package/dist/web/assets/TerminalPanel-Vk4p0V3p.js +0 -6
- package/dist/web/assets/archive-0hLYBKQf.js +0 -6
- package/dist/web/assets/arrow-left-CXb6Gqf3.js +0 -6
- package/dist/web/assets/calendar-clock-DiaFI9Jk.js +0 -6
- package/dist/web/assets/chevron-right-CcPXH37D.js +0 -6
- package/dist/web/assets/clock-3-D6VR6gJc.js +0 -6
- package/dist/web/assets/copy-C3eUAQgp.js +0 -6
- package/dist/web/assets/download-DHvS9tI3.js +0 -6
- package/dist/web/assets/external-link-BDVaEuqY.js +0 -11
- package/dist/web/assets/folder-B80Ac6rr.js +0 -11
- package/dist/web/assets/index-B5mUEr6D.js +0 -11
- package/dist/web/assets/index-VwIiNjc8.css +0 -1
- package/dist/web/assets/index-YqughEZk.js +0 -211
- package/dist/web/assets/message-square-plus-D15quyPH.js +0 -21
- package/dist/web/assets/pause-BjMlj6Bx.js +0 -6
- package/dist/web/assets/pencil-BMoJvcB7.js +0 -6
- package/dist/web/assets/play-BHh4py3p.js +0 -6
- package/dist/web/assets/plus-DeFz_gQq.js +0 -6
- package/dist/web/assets/session-events-DCHBz9We.js +0 -25
- package/dist/web/assets/settings-CI8xbId2.js +0 -6
- package/dist/web/assets/team-zZ803hH9.js +0 -6
- package/dist/web/assets/teamService-CgLBXgmv.js +0 -1
- package/dist/web/assets/terminal-1WxSJ47E.js +0 -6
- package/dist/web/assets/vendor-radix-D6QrtXqd.js +0 -45
- package/dist/web/assets/vendor-react-DofNRwfy.js +0 -49
- package/dist/web/assets/vendor-xterm-9CEnUXvW.css +0 -32
- package/dist/web/assets/vendor-xterm-DuYZoU4T.js +0 -49
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/teamService-DfIvlI2_.js","assets/rolldown-runtime-hePW80VL.js","assets/session-events-CvFfHkFA.js","assets/SettingsModal-CFa2uCzI.js","assets/vendor-radix-CHeA_3Pt.js","assets/preload-helper-BC9Zf9qO.js","assets/team-qGS2kixH.js","assets/arrow-left-BQh8jlfT.js","assets/calendar-clock-CC7FeYTg.js","assets/download-CJHn20x1.js","assets/triangle-alert-Detl9fRQ.js","assets/pencil-D6HI7KC8.js","assets/play-4jKCDYR-.js","assets/plus-C4p8E1Nk.js","assets/ScrollArea-D1tPWHKZ.js","assets/TaskSwitcher-C9AKJrl-.js","assets/folder-DmyFehXD.js","assets/clock-3-P2q6i6vm.js","assets/settings-fWlqCZ-U.js","assets/terminal-DZkEoiSb.js","assets/FilePreview-BQid6G2-.js","assets/message-square-plus-CKu9bFq3.js","assets/chevron-right-6ZTOJE0p.js","assets/TerminalPanel-BxBGcuB9.js","assets/vendor-xterm-CANZO_wP.js","assets/vendor-xterm-CHOd7Rch.css","assets/Sidebar-DrRNJOgU.js","assets/archive-DNa9b1YE.js","assets/ChatView-BA3kB_z1.js","assets/copy-C-KvzjCC.js","assets/pause-D2FxNG-w.js","assets/KanbanBoard-CTR7bMLa.js","assets/SessionHistorySurface-Cv_jRoJr.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,A as n,B as r,C as i,D as a,E as o,F as s,G as c,H as l,I as u,J as d,K as f,L as p,M as m,N as h,P as g,Q as _,R as v,S as y,T as b,U as x,V as S,W as C,X as w,Y as T,Z as ee,_ as E,a as D,at as te,b as O,c as ne,d as re,dt as ie,et as ae,f as k,h as oe,i as A,it as j,j as se,k as M,l as N,lt as P,m as ce,n as le,nt as ue,o as de,ot as fe,p as pe,rt as F,s as me,t as he,tt as ge,u as I,ut as L,w as _e,x as ve,z as R}from"./session-events-CvFfHkFA.js";import{t as ye}from"./vendor-react-hNfZDUf2.js";import{C as be,_ as xe,b as Se,d as Ce,f as we,g as Te,h as Ee,m as De,p as Oe,u as z,v as ke,w as Ae,y as je}from"./vendor-radix-CHeA_3Pt.js";import{c as Me,l as B,o as V,r as Ne,t as Pe}from"./preload-helper-BC9Zf9qO.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Fe={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};Fe.node;var Ie=B(Fe),Le={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};Le.node;var Re=B(Le),ze={name:`braces`,size:24,node:[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]],aliases:[`curly-braces`]};ze.node;var Be=B(ze),Ve={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};Ve.node;var He=B(Ve),Ue={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};Ue.node;var We=B(Ue),Ge={name:`circle-alert`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`]};Ge.node;var Ke=B(Ge),qe={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};qe.node;var Je=B(qe),Ye={name:`clipboard-list`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]};Ye.node;var Xe=B(Ye),Ze={name:`command`,size:24,node:[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]};Ze.node;var Qe=B(Ze),$e={name:`file-code-corner`,size:24,node:[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]],aliases:[`file-code-2`]};$e.node;var et=B($e),tt={name:`file-text`,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:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};tt.node;var nt=B(tt),rt={name:`folder-git-2`,size:24,node:[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 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 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]};rt.node;var it=B(rt),at={name:`folder-open`,size:24,node:[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]};at.node;var ot=B(at),st={name:`folder-plus`,size:24,node:[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`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`}]]};st.node;var ct=B(st),lt={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};lt.node;var ut=B(lt),dt={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`}]]};dt.node;var ft=B(dt),pt={name:`hand`,size:24,node:[[`path`,{d:`M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1fvzgz`}],[`path`,{d:`M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2`,key:`1kc0my`}],[`path`,{d:`M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8`,key:`10h0bg`}],[`path`,{d:`M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`1s1gnw`}]]};pt.node;var mt=B(pt),ht={name:`hard-drive`,size:24,node:[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]};ht.node;var gt=B(ht),_t={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};_t.node;var vt=B(_t),yt={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};yt.node;var bt=B(yt),xt={name:`locate-fixed`,size:24,node:[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};xt.node;var St=B(xt),Ct={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};Ct.node;var wt=B(Ct),Tt={name:`message-square-quote`,size:24,node:[[`path`,{d:`M14 14a2 2 0 0 0 2-2V8h-2`,key:`1r06pg`}],[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M8 14a2 2 0 0 0 2-2V8H8`,key:`1jzu5j`}]]};Tt.node;var Et=B(Tt),Dt={name:`package`,size:24,node:[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]};Dt.node;var Ot=B(Dt),kt={name:`paperclip`,size:24,node:[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]};kt.node;var At=B(kt),jt={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};jt.node;var Mt=B(jt),Nt={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};Nt.node;var Pt=B(Nt),Ft={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};Ft.node;var It=B(Ft),Lt={name:`scan-search`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m16 16-1.9-1.9`,key:`1dq9hf`}]]};Lt.node;var Rt=B(Lt),zt={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};zt.node;var Bt=B(zt),Vt={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};Vt.node;var Ht=B(Vt),Ut={name:`shield-alert`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]};Ut.node;var Wt=B(Ut),Gt={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};Gt.node;var Kt=B(Gt),qt={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};qt.node;var Jt=B(qt),Yt={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};Yt.node;var Xt=B(Yt),Zt={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};Zt.node;var Qt=B(Zt),$t={name:`wifi-off`,size:24,node:[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};$t.node;var en=B($t),tn={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};tn.node;var nn=B(tn),rn={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};rn.node;var an=B(rn),H=e(ie(),1),on=e(ye(),1);function sn(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=sn(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function cn(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=sn(e))&&(r&&(r+=` `),r+=t);return r}var ln=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,un=cn,dn=(e,t)=>n=>{if(t?.variants==null)return un(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=ln(t)||ln(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return un(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},fn=`-`,pn=e=>{let t=_n(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{let n=e.split(fn);return n[0]===``&&n.length!==1&&n.shift(),mn(n,t)||gn(e)},getConflictingClassGroupIds:(e,t)=>{let i=n[e]||[];return t&&r[e]?[...i,...r[e]]:i}}},mn=(e,t)=>{if(e.length===0)return t.classGroupId;let n=e[0],r=t.nextPart.get(n),i=r?mn(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;let a=e.join(fn);return t.validators.find(({validator:e})=>e(a))?.classGroupId},hn=/^\[(.+)\]$/,gn=e=>{if(hn.test(e)){let t=hn.exec(e)[1],n=t?.substring(0,t.indexOf(`:`));if(n)return`arbitrary..`+n}},_n=e=>{let{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return xn(Object.entries(e.classGroups),n).forEach(([e,n])=>{vn(n,r,e,t)}),r},vn=(e,t,n,r)=>{e.forEach(e=>{if(typeof e==`string`){let r=e===``?t:yn(t,e);r.classGroupId=n;return}if(typeof e==`function`){if(bn(e)){vn(e(r),t,n,r);return}t.validators.push({validator:e,classGroupId:n});return}Object.entries(e).forEach(([e,i])=>{vn(i,yn(t,e),n,r)})})},yn=(e,t)=>{let n=e;return t.split(fn).forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},bn=e=>e.isThemeGetter,xn=(e,t)=>t?e.map(([e,n])=>[e,n.map(e=>typeof e==`string`?t+e:typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,n])=>[t+e,n])):e)]):e,Sn=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=new Map,r=new Map,i=(i,a)=>{n.set(i,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);if(t!==void 0)return t;if((t=r.get(e))!==void 0)return i(e,t),t},set(e,t){n.has(e)?n.set(e,t):i(e,t)}}},Cn=`!`,wn=e=>{let{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],a=t.length,o=e=>{let n=[],o=0,s=0,c;for(let l=0;l<e.length;l++){let u=e[l];if(o===0){if(u===i&&(r||e.slice(l,l+a)===t)){n.push(e.slice(s,l)),s=l+a;continue}if(u===`/`){c=l;continue}}u===`[`?o++:u===`]`&&o--}let l=n.length===0?e:e.substring(s),u=l.startsWith(Cn);return{modifiers:n,hasImportantModifier:u,baseClassName:u?l.substring(1):l,maybePostfixModifierPosition:c&&c>s?c-s:void 0}};return n?e=>n({className:e,parseClassName:o}):o},Tn=e=>{if(e.length<=1)return e;let t=[],n=[];return e.forEach(e=>{e[0]===`[`?(t.push(...n.sort(),e),n=[]):n.push(e)}),t.push(...n.sort()),t},En=e=>({cache:Sn(e.cacheSize),parseClassName:wn(e),...pn(e)}),Dn=/\s+/,On=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,a=[],o=e.trim().split(Dn),s=``;for(let e=o.length-1;e>=0;--e){let t=o[e],{modifiers:c,hasImportantModifier:l,baseClassName:u,maybePostfixModifierPosition:d}=n(t),f=!!d,p=r(f?u.substring(0,d):u);if(!p){if(!f){s=t+(s.length>0?` `+s:s);continue}if(p=r(u),!p){s=t+(s.length>0?` `+s:s);continue}f=!1}let m=Tn(c).join(`:`),h=l?m+Cn:m,g=h+p;if(a.includes(g))continue;a.push(g);let _=i(p,f);for(let e=0;e<_.length;++e){let t=_[e];a.push(h+t)}s=t+(s.length>0?` `+s:s)}return s};function kn(){let e=0,t,n,r=``;for(;e<arguments.length;)(t=arguments[e++])&&(n=An(t))&&(r&&(r+=` `),r+=n);return r}var An=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=An(e[r]))&&(n&&(n+=` `),n+=t);return n};function jn(e,...t){let n,r,i,a=o;function o(o){return n=En(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)}function s(e){let t=r(e);if(t)return t;let a=On(e,n);return i(e,a),a}return function(){return a(kn.apply(null,arguments))}}var U=e=>{let t=t=>t[e]||[];return t.isThemeGetter=!0,t},Mn=/^\[(?:([a-z-]+):)?(.+)\]$/i,Nn=/^\d+\/\d+$/,Pn=new Set([`px`,`full`,`screen`]),Fn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,In=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ln=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Rn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bn=e=>Hn(e)||Pn.has(e)||Nn.test(e),Vn=e=>er(e,`length`,tr),Hn=e=>!!e&&!Number.isNaN(Number(e)),Un=e=>er(e,`number`,Hn),Wn=e=>!!e&&Number.isInteger(Number(e)),Gn=e=>e.endsWith(`%`)&&Hn(e.slice(0,-1)),W=e=>Mn.test(e),Kn=e=>Fn.test(e),qn=new Set([`length`,`size`,`percentage`]),Jn=e=>er(e,qn,nr),Yn=e=>er(e,`position`,nr),Xn=new Set([`image`,`url`]),Zn=e=>er(e,Xn,ir),Qn=e=>er(e,``,rr),$n=()=>!0,er=(e,t,n)=>{let r=Mn.exec(e);return r?r[1]?typeof t==`string`?r[1]===t:t.has(r[1]):n(r[2]):!1},tr=e=>In.test(e)&&!Ln.test(e),nr=()=>!1,rr=e=>Rn.test(e),ir=e=>zn.test(e),ar=jn(()=>{let e=U(`colors`),t=U(`spacing`),n=U(`blur`),r=U(`brightness`),i=U(`borderColor`),a=U(`borderRadius`),o=U(`borderSpacing`),s=U(`borderWidth`),c=U(`contrast`),l=U(`grayscale`),u=U(`hueRotate`),d=U(`invert`),f=U(`gap`),p=U(`gradientColorStops`),m=U(`gradientColorStopPositions`),h=U(`inset`),g=U(`margin`),_=U(`opacity`),v=U(`padding`),y=U(`saturate`),b=U(`scale`),x=U(`sepia`),S=U(`skew`),C=U(`space`),w=U(`translate`),T=()=>[`auto`,`contain`,`none`],ee=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],E=()=>[`auto`,W,t],D=()=>[W,t],te=()=>[``,Bn,Vn],O=()=>[`auto`,Hn,W],ne=()=>[`bottom`,`center`,`left`,`left-bottom`,`left-top`,`right`,`right-bottom`,`right-top`,`top`],re=()=>[`solid`,`dashed`,`dotted`,`double`,`none`],ie=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ae=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`],k=()=>[``,`0`,W],oe=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],A=()=>[Hn,W];return{cacheSize:500,separator:`:`,theme:{colors:[$n],spacing:[Bn,Vn],blur:[`none`,``,Kn,W],brightness:A(),borderColor:[e],borderRadius:[`none`,``,`full`,Kn,W],borderSpacing:D(),borderWidth:te(),contrast:A(),grayscale:k(),hueRotate:A(),invert:k(),gap:D(),gradientColorStops:[e],gradientColorStopPositions:[Gn,Vn],inset:E(),margin:E(),opacity:A(),padding:D(),saturate:A(),scale:A(),sepia:k(),skew:A(),space:D(),translate:D()},classGroups:{aspect:[{aspect:[`auto`,`square`,`video`,W]}],container:[`container`],columns:[{columns:[Kn]}],"break-after":[{"break-after":oe()}],"break-before":[{"break-before":oe()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:[...ne(),W]}],overflow:[{overflow:ee()}],"overflow-x":[{"overflow-x":ee()}],"overflow-y":[{"overflow-y":ee()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[`auto`,Wn,W]}],basis:[{basis:E()}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`wrap`,`wrap-reverse`,`nowrap`]}],flex:[{flex:[`1`,`auto`,`initial`,`none`,W]}],grow:[{grow:k()}],shrink:[{shrink:k()}],order:[{order:[`first`,`last`,`none`,Wn,W]}],"grid-cols":[{"grid-cols":[$n]}],"col-start-end":[{col:[`auto`,{span:[`full`,Wn,W]},W]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[$n]}],"row-start-end":[{row:[`auto`,{span:[Wn,W]},W]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":[`auto`,`min`,`max`,`fr`,W]}],"auto-rows":[{"auto-rows":[`auto`,`min`,`max`,`fr`,W]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:[`normal`,...ae()]}],"justify-items":[{"justify-items":[`start`,`end`,`center`,`stretch`]}],"justify-self":[{"justify-self":[`auto`,`start`,`end`,`center`,`stretch`]}],"align-content":[{content:[`normal`,...ae(),`baseline`]}],"align-items":[{items:[`start`,`end`,`center`,`baseline`,`stretch`]}],"align-self":[{self:[`auto`,`start`,`end`,`center`,`stretch`,`baseline`]}],"place-content":[{"place-content":[...ae(),`baseline`]}],"place-items":[{"place-items":[`start`,`end`,`center`,`baseline`,`stretch`]}],"place-self":[{"place-self":[`auto`,`start`,`end`,`center`,`stretch`]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[C]}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":[C]}],"space-y-reverse":[`space-y-reverse`],w:[{w:[`auto`,`min`,`max`,`fit`,`svw`,`lvw`,`dvw`,W,t]}],"min-w":[{"min-w":[W,t,`min`,`max`,`fit`]}],"max-w":[{"max-w":[W,t,`none`,`full`,`min`,`max`,`fit`,`prose`,{screen:[Kn]},Kn]}],h:[{h:[W,t,`auto`,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"min-h":[{"min-h":[W,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"max-h":[{"max-h":[W,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],size:[{size:[W,t,`auto`,`min`,`max`,`fit`]}],"font-size":[{text:[`base`,Kn,Vn]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`,Un]}],"font-family":[{font:[$n]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`,W]}],"line-clamp":[{"line-clamp":[`none`,Hn,Un]}],leading:[{leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`,Bn,W]}],"list-image":[{"list-image":[`none`,W]}],"list-style-type":[{list:[`none`,`disc`,`decimal`,W]}],"list-style-position":[{list:[`inside`,`outside`]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...re(),`wavy`]}],"text-decoration-thickness":[{decoration:[`auto`,`from-font`,Bn,Vn]}],"underline-offset":[{"underline-offset":[`auto`,Bn,W]}],"text-decoration-color":[{decoration:[e]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:D()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,W]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,W]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:[...ne(),Yn]}],"bg-repeat":[{bg:[`no-repeat`,{repeat:[``,`x`,`y`,`round`,`space`]}]}],"bg-size":[{bg:[`auto`,`cover`,`contain`,Jn]}],"bg-image":[{bg:[`none`,{"gradient-to":[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Zn]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...re(),`hidden`]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":[`divide-y-reverse`],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:re()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:[``,...re()]}],"outline-offset":[{"outline-offset":[Bn,W]}],"outline-w":[{outline:[Bn,Vn]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:te()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[Bn,Vn]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:[``,`inner`,`none`,Kn,Qn]}],"shadow-color":[{shadow:[$n]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...ie(),`plus-lighter`,`plus-darker`]}],"bg-blend":[{"bg-blend":ie()}],filter:[{filter:[``,`none`]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":[``,`none`,Kn,W]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":[``,`none`]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[`none`,`all`,``,`colors`,`opacity`,`shadow`,`transform`,W]}],duration:[{duration:A()}],ease:[{ease:[`linear`,`in`,`out`,`in-out`,W]}],delay:[{delay:A()}],animate:[{animate:[`none`,`spin`,`ping`,`pulse`,`bounce`,W]}],transform:[{transform:[``,`gpu`,`none`]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[Wn,W]}],"translate-x":[{"translate-x":[w]}],"translate-y":[{"translate-y":[w]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:[`center`,`top`,`top-right`,`right`,`bottom-right`,`bottom`,`bottom-left`,`left`,`top-left`,W]}],accent:[{accent:[`auto`,e]}],appearance:[{appearance:[`none`,`auto`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,W]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":[`none`,`auto`]}],resize:[{resize:[`none`,`y`,`x`,``]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,W]}],fill:[{fill:[e,`none`]}],"stroke-w":[{stroke:[Bn,Vn,Un]}],stroke:[{stroke:[e,`none`]}],sr:[`sr-only`,`not-sr-only`],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]}}});function G(...e){return ar(cn(e))}var K=be(),or=dn(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-input bg-background hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-10 px-4 py-2`,sm:`h-9 rounded-md px-3`,lg:`h-11 rounded-md px-8`,icon:`h-10 w-10`}},defaultVariants:{variant:`default`,size:`default`}}),sr=H.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,K.jsx)(r?Ae:`button`,{className:G(or({variant:t,size:n,className:e})),ref:a,...i}));sr.displayName=`Button`;var cr=De,lr=je,ur=H.forwardRef(({className:e,...t},n)=>(0,K.jsx)(ke,{ref:n,className:G(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));ur.displayName=ke.displayName;var dr=H.forwardRef(({className:e,children:t,hideCloseButton:n,...r},i)=>(0,K.jsxs)(lr,{children:[(0,K.jsx)(ur,{}),(0,K.jsxs)(Te,{ref:i,"aria-modal":`true`,className:G(`fixed left-[50%] top-[50%] z-50 grid max-h-[calc(100dvh-24px)] w-[calc(100vw-24px)] max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...r,children:[t,!n&&(0,K.jsxs)(Ee,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,K.jsx)(an,{className:`h-4 w-4`}),(0,K.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));dr.displayName=Te.displayName;var fr=({className:e,...t})=>(0,K.jsx)(`div`,{className:G(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});fr.displayName=`DialogHeader`;var pr=({className:e,...t})=>(0,K.jsx)(`div`,{className:G(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});pr.displayName=`DialogFooter`;var mr=H.forwardRef(({className:e,...t},n)=>(0,K.jsx)(Se,{ref:n,className:G(`text-lg font-semibold leading-none tracking-tight`,e),...t}));mr.displayName=Se.displayName;var hr=H.forwardRef(({className:e,...t},n)=>(0,K.jsx)(xe,{ref:n,className:G(`text-sm text-muted-foreground`,e),...t}));hr.displayName=xe.displayName;var gr=class extends Error{status;code;constructor(e,t,n){super(e),this.status=t,this.code=n,this.name=`HttpResponseError`}};function _r(e){return e instanceof gr}async function vr(e,t){let n=await fetch(e,t),r=await n.json().catch(()=>void 0);if(!n.ok){let e=r,t=e?.error&&typeof e.error==`object`&&!Array.isArray(e.error)?e.error:void 0;throw new gr(typeof e?.error==`string`?e.error:typeof t?.message==`string`?t.message:typeof e?.message==`string`?e.message:n.statusText||`Request failed (${n.status})`,n.status,typeof t?.code==`string`?t.code:typeof e?.code==`string`?e.code:void 0)}return r}var yr=L.Object({runId:L.String(),status:L.String(),messageId:L.Optional(L.String()),queued:L.Optional(L.Integer({minimum:0})),followUpQueue:L.Optional(te),queuePosition:L.Optional(L.Integer({minimum:0})),queueDepth:L.Optional(L.Integer({minimum:0})),maxConcurrentTasks:L.Optional(L.Integer({minimum:1}))},{additionalProperties:!1}),br=class extends Error{status;code;snapshot;name=`FollowUpQueueMutationHttpError`;constructor(e,t,n,r){super(e),this.status=t,this.code=n,this.snapshot=r}};function xr(e){if(!(e instanceof Error)||e.name!==`FollowUpQueueMutationHttpError`||!(`code`in e)||!(`snapshot`in e))return!1;let t=e;return typeof t.code==`string`&&F.safeParse({error:{code:t.code,message:t.message},snapshot:t.snapshot}).success}var q=``,Sr=1e4,Cr=L.Array(S),wr=L.Array(i),Tr=L.Array(p),Er=L.Array(R),Dr=L.Array(c),Or=L.Object({cwd:L.String(),gitBranch:L.Optional(L.String()),taskAdmission:L.Optional(L.Object({inFlight:L.Integer({minimum:0}),queued:L.Integer({minimum:0}),maxConcurrent:L.Integer({minimum:1}),maxQueued:L.Integer({minimum:1}),paused:L.Optional(L.Boolean())}))}),kr=e=>Array.isArray(e)?e:e==null?``:typeof e==`string`?e:JSON.stringify(e),Ar=()=>{let e=new Date;return`Session ${String(e.getFullYear()).slice(-2)}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)} ${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}`};function jr(e){let t=v.parse(e);return`projectPath=${encodeURIComponent(t.projectPath)}`}function J(e,t){let n=jr(t);return`${e}${e.includes(`?`)?`&`:`?`}${n}`}function Mr(e){return{"x-blade-directory":v.parse(e).projectPath}}var Nr=(e,t,n)=>({id:e.id??`history-${t}-${n}`,role:e.role,content:kr(e.content),timestamp:n,metadata:e.metadata&&typeof e.metadata==`object`?e.metadata:void 0,tool_call_id:e.tool_call_id,name:e.name,tool_calls:e.tool_calls,thinkingContent:e.thinkingContent??e.reasoningContent}),Y={listProjects:async()=>{let e=await fetch(`${q}/projects`);if(!e.ok)throw Error(`Failed to load projects`);return P(wr,await e.json())},bindProject:async e=>{let t=await fetch(`${q}/projects`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})});if(!t.ok){let e=await t.json().catch(()=>void 0);throw Error(e?.error?.message||`Failed to bind project`)}return i.parse(await t.json())},pickProjectDirectory:async()=>P(se,await vr(`${q}/projects/pick`,{method:`POST`})),unbindProject:async e=>{if(!(await fetch(`${q}/projects?path=${encodeURIComponent(e)}`,{method:`DELETE`})).ok)throw Error(`Failed to unbind project`)},listSessions:async()=>{let e=await fetch(`${q}/sessions`);if(!e.ok)throw Error(`Failed to load sessions`);return P(Cr,await e.json())},listSessionPage:async(e,t=50,n=!1)=>{let r=new URLSearchParams({limit:String(t)});e&&r.set(`cursor`,e),n&&r.set(`archived`,`true`);let i=await fetch(`${q}/sessions/catalog?${r.toString()}`);if(!i.ok)throw Error(`Failed to load session catalog`);return u.parse(await i.json())},listSurfaceCatalog:async(e={})=>{let t=new URLSearchParams;e.cursor&&t.set(`cursor`,e.cursor),e.limit!==void 0&&t.set(`limit`,String(e.limit)),e.archived!==void 0&&t.set(`archived`,String(e.archived)),e.workspaceKind&&t.set(`workspaceKind`,e.workspaceKind);let n=t.toString();return w.parse(await vr(`${q}/sessions/v2/catalog${n?`?${n}`:``}`))},openSurface:async(e,t,n)=>ue.parse(await vr(`${q}/sessions/v2/open`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(ge.parse({locator:e,...t===void 0?{}:{limit:t}})),signal:n})),loadSurfaceHistoryPage:async(e,n,r,i,a)=>t.parse(await vr(`${q}/sessions/v2/history`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(ae.parse({locator:e,cursor:n,expectedSnapshot:r,...i===void 0?{}:{limit:i}})),signal:a})),forkSurface:async(e,t)=>ue.parse(await vr(`${q}/sessions/v2/fork`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(_.parse({locator:e})),signal:t})),getSession:async e=>S.parse(await vr(J(`${q}/sessions/${e.sessionId}`,e))),createSession:async(e,t)=>{let n=await fetch(`${q}/sessions`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({projectPath:e,title:t||Ar()})});if(!n.ok)throw Error(`Failed to create session`);return S.parse(await n.json())},startCodeReview:async(e,t)=>{let n=await fetch(`${q}/sessions/${e.sessionId}/review`,{method:`POST`,headers:{"Content-Type":`application/json`,...Mr(e)},body:JSON.stringify({projectPath:e.projectPath,...t})});if(!n.ok){let e=await n.json().catch(()=>void 0),t=e?.error?.code===`CONFLICT`?V(`taskHome.review.conflict`):e?.error?.code===`BAD_REQUEST`?V(`taskHome.review.invalidTarget`):V(`taskHome.review.startFailed`);throw Error(t)}return b.parse(await n.json())},getWorkspaceInfo:async()=>P(Or,await vr(`${q}/global/info`)),createTask:async e=>{let t=await fetch(`${q}/tasks`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>void 0);throw Error(e?.error?.message||`Failed to dispatch task`)}return o.parse(await t.json())},updateTask:async(e,t)=>{let n=await fetch(J(`${q}/tasks/${e.sessionId}`,e),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>void 0);throw Error(e?.error?.message||`Failed to update task`)}return S.parse(await n.json())},setTaskAdmissionPaused:async e=>P(Or.properties.taskAdmission,await vr(`${q}/global/task-admission`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({paused:e})})),retryTask:async e=>{let t=await fetch(J(`${q}/tasks/${e.sessionId}/retry`,e),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>void 0);throw Error(e?.error?.message||`Failed to retry task`)}return o.parse(await t.json())},deliverTask:async(e,t)=>{let n=await fetch(J(`${q}/tasks/${e.sessionId}/delivery`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:t})});if(!n.ok){let e=await n.json().catch(()=>void 0);throw Error(e?.error?.message||`Failed to deliver task changes`)}return S.parse(await n.json())},getTaskDiff:async e=>{let t=await fetch(J(`${q}/tasks/${e.sessionId}/diff`,e));if(!t.ok){let e=await t.json().catch(()=>void 0);throw Error(e?.error?.message||`Failed to load task diff`)}return l.parse(await t.json())},deleteSession:async e=>{if(!(await fetch(J(`${q}/sessions/${e.sessionId}`,e),{method:`DELETE`})).ok)throw Error(`Failed to delete session`)},archiveSession:async e=>s.parse(await vr(J(`${q}/sessions/${e.sessionId}/archive`,e),{method:`POST`})),unarchiveSession:async e=>x.parse(await vr(J(`${q}/sessions/${e.sessionId}/unarchive`,e),{method:`POST`})),exportSessionMarkdown:async(e,t=!1)=>{let n=J(`${q}/sessions/${e.sessionId}/export`,e),r=t?`${n}&includeReasoning=true`:n,i=await fetch(r);if(!i.ok){let e=await i.json().catch(()=>void 0);throw Error(e?.error?.message||`Failed to export session`)}let a=i.headers.get(`content-disposition`)??``,o=/filename="([A-Za-z0-9._-]+)"/.exec(a)?.[1]??`blade-session-${e.sessionId.slice(0,12)}.md`,s=i.headers.get(`x-blade-content-sha256`)??``;if(!/^[a-f0-9]{64}$/.test(s))throw Error(`Session export is missing its integrity hash`);let c=e=>{let t=i.headers.get(e);if(t===null)throw Error(`Session export is missing its ${e} header`);let n=Number(t);if(!Number.isInteger(n)||n<0)throw Error(`Session export has an invalid ${e} header`);return n};return{filename:o,markdown:await i.text(),contentSha256:s,messageCount:c(`x-blade-export-messages`),activityCount:c(`x-blade-export-activities`),redactionCount:c(`x-blade-export-redactions`)}},updateSession:async(e,t)=>{if(!(await fetch(`${q}/sessions/${e.sessionId}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:t,projectPath:e.projectPath})})).ok)throw Error(`Failed to update session`)},getMessages:async e=>{let t=await fetch(J(`${q}/sessions/${e.sessionId}/message`,e));if(!t.ok)throw Error(`Failed to load messages`);let n=P(Tr,await t.json()),r=Date.now();return n.map((e,t)=>Nr(e,t,r))},sendMessage:async(e,t,n)=>{let r=await fetch(`${q}/sessions/${e.sessionId}/message`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...t,permissionMode:n,projectPath:e.projectPath})});if(!r.ok){let e=await r.json().catch(()=>void 0);throw new gr((e?.error?.message??e?.reason)||`Failed to send message`,r.status,e?.error?.code)}return P(yr,await r.json())},getFollowUpQueue:async e=>te.parse(await vr(J(`${q}/sessions/${e.sessionId}/follow-ups`,e))),mutateFollowUpQueue:async(e,t)=>{let n=await fetch(J(`${q}/sessions/${e.sessionId}/follow-ups/mutate`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r=await n.json().catch(()=>void 0);if(!n.ok){let e=F.safeParse(r);throw e.success?new br(e.data.error.message,n.status,e.data.error.code,e.data.snapshot):new gr(`Failed to mutate follow-up queue`,n.status)}return j.parse(r).snapshot},askSideQuestion:async(e,t,n)=>C.parse(await vr(`${q}/sessions/${e.sessionId}/side-question`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({question:t,projectPath:e.projectPath}),signal:n})),executeUserShellCommand:async(e,t)=>f.parse(await vr(`${q}/sessions/${e.sessionId}/shell`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({command:t,projectPath:e.projectPath})})),abortSession:async e=>{let t=await fetch(J(`${q}/sessions/${e.sessionId}/abort`,e),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>void 0);throw Error(e?.error?.message||`Failed to stop task`)}},getGoal:async e=>{let t=await fetch(J(`${q}/sessions/${e.sessionId}/goal`,e));if(!t.ok)throw Error(`Failed to load goal`);return(await t.json()).goal},createGoal:async(e,t,n,r)=>{let i=await fetch(J(`${q}/sessions/${e.sessionId}/goal`,e),{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({objective:t,tokenBudget:n,permissionMode:r})});if(!i.ok)throw Error(`Failed to create goal`);return i.json()},updateGoal:async(e,t)=>{let n=await fetch(J(`${q}/sessions/${e.sessionId}/goal`,e),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error(`Failed to update goal`);return n.json()},clearGoal:async e=>{if(!(await fetch(J(`${q}/sessions/${e.sessionId}/goal`,e),{method:`DELETE`})).ok)throw Error(`Failed to clear goal`)},listRewindCheckpoints:async e=>{let t=await fetch(J(`${q}/sessions/${e.sessionId}/rewind`,e));if(!t.ok)throw Error(`Failed to load rewind checkpoints`);let n=await t.json();return P(Er,n.checkpoints)},rewindSession:async(e,t,n)=>{let i=await fetch(J(`${q}/sessions/${e.sessionId}/rewind`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({targetMessageId:t,mode:n})});if(!i.ok)throw Error(`Failed to rewind session`);let a=r.parse(await i.json()),o=Date.now();return{...a,messages:a.messages.map((e,t)=>Nr(e,t,o))}},listSubagents:async e=>{let t=await fetch(J(`${q}/sessions/${e.sessionId}/subagents`,e));if(!t.ok)throw Error(`Failed to load subagents`);let n=await t.json();return P(Dr,n.subagents)},resumeSubagent:async(e,t,n)=>{let r=await fetch(J(`${q}/sessions/${e.sessionId}/subagents/${encodeURIComponent(t)}/resume`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({prompt:n})});if(!r.ok){let e=await r.json().catch(()=>void 0);throw Error(e?.message||`Failed to resume subagent`)}return m.parse(await r.json())},forkSession:async e=>{let t=await fetch(`${q}/sessions/${e.sessionId}/fork`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({projectPath:e.projectPath})});if(!t.ok)throw Error(`Failed to fork session`);let n=a.parse(await t.json()),r=Date.now();return{session:n.session,messages:n.messages.map((e,t)=>Nr(e,t,r))}},openEventSubscription:async(e,t,n)=>{let r=n?.maxRetries??5,i=n?.onConnectionChange,a=n?.onConnectionStateChange,o=null,s=0,c=null,l=Date.now(),u=null,d=null,f=!1,p=!1,m=0,h,g,_=!1,v=new Promise((e,t)=>{h=e,g=t}),y=()=>{u&&=(clearInterval(u),null)},b=()=>{d&&=(clearTimeout(d),null)},x=()=>{b();let e=o;o=null,e&&(e.onmessage=null,e.onerror=null,e.close())},S=()=>{c&&=(clearTimeout(c),null),y(),b(),x()},C=()=>{_||(_=!0,b(),h())},w=e=>{_||(_=!0,S(),g(e))},T=()=>{if(f||s>=r){s>=r&&(console.error(`SSE max retries (${r}) reached, giving up`),a?.(`offline`));return}s++,a?.(`reconnecting`);let e=Math.min(1e3*2**(s-1),3e4);console.log(`SSE reconnecting in ${e}ms (attempt ${s}/${r})`),c=setTimeout(()=>{c=null,E().catch(e=>{console.error(`SSE reconnect failed`,e),i?.(!1),T()})},e)},ee=()=>{b(),s=0,l=Date.now(),i?.(!0),!f&&o&&(a?.(`connected`),!f&&o&&(y(),u=setInterval(()=>{Date.now()-l>45e3&&(console.warn(`SSE heartbeat timeout, reconnecting...`),y(),x(),i?.(!1),a?.(`reconnecting`),T())},15e3),p||(p=!0,C())))},E=async()=>{if(f)return;x();let r=J(`${q}/sessions/${e.sessionId}/events${n?.resumePending===!1&&!p?`?resume=false`:``}`,e),s=m>0?`${r}${r.includes(`?`)?`&`:`?`}lastEventId=${m}`:r,c=new EventSource(s);o=c,d=setTimeout(()=>{if(!(f||o!==c)){if(x(),!p){a?.(`offline`),w(Error(`Timed out waiting for event subscription readiness`));return}i?.(!1),T()}},Sr),c.onmessage=n=>{if(!(f||o!==c))try{let r=_e.parse(JSON.parse(n.data));if(r.type===`heartbeat`){l=Date.now();return}if(r.properties.sessionId!==e.sessionId||r.properties.projectPath!==e.projectPath)return;if(typeof r.seq==`number`&&Number.isSafeInteger(r.seq)&&r.seq>m&&(m=r.seq),l=Date.now(),r.type===`connected`){r.properties.sessionId===e.sessionId&&r.properties.projectPath===e.projectPath&&(typeof r.properties.status==`string`&&t({type:`session.status`,properties:r.properties}),r.properties.followUpQueue!==void 0&&t({type:`follow_up.queue.changed`,properties:{sessionId:e.sessionId,projectPath:e.projectPath,queue:r.properties.followUpQueue}}),t({type:`provider.recovery`,properties:{sessionId:e.sessionId,projectPath:e.projectPath,recovery:r.properties.providerRecovery??null,authoritative:!0}}),t({type:`turn.activity`,properties:{sessionId:e.sessionId,projectPath:e.projectPath,activity:r.properties.turnActivity??null,authoritative:!0}}),ee());return}t(r)}catch(e){console.error(`Failed to parse SSE event:`,n.data,e)}},c.onerror=()=>{if(f||o!==c)return;let e=c.readyState===EventSource.CLOSED;if(y(),x(),e){i?.(!1),a?.(`offline`),p||w(Error(`Event subscription closed before it was ready`));return}if(!p){a?.(`offline`),w(Error(`Failed to open event subscription`));return}i?.(!1),T()}};return a?.(`connecting`),E().catch(e=>{a?.(`offline`),w(e instanceof Error?e:Error(`Failed to open event subscription`))}),await v,()=>{f=!0,c&&=(clearTimeout(c),null),S(),i?.(!1)}},openTaskEventSubscription:async(e,t)=>{let n=t?.onConnectionChange,r=t?.onConnectionStateChange,i=new EventSource(`${q}/events`),a=!1,o=!1,s,c,l,u=new Promise((e,t)=>{c=e,l=t}),d=()=>{a||(a=!0,s!==void 0&&(clearTimeout(s),s=void 0),i.close(),n?.(!1),r?.(`offline`))};return r?.(`connecting`),s=setTimeout(()=>{o||a||(d(),l(Error(`Timed out waiting for global task events`)))},Sr),i.onmessage=t=>{try{let i=_e.parse(JSON.parse(t.data));if(i.type===`connected`){o||(o=!0,s!==void 0&&(clearTimeout(s),s=void 0),c()),n?.(!0),r?.(`connected`);return}if(i.type===`heartbeat`)return;e(i)}catch(e){console.error(`Failed to parse global task event:`,t.data,e)}},i.onerror=()=>{n?.(!1),r?.(o?`reconnecting`:`offline`),!o&&!a&&(d(),l(Error(`Failed to open global task events`)))},await u,d},respondPermission:async(e,t,n)=>{let r=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),i=await fetch(`${q}/permissions/${t}?${r.toString()}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});if(!i.ok){let e=await i.json().catch(()=>void 0);throw Error(e?.error?.message||`Failed to respond to permission`)}},respondToConfirmation:async(e,t,n)=>{if(!(await fetch(J(`${q}/sessions/${e.sessionId}/confirmation/${t}`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({approved:n})})).ok)throw Error(`Failed to respond to confirmation`)},respondToQuestion:async(e,t,n)=>{let r=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),i=await fetch(`${q}/permissions/${t}?${r}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({approved:!0,answers:n})});if(!i.ok){let e=await i.json().catch(()=>void 0);throw Error(e?.error?.message||`Failed to respond to question`)}},respondToElicitation:async(e,t,n)=>{let r=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),i=await fetch(`${q}/permissions/${t}?${r}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({approved:n.action===`accept`,elicitation:n})});if(!i.ok){let e=await i.json().catch(()=>void 0);throw Error(e?.error?.message||`Failed to respond to MCP elicitation`)}},getGitInfo:async e=>{let t=await fetch(`${q}/suggestions/git-info`,{headers:Mr(e)});if(!t.ok)throw Error(`Failed to get git info`);return t.json()},listSchedules:async()=>{let e=await fetch(`${q}/schedules`);if(!e.ok){let t=await e.json().catch(()=>void 0);throw Error(t?.error?.message||V(`schedule.error.loadFailed`))}return h.parse(await e.json()).schedules},createSchedule:async e=>{let t=await fetch(`${q}/schedules`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>void 0);throw Error(e?.error?.message||V(`schedule.error.createFailed`))}return g.parse(await t.json())},updateSchedule:async(e,t)=>{let n=await fetch(`${q}/schedules/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>void 0);throw Error(e?.error?.message||V(`schedule.error.updateFailed`))}return g.parse(await n.json())},deleteSchedule:async e=>{let t=await fetch(`${q}/schedules/${encodeURIComponent(e)}`,{method:`DELETE`});if(!t.ok){let e=await t.json().catch(()=>void 0);throw Error(e?.error?.message||V(`schedule.error.deleteFailed`))}},enableSchedule:async e=>{let t=await fetch(`${q}/schedules/${encodeURIComponent(e)}/enable`,{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>void 0);throw Error(e?.error?.message||V(`schedule.error.toggleFailed`))}return g.parse(await t.json())},disableSchedule:async e=>{let t=await fetch(`${q}/schedules/${encodeURIComponent(e)}/disable`,{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>void 0);throw Error(e?.error?.message||V(`schedule.error.toggleFailed`))}return g.parse(await t.json())},runSchedule:async e=>{let t=await fetch(`${q}/schedules/${encodeURIComponent(e)}/run`,{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>void 0);throw Error(e?.error?.message||V(`schedule.error.runFailed`))}return g.parse(await t.json())}};function X(e){return{sessionId:e.sessionId,projectPath:e.projectPath}}function Z(e){return JSON.stringify([e.projectPath,e.sessionId])}function Pr(e){return JSON.stringify([e.version,e.sessionId,e.workspace.kind,e.workspace.kind===`local`?e.workspace.projectPath:e.workspace.workspaceRef])}function Q(e,t){return!e||!t?e===t:e.sessionId===t.sessionId&&e.projectPath===t.projectPath}function Fr(e,t){return!e||!t?e===t:e.version!==t.version||e.sessionId!==t.sessionId||e.workspace.kind!==t.workspace.kind?!1:e.workspace.kind===`local`&&t.workspace.kind===`local`?e.workspace.projectPath===t.workspace.projectPath:e.workspace.kind===`acp-remote`&&t.workspace.kind===`acp-remote`&&e.workspace.workspaceRef===t.workspace.workspaceRef}function Ir(e,t){return e.find(e=>Q(X(e),t))}function Lr(e,t){let n=X(t),r=e.findIndex(e=>Q(X(e),n));if(r===-1)return[...e,t];let i=[...e];return i[r]=t,i}function Rr(e,t){return e.filter(e=>!Q(X(e),t))}var zr=4;function Br(){let e=Error(`Aborted`);return e.name=`AbortError`,e}var Vr=new class{active=0;waiters=[];async run(e,t){await this.acquire(e);try{return e.throwIfAborted(),await t()}finally{this.release()}}acquire(e){return e.aborted?Promise.reject(Br()):this.active<zr?(this.active+=1,Promise.resolve()):new Promise((t,n)=>{let r=()=>{let e=this.waiters.indexOf(i);e>=0&&this.waiters.splice(e,1),n(Br())},i={signal:e,resolve:t,reject:n,removeAbortListener:()=>e.removeEventListener(`abort`,r)};e.addEventListener(`abort`,r,{once:!0}),this.waiters.push(i)})}release(){for(;this.waiters.length>0;){let e=this.waiters.shift();if(!e)break;if(e.removeAbortListener(),e.signal.aborted){e.reject(Br());continue}e.resolve();return}--this.active}},Hr=new Map;function Ur(e,t){return Vr.run(e,t)}function Wr(e){let t=Pr(e),n=Hr.get(t);if(n?.signal.aborted){Hr.delete(t);return}return n?.promise}function Gr(e,t,n){let r=Pr(e),i=Hr.get(r);if(i&&!i.signal.aborted)return i.promise;i&&Hr.delete(r);let a=Symbol(r),o=n().finally(()=>{Hr.get(r)?.token===a&&Hr.delete(r)});return Hr.set(r,{signal:t,token:a,promise:o}),o}var Kr=50,qr=500,Jr=new Set([`session_surface_cursor_invalid`,`session_surface_snapshot_changed`]);function Yr(e){let t=null;if(_r(e)&&e.code!==void 0)try{t=ee.parse(e.code)}catch{t=null}return{code:t,message:e instanceof Error?e.message:`Session history request failed`}}function Xr(e){return e instanceof Error&&e.name===`AbortError`}function Zr(e){return{locator:e.session.locator,displayCwd:e.session.displayCwd,capabilities:e.session.capabilities,mode:`history-only`}}function Qr(e){return e.length<=qr?e:e.slice(-500)}function $r(e,t){let n=new Set(t.map(e=>e.id));return[...e.filter(e=>!n.has(e.id)),...t].slice(0,qr).map(e=>({...e}))}function ei(e,t){return e.workspace.kind===t.workspace.kind?e.workspace.kind===`local`&&t.workspace.kind===`local`?e.workspace.projectPath===t.workspace.projectPath:e.workspace.kind===`acp-remote`&&t.workspace.kind===`acp-remote`&&e.workspace.workspaceRef===t.workspace.workspaceRef:!1}var ti=(e,t)=>{let n=0,r=null,i={},a=0,o=null,s=(e,n)=>e===a&&Fr(t().historySurfaceSelection?.locator,n),c=()=>(o?.abort(),o=new AbortController,a+=1,{generation:a,controller:o}),l=()=>{a+=1,o?.abort(),o=null},u=(t,n,r,i=null)=>{if(n===a){if(!Fr(r,t.session.locator))throw Error(`Session history response locator mismatch`);e({historySurfaceSelection:Zr(t),historySurfaceMessages:Qr(t.history.messages),historySurfaceOlderCursor:t.history.olderCursor??null,historySurfaceSnapshot:t.history.snapshot,historySurfaceGeneration:n,historySurfaceLoadState:`ready`,historySurfaceError:null,historySurfaceRecoveryCode:i,historySurfaceTruncated:t.history.truncated})}};return{surfaceCatalog:[],surfaceCatalogLoadState:`idle`,surfaceCatalogError:null,historySurfaceSelection:null,historySurfaceMessages:[],historySurfaceOlderCursor:null,historySurfaceSnapshot:null,historySurfaceGeneration:0,historySurfaceLoadState:`idle`,historySurfaceError:null,historySurfaceRecoveryCode:null,historySurfaceTruncated:!1,loadSurfaceCatalog:(a={})=>(n++,i={...a},r||(r=Promise.resolve().then(async()=>{try{let r;do{r=n;let a=i,o=t().catalogOverlayRevision??0;e({surfaceCatalogLoadState:`loading`,surfaceCatalogError:null});try{let i=[],s;do{let e=await Y.listSurfaceCatalog({...a,cursor:s,limit:Kr});if(r!==n)break;for(let t of e.sessions){let e=i.findIndex(e=>Fr(e.locator,t.locator));e<0?i.push(t):i[e]=t}s=e.nextCursor}while(s);if(r!==n)continue;if((t().catalogOverlayRevision??0)!==o){n++;continue}e({surfaceCatalog:i,surfaceCatalogLoadState:`ready`,surfaceCatalogError:null})}catch(t){if(r!==n)continue;e({surfaceCatalogLoadState:`error`,surfaceCatalogError:Yr(t)})}}while(r!==n)}finally{r=null}}),r)),openHistorySurface:async(n,r=Kr)=>{if(n.workspace.kind===`local`){await t().selectSession({sessionId:n.sessionId,projectPath:n.workspace.projectPath});return}let{generation:i,controller:o}=c(),s=t().claimViewSelection();e({historySurfaceSelection:null,historySurfaceMessages:[],historySurfaceOlderCursor:null,historySurfaceSnapshot:null,historySurfaceGeneration:i,historySurfaceLoadState:`loading`,historySurfaceError:null,historySurfaceRecoveryCode:null,historySurfaceTruncated:!1});try{let e=await Y.openSurface(n,r,o.signal);if(s!==t().getViewSelectionVersion())return;u(e,i,n)}catch(t){if(i!==a||Xr(t))return;e({historySurfaceLoadState:`error`,historySurfaceError:Yr(t)})}},loadOlderSurfaceHistory:async(n=Kr)=>{let r=t();if(r.historySurfaceSelection&&!r.historySurfaceSelection.capabilities.history.read){e({historySurfaceError:{code:`session_surface_capability_unavailable`,message:`Session history read is unavailable`}});return}let i=r.historySurfaceSelection?.locator,c=r.historySurfaceOlderCursor,l=r.historySurfaceSnapshot;if(!i||!c||!l)return;let d=Wr(i);if(d)return d;let f=a,p=o;if(p)return Gr(i,p.signal,async()=>{e({historySurfaceLoadState:`loading-older`,historySurfaceError:null});try{let t=await Ur(p.signal,()=>Y.loadSurfaceHistoryPage(i,c,l,n,p.signal));if(!s(f,i))return;if(t.snapshot!==l)throw Error(`Session history response snapshot mismatch`);e(e=>({historySurfaceMessages:$r(t.messages,e.historySurfaceMessages),historySurfaceOlderCursor:t.olderCursor??null,historySurfaceSnapshot:t.snapshot,historySurfaceLoadState:`ready`,historySurfaceError:null,historySurfaceRecoveryCode:null,historySurfaceTruncated:e.historySurfaceTruncated||t.truncated}))}catch(t){if(!s(f,i)||Xr(t))return;let r=Yr(t);if(r.code&&Jr.has(r.code)){let t=r.code;e({historySurfaceMessages:[],historySurfaceOlderCursor:null,historySurfaceSnapshot:null,historySurfaceLoadState:`loading`,historySurfaceError:null,historySurfaceRecoveryCode:t,historySurfaceTruncated:!1});try{let e=await Y.openSurface(i,n,p.signal);u(e,f,i,t)}catch(t){if(!s(f,i)||Xr(t))return;e({historySurfaceLoadState:`error`,historySurfaceError:Yr(t)})}return}e({historySurfaceLoadState:`error`,historySurfaceError:r})}})},forkHistorySurface:async()=>{let n=t().historySurfaceSelection,r=n?.locator;if(!r)return;if(!n.capabilities.history.fork){e({historySurfaceError:{code:`session_surface_capability_unavailable`,message:`Session history fork is unavailable`}});return}let{generation:i,controller:o}=c();e({historySurfaceGeneration:i,historySurfaceLoadState:`forking`,historySurfaceError:null,historySurfaceRecoveryCode:null});try{let e=await Y.forkSurface(r,o.signal);if(!ei(r,e.session.locator))throw Error(`Forked Session workspace mismatch`);u(e,i,e.session.locator),t().loadSurfaceCatalog()}catch(t){if(i!==a||Xr(t))return;e({historySurfaceLoadState:`error`,historySurfaceError:Yr(t)})}},closeHistorySurface:()=>{l(),e({historySurfaceSelection:null,historySurfaceMessages:[],historySurfaceOlderCursor:null,historySurfaceSnapshot:null,historySurfaceGeneration:a,historySurfaceLoadState:`idle`,historySurfaceError:null,historySurfaceRecoveryCode:null,historySurfaceTruncated:!1})}}},ni=(e,t)=>({messages:[],setMessages:t=>e({messages:t}),addMessage:t=>e(e=>({messages:[...e.messages,t]})),updateMessage:(t,n)=>e(e=>({messages:e.messages.map(e=>e.id===t?{...e,...n}:e)})),appendDelta:(t,n,r)=>e(e=>({messages:e.messages.map(e=>{if(e.id!==t)return e;let i=e.agentContent||oe();return r===`before`?{...e,agentContent:{...k(i,n),textBefore:i.textBefore+n}}:{...e,agentContent:{...k(i,n),textAfter:i.textAfter+n}}})})),appendToolCall:(t,n)=>e(e=>({messages:e.messages.map(e=>{if(e.id!==t)return e;let r=e.agentContent||oe();return{...e,agentContent:ce(r,n)}})})),updateToolCall:(t,n,r)=>e(e=>({messages:e.messages.map(e=>{if(e.id!==t)return e;let i=e.agentContent;return i?{...e,agentContent:{...i,toolCalls:i.toolCalls.map(e=>e.toolCallId===n?{...e,...r}:e)}}:e})})),appendThinking:(t,n)=>e(e=>({messages:e.messages.map(e=>{if(e.id!==t)return e;let r=e.agentContent||oe();return{...e,agentContent:{...pe(r,n),thinkingContent:r.thinkingContent+n}}})})),setConfirmation:(t,n)=>e(e=>({messages:e.messages.map(e=>{if(e.id!==t)return e;let r=e.agentContent||oe();return{...e,agentContent:{...r,confirmation:n}}})})),setQuestion:(t,n)=>e(e=>({messages:e.messages.map(e=>{if(e.id!==t)return e;let r=e.agentContent||oe();return{...e,agentContent:{...r,question:n}}})})),setElicitation:(t,n)=>e(e=>({messages:e.messages.map(e=>{if(e.id!==t)return e;let r=e.agentContent||oe();return{...e,agentContent:{...r,elicitation:n}}})})),setSubagent:(t,n)=>e(e=>({messages:e.messages.map(e=>{if(e.id!==t)return e;let r=e.agentContent||oe();return{...e,agentContent:n?O(r,n):ve(r,[])}})})),updateSubagent:(t,n,r)=>e(e=>({messages:e.messages.map(e=>{if(e.id!==t)return e;let i=e.agentContent||oe(),a=[...E(i)],o=a.findIndex(e=>e.id===n||e.sessionId===n);if(o===-1)return e;let s=a[o],c=typeof r==`function`?r(s):r;return a[o]={...s,...c,id:s.id},{...e,agentContent:ve(i,a,a[o].id)}})})),setTasks:(t,n)=>e(e=>({messages:e.messages.map(e=>{if(e.id!==t)return e;let r=e.agentContent||oe();return{...e,agentContent:{...r,tasks:n}}})})),replaceTemp:(t,n)=>e(e=>{let r=e.messages.findIndex(e=>e.content===t&&e.role===`user`);if(r===-1)return e;let i=[...e.messages];return i[r]=n,{messages:i}})}),ri=60,ii=[/<system-reminder>[\s\S]*?<\/system-reminder>/gi,/<file[^>]*>[\s\S]*?<\/file>/gi,/<hooks_context>[\s\S]*?<\/hooks_context>/gi,/<[^>]+>/g];function ai(e){let t=e;for(let e of ii)t=t.replace(e,` `);t=t.replace(/^\s*\/[a-zA-Z][\w-]*\s+/,``);let n=t.replace(/\s+/g,` `).trim();if(!n)return``;let r=n.match(/^(.+?)(?:[.!?]\s|[。!?](?=\S|$)|$)/),i=r&&r[1].length>=6?r[1]:n;if(i=i.trim().replace(/[\s.。!!??,,;;::-]+$/,``),i.length<=ri)return i;let a=i.slice(0,ri),o=a.lastIndexOf(` `);return`${(o>ri*.6?a.slice(0,o):a).trimEnd()}…`}var oi=M,si=`button, input, textarea, select, [contenteditable="true"], [data-chat-selection-exclude]`;function ci(e){return e.nodeType===Node.ELEMENT_NODE?e:e.parentElement}function li(e,t){let n=ci(e)?.closest(`[data-chat-message-id]`)??null;return n&&t.contains(n)?n:null}function ui(e){let t=e.getBoundingClientRect(),n=[...e.getClientRects()].find(e=>e.width>0||e.height>0),r=t.width>0||t.height>0?t:n;return r?{left:r.left,top:r.top,right:r.right,bottom:r.bottom,width:r.width,height:r.height}:null}function di(e,t){if(!t||t.rangeCount!==1||t.isCollapsed)return null;let n=t.getRangeAt(0),r=li(n.startContainer,e),i=li(n.endContainer,e);if(!r||r!==i)return null;let a=ci(n.startContainer),o=ci(n.endContainer);if(a?.closest(si)||o?.closest(si))return null;let s=r.dataset.chatRole;if(s!==`user`&&s!==`assistant`)return null;let c=t.toString().replaceAll(`\r
|
|
3
|
+
`,`
|
|
4
|
+
`).trim();if(!c)return null;let l=ui(n);return l?{messageId:r.dataset.chatMessageId??``,role:s,text:c,rect:l,tooLarge:c.length>oi}:null}function fi(e){let t=e?.selectedConversationAnnotations;return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e;return typeof t.id!=`string`||typeof t.text!=`string`||typeof t.sourceMessageId!=`string`||t.sourceRole!==`user`&&t.sourceRole!==`assistant`||t.comment!==void 0&&typeof t.comment!=`string`?[]:[t]}):[]}function pi(e){return e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`)}function mi(e,t,n=[]){let r=e.trim(),i=t?.trim();return!i&&n.length===0?r:[...i?[`<selected_conversation_text trust="untrusted">`,pi(i),`</selected_conversation_text>`,``]:[],...n.length>0?[`<side_conversation_history>`,...n.flatMap(e=>[`<${e.role}>`,pi(e.content),`</${e.role}>`]),`</side_conversation_history>`,``]:[],r].join(`
|
|
5
|
+
`)}var hi=`/.blade/worktrees/`,gi=/-[a-f0-9]{8,}$/i,_i=/^(.+?(?:test|config))-[a-z0-9]{6,}$/i;function vi(e){let t=e.indexOf(hi);if(t<0)return null;let n=e.slice(t+18).split(`/`)[0];return n?`${e.slice(0,t+18)}${n}`:null}function yi(e){if(!e.includes(`/tmp/`)&&!e.includes(`/T/`))return null;let t=e.split(`/`),n=t.at(-1)?.match(_i);return n?.[1]?(t[t.length-1]=n[1],t.join(`/`)):null}function bi(e){let t=e.split(`/`).filter(Boolean).at(-1)||e;return e.includes(hi)?t.replace(gi,``):t}function xi(e,t=null){let n=e.taskSourceProjectPath,r=yi(n||e.projectPath);if(r)return r;if(n)return n;let i=vi(e.projectPath);if(!i)return e.projectPath;let a=bi(i);return t&&a===bi(t)?t:i}function Si(e,t,n=null){return t?e.filter(e=>xi(e,n)===t):e}var Ci=n.AUTO_EDIT,wi=0,Ti=y((e,t)=>({currentModelId:null,currentMode:Ci,configuredModels:[],availableModels:[],isLoading:!1,hasLoaded:!1,loadedWorkspacePath:null,error:null,loadModels:async n=>{let r=n??null;if(t().isLoading&&t().loadedWorkspacePath===r)return;let i=++wi;e({isLoading:!0,hasLoaded:!1,loadedWorkspacePath:r,error:null});try{let a=await vr(`/models`,n?{headers:{"x-blade-directory":n}}:void 0);if(i!==wi||t().loadedWorkspacePath!==r)return;let o=a.current;e({currentModelId:o?.id||null,configuredModels:a.configured||[],availableModels:a.available||[],isLoading:!1,hasLoaded:!0})}catch(n){if(i!==wi||t().loadedWorkspacePath!==r)return;e({error:n instanceof Error?n.message:`Failed to load models`,isLoading:!1,hasLoaded:!0})}},setCurrentModel:async(t,n)=>{if(e({error:null}),n){e({currentModelId:t});return}try{await vr(`/configs`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({updates:{currentModelId:t},options:{scope:`global`}})}),e({currentModelId:t})}catch(t){throw e({error:t instanceof Error?t.message:`Failed to set model`}),t}},setMode:t=>e({currentMode:t}),resetMode:()=>e({currentMode:Ci})})),Ei=`__temp__`,Di={inputTokens:0,outputTokens:0,totalTokens:0,maxContextTokens:0,isDefaultMaxTokens:!0,totalInputTokens:0,totalOutputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,estimatedCostUsd:0},Oi=`blade.tasks.unread`,ki=`blade.tasks.terminal-read-ledger.v1`,Ai=16384,ji=1024,Mi=`blade:open-session`;function Ni(e){return e===`completed`||e===`failed`||e===`interrupted`}function Pi(){return{version:1,entries:[]}}function Fi(e){if(e===void 0)return null;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toISOString():null}function Ii(e){return Ni(e.taskStatus)?JSON.stringify([e.taskStatus,Fi(e.taskCompletedAt),de(e.taskFailure?.code)??null]):null}function Li(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ri(e){if(e.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e))return!0;if(!e.startsWith(`\\\\`))return!1;let[t,n]=e.slice(2).split(/[\\/]/);return!!(t&&n)}function zi(e){if(e.length===0||e.length>Ai)return!1;try{let t=JSON.parse(e);return!Array.isArray(t)||t.length!==2||typeof t[0]!=`string`||typeof t[1]!=`string`||!Ri(t[0])||t[1].length===0?!1:Z({projectPath:t[0],sessionId:t[1]})===e}catch{return!1}}function Bi(e){try{let t=JSON.parse(e);if(!Array.isArray(t)||t.length!==3||!Ni(t[0]))return!1;let n=t[1];if(n!==null&&(typeof n!=`string`||Fi(n)!==n))return!1;let r=t[2]===null?null:de(t[2])??void 0;return r!==void 0&&JSON.stringify([t[0],n,r])===e}catch{return!1}}function Vi(e){return!Li(e)||typeof e.key!=`string`||!zi(e.key)||e.signature!==null&&(typeof e.signature!=`string`||!Bi(e.signature))?null:{key:e.key,signature:e.signature}}function Hi(e=typeof localStorage>`u`?null:localStorage){if(!e)return Pi();try{let t=e.getItem(ki);if(t===null)return Pi();let n=JSON.parse(t);if(!Li(n)||n.version!==1||!Array.isArray(n.entries))return Pi();let r=new Map;for(let e of n.entries){let t=Vi(e);t&&(r.delete(t.key),r.set(t.key,t))}return{version:1,entries:[...r.values()]}}catch{return Pi()}}function Ui(e,t=typeof localStorage>`u`?null:localStorage){if(t)try{t.setItem(ki,JSON.stringify(e))}catch{}}function Wi(e,t,n){let r=Z(t);return{version:1,entries:[...e.entries.filter(e=>e.key!==r),{key:r,signature:Ii(n)}]}}function Gi(e){let t=new Set(e.sessions.map(e=>Z({sessionId:e.sessionId,projectPath:e.projectPath}))),n=new Set(e.unreadTaskKeys),r=e.ledger.entries.filter(e=>t.has(e.key)),i=r.filter(e=>e.signature!==null&&!n.has(e.key)),a=new Set(i.slice(0,Math.max(0,i.length-ji)));return{version:1,entries:r.filter(e=>!a.has(e))}}function Ki(e){let t=new Map;for(let n of e.ledger.entries)t.delete(n.key),t.set(n.key,n);let n=new Set(e.unreadTaskKeys),r=e.documentVisible&&e.currentSessionRef?Z(e.currentSessionRef):null,i=(e,n)=>{t.delete(e),t.set(e,{key:e,signature:n})};for(let a of e.sessions){let e=Z({sessionId:a.sessionId,projectPath:a.projectPath}),o=Ii(a);if(!t.has(e)){i(e,o),r===e&&n.delete(e);continue}if(r===e){i(e,o),n.delete(e);continue}if(o===null){i(e,null);continue}t.get(e)?.signature!==o&&n.add(e)}let a=new Set(e.sessions.map(e=>Z({sessionId:e.sessionId,projectPath:e.projectPath}))),o=[...n].filter(e=>a.has(e));return{ledger:Gi({ledger:{version:1,entries:[...t.values()]},sessions:e.sessions,unreadTaskKeys:o}),unreadTaskKeys:o}}function qi(e=typeof localStorage>`u`?null:localStorage){if(!e)return[];try{let t=JSON.parse(e.getItem(Oi)??`[]`);return Array.isArray(t)?[...new Set(t.filter(e=>typeof e==`string`))]:[]}catch{return[]}}function Ji(e,t=typeof localStorage>`u`?null:localStorage){if(t)try{t.setItem(Oi,JSON.stringify([...new Set(e)]))}catch{}}function Yi(e){if(typeof document>`u`||document.visibilityState!==`hidden`||typeof Notification>`u`||Notification.permission!==`granted`)return!1;let t=new Notification(e.title,{body:e.body,icon:`/favicon.svg`,tag:`blade-task-${Z(e.ref)}`});return t.onclick=()=>e.onOpen(e.ref),!0}function Xi(e){if(typeof window>`u`)return!1;let t=window.AudioContext??window.webkitAudioContext;if(!t)return!1;try{let n=new t,r=n.createOscillator(),i=n.createGain();return r.type=`sine`,r.frequency.value=e===`completed`?660:330,i.gain.setValueAtTime(1e-4,n.currentTime),i.gain.exponentialRampToValueAtTime(.045,n.currentTime+.015),i.gain.exponentialRampToValueAtTime(1e-4,n.currentTime+.18),r.connect(i),i.connect(n.destination),r.start(),r.stop(n.currentTime+.2),r.onended=()=>void n.close(),!0}catch{return!1}}var Zi=e=>{let t=[];e.content.trim()&&t.push({type:`text`,text:e.content});for(let n of e.attachments??[])n.type===`image`&&t.push({type:`image_url`,image_url:{url:n.content}});return t.length===0?e.content:t.length===1&&t[0]?.type===`text`?t[0].text:t},Qi=(e,t,n)=>{if(!n)return e;let r=t.find(e=>{let t=e.agentContent;if(!t)return!1;switch(n.type){case`permission`:return t.confirmation?.toolCallId===n.requestId&&t.confirmation.status===`pending`;case`question`:return t.question?.toolCallId===n.requestId&&t.question.status===`pending`;case`elicitation`:return t.elicitation?.toolCallId===n.requestId&&t.elicitation.status===`pending`}});if(!r?.agentContent)return e;let i=e.findIndex(e=>e.id===r.id),a=e[i]??{id:r.id,role:`assistant`,content:``,timestamp:r.timestamp},o=a.agentContent??oe();switch(n.type){case`permission`:o={...o,confirmation:r.agentContent.confirmation};break;case`question`:o={...o,question:r.agentContent.question};break;case`elicitation`:o={...o,elicitation:r.agentContent.elicitation}}let s={...a,agentContent:o};return i<0?[...e,s]:e.map((e,t)=>t===i?s:e)},$i=()=>({eventUnsubscribe:null,sessionEventConnectionState:`idle`,isStreaming:!1,isStopping:!1,agentPhase:`idle`,providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null,currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,pendingSubagentCompletions:{},currentAssistantMessageId:null,hasToolCalls:!1}),ea=()=>({followUpQueue:null,followUpQueueMutation:{pending:!1,supersededVersions:[]}}),ta=()=>new Promise(e=>{globalThis.setTimeout(()=>{if(typeof window<`u`&&typeof window.requestIdleCallback==`function`){window.requestIdleCallback(()=>e(),{timeout:750});return}e()},350)});function na(e){return e??{version:1,entries:[]}}function ra(e,t,n){let r=[...e];for(let[e,i]of Object.entries(t))i.revision<=n||(r=i.kind===`remove`?r.filter(t=>Z(X(t))!==e):Lr(r,i.session));return r}function ia(e,t){return Object.fromEntries(Object.entries(e).filter(([,e])=>e.revision>t))}var aa=async e=>(await Pe(async()=>{let{teamService:e}=await import(`./teamService-DfIvlI2_.js`).then(e=>e.n);return{teamService:e}},__vite__mapDeps([0,1,2]))).teamService.list(e),oa=(e,t)=>{let n=0,r=0,i=0,a=0,o=new Map,s=new Map,c=null,l=()=>(c?.abort(`session-navigation`),c=null,n+=1,n),u=e=>e===n,f=e=>{try{e()}catch(e){console.warn(`Failed to clean up stale event subscription`,e)}},p=n=>{if(I(t().historySurfaceSelection))return e({error:N}),!1;let r=t(),i=r.currentSessionRef;if(r.isTemporarySession||!i||!r.currentSessionId)return e({error:`Start or select a Session before using /btw`}),!1;c?.abort(`side-conversation-replaced`),c=null;let a=n?.trim();return e({sideConversation:{requestId:`draft-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,sessionRef:i,question:``,...a?{selectedText:a}:{},messages:[],status:`idle`},error:null,errorContext:null}),!0},m=async(r,i)=>{if(I(t().historySurfaceSelection))return e({error:N}),!1;let a=r.trim();if(!a)return e({error:`Usage: /btw <question>`}),!1;let o=t(),s=o.currentSessionRef;if(o.isTemporarySession||!s||!o.currentSessionId)return e({error:`Start or select a Session before using /btw`}),!1;let l=o.sideConversation&&Q(o.sideConversation.sessionRef,s)?o.sideConversation:null,d=l?.messages??[],f=i?.trim()||l?.selectedText?.trim(),p=mi(a,f,d);if(p.length>16384)return e({error:`Side conversation question is too long`}),!1;let m=n,h=()=>u(m)&&Q(t().currentSessionRef,s)&&!I(t().historySurfaceSelection);c?.abort(`side-conversation-replaced`);let g=new AbortController;c=g;let _=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,v={id:`${_}-user`,role:`user`,content:a},y=[...d,v];e({sideConversation:{requestId:_,sessionRef:s,question:a,...f?{selectedText:f}:{},messages:y,status:`loading`},error:null,errorContext:null});try{let n=await Y.askSideQuestion(s,p,g.signal);return g.signal.aborted||!h()||t().sideConversation?.requestId!==_?!1:(e({sideConversation:{requestId:_,sessionRef:s,question:a,...f?{selectedText:f}:{},messages:[...y,{id:`${_}-assistant`,role:`assistant`,content:n.response}],status:`completed`,response:n.response,durationMs:n.durationMs,modelId:n.modelId}}),n.usage&&t().updateTokenUsage({scope:`auxiliary`,inputTokens:n.usage.promptTokens,outputTokens:n.usage.completionTokens,totalTokens:n.usage.totalTokens,cacheReadTokens:n.usage.cacheReadInputTokens??0,cacheWriteTokens:n.usage.cacheCreationInputTokens??0,costUsd:n.usage.costUsd}),!0)}catch(t){return g.signal.aborted||!h()||e({sideConversation:{requestId:_,sessionRef:s,question:a,...f?{selectedText:f}:{},messages:y,status:`error`,error:t instanceof Error?t.message:String(t)}}),!1}finally{c===g&&(c=null)}};return{sessions:[],archivedSessions:[],currentSessionId:null,currentSessionRef:null,forkingSessionRef:null,isTemporarySession:!1,isLoading:!1,catalogLoadState:`idle`,catalogError:null,archivedCatalogLoadState:`idle`,archivedCatalogError:null,error:null,errorContext:null,goal:null,sideConversation:null,...ea(),teams:[],setSessions:t=>e({sessions:t}),addSession:n=>{e(e=>({sessions:Lr(e.sessions,n)})),t().loadSurfaceCatalog()},removeSession:n=>{let r=t(),i=Z(n),a=Q(r.currentSessionRef,n),o=Q(r.forkingSessionRef,n);(a||o)&&l(),a&&r.unsubscribeFromEvents();let s=r.unreadTaskKeys,c=na(r.taskTerminalReadLedger);e(e=>{let t={...e.sessionCatalogOverlays};return delete t[i],s=e.unreadTaskKeys.filter(e=>e!==i),c={version:1,entries:na(e.taskTerminalReadLedger).entries.filter(e=>e.key!==i)},{sessions:Rr(e.sessions,n),surfaceCatalog:e.surfaceCatalog.filter(e=>e.locator.workspace.kind!==`local`||e.locator.workspace.projectPath!==n.projectPath||e.locator.sessionId!==n.sessionId),unreadTaskKeys:s,taskTerminalReadLedger:c,sessionCatalogOverlays:t,currentSessionId:a?null:e.currentSessionId,currentSessionRef:a?null:e.currentSessionRef,messages:a?[]:e.messages,goal:a?null:e.goal,sideConversation:a?null:e.sideConversation,teams:a?[]:e.teams,forkingSessionRef:o?null:e.forkingSessionRef,...a?ea():{},...a?$i():{}}}),Ui(c),Ji(s)},setCurrentSession:n=>{l(),t().claimViewSelection(),t().closeHistorySurface(),e({currentSessionId:n?.sessionId??null,currentSessionRef:n,isTemporarySession:!1,sideConversation:null,teams:[],pendingResume:null,...ea()})},setTemporarySession:t=>e({isTemporarySession:t}),setLoading:t=>e({isLoading:t}),setError:t=>e({error:t,errorContext:null}),getNavigationVersion:()=>n,getViewSelectionVersion:()=>r,claimViewSelection:()=>(r+=1,r),clearError:()=>e({error:null,errorContext:null}),setGoal:t=>e({goal:t}),startTemporarySession:n=>{l(),t().claimViewSelection(),t().closeHistorySurface(),t().unsubscribeFromEvents(),Ti.getState().resetMode(),n&&t().selectProject(n),e({currentSessionId:Ei,currentSessionRef:null,isTemporarySession:!0,forkingSessionRef:null,isLoading:!1,messages:[],goal:null,sideConversation:null,teams:[],tokenUsage:{...Di},error:null,errorContext:null,...ea(),...$i()})},loadSessions:async()=>{let n=++i,r=t().sessions,a=t().catalogOverlayRevision??0,o=[];e({catalogLoadState:`loading`,catalogError:null});try{let s;do{let t=await Y.listSessionPage(s);if(n!==i)return;for(let e of t.sessions)o=Lr(o,e);if(e(e=>{let t=new Set(o.map(e=>Z(X(e))));return{sessions:ra([...o,...r.filter(e=>!t.has(Z(X(e))))],e.sessionCatalogOverlays??{},a),catalogLoadState:`hydrating`}}),s=t.nextCursor,s&&(await ta(),n!==i))return}while(s);if(n!==i)return;let c=t().unreadTaskKeys,l=na(t().taskTerminalReadLedger);e(e=>{let t=ra(o,e.sessionCatalogOverlays??{},a),n=Ki({ledger:na(e.taskTerminalReadLedger),unreadTaskKeys:e.unreadTaskKeys,sessions:t,currentSessionRef:e.currentSessionRef,documentVisible:typeof document<`u`&&document.visibilityState===`visible`});return c=n.unreadTaskKeys,l=n.ledger,{sessions:t,unreadTaskKeys:c,taskTerminalReadLedger:l,sessionCatalogOverlays:ia(e.sessionCatalogOverlays??{},a),catalogLoadState:`ready`,catalogError:null}}),Ui(l),Ji(c)}catch(t){if(n!==i)return;e({catalogLoadState:`error`,catalogError:t.message})}},loadArchivedSessions:async()=>{let t=++a;e({archivedCatalogLoadState:`loading`,archivedCatalogError:null});try{let n,r=[];do{let i=await Y.listSessionPage(n,50,!0);if(t!==a)return;for(let e of i.sessions){let t=r.findIndex(t=>Q(X(t),X(e)));t===-1?r.push(e):r[t]=e}n=i.nextCursor,n&&(e({archivedCatalogLoadState:`hydrating`}),await ta())}while(n);if(t!==a)return;e({archivedSessions:r,archivedCatalogLoadState:`ready`,archivedCatalogError:null})}catch(n){if(t!==a)return;e({archivedCatalogLoadState:`error`,archivedCatalogError:n.message})}},selectSession:async n=>{let r=l(),i=t().claimViewSelection();t().closeHistorySurface(),e({isLoading:!0,error:null,errorContext:null,forkingSessionRef:null});let a=null;try{let o=Ir(t().sessions,n),s=[],c=!1;if(a=await t().prepareEventSubscription(n,e=>{c?t().handleEvent(e):s.push(e)}),!u(r)||i!==t().getViewSelectionVersion()){f(a),a=null;return}let[l,d,p,m]=await Promise.all([Y.getMessages(n),Y.getGoal(n).catch(()=>null),o?Promise.resolve(o):Y.getSession(n),Ne.getState().agentTeamsEnabled?aa(n).catch(()=>[]):Promise.resolve([])]);if(!u(r)||i!==t().getViewSelectionVersion()){f(a),a=null;return}let h=D(l),g=xi(p,t().selectedProjectPath??t().taskWorkspaceInfo?.cwd??null);t().boundProjects.some(e=>e.available&&e.path===g)&&t().selectProject(g),Ti.getState().setMode(p.permissionMode??Ci),e(e=>({currentSessionId:n.sessionId,currentSessionRef:n,isTemporarySession:!1,messages:h,goal:d,teams:m,...ea(),isLoading:!1,tokenUsage:{...Di},isStreaming:!1,isStopping:!1,agentPhase:`idle`,providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null,currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,pendingSubagentCompletions:{},currentAssistantMessageId:null,hasToolCalls:!1,error:p.taskStatus===`failed`?p.taskFailure?.message??null:null,errorContext:p.taskStatus===`failed`&&p.taskFailure?{kind:`execution`,sessionRef:n,failureCode:p.taskFailure.code}:null,sessions:Lr(e.sessions,p)})),t().markTaskRead(n),c=!0,t().replaceEventSubscription(a),a=null;for(let e of s)t().handleEvent(e)}catch(o){if(a&&f(a),!u(r)||i!==t().getViewSelectionVersion())return;e({error:o.message,errorContext:{kind:`navigation`,sessionRef:n},isLoading:!1})}},resyncSessionMessages:async r=>{if(I(t().historySurfaceSelection)){e({error:N});return}let i=Z(r),a=o.get(i);if(a)return a;let s=n,c=Promise.resolve().then(async()=>{try{let n=await Y.getMessages(r);if(!u(s)||!Q(t().currentSessionRef,r))return;let i=D(n);e(e=>({messages:Qi(i,e.messages,Ir(e.sessions,r)?.pendingInteraction),sessions:e.sessions.map(e=>Q(X(e),r)?{...e,messageCount:i.length}:e)}))}catch(e){console.warn(`Failed to resync terminal session messages`,e)}finally{o.get(i)===c&&o.delete(i)}});return o.set(i,c),c},archiveSession:async n=>{if(I(t().historySurfaceSelection)){e({error:N});return}try{let r=await Y.archiveSession(n),i=new Set(r.archivedSessionIds),a=t(),o=a.currentSessionRef?.projectPath===n.projectPath&&i.has(a.currentSessionRef.sessionId);o&&(l(),a.unsubscribeFromEvents());let s=a.unreadTaskKeys,c=na(a.taskTerminalReadLedger);if(e(e=>{let t=new Set(r.archivedSessionIds.map(e=>Z({sessionId:e,projectPath:n.projectPath}))),a=e.sessions.filter(e=>e.projectPath!==n.projectPath||!i.has(e.sessionId));s=e.unreadTaskKeys.filter(e=>!t.has(e)),c={version:1,entries:na(e.taskTerminalReadLedger).entries.filter(e=>!t.has(e.key))};let l=(e.catalogOverlayRevision??0)+1,u={...e.sessionCatalogOverlays};for(let e of t)u[e]={revision:l,kind:`remove`};return{sessions:a,surfaceCatalog:e.surfaceCatalog.filter(e=>e.locator.workspace.kind!==`local`||e.locator.workspace.projectPath!==n.projectPath||!i.has(e.locator.sessionId)),archivedSessions:Lr(e.archivedSessions,r.session),unreadTaskKeys:s,taskTerminalReadLedger:c,catalogOverlayRevision:l,sessionCatalogOverlays:u,currentSessionId:o?null:e.currentSessionId,currentSessionRef:o?null:e.currentSessionRef,messages:o?[]:e.messages,goal:o?null:e.goal,...o?ea():{},...o?$i():{}}}),Ui(c),Ji(s),I(t().historySurfaceSelection))return;await t().loadArchivedSessions()}catch(t){e({error:t.message,errorContext:{kind:`task_action`,sessionRef:n}})}},unarchiveSession:async n=>{if(I(t().historySurfaceSelection)){e({error:N});return}try{let r=await Y.unarchiveSession(n),i=new Set(r.restoredSessionIds);if(e(e=>{let t=(e.catalogOverlayRevision??0)+1,a=Z(X(r.session));return{archivedSessions:e.archivedSessions.filter(e=>e.projectPath!==n.projectPath||!i.has(e.sessionId)),sessions:Lr(e.sessions,r.session),catalogOverlayRevision:t,sessionCatalogOverlays:{...e.sessionCatalogOverlays,[a]:{revision:t,kind:`upsert`,session:r.session}}}}),I(t().historySurfaceSelection))return;await Promise.all([t().loadSessions(),t().loadArchivedSessions(),t().loadSurfaceCatalog()])}catch(t){e({error:t.message,errorContext:{kind:`task_action`,sessionRef:n}})}},deleteSession:async n=>{if(I(t().historySurfaceSelection)){e({error:N});return}let r=t(),i=Q(r.currentSessionRef,n),a=Q(r.forkingSessionRef,n),o=i||a?l():null,s=i?o:null;a&&e({forkingSessionRef:null});try{await Y.deleteSession(n);let r=t(),i=Q(r.currentSessionRef,n)&&(s===null||u(s));i&&(l(),r.unsubscribeFromEvents());let a=Z(n),o=r.unreadTaskKeys,c=na(r.taskTerminalReadLedger);e(e=>{let t=(e.catalogOverlayRevision??0)+1;return o=e.unreadTaskKeys.filter(e=>e!==a),c={version:1,entries:na(e.taskTerminalReadLedger).entries.filter(e=>e.key!==a)},{sessions:Rr(e.sessions,n),surfaceCatalog:e.surfaceCatalog.filter(e=>e.locator.workspace.kind!==`local`||e.locator.workspace.projectPath!==n.projectPath||e.locator.sessionId!==n.sessionId),unreadTaskKeys:o,taskTerminalReadLedger:c,catalogOverlayRevision:t,sessionCatalogOverlays:{...e.sessionCatalogOverlays,[a]:{revision:t,kind:`remove`}},currentSessionId:i?null:e.currentSessionId,currentSessionRef:i?null:e.currentSessionRef,messages:i?[]:e.messages,goal:i?null:e.goal,...i?ea():{},...i?$i():{}}}),Ui(c),Ji(o)}catch(r){if(s!==null&&(!u(s)||!Q(t().currentSessionRef,n)))return;e({error:r.message})}},updateSession:async(n,r)=>{if(I(t().historySurfaceSelection)){e({error:N});return}try{await Y.updateSession(n,r),e(e=>({sessions:e.sessions.map(e=>e.sessionId===n.sessionId&&e.projectPath===n.projectPath?{...e,title:r}:e)}))}catch(t){e({error:t.message})}},forkSession:async n=>{if(I(t().historySurfaceSelection)){e({error:N});return}let r=l(),i=t().claimViewSelection();t().closeHistorySurface(),e({forkingSessionRef:X(n),isLoading:!1,error:null});let a=null;try{let o=await Y.forkSession(n),s=X(o.session),c=D(o.messages);if(e(e=>({sessions:Lr(e.sessions,o.session)})),t().loadSurfaceCatalog(),!u(r)||i!==t().getViewSelectionVersion())return;if(a=await t().prepareEventSubscription(s),!u(r)||i!==t().getViewSelectionVersion()){f(a),a=null;return}e({currentSessionId:s.sessionId,currentSessionRef:s,isTemporarySession:!1,messages:c,goal:null,...ea(),tokenUsage:{...Di},error:null,forkingSessionRef:null}),t().replaceEventSubscription(a),a=null}catch(n){if(a&&f(a),!u(r)||i!==t().getViewSelectionVersion())return;e({error:n.message,forkingSessionRef:null})}},rewindSession:async(r,i)=>{if(I(t().historySurfaceSelection))return e({error:N}),!1;let{currentSessionRef:a,isTemporarySession:o,isStreaming:s}=t();if(!a||o)return e({error:`No persisted session is available for rewind`}),!1;if(s)return e({error:`Stop the active run before rewinding`}),!1;let c=n;try{let n=await Y.rewindSession(a,r,i);if(!u(c)||!Q(t().currentSessionRef,a))return!1;let o=D(n.messages);return e(e=>({messages:o,tokenUsage:{...Di},error:null,currentRunId:null,agentPhase:`idle`,providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,pendingSubagentCompletions:{},currentAssistantMessageId:null,hasToolCalls:!1,sessions:e.sessions.map(e=>e.sessionId===a.sessionId&&e.projectPath===a.projectPath?{...e,messageCount:o.length}:e)})),!0}catch(n){return!u(c)||!Q(t().currentSessionRef,a)||e({error:n.message}),!1}},openSideConversation:p,askSideConversation:m,sendMessage:async r=>{if(I(t().historySurfaceSelection))return e({error:N}),!1;let{currentSessionId:i,currentSessionRef:a,isTemporarySession:o,isStreaming:s,addSession:l,addMessage:h}=t(),g=n,_=a,v={isStreaming:s,agentPhase:t().agentPhase,currentRunId:t().currentRunId},y=a,b=i,x=_,S=null,C=null,w=()=>u(g)&&Q(t().currentSessionRef,x)&&!I(t().historySurfaceSelection),T=d(r.content);if(T)return(r.attachments?.length??0)>0?(e({error:`Side conversations do not accept image attachments`}),!1):T.question?p()?m(T.question):!1:m(T.question);if(c?.abort(`main-conversation-submitted`),c=null,e({sideConversation:null,pendingResume:null}),o||!b||b===`__temp__`)try{let n=ai(r.content),i=await Y.createSession(t().selectedProjectPath??t().taskWorkspaceInfo?.cwd??void 0,n||void 0);if(l(i),!w())return!1;y=X(i),b=i.sessionId,e({currentSessionId:i.sessionId,currentSessionRef:y,isTemporarySession:!1}),x=y}catch(t){return w()&&e({error:t.message}),!1}if(!y||!b||b===`__temp__`)return w()&&e({error:`Failed to create session`}),!1;try{if(!s){if(S=await t().prepareEventSubscription(y,void 0,{resumePending:!1}),!w())return f(S),S=null,!1;t().replaceEventSubscription(S),S=null}if(!w())return!1;let n=r.content.trim();if(n.startsWith(`!`)){if((r.attachments?.length??0)>0)throw Error(`User shell commands do not accept image attachments`);let t=n.slice(1).trim();if(!t)throw Error(`User shell command cannot be empty`);s||e({isStreaming:!0,agentPhase:`running`,error:null,errorContext:null});let i=await Y.executeUserShellCommand(y,t);return w()?(i.auxiliary||e({isStreaming:!1,agentPhase:`idle`,pendingResume:null}),i.delivery&&e({pendingSteeringCount:i.queued??0,pendingInputDelivery:i.delivery===`current_turn`?`current_turn`:`next_turn`}),!0):!1}if((r.attachments?.length??0)===0&&(n===`/goal`||n.startsWith(`/goal `))){C=`goal-command-${Date.now()}`,h({id:C,role:`user`,content:n,timestamp:Date.now()});let t=n.slice(5).trim().split(/\s+/).filter(Boolean),r=t[0]?.toLowerCase();if(!r||r===`status`){let t=await Y.getGoal(y);return w()&&e({goal:t}),w()}if(r===`clear`)return await Y.clearGoal(y),w()&&e({goal:null}),w();let i;if(r===`pause`)i=await Y.updateGoal(y,{action:`pause`});else if(r===`resume`)i=await Y.updateGoal(y,{action:`resume`});else if(r===`edit`){let e=t.slice(1).join(` `).trim();if(!e)throw Error(`Usage: /goal edit <objective>`);i=await Y.updateGoal(y,{action:`edit`,objective:e})}else{let e=t.lastIndexOf(`--budget`),n;if(e>=0){let r=t[e+1];if(!r||!/^[1-9]\d*$/.test(r))throw Error(`--budget requires a positive integer`);n=Number(r),t.splice(e,2)}let r=t.join(` `).trim();if(!r)throw Error(`Usage: /goal <objective>`);let{currentMode:a}=Ti.getState();i=await Y.createGoal(y,r,n,a)}return w()?(e({goal:i.goal,...i.runId?{currentRunId:i.runId,isStreaming:!0,agentPhase:`running`}:{}}),!0):!1}s||(C=`temp-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,h({id:C,role:`user`,content:Zi(r),timestamp:Date.now(),metadata:r.annotations&&r.annotations.length>0?{selectedConversationAnnotations:r.annotations}:void 0})),e({isStreaming:!0,error:null,errorContext:null,recoveredSteeringCount:s?t().recoveredSteeringCount:0});let{currentMode:i,currentModelId:a}=Ti.getState(),{modelId:o,...c}=r,l=o??a??void 0,u=r.reasoningEffort,d=r.serviceTier,p=r.responseVerbosity,m=r.communicationStyle,g=l&&!s?{...c,modelId:l}:c,_=await Y.sendMessage(y,g,i);return w()?(e(e=>({currentRunId:_.runId,pendingSteeringCount:_.followUpQueue?_.followUpQueue.pending:_.status===`steering_queued`||_.status===`follow_up_queued`?Math.max(0,_.queued??1):e.pendingSteeringCount,pendingInputDelivery:_.status===`steering_queued`?`current_turn`:_.status===`follow_up_queued`?`next_turn`:e.pendingInputDelivery,..._.followUpQueue?{followUpQueue:_.followUpQueue}:{},..._.followUpQueue?{followUpQueueMutation:{pending:!1,supersededVersions:e.followUpQueue?[...e.followUpQueueMutation.supersededVersions,e.followUpQueue.version].slice(-16):e.followUpQueueMutation.supersededVersions}}:{},sessions:(l||u||d||p||m)&&!s?e.sessions.map(e=>e.sessionId===y.sessionId&&e.projectPath===y.projectPath?{...e,...l?{selectedModelId:l}:{},...u?{reasoningEffort:u}:{},...d?{serviceTier:d}:{},...p?{responseVerbosity:p}:{},...m?{communicationStyle:m}:{}}:e):e.sessions})),!0):!1}catch(n){if(S&&f(S),!w())return!1;if(C&&!t().messages.some(e=>e.id===C)&&!_r(n))return!0;let r=_r(n)&&n.code===`SESSION_WORKSPACE_UNAVAILABLE`?`workspace_unavailable`:void 0;return e(e=>({error:n.message,errorContext:{kind:`submission`,sessionRef:y,...r?{failureCode:r}:{}},messages:C?e.messages.filter(e=>e.id!==C):e.messages,...v})),!1}},refreshFollowUpQueue:async()=>{let r=t().currentSessionRef;if(!r||I(t().historySurfaceSelection))return;let i=n,a=t().followUpQueue?.version;try{let n=await Y.getFollowUpQueue(r),o=t();u(i)&&Q(o.currentSessionRef,r)&&o.followUpQueue?.version===a&&e(e=>({followUpQueue:n,followUpQueueMutation:{pending:e.followUpQueueMutation.pending,supersededVersions:e.followUpQueue?[...e.followUpQueueMutation.supersededVersions,e.followUpQueue.version].slice(-16):e.followUpQueueMutation.supersededVersions}}))}catch(n){u(i)&&Q(t().currentSessionRef,r)&&e(e=>({followUpQueueMutation:{pending:e.followUpQueueMutation.pending,errorMessage:n instanceof Error?n.message:String(n),supersededVersions:e.followUpQueueMutation.supersededVersions}}))}},mutateFollowUpQueue:async r=>{let i=t(),a=i.currentSessionRef,o=i.followUpQueue;if(!a||!o||i.followUpQueueMutation.pending||I(i.historySurfaceSelection))return!1;let s=n;e({followUpQueueMutation:{pending:!0,messageId:r.messageId,supersededVersions:i.followUpQueueMutation.supersededVersions}});try{let n=await Y.mutateFollowUpQueue(a,{expectedVersion:o.version,operation:r});return!u(s)||!Q(t().currentSessionRef,a)?!1:(e(e=>{let t=e.followUpQueue?.version,r=t===o.version||t===n.version;return{...r?{followUpQueue:n}:{},followUpQueueMutation:{pending:!1,supersededVersions:[...e.followUpQueueMutation.supersededVersions,o.version,...r?[]:[n.version]].slice(-16)}}}),!0)}catch(n){return!u(s)||!Q(t().currentSessionRef,a)?!1:xr(n)?(e(e=>{let t=e.followUpQueue?.version,r=t===o.version||t===n.snapshot.version;return{...r?{followUpQueue:n.snapshot}:{},followUpQueueMutation:{pending:!1,errorCode:n.code,errorMessage:n.message,supersededVersions:[...e.followUpQueueMutation.supersededVersions,o.version,...r?[]:[n.snapshot.version]].slice(-16)}}}),!1):(e({followUpQueueMutation:{pending:!1,errorMessage:n instanceof Error?n.message:String(n),supersededVersions:i.followUpQueueMutation.supersededVersions}}),!1)}},dismissSideConversation:()=>{c?.abort(`side-conversation-dismissed`),c=null,e({sideConversation:null})},loadTeams:async n=>{if(I(t().historySurfaceSelection)){e({error:N});return}let r=n??t().currentSessionRef;if(!r||!Ne.getState().agentTeamsEnabled){e({teams:[]});return}let i=Z(r),a=s.get(i);if(a)return a;let o;o=(async()=>{try{let n=await aa(r);if(!Q(t().currentSessionRef,r))return;e({teams:n})}catch{Q(t().currentSessionRef,r)&&e({teams:[]})}finally{s.get(i)===o&&s.delete(i)}})(),s.set(i,o),await o},abortSession:async()=>{if(I(t().historySurfaceSelection))return e({error:N}),!1;let{currentSessionRef:n,isStopping:r}=t();if(!n||r)return!1;e({isStopping:!0,error:null,errorContext:null});try{return await Y.abortSession(n),!Q(t().currentSessionRef,n)||(await t().resyncSessionMessages(n),!Q(t().currentSessionRef,n))?!1:(t().unsubscribeFromEvents(),e({isStreaming:!1,isStopping:!1,agentPhase:`idle`,providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null,currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,pendingSubagentCompletions:{},currentAssistantMessageId:null,hasToolCalls:!1}),!0)}catch(r){return Q(t().currentSessionRef,n)&&e({isStopping:!1,error:r instanceof Error?r.message:`Failed to stop task`,errorContext:{kind:`task_action`,sessionRef:n}}),!1}},pauseGoal:async()=>{if(I(t().historySurfaceSelection)){e({error:N});return}let{currentSessionRef:n,isTemporarySession:r}=t();if(!n||r){e({error:`No persisted session is available for this goal`});return}try{let r=await Y.updateGoal(n,{action:`pause`});if(!Q(t().currentSessionRef,n))return;e({goal:r.goal,error:null})}catch(r){if(!Q(t().currentSessionRef,n))return;e({error:r.message})}},resumeGoal:async()=>{if(I(t().historySurfaceSelection)){e({error:N});return}let{currentSessionRef:n,isTemporarySession:r}=t();if(!n||r){e({error:`No persisted session is available for this goal`});return}try{let r=await Y.updateGoal(n,{action:`resume`});if(!Q(t().currentSessionRef,n))return;e({goal:r.goal,error:null,...r.runId?{currentRunId:r.runId,isStreaming:!0,agentPhase:`running`}:{}})}catch(r){if(!Q(t().currentSessionRef,n))return;e({error:r.message})}},editGoal:async n=>{if(I(t().historySurfaceSelection)){e({error:N});return}let{currentSessionRef:r,isTemporarySession:i}=t();if(!r||i){e({error:`No persisted session is available for this goal`});return}try{let i=await Y.updateGoal(r,{action:`edit`,objective:n});if(!Q(t().currentSessionRef,r))return;e({goal:i.goal,error:null,...i.runId?{currentRunId:i.runId,isStreaming:!0,agentPhase:`running`}:{}})}catch(n){if(!Q(t().currentSessionRef,r))return;e({error:n.message})}},clearGoal:async()=>{if(I(t().historySurfaceSelection)){e({error:N});return}let{currentSessionRef:n,isTemporarySession:r}=t();if(!n||r){e({error:`No persisted session is available for this goal`});return}try{if(await Y.clearGoal(n),!Q(t().currentSessionRef,n))return;e({goal:null,error:null})}catch(r){if(!Q(t().currentSessionRef,n))return;e({error:r.message})}}}},sa=(e,t)=>{let n=new WeakMap,r=null;return{isStreaming:!1,isStopping:!1,agentPhase:`idle`,providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null,sessionEventConnectionState:`idle`,currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,pendingSubagentCompletions:{},eventUnsubscribe:null,currentAssistantMessageId:null,hasToolCalls:!1,setStreaming:t=>e({isStreaming:t}),setAgentPhase:t=>e({agentPhase:t}),setRunId:t=>e({currentRunId:t}),prepareEventSubscription:async(i,a,o)=>{if(I(t().historySurfaceSelection))throw e({error:N}),Error(N);let s=a??he(t,e),c=null,l=`connecting`;if(c=await Y.openEventSubscription(i,s,{...o,onConnectionStateChange:t=>{l=t,c&&r===c&&e({sessionEventConnectionState:t})}}),I(t().historySurfaceSelection))throw c(),e({error:N}),Error(N);return n.set(c,l),c},replaceEventSubscription:i=>{let a=t().eventUnsubscribe;if(r=i,e({eventUnsubscribe:i,sessionEventConnectionState:i?n.get(i)??`connected`:`idle`}),le.reset(),a&&a!==i)try{a()}catch(e){console.warn(`Failed to clean up previous event subscription`,e)}},setCurrentAssistantMessageId:t=>e({currentAssistantMessageId:t}),setHasToolCalls:t=>e({hasToolCalls:t}),startAgentResponse:t=>{e({currentAssistantMessageId:t,hasToolCalls:!1,isStreaming:!0,agentPhase:`running`,providerAdmission:null,providerCircuit:null,providerRetry:null,providerStall:null,providerRecovery:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null})},endAgentResponse:()=>{le.drainAll(),e({currentAssistantMessageId:null,hasToolCalls:!1,isStreaming:!1,isStopping:!1,agentPhase:`idle`,providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null})},subscribeToEvents:async n=>{if(I(t().historySurfaceSelection))throw e({error:N}),Error(N);let r=await t().prepareEventSubscription(n);if(I(t().historySurfaceSelection))throw r(),e({error:N}),Error(N);t().replaceEventSubscription(r)},reconnectSessionEvents:async()=>{if(I(t().historySurfaceSelection)){e({error:N});return}let n=t().currentSessionRef;if(n){t().unsubscribeFromEvents(),e({sessionEventConnectionState:`connecting`});try{await t().subscribeToEvents(n)}catch(t){throw e({sessionEventConnectionState:`offline`}),t}}},unsubscribeFromEvents:()=>{let{eventUnsubscribe:n}=t();r=null,e({eventUnsubscribe:null,sessionEventConnectionState:`idle`});try{n?.()}catch(e){console.warn(`Failed to clean up event subscription`,e)}finally{le.reset()}},handleEvent:n=>{he(t,e)(n)}}};function ca(e){return e.taskPromptSummary?.trimStart().startsWith(`/review`)===!0}function la(e,t){let n=e.taskStatusReason?.trim();if(ca(e)){if(e.taskStatus===`running`)return t(`taskHome.review.running`);if(n?.startsWith(`Code review stale:`))return t(`taskHome.review.stale`);if(n===`Code review aborted`)return t(`taskHome.review.aborted`);if(n===`Code review interrupted by process restart`)return t(`taskHome.review.interrupted`);if(e.taskStatus===`failed`)return t(`taskHome.review.failed`)}return e.taskFailure?t(ne(e.taskFailure.code)):n===`user-cancel`?t(`session.reason.cancelledByUser`):n||void 0}var ua=0;function da(e,t){let n=e.findIndex(e=>e.id===t.id);if(n===-1)return[...e,t];let r=e.slice();return r[n]=t,r}var fa=y(e=>({schedules:[],isLoading:!1,hasLoaded:!1,error:null,loadSchedules:async()=>{let t=++ua;e({isLoading:!0,error:null});try{let n=await Y.listSchedules();if(t!==ua)return;e({schedules:n,isLoading:!1,hasLoaded:!0})}catch(n){if(t!==ua)return;e({error:n instanceof Error?n.message:V(`schedule.error.loadFailed`),isLoading:!1,hasLoaded:!0})}},createSchedule:async t=>{e({error:null});try{let n=await Y.createSchedule(t);return e(e=>({schedules:da(e.schedules,n)})),n}catch(t){throw e({error:t instanceof Error?t.message:V(`schedule.error.createFailed`)}),t}},updateSchedule:async(t,n)=>{e({error:null});try{let r=await Y.updateSchedule(t,n);return e(e=>({schedules:da(e.schedules,r)})),r}catch(t){throw e({error:t instanceof Error?t.message:V(`schedule.error.updateFailed`)}),t}},deleteSchedule:async t=>{e({error:null});try{await Y.deleteSchedule(t),e(e=>({schedules:e.schedules.filter(e=>e.id!==t)}))}catch(t){throw e({error:t instanceof Error?t.message:V(`schedule.error.deleteFailed`)}),t}},toggleSchedule:async(t,n)=>{e({error:null});try{let r=n?await Y.enableSchedule(t):await Y.disableSchedule(t);return e(e=>({schedules:da(e.schedules,r)})),r}catch(t){throw e({error:t instanceof Error?t.message:V(`schedule.error.toggleFailed`)}),t}},runSchedule:async t=>{e({error:null});try{let n=await Y.runSchedule(t);return e(e=>({schedules:da(e.schedules,n)})),n}catch(t){throw e({error:t instanceof Error?t.message:V(`schedule.error.runFailed`)}),t}}})),pa=`blade.projects.selected`;function ma(){return typeof localStorage>`u`?null:localStorage.getItem(pa)}function ha(e){typeof localStorage<`u`&&localStorage.setItem(pa,e)}var ga=new Set([`queued`,`running`,`completed`,`failed`,`cancelled`,`interrupted`]),_a=new Set([`default`,`autoEdit`,`yolo`,`plan`]),va=new Set([`auto`,`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`]),ya=new Set([`auto`,`standard`,`fast`,`flex`]),ba=new Set([`auto`,`low`,`medium`,`high`]),xa=new Set([`auto`,`pragmatic`,`friendly`,`explanatory`]),Sa=new Set([`high`,`medium`,`low`]),Ca=new Set([`feature`,`bug`,`maintenance`,`research`]);function wa(e){return typeof e==`string`&&ga.has(e)}function Ta(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;if(![`changedFiles`,`additions`,`deletions`,`commits`].some(e=>typeof t[e]!=`number`||!Number.isInteger(t[e])||t[e]<0))return{changedFiles:t.changedFiles,additions:t.additions,deletions:t.deletions,commits:t.commits}}function Ea(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=de(t.code);if(n&&typeof t.message==`string`&&typeof t.retryable==`boolean`)return{code:n,message:V(ne(n)),retryable:me(n)}}function Da(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;if([`applied`,`discarded`,`conflicted`].includes(String(t.status))&&typeof t.updatedAt==`string`)return{status:t.status,updatedAt:t.updatedAt,...typeof t.sourceCommit==`string`?{sourceCommit:t.sourceCommit}:{},...typeof t.changedFiles==`number`&&Number.isInteger(t.changedFiles)&&t.changedFiles>=0?{changedFiles:t.changedFiles}:{},...typeof t.message==`string`?{message:t.message}:{}}}function Oa(e,t){return typeof e==`number`&&Number.isInteger(e)&&e>=t?e:void 0}function ka(e,t){return{...e,taskStatus:t.taskStatus,taskStatusReason:t.taskStatusReason,taskFailure:t.taskStatus===`failed`?t.taskFailure??e.taskFailure:void 0,taskPromptSummary:t.taskPromptSummary??e.taskPromptSummary,taskStartedAt:t.taskStartedAt??(t.taskStatus===`queued`?void 0:e.taskStartedAt),taskCompletedAt:t.taskCompletedAt??(t.taskStatus===`queued`||t.taskStatus===`running`?void 0:e.taskCompletedAt),taskDiffStat:t.taskDiffStat??e.taskDiffStat,taskQueuePosition:t.taskStatus===`queued`?t.taskQueuePosition??e.taskQueuePosition:void 0,taskQueueDepth:t.taskStatus===`queued`?t.taskQueueDepth??e.taskQueueDepth:void 0,taskConcurrencyLimit:t.taskConcurrencyLimit??e.taskConcurrencyLimit,lastMessageTime:t.updatedAt??e.lastMessageTime}}function Aa(e,t,n,r){return{...e,[t]:{revision:n,kind:`upsert`,session:r}}}function ja(e){return e??{version:1,entries:[]}}var Ma=(e,t)=>{let n=null,r=!1,i=!1,a=0,o=new Map,s=n=>{let r=Z(n),i=++a,s=t().catalogOverlayRevision??0;o.set(r,i),Y.getSession(n).then(t=>{o.get(r)===i&&e(e=>{let n=e.sessionCatalogOverlays?.[r];if(n&&n.revision>s)return{};let i=(e.catalogOverlayRevision??0)+1;return{sessions:Lr(e.sessions,t),catalogOverlayRevision:i,sessionCatalogOverlays:Aa(e.sessionCatalogOverlays??{},r,i,t)}})}).catch(()=>{o.get(r)===i&&t().loadSessions()}).finally(()=>{o.get(r)===i&&o.delete(r)})},c=t=>{let n=Z(t);e(e=>{let t=(e.catalogOverlayRevision??0)+1;return{catalogOverlayRevision:t,sessionCatalogOverlays:{...e.sessionCatalogOverlays,[n]:{revision:t,kind:`remove`}}}})},l=e=>{let t=Z(e),n=++a;o.set(t,n),queueMicrotask(()=>{o.get(t)===n&&o.delete(t)})};return{taskEventsConnected:!1,taskEventConnectionState:`connecting`,taskEventUnsubscribe:null,taskWorkspaceInfo:null,isTaskWorkspaceLoading:!1,taskWorkspaceError:null,boundProjects:[],selectedProjectPath:ma(),isDispatchingTask:!1,isUpdatingTaskAdmission:!1,isBindingProject:!1,cancellingTaskKeys:[],retryingTaskKeys:[],updatingTaskKeys:[],taskDeliveryActions:{},unreadTaskKeys:qi(),taskTerminalReadLedger:Hi(),catalogOverlayRevision:0,sessionCatalogOverlays:{},handleTaskEvent:n=>{if(n.type===`session.created`){let e=n.properties.sessionId,r=n.properties.projectPath;if(typeof e!=`string`||typeof r!=`string`)return;s({sessionId:e,projectPath:r}),t().loadSurfaceCatalog();return}if(n.type===`session.deleted`){let e=n.properties.sessionId,r=n.properties.projectPath;if(typeof e!=`string`||typeof r!=`string`)return;let i={sessionId:e,projectPath:r};l(i),t().removeSession(i),c(i);return}if(n.type===`session.archived`){let e=n.properties.sessionId,r=n.properties.projectPath;if(typeof e!=`string`||typeof r!=`string`)return;let i={sessionId:e,projectPath:r};l(i),t().removeSession(i),c(i),t().loadArchivedSessions();return}if(n.type===`session.unarchived`){let e=n.properties.sessionId,r=n.properties.projectPath;if(typeof e!=`string`||typeof r!=`string`)return;s({sessionId:e,projectPath:r}),t().loadSurfaceCatalog(),t().loadArchivedSessions();return}if(n.type===`session.updated`){let r=n.properties.sessionId,i=n.properties.projectPath,a=n.properties.title,o=n.properties.selectedModelId,c=n.properties.permissionMode,l=n.properties.reasoningEffort,u=n.properties.serviceTier,d=n.properties.responseVerbosity,f=n.properties.communicationStyle,p=n.properties.taskPriority,m=n.properties.taskKind,h=n.properties.taskDueAt;if(typeof r!=`string`||typeof i!=`string`||!(typeof a==`string`&&a.trim()||typeof o==`string`&&o.trim()||_a.has(c)||va.has(l)||ya.has(u)||ba.has(d)||xa.has(f)||Sa.has(p)||Ca.has(m)||h===null||typeof h==`string`&&Number.isFinite(Date.parse(h))))return;let g={sessionId:r,projectPath:i};if(Q(t().currentSessionRef,g)&&_a.has(c)&&Ti.getState().setMode(c),!t().sessions.some(e=>Q(X(e),g))){s(g);return}e(e=>{let t=e.sessions.find(e=>Q(X(e),g));if(!t)return{};let n={...t,...typeof a==`string`&&a.trim()?{title:a}:{},...typeof o==`string`&&o.trim()?{selectedModelId:o}:{},..._a.has(c)?{permissionMode:c}:{},...va.has(l)?{reasoningEffort:l}:{},...ya.has(u)?{serviceTier:u}:{},...ba.has(d)?{responseVerbosity:d}:{},...xa.has(f)?{communicationStyle:f}:{},...Sa.has(p)?{taskPriority:p}:{},...Ca.has(m)?{taskKind:m}:{},...h===null?{taskDueAt:void 0}:typeof h==`string`&&Number.isFinite(Date.parse(h))?{taskDueAt:h}:{}},r=(e.catalogOverlayRevision??0)+1;return{sessions:Lr(e.sessions,n),catalogOverlayRevision:r,sessionCatalogOverlays:Aa(e.sessionCatalogOverlays??{},Z(g),r,n)}});return}if(n.type===`task.delivery`){let t=n.properties.sessionId,r=n.properties.projectPath,i=Da(n.properties.taskDelivery);if(typeof t!=`string`||typeof r!=`string`||!i)return;let a={sessionId:t,projectPath:r},o=n.properties.taskWorktreeRemoved===!0;e(e=>({sessions:e.sessions.map(e=>Q(X(e),a)?{...e,taskDelivery:i,...o?{taskWorktreePath:void 0,taskWorktreeBranch:void 0}:{},lastMessageTime:typeof n.properties.updatedAt==`string`?n.properties.updatedAt:e.lastMessageTime}:e)}));return}if(n.type===`interaction.pending`){let r=n.properties.sessionId,i=n.properties.projectPath,a=n.properties.interactionType,o=n.properties.requestId;if(typeof r!=`string`||typeof i!=`string`||a!==`permission`&&a!==`question`&&a!==`elicitation`||typeof o!=`string`||!o)return;let s={sessionId:r,projectPath:i},c=t().sessions.find(e=>Q(X(e),s));if(!c){t().loadSessions();return}if(e(e=>({sessions:e.sessions.map(e=>Q(X(e),s)?{...e,pendingInteraction:{type:a,requestId:o}}:e)})),!(typeof document<`u`&&document.visibilityState===`visible`&&Q(t().currentSessionRef,s))&&Ne.getState().notifyErrors){let e=c.title??c.sessionId??r;Yi({ref:s,title:`Blade · ${V(a===`question`?`attention.notification.question`:a===`elicitation`?`attention.notification.elicitation`:`attention.notification.permission`)}`,body:e,onOpen:e=>{typeof window<`u`&&(window.focus(),window.dispatchEvent(new CustomEvent(Mi,{detail:e})))}})}return}if(n.type===`interaction.resolved`){let t=n.properties.sessionId,r=n.properties.projectPath,i=n.properties.requestId;if(typeof t!=`string`||typeof r!=`string`||typeof i!=`string`)return;let a={sessionId:t,projectPath:r};e(e=>({sessions:e.sessions.map(e=>Q(X(e),a)&&e.pendingInteraction?.requestId===i?{...e,pendingInteraction:void 0}:e)}));return}if(n.type===`schedule.fired`){fa.getState().loadSchedules();return}if(n.type!==`task.status`)return;let r=n.properties.sessionId,i=n.properties.projectPath,a=n.properties.taskStatus;if(typeof r!=`string`||typeof i!=`string`||!wa(a))return;let o={sessionId:r,projectPath:i},u=Oa(n.properties.taskInFlight,0),d=Oa(n.properties.taskQueueDepth,0),f=Oa(n.properties.taskConcurrencyLimit,1),p=typeof n.properties.taskAdmissionPaused==`boolean`?n.properties.taskAdmissionPaused:void 0;u!==void 0&&d!==void 0&&f!==void 0&&e(e=>({taskWorkspaceInfo:e.taskWorkspaceInfo?{...e.taskWorkspaceInfo,taskAdmission:{inFlight:u,queued:d,maxConcurrent:f,maxQueued:e.taskWorkspaceInfo.taskAdmission?.maxQueued??100,paused:p??e.taskWorkspaceInfo.taskAdmission?.paused??!1}}:null}));let m=Z(o),h=Ea(n.properties.taskFailure),g=!1,_=null,v=null,y=!1;e(e=>{let t=e.sessions.find(e=>Q(X(e),o));if(!t)return y=!0,v=Wi(ja(e.taskTerminalReadLedger),o,{taskStatus:a,taskCompletedAt:typeof n.properties.taskCompletedAt==`string`?n.properties.taskCompletedAt:void 0,taskFailure:h}),{taskTerminalReadLedger:v};let r=(e.catalogOverlayRevision??0)+1,i=ka(t,{revision:r,taskStatus:a,taskStatusReason:typeof n.properties.taskStatusReason==`string`?n.properties.taskStatusReason:void 0,taskFailure:h,taskPromptSummary:typeof n.properties.taskPromptSummary==`string`?n.properties.taskPromptSummary:void 0,taskStartedAt:typeof n.properties.taskStartedAt==`string`?n.properties.taskStartedAt:void 0,taskCompletedAt:typeof n.properties.taskCompletedAt==`string`?n.properties.taskCompletedAt:void 0,taskDiffStat:Ta(n.properties.taskDiffStat),taskQueuePosition:Oa(n.properties.taskQueuePosition,1),taskQueueDepth:Oa(n.properties.taskQueueDepth,0),taskConcurrencyLimit:f,updatedAt:typeof n.properties.updatedAt==`string`?n.properties.updatedAt:void 0}),s=typeof document<`u`&&document.visibilityState===`visible`&&Q(e.currentSessionRef,o),c=Ii(t),l=Ii(i),u=ja(e.taskTerminalReadLedger),d=u.entries.find(e=>e.key===m),p=u,b=e.unreadTaskKeys;return s||l===null?(p=Wi(p,o,i),s&&(b=b.filter(e=>e!==m))):d?d.signature!==l&&(b.includes(m)||(b=[...b,m],c!==l&&(g=!0))):c===null?(p=Wi(p,o,t),b.includes(m)||(b=[...b,m],g=!0)):p=Wi(p,o,i),v=p,_=b,{sessions:Lr(e.sessions,i),unreadTaskKeys:b,taskTerminalReadLedger:p,catalogOverlayRevision:r,sessionCatalogOverlays:Aa(e.sessionCatalogOverlays??{},m,r,i)}}),v&&Ui(v),_&&Ji(_);let b=g?t().sessions.find(e=>Q(X(e),o)):void 0;if(b&&Ni(a)){let e=Ne.getState();if(e.notifySounds&&Xi(a),a===`completed`?e.notifyBuild:e.notifyErrors){let e=V(a===`completed`?`attention.notification.completed`:a===`failed`?`attention.notification.failed`:`attention.notification.interrupted`),t=la(b,V),n=b.title??r;Yi({ref:o,title:`Blade · ${e}`,body:t?`${n} · ${t}`:n,onOpen:e=>{typeof window<`u`&&(window.focus(),window.dispatchEvent(new CustomEvent(Mi,{detail:e})))}})}}y&&(s(o),t().loadSurfaceCatalog())},subscribeToTaskEvents:async()=>{if(r=!0,!t().taskEventUnsubscribe){if(n)return n;i=!0,e({taskEventsConnected:!1,taskEventConnectionState:`connecting`}),n=(async()=>{try{let n=await Y.openTaskEventSubscription(e=>t().handleTaskEvent(e),{onConnectionChange:t=>{r&&e({taskEventsConnected:t})},onConnectionStateChange:n=>{r&&((n===`reconnecting`||n===`offline`)&&(i=!0),e({taskEventsConnected:n===`connected`,taskEventConnectionState:n}),n===`connected`&&i&&(i=!1,Promise.all([t().loadSessions(),t().loadSurfaceCatalog(),t().loadTaskWorkspaceInfo(),t().loadBoundProjects(),Ti.getState().loadModels()])))}});if(!r||t().taskEventUnsubscribe){n();return}e({taskEventUnsubscribe:n})}catch(t){throw i=!0,e({taskEventsConnected:!1,taskEventConnectionState:`offline`}),t}})();try{await n}finally{n=null}}},reconnectTaskEvents:async()=>{i=!0,t().unsubscribeFromTaskEvents(),await t().subscribeToTaskEvents()},unsubscribeFromTaskEvents:()=>{r=!1,t().taskEventUnsubscribe?.(),e({taskEventUnsubscribe:null,taskEventsConnected:!1,taskEventConnectionState:`offline`})},loadTaskWorkspaceInfo:async()=>{e({isTaskWorkspaceLoading:!0,taskWorkspaceError:null});try{e({taskWorkspaceInfo:await Y.getWorkspaceInfo(),isTaskWorkspaceLoading:!1})}catch(t){e({isTaskWorkspaceLoading:!1,taskWorkspaceError:t instanceof Error?t.message:`Failed to load task workspace`})}},loadBoundProjects:async()=>{try{let t=await Y.listProjects(),n=ma(),r=t.find(e=>e.available&&e.path===n)??t.find(e=>e.isCurrent)??t.find(e=>e.available);r&&ha(r.path),e({boundProjects:t,selectedProjectPath:r?.path??null})}catch(t){e({error:t instanceof Error?t.message:`Failed to load projects`})}},bindProject:async n=>{if(I(t().historySurfaceSelection)){e({error:N});return}e({isBindingProject:!0,error:null});try{let t=await Y.bindProject(n);ha(t.path),e(e=>({boundProjects:[...e.boundProjects.filter(e=>e.path!==t.path),t].sort((e,t)=>e.isCurrent===t.isCurrent?e.name.localeCompare(t.name):e.isCurrent?-1:1),selectedProjectPath:t.path,isBindingProject:!1}))}catch(t){throw e({isBindingProject:!1,error:t instanceof Error?t.message:`Failed to bind project`}),t}},unbindProject:async n=>{if(I(t().historySurfaceSelection)){e({error:N});return}try{await Y.unbindProject(n),e(e=>{let t=e.boundProjects.filter(e=>e.path!==n||e.isCurrent),r=e.selectedProjectPath===n?t.find(e=>e.isCurrent)??t.find(e=>e.available):void 0;return r&&ha(r.path),{boundProjects:t,...r?{selectedProjectPath:r.path}:{}}})}catch(t){throw e({error:t instanceof Error?t.message:`Failed to unbind project`}),t}},selectProject:t=>{ha(t),e({selectedProjectPath:t})},markTaskRead:n=>{let r=Z(n),i=ja(t().taskTerminalReadLedger),a=t().unreadTaskKeys;e(e=>{let t=e.sessions.find(e=>Q(X(e),n));return i=t?Wi(ja(e.taskTerminalReadLedger),n,t):ja(e.taskTerminalReadLedger),a=e.unreadTaskKeys.filter(e=>e!==r),{taskTerminalReadLedger:i,unreadTaskKeys:a}}),Ui(i),Ji(a)},clearUnreadTasks:()=>{if(t().catalogLoadState!==`ready`)return;let n=ja(t().taskTerminalReadLedger);e(e=>{let t=new Map(e.sessions.map(e=>[Z(X(e)),e])),r=new Set(e.unreadTaskKeys),i={version:1,entries:ja(e.taskTerminalReadLedger).entries.filter(e=>!r.has(e.key)||t.has(e.key))};for(let n of e.unreadTaskKeys){let e=t.get(n);e&&(i=Wi(i,X(e),e))}return n=i,{unreadTaskKeys:[],taskTerminalReadLedger:i}}),Ui(n),Ji([])},setTaskAdmissionPaused:async n=>{if(I(t().historySurfaceSelection)){e({error:N});return}if(!t().isUpdatingTaskAdmission){e({isUpdatingTaskAdmission:!0,error:null,errorContext:null});try{let t=await Y.setTaskAdmissionPaused(n);e(e=>({taskWorkspaceInfo:e.taskWorkspaceInfo?{...e.taskWorkspaceInfo,taskAdmission:t}:e.taskWorkspaceInfo}))}catch(t){throw e({error:t instanceof Error?t.message:`Failed to update task admission`,errorContext:{kind:`task_action`}}),t}finally{e({isUpdatingTaskAdmission:!1})}}},updateTask:async(n,r)=>{if(I(t().historySurfaceSelection)){e({error:N});return}let i=Z(n);if(!t().updatingTaskKeys.includes(i)){e(e=>({updatingTaskKeys:[...e.updatingTaskKeys,i],error:null,errorContext:null}));try{let t=await Y.updateTask(n,r);e(e=>({sessions:Lr(e.sessions,t)}))}catch(t){throw e({error:t instanceof Error?t.message:`Failed to update task`,errorContext:{kind:`task_action`,sessionRef:n}}),t}finally{e(e=>({updatingTaskKeys:e.updatingTaskKeys.filter(e=>e!==i)}))}}},cancelTask:async n=>{if(I(t().historySurfaceSelection)){e({error:N});return}let r=Z(n);if(!t().cancellingTaskKeys.includes(r)){e(e=>({cancellingTaskKeys:[...e.cancellingTaskKeys,r],error:null,errorContext:null}));try{await Y.abortSession(n);let r=Q(t().currentSessionRef,n);r&&(await t().resyncSessionMessages(n),Q(t().currentSessionRef,n)&&t().unsubscribeFromEvents()),e(e=>({sessions:e.sessions.map(e=>Q(X(e),n)?{...e,taskStatus:`cancelled`,taskQueuePosition:void 0,taskQueueDepth:void 0,taskCompletedAt:e.taskCompletedAt??new Date().toISOString()}:e),...r?{isStreaming:!1,isStopping:!1,agentPhase:`idle`,providerAdmission:null,providerCircuit:null,providerRetry:null,pendingResume:null,providerStall:null,providerRecovery:null,turnActivity:null,memoryConsolidation:null,actionStationarity:null,turnRecovery:null,currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1,eventUnsubscribe:null}:{}}))}catch(t){throw e({error:t instanceof Error?t.message:`Failed to stop task`,errorContext:{kind:`task_action`,sessionRef:n}}),t}finally{e(e=>({cancellingTaskKeys:e.cancellingTaskKeys.filter(e=>e!==r)}))}}},retryTask:async n=>{if(I(t().historySurfaceSelection)){e({error:N});return}let r=Z(n);if(t().retryingTaskKeys.includes(r))return;let i=t().getNavigationVersion(),a=t().selectedProjectPath,o=()=>t().getNavigationVersion()===i&&t().selectedProjectPath===a&&!I(t().historySurfaceSelection);e(e=>({retryingTaskKeys:[...e.retryingTaskKeys,r],error:null,errorContext:null}));try{let r=await Y.retryTask(n);e(e=>({sessions:Lr(e.sessions,r.session)})),t().loadSurfaceCatalog(),t().markTaskRead(n),o()&&await t().selectSession(X(r.session))}catch(t){throw o()&&e({error:t instanceof Error?t.message:`Failed to retry task`,errorContext:{kind:`task_action`,sessionRef:n}}),t}finally{e(e=>({retryingTaskKeys:e.retryingTaskKeys.filter(e=>e!==r)}))}},deliverTask:async(n,r)=>{if(I(t().historySurfaceSelection)){e({error:N});return}let i=Z(n);if(!t().taskDeliveryActions[i]){e(e=>({taskDeliveryActions:{...e.taskDeliveryActions,[i]:r},error:null,errorContext:null}));try{let i=await Y.deliverTask(n,r);e(e=>({sessions:Lr(e.sessions,i)})),t().markTaskRead(n)}catch(t){throw e({error:t instanceof Error?t.message:`Failed to deliver task changes`,errorContext:{kind:`task_action`,sessionRef:n}}),t}finally{e(e=>{let{[i]:t,...n}=e.taskDeliveryActions;return{taskDeliveryActions:n}})}}},dispatchTask:async(n,r)=>{if(I(t().historySurfaceSelection)){e({error:N});return}let i=t().getNavigationVersion(),a=t().selectedProjectPath,o=n.projectPath??a??void 0,s=()=>t().getNavigationVersion()===i&&t().selectedProjectPath===a&&!I(t().historySurfaceSelection);e({isDispatchingTask:!0,error:null,errorContext:null});try{let i=await Y.createTask({...n,projectPath:o});e(e=>({sessions:Lr(e.sessions,i.session),isDispatchingTask:!1})),t().loadSurfaceCatalog(),r?.selectSession!==!1&&s()&&await t().selectSession(X(i.session))}catch(t){throw e({isDispatchingTask:!1,...s()?{error:t instanceof Error?t.message:`Failed to dispatch task`}:{}}),t}},startCodeReview:async n=>{if(I(t().historySurfaceSelection)){e({error:N});return}let r=t().getNavigationVersion(),i=t().selectedProjectPath,a=n.projectPath??i??void 0,o=()=>t().getNavigationVersion()===r&&t().selectedProjectPath===i&&!I(t().historySurfaceSelection);e({isDispatchingTask:!0,error:null,errorContext:null});let s,c=!1;try{s=await Y.createSession(a,`Code Review`);let r=X(s);if(I(t().historySurfaceSelection)){await Y.deleteSession(r).catch(()=>void 0),e({isDispatchingTask:!1});return}await Y.startCodeReview(r,{kind:n.kind,...n.ref?{ref:n.ref}:{},...n.instructions?{instructions:n.instructions}:{},...n.modelId?{modelId:n.modelId}:{}}),c=!0;let i={...s,taskStatus:`running`,taskStatusReason:V(`taskHome.review.running`),taskPromptSummary:`/review ${n.kind}${n.ref?` ${n.ref}`:``}`};e(e=>({sessions:Lr(e.sessions,i),isDispatchingTask:!1})),t().loadSurfaceCatalog(),o()&&await t().selectSession(r)}catch(t){throw s&&!c&&await Y.deleteSession(X(s)).catch(()=>void 0),e({isDispatchingTask:!1,...o()?{error:t instanceof Error?t.message:V(`taskHome.review.startFailed`)}:{}}),t}}}},Na=e=>({tokenUsage:Di,updateTokenUsage:t=>e(e=>{let{costUsd:n,scope:r,...i}=t;return{tokenUsage:{...e.tokenUsage,...r===`auxiliary`?{}:i,totalInputTokens:e.tokenUsage.totalInputTokens+Math.max(0,t.inputTokens??0),totalOutputTokens:e.tokenUsage.totalOutputTokens+Math.max(0,t.outputTokens??0),cacheReadTokens:e.tokenUsage.cacheReadTokens+Math.max(0,t.cacheReadTokens??0),cacheWriteTokens:e.tokenUsage.cacheWriteTokens+Math.max(0,t.cacheWriteTokens??0),estimatedCostUsd:e.tokenUsage.estimatedCostUsd+Math.max(0,n??0)}}}),resetContextUsage:()=>e(e=>({tokenUsage:{...e.tokenUsage,inputTokens:0,outputTokens:0,totalTokens:0}})),setMaxContextTokens:(t,n=!1)=>e(e=>({tokenUsage:{...e.tokenUsage,maxContextTokens:t,isDefaultMaxTokens:n}}))}),$=y()((...e)=>({...oa(...e),...ti(...e),...Ma(...e),...ni(...e),...sa(...e),...Na(...e)}));function Pa(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleString([],{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Fa({open:e,onOpenChange:t}){let n=Me(),r=$(e=>e.currentSessionRef),i=$(e=>I(e.historySurfaceSelection)),a=$(e=>e.isStreaming),o=$(e=>e.isTemporarySession),s=$(e=>e.rewindSession),[c,l]=(0,H.useState)([]),[u,d]=(0,H.useState)(null),[f,p]=(0,H.useState)(!1),[m,h]=(0,H.useState)(!1),[g,_]=(0,H.useState)(!1),[v,y]=(0,H.useState)(null);(0,H.useEffect)(()=>{if(i||!e||!r)return;let t=!1;return h(!0),y(null),l([]),d(null),p(!1),Y.listRewindCheckpoints(r).then(e=>{t||(l(e),d(e[0]?.messageId??null))}).catch(e=>{t||y(e instanceof Error?e.message:n(`chat.rewind.loadFailed`))}).finally(()=>{t||h(!1)}),()=>{t=!0}},[r,i,e]);let b=(0,H.useMemo)(()=>c.find(e=>e.messageId===u)??null,[c,u]),x=!!b&&!i&&!m&&!g&&!a&&!o,S=async()=>{if(re($.getState())||!b||!x)return;_(!0),y(null);let e=await s(b.messageId,f?`both`:`conversation`);_(!1),e?t(!1):y(n(`chat.rewind.failed`))};return(0,K.jsx)(cr,{open:e,onOpenChange:t,children:(0,K.jsxs)(dr,{className:`max-w-[620px] gap-0 overflow-hidden border-[#E5E7EB] bg-white p-0 dark:border-zinc-800 dark:bg-[#09090b]`,children:[(0,K.jsx)(fr,{className:`border-b border-[#E5E7EB] px-6 py-5 dark:border-zinc-800`,children:(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-md bg-[#F3F4F6] text-[#4B5563] dark:bg-zinc-800 dark:text-zinc-300`,children:(0,K.jsx)(Pt,{className:`h-4 w-4`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(mr,{className:`text-[15px] font-semibold text-[#111827] dark:text-zinc-100`,children:n(`chat.rewind.title`)}),(0,K.jsx)(hr,{className:`mt-1 text-[12px] text-[#6B7280] dark:text-zinc-400`,children:n(`chat.rewind.description`)})]})]})}),(0,K.jsxs)(`div`,{className:`min-h-[260px] px-6 py-4`,children:[m&&(0,K.jsxs)(`div`,{className:`flex h-[220px] items-center justify-center text-[#6B7280] dark:text-zinc-400`,children:[(0,K.jsx)(bt,{className:`mr-2 h-4 w-4 animate-spin`}),(0,K.jsx)(`span`,{className:`text-xs font-mono`,children:n(`chat.rewind.loading`)})]}),!m&&v&&(0,K.jsx)(`div`,{role:`alert`,className:`rounded-md border border-rose-200 bg-rose-50 px-4 py-3 text-xs text-rose-700 dark:border-rose-900/60 dark:bg-rose-950/30 dark:text-rose-300`,children:v}),!m&&!v&&c.length===0&&(0,K.jsxs)(`div`,{className:`flex h-[220px] flex-col items-center justify-center text-center`,children:[(0,K.jsx)(Pt,{className:`mb-3 h-5 w-5 text-[#9CA3AF] dark:text-zinc-600`}),(0,K.jsx)(`p`,{className:`text-sm text-[#4B5563] dark:text-zinc-300`,children:n(`chat.rewind.empty`)})]}),!m&&c.length>0&&(0,K.jsx)(`div`,{role:`radiogroup`,"aria-label":n(`chat.rewind.checkpointAria`),className:`max-h-[310px] space-y-1 overflow-y-auto`,children:c.map(e=>{let t=e.messageId===u;return(0,K.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,onClick:()=>d(e.messageId),className:G(`w-full rounded-md border px-4 py-3 text-left transition-colors`,t?`border-[#22C55E] bg-[#F0FDF4] dark:border-[#22C55E] dark:bg-[#052E16]/50`:`border-transparent hover:bg-[#F9FAFB] dark:hover:bg-zinc-900`),children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,K.jsx)(`p`,{className:`line-clamp-2 text-[13px] leading-5 text-[#111827] dark:text-zinc-100`,children:e.preview||n(`chat.rewind.userMessage`)}),(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] font-mono text-[#9CA3AF] dark:text-zinc-500`,children:Pa(e.createdAt)})]}),(0,K.jsxs)(`div`,{className:`mt-2 flex items-center gap-3 text-[10px] font-mono text-[#6B7280] dark:text-zinc-500`,children:[(0,K.jsx)(`span`,{children:e.messageId.slice(0,10)}),e.fileCount>0&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(et,{className:`h-3 w-3`}),e.fileCount===1?n(`chat.rewind.fileCountOne`,{count:e.fileCount}):n(`chat.rewind.fileCountMany`,{count:e.fileCount})]})]})]},e.messageId)})})]}),(0,K.jsx)(`div`,{className:`border-t border-[#E5E7EB] px-6 py-4 dark:border-zinc-800`,children:(0,K.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:f,disabled:!b||b.fileCount===0,onChange:e=>p(e.target.checked),className:`mt-0.5 h-4 w-4 accent-[#16A34A] disabled:opacity-40`}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`span`,{className:`block text-[12px] font-medium text-[#374151] dark:text-zinc-200`,children:n(`chat.rewind.restoreCode`)}),(0,K.jsx)(`span`,{className:`mt-0.5 block text-[11px] text-[#6B7280] dark:text-zinc-500`,children:n(`chat.rewind.restoreCodeHint`)})]})]})}),(0,K.jsxs)(pr,{className:`border-t border-[#E5E7EB] px-6 py-4 dark:border-zinc-800`,children:[(0,K.jsx)(sr,{variant:`ghost`,onClick:()=>t(!1),disabled:g,children:n(`chat.rewind.cancel`)}),(0,K.jsxs)(sr,{onClick:()=>void S(),disabled:!x,className:`bg-[#16A34A] text-white hover:bg-[#15803D]`,children:[g?(0,K.jsx)(bt,{className:`mr-2 h-4 w-4 animate-spin`}):(0,K.jsx)(It,{className:`mr-2 h-4 w-4`}),n(`chat.rewind.confirm`)]})]})]})})}function Ia({inFlight:e,queued:t,maxConcurrent:n,compact:r=!1,className:i}){let a=Me(),o=Math.max(1,n),s=Array.from({length:Math.min(o,12)}),c=Math.min(e,o);return(0,K.jsxs)(`div`,{className:G(`inline-flex items-center gap-2 font-mono`,r?`text-[10.5px]`:`text-[11px]`,i),title:a(`capacity.title`,{inFlight:e,queued:t,max:n}),children:[(0,K.jsx)(`span`,{className:G(`inline-flex items-center gap-[3px] rounded-sm`,r?`px-0`:`px-0.5`),children:s.map((e,t)=>(0,K.jsx)(`span`,{className:G(`block`,r?`h-2.5 w-[3px] rounded-[1px]`:`h-3 w-[3px] rounded-[1px]`,t<c?`bg-[hsl(var(--deck-accent))] shadow-[0_0_4px_hsl(var(--deck-accent)/0.65)]`:`bg-[hsl(var(--deck-border-strong))]/60`)},t))}),(0,K.jsxs)(`span`,{className:`tabular-nums text-[hsl(var(--deck-ink-muted))]`,children:[(0,K.jsx)(`span`,{className:`text-[hsl(var(--deck-ink))]`,children:e}),(0,K.jsx)(`span`,{className:`mx-[2px] opacity-40`,children:`/`}),(0,K.jsx)(`span`,{children:n}),(0,K.jsx)(`span`,{className:`opacity-60`,children:a(`capacity.suffix.running`)})]}),t>0&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-sm border border-amber-300/60 bg-amber-50 px-1.5 py-[1px] text-[10px] text-amber-800 dark:border-amber-800/60 dark:bg-amber-950/40 dark:text-amber-300`,children:[(0,K.jsx)(`span`,{className:`h-1 w-1 rounded-full bg-amber-500`}),a(`capacity.queued`,{queued:t})]})]})}function La(){let e=document.querySelector(`textarea[data-blade-composer]:not(:disabled)`);if(!e)return!1;e.focus();let t=e.value.length;return e.setSelectionRange(t,t),!0}var Ra=[{id:`searchTasks`,key:`k`,primaryModifier:!0,scope:`Global`},{id:`openCommands`,key:`p`,primaryModifier:!0,shiftKey:!0,scope:`Global`},{id:`newTask`,key:`n`,primaryModifier:!1,scope:`Global`},{id:`focusComposer`,key:`/`,primaryModifier:!1,scope:`Chat`},{id:`toggleSidebar`,key:`b`,primaryModifier:!0,scope:`Layout`}];function za(e){let t=e.key.toLocaleLowerCase();return Ra.find(n=>{if(n.key!==t||e.altKey||e.shiftKey!==!!n.shiftKey)return!1;let r=e.metaKey||e.ctrlKey;return n.primaryModifier?r:!r})??null}function Ba(e){return e instanceof Element&&!!e.closest(`input, textarea, select, [contenteditable="true"], [role="textbox"], [role="combobox"]`)}function Va(e){let t=typeof navigator>`u`?null:navigator,n=e??t?.userAgentData?.platform??t?.platform??``;return/mac|iphone|ipad|ipod/i.test(n)}function Ha(e,t){let n=e.key===`/`?`/`:e.key.toLocaleUpperCase(),r=Va(t);return[...e.primaryModifier?[r?`⌘`:`Ctrl`]:[],...e.shiftKey?[r?`⇧`:`Shift`]:[],n]}function Ua(e,t){let n=Ra.find(t=>t.id===e);return n?Ha(n,t).join(``):``}function Wa(){let e=A(e=>e.setTaskSwitcherOpen),t=A(e=>e.setMainView),n=A(e=>e.toggleSidebar),r=$(e=>e.startTemporarySession);(0,H.useEffect)(()=>{let i=i=>{if(i.repeat)return;let a=za(i);if(!a)return;let o=A.getState(),s=o.isTaskSwitcherOpen,c=Ba(i.target),l=!!document.querySelector(`[role="dialog"]`);if(a.id===`searchTasks`||a.id===`openCommands`){if(l&&!s)return;i.preventDefault();let t=a.id===`searchTasks`?`tasks`:`commands`,n=s&&o.taskSwitcherMode===t;e(!n,t);return}if(!(c||l)){if(a.id===`newTask`){i.preventDefault(),t(`workspace`),r(),requestAnimationFrame(()=>La());return}if(a.id===`focusComposer`){La()&&i.preventDefault();return}a.id===`toggleSidebar`&&(i.preventDefault(),n())}};return window.addEventListener(`keydown`,i),()=>window.removeEventListener(`keydown`,i)},[t,e,r,n])}var Ga=(0,H.lazy)(()=>Pe(()=>import(`./SettingsModal-CFa2uCzI.js`).then(e=>({default:e.SettingsModal})),__vite__mapDeps([3,1,2,4,5,6,7,8,9,10,11,12,13,14]))),Ka=()=>Pe(()=>import(`./TaskSwitcher-C9AKJrl-.js`).then(e=>({default:e.TaskSwitcher})),__vite__mapDeps([15,1,2,4,5,16,17,13,18,19])),qa=(0,H.lazy)(Ka),Ja=()=>Pe(()=>import(`./FilePreview-BQid6G2-.js`),__vite__mapDeps([20,1,2,4,5,21,7,16,22,10])),Ya=(0,H.lazy)(()=>Ja().then(e=>({default:e.FilePreview}))),Xa=(0,H.lazy)(()=>Ja().then(e=>({default:e.PreviewControls}))),Za=(0,H.lazy)(()=>Pe(()=>import(`./TerminalPanel-BxBGcuB9.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([23,1,2,4,5,19,24,25]))),Qa=(0,H.lazy)(()=>Pe(()=>import(`./Sidebar-DrRNJOgU.js`).then(e=>({default:e.Sidebar})),__vite__mapDeps([26,1,2,4,5,27,22,9,11,13,18,19,14]))),$a=e=>{if(e.startsWith(`/Users/`)){let t=e.split(`/`);if(t.length>=3)return`~/`+t.slice(3).join(`/`)}return e},eo=e=>e.replace(/^~\//,`~/§`).split(`/`).filter(Boolean).map((e,t,n)=>t===0&&n[0]?.startsWith(`~`)?`~`:e.replace(/^§/,``));function to({children:e}){let t=Me();Wa();let{isSidebarOpen:n,isFilePreviewOpen:r,isSettingsOpen:i,isTerminalOpen:a,isTaskSwitcherOpen:o,toggleFilePreview:s,toggleTerminal:c,openFilePreview:l,setFilePreviewOpen:u,setTaskSwitcherOpen:d,previewRequestId:f,setSidebarOpen:p,mainView:m}=A();(0,H.useEffect)(()=>{let e=window.setTimeout(()=>{Ka()},1500);return()=>window.clearTimeout(e)},[]);let h=$(e=>e.currentSessionId),g=$(e=>e.currentSessionRef),_=$(e=>e.historySurfaceSelection),v=$(e=>e.sessions),y=$(e=>e.isStreaming),b=$(e=>e.isTemporarySession),x=$(e=>e.taskWorkspaceInfo),S=$(e=>e.boundProjects),C=$(e=>e.selectedProjectPath),[w,T]=(0,H.useState)(null),[ee,E]=(0,H.useState)(!1),[D,te]=(0,H.useState)(),[O,ne]=(0,H.useState)(()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(max-width: 639px)`).matches),[re,ie]=(0,H.useState)(()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(max-width: 1023px)`).matches),ae=(0,H.useRef)(null),k=(0,H.useRef)(null),oe=(0,H.useRef)(null),j=(0,H.useMemo)(()=>v.find(e=>Q({sessionId:e.sessionId,projectPath:e.projectPath},g)),[g,v]),se=j?.taskIsolation===`worktree`&&j.taskSourceProjectPath&&(j.taskDelivery?.status===`applied`||j.taskDelivery?.status===`discarded`)?j.taskSourceProjectPath:g?.projectPath,M=I(_);(0,H.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(max-width: 900px)`),t=()=>{e.matches&&p(!1)};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[p]),(0,H.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(max-width: 639px)`),t=()=>ne(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,H.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(max-width: 1023px)`),t=()=>ie(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,H.useEffect)(()=>{if(!O||!n)return;let e=requestAnimationFrame(()=>{ae.current?.querySelector(`button`)?.focus()});return()=>{cancelAnimationFrame(e),k.current?.focus({preventScroll:!0})}},[O,n]);let N=e=>{if(!O||!n)return;if(e.key===`Escape`){e.preventDefault(),p(!1);return}if(e.key!==`Tab`)return;let t=Array.from(ae.current?.querySelectorAll(`button:not([disabled]), input:not([disabled]), select:not([disabled]), [href], [tabindex]:not([tabindex="-1"])`)??[]);if(t.length===0)return;let r=t[0],i=t[t.length-1];e.shiftKey&&document.activeElement===r?(e.preventDefault(),i?.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r?.focus())},P=(0,H.useMemo)(()=>M?null:m===`board`||!h||b?C?$a(C):null:j?.projectPath?$a(j.taskSourceProjectPath||j.projectPath):null,[h,j,M,b,m,C]),ce=(0,H.useMemo)(()=>P?eo(P):[],[P]);(0,H.useEffect)(()=>{if(M){T(null);return}if(!g){T(S.find(e=>e.path===C)?.gitBranch??null);return}(async()=>{try{let e=await Y.getGitInfo({sessionId:g.sessionId,projectPath:se??g.projectPath});T(e.branch)}catch{T(null)}})()},[S,g,se,M,C]);let le=x?.taskAdmission,ue=m===`board`?C??x?.cwd??null:se??C??x?.cwd??null,de=g&&m===`workspace`?Z(g):`project:${C??`none`}`,fe=r&&re,pe=r&&D;return(0,H.useEffect)(()=>{M&&(r&&u(!1),a&&c(),o&&d(!1))},[M,r,a,o,u,d,c]),(0,K.jsxs)(`div`,{className:`flex h-screen overflow-hidden bg-[hsl(var(--deck-canvas))]`,children:[O&&n&&!fe&&(0,K.jsx)(`button`,{type:`button`,"aria-label":t(`sidebar.action.collapse`),onClick:()=>p(!1),className:`fixed inset-0 z-40 bg-black/25 backdrop-blur-[1px]`}),(0,K.jsx)(`div`,{ref:ae,role:O&&n&&!fe?`dialog`:void 0,"aria-modal":O&&n&&!fe?!0:void 0,"aria-label":O&&n&&!fe?t(`sidebar.navigationAria`):void 0,inert:fe||O&&!n?!0:void 0,onKeyDown:N,className:G(`overflow-hidden`,n?`w-[260px]`:`w-[64px]`,O?`fixed inset-y-0 left-0 z-50 shadow-2xl transition-none`:`shrink-0 transition-[width] duration-300 ease-in-out`,O&&!n&&`-translate-x-full`),children:(0,K.jsx)(`div`,{className:G(`transition-all duration-300 ease-in-out`,n?`w-[260px]`:`w-[64px]`),children:(0,K.jsx)(H.Suspense,{fallback:null,children:(0,K.jsx)(Qa,{onNavigate:()=>{O&&p(!1)}})})})}),(0,K.jsxs)(`div`,{className:`flex flex-col flex-1 min-w-0`,children:[(0,K.jsxs)(`header`,{inert:fe,className:`relative z-10 flex h-14 items-center gap-2 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas))]/90 px-3 backdrop-blur-md sm:gap-4 sm:px-6`,children:[O&&(0,K.jsx)(sr,{ref:k,"data-mobile-navigation-trigger":!0,variant:`ghost`,size:`icon`,onClick:()=>p(!0),"aria-label":t(`layout.action.openNavigation`),title:t(`layout.action.openNavigation`),className:`h-9 w-9 shrink-0 rounded-md text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]`,children:(0,K.jsx)(wt,{className:`h-4 w-4`})}),(0,K.jsxs)(`div`,{className:`flex gap-2 items-center min-w-0`,children:[M?(0,K.jsxs)(`span`,{className:`font-mono text-[12px] font-medium text-[hsl(var(--deck-ink))]`,children:[t(`history.badge.remote`),` · `,t(`history.badge.historyOnly`)]}):ce.length>0?(0,K.jsx)(`nav`,{"aria-label":t(`layout.workspace.pathAria`),title:P??void 0,className:`flex min-w-0 items-center font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]`,children:ce.map((e,t)=>{let n=t===ce.length-1;return(0,K.jsxs)(`span`,{className:`flex items-center min-w-0`,children:[t>0&&(0,K.jsx)(`span`,{className:`mx-1 text-[hsl(var(--deck-ink-faint))]/70`,children:`/`}),t===0&&(t!==0||e!==`~`)&&(0,K.jsx)(`span`,{className:`mr-1 text-[hsl(var(--deck-ink-faint))]/70`,children:`/`}),(0,K.jsx)(`span`,{className:G(`truncate`,n?`font-medium text-[hsl(var(--deck-ink))]`:`text-[hsl(var(--deck-ink-muted))]`),children:e})]},t)})}):(0,K.jsx)(`span`,{className:`font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]`,children:x?.cwd?$a(x.cwd):t(`layout.workspace.empty`)}),w&&(0,K.jsxs)(`span`,{className:`ml-2 inline-flex items-center gap-1 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2 py-0.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-muted))]`,children:[(0,K.jsx)(ut,{className:`h-3 w-3 text-[hsl(var(--deck-accent))]`}),w]})]}),(0,K.jsxs)(`div`,{className:`flex gap-3 items-center ml-auto`,children:[le&&(0,K.jsx)(`span`,{className:`hidden items-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2.5 py-1 md:inline-flex`,children:(0,K.jsx)(Ia,{inFlight:le.inFlight,queued:le.queued,maxConcurrent:le.maxConcurrent,compact:!0})}),(0,K.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,K.jsx)(sr,{variant:`ghost`,size:`icon`,"aria-label":t(`layout.action.rewind`),title:t(`layout.action.rewind`),disabled:M||m===`board`||!g||b||y,onClick:()=>E(!0),className:`h-8 w-8 rounded-md text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] disabled:opacity-35`,children:(0,K.jsx)(It,{className:`w-4 h-4`})}),(0,K.jsx)(H.Suspense,{fallback:null,children:(0,K.jsx)(Xa,{ref:oe,open:r,maximized:D,disabled:M||m===`board`,onToggleMaximized:()=>te(e=>!e),onTogglePreview:()=>{if(r){te(!1),s();return}l((!g||b)&&f===0?{tab:`files`}:void 0)}})})]})]})]}),(0,K.jsxs)(`main`,{className:`flex-1 overflow-hidden relative flex bg-[hsl(var(--deck-canvas))]`,children:[(0,K.jsx)(`div`,{"data-preview-background":`content`,"data-preview-maximized":pe,inert:fe,className:`relative flex min-w-0 flex-1 flex-col`,children:i?(0,K.jsx)(H.Suspense,{fallback:null,children:(0,K.jsx)(Ga,{})}):e}),r&&!M&&(0,K.jsx)(H.Suspense,{fallback:null,children:(0,K.jsx)(Ya,{returnFocusElement:oe.current,maximized:pe},de)})]})]}),a&&!M&&(0,K.jsx)(H.Suspense,{fallback:null,children:(0,K.jsx)(Za,{workspacePath:ue},ue??`default-workspace`)}),o&&!M&&(0,K.jsx)(H.Suspense,{fallback:null,children:(0,K.jsx)(qa,{})}),(0,K.jsx)(Fa,{open:!M&&ee,onOpenChange:E})]})}var no=`BladeCode`;function ro(){let e=Me(),t=$(e=>e.unreadTaskKeys),n=$(e=>e.sessions),r=$(e=>e.selectSession),i=$(e=>e.selectProject),a=(0,H.useMemo)(()=>{let e=new Set(t);for(let t of n)t.pendingInteraction&&e.add(Z(X(t)));return e.size},[n,t]);return(0,H.useEffect)(()=>(document.title=a>0?`(${a}) ${no}`:no,()=>{document.title=no}),[a]),(0,H.useEffect)(()=>{let e=e=>{let t=e.detail;if(!t?.sessionId||!t.projectPath)return;let n=$.getState(),a=Ir(n.sessions,t),o=a?xi(a,n.selectedProjectPath??n.taskWorkspaceInfo?.cwd??null):t.projectPath;n.boundProjects.some(e=>e.available&&e.path===o)&&i(o),r(t)};return window.addEventListener(Mi,e),()=>window.removeEventListener(Mi,e)},[i,r]),(0,K.jsx)(`div`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:a>0?e(`attention.unreadAnnouncement`,{count:a}):``})}var io=we,ao=Oe,oo=H.forwardRef(({className:e,align:t=`center`,sideOffset:n=4,...r},i)=>(0,K.jsx)(Ce,{children:(0,K.jsx)(z,{ref:i,align:t,sideOffset:n,className:G(`z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]`,e),...r})}));oo.displayName=z.displayName;var so=H.forwardRef(({className:e,...t},n)=>(0,K.jsx)(`textarea`,{className:G(`flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,e),ref:n,...t}));so.displayName=`Textarea`;var co=(e,t)=>{let n=[...e.matchAll(/(?:^|\s)(@(?:"[^"]*"|(?:[^\\ ]|\\ )*))/g)];for(let e of n){let n=e[1],r=e.index+(e[0].length-n.length),i=r+n.length;if(t>=r&&t<=i){let e=n.slice(1),t=!1;return e.startsWith(`"`)&&(t=!0,e=e.slice(1),e.endsWith(`"`)&&(e=e.slice(0,-1))),{hasQuery:!0,query:e,startIndex:r,endIndex:i,quoted:t}}}return{hasQuery:!1,query:``,startIndex:-1,endIndex:-1,quoted:!1}},lo=(e,t,n={})=>{let{debounceDelay:r=200,maxSuggestions:i=15,workspacePath:a,disabled:o=!1,canRequest:s}=n,[c,l]=(0,H.useState)([]),[u,d]=(0,H.useState)(0),[f,p]=(0,H.useState)(!1),m=(0,H.useMemo)(()=>t===void 0?{hasQuery:!1,query:``,startIndex:-1,endIndex:-1,quoted:!1}:co(e,t),[e,t]);(0,H.useEffect)(()=>{if(o||!m.hasQuery){l([]),p(!1);return}let e=!1;p(!0);let t=setTimeout(async()=>{if(!(o||s?.()===!1))try{let t=await fetch(`/suggestions/files?q=${encodeURIComponent(m.query)}&limit=${i}`,a?{headers:{"x-blade-directory":a}}:void 0);if(!t.ok)throw Error(`Failed to fetch suggestions`);let n=await t.json();e||l(n)}catch(t){console.error(`Failed to fetch file suggestions:`,t),e||l([])}finally{e||p(!1)}},r);return()=>{e=!0,clearTimeout(t)}},[o,m.hasQuery,m.query,r,i,a,s]),(0,H.useEffect)(()=>{d(0)},[c]);let h=(0,H.useCallback)(()=>{d(e=>(e+1)%Math.max(c.length,1))},[c.length]),g=(0,H.useCallback)(()=>{d(e=>(e-1+c.length)%Math.max(c.length,1))},[c.length]);return{...m,suggestions:c,selectedIndex:u,loading:f,setSelectedIndex:d,selectNext:h,selectPrevious:g}},uo=(e,t=!1)=>e.includes(` `)||t?`@"${e}"`:`@${e}`,fo=(e,t,n)=>{if(!t.hasQuery)return{newInput:e,newCursorPos:e.length};let r=uo(n,t.quoted),i=e.slice(0,t.startIndex),a=e.slice(t.endIndex);return{newInput:i+r+` `+a,newCursorPos:t.startIndex+r.length+1}};function po(){let[e,t]=(0,H.useState)([]),[n,r]=(0,H.useState)(-1),i=(0,H.useRef)(``);return{addToHistory:(0,H.useCallback)(e=>{e.trim()&&(t(t=>t[t.length-1]===e?t:[...t,e]),r(-1),i.current=``)},[]),getPrevious:(0,H.useCallback)(t=>{if(e.length===0)return null;n===-1&&(i.current=t);let a=n===-1?e.length-1:Math.max(0,n-1);return r(a),e[a]??null},[e,n]),getNext:(0,H.useCallback)(()=>{if(n===-1)return null;let t=n+1;return t>=e.length?(r(-1),i.current):(r(t),e[t]??null)},[e,n]),reset:(0,H.useCallback)(()=>{r(-1),i.current=``},[]),historyIndex:n}}var mo=(e,t)=>{if(!e.startsWith(`/`))return{hasQuery:!1,query:``,startIndex:-1,endIndex:-1};let n=e.indexOf(` `);return t<=(n===-1?e.length:n)?{hasQuery:!0,query:e.slice(1,t),startIndex:0,endIndex:t}:{hasQuery:!1,query:``,startIndex:-1,endIndex:-1}},ho=(e,t,n={})=>{let{debounceDelay:r=150,workspacePath:i}=n,[a,o]=(0,H.useState)([]),[s,c]=(0,H.useState)(0),[l,u]=(0,H.useState)(!1),d=(0,H.useMemo)(()=>t===void 0?{hasQuery:!1,query:``,startIndex:-1,endIndex:-1}:mo(e,t),[e,t]);(0,H.useEffect)(()=>{if(!d.hasQuery){o([]),u(!1);return}let e=!1;u(!0);let t=setTimeout(async()=>{try{let t=await fetch(`/suggestions/commands?q=${encodeURIComponent(d.query)}`,i?{headers:{"x-blade-directory":i}}:void 0);if(!t.ok)throw Error(`Failed to fetch suggestions`);let n=await t.json();e||o(n)}catch(t){console.error(`Failed to fetch command suggestions:`,t),e||o([])}finally{e||u(!1)}},r);return()=>{e=!0,clearTimeout(t)}},[d.hasQuery,d.query,r,i]),(0,H.useEffect)(()=>{c(0)},[a]);let f=(0,H.useCallback)(()=>{c(e=>(e+1)%Math.max(a.length,1))},[a.length]),p=(0,H.useCallback)(()=>{c(e=>(e-1+a.length)%Math.max(a.length,1))},[a.length]);return{...d,suggestions:a,selectedIndex:s,loading:l,setSelectedIndex:c,selectNext:f,selectPrevious:p}},go=(e,t,n)=>{if(!t.hasQuery)return{newInput:e,newCursorPos:e.length};let r=e.slice(t.endIndex);return{newInput:n.command+` `+r.trimStart(),newCursorPos:n.command.length+1}},_o=`blade.composer.draft.`,vo=new Map,yo=new Set,bo=2;function xo(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e;return typeof t.id!=`string`||typeof t.text!=`string`||typeof t.sourceMessageId!=`string`||t.sourceRole!==`user`&&t.sourceRole!==`assistant`||t.comment!==void 0&&typeof t.comment!=`string`?[]:[t]}):[]}function So(){return typeof sessionStorage>`u`?null:sessionStorage}function Co(e){return`${_o}${e}`}function wo(e){if(!e)return{content:``,attachments:[],annotations:[],outputSchema:void 0};let t=vo.get(e);if(t)return{content:t.content,attachments:[...t.attachments],annotations:[...t.annotations??[]],outputSchema:t.outputSchema};try{let t=So()?.getItem(Co(e))??``;if(!t)return{content:``,attachments:[],annotations:[],outputSchema:void 0};try{let e=JSON.parse(t);if((e.version===1||e.version===bo)&&typeof e.content==`string`&&(e.outputSchema===void 0||typeof e.outputSchema==`string`))return{content:e.content,attachments:[],annotations:xo(e.annotations),outputSchema:e.outputSchema}}catch{}return{content:t,attachments:[],annotations:[],outputSchema:void 0}}catch{return{content:``,attachments:[],annotations:[],outputSchema:void 0}}}function To(e,t){if(!e)return;let n=vo.get(e)??wo(e),r=t.outputSchema??n?.outputSchema,i=t.annotations??n.annotations??[];if(!t.content&&t.attachments.length===0&&i.length===0&&!r){Eo(e);return}vo.set(e,{content:t.content,attachments:[...t.attachments],annotations:[...i],outputSchema:r});try{t.content||i.length>0||r?So()?.setItem(Co(e),JSON.stringify({version:bo,content:t.content,annotations:i,...r?{outputSchema:r}:{}})):So()?.removeItem(Co(e))}catch{}}function Eo(e){if(e){vo.delete(e);try{So()?.removeItem(Co(e))}catch{}}}function Do(e,t){let n=t.trim();if(!e||!n)return!1;let r=wo(e),i=r.content.length===0?``:r.content.endsWith(`
|
|
6
|
+
`)?`
|
|
7
|
+
`:`
|
|
8
|
+
|
|
9
|
+
`,a={...r,content:`${r.content}${i}${n}`};To(e,a);let o={key:e,draft:{...a,attachments:[...a.attachments],annotations:[...a.annotations??[]]}};for(let e of yo)e(o);return!0}function Oo(e,t){To(e,t);let n={key:e,draft:{...t,attachments:[...t.attachments],annotations:[...t.annotations??[]]}};for(let e of yo)e(n)}function ko(e,t){if(!e||!t.text.trim())return!1;let n=wo(e),r=n.annotations??[];if(!r.some(e=>e.id===t.id)&&r.length>=20)return!1;let i=[...r.filter(e=>e.id!==t.id),t];return Oo(e,{...n,annotations:i}),!0}function Ao(e,t){if(!e)return!1;let n=wo(e),r=(n.annotations??[]).filter(e=>e.id!==t);return r.length!==(n.annotations??[]).length&&(Oo(e,{...n,annotations:r}),!0)}function jo(e){return yo.add(e),()=>yo.delete(e)}function Mo(e){return e.reduce((e,t)=>e+t.dataUrl.length,0)}function No(e){return`data:${e.type||`application/octet-stream`};base64,`.length+4*Math.ceil(e.size/3)}function Po(e,t){let n=Mo(e)+t.reduce((e,t)=>e+No(t),0);return e.length+t.length>20?{accepted:!1,reason:`count`,estimatedBytes:n}:n>5242880?{accepted:!1,reason:`bytes`,estimatedBytes:n}:{accepted:!0,estimatedBytes:n}}var Fo=e=>typeof e==`object`&&`command`in e,Io=({type:e,suggestions:t,selectedIndex:n,loading:r,onSelect:i,onHover:a,visible:o})=>{let s=(0,H.useRef)(null),c=(0,H.useRef)(null);return(0,H.useEffect)(()=>{if(c.current&&s.current){let e=s.current,t=c.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.bottom>n.bottom?e.scrollTop+=r.bottom-n.bottom+4:r.top<n.top&&(e.scrollTop-=n.top-r.top+4)}},[n]),!o||t.length===0&&!r?null:(0,K.jsx)(`div`,{className:`absolute bottom-full left-0 right-0 mb-2 z-50`,children:(0,K.jsxs)(`div`,{className:`mx-4 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700 rounded-lg shadow-xl overflow-hidden`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-[#E5E7EB] dark:border-zinc-800 text-xs text-[#6B7280] dark:text-zinc-400`,children:[(0,K.jsx)(e===`command`?Qe:nt,{className:`h-3.5 w-3.5`}),(0,K.jsx)(`span`,{children:e===`command`?`Commands`:`Files`}),r&&(0,K.jsx)(bt,{className:`h-3 w-3 animate-spin ml-auto`})]}),(0,K.jsx)(`div`,{ref:s,className:`max-h-64 overflow-y-auto py-1`,children:t.length===0&&r?(0,K.jsx)(`div`,{className:`px-3 py-4 text-center text-[#6B7280] dark:text-zinc-500 text-sm`,children:`Loading...`}):t.length===0?(0,K.jsx)(`div`,{className:`px-3 py-4 text-center text-[#6B7280] dark:text-zinc-500 text-sm`,children:`No matches found`}):t.map((e,t)=>{let r=t===n,o=Fo(e);return(0,K.jsx)(`button`,{ref:r?c:null,className:G(`w-full text-left px-3 py-2 flex items-start gap-3 transition-colors`,r?`bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100`:`text-[#6B7280] hover:bg-[#F3F4F6] hover:text-[#111827] dark:text-zinc-400 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-300`),onClick:()=>i(t),onMouseEnter:()=>a(t),children:o?(0,K.jsx)(K.Fragment,{children:(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`font-mono text-sm text-blue-600 dark:text-blue-400`,children:e.command}),e.argumentHint&&(0,K.jsx)(`span`,{className:`text-xs text-[#9CA3AF] dark:text-zinc-500 font-mono`,children:e.argumentHint})]}),(0,K.jsx)(`p`,{className:`text-xs text-[#9CA3AF] dark:text-zinc-500 mt-0.5 truncate`,children:e.description})]})}):(0,K.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,K.jsx)(nt,{className:`h-4 w-4 flex-shrink-0 text-[#9CA3AF] dark:text-zinc-500`}),(0,K.jsx)(`span`,{className:`font-mono text-sm truncate`,children:e})]})},o?e.command:e)})}),(0,K.jsxs)(`div`,{className:`px-3 py-1.5 border-t border-[#E5E7EB] dark:border-zinc-800 text-xs text-[#9CA3AF] dark:text-zinc-500 flex items-center gap-4`,children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`kbd`,{className:`px-1.5 py-0.5 bg-[#E5E7EB] dark:bg-zinc-800 rounded text-[#6B7280] dark:text-zinc-400`,children:`↑↓`}),` `,`Navigate`]}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`kbd`,{className:`px-1.5 py-0.5 bg-[#E5E7EB] dark:bg-zinc-800 rounded text-[#6B7280] dark:text-zinc-400`,children:`Tab`}),` `,`Select`]}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`kbd`,{className:`px-1.5 py-0.5 bg-[#E5E7EB] dark:bg-zinc-800 rounded text-[#6B7280] dark:text-zinc-400`,children:`Esc`}),` `,`Close`]})]})]})})},Lo=()=>!I($.getState().historySurfaceSelection),Ro=[{value:n.DEFAULT,labelKey:`chat.input.mode.default`,descriptionKey:`chat.input.mode.default.desc`,icon:mt},{value:n.AUTO_EDIT,labelKey:`chat.input.mode.autoEdit`,descriptionKey:`chat.input.mode.autoEdit.desc`,icon:Kt},{value:n.YOLO,labelKey:`chat.input.mode.yolo`,descriptionKey:`chat.input.mode.yolo.desc`,icon:Wt,tone:`danger`},{value:n.PLAN,labelKey:`chat.input.mode.plan`,descriptionKey:`chat.input.mode.plan.desc`,icon:Xe}],zo=[`off`],Bo=[`high`,`xhigh`,`medium`,`max`,`low`,`minimal`,`off`],Vo=[`standard`],Ho=[];function Uo(e){return Bo.find(t=>e.includes(t))??`off`}function Wo(e){return e<1048576?`${Math.max(1,Math.ceil(e/1024))} KiB`:`${(e/1048576).toFixed(1)} MiB`}function Go({onSend:e,onAbort:t,disabled:r,submitDisabled:i=!1,shellSubmitDisabled:a=!1,isStreaming:o,isStopping:s=!1,pendingSteeringCount:c=0,pendingInputDelivery:l=null,recoveredSteeringCount:u=0,variant:d=`chat`,draft:f,draftAttachments:p,draftRevision:m,draftKey:h,placeholder:g,workspacePath:_,onNavigateToMessage:v}){let y=Me(),b=(0,H.useRef)(wo(h)),[x,S]=(0,H.useState)(b.current.content),[C,w]=(0,H.useState)(b.current.attachments),[T,ee]=(0,H.useState)(b.current.annotations??[]),E=(0,H.useRef)(x),D=(0,H.useRef)(C),te=(0,H.useRef)(T),[O,ne]=(0,H.useState)(!1),[ie,ae]=(0,H.useState)(b.current.outputSchema??``),k=(0,H.useRef)(ie),[oe,j]=(0,H.useState)(!1),[se,M]=(0,H.useState)(null),[N,P]=(0,H.useState)(void 0),[ce,le]=(0,H.useState)(!1),[ue,de]=(0,H.useState)(!1),[pe,F]=(0,H.useState)(!1),[me,he]=(0,H.useState)(!1),[ge,L]=(0,H.useState)(!1),[_e,ve]=(0,H.useState)(!1),[R,ye]=(0,H.useState)(!1),[be,xe]=(0,H.useState)(null),[Se,Ce]=(0,H.useState)(null),we=T.length===0&&x.trimStart().startsWith(`!`),Te=we?a:i,Ee=(0,H.useRef)(null),De=(0,H.useRef)(!1),Oe=(0,H.useRef)(!1),z=(0,H.useRef)(null),ke=(0,H.useRef)(null),{currentModelId:Ae,configuredModels:je,hasLoaded:B,loadedWorkspacePath:V,loadModels:Pe,setCurrentModel:Fe,currentMode:Ie,setMode:Le}=Ti(),Re=A(e=>e.isSettingsOpen),ze=Ne(e=>e.communicationStyle),Ve=$(e=>e.setMaxContextTokens),Ue=$(e=>I(e.historySurfaceSelection)),Ge=$(e=>e.currentSessionRef),qe=$(e=>e.sessions.find(e=>e.sessionId===Ge?.sessionId&&e.projectPath===Ge?.projectPath)?.selectedModelId),Je=$(e=>e.sessions.find(e=>e.sessionId===Ge?.sessionId&&e.projectPath===Ge?.projectPath)?.reasoningEffort),Ye=$(e=>e.sessions.find(e=>e.sessionId===Ge?.sessionId&&e.projectPath===Ge?.projectPath)?.serviceTier),Xe=$(e=>e.sessions.find(e=>e.sessionId===Ge?.sessionId&&e.projectPath===Ge?.projectPath)?.responseVerbosity),[Ze,Qe]=(0,H.useState)(null),[$e,et]=(0,H.useState)(null),[tt,nt]=(0,H.useState)(null),[rt,it]=(0,H.useState)(null),at=je.some(e=>e.id===qe),ot=Ge?Ze??(at?qe:Ae):Ae,st=je.find(e=>e.id===ot),ct=(st?.supportedReasoningEfforts??zo).filter(e=>e!==`auto`),lt=$e??Je,ut=Uo(ct),dt=lt!==void 0&<!==`auto`&&ct.includes(lt)?lt:ut,ft=st?.supportedServiceTiers??Vo,pt=[`auto`,...ft],mt=tt??Ye??`auto`,ht=st?.supportedResponseVerbosities??Ho,gt=[`auto`,...ht],_t=rt??Xe??`auto`,yt=ze??`auto`,xt=ct.length>1,Ct=ft.some(e=>e!==`standard`),wt=ht.length>0,Tt=st?.displayName||st?.model||ot||y(`chat.input.model.placeholder`),Dt=st?.input?.includes(`image`)===!0,Ot=st?y(`chat.input.attachment.modelUnsupported`,{model:Tt}):y(`chat.input.attachment.modelRequired`),kt=C.length>0&&!Dt,jt=ho(x,N,{workspacePath:_}),Mt=lo(x,N,{workspacePath:_,disabled:Ue,canRequest:Lo}),Nt=po(),Pt=jt.hasQuery&&jt.suggestions.length>0,Ft=Mt.hasQuery&&Mt.suggestions.length>0,It=Pt||Ft;(0,H.useEffect)(()=>{!Re&&(!B||V!==(_??null))&&Pe(_??void 0)},[Re,Pe,V,B,_]),(0,H.useEffect)(()=>{o&&(le(!1),de(!1),F(!1),he(!1),j(!1))},[o]),(0,H.useEffect)(()=>{Qe(null),et(null),nt(null),it(null)},[Ge?.projectPath,Ge?.sessionId]),(0,H.useEffect)(()=>{mt!==`auto`&&!ft.includes(mt)&&nt(`auto`)},[mt,ft]),(0,H.useEffect)(()=>{_t!==`auto`&&!ht.includes(_t)&&it(`auto`)},[_t,ht]),(0,H.useEffect)(()=>{Ce(null)},[ot]),(0,H.useEffect)(()=>{if(f!==void 0){let e=p??D.current;E.current=f,D.current=e,S(f),w(e),xe(null),Ce(null),P(f.length),To(h,{content:f,attachments:e,annotations:te.current}),requestAnimationFrame(()=>z.current?.focus())}},[f,p,h,m]),(0,H.useEffect)(()=>()=>{To(h,{content:E.current,attachments:D.current,annotations:te.current,outputSchema:k.current})},[h]),(0,H.useEffect)(()=>jo(e=>{if(e.key!==h)return;let t=e.draft.attachments,n=e.draft.annotations??[];E.current=e.draft.content,D.current=t,te.current=n,S(e.draft.content),w(t),ee(n),P(e.draft.content.length),requestAnimationFrame(()=>{z.current?.focus(),z.current?.setSelectionRange(e.draft.content.length,e.draft.content.length)})}),[h]),(0,H.useEffect)(()=>{if(!st)return;let e=!!st.contextWindow;Ve(st.contextWindow||0,!e)},[st,Ve]),(0,H.useEffect)(()=>{Dt&&xe(e=>e===Ee.current?(Ee.current=null,null):e)},[Dt]);let Lt=(0,H.useCallback)(async()=>{if(re($.getState())||!x.trim()&&C.length===0&&T.length===0||r||Te||kt||De.current)return;let t;if(ie.trim()){if(we){M(y(`chat.input.outputSchema.shellUnsupported`)),j(!0);return}try{let e=JSON.parse(ie);if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`schema root must be an object`);t=e}catch{M(y(`chat.input.outputSchema.invalid`)),j(!0);return}}x.trim()&&Nt.addToHistory(x),De.current=!0,ye(!0);let n=h;try{if(await e({content:x,modelId:ot??void 0,reasoningEffort:dt,serviceTier:mt,responseVerbosity:_t,communicationStyle:yt,attachments:C,...T.length>0?{annotations:T}:{},...t?{outputSchema:t}:{}})===!1)return;Eo(n),E.current=``,D.current=[],te.current=[],k.current=``,S(``),w([]),ee([]),ne(!1),ae(``),M(null),xe(null),Ce(null),Ee.current=null,P(void 0)}catch{}finally{De.current=!1,ye(!1)}},[C,T,kt,h,x,we,r,ot,dt,_t,yt,mt,Te,e,ie,Nt,y]),Rt=(0,H.useCallback)(()=>{re($.getState())||t?.()},[t]),zt=(0,H.useCallback)(e=>{xe(null),Ce(null),Ee.current=null,w(t=>{let n=t.filter(t=>t.id!==e);return D.current=n,To(h,{content:E.current,attachments:n}),n})},[h]),Bt=(0,H.useCallback)(e=>{Ao(h,e),te.current.length<=1&&ne(!1)},[h]),Vt=(0,H.useCallback)(e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{if(typeof r.result!=`string`){n(Error(`Failed to read image`));return}t({id:typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:e.name,mimeType:e.type,dataUrl:r.result})},r.onerror=()=>n(r.error??Error(`Failed to read image`)),r.readAsDataURL(e)}),[]),Ut=(0,H.useCallback)(async e=>{if(e.length===0)return;if(!Dt){Ee.current=Ot,Ce(null),xe(Ot);return}let t=Po(D.current,e),n=e=>e===`count`?y(`chat.input.attachment.countLimit`,{count:20}):y(`chat.input.attachment.sizeLimit`,{size:Wo(fe)});if(!t.accepted){Ee.current=null,Ce(null),xe(n(t.reason??`bytes`));return}try{let t=await Promise.all(e.map(e=>Vt(e))),r=new Set(D.current.map(e=>e.dataUrl)),i=t.filter(e=>!r.has(e.dataUrl)&&(r.add(e.dataUrl),!0));if(i.length===0){xe(null),Ce(null),Ee.current=null;return}let a=[...D.current,...i];if(Mo(a)>5242880){Ee.current=null,Ce(null),xe(n(`bytes`));return}D.current=a,w(a),xe(null),Ce(null),Ee.current=null,To(h,{content:E.current,attachments:a})}catch{Ee.current=null,Ce(null),xe(y(`chat.input.attachment.readFailed`))}},[h,Ot,Dt,Vt,y]),Gt=(0,H.useCallback)(async e=>{let t=Array.from(e.target.files??[]).filter(e=>e.type.startsWith(`image/`));await Ut(t),e.target.value=``},[Ut]),Kt=(0,H.useCallback)(async e=>{let t=Array.from(e.clipboardData.items).filter(e=>e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),await Ut(t))},[Ut]),qt=(0,H.useCallback)(e=>{let t=jt.suggestions[e];if(!t)return;let{newInput:n,newCursorPos:r}=go(x,jt,t);E.current=n,S(n),P(r),To(h,{content:n,attachments:D.current}),requestAnimationFrame(()=>{z.current&&(z.current.focus(),z.current.setSelectionRange(r,r))})},[h,x,jt]),Jt=(0,H.useCallback)(e=>{let t=Mt.suggestions[e];if(!t)return;let{newInput:n,newCursorPos:r}=fo(x,Mt,t);E.current=n,S(n),P(r),To(h,{content:n,attachments:D.current}),requestAnimationFrame(()=>{z.current&&(z.current.focus(),z.current.setSelectionRange(r,r))})},[Mt,h,x]),Yt=(0,H.useCallback)(e=>{if(!(Oe.current||e.nativeEvent.isComposing||e.keyCode===229)){if((e.metaKey||e.ctrlKey)&&e.key.toLocaleLowerCase()===`a`){e.preventDefault(),e.stopPropagation(),e.currentTarget.select();return}if(Pt){if(e.key===`ArrowDown`){e.preventDefault(),jt.selectNext();return}if(e.key===`ArrowUp`){e.preventDefault(),jt.selectPrevious();return}if(e.key===`Tab`||e.key===`Enter`&&!e.shiftKey){e.preventDefault(),qt(jt.selectedIndex);return}if(e.key===`Escape`){e.preventDefault(),P(void 0);return}}if(Ft){if(e.key===`ArrowDown`){e.preventDefault(),Mt.selectNext();return}if(e.key===`ArrowUp`){e.preventDefault(),Mt.selectPrevious();return}if(e.key===`Tab`||e.key===`Enter`&&!e.shiftKey){e.preventDefault(),Jt(Mt.selectedIndex);return}if(e.key===`Escape`){e.preventDefault(),P(void 0);return}}if(e.key===`Enter`&&!e.shiftKey){e.preventDefault(),Lt();return}if(e.key===`ArrowUp`&&!e.shiftKey){let t=e.target,n=t.selectionStart===0&&t.selectionEnd===0,r=!x.includes(`
|
|
10
|
+
`);if(n||r){let t=Nt.getPrevious(x);t!==null&&(e.preventDefault(),E.current=t,S(t),To(h,{content:t,attachments:D.current}),requestAnimationFrame(()=>{z.current&&z.current.setSelectionRange(t.length,t.length)}))}return}if(e.key===`ArrowDown`&&!e.shiftKey){let t=e.target,n=t.selectionStart===x.length&&t.selectionEnd===x.length,r=!x.includes(`
|
|
11
|
+
`);if((n||r)&&Nt.historyIndex!==-1){let t=Nt.getNext();t!==null&&(e.preventDefault(),E.current=t,S(t),To(h,{content:t,attachments:D.current}),requestAnimationFrame(()=>{z.current&&z.current.setSelectionRange(t.length,t.length)}))}}}},[Pt,Ft,jt,Mt,qt,Jt,Lt,h,x,Nt]),Zt=(0,H.useCallback)(e=>{let t=e.target.value;E.current=t,S(t),P(e.target.selectionStart),To(h,{content:t,attachments:D.current})},[h]),Qt=(0,H.useCallback)(e=>{let t=e.target;P(t.selectionStart)},[]);(0,H.useEffect)(()=>{z.current&&(z.current.style.height=`inherit`,z.current.style.height=`${Math.min(z.current.scrollHeight,200)}px`)},[x]);let $t=Ro.find(e=>e.value===Ie)??Ro[1],en=y($t.labelKey),tn=$t.icon,nn=!!x.trim()||C.length>0||T.length>0,rn=C.length>=20,on=Mo(C),sn=be||(kt?Ot:null),cn=sn?null:Se,ln=!!r||Ue,un=ln||R,dn=un||rn||!Dt,fn=Dt?rn?y(`chat.input.attachment.countLimit`,{count:20}):y(`chat.input.attachment.add`):Ot;return(0,K.jsxs)(`div`,{"data-chat-input-shell":!0,className:d===`task`?`bg-transparent`:`py-2.5 border-t border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas))]`,children:[(0,K.jsxs)(`div`,{"data-chat-input-inner":!0,className:d===`task`?`w-full`:`px-4 w-full md:px-6`,children:[(0,K.jsxs)(`div`,{className:`relative border rounded-lg bg-[hsl(var(--deck-surface))] transition-all duration-200 flex flex-col ${d===`task`?`min-h-[148px] shadow-[0_18px_60px_-24px_hsl(var(--deck-accent)/0.4)] focus-within:ring-1 ${we?`border-amber-400/70 focus-within:border-amber-500 focus-within:ring-amber-400/25`:`border-[hsl(var(--deck-border))] focus-within:border-[hsl(var(--deck-accent)/0.6)] focus-within:ring-[hsl(var(--deck-accent)/0.25)]`}`:`min-h-[56px] shadow-sm focus-within:ring-1 ${we?`border-amber-400/70 focus-within:border-amber-500 focus-within:ring-amber-400/25`:`border-[hsl(var(--deck-border))] focus-within:border-[hsl(var(--deck-border-strong))] focus-within:ring-[hsl(var(--deck-border-strong))]`}`}`,children:[(0,K.jsx)(Io,{type:`command`,suggestions:jt.suggestions,selectedIndex:jt.selectedIndex,loading:jt.loading,onSelect:qt,onHover:jt.setSelectedIndex,visible:Pt}),(0,K.jsx)(Io,{type:`file`,suggestions:Mt.suggestions,selectedIndex:Mt.selectedIndex,loading:Mt.loading,onSelect:Jt,onHover:Mt.setSelectedIndex,visible:Ft&&!Pt}),T.length>0&&(0,K.jsx)(`div`,{className:`px-3 pt-3`,children:(0,K.jsxs)(io,{open:O,onOpenChange:ne,children:[(0,K.jsx)(ao,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,"aria-label":y(`chat.input.annotation.show`,{count:T.length}),className:`inline-flex h-8 items-center gap-1.5 rounded-md border border-[hsl(var(--deck-border-strong))] bg-[hsl(var(--deck-surface-2))] px-2.5 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]`,children:[(0,K.jsx)(Et,{"aria-hidden":!0,className:`h-3.5 w-3.5`}),y(T.length===1?`chat.input.annotation.one`:`chat.input.annotation.many`,{count:T.length})]})}),(0,K.jsx)(oo,{align:`start`,side:`top`,className:`w-[min(360px,calc(100vw-1rem))] space-y-2 p-2`,children:T.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md bg-[hsl(var(--deck-surface-2))] px-2.5 py-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`font-mono text-[9.5px] uppercase text-[hsl(var(--deck-ink-faint))]`,children:y(`chat.input.annotation.item`,{index:t+1})}),(0,K.jsx)(`blockquote`,{className:`mt-1 line-clamp-3 whitespace-pre-wrap border-l-2 border-[hsl(var(--deck-accent)/0.45)] pl-2 text-[11px] leading-4 text-[hsl(var(--deck-ink-muted))]`,children:e.text}),e.comment&&(0,K.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-4 text-[hsl(var(--deck-ink))]`,children:e.comment}),v&&(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{ne(!1),v(e.sourceMessageId)},className:`mt-1.5 inline-flex min-h-7 items-center gap-1.5 rounded-md px-2 text-[10.5px] font-medium text-[hsl(var(--deck-accent))] transition-colors hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]`,children:[(0,K.jsx)(St,{"aria-hidden":!0,className:`h-3.5 w-3.5`}),y(`chat.input.annotation.jump`)]})]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":y(`chat.input.annotation.remove`,{index:t+1}),onClick:()=>Bt(e.id),className:`flex h-6 w-6 shrink-0 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]`,children:(0,K.jsx)(an,{"aria-hidden":!0,className:`h-3 w-3`})})]},e.id))})]})}),(0,K.jsx)(so,{ref:z,"data-blade-composer":!0,value:x,onChange:Zt,onCompositionStart:()=>{Oe.current=!0},onCompositionEnd:()=>{Oe.current=!1},onBlur:()=>{Oe.current=!1},onKeyDown:Yt,onPaste:Kt,onSelect:Qt,onClick:Qt,placeholder:g??y(o?`chat.input.placeholder.steering`:`chat.input.placeholder.default`),className:`flex-1 w-full resize-none border-0 bg-transparent px-4 focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none text-[#111827] dark:text-zinc-300 placeholder:text-[#9CA3AF] dark:placeholder:text-zinc-600 ${d===`task`?`min-h-[84px] py-4 text-[15px]`:`py-2.5 text-[14px]`}`,disabled:ln||R,"aria-busy":R}),we&&(0,K.jsx)(`div`,{className:`px-4 pb-2 font-mono text-[11px] text-amber-600 dark:text-amber-400`,children:`$ user shell · runs in this Session workspace`}),o&&(0,K.jsx)(`div`,{className:`px-4 pb-2 text-[11px] font-mono text-amber-600 dark:text-amber-400`,children:c>0&&l===`next_turn`?y(`chat.input.followUp.queued`,{count:c}):c>0?y(`chat.input.steering.queued`,{count:c}):(0,K.jsxs)(K.Fragment,{children:[y(`chat.input.steering.status`),y(`chat.input.steering.enterHint`)]})}),u>0&&(0,K.jsx)(`div`,{className:`px-4 pb-2 text-[11px] font-mono text-cyan-600 dark:text-cyan-400`,children:y(u===1?`chat.input.steering.recoveredOne`:`chat.input.steering.recoveredMany`,{count:u})}),sn&&(0,K.jsxs)(`div`,{role:`alert`,className:`mx-4 mb-2 flex min-h-8 items-center gap-2 rounded-md border border-red-200 bg-red-50 px-2.5 py-1.5 text-[11px] text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300`,children:[(0,K.jsx)(Ke,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{className:`flex-1 min-w-0`,children:sn}),be&&(0,K.jsx)(`button`,{type:`button`,"aria-label":y(`chat.error.dismiss`),onClick:()=>{xe(null),Ee.current=null},className:`flex justify-center items-center w-6 h-6 text-red-500 rounded shrink-0 hover:bg-red-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 dark:hover:bg-red-950`,children:(0,K.jsx)(an,{className:`w-3 h-3`})})]}),cn&&(0,K.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`mx-4 mb-2 flex min-h-8 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-2.5 py-1.5 text-[11px] text-[hsl(var(--deck-ink-muted))]`,children:[(0,K.jsx)(vt,{className:`h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]`}),(0,K.jsx)(`span`,{className:`flex-1 min-w-0`,children:cn}),(0,K.jsx)(`button`,{type:`button`,"aria-label":y(`chat.notice.dismiss`),onClick:()=>Ce(null),className:`flex h-6 w-6 shrink-0 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]`,children:(0,K.jsx)(an,{className:`w-3 h-3`})})]}),C.length>0&&(0,K.jsxs)(`div`,{className:`px-4 pb-2`,children:[(0,K.jsx)(`div`,{className:`mb-1.5 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]`,children:y(`chat.input.attachment.usage`,{count:C.length,limit:20,used:Wo(on),budget:Wo(5242880)})}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:C.map(e=>(0,K.jsxs)(`div`,{title:e.name,className:`relative overflow-hidden rounded-md border border-[#E5E7EB] bg-[#F9FAFB] dark:border-zinc-800 dark:bg-zinc-900`,children:[(0,K.jsx)(`img`,{src:e.dataUrl,alt:e.name,className:`object-cover w-20 h-20`}),(0,K.jsx)(`button`,{type:`button`,"aria-label":`${y(`chat.input.attachment.remove`)} ${e.name}`,title:`${y(`chat.input.attachment.remove`)} ${e.name}`,onClick:()=>zt(e.id),className:`flex absolute top-1 right-1 justify-center items-center w-6 h-6 text-white rounded transition-colors bg-black/75 hover:bg-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white`,children:(0,K.jsx)(an,{className:`w-3 h-3`})})]},e.id))})]}),(0,K.jsxs)(`div`,{className:`flex justify-between items-center px-3 py-2 mt-auto`,children:[(0,K.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[dn?(0,K.jsx)(`button`,{type:`button`,disabled:un,"aria-disabled":`true`,"aria-label":fn,title:fn,onClick:()=>{un||(Ce(fn),!Dt&&!o&&je.some(e=>e.input?.includes(`image`))&&le(!0))},className:`flex h-8 w-8 cursor-help items-center justify-center rounded-md text-[#9CA3AF] opacity-55 transition-colors hover:bg-[hsl(var(--deck-surface-2))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed dark:text-zinc-500`,children:(0,K.jsx)(At,{className:`w-4 h-4`})}):(0,K.jsxs)(`label`,{title:fn,className:`relative flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[#9CA3AF] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-within:ring-1 focus-within:ring-[hsl(var(--deck-accent))] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-300`,children:[(0,K.jsx)(`input`,{ref:ke,type:`file`,accept:`image/*`,multiple:!0,"aria-label":fn,className:`absolute inset-0 z-10 w-full h-full opacity-0 cursor-pointer`,onChange:Gt}),(0,K.jsx)(At,{className:`w-4 h-4`})]}),(0,K.jsxs)(io,{open:ce,onOpenChange:e=>{!o&&!R&&le(e)},children:[(0,K.jsx)(ao,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,disabled:ln||o||R,title:y(o?`chat.input.model.locked`:`chat.input.model.change`),className:`flex cursor-pointer items-center gap-1 rounded px-2 py-1 text-xs text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200`,children:[Tt,(0,K.jsx)(We,{className:`w-3 h-3`})]})}),(0,K.jsx)(oo,{className:`w-64 p-2 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700`,align:`start`,children:(0,K.jsx)(`div`,{className:`overflow-y-auto max-h-72`,children:je.length===0?(0,K.jsx)(`div`,{className:`text-xs text-[#6B7280] dark:text-zinc-500 px-2 py-2`,children:y(`chat.input.model.empty`)}):Object.entries(je.reduce((e,t)=>{let n=t.provider||`unknown`;return e[n]||(e[n]=[]),e[n].push(t),e},{})).map(([e,t])=>(0,K.jsxs)(`div`,{className:`mb-2`,children:[(0,K.jsx)(`div`,{className:`text-xs text-[#6B7280] dark:text-zinc-500 px-2 py-1 capitalize`,children:e.replace(/-/g,` `)}),t.map(e=>(0,K.jsx)(`button`,{className:`w-full text-left px-2 py-1.5 text-sm rounded hover:bg-[#E5E7EB] dark:hover:bg-zinc-800 transition-colors ${e.id===ot?`bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100`:`text-[#6B7280] dark:text-zinc-400`}`,onClick:()=>{if(Ce(null),Ge){Qe(e.id),le(!1);return}Fe(e.id,_??void 0).then(()=>le(!1)).catch(()=>void 0)},children:(0,K.jsxs)(`span`,{className:`flex gap-2 items-center min-w-0`,children:[(0,K.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:e.displayName||e.model}),e.input?.includes(`image`)&&(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-[hsl(var(--deck-accent-soft))] px-1.5 py-0.5 font-mono text-[8.5px] uppercase tracking-[0.08em] text-[hsl(var(--deck-accent))]`,children:y(`chat.input.model.vision`)})]})},e.id))]},e))})})]}),xt&&(0,K.jsxs)(io,{open:ue,onOpenChange:e=>{!o&&!R&&de(e)},children:[(0,K.jsx)(ao,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,disabled:ln||o||R,"aria-label":y(`chat.input.effort.change`),title:y(o?`chat.input.effort.locked`:`chat.input.effort.change`),className:`flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200`,children:[y(`chat.input.effort.label`,{effort:dt}),(0,K.jsx)(We,{className:`w-3 h-3`})]})}),(0,K.jsxs)(oo,{className:`w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900`,align:`start`,children:[(0,K.jsx)(`div`,{className:`px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600`,children:y(`chat.input.effort.heading`)}),(0,K.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:ct.map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-label":y(`chat.input.effort.option`,{effort:e}),onClick:()=>{et(e),de(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${dt===e?`bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100`:`text-[#6B7280] dark:text-zinc-400`}`,children:(0,K.jsx)(`span`,{className:`capitalize`,children:e})},e))})]})]}),Ct&&(0,K.jsxs)(io,{open:pe,onOpenChange:e=>{!o&&!R&&F(e)},children:[(0,K.jsx)(ao,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,disabled:ln||o||R,"aria-label":y(`chat.input.serviceTier.change`),title:y(o?`chat.input.serviceTier.locked`:`chat.input.serviceTier.change`),className:`flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200`,children:[y(`chat.input.serviceTier.label`,{tier:mt}),(0,K.jsx)(We,{className:`w-3 h-3`})]})}),(0,K.jsxs)(oo,{className:`w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900`,align:`start`,children:[(0,K.jsx)(`div`,{className:`px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600`,children:y(`chat.input.serviceTier.heading`)}),(0,K.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:pt.map(e=>(0,K.jsxs)(`button`,{type:`button`,"aria-label":y(`chat.input.serviceTier.option`,{tier:e}),onClick:()=>{nt(e),F(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${mt===e?`bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100`:`text-[#6B7280] dark:text-zinc-400`}`,children:[(0,K.jsx)(`span`,{className:`capitalize`,children:e}),e===`fast`&&(0,K.jsx)(`span`,{className:`text-[9px] text-[#9CA3AF] dark:text-zinc-600`,children:y(`chat.input.serviceTier.fastHint`)}),e===`flex`&&(0,K.jsx)(`span`,{className:`text-[9px] text-[#9CA3AF] dark:text-zinc-600`,children:y(`chat.input.serviceTier.flexHint`)})]},e))})]})]}),wt&&(0,K.jsxs)(io,{open:me,onOpenChange:e=>{!o&&!R&&he(e)},children:[(0,K.jsx)(ao,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,disabled:ln||o||R,"aria-label":y(`chat.input.responseVerbosity.change`),title:y(o?`chat.input.responseVerbosity.locked`:`chat.input.responseVerbosity.change`),className:`flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200`,children:[y(`chat.input.responseVerbosity.label`,{verbosity:_t}),(0,K.jsx)(We,{className:`w-3 h-3`})]})}),(0,K.jsxs)(oo,{className:`w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900`,align:`start`,children:[(0,K.jsx)(`div`,{className:`px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600`,children:y(`chat.input.responseVerbosity.heading`)}),(0,K.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:gt.map(e=>(0,K.jsxs)(`button`,{type:`button`,"aria-label":y(`chat.input.responseVerbosity.option`,{verbosity:e}),onClick:()=>{it(e),he(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${_t===e?`bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100`:`text-[#6B7280] dark:text-zinc-400`}`,children:[(0,K.jsx)(`span`,{className:`capitalize`,children:e}),e===`auto`&&(0,K.jsx)(`span`,{className:`text-[9px] text-[#9CA3AF] dark:text-zinc-600`,children:y(`chat.input.responseVerbosity.autoHint`)})]},e))})]})]}),(0,K.jsxs)(io,{open:oe,onOpenChange:e=>{!o&&!R&&j(e)},children:[(0,K.jsx)(ao,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,disabled:ln||o||R,"aria-label":y(`chat.input.outputSchema.change`),title:y(o?`chat.input.outputSchema.locked`:`chat.input.outputSchema.change`),className:`flex h-7 items-center gap-1 rounded px-1.5 font-mono text-[10.5px] transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 ${ie.trim()?`bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]`:`text-[#6B7280] hover:bg-[#E5E7EB] hover:text-[#111827] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200`}`,children:[(0,K.jsx)(Be,{className:`h-3.5 w-3.5`}),ie.trim()&&`JSON`]})}),(0,K.jsxs)(oo,{className:`w-[min(440px,calc(100vw-24px))] border border-[#E5E7EB] bg-white p-0 dark:border-zinc-700 dark:bg-zinc-900`,align:`start`,children:[(0,K.jsxs)(`div`,{className:`border-b border-[#E5E7EB] px-3 py-2.5 dark:border-zinc-800`,children:[(0,K.jsx)(`div`,{className:`font-mono text-[11px] font-semibold text-[#111827] dark:text-zinc-100`,children:y(`chat.input.outputSchema.title`)}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[10.5px] leading-4 text-[#6B7280] dark:text-zinc-500`,children:y(`chat.input.outputSchema.description`)})]}),(0,K.jsxs)(`div`,{className:`p-3`,children:[(0,K.jsx)(so,{value:ie,onChange:e=>{let t=e.target.value;k.current=t,ae(t),M(null),To(h,{content:E.current,attachments:D.current,outputSchema:t})},spellCheck:!1,"aria-label":y(`chat.input.outputSchema.editor`),"aria-invalid":!!se,placeholder:y(`chat.input.outputSchema.placeholder`),className:`min-h-[180px] resize-y border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] font-mono text-[11px] leading-5 focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]`}),se&&(0,K.jsxs)(`div`,{role:`alert`,className:`mt-2 flex items-center gap-1.5 text-[10.5px] text-red-600 dark:text-red-400`,children:[(0,K.jsx)(Ke,{className:`h-3.5 w-3.5`}),se]}),(0,K.jsxs)(`div`,{className:`mt-2.5 flex items-center justify-between gap-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>{let e=JSON.stringify({type:`object`,properties:{summary:{type:`string`}},required:[`summary`],additionalProperties:!1},null,2);k.current=e,ae(e),M(null),To(h,{content:E.current,attachments:D.current,outputSchema:e})},className:`rounded px-2 py-1 font-mono text-[10.5px] text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-accent-soft))]`,children:y(`chat.input.outputSchema.example`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{k.current=``,ae(``),M(null),To(h,{content:E.current,attachments:D.current,outputSchema:``})},className:`rounded px-2 py-1 font-mono text-[10.5px] text-[#6B7280] hover:bg-[#F3F4F6] dark:text-zinc-400 dark:hover:bg-zinc-800`,children:y(`chat.input.outputSchema.clear`)})]})]})]})]}),(0,K.jsxs)(io,{open:ge,onOpenChange:L,children:[(0,K.jsx)(ao,{asChild:!0,children:(0,K.jsxs)(`button`,{"data-blade-permission-mode":Ie,className:`flex items-center gap-1.5 rounded px-2 py-1 text-xs transition-colors ${$t.tone===`danger`?`text-amber-600 hover:bg-amber-500/10 dark:text-amber-400`:`text-[#6B7280] hover:bg-[#E5E7EB] hover:text-[#111827] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200`}`,children:[(0,K.jsx)(tn,{className:`h-3.5 w-3.5`}),en,(0,K.jsx)(We,{className:`w-3 h-3`})]})}),(0,K.jsxs)(oo,{className:`w-72 p-1.5 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700`,align:`start`,children:[(0,K.jsx)(`div`,{className:`px-2 pb-1.5 pt-1 text-[11px] font-medium text-[#9CA3AF] dark:text-zinc-500`,children:y(`chat.input.mode.aria`)}),(0,K.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:Ro.map(e=>{let t=e.icon,r=Ie===e.value,i=e.tone===`danger`;return(0,K.jsxs)(`button`,{type:`button`,"data-blade-permission-option":e.value,"aria-pressed":r,className:`flex w-full items-start gap-2.5 rounded-md px-2 py-2 text-left transition-colors ${r?`bg-[#F3F4F6] dark:bg-zinc-800/70`:`hover:bg-[#F3F4F6] dark:hover:bg-zinc-800/50`}`,onClick:()=>{e.value===n.YOLO&&Ie!==n.YOLO?(L(!1),ve(!0)):(Le(e.value),L(!1))},children:[(0,K.jsx)(t,{className:`mt-0.5 h-4 w-4 shrink-0 ${i?`text-amber-500`:r?`text-[#111827] dark:text-zinc-100`:`text-[#6B7280] dark:text-zinc-400`}`}),(0,K.jsxs)(`span`,{className:`flex-1 min-w-0`,children:[(0,K.jsx)(`span`,{className:`block text-[13px] font-medium leading-tight ${i?`text-amber-600 dark:text-amber-400`:`text-[#111827] dark:text-zinc-100`}`,children:y(e.labelKey)}),(0,K.jsx)(`span`,{className:`mt-0.5 block text-[11px] leading-snug text-[#6B7280] dark:text-zinc-500`,children:y(e.descriptionKey)})]}),r&&(0,K.jsx)(He,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]`})]},e.value)})})]})]})]}),(0,K.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[o&&(0,K.jsx)(sr,{size:`icon`,onClick:Rt,disabled:Ue||s,title:y(s?`chat.input.action.stopping`:`chat.input.action.stop`),"aria-label":y(s?`chat.input.action.stopping`:`chat.input.action.stop`),className:`w-8 h-8 text-white bg-red-500 hover:bg-red-600`,children:s?(0,K.jsx)(bt,{className:`h-3.5 w-3.5 animate-spin`}):(0,K.jsx)(Xt,{className:`w-3 h-3`})}),(0,K.jsx)(sr,{size:`icon`,"data-blade-submit":!0,onClick:Lt,disabled:!nn||ln||Te||kt||R||It,title:y(R?`chat.input.action.submitting`:o?`chat.input.action.steer`:`chat.input.action.send`),"aria-label":y(R?`chat.input.action.submitting`:o?`chat.input.action.steer`:`chat.input.action.send`),className:`h-8 w-8 bg-[#111827] text-white hover:bg-[#0F172A] disabled:bg-[#E5E7EB] disabled:text-[#9CA3AF] dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-white dark:disabled:bg-zinc-800 dark:disabled:text-zinc-600`,children:R?(0,K.jsx)(bt,{className:`w-4 h-4 animate-spin`}):(0,K.jsx)(Ht,{className:`w-4 h-4`})})]})]})]}),d===`chat`&&(0,K.jsx)(`div`,{className:`text-center text-xs text-[#6B7280] dark:text-zinc-600 mt-3 font-mono`,children:y(`chat.footer.disclaimer`)})]}),(0,K.jsx)(cr,{open:_e,onOpenChange:ve,children:(0,K.jsx)(dr,{className:`gap-0 rounded-xl border border-zinc-200 bg-white p-0 dark:border-zinc-800 dark:bg-[#09090b] sm:max-w-[400px]`,"aria-describedby":`yolo-confirm-desc`,hideCloseButton:!0,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-4 p-5`,children:[(0,K.jsxs)(`div`,{className:`flex gap-3 items-center`,children:[(0,K.jsx)(`div`,{className:`flex justify-center items-center w-9 h-9 bg-amber-100 rounded-full dark:bg-amber-950/40`,children:(0,K.jsx)(Wt,{className:`w-5 h-5 text-amber-600 dark:text-amber-400`})}),(0,K.jsx)(mr,{className:`font-mono text-sm font-semibold`,children:y(`chat.input.mode.yolo.confirm.title`)})]}),(0,K.jsx)(hr,{id:`yolo-confirm-desc`,className:`text-[13px] leading-relaxed text-zinc-600 dark:text-zinc-400`,children:y(`chat.input.mode.yolo.confirm.desc`)}),(0,K.jsxs)(`div`,{className:`flex gap-2 justify-end items-center pt-1`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>ve(!1),className:`h-8 rounded-md px-3 font-mono text-[12px] font-medium text-zinc-600 transition-colors hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800`,children:y(`chat.input.mode.yolo.confirm.cancel`)}),(0,K.jsx)(`button`,{type:`button`,"data-blade-yolo-confirm":!0,onClick:()=>{Le(n.YOLO),ve(!1)},className:`h-8 rounded-md bg-amber-600 px-3 font-mono text-[12px] font-semibold text-white transition-colors hover:bg-amber-700`,children:y(`chat.input.mode.yolo.confirm.accept`)})]})]})})})]})}function Ko({className:e,size:t=28,pulse:n=!0}){return(0,K.jsxs)(`span`,{className:G(`inline-flex relative justify-center items-center`,`text-[hsl(var(--deck-ink))]`,e),style:{width:t,height:t},"aria-hidden":`true`,children:[(0,K.jsxs)(`svg`,{viewBox:`0 0 32 32`,width:t,height:t,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,K.jsx)(`path`,{d:`M16 3 L28 16 L16 29 L4 16 Z`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinejoin:`round`}),(0,K.jsx)(`path`,{d:`M16 8 L24 16 L16 24`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinejoin:`round`,strokeLinecap:`round`,opacity:`0.55`}),(0,K.jsx)(`path`,{d:`M16 3 L20 7`,stroke:`hsl(var(--deck-accent))`,strokeWidth:`2`,strokeLinecap:`round`})]}),n&&(0,K.jsx)(`span`,{className:`absolute top-[3px] right-[3px] h-1.5 w-1.5 rounded-full`,style:{background:`hsl(var(--deck-accent-glow))`,boxShadow:`0 0 6px hsl(var(--deck-accent-glow) / 0.9)`}})]})}var qo=`[data-mobile-navigation-trigger]`;function Jo(e){return Yo(qo,e)}function Yo(e,t){let n=document.querySelector(e);return!n||n.getClientRects().length===0?!1:(t.preventDefault(),n.focus({preventScroll:!0}),!0)}function Xo({open:e,onOpenChange:t}){let n=Me(),{boundProjects:r,selectedProjectPath:i,isBindingProject:a,loadBoundProjects:o,bindProject:s,unbindProject:c,selectProject:l,startTemporarySession:u}=$(),d=$(e=>I(e.historySurfaceSelection)),[f,p]=(0,H.useState)(``),[m,h]=(0,H.useState)(null),[g,_]=(0,H.useState)(!1),v=(0,H.useRef)(0);(0,H.useEffect)(()=>{if(e&&!d){o();return}v.current+=1,_(!1)},[d,o,e]);let y=async e=>{re($.getState())||(await s(e),p(``),u(),t(!1))},b=async e=>{if(e.preventDefault(),!(!f.trim()||a||g)){h(null);try{await y(f.trim())}catch(e){h(e instanceof Error?e.message:n(`projects.bind.failed`))}}},x=async()=>{if(re($.getState())||g||a)return;let e=++v.current;h(null),_(!0);try{let t=await Y.pickProjectDirectory();if(e!==v.current||t.cancelled)return;p(t.path),await y(t.path)}catch(t){if(e!==v.current)return;h(t instanceof Error?t.message:n(`projects.pick.failed`))}finally{e===v.current&&_(!1)}},S=e=>{re($.getState())||(l(e),u(),t(!1))};return!e||d?null:(0,K.jsx)(cr,{open:e,onOpenChange:t,children:(0,K.jsxs)(dr,{onCloseAutoFocus:e=>Yo(`[data-project-setup-trigger]`,e),className:`border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] text-[hsl(var(--deck-ink))] sm:max-w-xl`,children:[(0,K.jsxs)(fr,{children:[(0,K.jsxs)(mr,{className:`flex items-center gap-2 font-mono text-[16px]`,children:[(0,K.jsx)(ct,{className:`h-4 w-4 text-[hsl(var(--deck-accent))]`}),n(`projects.dialog.title`)]}),(0,K.jsx)(hr,{className:`text-[12px] text-[hsl(var(--deck-ink-muted))]`,children:n(`projects.dialog.description`)})]}),(0,K.jsxs)(`form`,{onSubmit:b,className:`flex gap-2`,children:[(0,K.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),disabled:a,placeholder:n(`projects.bind.placeholder`),"aria-label":n(`projects.bind.pathLabel`),className:`h-9 min-w-0 flex-1 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 font-mono text-[12px] outline-none placeholder:text-[hsl(var(--deck-ink-faint))] focus:border-[hsl(var(--deck-accent)/0.65)]`}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>void x(),disabled:g||a,title:n(`projects.pick.action`),"aria-label":n(`projects.pick.action`),className:`inline-flex h-9 shrink-0 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2.5 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))] disabled:cursor-wait disabled:opacity-50`,children:[g?(0,K.jsx)(bt,{className:`h-3.5 w-3.5 animate-spin`}):(0,K.jsx)(ot,{className:`h-3.5 w-3.5`}),(0,K.jsx)(`span`,{className:`hidden sm:inline`,children:n(g?`projects.pick.picking`:`projects.pick.actionShort`)})]}),(0,K.jsxs)(`button`,{type:`submit`,disabled:!f.trim()||a||g,className:`inline-flex h-9 items-center gap-2 rounded-md bg-[hsl(var(--deck-ink))] px-3 font-mono text-[12px] text-[hsl(var(--deck-canvas))] transition-opacity disabled:opacity-40`,children:[a?(0,K.jsx)(bt,{className:`h-3.5 w-3.5 animate-spin`}):(0,K.jsx)(ct,{className:`h-3.5 w-3.5`}),n(`projects.bind.action`)]})]}),m&&(0,K.jsx)(`div`,{role:`alert`,className:`rounded-md border border-red-200 bg-red-50 px-3 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300`,children:m}),(0,K.jsx)(`div`,{className:`max-h-72 space-y-1 overflow-y-auto`,children:r.map(e=>{let t=e.path===i;return(0,K.jsxs)(`div`,{className:G(`group flex items-center gap-3 rounded-md border px-3 py-2`,t?`border-[hsl(var(--deck-accent)/0.55)] bg-[hsl(var(--deck-accent-soft))]`:`border-transparent hover:border-[hsl(var(--deck-border))] hover:bg-[hsl(var(--deck-surface))]`),children:[(0,K.jsx)(it,{className:G(`h-4 w-4 shrink-0`,t?`text-[hsl(var(--deck-accent))]`:`text-[hsl(var(--deck-ink-faint))]`)}),(0,K.jsxs)(`button`,{type:`button`,disabled:!e.available,onClick:()=>S(e.path),className:`min-w-0 flex-1 text-left disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,K.jsx)(`span`,{className:`block truncate font-mono text-[12px] text-[hsl(var(--deck-ink))]`,children:e.name}),(0,K.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1.5 truncate font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]`,children:[e.gitBranch&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ut,{className:`h-2.5 w-2.5`}),(0,K.jsx)(`span`,{children:e.gitBranch}),(0,K.jsx)(`span`,{children:`·`})]}),(0,K.jsx)(`span`,{className:`truncate`,children:e.path}),!e.available&&(0,K.jsxs)(`span`,{className:`shrink-0 text-red-500`,children:[`· `,n(`projects.unavailable`)]})]})]}),!e.isCurrent&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>re($.getState())?void 0:void c(e.path).catch(()=>void 0),title:n(`projects.unbind.action`),"aria-label":n(`projects.unbind.action`),className:`rounded p-1.5 text-[hsl(var(--deck-ink-faint))] opacity-0 transition group-hover:opacity-100 hover:bg-red-50 hover:text-red-600 focus-visible:opacity-100 dark:hover:bg-red-950/30`,children:(0,K.jsx)(Qt,{className:`h-3.5 w-3.5`})})]},e.path)})})]})})}function Zo(e,t){let n=e.title?.trim();if(n===`Code Review`)return t(`session.title.codeReview`);if(n)return n;let r=e.firstMessageTime||e.lastMessageTime;if(r){let e=new Date(r);if(!Number.isNaN(e.getTime()))return t(`recent.session.fallbackDated`,{y:String(e.getFullYear()).slice(-2),m:String(e.getMonth()+1).padStart(2,`0`),d:String(e.getDate()).padStart(2,`0`),hh:String(e.getHours()).padStart(2,`0`),mm:String(e.getMinutes()).padStart(2,`0`)})}return t(`recent.session.fallbackShort`,{id:e.sessionId.slice(0,6)})}function Qo(e){let t=e.lastMessageTime||e.firstMessageTime;if(!t)return 0;let n=new Date(t).getTime();return Number.isNaN(n)?0:n}function $o(e){return e.pendingInteraction?0:e.taskStatus===`running`?1:e.taskStatus===`queued`?2:3}function es(e,t){return $o(e)-$o(t)||Qo(t)-Qo(e)}var ts={running:{dot:`bg-blue-500 shadow-[0_0_5px_rgba(59,130,246,0.7)] animate-pulse`,labelKey:`recent.status.running`,text:`text-blue-700 dark:text-blue-400`},queued:{dot:`bg-amber-400`,labelKey:`recent.status.queued`,text:`text-amber-700 dark:text-amber-400`},interrupted:{dot:`bg-orange-500`,labelKey:`recent.status.paused`,text:`text-orange-700 dark:text-orange-400`},failed:{dot:`bg-red-500`,labelKey:`recent.status.failed`,text:`text-red-700 dark:text-red-400`},cancelled:{dot:`bg-zinc-400`,labelKey:`recent.status.cancelled`,text:`text-zinc-500`},completed:{dot:`bg-[hsl(var(--deck-accent))]`,labelKey:`recent.status.done`,text:`text-[hsl(var(--deck-accent))]`}};function ns(e,t){if(!e)return``;let n=new Date(e);if(Number.isNaN(n.getTime()))return``;let r=Date.now()-n.getTime(),i=Math.floor(r/6e4);if(i<1)return t(`recent.time.justNow`);if(i<60)return t(`recent.time.minutes`,{n:i});let a=Math.floor(i/60);return a<24?t(`recent.time.hours`,{n:a}):t(`recent.time.days`,{n:Math.floor(a/24)})}function rs(e){return e.split(`/`).filter(Boolean).at(-1)||e}function is({sessions:e,onSelect:t,cancellingTaskKeys:n,retryingTaskKeys:r,unreadTaskKeys:i,onCancel:a,onRetry:o,catalogLoadState:s=`ready`,className:c}){let l=Me(),u=[...e].sort(es).slice(0,4),d=s===`loading`||s===`hydrating`;return u.length===0?!d&&s!==`error`?null:(0,K.jsxs)(`div`,{role:s===`error`?`alert`:`status`,className:G(`mt-7 flex items-center gap-2 rounded-md border border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface))]/50 px-3 py-2 font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]`,c),children:[d?(0,K.jsx)(bt,{className:`h-3 w-3 animate-spin text-[hsl(var(--deck-accent))]`}):(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-amber-500`}),l(d?`sidebar.catalog.syncing`:`sidebar.catalog.incomplete`)]}):(0,K.jsxs)(`div`,{className:G(`mt-7`,c),children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,K.jsx)(`span`,{className:`deck-eyebrow text-[hsl(var(--deck-ink-faint))]`,children:l(`taskHome.recent.title`)}),(0,K.jsx)(`span`,{className:`font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]`,children:l(d?`taskHome.recent.partial`:s===`error`?`taskHome.recent.incomplete`:`taskHome.recent.total`,{count:e.length})})]}),(0,K.jsx)(`div`,{className:`grid grid-cols-1 gap-1 sm:grid-cols-2`,children:u.map(e=>{let s=ts[e.taskStatus],c=e.pendingInteraction?e.pendingInteraction.type===`question`?`interaction.badge.question`:e.pendingInteraction.type===`elicitation`?`interaction.badge.elicitation`:`interaction.badge.permission`:null,u=rs(e.taskSourceProjectPath||e.projectPath),d=Zo(e,l),f=Z(X(e)),p=e.taskStatus===`running`||e.taskStatus===`queued`,m=n.includes(f),h=r.includes(f),g=!!e.taskRetryAvailable&&(e.taskStatus===`failed`||e.taskStatus===`interrupted`||e.taskStatus===`cancelled`),_=i.includes(f),v=la(e,l);return(0,K.jsxs)(`div`,{className:G(`group flex items-center gap-3 rounded-md border border-transparent px-3 py-1.5 text-left transition-colors`,`hover:border-[hsl(var(--deck-border))] hover:bg-[hsl(var(--deck-surface))]`),children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>t(e),className:`flex min-w-0 flex-1 items-center gap-3 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]`,children:[(0,K.jsx)(`span`,{className:G(`h-1.5 w-1.5 shrink-0 rounded-full`,c?`animate-pulse bg-amber-500 shadow-[0_0_5px_rgba(245,158,11,0.75)]`:s.dot)}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[12.5px] text-[hsl(var(--deck-ink))]`,children:[(0,K.jsx)(`span`,{className:`truncate`,children:d}),_&&(0,K.jsx)(`span`,{title:l(`taskSwitcher.new`),className:`h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))] shadow-[0_0_5px_hsl(var(--deck-accent-glow)/0.75)]`}),e.taskRetriedFrom&&(0,K.jsx)(`span`,{title:`${l(`session.retriedFrom`)} ${e.taskRetriedFrom.sessionId.slice(0,6)}`,className:`shrink-0 font-mono text-[8.5px] text-[hsl(var(--deck-accent))]`,children:l(`session.retryShort`)})]}),(0,K.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1.5 truncate font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]`,children:[(0,K.jsx)(`span`,{className:`truncate`,children:u}),(0,K.jsx)(`span`,{className:`opacity-40`,children:`·`}),(0,K.jsx)(`span`,{className:G(`shrink-0`,c?`text-amber-700 dark:text-amber-400`:s.text),children:l(c??s.labelKey)}),(0,K.jsx)(`span`,{className:`opacity-40`,children:`·`}),(0,K.jsx)(`span`,{className:`shrink-0`,children:ns(e.lastMessageTime||e.firstMessageTime,l)})]}),v&&(0,K.jsx)(`span`,{title:v,className:`mt-0.5 block truncate font-mono text-[9.5px] text-red-600 dark:text-red-400`,children:v})]}),(0,K.jsx)(Ie,{className:`h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))] opacity-0 transition-opacity group-hover:opacity-100`})]}),p&&(0,K.jsx)(`button`,{type:`button`,"aria-label":l(m?`session.action.stopping`:`session.action.stop`,{title:d}),disabled:m,onClick:()=>a(e),className:`rounded p-1.5 text-red-500 transition-colors hover:bg-red-500/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 disabled:cursor-wait disabled:opacity-60`,children:m?(0,K.jsx)(bt,{className:`h-3.5 w-3.5 animate-spin`}):(0,K.jsx)(Xt,{className:`h-3.5 w-3.5`})}),g&&(0,K.jsx)(`button`,{type:`button`,"aria-label":l(h?`session.action.retrying`:`session.action.retry`,{title:d}),disabled:h,onClick:()=>o(e),className:`rounded p-1.5 text-[hsl(var(--deck-accent))] transition-colors hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-wait disabled:opacity-60`,children:h?(0,K.jsx)(bt,{className:`h-3.5 w-3.5 animate-spin`}):(0,K.jsx)(It,{className:`h-3.5 w-3.5`})})]},f)})})]})}function as({index:e,title:t,description:n,icon:r,hint:i,onClick:a}){let o=String(e+1).padStart(2,`0`),s=`⌘${e+1}`;return(0,K.jsxs)(`button`,{type:`button`,onClick:a,className:G(`group relative flex min-h-[100px] flex-col justify-between overflow-hidden rounded-lg border p-3.5 text-left transition`,`border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]`,`hover:-translate-y-[1px] hover:border-[hsl(var(--deck-accent)/0.55)] hover:shadow-[0_10px_28px_-14px_hsl(var(--deck-accent)/0.35)]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--deck-accent))] focus-visible:ring-offset-2 focus-visible:ring-offset-[hsl(var(--deck-canvas))]`,`dark:bg-[hsl(var(--deck-surface))] dark:hover:shadow-[0_10px_28px_-14px_hsl(var(--deck-accent)/0.55)]`),children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:G(`pointer-events-none absolute right-3 top-3 h-2 w-2`,`border-r border-t border-[hsl(var(--deck-border-strong))]`,`transition-colors group-hover:border-[hsl(var(--deck-accent))]`)}),(0,K.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,K.jsx)(`span`,{className:G(`inline-flex h-8 w-8 items-center justify-center rounded-md border transition-colors`,`border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))]`,`group-hover:border-[hsl(var(--deck-accent)/0.5)] group-hover:bg-[hsl(var(--deck-accent-soft))]`),children:(0,K.jsx)(r,{className:`h-4 w-4 text-[hsl(var(--deck-ink-muted))] transition-colors group-hover:text-[hsl(var(--deck-accent))]`})}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] tracking-[0.16em] text-[hsl(var(--deck-ink-faint))]`,children:o})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-[13px] font-semibold text-[hsl(var(--deck-ink))]`,children:t}),(0,K.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[11.5px] leading-[1.45] text-[hsl(var(--deck-ink-muted))]`,children:n}),(0,K.jsxs)(`div`,{className:`mt-2 flex items-center justify-between`,children:[(0,K.jsx)(`span`,{className:`truncate font-mono text-[10px] text-[hsl(var(--deck-ink-faint))] opacity-0 transition-opacity group-hover:opacity-100`,children:i}),(0,K.jsx)(`span`,{className:`deck-kbd shrink-0 opacity-0 transition-opacity group-hover:opacity-100`,children:s})]})]})]})}var os=[{key:`explore`,titleKey:`taskHome.template.explore.title`,descriptionKey:`taskHome.template.explore.description`,icon:Bt,prompt:`Explore this codebase and explain `,hintKey:`taskHome.template.explore.hint`},{key:`build`,titleKey:`taskHome.template.build.title`,descriptionKey:`taskHome.template.build.description`,icon:ft,prompt:`Build a production-ready `,hintKey:`taskHome.template.build.hint`},{key:`review`,titleKey:`taskHome.template.review.title`,descriptionKey:`taskHome.template.review.description`,icon:Rt,prompt:`/review uncommitted`,hintKey:`taskHome.template.review.hint`},{key:`fix`,titleKey:`taskHome.template.fix.title`,descriptionKey:`taskHome.template.fix.description`,icon:nn,prompt:`Investigate and fix `,hintKey:`taskHome.template.fix.hint`}];function ss(e,t){return t?t.split(`/`).filter(Boolean).at(-1)||t:e(`taskHome.hero.projectFallback`)}function cs(){let e=Me(),{taskWorkspaceInfo:t,historySurfaceSelection:n,isTaskWorkspaceLoading:r,taskWorkspaceError:i,isDispatchingTask:a,sessions:o,boundProjects:s,selectedProjectPath:c,error:l,selectProject:u,dispatchTask:d,startCodeReview:f,sendMessage:p,startTemporarySession:m,selectSession:h,cancelTask:g,cancellingTaskKeys:_,retryTask:v,retryingTaskKeys:y,unreadTaskKeys:b,taskEventConnectionState:x,catalogLoadState:S,reconnectTaskEvents:C,clearError:w,loadTaskWorkspaceInfo:T,loadBoundProjects:ee}=$(),E=I(n),D=A(e=>e.openSettings),te=A(e=>e.isSettingsOpen),O=Ti(e=>e.currentMode),ne=Ti(e=>e.currentModelId),ie=Ti(e=>e.configuredModels),ae=Ti(e=>e.isLoading),k=Ti(e=>e.hasLoaded),oe=Ti(e=>e.loadedWorkspacePath),j=Ti(e=>e.error),se=Ti(e=>e.loadModels),[M,N]=(0,H.useState)(`worktree`),[P,ce]=(0,H.useState)(),[le,ue]=(0,H.useState)(!1),de=e(x===`connected`?`taskHome.eyebrow`:x===`reconnecting`?`taskHome.feed.reconnecting`:x===`offline`?`taskHome.feed.offline`:`taskHome.feed.connecting`),fe=(0,H.useMemo)(()=>s.find(e=>e.path===c)??s.find(e=>e.isCurrent),[s,c]),pe=(0,H.useMemo)(()=>Si(o,c,t?.cwd??null),[c,o,t?.cwd]),F=(fe?.available?fe.path:void 0)??t?.cwd,me=`task:${F??`unavailable`}`;(0,H.useEffect)(()=>{!te&&F&&(!k||oe!==F)&&se(F)},[te,se,oe,k,F]);let he=!fe?.available&&r,ge=fe?.available?null:i,L=!(!F||he||ge),_e=!!(ne&&ie.some(e=>e.id===ne)),ve=!k||ae,R=L&&_e&&!ve&&j===null,ye=(0,H.useMemo)(()=>({project:ss(e,fe?.path??t?.cwd),branch:fe?.gitBranch??t?.gitBranch??e(`taskHome.context.branchFallback`)}),[fe,t,e]),be=(0,H.useCallback)(async t=>{if(re($.getState()))return;let n=t.content.trim();if(n===`/review`||n.startsWith(`/review `)){if(t.attachments.length>0)throw Error(e(`taskHome.review.attachmentsUnsupported`));if(t.outputSchema)throw Error(e(`taskHome.review.outputSchemaUnsupported`));let r=n.split(/\s+/),i=r[1]||`uncommitted`;if(i!==`uncommitted`&&i!==`base`&&i!==`commit`||i===`uncommitted`&&r.length!==2&&r.length!==1||(i===`base`||i===`commit`)&&r.length!==3)throw Error(e(`taskHome.review.usage`));await f({projectPath:F,kind:i,...r[2]?{ref:r[2]}:{},modelId:t.modelId??ne??void 0});return}if(t.content.trimStart().startsWith(`!`)){m(F),await p({content:t.content,attachments:[]});return}await d({prompt:t.content,projectPath:F,isolation:M,permissionMode:O,modelId:t.modelId??ne??void 0,reasoningEffort:t.reasoningEffort,serviceTier:t.serviceTier,responseVerbosity:t.responseVerbosity,communicationStyle:t.communicationStyle,...t.outputSchema?{outputSchema:t.outputSchema}:{},attachments:t.attachments.map(e=>({type:`image`,content:e.dataUrl,mimeType:e.mimeType,name:e.name}))})},[O,ne,d,M,p,f,m,F,e]);return(0,H.useEffect)(()=>{let e=e=>{if(!(e.metaKey||e.ctrlKey))return;let t=Number.parseInt(e.key,10);if(Number.isNaN(t)||t<1||t>os.length)return;let n=os[t-1];n&&(e.preventDefault(),ce({key:me,content:n.prompt}))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[me]),(0,K.jsx)(`main`,{className:`deck-canvas relative flex-1 overflow-y-auto text-[hsl(var(--deck-ink))]`,children:(0,K.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-[960px] flex-col px-6 py-8 md:px-8 md:py-10`,children:[(0,K.jsxs)(`div`,{className:`flex gap-4 items-start mb-6`,children:[(0,K.jsx)(Ko,{size:36,className:`hidden mt-1 sm:inline-flex`}),(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsxs)(`div`,{className:G(`deck-eyebrow flex items-center gap-2`,x===`offline`?`text-amber-700 dark:text-amber-400`:`text-[hsl(var(--deck-accent))]`),children:[x===`offline`?(0,K.jsx)(en,{className:`w-3 h-3`}):(0,K.jsx)(`span`,{className:`deck-pulse-dot`}),de]}),(0,K.jsxs)(`h1`,{className:`mt-2.5 max-w-3xl text-balance text-[clamp(28px,3vw,34px)] font-medium leading-[1.12] tracking-[-0.028em] text-[hsl(var(--deck-ink))]`,children:[e(`taskHome.hero.prefix`),` `,(0,K.jsx)(`span`,{className:`whitespace-nowrap font-mono text-[0.82em] text-[hsl(var(--deck-accent))]`,children:ye.project}),(0,K.jsx)(`span`,{className:`text-[hsl(var(--deck-ink-muted))]`,children:`?`})]}),(0,K.jsx)(`p`,{className:`mt-2 max-w-[46rem] text-[13px] leading-[1.55] text-[hsl(var(--deck-ink-muted))]`,children:e(`taskHome.hero.subtitle`)})]})]}),(0,K.jsxs)(`div`,{className:`mb-4`,children:[(0,K.jsxs)(`div`,{className:`flex justify-between items-center mb-2`,children:[(0,K.jsx)(`span`,{className:`deck-eyebrow text-[hsl(var(--deck-ink-faint))]`,children:e(`taskHome.templates.title`)}),(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]`,children:[(0,K.jsx)(Qe,{className:`w-3 h-3`}),(0,K.jsx)(`span`,{children:e(`taskHome.templates.hint`)})]})]}),(0,K.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:os.map((t,n)=>(0,K.jsx)(as,{index:n,title:e(t.titleKey),description:e(t.descriptionKey),icon:t.icon,hint:e(t.hintKey),onClick:()=>ce({key:me,content:t.prompt})},t.key))})]}),(0,K.jsxs)(`div`,{"data-blade-task-dispatch-ready":R?`true`:`false`,"data-blade-task-workspace-ready":L?`true`:`false`,"data-blade-task-model-ready":_e?`true`:`false`,"data-blade-task-model-loaded":k?`true`:`false`,"data-blade-task-model-loading":ae?`true`:`false`,className:`rounded-xl border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] shadow-[0_28px_80px_-32px_hsl(var(--deck-accent)/0.28),0_2px_0_hsl(var(--deck-hairline))]`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-0 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface-2))]/50`,children:[(0,K.jsxs)(`div`,{className:`flex flex-1 items-center min-w-0`,children:[(0,K.jsxs)(io,{children:[(0,K.jsx)(ao,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,"aria-label":e(`taskHome.context.projectSelect`),disabled:s.length===0,className:`group flex h-9 min-w-0 items-center gap-2 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11.5px] text-[hsl(var(--deck-ink))] transition-colors hover:bg-[hsl(var(--deck-surface))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-[hsl(var(--deck-accent))] disabled:opacity-50`,children:[(0,K.jsx)(it,{className:`h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]`}),(0,K.jsx)(`span`,{className:`font-medium truncate`,children:fe?.name??ye.project}),(0,K.jsx)(We,{className:`h-3 w-3 shrink-0 text-[hsl(var(--deck-ink-faint))] transition-transform group-data-[state=open]:rotate-180`})]})}),(0,K.jsx)(oo,{align:`start`,sideOffset:4,className:`w-56 rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-1 shadow-xl`,children:(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[s.map(e=>(0,K.jsxs)(`button`,{type:`button`,disabled:!e.available,onClick:()=>{u(e.path)},className:G(`flex items-center gap-2 rounded-md px-2.5 py-1.5 text-left font-mono text-[12px] transition-colors`,e.path===c?`bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]`:`text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-ink))]`,!e.available&&`opacity-40`),children:[(0,K.jsx)(it,{className:`w-3 h-3 shrink-0`}),(0,K.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:e.name}),e.path===c&&(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))]`})]},e.path)),s.length===0&&(0,K.jsx)(`span`,{className:`px-2.5 py-2 text-center font-mono text-[11px] text-[hsl(var(--deck-ink-faint))]`,children:e(`taskHome.setup.workspace.empty`)})]})})]}),(0,K.jsxs)(`button`,{type:`button`,"data-blade-task-isolation":M,"aria-pressed":M===`worktree`,onClick:()=>N(e=>e===`worktree`?`local`:`worktree`),className:G(`flex h-9 shrink-0 items-center gap-1.5 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11px] transition-colors`,M===`worktree`?`text-[hsl(var(--deck-accent))]`:`text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]`),title:e(`taskHome.context.isolationToggleTitle`),children:[M===`worktree`?(0,K.jsx)(Ot,{className:`w-3 h-3`}):(0,K.jsx)(gt,{className:`w-3 h-3`}),(0,K.jsx)(`span`,{className:`hidden sm:inline`,children:e(M===`worktree`?`taskHome.context.isolation.worktree`:`taskHome.context.isolation.local`)})]}),(0,K.jsxs)(`span`,{className:`flex h-9 shrink-0 items-center gap-1.5 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]`,children:[(0,K.jsx)(ut,{className:`w-3 h-3`}),(0,K.jsx)(`span`,{className:`hidden sm:inline`,children:ye.branch})]})]}),(0,K.jsxs)(`div`,{className:`flex gap-2 items-center px-3 shrink-0`,children:[t?.taskAdmission&&(0,K.jsx)(Ia,{inFlight:t.taskAdmission.inFlight,queued:t.taskAdmission.queued,maxConcurrent:t.taskAdmission.maxConcurrent,compact:!0}),a&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-mono text-[10.5px] text-[hsl(var(--deck-accent))]`,children:[(0,K.jsx)(bt,{className:`w-3 h-3 animate-spin`}),(0,K.jsx)(`span`,{className:`hidden sm:inline`,children:e(`taskHome.context.preparing`)})]})]})]}),!R&&(0,K.jsxs)(`section`,{"aria-label":e(`taskHome.setup.aria`),className:`border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))] px-3 py-3`,children:[(0,K.jsxs)(`div`,{className:`mb-2.5`,children:[(0,K.jsx)(`h2`,{className:`font-mono text-[11px] font-semibold uppercase tracking-[0.12em] text-[hsl(var(--deck-ink))]`,children:e(`taskHome.setup.title`)}),(0,K.jsx)(`p`,{className:`mt-0.5 text-[11px] text-[hsl(var(--deck-ink-faint))]`,children:e(`taskHome.setup.description`)})]}),(0,K.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-2.5`,children:[(0,K.jsx)(`span`,{className:G(`flex justify-center items-center w-7 h-7 rounded-md border shrink-0`,L?`text-emerald-700 bg-emerald-50 border-emerald-300/70 dark:border-emerald-800/70 dark:bg-emerald-950/40 dark:text-emerald-300`:ge?`text-red-700 bg-red-50 border-red-300/70 dark:border-red-900/70 dark:bg-red-950/40 dark:text-red-300`:`text-amber-700 bg-amber-50 border-amber-300/70 dark:border-amber-800/70 dark:bg-amber-950/40 dark:text-amber-300`),children:he?(0,K.jsx)(bt,{className:`h-3.5 w-3.5 animate-spin`}):L?(0,K.jsx)(Je,{className:`h-3.5 w-3.5`}):ge?(0,K.jsx)(Ke,{className:`h-3.5 w-3.5`}):(0,K.jsx)(it,{className:`h-3.5 w-3.5`})}),(0,K.jsxs)(`span`,{className:`flex-1 min-w-0`,children:[(0,K.jsx)(`span`,{className:`block font-mono text-[11px] font-medium text-[hsl(var(--deck-ink))]`,children:e(`taskHome.setup.workspace.title`)}),(0,K.jsx)(`span`,{className:`mt-0.5 block truncate text-[10.5px] text-[hsl(var(--deck-ink-faint))]`,children:he?e(`taskHome.setup.workspace.loading`):ge||(L?e(`taskHome.setup.workspace.ready`,{project:ye.project}):e(`taskHome.setup.workspace.required`))})]}),!L&&(0,K.jsxs)(`div`,{className:`flex gap-1 items-center shrink-0`,children:[ge&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>{Promise.all([T(),ee()])},"aria-label":e(`taskHome.setup.workspace.retry`),title:e(`taskHome.setup.workspace.retry`),className:`flex h-8 w-8 items-center justify-center rounded-md text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-canvas))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]`,children:(0,K.jsx)(Mt,{className:`h-3.5 w-3.5`})}),(0,K.jsxs)(`button`,{type:`button`,"data-project-setup-trigger":!0,onClick:()=>ue(!0),className:`inline-flex h-8 items-center gap-1.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-2.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink))] hover:border-[hsl(var(--deck-accent)/0.55)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]`,children:[(0,K.jsx)(ct,{className:`w-3 h-3`}),e(`taskHome.setup.workspace.action`)]})]})]}),(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-2.5`,children:[(0,K.jsx)(`span`,{className:G(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,_e&&!j?`border-emerald-300/70 bg-emerald-50 text-emerald-700 dark:border-emerald-800/70 dark:bg-emerald-950/40 dark:text-emerald-300`:j?`border-red-300/70 bg-red-50 text-red-700 dark:border-red-900/70 dark:bg-red-950/40 dark:text-red-300`:`border-amber-300/70 bg-amber-50 text-amber-700 dark:border-amber-800/70 dark:bg-amber-950/40 dark:text-amber-300`),children:ve?(0,K.jsx)(bt,{className:`h-3.5 w-3.5 animate-spin`}):_e&&!j?(0,K.jsx)(Je,{className:`h-3.5 w-3.5`}):j?(0,K.jsx)(Ke,{className:`h-3.5 w-3.5`}):(0,K.jsx)(Re,{className:`h-3.5 w-3.5`})}),(0,K.jsxs)(`span`,{className:`flex-1 min-w-0`,children:[(0,K.jsx)(`span`,{className:`block font-mono text-[11px] font-medium text-[hsl(var(--deck-ink))]`,children:e(`taskHome.setup.model.title`)}),(0,K.jsx)(`span`,{title:j??void 0,className:G(`mt-0.5 block truncate text-[10.5px]`,j?`text-red-600 dark:text-red-400`:`text-[hsl(var(--deck-ink-faint))]`),children:ve?e(`taskHome.setup.model.loading`):j||e(_e?`taskHome.setup.model.ready`:`taskHome.setup.model.required`)})]}),!ve&&(!_e||j)&&(0,K.jsxs)(`button`,{type:`button`,"data-model-setup-trigger":!0,onClick:()=>{j?se(F):D(`models`)},className:`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-2.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink))] hover:border-[hsl(var(--deck-accent)/0.55)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]`,children:[j?(0,K.jsx)(Mt,{className:`w-3 h-3`}):(0,K.jsx)(Re,{className:`w-3 h-3`}),e(j?`taskHome.setup.model.retry`:`taskHome.setup.model.action`)]})]})]})]}),(0,K.jsx)(`div`,{className:`px-3 pt-3 pb-3`,children:(0,K.jsx)(Go,{variant:`task`,draft:P?.key===me?P.content:void 0,draftKey:me,placeholder:e(`taskHome.composer.placeholder`),onSend:async e=>{try{return await be(e),ce(void 0),!0}catch{return!1}},disabled:E||a,submitDisabled:!R,shellSubmitDisabled:!R,workspacePath:F},me)})]}),x===`offline`&&(0,K.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap gap-3 items-center px-3 py-2 mt-4 text-amber-900 rounded-md border border-amber-300/70 bg-amber-50/80 dark:border-amber-800/70 dark:bg-amber-950/35 dark:text-amber-200`,children:[(0,K.jsx)(en,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 text-[12px]`,children:e(`taskHome.feed.offlineDescription`)}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>void C().catch(()=>void 0),className:`inline-flex min-h-8 items-center gap-1.5 rounded-md border border-amber-400/70 bg-white/60 px-2.5 font-mono text-[10.5px] font-medium transition-colors hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-700 dark:bg-amber-950/50 dark:hover:bg-amber-900/50`,children:[(0,K.jsx)(Mt,{className:`w-3 h-3`}),e(`taskHome.feed.retry`)]})]}),l&&(0,K.jsxs)(`div`,{role:`alert`,"data-blade-task-error":!0,className:`flex justify-between items-center px-3 py-2 mt-4 font-mono text-xs text-red-700 rounded-md border border-red-200 bg-red-50/80 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300`,children:[(0,K.jsx)(`span`,{children:l}),(0,K.jsx)(`button`,{type:`button`,onClick:w,className:`underline`,children:e(`taskHome.error.dismiss`)})]}),(0,K.jsx)(is,{sessions:pe,catalogLoadState:S,cancellingTaskKeys:_,retryingTaskKeys:y,unreadTaskKeys:b,onSelect:e=>{h(X(e))},onCancel:e=>{re($.getState())||g(X(e)).catch(()=>void 0)},onRetry:e=>{re($.getState())||v(X(e)).catch(()=>void 0)}}),(0,K.jsxs)(`div`,{className:`mt-6 flex items-center justify-center gap-2 text-[10.5px] text-[hsl(var(--deck-ink-faint))]`,children:[(0,K.jsx)(Jt,{className:`w-3 h-3`}),(0,K.jsx)(`span`,{className:`font-mono uppercase tracking-[0.14em]`,children:e(`taskHome.footer.note`)})]}),(0,K.jsx)(Xo,{open:le,onOpenChange:ue})]})})}var ls=`blade.sessions.last`,us=`session`,ds=`project`,fs=`workspace`,ps=`view`,ms=`workspaceKind`,hs=`workspaceRef`,gs=`history`,_s=`bladeSessionSurfaceLocator`,vs=[ps,us,ms,hs],ys=[ds,fs,`cwd`,`displayCwd`];function bs(e){try{return T.parse(e)}catch{return null}}function xs(e){return!e||typeof e!=`object`||Array.isArray(e)?null:bs(e[_s])}function Ss(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&Object.hasOwn(e,_s)}function Cs(e){let t=e.get(us),n=e.get(ms),r=e.get(hs);return!t||n!==`acp-remote`||!r?null:bs({version:2,sessionId:t,workspace:{kind:`acp-remote`,workspaceRef:r}})}function ws(e,t){let n=new URLSearchParams(e),r=n.get(ps)===gs,i=n.has(ms)||n.has(hs),a=xs(t),o=Ss(t);if(!r)return{locator:null,shouldCleanup:i||o};let s=new Set;for(let[e]of n){if(!vs.includes(e)||s.has(e))return{locator:null,shouldCleanup:!0};s.add(e)}let c=Cs(n);return!c||o&&!a||a&&!Fr(a,c)?{locator:null,shouldCleanup:!0}:{locator:c,shouldCleanup:!1}}function Ts(e,t={}){let n=t.href??(typeof window>`u`?`http://localhost/`:window.location.href),r=new URL(n),i=e?bs(e):null,a=i?.workspace.kind===`acp-remote`?i:null;if(a)r.search=``;else for(let e of[...vs,...ys])r.searchParams.delete(e);let o=t.historyState&&typeof t.historyState==`object`&&!Array.isArray(t.historyState)?{...t.historyState}:{};delete o[_s];let s=a?{...o,[_s]:a}:Object.keys(o).length>0?o:null;a?.workspace.kind===`acp-remote`&&(r.searchParams.set(ps,gs),r.searchParams.set(us,a.sessionId),r.searchParams.set(ms,a.workspace.kind),r.searchParams.set(hs,a.workspace.workspaceRef));let c=`${r.pathname}${r.search}${r.hash}`,l=t.replaceState??(typeof window>`u`?void 0:(e,t)=>window.history.replaceState(e,``,t)),u=t.pushState??(typeof window>`u`?void 0:(e,t)=>window.history.pushState(e,``,t));return s&&t.push?u?.(s,c):l?.(s,c),c}function Es(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e;return typeof t.sessionId==`string`&&t.sessionId.trim()&&typeof t.projectPath==`string`&&t.projectPath.trim()?{sessionId:t.sessionId,projectPath:t.projectPath}:null}function Ds(e){let t=new URLSearchParams(e),n=t.get(us)?.trim()||null,r=t.get(ds)?.trim()||null,i=t.get(fs)?.trim()||null,a=t.get(ps)===`board`?`board`:`workspace`;return{sessionRef:n&&(i||r)?{sessionId:n,projectPath:i||r}:null,projectPath:r,hasSessionParam:t.has(us),view:a}}function Os(e=typeof localStorage>`u`?null:localStorage){if(!e)return null;try{let t=e.getItem(ls);return t?Es(JSON.parse(t)):null}catch{return null}}function ks(e,t,n={}){let r=n.href??(typeof window>`u`?`http://localhost/`:window.location.href),i=new URL(r),a=n.view??`workspace`,o=n.displayProjectPath??(a===`board`?t:e?.projectPath)??t,s=e?.projectPath??null;e&&a===`workspace`?i.searchParams.set(us,e.sessionId):i.searchParams.delete(us),o?i.searchParams.set(ds,o):i.searchParams.delete(ds),s&&o&&s!==o?i.searchParams.set(fs,s):i.searchParams.delete(fs),a===`board`?(i.searchParams.set(ps,`board`),i.searchParams.delete(us),i.searchParams.delete(fs)):i.searchParams.delete(ps);let c=n.storage===void 0?typeof localStorage>`u`?null:localStorage:n.storage;try{e&&a===`workspace`?c?.setItem(ls,JSON.stringify(e)):a===`workspace`&&c?.removeItem(ls)}catch{}let l=`${i.pathname}${i.search}${i.hash}`;return(n.replaceState??(typeof window>`u`?void 0:e=>window.history.replaceState(null,``,e)))?.(l),l}var As=(0,H.lazy)(()=>Pe(()=>import(`./ChatView-BA3kB_z1.js`).then(e=>({default:e.ChatView})),__vite__mapDeps([28,1,2,4,5,6,21,22,17,29,10,30,11,12,13,14,0]))),js=(0,H.lazy)(()=>Pe(()=>import(`./KanbanBoard-CTR7bMLa.js`).then(e=>({default:e.KanbanBoard})),__vite__mapDeps([31,1,2,4,5,27,8,17,30,11,12,13]))),Ms=(0,H.lazy)(()=>Pe(()=>import(`./SessionHistorySurface-Cv_jRoJr.js`).then(e=>({default:e.SessionHistorySurface})),__vite__mapDeps([32,1,2,4,5,29])));function Ns(){let e=Me(),[t,n]=(0,H.useState)(!1),r=$(e=>e.subscribeToTaskEvents),i=$(e=>e.unsubscribeFromTaskEvents),a=$(e=>e.currentSessionRef),o=$(e=>e.historySurfaceSelection),s=$(e=>e.isTemporarySession),c=$(e=>e.loadTaskWorkspaceInfo),l=$(e=>e.loadBoundProjects),u=$(e=>e.loadSessions),d=$(e=>e.loadSurfaceCatalog),f=$(e=>e.openHistorySurface),p=$(e=>e.closeHistorySurface),m=$(e=>e.selectSession),h=$(e=>e.selectProject),g=$(e=>e.startTemporarySession),_=$(e=>e.setError),v=$(e=>e.sessions),y=$(e=>e.selectedProjectPath),b=Ti(e=>e.loadModels),x=Ne(e=>e.loadSettings),S=A(e=>e.mainView),C=A(e=>e.setMainView),w=A(e=>e.boardProjectPath),T=A(e=>e.setBoardProjectPath);return(0,H.useEffect)(()=>(r().catch(e=>{console.error(`Failed to subscribe to task events`,e)}),i),[r,i]),(0,H.useEffect)(()=>p,[p]),(0,H.useEffect)(()=>{let e=!1;return(async()=>{u(),d(),x(),b();let t=ws(window.location.search,window.history.state);if(t.shouldCleanup&&Ts(null,{href:window.location.href,historyState:window.history.state}),t.locator){if(await f(t.locator),e)return;$.getState().historySurfaceSelection||(Ts(null,{href:window.location.href,historyState:window.history.state}),$.getState().currentSessionRef||g()),C(`workspace`),T(null),n(!0);return}let r=Ds(window.location.search);C(r.view),T(r.view===`board`?r.projectPath:null);let i=Os(),a=r.view===`board`?null:r.hasSessionParam?r.sessionRef:r.projectPath?null:i,o=Promise.all([c(),l()]),s=!a&&!r.projectPath;if(s&&(g(),n(!0)),await o,e)return;let p=$.getState(),v=r.projectPath?p.boundProjects.find(e=>e.path===r.projectPath&&e.available)?.path:null;if(v&&h(v),!(a&&(await m(a),e))){if(!a||!Q($.getState().currentSessionRef,a)){let e=a?$.getState().error:null;g(),e&&_(e)}s||n(!0)}})(),()=>{e=!0}},[l,b,u,d,x,c,f,h,m,_,T,C,g]),(0,H.useEffect)(()=>{if(!t)return;if(o){Ts(o.locator,{href:window.location.href,historyState:window.history.state});return}let e=ws(window.location.search,window.history.state);(e.locator||e.shouldCleanup)&&Ts(null,{href:window.location.href,historyState:window.history.state});let n=a?Ir(v,a):void 0;ks(S===`workspace`?a:null,S===`board`?w:y,{displayProjectPath:S===`board`?w:n?xi(n,y):y,view:S})},[w,a,o,t,S,y,v]),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ro,{}),(0,K.jsx)(to,{children:t?o?(0,K.jsx)(H.Suspense,{fallback:(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]`,children:e(`app.restoring`)}),children:(0,K.jsx)(Ms,{})}):S===`board`?(0,K.jsx)(H.Suspense,{fallback:(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]`,children:e(`app.restoring`)}),children:(0,K.jsx)(js,{})}):!a||s?(0,K.jsx)(cs,{}):(0,K.jsx)(H.Suspense,{fallback:(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]`,children:e(`app.restoring`)}),children:(0,K.jsx)(As,{})}):(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]`,children:e(`app.restoring`)})})]})}on.createRoot(document.getElementById(`root`)).render((0,K.jsx)(H.StrictMode,{children:(0,K.jsx)(Ns,{})}));export{Rt as $,X as A,fr as B,bi as C,Ir as D,fi as E,vr as F,en as G,sr as H,cr as I,Jt as J,Qt as K,dr as L,Pr as M,Mr as N,Q as O,Y as P,Bt as Q,hr as R,Ti as S,di as T,G as U,mr as V,an as W,Wt as X,Kt as Y,Ht as Z,La as _,We as _t,Yo as a,Et as at,fa as b,Re as bt,Go as c,gt as ct,io as d,ot as dt,It as et,oo as f,it as ft,Ha as g,Ke as gt,Ua as h,Je as ht,Xo as i,Ot as it,Z as j,Fr as k,ko as l,ut as lt,Ra as m,et as mt,Qo as n,Mt as nt,Jo as o,St as ot,ao as p,nt as pt,Xt as q,Zo as r,At as rt,Ko as s,bt as st,es as t,Pt as tt,Do as u,ct as ut,Ia as v,He as vt,xi as w,la as x,Ie as xt,$ as y,Be as yt,pr as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e}from"./preload-helper-BC9Zf9qO.js";var t={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};t.node;var n=e(t),r={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};r.node;var i=e(r),a={name:`chevrons-up-down`,size:24,node:[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]};a.node;var o=e(a),s={name:`message-square-plus`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]};s.node;var c=e(s);export{n as i,o as n,i as r,c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e}from"./preload-helper-BC9Zf9qO.js";var t={name:`pause`,size:24,node:[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]};t.node;var n=e(t);export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e}from"./preload-helper-BC9Zf9qO.js";var t={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};t.node;var n=e(t);export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e}from"./preload-helper-BC9Zf9qO.js";var t={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};t.node;var n=e(t);export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e}from"./preload-helper-BC9Zf9qO.js";var t={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};t.node;var n=e(t);export{n as t};
|