meshy-node 0.0.6 → 0.0.8

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