camelagi 0.5.41 → 0.5.45

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.
Files changed (190) hide show
  1. package/README.md +116 -25
  2. package/dashboard/404.html +1 -0
  3. package/dashboard/__next.__PAGE__.txt +9 -0
  4. package/dashboard/__next._full.txt +19 -0
  5. package/dashboard/__next._head.txt +6 -0
  6. package/dashboard/__next._index.txt +5 -0
  7. package/dashboard/__next._tree.txt +3 -0
  8. package/dashboard/_next/_next/static/T-oVqD_b6KFHCZwRKsnRE/_buildManifest.js +11 -0
  9. package/dashboard/_next/_next/static/T-oVqD_b6KFHCZwRKsnRE/_clientMiddlewareManifest.js +1 -0
  10. package/dashboard/_next/_next/static/T-oVqD_b6KFHCZwRKsnRE/_ssgManifest.js +1 -0
  11. package/dashboard/_next/_next/static/chunks/0.9wqq91a2h.e.js +3 -0
  12. package/dashboard/_next/_next/static/chunks/00-nlsz4ud071.js +11 -0
  13. package/dashboard/_next/_next/static/chunks/00noe7du3vxk9.js +1 -0
  14. package/dashboard/_next/_next/static/chunks/04wr2uisy8870.js +5 -0
  15. package/dashboard/_next/_next/static/chunks/05f.w0h0j~.3g.js +1 -0
  16. package/dashboard/_next/_next/static/chunks/0geaa8~wrpcj6.js +1 -0
  17. package/dashboard/_next/_next/static/chunks/0nrlwe_~wde44.js +1 -0
  18. package/dashboard/_next/_next/static/chunks/12l48lp-434~..js +31 -0
  19. package/dashboard/_next/_next/static/chunks/14qcm-bqojrb9.js +1 -0
  20. package/dashboard/_next/_next/static/chunks/15~vsexhgsteo.js +1 -0
  21. package/dashboard/_next/_next/static/chunks/turbopack-173kubfog5kol.js +1 -0
  22. package/dashboard/_next/static/8Qf-y5Z4kUHAaWZgy3BFF/_buildManifest.js +11 -0
  23. package/dashboard/_next/static/8Qf-y5Z4kUHAaWZgy3BFF/_clientMiddlewareManifest.js +1 -0
  24. package/dashboard/_next/static/8Qf-y5Z4kUHAaWZgy3BFF/_ssgManifest.js +1 -0
  25. package/dashboard/_next/static/IQ8CU45QQ3REnyUqiqjou/_buildManifest.js +11 -0
  26. package/dashboard/_next/static/IQ8CU45QQ3REnyUqiqjou/_clientMiddlewareManifest.js +1 -0
  27. package/dashboard/_next/static/IQ8CU45QQ3REnyUqiqjou/_ssgManifest.js +1 -0
  28. package/dashboard/_next/static/PXgzS7j3kuwIb14Ph3vgL/_buildManifest.js +11 -0
  29. package/dashboard/_next/static/PXgzS7j3kuwIb14Ph3vgL/_clientMiddlewareManifest.js +1 -0
  30. package/dashboard/_next/static/PXgzS7j3kuwIb14Ph3vgL/_ssgManifest.js +1 -0
  31. package/dashboard/_next/static/S6BdJ1Ro25a6twuts7gHi/_buildManifest.js +11 -0
  32. package/dashboard/_next/static/S6BdJ1Ro25a6twuts7gHi/_clientMiddlewareManifest.js +1 -0
  33. package/dashboard/_next/static/S6BdJ1Ro25a6twuts7gHi/_ssgManifest.js +1 -0
  34. package/dashboard/_next/static/T-oVqD_b6KFHCZwRKsnRE/_buildManifest.js +11 -0
  35. package/dashboard/_next/static/T-oVqD_b6KFHCZwRKsnRE/_clientMiddlewareManifest.js +1 -0
  36. package/dashboard/_next/static/T-oVqD_b6KFHCZwRKsnRE/_ssgManifest.js +1 -0
  37. package/dashboard/_next/static/bvUynE5XeBkbLQynmgHa8/_buildManifest.js +11 -0
  38. package/dashboard/_next/static/bvUynE5XeBkbLQynmgHa8/_clientMiddlewareManifest.js +1 -0
  39. package/dashboard/_next/static/bvUynE5XeBkbLQynmgHa8/_ssgManifest.js +1 -0
  40. package/dashboard/_next/static/chunks/0.9wqq91a2h.e.js +3 -0
  41. package/dashboard/_next/static/chunks/00-nlsz4ud071.js +11 -0
  42. package/dashboard/_next/static/chunks/00noe7du3vxk9.js +1 -0
  43. package/dashboard/_next/static/chunks/03~yq9q893hmn.js +1 -0
  44. package/dashboard/_next/static/chunks/04wr2uisy8870.js +5 -0
  45. package/dashboard/_next/static/chunks/05f.w0h0j~.3g.js +1 -0
  46. package/dashboard/_next/static/chunks/08ug0khjvhl6m.js +11 -0
  47. package/dashboard/_next/static/chunks/0d1s5w1cd08~7.js +11 -0
  48. package/dashboard/_next/static/chunks/0geaa8~wrpcj6.js +1 -0
  49. package/dashboard/_next/static/chunks/0lyajo4_yki3f.js +11 -0
  50. package/dashboard/_next/static/chunks/0nrlwe_~wde44.js +1 -0
  51. package/dashboard/_next/static/chunks/0pd15v2_1spxb.js +11 -0
  52. package/dashboard/_next/static/chunks/0vnhcfh7g1u6i.js +11 -0
  53. package/dashboard/_next/static/chunks/0ynuwcqa7w3o..css +2 -0
  54. package/dashboard/_next/static/chunks/11dfqgfbc8fk2.js +11 -0
  55. package/dashboard/_next/static/chunks/12l48lp-434~..js +31 -0
  56. package/dashboard/_next/static/chunks/14qcm-bqojrb9.js +1 -0
  57. package/dashboard/_next/static/chunks/15~vsexhgsteo.js +1 -0
  58. package/dashboard/_next/static/chunks/turbopack-173kubfog5kol.js +1 -0
  59. package/dashboard/_next/static/media/1bffadaabf893a1e-s.16ipb6fqu393i.woff2 +0 -0
  60. package/dashboard/_next/static/media/2bbe8d2671613f1f-s.067x_6k0k23tk.woff2 +0 -0
  61. package/dashboard/_next/static/media/2c55a0e60120577a-s.0bjc5tiuqdqro.woff2 +0 -0
  62. package/dashboard/_next/static/media/5476f68d60460930-s.0wxq9webf.ew4.woff2 +0 -0
  63. package/dashboard/_next/static/media/83afe278b6a6bb3c-s.p.0q-301v4kxxnr.woff2 +0 -0
  64. package/dashboard/_next/static/media/9c72aa0f40e4eef8-s.0m6w47a4e5dy9.woff2 +0 -0
  65. package/dashboard/_next/static/media/ad66f9afd8947f86-s.11u06r12fd6v_.woff2 +0 -0
  66. package/dashboard/_next/static/media/favicon.0x3dzn~oxb6tn.ico +0 -0
  67. package/dashboard/_next/static/uQ6ZB7JlP8tE93mlzKtXM/_buildManifest.js +11 -0
  68. package/dashboard/_next/static/uQ6ZB7JlP8tE93mlzKtXM/_clientMiddlewareManifest.js +1 -0
  69. package/dashboard/_next/static/uQ6ZB7JlP8tE93mlzKtXM/_ssgManifest.js +1 -0
  70. package/dashboard/_not-found/__next._full.txt +16 -0
  71. package/dashboard/_not-found/__next._head.txt +6 -0
  72. package/dashboard/_not-found/__next._index.txt +5 -0
  73. package/dashboard/_not-found/__next._not-found.__PAGE__.txt +5 -0
  74. package/dashboard/_not-found/__next._not-found.txt +5 -0
  75. package/dashboard/_not-found/__next._tree.txt +2 -0
  76. package/dashboard/_not-found.html +1 -0
  77. package/dashboard/_not-found.txt +16 -0
  78. package/dashboard/favicon.ico +0 -0
  79. package/dashboard/file.svg +1 -0
  80. package/dashboard/globe.svg +1 -0
  81. package/dashboard/index.html +1 -1
  82. package/dashboard/index.txt +18 -27
  83. package/dashboard/next.svg +1 -0
  84. package/dashboard/vercel.svg +1 -0
  85. package/dashboard/window.svg +1 -0
  86. package/dist/agent/agent-cursor.js +138 -0
  87. package/dist/agent/agent-cursor.js.map +1 -0
  88. package/dist/agent/agent-sdk.js +6 -2
  89. package/dist/agent/agent-sdk.js.map +1 -1
  90. package/dist/agent/types.js +1 -1
  91. package/dist/agent/types.js.map +1 -1
  92. package/dist/agent.js +11 -7
  93. package/dist/agent.js.map +1 -1
  94. package/dist/cli/cmd-dashboard.js +63 -0
  95. package/dist/cli/cmd-dashboard.js.map +1 -0
  96. package/dist/cli/cmd-projects.js +128 -0
  97. package/dist/cli/cmd-projects.js.map +1 -0
  98. package/dist/cli/cmd-team.js +587 -0
  99. package/dist/cli/cmd-team.js.map +1 -0
  100. package/dist/cli.js +2 -1
  101. package/dist/cli.js.map +1 -1
  102. package/dist/core/config.js +4 -0
  103. package/dist/core/config.js.map +1 -1
  104. package/dist/core/version.js +1 -1
  105. package/dist/extensions/team-coordinator.js +63 -0
  106. package/dist/extensions/team-coordinator.js.map +1 -0
  107. package/dist/gateway/routes.js +167 -3
  108. package/dist/gateway/routes.js.map +1 -1
  109. package/dist/gateway/ws-handler.js +11 -3
  110. package/dist/gateway/ws-handler.js.map +1 -1
  111. package/dist/runtime/orchestrate.js +19 -8
  112. package/dist/runtime/orchestrate.js.map +1 -1
  113. package/dist/serve.js +15 -17
  114. package/dist/serve.js.map +1 -1
  115. package/dist/session.js +14 -2
  116. package/dist/session.js.map +1 -1
  117. package/dist/team.js +203 -0
  118. package/dist/team.js.map +1 -0
  119. package/dist/telegram/dir-browser.js +9 -0
  120. package/dist/telegram/dir-browser.js.map +1 -1
  121. package/dist/telegram/draft-stream.js +4 -2
  122. package/dist/telegram/draft-stream.js.map +1 -1
  123. package/dist/telegram/terminal.js +65 -31
  124. package/dist/telegram/terminal.js.map +1 -1
  125. package/dist/telegram.js +4 -3
  126. package/dist/telegram.js.map +1 -1
  127. package/dist/tools/admin.js +841 -0
  128. package/dist/tools/admin.js.map +1 -0
  129. package/dist/tools/team.js +182 -0
  130. package/dist/tools/team.js.map +1 -0
  131. package/dist/tui/commands.js +15 -0
  132. package/dist/tui/commands.js.map +1 -1
  133. package/dist/tui/components/welcome.js +2 -1
  134. package/dist/tui/components/welcome.js.map +1 -1
  135. package/dist/tui/tui.js +13 -1
  136. package/dist/tui/tui.js.map +1 -1
  137. package/package.json +3 -1
  138. package/dashboard/_next/static/chunks/172-a2787ae03f0db2b4.js +0 -12
  139. package/dashboard/_next/static/chunks/239-49a9ac3789f8c41c.js +0 -1
  140. package/dashboard/_next/static/chunks/255-102f2e5b2e3dc2ef.js +0 -1
  141. package/dashboard/_next/static/chunks/413-89d8e4554f461999.js +0 -1
  142. package/dashboard/_next/static/chunks/4bd1b696-c023c6e3521b1417.js +0 -1
  143. package/dashboard/_next/static/chunks/619-ba102abea3e3d0e4.js +0 -1
  144. package/dashboard/_next/static/chunks/909-aed3aa549e59d0fb.js +0 -1
  145. package/dashboard/_next/static/chunks/app/_not-found/page-121b856ce9a0ddcd.js +0 -1
  146. package/dashboard/_next/static/chunks/app/dashboard/agents/page-aa6e6fb2a1df7d63.js +0 -1
  147. package/dashboard/_next/static/chunks/app/dashboard/chat/page-feeb17fdc08b91e5.js +0 -1
  148. package/dashboard/_next/static/chunks/app/dashboard/config/page-afad9f4da82a343e.js +0 -1
  149. package/dashboard/_next/static/chunks/app/dashboard/layout-853ce5dfe3461735.js +0 -1
  150. package/dashboard/_next/static/chunks/app/dashboard/monitor/page-1b3d112c49b3a383.js +0 -1
  151. package/dashboard/_next/static/chunks/app/dashboard/page-b15605f3b21f7467.js +0 -1
  152. package/dashboard/_next/static/chunks/app/dashboard/sessions/page-e11d3f3e6ad99067.js +0 -1
  153. package/dashboard/_next/static/chunks/app/docs/[slug]/page-baf0632d98082d10.js +0 -1
  154. package/dashboard/_next/static/chunks/app/docs/page-5933496f46ff00ec.js +0 -1
  155. package/dashboard/_next/static/chunks/app/download/page-da533b5f543dfd66.js +0 -1
  156. package/dashboard/_next/static/chunks/app/layout-1112267c08c875b5.js +0 -1
  157. package/dashboard/_next/static/chunks/app/page-d69c17b39431e2c5.js +0 -1
  158. package/dashboard/_next/static/chunks/framework-de98b93a850cfc71.js +0 -1
  159. package/dashboard/_next/static/chunks/main-8d9a106db393efcf.js +0 -1
  160. package/dashboard/_next/static/chunks/main-app-e38cb42677e65e59.js +0 -1
  161. package/dashboard/_next/static/chunks/pages/_app-7d307437aca18ad4.js +0 -1
  162. package/dashboard/_next/static/chunks/pages/_error-cb2a52f75f2162e2.js +0 -1
  163. package/dashboard/_next/static/chunks/webpack-b2507a6fba7be451.js +0 -1
  164. package/dashboard/_next/static/css/c60b60dc84892a8b.css +0 -5
  165. package/dashboard/_next/static/css/d4ea3c83e49eb5e1.css +0 -4
  166. package/dashboard/_next/static/jjqY4ybx1hNTX-bnJfS2f/_buildManifest.js +0 -1
  167. package/dashboard/_next/static/jjqY4ybx1hNTX-bnJfS2f/_ssgManifest.js +0 -1
  168. package/dashboard/_next/static/media/4cf2300e9c8272f7-s.p.woff2 +0 -0
  169. package/dashboard/_next/static/media/4da3161b738b07dd-s.woff2 +0 -0
  170. package/dashboard/_next/static/media/8d697b304b401681-s.woff2 +0 -0
  171. package/dashboard/_next/static/media/af4bf8399d1aacdf-s.p.woff2 +0 -0
  172. package/dashboard/_next/static/media/ba015fad6dcf6784-s.woff2 +0 -0
  173. package/dashboard/_next/static/media/fb526027db1fc1ae-s.woff2 +0 -0
  174. package/dashboard/agents/index.html +0 -1
  175. package/dashboard/agents/index.txt +0 -28
  176. package/dashboard/chat/index.html +0 -1
  177. package/dashboard/chat/index.txt +0 -28
  178. package/dashboard/config/index.html +0 -1
  179. package/dashboard/config/index.txt +0 -28
  180. package/dashboard/monitor/index.html +0 -1
  181. package/dashboard/monitor/index.txt +0 -28
  182. package/dashboard/sessions/index.html +0 -1
  183. package/dashboard/sessions/index.txt +0 -28
  184. package/dist/cli/cmd-install.js +0 -80
  185. package/dist/cli/cmd-install.js.map +0 -1
  186. package/dist/telegram/bot-approval.js +0 -63
  187. package/dist/telegram/bot-approval.js.map +0 -1
  188. package/dist/telegram/pairing.js +0 -138
  189. package/dist/telegram/pairing.js.map +0 -1
  190. /package/dashboard/_next/{static/chunks/polyfills-42372ed130431b0a.js → _next/static/chunks/03~yq9q893hmn.js} +0 -0
@@ -0,0 +1,11 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,1051,e=>{"use strict";let t,s,r,n,a,i,o,l;var c,d,u,h=e.i(53188),m=e.i(28142);class p{baseUrl;token;constructor(e,t){this.baseUrl=e,this.token=t}headers(){let e={"Content-Type":"application/json"};return this.token&&(e.Authorization=`Bearer ${this.token}`),e}async request(e,t){let s=await fetch(e,{...t,headers:{...this.headers(),...t?.headers}});if(!s.ok){let e=await s.text().catch(()=>"");throw Error(`API error ${s.status}: ${e||s.statusText}`)}return s}async health(){return(await this.request(`${this.baseUrl}/health`)).json()}async sessions(){return(await this.request(`${this.baseUrl}/sessions`)).json()}async sessionMessages(e){return(await this.request(`${this.baseUrl}/sessions/${encodeURIComponent(e)}/messages`)).json()}async deleteSession(e){await this.request(`${this.baseUrl}/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}async agents(){return(await this.request(`${this.baseUrl}/agents`)).json()}async createAgent(e){return(await this.request(`${this.baseUrl}/agents`,{method:"POST",body:JSON.stringify(e)})).json()}async deleteAgent(e){await this.request(`${this.baseUrl}/agents/${encodeURIComponent(e)}`,{method:"DELETE"})}async projects(){return(await this.request(`${this.baseUrl}/projects`)).json()}async addProject(e){return(await this.request(`${this.baseUrl}/projects`,{method:"POST",body:JSON.stringify(e)})).json()}async deleteProject(e){await this.request(`${this.baseUrl}/projects/${encodeURIComponent(e)}`,{method:"DELETE"})}async teams(){return(await this.request(`${this.baseUrl}/teams`)).json()}async team(e){return(await this.request(`${this.baseUrl}/teams/${encodeURIComponent(e)}`)).json()}async teamDiscussion(e,t=16384){return(await this.request(`${this.baseUrl}/teams/${encodeURIComponent(e)}/discussion?tail=${t}`)).text()}async teamState(e){return(await this.request(`${this.baseUrl}/teams/${encodeURIComponent(e)}/state`)).text()}async teamDecisions(e){return(await this.request(`${this.baseUrl}/teams/${encodeURIComponent(e)}/decisions`)).text()}async teamInbox(e,t){return(await this.request(`${this.baseUrl}/teams/${encodeURIComponent(e)}/inbox/${encodeURIComponent(t)}`)).text()}async teamInboxStatus(e){return(await this.request(`${this.baseUrl}/teams/${encodeURIComponent(e)}/inbox-status`)).json()}async teamTopics(e){return(await this.request(`${this.baseUrl}/teams/${encodeURIComponent(e)}/topics`)).json()}async teamRoles(){return(await this.request(`${this.baseUrl}/teams/roles`)).json()}async createTeam(e){return(await this.request(`${this.baseUrl}/teams`,{method:"POST",body:JSON.stringify(e)})).json()}async deleteTeam(e){await this.request(`${this.baseUrl}/teams/${encodeURIComponent(e)}`,{method:"DELETE"})}async getAgentSoul(e){let t=await this.request(`${this.baseUrl}/agents/${encodeURIComponent(e)}/soul`);return(await t.json()).content??""}async updateAgentSoul(e,t){await this.request(`${this.baseUrl}/agents/${encodeURIComponent(e)}/soul`,{method:"PUT",body:JSON.stringify({content:t})})}async getConfig(){return(await this.request(`${this.baseUrl}/config`)).json()}async updateConfig(e){await this.request(`${this.baseUrl}/config`,{method:"PATCH",body:JSON.stringify(e)})}async setCursorKey(e){await this.request(`${this.baseUrl}/config/cursor-key`,{method:"POST",body:JSON.stringify({apiKey:e})})}async getWorkspaceFile(e,t){let s=await this.request(`${this.baseUrl}/agents/${encodeURIComponent(e)}/workspace/${t}`);return(await s.json()).content??""}async updateWorkspaceFile(e,t,s){await this.request(`${this.baseUrl}/agents/${encodeURIComponent(e)}/workspace/${t}`,{method:"PUT",body:JSON.stringify({content:s})})}async getMemoryNotes(e){return(await this.request(`${this.baseUrl}/agents/${encodeURIComponent(e)}/memory`)).json()}async getCronJobs(){return(await this.request(`${this.baseUrl}/cron`)).json()}async getSessionUsage(e){return(await this.request(`${this.baseUrl}/usage/${encodeURIComponent(e)}`)).json()}async getSkills(){return(await this.request(`${this.baseUrl}/skills`)).json()}async getMcpServers(){return(await this.request(`${this.baseUrl}/mcp`)).json()}async cloneAgent(e,t,s){return(await this.request(`${this.baseUrl}/agents/${encodeURIComponent(e)}/clone`,{method:"POST",body:JSON.stringify({newId:t,newName:s})})).json()}async getChannels(){return(await this.request(`${this.baseUrl}/channels`)).json()}async getLogs(){return(await this.request(`${this.baseUrl}/logs`)).json()}async getModels(){return(await this.request(`${this.baseUrl}/models`)).json()}async getPairingRequests(){return(await this.request(`${this.baseUrl}/pairing`)).json()}async approvePairing(e){await this.request(`${this.baseUrl}/pairing/${e}/approve`,{method:"POST"})}async denyPairing(e){await this.request(`${this.baseUrl}/pairing/${e}/deny`,{method:"POST"})}async getBotApprovals(){return(await this.request(`${this.baseUrl}/bot-approvals`)).json()}async approveBotApproval(e){await this.request(`${this.baseUrl}/bot-approvals/${encodeURIComponent(e)}/approve`,{method:"POST"})}async denyBotApproval(e){await this.request(`${this.baseUrl}/bot-approvals/${encodeURIComponent(e)}/deny`,{method:"POST"})}async getPendingApprovals(){return(await this.request(`${this.baseUrl}/approvals/pending`)).json()}async decideApproval(e,t){await this.request(`${this.baseUrl}/approvals/${encodeURIComponent(e)}/decide`,{method:"POST",body:JSON.stringify({decision:t})})}async shutdown(){await this.request(`${this.baseUrl}/shutdown`,{method:"POST"})}exportSessionUrl(e){let t=this.token?`?token=${this.token}`:"";return`${this.baseUrl}/sessions/${encodeURIComponent(e)}/export${t}`}async renderDevPrompt(e,t){try{let s=await fetch(`${this.baseUrl}/dev/prompts`,{method:"POST",headers:this.headers(),body:JSON.stringify({name:e,params:t})});if(s.ok)return s.json()}catch{}let s=t.feature??t.description??t.a??"";return{prompt:`/${e}${s?` ${s}`:""}`}}}class x{ws=null;handlers=new Map;url;token;reconnectTimer=null;constructor(e,t){this.url=e.replace(/^http/,"ws"),this.token=t}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;let e=this.token?`${this.url}?token=${this.token}`:this.url;this.ws=new WebSocket(e),this.ws.onopen=()=>this.emit("connected",{}),this.ws.onclose=()=>{this.emit("disconnected",{}),this.reconnectTimer=setTimeout(()=>this.connect(),3e3)},this.ws.onerror=()=>this.emit("error",{message:"WebSocket error"}),this.ws.onmessage=e=>{try{let t=JSON.parse(e.data);this.emit(t.type,t)}catch{}}}disconnect(){this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.ws?.close(),this.ws=null}send(e){return this.ws?.readyState===WebSocket.OPEN&&(this.ws.send(JSON.stringify(e)),!0)}sendChat(e,t,s){return this.send({type:"chat",message:e,session:t,...s??{}})}abort(){return this.send({type:"abort"})}switchModel(e,t,s){return this.send({type:"model.switch",model:e,...t?{thinking:t}:{},...s?{effort:s}:{}})}compact(e){return this.send({type:"compact",session:e})}requestStatus(e){return this.send({type:"status",session:e})}enterWatchMode(){return this.send({type:"watch"})}decideApproval(e,t){return this.send({type:"approval.decide",id:e,decision:t})}on(e,t){return this.handlers.has(e)||this.handlers.set(e,new Set),this.handlers.get(e).add(t),()=>{this.handlers.get(e)?.delete(t)}}emit(e,t){this.handlers.get(e)?.forEach(e=>e(t)),this.handlers.get("*")?.forEach(s=>s({...t,_event:e}))}get connected(){return this.ws?.readyState===WebSocket.OPEN}}let g=(0,m.createContext)({url:"",token:"",setConnection:()=>{},api:null,ws:null,connected:!1,connecting:!1,error:null});function f(){return(0,m.useContext)(g)}function b({children:e}){let[t,s]=(0,m.useState)(""),[r,n]=(0,m.useState)(""),[a,i]=(0,m.useState)(null),[o,l]=(0,m.useState)(null),[c,d]=(0,m.useState)(!1),[u,f]=(0,m.useState)(!1),[v,y]=(0,m.useState)(null);(0,m.useEffect)(()=>{let e=localStorage.getItem("camelagi_url");e?(s(e),n(localStorage.getItem("camelagi_token")??"")):s(window.location.origin.replace(/\/dashboard.*$/,""))},[]),(0,m.useEffect)(()=>{if(!t)return;o?.disconnect(),f(!0),y(null);let e=new p(t,r||void 0),s=new x(t,r||void 0);e.health().then(()=>{i(e),l(s),s.connect(),f(!1)}).catch(e=>{y(e.message??"Connection failed"),f(!1)});let n=s.on("connected",()=>d(!0)),a=s.on("disconnected",()=>d(!1));return()=>{n(),a(),s.disconnect()}},[t,r]);let j=(0,m.useCallback)((e,t)=>{localStorage.setItem("camelagi_url",e),localStorage.setItem("camelagi_token",t),s(e),n(t)},[]);return(0,h.jsx)(g.Provider,{value:{url:t,token:r,setConnection:j,api:a,ws:o,connected:c,connecting:u,error:v},children:e})}let v=(0,m.createContext)({theme:"light",setTheme:()=>{},toggle:()=>{}});function y({children:e}){let[t,s]=(0,m.useState)("light");(0,m.useEffect)(()=>{let e=localStorage.getItem("camelagi_theme"),t="dark"===e||"light"===e?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";s(t),document.documentElement.classList.toggle("theme-dark","dark"===t),document.documentElement.classList.toggle("dark","dark"===t)},[]);let r=(0,m.useCallback)(e=>{s(e),document.documentElement.classList.toggle("theme-dark","dark"===e),document.documentElement.classList.toggle("dark","dark"===e),localStorage.setItem("camelagi_theme",e)},[]),n=(0,m.useCallback)(()=>{r("dark"===t?"light":"dark")},[t,r]);return(0,h.jsx)(v.Provider,{value:{theme:t,setTheme:r,toggle:n},children:e})}let j=(0,m.createContext)(null),w="camelagi_route";function k({children:e,initial:t="chat"}){let[s,r]=(0,m.useState)(t);(0,m.useEffect)(()=>{try{let e=localStorage.getItem(w);e&&r(e)}catch{}},[]);let n=(0,m.useCallback)(e=>{r(e);try{localStorage.setItem(w,e)}catch{}},[]);return(0,h.jsx)(j.Provider,{value:{route:s,navigate:n,back:()=>{},params:{}},children:e})}function N(){let e=(0,m.useContext)(j);if(!e)throw Error("useRouter must be used inside <RouterProvider>");return e}let S=(...e)=>e.filter((e,t,s)=>!!e&&""!==e.trim()&&s.indexOf(e)===t).join(" ").trim(),C=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,s)=>s?s.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var A={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let M=(0,m.createContext)({}),P=(0,m.forwardRef)(({color:e,size:t,strokeWidth:s,absoluteStrokeWidth:r,className:n="",children:a,iconNode:i,...o},l)=>{let{size:c=24,strokeWidth:d=2,absoluteStrokeWidth:u=!1,color:h="currentColor",className:p=""}=(0,m.useContext)(M)??{},x=r??u?24*Number(s??d)/Number(t??c):s??d;return(0,m.createElement)("svg",{ref:l,...A,width:t??c??A.width,height:t??c??A.height,stroke:e??h,strokeWidth:x,className:S("lucide",p,n),...!a&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(o)&&{"aria-hidden":"true"},...o},[...i.map(([e,t])=>(0,m.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),E=(e,t)=>{let s=(0,m.forwardRef)(({className:s,...r},n)=>(0,m.createElement)(P,{ref:n,iconNode:t,className:S(`lucide-${C(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,s),...r}));return s.displayName=C(e),s},T=E("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]),D=E("bot",[["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"}]]),$=E("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]),R=E("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),_=E("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),F=E("layout-dashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]),V=E("message-square",[["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"}]]),I=E("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]),L=E("plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]]),U=E("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),z=E("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),O=E("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),B=E("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),q=E("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),W=["workspace","agents","ops","settings"],H={workspace:"Workspace",agents:"Agents",ops:"Ops",settings:"Settings"},K={workspace:"chat",agents:"agents",ops:"overview",settings:"config"},G={chat:"workspace",sessions:"workspace",workspace:"workspace",agents:"agents",pairing:"agents",mcp:"agents",skills:"agents",channels:"agents",overview:"ops",monitor:"ops",cron:"ops",logs:"ops",config:"settings",voice:"settings",settings:"settings"},Y={chat:"Chat",sessions:"Sessions",workspace:"Files",agents:"Agents",pairing:"Pairing",mcp:"MCP",skills:"Skills",channels:"Channels",overview:"Overview",monitor:"Monitor",cron:"Cron Jobs",logs:"Logs",config:"Config",voice:"Voice",settings:"App Settings"},X={workspace:[{label:"Workspace",routes:["chat","sessions","workspace"]}],agents:[{label:"Agents",routes:["agents","pairing","mcp","skills","channels"]}],ops:[{label:"Ops",routes:["overview","monitor","cron","logs"]}],settings:[{label:"Settings",routes:["config","voice","settings"]}]},J=(0,m.createContext)(null),Z="desktop.rail.collapsed";function Q({children:e}){let{route:t,navigate:s}=N(),r=G[t]??"workspace",[n,a]=(0,m.useState)(!1);(0,m.useEffect)(()=>{try{"1"===localStorage.getItem(Z)&&a(!0)}catch{}},[]),(0,m.useEffect)(()=>{try{localStorage.setItem(Z,n?"1":"0")}catch{}},[n]);let i=(0,m.useCallback)(()=>a(e=>!e),[]),o=(0,m.useCallback)(e=>{s({workspace:"chat",agents:"agents",ops:"overview",settings:"config"}[e])},[s]),l=(0,m.useMemo)(()=>({terminalOpen:!1,filesOpen:!1,summaryOpen:!1,deployOpen:!1,toggle:()=>{},isOpen:()=>!1}),[]),c=(0,m.useMemo)(()=>({segment:r,railCollapsed:n,toggleRail:i,setRailCollapsed:a,route:t,setRoute:s,setSegment:o,workspacePanels:l}),[r,n,i,t,s,o,l]);return(0,h.jsx)(J.Provider,{value:c,children:e})}function ee(){let e=(0,m.useContext)(J);if(!e)throw Error("useShell must be used inside <ShellProvider>");return e}let et=[{id:"default",label:"Default",hint:"Ask before edits and dangerous commands.",hotkey:1},{id:"acceptEdits",label:"Accept edits",hint:"Auto-accept file edits, still ask for commands.",hotkey:2},{id:"plan",label:"Plan",hint:"Plan first; no edits or commands.",hotkey:3},{id:"bypassPermissions",label:"Bypass",hint:"Don't ask — full auto.",hotkey:4}],es=[{id:"camelagi",label:"CamelAGI",hint:"Default — runs through CamelAGI gateway."},{id:"claude-code",label:"Claude Code",hint:"Direct Claude Code subprocess."}],er=(0,m.createContext)(null);function en({children:e}){let{api:t}=f(),[s,r]=(0,m.useState)("default"),[n,a]=(0,m.useState)("camelagi"),[i,o]=(0,m.useState)(null),[l,c]=(0,m.useState)(null),[d,u]=(0,m.useState)(null),[p,x]=(0,m.useState)([]),[g,b]=(0,m.useState)([]),[v,y]=(0,m.useState)([]);(0,m.useEffect)(()=>{try{let e=localStorage.getItem("camelagi_mode"),t=localStorage.getItem("camelagi_runtime"),s=localStorage.getItem("camelagi_active_project"),n=localStorage.getItem("camelagi_active_agent");e&&et.some(t=>t.id===e)&&r(e),t&&es.some(e=>e.id===t)&&a(t),s&&o(s),n&&c(n)}catch{}},[]);let j=(0,m.useCallback)(e=>{r(e);try{localStorage.setItem("camelagi_mode",e)}catch{}},[]),w=(0,m.useCallback)(e=>{a(e);try{localStorage.setItem("camelagi_runtime",e)}catch{}},[]),k=(0,m.useCallback)(e=>{o(e);try{e?localStorage.setItem("camelagi_active_project",e):localStorage.removeItem("camelagi_active_project")}catch{}},[]),N=(0,m.useCallback)(e=>{c(e);try{e?localStorage.setItem("camelagi_active_agent",e):localStorage.removeItem("camelagi_active_agent")}catch{}},[]),S=(0,m.useCallback)(()=>{t&&t.sessions().then(e=>{y([...e].sort((e,t)=>t.createdAt-e.createdAt))}).catch(()=>{})},[t]),C=(0,m.useCallback)(()=>{t&&t.projects().then(x).catch(()=>x([]))},[t]),A=(0,m.useCallback)(()=>{t&&t.agents().then(b).catch(()=>b([]))},[t]);return(0,m.useEffect)(()=>{S()},[S]),(0,m.useEffect)(()=>{C()},[C]),(0,m.useEffect)(()=>{A()},[A]),(0,h.jsx)(er.Provider,{value:{activeProjectId:i,setActiveProjectId:k,activeAgentId:l,setActiveAgentId:N,mode:s,setMode:j,runtime:n,setRuntime:w,cachedProjects:d,setCachedProjects:u,projects:p,refreshProjects:C,agents:g,refreshAgents:A,sessions:v,refreshSessions:S},children:e})}function ea(){let e=(0,m.useContext)(er);if(!e)throw Error("useDev must be used inside <DevProvider>");return e}let ei=E("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);var eo=m;let el=E("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);class ec extends eo.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){console.error(`[SectionErrorBoundary${this.props.label?`: ${this.props.label}`:""}]`,e,t)}retry=()=>this.setState({hasError:!1});render(){return this.state.hasError?(0,h.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 p-6 text-center h-full",children:[(0,h.jsxs)("p",{className:"text-[13px] text-fg-subtle",children:["Something went wrong",this.props.label?` in ${this.props.label}`:"","."]}),(0,h.jsxs)("button",{onClick:this.retry,className:"inline-flex items-center gap-1.5 h-7 px-3 rounded-md text-[11.5px] font-medium text-fg bg-bg-elevated hover:bg-bg-hover transition-colors shadow-[inset_0_0_0_1px_var(--border-soft)]",children:[(0,h.jsx)(el,{className:"h-3 w-3"}),"Retry"]})]}):this.props.children}}let ed=(0,m.createContext)({pairing:0});function eu({children:e}){return(0,h.jsx)(ed.Provider,{value:{pairing:0},children:e})}function eh(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}e.i(14135);let em=e=>Array.isArray(e);function ep(e,t){if(!Array.isArray(t))return!1;let s=t.length;if(s!==e.length)return!1;for(let r=0;r<s;r++)if(t[r]!==e[r])return!1;return!0}function ex(e){return"string"==typeof e||Array.isArray(e)}function eg(e){let t=[{},{}];return null==e||e.values.forEach((e,s)=>{t[0][s]=e.get(),t[1][s]=e.getVelocity()}),t}function ef(e,t,s,r){if("function"==typeof t){let[n,a]=eg(r);t=t(void 0!==s?s:e.custom,n,a)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){let[n,a]=eg(r);t=t(void 0!==s?s:e.custom,n,a)}return t}function eb(e,t,s){let r=e.getProps();return ef(r,t,void 0!==s?s:r.custom,e)}let ev=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ey=["initial",...ev],ej=e=>e;function ew(e){let t;return()=>(void 0===t&&(t=e()),t)}let ek=ew(()=>void 0!==window.ScrollTimeline);class eN{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>"finished"in e?e.finished:e))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let s=0;s<this.animations.length;s++)this.animations[s][e]=t}attachTimeline(e,t){let s=this.animations.map(s=>ek()&&s.attachTimeline?s.attachTimeline(e):"function"==typeof t?t(s):void 0);return()=>{s.forEach((e,t)=>{e&&e(),this.animations[t].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let t=0;t<this.animations.length;t++)e=Math.max(e,this.animations[t].duration);return e}runAll(e){this.animations.forEach(t=>t[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class eS extends eN{then(e,t){return Promise.all(this.animations).then(e).catch(t)}}let eC=e=>1e3*e;function eA(e){let t=0,s=e.next(t);for(;!s.done&&t<2e4;)t+=50,s=e.next(t);return t>=2e4?1/0:t}function eM(e,t){e.timeline=t,e.onfinish=null}let eP=e=>Array.isArray(e)&&"number"==typeof e[0],eE,eT=(s=ew(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0}),()=>{var e;return null!=(e=eE)?e:s()}),eD=(e,t,s)=>{let r=t-e;return 0===r?1:(s-e)/r},e$=(e,t,s=10)=>{let r="",n=Math.max(Math.round(t/s),2);for(let t=0;t<n;t++)r+=e(eD(0,n-1,t))+", ";return`linear(${r.substring(0,r.length-2)})`},eR=([e,t,s,r])=>`cubic-bezier(${e}, ${t}, ${s}, ${r})`,e_={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:eR([0,.65,.55,1]),circOut:eR([.55,0,1,.45]),backIn:eR([.31,.01,.66,-.59]),backOut:eR([.33,1.53,.69,.99])};function eF(e,t){return e?e[t]||e.default||e:void 0}function eV(e){return"function"==typeof e}let eI=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],eL=new Set(eI),eU=new Set(["width","height","top","left","right","bottom",...eI]),ez=e=>em(e)?e[e.length-1]||0:e,eO=["read","resolveKeyframes","update","preRender","render","postRender"];function eB(e,t){let s=!1,r=!0,n={delta:0,timestamp:0,isProcessing:!1},a=()=>s=!0,i=eO.reduce((e,t)=>(e[t]=function(e){let t=new Set,s=new Set,r=!1,n=!1,a=new WeakSet,i={delta:0,timestamp:0,isProcessing:!1};function o(t){a.has(t)&&(l.schedule(t),e()),t(i)}let l={schedule:(e,n=!1,i=!1)=>{let o=i&&r?t:s;return n&&a.add(e),o.has(e)||o.add(e),e},cancel:e=>{s.delete(e),a.delete(e)},process:e=>{if(i=e,r){n=!0;return}r=!0,[t,s]=[s,t],t.forEach(o),t.clear(),r=!1,n&&(n=!1,l.process(e))}};return l}(a),e),{}),{read:o,resolveKeyframes:l,update:c,preRender:d,render:u,postRender:h}=i,m=()=>{let a=performance.now();s=!1,n.delta=r?1e3/60:Math.max(Math.min(a-n.timestamp,40),1),n.timestamp=a,n.isProcessing=!0,o.process(n),l.process(n),c.process(n),d.process(n),u.process(n),h.process(n),n.isProcessing=!1,s&&t&&(r=!1,e(m))};return{schedule:eO.reduce((t,a)=>{let o=i[a];return t[a]=(t,a=!1,i=!1)=>(!s&&(s=!0,r=!0,n.isProcessing||e(m)),o.schedule(t,a,i)),t},{}),cancel:e=>{for(let t=0;t<eO.length;t++)i[eO[t]].cancel(e)},state:n,steps:i}}let{schedule:eq,cancel:eW,state:eH,steps:eK}=eB("u">typeof requestAnimationFrame?requestAnimationFrame:ej,!0);function eG(){t=void 0}let eY={now:()=>(void 0===t&&eY.set(eH.isProcessing?eH.timestamp:performance.now()),t),set:e=>{t=e,queueMicrotask(eG)}};function eX(e,t){-1===e.indexOf(t)&&e.push(t)}function eJ(e,t){let s=e.indexOf(t);s>-1&&e.splice(s,1)}class eZ{constructor(){this.subscriptions=[]}add(e){return eX(this.subscriptions,e),()=>eJ(this.subscriptions,e)}notify(e,t,s){let r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](e,t,s);else for(let n=0;n<r;n++){let r=this.subscriptions[n];r&&r(e,t,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}class eQ{constructor(e,t={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(e,t=!0)=>{let s=eY.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),t&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=eY.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new eZ);let s=this.events[e].add(t);return"change"===e?()=>{s(),eq.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e,t=!0){t&&this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e,t)}setWithVelocity(e,t,s){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-s}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return o&&o.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var e;let t=eY.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;let s=Math.min(this.updatedAt-this.prevUpdatedAt,30);return e=parseFloat(this.current)-parseFloat(this.prevFrameValue),s?1e3/s*e:0}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function e0(e,t){return new eQ(e,t)}let e1=e=>!!(e&&e.getVelocity);function e2(e,t){let s=e.getValue("willChange");if(e1(s)&&s.add)return s.add(t)}let e5=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),e3="data-"+e5("framerAppearId"),e4=(e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e;function e6(e,t,s,r){return e===t&&s===r?ej:n=>0===n||1===n?n:e4(function(e,t,s,r,n){let a,i,o=0;do(a=e4(i=t+(s-t)/2,r,n)-e)>0?s=i:t=i;while(Math.abs(a)>1e-7&&++o<12)return i}(n,0,1,e,s),t,r)}let e9=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,e8=e=>t=>1-e(1-t),e7=e6(.33,1.53,.69,.99),te=e8(e7),tt=e9(te),ts=e=>(e*=2)<1?.5*te(e):.5*(2-Math.pow(2,-10*(e-1))),tr=e=>1-Math.sin(Math.acos(e)),tn=e8(tr),ta=e9(tr),ti=(e,t,s)=>s>t?t:s<e?e:s,to={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},tl={...to,transform:e=>ti(0,1,e)},tc={...to,default:1},td=e=>Math.round(1e5*e)/1e5,tu=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,th=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,tm=(e,t)=>s=>!!("string"==typeof s&&th.test(s)&&s.startsWith(e)||t&&null!=s&&Object.prototype.hasOwnProperty.call(s,t)),tp=(e,t,s)=>r=>{if("string"!=typeof r)return r;let[n,a,i,o]=r.match(tu);return{[e]:parseFloat(n),[t]:parseFloat(a),[s]:parseFloat(i),alpha:void 0!==o?parseFloat(o):1}},tx={...to,transform:e=>Math.round(ti(0,255,e))},tg={test:tm("rgb","red"),parse:tp("red","green","blue"),transform:({red:e,green:t,blue:s,alpha:r=1})=>"rgba("+tx.transform(e)+", "+tx.transform(t)+", "+tx.transform(s)+", "+td(tl.transform(r))+")"},tf={test:tm("#"),parse:function(e){let t="",s="",r="",n="";return e.length>5?(t=e.substring(1,3),s=e.substring(3,5),r=e.substring(5,7),n=e.substring(7,9)):(t=e.substring(1,2),s=e.substring(2,3),r=e.substring(3,4),n=e.substring(4,5),t+=t,s+=s,r+=r,n+=n),{red:parseInt(t,16),green:parseInt(s,16),blue:parseInt(r,16),alpha:n?parseInt(n,16)/255:1}},transform:tg.transform},tb=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),tv=tb("deg"),ty=tb("%"),tj=tb("px"),tw=tb("vh"),tk=tb("vw"),tN={...ty,parse:e=>ty.parse(e)/100,transform:e=>ty.transform(100*e)},tS={test:tm("hsl","hue"),parse:tp("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:s,alpha:r=1})=>"hsla("+Math.round(e)+", "+ty.transform(td(t))+", "+ty.transform(td(s))+", "+td(tl.transform(r))+")"},tC={test:e=>tg.test(e)||tf.test(e)||tS.test(e),parse:e=>tg.test(e)?tg.parse(e):tS.test(e)?tS.parse(e):tf.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?tg.transform(e):tS.transform(e)},tA=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,tM="number",tP="color",tE=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function tT(e){let t=e.toString(),s=[],r={color:[],number:[],var:[]},n=[],a=0,i=t.replace(tE,e=>(tC.test(e)?(r.color.push(a),n.push(tP),s.push(tC.parse(e))):e.startsWith("var(")?(r.var.push(a),n.push("var"),s.push(e)):(r.number.push(a),n.push(tM),s.push(parseFloat(e))),++a,"${}")).split("${}");return{values:s,split:i,indexes:r,types:n}}function tD(e){return tT(e).values}function t$(e){let{split:t,types:s}=tT(e),r=t.length;return e=>{let n="";for(let a=0;a<r;a++)if(n+=t[a],void 0!==e[a]){let t=s[a];t===tM?n+=td(e[a]):t===tP?n+=tC.transform(e[a]):n+=e[a]}return n}}let tR=e=>"number"==typeof e?0:e,t_={test:function(e){var t,s;return isNaN(e)&&"string"==typeof e&&((null==(t=e.match(tu))?void 0:t.length)||0)+((null==(s=e.match(tA))?void 0:s.length)||0)>0},parse:tD,createTransformer:t$,getAnimatableNone:function(e){let t=tD(e);return t$(e)(t.map(tR))}},tF=new Set(["brightness","contrast","saturate","opacity"]);function tV(e){let[t,s]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;let[r]=s.match(tu)||[];if(!r)return e;let n=s.replace(r,""),a=+!!tF.has(t);return r!==s&&(a*=100),t+"("+a+n+")"}let tI=/\b([a-z-]*)\(.*?\)/gu,tL={...t_,getAnimatableNone:e=>{let t=e.match(tI);return t?t.map(tV).join(" "):e}},tU={...to,transform:Math.round},tz={borderWidth:tj,borderTopWidth:tj,borderRightWidth:tj,borderBottomWidth:tj,borderLeftWidth:tj,borderRadius:tj,radius:tj,borderTopLeftRadius:tj,borderTopRightRadius:tj,borderBottomRightRadius:tj,borderBottomLeftRadius:tj,width:tj,maxWidth:tj,height:tj,maxHeight:tj,top:tj,right:tj,bottom:tj,left:tj,padding:tj,paddingTop:tj,paddingRight:tj,paddingBottom:tj,paddingLeft:tj,margin:tj,marginTop:tj,marginRight:tj,marginBottom:tj,marginLeft:tj,backgroundPositionX:tj,backgroundPositionY:tj,rotate:tv,rotateX:tv,rotateY:tv,rotateZ:tv,scale:tc,scaleX:tc,scaleY:tc,scaleZ:tc,skew:tv,skewX:tv,skewY:tv,distance:tj,translateX:tj,translateY:tj,translateZ:tj,x:tj,y:tj,z:tj,perspective:tj,transformPerspective:tj,opacity:tl,originX:tN,originY:tN,originZ:tj,zIndex:tU,size:tj,fillOpacity:tl,strokeOpacity:tl,numOctaves:tU},tO={...tz,color:tC,backgroundColor:tC,outlineColor:tC,fill:tC,stroke:tC,borderColor:tC,borderTopColor:tC,borderRightColor:tC,borderBottomColor:tC,borderLeftColor:tC,filter:tL,WebkitFilter:tL},tB=e=>tO[e];function tq(e,t){let s=tB(e);return s!==tL&&(s=t_),s.getAnimatableNone?s.getAnimatableNone(t):void 0}let tW=new Set(["auto","none","0"]),tH=e=>e===to||e===tj,tK=(e,t)=>parseFloat(e.split(", ")[t]),tG=(e,t)=>(s,{transform:r})=>{if("none"===r||!r)return 0;let n=r.match(/^matrix3d\((.+)\)$/u);if(n)return tK(n[1],t);{let t=r.match(/^matrix\((.+)\)$/u);return t?tK(t[1],e):0}},tY=new Set(["x","y","z"]),tX=eI.filter(e=>!tY.has(e)),tJ={width:({x:e},{paddingLeft:t="0",paddingRight:s="0"})=>e.max-e.min-parseFloat(t)-parseFloat(s),height:({y:e},{paddingTop:t="0",paddingBottom:s="0"})=>e.max-e.min-parseFloat(t)-parseFloat(s),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:tG(4,13),y:tG(5,14)};tJ.translateX=tJ.x,tJ.translateY=tJ.y;let tZ=new Set,tQ=!1,t0=!1;function t1(){if(t0){let e=Array.from(tZ).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),s=new Map;t.forEach(e=>{let t,r=(t=[],tX.forEach(s=>{let r=e.getValue(s);void 0!==r&&(t.push([s,r.get()]),r.set(+!!s.startsWith("scale")))}),t);r.length&&(s.set(e,r),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=s.get(e);t&&t.forEach(([t,s])=>{var r;null==(r=e.getValue(t))||r.set(s)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}t0=!1,tQ=!1,tZ.forEach(e=>e.complete()),tZ.clear()}function t2(){tZ.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(t0=!0)})}class t5{constructor(e,t,s,r,n,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=s,this.motionValue=r,this.element=n,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(tZ.add(this),tQ||(tQ=!0,eq.read(t2),eq.resolveKeyframes(t1))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:s,motionValue:r}=this;for(let n=0;n<e.length;n++)if(null===e[n])if(0===n){let n=null==r?void 0:r.get(),a=e[e.length-1];if(void 0!==n)e[0]=n;else if(s&&t){let r=s.readValue(t,a);null!=r&&(e[0]=r)}void 0===e[0]&&(e[0]=a),r&&void 0===n&&r.set(e[0])}else e[n]=e[n-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),tZ.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,tZ.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}let t3=e=>t=>"string"==typeof t&&t.startsWith(e),t4=t3("--"),t6=t3("var(--"),t9=e=>!!t6(e)&&t8.test(e.split("/*")[0].trim()),t8=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,t7=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,se=e=>t=>t.test(e),st=[to,tj,ty,tv,tk,tw,{test:e=>"auto"===e,parse:e=>e}],ss=e=>st.find(se(e));class sr extends t5{constructor(e,t,s,r,n){super(e,t,s,r,n,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:s}=this;if(!t||!t.current)return;super.readKeyframes();for(let s=0;s<e.length;s++){let r=e[s];if("string"==typeof r&&t9(r=r.trim())){let n=function e(t,s,r=1){ej(r<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);let[n,a]=function(e){let t=t7.exec(e);if(!t)return[,];let[,s,r,n]=t;return[`--${null!=s?s:r}`,n]}(t);if(!n)return;let i=window.getComputedStyle(s).getPropertyValue(n);if(i){let e=i.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e)?parseFloat(e):e}return t9(a)?e(a,s,r+1):a}(r,t.current);void 0!==n&&(e[s]=n),s===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!eU.has(s)||2!==e.length)return;let[r,n]=e,a=ss(r),i=ss(n);if(a!==i)if(tH(a)&&tH(i))for(let t=0;t<e.length;t++){let s=e[t];"string"==typeof s&&(e[t]=parseFloat(s))}else this.needsMeasurement=!0}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,s=[];for(let t=0;t<e.length;t++)(function(e){if("number"==typeof e)return 0===e;if(null===e)return!0;return"none"===e||"0"===e||/^0[^.\s]+$/u.test(e)})(e[t])&&s.push(t);s.length&&function(e,t,s){let r,n=0;for(;n<e.length&&!r;){let t=e[n];"string"==typeof t&&!tW.has(t)&&tT(t).values.length&&(r=e[n]),n++}if(r&&s)for(let n of t)e[n]=tq(s,r)}(e,s,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:s}=this;if(!e||!e.current)return;"height"===s&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=tJ[s](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];void 0!==r&&e.getValue(s,r).jump(r,!1)}measureEndState(){var e;let{element:t,name:s,unresolvedKeyframes:r}=this;if(!t||!t.current)return;let n=t.getValue(s);n&&n.jump(this.measuredOrigin,!1);let a=r.length-1,i=r[a];r[a]=tJ[s](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==i&&void 0===this.finalKeyframe&&(this.finalKeyframe=i),(null==(e=this.removedTransforms)?void 0:e.length)&&this.removedTransforms.forEach(([e,s])=>{t.getValue(e).set(s)}),this.resolveNoneKeyframes()}}let sn=(e,t)=>"zIndex"!==t&&!!("number"==typeof e||Array.isArray(e)||"string"==typeof e&&(t_.test(e)||"0"===e)&&!e.startsWith("url(")),sa=e=>null!==e;function si(e,{repeat:t,repeatType:s="loop"},r){let n=e.filter(sa),a=t&&"loop"!==s&&t%2==1?0:n.length-1;return a&&void 0!==r?r:n[a]}class so{constructor({autoplay:e=!0,delay:t=0,type:s="keyframes",repeat:r=0,repeatDelay:n=0,repeatType:a="loop",...i}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=eY.now(),this.options={autoplay:e,delay:t,type:s,repeat:r,repeatDelay:n,repeatType:a,...i},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(t2(),t1()),this._resolved}onKeyframesResolved(e,t){this.resolvedAt=eY.now(),this.hasAttemptedResolve=!0;let{name:s,type:r,velocity:n,delay:a,onComplete:i,onUpdate:o,isGenerator:l}=this.options;if(!l&&!function(e,t,s,r){let n=e[0];if(null===n)return!1;if("display"===t||"visibility"===t)return!0;let a=e[e.length-1],i=sn(n,t),o=sn(a,t);return ej(i===o,`You are trying to animate ${t} from "${n}" to "${a}". ${n} is not an animatable value - to enable this animation set ${n} to a value animatable to ${a} via the \`style\` property.`),!!i&&!!o&&(function(e){let t=e[0];if(1===e.length)return!0;for(let s=0;s<e.length;s++)if(e[s]!==t)return!0}(e)||("spring"===s||eV(s))&&r)}(e,s,r,n))if(a)this.options.duration=0;else{o&&o(si(e,this.options,t)),i&&i(),this.resolveFinishedPromise();return}let c=this.initPlayback(e,t);!1!==c&&(this._resolved={keyframes:e,finalKeyframe:t,...c},this.onPostResolved())}onPostResolved(){}then(e,t){return this.currentFinishedPromise.then(e,t)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}let sl=(e,t,s)=>e+(t-e)*s;function sc(e,t,s){return(s<0&&(s+=1),s>1&&(s-=1),s<1/6)?e+(t-e)*6*s:s<.5?t:s<2/3?e+(t-e)*(2/3-s)*6:e}function sd(e,t){return s=>s>0?t:e}let su=(e,t,s)=>{let r=e*e,n=s*(t*t-r)+r;return n<0?0:Math.sqrt(n)},sh=[tf,tg,tS];function sm(e){let t=sh.find(t=>t.test(e));if(ej(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`),!t)return!1;let s=t.parse(e);return t===tS&&(s=function({hue:e,saturation:t,lightness:s,alpha:r}){e/=360,s/=100;let n=0,a=0,i=0;if(t/=100){let r=s<.5?s*(1+t):s+t-s*t,o=2*s-r;n=sc(o,r,e+1/3),a=sc(o,r,e),i=sc(o,r,e-1/3)}else n=a=i=s;return{red:Math.round(255*n),green:Math.round(255*a),blue:Math.round(255*i),alpha:r}}(s)),s}let sp=(e,t)=>{let s=sm(e),r=sm(t);if(!s||!r)return sd(e,t);let n={...s};return e=>(n.red=su(s.red,r.red,e),n.green=su(s.green,r.green,e),n.blue=su(s.blue,r.blue,e),n.alpha=sl(s.alpha,r.alpha,e),tg.transform(n))},sx=(e,t)=>s=>t(e(s)),sg=(...e)=>e.reduce(sx),sf=new Set(["none","hidden"]);function sb(e,t){return s=>sl(e,t,s)}function sv(e){return"number"==typeof e?sb:"string"==typeof e?t9(e)?sd:tC.test(e)?sp:sw:Array.isArray(e)?sy:"object"==typeof e?tC.test(e)?sp:sj:sd}function sy(e,t){let s=[...e],r=s.length,n=e.map((e,s)=>sv(e)(e,t[s]));return e=>{for(let t=0;t<r;t++)s[t]=n[t](e);return s}}function sj(e,t){let s={...e,...t},r={};for(let n in s)void 0!==e[n]&&void 0!==t[n]&&(r[n]=sv(e[n])(e[n],t[n]));return e=>{for(let t in r)s[t]=r[t](e);return s}}let sw=(e,t)=>{let s=t_.createTransformer(t),r=tT(e),n=tT(t);if(!(r.indexes.var.length===n.indexes.var.length&&r.indexes.color.length===n.indexes.color.length&&r.indexes.number.length>=n.indexes.number.length))return ej(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),sd(e,t);if(sf.has(e)&&!n.values.length||sf.has(t)&&!r.values.length)return sf.has(e)?s=>s<=0?e:t:s=>s>=1?t:e;return sg(sy(function(e,t){var s;let r=[],n={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){let i=t.types[a],o=e.indexes[i][n[i]],l=null!=(s=e.values[o])?s:0;r[a]=l,n[i]++}return r}(r,n),n.values),s)};function sk(e,t,s){return"number"==typeof e&&"number"==typeof t&&"number"==typeof s?sl(e,t,s):sv(e)(e,t)}function sN(e,t,s){var r,n;let a=Math.max(t-5,0);return r=s-e(a),(n=t-a)?1e3/n*r:0}let sS=.01,sC=2,sA=.005,sM=.5;function sP(e,t){return e*Math.sqrt(1-t*t)}let sE=["duration","bounce"],sT=["stiffness","damping","mass"];function sD(e,t){return t.some(t=>void 0!==e[t])}function s$(e=.3,t=.3){let s,r="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e,{restSpeed:n,restDelta:a}=r,i=r.keyframes[0],o=r.keyframes[r.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:d,mass:u,duration:h,velocity:m,isResolvedFromDuration:p}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!sD(e,sT)&&sD(e,sE))if(e.visualDuration){let s=2*Math.PI/(1.2*e.visualDuration),r=s*s,n=2*ti(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:1,stiffness:r,damping:n}}else{let s=function({duration:e=800,bounce:t=.3,velocity:s=0,mass:r=1}){let n,a;ej(e<=eC(10),"Spring duration must be 10 seconds or less");let i=1-t;i=ti(.05,1,i),e=ti(.01,10,e/1e3),i<1?(n=t=>{let r=t*i,n=r*e;return .001-(r-s)/sP(t,i)*Math.exp(-n)},a=t=>{let r=t*i*e,a=Math.pow(i,2)*Math.pow(t,2)*e,o=Math.exp(-r),l=sP(Math.pow(t,2),i);return(r*s+s-a)*o*(-n(t)+.001>0?-1:1)/l}):(n=t=>-.001+Math.exp(-t*e)*((t-s)*e+1),a=t=>e*e*(s-t)*Math.exp(-t*e));let o=function(e,t,s){let r=s;for(let s=1;s<12;s++)r-=e(r)/t(r);return r}(n,a,5/e);if(e=eC(e),isNaN(o))return{stiffness:100,damping:10,duration:e};{let t=Math.pow(o,2)*r;return{stiffness:t,damping:2*i*Math.sqrt(r*t),duration:e}}}(e);(t={...t,...s,mass:1}).isResolvedFromDuration=!0}return t}({...r,velocity:-((r.velocity||0)/1e3)}),x=m||0,g=d/(2*Math.sqrt(c*u)),f=o-i,b=Math.sqrt(c/u)/1e3,v=5>Math.abs(f);if(n||(n=v?sS:sC),a||(a=v?sA:sM),g<1){let e=sP(b,g);s=t=>o-Math.exp(-g*b*t)*((x+g*b*f)/e*Math.sin(e*t)+f*Math.cos(e*t))}else if(1===g)s=e=>o-Math.exp(-b*e)*(f+(x+b*f)*e);else{let e=b*Math.sqrt(g*g-1);s=t=>{let s=Math.exp(-g*b*t),r=Math.min(e*t,300);return o-s*((x+g*b*f)*Math.sinh(r)+e*f*Math.cosh(r))/e}}let y={calculatedDuration:p&&h||null,next:e=>{let t=s(e);if(p)l.done=e>=h;else{let r=0;g<1&&(r=0===e?eC(x):sN(s,e,t));let i=Math.abs(o-t)<=a;l.done=Math.abs(r)<=n&&i}return l.value=l.done?o:t,l},toString:()=>{let e=Math.min(eA(y),2e4),t=e$(t=>y.next(e*t).value,e,30);return e+"ms "+t}};return y}function sR({keyframes:e,velocity:t=0,power:s=.8,timeConstant:r=325,bounceDamping:n=10,bounceStiffness:a=500,modifyTarget:i,min:o,max:l,restDelta:c=.5,restSpeed:d}){let u,h,m=e[0],p={done:!1,value:m},x=s*t,g=m+x,f=void 0===i?g:i(g);f!==g&&(x=f-m);let b=e=>-x*Math.exp(-e/r),v=e=>f+b(e),y=e=>{let t=b(e),s=v(e);p.done=Math.abs(t)<=c,p.value=p.done?f:s},j=e=>{let t;if(t=p.value,void 0!==o&&t<o||void 0!==l&&t>l){var s;u=e,h=s$({keyframes:[p.value,(s=p.value,void 0===o?l:void 0===l||Math.abs(o-s)<Math.abs(l-s)?o:l)],velocity:sN(v,e,p.value),damping:n,stiffness:a,restDelta:c,restSpeed:d})}};return j(0),{calculatedDuration:null,next:e=>{let t=!1;return(h||void 0!==u||(t=!0,y(e),j(e)),void 0!==u&&e>=u)?h.next(e-u):(t||y(e),p)}}}let s_=e6(.42,0,1,1),sF=e6(0,0,.58,1),sV=e6(.42,0,.58,1),sI={linear:ej,easeIn:s_,easeInOut:sV,easeOut:sF,circIn:tr,circInOut:ta,circOut:tn,backIn:te,backInOut:tt,backOut:e7,anticipate:ts},sL=e=>{if(eP(e)){ej(4===e.length,"Cubic bezier arrays must contain four numerical values.");let[t,s,r,n]=e;return e6(t,s,r,n)}return"string"==typeof e?(ej(void 0!==sI[e],`Invalid easing type '${e}'`),sI[e]):e};function sU({duration:e=300,keyframes:t,times:s,ease:r="easeInOut"}){var n;let a,i=Array.isArray(r)&&"number"!=typeof r[0]?r.map(sL):sL(r),o={done:!1,value:t[0]},l=function(e,t,{clamp:s=!0,ease:r,mixer:n}={}){let a=e.length;if(ej(a===t.length,"Both input and output ranges must be the same length"),1===a)return()=>t[0];if(2===a&&t[0]===t[1])return()=>t[1];let i=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let o=function(e,t,s){let r=[],n=s||sk,a=e.length-1;for(let s=0;s<a;s++){let a=n(e[s],e[s+1]);t&&(a=sg(Array.isArray(t)?t[s]||ej:t,a)),r.push(a)}return r}(t,r,n),l=o.length,c=s=>{if(i&&s<e[0])return t[0];let r=0;if(l>1)for(;r<e.length-2&&!(s<e[r+1]);r++);let n=eD(e[r],e[r+1],s);return o[r](n)};return s?t=>c(ti(e[0],e[a-1],t)):c}((n=s&&s.length===t.length?s:(!function(e,t){let s=e[e.length-1];for(let r=1;r<=t;r++){let n=eD(0,t,r);e.push(sl(s,1,n))}}(a=[0],t.length-1),a),n.map(t=>t*e)),t,{ease:Array.isArray(i)?i:t.map(()=>i||sV).splice(0,t.length-1)});return{calculatedDuration:e,next:t=>(o.value=l(t),o.done=t>=e,o)}}let sz=e=>{let t=({timestamp:t})=>e(t);return{start:()=>eq.update(t,!0),stop:()=>eW(t),now:()=>eH.isProcessing?eH.timestamp:eY.now()}},sO={decay:sR,inertia:sR,tween:sU,keyframes:sU,spring:s$},sB=e=>e/100;class sq extends so{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();let{onStop:e}=this.options;e&&e()};const{name:t,motionValue:s,element:r,keyframes:n}=this.options,a=(null==r?void 0:r.KeyframeResolver)||t5,i=(e,t)=>this.onKeyframesResolved(e,t);this.resolver=new a(n,i,t,s,r),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){let t,s,{type:r="keyframes",repeat:n=0,repeatDelay:a=0,repeatType:i,velocity:o=0}=this.options,l=eV(r)?r:sO[r]||sU;l!==sU&&"number"!=typeof e[0]&&(t=sg(sB,sk(e[0],e[1])),e=[0,100]);let c=l({...this.options,keyframes:e});"mirror"===i&&(s=l({...this.options,keyframes:[...e].reverse(),velocity:-o})),null===c.calculatedDuration&&(c.calculatedDuration=eA(c));let{calculatedDuration:d}=c,u=d+a;return{generator:c,mirroredGenerator:s,mapPercentToKeyframes:t,calculatedDuration:d,resolvedDuration:u,totalDuration:u*(n+1)-a}}onPostResolved(){let{autoplay:e=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&e?this.state=this.pendingPlayState:this.pause()}tick(e,t=!1){let{resolved:s}=this;if(!s){let{keyframes:e}=this.options;return{done:!0,value:e[e.length-1]}}let{finalKeyframe:r,generator:n,mirroredGenerator:a,mapPercentToKeyframes:i,keyframes:o,calculatedDuration:l,totalDuration:c,resolvedDuration:d}=s;if(null===this.startTime)return n.next(0);let{delay:u,repeat:h,repeatType:m,repeatDelay:p,onUpdate:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-c/this.speed,this.startTime)),t?this.currentTime=e:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;let g=this.currentTime-u*(this.speed>=0?1:-1),f=this.speed>=0?g<0:g>c;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=c);let b=this.currentTime,v=n;if(h){let e=Math.min(this.currentTime,c)/d,t=Math.floor(e),s=e%1;!s&&e>=1&&(s=1),1===s&&t--,(t=Math.min(t,h+1))%2&&("reverse"===m?(s=1-s,p&&(s-=p/d)):"mirror"===m&&(v=a)),b=ti(0,1,s)*d}let y=f?{done:!1,value:o[0]}:v.next(b);i&&(y.value=i(y.value));let{done:j}=y;f||null===l||(j=this.speed>=0?this.currentTime>=c:this.currentTime<=0);let w=null===this.holdTime&&("finished"===this.state||"running"===this.state&&j);return w&&void 0!==r&&(y.value=si(o,this.options,r)),x&&x(y.value),w&&this.finish(),y}get duration(){let{resolved:e}=this;return e?e.calculatedDuration/1e3:0}get time(){return this.currentTime/1e3}set time(e){e=eC(e),this.currentTime=e,null!==this.holdTime||0===this.speed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=this.currentTime/1e3)}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;let{driver:e=sz,onPlay:t,startTime:s}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),t&&t();let r=this.driver.now();null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=r):this.startTime=null!=s?s:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=null!=(e=this.currentTime)?e:0}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";let{onComplete:e}=this.options;e&&e()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}let sW=new Set(["opacity","clipPath","filter","transform"]),sH=ew(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),sK={anticipate:ts,backInOut:tt,circInOut:ta};class sG extends so{constructor(e){super(e);const{name:t,motionValue:s,element:r,keyframes:n}=this.options;this.resolver=new sr(n,(e,t)=>this.onKeyframesResolved(e,t),t,s,r),this.resolver.scheduleResolve()}initPlayback(e,t){var s;let{duration:r=300,times:n,ease:a,type:i,motionValue:o,name:l,startTime:c}=this.options;if(!o.owner||!o.owner.current)return!1;if("string"==typeof a&&eT()&&a in sK&&(a=sK[a]),eV((s=this.options).type)||"spring"===s.type||!function e(t){return!!("function"==typeof t&&eT()||!t||"string"==typeof t&&(t in e_||eT())||eP(t)||Array.isArray(t)&&t.every(e))}(s.ease)){let{onComplete:t,onUpdate:s,motionValue:o,element:l,...c}=this.options,d=function(e,t){let s=new sq({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0}),r={done:!1,value:e[0]},n=[],a=0;for(;!r.done&&a<2e4;)n.push((r=s.sample(a)).value),a+=10;return{times:void 0,keyframes:n,duration:a-10,ease:"linear"}}(e,c);1===(e=d.keyframes).length&&(e[1]=e[0]),r=d.duration,n=d.times,a=d.ease,i="keyframes"}let d=function(e,t,s,{delay:r=0,duration:n=300,repeat:a=0,repeatType:i="loop",ease:o="easeInOut",times:l}={}){let c={[t]:s};l&&(c.offset=l);let d=function e(t,s){if(t)return"function"==typeof t&&eT()?e$(t,s):eP(t)?eR(t):Array.isArray(t)?t.map(t=>e(t,s)||e_.easeOut):e_[t]}(o,n);return Array.isArray(d)&&(c.easing=d),e.animate(c,{delay:r,duration:n,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:a+1,direction:"reverse"===i?"alternate":"normal"})}(o.owner.current,l,e,{...this.options,duration:r,times:n,ease:a});return d.startTime=null!=c?c:this.calcStartTime(),this.pendingTimeline?(eM(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{let{onComplete:s}=this.options;o.set(si(e,this.options,t)),s&&s(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:n,type:i,ease:a,keyframes:e}}get duration(){let{resolved:e}=this;if(!e)return 0;let{duration:t}=e;return t/1e3}get time(){let{resolved:e}=this;if(!e)return 0;let{animation:t}=e;return(t.currentTime||0)/1e3}set time(e){let{resolved:t}=this;if(!t)return;let{animation:s}=t;s.currentTime=eC(e)}get speed(){let{resolved:e}=this;if(!e)return 1;let{animation:t}=e;return t.playbackRate}set speed(e){let{resolved:t}=this;if(!t)return;let{animation:s}=t;s.playbackRate=e}get state(){let{resolved:e}=this;if(!e)return"idle";let{animation:t}=e;return t.playState}get startTime(){let{resolved:e}=this;if(!e)return null;let{animation:t}=e;return t.startTime}attachTimeline(e){if(this._resolved){let{resolved:t}=this;if(!t)return ej;let{animation:s}=t;eM(s,e)}else this.pendingTimeline=e;return ej}play(){if(this.isStopped)return;let{resolved:e}=this;if(!e)return;let{animation:t}=e;"finished"===t.playState&&this.updateFinishedPromise(),t.play()}pause(){let{resolved:e}=this;if(!e)return;let{animation:t}=e;t.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();let{resolved:e}=this;if(!e)return;let{animation:t,keyframes:s,duration:r,type:n,ease:a,times:i}=e;if("idle"===t.playState||"finished"===t.playState)return;if(this.time){let{motionValue:e,onUpdate:t,onComplete:o,element:l,...c}=this.options,d=new sq({...c,keyframes:s,duration:r,type:n,ease:a,times:i,isGenerator:!0}),u=eC(this.time);e.setWithVelocity(d.sample(u-10).value,d.sample(u).value,10)}let{onStop:o}=this.options;o&&o(),this.cancel()}complete(){let{resolved:e}=this;e&&e.animation.finish()}cancel(){let{resolved:e}=this;e&&e.animation.cancel()}static supports(e){let{motionValue:t,name:s,repeatDelay:r,repeatType:n,damping:a,type:i}=e;if(!t||!t.owner||!(t.owner.current instanceof HTMLElement))return!1;let{onUpdate:o,transformTemplate:l}=t.owner.getProps();return sH()&&s&&sW.has(s)&&!o&&!l&&!r&&"mirror"!==n&&0!==a&&"inertia"!==i}}let sY={type:"spring",stiffness:500,damping:25,restSpeed:10},sX={type:"keyframes",duration:.8},sJ={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},sZ=(e,t,s,r={},n,a)=>i=>{let o=eF(r,e)||{},l=o.delay||r.delay||0,{elapsed:c=0}=r;c-=eC(l);let d={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-c,onUpdate:e=>{t.set(e),o.onUpdate&&o.onUpdate(e)},onComplete:()=>{i(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:a?void 0:n};!function({when:e,delay:t,delayChildren:s,staggerChildren:r,staggerDirection:n,repeat:a,repeatType:i,repeatDelay:o,from:l,elapsed:c,...d}){return!!Object.keys(d).length}(o)&&(d={...d,...((e,{keyframes:t})=>t.length>2?sX:eL.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:sY:sJ)(e,d)}),d.duration&&(d.duration=eC(d.duration)),d.repeatDelay&&(d.repeatDelay=eC(d.repeatDelay)),void 0!==d.from&&(d.keyframes[0]=d.from);let u=!1;if(!1!==d.type&&(0!==d.duration||d.repeatDelay)||(d.duration=0,0===d.delay&&(u=!0)),u&&!a&&void 0!==t.get()){let e=si(d.keyframes,o);if(void 0!==e)return eq.update(()=>{d.onUpdate(e),d.onComplete()}),new eS([])}return!a&&sG.supports(d)?new sG(d):new sq(d)};function sQ(e,t,{delay:s=0,transitionOverride:r,type:n}={}){var a;let{transition:i=e.getDefaultTransition(),transitionEnd:o,...l}=t;r&&(i=r);let c=[],d=n&&e.animationState&&e.animationState.getState()[n];for(let t in l){let r=e.getValue(t,null!=(a=e.latestValues[t])?a:null),n=l[t];if(void 0===n||d&&function({protectedKeys:e,needsAnimating:t},s){let r=e.hasOwnProperty(s)&&!0!==t[s];return t[s]=!1,r}(d,t))continue;let o={delay:s,...eF(i||{},t)},u=!1;if(window.MotionHandoffAnimation){let s=e.props[e3];if(s){let e=window.MotionHandoffAnimation(s,t,eq);null!==e&&(o.startTime=e,u=!0)}}e2(e,t),r.start(sZ(t,r,n,e.shouldReduceMotion&&eU.has(t)?{type:!1}:o,e,u));let h=r.animation;h&&c.push(h)}return o&&Promise.all(c).then(()=>{eq.update(()=>{o&&function(e,t){let{transitionEnd:s={},transition:r={},...n}=eb(e,t)||{};for(let t in n={...n,...s}){let s=ez(n[t]);e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,e0(s))}}(e,o)})}),c}function s0(e,t,s={}){var r;let n=eb(e,t,"exit"===s.type?null==(r=e.presenceContext)?void 0:r.custom:void 0),{transition:a=e.getDefaultTransition()||{}}=n||{};s.transitionOverride&&(a=s.transitionOverride);let i=n?()=>Promise.all(sQ(e,n,s)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:n=0,staggerChildren:i,staggerDirection:o}=a;return function(e,t,s=0,r=0,n=1,a){let i=[],o=(e.variantChildren.size-1)*r,l=1===n?(e=0)=>e*r:(e=0)=>o-e*r;return Array.from(e.variantChildren).sort(s1).forEach((e,r)=>{e.notify("AnimationStart",t),i.push(s0(e,t,{...a,delay:s+l(r)}).then(()=>e.notify("AnimationComplete",t)))}),Promise.all(i)}(e,t,n+r,i,o,s)}:()=>Promise.resolve(),{when:l}=a;if(!l)return Promise.all([i(),o(s.delay)]);{let[e,t]="beforeChildren"===l?[i,o]:[o,i];return e().then(()=>t())}}function s1(e,t){return e.sortNodePosition(t)}let s2=ey.length,s5=[...ev].reverse(),s3=ev.length;function s4(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function s6(){return{animate:s4(!0),whileInView:s4(),whileHover:s4(),whileTap:s4(),whileDrag:s4(),whileFocus:s4(),exit:s4()}}class s9{constructor(e){this.isMounted=!1,this.node=e}update(){}}let s8=0,s7={x:!1,y:!1},re=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function rt(e,t,s,r={passive:!0}){return e.addEventListener(t,s,r),()=>e.removeEventListener(t,s)}function rs(e){return{point:{x:e.pageX,y:e.pageY}}}function rr(e,t,s,r){return rt(e,t,e=>re(e)&&s(e,rs(e)),r)}let rn=(e,t)=>Math.abs(e-t);class ra{constructor(e,t,{transformPagePoint:s,contextWindow:r,dragSnapToOrigin:n=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{var e,t;if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let s=rl(this.lastMoveEventInfo,this.history),r=null!==this.startEvent,n=(e=s.offset,t={x:0,y:0},Math.sqrt(rn(e.x,t.x)**2+rn(e.y,t.y)**2)>=3);if(!r&&!n)return;let{point:a}=s,{timestamp:i}=eH;this.history.push({...a,timestamp:i});let{onStart:o,onMove:l}=this.handlers;r||(o&&o(this.lastMoveEvent,s),this.startEvent=this.lastMoveEvent),l&&l(this.lastMoveEvent,s)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=ri(t,this.transformPagePoint),eq.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:s,onSessionEnd:r,resumeAnimation:n}=this.handlers;if(this.dragSnapToOrigin&&n&&n(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=rl("pointercancel"===e.type?this.lastMoveEventInfo:ri(t,this.transformPagePoint),this.history);this.startEvent&&s&&s(e,a),r&&r(e,a)},!re(e))return;this.dragSnapToOrigin=n,this.handlers=t,this.transformPagePoint=s,this.contextWindow=r||window;const a=ri(rs(e),this.transformPagePoint),{point:i}=a,{timestamp:o}=eH;this.history=[{...i,timestamp:o}];const{onSessionStart:l}=t;l&&l(e,rl(a,this.history)),this.removeListeners=sg(rr(this.contextWindow,"pointermove",this.handlePointerMove),rr(this.contextWindow,"pointerup",this.handlePointerUp),rr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),eW(this.updatePoint)}}function ri(e,t){return t?{point:t(e.point)}:e}function ro(e,t){return{x:e.x-t.x,y:e.y-t.y}}function rl({point:e},t){return{point:e,delta:ro(e,rc(t)),offset:ro(e,t[0]),velocity:function(e){if(e.length<2)return{x:0,y:0};let t=e.length-1,s=null,r=rc(e);for(;t>=0&&(s=e[t],!(r.timestamp-s.timestamp>eC(.1)));)t--;if(!s)return{x:0,y:0};let n=(r.timestamp-s.timestamp)/1e3;if(0===n)return{x:0,y:0};let a={x:(r.x-s.x)/n,y:(r.y-s.y)/n};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}(t)}}function rc(e){return e[e.length-1]}function rd(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function ru(e){return e.max-e.min}function rh(e,t,s,r=.5){e.origin=r,e.originPoint=sl(t.min,t.max,e.origin),e.scale=ru(s)/ru(t),e.translate=sl(s.min,s.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function rm(e,t,s,r){rh(e.x,t.x,s.x,r?r.originX:void 0),rh(e.y,t.y,s.y,r?r.originY:void 0)}function rp(e,t,s){e.min=s.min+t.min,e.max=e.min+ru(t)}function rx(e,t,s){e.min=t.min-s.min,e.max=e.min+ru(t)}function rg(e,t,s){rx(e.x,t.x,s.x),rx(e.y,t.y,s.y)}function rf(e,t,s){return{min:void 0!==t?e.min+t:void 0,max:void 0!==s?e.max+s-(e.max-e.min):void 0}}function rb(e,t){let s=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([s,r]=[r,s]),{min:s,max:r}}function rv(e,t,s){return{min:ry(e,t),max:ry(e,s)}}function ry(e,t){return"number"==typeof e?e:e[t]||0}let rj=()=>({translate:0,scale:1,origin:0,originPoint:0}),rw=()=>({x:rj(),y:rj()}),rk=()=>({min:0,max:0}),rN=()=>({x:rk(),y:rk()});function rS(e){return[e("x"),e("y")]}function rC({top:e,left:t,right:s,bottom:r}){return{x:{min:t,max:s},y:{min:e,max:r}}}function rA(e){return void 0===e||1===e}function rM({scale:e,scaleX:t,scaleY:s}){return!rA(e)||!rA(t)||!rA(s)}function rP(e){return rM(e)||rE(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function rE(e){var t,s;return(t=e.x)&&"0%"!==t||(s=e.y)&&"0%"!==s}function rT(e,t,s,r,n){return void 0!==n&&(e=r+n*(e-r)),r+s*(e-r)+t}function rD(e,t=0,s=1,r,n){e.min=rT(e.min,t,s,r,n),e.max=rT(e.max,t,s,r,n)}function r$(e,{x:t,y:s}){rD(e.x,t.translate,t.scale,t.originPoint),rD(e.y,s.translate,s.scale,s.originPoint)}function rR(e,t){e.min=e.min+t,e.max=e.max+t}function r_(e,t,s,r,n=.5){let a=sl(e.min,e.max,n);rD(e,t,s,a,r)}function rF(e,t){r_(e.x,t.x,t.scaleX,t.scale,t.originX),r_(e.y,t.y,t.scaleY,t.scale,t.originY)}function rV(e,t){return rC(function(e,t){if(!t)return e;let s=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:s.y,left:s.x,bottom:r.y,right:r.x}}(e.getBoundingClientRect(),t))}let rI=({current:e})=>e?e.ownerDocument.defaultView:null,rL=new WeakMap;class rU{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=rN(),this.visualElement=e}start(e,{snapToCursor:t=!1}={}){let{presenceContext:s}=this.visualElement;if(s&&!1===s.isPresent)return;let r=e=>{let{dragSnapToOrigin:s}=this.getProps();s?this.pauseAnimation():this.stopAnimation(),t&&this.snapToCursor(rs(e).point)},n=(e,t)=>{let{drag:s,dragPropagation:r,onDragStart:n}=this.getProps();if(s&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=function(e){if("x"===e||"y"===e)if(s7[e])return null;else return s7[e]=!0,()=>{s7[e]=!1};return s7.x||s7.y?null:(s7.x=s7.y=!0,()=>{s7.x=s7.y=!1})}(s),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),rS(e=>{let t=this.getAxisMotionValue(e).get()||0;if(ty.test(t)){let{projection:s}=this.visualElement;if(s&&s.layout){let r=s.layout.layoutBox[e];r&&(t=ru(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),n&&eq.postRender(()=>n(e,t)),e2(this.visualElement,"transform");let{animationState:a}=this.visualElement;a&&a.setActive("whileDrag",!0)},a=(e,t)=>{let{dragPropagation:s,dragDirectionLock:r,onDirectionLock:n,onDrag:a}=this.getProps();if(!s&&!this.openDragLock)return;let{offset:i}=t;if(r&&null===this.currentDirection){this.currentDirection=function(e,t=10){let s=null;return Math.abs(e.y)>t?s="y":Math.abs(e.x)>t&&(s="x"),s}(i),null!==this.currentDirection&&n&&n(this.currentDirection);return}this.updateAxis("x",t.point,i),this.updateAxis("y",t.point,i),this.visualElement.render(),a&&a(e,t)},i=(e,t)=>this.stop(e,t),o=()=>rS(e=>{var t;return"paused"===this.getAnimationState(e)&&(null==(t=this.getAxisMotionValue(e).animation)?void 0:t.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new ra(e,{onSessionStart:r,onStart:n,onMove:a,onSessionEnd:i,resumeAnimation:o},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:rI(this.visualElement)})}stop(e,t){let s=this.isDragging;if(this.cancel(),!s)return;let{velocity:r}=t;this.startAnimation(r);let{onDragEnd:n}=this.getProps();n&&eq.postRender(()=>n(e,t))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;let{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}updateAxis(e,t,s){let{drag:r}=this.getProps();if(!s||!rz(e,r,this.currentDirection))return;let n=this.getAxisMotionValue(e),a=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(a=function(e,{min:t,max:s},r){return void 0!==t&&e<t?e=r?sl(t,e,r.min):Math.max(e,t):void 0!==s&&e>s&&(e=r?sl(s,e,r.max):Math.min(e,s)),e}(a,this.constraints[e],this.elastic[e])),n.set(a)}resolveConstraints(){var e;let{dragConstraints:t,dragElastic:s}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null==(e=this.visualElement.projection)?void 0:e.layout,n=this.constraints;t&&rd(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=function(e,{top:t,left:s,bottom:r,right:n}){return{x:rf(e.x,s,n),y:rf(e.y,t,r)}}(r.layoutBox,t):this.constraints=!1,this.elastic=function(e=.35){return!1===e?e=0:!0===e&&(e=.35),{x:rv(e,"left","right"),y:rv(e,"top","bottom")}}(s),n!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&rS(e=>{var t,s;let n;!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=(t=r.layoutBox[e],s=this.constraints[e],n={},void 0!==s.min&&(n.min=s.min-t.min),void 0!==s.max&&(n.max=s.max-t.min),n))})}resolveRefConstraints(){var e;let{dragConstraints:t,onMeasureDragConstraints:s}=this.getProps();if(!t||!rd(t))return!1;let r=t.current;ej(null!==r,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");let{projection:n}=this.visualElement;if(!n||!n.layout)return!1;let a=function(e,t,s){let r=rV(e,s),{scroll:n}=t;return n&&(rR(r.x,n.offset.x),rR(r.y,n.offset.y)),r}(r,n.root,this.visualElement.getTransformPagePoint()),i=(e=n.layout.layoutBox,{x:rb(e.x,a.x),y:rb(e.y,a.y)});if(s){let e=s(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(i));this.hasMutatedConstraints=!!e,e&&(i=rC(e))}return i}startAnimation(e){let{drag:t,dragMomentum:s,dragElastic:r,dragTransition:n,dragSnapToOrigin:a,onDragTransitionEnd:i}=this.getProps(),o=this.constraints||{};return Promise.all(rS(i=>{if(!rz(i,t,this.currentDirection))return;let l=o&&o[i]||{};a&&(l={min:0,max:0});let c={type:"inertia",velocity:s?e[i]:0,bounceStiffness:r?200:1e6,bounceDamping:r?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...n,...l};return this.startAxisValueAnimation(i,c)})).then(i)}startAxisValueAnimation(e,t){let s=this.getAxisMotionValue(e);return e2(this.visualElement,e),s.start(sZ(e,s,0,t,this.visualElement,!1))}stopAnimation(){rS(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){rS(e=>{var t;return null==(t=this.getAxisMotionValue(e).animation)?void 0:t.pause()})}getAnimationState(e){var t;return null==(t=this.getAxisMotionValue(e).animation)?void 0:t.state}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,s=this.visualElement.getProps();return s[t]||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){rS(t=>{let{drag:s}=this.getProps();if(!rz(t,s,this.currentDirection))return;let{projection:r}=this.visualElement,n=this.getAxisMotionValue(t);if(r&&r.layout){let{min:s,max:a}=r.layout.layoutBox[t];n.set(e[t]-sl(s,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:s}=this.visualElement;if(!rd(t)||!s||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};rS(e=>{let t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){var s,n;let a,i,o,l=t.get();r[e]=(s={min:l,max:l},n=this.constraints[e],a=.5,i=ru(s),(o=ru(n))>i?a=eD(n.min,n.max-i,s.min):i>o&&(a=eD(s.min,s.max-o,n.min)),ti(0,1,a))}});let{transformTemplate:n}=this.visualElement.getProps();this.visualElement.current.style.transform=n?n({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),rS(t=>{if(!rz(t,e,null))return;let s=this.getAxisMotionValue(t),{min:n,max:a}=this.constraints[t];s.set(sl(n,a,r[t]))})}addListeners(){if(!this.visualElement.current)return;rL.set(this.visualElement,this);let e=rr(this.visualElement.current,"pointerdown",e=>{let{drag:t,dragListener:s=!0}=this.getProps();t&&s&&this.start(e)}),t=()=>{let{dragConstraints:e}=this.getProps();rd(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,r=s.addEventListener("measure",t);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),eq.read(t);let n=rt(window,"resize",()=>this.scalePositionWithinConstraints()),a=s.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(rS(t=>{let s=this.getAxisMotionValue(t);s&&(this.originPoint[t]+=e[t].translate,s.set(s.get()+e[t].translate))}),this.visualElement.render())});return()=>{n(),e(),r(),a&&a()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:s=!1,dragPropagation:r=!1,dragConstraints:n=!1,dragElastic:a=.35,dragMomentum:i=!0}=e;return{...e,drag:t,dragDirectionLock:s,dragPropagation:r,dragConstraints:n,dragElastic:a,dragMomentum:i}}}function rz(e,t,s){return(!0===t||t===e)&&(null===s||s===e)}let rO=e=>(t,s)=>{e&&eq.postRender(()=>e(t,s))};var rB=m;let rq=(0,m.createContext)(null);function rW(e=!0){let t=(0,m.useContext)(rq);if(null===t)return[!0,null];let{isPresent:s,onExitComplete:r,register:n}=t,a=(0,m.useId)();(0,m.useEffect)(()=>{e&&n(a)},[e]);let i=(0,m.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!s&&r?[!1,i]:[!0]}let rH=(0,m.createContext)({}),rK=(0,m.createContext)({}),rG={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function rY(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}let rX={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e)if(!tj.test(e))return e;else e=parseFloat(e);let s=rY(e,t.target.x),r=rY(e,t.target.y);return`${s}% ${r}%`}},rJ={},{schedule:rZ,cancel:rQ}=eB(queueMicrotask,!1);class r0 extends rB.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:s,layoutId:r}=this.props,{projection:n}=e;Object.assign(rJ,r2),n&&(t.group&&t.group.add(n),s&&s.register&&r&&s.register(n),n.root.didUpdate(),n.addEventListener("animationComplete",()=>{this.safeToRemove()}),n.setOptions({...n.options,onExitComplete:()=>this.safeToRemove()})),rG.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:s,drag:r,isPresent:n}=this.props,a=s.projection;return a&&(a.isPresent=n,r||e.layoutDependency!==t||void 0===t?a.willUpdate():this.safeToRemove(),e.isPresent!==n&&(n?a.promote():a.relegate()||eq.postRender(()=>{let e=a.getStack();e&&e.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),rZ.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:s}=this.props,{projection:r}=e;r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),s&&s.deregister&&s.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}}function r1(e){let[t,s]=rW(),r=(0,rB.useContext)(rH);return(0,h.jsx)(r0,{...e,layoutGroup:r,switchLayoutGroup:(0,rB.useContext)(rK),isPresent:t,safeToRemove:s})}let r2={borderRadius:{...rX,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:rX,borderTopRightRadius:rX,borderBottomLeftRadius:rX,borderBottomRightRadius:rX,boxShadow:{correct:(e,{treeScale:t,projectionDelta:s})=>{let r=t_.parse(e);if(r.length>5)return e;let n=t_.createTransformer(e),a=+("number"!=typeof r[0]),i=s.x.scale*t.x,o=s.y.scale*t.y;r[0+a]/=i,r[1+a]/=o;let l=sl(i,o,.5);return"number"==typeof r[2+a]&&(r[2+a]/=l),"number"==typeof r[3+a]&&(r[3+a]/=l),n(r)}}},r5=(e,t)=>e.depth-t.depth;class r3{constructor(){this.children=[],this.isDirty=!1}add(e){eX(this.children,e),this.isDirty=!0}remove(e){eJ(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(r5),this.isDirty=!1,this.children.forEach(e)}}function r4(e){let t=e1(e)?e.get():e;return t&&"object"==typeof t&&t.mix&&t.toValue?t.toValue():t}let r6=["TopLeft","TopRight","BottomLeft","BottomRight"],r9=r6.length,r8=e=>"string"==typeof e?parseFloat(e):e,r7=e=>"number"==typeof e||tj.test(e);function ne(e,t){return void 0!==e[t]?e[t]:e.borderRadius}let nt=nr(0,.5,tn),ns=nr(.5,.95,ej);function nr(e,t,s){return r=>r<e?0:r>t?1:s(eD(e,t,r))}function nn(e,t){e.min=t.min,e.max=t.max}function na(e,t){nn(e.x,t.x),nn(e.y,t.y)}function ni(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function no(e,t,s,r,n){return e-=t,e=r+1/s*(e-r),void 0!==n&&(e=r+1/n*(e-r)),e}function nl(e,t,[s,r,n],a,i){!function(e,t=0,s=1,r=.5,n,a=e,i=e){if(ty.test(t)&&(t=parseFloat(t),t=sl(i.min,i.max,t/100)-i.min),"number"!=typeof t)return;let o=sl(a.min,a.max,r);e===a&&(o-=t),e.min=no(e.min,t,s,o,n),e.max=no(e.max,t,s,o,n)}(e,t[s],t[r],t[n],t.scale,a,i)}let nc=["x","scaleX","originX"],nd=["y","scaleY","originY"];function nu(e,t,s,r){nl(e.x,t,nc,s?s.x:void 0,r?r.x:void 0),nl(e.y,t,nd,s?s.y:void 0,r?r.y:void 0)}function nh(e){return 0===e.translate&&1===e.scale}function nm(e){return nh(e.x)&&nh(e.y)}function np(e,t){return e.min===t.min&&e.max===t.max}function nx(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function ng(e,t){return nx(e.x,t.x)&&nx(e.y,t.y)}function nf(e){return ru(e.x)/ru(e.y)}function nb(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class nv{constructor(){this.members=[]}add(e){eX(this.members,e),e.scheduleRender()}remove(e){if(eJ(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let t,s=this.members.findIndex(t=>e===t);if(0===s)return!1;for(let e=s;e>=0;e--){let s=this.members[e];if(!1!==s.isPresent){t=s;break}}return!!t&&(this.promote(t),!0)}promote(e,t){let s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender(),e.resumeFrom=s,t&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);let{crossfade:r}=e.options;!1===r&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:t,resumingFrom:s}=e;t.onExitComplete&&t.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}let ny={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},nj="u">typeof window&&void 0!==window.MotionDebug,nw=["","X","Y","Z"],nk={visibility:"hidden"},nN=0;function nS(e,t,s,r){let{latestValues:n}=t;n[e]&&(s[e]=n[e],t.setStaticValue(e,0),r&&(r[e]=0))}function nC({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:r,resetTransform:n}){return class{constructor(e={},s=null==t?void 0:t()){this.id=nN++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,nj&&(ny.totalNodes=ny.resolvedTargetDeltas=ny.recalculatedProjection=0),this.nodes.forEach(nP),this.nodes.forEach(nF),this.nodes.forEach(nV),this.nodes.forEach(nE),nj&&window.MotionDebug.record(ny)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new r3)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new eZ),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let s=this.eventHandlers.get(e);s&&s.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t,s=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=t instanceof SVGElement&&"svg"!==t.tagName,this.instance=t;let{layoutId:r,layout:n,visualElement:a}=this.options;if(a&&!a.current&&a.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),s&&(n||r)&&(this.isLayoutDirty=!0),e){let s,r=()=>this.root.updateBlockedByResize=!1;e(t,()=>{let e,t;this.root.updateBlockedByResize=!0,s&&s(),e=eY.now(),t=({timestamp:s})=>{let n=s-e;n>=250&&(eW(t),r(n-250))},eq.read(t,!0),s=()=>eW(t),rG.hasAnimatedSinceResize&&(rG.hasAnimatedSinceResize=!1,this.nodes.forEach(n_))})}r&&this.root.registerSharedNode(r,this),!1!==this.options.animate&&a&&(r||n)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeTargetChanged:s,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let n=this.options.transition||a.getDefaultTransition()||nB,{onLayoutAnimationStart:i,onLayoutAnimationComplete:o}=a.getProps(),l=!this.targetLayout||!ng(this.targetLayout,r)||s,c=!t&&s;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(e,c);let t={...eF(n,"layout"),onPlay:i,onComplete:o};(a.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t)}else t||n_(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,eW(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){!this.isUpdateBlocked()&&(this.isUpdating=!0,this.nodes&&this.nodes.forEach(nI),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function e(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;let{visualElement:s}=t.options;if(!s)return;let r=s.props[e3];if(window.MotionHasOptimisedAnimation(r,"transform")){let{layout:e,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",eq,!(e||s))}let{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&e(n)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll("snapshot"),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:s}=this.options;if(void 0===t&&!s)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(nD);return}this.isUpdating||this.nodes.forEach(n$),this.isUpdating=!1,this.nodes.forEach(nR),this.nodes.forEach(nA),this.nodes.forEach(nM),this.clearAllSnapshots();let e=eY.now();eH.delta=ti(0,1e3/60,e-eH.timestamp),eH.timestamp=e,eH.isProcessing=!0,eK.update.process(eH),eK.preRender.process(eH),eK.render.process(eH),eH.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,rZ.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(nT),this.sharedNodes.forEach(nL)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,eq.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){eq.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutCorrected=rN(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!n)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!nm(this.projectionDelta),s=this.getTransformTemplate(),r=s?s(this.latestValues,""):void 0,a=r!==this.prevTransformTemplateValue;e&&(t||rP(this.latestValues)||a)&&(n(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){var t;let s=this.measurePageBox(),r=this.removeElementScroll(s);return e&&(r=this.removeTransform(r)),nH((t=r).x),nH(t.y),{animationId:this.root.animationId,measuredBox:s,layoutBox:r,latestValues:{},source:this.id}}measurePageBox(){var e;let{visualElement:t}=this.options;if(!t)return rN();let s=t.measureViewportBox();if(!((null==(e=this.scroll)?void 0:e.wasRoot)||this.path.some(nG))){let{scroll:e}=this.root;e&&(rR(s.x,e.offset.x),rR(s.y,e.offset.y))}return s}removeElementScroll(e){var t;let s=rN();if(na(s,e),null==(t=this.scroll)?void 0:t.wasRoot)return s;for(let t=0;t<this.path.length;t++){let r=this.path[t],{scroll:n,options:a}=r;r!==this.root&&n&&a.layoutScroll&&(n.wasRoot&&na(s,e),rR(s.x,n.offset.x),rR(s.y,n.offset.y))}return s}applyTransform(e,t=!1){let s=rN();na(s,e);for(let e=0;e<this.path.length;e++){let r=this.path[e];!t&&r.options.layoutScroll&&r.scroll&&r!==r.root&&rF(s,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),rP(r.latestValues)&&rF(s,r.latestValues)}return rP(this.latestValues)&&rF(s,this.latestValues),s}removeTransform(e){let t=rN();na(t,e);for(let e=0;e<this.path.length;e++){let s=this.path[e];if(!s.instance||!rP(s.latestValues))continue;rM(s.latestValues)&&s.updateSnapshot();let r=rN();na(r,s.measurePageBox()),nu(t,s.latestValues,s.snapshot?s.snapshot.layoutBox:void 0,r)}return rP(this.latestValues)&&nu(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==eH.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){var t,s,r,n;let a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);let i=!!this.resumingFrom||this!==a;if(!(e||i&&this.isSharedProjectionDirty||this.isProjectionDirty||(null==(t=this.parent)?void 0:t.isProjectionDirty)||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:o,layoutId:l}=this.options;if(this.layout&&(o||l)){if(this.resolvedRelativeTargetAt=eH.timestamp,!this.targetDelta&&!this.relativeTarget){let e=this.getClosestProjectingParent();e&&e.layout&&1!==this.animationProgress?(this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=rN(),this.relativeTargetOrigin=rN(),rg(this.relativeTargetOrigin,this.layout.layoutBox,e.layout.layoutBox),na(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(this.relativeTarget||this.targetDelta){if((this.target||(this.target=rN(),this.targetWithTransforms=rN()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target)?(this.forceRelativeParentToResolveTarget(),s=this.target,r=this.relativeTarget,n=this.relativeParent.target,rp(s.x,r.x,n.x),rp(s.y,r.y,n.y)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):na(this.target,this.layout.layoutBox),r$(this.target,this.targetDelta)):na(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;let e=this.getClosestProjectingParent();e&&!!e.resumingFrom==!!this.resumingFrom&&!e.options.layoutScroll&&e.target&&1!==this.animationProgress?(this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=rN(),this.relativeTargetOrigin=rN(),rg(this.relativeTargetOrigin,this.target,e.target),na(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}nj&&ny.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||rM(this.parent.latestValues)||rE(this.parent.latestValues)))if(this.parent.isProjecting())return this.parent;else return this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var e;let t=this.getLead(),s=!!this.resumingFrom||this!==t,r=!0;if((this.isProjectionDirty||(null==(e=this.parent)?void 0:e.isProjectionDirty))&&(r=!1),s&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===eH.timestamp&&(r=!1),r)return;let{layout:n,layoutId:a}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(n||a))return;na(this.layoutCorrected,this.layout.layoutBox);let i=this.treeScale.x,o=this.treeScale.y;!function(e,t,s,r=!1){let n,a,i=s.length;if(i){t.x=t.y=1;for(let o=0;o<i;o++){a=(n=s[o]).projectionDelta;let{visualElement:i}=n.options;(!i||!i.props.style||"contents"!==i.props.style.display)&&(r&&n.options.layoutScroll&&n.scroll&&n!==n.root&&rF(e,{x:-n.scroll.offset.x,y:-n.scroll.offset.y}),a&&(t.x*=a.x.scale,t.y*=a.y.scale,r$(e,a)),r&&rP(n.latestValues)&&rF(e,n.latestValues))}t.x<1.0000000000001&&t.x>.999999999999&&(t.x=1),t.y<1.0000000000001&&t.y>.999999999999&&(t.y=1)}}(this.layoutCorrected,this.treeScale,this.path,s),t.layout&&!t.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(t.target=t.layout.layoutBox,t.targetWithTransforms=rN());let{target:l}=t;if(!l){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(ni(this.prevProjectionDelta.x,this.projectionDelta.x),ni(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),rm(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.treeScale.x===i&&this.treeScale.y===o&&nb(this.projectionDelta.x,this.prevProjectionDelta.x)&&nb(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",l)),nj&&ny.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){var t;if(null==(t=this.options.visualElement)||t.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=rw(),this.projectionDelta=rw(),this.projectionDeltaWithTransform=rw()}setAnimationOrigin(e,t=!1){let s,r=this.snapshot,n=r?r.latestValues:{},a={...this.latestValues},i=rw();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=rN(),l=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),d=!c||c.members.length<=1,u=!!(l&&!d&&!0===this.options.crossfade&&!this.path.some(nO));this.animationProgress=0,this.mixTargetDelta=t=>{let r=t/1e3;if(nU(i.x,e.x,r),nU(i.y,e.y,r),this.setTargetDelta(i),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var c,h,m,p,x,g;rg(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),m=this.relativeTarget,p=this.relativeTargetOrigin,x=o,g=r,nz(m.x,p.x,x.x,g),nz(m.y,p.y,x.y,g),s&&(c=this.relativeTarget,h=s,np(c.x,h.x)&&np(c.y,h.y))&&(this.isProjectionDirty=!1),s||(s=rN()),na(s,this.relativeTarget)}l&&(this.animationValues=a,function(e,t,s,r,n,a){n?(e.opacity=sl(0,void 0!==s.opacity?s.opacity:1,nt(r)),e.opacityExit=sl(void 0!==t.opacity?t.opacity:1,0,ns(r))):a&&(e.opacity=sl(void 0!==t.opacity?t.opacity:1,void 0!==s.opacity?s.opacity:1,r));for(let n=0;n<r9;n++){let a=`border${r6[n]}Radius`,i=ne(t,a),o=ne(s,a);(void 0!==i||void 0!==o)&&(i||(i=0),o||(o=0),0===i||0===o||r7(i)===r7(o)?(e[a]=Math.max(sl(r8(i),r8(o),r),0),(ty.test(o)||ty.test(i))&&(e[a]+="%")):e[a]=o)}(t.rotate||s.rotate)&&(e.rotate=sl(t.rotate||0,s.rotate||0,r))}(a,n,this.latestValues,r,u,d)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=r},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(eW(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=eq.update(()=>{var t;let s;rG.hasAnimatedSinceResize=!0,this.currentAnimation=(t={...e,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}},(s=e1(0)?0:e0(0)).start(sZ("",s,1e3,t)),s.animation),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:s,layout:r,latestValues:n}=e;if(t&&s&&r){if(this!==e&&this.layout&&r&&nK(this.options.animationType,this.layout.layoutBox,r.layoutBox)){s=this.target||rN();let t=ru(this.layout.layoutBox.x);s.x.min=e.target.x.min,s.x.max=s.x.min+t;let r=ru(this.layout.layoutBox.y);s.y.min=e.target.y.min,s.y.max=s.y.min+r}na(t,s),rF(t,n),rm(this.projectionDeltaWithTransform,this.layoutCorrected,t,n)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new nv),this.sharedNodes.get(e).add(t);let s=t.options.initialPromotionConfig;t.promote({transition:s?s.transition:void 0,preserveFollowOpacity:s&&s.shouldPreserveFollowOpacity?s.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){var e;let{layoutId:t}=this.options;return t&&(null==(e=this.getStack())?void 0:e.lead)||this}getPrevLead(){var e;let{layoutId:t}=this.options;return t?null==(e=this.getStack())?void 0:e.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:s}={}){let r=this.getStack();r&&r.promote(this,s),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:s}=e;if((s.z||s.rotate||s.rotateX||s.rotateY||s.rotateZ||s.skewX||s.skewY)&&(t=!0),!t)return;let r={};s.z&&nS("z",e,r,this.animationValues);for(let t=0;t<nw.length;t++)nS(`rotate${nw[t]}`,e,r,this.animationValues),nS(`skew${nw[t]}`,e,r,this.animationValues);for(let t in e.render(),r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}getProjectionStyles(e){var t,s;if(!this.instance||this.isSVG)return;if(!this.isVisible)return nk;let r={visibility:""},n=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,r.opacity="",r.pointerEvents=r4(null==e?void 0:e.pointerEvents)||"",r.transform=n?n(this.latestValues,""):"none",r;let a=this.getLead();if(!this.projectionDelta||!this.layout||!a.target){let t={};return this.options.layoutId&&(t.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,t.pointerEvents=r4(null==e?void 0:e.pointerEvents)||""),this.hasProjected&&!rP(this.latestValues)&&(t.transform=n?n({},""):"none",this.hasProjected=!1),t}let i=a.animationValues||a.latestValues;this.applyTransformsToTarget(),r.transform=function(e,t,s){let r="",n=e.x.translate/t.x,a=e.y.translate/t.y,i=(null==s?void 0:s.z)||0;if((n||a||i)&&(r=`translate3d(${n}px, ${a}px, ${i}px) `),(1!==t.x||1!==t.y)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),s){let{transformPerspective:e,rotate:t,rotateX:n,rotateY:a,skewX:i,skewY:o}=s;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),n&&(r+=`rotateX(${n}deg) `),a&&(r+=`rotateY(${a}deg) `),i&&(r+=`skewX(${i}deg) `),o&&(r+=`skewY(${o}deg) `)}let o=e.x.scale*t.x,l=e.y.scale*t.y;return(1!==o||1!==l)&&(r+=`scale(${o}, ${l})`),r||"none"}(this.projectionDeltaWithTransform,this.treeScale,i),n&&(r.transform=n(i,r.transform));let{x:o,y:l}=this.projectionDelta;for(let e in r.transformOrigin=`${100*o.origin}% ${100*l.origin}% 0`,a.animationValues?r.opacity=a===this?null!=(s=null!=(t=i.opacity)?t:this.latestValues.opacity)?s:1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:r.opacity=a===this?void 0!==i.opacity?i.opacity:"":void 0!==i.opacityExit?i.opacityExit:0,rJ){if(void 0===i[e])continue;let{correct:t,applyTo:s}=rJ[e],n="none"===r.transform?i[e]:t(i[e],a);if(s){let e=s.length;for(let t=0;t<e;t++)r[s[t]]=n}else r[e]=n}return this.options.layoutId&&(r.pointerEvents=a===this?r4(null==e?void 0:e.pointerEvents)||"":"none"),r}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>{var t;return null==(t=e.currentAnimation)?void 0:t.stop()}),this.root.nodes.forEach(nD),this.root.sharedNodes.clear()}}}function nA(e){e.updateLayout()}function nM(e){var t;let s=(null==(t=e.resumeFrom)?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&s&&e.hasListeners("didUpdate")){let{layoutBox:t,measuredBox:r}=e.layout,{animationType:n}=e.options,a=s.source!==e.layout.source;"size"===n?rS(e=>{let r=a?s.measuredBox[e]:s.layoutBox[e],n=ru(r);r.min=t[e].min,r.max=r.min+n}):nK(n,s.layoutBox,t)&&rS(r=>{let n=a?s.measuredBox[r]:s.layoutBox[r],i=ru(t[r]);n.max=n.min+i,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+i)});let i=rw();rm(i,t,s.layoutBox);let o=rw();a?rm(o,e.applyTransform(r,!0),s.measuredBox):rm(o,t,s.layoutBox);let l=!nm(i),c=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:n,layout:a}=r;if(n&&a){let i=rN();rg(i,s.layoutBox,n.layoutBox);let o=rN();rg(o,t,a.layoutBox),ng(i,o)||(c=!0),r.options.layoutRoot&&(e.relativeTarget=o,e.relativeTargetOrigin=i,e.relativeParent=r)}}}e.notifyListeners("didUpdate",{layout:t,snapshot:s,delta:o,layoutDelta:i,hasLayoutChanged:l,hasRelativeTargetChanged:c})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function nP(e){nj&&ny.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function nE(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function nT(e){e.clearSnapshot()}function nD(e){e.clearMeasurements()}function n$(e){e.isLayoutDirty=!1}function nR(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function n_(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function nF(e){e.resolveTargetDelta()}function nV(e){e.calcProjection()}function nI(e){e.resetSkewAndRotation()}function nL(e){e.removeLeadSnapshot()}function nU(e,t,s){e.translate=sl(t.translate,0,s),e.scale=sl(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}function nz(e,t,s,r){e.min=sl(t.min,s.min,r),e.max=sl(t.max,s.max,r)}function nO(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}let nB={duration:.45,ease:[.4,0,.1,1]},nq=e=>"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),nW=nq("applewebkit/")&&!nq("chrome/")?Math.round:ej;function nH(e){e.min=nW(e.min),e.max=nW(e.max)}function nK(e,t,s){return"position"===e||"preserve-aspect"===e&&!(.2>=Math.abs(nf(t)-nf(s)))}function nG(e){var t;return e!==e.root&&(null==(t=e.scroll)?void 0:t.wasRoot)}let nY=nC({attachResizeListener:(e,t)=>rt(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),nX={current:void 0},nJ=nC({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!nX.current){let e=new nY({});e.mount(window),e.setOptions({layoutScroll:!0}),nX.current=e}return nX.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>"fixed"===window.getComputedStyle(e).position});function nZ(e,t){let s=function(e){if(e instanceof Element)return[e];if("string"==typeof e){let t=document.querySelectorAll(e);return t?Array.from(t):[]}return Array.from(e)}(e),r=new AbortController;return[s,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function nQ(e){return t=>{"touch"===t.pointerType||s7.x||s7.y||e(t)}}function n0(e,t,s){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover","Start"===s);let n=r["onHover"+s];n&&eq.postRender(()=>n(t,rs(t)))}let n1=(e,t)=>!!t&&(e===t||n1(e,t.parentElement)),n2=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]),n5=new WeakSet;function n3(e){return t=>{"Enter"===t.key&&e(t)}}function n4(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function n6(e){return re(e)&&!(s7.x||s7.y)}function n9(e,t,s){let{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap","Start"===s);let n=r["onTap"+("End"===s?"":s)];n&&eq.postRender(()=>n(t,rs(t)))}let n8=new WeakMap,n7=new WeakMap,ae=e=>{let t=n8.get(e.target);t&&t(e)},at=e=>{e.forEach(ae)},as={some:0,all:1},ar=(0,m.createContext)({strict:!1}),an=(0,m.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),aa=(0,m.createContext)({});function ai(e){return eh(e.animate)||ey.some(t=>ex(e[t]))}function ao(e){return!!(ai(e)||e.variants)}function al(e){return Array.isArray(e)?e.join(" "):e}let ac="u">typeof window,ad={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},au={};for(let e in ad)au[e]={isEnabled:t=>ad[e].some(e=>!!t[e])};let ah=Symbol.for("motionComponentSymbol"),am=ac?m.useLayoutEffect:m.useEffect,ap=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function ax(e){if("string"!=typeof e||e.includes("-"));else if(ap.indexOf(e)>-1||/[A-Z]/u.test(e))return!0;return!1}function ag(e){let t=(0,m.useRef)(null);return null===t.current&&(t.current=e()),t.current}let af=e=>(t,s)=>{let r=(0,m.useContext)(aa),n=(0,m.useContext)(rq),a=()=>(function({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:s},r,n,a){let i={latestValues:function(e,t,s,r){let n={},a=r(e,{});for(let e in a)n[e]=r4(a[e]);let{initial:i,animate:o}=e,l=ai(e),c=ao(e);t&&c&&!l&&!1!==e.inherit&&(void 0===i&&(i=t.initial),void 0===o&&(o=t.animate));let d=!!s&&!1===s.initial,u=(d=d||!1===i)?o:i;if(u&&"boolean"!=typeof u&&!eh(u)){let t=Array.isArray(u)?u:[u];for(let s=0;s<t.length;s++){let r=ef(e,t[s]);if(r){let{transitionEnd:e,transition:t,...s}=r;for(let e in s){let t=s[e];if(Array.isArray(t)){let e=d?t.length-1:0;t=t[e]}null!==t&&(n[e]=t)}for(let t in e)n[t]=e[t]}}}return n}(r,n,a,e),renderState:t()};return s&&(i.onMount=e=>s({props:r,current:e,...i}),i.onUpdate=e=>s(e)),i})(e,t,r,n);return s?a():ag(a)},ab=(e,t)=>t&&"number"==typeof e?t.transform(e):e,av={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ay=eI.length;function aj(e,t,s){let{style:r,vars:n,transformOrigin:a}=e,i=!1,o=!1;for(let e in t){let s=t[e];if(eL.has(e)){i=!0;continue}if(t4(e)){n[e]=s;continue}{let t=ab(s,tz[e]);e.startsWith("origin")?(o=!0,a[e]=t):r[e]=t}}if(!t.transform&&(i||s?r.transform=function(e,t,s){let r="",n=!0;for(let a=0;a<ay;a++){let i=eI[a],o=e[i];if(void 0===o)continue;let l=!0;if(!(l="number"==typeof o?o===+!!i.startsWith("scale"):0===parseFloat(o))||s){let e=ab(o,tz[i]);if(!l){n=!1;let t=av[i]||i;r+=`${t}(${e}) `}s&&(t[i]=e)}}return r=r.trim(),s?r=s(t,n?"":r):n&&(r="none"),r}(t,e.transform,s):r.transform&&(r.transform="none")),o){let{originX:e="50%",originY:t="50%",originZ:s=0}=a;r.transformOrigin=`${e} ${t} ${s}`}}let aw={offset:"stroke-dashoffset",array:"stroke-dasharray"},ak={offset:"strokeDashoffset",array:"strokeDasharray"};function aN(e,t,s){return"string"==typeof e?e:tj.transform(t+s*e)}function aS(e,{attrX:t,attrY:s,attrScale:r,originX:n,originY:a,pathLength:i,pathSpacing:o=1,pathOffset:l=0,...c},d,u){let h,m;if(aj(e,c,u),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:p,style:x,dimensions:g}=e;p.transform&&(g&&(x.transform=p.transform),delete p.transform),g&&(void 0!==n||void 0!==a||x.transform)&&(h=aN(void 0!==n?n:.5,g.x,g.width),m=aN(void 0!==a?a:.5,g.y,g.height),x.transformOrigin=`${h} ${m}`),void 0!==t&&(p.x=t),void 0!==s&&(p.y=s),void 0!==r&&(p.scale=r),void 0!==i&&function(e,t,s=1,r=0,n=!0){e.pathLength=1;let a=n?aw:ak;e[a.offset]=tj.transform(-r);let i=tj.transform(t),o=tj.transform(s);e[a.array]=`${i} ${o}`}(p,i,o,l,!1)}let aC=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),aA=()=>({...aC(),attrs:{}}),aM=e=>"string"==typeof e&&"svg"===e.toLowerCase();function aP(e,{style:t,vars:s},r,n){for(let a in Object.assign(e.style,t,n&&n.getProjectionStyles(r)),s)e.style.setProperty(a,s[a])}let aE=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function aT(e,t,s,r){for(let s in aP(e,t,void 0,r),t.attrs)e.setAttribute(aE.has(s)?s:e5(s),t.attrs[s])}function aD(e,{layout:t,layoutId:s}){return eL.has(e)||e.startsWith("origin")||(t||void 0!==s)&&(!!rJ[e]||"opacity"===e)}function a$(e,t,s){var r;let{style:n}=e,a={};for(let i in n)(e1(n[i])||t.style&&e1(t.style[i])||aD(i,e)||(null==(r=null==s?void 0:s.getValue(i))?void 0:r.liveStyle)!==void 0)&&(a[i]=n[i]);return a}function aR(e,t,s){let r=a$(e,t,s);for(let s in e)(e1(e[s])||e1(t[s]))&&(r[-1!==eI.indexOf(s)?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s]=e[s]);return r}let a_=["x","y","width","height","cx","cy","r"],aF={useVisualState:af({scrapeMotionValuesFromProps:aR,createRenderState:aA,onUpdate:({props:e,prevProps:t,current:s,renderState:r,latestValues:n})=>{if(!s)return;let a=!!e.drag;if(!a){for(let e in n)if(eL.has(e)){a=!0;break}}if(!a)return;let i=!t;if(t)for(let s=0;s<a_.length;s++){let r=a_[s];e[r]!==t[r]&&(i=!0)}i&&eq.read(()=>{try{r.dimensions="function"==typeof s.getBBox?s.getBBox():s.getBoundingClientRect()}catch(e){r.dimensions={x:0,y:0,width:0,height:0}}eq.render(()=>{aS(r,n,aM(s.tagName),e.transformTemplate),aT(s,r)})})}})},aV={useVisualState:af({scrapeMotionValuesFromProps:a$,createRenderState:aC})};function aI(e,t,s){for(let r in t)e1(t[r])||aD(r,s)||(e[r]=t[r])}let aL=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function aU(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||aL.has(e)}let az=e=>!aU(e);try{(c=(()=>{let e=Error("Cannot find module '@emotion/is-prop-valid'");throw e.code="MODULE_NOT_FOUND",e})().default)&&(az=e=>e.startsWith("on")?!aU(e):c(e))}catch(e){}let aO={current:null},aB={current:!1},aq=[...st,tC,t_],aW=new WeakMap,aH=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class aK{scrapeMotionValuesFromProps(e,t,s){return{}}constructor({parent:e,props:t,presenceContext:s,reducedMotionConfig:r,blockInitialAnimation:n,visualState:a},i={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=t5,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=eY.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,eq.render(this.render,!1,!0))};const{latestValues:o,renderState:l,onUpdate:c}=a;this.onUpdate=c,this.latestValues=o,this.baseTarget={...o},this.initialValues=t.initial?{...o}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=i,this.blockInitialAnimation=!!n,this.isControllingVariants=ai(t),this.isVariantNode=ao(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...u}=this.scrapeMotionValuesFromProps(t,{},this);for(const e in u){const t=u[e];void 0!==o[e]&&e1(t)&&t.set(o[e],!1)}}mount(e){this.current=e,aW.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),aB.current||function(){if(aB.current=!0,ac)if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),t=()=>aO.current=e.matches;e.addListener(t),t()}else aO.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||aO.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){for(let e in aW.delete(this.current),this.projection&&this.projection.unmount(),eW(this.notifyUpdate),eW(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}bindToMotionValue(e,t){let s;this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();let r=eL.has(e),n=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&eq.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),a=t.on("renderRequest",this.scheduleRender);window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{n(),a(),s&&s(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in au){let t=au[e];if(!t)continue;let{isEnabled:s,Feature:r}=t;if(!this.features[e]&&r&&s(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):rN()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<aH.length;t++){let s=aH[t];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);let r=e["on"+s];r&&(this.propEventSubscriptions[s]=this.on(s,r))}this.prevMotionValues=function(e,t,s){for(let r in t){let n=t[r],a=s[r];if(e1(n))e.addValue(r,n);else if(e1(a))e.addValue(r,e0(n,{owner:e}));else if(a!==n)if(e.hasValue(r)){let t=e.getValue(r);!0===t.liveStyle?t.jump(n):t.hasAnimated||t.set(n)}else{let t=e.getStaticValue(r);e.addValue(r,e0(void 0!==t?t:n,{owner:e}))}}for(let r in s)void 0===t[r]&&e.removeValue(r);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let s=this.values.get(e);t!==s&&(s&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return void 0===s&&void 0!==t&&(s=e0(null===t?void 0:t,{owner:this}),this.addValue(e,s)),s}readValue(e,t){var s;let r=void 0===this.latestValues[e]&&this.current?null!=(s=this.getBaseTargetFromProps(this.props,e))?s:this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];if(null!=r){let s,n;if("string"==typeof r&&(s=r,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(s)||(n=r,/^0[^.\s]+$/u.test(n))))r=parseFloat(r);else{let s;s=r,!aq.find(se(s))&&t_.test(t)&&(r=tq(e,t))}this.setBaseTarget(e,e1(r)?r.get():r)}return e1(r)?r.get():r}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;let s,{initial:r}=this.props;if("string"==typeof r||"object"==typeof r){let n=ef(this.props,r,null==(t=this.presenceContext)?void 0:t.custom);n&&(s=n[e])}if(r&&void 0!==s)return s;let n=this.getBaseTargetFromProps(this.props,e);return void 0===n||e1(n)?void 0!==this.initialValues[e]&&void 0===s?void 0:this.baseTarget[e]:n}on(e,t){return this.events[e]||(this.events[e]=new eZ),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}}class aG extends aK{constructor(){super(...arguments),this.KeyframeResolver=sr}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:s}){delete t[e],delete s[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;e1(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}class aY extends aG{constructor(){super(...arguments),this.type="html",this.renderInstance=aP}readValueFromInstance(e,t){if(eL.has(t)){let e=tB(t);return e&&e.default||0}{let s=window.getComputedStyle(e),r=(t4(t)?s.getPropertyValue(t):s[t])||0;return"string"==typeof r?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return rV(e,t)}build(e,t,s){aj(e,t,s.transformTemplate)}scrapeMotionValuesFromProps(e,t,s){return a$(e,t,s)}}class aX extends aG{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=rN}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(eL.has(t)){let e=tB(t);return e&&e.default||0}return t=aE.has(t)?t:e5(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,s){return aR(e,t,s)}build(e,t,s){aS(e,t,this.isSVGTag,s.transformTemplate)}renderInstance(e,t,s,r){aT(e,t,s,r)}mount(e){this.isSVGTag=aM(e.tagName),super.mount(e)}}let aJ=function(e){if("u"<typeof Proxy)return e;let t=new Map;return new Proxy((...t)=>e(...t),{get:(s,r)=>"create"===r?e:(t.has(r)||t.set(r,e(r)),t.get(r))})}((d={animation:{Feature:class extends s9{constructor(e){super(e),e.animationState||(e.animationState=function(e){let t=t=>Promise.all(t.map(({animation:t,options:s})=>(function(e,t,s={}){let r;if(e.notify("AnimationStart",t),Array.isArray(t))r=Promise.all(t.map(t=>s0(e,t,s)));else if("string"==typeof t)r=s0(e,t,s);else{let n="function"==typeof t?eb(e,t,s.custom):t;r=Promise.all(sQ(e,n,s))}return r.then(()=>{e.notify("AnimationComplete",t)})})(e,t,s))),s=s6(),r=!0,n=t=>(s,r)=>{var n;let a=eb(e,r,"exit"===t?null==(n=e.presenceContext)?void 0:n.custom:void 0);if(a){let{transition:e,transitionEnd:t,...r}=a;s={...s,...r,...t}}return s};function a(a){let{props:i}=e,o=function e(t){if(!t)return;if(!t.isControllingVariants){let s=t.parent&&e(t.parent)||{};return void 0!==t.props.initial&&(s.initial=t.props.initial),s}let s={};for(let e=0;e<s2;e++){let r=ey[e],n=t.props[r];(ex(n)||!1===n)&&(s[r]=n)}return s}(e.parent)||{},l=[],c=new Set,d={},u=1/0;for(let t=0;t<s3;t++){var h,m;let p=s5[t],x=s[p],g=void 0!==i[p]?i[p]:o[p],f=ex(g),b=p===a?x.isActive:null;!1===b&&(u=t);let v=g===o[p]&&g!==i[p]&&f;if(v&&r&&e.manuallyAnimateOnMount&&(v=!1),x.protectedKeys={...d},!x.isActive&&null===b||!g&&!x.prevProp||eh(g)||"boolean"==typeof g)continue;let y=(h=x.prevProp,"string"==typeof(m=g)?m!==h:!!Array.isArray(m)&&!ep(m,h)),j=y||p===a&&x.isActive&&!v&&f||t>u&&f,w=!1,k=Array.isArray(g)?g:[g],N=k.reduce(n(p),{});!1===b&&(N={});let{prevResolvedValues:S={}}=x,C={...S,...N},A=t=>{j=!0,c.has(t)&&(w=!0,c.delete(t)),x.needsAnimating[t]=!0;let s=e.getValue(t);s&&(s.liveStyle=!1)};for(let e in C){let t=N[e],s=S[e];if(!d.hasOwnProperty(e))(em(t)&&em(s)?ep(t,s):t===s)?void 0!==t&&c.has(e)?A(e):x.protectedKeys[e]=!0:null!=t?A(e):c.add(e)}x.prevProp=g,x.prevResolvedValues=N,x.isActive&&(d={...d,...N}),r&&e.blockInitialAnimation&&(j=!1);let M=!(v&&y)||w;j&&M&&l.push(...k.map(e=>({animation:e,options:{type:p}})))}if(c.size){let t={};c.forEach(s=>{let r=e.getBaseTarget(s),n=e.getValue(s);n&&(n.liveStyle=!0),t[s]=null!=r?r:null}),l.push({animation:t})}let p=!!l.length;return r&&(!1===i.initial||i.initial===i.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,p?t(l):Promise.resolve()}return{animateChanges:a,setActive:function(t,r){var n;if(s[t].isActive===r)return Promise.resolve();null==(n=e.variantChildren)||n.forEach(e=>{var s;return null==(s=e.animationState)?void 0:s.setActive(t,r)}),s[t].isActive=r;let i=a(t);for(let e in s)s[e].protectedKeys={};return i},setAnimateFunction:function(s){t=s(e)},getState:()=>s,reset:()=>{s=s6(),r=!0}}}(e))}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();eh(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),null==(e=this.unmountControls)||e.call(this)}}},exit:{Feature:class extends s9{constructor(){super(...arguments),this.id=s8++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===s)return;let r=this.node.animationState.setActive("exit",!e);t&&!e&&r.then(()=>t(this.id))}mount(){let{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}},inView:{Feature:class extends s9{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var e;let t;this.unmount();let{viewport:s={}}=this.node.getProps(),{root:r,margin:n,amount:a="some",once:i}=s,o={root:r?r.current:void 0,rootMargin:n,threshold:"number"==typeof a?a:as[a]},l=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);let{onViewportEnter:s,onViewportLeave:r}=this.node.getProps(),n=t?s:r;n&&n(e)};return e=this.node.current,t=function({root:e,...t}){let s=e||document;n7.has(s)||n7.set(s,{});let r=n7.get(s),n=JSON.stringify(t);return r[n]||(r[n]=new IntersectionObserver(at,{root:e,...t})),r[n]}(o),n8.set(e,l),t.observe(e),()=>{n8.delete(e),t.unobserve(e)}}mount(){this.startObserver()}update(){if("u"<typeof IntersectionObserver)return;let{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return s=>e[s]!==t[s]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends s9{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,s={}){let[r,n,a]=nZ(e,s),i=e=>{let r=e.currentTarget;if(!n6(e)||n5.has(r))return;n5.add(r);let a=t(e),i=(e,t)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",l),n6(e)&&n5.has(r)&&(n5.delete(r),"function"==typeof a&&a(e,{success:t}))},o=e=>{i(e,s.useGlobalTarget||n1(r,e.target))},l=e=>{i(e,!1)};window.addEventListener("pointerup",o,n),window.addEventListener("pointercancel",l,n)};return r.forEach(e=>{n2.has(e.tagName)||-1!==e.tabIndex||null!==e.getAttribute("tabindex")||(e.tabIndex=0),(s.useGlobalTarget?window:e).addEventListener("pointerdown",i,n),e.addEventListener("focus",e=>((e,t)=>{let s=e.currentTarget;if(!s)return;let r=n3(()=>{if(n5.has(s))return;n4(s,"down");let e=n3(()=>{n4(s,"up")});s.addEventListener("keyup",e,t),s.addEventListener("blur",()=>n4(s,"cancel"),t)});s.addEventListener("keydown",r,t),s.addEventListener("blur",()=>s.removeEventListener("keydown",r),t)})(e,n),n)}),a}(e,e=>(n9(this.node,e,"Start"),(e,{success:t})=>n9(this.node,e,t?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends s9{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=sg(rt(this.node.current,"focus",()=>this.onFocus()),rt(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends s9{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,s={}){let[r,n,a]=nZ(e,s),i=nQ(e=>{let{target:s}=e,r=t(e);if("function"!=typeof r||!s)return;let a=nQ(e=>{r(e),s.removeEventListener("pointerleave",a)});s.addEventListener("pointerleave",a,n)});return r.forEach(e=>{e.addEventListener("pointerenter",i,n)}),a}(e,e=>(n0(this.node,e,"Start"),e=>n0(this.node,e,"End"))))}unmount(){}}},pan:{Feature:class extends s9{constructor(){super(...arguments),this.removePointerDownListener=ej}onPointerDown(e){this.session=new ra(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:rI(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:s,onPanEnd:r}=this.node.getProps();return{onSessionStart:rO(e),onStart:rO(t),onMove:s,onEnd:(e,t)=>{delete this.session,r&&eq.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=rr(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends s9{constructor(e){super(e),this.removeGroupControls=ej,this.removeListeners=ej,this.controls=new rU(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ej}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:nJ,MeasureLayout:r1},layout:{ProjectionNode:nJ,MeasureLayout:r1}},u=(e,t)=>ax(e)?new aX(t):new aY(t,{allowProjection:e!==m.Fragment}),function(e,{forwardMotionProps:t}={forwardMotionProps:!1}){return function({preloadedFeatures:e,createVisualElement:t,useRender:s,useVisualState:r,Component:n}){var a,i;function o(e,a){var i;let o,l={...(0,m.useContext)(an),...e,layoutId:function({layoutId:e}){let t=(0,m.useContext)(rH).id;return t&&void 0!==e?t+"-"+e:e}(e)},{isStatic:c}=l,d=function(e){let{initial:t,animate:s}=function(e,t){if(ai(e)){let{initial:t,animate:s}=e;return{initial:!1===t||ex(t)?t:void 0,animate:ex(s)?s:void 0}}return!1!==e.inherit?t:{}}(e,(0,m.useContext)(aa));return(0,m.useMemo)(()=>({initial:t,animate:s}),[al(t),al(s)])}(e),u=r(e,c);if(!c&&ac){(0,m.useContext)(ar).strict;let e=function(e){let{drag:t,layout:s}=au;if(!t&&!s)return{};let r={...t,...s};return{MeasureLayout:(null==t?void 0:t.isEnabled(e))||(null==s?void 0:s.isEnabled(e))?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(l);o=e.MeasureLayout,d.visualElement=function(e,t,s,r,n){var a,i;let{visualElement:o}=(0,m.useContext)(aa),l=(0,m.useContext)(ar),c=(0,m.useContext)(rq),d=(0,m.useContext)(an).reducedMotion,u=(0,m.useRef)(null);r=r||l.renderer,!u.current&&r&&(u.current=r(e,{visualState:t,parent:o,props:s,presenceContext:c,blockInitialAnimation:!!c&&!1===c.initial,reducedMotionConfig:d}));let h=u.current,p=(0,m.useContext)(rK);h&&!h.projection&&n&&("html"===h.type||"svg"===h.type)&&function(e,t,s,r){let{layoutId:n,layout:a,drag:i,dragConstraints:o,layoutScroll:l,layoutRoot:c}=t;e.projection=new s(e.latestValues,t["data-framer-portal-id"]?void 0:function e(t){if(t)return!1!==t.options.allowProjection?t.projection:e(t.parent)}(e.parent)),e.projection.setOptions({layoutId:n,layout:a,alwaysMeasureLayout:!!i||o&&rd(o),visualElement:e,animationType:"string"==typeof a?a:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:c})}(u.current,s,n,p);let x=(0,m.useRef)(!1);(0,m.useInsertionEffect)(()=>{h&&x.current&&h.update(s,c)});let g=s[e3],f=(0,m.useRef)(!!g&&!(null==(a=window.MotionHandoffIsComplete)?void 0:a.call(window,g))&&(null==(i=window.MotionHasOptimisedAnimation)?void 0:i.call(window,g)));return am(()=>{h&&(x.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),rZ.render(h.render),f.current&&h.animationState&&h.animationState.animateChanges())}),(0,m.useEffect)(()=>{h&&(!f.current&&h.animationState&&h.animationState.animateChanges(),f.current&&(queueMicrotask(()=>{var e;null==(e=window.MotionHandoffMarkAsComplete)||e.call(window,g)}),f.current=!1))}),h}(n,u,l,t,e.ProjectionNode)}return(0,h.jsxs)(aa.Provider,{value:d,children:[o&&d.visualElement?(0,h.jsx)(o,{visualElement:d.visualElement,...l}):null,s(n,e,(i=d.visualElement,(0,m.useCallback)(e=>{e&&u.onMount&&u.onMount(e),i&&(e?i.mount(e):i.unmount()),a&&("function"==typeof a?a(e):rd(a)&&(a.current=e))},[i])),u,c,d.visualElement)]})}e&&function(e){for(let t in e)au[t]={...au[t],...e[t]}}(e),o.displayName=`motion.${"string"==typeof n?n:`create(${null!=(i=null!=(a=n.displayName)?a:n.name)?i:""})`}`;let l=(0,m.forwardRef)(o);return l[ah]=n,l}({...ax(e)?aF:aV,preloadedFeatures:d,useRender:function(e=!1){return(t,s,r,{latestValues:n},a)=>{let i=(ax(t)?function(e,t,s,r){let n=(0,m.useMemo)(()=>{let s=aA();return aS(s,t,aM(r),e.transformTemplate),{...s.attrs,style:{...s.style}}},[t]);if(e.style){let t={};aI(t,e.style,e),n.style={...t,...n.style}}return n}:function(e,t){let s,r,n={},a=(s=e.style||{},aI(r={},s,e),Object.assign(r,function({transformTemplate:e},t){return(0,m.useMemo)(()=>{let s=aC();return aj(s,t,e),Object.assign({},s.vars,s.style)},[t])}(e,t)),r);return e.drag&&!1!==e.dragListener&&(n.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=a,n})(s,n,a,t),o=function(e,t,s){let r={};for(let n in e)("values"!==n||"object"!=typeof e.values)&&(az(n)||!0===s&&aU(n)||!t&&!aU(n)||e.draggable&&n.startsWith("onDrag"))&&(r[n]=e[n]);return r}(s,"string"==typeof t,e),l=t!==m.Fragment?{...o,...i,ref:r}:{},{children:c}=s,d=(0,m.useMemo)(()=>e1(c)?c.get():c,[c]);return(0,m.createElement)(t,{...l,children:d})}}(t),createVisualElement:u,Component:e})}));function aZ(){for(var e,t,s=0,r="",n=arguments.length;s<n;s++)(e=arguments[s])&&(t=function e(t){var s,r,n="";if("string"==typeof t||"number"==typeof t)n+=t;else if("object"==typeof t)if(Array.isArray(t)){var a=t.length;for(s=0;s<a;s++)t[s]&&(r=e(t[s]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}(e))&&(r&&(r+=" "),r+=t);return r}let aQ=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),a0=[],a1=(e,t,s)=>{if(0==e.length-t)return s.classGroupId;let r=e[t],n=s.nextPart.get(r);if(n){let s=a1(e,t+1,n);if(s)return s}let a=s.validators;if(null===a)return;let i=0===t?e.join("-"):e.slice(t).join("-"),o=a.length;for(let e=0;e<o;e++){let t=a[e];if(t.validator(i))return t.classGroupId}},a2=(e,t)=>{let s=aQ();for(let r in e)a5(e[r],s,r,t);return s},a5=(e,t,s,r)=>{let n=e.length;for(let a=0;a<n;a++)a3(e[a],t,s,r)},a3=(e,t,s,r)=>{"string"==typeof e?a4(e,t,s):"function"==typeof e?a6(e,t,s,r):a9(e,t,s,r)},a4=(e,t,s)=>{(""===e?t:a8(t,e)).classGroupId=s},a6=(e,t,s,r)=>{a7(e)?a5(e(r),t,s,r):(null===t.validators&&(t.validators=[]),t.validators.push({classGroupId:s,validator:e}))},a9=(e,t,s,r)=>{let n=Object.entries(e),a=n.length;for(let e=0;e<a;e++){let[a,i]=n[e];a5(i,a8(t,a),s,r)}},a8=(e,t)=>{let s=e,r=t.split("-"),n=r.length;for(let e=0;e<n;e++){let t=r[e],n=s.nextPart.get(t);n||(n=aQ(),s.nextPart.set(t,n)),s=n}return s},a7=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,ie=[],it=(e,t,s,r,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:r,isExternal:n}),is=/\s+/,ir=e=>{let t;if("string"==typeof e)return e;let s="";for(let r=0;r<e.length;r++)e[r]&&(t=ir(e[r]))&&(s&&(s+=" "),s+=t);return s},ia=[],ii=e=>{let t=t=>t[e]||ia;return t.isThemeGetter=!0,t},io=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,il=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ic=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,id=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,iu=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ih=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,im=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ip=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ix=e=>ic.test(e),ig=e=>!!e&&!Number.isNaN(Number(e)),ib=e=>!!e&&Number.isInteger(Number(e)),iv=e=>e.endsWith("%")&&ig(e.slice(0,-1)),iy=e=>id.test(e),ij=()=>!0,iw=e=>iu.test(e)&&!ih.test(e),ik=()=>!1,iN=e=>im.test(e),iS=e=>ip.test(e),iC=e=>!iM(e)&&!iF(e),iA=e=>iq(e,iG,ik),iM=e=>io.test(e),iP=e=>iq(e,iY,iw),iE=e=>iq(e,iX,ig),iT=e=>iq(e,iZ,ij),iD=e=>iq(e,iJ,ik),i$=e=>iq(e,iH,ik),iR=e=>iq(e,iK,iS),i_=e=>iq(e,iQ,iN),iF=e=>il.test(e),iV=e=>iW(e,iY),iI=e=>iW(e,iJ),iL=e=>iW(e,iH),iU=e=>iW(e,iG),iz=e=>iW(e,iK),iO=e=>iW(e,iQ,!0),iB=e=>iW(e,iZ,!0),iq=(e,t,s)=>{let r=io.exec(e);return!!r&&(r[1]?t(r[1]):s(r[2]))},iW=(e,t,s=!1)=>{let r=il.exec(e);return!!r&&(r[1]?t(r[1]):s)},iH=e=>"position"===e||"percentage"===e,iK=e=>"image"===e||"url"===e,iG=e=>"length"===e||"size"===e||"bg-size"===e,iY=e=>"length"===e,iX=e=>"number"===e,iJ=e=>"family-name"===e,iZ=e=>"number"===e||"weight"===e,iQ=e=>"shadow"===e,i0=((e,...t)=>{let s,r,n,a,i=e=>{let t=r(e);if(t)return t;let a=((e,t)=>{let{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:n,sortModifiers:a}=t,i=[],o=e.trim().split(is),l="";for(let e=o.length-1;e>=0;e-=1){let t=o[e],{isExternal:c,modifiers:d,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:m}=s(t);if(c){l=t+(l.length>0?" "+l:l);continue}let p=!!m,x=r(p?h.substring(0,m):h);if(!x){if(!p||!(x=r(h))){l=t+(l.length>0?" "+l:l);continue}p=!1}let g=0===d.length?"":1===d.length?d[0]:a(d).join(":"),f=u?g+"!":g,b=f+x;if(i.indexOf(b)>-1)continue;i.push(b);let v=n(x,p);for(let e=0;e<v.length;++e){let t=v[e];i.push(f+t)}l=t+(l.length>0?" "+l:l)}return l})(e,s);return n(e,a),a};return a=o=>{var l;let c;return r=(s={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,s=Object.create(null),r=Object.create(null),n=(n,a)=>{s[n]=a,++t>e&&(t=0,r=s,s=Object.create(null))};return{get(e){let t=s[e];return void 0!==t?t:void 0!==(t=r[e])?(n(e,t),t):void 0},set(e,t){e in s?s[e]=t:n(e,t)}}})((l=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{prefix:t,experimentalParseClassName:s}=e,r=e=>{let t,s=[],r=0,n=0,a=0,i=e.length;for(let o=0;o<i;o++){let i=e[o];if(0===r&&0===n){if(":"===i){s.push(e.slice(a,o)),a=o+1;continue}if("/"===i){t=o;continue}}"["===i?r++:"]"===i?r--:"("===i?n++:")"===i&&n--}let o=0===s.length?e:e.slice(a),l=o,c=!1;return o.endsWith("!")?(l=o.slice(0,-1),c=!0):o.startsWith("!")&&(l=o.slice(1),c=!0),it(s,c,l,t&&t>a?t-a:void 0)};if(t){let e=t+":",s=r;r=t=>t.startsWith(e)?s(t.slice(e.length)):it(ie,!1,t,void 0,!0)}if(s){let e=r;r=t=>s({className:t,parseClassName:e})}return r})(l),sortModifiers:(c=new Map,l.orderSensitiveModifiers.forEach((e,t)=>{c.set(e,1e6+t)}),e=>{let t=[],s=[];for(let r=0;r<e.length;r++){let n=e[r],a="["===n[0],i=c.has(n);a||i?(s.length>0&&(s.sort(),t.push(...s),s=[]),t.push(n)):s.push(n)}return s.length>0&&(s.sort(),t.push(...s)),t}),...(e=>{let t=(e=>{let{theme:t,classGroups:s}=e;return a2(s,t)})(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]")){var s;let t,r,n;return -1===(s=e).slice(1,-1).indexOf(":")?void 0:(r=(t=s.slice(1,-1)).indexOf(":"),(n=t.slice(0,r))?"arbitrary.."+n:void 0)}let r=e.split("-"),n=+(""===r[0]&&r.length>1);return a1(r,n,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],n=s[e];if(t){if(n){let e=Array(n.length+t.length);for(let t=0;t<n.length;t++)e[t]=n[t];for(let s=0;s<t.length;s++)e[n.length+s]=t[s];return e}return t}return n||a0}return s[e]||a0}}})(l)}).cache.get,n=s.cache.set,a=i,i(o)},(...e)=>a(((...e)=>{let t,s,r=0,n="";for(;r<e.length;)(t=e[r++])&&(s=ir(t))&&(n&&(n+=" "),n+=s);return n})(...e))})(()=>{let e=ii("color"),t=ii("font"),s=ii("text"),r=ii("font-weight"),n=ii("tracking"),a=ii("leading"),i=ii("breakpoint"),o=ii("container"),l=ii("spacing"),c=ii("radius"),d=ii("shadow"),u=ii("inset-shadow"),h=ii("text-shadow"),m=ii("drop-shadow"),p=ii("blur"),x=ii("perspective"),g=ii("aspect"),f=ii("ease"),b=ii("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],y=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...y(),iF,iM],w=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],N=()=>[iF,iM,l],S=()=>[ix,"full","auto",...N()],C=()=>[ib,"none","subgrid",iF,iM],A=()=>["auto",{span:["full",ib,iF,iM]},ib,iF,iM],M=()=>[ib,"auto",iF,iM],P=()=>["auto","min","max","fr",iF,iM],E=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],T=()=>["start","end","center","stretch","center-safe","end-safe"],D=()=>["auto",...N()],$=()=>[ix,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...N()],R=()=>[ix,"screen","full","dvw","lvw","svw","min","max","fit",...N()],_=()=>[ix,"screen","full","lh","dvh","lvh","svh","min","max","fit",...N()],F=()=>[e,iF,iM],V=()=>[...y(),iL,i$,{position:[iF,iM]}],I=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",iU,iA,{size:[iF,iM]}],U=()=>[iv,iV,iP],z=()=>["","none","full",c,iF,iM],O=()=>["",ig,iV,iP],B=()=>["solid","dashed","dotted","double"],q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>[ig,iv,iL,i$],H=()=>["","none",p,iF,iM],K=()=>["none",ig,iF,iM],G=()=>["none",ig,iF,iM],Y=()=>[ig,iF,iM],X=()=>[ix,"full",...N()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[iy],breakpoint:[iy],color:[ij],container:[iy],"drop-shadow":[iy],ease:["in","out","in-out"],font:[iC],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[iy],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[iy],shadow:[iy],spacing:["px",ig],text:[iy],"text-shadow":[iy],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ix,iM,iF,g]}],container:["container"],columns:[{columns:[ig,iM,iF,o]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:j()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:S()}],"inset-x":[{"inset-x":S()}],"inset-y":[{"inset-y":S()}],start:[{"inset-s":S(),start:S()}],end:[{"inset-e":S(),end:S()}],"inset-bs":[{"inset-bs":S()}],"inset-be":[{"inset-be":S()}],top:[{top:S()}],right:[{right:S()}],bottom:[{bottom:S()}],left:[{left:S()}],visibility:["visible","invisible","collapse"],z:[{z:[ib,"auto",iF,iM]}],basis:[{basis:[ix,"full","auto",o,...N()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ig,ix,"auto","initial","none",iM]}],grow:[{grow:["",ig,iF,iM]}],shrink:[{shrink:["",ig,iF,iM]}],order:[{order:[ib,"first","last","none",iF,iM]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":P()}],"auto-rows":[{"auto-rows":P()}],gap:[{gap:N()}],"gap-x":[{"gap-x":N()}],"gap-y":[{"gap-y":N()}],"justify-content":[{justify:[...E(),"normal"]}],"justify-items":[{"justify-items":[...T(),"normal"]}],"justify-self":[{"justify-self":["auto",...T()]}],"align-content":[{content:["normal",...E()]}],"align-items":[{items:[...T(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...T(),{baseline:["","last"]}]}],"place-content":[{"place-content":E()}],"place-items":[{"place-items":[...T(),"baseline"]}],"place-self":[{"place-self":["auto",...T()]}],p:[{p:N()}],px:[{px:N()}],py:[{py:N()}],ps:[{ps:N()}],pe:[{pe:N()}],pbs:[{pbs:N()}],pbe:[{pbe:N()}],pt:[{pt:N()}],pr:[{pr:N()}],pb:[{pb:N()}],pl:[{pl:N()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mbs:[{mbs:D()}],mbe:[{mbe:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":N()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":N()}],"space-y-reverse":["space-y-reverse"],size:[{size:$()}],"inline-size":[{inline:["auto",...R()]}],"min-inline-size":[{"min-inline":["auto",...R()]}],"max-inline-size":[{"max-inline":["none",...R()]}],"block-size":[{block:["auto",..._()]}],"min-block-size":[{"min-block":["auto",..._()]}],"max-block-size":[{"max-block":["none",..._()]}],w:[{w:[o,"screen",...$()]}],"min-w":[{"min-w":[o,"screen","none",...$()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[i]},...$()]}],h:[{h:["screen","lh",...$()]}],"min-h":[{"min-h":["screen","lh","none",...$()]}],"max-h":[{"max-h":["screen","lh",...$()]}],"font-size":[{text:["base",s,iV,iP]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,iB,iT]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",iv,iM]}],"font-family":[{font:[iI,iD,t]}],"font-features":[{"font-features":[iM]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,iF,iM]}],"line-clamp":[{"line-clamp":[ig,"none",iF,iE]}],leading:[{leading:[a,...N()]}],"list-image":[{"list-image":["none",iF,iM]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",iF,iM]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...B(),"wavy"]}],"text-decoration-thickness":[{decoration:[ig,"from-font","auto",iF,iP]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[ig,"auto",iF,iM]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",iF,iM]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",iF,iM]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:V()}],"bg-repeat":[{bg:I()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ib,iF,iM],radial:["",iF,iM],conic:[ib,iF,iM]},iz,iR]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:O()}],"border-w-x":[{"border-x":O()}],"border-w-y":[{"border-y":O()}],"border-w-s":[{"border-s":O()}],"border-w-e":[{"border-e":O()}],"border-w-bs":[{"border-bs":O()}],"border-w-be":[{"border-be":O()}],"border-w-t":[{"border-t":O()}],"border-w-r":[{"border-r":O()}],"border-w-b":[{"border-b":O()}],"border-w-l":[{"border-l":O()}],"divide-x":[{"divide-x":O()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":O()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...B(),"hidden","none"]}],"divide-style":[{divide:[...B(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...B(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ig,iF,iM]}],"outline-w":[{outline:["",ig,iV,iP]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",d,iO,i_]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",u,iO,i_]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:O()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[ig,iP]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":O()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",h,iO,i_]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[ig,iF,iM]}],"mix-blend":[{"mix-blend":[...q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ig]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[iF,iM]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":y()}],"mask-image-conic-pos":[{"mask-conic":[ig]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:V()}],"mask-repeat":[{mask:I()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",iF,iM]}],filter:[{filter:["","none",iF,iM]}],blur:[{blur:H()}],brightness:[{brightness:[ig,iF,iM]}],contrast:[{contrast:[ig,iF,iM]}],"drop-shadow":[{"drop-shadow":["","none",m,iO,i_]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",ig,iF,iM]}],"hue-rotate":[{"hue-rotate":[ig,iF,iM]}],invert:[{invert:["",ig,iF,iM]}],saturate:[{saturate:[ig,iF,iM]}],sepia:[{sepia:["",ig,iF,iM]}],"backdrop-filter":[{"backdrop-filter":["","none",iF,iM]}],"backdrop-blur":[{"backdrop-blur":H()}],"backdrop-brightness":[{"backdrop-brightness":[ig,iF,iM]}],"backdrop-contrast":[{"backdrop-contrast":[ig,iF,iM]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ig,iF,iM]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ig,iF,iM]}],"backdrop-invert":[{"backdrop-invert":["",ig,iF,iM]}],"backdrop-opacity":[{"backdrop-opacity":[ig,iF,iM]}],"backdrop-saturate":[{"backdrop-saturate":[ig,iF,iM]}],"backdrop-sepia":[{"backdrop-sepia":["",ig,iF,iM]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":N()}],"border-spacing-x":[{"border-spacing-x":N()}],"border-spacing-y":[{"border-spacing-y":N()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",iF,iM]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ig,"initial",iF,iM]}],ease:[{ease:["linear","initial",f,iF,iM]}],delay:[{delay:[ig,iF,iM]}],animate:[{animate:["none",b,iF,iM]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,iF,iM]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:K()}],"rotate-x":[{"rotate-x":K()}],"rotate-y":[{"rotate-y":K()}],"rotate-z":[{"rotate-z":K()}],scale:[{scale:G()}],"scale-x":[{"scale-x":G()}],"scale-y":[{"scale-y":G()}],"scale-z":[{"scale-z":G()}],"scale-3d":["scale-3d"],skew:[{skew:Y()}],"skew-x":[{"skew-x":Y()}],"skew-y":[{"skew-y":Y()}],transform:[{transform:[iF,iM,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:X()}],"translate-x":[{"translate-x":X()}],"translate-y":[{"translate-y":X()}],"translate-z":[{"translate-z":X()}],"translate-none":["translate-none"],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",iF,iM]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mbs":[{"scroll-mbs":N()}],"scroll-mbe":[{"scroll-mbe":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pbs":[{"scroll-pbs":N()}],"scroll-pbe":[{"scroll-pbe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",iF,iM]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[ig,iV,iP,iE]}],stroke:[{stroke:["none",...F()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function i1(...e){return i0(aZ(e))}let i2={chat:q,sessions:_,workspace:R,agents:D,pairing:B,mcp:L,skills:q,channels:U,overview:F,monitor:T,cron:$,logs:z,config:R,voice:I,settings:O},i5={workspace:V,agents:D,ops:T,settings:O};function i3({collapsed:e}){let{segment:t}=ee(),{navigate:s}=N();return e?(0,h.jsx)("nav",{className:"px-1.5 pt-3 pb-2 space-y-1 shrink-0",role:"tablist","aria-label":"Primary navigation",children:W.map(e=>{let r=e===t,n=i5[e]??F;return(0,h.jsxs)("button",{role:"tab","aria-selected":r,onClick:()=>s(K[e]),title:H[e],className:i1("relative w-full h-7 flex items-center justify-center rounded-md transition-colors",r?"text-fg":"text-fg-muted hover:text-fg active:bg-bg-hover"),children:[r&&(0,h.jsx)(aJ.span,{layoutId:"sidebar-segment",className:"absolute inset-0 rounded-md bg-bg-selected shadow-[inset_0_0_0_1px_rgba(255,255,255,0.05)]",transition:{type:"spring",stiffness:520,damping:36}}),(0,h.jsx)(n,{className:"relative h-3.5 w-3.5 opacity-80"})]},e)})}):(0,h.jsx)("div",{className:"px-2 pt-3 pb-2 shrink-0",children:(0,h.jsx)("div",{className:"relative inline-flex items-center w-full p-0.5 rounded-[9px] bg-bg-elevated shadow-[inset_0_0_0_1px_var(--border-soft)]",role:"tablist","aria-label":"Primary navigation",children:W.map(e=>{let r=e===t,n=i5[e]??F;return(0,h.jsxs)("button",{role:"tab","aria-selected":r,title:H[e],onClick:()=>s(K[e]),className:i1("relative flex-1 h-7 flex items-center justify-center rounded-[6px]","transition-colors duration-150 ease-out-quart",r?"text-fg":"text-fg-muted hover:text-fg"),children:[r&&(0,h.jsx)(aJ.span,{layoutId:"sidebar-segment",transition:{type:"spring",stiffness:520,damping:36},className:"absolute inset-0 rounded-[6px] bg-bg-main shadow-[0_1px_2px_rgba(0,0,0,0.06),inset_0_0_0_1px_var(--border-soft)]"}),(0,h.jsx)(n,{className:"relative z-[1] h-3.5 w-3.5"})]},e)})})})}let i4=E("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),i6=E("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),i9=E("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);var i8=m;class i7 extends i8.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=this.props.sizeRef.current;e.height=t.offsetHeight||0,e.width=t.offsetWidth||0,e.top=t.offsetTop,e.left=t.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function oe({children:e,isPresent:t}){let s=(0,i8.useId)(),r=(0,i8.useRef)(null),n=(0,i8.useRef)({width:0,height:0,top:0,left:0}),{nonce:a}=(0,i8.useContext)(an);return(0,i8.useInsertionEffect)(()=>{let{width:e,height:i,top:o,left:l}=n.current;if(t||!r.current||!e||!i)return;r.current.dataset.motionPopId=s;let c=document.createElement("style");return a&&(c.nonce=a),document.head.appendChild(c),c.sheet&&c.sheet.insertRule(`
2
+ [data-motion-pop-id="${s}"] {
3
+ position: absolute !important;
4
+ width: ${e}px !important;
5
+ height: ${i}px !important;
6
+ top: ${o}px !important;
7
+ left: ${l}px !important;
8
+ }
9
+ `),()=>{document.head.removeChild(c)}},[t]),(0,h.jsx)(i7,{isPresent:t,childRef:r,sizeRef:n,children:i8.cloneElement(e,{ref:r})})}let ot=({children:e,initial:t,isPresent:s,onExitComplete:r,custom:n,presenceAffectsLayout:a,mode:i})=>{let o=ag(os),l=(0,m.useId)(),c=(0,m.useCallback)(e=>{for(let t of(o.set(e,!0),o.values()))if(!t)return;r&&r()},[o,r]),d=(0,m.useMemo)(()=>({id:l,initial:t,isPresent:s,custom:n,onExitComplete:c,register:e=>(o.set(e,!1),()=>o.delete(e))}),a?[Math.random(),c]:[s,c]);return(0,m.useMemo)(()=>{o.forEach((e,t)=>o.set(t,!1))},[s]),m.useEffect(()=>{s||o.size||!r||r()},[s]),"popLayout"===i&&(e=(0,h.jsx)(oe,{isPresent:s,children:e})),(0,h.jsx)(rq.Provider,{value:d,children:e})};function os(){return new Map}let or=e=>e.key||"";function on(e){let t=[];return m.Children.forEach(e,e=>{(0,m.isValidElement)(e)&&t.push(e)}),t}let oa=({children:e,custom:t,initial:s=!0,onExitComplete:r,presenceAffectsLayout:n=!0,mode:a="sync",propagate:i=!1})=>{let[o,l]=rW(i),c=(0,m.useMemo)(()=>on(e),[e]),d=i&&!o?[]:c.map(or),u=(0,m.useRef)(!0),p=(0,m.useRef)(c),x=ag(()=>new Map),[g,f]=(0,m.useState)(c),[b,v]=(0,m.useState)(c);am(()=>{u.current=!1,p.current=c;for(let e=0;e<b.length;e++){let t=or(b[e]);d.includes(t)?x.delete(t):!0!==x.get(t)&&x.set(t,!1)}},[b,d.length,d.join("-")]);let y=[];if(c!==g){let e=[...c];for(let t=0;t<b.length;t++){let s=b[t],r=or(s);d.includes(r)||(e.splice(t,0,s),y.push(s))}"wait"===a&&y.length&&(e=y),v(on(e)),f(c);return}let{forceRender:j}=(0,m.useContext)(rH);return(0,h.jsx)(h.Fragment,{children:b.map(e=>{let m=or(e),g=(!i||!!o)&&(c===b||d.includes(m));return(0,h.jsx)(ot,{isPresent:g,initial:(!u.current||!!s)&&void 0,custom:g?void 0:t,presenceAffectsLayout:n,mode:a,onExitComplete:g?void 0:()=>{if(!x.has(m))return;x.set(m,!0);let e=!0;x.forEach(t=>{t||(e=!1)}),e&&(null==j||j(),v(p.current),i&&(null==l||l()),r&&r())},children:e},m)})})},oi=E("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),oo=E("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),ol=E("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),oc=E("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),od=E("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),ou=E("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),oh=E("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]),om=E("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),op={manager:{bg:"bg-amber-500/10",text:"text-amber-500",ring:"ring-amber-500/40"},developer:{bg:"bg-emerald-500/10",text:"text-emerald-500",ring:"ring-emerald-500/40"},reviewer:{bg:"bg-violet-500/10",text:"text-violet-500",ring:"ring-violet-500/40"},tester:{bg:"bg-sky-500/10",text:"text-sky-500",ring:"ring-sky-500/40"},fixer:{bg:"bg-rose-500/10",text:"text-rose-500",ring:"ring-rose-500/40"},researcher:{bg:"bg-cyan-500/10",text:"text-cyan-500",ring:"ring-cyan-500/40"}},ox=e=>op[e]??{bg:"bg-bg-elevated",text:"text-fg",ring:"ring-fg-subtle/30"},og=[{id:"full",label:"Full team",hint:"All 6 roles — best for complex projects",ids:["manager","researcher","developer","reviewer","tester","fixer"]},{id:"core",label:"Core team",hint:"Manager + Developer + Reviewer",ids:["manager","developer","reviewer"]},{id:"custom",label:"Custom",hint:"Pick roles individually",ids:[]}];function of({open:e,onClose:t,onCreated:s}){let{api:r}=f(),{refreshAgents:n}=ea(),[a,i]=(0,m.useState)(0),[o,l]=(0,m.useState)(!1),[c,d]=(0,m.useState)(null),[u,p]=(0,m.useState)("My Team"),[x,g]=(0,m.useState)("full"),[b,v]=(0,m.useState)(og[0].ids),[y,j]=(0,m.useState)([]),[w,k]=(0,m.useState)(""),[N,S]=(0,m.useState)([]),[C,A]=(0,m.useState)("same"),[M,P]=(0,m.useState)([]),[E,T]=(0,m.useState)(""),[D,$]=(0,m.useState)({}),[R,_]=(0,m.useState)("manual");(0,m.useEffect)(()=>{e&&r&&Promise.all([r.teamRoles().catch(()=>[]),r.projects().catch(()=>[]),r.getModels().catch(()=>[]),r.getConfig().catch(()=>({}))]).then(([e,t,s,r])=>{j(e),S(t.map(e=>({id:e.id,name:e.name,path:e.path}))),P(s),T(r.model??s[0]??""),t.length>0&&!w&&k(t[0].path)})},[e,r]),(0,m.useEffect)(()=>{if("custom"===x)return;let e=og.find(e=>e.id===x);e&&v(e.ids)},[x]),(0,m.useEffect)(()=>{"per"===C&&$(e=>{let t={...e};for(let e of b)t[e]||(t[e]=E);return t})},[b,C,E]),(0,m.useEffect)(()=>{e&&(i(0),d(null))},[e]);let F=e=>0===e?u.trim().length>0&&b.length>0:1===e?w.trim().length>0:2!==e||("same"===C?!!E:b.every(e=>!!D[e])),V=async()=>{if(r){d(null),l(!0);try{let e={};for(let t of b)e[t]="same"===C?E:D[t]??E;let t=await r.createTeam({name:u.trim(),roleIds:b,dir:w,modelMap:e,..."manual"!==R?{schedule:R}:{}});n(),s(t)}catch(e){d(e instanceof Error?e.message:String(e))}finally{l(!1)}}};return e?(0,h.jsxs)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[(0,h.jsx)(aJ.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:t}),(0,h.jsxs)(aJ.div,{initial:{opacity:0,scale:.96,y:8},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:8},transition:{duration:.18,ease:[.16,1,.3,1]},className:"relative w-[640px] max-w-full max-h-[90vh] rounded-2xl bg-bg-panel shadow-elevated overflow-hidden flex flex-col",children:[(0,h.jsxs)("div",{className:"px-5 pt-5 pb-3 border-b border-border flex items-center gap-3",children:[(0,h.jsx)("div",{className:"w-9 h-9 rounded-xl bg-accent-soft text-accent flex items-center justify-center",children:(0,h.jsx)(q,{className:"h-4.5 w-4.5"})}),(0,h.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,h.jsx)("h2",{className:"text-[14px] font-semibold",children:"Create a team"}),(0,h.jsx)("p",{className:"text-[11px] text-fg-subtle",children:"Spin up a multi-agent collab — they share a workspace and talk to each other."})]}),(0,h.jsx)("button",{onClick:t,className:"text-fg-subtle hover:text-fg p-1.5 rounded-md hover:bg-bg-hover",children:(0,h.jsx)(oi,{className:"h-4 w-4"})})]}),(0,h.jsx)(ov,{step:a}),(0,h.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-5 py-4",children:(0,h.jsxs)(oa,{mode:"wait",initial:!1,children:[0===a&&(0,h.jsxs)(aJ.div,{...ob,className:"space-y-4",children:[(0,h.jsx)(oy,{label:"Team name",children:(0,h.jsx)("input",{autoFocus:!0,type:"text",value:u,onChange:e=>p(e.target.value),placeholder:"e.g. CamelAGI Core",className:"w-full bg-bg-elevated border border-border rounded-md px-3 h-9 text-[13px] focus:outline-none focus:ring-2 focus:ring-accent/40"})}),(0,h.jsx)(oy,{label:"Preset",children:(0,h.jsx)("div",{className:"grid grid-cols-3 gap-2",children:og.map(e=>(0,h.jsxs)("button",{onClick:()=>g(e.id),className:i1("px-3 py-2.5 rounded-lg text-left transition-all",x===e.id?"bg-accent-soft ring-2 ring-accent/40 text-fg":"bg-bg-elevated hover:bg-bg-hover text-fg-muted"),children:[(0,h.jsx)("div",{className:"text-[12px] font-semibold",children:e.label}),(0,h.jsx)("div",{className:"text-[10.5px] text-fg-subtle mt-0.5 leading-tight",children:e.hint})]},e.id))})}),(0,h.jsx)(oy,{label:`Roles \xb7 ${b.length} selected`,children:(0,h.jsx)("div",{className:"space-y-1.5",children:y.map(e=>{let t=b.includes(e.id),s=ox(e.id);return(0,h.jsxs)("button",{onClick:()=>{var t;return t=e.id,void(g("custom"),v(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t]))},className:i1("w-full flex items-center gap-3 px-3 py-2 rounded-lg transition-all text-left",t?"bg-bg-elevated ring-1 ring-border":"bg-transparent hover:bg-bg-hover"),children:[(0,h.jsx)("div",{className:i1("w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-semibold ring-1",s.bg,s.text,s.ring),children:e.id.slice(0,1).toUpperCase()}),(0,h.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,h.jsx)("div",{className:"text-[12.5px] font-medium",children:e.name}),(0,h.jsx)("div",{className:"text-[10.5px] text-fg-subtle truncate",children:e.description})]}),(0,h.jsx)("div",{className:i1("w-4 h-4 rounded-full flex items-center justify-center transition-all",t?"bg-accent text-bg-base":"bg-bg-elevated ring-1 ring-border"),children:t&&(0,h.jsx)(oo,{className:"h-3 w-3",strokeWidth:3})})]},e.id)})})})]},"step0"),1===a&&(0,h.jsxs)(aJ.div,{...ob,className:"space-y-4",children:[(0,h.jsx)(oy,{label:"Working directory",hint:"The folder all team members run their tools in (Bash, Read, Write).",children:(0,h.jsx)("input",{type:"text",value:w,onChange:e=>k(e.target.value),placeholder:"/Users/you/projects/my-app",className:"w-full bg-bg-elevated border border-border rounded-md px-3 h-9 text-[12px] font-mono focus:outline-none focus:ring-2 focus:ring-accent/40"})}),N.length>0&&(0,h.jsx)(oy,{label:"Or pick a registered project",children:(0,h.jsx)("div",{className:"space-y-1.5 max-h-[200px] overflow-y-auto",children:N.map(e=>{let t=w===e.path;return(0,h.jsxs)("button",{onClick:()=>k(e.path),className:i1("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-all",t?"bg-accent-soft ring-1 ring-accent/40":"bg-bg-elevated hover:bg-bg-hover"),children:[(0,h.jsx)(od,{className:i1("h-3.5 w-3.5 shrink-0",t?"text-accent":"text-fg-subtle")}),(0,h.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,h.jsx)("div",{className:"text-[12px] font-medium",children:e.name}),(0,h.jsx)("div",{className:"text-[10px] text-fg-subtle font-mono truncate",children:e.path})]}),t&&(0,h.jsx)(oo,{className:"h-3 w-3 text-accent",strokeWidth:3})]},e.id)})})})]},"step1"),2===a&&(0,h.jsxs)(aJ.div,{...ob,className:"space-y-4",children:[(0,h.jsx)(oy,{label:"Model strategy",children:(0,h.jsx)("div",{className:"grid grid-cols-2 gap-2",children:["same","per"].map(e=>(0,h.jsxs)("button",{onClick:()=>A(e),className:i1("px-3 py-2.5 rounded-lg text-left transition-all",C===e?"bg-accent-soft ring-2 ring-accent/40":"bg-bg-elevated hover:bg-bg-hover"),children:[(0,h.jsx)("div",{className:"text-[12px] font-semibold",children:"same"===e?"Same model for all":"Per-role model"}),(0,h.jsx)("div",{className:"text-[10.5px] text-fg-subtle mt-0.5",children:"same"===e?"Simpler — every agent uses the same one":"Specialise: e.g. Opus for manager, Haiku for tester"})]},e))})}),"same"===C?(0,h.jsx)(oy,{label:"Model",children:(0,h.jsx)(ow,{value:E,models:M,onChange:T})}):(0,h.jsx)(oy,{label:"Per-role model",children:(0,h.jsx)("div",{className:"space-y-2",children:b.map(e=>{let t=y.find(t=>t.id===e);if(!t)return null;let s=ox(e);return(0,h.jsxs)("div",{className:"flex items-center gap-3",children:[(0,h.jsx)("div",{className:i1("w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-semibold ring-1 shrink-0",s.bg,s.text,s.ring),children:e.slice(0,1).toUpperCase()}),(0,h.jsx)("div",{className:"text-[12px] font-medium w-24 shrink-0",children:t.name}),(0,h.jsx)("div",{className:"flex-1",children:(0,h.jsx)(ow,{value:D[e]??E,models:M,onChange:t=>$(s=>({...s,[e]:t}))})})]},e)})})})]},"step2"),3===a&&(0,h.jsxs)(aJ.div,{...ob,className:"space-y-4",children:[(0,h.jsx)(oy,{label:"Pipeline schedule",hint:"When the manager auto-runs the daily improvement workflow. You can always trigger manually from chat.",children:(0,h.jsx)("div",{className:"grid grid-cols-3 gap-2",children:["manual","1d","12h"].map(e=>(0,h.jsxs)("button",{onClick:()=>_(e),className:i1("px-3 py-2.5 rounded-lg text-left transition-all",R===e?"bg-accent-soft ring-2 ring-accent/40":"bg-bg-elevated hover:bg-bg-hover"),children:[(0,h.jsx)("div",{className:"text-[12px] font-semibold",children:"manual"===e?"Manual":"1d"===e?"Daily":"Twice daily"}),(0,h.jsx)("div",{className:"text-[10.5px] text-fg-subtle mt-0.5",children:"manual"===e?"Run only when you say so":"1d"===e?"Once every 24 hours":"Every 12 hours"})]},e))})}),(0,h.jsxs)("div",{className:"rounded-xl border border-border bg-bg-elevated p-4 space-y-2.5",children:[(0,h.jsx)("div",{className:"text-[11px] uppercase tracking-[0.08em] text-fg-subtle",children:"Review"}),(0,h.jsx)(oj,{label:"Name",value:u}),(0,h.jsx)(oj,{label:"Members",value:b.join(" · ")}),(0,h.jsx)(oj,{label:"Workspace",value:(0,h.jsx)("span",{className:"font-mono text-[11px]",children:w})}),(0,h.jsx)(oj,{label:"Models",value:"same"===C?E:(0,h.jsx)("span",{className:"text-[11px]",children:b.map(e=>`${e}=${(D[e]??E).split("/").pop()}`).join(", ")})}),(0,h.jsx)(oj,{label:"Schedule",value:"manual"===R?"Manual":"1d"===R?"Daily":"Twice daily"})]}),c&&(0,h.jsx)("div",{className:"rounded-lg bg-rose-500/10 ring-1 ring-rose-500/30 px-3 py-2 text-[12px] text-rose-500",children:c})]},"step3")]})}),(0,h.jsxs)("div",{className:"px-5 py-3 border-t border-border flex items-center justify-between bg-bg-base/40",children:[(0,h.jsx)("button",{onClick:0===a?t:()=>{a>0&&i(a-1)},className:"text-[12px] text-fg-muted hover:text-fg px-3 h-8 rounded-md hover:bg-bg-hover transition-colors inline-flex items-center gap-1",children:0===a?"Cancel":(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(oc,{className:"h-3.5 w-3.5"})," Back"]})}),a<3?(0,h.jsxs)("button",{onClick:()=>{F(a)&&a<3&&i(a+1)},disabled:!F(a),className:i1("h-8 px-4 rounded-md text-[12px] font-medium inline-flex items-center gap-1.5 transition-all",F(a)?"bg-accent text-bg-base hover:opacity-90":"bg-bg-elevated text-fg-subtle/60 cursor-not-allowed"),children:["Next ",(0,h.jsx)(ol,{className:"h-3.5 w-3.5"})]}):(0,h.jsxs)("button",{onClick:V,disabled:o||!F(2),className:i1("h-8 px-4 rounded-md text-[12px] font-medium inline-flex items-center gap-1.5 transition-all",o||!F(2)?"bg-bg-elevated text-fg-subtle/60 cursor-not-allowed":"bg-accent text-bg-base hover:opacity-90"),children:[o&&(0,h.jsx)(om,{className:"h-3.5 w-3.5 animate-spin"}),"Create team"]})]})]})]}):null}let ob={initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.14}};function ov({step:e}){let t=[{label:"Roles",icon:i9},{label:"Workspace",icon:od},{label:"Models",icon:ou},{label:"Review",icon:oh}];return(0,h.jsx)("div",{className:"px-5 py-3 flex items-center gap-1 border-b border-border bg-bg-base/30",children:t.map((s,r)=>{let n=s.icon,a=r===e,i=r<e;return(0,h.jsxs)("div",{className:"flex items-center gap-1 flex-1",children:[(0,h.jsxs)("div",{className:i1("h-7 px-2.5 rounded-full inline-flex items-center gap-1.5 text-[11px] transition-all",a&&"bg-accent-soft text-accent ring-1 ring-accent/30 font-medium",i&&"text-fg-muted",!a&&!i&&"text-fg-subtle"),children:[(0,h.jsx)(n,{className:"h-3 w-3"}),s.label,i&&(0,h.jsx)(oo,{className:"h-3 w-3",strokeWidth:2.5})]}),r<t.length-1&&(0,h.jsx)("div",{className:i1("h-px flex-1",i?"bg-accent/40":"bg-border")})]},s.label)})})}function oy({label:e,hint:t,children:s}){return(0,h.jsxs)("div",{children:[(0,h.jsxs)("div",{className:"flex items-baseline justify-between mb-1.5",children:[(0,h.jsx)("label",{className:"text-[11px] uppercase tracking-[0.08em] text-fg-subtle font-medium",children:e}),t&&(0,h.jsx)("span",{className:"text-[10.5px] text-fg-subtle/80 truncate ml-3 max-w-[60%]",children:t})]}),s]})}function oj({label:e,value:t}){return(0,h.jsxs)("div",{className:"flex items-baseline gap-3",children:[(0,h.jsx)("span",{className:"text-[10.5px] uppercase tracking-[0.08em] text-fg-subtle w-20 shrink-0",children:e}),(0,h.jsx)("span",{className:"text-[12px] text-fg flex-1 min-w-0 truncate",children:t})]})}function ow({value:e,models:t,onChange:s}){let r=(0,m.useMemo)(()=>{let s=new Set,r=[];for(let n of[e,...t])n&&!s.has(n)&&(s.add(n),r.push(n));return r},[e,t]);return(0,h.jsx)("select",{value:e,onChange:e=>s(e.target.value),className:"w-full bg-bg-elevated border border-border rounded-md px-3 h-9 text-[12px] focus:outline-none focus:ring-2 focus:ring-accent/40",children:r.map(e=>(0,h.jsx)("option",{value:e,children:e},e))})}function ok({collapsed:e}){let{navigate:t}=N(),{setActiveProjectId:s,setActiveAgentId:r}=ea(),{api:n}=f(),[a,i]=(0,m.useState)([]),[o,l]=(0,m.useState)(!1),c=(0,m.useCallback)(()=>{n&&n.teams().then(i).catch(()=>i([]))},[n]);(0,m.useEffect)(()=>{c()},[c]);let d=()=>{s(null),t("chat"),window.dispatchEvent(new CustomEvent("camelagi:new-chat"))},u=e=>{e.coordinator&&r(e.coordinator),t("chat"),window.dispatchEvent(new CustomEvent("camelagi:new-collab",{detail:{teamId:e.id}}))},p=()=>{0===a.length?l(!0):u(a[0])},x=()=>{window.dispatchEvent(new KeyboardEvent("keydown",{key:"k",metaKey:!0,bubbles:!0,cancelable:!0}))},g=0===a.length;return e?(0,h.jsxs)("div",{className:"px-1.5 pt-3 pb-1 space-y-1 shrink-0",children:[(0,h.jsx)("button",{onClick:d,title:"New chat",className:"w-full h-7 flex items-center justify-center rounded-md text-fg-muted hover:text-fg hover:bg-bg-hover transition-colors",children:(0,h.jsx)(i4,{className:"h-3.5 w-3.5"})}),(0,h.jsx)("button",{onClick:p,title:g?"Set up team":`New collab — ${a[0]?.name}`,className:"w-full h-7 flex items-center justify-center rounded-md text-fg-muted hover:text-accent hover:bg-bg-hover transition-colors",children:g?(0,h.jsx)(q,{className:"h-3.5 w-3.5"}):(0,h.jsx)(i9,{className:"h-3.5 w-3.5"})}),(0,h.jsx)("button",{onClick:x,title:"Search (⌘G)",className:"w-full h-7 flex items-center justify-center rounded-md text-fg-muted hover:text-fg hover:bg-bg-hover transition-colors",children:(0,h.jsx)(i6,{className:"h-3.5 w-3.5"})})]}):(0,h.jsxs)("div",{className:"px-2 pt-3 pb-1 space-y-1 shrink-0",children:[(0,h.jsxs)("button",{onClick:d,className:i1("w-full flex items-center gap-2 h-7 px-2.5 rounded-md","text-[12px] text-fg-muted hover:text-fg hover:bg-bg-hover transition-colors"),children:[(0,h.jsx)(i4,{className:"h-3.5 w-3.5 shrink-0"}),(0,h.jsx)("span",{children:"New chat"})]}),(0,h.jsxs)("button",{onClick:p,className:i1("w-full flex items-center gap-2 h-7 px-2.5 rounded-md transition-colors","text-fg-muted hover:text-fg hover:bg-bg-hover"),title:g?"Set up your first team":void 0,children:[g?(0,h.jsx)(q,{className:"h-3.5 w-3.5 shrink-0 text-accent"}):(0,h.jsx)(i9,{className:"h-3.5 w-3.5 shrink-0 text-accent"}),(0,h.jsx)("span",{className:"flex-1 text-left text-[12px]",children:g?"Set up team":"New collab"}),!g&&(0,h.jsx)("span",{className:"text-[10px] text-fg-subtle truncate max-w-[80px]",children:a[0]?.name})]}),(0,h.jsxs)("button",{onClick:x,className:i1("w-full flex items-center gap-2 h-7 px-2.5 rounded-md","text-[12px] text-fg-muted hover:text-fg hover:bg-bg-hover transition-colors"),children:[(0,h.jsx)(i6,{className:"h-3.5 w-3.5 shrink-0"}),(0,h.jsx)("span",{className:"flex-1 text-left",children:"Search"}),(0,h.jsx)("kbd",{className:"text-[10px] text-fg-subtle bg-bg-elevated px-1.5 py-0.5 rounded shadow-[inset_0_0_0_1px_var(--border-soft)]",children:"⌘G"})]}),(0,h.jsx)(of,{open:o,onClose:()=>l(!1),onCreated:e=>{l(!1),i(t=>[...t.filter(t=>t.id!==e.id),e]),u(e)}})]})}function oN({collapsed:e}){let{navigate:t,route:s}=N();return(0,h.jsx)("div",{className:i1("shrink-0 border-t border-border",e?"px-1.5 py-1.5":"px-2 py-1.5"),children:(0,h.jsxs)("button",{onClick:()=>t("settings"),title:e?"Settings":void 0,className:i1("w-full flex items-center rounded-md h-7 transition-colors",e?"justify-center px-0":"gap-2 px-2.5","text-[12px]","settings"===s?"text-fg bg-bg-selected":"text-fg-muted hover:text-fg hover:bg-bg-hover"),children:[(0,h.jsx)(O,{className:"h-3.5 w-3.5 shrink-0"}),!e&&(0,h.jsx)("span",{children:"Settings"})]})})}let oS=E("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]),oC=E("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),oA=E("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),oM=E("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),oP=E("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);function oE({collapsed:e}){let{connected:t,url:s}=f(),{theme:r,toggle:n}=(0,m.useContext)(v),{railCollapsed:a,toggleRail:i}=ee();return e?(0,h.jsxs)("div",{className:"border-t border-border px-1.5 py-2 flex flex-col items-center gap-1",children:[(0,h.jsx)("button",{onClick:n,className:"p-1.5 rounded text-fg-muted hover:text-fg hover:bg-bg-hover transition-colors",title:"dark"===r?"Light":"Dark",children:"dark"===r?(0,h.jsx)(oM,{className:"h-3.5 w-3.5"}):(0,h.jsx)(oA,{className:"h-3.5 w-3.5"})}),(0,h.jsx)("button",{onClick:i,className:"p-1.5 rounded text-fg-muted hover:text-fg hover:bg-bg-hover transition-colors",title:a?"Show":"Hide",children:a?(0,h.jsx)(ei,{className:"h-3.5 w-3.5"}):(0,h.jsx)(oP,{className:"h-3.5 w-3.5"})})]}):(0,h.jsxs)("div",{className:"border-t border-border px-2.5 py-2 flex items-center gap-2",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0 flex-1",children:[t?(0,h.jsx)(oS,{className:"h-3 w-3 text-ok shrink-0"}):(0,h.jsx)(oC,{className:"h-3 w-3 text-danger shrink-0"}),(0,h.jsx)("span",{className:i1("text-[10.5px] truncate",t?"text-fg-muted":"text-fg-subtle"),title:s,children:s?s.replace(/^https?:\/\//,""):"Not connected"})]}),(0,h.jsx)("button",{onClick:n,className:"p-1 rounded text-fg-muted hover:text-fg hover:bg-bg-hover transition-colors",title:"dark"===r?"Light":"Dark",children:"dark"===r?(0,h.jsx)(oM,{className:"h-3.5 w-3.5"}):(0,h.jsx)(oA,{className:"h-3.5 w-3.5"})}),(0,h.jsx)("button",{onClick:i,className:"p-1 rounded text-fg-muted hover:text-fg hover:bg-bg-hover transition-colors",title:"Hide sidebar",children:(0,h.jsx)(oP,{className:"h-3.5 w-3.5"})})]})}let oT=(0,m.memo)(function({icon:e,label:t,collapsed:s,active:r,onClick:n,badgeRoute:a}){let i,o=(i=(0,m.useContext)(ed),"pairing"===a?i.pairing:0);return(0,h.jsxs)("button",{onClick:n,title:s?t:void 0,className:i1("relative w-full flex items-center gap-2.5 rounded-md h-7",s?"justify-center px-0":"pl-2.5 pr-2","text-[12px] transition-colors duration-150 ease-out-quart",r?"text-fg":"text-fg-muted hover:text-fg active:bg-bg-hover"),children:[r&&(0,h.jsx)(aJ.span,{layoutId:"nav-active",className:"absolute inset-0 rounded-md bg-bg-selected shadow-[inset_0_0_0_1px_rgba(255,255,255,0.05)]",transition:{type:"spring",stiffness:520,damping:36}}),(0,h.jsxs)("span",{className:"relative shrink-0",children:[(0,h.jsx)(e,{className:"h-3.5 w-3.5 opacity-80"}),s&&o>0&&(0,h.jsx)("span",{className:"absolute -top-1 -right-1 min-w-[14px] h-[14px] px-1 rounded-full bg-accent text-black text-[9px] font-semibold flex items-center justify-center",style:{boxShadow:"0 0 0 1.5px rgba(18,18,22,1)"},children:o>9?"9+":o})]}),!s&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("span",{className:"relative flex-1 text-left truncate",children:t}),o>0&&(0,h.jsx)("span",{className:"relative inline-flex items-center justify-center min-w-[18px] h-[16px] px-1.5 rounded-full bg-accent/15 text-accent text-[10px] font-medium tabular-nums",style:{boxShadow:"inset 0 0 0 1px rgba(15,23,42,0.35)"},children:o>99?"99+":o})]})]})});function oD({segment:e,collapsed:t}){let{route:s,navigate:r}=N(),n=X[e].filter(e=>e.routes.length>0);return 0===n.length?null:(0,h.jsx)("div",{className:"flex flex-col mt-1 pt-2 border-t border-border",children:n.map((e,n)=>(0,h.jsxs)("div",{className:i1(n>0&&"mt-3 pt-2.5 border-t border-border"),children:[e.label&&!t&&(0,h.jsx)("div",{className:"px-3 pb-1",children:(0,h.jsx)("span",{className:"text-[9.5px] uppercase tracking-[0.12em] text-fg-subtle",children:e.label})}),(0,h.jsx)("nav",{className:"px-2 space-y-0.5",children:e.routes.map(e=>{let n=i2[e],a=s===e;return(0,h.jsx)(oT,{icon:n,label:Y[e],collapsed:t,active:a,onClick:()=>r(e),badgeRoute:e},e)})})]},n))})}function o$({collapsed:e}){let{segment:t}=ee();return(0,h.jsx)(oD,{segment:t,collapsed:e})}function oR(e){return null}function o_(){let{railCollapsed:e,segment:t}=ee();return"u">typeof navigator&&navigator.platform.toLowerCase().includes("mac"),(0,h.jsx)(eu,{children:(0,h.jsxs)("aside",{className:"h-full shrink-0 hidden md:flex flex-col bg-bg-sidebar overflow-hidden transition-[width] duration-300 ease-out-quart",style:{width:240*!e},children:[(0,h.jsx)("div",{className:"shrink-0",style:{height:0}}),(0,h.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col overflow-x-hidden pb-2",children:[(0,h.jsx)(i3,{collapsed:!1}),(0,h.jsx)(ok,{collapsed:!1}),(0,h.jsx)(ec,{label:"sidebar",children:(0,h.jsx)(o$,{collapsed:!1})},t)]}),(0,h.jsx)(oN,{collapsed:!1}),(0,h.jsx)(oR,{collapsed:!1}),(0,h.jsx)(oE,{collapsed:!1})]})})}let oF=["backend","frontend"],oV=[{name:"analyze",label:"/analyze",description:"Architecture, modules, risky areas, missing parts.",requiresProject:!0,buildParams:({projectId:e})=>({promptName:"analyze",params:{projectId:e}})},{name:"compare",label:"/compare",description:"Compare two targets in the code — e.g. iOS vs Android.",argHint:"<a> vs <b>",buildParams:({tail:e,projectId:t})=>{if(!e.trim())return{error:"Usage: /compare <a> vs <b>"};let s=e.match(/^\s*(.+?)\s+(?:vs|VS|versus)\s+(.+?)\s*$/);return s?{promptName:"compare",params:{a:s[1].trim(),b:s[2].trim(),mode:"ai",projectId:t}}:{error:"Usage: /compare <a> vs <b>"}}},{name:"tasks",label:"/tasks",description:"Break a feature idea into platform-grouped tasks.",argHint:"<feature description>",buildParams:({tail:e,projectId:t,platforms:s})=>{let r=e.trim();return r?{promptName:"tasks",params:{feature:r,platforms:s??oF,projectId:t}}:{error:"Usage: /tasks <feature description>"}}},{name:"bug",label:"/bug",description:"Map the blast radius of a reported bug.",argHint:"<bug description>",requiresProject:!0,buildParams:({tail:e,projectId:t})=>{let s=e.trim();return s?{promptName:"bugImpact",params:{description:s,projectId:t}}:{error:"Usage: /bug <bug description>"}}},{name:"next",label:"/next",description:"Suggest next steps, ranked by impact.",requiresProject:!0,buildParams:({projectId:e})=>({promptName:"nextSteps",params:{projectId:e}})},{name:"feature",label:"/feature",description:"Convert a feature to a platform-specific build plan.",argHint:"<feature description>",buildParams:({tail:e,projectId:t,platforms:s})=>{let r=e.trim();return r?{promptName:"featurePlan",params:{feature:r,platforms:s??oF,projectId:t}}:{error:"Usage: /feature <feature description>"}}},{name:"diff",label:"/diff",description:"Compare two folders or modules in the project.",argHint:"<path-a> <path-b>",requiresProject:!0,buildParams:({tail:e,projectId:t})=>{let s=e.trim().split(/\s+/).filter(Boolean);return s.length<2?{error:"Usage: /diff <path-a> <path-b>"}:{promptName:"diffFolders",params:{a:s[0],b:s[1],projectId:t}}}}];async function oI(e,t,s){let r=function(e){let t=e.match(/^\/(\w+)(?:\s+([\s\S]*))?$/);if(!t)return null;let s=oV.find(e=>e.name===t[1]);return s?{command:s,tail:(t[2]??"").trim()}:null}(t);if(!r)return{ok:!0,prompt:t};let n=r.command.buildParams({tail:r.tail,projectId:s.projectId,platforms:s.platforms});if("error"in n)return{ok:!1,error:n.error};if(r.command.requiresProject&&!s.projectId)return{ok:!1,error:`/${r.command.name} requires an active project.`};try{let{prompt:t}=await e.renderDevPrompt(n.promptName,n.params),s=!r.tail||n.params.feature||n.params.description||n.params.a?"":`
10
+
11
+ User note: ${r.tail}`;return{ok:!0,prompt:t+s}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}let oL=[{id:"backend-agent",label:"@backend-agent",description:"APIs, DBs, auth, deployment"},{id:"frontend-agent",label:"@frontend-agent",description:"Web UI, state mgmt, styling"},{id:"mobile-agent",label:"@mobile-agent",description:"iOS · Android · Flutter · RN"},{id:"qa-agent",label:"@qa-agent",description:"Test strategy, edge cases"}],oU=new Map,oz=E("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]),oO=E("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),oB=E("slash",[["path",{d:"M22 2 2 22",key:"y4kqgn"}]]),oq=E("at-sign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]),oW=E("laptop",[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]]),oH=E("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);function oK(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}var oG=Symbol.for("react.lazy"),oY=m[" use ".trim().toString()];function oX(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===oG&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var oJ=((l=m.forwardRef((e,t)=>{let{children:s,...r}=e;if(oX(s)&&"function"==typeof oY&&(s=oY(s._payload)),m.isValidElement(s)){var n;let e,a,i=(n=s,(a=(e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?n.ref:(a=(e=Object.getOwnPropertyDescriptor(n,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?n.props.ref:n.props.ref||n.ref),o=function(e,t){let s={...t};for(let r in t){let n=e[r],a=t[r];/^on[A-Z]/.test(r)?n&&a?s[r]=(...e)=>{let t=a(...e);return n(...e),t}:n&&(s[r]=n):"style"===r?s[r]={...n,...a}:"className"===r&&(s[r]=[n,a].filter(Boolean).join(" "))}return{...e,...s}}(r,s.props);return s.type!==m.Fragment&&(o.ref=t?function(...e){return t=>{let s=!1,r=e.map(e=>{let r=oK(e,t);return s||"function"!=typeof r||(s=!0),r});if(s)return()=>{for(let t=0;t<r.length;t++){let s=r[t];"function"==typeof s?s():oK(e[t],null)}}}}(t,i):i),m.cloneElement(s,o)}return m.Children.count(s)>1?m.Children.only(null):null})).displayName="Slot.SlotClone",r=l,(n=m.forwardRef((e,t)=>{let{children:s,...n}=e;oX(s)&&"function"==typeof oY&&(s=oY(s._payload));let a=m.Children.toArray(s),i=a.find(oQ);if(i){let e=i.props.children,s=a.map(t=>t!==i?t:m.Children.count(e)>1?m.Children.only(null):m.isValidElement(e)?e.props.children:null);return(0,h.jsx)(r,{...n,ref:t,children:m.isValidElement(e)?m.cloneElement(e,void 0,s):null})}return(0,h.jsx)(r,{...n,ref:t,children:s})})).displayName="Slot.Slot",n),oZ=Symbol("radix.slottable");function oQ(e){return m.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===oZ}let o0=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,o1=(a="inline-flex items-center justify-center gap-1.5 whitespace-nowrap font-medium tracking-tight select-none relative transition-[background,color,box-shadow,transform] duration-150 ease-out-quart focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:pointer-events-none disabled:opacity-40 active:scale-[0.985] active:translate-y-[0.5px]",i={variants:{variant:{accent:"text-white bg-accent shadow-[0_1px_2px_rgba(0,0,0,0.08),inset_0_0_0_1px_var(--accent-stroke)] hover:bg-accent-hover hover:shadow-[0_2px_6px_rgba(0,0,0,0.12),inset_0_0_0_1px_var(--accent-stroke)]",panel:"text-fg bg-bg-elevated shadow-[inset_0_0_0_1px_var(--border-soft)] hover:bg-bg-elevated-2",ghost:"text-fg-muted hover:text-fg bg-transparent hover:bg-bg-hover",outline:"text-fg bg-transparent shadow-[inset_0_0_0_1px_var(--border-soft)] hover:shadow-[inset_0_0_0_1px_var(--border-strong)] hover:bg-bg-hover",danger:"text-white bg-danger hover:brightness-[1.05] shadow-[0_1px_2px_rgba(0,0,0,0.08)]"},size:{sm:"h-7 rounded-md px-2.5 text-[11.5px]",md:"h-8 rounded-lg px-3 text-[12.5px]",lg:"h-10 rounded-xl px-5 text-[13px]",icon:"h-8 w-8 rounded-lg"}},defaultVariants:{variant:"panel",size:"md"}},e=>{var t;if((null==i?void 0:i.variants)==null)return aZ(a,null==e?void 0:e.class,null==e?void 0:e.className);let{variants:s,defaultVariants:r}=i,n=Object.keys(s).map(t=>{let n=null==e?void 0:e[t],a=null==r?void 0:r[t];if(null===n)return null;let i=o0(n)||o0(a);return s[t][i]}),o=e&&Object.entries(e).reduce((e,t)=>{let[s,r]=t;return void 0===r||(e[s]=r),e},{});return aZ(a,n,null==i||null==(t=i.compoundVariants)?void 0:t.reduce((e,t)=>{let{class:s,className:n,...a}=t;return Object.entries(a).every(e=>{let[t,s]=e;return Array.isArray(s)?s.includes({...r,...o}[t]):({...r,...o})[t]===s})?[...e,s,n]:e},[]),null==e?void 0:e.class,null==e?void 0:e.className)}),o2=m.forwardRef(({className:e,variant:t,size:s,asChild:r=!1,children:n,...a},i)=>(0,h.jsx)(r?oJ:"button",{className:i1(o1({variant:t,size:s}),e),ref:i,...a,children:n}));async function o5(e,t){if(!e.type.startsWith("image/"))return t(`"${e.name}" is not an image.`),null;if(e.size>8388608)return t(`"${e.name}" is over 8 MB.`),null;let s=await new Promise((t,s)=>{let r=new FileReader;r.onerror=()=>s(r.error),r.onload=()=>t(r.result),r.readAsDataURL(e)}),r=s.indexOf(","),n=r>=0?s.slice(r+1):"";return{id:`att-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,kind:"image",mime:e.type,data:n,previewUrl:s,name:e.name}}o2.displayName="Button";let o3={kind:null,anchor:-1,query:"",cursor:0};function o4({icon:e,label:t,onClick:s,title:r}){let n=s?"button":"div";return(0,h.jsxs)(n,{onClick:s,title:r,className:i1("inline-flex items-center gap-1.5 h-6 px-2 rounded-md text-[11.5px] text-fg bg-bg-elevated","shadow-[inset_0_0_0_1px_var(--border-soft)]",s&&"hover:bg-bg-elevated-2 cursor-pointer transition-colors"),children:[e&&(0,h.jsx)("span",{className:"text-fg-muted",children:e}),(0,h.jsx)("span",{className:"truncate max-w-[200px]",children:t})]})}let o6=E("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);function o9(e,t,s=!0){(0,m.useEffect)(()=>{if(!s)return;let r=s=>{e.current?.contains(s.target)||t()};return window.addEventListener("mousedown",r),()=>window.removeEventListener("mousedown",r)},[e,t,s])}function o8({project:e,projects:t,onSelect:s,onNew:r}){let[n,a]=(0,m.useState)(!1),i=(0,m.useRef)(null);return o9(i,(0,m.useCallback)(()=>a(!1),[]),n),(0,h.jsxs)("div",{className:"relative",ref:i,children:[(0,h.jsxs)("button",{onClick:()=>a(e=>!e),className:"inline-flex items-center gap-1.5 h-6 px-2 rounded-md text-[11.5px] text-fg bg-bg-elevated hover:bg-bg-elevated-2 transition-colors shadow-[inset_0_0_0_1px_var(--border-soft)]",title:e?.path,children:[(0,h.jsx)(od,{className:"h-3 w-3 text-fg-muted"}),(0,h.jsx)("span",{className:"truncate max-w-[180px]",children:e?.name??"No project"}),(0,h.jsx)(o6,{className:i1("h-2.5 w-2.5 text-fg-subtle transition-transform",n&&"rotate-180")})]}),n&&(0,h.jsxs)("div",{className:"absolute left-0 bottom-[calc(100%+6px)] z-50 w-[260px] rounded-xl overflow-hidden bg-bg-main shadow-elevated py-1.5",children:[(0,h.jsx)("div",{className:"px-3 pt-1 pb-1.5 text-[12px] text-fg-subtle",children:"Recent"}),(0,h.jsxs)("div",{className:"max-h-[280px] overflow-auto px-1.5",children:[0===t.length&&(0,h.jsx)("div",{className:"px-2 py-2 text-[12px] text-fg-subtle",children:"No projects yet."}),t.map(t=>{let r=t.id===e?.id;return(0,h.jsxs)("button",{onClick:()=>{s?.(t.id),a(!1)},className:"w-full flex items-center gap-2 px-2.5 h-8 text-[13px] text-fg text-left rounded-md hover:bg-bg-hover transition-colors",children:[(0,h.jsx)("span",{className:"flex-1 truncate",children:t.name}),r&&(0,h.jsx)(oo,{className:"h-3.5 w-3.5 text-fg shrink-0",strokeWidth:2.25})]},t.id)})]}),r&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:"my-1.5 mx-3 border-t border-border"}),(0,h.jsx)("div",{className:"px-1.5 pb-0.5",children:(0,h.jsx)("button",{onClick:()=>{r(),a(!1)},className:"w-full flex items-center gap-2 px-2.5 h-8 text-[13px] text-fg text-left rounded-md hover:bg-bg-hover transition-colors",children:"Open folder…"})})]})]})]})}function o7(){let[e,t]=(0,m.useState)(!1),s=(0,m.useRef)(null);o9(s,(0,m.useCallback)(()=>t(!1),[]),e);let{projects:r,activeProjectId:n,setActiveProjectId:a}=ea(),i=r.find(e=>e.id===n),o=i?.name??"No workspace";return(0,h.jsxs)("div",{className:"relative",ref:s,children:[(0,h.jsxs)("button",{onClick:()=>t(e=>!e),className:"inline-flex items-center gap-1.5 h-6 px-2 rounded-md text-[11px] text-fg active:bg-bg-hover transition-colors",title:i?.path??"Pick a project workspace",children:[(0,h.jsx)(od,{className:"h-3 w-3 text-fg-subtle"}),(0,h.jsx)("span",{className:"font-medium truncate max-w-[140px]",children:o}),(0,h.jsx)(o6,{className:i1("h-2.5 w-2.5 text-fg-subtle transition-transform",e&&"rotate-180")})]}),e&&(0,h.jsxs)("div",{className:"absolute right-0 bottom-[calc(100%+4px)] z-50 w-[300px] rounded-lg overflow-hidden bg-bg-panel shadow-elevated",children:[(0,h.jsxs)("div",{className:"px-3 py-2 border-b border-border flex items-center justify-between",children:[(0,h.jsx)("span",{className:"text-[10px] uppercase tracking-[0.1em] text-fg-subtle",children:"Workspace"}),0===r.length&&(0,h.jsx)("span",{className:"text-[10px] text-fg-subtle",children:"camel projects add"})]}),(0,h.jsxs)("div",{className:"py-1 max-h-[280px] overflow-auto",children:[(0,h.jsxs)("button",{onClick:()=>{a(null),t(!1)},className:i1("w-full flex items-center gap-2 px-3 h-8 text-left transition-colors",i?"text-fg-muted hover:text-fg hover:bg-bg-hover":"bg-bg-selected text-fg"),children:[(0,h.jsx)(od,{className:i1("h-3 w-3 shrink-0",i?"text-fg-subtle":"text-accent")}),(0,h.jsx)("span",{className:"text-[12px] font-medium flex-1",children:"No workspace"}),!i&&(0,h.jsx)(oo,{className:"h-3 w-3 text-accent"})]}),r.map(e=>{let s=e.id===n;return(0,h.jsxs)("button",{onClick:()=>{a(e.id),t(!1)},className:i1("w-full flex items-start gap-2 px-3 h-10 text-left transition-colors",s?"bg-bg-selected text-fg":"text-fg-muted hover:text-fg hover:bg-bg-hover"),title:e.path,children:[(0,h.jsx)(od,{className:i1("h-3 w-3 mt-1 shrink-0",s?"text-accent":"text-fg-subtle")}),(0,h.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,h.jsx)("div",{className:"text-[12px] font-medium truncate",children:e.name}),(0,h.jsx)("div",{className:"text-[10px] text-fg-subtle truncate",children:e.path})]}),s&&(0,h.jsx)(oo,{className:"h-3 w-3 text-accent mt-1"})]},e.id)})]})]})]})}function le({model:e,thinking:t,models:s,onChange:r}){let[n,a]=(0,m.useState)(!1),[i,o]=(0,m.useState)(""),[l,c]=(0,m.useState)(0),d=(0,m.useRef)(null),u=(0,m.useRef)(null),p=(0,m.useMemo)(()=>{let e=i.trim().toLowerCase();return e?s.filter(t=>t.toLowerCase().includes(e)):s},[s,i]);(0,m.useEffect)(()=>c(0),[i]),o9(d,(0,m.useCallback)(()=>a(!1),[]),n),(0,m.useEffect)(()=>{n&&(o(""),setTimeout(()=>u.current?.focus(),10))},[n]);let x=e=>{r(e,t),a(!1)};return(0,h.jsxs)("div",{className:"relative",ref:d,children:[(0,h.jsxs)("button",{onClick:()=>a(e=>!e),className:"inline-flex items-center gap-1.5 h-6 px-2 rounded-md text-[11px] text-fg active:bg-bg-hover transition-colors",title:e,children:[(0,h.jsx)("span",{className:"font-medium",children:(e=>{if(!e)return"pick model";let t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e})(e)}),t&&"off"!==t&&(0,h.jsxs)("span",{className:"text-fg-subtle",children:["· ",t]}),(0,h.jsx)(o6,{className:i1("h-2.5 w-2.5 text-fg-subtle transition-transform",n&&"rotate-180")})]}),n&&(0,h.jsxs)("div",{className:"absolute right-0 bottom-[calc(100%+4px)] z-50 w-[320px] rounded-lg overflow-hidden bg-bg-panel shadow-elevated",children:[(0,h.jsxs)("div",{className:"relative border-b border-border",children:[(0,h.jsx)(i6,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3 w-3 text-fg-subtle"}),(0,h.jsx)("input",{ref:u,value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{if("ArrowDown"===e.key)e.preventDefault(),c(e=>Math.min(e+1,p.length-1));else if("ArrowUp"===e.key)e.preventDefault(),c(e=>Math.max(e-1,0));else if("Enter"===e.key){e.preventDefault();let t=p[l];t&&x(t)}else"Escape"===e.key&&(e.preventDefault(),a(!1))},placeholder:"Search models…",className:"w-full h-9 pl-8 pr-2.5 bg-transparent text-[12px] text-fg placeholder:text-fg-subtle focus:outline-none"})]}),(0,h.jsxs)("div",{className:"max-h-[240px] overflow-auto py-1",children:[0===p.length&&(0,h.jsx)("div",{className:"px-3 py-3 text-[11.5px] text-fg-subtle text-center",children:"No models match."}),p.map((t,s)=>{let r=s===l,n=t===e;return(0,h.jsxs)("button",{onMouseEnter:()=>c(s),onClick:()=>x(t),className:i1("w-full flex items-center gap-2 px-3 h-7 text-[11.5px] font-mono transition-colors",r?"bg-bg-selected text-fg":"text-fg-muted hover:text-fg"),children:[(0,h.jsx)("span",{className:"flex-1 text-left truncate",children:t}),n&&(0,h.jsx)(oo,{className:"h-3 w-3 text-accent"})]},t)})]}),(0,h.jsxs)("div",{className:"border-t border-border px-3 py-2 flex items-center gap-1",children:[(0,h.jsx)("span",{className:"text-[10px] uppercase tracking-[0.1em] text-fg-subtle mr-1",children:"Thinking"}),["off","low","medium","high"].map(s=>{let n=(t??"off")===s;return(0,h.jsx)("button",{onClick:()=>{r(e,s)},className:i1("h-5 px-2 rounded text-[10.5px] transition-colors",n?"bg-accent-soft text-accent shadow-[inset_0_0_0_1px_var(--accent-stroke)]":"text-fg-muted hover:text-fg hover:bg-bg-hover"),children:s},s)})]})]})]})}E("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);let lt=E("shield-check",[["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"}]]),ls=E("file-pen",[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]]),lr={default:lt,acceptEdits:ls,plan:E("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]),bypassPermissions:E("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])};function ln({mode:e,onChange:t}){let[s,r]=(0,m.useState)(!1),n=(0,m.useRef)(null),a=et.find(t=>t.id===e)??et[0],i=lr[e];return o9(n,(0,m.useCallback)(()=>r(!1),[]),s),(0,m.useEffect)(()=>{let e=e=>{if(e.shiftKey&&(e.metaKey||e.ctrlKey)&&("m"===e.key||"M"===e.key)){e.preventDefault(),r(e=>!e);return}if(!s)return;if("Escape"===e.key){e.preventDefault(),r(!1);return}let n=Number.parseInt(e.key,10);if(Number.isFinite(n)&&n>=1&&n<=et.length){e.preventDefault();let s=et.find(e=>e.hotkey===n);s&&(t(s.id),r(!1))}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[s,t]),(0,h.jsxs)("div",{className:"relative",ref:n,children:[(0,h.jsxs)("button",{onClick:()=>r(e=>!e),className:"inline-flex items-center gap-1.5 h-6 px-2 rounded-md text-[11px] text-fg active:bg-bg-hover transition-colors",title:`${a.label} — ⌘⇧M to change`,children:[(0,h.jsx)(i,{className:i1("h-3 w-3","plan"===e?"text-accent":"text-fg-subtle")}),(0,h.jsx)("span",{className:"font-medium",children:a.label}),(0,h.jsx)(o6,{className:i1("h-2.5 w-2.5 text-fg-subtle transition-transform",s&&"rotate-180")})]}),s&&(0,h.jsxs)("div",{className:"absolute right-0 bottom-[calc(100%+4px)] z-50 w-[280px] rounded-lg overflow-hidden bg-bg-panel shadow-elevated",children:[(0,h.jsxs)("div",{className:"px-3 py-2 border-b border-border flex items-center justify-between",children:[(0,h.jsx)("span",{className:"text-[10px] uppercase tracking-[0.1em] text-fg-subtle",children:"Mode"}),(0,h.jsx)("span",{className:"text-[10px] text-fg-subtle/70 font-mono",children:"⇧⌘M"})]}),(0,h.jsx)("div",{className:"py-1",children:et.map(s=>{let n=s.id===e,a=lr[s.id];return(0,h.jsxs)("button",{onClick:()=>{t(s.id),r(!1)},className:i1("w-full flex items-start gap-2 px-3 h-11 text-left transition-colors",n?"bg-bg-selected text-fg":"text-fg-muted hover:text-fg hover:bg-bg-hover"),children:[(0,h.jsx)(a,{className:i1("h-3.5 w-3.5 mt-0.5 shrink-0",n?"text-accent":"text-fg-subtle")}),(0,h.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)("span",{className:"text-[12px] font-medium",children:s.label}),n&&(0,h.jsx)(oo,{className:"h-3 w-3 text-accent"})]}),(0,h.jsx)("div",{className:"text-[10.5px] text-fg-subtle truncate",children:s.hint})]}),(0,h.jsx)("span",{className:"text-[10.5px] text-fg-subtle font-mono self-center",children:s.hotkey})]},s.id)})})]})]})}function la({agentId:e,onChange:t}={}){let[s,r]=(0,m.useState)(!1),n=(0,m.useRef)(null);o9(n,(0,m.useCallback)(()=>r(!1),[]),s);let a=ea(),i=e??a.activeAgentId,o=t??a.setActiveAgentId,l=a.agents.find(e=>e.id===i),c=l?.name??"Default";return(0,h.jsxs)("div",{className:"relative",ref:n,children:[(0,h.jsxs)("button",{onClick:()=>r(e=>!e),className:"inline-flex items-center gap-1.5 h-6 px-2 rounded-md text-[11px] text-fg active:bg-bg-hover transition-colors",title:l?`Agent: ${l.id}`:"Default agent",children:[(0,h.jsx)(D,{className:"h-3 w-3 text-fg-subtle"}),(0,h.jsx)("span",{className:"font-medium",children:c}),(0,h.jsx)(o6,{className:i1("h-2.5 w-2.5 text-fg-subtle transition-transform",s&&"rotate-180")})]}),s&&(0,h.jsxs)("div",{className:"absolute right-0 bottom-[calc(100%+4px)] z-50 w-[260px] rounded-lg overflow-hidden bg-bg-panel shadow-elevated",children:[(0,h.jsxs)("div",{className:"px-3 py-2 border-b border-border flex items-center justify-between",children:[(0,h.jsx)("span",{className:"text-[10px] uppercase tracking-[0.1em] text-fg-subtle",children:"Agent"}),0===a.agents.length&&(0,h.jsx)("span",{className:"text-[10px] text-fg-subtle",children:"no agents"})]}),(0,h.jsxs)("div",{className:"py-1 max-h-[280px] overflow-auto",children:[(0,h.jsxs)("button",{onClick:()=>{o(null),r(!1)},className:i1("w-full flex items-center gap-2 px-3 h-8 text-left transition-colors",l?"text-fg-muted hover:text-fg hover:bg-bg-hover":"bg-bg-selected text-fg"),children:[(0,h.jsx)(D,{className:i1("h-3 w-3 shrink-0",l?"text-fg-subtle":"text-accent")}),(0,h.jsx)("span",{className:"text-[12px] font-medium flex-1",children:"Default"}),!l&&(0,h.jsx)(oo,{className:"h-3 w-3 text-accent"})]}),a.agents.map(e=>{let t=e.id===i;return(0,h.jsxs)("button",{onClick:()=>{o(e.id),r(!1)},className:i1("w-full flex items-center gap-2 px-3 h-9 text-left transition-colors",t?"bg-bg-selected text-fg":"text-fg-muted hover:text-fg hover:bg-bg-hover"),title:e.id,children:[(0,h.jsx)(D,{className:i1("h-3 w-3 shrink-0",t?"text-accent":"text-fg-subtle")}),(0,h.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,h.jsx)("div",{className:"text-[12px] font-medium truncate",children:e.name}),(0,h.jsx)("div",{className:"text-[10px] text-fg-subtle truncate",children:e.id})]}),t&&(0,h.jsx)(oo,{className:"h-3 w-3 text-accent"})]},e.id)})]})]})]})}function li({att:e,onRemove:t}){return(0,h.jsxs)("div",{className:"group relative h-14 w-14 rounded-md overflow-hidden shadow-[inset_0_0_0_1px_var(--border-soft)] bg-bg-elevated",title:e.name,children:[(0,h.jsx)("img",{src:e.previewUrl,alt:e.name??"attachment",className:"h-full w-full object-cover",draggable:!1}),(0,h.jsx)("button",{onClick:t,"aria-label":"Remove attachment",className:i1("absolute top-0.5 right-0.5 h-4 w-4 inline-flex items-center justify-center rounded-full","bg-bg-tooltip text-white opacity-0 group-hover:opacity-100 transition-opacity"),children:(0,h.jsx)(oi,{className:"h-2.5 w-2.5"})})]})}function lo({kind:e,items:t,cursor:s,onHover:r,onPick:n,disabledItem:a}){return(0,h.jsxs)("div",{className:"absolute left-0 right-0 bottom-full mb-2 z-50 rounded-lg overflow-hidden bg-bg-panel shadow-elevated",style:{maxHeight:"280px",overflowY:"auto"},children:[(0,h.jsx)("div",{className:"px-3 py-1.5 border-b border-border text-[9.5px] uppercase tracking-[0.12em] text-fg-subtle",children:"slash"===e?"Commands":"Agents"}),t.map((t,i)=>{let o=i===s,l=a?.(i)??!1,c=t.label,d=t.description,u="slash"===e?t.argHint:"";return(0,h.jsxs)("button",{disabled:l,onMouseEnter:()=>r(i),onClick:()=>!l&&n(i),className:i1("w-full flex items-baseline gap-3 px-3 py-1.5 text-left transition-colors",o?"bg-bg-selected":"hover:bg-bg-hover",l&&"opacity-40 cursor-not-allowed"),children:[(0,h.jsx)("span",{className:"font-mono text-[11.5px] text-accent min-w-[92px]",children:c}),u&&(0,h.jsx)("span",{className:"font-mono text-[10px] text-fg-subtle",children:u}),(0,h.jsx)("span",{className:"text-[11px] text-fg-muted flex-1 truncate",children:d}),l&&(0,h.jsx)("span",{className:"text-[9.5px] text-fg-subtle",children:"needs project"})]},i)})]})}let ll=(0,m.forwardRef)(function({value:e,onChange:t,onSubmit:s,onAbort:r,streaming:n,placeholder:a,disabled:i,hasProject:o,project:l,projects:c,onSelectProject:d,onNewProject:u,model:p,thinking:x,models:g,onChangeModel:f,mode:b,onChangeMode:v,runtime:y,onChangeRuntime:j,projectKind:w,onChangeProjectKind:k,hideProjectControls:N},S){let C=(0,m.useRef)(null),A=(0,m.useRef)(null),{menu:M,setMenu:P,suggestions:E,recomputeMenu:T,insertSuggestion:D,navigateMenu:$,closeMenu:R,isOpen:_}=function(){let[e,t]=(0,m.useState)(o3),s=(0,m.useMemo)(()=>{if("slash"===e.kind){let t;return(t=e.query.trim().toLowerCase())?oV.filter(e=>e.name.startsWith(t)||e.description.toLowerCase().includes(t)):oV}if("mention"===e.kind){let t;return(t=e.query.trim().toLowerCase())?oL.filter(e=>e.id.includes(t)||e.description.toLowerCase().includes(t)):oL}return[]},[e]),r=null!==e.kind&&s.length>0;return{menu:e,setMenu:t,suggestions:s,recomputeMenu:(e,s)=>{let r=s-1,n="";for(;r>=0;){let s=e[r];if("/"===s||"@"===s){let a=0===r?"\n":e[r-1];if(/\s|\n/.test(a)||0===r)return void t({kind:"/"===s?"slash":"mention",anchor:r,query:n,cursor:0});break}if(/\s/.test(s))break;n=s+n,r--}t(o3)},insertSuggestion:(s,r)=>{if(null===e.kind||e.anchor<0)return{newText:r,newCursor:r.length};let n=r.slice(0,e.anchor),a=e.anchor+1+e.query.length,i=r.slice(a),o=i.startsWith(" ")||""===i?"":" ",l=`${n}${s} ${o}${i}`,c=n.length+s.length+1;return t(o3),{newText:l,newCursor:c}},navigateMenu:e=>{"down"===e?t(e=>({...e,cursor:Math.min(e.cursor+1,s.length-1)})):t(e=>({...e,cursor:Math.max(e.cursor-1,0)}))},closeMenu:()=>t(o3),isOpen:r}}(),{attachments:F,attachErr:V,dragOver:I,setDragOver:L,ingestFiles:U,removeAttachment:z,clearAttachments:O,clearError:B,isFull:q}=function(){let[e,t]=(0,m.useState)([]),[s,r]=(0,m.useState)(!1),[n,a]=(0,m.useState)(null),i=async s=>{a(null);let r=Array.from(s),n=4-e.length;if(n<=0)return void a("Max 4 images per message.");let i=[];for(let e of r.slice(0,n)){let t=await o5(e,a);t&&i.push(t)}i.length>0&&t(e=>[...e,...i])};return{attachments:e,attachErr:n,dragOver:s,setDragOver:r,ingestFiles:i,removeAttachment:e=>{t(t=>t.filter(t=>t.id!==e)),a(null)},clearAttachments:()=>t([]),clearError:()=>a(null),isFull:e.length>=4}}();(0,m.useImperativeHandle)(S,()=>({addFiles:e=>{U(e)},focus:()=>{C.current?.focus()}}),[F.length]);let W=s=>{let{newText:r,newCursor:n}=D(s,e);t(r),requestAnimationFrame(()=>{let e=C.current;e&&(e.focus(),e.setSelectionRange(n,n))})},H=()=>{let t=e.trim();i||(t||0!==F.length)&&(s(t,F.length>0?F:void 0),O(),B())};return(0,m.useEffect)(()=>{let e=C.current;if(!e)return;let t=()=>T(e.value,e.selectionStart);return e.addEventListener("keyup",t),e.addEventListener("click",t),()=>{e.removeEventListener("keyup",t),e.removeEventListener("click",t)}},[e]),(0,h.jsxs)("div",{className:"relative",children:[_&&(0,h.jsx)(lo,{kind:M.kind,items:E,cursor:M.cursor,onHover:e=>P(t=>({...t,cursor:e})),onPick:e=>{let t=E[e];t&&W("slash"===M.kind?`/${t.name}`:t.label)},disabledItem:e=>"slash"===M.kind&&!!E[e].requiresProject&&!o}),!N&&(0,h.jsxs)("div",{className:"flex items-center gap-1.5 pb-2 px-0.5",children:[(0,h.jsx)(o4,{icon:(0,h.jsx)(oW,{className:"h-3 w-3"}),label:"Local"}),(0,h.jsx)(o8,{project:l??null,projects:c??[],onSelect:d,onNew:u}),u&&(0,h.jsx)("button",{onClick:u,className:"h-6 w-6 inline-flex items-center justify-center rounded-md text-fg-muted hover:text-fg active:bg-bg-hover transition-colors shadow-[inset_0_0_0_1px_var(--border-soft)]",title:"Register new project",children:(0,h.jsx)(i4,{className:"h-3 w-3"})})]}),(0,h.jsxs)("div",{className:i1("relative rounded-xl px-3 py-2.5 bg-bg-input shadow-[inset_0_0_0_1px_var(--border-input)]","transition-shadow",I&&"shadow-[inset_0_0_0_1.5px_var(--accent-stroke)]"),onDragOver:e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),L(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||L(!1)},onDrop:e=>{e.dataTransfer.files&&0!==e.dataTransfer.files.length&&(e.preventDefault(),L(!1),U(e.dataTransfer.files))},onPaste:e=>{let t=Array.from(e.clipboardData?.items??[]).filter(e=>"file"===e.kind).map(e=>e.getAsFile()).filter(e=>!!e);t.length>0&&(e.preventDefault(),U(t))},children:[F.length>0&&(0,h.jsx)("div",{className:"flex flex-wrap gap-1.5 mb-2",children:F.map(e=>(0,h.jsx)(li,{att:e,onRemove:()=>z(e.id)},e.id))}),V&&(0,h.jsx)("div",{className:"mb-1.5 text-[10.5px] text-danger",children:V}),(0,h.jsxs)("div",{className:"flex items-end gap-2",children:[(0,h.jsx)("button",{onClick:()=>A.current?.click(),disabled:i||q,"aria-label":"Attach image",title:"Attach image",className:i1("h-7 w-7 inline-flex items-center justify-center rounded-md shrink-0","text-fg-subtle hover:text-fg active:bg-bg-hover transition-colors","disabled:opacity-40 disabled:cursor-not-allowed"),children:(0,h.jsx)(oH,{className:"h-3.5 w-3.5"})}),(0,h.jsx)("input",{ref:A,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&U(e.target.files),e.target.value=""}}),(0,h.jsx)("textarea",{ref:C,value:e,onChange:e=>{t(e.target.value),requestAnimationFrame(()=>{let e=C.current;e&&T(e.value,e.selectionStart)})},onKeyDown:e=>{if(_){if("ArrowDown"===e.key){e.preventDefault(),$("down");return}if("ArrowUp"===e.key){e.preventDefault(),$("up");return}if("Enter"===e.key||"Tab"===e.key){e.preventDefault();let t=E[M.cursor];t&&W("slash"===M.kind?`/${t.name}`:t.label);return}if("Escape"===e.key){e.preventDefault(),R();return}}"Enter"!==e.key||e.shiftKey||(e.preventDefault(),H())},rows:1,disabled:i,placeholder:a??"Describe a task, paste an image, or drop a file",className:"flex-1 resize-none bg-transparent outline-none text-[13px] text-fg placeholder:text-fg-subtle max-h-40",style:{minHeight:"24px"}}),n?(0,h.jsxs)(o2,{variant:"outline",size:"sm",onClick:r,"aria-label":"Abort",children:[(0,h.jsx)(oO,{className:"h-3 w-3"})," Stop"]}):(0,h.jsx)(o2,{variant:"accent",size:"sm",onClick:H,disabled:i||!e.trim()&&0===F.length,children:(0,h.jsx)(oz,{className:"h-3 w-3"})})]}),I&&(0,h.jsx)("div",{className:"absolute inset-0 rounded-xl flex items-center justify-center bg-accent/[0.04] pointer-events-none",children:(0,h.jsx)("span",{className:"text-[11.5px] text-accent font-medium",children:"Drop to attach"})})]}),(0,h.jsxs)("div",{className:"mt-2 flex items-center gap-3 text-[10.5px] text-fg-subtle px-0.5",children:[(0,h.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,h.jsx)(oB,{className:"h-2.5 w-2.5"})," commands"]}),(0,h.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,h.jsx)(oq,{className:"h-2.5 w-2.5"})," mention"]}),(0,h.jsx)("span",{className:"text-fg-subtle/70",children:"· ⏎ send · ⇧⏎ newline"}),(0,h.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[g&&g.length>0&&f&&(0,h.jsx)(le,{model:p,thinking:x,models:g,onChange:f}),(0,h.jsx)(la,{}),(0,h.jsx)(o7,{}),b&&v&&(0,h.jsx)(ln,{mode:b,onChange:v})]})]})]})});function lc(e,t){if(0===e.length)return[t];let s=e[e.length-1];return"subagent"===s.kind&&"running"===s.state?[...e.slice(0,-1),{...s,children:lc(s.children,t)}]:[...e,t]}function ld(e,t,s){return e.map(e=>e.id===t?s(e):"subagent"===e.kind?{...e,children:ld(e.children,t,s)}:e)}function lu(e){let t="";for(let s of e)"text"===s.kind?t+=s.text:"subagent"===s.kind&&(t+=lu(s.children));return t}function lh(e){for(let t of e)if("approval"===t.kind&&!t.decision||"subagent"===t.kind&&lh(t.children))return!0;return!1}let lm="[dev-chat]";function lp(e,t,s=1e3){let[,r]=(0,m.useState)(0);return(0,m.useEffect)(()=>{if(!e)return;let t=setInterval(()=>r(e=>e+1),s);return()=>clearInterval(t)},[e,s]),e?Date.now()-t:0}let lx=E("file-plus",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]),lg=E("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),lf=E("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),lb=E("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);function lv(e){if(!e)return"";let t=String(e).replace(/\/+$/,""),s=t.lastIndexOf("/");return s>=0?t.slice(s+1):t}let ly=E("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);var lj=e.i(86976);function lw({text:e,caption:t,prefix:s,maxHeight:r=280,language:n,className:a}){let[i,o]=(0,m.useState)(!1),l=(0,m.useMemo)(()=>n||(t?(0,lj.langFromPath)(t):void 0),[n,t]),c=(0,m.useMemo)(()=>l||e.length<8e3?(0,lj.highlight)(e,l):null,[e,l]),d=async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),1200)}catch{}};return(0,h.jsxs)("div",{className:i1("group relative rounded-md overflow-hidden bg-bg-elevated-2 shadow-[inset_0_0_0_1px_var(--border-soft)]",a),children:[t&&(0,h.jsx)("div",{className:"px-2.5 py-1 text-[10.5px] font-mono text-fg-subtle bg-bg-elevated border-b border-border truncate",children:t}),(0,h.jsx)("button",{onClick:d,className:"absolute top-1.5 right-1.5 z-10 h-5 w-5 inline-flex items-center justify-center rounded text-fg-subtle hover:text-fg hover:bg-bg-hover opacity-0 group-hover:opacity-100 transition-opacity",title:"Copy","aria-label":"Copy",children:i?(0,h.jsx)(oo,{className:"h-3 w-3 text-ok"}):(0,h.jsx)(ly,{className:"h-3 w-3"})}),(0,h.jsxs)("pre",{className:"hljs font-mono text-[11.5px] leading-[1.55] text-fg px-2.5 py-2 overflow-auto whitespace-pre",style:{maxHeight:r},"data-selectable":!0,children:[s&&(0,h.jsxs)("span",{className:"text-fg-subtle select-none",children:[s," "]}),c?(0,h.jsx)("code",{className:i1("hljs",l&&`language-${l}`),dangerouslySetInnerHTML:{__html:c}}):e]})]})}function lk({oldText:e,newText:t,caption:s,maxHeight:r=320,className:n}){let a=function(e,t){let s=e.split(/\r?\n/),r=t.split(/\r?\n/),n=s.length,a=r.length,i=Array.from({length:n+1},()=>Array(a+1).fill(0));for(let e=n-1;e>=0;e--)for(let t=a-1;t>=0;t--)i[e][t]=s[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let o=[],l=0,c=0,d=1,u=1;for(;l<n&&c<a;)s[l]===r[c]?(o.push({kind:"ctx",oldNum:d,newNum:u,text:s[l]}),l++,c++,d++,u++):i[l+1][c]>=i[l][c+1]?(o.push({kind:"del",oldNum:d,newNum:null,text:s[l]}),l++,d++):(o.push({kind:"add",oldNum:null,newNum:u,text:r[c]}),c++,u++);for(;l<n;)o.push({kind:"del",oldNum:d,newNum:null,text:s[l]}),l++,d++;for(;c<a;)o.push({kind:"add",oldNum:null,newNum:u,text:r[c]}),c++,u++;return o}(e,t),i=a.filter(e=>"add"===e.kind).length,o=a.filter(e=>"del"===e.kind).length;return(0,h.jsxs)("div",{className:i1("rounded-md overflow-hidden bg-bg-elevated-2 shadow-[inset_0_0_0_1px_var(--border-soft)]",n),children:[(s||i+o>0)&&(0,h.jsxs)("div",{className:"px-2.5 py-1 text-[10.5px] font-mono text-fg-subtle bg-bg-elevated border-b border-border flex items-center gap-2",children:[s&&(0,h.jsx)("span",{className:"truncate flex-1",children:s}),i>0&&(0,h.jsxs)("span",{className:"text-diff-add-fg tabular-nums",children:["+",i]}),o>0&&(0,h.jsxs)("span",{className:"text-diff-del-fg tabular-nums",children:["-",o]})]}),(0,h.jsx)("div",{className:"font-mono text-[11px] leading-[1.55] overflow-auto",style:{maxHeight:r},"data-selectable":!0,children:a.map((e,t)=>(0,h.jsx)(lN,{line:e},t))})]})}function lN({line:e}){let t="add"===e.kind?"+":"del"===e.kind?"-":" ",s="add"===e.kind?"bg-diff-add-bg":"del"===e.kind?"bg-diff-del-bg":"",r="add"===e.kind?"text-diff-add-fg":"del"===e.kind?"text-diff-del-fg":"text-fg-muted";return(0,h.jsxs)("div",{className:i1("flex",s),children:[(0,h.jsx)("span",{className:"select-none shrink-0 w-8 text-right pr-2 text-fg-subtle tabular-nums",children:e.oldNum??""}),(0,h.jsx)("span",{className:"select-none shrink-0 w-8 text-right pr-2 text-fg-subtle tabular-nums",children:e.newNum??""}),(0,h.jsx)("span",{className:i1("select-none shrink-0 w-4 text-center",r),children:t}),(0,h.jsx)("span",{className:i1("whitespace-pre flex-1 pr-2",r),children:e.text})]})}function lS({tool:e,project:t}){let s=e.result??"",r=t?.path,n=e=>{if(e)return r&&e.startsWith(r)?e.slice(r.length).replace(/^\/+/,"")||"/":e};if("Bash"===e.name){let t=String(e.args.command??"");return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(lw,{text:t,prefix:"$",maxHeight:120}),s&&(0,h.jsx)(lw,{text:s,caption:"output",maxHeight:240})]})}if("Write"===e.name){let t=String(e.args.content??"");return(0,h.jsx)(lk,{oldText:"",newText:t,caption:n(e.args.file_path)})}if("Edit"===e.name){let t=String(e.args.old_string??""),s=String(e.args.new_string??"");return(0,h.jsx)(lk,{oldText:t,newText:s,caption:n(e.args.file_path)})}if("Read"===e.name)return s?(0,h.jsx)(lw,{text:s,caption:n(e.args.file_path),maxHeight:320}):(0,h.jsx)("div",{className:"text-[11px] text-fg-subtle italic",children:"No content returned."});if("Glob"===e.name||"Grep"===e.name){let t=String(e.args.pattern??"");return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(lw,{text:t,caption:"Grep"===e.name?"pattern":"glob",maxHeight:60}),s&&(0,h.jsx)(lw,{text:s,caption:"matches",maxHeight:240})]})}if("WebSearch"===e.name||"WebFetch"===e.name){let t=String(e.args.query??e.args.url??"");return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(lw,{text:t,caption:"WebFetch"===e.name?"url":"query",maxHeight:60}),s&&(0,h.jsx)(lw,{text:s,caption:"result",maxHeight:300})]})}return(0,h.jsxs)(h.Fragment,{children:[Object.entries(e.args).map(([e,t])=>{let s="string"==typeof t?t:JSON.stringify(t,null,2);return(0,h.jsx)(lw,{text:s,caption:e,maxHeight:180},e)}),s&&(0,h.jsx)(lw,{text:s,caption:"result",maxHeight:240})]})}function lC(e){if(!e)return"";let t=e.replace(/\/+$/,""),s=t.lastIndexOf("/");return s>=0?t.slice(s+1):t}function lA({tool:e,project:t}){let s=function(e,t){if(e)return t&&e.startsWith(t)?e.slice(t.length).replace(/^\/+/,"")||"/":e}(String(e.args.file_path??e.args.path??""),t?.path);return e.result?(0,h.jsx)(lw,{text:e.result,caption:s,maxHeight:320}):(0,h.jsx)("div",{className:"text-[11px] text-fg-subtle italic",children:"No content yet…"})}function lM({tool:e,count:t,project:s,onToggle:r,messageIsDone:n}){let a=function(e,t,s){let r=s?.name;switch(s?.path,e){case"Read":{let e=lv(t.file_path??t.path);return{title:`Read ${e||"file"}`,icon:R,tone:"read"}}case"Write":{let e=lv(t.file_path??t.path);return{title:`Created ${e||"file"}`,icon:lx,tone:"create"}}case"Edit":{let e=lv(t.file_path??t.path);return{title:`Edited ${e||"file"}`,icon:ls,tone:"edit"}}case"Bash":{let e=String(t.command??"").trim(),s=e.split(/\s+/)[0]||"command",r=e.length<=50?e:`${s}…`;return{title:`Ran ${r}`,icon:lg,tone:"exec"}}case"Glob":{let e=String(t.pattern??""),s=t.path?` in ${lv(String(t.path))}`:r?` in ${r}`:"";return{title:`Listed ${e}${s}`,icon:od,tone:"search"}}case"Grep":{let e=String(t.pattern??""),s=t.path?` in ${lv(String(t.path))}`:r?` in ${r}`:"";return{title:`Searched “${e}”${s}`,icon:i6,tone:"search"}}case"WebSearch":{let e=String(t.query??"").slice(0,60);return{title:`Searched the web: ${e}`,icon:lf,tone:"search"}}case"WebFetch":{let e=String(t.url??"").slice(0,60);return{title:`Fetched ${e}`,icon:lf,tone:"read"}}case"Agent":{let e=String(t.description??t.subagent_type??"subagent");return{title:`Spawned ${e}`,icon:D,tone:"agent"}}default:if(e.startsWith("mcp__"))return{title:e.replace(/^mcp__[^_]+__/,""),icon:lb,tone:"default"};let n=Object.values(t).find(e=>"string"==typeof e);return{title:n?`${e} — ${n.slice(0,60)}`:e,icon:lb,tone:"default"}}}(e.name,e.args,s),i=void 0!==e.result||!!n,o=lp(!i,(0,m.useRef)(Date.now()).current),l=i?null:Math.round(o/1e3),c=i?null:function(e,t,s){let r=null!=s&&s>0?` for ${s}s`:"";switch(e){case"Bash":{let e=String(t.command??"").trim(),s=e.length<=40?e:e.split(/\s+/)[0]+"…";return`Running ${s}${r}`}case"Read":return`Reading ${lC(String(t.file_path??t.path??""))}${r}`;case"Write":return`Creating ${lC(String(t.file_path??t.path??""))}${r}`;case"Edit":return`Editing ${lC(String(t.file_path??t.path??""))}${r}`;case"Glob":return`Exploring files${r}`;case"Grep":return`Searching "${String(t.pattern??"").slice(0,30)}"${r}`;case"WebSearch":return`Searching the web${r}`;case"WebFetch":return`Fetching page${r}`;case"Agent":return`Running agent${r}`;default:return`Running ${e}${r}`}}(e.name,e.args,l);return(0,h.jsxs)("div",{className:"my-0.5",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1",children:[(0,h.jsx)("span",{className:i1("text-[11px]",i?"text-fg-disabled":"text-accent"),children:("Read"===e.name||"Write"===e.name||"Edit"===e.name||e.name,"⟡")}),(0,h.jsxs)("button",{onClick:r,"aria-expanded":!!e.expanded,className:"group flex items-center gap-1 text-left transition-opacity hover:opacity-70",children:[(0,h.jsxs)("span",{className:i1("text-[13px] leading-[1.65]",i?"text-fg-subtle":"tool-shimmer-text"),children:[i?a.title:c,i&&t&&t>1&&(0,h.jsxs)("span",{className:"text-fg-disabled font-normal",children:[" ×",t]})]}),e.expanded&&(0,h.jsx)(o6,{className:"h-3 w-3 text-fg-subtle/50 shrink-0"})]})]}),e.expanded&&(0,h.jsx)("div",{className:"mt-1 ml-4 mb-2 border-l-2 border-border pl-3",children:"Read"===e.name?(0,h.jsx)(lA,{tool:e,project:s}):(0,h.jsx)(lS,{tool:e,project:s})})]})}let lP=E("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),lE=E("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),lT=E("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);function lD(e){if(e.startsWith("mcp__")){let t=e.split("__");return t[t.length-1].replace(/_/g," ").replace(/^\w/,e=>e.toUpperCase())}return e}let l$=(0,m.memo)(function({block:e,onDecide:t}){if(e.decision){let t="deny"===e.decision?(0,h.jsx)(lP,{className:"h-3 w-3 text-danger"}):(0,h.jsx)(lE,{className:"h-3 w-3 text-ok"});return(0,h.jsxs)("div",{className:"flex items-center gap-1.5 text-[11px] text-fg-subtle py-0.5",children:[t,(0,h.jsxs)("span",{children:["deny"===e.decision?"Denied":"allow-always"===e.decision?"Always allowed":"Allowed",":"]}),(0,h.jsx)("span",{className:"font-mono text-fg-muted",children:lD(e.toolName)})]})}let s=lD(e.toolName),r=function(e){if(!e)return"";if(e.match(/\*\*\*\s*(Add|Update|Delete)\s+File:\s*(.+)/))return e.replace(/^[^*]*/,"").trim();let t=e.match(/^\w+\((.*)\)$/s);return t?t[1]:e}(e.preview);return(0,h.jsxs)("div",{role:"alertdialog","aria-label":`Approve ${s}`,className:"rounded-lg px-3 py-2.5 my-1.5 bg-bg-elevated border border-border",children:[(0,h.jsxs)("div",{className:"flex items-start gap-2 mb-2",children:[(0,h.jsx)(lT,{className:"h-3 w-3 text-accent mt-0.5 shrink-0"}),(0,h.jsxs)("div",{className:"text-[12px] text-fg",children:["Allow ",(0,h.jsx)("span",{className:"font-semibold",children:s}),"?"]})]}),r&&(0,h.jsx)("pre",{className:"text-[10.5px] font-mono text-fg-muted bg-bg-panel rounded px-2 py-1.5 mb-2 whitespace-pre-wrap max-h-40 overflow-auto border border-border",children:r}),(0,h.jsxs)("div",{className:"flex items-center gap-1.5 justify-end",children:[(0,h.jsx)(o2,{variant:"ghost",size:"sm",onClick:()=>t(e.id,"deny"),children:"Deny"}),(0,h.jsx)(o2,{variant:"outline",size:"sm",onClick:()=>t(e.id,"allow-always"),children:"Always allow"}),(0,h.jsx)(o2,{variant:"accent",size:"sm",onClick:()=>t(e.id,"allow-once"),children:"Allow once"})]})]})}),lR=[{bg:"#2D5F7C",fg:"#CFE5F3"},{bg:"#5F2D7C",fg:"#E0CFF3"},{bg:"#7C2D5F",fg:"#F3CFE1"},{bg:"#7C5F2D",fg:"#F3E1CF"},{bg:"#2D7C5F",fg:"#CFF3E1"},{bg:"#5F7C2D",fg:"#E1F3CF"},{bg:"#7C2D2D",fg:"#F3CFCF"},{bg:"#2D2D7C",fg:"#CFCFF3"}];function l_(e){let t=String(e??"");return t?lR[function(e){let t=0;for(let s=0;s<e.length;s++)t=(t<<5)-t+e.charCodeAt(s)|0;return Math.abs(t)}(t)%lR.length]:lR[0]}function lF(e){let t=String(e??"").replace(/^@/,"").trim();if(!t)return"?";let s=t.split(/[-_.\s]+/).filter(Boolean);return 0===s.length?t.slice(0,2).toUpperCase():1===s.length?s[0].slice(0,2).toUpperCase():(s[0][0]+s[1][0]).toUpperCase()}function lV({block:e,depth:t,project:s,onToggle:r,onDecideApproval:n}){var a;let i,o,l,c,d=l_(e.agentId),u=lF(e.agentId),m="running"===e.state,p=lp(m,e.startedAt),x=m?p:"number"==typeof e.duration&&e.duration>0?1e3*e.duration:Date.now()-e.startedAt,g=(a=e.children,l=[],(c=e=>{for(let t of e)"tool"===t.kind?l.push(t.name):"subagent"===t.kind&&c(t.children)})(a),l.slice(-3)),f=lh(e.children),b=m?"":function(e,t=80){let s=lu(e).trim();if(!s)return"";let r=s.split(/\n+/).map(e=>e.trim()).find(e=>e.length>0)??"";return r?r.length>t?r.slice(0,t-1)+"…":r:""}(e.children);return f?(i=(0,h.jsx)(lP,{className:"h-2.5 w-2.5 text-accent"}),o="waiting"):m?(i=(0,h.jsx)(om,{className:"h-2.5 w-2.5 animate-spin"}),o=g.length>0?"running":"thinking"):(i=(0,h.jsx)(lE,{className:"h-2.5 w-2.5 text-ok"}),o="done"),(0,h.jsxs)("div",{className:"text-[12.5px] flex gap-2",children:[(0,h.jsx)("div",{"aria-hidden":!0,className:i1("w-0.5 rounded-full shrink-0 self-stretch",m&&"animate-pulse"),style:{background:d.bg,opacity:m?.9:.45}}),(0,h.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,h.jsxs)("button",{onClick:()=>r(e.id),"aria-expanded":!!e.expanded,className:"w-full flex items-center gap-2 py-0.5 text-left hover:opacity-90 transition-opacity",children:[e.expanded?(0,h.jsx)(o6,{className:"h-3 w-3 text-fg-subtle shrink-0"}):(0,h.jsx)(ol,{className:"h-3 w-3 text-fg-subtle shrink-0"}),(0,h.jsx)("span",{className:"inline-flex items-center justify-center rounded font-mono font-semibold tabular-nums shrink-0",style:{background:d.bg,color:d.fg,width:20,height:16,fontSize:9.5,letterSpacing:.5},children:u}),(0,h.jsxs)("span",{className:"text-fg font-mono truncate",children:["@",e.agentId]}),(0,h.jsxs)("span",{className:"inline-flex items-center gap-1 text-[11px] text-fg-subtle shrink-0",children:[i," ",o]}),m&&g.length>0&&(0,h.jsx)("span",{className:"text-[10.5px] text-fg-muted font-mono truncate min-w-0",title:g.join(" → "),children:g.join(" → ")}),!m&&b&&(0,h.jsx)("span",{className:"text-[10.5px] text-fg-subtle italic truncate min-w-0",title:b,children:b}),(0,h.jsxs)("span",{className:"ml-auto flex items-center gap-2 shrink-0 text-[10.5px] text-fg-subtle tabular-nums",children:["number"==typeof e.toolCount&&(0,h.jsxs)("span",{children:[e.toolCount," tool",1===e.toolCount?"":"s"]}),(0,h.jsx)("span",{children:function(e){if(!Number.isFinite(e)||e<0)return"0s";if(e<1e3)return`${e}ms`;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let s=Math.floor(t/60);return`${s}m${(t%60).toString().padStart(2,"0")}s`}(x)})]})]}),e.expanded&&(0,h.jsxs)("div",{className:"mt-1 ml-4 pl-3 space-y-2 py-1",style:{borderLeft:`1px solid ${d.bg}`,opacity:1},children:[0===e.children.length&&(0,h.jsx)("div",{className:"text-[11.5px] text-fg-subtle italic",children:"Waiting for first tool call…"}),(0,h.jsx)(lH,{blocks:e.children,depth:t+1,project:s,onToggle:r,onDecideApproval:n})]})]})]})}let lI=E("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);function lL({block:e}){return e.failures&&e.failures.length>0?(0,h.jsx)("div",{className:"my-1 flex items-center gap-3 flex-wrap text-[11px]",children:e.failures.map((e,t)=>(0,h.jsxs)("div",{className:"flex items-center gap-1 text-warn",children:[(0,h.jsx)(lI,{className:"h-3 w-3"}),(0,h.jsx)("span",{className:"font-medium",children:e.name}),(0,h.jsxs)("span",{className:"text-fg-subtle",children:["— ",e.reason]})]},t))}):null}let lU=null,lz=null;async function lO(){if(!lU){let[t,s,{highlight:r}]=await Promise.all([e.A(54936).then(e=>e.default),e.A(68753).then(e=>e.default),e.A(7265)]);lz=s,lU=new t({html:!1,linkify:!0,typographer:!0,highlight:(e,t)=>{let s=r(e,t);return`<pre class="hljs"><code class="hljs language-${t||"plaintext"}">${s}</code></pre>`}})}return{md:lU,purify:lz}}function lB({text:e}){let[t,s]=(0,m.useState)(()=>lU&&lz?lz.sanitize(lU.render(e)):null),r=(0,m.useRef)(e);return(r.current=e,(0,m.useEffect)(()=>{if(lU&&lz)return void s(lz.sanitize(lU.render(r.current)));let e=!0;return lO().then(({md:t,purify:n})=>{e&&s(n.sanitize(t.render(r.current)))}),()=>{e=!1}},[e]),null===t)?(0,h.jsx)("div",{className:"text-[14px] leading-[1.65] text-fg-subtle animate-pulse",children:"Loading..."}):(0,h.jsx)("div",{className:"text-[14px] leading-[1.65] text-fg prose-chat","data-selectable":!0,dangerouslySetInnerHTML:{__html:t}})}function lq({block:e,depth:t,project:s,onToggle:r,onDecideApproval:n,messageIsDone:a}){return"text"===e.kind?(0,h.jsx)(lB,{text:e.text}):"tool"===e.kind?(0,h.jsx)(lM,{tool:e,project:s,onToggle:()=>r(e.id),messageIsDone:a}):"approval"===e.kind?(0,h.jsx)(l$,{block:e,onDecide:n}):"skill"===e.kind?null:"skills_summary"===e.kind?(0,h.jsx)(lL,{block:e}):(0,h.jsx)(lV,{block:e,depth:t,project:s,onToggle:r,onDecideApproval:n})}function lW(e){let t=String(e.args.file_path??e.args.path??"");return`${e.name}:${t}`}function lH({blocks:e,depth:t,project:s,onToggle:r,onDecideApproval:n,messageIsDone:a}){let i=function(e){let t=[],s=0;for(;s<e.length;){let r=e[s];if("tool"===r.kind){let n=lW(r),a=[r];for(;s+1<e.length&&"tool"===e[s+1].kind&&lW(e[s+1])===n;)s++,a.push(e[s]);t.push({type:"tool-group",tools:a,key:`tg-${a[0].id}`})}else t.push({type:"block",block:r});s++}return t}(e);return(0,h.jsx)(h.Fragment,{children:i.map(e=>{if("tool-group"===e.type){let t=e.tools[0];return(0,h.jsx)(lM,{tool:t,count:e.tools.length,project:s,onToggle:()=>r(t.id),messageIsDone:a},e.key)}return(0,h.jsx)(lq,{block:e.block,depth:t,project:s,onToggle:r,onDecideApproval:n,messageIsDone:a},e.block.id)})})}let lK=(0,m.memo)(function({stats:e,streaming:t}){if(t&&!e.endedAt)return null;let s=e.endedAt?Math.round((e.endedAt-e.startedAt)/1e3):Math.round((Date.now()-e.startedAt)/1e3),r=(e.inputTokens??0)+(e.outputTokens??0);return(0,h.jsxs)("div",{className:"flex items-center gap-3 pt-1 text-[10px] text-fg-subtle",children:[(0,h.jsxs)("span",{className:"tabular-nums",children:[s,"s"]}),r>0&&(0,h.jsxs)("span",{className:"tabular-nums",children:[r.toLocaleString()," tokens"]})]})}),lG=(0,m.memo)(function({hasProject:e}){return(0,h.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-center px-8 py-16 text-fg-subtle",children:[(0,h.jsx)("img",{src:"/camel-mark.png",alt:"CamelAGI",width:36,height:36,draggable:!1,className:"block select-none mb-4 opacity-80",style:{width:36,height:36}}),(0,h.jsx)("div",{className:"text-[14px] font-semibold text-fg tracking-tight",children:e?"Let's build.":"Pick a project to start"}),(0,h.jsx)("div",{className:"mt-1 text-[11.5px] max-w-md leading-relaxed",children:e?(0,h.jsxs)(h.Fragment,{children:["Describe a task, paste an error, or drop a file. Use ",(0,h.jsx)("kbd",{className:"font-mono text-[10.5px] px-1 py-px rounded bg-bg-elevated border border-border-soft",children:"/"})," for commands and ",(0,h.jsx)("kbd",{className:"font-mono text-[10.5px] px-1 py-px rounded bg-bg-elevated border border-border-soft",children:"@"})," to mention a specialist."]}):"Open a project from Home so CamelAGI has context about your code, agents, and plugins."})]})}),lY={read:"is reading",thinking:"is thinking",typing:"is typing",waiting:"is waiting",silent:"stayed silent"},lX=["read","thinking","typing","waiting"];function lJ({statuses:e}){let t=Object.entries(e).filter(([,e])=>lX.includes(e));if(0===t.length)return null;let s={typing:0,thinking:1,read:2,waiting:3,silent:99};return t.sort((e,t)=>(s[e[1]]??9)-(s[t[1]]??9)),(0,h.jsx)("div",{className:"mx-6 mb-2 flex items-center gap-2 flex-wrap text-[11.5px] text-fg-subtle",children:t.map(([e,t])=>{let s=l_(e),r=lF(e);return(0,h.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full",style:{background:"var(--bg-elevated)",boxShadow:"inset 0 0 0 1px var(--border-soft)"},children:[(0,h.jsx)("span",{className:"inline-flex items-center justify-center text-[9px] font-semibold rounded-full",style:{width:14,height:14,background:s.bg,color:s.fg},children:r}),(0,h.jsx)("span",{className:"font-medium text-fg",children:e}),(0,h.jsx)("span",{children:lY[t]}),("thinking"===t||"typing"===t)&&(0,h.jsx)(lZ,{})]},e)})})}function lZ(){return(0,h.jsxs)("span",{className:"inline-flex items-center gap-[2px] ml-0.5",children:[(0,h.jsx)(lQ,{delay:0}),(0,h.jsx)(lQ,{delay:150}),(0,h.jsx)(lQ,{delay:300})]})}function lQ({delay:e}){return(0,h.jsx)("span",{className:"inline-block w-[3px] h-[3px] rounded-full bg-fg-subtle",style:{animation:`peerDot 1s ${e}ms infinite ease-in-out`}})}let l0={bg:"#3F3F46",fg:"#F4F4F5"};function l1({entries:e,streamingDrafts:t={}}){let s=Object.keys(t).filter(e=>t[e]?.length>0);if(0===e.length&&0===s.length)return(0,h.jsx)("div",{className:"flex items-center justify-center h-full opacity-40 text-[12px]",children:"Send a message to start the conversation."});let r=[],n="",a="";for(let t=0;t<e.length;t++){let s=e[t],i=function(e,t=Date.now()){let s=new Date(e),r=new Date(t);if(s.getFullYear()===r.getFullYear()&&s.getMonth()===r.getMonth()&&s.getDate()===r.getDate())return"Today";let n=new Date(t);return(n.setDate(n.getDate()-1),s.getFullYear()===n.getFullYear()&&s.getMonth()===n.getMonth()&&s.getDate()===n.getDate())?"Yesterday":s.toLocaleDateString(void 0,{month:"short",day:"numeric"})}(s.ts);i!==n&&(r.push({kind:"day",key:`day-${t}`,label:i}),n=i,a=""),r.push({kind:"row",entry:s,consecutive:s.from===a}),a=s.from}return(0,h.jsxs)("div",{className:"space-y-3",children:[r.map(e=>"day"===e.kind?(0,h.jsx)(l2,{label:e.label},e.key):(0,h.jsx)(l5,{entry:e.entry,consecutive:e.consecutive},e.entry.id)),s.map(e=>(0,h.jsx)(l5,{entry:{id:`draft-${e}`,from:e,text:t[e],ts:Date.now()},streaming:!0,consecutive:!1},`draft-${e}`))]})}function l2({label:e}){return(0,h.jsxs)("div",{className:"flex items-center gap-3 my-3 select-none",children:[(0,h.jsx)("div",{className:"flex-1 h-px bg-[var(--border-soft)]"}),(0,h.jsx)("span",{className:"text-[10.5px] uppercase tracking-wider opacity-50",children:e}),(0,h.jsx)("div",{className:"flex-1 h-px bg-[var(--border-soft)]"})]})}function l5({entry:e,streaming:t=!1,consecutive:s=!1}){let r,n,a,i="user"===e.from,o=i?l0:l_(e.from),l=i?"ME":lF(e.from),c=i?"you":e.from;return(0,h.jsxs)("div",{className:`flex gap-3 items-start ${s?"mt-0.5":"mt-2"} group`,children:[(0,h.jsx)("div",{className:"shrink-0 w-7",children:!s&&(0,h.jsx)("span",{className:"inline-flex items-center justify-center text-[10px] font-semibold rounded-full mt-0.5 ring-1 ring-[var(--border-soft)]",style:{width:28,height:28,background:o.bg,color:o.fg},children:l})}),(0,h.jsxs)("div",{className:"flex-1 min-w-0",children:[!s&&(0,h.jsxs)("div",{className:"flex items-baseline gap-2 mb-0.5",children:[(0,h.jsx)("span",{className:"text-[12.5px] font-semibold text-fg",children:c}),(0,h.jsx)("span",{className:"text-[10.5px] opacity-40 group-hover:opacity-70 transition-opacity",children:t?"typing…":(n=String((r=new Date(e.ts)).getHours()).padStart(2,"0"),a=String(r.getMinutes()).padStart(2,"0"),`${n}:${a}`)})]}),t?(0,h.jsxs)("div",{className:"text-[13.5px] leading-[1.65] text-fg whitespace-pre-wrap",style:{opacity:.9},"data-selectable":!0,children:[e.text,(0,h.jsx)("span",{className:"ml-0.5 opacity-50 animate-pulse",children:"▍"})]}):(0,h.jsx)("div",{className:"text-[13.5px] leading-[1.65] text-fg","data-selectable":!0,children:(0,h.jsx)(lB,{text:e.text})})]})]})}function l3({pending:e,onDismiss:t}){let s=l_(e.from),r=lF(e.from);return(0,h.jsxs)("div",{className:"mx-6 mb-2 flex items-start gap-2.5 px-3 py-2 rounded-lg text-[12px]",style:{background:"rgba(245, 158, 11, 0.08)",boxShadow:"inset 0 0 0 1px rgba(245, 158, 11, 0.25)"},children:[(0,h.jsx)("span",{className:"shrink-0 inline-flex items-center justify-center text-[9px] font-semibold rounded-full mt-0.5",style:{width:18,height:18,background:s.bg,color:s.fg},children:r}),(0,h.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,h.jsxs)("div",{className:"font-medium text-warn mb-0.5",children:[e.from," is asking you a question"]}),(0,h.jsx)("div",{className:"text-fg whitespace-pre-wrap",children:e.question})]}),(0,h.jsx)("button",{onClick:t,className:"shrink-0 text-[10.5px] opacity-60 hover:opacity-100 transition-opacity px-1.5",title:"Dismiss",children:"✕"})]})}let l4=/^###\s+(\S+)\s+—\s+(.+?)\s*$/,l6=null,l9=null;async function l8(){if(!l6){let[t,s,{highlight:r}]=await Promise.all([e.A(54936).then(e=>e.default),e.A(68753).then(e=>e.default),e.A(7265)]);l9=s,l6=new t({html:!1,linkify:!0,typographer:!0,highlight:(e,t)=>{let s=r(e,t);return`<pre class="hljs"><code class="hljs language-${t||"plaintext"}">${s}</code></pre>`}})}return{md:l6,purify:l9}}function l7({text:e}){let[t,s]=(0,m.useState)(()=>l6&&l9?l9.sanitize(l6.render(e)):null),r=(0,m.useRef)(e);return(r.current=e,(0,m.useEffect)(()=>{if(l6&&l9)return void s(l9.sanitize(l6.render(r.current)));let e=!0;return l8().then(({md:t,purify:n})=>{e&&s(n.sanitize(t.render(r.current)))}),()=>{e=!1}},[e]),null===t)?(0,h.jsx)("div",{className:"text-[13px] leading-[1.6] text-fg-subtle animate-pulse",children:"…"}):(0,h.jsx)("div",{className:"text-[13px] leading-[1.6] text-fg prose-chat","data-selectable":!0,dangerouslySetInnerHTML:{__html:t}})}function ce({bubble:e,project:t,onToggle:s,onDecideApproval:r,messageIsDone:n}){let a=l_(e.author),i=lF(e.author);return(0,h.jsxs)("div",{className:"flex gap-2.5 items-start",children:[(0,h.jsx)("div",{className:"w-7 h-7 rounded-full shrink-0 flex items-center justify-center text-[10px] font-bold tabular-nums select-none",style:{background:a.bg,color:a.fg},title:e.author,children:i}),(0,h.jsxs)("div",{className:"flex-1 min-w-0 space-y-1",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)("span",{className:"text-[11.5px] font-semibold lowercase tracking-tight",style:{color:a.fg},children:e.author}),e.pendingFor&&(0,h.jsx)(om,{className:"h-3 w-3 animate-spin text-fg-subtle"})]}),(0,h.jsxs)("div",{className:i1("rounded-2xl rounded-tl-sm px-3.5 py-2 inline-block max-w-full","bg-bg-elevated shadow-[inset_0_0_0_1px_var(--border-soft)]"),children:[e.pendingFor&&(0,h.jsxs)("span",{className:"tool-shimmer-text text-[12px] leading-[1.5]",children:[e.pendingFor," is thinking…"]}),!e.pendingFor&&0===e.blocks.length&&(0,h.jsx)("span",{className:"tool-shimmer-text text-[12px] leading-[1.5]",children:"…"}),(0,h.jsx)(ct,{blocks:e.blocks,project:t,onToggle:s,onDecideApproval:r,messageIsDone:n})]})]})]})}function ct({blocks:e,project:t,onToggle:s,onDecideApproval:r,messageIsDone:n}){return(0,h.jsx)("div",{className:"space-y-1.5",children:e.map(e=>"text"===e.kind?(0,h.jsx)(l7,{text:e.text},e.id):"tool"===e.kind?(0,h.jsx)(lM,{tool:e,project:t,onToggle:()=>s(e.id),messageIsDone:n},e.id):"approval"===e.kind?(0,h.jsx)(l$,{block:e,onDecide:r},e.id):"skill"===e.kind?null:"skills_summary"===e.kind?(0,h.jsx)(lL,{block:e},e.id):null)})}function cs({blocks:e,parentAuthor:t,project:s,onToggle:r,onDecideApproval:n,messageIsDone:a,messageId:i}){let o=[];return(!function e(t,s,r,n){let a=[],i=0;for(let o of t)"subagent"===o.kind?(a.length>0&&(r.push({key:`${n}-${i}-${s}`,author:s,blocks:a}),a=[],i++),0===o.children.length?r.push({key:`${n}-${i}-${o.agentId}-pending`,author:o.agentId,blocks:[],pendingFor:o.agentId}):e(o.children,o.agentId,r,`${n}-${i}-${o.agentId}`),i++):a.push(o);a.length>0&&r.push({key:`${n}-tail-${s}`,author:s,blocks:a})}(e,t,o,i),0===o.length)?null:(0,h.jsx)("div",{className:"space-y-3",children:o.map(e=>(0,h.jsx)(ce,{bubble:e,project:s,onToggle:r,onDecideApproval:n,messageIsDone:a},e.key))})}let cr="[dev-chat]";function cn({sessionId:e,project:t,platforms:s,onAssistantText:r,onSubagentEvent:n,projects:a,onSelectProject:i,onNewProject:o,agentId:l,initialMessage:c,onInitialMessageDispatched:d,mode:u,onChangeMode:p,onTodos:x,runtime:g,onChangeRuntime:b,onCreditsDebited:v,projectKind:y,onChangeProjectKind:j,emptyState:w,hideProjectControls:k}){let{api:S,ws:C}=function(){let e=f();if(!e.api||!e.ws)throw Error("useGateway must be used after the gateway connects");return{api:e.api,ws:e.ws,baseUrl:e.url,token:e.token||void 0,health:null,connected:e.connected,refresh:async()=>{},wsDiag:null}}(),{navigate:A}=N(),{refreshSessions:M,activeAgentId:P,activeProjectId:E}=ea(),[T,D]=(0,m.useState)([]),[$,R]=(0,m.useState)(),[_,F]=(0,m.useState)(),[V,I]=(0,m.useState)([]),[L,U]=(0,m.useState)(""),[z,O]=(0,m.useState)(!1),[B,q]=(0,m.useState)(null),W=(0,m.useRef)(null),H=(0,m.useRef)(e);H.current=e;let K=(0,m.useRef)(!0),G=E??t?.id,Y=P??l,X=e.startsWith("collab-"),J=X?e.match(/^collab-([^-]+)/)?.[1]??null:null,[Z,Q]=(0,m.useState)({}),[ee,et]=(0,m.useState)([]),[es,er]=(0,m.useState)(null),[en,ei]=(0,m.useState)({});(0,m.useEffect)(()=>{let e=!0;return Promise.all([S.getModels().catch(()=>[]),S.getConfig().catch(()=>({}))]).then(([t,s])=>{if(!e)return;D(t);let r=s.model??void 0;r&&t.length>0&&!t.includes(r)?R(t[0]):R(r),F(s.thinking??void 0)}),()=>{e=!1}},[S]);let eo=(0,m.useCallback)((e,t)=>{C.switchModel(e??$??"",t),e&&R(e),t&&F(t)},[C,$]),el=(0,m.useMemo)(()=>T,[T,g]);(0,m.useEffect)(()=>{},[g,$,el,C,_]);let[ed,eu]=(0,m.useState)(!1);(0,m.useEffect)(()=>{let t=!0;return console.log(cr,"load history",{sessionId:e,projectId:G}),I([]),q(null),eu(!1),S.sessionMessages(e).then(s=>{t&&(console.log(cr,"history loaded",{count:s.length,sessionId:e}),I(s.filter(e=>"user"===e.role||"assistant"===e.role).map((e,t)=>"user"===e.role?{id:`hist-u-${t}`,role:"user",content:e.content}:{id:`hist-a-${t}`,role:"assistant",blocks:[{kind:"text",id:`hist-t-${t}`,text:e.content}]})))}).catch(e=>{t&&(console.warn(cr,"history load failed",e),I([]))}).finally(()=>{t&&eu(!0)}),()=>{t=!1}},[S,e,G]),(0,m.useEffect)(()=>{let e=W.current;if(!e)return;let t=()=>{K.current=e.scrollHeight-e.scrollTop-e.clientHeight<120};return e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)},[]),!function({ws:e,sessionRef:t,setMessages:s,setStreaming:r,setError:n,onSubagentEvent:a,onPeerStatus:i,onDiscussionAppend:o,onPendingQuestion:l,onCollabStream:c,onTodos:d,onCreditsDebited:u,onDone:h}){(0,m.useEffect)(()=>{if(!e)return;let m=[],p=e=>{s(t=>{if(0===t.length)return t;let s=t[t.length-1];if("assistant"!==s.role)return[...t,e({id:`a-${Date.now()}`,role:"assistant",blocks:[],stats:{startedAt:Date.now()}})];let r=[...t];return r[r.length-1]=e(s),r})};m.push(e.on("stream_text",e=>{if(e.session&&e.session!==t.current)return;let s=e.taskId?String(e.taskId):void 0,r=e.agentId?String(e.agentId):void 0,n=String(e.text??"");r&&n&&c?.(r,n),p(e=>({...e,blocks:s?function(e,t,s){var r;let n,a;return s?(r=e=>{if(0===e.length)return[{kind:"text",id:`t-${Date.now()}-${Math.random()}`,text:s}];let t=e[e.length-1];return"text"===t.kind?[...e.slice(0,-1),{...t,text:t.text+s}]:[...e,{kind:"text",id:`t-${Date.now()}-${Math.random()}`,text:s}]},n=!1,(a=e=>e.map(e=>{if(n)return e;if("subagent"===e.kind){if(e.taskId===t)return n=!0,{...e,children:r(e.children)};let s=a(e.children);if(s!==e.children)return{...e,children:s}}return e}))(e)):e}(e.blocks??[],s,n):function(e,t){if(!t)return e;let s=e=>{if(0===e.length)return[{kind:"text",id:`t-${Date.now()}-${Math.random()}`,text:t}];let r=e[e.length-1];return"subagent"===r.kind&&"running"===r.state?[...e.slice(0,-1),{...r,children:s(r.children)}]:"text"===r.kind?[...e.slice(0,-1),{...r,text:r.text+t}]:[...e,{kind:"text",id:`t-${Date.now()}-${Math.random()}`,text:t}]};return s(e)}(e.blocks??[],n)}))})),m.push(e.on("chunk",e=>{e.session&&e.session!==t.current||!e.text||e.taskId||p(t=>{let s=t.blocks??[];return s.some(e=>"text"===e.kind&&e.text.length>0)?t:{...t,blocks:lc(s,{kind:"text",id:`t-${Date.now()}`,text:String(e.text)})}})})),m.push(e.on("thinking_delta",e=>{p(t=>({...t,thinking:(t.thinking??"")+String(e.text??"")}))})),m.push(e.on("tool_call",e=>{console.log(lm,"tool_call",{name:e.name,id:e.id});let t=e.taskId?String(e.taskId):void 0,s={kind:"tool",id:String(e.id??`tool-${Date.now()}`),name:String(e.name??"tool"),args:e.args??{},expanded:!1};p(e=>{var r;let n,a,i;return{...e,blocks:t?(r=e.blocks??[],n=!1,i=(a=e=>e.map(e=>{if(n)return e;if("subagent"===e.kind){if(e.taskId===t)return n=!0,{...e,children:[...e.children,s]};let r=a(e.children);if(r!==e.children)return{...e,children:r}}return e}))(r),n?i:[...r,s]):lc(e.blocks??[],s)}})})),m.push(e.on("tool_result",e=>{p(t=>({...t,blocks:ld(t.blocks??[],String(e.id),t=>"tool"===t.kind?{...t,result:String(e.preview??"")}:t)}))})),m.push(e.on("approval_request",e=>{console.log(lm,"approval_request",e),p(t=>({...t,blocks:lc(t.blocks??[],{kind:"approval",id:String(e.id),toolName:String(e.toolName??"tool"),preview:String(e.preview??"")})}))})),m.push(e.on("approval_resolved",e=>{p(t=>({...t,blocks:ld(t.blocks??[],String(e.id),t=>"approval"===t.kind?{...t,decision:e.decision}:t)}))})),m.push(e.on("subagent_start",e=>{let t=String(e.agentId??"subagent");a?.({agentId:t,state:"start"}),p(s=>({...s,blocks:lc(s.blocks??[],{kind:"subagent",id:`sa-${t}-${Date.now()}`,agentId:t,taskId:e.taskId,state:"running",startedAt:Date.now(),children:[],expanded:!0})}))})),m.push(e.on("subagent_progress",e=>{a?.({agentId:String(e.agentId??"subagent"),state:"progress",toolCount:e.toolCount,duration:e.duration}),p(t=>({...t,blocks:function e(t,s,r,n){for(let a=t.length-1;a>=0;a--){let i=t[a];if("subagent"===i.kind){if("running"===i.state&&(""===s||i.agentId===s)){let e=[...t];return e[a]={...i,toolCount:r??i.toolCount,duration:n??i.duration},e}let o=e(i.children,s,r,n);if(o!==i.children){let e=[...t];return e[a]={...i,children:o},e}}}return t}(t.blocks??[],String(e.agentId??""),e.toolCount,e.duration)}))})),m.push(e.on("pending_question",e=>{let t=String(e.from??""),s=String(e.question??"");s&&l?.({from:t,question:s,ts:Date.now()})})),m.push(e.on("discussion_append",e=>{let t=String(e.from??""),s=String(e.text??""),r=Number(e.ts??Date.now());t&&s&&o?.({id:`d-${r}-${t}-${s.length}`,from:t,text:s,ts:r})})),m.push(e.on("peer_status",e=>{let t=String(e.peerId??""),s=String(e.state??"");t&&s&&i?.({peerId:t,state:s,ts:Date.now()})})),m.push(e.on("subagent_done",e=>{let t=String(e.agentId??"subagent");a?.({agentId:t,state:"done"}),p(e=>{let s=function e(t,s,r){for(let n=t.length-1;n>=0;n--){let a=t[n];if("subagent"===a.kind){let i=e(a.children,s,r);if(i.closed){let e=[...t];return e[n]={...a,children:i.blocks},{blocks:e,closed:!0}}if("running"===a.state&&a.agentId===s){let e=[...t];return e[n]=r(a),{blocks:e,closed:!0}}}}return{blocks:t,closed:!1}}(e.blocks??[],t,e=>({...e,state:"done",expanded:!1}));return{...e,blocks:s.blocks}})}));let x=!1;m.push(e.on("skills_loaded",e=>{if(x)return;let t=Array.isArray(e.skills)?e.skills.map(String):[],s=Array.isArray(e.plugins)?e.plugins.map(String):[],r=Array.isArray(e.failures)?e.failures:[];(0!==t.length||0!==s.length||0!==r.length)&&(x=!0,p(e=>({...e,blocks:lc(e.blocks??[],{kind:"skills_summary",id:`skills-summary-${Date.now()}`,skills:t,plugins:s,failures:r.length>0?r:void 0})})))})),m.push(e.on("todos",e=>{let t=(Array.isArray(e?.items)?e.items:[]).filter(e=>e&&"string"==typeof e.content).map(e=>({content:String(e.content),activeForm:"string"==typeof e.activeForm?e.activeForm:String(e.content),status:"in_progress"===e.status||"completed"===e.status?e.status:"pending"}));t.length>0&&d?.(t)})),m.push(e.on("usage",e=>{p(t=>({...t,stats:{...t.stats??{startedAt:Date.now()},inputTokens:e.inputTokens,outputTokens:e.outputTokens}}))})),m.push(e.on("done",e=>{e.session&&e.session!==t.current||(r(!1),h?.(),p(t=>{let s=t.blocks??[],r=!s.some(e=>"text"===e.kind&&e.text.length>0)&&e.response?lc(s,{kind:"text",id:`final-${Date.now()}`,text:String(e.response)}):s;return{...t,stats:{...t.stats??{startedAt:Date.now()},endedAt:Date.now()},blocks:r}}))})),m.push(e.on("error",e=>{let t=e.code;n({message:"subscription_required"===t?"Active subscription required to continue.":"out_of_credits"===t?"You're out of credits on your current plan.":"billing"===t?"Provider billing error — your API account needs more credits or a higher limit.":"auth"===t?"API authentication failed — check your API key.":"overflow"===t?"Message too long — try compacting or starting a new chat.":"rate_limit"===t?"Rate limited by the AI provider. Wait a moment and try again.":String(e.message??"Unknown error"),code:t}),r(!1)})),m.push(e.on("credits.debited",()=>{u?.()})),m.push(e.on("disconnected",()=>{r(e=>(e&&n({message:"Connection lost. Reconnecting…"}),!1))}));let g=null,f=()=>{g&&clearTimeout(g),g=setTimeout(()=>{r(e=>(e&&(console.warn(lm,"streaming safety timeout — forcing done"),n({message:"Response timed out. Try sending again."})),!1))},9e4)};for(let t of["stream_text","chunk","tool_call","tool_result","thinking_delta","subagent_progress"])m.push(e.on(t,f));return m.push(e.on("done",()=>{g&&clearTimeout(g)})),()=>{g&&clearTimeout(g),m.forEach(e=>e())}},[e,a,d,u,h,t,s,r,n])}({ws:C,sessionRef:H,setMessages:I,setStreaming:O,setError:q,onSubagentEvent:n,onPeerStatus:(0,m.useCallback)(({peerId:e,state:t})=>{Q(s=>({...s,[e]:t}))},[]),onDiscussionAppend:(0,m.useCallback)(e=>{et(t=>t.some(t=>t.from===e.from&&t.ts===e.ts&&t.text===e.text)?t:[...t,e]),ei(t=>{if(!(e.from in t))return t;let s={...t};return delete s[e.from],s})},[]),onPendingQuestion:(0,m.useCallback)(e=>{er(e)},[]),onCollabStream:(0,m.useCallback)((e,t)=>{X&&ei(s=>({...s,[e]:(s[e]??"")+t}))},[X]),onTodos:x,onCreditsDebited:v,onDone:M}),(0,m.useEffect)(()=>{if(!X||!J)return void et([]);let e=!0;return S.teamDiscussion(J,65536).then(t=>{e&&et(function(e){let t=[];if(!e)return t;let s=e.split("\n"),r=null,n=()=>{if(!r)return;let e=r.body.join("\n").trim();e&&t.push({id:`d-${r.ts}-${t.length}`,from:r.from,text:e,ts:r.ts}),r=null};for(let e of s){let t=l4.exec(e);if(t){n();let e=t[1],s=t[2].trim(),a=Date.parse(e);r={ts:Number.isFinite(a)?a:Date.now(),from:s,body:[]}}else r&&r.body.push(e)}return n(),t}(t))}).catch(()=>{e&&et([])}),()=>{e=!1}},[S,X,J,e]),(0,m.useEffect)(()=>{let e=[...V].reverse().find(e=>"assistant"===e.role);e?.blocks&&r?.(lu(e.blocks))},[V,r]),(0,m.useEffect)(()=>{if(X)return;let e=W.current;e&&K.current&&(e.scrollTop=e.scrollHeight)},[V,X]),(0,m.useEffect)(()=>{if(!X)return;let e=W.current;e&&K.current&&(e.scrollTop=e.scrollHeight)},[X,ee.length,en]);let eh=(0,m.useCallback)(async(t,r)=>{q(null),console.log(cr,"send",{raw:t,projectId:G,sessionId:e});let n=await oI(S,t,{projectId:G,platforms:s});if(!n.ok)return void q({message:n.error});console.log(cr,"dispatch",{sessionId:e,projectId:G,promptLen:n.prompt.length});let a=r&&r.length>0?r.map(e=>({mime:e.mime,previewUrl:e.previewUrl})):void 0,i={id:`u-${Date.now()}`,role:"user",content:t,attachments:a},o={id:`a-${Date.now()}`,role:"assistant",blocks:[],stats:{startedAt:Date.now()}};I(e=>[...e,i,o]),Q({}),er(null),ei({}),U(""),O(!0),K.current=!0;let l="claude-code"===g?void 0:Y??void 0,c=r&&r.length>0?r.map(e=>({kind:"image",mime:e.mime,data:e.data})):void 0;c&&console.log(cr,"dispatch with attachments",c.map(e=>({mime:e.mime,bytes:e.data.length}))),C.sendChat(n.prompt,e,{agentId:l,projectId:G,mode:u,runtime:g,model:$,attachments:c})||(O(!1),q({message:"Connection lost. Please wait and try again."}))},[S,C,e,t,G,s,Y,u,g,$]),em=(0,m.useRef)(null);(0,m.useEffect)(()=>{let t;c&&ed&&em.current!==e+":"+c&&(em.current=e+":"+c,eh(c,(t=oU.get(e)??[],oU.delete(e),t)),d?.())},[c,ed,e,eh,d]);let ep=e=>{I(t=>t.map(t=>"assistant"===t.role&&t.blocks?{...t,blocks:function e(t,s){return t.map(t=>t.id===s?"tool"===t.kind||"subagent"===t.kind?{...t,expanded:!t.expanded}:t:"subagent"===t.kind?{...t,children:e(t.children,s)}:t)}(t.blocks,e)}:t))},ex=(e,t)=>{console.log(cr,"decide approval",{id:e,decision:t}),C.decideApproval(e,t),I(s=>s.map(s=>"assistant"===s.role&&s.blocks?{...s,blocks:ld(s.blocks,e,e=>"approval"===e.kind?{...e,decision:t}:e)}:s))},eg=(0,m.useRef)(null),[ef,eb]=(0,m.useState)(!1);return(0,h.jsxs)("div",{className:"relative h-full flex flex-col min-h-0",onDragOver:e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),eb(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||eb(!1)},onDrop:e=>{eb(!1),e.dataTransfer.files&&0!==e.dataTransfer.files.length&&(e.preventDefault(),eg.current?.addFiles(e.dataTransfer.files),eg.current?.focus())},children:["plan"===u&&(0,h.jsx)(ca,{}),(0,h.jsx)("div",{ref:W,className:"flex-1 min-h-0 overflow-auto px-6 py-5 space-y-5",style:{overflowAnchor:"none"},role:"log","aria-live":"polite",children:(0,h.jsx)(ec,{label:"chat messages",children:X?(0,h.jsx)(l1,{entries:ee,streamingDrafts:en}):(0,h.jsxs)(h.Fragment,{children:[0===V.length&&!z&&ed&&(w??(0,h.jsx)(lG,{hasProject:!!G})),V.map((e,s)=>{let r=z&&"assistant"===e.role&&s===V.length-1;return(0,h.jsx)(ci,{message:e,streaming:r,project:t,onToggleBlock:ep,onDecideApproval:ex,collabMode:!1,collabAuthor:Y??"assistant"},e.id)})]})})}),B&&(0,h.jsxs)("div",{className:"mx-6 mb-2 px-3 py-1.5 rounded-md text-[11px] text-warn flex items-center gap-2",style:{background:"rgba(245,158,11,0.08)",boxShadow:"inset 0 0 0 1px rgba(245,158,11,0.2)"},children:[(0,h.jsx)("span",{className:"flex-1",children:B.message}),("subscription_required"===B.code||"out_of_credits"===B.code)&&(0,h.jsx)("button",{onClick:()=>A("settings"),className:"shrink-0 px-2 h-5 rounded text-[10.5px] bg-warn/20 hover:bg-warn/30 text-warn transition-colors",children:"Open Subscription"})]}),X&&es&&(0,h.jsx)(l3,{pending:es,onDismiss:()=>er(null)}),X&&(0,h.jsx)(lJ,{statuses:Z}),(0,h.jsx)("div",{className:"px-6 pb-5",children:(0,h.jsx)(ll,{ref:eg,value:L,onChange:U,onSubmit:(e,t)=>void eh(e,t),onAbort:()=>{console.log(cr,"abort"),C.abort(),O(!1),I(e=>e.map(e=>{if("assistant"!==e.role||!e.blocks)return e;let t=e=>e.map(e=>"subagent"===e.kind&&"running"===e.state?{...e,state:"done",expanded:!1,children:t(e.children)}:"tool"===e.kind&&void 0===e.result?{...e,result:"(stopped)"}:e);return{...e,blocks:t(e.blocks),stats:{...e.stats??{startedAt:Date.now()},endedAt:Date.now()}}}))},streaming:z,disabled:!1,hasProject:!!G,project:t??null,projects:a,onSelectProject:i,onNewProject:o,hideProjectControls:k,model:$,thinking:_,models:el,onChangeModel:eo,mode:u,onChangeMode:p,runtime:g,onChangeRuntime:b,projectKind:y,onChangeProjectKind:j})}),ef&&(0,h.jsx)("div",{className:"absolute inset-0 z-30 pointer-events-none flex items-center justify-center",style:{background:"var(--accent-soft)",boxShadow:"inset 0 0 0 2px var(--accent-stroke)"},children:(0,h.jsx)("div",{className:"px-4 py-2 rounded-lg text-[12.5px] font-medium text-accent bg-bg-main shadow-[inset_0_0_0_1px_var(--accent-stroke)]",children:"Drop image to attach"})})]})}function ca(){return(0,h.jsxs)("div",{className:"mx-6 mb-4 mt-1 px-3 py-2 rounded-md flex items-center gap-2 text-[11.5px] text-fg",style:{background:"var(--accent-soft)",boxShadow:"inset 0 0 0 1px var(--accent-stroke)"},children:[(0,h.jsx)("span",{className:"inline-flex h-1.5 w-1.5 rounded-full bg-accent"}),(0,h.jsx)("span",{className:"font-medium",children:"Plan mode"}),(0,h.jsx)("span",{className:"text-fg-subtle",children:"— no changes will be made. The agent will draft a plan and stream todos."})]})}function ci({message:e,streaming:t,project:s,onToggleBlock:r,onDecideApproval:n,collabMode:a=!1,collabAuthor:i="assistant"}){if("user"===e.role)return(0,h.jsx)("div",{className:"flex justify-end",children:(0,h.jsxs)("div",{className:"max-w-[70%] space-y-2",children:[e.attachments&&e.attachments.length>0&&(0,h.jsx)("div",{className:"flex justify-end gap-1.5 flex-wrap",children:e.attachments.map((e,t)=>(0,h.jsx)("img",{src:e.previewUrl,alt:"",className:"max-h-[200px] max-w-[260px] rounded-xl object-cover shadow-[inset_0_0_0_1px_var(--border-soft)]"},t))}),e.content&&(0,h.jsx)("div",{className:"px-3.5 py-2 rounded-2xl rounded-br-md text-[13px] text-fg whitespace-pre-wrap bg-bg-elevated shadow-[inset_0_0_0_1px_var(--border-soft)]","data-selectable":!0,children:e.content.replace(/^\[Context:[^\]]*\]\s*\n*/i,"")})]})});let o=e.blocks??[];return(0,h.jsxs)("div",{className:"space-y-1 text-fg",children:[0===o.length&&t&&(0,h.jsx)("span",{className:"tool-shimmer-text text-[13.5px] leading-[1.65]",children:"Thinking…"}),a?(0,h.jsx)(cs,{blocks:o,parentAuthor:i,messageId:e.id,project:s,onToggle:r,onDecideApproval:n,messageIsDone:!t}):(0,h.jsx)(lH,{blocks:o,depth:0,project:s,onToggle:r,onDecideApproval:n,messageIsDone:!t}),o.length>0&&t&&!lh(o)&&(0,h.jsx)("div",{className:"flex items-center gap-1.5 mt-1",children:(0,h.jsx)("span",{className:"tool-shimmer-text text-[11px]",children:"Working…"})}),e.stats&&(0,h.jsx)(lK,{stats:e.stats,streaming:t})]})}let co=E("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),cl=E("inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]),cc={manager:{ring:"ring-amber-500/50",bg:"bg-amber-500/10",text:"text-amber-500"},developer:{ring:"ring-emerald-500/50",bg:"bg-emerald-500/10",text:"text-emerald-500"},reviewer:{ring:"ring-violet-500/50",bg:"bg-violet-500/10",text:"text-violet-500"},tester:{ring:"ring-sky-500/50",bg:"bg-sky-500/10",text:"text-sky-500"},fixer:{ring:"ring-rose-500/50",bg:"bg-rose-500/10",text:"text-rose-500"},researcher:{ring:"ring-cyan-500/50",bg:"bg-cyan-500/10",text:"text-cyan-500"}};function cd(e){return cc[e]??{ring:"ring-fg-subtle/40",bg:"bg-bg-elevated",text:"text-fg-muted"}}function cu({id:e,online:t}){let s=cd(e);return(0,h.jsxs)("div",{className:"relative",children:[(0,h.jsx)("div",{className:i1("w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-semibold ring-1",s.ring,s.bg,s.text),children:e.slice(0,1).toUpperCase()}),t&&(0,h.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-full bg-emerald-500 ring-2 ring-bg-main"})]})}function ch({teamId:e}){let{api:t}=f(),{agents:s}=ea(),[r,n]=(0,m.useState)(null),[a,i]=(0,m.useState)("discussion"),[o,l]=(0,m.useState)(""),[c,d]=(0,m.useState)(""),[u,p]=(0,m.useState)(""),[x,g]=(0,m.useState)([]),b=(0,m.useRef)(null);(0,m.useEffect)(()=>{t&&t.team(e).then(n).catch(()=>n(null))},[t,e]),(0,m.useEffect)(()=>{if(!t)return;let s=!0,r=async()=>{try{if("discussion"===a){let r=await t.teamDiscussion(e,32768);s&&l(r)}else if("state"===a){let r=await t.teamState(e);s&&d(r)}else if("decisions"===a){let r=await t.teamDecisions(e);s&&p(r)}else if("inboxes"===a){let r=await t.teamInboxStatus(e);s&&g(r.unread)}}catch{}};r();let n=setInterval(r,2500);return()=>{s=!1,clearInterval(n)}},[t,e,a]),(0,m.useEffect)(()=>{if(!t)return;let s=!0,r=async()=>{try{let r=await t.teamInboxStatus(e);s&&g(r.unread)}catch{}};r();let n=setInterval(r,4e3);return()=>{s=!1,clearInterval(n)}},[t,e]);let v=(0,m.useMemo)(()=>(function(e){let t=e.split("\n"),s=[],r=null;for(let e of t){let t=e.match(/^### (\S+) — (.+)$/);t?(r&&s.push(r),r={ts:t[1],author:t[2].trim(),content:""}):r&&(r.content+=e+"\n")}return r&&s.push(r),s.map(e=>({...e,content:e.content.trim()}))})(o),[o]);return((0,m.useEffect)(()=>{if("discussion"!==a)return;let e=b.current;e&&(e.scrollTop=e.scrollHeight)},[v.length,a]),r)?(0,h.jsxs)("aside",{className:"w-[360px] shrink-0 border-l border-border bg-bg-panel flex flex-col min-h-0",children:[(0,h.jsxs)("div",{className:"px-4 py-3 border-b border-border flex items-center gap-3 shrink-0",children:[(0,h.jsx)(i9,{className:"h-4 w-4 text-accent"}),(0,h.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,h.jsx)("div",{className:"text-[12.5px] font-semibold truncate",children:r.name}),(0,h.jsxs)("div",{className:"text-[10.5px] text-fg-subtle",children:[r.members.length," members"]})]})]}),(0,h.jsx)("div",{className:"px-4 py-3 border-b border-border flex items-center gap-2 shrink-0 overflow-x-auto",children:r.members.map(e=>{let t,r=(t=s.find(t=>t.id===e),{name:t?.name??e,running:t?.running??!1});return(0,h.jsxs)("div",{title:`${r.name}${x.includes(e)?" — unread":""}`,className:"shrink-0 flex flex-col items-center gap-1",children:[(0,h.jsx)(cu,{id:e,online:r.running}),(0,h.jsx)("span",{className:i1("text-[9.5px] truncate max-w-[56px]",x.includes(e)?"text-accent font-medium":"text-fg-subtle"),children:e})]},e)})}),(0,h.jsx)("div",{className:"px-2 pt-2 flex items-center gap-1 shrink-0",children:[["discussion","Discussion",T],["state","State",T],["decisions","Decisions",co],["inboxes","Inboxes",cl]].map(([e,t,s])=>(0,h.jsxs)("button",{onClick:()=>i(e),className:i1("px-2.5 h-7 rounded-md text-[11px] inline-flex items-center gap-1.5 transition-colors",a===e?"bg-bg-selected text-fg":"text-fg-muted hover:text-fg hover:bg-bg-hover"),children:[(0,h.jsx)(s,{className:"h-3 w-3"}),t,"inboxes"===e&&x.length>0&&(0,h.jsx)("span",{className:"text-[9px] bg-accent text-bg-base rounded-full px-1.5",children:x.length})]},e))}),(0,h.jsxs)("div",{ref:b,className:"flex-1 overflow-y-auto px-3 py-3 min-h-0",children:["discussion"===a&&(0,h.jsx)(cm,{entries:v}),"state"===a&&(0,h.jsx)(cp,{content:c}),"decisions"===a&&(0,h.jsx)(cp,{content:u}),"inboxes"===a&&(0,h.jsx)(cx,{teamId:e,members:r.members,unread:x})]})]}):(0,h.jsx)("aside",{className:"w-[360px] shrink-0 border-l border-border bg-bg-panel flex items-center justify-center text-[12px] text-fg-subtle",children:"Loading team…"})}function cm({entries:e}){return 0===e.length?(0,h.jsx)("div",{className:"text-[11.5px] text-fg-subtle italic",children:"No team discussion yet. Send the first message in the chat to get the team going."}):(0,h.jsx)("div",{className:"space-y-3",children:e.map((e,t)=>{let s=cd(e.author);return(0,h.jsxs)("div",{className:"flex gap-2 items-start",children:[(0,h.jsx)(cu,{id:e.author}),(0,h.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,h.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,h.jsx)("span",{className:i1("text-[11px] font-semibold",s.text),children:e.author}),(0,h.jsx)("span",{className:"text-[9.5px] text-fg-subtle",children:function(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}(e.ts)})]}),(0,h.jsx)("div",{className:"text-[12px] text-fg whitespace-pre-wrap break-words mt-0.5",children:e.content})]})]},t)})})}function cp({content:e}){return(0,h.jsx)("pre",{className:"text-[11.5px] text-fg whitespace-pre-wrap break-words font-mono leading-[1.55]",children:e||"(empty)"})}function cx({teamId:e,members:t,unread:s}){let{api:r}=f(),[n,a]=(0,m.useState)(null),[i,o]=(0,m.useState)("");return(0,m.useEffect)(()=>{if(!r||!n)return void o("");let t=!0;return r.teamInbox(e,n).then(e=>{t&&o(e)}).catch(()=>{t&&o("")}),()=>{t=!1}},[r,e,n]),(0,h.jsx)("div",{className:"space-y-1.5",children:t.map(e=>{let t=s.includes(e),r=n===e;return(0,h.jsxs)("div",{className:"rounded-md bg-bg-elevated",children:[(0,h.jsxs)("button",{onClick:()=>a(r?null:e),className:"w-full flex items-center gap-2 px-2.5 h-8 text-left",children:[(0,h.jsx)(cu,{id:e}),(0,h.jsx)("span",{className:"text-[11.5px] font-medium flex-1",children:e}),t?(0,h.jsx)("span",{className:"text-[9.5px] text-accent font-medium",children:"unread"}):(0,h.jsx)("span",{className:"text-[9.5px] text-fg-subtle",children:"clear"})]}),r&&(0,h.jsx)("div",{className:"px-3 py-2 border-t border-border",children:(0,h.jsx)("pre",{className:"text-[11px] text-fg whitespace-pre-wrap break-words font-mono leading-[1.55]",children:i||"(empty)"})})]},e)})})}function cg(){let[e,t]=(0,m.useState)(()=>`dashboard-${Date.now()}`),[s,r]=(0,m.useState)(null),n=(0,m.useCallback)(()=>{t(`dashboard-${Date.now()}`),r(null)},[]),a=(0,m.useCallback)(e=>{t(`collab-${e}-${Date.now()}`),r(e)},[]);return(0,m.useEffect)(()=>{let e=()=>n(),t=e=>{let t=e.detail;a(t?.teamId??"default")};return window.addEventListener("camelagi:new-chat",e),window.addEventListener("camelagi:new-collab",t),()=>{window.removeEventListener("camelagi:new-chat",e),window.removeEventListener("camelagi:new-collab",t)}},[n,a]),(0,h.jsxs)("div",{className:"h-full flex min-h-0",children:[(0,h.jsx)("div",{className:"flex-1 min-w-0 flex flex-col",children:(0,h.jsx)(cn,{sessionId:e,hideProjectControls:!0})}),s&&(0,h.jsx)(ch,{teamId:s})]})}function cf({label:e,value:t,sub:s,icon:r,color:n}){return(0,h.jsxs)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-4",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,h.jsx)("span",{className:"text-xs opacity-70",children:e}),(0,h.jsx)(r,{className:`h-4 w-4 ${n}`})]}),(0,h.jsx)("p",{className:"text-2xl font-bold",children:t}),s&&(0,h.jsx)("p",{className:"text-xs opacity-50 mt-0.5",children:s})]})}function cb(){var e;let t,s,{api:r}=f(),[n,a]=(0,m.useState)(null),[i,o]=(0,m.useState)([]),[l,c]=(0,m.useState)([]);return(0,m.useEffect)(()=>{if(!r)return;let e=()=>{Promise.all([r.health(),r.sessions(),r.agents()]).then(([e,t,s])=>{a(e),o(t),c(s)}).catch(()=>{})};e();let t=setInterval(e,1e4);return()=>clearInterval(t)},[r]),(0,h.jsxs)("div",{className:"p-6 space-y-6",children:[(0,h.jsx)("h1",{className:"text-2xl font-bold",children:"Dashboard"}),(0,h.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[(0,h.jsx)(cf,{label:"Uptime",value:n?(t=Math.floor((e=n.uptime)/3600),s=Math.floor(e%3600/60),t>0?`${t}h ${s}m`:`${s}m`):"—",icon:$,color:"text-[#EC9639]"}),(0,h.jsx)(cf,{label:"Active Runs",value:n?.activeRuns??0,icon:T,color:"text-emerald-500"}),(0,h.jsx)(cf,{label:"Agents",value:l.length,sub:`${l.filter(e=>e.running).length} running`,icon:D,color:"text-blue-500"}),(0,h.jsx)(cf,{label:"Sessions",value:i.length,icon:V,color:"text-purple-500"})]}),n?.lanes&&(0,h.jsxs)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-4",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 mb-3 text-xs opacity-70",children:[(0,h.jsx)(ou,{className:"h-4 w-4"})," Concurrency Lanes"]}),(0,h.jsx)("div",{className:"grid grid-cols-3 gap-4",children:Object.entries(n.lanes).map(([e,t])=>(0,h.jsxs)("div",{className:"space-y-1.5",children:[(0,h.jsxs)("div",{className:"flex justify-between text-xs",children:[(0,h.jsx)("span",{className:"opacity-70 capitalize",children:e}),(0,h.jsxs)("span",{className:"opacity-50",children:[t.active,"/",t.limit]})]}),(0,h.jsx)("div",{className:"h-2 bg-[var(--border-color)] rounded-full overflow-hidden",children:(0,h.jsx)("div",{className:"h-full bg-[#EC9639] rounded-full transition-all",style:{width:`${t.active/t.limit*100}%`}})})]},e))})]}),(0,h.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,h.jsxs)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-4",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 mb-3 text-xs opacity-70",children:[(0,h.jsx)(D,{className:"h-4 w-4"})," Agents"]}),(0,h.jsxs)("div",{className:"space-y-1.5",children:[l.map(e=>(0,h.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 rounded-md bg-[var(--muted)]",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,h.jsx)("div",{className:`h-2 w-2 rounded-full ${e.running?"bg-emerald-500":"opacity-40"}`}),(0,h.jsxs)("div",{children:[(0,h.jsx)("p",{className:"text-sm font-medium",children:e.name}),(0,h.jsx)("p",{className:"text-[10px] opacity-50",children:e.model})]})]}),(0,h.jsxs)("div",{className:"flex gap-1.5",children:[e.telegram&&(0,h.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-[#2AABEE]/10 text-[#2AABEE]",children:"TG"}),"claude-code"===e.mode&&(0,h.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-[#EC9639]/10 text-[#EC9639]",children:"CC"})]})]},e.id)),0===l.length&&(0,h.jsx)("p",{className:"text-xs opacity-40 text-center py-4",children:"No agents"})]})]}),(0,h.jsxs)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-4",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 mb-3 text-xs opacity-70",children:[(0,h.jsx)(V,{className:"h-4 w-4"})," Recent Sessions"]}),(0,h.jsxs)("div",{className:"space-y-1",children:[i.slice(0,8).map(e=>(0,h.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 rounded-md hover:bg-[var(--muted)]",children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("p",{className:"text-sm",children:e.label??e.id}),(0,h.jsx)("p",{className:"text-[10px] opacity-50",children:e.model})]}),(0,h.jsx)("p",{className:"text-[10px] opacity-40",children:new Date(e.createdAt).toLocaleDateString()})]},e.id)),0===i.length&&(0,h.jsx)("p",{className:"text-xs opacity-40 text-center py-4",children:"No sessions"})]})]})]})]})}let cv=E("trash-2",[["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"}]]),cy=E("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);function cj(){let{api:e}=f(),[t,s]=(0,m.useState)([]),[r,n]=(0,m.useState)(!1),[a,i]=(0,m.useState)(null),[o,l]=(0,m.useState)(null),[c,d]=(0,m.useState)(null),[u,p]=(0,m.useState)(""),[x,g]=(0,m.useState)(""),[b,v]=(0,m.useState)("llm"),[y,j]=(0,m.useState)(""),[w,k]=(0,m.useState)(""),N=()=>{e?.agents().then(s).catch(()=>{})};(0,m.useEffect)(()=>{N()},[e]);let S=async()=>{if(!e||!x.trim())return;let t=x.toLowerCase().replace(/[^a-z0-9]+/g,"");await e.createAgent({id:t,name:x,model:y||void 0,telegramToken:w||void 0}),n(!1),g(""),v("llm"),j(""),k(""),N()},C=async t=>{if(!e||!u.trim())return;let s=u.toLowerCase().replace(/[^a-z0-9]+/g,"");await e.cloneAgent(t,s,u),d(null),p(""),N()},A=async t=>{e&&(await e.deleteAgent(t),l(null),N())},M=async t=>{if(!e)return;let s=await e.getAgentSoul(t);i({id:t,content:s})},P=async()=>{e&&a&&(await e.updateAgentSoul(a.id,a.content),i(null))};return(0,h.jsxs)("div",{className:"p-6 space-y-6",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsx)("h1",{className:"text-2xl font-bold",children:"Agents"}),(0,h.jsxs)("button",{onClick:()=>n(!r),className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-[#EC9639] text-white text-sm font-medium hover:bg-[#d07a20]",children:[(0,h.jsx)(i4,{className:"h-4 w-4"})," New Agent"]})]}),r&&(0,h.jsxs)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-5 space-y-4",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsx)("span",{className:"text-sm font-medium opacity-70",children:"Create Agent"}),(0,h.jsx)("button",{onClick:()=>n(!1),className:"opacity-40 hover:opacity-70",children:(0,h.jsx)(oi,{className:"h-4 w-4"})})]}),(0,h.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("label",{className:"block text-xs opacity-50 mb-1.5",children:"Name"}),(0,h.jsx)("input",{value:x,onChange:e=>g(e.target.value),placeholder:"My Agent",className:"w-full px-3 py-2 rounded-md bg-[var(--muted)] border border-[var(--border-color)] text-sm focus:outline-none focus:border-[#EC9639]"})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("label",{className:"block text-xs opacity-50 mb-1.5",children:"Mode"}),(0,h.jsxs)("select",{value:b,onChange:e=>v(e.target.value),className:"w-full px-3 py-2 rounded-md bg-[var(--muted)] border border-[var(--border-color)] text-sm focus:outline-none focus:border-[#EC9639]",children:[(0,h.jsx)("option",{value:"llm",children:"LLM (API-based)"}),(0,h.jsx)("option",{value:"claude-code",children:"Claude Code (local CLI)"})]})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("label",{className:"block text-xs opacity-50 mb-1.5",children:"Model (optional)"}),(0,h.jsx)("input",{value:y,onChange:e=>j(e.target.value),placeholder:"Uses default",className:"w-full px-3 py-2 rounded-md bg-[var(--muted)] border border-[var(--border-color)] text-sm placeholder:opacity-40 focus:outline-none focus:border-[#EC9639]"})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("label",{className:"block text-xs opacity-50 mb-1.5",children:"Telegram Token (optional)"}),(0,h.jsx)("input",{value:w,onChange:e=>k(e.target.value),placeholder:"From @BotFather",className:"w-full px-3 py-2 rounded-md bg-[var(--muted)] border border-[var(--border-color)] text-sm placeholder:opacity-40 focus:outline-none focus:border-[#EC9639]"})]})]}),(0,h.jsx)("button",{onClick:S,disabled:!x.trim(),className:"px-4 py-2 rounded-md bg-[#EC9639] text-white text-sm font-medium hover:bg-[#d07a20] disabled:opacity-50",children:"Create Agent"})]}),a&&(0,h.jsxs)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-5 space-y-3",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsxs)("span",{className:"text-sm font-medium opacity-70",children:["SOUL.md — ",a.id]}),(0,h.jsxs)("div",{className:"flex gap-2",children:[(0,h.jsxs)("button",{onClick:P,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md bg-[#EC9639] text-white text-xs hover:bg-[#d07a20]",children:[(0,h.jsx)(cy,{className:"h-3 w-3"})," Save"]}),(0,h.jsx)("button",{onClick:()=>i(null),className:"opacity-40 hover:opacity-70",children:(0,h.jsx)(oi,{className:"h-4 w-4"})})]})]}),(0,h.jsx)("textarea",{value:a.content,onChange:e=>i({...a,content:e.target.value}),rows:12,className:"w-full px-3 py-2 rounded-md bg-[var(--muted)] border border-[var(--border-color)] text-sm font-mono resize-y focus:outline-none focus:border-[#EC9639]"})]}),c&&(0,h.jsxs)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-5 space-y-3",children:[(0,h.jsxs)("span",{className:"text-sm font-medium opacity-70",children:["Clone agent: ",c]}),(0,h.jsx)("input",{value:u,onChange:e=>p(e.target.value),placeholder:"New agent name",className:"w-full px-3 py-2 rounded-lg bg-[var(--input-bg)] border border-[var(--border-color)] text-sm focus:outline-none focus:border-[#EC9639]"}),(0,h.jsxs)("div",{className:"flex gap-2",children:[(0,h.jsx)("button",{onClick:()=>C(c),disabled:!u.trim(),className:"px-3 py-1.5 rounded-lg bg-[#EC9639] text-white text-xs font-medium hover:bg-[#d07a20] disabled:opacity-50",children:"Clone"}),(0,h.jsx)("button",{onClick:()=>d(null),className:"px-3 py-1.5 rounded-lg opacity-50 hover:opacity-100 text-xs",children:"Cancel"})]})]}),(0,h.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:t.map(e=>(0,h.jsxs)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-4",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,h.jsx)("div",{className:`h-3 w-3 rounded-full ${e.running?"bg-emerald-500":"opacity-40"}`}),(0,h.jsx)("span",{className:"font-medium",children:e.name})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1",children:[e.admin&&(0,h.jsx)("span",{className:"text-[9px] px-2 py-0.5 rounded-full bg-[#EC9639]/10 text-[#EC9639]",children:"admin"}),(0,h.jsx)("button",{onClick:()=>M(e.id),className:"p-1.5 rounded hover:bg-[var(--hover)] opacity-40 hover:opacity-70",title:"Edit SOUL.md",children:(0,h.jsx)(R,{className:"h-3.5 w-3.5"})}),!e.admin&&(0,h.jsx)("button",{onClick:()=>d(e.id),className:"p-1.5 rounded hover:bg-[var(--hover)] opacity-40 hover:opacity-70",title:"Clone",children:(0,h.jsx)(ly,{className:"h-3.5 w-3.5"})}),!e.admin&&(o===e.id?(0,h.jsxs)("div",{className:"flex gap-1",children:[(0,h.jsx)("button",{onClick:()=>A(e.id),className:"px-2 py-1 rounded text-[10px] bg-red-500/10 text-red-400 hover:bg-red-500/20",children:"Delete"}),(0,h.jsx)("button",{onClick:()=>l(null),className:"px-2 py-1 rounded text-[10px] opacity-50 hover:bg-[var(--hover)]",children:"Cancel"})]}):(0,h.jsx)("button",{onClick:()=>l(e.id),className:"p-1.5 rounded hover:bg-red-500/10 opacity-40 hover:text-red-400",title:"Delete",children:(0,h.jsx)(cv,{className:"h-3.5 w-3.5"})}))]})]}),(0,h.jsx)("div",{className:"space-y-1.5 text-sm",children:[["ID",e.id],["Model",e.model],["Mode",e.mode??"llm"],["Telegram",e.telegram?"Connected":"—"],["Status",e.running?"Running":"Stopped"]].map(([e,t])=>(0,h.jsxs)("div",{className:"flex justify-between",children:[(0,h.jsx)("span",{className:"opacity-50",children:e}),(0,h.jsx)("span",{className:`opacity-70 ${"Status"===e&&"Running"===t?"text-emerald-500 !opacity-100":""}`,children:t})]},e))})]},e.id))})]})}let cw=E("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);function ck(){let{api:e}=f(),[t,s]=(0,m.useState)([]),[r,n]=(0,m.useState)(null),[a,i]=(0,m.useState)([]);(0,m.useEffect)(()=>{e?.sessions().then(s).catch(()=>{})},[e]);let o=async t=>{e&&(n(t),i(await e.sessionMessages(t)))},l=async t=>{e&&(await e.deleteSession(t),s(e=>e.filter(e=>e.id!==t)),r===t&&(n(null),i([])))};return(0,h.jsxs)("div",{className:"flex h-full",children:[(0,h.jsxs)("div",{className:"w-72 border-r border-[var(--border-color)] overflow-auto shrink-0",children:[(0,h.jsx)("div",{className:"p-4 border-b border-[var(--border-color)]",children:(0,h.jsxs)("span",{className:"text-sm opacity-70",children:["Sessions (",t.length,")"]})}),(0,h.jsx)("div",{className:"p-2 space-y-0.5",children:t.map(t=>(0,h.jsxs)("div",{onClick:()=>o(t.id),className:`flex items-center justify-between px-3 py-2 rounded-md cursor-pointer ${r===t.id?"bg-[#EC9639]/10 text-[#EC9639]":"opacity-70 hover:bg-[var(--hover)]"}`,children:[(0,h.jsxs)("div",{className:"min-w-0",children:[(0,h.jsx)("p",{className:"text-sm truncate",children:t.label??t.id}),(0,h.jsx)("p",{className:"text-[10px] opacity-40",children:t.model})]}),(0,h.jsx)("button",{onClick:e=>{e.stopPropagation(),l(t.id)},className:"p-1 rounded hover:bg-red-500/10 opacity-40 hover:text-red-500",children:(0,h.jsx)(cv,{className:"h-3 w-3"})}),(0,h.jsx)("a",{href:e?.exportSessionUrl(t.id)??"#",download:!0,className:"p-1 rounded hover:bg-[#EC9639]/10 opacity-40 hover:text-[#EC9639] hover:opacity-100",title:"Export as markdown",onClick:e=>e.stopPropagation(),children:(0,h.jsx)(cw,{className:"h-3 w-3"})})]},t.id))})]}),(0,h.jsx)("div",{className:"flex-1 overflow-auto p-6",children:r?(0,h.jsx)("div",{className:"space-y-3 max-w-3xl mx-auto",children:a.map((e,t)=>(0,h.jsx)("div",{className:`flex ${"user"===e.role?"justify-end":"justify-start"}`,children:(0,h.jsx)("div",{className:`max-w-[80%] px-4 py-2.5 rounded-2xl text-sm whitespace-pre-wrap ${"user"===e.role?"bg-[#EC9639] text-white rounded-br-sm":"tool"===e.role?"bg-[var(--tool-bg)] opacity-70 font-mono text-xs border border-[var(--border-color)]":"bg-[var(--card)] text-[var(--fg)] rounded-bl-sm border border-[var(--border-color)]"}`,children:e.content})},t))}):(0,h.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,h.jsxs)("div",{className:"text-center",children:[(0,h.jsx)(_,{className:"h-12 w-12 opacity-40 mx-auto mb-3"}),(0,h.jsx)("p",{className:"text-sm opacity-50",children:"Select a session"})]})})})]})}let cN=[{key:"model",label:"Model",type:"text"},{key:"provider",label:"Provider",type:"select",options:["anthropic","openai"]},{key:"thinking",label:"Thinking",type:"select",options:["off","low","medium","high"]},{key:"effort",label:"Effort",type:"select",options:["low","medium","high","max"]},{key:"maxTurns",label:"Max Turns",type:"number"},{key:"timeoutSeconds",label:"Timeout (sec)",type:"number"},{key:"systemPrompt",label:"System Prompt",type:"textarea"}];function cS(){let{api:e}=f(),[t,s]=(0,m.useState)(null),[r,n]=(0,m.useState)(!1),[a,i]=(0,m.useState)(!1),[o,l]=(0,m.useState)(""),[c,d]=(0,m.useState)(!1);(0,m.useEffect)(()=>{e?.getConfig().then(s).catch(()=>{})},[e]);let u=(e,r)=>{t&&s({...t,[e]:r})},p=t?.sdk??"claude",x=t?.cursor??{},g=async()=>{if(!e||!t)return;n(!0);let s={sdk:p,cursor:{model:x.model}};for(let e of cN)s[e.key]=t[e.key];await e.updateConfig(s),n(!1),i(!0),setTimeout(()=>i(!1),2e3)},b=async()=>{if(e){d(!0);try{await e.setCursorKey(o||null),l("");let t=await e.getConfig();s(t)}finally{d(!1)}}};return t?(0,h.jsxs)("div",{className:"p-6 space-y-6 max-w-2xl",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsx)("h1",{className:"text-2xl font-bold",children:"Configuration"}),(0,h.jsx)("button",{onClick:g,disabled:r,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-[#EC9639] text-white text-sm font-medium hover:bg-[#d07a20] disabled:opacity-50",children:a?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(oo,{className:"h-4 w-4"})," Saved"]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(cy,{className:"h-4 w-4"})," ",r?"Saving...":"Save"]})})]}),(0,h.jsxs)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-5 space-y-4",children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("div",{className:"text-sm font-medium mb-1",children:"Agent Runtime"}),(0,h.jsxs)("div",{className:"text-xs opacity-50 mb-3",children:["Which SDK runs your agent. Cursor mode uses ",(0,h.jsx)("code",{children:"@cursor/sdk"})," and Cursor models (e.g. composer-2); in-process custom tools (memory, patch, cron, team) and programmatic approval hooks are not available there."]}),(0,h.jsx)("div",{className:"inline-flex rounded-lg border border-[var(--border-color)] overflow-hidden",children:["claude","cursor"].map(e=>(0,h.jsx)("button",{onClick:()=>u("sdk",e),className:`px-4 py-1.5 text-sm transition-colors ${p===e?"bg-[#EC9639] text-white":"bg-[var(--input-bg)] hover:opacity-80"}`,children:"claude"===e?"Claude Agent SDK":"Cursor SDK"},e))})]}),"cursor"===p&&(0,h.jsxs)("div",{className:"space-y-4 pt-2 border-t border-[var(--border-color)]",children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("label",{className:"block text-xs opacity-50 mb-1.5",children:"Cursor Model"}),(0,h.jsx)("input",{value:String(x.model??""),placeholder:"composer-2",onChange:e=>u("cursor",{...x,model:e.target.value}),className:"w-full px-3 py-2 rounded-lg bg-[var(--input-bg)] border border-[var(--border-color)] text-sm focus:outline-none focus:border-[#EC9639]"}),(0,h.jsx)("div",{className:"text-xs opacity-40 mt-1",children:"Falls back to the top-level Model field if blank."})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("label",{className:"block text-xs opacity-50 mb-1.5",children:"Cursor API Key"}),(0,h.jsxs)("div",{className:"flex gap-2",children:[(0,h.jsx)("input",{type:"password",value:o,placeholder:x.apiKey?`Current: ${x.apiKey}`:"Not set",onChange:e=>l(e.target.value),className:"flex-1 px-3 py-2 rounded-lg bg-[var(--input-bg)] border border-[var(--border-color)] text-sm placeholder:opacity-40 focus:outline-none focus:border-[#EC9639]"}),(0,h.jsx)("button",{onClick:b,disabled:c,className:"px-3 py-2 rounded-lg bg-[var(--input-bg)] border border-[var(--border-color)] text-sm hover:opacity-80 disabled:opacity-50",children:c?"Saving...":o?"Save Key":"Clear"})]})]})]})]}),(0,h.jsx)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-5 space-y-5",children:cN.map(e=>(0,h.jsxs)("div",{children:[(0,h.jsx)("label",{className:"block text-xs opacity-50 mb-1.5",children:e.label}),"textarea"===e.type?(0,h.jsx)("textarea",{value:String(t[e.key]??""),onChange:t=>u(e.key,t.target.value),rows:4,className:"w-full px-3 py-2 rounded-lg bg-[var(--input-bg)] border border-[var(--border-color)] text-sm focus:outline-none focus:border-[#EC9639] resize-y font-mono"}):"select"===e.type?(0,h.jsx)("select",{value:String(t[e.key]??""),onChange:t=>u(e.key,t.target.value),className:"w-full px-3 py-2 rounded-lg bg-[var(--input-bg)] border border-[var(--border-color)] text-sm focus:outline-none focus:border-[#EC9639]",children:e.options.map(e=>(0,h.jsx)("option",{value:e,children:e},e))}):"number"===e.type?(0,h.jsx)("input",{type:"number",value:Number(t[e.key]??0),onChange:t=>u(e.key,Number(t.target.value)),className:"w-full px-3 py-2 rounded-lg bg-[var(--input-bg)] border border-[var(--border-color)] text-sm focus:outline-none focus:border-[#EC9639]"}):(0,h.jsx)("input",{value:String(t[e.key]??""),onChange:t=>u(e.key,t.target.value),className:"w-full px-3 py-2 rounded-lg bg-[var(--input-bg)] border border-[var(--border-color)] text-sm focus:outline-none focus:border-[#EC9639]"})]},e.key))}),(0,h.jsxs)("details",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)]",children:[(0,h.jsx)("summary",{className:"px-5 py-3 text-xs opacity-50 cursor-pointer hover:opacity-70",children:"Raw JSON"}),(0,h.jsx)("pre",{className:"px-5 py-3 text-xs opacity-50 font-mono whitespace-pre-wrap overflow-auto max-h-[400px] border-t border-[var(--border-color)]",children:JSON.stringify(t,null,2)})]})]}):(0,h.jsx)("div",{className:"flex items-center justify-center h-full opacity-50",children:"Loading..."})}function cC(){let{ws:e}=f(),[t,s]=(0,m.useState)([]),[r,n]=(0,m.useState)(null);return(0,m.useEffect)(()=>{if(!e)return;e.enterWatchMode();let t=e.on("watch.snapshot",e=>n(e)),r=e.on("*",e=>{let t=e._event??"";t.startsWith("watch.")&&"watch.snapshot"!==t&&s(s=>[{...e,type:t,ts:Date.now()},...s].slice(0,100))});return()=>{t(),r()}},[e]),(0,h.jsxs)("div",{className:"p-6 space-y-6",children:[(0,h.jsx)("h1",{className:"text-2xl font-bold",children:"Live Monitor"}),r&&(0,h.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[["Clients",r.clients],["Watchers",r.watchers],["Active Runs",r.activeRuns],["Model",r.model]].map(([e,t])=>(0,h.jsxs)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-4",children:[(0,h.jsx)("p",{className:"text-xs opacity-50",children:String(e)}),(0,h.jsx)("p",{className:"text-lg font-bold",children:String(t??"—")})]},String(e)))}),(0,h.jsxs)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-4",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 mb-3 text-xs opacity-70",children:[(0,h.jsx)(T,{className:"h-4 w-4"})," Event Feed"]}),(0,h.jsxs)("div",{className:"space-y-1 max-h-[500px] overflow-auto font-mono text-xs",children:[0===t.length&&(0,h.jsx)("p",{className:"opacity-40 text-center py-8",children:"Waiting for events..."}),t.map((e,t)=>(0,h.jsxs)("div",{className:"flex items-start gap-3 px-2 py-1.5 rounded hover:bg-[var(--muted)]",children:[(0,h.jsx)("span",{className:"opacity-40 shrink-0",children:new Date(e.ts).toLocaleTimeString()}),(0,h.jsx)("span",{className:"text-[#EC9639] shrink-0",children:e.type}),(0,h.jsx)("span",{className:"opacity-50 truncate",children:JSON.stringify(e)})]},t))]})]})]})}function cA(){let{url:e,token:t,setConnection:s,connected:r}=f(),[n,a]=(0,m.useState)(e),[i,o]=(0,m.useState)(t);return(0,h.jsxs)("div",{className:"p-6 space-y-6 max-w-xl",children:[(0,h.jsx)("h1",{className:"text-2xl font-bold",children:"Settings"}),(0,h.jsxs)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-5 space-y-4",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 text-sm opacity-70",children:[(0,h.jsx)(O,{className:"h-4 w-4"})," Gateway Connection"]}),(0,h.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,h.jsx)("div",{className:`h-2 w-2 rounded-full ${r?"bg-emerald-500":"bg-red-500"}`}),(0,h.jsx)("span",{className:"opacity-50",children:r?"Connected":"Disconnected"})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("label",{className:"block text-xs opacity-50 mb-1.5",children:"Gateway URL"}),(0,h.jsx)("input",{value:n,onChange:e=>a(e.target.value),className:"w-full px-3 py-2 rounded-md bg-[var(--muted)] border border-[var(--border-color)] text-sm focus:outline-none focus:border-[#EC9639]"})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("label",{className:"block text-xs opacity-50 mb-1.5",children:"Auth Token (optional)"}),(0,h.jsx)("input",{type:"password",value:i,onChange:e=>o(e.target.value),placeholder:"Only needed if serve.token is set",className:"w-full px-3 py-2 rounded-md bg-[var(--muted)] border border-[var(--border-color)] text-sm placeholder:opacity-40 focus:outline-none focus:border-[#EC9639]"})]}),(0,h.jsx)("button",{onClick:()=>s(n,i),className:"px-4 py-2 rounded-md bg-[#EC9639] text-white text-sm font-medium hover:bg-[#d07a20] transition-colors",children:"Save & Reconnect"})]})]})}function cM(){let{api:e}=f(),[t,s]=(0,m.useState)([]);return(0,m.useEffect)(()=>{e?.getCronJobs().then(s).catch(()=>{})},[e]),(0,h.jsxs)("div",{className:"p-6 space-y-6",children:[(0,h.jsx)("h1",{className:"text-2xl font-bold",children:"Cron Jobs"}),(0,h.jsxs)("div",{className:"space-y-3",children:[Array.isArray(t)&&t.map((e,t)=>(0,h.jsxs)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-4",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)($,{className:"h-4 w-4 text-[#EC9639]"}),(0,h.jsx)("span",{className:"font-medium text-sm",children:String(e.name||e.id||`Job ${t+1}`)})]}),(0,h.jsx)("span",{className:`text-[10px] px-2 py-0.5 rounded-full ${!1!==e.enabled?"bg-emerald-500/10 text-emerald-500":"opacity-40"}`,children:!1!==e.enabled?"Active":"Disabled"})]}),(0,h.jsxs)("div",{className:"space-y-1 text-sm",children:[e.schedule?(0,h.jsxs)("div",{className:"flex justify-between",children:[(0,h.jsx)("span",{className:"opacity-50",children:"Schedule"}),(0,h.jsx)("span",{className:"opacity-70 font-mono text-xs",children:String(e.schedule)})]}):null,e.prompt?(0,h.jsxs)("div",{className:"flex justify-between",children:[(0,h.jsx)("span",{className:"opacity-50",children:"Prompt"}),(0,h.jsx)("span",{className:"opacity-70 truncate ml-4 max-w-[300px]",children:String(e.prompt).slice(0,80)})]}):null,e.source?(0,h.jsxs)("div",{className:"flex justify-between",children:[(0,h.jsx)("span",{className:"opacity-50",children:"Source"}),(0,h.jsx)("span",{className:"opacity-70",children:String(e.source)})]}):null,e.lastRunAt?(0,h.jsxs)("div",{className:"flex justify-between",children:[(0,h.jsx)("span",{className:"opacity-50",children:"Last run"}),(0,h.jsx)("span",{className:"opacity-70",children:new Date(e.lastRunAt).toLocaleString()})]}):null]})]},t)),0===t.length&&(0,h.jsx)("p",{className:"text-center opacity-40 py-8",children:"No cron jobs configured"})]})]})}function cP(){let{api:e}=f(),[t,s]=(0,m.useState)([]);return(0,m.useEffect)(()=>{e?.getSkills().then(s).catch(()=>{})},[e]),(0,h.jsxs)("div",{className:"p-6 space-y-6",children:[(0,h.jsx)("h1",{className:"text-2xl font-bold",children:"Skills"}),(0,h.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map(e=>(0,h.jsxs)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-4 flex items-center gap-3",children:[(0,h.jsx)(q,{className:"h-4 w-4 text-[#EC9639] shrink-0"}),(0,h.jsx)("span",{className:"text-sm",children:e})]},e))}),0===t.length&&(0,h.jsx)("p",{className:"text-center opacity-40 py-8",children:"No skills installed. Add skills to ~/.camelagi/skills/"})]})}let cE=E("user-check",[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),cT=E("user-x",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]),cD=E("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);function c$(){let{api:e}=f(),[t,s]=(0,m.useState)([]),[r,n]=(0,m.useState)([]),[a,i]=(0,m.useState)(!1),o=async()=>{if(e){i(!0);try{let[t,r]=await Promise.all([e.getPairingRequests(),e.getBotApprovals()]);s(t),n(r)}catch{}i(!1)}};(0,m.useEffect)(()=>{e&&o()},[e]);let l=async(t,s)=>{if(e){try{"approve"===s?await e.approvePairing(t):await e.denyPairing(t)}catch{}o()}},c=async(t,s)=>{if(e){try{"approve"===s?await e.approveBotApproval(t):await e.denyBotApproval(t)}catch{}o()}},d=e=>{let t=Math.floor((Date.now()-e)/1e3);return t<60?"Just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`};return(0,h.jsxs)("div",{className:"p-6 space-y-6",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsx)("h1",{className:"text-2xl font-bold",children:"Approvals"}),(0,h.jsx)("button",{onClick:o,disabled:a,className:"p-2 rounded-lg hover:bg-[var(--hover)] opacity-50 hover:opacity-100 transition-opacity",children:(0,h.jsx)(cD,{className:`h-4 w-4 ${a?"animate-spin":""}`})})]}),r.length>0&&(0,h.jsxs)("div",{className:"space-y-3",children:[(0,h.jsx)("h2",{className:"text-sm font-semibold opacity-60 uppercase tracking-wider",children:"Bot Connections"}),r.map(e=>(0,h.jsx)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-4",children:(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsxs)("div",{className:"flex items-center gap-3",children:[(0,h.jsx)(D,{className:"h-4 w-4 text-blue-500"}),(0,h.jsxs)("div",{children:[(0,h.jsx)("p",{className:"text-sm font-medium",children:e.agentId}),(0,h.jsxs)("p",{className:"text-xs opacity-40",children:[e.botUsername?`@${e.botUsername}`:"New bot"," · ",d(e.requestedAt)]})]})]}),(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)("button",{onClick:()=>c(e.agentId,"approve"),className:"p-1.5 rounded-lg bg-emerald-500/10 text-emerald-500 hover:bg-emerald-500/20",title:"Approve & Start Bot",children:(0,h.jsx)(cE,{className:"h-3.5 w-3.5"})}),(0,h.jsx)("button",{onClick:()=>c(e.agentId,"deny"),className:"p-1.5 rounded-lg bg-red-500/10 text-red-500 hover:bg-red-500/20",title:"Deny",children:(0,h.jsx)(cT,{className:"h-3.5 w-3.5"})})]})]})},e.agentId))]}),(0,h.jsxs)("div",{className:"space-y-3",children:[r.length>0&&(0,h.jsx)("h2",{className:"text-sm font-semibold opacity-60 uppercase tracking-wider",children:"User Access"}),t.map(e=>(0,h.jsx)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-4",children:(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsxs)("div",{className:"flex items-center gap-3",children:[(0,h.jsx)(B,{className:"h-4 w-4 text-[#EC9639]"}),(0,h.jsxs)("div",{children:[(0,h.jsx)("p",{className:"text-sm font-medium",children:e.username?`@${e.username}`:e.firstName??String(e.userId)}),(0,h.jsxs)("p",{className:"text-xs opacity-40",children:["Agent: ",e.agentId," · Code: ",e.code," · ",d(e.createdAt)]})]})]}),(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)("span",{className:`text-[10px] px-2 py-0.5 rounded-full ${"pending"===e.status?"bg-yellow-500/10 text-yellow-500":"completed"===e.status?"bg-emerald-500/10 text-emerald-500":"opacity-40"}`,children:e.status}),"pending"===e.status&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("button",{onClick:()=>l(e.code,"approve"),className:"p-1.5 rounded-lg bg-emerald-500/10 text-emerald-500 hover:bg-emerald-500/20",title:"Approve",children:(0,h.jsx)(cE,{className:"h-3.5 w-3.5"})}),(0,h.jsx)("button",{onClick:()=>l(e.code,"deny"),className:"p-1.5 rounded-lg bg-red-500/10 text-red-500 hover:bg-red-500/20",title:"Deny",children:(0,h.jsx)(cT,{className:"h-3.5 w-3.5"})})]})]})]})},e.code)),0===t.length&&0===r.length&&(0,h.jsx)("p",{className:"text-center opacity-40 py-8",children:"No pending approvals"})]})]})}let cR=["SOUL.md","TOOLS.md","MEMORY.md","HEARTBEAT.md"];function c_(){let{api:e}=f(),[t,s]=(0,m.useState)([]),[r,n]=(0,m.useState)(""),[a,i]=(0,m.useState)("SOUL.md"),[o,l]=(0,m.useState)(""),[c,d]=(0,m.useState)(!1),[u,p]=(0,m.useState)(!1),[x,g]=(0,m.useState)([]);(0,m.useEffect)(()=>{e?.agents().then(e=>{s(e);let t=e.find(e=>!e.admin)??e[0];t&&n(t.id)}).catch(()=>{})},[e]),(0,m.useEffect)(()=>{e&&r&&(e.getWorkspaceFile(r,a).then(l).catch(()=>l("")),e.getMemoryNotes(r).then(g).catch(()=>g([])))},[e,r,a]);let b=async()=>{e&&r&&(d(!0),await e.updateWorkspaceFile(r,a,o),d(!1),p(!0),setTimeout(()=>p(!1),2e3))};return(0,h.jsxs)("div",{className:"flex h-full",children:[(0,h.jsxs)("div",{className:"w-56 shrink-0 border-r border-[var(--border-color)] flex flex-col",children:[(0,h.jsxs)("div",{className:"p-3 border-b border-[var(--border-color)]",children:[(0,h.jsx)("label",{className:"block text-[10px] opacity-40 uppercase tracking-wider mb-1.5",children:"Agent"}),(0,h.jsx)("select",{value:r,onChange:e=>n(e.target.value),className:"w-full px-2.5 py-1.5 rounded-lg bg-[var(--input-bg)] border border-[var(--border-color)] text-sm focus:outline-none focus:border-[#EC9639]",children:t.map(e=>(0,h.jsx)("option",{value:e.id,children:e.name},e.id))})]}),(0,h.jsxs)("div",{className:"p-2 space-y-0.5",children:[(0,h.jsx)("p",{className:"px-2 py-1 text-[10px] opacity-40 uppercase tracking-wider",children:"Files"}),cR.map(e=>(0,h.jsxs)("button",{onClick:()=>i(e),className:`w-full text-left flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors ${a===e?"bg-[#EC9639]/10 text-[#EC9639] font-medium":"opacity-60 hover:opacity-100 hover:bg-[var(--hover)]"}`,children:[(0,h.jsx)(R,{className:"h-3.5 w-3.5"})," ",e]},e)),x.length>0&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("p",{className:"px-2 py-1 mt-3 text-[10px] opacity-40 uppercase tracking-wider",children:"Daily Notes"}),x.slice(0,7).map(e=>(0,h.jsx)("button",{onClick:()=>{i(e.name),l(e.content)},className:`w-full text-left flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors ${a===e.name?"bg-[#EC9639]/10 text-[#EC9639]":"opacity-50 hover:opacity-100 hover:bg-[var(--hover)]"}`,children:e.name},e.name))]})]})]}),(0,h.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,h.jsxs)("div",{className:"px-5 py-3 border-b border-[var(--border-color)] flex items-center justify-between",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)(R,{className:"h-4 w-4 text-[#EC9639]"}),(0,h.jsx)("span",{className:"text-sm font-medium",children:a}),(0,h.jsxs)("span",{className:"text-xs opacity-40",children:["(",r,")"]})]}),cR.includes(a)&&(0,h.jsx)("button",{onClick:b,disabled:c,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-[#EC9639] text-white text-xs font-medium hover:bg-[#d07a20] disabled:opacity-50",children:u?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(oo,{className:"h-3 w-3"})," Saved"]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(cy,{className:"h-3 w-3"})," Save"]})})]}),(0,h.jsx)("textarea",{value:o,onChange:e=>l(e.target.value),readOnly:!cR.includes(a),className:"flex-1 p-5 bg-transparent text-sm font-mono resize-none focus:outline-none leading-relaxed",placeholder:`${a} content...`})]})]})}function cF(){let{api:e}=f(),[t,s]=(0,m.useState)(!1),[r,n]=(0,m.useState)("groq"),[a,i]=(0,m.useState)(""),[o,l]=(0,m.useState)(""),[c,d]=(0,m.useState)(""),[u,p]=(0,m.useState)(!1),[x,g]=(0,m.useState)(!1);(0,m.useEffect)(()=>{e?.getConfig().then(e=>{let t=e.voice;t&&(s(!!t.enabled),n(String(t.provider??"groq")),i(String(t.apiKey??"")),l(String(t.model??"")),d(String(t.language??"")))}).catch(()=>{})},[e]);let b=async()=>{e&&(p(!0),await e.updateConfig({voice:{enabled:t,provider:r,apiKey:a||void 0,model:o||void 0,language:c||void 0}}),p(!1),g(!0),setTimeout(()=>g(!1),2e3))};return(0,h.jsxs)("div",{className:"p-6 space-y-6 max-w-xl",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsx)("h1",{className:"text-2xl font-bold",children:"Voice Transcription"}),(0,h.jsx)("button",{onClick:b,disabled:u,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-[#EC9639] text-white text-sm font-medium hover:bg-[#d07a20] disabled:opacity-50",children:x?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(oo,{className:"h-4 w-4"})," Saved"]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(cy,{className:"h-4 w-4"})," ",u?"Saving...":"Save"]})})]}),(0,h.jsxs)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-5 space-y-5",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)(I,{className:"h-4 w-4 text-[#EC9639]"}),(0,h.jsx)("span",{className:"text-sm font-medium",children:"Enable Voice"})]}),(0,h.jsx)("button",{onClick:()=>s(!t),className:`relative w-10 h-5 rounded-full transition-colors ${t?"bg-[#EC9639]":"bg-[var(--border-color)]"}`,children:(0,h.jsx)("span",{className:`absolute top-0.5 h-4 w-4 rounded-full bg-white transition-transform ${t?"left-5.5 translate-x-0":"left-0.5"}`,style:{left:t?"22px":"2px"}})})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("label",{className:"block text-xs opacity-50 mb-1.5",children:"Provider"}),(0,h.jsxs)("select",{value:r,onChange:e=>n(e.target.value),className:"w-full px-3 py-2 rounded-lg bg-[var(--input-bg)] border border-[var(--border-color)] text-sm focus:outline-none focus:border-[#EC9639]",children:[(0,h.jsx)("option",{value:"groq",children:"Groq (free)"}),(0,h.jsx)("option",{value:"openai",children:"OpenAI Whisper"}),(0,h.jsx)("option",{value:"deepgram",children:"Deepgram"})]})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("label",{className:"block text-xs opacity-50 mb-1.5",children:"API Key"}),(0,h.jsx)("input",{type:"password",value:a,onChange:e=>i(e.target.value),placeholder:`${r} API key`,className:"w-full px-3 py-2 rounded-lg bg-[var(--input-bg)] border border-[var(--border-color)] text-sm placeholder:opacity-30 focus:outline-none focus:border-[#EC9639]"})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("label",{className:"block text-xs opacity-50 mb-1.5",children:"Model (optional)"}),(0,h.jsx)("input",{value:o,onChange:e=>l(e.target.value),placeholder:"Default model",className:"w-full px-3 py-2 rounded-lg bg-[var(--input-bg)] border border-[var(--border-color)] text-sm placeholder:opacity-30 focus:outline-none focus:border-[#EC9639]"})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("label",{className:"block text-xs opacity-50 mb-1.5",children:"Language (optional)"}),(0,h.jsx)("input",{value:c,onChange:e=>d(e.target.value),placeholder:"e.g. en, ar, es",className:"w-full px-3 py-2 rounded-lg bg-[var(--input-bg)] border border-[var(--border-color)] text-sm placeholder:opacity-30 focus:outline-none focus:border-[#EC9639]"})]})]})]})}let cV=E("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);function cI(){let{api:e}=f(),[t,s]=(0,m.useState)(null);(0,m.useEffect)(()=>{e?.getMcpServers().then(s).catch(()=>{})},[e]);let r=(e,t)=>(0,h.jsxs)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-4",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,h.jsx)(cV,{className:"h-4 w-4 text-[#EC9639]"}),(0,h.jsx)("span",{className:"font-medium text-sm",children:e}),(0,h.jsx)("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-[#EC9639]/10 text-[#EC9639]",children:String(t.type??"stdio")})]}),(0,h.jsxs)("div",{className:"space-y-1 text-xs",children:[t.command?(0,h.jsxs)("div",{className:"flex gap-2",children:[(0,h.jsx)("span",{className:"opacity-40",children:"Command"}),(0,h.jsxs)("span",{className:"opacity-70 font-mono",children:[String(t.command)," ",Array.isArray(t.args)?t.args.join(" "):""]})]}):null,t.url?(0,h.jsxs)("div",{className:"flex gap-2",children:[(0,h.jsx)("span",{className:"opacity-40",children:"URL"}),(0,h.jsx)("span",{className:"opacity-70 font-mono truncate",children:String(t.url)})]}):null]})]},e);return t?(0,h.jsxs)("div",{className:"p-6 space-y-6",children:[(0,h.jsx)("h1",{className:"text-2xl font-bold",children:"MCP Servers"}),(0,h.jsxs)("div",{children:[(0,h.jsxs)("h2",{className:"text-sm font-medium opacity-70 mb-3 flex items-center gap-2",children:[(0,h.jsx)(L,{className:"h-4 w-4"})," Global"]}),(0,h.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[Object.entries(t.global).map(([e,t])=>r(e,t)),0===Object.keys(t.global).length&&(0,h.jsx)("p",{className:"opacity-40 text-sm",children:"No global MCP servers"})]})]}),Object.entries(t.perAgent).map(([e,t])=>(0,h.jsxs)("div",{children:[(0,h.jsxs)("h2",{className:"text-sm font-medium opacity-70 mb-3",children:["Agent: ",e]}),(0,h.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Object.entries(t).map(([e,t])=>r(e,t))})]},e))]}):(0,h.jsx)("div",{className:"flex items-center justify-center h-full opacity-50",children:"Loading..."})}function cL(){let{api:e}=f(),[t,s]=(0,m.useState)([]);return(0,m.useEffect)(()=>{e?.getChannels().then(s).catch(()=>{})},[e]),(0,h.jsxs)("div",{className:"p-6 space-y-6",children:[(0,h.jsx)("h1",{className:"text-2xl font-bold",children:"Channels"}),(0,h.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[t.map(e=>(0,h.jsxs)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-4",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,h.jsx)("div",{className:`h-3 w-3 rounded-full ${e.running?"bg-emerald-500":"bg-red-500"}`}),(0,h.jsx)("span",{className:"font-medium text-sm",children:e.name})]}),(0,h.jsx)("span",{className:`text-[10px] px-2 py-0.5 rounded-full font-medium ${"telegram"===e.type?"bg-[#2AABEE]/10 text-[#2AABEE]":"bg-[#5865F2]/10 text-[#5865F2]"}`,children:e.type})]}),(0,h.jsxs)("div",{className:"space-y-1 text-sm",children:[(0,h.jsxs)("div",{className:"flex justify-between",children:[(0,h.jsx)("span",{className:"opacity-50",children:"Agent"}),(0,h.jsx)("span",{className:"opacity-70",children:e.id})]}),(0,h.jsxs)("div",{className:"flex justify-between",children:[(0,h.jsx)("span",{className:"opacity-50",children:"Status"}),(0,h.jsx)("span",{className:e.running?"text-emerald-500":"text-red-500",children:e.running?"Running":"Stopped"})]})]})]},`${e.id}-${e.type}`)),0===t.length&&(0,h.jsx)("p",{className:"opacity-40 py-8 col-span-full text-center",children:"No channels configured. Add Telegram/Discord tokens to agent config."})]})]})}function cU(){let{api:e}=f(),[t,s]=(0,m.useState)([]),r=()=>{e?.getLogs().then(s).catch(()=>{})};return(0,m.useEffect)(()=>{r();let e=setInterval(r,5e3);return()=>clearInterval(e)},[e]),(0,h.jsxs)("div",{className:"p-6 space-y-4",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsx)("h1",{className:"text-2xl font-bold",children:"Logs"}),(0,h.jsx)("button",{onClick:r,className:"p-2 rounded-lg hover:bg-[var(--hover)] opacity-50 hover:opacity-100",title:"Refresh",children:(0,h.jsx)(cD,{className:"h-4 w-4"})})]}),(0,h.jsx)("div",{className:"rounded-xl border border-[var(--border-color)] bg-[var(--card)] p-4 max-h-[600px] overflow-auto",children:(0,h.jsxs)("div",{className:"space-y-0.5 font-mono text-xs",children:[0===t.length&&(0,h.jsx)("p",{className:"opacity-40 text-center py-8",children:"No logs yet"}),t.map((e,t)=>(0,h.jsx)("div",{className:"py-0.5 opacity-60 hover:opacity-100 transition-opacity",children:e},t))]})})]})}function cz(){let{connected:e,error:t,url:s,setConnection:r}=f(),{route:n}=N(),{railCollapsed:a,toggleRail:i}=ee();return(0,m.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&("b"===e.key||"B"===e.key)&&(e.preventDefault(),i())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[i]),(0,h.jsxs)("div",{className:"flex h-screen bg-bg-base",children:[(0,h.jsx)(o_,{}),a&&(0,h.jsx)("button",{onClick:i,title:"Show sidebar (⌘B)",className:"fixed top-3 left-3 z-50 w-8 h-8 rounded-md bg-bg-panel shadow-elevated flex items-center justify-center text-fg-muted hover:text-fg hover:bg-bg-hover transition-colors",children:(0,h.jsx)(ei,{className:"h-4 w-4"})}),(0,h.jsxs)("main",{className:"flex-1 min-w-0 flex flex-col bg-bg-main overflow-hidden",style:{borderTopLeftRadius:14*!a,boxShadow:"-4px 0 16px rgba(0,0,0,0.04)",transition:"border-radius 250ms var(--ease-out-quart)"},children:[!e&&(0,h.jsxs)("div",{className:"shrink-0 flex items-center justify-center gap-3 px-4 py-1.5 text-xs bg-bg-elevated border-b border-border",children:[(0,h.jsx)("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-danger"}),(0,h.jsx)("span",{className:"text-fg-muted",children:t?`Connection lost: ${t}`:"Disconnected"}),(0,h.jsx)("button",{onClick:()=>{let e=localStorage.getItem("camelagi_token")??"";r(s+" ",e),setTimeout(()=>r(s.trim(),e),100)},className:"px-2.5 py-0.5 rounded text-[10.5px] font-medium bg-accent-soft text-accent hover:bg-accent-stroke/30 transition-colors",children:"Reconnect"})]}),(0,h.jsxs)("div",{className:"flex-1 min-h-0 overflow-hidden",children:[(0,h.jsx)("div",{style:{display:"chat"===n?"block":"none",height:"100%"},children:(0,h.jsx)(cg,{})}),"overview"===n&&(0,h.jsx)(cb,{}),"agents"===n&&(0,h.jsx)(cj,{}),"sessions"===n&&(0,h.jsx)(ck,{}),"config"===n&&(0,h.jsx)(cS,{}),"monitor"===n&&(0,h.jsx)(cC,{}),"workspace"===n&&(0,h.jsx)(c_,{}),"cron"===n&&(0,h.jsx)(cM,{}),"skills"===n&&(0,h.jsx)(cP,{}),"pairing"===n&&(0,h.jsx)(c$,{}),"voice"===n&&(0,h.jsx)(cF,{}),"mcp"===n&&(0,h.jsx)(cI,{}),"channels"===n&&(0,h.jsx)(cL,{}),"logs"===n&&(0,h.jsx)(cU,{}),"settings"===n&&(0,h.jsx)(cA,{})]})]})]})}function cO(){let{api:e,connecting:t,error:s}=f();return e||t||!s?null:(0,h.jsx)("div",{className:"flex items-center justify-center h-screen",style:{background:"var(--bg)"},children:(0,h.jsxs)("div",{className:"text-center space-y-4 max-w-sm px-6",children:[(0,h.jsx)(oC,{className:"h-10 w-10 mx-auto text-red-400"}),(0,h.jsx)("h1",{className:"text-lg font-bold text-[#EC9639]",children:"Cannot connect"}),(0,h.jsx)("p",{className:"text-sm text-red-400",children:s}),(0,h.jsxs)("p",{className:"text-xs opacity-50",children:["Make sure the gateway is running: ",(0,h.jsx)("code",{className:"font-mono",children:"camel serve"})]})]})})}var cB=m;class cq extends cB.Component{state={error:null,info:null};static getDerivedStateFromError(e){return{error:e,info:null}}componentDidCatch(e,t){console.error("[RuntimeErrorBoundary]",e,t),this.setState({info:t.componentStack??null})}render(){return this.state.error?(0,h.jsxs)("div",{style:{padding:24,fontFamily:"ui-monospace, monospace",fontSize:12,lineHeight:1.5,background:"#0F0F13",color:"#F2F2F5",minHeight:"100vh",overflow:"auto"},children:[(0,h.jsx)("h1",{style:{fontSize:16,color:"#F87171",marginBottom:12},children:"Dashboard crashed"}),(0,h.jsxs)("pre",{style:{background:"#1B1B22",padding:12,borderRadius:6,whiteSpace:"pre-wrap",marginBottom:12,color:"#FCA5A5"},children:[this.state.error.name,": ",this.state.error.message]}),this.state.error.stack&&(0,h.jsxs)("details",{open:!0,style:{marginBottom:12},children:[(0,h.jsx)("summary",{style:{cursor:"pointer",color:"#9CA3AF",marginBottom:8},children:"Stack"}),(0,h.jsx)("pre",{style:{background:"#1B1B22",padding:12,borderRadius:6,whiteSpace:"pre-wrap",color:"#D1D5DB",fontSize:11},children:this.state.error.stack})]}),this.state.info&&(0,h.jsxs)("details",{children:[(0,h.jsx)("summary",{style:{cursor:"pointer",color:"#9CA3AF",marginBottom:8},children:"Component stack"}),(0,h.jsx)("pre",{style:{background:"#1B1B22",padding:12,borderRadius:6,whiteSpace:"pre-wrap",color:"#D1D5DB",fontSize:11},children:this.state.info})]}),(0,h.jsx)("p",{style:{marginTop:16,color:"#9CA3AF"},children:"Open the browser console for the full trace."})]}):this.props.children}}function cW(){let{api:e,connecting:t}=f();return t?(0,h.jsx)("div",{className:"flex items-center justify-center h-screen bg-bg-base",children:(0,h.jsx)(om,{className:"h-6 w-6 animate-spin text-accent"})}):e?(0,h.jsx)(k,{initial:"chat",children:(0,h.jsx)(Q,{children:(0,h.jsx)(en,{children:(0,h.jsx)(cz,{})})})}):(0,h.jsx)(cO,{})}e.s(["default",0,function(){return(0,h.jsx)(cq,{children:(0,h.jsx)(y,{children:(0,h.jsx)(b,{children:(0,h.jsx)(cW,{})})})})}],1051)}]);