meshy-node 0.0.5 → 0.0.7
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-vJKpJw48.js +200 -0
- package/dashboard/assets/{DiffTab-BnEEacma.js → DiffTab-RBHpHnzj.js} +3 -3
- package/dashboard/assets/{FilesTab-BA_AQGff.js → FilesTab-tWHzvDgF.js} +2 -2
- package/dashboard/assets/{PreviewTab-F2z-8pM5.js → PreviewTab-DUfl_tjX.js} +1 -1
- package/dashboard/assets/{folder-TnLGJD38.js → folder-DLwF1-Yt.js} +1 -1
- package/dashboard/assets/{index-Cf2Ckzj8.js → index-B-YQV-_s.js} +4 -4
- package/dashboard/assets/index-bj-TBurH.css +1 -0
- package/dashboard/index.html +2 -2
- package/main.cjs +1151 -111
- package/package.json +1 -1
- package/dashboard/assets/DashboardPage-Du861ESc.js +0 -200
- package/dashboard/assets/index-CS0F09J4.css +0 -1
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-BA_AQGff.js","assets/index-Cf2Ckzj8.js","assets/index-CS0F09J4.css","assets/folder-TnLGJD38.js","assets/PreviewTab-F2z-8pM5.js","assets/DiffTab-BnEEacma.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as te,r as i,j as n,R as Gs,a as Ll,b as wn,u as ne,d as $l,e as W,f as Fl,g as Bl,h as Vl,B as H,i as at,k as Ys,l as Wl,t as ue,m as Te,T as Xs,P as zl,_ as gr,n as Ul,N as Zs,o as Js,p as Hl,q as Kl,s as ql,v as Gl,w as Yl,x as Xl,y as Zl,z as Jl,A as Ql,C as ec,D as tc,E as nc,F as rc,G as sc,H as oc,I as ac,J as ic,K as lc}from"./index-Cf2Ckzj8.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 cc=[["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"}]],fs=te("archive",cc);/**
|
|
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 dc=[["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"}]],vr=te("bot",dc);/**
|
|
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 uc=[["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"}]],fc=te("brain",uc);/**
|
|
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 mc=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],br=te("check",mc);/**
|
|
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 pc=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],St=te("chevron-down",pc);/**
|
|
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 hc=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],yr=te("chevron-right",hc);/**
|
|
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 xc=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Qs=te("chevron-up",xc);/**
|
|
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 gc=[["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"}]],vc=te("circle-question-mark",gc);/**
|
|
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 bc=[["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"}]],eo=te("circle-x",bc);/**
|
|
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 yc=[["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"}]],to=te("copy",yc);/**
|
|
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 wc=[["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"}]],no=te("external-link",wc);/**
|
|
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 Nc=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],jc=te("folder-open",Nc);/**
|
|
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 Sc=[["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"}]],er=te("image-plus",Sc);/**
|
|
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 Cc=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Fe=te("loader-circle",Cc);/**
|
|
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 kc=[["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"}]],ro=te("message-square-plus",kc);/**
|
|
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 Ec=[["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"}]],so=te("panel-left-close",Ec);/**
|
|
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 Ac=[["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"}]],Tc=te("panel-left-open",Ac);/**
|
|
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 Rc=[["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"}]],oo=te("panel-right-close",Rc);/**
|
|
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 _c=[["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"}]],Pc=te("panel-right-open",_c);/**
|
|
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 Dc=[["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"}]],Ic=te("rotate-ccw",Dc);/**
|
|
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 Mc=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ms=te("search",Mc);/**
|
|
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 Oc=[["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"}]],ao=te("send",Oc);/**
|
|
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 Lc=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],$c=te("settings-2",Lc);/**
|
|
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 Fc=[["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"}]],Bc=te("shield-check",Fc);/**
|
|
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 Vc=[["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"}]],Wc=te("trash-2",Vc);/**
|
|
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 zc=[["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"}]],Uc=te("user",zc);/**
|
|
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 Hc=[["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"}]],Kc=te("wrench",Hc);/**
|
|
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 qc=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],wr=te("x",qc),Gc=new Set(["assigned","running"]);function Yc(e,t){return e.reduce((r,s)=>s.assignedTo===t&&Gc.has(s.status)?r+1:r,0)}function Nn(e){return(e==null?void 0:e.toLowerCase())==="devtunnel"}function Xc(e){return e?Nn(e)?"DevTunnel":e.charAt(0).toUpperCase()+e.slice(1):"Direct"}function Nr(e,t){return Nn(t??e.transportType)||!!e.devtunnelEndpoint}function io(e,t){return!Nn(t??e.transportType)}function lo(e,t){const r=t??e.transportType;return Nn(r)?"DevTunnel":e.devtunnelEndpoint?"Direct + DevTunnel":Xc(r)}function ps(e,t){return!e&&!t}function Zc({routeTaskId:e,creatingTask:t,internalSelectedTaskId:r,sortedTaskIds:s}){return e||(t?null:r??s[0]??null)}const Jc=new Set(["completed","failed","cancelled","archived"]);function Qc(e,t){const r=new Set(t);return new Set(Array.from(e).filter(s=>r.has(s)))}function ed(e,t){const r=new Set(t);if(r.size===0)return!1;const s=e.filter(o=>r.has(o.id));return s.length===r.size&&s.every(o=>Jc.has(o.status))}function td(e,t){var s;const r=new Set(t);return((s=e.find(o=>!r.has(o.id)))==null?void 0:s.id)??null}function fn(e){return typeof e=="object"&&e!==null}function nd(e){if(!fn(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(),r=e.data;return!t||!r?null:{type:"image",mediaType:t,data:r,...typeof e.filename=="string"&&e.filename.trim()?{filename:e.filename.trim()}:{}}}return null}function rd(e){if(!fn(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"||!fn(e.source))return null;const t=typeof e.source.media_type=="string"?e.source.media_type.trim():"",r=typeof e.source.data=="string"?e.source.data:"";return!t||!r?null:{type:"image",mediaType:t,data:r}}function Dt(e){if(typeof e=="string"){const t=e.trim();return t?[{type:"text",text:t}]:[]}return Array.isArray(e)?e.map(t=>nd(t)??rd(t)).filter(t=>t!==null):[]}function jr(e,t){const r=e.trim();return[...r?[{type:"text",text:r}]:[],...t]}function sd(e){return{role:"user",content:e.map(t=>t.type==="text"?{type:"text",text:t.text}:{type:"image",source:{type:"base64",media_type:t.mediaType,data:t.data}})}}function Bn(e,t=new Date().toISOString()){return{type:"user",message:sd(e),timestamp:t}}function Kt(e){if(e.type!=="user"||e.isSynthetic===!0)return null;if(typeof e.message=="string"){const t=Dt(e.message);return t.length>0?t:null}if(fn(e.message)&&Array.isArray(e.message.content)){const t=Dt(e.message.content);return t.length>0?t:null}if(Array.isArray(e.content)){const t=Dt(e.content);return t.length>0?t:null}return null}function od(e){return Dt(e.payload.initialMessage)}function Vt(e){return e.map(t=>{if(t.type==="text")return`t:${t.text}`;const r=t.data.slice(0,32),s=t.data.slice(-32);return`i:${t.mediaType}:${t.data.length}:${r}:${s}`}).join("|")}function ad(e){return e.filter(t=>t.type==="text").map(t=>t.text).join(`
|
|
143
|
-
`)}function Sr(e){return`data:${e.mediaType};base64,${e.data}`}function id(e){var o,a;if(!e)return[];const t=[],r=e.items;if(r)for(const l of Array.from(r)){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 ld(e){return new Promise((t,r)=>{const s=new FileReader;s.onload=()=>{if(typeof s.result!="string"){r(new Error(`Failed to read ${e.name}`));return}t(s.result)},s.onerror=()=>r(s.error??new Error(`Failed to read ${e.name}`)),s.readAsDataURL(e)})}async function hs(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 r=await ld(t),s=r.indexOf(",");if(s===-1)throw new Error(`Failed to parse ${t.name}`);return{type:"image",mediaType:t.type||"image/png",data:r.slice(s+1),filename:t.name}}))}function qt(e){return typeof e=="object"&&e!==null}function cd(e){return qt(e)&&typeof e.name=="string"&&e.name.toLowerCase()==="askuserquestion"}function dd(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 ud(e){if(!qt(e)||typeof e.question!="string"||!e.question.trim())return null;const t=Array.isArray(e.options)?e.options.map(dd).filter(r=>r!==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 tr(e){if(!qt(e)||!Array.isArray(e.questions))return null;const t=e.questions.map(ud).filter(r=>r!==null);return t.length===0?null:{questions:t}}function Ct(e){return JSON.stringify(e)}function jn(e){const t=tr(e);if(t)return t;if(cd(e)){const r=qt(e.input)?e.input:void 0;return tr(r)}return null}function fd(e){var o;const t=e.trim();if(!t)return[];const r=[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&&r.push(l)}return r}function Sn(e){for(const t of fd(e))try{const r=JSON.parse(t),s=tr(r);if(s)return s}catch{}return null}function md(e){return e.questions.map(t=>t.options.length>0?[0]:[])}function pd(e,t){return e.questions.every((r,s)=>(t[s]??[]).length>0)}function hd(e,t){return e.questions.map((s,o)=>{const a=[...new Set(t[o]??[])].sort((l,c)=>l-c).filter(l=>s.options[l]!==void 0);return{header:s.header??null,question:s.question,multiSelect:s.multiSelect,selectedOptions:a.map(l=>s.options[l]).filter(l=>l!==void 0)}}).map(s=>{const o=s.header??s.question,a=s.selectedOptions.map(l=>l.label).join(s.multiSelect?", ":"");return`${o}: ${a}`}).join(`
|
|
144
|
-
`)}function co(e){return Kt(e)!==null}function mn(e){if(e.type==="user"){const t=Kt(e),r=typeof e.timestamp=="string"?e.timestamp:"";if(t)return`user:${r}:${Vt(t)}`}return JSON.stringify(e)}function nr(e){const t=jn(e);return t?Ct(t):null}function xs(e){if(!Array.isArray(e))return null;const t=new Set;for(const r of e){const s=nr(r);if(s){t.add(s);continue}if(typeof r=="object"&&r!==null&&r.type==="text"&&typeof r.text=="string"){const o=Sn(r.text);o&&t.add(Ct(o))}}return t.size===0?null:Array.from(t).sort().join("|")}function xd(e){const t=nr(e);if(t)return t;if(typeof e.message=="string"){const r=Sn(e.message);return r?Ct(r):null}if(typeof e.message=="object"&&e.message!==null){const r=nr(e.message);return r||xs(e.message.content)}return xs(e.content)}function gd(e,t,r){const s=typeof t.timestamp=="string"?t.timestamp:"";return`${e}-${s}-${r}`}function vd(e,t){const r=t.map(o=>({...o})),s=new Set(r.map(mn));for(const o of e){const a=mn(o);s.has(a)||(r.push(o),s.add(a))}return r}function bd(e,t){const r=mn(t);return e.some(s=>mn(s)===r)?e:[...e,{...t}]}function yd(e,t){const r=new Map;for(const s of t){const o=Kt(s);if(!o)continue;const a=Vt(o);r.set(a,(r.get(a)??0)+1)}return e.filter(s=>{const o=Vt(s.content),a=r.get(o)??0;return a<=0?!0:(r.set(o,a-1),!1)})}function wd(e,t){const r=Vt(t),s=e.findIndex(o=>Vt(o.content)===r);return s===-1?e:e.filter((o,a)=>a!==s)}function Nd(e){return e.some(co)}function jd(e){const t=[];let r=null;for(const s of e){if(co(s)){r=null,t.push(s);continue}const o=xd(s);o&&o===r||(t.push(s),o&&(r=o))}return t}function q(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e==null||e(o),r===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Sd(e,t){const r=i.createContext(t),s=a=>{const{children:l,...c}=a,u=i.useMemo(()=>c,Object.values(c));return n.jsx(r.Provider,{value:u,children:l})};s.displayName=e+"Provider";function o(a){const l=i.useContext(r);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[s,o]}function tt(e,t=[]){let r=[];function s(a,l){const c=i.createContext(l),u=r.length;r=[...r,l];const f=m=>{var b;const{scope:h,children:v,...x}=m,p=((b=h==null?void 0:h[e])==null?void 0:b[u])||c,g=i.useMemo(()=>x,Object.values(x));return n.jsx(p.Provider,{value:g,children:v})};f.displayName=a+"Provider";function d(m,h){var p;const v=((p=h==null?void 0:h[e])==null?void 0:p[u])||c,x=i.useContext(v);if(x)return x;if(l!==void 0)return l;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[f,d]}const o=()=>{const a=r.map(l=>i.createContext(l));return function(c){const u=(c==null?void 0:c[e])||a;return i.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])}};return o.scopeName=e,[s,Cd(o,...t)]}function Cd(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const l=s.reduce((c,{useScope:u,scopeName:f})=>{const m=u(a)[`__scope${f}`];return{...c,...m}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return r.scopeName=t.scopeName,r}var pe=globalThis!=null&&globalThis.document?i.useLayoutEffect:()=>{},kd=Gs[" useId ".trim().toString()]||(()=>{}),Ed=0;function Xe(e){const[t,r]=i.useState(kd());return pe(()=>{r(s=>s??String(Ed++))},[e]),e||(t?`radix-${t}`:"")}var Ad=Gs[" useInsertionEffect ".trim().toString()]||pe;function wt({prop:e,defaultProp:t,onChange:r=()=>{},caller:s}){const[o,a,l]=Td({defaultProp:t,onChange:r}),c=e!==void 0,u=c?e:o;{const d=i.useRef(e!==void 0);i.useEffect(()=>{const m=d.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.`),d.current=c},[c,s])}const f=i.useCallback(d=>{var m;if(c){const h=Rd(d)?d(e):d;h!==e&&((m=l.current)==null||m.call(l,h))}else a(d)},[c,e,a,l]);return[u,f]}function Td({defaultProp:e,onChange:t}){const[r,s]=i.useState(e),o=i.useRef(r),a=i.useRef(t);return Ad(()=>{a.current=t},[t]),i.useEffect(()=>{var l;o.current!==r&&((l=a.current)==null||l.call(a,r),o.current=r)},[r,o]),[r,s,a]}function Rd(e){return typeof e=="function"}function Wt(e){const t=_d(e),r=i.forwardRef((s,o)=>{const{children:a,...l}=s,c=i.Children.toArray(a),u=c.find(Dd);if(u){const f=u.props.children,d=c.map(m=>m===u?i.Children.count(f)>1?i.Children.only(null):i.isValidElement(f)?f.props.children:null:m);return n.jsx(t,{...l,ref:o,children:i.isValidElement(f)?i.cloneElement(f,void 0,d):null})}return n.jsx(t,{...l,ref:o,children:a})});return r.displayName=`${e}.Slot`,r}function _d(e){const t=i.forwardRef((r,s)=>{const{children:o,...a}=r;if(i.isValidElement(o)){const l=Md(o),c=Id(a,o.props);return o.type!==i.Fragment&&(c.ref=s?Ll(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 uo=Symbol("radix.slottable");function Pd(e){const t=({children:r})=>n.jsx(n.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=uo,t}function Dd(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===uo}function Id(e,t){const r={...t};for(const s in t){const o=e[s],a=t[s];/^on[A-Z]/.test(s)?o&&a?r[s]=(...c)=>{const u=a(...c);return o(...c),u}:o&&(r[s]=o):s==="style"?r[s]={...o,...a}:s==="className"&&(r[s]=[o,a].filter(Boolean).join(" "))}return{...e,...r}}function Md(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Od=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],X=Od.reduce((e,t)=>{const r=Wt(`Primitive.${t}`),s=i.forwardRef((o,a)=>{const{asChild:l,...c}=o,u=l?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(u,{...c,ref:a})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function Ld(e,t){e&&wn.flushSync(()=>e.dispatchEvent(t))}function Je(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...r)=>{var s;return(s=t.current)==null?void 0:s.call(t,...r)},[])}function $d(e,t=globalThis==null?void 0:globalThis.document){const r=Je(e);i.useEffect(()=>{const s=o=>{o.key==="Escape"&&r(o)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[r,t])}var Fd="DismissableLayer",rr="dismissableLayer.update",Bd="dismissableLayer.pointerDownOutside",Vd="dismissableLayer.focusOutside",gs,fo=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Cr=i.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...u}=e,f=i.useContext(fo),[d,m]=i.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,v]=i.useState({}),x=ne(t,C=>m(C)),p=Array.from(f.layers),[g]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),b=p.indexOf(g),y=d?p.indexOf(d):-1,w=f.layersWithOutsidePointerEventsDisabled.size>0,S=y>=b,j=Ud(C=>{const T=C.target,F=[...f.branches].some($=>$.contains(T));!S||F||(o==null||o(C),l==null||l(C),C.defaultPrevented||c==null||c())},h),E=Hd(C=>{const T=C.target;[...f.branches].some($=>$.contains(T))||(a==null||a(C),l==null||l(C),C.defaultPrevented||c==null||c())},h);return $d(C=>{y===f.layers.size-1&&(s==null||s(C),!C.defaultPrevented&&c&&(C.preventDefault(),c()))},h),i.useEffect(()=>{if(d)return r&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(gs=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(d)),f.layers.add(d),vs(),()=>{r&&f.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=gs)}},[d,h,r,f]),i.useEffect(()=>()=>{d&&(f.layers.delete(d),f.layersWithOutsidePointerEventsDisabled.delete(d),vs())},[d,f]),i.useEffect(()=>{const C=()=>v({});return document.addEventListener(rr,C),()=>document.removeEventListener(rr,C)},[]),n.jsx(X.div,{...u,ref:x,style:{pointerEvents:w?S?"auto":"none":void 0,...e.style},onFocusCapture:q(e.onFocusCapture,E.onFocusCapture),onBlurCapture:q(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:q(e.onPointerDownCapture,j.onPointerDownCapture)})});Cr.displayName=Fd;var Wd="DismissableLayerBranch",zd=i.forwardRef((e,t)=>{const r=i.useContext(fo),s=i.useRef(null),o=ne(t,s);return i.useEffect(()=>{const a=s.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),n.jsx(X.div,{...e,ref:o})});zd.displayName=Wd;function Ud(e,t=globalThis==null?void 0:globalThis.document){const r=Je(e),s=i.useRef(!1),o=i.useRef(()=>{});return i.useEffect(()=>{const a=c=>{if(c.target&&!s.current){let u=function(){mo(Bd,r,f,{discrete:!0})};const f={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=u,t.addEventListener("click",o.current,{once:!0})):u()}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,r]),{onPointerDownCapture:()=>s.current=!0}}function Hd(e,t=globalThis==null?void 0:globalThis.document){const r=Je(e),s=i.useRef(!1);return i.useEffect(()=>{const o=a=>{a.target&&!s.current&&mo(Vd,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function vs(){const e=new CustomEvent(rr);document.dispatchEvent(e)}function mo(e,t,r,{discrete:s}){const o=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),s?Ld(o,a):o.dispatchEvent(a)}var Vn="focusScope.autoFocusOnMount",Wn="focusScope.autoFocusOnUnmount",bs={bubbles:!1,cancelable:!0},Kd="FocusScope",kr=i.forwardRef((e,t)=>{const{loop:r=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...l}=e,[c,u]=i.useState(null),f=Je(o),d=Je(a),m=i.useRef(null),h=ne(t,p=>u(p)),v=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(s){let p=function(w){if(v.paused||!c)return;const S=w.target;c.contains(S)?m.current=S:qe(m.current,{select:!0})},g=function(w){if(v.paused||!c)return;const S=w.relatedTarget;S!==null&&(c.contains(S)||qe(m.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const j of w)j.removedNodes.length>0&&qe(c)};document.addEventListener("focusin",p),document.addEventListener("focusout",g);const y=new MutationObserver(b);return c&&y.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",g),y.disconnect()}}},[s,c,v.paused]),i.useEffect(()=>{if(c){ws.add(v);const p=document.activeElement;if(!c.contains(p)){const b=new CustomEvent(Vn,bs);c.addEventListener(Vn,f),c.dispatchEvent(b),b.defaultPrevented||(qd(Jd(po(c)),{select:!0}),document.activeElement===p&&qe(c))}return()=>{c.removeEventListener(Vn,f),setTimeout(()=>{const b=new CustomEvent(Wn,bs);c.addEventListener(Wn,d),c.dispatchEvent(b),b.defaultPrevented||qe(p??document.body,{select:!0}),c.removeEventListener(Wn,d),ws.remove(v)},0)}}},[c,f,d,v]);const x=i.useCallback(p=>{if(!r&&!s||v.paused)return;const g=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,b=document.activeElement;if(g&&b){const y=p.currentTarget,[w,S]=Gd(y);w&&S?!p.shiftKey&&b===S?(p.preventDefault(),r&&qe(w,{select:!0})):p.shiftKey&&b===w&&(p.preventDefault(),r&&qe(S,{select:!0})):b===y&&p.preventDefault()}},[r,s,v.paused]);return n.jsx(X.div,{tabIndex:-1,...l,ref:h,onKeyDown:x})});kr.displayName=Kd;function qd(e,{select:t=!1}={}){const r=document.activeElement;for(const s of e)if(qe(s,{select:t}),document.activeElement!==r)return}function Gd(e){const t=po(e),r=ys(t,e),s=ys(t.reverse(),e);return[r,s]}function po(e){const t=[],r=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(;r.nextNode();)t.push(r.currentNode);return t}function ys(e,t){for(const r of e)if(!Yd(r,{upTo:t}))return r}function Yd(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 Xd(e){return e instanceof HTMLInputElement&&"select"in e}function qe(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Xd(e)&&t&&e.select()}}var ws=Zd();function Zd(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Ns(e,t),e.unshift(t)},remove(t){var r;e=Ns(e,t),(r=e[0])==null||r.resume()}}}function Ns(e,t){const r=[...e],s=r.indexOf(t);return s!==-1&&r.splice(s,1),r}function Jd(e){return e.filter(t=>t.tagName!=="A")}var Qd="Portal",Er=i.forwardRef((e,t)=>{var c;const{container:r,...s}=e,[o,a]=i.useState(!1);pe(()=>a(!0),[]);const l=r||o&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?$l.createPortal(n.jsx(X.div,{...s,ref:t}),l):null});Er.displayName=Qd;function eu(e,t){return i.useReducer((r,s)=>t[r][s]??r,e)}var kt=e=>{const{present:t,children:r}=e,s=tu(t),o=typeof r=="function"?r({present:s.isPresent}):i.Children.only(r),a=ne(s.ref,nu(o));return typeof r=="function"||s.isPresent?i.cloneElement(o,{ref:a}):null};kt.displayName="Presence";function tu(e){const[t,r]=i.useState(),s=i.useRef(null),o=i.useRef(e),a=i.useRef("none"),l=e?"mounted":"unmounted",[c,u]=eu(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const f=Qt(s.current);a.current=c==="mounted"?f:"none"},[c]),pe(()=>{const f=s.current,d=o.current;if(d!==e){const h=a.current,v=Qt(f);e?u("MOUNT"):v==="none"||(f==null?void 0:f.display)==="none"?u("UNMOUNT"):u(d&&h!==v?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),pe(()=>{if(t){let f;const d=t.ownerDocument.defaultView??window,m=v=>{const p=Qt(s.current).includes(CSS.escape(v.animationName));if(v.target===t&&p&&(u("ANIMATION_END"),!o.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",f=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},h=v=>{v.target===t&&(a.current=Qt(s.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{d.clearTimeout(f),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:i.useCallback(f=>{s.current=f?getComputedStyle(f):null,r(f)},[])}}function Qt(e){return(e==null?void 0:e.animationName)||"none"}function nu(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var zn=0;function ho(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??js()),document.body.insertAdjacentElement("beforeend",e[1]??js()),zn++,()=>{zn===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),zn--}},[])}function js(){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 Ie=function(){return Ie=Object.assign||function(t){for(var r,s=1,o=arguments.length;s<o;s++){r=arguments[s];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Ie.apply(this,arguments)};function xo(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(r[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])&&(r[s[o]]=e[s[o]]);return r}function ru(e,t,r){if(r||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 on="right-scroll-bar-position",an="width-before-scroll-bar",su="with-scroll-bars-hidden",ou="--removed-body-scroll-bar-size";function Un(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function au(e,t){var r=i.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(s){var o=r.value;o!==s&&(r.value=s,r.callback(s,o))}}}})[0];return r.callback=t,r.facade}var iu=typeof window<"u"?i.useLayoutEffect:i.useEffect,Ss=new WeakMap;function lu(e,t){var r=au(null,function(s){return e.forEach(function(o){return Un(o,s)})});return iu(function(){var s=Ss.get(r);if(s){var o=new Set(s),a=new Set(e),l=r.current;o.forEach(function(c){a.has(c)||Un(c,null)}),a.forEach(function(c){o.has(c)||Un(c,l)})}Ss.set(r,e)},[e]),r}function cu(e){return e}function du(e,t){t===void 0&&(t=cu);var r=[],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 r.length?r[r.length-1]:e},useMedium:function(a){var l=t(a,s);return r.push(l),function(){r=r.filter(function(c){return c!==l})}},assignSyncMedium:function(a){for(s=!0;r.length;){var l=r;r=[],l.forEach(a)}r={push:function(c){return a(c)},filter:function(){return r}}},assignMedium:function(a){s=!0;var l=[];if(r.length){var c=r;r=[],c.forEach(a),l=r}var u=function(){var d=l;l=[],d.forEach(a)},f=function(){return Promise.resolve().then(u)};f(),r={push:function(d){l.push(d),f()},filter:function(d){return l=l.filter(d),r}}}};return o}function uu(e){e===void 0&&(e={});var t=du(null);return t.options=Ie({async:!0,ssr:!1},e),t}var go=function(e){var t=e.sideCar,r=xo(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,Ie({},r))};go.isSideCarExport=!0;function fu(e,t){return e.useMedium(t),go}var vo=uu(),Hn=function(){},Cn=i.forwardRef(function(e,t){var r=i.useRef(null),s=i.useState({onScrollCapture:Hn,onWheelCapture:Hn,onTouchMoveCapture:Hn}),o=s[0],a=s[1],l=e.forwardProps,c=e.children,u=e.className,f=e.removeScrollBar,d=e.enabled,m=e.shards,h=e.sideCar,v=e.noRelative,x=e.noIsolation,p=e.inert,g=e.allowPinchZoom,b=e.as,y=b===void 0?"div":b,w=e.gapMode,S=xo(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=h,E=lu([r,t]),C=Ie(Ie({},S),o);return i.createElement(i.Fragment,null,d&&i.createElement(j,{sideCar:vo,removeScrollBar:f,shards:m,noRelative:v,noIsolation:x,inert:p,setCallbacks:a,allowPinchZoom:!!g,lockRef:r,gapMode:w}),l?i.cloneElement(i.Children.only(c),Ie(Ie({},C),{ref:E})):i.createElement(y,Ie({},C,{className:u,ref:E}),c))});Cn.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Cn.classNames={fullWidth:an,zeroRight:on};var mu=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function pu(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=mu();return t&&e.setAttribute("nonce",t),e}function hu(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function xu(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var gu=function(){var e=0,t=null;return{add:function(r){e==0&&(t=pu())&&(hu(t,r),xu(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},vu=function(){var e=gu();return function(t,r){i.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},bo=function(){var e=vu(),t=function(r){var s=r.styles,o=r.dynamic;return e(s,o),null};return t},bu={left:0,top:0,right:0,gap:0},Kn=function(e){return parseInt(e||"",10)||0},yu=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Kn(r),Kn(s),Kn(o)]},wu=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return bu;var t=yu(e),r=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-r+t[2]-t[0])}},Nu=bo(),vt="data-scroll-locked",ju=function(e,t,r,s){var o=e.left,a=e.top,l=e.right,c=e.gap;return r===void 0&&(r="margin"),`
|
|
145
|
-
.`.concat(su,` {
|
|
146
|
-
overflow: hidden `).concat(s,`;
|
|
147
|
-
padding-right: `).concat(c,"px ").concat(s,`;
|
|
148
|
-
}
|
|
149
|
-
body[`).concat(vt,`] {
|
|
150
|
-
overflow: hidden `).concat(s,`;
|
|
151
|
-
overscroll-behavior: contain;
|
|
152
|
-
`).concat([t&&"position: relative ".concat(s,";"),r==="margin"&&`
|
|
153
|
-
padding-left: `.concat(o,`px;
|
|
154
|
-
padding-top: `).concat(a,`px;
|
|
155
|
-
padding-right: `).concat(l,`px;
|
|
156
|
-
margin-left:0;
|
|
157
|
-
margin-top:0;
|
|
158
|
-
margin-right: `).concat(c,"px ").concat(s,`;
|
|
159
|
-
`),r==="padding"&&"padding-right: ".concat(c,"px ").concat(s,";")].filter(Boolean).join(""),`
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.`).concat(on,` {
|
|
163
|
-
right: `).concat(c,"px ").concat(s,`;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.`).concat(an,` {
|
|
167
|
-
margin-right: `).concat(c,"px ").concat(s,`;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.`).concat(on," .").concat(on,` {
|
|
171
|
-
right: 0 `).concat(s,`;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.`).concat(an," .").concat(an,` {
|
|
175
|
-
margin-right: 0 `).concat(s,`;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
body[`).concat(vt,`] {
|
|
179
|
-
`).concat(ou,": ").concat(c,`px;
|
|
180
|
-
}
|
|
181
|
-
`)},Cs=function(){var e=parseInt(document.body.getAttribute(vt)||"0",10);return isFinite(e)?e:0},Su=function(){i.useEffect(function(){return document.body.setAttribute(vt,(Cs()+1).toString()),function(){var e=Cs()-1;e<=0?document.body.removeAttribute(vt):document.body.setAttribute(vt,e.toString())}},[])},Cu=function(e){var t=e.noRelative,r=e.noImportant,s=e.gapMode,o=s===void 0?"margin":s;Su();var a=i.useMemo(function(){return wu(o)},[o]);return i.createElement(Nu,{styles:ju(a,!t,o,r?"":"!important")})},sr=!1;if(typeof window<"u")try{var en=Object.defineProperty({},"passive",{get:function(){return sr=!0,!0}});window.addEventListener("test",en,en),window.removeEventListener("test",en,en)}catch{sr=!1}var pt=sr?{passive:!1}:!1,ku=function(e){return e.tagName==="TEXTAREA"},yo=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!ku(e)&&r[t]==="visible")},Eu=function(e){return yo(e,"overflowY")},Au=function(e){return yo(e,"overflowX")},ks=function(e,t){var r=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var o=wo(e,s);if(o){var a=No(e,s),l=a[1],c=a[2];if(l>c)return!0}s=s.parentNode}while(s&&s!==r.body);return!1},Tu=function(e){var t=e.scrollTop,r=e.scrollHeight,s=e.clientHeight;return[t,r,s]},Ru=function(e){var t=e.scrollLeft,r=e.scrollWidth,s=e.clientWidth;return[t,r,s]},wo=function(e,t){return e==="v"?Eu(t):Au(t)},No=function(e,t){return e==="v"?Tu(t):Ru(t)},_u=function(e,t){return e==="h"&&t==="rtl"?-1:1},Pu=function(e,t,r,s,o){var a=_u(e,window.getComputedStyle(t).direction),l=a*s,c=r.target,u=t.contains(c),f=!1,d=l>0,m=0,h=0;do{if(!c)break;var v=No(e,c),x=v[0],p=v[1],g=v[2],b=p-g-a*x;(x||b)&&wo(e,c)&&(m+=b,h+=x);var y=c.parentNode;c=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!u&&c!==document.body||u&&(t.contains(c)||t===c));return(d&&Math.abs(m)<1||!d&&Math.abs(h)<1)&&(f=!0),f},tn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Es=function(e){return[e.deltaX,e.deltaY]},As=function(e){return e&&"current"in e?e.current:e},Du=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Iu=function(e){return`
|
|
182
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
183
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
184
|
-
`)},Mu=0,ht=[];function Ou(e){var t=i.useRef([]),r=i.useRef([0,0]),s=i.useRef(),o=i.useState(Mu++)[0],a=i.useState(bo)[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=ru([e.lockRef.current],(e.shards||[]).map(As),!0).filter(Boolean);return p.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),p.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=i.useCallback(function(p,g){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!l.current.allowPinchZoom;var b=tn(p),y=r.current,w="deltaX"in p?p.deltaX:y[0]-b[0],S="deltaY"in p?p.deltaY:y[1]-b[1],j,E=p.target,C=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in p&&C==="h"&&E.type==="range")return!1;var T=window.getSelection(),F=T&&T.anchorNode,$=F?F===E||F.contains(E):!1;if($)return!1;var O=ks(C,E);if(!O)return!0;if(O?j=C:(j=C==="v"?"h":"v",O=ks(C,E)),!O)return!1;if(!s.current&&"changedTouches"in p&&(w||S)&&(s.current=j),!j)return!0;var L=s.current||j;return Pu(L,g,p,L==="h"?w:S)},[]),u=i.useCallback(function(p){var g=p;if(!(!ht.length||ht[ht.length-1]!==a)){var b="deltaY"in g?Es(g):tn(g),y=t.current.filter(function(j){return j.name===g.type&&(j.target===g.target||g.target===j.shadowParent)&&Du(j.delta,b)})[0];if(y&&y.should){g.cancelable&&g.preventDefault();return}if(!y){var w=(l.current.shards||[]).map(As).filter(Boolean).filter(function(j){return j.contains(g.target)}),S=w.length>0?c(g,w[0]):!l.current.noIsolation;S&&g.cancelable&&g.preventDefault()}}},[]),f=i.useCallback(function(p,g,b,y){var w={name:p,delta:g,target:b,should:y,shadowParent:Lu(b)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),d=i.useCallback(function(p){r.current=tn(p),s.current=void 0},[]),m=i.useCallback(function(p){f(p.type,Es(p),p.target,c(p,e.lockRef.current))},[]),h=i.useCallback(function(p){f(p.type,tn(p),p.target,c(p,e.lockRef.current))},[]);i.useEffect(function(){return ht.push(a),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:h}),document.addEventListener("wheel",u,pt),document.addEventListener("touchmove",u,pt),document.addEventListener("touchstart",d,pt),function(){ht=ht.filter(function(p){return p!==a}),document.removeEventListener("wheel",u,pt),document.removeEventListener("touchmove",u,pt),document.removeEventListener("touchstart",d,pt)}},[]);var v=e.removeScrollBar,x=e.inert;return i.createElement(i.Fragment,null,x?i.createElement(a,{styles:Iu(o)}):null,v?i.createElement(Cu,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Lu(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const $u=fu(vo,Ou);var Ar=i.forwardRef(function(e,t){return i.createElement(Cn,Ie({},e,{ref:t,sideCar:$u}))});Ar.classNames=Cn.classNames;var Fu=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},xt=new WeakMap,nn=new WeakMap,rn={},qn=0,jo=function(e){return e&&(e.host||jo(e.parentNode))},Bu=function(e,t){return t.map(function(r){if(e.contains(r))return r;var s=jo(r);return s&&e.contains(s)?s:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Vu=function(e,t,r,s){var o=Bu(t,Array.isArray(e)?e:[e]);rn[r]||(rn[r]=new WeakMap);var a=rn[r],l=[],c=new Set,u=new Set(o),f=function(m){!m||c.has(m)||(c.add(m),f(m.parentNode))};o.forEach(f);var d=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(h){if(c.has(h))d(h);else try{var v=h.getAttribute(s),x=v!==null&&v!=="false",p=(xt.get(h)||0)+1,g=(a.get(h)||0)+1;xt.set(h,p),a.set(h,g),l.push(h),p===1&&x&&nn.set(h,!0),g===1&&h.setAttribute(r,"true"),x||h.setAttribute(s,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(t),c.clear(),qn++,function(){l.forEach(function(m){var h=xt.get(m)-1,v=a.get(m)-1;xt.set(m,h),a.set(m,v),h||(nn.has(m)||m.removeAttribute(s),nn.delete(m)),v||m.removeAttribute(r)}),qn--,qn||(xt=new WeakMap,xt=new WeakMap,nn=new WeakMap,rn={})}},So=function(e,t,r){r===void 0&&(r="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),o=Fu(e);return o?(s.push.apply(s,Array.from(o.querySelectorAll("[aria-live], script"))),Vu(s,o,r,"aria-hidden")):function(){return null}},kn="Dialog",[Co,ko]=tt(kn),[Wu,Pe]=Co(kn),Eo=e=>{const{__scopeDialog:t,children:r,open:s,defaultOpen:o,onOpenChange:a,modal:l=!0}=e,c=i.useRef(null),u=i.useRef(null),[f,d]=wt({prop:s,defaultProp:o??!1,onChange:a,caller:kn});return n.jsx(Wu,{scope:t,triggerRef:c,contentRef:u,contentId:Xe(),titleId:Xe(),descriptionId:Xe(),open:f,onOpenChange:d,onOpenToggle:i.useCallback(()=>d(m=>!m),[d]),modal:l,children:r})};Eo.displayName=kn;var Ao="DialogTrigger",To=i.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=Pe(Ao,r),a=ne(t,o.triggerRef);return n.jsx(X.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":_r(o.open),...s,ref:a,onClick:q(e.onClick,o.onOpenToggle)})});To.displayName=Ao;var Tr="DialogPortal",[zu,Ro]=Co(Tr,{forceMount:void 0}),_o=e=>{const{__scopeDialog:t,forceMount:r,children:s,container:o}=e,a=Pe(Tr,t);return n.jsx(zu,{scope:t,forceMount:r,children:i.Children.map(s,l=>n.jsx(kt,{present:r||a.open,children:n.jsx(Er,{asChild:!0,container:o,children:l})}))})};_o.displayName=Tr;var pn="DialogOverlay",Po=i.forwardRef((e,t)=>{const r=Ro(pn,e.__scopeDialog),{forceMount:s=r.forceMount,...o}=e,a=Pe(pn,e.__scopeDialog);return a.modal?n.jsx(kt,{present:s||a.open,children:n.jsx(Hu,{...o,ref:t})}):null});Po.displayName=pn;var Uu=Wt("DialogOverlay.RemoveScroll"),Hu=i.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=Pe(pn,r);return n.jsx(Ar,{as:Uu,allowPinchZoom:!0,shards:[o.contentRef],children:n.jsx(X.div,{"data-state":_r(o.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),lt="DialogContent",Do=i.forwardRef((e,t)=>{const r=Ro(lt,e.__scopeDialog),{forceMount:s=r.forceMount,...o}=e,a=Pe(lt,e.__scopeDialog);return n.jsx(kt,{present:s||a.open,children:a.modal?n.jsx(Ku,{...o,ref:t}):n.jsx(qu,{...o,ref:t})})});Do.displayName=lt;var Ku=i.forwardRef((e,t)=>{const r=Pe(lt,e.__scopeDialog),s=i.useRef(null),o=ne(t,r.contentRef,s);return i.useEffect(()=>{const a=s.current;if(a)return So(a)},[]),n.jsx(Io,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:q(e.onCloseAutoFocus,a=>{var l;a.preventDefault(),(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:q(e.onPointerDownOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&a.preventDefault()}),onFocusOutside:q(e.onFocusOutside,a=>a.preventDefault())})}),qu=i.forwardRef((e,t)=>{const r=Pe(lt,e.__scopeDialog),s=i.useRef(!1),o=i.useRef(!1);return n.jsx(Io,{...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=r.triggerRef.current)==null||c.focus(),a.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:a=>{var u,f;(u=e.onInteractOutside)==null||u.call(e,a),a.defaultPrevented||(s.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const l=a.target;((f=r.triggerRef.current)==null?void 0:f.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),Io=i.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:a,...l}=e,c=Pe(lt,r),u=i.useRef(null),f=ne(t,u);return ho(),n.jsxs(n.Fragment,{children:[n.jsx(kr,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:a,children:n.jsx(Cr,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":_r(c.open),...l,ref:f,onDismiss:()=>c.onOpenChange(!1)})}),n.jsxs(n.Fragment,{children:[n.jsx(Yu,{titleId:c.titleId}),n.jsx(Zu,{contentRef:u,descriptionId:c.descriptionId})]})]})}),Rr="DialogTitle",Mo=i.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=Pe(Rr,r);return n.jsx(X.h2,{id:o.titleId,...s,ref:t})});Mo.displayName=Rr;var Oo="DialogDescription",Lo=i.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=Pe(Oo,r);return n.jsx(X.p,{id:o.descriptionId,...s,ref:t})});Lo.displayName=Oo;var $o="DialogClose",Fo=i.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,o=Pe($o,r);return n.jsx(X.button,{type:"button",...s,ref:t,onClick:q(e.onClick,()=>o.onOpenChange(!1))})});Fo.displayName=$o;function _r(e){return e?"open":"closed"}var Bo="DialogTitleWarning",[Gu,Vo]=Sd(Bo,{contentName:lt,titleName:Rr,docsSlug:"dialog"}),Yu=({titleId:e})=>{const t=Vo(Bo),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
185
|
-
|
|
186
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
187
|
-
|
|
188
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return i.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Xu="DialogDescriptionWarning",Zu=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Vo(Xu).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},Wo=Eo,Ju=To,zo=_o,Pr=Po,Dr=Do,Ir=Mo,Mr=Lo,Or=Fo;const Qu=Wo,ef=zo,Uo=i.forwardRef(({className:e,...t},r)=>n.jsx(Pr,{ref:r,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}));Uo.displayName=Pr.displayName;const Ho=i.forwardRef(({className:e,children:t,...r},s)=>n.jsxs(ef,{children:[n.jsx(Uo,{}),n.jsxs(Dr,{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),...r,children:[t,n.jsxs(Or,{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:[n.jsx(wr,{className:"h-4 w-4"}),n.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ho.displayName=Dr.displayName;const Ko=({className:e,...t})=>n.jsx("div",{className:W("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Ko.displayName="DialogHeader";const qo=({className:e,...t})=>n.jsx("div",{className:W("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});qo.displayName="DialogFooter";const Go=i.forwardRef(({className:e,...t},r)=>n.jsx(Ir,{ref:r,className:W("text-lg font-semibold leading-none tracking-tight",e),...t}));Go.displayName=Ir.displayName;const tf=i.forwardRef(({className:e,...t},r)=>n.jsx(Mr,{ref:r,className:W("text-sm text-muted-foreground",e),...t}));tf.displayName=Mr.displayName;const Me=i.forwardRef(({className:e,type:t,...r},s)=>n.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,...r}));Me.displayName="Input";var nf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],rf=nf.reduce((e,t)=>{const r=Fl(`Primitive.${t}`),s=i.forwardRef((o,a)=>{const{asChild:l,...c}=o,u=l?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(u,{...c,ref:a})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),sf="Label",Yo=i.forwardRef((e,t)=>n.jsx(rf.label,{...e,ref:t,onMouseDown:r=>{var o;r.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Yo.displayName=sf;var Xo=Yo;const of=Bl("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ee=i.forwardRef(({className:e,...t},r)=>n.jsx(Xo,{ref:r,className:W(of(),e),...t}));Ee.displayName=Xo.displayName;function af({onAdded:e}){const[t,r]=i.useState(""),[s,o]=i.useState(""),[a,l]=i.useState(""),[c,u]=i.useState(""),[f,d]=i.useState(!1),[m,h]=i.useState(null),v=i.useCallback(async x=>{if(x.preventDefault(),!(!t.trim()||!s.trim()||!a.trim())){d(!0),h(null);try{const p=c.trim()?c.split(",").map(g=>g.trim()).filter(Boolean):[];await Vl({id:t.trim(),name:s.trim(),endpoint:a.trim(),capabilities:p}),e()}catch(p){h(p instanceof Error?p.message:"Failed to add node")}finally{d(!1)}}},[t,s,a,c,e]);return n.jsx(Ho,{className:"overflow-hidden border-border/60 bg-transparent p-0 shadow-none sm:max-w-xl",children:n.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:[n.jsx("div",{className:"border-b border-border/60 px-6 py-5",children:n.jsxs(Ko,{className:"space-y-2 text-left",children:[n.jsx(Go,{className:"text-2xl tracking-tight",children:"Add node"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Join another Meshy node to the current cluster by endpoint."})]})}),n.jsxs("form",{onSubmit:v,className:"space-y-4 px-6 py-5",children:[m&&n.jsx("div",{className:"rounded-[20px] border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:m}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(Ee,{htmlFor:"node-id",children:"Node ID"}),n.jsx(Me,{id:"node-id",value:t,onChange:x=>r(x.target.value),placeholder:"Unique node identifier",className:"h-11 rounded-2xl border-border/70 bg-background/70"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(Ee,{htmlFor:"node-name",children:"Name"}),n.jsx(Me,{id:"node-name",value:s,onChange:x=>o(x.target.value),placeholder:"Node display name",className:"h-11 rounded-2xl border-border/70 bg-background/70"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(Ee,{htmlFor:"node-endpoint",children:"Endpoint"}),n.jsx(Me,{id:"node-endpoint",type:"url",value:a,onChange:x=>l(x.target.value),placeholder:"http://host:port",className:"h-11 rounded-2xl border-border/70 bg-background/70"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(Ee,{htmlFor:"node-capabilities",children:"Capabilities"}),n.jsx(Me,{id:"node-capabilities",value:c,onChange:x=>u(x.target.value),placeholder:"Comma-separated, for example gpu, high-memory",className:"h-11 rounded-2xl border-border/70 bg-background/70"})]}),n.jsx(qo,{className:"border-t border-border/60 pt-4",children:n.jsx(H,{type:"submit",disabled:!t.trim()||!s.trim()||!a.trim()||f,className:"rounded-2xl",children:f?"Adding...":"Add node"})})]})]})})}function Zo(){const[e,t]=i.useState([]),[r,s]=i.useState(null),o=i.useRef(null),a=i.useCallback(()=>{var d;(d=o.current)==null||d.click()},[]),l=i.useCallback(async d=>{const m=Array.from(d.target.files??[]);if(m.length!==0)try{const h=await hs(m);t(v=>[...v,...h]),s(null)}catch(h){s(h instanceof Error?h.message:"Failed to attach image")}finally{d.target.value=""}},[]),c=i.useCallback(async d=>{const m=id(d.clipboardData);if(m.length!==0){d.preventDefault();try{const h=await hs(m);t(v=>[...v,...h]),s(null)}catch(h){s(h instanceof Error?h.message:"Failed to attach image")}}},[]),u=i.useCallback(d=>{t(m=>m.filter((h,v)=>v!==d))},[]),f=i.useCallback(()=>{t([]),s(null)},[]);return{images:e,error:r,fileInputRef:o,pickImages:a,handleFileChange:l,handlePaste:c,removeImage:u,clearImages:f}}function lf({onSend:e,disabled:t,placeholder:r="Send a follow-up message...",contextItems:s=[]}){const[o,a]=i.useState(""),l=i.useRef(null),{images:c,error:u,fileInputRef:f,pickImages:d,handleFileChange:m,handlePaste:h,removeImage:v,clearImages:x}=Zo(),p=i.useCallback(()=>{l.current&&(l.current.style.height="auto")},[]),g=i.useCallback(()=>{const j=jr(o,c);j.length===0||t||(e(j),a(""),x(),p())},[o,c,t,e,x,p]),b=i.useCallback(j=>{j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),g())},[g]),y=i.useCallback(()=>{l.current&&(l.current.style.height="auto",l.current.style.height=`${Math.min(l.current.scrollHeight,220)}px`)},[]),w=!t&&(o.trim().length>0||c.length>0),S=t?"Chat is waiting on the agent.":"Enter sends, Shift+Enter adds a line";return n.jsxs("div",{className:"border-t border-border/60 bg-background/55 px-4 py-4 backdrop-blur-xl sm:px-5",children:[s.length>0&&n.jsx("div",{className:"flex flex-wrap items-center gap-2 px-3 pb-2.5",children:s.map(j=>n.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:[n.jsx("span",{className:"shrink-0 text-[9px] font-medium uppercase tracking-[0.12em] text-muted-foreground/80",children:j.label}),n.jsx("span",{className:`truncate text-foreground/90 ${j.mono?"font-mono text-[11px]":""}`,children:j.value})]},`${j.label}:${j.value}`))}),n.jsxs("div",{className:"overflow-hidden rounded-[40px] border border-border/65 bg-card/85 shadow-[0_28px_90px_-62px_rgba(0,0,0,0.9)]",children:[n.jsx("input",{ref:f,type:"file",accept:"image/*",multiple:!0,onChange:m,className:"hidden"}),c.length>0&&n.jsx("div",{className:"px-6 pt-6",children:n.jsx("div",{className:"flex flex-wrap gap-3",children:c.map((j,E)=>n.jsxs("div",{className:"relative",children:[n.jsx("img",{src:Sr(j),alt:j.filename??`attachment ${E+1}`,className:"h-24 w-24 rounded-[22px] border border-border/70 object-cover"}),n.jsx("button",{type:"button",onClick:()=>v(E),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 ${j.filename??`image ${E+1}`}`,children:n.jsx(wr,{className:"h-3.5 w-3.5"})})]},`${j.filename??"image"}-${E}`))})}),n.jsxs("div",{className:"flex items-end gap-2 px-6 pt-4 pb-4",children:[n.jsx("textarea",{ref:l,value:o,onChange:j=>a(j.target.value),onKeyDown:b,onPaste:h,onInput:y,placeholder:r,disabled:t,rows:1,className:"min-h-[2.5rem] flex-1 resize-none bg-transparent px-0 py-1 text-[1.05rem] leading-7 text-foreground placeholder:text-muted-foreground/70 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 sm:text-[1.1rem]"}),n.jsxs(H,{type:"button",variant:"ghost",onClick:d,disabled:t,className:"mb-0.5 h-9 shrink-0 gap-1.5 rounded-full px-3 text-xs text-muted-foreground hover:text-foreground",children:[n.jsx(er,{className:"h-3.5 w-3.5"}),"Images"]}),n.jsx("span",{title:S,children:n.jsx(H,{onClick:g,disabled:!w,size:"icon",className:"mb-0.5 h-9 w-9 shrink-0 rounded-full bg-primary/85 text-primary-foreground shadow-sm hover:bg-primary",children:n.jsx(ao,{className:"h-4 w-4"})})})]}),u&&n.jsx("div",{className:"border-t border-destructive/20 bg-destructive/10 px-6 py-3 text-xs text-destructive",children:u})]})]})}function zt({payload:e,disabled:t=!1,bypassEnabled:r=!1,onBypassChange:s,onSubmit:o}){const[a,l]=i.useState(()=>r?md(e):e.questions.map(()=>[])),[c,u]=i.useState(!1),[f,d]=i.useState(!1);i.useEffect(()=>{r&&l(x=>x.map((p,g)=>{var b;return p.length>0?p:(b=e.questions[g])!=null&&b.options.length?[0]:[]}))},[r,e]);const m=pd(e,a)&&!t&&!c&&!f&&!!o,h=(x,p)=>{t||f||c||l(g=>g.map((b,y)=>{if(y!==x)return b;const w=e.questions[y];return w?w.multiSelect?b.includes(p)?b.filter(S=>S!==p):[...b,p].sort((S,j)=>S-j):[p]:b}))},v=async()=>{if(!m||!o)return;u(!0);const x=await o(hd(e,a));u(!1),x&&d(!0)};return n.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:[n.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.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:n.jsx(vc,{className:"h-4 w-4"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.22em] text-primary/80",children:"Ask User Question"}),n.jsx("div",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:"Select the answer you want to send back to the agent."})]})]}),n.jsxs(H,{type:"button",variant:r?"secondary":"outline",size:"sm",onClick:()=>s==null?void 0:s(!r),className:"rounded-full",children:[n.jsx(Bc,{className:"h-4 w-4"}),r?"Bypass on":"Bypass future questions"]})]}),n.jsx("div",{className:"mt-4 space-y-4",children:e.questions.map((x,p)=>{const g=a[p]??[];return n.jsxs("div",{className:"space-y-3 rounded-[20px] border border-border/60 bg-background/75 p-4",children:[n.jsxs("div",{children:[x.header&&n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-muted-foreground",children:x.header}),n.jsx("div",{className:"mt-1 text-sm font-medium leading-6 text-foreground",children:x.question}),n.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:x.multiSelect?"Select one or more options.":"Select one option."})]}),n.jsx("div",{className:"space-y-2",children:x.options.map((b,y)=>{const w=g.includes(y);return n.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:[n.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:n.jsx(br,{className:"h-3.5 w-3.5"})}),n.jsxs("span",{className:"min-w-0",children:[n.jsx("span",{className:"block text-sm font-medium leading-5",children:b.label}),b.description&&n.jsx("span",{className:"mt-1 block text-xs leading-5 text-muted-foreground",children:b.description})]})]},`${b.label}-${y}`)})})]},`${x.header??"question"}-${p}`)})}),n.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3",children:[n.jsx("div",{className:"text-xs text-muted-foreground",children:r?"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."}),n.jsx(H,{type:"button",onClick:()=>void v(),disabled:!m,className:"rounded-full px-5",children:f?"Sent":c?"Sending...":e.questions.length>1?"Send answers":"Send answer"})]})]})}function Ts({event:e,questionBypassEnabled:t=!1,onQuestionBypassChange:r,onSubmitQuestionResponse:s,questionResponseDisabled:o=!1}){const a=e.type,l=jn(e);if(l)return n.jsx(or,{children:n.jsx(zt,{payload:l,bypassEnabled:t,onBypassChange:r,onSubmit:s,disabled:o})});if(a==="user"){const c=Kt(e);return c?n.jsx(cf,{content:c}):null}return a==="assistant"?n.jsx(df,{event:e,questionBypassEnabled:t,onQuestionBypassChange:r,onSubmitQuestionResponse:s,questionResponseDisabled:o}):null}function Rs(e){var r;const t=e.replace(/\r\n/g,`
|
|
189
|
-
`).split(`
|
|
190
|
-
`);for(;t.length>0&&((r=t[0])==null?void 0:r.trim())==="";)t.shift();return t.join(`
|
|
191
|
-
`)}function cf({content:e}){const t=ad(e),r=e.filter(s=>s.type==="image");return n.jsx("div",{className:"animate-message-rise flex justify-end",children:n.jsxs("div",{className:"flex max-w-[88%] items-start gap-3",children:[n.jsxs("div",{className:"space-y-1 rounded-[26px] rounded-tr-md border border-primary/25 bg-primary px-4 py-3 text-sm leading-6 text-primary-foreground shadow-[0_20px_70px_-42px_hsl(var(--primary)/0.95)]",children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.28em] text-primary-foreground/75",children:"You"}),t&&n.jsx("div",{className:"whitespace-pre-wrap",children:t}),r.length>0&&n.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:r.map((s,o)=>n.jsx("img",{src:Sr(s),alt:s.filename??`attachment ${o+1}`,className:"max-h-72 rounded-2xl border border-primary-foreground/15 object-cover"},`${s.filename??"image"}-${o}`))})]}),n.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:n.jsx(Uc,{className:"h-4 w-4"})})]})})}function or({children:e}){return n.jsx("div",{className:"animate-message-rise flex justify-start",children:n.jsxs("div",{className:"flex max-w-[92%] items-start gap-3",children:[n.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:n.jsx(vr,{className:"h-4 w-4"})}),n.jsxs("div",{className:"min-w-0 space-y-3",children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.28em] text-muted-foreground",children:"Agent"}),e]})]})})}function df({event:e,questionBypassEnabled:t,onQuestionBypassChange:r,onSubmitQuestionResponse:s,questionResponseDisabled:o}){const a=e.message;if(!a)return null;const l=jn(a);if(l)return n.jsx(or,{children:n.jsx(zt,{payload:l,bypassEnabled:t,onBypassChange:r,onSubmit:s,disabled:o})});const c=a.content;if(!c||!Array.isArray(c))return null;const u=new Set,f=c.filter(x=>x.type==="text").map(x=>({...x,text:Rs(String(x.text??"")),questionPayload:Sn(Rs(String(x.text??"")))})).filter(x=>x.text.length>0||x.questionPayload),d=c.filter(x=>x.type==="thinking"),m=c.filter(x=>x.type==="tool_use"),h=c.filter(x=>x.type==="tool_result");return f.length>0||d.length>0||m.length>0||h.length>0?n.jsxs(or,{children:[d.length>0&&n.jsx(uf,{text:d.map(x=>String(x.thinking??"")).join(`
|
|
192
|
-
`)}),f.map((x,p)=>{if(x.questionPayload){const g=Ct(x.questionPayload);return u.has(g)?null:(u.add(g),n.jsx(zt,{payload:x.questionPayload,bypassEnabled:t,onBypassChange:r,onSubmit:s,disabled:o},p))}return n.jsx("div",{className:"rounded-[26px] rounded-tl-md border border-border/70 bg-card/80 px-4 py-3 text-sm leading-6 text-foreground shadow-[0_20px_70px_-58px_rgba(0,0,0,0.9)] backdrop-blur-sm",children:n.jsx("div",{className:"whitespace-pre-wrap",children:x.text})},p)}),m.map((x,p)=>n.jsx(ff,{block:x,renderedQuestionSignatures:u,questionBypassEnabled:t,onQuestionBypassChange:r,onSubmitQuestionResponse:s,questionResponseDisabled:o},p)),h.map((x,p)=>n.jsx(mf,{block:x,renderedQuestionSignatures:u,questionBypassEnabled:t,onQuestionBypassChange:r,onSubmitQuestionResponse:s,questionResponseDisabled:o},p))]}):null}function uf({text:e}){const[t,r]=i.useState(!1);return n.jsx("div",{className:"rounded-[22px] border border-border/60 bg-muted/35 px-4 py-3",children:n.jsxs("button",{type:"button",onClick:()=>r(s=>!s),className:"flex w-full items-start gap-2 text-left text-xs text-muted-foreground transition-colors hover:text-foreground",children:[n.jsx(fc,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-1 font-medium uppercase tracking-[0.18em]",children:[t?n.jsx(St,{className:"h-3 w-3"}):n.jsx(yr,{className:"h-3 w-3"}),"Thinking"]}),t&&n.jsx("div",{className:"mt-2 whitespace-pre-wrap text-sm leading-6 text-muted-foreground/90",children:e})]})]})})}function ff({block:e,renderedQuestionSignatures:t,questionBypassEnabled:r,onQuestionBypassChange:s,onSubmitQuestionResponse:o,questionResponseDisabled:a}){const[l,c]=i.useState(!1),u=String(e.name??"tool"),f=e.input,d=jn(e);if(d){const m=Ct(d);return t!=null&&t.has(m)?null:(t==null||t.add(m),n.jsx(zt,{payload:d,bypassEnabled:r,onBypassChange:s,onSubmit:o,disabled:a}))}return n.jsxs("div",{className:"overflow-hidden rounded-[22px] border border-border/60 bg-muted/25",children:[n.jsxs("button",{type:"button",onClick:()=>c(m=>!m),className:"flex w-full items-center gap-2 px-4 py-3 text-left text-xs text-muted-foreground transition-colors hover:bg-muted/40 hover:text-foreground",children:[n.jsx(Kc,{className:"h-3.5 w-3.5 shrink-0"}),n.jsx("span",{className:"font-mono text-[11px]",children:u}),l?n.jsx(St,{className:"ml-auto h-3.5 w-3.5"}):n.jsx(yr,{className:"ml-auto h-3.5 w-3.5"})]}),l&&f&&n.jsx("div",{className:"border-t border-border/60 px-4 py-3",children:n.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap text-xs leading-5 text-muted-foreground",children:JSON.stringify(f,null,2)})})]})}function mf({block:e,renderedQuestionSignatures:t,questionBypassEnabled:r,onQuestionBypassChange:s,onSubmitQuestionResponse:o,questionResponseDisabled:a}){const[l,c]=i.useState(!1),u=e.content,f=typeof u=="string"?u:Array.isArray(u)?u.map(h=>String(h.text??"")).join(`
|
|
193
|
-
`):"";if(!f)return null;const d=Sn(f);if(d){const h=Ct(d);return t!=null&&t.has(h)?null:(t==null||t.add(h),n.jsx(zt,{payload:d,bypassEnabled:r,onBypassChange:s,onSubmit:o,disabled:a}))}const m=f.length>132?`${f.slice(0,129)}...`:f;return n.jsxs("div",{className:"overflow-hidden rounded-[22px] border border-border/60 bg-background/65",children:[n.jsxs("button",{type:"button",onClick:()=>c(h=>!h),className:"flex w-full items-start gap-2 px-4 py-3 text-left text-xs text-muted-foreground transition-colors hover:bg-muted/35 hover:text-foreground",children:[n.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 font-medium uppercase tracking-[0.18em]",children:"Result"}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px]",children:m}),l?n.jsx(St,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}):n.jsx(yr,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"})]}),l&&n.jsx("div",{className:"border-t border-border/60 px-4 py-3",children:n.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap text-xs leading-5 text-muted-foreground",children:f})})]})}function Jo(e){const t=e+"CollectionProvider",[r,s]=tt(t),[o,a]=r(t,{collectionRef:{current:null},itemMap:new Map}),l=p=>{const{scope:g,children:b}=p,y=at.useRef(null),w=at.useRef(new Map).current;return n.jsx(o,{scope:g,itemMap:w,collectionRef:y,children:b})};l.displayName=t;const c=e+"CollectionSlot",u=Wt(c),f=at.forwardRef((p,g)=>{const{scope:b,children:y}=p,w=a(c,b),S=ne(g,w.collectionRef);return n.jsx(u,{ref:S,children:y})});f.displayName=c;const d=e+"CollectionItemSlot",m="data-radix-collection-item",h=Wt(d),v=at.forwardRef((p,g)=>{const{scope:b,children:y,...w}=p,S=at.useRef(null),j=ne(g,S),E=a(d,b);return at.useEffect(()=>(E.itemMap.set(S,{ref:S,...w}),()=>void E.itemMap.delete(S))),n.jsx(h,{[m]:"",ref:j,children:y})});v.displayName=d;function x(p){const g=a(e+"CollectionConsumer",p);return at.useCallback(()=>{const y=g.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${m}]`));return Array.from(g.itemMap.values()).sort((E,C)=>w.indexOf(E.ref.current)-w.indexOf(C.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:l,Slot:f,ItemSlot:v},x,s]}var pf=i.createContext(void 0);function Lr(e){const t=i.useContext(pf);return e||t||"ltr"}var Gn="rovingFocusGroup.onEntryFocus",hf={bubbles:!1,cancelable:!0},Gt="RovingFocusGroup",[ar,Qo,xf]=Jo(Gt),[gf,ea]=tt(Gt,[xf]),[vf,bf]=gf(Gt),ta=i.forwardRef((e,t)=>n.jsx(ar.Provider,{scope:e.__scopeRovingFocusGroup,children:n.jsx(ar.Slot,{scope:e.__scopeRovingFocusGroup,children:n.jsx(yf,{...e,ref:t})})}));ta.displayName=Gt;var yf=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:s,loop:o=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:f,preventScrollOnEntryFocus:d=!1,...m}=e,h=i.useRef(null),v=ne(t,h),x=Lr(a),[p,g]=wt({prop:l,defaultProp:c??null,onChange:u,caller:Gt}),[b,y]=i.useState(!1),w=Je(f),S=Qo(r),j=i.useRef(!1),[E,C]=i.useState(0);return i.useEffect(()=>{const T=h.current;if(T)return T.addEventListener(Gn,w),()=>T.removeEventListener(Gn,w)},[w]),n.jsx(vf,{scope:r,orientation:s,dir:x,loop:o,currentTabStopId:p,onItemFocus:i.useCallback(T=>g(T),[g]),onItemShiftTab:i.useCallback(()=>y(!0),[]),onFocusableItemAdd:i.useCallback(()=>C(T=>T+1),[]),onFocusableItemRemove:i.useCallback(()=>C(T=>T-1),[]),children:n.jsx(X.div,{tabIndex:b||E===0?-1:0,"data-orientation":s,...m,ref:v,style:{outline:"none",...e.style},onMouseDown:q(e.onMouseDown,()=>{j.current=!0}),onFocus:q(e.onFocus,T=>{const F=!j.current;if(T.target===T.currentTarget&&F&&!b){const $=new CustomEvent(Gn,hf);if(T.currentTarget.dispatchEvent($),!$.defaultPrevented){const O=S().filter(_=>_.focusable),L=O.find(_=>_.active),I=O.find(_=>_.id===p),G=[L,I,...O].filter(Boolean).map(_=>_.ref.current);sa(G,d)}}j.current=!1}),onBlur:q(e.onBlur,()=>y(!1))})})}),na="RovingFocusGroupItem",ra=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:s=!0,active:o=!1,tabStopId:a,children:l,...c}=e,u=Xe(),f=a||u,d=bf(na,r),m=d.currentTabStopId===f,h=Qo(r),{onFocusableItemAdd:v,onFocusableItemRemove:x,currentTabStopId:p}=d;return i.useEffect(()=>{if(s)return v(),()=>x()},[s,v,x]),n.jsx(ar.ItemSlot,{scope:r,id:f,focusable:s,active:o,children:n.jsx(X.span,{tabIndex:m?0:-1,"data-orientation":d.orientation,...c,ref:t,onMouseDown:q(e.onMouseDown,g=>{s?d.onItemFocus(f):g.preventDefault()}),onFocus:q(e.onFocus,()=>d.onItemFocus(f)),onKeyDown:q(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){d.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const b=jf(g,d.orientation,d.dir);if(b!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let w=h().filter(S=>S.focusable).map(S=>S.ref.current);if(b==="last")w.reverse();else if(b==="prev"||b==="next"){b==="prev"&&w.reverse();const S=w.indexOf(g.currentTarget);w=d.loop?Sf(w,S+1):w.slice(S+1)}setTimeout(()=>sa(w))}}),children:typeof l=="function"?l({isCurrentTabStop:m,hasTabStop:p!=null}):l})})});ra.displayName=na;var wf={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Nf(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function jf(e,t,r){const s=Nf(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return wf[s]}function sa(e,t=!1){const r=document.activeElement;for(const s of e)if(s===r||(s.focus({preventScroll:t}),document.activeElement!==r))return}function Sf(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var Cf=ta,kf=ra,En="Tabs",[Ef]=tt(En,[ea]),oa=ea(),[Af,$r]=Ef(En),aa=i.forwardRef((e,t)=>{const{__scopeTabs:r,value:s,onValueChange:o,defaultValue:a,orientation:l="horizontal",dir:c,activationMode:u="automatic",...f}=e,d=Lr(c),[m,h]=wt({prop:s,onChange:o,defaultProp:a??"",caller:En});return n.jsx(Af,{scope:r,baseId:Xe(),value:m,onValueChange:h,orientation:l,dir:d,activationMode:u,children:n.jsx(X.div,{dir:d,"data-orientation":l,...f,ref:t})})});aa.displayName=En;var ia="TabsList",la=i.forwardRef((e,t)=>{const{__scopeTabs:r,loop:s=!0,...o}=e,a=$r(ia,r),l=oa(r);return n.jsx(Cf,{asChild:!0,...l,orientation:a.orientation,dir:a.dir,loop:s,children:n.jsx(X.div,{role:"tablist","aria-orientation":a.orientation,...o,ref:t})})});la.displayName=ia;var ca="TabsTrigger",da=i.forwardRef((e,t)=>{const{__scopeTabs:r,value:s,disabled:o=!1,...a}=e,l=$r(ca,r),c=oa(r),u=ma(l.baseId,s),f=pa(l.baseId,s),d=s===l.value;return n.jsx(kf,{asChild:!0,...c,focusable:!o,active:d,children:n.jsx(X.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":f,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u,...a,ref:t,onMouseDown:q(e.onMouseDown,m=>{!o&&m.button===0&&m.ctrlKey===!1?l.onValueChange(s):m.preventDefault()}),onKeyDown:q(e.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&l.onValueChange(s)}),onFocus:q(e.onFocus,()=>{const m=l.activationMode!=="manual";!d&&!o&&m&&l.onValueChange(s)})})})});da.displayName=ca;var ua="TabsContent",fa=i.forwardRef((e,t)=>{const{__scopeTabs:r,value:s,forceMount:o,children:a,...l}=e,c=$r(ua,r),u=ma(c.baseId,s),f=pa(c.baseId,s),d=s===c.value,m=i.useRef(d);return i.useEffect(()=>{const h=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(h)},[]),n.jsx(kt,{present:o||d,children:({present:h})=>n.jsx(X.div,{"data-state":d?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!h,id:f,tabIndex:0,...l,ref:t,style:{...e.style,animationDuration:m.current?"0s":void 0},children:h&&a})})});fa.displayName=ua;function ma(e,t){return`${e}-trigger-${t}`}function pa(e,t){return`${e}-content-${t}`}var Tf=aa,ha=la,xa=da,ga=fa;const va=Tf,Fr=i.forwardRef(({className:e,...t},r)=>n.jsx(ha,{ref:r,className:W("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Fr.displayName=ha.displayName;const Ge=i.forwardRef(({className:e,...t},r)=>n.jsx(xa,{ref:r,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}));Ge.displayName=xa.displayName;const Ye=i.forwardRef(({className:e,...t},r)=>n.jsx(ga,{ref:r,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}));Ye.displayName=ga.displayName;var ba="AlertDialog",[Rf]=tt(ba,[ko]),We=ko(),ya=e=>{const{__scopeAlertDialog:t,...r}=e,s=We(t);return n.jsx(Wo,{...s,...r,modal:!0})};ya.displayName=ba;var _f="AlertDialogTrigger",wa=i.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,o=We(r);return n.jsx(Ju,{...o,...s,ref:t})});wa.displayName=_f;var Pf="AlertDialogPortal",Na=e=>{const{__scopeAlertDialog:t,...r}=e,s=We(t);return n.jsx(zo,{...s,...r})};Na.displayName=Pf;var Df="AlertDialogOverlay",ja=i.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,o=We(r);return n.jsx(Pr,{...o,...s,ref:t})});ja.displayName=Df;var bt="AlertDialogContent",[If,Mf]=Rf(bt),Of=Pd("AlertDialogContent"),Sa=i.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:s,...o}=e,a=We(r),l=i.useRef(null),c=ne(t,l),u=i.useRef(null);return n.jsx(Gu,{contentName:bt,titleName:Ca,docsSlug:"alert-dialog",children:n.jsx(If,{scope:r,cancelRef:u,children:n.jsxs(Dr,{role:"alertdialog",...a,...o,ref:c,onOpenAutoFocus:q(o.onOpenAutoFocus,f=>{var d;f.preventDefault(),(d=u.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[n.jsx(Of,{children:s}),n.jsx($f,{contentRef:l})]})})})});Sa.displayName=bt;var Ca="AlertDialogTitle",ka=i.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,o=We(r);return n.jsx(Ir,{...o,...s,ref:t})});ka.displayName=Ca;var Ea="AlertDialogDescription",Aa=i.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,o=We(r);return n.jsx(Mr,{...o,...s,ref:t})});Aa.displayName=Ea;var Lf="AlertDialogAction",Ta=i.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,o=We(r);return n.jsx(Or,{...o,...s,ref:t})});Ta.displayName=Lf;var Ra="AlertDialogCancel",_a=i.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,{cancelRef:o}=Mf(Ra,r),a=We(r),l=ne(t,o);return n.jsx(Or,{...a,...s,ref:l})});_a.displayName=Ra;var $f=({contentRef:e})=>{const t=`\`${bt}\` requires a description for the component to be accessible for screen reader users.
|
|
194
|
-
|
|
195
|
-
You can add a description to the \`${bt}\` by passing a \`${Ea}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
196
|
-
|
|
197
|
-
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 \`${bt}\`. 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.
|
|
198
|
-
|
|
199
|
-
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},Ff=ya,Bf=wa,Vf=Na,Pa=ja,Da=Sa,Ia=Ta,Ma=_a,Oa=ka,La=Aa;const ln=Ff,cn=Bf,Wf=Vf,$a=i.forwardRef(({className:e,...t},r)=>n.jsx(Pa,{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:r}));$a.displayName=Pa.displayName;const It=i.forwardRef(({className:e,...t},r)=>n.jsxs(Wf,{children:[n.jsx($a,{}),n.jsx(Da,{ref:r,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})]}));It.displayName=Da.displayName;const Mt=({className:e,...t})=>n.jsx("div",{className:W("flex flex-col space-y-2 text-center sm:text-left",e),...t});Mt.displayName="AlertDialogHeader";const Ot=({className:e,...t})=>n.jsx("div",{className:W("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ot.displayName="AlertDialogFooter";const Lt=i.forwardRef(({className:e,...t},r)=>n.jsx(Oa,{ref:r,className:W("text-lg font-semibold",e),...t}));Lt.displayName=Oa.displayName;const $t=i.forwardRef(({className:e,...t},r)=>n.jsx(La,{ref:r,className:W("text-sm text-muted-foreground",e),...t}));$t.displayName=La.displayName;const Ft=i.forwardRef(({className:e,...t},r)=>n.jsx(Ia,{ref:r,className:W(Ys(),e),...t}));Ft.displayName=Ia.displayName;const Bt=i.forwardRef(({className:e,...t},r)=>n.jsx(Ma,{ref:r,className:W(Ys({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Bt.displayName=Ma.displayName;function _s(e,[t,r]){return Math.min(r,Math.max(t,e))}const zf=["top","right","bottom","left"],Qe=Math.min,we=Math.max,hn=Math.round,sn=Math.floor,Le=e=>({x:e,y:e}),Uf={left:"right",right:"left",bottom:"top",top:"bottom"};function ir(e,t,r){return we(e,Qe(t,r))}function Be(e,t){return typeof e=="function"?e(t):e}function Ve(e){return e.split("-")[0]}function Et(e){return e.split("-")[1]}function Br(e){return e==="x"?"y":"x"}function Vr(e){return e==="y"?"height":"width"}function Oe(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Wr(e){return Br(Oe(e))}function Hf(e,t,r){r===void 0&&(r=!1);const s=Et(e),o=Wr(e),a=Vr(o);let l=o==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(l=xn(l)),[l,xn(l)]}function Kf(e){const t=xn(e);return[lr(e),t,lr(t)]}function lr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ps=["left","right"],Ds=["right","left"],qf=["top","bottom"],Gf=["bottom","top"];function Yf(e,t,r){switch(e){case"top":case"bottom":return r?t?Ds:Ps:t?Ps:Ds;case"left":case"right":return t?qf:Gf;default:return[]}}function Xf(e,t,r,s){const o=Et(e);let a=Yf(Ve(e),r==="start",s);return o&&(a=a.map(l=>l+"-"+o),t&&(a=a.concat(a.map(lr)))),a}function xn(e){const t=Ve(e);return Uf[t]+e.slice(t.length)}function Zf(e){return{top:0,right:0,bottom:0,left:0,...e}}function Fa(e){return typeof e!="number"?Zf(e):{top:e,right:e,bottom:e,left:e}}function gn(e){const{x:t,y:r,width:s,height:o}=e;return{width:s,height:o,top:r,left:t,right:t+s,bottom:r+o,x:t,y:r}}function Is(e,t,r){let{reference:s,floating:o}=e;const a=Oe(t),l=Wr(t),c=Vr(l),u=Ve(t),f=a==="y",d=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 v;switch(u){case"top":v={x:d,y:s.y-o.height};break;case"bottom":v={x:d,y:s.y+s.height};break;case"right":v={x:s.x+s.width,y:m};break;case"left":v={x:s.x-o.width,y:m};break;default:v={x:s.x,y:s.y}}switch(Et(t)){case"start":v[l]-=h*(r&&f?-1:1);break;case"end":v[l]+=h*(r&&f?-1:1);break}return v}async function Jf(e,t){var r;t===void 0&&(t={});const{x:s,y:o,platform:a,rects:l,elements:c,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:d="viewport",elementContext:m="floating",altBoundary:h=!1,padding:v=0}=Be(t,e),x=Fa(v),g=c[h?m==="floating"?"reference":"floating":m],b=gn(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(g)))==null||r?g:g.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:f,rootBoundary:d,strategy:u})),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)),S=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},j=gn(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:w,strategy:u}):y);return{top:(b.top-j.top+x.top)/S.y,bottom:(j.bottom-b.bottom+x.bottom)/S.y,left:(b.left-j.left+x.left)/S.x,right:(j.right-b.right+x.right)/S.x}}const Qf=50,em=async(e,t,r)=>{const{placement:s="bottom",strategy:o="absolute",middleware:a=[],platform:l}=r,c=l.detectOverflow?l:{...l,detectOverflow:Jf},u=await(l.isRTL==null?void 0:l.isRTL(t));let f=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:m}=Is(f,s,u),h=s,v=0;const x={};for(let p=0;p<a.length;p++){const g=a[p];if(!g)continue;const{name:b,fn:y}=g,{x:w,y:S,data:j,reset:E}=await y({x:d,y:m,initialPlacement:s,placement:h,strategy:o,middlewareData:x,rects:f,platform:c,elements:{reference:e,floating:t}});d=w??d,m=S??m,x[b]={...x[b],...j},E&&v<Qf&&(v++,typeof E=="object"&&(E.placement&&(h=E.placement),E.rects&&(f=E.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:o}):E.rects),{x:d,y:m}=Is(f,h,u)),p=-1)}return{x:d,y:m,placement:h,strategy:o,middlewareData:x}},tm=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:s,placement:o,rects:a,platform:l,elements:c,middlewareData:u}=t,{element:f,padding:d=0}=Be(e,t)||{};if(f==null)return{};const m=Fa(d),h={x:r,y:s},v=Wr(o),x=Vr(v),p=await l.getDimensions(f),g=v==="y",b=g?"top":"left",y=g?"bottom":"right",w=g?"clientHeight":"clientWidth",S=a.reference[x]+a.reference[v]-h[v]-a.floating[x],j=h[v]-a.reference[v],E=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f));let C=E?E[w]:0;(!C||!await(l.isElement==null?void 0:l.isElement(E)))&&(C=c.floating[w]||a.floating[x]);const T=S/2-j/2,F=C/2-p[x]/2-1,$=Qe(m[b],F),O=Qe(m[y],F),L=$,I=C-p[x]-O,z=C/2-p[x]/2+T,G=ir(L,z,I),_=!u.arrow&&Et(o)!=null&&z!==G&&a.reference[x]/2-(z<L?$:O)-p[x]/2<0,B=_?z<L?z-L:z-I:0;return{[v]:h[v]+B,data:{[v]:G,centerOffset:z-G-B,..._&&{alignmentOffset:B}},reset:_}}}),nm=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,s;const{placement:o,middlewareData:a,rects:l,initialPlacement:c,platform:u,elements:f}=t,{mainAxis:d=!0,crossAxis:m=!0,fallbackPlacements:h,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:p=!0,...g}=Be(e,t);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const b=Ve(o),y=Oe(c),w=Ve(c)===c,S=await(u.isRTL==null?void 0:u.isRTL(f.floating)),j=h||(w||!p?[xn(c)]:Kf(c)),E=x!=="none";!h&&E&&j.push(...Xf(c,p,x,S));const C=[c,...j],T=await u.detectOverflow(t,g),F=[];let $=((s=a.flip)==null?void 0:s.overflows)||[];if(d&&F.push(T[b]),m){const z=Hf(o,l,S);F.push(T[z[0]],T[z[1]])}if($=[...$,{placement:o,overflows:F}],!F.every(z=>z<=0)){var O,L;const z=(((O=a.flip)==null?void 0:O.index)||0)+1,G=C[z];if(G&&(!(m==="alignment"?y!==Oe(G):!1)||$.every(P=>Oe(P.placement)===y?P.overflows[0]>0:!0)))return{data:{index:z,overflows:$},reset:{placement:G}};let _=(L=$.filter(B=>B.overflows[0]<=0).sort((B,P)=>B.overflows[1]-P.overflows[1])[0])==null?void 0:L.placement;if(!_)switch(v){case"bestFit":{var I;const B=(I=$.filter(P=>{if(E){const U=Oe(P.placement);return U===y||U==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(U=>U>0).reduce((U,Y)=>U+Y,0)]).sort((P,U)=>P[1]-U[1])[0])==null?void 0:I[0];B&&(_=B);break}case"initialPlacement":_=c;break}if(o!==_)return{reset:{placement:_}}}return{}}}};function Ms(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Os(e){return zf.some(t=>e[t]>=0)}const rm=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:s}=t,{strategy:o="referenceHidden",...a}=Be(e,t);switch(o){case"referenceHidden":{const l=await s.detectOverflow(t,{...a,elementContext:"reference"}),c=Ms(l,r.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Os(c)}}}case"escaped":{const l=await s.detectOverflow(t,{...a,altBoundary:!0}),c=Ms(l,r.floating);return{data:{escapedOffsets:c,escaped:Os(c)}}}default:return{}}}}},Ba=new Set(["left","top"]);async function sm(e,t){const{placement:r,platform:s,elements:o}=e,a=await(s.isRTL==null?void 0:s.isRTL(o.floating)),l=Ve(r),c=Et(r),u=Oe(r)==="y",f=Ba.has(l)?-1:1,d=a&&u?-1:1,m=Be(t,e);let{mainAxis:h,crossAxis:v,alignmentAxis:x}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof x=="number"&&(v=c==="end"?x*-1:x),u?{x:v*d,y:h*f}:{x:h*f,y:v*d}}const om=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,s;const{x:o,y:a,placement:l,middlewareData:c}=t,u=await sm(t,e);return l===((r=c.offset)==null?void 0:r.placement)&&(s=c.arrow)!=null&&s.alignmentOffset?{}:{x:o+u.x,y:a+u.y,data:{...u,placement:l}}}}},am=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:s,placement:o,platform:a}=t,{mainAxis:l=!0,crossAxis:c=!1,limiter:u={fn:b=>{let{x:y,y:w}=b;return{x:y,y:w}}},...f}=Be(e,t),d={x:r,y:s},m=await a.detectOverflow(t,f),h=Oe(Ve(o)),v=Br(h);let x=d[v],p=d[h];if(l){const b=v==="y"?"top":"left",y=v==="y"?"bottom":"right",w=x+m[b],S=x-m[y];x=ir(w,x,S)}if(c){const b=h==="y"?"top":"left",y=h==="y"?"bottom":"right",w=p+m[b],S=p-m[y];p=ir(w,p,S)}const g=u.fn({...t,[v]:x,[h]:p});return{...g,data:{x:g.x-r,y:g.y-s,enabled:{[v]:l,[h]:c}}}}}},im=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:s,placement:o,rects:a,middlewareData:l}=t,{offset:c=0,mainAxis:u=!0,crossAxis:f=!0}=Be(e,t),d={x:r,y:s},m=Oe(o),h=Br(m);let v=d[h],x=d[m];const p=Be(c,t),g=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(u){const w=h==="y"?"height":"width",S=a.reference[h]-a.floating[w]+g.mainAxis,j=a.reference[h]+a.reference[w]-g.mainAxis;v<S?v=S:v>j&&(v=j)}if(f){var b,y;const w=h==="y"?"width":"height",S=Ba.has(Ve(o)),j=a.reference[m]-a.floating[w]+(S&&((b=l.offset)==null?void 0:b[m])||0)+(S?0:g.crossAxis),E=a.reference[m]+a.reference[w]+(S?0:((y=l.offset)==null?void 0:y[m])||0)-(S?g.crossAxis:0);x<j?x=j:x>E&&(x=E)}return{[h]:v,[m]:x}}}},lm=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,s;const{placement:o,rects:a,platform:l,elements:c}=t,{apply:u=()=>{},...f}=Be(e,t),d=await l.detectOverflow(t,f),m=Ve(o),h=Et(o),v=Oe(o)==="y",{width:x,height:p}=a.floating;let g,b;m==="top"||m==="bottom"?(g=m,b=h===(await(l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(b=m,g=h==="end"?"top":"bottom");const y=p-d.top-d.bottom,w=x-d.left-d.right,S=Qe(p-d[g],y),j=Qe(x-d[b],w),E=!t.middlewareData.shift;let C=S,T=j;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(T=w),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(C=y),E&&!h){const $=we(d.left,0),O=we(d.right,0),L=we(d.top,0),I=we(d.bottom,0);v?T=x-2*($!==0||O!==0?$+O:we(d.left,d.right)):C=p-2*(L!==0||I!==0?L+I:we(d.top,d.bottom))}await u({...t,availableWidth:T,availableHeight:C});const F=await l.getDimensions(c.floating);return x!==F.width||p!==F.height?{reset:{rects:!0}}:{}}}};function An(){return typeof window<"u"}function At(e){return Va(e)?(e.nodeName||"").toLowerCase():"#document"}function Ne(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function $e(e){var t;return(t=(Va(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Va(e){return An()?e instanceof Node||e instanceof Ne(e).Node:!1}function Re(e){return An()?e instanceof Element||e instanceof Ne(e).Element:!1}function ze(e){return An()?e instanceof HTMLElement||e instanceof Ne(e).HTMLElement:!1}function Ls(e){return!An()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ne(e).ShadowRoot}function Yt(e){const{overflow:t,overflowX:r,overflowY:s,display:o}=_e(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+r)&&o!=="inline"&&o!=="contents"}function cm(e){return/^(table|td|th)$/.test(At(e))}function Tn(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const dm=/transform|translate|scale|rotate|perspective|filter/,um=/paint|layout|strict|content/,it=e=>!!e&&e!=="none";let Yn;function zr(e){const t=Re(e)?_e(e):e;return it(t.transform)||it(t.translate)||it(t.scale)||it(t.rotate)||it(t.perspective)||!Ur()&&(it(t.backdropFilter)||it(t.filter))||dm.test(t.willChange||"")||um.test(t.contain||"")}function fm(e){let t=et(e);for(;ze(t)&&!Nt(t);){if(zr(t))return t;if(Tn(t))return null;t=et(t)}return null}function Ur(){return Yn==null&&(Yn=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Yn}function Nt(e){return/^(html|body|#document)$/.test(At(e))}function _e(e){return Ne(e).getComputedStyle(e)}function Rn(e){return Re(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function et(e){if(At(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ls(e)&&e.host||$e(e);return Ls(t)?t.host:t}function Wa(e){const t=et(e);return Nt(t)?e.ownerDocument?e.ownerDocument.body:e.body:ze(t)&&Yt(t)?t:Wa(t)}function Ut(e,t,r){var s;t===void 0&&(t=[]),r===void 0&&(r=!0);const o=Wa(e),a=o===((s=e.ownerDocument)==null?void 0:s.body),l=Ne(o);if(a){const c=cr(l);return t.concat(l,l.visualViewport||[],Yt(o)?o:[],c&&r?Ut(c):[])}else return t.concat(o,Ut(o,[],r))}function cr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function za(e){const t=_e(e);let r=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const o=ze(e),a=o?e.offsetWidth:r,l=o?e.offsetHeight:s,c=hn(r)!==a||hn(s)!==l;return c&&(r=a,s=l),{width:r,height:s,$:c}}function Hr(e){return Re(e)?e:e.contextElement}function yt(e){const t=Hr(e);if(!ze(t))return Le(1);const r=t.getBoundingClientRect(),{width:s,height:o,$:a}=za(t);let l=(a?hn(r.width):r.width)/s,c=(a?hn(r.height):r.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const mm=Le(0);function Ua(e){const t=Ne(e);return!Ur()||!t.visualViewport?mm:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function pm(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Ne(e)?!1:t}function ct(e,t,r,s){t===void 0&&(t=!1),r===void 0&&(r=!1);const o=e.getBoundingClientRect(),a=Hr(e);let l=Le(1);t&&(s?Re(s)&&(l=yt(s)):l=yt(e));const c=pm(a,r,s)?Ua(a):Le(0);let u=(o.left+c.x)/l.x,f=(o.top+c.y)/l.y,d=o.width/l.x,m=o.height/l.y;if(a){const h=Ne(a),v=s&&Re(s)?Ne(s):s;let x=h,p=cr(x);for(;p&&s&&v!==x;){const g=yt(p),b=p.getBoundingClientRect(),y=_e(p),w=b.left+(p.clientLeft+parseFloat(y.paddingLeft))*g.x,S=b.top+(p.clientTop+parseFloat(y.paddingTop))*g.y;u*=g.x,f*=g.y,d*=g.x,m*=g.y,u+=w,f+=S,x=Ne(p),p=cr(x)}}return gn({width:d,height:m,x:u,y:f})}function _n(e,t){const r=Rn(e).scrollLeft;return t?t.left+r:ct($e(e)).left+r}function Ha(e,t){const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-_n(e,r),o=r.top+t.scrollTop;return{x:s,y:o}}function hm(e){let{elements:t,rect:r,offsetParent:s,strategy:o}=e;const a=o==="fixed",l=$e(s),c=t?Tn(t.floating):!1;if(s===l||c&&a)return r;let u={scrollLeft:0,scrollTop:0},f=Le(1);const d=Le(0),m=ze(s);if((m||!m&&!a)&&((At(s)!=="body"||Yt(l))&&(u=Rn(s)),m)){const v=ct(s);f=yt(s),d.x=v.x+s.clientLeft,d.y=v.y+s.clientTop}const h=l&&!m&&!a?Ha(l,u):Le(0);return{width:r.width*f.x,height:r.height*f.y,x:r.x*f.x-u.scrollLeft*f.x+d.x+h.x,y:r.y*f.y-u.scrollTop*f.y+d.y+h.y}}function xm(e){return Array.from(e.getClientRects())}function gm(e){const t=$e(e),r=Rn(e),s=e.ownerDocument.body,o=we(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),a=we(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let l=-r.scrollLeft+_n(e);const c=-r.scrollTop;return _e(s).direction==="rtl"&&(l+=we(t.clientWidth,s.clientWidth)-o),{width:o,height:a,x:l,y:c}}const $s=25;function vm(e,t){const r=Ne(e),s=$e(e),o=r.visualViewport;let a=s.clientWidth,l=s.clientHeight,c=0,u=0;if(o){a=o.width,l=o.height;const d=Ur();(!d||d&&t==="fixed")&&(c=o.offsetLeft,u=o.offsetTop)}const f=_n(s);if(f<=0){const d=s.ownerDocument,m=d.body,h=getComputedStyle(m),v=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,x=Math.abs(s.clientWidth-m.clientWidth-v);x<=$s&&(a-=x)}else f<=$s&&(a+=f);return{width:a,height:l,x:c,y:u}}function bm(e,t){const r=ct(e,!0,t==="fixed"),s=r.top+e.clientTop,o=r.left+e.clientLeft,a=ze(e)?yt(e):Le(1),l=e.clientWidth*a.x,c=e.clientHeight*a.y,u=o*a.x,f=s*a.y;return{width:l,height:c,x:u,y:f}}function Fs(e,t,r){let s;if(t==="viewport")s=vm(e,r);else if(t==="document")s=gm($e(e));else if(Re(t))s=bm(t,r);else{const o=Ua(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return gn(s)}function Ka(e,t){const r=et(e);return r===t||!Re(r)||Nt(r)?!1:_e(r).position==="fixed"||Ka(r,t)}function ym(e,t){const r=t.get(e);if(r)return r;let s=Ut(e,[],!1).filter(c=>Re(c)&&At(c)!=="body"),o=null;const a=_e(e).position==="fixed";let l=a?et(e):e;for(;Re(l)&&!Nt(l);){const c=_e(l),u=zr(l);!u&&c.position==="fixed"&&(o=null),(a?!u&&!o:!u&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Yt(l)&&!u&&Ka(e,l))?s=s.filter(d=>d!==l):o=c,l=et(l)}return t.set(e,s),s}function wm(e){let{element:t,boundary:r,rootBoundary:s,strategy:o}=e;const l=[...r==="clippingAncestors"?Tn(t)?[]:ym(t,this._c):[].concat(r),s],c=Fs(t,l[0],o);let u=c.top,f=c.right,d=c.bottom,m=c.left;for(let h=1;h<l.length;h++){const v=Fs(t,l[h],o);u=we(v.top,u),f=Qe(v.right,f),d=Qe(v.bottom,d),m=we(v.left,m)}return{width:f-m,height:d-u,x:m,y:u}}function Nm(e){const{width:t,height:r}=za(e);return{width:t,height:r}}function jm(e,t,r){const s=ze(t),o=$e(t),a=r==="fixed",l=ct(e,!0,a,t);let c={scrollLeft:0,scrollTop:0};const u=Le(0);function f(){u.x=_n(o)}if(s||!s&&!a)if((At(t)!=="body"||Yt(o))&&(c=Rn(t)),s){const v=ct(t,!0,a,t);u.x=v.x+t.clientLeft,u.y=v.y+t.clientTop}else o&&f();a&&!s&&o&&f();const d=o&&!s&&!a?Ha(o,c):Le(0),m=l.left+c.scrollLeft-u.x-d.x,h=l.top+c.scrollTop-u.y-d.y;return{x:m,y:h,width:l.width,height:l.height}}function Xn(e){return _e(e).position==="static"}function Bs(e,t){if(!ze(e)||_e(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return $e(e)===r&&(r=r.ownerDocument.body),r}function qa(e,t){const r=Ne(e);if(Tn(e))return r;if(!ze(e)){let o=et(e);for(;o&&!Nt(o);){if(Re(o)&&!Xn(o))return o;o=et(o)}return r}let s=Bs(e,t);for(;s&&cm(s)&&Xn(s);)s=Bs(s,t);return s&&Nt(s)&&Xn(s)&&!zr(s)?r:s||fm(e)||r}const Sm=async function(e){const t=this.getOffsetParent||qa,r=this.getDimensions,s=await r(e.floating);return{reference:jm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Cm(e){return _e(e).direction==="rtl"}const km={convertOffsetParentRelativeRectToViewportRelativeRect:hm,getDocumentElement:$e,getClippingRect:wm,getOffsetParent:qa,getElementRects:Sm,getClientRects:xm,getDimensions:Nm,getScale:yt,isElement:Re,isRTL:Cm};function Ga(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Em(e,t){let r=null,s;const o=$e(e);function a(){var c;clearTimeout(s),(c=r)==null||c.disconnect(),r=null}function l(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),a();const f=e.getBoundingClientRect(),{left:d,top:m,width:h,height:v}=f;if(c||t(),!h||!v)return;const x=sn(m),p=sn(o.clientWidth-(d+h)),g=sn(o.clientHeight-(m+v)),b=sn(d),w={rootMargin:-x+"px "+-p+"px "+-g+"px "+-b+"px",threshold:we(0,Qe(1,u))||1};let S=!0;function j(E){const C=E[0].intersectionRatio;if(C!==u){if(!S)return l();C?l(!1,C):s=setTimeout(()=>{l(!1,1e-7)},1e3)}C===1&&!Ga(f,e.getBoundingClientRect())&&l(),S=!1}try{r=new IntersectionObserver(j,{...w,root:o.ownerDocument})}catch{r=new IntersectionObserver(j,w)}r.observe(e)}return l(!0),a}function Am(e,t,r,s){s===void 0&&(s={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=s,f=Hr(e),d=o||a?[...f?Ut(f):[],...t?Ut(t):[]]:[];d.forEach(b=>{o&&b.addEventListener("scroll",r,{passive:!0}),a&&b.addEventListener("resize",r)});const m=f&&c?Em(f,r):null;let h=-1,v=null;l&&(v=new ResizeObserver(b=>{let[y]=b;y&&y.target===f&&v&&t&&(v.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=v)==null||w.observe(t)})),r()}),f&&!u&&v.observe(f),t&&v.observe(t));let x,p=u?ct(e):null;u&&g();function g(){const b=ct(e);p&&!Ga(p,b)&&r(),p=b,x=requestAnimationFrame(g)}return r(),()=>{var b;d.forEach(y=>{o&&y.removeEventListener("scroll",r),a&&y.removeEventListener("resize",r)}),m==null||m(),(b=v)==null||b.disconnect(),v=null,u&&cancelAnimationFrame(x)}}const Tm=om,Rm=am,_m=nm,Pm=lm,Dm=rm,Vs=tm,Im=im,Mm=(e,t,r)=>{const s=new Map,o={platform:km,...r},a={...o.platform,_c:s};return em(e,t,{...o,platform:a})};var Om=typeof document<"u",Lm=function(){},dn=Om?i.useLayoutEffect:Lm;function vn(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 r,s,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(s=r;s--!==0;)if(!vn(e[s],t[s]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(s=r;s--!==0;)if(!{}.hasOwnProperty.call(t,o[s]))return!1;for(s=r;s--!==0;){const a=o[s];if(!(a==="_owner"&&e.$$typeof)&&!vn(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function Ya(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ws(e,t){const r=Ya(e);return Math.round(t*r)/r}function Zn(e){const t=i.useRef(e);return dn(()=>{t.current=e}),t}function $m(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:s=[],platform:o,elements:{reference:a,floating:l}={},transform:c=!0,whileElementsMounted:u,open:f}=e,[d,m]=i.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,v]=i.useState(s);vn(h,s)||v(s);const[x,p]=i.useState(null),[g,b]=i.useState(null),y=i.useCallback(P=>{P!==E.current&&(E.current=P,p(P))},[]),w=i.useCallback(P=>{P!==C.current&&(C.current=P,b(P))},[]),S=a||x,j=l||g,E=i.useRef(null),C=i.useRef(null),T=i.useRef(d),F=u!=null,$=Zn(u),O=Zn(o),L=Zn(f),I=i.useCallback(()=>{if(!E.current||!C.current)return;const P={placement:t,strategy:r,middleware:h};O.current&&(P.platform=O.current),Mm(E.current,C.current,P).then(U=>{const Y={...U,isPositioned:L.current!==!1};z.current&&!vn(T.current,Y)&&(T.current=Y,wn.flushSync(()=>{m(Y)}))})},[h,t,r,O,L]);dn(()=>{f===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,m(P=>({...P,isPositioned:!1})))},[f]);const z=i.useRef(!1);dn(()=>(z.current=!0,()=>{z.current=!1}),[]),dn(()=>{if(S&&(E.current=S),j&&(C.current=j),S&&j){if($.current)return $.current(S,j,I);I()}},[S,j,I,$,F]);const G=i.useMemo(()=>({reference:E,floating:C,setReference:y,setFloating:w}),[y,w]),_=i.useMemo(()=>({reference:S,floating:j}),[S,j]),B=i.useMemo(()=>{const P={position:r,left:0,top:0};if(!_.floating)return P;const U=Ws(_.floating,d.x),Y=Ws(_.floating,d.y);return c?{...P,transform:"translate("+U+"px, "+Y+"px)",...Ya(_.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:U,top:Y}},[r,c,_.floating,d.x,d.y]);return i.useMemo(()=>({...d,update:I,refs:G,elements:_,floatingStyles:B}),[d,I,G,_,B])}const Fm=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:s,padding:o}=typeof e=="function"?e(r):e;return s&&t(s)?s.current!=null?Vs({element:s.current,padding:o}).fn(r):{}:s?Vs({element:s,padding:o}).fn(r):{}}}},Bm=(e,t)=>{const r=Tm(e);return{name:r.name,fn:r.fn,options:[e,t]}},Vm=(e,t)=>{const r=Rm(e);return{name:r.name,fn:r.fn,options:[e,t]}},Wm=(e,t)=>({fn:Im(e).fn,options:[e,t]}),zm=(e,t)=>{const r=_m(e);return{name:r.name,fn:r.fn,options:[e,t]}},Um=(e,t)=>{const r=Pm(e);return{name:r.name,fn:r.fn,options:[e,t]}},Hm=(e,t)=>{const r=Dm(e);return{name:r.name,fn:r.fn,options:[e,t]}},Km=(e,t)=>{const r=Fm(e);return{name:r.name,fn:r.fn,options:[e,t]}};var qm="Arrow",Xa=i.forwardRef((e,t)=>{const{children:r,width:s=10,height:o=5,...a}=e;return n.jsx(X.svg,{...a,ref:t,width:s,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:n.jsx("polygon",{points:"0,0 30,0 15,10"})})});Xa.displayName=qm;var Gm=Xa;function Za(e){const[t,r]=i.useState(void 0);return pe(()=>{if(e){r({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 u=a.borderBoxSize,f=Array.isArray(u)?u[0]:u;l=f.inlineSize,c=f.blockSize}else l=e.offsetWidth,c=e.offsetHeight;r({width:l,height:c})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else r(void 0)},[e]),t}var Kr="Popper",[Ja,Qa]=tt(Kr),[Ym,ei]=Ja(Kr),ti=e=>{const{__scopePopper:t,children:r}=e,[s,o]=i.useState(null);return n.jsx(Ym,{scope:t,anchor:s,onAnchorChange:o,children:r})};ti.displayName=Kr;var ni="PopperAnchor",ri=i.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:s,...o}=e,a=ei(ni,r),l=i.useRef(null),c=ne(t,l),u=i.useRef(null);return i.useEffect(()=>{const f=u.current;u.current=(s==null?void 0:s.current)||l.current,f!==u.current&&a.onAnchorChange(u.current)}),s?null:n.jsx(X.div,{...o,ref:c})});ri.displayName=ni;var qr="PopperContent",[Xm,Zm]=Ja(qr),si=i.forwardRef((e,t)=>{var M,Q,le,ee,Z,k;const{__scopePopper:r,side:s="bottom",sideOffset:o=0,align:a="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:d=0,sticky:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:v="optimized",onPlaced:x,...p}=e,g=ei(qr,r),[b,y]=i.useState(null),w=ne(t,K=>y(K)),[S,j]=i.useState(null),E=Za(S),C=(E==null?void 0:E.width)??0,T=(E==null?void 0:E.height)??0,F=s+(a!=="center"?"-"+a:""),$=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},O=Array.isArray(f)?f:[f],L=O.length>0,I={padding:$,boundary:O.filter(Qm),altBoundary:L},{refs:z,floatingStyles:G,placement:_,isPositioned:B,middlewareData:P}=$m({strategy:"fixed",placement:F,whileElementsMounted:(...K)=>Am(...K,{animationFrame:v==="always"}),elements:{reference:g.anchor},middleware:[Bm({mainAxis:o+T,alignmentAxis:l}),u&&Vm({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?Wm():void 0,...I}),u&&zm({...I}),Um({...I,apply:({elements:K,rects:ae,availableWidth:he,availableHeight:xe})=>{const{width:st,height:Rt}=ae.reference,ft=K.floating.style;ft.setProperty("--radix-popper-available-width",`${he}px`),ft.setProperty("--radix-popper-available-height",`${xe}px`),ft.setProperty("--radix-popper-anchor-width",`${st}px`),ft.setProperty("--radix-popper-anchor-height",`${Rt}px`)}}),S&&Km({element:S,padding:c}),ep({arrowWidth:C,arrowHeight:T}),h&&Hm({strategy:"referenceHidden",...I})]}),[U,Y]=ii(_),A=Je(x);pe(()=>{B&&(A==null||A())},[B,A]);const re=(M=P.arrow)==null?void 0:M.x,ge=(Q=P.arrow)==null?void 0:Q.y,fe=((le=P.arrow)==null?void 0:le.centerOffset)!==0,[me,ve]=i.useState();return pe(()=>{b&&ve(window.getComputedStyle(b).zIndex)},[b]),n.jsx("div",{ref:z.setFloating,"data-radix-popper-content-wrapper":"",style:{...G,transform:B?G.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:me,"--radix-popper-transform-origin":[(ee=P.transformOrigin)==null?void 0:ee.x,(Z=P.transformOrigin)==null?void 0:Z.y].join(" "),...((k=P.hide)==null?void 0:k.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:n.jsx(Xm,{scope:r,placedSide:U,onArrowChange:j,arrowX:re,arrowY:ge,shouldHideArrow:fe,children:n.jsx(X.div,{"data-side":U,"data-align":Y,...p,ref:w,style:{...p.style,animation:B?void 0:"none"}})})})});si.displayName=qr;var oi="PopperArrow",Jm={top:"bottom",right:"left",bottom:"top",left:"right"},ai=i.forwardRef(function(t,r){const{__scopePopper:s,...o}=t,a=Zm(oi,s),l=Jm[a.placedSide];return n.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:n.jsx(Gm,{...o,ref:r,style:{...o.style,display:"block"}})})});ai.displayName=oi;function Qm(e){return e!==null}var ep=e=>({name:"transformOrigin",options:e,fn(t){var g,b,y;const{placement:r,rects:s,middlewareData:o}=t,l=((g=o.arrow)==null?void 0:g.centerOffset)!==0,c=l?0:e.arrowWidth,u=l?0:e.arrowHeight,[f,d]=ii(r),m={start:"0%",center:"50%",end:"100%"}[d],h=(((b=o.arrow)==null?void 0:b.x)??0)+c/2,v=(((y=o.arrow)==null?void 0:y.y)??0)+u/2;let x="",p="";return f==="bottom"?(x=l?m:`${h}px`,p=`${-u}px`):f==="top"?(x=l?m:`${h}px`,p=`${s.floating.height+u}px`):f==="right"?(x=`${-u}px`,p=l?m:`${v}px`):f==="left"&&(x=`${s.floating.width+u}px`,p=l?m:`${v}px`),{data:{x,y:p}}}});function ii(e){const[t,r="center"]=e.split("-");return[t,r]}var tp=ti,np=ri,rp=si,sp=ai;function li(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 ci=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"}),op="VisuallyHidden",ap=i.forwardRef((e,t)=>n.jsx(X.span,{...e,ref:t,style:{...ci,...e.style}}));ap.displayName=op;var ip=[" ","Enter","ArrowUp","ArrowDown"],lp=[" ","Enter"],dt="Select",[Pn,Dn,cp]=Jo(dt),[Tt]=tt(dt,[cp,Qa]),In=Qa(),[dp,nt]=Tt(dt),[up,fp]=Tt(dt),di=e=>{const{__scopeSelect:t,children:r,open:s,defaultOpen:o,onOpenChange:a,value:l,defaultValue:c,onValueChange:u,dir:f,name:d,autoComplete:m,disabled:h,required:v,form:x}=e,p=In(t),[g,b]=i.useState(null),[y,w]=i.useState(null),[S,j]=i.useState(!1),E=Lr(f),[C,T]=wt({prop:s,defaultProp:o??!1,onChange:a,caller:dt}),[F,$]=wt({prop:l,defaultProp:c,onChange:u,caller:dt}),O=i.useRef(null),L=g?x||!!g.closest("form"):!0,[I,z]=i.useState(new Set),G=Array.from(I).map(_=>_.props.value).join(";");return n.jsx(tp,{...p,children:n.jsxs(dp,{required:v,scope:t,trigger:g,onTriggerChange:b,valueNode:y,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:j,contentId:Xe(),value:F,onValueChange:$,open:C,onOpenChange:T,dir:E,triggerPointerDownPosRef:O,disabled:h,children:[n.jsx(Pn.Provider,{scope:t,children:n.jsx(up,{scope:e.__scopeSelect,onNativeOptionAdd:i.useCallback(_=>{z(B=>new Set(B).add(_))},[]),onNativeOptionRemove:i.useCallback(_=>{z(B=>{const P=new Set(B);return P.delete(_),P})},[]),children:r})}),L?n.jsxs(Ii,{"aria-hidden":!0,required:v,tabIndex:-1,name:d,autoComplete:m,value:F,onChange:_=>$(_.target.value),disabled:h,form:x,children:[F===void 0?n.jsx("option",{value:""}):null,Array.from(I)]},G):null]})})};di.displayName=dt;var ui="SelectTrigger",fi=i.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:s=!1,...o}=e,a=In(r),l=nt(ui,r),c=l.disabled||s,u=ne(t,l.onTriggerChange),f=Dn(r),d=i.useRef("touch"),[m,h,v]=Oi(p=>{const g=f().filter(w=>!w.disabled),b=g.find(w=>w.value===l.value),y=Li(g,p,b);y!==void 0&&l.onValueChange(y.value)}),x=p=>{c||(l.onOpenChange(!0),v()),p&&(l.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return n.jsx(np,{asChild:!0,...a,children:n.jsx(X.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":Mi(l.value)?"":void 0,...o,ref:u,onClick:q(o.onClick,p=>{p.currentTarget.focus(),d.current!=="mouse"&&x(p)}),onPointerDown:q(o.onPointerDown,p=>{d.current=p.pointerType;const g=p.target;g.hasPointerCapture(p.pointerId)&&g.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(x(p),p.preventDefault())}),onKeyDown:q(o.onKeyDown,p=>{const g=m.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&h(p.key),!(g&&p.key===" ")&&ip.includes(p.key)&&(x(),p.preventDefault())})})})});fi.displayName=ui;var mi="SelectValue",pi=i.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:o,children:a,placeholder:l="",...c}=e,u=nt(mi,r),{onValueNodeHasChildrenChange:f}=u,d=a!==void 0,m=ne(t,u.onValueNodeChange);return pe(()=>{f(d)},[f,d]),n.jsx(X.span,{...c,ref:m,style:{pointerEvents:"none"},children:Mi(u.value)?n.jsx(n.Fragment,{children:l}):a})});pi.displayName=mi;var mp="SelectIcon",hi=i.forwardRef((e,t)=>{const{__scopeSelect:r,children:s,...o}=e;return n.jsx(X.span,{"aria-hidden":!0,...o,ref:t,children:s||"▼"})});hi.displayName=mp;var pp="SelectPortal",xi=e=>n.jsx(Er,{asChild:!0,...e});xi.displayName=pp;var ut="SelectContent",gi=i.forwardRef((e,t)=>{const r=nt(ut,e.__scopeSelect),[s,o]=i.useState();if(pe(()=>{o(new DocumentFragment)},[]),!r.open){const a=s;return a?wn.createPortal(n.jsx(vi,{scope:e.__scopeSelect,children:n.jsx(Pn.Slot,{scope:e.__scopeSelect,children:n.jsx("div",{children:e.children})})}),a):null}return n.jsx(bi,{...e,ref:t})});gi.displayName=ut;var ke=10,[vi,rt]=Tt(ut),hp="SelectContentImpl",xp=Wt("SelectContent.RemoveScroll"),bi=i.forwardRef((e,t)=>{const{__scopeSelect:r,position:s="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:a,onPointerDownOutside:l,side:c,sideOffset:u,align:f,alignOffset:d,arrowPadding:m,collisionBoundary:h,collisionPadding:v,sticky:x,hideWhenDetached:p,avoidCollisions:g,...b}=e,y=nt(ut,r),[w,S]=i.useState(null),[j,E]=i.useState(null),C=ne(t,M=>S(M)),[T,F]=i.useState(null),[$,O]=i.useState(null),L=Dn(r),[I,z]=i.useState(!1),G=i.useRef(!1);i.useEffect(()=>{if(w)return So(w)},[w]),ho();const _=i.useCallback(M=>{const[Q,...le]=L().map(k=>k.ref.current),[ee]=le.slice(-1),Z=document.activeElement;for(const k of M)if(k===Z||(k==null||k.scrollIntoView({block:"nearest"}),k===Q&&j&&(j.scrollTop=0),k===ee&&j&&(j.scrollTop=j.scrollHeight),k==null||k.focus(),document.activeElement!==Z))return},[L,j]),B=i.useCallback(()=>_([T,w]),[_,T,w]);i.useEffect(()=>{I&&B()},[I,B]);const{onOpenChange:P,triggerPointerDownPosRef:U}=y;i.useEffect(()=>{if(w){let M={x:0,y:0};const Q=ee=>{var Z,k;M={x:Math.abs(Math.round(ee.pageX)-(((Z=U.current)==null?void 0:Z.x)??0)),y:Math.abs(Math.round(ee.pageY)-(((k=U.current)==null?void 0:k.y)??0))}},le=ee=>{M.x<=10&&M.y<=10?ee.preventDefault():w.contains(ee.target)||P(!1),document.removeEventListener("pointermove",Q),U.current=null};return U.current!==null&&(document.addEventListener("pointermove",Q),document.addEventListener("pointerup",le,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Q),document.removeEventListener("pointerup",le,{capture:!0})}}},[w,P,U]),i.useEffect(()=>{const M=()=>P(!1);return window.addEventListener("blur",M),window.addEventListener("resize",M),()=>{window.removeEventListener("blur",M),window.removeEventListener("resize",M)}},[P]);const[Y,A]=Oi(M=>{const Q=L().filter(Z=>!Z.disabled),le=Q.find(Z=>Z.ref.current===document.activeElement),ee=Li(Q,M,le);ee&&setTimeout(()=>ee.ref.current.focus())}),re=i.useCallback((M,Q,le)=>{const ee=!G.current&&!le;(y.value!==void 0&&y.value===Q||ee)&&(F(M),ee&&(G.current=!0))},[y.value]),ge=i.useCallback(()=>w==null?void 0:w.focus(),[w]),fe=i.useCallback((M,Q,le)=>{const ee=!G.current&&!le;(y.value!==void 0&&y.value===Q||ee)&&O(M)},[y.value]),me=s==="popper"?dr:yi,ve=me===dr?{side:c,sideOffset:u,align:f,alignOffset:d,arrowPadding:m,collisionBoundary:h,collisionPadding:v,sticky:x,hideWhenDetached:p,avoidCollisions:g}:{};return n.jsx(vi,{scope:r,content:w,viewport:j,onViewportChange:E,itemRefCallback:re,selectedItem:T,onItemLeave:ge,itemTextRefCallback:fe,focusSelectedItem:B,selectedItemText:$,position:s,isPositioned:I,searchRef:Y,children:n.jsx(Ar,{as:xp,allowPinchZoom:!0,children:n.jsx(kr,{asChild:!0,trapped:y.open,onMountAutoFocus:M=>{M.preventDefault()},onUnmountAutoFocus:q(o,M=>{var Q;(Q=y.trigger)==null||Q.focus({preventScroll:!0}),M.preventDefault()}),children:n.jsx(Cr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:M=>M.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:n.jsx(me,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:M=>M.preventDefault(),...b,...ve,onPlaced:()=>z(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:q(b.onKeyDown,M=>{const Q=M.ctrlKey||M.altKey||M.metaKey;if(M.key==="Tab"&&M.preventDefault(),!Q&&M.key.length===1&&A(M.key),["ArrowUp","ArrowDown","Home","End"].includes(M.key)){let ee=L().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);if(["ArrowUp","End"].includes(M.key)&&(ee=ee.slice().reverse()),["ArrowUp","ArrowDown"].includes(M.key)){const Z=M.target,k=ee.indexOf(Z);ee=ee.slice(k+1)}setTimeout(()=>_(ee)),M.preventDefault()}})})})})})})});bi.displayName=hp;var gp="SelectItemAlignedPosition",yi=i.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:s,...o}=e,a=nt(ut,r),l=rt(ut,r),[c,u]=i.useState(null),[f,d]=i.useState(null),m=ne(t,C=>d(C)),h=Dn(r),v=i.useRef(!1),x=i.useRef(!0),{viewport:p,selectedItem:g,selectedItemText:b,focusSelectedItem:y}=l,w=i.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&f&&p&&g&&b){const C=a.trigger.getBoundingClientRect(),T=f.getBoundingClientRect(),F=a.valueNode.getBoundingClientRect(),$=b.getBoundingClientRect();if(a.dir!=="rtl"){const Z=$.left-T.left,k=F.left-Z,K=C.left-k,ae=C.width+K,he=Math.max(ae,T.width),xe=window.innerWidth-ke,st=_s(k,[ke,Math.max(ke,xe-he)]);c.style.minWidth=ae+"px",c.style.left=st+"px"}else{const Z=T.right-$.right,k=window.innerWidth-F.right-Z,K=window.innerWidth-C.right-k,ae=C.width+K,he=Math.max(ae,T.width),xe=window.innerWidth-ke,st=_s(k,[ke,Math.max(ke,xe-he)]);c.style.minWidth=ae+"px",c.style.right=st+"px"}const O=h(),L=window.innerHeight-ke*2,I=p.scrollHeight,z=window.getComputedStyle(f),G=parseInt(z.borderTopWidth,10),_=parseInt(z.paddingTop,10),B=parseInt(z.borderBottomWidth,10),P=parseInt(z.paddingBottom,10),U=G+_+I+P+B,Y=Math.min(g.offsetHeight*5,U),A=window.getComputedStyle(p),re=parseInt(A.paddingTop,10),ge=parseInt(A.paddingBottom,10),fe=C.top+C.height/2-ke,me=L-fe,ve=g.offsetHeight/2,M=g.offsetTop+ve,Q=G+_+M,le=U-Q;if(Q<=fe){const Z=O.length>0&&g===O[O.length-1].ref.current;c.style.bottom="0px";const k=f.clientHeight-p.offsetTop-p.offsetHeight,K=Math.max(me,ve+(Z?ge:0)+k+B),ae=Q+K;c.style.height=ae+"px"}else{const Z=O.length>0&&g===O[0].ref.current;c.style.top="0px";const K=Math.max(fe,G+p.offsetTop+(Z?re:0)+ve)+le;c.style.height=K+"px",p.scrollTop=Q-fe+p.offsetTop}c.style.margin=`${ke}px 0`,c.style.minHeight=Y+"px",c.style.maxHeight=L+"px",s==null||s(),requestAnimationFrame(()=>v.current=!0)}},[h,a.trigger,a.valueNode,c,f,p,g,b,a.dir,s]);pe(()=>w(),[w]);const[S,j]=i.useState();pe(()=>{f&&j(window.getComputedStyle(f).zIndex)},[f]);const E=i.useCallback(C=>{C&&x.current===!0&&(w(),y==null||y(),x.current=!1)},[w,y]);return n.jsx(bp,{scope:r,contentWrapper:c,shouldExpandOnScrollRef:v,onScrollButtonChange:E,children:n.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:n.jsx(X.div,{...o,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});yi.displayName=gp;var vp="SelectPopperPosition",dr=i.forwardRef((e,t)=>{const{__scopeSelect:r,align:s="start",collisionPadding:o=ke,...a}=e,l=In(r);return n.jsx(rp,{...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)"}})});dr.displayName=vp;var[bp,Gr]=Tt(ut,{}),ur="SelectViewport",wi=i.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:s,...o}=e,a=rt(ur,r),l=Gr(ur,r),c=ne(t,a.onViewportChange),u=i.useRef(0);return n.jsxs(n.Fragment,{children:[n.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}),n.jsx(Pn.Slot,{scope:r,children:n.jsx(X.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:q(o.onScroll,f=>{const d=f.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:h}=l;if(h!=null&&h.current&&m){const v=Math.abs(u.current-d.scrollTop);if(v>0){const x=window.innerHeight-ke*2,p=parseFloat(m.style.minHeight),g=parseFloat(m.style.height),b=Math.max(p,g);if(b<x){const y=b+v,w=Math.min(x,y),S=y-w;m.style.height=w+"px",m.style.bottom==="0px"&&(d.scrollTop=S>0?S:0,m.style.justifyContent="flex-end")}}}u.current=d.scrollTop})})})]})});wi.displayName=ur;var Ni="SelectGroup",[yp,wp]=Tt(Ni),Np=i.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,o=Xe();return n.jsx(yp,{scope:r,id:o,children:n.jsx(X.div,{role:"group","aria-labelledby":o,...s,ref:t})})});Np.displayName=Ni;var ji="SelectLabel",Si=i.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,o=wp(ji,r);return n.jsx(X.div,{id:o.id,...s,ref:t})});Si.displayName=ji;var bn="SelectItem",[jp,Ci]=Tt(bn),ki=i.forwardRef((e,t)=>{const{__scopeSelect:r,value:s,disabled:o=!1,textValue:a,...l}=e,c=nt(bn,r),u=rt(bn,r),f=c.value===s,[d,m]=i.useState(a??""),[h,v]=i.useState(!1),x=ne(t,y=>{var w;return(w=u.itemRefCallback)==null?void 0:w.call(u,y,s,o)}),p=Xe(),g=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 n.jsx(jp,{scope:r,value:s,disabled:o,textId:p,isSelected:f,onItemTextChange:i.useCallback(y=>{m(w=>w||((y==null?void 0:y.textContent)??"").trim())},[]),children:n.jsx(Pn.ItemSlot,{scope:r,value:s,disabled:o,textValue:d,children:n.jsx(X.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:x,onFocus:q(l.onFocus,()=>v(!0)),onBlur:q(l.onBlur,()=>v(!1)),onClick:q(l.onClick,()=>{g.current!=="mouse"&&b()}),onPointerUp:q(l.onPointerUp,()=>{g.current==="mouse"&&b()}),onPointerDown:q(l.onPointerDown,y=>{g.current=y.pointerType}),onPointerMove:q(l.onPointerMove,y=>{var w;g.current=y.pointerType,o?(w=u.onItemLeave)==null||w.call(u):g.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:q(l.onPointerLeave,y=>{var w;y.currentTarget===document.activeElement&&((w=u.onItemLeave)==null||w.call(u))}),onKeyDown:q(l.onKeyDown,y=>{var S;((S=u.searchRef)==null?void 0:S.current)!==""&&y.key===" "||(lp.includes(y.key)&&b(),y.key===" "&&y.preventDefault())})})})})});ki.displayName=bn;var Pt="SelectItemText",Ei=i.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:o,...a}=e,l=nt(Pt,r),c=rt(Pt,r),u=Ci(Pt,r),f=fp(Pt,r),[d,m]=i.useState(null),h=ne(t,b=>m(b),u.onItemTextChange,b=>{var y;return(y=c.itemTextRefCallback)==null?void 0:y.call(c,b,u.value,u.disabled)}),v=d==null?void 0:d.textContent,x=i.useMemo(()=>n.jsx("option",{value:u.value,disabled:u.disabled,children:v},u.value),[u.disabled,u.value,v]),{onNativeOptionAdd:p,onNativeOptionRemove:g}=f;return pe(()=>(p(x),()=>g(x)),[p,g,x]),n.jsxs(n.Fragment,{children:[n.jsx(X.span,{id:u.textId,...a,ref:h}),u.isSelected&&l.valueNode&&!l.valueNodeHasChildren?wn.createPortal(a.children,l.valueNode):null]})});Ei.displayName=Pt;var Ai="SelectItemIndicator",Ti=i.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return Ci(Ai,r).isSelected?n.jsx(X.span,{"aria-hidden":!0,...s,ref:t}):null});Ti.displayName=Ai;var fr="SelectScrollUpButton",Ri=i.forwardRef((e,t)=>{const r=rt(fr,e.__scopeSelect),s=Gr(fr,e.__scopeSelect),[o,a]=i.useState(!1),l=ne(t,s.onScrollButtonChange);return pe(()=>{if(r.viewport&&r.isPositioned){let c=function(){const f=u.scrollTop>0;a(f)};const u=r.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[r.viewport,r.isPositioned]),o?n.jsx(Pi,{...e,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=r;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});Ri.displayName=fr;var mr="SelectScrollDownButton",_i=i.forwardRef((e,t)=>{const r=rt(mr,e.__scopeSelect),s=Gr(mr,e.__scopeSelect),[o,a]=i.useState(!1),l=ne(t,s.onScrollButtonChange);return pe(()=>{if(r.viewport&&r.isPositioned){let c=function(){const f=u.scrollHeight-u.clientHeight,d=Math.ceil(u.scrollTop)<f;a(d)};const u=r.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[r.viewport,r.isPositioned]),o?n.jsx(Pi,{...e,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=r;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});_i.displayName=mr;var Pi=i.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:s,...o}=e,a=rt("SelectScrollButton",r),l=i.useRef(null),c=Dn(r),u=i.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return i.useEffect(()=>()=>u(),[u]),pe(()=>{var d;const f=c().find(m=>m.ref.current===document.activeElement);(d=f==null?void 0:f.ref.current)==null||d.scrollIntoView({block:"nearest"})},[c]),n.jsx(X.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:q(o.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(s,50))}),onPointerMove:q(o.onPointerMove,()=>{var f;(f=a.onItemLeave)==null||f.call(a),l.current===null&&(l.current=window.setInterval(s,50))}),onPointerLeave:q(o.onPointerLeave,()=>{u()})})}),Sp="SelectSeparator",Di=i.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return n.jsx(X.div,{"aria-hidden":!0,...s,ref:t})});Di.displayName=Sp;var pr="SelectArrow",Cp=i.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,o=In(r),a=nt(pr,r),l=rt(pr,r);return a.open&&l.position==="popper"?n.jsx(sp,{...o,...s,ref:t}):null});Cp.displayName=pr;var kp="SelectBubbleInput",Ii=i.forwardRef(({__scopeSelect:e,value:t,...r},s)=>{const o=i.useRef(null),a=ne(s,o),l=li(t);return i.useEffect(()=>{const c=o.current;if(!c)return;const u=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(u,"value").set;if(l!==t&&d){const m=new Event("change",{bubbles:!0});d.call(c,t),c.dispatchEvent(m)}},[l,t]),n.jsx(X.select,{...r,style:{...ci,...r.style},ref:a,defaultValue:t})});Ii.displayName=kp;function Mi(e){return e===""||e===void 0}function Oi(e){const t=Je(e),r=i.useRef(""),s=i.useRef(0),o=i.useCallback(l=>{const c=r.current+l;t(c),(function u(f){r.current=f,window.clearTimeout(s.current),f!==""&&(s.current=window.setTimeout(()=>u(""),1e3))})(c)},[t]),a=i.useCallback(()=>{r.current="",window.clearTimeout(s.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(s.current),[]),[r,o,a]}function Li(e,t,r){const o=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let l=Ep(e,Math.max(a,0));o.length===1&&(l=l.filter(f=>f!==r));const u=l.find(f=>f.textValue.toLowerCase().startsWith(o.toLowerCase()));return u!==r?u:void 0}function Ep(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var Ap=di,$i=fi,Tp=pi,Rp=hi,_p=xi,Fi=gi,Pp=wi,Bi=Si,Vi=ki,Dp=Ei,Ip=Ti,Wi=Ri,zi=_i,Ui=Di;const je=Ap,Se=Tp,be=i.forwardRef(({className:e,children:t,...r},s)=>n.jsxs($i,{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),...r,children:[t,n.jsx(Rp,{asChild:!0,children:n.jsx(St,{className:"h-4 w-4 opacity-50"})})]}));be.displayName=$i.displayName;const Hi=i.forwardRef(({className:e,...t},r)=>n.jsx(Wi,{ref:r,className:W("flex cursor-default items-center justify-center py-1",e),...t,children:n.jsx(Qs,{className:"h-4 w-4"})}));Hi.displayName=Wi.displayName;const Ki=i.forwardRef(({className:e,...t},r)=>n.jsx(zi,{ref:r,className:W("flex cursor-default items-center justify-center py-1",e),...t,children:n.jsx(St,{className:"h-4 w-4"})}));Ki.displayName=zi.displayName;const ye=i.forwardRef(({className:e,children:t,position:r="popper",...s},o)=>n.jsx(_p,{children:n.jsxs(Fi,{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",r==="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:r,...s,children:[n.jsx(Hi,{}),n.jsx(Pp,{className:W("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),n.jsx(Ki,{})]})}));ye.displayName=Fi.displayName;const Mp=i.forwardRef(({className:e,...t},r)=>n.jsx(Bi,{ref:r,className:W("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Mp.displayName=Bi.displayName;const oe=i.forwardRef(({className:e,children:t,...r},s)=>n.jsxs(Vi,{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),...r,children:[n.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:n.jsx(Ip,{children:n.jsx(br,{className:"h-4 w-4"})})}),n.jsx(Dp,{children:t})]}));oe.displayName=Vi.displayName;const Op=i.forwardRef(({className:e,...t},r)=>n.jsx(Ui,{ref:r,className:W("-mx-1 my-1 h-px bg-muted",e),...t}));Op.displayName=Ui.displayName;const qi=[{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"}],Lp=new Set(qi.filter(e=>e.supportsFollowUp).map(e=>e.value));function zs(){return qi.map(e=>n.jsx(oe,{value:e.value,disabled:e.disabled,children:n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx("span",{children:e.label}),e.description&&n.jsx("span",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:e.description})]})},e.value))}function Us(e,t,r=!1){const s=e.trim();if(s)return s;const o=t.trim().split(`
|
|
200
|
-
`).map(a=>a.trim()).find(Boolean);return o?o.length>72?`${o.slice(0,69).trimEnd()}...`:o:r?"Image task":""}function $p({nodes:e,onCreated:t,onCancel:r,className:s,footerClassName:o,submitLabel:a="Create chat",cancelLabel:l="Cancel",autoFocus:c=!1,layout:u="default"}){const[f,d]=i.useState(""),[m,h]=i.useState(""),[v,x]=i.useState("claudecode"),[p,g]=i.useState(""),[b,y]=i.useState("select"),[w,S]=i.useState("normal"),[j,E]=i.useState("auto"),[C,T]=i.useState(!1),[F,$]=i.useState(!1),{images:O,error:L,fileInputRef:I,pickImages:z,handleFileChange:G,handlePaste:_,removeImage:B}=Zo(),P=i.useMemo(()=>e.filter(k=>k.status==="online"),[e]),U=i.useMemo(()=>{if(j!=="auto"){const K=e.find(ae=>ae.id===j);return(K==null?void 0:K.workDirFolders)??[]}const k=new Set;for(const K of P)for(const ae of K.workDirFolders??[])k.add(ae);return[...k].sort()},[j,e,P]),Y=i.useCallback(async k=>{k.preventDefault();const K=Us(f,m,O.length>0),ae=m.trim()||K;if(!(!K||!ae||!v)){T(!0);try{const he=jr(m,O),xe=await Wl({title:K,description:ae,agent:v,project:p.trim()||null,payload:{initialMessage:he},priority:w,assignTo:j==="auto"?void 0:j});t(xe)}catch(he){ue.error(he instanceof Error?he.message:"Failed to create task")}finally{T(!1)}}},[f,m,v,p,O,w,j,t]),A=Us(f,m,O.length>0),re=!!(A&&v&&(m.trim()||O.length>0)),ge=i.useCallback(k=>{var K;k.nativeEvent.isComposing||k.key==="Enter"&&k.shiftKey&&re&&!C&&(k.preventDefault(),(K=k.currentTarget.form)==null||K.requestSubmit())},[re,C]),fe=p||"__none__",me=U.length>0,ve=O.length>0&&n.jsx("div",{className:"flex flex-wrap gap-3",children:O.map((k,K)=>n.jsxs("div",{className:"relative",children:[n.jsx("img",{src:Sr(k),alt:k.filename??`attachment ${K+1}`,className:"h-24 w-24 rounded-2xl border border-border/70 object-cover"}),n.jsx("button",{type:"button",onClick:()=>B(K),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 ${k.filename??`image ${K+1}`}`,children:n.jsx(wr,{className:"h-3.5 w-3.5"})})]},`${k.filename??"image"}-${K}`))}),M=n.jsxs("div",{className:"space-y-2",children:[n.jsx(Ee,{className:"text-sm font-medium",children:"Assign to"}),n.jsxs(je,{value:j,onValueChange:E,children:[n.jsx(be,{className:"h-11 rounded-2xl border-border/70 bg-background/70",children:n.jsx(Se,{placeholder:"Auto-assign"})}),n.jsxs(ye,{children:[n.jsx(oe,{value:"auto",children:"Auto-assign"}),P.map(k=>n.jsx(oe,{value:k.id,children:k.name},k.id))]})]})]}),Q=n.jsxs("div",{className:"space-y-2",children:[n.jsx(Ee,{className:"text-sm font-medium",children:"Agent"}),n.jsxs(je,{value:v,onValueChange:x,children:[n.jsx(be,{className:"h-11 rounded-2xl border-border/70 bg-background/70",children:n.jsx(Se,{placeholder:"Select agent"})}),n.jsx(ye,{children:zs()})]})]}),le=n.jsxs("div",{className:"space-y-2",children:[n.jsx(Ee,{className:"text-sm font-medium",children:"Priority"}),n.jsxs(je,{value:w,onValueChange:S,children:[n.jsx(be,{className:"h-11 rounded-2xl border-border/70 bg-background/70",children:n.jsx(Se,{placeholder:"Select priority"})}),n.jsxs(ye,{children:[n.jsx(oe,{value:"low",children:"Low"}),n.jsx(oe,{value:"normal",children:"Normal"}),n.jsx(oe,{value:"high",children:"High"}),n.jsx(oe,{value:"critical",children:"Critical"})]})]})]}),ee=n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:"Chat title"}),n.jsx(Me,{id:"task-title-composer",type:"text",value:f,onChange:k=>d(k.target.value),placeholder:"Optional. Leave blank to derive it from the prompt.",className:"h-10 rounded-2xl border-border/70 bg-background/60 px-3.5 shadow-none"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:A?`Will appear as: ${A}`:"A title will be generated from the first line of the prompt."})]}),Z=n.jsxs("div",{className:"space-y-2",children:[n.jsx(Ee,{className:"text-sm font-medium",children:"Working directory"}),b==="select"&&me?n.jsxs(je,{value:fe,onValueChange:k=>{if(k==="__custom__"){y("custom"),g("");return}g(k==="__none__"?"":k)},children:[n.jsx(be,{className:"h-11 rounded-2xl border-border/70 bg-background/70",children:n.jsx(Se,{placeholder:"Select folder or use the node default"})}),n.jsxs(ye,{children:[n.jsx(oe,{value:"__none__",children:"Use node default"}),U.map(k=>n.jsx(oe,{value:k,children:k},k)),n.jsx(oe,{value:"__custom__",children:"Custom path..."})]})]}):n.jsxs("div",{className:"flex gap-2",children:[n.jsx(Me,{id:"task-project",type:"text",value:p,onChange:k=>g(k.target.value),placeholder:"Optional path (absolute or relative to node work dir)",className:"h-11 flex-1 rounded-2xl border-border/70 bg-background/70"}),me&&n.jsx(H,{type:"button",variant:"outline",onClick:()=>{y("select"),g("")},className:"h-11 rounded-2xl",children:"Browse"})]})]});return u==="composer"?n.jsxs("form",{onSubmit:Y,className:W("space-y-4",s),children:[n.jsx("input",{ref:I,type:"file",accept:"image/*",multiple:!0,onChange:G,className:"hidden"}),n.jsxs("div",{className:"relative rounded-[24px] border border-border/60 bg-background/45 shadow-[0_20px_80px_-40px_rgba(0,0,0,0.6)]",children:[n.jsx("textarea",{id:"task-description",value:m,onChange:k=>h(k.target.value),onKeyDown:ge,onPaste:_,placeholder:"Ask anything...",rows:4,autoFocus:c,"aria-label":"Opening prompt",className:"min-h-[140px] w-full resize-none rounded-[24px] bg-transparent px-5 pt-5 pb-16 text-[15px] leading-7 text-foreground ring-offset-background placeholder:text-muted-foreground/70 focus-visible:outline-none"}),n.jsxs("div",{className:"absolute bottom-4 left-4 right-4 flex flex-wrap items-end justify-between gap-3",children:[n.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[n.jsxs(H,{type:"button",variant:"ghost",size:"sm",onClick:z,className:"h-9 gap-1.5 rounded-full px-3 text-xs text-muted-foreground hover:text-foreground",children:[n.jsx(er,{className:"h-3.5 w-3.5"}),"Images"]}),n.jsxs(je,{value:j,onValueChange:E,children:[n.jsx(be,{className:"h-9 w-auto gap-1.5 rounded-full border-border/70 bg-background/55 px-3.5 text-xs shadow-none",children:n.jsx(Se,{placeholder:"Auto-assign"})}),n.jsxs(ye,{children:[n.jsx(oe,{value:"auto",children:"Auto-assign"}),P.map(k=>n.jsx(oe,{value:k.id,children:k.name},k.id))]})]}),n.jsxs(je,{value:v,onValueChange:x,children:[n.jsx(be,{className:"h-9 w-auto gap-1.5 rounded-full border-border/70 bg-background/55 px-3.5 text-xs shadow-none",children:n.jsx(Se,{placeholder:"Agent"})}),n.jsx(ye,{children:zs()})]}),n.jsxs(H,{type:"button",variant:"ghost",size:"sm",onClick:()=>$(!F),"aria-controls":"task-composer-settings","aria-expanded":F,className:"h-9 gap-1.5 rounded-full px-3 text-xs text-muted-foreground hover:text-foreground",children:[n.jsx($c,{className:"h-3.5 w-3.5"}),F?n.jsx(Qs,{className:"h-3 w-3"}):n.jsx(St,{className:"h-3 w-3"})]})]}),n.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r&&n.jsx(H,{type:"button",variant:"ghost",size:"sm",onClick:r,className:"h-9 rounded-full px-4 text-xs text-muted-foreground",children:l}),n.jsxs(H,{type:"submit",size:"icon",disabled:!re||C,className:"h-10 w-10 rounded-full shadow-[0_8px_30px_-8px_hsl(var(--primary)/0.6)]",children:[C?n.jsx(Fe,{className:"h-4 w-4 animate-spin"}):n.jsx(ao,{className:"h-4 w-4"}),n.jsx("span",{className:"sr-only",children:C?"Creating chat":a})]})]})]})]}),(ve||L)&&n.jsxs("div",{className:"space-y-3 rounded-[20px] border border-border/60 bg-background/45 p-4",children:[ve,L&&n.jsx("div",{className:"text-xs text-destructive",children:L}),!L&&n.jsx("div",{className:"text-xs text-muted-foreground",children:"Shift+Enter starts the chat. Enter adds a new line. Paste screenshots directly into the prompt box or use the Images button."})]}),F&&n.jsxs("div",{id:"task-composer-settings",className:"grid gap-4 rounded-[20px] border border-border/60 bg-background/45 p-5 sm:grid-cols-2",children:[n.jsx("div",{className:"space-y-2 sm:col-span-2",children:ee}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:[n.jsx(jc,{className:"h-3.5 w-3.5"}),"Working directory"]}),b==="select"&&me?n.jsxs(je,{value:fe,onValueChange:k=>{if(k==="__custom__"){y("custom"),g("");return}g(k==="__none__"?"":k)},children:[n.jsx(be,{className:"h-10 rounded-2xl border-border/70 bg-background/60 px-3.5 text-sm shadow-none",children:n.jsx(Se,{placeholder:"Use node default"})}),n.jsxs(ye,{children:[n.jsx(oe,{value:"__none__",children:"Use node default"}),U.map(k=>n.jsx(oe,{value:k,children:k},k)),n.jsx(oe,{value:"__custom__",children:"Custom path..."})]})]}):n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Me,{id:"task-project",type:"text",value:p,onChange:k=>g(k.target.value),placeholder:"Optional path",className:"h-10 rounded-2xl border-border/70 bg-background/60 px-3.5 shadow-none"}),me&&n.jsx(H,{type:"button",variant:"ghost",size:"sm",onClick:()=>{y("select"),g("")},className:"h-9 shrink-0 rounded-2xl px-3",children:"Browse"})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:"Priority"}),n.jsxs(je,{value:w,onValueChange:S,children:[n.jsx(be,{className:"h-10 rounded-2xl border-border/70 bg-background/60 px-3.5 text-sm shadow-none",children:n.jsx(Se,{placeholder:"Select priority"})}),n.jsxs(ye,{children:[n.jsx(oe,{value:"low",children:"Low"}),n.jsx(oe,{value:"normal",children:"Normal"}),n.jsx(oe,{value:"high",children:"High"}),n.jsx(oe,{value:"critical",children:"Critical"})]})]})]})]})]}):n.jsxs("form",{onSubmit:Y,className:W("space-y-5",s),children:[n.jsx("input",{ref:I,type:"file",accept:"image/*",multiple:!0,onChange:G,className:"hidden"}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(Ee,{htmlFor:"task-description",className:"text-sm font-medium",children:"Opening prompt"}),n.jsx("textarea",{id:"task-description",value:m,onChange:k=>h(k.target.value),onKeyDown:ge,onPaste:_,placeholder:"Describe what the agent should do. This becomes the first message in the chat.",rows:6,autoFocus:c,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"}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[n.jsxs(H,{type:"button",variant:"outline",onClick:z,className:"rounded-2xl",children:[n.jsx(er,{className:"h-4 w-4"}),"Add images"]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Shift+Enter starts the chat. Enter adds a new line. Upload or paste screenshots and reference images with the opening prompt."})]}),ve,L&&n.jsx("p",{className:"text-xs text-destructive",children:L})]}),n.jsxs("div",{className:"grid gap-5 lg:grid-cols-[minmax(0,1fr)_220px]",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(Ee,{htmlFor:"task-title",className:"text-sm font-medium",children:"Chat title"}),n.jsx(Me,{id:"task-title",type:"text",value:f,onChange:k=>d(k.target.value),placeholder:"Optional. Leave blank to derive it from the prompt.",className:"h-11 rounded-2xl border-border/70 bg-background/70"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:A?`Will appear as: ${A}`:"A title will be generated from the first line of the prompt."})]}),Q]}),Z,n.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[le,M]}),n.jsxs("div",{className:W("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",o),children:[r&&n.jsx(H,{type:"button",variant:"ghost",onClick:r,className:"rounded-2xl",children:l}),n.jsx(H,{type:"submit",disabled:!re||C,className:"rounded-2xl px-5",children:C?"Creating...":a})]})]})}const Fp=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"archived",label:"Archived"}],yn=new Set(["pending","assigned"]),Gi=new Set(["running"]),Bp=new Set(["completed","failed","cancelled"]),Vp=new Set(["completed","failed","cancelled"]);function Wp(e,t){switch(t){case"running":return Gi.has(e.status);case"waiting":return yn.has(e.status);case"closed":return Bp.has(e.status);case"archived":return e.status==="archived";case"active":default:return e.status!=="archived"}}function zp(e,t){const r=t.trim().toLowerCase();return r?[e.title,e.description,e.id,e.agent,e.assignedTo??"",e.assignedNodeName??"",e.project??"",e.effectiveProjectPath??""].some(s=>s.toLowerCase().includes(r)):!0}function Yr(e,t,r){if(!e)return"unassigned";const s=t==null?void 0:t.find(o=>o.id===e);return(s==null?void 0:s.name)??r??e.slice(0,8)}function Up(e,t,r){return Yr(e,t,r).toLowerCase()}function Hp(e,t){return[...e].sort((r,s)=>r.id===t?-1:s.id===t?1:r.name.localeCompare(s.name))}function Kp(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 qp(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 Gp(e){return e==="default workspace"?e:e.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??e}function Yp(e){if(e==="default workspace")return"Uses the node default workspace";const t=e.replace(/\\/g,"/"),r=t.split("/").filter(Boolean);return r.length<=3?t:`.../${r.slice(-3).join("/")}`}function Xp(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 Zp(e){return new Date(e).toLocaleString()}function Jp(e){const t=Math.floor(e/1e3),r=Math.floor(t/3600),s=Math.floor(t%3600/60),o=t%60;return`${String(r).padStart(2,"0")}:${String(s).padStart(2,"0")}:${String(o).padStart(2,"0")}`}async function jt(e,t="Copied to clipboard"){var r,s,o;try{if((s=(r=globalThis.navigator)==null?void 0:r.clipboard)!=null&&s.writeText)return await globalThis.navigator.clipboard.writeText(e),ue.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"),u=a.activeElement,f=u&&typeof u.focus=="function"?u: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 d=l("copy");if(a.body.removeChild(c),f==null||f.focus(),!d)throw new Error("Clipboard access is unavailable");return ue.success(t),!0}catch(a){return ue.error(a instanceof Error?a.message:"Failed to copy"),!1}}function gt({label:e,value:t}){return n.jsxs("div",{className:"min-w-[7.25rem] flex-1 rounded-[20px] border border-border/60 bg-background/45 px-3 py-3",children:[n.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:e}),n.jsx("div",{className:"mt-1 text-lg font-semibold tracking-tight text-foreground",children:t})]})}function Jn({label:e}){return n.jsx("div",{className:"flex h-64 items-center justify-center text-sm text-muted-foreground",children:e})}function Ae({label:e,value:t,mono:r,action:s}){return n.jsxs("div",{className:"grid grid-cols-[5.25rem,minmax(0,1fr)] items-start gap-3",children:[n.jsx("span",{className:"pt-0.5 text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:e}),n.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[n.jsx("span",{className:W("min-w-0 flex-1 break-all text-sm text-foreground",r&&"font-mono text-[11px] leading-5"),children:t}),s]})]})}function hr({label:e,value:t,mono:r}){return n.jsxs("div",{className:"rounded-[18px] border border-border/60 bg-background/60 px-3 py-3",children:[n.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:e}),n.jsx("div",{className:W("mt-1 text-sm font-medium text-foreground",r&&"font-mono text-[11px]"),children:t})]})}function Yi({capabilities:e,action:t}){return n.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4",children:[n.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[n.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:"Capabilities"}),n.jsx("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:e.length>0?e.map(r=>n.jsx(Te,{variant:"secondary",className:"rounded-full",children:r},r)):n.jsx("span",{className:"text-sm text-muted-foreground",children:"None declared"})})]}),t&&n.jsx("div",{className:"shrink-0 self-start",children:t})]})}const Qp=i.lazy(async()=>({default:(await gr(()=>import("./FilesTab-BA_AQGff.js"),__vite__mapDeps([0,1,2,3]))).FilesTab})),eh=i.lazy(async()=>({default:(await gr(()=>import("./PreviewTab-F2z-8pM5.js"),__vite__mapDeps([4,1,2]))).PreviewTab})),th=i.lazy(async()=>({default:(await gr(()=>import("./DiffTab-BnEEacma.js"),__vite__mapDeps([5,1,2,3]))).DiffTab}));function nh({onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:r,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l,activeTab:c,setActiveTab:u,creatingTask:f,activeTask:d,assignedNode:m,taskLoading:h,taskError:v,displayEvents:x,hasUserMessageInLogs:p,initialPrompt:g,supportsFollowUp:b,chatDisabled:y,questionBypassEnabled:w,isRunning:S,hasPendingFollowUp:j,canCancel:E,canRetry:C,onRetry:T,onCancel:F,onStartCreateTask:$,onCancelCreateTask:O,onCreateTask:L,onSendMessage:I,onQuestionBypassChange:z,onSubmitQuestionResponse:G,messagesEndRef:_}){const B=(d==null?void 0:d.effectiveProjectPath)??(d==null?void 0:d.project)??"default workspace",P=d?(m==null?void 0:m.name)??Yr(d.assignedTo,a==null?void 0:a.nodes,d.assignedNodeName):"unassigned",U=d?[{label:"Working dir",value:B,mono:!0},{label:"Agent",value:d.agent,mono:!0},{label:"Node",value:P}]:[],Y=d!=null&&d.description&&d.description!==d.title?d.description:null;return f?n.jsx(rh,{onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:r,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l,onCancel:O,onCreated:L}):!d&&h?n.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden rounded-[32px] border border-border/60 bg-background/78 shadow-[0_30px_120px_-60px_rgba(0,0,0,0.88)] backdrop-blur-xl",children:[n.jsx("div",{className:"shrink-0 border-b border-border/60 px-4 py-4 sm:px-5",children:n.jsx(un,{onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:r,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l})}),n.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center overflow-y-auto px-6 py-10 sm:px-8",children:n.jsxs("div",{className:"space-y-4 text-center",children:[n.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:n.jsx(Fe,{className:"h-7 w-7 animate-spin"})}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-foreground",children:"Loading conversation"}),n.jsxs("div",{className:"flex items-center justify-center gap-3 text-sm text-muted-foreground",children:[n.jsx(Fe,{className:"h-4 w-4 animate-spin"}),"Fetching the selected chat thread..."]})]})]})})]}):d?n.jsxs(va,{value:c,onValueChange:u,className:"flex h-full min-h-0 flex-col overflow-hidden rounded-[32px] border border-border/60 bg-background/78 shadow-[0_30px_120px_-60px_rgba(0,0,0,0.88)] backdrop-blur-xl",children:[n.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-4 sm:px-5",children:[n.jsx("div",{className:"flex items-center justify-between gap-3 border-b border-border/60 pb-4",children:n.jsx(un,{onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:r,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l})}),n.jsxs("div",{className:"flex flex-col gap-4 xl:flex-row xl:items-start xl:justify-between",children:[n.jsxs("div",{className:"min-w-0 space-y-3",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("h2",{className:"truncate text-2xl font-semibold tracking-tight text-foreground",children:d.title}),n.jsx(Xs,{status:d.status}),n.jsx(zl,{priority:d.priority})]}),Y&&n.jsx("p",{className:"max-w-3xl text-sm leading-6 text-muted-foreground",children:Y}),v&&n.jsx("div",{className:"w-fit rounded-full border border-destructive/25 bg-destructive/10 px-3 py-1 text-xs text-destructive",children:v})]}),n.jsxs("div",{className:"flex flex-col gap-3 xl:min-w-[14rem] xl:items-end",children:[n.jsxs("div",{className:"flex max-w-full flex-nowrap items-center gap-2 overflow-x-auto pt-2 pb-1 xl:justify-end",children:[C&&n.jsxs(H,{variant:"outline",size:"sm",onClick:T,className:"shrink-0 rounded-full",children:[n.jsx(Ic,{className:"h-3.5 w-3.5"}),"Retry"]}),E&&n.jsxs(ln,{children:[n.jsx(cn,{asChild:!0,children:n.jsxs(H,{variant:"destructive",size:"sm",className:"shrink-0 rounded-full",children:[n.jsx(eo,{className:"h-3.5 w-3.5"}),"Cancel"]})}),n.jsxs(It,{children:[n.jsxs(Mt,{children:[n.jsx(Lt,{children:"Cancel this task?"}),n.jsx($t,{children:"The task will stop and move to a cancelled state."})]}),n.jsxs(Ot,{children:[n.jsx(Bt,{children:"No"}),n.jsx(Ft,{onClick:F,children:"Yes, cancel"})]})]})]})]}),n.jsxs("div",{className:"flex flex-col text-xs text-muted-foreground xl:items-end",children:[n.jsxs("span",{children:["updated ",Zp(d.updatedAt)]}),n.jsx("span",{className:"font-mono",children:d.id.slice(0,8)})]})]})]}),n.jsx("div",{className:"mt-3 flex flex-col gap-3 xl:flex-row xl:items-center xl:justify-between",children:n.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[n.jsxs(Fr,{className:"h-auto rounded-full bg-muted/70 p-1",children:[n.jsx(Ge,{value:"transcript",className:"rounded-full px-4",children:"Transcript"}),n.jsx(Ge,{value:"files",className:"rounded-full px-4",children:"Files"}),n.jsx(Ge,{value:"preview",className:"rounded-full px-4",children:"Preview"}),n.jsx(Ge,{value:"diff",className:"rounded-full px-4",children:"Diff"})]}),S&&n.jsx(Te,{variant:"outline",className:"rounded-full border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",children:"Agent is working"}),j&&n.jsx(Te,{variant:"outline",className:"rounded-full border-primary/30 bg-primary/10 text-primary",children:"Message queued"}),!b&&n.jsx(Te,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:"Read-only transcript"})]})})]}),n.jsx(Ye,{value:"transcript",className:"mt-0 min-h-0 flex-1",children:n.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-5 sm:px-5",children:n.jsxs("div",{className:"mx-auto flex max-w-4xl flex-col gap-5",children:[g&&!p&&n.jsx(Ts,{event:g,questionBypassEnabled:w,onQuestionBypassChange:z,onSubmitQuestionResponse:G,questionResponseDisabled:!b||y}),x.map((A,re)=>n.jsx(Ts,{event:A,questionBypassEnabled:w,onQuestionBypassChange:z,onSubmitQuestionResponse:G,questionResponseDisabled:!b||y},gd("transcript",A,re))),x.length===0&&n.jsxs("div",{className:"rounded-[28px] border border-dashed border-border/70 bg-background/35 px-5 py-8 text-center",children:[n.jsx("div",{className:"text-sm font-medium text-foreground",children:"Transcript is warming up"}),n.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&&d.result||d.error)&&n.jsxs("div",{className:"space-y-3",children:[!b&&d.result&&n.jsxs("div",{className:"rounded-[26px] border border-border/70 bg-card/80 px-4 py-4",children:[n.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:"Stored result"}),n.jsx("pre",{className:"mt-3 overflow-x-auto whitespace-pre-wrap text-xs leading-5 text-muted-foreground",children:JSON.stringify(d.result,null,2)})]}),d.error&&n.jsxs("div",{className:"rounded-[26px] border border-destructive/20 bg-destructive/10 px-4 py-4 text-destructive",children:[n.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.22em]",children:"Stored error"}),n.jsx("pre",{className:"mt-3 overflow-x-auto whitespace-pre-wrap text-xs leading-5",children:d.error})]})]}),(S||j)&&x.length>0&&n.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:[n.jsx(Fe,{className:"h-4 w-4 animate-spin"}),"The agent is still working on this conversation."]}),n.jsx("div",{ref:_})]})}),b?n.jsx("div",{className:"shrink-0",children:n.jsx("div",{className:"mx-auto w-full max-w-4xl",children:n.jsx(lf,{onSend:I,disabled:y,contextItems:U,placeholder:y?"Waiting for the current turn to finish...":yn.has(d.status)?"Task has not started yet...":"Continue the conversation..."})})}):n.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."})]})}),n.jsx(Ye,{value:"files",className:"mt-0 min-h-0 flex-1 overflow-hidden",children:n.jsx(i.Suspense,{fallback:n.jsx(Jn,{label:"Loading files..."}),children:n.jsx(Qp,{taskId:d.id})})}),n.jsx(Ye,{value:"preview",className:"mt-0 min-h-0 flex-1 overflow-hidden",children:n.jsx(i.Suspense,{fallback:n.jsx(Jn,{label:"Loading preview..."}),children:n.jsx(eh,{taskId:d.id})})}),n.jsx(Ye,{value:"diff",className:"mt-0 min-h-0 flex-1 overflow-hidden",children:n.jsx(i.Suspense,{fallback:n.jsx(Jn,{label:"Loading diff..."}),children:n.jsx(th,{taskId:d.id})})})]}):n.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden rounded-[32px] border border-border/60 bg-background/78 shadow-[0_30px_120px_-60px_rgba(0,0,0,0.88)] backdrop-blur-xl",children:[n.jsx("div",{className:"shrink-0 border-b border-border/60 px-4 py-4 sm:px-5",children:n.jsx(un,{onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:r,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l})}),n.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center overflow-y-auto px-6 py-10 sm:px-8",children:n.jsxs("div",{className:"w-full max-w-2xl text-center",children:[n.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:n.jsx(vr,{className:"h-7 w-7"})}),n.jsx("h2",{className:"mt-5 text-3xl font-semibold tracking-tight text-foreground",children:"No chat selected"}),n.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."}),n.jsxs(H,{onClick:$,className:"mt-6 rounded-full px-5",children:[n.jsx(ro,{className:"h-4 w-4"}),"Start new chat"]}),v&&n.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:v})]})})]})}function rh({onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:r,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l,onCancel:c,onCreated:u}){return n.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden rounded-[32px] border border-border/60 bg-background/78 shadow-[0_30px_120px_-60px_rgba(0,0,0,0.88)] backdrop-blur-xl",children:[n.jsx("div",{className:"shrink-0 border-b border-border/60 px-4 py-4 sm:px-5",children:n.jsx(un,{onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:r,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l})}),n.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:n.jsxs("div",{className:"w-full max-w-2xl space-y-8",children:[n.jsxs("div",{className:"text-center",children:[n.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:n.jsx(vr,{className:"h-7 w-7"})}),n.jsx("h2",{className:"mt-5 text-3xl font-semibold tracking-tight text-foreground",children:"What should your agent do?"}),n.jsx("p",{className:"mx-auto mt-3 max-w-md text-sm leading-6 text-muted-foreground",children:"Describe what you want to build, fix, or explore. A new chat will open once the task is created."})]}),n.jsx($p,{nodes:(a==null?void 0:a.nodes)??[],onCreated:u,onCancel:c,submitLabel:"Start chat",autoFocus:!0,layout:"composer"})]})})]})}function un({onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:r,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l}){var c;return n.jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[n.jsx(sh,{desktopTasksOpen:t,mobileTasksPanelOpen:r,onToggleTasks:e}),n.jsx(Te,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:l?"Live":"Retrying"}),((c=a==null?void 0:a.leader)==null?void 0:c.name)&&n.jsxs(Te,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:["leader ",a.leader.name]})]}),n.jsxs(H,{variant:"outline",onClick:o,className:"shrink-0 rounded-full border-border/70 bg-background/60 px-4",children:[s?n.jsx(oo,{className:"h-4 w-4"}):n.jsx(Pc,{className:"h-4 w-4"}),s?"Hide cluster":"Show cluster"]})]})}function sh({desktopTasksOpen:e,mobileTasksPanelOpen:t,onToggleTasks:r}){var o,a;const s=(a=(o=globalThis.window)==null?void 0:o.matchMedia("(min-width: 1024px)"))!=null&&a.matches?e:t;return n.jsxs(H,{variant:"outline",onClick:r,className:"rounded-full border-border/70 bg-background/60 px-4",children:[s?n.jsx(so,{className:"h-4 w-4"}):n.jsx(Tc,{className:"h-4 w-4"}),s?"Hide tasks":"Show tasks"]})}const oh={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 ah(e){return e.split(".")[0]??"unknown"}function ih(e){return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}function Qn(e,t){return(t==null?void 0:t.get(e))??e}function lh(e,t){const r=e.data;switch(e.type){case"node.joined":return`${r.name} joined the cluster`;case"node.left":return`${Qn(r.nodeId,t)} left (${r.reason})`;case"node.status":return`${Qn(r.nodeId,t)} is now ${r.status}`;case"task.created":return`"${r.title}" created`;case"task.assigned":return`task assigned to ${Qn(r.nodeId,t)}`;case"task.status":return`task ${r.taskId.slice(0,8)} -> ${r.status}`;case"election.started":return`candidate ${r.candidateId.slice(0,8)} term ${r.term}`;case"election.complete":return`leader elected, term ${r.term}`;case"cluster.state":return`${r.nodeCount} nodes, term ${r.term}`;default:return JSON.stringify(r)}}function ch(e){return JSON.stringify(e,null,2)}function dh({events:e,maxHeight:t="400px",emptyTitle:r="No live events yet",emptyDescription:s="Cluster activity appears here as it happens.",nodeNameById:o}){return e.length===0?n.jsx("div",{className:"flex h-28 items-center justify-center rounded-[20px] border border-dashed border-border/70 bg-background/40 text-center",children:n.jsxs("div",{children:[n.jsx("div",{className:"text-sm text-muted-foreground",children:r}),n.jsx("div",{className:"mt-1 text-xs text-muted-foreground/70",children:s})]})}):n.jsx("div",{className:"overflow-y-auto pr-1",style:{maxHeight:t},children:n.jsx("div",{className:"space-y-2",children:e.map(a=>{const l=ah(a.type);return n.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:n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:ih(a.timestamp)}),n.jsx(Te,{variant:"outline",className:W("w-fit text-[10px] font-medium uppercase tracking-[0.16em]",oh[l]),children:a.type})]}),n.jsx(H,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 rounded-full text-muted-foreground",onClick:()=>void jt(ch(a),"Event copied"),"aria-label":`Copy ${a.type} event`,title:"Copy event",children:n.jsx(to,{className:"h-3.5 w-3.5"})})]}),n.jsx("div",{className:"text-sm leading-6 text-foreground/85",children:lh(a,o)})]})},a.id)})})})}function Hs({cluster:e,systemInfo:t,nodeNameById:r,nodeBlockingTaskCounts:s,eventTypeFilter:o,onEventTypeFilterChange:a,eventTypeOptions:l,filteredEvents:c,sseConnected:u,clusterLoading:f,clusterError:d,electionPending:m,onTriggerElection:h,promotePending:v,onPromote:x,onAddNode:p,onToggleNodeDevTunnel:g,devTunnelNodeId:b,onClose:y}){var T,F,$,O,L;const w=((T=e==null?void 0:e.self)==null?void 0:T.role)==="leader",S=((F=e==null?void 0:e.self)==null?void 0:F.role)==="follower"&&!(e!=null&&e.leader),j=(e==null?void 0:e.self)??null,C=Hp((e==null?void 0:e.nodes)??[],j==null?void 0:j.id).filter(I=>I.id!==(j==null?void 0:j.id));return n.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,0.92)] backdrop-blur-xl",children:n.jsxs(va,{defaultValue:"overview",className:"flex h-full min-h-0 flex-col",children:[n.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.28em] text-muted-foreground",children:"Operations"}),n.jsx("div",{className:"mt-1 text-lg font-semibold tracking-tight",children:"Cluster operations"}),n.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Monitor the local node, cluster state, and peers from one place."})]}),n.jsx(H,{variant:"ghost",size:"icon",onClick:y,className:"rounded-full",children:n.jsx(oo,{className:"h-4 w-4"})})]}),n.jsxs(Fr,{className:"mt-4 grid h-auto w-full grid-cols-3 rounded-full bg-muted/70 p-1",children:[n.jsx(Ge,{value:"overview",className:"rounded-full px-3 text-xs",children:"Overview"}),n.jsx(Ge,{value:"nodes",className:"rounded-full px-3 text-xs",children:"Nodes"}),n.jsx(Ge,{value:"events",className:"rounded-full px-3 text-xs",children:"Live events"})]})]}),n.jsx(Ye,{value:"overview",className:"mt-0 min-h-0 flex-1",children:n.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto px-4 py-5",children:n.jsxs("div",{className:"space-y-7",children:[j&&n.jsx(Ks,{node:j,systemInfo:t,blockingTaskCount:s.get(j.id)??0,devTunnelNodeId:b,onToggleNodeDevTunnel:g,showActions:!1}),n.jsxs("section",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium text-foreground",children:"Cluster snapshot"}),n.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Shared state, queue health, and cluster-wide controls."})]}),n.jsx(Te,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:u?"Connected":"Reconnecting"})]}),f&&!e?n.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[n.jsx(Fe,{className:"h-4 w-4 animate-spin"}),"Loading cluster state..."]}):d&&!e?n.jsx("div",{className:"rounded-[22px] border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:d}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsx(gt,{label:"Term",value:String((e==null?void 0:e.term)??0)}),n.jsx(gt,{label:"Nodes",value:String((e==null?void 0:e.nodes.length)??0)}),n.jsx(gt,{label:"Pending",value:String((e==null?void 0:e.taskSummary.pending)??0)}),n.jsx(gt,{label:"Running",value:String((e==null?void 0:e.taskSummary.running)??0)}),n.jsx(gt,{label:"Completed",value:String((e==null?void 0:e.taskSummary.completed)??0)}),n.jsx(gt,{label:"Failed",value:String((e==null?void 0:e.taskSummary.failed)??0)})]}),n.jsxs("div",{className:"space-y-3 rounded-[24px] border border-border/60 bg-background/45 px-4 py-4",children:[n.jsx(Ae,{label:"Leader",value:(($=e==null?void 0:e.leader)==null?void 0:$.name)??"None"}),n.jsx(Ae,{label:"Leader URL",value:((O=e==null?void 0:e.leader)==null?void 0:O.endpoint)??"Unavailable",mono:!0,action:(L=e==null?void 0:e.leader)!=null&&L.endpoint?n.jsx(Ht,{label:"Copy leader URL",onClick:()=>{var I;return void jt(((I=e.leader)==null?void 0:I.endpoint)??"","Leader URL copied")}}):void 0}),n.jsx(Ae,{label:"Feed",value:u?"Receiving live updates":"Reconnecting to event stream"})]}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[w&&n.jsxs(H,{variant:"outline",size:"sm",onClick:h,disabled:m,className:"rounded-full",children:[m&&n.jsx(Fe,{className:"h-3.5 w-3.5 animate-spin"}),"Trigger election"]}),S&&n.jsxs(H,{variant:"outline",size:"sm",onClick:x,disabled:v,className:"rounded-full",children:[v&&n.jsx(Fe,{className:"h-3.5 w-3.5 animate-spin"}),"Promote self"]})]})]})]})]})})}),n.jsx(Ye,{value:"nodes",className:"mt-0 min-h-0 flex-1",children:n.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto px-4 py-5",children:n.jsxs("div",{className:"space-y-7",children:[n.jsxs("section",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium text-foreground",children:"Node management"}),n.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Manage the local node and connected peers from one tab."})]}),w&&n.jsx(H,{variant:"outline",size:"sm",onClick:p,className:"rounded-full",children:"Add node"})]}),j&&n.jsx(Ks,{node:j,systemInfo:t,blockingTaskCount:s.get(j.id)??0,devTunnelNodeId:b,onToggleNodeDevTunnel:g,showActions:!0})]}),n.jsxs("section",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium text-foreground",children:"Peer nodes"}),n.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Other nodes currently visible in this cluster."})]}),C.length>0?n.jsx("div",{className:"space-y-3",children:C.map(I=>n.jsx(uh,{node:I,isLeader:!!w,blockingTaskCount:s.get(I.id)??0,devTunnelNodeId:b,onToggleNodeDevTunnel:g},I.id))}):n.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."})]})]})})}),n.jsx(Ye,{value:"events",className:"mt-0 min-h-0 flex-1",children:n.jsxs("div",{className:"flex h-full min-h-0 flex-col px-4 py-5",children:[n.jsxs("div",{className:"mb-4 space-y-3",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[n.jsx(Ul,{className:W("h-4 w-4",u?"text-emerald-500":"text-destructive")}),"Live events"]}),n.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:"Cluster activity streams here in real time, separate from node controls."})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsxs(je,{value:o,onValueChange:a,children:[n.jsx(be,{className:"h-9 min-w-[11rem] flex-1 rounded-full border-border/70 bg-background/55 text-[12px] sm:max-w-[15rem]",children:n.jsx(Se,{placeholder:"Event type"})}),n.jsx(ye,{children:l.map(I=>n.jsx(oe,{value:I,className:"text-[12px]",children:I==="all"?"All event types":I},I))})]}),n.jsx(Te,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:u?"Connected":"Reconnecting"})]})]}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(dh,{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:r})})]})})]})})}function Ks({node:e,systemInfo:t,blockingTaskCount:r,devTunnelNodeId:s,onToggleNodeDevTunnel:o,showActions:a=!0}){const l=e.devtunnelEndpoint??e.endpoint,c=e.previewOrigin,u=(t==null?void 0:t.workDir)??e.workDir,f=lo(e,t==null?void 0:t.transportType),d=Nr(e,t==null?void 0:t.transportType),m=io(e,t==null?void 0:t.transportType),h=r>0;return n.jsxs("section",{className:"rounded-[28px] border border-primary/20 bg-primary/8 px-4 py-4 shadow-[0_24px_80px_-60px_hsl(var(--primary)/0.9)]",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:[n.jsx(Zs,{status:e.status}),"Current node"]}),n.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[n.jsx("div",{className:"truncate text-lg font-semibold tracking-tight text-foreground",children:e.name}),n.jsx(Js,{role:e.role}),n.jsx(Te,{variant:"outline",className:"rounded-full border-primary/30 bg-background/60 capitalize",children:e.status})]}),n.jsx("div",{className:"mt-1 font-mono text-[11px] text-muted-foreground",children:e.id}),n.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:a?"Local endpoint, workspace, and node-specific controls.":"Local endpoint, workspace, and health summary."})]}),n.jsx(H,{variant:"outline",size:"sm",asChild:!0,className:"rounded-full border-primary/25 bg-background/70",children:n.jsxs("a",{href:l,target:"_blank",rel:"noreferrer",children:["Open",n.jsx(no,{className:"h-3.5 w-3.5"})]})})]}),n.jsxs("div",{className:"mt-4 space-y-4 rounded-[24px] border border-primary/20 bg-background/72 px-4 py-4",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx(Ae,{label:"Node ID",value:e.id,mono:!0}),n.jsx(Ae,{label:"Endpoint",value:l,mono:!0,action:n.jsx(Ht,{label:"Copy endpoint",onClick:()=>void jt(l,"Endpoint copied")})}),c&&n.jsx(Ae,{label:"Preview",value:c,mono:!0,action:n.jsx(Ht,{label:"Copy preview endpoint",onClick:()=>void jt(c,"Preview endpoint copied")})}),u&&n.jsx(Ae,{label:"Workspace",value:u,mono:!0})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3 border-t border-border/50 pt-4",children:[n.jsx(hr,{label:"Transport",value:f}),t&&n.jsx(hr,{label:"Uptime",value:Jp(t.uptime),mono:!0})]})]}),n.jsxs("div",{className:"mt-4 space-y-2",children:[n.jsx(Yi,{capabilities:e.capabilities,action:a&&m?n.jsxs(H,{variant:"outline",size:"sm",onClick:()=>o(e),disabled:s===e.id||h,className:"rounded-full",title:h?"Finish assigned or running tasks before changing DevTunnel":void 0,children:[s===e.id&&n.jsx(Fe,{className:"h-3.5 w-3.5 animate-spin"}),d?"Disable DevTunnel":"Enable DevTunnel"]}):void 0}),a&&m&&h&&n.jsxs("div",{className:"text-xs text-muted-foreground",children:[r," active task",r===1?"":"s"," on this node."]})]})]})}function uh({node:e,isLeader:t,blockingTaskCount:r,devTunnelNodeId:s,onToggleNodeDevTunnel:o}){const a=e.devtunnelEndpoint??e.endpoint,l=e.previewOrigin,c=lo(e),u=Nr(e),f=io(e),d=r>0;return n.jsxs("div",{className:"rounded-[24px] border border-border/60 bg-background/45 px-4 py-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx(Zs,{status:e.status}),n.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:e.name}),n.jsx(Js,{role:e.role}),n.jsx(Te,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 capitalize",children:e.status})]}),n.jsx("div",{className:"mt-1 font-mono text-[11px] text-muted-foreground",children:e.id}),n.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Remote node currently participating in the cluster."})]}),n.jsx(H,{variant:"outline",size:"sm",asChild:!0,className:"rounded-full border-border/70 bg-background/65",children:n.jsxs("a",{href:a,target:"_blank",rel:"noreferrer",children:["Open",n.jsx(no,{className:"h-3.5 w-3.5"})]})})]}),n.jsxs("div",{className:"mt-4 space-y-3 border-t border-border/50 pt-4",children:[n.jsx(Ae,{label:"Node ID",value:e.id,mono:!0}),n.jsx(Ae,{label:"Endpoint",value:a,mono:!0,action:n.jsx(Ht,{label:"Copy endpoint",onClick:()=>void jt(a,"Endpoint copied")})}),l&&n.jsx(Ae,{label:"Preview",value:l,mono:!0,action:n.jsx(Ht,{label:"Copy preview endpoint",onClick:()=>void jt(l,"Preview endpoint copied")})}),e.workDir&&n.jsx(Ae,{label:"Workspace",value:e.workDir,mono:!0}),n.jsx(hr,{label:"Transport",value:c})]}),n.jsxs("div",{className:"mt-4 space-y-2",children:[n.jsx(Yi,{capabilities:e.capabilities,action:t&&f?n.jsxs(H,{variant:"outline",size:"sm",onClick:()=>o(e),disabled:s===e.id||d,className:"rounded-full",title:d?"Finish assigned or running tasks before changing DevTunnel":void 0,children:[s===e.id&&n.jsx(Fe,{className:"h-3.5 w-3.5 animate-spin"}),u?"Disable DevTunnel":"Enable DevTunnel"]}):void 0}),t&&f&&d&&n.jsxs("div",{className:"text-xs text-muted-foreground",children:[r," active task",r===1?"":"s"," on this node."]})]})]})}function Ht({label:e,onClick:t}){return n.jsx(H,{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:n.jsx(to,{className:"h-3.5 w-3.5"})})}var Mn="Checkbox",[fh]=tt(Mn),[mh,Xr]=fh(Mn);function ph(e){const{__scopeCheckbox:t,checked:r,children:s,defaultChecked:o,disabled:a,form:l,name:c,onCheckedChange:u,required:f,value:d="on",internal_do_not_use_render:m}=e,[h,v]=wt({prop:r,defaultProp:o??!1,onChange:u,caller:Mn}),[x,p]=i.useState(null),[g,b]=i.useState(null),y=i.useRef(!1),w=x?!!l||!!x.closest("form"):!0,S={checked:h,disabled:a,setChecked:v,control:x,setControl:p,name:c,form:l,value:d,hasConsumerStoppedPropagationRef:y,required:f,defaultChecked:Ze(o)?!1:o,isFormControl:w,bubbleInput:g,setBubbleInput:b};return n.jsx(mh,{scope:t,...S,children:hh(m)?m(S):s})}var Xi="CheckboxTrigger",Zi=i.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...s},o)=>{const{control:a,value:l,disabled:c,checked:u,required:f,setControl:d,setChecked:m,hasConsumerStoppedPropagationRef:h,isFormControl:v,bubbleInput:x}=Xr(Xi,e),p=ne(o,d),g=i.useRef(u);return i.useEffect(()=>{const b=a==null?void 0:a.form;if(b){const y=()=>m(g.current);return b.addEventListener("reset",y),()=>b.removeEventListener("reset",y)}},[a,m]),n.jsx(X.button,{type:"button",role:"checkbox","aria-checked":Ze(u)?"mixed":u,"aria-required":f,"data-state":nl(u),"data-disabled":c?"":void 0,disabled:c,value:l,...s,ref:p,onKeyDown:q(t,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:q(r,b=>{m(y=>Ze(y)?!0:!y),x&&v&&(h.current=b.isPropagationStopped(),h.current||b.stopPropagation())})})});Zi.displayName=Xi;var Zr=i.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:s,checked:o,defaultChecked:a,required:l,disabled:c,value:u,onCheckedChange:f,form:d,...m}=e;return n.jsx(ph,{__scopeCheckbox:r,checked:o,defaultChecked:a,disabled:c,required:l,onCheckedChange:f,name:s,form:d,value:u,internal_do_not_use_render:({isFormControl:h})=>n.jsxs(n.Fragment,{children:[n.jsx(Zi,{...m,ref:t,__scopeCheckbox:r}),h&&n.jsx(tl,{__scopeCheckbox:r})]})})});Zr.displayName=Mn;var Ji="CheckboxIndicator",Qi=i.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:s,...o}=e,a=Xr(Ji,r);return n.jsx(kt,{present:s||Ze(a.checked)||a.checked===!0,children:n.jsx(X.span,{"data-state":nl(a.checked),"data-disabled":a.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});Qi.displayName=Ji;var el="CheckboxBubbleInput",tl=i.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:s,hasConsumerStoppedPropagationRef:o,checked:a,defaultChecked:l,required:c,disabled:u,name:f,value:d,form:m,bubbleInput:h,setBubbleInput:v}=Xr(el,e),x=ne(r,v),p=li(a),g=Za(s);i.useEffect(()=>{const y=h;if(!y)return;const w=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(w,"checked").set,E=!o.current;if(p!==a&&j){const C=new Event("click",{bubbles:E});y.indeterminate=Ze(a),j.call(y,Ze(a)?!1:a),y.dispatchEvent(C)}},[h,p,a,o]);const b=i.useRef(Ze(a)?!1:a);return n.jsx(X.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??b.current,required:c,disabled:u,name:f,value:d,form:m,...t,tabIndex:-1,ref:x,style:{...t.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});tl.displayName=el;function hh(e){return typeof e=="function"}function Ze(e){return e==="indeterminate"}function nl(e){return Ze(e)?"indeterminate":e?"checked":"unchecked"}const xr=i.forwardRef(({className:e,...t},r)=>n.jsx(Zr,{ref:r,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:n.jsx(Qi,{className:W("flex items-center justify-center text-current"),children:n.jsx(br,{className:"h-3.5 w-3.5"})})}));xr.displayName=Zr.displayName;function qs({toolbarTasks:e,activeTaskId:t,activeTask:r,tasksLoading:s,tasksError:o,isLeader:a,scope:l,agentFilter:c,nodeFilter:u,agentOptions:f,nodeOptions:d,nodeNameById:m,searchQuery:h,selectedTaskIds:v,allVisibleTasksSelected:x,someVisibleTasksSelected:p,canBatchArchive:g,onSearchChange:b,onScopeChange:y,onAgentFilterChange:w,onNodeFilterChange:S,onToggleTaskSelected:j,onToggleAllVisibleTasks:E,canArchive:C,canDelete:T,onArchive:F,onDelete:$,onBatchArchive:O,onBatchDelete:L,onCreateTask:I,onSelectTask:z,onClose:G}){const[_,B]=i.useState(!!h),P=i.useRef(null),U=i.useRef(null),Y=v.size;return i.useEffect(()=>{h&&B(!0)},[h]),i.useEffect(()=>{var A;_&&((A=P.current)==null||A.focus())},[_]),i.useEffect(()=>{if(!_)return;const A=ge=>{var me;const fe=ge.target;fe instanceof Node&&((me=U.current)!=null&&me.contains(fe)||B(!1))},re=ge=>{ge.key==="Escape"&&B(!1)};return document.addEventListener("mousedown",A),document.addEventListener("keydown",re),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("keydown",re)}},[_]),n.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,0.8)] backdrop-blur-xl",children:[n.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-4",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("div",{className:"text-lg font-semibold tracking-tight text-foreground",children:"Tasks"}),n.jsx(H,{variant:"ghost",size:"icon",onClick:G,className:"rounded-full",children:n.jsx(so,{className:"h-4 w-4"})})]}),n.jsxs("div",{ref:U,className:"mt-4 flex items-center gap-2",children:[n.jsxs(H,{onClick:I,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",_?"flex-[2]":"flex-1"),children:[n.jsx(ro,{className:"h-4 w-4"}),"New chat"]}),_?n.jsxs("div",{className:"flex min-w-0 flex-[3] items-center gap-2",children:[n.jsxs("div",{className:"relative min-w-0 flex-1",children:[n.jsx(ms,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),n.jsx(Me,{ref:P,value:h,onChange:A=>b(A.target.value),placeholder:"Search tasks",className:"h-11 rounded-full border-border/70 bg-background/60 pl-11 text-sm"})]}),n.jsx(H,{variant:"outline",size:"icon",onClick:()=>B(!1),className:"rounded-full border-border/70 bg-background/60",children:n.jsx(eo,{className:"h-4 w-4"})})]}):n.jsxs(H,{variant:"outline",onClick:()=>B(!0),className:W("rounded-full border-border/70 bg-background/60 px-4 text-sm",h&&"border-primary/40 bg-primary/8 text-primary"),children:[n.jsx(ms,{className:"h-4 w-4"}),"Search"]})]}),n.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:grid-cols-3",children:[n.jsxs(je,{value:l,onValueChange:A=>y(A),children:[n.jsx(be,{className:"h-9 rounded-full border-border/70 bg-background/55 text-[12px]",children:n.jsx(Se,{})}),n.jsx(ye,{children:Fp.map(A=>n.jsx(oe,{value:A.value,className:"text-[12px]",children:A.label},A.value))})]}),n.jsxs(je,{value:u,onValueChange:S,children:[n.jsx(be,{className:"h-9 rounded-full border-border/70 bg-background/55 text-[12px]",children:n.jsx(Se,{placeholder:"Node"})}),n.jsx(ye,{children:d.map(A=>n.jsx(oe,{value:A.value,className:"text-[12px]",children:A.label},A.value))})]}),n.jsxs(je,{value:c,onValueChange:w,children:[n.jsx(be,{className:"h-9 rounded-full border-border/70 bg-background/55 text-[12px]",children:n.jsx(Se,{placeholder:"Agent"})}),n.jsx(ye,{children:f.map(A=>n.jsx(oe,{value:A,className:"text-[12px]",children:A==="all"?"All agents":A},A))})]})]})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-3",children:e.length>0?n.jsxs("div",{className:"space-y-2",children:[a&&n.jsxs("div",{className:"mb-1 flex items-center justify-between px-1 py-1",children:[n.jsxs("label",{className:"flex items-center gap-2 text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:[n.jsx(xr,{checked:p&&!x?"indeterminate":x,onCheckedChange:A=>E(A===!0),"aria-label":"Select all visible tasks"}),n.jsx("span",{children:"Select all"})]}),Y>0&&n.jsx(H,{variant:"ghost",size:"sm",onClick:()=>E(!1),className:"h-7 rounded-full px-3 text-xs",children:"Clear"})]}),e.map(A=>n.jsxs("div",{className:W("flex items-start gap-3 rounded-[24px] border px-3 py-3 transition-all",A.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:[a&&n.jsx("div",{className:"flex shrink-0 pt-1",onClick:re=>re.stopPropagation(),children:n.jsx(xr,{checked:v.has(A.id),onCheckedChange:re=>j(A.id,re===!0),"aria-label":`Select ${A.title}`})}),n.jsx("button",{type:"button",onClick:()=>z(A.id),className:"min-w-0 flex-1 text-left",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("span",{className:W("mt-1 h-2.5 w-2.5 shrink-0 rounded-full",qp(A.status))}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:A.title}),n.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[n.jsx("span",{className:"font-mono",children:A.agent}),n.jsx("span",{className:"h-1 w-1 rounded-full bg-border"}),n.jsx("span",{children:A.assignedTo?m.get(A.assignedTo)??A.assignedTo.slice(0,8):"unassigned"}),n.jsx("span",{className:"h-1 w-1 rounded-full bg-border"}),n.jsx("span",{children:Xp(A.updatedAt)})]}),n.jsxs("div",{className:"mt-3 flex items-center gap-2 text-[11px] text-muted-foreground",children:[n.jsx(Xs,{status:A.status}),n.jsx("span",{className:"truncate font-medium text-foreground/85",children:Gp(A.effectiveProjectPath??A.project??"default workspace")})]}),n.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground/85",children:Yp(A.effectiveProjectPath??A.project??"default workspace")})]})]})})]},A.id))]}):n.jsx("div",{className:"rounded-[24px] border border-dashed border-border/70 bg-background/35 px-4 py-5 text-sm text-muted-foreground",children:s?"Loading tasks...":o||"No tasks match this view."})}),a&&Y>0?n.jsxs("div",{className:"shrink-0 border-t border-border/60 px-4 py-4",children:[n.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:"Batch actions"}),n.jsxs("div",{className:"mt-2 text-sm font-semibold text-foreground",children:[Y," task",Y!==1?"s":""," selected"]}),!g&&n.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Only completed, failed, cancelled, or archived tasks can be archived."}),n.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[n.jsxs(ln,{children:[n.jsx(cn,{asChild:!0,children:n.jsxs(H,{variant:"outline",size:"sm",disabled:!g,className:"rounded-full",children:[n.jsx(fs,{className:"h-3.5 w-3.5"}),"Archive"]})}),n.jsxs(It,{children:[n.jsxs(Mt,{children:[n.jsxs(Lt,{children:["Archive ",Y," task",Y!==1?"s":"","?"]}),n.jsx($t,{children:"Archived tasks stay hidden from the default task view and can be reopened from the archived scope."})]}),n.jsxs(Ot,{children:[n.jsx(Bt,{children:"Cancel"}),n.jsx(Ft,{onClick:O,disabled:!g,children:"Archive"})]})]})]}),n.jsxs(ln,{children:[n.jsx(cn,{asChild:!0,children:n.jsxs(H,{variant:"destructive",size:"sm",className:"rounded-full",children:[n.jsx(Wc,{className:"h-3.5 w-3.5"}),"Delete"]})}),n.jsxs(It,{children:[n.jsxs(Mt,{children:[n.jsxs(Lt,{children:["Delete ",Y," task",Y!==1?"s":"","?"]}),n.jsx($t,{children:"This removes the selected tasks and their saved logs."})]}),n.jsxs(Ot,{children:[n.jsx(Bt,{children:"Cancel"}),n.jsx(Ft,{onClick:L,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})]}):r?n.jsxs("div",{className:"shrink-0 border-t border-border/60 px-4 py-4",children:[n.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:"Selected task"}),n.jsx("div",{className:"mt-2 truncate text-sm font-semibold text-foreground",children:r.title}),n.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[C&&n.jsxs(H,{variant:"outline",size:"sm",onClick:F,className:"rounded-full",children:[n.jsx(fs,{className:"h-3.5 w-3.5"}),"Archive"]}),T&&n.jsxs(ln,{children:[n.jsx(cn,{asChild:!0,children:n.jsx(H,{variant:"destructive",size:"sm",className:"rounded-full",children:"Delete"})}),n.jsxs(It,{children:[n.jsxs(Mt,{children:[n.jsx(Lt,{children:"Permanently delete this task?"}),n.jsx($t,{children:"This removes the task record and its saved logs."})]}),n.jsxs(Ot,{children:[n.jsx(Bt,{children:"No"}),n.jsx(Ft,{onClick:$,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})]}):null]})}function xh(){var ds,us;const{id:e}=Hl(),t=Kl(),r=ql(),{cluster:s,systemInfo:o,events:a,sseConnected:l,subscribe:c,refresh:u,loading:f,error:d}=Gl(),m=i.useMemo(()=>Kp(t.state),[t.state]),[h,v]=i.useState([]),[x,p]=i.useState(!0),[g,b]=i.useState(null),[y,w]=i.useState(null),[S,j]=i.useState("active"),[E,C]=i.useState("all"),[T,F]=i.useState("all"),[$,O]=i.useState(""),L=i.useDeferredValue($),[I,z]=i.useState(!0),[G,_]=i.useState(!1),[B,P]=i.useState(!1),[U,Y]=i.useState(()=>!!(m!=null&&m.draftNewTask)),[A,re]=i.useState(()=>m!=null&&m.draftNewTask?{route:m.returnRoute??"/",taskId:m.returnTaskId??null}:null),[ge,fe]=i.useState(!1),[me,ve]=i.useState("transcript"),[M,Q]=i.useState("all"),[le,ee]=i.useState(!1),[Z,k]=i.useState(null),[K,ae]=i.useState([]),[he,xe]=i.useState([]),[st,Rt]=i.useState(!1),[ft,Xt]=i.useState(null),[Ue,ot]=i.useState(new Set),[rl,Jr]=i.useState(!1),[sl,Qr]=i.useState(!1),[ol,es]=i.useState(null),ts=i.useRef(null),_t=i.useRef(null),He=((ds=s==null?void 0:s.self)==null?void 0:ds.role)==="leader",On=(us=s==null?void 0:s.self)==null?void 0:us.id,ce=i.useCallback(async()=>{try{const N=await Yl({assignedTo:!He&&On?On:void 0,limit:100});v(N),b(null)}catch(N){b(N instanceof Error?N.message:"Failed to load tasks")}finally{p(!1)}},[He,On]);Xl(ce,1e4),i.useEffect(()=>{ce()},[ce]),i.useEffect(()=>c("task",ce),[c,ce]);const de=i.useMemo(()=>[...h].sort((N,R)=>R.updatedAt-N.updatedAt),[h]),al=i.useMemo(()=>{const N=new Map;for(const R of(s==null?void 0:s.nodes)??[]){const D=Yc(de,R.id);D>0&&N.set(R.id,D)}return N},[s==null?void 0:s.nodes,de]),Ce=i.useMemo(()=>de.filter(N=>!Wp(N,S)||E!=="all"&&N.agent!==E||T==="unassigned"&&N.assignedTo||T!=="all"&&T!=="unassigned"&&Up(N.assignedTo,s==null?void 0:s.nodes,N.assignedNodeName)!==T?!1:L.trim()?zp(N,L):!0),[de,S,E,T,L]);i.useEffect(()=>{ot(N=>{const R=Qc(N,Ce.map(D=>D.id));return R.size===N.size?N:R})},[Ce]),i.useEffect(()=>{He||ot(new Set)},[He]);const il=i.useMemo(()=>["all",...Array.from(new Set(de.map(N=>N.agent))).sort()],[de]),ll=i.useMemo(()=>{const R=Array.from(new Set(de.map(D=>D.assignedTo).filter(D=>!!D))).map(D=>{const ie=de.find(J=>J.assignedTo===D);return(s==null?void 0:s.nodes.find(J=>J.id===D))??{id:D,name:Yr(D,s==null?void 0:s.nodes,ie==null?void 0:ie.assignedNodeName)}}).sort((D,ie)=>D.name.localeCompare(ie.name));return[{value:"all",label:"All nodes"},{value:"unassigned",label:"Unassigned"},...R.map(D=>({value:D.name.toLowerCase(),label:D.name}))]},[de,s==null?void 0:s.nodes]),ns=i.useMemo(()=>{const N=new Map;for(const R of(s==null?void 0:s.nodes)??[])N.set(R.id,R.name);for(const R of de)R.assignedTo&&R.assignedNodeName&&!N.has(R.assignedTo)&&N.set(R.assignedTo,R.assignedNodeName);return N},[s==null?void 0:s.nodes,de]),Ln=i.useMemo(()=>["all",...Array.from(new Set(a.map(N=>N.type))).sort()],[a]),cl=i.useMemo(()=>M==="all"?a:a.filter(N=>N.type===M),[a,M]),dl=Ce.length>0&&Ce.every(N=>Ue.has(N.id)),ul=Ce.some(N=>Ue.has(N.id)),fl=ed(Ce,Ue);i.useEffect(()=>{m!=null&&m.draftNewTask&&(Y(!0),re({route:m.returnRoute??"/",taskId:m.returnTaskId??null}))},[m]),i.useEffect(()=>{M!=="all"&&!Ln.includes(M)&&Q("all")},[M,Ln]),i.useEffect(()=>{ps(e,U)&&!y&&de[0]&&w(de[0].id)},[e,U,y,de]),i.useEffect(()=>{var N;ps(e,U)&&(y&&h.some(R=>R.id===y)||w(((N=de[0])==null?void 0:N.id)??null))},[e,U,y,de,h]);const se=Zc({routeTaskId:e,creatingTask:U,internalSelectedTaskId:y,sortedTaskIds:de.map(N=>N.id)}),mt=i.useMemo(()=>h.find(N=>N.id===se)??null,[h,se]);i.useEffect(()=>{_t.current=se??null},[se]);const De=i.useCallback(async()=>{const N=se;if(N)try{const R=await Zl(N);if(_t.current!==N)return;k(R),Xt(null)}catch(R){if(_t.current!==N)return;Xt(R instanceof Error?R.message:"Failed to load task")}finally{_t.current===N&&Rt(!1)}},[se]),Zt=i.useCallback(async()=>{const N=se;if(N)try{const R=await Jl(N);if(_t.current!==N)return;ae(D=>vd(D,R.logs)),xe(D=>yd(D,R.logs))}catch{}},[se]);i.useEffect(()=>{if(!se){k(null),ae([]),xe([]),Xt(null),Rt(!1);return}ve("transcript"),k(mt),ae([]),xe([]),Xt(null),Rt(!0),De(),Zt()},[se,Zt,De]),i.useEffect(()=>{mt&&k(N=>!N||N.id!==mt.id?N:{...N,...mt})},[mt]),i.useEffect(()=>{if(se)return c("task",N=>{const R=N.data.taskId;if(!(typeof R!="string"||R!==se)){if(N.type==="task.output"){const D=N.data.event;if(D){ae(J=>bd(J,D));const ie=Kt(D);ie&&xe(J=>wd(J,ie))}}N.type==="task.status"&&(De(),Zt())}})},[c,se,De,Zt]),i.useEffect(()=>{var N;me==="transcript"&&((N=ts.current)==null||N.scrollIntoView({behavior:"smooth"}))},[K,he,me]);const V=Z??mt,ml=V!=null&&V.assignedTo?(s==null?void 0:s.nodes.find(N=>N.id===V.assignedTo))??null:null,rs=he.length>0,pl=V?Lp.has(V.agent):!1,ss=(V==null?void 0:V.status)==="running",hl=V?He&&(yn.has(V.status)||Gi.has(V.status)):!1,xl=(V==null?void 0:V.status)==="failed",gl=V?He&&Vp.has(V.status):!1,vl=!!(V&&He),bl=!V||rs||ss||yn.has(V.status)||V.status==="archived",yl=i.useMemo(()=>Nd(K),[K]),$n=i.useMemo(()=>jd([...K,...he.map(N=>Bn(N.content,N.timestamp))]),[K,he]),wl=i.useMemo(()=>{if(!V)return null;const N=od(V);if(N.length>0)return Bn(N,new Date(V.createdAt).toISOString());if($n.length>0)return null;const R=Dt(V.description||V.title);return R.length>0?Bn(R,new Date(V.createdAt).toISOString()):null},[V,$n]),Fn=i.useCallback(()=>{const N={route:e?`/tasks/${e}`:"/",taskId:se};re(N),Y(!0),i.startTransition(()=>{r("/",{state:{draftNewTask:!0,returnRoute:N.route,returnTaskId:N.taskId}})})},[e,se,r]),Nl=i.useCallback(()=>{var R;const N=(A==null?void 0:A.taskId)??((R=de[0])==null?void 0:R.id)??null;Y(!1),re(null),w(N),i.startTransition(()=>{r((A==null?void 0:A.route)??"/",{state:null})})},[A,de,r]),os=i.useCallback(N=>{Y(!1),re(null),w(N),i.startTransition(()=>{r(`/tasks/${N}`,{state:null})})},[r]),jl=i.useCallback(N=>{Y(!1),re(null),w(N.id),ce(),i.startTransition(()=>{r(`/tasks/${N.id}`,{state:null})})},[ce,r]),Jt=i.useCallback(async N=>{if(!se)return!1;const R=`local-${Date.now()}-${Math.random().toString(16).slice(2)}`;xe(D=>[...D,{id:R,content:N,timestamp:new Date().toISOString()}]);try{return await Ql(se,N),De(),!0}catch(D){return xe(ie=>ie.filter(J=>J.id!==R)),ue.error(D instanceof Error?D.message:"Failed to send message"),!1}},[se,De]),Sl=i.useCallback(N=>{Jt(N)},[Jt]),Cl=i.useCallback(N=>Jt(jr(N,[])),[Jt]),kl=i.useCallback(async()=>{if(V)try{await ec(V.id),De(),ce()}catch(N){ue.error(N instanceof Error?N.message:"Failed to cancel task")}},[V,De,ce]),El=i.useCallback(async()=>{if(V)try{await tc(V.id),De(),ce()}catch(N){ue.error(N instanceof Error?N.message:"Failed to retry task")}},[V,De,ce]),as=i.useCallback(()=>{k(null),ae([]),xe([])},[]),Ke=i.useCallback((N,R=!1)=>{const D=td(Ce,N);return w(D),(R||!D)&&as(),i.startTransition(()=>{r(D?`/tasks/${D}`:"/",{state:null})}),D},[as,Ce,r]),Al=i.useCallback(async()=>{if(V)try{await nc(V.id),Ke([V.id]),ce()}catch(N){ue.error(N instanceof Error?N.message:"Failed to archive task")}},[V,ce,Ke]),Tl=i.useCallback(async()=>{if(V)try{await rc(V.id),Ke([V.id],!0),ce()}catch(N){ue.error(N instanceof Error?N.message:"Failed to delete task")}},[V,ce,Ke]),Rl=i.useCallback((N,R)=>{ot(D=>{const ie=new Set(D);return R?ie.add(N):ie.delete(N),ie})},[]),_l=i.useCallback(N=>{if(!N){ot(new Set);return}ot(new Set(Ce.map(R=>R.id)))},[Ce]),Pl=i.useCallback(async()=>{const N=Array.from(Ue);if(N.length!==0)try{const{results:R}=await sc(N),D=R.filter(J=>!J.ok),ie=R.filter(J=>J.ok).map(J=>J.id);se&&ie.includes(se)&&Ke(ie),D.length>0?ue.error(`Failed to archive ${D.length} task(s): ${D.map(J=>J.error??J.id).join(", ")}`):ue.success(`Archived ${ie.length} task(s)`),ot(new Set(D.map(J=>J.id))),ce()}catch(R){ue.error(R instanceof Error?R.message:"Failed to archive tasks")}},[se,ce,Ke,Ue]),Dl=i.useCallback(async()=>{const N=Array.from(Ue);if(N.length!==0)try{const{results:R}=await oc(N),D=R.filter(J=>!J.ok),ie=R.filter(J=>J.ok).map(J=>J.id);se&&ie.includes(se)&&Ke(ie,!0),D.length>0?ue.error(`Failed to delete ${D.length} task(s): ${D.map(J=>J.error??J.id).join(", ")}`):ue.success(`Deleted ${ie.length} task(s)`),ot(new Set(D.map(J=>J.id))),ce()}catch(R){ue.error(R instanceof Error?R.message:"Failed to delete tasks")}},[se,ce,Ke,Ue]),Il=i.useCallback(async()=>{Jr(!0);try{await ac(),u()}catch(N){ue.error(N instanceof Error?N.message:"Failed to trigger election")}finally{Jr(!1)}},[u]),Ml=i.useCallback(async()=>{Qr(!0);try{await ic(),u()}catch(N){ue.error(N instanceof Error?N.message:"Failed to promote node")}finally{Qr(!1)}},[u]),Ol=i.useCallback(async N=>{const R=!Nr(N);es(N.id);try{await lc(N.id,R),ue.success(R?`Enabled DevTunnel on ${N.name}`:`Disabled DevTunnel on ${N.name}`),u()}catch(D){ue.error(D instanceof Error?D.message:"Failed to toggle DevTunnel")}finally{es(null)}},[u]),is=i.useCallback(()=>{var N,R;if((R=(N=globalThis.window)==null?void 0:N.matchMedia("(min-width: 1024px)"))!=null&&R.matches){z(D=>!D);return}_(D=>!D)},[]),ls={toolbarTasks:Ce,activeTaskId:se,activeTask:V,tasksLoading:x,tasksError:g,isLeader:He,scope:S,agentFilter:E,nodeFilter:T,agentOptions:il,nodeOptions:ll,nodeNameById:ns,searchQuery:$,selectedTaskIds:Ue,allVisibleTasksSelected:dl,someVisibleTasksSelected:ul,canBatchArchive:fl,onSearchChange:O,onScopeChange:j,onAgentFilterChange:C,onNodeFilterChange:F,onToggleTaskSelected:Rl,onToggleAllVisibleTasks:_l,canArchive:gl,canDelete:vl,onArchive:Al,onDelete:Tl,onBatchArchive:Pl,onBatchDelete:Dl,onCreateTask:Fn,onSelectTask:os,onClose:is},cs={cluster:s,systemInfo:o,nodeNameById:ns,nodeBlockingTaskCounts:al,eventTypeFilter:M,onEventTypeFilterChange:Q,eventTypeOptions:Ln,filteredEvents:cl,sseConnected:l,clusterLoading:f,clusterError:d,electionPending:rl,onTriggerElection:Il,promotePending:sl,onPromote:Ml,onAddNode:()=>fe(!0),onToggleNodeDevTunnel:Ol,devTunnelNodeId:ol,onClose:()=>P(!1)};return n.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden pb-2",children:[n.jsxs("div",{className:"flex min-h-0 flex-1 gap-4 overflow-hidden",children:[n.jsx("div",{className:W("hidden lg:block lg:shrink-0 lg:transition-all lg:duration-300",I?"lg:w-[22rem]":"lg:w-0 lg:overflow-hidden"),children:I&&n.jsx(qs,{...ls})}),n.jsx("section",{className:"min-h-0 min-w-0 flex-1",children:n.jsx(nh,{onToggleTasks:is,desktopTasksOpen:I,mobileTasksPanelOpen:G,operationsOpen:B,onToggleOperations:()=>P(N=>!N),cluster:s,sseConnected:l,activeTab:me,setActiveTab:ve,creatingTask:U,activeTask:V,assignedNode:ml,taskLoading:st,taskError:ft,displayEvents:$n,hasUserMessageInLogs:yl,initialPrompt:wl,supportsFollowUp:pl,chatDisabled:bl,questionBypassEnabled:le,isRunning:!!ss,hasPendingFollowUp:rs,canCancel:!!hl,canRetry:!!xl,onRetry:El,onCancel:kl,onStartCreateTask:Fn,onCancelCreateTask:Nl,onCreateTask:jl,onSendMessage:Sl,onQuestionBypassChange:ee,onSubmitQuestionResponse:Cl,messagesEndRef:ts})}),n.jsx("div",{className:W("hidden xl:block xl:shrink-0 xl:transition-all xl:duration-300",B?"xl:w-[24rem]":"xl:w-0 xl:overflow-hidden"),children:B&&n.jsx(Hs,{...cs})})]}),B&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button","aria-label":"Close operations panel",onClick:()=>P(!1),className:"fixed inset-0 z-30 bg-black/45 backdrop-blur-sm xl:hidden"}),n.jsx("div",{className:"fixed inset-y-0 right-0 z-40 w-full max-w-sm p-3 xl:hidden",children:n.jsx(Hs,{...cs})})]}),G&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button","aria-label":"Close task list",onClick:()=>_(!1),className:"fixed inset-0 z-30 bg-black/45 backdrop-blur-sm lg:hidden"}),n.jsx("div",{className:"fixed inset-y-0 left-0 z-40 w-full max-w-sm p-3 lg:hidden",children:n.jsx(qs,{...ls,onCreateTask:()=>{_(!1),Fn()},onSelectTask:N=>{_(!1),os(N)},onClose:()=>_(!1)})})]}),n.jsx(Qu,{open:ge,onOpenChange:fe,children:n.jsx(af,{onAdded:()=>{fe(!1),u()}})})]})}const vh=Object.freeze(Object.defineProperty({__proto__:null,DashboardPage:xh},Symbol.toStringTag,{value:"Module"}));export{yr as C,vh as D,no as E,St as a};
|