meshy-node 0.0.3 → 0.0.4

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