@agent-spaces/server 0.1.2 → 0.2.1

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 (216) hide show
  1. package/dist/adapters/claude-code-runtime/index.js +4 -1
  2. package/dist/adapters/git.js +2 -21
  3. package/dist/agents/issue-agent-runner.js +35 -21
  4. package/dist/agents/issue-task-controller.js +120 -73
  5. package/dist/agents/planner-agent.js +9 -12
  6. package/dist/app.js +10 -0
  7. package/dist/hooks/agent-hooks.js +5 -8
  8. package/dist/package.json +1 -1
  9. package/dist/routes/agent.js +40 -17
  10. package/dist/routes/channel.js +4 -1
  11. package/dist/routes/command.js +108 -0
  12. package/dist/routes/folder.js +44 -7
  13. package/dist/routes/issue.js +57 -23
  14. package/dist/routes/mcp.js +50 -0
  15. package/dist/routes/skill.js +57 -0
  16. package/dist/routes/subscription.js +49 -0
  17. package/dist/routes/task.js +16 -1
  18. package/dist/routes/workflow.js +63 -0
  19. package/dist/routes/workspace.js +2 -21
  20. package/dist/services/agent.js +140 -76
  21. package/dist/services/builtin-tools.js +72 -0
  22. package/dist/services/channel.js +5 -5
  23. package/dist/services/command-process-manager.js +136 -0
  24. package/dist/services/command.js +48 -0
  25. package/dist/services/issue.js +5 -6
  26. package/dist/services/mcp.js +120 -0
  27. package/dist/services/notification-hub/bot-commands.js +48 -16
  28. package/dist/services/notification-hub/helpers.js +12 -0
  29. package/dist/services/pty.js +10 -3
  30. package/dist/services/skill.js +171 -0
  31. package/dist/services/subscription/aicode.js +45 -0
  32. package/dist/services/subscription/base.js +3 -0
  33. package/dist/services/subscription/index.js +20 -0
  34. package/dist/services/subscription/minimax.js +60 -0
  35. package/dist/services/subscription/zhipu.js +39 -0
  36. package/dist/services/workflow.js +203 -0
  37. package/dist/services/workspace.js +0 -1
  38. package/dist/storage/command-store.js +17 -0
  39. package/dist/storage/subscription-store.js +44 -0
  40. package/dist/storage/workflow-store.js +40 -0
  41. package/dist/web/404.html +1 -1
  42. package/dist/web/__next.__PAGE__.txt +4 -4
  43. package/dist/web/__next._full.txt +22 -21
  44. package/dist/web/__next._head.txt +4 -4
  45. package/dist/web/__next._index.txt +9 -8
  46. package/dist/web/__next._tree.txt +2 -2
  47. package/dist/web/_next/static/MpJepsgfsHGGcc7rwFU8Y/_buildManifest.js +11 -0
  48. package/dist/web/_next/static/chunks/0-245kun-watp.js +2 -0
  49. package/dist/web/_next/static/chunks/0-ca_fo-yp3~z.js +1 -0
  50. package/dist/web/_next/static/chunks/0-vgd3j-zh3m8.js +2 -0
  51. package/dist/web/_next/static/chunks/0.4.g.8yf4rs0.js +3 -0
  52. package/dist/web/_next/static/chunks/02m_-ngl9w8co.js +1 -0
  53. package/dist/web/_next/static/chunks/03jbh7ud0jw~g.js +1 -0
  54. package/dist/web/_next/static/chunks/07kqxmubf5dua.js +1 -0
  55. package/dist/web/_next/static/chunks/088q-5_51dsrw.js +1 -0
  56. package/dist/web/_next/static/chunks/09_ki3dc5cfwv.css +1 -0
  57. package/dist/web/_next/static/chunks/09jryrjps0vl2.js +1 -0
  58. package/dist/web/_next/static/chunks/0b2tump5duj9j.js +1 -0
  59. package/dist/web/_next/static/chunks/0dctkv_2d2r0g.js +8 -0
  60. package/dist/web/_next/static/chunks/0efgv37kxyht8.js +1 -0
  61. package/dist/web/_next/static/chunks/0fwvdy-ml8wpk.js +1 -0
  62. package/dist/web/_next/static/chunks/0g4vm6.v0o_lt.js +1 -0
  63. package/dist/web/_next/static/chunks/0g_b4t~000.o~.js +179 -0
  64. package/dist/web/_next/static/chunks/0gyede80jpy3n.js +4 -0
  65. package/dist/web/_next/static/chunks/0h256h-tu4e0r.js +2 -0
  66. package/dist/web/_next/static/chunks/0ib18ul605e~a.js +1 -0
  67. package/dist/web/_next/static/chunks/0j1g_rd9t5ot1.js +1 -0
  68. package/dist/web/_next/static/chunks/0jn~llaqcxo4q.js +1 -0
  69. package/dist/web/_next/static/chunks/0jvmviuftg5e2.css +1 -0
  70. package/dist/web/_next/static/chunks/0lb8l2~6s_owo.js +1 -0
  71. package/dist/web/_next/static/chunks/0ni5ot2603_28.js +1 -0
  72. package/dist/web/_next/static/chunks/0pep4mkvt3.rh.js +31 -0
  73. package/dist/web/_next/static/chunks/0pq2670_ezbcj.js +1 -0
  74. package/dist/web/_next/static/chunks/0q_scqkk9.t53.js +2 -0
  75. package/dist/web/_next/static/chunks/0rrdur.v1a5r7.js +1 -0
  76. package/dist/web/_next/static/chunks/0spo.tmfeas-o.js +1 -0
  77. package/dist/web/_next/static/chunks/0tta_56qj1z8-.js +1 -0
  78. package/dist/web/_next/static/chunks/0u88ij9dqqh~-.js +1 -0
  79. package/dist/web/_next/static/chunks/0zl19l5tuoppw.js +1 -0
  80. package/dist/web/_next/static/chunks/11n16hogah-5..js +1 -0
  81. package/dist/web/_next/static/chunks/1250wo~-5dgyx.js +1 -0
  82. package/dist/web/_next/static/chunks/14n8i2xz4_y-e.js +1 -0
  83. package/dist/web/_next/static/chunks/160ji-.dfvm20.js +1 -0
  84. package/dist/web/_next/static/chunks/turbopack-0lxiiw.jhevml.js +1 -0
  85. package/dist/web/_next/static/media/favicon.0~ekuj.zhggpa.ico +0 -0
  86. package/dist/web/_not-found/__next._full.txt +24 -19
  87. package/dist/web/_not-found/__next._head.txt +4 -4
  88. package/dist/web/_not-found/__next._index.txt +9 -8
  89. package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
  90. package/dist/web/_not-found/__next._not-found.txt +3 -3
  91. package/dist/web/_not-found/__next._tree.txt +2 -2
  92. package/dist/web/_not-found.html +1 -1
  93. package/dist/web/_not-found.txt +24 -19
  94. package/dist/web/apple-touch-icon.png +0 -0
  95. package/dist/web/favicon.ico +0 -0
  96. package/dist/web/icon-192.png +0 -0
  97. package/dist/web/icon-512.png +0 -0
  98. package/dist/web/index.html +1 -1
  99. package/dist/web/index.txt +22 -21
  100. package/dist/web/login/__next._full.txt +24 -23
  101. package/dist/web/login/__next._head.txt +4 -4
  102. package/dist/web/login/__next._index.txt +9 -8
  103. package/dist/web/login/__next._tree.txt +2 -2
  104. package/dist/web/login/__next.login.__PAGE__.txt +4 -4
  105. package/dist/web/login/__next.login.txt +3 -3
  106. package/dist/web/login.html +1 -1
  107. package/dist/web/login.txt +24 -23
  108. package/dist/web/settings/__next._full.txt +34 -0
  109. package/dist/web/settings/__next._head.txt +6 -0
  110. package/dist/web/settings/__next._index.txt +11 -0
  111. package/dist/web/settings/__next._tree.txt +8 -0
  112. package/dist/web/settings/__next.settings.__PAGE__.txt +9 -0
  113. package/dist/web/settings/__next.settings.txt +7 -0
  114. package/dist/web/settings/agents/__next._full.txt +38 -0
  115. package/dist/web/settings/agents/__next._head.txt +6 -0
  116. package/dist/web/settings/agents/__next._index.txt +11 -0
  117. package/dist/web/settings/agents/__next._tree.txt +8 -0
  118. package/dist/web/settings/agents/__next.settings.agents.__PAGE__.txt +9 -0
  119. package/dist/web/settings/agents/__next.settings.agents.txt +5 -0
  120. package/dist/web/settings/agents/__next.settings.txt +7 -0
  121. package/dist/web/settings/agents.html +1 -0
  122. package/dist/web/settings/agents.txt +38 -0
  123. package/dist/web/settings/mcps/__next._full.txt +38 -0
  124. package/dist/web/settings/mcps/__next._head.txt +6 -0
  125. package/dist/web/settings/mcps/__next._index.txt +11 -0
  126. package/dist/web/settings/mcps/__next._tree.txt +8 -0
  127. package/dist/web/settings/mcps/__next.settings.mcps.__PAGE__.txt +9 -0
  128. package/dist/web/settings/mcps/__next.settings.mcps.txt +5 -0
  129. package/dist/web/settings/mcps/__next.settings.txt +7 -0
  130. package/dist/web/settings/mcps.html +1 -0
  131. package/dist/web/settings/mcps.txt +38 -0
  132. package/dist/web/settings/models/__next._full.txt +38 -0
  133. package/dist/web/settings/models/__next._head.txt +6 -0
  134. package/dist/web/settings/models/__next._index.txt +11 -0
  135. package/dist/web/settings/models/__next._tree.txt +8 -0
  136. package/dist/web/settings/models/__next.settings.models.__PAGE__.txt +9 -0
  137. package/dist/web/settings/models/__next.settings.models.txt +5 -0
  138. package/dist/web/settings/models/__next.settings.txt +7 -0
  139. package/dist/web/settings/models.html +1 -0
  140. package/dist/web/settings/models.txt +38 -0
  141. package/dist/web/settings/providers/__next._full.txt +38 -0
  142. package/dist/web/settings/providers/__next._head.txt +6 -0
  143. package/dist/web/settings/providers/__next._index.txt +11 -0
  144. package/dist/web/settings/providers/__next._tree.txt +8 -0
  145. package/dist/web/settings/providers/__next.settings.providers.__PAGE__.txt +9 -0
  146. package/dist/web/settings/providers/__next.settings.providers.txt +5 -0
  147. package/dist/web/settings/providers/__next.settings.txt +7 -0
  148. package/dist/web/settings/providers.html +1 -0
  149. package/dist/web/settings/providers.txt +38 -0
  150. package/dist/web/settings/skills/__next._full.txt +38 -0
  151. package/dist/web/settings/skills/__next._head.txt +6 -0
  152. package/dist/web/settings/skills/__next._index.txt +11 -0
  153. package/dist/web/settings/skills/__next._tree.txt +8 -0
  154. package/dist/web/settings/skills/__next.settings.skills.__PAGE__.txt +9 -0
  155. package/dist/web/settings/skills/__next.settings.skills.txt +5 -0
  156. package/dist/web/settings/skills/__next.settings.txt +7 -0
  157. package/dist/web/settings/skills.html +1 -0
  158. package/dist/web/settings/skills.txt +38 -0
  159. package/dist/web/settings.html +1 -0
  160. package/dist/web/settings.txt +34 -0
  161. package/dist/web/workflows/__next._full.txt +35 -0
  162. package/dist/web/workflows/__next._head.txt +6 -0
  163. package/dist/web/workflows/__next._index.txt +11 -0
  164. package/dist/web/workflows/__next._tree.txt +9 -0
  165. package/dist/web/workflows/__next.workflows.__PAGE__.txt +10 -0
  166. package/dist/web/workflows/__next.workflows.txt +5 -0
  167. package/dist/web/workflows.html +1 -0
  168. package/dist/web/workflows.txt +35 -0
  169. package/dist/web/workspace/_/__next._full.txt +25 -20
  170. package/dist/web/workspace/_/__next._head.txt +4 -4
  171. package/dist/web/workspace/_/__next._index.txt +9 -8
  172. package/dist/web/workspace/_/__next._tree.txt +2 -2
  173. package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +3 -3
  174. package/dist/web/workspace/_/__next.workspace.$d$id.txt +3 -3
  175. package/dist/web/workspace/_/__next.workspace.txt +3 -3
  176. package/dist/web/workspace/_.html +1 -1
  177. package/dist/web/workspace/_.txt +25 -20
  178. package/dist/web/workspaces/__next._full.txt +24 -23
  179. package/dist/web/workspaces/__next._head.txt +4 -4
  180. package/dist/web/workspaces/__next._index.txt +9 -8
  181. package/dist/web/workspaces/__next._tree.txt +2 -2
  182. package/dist/web/workspaces/__next.workspaces.__PAGE__.txt +4 -4
  183. package/dist/web/workspaces/__next.workspaces.txt +3 -3
  184. package/dist/web/workspaces.html +1 -1
  185. package/dist/web/workspaces.txt +24 -23
  186. package/dist/ws/agent-prompt.js +84 -0
  187. package/dist/ws/agent-runner.js +592 -0
  188. package/dist/ws/handler.js +9 -1200
  189. package/dist/ws/html-utils.js +30 -0
  190. package/dist/ws/message-parts.js +498 -0
  191. package/package.json +3 -2
  192. package/dist/web/_next/static/chunks/038whpa0zpnas.js +0 -1
  193. package/dist/web/_next/static/chunks/06q5go~xoz5a3.js +0 -1
  194. package/dist/web/_next/static/chunks/095.wizobwtyg.js +0 -2
  195. package/dist/web/_next/static/chunks/0bfg.w~u-83h5.js +0 -1
  196. package/dist/web/_next/static/chunks/0ce7i6~sb20rv.js +0 -113
  197. package/dist/web/_next/static/chunks/0d4~pcva1uk-a.js +0 -1
  198. package/dist/web/_next/static/chunks/0iq70n_u75nyu.js +0 -1
  199. package/dist/web/_next/static/chunks/0memz-8zsbxpu.js +0 -1
  200. package/dist/web/_next/static/chunks/0nw~w.3~twebx.js +0 -2
  201. package/dist/web/_next/static/chunks/0pyytgz~5vt0f.js +0 -31
  202. package/dist/web/_next/static/chunks/0ujjcrz~1nq.q.css +0 -1
  203. package/dist/web/_next/static/chunks/0vdnx9n41dyjl.js +0 -1
  204. package/dist/web/_next/static/chunks/0yl4mqmxtll6g.js +0 -1
  205. package/dist/web/_next/static/chunks/0zcbfka5tcle3.js +0 -1
  206. package/dist/web/_next/static/chunks/0~eo58u99i.fr.js +0 -8
  207. package/dist/web/_next/static/chunks/13_2vxyccsv84.js +0 -4
  208. package/dist/web/_next/static/chunks/13wfs~urgxu0w.js +0 -1
  209. package/dist/web/_next/static/chunks/157~3c6wqkt83.js +0 -1
  210. package/dist/web/_next/static/chunks/15jvow_z4uq-..js +0 -1
  211. package/dist/web/_next/static/chunks/15v697nf~r-cy.js +0 -2
  212. package/dist/web/_next/static/chunks/turbopack-164~7ulq9o9yc.js +0 -1
  213. package/dist/web/_next/static/media/favicon.0x3dzn~oxb6tn.ico +0 -0
  214. package/dist/web/_next/static/owMnKmxATbtXK_J_k_uHh/_buildManifest.js +0 -21
  215. /package/dist/web/_next/static/{owMnKmxATbtXK_J_k_uHh → MpJepsgfsHGGcc7rwFU8Y}/_clientMiddlewareManifest.js +0 -0
  216. /package/dist/web/_next/static/{owMnKmxATbtXK_J_k_uHh → MpJepsgfsHGGcc7rwFU8Y}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,837121,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"warnOnce",{enumerable:!0,get:function(){return a}});let a=e=>{}},989484,905724,e=>{"use strict";let t=(0,e.i(433721).default)("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.s(["default",0,t],905724),e.s(["FileText",0,t],989484)},517432,e=>{"use strict";var t=e.i(56032),s=e.i(863728);function a(){return s.NOOP}function i(){return!1}function n(){return!0}e.s(["useIsHydrating",0,function(){return(0,t.useSyncExternalStore)(a,i,n)}])},950396,e=>{"use strict";var t=e.i(344180),s=e.i(764556),a=e.i(799543);let i=(0,s.createContext)({theme:"system",setTheme:()=>{},resolvedTheme:"light"}),n="agent-spaces-theme";function l(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function r(e){let t="system"===e?l():e,s=document.documentElement;s.classList.remove("light","dark"),s.classList.add(t),s.style.colorScheme=t}e.s(["ThemeProvider",0,function({children:e,defaultTheme:o="system"}){(0,a.useServerInsertedHTML)(()=>(0,t.jsx)("script",{dangerouslySetInnerHTML:{__html:`(function(){try{var t=localStorage.getItem('${n}');var d=t==='dark'||((!t||t==='system')&&matchMedia('(prefers-color-scheme:dark)').matches);document.documentElement.classList.add(d?'dark':'light');document.documentElement.style.colorScheme=d?'dark':'light'}catch(e){}})()`}},"theme-init"));let c=(0,s.useSyncExternalStore)(e=>{let t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>l(),()=>"light"),d=(0,s.useSyncExternalStore)(e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),()=>localStorage.getItem(n)||o,()=>o),m="system"===d?c:d,u=(0,s.useCallback)(e=>{localStorage.setItem(n,e),r(e),window.dispatchEvent(new StorageEvent("storage",{key:n}))},[]);return(0,s.useEffect)(()=>{r(d)},[d,c]),(0,t.jsx)(i.Provider,{value:{theme:d,setTheme:u,resolvedTheme:m},children:e})},"useTheme",0,function(){return(0,s.useContext)(i)}])},799773,e=>{"use strict";let t=(0,e.i(433721).default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);e.s(["User",0,t],799773)},92457,e=>{"use strict";let t=(0,e.i(433721).default)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);e.s(["Monitor",0,t],92457)},267624,e=>{"use strict";let t=(0,e.i(433721).default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);e.s(["LayoutGrid",0,t],267624)},757106,e=>{"use strict";let t=(0,e.i(433721).default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]);e.s(["default",0,t])},990336,e=>{"use strict";var t=e.i(757106);e.s(["Brain",()=>t.default])},307858,e=>{"use strict";let t=(0,e.i(433721).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["ExternalLink",0,t],307858)},549705,e=>{"use strict";var t=e.i(344180),s=e.i(764556),a=e.i(244073),i=e.i(209988),n=e.i(260218),l=e.i(681622),r=e.i(562918),o=e.i(767467),c=e.i(100559),d=e.i(953700),m=e.i(137340),u=e.i(990336),x=e.i(307858),h=e.i(368942);let p={vision:"bg-blue-500/10 text-blue-600 border-blue-200",reasoning:"bg-purple-500/10 text-purple-600 border-purple-200",embedding:"bg-green-500/10 text-green-600 border-green-200"};function f({providers:e,providerModels:s,onEdit:i,onDelete:l,onAddModel:o}){let d=(0,a.useTranslations)("providers");return(0,t.jsxs)("div",{className:"flex flex-col p-2",children:[e.map(e=>{let a=s.find(t=>t.id===e.id),h=a?.models??[];return(0,t.jsxs)("div",{className:"group rounded-lg px-3 py-2.5 hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>i(e),children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex size-8 items-center justify-center rounded-lg bg-primary/10",children:(0,t.jsx)(c.Server,{className:"size-4 text-primary"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e.apiBase||d("list.noApiBase")})]}),(0,t.jsxs)(r.Badge,{variant:"outline",className:"text-[10px] h-4 px-1.5",children:[h.length," ",d("list.modelsCount")]}),(0,t.jsx)(n.Button,{variant:"ghost",size:"icon-xs",className:"opacity-0 group-hover:opacity-100 transition-opacity",onClick:t=>{t.stopPropagation(),l(e.id)},children:(0,t.jsx)(m.Trash2,{className:"size-3 text-destructive"})})]}),h.length>0&&(0,t.jsx)("div",{className:"mt-2 ml-11 flex flex-wrap gap-1",children:h.map(e=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-[11px] text-muted-foreground",children:[(0,t.jsx)(u.Brain,{className:"size-3"}),e.name,["vision","reasoning","embedding"].map(s=>e[s]?(0,t.jsx)("span",{className:`inline-block rounded px-1 text-[9px] font-medium border ${p[s]}`,children:s[0].toUpperCase()},s):null)]},e.id))}),(0,t.jsxs)(n.Button,{variant:"ghost",size:"xs",className:"mt-1 ml-11 h-6 text-[11px] text-muted-foreground",onClick:t=>{t.stopPropagation(),o(e.name)},children:[(0,t.jsx)(x.ExternalLink,{className:"size-3"}),d("list.addModel")]})]},e.id)}),0===e.length&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,t.jsx)(c.Server,{className:"size-10 mb-2 opacity-30"}),(0,t.jsx)("p",{className:"text-sm",children:d("list.empty")})]})]})}function g({draft:e,onChange:s}){let i=(0,a.useTranslations)("providers");return(0,t.jsx)("div",{className:"flex flex-col gap-5 p-5",children:(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:i("form.connection")}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:i("form.name")}),(0,t.jsx)(l.Input,{value:e.name||"",onChange:e=>s("name",e.target.value),placeholder:i("form.namePlaceholder")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:i("form.apiBase")}),(0,t.jsx)(l.Input,{value:e.apiBase||"",onChange:e=>s("apiBase",e.target.value),placeholder:i("form.apiBasePlaceholder")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:i("form.apiKey")}),(0,t.jsx)(l.Input,{type:"password",value:e.apiKey||"",onChange:e=>s("apiKey",e.target.value),placeholder:i("form.apiKeyPlaceholder")})]})]})})}e.s(["ProvidersDialog",0,function({open:e,onOpenChange:l,onAddModel:r,standalone:c}){let m=(0,a.useTranslations)("providers"),u=(0,a.useTranslations)("common"),{models:x,providers:p,ensure:j,addProvider:v,updateProvider:y,removeProvider:N}=(0,h.useLLMStore)(),[k,w]=(0,s.useState)(null),[b,S]=(0,s.useState)(null),[C,z]=(0,s.useState)(!1),[D,T]=(0,s.useState)(!1),[I,A]=(0,s.useState)(null);(0,s.useEffect)(()=>{e&&(z(!0),A(null),j().finally(()=>z(!1)))},[e,j]);let $=()=>{w(null),S(null)},M=async()=>{if(b&&b.name){T(!0),A(null);try{let e=!k,t=await fetch(e?"/api/providers":`/api/providers/${k.id}`,{method:e?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!t.ok)throw Error();let s=await t.json();e?v(s):y(s),$()}catch{A(m("error.saveFailed"))}finally{T(!1)}}},B=async e=>{if(confirm(m("confirm.delete"))){T(!0);try{if(!(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok)throw Error();N(e),k?.id===e&&$()}catch{A(m("error.deleteFailed"))}finally{T(!1)}}},P=(0,t.jsxs)(t.Fragment,{children:[!c&&(0,t.jsxs)("div",{className:"flex items-center gap-3 border-b px-5 py-4",children:[b&&(0,t.jsx)(n.Button,{variant:"ghost",size:"icon-sm",onClick:$,children:(0,t.jsx)(o.ArrowLeft,{className:"size-4"})}),(0,t.jsxs)(i.DialogHeader,{className:"flex-1 space-y-0",children:[(0,t.jsx)(i.DialogTitle,{className:"text-base",children:b?k?m("dialog.editTitle"):m("dialog.addTitle"):m("dialog.title")}),(0,t.jsx)(i.DialogDescription,{className:"text-xs",children:b?m("dialog.editDescription"):m("dialog.listDescription")})]}),!b&&(0,t.jsxs)(n.Button,{variant:"outline",size:"sm",onClick:()=>{w(null),S({name:"",apiBase:"",apiKey:""})},className:"mr-6",children:[(0,t.jsx)(d.Plus,{className:"size-3.5"}),m("dialog.add")]})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[I&&(0,t.jsx)("div",{className:"mx-5 mt-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:I}),C?(0,t.jsx)("div",{className:"py-12 text-center text-sm text-muted-foreground",children:m("dialog.loading")}):b?(0,t.jsx)(g,{draft:b,onChange:(e,t)=>{S(s=>s?{...s,[e]:t}:s)}}):(0,t.jsx)(f,{providers:p,providerModels:p.map(e=>{let t;return{id:e.id,models:(t=e.name,x.filter(e=>e.provider===t))}}),onEdit:e=>{w(e),S({...e})},onDelete:B,onAddModel:e=>{c||l(!1),r(e)}})]}),b&&(0,t.jsxs)("div",{className:"flex justify-end gap-2 border-t px-5 py-3",children:[(0,t.jsx)(n.Button,{variant:"outline",size:"sm",onClick:$,disabled:D,children:u("cancel")}),(0,t.jsx)(n.Button,{size:"sm",onClick:M,disabled:D||!b.name,children:u(D?"saving":"save")})]})]});return c?(0,t.jsx)("div",{className:"h-full flex flex-col",children:P}):(0,t.jsx)(i.Dialog,{open:e,onOpenChange:e=>{e||$(),l(e)},children:(0,t.jsx)(i.DialogContent,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 gap-0",children:P})})}])},523592,e=>{"use strict";var t=e.i(8890);let s="agent-spaces-servers",a="agent-spaces-active-server",i="active-server";function n(){let e=t.default.env.NEXT_PUBLIC_SERVER_URL?.trim();if(e)return e.replace(/\/$/,"");let{hostname:s,port:a}=window.location;return"localhost"!==s&&"127.0.0.1"!==s?"http://localhost:3100":"3000"===a?`http://${s}:3100`:window.location.origin}let l=[{id:"default",name:"Default",url:n()}];function r(){try{let e=localStorage.getItem(s);return e?JSON.parse(e).map(e=>"default"!==e.id||e.url?e:{...e,url:n()}):l}catch{return l}}function o(){return localStorage.getItem(a)||"default"}function c(){let e=r(),t=o();return e.find(e=>e.id===t)||e[0]||null}e.s(["getActiveServer",0,c,"getActiveServerUrl",0,function(){return c()?.url??null},"loadActiveId",0,o,"loadServers",0,r,"saveActiveId",0,function(e){localStorage.setItem(a,e)},"saveServers",0,function(e){localStorage.setItem(s,JSON.stringify(e))},"setActiveServerCookie",0,function(e){e?document.cookie=`${i}=${encodeURIComponent(e)}; path=/; max-age=31536000; SameSite=Lax`:document.cookie=`${i}=; path=/; max-age=0`}])},233297,515104,e=>{"use strict";function t(){return"tauri.localhost"===window.location.hostname||"__TAURI_INTERNALS__"in window}async function s(){return t()?r():"Notification"in window?l(Notification.permission):"unsupported"}async function a(){return t()?o():n()}async function i(e,s){var a,i;return t()?c(e,s):(a=e,i=s,void("Notification"in window&&"granted"===Notification.permission&&new Notification(a,{body:i,icon:"/favicon.ico"})))}async function n(){return"Notification"in window?l(await Notification.requestPermission()):"unsupported"}function l(e){switch(e){case"granted":return"granted";case"denied":return"denied";default:return"default"}}async function r(){try{let{isPermissionGranted:t}=await e.A(678001);return await t()?"granted":"default"}catch{return"unsupported"}}async function o(){try{let{requestPermission:t,isPermissionGranted:s}=await e.A(678001),a=await t();if("granted"===a||await s())return"granted";return"denied"}catch{return"unsupported"}}async function c(t,s){try{let{sendNotification:a,isPermissionGranted:i}=await e.A(678001);if(!await i())return;a({title:t,body:s})}catch{}}function d(e){let[t,s=""]=e.split("#",2),[a,i=""]=t.split("?",2);if(!a.startsWith("/")||a.startsWith("/api/"))return e;if("/"===a)return`/${i?`?${i}`:""}${s?`#${s}`:""}`;if(a.startsWith("/workspace/")){let e=a.slice(11).split("/")[0],t=new URLSearchParams(i);return t.set("workspaceId",e),`/workspace/_.html${t.toString()?`?${t.toString()}`:""}${s?`#${s}`:""}`}let n=a.endsWith(".html")?a:`${a}.html`;return`${n}${i?`?${i}`:""}${s?`#${s}`:""}`}e.i(8890),e.s(["getNotificationPermission",0,s,"isTauriEnvironment",0,t,"requestNotificationPermission",0,a,"sendNativeNotification",0,i],515104),e.s(["tauriNavigate",0,function(e,t,s=!1){t=d(t),s?window.location.replace(t):window.location.href=t},"toStaticHref",0,d],233297)},437122,286117,e=>{"use strict";var t=e.i(523592),s=e.i(233297);function a(e){return"/index.html"===e?"/":e.endsWith(".html")?e.slice(0,-5):e}function i(e){return"/login"===a(e)}e.s(["isLoginPath",0,i,"isWorkspacePath",0,function(e){return a(e).startsWith("/workspace/")},"workspaceIdFromLocation",0,function(e,t){let s=new URLSearchParams(t).get("workspaceId");if(s)return s;let i=a(e).match(/^\/workspace\/([^/]+)/);return i?.[1]??null}],286117);let n="agent-spaces-token",l="agent-spaces-auth-verified";function r(){let e=localStorage.getItem(n);if(null!==e)return e;let s=(0,t.getActiveServer)()?.secret;return void 0!==s?s:null}function o(){localStorage.removeItem(n),localStorage.removeItem(l)}function c(){let e=r();return null===e?{}:{Authorization:`Bearer ${e}`}}async function d(e,a){let n=function(e){if("string"!=typeof e||e.startsWith("http"))return e;let s=(0,t.getActiveServerUrl)();return s?`${s}${e.startsWith("/")?"":"/"}${e}`:e}(e),l={...c(),...a?.headers},r=await fetch(n,{...a,headers:l});return(401===r.status||403===r.status)&&(o(),i(window.location.pathname)||window.location.replace((0,s.toStaticHref)("/login"))),r}e.s(["authHeaders",0,c,"fetchWithAuth",0,d,"getToken",0,r,"isAuthenticated",0,function(){return"1"===localStorage.getItem(l)},"removeToken",0,o,"setToken",0,function(e){localStorage.setItem(n,e),localStorage.setItem(l,"1")}],437122)},962562,e=>{"use strict";let t=(0,e.i(433721).default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);e.s(["Pencil",0,t],962562)},210,e=>{"use strict";let t=(0,e.i(433721).default)("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);e.s(["Settings2",0,t],210)},100559,e=>{"use strict";let t=(0,e.i(433721).default)("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"}]]);e.s(["Server",0,t],100559)},894920,e=>{"use strict";var t=e.i(344180),s=e.i(764556),a=e.i(209988),i=e.i(260218),n=e.i(681622),l=e.i(344118),r=e.i(962562),o=e.i(953700),c=e.i(100559),d=e.i(137340),m=e.i(244073);e.s(["ServerManagerDialog",0,function({open:e,onOpenChange:u,servers:x,activeId:h,onUpdate:p,onRemove:f,onSwitch:g}){let j=(0,m.useTranslations)("sidebar"),v=(0,m.useTranslations)("common"),[y,N]=s.useState(null),[k,w]=s.useState(""),[b,S]=s.useState(""),[C,z]=s.useState(""),[D,T]=s.useState(""),[I,A]=s.useState(""),[$,M]=s.useState(""),B=()=>{N(null),w(""),S(""),z("")},P=()=>{if(!k.trim()||!b.trim())return;let e=b.trim().replace(/\/$/,"");/^https?:\/\//.test(e)||(e="http://"+e),p(x.map(t=>t.id===y?{...t,name:k.trim(),url:e,secret:C.trim()||void 0}:t)),B()};return(0,t.jsx)(a.Dialog,{open:e,onOpenChange:e=>{u(e),e||B()},children:(0,t.jsxs)(a.DialogContent,{className:"max-w-md",children:[(0,t.jsxs)(a.DialogHeader,{children:[(0,t.jsx)(a.DialogTitle,{children:j("server.manageServers")}),(0,t.jsx)(a.DialogDescription,{children:j("server.manageDescription")})]}),(0,t.jsx)("div",{className:"space-y-1",children:x.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded-md border px-3 py-2",children:[(0,t.jsx)(c.Server,{className:"size-4 shrink-0 text-muted-foreground"}),y===e.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.Input,{className:"h-7 text-sm flex-1",value:k,onChange:e=>w(e.target.value),placeholder:"Name",autoFocus:!0}),(0,t.jsx)(n.Input,{className:"h-7 text-sm flex-[1.5]",value:b,onChange:e=>S(e.target.value),placeholder:"http://...",onKeyDown:e=>"Enter"===e.key&&e.preventDefault()}),(0,t.jsx)(i.Button,{size:"sm",variant:"ghost",onClick:P,className:"h-7 px-2",children:v("save")}),(0,t.jsx)(i.Button,{size:"sm",variant:"ghost",onClick:B,className:"h-7 px-2",children:v("cancel")})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0 cursor-pointer",onClick:()=>{e.id!==h&&g(e)},children:[(0,t.jsx)("div",{className:"text-sm font-medium truncate",children:e.name}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.url})]}),e.id===h?(0,t.jsx)(l.Check,{className:"size-4 shrink-0 text-primary"}):(0,t.jsx)(i.Button,{size:"sm",variant:"ghost",onClick:()=>g(e),className:"h-7 px-2 text-xs shrink-0",children:j("server.switch")}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.Pencil,{className:"size-3.5 shrink-0 text-muted-foreground cursor-pointer hover:text-foreground",onClick:()=>{N(e.id),w(e.name),S(e.url),z(e.secret||"")}}),"default"!==e.id&&(0,t.jsx)(d.Trash2,{className:"size-3.5 shrink-0 text-muted-foreground cursor-pointer hover:text-destructive",onClick:()=>f(e.id)})]})]})]},e.id))}),null===y&&(0,t.jsxs)("div",{className:"border-t pt-3 mt-2 space-y-2",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:j("server.newServer")}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(n.Input,{className:"h-8 text-sm",value:D,onChange:e=>T(e.target.value),placeholder:"Name"}),(0,t.jsx)(i.Button,{size:"sm",onClick:()=>{if(!D.trim()||!I.trim())return;let e=I.trim().replace(/\/$/,"");/^https?:\/\//.test(e)||(e="http://"+e),p([...x,{id:Date.now().toString(),name:D.trim(),url:e,secret:$.trim()||void 0}]),T(""),A(""),M("")},disabled:!D.trim()||!I.trim(),children:(0,t.jsx)(o.Plus,{className:"size-4"})})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(n.Input,{className:"h-8 text-sm flex-1",value:I,onChange:e=>A(e.target.value),placeholder:"http://..."})}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(n.Input,{className:"h-8 text-sm flex-1",type:"password",value:$,onChange:e=>M(e.target.value),placeholder:j("server.secretOptionalPlaceholder"),onKeyDown:e=>"Enter"===e.key&&e.preventDefault()})})]})]})})}])},111343,e=>{"use strict";let t=(0,e.i(433721).default)("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"}]]);e.s(["Save",0,t],111343)},255742,973767,401058,977694,e=>{"use strict";var t=e.i(433721);let s=(0,t.default)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);e.s(["Star",0,s],255742);let a=(0,t.default)("star-off",[["path",{d:"m10.344 4.688 1.181-2.393a.53.53 0 0 1 .95 0l2.31 4.679a2.12 2.12 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.237 3.152",key:"19ctli"}],["path",{d:"m17.945 17.945.43 2.505a.53.53 0 0 1-.771.56l-4.618-2.428a2.12 2.12 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a8 8 0 0 0 .4-.099",key:"ptqqvy"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);e.s(["StarOff",0,a],973767);let i=(0,t.default)("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);e.s(["MoreVertical",0,i],401058);let n=(0,t.default)("rocket",[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]]);e.s(["Rocket",0,n],977694)},22906,191202,e=>{"use strict";var t=e.i(344180),s=e.i(764556),a=e.i(244073),i=e.i(887836),n=e.i(209988),l=e.i(260218),r=e.i(681622),o=e.i(788010),c=e.i(191118),d=e.i(917955),m=e.i(996652),u=e.i(188815),x=e.i(611176),h=e.i(255742),p=e.i(973767),f=e.i(129981),g=e.i(887354);let j=(0,e.i(433721).default)("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"}]]);e.s(["Plug",0,j],191202);var v=e.i(972846),y=e.i(401058),N=e.i(137340),k=e.i(977694),w=e.i(111343),b=e.i(465458);e.i(462506);let S=(0,i.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading editor..."})});e.s(["McpsDialog",0,function({open:e,onOpenChange:i,standalone:C}){let z=(0,a.useTranslations)("mcps"),D=(0,a.useTranslations)("common"),[T,I]=(0,s.useState)([]),[A,$]=(0,s.useState)([]),[M,B]=(0,s.useState)(!1),[P,L]=(0,s.useState)(""),[U,O]=(0,s.useState)("all"),[E,F]=(0,s.useState)(""),[H,R]=(0,s.useState)(!1),[J,q]=(0,s.useState)(""),[W,_]=(0,s.useState)(""),[V,K]=(0,s.useState)(null),[X,G]=(0,s.useState)([]),[Q,Y]=(0,s.useState)(null),[Z,ee]=(0,s.useState)(""),et=(0,s.useCallback)(async()=>{B(!0);try{let e=await fetch("/api/mcps");e.ok&&I(await e.json())}catch{}B(!1)},[]),es=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/agents/presets");if(e.ok){let t=await e.json();$(t.map(e=>({id:e.id,name:e.name,avatarUrl:e.avatarUrl,description:e.description})))}}catch{}},[]);(0,s.useEffect)(()=>{(e||C)&&(et(),es())},[e,C,et,es]);let ea=async e=>{try{let t=await fetch(`/api/mcps/${encodeURIComponent(e.name)}/favorite`,{method:"POST"});if(t.ok){let{favorited:s}=await t.json();I(t=>t.map(t=>t.name===e.name?{...t,favorited:s}:t))}}catch{}},ei=async()=>{_("");try{JSON.parse(J)}catch{_(z("importInvalidJson"));return}try{let e=await fetch("/api/mcps/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonText:J})});if(e.ok)q(""),R(!1),et();else{let t=await e.json();_(t.error||z("importFailed"))}}catch{_(z("importFailed"))}},en=async()=>{let e;if(Q){try{e=JSON.parse(Z)}catch{return}try{(await fetch(`/api/mcps/${encodeURIComponent(Q.name)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:e})})).ok&&(I(t=>t.map(t=>t.name===Q.name?{...t,config:e}:t)),Y(null))}catch{}}},el=async e=>{try{(await fetch(`/api/mcps/${encodeURIComponent(e.name)}`,{method:"DELETE"})).ok&&I(t=>t.filter(t=>t.name!==e.name))}catch{}},er=async()=>{if(V){for(let e of A){let t=V.boundAgents.some(t=>t.id===e.id),s=X.includes(e.id);if(t&&!s){let t=await fetch(`/api/agents/presets/${e.id}`);if(!t.ok)continue;let s=await t.json(),a=s.mcps||{},i={...a.mcpServers||{}};delete i[V.name],await fetch(`/api/agents/presets/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,mcps:{...a,mcpServers:i}})})}else if(!t&&s){let t=await fetch(`/api/agents/presets/${e.id}`);if(!t.ok)continue;let s=await t.json(),a=s.mcps||{},i={...a.mcpServers||{}};V.name in i||(i[V.name]=V.config,await fetch(`/api/agents/presets/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,mcps:{...a,mcpServers:i}})}))}}K(null),et()}},eo=e=>{G(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},ec=T.filter(e=>{if(P){let t=P.toLowerCase();if(!e.name.toLowerCase().includes(t)&&!e.description.toLowerCase().includes(t))return!1}return("favorites"!==U||!!e.favorited)&&("agent"!==U||!E||!!e.boundAgents.some(e=>e.id===E))}),ed=(C||e)&&!V&&!Q,em=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-end pr-8 pt-2",children:[(0,t.jsxs)("div",{className:"hidden md:block",children:[C?(0,t.jsx)("h2",{className:"text-base font-semibold",children:z("title")}):(0,t.jsx)(n.DialogTitle,{children:z("title")}),C?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:z("description")}):(0,t.jsx)(n.DialogDescription,{children:z("description")})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsxs)(m.Popover,{open:H,onOpenChange:R,children:[(0,t.jsx)(m.PopoverTrigger,{render:(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",children:[(0,t.jsx)(f.Upload,{className:"size-3.5 mr-1"}),z("import")]})}),(0,t.jsx)(m.PopoverContent,{className:"w-96",align:"end",children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:z("importTitle")}),(0,t.jsx)(o.Textarea,{value:J,onChange:e=>{q(e.target.value),_("")},placeholder:'{\n "mcpServers": {\n "server-name": {\n "command": "npx",\n "args": ["-y", "package"],\n "env": {}\n }\n }\n}',className:"font-mono text-xs min-h-[180px] resize-none"}),W&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:W}),(0,t.jsx)(l.Button,{size:"sm",onClick:ei,disabled:!J.trim(),className:"w-full",children:z("importConfirm")})]})})]})})]})}),(0,t.jsxs)("div",{className:"flex flex-1 min-h-0 gap-4 pt-2",children:[(0,t.jsxs)("div",{className:"hidden md:flex w-44 shrink-0 flex-col gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)(l.Button,{variant:"all"===U?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{O("all"),F("")},children:[(0,t.jsx)(j,{className:"size-3.5 mr-1.5"}),z("filterAll")]}),(0,t.jsxs)(l.Button,{variant:"favorites"===U?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{O("favorites"),F("")},children:[(0,t.jsx)(h.Star,{className:"size-3.5 mr-1.5"}),z("filterFavorites")]})]}),A.length>0&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground px-2",children:z("filterByAgent")}),(0,t.jsx)(c.ScrollArea,{className:"max-h-48",children:A.map(e=>(0,t.jsxs)(l.Button,{variant:"agent"===U&&E===e.id?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{O("agent"),F(e.id)},children:[(0,t.jsx)(x.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-4 mr-1.5 rounded-full"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]},e.id))})]})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex md:hidden flex-col gap-2",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(g.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(r.Input,{value:P,onChange:e=>L(e.target.value),placeholder:z("search"),className:"pl-8"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex rounded-lg border border-input p-0.5",children:[(0,t.jsx)("button",{type:"button",className:(0,b.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors","all"===U?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{O("all"),F("")},children:z("filterAll")}),(0,t.jsxs)("button",{type:"button",className:(0,b.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors","favorites"===U?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{O("favorites"),F("")},children:[(0,t.jsx)(h.Star,{className:"size-3 inline-block mr-0.5 -mt-px"}),z("filterFavorites")]})]}),A.length>0&&(0,t.jsx)(u.SearchSelect,{value:"agent"===U?E:"",onChange:e=>{e?(O("agent"),F(e)):(O("all"),F(""))},options:A.map(e=>({value:e.id,label:e.name})),placeholder:z("filterByAgent"),allowCustom:!1,className:"flex-1 min-w-0"})]})]}),(0,t.jsxs)("div",{className:"hidden md:block relative",children:[(0,t.jsx)(g.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(r.Input,{value:P,onChange:e=>L(e.target.value),placeholder:z("search"),className:"pl-8"})]}),(0,t.jsx)(c.ScrollArea,{className:"flex-1",children:M?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:D("loading")}):0===ec.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:z("empty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 gap-3 pr-2",children:ec.map(e=>(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors cursor-pointer",onClick:()=>{Y(e),ee(JSON.stringify(e.config,null,2))},children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(j,{className:"size-3.5 text-muted-foreground"}),(0,t.jsx)("span",{className:"font-medium text-sm",children:e.name}),(0,t.jsx)("button",{type:"button",className:"flex items-center justify-center size-5 rounded hover:bg-accent",onClick:t=>{t.stopPropagation(),ea(e)},children:e.favorited?(0,t.jsx)(h.Star,{className:"size-3.5 text-yellow-500 fill-yellow-500"}):(0,t.jsx)(p.StarOff,{className:"size-3.5 text-muted-foreground"})})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:e.description||e.config.command||e.config.url||JSON.stringify(e.config).slice(0,100)})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",onClick:()=>{K(e),G(e.boundAgents.map(e=>e.id))},children:[(0,t.jsx)(k.Rocket,{className:"size-3.5 mr-1"}),z("apply")]}),(0,t.jsxs)(d.DropdownMenu,{children:[(0,t.jsx)(d.DropdownMenuTrigger,{render:(0,t.jsx)(l.Button,{variant:"ghost",size:"icon",className:"size-7"}),children:(0,t.jsx)(y.MoreVertical,{className:"size-3.5"})}),(0,t.jsx)(d.DropdownMenuContent,{align:"end",children:(0,t.jsxs)(d.DropdownMenuItem,{className:"text-destructive focus:text-destructive",onClick:()=>el(e),children:[(0,t.jsx)(N.Trash2,{className:"size-3.5 mr-1.5"}),z("delete")]})})]})]})]}),e.boundAgents.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mt-2.5 pt-2.5 border-t border-border/50",children:[e.boundAgents.map(e=>(0,t.jsx)(x.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-5 rounded-full"},e.id)),(0,t.jsx)("span",{className:"text-xs text-muted-foreground ml-1",children:e.boundAgents.length})]})]},e.name))})})]})]})]});return(0,t.jsxs)(t.Fragment,{children:[C&&ed&&(0,t.jsx)("div",{className:"h-full flex flex-col",children:em}),!C&&(0,t.jsx)(n.Dialog,{open:ed,onOpenChange:i,children:(0,t.jsx)(n.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:em})}),(0,t.jsx)(n.Dialog,{open:!!Q,onOpenChange:e=>{e||Y(null)},children:(0,t.jsxs)(n.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:[(0,t.jsx)(n.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between pr-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(n.DialogTitle,{children:z("editTitle",{name:Q?.name||""})}),(0,t.jsx)(n.DialogDescription,{children:z("editDescription")})]}),(0,t.jsxs)(l.Button,{size:"sm",onClick:en,children:[(0,t.jsx)(w.Save,{className:"size-3.5 mr-1"}),D("save")]})]})}),(0,t.jsx)("div",{className:"flex-1 min-h-0 pt-2",children:(0,t.jsx)(S,{height:"100%",language:"json",value:Z,onChange:e=>ee(e||""),theme:"vs-dark",options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},renderLineHighlight:"gutter",wordWrap:"on",formatOnPaste:!0}})})]})}),(0,t.jsx)(n.Dialog,{open:!!V,onOpenChange:e=>{e||K(null)},children:(0,t.jsxs)(n.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsxs)(n.DialogHeader,{children:[(0,t.jsx)(n.DialogTitle,{children:z("bindTitle",{name:V?.name||""})}),(0,t.jsx)(n.DialogDescription,{children:z("bindDescription")})]}),(0,t.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,t.jsx)("div",{className:"max-h-52 overflow-y-auto space-y-0.5",children:A.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>eo(e.id),className:(0,b.cn)("flex items-center gap-2 w-full px-2 py-1.5 rounded-md hover:bg-muted text-left text-sm transition-colors"),children:[(0,t.jsx)(x.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-5 rounded-full"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"block truncate",children:e.name}),e.description&&(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,t.jsx)("div",{className:(0,b.cn)("flex items-center justify-center size-4 rounded border shrink-0",X.includes(e.id)?"bg-primary border-primary text-primary-foreground":"border-input")})]},e.id))}),X.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:X.map(e=>{let s=A.find(t=>t.id===e);return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs",children:[(0,t.jsx)(x.AgentIcon,{agentId:e,name:s?.name,className:"size-3.5 rounded-full"}),s?.name||e,(0,t.jsx)("button",{type:"button",onClick:()=>eo(e),className:"hover:text-destructive",children:(0,t.jsx)(v.X,{className:"size-3"})})]},e)})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,t.jsx)(l.Button,{variant:"outline",onClick:()=>K(null),children:D("cancel")}),(0,t.jsx)(l.Button,{onClick:er,children:D("confirm")})]})]})]})})]})}],22906)},625873,e=>{"use strict";var t=e.i(344180),s=e.i(764556),a=e.i(244073),i=e.i(887836),n=e.i(209988),l=e.i(260218),r=e.i(681622),o=e.i(191118),c=e.i(917955),d=e.i(996652),m=e.i(898822),u=e.i(129981),x=e.i(972846),h=e.i(984178),p=e.i(465458);let f=0;function g({value:e=[],onChange:a,accept:i,maxFiles:n=0,maxSize:l,disabled:r=!1,className:o,placeholder:c}){let[d,j]=(0,s.useState)(null),v=(0,s.useCallback)((t,s)=>{if(j(null),s.length>0){let e=s[0].errors[0]?.message;e&&j(e)}if(0===t.length)return;let i=t.map(e=>{let t={id:`upload-${++f}`,file:e};return e.type.startsWith("image/")&&(t.preview=URL.createObjectURL(e)),t}),l=n>0?[...e,...i].slice(0,n):[...e,...i];a?.(l)},[e,a,n]),y=(0,s.useCallback)(t=>{let s=e.find(e=>e.id===t);s?.preview&&URL.revokeObjectURL(s.preview),a?.(e.filter(e=>e.id!==t))},[e,a]),{getRootProps:N,getInputProps:k,isDragActive:w,open:b}=(0,m.useDropzone)({onDrop:v,accept:i,maxFiles:n||void 0,maxSize:l,disabled:r,noClick:!1});return(0,t.jsxs)("div",{className:(0,p.cn)("space-y-3",o),children:[(0,t.jsxs)("div",{...N(),className:(0,p.cn)("relative flex flex-col items-center justify-center gap-2 rounded-xl border-2 border-dashed px-6 py-8 transition-colors cursor-pointer",w?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-accent/50",r&&"pointer-events-none opacity-50"),children:[(0,t.jsx)("input",{...k()}),(0,t.jsx)(u.Upload,{className:"size-8 text-muted-foreground"}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:c??(w?"松开即可上传":"拖拽文件到此处,或点击选择")}),!w&&(0,t.jsxs)("p",{className:"mt-1 text-xs text-muted-foreground",children:["支持多文件",l?`,单文件最大 ${(l/1024/1024).toFixed(0)}MB`:""]})]})]}),d&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:d}),e.length>0&&(0,t.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>{var s;return(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-background px-3 py-2",children:[e.preview?(0,t.jsx)("img",{src:e.preview,alt:"",className:"size-10 rounded-md object-cover"}):(0,t.jsx)("div",{className:"flex size-10 items-center justify-center rounded-md bg-muted",children:(0,t.jsx)(h.FileIcon,{className:"size-5 text-muted-foreground"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"truncate text-sm",children:e.file.name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:(s=e.file.size)<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1024/1024).toFixed(1)} MB`})]}),(0,t.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),y(e.id)},className:"flex size-7 items-center justify-center rounded-md hover:bg-accent transition-colors",children:(0,t.jsx)(x.X,{className:"size-4 text-muted-foreground"})})]},e.id)})})]})}var j=e.i(188815),v=e.i(611176),y=e.i(255742),N=e.i(973767),k=e.i(887354),w=e.i(989484),b=e.i(401058),S=e.i(137340),C=e.i(977694),z=e.i(111343),D=e.i(601039);e.i(462506);let T=(0,i.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading editor..."})});e.s(["SkillsDialog",0,function({open:e,onOpenChange:i,standalone:m}){let h=(0,a.useTranslations)("skills"),f=(0,a.useTranslations)("common"),[I,A]=(0,s.useState)([]),[$,M]=(0,s.useState)([]),[B,P]=(0,s.useState)(!1),[L,U]=(0,s.useState)(""),[O,E]=(0,s.useState)("all"),[F,H]=(0,s.useState)(""),[R,J]=(0,s.useState)(!1),[q,W]=(0,s.useState)([]),[_,V]=(0,s.useState)(null),[K,X]=(0,s.useState)([]),[G,Q]=(0,s.useState)(null),[Y,Z]=(0,s.useState)(""),[ee,et]=(0,s.useState)([]),[es,ea]=(0,s.useState)(new Set),[ei,en]=(0,s.useState)(!1),[el,er]=(0,s.useState)(!1),eo=(0,s.useCallback)(async()=>{P(!0);try{let e=await fetch("/api/skills");e.ok&&A(await e.json())}catch{}P(!1)},[]),ec=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/agents/presets");if(e.ok){let t=await e.json();M(t.map(e=>({id:e.id,name:e.name,avatarUrl:e.avatarUrl,description:e.description})))}}catch{}},[]);(0,s.useEffect)(()=>{(e||m)&&(eo(),ec())},[e,m,eo,ec]);let ed=async e=>{try{let t=await fetch(`/api/skills/${encodeURIComponent(e.name)}/favorite`,{method:"POST"});if(t.ok){let{favorited:s}=await t.json();A(t=>t.map(t=>t.name===e.name?{...t,favorited:s}:t))}}catch{}},em=async()=>{for(let e of q){let t=await e.file.text();await fetch("/api/skills/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:e.file.name,content:t})})}W([]),J(!1),eo()},eu=async()=>{if(G)try{(await fetch(`/api/skills/${encodeURIComponent(G.name)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:Y})})).ok&&(A(e=>e.map(e=>e.name===G.name?{...e,content:Y}:e)),Q(null))}catch{}},ex=async e=>{try{(await fetch(`/api/skills/${encodeURIComponent(e.name)}`,{method:"DELETE"})).ok&&A(t=>t.filter(t=>t.name!==e.name))}catch{}},eh=async()=>{if(_){for(let e of $){let t=_.boundAgents.some(t=>t.id===e.id),s=K.includes(e.id);if(t&&!s){let t=await fetch(`/api/agents/presets/${e.id}`);if(!t.ok)continue;let s=await t.json(),a=(s.skills||[]).filter(e=>e.replace(/\.md$/i,"")!==_.name);console.log("[skills] remove skill",_.name,"from agent",e.name,"updatedSkills:",a),await fetch(`/api/agents/presets/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,skills:a})})}else if(!t&&s){let t=await fetch(`/api/agents/presets/${e.id}`);if(!t.ok)continue;let s=await t.json();if(!(s.skills||[]).map(e=>e.replace(/\.md$/i,"")).includes(_.name)){let t=[...s.skills||[],`${_.name}.md`];console.log("[skills] add skill",_.name,"to agent",e.name,"updatedSkills:",t),await fetch(`/api/agents/presets/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,skills:t})})}}}V(null),eo()}},ep=e=>{X(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},ef=async()=>{er(!0);try{let e=await fetch("/api/skills/sync-check");if(e.ok){let t=await e.json();et(t),ea(new Set(t.map(e=>`${e.agentId}::${e.skillName}`))),en(!0)}}catch{}er(!1)},eg=async()=>{let e=ee.filter(e=>es.has(`${e.agentId}::${e.skillName}`));if(0!==e.length)try{(await fetch("/api/skills/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:e.map(e=>({agentId:e.agentId,skillName:e.skillName}))})})).ok&&(en(!1),eo())}catch{}},ej=I.filter(e=>{if(L){let t=L.toLowerCase();if(!e.name.toLowerCase().includes(t)&&!e.content.toLowerCase().includes(t))return!1}return("favorites"!==O||!!e.favorited)&&("agent"!==O||!F||!!e.boundAgents.some(e=>e.id===F))}),ev=(m||e)&&!_&&!G,ey=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between pr-8",children:[(0,t.jsxs)("div",{className:"hidden md:block",children:[m?(0,t.jsx)("h2",{className:"text-base font-semibold",children:h("title")}):(0,t.jsx)(n.DialogTitle,{children:h("title")}),m?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:h("description")}):(0,t.jsx)(n.DialogDescription,{children:h("description")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 ml-auto shrink-0 pt-2",children:[(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",onClick:ef,disabled:el,children:[(0,t.jsx)(D.RefreshCw,{className:(0,p.cn)("size-3.5 mr-1",el&&"animate-spin")}),h("syncToAgents")]}),(0,t.jsxs)(d.Popover,{open:R,onOpenChange:J,children:[(0,t.jsx)(d.PopoverTrigger,{render:(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",children:[(0,t.jsx)(u.Upload,{className:"size-3.5 mr-1"}),h("import")]})}),(0,t.jsx)(d.PopoverContent,{className:"w-80",align:"end",children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:h("importTitle")}),(0,t.jsx)(g,{value:q,onChange:W,accept:{"text/markdown":[".md"],"":[".md"]},placeholder:h("importPlaceholder"),maxFiles:10}),(0,t.jsx)(l.Button,{size:"sm",onClick:em,disabled:0===q.length,className:"w-full",children:h("importConfirm")})]})})]})]})]})}),(0,t.jsxs)("div",{className:"flex flex-1 min-h-0 gap-4 pt-2",children:[(0,t.jsxs)("div",{className:"hidden md:flex w-44 shrink-0 flex-col gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)(l.Button,{variant:"all"===O?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{E("all"),H("")},children:[(0,t.jsx)(w.FileText,{className:"size-3.5 mr-1.5"}),h("filterAll")]}),(0,t.jsxs)(l.Button,{variant:"favorites"===O?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{E("favorites"),H("")},children:[(0,t.jsx)(y.Star,{className:"size-3.5 mr-1.5"}),h("filterFavorites")]})]}),$.length>0&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground px-2",children:h("filterByAgent")}),(0,t.jsx)(o.ScrollArea,{className:"max-h-48",children:$.map(e=>(0,t.jsxs)(l.Button,{variant:"agent"===O&&F===e.id?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{E("agent"),H(e.id)},children:[(0,t.jsx)(v.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-4 mr-1.5 rounded-full"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]},e.id))})]})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex md:hidden flex-col gap-2",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(k.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(r.Input,{value:L,onChange:e=>U(e.target.value),placeholder:h("search"),className:"pl-8"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex rounded-lg border border-input p-0.5",children:[(0,t.jsx)("button",{type:"button",className:(0,p.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors","all"===O?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{E("all"),H("")},children:h("filterAll")}),(0,t.jsxs)("button",{type:"button",className:(0,p.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors","favorites"===O?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{E("favorites"),H("")},children:[(0,t.jsx)(y.Star,{className:"size-3 inline-block mr-0.5 -mt-px"}),h("filterFavorites")]})]}),$.length>0&&(0,t.jsx)(j.SearchSelect,{value:"agent"===O?F:"",onChange:e=>{e?(E("agent"),H(e)):(E("all"),H(""))},options:$.map(e=>({value:e.id,label:e.name})),placeholder:h("filterByAgent"),allowCustom:!1,className:"flex-1 min-w-0"})]})]}),(0,t.jsxs)("div",{className:"hidden md:block relative",children:[(0,t.jsx)(k.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(r.Input,{value:L,onChange:e=>U(e.target.value),placeholder:h("search"),className:"pl-8"})]}),(0,t.jsx)(o.ScrollArea,{className:"flex-1",children:B?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:f("loading")}):0===ej.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:h("empty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 gap-3 pr-2",children:ej.map(e=>(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors cursor-pointer",onClick:()=>{Q(e),Z(e.content)},children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{className:"font-medium text-sm",children:e.name}),(0,t.jsx)("button",{type:"button",className:"flex items-center justify-center size-5 rounded hover:bg-accent",onClick:t=>{t.stopPropagation(),ed(e)},children:e.favorited?(0,t.jsx)(y.Star,{className:"size-3.5 text-yellow-500 fill-yellow-500"}):(0,t.jsx)(N.StarOff,{className:"size-3.5 text-muted-foreground"})})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:e.description||e.content.slice(0,120).replace(/^#\s+/,"")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",onClick:()=>{V(e),X(e.boundAgents.map(e=>e.id))},children:[(0,t.jsx)(C.Rocket,{className:"size-3.5 mr-1"}),h("apply")]}),(0,t.jsxs)(c.DropdownMenu,{children:[(0,t.jsx)(c.DropdownMenuTrigger,{render:(0,t.jsx)(l.Button,{variant:"ghost",size:"icon",className:"size-7"}),children:(0,t.jsx)(b.MoreVertical,{className:"size-3.5"})}),(0,t.jsx)(c.DropdownMenuContent,{align:"end",children:(0,t.jsxs)(c.DropdownMenuItem,{className:"text-destructive focus:text-destructive",onClick:()=>ex(e),children:[(0,t.jsx)(S.Trash2,{className:"size-3.5 mr-1.5"}),h("delete")]})})]})]})]}),e.boundAgents.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mt-2.5 pt-2.5 border-t border-border/50",children:[e.boundAgents.map(e=>(0,t.jsx)(v.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-5 rounded-full"},e.id)),(0,t.jsx)("span",{className:"text-xs text-muted-foreground ml-1",children:e.boundAgents.length})]})]},e.name))})})]})]})]});return(0,t.jsxs)(t.Fragment,{children:[m&&ev&&(0,t.jsx)("div",{className:"h-full flex flex-col",children:ey}),!m&&(0,t.jsx)(n.Dialog,{open:ev,onOpenChange:i,children:(0,t.jsx)(n.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:ey})}),(0,t.jsx)(n.Dialog,{open:!!G,onOpenChange:e=>{e||Q(null)},children:(0,t.jsxs)(n.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:[(0,t.jsx)(n.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between pr-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(n.DialogTitle,{children:h("editTitle",{name:G?.name||""})}),(0,t.jsx)(n.DialogDescription,{children:h("editDescription")})]}),(0,t.jsxs)(l.Button,{size:"sm",onClick:eu,children:[(0,t.jsx)(z.Save,{className:"size-3.5 mr-1"}),f("save")]})]})}),(0,t.jsx)("div",{className:"flex-1 min-h-0 pt-2",children:(0,t.jsx)(T,{height:"100%",language:"markdown",value:Y,onChange:e=>Z(e||""),theme:"vs-dark",options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},renderLineHighlight:"gutter",wordWrap:"on"}})})]})}),(0,t.jsx)(n.Dialog,{open:!!_,onOpenChange:e=>{e||V(null)},children:(0,t.jsxs)(n.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsxs)(n.DialogHeader,{children:[(0,t.jsx)(n.DialogTitle,{children:h("bindTitle",{name:_?.name||""})}),(0,t.jsx)(n.DialogDescription,{children:h("bindDescription")})]}),(0,t.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,t.jsx)("div",{className:"max-h-52 overflow-y-auto space-y-0.5",children:$.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>ep(e.id),className:(0,p.cn)("flex items-center gap-2 w-full px-2 py-1.5 rounded-md hover:bg-muted text-left text-sm transition-colors"),children:[(0,t.jsx)(v.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-5 rounded-full"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"block truncate",children:e.name}),e.description&&(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,t.jsx)("div",{className:(0,p.cn)("flex items-center justify-center size-4 rounded border shrink-0",K.includes(e.id)?"bg-primary border-primary text-primary-foreground":"border-input")})]},e.id))}),K.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:K.map(e=>{let s=$.find(t=>t.id===e);return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs",children:[(0,t.jsx)(v.AgentIcon,{agentId:e,name:s?.name,className:"size-3.5 rounded-full"}),s?.name||e,(0,t.jsx)("button",{type:"button",onClick:()=>ep(e),className:"hover:text-destructive",children:(0,t.jsx)(x.X,{className:"size-3"})})]},e)})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,t.jsx)(l.Button,{variant:"outline",onClick:()=>V(null),children:f("cancel")}),(0,t.jsx)(l.Button,{onClick:eh,children:f("confirm")})]})]})]})}),(0,t.jsx)(n.Dialog,{open:ei,onOpenChange:en,children:(0,t.jsxs)(n.DialogContent,{className:"sm:max-w-lg",children:[(0,t.jsxs)(n.DialogHeader,{children:[(0,t.jsx)(n.DialogTitle,{children:h("syncTitle")}),(0,t.jsx)(n.DialogDescription,{children:h("syncDescription")})]}),(0,t.jsxs)("div",{className:"space-y-3 pt-2",children:[0===ee.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-8 text-muted-foreground text-sm",children:h("syncEmpty")}):(0,t.jsx)(o.ScrollArea,{className:"max-h-72",children:(0,t.jsx)("div",{className:"space-y-1",children:ee.map(e=>{let s=`${e.agentId}::${e.skillName}`;return(0,t.jsxs)("button",{type:"button",onClick:()=>{var t,s;let a;return t=e.agentId,s=e.skillName,a=`${t}::${s}`,void ea(e=>{let t=new Set(e);return t.has(a)?t.delete(a):t.add(a),t})},className:"flex items-center gap-3 w-full px-2 py-1.5 rounded-md hover:bg-muted text-left text-sm transition-colors",children:[(0,t.jsx)("div",{className:(0,p.cn)("flex items-center justify-center size-4 rounded border shrink-0",es.has(s)?"bg-primary border-primary text-primary-foreground":"border-input")}),(0,t.jsx)(v.AgentIcon,{agentId:e.agentId,name:e.agentName,className:"size-5 rounded-full"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.agentName}),(0,t.jsxs)("span",{className:"text-muted-foreground text-xs shrink-0",children:[e.skillName,".md"]})]},s)})})}),ee.length>0&&(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,t.jsx)(l.Button,{variant:"outline",onClick:()=>en(!1),children:f("cancel")}),(0,t.jsx)(l.Button,{onClick:eg,disabled:0===es.size,children:h("syncConfirm")})]})]})]})})]})}],625873)},678001,e=>{e.v(t=>Promise.all(["static/chunks/0zl19l5tuoppw.js"].map(t=>e.l(t))).then(()=>t(228394)))},863812,e=>{e.v(t=>Promise.all(["static/chunks/168ojsxhm7ypc.js"].map(t=>e.l(t))).then(()=>t(158480)))}]);
@@ -0,0 +1,31 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,893300,(e,t,r)=>{var n={229:function(e){var t,r,n,o=e.exports={};function i(){throw Error("setTimeout has not been defined")}function u(){throw Error("clearTimeout has not been defined")}try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(e){r=u}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}var a=[],c=!1,l=-1;function f(){c&&n&&(c=!1,n.length?a=n.concat(a):l=-1,a.length&&d())}function d(){if(!c){var e=s(f);c=!0;for(var t=a.length;t;){for(n=a,a=[];++l<t;)n&&n[l].run();l=-1,t=a.length}n=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function y(){}o.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];a.push(new p(e,t)),1!==a.length||c||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(e){return[]},o.binding=function(e){throw Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw Error("process.chdir is not supported")},o.umask=function(){return 0}}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}},u=!0;try{n[e](r,r.exports,i),u=!1}finally{u&&delete o[e]}return r.exports}i.ab="/ROOT/node_modules/.pnpm/next@16.2.4_@babel+core@7.29.0_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/next/dist/compiled/process/",t.exports=i(229)},8890,(e,t,r)=>{"use strict";var n,o;t.exports=(null==(n=e.g.process)?void 0:n.env)&&"object"==typeof(null==(o=e.g.process)?void 0:o.env)?e.g.process:e.r(893300)},136203,(e,t,r)=>{"use strict";var n=Symbol.for("react.transitional.element");function o(e,t,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==t.key&&(o=""+t.key),"key"in t)for(var i in r={},t)"key"!==i&&(r[i]=t[i]);else r=t;return{$$typeof:n,type:e,key:o,ref:void 0!==(t=r.ref)?t:null,props:r}}r.Fragment=Symbol.for("react.fragment"),r.jsx=o,r.jsxs=o},344180,(e,t,r)=>{"use strict";t.exports=e.r(136203)},627685,(e,t,r)=>{"use strict";var n=e.i(8890),o=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),l=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),h=Symbol.for("react.view_transition"),b=Symbol.iterator,v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,_={};function x(e,t,r){this.props=e,this.context=t,this.refs=_,this.updater=r||v}function S(){}function O(e,t,r){this.props=e,this.context=t,this.refs=_,this.updater=r||v}x.prototype.isReactComponent={},x.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},x.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},S.prototype=x.prototype;var j=O.prototype=new S;j.constructor=O,m(j,x.prototype),j.isPureReactComponent=!0;var E=Array.isArray;function T(){}var w={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function C(e,t,r){var n=r.ref;return{$$typeof:o,type:e,key:t,ref:void 0!==n?n:null,props:r}}function k(e){return"object"==typeof e&&null!==e&&e.$$typeof===o}var A=/\/+/g;function H(e,t){var r,n;return"object"==typeof e&&null!==e&&null!=e.key?(r=""+e.key,n={"=":"=0",":":"=2"},"$"+r.replace(/[=:]/g,function(e){return n[e]})):t.toString(36)}function P(e,t,r){if(null==e)return e;var n=[],u=0;return!function e(t,r,n,u,s){var a,c,l,f=typeof t;("undefined"===f||"boolean"===f)&&(t=null);var d=!1;if(null===t)d=!0;else switch(f){case"bigint":case"string":case"number":d=!0;break;case"object":switch(t.$$typeof){case o:case i:d=!0;break;case y:return e((d=t._init)(t._payload),r,n,u,s)}}if(d)return s=s(t),d=""===u?"."+H(t,0):u,E(s)?(n="",null!=d&&(n=d.replace(A,"$&/")+"/"),e(s,r,n,"",function(e){return e})):null!=s&&(k(s)&&(a=s,c=n+(null==s.key||t&&t.key===s.key?"":(""+s.key).replace(A,"$&/")+"/")+d,s=C(a.type,c,a.props)),r.push(s)),1;d=0;var p=""===u?".":u+":";if(E(t))for(var g=0;g<t.length;g++)f=p+H(u=t[g],g),d+=e(u,r,n,f,s);else if("function"==typeof(g=null===(l=t)||"object"!=typeof l?null:"function"==typeof(l=b&&l[b]||l["@@iterator"])?l:null))for(t=g.call(t),g=0;!(u=t.next()).done;)f=p+H(u=u.value,g++),d+=e(u,r,n,f,s);else if("object"===f){if("function"==typeof t.then)return e(function(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch("string"==typeof e.status?e.then(T,T):(e.status="pending",e.then(function(t){"pending"===e.status&&(e.status="fulfilled",e.value=t)},function(t){"pending"===e.status&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}(t),r,n,u,s);throw Error("Objects are not valid as a React child (found: "+("[object Object]"===(r=String(t))?"object with keys {"+Object.keys(t).join(", ")+"}":r)+"). If you meant to render a collection of children, use an array instead.")}return d}(e,n,"","",function(e){return t.call(r,e,u++)}),n}function M(e){if(-1===e._status){var t=(0,e._result)();t.then(function(r){(0===e._status||-1===e._status)&&(e._status=1,e._result=r,void 0===t.status&&(t.status="fulfilled",t.value=r))},function(r){(0===e._status||-1===e._status)&&(e._status=2,e._result=r,void 0===t.status&&(t.status="rejected",t.reason=r))}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var I="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof n.default&&"function"==typeof n.default.emit)return void n.default.emit("uncaughtException",e);console.error(e)};function L(e){var t=w.T,r={};r.types=null!==t?t.types:null,w.T=r;try{var n=e(),o=w.S;null!==o&&o(r,n),"object"==typeof n&&null!==n&&"function"==typeof n.then&&n.then(T,I)}catch(e){I(e)}finally{null!==t&&null!==r.types&&(t.types=r.types),w.T=t}}function $(e){var t=w.T;if(null!==t){var r=t.types;null===r?t.types=[e]:-1===r.indexOf(e)&&r.push(e)}else L($.bind(null,e))}r.Activity=g,r.Children={map:P,forEach:function(e,t,r){P(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},r.Component=x,r.Fragment=u,r.Profiler=a,r.PureComponent=O,r.StrictMode=s,r.Suspense=d,r.ViewTransition=h,r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,r.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},r.addTransitionType=$,r.cache=function(e){return function(){return e.apply(null,arguments)}},r.cacheSignal=function(){return null},r.cloneElement=function(e,t,r){if(null==e)throw Error("The argument must be a React element, but you passed "+e+".");var n=m({},e.props),o=e.key;if(null!=t)for(i in void 0!==t.key&&(o=""+t.key),t)R.call(t,i)&&"key"!==i&&"__self"!==i&&"__source"!==i&&("ref"!==i||void 0!==t.ref)&&(n[i]=t[i]);var i=arguments.length-2;if(1===i)n.children=r;else if(1<i){for(var u=Array(i),s=0;s<i;s++)u[s]=arguments[s+2];n.children=u}return C(e.type,o,n)},r.createContext=function(e){return(e={$$typeof:l,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider=e,e.Consumer={$$typeof:c,_context:e},e},r.createElement=function(e,t,r){var n,o={},i=null;if(null!=t)for(n in void 0!==t.key&&(i=""+t.key),t)R.call(t,n)&&"key"!==n&&"__self"!==n&&"__source"!==n&&(o[n]=t[n]);var u=arguments.length-2;if(1===u)o.children=r;else if(1<u){for(var s=Array(u),a=0;a<u;a++)s[a]=arguments[a+2];o.children=s}if(e&&e.defaultProps)for(n in u=e.defaultProps)void 0===o[n]&&(o[n]=u[n]);return C(e,i,o)},r.createRef=function(){return{current:null}},r.forwardRef=function(e){return{$$typeof:f,render:e}},r.isValidElement=k,r.lazy=function(e){return{$$typeof:y,_payload:{_status:-1,_result:e},_init:M}},r.memo=function(e,t){return{$$typeof:p,type:e,compare:void 0===t?null:t}},r.startTransition=L,r.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},r.use=function(e){return w.H.use(e)},r.useActionState=function(e,t,r){return w.H.useActionState(e,t,r)},r.useCallback=function(e,t){return w.H.useCallback(e,t)},r.useContext=function(e){return w.H.useContext(e)},r.useDebugValue=function(){},r.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},r.useEffect=function(e,t){return w.H.useEffect(e,t)},r.useEffectEvent=function(e){return w.H.useEffectEvent(e)},r.useId=function(){return w.H.useId()},r.useImperativeHandle=function(e,t,r){return w.H.useImperativeHandle(e,t,r)},r.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},r.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},r.useMemo=function(e,t){return w.H.useMemo(e,t)},r.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},r.useReducer=function(e,t,r){return w.H.useReducer(e,t,r)},r.useRef=function(e){return w.H.useRef(e)},r.useState=function(e){return w.H.useState(e)},r.useSyncExternalStore=function(e,t,r){return w.H.useSyncExternalStore(e,t,r)},r.useTransition=function(){return w.H.useTransition()},r.version="19.3.0-canary-3f0b9e61-20260317"},764556,(e,t,r)=>{"use strict";t.exports=e.r(627685)},251007,(e,t,r)=>{"use strict";var n=e.r(764556);function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var u={d:{f:i,r:function(){throw Error(o(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},s=Symbol.for("react.portal"),a=Symbol.for("react.optimistic_key"),c=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){return"font"===e?"":"string"==typeof t?"use-credentials"===t?t:"":void 0}r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=u,r.createPortal=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!t||1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType)throw Error(o(299));return function(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:s,key:null==n?null:n===a?a:""+n,children:e,containerInfo:t,implementation:r}}(e,t,null,r)},r.flushSync=function(e){var t=c.T,r=u.p;try{if(c.T=null,u.p=2,e)return e()}finally{c.T=t,u.p=r,u.d.f()}},r.preconnect=function(e,t){"string"==typeof e&&(t=t?"string"==typeof(t=t.crossOrigin)?"use-credentials"===t?t:"":void 0:null,u.d.C(e,t))},r.prefetchDNS=function(e){"string"==typeof e&&u.d.D(e)},r.preinit=function(e,t){if("string"==typeof e&&t&&"string"==typeof t.as){var r=t.as,n=l(r,t.crossOrigin),o="string"==typeof t.integrity?t.integrity:void 0,i="string"==typeof t.fetchPriority?t.fetchPriority:void 0;"style"===r?u.d.S(e,"string"==typeof t.precedence?t.precedence:void 0,{crossOrigin:n,integrity:o,fetchPriority:i}):"script"===r&&u.d.X(e,{crossOrigin:n,integrity:o,fetchPriority:i,nonce:"string"==typeof t.nonce?t.nonce:void 0})}},r.preinitModule=function(e,t){if("string"==typeof e)if("object"==typeof t&&null!==t){if(null==t.as||"script"===t.as){var r=l(t.as,t.crossOrigin);u.d.M(e,{crossOrigin:r,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0})}}else null==t&&u.d.M(e)},r.preload=function(e,t){if("string"==typeof e&&"object"==typeof t&&null!==t&&"string"==typeof t.as){var r=t.as,n=l(r,t.crossOrigin);u.d.L(e,r,{crossOrigin:n,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0,type:"string"==typeof t.type?t.type:void 0,fetchPriority:"string"==typeof t.fetchPriority?t.fetchPriority:void 0,referrerPolicy:"string"==typeof t.referrerPolicy?t.referrerPolicy:void 0,imageSrcSet:"string"==typeof t.imageSrcSet?t.imageSrcSet:void 0,imageSizes:"string"==typeof t.imageSizes?t.imageSizes:void 0,media:"string"==typeof t.media?t.media:void 0})}},r.preloadModule=function(e,t){if("string"==typeof e)if(t){var r=l(t.as,t.crossOrigin);u.d.m(e,{as:"string"==typeof t.as&&"script"!==t.as?t.as:void 0,crossOrigin:r,integrity:"string"==typeof t.integrity?t.integrity:void 0})}else u.d.m(e)},r.requestFormReset=function(e){u.d.r(e)},r.unstable_batchedUpdates=function(e,t){return e(t)},r.useFormState=function(e,t,r){return c.H.useFormState(e,t,r)},r.useFormStatus=function(){return c.H.useHostTransitionStatus()},r.version="19.3.0-canary-3f0b9e61-20260317"},106206,(e,t,r)=>{"use strict";!function e(){if("u">typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),t.exports=e.r(251007)},481258,(e,t,r)=>{"use strict";r._=function(e){return e&&e.__esModule?e:{default:e}}},64791,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={bindSnapshot:function(){return c},createAsyncLocalStorage:function(){return a},createSnapshot:function(){return l}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let i=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class u{disable(){throw i}getStore(){}run(){throw i}exit(){throw i}enterWith(){throw i}static bind(e){return e}}let s="u">typeof globalThis&&globalThis.AsyncLocalStorage;function a(){return s?new s:new u}function c(e){return s?s.bind(e):u.bind(e)}function l(){return s?s.snapshot():function(e,...t){return e(...t)}}},12267,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"workAsyncStorageInstance",{enumerable:!0,get:function(){return n}});let n=(0,e.r(64791).createAsyncLocalStorage)()},94932,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"workAsyncStorage",{enumerable:!0,get:function(){return n.workAsyncStorageInstance}});let n=e.r(12267)},745137,(e,t,r)=>{"use strict";let n;Object.defineProperty(r,"__esModule",{value:!0});var o={getAssetToken:function(){return a},getAssetTokenQuery:function(){return c},getDeploymentId:function(){return u},getDeploymentIdQuery:function(){return s}};for(var i in o)Object.defineProperty(r,i,{enumerable:!0,get:o[i]});function u(){return n}function s(e=!1){let t=n;return t?`${e?"&":"?"}dpl=${t}`:""}function a(){return!1}function c(e=!1){return""}"u">typeof window?(n=document.documentElement.dataset.dplId,delete document.documentElement.dataset.dplId):n=void 0},549424,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"handleISRError",{enumerable:!0,get:function(){return o}});let n="u"<typeof window?e.r(94932).workAsyncStorage:void 0;function o({error:e}){if(n){let t=n.getStore();if(t?.isStaticGeneration)throw e&&console.error(e),e}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},801149,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={WarningIcon:function(){return a},errorStyles:function(){return u},errorThemeCss:function(){return s}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});e.r(481258);let i=e.r(344180);e.r(764556);let u={container:{fontFamily:'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',height:"100vh",display:"flex",alignItems:"center",justifyContent:"center"},card:{marginTop:"-32px",maxWidth:"325px",padding:"32px 28px",textAlign:"left"},icon:{marginBottom:"24px"},title:{fontSize:"24px",fontWeight:500,letterSpacing:"-0.02em",lineHeight:"32px",margin:"0 0 12px 0",color:"var(--next-error-title)"},message:{fontSize:"14px",fontWeight:400,lineHeight:"21px",margin:"0 0 20px 0",color:"var(--next-error-message)"},form:{margin:0},buttonGroup:{display:"flex",gap:"8px",alignItems:"center"},button:{display:"inline-flex",alignItems:"center",justifyContent:"center",height:"32px",padding:"0 12px",fontSize:"14px",fontWeight:500,lineHeight:"20px",borderRadius:"6px",cursor:"pointer",color:"var(--next-error-btn-text)",background:"var(--next-error-btn-bg)",border:"var(--next-error-btn-border)"},buttonSecondary:{display:"inline-flex",alignItems:"center",justifyContent:"center",height:"32px",padding:"0 12px",fontSize:"14px",fontWeight:500,lineHeight:"20px",borderRadius:"6px",cursor:"pointer",color:"var(--next-error-btn-secondary-text)",background:"var(--next-error-btn-secondary-bg)",border:"var(--next-error-btn-secondary-border)"},digestFooter:{position:"fixed",bottom:"32px",left:"0",right:"0",textAlign:"center",fontFamily:'ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,monospace',fontSize:"12px",lineHeight:"18px",fontWeight:400,margin:"0",color:"var(--next-error-digest)"}},s=`
2
+ :root {
3
+ --next-error-bg: #fff;
4
+ --next-error-text: #171717;
5
+ --next-error-title: #171717;
6
+ --next-error-message: #171717;
7
+ --next-error-digest: #666666;
8
+ --next-error-btn-text: #fff;
9
+ --next-error-btn-bg: #171717;
10
+ --next-error-btn-border: none;
11
+ --next-error-btn-secondary-text: #171717;
12
+ --next-error-btn-secondary-bg: transparent;
13
+ --next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);
14
+ }
15
+ @media (prefers-color-scheme: dark) {
16
+ :root {
17
+ --next-error-bg: #0a0a0a;
18
+ --next-error-text: #ededed;
19
+ --next-error-title: #ededed;
20
+ --next-error-message: #ededed;
21
+ --next-error-digest: #a0a0a0;
22
+ --next-error-btn-text: #0a0a0a;
23
+ --next-error-btn-bg: #ededed;
24
+ --next-error-btn-border: none;
25
+ --next-error-btn-secondary-text: #ededed;
26
+ --next-error-btn-secondary-bg: transparent;
27
+ --next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);
28
+ }
29
+ }
30
+ body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }
31
+ `.replace(/\n\s*/g,"");function a(){return(0,i.jsx)("svg",{width:"32",height:"32",viewBox:"-0.2 -1.5 32 32",fill:"none",style:u.icon,children:(0,i.jsx)("path",{d:"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z",fill:"var(--next-error-title)"})})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},785502,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return u}}),e.r(481258);let n=e.r(344180);e.r(764556);let o=e.r(549424),i=e.r(801149),u=function({error:e}){let t=e?.digest,r=!!t;return(0,o.handleISRError)({error:e}),(0,n.jsxs)("html",{id:"__next_error__",children:[(0,n.jsx)("head",{children:(0,n.jsx)("style",{dangerouslySetInnerHTML:{__html:i.errorThemeCss}})}),(0,n.jsxs)("body",{children:[(0,n.jsx)("div",{style:i.errorStyles.container,children:(0,n.jsxs)("div",{style:i.errorStyles.card,children:[(0,n.jsx)(i.WarningIcon,{}),(0,n.jsx)("h1",{style:i.errorStyles.title,children:"This page couldn’t load"}),(0,n.jsx)("p",{style:i.errorStyles.message,children:r?"A server error occurred. Reload to try again.":"Reload to try again, or go back."}),(0,n.jsxs)("div",{style:i.errorStyles.buttonGroup,children:[(0,n.jsx)("form",{style:i.errorStyles.form,children:(0,n.jsx)("button",{type:"submit",style:i.errorStyles.button,children:"Reload"})}),!r&&(0,n.jsx)("button",{type:"button",style:i.errorStyles.buttonSecondary,onClick:()=>{window.history.length>1?window.history.back():window.location.href="/"},children:"Back"})]})]})}),t&&(0,n.jsxs)("p",{style:i.errorStyles.digestFooter,children:["ERROR ",t]})]})]})};("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,769178,e=>{"use strict";var t=e.i(344180),s=e.i(799543),i=e.i(260218),a=e.i(767467);e.s(["SettingsPageLayout",0,function({title:e,children:n}){let l=(0,s.useRouter)();return(0,t.jsxs)("div",{className:"h-full flex flex-col",children:[(0,t.jsxs)("header",{className:"flex items-center gap-2 px-4 py-3 border-b shrink-0",children:[(0,t.jsx)(i.Button,{variant:"ghost",size:"icon",onClick:()=>l.back(),children:(0,t.jsx)(a.ArrowLeft,{className:"size-4"})}),(0,t.jsx)("h1",{className:"text-base font-medium",children:e})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:n})]})}])},660965,e=>{"use strict";var t=e.i(344180),s=e.i(244073),i=e.i(769178),a=e.i(588591);e.s(["default",0,function(){let e=(0,s.useTranslations)("agent");return(0,t.jsx)(i.SettingsPageLayout,{title:e("dialog.title"),children:(0,t.jsx)(a.AgentDialog,{open:!0,onOpenChange:()=>{},standalone:!0})})}])}]);
@@ -0,0 +1,2 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,86477,e=>{"use strict";var t,n=e.i(344180),r=e.i(764556),l=e.i(244073),i=e.i(209988),a=e.i(260218),s=e.i(681622);e.s([],885864),e.i(885864),e.i(8890);var o=e.i(526850),u=e.i(535270),d=e.i(29905),c=e.i(106045),m=e.i(277642),f=e.i(602453),p=e.i(638144),h=e.i(139236),x=e.i(969490),v=e.i(464111);function g(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}var b=e.i(410421),y=e.i(756432),N=e.i(125231),j=e.i(975698),E=e.i(380414),C=e.i(443124);function k(e,t){return e-t}function w(e,t,n,r,l,i){var a;let s,o=e;return o=(0,v.clamp)(o,n,r),l&&(a=(0,v.clamp)(o,i[t-1]||-1/0,i[t+1]||1/0),(s=i.slice())[t]=a,o=s.sort(k)),o}function R(e,t,n){return!Array.isArray(e)||Math.min(...e.reduce((e,t,n,r)=>(n===r.length-1||e.push(Math.abs(t-r[n+1])),e),[]))>=t*n}let I={activeThumbIndex:()=>null,max:()=>null,min:()=>null,minStepsBetweenValues:()=>null,step:()=>null,values:()=>null,...e.i(438904).fieldValidityMapping};var S=e.i(267805);let A=r.createContext(void 0);function M(){let e=r.useContext(A);if(void 0===e)throw Error((0,S.default)(62));return e}var P=e.i(742665);let T=r.forwardRef(function(e,t){let{"aria-labelledby":l,className:i,defaultValue:a,disabled:s=!1,id:S,format:M,largeStep:T=10,locale:D,render:O,max:F=100,min:$=0,minStepsBetweenValues:L=0,form:B,name:V,onValueChange:z,onValueCommitted:W,orientation:H="horizontal",step:K=1,thumbCollisionBehavior:_="push",thumbAlignment:U="center",value:q,style:G,...Y}=e,X=(0,h.useBaseUiId)(S),J=null==X?void 0:`${X}-label`,Q=(0,d.useStableCallback)(z),Z=(0,d.useStableCallback)(W),{clearErrors:ee}=(0,E.useFormContext)(),{state:et,disabled:en,name:er,setTouched:el,setDirty:ei,validityData:ea,shouldValidateOnChange:es,validation:eo}=(0,N.useFieldRootContext)(),{labelId:eu}=(0,C.useLabelableContext)(),[ed,ec]=r.useState(),em=l??eu??ed,ef=en||s,ep=er??V,[eh,ex]=(0,u.useControlled)({controlled:q,default:a??$,name:"Slider"}),ev=r.useRef(null),eg=r.useRef(null),eb=r.useRef([]),ey=r.useRef(null),eN=r.useRef(null),ej=r.useRef(-1),eE=r.useRef(null),eC=r.useRef(null),ek=r.useRef("none"),ew=(0,c.useValueAsRef)(M),[eR,eI]=r.useState(-1),[eS,eA]=r.useState(-1),[eM,eP]=r.useState(!1),[eT,eD]=r.useState(()=>new Map),[eO,eF]=r.useState([void 0,void 0]),e$=(0,d.useStableCallback)(e=>{eI(e),-1!==e&&eA(e)});(0,j.useRegisterFieldControl)(eg,{id:X,value:eh}),(0,p.useValueChanged)(eh,()=>{ee(ep),es()?eo.commit(eh):eo.commit(eh,!0);let e=ea.initialValue;ei(Array.isArray(eh)&&Array.isArray(e)?!g(eh,e):eh!==e)});let eL=(0,d.useStableCallback)(e=>{e&&(eg.current=e)}),eB=Array.isArray(eh),eV=r.useMemo(()=>eB?eh.slice().sort(k):[(0,v.clamp)(eh,$,F)],[F,$,eB,eh]),ez=(0,d.useStableCallback)((e,t)=>{if(Number.isNaN(e)||("number"==typeof e&&"number"==typeof eh?e===eh:!!(Array.isArray(e)&&Array.isArray(eh))&&g(e,eh)))return;let n=t??(0,f.createChangeEventDetails)(P.REASONS.none,void 0,void 0,{activeThumbIndex:-1});ek.current=n.reason;let r=n.event,l=new(r.constructor??Event)(r.type,r);Object.defineProperty(l,"target",{writable:!0,value:{value:e,name:ep}}),n.event=l,eC.current=e,Q(e,n),n.isCanceled||ex(e)}),eW=(0,d.useStableCallback)((e,t,n)=>{let r=w(e,t,$,F,eB,eV);if(R(r,K,L)){let e="key"in n?P.REASONS.keyboard:P.REASONS.inputChange;ez(r,(0,f.createChangeEventDetails)(e,n.nativeEvent,void 0,{activeThumbIndex:t})),el(!0),Z(eC.current??r,(0,f.createGenericEventDetails)(e,n.nativeEvent))}});(0,m.useIsoLayoutEffect)(()=>{let e=(0,b.activeElement)((0,o.ownerDocument)(ev.current));ef&&(0,b.contains)(ev.current,e)&&e.blur()},[ef]),ef&&-1!==eR&&e$(-1);let eH=r.useMemo(()=>({...et,activeThumbIndex:eR,disabled:ef,dragging:eM,orientation:H,max:F,min:$,minStepsBetweenValues:L,step:K,values:eV}),[et,eR,ef,eM,F,$,L,H,K,eV]),eK=r.useMemo(()=>({active:eR,controlRef:eg,disabled:ef,dragging:eM,validation:eo,formatOptionsRef:ew,handleInputChange:eW,indicatorPosition:eO,inset:"center"!==U,labelId:em,rootLabelId:J,largeStep:T,lastUsedThumbIndex:eS,lastChangedValueRef:eC,lastChangeReasonRef:ek,form:B,locale:D,max:F,min:$,minStepsBetweenValues:L,name:ep,onValueCommitted:Z,orientation:H,pressedInputRef:ey,pressedThumbCenterOffsetRef:eN,pressedThumbIndexRef:ej,pressedValuesRef:eE,registerFieldControlRef:eL,renderBeforeHydration:"edge"===U,setActive:e$,setDragging:eP,setIndicatorPosition:eF,setLabelId:ec,setValue:ez,state:eH,step:K,thumbCollisionBehavior:_,thumbMap:eT,thumbRefs:eb,values:eV}),[eR,eg,em,J,ef,eM,eo,ew,eW,eO,T,eS,eC,ek,B,D,F,$,L,ep,Z,H,ey,eN,ej,eE,eL,e$,eP,eF,ec,ez,eH,K,_,U,eT,eb,eV]),e_=(0,x.useRenderElement)("div",e,{state:eH,ref:[t,ev],props:[{"aria-labelledby":em,id:X,role:"group"},eo.getValidationProps,Y],stateAttributesMapping:I});return(0,n.jsx)(A.Provider,{value:eK,children:(0,n.jsx)(y.CompositeList,{elementsRef:eb,onMapChange:eD,children:e_})})});var D=e.i(92615),O=e.i(213700);let F=r.forwardRef(function(e,t){let{render:n,className:r,style:l,...i}=e;delete i.id;let{state:a,setLabelId:s,controlRef:u,rootLabelId:d}=M(),c=(0,O.useLabel)({id:d,setLabelId:s,focusControl:function(e,t){if(t){let n=(0,o.ownerDocument)(e.currentTarget).getElementById(t);if((0,D.isHTMLElement)(n))return void(0,O.focusElementWithVisible)(n)}let n=u.current?.querySelectorAll('input[type="range"]'),r=n?.length===1?n[0]:null;(0,D.isHTMLElement)(r)&&(0,O.focusElementWithVisible)(r)}});return(0,x.useRenderElement)("div",e,{ref:t,state:a,props:[c,i],stateAttributesMapping:I})});var $=e.i(842809);let L=r.forwardRef(function(e,t){let{"aria-live":n="off",render:l,className:i,children:a,style:s,...o}=e,{thumbMap:u,state:d,values:c,formatOptionsRef:m,locale:f}=M(),p=r.useMemo(()=>{let e="";for(let t of u.values())t?.inputId&&(e+=`${t.inputId} `);return""===e.trim()?void 0:e.trim()},[u]),h=r.useMemo(()=>{let e=[];for(let t=0;t<c.length;t+=1)e.push((0,$.formatNumber)(c[t],f,m.current??void 0));return e},[m,f,c]),v=r.useMemo(()=>{let e=[];for(let t=0;t<c.length;t+=1)e.push(h[t]||c[t]);return e.join(" – ")},[c,h]);return(0,x.useRenderElement)("output",e,{state:d,ref:t,props:[{"aria-live":n,children:"function"==typeof a?a(h,c):v,htmlFor:p},o],stateAttributesMapping:I})});var B=e.i(422561),V=e.i(859092),z=e.i(189131);function W(e){let t=e.getBoundingClientRect();return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function H(e){if(0===e)return 0;if(1>Math.abs(e)){let t=e.toExponential().split("e-"),n=t[0].split(".")[1];return(n?n.length:0)+parseInt(t[1],10)}let t=e.toString().split(".")[1];return t?t.length:0}function K(e,t,n){return Number((Math.round((e-n)/t)*t+n).toFixed(Math.max(H(t),H(n))))}function _({values:e,index:t,nextValue:n,min:r,max:l,step:i,minStepsBetweenValues:a,initialValues:s}){if(0===e.length)return[];let o=e.slice(),u=i*a,d=o.length-1,c=s??e;o[t]=(0,v.clamp)(n,r+t*u,l-(d-t)*u);for(let e=t+1;e<=d;e+=1){let t=o[e-1]+u,n=l-(d-e)*u,r=c[e]??o[e],i=Math.max(o[e],t);r<i&&(i=Math.max(r,t)),o[e]=(0,v.clamp)(i,t,n)}for(let e=t-1;e>=0;e-=1){let t=o[e+1]-u,n=r+e*u,l=c[e]??o[e],i=Math.min(o[e],t);l>i&&(i=Math.min(l,t)),o[e]=(0,v.clamp)(i,n,t)}for(let e=0;e<=d;e+=1)o[e]=Number(o[e].toFixed(12));return o}function U(e,t){if(null!=t.current&&e.changedTouches){for(let n=0;n<e.changedTouches.length;n+=1){let r=e.changedTouches[n];if(r.identifier===t.current)return{x:r.clientX,y:r.clientY}}return null}return{x:e.clientX,y:e.clientY}}let q=r.forwardRef(function(e,t){let{render:n,className:l,style:i,...a}=e,{disabled:s,dragging:u,inset:m,lastChangedValueRef:p,lastChangeReasonRef:h,max:g,min:y,minStepsBetweenValues:N,onValueCommitted:j,orientation:E,pressedInputRef:C,pressedThumbCenterOffsetRef:k,pressedThumbIndexRef:w,pressedValuesRef:S,registerFieldControlRef:A,renderBeforeHydration:T,setActive:O,setDragging:F,setValue:$,state:L,step:H,thumbCollisionBehavior:q,thumbRefs:G,values:Y}=M(),X=(0,z.useDirection)(),J=Y.length>1,Q="vertical"===E,Z=r.useRef(null),ee=r.useRef(null),et=(0,d.useStableCallback)(e=>{e&&null==ee.current&&null==ee.current&&(ee.current=getComputedStyle(e))}),en=r.useRef(null),er=r.useRef(0),el=r.useRef(0),ei=(0,c.useValueAsRef)(Y),ea=(0,d.useStableCallback)(e=>{w.current!==e&&(w.current=e);let t=G.current[e];if(!t){k.current=null,C.current=null;return}C.current=t.querySelector('input[type="range"]')}),es=(0,d.useStableCallback)(e=>{let t=Z.current;if(!t)return null;let{width:n,height:r,bottom:l,left:i,right:a}=t.getBoundingClientRect(),s=function(e,t){if(!e)return{start:0,end:0};function n(e){let t=null!=e?parseFloat(e):0;return Number.isNaN(t)?0:t}let r=t?"Top":"InlineStart",l=t?"Bottom":"InlineEnd";return{start:n(e[`border${r}Width`])+n(e[`padding${r}`]),end:n(e[`border${l}Width`])+n(e[`padding${l}`])}}(ee.current,Q),o=el.current,u=(Q?r:n)-s.start-s.end-2*o,d=k.current??0,c=e.x-d,m=e.y-d,f=Q?l-m-s.end:("rtl"===X?a-c:c-i)-s.start,p=(g-y)*(0,v.clamp)((f-o)/u,0,1)+y;if(p=K(p,H,y),p=(0,v.clamp)(p,y,g),!J)return{value:p,thumbIndex:0,didSwap:!1};let h=w.current;if(h<0)return null;let x=function({behavior:e,values:t,currentValues:n,initialValues:r,pressedIndex:l,nextValue:i,min:a,max:s,step:o,minStepsBetweenValues:u}){let d=n??t,c=r??t;if(!(d.length>1))return{value:i,thumbIndex:0,didSwap:!1};let m=o*u;switch(e){case"swap":{let e=d[l],t=d.slice(),n=t[l-1],r=t[l+1],f=null!=n?n+m:a,p=null!=r?r-m:s,h=Number((0,v.clamp)(i,f,p).toFixed(12));t[l]=h;let x=i>e,g=i<e,b=x&&null!=r&&i>=r-1e-7,y=g&&null!=n&&i<=n+1e-7;if(!b&&!y)return{value:t,thumbIndex:l,didSwap:!1};let N=b?l+1:l-1,j=t.map((e,t)=>{if(t===l)return h;let n=c[t];return null!=n?n:d[t]}),E=i;E=b?Math.max(i,t[N]):Math.min(i,t[N]);let C=_({values:t,index:N,nextValue:E,min:a,max:s,step:o,minStepsBetweenValues:u,initialValues:j}),k=b?N-1:N+1;if(k>=0&&k<C.length){let e=C[k-1],t=C[k+1],n=null!=e?e+m:a;n=Math.max(n,a+k*m);let r=null!=t?t-m:s;r=Math.min(r,s-(C.length-1-k)*m);let l=(0,v.clamp)(h,n,r);C[k]=Number(l.toFixed(12))}return{value:C,thumbIndex:N,didSwap:!0}}case"push":return{value:_({values:d,index:l,nextValue:i,min:a,max:s,step:o,minStepsBetweenValues:u}),thumbIndex:l,didSwap:!1};default:{let e=d.slice(),t=e[l-1],n=e[l+1],r=null!=t?t+m:a,o=null!=n?n-m:s,u=(0,v.clamp)(i,r,o);return e[l]=Number(u.toFixed(12)),{value:e,thumbIndex:l,didSwap:!1}}}}({behavior:q,values:Y,currentValues:ei.current??Y,initialValues:S.current,pressedIndex:h,nextValue:p,min:y,max:g,step:H,minStepsBetweenValues:N});return"swap"===q&&x.didSwap?ea(x.thumbIndex):w.current=x.thumbIndex,x}),eo=(0,d.useStableCallback)(e=>{S.current=J?Y.slice():null,ei.current=Y;let t=w.current,n=t;if(t>-1&&t<Y.length){if(Y[t]===g){let e=t;for(;e>0&&Y[e-1]===g;)e-=1;n=e}}else{let t,r=Q?"y":"x";n=-1;for(let l=0;l<G.current.length;l+=1){let i=G.current[l];if((0,D.isElement)(i)){let a=W(i),s=Math.abs(e[r]-a[r]);(void 0===t||s<=t)&&(n=l,t=s)}}}if(n>-1&&n!==t&&ea(n),m){let e=G.current[n];(0,D.isElement)(e)&&(el.current=e.getBoundingClientRect()[Q?"height":"width"]/2)}}),eu=(0,d.useStableCallback)(e=>{let t=G.current?.[e]?.querySelector('input[type="range"]');t&&t.focus({preventScroll:!0,focusVisible:!1})}),ed=(0,d.useStableCallback)(e=>{let t=U(e,en);if(null==t)return;if(er.current+=1,"pointermove"===e.type&&0===e.buttons)return void ec(e);let n=es(t);null!=n&&R(n.value,H,N)&&(!u&&er.current>2&&F(!0),$(n.value,(0,f.createChangeEventDetails)(P.REASONS.drag,e,void 0,{activeThumbIndex:n.thumbIndex})),ei.current=Array.isArray(n.value)?n.value:[n.value],n.didSwap&&eu(n.thumbIndex))});function ec(e){O(-1),F(!1),C.current=null,k.current=null;let t=U(e,en),n=null!=t?es(t):null;if(null!=n){let t=h.current;j(p.current??n.value,(0,f.createGenericEventDetails)(t,e))}"pointerType"in e&&Z.current?.hasPointerCapture(e.pointerId)&&Z.current?.releasePointerCapture(e.pointerId),w.current=-1,en.current=null,S.current=null,ef()}let em=(0,d.useStableCallback)(e=>{if(s)return;let t=e.changedTouches[0];null!=t&&(en.current=t.identifier);let n=U(e,en);if(null!=n){eo(n);let t=es(n);if(null==t)return;eu(t.thumbIndex),$(t.value,(0,f.createChangeEventDetails)(P.REASONS.trackPress,e,void 0,{activeThumbIndex:t.thumbIndex})),ei.current=Array.isArray(t.value)?t.value:[t.value],t.didSwap&&eu(t.thumbIndex)}er.current=0;let r=(0,o.ownerDocument)(Z.current);r.addEventListener("touchmove",ed,{passive:!0}),r.addEventListener("touchend",ec,{passive:!0})}),ef=(0,d.useStableCallback)(()=>{let e=(0,o.ownerDocument)(Z.current);e.removeEventListener("pointermove",ed),e.removeEventListener("pointerup",ec),e.removeEventListener("touchmove",ed),e.removeEventListener("touchend",ec),S.current=null}),ep=(0,V.useAnimationFrame)();return r.useEffect(()=>{let e=Z.current;if(!e)return()=>ef();let t=(0,B.addEventListener)(e,"touchstart",em,{passive:!0});return()=>{t(),ep.cancel(),ef()}},[ef,em,Z,ep]),r.useEffect(()=>{s&&ef()},[s,ef]),(0,x.useRenderElement)("div",e,{state:L,ref:[t,A,Z,et],props:[{"data-base-ui-slider-control":T?"":void 0,onPointerDown(e){let t=Z.current,n=(0,b.getTarget)(e.nativeEvent);if(!t||s||e.defaultPrevented||!(0,D.isElement)(n)||0!==e.button)return;let r=U(e,en);if(null!=r){eo(r);let n=es(r);if(null==n)return;(0,b.contains)(G.current[n.thumbIndex],(0,b.activeElement)((0,o.ownerDocument)(t)))?e.preventDefault():ep.request(()=>{eu(n.thumbIndex)}),F(!0),null==k.current&&($(n.value,(0,f.createChangeEventDetails)(P.REASONS.trackPress,e.nativeEvent,void 0,{activeThumbIndex:n.thumbIndex})),ei.current=Array.isArray(n.value)?n.value:[n.value],n.didSwap&&eu(n.thumbIndex))}e.nativeEvent.pointerId&&t.setPointerCapture(e.nativeEvent.pointerId),er.current=0;let l=(0,o.ownerDocument)(Z.current);l.addEventListener("pointermove",ed,{passive:!0}),l.addEventListener("pointerup",ec,{once:!0})}},a],stateAttributesMapping:I})}),G=r.forwardRef(function(e,t){let{render:n,className:r,style:l,...i}=e,{state:a}=M();return(0,x.useRenderElement)("div",e,{state:a,ref:t,props:[{style:{position:"relative"}},i],stateAttributesMapping:I})});var Y=e.i(204133),X=e.i(236706),J=e.i(370383),Q=e.i(517432),Z=e.i(203922),ee=e.i(100229),et=e.i(296615),en=e.i(394394),er=e.i(922970),el=e.i(575665);let ei=((t={}).index="data-index",t.dragging="data-dragging",t.orientation="data-orientation",t.disabled="data-disabled",t.valid="data-valid",t.invalid="data-invalid",t.touched="data-touched",t.dirty="data-dirty",t.focused="data-focused",t),ea=new Set([ee.ARROW_UP,ee.ARROW_DOWN,ee.ARROW_LEFT,ee.ARROW_RIGHT,ee.HOME,ee.END,ee.PAGE_UP,ee.PAGE_DOWN]);function es(e,t,n,r,l){let i=Number((1===n?e+t:e-t).toFixed(Math.max(H(e),H(t),H(r))));return(0,v.clamp)(i,r,l)}let eo=r.forwardRef(function(e,t){let l,{render:i,children:a,className:s,"aria-describedby":o,"aria-label":u,"aria-labelledby":c,disabled:f=!1,getAriaLabel:p,getAriaValueText:v,id:g,index:b,inputRef:y,onBlur:j,onFocus:E,onKeyDown:C,tabIndex:k,style:R,...S}=e,{nonce:A}=(0,en.useCSPContext)(),P=(0,h.useBaseUiId)(g),{active:T,lastUsedThumbIndex:D,controlRef:O,disabled:F,validation:L,formatOptionsRef:B,handleInputChange:V,inset:H,labelId:_,largeStep:U,locale:q,max:G,min:eo,minStepsBetweenValues:eu,form:ed,name:ec,orientation:em,pressedInputRef:ef,pressedThumbCenterOffsetRef:ep,pressedThumbIndexRef:eh,renderBeforeHydration:ex,setActive:ev,setIndicatorPosition:eg,state:eb,step:ey,values:eN}=M(),ej=(0,z.useDirection)(),eE=eN.length>1,eC="vertical"===em,ek="rtl"===ej,{setTouched:ew,setFocused:eR,validationMode:eI}=(0,N.useFieldRootContext)(),eS=r.useRef(null),eA=r.useRef(null),eM=r.useRef(!1),eP=(0,h.useBaseUiId)(),eT=(0,el.useLabelableId)(),eD=eE?eP:eT,eO=r.useMemo(()=>({inputId:eD}),[eD]),{ref:eF,index:e$}=(0,et.useCompositeListItem)({metadata:eO}),eL=eE?b??e$:0,eB=eL===eN.length-1,eV=eN[eL],ez=(0,Z.valueToPercent)(eV,eo,G),[eW,eH]=r.useState(),eK=(0,Q.useIsHydrating)(),e_=D>=0&&D<eN.length?D:-1,eU=(0,d.useStableCallback)(()=>{let e=O.current,t=eS.current;if(!e||!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),l=eC?"height":"width",i=r[l]-n[l],a=(n[l]/2+i*ez/100)/r[l]*100,s=Number.isFinite(a)?a:void 0;eH(s),0===eL?eg(e=>[s,e[1]]):eB&&eg(e=>[e[0],s])});(0,m.useIsoLayoutEffect)(()=>{H&&queueMicrotask(eU)},[eU,H]),(0,m.useIsoLayoutEffect)(()=>{H&&eU()},[eU,H,ez]),(0,m.useIsoLayoutEffect)(()=>{if(!H||"function"!=typeof ResizeObserver)return;let e=O.current,t=eS.current;if(!e||!t)return;let n=new ResizeObserver(eU);return n.observe(e),n.observe(t),()=>{n.disconnect()}},[O,eU,H]);let eq=r.useCallback(()=>{let e,t=eC?"bottom":"insetInlineStart",n=eC?"left":"top";return(eE?T===eL?e=2:e_===eL&&(e=1):T===eL&&(e=1),H)?{"--position":`${eW??0}%`,visibility:ex&&eK||void 0===eW?"hidden":void 0,position:"absolute",[t]:"var(--position)",[n]:"50%",translate:`${(eC||!ek?-1:1)*50}% ${(eC?1:-1)*50}%`,zIndex:e}:Number.isFinite(ez)?{position:"absolute",[t]:`${ez}%`,[n]:"50%",translate:`${(eC||!ek?-1:1)*50}% ${(eC?1:-1)*50}%`,zIndex:e}:X.visuallyHidden},[T,eL,H,eK,eW,eE,ex,ek,e_,ez,eC]);"vertical"===em&&(l=ek?"vertical-rl":"vertical-lr");let eG="function"==typeof p?p(eL):u,eY=(0,J.mergeProps)({"aria-label":eG,"aria-labelledby":c??(null==eG?_:void 0),"aria-describedby":o,"aria-orientation":em,"aria-valuenow":eV,"aria-valuetext":"function"==typeof v?v((0,$.formatNumber)(eV,q,B.current??void 0),eV,eL):function(e,t,n,r){if(!(t<0))return 2===e.length?0===t?`${(0,$.formatNumber)(e[t],r,n)} start range`:`${(0,$.formatNumber)(e[t],r,n)} end range`:n?(0,$.formatNumber)(e[t],r,n):void 0}(eN,eL,B.current??void 0,q),disabled:f||F,form:ed,id:eD,max:G,min:eo,name:ec,onChange(e){V(e.currentTarget.valueAsNumber,eL,e)},onFocus(e){let t=eM.current;eM.current=!1,ev(eL),eR(!0),t&&e.stopPropagation()},onBlur(e){eM.current?e.stopPropagation():eS.current&&(ev(-1),ew(!0),eR(!1),"onBlur"===eI&&L.commit(w(eV,eL,eo,G,eE,eN)))},onKeyDown(e){if(!ea.has(e.key))return;ee.COMPOSITE_KEYS.has(e.key)&&e.stopPropagation();let t=null,n=K(eV,ey,eo);switch(e.key){case ee.ARROW_UP:t=es(n,e.shiftKey?U:ey,1,eo,G);break;case ee.ARROW_RIGHT:t=es(n,e.shiftKey?U:ey,ek?-1:1,eo,G);break;case ee.ARROW_DOWN:t=es(n,e.shiftKey?U:ey,-1,eo,G);break;case ee.ARROW_LEFT:t=es(n,e.shiftKey?U:ey,ek?1:-1,eo,G);break;case ee.PAGE_UP:t=es(n,U,1,eo,G);break;case ee.PAGE_DOWN:t=es(n,U,-1,eo,G);break;case ee.END:t=G,eE&&(t=Number.isFinite(eN[eL+1])?eN[eL+1]-ey*eu:G);break;case ee.HOME:t=eo,eE&&(t=Number.isFinite(eN[eL-1])?eN[eL-1]+ey*eu:eo)}if(null!==t){let n=e.currentTarget;(0,er.matchesFocusVisible)(n)||(eM.current=!0,n.blur(),n.focus({preventScroll:!0,focusVisible:!0})),V(t,eL,e),e.preventDefault()}},step:ey,style:{...X.visuallyHidden,width:"100%",height:"100%",writingMode:l},tabIndex:k??void 0,type:"range",value:eV??""},L.getInputValidationProps),eX=(0,Y.useMergedRefs)(eA,L.inputRef,y);return(0,x.useRenderElement)("div",e,{state:eb,ref:[t,eF,eS],props:[{[ei.index]:eL,children:(0,n.jsxs)(r.Fragment,{children:[a,(0,n.jsx)("input",{ref:eX,...eY,suppressHydrationWarning:!0}),H&&eK&&ex&&eB&&(0,n.jsx)("script",{nonce:A,dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript?.parentElement;if(!t)return;const e=t.closest("[data-base-ui-slider-control]");if(!e)return;const r=e.querySelector("[data-base-ui-slider-indicator]"),i=e.getBoundingClientRect(),n="vertical"===e.getAttribute("data-orientation")?"height":"width",o=e.querySelectorAll(\'input[type="range"]\'),l=o.length>1,s=o.length-1;let a=null,u=null;for(let t=0;t<o.length;t+=1){const e=o[t],y=parseFloat(e.getAttribute("value")??"");if(Number.isNaN(y))return;const c=e.parentElement;if(!c)return;const p=parseFloat(e.getAttribute("max")??"100"),g=parseFloat(e.getAttribute("min")??"0"),b=c?.getBoundingClientRect(),d=i[n]-b[n],m=100*(y-g)/(p-g),v=(b[n]/2+d*m/100)/i[n]*100;c.style.setProperty("--position",`${v}%`),Number.isFinite(v)&&(c.style.removeProperty("visibility"),r&&(0===t?(a=v,r.style.setProperty("--start-position",`${v}%`),l||r.style.removeProperty("visibility")):t===s&&(u=v-(a??0),r.style.setProperty("--end-position",`${v}%`),r.style.setProperty("--relative-size",`${u}%`),r.style.removeProperty("visibility"))))}}();'},suppressHydrationWarning:!0})]}),id:P,onBlur:j,onFocus:E,onPointerDown(e){if(eh.current=eL,null!=eS.current){let t="horizontal"===em?"x":"y",n=W(eS.current);ep.current=("horizontal"===em?e.clientX:e.clientY)-n[t]}null!=eA.current&&ef.current!==eA.current&&(ef.current=eA.current)},style:eq(),suppressHydrationWarning:ex||void 0},S],stateAttributesMapping:I})}),eu=r.forwardRef(function(e,t){var n,r;let l,i,a,s,{render:o,className:u,style:d,...c}=e,{indicatorPosition:m,inset:f,max:p,min:h,orientation:v,renderBeforeHydration:g,state:b,values:y}=M(),N=(0,Q.useIsHydrating)(),j="vertical"===v,E=y.length>1,C=f?(n=m[0],r=m[1],l=void 0===n||E&&void 0===r?"hidden":void 0,i=j?"bottom":"insetInlineStart",a=j?"height":"width",((s={visibility:g&&N?"hidden":l,position:j?"absolute":"relative",[j?"width":"height"]:"inherit"})["--start-position"]=`${n??0}%`,E)?(s["--relative-size"]=`${(r??0)-(n??0)}%`,s[i]="var(--start-position)",s[a]="var(--relative-size)"):(s[i]=0,s[a]="var(--start-position)"),s):function(e,t,n,r){let l=e?"bottom":"insetInlineStart",i=e?"height":"width",a={position:e?"absolute":"relative",[e?"width":"height"]:"inherit"};if(!t)return a[l]=0,a[i]=`${n}%`,a;let s=r-n;return a[l]=`${n}%`,a[i]=`${s}%`,a}(j,E,(0,Z.valueToPercent)(y[0],h,p),(0,Z.valueToPercent)(y[y.length-1],h,p));return(0,x.useRenderElement)("div",e,{state:b,ref:t,props:[{"data-base-ui-slider-indicator":g?"":void 0,style:C,suppressHydrationWarning:g||void 0},c],stateAttributesMapping:I})});e.s(["Control",0,q,"Indicator",0,eu,"Label",0,F,"Root",0,T,"Thumb",0,eo,"Track",0,G,"Value",0,L],414857);var ed=e.i(414857),ed=ed,ec=e.i(465458);function em({className:e,defaultValue:t,value:r,min:l=0,max:i=100,...a}){let s=Array.isArray(r)?r:void 0!==r?[r]:Array.isArray(t)?t:[l,i];return(0,n.jsx)(ed.Root,{className:(0,ec.cn)("data-horizontal:w-full data-vertical:h-full",e),"data-slot":"slider",defaultValue:t,value:r,min:l,max:i,thumbAlignment:"edge",...a,children:(0,n.jsxs)(ed.Control,{className:"relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col",children:[(0,n.jsx)(ed.Track,{"data-slot":"slider-track",className:"relative grow overflow-hidden rounded-full bg-muted select-none data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1",children:(0,n.jsx)(ed.Indicator,{"data-slot":"slider-range",className:"bg-primary select-none data-horizontal:h-full data-vertical:w-full"})}),Array.from({length:s.length},(e,t)=>(0,n.jsx)(ed.Thumb,{"data-slot":"slider-thumb",className:"relative block size-3 shrink-0 rounded-full border border-ring bg-white ring-ring/50 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50"},t))]})})}var ef=e.i(562918),ep=e.i(226624),eh=e.i(767467),ex=e.i(990336),ev=e.i(953700),eg=e.i(137340),eb=e.i(368942);let ey={vision:"bg-blue-500/10 text-blue-600 border-blue-200",reasoning:"bg-purple-500/10 text-purple-600 border-purple-200",embedding:"bg-green-500/10 text-green-600 border-green-200"},eN=[{label:"8K",value:8192},{label:"16K",value:16384},{label:"32K",value:32768},{label:"64K",value:65536},{label:"128K",value:128e3},{label:"200K",value:2e5},{label:"256K",value:256e3},{label:"1M",value:1e6}],ej=["low","medium","high"];function eE({groups:e,providerNames:t,onEdit:r,onDelete:i}){let s=(0,l.useTranslations)("models"),o=t.length>0?t:["Other"],u=Object.keys(e).sort((e,t)=>{let n=o.indexOf(e),r=o.indexOf(t);return n>=0&&r>=0?n-r:n>=0?-1:r>=0?1:e.localeCompare(t)});return(0,n.jsxs)("div",{className:"flex flex-col p-4 gap-4",children:[u.map(t=>(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2 px-1",children:t}),(0,n.jsx)("div",{className:"flex flex-col gap-0.5",children:e[t].map(e=>{var t;return(0,n.jsxs)("div",{className:"group flex items-center gap-3 rounded-lg px-3 py-2 hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>r(e),children:[(0,n.jsx)(ex.Brain,{className:"size-4 text-muted-foreground shrink-0"}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,n.jsx)("span",{className:"text-[11px] text-muted-foreground font-mono ml-2",children:e.modelId}),e.cost?(0,n.jsxs)("span",{className:"ml-2 text-[11px] text-muted-foreground font-mono",children:["$",ew(e.cost.inputPerMillion),"/$",ew(e.cost.outputPerMillion)]}):null,e.maxContextTokens?(0,n.jsxs)("span",{className:"ml-2 text-[11px] text-muted-foreground font-mono",children:[(t=e.maxContextTokens,new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1}).format(t))," ",s("list.contextAbbr")]}):null]}),(0,n.jsx)("div",{className:"flex items-center gap-1",children:["vision","reasoning","embedding"].map(t=>e[t]?(0,n.jsx)(ef.Badge,{variant:"outline",className:`text-[10px] h-5 px-1.5 ${ey[t]}`,children:s(`capability.${t}`)},t):null)}),(0,n.jsx)(a.Button,{variant:"ghost",size:"icon-xs",className:"opacity-0 group-hover:opacity-100 transition-opacity",onClick:t=>{t.stopPropagation(),i(e.id)},children:(0,n.jsx)(eg.Trash2,{className:"size-3 text-destructive"})})]},e.id)})})]},t)),0===u.length&&(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,n.jsx)(ex.Brain,{className:"size-10 mb-2 opacity-30"}),(0,n.jsx)("p",{className:"text-sm",children:s("list.empty")})]})]})}function eC({draft:e,providerNames:t,onChange:i}){let a=(0,l.useTranslations)("models"),o=(0,r.useRef)(!1),[u,d]=(0,r.useState)(()=>(function(e){if(!e)return eN.length;let t=eN.findIndex(t=>t.value===e);return t>=0?t:eN.length})(e.maxContextTokens)),c=t.length>0?t:["Other"];return(0,n.jsxs)("div",{className:"flex flex-col gap-5 p-5",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,n.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:a("form.details")}),(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)("label",{className:"text-xs text-muted-foreground",children:a("form.modelId")}),(0,n.jsx)(s.Input,{value:e.modelId||"",onChange:e=>{let t=e.target.value;i("modelId",t),o.current||i("name",t)},placeholder:a("form.modelIdPlaceholder")})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)("label",{className:"text-xs text-muted-foreground",children:a("form.displayName")}),(0,n.jsx)(s.Input,{value:e.name||"",onChange:e=>{o.current=!0,i("name",e.target.value)},placeholder:a("form.displayNamePlaceholder")})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)("label",{className:"text-xs text-muted-foreground",children:a("form.provider")}),(0,n.jsx)("select",{value:e.provider||"Other",onChange:e=>i("provider",e.target.value),className:"h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring dark:bg-input/30",children:c.map(e=>(0,n.jsx)("option",{value:e,children:e},e))})]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,n.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:a("form.context")}),(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)("label",{className:"text-xs text-muted-foreground",children:a("form.maxContextTokens")}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)(em,{min:0,max:eN.length,step:1,value:u,onValueChange:e=>{d(e),e<eN.length&&i("maxContextTokens",eN[e].value)},className:"flex-1"}),u<eN.length?(0,n.jsx)("span",{className:"text-sm tabular-nums min-w-[3.5rem] text-right",children:eN[u].label}):(0,n.jsx)(s.Input,{type:"number",min:"1",step:"1",value:e.maxContextTokens??"",onChange:e=>i("maxContextTokens",function(e){if(!e.trim())return;let t=Number(e);return Number.isFinite(t)&&t>0?Math.floor(t):void 0}(e.target.value)),placeholder:a("form.customContextPlaceholder"),className:"h-7 w-24 text-sm tabular-nums"})]})]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,n.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:a("form.thinking")}),(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-input px-3 py-2",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:a("form.enableThinking")}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:a("form.enableThinkingHelper")})]}),(0,n.jsx)(ep.Switch,{checked:e.thinkingEnabled??!0,onCheckedChange:e=>i("thinkingEnabled",e)})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)("label",{className:"text-xs text-muted-foreground",children:a("form.effort")}),(0,n.jsx)("select",{value:e.thinkingEffort||"medium",onChange:e=>i("thinkingEffort",e.target.value),disabled:!(e.thinkingEnabled??!0),className:"h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring disabled:cursor-not-allowed disabled:opacity-50 dark:bg-input/30",children:ej.map(e=>(0,n.jsx)("option",{value:e,children:e},e))})]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,n.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:a("form.cost")}),(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)("label",{className:"text-xs text-muted-foreground",children:a("form.inputPerMillion")}),(0,n.jsx)(s.Input,{type:"number",min:"0",step:"0.0001",value:e.cost?.inputPerMillion??0,onChange:t=>i("cost",{inputPerMillion:ek(t.target.value),outputPerMillion:e.cost?.outputPerMillion??0}),placeholder:a("form.costPlaceholder")})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)("label",{className:"text-xs text-muted-foreground",children:a("form.outputPerMillion")}),(0,n.jsx)(s.Input,{type:"number",min:"0",step:"0.0001",value:e.cost?.outputPerMillion??0,onChange:t=>i("cost",{inputPerMillion:e.cost?.inputPerMillion??0,outputPerMillion:ek(t.target.value)}),placeholder:a("form.costPlaceholder")})]})]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,n.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:a("form.capabilities")}),(0,n.jsx)("div",{className:"flex items-center gap-1.5",children:["vision","reasoning","embedding"].map(t=>{let r=!!e[t];return(0,n.jsx)("button",{type:"button",onClick:()=>i(t,!r),className:`rounded-md border px-2 py-1 text-xs font-medium transition-colors cursor-pointer
2
+ ${r?ey[t]:"text-muted-foreground border-input hover:bg-muted/50"}`,children:a(`capability.${t}`)},t)})})]})]})}function ek(e){let t=Number(e);return Number.isFinite(t)&&t>=0?t:0}function ew(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:4}).format(e)}e.s(["ModelsDialog",0,function({open:e,onOpenChange:t,initialProvider:s,standalone:o}){let u=(0,l.useTranslations)("models"),d=(0,l.useTranslations)("common"),{models:c,providers:m,ensure:f,addModel:p,updateModel:h,removeModel:x}=(0,eb.useLLMStore)(),v=m.map(e=>e.name),[g,b]=(0,r.useState)(null),[y,N]=(0,r.useState)(null),[j,E]=(0,r.useState)(!1),[C,k]=(0,r.useState)(!1),[w,R]=(0,r.useState)(null),I=(0,r.useRef)(!1);(0,r.useEffect)(()=>{if(!e){I.current=!1;return}queueMicrotask(()=>{E(!0),R(null)}),f().finally(()=>E(!1))},[e,f]),(0,r.useEffect)(()=>{e&&s&&!y&&!I.current&&(I.current=!0,queueMicrotask(()=>{b(null),N({modelId:"",name:"",provider:s,cost:{inputPerMillion:0,outputPerMillion:0},maxContextTokens:128e3,thinkingEnabled:!0,thinkingEffort:"medium",vision:!1,reasoning:!1,embedding:!1})}))},[e,s,y]);let S=()=>{b(null),N(null)},A=async()=>{if(y&&y.modelId&&y.name){k(!0),R(null);try{let e=!g,t=await fetch(e?"/api/models":`/api/models/${g.id}`,{method:e?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(y)});if(!t.ok)throw Error();let n=await t.json();e?p(n):h(n),S()}catch{R(u("error.saveFailed"))}finally{k(!1)}}},M=async e=>{if(confirm(u("confirm.delete"))){k(!0);try{if(!(await fetch(`/api/models/${e}`,{method:"DELETE"})).ok)throw Error();x(e),g?.id===e&&S()}catch{R(u("error.deleteFailed"))}finally{k(!1)}}},P=function(e){let t={};for(let n of e){let e=n.provider||"Other";(t[e]??=[]).push(n)}return t}(c),T=(0,n.jsxs)(n.Fragment,{children:[!o&&(0,n.jsxs)("div",{className:"flex items-center gap-3 border-b px-5 py-4",children:[y&&(0,n.jsx)(a.Button,{variant:"ghost",size:"icon-sm",onClick:S,children:(0,n.jsx)(eh.ArrowLeft,{className:"size-4"})}),(0,n.jsxs)(i.DialogHeader,{className:"flex-1 space-y-0",children:[(0,n.jsx)(i.DialogTitle,{className:"text-base",children:y?g?u("dialog.editTitle"):u("dialog.addTitle"):u("dialog.title")}),(0,n.jsx)(i.DialogDescription,{className:"text-xs",children:y?u("dialog.editDescription"):u("dialog.listDescription")})]}),!y&&(0,n.jsxs)(a.Button,{variant:"outline",size:"sm",onClick:()=>{b(null),N({modelId:"",name:"",provider:"Other",cost:{inputPerMillion:0,outputPerMillion:0},maxContextTokens:128e3,thinkingEnabled:!0,thinkingEffort:"medium",vision:!1,reasoning:!1,embedding:!1})},className:"mr-6",children:[(0,n.jsx)(ev.Plus,{className:"size-3.5"}),u("dialog.add")]})]}),(0,n.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[w&&(0,n.jsx)("div",{className:"mx-5 mt-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:w}),j?(0,n.jsx)("div",{className:"py-12 text-center text-sm text-muted-foreground",children:u("dialog.loading")}):y?(0,n.jsx)(eC,{draft:y,providerNames:v,onChange:(e,t)=>{N(n=>n?{...n,[e]:t}:n)}}):(0,n.jsx)(eE,{groups:P,providerNames:v,onEdit:e=>{b(e),N({...e,thinkingEnabled:e.thinkingEnabled??!0,thinkingEffort:e.thinkingEffort??"medium"})},onDelete:M})]}),y&&(0,n.jsxs)("div",{className:"flex justify-end gap-2 border-t px-5 py-3",children:[(0,n.jsx)(a.Button,{variant:"outline",size:"sm",onClick:S,disabled:C,children:d("cancel")}),(0,n.jsx)(a.Button,{size:"sm",onClick:A,disabled:C||!y.modelId||!y.name,children:d(C?"saving":"save")})]})]});return o?(0,n.jsx)("div",{className:"h-full flex flex-col",children:T}):(0,n.jsx)(i.Dialog,{open:e,onOpenChange:e=>{e||S(),t(e)},children:(0,n.jsx)(i.DialogContent,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 gap-0",children:T})})}],86477)}]);