meshy-node 0.1.8 → 0.1.9
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/README.md +1 -1
- package/dashboard/assets/DashboardPage-Da_VtP_l.js +172 -0
- package/dashboard/assets/{DiffTab-L7XOR2ma.js → DiffTab-C1s6zab_.js} +4 -4
- package/dashboard/assets/{FilesTab-MiZ3rGO0.js → FilesTab-oATTYGJa.js} +5 -5
- package/dashboard/assets/{PreviewTab-DdT_r4GF.js → PreviewTab--9Iy_Xpu.js} +4 -4
- package/dashboard/assets/{file-DP1hVNzm.js → file-XG11YnWT.js} +1 -1
- package/dashboard/assets/index-C49tlczJ.js +249 -0
- package/dashboard/assets/index-DOX-2CnC.css +1 -0
- package/dashboard/index.html +2 -2
- package/main.cjs +755 -287
- package/package.json +2 -1
- package/runtime-metadata.json +31 -0
- package/dashboard/assets/DashboardPage-Bu_7sWoy.js +0 -256
- package/dashboard/assets/index-2UShBZ7T.css +0 -1
- package/dashboard/assets/index-Dc0APxmT.js +0 -115
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-MiZ3rGO0.js","assets/index-Dc0APxmT.js","assets/index-2UShBZ7T.css","assets/file-DP1hVNzm.js","assets/PreviewTab-DdT_r4GF.js","assets/DiffTab-L7XOR2ma.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as G,r as i,j as r,R as xo,a as nc,b as En,u as le,d as rc,e as W,f as sc,g as oc,h as ac,B as Se,i as q,k as it,l as go,m as ic,n as lc,t as pe,T as vo,P as cc,_ as Dr,o as dc,N as bo,p as yo,q as uc,s as fc,v as mc,w as pc,x as hc,y as xc,z as gc,A as vc,C as bc,D as yc,E as wc,F as Nc,G as jc,H as kc,I as Cc,J as Sc,K as Ec}from"./index-Dc0APxmT.js";/**
|
|
3
|
-
* @license lucide-react v1.7.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 Ac=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Tc=G("archive",Ac);/**
|
|
8
|
-
* @license lucide-react v1.7.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 Rc=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],_c=G("arrow-up",Rc);/**
|
|
13
|
-
* @license lucide-react v1.7.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 Pc=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Mr=G("bot",Pc);/**
|
|
18
|
-
* @license lucide-react v1.7.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 Dc=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],Mc=G("brain",Dc);/**
|
|
23
|
-
* @license lucide-react v1.7.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 Oc=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],He=G("check",Oc);/**
|
|
28
|
-
* @license lucide-react v1.7.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 Ic=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Tt=G("chevron-down",Ic);/**
|
|
33
|
-
* @license lucide-react v1.7.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
|
-
*/const $c=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Or=G("chevron-right",$c);/**
|
|
38
|
-
* @license lucide-react v1.7.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 Lc=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ir=G("chevron-up",Lc);/**
|
|
43
|
-
* @license lucide-react v1.7.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 Fc=[["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"}]],Bc=G("circle-question-mark",Fc);/**
|
|
48
|
-
* @license lucide-react v1.7.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 Uc=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Wc=G("circle-x",Uc);/**
|
|
53
|
-
* @license lucide-react v1.7.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 Vc=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],zc=G("circle",Vc);/**
|
|
58
|
-
* @license lucide-react v1.7.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 Hc=[["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"}]],An=G("copy",Hc);/**
|
|
63
|
-
* @license lucide-react v1.7.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 Kc=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],wo=G("external-link",Kc);/**
|
|
68
|
-
* @license lucide-react v1.7.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 qc=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],Gc=G("flag",qc);/**
|
|
73
|
-
* @license lucide-react v1.7.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 Yc=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],Xc=G("folder-tree",Yc);/**
|
|
78
|
-
* @license lucide-react v1.7.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 Jc=[["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"}]],Zc=G("folder",Jc);/**
|
|
83
|
-
* @license lucide-react v1.7.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 Qc=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],ed=G("funnel",Qc);/**
|
|
88
|
-
* @license lucide-react v1.7.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 td=[["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"}]],nd=G("globe",td);/**
|
|
93
|
-
* @license lucide-react v1.7.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 rd=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],sd=G("history",rd);/**
|
|
98
|
-
* @license lucide-react v1.7.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 od=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],fr=G("image-plus",od);/**
|
|
103
|
-
* @license lucide-react v1.7.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 ad=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],id=G("laptop",ad);/**
|
|
108
|
-
* @license lucide-react v1.7.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 ld=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],cd=G("list-checks",ld);/**
|
|
113
|
-
* @license lucide-react v1.7.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 dd=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ee=G("loader-circle",dd);/**
|
|
118
|
-
* @license lucide-react v1.7.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 ud=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],No=G("message-square-plus",ud);/**
|
|
123
|
-
* @license lucide-react v1.7.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 fd=[["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"}]],jo=G("panel-left-close",fd);/**
|
|
128
|
-
* @license lucide-react v1.7.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 md=[["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"}]],pd=G("panel-left-open",md);/**
|
|
133
|
-
* @license lucide-react v1.7.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 hd=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],ko=G("panel-right-close",hd);/**
|
|
138
|
-
* @license lucide-react v1.7.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 xd=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],gd=G("panel-right-open",xd);/**
|
|
143
|
-
* @license lucide-react v1.7.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 vd=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],$r=G("pencil",vd);/**
|
|
148
|
-
* @license lucide-react v1.7.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 bd=[["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"}]],yd=G("rotate-ccw",bd);/**
|
|
153
|
-
* @license lucide-react v1.7.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 wd=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],As=G("search",wd);/**
|
|
158
|
-
* @license lucide-react v1.7.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 Nd=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Co=G("send",Nd);/**
|
|
163
|
-
* @license lucide-react v1.7.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 jd=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],kd=G("shield-alert",jd);/**
|
|
168
|
-
* @license lucide-react v1.7.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 Cd=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Sd=G("shield-check",Cd);/**
|
|
173
|
-
* @license lucide-react v1.7.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 Ed=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],Ad=G("sliders-horizontal",Ed);/**
|
|
178
|
-
* @license lucide-react v1.7.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 Td=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Rd=G("trash-2",Td);/**
|
|
183
|
-
* @license lucide-react v1.7.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 _d=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Pd=G("user",_d);/**
|
|
188
|
-
* @license lucide-react v1.7.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 Dd=[["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"}]],So=G("wrench",Dd);/**
|
|
193
|
-
* @license lucide-react v1.7.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 Md=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],kt=G("x",Md),Od=new Set(["assigned","running"]);function Id(e,t){return e.reduce((n,s)=>s.assignedTo===t&&Od.has(s.status)?n+1:n,0)}function Rt(e){return(e==null?void 0:e.toLowerCase())==="devtunnel"}function $d(e){return e?Rt(e)?"DevTunnel":e.charAt(0).toUpperCase()+e.slice(1):"Direct"}function Lr(e,t){return Rt(t??e.transportType)||!!e.devtunnelEndpoint}function Eo(e,t){return!Rt(t??e.transportType)}function Ao(e,t){const n=t??e.transportType;return Rt(n)?"DevTunnel":e.devtunnelEndpoint?"Direct + DevTunnel":$d(n)}function Ts(e,t){return!e&&!t}function Ld({routeTaskId:e,creatingTask:t,internalSelectedTaskId:n,sortedTaskIds:s}){return e||(t?null:n??s[0]??null)}function Fd(e,t){return[t,...e.filter(n=>n.id!==t.id)]}const Bd=new Set(["completed","failed","cancelled","archived"]);function Ud(e,t){const n=new Set(t);return new Set(Array.from(e).filter(s=>n.has(s)))}function Wd(e,t){const n=new Set(t);if(n.size===0)return!1;const s=e.filter(o=>n.has(o.id));return s.length===n.size&&s.every(o=>Bd.has(o.status))}function Vd(e,t){var s;const n=new Set(t);return((s=e.find(o=>!n.has(o.id)))==null?void 0:s.id)??null}function un(e){return typeof e=="object"&&e!==null}function zd(e){if(!un(e))return null;if(e.type==="text"&&typeof e.text=="string"){const t=e.text.trim();return t?{type:"text",text:t}:null}if(e.type==="image"&&typeof e.mediaType=="string"&&typeof e.data=="string"){const t=e.mediaType.trim(),n=e.data;return!t||!n?null:{type:"image",mediaType:t,data:n,...typeof e.filename=="string"&&e.filename.trim()?{filename:e.filename.trim()}:{}}}if(e.type==="tool_result"&&typeof e.toolUseId=="string"&&typeof e.content=="string"){const t=e.toolUseId.trim(),n=e.content.trim();return!t||!n?null:{type:"tool_result",toolUseId:t,content:n,...typeof e.isError=="boolean"?{isError:e.isError}:{}}}return null}function Hd(e){if(!un(e))return null;if(e.type==="text"&&typeof e.text=="string"){const s=e.text.trim();return s?{type:"text",text:s}:null}if(e.type!=="image"||!un(e.source)){if(e.type==="tool_result"&&typeof e.tool_use_id=="string"&&typeof e.content=="string"){const s=e.tool_use_id.trim(),o=e.content.trim();return!s||!o?null:{type:"tool_result",toolUseId:s,content:o,...typeof e.is_error=="boolean"?{isError:e.is_error}:{}}}return null}const t=typeof e.source.media_type=="string"?e.source.media_type.trim():"",n=typeof e.source.data=="string"?e.source.data:"";return!t||!n?null:{type:"image",mediaType:t,data:n}}function Lt(e){if(typeof e=="string"){const t=e.trim();return t?[{type:"text",text:t}]:[]}return Array.isArray(e)?e.map(t=>zd(t)??Hd(t)).filter(t=>t!==null):[]}function To(e,t){const n=e.trim();return[...n?[{type:"text",text:n}]:[],...t]}function Kd(e){return{role:"user",content:e.map(t=>t.type==="text"?{type:"text",text:t.text}:t.type==="tool_result"?{type:"tool_result",tool_use_id:t.toolUseId,content:t.content,...typeof t.isError=="boolean"?{is_error:t.isError}:{}}:{type:"image",source:{type:"base64",media_type:t.mediaType,data:t.data}})}}function Jn(e,t=new Date().toISOString()){return{type:"user",message:Kd(e),timestamp:t}}function Kt(e){if(e.type!=="user"||e.isSynthetic===!0)return null;if(typeof e.message=="string"){const t=Lt(e.message);return t.length>0?t:null}if(un(e.message)&&Array.isArray(e.message.content)){const t=Lt(e.message.content);return t.length>0?t:null}if(Array.isArray(e.content)){const t=Lt(e.content);return t.length>0?t:null}return null}function qd(e){return Lt(e.payload.initialMessage)}function Bt(e){return e.map(t=>{if(t.type==="text")return`t:${t.text}`;if(t.type==="tool_result")return`r:${t.toolUseId}:${t.isError===!0?"1":"0"}:${t.content}`;const n=t.data.slice(0,32),s=t.data.slice(-32);return`i:${t.mediaType}:${t.data.length}:${n}:${s}`}).join("|")}function Gd(e){return e.map(t=>t.type==="text"?t.text:t.type==="tool_result"?t.content:"").filter(Boolean).join(`
|
|
198
|
-
`)}function Fr(e){return`data:${e.mediaType};base64,${e.data}`}function Yd(e){var o,a;if(!e)return[];const t=[],n=e.items;if(n)for(const l of Array.from(n)){if((l==null?void 0:l.kind)!=="file"||!((o=l.type)!=null&&o.startsWith("image/")))continue;const c=(a=l.getAsFile)==null?void 0:a.call(l);c&&c.type.startsWith("image/")&&t.push(c)}if(t.length>0)return t;const s=e.files;return s?Array.from(s).filter(l=>l.type.startsWith("image/")):[]}function Xd(e){return new Promise((t,n)=>{const s=new FileReader;s.onload=()=>{if(typeof s.result!="string"){n(new Error(`Failed to read ${e.name}`));return}t(s.result)},s.onerror=()=>n(s.error??new Error(`Failed to read ${e.name}`)),s.readAsDataURL(e)})}async function Rs(e){return Promise.all(Array.from(e).map(async t=>{if(!t.type.startsWith("image/"))throw new Error(`${t.name} is not an image`);const n=await Xd(t),s=n.indexOf(",");if(s===-1)throw new Error(`Failed to parse ${t.name}`);return{type:"image",mediaType:t.type||"image/png",data:n.slice(s+1),filename:t.name}}))}function qt(e){return typeof e=="object"&&e!==null}function Jd(e){return qt(e)&&typeof e.name=="string"&&e.name.toLowerCase()==="askuserquestion"}function Zd(e){return!qt(e)||typeof e.label!="string"||!e.label.trim()?null:{label:e.label.trim(),description:typeof e.description=="string"?e.description.trim():""}}function Qd(e){if(!qt(e)||typeof e.question!="string"||!e.question.trim())return null;const t=Array.isArray(e.options)?e.options.map(Zd).filter(n=>n!==null):[];return t.length===0?null:{header:typeof e.header=="string"&&e.header.trim()?e.header.trim():void 0,question:e.question.trim(),multiSelect:e.multiSelect===!0,options:t}}function mr(e){if(!qt(e)||!Array.isArray(e.questions))return null;const t=e.questions.map(Qd).filter(n=>n!==null);return t.length===0?null:{questions:t}}function _t(e){return JSON.stringify({questions:e.questions})}function Tn(e){const t=mr(e);if(t)return t;if(Jd(e)){const n=qt(e.input)?e.input:void 0,s=mr(n);return s?{...s,...typeof e.id=="string"&&e.id.trim()?{toolUseId:e.id.trim()}:{}}:null}return null}function eu(e){var o;const t=e.trim();if(!t)return[];const n=[t],s=t.matchAll(/```(?:json)?\s*([\s\S]*?)```/gi);for(const a of s){const l=(o=a[1])==null?void 0:o.trim();l&&n.push(l)}return n}function Rn(e){for(const t of eu(e))try{const n=JSON.parse(t),s=mr(n);if(s)return s}catch{}return null}function tu(e){return e.questions.map(t=>t.options.length>0?[0]:[])}function nu(e,t){return e.questions.every((n,s)=>(t[s]??[]).length>0)}function ru(e,t){const s=e.questions.map((o,a)=>{const l=[...new Set(t[a]??[])].sort((c,d)=>c-d).filter(c=>o.options[c]!==void 0);return{header:o.header??null,question:o.question,multiSelect:o.multiSelect,selectedOptions:l.map(c=>o.options[c]).filter(c=>c!==void 0)}}).map(o=>{const a=o.header??o.question,l=o.selectedOptions.map(c=>c.label).join(o.multiSelect?", ":"");return`${a}: ${l}`}).join(`
|
|
199
|
-
`);return e.toolUseId?[{type:"tool_result",toolUseId:e.toolUseId,content:s,isError:!1}]:[{type:"text",text:s}]}function Ut(e){return typeof e=="object"&&e!==null}function su(e){if(!e)return;const t=["file_path","path","command"].map(n=>e[n]).find(n=>typeof n=="string"&&n.trim().length>0);return t==null?void 0:t.trim()}function ou(e){const t=e.toLowerCase();return t.includes(" permission to write ")?"Write":t.includes(" permission to edit ")?"Edit":t.includes(" permission to run ")||t.includes(" permission to execute ")?"Bash":"Action"}function pr(e){const t=e.trim();if(!t.startsWith("Awaiting your permission to "))return null;const n=t.match(/`([^`]+)`/);return{requests:[{toolName:ou(t),target:n==null?void 0:n[1],summary:t}]}}function au(e){if(!Array.isArray(e.permission_denials))return null;const t=[];for(const n of e.permission_denials){if(!Ut(n)||typeof n.tool_name!="string")continue;const s=Ut(n.tool_input)?n.tool_input:void 0,o=su(s),a=typeof e.result=="string"&&e.result.trim().length>0?e.result.trim():`Awaiting your permission to use ${n.tool_name}${o?` on \`${o}\``:""}.`;t.push({toolName:n.tool_name,...typeof n.tool_use_id=="string"?{toolUseId:n.tool_use_id}:{},...o?{target:o}:{},summary:a})}return t.length>0?{requests:t}:null}function _s(e){if(!Array.isArray(e))return null;for(const t of e){if(!Ut(t)||t.type!=="text"||typeof t.text!="string")continue;const n=pr(t.text);if(n)return n}return null}function Br(e){if(!Ut(e))return null;const t=au(e);if(t)return t;if(typeof e.result=="string"){const s=pr(e.result);if(s)return s}if(typeof e.message=="string"){const s=pr(e.message);if(s)return s}if(Ut(e.message)){const s=Br(e.message);if(s)return s;const o=_s(e.message.content);if(o)return o}const n=_s(e.content);return n||null}function iu(e){return JSON.stringify(e.requests.map(t=>({toolName:t.toolName,target:t.target??null,summary:t.summary})))}function lu(e,t){return e.requests.map(n=>{const s=n.target?` for \`${n.target}\``:"",o=t==="approve"?`Approved. Proceed with the requested ${n.toolName} action${s}.`:`Denied. Do not proceed with the requested ${n.toolName} action${s}. Ask for another approach if needed.`;return n.toolUseId?{type:"tool_result",toolUseId:n.toolUseId,content:o,isError:t==="deny"}:t==="approve"?{type:"text",text:o}:{type:"text",text:o}})}function Ro(e){return Kt(e)!==null}function fn(e){if(e.type==="user"){const t=Kt(e),n=typeof e.timestamp=="string"?e.timestamp:"";if(t)return`user:${n}:${Bt(t)}`}return JSON.stringify(e)}function hr(e){const t=Tn(e);return t?`question:${_t(t)}`:null}function cu(e){const t=Br(e);return t?`permission:${iu(t)}`:null}function Ps(e){if(!Array.isArray(e))return null;const t=new Set;for(const n of e){const s=hr(n);if(s){t.add(s);continue}if(typeof n=="object"&&n!==null&&n.type==="text"&&typeof n.text=="string"){const o=Rn(n.text);o&&t.add(_t(o))}}return t.size===0?null:Array.from(t).sort().join("|")}function du(e){const t=hr(e);if(t)return t;if(typeof e.message=="string"){const n=Rn(e.message);return n?_t(n):null}if(typeof e.message=="object"&&e.message!==null){const n=hr(e.message);return n||Ps(e.message.content)}return Ps(e.content)}function uu(e){return cu(e)}function fu(e,t,n){const s=typeof t.timestamp=="string"?t.timestamp:"";return`${e}-${s}-${n}`}function mu(e,t){const n=t.map(o=>({...o})),s=new Set(n.map(fn));for(const o of e){const a=fn(o);s.has(a)||(n.push(o),s.add(a))}return n}function pu(e,t){const n=fn(t);return e.some(s=>fn(s)===n)?e:[...e,{...t}]}function hu(e,t){const n=new Map;for(const s of t){const o=Kt(s);if(!o)continue;const a=Bt(o);n.set(a,(n.get(a)??0)+1)}return e.filter(s=>{const o=Bt(s.content),a=n.get(o)??0;return a<=0?!0:(n.set(o,a-1),!1)})}function xu(e,t){const n=Bt(t),s=e.findIndex(o=>Bt(o.content)===n);return s===-1?e:e.filter((o,a)=>a!==s)}function gu(e){return e.some(Ro)}function vu(e){const t=[];let n=null;for(const s of e){if(Ro(s)){n=null,t.push(s);continue}const o=uu(s)??du(s);o&&o===n||(t.push(s),o&&(n=o))}return t}function Z(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function bu(e,t){const n=i.createContext(t),s=a=>{const{children:l,...c}=a,d=i.useMemo(()=>c,Object.values(c));return r.jsx(n.Provider,{value:d,children:l})};s.displayName=e+"Provider";function o(a){const l=i.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[s,o]}function rt(e,t=[]){let n=[];function s(a,l){const c=i.createContext(l),d=n.length;n=[...n,l];const f=m=>{var b;const{scope:h,children:x,...g}=m,p=((b=h==null?void 0:h[e])==null?void 0:b[d])||c,v=i.useMemo(()=>g,Object.values(g));return r.jsx(p.Provider,{value:v,children:x})};f.displayName=a+"Provider";function u(m,h){var p;const x=((p=h==null?void 0:h[e])==null?void 0:p[d])||c,g=i.useContext(x);if(g)return g;if(l!==void 0)return l;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[f,u]}const o=()=>{const a=n.map(l=>i.createContext(l));return function(c){const d=(c==null?void 0:c[e])||a;return i.useMemo(()=>({[`__scope${e}`]:{...c,[e]:d}}),[c,d])}};return o.scopeName=e,[s,yu(o,...t)]}function yu(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const l=s.reduce((c,{useScope:d,scopeName:f})=>{const m=d(a)[`__scope${f}`];return{...c,...m}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var ye=globalThis!=null&&globalThis.document?i.useLayoutEffect:()=>{},wu=xo[" useId ".trim().toString()]||(()=>{}),Nu=0;function Ze(e){const[t,n]=i.useState(wu());return ye(()=>{n(s=>s??String(Nu++))},[e]),e||(t?`radix-${t}`:"")}var ju=xo[" useInsertionEffect ".trim().toString()]||ye;function Ct({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[o,a,l]=ku({defaultProp:t,onChange:n}),c=e!==void 0,d=c?e:o;{const u=i.useRef(e!==void 0);i.useEffect(()=>{const m=u.current;m!==c&&console.warn(`${s} is changing from ${m?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=c},[c,s])}const f=i.useCallback(u=>{var m;if(c){const h=Cu(u)?u(e):u;h!==e&&((m=l.current)==null||m.call(l,h))}else a(u)},[c,e,a,l]);return[d,f]}function ku({defaultProp:e,onChange:t}){const[n,s]=i.useState(e),o=i.useRef(n),a=i.useRef(t);return ju(()=>{a.current=t},[t]),i.useEffect(()=>{var l;o.current!==n&&((l=a.current)==null||l.call(a,n),o.current=n)},[n,o]),[n,s,a]}function Cu(e){return typeof e=="function"}function Wt(e){const t=Su(e),n=i.forwardRef((s,o)=>{const{children:a,...l}=s,c=i.Children.toArray(a),d=c.find(Au);if(d){const f=d.props.children,u=c.map(m=>m===d?i.Children.count(f)>1?i.Children.only(null):i.isValidElement(f)?f.props.children:null:m);return r.jsx(t,{...l,ref:o,children:i.isValidElement(f)?i.cloneElement(f,void 0,u):null})}return r.jsx(t,{...l,ref:o,children:a})});return n.displayName=`${e}.Slot`,n}function Su(e){const t=i.forwardRef((n,s)=>{const{children:o,...a}=n;if(i.isValidElement(o)){const l=Ru(o),c=Tu(a,o.props);return o.type!==i.Fragment&&(c.ref=s?nc(s,l):l),i.cloneElement(o,c)}return i.Children.count(o)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _o=Symbol("radix.slottable");function Eu(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=_o,t}function Au(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_o}function Tu(e,t){const n={...t};for(const s in t){const o=e[s],a=t[s];/^on[A-Z]/.test(s)?o&&a?n[s]=(...c)=>{const d=a(...c);return o(...c),d}:o&&(n[s]=o):s==="style"?n[s]={...o,...a}:s==="className"&&(n[s]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function Ru(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _u=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Q=_u.reduce((e,t)=>{const n=Wt(`Primitive.${t}`),s=i.forwardRef((o,a)=>{const{asChild:l,...c}=o,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(d,{...c,ref:a})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function Pu(e,t){e&&En.flushSync(()=>e.dispatchEvent(t))}function et(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function Du(e,t=globalThis==null?void 0:globalThis.document){const n=et(e);i.useEffect(()=>{const s=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var Mu="DismissableLayer",xr="dismissableLayer.update",Ou="dismissableLayer.pointerDownOutside",Iu="dismissableLayer.focusOutside",Ds,Po=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ur=i.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...d}=e,f=i.useContext(Po),[u,m]=i.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=i.useState({}),g=le(t,S=>m(S)),p=Array.from(f.layers),[v]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),b=p.indexOf(v),y=u?p.indexOf(u):-1,w=f.layersWithOutsidePointerEventsDisabled.size>0,j=y>=b,k=Fu(S=>{const A=S.target,T=[...f.branches].some(R=>R.contains(A));!j||T||(o==null||o(S),l==null||l(S),S.defaultPrevented||c==null||c())},h),C=Bu(S=>{const A=S.target;[...f.branches].some(R=>R.contains(A))||(a==null||a(S),l==null||l(S),S.defaultPrevented||c==null||c())},h);return Du(S=>{y===f.layers.size-1&&(s==null||s(S),!S.defaultPrevented&&c&&(S.preventDefault(),c()))},h),i.useEffect(()=>{if(u)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Ds=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(u)),f.layers.add(u),Ms(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Ds)}},[u,h,n,f]),i.useEffect(()=>()=>{u&&(f.layers.delete(u),f.layersWithOutsidePointerEventsDisabled.delete(u),Ms())},[u,f]),i.useEffect(()=>{const S=()=>x({});return document.addEventListener(xr,S),()=>document.removeEventListener(xr,S)},[]),r.jsx(Q.div,{...d,ref:g,style:{pointerEvents:w?j?"auto":"none":void 0,...e.style},onFocusCapture:Z(e.onFocusCapture,C.onFocusCapture),onBlurCapture:Z(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:Z(e.onPointerDownCapture,k.onPointerDownCapture)})});Ur.displayName=Mu;var $u="DismissableLayerBranch",Lu=i.forwardRef((e,t)=>{const n=i.useContext(Po),s=i.useRef(null),o=le(t,s);return i.useEffect(()=>{const a=s.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),r.jsx(Q.div,{...e,ref:o})});Lu.displayName=$u;function Fu(e,t=globalThis==null?void 0:globalThis.document){const n=et(e),s=i.useRef(!1),o=i.useRef(()=>{});return i.useEffect(()=>{const a=c=>{if(c.target&&!s.current){let d=function(){Do(Ou,n,f,{discrete:!0})};const f={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=d,t.addEventListener("click",o.current,{once:!0})):d()}else t.removeEventListener("click",o.current);s.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function Bu(e,t=globalThis==null?void 0:globalThis.document){const n=et(e),s=i.useRef(!1);return i.useEffect(()=>{const o=a=>{a.target&&!s.current&&Do(Iu,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function Ms(){const e=new CustomEvent(xr);document.dispatchEvent(e)}function Do(e,t,n,{discrete:s}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),s?Pu(o,a):o.dispatchEvent(a)}var Zn="focusScope.autoFocusOnMount",Qn="focusScope.autoFocusOnUnmount",Os={bubbles:!1,cancelable:!0},Uu="FocusScope",Wr=i.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...l}=e,[c,d]=i.useState(null),f=et(o),u=et(a),m=i.useRef(null),h=le(t,p=>d(p)),x=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(s){let p=function(w){if(x.paused||!c)return;const j=w.target;c.contains(j)?m.current=j:Ye(m.current,{select:!0})},v=function(w){if(x.paused||!c)return;const j=w.relatedTarget;j!==null&&(c.contains(j)||Ye(m.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const k of w)k.removedNodes.length>0&&Ye(c)};document.addEventListener("focusin",p),document.addEventListener("focusout",v);const y=new MutationObserver(b);return c&&y.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",v),y.disconnect()}}},[s,c,x.paused]),i.useEffect(()=>{if(c){$s.add(x);const p=document.activeElement;if(!c.contains(p)){const b=new CustomEvent(Zn,Os);c.addEventListener(Zn,f),c.dispatchEvent(b),b.defaultPrevented||(Wu(qu(Mo(c)),{select:!0}),document.activeElement===p&&Ye(c))}return()=>{c.removeEventListener(Zn,f),setTimeout(()=>{const b=new CustomEvent(Qn,Os);c.addEventListener(Qn,u),c.dispatchEvent(b),b.defaultPrevented||Ye(p??document.body,{select:!0}),c.removeEventListener(Qn,u),$s.remove(x)},0)}}},[c,f,u,x]);const g=i.useCallback(p=>{if(!n&&!s||x.paused)return;const v=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,b=document.activeElement;if(v&&b){const y=p.currentTarget,[w,j]=Vu(y);w&&j?!p.shiftKey&&b===j?(p.preventDefault(),n&&Ye(w,{select:!0})):p.shiftKey&&b===w&&(p.preventDefault(),n&&Ye(j,{select:!0})):b===y&&p.preventDefault()}},[n,s,x.paused]);return r.jsx(Q.div,{tabIndex:-1,...l,ref:h,onKeyDown:g})});Wr.displayName=Uu;function Wu(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(Ye(s,{select:t}),document.activeElement!==n)return}function Vu(e){const t=Mo(e),n=Is(t,e),s=Is(t.reverse(),e);return[n,s]}function Mo(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const o=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||o?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Is(e,t){for(const n of e)if(!zu(n,{upTo:t}))return n}function zu(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Hu(e){return e instanceof HTMLInputElement&&"select"in e}function Ye(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Hu(e)&&t&&e.select()}}var $s=Ku();function Ku(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Ls(e,t),e.unshift(t)},remove(t){var n;e=Ls(e,t),(n=e[0])==null||n.resume()}}}function Ls(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function qu(e){return e.filter(t=>t.tagName!=="A")}var Gu="Portal",Vr=i.forwardRef((e,t)=>{var c;const{container:n,...s}=e,[o,a]=i.useState(!1);ye(()=>a(!0),[]);const l=n||o&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?rc.createPortal(r.jsx(Q.div,{...s,ref:t}),l):null});Vr.displayName=Gu;function Yu(e,t){return i.useReducer((n,s)=>t[n][s]??n,e)}var Pt=e=>{const{present:t,children:n}=e,s=Xu(t),o=typeof n=="function"?n({present:s.isPresent}):i.Children.only(n),a=le(s.ref,Ju(o));return typeof n=="function"||s.isPresent?i.cloneElement(o,{ref:a}):null};Pt.displayName="Presence";function Xu(e){const[t,n]=i.useState(),s=i.useRef(null),o=i.useRef(e),a=i.useRef("none"),l=e?"mounted":"unmounted",[c,d]=Yu(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const f=en(s.current);a.current=c==="mounted"?f:"none"},[c]),ye(()=>{const f=s.current,u=o.current;if(u!==e){const h=a.current,x=en(f);e?d("MOUNT"):x==="none"||(f==null?void 0:f.display)==="none"?d("UNMOUNT"):d(u&&h!==x?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),ye(()=>{if(t){let f;const u=t.ownerDocument.defaultView??window,m=x=>{const p=en(s.current).includes(CSS.escape(x.animationName));if(x.target===t&&p&&(d("ANIMATION_END"),!o.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",f=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},h=x=>{x.target===t&&(a.current=en(s.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{u.clearTimeout(f),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:i.useCallback(f=>{s.current=f?getComputedStyle(f):null,n(f)},[])}}function en(e){return(e==null?void 0:e.animationName)||"none"}function Ju(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var er=0;function Oo(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Fs()),document.body.insertAdjacentElement("beforeend",e[1]??Fs()),er++,()=>{er===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),er--}},[])}function Fs(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var $e=function(){return $e=Object.assign||function(t){for(var n,s=1,o=arguments.length;s<o;s++){n=arguments[s];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},$e.apply(this,arguments)};function Io(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(e);o<s.length;o++)t.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(e,s[o])&&(n[s[o]]=e[s[o]]);return n}function Zu(e,t,n){if(n||arguments.length===2)for(var s=0,o=t.length,a;s<o;s++)(a||!(s in t))&&(a||(a=Array.prototype.slice.call(t,0,s)),a[s]=t[s]);return e.concat(a||Array.prototype.slice.call(t))}var an="right-scroll-bar-position",ln="width-before-scroll-bar",Qu="with-scroll-bars-hidden",ef="--removed-body-scroll-bar-size";function tr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function tf(e,t){var n=i.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var o=n.value;o!==s&&(n.value=s,n.callback(s,o))}}}})[0];return n.callback=t,n.facade}var nf=typeof window<"u"?i.useLayoutEffect:i.useEffect,Bs=new WeakMap;function rf(e,t){var n=tf(null,function(s){return e.forEach(function(o){return tr(o,s)})});return nf(function(){var s=Bs.get(n);if(s){var o=new Set(s),a=new Set(e),l=n.current;o.forEach(function(c){a.has(c)||tr(c,null)}),a.forEach(function(c){o.has(c)||tr(c,l)})}Bs.set(n,e)},[e]),n}function sf(e){return e}function of(e,t){t===void 0&&(t=sf);var n=[],s=!1,o={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var l=t(a,s);return n.push(l),function(){n=n.filter(function(c){return c!==l})}},assignSyncMedium:function(a){for(s=!0;n.length;){var l=n;n=[],l.forEach(a)}n={push:function(c){return a(c)},filter:function(){return n}}},assignMedium:function(a){s=!0;var l=[];if(n.length){var c=n;n=[],c.forEach(a),l=n}var d=function(){var u=l;l=[],u.forEach(a)},f=function(){return Promise.resolve().then(d)};f(),n={push:function(u){l.push(u),f()},filter:function(u){return l=l.filter(u),n}}}};return o}function af(e){e===void 0&&(e={});var t=of(null);return t.options=$e({async:!0,ssr:!1},e),t}var $o=function(e){var t=e.sideCar,n=Io(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return i.createElement(s,$e({},n))};$o.isSideCarExport=!0;function lf(e,t){return e.useMedium(t),$o}var Lo=af(),nr=function(){},_n=i.forwardRef(function(e,t){var n=i.useRef(null),s=i.useState({onScrollCapture:nr,onWheelCapture:nr,onTouchMoveCapture:nr}),o=s[0],a=s[1],l=e.forwardProps,c=e.children,d=e.className,f=e.removeScrollBar,u=e.enabled,m=e.shards,h=e.sideCar,x=e.noRelative,g=e.noIsolation,p=e.inert,v=e.allowPinchZoom,b=e.as,y=b===void 0?"div":b,w=e.gapMode,j=Io(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=h,C=rf([n,t]),S=$e($e({},j),o);return i.createElement(i.Fragment,null,u&&i.createElement(k,{sideCar:Lo,removeScrollBar:f,shards:m,noRelative:x,noIsolation:g,inert:p,setCallbacks:a,allowPinchZoom:!!v,lockRef:n,gapMode:w}),l?i.cloneElement(i.Children.only(c),$e($e({},S),{ref:C})):i.createElement(y,$e({},S,{className:d,ref:C}),c))});_n.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};_n.classNames={fullWidth:ln,zeroRight:an};var cf=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function df(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=cf();return t&&e.setAttribute("nonce",t),e}function uf(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ff(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var mf=function(){var e=0,t=null;return{add:function(n){e==0&&(t=df())&&(uf(t,n),ff(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},pf=function(){var e=mf();return function(t,n){i.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Fo=function(){var e=pf(),t=function(n){var s=n.styles,o=n.dynamic;return e(s,o),null};return t},hf={left:0,top:0,right:0,gap:0},rr=function(e){return parseInt(e||"",10)||0},xf=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[rr(n),rr(s),rr(o)]},gf=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return hf;var t=xf(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},vf=Fo(),yt="data-scroll-locked",bf=function(e,t,n,s){var o=e.left,a=e.top,l=e.right,c=e.gap;return n===void 0&&(n="margin"),`
|
|
200
|
-
.`.concat(Qu,` {
|
|
201
|
-
overflow: hidden `).concat(s,`;
|
|
202
|
-
padding-right: `).concat(c,"px ").concat(s,`;
|
|
203
|
-
}
|
|
204
|
-
body[`).concat(yt,`] {
|
|
205
|
-
overflow: hidden `).concat(s,`;
|
|
206
|
-
overscroll-behavior: contain;
|
|
207
|
-
`).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
|
|
208
|
-
padding-left: `.concat(o,`px;
|
|
209
|
-
padding-top: `).concat(a,`px;
|
|
210
|
-
padding-right: `).concat(l,`px;
|
|
211
|
-
margin-left:0;
|
|
212
|
-
margin-top:0;
|
|
213
|
-
margin-right: `).concat(c,"px ").concat(s,`;
|
|
214
|
-
`),n==="padding"&&"padding-right: ".concat(c,"px ").concat(s,";")].filter(Boolean).join(""),`
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.`).concat(an,` {
|
|
218
|
-
right: `).concat(c,"px ").concat(s,`;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
.`).concat(ln,` {
|
|
222
|
-
margin-right: `).concat(c,"px ").concat(s,`;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.`).concat(an," .").concat(an,` {
|
|
226
|
-
right: 0 `).concat(s,`;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
.`).concat(ln," .").concat(ln,` {
|
|
230
|
-
margin-right: 0 `).concat(s,`;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
body[`).concat(yt,`] {
|
|
234
|
-
`).concat(ef,": ").concat(c,`px;
|
|
235
|
-
}
|
|
236
|
-
`)},Us=function(){var e=parseInt(document.body.getAttribute(yt)||"0",10);return isFinite(e)?e:0},yf=function(){i.useEffect(function(){return document.body.setAttribute(yt,(Us()+1).toString()),function(){var e=Us()-1;e<=0?document.body.removeAttribute(yt):document.body.setAttribute(yt,e.toString())}},[])},wf=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,o=s===void 0?"margin":s;yf();var a=i.useMemo(function(){return gf(o)},[o]);return i.createElement(vf,{styles:bf(a,!t,o,n?"":"!important")})},gr=!1;if(typeof window<"u")try{var tn=Object.defineProperty({},"passive",{get:function(){return gr=!0,!0}});window.addEventListener("test",tn,tn),window.removeEventListener("test",tn,tn)}catch{gr=!1}var xt=gr?{passive:!1}:!1,Nf=function(e){return e.tagName==="TEXTAREA"},Bo=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Nf(e)&&n[t]==="visible")},jf=function(e){return Bo(e,"overflowY")},kf=function(e){return Bo(e,"overflowX")},Ws=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var o=Uo(e,s);if(o){var a=Wo(e,s),l=a[1],c=a[2];if(l>c)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},Cf=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},Sf=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},Uo=function(e,t){return e==="v"?jf(t):kf(t)},Wo=function(e,t){return e==="v"?Cf(t):Sf(t)},Ef=function(e,t){return e==="h"&&t==="rtl"?-1:1},Af=function(e,t,n,s,o){var a=Ef(e,window.getComputedStyle(t).direction),l=a*s,c=n.target,d=t.contains(c),f=!1,u=l>0,m=0,h=0;do{if(!c)break;var x=Wo(e,c),g=x[0],p=x[1],v=x[2],b=p-v-a*g;(g||b)&&Uo(e,c)&&(m+=b,h+=g);var y=c.parentNode;c=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!d&&c!==document.body||d&&(t.contains(c)||t===c));return(u&&Math.abs(m)<1||!u&&Math.abs(h)<1)&&(f=!0),f},nn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Vs=function(e){return[e.deltaX,e.deltaY]},zs=function(e){return e&&"current"in e?e.current:e},Tf=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Rf=function(e){return`
|
|
237
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
238
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
239
|
-
`)},_f=0,gt=[];function Pf(e){var t=i.useRef([]),n=i.useRef([0,0]),s=i.useRef(),o=i.useState(_f++)[0],a=i.useState(Fo)[0],l=i.useRef(e);i.useEffect(function(){l.current=e},[e]),i.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var p=Zu([e.lockRef.current],(e.shards||[]).map(zs),!0).filter(Boolean);return p.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),p.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=i.useCallback(function(p,v){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!l.current.allowPinchZoom;var b=nn(p),y=n.current,w="deltaX"in p?p.deltaX:y[0]-b[0],j="deltaY"in p?p.deltaY:y[1]-b[1],k,C=p.target,S=Math.abs(w)>Math.abs(j)?"h":"v";if("touches"in p&&S==="h"&&C.type==="range")return!1;var A=window.getSelection(),T=A&&A.anchorNode,R=T?T===C||T.contains(C):!1;if(R)return!1;var F=Ws(S,C);if(!F)return!0;if(F?k=S:(k=S==="v"?"h":"v",F=Ws(S,C)),!F)return!1;if(!s.current&&"changedTouches"in p&&(w||j)&&(s.current=k),!k)return!0;var _=s.current||k;return Af(_,v,p,_==="h"?w:j)},[]),d=i.useCallback(function(p){var v=p;if(!(!gt.length||gt[gt.length-1]!==a)){var b="deltaY"in v?Vs(v):nn(v),y=t.current.filter(function(k){return k.name===v.type&&(k.target===v.target||v.target===k.shadowParent)&&Tf(k.delta,b)})[0];if(y&&y.should){v.cancelable&&v.preventDefault();return}if(!y){var w=(l.current.shards||[]).map(zs).filter(Boolean).filter(function(k){return k.contains(v.target)}),j=w.length>0?c(v,w[0]):!l.current.noIsolation;j&&v.cancelable&&v.preventDefault()}}},[]),f=i.useCallback(function(p,v,b,y){var w={name:p,delta:v,target:b,should:y,shadowParent:Df(b)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(j){return j!==w})},1)},[]),u=i.useCallback(function(p){n.current=nn(p),s.current=void 0},[]),m=i.useCallback(function(p){f(p.type,Vs(p),p.target,c(p,e.lockRef.current))},[]),h=i.useCallback(function(p){f(p.type,nn(p),p.target,c(p,e.lockRef.current))},[]);i.useEffect(function(){return gt.push(a),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:h}),document.addEventListener("wheel",d,xt),document.addEventListener("touchmove",d,xt),document.addEventListener("touchstart",u,xt),function(){gt=gt.filter(function(p){return p!==a}),document.removeEventListener("wheel",d,xt),document.removeEventListener("touchmove",d,xt),document.removeEventListener("touchstart",u,xt)}},[]);var x=e.removeScrollBar,g=e.inert;return i.createElement(i.Fragment,null,g?i.createElement(a,{styles:Rf(o)}):null,x?i.createElement(wf,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Df(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Mf=lf(Lo,Pf);var zr=i.forwardRef(function(e,t){return i.createElement(_n,$e({},e,{ref:t,sideCar:Mf}))});zr.classNames=_n.classNames;var Of=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},vt=new WeakMap,rn=new WeakMap,sn={},sr=0,Vo=function(e){return e&&(e.host||Vo(e.parentNode))},If=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=Vo(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},$f=function(e,t,n,s){var o=If(t,Array.isArray(e)?e:[e]);sn[n]||(sn[n]=new WeakMap);var a=sn[n],l=[],c=new Set,d=new Set(o),f=function(m){!m||c.has(m)||(c.add(m),f(m.parentNode))};o.forEach(f);var u=function(m){!m||d.has(m)||Array.prototype.forEach.call(m.children,function(h){if(c.has(h))u(h);else try{var x=h.getAttribute(s),g=x!==null&&x!=="false",p=(vt.get(h)||0)+1,v=(a.get(h)||0)+1;vt.set(h,p),a.set(h,v),l.push(h),p===1&&g&&rn.set(h,!0),v===1&&h.setAttribute(n,"true"),g||h.setAttribute(s,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return u(t),c.clear(),sr++,function(){l.forEach(function(m){var h=vt.get(m)-1,x=a.get(m)-1;vt.set(m,h),a.set(m,x),h||(rn.has(m)||m.removeAttribute(s),rn.delete(m)),x||m.removeAttribute(n)}),sr--,sr||(vt=new WeakMap,vt=new WeakMap,rn=new WeakMap,sn={})}},zo=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),o=Of(e);return o?(s.push.apply(s,Array.from(o.querySelectorAll("[aria-live], script"))),$f(s,o,n,"aria-hidden")):function(){return null}},Pn="Dialog",[Ho,Ko]=rt(Pn),[Lf,Ie]=Ho(Pn),qo=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:o,onOpenChange:a,modal:l=!0}=e,c=i.useRef(null),d=i.useRef(null),[f,u]=Ct({prop:s,defaultProp:o??!1,onChange:a,caller:Pn});return r.jsx(Lf,{scope:t,triggerRef:c,contentRef:d,contentId:Ze(),titleId:Ze(),descriptionId:Ze(),open:f,onOpenChange:u,onOpenToggle:i.useCallback(()=>u(m=>!m),[u]),modal:l,children:n})};qo.displayName=Pn;var Go="DialogTrigger",Yo=i.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ie(Go,n),a=le(t,o.triggerRef);return r.jsx(Q.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":qr(o.open),...s,ref:a,onClick:Z(e.onClick,o.onOpenToggle)})});Yo.displayName=Go;var Hr="DialogPortal",[Ff,Xo]=Ho(Hr,{forceMount:void 0}),Jo=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:o}=e,a=Ie(Hr,t);return r.jsx(Ff,{scope:t,forceMount:n,children:i.Children.map(s,l=>r.jsx(Pt,{present:n||a.open,children:r.jsx(Vr,{asChild:!0,container:o,children:l})}))})};Jo.displayName=Hr;var mn="DialogOverlay",Zo=i.forwardRef((e,t)=>{const n=Xo(mn,e.__scopeDialog),{forceMount:s=n.forceMount,...o}=e,a=Ie(mn,e.__scopeDialog);return a.modal?r.jsx(Pt,{present:s||a.open,children:r.jsx(Uf,{...o,ref:t})}):null});Zo.displayName=mn;var Bf=Wt("DialogOverlay.RemoveScroll"),Uf=i.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ie(mn,n);return r.jsx(zr,{as:Bf,allowPinchZoom:!0,shards:[o.contentRef],children:r.jsx(Q.div,{"data-state":qr(o.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),ct="DialogContent",Qo=i.forwardRef((e,t)=>{const n=Xo(ct,e.__scopeDialog),{forceMount:s=n.forceMount,...o}=e,a=Ie(ct,e.__scopeDialog);return r.jsx(Pt,{present:s||a.open,children:a.modal?r.jsx(Wf,{...o,ref:t}):r.jsx(Vf,{...o,ref:t})})});Qo.displayName=ct;var Wf=i.forwardRef((e,t)=>{const n=Ie(ct,e.__scopeDialog),s=i.useRef(null),o=le(t,n.contentRef,s);return i.useEffect(()=>{const a=s.current;if(a)return zo(a)},[]),r.jsx(ea,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Z(e.onCloseAutoFocus,a=>{var l;a.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Z(e.onPointerDownOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&a.preventDefault()}),onFocusOutside:Z(e.onFocusOutside,a=>a.preventDefault())})}),Vf=i.forwardRef((e,t)=>{const n=Ie(ct,e.__scopeDialog),s=i.useRef(!1),o=i.useRef(!1);return r.jsx(ea,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,c;(l=e.onCloseAutoFocus)==null||l.call(e,a),a.defaultPrevented||(s.current||(c=n.triggerRef.current)==null||c.focus(),a.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:a=>{var d,f;(d=e.onInteractOutside)==null||d.call(e,a),a.defaultPrevented||(s.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const l=a.target;((f=n.triggerRef.current)==null?void 0:f.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),ea=i.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:a,...l}=e,c=Ie(ct,n),d=i.useRef(null),f=le(t,d);return Oo(),r.jsxs(r.Fragment,{children:[r.jsx(Wr,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:a,children:r.jsx(Ur,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":qr(c.open),...l,ref:f,onDismiss:()=>c.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(Hf,{titleId:c.titleId}),r.jsx(qf,{contentRef:d,descriptionId:c.descriptionId})]})]})}),Kr="DialogTitle",ta=i.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ie(Kr,n);return r.jsx(Q.h2,{id:o.titleId,...s,ref:t})});ta.displayName=Kr;var na="DialogDescription",ra=i.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ie(na,n);return r.jsx(Q.p,{id:o.descriptionId,...s,ref:t})});ra.displayName=na;var sa="DialogClose",oa=i.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ie(sa,n);return r.jsx(Q.button,{type:"button",...s,ref:t,onClick:Z(e.onClick,()=>o.onOpenChange(!1))})});oa.displayName=sa;function qr(e){return e?"open":"closed"}var aa="DialogTitleWarning",[zf,ia]=bu(aa,{contentName:ct,titleName:Kr,docsSlug:"dialog"}),Hf=({titleId:e})=>{const t=ia(aa),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
240
|
-
|
|
241
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
242
|
-
|
|
243
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return i.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Kf="DialogDescriptionWarning",qf=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ia(Kf).contentName}}.`;return i.useEffect(()=>{var a;const o=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},la=qo,Gf=Yo,ca=Jo,Gr=Zo,Yr=Qo,Xr=ta,Jr=ra,Dn=oa;const Yf=la,Xf=ca,Wx=Dn,da=i.forwardRef(({className:e,...t},n)=>r.jsx(Gr,{ref:n,className:W("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));da.displayName=Gr.displayName;const ua=i.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(Xf,{children:[r.jsx(da,{}),r.jsxs(Yr,{ref:s,className:W("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,r.jsxs(Dn,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[r.jsx(kt,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ua.displayName=Yr.displayName;const fa=({className:e,...t})=>r.jsx("div",{className:W("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});fa.displayName="DialogHeader";const ma=({className:e,...t})=>r.jsx("div",{className:W("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ma.displayName="DialogFooter";const pa=i.forwardRef(({className:e,...t},n)=>r.jsx(Xr,{ref:n,className:W("text-lg font-semibold leading-none tracking-tight",e),...t}));pa.displayName=Xr.displayName;const Jf=i.forwardRef(({className:e,...t},n)=>r.jsx(Jr,{ref:n,className:W("text-sm text-muted-foreground",e),...t}));Jf.displayName=Jr.displayName;const St=i.forwardRef(({className:e,type:t,...n},s)=>r.jsx("input",{type:t,className:W("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:s,...n}));St.displayName="Input";var Zf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Qf=Zf.reduce((e,t)=>{const n=sc(`Primitive.${t}`),s=i.forwardRef((o,a)=>{const{asChild:l,...c}=o,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(d,{...c,ref:a})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),em="Label",ha=i.forwardRef((e,t)=>r.jsx(Qf.label,{...e,ref:t,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));ha.displayName=em;var xa=ha;const tm=oc("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ue=i.forwardRef(({className:e,...t},n)=>r.jsx(xa,{ref:n,className:W(tm(),e),...t}));Ue.displayName=xa.displayName;function nm({onAdded:e}){const[t,n]=i.useState(""),[s,o]=i.useState(!1),[a,l]=i.useState(null),c=i.useCallback(async d=>{if(d.preventDefault(),!!t.trim()){o(!0),l(null);try{await ac({leaderEndpoint:t.trim(),transport:"devtunnel"}),e()}catch(f){l(f instanceof Error?f.message:"Failed to join node")}finally{o(!1)}}},[t,e]);return r.jsx(ua,{className:"overflow-hidden border-border/60 bg-transparent p-0 shadow-none sm:max-w-xl",children:r.jsxs("div",{className:"overflow-hidden rounded-[28px] border border-border/60 bg-background/95 p-0 shadow-[0_40px_120px_-60px_rgba(0,0,0,0.88)] backdrop-blur-xl",children:[r.jsx("div",{className:"border-b border-border/60 px-6 py-5",children:r.jsxs(fa,{className:"space-y-2 text-left",children:[r.jsx(pa,{className:"text-2xl tracking-tight",children:"Join node"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Verify the remote leader's DevTunnel endpoint, sync this node's tasks to that leader, and join the cluster as a follower."})]})}),r.jsxs("form",{onSubmit:c,className:"space-y-4 px-6 py-5",children:[a&&r.jsx("div",{className:"rounded-[20px] border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:a}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(Ue,{htmlFor:"leader-endpoint",children:"Leader endpoint"}),r.jsx(Se,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 text-[10px] uppercase tracking-[0.16em]",children:"DevTunnel only"})]}),r.jsx(St,{id:"leader-endpoint",type:"url",value:t,onChange:d=>n(d.target.value),placeholder:"https://your-leader.devtunnels.ms",className:"h-11 rounded-2xl border-border/70 bg-background/70"})]}),r.jsx("div",{className:"rounded-[20px] border border-border/60 bg-background/45 px-4 py-3 text-sm text-muted-foreground",children:"This does not switch the local node transport or auto-enable a local DevTunnel. Leaving later will detach this node from the remote leader and make it leader of its own cluster again."}),r.jsx(ma,{className:"border-t border-border/60 pt-4",children:r.jsx(q,{type:"submit",disabled:!t.trim()||s,className:"rounded-2xl",children:s?"Joining...":"Join node"})})]})]})})}function ga(){const[e,t]=i.useState([]),[n,s]=i.useState(null),o=i.useRef(null),a=i.useCallback(()=>{var u;(u=o.current)==null||u.click()},[]),l=i.useCallback(async u=>{const m=Array.from(u.target.files??[]);if(m.length!==0)try{const h=await Rs(m);t(x=>[...x,...h]),s(null)}catch(h){s(h instanceof Error?h.message:"Failed to attach image")}finally{u.target.value=""}},[]),c=i.useCallback(async u=>{const m=Yd(u.clipboardData);if(m.length!==0){u.preventDefault();try{const h=await Rs(m);t(x=>[...x,...h]),s(null)}catch(h){s(h instanceof Error?h.message:"Failed to attach image")}}},[]),d=i.useCallback(u=>{t(m=>m.filter((h,x)=>x!==u))},[]),f=i.useCallback(()=>{t([]),s(null)},[]);return{images:e,error:n,fileInputRef:o,pickImages:a,handleFileChange:l,handlePaste:c,removeImage:d,clearImages:f}}function rm({onSend:e,disabled:t,disabledReason:n="Chat is waiting on the agent.",placeholder:s="Send a follow-up message...",contextItems:o=[],running:a=!1,onStop:l}){const[c,d]=i.useState(""),f=i.useRef(null),{images:u,error:m,fileInputRef:h,pickImages:x,handleFileChange:g,handlePaste:p,removeImage:v,clearImages:b}=ga(),y=i.useCallback(()=>{f.current&&(f.current.style.height="auto")},[]),w=i.useCallback(()=>{const T=To(c,u);T.length===0||t||(e(T),d(""),b(),y())},[c,u,t,e,b,y]),j=i.useCallback(T=>{T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),w())},[w]),k=i.useCallback(()=>{f.current&&(f.current.style.height="auto",f.current.style.height=`${Math.min(f.current.scrollHeight,220)}px`)},[]),C=!t&&!a&&(c.trim().length>0||u.length>0),S=a&&!!l,A=a?l?"Task is running — click to stop":"Task is running...":t?n:"Enter sends, Shift+Enter adds a line";return r.jsxs("div",{className:"border-t border-border/60 bg-background/55 px-2 py-1.5 backdrop-blur-xl sm:px-4 sm:py-2",children:[o.length>0&&r.jsx("div",{className:"flex flex-wrap items-center gap-2 px-3 pb-2.5",children:o.map(T=>r.jsxs("div",{className:"inline-flex max-w-full items-center gap-1.5 rounded-full border border-border/60 bg-muted/40 px-3 py-1 text-xs",children:[r.jsx("span",{className:"shrink-0 text-[9px] font-medium uppercase tracking-[0.12em] text-muted-foreground/80",children:T.label}),r.jsx("span",{className:`truncate text-foreground/90 ${T.mono?"font-mono text-[11px]":""}`,children:T.value})]},`${T.label}:${T.value}`))}),r.jsxs("div",{className:"overflow-hidden rounded-3xl border border-border/65 bg-card/85 shadow-[0_28px_90px_-62px_rgba(0,0,0,var(--panel-shadow-alpha))] sm:rounded-[40px]",children:[r.jsx("input",{ref:h,type:"file",accept:"image/*",multiple:!0,onChange:g,className:"hidden"}),u.length>0&&r.jsx("div",{className:"px-3 pt-3 sm:px-6 sm:pt-6",children:r.jsx("div",{className:"flex flex-wrap gap-3",children:u.map((T,R)=>r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:Fr(T),alt:T.filename??`attachment ${R+1}`,className:"h-24 w-24 rounded-[22px] border border-border/70 object-cover"}),r.jsx("button",{type:"button",onClick:()=>v(R),className:"absolute -top-2 -right-2 flex h-7 w-7 items-center justify-center rounded-full border border-border/70 bg-background text-muted-foreground transition-colors hover:text-foreground","aria-label":`Remove ${T.filename??`image ${R+1}`}`,children:r.jsx(kt,{className:"h-3.5 w-3.5"})})]},`${T.filename??"image"}-${R}`))})}),r.jsxs("div",{className:"flex items-end gap-2 px-3 pt-3 pb-3 sm:px-6 sm:pt-4 sm:pb-4",children:[r.jsx("textarea",{ref:f,value:c,onChange:T=>d(T.target.value),onKeyDown:j,onPaste:p,onInput:k,placeholder:s,disabled:t,rows:1,className:"min-h-[2.5rem] flex-1 resize-none bg-transparent px-0 py-1 text-sm leading-7 text-foreground placeholder:text-muted-foreground/70 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50"}),r.jsxs(q,{type:"button",variant:"ghost",onClick:x,disabled:t,className:"mb-0.5 h-9 shrink-0 gap-1.5 rounded-full px-2 text-xs text-muted-foreground hover:text-foreground sm:px-3",title:"Attach images",children:[r.jsx(fr,{className:"h-4 w-4 sm:h-3.5 sm:w-3.5"}),r.jsx("span",{className:"hidden sm:inline",children:"Images"})]}),r.jsx("span",{title:A,children:r.jsx(q,{onClick:a?l:w,disabled:a?!S:!C,size:"icon","aria-label":a?"Stop running task":"Send message",className:"mb-0.5 h-9 w-9 shrink-0 rounded-full bg-primary/85 text-primary-foreground shadow-sm hover:bg-primary",children:a?r.jsx(Ee,{className:"h-4 w-4 animate-spin"}):r.jsx(Co,{className:"h-4 w-4"})})})]}),m&&r.jsx("div",{className:"border-t border-destructive/20 bg-destructive/10 px-3 py-2 text-xs text-destructive sm:px-6 sm:py-3",children:m})]})]})}function Vt({payload:e,disabled:t=!1,bypassEnabled:n=!1,onBypassChange:s,onSubmit:o}){const[a,l]=i.useState(()=>n?tu(e):e.questions.map(()=>[])),[c,d]=i.useState(!1),[f,u]=i.useState(!1);i.useEffect(()=>{n&&l(g=>g.map((p,v)=>{var b;return p.length>0?p:(b=e.questions[v])!=null&&b.options.length?[0]:[]}))},[n,e]);const m=nu(e,a)&&!t&&!c&&!f&&!!o,h=(g,p)=>{t||f||c||l(v=>v.map((b,y)=>{if(y!==g)return b;const w=e.questions[y];return w?w.multiSelect?b.includes(p)?b.filter(j=>j!==p):[...b,p].sort((j,k)=>j-k):[p]:b}))},x=async()=>{if(!m||!o)return;d(!0);const g=await o(ru(e,a));d(!1),g&&u(!0)};return r.jsxs("div",{className:"rounded-[24px] border border-primary/20 bg-primary/5 p-4 shadow-[0_24px_80px_-60px_hsl(var(--primary)/0.9)]",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-primary/20 bg-primary/10 text-primary",children:r.jsx(Bc,{className:"h-4 w-4"})}),r.jsxs("div",{children:[r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.22em] text-primary/80",children:"Ask User Question"}),r.jsx("div",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:"Select the answer you want to send back to the agent."})]})]}),r.jsxs(q,{type:"button",variant:n?"secondary":"outline",size:"sm",onClick:()=>s==null?void 0:s(!n),className:"rounded-full",children:[r.jsx(Sd,{className:"h-4 w-4"}),n?"Bypass on":"Bypass future questions"]})]}),r.jsx("div",{className:"mt-4 space-y-4",children:e.questions.map((g,p)=>{const v=a[p]??[];return r.jsxs("div",{className:"space-y-3 rounded-[20px] border border-border/60 bg-background/75 p-4",children:[r.jsxs("div",{children:[g.header&&r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-muted-foreground",children:g.header}),r.jsx("div",{className:"mt-1 text-sm font-medium leading-6 text-foreground",children:g.question}),r.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:g.multiSelect?"Select one or more options.":"Select one option."})]}),r.jsx("div",{className:"space-y-2",children:g.options.map((b,y)=>{const w=v.includes(y);return r.jsxs("button",{type:"button",onClick:()=>h(p,y),disabled:t||c||f,"aria-pressed":w,className:W("flex w-full items-start gap-3 rounded-[18px] border px-4 py-3 text-left transition-colors",w?"border-primary/50 bg-primary/10 text-foreground":"border-border/60 bg-background/80 text-foreground hover:border-primary/30 hover:bg-primary/5"),children:[r.jsx("span",{className:W("mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border",w?"border-primary bg-primary text-primary-foreground":"border-border/70 bg-background text-transparent"),children:r.jsx(He,{className:"h-3.5 w-3.5"})}),r.jsxs("span",{className:"min-w-0",children:[r.jsx("span",{className:"block text-sm font-medium leading-5",children:b.label}),b.description&&r.jsx("span",{className:"mt-1 block text-xs leading-5 text-muted-foreground",children:b.description})]})]},`${b.label}-${y}`)})})]},`${g.header??"question"}-${p}`)})}),r.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3",children:[r.jsx("div",{className:"text-xs text-muted-foreground",children:n?"Bypass is enabled. New question cards will default to the first option.":"Enable bypass if you want future question cards to preselect the first option."}),r.jsx(q,{type:"button",onClick:()=>void x(),disabled:!m,className:"rounded-full px-5",children:f?"Sent":c?"Sending...":e.questions.length>1?"Send answers":"Send answer"})]})]})}function sm({payload:e,disabled:t=!1,onSubmit:n}){const[s,o]=i.useState(null),[a,l]=i.useState(!1),c=!t&&!a&&!!n,d=async f=>{if(!c||!n)return;o(f);const u=await n(lu(e,f));o(null),u&&l(!0)};return r.jsxs("div",{className:"rounded-[24px] border border-amber-500/25 bg-amber-500/5 p-4 shadow-[0_24px_80px_-60px_rgba(245,158,11,0.8)]",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-amber-500/25 bg-amber-500/10 text-amber-600 dark:text-amber-400",children:r.jsx(kd,{className:"h-4 w-4"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.22em] text-amber-700/80 dark:text-amber-300/80",children:"Permission Request"}),r.jsx("div",{className:"mt-1 space-y-3",children:e.requests.map((f,u)=>r.jsxs("div",{className:"rounded-[18px] border border-border/60 bg-background/75 px-4 py-3",children:[r.jsx("div",{className:"text-sm font-medium leading-6 text-foreground",children:f.summary}),(f.toolName||f.target)&&r.jsxs("div",{className:"mt-2 flex flex-wrap gap-2 text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:[r.jsx("span",{children:f.toolName}),f.target&&r.jsx("span",{className:"font-mono normal-case tracking-normal",children:f.target})]})]},`${f.toolUseId??f.toolName}-${u}`))})]})]}),r.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-end gap-2",children:[r.jsxs(q,{type:"button",variant:"outline",onClick:()=>void d("deny"),disabled:!c||s!==null,className:"rounded-full",children:[r.jsx(kt,{className:"h-4 w-4"}),a?"Sent":s==="deny"?"Sending...":"Deny"]}),r.jsxs(q,{type:"button",onClick:()=>void d("approve"),disabled:!c||s!==null,className:"rounded-full",children:[r.jsx(He,{className:"h-4 w-4"}),a?"Sent":s==="approve"?"Sending...":"Approve"]})]})]})}function Hs({event:e,questionBypassEnabled:t=!1,onQuestionBypassChange:n,onSubmitQuestionResponse:s,questionResponseDisabled:o=!1}){const a=e.type,l=Br(e),c=Tn(e);if(l)return r.jsx(Ft,{children:r.jsx(sm,{payload:l,onSubmit:s,disabled:o})});if(c)return r.jsx(Ft,{children:r.jsx(Vt,{payload:c,bypassEnabled:t,onBypassChange:n,onSubmit:s,disabled:o})});if(a==="user"){const d=om(e),f=d.filter(m=>m.type==="tool_result");if(f.length>0&&d.every(m=>m.type==="tool_result"))return r.jsx(Ft,{children:f.map((m,h)=>r.jsx(ba,{block:m,questionBypassEnabled:t,onQuestionBypassChange:n,onSubmitQuestionResponse:s,questionResponseDisabled:o},h))});const u=Kt(e);return u?r.jsx(cm,{content:u}):null}return a==="assistant"?r.jsx(dm,{event:e,questionBypassEnabled:t,onQuestionBypassChange:n,onSubmitQuestionResponse:s,questionResponseDisabled:o}):null}function om(e){const t=e.message,n=t==null?void 0:t.content;if(Array.isArray(n))return n.filter(o=>typeof o=="object"&&o!==null);const s=e.content;return Array.isArray(s)?s.filter(o=>typeof o=="object"&&o!==null):[]}function or(e){var n;const t=e.replace(/\r\n/g,`
|
|
244
|
-
`).split(`
|
|
245
|
-
`);for(;t.length>0&&((n=t[0])==null?void 0:n.trim())==="";)t.shift();return t.join(`
|
|
246
|
-
`)}function va({text:e,className:t=""}){const[n,s]=i.useState(!1);if(!e)return null;const o=async a=>{a.stopPropagation();try{await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),1500)}catch{}};return r.jsx("button",{type:"button",onClick:o,"aria-label":n?"Copied":"Copy message",className:`flex h-6 w-6 items-center justify-center rounded-full border border-border/60 bg-background/80 text-muted-foreground opacity-0 shadow-sm backdrop-blur transition-opacity hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100 ${t}`,children:n?r.jsx(He,{className:"h-3 w-3 text-emerald-500"}):r.jsx(An,{className:"h-3 w-3"})})}async function am(e){let n=await(await fetch(e)).blob();n.type!=="image/png"&&(n=await im(n)),await navigator.clipboard.write([new ClipboardItem({[n.type]:n})])}async function im(e){const t=await createImageBitmap(e),n=document.createElement("canvas");n.width=t.width,n.height=t.height;const s=n.getContext("2d");if(!s)throw new Error("canvas 2d context unavailable");return s.drawImage(t,0,0),await new Promise((o,a)=>{n.toBlob(l=>l?o(l):a(new Error("toBlob failed")),"image/png")})}function lm({dataUrl:e,className:t=""}){const[n,s]=i.useState(!1),o=async a=>{a.stopPropagation();try{await am(e),s(!0),setTimeout(()=>s(!1),1500)}catch(l){console.error("copy image failed",l)}};return r.jsx("button",{type:"button",onClick:o,"aria-label":n?"Copied":"Copy image",className:`flex h-6 w-6 items-center justify-center rounded-full border border-border/60 bg-background/80 text-muted-foreground opacity-0 shadow-sm backdrop-blur transition-opacity hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100 ${t}`,children:n?r.jsx(He,{className:"h-3 w-3 text-emerald-500"}):r.jsx(An,{className:"h-3 w-3"})})}function cm({content:e}){const t=Gd(e),n=e.filter(s=>s.type==="image");return r.jsx("div",{className:"animate-message-rise flex justify-end",children:r.jsxs("div",{className:"group relative flex max-w-[88%] items-start gap-3",children:[r.jsx(va,{text:t,className:"absolute -left-8 top-2"}),r.jsxs("div",{className:"space-y-1 rounded-[26px] rounded-tr-md border border-primary/25 bg-primary px-4 py-3 text-[13px] leading-5 text-primary-foreground shadow-[0_20px_70px_-42px_hsl(var(--primary)/0.95)]",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.28em] text-primary-foreground/75",children:"You"}),t&&r.jsx("div",{className:"whitespace-pre-wrap",children:t}),n.length>0&&r.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:n.map((s,o)=>{const a=Fr(s);return r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:a,alt:s.filename??`attachment ${o+1}`,className:"max-h-72 w-full rounded-2xl border border-primary-foreground/15 object-cover"}),r.jsx(lm,{dataUrl:a,className:"absolute right-2 top-2"})]},`${s.filename??"image"}-${o}`)})})]}),r.jsx("div",{className:"mt-1 flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-primary/20 bg-primary/10 text-primary",children:r.jsx(Pd,{className:"h-4 w-4"})})]})})}function Ft({children:e}){return r.jsx("div",{className:"animate-message-rise flex justify-start",children:r.jsxs("div",{className:"flex max-w-[92%] items-start gap-3",children:[r.jsx("div",{className:"mt-1 flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-border/70 bg-muted/70 text-muted-foreground",children:r.jsx(Mr,{className:"h-4 w-4"})}),r.jsxs("div",{className:"min-w-0 space-y-3",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.28em] text-muted-foreground",children:"Agent"}),e]})]})})}function dm({event:e,questionBypassEnabled:t,onQuestionBypassChange:n,onSubmitQuestionResponse:s,questionResponseDisabled:o}){const a=e.message;if(!a)return null;const l=Tn(a);if(l)return r.jsx(Ft,{children:r.jsx(Vt,{payload:l,bypassEnabled:t,onBypassChange:n,onSubmit:s,disabled:o})});const c=a.content;if(!c||!Array.isArray(c))return null;const d=new Set,f=c.filter(g=>g.type==="text").map(g=>({...g,text:or(String(g.text??"")),questionPayload:Rn(or(String(g.text??"")))})).filter(g=>g.text.length>0||g.questionPayload),u=c.filter(g=>g.type==="thinking").map(g=>or(String(g.thinking??""))).filter(Boolean).join(`
|
|
247
|
-
|
|
248
|
-
`),m=c.filter(g=>g.type==="tool_use"),h=c.filter(g=>g.type==="tool_result");return f.length>0||u.length>0||m.length>0||h.length>0?r.jsxs(Ft,{children:[u.length>0&&r.jsx(pm,{text:u}),f.map((g,p)=>{if(g.questionPayload){const v=_t(g.questionPayload);return d.has(v)?null:(d.add(v),r.jsx(Vt,{payload:g.questionPayload,bypassEnabled:t,onBypassChange:n,onSubmit:s,disabled:o},p))}return r.jsxs("div",{className:"group relative rounded-[26px] rounded-tl-md border border-border/70 bg-card/80 px-4 py-3 text-[13px] leading-5 text-foreground shadow-[0_20px_70px_-58px_rgba(0,0,0,0.9)] backdrop-blur-sm",children:[r.jsx(va,{text:g.text,className:"absolute right-2 top-2"}),r.jsx("div",{className:"whitespace-pre-wrap",children:g.text})]},p)}),m.map((g,p)=>r.jsx(hm,{block:g,renderedQuestionSignatures:d,questionBypassEnabled:t,onQuestionBypassChange:n,onSubmitQuestionResponse:s,questionResponseDisabled:o},p)),h.map((g,p)=>r.jsx(ba,{block:g,renderedQuestionSignatures:d,questionBypassEnabled:t,onQuestionBypassChange:n,onSubmitQuestionResponse:s,questionResponseDisabled:o},p))]}):null}function um(e){return e.replace(/\s+/g," ").trim()}function wt(e,t=132){const n=um(e);return n?n.length>t?`${n.slice(0,t-3)}...`:n:""}function vr(e,t=84){if(typeof e=="string")return wt(e,t);if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e)){const n=e.slice(0,3).map(s=>vr(s,28)).filter(Boolean).join(", ");return wt(n||JSON.stringify(e),t)}if(typeof e=="object"&&e!==null){const n=Object.entries(e).slice(0,3).map(([s,o])=>`${s}: ${vr(o,32)}`).join(" · ");return wt(n||JSON.stringify(e),t)}return""}function fm(e){if(!e)return"No input";const t=Object.entries(e).slice(0,4).map(([n,s])=>`${n}: ${vr(s,40)}`).filter(n=>n.trim().length>0).join(" · ");return wt(t||JSON.stringify(e),156)||"No input"}function mm({expanded:e}){return r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-border/60 bg-background/70 px-2 py-1 text-[10px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:[e?"Less":"More",e?r.jsx(Ir,{className:"h-3 w-3"}):r.jsx(Tt,{className:"h-3 w-3"})]})}function Zr({title:e,preview:t,icon:n,children:s,accentClassName:o,previewClassName:a="font-mono text-[11px] text-muted-foreground/90"}){const[l,c]=i.useState(!1);return r.jsxs("div",{className:`overflow-hidden rounded-[22px] border border-border/60 ${o}`,children:[r.jsxs("button",{type:"button",onClick:()=>c(d=>!d),className:"flex w-full items-start gap-3 px-4 py-3 text-left transition-colors hover:bg-background/30",children:[r.jsx("div",{className:"mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-border/60 bg-background/70 text-muted-foreground",children:n}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"flex flex-wrap items-center gap-2",children:r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.22em] text-muted-foreground",children:e})}),r.jsx("div",{className:`mt-1 whitespace-pre-wrap break-words text-[12px] leading-5 ${a}`,children:t})]}),r.jsx(mm,{expanded:l})]}),l&&r.jsx("div",{className:"border-t border-border/60 px-4 py-3",children:s})]})}function pm({text:e}){const t=wt(e,156);return r.jsx(Zr,{title:"Thinking",preview:t,icon:r.jsx(Mc,{className:"h-3.5 w-3.5"}),accentClassName:"bg-muted/35",previewClassName:"text-[12px] leading-5 text-muted-foreground/90",children:r.jsx("div",{className:"whitespace-pre-wrap text-[13px] leading-5 text-muted-foreground/90",children:e})})}function hm({block:e,renderedQuestionSignatures:t,questionBypassEnabled:n,onQuestionBypassChange:s,onSubmitQuestionResponse:o,questionResponseDisabled:a}){const l=String(e.name??"tool"),c=e.input,d=Tn(e);if(d){const u=_t(d);return t!=null&&t.has(u)?null:(t==null||t.add(u),r.jsx(Vt,{payload:d,bypassEnabled:n,onBypassChange:s,onSubmit:o,disabled:a}))}const f=fm(c);if(l==="TodoWrite"){const u=xm(c==null?void 0:c.todos);if(u.length>0)return r.jsx(gm,{todos:u})}return r.jsx(Zr,{title:`Tool: ${l}`,preview:f,icon:r.jsx(So,{className:"h-3.5 w-3.5"}),accentClassName:"bg-muted/25",children:r.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap text-xs leading-5 text-muted-foreground",children:JSON.stringify(c??{},null,2)})})}function ba({block:e,renderedQuestionSignatures:t,questionBypassEnabled:n,onQuestionBypassChange:s,onSubmitQuestionResponse:o,questionResponseDisabled:a}){const l=e.content,c=typeof l=="string"?l:Array.isArray(l)?l.map(u=>String(u.text??"")).join(`
|
|
249
|
-
`):"";if(!c)return null;const d=Rn(c);if(d){const u=_t(d);return t!=null&&t.has(u)?null:(t==null||t.add(u),r.jsx(Vt,{payload:d,bypassEnabled:n,onBypassChange:s,onSubmit:o,disabled:a}))}const f=wt(c,156);return r.jsx(Zr,{title:"Result",preview:f,icon:r.jsx(So,{className:"h-3.5 w-3.5"}),accentClassName:"bg-background/65",children:r.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap text-xs leading-5 text-muted-foreground",children:c})})}function xm(e){return Array.isArray(e)?e.map(t=>{if(typeof t!="object"||t===null)return null;const n=t,s=typeof n.content=="string"?n.content:"";if(!s)return null;const o=typeof n.activeForm=="string"?n.activeForm:s,a=typeof n.status=="string"?n.status:"pending";return{content:s,activeForm:o,status:a==="completed"||a==="in_progress"?a:"pending"}}).filter(t=>t!==null):[]}function gm({todos:e}){const t=e.filter(o=>o.status==="completed").length,n=e.length,s=e.find(o=>o.status==="in_progress");return r.jsxs("div",{className:"overflow-hidden rounded-[22px] border border-border/60 bg-muted/20",children:[r.jsxs("div",{className:"flex items-center gap-3 border-b border-border/50 px-4 py-3",children:[r.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-border/60 bg-background/70 text-muted-foreground",children:r.jsx(cd,{className:"h-3.5 w-3.5"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.22em] text-muted-foreground",children:"Todos"}),r.jsx("div",{className:"mt-0.5 truncate text-[12px] leading-5 text-muted-foreground/90",children:s?s.activeForm:n===0?"No items":t===n?"All complete":"Up next"})]}),r.jsxs("div",{className:"shrink-0 rounded-full border border-border/60 bg-background/70 px-2 py-0.5 font-mono text-[10px] tracking-wide text-muted-foreground",children:[t,"/",n]})]}),r.jsx("ul",{className:"divide-y divide-border/40",children:e.map((o,a)=>r.jsxs("li",{className:"flex items-start gap-3 px-4 py-2.5",children:[r.jsx(vm,{status:o.status}),r.jsx("span",{className:o.status==="completed"?"text-[13px] leading-5 text-muted-foreground line-through decoration-muted-foreground/60":o.status==="in_progress"?"text-[13px] font-medium leading-5 text-foreground":"text-[13px] leading-5 text-foreground/85",children:o.status==="in_progress"?o.activeForm:o.content})]},`${a}-${o.content}`))})]})}function vm({status:e}){return e==="completed"?r.jsx("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-emerald-500/15 text-emerald-500 dark:text-emerald-400",children:r.jsx(He,{className:"h-3 w-3"})}):e==="in_progress"?r.jsx("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center text-primary",children:r.jsx(Ee,{className:"h-3.5 w-3.5 animate-spin"})}):r.jsx("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground/60",children:r.jsx(zc,{className:"h-3 w-3"})})}function ya(e){const t=e+"CollectionProvider",[n,s]=rt(t),[o,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=p=>{const{scope:v,children:b}=p,y=it.useRef(null),w=it.useRef(new Map).current;return r.jsx(o,{scope:v,itemMap:w,collectionRef:y,children:b})};l.displayName=t;const c=e+"CollectionSlot",d=Wt(c),f=it.forwardRef((p,v)=>{const{scope:b,children:y}=p,w=a(c,b),j=le(v,w.collectionRef);return r.jsx(d,{ref:j,children:y})});f.displayName=c;const u=e+"CollectionItemSlot",m="data-radix-collection-item",h=Wt(u),x=it.forwardRef((p,v)=>{const{scope:b,children:y,...w}=p,j=it.useRef(null),k=le(v,j),C=a(u,b);return it.useEffect(()=>(C.itemMap.set(j,{ref:j,...w}),()=>void C.itemMap.delete(j))),r.jsx(h,{[m]:"",ref:k,children:y})});x.displayName=u;function g(p){const v=a(e+"CollectionConsumer",p);return it.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${m}]`));return Array.from(v.itemMap.values()).sort((C,S)=>w.indexOf(C.ref.current)-w.indexOf(S.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:l,Slot:f,ItemSlot:x},g,s]}var bm=i.createContext(void 0);function Qr(e){const t=i.useContext(bm);return e||t||"ltr"}var ar="rovingFocusGroup.onEntryFocus",ym={bubbles:!1,cancelable:!0},Gt="RovingFocusGroup",[br,wa,wm]=ya(Gt),[Nm,Na]=rt(Gt,[wm]),[jm,km]=Nm(Gt),ja=i.forwardRef((e,t)=>r.jsx(br.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(br.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Cm,{...e,ref:t})})}));ja.displayName=Gt;var Cm=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:o=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:f,preventScrollOnEntryFocus:u=!1,...m}=e,h=i.useRef(null),x=le(t,h),g=Qr(a),[p,v]=Ct({prop:l,defaultProp:c??null,onChange:d,caller:Gt}),[b,y]=i.useState(!1),w=et(f),j=wa(n),k=i.useRef(!1),[C,S]=i.useState(0);return i.useEffect(()=>{const A=h.current;if(A)return A.addEventListener(ar,w),()=>A.removeEventListener(ar,w)},[w]),r.jsx(jm,{scope:n,orientation:s,dir:g,loop:o,currentTabStopId:p,onItemFocus:i.useCallback(A=>v(A),[v]),onItemShiftTab:i.useCallback(()=>y(!0),[]),onFocusableItemAdd:i.useCallback(()=>S(A=>A+1),[]),onFocusableItemRemove:i.useCallback(()=>S(A=>A-1),[]),children:r.jsx(Q.div,{tabIndex:b||C===0?-1:0,"data-orientation":s,...m,ref:x,style:{outline:"none",...e.style},onMouseDown:Z(e.onMouseDown,()=>{k.current=!0}),onFocus:Z(e.onFocus,A=>{const T=!k.current;if(A.target===A.currentTarget&&T&&!b){const R=new CustomEvent(ar,ym);if(A.currentTarget.dispatchEvent(R),!R.defaultPrevented){const F=j().filter(O=>O.focusable),_=F.find(O=>O.active),$=F.find(O=>O.id===p),B=[_,$,...F].filter(Boolean).map(O=>O.ref.current);Sa(B,u)}}k.current=!1}),onBlur:Z(e.onBlur,()=>y(!1))})})}),ka="RovingFocusGroupItem",Ca=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:o=!1,tabStopId:a,children:l,...c}=e,d=Ze(),f=a||d,u=km(ka,n),m=u.currentTabStopId===f,h=wa(n),{onFocusableItemAdd:x,onFocusableItemRemove:g,currentTabStopId:p}=u;return i.useEffect(()=>{if(s)return x(),()=>g()},[s,x,g]),r.jsx(br.ItemSlot,{scope:n,id:f,focusable:s,active:o,children:r.jsx(Q.span,{tabIndex:m?0:-1,"data-orientation":u.orientation,...c,ref:t,onMouseDown:Z(e.onMouseDown,v=>{s?u.onItemFocus(f):v.preventDefault()}),onFocus:Z(e.onFocus,()=>u.onItemFocus(f)),onKeyDown:Z(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){u.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=Am(v,u.orientation,u.dir);if(b!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let w=h().filter(j=>j.focusable).map(j=>j.ref.current);if(b==="last")w.reverse();else if(b==="prev"||b==="next"){b==="prev"&&w.reverse();const j=w.indexOf(v.currentTarget);w=u.loop?Tm(w,j+1):w.slice(j+1)}setTimeout(()=>Sa(w))}}),children:typeof l=="function"?l({isCurrentTabStop:m,hasTabStop:p!=null}):l})})});Ca.displayName=ka;var Sm={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Em(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Am(e,t,n){const s=Em(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return Sm[s]}function Sa(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function Tm(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var Rm=ja,_m=Ca,Mn="Tabs",[Pm]=rt(Mn,[Na]),Ea=Na(),[Dm,es]=Pm(Mn),Aa=i.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:o,defaultValue:a,orientation:l="horizontal",dir:c,activationMode:d="automatic",...f}=e,u=Qr(c),[m,h]=Ct({prop:s,onChange:o,defaultProp:a??"",caller:Mn});return r.jsx(Dm,{scope:n,baseId:Ze(),value:m,onValueChange:h,orientation:l,dir:u,activationMode:d,children:r.jsx(Q.div,{dir:u,"data-orientation":l,...f,ref:t})})});Aa.displayName=Mn;var Ta="TabsList",Ra=i.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...o}=e,a=es(Ta,n),l=Ea(n);return r.jsx(Rm,{asChild:!0,...l,orientation:a.orientation,dir:a.dir,loop:s,children:r.jsx(Q.div,{role:"tablist","aria-orientation":a.orientation,...o,ref:t})})});Ra.displayName=Ta;var _a="TabsTrigger",Pa=i.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:o=!1,...a}=e,l=es(_a,n),c=Ea(n),d=Oa(l.baseId,s),f=Ia(l.baseId,s),u=s===l.value;return r.jsx(_m,{asChild:!0,...c,focusable:!o,active:u,children:r.jsx(Q.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":f,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:d,...a,ref:t,onMouseDown:Z(e.onMouseDown,m=>{!o&&m.button===0&&m.ctrlKey===!1?l.onValueChange(s):m.preventDefault()}),onKeyDown:Z(e.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&l.onValueChange(s)}),onFocus:Z(e.onFocus,()=>{const m=l.activationMode!=="manual";!u&&!o&&m&&l.onValueChange(s)})})})});Pa.displayName=_a;var Da="TabsContent",Ma=i.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:o,children:a,...l}=e,c=es(Da,n),d=Oa(c.baseId,s),f=Ia(c.baseId,s),u=s===c.value,m=i.useRef(u);return i.useEffect(()=>{const h=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(h)},[]),r.jsx(Pt,{present:o||u,children:({present:h})=>r.jsx(Q.div,{"data-state":u?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":d,hidden:!h,id:f,tabIndex:0,...l,ref:t,style:{...e.style,animationDuration:m.current?"0s":void 0},children:h&&a})})});Ma.displayName=Da;function Oa(e,t){return`${e}-trigger-${t}`}function Ia(e,t){return`${e}-content-${t}`}var Mm=Aa,$a=Ra,La=Pa,Fa=Ma;const Ba=Mm,ts=i.forwardRef(({className:e,...t},n)=>r.jsx($a,{ref:n,className:W("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));ts.displayName=$a.displayName;const Xe=i.forwardRef(({className:e,...t},n)=>r.jsx(La,{ref:n,className:W("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Xe.displayName=La.displayName;const Je=i.forwardRef(({className:e,...t},n)=>r.jsx(Fa,{ref:n,className:W("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Je.displayName=Fa.displayName;var Ua="AlertDialog",[Om]=rt(Ua,[Ko]),Ke=Ko(),Wa=e=>{const{__scopeAlertDialog:t,...n}=e,s=Ke(t);return r.jsx(la,{...s,...n,modal:!0})};Wa.displayName=Ua;var Im="AlertDialogTrigger",Va=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Ke(n);return r.jsx(Gf,{...o,...s,ref:t})});Va.displayName=Im;var $m="AlertDialogPortal",za=e=>{const{__scopeAlertDialog:t,...n}=e,s=Ke(t);return r.jsx(ca,{...s,...n})};za.displayName=$m;var Lm="AlertDialogOverlay",Ha=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Ke(n);return r.jsx(Gr,{...o,...s,ref:t})});Ha.displayName=Lm;var Nt="AlertDialogContent",[Fm,Bm]=Om(Nt),Um=Eu("AlertDialogContent"),Ka=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...o}=e,a=Ke(n),l=i.useRef(null),c=le(t,l),d=i.useRef(null);return r.jsx(zf,{contentName:Nt,titleName:qa,docsSlug:"alert-dialog",children:r.jsx(Fm,{scope:n,cancelRef:d,children:r.jsxs(Yr,{role:"alertdialog",...a,...o,ref:c,onOpenAutoFocus:Z(o.onOpenAutoFocus,f=>{var u;f.preventDefault(),(u=d.current)==null||u.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[r.jsx(Um,{children:s}),r.jsx(Vm,{contentRef:l})]})})})});Ka.displayName=Nt;var qa="AlertDialogTitle",Ga=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Ke(n);return r.jsx(Xr,{...o,...s,ref:t})});Ga.displayName=qa;var Ya="AlertDialogDescription",Xa=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Ke(n);return r.jsx(Jr,{...o,...s,ref:t})});Xa.displayName=Ya;var Wm="AlertDialogAction",Ja=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Ke(n);return r.jsx(Dn,{...o,...s,ref:t})});Ja.displayName=Wm;var Za="AlertDialogCancel",Qa=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:o}=Bm(Za,n),a=Ke(n),l=le(t,o);return r.jsx(Dn,{...a,...s,ref:l})});Qa.displayName=Za;var Vm=({contentRef:e})=>{const t=`\`${Nt}\` requires a description for the component to be accessible for screen reader users.
|
|
250
|
-
|
|
251
|
-
You can add a description to the \`${Nt}\` by passing a \`${Ya}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
252
|
-
|
|
253
|
-
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Nt}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
254
|
-
|
|
255
|
-
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return i.useEffect(()=>{var s;document.getElementById((s=e.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},zm=Wa,Hm=Va,Km=za,ei=Ha,ti=Ka,ni=Ja,ri=Qa,si=Ga,oi=Xa;const yr=zm,Ks=Hm,qm=Km,ai=i.forwardRef(({className:e,...t},n)=>r.jsx(ei,{className:W("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));ai.displayName=ei.displayName;const pn=i.forwardRef(({className:e,...t},n)=>r.jsxs(qm,{children:[r.jsx(ai,{}),r.jsx(ti,{ref:n,className:W("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));pn.displayName=ti.displayName;const hn=({className:e,...t})=>r.jsx("div",{className:W("flex flex-col space-y-2 text-center sm:text-left",e),...t});hn.displayName="AlertDialogHeader";const xn=({className:e,...t})=>r.jsx("div",{className:W("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});xn.displayName="AlertDialogFooter";const gn=i.forwardRef(({className:e,...t},n)=>r.jsx(si,{ref:n,className:W("text-lg font-semibold",e),...t}));gn.displayName=si.displayName;const vn=i.forwardRef(({className:e,...t},n)=>r.jsx(oi,{ref:n,className:W("text-sm text-muted-foreground",e),...t}));vn.displayName=oi.displayName;const bn=i.forwardRef(({className:e,...t},n)=>r.jsx(ni,{ref:n,className:W(go(),e),...t}));bn.displayName=ni.displayName;const yn=i.forwardRef(({className:e,...t},n)=>r.jsx(ri,{ref:n,className:W(go({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));yn.displayName=ri.displayName;function qs(e,[t,n]){return Math.min(n,Math.max(t,e))}const Gm=["top","right","bottom","left"],tt=Math.min,Ce=Math.max,wn=Math.round,on=Math.floor,Fe=e=>({x:e,y:e}),Ym={left:"right",right:"left",bottom:"top",top:"bottom"};function wr(e,t,n){return Ce(e,tt(t,n))}function Ve(e,t){return typeof e=="function"?e(t):e}function ze(e){return e.split("-")[0]}function Dt(e){return e.split("-")[1]}function ns(e){return e==="x"?"y":"x"}function rs(e){return e==="y"?"height":"width"}function Le(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ss(e){return ns(Le(e))}function Xm(e,t,n){n===void 0&&(n=!1);const s=Dt(e),o=ss(e),a=rs(o);let l=o==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(l=Nn(l)),[l,Nn(l)]}function Jm(e){const t=Nn(e);return[Nr(e),t,Nr(t)]}function Nr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Gs=["left","right"],Ys=["right","left"],Zm=["top","bottom"],Qm=["bottom","top"];function ep(e,t,n){switch(e){case"top":case"bottom":return n?t?Ys:Gs:t?Gs:Ys;case"left":case"right":return t?Zm:Qm;default:return[]}}function tp(e,t,n,s){const o=Dt(e);let a=ep(ze(e),n==="start",s);return o&&(a=a.map(l=>l+"-"+o),t&&(a=a.concat(a.map(Nr)))),a}function Nn(e){const t=ze(e);return Ym[t]+e.slice(t.length)}function np(e){return{top:0,right:0,bottom:0,left:0,...e}}function ii(e){return typeof e!="number"?np(e):{top:e,right:e,bottom:e,left:e}}function jn(e){const{x:t,y:n,width:s,height:o}=e;return{width:s,height:o,top:n,left:t,right:t+s,bottom:n+o,x:t,y:n}}function Xs(e,t,n){let{reference:s,floating:o}=e;const a=Le(t),l=ss(t),c=rs(l),d=ze(t),f=a==="y",u=s.x+s.width/2-o.width/2,m=s.y+s.height/2-o.height/2,h=s[c]/2-o[c]/2;let x;switch(d){case"top":x={x:u,y:s.y-o.height};break;case"bottom":x={x:u,y:s.y+s.height};break;case"right":x={x:s.x+s.width,y:m};break;case"left":x={x:s.x-o.width,y:m};break;default:x={x:s.x,y:s.y}}switch(Dt(t)){case"start":x[l]-=h*(n&&f?-1:1);break;case"end":x[l]+=h*(n&&f?-1:1);break}return x}async function rp(e,t){var n;t===void 0&&(t={});const{x:s,y:o,platform:a,rects:l,elements:c,strategy:d}=e,{boundary:f="clippingAncestors",rootBoundary:u="viewport",elementContext:m="floating",altBoundary:h=!1,padding:x=0}=Ve(t,e),g=ii(x),v=c[h?m==="floating"?"reference":"floating":m],b=jn(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(v)))==null||n?v:v.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:f,rootBoundary:u,strategy:d})),y=m==="floating"?{x:s,y:o,width:l.floating.width,height:l.floating.height}:l.reference,w=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),j=await(a.isElement==null?void 0:a.isElement(w))?await(a.getScale==null?void 0:a.getScale(w))||{x:1,y:1}:{x:1,y:1},k=jn(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:w,strategy:d}):y);return{top:(b.top-k.top+g.top)/j.y,bottom:(k.bottom-b.bottom+g.bottom)/j.y,left:(b.left-k.left+g.left)/j.x,right:(k.right-b.right+g.right)/j.x}}const sp=50,op=async(e,t,n)=>{const{placement:s="bottom",strategy:o="absolute",middleware:a=[],platform:l}=n,c=l.detectOverflow?l:{...l,detectOverflow:rp},d=await(l.isRTL==null?void 0:l.isRTL(t));let f=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:m}=Xs(f,s,d),h=s,x=0;const g={};for(let p=0;p<a.length;p++){const v=a[p];if(!v)continue;const{name:b,fn:y}=v,{x:w,y:j,data:k,reset:C}=await y({x:u,y:m,initialPlacement:s,placement:h,strategy:o,middlewareData:g,rects:f,platform:c,elements:{reference:e,floating:t}});u=w??u,m=j??m,g[b]={...g[b],...k},C&&x<sp&&(x++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(f=C.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:u,y:m}=Xs(f,h,d)),p=-1)}return{x:u,y:m,placement:h,strategy:o,middlewareData:g}},ap=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:o,rects:a,platform:l,elements:c,middlewareData:d}=t,{element:f,padding:u=0}=Ve(e,t)||{};if(f==null)return{};const m=ii(u),h={x:n,y:s},x=ss(o),g=rs(x),p=await l.getDimensions(f),v=x==="y",b=v?"top":"left",y=v?"bottom":"right",w=v?"clientHeight":"clientWidth",j=a.reference[g]+a.reference[x]-h[x]-a.floating[g],k=h[x]-a.reference[x],C=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f));let S=C?C[w]:0;(!S||!await(l.isElement==null?void 0:l.isElement(C)))&&(S=c.floating[w]||a.floating[g]);const A=j/2-k/2,T=S/2-p[g]/2-1,R=tt(m[b],T),F=tt(m[y],T),_=R,$=S-p[g]-F,z=S/2-p[g]/2+A,B=wr(_,z,$),O=!d.arrow&&Dt(o)!=null&&z!==B&&a.reference[g]/2-(z<_?R:F)-p[g]/2<0,L=O?z<_?z-_:z-$:0;return{[x]:h[x]+L,data:{[x]:B,centerOffset:z-B-L,...O&&{alignmentOffset:L}},reset:O}}}),ip=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:o,middlewareData:a,rects:l,initialPlacement:c,platform:d,elements:f}=t,{mainAxis:u=!0,crossAxis:m=!0,fallbackPlacements:h,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:p=!0,...v}=Ve(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const b=ze(o),y=Le(c),w=ze(c)===c,j=await(d.isRTL==null?void 0:d.isRTL(f.floating)),k=h||(w||!p?[Nn(c)]:Jm(c)),C=g!=="none";!h&&C&&k.push(...tp(c,p,g,j));const S=[c,...k],A=await d.detectOverflow(t,v),T=[];let R=((s=a.flip)==null?void 0:s.overflows)||[];if(u&&T.push(A[b]),m){const z=Xm(o,l,j);T.push(A[z[0]],A[z[1]])}if(R=[...R,{placement:o,overflows:T}],!T.every(z=>z<=0)){var F,_;const z=(((F=a.flip)==null?void 0:F.index)||0)+1,B=S[z];if(B&&(!(m==="alignment"?y!==Le(B):!1)||R.every(M=>Le(M.placement)===y?M.overflows[0]>0:!0)))return{data:{index:z,overflows:R},reset:{placement:B}};let O=(_=R.filter(L=>L.overflows[0]<=0).sort((L,M)=>L.overflows[1]-M.overflows[1])[0])==null?void 0:_.placement;if(!O)switch(x){case"bestFit":{var $;const L=($=R.filter(M=>{if(C){const E=Le(M.placement);return E===y||E==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(E=>E>0).reduce((E,ne)=>E+ne,0)]).sort((M,E)=>M[1]-E[1])[0])==null?void 0:$[0];L&&(O=L);break}case"initialPlacement":O=c;break}if(o!==O)return{reset:{placement:O}}}return{}}}};function Js(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Zs(e){return Gm.some(t=>e[t]>=0)}const lp=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:o="referenceHidden",...a}=Ve(e,t);switch(o){case"referenceHidden":{const l=await s.detectOverflow(t,{...a,elementContext:"reference"}),c=Js(l,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Zs(c)}}}case"escaped":{const l=await s.detectOverflow(t,{...a,altBoundary:!0}),c=Js(l,n.floating);return{data:{escapedOffsets:c,escaped:Zs(c)}}}default:return{}}}}},li=new Set(["left","top"]);async function cp(e,t){const{placement:n,platform:s,elements:o}=e,a=await(s.isRTL==null?void 0:s.isRTL(o.floating)),l=ze(n),c=Dt(n),d=Le(n)==="y",f=li.has(l)?-1:1,u=a&&d?-1:1,m=Ve(t,e);let{mainAxis:h,crossAxis:x,alignmentAxis:g}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof g=="number"&&(x=c==="end"?g*-1:g),d?{x:x*u,y:h*f}:{x:h*f,y:x*u}}const dp=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:o,y:a,placement:l,middlewareData:c}=t,d=await cp(t,e);return l===((n=c.offset)==null?void 0:n.placement)&&(s=c.arrow)!=null&&s.alignmentOffset?{}:{x:o+d.x,y:a+d.y,data:{...d,placement:l}}}}},up=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:o,platform:a}=t,{mainAxis:l=!0,crossAxis:c=!1,limiter:d={fn:b=>{let{x:y,y:w}=b;return{x:y,y:w}}},...f}=Ve(e,t),u={x:n,y:s},m=await a.detectOverflow(t,f),h=Le(ze(o)),x=ns(h);let g=u[x],p=u[h];if(l){const b=x==="y"?"top":"left",y=x==="y"?"bottom":"right",w=g+m[b],j=g-m[y];g=wr(w,g,j)}if(c){const b=h==="y"?"top":"left",y=h==="y"?"bottom":"right",w=p+m[b],j=p-m[y];p=wr(w,p,j)}const v=d.fn({...t,[x]:g,[h]:p});return{...v,data:{x:v.x-n,y:v.y-s,enabled:{[x]:l,[h]:c}}}}}},fp=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:o,rects:a,middlewareData:l}=t,{offset:c=0,mainAxis:d=!0,crossAxis:f=!0}=Ve(e,t),u={x:n,y:s},m=Le(o),h=ns(m);let x=u[h],g=u[m];const p=Ve(c,t),v=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(d){const w=h==="y"?"height":"width",j=a.reference[h]-a.floating[w]+v.mainAxis,k=a.reference[h]+a.reference[w]-v.mainAxis;x<j?x=j:x>k&&(x=k)}if(f){var b,y;const w=h==="y"?"width":"height",j=li.has(ze(o)),k=a.reference[m]-a.floating[w]+(j&&((b=l.offset)==null?void 0:b[m])||0)+(j?0:v.crossAxis),C=a.reference[m]+a.reference[w]+(j?0:((y=l.offset)==null?void 0:y[m])||0)-(j?v.crossAxis:0);g<k?g=k:g>C&&(g=C)}return{[h]:x,[m]:g}}}},mp=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:o,rects:a,platform:l,elements:c}=t,{apply:d=()=>{},...f}=Ve(e,t),u=await l.detectOverflow(t,f),m=ze(o),h=Dt(o),x=Le(o)==="y",{width:g,height:p}=a.floating;let v,b;m==="top"||m==="bottom"?(v=m,b=h===(await(l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(b=m,v=h==="end"?"top":"bottom");const y=p-u.top-u.bottom,w=g-u.left-u.right,j=tt(p-u[v],y),k=tt(g-u[b],w),C=!t.middlewareData.shift;let S=j,A=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=w),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(S=y),C&&!h){const R=Ce(u.left,0),F=Ce(u.right,0),_=Ce(u.top,0),$=Ce(u.bottom,0);x?A=g-2*(R!==0||F!==0?R+F:Ce(u.left,u.right)):S=p-2*(_!==0||$!==0?_+$:Ce(u.top,u.bottom))}await d({...t,availableWidth:A,availableHeight:S});const T=await l.getDimensions(c.floating);return g!==T.width||p!==T.height?{reset:{rects:!0}}:{}}}};function On(){return typeof window<"u"}function Mt(e){return ci(e)?(e.nodeName||"").toLowerCase():"#document"}function Ae(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Be(e){var t;return(t=(ci(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ci(e){return On()?e instanceof Node||e instanceof Ae(e).Node:!1}function Me(e){return On()?e instanceof Element||e instanceof Ae(e).Element:!1}function qe(e){return On()?e instanceof HTMLElement||e instanceof Ae(e).HTMLElement:!1}function Qs(e){return!On()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ae(e).ShadowRoot}function Yt(e){const{overflow:t,overflowX:n,overflowY:s,display:o}=Oe(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&o!=="inline"&&o!=="contents"}function pp(e){return/^(table|td|th)$/.test(Mt(e))}function In(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const hp=/transform|translate|scale|rotate|perspective|filter/,xp=/paint|layout|strict|content/,lt=e=>!!e&&e!=="none";let ir;function os(e){const t=Me(e)?Oe(e):e;return lt(t.transform)||lt(t.translate)||lt(t.scale)||lt(t.rotate)||lt(t.perspective)||!as()&&(lt(t.backdropFilter)||lt(t.filter))||hp.test(t.willChange||"")||xp.test(t.contain||"")}function gp(e){let t=nt(e);for(;qe(t)&&!Et(t);){if(os(t))return t;if(In(t))return null;t=nt(t)}return null}function as(){return ir==null&&(ir=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ir}function Et(e){return/^(html|body|#document)$/.test(Mt(e))}function Oe(e){return Ae(e).getComputedStyle(e)}function $n(e){return Me(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function nt(e){if(Mt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Qs(e)&&e.host||Be(e);return Qs(t)?t.host:t}function di(e){const t=nt(e);return Et(t)?e.ownerDocument?e.ownerDocument.body:e.body:qe(t)&&Yt(t)?t:di(t)}function zt(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=di(e),a=o===((s=e.ownerDocument)==null?void 0:s.body),l=Ae(o);if(a){const c=jr(l);return t.concat(l,l.visualViewport||[],Yt(o)?o:[],c&&n?zt(c):[])}else return t.concat(o,zt(o,[],n))}function jr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ui(e){const t=Oe(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const o=qe(e),a=o?e.offsetWidth:n,l=o?e.offsetHeight:s,c=wn(n)!==a||wn(s)!==l;return c&&(n=a,s=l),{width:n,height:s,$:c}}function is(e){return Me(e)?e:e.contextElement}function jt(e){const t=is(e);if(!qe(t))return Fe(1);const n=t.getBoundingClientRect(),{width:s,height:o,$:a}=ui(t);let l=(a?wn(n.width):n.width)/s,c=(a?wn(n.height):n.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const vp=Fe(0);function fi(e){const t=Ae(e);return!as()||!t.visualViewport?vp:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function bp(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ae(e)?!1:t}function dt(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),a=is(e);let l=Fe(1);t&&(s?Me(s)&&(l=jt(s)):l=jt(e));const c=bp(a,n,s)?fi(a):Fe(0);let d=(o.left+c.x)/l.x,f=(o.top+c.y)/l.y,u=o.width/l.x,m=o.height/l.y;if(a){const h=Ae(a),x=s&&Me(s)?Ae(s):s;let g=h,p=jr(g);for(;p&&s&&x!==g;){const v=jt(p),b=p.getBoundingClientRect(),y=Oe(p),w=b.left+(p.clientLeft+parseFloat(y.paddingLeft))*v.x,j=b.top+(p.clientTop+parseFloat(y.paddingTop))*v.y;d*=v.x,f*=v.y,u*=v.x,m*=v.y,d+=w,f+=j,g=Ae(p),p=jr(g)}}return jn({width:u,height:m,x:d,y:f})}function Ln(e,t){const n=$n(e).scrollLeft;return t?t.left+n:dt(Be(e)).left+n}function mi(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-Ln(e,n),o=n.top+t.scrollTop;return{x:s,y:o}}function yp(e){let{elements:t,rect:n,offsetParent:s,strategy:o}=e;const a=o==="fixed",l=Be(s),c=t?In(t.floating):!1;if(s===l||c&&a)return n;let d={scrollLeft:0,scrollTop:0},f=Fe(1);const u=Fe(0),m=qe(s);if((m||!m&&!a)&&((Mt(s)!=="body"||Yt(l))&&(d=$n(s)),m)){const x=dt(s);f=jt(s),u.x=x.x+s.clientLeft,u.y=x.y+s.clientTop}const h=l&&!m&&!a?mi(l,d):Fe(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-d.scrollLeft*f.x+u.x+h.x,y:n.y*f.y-d.scrollTop*f.y+u.y+h.y}}function wp(e){return Array.from(e.getClientRects())}function Np(e){const t=Be(e),n=$n(e),s=e.ownerDocument.body,o=Ce(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),a=Ce(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let l=-n.scrollLeft+Ln(e);const c=-n.scrollTop;return Oe(s).direction==="rtl"&&(l+=Ce(t.clientWidth,s.clientWidth)-o),{width:o,height:a,x:l,y:c}}const eo=25;function jp(e,t){const n=Ae(e),s=Be(e),o=n.visualViewport;let a=s.clientWidth,l=s.clientHeight,c=0,d=0;if(o){a=o.width,l=o.height;const u=as();(!u||u&&t==="fixed")&&(c=o.offsetLeft,d=o.offsetTop)}const f=Ln(s);if(f<=0){const u=s.ownerDocument,m=u.body,h=getComputedStyle(m),x=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,g=Math.abs(s.clientWidth-m.clientWidth-x);g<=eo&&(a-=g)}else f<=eo&&(a+=f);return{width:a,height:l,x:c,y:d}}function kp(e,t){const n=dt(e,!0,t==="fixed"),s=n.top+e.clientTop,o=n.left+e.clientLeft,a=qe(e)?jt(e):Fe(1),l=e.clientWidth*a.x,c=e.clientHeight*a.y,d=o*a.x,f=s*a.y;return{width:l,height:c,x:d,y:f}}function to(e,t,n){let s;if(t==="viewport")s=jp(e,n);else if(t==="document")s=Np(Be(e));else if(Me(t))s=kp(t,n);else{const o=fi(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return jn(s)}function pi(e,t){const n=nt(e);return n===t||!Me(n)||Et(n)?!1:Oe(n).position==="fixed"||pi(n,t)}function Cp(e,t){const n=t.get(e);if(n)return n;let s=zt(e,[],!1).filter(c=>Me(c)&&Mt(c)!=="body"),o=null;const a=Oe(e).position==="fixed";let l=a?nt(e):e;for(;Me(l)&&!Et(l);){const c=Oe(l),d=os(l);!d&&c.position==="fixed"&&(o=null),(a?!d&&!o:!d&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Yt(l)&&!d&&pi(e,l))?s=s.filter(u=>u!==l):o=c,l=nt(l)}return t.set(e,s),s}function Sp(e){let{element:t,boundary:n,rootBoundary:s,strategy:o}=e;const l=[...n==="clippingAncestors"?In(t)?[]:Cp(t,this._c):[].concat(n),s],c=to(t,l[0],o);let d=c.top,f=c.right,u=c.bottom,m=c.left;for(let h=1;h<l.length;h++){const x=to(t,l[h],o);d=Ce(x.top,d),f=tt(x.right,f),u=tt(x.bottom,u),m=Ce(x.left,m)}return{width:f-m,height:u-d,x:m,y:d}}function Ep(e){const{width:t,height:n}=ui(e);return{width:t,height:n}}function Ap(e,t,n){const s=qe(t),o=Be(t),a=n==="fixed",l=dt(e,!0,a,t);let c={scrollLeft:0,scrollTop:0};const d=Fe(0);function f(){d.x=Ln(o)}if(s||!s&&!a)if((Mt(t)!=="body"||Yt(o))&&(c=$n(t)),s){const x=dt(t,!0,a,t);d.x=x.x+t.clientLeft,d.y=x.y+t.clientTop}else o&&f();a&&!s&&o&&f();const u=o&&!s&&!a?mi(o,c):Fe(0),m=l.left+c.scrollLeft-d.x-u.x,h=l.top+c.scrollTop-d.y-u.y;return{x:m,y:h,width:l.width,height:l.height}}function lr(e){return Oe(e).position==="static"}function no(e,t){if(!qe(e)||Oe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Be(e)===n&&(n=n.ownerDocument.body),n}function hi(e,t){const n=Ae(e);if(In(e))return n;if(!qe(e)){let o=nt(e);for(;o&&!Et(o);){if(Me(o)&&!lr(o))return o;o=nt(o)}return n}let s=no(e,t);for(;s&&pp(s)&&lr(s);)s=no(s,t);return s&&Et(s)&&lr(s)&&!os(s)?n:s||gp(e)||n}const Tp=async function(e){const t=this.getOffsetParent||hi,n=this.getDimensions,s=await n(e.floating);return{reference:Ap(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Rp(e){return Oe(e).direction==="rtl"}const _p={convertOffsetParentRelativeRectToViewportRelativeRect:yp,getDocumentElement:Be,getClippingRect:Sp,getOffsetParent:hi,getElementRects:Tp,getClientRects:wp,getDimensions:Ep,getScale:jt,isElement:Me,isRTL:Rp};function xi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Pp(e,t){let n=null,s;const o=Be(e);function a(){var c;clearTimeout(s),(c=n)==null||c.disconnect(),n=null}function l(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),a();const f=e.getBoundingClientRect(),{left:u,top:m,width:h,height:x}=f;if(c||t(),!h||!x)return;const g=on(m),p=on(o.clientWidth-(u+h)),v=on(o.clientHeight-(m+x)),b=on(u),w={rootMargin:-g+"px "+-p+"px "+-v+"px "+-b+"px",threshold:Ce(0,tt(1,d))||1};let j=!0;function k(C){const S=C[0].intersectionRatio;if(S!==d){if(!j)return l();S?l(!1,S):s=setTimeout(()=>{l(!1,1e-7)},1e3)}S===1&&!xi(f,e.getBoundingClientRect())&&l(),j=!1}try{n=new IntersectionObserver(k,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(k,w)}n.observe(e)}return l(!0),a}function Dp(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=s,f=is(e),u=o||a?[...f?zt(f):[],...t?zt(t):[]]:[];u.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),a&&b.addEventListener("resize",n)});const m=f&&c?Pp(f,n):null;let h=-1,x=null;l&&(x=new ResizeObserver(b=>{let[y]=b;y&&y.target===f&&x&&t&&(x.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=x)==null||w.observe(t)})),n()}),f&&!d&&x.observe(f),t&&x.observe(t));let g,p=d?dt(e):null;d&&v();function v(){const b=dt(e);p&&!xi(p,b)&&n(),p=b,g=requestAnimationFrame(v)}return n(),()=>{var b;u.forEach(y=>{o&&y.removeEventListener("scroll",n),a&&y.removeEventListener("resize",n)}),m==null||m(),(b=x)==null||b.disconnect(),x=null,d&&cancelAnimationFrame(g)}}const Mp=dp,Op=up,Ip=ip,$p=mp,Lp=lp,ro=ap,Fp=fp,Bp=(e,t,n)=>{const s=new Map,o={platform:_p,...n},a={...o.platform,_c:s};return op(e,t,{...o,platform:a})};var Up=typeof document<"u",Wp=function(){},cn=Up?i.useLayoutEffect:Wp;function kn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!kn(e[s],t[s]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,o[s]))return!1;for(s=n;s--!==0;){const a=o[s];if(!(a==="_owner"&&e.$$typeof)&&!kn(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function gi(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function so(e,t){const n=gi(e);return Math.round(t*n)/n}function cr(e){const t=i.useRef(e);return cn(()=>{t.current=e}),t}function Vp(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:o,elements:{reference:a,floating:l}={},transform:c=!0,whileElementsMounted:d,open:f}=e,[u,m]=i.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,x]=i.useState(s);kn(h,s)||x(s);const[g,p]=i.useState(null),[v,b]=i.useState(null),y=i.useCallback(M=>{M!==C.current&&(C.current=M,p(M))},[]),w=i.useCallback(M=>{M!==S.current&&(S.current=M,b(M))},[]),j=a||g,k=l||v,C=i.useRef(null),S=i.useRef(null),A=i.useRef(u),T=d!=null,R=cr(d),F=cr(o),_=cr(f),$=i.useCallback(()=>{if(!C.current||!S.current)return;const M={placement:t,strategy:n,middleware:h};F.current&&(M.platform=F.current),Bp(C.current,S.current,M).then(E=>{const ne={...E,isPositioned:_.current!==!1};z.current&&!kn(A.current,ne)&&(A.current=ne,En.flushSync(()=>{m(ne)}))})},[h,t,n,F,_]);cn(()=>{f===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,m(M=>({...M,isPositioned:!1})))},[f]);const z=i.useRef(!1);cn(()=>(z.current=!0,()=>{z.current=!1}),[]),cn(()=>{if(j&&(C.current=j),k&&(S.current=k),j&&k){if(R.current)return R.current(j,k,$);$()}},[j,k,$,R,T]);const B=i.useMemo(()=>({reference:C,floating:S,setReference:y,setFloating:w}),[y,w]),O=i.useMemo(()=>({reference:j,floating:k}),[j,k]),L=i.useMemo(()=>{const M={position:n,left:0,top:0};if(!O.floating)return M;const E=so(O.floating,u.x),ne=so(O.floating,u.y);return c?{...M,transform:"translate("+E+"px, "+ne+"px)",...gi(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:E,top:ne}},[n,c,O.floating,u.x,u.y]);return i.useMemo(()=>({...u,update:$,refs:B,elements:O,floatingStyles:L}),[u,$,B,O,L])}const zp=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:o}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?ro({element:s.current,padding:o}).fn(n):{}:s?ro({element:s,padding:o}).fn(n):{}}}},Hp=(e,t)=>{const n=Mp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kp=(e,t)=>{const n=Op(e);return{name:n.name,fn:n.fn,options:[e,t]}},qp=(e,t)=>({fn:Fp(e).fn,options:[e,t]}),Gp=(e,t)=>{const n=Ip(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yp=(e,t)=>{const n=$p(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xp=(e,t)=>{const n=Lp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jp=(e,t)=>{const n=zp(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Zp="Arrow",vi=i.forwardRef((e,t)=>{const{children:n,width:s=10,height:o=5,...a}=e;return r.jsx(Q.svg,{...a,ref:t,width:s,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});vi.displayName=Zp;var Qp=vi;function bi(e){const[t,n]=i.useState(void 0);return ye(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const a=o[0];let l,c;if("borderBoxSize"in a){const d=a.borderBoxSize,f=Array.isArray(d)?d[0]:d;l=f.inlineSize,c=f.blockSize}else l=e.offsetWidth,c=e.offsetHeight;n({width:l,height:c})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var ls="Popper",[yi,wi]=rt(ls),[eh,Ni]=yi(ls),ji=e=>{const{__scopePopper:t,children:n}=e,[s,o]=i.useState(null);return r.jsx(eh,{scope:t,anchor:s,onAnchorChange:o,children:n})};ji.displayName=ls;var ki="PopperAnchor",Ci=i.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...o}=e,a=Ni(ki,n),l=i.useRef(null),c=le(t,l),d=i.useRef(null);return i.useEffect(()=>{const f=d.current;d.current=(s==null?void 0:s.current)||l.current,f!==d.current&&a.onAnchorChange(d.current)}),s?null:r.jsx(Q.div,{...o,ref:c})});Ci.displayName=ki;var cs="PopperContent",[th,nh]=yi(cs),Si=i.forwardRef((e,t)=>{var D,U,Y,X,J,K;const{__scopePopper:n,side:s="bottom",sideOffset:o=0,align:a="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:u=0,sticky:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:x="optimized",onPlaced:g,...p}=e,v=Ni(cs,n),[b,y]=i.useState(null),w=le(t,ie=>y(ie)),[j,k]=i.useState(null),C=bi(j),S=(C==null?void 0:C.width)??0,A=(C==null?void 0:C.height)??0,T=s+(a!=="center"?"-"+a:""),R=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},F=Array.isArray(f)?f:[f],_=F.length>0,$={padding:R,boundary:F.filter(sh),altBoundary:_},{refs:z,floatingStyles:B,placement:O,isPositioned:L,middlewareData:M}=Vp({strategy:"fixed",placement:T,whileElementsMounted:(...ie)=>Dp(...ie,{animationFrame:x==="always"}),elements:{reference:v.anchor},middleware:[Hp({mainAxis:o+A,alignmentAxis:l}),d&&Kp({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?qp():void 0,...$}),d&&Gp({...$}),Yp({...$,apply:({elements:ie,rects:fe,availableWidth:Ne,availableHeight:we})=>{const{width:H,height:oe}=fe.reference,ge=ie.floating.style;ge.setProperty("--radix-popper-available-width",`${Ne}px`),ge.setProperty("--radix-popper-available-height",`${we}px`),ge.setProperty("--radix-popper-anchor-width",`${H}px`),ge.setProperty("--radix-popper-anchor-height",`${oe}px`)}}),j&&Jp({element:j,padding:c}),oh({arrowWidth:S,arrowHeight:A}),h&&Xp({strategy:"referenceHidden",...$})]}),[E,ne]=Ti(O),re=et(g);ye(()=>{L&&(re==null||re())},[L,re]);const de=(D=M.arrow)==null?void 0:D.x,ee=(U=M.arrow)==null?void 0:U.y,ue=((Y=M.arrow)==null?void 0:Y.centerOffset)!==0,[he,I]=i.useState();return ye(()=>{b&&I(window.getComputedStyle(b).zIndex)},[b]),r.jsx("div",{ref:z.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:L?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[(X=M.transformOrigin)==null?void 0:X.x,(J=M.transformOrigin)==null?void 0:J.y].join(" "),...((K=M.hide)==null?void 0:K.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(th,{scope:n,placedSide:E,onArrowChange:k,arrowX:de,arrowY:ee,shouldHideArrow:ue,children:r.jsx(Q.div,{"data-side":E,"data-align":ne,...p,ref:w,style:{...p.style,animation:L?void 0:"none"}})})})});Si.displayName=cs;var Ei="PopperArrow",rh={top:"bottom",right:"left",bottom:"top",left:"right"},Ai=i.forwardRef(function(t,n){const{__scopePopper:s,...o}=t,a=nh(Ei,s),l=rh[a.placedSide];return r.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:r.jsx(Qp,{...o,ref:n,style:{...o.style,display:"block"}})})});Ai.displayName=Ei;function sh(e){return e!==null}var oh=e=>({name:"transformOrigin",options:e,fn(t){var v,b,y;const{placement:n,rects:s,middlewareData:o}=t,l=((v=o.arrow)==null?void 0:v.centerOffset)!==0,c=l?0:e.arrowWidth,d=l?0:e.arrowHeight,[f,u]=Ti(n),m={start:"0%",center:"50%",end:"100%"}[u],h=(((b=o.arrow)==null?void 0:b.x)??0)+c/2,x=(((y=o.arrow)==null?void 0:y.y)??0)+d/2;let g="",p="";return f==="bottom"?(g=l?m:`${h}px`,p=`${-d}px`):f==="top"?(g=l?m:`${h}px`,p=`${s.floating.height+d}px`):f==="right"?(g=`${-d}px`,p=l?m:`${x}px`):f==="left"&&(g=`${s.floating.width+d}px`,p=l?m:`${x}px`),{data:{x:g,y:p}}}});function Ti(e){const[t,n="center"]=e.split("-");return[t,n]}var ah=ji,ih=Ci,lh=Si,ch=Ai;function Ri(e){const t=i.useRef({value:e,previous:e});return i.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var _i=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),dh="VisuallyHidden",uh=i.forwardRef((e,t)=>r.jsx(Q.span,{...e,ref:t,style:{..._i,...e.style}}));uh.displayName=dh;var fh=[" ","Enter","ArrowUp","ArrowDown"],mh=[" ","Enter"],ut="Select",[Fn,Bn,ph]=ya(ut),[Ot]=rt(ut,[ph,wi]),Un=wi(),[hh,st]=Ot(ut),[xh,gh]=Ot(ut),Pi=e=>{const{__scopeSelect:t,children:n,open:s,defaultOpen:o,onOpenChange:a,value:l,defaultValue:c,onValueChange:d,dir:f,name:u,autoComplete:m,disabled:h,required:x,form:g}=e,p=Un(t),[v,b]=i.useState(null),[y,w]=i.useState(null),[j,k]=i.useState(!1),C=Qr(f),[S,A]=Ct({prop:s,defaultProp:o??!1,onChange:a,caller:ut}),[T,R]=Ct({prop:l,defaultProp:c,onChange:d,caller:ut}),F=i.useRef(null),_=v?g||!!v.closest("form"):!0,[$,z]=i.useState(new Set),B=Array.from($).map(O=>O.props.value).join(";");return r.jsx(ah,{...p,children:r.jsxs(hh,{required:x,scope:t,trigger:v,onTriggerChange:b,valueNode:y,onValueNodeChange:w,valueNodeHasChildren:j,onValueNodeHasChildrenChange:k,contentId:Ze(),value:T,onValueChange:R,open:S,onOpenChange:A,dir:C,triggerPointerDownPosRef:F,disabled:h,children:[r.jsx(Fn.Provider,{scope:t,children:r.jsx(xh,{scope:e.__scopeSelect,onNativeOptionAdd:i.useCallback(O=>{z(L=>new Set(L).add(O))},[]),onNativeOptionRemove:i.useCallback(O=>{z(L=>{const M=new Set(L);return M.delete(O),M})},[]),children:n})}),_?r.jsxs(nl,{"aria-hidden":!0,required:x,tabIndex:-1,name:u,autoComplete:m,value:T,onChange:O=>R(O.target.value),disabled:h,form:g,children:[T===void 0?r.jsx("option",{value:""}):null,Array.from($)]},B):null]})})};Pi.displayName=ut;var Di="SelectTrigger",Mi=i.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...o}=e,a=Un(n),l=st(Di,n),c=l.disabled||s,d=le(t,l.onTriggerChange),f=Bn(n),u=i.useRef("touch"),[m,h,x]=sl(p=>{const v=f().filter(w=>!w.disabled),b=v.find(w=>w.value===l.value),y=ol(v,p,b);y!==void 0&&l.onValueChange(y.value)}),g=p=>{c||(l.onOpenChange(!0),x()),p&&(l.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return r.jsx(ih,{asChild:!0,...a,children:r.jsx(Q.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":rl(l.value)?"":void 0,...o,ref:d,onClick:Z(o.onClick,p=>{p.currentTarget.focus(),u.current!=="mouse"&&g(p)}),onPointerDown:Z(o.onPointerDown,p=>{u.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(g(p),p.preventDefault())}),onKeyDown:Z(o.onKeyDown,p=>{const v=m.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&h(p.key),!(v&&p.key===" ")&&fh.includes(p.key)&&(g(),p.preventDefault())})})})});Mi.displayName=Di;var Oi="SelectValue",Ii=i.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:o,children:a,placeholder:l="",...c}=e,d=st(Oi,n),{onValueNodeHasChildrenChange:f}=d,u=a!==void 0,m=le(t,d.onValueNodeChange);return ye(()=>{f(u)},[f,u]),r.jsx(Q.span,{...c,ref:m,style:{pointerEvents:"none"},children:rl(d.value)?r.jsx(r.Fragment,{children:l}):a})});Ii.displayName=Oi;var vh="SelectIcon",$i=i.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...o}=e;return r.jsx(Q.span,{"aria-hidden":!0,...o,ref:t,children:s||"▼"})});$i.displayName=vh;var bh="SelectPortal",Li=e=>r.jsx(Vr,{asChild:!0,...e});Li.displayName=bh;var ft="SelectContent",Fi=i.forwardRef((e,t)=>{const n=st(ft,e.__scopeSelect),[s,o]=i.useState();if(ye(()=>{o(new DocumentFragment)},[]),!n.open){const a=s;return a?En.createPortal(r.jsx(Bi,{scope:e.__scopeSelect,children:r.jsx(Fn.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),a):null}return r.jsx(Ui,{...e,ref:t})});Fi.displayName=ft;var Pe=10,[Bi,ot]=Ot(ft),yh="SelectContentImpl",wh=Wt("SelectContent.RemoveScroll"),Ui=i.forwardRef((e,t)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:a,onPointerDownOutside:l,side:c,sideOffset:d,align:f,alignOffset:u,arrowPadding:m,collisionBoundary:h,collisionPadding:x,sticky:g,hideWhenDetached:p,avoidCollisions:v,...b}=e,y=st(ft,n),[w,j]=i.useState(null),[k,C]=i.useState(null),S=le(t,D=>j(D)),[A,T]=i.useState(null),[R,F]=i.useState(null),_=Bn(n),[$,z]=i.useState(!1),B=i.useRef(!1);i.useEffect(()=>{if(w)return zo(w)},[w]),Oo();const O=i.useCallback(D=>{const[U,...Y]=_().map(K=>K.ref.current),[X]=Y.slice(-1),J=document.activeElement;for(const K of D)if(K===J||(K==null||K.scrollIntoView({block:"nearest"}),K===U&&k&&(k.scrollTop=0),K===X&&k&&(k.scrollTop=k.scrollHeight),K==null||K.focus(),document.activeElement!==J))return},[_,k]),L=i.useCallback(()=>O([A,w]),[O,A,w]);i.useEffect(()=>{$&&L()},[$,L]);const{onOpenChange:M,triggerPointerDownPosRef:E}=y;i.useEffect(()=>{if(w){let D={x:0,y:0};const U=X=>{var J,K;D={x:Math.abs(Math.round(X.pageX)-(((J=E.current)==null?void 0:J.x)??0)),y:Math.abs(Math.round(X.pageY)-(((K=E.current)==null?void 0:K.y)??0))}},Y=X=>{D.x<=10&&D.y<=10?X.preventDefault():w.contains(X.target)||M(!1),document.removeEventListener("pointermove",U),E.current=null};return E.current!==null&&(document.addEventListener("pointermove",U),document.addEventListener("pointerup",Y,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",U),document.removeEventListener("pointerup",Y,{capture:!0})}}},[w,M,E]),i.useEffect(()=>{const D=()=>M(!1);return window.addEventListener("blur",D),window.addEventListener("resize",D),()=>{window.removeEventListener("blur",D),window.removeEventListener("resize",D)}},[M]);const[ne,re]=sl(D=>{const U=_().filter(J=>!J.disabled),Y=U.find(J=>J.ref.current===document.activeElement),X=ol(U,D,Y);X&&setTimeout(()=>X.ref.current.focus())}),de=i.useCallback((D,U,Y)=>{const X=!B.current&&!Y;(y.value!==void 0&&y.value===U||X)&&(T(D),X&&(B.current=!0))},[y.value]),ee=i.useCallback(()=>w==null?void 0:w.focus(),[w]),ue=i.useCallback((D,U,Y)=>{const X=!B.current&&!Y;(y.value!==void 0&&y.value===U||X)&&F(D)},[y.value]),he=s==="popper"?kr:Wi,I=he===kr?{side:c,sideOffset:d,align:f,alignOffset:u,arrowPadding:m,collisionBoundary:h,collisionPadding:x,sticky:g,hideWhenDetached:p,avoidCollisions:v}:{};return r.jsx(Bi,{scope:n,content:w,viewport:k,onViewportChange:C,itemRefCallback:de,selectedItem:A,onItemLeave:ee,itemTextRefCallback:ue,focusSelectedItem:L,selectedItemText:R,position:s,isPositioned:$,searchRef:ne,children:r.jsx(zr,{as:wh,allowPinchZoom:!0,children:r.jsx(Wr,{asChild:!0,trapped:y.open,onMountAutoFocus:D=>{D.preventDefault()},onUnmountAutoFocus:Z(o,D=>{var U;(U=y.trigger)==null||U.focus({preventScroll:!0}),D.preventDefault()}),children:r.jsx(Ur,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:D=>D.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:r.jsx(he,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:D=>D.preventDefault(),...b,...I,onPlaced:()=>z(!0),ref:S,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Z(b.onKeyDown,D=>{const U=D.ctrlKey||D.altKey||D.metaKey;if(D.key==="Tab"&&D.preventDefault(),!U&&D.key.length===1&&re(D.key),["ArrowUp","ArrowDown","Home","End"].includes(D.key)){let X=_().filter(J=>!J.disabled).map(J=>J.ref.current);if(["ArrowUp","End"].includes(D.key)&&(X=X.slice().reverse()),["ArrowUp","ArrowDown"].includes(D.key)){const J=D.target,K=X.indexOf(J);X=X.slice(K+1)}setTimeout(()=>O(X)),D.preventDefault()}})})})})})})});Ui.displayName=yh;var Nh="SelectItemAlignedPosition",Wi=i.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...o}=e,a=st(ft,n),l=ot(ft,n),[c,d]=i.useState(null),[f,u]=i.useState(null),m=le(t,S=>u(S)),h=Bn(n),x=i.useRef(!1),g=i.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:b,focusSelectedItem:y}=l,w=i.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&f&&p&&v&&b){const S=a.trigger.getBoundingClientRect(),A=f.getBoundingClientRect(),T=a.valueNode.getBoundingClientRect(),R=b.getBoundingClientRect();if(a.dir!=="rtl"){const J=R.left-A.left,K=T.left-J,ie=S.left-K,fe=S.width+ie,Ne=Math.max(fe,A.width),we=window.innerWidth-Pe,H=qs(K,[Pe,Math.max(Pe,we-Ne)]);c.style.minWidth=fe+"px",c.style.left=H+"px"}else{const J=A.right-R.right,K=window.innerWidth-T.right-J,ie=window.innerWidth-S.right-K,fe=S.width+ie,Ne=Math.max(fe,A.width),we=window.innerWidth-Pe,H=qs(K,[Pe,Math.max(Pe,we-Ne)]);c.style.minWidth=fe+"px",c.style.right=H+"px"}const F=h(),_=window.innerHeight-Pe*2,$=p.scrollHeight,z=window.getComputedStyle(f),B=parseInt(z.borderTopWidth,10),O=parseInt(z.paddingTop,10),L=parseInt(z.borderBottomWidth,10),M=parseInt(z.paddingBottom,10),E=B+O+$+M+L,ne=Math.min(v.offsetHeight*5,E),re=window.getComputedStyle(p),de=parseInt(re.paddingTop,10),ee=parseInt(re.paddingBottom,10),ue=S.top+S.height/2-Pe,he=_-ue,I=v.offsetHeight/2,D=v.offsetTop+I,U=B+O+D,Y=E-U;if(U<=ue){const J=F.length>0&&v===F[F.length-1].ref.current;c.style.bottom="0px";const K=f.clientHeight-p.offsetTop-p.offsetHeight,ie=Math.max(he,I+(J?ee:0)+K+L),fe=U+ie;c.style.height=fe+"px"}else{const J=F.length>0&&v===F[0].ref.current;c.style.top="0px";const ie=Math.max(ue,B+p.offsetTop+(J?de:0)+I)+Y;c.style.height=ie+"px",p.scrollTop=U-ue+p.offsetTop}c.style.margin=`${Pe}px 0`,c.style.minHeight=ne+"px",c.style.maxHeight=_+"px",s==null||s(),requestAnimationFrame(()=>x.current=!0)}},[h,a.trigger,a.valueNode,c,f,p,v,b,a.dir,s]);ye(()=>w(),[w]);const[j,k]=i.useState();ye(()=>{f&&k(window.getComputedStyle(f).zIndex)},[f]);const C=i.useCallback(S=>{S&&g.current===!0&&(w(),y==null||y(),g.current=!1)},[w,y]);return r.jsx(kh,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:x,onScrollButtonChange:C,children:r.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:r.jsx(Q.div,{...o,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Wi.displayName=Nh;var jh="SelectPopperPosition",kr=i.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:o=Pe,...a}=e,l=Un(n);return r.jsx(lh,{...l,...a,ref:t,align:s,collisionPadding:o,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});kr.displayName=jh;var[kh,ds]=Ot(ft,{}),Cr="SelectViewport",Vi=i.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...o}=e,a=ot(Cr,n),l=ds(Cr,n),c=le(t,a.onViewportChange),d=i.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),r.jsx(Fn.Slot,{scope:n,children:r.jsx(Q.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Z(o.onScroll,f=>{const u=f.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:h}=l;if(h!=null&&h.current&&m){const x=Math.abs(d.current-u.scrollTop);if(x>0){const g=window.innerHeight-Pe*2,p=parseFloat(m.style.minHeight),v=parseFloat(m.style.height),b=Math.max(p,v);if(b<g){const y=b+x,w=Math.min(g,y),j=y-w;m.style.height=w+"px",m.style.bottom==="0px"&&(u.scrollTop=j>0?j:0,m.style.justifyContent="flex-end")}}}d.current=u.scrollTop})})})]})});Vi.displayName=Cr;var zi="SelectGroup",[Ch,Sh]=Ot(zi),Eh=i.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=Ze();return r.jsx(Ch,{scope:n,id:o,children:r.jsx(Q.div,{role:"group","aria-labelledby":o,...s,ref:t})})});Eh.displayName=zi;var Hi="SelectLabel",Ki=i.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=Sh(Hi,n);return r.jsx(Q.div,{id:o.id,...s,ref:t})});Ki.displayName=Hi;var Cn="SelectItem",[Ah,qi]=Ot(Cn),Gi=i.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:o=!1,textValue:a,...l}=e,c=st(Cn,n),d=ot(Cn,n),f=c.value===s,[u,m]=i.useState(a??""),[h,x]=i.useState(!1),g=le(t,y=>{var w;return(w=d.itemRefCallback)==null?void 0:w.call(d,y,s,o)}),p=Ze(),v=i.useRef("touch"),b=()=>{o||(c.onValueChange(s),c.onOpenChange(!1))};if(s==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(Ah,{scope:n,value:s,disabled:o,textId:p,isSelected:f,onItemTextChange:i.useCallback(y=>{m(w=>w||((y==null?void 0:y.textContent)??"").trim())},[]),children:r.jsx(Fn.ItemSlot,{scope:n,value:s,disabled:o,textValue:u,children:r.jsx(Q.div,{role:"option","aria-labelledby":p,"data-highlighted":h?"":void 0,"aria-selected":f&&h,"data-state":f?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...l,ref:g,onFocus:Z(l.onFocus,()=>x(!0)),onBlur:Z(l.onBlur,()=>x(!1)),onClick:Z(l.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:Z(l.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:Z(l.onPointerDown,y=>{v.current=y.pointerType}),onPointerMove:Z(l.onPointerMove,y=>{var w;v.current=y.pointerType,o?(w=d.onItemLeave)==null||w.call(d):v.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Z(l.onPointerLeave,y=>{var w;y.currentTarget===document.activeElement&&((w=d.onItemLeave)==null||w.call(d))}),onKeyDown:Z(l.onKeyDown,y=>{var j;((j=d.searchRef)==null?void 0:j.current)!==""&&y.key===" "||(mh.includes(y.key)&&b(),y.key===" "&&y.preventDefault())})})})})});Gi.displayName=Cn;var $t="SelectItemText",Yi=i.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:o,...a}=e,l=st($t,n),c=ot($t,n),d=qi($t,n),f=gh($t,n),[u,m]=i.useState(null),h=le(t,b=>m(b),d.onItemTextChange,b=>{var y;return(y=c.itemTextRefCallback)==null?void 0:y.call(c,b,d.value,d.disabled)}),x=u==null?void 0:u.textContent,g=i.useMemo(()=>r.jsx("option",{value:d.value,disabled:d.disabled,children:x},d.value),[d.disabled,d.value,x]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=f;return ye(()=>(p(g),()=>v(g)),[p,v,g]),r.jsxs(r.Fragment,{children:[r.jsx(Q.span,{id:d.textId,...a,ref:h}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?En.createPortal(a.children,l.valueNode):null]})});Yi.displayName=$t;var Xi="SelectItemIndicator",Ji=i.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return qi(Xi,n).isSelected?r.jsx(Q.span,{"aria-hidden":!0,...s,ref:t}):null});Ji.displayName=Xi;var Sr="SelectScrollUpButton",Zi=i.forwardRef((e,t)=>{const n=ot(Sr,e.__scopeSelect),s=ds(Sr,e.__scopeSelect),[o,a]=i.useState(!1),l=le(t,s.onScrollButtonChange);return ye(()=>{if(n.viewport&&n.isPositioned){let c=function(){const f=d.scrollTop>0;a(f)};const d=n.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),o?r.jsx(el,{...e,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop-d.offsetHeight)}}):null});Zi.displayName=Sr;var Er="SelectScrollDownButton",Qi=i.forwardRef((e,t)=>{const n=ot(Er,e.__scopeSelect),s=ds(Er,e.__scopeSelect),[o,a]=i.useState(!1),l=le(t,s.onScrollButtonChange);return ye(()=>{if(n.viewport&&n.isPositioned){let c=function(){const f=d.scrollHeight-d.clientHeight,u=Math.ceil(d.scrollTop)<f;a(u)};const d=n.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),o?r.jsx(el,{...e,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop+d.offsetHeight)}}):null});Qi.displayName=Er;var el=i.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...o}=e,a=ot("SelectScrollButton",n),l=i.useRef(null),c=Bn(n),d=i.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return i.useEffect(()=>()=>d(),[d]),ye(()=>{var u;const f=c().find(m=>m.ref.current===document.activeElement);(u=f==null?void 0:f.ref.current)==null||u.scrollIntoView({block:"nearest"})},[c]),r.jsx(Q.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:Z(o.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(s,50))}),onPointerMove:Z(o.onPointerMove,()=>{var f;(f=a.onItemLeave)==null||f.call(a),l.current===null&&(l.current=window.setInterval(s,50))}),onPointerLeave:Z(o.onPointerLeave,()=>{d()})})}),Th="SelectSeparator",tl=i.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return r.jsx(Q.div,{"aria-hidden":!0,...s,ref:t})});tl.displayName=Th;var Ar="SelectArrow",Rh=i.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=Un(n),a=st(Ar,n),l=ot(Ar,n);return a.open&&l.position==="popper"?r.jsx(ch,{...o,...s,ref:t}):null});Rh.displayName=Ar;var _h="SelectBubbleInput",nl=i.forwardRef(({__scopeSelect:e,value:t,...n},s)=>{const o=i.useRef(null),a=le(s,o),l=Ri(t);return i.useEffect(()=>{const c=o.current;if(!c)return;const d=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==t&&u){const m=new Event("change",{bubbles:!0});u.call(c,t),c.dispatchEvent(m)}},[l,t]),r.jsx(Q.select,{...n,style:{..._i,...n.style},ref:a,defaultValue:t})});nl.displayName=_h;function rl(e){return e===""||e===void 0}function sl(e){const t=et(e),n=i.useRef(""),s=i.useRef(0),o=i.useCallback(l=>{const c=n.current+l;t(c),(function d(f){n.current=f,window.clearTimeout(s.current),f!==""&&(s.current=window.setTimeout(()=>d(""),1e3))})(c)},[t]),a=i.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,o,a]}function ol(e,t,n){const o=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let l=Ph(e,Math.max(a,0));o.length===1&&(l=l.filter(f=>f!==n));const d=l.find(f=>f.textValue.toLowerCase().startsWith(o.toLowerCase()));return d!==n?d:void 0}function Ph(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var Dh=Pi,al=Mi,Mh=Ii,Oh=$i,Ih=Li,il=Fi,$h=Vi,ll=Ki,cl=Gi,Lh=Yi,Fh=Ji,dl=Zi,ul=Qi,fl=tl;const Re=Dh,We=Mh,je=i.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(al,{ref:s,className:W("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,r.jsx(Oh,{asChild:!0,children:r.jsx(Tt,{className:"h-4 w-4 opacity-50"})})]}));je.displayName=al.displayName;const ml=i.forwardRef(({className:e,...t},n)=>r.jsx(dl,{ref:n,className:W("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Ir,{className:"h-4 w-4"})}));ml.displayName=dl.displayName;const pl=i.forwardRef(({className:e,...t},n)=>r.jsx(ul,{ref:n,className:W("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Tt,{className:"h-4 w-4"})}));pl.displayName=ul.displayName;const ke=i.forwardRef(({className:e,children:t,position:n="popper",...s},o)=>r.jsx(Ih,{children:r.jsxs(il,{ref:o,className:W("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...s,children:[r.jsx(ml,{}),r.jsx($h,{className:W("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(pl,{})]})}));ke.displayName=il.displayName;const Bh=i.forwardRef(({className:e,...t},n)=>r.jsx(ll,{ref:n,className:W("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Bh.displayName=ll.displayName;const be=i.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(cl,{ref:s,className:W("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(Fh,{children:r.jsx(He,{className:"h-4 w-4"})})}),r.jsx(Lh,{children:t})]}));be.displayName=cl.displayName;const Uh=i.forwardRef(({className:e,...t},n)=>r.jsx(fl,{ref:n,className:W("-mx-1 my-1 h-px bg-muted",e),...t}));Uh.displayName=fl.displayName;const Tr="bypass",us=[{value:"claudecode",label:"claudecode",supportsFollowUp:!0},{value:"codex",label:"codex",supportsFollowUp:!0},{value:"mars",label:"mars",disabled:!0,description:"coming soon"},{value:"eureka",label:"eureka",disabled:!0,description:"coming soon"}],hl=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],Wh=new Set(us.filter(e=>e.supportsFollowUp).map(e=>e.value)),Vh=20,zh=3,oo="meshy-working-dir-recents-by-node";function Hh(e){return e.startsWith("/")||e.startsWith("\\\\")||/^[A-Za-z]:[\\/]/.test(e)}function Kh(e){const t=e.trim();return t||"."}function Rr(e){const t=[],n=new Set;for(const s of e){const o=s.trim();if(!(!o||n.has(o))&&(n.add(o),t.push(o),t.length===zh))break}return t}function qh(e,t){const n=t.trim();return Rr(n?[n,...e]:e)}function Gh(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,s]of Object.entries(e)){if(!n||!Array.isArray(s))continue;const o=s.filter(l=>typeof l=="string"),a=Rr(o);a.length>0&&(t[n]=a)}return t}function Yh(e,t,n){if(!t)return e;const s=e[t]??[],o=qh(s,n);if(o.length===0){if(!(t in e))return e;const{[t]:a,...l}=e;return l}return{...e,[t]:o}}function Xh(e,t,n){return e!=="auto"?t.find(s=>s.id===e)??null:n.length===1?n[0]??null:null}function Jh(e,t){const n=t.trim();return n?Hh(n)||!e?n:`${e.replace(/[/\\]+$/,"")}/${n}`:""}function Zh(e,t){return e?e.isAbsolute?e.currentPath:e.currentPath==="."||e.currentPath===""?e.rootPath||(t==null?void 0:t.workDir)||"Node root":e.currentPath:(t==null?void 0:t.workDir)??"Node root"}function ao({value:e,onChange:t,assignTo:n,nodes:s,assignableNodes:o,layout:a="default",chipClassName:l,chipActiveClassName:c,chipInactiveClassName:d,labelClassName:f,triggerClassName:u}){const[m,h]=i.useState(!1),[x,g]=i.useState(null),[p,v]=i.useState(!1),[b,y]=i.useState(!1),[w,j]=i.useState(null),[k,C]=i.useState(""),[S,A]=i.useState(!1),[T,R]=i.useState({}),F=i.useRef(null),_=i.useMemo(()=>Xh(n,s,o),[n,s,o]),$=_==null?void 0:_.id,z=i.useMemo(()=>$?T[$]??[]:[],[T,$]),B=i.useMemo(()=>e.trim()?Jh(_==null?void 0:_.workDir,e):"Use node default",[e,_==null?void 0:_.workDir]);i.useEffect(()=>{if(!(typeof window>"u"))try{const I=window.localStorage.getItem(oo);if(!I)return;const D=JSON.parse(I);R(Gh(D))}catch{}},[]);const O=i.useCallback(I=>{$&&R(D=>{const U=Yh(D,$,I);if(U===D)return D;if(typeof window<"u")try{window.localStorage.setItem(oo,JSON.stringify(U))}catch{}return U})},[$]),L=i.useCallback((I,D=!0)=>{const U=I.trim();t(U),D&&U&&O(U),h(!1)},[t,O]),M=i.useCallback(async(I,D=0,U=!1)=>{if($){j(null),U?y(!0):v(!0);try{const Y=await ic($,{path:I,limit:Vh,offset:D,directoriesOnly:!0,allowAbsolute:!0});g(X=>U&&X?{...Y,entries:[...X.entries,...Y.entries]}:Y)}catch(Y){j(Y instanceof Error?Y.message:"Failed to browse directories"),U||g(null)}finally{v(!1),y(!1)}}},[$]),E=i.useRef(e);E.current=e;const ne=i.useRef(M);ne.current=M,i.useEffect(()=>{if(!m)return;const I=E.current;C(I),A(!1),g(null),j(null),$&&ne.current(Kh(I))},[m,$]),i.useEffect(()=>{if(!m)return;const I=U=>{F.current&&(F.current.contains(U.target)||h(!1))},D=U=>{U.key==="Escape"&&h(!1)};return document.addEventListener("mousedown",I),document.addEventListener("keydown",D),()=>{document.removeEventListener("mousedown",I),document.removeEventListener("keydown",D)}},[m]);const re=i.useCallback(I=>{M(I)},[M]),de=i.useCallback(()=>{x&&M(x.currentPath,x.entries.length,!0)},[x,M]),ee=a==="composer"?r.jsxs(q,{type:"button",variant:"ghost",onClick:()=>h(I=>!I),title:B,"aria-label":`Working directory: ${B}`,className:W(l,u,"min-w-0 max-w-full",e.trim()?c:d),children:[r.jsx(Xc,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:W("min-w-0 truncate",f),children:B})]}):r.jsxs(q,{type:"button",variant:"outline",onClick:()=>h(I=>!I),className:"h-11 w-full justify-between rounded-2xl border-border/70 bg-background/70 px-4",title:B,children:[r.jsx("span",{className:W("truncate",e.trim()?"font-mono text-foreground":"text-muted-foreground"),children:B}),r.jsx("span",{className:"ml-3 shrink-0 text-xs text-muted-foreground",children:_?_.name:"Manual"})]}),ue=Zh(x,_),he=!!(x!=null&&x.parentPath);return r.jsxs("div",{className:W("relative inline-block",a==="composer"?"min-w-0 flex-1":"w-full"),ref:F,children:[a==="default"?r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Working directory"}),ee]}):ee,m&&r.jsxs("div",{className:W("absolute z-50 mt-2 w-[360px] overflow-hidden rounded-2xl border border-border/60 bg-background/95 shadow-lg backdrop-blur",a==="composer"?"left-0":"left-0 right-0 w-auto min-w-[320px]"),children:[z.length>0&&r.jsxs("div",{className:"border-b border-border/60 px-3 py-2.5",children:[r.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:[r.jsx(sd,{className:"h-3 w-3"}),"Recent"]}),r.jsx("div",{className:"flex flex-col gap-1",children:z.map(I=>r.jsx("button",{type:"button",onClick:()=>L(I,!1),className:"truncate rounded-md px-2 py-1 text-left font-mono text-xs text-foreground hover:bg-background/60",title:I,children:I},I))})]}),r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/60 px-3 py-2",children:[r.jsx("button",{type:"button",onClick:()=>(x==null?void 0:x.parentPath)&&re(x.parentPath),disabled:!he||p,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border/60 text-muted-foreground transition-colors hover:bg-background/60 hover:text-foreground disabled:opacity-40",title:"Parent directory",children:r.jsx(_c,{className:"h-3.5 w-3.5"})}),r.jsx("div",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",title:ue,children:ue}),x&&r.jsx("button",{type:"button",onClick:()=>L(x.isAbsolute?x.currentPath:x.currentPath==="."?"":x.currentPath),className:"shrink-0 rounded-md px-2 py-1 text-[11px] font-medium text-foreground hover:bg-background/60",title:"Use this folder",children:"Use"})]}),r.jsxs("div",{className:"max-h-72 overflow-y-auto",children:[_?p?r.jsxs("div",{className:"flex items-center justify-center px-3 py-6 text-xs text-muted-foreground",children:[r.jsx(Ee,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),"Loading..."]}):x&&x.entries.length>0?r.jsxs(r.Fragment,{children:[x.entries.map(I=>r.jsxs("div",{className:"group flex items-stretch border-b border-border/40 last:border-b-0",children:[r.jsxs("button",{type:"button",onClick:()=>L(I.path),className:"flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left hover:bg-background/55",title:`Use ${I.path}`,children:[r.jsx(Zc,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"truncate text-sm text-foreground",children:I.name})]}),r.jsx("button",{type:"button",onClick:()=>re(I.path),className:"flex w-16 shrink-0 items-center justify-center border-l border-border/30 text-muted-foreground hover:bg-background/70 hover:text-foreground",title:"Open subfolder","aria-label":`Open ${I.name}`,children:r.jsx(Or,{className:"h-4 w-4"})})]},I.path)),x.hasMore&&r.jsx("div",{className:"border-t border-border/60 p-2",children:r.jsxs(q,{type:"button",variant:"outline",size:"sm",onClick:de,disabled:b,className:"h-8 w-full rounded-md text-xs",children:[b?r.jsx(Ee,{className:"mr-1.5 h-3 w-3 animate-spin"}):null,"Load more"]})})]}):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:w??"No subfolders."}):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"Select a specific node to browse folders."}),w&&x&&x.entries.length>0&&r.jsx("div",{className:"border-t border-border/60 px-3 py-2 text-xs text-destructive",children:w})]}),r.jsx("div",{className:"flex items-center gap-1.5 border-t border-border/60 bg-background/40 px-3 py-2",children:S?r.jsxs(r.Fragment,{children:[r.jsx(St,{value:k,onChange:I=>C(I.target.value),onKeyDown:I=>{I.key==="Enter"&&k.trim()?(I.preventDefault(),L(k)):I.key==="Escape"&&(I.preventDefault(),A(!1),C(e))},autoFocus:!0,placeholder:"Path (relative or absolute)",className:"h-8 flex-1 rounded-md border-border/60 bg-background/70 font-mono text-xs"}),r.jsx("button",{type:"button",onClick:()=>L(k),disabled:!k.trim(),className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-foreground hover:bg-background/60 disabled:opacity-40",title:"Apply","aria-label":"Apply manual path",children:r.jsx(He,{className:"h-4 w-4"})}),r.jsx("button",{type:"button",onClick:()=>{A(!1),C(e)},className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-background/60 hover:text-foreground",title:"Cancel","aria-label":"Cancel manual path",children:r.jsx(kt,{className:"h-4 w-4"})})]}):r.jsxs("button",{type:"button",onClick:()=>{C(e),A(!0)},className:"flex h-8 flex-1 items-center justify-between rounded-md px-2 text-xs text-muted-foreground hover:bg-background/60 hover:text-foreground",title:"Enter a manual path",children:[r.jsx("span",{children:"Manual input"}),r.jsx($r,{className:"h-3.5 w-3.5"})]})})]})]})}function Qh(e,t={}){const n=e.filter(s=>s.status==="online");return t.currentNodeRole!=="follower"||!t.leaderNodeId?n:n.filter(s=>s.id!==t.leaderNodeId)}function io(){return us.map(e=>r.jsx(be,{value:e.value,disabled:e.disabled,children:r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{children:e.label}),e.description&&r.jsx("span",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:e.description})]})},e.value))}function lo(){return hl.map(e=>r.jsx(be,{value:e.value,children:r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{children:e.label}),e.description&&r.jsx("span",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:e.description})]})},e.value))}function xl({isCurrent:e}){return e?r.jsx(id,{className:"h-3.5 w-3.5 shrink-0 text-emerald-500 dark:text-emerald-400","aria-label":"current node"}):r.jsx(nd,{className:"h-3.5 w-3.5 shrink-0 text-sky-500 dark:text-sky-400","aria-label":"remote follower node"})}function co(e,t){return e.map(n=>{const s=!!t&&n.id===t;return r.jsx(be,{value:n.id,children:r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(xl,{isCurrent:s}),r.jsx("span",{className:"truncate",children:n.name}),r.jsx("span",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:s?"current":"remote"})]})},n.id)})}function ex(e){var t;return((t=us.find(n=>n.value===e))==null?void 0:t.label)??e}function tx(e){var t;return((t=hl.find(n=>n.value===e))==null?void 0:t.label)??e}function gl(e,t,n=!1){const s=e.trim();if(s)return s;const o=t.trim().split(`
|
|
256
|
-
`).map(a=>a.trim()).find(Boolean);return o?o.length>72?`${o.slice(0,69).trimEnd()}...`:o:n?"Image task":""}function nx(e){const t=gl(e.title,e.description,e.images.length>0),n=e.description.trim()||t,s=e.mode??Tr,o=To(e.description,e.images);return!t||!n||!e.agent?null:{title:t,description:n,agent:e.agent,project:e.project.trim()||null,payload:{initialMessage:o,mode:s},priority:e.priority,assignTo:e.assignTo==="auto"?void 0:e.assignTo}}function rx({nodes:e,currentNodeRole:t,currentNodeId:n,leaderNodeId:s,onCreated:o,onCancel:a,className:l,footerClassName:c,submitLabel:d="Create chat",cancelLabel:f="Cancel",autoFocus:u=!1,layout:m="default"}){const[h,x]=i.useState(""),[g,p]=i.useState(""),[v,b]=i.useState("claudecode"),[y,w]=i.useState(Tr),[j,k]=i.useState(""),[C,S]=i.useState("normal"),A=i.useMemo(()=>Qh(e,{currentNodeRole:t,leaderNodeId:s}),[e,t,s]),T=i.useMemo(()=>{var H;return n&&A.some(oe=>oe.id===n)?n:((H=A[0])==null?void 0:H.id)??""},[A,n]),[R,F]=i.useState(T),[_,$]=i.useState(!1),[z,B]=i.useState(!1),{images:O,error:L,fileInputRef:M,pickImages:E,handleFileChange:ne,handlePaste:re,removeImage:de}=ga(),ee=i.useMemo(()=>A.find(H=>H.id===R)??null,[R,A]),ue=!!(n&&(ee==null?void 0:ee.id)===n),he=ex(v),I=tx(y);i.useEffect(()=>{R&&A.some(H=>H.id===R)||F(T)},[R,A,T]),i.useEffect(()=>{k("")},[R]);const D=i.useCallback(async H=>{H.preventDefault();const oe=nx({title:h,description:g,agent:v,project:j,priority:C,assignTo:R,mode:y,images:O});if(oe){$(!0);try{const ge=await lc(oe);o(ge)}catch(ge){pe.error(ge instanceof Error?ge.message:"Failed to create task")}finally{$(!1)}}},[h,g,v,j,C,R,y,O,o]),U=gl(h,g,O.length>0),Y=!!(U&&v&&R&&(g.trim()||O.length>0)),X=i.useCallback(H=>{var oe;H.nativeEvent.isComposing||H.key==="Enter"&&(H.ctrlKey||H.metaKey)&&Y&&!_&&(H.preventDefault(),(oe=H.currentTarget.form)==null||oe.requestSubmit())},[Y,_]),J=O.length>0&&r.jsx("div",{className:"flex flex-wrap gap-3",children:O.map((H,oe)=>r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:Fr(H),alt:H.filename??`attachment ${oe+1}`,className:"h-24 w-24 rounded-2xl border border-border/70 object-cover"}),r.jsx("button",{type:"button",onClick:()=>de(oe),className:"absolute -top-2 -right-2 flex h-6 w-6 items-center justify-center rounded-full border border-border/70 bg-background text-muted-foreground transition-colors hover:text-foreground","aria-label":`Remove ${H.filename??`image ${oe+1}`}`,children:r.jsx(kt,{className:"h-3.5 w-3.5"})})]},`${H.filename??"image"}-${oe}`))}),K=r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Assign to"}),r.jsxs(Re,{value:R,onValueChange:F,children:[r.jsx(je,{className:"h-11 rounded-2xl border-border/70 bg-background/70",children:r.jsx(We,{placeholder:"Select node"})}),r.jsx(ke,{children:co(A,n)})]})]}),ie=r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Agent"}),r.jsxs(Re,{value:v,onValueChange:b,children:[r.jsx(je,{className:"h-11 rounded-2xl border-border/70 bg-background/70",children:r.jsx(We,{placeholder:"Select agent"})}),r.jsx(ke,{children:io()})]})]}),fe=r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Mode"}),r.jsxs(Re,{value:y,onValueChange:H=>w(H),children:[r.jsx(je,{className:"h-11 rounded-2xl border-border/70 bg-background/70",children:r.jsx(We,{placeholder:"Select mode"})}),r.jsx(ke,{children:lo()})]})]}),Ne=r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Priority"}),r.jsxs(Re,{value:C,onValueChange:S,children:[r.jsx(je,{className:"h-11 rounded-2xl border-border/70 bg-background/70",children:r.jsx(We,{placeholder:"Select priority"})}),r.jsxs(ke,{children:[r.jsx(be,{value:"low",children:"Low"}),r.jsx(be,{value:"normal",children:"Normal"}),r.jsx(be,{value:"high",children:"High"}),r.jsx(be,{value:"critical",children:"Critical"})]})]})]}),we=r.jsx(ao,{value:j,onChange:k,assignTo:R,nodes:e,assignableNodes:A});return m==="composer"?r.jsxs("form",{onSubmit:D,className:W("space-y-4",l),children:[r.jsx("input",{ref:M,type:"file",accept:"image/*",multiple:!0,onChange:ne,className:"hidden"}),(()=>{const H="chat-composer__chip h-9 w-auto gap-1.5 rounded-full px-3.5 text-xs shadow-none transition-colors",oe="border-transparent bg-transparent text-muted-foreground hover:bg-background/40 hover:text-foreground",ge="border-border/70 bg-background/55 text-foreground",mt=v==="claudecode",Vn=y===Tr;return r.jsxs("div",{className:"chat-composer relative rounded-[24px] border border-border/60 bg-background/45 shadow-[0_20px_80px_-40px_rgba(0,0,0,0.6)]",children:[r.jsxs("div",{className:"chat-composer__header flex min-w-0 items-center justify-between gap-3 px-4 pt-3",children:[r.jsxs(Re,{value:R,onValueChange:F,children:[r.jsx(je,{className:W(H,ge,"chat-composer__node-trigger border-transparent bg-transparent hover:bg-background/40"),title:`Assigned node: ${(ee==null?void 0:ee.name)??"unassigned"}`,"aria-label":`Assigned node: ${(ee==null?void 0:ee.name)??"unassigned"}`,children:ee?r.jsxs(r.Fragment,{children:[r.jsx(xl,{isCurrent:ue}),r.jsx("span",{className:"min-w-0 truncate",children:ee.name}),r.jsx("span",{className:"chat-composer__header-meta shrink-0 text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:ue?"current":"remote"})]}):r.jsx(We,{placeholder:"Select node"})}),r.jsx(ke,{children:co(A,n)})]}),z?r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(St,{id:"task-title-composer",type:"text",value:h,onChange:ve=>x(ve.target.value),onKeyDown:ve=>{(ve.key==="Enter"||ve.key==="Escape")&&(ve.preventDefault(),B(!1))},autoFocus:!0,placeholder:"Chat title",className:"h-8 w-48 min-w-0 rounded-full border-border/70 bg-background/55 px-3 text-xs shadow-none"}),r.jsx(q,{type:"button",variant:"ghost",size:"icon",onClick:()=>B(!1),"aria-label":"Save title",className:"h-8 w-8 shrink-0 rounded-full text-muted-foreground hover:text-foreground",children:r.jsx(He,{className:"h-3.5 w-3.5"})})]}):r.jsxs("button",{type:"button",onClick:()=>B(!0),className:"chat-composer__title-button flex min-w-0 items-center gap-1.5 rounded-full px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-background/55 hover:text-foreground",title:U||"Title","aria-label":U?`Edit title: ${U}`:"Edit title",children:[r.jsx("span",{className:"chat-composer__title-text max-w-[220px] truncate",children:U||"Title"}),r.jsx($r,{className:"h-3 w-3 shrink-0"})]})]}),r.jsx("textarea",{id:"task-description",value:g,onChange:ve=>p(ve.target.value),onKeyDown:X,onPaste:re,placeholder:"Ask anything...",rows:4,autoFocus:u,"aria-label":"Opening prompt",className:"min-h-[140px] w-full resize-none rounded-[24px] bg-transparent px-5 pt-2 pb-16 text-[15px] leading-7 text-foreground ring-offset-background placeholder:text-muted-foreground/70 focus-visible:outline-none"}),r.jsxs("div",{className:"chat-composer__rail absolute bottom-3 left-3 right-3 flex flex-nowrap items-center gap-2",children:[r.jsx(q,{type:"button",variant:"ghost",size:"icon",onClick:E,"aria-label":"Add images",className:"h-9 w-9 shrink-0 rounded-full text-muted-foreground hover:text-foreground",children:r.jsx(fr,{className:"h-4 w-4"})}),r.jsx("span",{className:"mx-0.5 h-5 w-px bg-border/60","aria-hidden":!0}),r.jsx(ao,{value:j,onChange:k,assignTo:R,nodes:e,assignableNodes:A,layout:"composer",chipClassName:H,chipActiveClassName:ge,chipInactiveClassName:oe,triggerClassName:"chat-composer__icon-trigger",labelClassName:"chat-composer__footer-label"}),r.jsxs(Re,{value:v,onValueChange:b,children:[r.jsxs(je,{className:W(H,"chat-composer__icon-trigger",mt?oe:ge),title:`Agent: ${he}`,"aria-label":`Agent: ${he}`,children:[r.jsx(Mr,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"chat-composer__footer-label truncate",children:he})]}),r.jsx(ke,{children:io()})]}),r.jsxs(Re,{value:y,onValueChange:ve=>w(ve),children:[r.jsxs(je,{className:W(H,"chat-composer__icon-trigger",Vn?oe:ge),title:`Mode: ${I}`,"aria-label":`Mode: ${I}`,children:[r.jsx(Ad,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"chat-composer__footer-label truncate",children:I})]}),r.jsx(ke,{children:lo()})]}),r.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:[r.jsxs(Re,{value:C,onValueChange:S,children:[r.jsx(je,{"aria-label":`Priority: ${C}`,title:`Priority: ${C}`,className:W("h-9 w-9 justify-center gap-0 rounded-full p-0 text-xs shadow-none [&>svg:last-child]:hidden",C==="normal"?"border-transparent bg-transparent text-muted-foreground hover:bg-background/40":"border-border/70 bg-background/55",C==="critical"&&"text-destructive",C==="high"&&"text-amber-600 dark:text-amber-400",C==="low"&&"text-muted-foreground"),children:r.jsx(Gc,{className:W("h-4 w-4",C==="critical"&&"fill-destructive/20")})}),r.jsxs(ke,{children:[r.jsx(be,{value:"low",children:"Low"}),r.jsx(be,{value:"normal",children:"Normal"}),r.jsx(be,{value:"high",children:"High"}),r.jsx(be,{value:"critical",children:"Critical"})]})]}),a&&r.jsxs(q,{type:"button",variant:"ghost",size:"sm",onClick:a,"aria-label":f,className:"chat-composer__cancel h-9 rounded-full px-4 text-xs text-muted-foreground",children:[r.jsx(kt,{className:"chat-composer__cancel-icon h-4 w-4 shrink-0"}),r.jsx("span",{className:"chat-composer__footer-label",children:f})]}),r.jsxs(q,{type:"submit",size:"icon",disabled:!Y||_,className:"h-10 w-10 rounded-full shadow-[0_8px_30px_-8px_hsl(var(--primary)/0.6)]",children:[_?r.jsx(Ee,{className:"h-4 w-4 animate-spin"}):r.jsx(Co,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:_?"Creating chat":d})]})]})]})]})})(),(J||L)&&r.jsxs("div",{className:"space-y-3 rounded-[20px] border border-border/60 bg-background/45 p-4",children:[J,L&&r.jsx("div",{className:"text-xs text-destructive",children:L}),!L&&r.jsx("div",{className:"text-xs text-muted-foreground",children:"Ctrl/Cmd+Enter starts the chat. Enter adds a new line. Paste screenshots directly into the prompt box or use the Images button."})]})]}):r.jsxs("form",{onSubmit:D,className:W("space-y-5",l),children:[r.jsx("input",{ref:M,type:"file",accept:"image/*",multiple:!0,onChange:ne,className:"hidden"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"task-description",className:"text-sm font-medium",children:"Opening prompt"}),r.jsx("textarea",{id:"task-description",value:g,onChange:H=>p(H.target.value),onKeyDown:X,onPaste:re,placeholder:"Describe what the agent should do. This becomes the first message in the chat.",rows:6,autoFocus:u,className:"flex min-h-[144px] w-full resize-none rounded-[22px] border border-border/70 bg-background/70 px-4 py-3 text-sm leading-6 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs(q,{type:"button",variant:"outline",onClick:E,className:"rounded-2xl",children:[r.jsx(fr,{className:"h-4 w-4"}),"Add images"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Ctrl/Cmd+Enter starts the chat. Enter adds a new line. Upload or paste screenshots and reference images with the opening prompt."})]}),J,L&&r.jsx("p",{className:"text-xs text-destructive",children:L})]}),r.jsxs("div",{className:"grid gap-5 lg:grid-cols-[minmax(0,1fr)_220px_220px]",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"task-title",className:"text-sm font-medium",children:"Chat title"}),r.jsx(St,{id:"task-title",type:"text",value:h,onChange:H=>x(H.target.value),placeholder:"Optional. Leave blank to derive it from the prompt.",className:"h-11 rounded-2xl border-border/70 bg-background/70"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:U?`Will appear as: ${U}`:"A title will be generated from the first line of the prompt."})]}),ie,fe]}),we,r.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[Ne,K]}),r.jsxs("div",{className:W("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",c),children:[a&&r.jsx(q,{type:"button",variant:"ghost",onClick:a,className:"rounded-2xl",children:f}),r.jsx(q,{type:"submit",disabled:!Y||_,className:"rounded-2xl px-5",children:_?"Creating...":d})]})]})}const sx=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"archived",label:"Archived"}],Sn=new Set(["pending","assigned"]),vl=new Set(["running"]),ox=new Set(["completed","failed","cancelled"]);function ax(e,t){switch(t){case"running":return vl.has(e.status);case"waiting":return Sn.has(e.status);case"closed":return ox.has(e.status);case"archived":return e.status==="archived";case"active":default:return e.status!=="archived"}}function ix(e,t){const n=t.trim().toLowerCase();return n?[e.title,e.description,e.id,e.agent,e.assignedTo??"",e.assignedNodeName??"",e.project??"",e.effectiveProjectPath??""].some(s=>s.toLowerCase().includes(n)):!0}function fs(e,t,n){if(!e)return"unassigned";const s=t==null?void 0:t.find(o=>o.id===e);return(s==null?void 0:s.name)??n??e.slice(0,8)}function lx(e,t,n){return fs(e,t,n).toLowerCase()}function cx(e,t){return[...e].sort((n,s)=>n.id===t?-1:s.id===t?1:n.name.localeCompare(s.name))}function dx(e){if(!e||typeof e!="object")return null;const t=e;return{draftNewTask:t.draftNewTask===!0,returnRoute:typeof t.returnRoute=="string"?t.returnRoute:void 0,returnTaskId:typeof t.returnTaskId=="string"||t.returnTaskId===null?t.returnTaskId:void 0}}function ux(e){switch(e){case"running":return"bg-amber-500";case"completed":return"bg-emerald-500";case"failed":return"bg-destructive";case"cancelled":case"archived":return"bg-slate-400";case"assigned":return"bg-teal-500";case"pending":default:return"bg-muted-foreground"}}function fx(e){return e==="default workspace"?e:e.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??e}function mx(e){if(e==="default workspace")return"Uses the node default workspace";const t=e.replace(/\\/g,"/"),n=t.split("/").filter(Boolean);return n.length<=3?t:`.../${n.slice(-3).join("/")}`}function px(e){const t=Date.now()-e;return t<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m`:t<864e5?`${Math.floor(t/36e5)}h`:`${Math.floor(t/864e5)}d`}function hx(e){return new Date(e).toLocaleString()}function xx(e){const t=Math.floor(e/1e3),n=Math.floor(t/3600),s=Math.floor(t%3600/60),o=t%60;return`${String(n).padStart(2,"0")}:${String(s).padStart(2,"0")}:${String(o).padStart(2,"0")}`}async function At(e,t="Copied to clipboard"){var n,s,o;try{if((s=(n=globalThis.navigator)==null?void 0:n.clipboard)!=null&&s.writeText)return await globalThis.navigator.clipboard.writeText(e),pe.success(t),!0;const a=globalThis.document,l=(o=a==null?void 0:a.execCommand)==null?void 0:o.bind(a);if(!(a!=null&&a.body)||typeof a.createElement!="function"||typeof l!="function")throw new Error("Clipboard access is unavailable");const c=a.createElement("textarea"),d=a.activeElement,f=d&&typeof d.focus=="function"?d:null;c.value=e,c.setAttribute("readonly","true"),c.style.position="fixed",c.style.opacity="0",c.style.pointerEvents="none",a.body.appendChild(c),c.select(),c.setSelectionRange(0,c.value.length);const u=l("copy");if(a.body.removeChild(c),f==null||f.focus(),!u)throw new Error("Clipboard access is unavailable");return pe.success(t),!0}catch(a){return pe.error(a instanceof Error?a.message:"Failed to copy"),!1}}function bt({label:e,value:t}){return r.jsxs("div",{className:"min-w-[7.25rem] flex-1 rounded-[20px] border border-border/60 bg-background/45 px-3 py-3",children:[r.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:e}),r.jsx("div",{className:"mt-1 text-lg font-semibold tracking-tight text-foreground",children:t})]})}function dr({label:e}){return r.jsx("div",{className:"flex h-64 items-center justify-center text-sm text-muted-foreground",children:e})}function De({label:e,value:t,mono:n,action:s}){return r.jsxs("div",{className:"grid grid-cols-[5.25rem,minmax(0,1fr)] items-start gap-3",children:[r.jsx("span",{className:"pt-0.5 text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:e}),r.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[r.jsx("span",{className:W("min-w-0 flex-1 break-all text-sm text-foreground",n&&"font-mono text-[11px] leading-5"),children:t}),s]})]})}function _r({label:e,value:t,mono:n}){return r.jsxs("div",{className:"rounded-[18px] border border-border/60 bg-background/60 px-3 py-3",children:[r.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:e}),r.jsx("div",{className:W("mt-1 text-sm font-medium text-foreground",n&&"font-mono text-[11px]"),children:t})]})}function bl({capabilities:e,action:t}){return r.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4",children:[r.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[r.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:"Capabilities"}),r.jsx("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:e.length>0?e.map(n=>r.jsx(Se,{variant:"secondary",className:"rounded-full",children:n},n)):r.jsx("span",{className:"text-sm text-muted-foreground",children:"None declared"})})]}),t&&r.jsx("div",{className:"shrink-0 self-start",children:t})]})}const gx=i.lazy(async()=>({default:(await Dr(()=>import("./FilesTab-MiZ3rGO0.js"),__vite__mapDeps([0,1,2,3]))).FilesTab})),vx=i.lazy(async()=>({default:(await Dr(()=>import("./PreviewTab-DdT_r4GF.js"),__vite__mapDeps([4,1,2]))).PreviewTab})),bx=i.lazy(async()=>({default:(await Dr(()=>import("./DiffTab-L7XOR2ma.js"),__vite__mapDeps([5,1,2,3]))).DiffTab}));function yx({onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:n,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l,activeTab:c,setActiveTab:d,creatingTask:f,activeTask:u,assignedNode:m,taskLoading:h,taskError:x,displayEvents:g,hasUserMessageInLogs:p,initialPrompt:v,supportsFollowUp:b,taskUnavailable:y,chatDisabled:w,chatDisabledReason:j,questionBypassEnabled:k,isRunning:C,hasPendingFollowUp:S,canCancel:A,canRetry:T,onRetry:R,onCancel:F,onStartCreateTask:_,onCancelCreateTask:$,onCreateTask:z,onSendMessage:B,onQuestionBypassChange:O,onSubmitQuestionResponse:L,messagesEndRef:M}){const[E,ne]=i.useState(!1),[re,de]=i.useState(!1),[ee,ue]=i.useState(!1),he=i.useRef(0),I=i.useRef(!1),D=i.useCallback(K=>{const ie=K.currentTarget,fe=he.current;if(he.current=ie.scrollTop,I.current)return;if(ie.scrollHeight-ie.scrollTop-ie.clientHeight<30){de(!1),I.current=!0,setTimeout(()=>{I.current=!1},300);return}ie.scrollTop<fe&&fe-ie.scrollTop>10&&de(!0),ie.scrollTop<=0&&de(!0)},[]),U=(u==null?void 0:u.effectiveProjectPath)??(u==null?void 0:u.project)??"default workspace",Y=u?(m==null?void 0:m.name)??fs(u.assignedTo,a==null?void 0:a.nodes,u.assignedNodeName):"unassigned",X=u?[{label:"Working dir",value:U,mono:!0},{label:"Agent",value:u.agent,mono:!0},{label:"Node",value:Y}]:[],J=u!=null&&u.description&&u.description!==u.title?u.description:null;return f?r.jsx(wx,{onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:n,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l,onCancel:$,onCreated:z}):!u&&h?r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden rounded-2xl sm:rounded-[32px] border border-border/60 bg-background/78 shadow-[0_30px_120px_-60px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl",children:[r.jsx("div",{className:"shrink-0 border-b border-border/60 px-4 py-4 sm:px-5",children:r.jsx(dn,{onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:n,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l})}),r.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center overflow-y-auto px-6 py-10 sm:px-8",children:r.jsxs("div",{className:"space-y-4 text-center",children:[r.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full border border-primary/20 bg-primary/10 text-primary",children:r.jsx(Ee,{className:"h-7 w-7 animate-spin"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-foreground",children:"Loading conversation"}),r.jsxs("div",{className:"flex items-center justify-center gap-3 text-sm text-muted-foreground",children:[r.jsx(Ee,{className:"h-4 w-4 animate-spin"}),"Fetching the selected chat thread..."]})]})]})})]}):u?r.jsxs(Ba,{value:c,onValueChange:d,className:"flex h-full min-h-0 flex-col overflow-hidden rounded-2xl sm:rounded-[32px] border border-border/60 bg-background/78 shadow-[0_30px_120px_-60px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl",children:[r.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-2.5 sm:px-5",children:[r.jsx("div",{className:"flex items-center gap-3",children:r.jsx(dn,{onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:n,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l})}),r.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[r.jsx("h2",{className:"min-w-0 truncate text-base font-semibold tracking-tight text-foreground sm:text-lg",title:u.title,children:u.title}),r.jsx(vo,{status:u.status}),r.jsx(cc,{priority:u.priority}),r.jsx(q,{variant:"ghost",size:"icon",className:"ml-auto h-6 w-6 shrink-0 rounded-full text-muted-foreground",onClick:()=>ne(K=>!K),children:E?r.jsx(Ir,{className:"h-3.5 w-3.5"}):r.jsx(Tt,{className:"h-3.5 w-3.5"})})]}),E&&r.jsxs("div",{className:"mt-2 space-y-2",children:[J&&r.jsx("p",{className:"max-w-3xl text-sm leading-5 text-muted-foreground",children:J}),x&&r.jsx("div",{className:"w-fit rounded-full border border-destructive/25 bg-destructive/10 px-3 py-1 text-xs text-destructive",children:x}),r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex flex-col text-xs text-muted-foreground",children:[r.jsxs("span",{children:["updated ",hx(u.updatedAt)]}),r.jsx("span",{className:"font-mono",children:u.id.slice(0,8)})]}),r.jsx("div",{className:"flex items-center gap-2",children:T&&r.jsxs(q,{variant:"outline",size:"sm",onClick:R,className:"shrink-0 rounded-full",children:[r.jsx(yd,{className:"h-3.5 w-3.5"}),"Retry"]})})]})]}),r.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[r.jsxs(ts,{className:"h-auto max-w-full overflow-x-auto rounded-full bg-muted/70 p-1",children:[r.jsx(Xe,{value:"transcript",className:"rounded-full px-2.5 sm:px-4",children:"Transcript"}),r.jsx(Xe,{value:"files",className:"rounded-full px-2.5 sm:px-4",children:"Files"}),r.jsx(Xe,{value:"preview",className:"rounded-full px-2.5 sm:px-4",children:"Preview"}),r.jsx(Xe,{value:"diff",className:"rounded-full px-2.5 sm:px-4",children:"Diff"})]}),C&&r.jsx(Se,{variant:"outline",className:"hidden rounded-full border-amber-500/30 bg-amber-500/10 text-amber-700 sm:inline-flex dark:text-amber-300",children:"Working"}),S&&r.jsx(Se,{variant:"outline",className:"hidden rounded-full border-primary/30 bg-primary/10 text-primary sm:inline-flex",children:"Queued"}),y&&r.jsx(Se,{variant:"outline",className:"hidden rounded-full border-destructive/25 bg-destructive/10 text-destructive sm:inline-flex",children:"Unavailable"})]})]}),r.jsx(Je,{value:"transcript",className:"mt-0 min-h-0 flex-1",children:r.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-5 sm:px-5",onScroll:D,children:r.jsxs("div",{className:"mx-auto flex max-w-[72rem] flex-col gap-5",children:[v&&!p&&r.jsx(Hs,{event:v,questionBypassEnabled:k,onQuestionBypassChange:O,onSubmitQuestionResponse:L,questionResponseDisabled:!b||w}),g.map((K,ie)=>r.jsx(Hs,{event:K,questionBypassEnabled:k,onQuestionBypassChange:O,onSubmitQuestionResponse:L,questionResponseDisabled:!b||w},fu("transcript",K,ie))),g.length===0&&r.jsxs("div",{className:"rounded-[28px] border border-dashed border-border/70 bg-background/35 px-5 py-8 text-center",children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:"Transcript is warming up"}),r.jsx("div",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:h?"Fetching task output...":"The opening prompt has been stored, but the agent has not emitted conversation output yet."})]}),(!b&&u.result||u.error)&&r.jsxs("div",{className:"space-y-3",children:[!b&&u.result&&r.jsxs("div",{className:"rounded-[26px] border border-border/70 bg-card/80 px-4 py-4",children:[r.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:"Stored result"}),r.jsx("pre",{className:"mt-3 overflow-x-auto whitespace-pre-wrap text-xs leading-5 text-muted-foreground",children:JSON.stringify(u.result,null,2)})]}),u.error&&r.jsxs("div",{className:"rounded-[26px] border border-destructive/20 bg-destructive/10 px-4 py-4 text-destructive",children:[r.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.22em]",children:"Stored error"}),r.jsx("pre",{className:"mt-3 overflow-x-auto whitespace-pre-wrap text-xs leading-5",children:u.error})]})]}),(C||S)&&g.length>0&&r.jsxs("div",{className:"flex items-center gap-3 rounded-[24px] border border-border/60 bg-background/45 px-4 py-3 text-sm text-muted-foreground",children:[r.jsx(Ee,{className:"h-4 w-4 animate-spin"}),"The agent is still working on this conversation."]}),r.jsx("div",{ref:M})]})}),b?re?r.jsx(q,{size:"icon",onClick:()=>de(!1),className:"absolute bottom-4 right-4 z-10 h-12 w-12 rounded-full shadow-lg",children:r.jsx($r,{className:"h-5 w-5"})}):r.jsx("div",{className:"shrink-0",children:r.jsx("div",{className:"mx-auto w-full max-w-[72rem]",children:r.jsx(rm,{onSend:B,disabled:w,disabledReason:j,contextItems:X,placeholder:w?j:"Continue the conversation...",running:C||S,onStop:A?()=>ue(!0):void 0})})}):r.jsx("div",{className:"shrink-0 border-t border-border/60 px-4 py-4 text-sm text-muted-foreground sm:px-5",children:"This task does not expose follow-up chat messages. Use Files, Preview, or Diff to inspect the result."})]})}),r.jsx(Je,{value:"files",className:"mt-0 min-h-0 flex-1 overflow-hidden",children:r.jsx(i.Suspense,{fallback:r.jsx(dr,{label:"Loading files..."}),children:r.jsx(gx,{taskId:u.id})})}),r.jsx(Je,{value:"preview",className:"mt-0 min-h-0 flex-1 overflow-hidden",children:r.jsx(i.Suspense,{fallback:r.jsx(dr,{label:"Loading preview..."}),children:r.jsx(vx,{taskId:u.id})})}),r.jsx(Je,{value:"diff",className:"mt-0 min-h-0 flex-1 overflow-hidden",children:r.jsx(i.Suspense,{fallback:r.jsx(dr,{label:"Loading diff..."}),children:r.jsx(bx,{taskId:u.id})})}),r.jsx(yr,{open:ee,onOpenChange:ue,children:r.jsxs(pn,{children:[r.jsxs(hn,{children:[r.jsx(gn,{children:"Stop this task?"}),r.jsx(vn,{children:"The task will stop and move to a cancelled state."})]}),r.jsxs(xn,{children:[r.jsx(yn,{children:"Keep running"}),r.jsx(bn,{onClick:F,children:"Stop task"})]})]})})]}):r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden rounded-2xl sm:rounded-[32px] border border-border/60 bg-background/78 shadow-[0_30px_120px_-60px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl",children:[r.jsx("div",{className:"shrink-0 border-b border-border/60 px-4 py-4 sm:px-5",children:r.jsx(dn,{onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:n,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l})}),r.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center overflow-y-auto px-6 py-10 sm:px-8",children:r.jsxs("div",{className:"w-full max-w-2xl text-center",children:[r.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full border border-primary/20 bg-primary/10 text-primary",children:r.jsx(Mr,{className:"h-7 w-7"})}),r.jsx("h2",{className:"mt-5 text-xl font-semibold tracking-tight text-foreground sm:text-3xl",children:"No chat selected"}),r.jsx("p",{className:"mx-auto mt-3 max-w-xl text-sm leading-6 text-muted-foreground",children:"Open a task from the left sidebar to continue the conversation, or start a new task to create a fresh chat thread."}),r.jsxs(q,{onClick:_,className:"mt-6 rounded-full px-5",children:[r.jsx(No,{className:"h-4 w-4"}),"Start new chat"]}),x&&r.jsx("div",{className:"mx-auto mt-4 max-w-lg rounded-[20px] border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:x})]})})]})}function wx({onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:n,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l,onCancel:c,onCreated:d}){var f,u,m;return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden rounded-2xl sm:rounded-[32px] border border-border/60 bg-background/78 shadow-[0_30px_120px_-60px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl",children:[r.jsx("div",{className:"shrink-0 border-b border-border/60 px-4 py-4 sm:px-5",children:r.jsx(dn,{onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:n,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l})}),r.jsx("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center overflow-y-auto px-6 py-10 sm:px-8",children:r.jsx("div",{className:"w-full max-w-2xl",children:r.jsx(rx,{nodes:(a==null?void 0:a.nodes)??[],currentNodeRole:(f=a==null?void 0:a.self)==null?void 0:f.role,currentNodeId:((u=a==null?void 0:a.self)==null?void 0:u.id)??null,leaderNodeId:((m=a==null?void 0:a.leader)==null?void 0:m.id)??null,onCreated:d,onCancel:c,submitLabel:"Start chat",autoFocus:!0,layout:"composer"})})})]})}function dn({onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:n,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l}){var c;return r.jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[r.jsx(Nx,{desktopTasksOpen:t,mobileTasksPanelOpen:n,onToggleTasks:e}),r.jsx(Se,{variant:"outline",className:"hidden rounded-full border-border/70 bg-background/60 sm:inline-flex",children:l?"Live":"Retrying"}),((c=a==null?void 0:a.leader)==null?void 0:c.name)&&r.jsxs(Se,{variant:"outline",className:"hidden rounded-full border-border/70 bg-background/60 sm:inline-flex",children:["leader ",a.leader.name]})]}),r.jsxs(q,{variant:"outline",onClick:o,className:"shrink-0 rounded-full border-border/70 bg-background/60 px-3 sm:px-4",children:[s?r.jsx(ko,{className:"h-4 w-4"}):r.jsx(gd,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:s?"Hide cluster":"Show cluster"})]})]})}function Nx({desktopTasksOpen:e,mobileTasksPanelOpen:t,onToggleTasks:n}){var o,a;const s=(a=(o=globalThis.window)==null?void 0:o.matchMedia("(min-width: 1024px)"))!=null&&a.matches?e:t;return r.jsxs(q,{variant:"outline",onClick:n,className:"rounded-full border-border/70 bg-background/60 px-3 sm:px-4",children:[s?r.jsx(jo,{className:"h-4 w-4"}):r.jsx(pd,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:s?"Hide tasks":"Show tasks"})]})}const jx={node:"border-teal-500/30 bg-teal-500/10 text-teal-700 dark:text-teal-300",task:"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",election:"border-indigo-500/30 bg-indigo-500/10 text-indigo-700 dark:text-indigo-300",cluster:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"};function kx(e){return e.split(".")[0]??"unknown"}function Cx(e){return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}function ur(e,t){return(t==null?void 0:t.get(e))??e}function Sx(e,t){const n=e.data;switch(e.type){case"node.joined":return`${n.name} joined the cluster`;case"node.left":return`${ur(n.nodeId,t)} left (${n.reason})`;case"node.status":return`${ur(n.nodeId,t)} is now ${n.status}`;case"task.created":return`"${n.title}" created`;case"task.assigned":return`task assigned to ${ur(n.nodeId,t)}`;case"task.status":return`task ${n.taskId.slice(0,8)} -> ${n.status}`;case"election.started":return`candidate ${n.candidateId.slice(0,8)} term ${n.term}`;case"election.complete":return`leader elected, term ${n.term}`;case"cluster.state":return`${n.nodeCount} nodes, term ${n.term}`;default:return JSON.stringify(n)}}function Ex(e){return JSON.stringify(e,null,2)}function Ax({events:e,maxHeight:t="400px",emptyTitle:n="No live events yet",emptyDescription:s="Cluster activity appears here as it happens.",nodeNameById:o}){return e.length===0?r.jsx("div",{className:"flex h-28 items-center justify-center rounded-[20px] border border-dashed border-border/70 bg-background/40 text-center",children:r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:n}),r.jsx("div",{className:"mt-1 text-xs text-muted-foreground/70",children:s})]})}):r.jsx("div",{className:"overflow-y-auto pr-1",style:{maxHeight:t},children:r.jsx("div",{className:"space-y-2",children:e.map(a=>{const l=kx(a.type);return r.jsx("div",{className:"rounded-[20px] border border-border/60 bg-background/45 px-4 py-3 transition-colors hover:border-border hover:bg-background/65",children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:Cx(a.timestamp)}),r.jsx(Se,{variant:"outline",className:W("w-fit text-[10px] font-medium uppercase tracking-[0.16em]",jx[l]),children:a.type})]}),r.jsx(q,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 rounded-full text-muted-foreground",onClick:()=>void At(Ex(a),"Event copied"),"aria-label":`Copy ${a.type} event`,title:"Copy event",children:r.jsx(An,{className:"h-3.5 w-3.5"})})]}),r.jsx("div",{className:"text-sm leading-6 text-foreground/85",children:Sx(a,o)})]})},a.id)})})})}function uo({cluster:e,systemInfo:t,nodeNameById:n,nodeBlockingTaskCounts:s,eventTypeFilter:o,onEventTypeFilterChange:a,eventTypeOptions:l,filteredEvents:c,sseConnected:d,clusterLoading:f,clusterError:u,promotePending:m,onPromote:h,onAddNode:x,leavePending:g,onLeaveCluster:p,onToggleNodeDevTunnel:v,devTunnelNodeId:b,onClose:y}){var R,F,_,$,z;const w=((R=e==null?void 0:e.self)==null?void 0:R.role)==="leader",j=((F=e==null?void 0:e.self)==null?void 0:F.role)==="follower"&&!(e!=null&&e.leader),k=(e==null?void 0:e.self)??null,S=cx((e==null?void 0:e.nodes)??[],k==null?void 0:k.id).filter(B=>B.id!==(k==null?void 0:k.id)),A=(k==null?void 0:k.role)==="leader"&&S.length===0,T=(k==null?void 0:k.role)==="follower";return r.jsx("aside",{className:"flex h-full min-h-0 flex-col overflow-hidden rounded-[32px] border border-border/60 bg-background/84 shadow-[0_30px_120px_-60px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl",children:r.jsxs(Ba,{defaultValue:"overview",className:"flex h-full min-h-0 flex-col",children:[r.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-semibold tracking-tight",children:"Operations"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Node, cluster, and live events."})]}),r.jsx(q,{variant:"ghost",size:"icon",onClick:y,className:"rounded-full",children:r.jsx(ko,{className:"h-4 w-4"})})]}),r.jsxs(ts,{className:"mt-4 grid h-auto w-full grid-cols-3 rounded-full bg-muted/70 p-1",children:[r.jsx(Xe,{value:"overview",className:"rounded-full px-3 text-xs",children:"Overview"}),r.jsx(Xe,{value:"nodes",className:"rounded-full px-3 text-xs",children:"Nodes"}),r.jsx(Xe,{value:"events",className:"rounded-full px-3 text-xs",children:"Live events"})]})]}),r.jsx(Je,{value:"overview",className:"mt-0 min-h-0 flex-1",children:r.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto px-4 py-5",children:r.jsxs("div",{className:"space-y-7",children:[k&&r.jsx(fo,{node:k,systemInfo:t,blockingTaskCount:s.get(k.id)??0,devTunnelNodeId:b,onToggleNodeDevTunnel:v,showActions:!1,defaultExpanded:!1}),r.jsxs("section",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:"Cluster snapshot"}),r.jsx(Se,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:d?"Connected":"Reconnecting"})]}),f&&!e?r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Ee,{className:"h-4 w-4 animate-spin"}),"Loading cluster state..."]}):u&&!e?r.jsx("div",{className:"rounded-[22px] border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:u}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(bt,{label:"Term",value:String((e==null?void 0:e.term)??0)}),r.jsx(bt,{label:"Nodes",value:String((e==null?void 0:e.nodes.length)??0)}),r.jsx(bt,{label:"Pending",value:String((e==null?void 0:e.taskSummary.pending)??0)}),r.jsx(bt,{label:"Running",value:String((e==null?void 0:e.taskSummary.running)??0)}),r.jsx(bt,{label:"Completed",value:String((e==null?void 0:e.taskSummary.completed)??0)}),r.jsx(bt,{label:"Failed",value:String((e==null?void 0:e.taskSummary.failed)??0)})]}),r.jsxs("div",{className:"space-y-3 rounded-[24px] border border-border/60 bg-background/45 px-4 py-4",children:[r.jsx(De,{label:"Leader",value:((_=e==null?void 0:e.leader)==null?void 0:_.name)??"None"}),r.jsx(De,{label:"Leader URL",value:(($=e==null?void 0:e.leader)==null?void 0:$.endpoint)??"Unavailable",mono:!0,action:(z=e==null?void 0:e.leader)!=null&&z.endpoint?r.jsx(Ht,{label:"Copy leader URL",onClick:()=>{var B;return void At(((B=e.leader)==null?void 0:B.endpoint)??"","Leader URL copied")}}):void 0}),r.jsx(De,{label:"Feed",value:d?"Receiving live updates":"Reconnecting to event stream"})]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:j&&r.jsxs(q,{variant:"outline",size:"sm",onClick:h,disabled:m,className:"rounded-full",children:[m&&r.jsx(Ee,{className:"h-3.5 w-3.5 animate-spin"}),"Promote self"]})})]})]})]})})}),r.jsx(Je,{value:"nodes",className:"mt-0 min-h-0 flex-1",children:r.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto px-4 py-5",children:r.jsxs("div",{className:"space-y-7",children:[r.jsxs("section",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:"This node"}),A?r.jsx(q,{variant:"outline",size:"sm",onClick:x,className:"rounded-full",children:"Join node"}):T?r.jsxs(q,{variant:"outline",size:"sm",onClick:p,disabled:g,className:"rounded-full",children:[g&&r.jsx(Ee,{className:"h-3.5 w-3.5 animate-spin"}),"Leave cluster"]}):null]}),k&&r.jsx(fo,{node:k,systemInfo:t,blockingTaskCount:s.get(k.id)??0,devTunnelNodeId:b,onToggleNodeDevTunnel:v,showActions:!0,defaultExpanded:!0})]}),r.jsxs("section",{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm font-medium text-foreground",children:["Peer nodes (",S.length,")"]}),S.length>0?r.jsx("div",{className:"space-y-3",children:S.map(B=>r.jsx(Tx,{node:B,isLeader:!!w,blockingTaskCount:s.get(B.id)??0,devTunnelNodeId:b,onToggleNodeDevTunnel:v},B.id))}):r.jsx("div",{className:"rounded-[24px] border border-dashed border-border/70 bg-background/35 px-4 py-5 text-sm text-muted-foreground",children:"No peer nodes are connected yet."})]})]})})}),r.jsx(Je,{value:"events",className:"mt-0 min-h-0 flex-1",children:r.jsxs("div",{className:"flex h-full min-h-0 flex-col px-4 py-5",children:[r.jsxs("div",{className:"mb-4 space-y-3",children:[r.jsx("div",{children:r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[r.jsx(dc,{className:W("h-4 w-4",d?"text-emerald-500":"text-destructive")}),"Live events"]})}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs(Re,{value:o,onValueChange:a,children:[r.jsx(je,{className:"h-9 min-w-[11rem] flex-1 rounded-full border-border/70 bg-background/55 text-[12px] sm:max-w-[15rem]",children:r.jsx(We,{placeholder:"Event type"})}),r.jsx(ke,{children:l.map(B=>r.jsx(be,{value:B,className:"text-[12px]",children:B==="all"?"All event types":B},B))})]}),r.jsx(Se,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:d?"Connected":"Reconnecting"})]})]}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(Ax,{events:c,maxHeight:"100%",emptyTitle:o==="all"?"No live events yet":"No matching events",emptyDescription:o==="all"?"Cluster activity appears here as it happens.":`No "${o}" events are in the current stream.`,nodeNameById:n})})]})})]})})}function fo({node:e,systemInfo:t,blockingTaskCount:n,devTunnelNodeId:s,onToggleNodeDevTunnel:o,showActions:a=!0,defaultExpanded:l=!1}){const[c,d]=i.useState(l),f=(t==null?void 0:t.dashboardOrigin)??e.dashboardOrigin,u=e.devtunnelEndpoint??e.endpoint,m=f??e.endpoint,h=(t==null?void 0:t.workDir)??e.workDir,x=Ao(e,t==null?void 0:t.transportType),g=Lr(e,t==null?void 0:t.transportType),p=g&&Rt((t==null?void 0:t.transportType)??e.transportType)?!0:Eo(e,t==null?void 0:t.transportType),v=n>0;return r.jsxs("section",{className:"rounded-[28px] border border-primary/20 bg-primary/8 shadow-[0_24px_80px_-60px_hsl(var(--primary)/0.9)]",children:[r.jsxs("button",{type:"button",onClick:()=>d(b=>!b),className:"w-full px-4 py-3.5 text-left",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[c?r.jsx(Tt,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):r.jsx(Or,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),r.jsx(bo,{status:e.status}),r.jsx("span",{className:"text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:"Current node"}),r.jsx("a",{href:m,target:"_blank",rel:"noreferrer",onClick:b=>b.stopPropagation(),className:"ml-auto shrink-0 text-muted-foreground transition-colors hover:text-primary",title:"Open Dashboard",children:r.jsx(wo,{className:"h-3.5 w-3.5"})})]}),r.jsxs("div",{className:"mt-1.5 flex items-center gap-2 pl-6",children:[r.jsx("span",{className:"text-sm font-semibold tracking-tight text-foreground",children:e.name}),r.jsx(yo,{role:e.role}),r.jsx(Se,{variant:"outline",className:"rounded-full border-primary/30 bg-background/60 text-[10px] capitalize",children:e.status})]})]}),c&&r.jsxs("div",{className:"space-y-4 border-t border-primary/15 px-4 pb-4 pt-3",children:[r.jsxs("div",{className:"space-y-3 rounded-[20px] border border-primary/20 bg-background/72 px-3.5 py-3.5",children:[r.jsx(De,{label:"Node ID",value:e.id,mono:!0}),f&&r.jsx(De,{label:"Dashboard",value:f,mono:!0,action:r.jsx(Ht,{label:"Copy dashboard URL",onClick:()=>void At(f,"Dashboard URL copied")})}),r.jsx(De,{label:"Node URL",value:u,mono:!0,action:r.jsx(Ht,{label:"Copy node URL",onClick:()=>void At(u,"Node URL copied")})}),h&&r.jsx(De,{label:"Workspace",value:h,mono:!0})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(_r,{label:"Transport",value:x}),t&&r.jsx(_r,{label:"Uptime",value:xx(t.uptime),mono:!0})]}),r.jsx(bl,{capabilities:e.capabilities,action:a&&p?r.jsxs(q,{variant:"outline",size:"sm",onClick:()=>o(e),disabled:s===e.id||v,className:"rounded-full",title:v?"Finish assigned or running tasks before changing remote access":void 0,children:[s===e.id&&r.jsx(Ee,{className:"h-3.5 w-3.5 animate-spin"}),g?"Disable Remote Access":"Enable Remote Access"]}):void 0}),a&&p&&v&&r.jsxs("div",{className:"text-xs text-muted-foreground",children:[n," active task",n===1?"":"s"," on this node."]})]})]})}function Tx({node:e,isLeader:t,blockingTaskCount:n,devTunnelNodeId:s,onToggleNodeDevTunnel:o}){const[a,l]=i.useState(!1),c=e.dashboardOrigin,d=e.devtunnelEndpoint??e.endpoint,f=c??e.endpoint,u=Ao(e),m=Lr(e),h=Eo(e),x=n>0;return r.jsxs("div",{className:"rounded-[24px] border border-border/60 bg-background/45",children:[r.jsxs("button",{type:"button",onClick:()=>l(g=>!g),className:"w-full px-4 py-3 text-left",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[a?r.jsx(Tt,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):r.jsx(Or,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),r.jsx(bo,{status:e.status}),r.jsx("span",{className:"text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:"Peer node"}),r.jsx("a",{href:f,target:"_blank",rel:"noreferrer",onClick:g=>g.stopPropagation(),className:"ml-auto shrink-0 text-muted-foreground transition-colors hover:text-primary",title:"Open Dashboard",children:r.jsx(wo,{className:"h-3.5 w-3.5"})})]}),r.jsxs("div",{className:"mt-1.5 flex items-center gap-2 pl-6",children:[r.jsx("span",{className:"text-sm font-semibold text-foreground",children:e.name}),r.jsx(yo,{role:e.role}),r.jsx(Se,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 text-[10px] capitalize",children:e.status})]})]}),a&&r.jsxs("div",{className:"space-y-4 border-t border-border/50 px-4 pb-4 pt-3",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(De,{label:"Node ID",value:e.id,mono:!0}),c&&r.jsx(De,{label:"Dashboard",value:c,mono:!0,action:r.jsx(Ht,{label:"Copy dashboard URL",onClick:()=>void At(c,"Dashboard URL copied")})}),r.jsx(De,{label:"Node URL",value:d,mono:!0,action:r.jsx(Ht,{label:"Copy node URL",onClick:()=>void At(d,"Node URL copied")})}),e.workDir&&r.jsx(De,{label:"Workspace",value:e.workDir,mono:!0}),r.jsx(_r,{label:"Transport",value:u})]}),r.jsx(bl,{capabilities:e.capabilities,action:t&&h?r.jsxs(q,{variant:"outline",size:"sm",onClick:()=>o(e),disabled:s===e.id||x,className:"rounded-full",title:x?"Finish assigned or running tasks before changing remote access":void 0,children:[s===e.id&&r.jsx(Ee,{className:"h-3.5 w-3.5 animate-spin"}),m?"Disable Remote Access":"Enable Remote Access"]}):void 0}),t&&h&&x&&r.jsxs("div",{className:"text-xs text-muted-foreground",children:[n," active task",n===1?"":"s"," on this node."]})]})]})}function Ht({label:e,onClick:t}){return r.jsx(q,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 rounded-full text-muted-foreground",onClick:t,"aria-label":e,title:e,children:r.jsx(An,{className:"h-3.5 w-3.5"})})}function Rx(e,t,n,s){var l;if(!e)return{taskUnavailable:!1,chatDisabled:!0,chatDisabledReason:"Select a task to continue the conversation."};const o=((l=t==null?void 0:t.self)==null?void 0:l.role)==="follower";return e.assignedTo!==null&&e.assignedNodeAvailable===!1?{taskUnavailable:!0,chatDisabled:!0,chatDisabledReason:`${e.assignedNodeName??"Assigned node"} is unavailable. Leave the cluster on that node or re-run the task elsewhere.`}:o?{taskUnavailable:!1,chatDisabled:!0,chatDisabledReason:"Follower nodes are read-only. Use the leader dashboard to manage chat, or leave the cluster first."}:n||s?{taskUnavailable:!1,chatDisabled:!0,chatDisabledReason:"Waiting for the current turn to finish..."}:Sn.has(e.status)||e.status==="archived"?{taskUnavailable:!1,chatDisabled:!0,chatDisabledReason:Sn.has(e.status)?"Task has not started yet...":"Archived tasks are read-only."}:{taskUnavailable:!1,chatDisabled:!1,chatDisabledReason:"Continue the conversation..."}}var Wn="Checkbox",[_x]=rt(Wn),[Px,ms]=_x(Wn);function Dx(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:o,disabled:a,form:l,name:c,onCheckedChange:d,required:f,value:u="on",internal_do_not_use_render:m}=e,[h,x]=Ct({prop:n,defaultProp:o??!1,onChange:d,caller:Wn}),[g,p]=i.useState(null),[v,b]=i.useState(null),y=i.useRef(!1),w=g?!!l||!!g.closest("form"):!0,j={checked:h,disabled:a,setChecked:x,control:g,setControl:p,name:c,form:l,value:u,hasConsumerStoppedPropagationRef:y,required:f,defaultChecked:Qe(o)?!1:o,isFormControl:w,bubbleInput:v,setBubbleInput:b};return r.jsx(Px,{scope:t,...j,children:Mx(m)?m(j):s})}var yl="CheckboxTrigger",wl=i.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...s},o)=>{const{control:a,value:l,disabled:c,checked:d,required:f,setControl:u,setChecked:m,hasConsumerStoppedPropagationRef:h,isFormControl:x,bubbleInput:g}=ms(yl,e),p=le(o,u),v=i.useRef(d);return i.useEffect(()=>{const b=a==null?void 0:a.form;if(b){const y=()=>m(v.current);return b.addEventListener("reset",y),()=>b.removeEventListener("reset",y)}},[a,m]),r.jsx(Q.button,{type:"button",role:"checkbox","aria-checked":Qe(d)?"mixed":d,"aria-required":f,"data-state":Sl(d),"data-disabled":c?"":void 0,disabled:c,value:l,...s,ref:p,onKeyDown:Z(t,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:Z(n,b=>{m(y=>Qe(y)?!0:!y),g&&x&&(h.current=b.isPropagationStopped(),h.current||b.stopPropagation())})})});wl.displayName=yl;var ps=i.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:s,checked:o,defaultChecked:a,required:l,disabled:c,value:d,onCheckedChange:f,form:u,...m}=e;return r.jsx(Dx,{__scopeCheckbox:n,checked:o,defaultChecked:a,disabled:c,required:l,onCheckedChange:f,name:s,form:u,value:d,internal_do_not_use_render:({isFormControl:h})=>r.jsxs(r.Fragment,{children:[r.jsx(wl,{...m,ref:t,__scopeCheckbox:n}),h&&r.jsx(Cl,{__scopeCheckbox:n})]})})});ps.displayName=Wn;var Nl="CheckboxIndicator",jl=i.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...o}=e,a=ms(Nl,n);return r.jsx(Pt,{present:s||Qe(a.checked)||a.checked===!0,children:r.jsx(Q.span,{"data-state":Sl(a.checked),"data-disabled":a.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});jl.displayName=Nl;var kl="CheckboxBubbleInput",Cl=i.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:o,checked:a,defaultChecked:l,required:c,disabled:d,name:f,value:u,form:m,bubbleInput:h,setBubbleInput:x}=ms(kl,e),g=le(n,x),p=Ri(a),v=bi(s);i.useEffect(()=>{const y=h;if(!y)return;const w=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(w,"checked").set,C=!o.current;if(p!==a&&k){const S=new Event("click",{bubbles:C});y.indeterminate=Qe(a),k.call(y,Qe(a)?!1:a),y.dispatchEvent(S)}},[h,p,a,o]);const b=i.useRef(Qe(a)?!1:a);return r.jsx(Q.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??b.current,required:c,disabled:d,name:f,value:u,form:m,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Cl.displayName=kl;function Mx(e){return typeof e=="function"}function Qe(e){return e==="indeterminate"}function Sl(e){return Qe(e)?"indeterminate":e?"checked":"unchecked"}const Pr=i.forwardRef(({className:e,...t},n)=>r.jsx(ps,{ref:n,className:W("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:r.jsx(jl,{className:W("flex items-center justify-center text-current"),children:r.jsx(He,{className:"h-3.5 w-3.5"})})}));Pr.displayName=ps.displayName;function mo({toolbarTasks:e,activeTaskId:t,tasksLoading:n,tasksError:s,isLeader:o,scope:a,agentFilter:l,nodeFilter:c,agentOptions:d,nodeOptions:f,nodeNameById:u,searchQuery:m,selectedTaskIds:h,allVisibleTasksSelected:x,someVisibleTasksSelected:g,canBatchArchive:p,onSearchChange:v,onScopeChange:b,onAgentFilterChange:y,onNodeFilterChange:w,onToggleTaskSelected:j,onToggleAllVisibleTasks:k,onBatchArchive:C,onBatchDelete:S,onCreateTask:A,onSelectTask:T,onClose:R}){const[F,_]=i.useState(!!m),[$,z]=i.useState(!1),B=i.useRef(null),O=i.useRef(null),L=h.size,M=a!=="active"||c!=="all"||l!=="all";return i.useEffect(()=>{m&&_(!0)},[m]),i.useEffect(()=>{var E;F&&((E=B.current)==null||E.focus())},[F]),i.useEffect(()=>{if(!F)return;const E=re=>{var ee;const de=re.target;de instanceof Node&&((ee=O.current)!=null&&ee.contains(de)||_(!1))},ne=re=>{re.key==="Escape"&&_(!1)};return document.addEventListener("mousedown",E),document.addEventListener("keydown",ne),()=>{document.removeEventListener("mousedown",E),document.removeEventListener("keydown",ne)}},[F]),r.jsxs("aside",{className:"flex h-full min-h-0 flex-col overflow-hidden rounded-[32px] border border-border/60 bg-background/80 shadow-[0_30px_120px_-60px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl",children:[r.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx("div",{className:"text-lg font-semibold tracking-tight text-foreground",children:"Tasks"}),r.jsx(q,{variant:"ghost",size:"icon",onClick:R,className:"rounded-full",children:r.jsx(jo,{className:"h-4 w-4"})})]}),r.jsxs("div",{ref:O,className:"mt-4 flex items-center gap-2",children:[r.jsxs(q,{onClick:A,className:W("justify-start rounded-[22px] px-4 py-6 text-left shadow-[0_24px_60px_-32px_hsl(var(--primary)/0.95)] transition-[flex] duration-200",F?"flex-[2]":"flex-1"),children:[r.jsx(No,{className:"h-4 w-4"}),"New chat"]}),F?r.jsxs("div",{className:"flex min-w-0 flex-[3] items-center gap-2",children:[r.jsxs("div",{className:"relative min-w-0 flex-1",children:[r.jsx(As,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx(St,{ref:B,value:m,onChange:E=>v(E.target.value),placeholder:"Search tasks",className:"h-11 rounded-full border-border/70 bg-background/60 pl-11 text-sm"})]}),r.jsx(q,{variant:"outline",size:"icon",onClick:()=>_(!1),className:"rounded-full border-border/70 bg-background/60",children:r.jsx(Wc,{className:"h-4 w-4"})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(q,{variant:"outline",onClick:()=>_(!0),className:W("rounded-full border-border/70 bg-background/60 px-4 text-sm",m&&"border-primary/40 bg-primary/8 text-primary"),children:[r.jsx(As,{className:"h-4 w-4"}),"Search"]}),r.jsx(q,{variant:$||M?"secondary":"outline",size:"icon",onClick:()=>z(E=>!E),className:W("shrink-0 rounded-full border-border/70 bg-background/60",M&&"border-primary/40 bg-primary/8 text-primary"),title:"Filters",children:r.jsx(ed,{className:"h-4 w-4"})})]})]}),($||M)&&r.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-3",children:[r.jsxs(Re,{value:a,onValueChange:E=>b(E),children:[r.jsx(je,{className:"h-9 rounded-full border-border/70 bg-background/55 text-[12px]",children:r.jsx(We,{})}),r.jsx(ke,{children:sx.map(E=>r.jsx(be,{value:E.value,className:"text-[12px]",children:E.label},E.value))})]}),r.jsxs(Re,{value:c,onValueChange:w,children:[r.jsx(je,{className:"h-9 rounded-full border-border/70 bg-background/55 text-[12px]",children:r.jsx(We,{placeholder:"Node"})}),r.jsx(ke,{children:f.map(E=>r.jsx(be,{value:E.value,className:"text-[12px]",children:E.label},E.value))})]}),r.jsxs(Re,{value:l,onValueChange:y,children:[r.jsx(je,{className:"h-9 rounded-full border-border/70 bg-background/55 text-[12px]",children:r.jsx(We,{placeholder:"Agent"})}),r.jsx(ke,{children:d.map(E=>r.jsx(be,{value:E,className:"text-[12px]",children:E==="all"?"All agents":E},E))})]})]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-3",children:e.length>0?r.jsxs("div",{className:"space-y-2",children:[o&&r.jsxs("div",{className:"mb-1 flex items-center justify-between px-1 py-1",children:[r.jsxs("label",{className:"flex items-center gap-2 text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:[r.jsx(Pr,{checked:g&&!x?"indeterminate":x,onCheckedChange:E=>k(E===!0),"aria-label":"Select all visible tasks"}),r.jsx("span",{children:"Select all"})]}),L>0&&r.jsx(q,{variant:"ghost",size:"sm",onClick:()=>k(!1),className:"h-7 rounded-full px-3 text-xs",children:"Clear"})]}),e.map(E=>r.jsxs("div",{className:W("flex items-start gap-3 rounded-[24px] border px-3 py-3 transition-all",E.id===t?"border-primary/45 bg-primary/9 shadow-[0_24px_80px_-54px_hsl(var(--primary)/0.95)]":"border-border/60 bg-background/40 hover:border-border hover:bg-background/60"),children:[o&&r.jsx("div",{className:"flex shrink-0 pt-1",onClick:ne=>ne.stopPropagation(),children:r.jsx(Pr,{checked:h.has(E.id),onCheckedChange:ne=>j(E.id,ne===!0),"aria-label":`Select ${E.title}`})}),r.jsx("button",{type:"button",onClick:()=>T(E.id),className:"min-w-0 flex-1 text-left",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:W("mt-1 h-2.5 w-2.5 shrink-0 rounded-full",ux(E.status))}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:E.title}),r.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"font-mono",children:E.agent}),r.jsx("span",{className:"h-1 w-1 rounded-full bg-border"}),r.jsx("span",{children:E.assignedTo?u.get(E.assignedTo)??E.assignedTo.slice(0,8):"unassigned"}),r.jsx("span",{className:"h-1 w-1 rounded-full bg-border"}),r.jsx("span",{children:px(E.updatedAt)})]}),r.jsxs("div",{className:"mt-3 flex items-center gap-2 text-[11px] text-muted-foreground",children:[r.jsx(vo,{status:E.status}),E.assignedNodeAvailable===!1&&r.jsx(Se,{variant:"outline",className:"border-destructive/25 bg-destructive/10 text-[10px] text-destructive",children:"unavailable"}),r.jsx("span",{className:"truncate font-medium text-foreground/85",children:fx(E.effectiveProjectPath??E.project??"default workspace")})]}),r.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground/85",children:mx(E.effectiveProjectPath??E.project??"default workspace")})]})]})})]},E.id))]}):r.jsx("div",{className:"rounded-[24px] border border-dashed border-border/70 bg-background/35 px-4 py-5 text-sm text-muted-foreground",children:n?"Loading tasks...":s||"No tasks match this view."})}),o&&L>0?r.jsxs("div",{className:"shrink-0 border-t border-border/60 px-4 py-4",children:[r.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:"Batch actions"}),r.jsxs("div",{className:"mt-2 text-sm font-semibold text-foreground",children:[L," task",L!==1?"s":""," selected"]}),!p&&r.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Only completed, failed, cancelled, or archived tasks can be archived."}),r.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[r.jsxs(yr,{children:[r.jsx(Ks,{asChild:!0,children:r.jsxs(q,{variant:"outline",size:"sm",disabled:!p,className:"rounded-full",children:[r.jsx(Tc,{className:"h-3.5 w-3.5"}),"Archive"]})}),r.jsxs(pn,{children:[r.jsxs(hn,{children:[r.jsxs(gn,{children:["Archive ",L," task",L!==1?"s":"","?"]}),r.jsx(vn,{children:"Archived tasks stay hidden from the default task view and can be reopened from the archived scope."})]}),r.jsxs(xn,{children:[r.jsx(yn,{children:"Cancel"}),r.jsx(bn,{onClick:C,disabled:!p,children:"Archive"})]})]})]}),r.jsxs(yr,{children:[r.jsx(Ks,{asChild:!0,children:r.jsxs(q,{variant:"destructive",size:"sm",className:"rounded-full",children:[r.jsx(Rd,{className:"h-3.5 w-3.5"}),"Delete"]})}),r.jsxs(pn,{children:[r.jsxs(hn,{children:[r.jsxs(gn,{children:["Delete ",L," task",L!==1?"s":"","?"]}),r.jsx(vn,{children:"This removes the selected tasks and their saved logs."})]}),r.jsxs(xn,{children:[r.jsx(yn,{children:"Cancel"}),r.jsx(bn,{onClick:S,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})]}):null]})}function po(e,t,n){const s=i.useRef(t);s.current=t,i.useEffect(()=>{let l=0,c=0;const d=m=>{const h=m.touches[0];h&&(l=h.clientX,c=h.clientY)},f=m=>{var p,v,b,y;const h=m.changedTouches[0];if(!h)return;const x=h.clientX-l;Math.abs(h.clientY-c)>100||Math.abs(x)<50||(x>0?(v=(p=s.current).onSwipeRight)==null||v.call(p):(y=(b=s.current).onSwipeLeft)==null||y.call(b))},u=(e==null?void 0:e.current)??document;return u.addEventListener("touchstart",d,{passive:!0}),u.addEventListener("touchend",f,{passive:!0}),()=>{u.removeEventListener("touchstart",d),u.removeEventListener("touchend",f)}},[e,n==null?void 0:n.threshold,n==null?void 0:n.maxVertical])}const Ox="(min-width: 1024px)",Ix="(min-width: 1280px)";function ho(e){var t,n,s;return((s=(n=(t=globalThis.window)==null?void 0:t.matchMedia)==null?void 0:n.call(t,e))==null?void 0:s.matches)??!1}function $x(){const[e,t]=i.useState(!0),[n,s]=i.useState(!1),[o,a]=i.useState(()=>ho(Ix)),l=i.useRef(null),c=i.useRef(null);po(l,{onSwipeLeft:()=>s(!1)}),po(c,{onSwipeRight:()=>a(!1)});const d=i.useCallback(()=>{if(ho(Ox)){t(f=>!f);return}s(f=>!f)},[]);return{desktopTasksOpen:e,mobileTasksPanelOpen:n,mobileTasksPanelRef:l,operationsOpen:o,operationsPanelRef:c,setMobileTasksPanelOpen:s,setOperationsOpen:a,toggleTasksPanel:d}}function Lx(e,t){return t.data.nodeId===e.self.id||t.data.name===e.self.name||t.data.endpoint===e.self.endpoint}function Fx({cluster:e,subscribe:t}){i.useEffect(()=>{var n;if(((n=e==null?void 0:e.self)==null?void 0:n.role)==="leader")return t("node",s=>{const o=String(s.data.name??s.data.nodeId??"node"),a=Lx(e,s);s.type==="node.joined"&&!a&&pe.success(`${o} joined the cluster`),s.type==="node.left"&&!a&&pe.message(`${o} left the cluster`)})},[e,t])}function Bx(){var js,ks,Cs;const{id:e}=uc(),t=fc(),n=mc(),{cluster:s,systemInfo:o,events:a,sseConnected:l,subscribe:c,refresh:d,loading:f,error:u}=pc(),m=i.useMemo(()=>dx(t.state),[t.state]),[h,x]=i.useState([]),[g,p]=i.useState(!0),[v,b]=i.useState(null),[y,w]=i.useState(null),[j,k]=i.useState("active"),[C,S]=i.useState("all"),[A,T]=i.useState("all"),[R,F]=i.useState(""),_=i.useDeferredValue(R),{desktopTasksOpen:$,mobileTasksPanelOpen:z,mobileTasksPanelRef:B,operationsOpen:O,operationsPanelRef:L,setMobileTasksPanelOpen:M,setOperationsOpen:E,toggleTasksPanel:ne}=$x(),[re,de]=i.useState(()=>!!(m!=null&&m.draftNewTask)),[ee,ue]=i.useState(()=>m!=null&&m.draftNewTask?{route:m.returnRoute??"/",taskId:m.returnTaskId??null}:null),[he,I]=i.useState(!1),[D,U]=i.useState("transcript"),[Y,X]=i.useState("all"),[J,K]=i.useState(!1),[ie,fe]=i.useState(null),[Ne,we]=i.useState([]),[H,oe]=i.useState([]),[ge,mt]=i.useState(!1),[Vn,ve]=i.useState(null),[Ge,at]=i.useState(new Set),[El,hs]=i.useState(!1),[Al,xs]=i.useState(!1),[Tl,gs]=i.useState(null),vs=i.useRef(null),It=i.useRef(null),pt=((js=s==null?void 0:s.self)==null?void 0:js.role)==="leader",zn=(ks=s==null?void 0:s.self)==null?void 0:ks.id;Fx({cluster:s,subscribe:c});const xe=i.useCallback(async()=>{try{const N=await hc({assignedTo:!pt&&zn?zn:void 0,limit:100});x(N),b(null)}catch(N){b(N instanceof Error?N.message:"Failed to load tasks")}finally{p(!1)}},[pt,zn]);xc(xe,1e4),i.useEffect(()=>{xe()},[xe]),i.useEffect(()=>c("task",xe),[c,xe]);const me=i.useMemo(()=>[...h].sort((N,P)=>P.updatedAt-N.updatedAt),[h]),Rl=i.useMemo(()=>{const N=new Map;for(const P of(s==null?void 0:s.nodes)??[]){const V=Id(me,P.id);V>0&&N.set(P.id,V)}return N},[s==null?void 0:s.nodes,me]),_e=i.useMemo(()=>me.filter(N=>!ax(N,j)||C!=="all"&&N.agent!==C||A==="unassigned"&&N.assignedTo||A!=="all"&&A!=="unassigned"&&lx(N.assignedTo,s==null?void 0:s.nodes,N.assignedNodeName)!==A?!1:_.trim()?ix(N,_):!0),[me,j,C,A,_]);i.useEffect(()=>{at(N=>{const P=Ud(N,_e.map(V=>V.id));return P.size===N.size?N:P})},[_e]),i.useEffect(()=>{pt||at(new Set)},[pt]);const _l=i.useMemo(()=>["all",...Array.from(new Set(me.map(N=>N.agent))).sort()],[me]),Pl=i.useMemo(()=>{const P=Array.from(new Set(me.map(V=>V.assignedTo).filter(V=>!!V))).map(V=>{const ce=me.find(te=>te.assignedTo===V);return(s==null?void 0:s.nodes.find(te=>te.id===V))??{id:V,name:fs(V,s==null?void 0:s.nodes,ce==null?void 0:ce.assignedNodeName)}}).sort((V,ce)=>V.name.localeCompare(ce.name));return[{value:"all",label:"All nodes"},{value:"unassigned",label:"Unassigned"},...P.map(V=>({value:V.name.toLowerCase(),label:V.name}))]},[me,s==null?void 0:s.nodes]),bs=i.useMemo(()=>{const N=new Map;for(const P of(s==null?void 0:s.nodes)??[])N.set(P.id,P.name);for(const P of me)P.assignedTo&&P.assignedNodeName&&!N.has(P.assignedTo)&&N.set(P.assignedTo,P.assignedNodeName);return N},[s==null?void 0:s.nodes,me]),Hn=i.useMemo(()=>["all",...Array.from(new Set(a.map(N=>N.type))).sort()],[a]),Dl=i.useMemo(()=>Y==="all"?a:a.filter(N=>N.type===Y),[a,Y]),Ml=_e.length>0&&_e.every(N=>Ge.has(N.id)),Ol=_e.some(N=>Ge.has(N.id)),Il=Wd(_e,Ge);i.useEffect(()=>{m!=null&&m.draftNewTask&&(de(!0),ue({route:m.returnRoute??"/",taskId:m.returnTaskId??null}))},[m]),i.useEffect(()=>{Y!=="all"&&!Hn.includes(Y)&&X("all")},[Y,Hn]),i.useEffect(()=>{Ts(e,re)&&!y&&me[0]&&w(me[0].id)},[e,re,y,me]),i.useEffect(()=>{var N;Ts(e,re)&&(y&&h.some(P=>P.id===y)||w(((N=me[0])==null?void 0:N.id)??null))},[e,re,y,me,h]);const ae=Ld({routeTaskId:e,creatingTask:re,internalSelectedTaskId:y,sortedTaskIds:me.map(N=>N.id)}),ht=i.useMemo(()=>h.find(N=>N.id===ae)??null,[h,ae]);i.useEffect(()=>{It.current=ae??null},[ae]);const Xt=i.useCallback(()=>{fe(null),we([]),oe([]),ve(null)},[]),Te=i.useCallback(async()=>{const N=ae;if(N)try{const P=await gc(N);if(It.current!==N)return;fe(P),ve(null)}catch(P){if(It.current!==N)return;fe(null),we([]),oe([]),ve(P instanceof Error?P.message:"Failed to load task")}finally{It.current===N&&mt(!1)}},[ae]),Jt=i.useCallback(async()=>{const N=ae;if(N)try{const P=await vc(N);if(It.current!==N)return;we(V=>mu(V,P.logs)),oe(V=>hu(V,P.logs))}catch{}},[ae]);i.useEffect(()=>{if(!ae){fe(null),we([]),oe([]),ve(null),mt(!1);return}U("transcript"),fe(ht),we([]),oe([]),ve(null),mt(!0),Te(),Jt()},[ae,Jt,Te]),i.useEffect(()=>{var P;if(!ae||re||g||h.some(V=>V.id===ae))return;const N=((P=me[0])==null?void 0:P.id)??null;w(N),Xt(),i.startTransition(()=>{n(N?`/tasks/${N}`:"/",{state:null})})},[ae,Xt,re,n,me,h,g]),i.useEffect(()=>{ht&&fe(N=>!N||N.id!==ht.id?N:{...N,...ht})},[ht]),i.useEffect(()=>{if(ae)return c("task",N=>{const P=N.data.taskId;if(!(typeof P!="string"||P!==ae)){if(N.type==="task.output"){const V=N.data.event;if(V){we(te=>pu(te,V));const ce=Kt(V);ce&&oe(te=>xu(te,ce))}}N.type==="task.status"&&(Te(),Jt())}})},[c,ae,Te,Jt]),i.useEffect(()=>{var N;D==="transcript"&&((N=vs.current)==null||N.scrollIntoView({behavior:"smooth"}))},[Ne,H,D]);const se=ie??ht,$l=se!=null&&se.assignedTo?(s==null?void 0:s.nodes.find(N=>N.id===se.assignedTo))??null:null,Kn=H.length>0,Ll=se?Wh.has(se.agent):!1,qn=(se==null?void 0:se.status)==="running",Fl=se?Sn.has(se.status)||vl.has(se.status):!1,Bl=!!(se&&pt&&se.status==="failed"),Gn=i.useMemo(()=>Rx(se,s,Kn,!!qn),[se,s,Kn,qn]),Ul=i.useMemo(()=>gu(Ne),[Ne]),Yn=i.useMemo(()=>vu([...Ne,...H.map(N=>Jn(N.content,N.timestamp))]),[Ne,H]),Wl=i.useMemo(()=>{if(!se)return null;const N=qd(se);if(N.length>0)return Jn(N,new Date(se.createdAt).toISOString());if(Yn.length>0)return null;const P=Lt(se.description||se.title);return P.length>0?Jn(P,new Date(se.createdAt).toISOString()):null},[se,Yn]),Xn=i.useCallback(()=>{const N={route:e?`/tasks/${e}`:"/",taskId:ae};ue(N),de(!0),i.startTransition(()=>{n("/",{state:{draftNewTask:!0,returnRoute:N.route,returnTaskId:N.taskId}})})},[e,ae,n]),Vl=i.useCallback(()=>{var P;const N=(ee==null?void 0:ee.taskId)??((P=me[0])==null?void 0:P.id)??null;de(!1),ue(null),w(N),i.startTransition(()=>{n((ee==null?void 0:ee.route)??"/",{state:null})})},[ee,me,n]),ys=i.useCallback(N=>{de(!1),ue(null),w(N),i.startTransition(()=>{n(`/tasks/${N}`,{state:null})})},[n]),zl=i.useCallback(N=>{de(!1),ue(null),x(P=>Fd(P,N)),fe(N),we([]),oe([]),ve(null),mt(!1),U("transcript"),w(N.id),xe(),i.startTransition(()=>{n(`/tasks/${N.id}`,{state:null})})},[xe,n]),Zt=i.useCallback(async N=>{if(!ae)return!1;const P=`local-${Date.now()}-${Math.random().toString(16).slice(2)}`;oe(V=>[...V,{id:P,content:N,timestamp:new Date().toISOString()}]);try{return await bc(ae,N),Te(),!0}catch(V){return oe(ce=>ce.filter(te=>te.id!==P)),pe.error(V instanceof Error?V.message:"Failed to send message"),!1}},[ae,Te]),Hl=i.useCallback(N=>{Zt(N)},[Zt]),Kl=i.useCallback(N=>Zt(N),[Zt]),ql=i.useCallback(async()=>{if(se)try{await yc(se.id),Te(),xe()}catch(N){pe.error(N instanceof Error?N.message:"Failed to cancel task")}},[se,Te,xe]),Gl=i.useCallback(async()=>{if(se)try{await wc(se.id),Te(),xe()}catch(N){pe.error(N instanceof Error?N.message:"Failed to retry task")}},[se,Te,xe]),Qt=i.useCallback((N,P=!1)=>{const V=Vd(_e,N);return w(V),(P||!V)&&Xt(),i.startTransition(()=>{n(V?`/tasks/${V}`:"/",{state:null})}),V},[Xt,_e,n]),Yl=i.useCallback((N,P)=>{at(V=>{const ce=new Set(V);return P?ce.add(N):ce.delete(N),ce})},[]),Xl=i.useCallback(N=>{if(!N){at(new Set);return}at(new Set(_e.map(P=>P.id)))},[_e]),Jl=i.useCallback(async()=>{const N=Array.from(Ge);if(N.length!==0)try{const{results:P}=await Nc(N),V=P.filter(te=>!te.ok),ce=P.filter(te=>te.ok).map(te=>te.id);ae&&ce.includes(ae)&&Qt(ce),V.length>0?pe.error(`Failed to archive ${V.length} task(s): ${V.map(te=>te.error??te.id).join(", ")}`):pe.success(`Archived ${ce.length} task(s)`),at(new Set(V.map(te=>te.id))),xe()}catch(P){pe.error(P instanceof Error?P.message:"Failed to archive tasks")}},[ae,xe,Qt,Ge]),Zl=i.useCallback(async()=>{const N=Array.from(Ge);if(N.length!==0)try{const{results:P}=await jc(N),V=P.filter(te=>!te.ok),ce=P.filter(te=>te.ok).map(te=>te.id);ae&&ce.includes(ae)&&Qt(ce,!0),V.length>0?pe.error(`Failed to delete ${V.length} task(s): ${V.map(te=>te.error??te.id).join(", ")}`):pe.success(`Deleted ${ce.length} task(s)`),at(new Set(V.map(te=>te.id))),xe()}catch(P){pe.error(P instanceof Error?P.message:"Failed to delete tasks")}},[ae,xe,Qt,Ge]),Ql=i.useCallback(async()=>{hs(!0);try{await kc(),d()}catch(N){pe.error(N instanceof Error?N.message:"Failed to promote node")}finally{hs(!1)}},[d]),ec=i.useCallback(async()=>{xs(!0);try{await Cc(),pe.success("This node left the remote cluster and is leading itself again."),xe(),Te(),d()}catch(N){pe.error(N instanceof Error?N.message:"Failed to leave cluster")}finally{xs(!1)}},[Te,xe,d]),tc=i.useCallback(async N=>{var Ss;const P=!Lr(N),V=N.id===((Ss=s==null?void 0:s.self)==null?void 0:Ss.id),ce=V?(o==null?void 0:o.transportType)??N.transportType:N.transportType,te=V&&!P&&Rt(ce);gs(N.id);try{te?await Sc("direct"):await Ec(N.id,P),pe.success(P?`Enabled remote access on ${N.name}`:`Disabled remote access on ${N.name}`),d()}catch(Es){pe.error(Es instanceof Error?Es.message:"Failed to update remote access")}finally{gs(null)}},[(Cs=s==null?void 0:s.self)==null?void 0:Cs.id,d,o==null?void 0:o.transportType]),ws={toolbarTasks:_e,activeTaskId:ae,tasksLoading:g,tasksError:v,isLeader:pt,scope:j,agentFilter:C,nodeFilter:A,agentOptions:_l,nodeOptions:Pl,nodeNameById:bs,searchQuery:R,selectedTaskIds:Ge,allVisibleTasksSelected:Ml,someVisibleTasksSelected:Ol,canBatchArchive:Il,onSearchChange:F,onScopeChange:k,onAgentFilterChange:S,onNodeFilterChange:T,onToggleTaskSelected:Yl,onToggleAllVisibleTasks:Xl,onBatchArchive:Jl,onBatchDelete:Zl,onCreateTask:Xn,onSelectTask:ys,onClose:ne},Ns={cluster:s,systemInfo:o,nodeNameById:bs,nodeBlockingTaskCounts:Rl,eventTypeFilter:Y,onEventTypeFilterChange:X,eventTypeOptions:Hn,filteredEvents:Dl,sseConnected:l,clusterLoading:f,clusterError:u,promotePending:El,onPromote:Ql,onAddNode:()=>I(!0),leavePending:Al,onLeaveCluster:ec,onToggleNodeDevTunnel:tc,devTunnelNodeId:Tl,onClose:()=>E(!1)};return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden pb-2",children:[r.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[r.jsx("div",{className:W("hidden lg:block lg:shrink-0 lg:transition-all lg:duration-300",$?"lg:mr-3 lg:w-[24rem]":"lg:w-0 lg:overflow-hidden"),children:$&&r.jsx(mo,{...ws})}),r.jsx("section",{className:"min-h-0 min-w-0 flex-1",children:r.jsx(yx,{onToggleTasks:ne,desktopTasksOpen:$,mobileTasksPanelOpen:z,operationsOpen:O,onToggleOperations:()=>E(N=>!N),cluster:s,sseConnected:l,activeTab:D,setActiveTab:U,creatingTask:re,activeTask:se,assignedNode:$l,taskLoading:ge,taskError:Vn,displayEvents:Yn,hasUserMessageInLogs:Ul,initialPrompt:Wl,supportsFollowUp:Ll,taskUnavailable:Gn.taskUnavailable,chatDisabled:Gn.chatDisabled,chatDisabledReason:Gn.chatDisabledReason,questionBypassEnabled:J,isRunning:!!qn,hasPendingFollowUp:Kn,canCancel:!!Fl,canRetry:!!Bl,onRetry:Gl,onCancel:ql,onStartCreateTask:Xn,onCancelCreateTask:Vl,onCreateTask:zl,onSendMessage:Hl,onQuestionBypassChange:K,onSubmitQuestionResponse:Kl,messagesEndRef:vs})}),r.jsx("div",{className:W("hidden xl:block xl:shrink-0 xl:transition-all xl:duration-300",O?"xl:ml-3 xl:w-[26rem]":"xl:w-0 xl:overflow-hidden"),children:O&&r.jsx(uo,{...Ns})})]}),O&&r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button","aria-label":"Close operations panel",onClick:()=>E(!1),className:"fixed inset-0 z-30 bg-black/45 backdrop-blur-sm xl:hidden"}),r.jsx("div",{ref:L,className:"fixed inset-y-0 right-0 z-40 w-full p-2 sm:max-w-sm sm:p-3 xl:hidden",children:r.jsx(uo,{...Ns})})]}),z&&r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button","aria-label":"Close task list",onClick:()=>M(!1),className:"fixed inset-0 z-30 bg-black/45 backdrop-blur-sm lg:hidden"}),r.jsx("div",{ref:B,className:"fixed inset-y-0 left-0 z-40 w-full p-2 sm:max-w-sm sm:p-3 lg:hidden",children:r.jsx(mo,{...ws,onCreateTask:()=>{M(!1),Xn()},onSelectTask:N=>{M(!1),ys(N)},onClose:()=>M(!1)})})]}),r.jsx(Yf,{open:he,onOpenChange:I,children:r.jsx(nm,{onAdded:()=>{I(!1),d()}})})]})}const Vx=Object.freeze(Object.defineProperty({__proto__:null,DashboardPage:Bx},Symbol.toStringTag,{value:"Module"}));export{Or as C,Yf as D,wo as E,Zc as F,ua as a,pa as b,Wx as c,Tt as d,Vx as e};
|