dimcode-web 0.1.0-alpha.21 → 0.1.0-alpha.23
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/package.json +1 -1
- package/release-manifest.json +94 -94
- package/web/assets/AccountSettings-DF5hf1Ti.css +1 -0
- package/web/assets/AccountSettings-KJxLwnAQ.js +1 -0
- package/web/assets/{AgentSettings-C6opxYYo.js → AgentSettings-AtjhW1u9.js} +1 -1
- package/web/assets/{AppearanceSettings-BoOhVnFz.js → AppearanceSettings-B2hfRF8G.js} +1 -1
- package/web/assets/{ArchivedSettings-D5tDripk.js → ArchivedSettings-zfBiREJC.js} +1 -1
- package/web/assets/{CodeBlockNode-BigXVQAf.js → CodeBlockNode-C0MXs3Mw.js} +2 -2
- package/web/assets/{DiagnosticsSettings-DJcBCpEy.js → DiagnosticsSettings-3WeumMYl.js} +1 -1
- package/web/assets/{McpSettings-rHDDYrKl.js → McpSettings-8O2EQkfU.js} +1 -1
- package/web/assets/{ModalitySettings-DprOf77o.js → ModalitySettings-qp9qr-DE.js} +1 -1
- package/web/assets/{PermissionsSettings-DtADZ5dp.js → PermissionsSettings-DRaeZ5ry.js} +1 -1
- package/web/assets/{PluginSettings-DvJj4pme.js → PluginSettings-B_YwUXUy.js} +1 -1
- package/web/assets/{PreCodeBlock-Cs_v_zn2.js → PreCodeBlock-ChATSWPq.js} +1 -1
- package/web/assets/ProviderAuthFlow.vue_vue_type_script_setup_true_lang-BwVv780g.js +6 -0
- package/web/assets/ProviderSettings-CxnpSWBK.js +1 -0
- package/web/assets/ProviderSettings-Dem0jfRB.css +1 -0
- package/web/assets/ScheduledSettings-CNSQQAYZ.js +1 -0
- package/web/assets/{ScheduledSettings-voX1TYx5.css → ScheduledSettings-CPLRSMxF.css} +1 -1
- package/web/assets/{SettingsPage-B76s7xMI.js → SettingsPage-DIs3PPbX.js} +1 -1
- package/web/assets/{SkillSettings-BQ774cUK.js → SkillSettings-BI01BTVt.js} +1 -1
- package/web/assets/{Tooltip-B5X1Lr7y.js → Tooltip-ObkSf90_.js} +1 -1
- package/web/assets/{abnfDiagram-N423BO3Z-Budr7LDr.js → abnfDiagram-N423BO3Z-pIlACrRT.js} +1 -1
- package/web/assets/{arc-DmLVSho5.js → arc-agS2EdKv.js} +1 -1
- package/web/assets/{architectureDiagram-T3A2C74G-CZ9twOWw.js → architectureDiagram-T3A2C74G-hrd9AvKA.js} +1 -1
- package/web/assets/{arrow-left-Q8O22LEf.js → arrow-left-DMez556f.js} +1 -1
- package/web/assets/{blockDiagram-VBNYF7ZC-B6vsATAl.js → blockDiagram-VBNYF7ZC-BuKPFjea.js} +1 -1
- package/web/assets/{c4Diagram-5PPSVZJV-ZbBXLah8.js → c4Diagram-5PPSVZJV-BXJhp8Sw.js} +1 -1
- package/web/assets/channel-BWOS3_Qf.js +1 -0
- package/web/assets/{chunk-2GRJ4B5K-DCbPHDn9.js → chunk-2GRJ4B5K-Cm6dqK-Y.js} +1 -1
- package/web/assets/{chunk-2Q5K7J3B-q-A4RCdp.js → chunk-2Q5K7J3B-C_-X-KAN.js} +1 -1
- package/web/assets/{chunk-5RXB4S5H-B-mGURLT.js → chunk-5RXB4S5H-D-NnfZGZ.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-DFGchYlp.js → chunk-5VM5RSS4-IJ_i-zuI.js} +1 -1
- package/web/assets/{chunk-6Q2QTUOP-0FNBovJD.js → chunk-6Q2QTUOP-D3VQN0jj.js} +1 -1
- package/web/assets/{chunk-GF5L2VYU-wi5f-cDY.js → chunk-GF5L2VYU-C2uoEo9L.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-C5DYyLY7.js → chunk-JWPE2WC7-B3JrwNpe.js} +1 -1
- package/web/assets/{chunk-KBJHAD2P-CoHVmRnB.js → chunk-KBJHAD2P-D0hr5xrP.js} +1 -1
- package/web/assets/{chunk-RYQCIY6F-DrN39PnO.js → chunk-RYQCIY6F-SwL94E05.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-CbRCRbeQ.js → chunk-XXDRQBXY-Cwup4DJz.js} +1 -1
- package/web/assets/classDiagram-JCYQIIEL-BEjQaM9K.js +1 -0
- package/web/assets/classDiagram-v2-OCEON4UE-BEjQaM9K.js +1 -0
- package/web/assets/{clock-3-CEcFQuW4.js → clock-3-ZiStq2y-.js} +1 -1
- package/web/assets/{cose-bilkent-JH36ORCC-BqViSKnD.js → cose-bilkent-JH36ORCC-DFrmUkID.js} +1 -1
- package/web/assets/{cynefin-OW5HDTMX-rMAZpWdi.js → cynefin-OW5HDTMX-Co06-7f6.js} +1 -1
- package/web/assets/{cynefinDiagram-MW4NZA55-BYSCyLEg.js → cynefinDiagram-MW4NZA55-Bu536scJ.js} +1 -1
- package/web/assets/{dagre-VZM6K2ZE-DMCK3aFx.js → dagre-VZM6K2ZE-D4cHzDFq.js} +1 -1
- package/web/assets/{diagram-7IWD3JNH-BFKte3Xm.js → diagram-7IWD3JNH-oovM8Sc7.js} +1 -1
- package/web/assets/{diagram-B4RE2ZJO-D9EupTSG.js → diagram-B4RE2ZJO-BdOdIOgB.js} +1 -1
- package/web/assets/{diagram-LBJQPF4R-DKIeq9be.js → diagram-LBJQPF4R-CjfEUzok.js} +1 -1
- package/web/assets/{diagram-Q27KOJAE-BOrnx2ed.js → diagram-Q27KOJAE-C6AZJ1Do.js} +1 -1
- package/web/assets/{diagram-UB23O5K3-D8lvv7G0.js → diagram-UB23O5K3-BUVY_zgS.js} +1 -1
- package/web/assets/{ebnfDiagram-BXEA7PRR-CGeZxtxl.js → ebnfDiagram-BXEA7PRR-Bl_DPMOL.js} +1 -1
- package/web/assets/{erDiagram-JOGREHBK-eGGkPfnP.js → erDiagram-JOGREHBK-CjrdFPg3.js} +1 -1
- package/web/assets/{flowDiagram-UKHOOZJN-p09UM-22.js → flowDiagram-UKHOOZJN-D9YAMCtz.js} +1 -1
- package/web/assets/{ganttDiagram-PKOTCBZU-SqulGI3A.js → ganttDiagram-PKOTCBZU-BZjsjDEI.js} +1 -1
- package/web/assets/{gitGraphDiagram-DS77QQ5N-DVBfe-CW.js → gitGraphDiagram-DS77QQ5N-DmJzxq0N.js} +1 -1
- package/web/assets/{index-lSaCQ5HQ.js → index-6bKx5FLu.js} +5 -5
- package/web/assets/{index-CTaNCPit.js → index-BEYRi-K7.js} +1 -1
- package/web/assets/{index-B0IMqptZ.css → index-Bkes3xCC.css} +1 -1
- package/web/assets/index-Dx0dig4j.js +251 -0
- package/web/assets/{index10-B9YpVOxp.js → index10-BwtjQn99.js} +1 -1
- package/web/assets/{index5-ZFdL0BRF.js → index5-7Gb8JgnB.js} +1 -1
- package/web/assets/{index6-DwYIp71E.js → index6-CtKexy1_.js} +1 -1
- package/web/assets/{index8-DNs0laJT.js → index8-VR16_ODJ.js} +1 -1
- package/web/assets/{index9-C76POzlM.js → index9-_nJa0ns1.js} +1 -1
- package/web/assets/{infoDiagram-6WML65LV-ClGQXzPV.js → infoDiagram-6WML65LV-BRlxsenA.js} +1 -1
- package/web/assets/{ishikawaDiagram-WSZJBQD7-kaFUTkwb.js → ishikawaDiagram-WSZJBQD7-Dn2JFwxS.js} +1 -1
- package/web/assets/{journeyDiagram-NVQOT4AX-BRpajxRG.js → journeyDiagram-NVQOT4AX-B6oYvZJd.js} +1 -1
- package/web/assets/{kanban-definition-27J2QSJJ-QTf_fpBx.js → kanban-definition-27J2QSJJ-Bv0r7KvM.js} +1 -1
- package/web/assets/{linear-BH8Hio3w.js → linear-tKjbaK9-.js} +1 -1
- package/web/assets/{markstream-9drg_IpK.js → markstream-BjjYM-oL.js} +2 -2
- package/web/assets/{mermaid.core-C9VqvILU.js → mermaid.core-B51U-Fe_.js} +4 -4
- package/web/assets/{mindmap-definition-FAOFIHXS-A67fKlRw.js → mindmap-definition-FAOFIHXS-7Mnvm5Ff.js} +1 -1
- package/web/assets/{pegDiagram-VL7TDLO6-BBjPwAwO.js → pegDiagram-VL7TDLO6-D_NG6zax.js} +1 -1
- package/web/assets/{pieDiagram-7S7Q4E2Y-B2O2_6Ql.js → pieDiagram-7S7Q4E2Y-CjKiVkku.js} +1 -1
- package/web/assets/{quadrantDiagram-CIZ2JOQS-9BnbLmnp.js → quadrantDiagram-CIZ2JOQS-CJUGbKH_.js} +1 -1
- package/web/assets/{railroadDiagram-AXF67PYL-4jnaEanA.js → railroadDiagram-AXF67PYL-DG1bLqc1.js} +1 -1
- package/web/assets/{refresh-cw-CdGjCYEi.js → refresh-cw-DjhCdimB.js} +1 -1
- package/web/assets/{requirementDiagram-LRYGKXZP-CE9rGQ5I.js → requirementDiagram-LRYGKXZP-D56CPqbp.js} +1 -1
- package/web/assets/{sankeyDiagram-W5VNT64P-BTub3bJG.js → sankeyDiagram-W5VNT64P-DZ2GHKGE.js} +1 -1
- package/web/assets/{sequenceDiagram-SI44F4Z6-CpY_fBT6.js → sequenceDiagram-SI44F4Z6-J_TEZjUz.js} +1 -1
- package/web/assets/{sizeCapture-X5ZJPWSS-DnJ1KeP_.js → sizeCapture-X5ZJPWSS-Cz7_0YL6.js} +1 -1
- package/web/assets/{stateDiagram-OKZ733FA-_5PCQD6y.js → stateDiagram-OKZ733FA-DXh9K0Bi.js} +1 -1
- package/web/assets/stateDiagram-v2-UEYNNEHI-iBah7iBd.js +1 -0
- package/web/assets/{swimlanes-SLNWSIFB-YeAoXX44.js → swimlanes-SLNWSIFB-I9_WGhlP.js} +2 -2
- package/web/assets/swimlanesDiagram-ULZ7WXOC-Bh3nmJRl.js +8 -0
- package/web/assets/{timeline-definition-Z64GVDOM-BLxnm5xB.js → timeline-definition-Z64GVDOM-BFlT-0N5.js} +1 -1
- package/web/assets/{vennDiagram-T6HMQDX7-SZnCg-5k.js → vennDiagram-T6HMQDX7-C8ase2Ip.js} +1 -1
- package/web/assets/{wardleyDiagram-T6FBY63Y-Cv3hfuMY.js → wardleyDiagram-T6FBY63Y-mTJRmNI-.js} +1 -1
- package/web/assets/{xychartDiagram-ELKLHX3M-Myh9al5x.js → xychartDiagram-ELKLHX3M-DnizrE8y.js} +1 -1
- package/web/assets/{zh-CN-CJTbN_T1.js → zh-CN-C34hOQsk.js} +1 -1
- package/web/dimcode-web.json +3 -3
- package/web/index.html +2 -2
- package/web/assets/AccountSettings-DnfPPG7u.css +0 -1
- package/web/assets/AccountSettings-nyVX4bl3.js +0 -1
- package/web/assets/ProviderAuthFlow.vue_vue_type_script_setup_true_lang-t8Pt_gCk.js +0 -6
- package/web/assets/ProviderSettings-Cc10ophS.css +0 -1
- package/web/assets/ProviderSettings-DwxeUHLU.js +0 -2
- package/web/assets/ScheduledSettings-D9YosCWp.js +0 -1
- package/web/assets/channel-S4MqItxT.js +0 -1
- package/web/assets/classDiagram-JCYQIIEL-DUDCefSy.js +0 -1
- package/web/assets/classDiagram-v2-OCEON4UE-DUDCefSy.js +0 -1
- package/web/assets/index-NdaMpp0K.js +0 -249
- package/web/assets/stateDiagram-v2-UEYNNEHI-CUP19cPR.js +0 -1
- package/web/assets/swimlanesDiagram-ULZ7WXOC-BmGPOH52.js +0 -8
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-lSaCQ5HQ.js","assets/vendor-vue-BSuwZuJF.js","assets/SettingsPage-B76s7xMI.js","assets/context-B95juZL3.js","assets/arrow-left-Q8O22LEf.js","assets/clock-3-CEcFQuW4.js","assets/AccountSettings-nyVX4bl3.js","assets/settings-general-qm23fkZo.js","assets/ProviderAuthFlow.vue_vue_type_script_setup_true_lang-t8Pt_gCk.js","assets/refresh-cw-CdGjCYEi.js","assets/AccountSettings-DnfPPG7u.css","assets/AppearanceSettings-BoOhVnFz.js","assets/AppearanceSettings-WVGDYAhR.css","assets/AgentSettings-C6opxYYo.js","assets/GeneralSettingsStatus.vue_vue_type_script_setup_true_lang-C2v20RcN.js","assets/ProviderSettings-DwxeUHLU.js","assets/ProviderSettings-Cc10ophS.css","assets/ModalitySettings-DprOf77o.js","assets/McpSettings-rHDDYrKl.js","assets/McpSettings-Dl7iog2J.css","assets/PluginSettings-DvJj4pme.js","assets/PluginSettings-DziS_TZL.css","assets/SkillSettings-BQ774cUK.js","assets/SkillSettings-OqERafmE.css","assets/PermissionsSettings-DtADZ5dp.js","assets/PermissionsSettings-aVsQzgZQ.css","assets/ScheduledSettings-D9YosCWp.js","assets/ScheduledSettings-voX1TYx5.css","assets/ArchivedSettings-D5tDripk.js","assets/ArchivedSettings-CbpGcugQ.css","assets/DiagnosticsSettings-DJcBCpEy.js","assets/DiagnosticsSettings-Bf1nv4em.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
var Dn=Object.defineProperty;var Nn=(s,t,e)=>t in s?Dn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var ve=(s,t,e)=>Nn(s,typeof t!="symbol"?t+"":t,e);import{$ as es,d as ke,c as u,m as je,F as ne,C as he,o as d,e as c,n as Mt,a7 as jn,a8 as mt,r as R,z as E,w as $e,a9 as _s,H as Bt,f as ye,u as a,h as ae,t as m,aa as vt,B as Se,j as G,a as D,l as Ne,R as ut,k as We,b as be,P as Ft,x as ot,g as it,K as At,ab as Bn,q as He,Q as is,a3 as ts,y as Fn,O as Wt,V as Is,W as Wn,a1 as $s,T as Vn,a6 as Un,ac as xs,ad as Hn,ae as Kn,af as Qn,ag as Gn}from"./vendor-vue-BSuwZuJF.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const r of i.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&n(r)}).observe(document,{childList:!0,subtree:!0});function e(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(o){if(o.ep)return;o.ep=!0;const i=e(o);fetch(o.href,i)}})();/**
|
|
3
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the ISC license.
|
|
6
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const Jn=s=>{for(const t in s)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
|
|
8
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the ISC license.
|
|
11
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/const Cs=s=>s==="";/**
|
|
13
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the ISC license.
|
|
16
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/const Yn=(...s)=>s.filter((t,e,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===e).join(" ").trim();/**
|
|
18
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the ISC license.
|
|
21
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/const Ss=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
23
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
24
|
-
*
|
|
25
|
-
* This source code is licensed under the ISC license.
|
|
26
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
-
*/const Xn=s=>s.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,e,n)=>n?n.toUpperCase():e.toLowerCase());/**
|
|
28
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
29
|
-
*
|
|
30
|
-
* This source code is licensed under the ISC license.
|
|
31
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
32
|
-
*/const Zn=s=>{const t=Xn(s);return t.charAt(0).toUpperCase()+t.slice(1)};/**
|
|
33
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
34
|
-
*
|
|
35
|
-
* This source code is licensed under the ISC license.
|
|
36
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/var St={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
|
|
38
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
39
|
-
*
|
|
40
|
-
* This source code is licensed under the ISC license.
|
|
41
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/const eo=({name:s,iconNode:t,absoluteStrokeWidth:e,"absolute-stroke-width":n,strokeWidth:o,"stroke-width":i,size:r=St.width,color:l=St.stroke,...h},{slots:g})=>es("svg",{...St,...h,width:r,height:r,stroke:l,"stroke-width":Cs(e)||Cs(n)||e===!0||n===!0?Number(o||i||St["stroke-width"])*24/Number(r):o||i||St["stroke-width"],class:Yn("lucide",h.class,...s?[`lucide-${Ss(Zn(s))}-icon`,`lucide-${Ss(s)}`]:["lucide-icon"]),...!g.default&&!Jn(h)&&{"aria-hidden":"true"}},[...t.map(I=>es(...I)),...g.default?[g.default()]:[]]);/**
|
|
43
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
44
|
-
*
|
|
45
|
-
* This source code is licensed under the ISC license.
|
|
46
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
47
|
-
*/const fe=(s,t)=>(e,{slots:n,attrs:o})=>es(eo,{...o,...e,iconNode:t,name:s},n);/**
|
|
48
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
49
|
-
*
|
|
50
|
-
* This source code is licensed under the ISC license.
|
|
51
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
52
|
-
*/const to=fe("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
|
|
53
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
54
|
-
*
|
|
55
|
-
* This source code is licensed under the ISC license.
|
|
56
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
57
|
-
*/const It=fe("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
58
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
59
|
-
*
|
|
60
|
-
* This source code is licensed under the ISC license.
|
|
61
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
62
|
-
*/const as=fe("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
63
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
64
|
-
*
|
|
65
|
-
* This source code is licensed under the ISC license.
|
|
66
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
67
|
-
*/const Dt=fe("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
68
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
69
|
-
*
|
|
70
|
-
* This source code is licensed under the ISC license.
|
|
71
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
72
|
-
*/const so=fe("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
73
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
74
|
-
*
|
|
75
|
-
* This source code is licensed under the ISC license.
|
|
76
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
77
|
-
*/const no=fe("circle-slash-2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/**
|
|
78
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
79
|
-
*
|
|
80
|
-
* This source code is licensed under the ISC license.
|
|
81
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
82
|
-
*/const sn=fe("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
83
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
84
|
-
*
|
|
85
|
-
* This source code is licensed under the ISC license.
|
|
86
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
87
|
-
*/const oo=fe("file-pen",[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]]);/**
|
|
88
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
89
|
-
*
|
|
90
|
-
* This source code is licensed under the ISC license.
|
|
91
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
92
|
-
*/const io=fe("folder-open",[["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"}]]);/**
|
|
93
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
94
|
-
*
|
|
95
|
-
* This source code is licensed under the ISC license.
|
|
96
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
97
|
-
*/const ss=fe("folder",[["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"}]]);/**
|
|
98
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
99
|
-
*
|
|
100
|
-
* This source code is licensed under the ISC license.
|
|
101
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
102
|
-
*/const ft=fe("git-branch",[["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"}]]);/**
|
|
103
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
104
|
-
*
|
|
105
|
-
* This source code is licensed under the ISC license.
|
|
106
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
107
|
-
*/const ao=fe("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
|
|
108
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
109
|
-
*
|
|
110
|
-
* This source code is licensed under the ISC license.
|
|
111
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
112
|
-
*/const ro=fe("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
113
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
114
|
-
*
|
|
115
|
-
* This source code is licensed under the ISC license.
|
|
116
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
117
|
-
*/const lo=fe("list-tree",[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]]);/**
|
|
118
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
119
|
-
*
|
|
120
|
-
* This source code is licensed under the ISC license.
|
|
121
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
122
|
-
*/const Vt=fe("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
123
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
124
|
-
*
|
|
125
|
-
* This source code is licensed under the ISC license.
|
|
126
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
127
|
-
*/const co=fe("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);/**
|
|
128
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
129
|
-
*
|
|
130
|
-
* This source code is licensed under the ISC license.
|
|
131
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
132
|
-
*/const nn=fe("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);/**
|
|
133
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
134
|
-
*
|
|
135
|
-
* This source code is licensed under the ISC license.
|
|
136
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
137
|
-
*/const uo=fe("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]);/**
|
|
138
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
139
|
-
*
|
|
140
|
-
* This source code is licensed under the ISC license.
|
|
141
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
142
|
-
*/const po=fe("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
|
|
143
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
144
|
-
*
|
|
145
|
-
* This source code is licensed under the ISC license.
|
|
146
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
147
|
-
*/const ho=fe("panel-left-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/**
|
|
148
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
149
|
-
*
|
|
150
|
-
* This source code is licensed under the ISC license.
|
|
151
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
152
|
-
*/const rs=fe("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
153
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
154
|
-
*
|
|
155
|
-
* This source code is licensed under the ISC license.
|
|
156
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
157
|
-
*/const mo=fe("puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/**
|
|
158
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
159
|
-
*
|
|
160
|
-
* This source code is licensed under the ISC license.
|
|
161
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
162
|
-
*/const vo=fe("quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
|
|
163
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
164
|
-
*
|
|
165
|
-
* This source code is licensed under the ISC license.
|
|
166
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
167
|
-
*/const fo=fe("rotate-ccw",[["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"}]]);/**
|
|
168
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
169
|
-
*
|
|
170
|
-
* This source code is licensed under the ISC license.
|
|
171
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
172
|
-
*/const ls=fe("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);/**
|
|
173
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
174
|
-
*
|
|
175
|
-
* This source code is licensed under the ISC license.
|
|
176
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
177
|
-
*/const go=fe("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
178
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
179
|
-
*
|
|
180
|
-
* This source code is licensed under the ISC license.
|
|
181
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
182
|
-
*/const bo=fe("shield",[["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"}]]);/**
|
|
183
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
184
|
-
*
|
|
185
|
-
* This source code is licensed under the ISC license.
|
|
186
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
187
|
-
*/const yo=fe("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
188
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
189
|
-
*
|
|
190
|
-
* This source code is licensed under the ISC license.
|
|
191
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
192
|
-
*/const wo=fe("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);/**
|
|
193
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
194
|
-
*
|
|
195
|
-
* This source code is licensed under the ISC license.
|
|
196
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
197
|
-
*/const ko=fe("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
198
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
199
|
-
*
|
|
200
|
-
* This source code is licensed under the ISC license.
|
|
201
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
202
|
-
*/const _o=fe("wifi-off",[["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"}]]);/**
|
|
203
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
204
|
-
*
|
|
205
|
-
* This source code is licensed under the ISC license.
|
|
206
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
207
|
-
*/const Io=fe("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/**
|
|
208
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
209
|
-
*
|
|
210
|
-
* This source code is licensed under the ISC license.
|
|
211
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
212
|
-
*/const $o=fe("wrench",[["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"}]]);/**
|
|
213
|
-
* @license lucide-vue-next v0.577.0 - ISC
|
|
214
|
-
*
|
|
215
|
-
* This source code is licensed under the ISC license.
|
|
216
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
217
|
-
*/const yt=fe("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),ds={en:{confirm:"Confirm",scheduled:"Scheduled tasks",settings:"Settings",account:"Account",appearance:"Appearance",agent:"Agent defaults",providers:"Providers",modality:"Modality",mcp:"MCP",plugins:"Plugins",skills:"Skills",permissions:"Permissions",archived:"Archived sessions",diagnostics:"Diagnostics",back:"Back",cancel:"Cancel",save:"Save changes",saving:"Saving…",loading:"Loading…",refresh:"Refresh",retry:"Retry",close:"Close",search:"Search providers or models",add:"Add provider",custom:"Custom provider",configured:"Configured",connected:"Connected",signedOut:"Not signed in",enabled:"Enabled",disabled:"Disabled",enable:"Enable",disable:"Disable",remove:"Delete",edit:"Edit",reset:"Reset",name:"Name",id:"ID",models:"Models",noModels:"No models. Refresh the catalog or add a model.",noProviders:"No providers configured. Add one to get started.",noResults:"No matches",connection:"Connection",driver:"Adapter",baseUrl:"Base URL",apiKey:"API key",keepSecret:"Leave blank to keep the existing secret",clearSecret:"Remove stored credential",headers:"Headers",headerName:"Header name",headerValue:"New header value",addHeader:"Add header",proxy:"Proxy URL",timeout:"Timeout (ms)",default:"Default",probe:"Test connection",probeResult:"Connection succeeded. Models found:",create:"Create",modelIds:"Model IDs (one per line)",addModel:"Add model",modelId:"Model ID",context:"Context window",output:"Max output tokens",tools:"Tool calling",vision:"Vision",reasoning:"Reasoning",effort:"Reasoning effort",tier:"Service tier",endpoint:"Endpoint override",inherit:"Use provider default",preferences:"Model preferences",unavailable:"Unavailable",knownProviders:"Available providers",authType:"Authentication",headerPrefix:"Header prefix",secretRequired:"A credential is required before enabling this provider.",conflict:"The provider changed. Reload before saving again; your draft has been preserved.",discard:"Discard unsaved changes?",deleteConfirm:"Delete this provider and its saved configuration?",modelDeleteConfirm:"Delete this model?",resetConfirm:"Reset this model to the provider defaults?",signOutConfirm:"Sign out of this provider on the CLI host?",accountDescription:"Your Dim account is shared with the CLI on this host.",providerDescription:"Connect accounts and API providers, and manage the models available in chat.",signIn:"Sign in to Dim",login:"Sign in",enterprise:"Enterprise sign-in",email:"Enterprise email",browser:"Browser",device:"Device code",openAuth:"Open authorization page",copy:"Copy",copied:"Copied",callback:"Authorization callback URL",callbackHint:"After authorization, copy the full localhost redirect URL from your browser and paste it here. It also works when the browser and CLI are on different machines.",finish:"Complete sign-in",waiting:"Waiting for authorization…",expired:"This sign-in attempt expired. Start again.",cancelled:"Sign-in cancelled.",failed:"Sign-in failed. Try again.",expires:"Expires",signOut:"Sign out",plan:"Plan and usage",credits:"Credits",unlimited:"Unlimited",remaining:"Remaining",usageUnavailable:"Usage could not be loaded",viewPlan:"View plan",choosePlan:"Choose a plan",region:"Account region",cn:"China",global:"Global",uid:"User ID",accountUnavailable:"This CLI build has no Dim account provider. Use an account-enabled build to sign in.",missingMethod:"This server does not support this settings action. Update the CLI and reconnect.",reload:"Reload",unknownLimits:"Not declared",advanced:"Advanced",modelDescription:"Changes apply to future model selections; existing sessions retain their configuration.",status:"Status",working:"Working…",referral:"Invite friends",resetCredits:"Usage reset credits"},"zh-CN":{confirm:"确认",scheduled:"定时任务",settings:"设置",account:"账户",appearance:"外观",agent:"Agent 默认设置",providers:"模型提供商",modality:"多模态",mcp:"MCP",plugins:"插件",skills:"技能",permissions:"权限",archived:"已归档会话",diagnostics:"诊断",back:"返回",cancel:"取消",save:"保存更改",saving:"保存中…",loading:"加载中…",refresh:"刷新",retry:"重试",close:"关闭",search:"搜索提供商或模型",add:"添加提供商",custom:"自定义提供商",configured:"已配置",connected:"已连接",signedOut:"未登录",enabled:"已启用",disabled:"已禁用",enable:"启用",disable:"禁用",remove:"删除",edit:"编辑",reset:"重置",name:"名称",id:"ID",models:"模型",noModels:"暂无模型,请刷新模型列表或手动添加。",noProviders:"尚未配置提供商,添加一个即可开始使用。",noResults:"没有匹配项",connection:"连接配置",driver:"适配器",baseUrl:"接口地址",apiKey:"API 密钥",keepSecret:"留空保留已有密钥",clearSecret:"移除已存储的凭据",headers:"请求头",headerName:"请求头名称",headerValue:"新的请求头值",addHeader:"添加请求头",proxy:"代理地址",timeout:"超时时间(毫秒)",default:"默认",probe:"测试连接",probeResult:"连接成功,发现模型:",create:"创建",modelIds:"模型 ID(每行一个)",addModel:"添加模型",modelId:"模型 ID",context:"上下文窗口",output:"最大输出 Token",tools:"工具调用",vision:"视觉",reasoning:"推理",effort:"推理强度",tier:"服务等级",endpoint:"端点覆盖",inherit:"使用提供商默认值",preferences:"模型偏好",unavailable:"不可用",knownProviders:"可用提供商",authType:"认证方式",headerPrefix:"请求头前缀",secretRequired:"启用此提供商前需要配置凭据。",conflict:"提供商配置已变更。请重新加载后再保存,当前草稿已保留。",discard:"放弃未保存的更改?",deleteConfirm:"删除此提供商及其已保存的配置?",modelDeleteConfirm:"删除此模型?",resetConfirm:"将此模型重置为提供商默认配置?",signOutConfirm:"退出 CLI 主机上此提供商的登录?",accountDescription:"Dim 账户与此主机上的 CLI 共享。",providerDescription:"连接账户和 API 提供商,管理聊天中可用的模型。",signIn:"登录 Dim",login:"登录",enterprise:"企业登录",email:"企业邮箱",browser:"浏览器",device:"设备码",openAuth:"打开授权页面",copy:"复制",copied:"已复制",callback:"授权回调 URL",callbackHint:"授权后,从浏览器地址栏复制完整的 localhost 回调地址并粘贴到这里。浏览器和 CLI 不在同一台机器时也可使用。",finish:"完成登录",waiting:"等待授权…",expired:"本次登录已过期,请重新开始。",cancelled:"已取消登录。",failed:"登录失败,请重试。",expires:"到期时间",signOut:"退出登录",plan:"套餐与用量",credits:"额度",unlimited:"无限制",remaining:"剩余",usageUnavailable:"无法加载用量",viewPlan:"查看套餐",choosePlan:"选择套餐",region:"账户区域",cn:"中国",global:"全球",uid:"用户 ID",accountUnavailable:"当前 CLI 构建未包含 Dim 账户提供商,请使用支持账户登录的构建。",missingMethod:"服务端不支持此设置操作,请更新 CLI 后重新连接。",reload:"重新加载",unknownLimits:"未声明",advanced:"高级设置",modelDescription:"更改在之后选择模型时生效,已有会话保留其配置。",status:"状态",working:"处理中…",referral:"邀请好友",resetCredits:"用量重置额度"}},xo=["d"],Co=ke({__name:"BrandMark",props:{animated:{type:Boolean,default:!1}},setup(s){const t=[{delay:"-1.6s",d:"M52.042 34C50.8561 34.0001 49.8945 34.9615 49.8945 36.1475V46.1689C49.8946 47.3549 50.8561 48.3163 52.042 48.3164H77.958C79.144 48.3164 80.1054 47.3549 80.1055 46.1689V36.1475C80.1055 34.9615 79.144 34 77.958 34H52.042Z"},{delay:"-1.333s",d:"M83.8311 49.8945C82.6452 49.8947 81.6836 50.8561 81.6836 52.042V62.0635C81.6838 63.2493 82.6453 64.2108 83.8311 64.2109H93.8525C95.0384 64.2109 95.9998 63.2493 96 62.0635V52.042C96 50.856 95.0385 49.8945 93.8525 49.8945H83.8311Z"},{delay:"-1.067s",d:"M83.8311 65.7891C82.6453 65.7892 81.6838 66.7508 81.6836 67.9365V77.958C81.6836 79.1439 82.6452 80.1053 83.8311 80.1055H93.8525C95.0385 80.1055 96 79.144 96 77.958V67.9365C95.9998 66.7507 95.0384 65.7891 93.8525 65.7891H83.8311Z"},{delay:"-0.8s",d:"M52.042 81.6836C50.8561 81.6837 49.8946 82.6452 49.8945 83.8311V93.8525C49.8945 95.0385 50.8561 95.9999 52.042 96H77.958C79.144 96 80.1055 95.0385 80.1055 93.8525V83.8311C80.1054 82.6451 79.1439 81.6836 77.958 81.6836H52.042Z"},{delay:"-0.533s",d:"M36.1475 65.7891C34.9616 65.7891 34.0002 66.7507 34 67.9365V77.958C34 79.144 34.9615 80.1055 36.1475 80.1055H46.1689C47.3548 80.1054 48.3164 79.1439 48.3164 77.958V67.9365C48.3162 66.7507 47.3547 65.7892 46.1689 65.7891H36.1475Z"},{delay:"-0.267s",d:"M36.1475 49.8945C34.9615 49.8945 34 50.856 34 52.042V62.0635C34.0002 63.2493 34.9616 64.2109 36.1475 64.2109H46.1689C47.3547 64.2108 48.3162 63.2493 48.3164 62.0635V52.042C48.3164 50.8561 47.3548 49.8946 46.1689 49.8945H36.1475Z"}];return(e,n)=>(d(),u("svg",{viewBox:"34 34 62 62","aria-hidden":"true",class:je(["brand-mark",{"is-animated":s.animated}])},[(d(),u(ne,null,he(t,o=>c("path",{key:o.d,fill:"currentColor",d:o.d,style:Mt({animationDelay:o.delay})},null,12,xo)),64))],2))}}),Ae=(s,t)=>{const e=s.__vccOpts||s;for(const[n,o]of t)e[n]=o;return e},Ut=Ae(Co,[["__scopeId","data-v-44bc694b"]]),Es=3,de="main";class Te extends Error{constructor(){super(...arguments);ve(this,"name","ProtocolError")}}function xe(s,t){throw new Te(`Invalid ${s}: expected ${t}`)}function N(s,t){return(s===null||typeof s!="object"||Array.isArray(s))&&xe(t,"an object"),s}function _e(s,t){return Array.isArray(s)||xe(t,"an array"),s}function S(s,t,e){const n=s[t];return typeof n!="string"&&xe(`${e}.${t}`,"a string"),n}function Re(s,t,e){return s[t]===void 0||s[t]===null?void 0:S(s,t,e)}function ce(s,t,e){const n=s[t];return(typeof n!="number"||!Number.isSafeInteger(n)||n<0)&&xe(`${e}.${t}`,"a nonnegative safe integer"),n}function Lt(s,t,e){const n=s[t];return(typeof n!="number"||!Number.isFinite(n)||n<0)&&xe(`${e}.${t}`,"a nonnegative number"),n}function Ye(s,t,e){const n=s[t];return typeof n!="boolean"&&xe(`${e}.${t}`,"a boolean"),n}function Ht(s,t){const e=N(s,t);return{providerId:S(e,"providerId",t),modelId:S(e,"modelId",t)}}function So(s,t){if(s==null)return;const e=N(s,t),n=Re(e,"serverMessage",t),o=Re(e,"requestId",t),i=Re(e,"action",t);return{source:S(e,"source",t),reason:S(e,"reason",t),...n===void 0?{}:{serverMessage:n},...o===void 0?{}:{requestId:o},...i===void 0?{}:{action:i}}}function Eo(s,t){if(s==null)return;const e=N(s,t),n=e.status===void 0||e.status===null?void 0:ce(e,"status",t),o=Re(e,"providerCode",t),i=Re(e,"requestId",t),r=Re(e,"reason",t),l=e.retryAfterMs===void 0||e.retryAfterMs===null?void 0:ce(e,"retryAfterMs",t),h=e.cause===void 0||e.cause===null?[]:_e(e.cause,`${t}.cause`).map((g,I)=>(typeof g!="string"&&xe(`${t}.cause[${I}]`,"a string"),g));return{kind:S(e,"kind",t),...n===void 0?{}:{status:n},...o===void 0?{}:{providerCode:o},...i===void 0?{}:{requestId:i},...r===void 0?{}:{reason:r},cause:h,attempts:ce(e,"attempts",t),waitedMs:ce(e,"waitedMs",t),...l===void 0?{}:{retryAfterMs:l}}}function Mo(s,t){if(s==null)return;const e=N(s,t),n=Re(e,"reason",t);return{attempt:ce(e,"attempt",t),maxAttempts:ce(e,"maxAttempts",t),retryAtMs:ce(e,"retryAtMs",t),kind:S(e,"kind",t),...n===void 0?{}:{reason:n}}}function To(s){const t=N(s,"hello");return{instanceId:S(t,"instanceId","hello"),serverVersion:S(t,"serverVersion","hello"),protocolVersion:ce(t,"protocolVersion","hello"),features:_e(t.features,"hello.features").map((e,n)=>(typeof e!="string"&&xe(`hello.features[${n}]`,"a string"),e))}}function bt(s){N(s,"reply")}function cs(s){const t="session.methods";return _e(N(s,t).methods,`${t}.methods`).map((e,n)=>S(N(e,`${t}.methods[${n}]`),"name",`${t}.methods[${n}]`))}function qo(s){const t="session.context.compact",e=N(s,t),n=S(e,"status",t);if(n==="completed")return{status:n};if(n==="skipped")return{status:n,reason:S(e,"reason",t)};xe(`${t}.status`,"completed or skipped")}function Ao(s){const t="session.context.usage",e=N(s,t);return{contextWindow:Lt(e,"contextWindow",t),outputTokens:Lt(e,"outputTokens",t),thresholdTokens:Lt(e,"thresholdTokens",t),estimatedInputTokens:Lt(e,"estimatedInputTokens",t),baselineSource:S(e,"baselineSource",t)}}function Lo(s){return S(N(s,"session.fork"),"sessionId","session.fork")}function on(s,t){const e=s.title===null?null:S(s,"title",t),n=s.titleSource;return n!==null&&n!=="auto"&&n!=="manual"&&xe(`${t}.titleSource`,"auto, manual or null"),e===null!=(n===null)&&xe(`${t}.titleSource`,"null exactly when title is null"),{title:e,titleSource:n,titleRevision:ce(s,"titleRevision",t)}}function an(s){return _e(s,"session.summaries").map((t,e)=>{const n=`session.summaries[${e}]`,o=N(t,n),i=Re(o,"preview",n),r=Re(o,"origin",n);r!==void 0&&r!=="client"&&r!=="acp"&&r!=="internal"&&r!=="unknown"&&xe(`${n}.origin`,"client, acp, internal or unknown");const l=Re(o,"parentSessionId",n);return{...on(o,n),sessionId:S(o,"sessionId",n),cwd:S(o,"cwd",n),model:Ht(o.model,`${n}.model`),createdAt:ce(o,"createdAt",n),running:Ye(o,"running",n),sequence:ce(o,"sequence",n),...i===void 0?{}:{preview:i},...r===void 0?{}:{origin:r},...l===void 0?{}:{parentSessionId:l},updatedAt:ce(o,"updatedAt",n)}})}function Oo(s){const t=N(s,"session.create");return{sessionId:S(t,"sessionId","session.create"),model:Ht(t.model,"session.create.model"),sequence:ce(t,"sequence","session.create")}}function Ro(s){const t=N(s,"session.branch_create"),e=N(t.branch,"session.branch_create.branch"),n="session.branch_create.branch";return{branchId:S(e,"branchId",n),...e.parentBranchId===void 0||e.parentBranchId===null?{}:{parentBranchId:S(e,"parentBranchId",n)},...e.branchPoint===void 0||e.branchPoint===null?{}:{branchPoint:ce(e,"branchPoint",n)},...e.createEvent===void 0||e.createEvent===null?{}:{createEvent:ce(e,"createEvent",n)}}}function Po(s){const t=N(s,"session.history");return{events:_e(t.events,"session.history.events").map((e,n)=>un(e,`session.history.events[${n}]`)),through:ce(t,"through","session.history"),nextAfter:ce(t,"nextAfter","session.history"),done:Ye(t,"done","session.history"),...t.nextBefore===void 0?{}:{nextBefore:ce(t,"nextBefore","session.history")},...t.turnStart===void 0?{}:{turnStart:ce(t,"turnStart","session.history")}}}function zo(s){const t=N(s,"session.model.update");return{model:Ht(t.model,"session.model.update.model"),outcome:S(t,"outcome","session.model.update")}}function Do(s,t){return s==="read-only"||s==="workspace-write"||s==="full-access"?s:xe(t,"a permission preset")}function rn(s,t){const e=N(s,t),n=o=>_e(e[o],`${t}.${o}`).map((i,r)=>(typeof i!="string"&&xe(`${t}.${o}[${r}]`,"a string"),i));return{preset:Do(e.preset,`${t}.preset`),allowedTools:n("allowedTools"),disallowedTools:n("disallowedTools")}}function Ms(s){const t="session.permission.get",e=N(s,t);return{version:ce(e,"version",t),policy:rn(e.policy,`${t}.policy`)}}function No(s){return ce(N(s,"session.permission.update"),"version","session.permission.update")}function jo(s){const t="session.files.search";return _e(N(s,t).candidates,`${t}.candidates`).map((e,n)=>{const o=`${t}.candidates[${n}]`,i=N(e,o);return{relativePath:S(i,"relativePath",o),absolutePath:S(i,"absolutePath",o),dir:Ye(i,"dir",o)}})}function Bo(s){return S(N(s,"attachment.put"),"path","attachment.put")}function Fo(s){return S(N(s,"session.model.update"),"outcome","session.model.update")}function Wo(s){const t=N(s,"provider.list");return _e(t.providers,"provider.list.providers").map((e,n)=>{const o=`provider.list.providers[${n}]`,i=N(e,o);return{providerId:S(i,"providerId",o),displayName:S(i,"displayName",o),enabled:Ye(i,"enabled",o),credentialConfigured:Ye(i,"credentialConfigured",o)}})}function Vo(s){return _e(s,"account.providers").map((t,e)=>{const n=`account.providers[${e}]`,o=N(t,n);return{providerId:S(o,"providerId",n),displayName:S(o,"displayName",n)}})}function Uo(s,t){const e=s.metadata===void 0||s.metadata===null?void 0:N(s.metadata,`${t}.metadata`),n=(e==null?void 0:e.reasoning)===void 0||e.reasoning===null?void 0:N(e.reasoning,`${t}.metadata.reasoning`);if(n===void 0||n.supported!==!0||N(s.capabilities,`${t}.capabilities`).reasoning!==!0)return;const i=n.effortOptions===void 0||n.effortOptions===null?[]:_e(n.effortOptions,`${t}.metadata.reasoning.effortOptions`).map((r,l)=>(typeof r!="string"&&xe(`${t}.metadata.reasoning.effortOptions[${l}]`,"a string"),r));return n.off!==void 0&&n.off!==null&&!i.includes("none")&&i.push("none"),i}function Ho(s){const t=N(s,"provider.catalog");if(t.catalog===null)return;const e=N(t.catalog,"provider.catalog.catalog");return{models:_e(e.models,"provider.catalog.models").map((n,o)=>{const i=`provider.catalog.models[${o}]`,r=N(n,i),l=Re(r,"unavailableReason",i),h=Uo(r,i);return{id:S(r,"id",i),name:S(r,"name",i),...l===void 0?{}:{unavailableReason:l},...h===void 0?{}:{reasoningEfforts:h}}}),disabledModelIds:_e(e.disabledModelIds,"provider.catalog.disabledModelIds").map((n,o)=>(typeof n!="string"&&xe(`provider.catalog.disabledModelIds[${o}]`,"a string"),n))}}function Ko(s){const t=N(s,"provider.selection");if(t.selection===null)return;const e=N(t.selection,"provider.selection.selection");return{providerId:S(e,"provider_id","provider.selection"),modelId:S(e,"model_id","provider.selection")}}function ln(s,t){return{content:_e(s.content,`${t}.content`).map((e,n)=>N(e,`${t}.content[${n}]`))}}function Qo(s){const t="session.input.withdraw",e=S(N(s,t),"status",t);if(e==="deleted"||e==="notHeld")return{status:e};xe(`${t}.status`,"deleted or notHeld")}const Gt='<dim-skill name="';function Go(s){if(!s.startsWith(Gt))return;const t=s.indexOf('"',Gt.length);if(!(t<0))return s.slice(Gt.length,t).replaceAll("<","<").replaceAll(">",">").replaceAll(""",'"').replaceAll("&","&")}function dn(s,t){const e=[],n=[];return _e(s,t).forEach((o,i)=>{const r=N(o,`${t}[${i}]`);if(r.type!=="text"||typeof r.text!="string")return;const l=i===0?void 0:Go(r.text);l===void 0?e.push(r.text):n.push(l)}),{text:e.join(`
|
|
218
|
-
`),skills:n}}function Jo(s,t){return _e(s,t).flatMap((e,n)=>{const o=N(e,`${t}[${n}]`);return o.type==="text"?[S(o,"text",`${t}[${n}]`)]:[]}).join(`
|
|
219
|
-
`)}function Ts(s,t){const e=N(s,t),n=typeof e.content=="string"?e.content:Jo(e.content,`${t}.content`),o=e.structuredContent===void 0||e.structuredContent===null?void 0:N(e.structuredContent,`${t}.structuredContent`),i=typeof(o==null?void 0:o.diff)=="string"?o.diff:void 0;return{text:n,isError:e.isError===!0,...i===void 0?{}:{diff:i}}}function Yo(s,t){return s==null?[]:_e(s,t).flatMap((e,n)=>{const o=N(e,`${t}[${n}]`);if(o.type!=="raw")return[];const i=Re(o,"key",`${t}[${n}]`);return[{text:S(o,"text",`${t}[${n}]`),...i===void 0?{}:{key:i},retire:o.retire===!0}]})}function Jt(s,t){const e=N(s,t),n=S(e,"kind",t);return n==="tool"?{kind:n,turnId:S(e,"turn_id",t),requestId:S(e,"request_id",t),callId:S(e,"call_id",t)}:n==="host"?{kind:n,operationId:S(e,"operation_id",t)}:xe(t,"a branch source")}function Xo(s,t){const e=N(s,t);switch(S(e,"kind",t)){case"sequence":return ce(e,"sequence",t);case"create":return;default:return xe(t,"a branch cut")}}function Zo(s,t,e,n){switch(`${s}/${t}`){case"input/message":{const o=Yo(e.blocks,`${n}.blocks`);if(e.user===void 0||e.user===null){if(o.length===0)return{kind:"input",blocks:o};const h=Re(e,"mode",n);return{kind:"source-input",text:o.map(I=>I.text).find(I=>I.startsWith("<dim-branch-"))??o[0].text,blocks:o,...h===void 0?{}:{mode:h}}}const i=N(e.user,`${n}.user`),{text:r,skills:l}=dn(i.content,`${n}.user.content`);return{kind:"input",text:r,user:ln(i,`${n}.user`),skills:l.length===0?void 0:l,blocks:o}}case"input/applied":return{kind:"input-applied",inputId:S(e,"input_id",n)};case"input/consumed":return{kind:"input-consumed",inputId:S(e,"input_id",n)};case"permission/changed":return{kind:"permission-changed",policy:rn(e.policy,`${n}.policy`)};case"input/deleted":return{kind:"input-deleted",inputId:S(e,"input_id",n)};case"branch/start":return{kind:"branch-start"};case"session/forked":return{kind:"session-forked"};case"branch/create":return{kind:"branch-create",branchId:S(e,"branch",n),at:Xo(e.at,`${n}.at`),prompt:S(e,"prompt",n),source:Jt(e.source,`${n}.source`)};case"branch/create-failed":{const o=S(e,"status",n);return o!=="failed"&&o!=="cancelled"&&xe(`${n}.status`,"a creation outcome"),{kind:"branch-create-failed",branchId:S(e,"branch",n),status:o,error:S(e,o==="failed"?"error":"reason",n)}}case"branch/end":return{kind:"branch-end",source:Jt(e.source,`${n}.source`),...e.ancestor===void 0||e.ancestor===null?{}:{ancestor:S(e,"ancestor",n)}};case"branch/ended":return{kind:"branch-ended",branchId:S(e,"branch",n),source:Jt(e.source,`${n}.source`),...e.ancestor===void 0||e.ancestor===null?{}:{ancestor:S(e,"ancestor",n)}};case"turn/end":{const o=S(e,"status",n);o!=="completed"&&o!=="failed"&&o!=="cancelled"&&xe(`${n}.status`,"a turn outcome");const i=o==="failed"?S(e,"error",n):void 0;return{kind:"turn-end",outcome:o,...i===void 0?{}:{error:i}}}case"step/model-start":return{kind:"model-start",requestId:S(e,"request_id",n)};case"step/thinking":return{kind:"thinking",requestId:S(e,"request_id",n),delta:S(e,"delta",n)};case"step/text":return{kind:"text",requestId:S(e,"request_id",n),delta:S(e,"delta",n)};case"step/tool-call":return{kind:"tool-call",requestId:S(e,"request_id",n),asks:cn(_e(e.calls,`${n}.calls`),`${n}.calls`)};case"step/tool-use":{const o=N(e.call,`${n}.call`);return{kind:"tool-use",requestId:S(e,"request_id",n),callId:S(o,"id",`${n}.call`),name:S(o,"name",`${n}.call`),input:N(o.input,`${n}.call.input`)}}case"step/tool-completed":return{kind:"tool-completed",requestId:S(e,"request_id",n),callId:S(e,"call_id",n),result:Ts(e.result,`${n}.result`)};case"step/tool-result":return{kind:"tool-result",requestId:S(e,"request_id",n),results:_e(e.results,`${n}.results`).map((o,i)=>{const r=N(o,`${n}.results[${i}]`);return{callId:S(r,"call_id",`${n}.results[${i}]`),result:Ts(r.result,`${n}.results[${i}].result`)}})};case"step/model-output-end":{const o=S(e,"status",n)==="failed",i=o?S(e,"error",n):void 0,r=o?So(e.presentation,`${n}.presentation`):void 0,l=o?Eo(e.failure,`${n}.failure`):void 0;return{kind:"model-end",requestId:S(e,"request_id",n),...i===void 0?{}:{error:i},...r===void 0?{}:{presentation:r},...l===void 0?{}:{failure:l}}}case"context/configured":return{kind:"context-configured",model:{providerId:S(e,"provider_id",n),modelId:S(e,"model_id",n)}};default:return{kind:"other"}}}function ei(s){if(!Array.isArray(s.questions)||s.questions.length<1||s.questions.length>4)return;const t=new Set,e=[];for(const[n,o]of s.questions.entries()){const i=ti(o,String(n+1));if(i===void 0||t.has(i.id))return;t.add(i.id),e.push(i)}return e}function ti(s,t){if(s===null||typeof s!="object"||Array.isArray(s))return;const e=s,n=e.id??t;if(typeof n!="string"||n===""||e.header!==void 0&&typeof e.header!="string"||typeof e.header=="string"&&[...e.header].length>40||typeof e.question!="string"||e.question.trim()===""||!Array.isArray(e.options)||e.options.length<2||e.options.length>6)return;const o=new Set,i=[];for(const r of e.options){if(r===null||typeof r!="object"||Array.isArray(r))return;const l=r;if(typeof l.label!="string"||l.label.trim()===""||o.has(l.label)||l.description!==void 0&&typeof l.description!="string")return;o.add(l.label),i.push({label:l.label,...typeof l.description=="string"?{description:l.description}:{}})}if(!(e.multiSelect!==void 0&&typeof e.multiSelect!="boolean"||e.allowCustom!==void 0&&typeof e.allowCustom!="boolean"))return{id:n,...typeof e.header=="string"?{header:e.header}:{},question:e.question,options:i,multiSelect:e.multiSelect===!0,allowCustom:e.allowCustom!==!1}}function cn(s,t){const e=[];for(const[n,o]of s.entries()){const i=N(o,`${t}[${n}]`);if(S(i,"name",`${t}[${n}]`)!=="ask_user")continue;const r=ei(N(i.input,`${t}[${n}].input`));r!==void 0&&e.push({callId:S(i,"id",`${t}[${n}]`),questions:r})}return e}function un(s,t){const e=N(s,t),n=S(e,"type",t),o=S(e,"name",t);return{id:S(e,"id",t),sequence:ce(e,"sequence",t),createAt:ce(e,"create_at",t),content:Zo(n,o,N(e.data,`${t}.data`),`${t}.data`)}}function si(s){const t="approval.request",e=N(s.call,`${t}.call`),n=N(s.source,`${t}.source`),o=n.kind==="tool"?S(n,"call_id",`${t}.source`):void 0;return{sessionId:S(s,"sessionId",t),branchId:S(s,"branchId",t),requestId:S(s,"requestId",t),...o===void 0?{}:{callId:o},call:{name:S(e,"name",`${t}.call`),input:N(e.input,`${t}.call.input`)},reason:S(s,"reason",t)}}function ni(s){const t="session.collaboration.approval.get",e=N(s,t);if(e.state==="ended")return{state:"ended"};e.state!=="pending"&&xe(t,"pending or ended");const n=N(e.descriptor,`${t}.descriptor`),o=N(n.member,`${t}.member`),i=N(n.call,`${t}.call`);return{state:"pending",approvalId:S(e,"approvalId",t),descriptor:{delegationId:S(n,"delegationId",t),requestId:S(n,"requestId",t),reason:S(n,"reason",t),member:{agentId:S(o,"agentId",t),sessionId:S(o,"sessionId",t),branchId:S(o,"branchId",t)},call:{name:S(i,"name",t),input:N(i.input,t)}}}}function oi(s,t){const e=N(t??{},s);switch(s){case"ui.extensions.changed":return{method:s,revision:ce(e,"revision",s)};case"session.event":return{method:s,sessionId:S(e,"sessionId",s),branchId:S(e,"branchId",s),event:un(e.event,`${s}.event`)};case"session.state":return{method:s,sessionId:S(e,"sessionId",s),branchId:S(e,"branchId",s),running:Ye(e,"running",s),stopping:Ye(e,"stopping",s)};case"session.model.progress":{const n=Re(e,"requestId",s),o=Mo(e.retry,`${s}.retry`);return{method:s,progress:{sessionId:S(e,"sessionId",s),branchId:S(e,"branchId",s),...n===void 0?{}:{requestId:n},text:S(e,"text",s),textOffset:ce(e,"textOffset",s),thinking:S(e,"thinking",s),thinkingOffset:ce(e,"thinkingOffset",s),...o===void 0?{}:{retry:o}}}}case"approval.request":return{method:s,request:si(e)};case"approval.resolved":case"approval.cancelled":return{method:s,sessionId:S(e,"sessionId",s),branchId:S(e,"branchId",s),requestId:S(e,"requestId",s)};case"session.notice":{if(e.source==="SessionStore"&&e.kind==="title")return{method:"session.title",sessionId:S(e,"sessionId",s),data:on(N(e.data,`${s}.data`),`${s}.data`)};if(e.source!=="Collaboration"||e.kind!=="memberApprovalEnded")return;const n=N(e.data,s);return{method:"memberApprovalEnded",sessionId:S(e,"sessionId",s),branchId:S(n,"branchId",s),approvalId:S(n,"approvalId",s)}}case"session.closed":{const n=Re(e,"reason",s);return{method:s,sessionId:S(e,"sessionId",s),...n===void 0?{}:{reason:n}}}default:return}}function ii(s){const t=N(s,"ui.extensions.list");return{revision:ce(t,"revision","ui.extensions.list"),extensions:_e(t.extensions,"extensions").map(e=>{const n=N(e,"extension");return{pluginName:S(n,"pluginName","extension"),generation:S(n,"generation","extension"),panels:_e(n.panels,"panels").map(o=>{const i=N(o,"panel"),r=N(i.title,"title"),l=r.translations===void 0?void 0:N(r.translations,"translations");return{id:S(i,"id","panel"),title:{default:S(r,"default","title"),translations:l===void 0?void 0:Object.fromEntries(Object.entries(l).map(([h])=>[h,S(l,h,"translations")]))},icon:Re(i,"icon","panel"),entry:S(i,"entry","panel"),placement:S(i,"placement","panel"),requires:_e(i.requires,"requires").map(h=>typeof h=="string"?h:xe("requires","strings")),methods:_e(i.methods,"methods").map(h=>{const g=N(h,"method"),I=g.scope;return I!=="session"&&I!=="branch"&&xe("scope","session or branch"),{name:S(g,"name","method"),scope:I}})}})}}),errors:_e(t.errors,"errors").map(e=>{const n=N(e,"error");return{pluginName:S(n,"pluginName","error"),message:S(n,"message","error")}})}}function pn(s){const t=N(s,"event");return{id:S(t,"id","event"),sequence:ce(t,"sequence","event"),create_at:ce(t,"create_at","event"),type:S(t,"type","event"),name:S(t,"name","event"),data:N(t.data,"event.data"),...t.tags===void 0?{}:{tags:_e(t.tags,"event.tags").map(e=>typeof e=="string"?e:xe("event.tags","strings"))},...t.context_render===void 0?{}:{context_render:Ye(t,"context_render","event")},...t.context_state===void 0?{}:{context_state:Ye(t,"context_state","event")}}}function ai(s){const t=N(s,"session.history");return{events:_e(t.events,"events").map(pn),through:ce(t,"through","history"),nextAfter:ce(t,"nextAfter","history"),done:Ye(t,"done","history")}}function ri(s){return{event:pn(N(s,"session.submit").event)}}function li(s){return{sequence:ce(N(s,"session.stop"),"sequence","session.stop")}}function hn(s){const t="branch",e=N(s,t),n=S(e,"branchId",t),o=e.end===void 0||e.end===null?void 0:N(e.end,`${t}.end`);return{branchId:n,parentBranchId:n==="main"?void 0:S(e,"parentBranchId",t),branchPoint:n==="main"?void 0:ce(e,"branchPoint",t),state:S(e,"state",t),head:ce(e,"head",t),purpose:Re(e,"purpose",t),cutMessages:e.cutMessages===void 0||e.cutMessages===null?void 0:ce(e,"cutMessages",t),end:o===void 0?void 0:{source:{kind:S(N(o.source,`${t}.end.source`),"kind",`${t}.end.source`)},ancestor:Re(o,"ancestor",`${t}.end`)}}}function di(s){return _e(N(s,"session.branches").branches,"session.branches.branches").map(hn)}function ci(s){return hn(s)}function ui(s){return Ht(N(s,"session.attach").model,"session.attach.model")}function pi(s){const t="session.input.pending",e=N(s,t),n=_e(e.inputs,`${t}.inputs`).flatMap((o,i)=>{const r=`${t}.inputs[${i}]`,l=N(o,r);if(l.user===null)return[];const h=ln(N(l.user,`${r}.user`),`${r}.user`),g=dn(h.content,`${r}.user.content`);return[{id:S(l,"inputId",r),text:g.text,skills:g.skills,user:h}]});return{branchId:S(e,"branchId",t),through:ce(e,"through",t),inputs:n,next:e.next}}function hi(s){const t="session.question.pending",e=N(s,t),n=_e(e.batches,`${t}.batches`).flatMap((o,i)=>{const r=`${t}.batches[${i}]`,l=N(o,r);return cn(_e(l.calls,`${r}.calls`),`${r}.calls`).map(h=>({requestId:S(l,"requestId",r),...h}))});return{branchId:S(e,"branchId",t),through:ce(e,"through",t),asks:n,next:e.next}}function mi(s){const t="session.turn.get",e=N(s,t),n=e.turn===null?void 0:N(e.turn,`${t}.turn`),o=e.output===null?void 0:N(e.output,`${t}.output`);return{branchId:S(e,"branchId",t),through:ce(e,"through",t),turn:n===void 0?void 0:{sequence:ce(n,"sequence",`${t}.turn`),ended:Ye(n,"ended",`${t}.turn`)},output:o===void 0?void 0:{requestId:S(o,"requestId",`${t}.output`),textCharacters:ce(o,"textCharacters",`${t}.output`),thinkingCharacters:ce(o,"thinkingCharacters",`${t}.output`)}}}function vi(s){const t="session.goal.get",e=N(s,t);if(e.goal===null)return;const n=N(e.goal,`${t}.goal`),o=N(n.status,`${t}.goal.status`),i=S(o,"kind",`${t}.goal.status`);return["active","paused","completed","blocked","none"].includes(i)?{objective:S(n,"objective",`${t}.goal`),evaluator:Ye(n,"evaluator",`${t}.goal`),status:i==="paused"?{kind:i,reason:S(o,"reason",`${t}.goal.status`)}:{kind:i}}:xe(`${t}.goal.status.kind`,"a goal status")}function fi(s){const t="session.tool.get",e=N(s,t);if(e.call===null)return;const n=N(e.call,`${t}.call`),o=N(n.call,`${t}.call.call`);return{requestId:S(n,"request_id",`${t}.call`),callId:S(o,"id",`${t}.call.call`),name:S(o,"name",`${t}.call.call`),input:N(o.input,`${t}.call.call.input`)}}class ct extends Error{constructor(e,n,o){super(n);ve(this,"name","RpcError");this.code=e,this.appError=o}}class Nt extends Error{constructor(){super(...arguments);ve(this,"name","ConnectionLost")}}const gi=3e4,bi=2e4,yi=1e4,qs=[500,1e3,2e3,4e3,8e3,15e3];class wi{constructor(t){ve(this,"socket");ve(this,"nextId",1);ve(this,"pending",new Map);ve(this,"heartbeat");ve(this,"retry");ve(this,"attempt",0);ve(this,"connectedOnce",!1);ve(this,"stopped",!1);this.handlers=t}start(){this.stopped=!1,this.open()}stop(){var t;this.stopped=!0,clearTimeout(this.retry),(t=this.socket)==null||t.close()}retryNow(){this.socket!==void 0||this.stopped||(clearTimeout(this.retry),this.open())}call(t,e,n,o=gi){const i=this.socket;if(i===void 0||i.readyState!==WebSocket.OPEN)return Promise.reject(new Nt("Not connected"));const r=this.nextId++;return new Promise((l,h)=>{const g=setTimeout(()=>{this.pending.delete(r),h(new Error(`${t} timed out; the outcome is unknown`))},o);this.pending.set(r,{resolve:l,reject:h,timer:g}),i.send(JSON.stringify({jsonrpc:"2.0",id:r,method:t,params:e}))}).then(n)}open(){this.handlers.phase(this.connectedOnce?"reconnecting":"connecting");const t=location.protocol==="https:"?"wss:":"ws:",e=new WebSocket(`${t}//${location.host}/ws`);this.socket=e;let n=!1;e.onopen=()=>{n=!0,this.handshake()},e.onmessage=o=>this.receive(o.data),e.onclose=()=>{if(this.socket===e){this.socket=void 0,clearInterval(this.heartbeat);for(const[o,i]of this.pending)clearTimeout(i.timer),i.reject(new Nt("Connection closed")),this.pending.delete(o);this.stopped||(n?this.schedule():this.diagnoseRefusal())}}}async handshake(){var n,o;let t;try{t=await this.call("hello",{protocolVersion:Es,clientKind:"web",clientName:"dim-web"},To)}catch(i){i instanceof ct&&i.appError==="protocol_version"&&(this.stopped=!0,this.handlers.phase("version-mismatch")),(n=this.socket)==null||n.close();return}if(t.protocolVersion!==Es){this.stopped=!0,this.handlers.phase("version-mismatch"),(o=this.socket)==null||o.close();return}const e=this.connectedOnce;this.connectedOnce=!0,this.attempt=0,this.heartbeat=setInterval(()=>{this.call("daemon.ping",{},()=>{},yi).catch(()=>{var i;return(i=this.socket)==null?void 0:i.close()})},bi),this.handlers.phase("connected"),this.handlers.ready(t,e)}async diagnoseRefusal(){let t=!1;try{t=(await fetch("/api/auth/session",{cache:"no-store"})).status===401}catch{t=!1}this.stopped||(t?(this.stopped=!0,this.handlers.phase("unauthenticated")):this.schedule())}schedule(){this.handlers.phase(this.connectedOnce?"reconnecting":"connecting");const t=qs[Math.min(this.attempt,qs.length-1)];this.attempt+=1,this.retry=setTimeout(()=>this.open(),t)}receive(t){let e;try{const o=JSON.parse(String(t));if(o===null||typeof o!="object"||Array.isArray(o))throw new Te("Expected a JSON-RPC object");e=o}catch(o){this.handlers.invalid(o instanceof Te?o:new Te("Invalid JSON frame"));return}if(typeof e.id=="number"){const o=this.pending.get(e.id);if(o===void 0)return;this.pending.delete(e.id),clearTimeout(o.timer),"error"in e?o.reject(ki(e.error)):o.resolve(e.result);return}if(typeof e.method!="string")return;let n;try{n=oi(e.method,e.params)}catch(o){this.handlers.invalid(o instanceof Te?o:new Te(String(o)));return}n!==void 0&&this.handlers.notification(n)}}function ki(s){const t=s!==null&&typeof s=="object"?s:{},e=t.data!==null&&typeof t.data=="object"?t.data:{};return new ct(typeof t.code=="number"?t.code:-32603,typeof t.message=="string"?t.message:"Request failed",typeof e.appError=="string"?e.appError:void 0)}async function _i(){const s=new URLSearchParams(location.hash.slice(1)).get("bootstrap");if(s!==null){history.replaceState(history.state,"",`${location.pathname}${location.search}`);try{await fetch("/api/auth/exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:s})})}catch{}}}const Ii=/[;&|`()<>$\r\n]/;function mn(s){if(s.call.name!=="exec"&&s.call.name!=="execute")return;const t=s.call.input.command;if(!(typeof t!="string"||Ii.test(t)||t.trim()===""))return t}function $i(s){return{command:s.split(/\s+/).filter(t=>t!=="").join(" "),match:"exact",decision:"allow"}}function xi(s,t){return s.decision===t.decision&&s.match===t.match&&s.command.split(/\s+/).filter(e=>e!=="").join(" ")===t.command}function vn(s){const t=s.call.name;if(t!=="read"&&t!=="write"&&t!=="edit")return;const e=s.call.input.path;if(typeof e=="string")return{path:e,kind:"file",mode:t==="read"?"read":"write"}}const Ci="modulepreload",Si=function(s){return"/"+s},As={},Ee=function(t,e,n){let o=Promise.resolve();if(e&&e.length>0){let r=function(g){return Promise.all(g.map(I=>Promise.resolve(I).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),h=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));o=r(e.map(g=>{if(g=Si(g),g in As)return;As[g]=!0;const I=g.endsWith(".css"),v=I?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${v}`))return;const _=document.createElement("link");if(_.rel=I?"stylesheet":Ci,I||(_.as="script"),_.crossOrigin="",_.href=g,h&&_.setAttribute("nonce",h),document.head.appendChild(_),I)return new Promise((w,b)=>{_.addEventListener("load",w),_.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${g}`)))})}))}function i(r){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=r,window.dispatchEvent(l),!l.defaultPrevented)throw r}return o.then(r=>{for(const l of r||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},Ei={"a11y.mainContent":"Main content","a11y.primaryNavigation":"Primary navigation","a11y.workspaceSessionIndex":"Workspace and session index","auth.connectingTitle":"Connecting to Dim…","auth.expiredTitle":"This link has expired","auth.expiredBefore":"This browser is not signed in to the web workspace, or the workspace was reopened. Run ","auth.expiredAfter":" to get a fresh link.","auth.versionTitle":"Update the browser page","auth.versionDescription":"This page and the App Server speak different protocol versions. Reload the page; if it persists, run dimcode web again.","brand.product":"Dim","brand.webHost":"Web workspace","chat.assistant":"Dim","chat.composer":"Message composer","chat.copyFailed":"Clipboard access failed.","chat.emptyTimeline":"Send a message to begin.","chat.pathCopied":"Path copied","chat.removedDescription":"This session is closed or no longer exists on the App Server.","chat.removedTitle":"Session closed","chat.you":"You","common.cancel":"Cancel","common.close":"Close","common.loading":"Loading…","common.search":"Search","common.skipToContent":"Skip to content","composer.category.model":"Model","composer.category.session":"Session","composer.branchUnavailable":"Branch creation is not available here","composer.command.branch":"Open a line here","composer.command.compact":"Compact the context","composer.command.fork":"Fork at the last finished turn","composer.command.usage":"Show the context window usage","composer.command.lines":"Show session lines","command.basisEstimated":"estimated","command.basisProvider":"counted by the provider","command.compactSkipped":"Compaction skipped","command.compacted":"Context compacted","command.failed":"Command failed","command.effortChoices":"Reasoning effort choices: {choices}","command.effortSet":"Reasoning effort configuration {outcome}: {value}","command.effortUnavailable":"This model does not advertise reasoning effort choices.","command.effortUnknown":"Reasoning effort is not advertised by this model.","command.effortUsage":"Usage: /effort [VALUE]","composer.command.effort":"Show or set the reasoning effort","queue.notHeld":"That message was already adopted by the run.","queue.remove":"Remove","queue.steer":"Steer","queue.title":"Queued messages","command.usage":"Context: {input} / {window} tokens ({percent}%), {basis} · output up to {output} · compacts at {threshold}","command.usageTitle":"Context usage","fork.confirm":"Fork this session at its last finished turn? The new session copies main up to that point.","fork.confirmLabel":"Fork","composer.command.goal":"Show or change the goal","goal.action.clear":"cleared","goal.action.edit":"edited","goal.action.pause":"paused","goal.action.resume":"resumed","goal.action.set":"set","goal.evaluator":"evaluator judge","goal.line":"Goal on main · {status}","goal.none":"No goal on main.","goal.sent":"Goal {action} on main","goal.status.active":"active","goal.status.blocked":"blocked","goal.status.completed":"completed","goal.status.none":"no status","goal.status.paused":"paused ({reason})","goal.usage":"Usage: /goal [objective | set objective | edit objective | pause | resume | clear]","composer.command.models":"Choose a model","composer.command.new":"New session","composer.command.scheduled":"Manage scheduled tasks on the CLI host","composer.commandKeys":"↑↓ select · Enter confirm · Esc close","composer.command.permissions":"Show or change the session permissions","composer.permission.label":"Permissions","composer.permission.preset.read-only":"Read only","composer.permission.preset.workspace-write":"Workspace write","composer.permission.preset.full-access":"Full access","composer.permission.description.read-only":"Read files; deny writes and process commands.","composer.permission.description.workspace-write":"Write inside the workspace; ask for paths outside it and other risks.","composer.permission.description.full-access":"No path limit; skip tool questions. Explicit denies still apply.","composer.permission.fullAccessConfirm":"Allow unrestricted file access and skip tool questions? Explicit denies and process isolation still apply.","composer.permission.allowedTools":"Allowed tools","composer.permission.disallowedTools":"Denied tools","composer.permission.isolation":"The preset does not change process isolation.","composer.permission.processIsolation":"Process isolation settings","permission.conflict":"The permissions changed elsewhere. The current setting is shown.","timeline.rail":"Messages","composer.files":"Files","composer.mentionKeys":"↑↓ select · Enter insert · Esc close","composer.imageAttachment":"Attached image","composer.imageLimit":"A message takes up to 20 images.","question.selectMany":"Choose one or more","composer.imageReadFailed":"This image could not be read.","composer.onlyImages":"Only images can be attached here yet.","composer.pastedText":"Pasted text · {lines} lines","composer.pasteTooLarge":"This paste is larger than 10 MB.","composer.removeAttachment":"Remove attachment","composer.commands":"Commands","composer.modelLoadRetry":"Load failed · Retry","composer.modelLoading":"Loading models…","composer.noModels":"No models available","composer.notConfigured":"Default model","composer.searchModels":"Search models...","composer.send":"Send","composer.sendMessage":"Send a message...","composer.stopResponse":"Stop response","failure.details":"Details","failure.details.cause":"cause:","failure.details.kind":"kind: {kind}","failure.details.providerCode":"provider code: {code}","failure.details.requestId":"request id: {id}","failure.details.retryAfter":"the provider asked to wait {seconds} s","failure.details.status":"status: {status}","failure.details.tried":"tried {count} times over {seconds} s","failure.incomplete":"The response above is incomplete.","failure.retryAnnouncement":"Retrying, attempt {attempt} of {max}: {reason}","failure.tried":"Tried {count} times over {seconds} s.","failure.kind.network.meaning":"Could not reach the provider, or the connection dropped","failure.kind.rate_limited.meaning":"The provider is rate limiting requests","failure.kind.server_error.meaning":"The provider reported a server error","failure.kind.malformed_response.meaning":"The provider sent a response Dim could not use","failure.kind.auth_rejected.meaning":"The provider rejected the credentials","failure.kind.quota_exhausted.meaning":"The account has no quota left","failure.kind.not_found.meaning":"The provider did not find the model or endpoint","failure.kind.context_too_long.meaning":"The conversation is longer than the model accepts","failure.kind.content_filtered.meaning":"The provider's content filter blocked the response","failure.kind.invalid_request.meaning":"The provider rejected the request","failure.kind.output_limit.meaning":"The model stopped at its output limit","failure.kind.unknown.meaning":"The model request failed","failure.kind.network.action":"Check the network or proxy.","failure.kind.rate_limited.action":"Wait and try again.","failure.kind.server_error.action":"Try again later or choose another model.","failure.kind.malformed_response.action":"Try again; if it repeats, choose another model or check the proxy or gateway.","failure.kind.auth_rejected.action":"Sign in again or check the API key.","failure.kind.quota_exhausted.action":"Check the plan or billing.","failure.kind.not_found.action":"Check the model and the provider's base URL.","failure.kind.context_too_long.action":"Compact the conversation or start a new session.","failure.kind.content_filtered.action":"Rephrase the request.","failure.kind.invalid_request.action":"See the details.","failure.kind.output_limit.action":"Increase the output token limit and retry.","failure.kind.unknown.action":"See the details.","connection.accessRequired":"Access required","connection.connecting":"Connecting","connection.host":"App Server","connection.live":"Live","connection.protocolError":"Unexpected data from the App Server","connection.reconnecting":"Reconnecting","connection.versionMismatch":"Version mismatch","detail.output":"Output","timeline.loadEarlier":"Earlier content not loaded · Load earlier","timeline.loadingEarlier":"Loading earlier content…","lines.state.ending":"Ending","lines.state.ended":"Ended","lines.afterMessage":"after message {count}","lines.atEnd":"at the end of the line","lines.beforeMessage":"before “{message}”","lines.closePanel":"Close lines panel","lines.closeTab":"Close line tab","lines.collapse":"Restore panel width","lines.create":"Create line","lines.empty":"This line has no messages yet.","lines.emptyHint":"Branch from a message to work in parallel.","lines.emptyTitle":"No lines yet","lines.end":"End","lines.endDescription":"The line stops and becomes read-only. This cannot be undone.","lines.endLine":"End line {name}","lines.endTitle":"End line “{name}”?","lines.expand":"Expand panel","lines.from":"from {name}","lines.lineAria":"Line {name}","lines.loadFailed":"Could not load this line.","lines.main":"main","lines.mainHint":"the session itself","lines.newChild":"New child line","lines.newLine":"New line","lines.newLineFrom":"From {name}","lines.newLineTitle":"New line","lines.noFinishedTurn":"No finished turn to cut at yet","lines.open":"Open lines","lines.openLine":"Open line {name}","lines.panelAria":"Session lines","lines.placeholder":"Message this line…","lines.promptLabel":"Opening message","lines.promptPlaceholder":"What should this line do?","lines.promptRequired":"Write the line's opening message.","lines.readOnly":"This line is read-only.","lines.resize":"Resize lines panel","lines.retry":"Retry","lines.state.creationFailed":"creation failed","lines.state.endedByOperation":"ended by an operation","lines.state.endedItself":"ended itself","lines.state.endedWith":"ended with {id}","lines.state.main":"the session itself","lines.state.waiting":"waiting","lines.state.working":"working","lines.title":"Lines","message.branch":"Branch from here","message.collapse":"Collapse message","message.copy":"Copy entire message","message.skillLoaded":"Skill loaded: {name}","message.expand":"Show full message","message.quote":"Quote in the composer","newThread.pathLabel":"Absolute directory path","newThread.pathPlaceholder":"/path/to/project","newThread.selectWorkspace":"Select workspace...","newThread.title":"Start Build","newThread.usePath":"Use","newThread.workspaceRequired":"Choose a workspace or type an absolute directory.","page.notFoundDescription":"There is nothing at this address.","page.reconnecting":"Connection lost. Reconnecting…","prompt.actionRequest":"Dim wants to: {action}","prompt.allowOnce":"Allow once","prompt.allowAlways":"Always allow","prompt.allowSession":"Allow for this session","question.awaitingAnswer":"Awaiting answer","question.decline":"Decline","question.failed":"Failed to send the answer","question.notPending":"This question is no longer waiting for an answer. Send again once the run continues.","question.other":"Other answer","question.otherPlaceholder":"Type your own answer","question.steps":"Questions","question.number":"Question {number}","question.previous":"Previous","question.next":"Next","question.review":"Review answers","question.edit":"Edit","question.editAnswer":"Edit answer: {question}","question.unanswered":"Not answered","question.sent":"Answer sent","question.submit":"Send answers","question.title":"Dim has a question","prompt.awaitingApproval":"Awaiting approval","prompt.input":"Input","prompt.permissionSubmitFailed":"Failed to submit tool permission","prompt.reject":"Reject","prompt.useTool":"Use a tool","route.newSession":"New session","route.notFound":"Page not found","route.session":"Session","sidebar.closeMenu":"Close navigation","sidebar.collapseWorkspace":"Collapse {name}","sidebar.expandWorkspace":"Expand {name}","sidebar.newInWorkspace":"New session in {name}","sidebar.newSession":"New session","sidebar.noMatches":"No workspaces or sessions match.","sidebar.noWorkspaces":"No sessions yet.","sidebar.openMenu":"Open navigation","sidebar.searchPlaceholder":"Search workspaces and sessions","sidebar.showLess":"Show less","sidebar.showMore":"Show more","sidebar.untitled":"New session","session.parent":"Parent session: {title}","session.children":"Child sessions ({count})","sidebar.workspaces":"Workspaces","status.running":"Running","status.stopping":"Stopping","timeline.beforeMessage":"before “{message}”","timeline.copied":"Copied","timeline.copy":"Copy","timeline.final":"final","timeline.fromLine":"◂ from {id}","timeline.lineEnded":"◂ {id} ended","timeline.lineEndedByOperation":"This line ended (an operation)","timeline.lineEndedItself":"This line ended (itself)","timeline.lineEndedWith":"This line ended (with {id})","timeline.lineWaiting":"◂ {id} is waiting ({status})","timeline.noticeStopped":"Stopped","timeline.scrollToBottom":"Scroll to bottom","timeline.steer":"(steer)","tool.edit":"Edit","tool.glob":"Find","tool.grep":"Search content","tool.listFiles":"List files","tool.read":"Read","tool.run":"Run","tool.runBackground":"Run (background)","tool.webFetch":"Fetch webpage","tool.webSearch":"Search web","tool.write":"Write","work.actionSeparator":", ","work.command":"{count} command | {count} commands","work.edit":"{count} edit | {count} edits","work.processing":"Processing","work.read":"{count} read | {count} reads","work.search":"{count} search | {count} searches","work.separator":" · ","work.retrying":"Retrying {attempt}/{max} in {seconds} s · {reason} · {stop}","work.waiting":"Waiting for the provider · {reason} · {stop}","work.thinking":"Thinking","work.thinkingSteps":"Thought once | Thought {count} times","work.thoughtFor":"Thought for {duration}","work.unknown":"{count} tool | {count} tools","work.webFetch":"{count} fetch | {count} fetches","work.webSearch":"{count} web search | {count} web searches"},Mi=()=>Ee(()=>import("./zh-CN-CJTbN_T1.js"),[]),_t=jn({legacy:!1,locale:"en",fallbackLocale:"en",messages:{en:Ei}});function Ti(s){return s.toLowerCase().startsWith("zh")?"zh-CN":"en"}async function fn(s){const t=Ti(s);t==="zh-CN"&&!_t.global.availableLocales.includes(t)&&_t.global.setLocaleMessage(t,(await Mi()).default),_t.global.locale.value=t}function Oe(s,t){return _t.global.t(s,t??{})}function us(s){return`failure.kind.${s}.meaning`}function qi(s){return`failure.kind.${s}.action`}function gn(s){const t=s==null?void 0:s.trim();if(!(t===void 0||t===""))return t.replace(/\.$/u,"")}function Ai(s,t){const e=gn(s.reason),n=Oe(us(s.kind)),o=e===void 0?n:`${n}: ${e}.`,i=t?`${Oe("failure.incomplete")} `:"",r=s.attempts>1?` ${Oe("failure.tried",{count:s.attempts,seconds:Math.floor((s.waitedMs+500)/1e3)})}`:"";return`${i}${o} ${Oe(qi(s.kind))}${r}`}function Li(s){const t=[Oe("failure.details.kind",{kind:s.kind})];return s.status!==void 0&&t.push(Oe("failure.details.status",{status:s.status})),s.providerCode!==void 0&&t.push(Oe("failure.details.providerCode",{code:s.providerCode})),s.requestId!==void 0&&t.push(Oe("failure.details.requestId",{id:s.requestId})),s.attempts>1&&t.push(Oe("failure.details.tried",{count:s.attempts,seconds:(s.waitedMs/1e3).toFixed(1)})),s.retryAfterMs!==void 0&&t.push(Oe("failure.details.retryAfter",{seconds:Math.floor(s.retryAfterMs/1e3)})),s.cause.length>0&&(t.push(Oe("failure.details.cause")),t.push(...s.cause)),t}function Oi(s,t){return Math.max(0,Math.ceil((s-t)/1e3))}function Ri(s,t){const e=gn(s.reason),n=Oe(us(s.kind)),o=e===void 0?n:`${n}: ${e}`,i=Oe("composer.stopResponse");return t<=0?Oe("work.waiting",{reason:o,stop:i}):Oe("work.retrying",{attempt:s.attempt,max:s.maxAttempts,seconds:t,reason:o,stop:i})}function Pi(s){return s===void 0?"":Oe("failure.retryAnnouncement",{attempt:s.attempt,max:s.maxAttempts,reason:Oe(us(s.kind))})}class ns{constructor(){ve(this,"rows",[]);ve(this,"cursor",0);ve(this,"lastTurnEnd");ve(this,"model");ve(this,"answers",new Map);ve(this,"thoughts",new Map);ve(this,"requestStarts",new Map);ve(this,"tools",new Map);ve(this,"lines",new Map);ve(this,"asks",[]);ve(this,"held",new Map);ve(this,"goal");ve(this,"controlCursor",0);ve(this,"output");ve(this,"showedOutput",new Set);ve(this,"shownFailure")}queued(){return[...this.held.values()]}waiting(){return this.asks}restoreControls(t,e,n){this.held=new Map(t.map(o=>[o.id,o])),this.asks=e,this.controlCursor=n}applyControl(t){if(t.sequence<=this.controlCursor)return;this.controlCursor=t.sequence;const e=t.content;switch(e.kind){case"input":e.user!==void 0&&this.held.set(t.id,{id:t.id,text:e.text??"",skills:e.skills,user:e.user});break;case"input-consumed":case"input-deleted":this.held.delete(e.inputId);break;case"tool-call":for(const n of e.asks)this.asks.push({requestId:e.requestId,callId:n.callId,questions:n.questions});break;case"tool-result":this.asks=this.asks.filter(n=>n.requestId!==e.requestId||!e.results.some(o=>o.callId===n.callId));break}}activeOutput(t){this.output=t;const e=this.answers.get(t.requestId),n=this.thoughts.get(t.requestId);e!==void 0&&(e.writtenChars=t.textCharacters),n!==void 0&&(n.writtenChars=t.thinkingCharacters)}apply(t){if(t.sequence<=this.cursor)return!1;this.cursor=t.sequence,this.applyControl(t);const e=t.content;switch(e.kind){case"input":e.text!==void 0&&this.push({kind:"user",key:`user-${t.sequence}`,text:e.text,skills:e.skills,at:t.createAt,sequence:t.sequence,cut:Math.max(0,t.sequence-1)});break;case"input-applied":case"input-consumed":case"input-deleted":break;case"source-input":{const n=zi(e.text,e.mode);n!==void 0&&this.push({...n,key:`notice-${t.sequence}`});break}case"branch-create":{const n=e.at??t.sequence,o=this.rows.find(r=>r.kind==="user"&&r.cut===n),i=(o==null?void 0:o.kind)==="user"?Ni(o.text):void 0;this.lines.set(e.branchId,this.push({kind:"line",key:`line-${t.sequence}`,branchId:e.branchId,purpose:bn(e.prompt),...i===void 0?{}:{before:i}}));break}case"branch-create-failed":{const n=this.lines.get(e.branchId);n!==void 0&&this.update(n,{failed:!0});break}case"branch-end":{const n=e.ancestor;this.push({kind:"line-ended",key:`line-ended-${t.sequence}`,issuer:n!==void 0?"ancestor":e.source.kind==="tool"?"itself":"operation",...n===void 0?{}:{ancestor:n}});break}case"model-start":this.requestStarts.set(e.requestId,t.createAt);break;case"thinking":{this.showedOutput.add(e.requestId);const n=this.openThinking(e.requestId);Ls(n,e.delta);const o=this.requestStarts.get(e.requestId);this.update(n.index,{text:Ot(n),...o===void 0?{}:{elapsedMs:Math.max(0,t.createAt-o)}});break}case"text":{this.showedOutput.add(e.requestId),this.closeThinking(e.requestId);const n=this.openAnswer(e.requestId);Ls(n,e.delta),this.update(n.index,{text:Ot(n)});break}case"tool-use":this.showedOutput.add(e.requestId),this.closeThinking(e.requestId),this.closeAnswer(e.requestId),this.requestStarts.delete(e.requestId),this.tools.set(e.callId,this.push({kind:"tool",key:`tool-${e.callId}`,callId:e.callId,name:e.name,input:e.input,pending:!0}));break;case"tool-call":break;case"tool-completed":this.completeTool(e.callId,e.result);break;case"tool-result":for(const n of e.results)this.completeTool(n.callId,n.result);break;case"model-end":{const n=this.showedOutput.delete(e.requestId);if(this.closeThinking(e.requestId),this.closeAnswer(e.requestId),this.requestStarts.delete(e.requestId),e.error!==void 0){const o=e.failure,i=e.presentation!==void 0?Di(e.presentation,e.error):o!==void 0?Ai(o,n):e.error;this.push({kind:"error",key:`error-${t.sequence}`,text:i,...o===void 0?{}:{details:o}}),this.shownFailure=e.error}break}case"turn-end":{this.lastTurnEnd=t.sequence;for(const o of[...this.thoughts.keys()])this.closeThinking(o);for(const o of[...this.answers.keys()])this.closeAnswer(o);this.requestStarts.clear();const n=this.shownFailure;if(this.shownFailure=void 0,e.outcome==="failed"){const o=e.error??"";n!==o&&this.push({kind:"error",key:`error-${t.sequence}`,text:o})}e.outcome==="cancelled"&&this.push({kind:"stopped",key:`stopped-${t.sequence}`});break}case"context-configured":this.model=e.model;break}return!0}progress(t){const e=t.requestId;if(e!==void 0){if(t.thinking!==""){this.showedOutput.add(e);const n=this.openThinking(e);n.progress={text:t.thinking,offset:t.thinkingOffset},this.update(n.index,{text:Ot(n)})}if(t.text!==""){this.showedOutput.add(e);const n=this.openAnswer(e);n.progress={text:t.text,offset:t.textOffset},this.update(n.index,{text:Ot(n)})}}}prepend(t,e){const n=t.length;for(const o of[...this.answers.values(),...this.thoughts.values()])o.index+=n;for(const[o,i]of this.tools)this.tools.set(o,i+n);for(const[o,i]of this.lines)this.lines.set(o,i+n);this.rows=t.map(o=>({...o,key:`${e}:${o.key}`,...o.kind==="assistant"||o.kind==="thinking"?{streaming:!1}:{}})).concat(this.rows)}push(t){return this.rows.push(t),this.rows.length-1}update(t,e){this.rows[t]={...this.rows[t],...e}}openThinking(t){var n;let e=this.thoughts.get(t);return e===void 0&&(e={index:this.push({kind:"thinking",key:`thinking-${t}-${this.rows.length}`,text:"",streaming:!0}),written:"",writtenChars:((n=this.output)==null?void 0:n.requestId)===t?this.output.thinkingCharacters:0},this.thoughts.set(t,e)),e}openAnswer(t){var n;let e=this.answers.get(t);return e===void 0&&(e={index:this.push({kind:"assistant",key:`assistant-${t}-${this.rows.length}`,text:"",streaming:!0}),written:"",writtenChars:((n=this.output)==null?void 0:n.requestId)===t?this.output.textCharacters:0},this.answers.set(t,e)),e}closeThinking(t){const e=this.thoughts.get(t);e!==void 0&&(this.thoughts.delete(t),this.update(e.index,{text:e.written,streaming:!1}))}closeAnswer(t){const e=this.answers.get(t);e!==void 0&&(this.answers.delete(t),this.update(e.index,{text:e.written,streaming:!1}))}completeTool(t,e){const n=this.tools.get(t);n!==void 0&&(this.tools.delete(t),this.update(n,{pending:!1,result:e}))}}function zi(s,t){if(s.startsWith("<dim-branch-message")){const e=Et(s,"from");return e===void 0?void 0:{kind:"source-message",from:e,steer:t==="steer",final:Et(s,"final")!==void 0,body:ji(Bi(Fi(s,"</dim-branch-message>")))}}if(s.startsWith("<dim-branch-idle")){const e=Et(s,"branch");return e===void 0?void 0:{kind:"source-idle",branch:e,status:Et(s,"status")??"idle"}}if(s.startsWith("<dim-branch-ended")){const e=Et(s,"branch");return e===void 0?void 0:{kind:"source-ended",branch:e}}}function Di(s,t){const e=s.serverMessage??t;return s.action===void 0?`model failed: ${e}`:`model failed: ${e}. ${s.action}`}function bn(s){var t;return((t=s.split(`
|
|
220
|
-
`)[0])==null?void 0:t.trim())??""}function Ni(s){const t=bn(s),e=[...t];return e.length<=40?t:`${e.slice(0,40).join("")}…`}function ji(s){return s.split(/\s+/u).filter(Boolean).join(" ")}function Bi(s){return s.replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}function Et(s,t){const e=`${t}="`,n=s.indexOf(e);if(n<0)return;const o=n+e.length,i=s.indexOf('"',o);return i<0?void 0:s.slice(o,i)}function Fi(s,t){const e=s.indexOf(`
|
|
221
|
-
`),n=e<0?"":s.slice(e+1),o=n.indexOf(t);return o<0?n:n.slice(0,o)}function Ls(s,t){s.written+=t,s.writtenChars+=[...t].length}function Ot(s){const t=s.progress;if(t===void 0)return s.written;const e=s.writtenChars-t.offset;if(e<0)return s.written;const n=[...t.text];return e>=n.length?(s.progress=void 0,s.written):s.written+n.slice(e).join("")}function Os(s){const t=new Set;for(const e of s){const n=e.content;switch(n.kind){case"input":t.add(`input:${e.id}`);break;case"text":n.delta!==""&&t.add(`reply:${n.requestId}`);break;case"tool-use":t.add(`tool:${n.requestId}:${n.callId}`);break;case"tool-completed":t.add(`tool:${n.requestId}:${n.callId}`);break;case"tool-result":for(const o of n.results)t.add(`tool:${n.requestId}:${o.callId}`);break}}return t}class Wi{constructor(t,e){ve(this,"pages",[]);ve(this,"through");ve(this,"before");this.before=t,this.through=e}params(t,e){return{sessionId:t,branchId:e,limit:256,...this.before===void 0?{latestTurn:!0}:{before:this.before,through:this.through}}}push(t){if(this.through!==void 0&&t.through!==this.through||t.nextBefore!==void 0&&(t.nextBefore<1||t.nextBefore>t.through||this.before!==void 0&&t.nextBefore>=this.before)||t.events.some(e=>e.sequence>t.through||this.before!==void 0&&e.sequence>=this.before))throw new Te("Invalid history window cursor");return this.through=t.through,this.before=t.nextBefore!==void 0&&t.nextBefore>1?t.nextBefore:void 0,this.pages.unshift(t),this.before===void 0||this.pages.length>=4||Os(this.pages.flatMap(e=>e.events)).size>=100}take(){var i;const t=new Set;let e=0;for(const r of[...this.pages].reverse()){const l=t.size;for(const h of Os(r.events))t.add(h);if(l>0&&t.size>300)break;e++}this.pages.splice(0,this.pages.length-e);const n=(i=this.pages[0])==null?void 0:i.nextBefore;this.before=n!==void 0&&n>1?n:void 0;const o=this.pages.flatMap(r=>r.events);return this.pages=[],o}}const Vi={kind:"ended-itself"},Ui={kind:"ended-by-operation"};class Hi{constructor(){ve(this,"nodes",new Map);ve(this,"running",new Set)}directory(t){this.nodes.clear();for(const e of t)this.detail(e)}detail(t){if(t.branchId==="main")return;const e=this.nodes.get(t.branchId);this.nodes.set(t.branchId,{id:t.branchId,parentId:t.parentBranchId,at:t.branchPoint,purpose:t.purpose===void 0?(e==null?void 0:e.purpose)??"":Rs(t.purpose),cutMessages:t.cutMessages??(e==null?void 0:e.cutMessages),order:(e==null?void 0:e.order)??this.nodes.size,failed:t.state==="creation_failed",ended:t.state==="ending"?{kind:"ending"}:t.end===void 0?t.state==="ended"?{kind:"ended"}:e==null?void 0:e.ended:Ps(t.end.source,t.end.ancestor)})}apply(t,e){const n=e.content;switch(n.kind){case"branch-create":{if(this.nodes.has(n.branchId))return;this.nodes.set(n.branchId,{id:n.branchId,parentId:t,purpose:Rs(n.prompt),at:n.at??e.sequence,order:this.nodes.size,failed:!1,ended:void 0});break}case"branch-create-failed":{const o=this.nodes.get(n.branchId)??{id:n.branchId,parentId:t,purpose:"",at:e.sequence,order:this.nodes.size,failed:!1,ended:void 0};o.failed=!0,this.nodes.set(o.id,o);break}case"branch-end":{const o=this.nodes.get(t);o!==void 0&&(o.ended={kind:"ending"});break}case"branch-ended":{const o=this.nodes.get(n.branchId);o!==void 0&&(o.ended=Ps(n.source,n.ancestor));break}}}setRunning(t,e){e?this.running.add(t):this.running.delete(t)}has(t){return this.nodes.has(t)}views(){const t=[{id:"main",parentId:null,purpose:"",state:{kind:"main"},cut:null,depth:0}],e=new Map;for(const i of this.nodes.values()){const r=e.get(i.parentId)??[];r.push(i),e.set(i.parentId,r)}for(const i of e.values())i.sort((r,l)=>r.at-l.at||r.order-l.order);const n=new Set,o=(i,r)=>{for(const l of e.get(i)??[])n.has(l.id)||(n.add(l.id),t.push({id:l.id,parentId:l.parentId,purpose:l.purpose,state:this.stateOf(l),cut:{sequence:l.at,messages:l.cutMessages},depth:r}),o(l.id,r+1))};o("main",1);for(const i of this.nodes.values())n.has(i.id)||(n.add(i.id),t.push({id:i.id,parentId:i.parentId,purpose:i.purpose,state:this.stateOf(i),cut:{sequence:i.at,messages:i.cutMessages},depth:1}),o(i.id,2));return t}stateOf(t){return t.failed?{kind:"creation-failed"}:t.ended!==void 0?t.ended:this.running.has(t.id)?{kind:"working"}:{kind:"waiting"}}}function Rs(s){var t;return((t=s.split(`
|
|
222
|
-
`)[0])==null?void 0:t.trim())??""}function Ps(s,t){return t!==void 0?{kind:"ended-with",ancestor:t}:s.kind==="tool"?Vi:Ui}function oe(s){if(s===null||typeof s!="object"||Array.isArray(s))throw new Te("Invalid settings reply: expected object");return s}function U(s){if(typeof s!="string")throw new Te("Invalid settings reply: expected string");return s}function qe(s){if(typeof s!="boolean")throw new Te("Invalid settings reply: expected boolean");return s}function et(s){if(typeof s!="number"||!Number.isSafeInteger(s)||s<0)throw new Te("Invalid settings reply: expected nonnegative integer");return s}function we(s,t){if(!Array.isArray(s))throw new Te("Invalid settings reply: expected array");return s.map(t)}function Ce(s){return s==null?void 0:U(s)}function Ki(s){return s==null?void 0:qe(s)}function Xe(s,t){const e=U(s);if(!t.includes(e))throw new Te("Invalid settings reply: unknown option");return e}function Lm(s){const t=oe(s);return t.selection===null?void 0:Qi(t.selection)}function Qi(s){const t=oe(s);return{providerId:U(t.provider_id),modelId:U(t.model_id),version:et(t.version)}}function Om(s){const t=oe(s),e=oe(t.policy),n=Xe(e.mode,["agent","inherit","fixed"]);if(n!=="fixed")return{revision:U(t.revision),policy:{mode:n}};const o=oe(e.model);return{revision:U(t.revision),policy:{mode:n,model:{providerId:U(o.providerId),modelId:U(o.modelId)}}}}function Rm(s){const t=oe(s);return{revision:U(t.revision),executablePath:Ce(t.executablePath),configError:Ce(t.configError),shells:we(t.shells,e=>{const n=oe(e);return{executablePath:U(n.executablePath),name:U(n.name)}})}}function Gi(s){const t=oe(s);return{revision:U(t.revision),commandRules:we(t.commandRules,e=>{const n=oe(e);return{command:U(n.command),match:Xe(n.match,["exact","prefix"]),decision:Xe(n.decision,["allow","deny"])}})}}function Ji(s){return U(oe(s).revision)}function Pm(s){const t=oe(s);return{version:et(t.version),entries:we(t.entries,e=>{const n=oe(e);return{id:U(n.id),name:U(n.name),description:U(n.description),filePath:U(n.filePath),allowedTools:we(n.allowedTools,U),enabled:qe(n.enabled),shadowedBy:Ce(n.shadowedBy)}}),issues:we(t.issues,e=>{const n=oe(e);return{path:U(n.path),message:U(n.message)}})}}function zm(s){return we(s,t=>{const e=oe(t);return{name:U(e.name),use:Ce(e.use),off:qe(e.off),locked:qe(e.locked),status:Ce(e.status),error:Ce(e.error),optional:Ki(e.optional),candidates:we(e.candidates,n=>{const o=oe(n),i=o.source===void 0?void 0:oe(o.source);return{id:U(o.id),kinds:we(o.kinds,U),git:i===void 0?void 0:Ce(i.git)}}),refused:e.refused===void 0?[]:we(e.refused,n=>{const o=oe(n);return{kind:U(o.kind),error:U(o.error)}})}})}function Dm(s){const t=oe(s);return{userRevision:U(t.userRevision),projectRevision:Ce(t.projectRevision),servers:we(t.servers,e=>{const n=oe(e),o=i=>i===void 0?[]:we(i,U);return{id:U(n.id),source:Xe(n.source,["user","project","plugin"]),enabled:qe(n.enabled),transport:U(n.transport),auth:n.auth===void 0?void 0:U(oe(n.auth).status),referencedVariables:o(n.referencedVariables),unsetVariables:o(n.unsetVariables)}}),invalid:t.invalid===void 0?[]:we(t.invalid,e=>{const n=oe(e);return{id:U(n.id),source:Xe(n.source,["user","project","plugin"]),error:U(n.error)}}),errors:[t.userApplication,t.pluginApplication,t.projectApplication].flatMap(e=>{if(e===null)return[];const n=oe(e);return[Ce(n.error),Ce(n.cleanupError)].filter(o=>o!==void 0)})}}function yn(s){const t=oe(s),e=Xe(t.type,["stdio","http","sse"]),n=t.referencedVariables===void 0?[]:we(t.referencedVariables,U),o=t.unsetVariables===void 0?[]:we(t.unsetVariables,U),i=t.timeout===void 0||t.timeout===null?void 0:et(t.timeout);if(e==="stdio")return{type:e,command:U(t.command),argsCount:et(t.argsCount),cwd:Ce(t.cwd),envNames:we(t.envNames,U),timeout:i,referencedVariables:n,unsetVariables:o};const r=t.oauth===null?void 0:oe(t.oauth);return{type:e,endpoint:U(t.endpoint),headerNames:we(t.headerNames,U),authConfigured:qe(t.authConfigured),oauthConfigured:qe(t.oauthConfigured),oauth:r===void 0?void 0:{clientId:Ce(r.clientId),callbackPort:r.callbackPort===null?void 0:et(r.callbackPort),scopes:Ce(r.scopes),metadataConfigured:qe(r.metadataConfigured)},timeout:i,referencedVariables:n,unsetVariables:o}}function Nm(s){const t=oe(s);return{revision:Ce(t.revision),enabled:qe(t.enabled),secretsInUserScope:t.secretsInUserScope===!0,configuration:yn(t.configuration)}}function wn(s){const t=oe(s);return{name:U(t.name),description:Ce(t.description)}}function jm(s){const t=oe(s);return{enabled:qe(t.enabled),configuration:yn(t.configuration),connections:we(t.connections,e=>{const n=oe(e),o=oe(n.state),i=Xe(o.status,["disconnected","connecting","connected","failed","closed","auth_required"]);return{state:i,expired:i==="auth_required"?qe(o.expired):void 0,tools:n.tools===null?void 0:we(n.tools,wn)}})}}function Bm(s){const t=oe(s);return{status:Xe(t.status,["connected","authRequired","failed"]),latencyMs:et(t.latencyMs),tools:t.tools===null?void 0:we(t.tools,wn),expired:t.expired===void 0?void 0:qe(t.expired),missingScopes:t.missingScopes===void 0?void 0:we(t.missingScopes,U),reason:Ce(t.reason),message:Ce(t.message)}}function Fm(s){const t=oe(s),e=U(t.authorizationUrl),n=new URL(e);if(!["https:","http:"].includes(n.protocol)||n.username||n.password)throw new Te("Invalid MCP authorization URL");return{attemptId:U(t.attemptId),authorizationUrl:e,redirectUri:U(t.redirectUri),expiresAt:et(t.expiresAt)}}function Wm(s){const t=oe(s);return we(t.sources,e=>{const n=oe(e);return{id:U(n.id),client:U(n.client),scope:U(n.scope),path:U(n.path),state:Xe(n.state,["ready","absent","unreadable","too-large","malformed"]),entries:n.entries===void 0?void 0:et(n.entries),error:Ce(n.error)}})}function Vm(s){const t=oe(s);return{revision:U(t.revision),sourceRevision:Ce(t.sourceRevision),store:t.store===void 0?void 0:(()=>{const e=oe(t.store);return{id:U(e.id),client:U(e.client),scope:U(e.scope),path:U(e.path)}})(),entries:we(t.entries,e=>{const n=oe(e);return{id:U(n.id),transport:Ce(n.transport),status:Xe(n.status,["identical","changed","conflict","invalid"]),changes:we(n.changes,o=>{const i=oe(o);return{field:U(i.field),kind:U(i.kind)}}),unsupported:we(n.unsupported,o=>{const i=oe(o);return{field:U(i.field),effect:Xe(i.effect,["kept-unused","dropped"])}}),omitted:et(n.omitted),error:Ce(n.error)}}),unknownTopLevel:we(t.unknownTopLevel,U)}}function Um(s){return U(oe(s).revision)}function Hm(s){const t=oe(s);return{sessions:an(t.sessions),nextCursor:Ce(t.nextCursor)}}function Km(s){const t=oe(s);return{sessions:et(t.sessions),connections:et(t.connections),serverVersion:U(t.serverVersion)}}function Qm(s){const t=oe(s);return{revision:U(t.revision),enabled:qe(oe(t.document).enabled)}}function Gm(s){const t=oe(s),e=oe(t.document);return{revision:U(t.revision),sandbox:qe(e.sandbox),network:qe(e.network)}}function Jm(s){const t=oe(s);return qe(t.available)?{available:!0}:{available:!1,reason:U(t.reason)}}function ps(s){const t=oe(s);return{dimension:U(t.dimension),detail:U(t.detail)}}function zs(s){const t=oe(s),e=t.reason===null||t.reason===void 0?void 0:ps(t.reason);return{providerId:U(t.providerId),modelId:U(t.modelId),available:qe(t.available),...e===void 0?{}:{reason:e}}}function Yi(s){const t=oe(s),e=Ce(t.key),n=t.effective===null||t.effective===void 0?void 0:oe(t.effective);return{operation:U(t.operation),...e===void 0?{}:{key:e},available:qe(t.available),reasons:we(t.reasons,ps),...t.default===null||t.default===void 0?{}:{default:zs(t.default)},...n===void 0?{}:{effective:{providerId:U(n.providerId),modelId:U(n.modelId),source:Xe(n.source,["default","automatic"])}},options:we(t.options,zs)}}function Ym(s){const t=oe(s);return{revision:U(t.revision),categories:we(t.categories,e=>{const n=oe(e);return{category:U(n.category),available:qe(n.available),reasons:we(n.reasons,ps),operations:we(n.operations,Yi)}})}}const Ke=mt("sessions",()=>{const s=R([]),t=R(!1),e=R("");let n;const o=new Map,i=E(()=>new Map(s.value.map(_=>[_.sessionId,_]))),r=E(()=>{const _=new Map;for(const w of s.value){if(w.origin==="internal")continue;const b=_.get(w.cwd);b===void 0?_.set(w.cwd,[w]):b.push(w)}return[..._].map(([w,b])=>(b.sort((k,x)=>x.updatedAt-k.updatedAt),{cwd:w,name:Kt(w),sessions:b,updatedAt:b[0].updatedAt})).sort((w,b)=>b.updatedAt-w.updatedAt)});function l(){return n??(n=Me().client.call("session.summaries",{},an).then(_=>{for(const w of _){const b=i.value.get(w.sessionId)??o.get(w.sessionId);b!==void 0&&b.titleRevision>=w.titleRevision&&(w.title=b.title,w.titleSource=b.titleSource,w.titleRevision=b.titleRevision),o.delete(w.sessionId)}s.value=_,t.value=!0,e.value=""}).catch(_=>{e.value=_ instanceof Error?_.message:String(_)}).finally(()=>{n=void 0})),n}async function h(_,w){const b={cwd:_};w!==void 0&&(b.model={provider:w.providerId,modelId:w.modelId});const k=await Me().client.call("session.create",b,Oo);return l(),k.sessionId}function g(_,w){const b=i.value.get(_);b!==void 0&&b.running!==w&&(b.running=w)}function I(_,w){const b=i.value.get(_),k=b??o.get(_);k!==void 0&&w.titleRevision<=k.titleRevision||(b===void 0?o.set(_,w):Object.assign(b,w))}function v(_){o.delete(_),s.value=s.value.filter(w=>w.sessionId!==_)}return{summaries:s,loaded:t,error:e,byId:i,workspaces:r,refresh:l,create:h,setRunning:g,setTitle:I,forget:v}});function Kt(s){return s.replace(/[\\/]+$/,"").split(/[\\/]/).at(-1)||s}const Xi=1100;function wt(s){return s.slice(0,8)}function Pt(s,t){switch(t.kind){case"main":return s("lines.state.main");case"working":return s("lines.state.working");case"waiting":return s("lines.state.waiting");case"ending":return s("lines.state.ending");case"ended":return s("lines.state.ended");case"ended-itself":return s("lines.state.endedItself");case"ended-by-operation":return s("lines.state.endedByOperation");case"ended-with":return s("lines.state.endedWith",{id:t.ancestor});case"creation-failed":return s("lines.state.creationFailed")}}function hs(s){if(s.kind==="working")return"primary";if(s.kind==="creation-failed")return"danger";if(s.kind==="ended-with")return"warning"}function dt(s,t,e){const n=(t==null?void 0:t.purpose.trim())??"";return n===""?wt(e):n}function Zi(s,t){const e=!t.detailOpen||!t.detailExpanded&&t.shellWidth>=Xi,n=t.detailOpen?t.activeLine:void 0,o=e&&s.some(r=>r.branchId===de),i=n!==void 0&&s.some(r=>r.branchId===n);if(o&&i)return t.detailFocused?n:de;if(i)return n;if(o)return de}function ea(s,t={}){if(t.keyboard===!1||t.pending||s.defaultPrevented||t.dialogOpen)return;const e=s.target;if(!(e!==null&&typeof e=="object"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable===!0))){if(s.key==="Enter"||s.key==="y"||s.key==="Y")return"allow";if(s.key==="Escape"||s.key==="n"||s.key==="N")return"deny"}}const Ds="dim-web.appearance.v1",ms=mt("appearance",()=>{const s=R("system"),t=R(14),e=R(""),n=R("");try{const h=JSON.parse(localStorage.getItem(Ds)??"null");if(h!==null&&typeof h=="object"&&!Array.isArray(h)){const g=h;(g.theme==="light"||g.theme==="dark"||g.theme==="system")&&(s.value=g.theme),typeof g.fontSize=="number"&&[12,13,14,15,16,18].includes(g.fontSize)&&(t.value=g.fontSize),(g.language==="en"||g.language==="zh-CN")&&(e.value=g.language)}}catch{n.value="Browser appearance preferences could not be read."}const o=R("light"),i=matchMedia("(prefers-color-scheme: dark)");function r(){o.value=s.value==="dark"||s.value==="system"&&i.matches?"dark":"light",document.documentElement.classList.toggle("dark",o.value==="dark"),document.documentElement.style.setProperty("--ui-font-size",String(t.value))}r(),i.addEventListener("change",r),$e([s,t,e],()=>{r(),n.value="";try{localStorage.setItem(Ds,JSON.stringify({theme:s.value,fontSize:t.value,language:e.value}))}catch{n.value="Browser storage is unavailable. Appearance changes will not survive a reload."}},{flush:"sync"});async function l(h){try{await fn(h||navigator.language),e.value=h}catch{n.value="The selected language could not be loaded."}}return{theme:s,resolvedTheme:o,fontSize:t,language:e,selectLanguage:l,error:n}}),kn="dim-web.ui.v1",_n=320,In=720;function ta(){const s={sidebarCollapsed:!1,collapsedWorkspaces:[],lastSessionId:void 0,detailOpen:!1,detailWidth:420};try{const t=JSON.parse(localStorage.getItem(kn)??"null");if(t===null||typeof t!="object")return s;const e=t,n=typeof e.detailWidth=="number"&&Number.isFinite(e.detailWidth)?Math.min(In,Math.max(_n,e.detailWidth)):s.detailWidth;return{sidebarCollapsed:e.sidebarCollapsed===!0,collapsedWorkspaces:Array.isArray(e.collapsedWorkspaces)?e.collapsedWorkspaces.filter(o=>typeof o=="string"):[],lastSessionId:typeof e.lastSessionId=="string"?e.lastSessionId:void 0,detailOpen:e.detailOpen===!0,extension:e.extension!==null&&typeof e.extension=="object"&&"pluginName"in e.extension&&"panelId"in e.extension&&typeof e.extension.pluginName=="string"&&typeof e.extension.panelId=="string"?{pluginName:e.extension.pluginName,panelId:e.extension.panelId}:void 0,detailWidth:n}}catch{return s}}const Ve=mt("ui",()=>{const s=ta(),t=R(s.sidebarCollapsed),e=R(s.collapsedWorkspaces),n=R(s.lastSessionId),o=R(!1),i=R(typeof window<"u"&&window.innerWidth>0?window.innerWidth:1200),r=E(()=>i.value<720?"compact":i.value<960?"regular":"wide"),l=R(s.extension),h=R(s.detailOpen),g=R(s.detailWidth),I=R(!1),v=R(!1),_=R({}),w=R({}),b=R(),k=R();$e([t,e,n,h,g,l],()=>{try{localStorage.setItem(kn,JSON.stringify({sidebarCollapsed:t.value,collapsedWorkspaces:e.value,lastSessionId:n.value,detailOpen:h.value,extension:l.value,detailWidth:g.value}))}catch{}},{deep:!0}),ms();function x(z){i.value=z,r.value!=="compact"&&(o.value=!1)}function C(z){return!e.value.includes(z)}function Y(z){e.value=C(z)?[...e.value,z]:e.value.filter(L=>L!==z)}function X(z){g.value=Math.min(In,Math.max(_n,Math.round(z)))}function F(z){l.value=void 0,h.value=!0,v.value=!0,w.value={...w.value,[z]:void 0}}function P(z){h.value&&l.value===void 0&&w.value[z]===void 0?(h.value=!1,v.value=!1):F(z)}function j(z,L){l.value=void 0;const H=_.value[z]??[];H.includes(L)||(_.value={..._.value,[z]:[...H,L]}),w.value={...w.value,[z]:L},h.value=!0,v.value=!0}function $(z,L){if(l.value=void 0,!(_.value[z]??[]).includes(L)){j(z,L);return}w.value={...w.value,[z]:L},h.value=!0,v.value=!0}function M(z,L){const H=(_.value[z]??[]).filter(me=>me!==L);_.value={..._.value,[z]:H},w.value[z]===L&&(w.value={...w.value,[z]:H.at(-1)})}function T(){h.value=!1,I.value=!1,v.value=!1}function W(z,L,H){return l.value!==void 0&&h.value&&v.value?!1:Zi(H,{detailOpen:h.value,detailExpanded:I.value,shellWidth:i.value,activeLine:w.value[z],detailFocused:v.value})===L}function se(z){b.value=z}function le(){b.value=void 0}function ge(z){k.value=z}function J(){k.value=void 0}function re(z){var L,H;_.value={..._.value,[z]:[]},w.value={...w.value,[z]:void 0},((L=b.value)==null?void 0:L.sessionId)===z&&(b.value=void 0),((H=k.value)==null?void 0:H.sessionId)===z&&(k.value=void 0),h.value&&(h.value=!1),v.value=!1}return{sidebarCollapsed:t,lastSessionId:n,drawerOpen:o,shellWidth:i,shellMode:r,setShellWidth:x,isWorkspaceExpanded:C,toggleWorkspace:Y,extension:l,detailOpen:h,detailWidth:g,detailExpanded:I,detailFocused:v,lineTabs:_,activeLineTab:w,newLine:b,endingLine:k,setDetailWidth:X,openLines:F,toggleLines:P,openLine:j,activateLine:$,closeLineTab:M,closeDetail:T,approvalKeyboard:W,requestNewLine:se,closeNewLine:le,requestEndLine:ge,closeEndLine:J,resetSessionTabs:re}}),sa=6e4,na=16;function Ns(){return{projection:new ns,opened:!1,before:void 0,through:0,loadingEarlier:!1,historyError:"",liveTask:void 0,progress:void 0,syncing:!1,done:!1,error:"",queued:[]}}function oa(){return{running:!1,stopping:!1}}const Qe=mt("chat",()=>{const s=_s({}),t=new Map;let e;function n(){return Me().client}function o(p){if(t.has(p))return;const f=Ke().byId.get(p),y=_s({sessionId:p,status:"loading",error:"",rows:[],running:(f==null?void 0:f.running)??!1,stopping:!1,retry:void 0,sessionRunning:(f==null?void 0:f.running)??!1,approvals:[],questions:[],methods:[],permission:void 0,goal:void 0,queued:[],model:f==null?void 0:f.model,lines:[],branches:{},lastTurnEnd:void 0,earlier:!1,loadingEarlier:!1,historyError:""}),q={view:y,main:Ns(),branches:new Map,lines:new Hi,states:new Map,syncing:!1,queued:[],historyQueue:[],historyRunning:!1,goalRefreshing:!1,goalDirty:!1,publishTimer:void 0};q.main.opened=!0,t.set(p,q),s[p]=y,r(q)}async function i(){await Promise.all([...t.values()].filter(p=>p.view.status!=="closed").map(r))}async function r(p){if(p.syncing)return;const{view:f}=p;p.syncing=!0,p.view.status="loading",p.states.clear(),p.queued=[],f.approvals=[],p.main.syncing=!0,p.main.done=!1,p.main.error="",p.main.queued=[],p.main.progress=void 0;for(const[y,q]of p.branches)q.syncing=q.opened,q.done=!1,q.error="",q.queued=[],q.progress=void 0,q.opened&&!p.historyQueue.includes(y)&&p.historyQueue.push(y);try{const y=await n().call("session.attach",{sessionId:f.sessionId},ui);if(!Me().supports("session.history.latestTurn"))throw new Te("This server does not support bounded conversation history");f.methods=await Pe(f.sessionId);for(const K of["session.input.pending","session.question.pending","session.turn.get"])if(!f.methods.includes(K))throw new Te(`This Session does not provide ${K}`);const q=await n().call("session.branches",{sessionId:f.sessionId},di);p.lines.directory(q);for(const K of q){if(K.branchId===de)continue;const ie=_(p,K.branchId);if(!ie.opened){const Le=await w(p,K.branchId,K.head);ie.projection=new ns,ie.projection.restoreControls([],Le,K.head)}}const B=await C(p,de);if(B!=="ok"){B==="failed"&&f.status!=="closed"&&(f.status="failed",f.error=p.main.error);return}if(p.main.projection.model=y,await k(p),f.status==="failed")return;const ee=p.queued;p.queued=[],p.syncing=!1;for(const K of ee)l(K);f.status!=="closed"&&(f.permission=await at(f.sessionId)),f.status!=="closed"&&(f.status="ready",f.error=""),T(p),f.status!=="closed"&&F(p)}catch(y){y instanceof ct&&y.appError==="session_closed"?f.status="closed":y instanceof Nt||(f.status="failed",f.error=y instanceof Error?y.message:String(y))}finally{if(p.syncing=!1,p.main.syncing=!p.main.done||p.main.error!=="",p.main.syncing)for(const y of p.queued)h(p,y);p.queued=[],T(p)}}function l(p){if(p.method==="ui.extensions.changed")return;const f=p.method==="session.model.progress"?p.progress.sessionId:p.method==="approval.request"?p.request.sessionId:p.sessionId,y=t.get(f);if(y!==void 0){if(y.syncing){y.queued.push(p);return}h(y,p)}}function h(p,f){var q;const y=p.view;switch(f.method){case"session.event":{const B=f.branchId,ee=_(p,B);if(ee.syncing){p.lines.apply(B,f.event);const K=f.event.content;(K.kind==="turn-end"||(K.kind==="model-end"||K.kind==="tool-use")&&K.requestId===((q=ee.progress)==null?void 0:q.requestId))&&(ee.progress=void 0),ee.queued.push(f.event)}else ee.opened?(ee.queued.push(f.event),v(p,B).catch(K=>{ee.error=K instanceof Error?K.message:String(K),ee.syncing=!0,M(p)})):g(p,B,f.event);break}case"session.model.progress":{const B=f.progress.branchId,ee=_(p,B);if(ee.progress=f.progress,ee.syncing||!ee.opened||ee.liveTask!==void 0)break;ee.projection.progress(f.progress),M(p);break}case"session.state":{f.branchId===de&&y.running&&!f.running&&W(),p.states.set(f.branchId,{running:f.running,stopping:f.stopping}),p.lines.setRunning(f.branchId,f.running),f.branchId!==de&&_(p,f.branchId);const B=$(p);y.running=j(p,de).running,y.stopping=j(p,de).stopping,y.sessionRunning=B,Ke().setRunning(y.sessionId,B),M(p);break}case"approval.request":y.approvals.some(B=>B.requestId===f.request.requestId&&B.branchId===f.request.branchId)||(y.approvals=[...y.approvals,f.request]);break;case"approval.resolved":case"approval.cancelled":y.approvals.some(B=>B.branchId===f.branchId&&B.requestId===f.requestId)&&se(y,f.branchId,f.requestId);break;case"memberApprovalEnded":{const B=y.approvals.filter(ee=>ee.branchId===f.branchId&&ee.call.name==="member_approval_allow"&&ee.call.input.approvalId===f.approvalId);for(const ee of B)se(y,ee.branchId,ee.requestId),H(y.sessionId,ee,"deny").catch(()=>{});break}case"session.closed":y.status="closed",y.running=!1,y.stopping=!1,y.sessionRunning=!1,y.approvals=[],y.questions=[],Ke().forget(y.sessionId),Ve().resetSessionTabs(y.sessionId);break}}function g(p,f,y){var ee;p.lines.apply(f,y);const q=_(p,f);if(!q.opened){q.projection.applyControl(y),M(p);return}if(!q.projection.apply(y))return;const B=y.content;(B.kind==="turn-end"||(B.kind==="model-end"||B.kind==="tool-use")&&B.requestId===((ee=q.progress)==null?void 0:ee.requestId))&&(q.progress=void 0),y.content.kind==="branch-create"&&_(p,y.content.branchId),f===de&&y.content.kind==="permission-changed"&&(p.view.permission=y.content.policy),f===de&&(B.kind==="input-deleted"||(B.kind==="input"||B.kind==="source-input")&&B.blocks.some(K=>{var ie;return(ie=K.key)==null?void 0:ie.startsWith("goal:")}))&&k(p),M(p)}async function I(p,f,y,q){const B=q.content;if(B.kind!=="tool-completed"&&B.kind!=="tool-result")return;const ee=B.kind==="tool-result"?B.results:[{callId:B.callId,result:B.result}];for(const K of ee){if(y.rows.some(Le=>Le.kind==="tool"&&Le.callId===K.callId))continue;const ie=await n().call("session.tool.get",{sessionId:p.view.sessionId,branchId:f,requestId:B.requestId,callId:K.callId,through:q.sequence},fi);ie!==void 0&&y.rows.push({kind:"tool",key:`tool-${ie.callId}`,callId:ie.callId,name:ie.name,input:ie.input,pending:!1,result:K.result})}}function v(p,f){const y=_(p,f);if(y.liveTask!==void 0)return y.liveTask;const q=y.projection;return y.liveTask=(async()=>{for(;!y.syncing&&y.queued.length>0;){const B=y.queued[0];if(B.sequence>q.cursor&&await I(p,f,q,B),y.projection!==q||y.syncing)return;y.queued.shift(),g(p,f,B)}!y.syncing&&y.progress!==void 0&&q.progress(y.progress)})().then(()=>{if(y.liveTask=void 0,!y.syncing&&y.queued.length>0)return v(p,f)},B=>{throw y.liveTask=void 0,y.syncing=!0,B}).finally(()=>M(p)),y.liveTask}function _(p,f){if(f===de)return p.main;let y=p.branches.get(f);return y===void 0&&(y=Ns(),p.branches.set(f,y),M(p)),y}async function w(p,f,y){const q=[];let B;do{const ee=await n().call("session.question.pending",{sessionId:p.view.sessionId,branchId:f,through:y,...B==null?{}:{after:B}},hi);if(ee.branchId!==f||ee.through!==y)throw new Te("Question snapshot changed");q.push(...ee.asks),B=ee.next}while(B!=null);return q}async function b(p,f,y,q){var Le;const B=await w(p,f,q),ee=[];let K;do{const A=await n().call("session.input.pending",{sessionId:p.view.sessionId,branchId:f,through:q,...K==null?{}:{after:K}},pi);if(A.branchId!==f||A.through!==q)throw new Te("Input snapshot changed");ee.push(...A.inputs),K=A.next}while(K!=null);y.restoreControls(ee,B,q);const ie=await n().call("session.turn.get",{sessionId:p.view.sessionId,branchId:f,through:q},mi);if(ie.branchId!==f||ie.through!==q)throw new Te("Turn snapshot changed");ie.output!==void 0&&y.activeOutput(ie.output),(Le=ie.turn)!=null&&Le.ended&&(y.lastTurnEnd=Math.max(y.lastTurnEnd??0,ie.turn.sequence)),p.states.has(f)||p.states.set(f,{running:ie.turn!==void 0&&!ie.turn.ended,stopping:!1})}async function k(p){if(p.view.methods.includes("session.goal.get")&&(p.goalDirty=!0,!p.goalRefreshing)){p.goalRefreshing=!0;try{for(;p.goalDirty;)p.goalDirty=!1,p.main.projection.goal=await n().call("session.goal.get",{sessionId:p.view.sessionId,branchId:de},vi),M(p)}catch(f){p.view.status="failed",p.view.error=f instanceof Error?f.message:String(f)}finally{p.goalRefreshing=!1}}}async function x(p,f,y,q){const B=new Wi(y,q);for(;;){const ie=await n().call("session.history",B.params(p.view.sessionId,f),Po,sa);if(B.push(ie))break}const ee=B.take(),K=new ns;for(const ie of ee)await I(p,f,K,ie),K.apply(ie);return{window:B,events:ee,projection:K}}async function C(p,f){var q,B;const y=_(p,f);y.syncing=!0,y.error="",y.done=!1;for(let ee=0;;ee++)try{const K=await x(p,f),ie=K.window.through;await b(p,f,K.projection,ie),f!==de&&p.lines.detail(await n().call("session.branch.get",{sessionId:p.view.sessionId,branchId:f},ci)),await((q=y.liveTask)==null?void 0:q.catch(()=>{})),K.projection.cursor=ie,y.projection=K.projection,y.before=K.window.before,y.through=ie;for(const Le of K.events){const A=Le.content;(A.kind==="turn-end"||(A.kind==="model-end"||A.kind==="tool-use")&&A.requestId===((B=y.progress)==null?void 0:B.requestId))&&(y.progress=void 0)}return y.queued=y.queued.filter(Le=>Le.sequence>ie),y.syncing=!1,await v(p,f),y.done=!0,M(p),"ok"}catch(K){if(f!==de&&ee<10&&X(K)){await new Promise(ie=>setTimeout(ie,100));continue}return K instanceof Nt?"lost":(y.done=!0,y.syncing=!0,y.error=K instanceof Error?K.message:String(K),K instanceof ct&&K.appError==="session_closed"&&(p.view.status="closed"),M(p),"failed")}}async function Y(p,f){const y=t.get(p);if(y===void 0)return;const q=_(y,f);if(q.before===void 0||q.loadingEarlier||q.syncing)return;q.loadingEarlier=!0,q.historyError="";const B=q.before,ee=q.projection;T(y);try{const K=await x(y,f,B,q.through);if(q.projection!==ee)return;ee.prepend(K.projection.rows,`before-${B}`),q.before=K.window.before}catch(K){q.historyError=K instanceof Error?K.message:String(K)}finally{q.loadingEarlier=!1,T(y)}}function X(p){return p instanceof ct&&(p.appError==="branch_missing"||p.appError==="unknown_branch"||p.message.startsWith("unknown branch"))}async function F(p){if(!(p.historyRunning||p.syncing)){p.historyRunning=!0;try{for(;p.historyQueue.length>0;){const f=p.historyQueue.shift();f===de||!p.branches.has(f)||await C(p,f)}}finally{p.historyRunning=!1,T(p)}}}function P(p,f){const y=t.get(p);if(y===void 0||f===de)return;const q=y.branches.get(f);q!==void 0&&(q.error="",q.done=!1,q.syncing=!0,y.historyQueue.includes(f)||y.historyQueue.push(f),T(y),F(y))}function j(p,f){return p.states.get(f)??oa()}function $(p){const f=new Set(p.lines.views().filter(y=>y.state.kind.startsWith("ended")||y.state.kind==="creation-failed").map(y=>y.id));return[...p.states].some(([y,q])=>!f.has(y)&&(q.running||q.stopping))}function M(p){p.publishTimer??(p.publishTimer=setTimeout(()=>T(p),na))}function T(p){var B,ee;clearTimeout(p.publishTimer),p.publishTimer=void 0;const f=p.view,y=j(p,de);f.rows=p.main.projection.rows.slice(),f.lastTurnEnd=p.main.projection.lastTurnEnd,f.earlier=p.main.before!==void 0,f.loadingEarlier=p.main.loadingEarlier,f.historyError=p.main.historyError,f.running=y.running,f.stopping=y.stopping,f.retry=(B=p.main.progress)==null?void 0:B.retry,f.sessionRunning=$(p),f.model=p.main.projection.model??((ee=Ke().byId.get(f.sessionId))==null?void 0:ee.model),f.lines=p.lines.views(),f.goal=p.main.projection.goal,f.queued=p.main.projection.queued(),f.questions=[...p.main.projection.waiting().map(K=>({branchId:de,...K})),...[...p.branches].flatMap(([K,ie])=>ie.projection.waiting().map(Le=>({branchId:K,...Le})))];const q={};for(const[K,ie]of p.branches){const Le=j(p,K);q[K]={rows:ie.projection.rows.slice(),running:Le.running,stopping:Le.stopping,status:ie.error!==""?"failed":ie.done?"ready":"loading",error:ie.error,lastTurnEnd:ie.projection.lastTurnEnd,earlier:ie.before!==void 0,loadingEarlier:ie.loadingEarlier,historyError:ie.historyError}}f.branches=q}function W(){clearTimeout(e),e=setTimeout(()=>void Ke().refresh(),500)}function se(p,f,y){p.approvals=p.approvals.filter(q=>q.branchId!==f||q.requestId!==y)}function le(p,f){const y=t.get(p);if(y===void 0||f!==de&&!y.lines.has(f))return;const q=_(y,f);q.opened||(q.opened=!0,q.syncing=!0,y.historyQueue.includes(f)||y.historyQueue.push(f),F(y)),T(y)}async function ge(p,f,y,q={images:[],pastes:[]}){let B=y;for(const K of q.pastes){const ie=await n().call("attachment.put",{sessionId:p,text:K},Bo);B=`${B}${B===""?"":`
|
|
223
|
-
`}[Pasted text: ${ie} (${K.split(`
|
|
224
|
-
`).length} lines)]`}const ee={sessionId:p,branchId:f,submissionId:crypto.randomUUID(),mode:"queue"};q.images.length===0?ee.text=B:ee.user={content:[...B===""?[]:[{type:"text",text:B}],...q.images]},await n().call("session.submit",ee,bt)}async function J(p,f){await n().call("session.stop",{sessionId:p,branchId:f,reason:"Stopped from the web workspace"},bt)}async function re(p,f,y,q){return(await n().call("session.branch_create",{sessionId:p,parentBranchId:f,at:y,prompt:q},Ro)).branchId}async function z(p,f){await n().call("session.branch_end",{sessionId:p,branchId:f},bt)}async function L(p,f){return n().call("session.collaboration.approval.get",{sessionId:p,branchId:f.branchId,requestId:f.requestId},ni)}async function H(p,f,y){await n().call("approval.respond",{sessionId:p,branchId:f.branchId,requestId:f.requestId,decision:y},bt);const q=s[p];q!==void 0&&se(q,f.branchId,f.requestId)}async function me(p,f){const y=mn(f);if(y===void 0)throw new Error("This approval has no simple command to allow");const q=$i(y),B=await n().call("permission.rules",{},Gi);B.commandRules.some(ee=>xi(ee,q))||await n().call("permission.set_rules",{expectedRevision:B.revision,commandRules:[...B.commandRules,q]},Ji),await H(p,f,"allow")}async function V(p,f){const y=vn(f);if(y===void 0)throw new Error("This approval names no file to allow");await n().call("session.grants.add",{sessionId:p,...y},bt),await H(p,f,"allow")}async function ue(p,f,y){await n().call("session.question.respond",{sessionId:p,branchId:f.branchId,requestId:f.requestId,callId:f.callId,...y===void 0?{declined:!0}:{answers:y}},bt)}async function Pe(p){return Me().supports("session.methods")?n().call("session.methods",{sessionId:p},cs).catch(()=>[]):[]}async function Ze(p){return n().call("session.context.compact",{sessionId:p,branchId:de},qo)}async function Ge(p,f,y){await n().call(`session.goal.${f}`,{sessionId:p,branchId:de,...y===void 0?{}:{objective:y}},bt);const q=t.get(p);if(q!==void 0&&(await k(q),q.view.status==="failed"))throw new Error(q.view.error)}async function tt(p){return n().call("session.context.usage",{sessionId:p,branchId:de},Ao)}async function ze(p,f){return n().call("session.fork",{sessionId:p,at:f},Lo)}async function Ue(p,f){return n().call("session.files.search",{sessionId:p,query:f,limit:20},jo)}async function Be(p,f,y){return n().call("session.input.withdraw",{sessionId:p,branchId:de,inputId:f,...y===void 0?{}:{steer:y}},Qo)}async function at(p){if(Me().supports("session.permission.get"))return n().call("session.permission.get",{sessionId:p,branchId:de},Ms).then(f=>f.policy,()=>{})}async function ht(p,f){const y=await n().call("session.permission.get",{sessionId:p,branchId:de},Ms),q=s[p];if(q!==void 0&&(q.permission=y.policy),y.policy.preset===f)return"unchanged";const B={...y.policy,preset:f};try{await n().call("session.permission.update",{sessionId:p,branchId:de,expectedVersion:y.version,policy:B},No)}catch(ee){if(ee instanceof ct&&ee.appError==="permission_conflict")return q!==void 0&&(q.permission=await at(p)),"conflict";throw ee}return q!==void 0&&(q.permission=B),"updated"}async function O(p,f){return n().call("session.model.update",{sessionId:p,branchId:de,modelPreferences:{reasoningEffort:f}},Fo)}async function Z(p,f){const y=await n().call("session.model.update",{sessionId:p,branchId:de,providerId:f.providerId,modelId:f.modelId},zo),q=t.get(p);q!==void 0&&(q.main.projection.model=y.model,T(q))}return{views:s,open:o,resync:i,receive:l,ensureLine:le,loadEarlier:Y,retryLine:P,submit:ge,stop:J,createLine:re,endLine:z,respond:H,allowAlways:me,allowForSession:V,answerQuestion:ue,compact:Ze,usage:tt,fork:ze,writeGoal:Ge,setEffort:O,setPermission:ht,withdrawInput:Be,searchFiles:Ue,memberApproval:L,setModel:Z}}),ia=4e3,$t=mt("toast",()=>{const s=R([]),t=new Map;let e=0;function n(l){clearTimeout(t.get(l)),t.delete(l),s.value=s.value.filter(h=>h.id!==l)}function o(l){clearTimeout(t.get(l)),t.set(l,setTimeout(()=>n(l),ia))}function i(l){clearTimeout(t.get(l)),t.delete(l)}function r(l){const h=++e,g=[...s.value,{...l,id:h}];for(const I of g.slice(0,-3))i(I.id);s.value=g.slice(-3),o(h)}return{toasts:s,push:r,dismiss:n,pause:i,resume:o}}),Tt=mt("extensions",()=>{const s=Bt(),t=R("");let e=0;function n(){e++,s.value=void 0,t.value=""}async function o(i=!1){const r=Me();if(r.phase!=="connected")return;if(!i&&!r.supports("ui.extensions.list")){n();return}const l=++e;try{const h=await r.client.call("ui.extensions.list",{},ii);if(l!==e)return;s.value=h,t.value=""}catch(h){if(l!==e)return;s.value=void 0,t.value=h instanceof Error?h.message:String(h)}}return{directory:s,error:t,clear:n,refresh:o}}),Me=mt("connection",()=>{const s=R("connecting"),t=Bt(),e=R(!1),n=new wi({phase(i){s.value=i,i!=="connected"&&Tt().clear()},async ready(i,r){t.value=i,e.value=!0,Tt().refresh(),r&&await Qe().resync(),Ke().refresh()},notification(i){if(i.method==="ui.extensions.changed"){Tt().refresh(!0);return}i.method==="session.title"?Ke().setTitle(i.sessionId,i.data):Qe().receive(i)},invalid(i){console.error(i),$t().push({tone:"danger",title:Oe("connection.protocolError"),description:i.message})}});function o(i){var r;return((r=t.value)==null?void 0:r.features.includes(i))??!1}return{phase:s,hello:t,everConnected:e,client:n,supports:o}}),aa=["data-state"],ra=ke({__name:"ConnectionBadge",setup(s){const t=Me(),{t:e}=ye(),n=E(()=>({connecting:e("connection.connecting"),connected:e("connection.live"),reconnecting:e("connection.reconnecting"),unauthenticated:e("connection.accessRequired"),"version-mismatch":e("connection.versionMismatch")})[t.phase]);return(o,i)=>(d(),u("div",{class:"connection-badge","aria-live":"polite","data-state":a(t).phase},[a(t).phase==="connected"?(d(),ae(a(Io),{key:0,size:14,"aria-hidden":"true"})):(d(),ae(a(_o),{key:1,size:14,"aria-hidden":"true"})),c("span",null,[c("strong",null,m(n.value),1),c("small",null,m(a(e)("connection.host")),1)])],8,aa))}}),la=1440*60*1e3;function js(s){const t=new Date(s);return t.setHours(0,0,0,0),t.getTime()}function da(s,t,e=new Date){const n=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit",hour12:!1}).format(s);return js(e)-js(s)<7*la?`${new Intl.DateTimeFormat(t,{weekday:"long"}).format(s)} ${n}`:`${new Intl.DateTimeFormat(t,{...s.getFullYear()===e.getFullYear()?{}:{year:"numeric"},month:"short",day:"numeric"}).format(s)} ${n}`}function ca(s,t=Date.now()){const e=Math.max(0,t-s.getTime());return e<6e4?"now":e<36e5?`${Math.floor(e/6e4)}m`:e<864e5?`${Math.floor(e/36e5)}h`:`${Math.floor(e/864e5)}d`}function ua(s){const t=Math.max(s,0),e=Math.floor(t/1e3);if(e<60)return e===0&&t>0?`${Math.round(t/100)/10}s`:`${e}s`;const n=Math.floor(e/60),o=e%60;return o>0?`${n}m ${o}s`:`${n}m`}const pa={class:"workspace-group"},ha=["aria-expanded","aria-label"],ma={class:"workspace-disclosure","aria-hidden":"true"},va=["data-open"],fa={class:"workspace-disclosure-icon"},ga=["title"],ba={key:0,class:"workspace-running","aria-hidden":"true"},ya={key:0,class:"session-list"},wa=["data-state"],ka={key:0},Yt=5,_a=20,Ia=ke({__name:"SidebarWorkspaceGroup",props:{workspace:{},expanded:{type:Boolean},activeSessionId:{},nowMs:{}},emits:["toggle","navigate"],setup(s,{emit:t}){const e=s,n=t,{t:o}=ye(),i=R(Yt),r=E(()=>e.workspace.sessions.slice(0,i.value)),l=E(()=>e.workspace.sessions.length>i.value),h=E(()=>!e.expanded&&e.workspace.sessions.some(I=>I.running));function g(){i.value=l.value?i.value+_a:Yt}return(I,v)=>{const _=vt("tooltip");return d(),u("section",pa,[c("div",{class:"workspace-row",onClick:v[3]||(v[3]=w=>n("toggle"))},[c("button",{class:"workspace-toggle",type:"button","aria-expanded":s.expanded,"aria-label":a(o)(s.expanded?"sidebar.collapseWorkspace":"sidebar.expandWorkspace",{name:s.workspace.name}),onClick:v[0]||(v[0]=Se(w=>n("toggle"),["stop"]))},[c("span",ma,[c("span",{class:"workspace-disclosure-chevron","data-open":s.expanded?"true":void 0},[G(a(Dt),{size:14})],8,va),c("span",fa,[s.expanded?(d(),ae(a(io),{key:0,size:14})):(d(),ae(a(ss),{key:1,size:14}))])]),c("strong",{title:s.workspace.cwd},m(s.workspace.name),9,ga)],8,ha),h.value?(d(),u("span",ba,[G(a(Vt),{size:14,class:"is-spinning"})])):D("",!0),c("div",{class:"workspace-row-actions",onClick:v[2]||(v[2]=Se(()=>{},["stop"]))},[Ne((d(),ae(a(ut),{class:"ui-icon-button workspace-add","data-variant":"ghost","data-size":"sm",to:{name:"chat-new",query:{cwd:s.workspace.cwd}},"aria-label":a(o)("sidebar.newInWorkspace",{name:s.workspace.name}),onClick:v[1]||(v[1]=w=>n("navigate"))},{default:We(()=>[G(a(rs),{"aria-hidden":"true"})]),_:1},8,["to","aria-label"])),[[_,a(o)("sidebar.newInWorkspace",{name:s.workspace.name})]])])]),s.expanded?(d(),u("ul",ya,[(d(!0),u(ne,null,he(r.value,w=>(d(),u("li",{key:w.sessionId},[G(a(ut),{class:"session-open",to:{name:"chat-session",params:{sessionId:w.sessionId}},"data-open":w.sessionId===s.activeSessionId?"true":void 0,"aria-current":w.sessionId===s.activeSessionId?"page":void 0,title:w.title??w.preview,onClick:v[4]||(v[4]=b=>n("navigate"))},{default:We(()=>[c("span",{class:"status-dot","data-state":w.running?"running":"idle","aria-hidden":"true"},null,8,wa),c("strong",null,m(w.title??w.preview??a(o)("sidebar.untitled")),1),c("small",null,m(a(ca)(new Date(w.updatedAt),s.nowMs)),1)]),_:2},1032,["to","data-open","aria-current","title"])]))),128)),s.workspace.sessions.length>Yt?(d(),u("li",ka,[c("button",{class:"ui-button reveal-more","data-variant":"ghost","data-size":"sm",type:"button",onClick:g},[G(a(Dt),{"data-open":l.value?void 0:"true","aria-hidden":"true"},null,8,["data-open"]),be(" "+m(a(o)(l.value?"sidebar.showMore":"sidebar.showLess")),1)])])):D("",!0)])):D("",!0)])}}}),$a=Ae(Ia,[["__scopeId","data-v-6abef294"]]),xa=["aria-label"],Ca={class:"brand-row"},Sa={class:"brand-copy"},Ea=["aria-label"],Ma=["aria-label"],Ta={class:"sidebar-new-label"},qa={class:"ui-field-wrap sidebar-search"},Aa=["placeholder","aria-label"],La={class:"workspace-scroll app-scroll-viewport"},Oa={class:"section-label"},Ra={key:0,class:"sidebar-empty",role:"alert"},Pa={key:1,class:"sidebar-empty"},za={class:"sidebar-footer"},Da=ke({__name:"AppSidebar",emits:["navigate"],setup(s){const{t}=ye(),{t:e}=ye({messages:ds}),n=Ft(),o=Ke(),i=Ve(),r=R(""),l=R(Date.now());let h;ot(()=>{h=setInterval(()=>{l.value=Date.now()},6e4)}),it(()=>clearInterval(h));const g=E(()=>typeof n.params.sessionId=="string"?n.params.sessionId:void 0),I=E(()=>{var b;return g.value===void 0||(b=o.byId.get(g.value))==null?void 0:b.cwd}),v=E(()=>({name:"chat-new",...I.value===void 0?{}:{query:{cwd:I.value}}})),_=E(()=>r.value.trim().toLocaleLowerCase()),w=E(()=>o.workspaces.flatMap(b=>{if(_.value==="")return[b];const x=b.name.toLocaleLowerCase().includes(_.value)||b.cwd.toLocaleLowerCase().includes(_.value)?b.sessions:b.sessions.filter(C=>[C.title,C.preview].some(Y=>Y==null?void 0:Y.toLocaleLowerCase().includes(_.value)));return x.length===0?[]:[{...b,sessions:x}]}));return(b,k)=>(d(),u("aside",{class:"app-sidebar","aria-label":a(t)("a11y.workspaceSessionIndex")},[c("header",Ca,[G(Ut,{class:"brand-logo"}),c("strong",Sa,m(a(t)("brand.product")),1),c("button",{class:"ui-icon-button sidebar-collapse","data-variant":"ghost","data-size":"sm",type:"button","aria-label":a(t)("sidebar.closeMenu"),onClick:k[0]||(k[0]=x=>a(i).sidebarCollapsed=!0)},[G(a(po),{"aria-hidden":"true"})],8,Ea)]),c("nav",{class:"primary-actions","aria-label":a(t)("a11y.primaryNavigation")},[G(a(ut),{class:"ui-button sidebar-new","data-variant":"secondary","data-size":"md",to:v.value,onClick:k[1]||(k[1]=x=>b.$emit("navigate"))},{default:We(()=>[G(a(rs),{"aria-hidden":"true"}),c("span",Ta,m(a(t)("sidebar.newSession")),1)]),_:1},8,["to"])],8,Ma),c("div",qa,[G(a(ls),{"aria-hidden":"true"}),Ne(c("input",{"onUpdate:modelValue":k[2]||(k[2]=x=>r.value=x),class:"ui-field","data-size":"md",type:"search",placeholder:a(t)("sidebar.searchPlaceholder"),"aria-label":a(t)("common.search")},null,8,Aa),[[At,r.value]])]),c("div",La,[c("p",Oa,m(a(t)("sidebar.workspaces")),1),a(o).error&&!a(o).loaded?(d(),u("p",Ra,m(a(o).error),1)):a(o).loaded&&w.value.length===0?(d(),u("p",Pa,m(a(t)(_.value?"sidebar.noMatches":"sidebar.noWorkspaces")),1)):D("",!0),(d(!0),u(ne,null,he(w.value,x=>(d(),ae($a,{key:x.cwd,workspace:x,expanded:_.value!==""||a(i).isWorkspaceExpanded(x.cwd),"active-session-id":g.value,"now-ms":l.value,onToggle:C=>a(i).toggleWorkspace(x.cwd),onNavigate:k[3]||(k[3]=C=>b.$emit("navigate"))},null,8,["workspace","expanded","active-session-id","now-ms","onToggle"]))),128))]),c("footer",za,[G(a(ut),{class:"ui-button","data-variant":"ghost","data-size":"md",to:"/settings",onClick:k[4]||(k[4]=x=>b.$emit("navigate"))},{default:We(()=>[G(a(go),{"aria-hidden":"true"}),be(m(a(e)("settings")),1)]),_:1}),G(ra)])],8,xa))}}),Bs=Ae(Da,[["__scopeId","data-v-c8d45ab0"]]),Na=["role","onMouseenter","onMouseleave","onFocusin","onFocusout"],ja=["data-tone"],Ba={class:"ui-toast-title"},Fa={key:0,class:"ui-toast-description"},Wa=["onClick"],Va=["aria-label","onClick"],Ua=ke({__name:"ToastRegion",setup(s){const{t}=ye(),e=$t();function n(o){var i;e.dismiss(o.id),(i=o.action)==null||i.run()}return(o,i)=>(d(),ae(Bn,{name:"ui-toast",tag:"div",class:"ui-toast-region","aria-live":"polite"},{default:We(()=>[(d(!0),u(ne,null,he(a(e).toasts,r=>(d(),u("div",{key:r.id,class:"ui-toast",role:r.tone==="danger"?"alert":"status",onMouseenter:l=>a(e).pause(r.id),onMouseleave:l=>a(e).resume(r.id),onFocusin:l=>a(e).pause(r.id),onFocusout:l=>a(e).resume(r.id)},[c("span",{class:"ui-toast-icon","data-tone":r.tone},[r.tone==="danger"?(d(),ae(a(yt),{key:0,"aria-hidden":"true"})):r.tone==="info"?(d(),ae(a(ro),{key:1,"aria-hidden":"true"})):(d(),ae(a(It),{key:2,"aria-hidden":"true"}))],8,ja),c("div",null,[c("p",Ba,m(r.title),1),r.description?(d(),u("p",Fa,m(r.description),1)):D("",!0)]),r.action?(d(),u("button",{key:0,type:"button",class:"ui-button","data-variant":"ghost","data-size":"xs",onClick:l=>n(r)},m(r.action.label),9,Wa)):(d(),u("button",{key:1,type:"button",class:"ui-icon-button","data-variant":"close","data-size":"xs","aria-label":a(t)("common.close"),onClick:l=>a(e).dismiss(r.id)},[G(a(yt),{"aria-hidden":"true"})],8,Va))],40,Na))),128))]),_:1}))}}),Ha={key:0},Ka={class:"ui-dialog-header"},Qa={class:"ui-dialog-icon","data-tone":"danger"},Ga={class:"ui-dialog-title"},Ja={class:"ui-dialog-description"},Ya=["aria-label"],Xa={key:0,class:"ui-banner","data-tone":"danger",role:"alert"},Za={class:"ui-dialog-footer"},er=["disabled"],tr=["disabled"],sr=ke({__name:"EndLineDialog",setup(s){const{t}=ye(),e=Qe(),n=Ve(),o=R(),i=R(""),r=R(!1),l=E(()=>n.endingLine);ot(()=>{var I;return(I=o.value)==null?void 0:I.showModal()});function h(){var I;(I=o.value)==null||I.close()}async function g(){const I=l.value;if(!(I===void 0||r.value)){r.value=!0,i.value="";try{await e.endLine(I.sessionId,I.branchId),h()}catch(v){i.value=v instanceof Error?v.message:String(v)}finally{r.value=!1}}}return(I,v)=>(d(),u("dialog",{ref_key:"dialog",ref:o,class:"ui-dialog",onCancel:Se(h,["prevent"]),onClose:v[0]||(v[0]=_=>a(n).closeEndLine())},[l.value?(d(),u("div",Ha,[c("header",Ka,[c("span",Qa,[G(a(ft),{size:16,"aria-hidden":"true"})]),c("div",null,[c("h2",Ga,m(a(t)("lines.endTitle",{name:l.value.purpose})),1),c("p",Ja,m(a(t)("lines.endDescription")),1)]),c("button",{type:"button",class:"ui-icon-button ui-dialog-close","data-variant":"close","data-size":"sm","aria-label":a(t)("common.close"),onClick:h},[...v[1]||(v[1]=[c("span",{"aria-hidden":"true"},"×",-1)])],8,Ya)]),i.value?(d(),u("p",Xa,m(i.value),1)):D("",!0),c("footer",Za,[c("button",{type:"button",class:"ui-button","data-variant":"ghost","data-size":"md",disabled:r.value,onClick:h},m(a(t)("common.cancel")),9,er),c("button",{type:"button",class:"ui-button","data-variant":"danger","data-size":"md",disabled:r.value,onClick:g},m(a(t)("lines.end")),9,tr)])])):D("",!0)],544))}}),nr=["session.state","session.history","session.submit","session.interrupt","resources"];function $n(s,t,e){if(s.placement!=="session-panel")return`Unsupported placement: ${s.placement}`;for(const n of s.requires){if(!nr.includes(n))return`Unsupported capability: ${n}`;const o={"session.history":"session.history","session.submit":"session.submit","session.interrupt":"session.stop"}[n];if(o&&!t(o))return`Unavailable capability: ${n}`}for(const n of s.methods)if(!e.includes(n.name))return`Unavailable method: ${n.name}`}class Rt extends Error{constructor(e,n){super(n);ve(this,"name","PanelError");this.code=e}}function or(s,t){const e=new AbortController,n=new Set,{sessionId:o,branchId:i}=t.environment,r=Object.freeze({sessionId:o,branchId:i});function l(){if(e.signal.aborted)throw new Rt("binding_closed","This panel binding has ended")}function h(w,b){l();const k=w(x=>{e.signal.aborted||b(x)});return n.add(k),()=>{n.delete(k),k()}}async function g(w,b,k,x){if(l(),"sessionId"in b||"branchId"in b)throw new Rt("invalid_binding","Panel arguments cannot override their bound target");try{const C=await t.client.call(w,{...b,sessionId:o,...x?{branchId:i}:{}},k);return l(),C}catch(C){throw!e.signal.aborted&&C instanceof ct&&["service_reloading","service_unavailable","unknown_method","session_closed","branch_ended"].includes(C.appError??"")&&t.unavailable(C),C}}const I={};for(const w of s.requires)switch(w){case"session.state":(I.session??(I.session={})).state={observe:b=>h(t.observeActivity,b)};break;case"session.history":(I.session??(I.session={})).history={read:b=>g("session.history",b,ai,!0)};break;case"session.submit":(I.session??(I.session={})).submit=b=>g("session.submit",b,ri,!0);break;case"session.interrupt":(I.session??(I.session={})).interrupt=()=>g("session.stop",{},li,!0);break;case"resources":I.resources={url(b){if(l(),b.sessionId!==r.sessionId||!/^[a-zA-Z0-9_-]+$/.test(b.id))throw new Rt("invalid_binding","Resource must belong to this Session");return`/api/ui/sessions/${encodeURIComponent(r.sessionId)}/resources/${encodeURIComponent(b.id)}`}};break;default:throw new Rt("missing_capability",`Unsupported capability: ${w}`)}const v=Object.fromEntries(s.methods.map(w=>[w.name,b=>g(w.name,b,k=>k,w.scope==="branch")]));return{context:Object.freeze({signal:e.signal,environment:Object.freeze({...t.environment}),observeEnvironment:w=>h(t.observeEnvironment,w),services:Object.freeze(I),methods:Object.freeze(v)}),dispose(){e.abort();for(const w of n)try{w()}catch(b){console.error("Extension observer cleanup failed",b)}n.clear()}}}function Fs(s,t){return`/api/ui/extensions/${encodeURIComponent(s)}/${t.split("/").map(encodeURIComponent).join("/")}`}function xn(s,t){var e,n;return((e=s.title.translations)==null?void 0:e[t])??((n=s.title.translations)==null?void 0:n[t.split("-")[0]])??s.title.default}const Cn={en:{extensions:"Extensions",choose:"Choose an extension",checking:"Checking Session methods…",session:"Select a conversation to open extensions",empty:"No extensions installed",close:"Close extension",retry:"Retry",loading:"Loading extension…",unavailable:"This extension is unavailable",syncing:"Waiting for the conversation to sync…",disconnected:"Connection lost",ended:"This conversation or line has ended",lines:"Lines",branch:"Line"},"zh-CN":{extensions:"扩展",choose:"选择扩展",checking:"正在检查会话方法…",session:"选择会话后可打开扩展",empty:"未安装扩展",close:"关闭扩展",retry:"重试",loading:"正在加载扩展…",unavailable:"此扩展不可用",syncing:"正在等待会话同步…",disconnected:"连接已断开",ended:"此会话或分支已结束",lines:"分支",branch:"当前分支"}},ir={class:"extension-header"},ar=["src"],rr=["aria-label"],lr={class:"extension-branch"},dr=["value"],cr=["value"],ur={key:0,class:"extension-status",role:"status"},pr=["aria-label","hidden"],hr=ke({__name:"ExtensionPanel",props:{sessionId:{}},setup(s){const t=s,{t:e,locale:n}=ye({messages:Cn}),o=Me(),i=Tt(),r=Qe(),l=Ve(),h=ms(),g=R(),I=R(),v=R(""),_=R(!1),w=R(0),b=E(()=>l.activeLineTab[t.sessionId]??"main"),k=E(()=>r.views[t.sessionId]),x=E(()=>{var J;return(J=i.directory)==null?void 0:J.extensions.find(re=>{var z;return re.pluginName===((z=l.extension)==null?void 0:z.pluginName)})}),C=E(()=>{var J;return(J=x.value)==null?void 0:J.panels.find(re=>{var z;return re.id===((z=l.extension)==null?void 0:z.panelId)})}),Y=E(()=>{var J;return(J=C.value)!=null&&J.icon&&x.value?Fs(x.value.generation,C.value.icon):void 0}),X=R(),F=E(()=>C.value?xn(C.value,n.value):e("extensions")),P=E(()=>{var J,re;return((J=k.value)==null?void 0:J.status)==="closed"||((re=k.value)==null?void 0:re.lines.some(z=>z.id===b.value&&(z.state.kind.startsWith("ended")||z.state.kind==="creation-failed")))}),j=E(()=>{var J,re;return((J=k.value)==null?void 0:J.status)==="ready"&&(b.value==="main"||((re=k.value.branches[b.value])==null?void 0:re.status)==="ready")}),$=E(()=>o.phase!=="connected"?e("disconnected"):P.value?e("ended"):j.value?C.value?v.value||(_.value?e("loading"):""):e("unavailable"):e("syncing")),M=E(()=>{const J=k.value,re=b.value==="main"?J:J.branches[b.value];return Object.freeze({branch:Object.freeze({running:re.running,stopping:re.stopping}),sessionRunning:J.sessionRunning})}),T=E(()=>Object.freeze({sessionId:t.sessionId,branchId:b.value,theme:h.resolvedTheme,locale:n.value}));let W;$e([()=>t.sessionId,b],([J,re])=>{re!=="main"&&r.ensureLine(J,re)},{immediate:!0}),$e(I,async J=>{J instanceof HTMLDialogElement&&!J.open&&J.showModal(),await He(),J==null||J.focus()},{flush:"post"}),$e([g,()=>{var J;return(J=x.value)==null?void 0:J.generation},()=>{var J;return(J=C.value)==null?void 0:J.id},()=>t.sessionId,b,j,P,()=>o.phase,w],async(J,re,z)=>{let L=!0,H;z(()=>{L=!1,H==null||H(),W=void 0}),v.value="",_.value=!1;const me=g.value,V=C.value,ue=x.value;if(!me||!V||!ue||!j.value||P.value||o.phase!=="connected")return;const Pe=t.sessionId,Ze=b.value,Ge=T.value,tt=me.shadowRoot??me.attachShadow({mode:"open"});tt.replaceChildren();let ze,Ue;H=()=>{ze==null||ze.dispose();try{Ue==null||Ue()}catch(Be){console.error("Extension cleanup failed",Be)}Ue=void 0,tt.replaceChildren()},W=()=>{L=!1,H==null||H()},_.value=!0;try{const Be=V.methods.length===0?[]:await o.client.call("session.methods",{sessionId:Pe},cs);if(!L)return;const at=$n(V,o.supports,Be);if(at)throw new Error(at);const ht=await import(Fs(ue.generation,V.entry));if(!L)return;if(typeof ht.mount!="function")throw new Error("The extension does not export mount");if(ze=or(V,{client:o.client,environment:Ge,observeEnvironment:O=>$e(T,Z=>O(Z),{immediate:!0,flush:"sync"}),observeActivity:O=>$e(M,Z=>O(Z),{immediate:!0,flush:"sync"}),unavailable(O){v.value=O.message,H==null||H()}}),Ue=ht.mount(tt,ze.context),typeof Ue!="function")throw Ue=void 0,new Error("mount must return a cleanup function");(Pe!==t.sessionId||Ze!==b.value)&&H()}catch(Be){L&&(v.value=Be instanceof Error?Be.message:String(Be),H())}finally{L&&(_.value=!1)}},{immediate:!0,flush:"post"}),$e([()=>t.sessionId,b,()=>{var J;return(J=x.value)==null?void 0:J.generation},()=>{var J;return(J=C.value)==null?void 0:J.id},j,P,()=>o.phase,w],()=>W==null?void 0:W(),{flush:"sync"});function se(){W==null||W(),l.closeDetail(),He(()=>{var J;return(J=document.querySelector("[data-extension-trigger]"))==null?void 0:J.focus()})}function le(J){l.activeLineTab={...l.activeLineTab,[t.sessionId]:J.target.value}}async function ge(){await i.refresh(!0),w.value++}return it(()=>W==null?void 0:W()),(J,re)=>(d(),ae(is(a(l).shellMode==="compact"?"dialog":"section"),{ref_key:"surface",ref:I,class:"extension-panel","aria-label":F.value,tabindex:"-1",onCancel:Se(se,["prevent"]),onKeydown:re[2]||(re[2]=Se(()=>{},["stop"])),onPointerdown:re[3]||(re[3]=Se(z=>a(l).detailFocused=!0,["stop"])),onFocusin:re[4]||(re[4]=z=>a(l).detailFocused=!0)},{default:We(()=>{var z;return[c("header",ir,[Y.value&&X.value!==Y.value?(d(),u("img",{key:0,src:Y.value,alt:"",width:"20",height:"20",onError:re[0]||(re[0]=L=>X.value=Y.value)},null,40,ar)):(d(),ae(a(mo),{key:1,size:20,"aria-hidden":"true"})),c("strong",null,m(F.value),1),c("button",{type:"button",class:"ui-button","data-variant":"ghost","data-size":"sm",onClick:re[1]||(re[1]=L=>a(l).openLines(s.sessionId))},m(a(e)("lines")),1),c("button",{type:"button",class:"ui-button","data-variant":"ghost","data-size":"sm","aria-label":a(e)("close"),onClick:se},"×",8,rr)]),c("label",lr,[be(m(a(e)("branch"))+" ",1),c("select",{value:b.value,onChange:le},[(d(!0),u(ne,null,he((z=k.value)==null?void 0:z.lines,L=>(d(),u("option",{key:L.id,value:L.id},m(L.purpose||L.id),9,cr))),128))],40,dr)]),$.value?(d(),u("div",ur,[be(m($.value)+" ",1),v.value||!C.value?(d(),u("button",{key:0,type:"button",class:"ui-button","data-size":"sm",onClick:ge},m(a(e)("retry")),1)):D("",!0)])):D("",!0),c("div",{ref_key:"container",ref:g,class:"extension-root","aria-label":F.value,tabindex:"-1",hidden:!!$.value},null,8,pr)]}),_:1},40,["aria-label"]))}}),mr=Ae(hr,[["__scopeId","data-v-ddd975e8"]]),Ws={read:"tool.read",read_file:"tool.read",write:"tool.write",write_file:"tool.write",edit:"tool.edit",edit_file:"tool.edit",apply_patch:"tool.edit",grep:"tool.grep",rg:"tool.grep",glob:"tool.glob"};function vr(s){const t=s.trim().toLowerCase();return t.split(/(?:__|[./\s:-])+/).filter(Boolean).at(-1)??t}function vs(s,t){const e=s.trim().toLowerCase();if(e.startsWith("mcp__"))return{renderer:"generic",labelKey:"prompt.useTool"};const n=vr(s);if(["exec","bash","shell","run_command","exec_command"].includes(n))return{renderer:"command",labelKey:t.runInBackground===!0?"tool.runBackground":"tool.run"};if(["grep","rg","glob","find","ls","list_files"].includes(n)){const o=typeof t.pattern=="string"?t.pattern:void 0;return{renderer:"search",labelKey:n==="glob"&&(!o||o==="*")?"tool.listFiles":Ws[n]??"tool.grep"}}return["read","read_file","write","write_file","edit","edit_file","apply_patch"].includes(n)?{renderer:"file",labelKey:Ws[n]??"tool.edit"}:e.includes("web_search")||n==="websearch"?{renderer:"web",labelKey:"tool.webSearch"}:e.includes("web_fetch")||n==="webfetch"?{renderer:"web",labelKey:"tool.webFetch"}:{renderer:"generic",labelKey:"prompt.useTool"}}function Sn(s,t){if(t!==void 0)return t.split(`
|
|
225
|
-
`).filter(o=>!o.startsWith("---")&&!o.startsWith("+++")&&!o.startsWith("@@")).map(o=>{const i=o.startsWith("+")?"+":o.startsWith("-")?"-":" ";return{sign:i,text:i===" "?o.replace(/^ /,""):o.slice(1)}});const e=typeof s.oldText=="string"?s.oldText:void 0,n=typeof s.newText=="string"?s.newText:void 0;return e===void 0||n===void 0?[]:[...e.split(`
|
|
226
|
-
`).map(o=>({sign:"-",text:o})),...n.split(`
|
|
227
|
-
`).map(o=>({sign:"+",text:o}))]}const fr={class:"prompt-card","data-inline-interaction-prompt":""},gr={class:"prompt-header"},br={class:"prompt-icon","aria-hidden":"true"},yr={class:"prompt-title"},wr={class:"ui-badge","data-tone":"warning"},kr={key:0,class:"prompt-subtitle"},_r={key:1,class:"approval-panel"},Ir={class:"approval-panel-header"},$r={class:"approval-panel-body"},xr={key:1},Cr={key:2,class:"approval-command"},Sr={key:0,class:"approval-muted"},Er={key:3,class:"approval-panel"},Mr={class:"approval-panel-header"},Tr={key:0,class:"approval-panel-body"},qr={key:1,class:"approval-panel-body"},Ar={class:"approval-line-number"},Lr={key:4,class:"approval-panel"},Or={class:"approval-panel-header"},Rr={class:"approval-panel-body"},Pr={key:0},zr={key:1},Dr={key:2},Nr={key:3,class:"approval-muted"},jr={key:5,class:"approval-panel"},Br={class:"approval-panel-header is-mono"},Fr={class:"approval-panel-body"},Wr={key:6,class:"approval-panel"},Vr={class:"approval-panel-body approval-muted"},Ur={key:7,class:"prompt-error",role:"alert"},Hr={class:"prompt-buttons"},Kr=["disabled"],Qr=["disabled"],Gr=["disabled"],Jr=["disabled"],Yr=["disabled"],En=ke({__name:"ApprovalPrompt",props:{sessionId:{},request:{},keyboard:{type:Boolean},rulesAvailable:{type:Boolean}},setup(s){const t=s,{t:e}=ye(),n=Qe(),o=R(!1),i=R(""),r=E(()=>t.request.call.name==="member_approval_allow"),l=E(()=>!r.value&&vn(t.request)!==void 0),h=E(()=>!r.value&&t.rulesAvailable===!0&&mn(t.request)!==void 0),g=R(),I=R(!1),v=R(!0);async function _(){I.value=!0,i.value="";try{const se=await n.memberApproval(t.sessionId,t.request);return se.state==="ended"?(await n.respond(t.sessionId,t.request,"deny"),!1):(g.value=se.descriptor,!0)}catch(se){return g.value=void 0,v.value=!(se instanceof ct&&se.code===-32601),i.value=se instanceof Error?se.message:"Cannot review member action",!1}finally{I.value=!1}}const w=E(()=>{var se;return((se=g.value)==null?void 0:se.call)??t.request.call}),b=E(()=>w.value.input),k=E(()=>vs(w.value.name,b.value)),x={command:wo,search:ls,file:oo,web:ao,generic:$o};function C(se){const le=b.value[se];return typeof le=="string"&&le.trim()!==""?le:void 0}const Y=E(()=>w.value.name.trim().toLowerCase()),X=E(()=>Y.value==="edit"?Sn(b.value,void 0):[]),F=E(()=>Y.value==="write"?C("content"):void 0),P=E(()=>Object.entries(b.value).filter(([se])=>!["command","cwd","path","pattern","oldText","newText","content","query","url"].includes(se)).map(([se,le])=>({key:se,value:typeof le=="string"?le:JSON.stringify(le)})));async function j(se){if(!(o.value||se==="allow"&&r.value&&(I.value||g.value===void 0))){o.value=!0,i.value="";try{if(se==="allow"&&r.value&&!await _()){o.value=!1;return}se==="always"?await n.allowAlways(t.sessionId,t.request):se==="session"?await n.allowForSession(t.sessionId,t.request):await n.respond(t.sessionId,t.request,se)}catch(le){i.value=le instanceof Error&&le.message?le.message:e("prompt.permissionSubmitFailed"),o.value=!1}}}function $(se){const le=ea(se,{keyboard:t.keyboard,pending:o.value,dialogOpen:document.querySelector("dialog[open]")!==null});le!==void 0&&(se.preventDefault(),j(le))}let M=!1;function T(){M||t.keyboard===!1||(window.addEventListener("keydown",$),M=!0)}function W(){M&&(window.removeEventListener("keydown",$),M=!1)}return ot(()=>{T(),r.value&&_()}),it(W),$e(()=>t.keyboard,()=>t.keyboard===!1?W():T()),(se,le)=>(d(),u("article",fr,[c("header",gr,[c("span",br,[(d(),ae(is(x[k.value.renderer]),{size:12,"stroke-width":2.25}))]),c("h2",yr,m(a(e)("prompt.actionRequest",{action:k.value.renderer==="generic"?s.request.call.name:a(e)(k.value.labelKey)})),1),c("span",wr,m(a(e)("prompt.awaitingApproval")),1)]),s.request.reason?(d(),u("p",kr,m(s.request.reason),1)):D("",!0),r.value?(d(),u("div",_r,[c("div",Ir,"Subagent tool approval · Leader branch: "+m(s.request.branchId),1),g.value?(d(),u(ne,{key:0},[c("p",null,"Member: "+m(g.value.member.agentId)+" · Session: "+m(g.value.member.sessionId)+" · Branch: "+m(g.value.member.branchId),1),c("p",null,m(g.value.call.name)+": "+m(g.value.reason),1),c("pre",$r,m(JSON.stringify(g.value.call.input,null,2)),1)],64)):(d(),u("p",xr,m(I.value?"Loading member action...":"Cannot review member action"),1))])):k.value.renderer==="command"?(d(),u("div",Cr,[c("div",null,[le[5]||(le[5]=c("span",{class:"approval-muted"},"$",-1)),be(" "+m(C("command")),1)]),C("cwd")?(d(),u("div",Sr," cwd: "+m(C("cwd")),1)):D("",!0)])):k.value.renderer==="file"?(d(),u("div",Er,[c("div",Mr,m(C("path")??s.request.call.name),1),X.value.length?(d(),u("div",Tr,[(d(!0),u(ne,null,he(X.value,(ge,J)=>(d(),u("div",{key:J,class:je(ge.sign==="-"?"approval-diff-del":"approval-diff-add")},m(ge.sign)+" "+m(ge.text),3))),128))])):F.value!==void 0?(d(),u("div",qr,[(d(!0),u(ne,null,he(F.value.split(`
|
|
228
|
-
`),(ge,J)=>(d(),u("div",{key:J,class:"approval-code-line"},[c("span",Ar,m(J+1),1),be(m(ge),1)]))),128))])):D("",!0)])):k.value.renderer==="search"||k.value.renderer==="web"?(d(),u("div",Lr,[c("div",Or,m(a(e)("prompt.input")),1),c("div",Rr,[C("pattern")?(d(),u("div",Pr,"pattern: "+m(C("pattern")),1)):D("",!0),C("query")?(d(),u("div",zr,"query: "+m(C("query")),1)):D("",!0),C("url")?(d(),u("div",Dr,"url: "+m(C("url")),1)):D("",!0),C("path")?(d(),u("div",Nr,"path: "+m(C("path")),1)):D("",!0)])])):(d(),u("div",jr,[c("div",Br,m(s.request.call.name),1),c("pre",Fr,m(JSON.stringify(b.value,null,2)),1)])),!r.value&&k.value.renderer!=="generic"&&P.value.length?(d(),u("div",Wr,[c("div",Vr,[(d(!0),u(ne,null,he(P.value,ge=>(d(),u("div",{key:ge.key},m(ge.key)+": "+m(ge.value),1))),128))])])):D("",!0),i.value?(d(),u("p",Ur,m(i.value),1)):D("",!0),c("div",Hr,[c("button",{type:"button",class:"ui-button","data-size":"md","data-variant":"ghost",disabled:o.value,onClick:le[0]||(le[0]=ge=>j("deny"))},m(a(e)("prompt.reject")),9,Kr),r.value&&i.value&&v.value?(d(),u("button",{key:0,type:"button",class:"ui-button",disabled:I.value,onClick:le[1]||(le[1]=ge=>_())},"Retry",8,Qr)):D("",!0),l.value?(d(),u("button",{key:1,type:"button",class:"ui-button","data-size":"md","data-variant":"secondary",disabled:o.value,onClick:le[2]||(le[2]=ge=>j("session"))},m(a(e)("prompt.allowSession")),9,Gr)):D("",!0),h.value?(d(),u("button",{key:2,type:"button",class:"ui-button","data-size":"md","data-variant":"secondary",disabled:o.value,onClick:le[3]||(le[3]=ge=>j("always"))},m(a(e)("prompt.allowAlways")),9,Jr)):D("",!0),c("button",{type:"button",class:"ui-button","data-size":"md","data-variant":"primary",disabled:o.value||r.value&&(I.value||!g.value),onClick:le[4]||(le[4]=ge=>j("allow"))},m(a(e)("prompt.allowOnce")),9,Yr)])]))}}),Xr=/[\s,;:!?,。!?、()[\]{}<>]/,Mn=/[\p{L}\p{N}_./~\\:-]/u;function Zr(s,t){const e=s.slice(0,t);for(let n=e.length-1;n>=0;n--){const o=e[n];if(o==="@"){const i=n===0?void 0:e[n-1];return i!==void 0&&!Xr.test(i)?void 0:{start:n,query:e.slice(n+1)}}if(!Mn.test(o))return}}function el(s,t){const e=s.replace(/[[\]\\]/g,n=>`\\${n}`);return/[\s()<>]/.test(t)?`[${e}](<${t.replaceAll("<","%3C").replaceAll(">","%3E")}>)`:`[${e}](${t})`}function tl(s,t){const e=[];for(const i of t){let r=0;for(;;){const l=s.indexOf(i.label,r);if(l===-1)break;const h=l+i.label.length,g=s[h];(g===void 0||!Mn.test(g))&&e.push({start:l,end:h,link:el(i.label,i.path)}),r=h}}e.sort((i,r)=>i.start-r.start||r.end-i.end);let n="",o=0;for(const i of e)i.start<o||(n+=s.slice(o,i.start)+i.link,o=i.end);return n+s.slice(o)}const Qt=mt("models",()=>{const s=R(),t=R("");let e;const n=E(()=>{const h=Me();return h.supports("provider.list")&&h.supports("provider.catalog")});function o(){return e??(e=i().finally(()=>{e=void 0})),e}async function i(){const h=Me(),g=h.client;t.value="";const v=(await Promise.allSettled([g.call("provider.list",{},Wo).then(b=>b.filter(k=>k.enabled)),h.supports("account.providers")?g.call("account.providers",{},Vo):[]])).flatMap(b=>b.status==="rejected"?(t.value=b.reason instanceof Error?b.reason.message:String(b.reason),[]):b.value),_=[...new Map(v.map(b=>[b.providerId,b])).values()],w=await Promise.allSettled(_.map(b=>g.call("provider.catalog",{providerId:b.providerId},Ho)));s.value=_.flatMap((b,k)=>{const x=w[k];if(x.status==="rejected")return t.value=x.reason instanceof Error?x.reason.message:String(x.reason),[];const C=x.value;if(C===void 0)return[];const Y=new Set(C.disabledModelIds),X=C.models.filter(F=>F.unavailableReason===void 0&&!Y.has(F.id));return X.length===0?[]:[{providerId:b.providerId,name:b.displayName,models:X}]})}async function r(h){if(Me().supports("provider.selection"))return Me().client.call("provider.selection",{cwd:h},Ko).catch(()=>{})}function l(h){var I,v;const g=(I=s.value)==null?void 0:I.find(_=>_.providerId===h.providerId);return((v=g==null?void 0:g.models.find(_=>_.id===h.modelId))==null?void 0:v.name)??h.modelId}return{providers:s,error:t,available:n,load:o,defaultFor:r,nameOf:l}}),sl={key:0,class:"ui-button model-trigger","data-variant":"ghost","data-size":"sm","aria-disabled":"true"},nl={class:"model-trigger-label"},ol={class:"ui-button model-trigger","data-variant":"ghost","data-size":"sm"},il={key:0,class:"provider-badge","aria-hidden":"true"},al={class:"model-trigger-label"},rl={class:"composer-popover-content is-end ui-popover model-content","data-width":"xl"},ll={class:"ui-menu-search model-search"},dl=["placeholder","aria-label"],cl={key:0,class:"menu-empty"},ul={key:1,class:"menu-empty"},pl={key:2,class:"model-panes"},hl={key:0,class:"provider-pane"},ml=["aria-current","onClick"],vl={class:"provider-badge","aria-hidden":"true"},fl=["aria-label"],gl={key:0,class:"menu-empty"},bl=["aria-selected","data-highlighted","title","onMouseenter","onClick"],yl={class:"model-check"},wl={key:0,class:"provider-badge","aria-hidden":"true"},kl={class:"model-name"},_l=ke({__name:"ComposerModelMenu",props:{model:{},selectable:{type:Boolean},disabled:{type:Boolean}},emits:["select"],setup(s,{expose:t,emit:e}){const n=s,o=e,{t:i}=ye(),r=Qt(),l=R(),h=R(),g=R(""),I=R(),v=R(0),_=E(()=>r.providers??[]),w=E(()=>{var $,M,T;return(($=_.value.find(W=>W.providerId===I.value))==null?void 0:$.providerId)??((M=_.value.find(W=>{var se;return W.providerId===((se=n.model)==null?void 0:se.providerId)}))==null?void 0:M.providerId)??((T=_.value[0])==null?void 0:T.providerId)}),b=E(()=>_.value.flatMap($=>$.models.map(M=>({providerId:$.providerId,providerName:$.name,modelId:M.id,name:M.name})))),k=E(()=>g.value.trim()!==""),x=E(()=>{if(!k.value)return b.value.filter(M=>M.providerId===w.value);const $=g.value.trim().toLocaleLowerCase();return b.value.filter(M=>[M.name,M.modelId,M.providerName].some(T=>T.toLocaleLowerCase().includes($)))}),C=E(()=>n.model===void 0?i("composer.notConfigured"):r.nameOf(n.model));ot(()=>{n.selectable&&r.available&&r.providers===void 0&&r.load()});function Y($){var M;return $.providerId===((M=n.model)==null?void 0:M.providerId)&&$.modelId===n.model.modelId}function X($){return $.trim().charAt(0).toLocaleUpperCase()}async function F(){var $,M,T,W;(($=l.value)==null?void 0:$.open)===!0&&(r.providers===void 0&&await r.load(),g.value="",I.value=((M=n.model)==null?void 0:M.providerId)??((T=_.value[0])==null?void 0:T.providerId),v.value=Math.max(0,x.value.findIndex(Y)),await He(),matchMedia("(pointer: coarse)").matches||(W=h.value)==null||W.focus())}function P($){l.value&&(l.value.open=!1),Y($)||o("select",{providerId:$.providerId,modelId:$.modelId})}function j($){var M,T;if(!($.isComposing||$.keyCode===229)){if($.key==="Escape"){$.preventDefault(),l.value&&(l.value.open=!1),(T=(M=l.value)==null?void 0:M.querySelector("summary"))==null||T.focus();return}if($.key==="ArrowDown")$.preventDefault(),v.value=Math.min(x.value.length-1,v.value+1);else if($.key==="ArrowUp")$.preventDefault(),v.value=Math.max(0,v.value-1);else if($.key==="Enter"){$.preventDefault();const W=x.value[v.value];W!==void 0&&P(W)}}}return t({open:()=>{n.selectable&&r.available&&!n.disabled&&l.value&&(l.value.open=!0)}}),($,M)=>{const T=vt("tooltip");return!s.selectable||!a(r).available?(d(),u("span",sl,[c("span",nl,m(C.value),1)])):(d(),u("details",{key:1,ref_key:"details",ref:l,class:je(["composer-popover model-menu",{"is-disabled":s.disabled}]),onToggle:F},[Ne((d(),u("summary",ol,[s.model?(d(),u("span",il,m(X(s.model.providerId)),1)):D("",!0),c("span",al,m(C.value),1)])),[[T,s.model?`${C.value} · ${s.model.providerId}`:void 0]]),c("div",rl,[c("label",ll,[G(a(ls),{"aria-hidden":"true"}),Ne(c("input",{ref_key:"searchInput",ref:h,"onUpdate:modelValue":M[0]||(M[0]=W=>g.value=W),type:"text",placeholder:a(i)("composer.searchModels"),"aria-label":a(i)("composer.searchModels"),onKeydown:j,onInput:M[1]||(M[1]=W=>v.value=0)},null,40,dl),[[At,g.value]])]),a(r).providers===void 0&&!a(r).error?(d(),u("p",cl,[G(a(Vt),{class:"is-spinning","aria-hidden":"true"}),be(m(a(i)("composer.modelLoading")),1)])):a(r).error?(d(),u("p",ul,[c("button",{type:"button",class:"ui-button","data-variant":"danger-ghost","data-size":"sm",onClick:M[2]||(M[2]=W=>a(r).load())},m(a(i)("composer.modelLoadRetry")),1)])):D("",!0),a(r).providers!==void 0&&(!a(r).error||_.value.length>0)?(d(),u("div",pl,[k.value?D("",!0):(d(),u("div",hl,[(d(!0),u(ne,null,he(_.value,W=>(d(),u("button",{key:W.providerId,type:"button",class:"ui-menu-item","aria-current":w.value===W.providerId,onClick:se=>{I.value=W.providerId,v.value=0}},[c("span",vl,m(X(W.name)),1),c("span",null,m(W.name),1)],8,ml))),128))])),c("div",{class:"model-pane",role:"listbox","aria-label":a(i)("composer.searchModels")},[x.value.length===0?(d(),u("p",gl,m(a(i)("composer.noModels")),1)):D("",!0),(d(!0),u(ne,null,he(x.value,(W,se)=>(d(),u("button",{key:`${W.providerId}:${W.modelId}`,type:"button",role:"option",class:"ui-menu-item","aria-selected":Y(W),"data-highlighted":se===v.value?"":void 0,title:`${W.name} · ${W.providerName}`,onMouseenter:le=>v.value=se,onClick:le=>P(W)},[c("span",yl,[Y(W)?(d(),ae(a(It),{key:0,"aria-hidden":"true"})):D("",!0)]),k.value?(d(),u("span",wl,m(X(W.providerName)),1)):D("",!0),c("span",kl,m(W.name),1)],40,bl))),128))],8,fl)])):D("",!0)])],34))}}}),Il=Ae(_l,[["__scopeId","data-v-65d27c07"]]),$l=["aria-labelledby"],xl={class:"ui-dialog-header"},Cl={class:"ui-dialog-icon","data-tone":"warning"},Sl=["id"],El={class:"ui-dialog-footer"},Tn=ke({__name:"ConfirmDialog",setup(s,{expose:t}){const{t:e}=ye({messages:ds}),n=ts(),o=R(),i=R(""),r=R("");let l;function h(I,v={}){return l==null||l(!1),i.value=I,r.value=v.confirmLabel??e("confirm"),new Promise(_=>{var w;l=_,(w=o.value)==null||w.showModal()})}function g(I){var _;const v=l;l=void 0,(_=o.value)==null||_.close(),v==null||v(I)}return it(()=>l==null?void 0:l(!1)),t({open:h}),(I,v)=>(d(),u("dialog",{ref_key:"dialog",ref:o,class:"ui-dialog","data-size":"md","aria-labelledby":a(n),onCancel:v[2]||(v[2]=Se(_=>g(!1),["prevent"])),onClose:v[3]||(v[3]=_=>g(!1))},[c("header",xl,[c("span",Cl,[G(a(ko),{"aria-hidden":"true"})]),c("h2",{id:a(n),class:"ui-dialog-title"},m(i.value),9,Sl)]),c("footer",El,[c("button",{class:"ui-button","data-variant":"secondary",type:"button",autofocus:"",onClick:v[0]||(v[0]=_=>g(!1))},m(a(e)("cancel")),1),c("button",{class:"ui-button","data-variant":"danger",type:"button",onClick:v[1]||(v[1]=_=>g(!0))},m(r.value),1)])],40,$l))}}),Ml=["aria-label"],Tl={class:"permission-trigger-label"},ql={class:"composer-popover-content ui-popover permission-content","data-width":"lg"},Al=["disabled"],Ll=["aria-pressed","onClick"],Ol={class:"permission-option-text"},Rl={key:0,class:"permission-note"},Pl={key:1,class:"permission-note"},zl={class:"permission-note"},Dl=ke({__name:"ComposerPermissionMenu",props:{policy:{}},emits:["select"],setup(s,{expose:t,emit:e}){const n=s,o=e,{t:i}=ye(),r=R(),l=R(),h=["read-only","workspace-write","full-access"];async function g(v){var _;n.policy===void 0||v===n.policy.preset||v==="full-access"&&!await((_=l.value)==null?void 0:_.open(i("composer.permission.fullAccessConfirm")))||o("select",v)}function I(){r.value&&(r.value.open=!0)}return t({open:I}),(v,_)=>{var w,b;return d(),u("details",{ref_key:"details",ref:r,class:"composer-popover permission-menu"},[c("summary",{class:"ui-button permission-trigger","data-variant":"ghost","data-size":"sm","aria-label":a(i)("composer.permission.label")},[G(a(bo),{size:14,"aria-hidden":"true"}),c("span",Tl,m(s.policy?a(i)(`composer.permission.preset.${s.policy.preset}`):a(i)("composer.permission.label")),1)],8,Ml),c("div",ql,[c("fieldset",{class:"permission-group",disabled:!s.policy},[c("legend",null,m(a(i)("composer.permission.label")),1),(d(),u(ne,null,he(h,k=>{var x,C;return c("button",{key:k,type:"button",class:"ui-menu-item permission-option","aria-pressed":k===((x=s.policy)==null?void 0:x.preset),onClick:Y=>g(k)},[c("span",Ol,[c("span",null,m(a(i)(`composer.permission.preset.${k}`)),1),c("small",null,m(a(i)(`composer.permission.description.${k}`)),1)]),k===((C=s.policy)==null?void 0:C.preset)?(d(),ae(a(It),{key:0,size:14,"aria-hidden":"true"})):D("",!0)],8,Ll)}),64))],8,Al),(w=s.policy)!=null&&w.allowedTools.length?(d(),u("p",Rl,m(a(i)("composer.permission.allowedTools"))+": "+m(s.policy.allowedTools.join(", ")),1)):D("",!0),(b=s.policy)!=null&&b.disallowedTools.length?(d(),u("p",Pl,m(a(i)("composer.permission.disallowedTools"))+": "+m(s.policy.disallowedTools.join(", ")),1)):D("",!0),c("p",zl,m(a(i)("composer.permission.isolation")),1),G(a(ut),{class:"ui-menu-item",to:{name:"settings-permissions"}},{default:We(()=>[be(m(a(i)("composer.permission.processIsolation")),1)]),_:1})]),G(Tn,{ref_key:"confirm",ref:l},null,512)],512)}}}),Nl=Ae(Dl,[["__scopeId","data-v-f15bf42f"]]);function jl(s,t){let e=t.replaceAll(`\r
|
|
229
|
-
`,`
|
|
230
|
-
`);if(e.endsWith(`
|
|
231
|
-
`)&&(e=e.slice(0,-1)),e==="")return s;const n=e.split(`
|
|
232
|
-
`).map(i=>i===""?`>
|
|
233
|
-
`:`> ${i}
|
|
234
|
-
`).join(""),o=s===""||s.endsWith(`
|
|
235
|
-
|
|
236
|
-
`)?"":s.endsWith(`
|
|
237
|
-
`)?`
|
|
238
|
-
`:`
|
|
239
|
-
|
|
240
|
-
`;return`${s}${o}${n}
|
|
241
|
-
`}const Bl=["data-variant","aria-label"],Fl={key:0,class:"inline-error",role:"alert"},Wl={key:0,class:"draft-attachments"},Vl=["src","alt"],Ul=["aria-label","onClick"],Hl=["aria-label","onClick"],Kl=["id","aria-label"],Ql=["id","aria-selected","data-highlighted","onMouseenter","onClick"],Gl={class:"command-category"},Jl={class:"command-name"},Yl={key:0,class:"command-argument"},Xl={key:1,class:"command-argument"},Zl={class:"command-description"},ed={class:"command-keys"},td=["id","aria-label"],sd=["aria-selected","data-highlighted","onMouseenter","onClick"],nd={class:"command-name"},od={class:"command-keys"},id=["placeholder","aria-label","aria-controls","aria-expanded","aria-activedescendant"],ad={class:"composer-toolbar"},rd={class:"composer-tool-group"},ld={class:"composer-run-group"},dd=["data-variant","aria-label","disabled"],cd={key:1,class:"composer-statusbar"},ud={class:"composer-status-start"},pd=16*1024,hd=10*1024*1024,md=20,vd=ke({__name:"ComposerPanel",props:{running:{type:Boolean},stopping:{type:Boolean},model:{},modelSelectable:{type:Boolean},send:{},attachments:{type:Boolean,default:!0},storesPastes:{type:Boolean},searchFiles:{},permission:{},stop:{},selectModel:{},variant:{},placeholder:{},createBranch:{},openLines:{},sessionCommands:{}},setup(s,{expose:t}){const e=s,{t:n}=ye(),o=Ft(),i=Wt(),r=Qt(),l=Ke(),h=Me(),g=R(),I=R(),v=R(),_=ts(),w=R(""),b=R(!1),k=R(!1),x=R(""),C=R(!1),Y=R(!1),X=R(!1),F=R([]),P=R(),j=R(),$=R([]),M=R(0);let T=0,W;const se=E(()=>P.value===void 0?void 0:`${P.value.start}:${P.value.query}`),le=E(()=>Y.value&&e.searchFiles!==void 0&&P.value!==void 0&&se.value!==j.value),ge=E(()=>le.value&&$.value.length>0),J=ts(),re=R(0),z=R([]),L=R([]);let H=0;const me=E(()=>{var A,Q,Ie,te,pe;return[{category:"model",name:"models",available:e.modelSelectable&&r.available&&!k.value},{category:"session",name:"branch",available:e.createBranch!==void 0},{category:"session",name:"compact",available:((A=e.sessionCommands)==null?void 0:A.compact)!==void 0},{category:"session",name:"usage",available:((Q=e.sessionCommands)==null?void 0:Q.usage)!==void 0},{category:"session",name:"fork",available:((Ie=e.sessionCommands)==null?void 0:Ie.fork)!==void 0},{category:"session",name:"goal",available:((te=e.sessionCommands)==null?void 0:te.goal)!==void 0},{category:"model",name:"effort",available:((pe=e.sessionCommands)==null?void 0:pe.effort)!==void 0},{category:"model",name:"permissions",available:e.permission!==void 0&&e.variant!=="panel"},{category:"session",name:"lines",available:e.openLines!==void 0},{category:"session",name:"new",available:!0},{category:"session",name:"scheduled",available:h.supports("schedule.list")}].filter(De=>De.available)}),V=E(()=>/^\/[a-z]*$/i.test(w.value)?w.value.slice(1).toLowerCase():void 0),ue=E(()=>{const A=V.value;return A===void 0?[]:me.value.filter(Q=>Q.name.startsWith(A))}),Pe=E(()=>!C.value&&!X.value&&ue.value.length>0),Ze=E(()=>Y.value&&Pe.value);$e(w,()=>{w.value.startsWith("/")||(X.value=!1)},{flush:"sync"}),$e(ue,()=>{re.value=0},{flush:"sync"});const Ge=E(()=>e.running&&e.stop!==void 0&&w.value.trim()===""&&z.value.length===0&&L.value.length===0),tt=E(()=>(w.value.trim()!==""||z.value.length>0||L.value.length>0)&&!b.value);function ze(){const A=g.value;A!==void 0&&(A.style.height="auto",A.style.height=`${Math.min(A.scrollHeight,300)}px`)}function Ue(A){return new Promise((Q,Ie)=>{const te=new FileReader;te.onload=()=>{const pe=String(te.result);Q({url:pe,block:{type:"image",source:{type:"base64",mediaType:A.type,data:pe.slice(pe.indexOf(",")+1)}}})},te.onerror=()=>Ie(te.error??new Error(n("composer.imageReadFailed"))),te.readAsDataURL(A)})}async function Be(A){for(const Q of A)try{const Ie=await Ue(Q);if(z.value.length>=md){x.value=n("composer.imageLimit");return}z.value=[...z.value,{id:++H,...Ie}]}catch{x.value=n("composer.imageReadFailed")}}function at(A){if(new TextEncoder().encode(A).length>hd){x.value=n("composer.pasteTooLarge");return}L.value=[...L.value,{id:++H,text:A}]}function ht(A){var te,pe;if(!e.attachments)return;const Q=[...((te=A.clipboardData)==null?void 0:te.files)??[]].filter(De=>De.type.startsWith("image/"));if(Q.length>0){A.preventDefault(),Be(Q);return}const Ie=((pe=A.clipboardData)==null?void 0:pe.getData("text/plain"))??"";e.storesPastes&&new TextEncoder().encode(Ie).length>pd&&(A.preventDefault(),at(Ie))}function O(A){var te;if(A.preventDefault(),!e.attachments)return;const Q=[...((te=A.dataTransfer)==null?void 0:te.files)??[]],Ie=Q.filter(pe=>pe.type.startsWith("image/"));Ie.length<Q.length&&(x.value=n("composer.onlyImages")),Be(Ie)}function Z(A){z.value=z.value.filter(Q=>Q.id!==A)}function p(A){L.value=L.value.filter(Q=>Q.id!==A)}function f(){const A=g.value;P.value=A===void 0||e.searchFiles===void 0?void 0:Zr(A.value,A.selectionStart)}$e(()=>{var A;return(A=P.value)==null?void 0:A.query},A=>{clearTimeout(W),M.value=0;const Q=e.searchFiles;if(A===void 0||Q===void 0){$.value=[];return}const Ie=++T;W=setTimeout(()=>{Q(A).then(te=>{Ie===T&&($.value=te)},te=>{Ie===T&&($.value=[],x.value=te instanceof Error?te.message:String(te))})},80)});function y(A){const Q=g.value,Ie=P.value;if(Q===void 0||Ie===void 0)return;const te=Q.selectionStart,pe=`@${A.relativePath}${A.dir?"/":""}`,De=A.dir?"":" ";w.value=`${w.value.slice(0,Ie.start)}${pe}${De}${w.value.slice(te)}`,A.dir||(F.value=[...F.value,{label:`@${A.relativePath}`,path:A.absolutePath}]);const st=Ie.start+pe.length+De.length;He(()=>{Q.setSelectionRange(st,st),ze(),f()})}async function q(){var st,xt,gt,Ct,Je;if(!tt.value||C.value)return;if(Pe.value){const rt=ue.value[re.value];rt!==void 0&&await K(rt.name);return}const A=w.value;if(!X.value&&h.supports("schedule.list")&&/^\/schedule(?:d)?\s*$/i.test(A)){await K("scheduled");return}const Q=!X.value&&/^\/branch(?:\s+([\s\S]*))?$/i.exec(A);if(Q&&!((st=Q[1])!=null&&st.trim())){await K("branch");return}const Ie=(xt=e.sessionCommands)==null?void 0:xt.goal,te=!X.value&&Ie!==void 0?/^\/goal(?:\s+([\s\S]*))?$/i.exec(A):null;if(Ie&&te){w.value="",await He(),ze(),await Ie(((gt=te[1])==null?void 0:gt.trim())??"");return}const pe=(Ct=e.sessionCommands)==null?void 0:Ct.effort,De=!X.value&&pe!==void 0?/^\/effort(?:\s+([\s\S]*))?$/i.exec(A):null;if(pe&&De){w.value="",await He(),ze(),await pe(((Je=De[1])==null?void 0:Je.trim())??"");return}b.value=!0,x.value="";try{if(Q){if(!e.createBranch)throw new Error(n("composer.branchUnavailable"));await e.createBranch(Q[1].trim())}else{const rt=F.value,ws=z.value,ks=L.value;await e.send(tl(A,rt),{images:ws.map(lt=>lt.block),pastes:ks.map(lt=>lt.text)}),F.value=F.value.filter(lt=>!rt.includes(lt)),z.value=z.value.filter(lt=>!ws.includes(lt)),L.value=L.value.filter(lt=>!ks.includes(lt))}w.value===A&&(w.value=""),await He(),ze()}catch(rt){x.value=rt instanceof Error?rt.message:String(rt)}finally{b.value=!1}}async function B(){var A;x.value="";try{await((A=e.stop)==null?void 0:A.call(e))}catch(Q){x.value=Q instanceof Error?Q.message:String(Q)}}async function ee(A){k.value=!0,x.value="";try{await e.selectModel(A)}catch(Q){x.value=Q instanceof Error?Q.message:String(Q)}finally{k.value=!1}}async function K(A){var Ie,te,pe,De,st,xt,gt,Ct;if(C.value)return;x.value="";const Q=A==="branch"||A==="goal"||A==="effort";if(w.value=Q?`/${A} `:"",await He(),ze(),Q)(Ie=g.value)==null||Ie.focus();else if(A==="models")(te=I.value)==null||te.open();else if(A==="lines")(pe=e.openLines)==null||pe.call(e);else if(A==="scheduled"){const Je=typeof o.params.sessionId=="string"?(De=l.byId.get(o.params.sessionId))==null?void 0:De.cwd:void 0;await i.push({name:"settings-scheduled",...Je===void 0?{}:{query:{cwd:Je}}})}else if(A==="new")try{const Je=typeof o.params.sessionId=="string"?(st=l.byId.get(o.params.sessionId))==null?void 0:st.cwd:void 0;await i.push({name:"chat-new",...Je===void 0?{}:{query:{cwd:Je}}})}catch(Je){x.value=Je instanceof Error?Je.message:String(Je)}else A==="permissions"?(xt=v.value)==null||xt.open():(A==="compact"||A==="usage"||A==="fork")&&await((Ct=(gt=e.sessionCommands)==null?void 0:gt[A])==null?void 0:Ct.call(gt))}function ie(A){if(!(A.isComposing||C.value||A.keyCode===229)){if(le.value&&$.value.length>0){if(A.key==="ArrowDown"||A.key==="ArrowUp"){A.preventDefault(),M.value=(M.value+(A.key==="ArrowDown"?1:-1)+$.value.length)%$.value.length;return}if(A.key==="Enter"&&!A.shiftKey&&!A.altKey||A.key==="Tab"){A.preventDefault(),y($.value[M.value]);return}}if(le.value&&A.key==="Escape"){A.preventDefault(),A.stopPropagation(),j.value=se.value;return}if(A.key==="Escape"&&w.value.startsWith("/")&&!X.value){A.preventDefault(),A.stopPropagation(),X.value=!0;return}if(Ze.value&&(A.key==="ArrowDown"||A.key==="ArrowUp")){A.preventDefault(),re.value=(re.value+(A.key==="ArrowDown"?1:-1)+ue.value.length)%ue.value.length;return}A.key==="Enter"&&!A.shiftKey&&!A.altKey&&(A.preventDefault(),q())}}async function Le(A){w.value=jl(w.value,A),await He(),ze();const Q=g.value;Q==null||Q.focus(),Q==null||Q.setSelectionRange(w.value.length,w.value.length)}return ot(()=>{var A;return(A=g.value)==null?void 0:A.focus()}),t({focus:()=>{var A;return(A=g.value)==null?void 0:A.focus()},quote:Le}),(A,Q)=>{const Ie=vt("tooltip");return d(),u("section",{class:"composer-panel","data-variant":s.variant??"main","aria-label":a(n)("chat.composer")},[x.value?(d(),u("p",Fl,m(x.value),1)):D("",!0),c("div",{class:"composer-surface",onClick:Q[9]||(Q[9]=Se(te=>{var pe;return(pe=g.value)==null?void 0:pe.focus()},["self"])),onDragover:Q[10]||(Q[10]=Se(()=>{},["prevent"])),onDrop:O},[z.value.length>0||L.value.length>0?(d(),u("div",Wl,[(d(!0),u(ne,null,he(z.value,te=>(d(),u("span",{key:te.id,class:"draft-chip"},[c("img",{src:te.url,alt:a(n)("composer.imageAttachment"),class:"draft-thumb"},null,8,Vl),c("button",{type:"button",class:"ui-icon-button","data-variant":"ghost","data-size":"xs","aria-label":a(n)("composer.removeAttachment"),onClick:pe=>Z(te.id)},[G(a(yt),{"aria-hidden":"true"})],8,Ul)]))),128)),(d(!0),u(ne,null,he(L.value,te=>(d(),u("span",{key:te.id,class:"draft-chip"},[c("span",null,m(a(n)("composer.pastedText",{lines:te.text.split(`
|
|
242
|
-
`).length})),1),c("button",{type:"button",class:"ui-icon-button","data-variant":"ghost","data-size":"xs","aria-label":a(n)("composer.removeAttachment"),onClick:pe=>p(te.id)},[G(a(yt),{"aria-hidden":"true"})],8,Hl)]))),128))])):D("",!0),Ze.value?(d(),u("div",{key:1,id:a(_),class:"command-menu ui-popover",role:"listbox","aria-label":a(n)("composer.commands")},[(d(!0),u(ne,null,he(ue.value,(te,pe)=>{var De;return d(),u("button",{id:`${a(_)}-${pe}`,key:te.name,type:"button",role:"option",class:"ui-menu-item command-item","aria-selected":pe===re.value,"data-highlighted":pe===re.value?"":void 0,onMousedown:Q[0]||(Q[0]=Se(()=>{},["prevent"])),onMouseenter:st=>re.value=pe,onClick:Se(st=>K(te.name),["stop"])},[c("span",Gl,m(pe===0||((De=ue.value[pe-1])==null?void 0:De.category)!==te.category?a(n)(`composer.category.${te.category}`):""),1),c("span",Jl,[be("/"+m(te.name),1),te.name==="branch"?(d(),u("span",Yl," <prompt>")):te.name==="goal"||te.name==="effort"?(d(),u("span",Xl," [args]")):D("",!0)]),c("span",Zl,m(a(n)(`composer.command.${te.name}`)),1)],40,Ql)}),128)),c("p",ed,m(a(n)("composer.commandKeys")),1)],8,Kl)):D("",!0),ge.value?(d(),u("div",{key:2,id:a(J),class:"command-menu ui-popover",role:"listbox","aria-label":a(n)("composer.files")},[(d(!0),u(ne,null,he($.value,(te,pe)=>(d(),u("button",{key:te.absolutePath,type:"button",role:"option",class:"ui-menu-item command-item","aria-selected":pe===M.value,"data-highlighted":pe===M.value?"":void 0,onMousedown:Q[1]||(Q[1]=Se(()=>{},["prevent"])),onMouseenter:De=>M.value=pe,onClick:Se(De=>y(te),["stop"])},[c("span",nd,[be(m(te.relativePath),1),te.dir?(d(),u(ne,{key:0},[be("/")],64)):D("",!0)])],40,sd))),128)),c("p",od,m(a(n)("composer.mentionKeys")),1)],8,td)):D("",!0),Ne(c("textarea",{ref_key:"field",ref:g,"onUpdate:modelValue":Q[2]||(Q[2]=te=>w.value=te),class:"composer-input",rows:"2",placeholder:s.placeholder??a(n)("composer.sendMessage"),"aria-label":s.placeholder??a(n)("composer.sendMessage"),"aria-controls":Ze.value?a(_):ge.value?a(J):void 0,"aria-expanded":Ze.value||ge.value,"aria-activedescendant":Ze.value?`${a(_)}-${re.value}`:void 0,onInput:Q[3]||(Q[3]=te=>{ze(),f()}),onKeydown:ie,onKeyup:f,onClick:f,onPaste:ht,onFocus:Q[4]||(Q[4]=te=>Y.value=!0),onBlur:Q[5]||(Q[5]=te=>Y.value=!1),onCompositionstart:Q[6]||(Q[6]=te=>C.value=!0),onCompositionend:Q[7]||(Q[7]=te=>C.value=!1)},null,40,id),[[At,w.value]]),c("footer",ad,[c("div",rd,[s.permission&&s.variant!=="panel"?(d(),ae(Nl,{key:0,ref_key:"permissionMenu",ref:v,policy:s.permission.policy,onSelect:s.permission.select},null,8,["policy","onSelect"])):D("",!0)]),c("div",ld,[s.variant!=="panel"?(d(),ae(Il,{key:0,ref_key:"modelMenu",ref:I,model:s.model,selectable:s.modelSelectable,disabled:k.value,onSelect:ee},null,8,["model","selectable","disabled"])):D("",!0),Ne((d(),u("button",{class:"ui-icon-button","data-variant":Ge.value?"contrast":"primary","data-size":"sm",type:"button","aria-label":Ge.value?a(n)("composer.stopResponse"):a(n)("composer.send"),disabled:Ge.value?s.stopping:!tt.value,onClick:Q[8]||(Q[8]=Se(te=>Ge.value?B():q(),["stop"]))},[Ge.value?(d(),ae(a(yo),{key:0,fill:"currentColor","aria-hidden":"true"})):(d(),ae(a(to),{key:1,"stroke-width":2.25,"aria-hidden":"true"}))],8,dd)),[[Ie,Ge.value?a(n)("composer.stopResponse"):a(n)("composer.send")]])])])],32),A.$slots.status?(d(),u("div",cd,[c("div",ud,[Fn(A.$slots,"status",{},void 0,!0)])])):D("",!0)],8,Bl)}}}),fs=Ae(vd,[["__scopeId","data-v-3d5c7eee"]]),fd={class:"prompt-card question-card","data-inline-interaction-prompt":""},gd={class:"prompt-header"},bd={class:"prompt-icon","aria-hidden":"true"},yd={class:"prompt-title"},wd={class:"ui-badge","data-tone":"warning"},kd=["aria-label"],_d=["aria-current","disabled","onClick"],Id={key:0,"aria-hidden":"true"},$d=["aria-current","disabled"],xd=["aria-label"],Cd=["disabled"],Sd={key:0,class:"question-header"},Ed={key:1,class:"question-hint"},Md=["type","name","checked","onChange"],Td={class:"question-option-text"},qd={key:0,class:"question-option-description"},Ad=["value","placeholder","aria-label"],Ld={key:1,class:"question-review"},Od=["disabled","aria-label","onClick"],Rd={key:0,class:"prompt-error",role:"alert"},Pd={class:"prompt-buttons"},zd=["disabled"],Dd=["disabled"],Nd=["disabled"],jd=["disabled"],Bd=ke({__name:"QuestionPrompt",props:{sessionId:{},question:{}},setup(s){const t=s,{t:e}=ye(),n=Qe(),o=R(!1),i=R(!1),r=R(""),l=Is({}),h=Is({}),g=R(0),I=R(),v=E(()=>t.question.questions[g.value]),_=E(()=>t.question.questions.length>1),w=$=>`question-${t.question.callId}-${$.id}`;function b($){const M=(h[$.id]??"").trim();return $.allowCustom&&M!==""?M:void 0}function k($){var M;return(((M=l[$.id])==null?void 0:M.length)??0)>0||b($)!==void 0}const x=E(()=>t.question.questions.every(k));async function C($){var M,T;g.value=$,await He(),(M=I.value)==null||M.scrollTo({top:0}),(T=I.value)==null||T.focus()}function Y(){o.value||i.value||(v.value&&_.value?k(v.value)&&C(g.value+1):j(!1))}function X($,M){const T=l[$.id]??[];$.multiSelect?l[$.id]=T.includes(M)?T.filter(W=>W!==M):[...T,M]:(l[$.id]=[M],h[$.id]="")}function F($,M){h[$.id]=M,!$.multiSelect&&M.trim()!==""&&(l[$.id]=[])}function P(){return t.question.questions.map($=>{const M=b($);return{questionId:$.id,selected:l[$.id]??[],...M===void 0?{}:{custom:M}}})}async function j($){if(!(o.value||i.value||!$&&!x.value)){o.value=!0,r.value="";try{await n.answerQuestion(t.sessionId,t.question,$?void 0:P()),i.value=!0}catch(M){r.value=M instanceof ct&&M.appError==="question_not_pending"?e("question.notPending"):M instanceof Error&&M.message?M.message:e("question.failed")}finally{o.value=!1}}}return($,M)=>(d(),u("article",fd,[c("header",gd,[c("span",bd,[G(a(so),{size:12,"stroke-width":2.25})]),c("h2",yd,m(a(e)("question.title")),1),c("span",wd,m(i.value?a(e)("question.sent"):a(e)("question.awaitingAnswer")),1)]),_.value?(d(),u("nav",{key:0,class:"question-steps","aria-label":a(e)("question.steps")},[(d(!0),u(ne,null,he(t.question.questions,(T,W)=>(d(),u("button",{key:T.id,type:"button",class:"ui-button","data-size":"sm","data-variant":"ghost","aria-current":g.value===W?"step":void 0,disabled:o.value||i.value,onClick:se=>C(W)},[be(m(W+1)+". "+m(T.header||a(e)("question.number",{number:W+1})),1),k(T)?(d(),u("span",Id," ✓")):D("",!0)],8,_d))),128)),c("button",{type:"button",class:"ui-button","data-size":"sm","data-variant":"ghost","aria-current":v.value?void 0:"step",disabled:o.value||i.value,onClick:M[0]||(M[0]=T=>C(t.question.questions.length))},m(a(e)("question.review")),9,$d)],8,kd)):D("",!0),c("form",{class:"question-form",onSubmit:Se(Y,["prevent"])},[c("div",{ref_key:"body",ref:I,class:"question-body",tabindex:"-1","aria-label":v.value?v.value.question:a(e)("question.review")},[v.value?(d(),u("fieldset",{key:v.value.id,class:"question-item",disabled:o.value||i.value},[c("legend",null,[v.value.header?(d(),u("span",Sd,m(v.value.header),1)):D("",!0),be(" "+m(v.value.question)+" ",1),v.value.multiSelect?(d(),u("small",Ed,m(a(e)("question.selectMany")),1)):D("",!0)]),(d(!0),u(ne,null,he(v.value.options,T=>(d(),u("label",{key:T.label,class:"question-option"},[c("input",{type:v.value.multiSelect?"checkbox":"radio",name:w(v.value),checked:(l[v.value.id]??[]).includes(T.label),onChange:W=>X(v.value,T.label)},null,40,Md),c("span",Td,[c("span",null,m(T.label),1),T.description?(d(),u("small",qd,m(T.description),1)):D("",!0)])]))),128)),v.value.allowCustom?(d(),u("input",{key:0,class:"ui-field question-other","data-size":"md",type:"text",value:h[v.value.id]??"",placeholder:a(e)("question.otherPlaceholder"),"aria-label":a(e)("question.other"),onInput:M[1]||(M[1]=T=>F(v.value,T.target.value))},null,40,Ad)):D("",!0)],8,Cd)):(d(),u("ol",Ld,[(d(!0),u(ne,null,he(t.question.questions,(T,W)=>(d(),u("li",{key:T.id},[c("strong",null,m(T.question),1),c("p",null,m([...l[T.id]??[],...b(T)?[b(T)]:[]].join(", ")||a(e)("question.unanswered")),1),c("button",{type:"button",class:"ui-button","data-size":"sm","data-variant":"ghost",disabled:o.value||i.value,"aria-label":a(e)("question.editAnswer",{question:T.question}),onClick:se=>C(W)},m(a(e)("question.edit")),9,Od)]))),128))]))],8,xd),r.value?(d(),u("p",Rd,m(r.value),1)):D("",!0),c("div",Pd,[c("button",{type:"button",class:"ui-button question-decline","data-size":"md","data-variant":"ghost",disabled:o.value||i.value,onClick:M[2]||(M[2]=T=>j(!0))},m(a(e)("question.decline")),9,zd),_.value&&g.value>0?(d(),u("button",{key:0,type:"button",class:"ui-button","data-size":"md","data-variant":"secondary",disabled:o.value||i.value,onClick:M[3]||(M[3]=T=>C(g.value-1))},m(a(e)("question.previous")),9,Dd)):D("",!0),_.value&&v.value?(d(),u("button",{key:1,type:"submit",class:"ui-button","data-size":"md","data-variant":"primary",disabled:o.value||i.value||!k(v.value)},m(g.value===t.question.questions.length-1?a(e)("question.review"):a(e)("question.next")),9,Nd)):(d(),u("button",{key:2,type:"submit",class:"ui-button","data-size":"md","data-variant":"primary",disabled:o.value||i.value||!x.value},m(a(e)("question.submit")),9,jd))])],32)]))}}),qn=Ae(Bd,[["__scopeId","data-v-d6970f39"]]);function kt(s,t,e){let n=e.initialDeps??[],o,i=!0;function r(){var l,h,g;let I;e.key&&((l=e.debug)!=null&&l.call(e))&&(I=Date.now());const v=s();if(!(v.length!==n.length||v.some((b,k)=>n[k]!==b)))return o;n=v;let w;if(e.key&&((h=e.debug)!=null&&h.call(e))&&(w=Date.now()),o=t(...v),e.key&&((g=e.debug)!=null&&g.call(e))){const b=Math.round((Date.now()-I)*100)/100,k=Math.round((Date.now()-w)*100)/100,x=k/16,C=(Y,X)=>{for(Y=String(Y);Y.length<X;)Y=" "+Y;return Y};console.info(`%c⏱ ${C(k,5)} /${C(b,5)} ms`,`
|
|
243
|
-
font-size: .6rem;
|
|
244
|
-
font-weight: bold;
|
|
245
|
-
color: hsl(${Math.max(0,Math.min(120-120*x,120))}deg 100% 31%);`,e==null?void 0:e.key)}return e!=null&&e.onChange&&!(i&&e.skipInitialOnChange)&&e.onChange(o),i=!1,o}return r.updateDeps=l=>{n=l},r}function Vs(s,t){if(s===void 0)throw new Error("Unexpected undefined");return s}const Fd=(s,t)=>Math.abs(s-t)<1.01,Wd=(s,t,e)=>{let n;return function(...o){s.clearTimeout(n),n=s.setTimeout(()=>t.apply(this,o),e)}},Us=s=>{const{offsetWidth:t,offsetHeight:e}=s;return{width:t,height:e}},Vd=s=>s,Ud=s=>{const t=Math.max(s.startIndex-s.overscan,0),e=Math.min(s.endIndex+s.overscan,s.count-1),n=[];for(let o=t;o<=e;o++)n.push(o);return n},Hd=(s,t)=>{const e=s.scrollElement;if(!e)return;const n=s.targetWindow;if(!n)return;const o=r=>{const{width:l,height:h}=r;t({width:Math.round(l),height:Math.round(h)})};if(o(Us(e)),!n.ResizeObserver)return()=>{};const i=new n.ResizeObserver(r=>{const l=()=>{const h=r[0];if(h!=null&&h.borderBoxSize){const g=h.borderBoxSize[0];if(g){o({width:g.inlineSize,height:g.blockSize});return}}o(Us(e))};s.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return i.observe(e,{box:"border-box"}),()=>{i.unobserve(e)}},Hs={passive:!0},Ks=typeof window>"u"?!0:"onscrollend"in window,Kd=(s,t)=>{const e=s.scrollElement;if(!e)return;const n=s.targetWindow;if(!n)return;let o=0;const i=s.options.useScrollendEvent&&Ks?()=>{}:Wd(n,()=>{t(o,!1)},s.options.isScrollingResetDelay),r=I=>()=>{const{horizontal:v,isRtl:_}=s.options;o=v?e.scrollLeft*(_&&-1||1):e.scrollTop,i(),t(o,I)},l=r(!0),h=r(!1);e.addEventListener("scroll",l,Hs);const g=s.options.useScrollendEvent&&Ks;return g&&e.addEventListener("scrollend",h,Hs),()=>{e.removeEventListener("scroll",l),g&&e.removeEventListener("scrollend",h)}},Qd=(s,t,e)=>{if(t!=null&&t.borderBoxSize){const n=t.borderBoxSize[0];if(n)return Math.round(n[e.options.horizontal?"inlineSize":"blockSize"])}return s[e.options.horizontal?"offsetWidth":"offsetHeight"]},Gd=(s,{adjustments:t=0,behavior:e},n)=>{var o,i;const r=s+t;(i=(o=n.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[n.options.horizontal?"left":"top"]:r,behavior:e})};class Jd{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var e,n,o;return((o=(n=(e=this.targetWindow)==null?void 0:e.performance)==null?void 0:n.now)==null?void 0:o.call(n))??Date.now()},this.observer=(()=>{let e=null;const n=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(o=>{o.forEach(i=>{const r=()=>{const l=i.target,h=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l),this.elementsCache.delete(this.options.getItemKey(h));return}this.shouldMeasureDuringScroll(h)&&this.resizeItem(h,this.options.measureElement(l,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var o;(o=n())==null||o.disconnect(),e=null},observe:o=>{var i;return(i=n())==null?void 0:i.observe(o,{box:"border-box"})},unobserve:o=>{var i;return(i=n())==null?void 0:i.unobserve(o)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([n,o])=>{typeof o>"u"&&delete e[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Vd,rangeExtractor:Ud,onChange:()=>{},measureElement:Qd,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var n,o;(o=(n=this.options).onChange)==null||o.call(n,this,e)},this.maybeNotify=kt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=i,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,n)=>{const o=new Map,i=new Map;for(let r=n-1;r>=0;r--){const l=e[r];if(o.has(l.lane))continue;const h=i.get(l.lane);if(h==null||l.end>h.end?i.set(l.lane,l):l.end<h.end&&o.set(l.lane,!0),o.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((r,l)=>r.end===l.end?r.index-l.index:r.end-l.end)[0]:void 0},this.getMeasurementOptions=kt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,n,o,i,r,l)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:n,scrollMargin:o,getItemKey:i,enabled:r,lanes:l}),{key:!1}),this.getMeasurements=kt(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:n,scrollMargin:o,getItemKey:i,enabled:r,lanes:l},h)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const _ of this.laneAssignments.keys())_>=e&&this.laneAssignments.delete(_);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(_=>{this.itemSizeCache.set(_.key,_.size)}));const g=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);const I=this.measurementsCache.slice(0,g),v=new Array(l).fill(void 0);for(let _=0;_<g;_++){const w=I[_];w&&(v[w.lane]=_)}for(let _=g;_<e;_++){const w=i(_),b=this.laneAssignments.get(_);let k,x;if(b!==void 0&&this.options.lanes>1){k=b;const F=v[k],P=F!==void 0?I[F]:void 0;x=P?P.end+this.options.gap:n+o}else{const F=this.options.lanes===1?I[_-1]:this.getFurthestMeasurement(I,_);x=F?F.end+this.options.gap:n+o,k=F?F.lane:_%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(_,k)}const C=h.get(w),Y=typeof C=="number"?C:this.options.estimateSize(_),X=x+Y;I[_]={index:_,start:x,size:Y,end:X,key:w,lane:k},v[k]=_}return this.measurementsCache=I,I},{key:!1,debug:()=>this.options.debug}),this.calculateRange=kt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,n,o,i)=>this.range=e.length>0&&n>0?Yd({measurements:e,outerSize:n,scrollOffset:o,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=kt(()=>{let e=null,n=null;const o=this.calculateRange();return o&&(e=o.startIndex,n=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,n]},(e,n,o,i,r)=>i===null||r===null?[]:e({startIndex:i,endIndex:r,overscan:n,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const n=this.options.indexAttribute,o=e.getAttribute(n);return o?parseInt(o,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(o!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,o-i),l=Math.min(this.options.count-1,o+i);return e>=r&&e<=l}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((r,l)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(l))});return}const n=this.indexFromElement(e),o=this.options.getItemKey(n),i=this.elementsCache.get(o);i!==e&&(i&&this.observer.unobserve(i),this.observer.observe(e),this.elementsCache.set(o,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,n)=>{var o;const i=this.measurementsCache[e];if(!i)return;const r=this.itemSizeCache.get(i.key)??i.size,l=n-r;l!==0&&(((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,l,this):i.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=l,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(i.index),this.itemSizeCache=new Map(this.itemSizeCache.set(i.key,n)),this.notify(!1))},this.getVirtualItems=kt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,n)=>{const o=[];for(let i=0,r=e.length;i<r;i++){const l=e[i],h=n[l];o.push(h)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const n=this.getMeasurements();if(n.length!==0)return Vs(n[An(0,n.length-1,o=>Vs(n[o]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,n,o=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),r=this.getScrollOffset();n==="auto"&&(n=e>=r+i?"end":"start"),n==="center"?e+=(o-i)/2:n==="end"&&(e-=i);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,e),0)},this.getOffsetForIndex=(e,n="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const o=this.getSize(),i=this.getScrollOffset(),r=this.measurementsCache[e];if(!r)return;if(n==="auto")if(r.end>=i+o-this.options.scrollPaddingEnd)n="end";else if(r.start<=i+this.options.scrollPaddingStart)n="start";else return[i,n];if(n==="end"&&e===this.options.count-1)return[this.getMaxScrollOffset(),n];const l=n==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,n,r.size),n]},this.scrollToOffset=(e,{align:n="start",behavior:o="auto"}={})=>{const i=this.getOffsetForAlignment(e,n),r=this.now();this.scrollState={index:null,align:n,behavior:o,startedAt:r,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:n="auto",behavior:o="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));const i=this.getOffsetForIndex(e,n);if(!i)return;const[r,l]=i,h=this.now();this.scrollState={index:e,align:l,behavior:o,startedAt:h,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:n="auto"}={})=>{const o=this.getScrollOffset()+e,i=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:i,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var e;const n=this.getMeasurements();let o;if(n.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((e=n[n.length-1])==null?void 0:e.end)??0;else{const i=Array(this.options.lanes).fill(null);let r=n.length-1;for(;r>=0&&i.some(l=>l===null);){const l=n[r];i[l.lane]===null&&(i[l.lane]=l.end),r--}o=Math.max(...i.filter(l=>l!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:n,behavior:o})=>{this.options.scrollToFn(e,{behavior:o,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=n?n[0]:this.scrollState.lastTargetOffset,i=1,r=o!==this.scrollState.lastTargetOffset;if(!r&&Fd(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.scrollState=null;return}}else this.scrollState.stableFrames=0,r&&(this.scrollState.lastTargetOffset=o,this.scrollState.behavior="auto",this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const An=(s,t,e,n)=>{for(;s<=t;){const o=(s+t)/2|0,i=e(o);if(i<n)s=o+1;else if(i>n)t=o-1;else return o}return s>0?s-1:0};function Yd({measurements:s,outerSize:t,scrollOffset:e,lanes:n}){const o=s.length-1,i=h=>s[h].start;if(s.length<=n)return{startIndex:0,endIndex:o};let r=An(0,o,i,e),l=r;if(n===1)for(;l<o&&s[l].end<e+t;)l++;else if(n>1){const h=Array(n).fill(0);for(;l<o&&h.some(I=>I<e+t);){const I=s[l];h[I.lane]=I.end,l++}const g=Array(n).fill(e+t);for(;r>=0&&g.some(I=>I>=e);){const I=s[r];g[I.lane]=I.start,r--}r=Math.max(0,r-r%n),l=Math.min(o,l+(n-1-l%n))}return{startIndex:r,endIndex:l}}function Xd(s){const t=new Jd(a(s)),e=Bt(t),n=t._didMount();return $e(()=>a(s).getScrollElement(),o=>{o&&t._willUpdate()},{immediate:!0}),$e(()=>a(s),o=>{t.setOptions({...o,onChange:(i,r)=>{var l;$s(e),(l=o.onChange)==null||l.call(o,i,r)}}),t._willUpdate(),$s(e)},{immediate:!0}),Wn(n),e}function Zd(s){return Xd(E(()=>({observeElementRect:Hd,observeElementOffset:Kd,scrollToFn:Gd,...a(s)})))}async function gs(s){if(window.isSecureContext)return navigator.clipboard.writeText(s);const t=document.activeElement instanceof HTMLElement?document.activeElement:null,e=document.createElement("textarea");e.value=s,e.setAttribute("readonly",""),e.style.cssText="position:fixed;top:0;left:-9999px;font-size:16px;opacity:0",document.body.append(e),e.select(),e.setSelectionRange(0,s.length);const n=document.execCommand("copy");if(e.remove(),t==null||t.focus({preventScroll:!0}),!n)throw new Error("Copy to clipboard failed")}let ec;function Ln(){return ec??(ec=Ee(async()=>{const{default:s}=await import("./index-lSaCQ5HQ.js").then(t=>t.a4);return{default:s}},__vite__mapDeps([0,1])).then(({default:s})=>s))}const tc=/^[a-z][a-z\d+.-]*:/i;function Qs(s){try{return decodeURIComponent(s)}catch{return s}}function sc(s){if(!(s===""||s.startsWith("#"))){if(s.startsWith("file:"))return Qs(s.replace(/^file:(\/\/)?/,""));if(!tc.test(s))return Qs(s.split(/[?#]/)[0]??s)}}const nc={key:1,class:"chat-markdown chat-markdown--pending"};let Xt;const oc=ke({__name:"ChatMarkdown",props:{content:{},final:{type:Boolean},messageId:{}},setup(s){const{t}=ye(),e=$t(),n={fontSize:13,lineHeight:20},o=Bt(Xt),i=R(!1);let r;function l(){i.value=document.documentElement.dataset.theme==="dark"||document.documentElement.classList.contains("dark")}ot(async()=>{l(),r=new MutationObserver(l),r.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"]}),Xt??(Xt=await Ln()),o.value=Xt}),it(()=>r==null?void 0:r.disconnect());async function h(g){const I=g.target instanceof Element?g.target.closest("a[href]"):null,v=I===null?void 0:sc(I.getAttribute("href")??"");if(v!==void 0){g.preventDefault();try{await gs(v),e.push({tone:"success",title:t("chat.pathCopied"),description:v})}catch{e.push({tone:"danger",title:t("chat.copyFailed")})}}}return(g,I)=>o.value?(d(),ae(is(o.value),{key:0,class:je(["chat-markdown",{dark:i.value}]),content:s.content,final:s.final,"index-key":s.messageId,"is-dark":i.value,"code-block-options":n,"html-policy":"escape",mode:"chat","node-virtual":!1,onClick:h},null,8,["class","content","final","index-key","is-dark"])):(d(),u("div",nc,m(s.content),1))}}),ic={class:"user-message","data-role":"user"},ac={class:"sr-only"},rc={class:"user-bubble"},lc=["aria-expanded"],dc={key:0,class:"user-skills"},cc={class:"user-actions"},uc={class:"user-sent-time timestamp"},pc=["aria-label"],hc=["aria-label"],mc=["aria-label"],vc=ke({__name:"TimelineUserMessage",props:{text:{},skills:{},at:{},quotable:{type:Boolean},branchable:{type:Boolean}},emits:["quote","branch"],setup(s,{emit:t}){const e=s,n=t,{t:o,locale:i}=ye(),r=R(),l=R(!1),h=R(!1),g=R(!1);let I;const v=E(()=>da(new Date(e.at),i.value));ot(async()=>{var w;await He(),l.value=(((w=r.value)==null?void 0:w.scrollHeight)??0)>300}),it(()=>clearTimeout(I));async function _(){await gs(e.text),g.value=!0,clearTimeout(I),I=setTimeout(()=>{g.value=!1},1500)}return(w,b)=>{var x;const k=vt("tooltip");return d(),u("article",ic,[c("strong",ac,m(a(o)("chat.you")),1),c("div",rc,[c("div",{ref_key:"content",ref:r,class:je(["user-bubble-content",{"is-clipped":l.value&&!h.value}])},m(s.text),3),l.value?(d(),u("button",{key:0,type:"button",class:"ui-button user-bubble-expand","data-variant":"ghost","data-size":"xs","aria-expanded":h.value,onClick:b[0]||(b[0]=C=>h.value=!h.value)},[G(a(as),{"aria-hidden":"true",class:je({"is-expanded":h.value})},null,8,["class"]),c("span",null,m(h.value?a(o)("message.collapse"):a(o)("message.expand")),1)],8,lc)):D("",!0)]),(x=s.skills)!=null&&x.length?(d(),u("div",dc,[(d(!0),u(ne,null,he(s.skills,C=>(d(),u("div",{key:C,class:"user-skill"},m(a(o)("message.skillLoaded",{name:C})),1))),128))])):D("",!0),c("div",cc,[c("span",uc,m(v.value),1),Ne((d(),u("button",{class:"ui-icon-button","data-variant":"ghost","data-size":"sm",type:"button","aria-label":a(o)("message.copy"),onClick:_},[g.value?(d(),ae(a(It),{key:0,class:"is-copied","aria-hidden":"true"})):(d(),ae(a(sn),{key:1,"aria-hidden":"true"}))],8,pc)),[[k,a(o)("message.copy")]]),s.branchable?Ne((d(),u("button",{key:0,class:"ui-icon-button","data-variant":"ghost","data-size":"sm",type:"button","aria-label":a(o)("message.branch"),onClick:b[1]||(b[1]=C=>n("branch",s.text))},[G(a(ft),{"aria-hidden":"true"})],8,hc)),[[k,a(o)("message.branch")]]):D("",!0),s.quotable?Ne((d(),u("button",{key:1,class:"ui-icon-button","data-variant":"ghost","data-size":"sm",type:"button","aria-label":a(o)("message.quote"),onClick:b[2]||(b[2]=C=>n("quote",s.text))},[G(a(vo),{"aria-hidden":"true"})],8,mc)),[[k,a(o)("message.quote")]]):D("",!0)])])}}}),fc=Ae(vc,[["__scopeId","data-v-b6ed74f8"]]),gc={class:"timeline-work-item"},bc=["aria-expanded"],yc=["title"],wc={key:0},kc={key:1,class:"timeline-work-item-summary"},_c={class:"timeline-work-stat","data-tone":"success"},Ic={key:0,class:"timeline-work-stat","data-tone":"danger"},$c={key:0,class:"timeline-work-item-details"},xc={key:0,class:"timeline-thinking-quote"},Cc={key:1,class:"tool-panel"},Sc={class:"tool-panel-label"},Ec=["title"],Mc=["onClick"],Tc={key:0,class:"tool-panel-code"},qc={class:"is-strong"},Ac={key:0,class:"is-faint"},Lc={key:1,class:"tool-panel-code"},Oc={class:"is-strong"},Rc={key:0,class:"is-faint"},Pc={key:2,class:"tool-panel-diff"},zc=["data-sign"],Dc={class:"tool-panel-sign","aria-hidden":"true"},Nc={key:3,class:"tool-panel-lines"},jc={class:"tool-panel-line-number","aria-hidden":"true"},Bc={class:"tool-panel-line"},Gs=2e4,Fc=ke({__name:"TimelineWorkItem",props:{item:{},expanded:{type:Boolean}},emits:["toggle"],setup(s,{emit:t}){const e=s,n=t,{t:o}=ye(),i=E(()=>e.item.kind==="tool"?e.item:void 0),r=E(()=>i.value===void 0?void 0:vs(i.value.name,i.value.input)),l=E(()=>{const $=r.value;return $===void 0||i.value===void 0?"":$.renderer==="generic"?i.value.name:o($.labelKey)}),h=E(()=>e.item.kind!=="thinking"?"":e.item.running?o("work.thinking"):o("work.thoughtFor",{duration:e.item.durationMs===void 0?"…":ua(e.item.durationMs)})),g=E(()=>e.item.kind==="thinking"?e.item.content.trim():"");function I($){return $.length<=Gs?$:`${$.slice(0,Gs)}…`}function v($){var T;const M=(T=i.value)==null?void 0:T.input[$];return typeof M=="string"&&M!==""?M:void 0}const _=E(()=>{var $,M;return I((((M=($=i.value)==null?void 0:$.result)==null?void 0:M.text)??"").replace(/\s+$/u,""))}),w=E(()=>{var $;return(($=i.value)==null?void 0:$.status)==="error"}),b=E(()=>{var $;return(($=i.value)==null?void 0:$.name.trim().toLowerCase())??""}),k=E(()=>{var $,M,T;return b.value==="edit"?Sn((($=i.value)==null?void 0:$.input)??{},(T=(M=i.value)==null?void 0:M.result)==null?void 0:T.diff):[]}),x=E(()=>b.value==="write"?I(v("content")??""):""),C=E(()=>{if(k.value.length>0)return{added:k.value.filter($=>$.sign==="+").length,removed:k.value.filter($=>$.sign==="-").length};if(x.value!=="")return{added:x.value.split(`
|
|
246
|
-
`).length,removed:0}}),Y=E(()=>{const $=i.value;if($===void 0||r.value===void 0)return[];const M=_.value?[{id:"output",label:o("detail.output"),copy:_.value,body:"pre"}]:[];switch(r.value.renderer){case"command":{const T=v("command");return[...T===void 0?[]:[{id:"input",label:o("prompt.input"),copy:T,body:"command"}],...M]}case"search":{const T=v("pattern")??v("path");return[...T===void 0?[]:[{id:"input",label:o("prompt.input"),copy:T,body:"search"}],...M]}case"file":{const T=v("path")??$.name;return k.value.length>0?[{id:"file",label:T,copy:k.value.map(W=>`${W.sign}${W.text}`).join(`
|
|
247
|
-
`),body:"diff"},...w.value?M:[]]:x.value!==""?[{id:"file",label:T,copy:x.value,body:"lines"},...w.value?M:[]]:w.value?M:[]}default:{const T=Object.keys($.input).length===0?"":I(JSON.stringify($.input,null,2));return[...T?[{id:"input",label:o("prompt.input"),copy:T,body:"pre"}]:[],...M]}}}),X=E(()=>e.item.kind==="thinking"?g.value!=="":Y.value.length>0),F=R();let P;it(()=>clearTimeout(P));async function j($){await gs($.copy),F.value=$.id,clearTimeout(P),P=setTimeout(()=>{F.value=void 0},1500)}return($,M)=>(d(),u("div",gc,[c("button",{type:"button",class:je(["timeline-work-item-toggle",{"is-running":s.item.kind==="thinking"?s.item.running:s.item.status==="running","is-error":w.value,"is-static":!X.value}]),"aria-expanded":X.value?s.expanded:void 0,onClick:M[0]||(M[0]=T=>X.value&&n("toggle"))},[G(a(Dt),{size:14,"aria-hidden":"true",class:je({"is-expanded":s.expanded&&X.value})},null,8,["class"]),i.value?(d(),u("span",{key:0,class:"timeline-work-item-summary",title:[l.value,i.value.primary].filter(Boolean).join(" ")},[c("span",null,m(l.value),1),i.value.primary?(d(),u("small",wc,m(i.value.primary),1)):D("",!0)],8,yc)):(d(),u("span",kc,[c("span",null,m(h.value),1)])),C.value?(d(),u(ne,{key:2},[c("span",_c,"+"+m(C.value.added),1),C.value.removed?(d(),u("span",Ic,"−"+m(C.value.removed),1)):D("",!0)],64)):D("",!0)],10,bc),s.expanded&&X.value?(d(),u("div",$c,[s.item.kind==="thinking"?(d(),u("div",xc,m(g.value),1)):(d(),u("div",Cc,[(d(!0),u(ne,null,he(Y.value,T=>(d(),u(ne,{key:T.id},[c("div",Sc,[c("span",{title:T.label},m(T.label),9,Ec),c("button",{type:"button",class:"ui-button","data-variant":"ghost","data-size":"xs",onClick:W=>j(T)},[F.value===T.id?(d(),ae(a(It),{key:0,"aria-hidden":"true"})):(d(),ae(a(sn),{key:1,"aria-hidden":"true"})),be(m(a(o)(F.value===T.id?"timeline.copied":"timeline.copy")),1)],8,Mc)]),T.body==="command"?(d(),u("div",Tc,[c("div",qc,[M[1]||(M[1]=c("span",{class:"is-muted"},"$",-1)),be(" "+m(T.copy),1)]),v("cwd")?(d(),u("div",Ac," cwd: "+m(v("cwd")),1)):D("",!0)])):T.body==="search"?(d(),u("div",Lc,[c("div",Oc,m(T.copy),1),v("pattern")&&v("path")?(d(),u("div",Rc," path: "+m(v("path")),1)):D("",!0)])):T.body==="diff"?(d(),u("div",Pc,[(d(!0),u(ne,null,he(k.value,(W,se)=>(d(),u("div",{key:se,class:"tool-panel-diff-line","data-sign":W.sign},[c("span",Dc,m(W.sign),1),be(m(W.text),1)],8,zc))),128))])):T.body==="lines"?(d(),u("div",Nc,[(d(!0),u(ne,null,he(x.value.split(`
|
|
248
|
-
`),(W,se)=>(d(),u(ne,{key:se},[c("span",jc,m(se+1),1),c("span",Bc,m(W),1)],64))),128))])):(d(),u("pre",{key:4,class:je(["tool-panel-pre",{"is-error":w.value&&T.id==="output"}])},m(T.copy),3))],64))),128))]))])):D("",!0)]))}}),Js=Ae(Fc,[["__scopeId","data-v-e3447865"]]),Wc={class:"timeline-work-row"},Vc=["aria-expanded"],Uc={key:0,class:"timeline-work-group-content"},Hc=ke({__name:"TimelineWorkRow",props:{items:{},expanded:{type:Boolean},expandedItemIds:{}},emits:["toggle","toggleItem"],setup(s,{emit:t}){const e=s,n=t,{t:o}=ye(),i={read:"work.read",edit:"work.edit",command:"work.command",search:"work.search",web_search:"work.webSearch",web_fetch:"work.webFetch",unknown:"work.unknown"},r=Object.keys(i),l=E(()=>{let g="",I;const v=e.items.filter(w=>w.kind==="thinking").length;v>0&&(g=o("work.thinkingSteps",{count:v},v),I="thinking");const _=new Map;for(const w of e.items)w.kind==="tool"&&_.set(w.category,(_.get(w.category)??0)+1);for(const w of r){const b=_.get(w);b!==void 0&&(I!==void 0&&(g+=o(I==="thinking"?"work.separator":"work.actionSeparator")),g+=o(i[w],{count:b},b),I=w)}return g}),h=E(()=>e.items.some(g=>g.kind==="thinking"?g.running:g.status==="running"));return(g,I)=>(d(),u("div",Wc,[s.items.length>1?(d(),u(ne,{key:0},[c("button",{type:"button",class:je(["timeline-work-group-toggle",{"is-running":h.value}]),"aria-expanded":s.expanded,onClick:I[0]||(I[0]=v=>n("toggle"))},[G(a(Dt),{size:14,"aria-hidden":"true",class:je({"is-expanded":s.expanded})},null,8,["class"]),c("span",null,m(l.value),1)],10,Vc),s.expanded?(d(),u("div",Uc,[(d(!0),u(ne,null,he(s.items,v=>(d(),ae(Js,{key:v.id,item:v,expanded:s.expandedItemIds[v.id]===!0,onToggle:_=>n("toggleItem",v.id)},null,8,["item","expanded","onToggle"]))),128))])):D("",!0)],64)):s.items[0]?(d(),ae(Js,{key:1,item:s.items[0],expanded:s.expandedItemIds[s.items[0].id]===!0,onToggle:I[1]||(I[1]=v=>n("toggleItem",s.items[0].id))},null,8,["item","expanded"])):D("",!0)]))}});function Kc(s){var o;const t=[];let e=[];const n=()=>{e.length>0&&t.push({key:`work-${e[0].id}`,kind:"work",items:e}),e=[]};for(const i of s)if(i.kind==="thinking"){if(i.text===""&&!i.streaming)continue;e.push({id:i.key,kind:"thinking",content:i.text,running:i.streaming,...i.elapsedMs===void 0?{}:{durationMs:i.elapsedMs}})}else if(i.kind==="tool"){const r=Qc(i.name,i.input),l=Gc(r,i.input);e.push({id:i.key,kind:"tool",name:i.name,category:r,...l===void 0?{}:{primary:l},status:i.pending?"running":((o=i.result)==null?void 0:o.isError)===!0?"error":"complete",input:i.input,...i.result===void 0?{}:{result:i.result}})}else n(),t.push({key:i.key,kind:"row",row:i});return n(),t}function Qc(s,t){const{renderer:e,labelKey:n}=vs(s,t);switch(e){case"command":return"command";case"search":return"search";case"file":return n==="tool.read"?"read":"edit";case"web":return n==="tool.webSearch"?"web_search":"web_fetch";case"generic":return"unknown"}}function Gc(s,t){const n=(s==="command"?["command"]:s==="web_search"?["query"]:s==="web_fetch"?["url"]:s==="search"?["pattern","path"]:["path"]).map(i=>t[i]).find(i=>typeof i=="string"&&i.trim()!=="");if(n===void 0)return;const o=s==="read"||s==="edit"?n.replaceAll("\\","/").split("/").at(-1)??n:n;return o.length<=80?o:`${o.slice(0,79)}…`}const Jc=3,Yc=180;function Ys(s){return s.replace(/\s+/g," ").trim().slice(0,Yc)}function Xc(s){const t=[];return s.forEach((e,n)=>{if(e.kind!=="row")return;const o=e.row;if(o.kind==="user"){t.push({key:e.key,index:n,prompt:Ys(o.text)});return}const i=t.at(-1);o.kind==="assistant"&&i!==void 0&&i.reply===void 0&&o.text.trim()!==""&&(i.reply=Ys(o.text))}),t}const Zc=["data-variant"],eu=["disabled"],tu={key:1,role:"alert"},su={key:2,class:"timeline-empty"},nu=["data-index"],ou={key:2,class:"timeline-row","data-role":"assistant"},iu={class:"sr-only"},au=["disabled","aria-label","onClick"],ru={class:"timeline-line-name"},lu={key:0,class:"timeline-line-failed"},du={key:1,class:"timeline-line-cut"},cu={key:4,class:"timeline-notice"},uu={key:5,class:"timeline-line-notice"},pu={class:"timeline-line-from"},hu={key:6,class:"timeline-line-notice"},mu={key:7,class:"timeline-line-notice"},vu={key:8,class:"notice-row error-row",role:"alert"},fu=["aria-expanded","onClick"],gu={key:0,class:"error-details"},bu={key:9,class:"timeline-notice"},yu={key:3,class:"processing-row",role:"status"},wu=["aria-hidden"],ku={class:"sr-only"},_u=["aria-label"],Iu=["aria-label","onClick"],$u={class:"timeline-marker-card"},xu={class:"timeline-marker-prompt"},Cu={key:0,class:"timeline-marker-reply"},Su=["aria-label"],Eu=96,Mu=420,Tu=ke({__name:"TimelineView",props:{earlier:{type:Boolean},loadingEarlier:{type:Boolean},historyError:{},rows:{},running:{type:Boolean},retry:{},quotable:{type:Boolean},branchable:{type:Boolean},empty:{},variant:{}},emits:["earlier","quote","branch","openLine"],setup(s,{emit:t}){const e=s,n=t,{t:o}=ye(),i=R(),r=R(),l=R(!0),h=R({}),g=R({}),I=E(()=>Kc(e.rows)),v=R({}),_=R(Date.now());let w;$e(()=>e.retry,z=>{clearInterval(w),w=void 0,z!==void 0&&(_.value=Date.now(),w=setInterval(()=>{_.value=Date.now()},500))},{immediate:!0}),it(()=>clearInterval(w));const b=E(()=>e.retry===void 0?"":Ri(e.retry,Oi(e.retry.retryAtMs,_.value))),k=E(()=>Pi(e.retry));function x(z){v.value[z]=v.value[z]!==!0}function C(z){return z.slice(0,8)}function Y(z,L){z.kind==="user"&&n("branch",L,z.cut)}const X=Zd(E(()=>({count:I.value.length,getScrollElement:()=>i.value??null,estimateSize:()=>72,overscan:6,getItemKey:z=>I.value[z].key})));X.value.shouldAdjustScrollPositionOnItemSizeChange=(z,L,H)=>{var ue;const me=i.value;return me===void 0||r.value===void 0?!1:(H.getTotalSize(),(((ue=H.measurementsCache[z.index])==null?void 0:ue.start)??z.start)<me.scrollTop-r.value.offsetTop)};const F=E(()=>X.value.getVirtualItems()),P=E(()=>X.value.getTotalSize()),j=E(()=>Xc(I.value)),$=E(()=>e.variant!=="panel"&&j.value.length>=Jc),M=E(()=>Math.min(12,(Mu-12)/Math.max(1,j.value.length-1))),T=R();let W;function se(z){l.value=!1,X.value.scrollToIndex(z,{align:"center",behavior:"smooth"}),T.value=z,clearTimeout(W),W=setTimeout(()=>{T.value=void 0},1600)}function le(z){z instanceof Element&&X.value.measureElement(z)}function ge(){const z=i.value;z!==void 0&&(l.value=z.scrollHeight-z.scrollTop-z.clientHeight<=Eu)}async function J(){await He();const z=i.value;z!==void 0&&(z.scrollTop=z.scrollHeight)}function re(){l.value=!0,J()}return $e([()=>I.value.length,P,()=>e.rows.at(-1),()=>e.running],()=>{l.value&&J()}),ot(()=>void J()),(z,L)=>{const H=vt("tooltip");return d(),u("div",{class:"timeline-shell","data-variant":s.variant??"main"},[c("div",{ref_key:"viewport",ref:i,class:"timeline app-scroll-viewport",onScrollPassive:ge},[s.earlier?(d(),u("button",{key:0,type:"button",class:"ui-button",disabled:s.loadingEarlier,onClick:L[0]||(L[0]=me=>{l.value=!1,n("earlier")})},m(s.loadingEarlier?a(o)("timeline.loadingEarlier"):a(o)("timeline.loadEarlier")),9,eu)):D("",!0),s.historyError?(d(),u("p",tu,m(s.historyError),1)):D("",!0),I.value.length===0&&!s.running?(d(),u("p",su,m(s.empty??a(o)("chat.emptyTimeline")),1)):D("",!0),c("div",{ref_key:"list",ref:r,class:"virtual-timeline",style:Mt({height:`${P.value}px`,position:"relative"})},[(d(!0),u(ne,null,he(F.value,me=>(d(),u("div",{key:String(me.key),ref_for:!0,ref:le,class:je(["virtual-timeline-row",{"is-jump-target":me.index===T.value}]),"data-index":me.index,style:Mt({position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${me.start}px)`})},[(d(!0),u(ne,null,he([I.value[me.index]],V=>(d(),u(ne,{key:V.key},[V.kind==="work"?(d(),ae(Hc,{key:0,items:V.items,expanded:h.value[V.key]===!0,"expanded-item-ids":g.value,onToggle:ue=>h.value[V.key]=!h.value[V.key],onToggleItem:L[1]||(L[1]=ue=>g.value[ue]=!g.value[ue])},null,8,["items","expanded","expanded-item-ids","onToggle"])):V.row.kind==="user"?(d(),ae(fc,{key:1,text:V.row.text,skills:V.row.skills,at:V.row.at,quotable:s.quotable,branchable:s.branchable===!0,onBranch:ue=>Y(V.row,ue),onQuote:L[2]||(L[2]=ue=>n("quote",ue))},null,8,["text","skills","at","quotable","branchable","onBranch"])):V.row.kind==="assistant"?(d(),u("article",ou,[c("strong",iu,m(a(o)("chat.assistant")),1),G(oc,{content:V.row.text,final:!V.row.streaming,"message-id":V.row.key},null,8,["content","final","message-id"])])):V.row.kind==="line"?(d(),u("button",{key:3,type:"button",class:"timeline-line-marker",disabled:V.row.failed===!0,"aria-label":a(o)("lines.openLine",{name:V.row.purpose||C(V.row.branchId)}),onClick:ue=>V.row.failed!==!0&&n("openLine",V.row.branchId)},[G(a(ft),{size:14,"aria-hidden":"true"}),c("span",ru,m(V.row.purpose||C(V.row.branchId)),1),c("code",null,m(C(V.row.branchId)),1),V.row.failed?(d(),u("span",lu,m(a(o)("lines.state.creationFailed")),1)):V.row.before?(d(),u("span",du,m(a(o)("timeline.beforeMessage",{message:V.row.before})),1)):D("",!0)],8,au)):V.row.kind==="line-ended"?(d(),u("p",cu,m(V.row.issuer==="itself"?a(o)("timeline.lineEndedItself"):V.row.issuer==="operation"?a(o)("timeline.lineEndedByOperation"):a(o)("timeline.lineEndedWith",{id:V.row.ancestor??""})),1)):V.row.kind==="source-message"?(d(),u("p",uu,[c("span",pu,[be(m(a(o)("timeline.fromLine",{id:V.row.from})),1),V.row.steer?(d(),u(ne,{key:0},[be(m(a(o)("timeline.steer")),1)],64)):D("",!0),V.row.final?(d(),u(ne,{key:1},[be(", "+m(a(o)("timeline.final")),1)],64)):D("",!0)]),c("span",null,m(V.row.body),1)])):V.row.kind==="source-idle"?(d(),u("p",hu,m(a(o)("timeline.lineWaiting",{id:V.row.branch,status:V.row.status})),1)):V.row.kind==="source-ended"?(d(),u("p",mu,m(a(o)("timeline.lineEnded",{id:V.row.branch})),1)):V.row.kind==="error"?(d(),u("div",vu,[c("span",null,m(V.row.text),1),V.row.details?(d(),u(ne,{key:0},[c("button",{type:"button",class:"error-details-toggle","aria-expanded":v.value[V.row.key]===!0,onClick:ue=>x(V.row.key)},m(a(o)("failure.details")),9,fu),v.value[V.row.key]?(d(),u("div",gu,[(d(!0),u(ne,null,he(a(Li)(V.row.details),(ue,Pe)=>(d(),u("div",{key:Pe},m(ue),1))),128))])):D("",!0)],64)):D("",!0)])):(d(),u("p",bu,m(a(o)("timeline.noticeStopped")),1))],64))),128))],14,nu))),128))],4),s.running?(d(),u("div",yu,[G(a(Vt),{size:14,class:"is-spinning","aria-hidden":"true"}),c("span",{"aria-hidden":s.retry===void 0?!1:"true"},m(s.retry===void 0?a(o)("work.processing"):b.value),9,wu),c("span",ku,m(k.value),1)])):D("",!0)],544),$.value?(d(),u("nav",{key:0,class:"timeline-rail","aria-label":a(o)("timeline.rail")},[(d(!0),u(ne,null,he(j.value,(me,V)=>(d(),u("button",{key:me.key,type:"button",class:"timeline-marker",style:Mt({top:`${V*M.value}px`}),"aria-label":me.prompt,onClick:ue=>se(me.index)},[c("span",$u,[c("span",xu,m(me.prompt),1),me.reply?(d(),u("span",Cu,m(me.reply),1)):D("",!0)])],12,Iu))),128))],8,_u)):D("",!0),G(Vn,{name:"jump-latest"},{default:We(()=>[l.value?D("",!0):Ne((d(),u("button",{key:0,class:"ui-icon-button jump-latest","data-variant":"secondary","data-size":"md",type:"button","aria-label":a(o)("timeline.scrollToBottom"),onClick:re},[G(a(as),{"aria-hidden":"true"})],8,Su)),[[H,a(o)("timeline.scrollToBottom")]])]),_:1})],8,Zc)}}}),On=Ae(Tu,[["__scopeId","data-v-2dbca5eb"]]),qu=["aria-label"],Au={class:"line-crumb"},Lu={class:"line-crumb-main"},Ou=["data-tone"],Ru={class:"line-crumb-meta"},Pu={key:0},zu={key:1},Du={key:0,class:"line-loading",role:"status"},Nu={key:1,class:"line-loading line-error",role:"alert"},ju={key:0,class:"line-approval"},Bu={key:1,class:"line-approval question-prompts"},Fu={class:"line-status"},Wu={key:3,class:"line-readonly"},Vu=ke({__name:"LineConversation",props:{sessionId:{},branchId:{}},setup(s){const t=s,{t:e}=ye(),n=Qe(),o=Me(),i=Ve(),r=R(),l=E(()=>n.views[t.sessionId]),h=E(()=>{var L;return(L=l.value)==null?void 0:L.branches[t.branchId]}),g=E(()=>{var L;return(L=l.value)==null?void 0:L.lines.find(H=>H.id===t.branchId)}),I=E(()=>{var L;return(L=l.value)==null?void 0:L.approvals.find(H=>H.branchId===t.branchId)}),v=E(()=>{var L;return i.approvalKeyboard(t.sessionId,t.branchId,((L=l.value)==null?void 0:L.approvals)??[])}),_=E(()=>{var L;return((L=l.value)==null?void 0:L.questions.filter(H=>H.branchId===t.branchId))??[]}),w=E(()=>o.supports("permission.rules")&&o.supports("permission.set_rules")),b=E(()=>{var L;return(L=l.value)!=null&&L.methods.includes("session.files.search")?H=>n.searchFiles(t.sessionId,H):void 0}),k=E(()=>{var L;return g.value===void 0?((L=h.value)==null?void 0:L.status)!=="failed":g.value.state.kind==="working"||g.value.state.kind==="waiting"}),x=E(()=>dt(e,g.value,t.branchId)),C=E(()=>{var L,H;return((L=g.value)==null?void 0:L.state)??((H=h.value)!=null&&H.running?{kind:"working"}:{kind:"waiting"})}),Y=E(()=>{var me,V;const L=(me=g.value)==null?void 0:me.parentId;if(L==null)return"";if(L===de)return e("lines.main");const H=(V=l.value)==null?void 0:V.lines.find(ue=>ue.id===L);return H===void 0?wt(L):dt(e,H,L)}),X=E(()=>{var L,H;return((L=g.value)==null?void 0:L.cut)===null||((H=g.value)==null?void 0:H.cut)===void 0?"":e("lines.afterMessage",{count:g.value.cut.messages})}),F=E(()=>{var L;return((L=h.value)==null?void 0:L.rows)??[]}),P=E(()=>{var L;return((L=h.value)==null?void 0:L.running)??!1}),j=E(()=>{var L;return((L=h.value)==null?void 0:L.stopping)??!1});$e(()=>[t.sessionId,t.branchId],()=>n.ensureLine(t.sessionId,t.branchId),{immediate:!0});function $(L,H){return n.submit(t.sessionId,t.branchId,L,H)}function M(L){var H;(H=r.value)==null||H.quote(L)}function T(){return n.stop(t.sessionId,t.branchId)}function W(L,H){i.requestNewLine({sessionId:t.sessionId,parentBranchId:t.branchId,at:H,text:L})}function se(L){n.ensureLine(t.sessionId,L),i.openLine(t.sessionId,L)}function le(){i.requestEndLine({sessionId:t.sessionId,branchId:t.branchId,purpose:x.value})}function ge(){var H;const L=(H=h.value)==null?void 0:H.lastTurnEnd;L!==void 0&&i.requestNewLine({sessionId:t.sessionId,parentBranchId:t.branchId,at:L,text:""})}async function J(L){var V;const H=(V=h.value)==null?void 0:V.lastTurnEnd;if(H===void 0)throw new Error(e("lines.noFinishedTurn"));const me=await n.createLine(t.sessionId,t.branchId,H,L);i.openLine(t.sessionId,me)}function re(){n.retryLine(t.sessionId,t.branchId)}function z(){}return(L,H)=>{var me,V,ue;return d(),u("section",{class:"line-conversation","aria-label":a(e)("lines.lineAria",{name:x.value})},[c("header",Au,[c("div",Lu,[G(a(ft),{size:14,"aria-hidden":"true"}),c("strong",null,m(x.value),1),c("code",null,m(a(wt)(s.branchId)),1),c("span",{class:"line-state","data-tone":a(hs)(C.value)},m(a(Pt)(a(e),C.value)),9,Ou)]),c("div",Ru,[Y.value?(d(),u("span",Pu,[be(m(a(e)("lines.from",{name:Y.value})),1),X.value?(d(),u(ne,{key:0},[be(" · "+m(X.value),1)],64)):D("",!0)])):(d(),u("span",zu,m(a(e)("lines.main")),1)),k.value&&((me=h.value)==null?void 0:me.lastTurnEnd)!==void 0?(d(),u("button",{key:2,type:"button",class:"ui-button","data-variant":"ghost","data-size":"xs",onClick:ge},m(a(e)("lines.newChild")),1)):D("",!0),k.value&&((V=g.value)==null?void 0:V.id)!=="main"?(d(),u("button",{key:3,type:"button",class:"ui-button","data-variant":"ghost","data-size":"xs",onClick:le},m(a(e)("lines.end")),1)):D("",!0)])]),!l.value||!h.value||h.value.status==="loading"?(d(),u("div",Du,[G(a(Vt),{size:16,class:"is-spinning","aria-hidden":"true"}),c("span",null,m(a(e)("common.loading")),1)])):h.value.status==="failed"?(d(),u("div",Nu,[c("p",null,m(h.value.error||a(e)("lines.loadFailed")),1),c("button",{type:"button",class:"ui-button","data-variant":"secondary","data-size":"sm",onClick:re},[G(a(fo),{"aria-hidden":"true"}),be(m(a(e)("lines.retry")),1)])])):(d(),u(ne,{key:2},[G(On,{rows:F.value,earlier:h.value.earlier,"loading-earlier":h.value.loadingEarlier,"history-error":h.value.historyError,onEarlier:H[0]||(H[0]=Pe=>a(n).loadEarlier(s.sessionId,s.branchId)),running:P.value,quotable:k.value&&!I.value&&_.value.length===0,branchable:k.value&&!I.value&&_.value.length===0,empty:a(e)("lines.empty"),variant:"panel",onBranch:W,onOpenLine:se,onQuote:M},null,8,["rows","earlier","loading-earlier","history-error","running","quotable","branchable","empty"]),I.value?(d(),u("div",ju,[(d(),ae(En,{key:JSON.stringify([I.value.branchId,I.value.requestId]),"session-id":s.sessionId,request:I.value,keyboard:v.value,"rules-available":w.value},null,8,["session-id","request","keyboard","rules-available"]))])):_.value.length?(d(),u("div",Bu,[(d(!0),u(ne,null,he(_.value,Pe=>(d(),ae(qn,{key:JSON.stringify([Pe.branchId,Pe.requestId,Pe.callId]),"session-id":s.sessionId,question:Pe},null,8,["session-id","question"]))),128))])):k.value?(d(),ae(fs,{key:2,ref_key:"composer",ref:r,running:P.value,stopping:j.value,model:l.value.model,send:$,"stores-pastes":((ue=l.value)==null?void 0:ue.methods.includes("attachment.put"))===!0,"search-files":b.value,stop:T,"model-selectable":!1,"select-model":z,placeholder:a(e)("lines.placeholder"),"create-branch":a(o).supports("session.branch_create")?J:void 0,"open-lines":()=>a(i).openLines(s.sessionId),variant:"panel"},{status:We(()=>[c("span",Fu,"⑂ "+m(a(Pt)(a(e),C.value)),1)]),_:1},8,["running","stopping","model","stores-pastes","search-files","placeholder","create-branch","open-lines"])):(d(),u("div",Wu,[c("span",null,"⑂ "+m(a(Pt)(a(e),C.value)),1),c("span",null,m(a(e)("lines.readOnly")),1)]))],64))],8,qu)}}}),Uu=Ae(Vu,[["__scopeId","data-v-d0c8b107"]]),Hu={class:"lines-tree"},Ku={key:0,class:"lines-empty"},Qu={class:"lines-empty-icon","aria-hidden":"true"},Gu=["aria-label"],Ju=["data-depth","data-active"],Yu=["data-tone"],Xu={class:"lines-name"},Zu={class:"lines-meta"},ep=["aria-label","disabled","onClick"],tp=["data-tone"],sp={class:"lines-name"},np={class:"lines-meta"},op={key:0},ip={class:"lines-id"},ap={key:1},rp=["aria-label","onClick"],lp=ke({__name:"LinesTree",props:{sessionId:{}},setup(s){const t=s,{t:e}=ye(),n=Qe(),o=Ve(),i=E(()=>n.views[t.sessionId]),r=E(()=>{var k;return((k=i.value)==null?void 0:k.lines)??[]}),l=E(()=>r.value.some(k=>k.id!=="main"));function h(k){k.id==="main"||k.state.kind==="creation-failed"||(n.ensureLine(t.sessionId,k.id),o.openLine(t.sessionId,k.id))}function g(k){return k.id!=="main"&&(k.state.kind==="working"||k.state.kind==="waiting")}function I(k){var x;return((x=i.value)==null?void 0:x.approvals.some(C=>C.branchId===k.id))===!0}function v(k){return I(k)?"warning":hs(k.state)}function _(k){o.requestEndLine({sessionId:t.sessionId,branchId:k.id,purpose:dt(e,k,k.id)})}function w(k){return k.cut===null||k.cut.messages===void 0?"":e("lines.afterMessage",{count:k.cut.messages})}function b(k){if(k.parentId===null)return"";const x=r.value.find(C=>C.id===k.parentId);return x===void 0?wt(k.parentId):dt(e,x,k.parentId)}return(k,x)=>(d(),u("div",Hu,[l.value?(d(),u("ol",{key:1,class:"lines-list","aria-label":a(e)("lines.title")},[(d(!0),u(ne,null,he(r.value,C=>(d(),u("li",{key:C.id,class:"lines-row","data-depth":C.depth,"data-active":C.id!=="main"&&a(o).activeLineTab[s.sessionId]===C.id},[C.id==="main"?(d(),u(ne,{key:0},[c("span",{class:"lines-state","data-tone":v(C),"aria-hidden":"true"},null,8,Yu),c("span",Xu,m(a(e)("lines.main")),1),c("span",Zu,m(a(e)("lines.mainHint")),1)],64)):(d(),u(ne,{key:1},[c("button",{type:"button",class:"lines-open","aria-label":a(e)("lines.openLine",{name:a(dt)(a(e),C,C.id)}),disabled:C.state.kind==="creation-failed",onClick:Y=>h(C)},[c("span",{class:"lines-state","data-tone":v(C),"aria-hidden":"true"},null,8,tp),c("span",sp,m(a(dt)(a(e),C,C.id)),1),c("span",np,[C.cut!==null?(d(),u("span",op,m(w(C))+" · ",1)):D("",!0),c("span",ip,m(a(wt)(C.id)),1),C.parentId!=="main"?(d(),u("span",ap," · "+m(a(e)("lines.from",{name:b(C)})),1)):D("",!0),c("span",null," · "+m(a(Pt)(a(e),C.state)),1)])],8,ep),g(C)?(d(),u("button",{key:0,type:"button",class:"ui-button lines-end","data-variant":"ghost","data-size":"xs","aria-label":a(e)("lines.endLine",{name:a(dt)(a(e),C,C.id)}),onClick:Y=>_(C)},m(a(e)("lines.end")),9,rp)):D("",!0)],64))],8,Ju))),128))],8,Gu)):(d(),u("div",Ku,[c("span",Qu,[G(a(ft),{size:28})]),c("strong",null,m(a(e)("lines.emptyTitle")),1),c("p",null,m(a(e)("lines.emptyHint")),1)]))]))}}),dp=Ae(lp,[["__scopeId","data-v-a371ceb3"]]),cp=["aria-label"],up={class:"lines-tabs"},pp=["aria-label"],hp=["aria-selected"],mp={class:"lines-tab-title"},vp={key:0,class:"ui-badge","data-size":"sm"},fp=["aria-selected","onClick"],gp={class:"lines-tab-title"},bp={class:"lines-tab-id"},yp=["data-tone"],wp=["aria-label","onClick"],kp={class:"lines-tab-actions"},_p=["aria-label"],Ip=["aria-label"],$p=["aria-label"],xp={class:"lines-body"},Cp={key:0,class:"lines-loading",role:"status"},Sp=ke({__name:"LinesPanel",props:{sessionId:{}},setup(s){const t=s,{t:e}=ye(),n=Qe(),o=Ve(),i=$t(),r=E(()=>n.views[t.sessionId]),l=E(()=>o.lineTabs[t.sessionId]??[]),h=E(()=>o.activeLineTab[t.sessionId]),g=E(()=>{var F;return((F=r.value)==null?void 0:F.lines.filter(P=>P.id!==de).length)??0});function I(F){var P;return(P=r.value)==null?void 0:P.lines.find(j=>j.id===F)}function v(F){return dt(e,I(F),F)}function _(F){var j;if(((j=r.value)==null?void 0:j.approvals.some($=>$.branchId===F))===!0)return"warning";const P=I(F);return P===void 0?void 0:hs(P.state)}function w(F){var j,$;const P=(j=r.value)==null?void 0:j.branches[F];return(P==null?void 0:P.running)===!0||(($=r.value)==null?void 0:$.approvals.some(M=>M.branchId===F))===!0}function b(F){var j;const P=(j=I(F))==null?void 0:j.state.kind;return w(F)||P==="ending"||P==="ended"||P==="ended-itself"||P==="ended-by-operation"||P==="ended-with"||P==="creation-failed"}function k(){o.openLines(t.sessionId)}function x(F){n.ensureLine(t.sessionId,F),o.activateLine(t.sessionId,F)}function C(F){o.closeLineTab(t.sessionId,F)}function Y(){var P;const F=(P=r.value)==null?void 0:P.lastTurnEnd;if(F===void 0){i.push({tone:"info",title:e("lines.noFinishedTurn")});return}o.requestNewLine({sessionId:t.sessionId,parentBranchId:de,at:F,text:""})}function X(F){if(F.key!=="ArrowLeft"&&F.key!=="ArrowRight")return;const P=[void 0,...l.value],j=P.findIndex(M=>M===h.value),$=P[(j+(F.key==="ArrowRight"?1:-1)+P.length)%P.length];F.preventDefault(),$===void 0?k():x($)}return(F,P)=>{const j=vt("tooltip");return d(),u("div",{class:"lines-panel",role:"region","aria-label":a(e)("lines.panelAria")},[c("header",up,[c("div",{class:"lines-tablist",role:"tablist","aria-label":a(e)("lines.title"),onKeydown:X},[c("button",{type:"button",class:je(["lines-tab",{"is-active":h.value===void 0}]),role:"tab","aria-selected":h.value===void 0,onClick:k},[G(a(lo),{size:14,"aria-hidden":"true"}),c("span",mp,m(a(e)("lines.title")),1),g.value>0?(d(),u("span",vp,m(g.value),1)):D("",!0)],10,hp),(d(!0),u(ne,null,he(l.value,$=>(d(),u("div",{key:$,class:je(["lines-tab-wrap",{"is-active":h.value===$}])},[c("button",{type:"button",class:"lines-tab",role:"tab","aria-selected":h.value===$,onClick:M=>x($)},[G(a(ft),{size:14,"aria-hidden":"true",class:je({"is-running":w($)})},null,8,["class"]),c("span",gp,m(v($)),1),c("span",bp,m(a(wt)($)),1),b($)?(d(),u("span",{key:0,class:"lines-tab-dot","data-tone":_($),"aria-hidden":"true"},null,8,yp)):D("",!0)],8,fp),c("button",{type:"button",class:"lines-tab-close","aria-label":a(e)("lines.closeTab"),onClick:Se(M=>C($),["stop"])},[G(a(yt),{size:12,"aria-hidden":"true"})],8,wp)],2))),128))],40,pp),c("div",kp,[Ne((d(),u("button",{type:"button",class:"ui-icon-button","data-variant":"ghost","data-size":"sm","aria-label":a(e)("lines.newLine"),onClick:Y},[G(a(rs),{"aria-hidden":"true"})],8,_p)),[[j,a(e)("lines.newLine")]]),Ne((d(),u("button",{type:"button",class:"ui-icon-button","data-variant":"ghost","data-size":"sm","aria-label":a(o).detailExpanded?a(e)("lines.collapse"):a(e)("lines.expand"),onClick:P[0]||(P[0]=$=>a(o).detailExpanded=!a(o).detailExpanded)},[a(o).detailExpanded?(d(),ae(a(uo),{key:0,"aria-hidden":"true"})):(d(),ae(a(co),{key:1,"aria-hidden":"true"}))],8,Ip)),[[j,a(o).detailExpanded?a(e)("lines.collapse"):a(e)("lines.expand")]]),Ne((d(),u("button",{type:"button",class:"ui-icon-button","data-variant":"ghost","data-size":"sm","aria-label":a(e)("lines.closePanel"),onClick:P[1]||(P[1]=(...$)=>a(o).closeDetail&&a(o).closeDetail(...$))},[G(a(yt),{"aria-hidden":"true"})],8,$p)),[[j,a(e)("lines.closePanel")]])])]),c("div",xp,[!r.value||r.value.status==="loading"?(d(),u("div",Cp,m(a(e)("common.loading")),1)):h.value===void 0?(d(),ae(dp,{key:1,"session-id":s.sessionId},null,8,["session-id"])):(d(),ae(Uu,{key:h.value,"session-id":s.sessionId,"branch-id":h.value},null,8,["session-id","branch-id"]))])],8,cp)}}}),Ep=Ae(Sp,[["__scopeId","data-v-7751cb0a"]]),Mp={class:"ui-dialog-header"},Tp={class:"ui-dialog-icon","data-tone":"primary"},qp={class:"ui-dialog-title"},Ap={class:"ui-dialog-description"},Lp={class:"new-line-cut"},Op=["aria-label"],Rp={class:"new-line-label",for:"new-line-prompt"},Pp=["placeholder"],zp={key:0,class:"ui-banner","data-tone":"danger",role:"alert"},Dp={class:"ui-dialog-footer"},Np=["disabled"],jp=["disabled"],Bp=ke({__name:"NewLineDialog",setup(s){const{t}=ye(),e=Qe(),n=Ve(),o=R(),i=R(""),r=R(""),l=R(!1),h=E(()=>n.newLine),g=E(()=>{var x;const b=h.value;if(b===void 0)return"";if(b.parentBranchId===de)return t("lines.main");const k=(x=e.views[b.sessionId])==null?void 0:x.lines.find(C=>C.id===b.parentBranchId);return k===void 0?wt(b.parentBranchId):dt(t,k,b.parentBranchId)}),I=E(()=>{var x;const b=h.value;if(b===void 0)return"";const k=b.before??((x=b.text.split(`
|
|
249
|
-
`)[0])==null?void 0:x.trim())??"";return k===""?t("lines.atEnd"):t("lines.beforeMessage",{message:k})});function v(){var b;i.value=((b=h.value)==null?void 0:b.text)??"",r.value="",l.value=!1}$e(h,v,{immediate:!0}),ot(()=>{var b;return(b=o.value)==null?void 0:b.showModal()});function _(){var b;(b=o.value)==null||b.close()}async function w(){const b=h.value;if(b===void 0||l.value)return;const k=i.value.trim();if(k===""){r.value=t("lines.promptRequired");return}l.value=!0,r.value="";try{const x=await e.createLine(b.sessionId,b.parentBranchId,b.at,k);n.openLine(b.sessionId,x),_()}catch(x){r.value=x instanceof Error?x.message:String(x)}finally{l.value=!1}}return(b,k)=>(d(),u("dialog",{ref_key:"dialog",ref:o,class:"ui-dialog","data-size":"md",onCancel:Se(_,["prevent"]),onClose:k[1]||(k[1]=x=>a(n).closeNewLine())},[h.value?(d(),u("form",{key:0,onSubmit:Se(w,["prevent"])},[c("header",Mp,[c("span",Tp,[G(a(ft),{size:16,"aria-hidden":"true"})]),c("div",null,[c("h2",qp,m(a(t)("lines.newLineTitle")),1),c("p",Ap,[be(m(a(t)("lines.newLineFrom",{name:g.value})),1),k[2]||(k[2]=c("br",null,null,-1)),c("span",Lp,m(I.value),1)])]),c("button",{type:"button",class:"ui-icon-button ui-dialog-close","data-variant":"close","data-size":"sm","aria-label":a(t)("common.close"),onClick:_},[...k[3]||(k[3]=[c("span",{"aria-hidden":"true"},"×",-1)])],8,Op)]),c("label",Rp,m(a(t)("lines.promptLabel")),1),Ne(c("textarea",{id:"new-line-prompt","onUpdate:modelValue":k[0]||(k[0]=x=>i.value=x),class:"ui-field new-line-input",rows:"4",placeholder:a(t)("lines.promptPlaceholder"),autofocus:""},null,8,Pp),[[At,i.value]]),r.value?(d(),u("p",zp,m(r.value),1)):D("",!0),c("footer",Dp,[c("button",{type:"button",class:"ui-button","data-variant":"ghost","data-size":"md",disabled:l.value,onClick:_},m(a(t)("common.cancel")),9,Np),c("button",{type:"submit",class:"ui-button","data-variant":"primary","data-size":"md",disabled:l.value||i.value.trim()===""},m(l.value?a(t)("common.loading"):a(t)("lines.create")),9,jp)])],32)):D("",!0)],544))}}),Fp=Ae(Bp,[["__scopeId","data-v-dd14ac7e"]]),Wp=["data-mode","data-sidebar-collapsed","data-chat-route","data-settings-route"],Vp={key:0,class:"compact-header"},Up=["aria-label"],Hp={class:"compact-title"},Kp={class:"sr-only"},Qp=["aria-label"],Gp=["data-has-detail","data-detail-expanded"],Jp=["aria-label"],Yp=["aria-label"],Xp={key:1,class:"main-header"},Zp={key:2,class:"reconnect-banner",role:"status"},eh=["aria-label","aria-valuenow"],th=["aria-label"],Xs="details.session-menu[open], details.composer-popover[open]",sh=ke({__name:"AppShell",setup(s){const t=Ft(),{t:e}=ye(),{t:n}=ye({messages:ds}),o=Me(),i=Ke(),r=Ve(),l=R(),h=R();let g;const I=E(()=>t.path==="/settings"||t.path.startsWith("/settings/")),v=E(()=>t.name==="chat-new"||t.name==="chat-session"),_=E(()=>typeof t.params.sessionId=="string"?t.params.sessionId:void 0),w=E(()=>r.detailOpen&&t.name==="chat-session"&&_.value!==void 0),b=E(()=>{if(I.value)return n("settings");if(t.name==="chat-session"&&typeof t.params.sessionId=="string"){const P=i.byId.get(t.params.sessionId);return(P==null?void 0:P.title)??(P==null?void 0:P.preview)??(P===void 0?e("route.session"):Kt(P.cwd))}return t.name==="not-found"?e("route.notFound"):e("route.newSession")});$e(b,P=>{document.title=`${P} — Dim`},{immediate:!0}),$e(()=>r.drawerOpen,async P=>{await He();const j=h.value;j!==void 0&&(P&&!j.open?j.showModal():!P&&j.open&&j.close())});function k(P){const j=P.target instanceof Node?P.target:void 0;for(const $ of document.querySelectorAll(Xs))(j===void 0||!$.contains(j))&&($.open=!1)}function x(P){if(P.key==="Escape"){for(const $ of document.querySelectorAll(Xs))$.open=!1;return}(navigator.userAgent.includes("Mac")?P.metaKey:P.ctrlKey)&&!P.altKey&&!P.shiftKey&&P.key.toLowerCase()==="b"&&(P.preventDefault(),r.shellMode==="compact"?r.drawerOpen=!r.drawerOpen:r.sidebarCollapsed=!r.sidebarCollapsed)}function C(){o.phase==="connected"&&i.refresh()}ot(()=>{l.value!==void 0&&(g=new ResizeObserver(([P])=>{P!==void 0&&r.setShellWidth(P.contentRect.width)}),g.observe(l.value)),window.addEventListener("keydown",x),window.addEventListener("focus",C),document.addEventListener("pointerdown",k,!0)}),it(()=>{g==null||g.disconnect(),window.removeEventListener("keydown",x),window.removeEventListener("focus",C),document.removeEventListener("pointerdown",k,!0)});function Y(P){P.target===h.value&&(r.drawerOpen=!1)}function X(P){if(r.shellMode==="compact")return;const j=P.clientX,$=r.detailWidth,M=W=>{r.setDetailWidth($+j-W.clientX)},T=()=>{window.removeEventListener("pointermove",M),window.removeEventListener("pointerup",T)};window.addEventListener("pointermove",M),window.addEventListener("pointerup",T,{once:!0})}function F(P){r.setDetailWidth(r.detailWidth+P)}return(P,j)=>{var M;const $=vt("tooltip");return d(),u("div",{ref_key:"root",ref:l,class:"app-shell","data-mode":a(r).shellMode,"data-sidebar-collapsed":a(r).sidebarCollapsed,"data-chat-route":v.value,"data-settings-route":I.value,style:{"--sidebar-width":"280px"}},[G(Ua),a(r).shellMode==="compact"&&!I.value?(d(),u("header",Vp,[c("button",{class:"ui-icon-button","data-variant":"ghost","data-size":"md",type:"button","aria-label":a(e)("sidebar.openMenu"),onClick:j[0]||(j[0]=T=>a(r).drawerOpen=!0)},[G(a(nn),{"aria-hidden":"true"})],8,Up),c("span",Hp,m(b.value),1)])):D("",!0),a(r).shellMode==="compact"?(d(),u("dialog",{key:1,ref_key:"drawer",ref:h,class:"drawer-content",onClick:Y,onClose:j[3]||(j[3]=T=>a(r).drawerOpen=!1)},[c("h2",Kp,m(a(e)("sidebar.workspaces")),1),c("button",{autofocus:"",class:"ui-icon-button drawer-close","data-variant":"ghost","data-size":"md",type:"button","aria-label":a(e)("sidebar.closeMenu"),onClick:j[1]||(j[1]=T=>a(r).drawerOpen=!1)},[G(a(yt),{"aria-hidden":"true"})],8,Qp),G(Bs,{onNavigate:j[2]||(j[2]=T=>a(r).drawerOpen=!1)})],544)):D("",!0),a(r).shellMode!=="compact"&&!a(r).sidebarCollapsed&&!I.value?(d(),ae(Bs,{key:2,class:"inline-sidebar"})):D("",!0),c("div",{class:"content-region","data-has-detail":w.value,"data-detail-expanded":a(r).detailExpanded,style:Mt({"--detail-width":`${a(r).detailWidth}px`})},[c("main",{id:"main",class:"main-region","aria-label":a(e)("a11y.mainContent"),onPointerdown:j[5]||(j[5]=T=>a(r).detailFocused=!1),onFocusin:j[6]||(j[6]=T=>a(r).detailFocused=!1)},[a(r).sidebarCollapsed&&a(r).shellMode!=="compact"&&!I.value?Ne((d(),u("button",{key:0,class:"ui-icon-button sidebar-reopen","data-variant":"ghost","data-size":"md",type:"button","aria-label":a(e)("sidebar.openMenu"),onClick:j[4]||(j[4]=T=>a(r).sidebarCollapsed=!1)},[G(a(ho),{"aria-hidden":"true"})],8,Yp)),[[$,a(e)("sidebar.openMenu")]]):D("",!0),I.value?D("",!0):(d(),u("header",Xp,[c("div",null,[c("p",null,"Dim "+m((M=a(o).hello)==null?void 0:M.serverVersion),1),c("strong",null,m(b.value),1)])])),a(o).phase==="reconnecting"?(d(),u("p",Zp,m(a(e)("page.reconnecting")),1)):D("",!0),(d(),ae(a(Un),{key:I.value?"settings":a(t).fullPath}))],40,Jp),w.value?(d(),u("div",{key:0,class:"detail-resizer",role:"separator","aria-orientation":"vertical","aria-label":a(e)("lines.resize"),"aria-valuenow":a(r).detailWidth,"aria-valuemin":320,"aria-valuemax":720,tabindex:"0",onPointerdown:Se(X,["prevent"]),onKeydown:[j[7]||(j[7]=xs(Se(T=>F(-16),["prevent"]),["left"])),j[8]||(j[8]=xs(Se(T=>F(16),["prevent"]),["right"]))]},null,40,eh)):D("",!0),w.value&&_.value?(d(),u("aside",{key:1,class:"detail-region","data-active":"true","aria-label":a(r).extension?void 0:a(e)("lines.panelAria"),onPointerdown:j[9]||(j[9]=T=>a(r).detailFocused=!0),onFocusin:j[10]||(j[10]=T=>a(r).detailFocused=!0)},[a(r).extension?(d(),ae(mr,{key:0,"session-id":_.value},null,8,["session-id"])):(d(),ae(Ep,{key:1,"session-id":_.value},null,8,["session-id"]))],40,th)):D("",!0)],12,Gp),a(r).newLine?(d(),ae(Fp,{key:3})):D("",!0),a(r).endingLine?(d(),ae(sr,{key:4})):D("",!0)],8,Wp)}}}),nh={class:"skip-link",href:"#main"},oh={key:1,id:"main",class:"boot-page",tabindex:"-1","aria-busy":"true"},ih={class:"sr-only"},ah={key:2,id:"main",class:"auth-page",tabindex:"-1"},rh={class:"eyebrow"},lh={key:0},dh={key:1},ch=ke({__name:"AppRoot",setup(s){const{t}=ye(),e=Me(),n=E(()=>e.everConnected&&e.phase!=="unauthenticated"&&e.phase!=="version-mismatch"),o=E(()=>e.phase==="unauthenticated"?t("auth.expiredTitle"):e.phase==="version-mismatch"?t("auth.versionTitle"):t("auth.connectingTitle"));return $e([n,o],([i,r])=>{i||(document.title=`${r} — Dim`)},{immediate:!0}),(i,r)=>(d(),u(ne,null,[c("a",nh,m(a(t)("common.skipToContent")),1),n.value?(d(),ae(sh,{key:0})):a(e).phase==="connecting"||a(e).phase==="reconnecting"?(d(),u("main",oh,[G(Ut,{animated:"",class:"boot-mark"}),c("h1",ih,m(o.value),1)])):(d(),u("main",ah,[r[1]||(r[1]=c("span",{class:"auth-signal","aria-hidden":"true"},null,-1)),c("p",rh,m(a(t)("brand.webHost")),1),c("h1",null,m(o.value),1),a(e).phase==="unauthenticated"?(d(),u("p",lh,[be(m(a(t)("auth.expiredBefore")),1),r[0]||(r[0]=c("code",null,"dimcode web",-1)),be(m(a(t)("auth.expiredAfter")),1)])):(d(),u("p",dh,m(a(t)("auth.versionDescription")),1))]))],64))}}),uh=400,ph=300,Zs=6,Zt=8,bs="ui-tooltip";let Fe,nt,qt,Rn=0,os=null,ys=!1;function hh(){return Fe!==void 0||(Fe=document.createElement("div"),Fe.id=bs,Fe.className="ui-tooltip",Fe.setAttribute("role","tooltip"),Fe.popover="manual",Object.assign(Fe.style,{position:"fixed",inset:"auto",margin:"0",border:"0",overflow:"visible"}),document.body.append(Fe)),Fe}function jt(s){clearTimeout(qt);const t=s._tooltip;if(!t||!s.isConnected)return;const e=hh();e.textContent=t,e.matches(":popover-open")||e.showPopover(),nt=s,s.getAttribute("aria-label")!==t&&s.setAttribute("aria-describedby",bs),mh(s,e)}function mh(s,t){const e=s.getBoundingClientRect(),n=t.getBoundingClientRect(),o=e.top-Zs-n.height,i=o>=Zt?o:e.bottom+Zs,r=e.left+e.width/2-n.width/2,l=Math.min(Math.max(r,Zt),window.innerWidth-Zt-n.width);t.style.left=`${Math.round(l)}px`,t.style.top=`${Math.round(i)}px`}function pt(){clearTimeout(qt),qt=void 0,nt!==void 0&&(nt.getAttribute("aria-describedby")===bs&&nt.removeAttribute("aria-describedby"),nt=void 0,Fe!=null&&Fe.matches(":popover-open")&&Fe.hidePopover())}function vh(s){const t=s.currentTarget;clearTimeout(qt),!ys&&(performance.now()<Rn?jt(t):qt=setTimeout(()=>jt(t),uh))}function fh(){nt!==void 0&&(Rn=performance.now()+ph),pt()}function gh(s){const t=s.currentTarget;if(t===os){os=null;return}t.matches(":focus-visible")&&jt(t)}function bh(s){ys=s.pointerType==="touch",nt!==void 0&&!(s.target instanceof Node&&nt.contains(s.target))&&pt()}function yh(){os=document.activeElement,pt()}function wh(s){s.key==="Escape"&&pt()}const en=[["mouseenter",vh],["mouseleave",fh],["focus",gh],["blur",pt],["pointerdown",pt],["keydown",wh]];let tn=!1;function kh(){tn||(tn=!0,window.addEventListener("scroll",pt,{capture:!0,passive:!0}),window.addEventListener("blur",yh),document.addEventListener("pointermove",bh,{passive:!0}),document.addEventListener("pointerdown",s=>{ys=s.pointerType==="touch"},{capture:!0,passive:!0}))}const _h={mounted(s,t){s._tooltip=t.value;for(const[e,n]of en)s.addEventListener(e,n);kh()},updated(s,t){s._tooltip=t.value,nt===s&&(t.value?jt(s):pt())},beforeUnmount(s){nt===s&&pt();for(const[t,e]of en)s.removeEventListener(t,e)}},Ih=["aria-label"],$h={class:"queued-title"},xh={class:"queued-list"},Ch={class:"queued-index"},Sh={class:"queued-text"},Eh=["disabled","onClick"],Mh=["disabled","onClick"],Th=ke({__name:"QueuedInputs",props:{sessionId:{},items:{}},setup(s){const t=s,{t:e}=ye(),n=Qe(),o=$t(),i=R(!1);async function r(l,h){if(!i.value){i.value=!0;try{(await n.withdrawInput(t.sessionId,l.id,h?l.user:void 0)).status==="notHeld"&&o.push({tone:"info",title:e("queue.notHeld")})}catch(g){o.push({tone:"danger",title:e("command.failed"),description:g instanceof Error?g.message:String(g)})}finally{i.value=!1}}}return(l,h)=>(d(),u("section",{class:"queued-inputs","aria-label":a(e)("queue.title")},[c("h2",$h,m(a(e)("queue.title")),1),c("ol",xh,[(d(!0),u(ne,null,he(s.items,(g,I)=>(d(),u("li",{key:g.id,class:"queued-item"},[c("span",Ch,m(I+1),1),c("span",Sh,m(g.text),1),(d(!0),u(ne,null,he(g.skills,v=>(d(),u("span",{key:v,class:"queued-skill"},m(a(e)("message.skillLoaded",{name:v})),1))),128)),I===0?(d(),u("button",{key:0,type:"button",class:"ui-button","data-size":"sm","data-variant":"secondary",disabled:i.value,onClick:v=>r(g,!0)},m(a(e)("queue.steer")),9,Eh)):D("",!0),c("button",{type:"button",class:"ui-button","data-size":"sm","data-variant":"ghost",disabled:i.value,onClick:v=>r(g,!1)},m(a(e)("queue.remove")),9,Mh)]))),128))])],8,Ih))}}),qh=Ae(Th,[["__scopeId","data-v-a9cf2edc"]]),Ah={class:"extension-picker"},Lh={class:"sr-only"},Oh=["aria-label","title","disabled","value"],Rh={value:""},Ph=["value","disabled"],zh={key:0,role:"status"},Dh=ke({__name:"ExtensionMenu",props:{sessionId:{}},setup(s){const t=s,{t:e,locale:n}=ye({messages:Cn}),o=Tt(),i=Ve(),r=Me(),l=R(),h=R("");let g=0;const I=E(()=>{var w;return(((w=o.directory)==null?void 0:w.extensions)??[]).flatMap(b=>b.panels.map(k=>({extension:b,panel:k,reason:r.phase!=="connected"?e("disconnected"):k.methods.length&&l.value===void 0?h.value||e("checking"):$n(k,r.supports,l.value??[])}))).sort((b,k)=>b.extension.pluginName.localeCompare(k.extension.pluginName)||b.panel.id.localeCompare(k.panel.id))});async function v(){const w=++g;if(l.value=void 0,h.value="",!(!t.sessionId||r.phase!=="connected"||!I.value.some(({panel:b})=>b.methods.length)))try{const b=await r.client.call("session.methods",{sessionId:t.sessionId},cs);w===g&&(l.value=b)}catch(b){w===g&&(h.value=b instanceof Error?b.message:String(b))}}$e([()=>t.sessionId,()=>r.phase,()=>{var w;return(w=o.directory)==null?void 0:w.revision}],v,{immediate:!0}),it(()=>{g++});function _(w){const b=w.target.value,k=I.value.find(x=>JSON.stringify([x.extension.pluginName,x.panel.id])===b);k===void 0||k.reason||(i.extension={pluginName:k.extension.pluginName,panelId:k.panel.id},i.detailExpanded=!1,i.detailOpen=!0,i.detailFocused=!0)}return(w,b)=>{var k;return d(),u("label",Ah,[c("span",Lh,m(a(e)("extensions")),1),c("select",{"data-extension-trigger":"","aria-label":a(e)("extensions"),title:s.sessionId?a(e)("choose"):a(e)("session"),disabled:!s.sessionId,value:a(i).extension&&a(i).detailOpen?JSON.stringify([a(i).extension.pluginName,a(i).extension.panelId]):"",onFocus:v,onChange:_},[c("option",Rh,m(I.value.length?a(e)("choose"):a(e)("empty")),1),(d(!0),u(ne,null,he(I.value,({extension:x,panel:C,reason:Y})=>(d(),u("option",{key:JSON.stringify([x.pluginName,C.id]),value:JSON.stringify([x.pluginName,C.id]),disabled:!!Y},m(a(xn)(C,a(n)))+" · "+m(x.pluginName)+m(Y?` — ${Y}`:""),9,Ph))),128)),(d(!0),u(ne,null,he((k=a(o).directory)==null?void 0:k.errors,x=>(d(),u("option",{key:x.pluginName,disabled:""},m(x.pluginName)+": "+m(x.message),1))),128))],40,Oh),a(o).error?(d(),u("span",zh,m(a(o).error),1)):D("",!0)])}}}),Pn=Ae(Dh,[["__scopeId","data-v-9c4c5caa"]]);function Nh(s){const t=s.trim();if(t==="")return{form:"show"};const e=t.search(/\s/),n=e===-1?t:t.slice(0,e),o=e===-1?"":t.slice(e).trim();switch(n){case"pause":case"resume":case"clear":if(o==="")return{form:n};break;case"set":case"edit":return o===""?void 0:{form:n,objective:o}}return{form:"objective",objective:t}}function jh(s){switch(s.form){case"show":case"pause":case"resume":case"clear":return;default:return s.objective}}function Bh(s,t){switch(s.form){case"show":return;case"objective":return t!==void 0&&(t.status.kind==="active"||t.status.kind==="paused")?"edit":"set";default:return s.form}}const Fh={key:0,class:"removed-state route-page"},Wh={"data-route-heading":"",tabindex:"-1"},Vh={key:1,class:"removed-state route-page"},Uh={"data-route-heading":"",tabindex:"-1"},Hh={role:"alert"},Kh={key:2,class:"chat-loading","aria-busy":"true"},Qh={class:"sr-only"},Gh={key:3,class:"chat-page"},Jh={class:"chat-page-top"},Yh={class:"session-header"},Xh=["aria-label"],Zh={class:"session-heading"},em=["title"],tm=["title"],sm=["aria-label"],nm=["data-tone"],om={key:2,class:"ui-badge session-running","data-tone":"primary"},im={key:0,class:"session-relations"},am={key:0,class:"composer-panel"},rm={key:1,class:"composer-panel"},lm={key:2,class:"composer-panel question-prompts"},dm=ke({__name:"ChatPage",props:{sessionId:{}},setup(s){const t=s,{t:e}=ye(),n=Qt(),o=Qe(),i=Me(),r=Ke(),l=Ve(),h=$t(),g=Wt(),I=R();$e(()=>t.sessionId,O=>o.open(O),{immediate:!0});const v=E(()=>o.views[t.sessionId]),_=E(()=>r.byId.get(t.sessionId)),w=E(()=>{var O,Z;return((O=_.value)==null?void 0:O.title)??((Z=_.value)==null?void 0:Z.preview)??e("sidebar.untitled")}),b=E(()=>{var O;return(O=_.value)==null?void 0:O.parentSessionId}),k=E(()=>b.value===void 0?void 0:r.byId.get(b.value)),x=E(()=>r.summaries.filter(O=>O.parentSessionId===t.sessionId)),C=E(()=>{var O;return(O=v.value)==null?void 0:O.approvals.find(Z=>Z.branchId===de)}),Y=E(()=>{var O;return((O=v.value)==null?void 0:O.questions.filter(Z=>Z.branchId===de))??[]}),X=E(()=>i.supports("permission.rules")&&i.supports("permission.set_rules")),F=E(()=>{var O;return((O=v.value)==null?void 0:O.methods.includes("attachment.put"))===!0}),P=E(()=>{var O;return(O=v.value)!=null&&O.methods.includes("session.files.search")?Z=>o.searchFiles(t.sessionId,Z):void 0}),j=E(()=>{const O=v.value;if(!((O==null?void 0:O.status)!=="ready"||!O.methods.includes("session.permission.get")||!O.methods.includes("session.permission.update")))return{policy:O.permission,select:at}}),$=E(()=>{var O;return l.approvalKeyboard(t.sessionId,de,((O=v.value)==null?void 0:O.approvals)??[])}),M=R(),T=E(()=>{var O;return((O=v.value)==null?void 0:O.lines.filter(Z=>Z.id!==de).length)??0}),W=E(()=>{var Z,p;const O=((Z=v.value)==null?void 0:Z.approvals)??[];return((p=v.value)==null?void 0:p.lines.some(f=>f.id!==de&&(f.state.kind==="working"||O.some(y=>y.branchId===f.id))))??!1}),se=E(()=>{var O;return i.supports("session.branch_end")&&((O=v.value)==null?void 0:O.status)==="ready"}),le=E(()=>{var O;return i.supports("session.branch_create")&&((O=v.value)==null?void 0:O.status)==="ready"}),ge=E(()=>{var p,f,y;const O=(p=v.value)==null?void 0:p.model;if(O===void 0)return;const Z=(y=(f=n.providers)==null?void 0:f.find(q=>q.providerId===O.providerId))==null?void 0:y.models.find(q=>q.id===O.modelId);return Z==null?void 0:Z.reasoningEfforts});$e(()=>{var O;return(O=v.value)==null?void 0:O.status},O=>{O==="ready"&&n.load()},{immediate:!0});const J=E(()=>{const O=v.value;if((O==null?void 0:O.status)==="ready")return{compact:O.methods.includes("session.context.compact")?Pe:void 0,usage:O.methods.includes("session.context.usage")?Ge:void 0,fork:i.supports("session.fork")&&O.lastTurnEnd!==void 0?ht:void 0,goal:O.methods.includes("session.goal.set")?Ue:void 0,effort:ge.value!==void 0&&ge.value.length>0?Be:void 0}});function re(O,Z){return o.submit(t.sessionId,de,O,Z)}function z(){return o.stop(t.sessionId,de)}function L(O){return o.setModel(t.sessionId,O)}function H(O){o.ensureLine(t.sessionId,O),l.openLine(t.sessionId,O)}function me(O,Z){l.requestNewLine({sessionId:t.sessionId,parentBranchId:de,at:Z,text:O})}async function V(O){var f;const Z=(f=v.value)==null?void 0:f.lastTurnEnd;if(Z===void 0)throw new Error(e("lines.noFinishedTurn"));const p=await o.createLine(t.sessionId,de,Z,O);l.openLine(t.sessionId,p)}function ue(O){h.push({tone:"danger",title:e("command.failed"),description:O instanceof Error?O.message:String(O)})}async function Pe(){try{const O=await o.compact(t.sessionId);O.status==="completed"?h.push({tone:"success",title:e("command.compacted")}):h.push({tone:"info",title:e("command.compactSkipped"),description:O.reason})}catch(O){ue(O)}}function Ze(O){const Z=Math.round(O.estimatedInputTokens),p=Math.round(O.contextWindow);return e("command.usage",{input:Z.toLocaleString(),window:p.toLocaleString(),percent:p>0?Math.floor(Z*100/p):0,basis:O.baselineSource==="provider_baseline"?e("command.basisProvider"):e("command.basisEstimated"),output:Math.round(O.outputTokens).toLocaleString(),threshold:Math.round(O.thresholdTokens).toLocaleString()})}async function Ge(){try{h.push({tone:"info",title:e("command.usageTitle"),description:Ze(await o.usage(t.sessionId))})}catch(O){ue(O)}}function tt(O){switch(O.kind){case"active":return e("goal.status.active");case"paused":return e("goal.status.paused",{reason:O.reason.replaceAll("_"," ")});case"completed":return e("goal.status.completed");case"blocked":return e("goal.status.blocked");case"none":return e("goal.status.none")}}function ze(O){if(O===void 0){h.push({tone:"info",title:e("goal.none")});return}h.push({tone:"info",title:`${e("goal.line",{status:tt(O.status)})}${O.evaluator?` · ${e("goal.evaluator")}`:""}`,description:O.objective})}async function Ue(O){var y;const Z=Nh(O);if(Z===void 0){h.push({tone:"info",title:e("goal.usage")});return}const p=(y=v.value)==null?void 0:y.goal,f=Bh(Z,p);if(f===void 0){ze(p);return}try{await o.writeGoal(t.sessionId,f,jh(Z)),h.push({tone:"success",title:e("goal.sent",{action:e(`goal.action.${f}`)})})}catch(q){ue(q)}}async function Be(O){const Z=ge.value,p=O.trim();if(Z===void 0){h.push({tone:"info",title:e("command.effortUnavailable")});return}if(p===""){h.push({tone:"info",title:e("command.effortChoices",{choices:Z.join(", ")})});return}if(/\s/.test(p)){h.push({tone:"info",title:e("command.effortUsage")});return}if(!Z.includes(p)){h.push({tone:"danger",title:e("command.effortUnknown")});return}try{const f=await o.setEffort(t.sessionId,p);h.push({tone:"success",title:e("command.effortSet",{outcome:f,value:p})})}catch(f){ue(f)}}async function at(O){try{await o.setPermission(t.sessionId,O)==="conflict"&&h.push({tone:"info",title:e("permission.conflict")})}catch(Z){ue(Z)}}async function ht(){var Z,p;const O=(Z=v.value)==null?void 0:Z.lastTurnEnd;if(O!==void 0&&await((p=I.value)==null?void 0:p.open(e("fork.confirm"),{confirmLabel:e("fork.confirmLabel")})))try{const f=await o.fork(t.sessionId,O);r.refresh(),await g.push({name:"chat-session",params:{sessionId:f}})}catch(f){ue(f)}}return(O,Z)=>{var p,f;return((p=v.value)==null?void 0:p.status)==="closed"?(d(),u("section",Fh,[c("h1",Wh,m(a(e)("chat.removedTitle")),1),c("p",null,m(a(e)("chat.removedDescription")),1),G(a(ut),{to:"/chat/new"},{default:We(()=>[be(m(a(e)("sidebar.newSession")),1)]),_:1})])):((f=v.value)==null?void 0:f.status)==="failed"?(d(),u("section",Vh,[c("h1",Uh,m(w.value),1),c("p",Hh,m(v.value.error),1)])):!v.value||v.value.status==="loading"?(d(),u("section",Kh,[c("h1",Qh,m(a(e)("route.session")),1),G(Ut,{animated:"",class:"boot-mark"}),c("p",null,m(a(e)("common.loading")),1)])):(d(),u("section",Gh,[G(Tn,{ref_key:"forkConfirm",ref:I},null,512),c("div",Jh,[c("header",Yh,[a(l).shellMode==="compact"?(d(),u("button",{key:0,class:"ui-icon-button session-nav","data-variant":"ghost","data-size":"md",type:"button","aria-label":a(e)("sidebar.openMenu"),onClick:Z[0]||(Z[0]=y=>a(l).drawerOpen=!0)},[G(a(nn),{"aria-hidden":"true"})],8,Xh)):D("",!0),c("div",Zh,[_.value?(d(),u(ne,{key:0},[c("span",{class:"workspace-crumb",title:_.value.cwd},m(a(Kt)(_.value.cwd)),9,em),Z[4]||(Z[4]=c("span",{class:"workspace-crumb-separator","aria-hidden":"true"},"/",-1))],64)):D("",!0),c("h1",{"data-route-heading":"",tabindex:"-1",title:w.value},m(w.value),9,tm)]),G(Pn,{"session-id":s.sessionId},null,8,["session-id"]),a(i).supports("session.branch_end")?(d(),u("button",{key:1,class:"ui-button session-lines","data-variant":"ghost","data-size":"sm",type:"button","aria-label":a(e)("lines.open"),onClick:Z[1]||(Z[1]=y=>a(l).toggleLines(s.sessionId))},[G(a(ft),{"aria-hidden":"true"}),c("span",null,m(a(e)("lines.title")),1),T.value>0?(d(),u("span",{key:0,class:"ui-badge","data-size":"sm","data-tone":W.value?"warning":void 0},m(T.value),9,nm)):D("",!0)],8,sm)):D("",!0),v.value.sessionRunning?(d(),u("span",om,[Z[5]||(Z[5]=c("span",{class:"status-dot","data-state":"running","aria-hidden":"true"},null,-1)),be(m(a(e)(v.value.stopping?"status.stopping":"status.running")),1)])):D("",!0)]),b.value||x.value.length?(d(),u("div",im,[b.value?(d(),ae(a(ut),{key:0,to:{name:"chat-session",params:{sessionId:b.value}}},{default:We(()=>{var y,q;return[be(m(a(e)("session.parent",{title:((y=k.value)==null?void 0:y.title)??((q=k.value)==null?void 0:q.preview)??b.value})),1)]}),_:1},8,["to"])):D("",!0),x.value.length?(d(),u("details",{key:s.sessionId},[c("summary",null,m(a(e)("session.children",{count:x.value.length})),1),c("ul",null,[(d(!0),u(ne,null,he(x.value,y=>(d(),u("li",{key:y.sessionId},[G(a(ut),{to:{name:"chat-session",params:{sessionId:y.sessionId}}},{default:We(()=>[be(m(y.title??y.preview??y.sessionId),1)]),_:2},1032,["to"])]))),128))])])):D("",!0)])):D("",!0)]),G(On,{rows:v.value.rows,earlier:v.value.earlier,"loading-earlier":v.value.loadingEarlier,"history-error":v.value.historyError,onEarlier:Z[2]||(Z[2]=y=>a(o).loadEarlier(s.sessionId,"main")),running:v.value.running,retry:v.value.retry,quotable:!C.value&&Y.value.length===0,branchable:se.value&&!C.value&&Y.value.length===0,onBranch:me,onOpenLine:H,onQuote:Z[3]||(Z[3]=y=>{var q;return(q=M.value)==null?void 0:q.quote(y)})},null,8,["rows","earlier","loading-earlier","history-error","running","retry","quotable","branchable"]),v.value.running&&v.value.queued.length?(d(),u("div",am,[G(qh,{"session-id":s.sessionId,items:v.value.queued},null,8,["session-id","items"])])):D("",!0),C.value?(d(),u("div",rm,[(d(),ae(En,{key:JSON.stringify([C.value.branchId,C.value.requestId]),"session-id":s.sessionId,request:C.value,keyboard:$.value,"rules-available":X.value},null,8,["session-id","request","keyboard","rules-available"]))])):Y.value.length?(d(),u("div",lm,[(d(!0),u(ne,null,he(Y.value,y=>(d(),ae(qn,{key:JSON.stringify([y.branchId,y.requestId,y.callId]),"session-id":s.sessionId,question:y},null,8,["session-id","question"]))),128))])):(d(),ae(fs,{key:3,ref_key:"composer",ref:M,running:v.value.running,stopping:v.value.stopping,model:v.value.model,send:re,"stores-pastes":F.value,"search-files":P.value,permission:j.value,stop:z,"model-selectable":a(i).supports("session.model.update"),"select-model":L,"create-branch":le.value?V:void 0,"open-lines":se.value?()=>a(l).openLines(s.sessionId):void 0,"session-commands":J.value},null,8,["running","stopping","model","stores-pastes","search-files","permission","model-selectable","create-branch","open-lines","session-commands"]))]))}}}),cm=Ae(dm,[["__scopeId","data-v-af9bf5bd"]]),um={class:"new-session-page"},pm={class:"new-session-hero"},hm={"data-route-heading":"",tabindex:"-1"},mm={class:"ui-button","data-variant":"ghost","data-size":"xs","data-trailing":""},vm={class:"workspace-trigger-label"},fm={class:"composer-popover-content workspace-menu-content ui-popover","data-width":"lg"},gm=["placeholder","aria-label"],bm=["disabled"],ym={key:0,class:"ui-menu-separator"},wm=["aria-label"],km=["aria-selected","onClick"],_m={class:"ui-menu-desc workspace-path"},Im=ke({__name:"NewSessionPage",setup(s){const{t}=ye(),e=Ft(),n=Wt(),o=Ke(),i=Qe(),r=Qt(),l=R(),h=R(typeof e.query.cwd=="string"?e.query.cwd:""),g=R("");$e(()=>o.workspaces,x=>{h.value===""&&x[0]!==void 0&&(h.value=x[0].cwd)},{immediate:!0});const I=R(),v=R();$e(h,async x=>{if(v.value=void 0,x==="")return;const C=await r.defaultFor(x);h.value===x&&(v.value=C)},{immediate:!0});const _=E(()=>I.value??v.value);function w(x){h.value=x,l.value&&(l.value.open=!1)}function b(){const x=g.value.trim();x!==""&&(w(x),g.value="")}async function k(x){if(h.value==="")throw new Error(t("newThread.workspaceRequired"));const C=await o.create(h.value,I.value);i.open(C),await i.submit(C,de,x),await n.push({name:"chat-session",params:{sessionId:C}})}return(x,C)=>{const Y=vt("tooltip");return d(),u("section",um,[c("div",pm,[G(Ut,{class:"new-session-mark"}),c("h1",hm,m(a(t)("newThread.title")),1),G(Pn)]),G(fs,{class:"is-new-thread",running:!1,model:_.value,"model-selectable":!0,send:k,attachments:!1,"select-model":X=>{I.value=X}},{status:We(()=>[c("details",{ref_key:"menu",ref:l,class:"composer-popover workspace-menu"},[Ne((d(),u("summary",mm,[G(a(ss),{"aria-hidden":"true"}),c("span",vm,m(h.value?a(Kt)(h.value):a(t)("newThread.selectWorkspace")),1),G(a(as),{class:"workspace-chevron","aria-hidden":"true"})])),[[Y,h.value||void 0]]),c("div",fm,[c("form",{class:"workspace-path-form",onSubmit:Se(b,["prevent"])},[Ne(c("input",{"onUpdate:modelValue":C[0]||(C[0]=X=>g.value=X),class:"ui-field","data-size":"sm",type:"text",spellcheck:"false",autocapitalize:"off",placeholder:a(t)("newThread.pathPlaceholder"),"aria-label":a(t)("newThread.pathLabel")},null,8,gm),[[At,g.value]]),c("button",{type:"submit",class:"ui-button","data-variant":"secondary","data-size":"sm",disabled:g.value.trim()===""},m(a(t)("newThread.usePath")),9,bm)],32),a(o).workspaces.length?(d(),u("hr",ym)):D("",!0),c("div",{class:"workspace-list",role:"listbox","aria-label":a(t)("sidebar.workspaces")},[(d(!0),u(ne,null,he(a(o).workspaces,X=>(d(),u("button",{key:X.cwd,type:"button",role:"option",class:"ui-menu-item","data-two-line":"","aria-selected":X.cwd===h.value,onClick:F=>w(X.cwd)},[G(a(ss),{"aria-hidden":"true"}),c("span",null,[be(m(X.name),1),c("span",_m,m(X.cwd),1)]),X.cwd===h.value?(d(),ae(a(It),{key:0,class:"ui-menu-check","aria-hidden":"true"})):D("",!0)],8,km))),128))],8,wm)])],512)]),_:1},8,["model","select-model"])])}}}),$m=Ae(Im,[["__scopeId","data-v-eebc871b"]]),xm={class:"chat-loading","aria-busy":"true"},Cm=ke({__name:"RootRedirect",setup(s){const{t}=ye(),e=Wt(),n=Ke(),o=Ve();return $e(()=>n.loaded||n.error!=="",i=>{if(!i)return;const r=o.lastSessionId;e.replace(r!==void 0&&n.byId.has(r)?{name:"chat-session",params:{sessionId:r}}:{name:"chat-new"})},{immediate:!0}),(i,r)=>(d(),u("section",xm,[c("p",null,m(a(t)("common.loading")),1)]))}}),Sm={class:"route-page app-scroll-viewport"},Em={"data-route-heading":"",tabindex:"-1"},Mm={class:"page-description"},Tm=ke({__name:"NotFoundView",setup(s){const{t}=ye();return(e,n)=>(d(),u("section",Sm,[G(a(no),{size:20,class:"state-icon","aria-hidden":"true"}),c("h1",Em,m(a(t)("route.notFound")),1),c("p",Mm,m(a(t)("page.notFoundDescription")),1),G(a(ut),{to:"/chat/new"},{default:We(()=>[be(m(a(t)("sidebar.newSession")),1)]),_:1})]))}}),zn=Hn({history:Kn(),routes:[{path:"/",name:"root",component:Cm},{path:"/chat/new",name:"chat-new",component:$m},{path:"/chat/:sessionId",name:"chat-session",component:cm,props:!0},{path:"/settings",component:()=>Ee(()=>import("./SettingsPage-B76s7xMI.js"),__vite__mapDeps([2,1,3,4,5])),children:[{path:"",name:"settings-index",component:{render:()=>null}},{path:"account",name:"settings-account",component:()=>Ee(()=>import("./AccountSettings-nyVX4bl3.js"),__vite__mapDeps([6,1,7,8,3,9,10]))},{path:"appearance",name:"settings-appearance",component:()=>Ee(()=>import("./AppearanceSettings-BoOhVnFz.js"),__vite__mapDeps([11,7,1,12]))},{path:"agent",name:"settings-agent",component:()=>Ee(()=>import("./AgentSettings-C6opxYYo.js"),__vite__mapDeps([13,1,7,14,3]))},{path:"providers",name:"settings-providers",component:()=>Ee(()=>import("./ProviderSettings-DwxeUHLU.js"),__vite__mapDeps([15,1,8,3,4,9,16]))},{path:"providers/new",name:"settings-provider-new",component:()=>Ee(()=>import("./ProviderSettings-DwxeUHLU.js"),__vite__mapDeps([15,1,8,3,4,9,16]))},{path:"providers/:providerId",name:"settings-provider-detail",component:()=>Ee(()=>import("./ProviderSettings-DwxeUHLU.js"),__vite__mapDeps([15,1,8,3,4,9,16]))},{path:"modality",name:"settings-modality",component:()=>Ee(()=>import("./ModalitySettings-DprOf77o.js"),__vite__mapDeps([17,1,7,14,3,9]))},{path:"mcp/:serverId?",name:"settings-mcp",component:()=>Ee(()=>import("./McpSettings-rHDDYrKl.js"),__vite__mapDeps([18,1,7,14,3,19]))},{path:"plugins/:pluginId?",name:"settings-plugins",component:()=>Ee(()=>import("./PluginSettings-DvJj4pme.js"),__vite__mapDeps([20,1,7,14,3,21]))},{path:"skills/:skillId?",name:"settings-skills",component:()=>Ee(()=>import("./SkillSettings-BQ774cUK.js"),__vite__mapDeps([22,1,7,14,3,9,23]))},{path:"permissions/:page?",name:"settings-permissions",component:()=>Ee(()=>import("./PermissionsSettings-DtADZ5dp.js"),__vite__mapDeps([24,1,7,14,3,25]))},{path:"scheduled",name:"settings-scheduled",component:()=>Ee(()=>import("./ScheduledSettings-D9YosCWp.js"),__vite__mapDeps([26,1,7,3,5,9,4,27]))},{path:"scheduled/new",name:"settings-scheduled-new",component:()=>Ee(()=>import("./ScheduledSettings-D9YosCWp.js"),__vite__mapDeps([26,1,7,3,5,9,4,27]))},{path:"scheduled/:jobId",name:"settings-scheduled-detail",component:()=>Ee(()=>import("./ScheduledSettings-D9YosCWp.js"),__vite__mapDeps([26,1,7,3,5,9,4,27]))},{path:"scheduled/:jobId/edit",name:"settings-scheduled-edit",component:()=>Ee(()=>import("./ScheduledSettings-D9YosCWp.js"),__vite__mapDeps([26,1,7,3,5,9,4,27]))},{path:"archived",name:"settings-archived",component:()=>Ee(()=>import("./ArchivedSettings-D5tDripk.js"),__vite__mapDeps([28,1,7,14,3,29]))},{path:"diagnostics",name:"settings-diagnostics",component:()=>Ee(()=>import("./DiagnosticsSettings-DJcBCpEy.js"),__vite__mapDeps([30,1,7,14,3,31]))}]},{path:"/:pathMatch(.*)*",name:"not-found",component:Tm}]});zn.afterEach(s=>{s.name==="chat-session"&&typeof s.params.sessionId=="string"&&(Ve().lastSessionId=s.params.sessionId)});$e(_t.global.locale,s=>{document.documentElement.lang=s},{immediate:!0});const zt=Qn();Ve(zt);Promise.all([_i(),fn(ms(zt).language||navigator.language)]).then(()=>{Me(zt).client.start(),Gn(ch).use(zt).use(_t).use(zn).directive("tooltip",_h).mount("#app"),setTimeout(()=>void Ln(),0)});export{Vm as A,Ut as B,sn as C,Um as D,Bm as E,Fm as F,Nm as G,rs as H,Dt as I,ms as J,as as K,It as L,rn as M,Ve as N,$t as O,Te as P,ct as R,ls as S,$o as W,yt as X,Ee as _,Qt as a,Ke as b,fe as c,Om as d,Rm as e,Qi as f,Ji as g,Ym as h,Tn as i,bt as j,gs as k,Ae as l,zm as m,Pm as n,Gi as o,Gm as p,Jm as q,Lm as r,ds as s,Hm as t,Me as u,Km as v,Qm as w,jm as x,Dm as y,Wm as z};
|