larkup 0.4.12 → 0.4.14

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 (959) hide show
  1. package/.next/standalone/apps/web/.next/BUILD_ID +1 -0
  2. package/.next/standalone/apps/web/.next/app-path-routes-manifest.json +94 -0
  3. package/.next/standalone/apps/web/.next/build-manifest.json +20 -0
  4. package/.next/standalone/apps/web/.next/diagnostics/build-diagnostics.json +6 -0
  5. package/.next/standalone/apps/web/.next/diagnostics/framework.json +1 -0
  6. package/.next/standalone/apps/web/.next/lock +0 -0
  7. package/.next/standalone/apps/web/.next/package.json +1 -0
  8. package/.next/standalone/apps/web/.next/prerender-manifest.json +241 -0
  9. package/.next/standalone/apps/web/.next/react-loadable-manifest.json +31 -0
  10. package/.next/standalone/apps/web/.next/required-server-files.json +399 -0
  11. package/.next/standalone/apps/web/.next/routes-manifest.json +644 -0
  12. package/.next/standalone/apps/web/.next/server/app/_global-error/page.js +31 -0
  13. package/.next/standalone/apps/web/.next/server/app/_global-error/page.js.nft.json +1 -0
  14. package/.next/standalone/apps/web/.next/server/app/_global-error/page_client-reference-manifest.js +1 -0
  15. package/.next/standalone/apps/web/.next/server/app/_global-error.html +1 -0
  16. package/.next/standalone/apps/web/.next/server/app/_global-error.meta +35 -0
  17. package/.next/standalone/apps/web/.next/server/app/_global-error.rsc +15 -0
  18. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +15 -0
  19. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +21 -0
  20. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
  21. package/.next/standalone/apps/web/.next/server/app/_not-found/page.js +1 -0
  22. package/.next/standalone/apps/web/.next/server/app/_not-found/page.js.nft.json +1 -0
  23. package/.next/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
  24. package/.next/standalone/apps/web/.next/server/app/_not-found.html +1 -0
  25. package/.next/standalone/apps/web/.next/server/app/_not-found.meta +35 -0
  26. package/.next/standalone/apps/web/.next/server/app/_not-found.rsc +26 -0
  27. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_full.segment.rsc +26 -0
  28. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +32 -0
  29. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -0
  30. package/.next/standalone/apps/web/.next/server/app/add/page.js +1 -0
  31. package/.next/standalone/apps/web/.next/server/app/add/page.js.nft.json +1 -0
  32. package/.next/standalone/apps/web/.next/server/app/add/page_client-reference-manifest.js +1 -0
  33. package/.next/standalone/apps/web/.next/server/app/add.html +1 -0
  34. package/.next/standalone/apps/web/.next/server/app/add.meta +34 -0
  35. package/.next/standalone/apps/web/.next/server/app/add.rsc +27 -0
  36. package/.next/standalone/apps/web/.next/server/app/add.segments/_full.segment.rsc +27 -0
  37. package/.next/standalone/apps/web/.next/server/app/add.segments/_tree.segment.rsc +2 -0
  38. package/.next/standalone/apps/web/.next/server/app/add.segments/add/__PAGE__.segment.rsc +33 -0
  39. package/.next/standalone/apps/web/.next/server/app/api/analytics/route.js +1 -0
  40. package/.next/standalone/apps/web/.next/server/app/api/analytics/route.js.nft.json +1 -0
  41. package/.next/standalone/apps/web/.next/server/app/api/analytics/route_client-reference-manifest.js +1 -0
  42. package/.next/standalone/apps/web/.next/server/app/api/chat/feedback/route.js +1 -0
  43. package/.next/standalone/apps/web/.next/server/app/api/chat/feedback/route.js.nft.json +1 -0
  44. package/.next/standalone/apps/web/.next/server/app/api/chat/feedback/route_client-reference-manifest.js +1 -0
  45. package/.next/standalone/apps/web/.next/server/app/api/chat/route.js +111 -0
  46. package/.next/standalone/apps/web/.next/server/app/api/chat/route.js.nft.json +1 -0
  47. package/.next/standalone/apps/web/.next/server/app/api/chat/route_client-reference-manifest.js +1 -0
  48. package/.next/standalone/apps/web/.next/server/app/api/chat/status/route.js +1 -0
  49. package/.next/standalone/apps/web/.next/server/app/api/chat/status/route.js.nft.json +1 -0
  50. package/.next/standalone/apps/web/.next/server/app/api/chat/status/route_client-reference-manifest.js +1 -0
  51. package/.next/standalone/apps/web/.next/server/app/api/config/route.js +1 -0
  52. package/.next/standalone/apps/web/.next/server/app/api/config/route.js.nft.json +1 -0
  53. package/.next/standalone/apps/web/.next/server/app/api/config/route_client-reference-manifest.js +1 -0
  54. package/.next/standalone/apps/web/.next/server/app/api/config/test/route.js +1 -0
  55. package/.next/standalone/apps/web/.next/server/app/api/config/test/route.js.nft.json +1 -0
  56. package/.next/standalone/apps/web/.next/server/app/api/config/test/route_client-reference-manifest.js +1 -0
  57. package/.next/standalone/apps/web/.next/server/app/api/config/test-embedding/route.js +10 -0
  58. package/.next/standalone/apps/web/.next/server/app/api/config/test-embedding/route.js.nft.json +1 -0
  59. package/.next/standalone/apps/web/.next/server/app/api/config/test-embedding/route_client-reference-manifest.js +1 -0
  60. package/.next/standalone/apps/web/.next/server/app/api/config/test-llm/route.js +10 -0
  61. package/.next/standalone/apps/web/.next/server/app/api/config/test-llm/route.js.nft.json +1 -0
  62. package/.next/standalone/apps/web/.next/server/app/api/config/test-llm/route_client-reference-manifest.js +1 -0
  63. package/.next/standalone/apps/web/.next/server/app/api/config/test-provider/route.js +1 -0
  64. package/.next/standalone/apps/web/.next/server/app/api/config/test-provider/route.js.nft.json +1 -0
  65. package/.next/standalone/apps/web/.next/server/app/api/config/test-provider/route_client-reference-manifest.js +1 -0
  66. package/.next/standalone/apps/web/.next/server/app/api/config/verify/route.js +1 -0
  67. package/.next/standalone/apps/web/.next/server/app/api/config/verify/route.js.nft.json +1 -0
  68. package/.next/standalone/apps/web/.next/server/app/api/config/verify/route_client-reference-manifest.js +1 -0
  69. package/.next/standalone/apps/web/.next/server/app/api/connections/[channelId]/oauth/callback/route.js +1 -0
  70. package/.next/standalone/apps/web/.next/server/app/api/connections/[channelId]/oauth/callback/route.js.nft.json +1 -0
  71. package/.next/standalone/apps/web/.next/server/app/api/connections/[channelId]/oauth/callback/route_client-reference-manifest.js +1 -0
  72. package/.next/standalone/apps/web/.next/server/app/api/connections/[channelId]/oauth/start/route.js +1 -0
  73. package/.next/standalone/apps/web/.next/server/app/api/connections/[channelId]/oauth/start/route.js.nft.json +1 -0
  74. package/.next/standalone/apps/web/.next/server/app/api/connections/[channelId]/oauth/start/route_client-reference-manifest.js +1 -0
  75. package/.next/standalone/apps/web/.next/server/app/api/connections/[channelId]/route.js +1 -0
  76. package/.next/standalone/apps/web/.next/server/app/api/connections/[channelId]/route.js.nft.json +1 -0
  77. package/.next/standalone/apps/web/.next/server/app/api/connections/[channelId]/route_client-reference-manifest.js +1 -0
  78. package/.next/standalone/apps/web/.next/server/app/api/connections/route.js +1 -0
  79. package/.next/standalone/apps/web/.next/server/app/api/connections/route.js.nft.json +1 -0
  80. package/.next/standalone/apps/web/.next/server/app/api/connections/route_client-reference-manifest.js +1 -0
  81. package/.next/standalone/apps/web/.next/server/app/api/connections/tunnel/route.js +1 -0
  82. package/.next/standalone/apps/web/.next/server/app/api/connections/tunnel/route.js.nft.json +1 -0
  83. package/.next/standalone/apps/web/.next/server/app/api/connections/tunnel/route_client-reference-manifest.js +1 -0
  84. package/.next/standalone/apps/web/.next/server/app/api/demo/route.js +1 -0
  85. package/.next/standalone/apps/web/.next/server/app/api/demo/route.js.nft.json +1 -0
  86. package/.next/standalone/apps/web/.next/server/app/api/demo/route_client-reference-manifest.js +1 -0
  87. package/.next/standalone/apps/web/.next/server/app/api/deploy/ssh/route.js +5 -0
  88. package/.next/standalone/apps/web/.next/server/app/api/deploy/ssh/route.js.nft.json +1 -0
  89. package/.next/standalone/apps/web/.next/server/app/api/deploy/ssh/route_client-reference-manifest.js +1 -0
  90. package/.next/standalone/apps/web/.next/server/app/api/deploy/verify/route.js +1 -0
  91. package/.next/standalone/apps/web/.next/server/app/api/deploy/verify/route.js.nft.json +1 -0
  92. package/.next/standalone/apps/web/.next/server/app/api/deploy/verify/route_client-reference-manifest.js +1 -0
  93. package/.next/standalone/apps/web/.next/server/app/api/describe-image/route.js +1 -0
  94. package/.next/standalone/apps/web/.next/server/app/api/describe-image/route.js.nft.json +1 -0
  95. package/.next/standalone/apps/web/.next/server/app/api/describe-image/route_client-reference-manifest.js +1 -0
  96. package/.next/standalone/apps/web/.next/server/app/api/doc-editor/edit/route.js +1 -0
  97. package/.next/standalone/apps/web/.next/server/app/api/doc-editor/edit/route.js.nft.json +1 -0
  98. package/.next/standalone/apps/web/.next/server/app/api/doc-editor/edit/route_client-reference-manifest.js +1 -0
  99. package/.next/standalone/apps/web/.next/server/app/api/doc-editor/export/route.js +1 -0
  100. package/.next/standalone/apps/web/.next/server/app/api/doc-editor/export/route.js.nft.json +1 -0
  101. package/.next/standalone/apps/web/.next/server/app/api/doc-editor/export/route_client-reference-manifest.js +1 -0
  102. package/.next/standalone/apps/web/.next/server/app/api/doc-editor/extract-text/route.js +1 -0
  103. package/.next/standalone/apps/web/.next/server/app/api/doc-editor/extract-text/route.js.nft.json +1 -0
  104. package/.next/standalone/apps/web/.next/server/app/api/doc-editor/extract-text/route_client-reference-manifest.js +1 -0
  105. package/.next/standalone/apps/web/.next/server/app/api/doc-editor/parse/route.js +1 -0
  106. package/.next/standalone/apps/web/.next/server/app/api/doc-editor/parse/route.js.nft.json +1 -0
  107. package/.next/standalone/apps/web/.next/server/app/api/doc-editor/parse/route_client-reference-manifest.js +1 -0
  108. package/.next/standalone/apps/web/.next/server/app/api/doc-editor/restore/route.js +1 -0
  109. package/.next/standalone/apps/web/.next/server/app/api/doc-editor/restore/route.js.nft.json +1 -0
  110. package/.next/standalone/apps/web/.next/server/app/api/doc-editor/restore/route_client-reference-manifest.js +1 -0
  111. package/.next/standalone/apps/web/.next/server/app/api/document/sign/route.js +1 -0
  112. package/.next/standalone/apps/web/.next/server/app/api/document/sign/route.js.nft.json +1 -0
  113. package/.next/standalone/apps/web/.next/server/app/api/document/sign/route_client-reference-manifest.js +1 -0
  114. package/.next/standalone/apps/web/.next/server/app/api/documents/move/route.js +1 -0
  115. package/.next/standalone/apps/web/.next/server/app/api/documents/move/route.js.nft.json +1 -0
  116. package/.next/standalone/apps/web/.next/server/app/api/documents/move/route_client-reference-manifest.js +1 -0
  117. package/.next/standalone/apps/web/.next/server/app/api/documents/route.js +1 -0
  118. package/.next/standalone/apps/web/.next/server/app/api/documents/route.js.nft.json +1 -0
  119. package/.next/standalone/apps/web/.next/server/app/api/documents/route_client-reference-manifest.js +1 -0
  120. package/.next/standalone/apps/web/.next/server/app/api/files/remote/route.js +1 -0
  121. package/.next/standalone/apps/web/.next/server/app/api/files/remote/route.js.nft.json +1 -0
  122. package/.next/standalone/apps/web/.next/server/app/api/files/remote/route_client-reference-manifest.js +1 -0
  123. package/.next/standalone/apps/web/.next/server/app/api/firecrawl/local/route.js +1 -0
  124. package/.next/standalone/apps/web/.next/server/app/api/firecrawl/local/route.js.nft.json +1 -0
  125. package/.next/standalone/apps/web/.next/server/app/api/firecrawl/local/route_client-reference-manifest.js +1 -0
  126. package/.next/standalone/apps/web/.next/server/app/api/gpu-activity/route.js +1 -0
  127. package/.next/standalone/apps/web/.next/server/app/api/gpu-activity/route.js.nft.json +1 -0
  128. package/.next/standalone/apps/web/.next/server/app/api/gpu-activity/route_client-reference-manifest.js +1 -0
  129. package/.next/standalone/apps/web/.next/server/app/api/groups/route.js +1 -0
  130. package/.next/standalone/apps/web/.next/server/app/api/groups/route.js.nft.json +1 -0
  131. package/.next/standalone/apps/web/.next/server/app/api/groups/route_client-reference-manifest.js +1 -0
  132. package/.next/standalone/apps/web/.next/server/app/api/index/route.js +1 -0
  133. package/.next/standalone/apps/web/.next/server/app/api/index/route.js.nft.json +1 -0
  134. package/.next/standalone/apps/web/.next/server/app/api/index/route_client-reference-manifest.js +1 -0
  135. package/.next/standalone/apps/web/.next/server/app/api/integrations/[integration]/callback/route.js +4 -0
  136. package/.next/standalone/apps/web/.next/server/app/api/integrations/[integration]/callback/route.js.nft.json +1 -0
  137. package/.next/standalone/apps/web/.next/server/app/api/integrations/[integration]/callback/route_client-reference-manifest.js +1 -0
  138. package/.next/standalone/apps/web/.next/server/app/api/integrations/[integration]/route.js +1 -0
  139. package/.next/standalone/apps/web/.next/server/app/api/integrations/[integration]/route.js.nft.json +1 -0
  140. package/.next/standalone/apps/web/.next/server/app/api/integrations/[integration]/route_client-reference-manifest.js +1 -0
  141. package/.next/standalone/apps/web/.next/server/app/api/integrations/notion/callback/route.js +19 -0
  142. package/.next/standalone/apps/web/.next/server/app/api/integrations/notion/callback/route.js.nft.json +1 -0
  143. package/.next/standalone/apps/web/.next/server/app/api/integrations/notion/callback/route_client-reference-manifest.js +1 -0
  144. package/.next/standalone/apps/web/.next/server/app/api/integrations/notion/route.js +11 -0
  145. package/.next/standalone/apps/web/.next/server/app/api/integrations/notion/route.js.nft.json +1 -0
  146. package/.next/standalone/apps/web/.next/server/app/api/integrations/notion/route_client-reference-manifest.js +1 -0
  147. package/.next/standalone/apps/web/.next/server/app/api/integrations/route.js +1 -0
  148. package/.next/standalone/apps/web/.next/server/app/api/integrations/route.js.nft.json +1 -0
  149. package/.next/standalone/apps/web/.next/server/app/api/integrations/route_client-reference-manifest.js +1 -0
  150. package/.next/standalone/apps/web/.next/server/app/api/jobs/[id]/route.js +1 -0
  151. package/.next/standalone/apps/web/.next/server/app/api/jobs/[id]/route.js.nft.json +1 -0
  152. package/.next/standalone/apps/web/.next/server/app/api/jobs/[id]/route_client-reference-manifest.js +1 -0
  153. package/.next/standalone/apps/web/.next/server/app/api/jobs/route.js +1 -0
  154. package/.next/standalone/apps/web/.next/server/app/api/jobs/route.js.nft.json +1 -0
  155. package/.next/standalone/apps/web/.next/server/app/api/jobs/route_client-reference-manifest.js +1 -0
  156. package/.next/standalone/apps/web/.next/server/app/api/marketplace/[toolId]/route.js +1 -0
  157. package/.next/standalone/apps/web/.next/server/app/api/marketplace/[toolId]/route.js.nft.json +1 -0
  158. package/.next/standalone/apps/web/.next/server/app/api/marketplace/[toolId]/route_client-reference-manifest.js +1 -0
  159. package/.next/standalone/apps/web/.next/server/app/api/marketplace/route.js +1 -0
  160. package/.next/standalone/apps/web/.next/server/app/api/marketplace/route.js.nft.json +1 -0
  161. package/.next/standalone/apps/web/.next/server/app/api/marketplace/route_client-reference-manifest.js +1 -0
  162. package/.next/standalone/apps/web/.next/server/app/api/mcp/[connectionId]/route.js +1 -0
  163. package/.next/standalone/apps/web/.next/server/app/api/mcp/[connectionId]/route.js.nft.json +1 -0
  164. package/.next/standalone/apps/web/.next/server/app/api/mcp/[connectionId]/route_client-reference-manifest.js +1 -0
  165. package/.next/standalone/apps/web/.next/server/app/api/mcp/[connectionId]/test/route.js +1 -0
  166. package/.next/standalone/apps/web/.next/server/app/api/mcp/[connectionId]/test/route.js.nft.json +1 -0
  167. package/.next/standalone/apps/web/.next/server/app/api/mcp/[connectionId]/test/route_client-reference-manifest.js +1 -0
  168. package/.next/standalone/apps/web/.next/server/app/api/mcp/route.js +1 -0
  169. package/.next/standalone/apps/web/.next/server/app/api/mcp/route.js.nft.json +1 -0
  170. package/.next/standalone/apps/web/.next/server/app/api/mcp/route_client-reference-manifest.js +1 -0
  171. package/.next/standalone/apps/web/.next/server/app/api/media/[id]/frame/route.js +1 -0
  172. package/.next/standalone/apps/web/.next/server/app/api/media/[id]/frame/route.js.nft.json +1 -0
  173. package/.next/standalone/apps/web/.next/server/app/api/media/[id]/frame/route_client-reference-manifest.js +1 -0
  174. package/.next/standalone/apps/web/.next/server/app/api/media/[id]/route.js +1 -0
  175. package/.next/standalone/apps/web/.next/server/app/api/media/[id]/route.js.nft.json +1 -0
  176. package/.next/standalone/apps/web/.next/server/app/api/media/[id]/route_client-reference-manifest.js +1 -0
  177. package/.next/standalone/apps/web/.next/server/app/api/media/inspect/route.js +1 -0
  178. package/.next/standalone/apps/web/.next/server/app/api/media/inspect/route.js.nft.json +1 -0
  179. package/.next/standalone/apps/web/.next/server/app/api/media/inspect/route_client-reference-manifest.js +1 -0
  180. package/.next/standalone/apps/web/.next/server/app/api/media/jobs/[id]/approval/route.js +1 -0
  181. package/.next/standalone/apps/web/.next/server/app/api/media/jobs/[id]/approval/route.js.nft.json +1 -0
  182. package/.next/standalone/apps/web/.next/server/app/api/media/jobs/[id]/approval/route_client-reference-manifest.js +1 -0
  183. package/.next/standalone/apps/web/.next/server/app/api/media/jobs/[id]/route.js +1 -0
  184. package/.next/standalone/apps/web/.next/server/app/api/media/jobs/[id]/route.js.nft.json +1 -0
  185. package/.next/standalone/apps/web/.next/server/app/api/media/jobs/[id]/route_client-reference-manifest.js +1 -0
  186. package/.next/standalone/apps/web/.next/server/app/api/media/process/route.js +2 -0
  187. package/.next/standalone/apps/web/.next/server/app/api/media/process/route.js.nft.json +1 -0
  188. package/.next/standalone/apps/web/.next/server/app/api/media/process/route_client-reference-manifest.js +1 -0
  189. package/.next/standalone/apps/web/.next/server/app/api/media/route.js +1 -0
  190. package/.next/standalone/apps/web/.next/server/app/api/media/route.js.nft.json +1 -0
  191. package/.next/standalone/apps/web/.next/server/app/api/media/route_client-reference-manifest.js +1 -0
  192. package/.next/standalone/apps/web/.next/server/app/api/media/stream/route.js +5 -0
  193. package/.next/standalone/apps/web/.next/server/app/api/media/stream/route.js.nft.json +1 -0
  194. package/.next/standalone/apps/web/.next/server/app/api/media/stream/route_client-reference-manifest.js +1 -0
  195. package/.next/standalone/apps/web/.next/server/app/api/models/route.js +1 -0
  196. package/.next/standalone/apps/web/.next/server/app/api/models/route.js.nft.json +1 -0
  197. package/.next/standalone/apps/web/.next/server/app/api/models/route_client-reference-manifest.js +1 -0
  198. package/.next/standalone/apps/web/.next/server/app/api/parse-file/route.js +1 -0
  199. package/.next/standalone/apps/web/.next/server/app/api/parse-file/route.js.nft.json +1 -0
  200. package/.next/standalone/apps/web/.next/server/app/api/parse-file/route_client-reference-manifest.js +1 -0
  201. package/.next/standalone/apps/web/.next/server/app/api/pdf-page/route.js +1 -0
  202. package/.next/standalone/apps/web/.next/server/app/api/pdf-page/route.js.nft.json +1 -0
  203. package/.next/standalone/apps/web/.next/server/app/api/pdf-page/route_client-reference-manifest.js +1 -0
  204. package/.next/standalone/apps/web/.next/server/app/api/projects/deployments/route.js +1 -0
  205. package/.next/standalone/apps/web/.next/server/app/api/projects/deployments/route.js.nft.json +1 -0
  206. package/.next/standalone/apps/web/.next/server/app/api/projects/deployments/route_client-reference-manifest.js +1 -0
  207. package/.next/standalone/apps/web/.next/server/app/api/projects/route.js +1 -0
  208. package/.next/standalone/apps/web/.next/server/app/api/projects/route.js.nft.json +1 -0
  209. package/.next/standalone/apps/web/.next/server/app/api/projects/route_client-reference-manifest.js +1 -0
  210. package/.next/standalone/apps/web/.next/server/app/api/projects/runtime/route.js +1 -0
  211. package/.next/standalone/apps/web/.next/server/app/api/projects/runtime/route.js.nft.json +1 -0
  212. package/.next/standalone/apps/web/.next/server/app/api/projects/runtime/route_client-reference-manifest.js +1 -0
  213. package/.next/standalone/apps/web/.next/server/app/api/proxy/verify/route.js +1 -0
  214. package/.next/standalone/apps/web/.next/server/app/api/proxy/verify/route.js.nft.json +1 -0
  215. package/.next/standalone/apps/web/.next/server/app/api/proxy/verify/route_client-reference-manifest.js +1 -0
  216. package/.next/standalone/apps/web/.next/server/app/api/sandbox/route.js +1 -0
  217. package/.next/standalone/apps/web/.next/server/app/api/sandbox/route.js.nft.json +1 -0
  218. package/.next/standalone/apps/web/.next/server/app/api/sandbox/route_client-reference-manifest.js +1 -0
  219. package/.next/standalone/apps/web/.next/server/app/api/sandbox/verify/route.js +1 -0
  220. package/.next/standalone/apps/web/.next/server/app/api/sandbox/verify/route.js.nft.json +1 -0
  221. package/.next/standalone/apps/web/.next/server/app/api/sandbox/verify/route_client-reference-manifest.js +1 -0
  222. package/.next/standalone/apps/web/.next/server/app/api/search/bing/route.js +1 -0
  223. package/.next/standalone/apps/web/.next/server/app/api/search/bing/route.js.nft.json +1 -0
  224. package/.next/standalone/apps/web/.next/server/app/api/search/bing/route_client-reference-manifest.js +1 -0
  225. package/.next/standalone/apps/web/.next/server/app/api/search/brave/route.js +1 -0
  226. package/.next/standalone/apps/web/.next/server/app/api/search/brave/route.js.nft.json +1 -0
  227. package/.next/standalone/apps/web/.next/server/app/api/search/brave/route_client-reference-manifest.js +1 -0
  228. package/.next/standalone/apps/web/.next/server/app/api/search/exa/route.js +1 -0
  229. package/.next/standalone/apps/web/.next/server/app/api/search/exa/route.js.nft.json +1 -0
  230. package/.next/standalone/apps/web/.next/server/app/api/search/exa/route_client-reference-manifest.js +1 -0
  231. package/.next/standalone/apps/web/.next/server/app/api/search/google/route.js +1 -0
  232. package/.next/standalone/apps/web/.next/server/app/api/search/google/route.js.nft.json +1 -0
  233. package/.next/standalone/apps/web/.next/server/app/api/search/google/route_client-reference-manifest.js +1 -0
  234. package/.next/standalone/apps/web/.next/server/app/api/search/route.js +1 -0
  235. package/.next/standalone/apps/web/.next/server/app/api/search/route.js.nft.json +1 -0
  236. package/.next/standalone/apps/web/.next/server/app/api/search/route_client-reference-manifest.js +1 -0
  237. package/.next/standalone/apps/web/.next/server/app/api/search/tavily/route.js +1 -0
  238. package/.next/standalone/apps/web/.next/server/app/api/search/tavily/route.js.nft.json +1 -0
  239. package/.next/standalone/apps/web/.next/server/app/api/search/tavily/route_client-reference-manifest.js +1 -0
  240. package/.next/standalone/apps/web/.next/server/app/api/search/verify/route.js +1 -0
  241. package/.next/standalone/apps/web/.next/server/app/api/search/verify/route.js.nft.json +1 -0
  242. package/.next/standalone/apps/web/.next/server/app/api/search/verify/route_client-reference-manifest.js +1 -0
  243. package/.next/standalone/apps/web/.next/server/app/api/system/cache/route.js +2 -0
  244. package/.next/standalone/apps/web/.next/server/app/api/system/cache/route.js.nft.json +1 -0
  245. package/.next/standalone/apps/web/.next/server/app/api/system/cache/route_client-reference-manifest.js +1 -0
  246. package/.next/standalone/apps/web/.next/server/app/api/tabular/query/route.js +1 -0
  247. package/.next/standalone/apps/web/.next/server/app/api/tabular/query/route.js.nft.json +1 -0
  248. package/.next/standalone/apps/web/.next/server/app/api/tabular/query/route_client-reference-manifest.js +1 -0
  249. package/.next/standalone/apps/web/.next/server/app/api/tabular/route.js +1 -0
  250. package/.next/standalone/apps/web/.next/server/app/api/tabular/route.js.nft.json +1 -0
  251. package/.next/standalone/apps/web/.next/server/app/api/tabular/route_client-reference-manifest.js +1 -0
  252. package/.next/standalone/apps/web/.next/server/app/api/tools/[toolId]/host/route.js +1 -0
  253. package/.next/standalone/apps/web/.next/server/app/api/tools/[toolId]/host/route.js.nft.json +1 -0
  254. package/.next/standalone/apps/web/.next/server/app/api/tools/[toolId]/host/route_client-reference-manifest.js +1 -0
  255. package/.next/standalone/apps/web/.next/server/app/api/tools/[toolId]/runtime/route.js +1 -0
  256. package/.next/standalone/apps/web/.next/server/app/api/tools/[toolId]/runtime/route.js.nft.json +1 -0
  257. package/.next/standalone/apps/web/.next/server/app/api/tools/[toolId]/runtime/route_client-reference-manifest.js +1 -0
  258. package/.next/standalone/apps/web/.next/server/app/api/tools/[toolId]/usage/route.js +1 -0
  259. package/.next/standalone/apps/web/.next/server/app/api/tools/[toolId]/usage/route.js.nft.json +1 -0
  260. package/.next/standalone/apps/web/.next/server/app/api/tools/[toolId]/usage/route_client-reference-manifest.js +1 -0
  261. package/.next/standalone/apps/web/.next/server/app/api/tools/[toolId]/usage-request/route.js +1 -0
  262. package/.next/standalone/apps/web/.next/server/app/api/tools/[toolId]/usage-request/route.js.nft.json +1 -0
  263. package/.next/standalone/apps/web/.next/server/app/api/tools/[toolId]/usage-request/route_client-reference-manifest.js +1 -0
  264. package/.next/standalone/apps/web/.next/server/app/api/tools/[toolId]/verify/route.js +1 -0
  265. package/.next/standalone/apps/web/.next/server/app/api/tools/[toolId]/verify/route.js.nft.json +1 -0
  266. package/.next/standalone/apps/web/.next/server/app/api/tools/[toolId]/verify/route_client-reference-manifest.js +1 -0
  267. package/.next/standalone/apps/web/.next/server/app/api/tools/video-intelligence/connection/route.js +1 -0
  268. package/.next/standalone/apps/web/.next/server/app/api/tools/video-intelligence/connection/route.js.nft.json +1 -0
  269. package/.next/standalone/apps/web/.next/server/app/api/tools/video-intelligence/connection/route_client-reference-manifest.js +1 -0
  270. package/.next/standalone/apps/web/.next/server/app/api/tools/video-intelligence/usage/route.js +1 -0
  271. package/.next/standalone/apps/web/.next/server/app/api/tools/video-intelligence/usage/route.js.nft.json +1 -0
  272. package/.next/standalone/apps/web/.next/server/app/api/tools/video-intelligence/usage/route_client-reference-manifest.js +1 -0
  273. package/.next/standalone/apps/web/.next/server/app/api/tools/video-intelligence/usage-request/route.js +1 -0
  274. package/.next/standalone/apps/web/.next/server/app/api/tools/video-intelligence/usage-request/route.js.nft.json +1 -0
  275. package/.next/standalone/apps/web/.next/server/app/api/tools/video-intelligence/usage-request/route_client-reference-manifest.js +1 -0
  276. package/.next/standalone/apps/web/.next/server/app/api/upload-file/route.js +1 -0
  277. package/.next/standalone/apps/web/.next/server/app/api/upload-file/route.js.nft.json +1 -0
  278. package/.next/standalone/apps/web/.next/server/app/api/upload-file/route_client-reference-manifest.js +1 -0
  279. package/.next/standalone/apps/web/.next/server/app/api/uploads/[...slug]/route.js +1 -0
  280. package/.next/standalone/apps/web/.next/server/app/api/uploads/[...slug]/route.js.nft.json +1 -0
  281. package/.next/standalone/apps/web/.next/server/app/api/uploads/[...slug]/route_client-reference-manifest.js +1 -0
  282. package/.next/standalone/apps/web/.next/server/app/api/vector-stores/install/route.js +1 -0
  283. package/.next/standalone/apps/web/.next/server/app/api/vector-stores/install/route.js.nft.json +1 -0
  284. package/.next/standalone/apps/web/.next/server/app/api/vector-stores/install/route_client-reference-manifest.js +1 -0
  285. package/.next/standalone/apps/web/.next/server/app/api/vector-stores/status/route.js +1 -0
  286. package/.next/standalone/apps/web/.next/server/app/api/vector-stores/status/route.js.nft.json +1 -0
  287. package/.next/standalone/apps/web/.next/server/app/api/vector-stores/status/route_client-reference-manifest.js +1 -0
  288. package/.next/standalone/apps/web/.next/server/app/chat/[id]/page.js +1 -0
  289. package/.next/standalone/apps/web/.next/server/app/chat/[id]/page.js.nft.json +1 -0
  290. package/.next/standalone/apps/web/.next/server/app/chat/[id]/page_client-reference-manifest.js +1 -0
  291. package/.next/standalone/apps/web/.next/server/app/chat/page.js +1 -0
  292. package/.next/standalone/apps/web/.next/server/app/chat/page.js.nft.json +1 -0
  293. package/.next/standalone/apps/web/.next/server/app/chat/page_client-reference-manifest.js +1 -0
  294. package/.next/standalone/apps/web/.next/server/app/chat.html +1 -0
  295. package/.next/standalone/apps/web/.next/server/app/chat.meta +34 -0
  296. package/.next/standalone/apps/web/.next/server/app/chat.rsc +28 -0
  297. package/.next/standalone/apps/web/.next/server/app/chat.segments/_full.segment.rsc +28 -0
  298. package/.next/standalone/apps/web/.next/server/app/chat.segments/_tree.segment.rsc +3 -0
  299. package/.next/standalone/apps/web/.next/server/app/chat.segments/chat/__PAGE__.segment.rsc +34 -0
  300. package/.next/standalone/apps/web/.next/server/app/data/page.js +1 -0
  301. package/.next/standalone/apps/web/.next/server/app/data/page.js.nft.json +1 -0
  302. package/.next/standalone/apps/web/.next/server/app/data/page_client-reference-manifest.js +1 -0
  303. package/.next/standalone/apps/web/.next/server/app/data.html +1 -0
  304. package/.next/standalone/apps/web/.next/server/app/data.meta +34 -0
  305. package/.next/standalone/apps/web/.next/server/app/data.rsc +27 -0
  306. package/.next/standalone/apps/web/.next/server/app/data.segments/_full.segment.rsc +27 -0
  307. package/.next/standalone/apps/web/.next/server/app/data.segments/_tree.segment.rsc +2 -0
  308. package/.next/standalone/apps/web/.next/server/app/data.segments/data/__PAGE__.segment.rsc +33 -0
  309. package/.next/standalone/apps/web/.next/server/app/favicon.ico/route.js +1 -0
  310. package/.next/standalone/apps/web/.next/server/app/favicon.ico/route.js.nft.json +1 -0
  311. package/.next/standalone/apps/web/.next/server/app/favicon.ico.body +0 -0
  312. package/.next/standalone/apps/web/.next/server/app/favicon.ico.meta +1 -0
  313. package/.next/standalone/apps/web/.next/server/app/index.html +1 -0
  314. package/.next/standalone/apps/web/.next/server/app/index.meta +29 -0
  315. package/.next/standalone/apps/web/.next/server/app/index.rsc +25 -0
  316. package/.next/standalone/apps/web/.next/server/app/index.segments/__PAGE__.segment.rsc +30 -0
  317. package/.next/standalone/apps/web/.next/server/app/index.segments/_full.segment.rsc +25 -0
  318. package/.next/standalone/apps/web/.next/server/app/index.segments/_tree.segment.rsc +2 -0
  319. package/.next/standalone/apps/web/.next/server/app/page.js +1 -0
  320. package/.next/standalone/apps/web/.next/server/app/page.js.nft.json +1 -0
  321. package/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -0
  322. package/.next/standalone/apps/web/.next/server/app/settings/page.js +216 -0
  323. package/.next/standalone/apps/web/.next/server/app/settings/page.js.nft.json +1 -0
  324. package/.next/standalone/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -0
  325. package/.next/standalone/apps/web/.next/server/app/settings.html +1 -0
  326. package/.next/standalone/apps/web/.next/server/app/settings.meta +34 -0
  327. package/.next/standalone/apps/web/.next/server/app/settings.rsc +30 -0
  328. package/.next/standalone/apps/web/.next/server/app/settings.segments/_full.segment.rsc +30 -0
  329. package/.next/standalone/apps/web/.next/server/app/settings.segments/_tree.segment.rsc +2 -0
  330. package/.next/standalone/apps/web/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +36 -0
  331. package/.next/standalone/apps/web/.next/server/app-paths-manifest.json +94 -0
  332. package/.next/standalone/apps/web/.next/server/chunks/101.js +24 -0
  333. package/.next/standalone/apps/web/.next/server/chunks/1149.js +1 -0
  334. package/.next/standalone/apps/web/.next/server/chunks/1309.js +1 -0
  335. package/.next/standalone/apps/web/.next/server/chunks/1389.js +5 -0
  336. package/.next/standalone/apps/web/.next/server/chunks/1479.js +1 -0
  337. package/.next/standalone/apps/web/.next/server/chunks/1602.js +1 -0
  338. package/.next/standalone/apps/web/.next/server/chunks/1778.js +1 -0
  339. package/.next/standalone/apps/web/.next/server/chunks/1810.js +1 -0
  340. package/.next/standalone/apps/web/.next/server/chunks/1953.js +1 -0
  341. package/.next/standalone/apps/web/.next/server/chunks/1999.js +6 -0
  342. package/.next/standalone/apps/web/.next/server/chunks/2097.js +1 -0
  343. package/.next/standalone/apps/web/.next/server/chunks/2129.js +47 -0
  344. package/.next/standalone/apps/web/.next/server/chunks/2411.js +193 -0
  345. package/.next/standalone/apps/web/.next/server/chunks/2500.js +1 -0
  346. package/.next/standalone/apps/web/.next/server/chunks/2552.js +1 -0
  347. package/.next/standalone/apps/web/.next/server/chunks/2595.js +45 -0
  348. package/.next/standalone/apps/web/.next/server/chunks/2883.js +1 -0
  349. package/.next/standalone/apps/web/.next/server/chunks/2918.js +212 -0
  350. package/.next/standalone/apps/web/.next/server/chunks/309.js +2 -0
  351. package/.next/standalone/apps/web/.next/server/chunks/3122.js +1 -0
  352. package/.next/standalone/apps/web/.next/server/chunks/3257.js +1 -0
  353. package/.next/standalone/apps/web/.next/server/chunks/3287.js +1 -0
  354. package/.next/standalone/apps/web/.next/server/chunks/3304.js +1 -0
  355. package/.next/standalone/apps/web/.next/server/chunks/340.js +1 -0
  356. package/.next/standalone/apps/web/.next/server/chunks/3545.js +6 -0
  357. package/.next/standalone/apps/web/.next/server/chunks/3577.js +27 -0
  358. package/.next/standalone/apps/web/.next/server/chunks/3609.js +1 -0
  359. package/.next/standalone/apps/web/.next/server/chunks/364.js +36 -0
  360. package/.next/standalone/apps/web/.next/server/chunks/3642.js +1 -0
  361. package/.next/standalone/apps/web/.next/server/chunks/365.js +1 -0
  362. package/.next/standalone/apps/web/.next/server/chunks/4292.js +1 -0
  363. package/.next/standalone/apps/web/.next/server/chunks/4327.js +1 -0
  364. package/.next/standalone/apps/web/.next/server/chunks/4375.js +1 -0
  365. package/.next/standalone/apps/web/.next/server/chunks/4441.js +1 -0
  366. package/.next/standalone/apps/web/.next/server/chunks/4915.js +1 -0
  367. package/.next/standalone/apps/web/.next/server/chunks/5072.js +47 -0
  368. package/.next/standalone/apps/web/.next/server/chunks/5078.js +1 -0
  369. package/.next/standalone/apps/web/.next/server/chunks/5523.js +10 -0
  370. package/.next/standalone/apps/web/.next/server/chunks/5701.js +1 -0
  371. package/.next/standalone/apps/web/.next/server/chunks/5760.js +11 -0
  372. package/.next/standalone/apps/web/.next/server/chunks/5770.js +1 -0
  373. package/.next/standalone/apps/web/.next/server/chunks/588.js +1 -0
  374. package/.next/standalone/apps/web/.next/server/chunks/5884.js +1 -0
  375. package/.next/standalone/apps/web/.next/server/chunks/5937.js +1 -0
  376. package/.next/standalone/apps/web/.next/server/chunks/5995.js +1 -0
  377. package/.next/standalone/apps/web/.next/server/chunks/600.js +1 -0
  378. package/.next/standalone/apps/web/.next/server/chunks/6014.js +1 -0
  379. package/.next/standalone/apps/web/.next/server/chunks/6066.js +1 -0
  380. package/.next/standalone/apps/web/.next/server/chunks/6149.js +1 -0
  381. package/.next/standalone/apps/web/.next/server/chunks/6199.js +1 -0
  382. package/.next/standalone/apps/web/.next/server/chunks/620.js +78 -0
  383. package/.next/standalone/apps/web/.next/server/chunks/6207.js +14 -0
  384. package/.next/standalone/apps/web/.next/server/chunks/63.js +1 -0
  385. package/.next/standalone/apps/web/.next/server/chunks/6457.js +2 -0
  386. package/.next/standalone/apps/web/.next/server/chunks/6479.js +35 -0
  387. package/.next/standalone/apps/web/.next/server/chunks/657.js +84 -0
  388. package/.next/standalone/apps/web/.next/server/chunks/6573.js +1 -0
  389. package/.next/standalone/apps/web/.next/server/chunks/6814.js +18 -0
  390. package/.next/standalone/apps/web/.next/server/chunks/6909.js +1 -0
  391. package/.next/standalone/apps/web/.next/server/chunks/7010.js +1 -0
  392. package/.next/standalone/apps/web/.next/server/chunks/7289.js +1 -0
  393. package/.next/standalone/apps/web/.next/server/chunks/7324.js +1 -0
  394. package/.next/standalone/apps/web/.next/server/chunks/741.js +1 -0
  395. package/.next/standalone/apps/web/.next/server/chunks/7448.js +165 -0
  396. package/.next/standalone/apps/web/.next/server/chunks/7459.js +1 -0
  397. package/.next/standalone/apps/web/.next/server/chunks/7613.js +1 -0
  398. package/.next/standalone/apps/web/.next/server/chunks/7945.js +1 -0
  399. package/.next/standalone/apps/web/.next/server/chunks/7974.js +20 -0
  400. package/.next/standalone/apps/web/.next/server/chunks/8005.js +41 -0
  401. package/.next/standalone/apps/web/.next/server/chunks/8052.js +55 -0
  402. package/.next/standalone/apps/web/.next/server/chunks/8169.js +1 -0
  403. package/.next/standalone/apps/web/.next/server/chunks/8299.js +2 -0
  404. package/.next/standalone/apps/web/.next/server/chunks/8358.js +1 -0
  405. package/.next/standalone/apps/web/.next/server/chunks/843.js +1 -0
  406. package/.next/standalone/apps/web/.next/server/chunks/8437.js +12 -0
  407. package/.next/standalone/apps/web/.next/server/chunks/8840.js +1 -0
  408. package/.next/standalone/apps/web/.next/server/chunks/8952.js +1859 -0
  409. package/.next/standalone/apps/web/.next/server/chunks/9016.js +1 -0
  410. package/.next/standalone/apps/web/.next/server/chunks/9028.js +1 -0
  411. package/.next/standalone/apps/web/.next/server/chunks/9077.js +1 -0
  412. package/.next/standalone/apps/web/.next/server/chunks/915.js +1 -0
  413. package/.next/standalone/apps/web/.next/server/chunks/9248.js +256 -0
  414. package/.next/standalone/apps/web/.next/server/chunks/9301.js +1 -0
  415. package/.next/standalone/apps/web/.next/server/chunks/9319.js +1 -0
  416. package/.next/standalone/apps/web/.next/server/chunks/9439.js +24 -0
  417. package/.next/standalone/apps/web/.next/server/chunks/9480.js +1 -0
  418. package/.next/standalone/apps/web/.next/server/chunks/9579.js +1 -0
  419. package/.next/standalone/apps/web/.next/server/chunks/9768.js +4 -0
  420. package/.next/standalone/apps/web/.next/server/chunks/9837.js +121 -0
  421. package/.next/standalone/apps/web/.next/server/chunks/9851.js +1 -0
  422. package/.next/standalone/apps/web/.next/server/chunks/static/media/pdf.worker.min.63b810cd.mjs +6 -0
  423. package/.next/standalone/apps/web/.next/server/functions-config-manifest.json +82 -0
  424. package/.next/standalone/apps/web/.next/server/middleware-build-manifest.js +1 -0
  425. package/.next/standalone/apps/web/.next/server/middleware-manifest.json +6 -0
  426. package/.next/standalone/apps/web/.next/server/middleware-react-loadable-manifest.js +1 -0
  427. package/.next/standalone/apps/web/.next/server/next-font-manifest.js +1 -0
  428. package/.next/standalone/apps/web/.next/server/next-font-manifest.json +1 -0
  429. package/.next/standalone/apps/web/.next/server/pages/404.html +1 -0
  430. package/.next/standalone/apps/web/.next/server/pages/500.html +1 -0
  431. package/.next/standalone/apps/web/.next/server/pages-manifest.json +4 -0
  432. package/.next/standalone/apps/web/.next/server/prefetch-hints.json +95 -0
  433. package/.next/standalone/apps/web/.next/server/server-reference-manifest.js +1 -0
  434. package/.next/standalone/apps/web/.next/server/server-reference-manifest.json +1 -0
  435. package/.next/standalone/apps/web/.next/server/webpack-runtime.js +1 -0
  436. package/.next/standalone/apps/web/.next/static/chunks/0ed6b8a9-7f39ffa51cd4d7d3.js +1 -0
  437. package/.next/standalone/apps/web/.next/static/chunks/1788-3ec11e3d6d6986e9.js +1 -0
  438. package/.next/standalone/apps/web/.next/static/chunks/1986-2eb6c09f2f556e84.js +1 -0
  439. package/.next/standalone/apps/web/.next/static/chunks/2038-1dc8a3028545edab.js +1 -0
  440. package/.next/standalone/apps/web/.next/static/chunks/217c94bb-b2b832568a17950f.js +1 -0
  441. package/.next/standalone/apps/web/.next/static/chunks/227-7f3dac471f0eb3b0.js +1 -0
  442. package/.next/standalone/apps/web/.next/static/chunks/2634.803b324122bd1d49.js +1 -0
  443. package/.next/standalone/apps/web/.next/static/chunks/2928-8a2d9ed34f45623a.js +1 -0
  444. package/.next/standalone/apps/web/.next/static/chunks/3182.74de4aadefc6e951.js +1 -0
  445. package/.next/standalone/apps/web/.next/static/chunks/3259.41d1a9e21c751dca.js +1 -0
  446. package/.next/standalone/apps/web/.next/static/chunks/3853-f4d7f7a9e7afd752.js +1 -0
  447. package/.next/standalone/apps/web/.next/static/chunks/4112ad79.b782044759df4bc8.js +45 -0
  448. package/.next/standalone/apps/web/.next/static/chunks/4765-48a3b66331719b80.js +1 -0
  449. package/.next/standalone/apps/web/.next/static/chunks/4975-4de53a9574e52468.js +1 -0
  450. package/.next/standalone/apps/web/.next/static/chunks/5833-f7b1cb2153cd52ab.js +1 -0
  451. package/.next/standalone/apps/web/.next/static/chunks/6462-9d67b69d990b1234.js +1 -0
  452. package/.next/standalone/apps/web/.next/static/chunks/6837-67b91a5109edf8a8.js +1 -0
  453. package/.next/standalone/apps/web/.next/static/chunks/6880.4300fd5c0fd7f17a.js +1 -0
  454. package/.next/standalone/apps/web/.next/static/chunks/6904-f77e06e821ecae13.js +52 -0
  455. package/.next/standalone/apps/web/.next/static/chunks/7534-8b910687515b8403.js +6 -0
  456. package/.next/standalone/apps/web/.next/static/chunks/7857.ce5356f660fb54a1.js +1 -0
  457. package/.next/standalone/apps/web/.next/static/chunks/8226-c6f5131375b6df6a.js +3 -0
  458. package/.next/standalone/apps/web/.next/static/chunks/9734-c7b94c9bf40c9b2e.js +1 -0
  459. package/.next/standalone/apps/web/.next/static/chunks/9779-5dc3db110e05c070.js +1 -0
  460. package/.next/standalone/apps/web/.next/static/chunks/9987-45c7dfa599210f7e.js +78 -0
  461. package/.next/standalone/apps/web/.next/static/chunks/app/_global-error/page-0d4f12c4c9cbf85f.js +1 -0
  462. package/.next/standalone/apps/web/.next/static/chunks/app/_not-found/page-7007da1b6a809c3d.js +1 -0
  463. package/.next/standalone/apps/web/.next/static/chunks/app/add/page-d423813ec2556ef0.js +1 -0
  464. package/.next/standalone/apps/web/.next/static/chunks/app/api/analytics/route-0d4f12c4c9cbf85f.js +1 -0
  465. package/.next/standalone/apps/web/.next/static/chunks/app/api/chat/feedback/route-0d4f12c4c9cbf85f.js +1 -0
  466. package/.next/standalone/apps/web/.next/static/chunks/app/api/chat/route-0d4f12c4c9cbf85f.js +1 -0
  467. package/.next/standalone/apps/web/.next/static/chunks/app/api/chat/status/route-0d4f12c4c9cbf85f.js +1 -0
  468. package/.next/standalone/apps/web/.next/static/chunks/app/api/config/route-0d4f12c4c9cbf85f.js +1 -0
  469. package/.next/standalone/apps/web/.next/static/chunks/app/api/config/test/route-0d4f12c4c9cbf85f.js +1 -0
  470. package/.next/standalone/apps/web/.next/static/chunks/app/api/config/test-embedding/route-0d4f12c4c9cbf85f.js +1 -0
  471. package/.next/standalone/apps/web/.next/static/chunks/app/api/config/test-llm/route-0d4f12c4c9cbf85f.js +1 -0
  472. package/.next/standalone/apps/web/.next/static/chunks/app/api/config/test-provider/route-0d4f12c4c9cbf85f.js +1 -0
  473. package/.next/standalone/apps/web/.next/static/chunks/app/api/config/verify/route-0d4f12c4c9cbf85f.js +1 -0
  474. package/.next/standalone/apps/web/.next/static/chunks/app/api/connections/[channelId]/oauth/callback/route-0d4f12c4c9cbf85f.js +1 -0
  475. package/.next/standalone/apps/web/.next/static/chunks/app/api/connections/[channelId]/oauth/start/route-0d4f12c4c9cbf85f.js +1 -0
  476. package/.next/standalone/apps/web/.next/static/chunks/app/api/connections/[channelId]/route-0d4f12c4c9cbf85f.js +1 -0
  477. package/.next/standalone/apps/web/.next/static/chunks/app/api/connections/route-0d4f12c4c9cbf85f.js +1 -0
  478. package/.next/standalone/apps/web/.next/static/chunks/app/api/connections/tunnel/route-0d4f12c4c9cbf85f.js +1 -0
  479. package/.next/standalone/apps/web/.next/static/chunks/app/api/demo/route-0d4f12c4c9cbf85f.js +1 -0
  480. package/.next/standalone/apps/web/.next/static/chunks/app/api/deploy/ssh/route-0d4f12c4c9cbf85f.js +1 -0
  481. package/.next/standalone/apps/web/.next/static/chunks/app/api/deploy/verify/route-0d4f12c4c9cbf85f.js +1 -0
  482. package/.next/standalone/apps/web/.next/static/chunks/app/api/describe-image/route-0d4f12c4c9cbf85f.js +1 -0
  483. package/.next/standalone/apps/web/.next/static/chunks/app/api/doc-editor/edit/route-0d4f12c4c9cbf85f.js +1 -0
  484. package/.next/standalone/apps/web/.next/static/chunks/app/api/doc-editor/export/route-0d4f12c4c9cbf85f.js +1 -0
  485. package/.next/standalone/apps/web/.next/static/chunks/app/api/doc-editor/extract-text/route-0d4f12c4c9cbf85f.js +1 -0
  486. package/.next/standalone/apps/web/.next/static/chunks/app/api/doc-editor/parse/route-0d4f12c4c9cbf85f.js +1 -0
  487. package/.next/standalone/apps/web/.next/static/chunks/app/api/doc-editor/restore/route-0d4f12c4c9cbf85f.js +1 -0
  488. package/.next/standalone/apps/web/.next/static/chunks/app/api/document/sign/route-0d4f12c4c9cbf85f.js +1 -0
  489. package/.next/standalone/apps/web/.next/static/chunks/app/api/documents/move/route-0d4f12c4c9cbf85f.js +1 -0
  490. package/.next/standalone/apps/web/.next/static/chunks/app/api/documents/route-0d4f12c4c9cbf85f.js +1 -0
  491. package/.next/standalone/apps/web/.next/static/chunks/app/api/files/remote/route-0d4f12c4c9cbf85f.js +1 -0
  492. package/.next/standalone/apps/web/.next/static/chunks/app/api/firecrawl/local/route-0d4f12c4c9cbf85f.js +1 -0
  493. package/.next/standalone/apps/web/.next/static/chunks/app/api/gpu-activity/route-0d4f12c4c9cbf85f.js +1 -0
  494. package/.next/standalone/apps/web/.next/static/chunks/app/api/groups/route-0d4f12c4c9cbf85f.js +1 -0
  495. package/.next/standalone/apps/web/.next/static/chunks/app/api/index/route-0d4f12c4c9cbf85f.js +1 -0
  496. package/.next/standalone/apps/web/.next/static/chunks/app/api/integrations/[integration]/callback/route-0d4f12c4c9cbf85f.js +1 -0
  497. package/.next/standalone/apps/web/.next/static/chunks/app/api/integrations/[integration]/route-0d4f12c4c9cbf85f.js +1 -0
  498. package/.next/standalone/apps/web/.next/static/chunks/app/api/integrations/notion/callback/route-0d4f12c4c9cbf85f.js +1 -0
  499. package/.next/standalone/apps/web/.next/static/chunks/app/api/integrations/notion/route-0d4f12c4c9cbf85f.js +1 -0
  500. package/.next/standalone/apps/web/.next/static/chunks/app/api/integrations/route-0d4f12c4c9cbf85f.js +1 -0
  501. package/.next/standalone/apps/web/.next/static/chunks/app/api/jobs/[id]/route-0d4f12c4c9cbf85f.js +1 -0
  502. package/.next/standalone/apps/web/.next/static/chunks/app/api/jobs/route-0d4f12c4c9cbf85f.js +1 -0
  503. package/.next/standalone/apps/web/.next/static/chunks/app/api/marketplace/[toolId]/route-0d4f12c4c9cbf85f.js +1 -0
  504. package/.next/standalone/apps/web/.next/static/chunks/app/api/marketplace/route-0d4f12c4c9cbf85f.js +1 -0
  505. package/.next/standalone/apps/web/.next/static/chunks/app/api/mcp/[connectionId]/route-0d4f12c4c9cbf85f.js +1 -0
  506. package/.next/standalone/apps/web/.next/static/chunks/app/api/mcp/[connectionId]/test/route-0d4f12c4c9cbf85f.js +1 -0
  507. package/.next/standalone/apps/web/.next/static/chunks/app/api/mcp/route-0d4f12c4c9cbf85f.js +1 -0
  508. package/.next/standalone/apps/web/.next/static/chunks/app/api/media/[id]/frame/route-0d4f12c4c9cbf85f.js +1 -0
  509. package/.next/standalone/apps/web/.next/static/chunks/app/api/media/[id]/route-0d4f12c4c9cbf85f.js +1 -0
  510. package/.next/standalone/apps/web/.next/static/chunks/app/api/media/inspect/route-0d4f12c4c9cbf85f.js +1 -0
  511. package/.next/standalone/apps/web/.next/static/chunks/app/api/media/jobs/[id]/approval/route-0d4f12c4c9cbf85f.js +1 -0
  512. package/.next/standalone/apps/web/.next/static/chunks/app/api/media/jobs/[id]/route-0d4f12c4c9cbf85f.js +1 -0
  513. package/.next/standalone/apps/web/.next/static/chunks/app/api/media/process/route-0d4f12c4c9cbf85f.js +1 -0
  514. package/.next/standalone/apps/web/.next/static/chunks/app/api/media/route-0d4f12c4c9cbf85f.js +1 -0
  515. package/.next/standalone/apps/web/.next/static/chunks/app/api/media/stream/route-0d4f12c4c9cbf85f.js +1 -0
  516. package/.next/standalone/apps/web/.next/static/chunks/app/api/models/route-0d4f12c4c9cbf85f.js +1 -0
  517. package/.next/standalone/apps/web/.next/static/chunks/app/api/parse-file/route-0d4f12c4c9cbf85f.js +1 -0
  518. package/.next/standalone/apps/web/.next/static/chunks/app/api/pdf-page/route-0d4f12c4c9cbf85f.js +1 -0
  519. package/.next/standalone/apps/web/.next/static/chunks/app/api/projects/deployments/route-0d4f12c4c9cbf85f.js +1 -0
  520. package/.next/standalone/apps/web/.next/static/chunks/app/api/projects/route-0d4f12c4c9cbf85f.js +1 -0
  521. package/.next/standalone/apps/web/.next/static/chunks/app/api/projects/runtime/route-0d4f12c4c9cbf85f.js +1 -0
  522. package/.next/standalone/apps/web/.next/static/chunks/app/api/proxy/verify/route-0d4f12c4c9cbf85f.js +1 -0
  523. package/.next/standalone/apps/web/.next/static/chunks/app/api/sandbox/route-0d4f12c4c9cbf85f.js +1 -0
  524. package/.next/standalone/apps/web/.next/static/chunks/app/api/sandbox/verify/route-0d4f12c4c9cbf85f.js +1 -0
  525. package/.next/standalone/apps/web/.next/static/chunks/app/api/search/bing/route-0d4f12c4c9cbf85f.js +1 -0
  526. package/.next/standalone/apps/web/.next/static/chunks/app/api/search/brave/route-0d4f12c4c9cbf85f.js +1 -0
  527. package/.next/standalone/apps/web/.next/static/chunks/app/api/search/exa/route-0d4f12c4c9cbf85f.js +1 -0
  528. package/.next/standalone/apps/web/.next/static/chunks/app/api/search/google/route-0d4f12c4c9cbf85f.js +1 -0
  529. package/.next/standalone/apps/web/.next/static/chunks/app/api/search/route-0d4f12c4c9cbf85f.js +1 -0
  530. package/.next/standalone/apps/web/.next/static/chunks/app/api/search/tavily/route-0d4f12c4c9cbf85f.js +1 -0
  531. package/.next/standalone/apps/web/.next/static/chunks/app/api/search/verify/route-0d4f12c4c9cbf85f.js +1 -0
  532. package/.next/standalone/apps/web/.next/static/chunks/app/api/system/cache/route-0d4f12c4c9cbf85f.js +1 -0
  533. package/.next/standalone/apps/web/.next/static/chunks/app/api/tabular/query/route-0d4f12c4c9cbf85f.js +1 -0
  534. package/.next/standalone/apps/web/.next/static/chunks/app/api/tabular/route-0d4f12c4c9cbf85f.js +1 -0
  535. package/.next/standalone/apps/web/.next/static/chunks/app/api/tools/[toolId]/host/route-0d4f12c4c9cbf85f.js +1 -0
  536. package/.next/standalone/apps/web/.next/static/chunks/app/api/tools/[toolId]/runtime/route-0d4f12c4c9cbf85f.js +1 -0
  537. package/.next/standalone/apps/web/.next/static/chunks/app/api/tools/[toolId]/usage/route-0d4f12c4c9cbf85f.js +1 -0
  538. package/.next/standalone/apps/web/.next/static/chunks/app/api/tools/[toolId]/usage-request/route-0d4f12c4c9cbf85f.js +1 -0
  539. package/.next/standalone/apps/web/.next/static/chunks/app/api/tools/[toolId]/verify/route-0d4f12c4c9cbf85f.js +1 -0
  540. package/.next/standalone/apps/web/.next/static/chunks/app/api/tools/video-intelligence/connection/route-0d4f12c4c9cbf85f.js +1 -0
  541. package/.next/standalone/apps/web/.next/static/chunks/app/api/tools/video-intelligence/usage/route-0d4f12c4c9cbf85f.js +1 -0
  542. package/.next/standalone/apps/web/.next/static/chunks/app/api/tools/video-intelligence/usage-request/route-0d4f12c4c9cbf85f.js +1 -0
  543. package/.next/standalone/apps/web/.next/static/chunks/app/api/upload-file/route-0d4f12c4c9cbf85f.js +1 -0
  544. package/.next/standalone/apps/web/.next/static/chunks/app/api/uploads/[...slug]/route-0d4f12c4c9cbf85f.js +1 -0
  545. package/.next/standalone/apps/web/.next/static/chunks/app/api/vector-stores/install/route-0d4f12c4c9cbf85f.js +1 -0
  546. package/.next/standalone/apps/web/.next/static/chunks/app/api/vector-stores/status/route-0d4f12c4c9cbf85f.js +1 -0
  547. package/.next/standalone/apps/web/.next/static/chunks/app/chat/[id]/page-579d3515fee9f89a.js +1 -0
  548. package/.next/standalone/apps/web/.next/static/chunks/app/chat/page-bec03ef7408245b1.js +1 -0
  549. package/.next/standalone/apps/web/.next/static/chunks/app/data/page-02e56e093071379d.js +1 -0
  550. package/.next/standalone/apps/web/.next/static/chunks/app/layout-4b8ce98cb78f7113.js +1 -0
  551. package/.next/standalone/apps/web/.next/static/chunks/app/page-0d4f12c4c9cbf85f.js +1 -0
  552. package/.next/standalone/apps/web/.next/static/chunks/app/settings/page-485ea820c1111580.js +214 -0
  553. package/.next/standalone/apps/web/.next/static/chunks/app/template-6c3f1e7c9216df6c.js +1 -0
  554. package/.next/standalone/apps/web/.next/static/chunks/ca017448-ac5fddb4e8d1ca39.js +1 -0
  555. package/.next/standalone/apps/web/.next/static/chunks/db534642-baa98c214832026c.js +1 -0
  556. package/.next/standalone/apps/web/.next/static/chunks/framework-ae648e3ae9d64766.js +1 -0
  557. package/.next/standalone/apps/web/.next/static/chunks/main-25c6b3b10ba0a4a3.js +5 -0
  558. package/.next/standalone/apps/web/.next/static/chunks/main-app-ecde5d6ff9b76409.js +1 -0
  559. package/.next/standalone/apps/web/.next/static/chunks/next/dist/client/components/builtin/app-error-0d4f12c4c9cbf85f.js +1 -0
  560. package/.next/standalone/apps/web/.next/static/chunks/next/dist/client/components/builtin/forbidden-0d4f12c4c9cbf85f.js +1 -0
  561. package/.next/standalone/apps/web/.next/static/chunks/next/dist/client/components/builtin/global-error-ab826e81c411f616.js +1 -0
  562. package/.next/standalone/apps/web/.next/static/chunks/next/dist/client/components/builtin/not-found-0d4f12c4c9cbf85f.js +1 -0
  563. package/.next/standalone/apps/web/.next/static/chunks/next/dist/client/components/builtin/unauthorized-0d4f12c4c9cbf85f.js +1 -0
  564. package/.next/standalone/apps/web/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  565. package/.next/standalone/apps/web/.next/static/chunks/webpack-8c15908ca85a5a46.js +1 -0
  566. package/.next/standalone/apps/web/.next/static/css/063aaab22a52e4b4.css +1 -0
  567. package/.next/standalone/apps/web/.next/static/css/a2d2ae3b76e6a5b6.css +1 -0
  568. package/.next/standalone/apps/web/.next/static/media/KaTeX_AMS-Regular.1608a09b.woff +0 -0
  569. package/.next/standalone/apps/web/.next/static/media/KaTeX_AMS-Regular.4aafdb68.ttf +0 -0
  570. package/.next/standalone/apps/web/.next/static/media/KaTeX_AMS-Regular.a79f1c31.woff2 +0 -0
  571. package/.next/standalone/apps/web/.next/static/media/KaTeX_Caligraphic-Bold.b6770918.woff +0 -0
  572. package/.next/standalone/apps/web/.next/static/media/KaTeX_Caligraphic-Bold.cce5b8ec.ttf +0 -0
  573. package/.next/standalone/apps/web/.next/static/media/KaTeX_Caligraphic-Bold.ec17d132.woff2 +0 -0
  574. package/.next/standalone/apps/web/.next/static/media/KaTeX_Caligraphic-Regular.07ef19e7.ttf +0 -0
  575. package/.next/standalone/apps/web/.next/static/media/KaTeX_Caligraphic-Regular.55fac258.woff2 +0 -0
  576. package/.next/standalone/apps/web/.next/static/media/KaTeX_Caligraphic-Regular.dad44a7f.woff +0 -0
  577. package/.next/standalone/apps/web/.next/static/media/KaTeX_Fraktur-Bold.9f256b85.woff +0 -0
  578. package/.next/standalone/apps/web/.next/static/media/KaTeX_Fraktur-Bold.b18f59e1.ttf +0 -0
  579. package/.next/standalone/apps/web/.next/static/media/KaTeX_Fraktur-Bold.d42a5579.woff2 +0 -0
  580. package/.next/standalone/apps/web/.next/static/media/KaTeX_Fraktur-Regular.7c187121.woff +0 -0
  581. package/.next/standalone/apps/web/.next/static/media/KaTeX_Fraktur-Regular.d3c882a6.woff2 +0 -0
  582. package/.next/standalone/apps/web/.next/static/media/KaTeX_Fraktur-Regular.ed38e79f.ttf +0 -0
  583. package/.next/standalone/apps/web/.next/static/media/KaTeX_Main-Bold.b74a1a8b.ttf +0 -0
  584. package/.next/standalone/apps/web/.next/static/media/KaTeX_Main-Bold.c3fb5ac2.woff2 +0 -0
  585. package/.next/standalone/apps/web/.next/static/media/KaTeX_Main-Bold.d181c465.woff +0 -0
  586. package/.next/standalone/apps/web/.next/static/media/KaTeX_Main-BoldItalic.6f2bb1df.woff2 +0 -0
  587. package/.next/standalone/apps/web/.next/static/media/KaTeX_Main-BoldItalic.70d8b0a5.ttf +0 -0
  588. package/.next/standalone/apps/web/.next/static/media/KaTeX_Main-BoldItalic.e3f82f9d.woff +0 -0
  589. package/.next/standalone/apps/web/.next/static/media/KaTeX_Main-Italic.47373d1e.ttf +0 -0
  590. package/.next/standalone/apps/web/.next/static/media/KaTeX_Main-Italic.8916142b.woff2 +0 -0
  591. package/.next/standalone/apps/web/.next/static/media/KaTeX_Main-Italic.9024d815.woff +0 -0
  592. package/.next/standalone/apps/web/.next/static/media/KaTeX_Main-Regular.0462f03b.woff2 +0 -0
  593. package/.next/standalone/apps/web/.next/static/media/KaTeX_Main-Regular.7f51fe03.woff +0 -0
  594. package/.next/standalone/apps/web/.next/static/media/KaTeX_Main-Regular.b7f8fe9b.ttf +0 -0
  595. package/.next/standalone/apps/web/.next/static/media/KaTeX_Math-BoldItalic.572d331f.woff2 +0 -0
  596. package/.next/standalone/apps/web/.next/static/media/KaTeX_Math-BoldItalic.a879cf83.ttf +0 -0
  597. package/.next/standalone/apps/web/.next/static/media/KaTeX_Math-BoldItalic.f1035d8d.woff +0 -0
  598. package/.next/standalone/apps/web/.next/static/media/KaTeX_Math-Italic.5295ba48.woff +0 -0
  599. package/.next/standalone/apps/web/.next/static/media/KaTeX_Math-Italic.939bc644.ttf +0 -0
  600. package/.next/standalone/apps/web/.next/static/media/KaTeX_Math-Italic.f28c23ac.woff2 +0 -0
  601. package/.next/standalone/apps/web/.next/static/media/KaTeX_SansSerif-Bold.8c5b5494.woff2 +0 -0
  602. package/.next/standalone/apps/web/.next/static/media/KaTeX_SansSerif-Bold.94e1e8dc.ttf +0 -0
  603. package/.next/standalone/apps/web/.next/static/media/KaTeX_SansSerif-Bold.bf59d231.woff +0 -0
  604. package/.next/standalone/apps/web/.next/static/media/KaTeX_SansSerif-Italic.3b1e59b3.woff2 +0 -0
  605. package/.next/standalone/apps/web/.next/static/media/KaTeX_SansSerif-Italic.7c9bc82b.woff +0 -0
  606. package/.next/standalone/apps/web/.next/static/media/KaTeX_SansSerif-Italic.b4c20c84.ttf +0 -0
  607. package/.next/standalone/apps/web/.next/static/media/KaTeX_SansSerif-Regular.74048478.woff +0 -0
  608. package/.next/standalone/apps/web/.next/static/media/KaTeX_SansSerif-Regular.ba21ed5f.woff2 +0 -0
  609. package/.next/standalone/apps/web/.next/static/media/KaTeX_SansSerif-Regular.d4d7ba48.ttf +0 -0
  610. package/.next/standalone/apps/web/.next/static/media/KaTeX_Script-Regular.03e9641d.woff2 +0 -0
  611. package/.next/standalone/apps/web/.next/static/media/KaTeX_Script-Regular.07505710.woff +0 -0
  612. package/.next/standalone/apps/web/.next/static/media/KaTeX_Script-Regular.fe9cbbe1.ttf +0 -0
  613. package/.next/standalone/apps/web/.next/static/media/KaTeX_Size1-Regular.e1e279cb.woff +0 -0
  614. package/.next/standalone/apps/web/.next/static/media/KaTeX_Size1-Regular.eae34984.woff2 +0 -0
  615. package/.next/standalone/apps/web/.next/static/media/KaTeX_Size1-Regular.fabc004a.ttf +0 -0
  616. package/.next/standalone/apps/web/.next/static/media/KaTeX_Size2-Regular.57727022.woff +0 -0
  617. package/.next/standalone/apps/web/.next/static/media/KaTeX_Size2-Regular.5916a24f.woff2 +0 -0
  618. package/.next/standalone/apps/web/.next/static/media/KaTeX_Size2-Regular.d6b476ec.ttf +0 -0
  619. package/.next/standalone/apps/web/.next/static/media/KaTeX_Size3-Regular.9acaf01c.woff +0 -0
  620. package/.next/standalone/apps/web/.next/static/media/KaTeX_Size3-Regular.a144ef58.ttf +0 -0
  621. package/.next/standalone/apps/web/.next/static/media/KaTeX_Size3-Regular.b4230e7e.woff2 +0 -0
  622. package/.next/standalone/apps/web/.next/static/media/KaTeX_Size4-Regular.10d95fd3.woff2 +0 -0
  623. package/.next/standalone/apps/web/.next/static/media/KaTeX_Size4-Regular.7a996c9d.woff +0 -0
  624. package/.next/standalone/apps/web/.next/static/media/KaTeX_Size4-Regular.fbccdabe.ttf +0 -0
  625. package/.next/standalone/apps/web/.next/static/media/KaTeX_Typewriter-Regular.6258592b.woff +0 -0
  626. package/.next/standalone/apps/web/.next/static/media/KaTeX_Typewriter-Regular.a8709e36.woff2 +0 -0
  627. package/.next/standalone/apps/web/.next/static/media/KaTeX_Typewriter-Regular.d97aaf4a.ttf +0 -0
  628. package/.next/standalone/apps/web/.next/static/media/pdf.worker.min.b6d469c6.mjs +6 -0
  629. package/.next/standalone/apps/web/.next/static/omDbbCzcQ9kxlZ8Gz0yln/_buildManifest.js +1 -0
  630. package/.next/standalone/apps/web/.next/static/omDbbCzcQ9kxlZ8Gz0yln/_ssgManifest.js +1 -0
  631. package/.next/standalone/apps/web/.next/types/cache-life.d.ts +146 -0
  632. package/.next/standalone/apps/web/.next/types/root-params.d.ts +3 -0
  633. package/.next/standalone/apps/web/.next/types/routes.d.ts +161 -0
  634. package/.next/standalone/apps/web/.next/types/validator.ts +862 -0
  635. package/.next/standalone/apps/web/AGENTS.md +9 -0
  636. package/.next/standalone/apps/web/CLAUDE.md +1 -0
  637. package/.next/standalone/apps/web/app/api/groups/route.test.ts +86 -0
  638. package/.next/standalone/apps/web/app/api/index/route.test.ts +55 -0
  639. package/.next/standalone/apps/web/app/api/marketplace/[toolId]/route.test.ts +83 -0
  640. package/.next/standalone/apps/web/app/api/marketplace/route.test.ts +117 -0
  641. package/.next/standalone/apps/web/app/api/tools/[toolId]/verify/route.test.ts +66 -0
  642. package/.next/standalone/apps/web/app/favicon.ico +0 -0
  643. package/.next/standalone/apps/web/app/globals.css +406 -0
  644. package/.next/standalone/apps/web/app/themes.css +234 -0
  645. package/.next/standalone/apps/web/bin/larkup.js +528 -0
  646. package/.next/standalone/apps/web/components/alerts/generic-alert.tsx +76 -0
  647. package/.next/standalone/apps/web/components/analytics/analytics-dashboard.tsx +517 -0
  648. package/.next/standalone/apps/web/components/chat/canvas/doc-editor-provider.tsx +331 -0
  649. package/.next/standalone/apps/web/components/chat/canvas/document-canvas.tsx +98 -0
  650. package/.next/standalone/apps/web/components/chat/canvas/document-field.tsx +167 -0
  651. package/.next/standalone/apps/web/components/chat/canvas/document-viewer.tsx +446 -0
  652. package/.next/standalone/apps/web/components/chat/canvas/file-attachment-button.tsx +88 -0
  653. package/.next/standalone/apps/web/components/chat/canvas/file-chip.tsx +147 -0
  654. package/.next/standalone/apps/web/components/chat/message-actions.tsx +96 -0
  655. package/.next/standalone/apps/web/components/chat/message-item.tsx +1404 -0
  656. package/.next/standalone/apps/web/components/chat/message-queue.tsx +86 -0
  657. package/.next/standalone/apps/web/components/chat/reasoning.tsx +182 -0
  658. package/.next/standalone/apps/web/components/chat/tools/chat-card.tsx +97 -0
  659. package/.next/standalone/apps/web/components/chat/tools/chat-chart.tsx +554 -0
  660. package/.next/standalone/apps/web/components/chat/tools/chat-citations.tsx +152 -0
  661. package/.next/standalone/apps/web/components/chat/tools/chat-data-table.tsx +377 -0
  662. package/.next/standalone/apps/web/components/chat/tools/chat-file-export.tsx +49 -0
  663. package/.next/standalone/apps/web/components/chat/tools/chat-grid.tsx +99 -0
  664. package/.next/standalone/apps/web/components/chat/tools/chat-media-preview.tsx +465 -0
  665. package/.next/standalone/apps/web/components/chat/tools/chat-metrics.tsx +76 -0
  666. package/.next/standalone/apps/web/components/chat/tools/chat-sandbox-result.tsx +130 -0
  667. package/.next/standalone/apps/web/components/chat/tools/chat-signature-request.tsx +809 -0
  668. package/.next/standalone/apps/web/components/chat/tools/chat-tabs.tsx +59 -0
  669. package/.next/standalone/apps/web/components/chat/tools/corpus-data-result.tsx +194 -0
  670. package/.next/standalone/apps/web/components/chat/tools/knowledge-base-result.tsx +345 -0
  671. package/.next/standalone/apps/web/components/chat/tools/visual-placement-modal.tsx +314 -0
  672. package/.next/standalone/apps/web/components/chat/tools/visualization-tabs.tsx +37 -0
  673. package/.next/standalone/apps/web/components/configure/custom-model-modal.tsx +214 -0
  674. package/.next/standalone/apps/web/components/configure/store-fields.tsx +129 -0
  675. package/.next/standalone/apps/web/components/data/corpus-panel.tsx +1124 -0
  676. package/.next/standalone/apps/web/components/data/data-entry-mode-switch.tsx +53 -0
  677. package/.next/standalone/apps/web/components/data/data-primary-action.ts +6 -0
  678. package/.next/standalone/apps/web/components/data/groups-panel.tsx +526 -0
  679. package/.next/standalone/apps/web/components/data/integration-resources-panel.tsx +281 -0
  680. package/.next/standalone/apps/web/components/data/integrations-panel.tsx +397 -0
  681. package/.next/standalone/apps/web/components/data/jobs-panel.tsx +487 -0
  682. package/.next/standalone/apps/web/components/data/jobs-tracking-button.tsx +221 -0
  683. package/.next/standalone/apps/web/components/data/live-media-progress.tsx +79 -0
  684. package/.next/standalone/apps/web/components/data/media-indexing-jobs-panel.tsx +190 -0
  685. package/.next/standalone/apps/web/components/data/media-panel.tsx +2883 -0
  686. package/.next/standalone/apps/web/components/data/notion-panel.tsx +405 -0
  687. package/.next/standalone/apps/web/components/data/paste-panel.tsx +100 -0
  688. package/.next/standalone/apps/web/components/data/scrape-panel.tsx +1275 -0
  689. package/.next/standalone/apps/web/components/data/tabular-preview.tsx +205 -0
  690. package/.next/standalone/apps/web/components/data/tool-indexing-dialog.tsx +210 -0
  691. package/.next/standalone/apps/web/components/data/upload-panel.tsx +1306 -0
  692. package/.next/standalone/apps/web/components/data/web-crawler-status.tsx +131 -0
  693. package/.next/standalone/apps/web/components/index/index-action-dialog.tsx +545 -0
  694. package/.next/standalone/apps/web/components/index/index-workspace.tsx +406 -0
  695. package/.next/standalone/apps/web/components/onboarding/welcome-screen.tsx +596 -0
  696. package/.next/standalone/apps/web/components/projects/delete-project-dialog.tsx +63 -0
  697. package/.next/standalone/apps/web/components/projects/project-form-dialog.tsx +97 -0
  698. package/.next/standalone/apps/web/components/projects/project-switcher.tsx +136 -0
  699. package/.next/standalone/apps/web/components/settings/general/agent-customization-section.tsx +619 -0
  700. package/.next/standalone/apps/web/components/settings/general/cache-management-card.tsx +176 -0
  701. package/.next/standalone/apps/web/components/settings/general/general-section.tsx +333 -0
  702. package/.next/standalone/apps/web/components/settings/general/mcp-connections-section.tsx +893 -0
  703. package/.next/standalone/apps/web/components/settings/general/model-combobox.tsx +235 -0
  704. package/.next/standalone/apps/web/components/settings/general/models-section.tsx +918 -0
  705. package/.next/standalone/apps/web/components/settings/general/sandbox-section.tsx +382 -0
  706. package/.next/standalone/apps/web/components/settings/general/search-scraping-section.tsx +749 -0
  707. package/.next/standalone/apps/web/components/settings/general/storage-indexing-section.tsx +389 -0
  708. package/.next/standalone/apps/web/components/settings/hub/marketplace-section.tsx +574 -0
  709. package/.next/standalone/apps/web/components/settings/hub/marketplace-tools-settings.tsx +1247 -0
  710. package/.next/standalone/apps/web/components/settings/runtime/connections-tab.tsx +1045 -0
  711. package/.next/standalone/apps/web/components/settings/runtime/deploy/index.ts +4 -0
  712. package/.next/standalone/apps/web/components/settings/runtime/deploy/project-deploy-button.tsx +245 -0
  713. package/.next/standalone/apps/web/components/settings/runtime/deploy/project-deploy-view.tsx +1592 -0
  714. package/.next/standalone/apps/web/components/settings/runtime/deploy/use-vps-deploy.ts +114 -0
  715. package/.next/standalone/apps/web/components/settings/runtime/deploy/vps-terminal-dialog.tsx +391 -0
  716. package/.next/standalone/apps/web/components/settings/runtime/playground-tab.tsx +359 -0
  717. package/.next/standalone/apps/web/components/settings/runtime/runtime-section.tsx +1001 -0
  718. package/.next/standalone/apps/web/components/settings/runtime/widget-snippets.ts +15 -0
  719. package/.next/standalone/apps/web/components/settings/runtime/widget-tab.tsx +426 -0
  720. package/.next/standalone/apps/web/components/settings/settings-layout.tsx +123 -0
  721. package/.next/standalone/apps/web/components/sidebar.tsx +208 -0
  722. package/.next/standalone/apps/web/components/topnav.tsx +92 -0
  723. package/.next/standalone/apps/web/components/ui/alert-dialog.tsx +187 -0
  724. package/.next/standalone/apps/web/components/ui/alert.tsx +76 -0
  725. package/.next/standalone/apps/web/components/ui/badge.tsx +52 -0
  726. package/.next/standalone/apps/web/components/ui/button.tsx +58 -0
  727. package/.next/standalone/apps/web/components/ui/card.tsx +92 -0
  728. package/.next/standalone/apps/web/components/ui/checkbox.tsx +28 -0
  729. package/.next/standalone/apps/web/components/ui/collapsible.tsx +21 -0
  730. package/.next/standalone/apps/web/components/ui/command.tsx +181 -0
  731. package/.next/standalone/apps/web/components/ui/dialog.tsx +138 -0
  732. package/.next/standalone/apps/web/components/ui/dropdown-menu.tsx +267 -0
  733. package/.next/standalone/apps/web/components/ui/input-group.tsx +146 -0
  734. package/.next/standalone/apps/web/components/ui/input.tsx +20 -0
  735. package/.next/standalone/apps/web/components/ui/label.tsx +20 -0
  736. package/.next/standalone/apps/web/components/ui/line-tabs.tsx +59 -0
  737. package/.next/standalone/apps/web/components/ui/popover.tsx +77 -0
  738. package/.next/standalone/apps/web/components/ui/progress.tsx +83 -0
  739. package/.next/standalone/apps/web/components/ui/provider-icon.tsx +165 -0
  740. package/.next/standalone/apps/web/components/ui/scroll-area.tsx +55 -0
  741. package/.next/standalone/apps/web/components/ui/select.tsx +231 -0
  742. package/.next/standalone/apps/web/components/ui/separator.tsx +25 -0
  743. package/.next/standalone/apps/web/components/ui/sheet.tsx +125 -0
  744. package/.next/standalone/apps/web/components/ui/skeleton.tsx +14 -0
  745. package/.next/standalone/apps/web/components/ui/slider.tsx +52 -0
  746. package/.next/standalone/apps/web/components/ui/switch.tsx +32 -0
  747. package/.next/standalone/apps/web/components/ui/table.tsx +116 -0
  748. package/.next/standalone/apps/web/components/ui/tabs.tsx +77 -0
  749. package/.next/standalone/apps/web/components/ui/textarea.tsx +18 -0
  750. package/.next/standalone/apps/web/components/ui/tooltip.tsx +54 -0
  751. package/.next/standalone/apps/web/components.json +21 -0
  752. package/.next/standalone/apps/web/hooks/use-channel-oauth.ts +42 -0
  753. package/.next/standalone/apps/web/hooks/use-copy-to-clipboard.ts +25 -0
  754. package/.next/standalone/apps/web/hooks/use-integration-auth.ts +37 -0
  755. package/.next/standalone/apps/web/hooks/use-live-media-progress.ts +71 -0
  756. package/.next/standalone/apps/web/hooks/use-notion-auth.ts +63 -0
  757. package/.next/standalone/apps/web/lib/browser-cache.test.ts +32 -0
  758. package/.next/standalone/apps/web/lib/browser-cache.ts +17 -0
  759. package/.next/standalone/apps/web/lib/cache-size.test.ts +15 -0
  760. package/.next/standalone/apps/web/lib/cache-size.ts +11 -0
  761. package/.next/standalone/apps/web/lib/chat/assistant-source-scope.test.ts +43 -0
  762. package/.next/standalone/apps/web/lib/chat/chart-config.test.ts +144 -0
  763. package/.next/standalone/apps/web/lib/chat/chat-media-preview.test.ts +31 -0
  764. package/.next/standalone/apps/web/lib/chat/conversation-memory.test.ts +390 -0
  765. package/.next/standalone/apps/web/lib/chat/data-export.test.ts +224 -0
  766. package/.next/standalone/apps/web/lib/chat/live-tool-progress.test.ts +76 -0
  767. package/.next/standalone/apps/web/lib/chat/live-tool-progress.ts +69 -0
  768. package/.next/standalone/apps/web/lib/chat/media-retrieval-routing.test.ts +42 -0
  769. package/.next/standalone/apps/web/lib/chat/media-source-routing.test.ts +118 -0
  770. package/.next/standalone/apps/web/lib/chat/message-feedback.test.ts +102 -0
  771. package/.next/standalone/apps/web/lib/chat/message-input.test.ts +30 -0
  772. package/.next/standalone/apps/web/lib/chat/retrieval-ranking.test.ts +62 -0
  773. package/.next/standalone/apps/web/lib/chat/retrieval-routing.test.ts +80 -0
  774. package/.next/standalone/apps/web/lib/chat/tabular-dataset-routing.test.ts +83 -0
  775. package/.next/standalone/apps/web/lib/chat/tabular-query-plan.test.ts +148 -0
  776. package/.next/standalone/apps/web/lib/chat/tabular-routing.test.ts +109 -0
  777. package/.next/standalone/apps/web/lib/chat/tabular-sandbox-files.test.ts +100 -0
  778. package/.next/standalone/apps/web/lib/chat/tabular-visualization.test.ts +89 -0
  779. package/.next/standalone/apps/web/lib/chat/tool-call-repair.test.ts +64 -0
  780. package/.next/standalone/apps/web/lib/chat/tool-context.test.ts +978 -0
  781. package/.next/standalone/apps/web/lib/chat/tool-output.test.ts +23 -0
  782. package/.next/standalone/apps/web/lib/chat/tool-output.ts +14 -0
  783. package/.next/standalone/apps/web/lib/chat/tool-registry.test.ts +19 -0
  784. package/.next/standalone/apps/web/lib/chat/video-rag-routing.test.ts +158 -0
  785. package/.next/standalone/apps/web/lib/chat/visual-routing.test.ts +140 -0
  786. package/.next/standalone/apps/web/lib/chat-supporting-clip.test.ts +16 -0
  787. package/.next/standalone/apps/web/lib/chat-supporting-clip.ts +16 -0
  788. package/.next/standalone/apps/web/lib/constants/stores.ts +12 -0
  789. package/.next/standalone/apps/web/lib/constants/tools.test.ts +26 -0
  790. package/.next/standalone/apps/web/lib/constants/tools.ts +178 -0
  791. package/.next/standalone/apps/web/lib/error-formatter.ts +30 -0
  792. package/.next/standalone/apps/web/lib/jobs-client.ts +25 -0
  793. package/.next/standalone/apps/web/lib/marketplace/tool-runtime-config.test.ts +217 -0
  794. package/.next/standalone/apps/web/lib/media/knowledge.test.ts +36 -0
  795. package/.next/standalone/apps/web/lib/media/pdf-inspection.test.ts +63 -0
  796. package/.next/standalone/apps/web/lib/media/pdf.ts +57 -0
  797. package/.next/standalone/apps/web/lib/media/progress.test.ts +208 -0
  798. package/.next/standalone/apps/web/lib/media/progress.ts +209 -0
  799. package/.next/standalone/apps/web/lib/media/source-identity.test.ts +33 -0
  800. package/.next/standalone/apps/web/lib/media/source-selection.test.ts +36 -0
  801. package/.next/standalone/apps/web/lib/media/source-selection.ts +47 -0
  802. package/.next/standalone/apps/web/lib/media/source-utils.test.ts +231 -0
  803. package/.next/standalone/apps/web/lib/media/tool-indexing-estimate.test.ts +28 -0
  804. package/.next/standalone/apps/web/lib/media/tool-indexing-estimate.ts +39 -0
  805. package/.next/standalone/apps/web/lib/media/video/quick-look.test.ts +81 -0
  806. package/.next/standalone/apps/web/lib/media/video-intelligence-adapter.test.ts +739 -0
  807. package/.next/standalone/apps/web/lib/media/video-intelligence-capacity.test.ts +104 -0
  808. package/.next/standalone/apps/web/lib/media/video-runtime-scope.test.ts +43 -0
  809. package/.next/standalone/apps/web/lib/release-metadata.test.ts +118 -0
  810. package/.next/standalone/apps/web/lib/remote-files.test.ts +53 -0
  811. package/.next/standalone/apps/web/lib/system-cache.test.ts +173 -0
  812. package/.next/standalone/apps/web/lib/utils.ts +6 -0
  813. package/.next/standalone/apps/web/next-env.d.ts +7 -0
  814. package/.next/standalone/apps/web/next.config.mjs +82 -0
  815. package/.next/standalone/apps/web/package.json +96 -0
  816. package/.next/standalone/apps/web/parse_log.mjs +67 -0
  817. package/.next/standalone/apps/web/postcss.config.mjs +8 -0
  818. package/.next/standalone/apps/web/public/docker.png +0 -0
  819. package/.next/standalone/apps/web/public/favicon.ico +0 -0
  820. package/.next/standalone/apps/web/public/github.svg +3 -0
  821. package/.next/standalone/apps/web/public/hetzner.svg +1 -0
  822. package/.next/standalone/apps/web/public/icons/Confluence.png +0 -0
  823. package/.next/standalone/apps/web/public/icons/Instagram.png +0 -0
  824. package/.next/standalone/apps/web/public/icons/Northflank.png +0 -0
  825. package/.next/standalone/apps/web/public/icons/Salesforce.png +0 -0
  826. package/.next/standalone/apps/web/public/icons/agentskills.png +0 -0
  827. package/.next/standalone/apps/web/public/icons/airtable.png +0 -0
  828. package/.next/standalone/apps/web/public/icons/asana.png +0 -0
  829. package/.next/standalone/apps/web/public/icons/ashby.png +0 -0
  830. package/.next/standalone/apps/web/public/icons/audio.png +0 -0
  831. package/.next/standalone/apps/web/public/icons/aws-kendra.png +0 -0
  832. package/.next/standalone/apps/web/public/icons/aws.svg +38 -0
  833. package/.next/standalone/apps/web/public/icons/azure-ai-search.png +0 -0
  834. package/.next/standalone/apps/web/public/icons/azure.svg +1 -0
  835. package/.next/standalone/apps/web/public/icons/bigquery.png +0 -0
  836. package/.next/standalone/apps/web/public/icons/bing.png +0 -0
  837. package/.next/standalone/apps/web/public/icons/bitbucket.png +0 -0
  838. package/.next/standalone/apps/web/public/icons/brave.png +0 -0
  839. package/.next/standalone/apps/web/public/icons/browserbase.png +0 -0
  840. package/.next/standalone/apps/web/public/icons/calendly.png +0 -0
  841. package/.next/standalone/apps/web/public/icons/chroma.png +0 -0
  842. package/.next/standalone/apps/web/public/icons/cloudflare.png +0 -0
  843. package/.next/standalone/apps/web/public/icons/cohere.svg +30 -0
  844. package/.next/standalone/apps/web/public/icons/databricks.png +0 -0
  845. package/.next/standalone/apps/web/public/icons/daytonaio.png +0 -0
  846. package/.next/standalone/apps/web/public/icons/daytonaio2.png +0 -0
  847. package/.next/standalone/apps/web/public/icons/deepgram.png +0 -0
  848. package/.next/standalone/apps/web/public/icons/deepl.png +0 -0
  849. package/.next/standalone/apps/web/public/icons/digital-ocean.webp +0 -0
  850. package/.next/standalone/apps/web/public/icons/discord.png +0 -0
  851. package/.next/standalone/apps/web/public/icons/e2b-2.png +0 -0
  852. package/.next/standalone/apps/web/public/icons/e2b.png +0 -0
  853. package/.next/standalone/apps/web/public/icons/elevenlabs.png +0 -0
  854. package/.next/standalone/apps/web/public/icons/email.png +0 -0
  855. package/.next/standalone/apps/web/public/icons/exa.png +0 -0
  856. package/.next/standalone/apps/web/public/icons/excel.png +0 -0
  857. package/.next/standalone/apps/web/public/icons/fal.png +0 -0
  858. package/.next/standalone/apps/web/public/icons/firecrawl.png +0 -0
  859. package/.next/standalone/apps/web/public/icons/firecrawl2.png +0 -0
  860. package/.next/standalone/apps/web/public/icons/flyio.jpeg +0 -0
  861. package/.next/standalone/apps/web/public/icons/gcp.svg +1 -0
  862. package/.next/standalone/apps/web/public/icons/gemini.svg +1 -0
  863. package/.next/standalone/apps/web/public/icons/gmail.png +0 -0
  864. package/.next/standalone/apps/web/public/icons/google-analytics.png +0 -0
  865. package/.next/standalone/apps/web/public/icons/google-calender.png +0 -0
  866. package/.next/standalone/apps/web/public/icons/google-docs.png +0 -0
  867. package/.next/standalone/apps/web/public/icons/google-drive.png +0 -0
  868. package/.next/standalone/apps/web/public/icons/google-maps.png +0 -0
  869. package/.next/standalone/apps/web/public/icons/google-meet.png +0 -0
  870. package/.next/standalone/apps/web/public/icons/google-sheets.png +0 -0
  871. package/.next/standalone/apps/web/public/icons/google-slides.png +0 -0
  872. package/.next/standalone/apps/web/public/icons/google-tasks.png +0 -0
  873. package/.next/standalone/apps/web/public/icons/google.png +0 -0
  874. package/.next/standalone/apps/web/public/icons/grok.png +0 -0
  875. package/.next/standalone/apps/web/public/icons/hubspot.png +0 -0
  876. package/.next/standalone/apps/web/public/icons/image.png +0 -0
  877. package/.next/standalone/apps/web/public/icons/jina.svg +1 -0
  878. package/.next/standalone/apps/web/public/icons/jira.png +0 -0
  879. package/.next/standalone/apps/web/public/icons/lancedb2.png +0 -0
  880. package/.next/standalone/apps/web/public/icons/linear.png +0 -0
  881. package/.next/standalone/apps/web/public/icons/linux.png +0 -0
  882. package/.next/standalone/apps/web/public/icons/looker.png +0 -0
  883. package/.next/standalone/apps/web/public/icons/luma.png +0 -0
  884. package/.next/standalone/apps/web/public/icons/mac.png +0 -0
  885. package/.next/standalone/apps/web/public/icons/markdown.png +0 -0
  886. package/.next/standalone/apps/web/public/icons/mcp.png +0 -0
  887. package/.next/standalone/apps/web/public/icons/mcp.svg +1 -0
  888. package/.next/standalone/apps/web/public/icons/messenger.svg +1 -0
  889. package/.next/standalone/apps/web/public/icons/microsoft-intra.png +0 -0
  890. package/.next/standalone/apps/web/public/icons/microsoft-onenote.png +0 -0
  891. package/.next/standalone/apps/web/public/icons/microsoft-planner.png +0 -0
  892. package/.next/standalone/apps/web/public/icons/microsoft-teams.png +0 -0
  893. package/.next/standalone/apps/web/public/icons/miro.png +0 -0
  894. package/.next/standalone/apps/web/public/icons/mistral.svg +469 -0
  895. package/.next/standalone/apps/web/public/icons/modal.png +0 -0
  896. package/.next/standalone/apps/web/public/icons/ngrok.png +0 -0
  897. package/.next/standalone/apps/web/public/icons/nomic.png +0 -0
  898. package/.next/standalone/apps/web/public/icons/onedrive.png +0 -0
  899. package/.next/standalone/apps/web/public/icons/openai.svg +1 -0
  900. package/.next/standalone/apps/web/public/icons/outlook-calendar.png +0 -0
  901. package/.next/standalone/apps/web/public/icons/outlook-email.png +0 -0
  902. package/.next/standalone/apps/web/public/icons/outlook.png +0 -0
  903. package/.next/standalone/apps/web/public/icons/pdf.png +0 -0
  904. package/.next/standalone/apps/web/public/icons/personio.png +0 -0
  905. package/.next/standalone/apps/web/public/icons/pgvector2.png +0 -0
  906. package/.next/standalone/apps/web/public/icons/phone.png +0 -0
  907. package/.next/standalone/apps/web/public/icons/pinecone.png +0 -0
  908. package/.next/standalone/apps/web/public/icons/pipedrive.png +0 -0
  909. package/.next/standalone/apps/web/public/icons/power-pi.png +0 -0
  910. package/.next/standalone/apps/web/public/icons/pylon.png +0 -0
  911. package/.next/standalone/apps/web/public/icons/python.png +0 -0
  912. package/.next/standalone/apps/web/public/icons/qdrant.svg +35 -0
  913. package/.next/standalone/apps/web/public/icons/revai.png +0 -0
  914. package/.next/standalone/apps/web/public/icons/revai.svg +1 -0
  915. package/.next/standalone/apps/web/public/icons/sap.png +0 -0
  916. package/.next/standalone/apps/web/public/icons/serpapi.svg +34 -0
  917. package/.next/standalone/apps/web/public/icons/serper.png +0 -0
  918. package/.next/standalone/apps/web/public/icons/servicenow.png +0 -0
  919. package/.next/standalone/apps/web/public/icons/sharepoint.png +0 -0
  920. package/.next/standalone/apps/web/public/icons/slack.png +0 -0
  921. package/.next/standalone/apps/web/public/icons/snowflake.png +0 -0
  922. package/.next/standalone/apps/web/public/icons/statistia.png +0 -0
  923. package/.next/standalone/apps/web/public/icons/stripe.png +0 -0
  924. package/.next/standalone/apps/web/public/icons/supabase.png +0 -0
  925. package/.next/standalone/apps/web/public/icons/tableau.png +0 -0
  926. package/.next/standalone/apps/web/public/icons/tavily.png +0 -0
  927. package/.next/standalone/apps/web/public/icons/telegram.png +0 -0
  928. package/.next/standalone/apps/web/public/icons/typescript.png +0 -0
  929. package/.next/standalone/apps/web/public/icons/vercel copy.svg +1 -0
  930. package/.next/standalone/apps/web/public/icons/vercel.svg +1 -0
  931. package/.next/standalone/apps/web/public/icons/vertex-ai.png +0 -0
  932. package/.next/standalone/apps/web/public/icons/video.png +0 -0
  933. package/.next/standalone/apps/web/public/icons/voyage-light.png +0 -0
  934. package/.next/standalone/apps/web/public/icons/weaviate.webp +0 -0
  935. package/.next/standalone/apps/web/public/icons/webcontainers.svg +11 -0
  936. package/.next/standalone/apps/web/public/icons/webhook.png +0 -0
  937. package/.next/standalone/apps/web/public/icons/whatsapp copy.png +0 -0
  938. package/.next/standalone/apps/web/public/icons/whatsapp.png +0 -0
  939. package/.next/standalone/apps/web/public/icons/windows.png +0 -0
  940. package/.next/standalone/apps/web/public/icons/word.png +0 -0
  941. package/.next/standalone/apps/web/public/icons/zendesk.png +0 -0
  942. package/.next/standalone/apps/web/public/icons/zoom.png +0 -0
  943. package/.next/standalone/apps/web/public/logo-light.png +0 -0
  944. package/.next/standalone/apps/web/public/logo-light2.png +0 -0
  945. package/.next/standalone/apps/web/public/logo.png +0 -0
  946. package/.next/standalone/apps/web/public/logo9.png +0 -0
  947. package/.next/standalone/apps/web/public/notion-white.png +0 -0
  948. package/.next/standalone/apps/web/public/notion.png +0 -0
  949. package/.next/standalone/apps/web/public/vercel.svg +1 -0
  950. package/.next/standalone/apps/web/scripts/prepare-standalone.mjs +153 -0
  951. package/.next/standalone/apps/web/server.js +44 -0
  952. package/.next/standalone/apps/web/store/chat-store.ts +19 -0
  953. package/.next/standalone/apps/web/store/connections-store.ts +276 -0
  954. package/.next/standalone/apps/web/store/deploy-store.ts +90 -0
  955. package/.next/standalone/apps/web/store/scrape-store.ts +76 -0
  956. package/.next/standalone/apps/web/tsconfig.json +41 -0
  957. package/.next/standalone/apps/web/verify-models.mjs +133 -0
  958. package/.next/standalone/apps/web/vitest.config.ts +15 -0
  959. package/package.json +1 -1
@@ -0,0 +1,216 @@
1
+ (()=>{var a={};a.id=4662,a.ids=[4662],a.modules={432:(a,b,c)=>{Promise.resolve().then(c.bind(c,99343))},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},5501:(a,b)=>{"use strict";function c({widthInt:a,heightInt:b,blurWidth:d,blurHeight:e,blurDataURL:f,objectFit:g}){let h=d?40*d:a,i=e?40*e:b,j=h&&i?`viewBox='0 0 ${h} ${i}'`:"";return`%3Csvg xmlns='http://www.w3.org/2000/svg' ${j}%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${j?"none":"contain"===g?"xMidYMid":"cover"===g?"xMidYMid slice":"none"}' style='filter: url(%23b);' href='${f}'/%3E%3C/svg%3E`}Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"getImageBlurSvg",{enumerable:!0,get:function(){return c}})},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},8560:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"default",{enumerable:!0,get:function(){return g}});let d=c(9618),e=c(90512);function f({config:a,src:b,width:c,quality:g}){let h=(0,e.getDeploymentId)();if(b.startsWith("/")&&!b.startsWith("//"))if(b.includes("/_next/static/immutable")&&!(0,e.getAssetToken)())h=void 0;else{let a=b.indexOf("?");if(-1!==a){let c=new URLSearchParams(b.slice(a+1)),d=c.get("dpl");if(d){h=d,c.delete("dpl");let e=c.toString();b=b.slice(0,a)+(e?"?"+e:"")}}}if(b.startsWith("/")&&b.includes("?")&&a.localPatterns?.length===1&&"**"===a.localPatterns[0].pathname&&""===a.localPatterns[0].search)throw Object.defineProperty(Error(`Image with src "${b}" is using a query string which is not configured in images.localPatterns.
2
+ Read more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`),"__NEXT_ERROR_CODE",{value:"E871",enumerable:!1,configurable:!0});let i=(0,d.findClosestQuality)(g,a);return`${a.path}?url=${encodeURIComponent(b)}&w=${c}&q=${i}${b.startsWith("/")&&h?`&dpl=${h}`:""}`}f.__next_img_default=!0;let g=f},9618:(a,b)=>{"use strict";function c(a,b){let c=a||75;return b?.qualities?.length?b.qualities.reduce((a,b)=>Math.abs(b-c)<Math.abs(a-c)?b:a,b.qualities[0]):c}Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"findClosestQuality",{enumerable:!0,get:function(){return c}})},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},15760:(a,b,c)=>{"use strict";a.exports=c(13412).vendored.contexts.ImageConfigContext},18790:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>r,handler:()=>t,routeModule:()=>s});var d=c(89076),e=c(71394),f=c(20615),g=c(39570),h={};for(let a in g)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(h[a]=()=>g[a]);c.d(b,h);let i=(0,d.p)(()=>Promise.resolve().then(c.bind(c,19186))),j=(0,d.p)(()=>Promise.resolve().then(c.bind(c,5806))),k=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,83018,23))),l=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,82620,23))),m=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,67301,23))),n=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,43256,23))),o=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,83018,23))),p={children:["",{children:["settings",{children:["__PAGE__",{},{page:[(0,d.p)(()=>Promise.resolve().then(c.bind(c,78593))),"/private/tmp/larkup-release-0.4.14/apps/web/app/settings/page.tsx"]}]},{"global-error":[o,"next/dist/client/components/builtin/global-error.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,3676)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}},[]]},{layout:[i,"/private/tmp/larkup-release-0.4.14/apps/web/app/layout.tsx"],template:[j,"/private/tmp/larkup-release-0.4.14/apps/web/app/template.tsx"],"global-error":[k,"next/dist/client/components/builtin/global-error.js"],"not-found":[l,"next/dist/client/components/builtin/not-found.js"],forbidden:[m,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[n,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,3676)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}},[]]}.children,q=(0,e.H)({tree:p,page:"/settings/page",pathname:"/settings",require:c,loadChunk:()=>Promise.resolve(),interopDefault:f.T}),r=q.__next_app__,s=q.routeModule,t=q.handler},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},22515:(a,b,c)=>{"use strict";c.d(b,{AM:()=>k,Wv:()=>l,hl:()=>m});var d=c(32108);c(21621);var e=c(72138),f=c(83583),g=c(4594),h=c(53078),i=c(54818),j=c(3989);function k({...a}){return(0,d.jsx)(e.y,{"data-slot":"popover",...a})}function l({...a}){return(0,d.jsx)(f.W,{"data-slot":"popover-trigger",...a})}function m({className:a,align:b="center",alignOffset:c=0,side:e="bottom",sideOffset:f=4,...k}){return(0,d.jsx)(g.i,{children:(0,d.jsx)(h.U,{align:b,alignOffset:c,side:e,sideOffset:f,className:"isolate z-50",children:(0,d.jsx)(i.i,{"data-slot":"popover-content",className:(0,j.cn)("z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",a),...k})})})}},28354:a=>{"use strict";a.exports=require("util")},28796:(a,b,c)=>{"use strict";c.d(b,{BT:()=>i,Wu:()=>j,ZB:()=>h,Zp:()=>f,aR:()=>g,wL:()=>k});var d=c(32108);c(21621);var e=c(3989);function f({className:a,size:b="default",...c}){return(0,d.jsx)("div",{"data-slot":"card","data-size":b,className:(0,e.cn)("group/card flex flex-col gap-4 overflow-hidden rounded-xl border bg-card py-4 text-sm text-card-foreground has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",a),...c})}function g({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-header",className:(0,e.cn)("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",a),...b})}function h({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-title",className:(0,e.cn)("font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",a),...b})}function i({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-description",className:(0,e.cn)("text-sm text-muted-foreground",a),...b})}function j({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-content",className:(0,e.cn)("px-4 group-data-[size=sm]/card:px-3",a),...b})}function k({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-footer",className:(0,e.cn)("flex items-center rounded-b-xl border-none p-4 group-data-[size=sm]/card:p-3",a),...b})}},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33554:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"Image",{enumerable:!0,get:function(){return v}});let d=c(45925),e=c(89336),f=c(32108),g=e._(c(21621)),h=d._(c(4888)),i=d._(c(71525)),j=c(60622),k=c(66241),l=c(15760),m=c(80875),n=d._(c(8560)),o=c(65211),p={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!0};function q(a,b,c,d,e,f,g){let h=a?.src;a&&a["data-loaded-src"]!==h&&(a["data-loaded-src"]=h,("decode"in a?a.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(a.parentElement&&a.isConnected){if("empty"!==b&&e(!0),c?.current){let b=new Event("load");Object.defineProperty(b,"target",{writable:!1,value:a});let d=!1,e=!1;c.current({...b,nativeEvent:b,currentTarget:a,target:a,isDefaultPrevented:()=>d,isPropagationStopped:()=>e,persist:()=>{},preventDefault:()=>{d=!0,b.preventDefault()},stopPropagation:()=>{e=!0,b.stopPropagation()}})}d?.current&&d.current(a)}}))}function r(a){return g.use?{fetchPriority:a}:{fetchpriority:a}}globalThis.__NEXT_IMAGE_IMPORTED=!0;let s=g.useEffect,t=(0,g.forwardRef)(({src:a,srcSet:b,sizes:c,height:d,width:e,decoding:h,className:i,style:j,fetchPriority:k,placeholder:l,loading:m,unoptimized:n,fill:p,onLoadRef:t,onLoadingCompleteRef:u,setBlurComplete:v,setShowAltText:w,sizesInput:x,onLoad:y,onError:z,...A},B)=>{let C=(0,g.useRef)(!1),D=(0,g.useRef)(null);s(()=>{let{current:a}=C,{current:b}=D;a||null===b||(z&&(b.src=b.src),b.complete&&q(b,l,t,u,v,n,x),C.current=!0)},[a,l,t,u,z,n,x]);let E=(0,o.useMergedRef)(B,D);return(0,f.jsx)("img",{...A,...r(k),loading:m,width:e,height:d,decoding:h,"data-nimg":p?"fill":"1",className:i,style:j,sizes:c,srcSet:b,src:a,ref:E,onLoad:a=>{q(a.currentTarget,l,t,u,v,n,x)},onError:a=>{w(!0),"empty"!==l&&v(!0),z&&z(a)}})});function u({isAppRouter:a,imgAttributes:b}){let c={as:"image",imageSrcSet:b.srcSet,imageSizes:b.sizes,crossOrigin:b.crossOrigin,referrerPolicy:b.referrerPolicy,...r(b.fetchPriority)};return a&&h.default.preload?(h.default.preload(b.src,c),null):(0,f.jsx)(i.default,{children:(0,f.jsx)("link",{rel:"preload",href:b.srcSet?void 0:b.src,...c},"__nimg-"+b.src+b.srcSet+b.sizes)})}let v=(0,g.forwardRef)((a,b)=>{let c=(0,g.useContext)(m.RouterContext),d=(0,g.useContext)(l.ImageConfigContext),e=(0,g.useMemo)(()=>{let a=p||d||k.imageConfigDefault,b=[...a.deviceSizes,...a.imageSizes].sort((a,b)=>a-b),c=a.deviceSizes.sort((a,b)=>a-b),e=a.qualities?.sort((a,b)=>a-b);return{...a,allSizes:b,deviceSizes:c,qualities:e,localPatterns:d?.localPatterns}},[d]),{onLoad:h,onLoadingComplete:i}=a,o=(0,g.useRef)(h);(0,g.useEffect)(()=>{o.current=h},[h]);let q=(0,g.useRef)(i);(0,g.useEffect)(()=>{q.current=i},[i]);let[r,s]=(0,g.useState)(!1),[v,w]=(0,g.useState)(!1),{props:x,meta:y}=(0,j.getImgProps)(a,{defaultLoader:n.default,imgConf:e,blurComplete:r,showAltText:v});return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t,{...x,unoptimized:y.unoptimized,placeholder:y.placeholder,fill:y.fill,onLoadRef:o,onLoadingCompleteRef:q,setBlurComplete:s,setShowAltText:w,sizesInput:a.sizes,ref:b}),y.preload?(0,f.jsx)(u,{isAppRouter:!c,imgAttributes:x}):null]})});("function"==typeof b.default||"object"==typeof b.default&&null!==b.default)&&void 0===b.default.__esModule&&(Object.defineProperty(b.default,"__esModule",{value:!0}),Object.assign(b.default,b),a.exports=b.default)},33873:a=>{"use strict";a.exports=require("path")},36908:(a,b,c)=>{"use strict";c.d(b,{T:()=>f});var d=c(32108);c(21621);var e=c(3989);function f({className:a,...b}){return(0,d.jsx)("textarea",{"data-slot":"textarea",className:(0,e.cn)("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-background px-2.5 py-2 text-base transition-colors outline-none! placeholder:text-muted-foreground/50 placeholder:text-xs disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",a),...b})}},38092:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"default",{enumerable:!0,get:function(){return f}});let d=c(21621),e=()=>{};function f(a){let{headManager:b,reduceComponentsToState:c}=a;function f(){if(b&&b.mountedInstances){let a=d.Children.toArray(Array.from(b.mountedInstances).filter(Boolean));b.updateHead(c(a))}}return b?.mountedInstances?.add(a.children),f(),e(),e(),null}},38522:a=>{"use strict";a.exports=require("node:zlib")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},41203:(a,b,c)=>{"use strict";c.d(b,{A:()=>f});var d=c(41781);let e={name:"dices",size:24,node:[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]]};e.node;let f=(0,d.A)(e)},46060:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external.js")},49857:(a,b,c)=>{"use strict";c.d(b,{K:()=>g});var d=c(32108);c(21621);var e=c(28245),f=c(3989);function g({open:a,onOpenChange:b,title:c,description:h,cancelText:i="Cancel",actionText:j="Continue",onAction:k,variant:l="default",icon:m,contentClassName:n}){return(0,d.jsx)(e.Lt,{open:a,onOpenChange:b,children:(0,d.jsxs)(e.EO,{className:n,children:[(0,d.jsxs)(e.wd,{children:[(0,d.jsxs)(e.r7,{className:"flex items-center gap-2",children:[m,c]}),"string"==typeof h?(0,d.jsx)(e.$v,{className:"whitespace-pre-wrap",children:h}):h?(0,d.jsx)("div",{className:"space-y-2 text-sm text-muted-foreground",children:h}):null]}),(0,d.jsxs)(e.ck,{children:[(0,d.jsx)(e.Zr,{children:i}),(0,d.jsx)(e.Rx,{onClick:a=>{a.preventDefault(),k&&k(),b(!1)},className:(0,f.cn)("destructive"===l&&"bg-destructive text-white hover:bg-destructive/90 gap-2"),children:j})]})]})})}},55511:a=>{"use strict";a.exports=require("crypto")},60036:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});var d={default:function(){return k},getImageProps:function(){return j}};for(var e in d)Object.defineProperty(b,e,{enumerable:!0,get:d[e]});let f=c(45925),g=c(60622),h=c(33554),i=f._(c(8560));function j(a){let{props:b}=(0,g.getImgProps)(a,{defaultLoader:i.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!0}});for(let[a,c]of Object.entries(b))void 0===c&&delete b[a];return{props:b}}let k=h.Image},60403:(a,b,c)=>{"use strict";c.d(b,{Av:()=>h,Pp:()=>f,g9:()=>e,y8:()=>d});let d="scrape_recent_queries",e="media_recent_urls",f="larkup:recent-add-history-cleared",g=[d,e];function h(a,b){for(let b of g)a.removeItem(b);b?.dispatchEvent(new Event(f))}},60622:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"getImgProps",{enumerable:!0,get:function(){return j}});let d=c(90512),e=c(5501),f=c(66241),g=["-moz-initial","fill","none","scale-down",void 0];function h(a){return void 0!==a.default}function i(a){return void 0===a?a:"number"==typeof a?Number.isFinite(a)?a:NaN:"string"==typeof a&&/^[0-9]+$/.test(a)?parseInt(a,10):NaN}function j({src:a,sizes:b,unoptimized:c=!1,priority:k=!1,preload:l=!1,loading:m,className:n,quality:o,width:p,height:q,fill:r=!1,style:s,overrideSrc:t,onLoad:u,onLoadingComplete:v,placeholder:w="empty",blurDataURL:x,fetchPriority:y,decoding:z="async",layout:A,objectFit:B,objectPosition:C,lazyBoundary:D,lazyRoot:E,...F},G){var H;let I,J,K,{imgConf:L,showAltText:M,blurComplete:N,defaultLoader:O}=G,P=L||f.imageConfigDefault;if("allSizes"in P)I=P;else{let a=[...P.deviceSizes,...P.imageSizes].sort((a,b)=>a-b),b=P.deviceSizes.sort((a,b)=>a-b),c=P.qualities?.sort((a,b)=>a-b);I={...P,allSizes:a,deviceSizes:b,qualities:c}}if(void 0===O)throw Object.defineProperty(Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config"),"__NEXT_ERROR_CODE",{value:"E163",enumerable:!1,configurable:!0});let Q=F.loader||O;delete F.loader,delete F.srcSet;let R="__next_img_default"in Q;if(R){if("custom"===I.loader)throw Object.defineProperty(Error(`Image with src "${a}" is missing "loader" prop.
3
+ Read more: https://nextjs.org/docs/messages/next-image-missing-loader`),"__NEXT_ERROR_CODE",{value:"E252",enumerable:!1,configurable:!0})}else{let a=Q;Q=b=>{let{config:c,...d}=b;return a(d)}}if(A){"fill"===A&&(r=!0);let a={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[A];a&&(s={...s,...a});let c={responsive:"100vw",fill:"100vw"}[A];c&&!b&&(b=c)}let S="",T=i(p),U=i(q);if((H=a)&&"object"==typeof H&&(h(H)||void 0!==H.src)){let b=h(a)?a.default:a;if(!b.src)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(b)}`),"__NEXT_ERROR_CODE",{value:"E460",enumerable:!1,configurable:!0});if(!b.height||!b.width)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(b)}`),"__NEXT_ERROR_CODE",{value:"E48",enumerable:!1,configurable:!0});if(J=b.blurWidth,K=b.blurHeight,x=x||b.blurDataURL,S=b.src,!r)if(T||U){if(T&&!U){let a=T/b.width;U=Math.round(b.height*a)}else if(!T&&U){let a=U/b.height;T=Math.round(b.width*a)}}else T=b.width,U=b.height}let V=!k&&!l&&("lazy"===m||void 0===m);(!(a="string"==typeof a?a:S)||a.startsWith("data:")||a.startsWith("blob:"))&&(c=!0,V=!1),I.unoptimized&&(c=!0),R&&!I.dangerouslyAllowSVG&&a.split("?",1)[0].endsWith(".svg")&&(c=!0);let W=i(o),X=Object.assign(r?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:B,objectPosition:C}:{},M?{}:{color:"transparent"},s),Y=N||"empty"===w?null:"blur"===w?`url("data:image/svg+xml;charset=utf-8,${(0,e.getImageBlurSvg)({widthInt:T,heightInt:U,blurWidth:J,blurHeight:K,blurDataURL:x||"",objectFit:X.objectFit})}")`:`url("${w}")`,Z=g.includes(X.objectFit)?"fill"===X.objectFit?"100% 100%":"cover":X.objectFit,$=Y?{backgroundSize:Z,backgroundPosition:X.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:Y}:{},_=function({config:a,src:b,unoptimized:c,width:e,quality:f,sizes:g,loader:h}){if(c){if(b.startsWith("/")&&!b.startsWith("//")){let a=(0,d.getDeploymentId)();if(b.includes("/_next/static/immutable")&&!(0,d.getAssetToken)())a=void 0;else if(a){let c=b.indexOf("?");if(-1!==c){let d=new URLSearchParams(b.slice(c+1));d.get("dpl")||(d.append("dpl",a),b=b.slice(0,c)+"?"+d.toString())}else b+=`?dpl=${a}`}}return{src:b,srcSet:void 0,sizes:void 0}}let{widths:i,kind:j}=function({deviceSizes:a,allSizes:b},c,d){if(d){let c=/(^|\s)(1?\d?\d)vw/g,e=[];for(let a;a=c.exec(d);)e.push(parseInt(a[2]));if(e.length){let c=.01*Math.min(...e);return{widths:b.filter(b=>b>=a[0]*c),kind:"w"}}return{widths:b,kind:"w"}}return"number"!=typeof c?{widths:a,kind:"w"}:{widths:[...new Set([c,2*c].map(a=>b.find(b=>b>=a)||b[b.length-1]))],kind:"x"}}(a,e,g),k=i.length-1;return{sizes:g||"w"!==j?g:"100vw",srcSet:i.map((c,d)=>`${h({config:a,src:b,quality:f,width:c})} ${"w"===j?c:d+1}${j}`).join(", "),src:h({config:a,src:b,quality:f,width:i[k]})}}({config:I,src:a,unoptimized:c,width:T,quality:W,sizes:b,loader:Q}),aa=V?"lazy":m;return{props:{...F,loading:aa,fetchPriority:y,width:T,height:U,decoding:z,className:n,style:{...X,...$},sizes:_.sizes,srcSet:_.srcSet,src:t||_.src},meta:{unoptimized:c,preload:l||k,placeholder:w,fill:r}}}},62602:(a,b,c)=>{"use strict";a.exports=c(13412).vendored.contexts.HeadManagerContext},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66241:(a,b)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});var c={VALID_LOADERS:function(){return e},imageConfigDefault:function(){return f}};for(var d in c)Object.defineProperty(b,d,{enumerable:!0,get:c[d]});let e=["default","imgix","cloudinary","akamai","custom"],f={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:14400,formats:["image/webp"],maximumDiskCacheSize:void 0,maximumRedirects:3,maximumResponseBody:5e7,dangerouslyAllowLocalIP:!1,dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"attachment",localPatterns:void 0,remotePatterns:[],qualities:[75],unoptimized:!1,customCacheHandler:!1}},69865:(a,b,c)=>{"use strict";c.d(b,{Ag:()=>k,d3:()=>n,zf:()=>m});var d=c(98785),e=c(68987),f=c(35014),g=c(49684),h=c(7214),i=c(270),j=c(31293);let k={searchKnowledgeBase:{placement:"source",resultView:"none"},queryVideoKnowledge:{placement:"inline",pendingLabel:"Reviewing the video…",resultView:"none"},queryVideoEvidence:{placement:"inline",pendingLabel:"Reviewing indexed video context…",resultView:"data-table",compactResult:!1},inspectVideoKnowledge:{placement:"inline",pendingLabel:"Checking the relevant moment…",resultView:"none"},webSearch:{placement:"web-search",resultView:"none"},presentMedia:{placement:"media",resultView:"media"},queryTabularData:{placement:"inline",pendingLabel:"Checking data…",resultView:"data-table",compactResult:!0,showProgressBar:!1},generateVisualization:{placement:"visualization",pendingLabel:"Preparing chart…",resultView:"none"},createDataExport:{placement:"inline",pendingLabel:"Preparing file…",resultView:"file-export",showProgressBar:!1},executeAnalysis:{placement:"inline",pendingLabel:"Running analysis…",resultView:"sandbox"},analyzeCorpusWithCode:{placement:"inline",pendingLabel:"Analyzing documents…",resultView:"sandbox"},getIndexedData:{placement:"inline",pendingLabel:"Checking documents…",resultView:"corpus"},analyzeImageDeeply:{placement:"inline",pendingLabel:"Analyzing image…",resultView:"image-analysis"},fillDocumentForm:{placement:"inline",pendingLabel:"Updating document…",resultView:"document-edit"},editDocument:{placement:"inline",pendingLabel:"Updating document…",resultView:"document-edit"},requestDocumentSignature:{placement:"inline",pendingLabel:"Preparing signature…",resultView:"signature"}},l={placement:"inline",pendingLabel:"Working…",resultView:"none"};function m(a){return k[a]??l}let n=[{id:"searchKnowledgeBase",name:"Semantic Search",description:"Search the RAG knowledge base for text.",icon:d.A},{id:"queryTabularData",name:"Tabular Data Query",description:"Filter, group, and aggregate tabular data.",icon:e.A},{id:"generateVisualization",name:"Generate Charts",description:"Create interactive charts from Assistant results.",icon:f.A},{id:"createDataExport",name:"Export Answer",description:"Create a downloadable Excel, CSV, or PDF file from an Assistant result.",icon:g.A},{id:"executeAnalysis",name:"Python Sandbox",description:"Execute Python code for complex analysis.",icon:h.A},{id:"getIndexedData",name:"Indexed Data",description:"List and filter source documents.",icon:i.A},{id:"analyzeCorpusWithCode",name:"Corpus Analysis",description:"Run code against the full indexed corpus.",icon:h.A},{id:"fillDocumentForm",name:"Form Filler",description:"Fill forms in the active document.",icon:j.A}]},71525:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});var d={default:function(){return p},defaultHead:function(){return l}};for(var e in d)Object.defineProperty(b,e,{enumerable:!0,get:d[e]});let f=c(45925),g=c(89336),h=c(32108),i=g._(c(21621)),j=f._(c(38092)),k=c(62602);function l(){return[(0,h.jsx)("meta",{charSet:"utf-8"},"charset"),(0,h.jsx)("meta",{name:"viewport",content:"width=device-width"},"viewport")]}function m(a,b){return"string"==typeof b||"number"==typeof b?a:b.type===i.default.Fragment?a.concat(i.default.Children.toArray(b.props.children).reduce((a,b)=>"string"==typeof b||"number"==typeof b?a:a.concat(b),[])):a.concat(b)}let n=["name","httpEquiv","charSet","itemProp"];function o(a){let b,c,d,e;return a.reduce(m,[]).reverse().concat(l().reverse()).filter((b=new Set,c=new Set,d=new Set,e={},a=>{let f=!0,g=!1;if(a.key&&"number"!=typeof a.key&&a.key.indexOf("$")>0){g=!0;let c=a.key.slice(a.key.indexOf("$")+1);b.has(c)?f=!1:b.add(c)}switch(a.type){case"title":case"base":c.has(a.type)?f=!1:c.add(a.type);break;case"meta":for(let b=0,c=n.length;b<c;b++){let c=n[b];if(a.props.hasOwnProperty(c))if("charSet"===c)d.has(c)?f=!1:d.add(c);else{let b=a.props[c],d=e[c]||new Set;("name"!==c||!g)&&d.has(b)?f=!1:(d.add(b),e[c]=d)}}}return f})).reverse().map((a,b)=>{let c=a.key||b;return i.default.cloneElement(a,{key:c})})}let p=function({children:a}){let b=(0,i.useContext)(k.HeadManagerContext);return(0,h.jsx)(j.default,{reduceComponentsToState:o,headManager:b,children:a})};("function"==typeof b.default||"object"==typeof b.default&&null!==b.default)&&void 0===b.default.__esModule&&(Object.defineProperty(b.default,"__esModule",{value:!0}),Object.assign(b.default,b),a.exports=b.default)},78593:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(67578).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/private/tmp/larkup-release-0.4.14/apps/web/app/settings/page.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/private/tmp/larkup-release-0.4.14/apps/web/app/settings/page.tsx","default")},80875:(a,b,c)=>{"use strict";a.exports=c(13412).vendored.contexts.RouterContext},84508:(a,b,c)=>{"use strict";c.d(b,{Ke:()=>j,Nt:()=>h,R6:()=>i});var d=c(32108),e=c(81489),f=c(34038),g=c(65295);function h({...a}){return(0,d.jsx)(e.N,{"data-slot":"collapsible",...a})}function i({...a}){return(0,d.jsx)(f.R,{"data-slot":"collapsible-trigger",...a})}function j({...a}){return(0,d.jsx)(g.j,{"data-slot":"collapsible-content",...a})}},85469:(a,b,c)=>{"use strict";c.d(b,{CG:()=>q,Fm:()=>v,Qs:()=>y,XW:()=>w,cj:()=>p,h:()=>u,kN:()=>r,qp:()=>x});var d=c(32108);c(21621);var e=c(88340),f=c(10326),g=c(374),h=c(45828),i=c(4452),j=c(29855),k=c(22290),l=c(3826),m=c(3989),n=c(3962),o=c(94171);function p({...a}){return(0,d.jsx)(e.D,{"data-slot":"sheet",...a})}function q({...a}){return(0,d.jsx)(f.z,{"data-slot":"sheet-trigger",...a})}function r({...a}){return(0,d.jsx)(g.H,{"data-slot":"sheet-close",...a})}function s({...a}){return(0,d.jsx)(h.Z,{"data-slot":"sheet-portal",...a})}function t({className:a,...b}){return(0,d.jsx)(i.X,{"data-slot":"sheet-overlay",className:(0,m.cn)("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",a),...b})}function u({className:a,children:b,side:c="right",showCloseButton:e=!0,...f}){return(0,d.jsxs)(s,{children:[(0,d.jsx)(t,{}),(0,d.jsxs)(j.h,{"data-slot":"sheet-content","data-side":c,className:(0,m.cn)("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-10 data-[side=bottom]:data-starting-style:translate-y-10 data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:-translate-x-10 data-[side=left]:data-starting-style:-translate-x-10 data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-10 data-[side=right]:data-starting-style:translate-x-10 data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:-translate-y-10 data-[side=top]:data-starting-style:-translate-y-10 data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",a),...f,children:[b,e&&(0,d.jsxs)(g.H,{"data-slot":"sheet-close",render:(0,d.jsx)(n.$,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[(0,d.jsx)(o.A,{}),(0,d.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function v({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"sheet-header",className:(0,m.cn)("flex flex-col gap-0.5 p-4",a),...b})}function w({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"sheet-footer",className:(0,m.cn)("mt-auto flex flex-col gap-2 p-4",a),...b})}function x({className:a,...b}){return(0,d.jsx)(k.L,{"data-slot":"sheet-title",className:(0,m.cn)("font-heading text-base font-medium text-foreground",a),...b})}function y({className:a,...b}){return(0,d.jsx)(l.r,{"data-slot":"sheet-description",className:(0,m.cn)("text-sm text-muted-foreground",a),...b})}},90704:(a,b,c)=>{Promise.resolve().then(c.bind(c,78593))},94082:(a,b,c)=>{"use strict";c.d(b,{d:()=>h});var d=c(32108),e=c(84232),f=c(52570),g=c(3989);function h({className:a,size:b="default",...c}){return(0,d.jsx)(e.l,{"data-slot":"switch","data-size":b,className:(0,g.cn)("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",a),...c,children:(0,d.jsx)(f.p,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}},99343:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>g$});var d,e,f,g,h,i,j,k,l=c(32108),m=c(21621),n=c.t(m,2),o=c(20866),p=c(78467),q=c(41781);let r={name:"cpu",size:24,node:[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]};r.node;let s=(0,q.A)(r);var t=c(79278),u=c(77956),v=c(97704);let w={name:"wrench",size:24,node:[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]};w.node;let x=(0,q.A)(w),y={name:"blocks",size:24,node:[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]]};y.node;let z=(0,q.A)(y),A={name:"terminal",size:24,node:[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]};A.node;let B=(0,q.A)(A),C={name:"activity",size:24,node:[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]};C.node;let D=(0,q.A)(C);var E=c(3989);let F=[{label:"Project",items:[{id:"general",label:"General",icon:p.A},{id:"models",label:"AI Models",icon:s},{id:"storage",label:"Storage & indexing",icon:t.A},{id:"search-web",label:"Search & Scraping",icon:u.A}]},{label:"Hub",items:[{id:"marketplace",label:"Marketplace",icon:v.A},{id:"tool-settings",label:"Installed Tools",icon:x}]},{label:"Runtime",items:[{id:"agent-customization",label:"Agent Customization",icon:z},{id:"runtime",label:"Larkup Server",icon:B},{id:"monitoring",label:"Monitor",icon:D}]}];function G({children:a,activeSection:b,onSectionChange:c,fullWidth:d=!1}){return(0,l.jsxs)("div",{className:"flex h-full min-h-125",children:[(0,l.jsx)("aside",{className:"w-60 shrink-0 border-r bg-muted/40",children:(0,l.jsx)("nav",{className:"flex h-full flex-col gap-7 p-4",children:F.map(a=>(0,l.jsxs)("div",{children:[(0,l.jsx)("h4",{className:"mb-2 px-3 text-[12px] font-semibold text-muted-foreground",children:a.label}),(0,l.jsx)("div",{className:"space-y-1",children:a.items.map(a=>(0,l.jsxs)("button",{onClick:()=>c(a.id),className:(0,E.cn)("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-[13px] transition-colors",b===a.id?"bg-sidebar-accent/50 dark:bg-white/10 text-foreground font-medium":"font-normal text-muted-foreground/90 hover:bg-muted hover:text-foreground"),children:[(0,l.jsx)(a.icon,{className:"size-4"}),a.label]},a.id))})]},a.label))})}),(0,l.jsx)("main",{className:"flex-1 overflow-y-auto",children:(0,l.jsx)("div",{className:(0,E.cn)(d?"w-full p-6 lg:px-10 lg:py-8":"mx-auto max-w-6xl p-6 lg:p-8"),children:a})})]})}var H=c(55218);let I={name:"panel-left",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],aliases:["sidebar"]};I.node;let J=(0,q.A)(I),K={name:"panel-top",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]};K.node;let L=(0,q.A)(K);var M=c(93921),N=c(30326),O=c(3962),P=c(7368),Q=c(80586),R=c(30130),S=c(50665),T=c(28796),U=c(68498);let V={name:"hard-drive",size:24,node:[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]]};V.node;let W=(0,q.A)(V);var X=c(42373),Y=c(10501);function Z(a){if(0===a)return"0 B";if(a<1024){let b=a/1024;return b<.05?"< 0.1 KB":`${b.toFixed(1)} KB`}let b=["B","KB","MB","GB","TB"],c=Math.min(Math.floor(Math.log(a)/Math.log(1024)),b.length-1),d=a/1024**c;return`${d.toFixed(d>=10?0:1)} ${b[c]}`}var $=c(60403),_=c(28245);async function aa(a){let b=await fetch(a,{cache:"no-store"}),c=await b.json();if(!b.ok)throw Error(c.error||"Could not inspect the Larkup cache.");return c}function ab(){let{data:a,error:b,isLoading:c,isValidating:d,mutate:e}=(0,H.u)("/api/system/cache",aa,{revalidateOnMount:!0,revalidateOnFocus:!0,dedupingInterval:0}),[f,g]=(0,m.useState)(!1),[h,i]=(0,m.useState)(!1),j=a?.cache;async function k(){i(!0),(0,$.Av)(window.localStorage,window);try{let a=await fetch("/api/system/cache",{method:"DELETE"}),b=await a.json();if(!a.ok)throw Error(b.error||"Could not clear the Larkup cache.");await e(b,{revalidate:!1}),g(!1),S.oR.success(`Cleared ${Z(b.clearedBytes||0)} of Larkup cache and recent add-page history.`)}catch(a){S.oR.error((a instanceof Error?a.message:"Could not clear the Larkup cache.")+" Recent Add-page history was still cleared.")}finally{i(!1)}}return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(T.Zp,{children:[(0,l.jsx)(T.aR,{className:"pb-3",children:(0,l.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(T.ZB,{className:"text-sm",children:"Larkup cache"}),(0,l.jsx)(T.BT,{className:"mt-1 text-xs",children:"Temporary files that help Larkup run smoothly. You can clear them anytime to free up space."})]}),(0,l.jsx)("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground",children:(0,l.jsx)(W,{className:"size-4"})})]})}),(0,l.jsx)(T.Wu,{children:(0,l.jsxs)("div",{className:"flex flex-col gap-4 rounded-lg border bg-muted/20 p-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"Detected cache size"}),(0,l.jsx)("p",{className:"mt-1 text-2xl font-semibold tabular-nums",children:c?"—":Z(j?.sizeBytes||0)}),(0,l.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:b?"Cache size could not be read.":j?.available===!1?"No Larkup cache is present on this installation.":j?.exists?"Safe to clear. Larkup recreates temporary data only when needed.":"No temporary cache data is currently stored."})]}),(0,l.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,l.jsxs)(O.$,{variant:"outline",size:"sm","aria-label":"Refresh Larkup cache size",disabled:c||d,onClick:()=>void e(),children:[(0,l.jsx)(X.A,{className:`size-3.5 ${d?"animate-spin":""}`}),"Refresh"]}),(0,l.jsxs)(O.$,{variant:"destructive",size:"sm",disabled:h,onClick:()=>g(!0),children:[(0,l.jsx)(Y.A,{className:"size-3.5"}),"Clear cache"]})]})]})})]}),(0,l.jsx)(_.Lt,{open:f,onOpenChange:g,children:(0,l.jsxs)(_.EO,{children:[(0,l.jsxs)(_.wd,{children:[(0,l.jsx)(_.zu,{children:(0,l.jsx)(Y.A,{className:"size-5"})}),(0,l.jsx)(_.r7,{children:"Clear the Larkup cache?"}),(0,l.jsxs)(_.$v,{children:["This will remove ",Z(j?.sizeBytes||0)," of temporary build, package, image-analysis, video-query, and answer-feedback data. It will not remove projects, indexed sources, settings, API keys, user corrections, chat history, or installed tools. Recent website searches and media URLs from the Add page will also be cleared from this browser. To remove indexed sources, use Clear all data on the Data page."]})]}),(0,l.jsxs)(_.ck,{children:[(0,l.jsx)(_.Zr,{disabled:h,children:"Cancel"}),(0,l.jsxs)(_.Rx,{variant:"destructive",disabled:h,onClick:()=>void k(),children:[h?(0,l.jsx)(M.A,{className:"size-4 animate-spin"}):(0,l.jsx)(Y.A,{className:"size-4"}),"Clear cache"]})]})]})})]})}let ac=[{id:"theme-gaia",name:"Warm Ivory",color:"#e6d343ff",description:"Warm ivory with dark accents"},{id:"default",name:"Minimalist Gray",color:"#636262ff",description:"Clean & minimal gray palette"},{id:"theme-linear",name:"Crisp White",color:"#c7c6c6ff",description:"Crisp white with soft gray navigation"}],ad=[{id:"sidebar",name:"Sidebar Navigation",description:"Classic left sidebar layout",icon:J,color:"text-blue-500"},{id:"topnav",name:"Top Navigation",description:"Horizontal navigation bar",icon:L,color:"text-emerald-500"}],ae=a=>fetch(a).then(a=>a.json());function af(){let a,b,{data:c,isLoading:d,mutate:e}=(0,H.u)("/api/config",ae),[f,g]=(0,m.useState)({}),[h,i]=(0,m.useState)(null),j=async a=>void 0,{theme:k,setTheme:n,layout:o,setLayout:p,isMounted:q}=(0,U.y)(),[r,s]=(0,m.useState)(""),[t,u]=(0,m.useState)(null),[v,w]=(0,m.useState)(null),x=null!==t&&null!==v&&(k!==t||o!==v),y=""!==r.trim();async function z(a){i(a);try{let b={...c?.config};if("username"===a){r.trim()&&""!==r.trim()&&await j(r.trim()),i(null),S.oR.success("Settings saved");return}"webSearch"===a?(b.serperApiKey=f.serperApiKey,b.webSearchProvider=f.webSearchProvider,b.tavilyApiKey=f.tavilyApiKey,b.googleApiKey=f.googleApiKey,b.braveApiKey=f.braveApiKey,b.bingApiKey=f.bingApiKey,b.exaApiKey=f.exaApiKey):"webCrawler"===a?(b.webCrawlerProvider=f.webCrawlerProvider,b.firecrawlApiKey=f.firecrawlApiKey):"proxy"===a&&(b.scraperProxyServer=f.scraperProxyServer,b.scraperProxyUsername=f.scraperProxyUsername,b.scraperProxyPassword=f.scraperProxyPassword,b.useScraperProxy=f.useScraperProxy);let d=await fetch("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),h=await d.json();if(!d.ok)throw Error(h.error??"Failed to save");g(a=>({...a,...h.config})),await e(h,{revalidate:!1}),S.oR.success("Settings saved")}catch(a){S.oR.error(a instanceof Error?a.message:"Failed to save")}finally{i(null)}}return(f.serperApiKey!==c?.config?.serperApiKey||f.webSearchProvider!==c?.config?.webSearchProvider||f.tavilyApiKey!==c?.config?.tavilyApiKey||f.googleApiKey!==c?.config?.googleApiKey||f.braveApiKey!==c?.config?.braveApiKey||f.bingApiKey!==c?.config?.bingApiKey||(f.exaApiKey,c?.config?.exaApiKey),f.webCrawlerProvider!==c?.config?.webCrawlerProvider||(f.firecrawlApiKey,c?.config?.firecrawlApiKey),f.scraperProxyServer!==c?.config?.scraperProxyServer||f.scraperProxyUsername!==c?.config?.scraperProxyUsername||f.scraperProxyPassword!==c?.config?.scraperProxyPassword||(f.useScraperProxy,c?.config?.useScraperProxy),d)?(0,l.jsx)("div",{className:"flex h-40 items-center justify-center",children:(0,l.jsx)(M.A,{className:"size-5 animate-spin text-muted-foreground"})}):(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsx)("div",{className:"flex items-center justify-between",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-lg font-semibold tracking-tight",children:"General"}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:"Project settings and preferences."})]})}),(0,l.jsxs)(T.Zp,{id:"web-crawler",className:"",children:[(0,l.jsxs)(T.aR,{className:"pb-3",children:[(0,l.jsx)(T.ZB,{className:"text-sm",children:"Your Name"}),(0,l.jsx)(T.BT,{className:"text-xs",children:"Displayed in the workspace header."})]}),(0,l.jsx)(T.Wu,{children:(0,l.jsx)(P.p,{value:r,onChange:a=>s(a.target.value),placeholder:"Enter your name",className:""})}),(0,l.jsx)(T.wL,{className:"flex justify-end pt-4 border-t",children:(0,l.jsxs)(O.$,{size:"lg",disabled:"username"===h||!y,onClick:()=>z("username"),className:"gap-1.5 px-4",children:["username"===h?(0,l.jsx)(M.A,{className:"size-3.5 animate-spin"}):(0,l.jsx)(N.A,{className:"size-3.5"}),"Save"]})})]}),q&&(0,l.jsxs)(T.Zp,{children:[(0,l.jsxs)(T.aR,{className:"pb-3",children:[(0,l.jsx)(T.ZB,{className:"text-sm",children:"Appearance"}),(0,l.jsx)(T.BT,{className:"text-xs",children:"Customize the theme and layout of your workspace."})]}),(0,l.jsxs)(T.Wu,{className:"space-y-6",children:[(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Theme"}),(0,l.jsxs)(R.l6,{value:k,onValueChange:a=>n(a,!1),children:[(0,l.jsx)(R.bq,{className:"w-full text-sm",children:ac.find(a=>a.id===k)?(0,l.jsxs)("div",{className:"flex items-center gap-2 flex-1 text-left",children:[(0,l.jsx)("div",{className:"h-3 w-3 rounded-full border border-border/50",style:{background:ac.find(a=>a.id===k)?.color}}),(0,l.jsx)("span",{children:ac.find(a=>a.id===k)?.name})]}):(0,l.jsx)(R.yv,{placeholder:"Select theme"})}),(0,l.jsx)(R.gC,{children:ac.map(a=>(0,l.jsx)(R.eb,{value:a.id,children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"h-3 w-3 rounded-full border border-border/50",style:{background:a.color}}),(0,l.jsx)("span",{children:a.name})]})},a.id))})]})]}),(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Navigation Style"}),(0,l.jsxs)(R.l6,{value:o,onValueChange:a=>p(a,!1),children:[(0,l.jsx)(R.bq,{className:"w-full text-sm",children:ad.find(a=>a.id===o)?(0,l.jsx)("div",{className:"flex items-center gap-2 flex-1 text-left",children:(b=(a=ad.find(a=>a.id===o)).icon,(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(b,{className:`size-4 ${a.color}`}),(0,l.jsx)("span",{children:a.name})]}))}):(0,l.jsx)(R.yv,{placeholder:"Select layout"})}),(0,l.jsx)(R.gC,{children:ad.map(a=>{let b=a.icon;return(0,l.jsx)(R.eb,{value:a.id,children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(b,{className:`size-4 ${a.color}`}),(0,l.jsx)("span",{children:a.name})]})},a.id)})})]})]})]}),(0,l.jsx)(T.wL,{className:"flex justify-end pt-4 border-t",children:(0,l.jsxs)(O.$,{size:"lg",disabled:!x,onClick:()=>{n(k,!0),p(o,!0),u(k),w(o),S.oR.success("Appearance settings saved")},className:"gap-1.5 px-4",children:[(0,l.jsx)(N.A,{className:"size-3.5"}),"Save"]})})]}),(0,l.jsx)(ab,{})]})}var ag=c(60812),ah=c(53429),ai=c(38572),aj=c(9692);let ak={name:"scan-eye",size:24,node:[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]};ak.node;let al=(0,q.A)(ak);var am=c(90951),an=c(93037),ao=c(54399),ap=c(74503),aq=c(15865),ar=c(3254),as=c(79891),at=c(22515),au=/[\\\/_+.#"@\[\(\{&]/,av=/[\\\/_+.#"@\[\(\{&]/g,aw=/[\s-]/,ax=/[\s-]/g;function ay(a){return a.toLowerCase().replace(ax," ")}var az=Object.defineProperty,aA=(a,b)=>az(a,"name",{value:b,configurable:!0}),aB=!!("u">typeof window&&window.document&&window.document.createElement);function aC(a,b,{checkForDefaultPrevented:c=!0}={}){return aA(function(d){if(a?.(d),!1===c||!d||!d.defaultPrevented)return b?.(d)},"handleEvent")}function aD(a){if(!aB)throw Error("Cannot access document outside of the DOM");return a?.ownerDocument??document}function aE(a){return"IFRAME"===a.tagName}aA(aC,"composeEventHandlers"),aA(function(a){if(!aB)throw Error("Cannot access window outside of the DOM");return a?.ownerDocument?.defaultView??window},"getOwnerWindow"),aA(aD,"getOwnerDocument"),aA(function a(b,c=!1){let{activeElement:d}=aD(b);if(!d?.nodeName)return null;if(aE(d)&&d.contentDocument)return a(d.contentDocument.body,c);if(c){let a=d.getAttribute("aria-activedescendant");if(a){let b=aD(d).getElementById(a);if(b)return b}}return d},"getActiveElement"),aA(aE,"isFrame");var aF=Object.defineProperty,aG=(a,b)=>aF(a,"name",{value:b,configurable:!0});function aH(a,b){if("function"==typeof a)return a(b);null!=a&&(a.current=b)}function aI(...a){return b=>{let c=!1,d=a.map(a=>{let d=aH(a,b);return c||"function"!=typeof d||(c=!0),d});if(c)return()=>{for(let b=0;b<d.length;b++){let c=d[b];"function"==typeof c?c():aH(a[b],null)}}}}function aJ(...a){return m.useCallback(aI(...a),a)}aG(aH,"setRef"),aG(aI,"composeRefs"),aG(aJ,"useComposedRefs");var aK=Object.defineProperty,aL=(a,b)=>aK(a,"name",{value:b,configurable:!0});function aM(a,b=[]){let c=[];function d(b,d){let e=m.createContext(d);e.displayName=b+"Context";let f=c.length;c=[...c,d];let g=aL(b=>{let{scope:c,children:d,...g}=b,h=c?.[a]?.[f]||e,i=m.useMemo(()=>g,Object.values(g));return(0,l.jsx)(h.Provider,{value:i,children:d})},"Provider");function h(c,g,i={}){let{optional:j=!1}=i,k=g?.[a]?.[f]||e,l=m.useContext(k);if(l)return l;if(void 0!==d)return d;if(!j)throw Error(`\`${c}\` must be used within \`${b}\``)}return g.displayName=b+"Provider",aL(h,"useContext"),[g,h]}aL(d,"createContext");let e=aL(()=>{let b=c.map(a=>m.createContext(a));return aL(function(c){let d=c?.[a]||b;return m.useMemo(()=>({[`__scope${a}`]:{...c,[a]:d}}),[c,d])},"useScope")},"createScope");return e.scopeName=a,[d,aN(e,...b)]}function aN(...a){let b=a[0];if(1===a.length)return b;let c=aL(()=>{let c=a.map(a=>({useScope:a(),scopeName:a.scopeName}));return aL(function(a){let d=c.reduce((b,{useScope:c,scopeName:d})=>{let e=c(a)[`__scope${d}`];return{...b,...e}},{});return m.useMemo(()=>({[`__scope${b.scopeName}`]:d}),[d])},"useComposedScopes")},"createScope");return c.scopeName=b.scopeName,c}aL(function(a,b){let c=m.createContext(b);c.displayName=a+"Context";let d=aL(a=>{let{children:b,...d}=a,e=m.useMemo(()=>d,Object.values(d));return(0,l.jsx)(c.Provider,{value:e,children:b})},"Provider");function e(d,f={}){let{optional:g=!1}=f,h=m.useContext(c);if(h)return h;if(void 0!==b)return b;if(!g)throw Error(`\`${d}\` must be used within \`${a}\``)}return d.displayName=a+"Provider",aL(e,"useContext"),[d,e]},"createContext"),aL(aM,"createContextScope"),aL(aN,"composeContextScopes");var aO=globalThis?.document?m.useLayoutEffect:()=>{},aP=Object.defineProperty,aQ=n[" useId ".trim().toString()]||(()=>void 0),aR=0;function aS(a){let[b,c]=m.useState(aQ());return aO(()=>{a||c(a=>a??String(aR++))},[a]),a||(b?`radix-${b}`:"")}aP(aS,"name",{value:"useId",configurable:!0});var aT=Object.defineProperty,aU=n[" useEffectEvent ".trim().toString()],aV=n[" useInsertionEffect ".trim().toString()];function aW(a){if("function"==typeof aU)return aU(a);let b=m.useRef(()=>{throw Error("Cannot call an event handler while rendering.")});return"function"==typeof aV?aV(()=>{b.current=a}):aO(()=>{b.current=a}),m.useMemo(()=>(...a)=>b.current?.(...a),[])}aT(aW,"name",{value:"useEffectEvent",configurable:!0});var aX=Object.defineProperty,aY=(a,b)=>aX(a,"name",{value:b,configurable:!0}),aZ=n[" useInsertionEffect ".trim().toString()]||aO;function a$({prop:a,defaultProp:b,onChange:c=aY(()=>{},"onChange"),caller:d}){let[e,f,g]=a_({defaultProp:b,onChange:c}),h=void 0!==a,i=h?a:e;return[i,m.useCallback(b=>{if(h){let c=a0(b)?b(a):b;c!==a&&g.current?.(c)}else f(b)},[h,a,f,g])]}function a_({defaultProp:a,onChange:b}){let[c,d]=m.useState(a),e=m.useRef(c),f=m.useRef(b);return aZ(()=>{f.current=b},[b]),m.useEffect(()=>{e.current!==c&&(f.current?.(c),e.current=c)},[c,e]),[c,d,f]}function a0(a){return"function"==typeof a}aY(a$,"useControllableState"),aY(a_,"useUncontrolledState"),aY(a0,"isFunction");var a1=Symbol("RADIX:SYNC_STATE");aY(function(a,b,c,d){let{prop:e,defaultProp:f,onChange:g,caller:h}=b,i=void 0!==e,j=aW(g),k=[{...c,state:f}];d&&k.push(d);let[l,n]=m.useReducer((b,c)=>{if(c.type===a1)return{...b,state:c.state};let d=a(b,c);return i&&!Object.is(d.state,b.state)&&j(d.state),d},...k),o=l.state,p=m.useRef(o);m.useEffect(()=>{p.current!==o&&(p.current=o,i||j(o))},[o,p,i]);let q=m.useMemo(()=>void 0!==e?{...l,state:e}:l,[l,e]);return m.useEffect(()=>{i&&!Object.is(e,l.state)&&n({type:a1,state:e})},[e,l.state,i]),[q,n]},"useControllableStateReducer");var a2=c(4888),a3=Object.defineProperty,a4=(a,b)=>a3(a,"name",{value:b,configurable:!0});function a5(a){let b=m.forwardRef((b,c)=>{let{children:d,...e}=b,f=null,g=!1,h=[];bc(d)&&"function"==typeof bg&&(d=bg(d._payload)),m.Children.forEach(d,a=>{if(ba(a)){g=!0;let b="child"in a.props?a.props.child:a.props.children;bc(b)&&"function"==typeof bg&&(b=bg(b._payload)),f=a7(a,b),h.push(f?.props?.children)}else h.push(a)}),f?f=m.cloneElement(f,void 0,h):!g&&1===m.Children.count(d)&&m.isValidElement(d)&&(f=d);let i=f?a9(f):void 0,j=aJ(c,i);if(!f){if(d||0===d)throw Error(g?bf(a):be(a));return d}let k=a8(e,f.props??{});return f.type!==m.Fragment&&(k.ref=c?j:i),m.cloneElement(f,k)});return b.displayName=`${a}.Slot`,b}a4(a5,"createSlot");var a6=Symbol.for("radix.slottable");a4(function(a){let b=a4(a=>"child"in a?a.children(a.child):a.children,"Slottable");return b.displayName=`${a}.Slottable`,b.__radixId=a6,b},"createSlottable");var a7=a4((a,b)=>{if("child"in a.props){let b=a.props.child;return m.isValidElement(b)?m.cloneElement(b,void 0,a.props.children(b.props.children)):null}return m.isValidElement(b)?b:null},"getSlottableElementFromSlottable");function a8(a,b){let c={...b};for(let d in b){let e=a[d],f=b[d];/^on[A-Z]/.test(d)?e&&f?c[d]=(...a)=>{let b=f(...a);return e(...a),b}:e&&(c[d]=e):"style"===d?c[d]={...e,...f}:"className"===d&&(c[d]=[e,f].filter(Boolean).join(" "))}return{...a,...c}}function a9(a){let b=Object.getOwnPropertyDescriptor(a.props,"ref")?.get,c=b&&"isReactWarning"in b&&b.isReactWarning;return c?a.ref:(c=(b=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in b&&b.isReactWarning)?a.props.ref:a.props.ref||a.ref}function ba(a){return m.isValidElement(a)&&"function"==typeof a.type&&"__radixId"in a.type&&a.type.__radixId===a6}a4(a8,"mergeProps"),a4(a9,"getElementRef"),a4(ba,"isSlottable");var bb=Symbol.for("react.lazy");function bc(a){return null!=a&&"object"==typeof a&&"$$typeof"in a&&a.$$typeof===bb&&"_payload"in a&&bd(a._payload)}function bd(a){return"object"==typeof a&&null!==a&&"then"in a}a4(bc,"isLazyComponent"),a4(bd,"isPromiseLike");var be=a4(a=>`${a} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),bf=a4(a=>`${a} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),bg=n[" use ".trim().toString()],bh=Object.defineProperty,bi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((a,b)=>{let c=a5(`Primitive.${b}`),d=m.forwardRef((a,d)=>{let{asChild:e,...f}=a;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,l.jsx)(e?c:b,{...f,ref:d})});return d.displayName=`Primitive.${b}`,{...a,[b]:d}},{});function bj(a,b){a&&a2.flushSync(()=>a.dispatchEvent(b))}function bk(a){let b=m.useRef(a);return m.useEffect(()=>{b.current=a}),m.useMemo(()=>(...a)=>b.current?.(...a),[])}bh(bj,"name",{value:"dispatchDiscreteCustomEvent",configurable:!0}),(0,Object.defineProperty)(bk,"name",{value:"useCallbackRef",configurable:!0});var bl=Object.defineProperty,bm=(a,b)=>bl(a,"name",{value:b,configurable:!0}),bn="dismissableLayer.update",bo=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),bp=m.forwardRef(bm(function(a,b){let{disableOutsidePointerEvents:c=!1,deferPointerDownOutside:d=!1,onEscapeKeyDown:e,onPointerDownOutside:f,onFocusOutside:g,onInteractOutside:h,onDismiss:i,...k}=a,n=m.useContext(bo),[o,p]=m.useState(null),q=o?.ownerDocument??globalThis?.document,[,r]=m.useState({}),s=aJ(b,p),t=Array.from(n.layers),[u]=[...n.layersWithOutsidePointerEventsDisabled].slice(-1),v=u?t.indexOf(u):-1,w=o?t.indexOf(o):-1,x=n.layersWithOutsidePointerEventsDisabled.size>0,y=w>=v,z=m.useRef(!1),A=bs(a=>{f?.(a),h?.(a),a.defaultPrevented||i?.()},{ownerDocument:q,deferPointerDownOutside:d,isDeferredPointerDownOutsideRef:z,dismissableSurfaces:n.dismissableSurfaces,shouldHandlePointerDownOutside:m.useCallback(a=>{if(!(a instanceof Node))return!1;let b=[...n.branches].some(b=>b.contains(a));return y&&!b},[n.branches,y])}),B=bt(a=>{if(d&&z.current)return;let b=a.target;![...n.branches].some(a=>a.contains(b))&&(g?.(a),h?.(a),a.defaultPrevented||i?.())},q),C=!!o&&w===t.length-1,D=bk(a=>{"Escape"===a.key&&(e?.(a),!a.defaultPrevented&&i&&(a.preventDefault(),i()))});return m.useEffect(()=>{if(C)return q.addEventListener("keydown",D,{capture:!0}),()=>q.removeEventListener("keydown",D,{capture:!0})},[q,C,D]),m.useEffect(()=>{if(o)return c&&(0===n.layersWithOutsidePointerEventsDisabled.size&&(j=q.body.style.pointerEvents,q.body.style.pointerEvents="none"),n.layersWithOutsidePointerEventsDisabled.add(o)),n.layers.add(o),bu(),()=>{c&&(n.layersWithOutsidePointerEventsDisabled.delete(o),0===n.layersWithOutsidePointerEventsDisabled.size&&(q.body.style.pointerEvents=j))}},[o,q,c,n]),m.useEffect(()=>()=>{o&&(n.layers.delete(o),n.layersWithOutsidePointerEventsDisabled.delete(o),bu())},[o,n]),m.useEffect(()=>{let a=bm(()=>r({}),"handleUpdate");return document.addEventListener(bn,a),()=>document.removeEventListener(bn,a)},[]),(0,l.jsx)(bi.div,{...k,ref:s,style:{pointerEvents:x?y?"auto":"none":void 0,...a.style},onFocusCapture:aC(a.onFocusCapture,B.onFocusCapture),onBlurCapture:aC(a.onBlurCapture,B.onBlurCapture),onPointerDownCapture:aC(a.onPointerDownCapture,A.onPointerDownCapture)})},"DismissableLayer"));function bq(){let a=m.useContext(bo),[b,c]=m.useState(null);return m.useEffect(()=>{if(b)return a.dismissableSurfaces.add(b),()=>{a.dismissableSurfaces.delete(b)}},[b,a.dismissableSurfaces]),c}bm(bq,"useDismissableLayerSurface");var br=bm(()=>!0,"IS_TRUE");function bs(a,b){let{ownerDocument:c=globalThis?.document,deferPointerDownOutside:d=!1,isDeferredPointerDownOutsideRef:e,dismissableSurfaces:f,shouldHandlePointerDownOutside:g=br}=b,h=bk(a),i=m.useRef(!1),j=m.useRef(!1),k=m.useRef(new Map),l=m.useRef(()=>{});return m.useEffect(()=>{function a(){j.current=!1,e.current=!1,k.current.clear()}function b(){return Array.from(k.current.values()).some(Boolean)}function m(a){if(!j.current)return;let b=a.target;b instanceof Node&&[...f].some(a=>a.contains(b))||k.current.set(a.type,!0),"click"===a.type&&window.setTimeout(()=>{j.current&&l.current()},0)}function n(a){j.current&&k.current.set(a.type,!1)}bm(a,"resetOutsideInteraction"),bm(b,"isOutsideInteractionIntercepted"),bm(m,"handleInteractionCapture"),bm(n,"handleInteractionBubble");let o=bm(f=>{if(f.target&&!i.current){let m=function(){c.removeEventListener("click",l.current);let d=b();a(),d||bv("dismissableLayer.pointerDownOutside",h,n,{discrete:!0})};if(bm(m,"handleAndDispatchPointerDownOutsideEvent"),!g(f.target)){c.removeEventListener("click",l.current),a(),i.current=!1;return}let n={originalEvent:f};j.current=!0,e.current=d&&0===f.button,k.current.clear(),d&&0===f.button?(c.removeEventListener("click",l.current),l.current=m,c.addEventListener("click",l.current,{once:!0})):m()}else c.removeEventListener("click",l.current),a();i.current=!1},"handlePointerDown"),p=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(let a of p)c.addEventListener(a,m,!0),c.addEventListener(a,n);let q=window.setTimeout(()=>{c.addEventListener("pointerdown",o)},0);return()=>{for(let a of(window.clearTimeout(q),c.removeEventListener("pointerdown",o),c.removeEventListener("click",l.current),p))c.removeEventListener(a,m,!0),c.removeEventListener(a,n)}},[c,h,d,e,f,g]),{onPointerDownCapture:bm(()=>i.current=!0,"onPointerDownCapture")}}function bt(a,b=globalThis?.document){let c=bk(a),d=m.useRef(!1);return m.useEffect(()=>{let a=bm(a=>{a.target&&!d.current&&bv("dismissableLayer.focusOutside",c,{originalEvent:a},{discrete:!1})},"handleFocus");return b.addEventListener("focusin",a),()=>b.removeEventListener("focusin",a)},[b,c]),{onFocusCapture:bm(()=>d.current=!0,"onFocusCapture"),onBlurCapture:bm(()=>d.current=!1,"onBlurCapture")}}function bu(){let a=new CustomEvent(bn);document.dispatchEvent(a)}function bv(a,b,c,{discrete:d}){let e=c.originalEvent.target,f=new CustomEvent(a,{bubbles:!1,cancelable:!0,detail:c});b&&e.addEventListener(a,b,{once:!0}),d?bj(e,f):e.dispatchEvent(f)}bm(bs,"usePointerDownOutside"),bm(bt,"useFocusOutside"),bm(bu,"dispatchUpdate"),bm(bv,"handleAndDispatchCustomEvent");var bw=Object.defineProperty,bx=(a,b)=>bw(a,"name",{value:b,configurable:!0}),by="focusScope.autoFocusOnMount",bz="focusScope.autoFocusOnUnmount",bA={bubbles:!1,cancelable:!0},bB=m.forwardRef(bx(function(a,b){let{loop:c=!1,trapped:d=!1,onMountAutoFocus:e,onUnmountAutoFocus:f,...g}=a,[h,i]=m.useState(null),j=bk(e),k=bk(f),n=m.useRef(null),o=aJ(b,i),p=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(d){let a=function(a){if(p.paused||!h)return;let b=a.target;h.contains(b)?n.current=b:bI(n.current,{select:!0})},b=function(a){if(p.paused||!h)return;let b=a.relatedTarget;null!==b&&(h.contains(b)||bI(n.current,{select:!0}))},c=function(a){if(document.activeElement===document.body)for(let b of a)b.removedNodes.length>0&&bI(h)};bx(a,"handleFocusIn"),bx(b,"handleFocusOut"),bx(c,"handleMutations"),document.addEventListener("focusin",a),document.addEventListener("focusout",b);let d=new MutationObserver(c);return h&&d.observe(h,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",a),document.removeEventListener("focusout",b),d.disconnect()}}},[d,h,p.paused]),m.useEffect(()=>{if(h){bJ.add(p);let a=document.activeElement;if(!h.contains(a)){let b=new CustomEvent(by,bA);h.addEventListener(by,j),h.dispatchEvent(b),b.defaultPrevented||(bC(bM(bE(h)),{select:!0}),document.activeElement===a&&bI(h))}return()=>{h.removeEventListener(by,j),setTimeout(()=>{let b=new CustomEvent(bz,bA);h.addEventListener(bz,k),h.dispatchEvent(b),b.defaultPrevented||bI(a??document.body,{select:!0}),h.removeEventListener(bz,k),bJ.remove(p)},0)}}},[h,j,k,p]);let q=m.useCallback(a=>{if(!c&&!d||p.paused)return;let b="Tab"===a.key&&!a.altKey&&!a.ctrlKey&&!a.metaKey,e=document.activeElement;if(b&&e){let b=a.currentTarget,[d,f]=bD(b);d&&f?a.shiftKey||e!==f?a.shiftKey&&e===d&&(a.preventDefault(),c&&bI(f,{select:!0})):(a.preventDefault(),c&&bI(d,{select:!0})):e===b&&a.preventDefault()}},[c,d,p.paused]);return(0,l.jsx)(bi.div,{tabIndex:-1,...g,ref:o,onKeyDown:q})},"FocusScope"));function bC(a,{select:b=!1}={}){let c=document.activeElement;for(let d of a)if(bI(d,{select:b}),document.activeElement!==c)return}function bD(a){let b=bE(a);return[bF(b,a),bF(b.reverse(),a)]}function bE(a){let b=[],c=document.createTreeWalker(a,NodeFilter.SHOW_ELEMENT,{acceptNode:bx(a=>{let b="INPUT"===a.tagName&&"hidden"===a.type;return a.disabled||a.hidden||b?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;c.nextNode();)b.push(c.currentNode);return b}function bF(a,b){let c="function"==typeof b.checkVisibility&&b.checkVisibility({checkVisibilityCSS:!0});for(let d of a)if(!(c?!d.checkVisibility({checkVisibilityCSS:!0}):bG(d,{upTo:b})))return d}function bG(a,{upTo:b}){if("hidden"===getComputedStyle(a).visibility)return!0;for(;a&&(void 0===b||a!==b);){if("none"===getComputedStyle(a).display)return!0;a=a.parentElement}return!1}function bH(a){return a instanceof HTMLInputElement&&"select"in a}function bI(a,{select:b=!1}={}){if(a&&a.focus){let c=document.activeElement;a.focus({preventScroll:!0}),a!==c&&bH(a)&&b&&a.select()}}bx(bC,"focusFirst"),bx(bD,"getTabbableEdges"),bx(bE,"getTabbableCandidates"),bx(bF,"findVisible"),bx(bG,"isHidden"),bx(bH,"isSelectableInput"),bx(bI,"focus");var bJ=bK();function bK(){let a=[];return{add(b){let c=a[0];b!==c&&c?.pause(),(a=bL(a,b)).unshift(b)},remove(b){a=bL(a,b),a[0]?.resume()}}}function bL(a,b){let c=[...a],d=c.indexOf(b);return -1!==d&&c.splice(d,1),c}function bM(a){return a.filter(a=>"A"!==a.tagName)}bx(bK,"createFocusScopesStack"),bx(bL,"arrayRemove"),bx(bM,"removeLinks");var bN=Object.defineProperty,bO=m.forwardRef(bN(function(a,b){let{container:c,...d}=a,[e,f]=m.useState(!1);aO(()=>f(!0),[]);let g=c||e&&globalThis?.document?.body;return g?a2.createPortal((0,l.jsx)(bi.div,{...d,ref:b}),g):null},"name",{value:"Portal",configurable:!0})),bP=Object.defineProperty,bQ=(a,b)=>bP(a,"name",{value:b,configurable:!0});function bR(a,b){return m.useReducer((a,c)=>b[a][c]??a,a)}bQ(bR,"useStateMachine");var bS=bQ(a=>{let{present:b,children:c}=a,d=bT(b),e="function"==typeof c?c({present:d.isPresent}):m.Children.only(c),f=bV(d.ref,bX(e));return"function"==typeof c||d.isPresent?m.cloneElement(e,{ref:f}):null},"Presence");function bT(a){let[b,c]=m.useState(),d=m.useRef(null),e=m.useRef(a),f=m.useRef("none"),g=m.useRef(void 0),[h,i]=bR(a?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{"mounted"===h?(f.current=g.current??bW(d.current),g.current=void 0):f.current="none"},[h]),aO(()=>{let b=d.current,c=e.current;if(c!==a){let d=f.current,h=bW(b);a?(g.current=h,i("MOUNT")):"none"===h||b?.display==="none"?i("UNMOUNT"):c&&d!==h?i("ANIMATION_OUT"):i("UNMOUNT"),e.current=a}},[a,i]),aO(()=>{if(b){let a,c=b.ownerDocument.defaultView??window,g=bQ(f=>{let g=bW(d.current).includes(CSS.escape(f.animationName));if(f.target===b&&g&&(i("ANIMATION_END"),!e.current)){let d=b.style.animationFillMode;b.style.animationFillMode="forwards",a=c.setTimeout(()=>{"forwards"===b.style.animationFillMode&&(b.style.animationFillMode=d)})}},"handleAnimationEnd"),h=bQ(a=>{a.target===b&&(f.current=bW(d.current))},"handleAnimationStart");return b.addEventListener("animationstart",h),b.addEventListener("animationcancel",g),b.addEventListener("animationend",g),()=>{c.clearTimeout(a),b.removeEventListener("animationstart",h),b.removeEventListener("animationcancel",g),b.removeEventListener("animationend",g)}}i("ANIMATION_END")},[b,i]),{isPresent:["mounted","unmountSuspended"].includes(h),ref:m.useCallback(a=>{if(a){let b=getComputedStyle(a);d.current=b,g.current=bW(b)}else d.current=null;c(a)},[])}}function bU(a,b){if("function"==typeof a)return a(b);null!=a&&(a.current=b)}function bV(...a){let b=m.useRef(a);return b.current=a,m.useCallback(a=>{let c=b.current,d=!1,e=c.map(b=>{let c=bU(b,a);return d||"function"!=typeof c||(d=!0),c});if(d)return()=>{for(let a=0;a<e.length;a++){let b=e[a];"function"==typeof b?b():bU(c[a],null)}}},[])}function bW(a){return a?.animationName||"none"}function bX(a){let b=Object.getOwnPropertyDescriptor(a.props,"ref")?.get,c=b&&"isReactWarning"in b&&b.isReactWarning;return c?a.ref:(c=(b=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in b&&b.isReactWarning)?a.props.ref:a.props.ref||a.ref}bQ(bT,"usePresence"),bQ(bU,"setRef"),bQ(bV,"useStableComposedRefs"),bQ(bW,"getAnimationName"),bQ(bX,"getElementRef");var bY=Object.defineProperty,bZ=(a,b)=>bY(a,"name",{value:b,configurable:!0}),b$=0,b_=null;function b0(){m.useEffect(()=>{b_||(b_={start:b1(),end:b1()});let{start:a,end:b}=b_;return document.body.firstElementChild!==a&&document.body.insertAdjacentElement("afterbegin",a),document.body.lastElementChild!==b&&document.body.insertAdjacentElement("beforeend",b),b$++,()=>{1===b$&&(b_?.start.remove(),b_?.end.remove(),b_=null),b$=Math.max(0,b$-1)}},[])}function b1(){let a=document.createElement("span");return a.setAttribute("data-radix-focus-guard",""),a.tabIndex=0,a.style.outline="none",a.style.opacity="0",a.style.position="fixed",a.style.pointerEvents="none",a}bZ(function(a){return b0(),a.children},"FocusGuards"),bZ(b0,"useFocusGuards"),bZ(b1,"createFocusGuard");var b2=function(){return(b2=Object.assign||function(a){for(var b,c=1,d=arguments.length;c<d;c++)for(var e in b=arguments[c])Object.prototype.hasOwnProperty.call(b,e)&&(a[e]=b[e]);return a}).apply(this,arguments)};function b3(a,b){var c={};for(var d in a)Object.prototype.hasOwnProperty.call(a,d)&&0>b.indexOf(d)&&(c[d]=a[d]);if(null!=a&&"function"==typeof Object.getOwnPropertySymbols)for(var e=0,d=Object.getOwnPropertySymbols(a);e<d.length;e++)0>b.indexOf(d[e])&&Object.prototype.propertyIsEnumerable.call(a,d[e])&&(c[d[e]]=a[d[e]]);return c}var b4=("function"==typeof SuppressedError&&SuppressedError,"right-scroll-bar-position"),b5="width-before-scroll-bar";function b6(a,b){return"function"==typeof a?a(b):a&&(a.current=b),a}var b7="u">typeof window?m.useLayoutEffect:m.useEffect,b8=new WeakMap,b9=(void 0===d&&(d={}),(void 0===e&&(e=function(a){return a}),f=[],g=!1,h={read:function(){if(g)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return f.length?f[f.length-1]:null},useMedium:function(a){var b=e(a,g);return f.push(b),function(){f=f.filter(function(a){return a!==b})}},assignSyncMedium:function(a){for(g=!0;f.length;){var b=f;f=[],b.forEach(a)}f={push:function(b){return a(b)},filter:function(){return f}}},assignMedium:function(a){g=!0;var b=[];if(f.length){var c=f;f=[],c.forEach(a),b=f}var d=function(){var c=b;b=[],c.forEach(a)},e=function(){return Promise.resolve().then(d)};e(),f={push:function(a){b.push(a),e()},filter:function(a){return b=b.filter(a),f}}}}).options=b2({async:!0,ssr:!1},d),h),ca=function(){},cb=m.forwardRef(function(a,b){var c,d,e,f,g=m.useRef(null),h=m.useState({onScrollCapture:ca,onWheelCapture:ca,onTouchMoveCapture:ca}),i=h[0],j=h[1],k=a.forwardProps,l=a.children,n=a.className,o=a.removeScrollBar,p=a.enabled,q=a.shards,r=a.sideCar,s=a.noRelative,t=a.noIsolation,u=a.inert,v=a.allowPinchZoom,w=a.as,x=a.gapMode,y=b3(a,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),z=(c=[g,b],d=function(a){return c.forEach(function(b){return b6(b,a)})},(e=(0,m.useState)(function(){return{value:null,callback:d,facade:{get current(){return e.value},set current(value){var a=e.value;a!==value&&(e.value=value,e.callback(value,a))}}}})[0]).callback=d,f=e.facade,b7(function(){var a=b8.get(f);if(a){var b=new Set(a),d=new Set(c),e=f.current;b.forEach(function(a){d.has(a)||b6(a,null)}),d.forEach(function(a){b.has(a)||b6(a,e)})}b8.set(f,c)},[c]),f),A=b2(b2({},y),i);return m.createElement(m.Fragment,null,p&&m.createElement(r,{sideCar:b9,removeScrollBar:o,shards:q,noRelative:s,noIsolation:t,inert:u,setCallbacks:j,allowPinchZoom:!!v,lockRef:g,gapMode:x}),k?m.cloneElement(m.Children.only(l),b2(b2({},A),{ref:z})):m.createElement(void 0===w?"div":w,b2({},A,{className:n,ref:z}),l))});cb.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},cb.classNames={fullWidth:b5,zeroRight:b4};var cc=function(a){var b=a.sideCar,c=b3(a,["sideCar"]);if(!b)throw Error("Sidecar: please provide `sideCar` property to import the right car");var d=b.read();if(!d)throw Error("Sidecar medium not found");return m.createElement(d,b2({},c))};cc.isSideCarExport=!0;var cd=function(){var a=0,b=null;return{add:function(d){if(0==a&&(b=function(){if(!document)return null;var a=document.createElement("style");a.type="text/css";var b=k||c.nc;return b&&a.setAttribute("nonce",b),a}())){var e,f;(e=b).styleSheet?e.styleSheet.cssText=d:e.appendChild(document.createTextNode(d)),f=b,(document.head||document.getElementsByTagName("head")[0]).appendChild(f)}a++},remove:function(){--a||!b||(b.parentNode&&b.parentNode.removeChild(b),b=null)}}},ce=function(){var a=cd();return function(b,c){m.useEffect(function(){return a.add(b),function(){a.remove()}},[b&&c])}},cf=function(){var a=ce();return function(b){return a(b.styles,b.dynamic),null}},cg={left:0,top:0,right:0,gap:0},ch=function(a){return parseInt(a||"",10)||0},ci=function(a){var b=window.getComputedStyle(document.body),c=b["padding"===a?"paddingLeft":"marginLeft"],d=b["padding"===a?"paddingTop":"marginTop"],e=b["padding"===a?"paddingRight":"marginRight"];return[ch(c),ch(d),ch(e)]},cj=function(a){if(void 0===a&&(a="margin"),"u"<typeof window)return cg;var b=ci(a),c=document.documentElement.clientWidth,d=window.innerWidth;return{left:b[0],top:b[1],right:b[2],gap:Math.max(0,d-c+b[2]-b[0])}},ck=cf(),cl="data-scroll-locked",cm=function(a,b,c,d){var e=a.left,f=a.top,g=a.right,h=a.gap;return void 0===c&&(c="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(d,";\n padding-right: ").concat(h,"px ").concat(d,";\n }\n body[").concat(cl,"] {\n overflow: hidden ").concat(d,";\n overscroll-behavior: contain;\n ").concat([b&&"position: relative ".concat(d,";"),"margin"===c&&"\n padding-left: ".concat(e,"px;\n padding-top: ").concat(f,"px;\n padding-right: ").concat(g,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(h,"px ").concat(d,";\n "),"padding"===c&&"padding-right: ".concat(h,"px ").concat(d,";")].filter(Boolean).join(""),"\n }\n \n .").concat(b4," {\n right: ").concat(h,"px ").concat(d,";\n }\n \n .").concat(b5," {\n margin-right: ").concat(h,"px ").concat(d,";\n }\n \n .").concat(b4," .").concat(b4," {\n right: 0 ").concat(d,";\n }\n \n .").concat(b5," .").concat(b5," {\n margin-right: 0 ").concat(d,";\n }\n \n body[").concat(cl,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(h,"px;\n }\n")},cn=function(){var a=parseInt(document.body.getAttribute(cl)||"0",10);return isFinite(a)?a:0},co=function(){m.useEffect(function(){return document.body.setAttribute(cl,(cn()+1).toString()),function(){var a=cn()-1;a<=0?document.body.removeAttribute(cl):document.body.setAttribute(cl,a.toString())}},[])},cp=function(a){var b=a.noRelative,c=a.noImportant,d=a.gapMode,e=void 0===d?"margin":d;co();var f=m.useMemo(function(){return cj(e)},[e]);return m.createElement(ck,{styles:cm(f,!b,e,c?"":"!important")})},cq=!1;if("u">typeof window)try{var cr=Object.defineProperty({},"passive",{get:function(){return cq=!0,!0}});window.addEventListener("test",cr,cr),window.removeEventListener("test",cr,cr)}catch(a){cq=!1}var cs=!!cq&&{passive:!1},ct=function(a,b){if(!(a instanceof Element))return!1;var c=window.getComputedStyle(a);return"hidden"!==c[b]&&(c.overflowY!==c.overflowX||"TEXTAREA"===a.tagName||"visible"!==c[b])},cu=function(a,b){var c=b.ownerDocument,d=b;do{if("u">typeof ShadowRoot&&d instanceof ShadowRoot&&(d=d.host),cv(a,d)){var e=cw(a,d);if(e[1]>e[2])return!0}d=d.parentNode}while(d&&d!==c.body);return!1},cv=function(a,b){return"v"===a?ct(b,"overflowY"):ct(b,"overflowX")},cw=function(a,b){return"v"===a?[b.scrollTop,b.scrollHeight,b.clientHeight]:[b.scrollLeft,b.scrollWidth,b.clientWidth]},cx=function(a,b,c,d,e){var f,g=(f=window.getComputedStyle(b).direction,"h"===a&&"rtl"===f?-1:1),h=g*d,i=c.target,j=b.contains(i),k=!1,l=h>0,m=0,n=0;do{if(!i)break;var o=cw(a,i),p=o[0],q=o[1]-o[2]-g*p;(p||q)&&cv(a,i)&&(m+=q,n+=p);var r=i.parentNode;i=r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE?r.host:r}while(!j&&i!==document.body||j&&(b.contains(i)||b===i));return l&&(e&&1>Math.abs(m)||!e&&h>m)?k=!0:!l&&(e&&1>Math.abs(n)||!e&&-h>n)&&(k=!0),k},cy=function(a){return"changedTouches"in a?[a.changedTouches[0].clientX,a.changedTouches[0].clientY]:[0,0]},cz=function(a){return[a.deltaX,a.deltaY]},cA=function(a){return a&&"current"in a?a.current:a},cB=0,cC=[];let cD=(i=function(a){var b=m.useRef([]),c=m.useRef([0,0]),d=m.useRef(),e=m.useState(cB++)[0],f=m.useState(cf)[0],g=m.useRef(a);m.useEffect(function(){g.current=a},[a]),m.useEffect(function(){if(a.inert){document.body.classList.add("block-interactivity-".concat(e));var b=(function(a,b,c){if(c||2==arguments.length)for(var d,e=0,f=b.length;e<f;e++)!d&&e in b||(d||(d=Array.prototype.slice.call(b,0,e)),d[e]=b[e]);return a.concat(d||Array.prototype.slice.call(b))})([a.lockRef.current],(a.shards||[]).map(cA),!0).filter(Boolean);return b.forEach(function(a){return a.classList.add("allow-interactivity-".concat(e))}),function(){document.body.classList.remove("block-interactivity-".concat(e)),b.forEach(function(a){return a.classList.remove("allow-interactivity-".concat(e))})}}},[a.inert,a.lockRef.current,a.shards]);var h=m.useCallback(function(a,b){if("touches"in a&&2===a.touches.length||"wheel"===a.type&&a.ctrlKey)return!g.current.allowPinchZoom;var e,f=cy(a),h=c.current,i="deltaX"in a?a.deltaX:h[0]-f[0],j="deltaY"in a?a.deltaY:h[1]-f[1],k=a.target,l=Math.abs(i)>Math.abs(j)?"h":"v";if("touches"in a&&"h"===l&&"range"===k.type)return!1;var m=window.getSelection(),n=m&&m.anchorNode;if(n&&(n===k||n.contains(k)))return!1;var o=cu(l,k);if(!o)return!0;if(o?e=l:(e="v"===l?"h":"v",o=cu(l,k)),!o)return!1;if(!d.current&&"changedTouches"in a&&(i||j)&&(d.current=e),!e)return!0;var p=d.current||e;return cx(p,b,a,"h"===p?i:j,!0)},[]),i=m.useCallback(function(a){if(cC.length&&cC[cC.length-1]===f){var c="deltaY"in a?cz(a):cy(a),d=b.current.filter(function(b){var d;return b.name===a.type&&(b.target===a.target||a.target===b.shadowParent)&&(d=b.delta,d[0]===c[0]&&d[1]===c[1])})[0];if(d&&d.should){a.cancelable&&a.preventDefault();return}if(!d){var e=(g.current.shards||[]).map(cA).filter(Boolean).filter(function(b){return b.contains(a.target)});(e.length>0?h(a,e[0]):!g.current.noIsolation)&&a.cancelable&&a.preventDefault()}}},[]),j=m.useCallback(function(a,c,d,e){var f={name:a,delta:c,target:d,should:e,shadowParent:function(a){for(var b=null;null!==a;)a instanceof ShadowRoot&&(b=a.host,a=a.host),a=a.parentNode;return b}(d)};b.current.push(f),setTimeout(function(){b.current=b.current.filter(function(a){return a!==f})},1)},[]),k=m.useCallback(function(a){c.current=cy(a),d.current=void 0},[]),l=m.useCallback(function(b){j(b.type,cz(b),b.target,h(b,a.lockRef.current))},[]),n=m.useCallback(function(b){j(b.type,cy(b),b.target,h(b,a.lockRef.current))},[]);m.useEffect(function(){return cC.push(f),a.setCallbacks({onScrollCapture:l,onWheelCapture:l,onTouchMoveCapture:n}),document.addEventListener("wheel",i,cs),document.addEventListener("touchmove",i,cs),document.addEventListener("touchstart",k,cs),function(){cC=cC.filter(function(a){return a!==f}),document.removeEventListener("wheel",i,cs),document.removeEventListener("touchmove",i,cs),document.removeEventListener("touchstart",k,cs)}},[]);var o=a.removeScrollBar,p=a.inert;return m.createElement(m.Fragment,null,p?m.createElement(f,{styles:"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")}):null,o?m.createElement(cp,{noRelative:a.noRelative,gapMode:a.gapMode}):null)},b9.useMedium(i),cc);var cE=m.forwardRef(function(a,b){return m.createElement(cb,b2({},a,{ref:b,sideCar:cD}))});cE.classNames=cb.classNames;var cF=new WeakMap,cG=new WeakMap,cH={},cI=0,cJ=function(a){return a&&(a.host||cJ(a.parentNode))},cK=function(a,b,c,d){var e=(Array.isArray(a)?a:[a]).map(function(a){if(b.contains(a))return a;var c=cJ(a);return c&&b.contains(c)?c:(console.error("aria-hidden",a,"in not contained inside",b,". Doing nothing"),null)}).filter(function(a){return!!a});cH[c]||(cH[c]=new WeakMap);var f=cH[c],g=[],h=new Set,i=new Set(e),j=function(a){!a||h.has(a)||(h.add(a),j(a.parentNode))};e.forEach(j);var k=function(a){!a||i.has(a)||Array.prototype.forEach.call(a.children,function(a){if(h.has(a))k(a);else try{var b=a.getAttribute(d),e=null!==b&&"false"!==b,i=(cF.get(a)||0)+1,j=(f.get(a)||0)+1;cF.set(a,i),f.set(a,j),g.push(a),1===i&&e&&cG.set(a,!0),1===j&&a.setAttribute(c,"true"),e||a.setAttribute(d,"true")}catch(b){console.error("aria-hidden: cannot operate on ",a,b)}})};return k(b),h.clear(),cI++,function(){g.forEach(function(a){var b=cF.get(a)-1,e=f.get(a)-1;cF.set(a,b),f.set(a,e),b||(cG.has(a)||a.removeAttribute(d),cG.delete(a)),e||a.removeAttribute(c)}),--cI||(cF=new WeakMap,cF=new WeakMap,cG=new WeakMap,cH={})}},cL=function(a,b,c){void 0===c&&(c="data-aria-hidden");var d=Array.from(Array.isArray(a)?a:[a]),e=b||("u"<typeof document?null:(Array.isArray(a)?a[0]:a).ownerDocument.body);return e?(d.push.apply(d,Array.from(e.querySelectorAll("[aria-live], script"))),cK(d,e,c,"aria-hidden")):function(){return null}},cM=Object.defineProperty,cN=(a,b)=>cM(a,"name",{value:b,configurable:!0}),cO="Dialog",[cP,cQ]=aM(cO),[cR,cS]=cP(cO),cT=cN(a=>{let{__scopeDialog:b,children:c,open:d,defaultOpen:e,onOpenChange:f,modal:g=!0}=a,h=m.useRef(null),i=m.useRef(null),[j,k]=a$({prop:d,defaultProp:e??!1,onChange:f,caller:cO}),[n,o]=m.useState(0),[p,q]=m.useState(0);return(0,l.jsx)(cR,{scope:b,triggerRef:h,contentRef:i,contentId:aS(),titleId:aS(),descriptionId:aS(),titlePresent:n>0,descriptionPresent:p>0,setTitleCount:o,setDescriptionCount:q,open:j,onOpenChange:k,onOpenToggle:m.useCallback(()=>k(a=>!a),[k]),modal:g,children:c})},"Dialog"),cU="DialogPortal",[cV,cW]=cP(cU,{forceMount:void 0}),cX=cN(a=>{let{__scopeDialog:b,forceMount:c,children:d,container:e}=a,f=cS(cU,b);return(0,l.jsx)(cV,{scope:b,forceMount:c,children:m.Children.map(d,a=>(0,l.jsx)(bS,{present:c||f.open,children:(0,l.jsx)(bO,{asChild:!0,container:e,children:a})}))})},"DialogPortal"),cY="DialogOverlay",cZ=m.forwardRef(cN(function(a,b){let c=cW(cY,a.__scopeDialog),{forceMount:d=c.forceMount,...e}=a,f=cS(cY,a.__scopeDialog);return f.modal?(0,l.jsx)(bS,{present:d||f.open,children:(0,l.jsx)(c_,{...e,ref:b})}):null},"DialogOverlay")),c$=a5("DialogOverlay.RemoveScroll"),c_=m.forwardRef(cN(function(a,b){let{__scopeDialog:c,...d}=a,e=cS(cY,c),f=aJ(b,bq());return(0,l.jsx)(cE,{as:c$,allowPinchZoom:!0,shards:[e.contentRef],children:(0,l.jsx)(bi.div,{"data-state":c5(e.open),...d,ref:f,style:{pointerEvents:"auto",...d.style}})})},"DialogOverlayImpl")),c0="DialogContent",c1=m.forwardRef(cN(function(a,b){let c=cW(c0,a.__scopeDialog),{forceMount:d=c.forceMount,...e}=a,f=cS(c0,a.__scopeDialog);return(0,l.jsx)(bS,{present:d||f.open,children:f.modal?(0,l.jsx)(c2,{...e,ref:b}):(0,l.jsx)(c3,{...e,ref:b})})},"DialogContent")),c2=m.forwardRef(cN(function(a,b){let c=cS(c0,a.__scopeDialog),d=m.useRef(null),e=aJ(b,c.contentRef,d);return m.useEffect(()=>{let a=d.current;if(a)return cL(a)},[]),(0,l.jsx)(c4,{...a,ref:e,trapFocus:c.open,disableOutsidePointerEvents:c.open,onCloseAutoFocus:aC(a.onCloseAutoFocus,a=>{a.preventDefault(),c.triggerRef.current?.focus()}),onPointerDownOutside:aC(a.onPointerDownOutside,a=>{let b=a.detail.originalEvent,c=0===b.button&&!0===b.ctrlKey;(2===b.button||c)&&a.preventDefault()}),onFocusOutside:aC(a.onFocusOutside,a=>a.preventDefault())})},"DialogContentModal")),c3=m.forwardRef(cN(function(a,b){let c=cS(c0,a.__scopeDialog),d=m.useRef(!1),e=m.useRef(!1);return(0,l.jsx)(c4,{...a,ref:b,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:b=>{a.onCloseAutoFocus?.(b),b.defaultPrevented||(d.current||c.triggerRef.current?.focus(),b.preventDefault()),d.current=!1,e.current=!1},onInteractOutside:b=>{a.onInteractOutside?.(b),b.defaultPrevented||(d.current=!0,"pointerdown"===b.detail.originalEvent.type&&(e.current=!0));let f=b.target;c.triggerRef.current?.contains(f)&&b.preventDefault(),"focusin"===b.detail.originalEvent.type&&e.current&&b.preventDefault()}})},"DialogContentNonModal")),c4=m.forwardRef(cN(function(a,b){let{__scopeDialog:c,trapFocus:d,onOpenAutoFocus:e,onCloseAutoFocus:f,...g}=a,h=cS(c0,c);return b0(),(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(bB,{asChild:!0,loop:!0,trapped:d,onMountAutoFocus:e,onUnmountAutoFocus:f,children:(0,l.jsx)(bp,{role:"dialog",id:h.contentId,"aria-describedby":h.descriptionPresent?h.descriptionId:void 0,"aria-labelledby":h.titlePresent?h.titleId:void 0,"data-state":c5(h.open),...g,ref:b,deferPointerDownOutside:!0,onDismiss:()=>h.onOpenChange(!1)})})})},"DialogContentImpl"));function c5(a){return a?"open":"closed"}cN(c5,"getState");var c6='[cmdk-group=""]',c7='[cmdk-group-items=""]',c8='[cmdk-item=""]',c9=`${c8}:not([aria-disabled="true"])`,da="cmdk-item-select",db="data-value",dc=(a,b,c)=>{var d;return d=a,function a(b,c,d,e,f,g,h){if(g===c.length)return f===b.length?1:.99;var i=`${f},${g}`;if(void 0!==h[i])return h[i];for(var j,k,l,m,n=e.charAt(g),o=d.indexOf(n,f),p=0;o>=0;)(j=a(b,c,d,e,o+1,g+1,h))>p&&(o===f?j*=1:au.test(b.charAt(o-1))?(j*=.8,(l=b.slice(f,o-1).match(av))&&f>0&&(j*=Math.pow(.999,l.length))):aw.test(b.charAt(o-1))?(j*=.9,(m=b.slice(f,o-1).match(ax))&&f>0&&(j*=Math.pow(.999,m.length))):(j*=.17,f>0&&(j*=Math.pow(.999,o-f))),b.charAt(o)!==c.charAt(g)&&(j*=.9999)),(j<.1&&d.charAt(o-1)===e.charAt(g+1)||e.charAt(g+1)===e.charAt(g)&&d.charAt(o-1)!==e.charAt(g))&&.1*(k=a(b,c,d,e,o+1,g+2,h))>j&&(j=.1*k),j>p&&(p=j),o=d.indexOf(n,o+1);return h[i]=p,p}(d=c&&c.length>0?`${d+" "+c.join(" ")}`:d,b,ay(d),ay(b),0,0,{})},dd=m.createContext(void 0),de=m.createContext(void 0),df=m.createContext(void 0),dg=m.forwardRef((a,b)=>{let c=dr(()=>{var b,c;return{search:"",value:null!=(c=null!=(b=a.value)?b:a.defaultValue)?c:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),d=dr(()=>new Set),e=dr(()=>new Map),f=dr(()=>new Map),g=dr(()=>new Set),h=dp(a),{label:i,children:j,value:k,onValueChange:l,filter:n,shouldFilter:o,loop:p,disablePointerSelection:q=!1,vimBindings:r=!0,...s}=a,t=aS(),u=aS(),v=aS(),w=m.useRef(null),x=du();dq(()=>{if(void 0!==k){let a=k.trim();c.current.value=a,y.emit()}},[k]),dq(()=>{x(6,E)},[]);let y=m.useMemo(()=>({subscribe:a=>(g.current.add(a),()=>g.current.delete(a)),snapshot:()=>c.current,setState:(a,b,d)=>{var e,f,g,i;if(!Object.is(c.current[a],b)){if(c.current[a]=b,"search"===a)D(),B(),x(1,C);else if("value"===a){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let a=document.getElementById(v);a?a.focus():null==(e=document.getElementById(t))||e.focus()}if(x(7,()=>{var a;c.current.selectedItemId=null==(a=F())?void 0:a.id,y.emit()}),d||x(5,E),(null==(f=h.current)?void 0:f.value)!==void 0){null==(i=(g=h.current).onValueChange)||i.call(g,null!=b?b:"");return}}y.emit()}},emit:()=>{g.current.forEach(a=>a())}}),[]),z=m.useMemo(()=>({value:(a,b,d)=>{var e;b!==(null==(e=f.current.get(a))?void 0:e.value)&&(f.current.set(a,{value:b,keywords:d}),c.current.filtered.items.set(a,A(b,d)),x(2,()=>{B(),y.emit()}))},item:(a,b)=>(d.current.add(a),b&&(e.current.has(b)?e.current.get(b).add(a):e.current.set(b,new Set([a]))),x(3,()=>{D(),B(),c.current.value||C(),y.emit()}),()=>{f.current.delete(a),d.current.delete(a),c.current.filtered.items.delete(a);let b=F();x(4,()=>{D(),(null==b?void 0:b.getAttribute("id"))===a&&C(),y.emit()})}),group:a=>(e.current.has(a)||e.current.set(a,new Set),()=>{f.current.delete(a),e.current.delete(a)}),filter:()=>h.current.shouldFilter,label:i||a["aria-label"],getDisablePointerSelection:()=>h.current.disablePointerSelection,listId:t,inputId:v,labelId:u,listInnerRef:w}),[]);function A(a,b){var d,e;let f=null!=(e=null==(d=h.current)?void 0:d.filter)?e:dc;return a?f(a,c.current.search,b):0}function B(){if(!c.current.search||!1===h.current.shouldFilter)return;let a=c.current.filtered.items,b=[];c.current.filtered.groups.forEach(c=>{let d=e.current.get(c),f=0;d.forEach(b=>{f=Math.max(a.get(b),f)}),b.push([c,f])});let d=w.current;G().sort((b,c)=>{var d,e;let f=b.getAttribute("id"),g=c.getAttribute("id");return(null!=(d=a.get(g))?d:0)-(null!=(e=a.get(f))?e:0)}).forEach(a=>{let b=a.closest(c7);b?b.appendChild(a.parentElement===b?a:a.closest(`${c7} > *`)):d.appendChild(a.parentElement===d?a:a.closest(`${c7} > *`))}),b.sort((a,b)=>b[1]-a[1]).forEach(a=>{var b;let c=null==(b=w.current)?void 0:b.querySelector(`${c6}[${db}="${encodeURIComponent(a[0])}"]`);null==c||c.parentElement.appendChild(c)})}function C(){let a=G().find(a=>"true"!==a.getAttribute("aria-disabled")),b=null==a?void 0:a.getAttribute(db);y.setState("value",b||void 0)}function D(){var a,b,g,i;if(!c.current.search||!1===h.current.shouldFilter){c.current.filtered.count=d.current.size;return}c.current.filtered.groups=new Set;let j=0;for(let e of d.current){let d=A(null!=(b=null==(a=f.current.get(e))?void 0:a.value)?b:"",null!=(i=null==(g=f.current.get(e))?void 0:g.keywords)?i:[]);c.current.filtered.items.set(e,d),d>0&&j++}for(let[a,b]of e.current)for(let d of b)if(c.current.filtered.items.get(d)>0){c.current.filtered.groups.add(a);break}c.current.filtered.count=j}function E(){var a,b,c;let d=F();d&&((null==(a=d.parentElement)?void 0:a.firstChild)===d&&(null==(c=null==(b=d.closest(c6))?void 0:b.querySelector('[cmdk-group-heading=""]'))||c.scrollIntoView({block:"nearest"})),d.scrollIntoView({block:"nearest"}))}function F(){var a;return null==(a=w.current)?void 0:a.querySelector(`${c8}[aria-selected="true"]`)}function G(){var a;return Array.from((null==(a=w.current)?void 0:a.querySelectorAll(c9))||[])}function H(a){let b=G()[a];b&&y.setState("value",b.getAttribute(db))}function I(a){var b;let c=F(),d=G(),e=d.findIndex(a=>a===c),f=d[e+a];null!=(b=h.current)&&b.loop&&(f=e+a<0?d[d.length-1]:e+a===d.length?d[0]:d[e+a]),f&&y.setState("value",f.getAttribute(db))}function J(a){let b=F(),c=null==b?void 0:b.closest(c6),d;for(;c&&!d;)d=null==(c=a>0?function(a,b){let c=a.nextElementSibling;for(;c;){if(c.matches(b))return c;c=c.nextElementSibling}}(c,c6):function(a,b){let c=a.previousElementSibling;for(;c;){if(c.matches(b))return c;c=c.previousElementSibling}}(c,c6))?void 0:c.querySelector(c9);d?y.setState("value",d.getAttribute(db)):I(a)}let K=()=>H(G().length-1),L=a=>{a.preventDefault(),a.metaKey?K():a.altKey?J(1):I(1)},M=a=>{a.preventDefault(),a.metaKey?H(0):a.altKey?J(-1):I(-1)};return m.createElement(bi.div,{ref:b,tabIndex:-1,...s,"cmdk-root":"",onKeyDown:a=>{var b;null==(b=s.onKeyDown)||b.call(s,a);let c=a.nativeEvent.isComposing||229===a.keyCode;if(!(a.defaultPrevented||c))switch(a.key){case"n":case"j":r&&a.ctrlKey&&L(a);break;case"ArrowDown":L(a);break;case"p":case"k":r&&a.ctrlKey&&M(a);break;case"ArrowUp":M(a);break;case"Home":a.preventDefault(),H(0);break;case"End":a.preventDefault(),K();break;case"Enter":{a.preventDefault();let b=F();if(b){let a=new Event(da);b.dispatchEvent(a)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:z.inputId,id:z.labelId,style:dw},i),dv(a,a=>m.createElement(de.Provider,{value:y},m.createElement(dd.Provider,{value:z},a))))}),dh=m.forwardRef((a,b)=>{var c,d;let e=aS(),f=m.useRef(null),g=m.useContext(df),h=m.useContext(dd),i=dp(a),j=null!=(d=null==(c=i.current)?void 0:c.forceMount)?d:null==g?void 0:g.forceMount;dq(()=>{if(!j)return h.item(e,null==g?void 0:g.id)},[j]);let k=dt(e,f,[a.value,a.children,f],a.keywords),l=m.useContext(de),n=ds(a=>a.value&&a.value===k.current),o=ds(a=>!!j||!1===h.filter()||!a.search||a.filtered.items.get(e)>0);function p(){var a,b;q(),null==(b=(a=i.current).onSelect)||b.call(a,k.current)}function q(){l.setState("value",k.current,!0)}if(m.useEffect(()=>{let b=f.current;if(!(!b||a.disabled))return b.addEventListener(da,p),()=>b.removeEventListener(da,p)},[o,a.onSelect,a.disabled]),!o)return null;let{disabled:r,value:s,onSelect:t,forceMount:u,keywords:v,...w}=a;return m.createElement(bi.div,{ref:aI(f,b),...w,id:e,"cmdk-item":"",role:"option","aria-disabled":!!r,"aria-selected":!!n,"data-disabled":!!r,"data-selected":!!n,onPointerMove:r||h.getDisablePointerSelection()?void 0:q,onClick:r?void 0:p},a.children)}),di=m.forwardRef((a,b)=>{let{heading:c,children:d,forceMount:e,...f}=a,g=aS(),h=m.useRef(null),i=m.useRef(null),j=aS(),k=m.useContext(dd),l=ds(a=>!!e||!1===k.filter()||!a.search||a.filtered.groups.has(g));dq(()=>k.group(g),[]),dt(g,h,[a.value,a.heading,i]);let n=m.useMemo(()=>({id:g,forceMount:e}),[e]);return m.createElement(bi.div,{ref:aI(h,b),...f,"cmdk-group":"",role:"presentation",hidden:!l||void 0},c&&m.createElement("div",{ref:i,"cmdk-group-heading":"","aria-hidden":!0,id:j},c),dv(a,a=>m.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":c?j:void 0},m.createElement(df.Provider,{value:n},a))))}),dj=m.forwardRef((a,b)=>{let{alwaysRender:c,...d}=a,e=m.useRef(null),f=ds(a=>!a.search);return c||f?m.createElement(bi.div,{ref:aI(e,b),...d,"cmdk-separator":"",role:"separator"}):null}),dk=m.forwardRef((a,b)=>{let{onValueChange:c,...d}=a,e=null!=a.value,f=m.useContext(de),g=ds(a=>a.search),h=ds(a=>a.selectedItemId),i=m.useContext(dd);return m.useEffect(()=>{null!=a.value&&f.setState("search",a.value)},[a.value]),m.createElement(bi.input,{ref:b,...d,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":i.listId,"aria-labelledby":i.labelId,"aria-activedescendant":h,id:i.inputId,type:"text",value:e?a.value:g,onChange:a=>{e||f.setState("search",a.target.value),null==c||c(a.target.value)}})}),dl=m.forwardRef((a,b)=>{let{children:c,label:d="Suggestions",...e}=a,f=m.useRef(null),g=m.useRef(null),h=ds(a=>a.selectedItemId),i=m.useContext(dd);return m.useEffect(()=>{if(g.current&&f.current){let a=g.current,b=f.current,c,d=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let c=a.offsetHeight;b.style.setProperty("--cmdk-list-height",c.toFixed(1)+"px")})});return d.observe(a),()=>{cancelAnimationFrame(c),d.unobserve(a)}}},[]),m.createElement(bi.div,{ref:aI(f,b),...e,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":h,"aria-label":d,id:i.listId},dv(a,a=>m.createElement("div",{ref:aI(g,i.listInnerRef),"cmdk-list-sizer":""},a)))}),dm=m.forwardRef((a,b)=>{let{open:c,onOpenChange:d,overlayClassName:e,contentClassName:f,container:g,...h}=a;return m.createElement(cT,{open:c,onOpenChange:d},m.createElement(cX,{container:g},m.createElement(cZ,{"cmdk-overlay":"",className:e}),m.createElement(c1,{"aria-label":a.label,"cmdk-dialog":"",className:f},m.createElement(dg,{ref:b,...h}))))}),dn=Object.assign(dg,{List:dl,Item:dh,Input:dk,Group:di,Separator:dj,Dialog:dm,Empty:m.forwardRef((a,b)=>ds(a=>0===a.filtered.count)?m.createElement(bi.div,{ref:b,...a,"cmdk-empty":"",role:"presentation"}):null),Loading:m.forwardRef((a,b)=>{let{progress:c,children:d,label:e="Loading...",...f}=a;return m.createElement(bi.div,{ref:b,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":c,"aria-valuemin":0,"aria-valuemax":100,"aria-label":e},dv(a,a=>m.createElement("div",{"aria-hidden":!0},a)))})});function dp(a){let b=m.useRef(a);return dq(()=>{b.current=a}),b}var dq=m.useEffect;function dr(a){let b=m.useRef();return void 0===b.current&&(b.current=a()),b}function ds(a){let b=m.useContext(de),c=()=>a(b.snapshot());return m.useSyncExternalStore(b.subscribe,c,c)}function dt(a,b,c,d=[]){let e=m.useRef(),f=m.useContext(dd);return dq(()=>{var g;let h=(()=>{var a;for(let b of c){if("string"==typeof b)return b.trim();if("object"==typeof b&&"current"in b)return b.current?null==(a=b.current.textContent)?void 0:a.trim():e.current}})(),i=d.map(a=>a.trim());f.value(a,h,i),null==(g=b.current)||g.setAttribute(db,h),e.current=h}),e}var du=()=>{let[a,b]=m.useState(),c=dr(()=>new Map);return dq(()=>{c.current.forEach(a=>a()),c.current=new Map},[a]),(a,d)=>{c.current.set(a,d),b({})}};function dv({asChild:a,children:b},c){let d;return a&&m.isValidElement(b)?m.cloneElement("function"==typeof(d=b.type)?d(b.props):"render"in d?d.render(b.props):b,{ref:b.ref},c(b.props.children)):c(b)}var dw={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},dx=c(5326),dy=c(49665),dz=c(36908);function dA({className:a,...b}){return(0,l.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,E.cn)("group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",a),...b})}let dB=(0,dy.F)("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function dC({className:a,align:b="inline-start",...c}){return(0,l.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":b,className:(0,E.cn)(dB({align:b}),a),onClick:a=>{a.target.closest("button")||a.currentTarget.parentElement?.querySelector("input")?.focus()},...c})}(0,dy.F)("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});var dD=c(98785);function dE({className:a,...b}){return(0,l.jsx)(dn,{"data-slot":"command",className:(0,E.cn)("flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",a),...b})}function dF({className:a,...b}){return(0,l.jsx)("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:(0,l.jsxs)(dA,{className:"h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!",children:[(0,l.jsx)(dn.Input,{"data-slot":"command-input",className:(0,E.cn)("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",a),...b}),(0,l.jsx)(dC,{children:(0,l.jsx)(dD.A,{className:"size-4 shrink-0 opacity-50"})})]})})}function dG({className:a,...b}){return(0,l.jsx)(dn.List,{"data-slot":"command-list",className:(0,E.cn)("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",a),...b})}function dH({className:a,...b}){return(0,l.jsx)(dn.Empty,{"data-slot":"command-empty",className:(0,E.cn)("py-6 text-center text-sm",a),...b})}function dI({className:a,...b}){return(0,l.jsx)(dn.Group,{"data-slot":"command-group",className:(0,E.cn)("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",a),...b})}function dJ({className:a,children:b,...c}){return(0,l.jsxs)(dn.Item,{"data-slot":"command-item",className:(0,E.cn)("group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground",a),...c,children:[b,(0,l.jsx)(as.A,{className:"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"})]})}function dK({value:a,onValueChange:b,items:c,groups:d,customModels:e,isOther:f,onOtherChange:g,placeholder:h="Select model..."}){let[i,j]=(0,m.useState)(!1),k=(0,m.useMemo)(()=>c||(d?Object.values(d).flat():[]),[c,d]),n=(0,m.useMemo)(()=>e?.map(a=>({id:`custom:${a.modelName}`,label:a.modelName,provider:"custom",dimensions:a.dimensions}))||[],[e]),o=[...k,...n],p=f?{id:"other",label:"Other..."}:o.find(b=>b.id===a),q=f?"Other...":p?.label||a||h;return(0,l.jsxs)(at.AM,{open:i,onOpenChange:j,children:[(0,l.jsxs)(at.Wv,{render:(0,l.jsx)(O.$,{variant:"outline",role:"combobox",className:"w-full h-10 justify-between font-normal bg-background"}),children:[(0,l.jsx)("span",{className:"truncate",children:q}),(0,l.jsx)(ar.A,{className:"ml-2 size-4 shrink-0 opacity-50"})]}),(0,l.jsx)(at.hl,{className:"w-(--anchor-width) p-0",align:"start",children:(0,l.jsxs)(dE,{children:[(0,l.jsx)(dF,{placeholder:"Search models..."}),(0,l.jsxs)(dG,{children:[(0,l.jsx)(dH,{children:"No model found."}),d&&Object.entries(d).map(([c,d])=>{let e=ao.Qd[c];return(0,l.jsx)(dI,{heading:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[e&&(0,l.jsx)(ao.rb,{src:e.iconSrc,alt:e.label,pillBg:e.pillBg,size:14}),(0,l.jsx)("span",{children:e?.label??c})]}),children:d.map(c=>(0,l.jsxs)(dJ,{value:c.id,keywords:[c.label],onSelect:()=>{b(c.id),g?.(!1),j(!1)},children:[(0,l.jsx)("span",{className:"flex-1 truncate",children:c.label}),c.dimensions&&(0,l.jsxs)("span",{className:"text-[10px] text-muted-foreground font-mono ml-2",children:[c.dimensions,"d"]}),(0,l.jsx)(as.A,{className:(0,E.cn)("ml-auto size-4",a!==c.id||f?"opacity-0":"opacity-100")})]},c.id))},c)}),c&&(0,l.jsx)(dI,{children:c.map(c=>{let d=c.provider?ao.Qd[c.provider]:null;return(0,l.jsxs)(dJ,{value:c.id,keywords:[c.label],onSelect:()=>{b(c.id),g?.(!1),j(!1)},children:[d&&(0,l.jsx)(ao.rb,{src:d.iconSrc,alt:d.label,pillBg:d.pillBg,size:14}),(0,l.jsx)("span",{className:"flex-1 truncate",children:c.label}),c.dimensions&&(0,l.jsxs)("span",{className:"text-[10px] text-muted-foreground font-mono ml-2",children:[c.dimensions,"d"]}),(0,l.jsx)(as.A,{className:(0,E.cn)("ml-auto size-4",a!==c.id||f?"opacity-0":"opacity-100")})]},c.id)})}),n.length>0&&(0,l.jsx)(dI,{heading:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(ao.rb,{src:ao.Qd.custom.iconSrc,alt:"Custom",pillBg:ao.Qd.custom.pillBg,size:14}),(0,l.jsx)("span",{children:"Custom"})]}),children:n.map(c=>(0,l.jsxs)(dJ,{value:c.id,keywords:[c.label],onSelect:()=>{b(c.id),g?.(!1),j(!1)},children:[(0,l.jsx)("span",{className:"flex-1 truncate",children:c.label}),c.dimensions&&(0,l.jsxs)("span",{className:"text-[10px] text-muted-foreground font-mono ml-2",children:[c.dimensions,"d"]}),(0,l.jsx)(as.A,{className:(0,E.cn)("ml-auto size-4",a!==c.id||f?"opacity-0":"opacity-100")})]},c.id))}),g&&(0,l.jsx)(dI,{children:(0,l.jsxs)(dJ,{value:"other",onSelect:()=>{g(!0),j(!1)},children:["Other...",(0,l.jsx)(as.A,{className:(0,E.cn)("ml-auto size-4",f?"opacity-100":"opacity-0")})]})})]})]})})]})}var dL=c(52180);let dM=a=>fetch(a).then(a=>a.json()),dN=["vercel_ai_gateway","openai","google","deepseek","mistral","cohere"],dO=["vercel_ai_gateway","openai","anthropic","google","deepseek","mistral","cohere"],dP=new Set(["vercel_ai_gateway","openai","anthropic","google","mistral","cohere","deepseek"]);function dQ(){let a,b,c,d,{activeProject:e}=(0,an.B)(),f=e?.id,g=f?`/api/config?serverId=${encodeURIComponent(f)}`:"/api/config",{data:h,isLoading:i,mutate:j}=(0,H.u)(g,dM),{data:k}=(0,H.u)("/api/marketplace",a=>fetch(a).then(a=>a.json())),[n,o]=(0,m.useState)({}),[p,q]=(0,m.useState)(null),[r,s]=(0,m.useState)(!1),[t,u]=(0,m.useState)(!1),[v,w]=(0,m.useState)(!1),[x,y]=(0,m.useState)({}),z=n.chatProvider||n.embeddingProvider||"openai",A=f?`/api/chat/status?serverId=${encodeURIComponent(f)}&provider=${z}`:`/api/chat/status?provider=${z}`,{data:B}=(0,H.u)(A,a=>fetch(a).then(a=>a.json())),C=B?.availableEmbeddingModels??[],D=B?.availableVisionModels??[],F=(0,m.useMemo)(()=>[...new Set(D.flatMap(a=>a.availableFrom??[a.provider]))].filter(a=>dP.has(a)&&ao.Qd[a]),[D]),G=(0,m.useMemo)(()=>C.reduce((a,b)=>((a[b.provider]??=[]).push(b),a),{}),[C]),{data:I}=(0,H.u)("/api/index",a=>fetch(a).then(a=>a.json())),J=I?.run?.status==="completed"?I.run:null,[K,L]=(0,m.useState)(!1),[U,V]=(0,m.useState)({}),[W,X]=(0,m.useState)(!1),[Y,Z]=(0,m.useState)(!1),[$,_]=(0,m.useState)(!1),[aa,ab]=(0,m.useState)(!1),[ac,ad]=(0,m.useState)(!1),[ae,af]=(0,m.useState)(!1),ak=n.embeddingProvider!==h?.config?.embeddingProvider||n.embeddingModelId!==h?.config?.embeddingModelId||n.embeddingApiKey!==h?.config?.embeddingApiKey||JSON.stringify(n.customEmbeddings)!==JSON.stringify(h?.config?.customEmbeddings),ar=n.chatProvider!==(h?.config?.chatProvider||h?.config?.embeddingProvider)||n.chatModelId!==h?.config?.chatModelId||n.chatApiKey!==(h?.config?.chatApiKey||h?.config?.embeddingApiKey)||JSON.stringify(n.customChatModels)!==JSON.stringify(h?.config?.customChatModels),as=h?.config?.visionProvider||h?.config?.chatProvider||h?.config?.embeddingProvider,at=h?.config?.visionApiKey||h?.config?.chatApiKey||h?.config?.embeddingApiKey,au=n.visionProvider!==as||n.visionModelId!==(h?.config?.visionModelId||"")||n.visionApiKey!==at||JSON.stringify(n.customVisionModels)!==JSON.stringify(h?.config?.customVisionModels),av=a=>{U[a]&&V(b=>{let c={...b};return delete c[a],c})};function aw(a,b){if(!J)return!0;let c=b??function(a){if(a)return C.find(b=>b.id===a)?.dimensions??n.customEmbeddings?.find(b=>`custom:${b.modelName}`===a)?.dimensions??dL.yN[a]?.dimensions}(a);return c===J.dimensions||(S.oR.error("This embedding model is not compatible with the current index",{description:void 0===c?`The current index uses ${J.dimensions} dimensions. Choose a model with the same dimension or create a new project.`:`The current index uses ${J.dimensions} dimensions, but this model uses ${c}. Create a new project to use it.`,duration:1/0,action:{label:"New Project",onClick:()=>L(!0)}}),!1)}async function ax(a){if(!h?.config)return;let b=!1,c={};if("embedding"===a)if(n.embeddingProvider||(c.embeddingProvider="Required",b=!0),n.embeddingApiKey||(c.embeddingApiKey="Required",b=!0),n.embeddingModelId){if(!aw(n.embeddingModelId))return}else c.embeddingModelId="Required",b=!0;else if("chat"===a)n.chatProvider||(c.chatProvider="Required",b=!0),n.chatApiKey||(c.chatApiKey="Required",b=!0);else if("vision"===a)n.visionProvider||(c.visionProvider="Required",b=!0),n.visionApiKey||(c.visionApiKey="Required",b=!0);else if(a.startsWith("tool:")){let b=a.split(":")[1],c=k?.tools?.find(a=>a.id===b);if(c?.configSchema)for(let a of c.configSchema)n.toolConfigs?.[b]?.[a.key]||"password"===a.type||a.type}if(V(c),b)return void S.oR.error("Please fill in all required fields",{duration:1/0});q(a);try{let b={...h.config};"embedding"===a?(void 0!==n.embeddingProvider&&(b.embeddingProvider=n.embeddingProvider),void 0!==n.embeddingModelId&&(b.embeddingModelId=n.embeddingModelId),void 0!==n.embeddingApiKey&&(b.embeddingApiKey=n.embeddingApiKey),void 0!==n.customEmbeddings&&(b.customEmbeddings=n.customEmbeddings)):"chat"===a?(void 0!==n.chatProvider&&(b.chatProvider=n.chatProvider),void 0!==n.chatModelId&&(b.chatModelId=n.chatModelId),void 0!==n.chatApiKey&&(b.chatApiKey=n.chatApiKey),void 0!==n.customChatModels&&(b.customChatModels=n.customChatModels)):"vision"===a?(void 0!==n.visionProvider&&(b.visionProvider=n.visionProvider),void 0!==n.visionModelId&&(b.visionModelId=n.visionModelId),void 0!==n.visionApiKey&&(b.visionApiKey=n.visionApiKey),void 0!==n.customVisionModels&&(b.customVisionModels=n.customVisionModels)):a.startsWith("tool:")&&(b.toolConfigs=n.toolConfigs);let c={};if("embedding"===a?(c.embeddingProvider=b.embeddingProvider,c.embeddingApiKey=b.embeddingApiKey,c.embeddingModelId=b.embeddingModelId,c.customEmbeddings=b.customEmbeddings):"chat"===a?(c.chatProvider=b.chatProvider,c.chatApiKey=b.chatApiKey,c.chatModelId=b.chatModelId,c.customChatModels=b.customChatModels):"vision"===a||a.startsWith("tool:"),"vision"!==a&&!a.startsWith("tool:")){let a=await fetch("/api/config/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!a.ok){let b=await a.json();throw Error(b.error||"Verification failed")}}let d=await fetch(g,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),e=await d.json();if(!d.ok)throw Error(e.error??"Failed to save");o(a=>({...a,...e.config})),await j(e,{revalidate:!1}),S.oR.success("AI model settings saved",{duration:1/0})}catch(a){S.oR.error(a instanceof Error?a.message:"Failed to save",{duration:1/0})}finally{q(null)}}return i?(0,l.jsx)("div",{className:"flex h-40 items-center justify-center",children:(0,l.jsx)(M.A,{className:"size-5 animate-spin text-muted-foreground"})}):(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsx)("div",{className:"flex items-center justify-between",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-lg font-semibold tracking-tight",children:"AI Models"}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:"Configure the AI models that power your knowledge base."})]})}),(0,l.jsx)(ap.S,{mode:"create",open:K,onOpenChange:L}),(0,l.jsx)(aq.q,{type:"embedding",open:W,onOpenChange:X,onSave:a=>{let b=`custom:${a.modelName}`;aw(b,a.dimensions)&&(o({...n,embeddingProvider:"custom",embeddingModelId:b,customEmbeddings:[a]}),av("embeddingProvider"))}}),(0,l.jsx)(aq.q,{type:"chat",open:Y,onOpenChange:Z,onSave:a=>{o({...n,chatProvider:"custom",chatModelId:`custom:${a.modelName}`,customChatModels:[a]}),av("chatProvider")}}),(0,l.jsx)(aq.q,{type:"vision",open:$,onOpenChange:_,onSave:a=>{o({...n,visionProvider:"custom",visionModelId:`custom:${a.modelName}`,customVisionModels:[a]}),av("visionProvider")}}),(0,l.jsxs)(T.Zp,{children:[(0,l.jsxs)(T.aR,{className:"pb-3",children:[(0,l.jsxs)(T.ZB,{className:"flex items-center gap-2 text-sm",children:[(0,l.jsx)(ag.A,{className:"size-3.5 text-primary"}),"Embedding Model"]}),(0,l.jsx)(T.BT,{className:"text-xs",children:"Transforms your documents into searchable representations."})]}),(0,l.jsxs)(T.Wu,{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Provider"}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsxs)(R.l6,{value:n.embeddingProvider??"openai",onValueChange:a=>{o({...n,embeddingProvider:a,embeddingModelId:""}),av("embeddingProvider")},children:[(0,l.jsx)(R.bq,{className:(0,E.cn)("w-full",U.embeddingProvider&&"border-destructive"),children:(0,l.jsx)("span",{className:"flex items-center gap-2",children:ao.Qd[n.embeddingProvider??"openai"]?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ao.rb,{src:ao.Qd[n.embeddingProvider]?.iconSrc??"",alt:ao.Qd[n.embeddingProvider]?.label??"",pillBg:ao.Qd[n.embeddingProvider]?.pillBg??void 0,size:16}),ao.Qd[n.embeddingProvider]?.label??n.embeddingProvider]}):n.embeddingProvider||"Select provider"})}),(0,l.jsxs)(R.gC,{children:[dN.filter(a=>G[a]&&G[a].length>0||"vercel_ai_gateway"===a).map(a=>{let b=ao.Qd[a];return b?(0,l.jsx)(R.eb,{value:a,children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(ao.rb,{src:b.iconSrc,alt:b.label,pillBg:b.pillBg??void 0,size:16}),(0,l.jsxs)("span",{children:[b.label,"vercel_ai_gateway"===a&&" (Recommended)"]})]})},a):null}),n.customEmbeddings?.map(a=>(0,l.jsx)(R.eb,{value:"custom",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(ao.rb,{src:ao.Qd.custom.iconSrc,alt:"Custom",pillBg:ao.Qd.custom.pillBg,size:16}),(0,l.jsxs)("span",{children:[a.modelName," (Custom)"]})]})},`custom:${a.modelName}`))]})]}),(0,l.jsx)(O.$,{variant:"outline",size:"icon",type:"button",onClick:()=>{X(!0)},className:"shrink-0 size-10 bg-background",children:(0,l.jsx)(ah.A,{className:"size-4"})})]})]}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Model"}),(0,l.jsx)(dK,{value:n.embeddingModelId||"",onValueChange:a=>{aw(a)&&(o({...n,embeddingModelId:a}),av("embeddingModelId"))},groups:Object.fromEntries(Object.entries(G).filter(([a])=>"vercel_ai_gateway"===n.embeddingProvider||a===n.embeddingProvider||"deepseek"===a)),customModels:n.customEmbeddings,isOther:aa,onOtherChange:a=>ab(a),placeholder:"Default"}),aa&&(0,l.jsx)(P.p,{placeholder:"Enter custom model ID",value:n.embeddingModelId||"",onChange:a=>o({...n,embeddingModelId:a.target.value}),className:"mt-2"})]}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"API Key"}),(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)(P.p,{type:r?"text":"password",value:n.embeddingApiKey||"",onChange:a=>{o({...n,embeddingApiKey:a.target.value}),av("embeddingApiKey")},placeholder:"sk-...",className:(0,E.cn)("pr-10",U.embeddingApiKey&&"border-destructive")}),(0,l.jsx)("button",{type:"button",onClick:()=>s(!r),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground",children:r?(0,l.jsx)(ai.A,{className:"size-4"}):(0,l.jsx)(aj.A,{className:"size-4"})})]})]})]}),(0,l.jsx)(T.wL,{className:"flex justify-end pt-4 border-t",children:(0,l.jsxs)(O.$,{size:"lg",disabled:"embedding"===p||!ak,onClick:()=>ax("embedding"),className:"gap-1.5 px-4",children:["embedding"===p?(0,l.jsx)(M.A,{className:"size-3.5 animate-spin"}):(0,l.jsx)(N.A,{className:"size-3.5"}),"Save"]})})]}),(0,l.jsxs)(T.Zp,{children:[(0,l.jsxs)(T.aR,{className:"pb-3",children:[(0,l.jsxs)(T.ZB,{className:"flex items-center gap-2 text-sm",children:[(0,l.jsx)(al,{className:"size-3.5 text-primary"}),"Vision Model"]}),(0,l.jsx)(T.BT,{className:"text-xs",children:"Used by video, image, OCR, and future tools that need to understand pixels. Only providers with vision-capable models are shown."})]}),(0,l.jsxs)(T.Wu,{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Provider"}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsxs)(R.l6,{value:n.visionProvider||"",onValueChange:a=>{a&&(o({...n,visionProvider:a,visionModelId:""}),av("visionProvider"))},children:[(0,l.jsx)(R.bq,{className:(0,E.cn)("w-full",U.visionProvider&&"border-destructive"),children:(0,l.jsx)("span",{className:"flex items-center gap-2",children:(a=n.visionProvider||"",(b=ao.Qd[a])?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ao.rb,{src:b.iconSrc,alt:b.label,pillBg:b.pillBg,size:16}),b.label]}):a||"Select a vision provider")})}),(0,l.jsxs)(R.gC,{children:[F.map(a=>{let b=ao.Qd[a];return b?(0,l.jsx)(R.eb,{value:a,children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(ao.rb,{src:b.iconSrc,alt:b.label,pillBg:b.pillBg,size:16}),(0,l.jsx)("span",{children:b.label})]})},a):null}),n.customVisionModels?.map(a=>(0,l.jsx)(R.eb,{value:"custom",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(ao.rb,{src:ao.Qd.custom.iconSrc,alt:"Custom",pillBg:ao.Qd.custom.pillBg,size:16}),(0,l.jsxs)("span",{children:[a.modelName," (Custom)"]})]})},`custom:${a.modelName}`))]})]}),(0,l.jsx)(O.$,{variant:"outline",size:"icon",type:"button",onClick:()=>{_(!0)},className:"shrink-0 size-10 bg-background",children:(0,l.jsx)(ah.A,{className:"size-4"})})]}),F.includes(n.visionProvider||"")?null:(0,l.jsx)("p",{className:"text-[11px] text-amber-700 dark:text-amber-400",children:"This provider has no compatible vision model. Choose a provider from the list for video and image tasks."})]}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Model"}),(0,l.jsx)(dK,{value:n.visionModelId||"default",onValueChange:a=>{o({...n,visionModelId:"default"===a?"":a})},items:[{id:"default",label:"Default vision model"},...D.filter(a=>(a.availableFrom??[a.provider]).includes(n.visionProvider||""))],customModels:n.customVisionModels,isOther:ae,onOtherChange:a=>af(a),placeholder:"Default vision model"}),ae&&(0,l.jsx)(P.p,{placeholder:"Enter custom model ID",value:n.visionModelId||"",onChange:a=>o({...n,visionModelId:a.target.value}),className:"mt-2"})]}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"API Key"}),(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)(P.p,{type:v?"text":"password",value:n.visionApiKey||"",onChange:a=>{o({...n,visionApiKey:a.target.value}),av("visionApiKey")},placeholder:"sk-...",className:(0,E.cn)("pr-10",U.visionApiKey&&"border-destructive")}),(0,l.jsx)("button",{type:"button",onClick:()=>w(!v),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground",children:v?(0,l.jsx)(ai.A,{className:"size-4"}):(0,l.jsx)(aj.A,{className:"size-4"})})]})]})]}),(0,l.jsx)(T.wL,{className:"flex justify-end border-t pt-4",children:(0,l.jsxs)(O.$,{size:"lg",disabled:"vision"===p||!au,onClick:()=>ax("vision"),className:"gap-1.5 px-4",children:["vision"===p?(0,l.jsx)(M.A,{className:"size-3.5 animate-spin"}):(0,l.jsx)(N.A,{className:"size-3.5"}),"Save"]})})]}),(0,l.jsxs)(T.Zp,{children:[(0,l.jsxs)(T.aR,{className:"pb-3",children:[(0,l.jsxs)(T.ZB,{className:"flex items-center gap-2 text-sm",children:[(0,l.jsx)(am.A,{className:"size-3.5 text-primary"}),"Chat Model"]}),(0,l.jsx)(T.BT,{className:"text-xs",children:"Powers the AI assistant that answers questions from your knowledge base. Leave blank to use the same provider as embedding."})]}),(0,l.jsxs)(T.Wu,{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Provider"}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsxs)(R.l6,{value:n.chatProvider||n.embeddingProvider||"openai",onValueChange:a=>{o({...n,chatProvider:a,chatModelId:""}),av("chatProvider")},children:[(0,l.jsx)(R.bq,{className:(0,E.cn)("w-full",U.chatProvider&&"border-destructive"),children:(0,l.jsx)("span",{className:"flex items-center gap-2",children:(c=n.chatProvider||n.embeddingProvider||"openai",(d=ao.Qd[c])?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ao.rb,{src:d.iconSrc,alt:d.label,pillBg:d.pillBg??void 0,size:16}),d.label]}):c)})}),(0,l.jsxs)(R.gC,{children:[dO.map(a=>{let b=ao.Qd[a];return b?(0,l.jsx)(R.eb,{value:a,children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(ao.rb,{src:b.iconSrc,alt:b.label,pillBg:b.pillBg,size:16}),(0,l.jsx)("span",{children:b.label})]})},a):null}),n.customChatModels?.map(a=>(0,l.jsx)(R.eb,{value:"custom",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(ao.rb,{src:ao.Qd.custom.iconSrc,alt:"Custom",pillBg:ao.Qd.custom.pillBg,size:16}),(0,l.jsxs)("span",{children:[a.modelName," (Custom)"]})]})},`custom:${a.modelName}`))]})]}),(0,l.jsx)(O.$,{variant:"outline",size:"icon",type:"button",onClick:()=>Z(!0),className:"shrink-0 h-9 w-9",children:(0,l.jsx)(ah.A,{className:"size-4"})})]})]}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Model"}),(0,l.jsx)(dK,{value:n.chatModelId||"",onValueChange:a=>{o({...n,chatModelId:a})},items:B?.availableModels||[],customModels:n.customChatModels,isOther:ac,onOtherChange:ad,placeholder:"Default"}),ac&&(0,l.jsx)(P.p,{placeholder:"Enter custom model ID",value:n.chatModelId||"",onChange:a=>o({...n,chatModelId:a.target.value}),className:"mt-2"})]}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"API Key"}),(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)(P.p,{type:t?"text":"password",value:n.chatApiKey||"",onChange:a=>{o({...n,chatApiKey:a.target.value}),av("chatApiKey")},placeholder:"sk-...",className:(0,E.cn)("pr-10",U.chatApiKey&&"border-destructive")}),(0,l.jsx)("button",{type:"button",onClick:()=>u(!t),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground",children:t?(0,l.jsx)(ai.A,{className:"size-4"}):(0,l.jsx)(aj.A,{className:"size-4"})})]})]})]}),(0,l.jsx)(T.wL,{className:"flex justify-end pt-4 border-t",children:(0,l.jsxs)(O.$,{size:"lg",disabled:"chat"===p||!ar,onClick:()=>ax("chat"),className:"gap-1.5 px-4",children:["chat"===p?(0,l.jsx)(M.A,{className:"size-3.5 animate-spin"}):(0,l.jsx)(N.A,{className:"size-3.5"}),"Save"]})})]})]})}var dR=c(60036),dS=c.n(dR);let dT={name:"circle-dot",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]};dT.node;let dU=(0,q.A)(dT);var dV=c(43609),dW=c(39490),dX=c(17122);let dY={name:"server",size:24,node:[["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"}]]};dY.node;let dZ=(0,q.A)(dY);var d$=c(50136),d_=c(29936),d0=c(49073),d1=c(16784),d2=c(19847);let d3={name:"rocket",size:24,node:[["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"}]]};d3.node;let d4=(0,q.A)(d3);var d5=c(82554),d6=c(57505),d7=c(72346),d8=c(94082);function d9({tabs:a,activeTab:b,onTabChange:c,rightElement:d,className:e}){return(0,l.jsxs)("div",{className:(0,E.cn)("flex items-center justify-between border-b border-border",e),children:[(0,l.jsx)("div",{className:"-mb-px flex items-center gap-1",children:a.map(a=>{let d=b===a.id,e=a.icon;return(0,l.jsxs)("button",{onClick:()=>c(a.id),className:(0,E.cn)("relative flex items-center gap-2 px-4 py-2.5 text-sm font-medium transition-colors outline-none",d?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[e&&(0,l.jsx)(e,{className:"size-4"}),a.label,d&&(0,l.jsx)("span",{"aria-hidden":"true",className:"absolute bottom-0 left-0 right-0 h-0.5 rounded-full bg-primary motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-left-2 motion-safe:duration-200"})]},a.id)})}),d&&(0,l.jsx)("div",{className:"flex items-center gap-2",children:d})]})}var ea=c(41203),eb=c(52592);let ec={name:"test-tube-diagonal",size:24,node:[["path",{d:"M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3",key:"1ub6xw"}],["path",{d:"m16 2 6 6",key:"1gw87d"}],["path",{d:"M12 16H4",key:"1cjfip"}]],aliases:["test-tube-2"]};ec.node;let ed=(0,q.A)(ec),ee={name:"send",size:24,node:[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]};ee.node;let ef=(0,q.A)(ee);var eg=c(84508),eh=c(42489),ei=c(85469),ej=c(58232),ek=c(97256),el=c(53678),em=c(62309),en=c(98347),eo=c(70647);let ep=m.createContext(void 0);function eq(){let a=m.useContext(ep);if(void 0===a)throw Error((0,eo.A)(64));return a}let er={tabActivationDirection:a=>({"data-activation-direction":a})};var es=c(48544),et=c(26674);let eu=m.forwardRef(function(a,b){let{className:c,defaultValue:d=0,onValueChange:e,orientation:f="horizontal",render:g,value:h,style:i,...j}=a,k=void 0!==a.defaultValue,n=m.useRef([]),[o,p]=m.useState(()=>new Map),[q,r]=(0,ej.q)({controlled:h,default:d,name:"Tabs",state:"value"}),s=void 0!==h,[t,u]=m.useState(()=>new Map),v=m.useRef(void 0),w=m.useCallback(a=>ev(t,a),[t]),[x,y]=m.useState(()=>({previousValue:q,tabActivationDirection:"none"})),{previousValue:z,tabActivationDirection:A}=x,B=A,C=!1;z!==q&&(B=ew(z,q,f,t),C=null!=z&&null!=q&&null==w(q));let D=C?z:q,E=z!==D||A!==B;(0,ek.g)(()=>{E&&y({previousValue:D,tabActivationDirection:B})},[D,E,B]);let F=(0,el.K)((a,b)=>{b.activationDirection=ew(q,a,f,t),e?.(a,b),b.isCanceled||r(()=>a)}),G=(0,el.K)((a,b)=>{e?.(a,(0,es.d)(b,void 0,void 0,{activationDirection:"none"}))}),H=(0,el.K)((a,b)=>(p(c=>{let d=new Map(c);return d.set(a,b),d}),()=>{p(c=>{if(c.get(a)!==b)return c;let d=new Map(c);return d.delete(a),d})})),I=m.useCallback(a=>o.get(a),[o]),J=m.useCallback(a=>{for(let b of t.values())if(a===b.value)return b.id},[t]),K=m.useMemo(()=>({getTabElementBySelectedValue:w,getTabIdByPanelValue:J,getTabPanelIdByValue:I,onValueChange:F,orientation:f,registerMountedTabPanel:H,setTabMap:u,tabActivationDirection:B,value:q}),[w,J,I,F,f,H,u,B,q]),L=m.useMemo(()=>{for(let a of t.values())if(a.value===q)return a},[t,q]),M=m.useMemo(()=>{for(let a of t.values())if(!a.disabled)return a.value},[t]),N=m.useRef(!k),O=m.useRef(d),P=m.useRef(k),Q=m.useRef(!1);(0,ek.g)(()=>{if(s)return;function a(a,b){r(()=>a),y({previousValue:a,tabActivationDirection:"none"}),G(a,b),N.current=!1}if(0===t.size){Q.current&&null!==q&&!v.current?.isConnected&&a(null,et.c);return}Q.current=!0,v.current=t.keys().next().value;let b=L?.disabled,c=null==L&&null!==q;if(b||q!==O.current||(P.current=!1),P.current&&b&&q===O.current)return;let d=N.current;if(b||c){let c=M??null;if(q===c){N.current=!1;return}let e=et.c;d?e=et.Vh:b&&(e=et.r9),a(c,e);return}d&&null!=L&&(G(q,et.Vh),N.current=!1)},[M,s,G,L,r,t,q]);let R={orientation:f,tabActivationDirection:B},S=(0,em.o)("div",a,{state:R,ref:b,props:j,stateAttributesMapping:er});return(0,l.jsx)(ep.Provider,{value:K,children:(0,l.jsx)(en.u,{elementsRef:n,children:S})})});function ev(a,b){for(let[c,d]of a.entries())if(b===d.value)return c;return null}function ew(a,b,c,d){if(null==a||null==b)return"none";let[e,f,g]="horizontal"===c?["left","left","right"]:["top","up","down"],h=ev(d,a),i=ev(d,b);if(null==h||null==i)return h!==i&&("number"==typeof a||"string"==typeof a)&&typeof a==typeof b?b>a?g:f:"none";let j=h.getBoundingClientRect()[e],k=i.getBoundingClientRect()[e];return k<j?f:k>j?g:"none"}var ex=c(77088),ey=c(13819),ez=c(23952),eA=c(26152),eB=c(65975);let eC="data-composite-item-active";var eD=c(68675),eE=c(92616),eF=c(75223);function eG(a){let{render:b,className:c,style:d,refs:e=ex.Ml,props:f=ex.Ml,state:g=ex.t0,stateAttributesMapping:h,highlightedIndex:i,onHighlightedIndexChange:j,orientation:k,grid:n,loopFocus:o,onLoop:p,enableHomeAndEndKeys:q,onMapChange:r,stopEventPropagation:s=!0,rootRef:t,disabledIndices:u,modifierKeys:v,highlightItemOnHover:w=!1,tag:x="div",...y}=a,{props:z,highlightedIndex:A,onHighlightedIndexChange:B,elementsRef:C,onMapChange:D,relayKeyboardEvent:E}=function(a){let{loopFocus:b=!0,orientation:c="both",grid:d,onLoop:e,direction:f,highlightedIndex:g,onHighlightedIndexChange:h,rootRef:i,enableHomeAndEndKeys:j=!1,stopEventPropagation:k,disabledIndices:l,modifierKeys:n=ex.Ml}=a,[o,p]=m.useState(0),q=null!=d,r=m.useRef(null),s=(0,ez.a)(r,i),t=m.useRef([]),u=m.useRef(!1),v=m.useRef(null),w=g??o,x=(0,el.K)((a,b=!1)=>{if(v.current=t.current[a]??null,(h??p)(a),b){let b=t.current[a];(0,eA.$v)(r.current,b,f,c)}}),y=(0,el.K)(a=>{if(0===a.size)return;if(u.current){let a=t.current,b=a.indexOf(v.current);if(-1===b){let b=a[w];!b||(0,eB.FP)(a,w,l)?x(function(a,b){let c=-1;for(let d=0;d<a.length;d+=1){let e=a[d];if(!(!e||(0,eB.FP)(a,d,b))){if(e.hasAttribute(eC))return d;-1===c&&(c=d)}}return Math.max(c,0)}(a,l)):v.current=b}else b!==w&&x(b);return}u.current=!0;let b=Array.from(a.keys()),d=b.find(a=>a?.hasAttribute(eC))??null,e=d?a.get(d)?.index??-1:-1;if(-1!==e)x(e);else if((0,eB.FP)(b,w,l)){let a=(0,eB.BF)(b,{disabledIndices:l});(0,eB.du)(b,a)||x(a)}(0,eA.$v)(r.current,d,f,c)});(0,ek.g)(()=>{if(null==l||null!=g||!u.current)return;let a=t.current;if((0,eB.FP)(a,w,l)){let b=(0,eB.BF)(a,{disabledIndices:l});(0,eB.du)(a,b)||x(b)}},[l,g,w,t,x]);let z=(0,el.K)((a,b,c)=>e?e(a,b,c,t):c),A=(0,el.K)(a=>{let g=a.key===eA.yZ||a.key===eA.Kp;if(!eA.jF.has(a.key)||!j&&g||function(a,b){for(let c of eA.rT)if(!b.includes(c)&&a.getModifierState(c))return!0;return!1}(a,n)||!r.current)return;let h="rtl"===f,i=h?eA.eR:eA.RJ,m=h?eA.RJ:eA.eR,o="vertical"===c?eA.Jd:i,p="vertical"===c?eA.il:m,s=(0,eD.EW)(a.nativeEvent);if(null!=s&&(0,eA.Qi)(s)&&!(0,ey.F)(s)){let b=s.selectionStart,c=s.selectionEnd,d=s.value;if(null==b||a.shiftKey||b!==c||a.key!==p&&b<d.length||a.key!==o&&b>0)return}let u=w,v=(0,eB.Zb)(t,l),y=(0,eB.vB)(t,l);null!=d&&(u=d({disabledIndices:l,elementsRef:t,event:a,highlightedIndex:w,loopFocus:b,maxIndex:y,minIndex:v,onLoop:z,orientation:c,rtl:h}));let A="vertical"!==c&&a.key===i||"horizontal"!==c&&a.key===eA.Jd,B="vertical"!==c&&a.key===m||"horizontal"!==c&&a.key===eA.il;j&&(a.key===eA.yZ?u=v:a.key===eA.Kp&&(u=y)),u===w&&(A||B)&&(b&&u===y&&A?(u=v,e&&(u=e(a,w,u,t))):b&&u===v&&B?(u=y,e&&(u=e(a,w,u,t))):u=(0,eB.BF)(t.current,{startingIndex:u,decrement:B,disabledIndices:l})),u===w||(0,eB.du)(t.current,u)||(k&&a.stopPropagation(),(q||g||A||B)&&a.preventDefault(),x(u,!0),queueMicrotask(()=>{t.current[u]?.focus()}))});return{props:{ref:s,onFocus(a){let b=r.current,c=(0,eD.EW)(a.nativeEvent);b&&null!=c&&(0,eA.Qi)(c)&&c.setSelectionRange(0,c.value.length)},onKeyDown:A},highlightedIndex:w,onHighlightedIndexChange:x,elementsRef:t,onMapChange:y,relayKeyboardEvent:A}}({grid:n,loopFocus:o,onLoop:p,orientation:k,highlightedIndex:i,onHighlightedIndexChange:j,rootRef:t,stopEventPropagation:s,enableHomeAndEndKeys:q,direction:(0,eF.j)(),disabledIndices:u,modifierKeys:v}),F=(0,em.o)(x,a,{state:g,ref:e,props:[z,...f,y],stateAttributesMapping:h}),G=m.useMemo(()=>({highlightedIndex:A,onHighlightedIndexChange:B,highlightItemOnHover:w,relayKeyboardEvent:E}),[A,B,w,E]);return(0,l.jsx)(eE.H.Provider,{value:G,children:(0,l.jsx)(en.u,{elementsRef:C,onMapChange:a=>{r?.(a),D(a)},children:F})})}let eH=m.createContext(void 0),eI=m.forwardRef(function(a,b){let{activateOnFocus:c=!1,className:d,loopFocus:e=!0,render:f,style:g,...h}=a,{orientation:i,setTabMap:j,tabActivationDirection:k}=eq(),[n,o]=m.useState(0),[p,q]=m.useState(null),r=m.useRef(new Set),s=m.useRef(new Set),t=m.useRef(null);(0,ek.g)(()=>{if("u"<typeof ResizeObserver)return;let a=new ResizeObserver(()=>{r.current.forEach(a=>{a()})});return t.current=a,p&&a.observe(p),s.current.forEach(b=>{a.observe(b)}),()=>{a.disconnect(),t.current=null}},[p]);let u=(0,el.K)(a=>(r.current.add(a),()=>{r.current.delete(a)})),v=(0,el.K)(a=>(s.current.add(a),t.current?.observe(a),()=>{s.current.delete(a),t.current?.unobserve(a)})),w=m.useMemo(()=>({activateOnFocus:c,registerIndicatorUpdateListener:u,registerTabResizeObserverElement:v,tabsListElement:p}),[c,u,v,p]);return(0,l.jsx)(eH.Provider,{value:w,children:(0,l.jsx)(eG,{render:f,className:d,style:g,state:{orientation:i,tabActivationDirection:k},refs:[b,q],props:[{"aria-orientation":"vertical"===i?"vertical":void 0,role:"tablist"},h],stateAttributesMapping:er,highlightedIndex:n,enableHomeAndEndKeys:!0,loopFocus:e,orientation:i,onHighlightedIndexChange:o,onMapChange:j,disabledIndices:ex.Ml})})});var eJ=c(83298),eK=c(80830),eL=c(43778),eM=c(38218);let eN=m.forwardRef(function(a,b){let{className:c,disabled:d=!1,render:e,value:f,id:g,nativeButton:h=!0,style:i,...j}=a,{value:k,getTabPanelIdByValue:l,onValueChange:n,orientation:o,tabActivationDirection:p}=eq(),{activateOnFocus:q,registerTabResizeObserverElement:r,tabsListElement:s}=function(){let a=m.useContext(eH);if(void 0===a)throw Error((0,eo.A)(65));return a}(),{highlightedIndex:t,onHighlightedIndexChange:u}=(0,eE.G)(),v=(0,eK.e)(g),w=m.useMemo(()=>({disabled:d,id:v,value:f}),[d,v,f]),{compositeProps:x,compositeRef:y,index:z}=(0,eM.k)({metadata:w}),A=f===k,B=m.useRef(!1),C=m.useRef(null),D=(0,el.K)(a=>{C.current?.(),C.current=a?r(a):null});(0,ek.g)(()=>{if(B.current){B.current=!1;return}if(A&&z>-1&&t!==z){if(null!=s){let a=(0,eD.RS)((0,eJ.R)(s));if(a&&(0,eD.gR)(s,a))return}d||u(z)}},[A,z,t,u,d,s]);let{getButtonProps:E,buttonRef:F}=(0,eL.s)({disabled:d,native:h,focusableWhenDisabled:!0}),G=l(f),H=m.useRef(!1),I=m.useRef(!1);function J(a){n(f,(0,es.d)(et.dv,a.nativeEvent,void 0,{activationDirection:"none"}))}return(0,em.o)("button",a,{state:{disabled:d,active:A,orientation:o,tabActivationDirection:p},ref:[b,F,y,D],props:[x,{role:"tab","aria-controls":G,"aria-selected":A,id:v,onClick:function(a){A||d||J(a)},onFocus:function(a){A||d||q&&(!H.current||I.current)&&J(a)},onPointerDown:function(a){if(A||d)return;H.current=!0,I.current=0===a.button;let b=(0,eJ.R)(a.currentTarget);function c(){H.current=!1,I.current=!1,b.removeEventListener("pointerup",c),b.removeEventListener("pointercancel",c)}b.addEventListener("pointerup",c),b.addEventListener("pointercancel",c)},[eC]:A?"":void 0,onKeyDownCapture(){B.current=!0}},j,E],stateAttributesMapping:er})});var eO=c(88890),eP=c(41341),eQ=c(93133),eR=c(53527),eS=c(13021),eT=c(61927);eT.e,eT.V;let eU={...er,...eP.G},eV=m.forwardRef(function(a,b){let{className:c,value:d,render:e,keepMounted:f=!1,style:g,...h}=a,{value:i,getTabIdByPanelValue:j,orientation:k,tabActivationDirection:l,registerMountedTabPanel:n}=eq(),o=(0,eK.e)(),{ref:p,index:q}=(0,eS.q)(),r=d===i,{mounted:s,transitionStatus:t,setMounted:u}=(0,eR.$)(r),v=!s,w=j(d),x=m.useRef(null),y=(0,em.o)("div",a,{state:{hidden:v,orientation:k,tabActivationDirection:l,transitionStatus:t},ref:[b,p,x],props:[{"aria-labelledby":w,hidden:v,id:o,role:"tabpanel",tabIndex:r?0:-1,inert:(0,eO.Y)(!r),"data-index":q},h],stateAttributesMapping:eU});return((0,eQ.v)({open:r,ref:x,onComplete(){r||u(!1)}}),(0,ek.g)(()=>{if(null!=o&&(!v||f))return n(d,o)},[v,f,d,o,n]),f||s)?y:null});function eW({className:a,orientation:b="horizontal",...c}){return(0,l.jsx)(eu,{"data-slot":"tabs","data-orientation":b,className:(0,E.cn)("group/tabs flex gap-2 data-horizontal:flex-col",a),...c})}let eX=(0,dy.F)("group/tabs-list inline-flex w-fit items-center justify-center rounded-[5px] h-11! border bg-white p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function eY({className:a,variant:b="default",...c}){return(0,l.jsx)(eI,{"data-slot":"tabs-list","data-variant":b,className:(0,E.cn)(eX({variant:b}),a),...c})}function eZ({className:a,...b}){return(0,l.jsx)(eN,{"data-slot":"tabs-trigger",className:(0,E.cn)("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-lg border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active: group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:border-0 group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:border-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-muted/70 data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:-bottom-1.25 group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100","border shadow-none! data-active:border-border cursor-pointer",a),...b})}function e$({className:a,...b}){return(0,l.jsx)(eV,{"data-slot":"tabs-content",className:(0,E.cn)("flex-1 text-sm outline-none",a),...b})}let e_={Vercel:{id:"Vercel",label:"Vercel",icon:"/icons/vercel.svg",kind:"serverless"},Hetzner:{id:"Hetzner",label:"Hetzner",icon:"/hetzner.svg",kind:"vps"},AWS:{id:"AWS",label:"AWS",icon:"/icons/aws.svg",kind:"vps"},Azure:{id:"Azure",label:"Azure",icon:"/icons/azure.svg",kind:"vps"},GCP:{id:"GCP",label:"GCP",icon:"/icons/gcp.svg",kind:"vps"},DigitalOcean:{id:"DigitalOcean",label:"DigitalOcean",icon:"/icons/digital-ocean.webp",kind:"vps"}};function e0(a){return a?e_["Docker"===a?"Hetzner":a]??null:null}var e1=c(83615),e2=c(64547);let e3="••••••••";function e4(a){return Object.fromEntries(Object.entries(a).map(([a,b])=>[a,b===e3?"":b]))}let e5="/api/connections",e6=(0,e1.v)()((a,b)=>({active:null,current:void 0,settings:{},visibleFields:{},mode:"local",targetKey:"local",endpoint:"",apiKey:"",showApiKey:!1,enabled:!0,managed:!1,saving:!1,removing:!1,testing:!1,webhookRegistration:null,open:(b,c,d,e)=>{let f=c?.target.mode??"local",g=c?.target.endpoint??e,h="remote"===f?d.find(a=>"remote"===a.mode&&a.endpoint===g):d[0];a({active:b,current:c,settings:e4(c?.settings??{}),visibleFields:{},enabled:c?.enabled??!0,managed:c?.managed??!1,showApiKey:!1,webhookRegistration:null,mode:f,endpoint:g,targetKey:h?.key??"local",apiKey:c?.target.apiKey===e3?"":c?.target.apiKey??""})},close:()=>a({active:null,current:void 0,webhookRegistration:null}),selectTarget:b=>{var c;return a({targetKey:b.key,mode:b.mode,endpoint:b.endpoint,apiKey:"local"===(c=b).mode?"":(c.deploymentId&&c.deploymentId,"")})},setEndpoint:b=>a({endpoint:b}),setApiKey:b=>a({apiKey:b}),toggleShowApiKey:()=>a(a=>({showApiKey:!a.showApiKey})),setFieldValue:(b,c)=>a(a=>({settings:{...a.settings,[b]:c}})),generateFieldValue:b=>{let c=Array.from({length:2},()=>Math.random().toString(36).slice(2,15)).join("");a(a=>({settings:{...a.settings,[b]:c},visibleFields:{...a.visibleFields,[b]:!0}}))},toggleFieldVisibility:b=>a(a=>({visibleFields:{...a.visibleFields,[b]:!a.visibleFields[b]}})),setEnabled:b=>a({enabled:b}),setManaged:b=>a({managed:b}),applyManagedOAuth:async c=>{a(a=>({settings:{...a.settings,...c},managed:!0})),await b().save()},save:async()=>{let{active:c,current:d,enabled:e,managed:f,settings:g,mode:h,endpoint:i,apiKey:j}=b();if(c){a({saving:!0,webhookRegistration:null});try{let b=await fetch(e5,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:c.id,enabled:e,managed:f,settings:g,target:{mode:h,endpoint:i,apiKey:j||d?.target.apiKey}})}),k=await b.json();if(!b.ok)throw Error(k.error??"Could not save the channel.");await (0,e2.k)(e5),S.oR.success(`${c.name} is connected to this Agent.`,{position:"bottom-left"});let l=k.connection;a({current:l,settings:e4(l.settings),apiKey:l.target.apiKey===e3?"":j,webhookRegistration:k.webhookRegistration??null})}catch(a){S.oR.error(a instanceof Error?a.message:"Could not save the channel.",{position:"bottom-left"})}finally{a({saving:!1})}}},remove:async()=>{let{active:c}=b();if(c){a({removing:!0});try{let a=await fetch(`${e5}/${c.id}`,{method:"DELETE"}),d=await a.json();if(!a.ok)throw Error(d.error??"Could not remove the connection.");await (0,e2.k)(e5),S.oR.success(`${c.name} was disconnected.`,{position:"bottom-left"}),b().close()}catch(a){S.oR.error(a instanceof Error?a.message:"Could not remove the connection.",{position:"bottom-left"})}finally{a({removing:!1})}}},test:async()=>{let{active:c,current:d,settings:e,mode:f,endpoint:g,apiKey:h,managed:i}=b();if(c){a({testing:!0});try{let a=await fetch(e5,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:c.id,managed:i,settings:e,target:{mode:f,endpoint:g,apiKey:h||d?.target.apiKey}})}),b=await a.json();if(!a.ok)throw Error(b.error??"Could not test this channel.");if("ok"!==b.channel.status)throw Error(b.channel.detail);if(!b.runtime.ok)throw Error("The selected endpoint is not a reachable Agent Server.");S.oR.success(`${b.channel.detail} Agent: ${b.runtime.name}.`,{position:"bottom-left"})}catch(a){S.oR.error(a instanceof Error?a.message:"Could not test this channel.",{position:"bottom-left"})}finally{a({testing:!1})}}}}));var e7=c(7214);let e8={title:"Ask us anything",welcomeMessage:"Hi! How can I help?",placeholder:"Type a message…",primaryColor:"#111827",position:"bottom-right",darkMode:!1,customCss:"",logoUrl:""},e9=a=>fetch(a).then(a=>a.json());function fa({code:a,codeHiddenKey:b,showKey:c,onCopy:d}){return(0,l.jsxs)("div",{className:"relative overflow-hidden rounded-xl border bg-muted/35 dark:bg-background/40",children:[(0,l.jsxs)(O.$,{variant:"ghost",size:"sm",className:"absolute right-2 top-2 gap-1.5",onClick:d,children:[(0,l.jsx)(d5.A,{className:"size-3.5"})," Copy"]}),(0,l.jsx)("pre",{className:"overflow-x-auto p-4 pr-20 font-mono text-xs leading-6 text-foreground",children:!c&&b?b:a})]})}function fb({embedded:a=!1}){let{data:b,mutate:c}=(0,H.u)("/api/config",e9),{data:d}=(0,H.u)("/api/projects/runtime",e9),[e,f]=(0,m.useState)(e8),[g,h]=(0,m.useState)(""),[i,j]=(0,m.useState)(""),[k,n]=(0,m.useState)(!1),[o,p]=(0,m.useState)(""),[q,r]=(0,m.useState)("javascript"),[s,t]=(0,m.useState)(!1),u=(0,m.useMemo)(()=>{let a=g.replace(/\/+$/,"")||"https://YOUR-LARKUP-HOST",b=i||"YOUR_SERVER_API_KEY",c="********",d=b=>[` src="${a}/widget.js"`,` data-api-key="${b}"`,` data-position="${e.position}"`,` data-theme="${e.darkMode?"dark":"light"}"`,` data-primary-color="${e.primaryColor}"`,e.logoUrl?` data-logo-url="${e.logoUrl}"`:"",e.customCss?` data-custom-css="${e.customCss.replace(/"/g,"&quot;")}"`:"",o?` data-class="${o}"`:""].filter(Boolean).join("\n"),f=b=>`'use client';
4
+
5
+ import { useEffect } from 'react';
6
+
7
+ export function LarkupWidget() {
8
+ useEffect(() => {
9
+ const script = document.createElement('script');
10
+ script.async = true;
11
+ script.src = '${a}/widget.js';
12
+ script.dataset.apiKey = '${b}';
13
+ script.dataset.position = '${e.position}';
14
+ script.dataset.theme = '${e.darkMode?"dark":"light"}';
15
+ script.dataset.primaryColor = '${e.primaryColor}';
16
+ ${e.logoUrl?`script.dataset.logoUrl = '${e.logoUrl}';
17
+ `:""}${e.customCss?`script.dataset.customCss = \`${e.customCss}\`;
18
+ `:""}document.body.appendChild(script);
19
+ return () => window.LarkupWidget?.destroy();
20
+ }, []);
21
+
22
+ return null;
23
+ }`;return{javascript:`<script
24
+ async
25
+ ${d(b)}
26
+ ></script>`,javascriptHidden:`<script
27
+ async
28
+ ${d(c)}
29
+ ></script>`,react:f(b),reactHidden:f(c),api:`curl -N ${a}/chat \\
30
+ -H "Content-Type: application/json" \\
31
+ -H "Authorization: Bearer ${b}" \\
32
+ -d '{"messages":[{"role":"user","content":"Hello"}]}'`,apiHidden:`curl -N ${a}/chat \\
33
+ -H "Content-Type: application/json" \\
34
+ -H "Authorization: Bearer ${c}" \\
35
+ -d '{"messages":[{"role":"user","content":"Hello"}]}'`}},[i,o,g,e.darkMode,e.position,e.primaryColor,e.logoUrl,e.customCss]);async function v(){if(b?.config){t(!0);try{let a=await fetch("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...b.config,widget:e})}),d=await a.json();if(!a.ok)throw Error(d.error??"Could not save widget settings.");await c(d,{revalidate:!1}),S.oR.success("Widget appearance saved. Restart or redeploy the server to publish it.")}catch(a){S.oR.error(a instanceof Error?a.message:"Could not save widget settings.")}finally{t(!1)}}}async function w(a,b="Code"){await navigator.clipboard.writeText(a),S.oR.success(`${b} copied.`)}return b?(0,l.jsxs)("section",{className:"space-y-6",children:[!a&&(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"text-xl font-semibold tracking-tight",children:"Chat widget"}),(0,l.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Customize a self-contained chat surface, then embed the generated server anywhere."})]}),(0,l.jsxs)("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1fr)_minmax(380px,.7fr)]",children:[(0,l.jsx)("div",{className:"flex flex-col gap-5",children:(0,l.jsxs)("div",{className:"rounded-xl border bg-card/60 p-5",children:[(0,l.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{htmlFor:"widget-title",children:"Widget title"}),(0,l.jsx)(P.p,{id:"widget-title",value:e.title,onChange:a=>f({...e,title:a.target.value})})]}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{htmlFor:"widget-color",children:"Accent color"}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(P.p,{id:"widget-color",type:"color",className:"w-12 p-1",value:e.primaryColor,onChange:a=>f({...e,primaryColor:a.target.value})}),(0,l.jsx)(P.p,{value:e.primaryColor,onChange:a=>f({...e,primaryColor:a.target.value})})]})]}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{htmlFor:"widget-logo",children:"Custom logo URL"}),(0,l.jsx)(P.p,{id:"widget-logo",placeholder:"https://example.com/logo.png",value:e.logoUrl||"",onChange:a=>f({...e,logoUrl:a.target.value})})]}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{htmlFor:"widget-welcome",children:"Welcome message"}),(0,l.jsx)(P.p,{id:"widget-welcome",value:e.welcomeMessage,onChange:a=>f({...e,welcomeMessage:a.target.value})})]}),(0,l.jsxs)("div",{className:"space-y-1.5 sm:col-span-2",children:[(0,l.jsx)(Q.J,{htmlFor:"widget-placeholder",children:"Input placeholder"}),(0,l.jsx)(P.p,{id:"widget-placeholder",value:e.placeholder,onChange:a=>f({...e,placeholder:a.target.value})})]}),(0,l.jsxs)("div",{className:"space-y-1.5 sm:col-span-2",children:[(0,l.jsx)(Q.J,{htmlFor:"widget-css",children:"Custom CSS / Tailwind Classes"}),(0,l.jsx)(dz.T,{id:"widget-css",placeholder:"e.g. rounded-xl border-blue-500 ",className:"min-h-20 text-xs font-mono",value:e.customCss||"",onChange:a=>f({...e,customCss:a.target.value})})]}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{children:"Position"}),(0,l.jsxs)("div",{className:"grid grid-cols-2 rounded-lg border p-1",children:[(0,l.jsx)(O.$,{size:"sm",variant:"bottom-left"===e.position?"secondary":"ghost",onClick:()=>f({...e,position:"bottom-left"}),children:"Left"}),(0,l.jsx)(O.$,{size:"sm",variant:"bottom-right"===e.position?"secondary":"ghost",onClick:()=>f({...e,position:"bottom-right"}),children:"Right"})]})]}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{children:"Dark mode"}),(0,l.jsxs)("div",{className:"flex items-center justify-between rounded-lg border px-3 py-2.5",children:[(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"Preview in a dark palette."}),(0,l.jsx)(d8.d,{checked:e.darkMode,onCheckedChange:a=>f({...e,darkMode:a})})]})]})]}),(0,l.jsx)("div",{className:"mt-5 flex justify-end",children:(0,l.jsxs)(O.$,{disabled:s,onClick:()=>void v(),children:[(0,l.jsx)(N.A,{className:"size-4"})," Save appearance"]})})]})}),(0,l.jsxs)("div",{className:(0,E.cn)("flex h-full min-h-100 w-full flex-col overflow-hidden rounded-2xl border transition-all",e.darkMode?"border-white/10 bg-zinc-900 text-zinc-100":"bg-white text-zinc-950",e.customCss),children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 border-b px-4 py-3",children:[e.logoUrl?(0,l.jsx)("img",{src:e.logoUrl,alt:"Logo",className:"size-6 object-contain"}):(0,l.jsx)("span",{className:"size-2 rounded-full",style:{backgroundColor:e.primaryColor}}),(0,l.jsx)("span",{className:"text-sm font-semibold",children:e.title})]}),(0,l.jsx)("div",{className:"flex-1 overflow-y-auto p-4 flex flex-col gap-4",children:(0,l.jsx)("div",{className:"flex w-full",children:(0,l.jsx)("p",{className:(0,E.cn)("w-fit max-w-[85%] rounded-2xl px-3 py-2 text-sm",e.darkMode?"bg-zinc-800 text-zinc-100":"bg-zinc-100"),children:e.welcomeMessage})})}),(0,l.jsxs)("div",{className:"flex gap-2 border-t p-3",children:[(0,l.jsx)("div",{className:(0,E.cn)("flex-1 rounded-xl border px-3 py-2 text-xs flex items-center",e.darkMode?"border-zinc-700 text-zinc-400":"text-zinc-500 bg-zinc-50/50"),children:e.placeholder}),(0,l.jsx)("span",{className:"grid size-9 shrink-0 place-items-center rounded-xl text-white ",style:{backgroundColor:e.primaryColor},children:(0,l.jsx)(ef,{className:"size-4"})})]})]})]}),(0,l.jsxs)("div",{className:"rounded-xl border bg-card/60 p-5",children:[(0,l.jsx)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(e7.A,{className:"size-4 text-muted-foreground"}),(0,l.jsx)("h2",{className:"text-sm font-semibold",children:"Embed your widget"})]}),(0,l.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"The widget is served by this Agent runtime and uses the saved appearance after restart or deployment."})]})}),(0,l.jsxs)("div",{className:"mt-5 grid gap-5 lg:grid-cols-2",children:[(0,l.jsx)("div",{className:"flex flex-col gap-4",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"mb-3 flex flex-wrap gap-2",children:[{id:"javascript",label:"JavaScript"},{id:"react",label:"React"},{id:"api",label:"Server API"}].map(a=>(0,l.jsx)("button",{type:"button",onClick:()=>r(a.id),className:(0,E.cn)("rounded-full px-3 py-1.5 text-xs font-medium transition-colors",q===a.id?"bg-muted text-foreground":"border border-border text-muted-foreground hover:bg-muted/50"),children:a.label},a.id))}),(0,l.jsx)(fa,{code:u[q],codeHiddenKey:u[q+"Hidden"],showKey:k,onCopy:()=>void w(u[q])})]})}),(0,l.jsxs)("div",{className:"space-y-4 rounded-xl border bg-muted/20 p-4",children:[(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{htmlFor:"widget-host",children:"Widget server URL"}),(0,l.jsx)(P.p,{id:"widget-host",value:g,onChange:a=>h(a.target.value),placeholder:"https://agent.example.com"})]}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsxs)(Q.J,{htmlFor:"widget-class",children:["Host class name"," ",(0,l.jsx)("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),(0,l.jsx)(P.p,{id:"widget-class",value:o,onChange:a=>p(a.target.value),placeholder:"fixed z-50"}),(0,l.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"Applied to the outer mount. The chat itself remains isolated from host CSS."})]}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)(Q.J,{htmlFor:"widget-key",children:"Server API key"}),(0,l.jsxs)("div",{className:"flex",children:[(0,l.jsx)(O.$,{variant:"ghost",size:"icon-sm","aria-label":k?"Hide API key":"Show API key",onClick:()=>n(!k),children:k?(0,l.jsx)(ai.A,{className:"size-3.5"}):(0,l.jsx)(aj.A,{className:"size-3.5"})}),(0,l.jsx)(O.$,{variant:"ghost",size:"icon-sm","aria-label":"Copy API key",disabled:!i,onClick:()=>void w(i,"API key"),children:(0,l.jsx)(d5.A,{className:"size-3.5"})})]})]}),(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)(d6.A,{className:"absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),(0,l.jsx)(P.p,{id:"widget-key",className:"pl-8 font-mono text-xs",type:k?"text":"password",value:i||"Start the local server to create a key",readOnly:!0})]}),(0,l.jsx)("p",{className:"text-[11px] text-amber-700 dark:text-amber-300",children:"This key is visible to site visitors in a script tag. Use a scoped, low-privilege browser key or a proxy for public production embeds."})]})]})]})]})]}):(0,l.jsx)("div",{className:"flex h-40 items-center justify-center",children:(0,l.jsx)(M.A,{className:"size-5 animate-spin text-muted-foreground"})})}let fc=a=>fetch(a).then(a=>a.json()),fd=new Set(["webhook"]);function fe({name:a,icon:b,size:c="md"}){return(0,l.jsx)("div",{className:(0,E.cn)("flex shrink-0 items-center justify-center rounded-lg bg-muted/30","md"===c?"h-10 w-10":"h-7 w-7"),children:b?(0,l.jsx)("img",{src:b,alt:"",className:(0,E.cn)("object-contain","md"===c?"size-6":"size-4")}):(0,l.jsx)("span",{className:"text-sm font-semibold",children:a.slice(0,1)})})}function ff({id:a,value:b,visible:c,placeholder:d,onChange:e,onToggleVisible:f}){return(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)(P.p,{id:a,type:c?"text":"password",value:b,placeholder:d,onChange:a=>e(a.target.value),className:"pr-10"}),(0,l.jsx)("button",{type:"button","aria-label":c?"Hide value":"Show value",onClick:f,className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground",children:c?(0,l.jsx)(ai.A,{className:"size-4"}):(0,l.jsx)(aj.A,{className:"size-4"})})]})}function fg({embedded:a=!1}){let[b,c]=(0,m.useState)("list"),{data:d}=(0,H.u)("/api/connections",fc),{data:e}=(0,H.u)("/api/projects/runtime",fc),{data:f}=(0,H.u)("/api/projects/deployments",fc),g=e6(),[h,i]=(0,m.useState)(""),[j,k]=(0,m.useState)(!1),[n,o]=(0,m.useState)(""),[p,q]=(0,m.useState)(""),[r,s]=(0,m.useState)(""),[t,u]=(0,m.useState)(!1),[v,w]=(0,m.useState)("oauth"),[x,y]=(0,m.useState)(""),[z,A]=(0,m.useState)(!1),[C,D]=(0,m.useState)(!1),[F,G]=(0,m.useState)(!1),I=e?.runtime?.endpoint||"http://localhost:8080",J=(0,m.useMemo)(()=>(f?.deployments??[]).filter(a=>"assistant"===a.profile),[f]),K=(0,m.useMemo)(()=>[{key:"local",mode:"local",label:"Local runtime",endpoint:I,sublabel:I},...J.map(a=>({key:a.id,mode:"remote",label:a.name,endpoint:a.endpoint,sublabel:a.status,icon:e0(a.provider)?.icon,deploymentId:a.id}))],[I,J]),L=K.find(a=>a.key===g.targetKey)??K[0],R=!!g.active?.connectionUi?.requiresPublicIngress,T=g.current?.provider??d?.connections.find(a=>a.id===g.active?.id)?.provider,U=T?.testUrl??g.active?.testUrl,V=T?.testUrlLabel,{data:W,mutate:X}=(0,H.u)(R?"/api/connections/tunnel":null,fc),Y=(0,m.useMemo)(()=>new Map((d?.connections??[]).map(a=>[a.id,a])),[d?.connections]),Z=(0,m.useMemo)(()=>{let a=h.trim().toLowerCase(),b=a=>"available"===a.availability&&Y.get(a.id)?.enabled?0:"available"===a.availability?1:2;return(d?.connectionsCatalog??[]).filter(b=>!fd.has(b.id)&&(!a||`${b.name} ${b.description}`.toLowerCase().includes(a))).sort((a,c)=>b(a)-b(c))},[Y,d?.connectionsCatalog,h]);function $(a){o(a?.name??""),k(!0)}let _=function({onConnected:a,onError:b}={}){return(0,m.useRef)({onConnected:a,onError:b}),{connect:function(a){window.open(a,"channel-oauth","width=600,height=800,toolbar=0,scrollbars=1,status=1,resizable=1")}}}({onConnected:({channelId:a,fields:b})=>{g.active?.id===a&&(g.applyManagedOAuth(b),w("oauth"))},onError:a=>S.oR.error(a,{position:"bottom-left"})});async function aa(){D(!0);try{let a=await fetch("/api/connections/tunnel",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start",authtoken:x||void 0})}),b=await a.json();if(!a.ok)throw Error(b.error??b.detail??"Could not start the tunnel.");y(""),A(!1),await X(b,!1),g.current?.managed&&g.active?.managedConnection?.relay&&await g.save(),S.oR.success("Your public HTTPS tunnel is ready.",{position:"bottom-left"})}catch(a){S.oR.error(a instanceof Error?a.message:"Could not start the tunnel.",{position:"bottom-left"})}finally{D(!1)}}async function ab(){G(!0);try{let a=await fetch("/api/connections/tunnel",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"stop"})}),b=await a.json();if(!a.ok)throw Error(b.error??b.detail??"Could not stop the tunnel.");await X(b,!1)}catch(a){S.oR.error(a instanceof Error?a.message:"Could not stop the tunnel.",{position:"bottom-left"})}finally{G(!1)}}async function ac(){W?.publicUrl&&g.active&&(await navigator.clipboard.writeText(`${W.publicUrl.replace(/\/$/,"")}/api/connections/${g.active.id}`),S.oR.success("Webhook URL copied.",{position:"bottom-left"}))}async function ad(){if(n.trim()&&p.trim()){u(!0);try{if(!(await fetch(process.env.NEXT_PUBLIC_CONNECT_API_URL||"https://www.larkup.de/api/connect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:n.trim(),email:p,message:`Channel request: ${n.trim()}. ${r}`})})).ok)throw Error("Could not send the request.");S.oR.success(`Your ${n.trim()} channel request was sent.`,{position:"bottom-left"}),k(!1),o(""),q(""),s("")}catch(a){S.oR.error(a instanceof Error?a.message:"Could not send the request.",{position:"bottom-left"})}finally{u(!1)}}}function ae(){let a=g.active;return a?(0,l.jsxs)("div",{className:"space-y-4 rounded-xl border p-3",children:[(0,l.jsxs)("p",{className:"text-xs font-medium text-primary",children:["2. Connect ",a.name]}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:a.connectionUi?.credentialsDescription??`Enter the credentials for your own ${a.name} app.`}),g.managed&&(0,l.jsx)("p",{className:"rounded-lg bg-muted/60 px-2.5 py-2 text-[11px] text-muted-foreground",children:"Managed OAuth is active. Saved credentials stay hidden, and any shared provider secrets are handled by Larkup. Enter values below only to switch to your own app."}),a.configFields.filter(a=>!a.hidden).map(b=>{let c=g.managed&&a.managedConnection?.sharedSecretField===b.key;return(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,l.jsxs)(Q.J,{htmlFor:b.key,children:[b.label,b.required?" *":""]}),b.helpUrl&&(0,l.jsxs)("a",{href:b.helpUrl,target:"_blank",rel:"noreferrer",className:"flex shrink-0 items-center gap-1 text-[11px] font-medium text-primary hover:underline",children:["Open ",a.name," setup",(0,l.jsx)(d0.A,{className:"size-3"})]}),b.canGenerate&&(0,l.jsxs)("button",{type:"button",onClick:()=>g.generateFieldValue(b.key),className:"flex shrink-0 items-center gap-1 text-[11px] font-medium text-primary hover:underline",children:["Generate",(0,l.jsx)(ea.A,{className:"size-3"})]})]}),"secret"===b.type?(0,l.jsx)(ff,{id:b.key,value:g.settings[b.key]??"",visible:!!g.visibleFields[b.key],placeholder:g.current?.settings[b.key]?"Saved — leave blank to keep":b.placeholder,onChange:a=>{g.setFieldValue(b.key,a),g.managed&&a.trim()&&g.setManaged(!1)},onToggleVisible:()=>g.toggleFieldVisibility(b.key)}):(0,l.jsx)(P.p,{id:b.key,type:"boolean"===b.type?"text":b.type,value:g.settings[b.key]??"",placeholder:b.placeholder,onChange:a=>{let c=a.target.value;g.setFieldValue(b.key,c),g.managed&&c.trim()&&g.setManaged(!1)}}),c?(0,l.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-emerald-700 dark:text-emerald-400",children:[(0,l.jsx)(dW.A,{className:"size-3"}),"Managed by Larkup and never stored in this Project."]}):"secret"===b.type&&g.current?.settings[b.key]?(0,l.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-emerald-700 dark:text-emerald-400",children:[(0,l.jsx)(dW.A,{className:"size-3"}),"Saved — hidden here for security. Leave blank to keep it."]}):null,b.help&&(0,l.jsx)("p",{className:"text-[11px] text-muted-foreground",children:b.help})]},b.key)})]}):null}return d?"widget"===b?(0,l.jsxs)("div",{className:"space-y-4 animate-in fade-in-0 duration-200",children:[(0,l.jsxs)(O.$,{variant:"ghost",size:"sm",onClick:()=>c("list"),className:"-ml-3 text-muted-foreground hover:text-foreground",children:[(0,l.jsx)(eb.A,{className:"mr-1 size-4"}),"Back to connections"]}),(0,l.jsx)(fb,{embedded:!0})]}):(0,l.jsxs)("section",{className:"space-y-5",children:[(0,l.jsx)("div",{children:(0,l.jsxs)("div",{children:[!a&&(0,l.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:"Connect a provider once, choose the Agent that replies, then send a real test message."})]})}),(0,l.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"relative w-full",children:[(0,l.jsx)(dD.A,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),(0,l.jsx)(P.p,{"aria-label":"Search connections",placeholder:"Search connections...",value:h,onChange:a=>i(a.target.value),className:"h-9 pl-9 bg-white"})]}),(0,l.jsxs)(O.$,{variant:"default",size:"sm",className:"h-8 gap-2",onClick:()=>$(),children:[(0,l.jsx)(d$.A,{className:"size-3.5"}),"Ask for a connection"]})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[(0,l.jsxs)("div",{"data-testid":"connection-card-widget",className:(0,E.cn)("group flex items-center justify-between gap-3.5 rounded-xl border px-4 py-3.5 text-left transition-all","border-border bg-white/80 hover:border-primary/20 hover:bg-white dark:bg-card/60 dark:hover:bg-card"),children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3.5",children:[(0,l.jsx)(fe,{name:"Chat Widget",icon:"/logo.png"}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Chat Widget"}),(0,l.jsxs)("span",{className:"flex items-center gap-1 text-[10px] font-medium text-emerald-600",children:[(0,l.jsx)(dW.A,{className:"size-3"}),"Active"]})]}),(0,l.jsx)("p",{className:"mt-0.5 truncate text-xs text-muted-foreground max-w-50",children:"Embed a custom AI chat on your website."})]})]}),(0,l.jsx)("div",{className:"shrink-0",children:(0,l.jsx)(O.$,{variant:"default",size:"sm",onClick:()=>c("widget"),children:"Customize"})})]}),Z.map(a=>{if("coming_soon"===a.availability)return(0,l.jsxs)("div",{className:"flex items-center justify-between gap-3.5 rounded-xl border border-dashed border-border/60 bg-muted/15 px-4 py-3.5 text-left",children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3.5",children:[(0,l.jsx)(fe,{name:a.name,icon:a.icon}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"text-sm font-medium text-foreground",children:a.name}),(0,l.jsx)("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:"Coming soon"})]}),(0,l.jsx)("p",{className:"mt-0.5 max-w-50 truncate text-xs text-muted-foreground",children:a.description})]})]}),(0,l.jsx)(O.$,{variant:"outline",size:"sm",onClick:()=>$(a),children:"Request"})]},a.id);let b=Y.get(a.id),c=!!b?.enabled;return(0,l.jsxs)("div",{"data-testid":"connection-card",className:(0,E.cn)("group flex items-center justify-between gap-3.5 rounded-xl border px-4 py-3.5 text-left transition-all","border-border bg-white/80 hover:border-primary/20 hover:bg-white dark:bg-card/60 dark:hover:bg-card"),children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3.5",children:[(0,l.jsx)(fe,{name:a.name,icon:a.icon}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"text-sm font-medium text-foreground",children:a.name}),c&&(0,l.jsxs)("span",{className:"flex items-center gap-1 text-[10px] font-medium text-emerald-600",children:[(0,l.jsx)(dW.A,{className:"size-3"}),"Connected"]})]}),(0,l.jsx)("p",{className:"mt-0.5 truncate text-xs text-muted-foreground max-w-50",children:a.description}),b&&(0,l.jsxs)("p",{className:"mt-0.5 truncate text-[10px] text-muted-foreground/70",children:["local"===b.target.mode?"Local":"Remote"," \xb7"," ",b.target.endpoint]})]})]}),(0,l.jsx)("div",{className:"shrink-0",children:(0,l.jsx)(O.$,{variant:c?"default":"outline",size:"sm",onClick:()=>{let b;return b=Y.get(a.id),void(w(b?.managed||!b&&a.oauthConnect?"oauth":"credentials"),g.open(a,b,K,I))},children:c?"Configure":"Connect"})})]},a.id)})]}),(0,l.jsx)(ei.cj,{open:!!g.active,onOpenChange:a=>!a&&g.close(),children:(0,l.jsxs)(ei.h,{side:"right",className:"flex flex-col p-0 max-w-[90%]! w-187.5!",children:[(0,l.jsxs)(ei.Fm,{className:"border-b p-6",children:[(0,l.jsxs)(ei.qp,{className:"flex items-center gap-2",children:[g.active&&(0,l.jsx)(fe,{name:g.active.name,icon:g.active.icon,size:"sm"}),g.current?"Configure":"Connect"," ",g.active?.name]}),(0,l.jsxs)(ei.Qs,{children:["Follow the three steps below. Provider secrets stay private to this Project.",(0,l.jsx)("span",{className:"mt-1 block font-medium text-foreground",children:"Only Agent Servers can receive channels."})]})]}),g.active&&(0,l.jsxs)("div",{className:"flex-1 space-y-4 overflow-y-auto p-6",children:[(0,l.jsxs)("div",{className:"rounded-xl border bg-muted/20 p-3",children:[(0,l.jsx)("p",{className:"text-xs font-medium text-primary",children:"1. Choose the Agent"}),(0,l.jsx)(Q.J,{className:"mt-2 block",children:"Agent target"}),(0,l.jsxs)(eh.rI,{children:[(0,l.jsxs)(eh.ty,{render:(0,l.jsx)(O.$,{variant:"outline",className:"mt-2 w-full justify-between font-normal"}),children:[(0,l.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[L?.mode==="local"?(0,l.jsx)(B,{className:"size-4 shrink-0 text-muted-foreground"}):L?.icon?(0,l.jsx)("img",{src:L.icon,alt:"",className:"size-4 shrink-0 object-contain"}):(0,l.jsx)(d_.A,{className:"size-4 shrink-0 text-muted-foreground"}),(0,l.jsx)("span",{className:"truncate",children:L?.label??"Select an Agent target"})]}),(0,l.jsx)(ar.A,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),(0,l.jsxs)(eh.SQ,{className:"w-(--anchor-width)",children:[K.map(a=>(0,l.jsxs)(eh._2,{onClick:()=>g.selectTarget(a),children:["local"===a.mode?(0,l.jsx)(B,{className:"size-4 text-muted-foreground"}):a.icon?(0,l.jsx)("img",{src:a.icon,alt:"",className:"size-4 object-contain"}):(0,l.jsx)(d_.A,{className:"size-4 text-muted-foreground"}),(0,l.jsx)("span",{className:"min-w-0 flex-1 truncate",children:a.label}),(0,l.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"local"===a.mode?"Local":a.sublabel})]},a.key)),!J.length&&(0,l.jsx)("p",{className:"px-1.5 py-2 text-[11px] text-muted-foreground",children:"Deploy an Agent Server to see remote targets here."})]})]}),(0,l.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,l.jsx)(Q.J,{htmlFor:"agent-endpoint",children:"Agent endpoint"}),R&&W?.status!=="running"&&(0,l.jsx)(O.$,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>A(a=>!a),children:"Use ngrok"})]}),(0,l.jsx)(P.p,{id:"agent-endpoint",value:g.endpoint,onChange:a=>g.setEndpoint(a.target.value)}),R&&(0,l.jsx)(eg.Nt,{open:z,onOpenChange:A,children:(0,l.jsxs)(eg.Ke,{className:"mt-2 space-y-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(P.p,{"aria-label":"ngrok authtoken",type:"password",value:x,onChange:a=>y(a.target.value),placeholder:"ngrok authtoken (needed once)",className:"h-8"}),(0,l.jsxs)(O.$,{type:"button",variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:()=>void aa(),disabled:C,children:[C?(0,l.jsx)(M.A,{className:"size-3.5 animate-spin"}):null,"Generate HTTPS"]})]}),(0,l.jsxs)("p",{className:"text-[11px] text-muted-foreground",children:[W?.detail??"Creates an HTTPS address for this Larkup app on this computer."," ",(0,l.jsxs)("a",{href:"https://dashboard.ngrok.com/get-started/setup/",target:"_blank",rel:"noreferrer",className:"font-medium text-primary hover:underline",children:["Set up ngrok ",(0,l.jsx)(d0.A,{className:"inline size-3"})]})]})]})}),R&&W?.status==="running"&&W.publicUrl&&(0,l.jsxs)("div",{className:"flex items-center gap-2 rounded-md border bg-muted/30 px-2.5 py-2",children:[(0,l.jsx)("span",{className:"shrink-0 text-[11px] font-medium text-emerald-700 dark:text-emerald-400",children:"HTTPS"}),(0,l.jsx)("code",{className:"min-w-0 flex-1 truncate text-[11px]",children:W.publicUrl}),"credentials"===v&&!g.active.supportsWebhookRegistration&&(0,l.jsx)(O.$,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Copy public webhook URL",onClick:ac,children:(0,l.jsx)(d5.A,{className:"size-3.5"})}),(0,l.jsxs)(O.$,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-1.5 text-[11px]",onClick:()=>void ab(),disabled:F,children:[F?(0,l.jsx)(M.A,{className:"size-3 animate-spin"}):null,"Stop"]})]}),(0,l.jsx)("p",{className:"text-[11px] text-muted-foreground",children:g.active.connectionUi?.endpointHint??"This can stay local while testing. Your provider needs the public webhook URL shown after you save, not direct access to this Agent endpoint."})]}),(0,l.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,l.jsx)(Q.J,{htmlFor:"agent-key",children:"Agent retrieval API key"}),(0,l.jsx)(ff,{id:"agent-key",value:g.apiKey,visible:g.showApiKey,placeholder:g.current?.target.apiKey?"Saved key":"Required when the Agent uses API keys",onChange:g.setApiKey,onToggleVisible:g.toggleShowApiKey}),(0,l.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"Auto-filled from the key saved for this target — override if needed."})]})]}),g.active.oauthConnect?(0,l.jsxs)(eW,{value:v,onValueChange:a=>w(a),children:[(0,l.jsxs)(eY,{className:"w-full max-w-xs bg-white h-9!",children:[(0,l.jsx)(eZ,{className:"rounded-xs!",value:"oauth",children:"OAuth"}),(0,l.jsx)(eZ,{className:"rounded-xs!",value:"credentials",children:"Credentials"})]}),(0,l.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:"Choose OAuth for the managed setup, or Credentials when using your own app."}),(0,l.jsx)(e$,{value:"oauth",className:"pt-3",children:(0,l.jsxs)("div",{className:"space-y-3 rounded-xl border bg-muted/20 p-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)("p",{className:"text-xs font-medium text-primary",children:["2. Connect ",g.active.name]}),(0,l.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:g.active.oauthConnect.description??`Authorize Larkup to connect your ${g.active.name} workspace.`})]}),(0,l.jsxs)(O.$,{type:"button",variant:g.managed?"outline":"default",className:"w-full gap-2",onClick:()=>_.connect(g.active.oauthConnect.startUrl),children:[(0,l.jsx)("img",{src:g.active.icon,alt:"",className:"size-4 object-contain"}),g.managed?`Reconnect ${g.active.name}`:g.active.oauthConnect.label]}),g.managed?(0,l.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-emerald-700 dark:text-emerald-400",children:[(0,l.jsx)(dW.A,{className:"size-3"}),"OAuth credentials are saved securely for this Project."]}):(0,l.jsx)("p",{className:"text-[11px] text-muted-foreground",children:g.active.oauthConnect.completionHint??"Larkup securely saves the credentials returned by the provider."})]})}),(0,l.jsx)(e$,{value:"credentials",className:"pt-3",children:ae()})]}):ae(),(g.webhookRegistration||!g.managed&&g.active.setupInstructions?.length)&&(0,l.jsxs)("div",{className:"space-y-2 rounded-xl border bg-muted/20 p-3",children:[!g.managed&&g.active.setupInstructions?.length?(0,l.jsx)("p",{className:"text-xs font-medium text-primary",children:"Provider setup"}):null,g.webhookRegistration&&(0,l.jsxs)("p",{className:"flex items-start gap-1.5 text-xs text-emerald-700 dark:text-emerald-400",children:[(0,l.jsx)(dW.A,{className:"mt-0.5 size-3.5 shrink-0"}),g.webhookRegistration.detail]}),!g.managed&&g.active.setupInstructions?.length?(0,l.jsx)("ol",{className:"space-y-1 pl-4 text-[11px] text-muted-foreground",children:g.active.setupInstructions.map(a=>(0,l.jsx)("li",{className:"list-decimal pl-1",children:a},a))}):null]}),(0,l.jsxs)("div",{className:"space-y-3 rounded-xl border p-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-xs font-medium text-primary",children:"3. Save and test"}),(0,l.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:g.active.testHint??`Save this connection, then send a real ${g.active.name} message.`})]}),(0,l.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-lg bg-muted/30 p-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-sm font-medium",children:"Channel enabled"}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"Disable to pause inbound messages without losing setup."})]}),(0,l.jsx)(d8.d,{checked:g.enabled,onCheckedChange:g.setEnabled})]})]}),g.current&&g.active.connectionUi?.contact&&(0,l.jsxs)("div",{className:"space-y-2 rounded-xl border p-4",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,l.jsx)("p",{className:"text-sm font-medium",children:"Use your assistant"}),g.active.connectionUi.contact.mention&&(0,l.jsx)("span",{className:"rounded-md bg-muted px-2 py-1 text-xs font-medium text-foreground",children:g.active.connectionUi.contact.mention})]}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:g.active.connectionUi.contact.directMessage}),g.active.connectionUi.contact.channelMessage&&(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:g.active.connectionUi.contact.channelMessage})]}),g.current&&U&&(0,l.jsxs)(O.$,{variant:"outline",className:"w-full",render:(0,l.jsx)("a",{href:U,target:"_blank",rel:"noreferrer"}),nativeButton:!1,children:[V??`Open ${g.active.name} bot`,(0,l.jsx)(d0.A,{className:"size-3.5"})]})]}),(0,l.jsxs)(ei.XW,{className:"flex-row items-center gap-2 border-t p-4",children:[g.current&&(0,l.jsxs)(O.$,{variant:"destructive",className:"mr-auto",onClick:()=>{window.confirm(`Disconnect ${g.active?.name}? This removes its saved credentials.`)&&g.remove()},disabled:g.removing,children:[g.removing?(0,l.jsx)(M.A,{className:"size-4 animate-spin"}):null,"Disconnect"]}),(0,l.jsxs)(O.$,{variant:"outline",onClick:()=>void g.test(),disabled:!g.endpoint||g.testing,children:[g.testing?(0,l.jsx)(M.A,{className:"size-4 animate-spin"}):(0,l.jsx)(ed,{className:"size-4"}),"Check setup"]}),(0,l.jsxs)(O.$,{onClick:()=>void g.save(),disabled:g.saving||R&&W?.status!=="running",children:[g.saving?(0,l.jsx)(M.A,{className:"size-4 animate-spin"}):(0,l.jsx)(N.A,{className:"size-4"}),g.current?"Save changes":"Save & continue"]})]})]})}),(0,l.jsx)(dx.lG,{open:j,onOpenChange:a=>!a&&k(!1),children:(0,l.jsxs)(dx.Cf,{className:"sm:max-w-md",children:[(0,l.jsxs)(dx.c7,{children:[(0,l.jsx)(dx.L3,{children:"Request a connection"}),(0,l.jsx)(dx.rr,{children:"Tell us where you plan to use this channel. We’ll prioritize requests from active Agent projects."})]}),(0,l.jsxs)("div",{className:"space-y-4 py-2",children:[(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{htmlFor:"channel-request-name",children:"Connection or channel"}),(0,l.jsx)(P.p,{id:"channel-request-name",value:n,onChange:a=>o(a.target.value),placeholder:"e.g. WhatsApp, Microsoft Teams"})]}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{htmlFor:"channel-request-email",children:"Work email"}),(0,l.jsx)(P.p,{id:"channel-request-email",type:"email",value:p,onChange:a=>q(a.target.value),placeholder:"you@company.com"})]}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsxs)(Q.J,{htmlFor:"channel-request-details",children:["How will you use it? ",(0,l.jsx)("span",{className:"text-muted-foreground",children:"Optional"})]}),(0,l.jsx)(dz.T,{id:"channel-request-details",value:r,onChange:a=>s(a.target.value),placeholder:"Support, sales, appointment booking…"})]})]}),(0,l.jsxs)(dx.Es,{children:[(0,l.jsx)(O.$,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),(0,l.jsxs)(O.$,{onClick:()=>void ad(),disabled:t||!n.trim()||!p.trim(),children:[t?(0,l.jsx)(M.A,{className:"size-4 animate-spin"}):(0,l.jsx)(ef,{className:"size-4"}),"Apply for access"]})]})]})})]}):(0,l.jsx)("div",{className:"flex h-40 items-center justify-center",children:(0,l.jsx)(M.A,{className:"size-5 animate-spin text-muted-foreground"})})}var fh=c(45911),fi=c(91017);function fj({serverId:a="default",profile:b,onSaved:c,onDeployClick:d,showUtilities:e=!1,compact:f=!1}){let g=a=>{d(a)},h=a=>{window.open(`/api/server/download?provider=${a}`)};return(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[e&&(0,l.jsx)(fi.Bc,{children:(0,l.jsxs)(fi.m_,{children:[(0,l.jsx)(fi.k$,{delay:0,render:(0,l.jsx)(O.$,{variant:"outline",size:"icon",className:`${f?"h-8 w-8":"h-9 w-9"} shrink-0 text-muted-foreground hover:text-foreground`,onClick:()=>g("env"),children:(0,l.jsx)(p.A,{className:"size-4"})})}),(0,l.jsx)(fi.ZI,{children:(0,l.jsx)("p",{children:"Environment Variables"})})]})}),(0,l.jsxs)(eh.rI,{children:[(0,l.jsx)(eh.ty,{render:(0,l.jsx)(O.$,{variant:"default",size:"default",className:`${f?"h-8":"h-9"} w-32.5 justify-start gap-1 rounded-md`}),children:(0,l.jsxs)("div",{className:"w-full flex items-center h-8 justify-between rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(d4,{className:"size-4 mr-2"}),"Deploy"]}),(0,l.jsx)(fh.A,{className:"size-4"})]})}),(0,l.jsxs)(eh.SQ,{align:"end",className:"w-50",children:[(0,l.jsx)(eh._2,{onClick:()=>g(e_.Vercel.id),children:(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)("img",{src:e_.Vercel.icon,className:"size-4 mr-2",alt:""}),e_.Vercel.label]})}),(0,l.jsx)(eh._2,{onClick:()=>g(e_.Hetzner.id),children:(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)("img",{src:e_.Hetzner.icon,className:"size-4 mr-2",alt:""}),e_.Hetzner.label]})}),(0,l.jsxs)(eh.lv,{children:[(0,l.jsxs)(eh.nV,{children:[(0,l.jsx)("img",{src:e_.Azure.icon,className:"size-4 mr-2",alt:""}),e_.Azure.label]}),(0,l.jsxs)(eh.M5,{className:"w-60",children:[(0,l.jsx)(eh._2,{disabled:!0,className:"h-auto",onClick:()=>h("azure-app-service"),children:(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("span",{children:"App Service"}),(0,l.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"Managed PaaS"})]})}),(0,l.jsx)(eh._2,{disabled:!0,className:"h-auto",onClick:()=>h("azure-container-apps"),children:(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("span",{children:"Container Apps"}),(0,l.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"Serverless containers"})]})}),(0,l.jsx)(eh._2,{className:"h-auto",onClick:()=>g(e_.Azure.id),children:(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("span",{children:"Virtual Machines"}),(0,l.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"Full IaaS"})]})})]})]}),(0,l.jsxs)(eh.lv,{children:[(0,l.jsxs)(eh.nV,{children:[(0,l.jsx)("img",{src:e_.AWS.icon,className:"size-4 mr-2",alt:""}),e_.AWS.label]}),(0,l.jsxs)(eh.M5,{className:"w-60",children:[(0,l.jsx)(eh._2,{disabled:!0,className:"h-auto",onClick:()=>h("aws-elastic-beanstalk"),children:(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("span",{children:"Elastic Beanstalk"}),(0,l.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"Managed PaaS"})]})}),(0,l.jsx)(eh._2,{disabled:!0,className:"h-auto",onClick:()=>h("aws-app-runner"),children:(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("span",{children:"App Runner / Fargate"}),(0,l.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"Serverless containers"})]})}),(0,l.jsx)(eh._2,{className:"h-auto",onClick:()=>g(e_.AWS.id),children:(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("span",{children:"EC2"}),(0,l.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"Full IaaS"})]})})]})]}),(0,l.jsxs)(eh.lv,{children:[(0,l.jsxs)(eh.nV,{children:[(0,l.jsx)("img",{src:e_.GCP.icon,className:"size-4 mr-2",alt:""}),e_.GCP.label]}),(0,l.jsxs)(eh.M5,{className:"w-60",children:[(0,l.jsx)(eh._2,{disabled:!0,className:"h-auto",onClick:()=>h("gcp-app-engine"),children:(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("span",{children:"App Engine"}),(0,l.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"Managed PaaS"})]})}),(0,l.jsx)(eh._2,{disabled:!0,className:"h-auto",onClick:()=>h("gcp-cloud-run"),children:(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("span",{children:"Cloud Run"}),(0,l.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"Serverless containers"})]})}),(0,l.jsx)(eh._2,{className:"h-auto",onClick:()=>g(e_.GCP.id),children:(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("span",{children:"Compute Engine"}),(0,l.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"Full IaaS"})]})})]})]}),(0,l.jsxs)(eh.lv,{children:[(0,l.jsxs)(eh.nV,{children:[(0,l.jsx)("img",{src:e_.DigitalOcean.icon,className:"size-4 mr-2",alt:""}),e_.DigitalOcean.label]}),(0,l.jsxs)(eh.M5,{className:"w-60",children:[(0,l.jsx)(eh._2,{disabled:!0,className:"h-auto",onClick:()=>h("digitalocean-app-platform"),children:(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("span",{children:"App Platform"}),(0,l.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"Managed PaaS"})]})}),(0,l.jsx)(eh._2,{className:"h-auto",onClick:()=>g(e_.DigitalOcean.id),children:(0,l.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("span",{children:"Droplets"}),(0,l.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"Full IaaS"})]})})]})]})]})]})]})}let fk={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};fk.node;let fl=(0,q.A)(fk);var fm=c(72417);let fn={name:"plug-zap",size:24,node:[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]],aliases:["plug-zap-2"]};fn.node;let fo=(0,q.A)(fn),fp={name:"puzzle",size:24,node:[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]};fp.node;let fq=(0,q.A)(fp),fr={name:"badge-check",size:24,node:[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["verified"]};fr.node;let fs=(0,q.A)(fr);var ft=c(14089),fu=c(24544);function fv({store:a,values:b,errors:c,onChange:d,indexType:e}){let f=(0,fu.cj)(a,b,e),[g,h]=(0,m.useState)({});return(0,l.jsx)("div",{className:"grid gap-5 sm:grid-cols-2",children:f.map(a=>{let e=b[a.key]??a.defaultValue??"",f=c[a.key],i=`store-${a.key}`;return(0,l.jsxs)("div",{className:(0,E.cn)("space-y-1.5","select"===a.type&&"sm:col-span-1"),children:[(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)(Q.J,{htmlFor:i,children:a.label}),a.required&&(0,l.jsx)("span",{className:"text-destructive","aria-hidden":!0,children:"*"}),a.secret&&(0,l.jsxs)(ft.E,{variant:"outline",className:"h-4 gap-1 px-1 text-[9px] font-mono uppercase text-muted-foreground",children:[(0,l.jsx)(d6.A,{className:"size-2.5"}),"secret"]})]}),"select"===a.type?(0,l.jsxs)(R.l6,{value:e,onValueChange:b=>d(a.key,b??""),children:[(0,l.jsx)(R.bq,{id:i,className:(0,E.cn)("w-full",f&&"border-destructive"),children:(0,l.jsx)(R.yv,{placeholder:`Select ${a.label}`})}),(0,l.jsx)(R.gC,{children:a.options?.map(a=>(0,l.jsx)(R.eb,{value:a.value,children:a.label},a.value))})]}):"password"===a.type?(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)(P.p,{id:i,type:g[a.key]?"text":"password",placeholder:a.placeholder,value:e,spellCheck:!1,autoComplete:"off",className:(0,E.cn)("font-mono text-sm pr-9",f&&"border-destructive"),onChange:b=>d(a.key,b.target.value)}),(0,l.jsx)("button",{type:"button",onClick:()=>{var b;return b=a.key,void h(a=>({...a,[b]:!a[b]}))},className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:g[a.key]?(0,l.jsx)(ai.A,{className:"size-4"}):(0,l.jsx)(aj.A,{className:"size-4"})})]}):(0,l.jsx)(P.p,{id:i,type:"text",placeholder:a.placeholder,value:e,spellCheck:!1,autoComplete:"off",className:(0,E.cn)("path"===a.type&&"font-mono text-sm",f&&"border-destructive"),onChange:b=>d(a.key,b.target.value)}),f?(0,l.jsx)("p",{className:"text-xs text-destructive",children:f}):a.help?(0,l.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:a.help}):null]},a.key)})})}var fw=c(72024);let fx={e2b:{id:"e2b",label:"E2B",description:"Firecracker-microVM sandboxes purpose-built for AI code execution, with fast cold starts.",sdkPackage:"e2b",docsUrl:"https://docs.e2b.dev/",icon:"/icons/e2b.png",executionSupport:"full",fields:[{key:"apiKey",label:"API key",type:"password",required:!0,secret:!0,placeholder:"e2b_...",help:"From the E2B dashboard. Equivalent to the E2B_API_KEY environment variable."},{key:"snapshotId",label:"Snapshot or template ID",type:"text",required:!1,help:"Optional prebuilt environment with your required packages. New executions start from it."}]},vercel:{id:"vercel",label:"Vercel Sandbox",description:"Isolated Firecracker microVMs for running arbitrary or untrusted code, billed through your Vercel account.",sdkPackage:"@vercel/sandbox",docsUrl:"https://vercel.com/docs/sandbox",icon:"/icons/vercel.svg",executionSupport:"full",fields:[{key:"token",label:"Access token",type:"password",required:!0,secret:!0,help:"Vercel access token with Sandbox permissions. Equivalent to VERCEL_TOKEN."},{key:"teamId",label:"Team ID",type:"text",required:!0,placeholder:"team_...",help:"Found in Vercel Team Settings. Equivalent to VERCEL_TEAM_ID."},{key:"projectId",label:"Project ID",type:"text",required:!0,placeholder:"prj_...",help:"The Vercel project sandboxes run under. Equivalent to VERCEL_PROJECT_ID."},{key:"snapshotId",label:"Snapshot ID",type:"text",required:!1,help:"Optional Vercel snapshot to restore for each execution."}]},modal:{id:"modal",label:"Modal",description:"Sandboxes for executing untrusted user or agent code in secure containers on Modal’s compute platform.",sdkPackage:"modal",docsUrl:"https://modal.com/docs/guide/sandboxes",icon:"/icons/modal.png",executionSupport:"full",fields:[{key:"tokenId",label:"Token ID",type:"text",required:!0,placeholder:"ak-...",help:"From `modal setup` or the Modal dashboard. Equivalent to MODAL_TOKEN_ID."},{key:"tokenSecret",label:"Token secret",type:"password",required:!0,secret:!0,placeholder:"as-...",help:"Equivalent to MODAL_TOKEN_SECRET."}]},daytona:{id:"daytona",label:"Daytona",description:"Elastic infrastructure for running AI-generated code in fast, isolated sandboxes.",sdkPackage:"@daytona/sdk",docsUrl:"https://www.daytona.io/docs/en/sandboxes/",icon:"/icons/daytonaio.png",executionSupport:"full",fields:[{key:"apiKey",label:"API key",type:"password",required:!0,secret:!0,help:"From the Daytona dashboard. Equivalent to DAYTONA_API_KEY."},{key:"apiUrl",label:"API URL",type:"text",required:!1,placeholder:"https://app.daytona.io/api",help:"Only needed for a self-hosted Daytona instance."},{key:"snapshot",label:"Snapshot",type:"text",required:!1,help:"Optional Daytona snapshot containing the dependencies your agent needs."}]},browserbase:{id:"browserbase",label:"Browserbase",description:"Headless-Chrome browser sessions for Playwright/Puppeteer automation.",sdkPackage:"@browserbasehq/sdk",docsUrl:"https://docs.browserbase.com/welcome/introduction",icon:"/icons/browserbase.png",executionSupport:"unsupported",executionCaveat:"Browserbase provisions remote browser sessions reachable over CDP for Playwright/Puppeteer — it does not run arbitrary Python/JS and return stdout the way a code-execution sandbox does. Verify still checks your API key and project, but code-execution tools (data analysis, corpus analytics) need a different provider.",fields:[{key:"apiKey",label:"API key",type:"password",required:!0,secret:!0,help:"Equivalent to BROWSERBASE_API_KEY."},{key:"projectId",label:"Project ID",type:"text",required:!0,help:"Equivalent to BROWSERBASE_PROJECT_ID."}]},flyio:{id:"flyio",label:"Fly.io Sprites",description:"Persistent, fast-suspending Linux VM sandboxes for AI agents, built on Fly Machines.",sdkPackage:"@fly/sprites",docsUrl:"https://fly.io/sprites/",icon:"/icons/flyio.jpeg",executionSupport:"full",fields:[{key:"token",label:"Sprite token",type:"password",required:!0,secret:!0,help:"From `sprite org auth` or the Fly dashboard. Equivalent to SPRITE_TOKEN."}]},northflank:{id:"northflank",label:"Northflank",description:"On-demand sandbox containers running as Northflank services in your own project.",sdkPackage:"@northflank/js-client",docsUrl:"https://northflank.com/docs/v1/application/sandboxes/sandboxes-on-northflank",icon:"/icons/Northflank.png",executionSupport:"full",fields:[{key:"token",label:"API token",type:"password",required:!0,secret:!0,help:"A personal or team API token from Northflank → Account → API Tokens."},{key:"projectId",label:"Project ID",type:"text",required:!0,help:"The Northflank project sandbox services are created in."}]},cloudflare:{id:"cloudflare",label:"Cloudflare Sandbox",description:"Container sandboxes running inside a Cloudflare Worker via the Durable Object Sandbox SDK.",sdkPackage:"@cloudflare/sandbox",docsUrl:"https://developers.cloudflare.com/sandbox/",icon:"/icons/cloudflare.png",executionSupport:"unsupported",executionCaveat:"@cloudflare/sandbox only runs inside a Cloudflare Worker through a Durable Object binding declared in wrangler config. There is no external REST API to create or run commands in a sandbox from this server. Verify checks your account API token; actually running code here requires deploying a Worker with the Sandbox binding.",fields:[{key:"apiToken",label:"API token",type:"password",required:!0,secret:!0,help:"Used only to verify account access."},{key:"accountId",label:"Account ID",type:"text",required:!0}]},webcontainers:{id:"webcontainers",label:"WebContainers",description:"In-browser WebAssembly Node.js runtime for running full-stack apps client-side.",sdkPackage:"@webcontainer/api",docsUrl:"https://webcontainers.io/",icon:"/icons/webcontainers.svg",executionSupport:"unsupported",executionCaveat:"WebContainers boots entirely inside a cross-origin-isolated browser tab (it needs SharedArrayBuffer). There is no Node.js/server-side way to run it, so this backend cannot execute code from here. Use @webcontainer/api directly in your frontend for in-browser execution instead.",fields:[{key:"apiKey",label:"License key (optional)",type:"password",required:!1,secret:!0,help:"StackBlitz-issued commercial key for production embeds. Leave blank for local/prototype use."}]}},fy=Object.values(fx);var fz=c(18806);let fA=a=>fetch(a).then(a=>a.json()),fB="Local Sandbox";function fC({embedded:a=!1,onProviderChange:b,children:c}){let{data:d,isLoading:e,mutate:f}=(0,H.u)("/api/config",fA),[g,h]=(0,m.useState)({}),[i,j]=(0,m.useState)("local"),[k,n]=(0,m.useState)("/icons/linux.png"),[o,p]=(0,m.useState)(!1),[q,r]=(0,m.useState)(!1),[s,t]=(0,m.useState)(!1);(0,m.useRef)(!1);let u=function(a){if("local"!==a&&"docker"!==a&&"custom"!==a)return fx[a]}(i),v=g.sandboxProviderConfigs?.[i]??{},w=i!==(d?.config?.defaultSandboxProvider||"local")||JSON.stringify(v)!==JSON.stringify(d?.config?.sandboxProviderConfigs?.[i]??{});async function x(a){t(!0);try{let b=await fetch("/api/sandbox/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:i,credentials:v})}),c=await b.json();if(!b.ok)throw Error(c.error||"Verification failed");return a&&S.oR.success(`${u?.label??("docker"===i?"Local Docker":fB)} credentials verified!`,{position:"top-right"}),!0}catch(b){let a=b instanceof Error?b.message:"Verification failed";return S.oR.error(a,{position:"top-right"}),!1}finally{t(!1)}}async function y(){p(!0);try{if("local"!==i&&!await x(!1))return;let a={...d?.config,defaultSandboxProvider:i,sandboxProviderConfigs:g.sandboxProviderConfigs??{}},b=await fetch("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();if(!b.ok)throw Error(c.error??"Failed to save");h(a=>({...a,...c.config})),await f(c,{revalidate:!1}),S.oR.success("Sandbox settings saved")}catch(a){S.oR.error(a instanceof Error?a.message:"Failed to save")}finally{p(!1)}}async function z(){await x(!0)}if(e)return(0,l.jsx)("div",{className:"flex h-40 items-center justify-center",children:(0,l.jsx)(M.A,{className:"size-5 animate-spin text-muted-foreground"})});let A=(0,l.jsxs)(T.Zp,{className:"bg-white/70 dark:bg-card/70",children:[(0,l.jsxs)(T.aR,{className:"pb-3",children:[(0,l.jsx)(T.ZB,{className:"text-sm",children:"Code execution"}),(0,l.jsx)(T.BT,{className:"text-xs",children:"Choose where code-enabled Assistant tools run, and verify any provider credentials here."})]}),(0,l.jsxs)(T.Wu,{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Provider"}),(0,l.jsxs)(R.l6,{value:i,onValueChange:a=>{j(a),b?.(a)},children:[(0,l.jsx)(R.bq,{className:"w-full",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(dS(),{src:u?.icon??("local"===i?k:"/docker.png"),alt:"",width:16,height:16}),(0,l.jsx)(R.yv,{placeholder:"Select provider",children:a=>"local"===a?fB:"docker"===a?"Local Docker":u?.label??a})]})}),(0,l.jsxs)(R.gC,{children:[(0,l.jsx)(R.eb,{value:"local",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(dS(),{src:k,alt:"Local Sandbox",width:16,height:16}),(0,l.jsx)("span",{children:fB})]})}),(0,l.jsx)(R.eb,{value:"docker",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(dS(),{src:"/docker.png",alt:"Docker",width:16,height:16}),(0,l.jsx)("span",{children:"Local Docker"})]})}),fy.filter(a=>"full"===a.executionSupport).map(a=>(0,l.jsx)(R.eb,{value:a.id,children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(dS(),{src:a.icon,alt:a.label,width:16,height:16}),(0,l.jsx)("span",{children:a.label})]})},a.id))]})]}),"local"===i&&(0,l.jsx)("p",{className:"pt-1 text-xs text-muted-foreground",children:"Runs trusted Python or JavaScript on this computer. No Docker or credentials needed."}),"docker"===i&&(0,l.jsx)("p",{className:"pt-1 text-xs text-muted-foreground",children:"Runs in a local Docker container. No credentials required — requires Docker to be installed and running."})]}),u&&"unsupported"===u.executionSupport&&(0,l.jsxs)(fz.Fc,{children:[(0,l.jsx)(fw.A,{className:"size-4 text-amber-500"}),(0,l.jsx)(fz.TN,{children:u.executionCaveat})]}),u&&u.fields.length>0&&(0,l.jsxs)("div",{className:"space-y-4 pt-2",children:[(0,l.jsxs)(Q.J,{className:"text-xs",children:[u.label," credentials"]}),(0,l.jsx)("div",{className:"flex items-center gap-1",children:(0,l.jsx)("div",{className:"w-full",children:u.fields.map((a,b)=>(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsxs)(Q.J,{className:"text-xs",htmlFor:`sandbox-${i}-${a.key}`,children:[a.label,a.required&&(0,l.jsx)("span",{className:"text-destructive",children:" *"})]}),(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)(P.p,{id:`sandbox-${i}-${a.key}`,type:"password"!==a.type||q?"text":"password",className:"password"===a.type?"text-sm pr-9":"text-sm",value:v[a.key]??"",onChange:b=>{var c,d;return c=a.key,d=b.target.value,void h(a=>({...a,sandboxProviderConfigs:{...a.sandboxProviderConfigs,[i]:{...a.sandboxProviderConfigs?.[i],[c]:d}}}))},placeholder:a.placeholder}),"password"===a.type&&(0,l.jsx)("button",{type:"button",onClick:()=>r(!q),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground","aria-label":q?"Hide secret":"Show secret",children:q?(0,l.jsx)(ai.A,{className:"size-3.5"}):(0,l.jsx)(aj.A,{className:"size-3.5"})})]}),a.help&&(0,l.jsxs)("div",{className:"flex items-center justify-start gap-2",children:[(0,l.jsx)("p",{className:"text-[11px] text-muted-foreground",children:a.help}),0===b&&(0,l.jsxs)("a",{href:u.docsUrl,target:"_blank",rel:"noreferrer",className:"inline-flex underline shrink-0 items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground",children:["Docs ",(0,l.jsx)(d0.A,{className:"size-3"})]})]})]},a.key))})})]}),c]}),(0,l.jsxs)(T.wL,{className:"flex justify-end gap-2 border-t pt-4",children:["local"!==i&&(0,l.jsxs)(O.$,{variant:"outline",size:"lg",onClick:z,disabled:s,children:[s?(0,l.jsx)(M.A,{className:"size-3.5 animate-spin"}):null,"Verify"]}),(0,l.jsxs)(O.$,{size:"lg",disabled:o||s||!w,onClick:y,className:"gap-1.5 px-4",children:[o?(0,l.jsx)(M.A,{className:"size-3.5 animate-spin"}):(0,l.jsx)(N.A,{className:"size-3.5"}),"Save sandbox settings"]})]})]});return a?A:(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsx)("div",{className:"flex items-center justify-between",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-lg font-semibold tracking-tight",children:"Code Execution Sandbox"}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:"Choose where Assistant tools that run code (e.g. data analysis, corpus analytics) execute, and connect the provider's credentials."})]})}),A]})}var fD=c(69865);let fE={lancedb:{iconSrc:"/icons/lancedb2.png",pillBg:"bg-yellow-50 dark:bg-yellow-950/40"},pinecone:{iconSrc:"/icons/pinecone.png",pillBg:"bg-green-50 dark:bg-green-950/40"}};var fF=c(70079);let fG=(0,e1.v)()((0,fF.Zr)(a=>({vercelToken:"",vercelProject:"",sshCredentials:{},deployStorage:{},setVercelToken:b=>a({vercelToken:b}),setVercelProject:b=>a({vercelProject:b}),setSshCredential:(b,c)=>a(a=>({sshCredentials:{...a.sshCredentials,[b]:c}})),setDeployStorage:b=>a(a=>({deployStorage:{...a.deployStorage,...b}}))}),{name:"larkup-deploy-credentials"})),fH=(0,e1.v)()(a=>({open:!1,logs:[],state:"deploying",url:void 0,error:void 0,openTerminal:()=>a({open:!0}),closeTerminal:()=>a({open:!1}),reset:()=>a({logs:[],state:"deploying",url:void 0,error:void 0}),appendLog:b=>a(a=>({logs:[...a.logs,b]})),setState:b=>a({state:b}),setUrl:b=>a({url:b}),setError:b=>a({error:b})}));function fI({open:a,onSubmit:b,onCancel:c}){let[d,e]=(0,m.useState)(""),[f,g]=(0,m.useState)(""),[h,i]=(0,m.useState)(!1),[j,k]=(0,m.useState)(!1),n=()=>{d?d!==f?S.oR.error("Passwords do not match.",{position:"bottom-left"}):d.length<8?S.oR.error("Password must be at least 8 characters.",{position:"bottom-left"}):(b(d),e(""),g("")):S.oR.error("Enter a new password.",{position:"bottom-left"})};return(0,l.jsx)(dx.lG,{open:a,onOpenChange:a=>!a&&c(),children:(0,l.jsxs)(dx.Cf,{className:"sm:max-w-md",children:[(0,l.jsx)(dx.c7,{children:(0,l.jsxs)("div",{className:"flex items-center gap-3 mb-1",children:[(0,l.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-amber-100 dark:bg-amber-900/30",children:(0,l.jsx)(dZ,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)(dx.L3,{children:"Password Change Required"}),(0,l.jsx)(dx.rr,{className:"text-xs mt-0.5",children:"Your server requires a password change on first login."})]})]})}),(0,l.jsxs)("div",{className:"space-y-4 mt-2",children:[(0,l.jsx)("p",{className:"text-xs text-muted-foreground rounded-lg bg-muted/50 p-3 border",children:"This is common for first-time logins on Hetzner, AWS EC2, DigitalOcean, and similar providers. Your chosen password will be used to continue deployment."}),(0,l.jsxs)("div",{className:"grid gap-2",children:[(0,l.jsx)(Q.J,{children:"New Password"}),(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)(P.p,{type:h?"text":"password",value:d,onChange:a=>e(a.target.value),placeholder:"Enter new root password",className:"pr-10",onKeyDown:a=>"Enter"===a.key&&n()}),(0,l.jsx)("button",{type:"button",onClick:()=>i(!h),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:h?(0,l.jsx)(ai.A,{className:"size-4"}):(0,l.jsx)(aj.A,{className:"size-4"})})]})]}),(0,l.jsxs)("div",{className:"grid gap-2",children:[(0,l.jsx)(Q.J,{children:"Confirm Password"}),(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)(P.p,{type:j?"text":"password",value:f,onChange:a=>g(a.target.value),placeholder:"Re-enter new password",className:"pr-10",onKeyDown:a=>"Enter"===a.key&&n()}),(0,l.jsx)("button",{type:"button",onClick:()=>k(!j),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:j?(0,l.jsx)(ai.A,{className:"size-4"}):(0,l.jsx)(aj.A,{className:"size-4"})})]})]}),(0,l.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,l.jsx)(O.$,{variant:"outline",className:"flex-1",onClick:c,children:"Cancel"}),(0,l.jsx)(O.$,{className:"flex-1",onClick:n,children:"Change & Deploy"})]})]})]})})}function fJ({url:a,targetLabel:b,onViewDeployment:c}){let[d,e]=(0,m.useState)(!1);return(0,l.jsxs)("div",{className:"flex flex-col items-center gap-6 py-6 text-center",children:[(0,l.jsx)("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-green-600 border-green-700 dark:bg-emerald-900/30 ring-4 ring-emerald-50 dark:ring-emerald-900/10",children:(0,l.jsx)(as.A,{className:"h-8 w-8 text-white"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:"text-xl font-semibold tracking-tight",children:"Agent is Live!"}),(0,l.jsxs)("p",{className:"mt-1 text-sm text-muted-foreground",children:["Your ",b," server is running and ready to receive requests."]})]}),(0,l.jsxs)("div",{className:"w-full rounded-xl border bg-muted/30 p-4 space-y-2",children:[(0,l.jsx)("p",{className:"text-xs font-medium text-muted-foreground text-left",children:"SERVER ENDPOINT"}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("code",{className:"flex-1 truncate rounded-lg bg-background border px-3 py-2 text-sm font-mono",children:a}),(0,l.jsxs)(O.$,{size:"sm",variant:"outline",className:"shrink-0 gap-1.5",onClick:()=>{navigator.clipboard.writeText(a),e(!0),setTimeout(()=>e(!1),2e3)},children:[d?(0,l.jsx)(dW.A,{className:"size-3.5 text-emerald-500"}):(0,l.jsx)(d5.A,{className:"size-3.5"}),d?"Copied":"Copy"]}),(0,l.jsx)(O.$,{size:"sm",variant:"outline",className:"shrink-0",onClick:()=>window.open(a,"_blank"),children:(0,l.jsx)(d0.A,{className:"size-3.5"})})]})]}),(0,l.jsxs)("div",{className:"w-full rounded-xl border border-dashed bg-muted/10 p-4 text-left space-y-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(u.A,{className:"size-4 text-muted-foreground"}),(0,l.jsx)("p",{className:"text-sm font-medium",children:"Want a custom domain?"})]}),(0,l.jsxs)("ol",{className:"text-xs text-muted-foreground space-y-1 list-decimal list-inside pl-1",children:[(0,l.jsxs)("li",{children:["Point your domain's ",(0,l.jsx)("strong",{children:"A record"})," to the server IP."]}),(0,l.jsxs)("li",{children:["SSH in and install ",(0,l.jsx)("strong",{children:"nginx + certbot"})," for HTTPS/SSL."]}),(0,l.jsxs)("li",{children:["Or use ",(0,l.jsx)("strong",{children:"Cloudflare proxy"})," (free SSL, no nginx needed)."]})]}),(0,l.jsx)("p",{className:"text-[10px] text-muted-foreground/70 italic pt-1",children:"Full automated custom domain setup is coming in a future release."})]}),(0,l.jsx)(O.$,{className:"w-full",onClick:c,children:"View Deployment"})]})}function fK({logs:a,isLive:b}){let c=(0,m.useRef)(null);return(0,l.jsxs)("div",{className:"relative flex flex-col aspect-video w-full rounded-xl overflow-hidden border border-zinc-700 bg-[#0d0d0d]",children:[(0,l.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 px-3 py-2 border-b border-zinc-800 bg-zinc-900",children:[(0,l.jsx)("div",{className:"h-2.5 w-2.5 rounded-full bg-red-500/80"}),(0,l.jsx)("div",{className:"h-2.5 w-2.5 rounded-full bg-amber-500/80"}),(0,l.jsx)("div",{className:"h-2.5 w-2.5 rounded-full bg-emerald-500/80"}),(0,l.jsx)(B,{className:"ml-2 size-3 text-zinc-500"}),(0,l.jsx)("span",{className:"ml-1 text-[10px] font-medium text-zinc-500",children:"larkup — deploy"}),b&&(0,l.jsxs)("span",{className:"ml-auto flex items-center gap-1 text-[10px] text-emerald-400",children:[(0,l.jsxs)("span",{className:"relative flex h-1.5 w-1.5",children:[(0,l.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),(0,l.jsx)("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-emerald-500"})]}),"Live"]})]}),(0,l.jsxs)("div",{className:"flex-1 overflow-y-auto px-3 py-2 font-mono text-[11px] leading-relaxed",children:[0===a.length?(0,l.jsx)("span",{className:"text-zinc-600",children:"Initialising..."}):a.map((a,b)=>(0,l.jsxs)("div",{className:"whitespace-pre-wrap break-all",children:[(0,l.jsx)("span",{className:"text-zinc-600 select-none mr-2",children:"$"}),(0,l.jsx)("span",{className:a.startsWith("✓")||a.toLowerCase().includes("connected")||a.toLowerCase().includes("live")?"text-emerald-400":a.toLowerCase().includes("error")||a.toLowerCase().includes("failed")?"text-red-400":a.startsWith("$")?"text-cyan-400":a.startsWith("---")?"text-amber-400":"text-zinc-300",children:a})]},b)),(0,l.jsx)("div",{ref:c})]})]})}function fL({targetLabel:a,onPasswordSubmit:b,onClose:c,onViewDeployment:d}){let{open:e,logs:f,state:g,url:h,error:i}=fH(),j="success"===g,k="error"===g,m="password_required"===g,n="deploying"===g,o=n?`Setting up ${a} server...`:k?"Deployment failed":j?"Deployment complete":"Action required";return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(fI,{open:m,onSubmit:b,onCancel:c}),(0,l.jsx)(dx.lG,{open:e&&!m,onOpenChange:a=>!a&&!n&&c(),children:(0,l.jsx)(dx.Cf,{className:"sm:max-w-3xl ",children:j&&h?(0,l.jsx)(fJ,{url:h,targetLabel:a,onViewDeployment:d}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(dx.c7,{children:(0,l.jsxs)("div",{className:"flex items-center gap-3 mb-1",children:[(0,l.jsx)("div",{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-full ${k?"bg-red-100 dark:bg-red-900/30":"bg-zinc-100 dark:bg-zinc-800"}`,children:n?(0,l.jsx)(M.A,{className:"h-5 w-5 animate-spin text-zinc-600 dark:text-zinc-400"}):k?(0,l.jsx)(dX.A,{className:"h-5 w-5 text-red-600 dark:text-red-400"}):(0,l.jsx)(B,{className:"h-5 w-5 text-zinc-600 dark:text-zinc-400"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)(dx.L3,{children:o}),(0,l.jsx)(dx.rr,{className:"text-xs mt-0.5",children:n?`Larkup is automatically configuring your ${a} server. This may take a few minutes.`:k?"The deployment encountered an error. Check the logs below for details.":""})]})]})}),(0,l.jsx)(fK,{logs:f,isLive:n}),k&&i&&(0,l.jsx)("div",{className:"rounded-lg bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-900 px-3 py-2",children:(0,l.jsx)("p",{className:"text-xs font-medium text-red-700 dark:text-red-400",children:i})}),(0,l.jsx)("div",{className:"flex justify-end gap-3 pt-1",children:(0,l.jsx)(O.$,{variant:k?"default":"outline",size:"sm",onClick:c,disabled:n,children:k?"Close":"Cancel"})})]})})})]})}let fM=a=>fetch(a).then(a=>a.json()),fN=["openai","deepseek","google","mistral","cohere","vercel_ai_gateway"],fO={openai:"openai/gpt-4o-mini",deepseek:"deepseek/deepseek-chat",google:"google/gemini-3.6-flash",mistral:"mistral/mistral-large-latest",cohere:"cohere/command-r-plus",vercel_ai_gateway:"openai/gpt-4o-mini"};function fP({items:a,selected:b,onChange:c,getId:d,getLabel:e,getDescription:f,getIcon:g,isPlugin:h,emptyState:i}){return(0,l.jsxs)("div",{className:"space-y-3",children:[0===a.length&&(i||(0,l.jsx)("p",{className:"rounded-lg border border-dashed p-5 text-sm text-muted-foreground",children:"No items found."})),(0,l.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 pb-4",children:a.map(a=>{let i=g?g(a):null,j=!!h&&h(a);return(0,l.jsxs)("div",{className:"flex min-h-22 items-center gap-3 rounded-xl border bg-white/70 px-4 py-4 dark:bg-card/70",children:[(0,l.jsx)("div",{className:"flex shrink-0 h-10 w-10 items-center justify-center rounded-lg border bg-muted/40",children:i?(0,l.jsx)(i,{className:"w-4.5 h-4.5 text-muted-foreground"}):(0,l.jsx)("div",{className:"w-4.5 h-4.5"})}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("p",{className:"text-sm font-medium leading-none",children:[e(a),j&&(0,l.jsx)("span",{className:"ml-2 rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-normal text-muted-foreground",children:"Plugin"})]}),f&&(0,l.jsx)("p",{className:"mt-0.5 line-clamp-1 text-xs text-muted-foreground",children:f(a)})]}),(0,l.jsx)(d8.d,{checked:b.includes(d(a)),onCheckedChange:()=>{var e;return e=d(a),void(b.includes(e)?c(b.filter(a=>a!==e)):c([...b,e]))}})]},d(a))})})]})}function fQ({target:a,serverId:b="default",profile:c,onSaved:d,onBack:e,onDeployed:f}){let g,[h,i]=(0,m.useState)("1"),[j,k]=(0,m.useState)(null),[n,o]=(0,m.useState)(c??"knowledge"),p=e0(a),q=p?.kind==="serverless",{data:r}=(0,H.u)("/api/config",fM),[s,t]=(0,m.useState)("lancedb"),[u,v]=(0,m.useState)({}),[w,y]=(0,m.useState)({}),[z,A]=(0,m.useState)(!0),[B,C]=(0,m.useState)(""),[D,E]=(0,m.useState)("project"),[F,G]=(0,m.useState)(""),[I,J]=(0,m.useState)(""),[K,L]=(0,m.useState)(!1),[N,T]=(0,m.useState)(!1),[U,V]=(0,m.useState)(!1),[W,X]=(0,m.useState)(!1),[Y,Z]=(0,m.useState)(!1),[$,aa]=(0,m.useState)(null),[ab,ac]=(0,m.useState)("prompt"),[ad,ae]=(0,m.useState)(!1),[af,ag]=(0,m.useState)(""),[ak,al]=(0,m.useState)(""),[am,an]=(0,m.useState)([]),[ap,aq]=(0,m.useState)([]),[ar,as]=(0,m.useState)([]),[at,au]=(0,m.useState)([]),[av,aw]=(0,m.useState)({}),[ax,ay]=(0,m.useState)(""),[az,aA]=(0,m.useState)(!1),[aB,aC]=(0,m.useState)(""),[aD,aE]=(0,m.useState)(""),[aF,aG]=(0,m.useState)(!1),[aH,aI]=(0,m.useState)(""),[aJ,aK]=(0,m.useState)("root"),[aL,aM]=(0,m.useState)("password"),[aN,aO]=(0,m.useState)(""),[aP,aQ]=(0,m.useState)(!1),[aR,aS]=(0,m.useState)(!1),aT=fH(),{deployToVps:aU}=(g=fH(),{deployToVps:(0,m.useCallback)(async a=>{g.reset(),g.openTerminal(),g.setState("deploying");try{let b=await fetch("/api/deploy/ssh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.body)throw Error("No response stream from server.");let c=b.body.getReader(),e=new TextDecoder,f="";for(;;){let{value:b,done:h}=await c.read();if(h)break;let i=(f+=e.decode(b,{stream:!0})).split("\n\n");for(let b of(f=i.pop()??"",i))if(b.startsWith("data: "))try{let c=JSON.parse(b.slice(6));switch(c.type){case"log":g.appendLog(c.message);break;case"password_change_required":g.setState("password_required");return;case"password_changed":g.appendLog("--- Password changed. Reconnecting... ---");break;case"done":c.success&&(a.deployConfig.apiKey&&c.deploymentId&&(c.deploymentId,a.deployConfig.apiKey),g.setUrl(c.url),g.setState("success"),d());break;case"error":g.setError(c.error||"Deployment failed."),g.setState("error")}}catch{}}}catch(a){g.setError(a?.message||"Deployment failed."),g.setState("error")}},[g,d])}),aV=fG(),{data:aW}=(0,H.u)("/api/mcp",fM),{data:aX}=(0,H.u)("/api/marketplace",fM),aY=aW?.connections||[],aZ=(0,m.useMemo)(()=>(aX?.tools||[]).filter(a=>"installed"===a.status),[aX]),a$=(0,m.useMemo)(()=>{if(!r?.config)return[];let a=r.config.embeddingProvider,b=[...dL.vx.filter(b=>"vercel_ai_gateway"===a||b.provider===a),...(r.config.customEmbeddings??[]).map(a=>({id:`custom:${a.modelName}`,label:a.modelName}))];return b.some(a=>a.id===r.config.embeddingModelId)?b:[{id:r.config.embeddingModelId,label:r.config.embeddingModelId},...b]},[r?.config]),a_=a$.find(a=>a.id===B)??a$[0],a0=r?.config.chatProvider||r?.config.embeddingProvider||"openai",a1="project"===D?a0:D,a2="project"===D?r?.config.chatModelId||fO[a1]||fO.openai:F,a3=(0,fu.jX)(s),a4="lancedb"===s&&(u.mode??"local")==="local";async function a5(){if(!r?.config)return!1;let a=(0,fu.KB)(a3,u,r.config.indexType);if(Object.keys(a).length>0)return y(a),i("2"),S.oR.error("Complete the required storage fields before verifying.",{position:"bottom-left"}),!1;T(!0);try{let a=await fetch("/api/config/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r.config,vectorStore:s,storeConfig:u,embeddingModelId:B})}),b=await a.json();if(!a.ok)throw b.fieldErrors&&y(b.fieldErrors),Error(b.error??"Connection failed");return V(!0),S.oR.success("Storage credentials verified.",{position:"bottom-left"}),!0}catch(b){V(!1);let a=b instanceof Error?b.message:"Connection failed";return S.oR.error(a,{position:"bottom-left"}),!1}finally{T(!1)}}async function a6(b=!1){if(k(null),"env"===a){X(!0),i("2");return}if(p?.id==="Vercel"){if(!aB||!aD){k("1"),S.oR.error("Please enter both a Vercel Token and a Project name.",{position:"bottom-left"});return}}else if(!aH||!aJ||!aN){k("1"),S.oR.error("Please fill in all SSH connection details.",{position:"bottom-left"});return}Z(!0);try{let a=await fetch("/api/deploy/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:p?.id,createProject:b,credentials:p?.id==="Vercel"?{vercelToken:aB,vercelProject:aD}:{sshHost:aH,sshUsername:aJ,sshAuthType:aL,sshKeyOrPassword:aN}})}),c=await a.json();if(!a.ok||!c.success){if(c.projectNotFound)return void aa(aD);throw Error(c.error||"Verification failed")}aa(null),X(!0),i("2"),S.oR.success(c.created?"Project created and verified!":"Provider credentials verified!",{position:"bottom-left"})}catch(a){X(!1),S.oR.error(a.message||"Failed to verify provider credentials",{position:"bottom-left"})}finally{Z(!1)}}async function a7(){if(k(null),!W&&"env"!==a)return void i("1");if("project"!==D&&(!F.trim()||!I.trim())){i("2"),S.oR.error("Choose a chat model and provide an API key for the deployment provider.");return}if(q&&a4){k("2"),S.oR.error("Vercel uses ephemeral storage — local LanceDB data will not persist. Configure S3-compatible (LANCEDB_MODE=s3) or LanceDB Cloud (LANCEDB_MODE=cloud) storage before deploying to Vercel.",{position:"bottom-left",duration:8e3});return}if(!U&&!await a5())return void k("2");if(p&&"vps"===p.kind){let a="assistant"===n?{systemPrompt:af,enabledTools:am,enabledMcp:ap,enabledSkills:ar,enabledPlugins:at,sandboxProvider:ak||void 0}:void 0;aU({provider:p.id,profile:n,assistantOptions:a,deployConfig:{vectorStore:s,storeConfig:u,embeddingModelId:B,..."project"!==D?{chatProvider:a1,chatModelId:F.trim(),chatApiKey:I.trim()}:{},saveStorageSettings:z,envValues:av,apiKey:ax,credentials:{sshHost:aH,sshUsername:aJ,sshAuthType:aL,sshKeyOrPassword:aN}}});return}try{aS(!0);let a="assistant"===n?{systemPrompt:af,enabledTools:am,enabledMcp:ap,enabledSkills:ar,enabledPlugins:at,sandboxProvider:ak||void 0}:void 0,b={vectorStore:s,storeConfig:u,embeddingModelId:B,..."project"!==D?{chatProvider:a1,chatModelId:F.trim(),chatApiKey:I.trim()}:{},saveStorageSettings:z,envValues:av,apiKey:ax,credentials:p?.id==="Vercel"?{vercelToken:aB,vercelProject:aD}:{sshHost:aH,sshUsername:aJ,sshAuthType:aL,sshKeyOrPassword:aN}},c=await fetch("/api/projects/deployments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:p?.id,profile:n,assistantOptions:a,deployConfig:b})}),g=await c.json();if(!c.ok)throw Error(g.error||"Could not save deployment.");ax&&"string"==typeof g.deployment?.id&&g.deployment.id,S.oR.success("Deployment started. The remote URL has been added to this Project."),d(),f?f():e()}catch(a){S.oR.error(a instanceof Error?a.message:"Could not save deployment.")}finally{aS(!1)}}return(0,l.jsxs)("div",{className:"flex flex-col h-full w-full max-w-5xl mx-auto animate-in fade-in-0 duration-200 pb-20",children:[(0,l.jsx)(fL,{targetLabel:p?.label??"Server",onPasswordSubmit:a=>{if(!p)return;let b="assistant"===n?{systemPrompt:af,enabledTools:am,enabledMcp:ap,enabledSkills:ar,enabledPlugins:at,sandboxProvider:ak||void 0}:void 0;aU({provider:p.id,profile:n,assistantOptions:b,deployConfig:{vectorStore:s,storeConfig:u,embeddingModelId:B,..."project"!==D?{chatProvider:a1,chatModelId:F.trim(),chatApiKey:I.trim()}:{},saveStorageSettings:z,envValues:av,apiKey:ax,credentials:{sshHost:aH,sshUsername:aJ,sshAuthType:aL,sshKeyOrPassword:aN,newPassword:a}}})},onClose:()=>{"deploying"!==aT.state&&aT.closeTerminal()},onViewDeployment:()=>{aT.closeTerminal(),f?f():e()}}),(0,l.jsx)(_.Lt,{open:!!$,onOpenChange:a=>!a&&aa(null),children:(0,l.jsxs)(_.EO,{children:[(0,l.jsxs)(_.wd,{children:[(0,l.jsx)(_.r7,{children:"Project Not Found"}),(0,l.jsxs)(_.$v,{children:["The Vercel project '",$,"' does not exist. Would you like to create it now?"]})]}),(0,l.jsxs)(_.ck,{children:[(0,l.jsx)(_.Zr,{children:"Cancel"}),(0,l.jsx)(_.Rx,{onClick:()=>a6(!0),children:"Create Project"})]})]})}),(0,l.jsx)("div",{className:"flex items-center mb-8",children:(0,l.jsxs)(O.$,{variant:"ghost",size:"sm",onClick:e,className:"-ml-2 text-muted-foreground hover:text-foreground",children:[(0,l.jsx)(fl,{className:"mr-2 size-4"}),"Back to Server settings"]})}),(0,l.jsxs)("div",{className:"space-y-1 mb-5",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[p&&(0,l.jsx)("span",{className:"flex size-9 items-center justify-center rounded-lg border bg-muted/30",children:(0,l.jsx)("img",{src:p.icon,alt:"",className:"size-5 object-contain"})}),(0,l.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:"env"===a?"Environment Settings":`Deploy ${"assistant"===n?"Agent":"Knowledge"} to ${p?.label??a}`})]}),(0,l.jsx)("p",{className:"text-muted-foreground",children:"env"===a?"Configure environment variables and storage.":"Configure your deployment settings before launching."})]}),(0,l.jsxs)("div",{className:" mt-5",children:["env"!==a&&(0,l.jsxs)("div",{className:"flex items-center gap-6 mb-6 border-b pb-4",children:[(0,l.jsxs)("div",{onClick:()=>i("1"),className:`group flex items-center gap-2 cursor-pointer transition-colors ${"1"===h?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,l.jsx)("div",{className:`flex size-6 items-center justify-center rounded-full text-xs font-medium transition-colors ${"1"===h?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground group-hover:bg-muted/80 group-hover:text-foreground"}`,children:"1"}),(0,l.jsx)("span",{className:"text-sm font-medium",children:"Provider Settings"})]}),(0,l.jsx)("div",{className:"h-px w-8 bg-border"}),(0,l.jsxs)("div",{onClick:()=>i("2"),className:`group flex items-center gap-2 cursor-pointer transition-colors ${"2"===h?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,l.jsx)("div",{className:`flex size-6 items-center justify-center rounded-full text-xs font-medium transition-colors ${"2"===h?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground group-hover:bg-muted/80 group-hover:text-foreground"}`,children:"2"}),(0,l.jsx)("span",{className:"text-sm font-medium",children:"Server Configuration"})]})]}),(0,l.jsxs)("div",{className:`mt-2 space-y-6 ${"2"!==h?"hidden":"block"}`,children:["assistant"===n&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"space-y-4 rounded-xl border bg-white p-5 flex items-center justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:"text-sm font-semibold tracking-tight",children:"Agent Customization"}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Configure prompt, tools, plugins, skills, and MCP."})]}),(0,l.jsxs)(dx.lG,{open:ad,onOpenChange:a=>{ae(a),a||S.oR.success("Agent customization changes have been saved for this deployment.")},children:[(0,l.jsx)(dx.zM,{className:"inline-flex items-center justify-center rounded-md bg-primary text-primary-foreground hover:bg-primary/80 px-4 py-2 text-sm font-medium cursor-pointer",children:"Customize Agent"}),(0,l.jsxs)(dx.Cf,{className:"w-[90vw] h-[90vh] max-w-350 max-h-225 sm:max-w-[90vw] flex flex-col p-0",children:[(0,l.jsxs)(dx.c7,{className:"p-6 border-b pb-4",children:[(0,l.jsx)(dx.L3,{children:"Agent Customization"}),(0,l.jsx)(dx.rr,{children:"Configure how your agent behaves in this deployment."})]}),(0,l.jsx)("div",{className:"flex-1 overflow-hidden flex flex-col p-5 pt-1 bg-white",children:(0,l.jsxs)(eW,{value:ab,onValueChange:ac,className:"flex-1 flex flex-col h-full",children:[(0,l.jsxs)(eY,{className:"flex items-center gap-1 rounded-lg bg-white/60 p-1 h-auto w-fit mb-1",children:[(0,l.jsxs)(eZ,{value:"prompt",className:"relative flex items-center gap-1.5 px-3 py-1.5 text-[13px] font-medium transition-all duration-200 rounded-md data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:ring-1 data-[state=active]:ring-border data-[state=active]:shadow-sm text-muted-foreground hover:text-foreground hover:bg-muted/80 border-0 data-[state=inactive]:bg-transparent",children:[(0,l.jsx)(fm.A,{className:"size-3.5",strokeWidth:"prompt"===ab?2:1.75}),"Prompt"]}),(0,l.jsxs)(eZ,{value:"tools",className:"relative flex items-center gap-1.5 px-3 py-1.5 text-[13px] font-medium transition-all duration-200 rounded-md data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:ring-1 data-[state=active]:ring-border data-[state=active]:shadow-sm text-muted-foreground hover:text-foreground hover:bg-muted/80 border-0 data-[state=inactive]:bg-transparent",children:[(0,l.jsx)(x,{className:"size-3.5",strokeWidth:"tools"===ab?2:1.75}),"Tools & Plugins"]}),(0,l.jsxs)(eZ,{value:"mcp",className:"relative flex items-center gap-1.5 px-3 py-1.5 text-[13px] font-medium transition-all duration-200 rounded-md data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:ring-1 data-[state=active]:ring-border data-[state=active]:shadow-sm text-muted-foreground hover:text-foreground hover:bg-muted/80 border-0 data-[state=inactive]:bg-transparent",children:[(0,l.jsx)("img",{src:"/icons/mcp.svg",alt:"",className:"size-3.5 object-contain"}),"MCP"]}),(0,l.jsxs)(eZ,{value:"skills",className:"relative flex items-center gap-1.5 px-3 py-1.5 text-[13px] font-medium transition-all duration-200 rounded-md data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:ring-1 data-[state=active]:ring-border data-[state=active]:shadow-sm text-muted-foreground hover:text-foreground hover:bg-muted/80 border-0 data-[state=inactive]:bg-transparent",children:[(0,l.jsx)("img",{src:"/icons/agentskills.png",alt:"",className:"size-3.5 object-contain"}),"Skills"]})]}),(0,l.jsxs)("div",{className:"flex-1 overflow-y-auto pr-2 pb-10",children:[(0,l.jsx)(e$,{value:"prompt",className:"m-0 border-0 p-0 h-full",children:(0,l.jsxs)("div",{className:"flex flex-col h-full gap-2.5",children:[(0,l.jsx)(Q.J,{className:"font-semibold text-[13px] text-foreground/90",children:"System Prompt"}),(0,l.jsx)(dz.T,{value:af,onChange:a=>ag(a.target.value),className:"flex-1 text-sm bg-background/50 font-mono text-[13px] resize-none",placeholder:"You are a helpful assistant..."})]})}),(0,l.jsx)(e$,{value:"tools",className:"m-0 border-0 p-0",children:(0,l.jsxs)("div",{className:"space-y-8",children:[(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,l.jsx)(x,{className:"size-4 text-muted-foreground"}),(0,l.jsx)("h2",{className:"text-sm font-medium",children:"Built-in tools"})]}),(0,l.jsx)(fP,{items:fD.d3,selected:am,onChange:an,getId:a=>a.id,getLabel:a=>a.name,getDescription:a=>a.description,getIcon:a=>a.icon})]}),aZ.length>0&&(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,l.jsx)(fo,{className:"size-4 text-muted-foreground"}),(0,l.jsx)("h2",{className:"text-sm font-medium",children:"Marketplace plugins"})]}),(0,l.jsx)(fP,{items:aZ,selected:at,onChange:au,getId:a=>a.id,getLabel:a=>a.name,getDescription:a=>a.description,getIcon:()=>fq,isPlugin:()=>!0})]})]})}),(0,l.jsx)(e$,{value:"mcp",className:"m-0 border-0 p-0",children:(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,l.jsx)("img",{src:"/icons/mcp.svg",alt:"",className:"size-4 object-contain"}),(0,l.jsx)("h2",{className:"text-sm font-medium",children:"MCP Connections"})]}),(0,l.jsx)(fP,{items:aY,selected:ap,onChange:aq,getId:a=>a.id,getLabel:a=>a.name,getDescription:a=>a.url,emptyState:(0,l.jsx)("div",{className:"rounded-xl px-4 py-16 dark:bg-card/40",children:(0,l.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,l.jsx)("div",{className:"flex size-12 items-center justify-center rounded-xl border border-border dark:bg-secondary/70",children:(0,l.jsx)("img",{src:"/icons/mcp.svg",alt:"MCP",className:"size-7 object-contain"})}),(0,l.jsxs)("div",{className:"text-center",children:[(0,l.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"No MCP connections yet"}),(0,l.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Add a remote MCP endpoint to discover its tools."})]}),(0,l.jsxs)(_.Lt,{children:[(0,l.jsxs)(_.tv,{render:(0,l.jsx)(O.$,{className:"mt-2 gap-1.5"}),children:[(0,l.jsx)(ah.A,{className:"size-4"})," Add MCP"]}),(0,l.jsxs)(_.EO,{children:[(0,l.jsxs)(_.wd,{children:[(0,l.jsx)(_.r7,{children:"Unsaved changes"}),(0,l.jsx)(_.$v,{children:"This action will navigate you to the Agent Customization page. Any unsaved changes in this deployment configuration will be lost. Do you want to continue?"})]}),(0,l.jsxs)(_.ck,{children:[(0,l.jsx)(_.Zr,{children:"Cancel"}),(0,l.jsx)(_.Rx,{onClick:()=>{window.location.href="/settings?section=agent-customization"},children:"Continue"})]})]})]})]})})})]})}),(0,l.jsx)(e$,{value:"skills",className:"m-0 border-0 p-0",children:(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,l.jsx)("img",{src:"/icons/agentskills.png",alt:"",className:"size-4 object-contain"}),(0,l.jsx)("h2",{className:"text-sm font-medium",children:"Agent Skills"})]}),(0,l.jsx)(fP,{items:r?.config.skills||[],selected:ar,onChange:as,getId:a=>a.id,getLabel:a=>a.name,getDescription:a=>a.description,emptyState:(0,l.jsx)("div",{className:"rounded-xl px-4 py-16 dark:bg-card/40",children:(0,l.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,l.jsx)("div",{className:"flex size-12 items-center justify-center rounded-xl border border-border dark:bg-secondary/70",children:(0,l.jsx)("img",{src:"/icons/agentskills.png",alt:"",className:"size-7 object-contain"})}),(0,l.jsxs)("div",{className:"text-center",children:[(0,l.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"No skills added yet"}),(0,l.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Import a SKILL.md or keep a canonical remote skill URL."})]}),(0,l.jsxs)(_.Lt,{children:[(0,l.jsxs)(_.tv,{render:(0,l.jsx)(O.$,{className:"mt-2 gap-1.5"}),children:[(0,l.jsx)(ah.A,{className:"size-4"})," Add skill"]}),(0,l.jsxs)(_.EO,{children:[(0,l.jsxs)(_.wd,{children:[(0,l.jsx)(_.r7,{children:"Unsaved changes"}),(0,l.jsx)(_.$v,{children:"This action will navigate you to the Agent Customization page. Any unsaved changes in this deployment configuration will be lost. Do you want to continue?"})]}),(0,l.jsxs)(_.ck,{children:[(0,l.jsx)(_.Zr,{children:"Cancel"}),(0,l.jsx)(_.Rx,{onClick:()=>{window.location.href="/settings?section=agent-customization"},children:"Continue"})]})]})]})]})})})]})})]})]})})]})]})]}),(0,l.jsx)(fC,{embedded:!0,onProviderChange:a=>al(a),children:["local","docker"].includes(ak)&&q&&(0,l.jsxs)("p",{className:"text-[11px] font-medium text-orange-500 pl-1 mt-2",children:["Select a remote sandbox provider (for example E2B or Daytona) when deploying to"," ",p?.label,". Local and Docker runtimes are not available there."]})})]}),(0,l.jsxs)("div",{className:"space-y-4 rounded-xl border bg-white p-5 ",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between border-b pb-3",children:[(0,l.jsx)("h3",{className:"text-sm font-semibold tracking-tight",children:"Vector Storage"}),(0,l.jsxs)("label",{className:"flex items-center gap-2 text-xs font-medium cursor-pointer bg-muted/20 px-2.5 py-1 rounded-md border hover:bg-muted/40 transition-colors",children:[(0,l.jsx)("input",{type:"checkbox",className:"shrink-0 rounded-sm",checked:z,onChange:a=>A(a.target.checked)}),"Save storage settings"]})]}),(0,l.jsxs)("div",{className:"space-y-4 pt-2",children:[(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"Your selected vector store and embedding model are saved to this Project for later deployments. Persistent cloud stores reuse their indexed knowledge base without uploading or indexing it again."}),(0,l.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,l.jsxs)(R.l6,{value:s,onValueChange:a=>{let b,c;return t(a),v(b=(0,fu.jX)(a).fields.reduce((a,b)=>(b.defaultValue&&(a[b.key]=b.defaultValue),a),{})),y({}),V(!1),c=JSON.parse(window.localStorage.getItem("larkup-deploy-storage")||"{}"),void window.localStorage.setItem("larkup-deploy-storage",JSON.stringify({...c,storeId:a,storeConfig:b}))},children:[(0,l.jsx)(R.bq,{className:"flex-1 bg-background",children:(0,l.jsxs)("span",{className:"flex items-center gap-2.5",children:[fE[s]&&(0,l.jsx)(ao.rb,{src:fE[s].iconSrc,alt:a3.label,pillBg:fE[s].pillBg,size:16}),(0,l.jsx)("span",{className:"font-medium text-sm",children:a3.label})]})}),(0,l.jsx)(R.gC,{children:fu.VY.map(a=>{let b=fE[a.id],c="coming-soon"===a.installStatus;return(0,l.jsx)(R.eb,{value:a.id,disabled:c,children:(0,l.jsxs)("span",{className:"flex items-center gap-2.5",children:[b&&(0,l.jsx)(ao.rb,{src:b.iconSrc,alt:a.label,pillBg:b.pillBg,size:16}),(0,l.jsx)("span",{className:"font-medium text-sm",children:a.label}),c&&(0,l.jsx)("span",{className:"ml-2 text-[9px] text-muted-foreground border rounded-full px-1.5",children:"Soon"})]})},a.id)})})]}),(0,l.jsxs)(O.$,{variant:U?"secondary":"outline",size:"default",className:"h-10.5",onClick:a5,disabled:N||a4,children:[N?(0,l.jsx)(M.A,{className:"size-3.5 mr-2 animate-spin"}):U?(0,l.jsx)(fs,{className:"size-3.5 mr-2 text-emerald-500"}):(0,l.jsx)(fo,{className:"size-3.5 mr-2"}),U?"Verified":"Verify"]})]}),a4&&(0,l.jsx)("p",{className:"text-[11px] font-medium text-orange-500 pl-1 rounded-md ",children:"You must select a cloud storage provider before deploying."}),(0,l.jsxs)("div",{className:"bg-muted/10 p-4 rounded-lg border",children:[(0,l.jsx)(fv,{store:a3,values:u,errors:w,indexType:r?.config.indexType,onChange:(a,b)=>{let c={...u,[a]:b};v(c),y(b=>({...b,[a]:""})),V(!1);let d=JSON.parse(window.localStorage.getItem("larkup-deploy-storage")||"{}");window.localStorage.setItem("larkup-deploy-storage",JSON.stringify({...d,storeId:s,storeConfig:c}))}}),(0,l.jsxs)("div",{className:"pt-4 border-t mt-4",children:[(0,l.jsx)("h3",{className:"text-xs font-semibold mb-2 text-muted-foreground",children:"EMBEDDING MODEL"}),(0,l.jsxs)(R.l6,{value:B,onValueChange:a=>{C(a||""),V(!1);let b=JSON.parse(window.localStorage.getItem("larkup-deploy-storage")||"{}");window.localStorage.setItem("larkup-deploy-storage",JSON.stringify({...b,embeddingModelId:a||""}))},children:[(0,l.jsx)(R.bq,{className:"w-full bg-background",children:(0,l.jsx)("span",{className:"font-medium text-sm",children:a_?.label??"Default"})}),(0,l.jsx)(R.gC,{children:a$.map(a=>(0,l.jsx)(R.eb,{value:a.id,children:(0,l.jsx)("span",{className:"font-medium text-sm",children:a.label})},a.id))})]})]})]})]})]}),(0,l.jsxs)("div",{className:"space-y-4 rounded-xl border bg-white p-5",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:"text-sm font-semibold tracking-tight",children:"AI chat runtime"}),(0,l.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Choose the provider that will answer chat and Agent requests after deployment. Project settings are used by default."})]}),(0,l.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Provider"}),(0,l.jsxs)(R.l6,{value:D,onValueChange:a=>{let b=a??"project";E(b),"project"!==b&&(G(fO[b]||""),J(""))},children:[(0,l.jsx)(R.bq,{className:"w-full bg-background",children:(0,l.jsxs)("span",{className:"flex items-center gap-2",children:[ao.Qd[a1]&&(0,l.jsx)(ao.rb,{src:ao.Qd[a1].iconSrc,alt:ao.Qd[a1].label,pillBg:ao.Qd[a1].pillBg,size:16}),(0,l.jsx)("span",{children:"project"===D?`Project default \xb7 ${ao.Qd[a1]?.label??a1}`:ao.Qd[a1]?.label??a1})]})}),(0,l.jsxs)(R.gC,{children:[(0,l.jsxs)(R.eb,{value:"project",children:["Project default \xb7"," ",ao.Qd[a0]?.label??a0]}),fN.map(a=>{let b=ao.Qd[a];return(0,l.jsx)(R.eb,{value:a,children:(0,l.jsxs)("span",{className:"flex items-center gap-2",children:[(0,l.jsx)(ao.rb,{src:b.iconSrc,alt:b.label,pillBg:b.pillBg,size:16}),b.label]})},a)})]})]})]}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Model ID"}),(0,l.jsx)(P.p,{value:a2,onChange:a=>G(a.target.value),disabled:"project"===D,placeholder:"openai/gpt-4o-mini",className:"bg-background font-mono text-xs"})]})]}),"project"===D?(0,l.jsxs)("p",{className:"rounded-md border bg-muted/20 px-3 py-2 text-xs text-muted-foreground",children:["This deployment inherits the configured"," ",ao.Qd[a1]?.label??a1," key from General → AI Models and stores it as an encrypted provider environment value."]}):(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsxs)(Q.J,{className:"text-xs",children:[ao.Qd[a1]?.label??a1," API key"]}),(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)(P.p,{type:K?"text":"password",value:I,onChange:a=>J(a.target.value),placeholder:"Paste a deployment-only API key",autoComplete:"off",className:"bg-background pr-10"}),(0,l.jsx)("button",{type:"button","aria-label":K?"Hide chat API key":"Show chat API key",onClick:()=>L(a=>!a),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground",children:K?(0,l.jsx)(ai.A,{className:"size-4"}):(0,l.jsx)(aj.A,{className:"size-4"})})]}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"Used only for this deployment and sent to the provider as an encrypted environment value."})]})]}),(0,l.jsxs)("div",{className:"space-y-4 rounded-xl border bg-white p-5 ",children:[(0,l.jsx)("h3",{className:"text-sm font-semibold tracking-tight border-b pb-3",children:"Environment Variables"}),(0,l.jsxs)("div",{className:"grid gap-2 pt-2",children:[(0,l.jsxs)(Q.J,{className:"text-xs text-muted-foreground font-semibold",children:["SERVER_API_KEY ",(0,l.jsx)("span",{className:"font-normal",children:"(Optional)"})]}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsxs)("div",{className:"relative flex-1",children:[(0,l.jsx)(P.p,{type:az?"text":"password",value:ax,onChange:a=>ay(a.target.value),className:"bg-background pr-10"}),(0,l.jsx)("button",{type:"button",onClick:()=>aA(!az),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",children:az?(0,l.jsx)(ai.A,{className:"size-4"}):(0,l.jsx)(aj.A,{className:"size-4"})})]}),(0,l.jsx)(O.$,{className:"size-10",variant:"outline",size:"icon",onClick:()=>{ax&&(navigator.clipboard.writeText(ax),S.oR.success("API Key copied to clipboard"))},title:"Copy Key",children:(0,l.jsx)(d5.A,{className:"size-4"})}),(0,l.jsx)(O.$,{className:"size-10",variant:"outline",size:"icon",onClick:()=>{ay("larkup-"+Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15))},title:"Generate new Key",children:(0,l.jsx)(ea.A,{className:"size-4"})})]})]})]})]}),(0,l.jsx)("div",{className:`mt-2 space-y-6 ${"1"!==h?"hidden":"block"}`,children:(0,l.jsx)("div",{className:"space-y-4 rounded-xl border bg-white p-5 ",children:p?.id==="Vercel"?(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"grid gap-2",children:[(0,l.jsxs)(Q.J,{className:"flex justify-between w-full items-center",children:[(0,l.jsxs)("span",{children:["Vercel Token ",(0,l.jsx)("span",{className:"text-destructive ml-1",children:"*"})]}),(0,l.jsx)("a",{href:"https://vercel.com/account/tokens",target:"_blank",rel:"noreferrer",className:"text-[10px] font-medium text-muted-foreground underline hover:text-foreground",children:"Get token"})]}),(0,l.jsxs)("div",{className:"relative flex-1",children:[(0,l.jsx)(P.p,{type:aF?"text":"password",value:aB,onChange:a=>{aC(a.target.value),aV.setVercelToken(a.target.value)},className:"bg-background"}),(0,l.jsx)("button",{type:"button",onClick:()=>aG(!aF),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground",children:aF?(0,l.jsx)(ai.A,{className:"size-4"}):(0,l.jsx)(aj.A,{className:"size-4"})})]})]}),(0,l.jsxs)("div",{className:"grid gap-2",children:[(0,l.jsxs)(Q.J,{children:["Project Name ",(0,l.jsx)("span",{className:"text-destructive ml-1",children:"*"})]}),(0,l.jsx)(P.p,{value:aD,onChange:a=>{aE(a.target.value),aV.setVercelProject(a.target.value)},className:"bg-background"})]})]}):(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"grid gap-2",children:[(0,l.jsxs)(Q.J,{children:[a," Host IP / Domain ",(0,l.jsx)("span",{className:"text-destructive ml-1",children:"*"})]}),(0,l.jsx)(P.p,{value:aH,onChange:b=>{aI(b.target.value),a&&aV.setSshCredential(a,{host:b.target.value,username:aJ,authType:aL,credential:aN})},placeholder:"e.g. 192.168.1.1 or myserver.com",className:"bg-background"})]}),(0,l.jsxs)("div",{className:"grid gap-2",children:[(0,l.jsxs)(Q.J,{children:["SSH Username ",(0,l.jsx)("span",{className:"text-destructive ml-1",children:"*"})]}),(0,l.jsx)(P.p,{value:aJ,onChange:b=>{aK(b.target.value),a&&aV.setSshCredential(a,{host:aH,username:b.target.value,authType:aL,credential:aN})},placeholder:"root",className:"bg-background"})]}),(0,l.jsxs)("div",{className:"grid gap-2",children:[(0,l.jsx)(Q.J,{children:"Authentication Type"}),(0,l.jsxs)(R.l6,{value:aL,onValueChange:b=>{aM(b),a&&aV.setSshCredential(a,{host:aH,username:aJ,authType:b,credential:aN})},children:[(0,l.jsx)(R.bq,{className:"bg-background",children:(0,l.jsx)(R.yv,{})}),(0,l.jsxs)(R.gC,{children:[(0,l.jsx)(R.eb,{value:"password",children:"Password"}),(0,l.jsx)(R.eb,{value:"key",children:"Private Key"})]})]})]}),(0,l.jsxs)("div",{className:"grid gap-2",children:[(0,l.jsxs)(Q.J,{children:["password"===aL?"SSH Password":"Private Key (PEM)"," ",(0,l.jsx)("span",{className:"text-destructive ml-1",children:"*"})]}),(0,l.jsxs)("div",{className:"relative flex-1",children:["password"===aL?(0,l.jsx)(P.p,{type:aP?"text":"password",value:aN,onChange:b=>{aO(b.target.value),a&&aV.setSshCredential(a,{host:aH,username:aJ,authType:aL,credential:b.target.value})},className:"bg-background"}):(0,l.jsx)(dz.T,{value:aN,onChange:b=>{aO(b.target.value),a&&aV.setSshCredential(a,{host:aH,username:aJ,authType:aL,credential:b.target.value})},className:"font-mono text-xs min-h-25 bg-background",placeholder:"-----BEGIN RSA PRIVATE KEY-----..."}),"password"===aL&&(0,l.jsx)("button",{type:"button",onClick:()=>aQ(!aP),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground",children:aP?(0,l.jsx)(ai.A,{className:"size-4"}):(0,l.jsx)(aj.A,{className:"size-4"})})]})]})]})})})]}),(0,l.jsx)("div",{className:"mt-12 flex justify-end gap-3 pt-6 border-t",children:"1"===h?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(O.$,{variant:"ghost",onClick:e,disabled:Y,children:"Cancel"}),(0,l.jsxs)(O.$,{onClick:()=>a6(!1),disabled:Y,children:[Y&&(0,l.jsx)(M.A,{className:"mr-2 size-4 animate-spin"}),"Verify Connection & Next"]})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(O.$,{variant:"ghost",onClick:()=>"env"!==a?i("1"):e(),disabled:aR,children:"env"!==a?"Back":"Cancel"}),(0,l.jsxs)(O.$,{onClick:a7,disabled:aR,children:[aR?(0,l.jsx)(M.A,{className:"mr-2 size-4 animate-spin"}):(0,l.jsx)(d4,{className:"mr-2 size-4"}),"Deploy Server"]})]})})]})}let fR=a=>fetch(a).then(a=>a.json()),fS=[],fT={unknown:{label:"Not checked",className:"text-muted-foreground",Icon:dU},queued:{label:"Queued",className:"text-amber-600",Icon:dV.A},building:{label:"Building",className:"text-amber-600",Icon:M.A},ready:{label:"Ready",className:"text-emerald-600",Icon:dW.A},error:{label:"Failed",className:"text-destructive",Icon:dX.A},canceled:{label:"Canceled",className:"text-destructive",Icon:dX.A},unavailable:{label:"Unavailable",className:"text-destructive",Icon:dX.A}};function fU(){return`lk_${crypto.randomUUID().replaceAll("-","")}`}function fV(){let{data:a,mutate:b,isLoading:c}=(0,H.u)("/api/projects/runtime",fR,{refreshInterval:1e4}),{data:d,mutate:e}=(0,H.u)("/api/config",fR),{data:f,mutate:g}=(0,H.u)("/api/projects/deployments",fR),h=(0,o.useSearchParams)(),i=(0,o.useRouter)(),j=(0,o.usePathname)(),[k,n]=(0,m.useState)("knowledge"),[p,q]=(0,m.useState)(""),[r,s]=(0,m.useState)(!1),[t,u]=(0,m.useState)(()=>{var a;return"connections"===(a=h.get("tab"))||"deployments"===a||"server"===a?a:"server"}),[v,w]=(0,m.useState)(null),[x,y]=(0,m.useState)(""),[z,A]=(0,m.useState)(null),[C,D]=(0,m.useState)(null),[F,G]=(0,m.useState)(null),[I,J]=(0,m.useState)({}),K=h.get("deployTarget"),L=a=>{let b=new URLSearchParams(h.toString());a?b.set("deployTarget",a):b.delete("deployTarget"),i.replace(`${j}?${b.toString()}`)},[N,Q]=(0,m.useState)(!1),R=a?.runtime,T=R?.running??!1,U=R?.endpoint??"http://localhost:8080",V=f?.deployments??fS;function W(a){q(a),a?window.localStorage.setItem("larkup-server-api-key",a):window.localStorage.removeItem("larkup-server-api-key")}async function Z(a){T?S.oR.error("Stop the server before switching between Knowledge and Agent modes."):(n(a),d?.config&&((await fetch("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...d.config,runtimeProfile:a})})).ok?await e():S.oR.error("Could not save server profile.")))}async function $(a){Q(!0);let c="start"===a?p||fU():"";"start"!==a||p||W(c);let d=await fetch("/api/projects/runtime",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:a,apiKey:c||void 0})}),e=await d.json();if(!d.ok){S.oR.error(e.runtime?.lastError||e.error||`Could not ${a} the server.`),await b(),Q(!1);return}S.oR.success("start"===a?"Server has started successfully.":"Server has stopped successfully."),await b(),Q(!1)}async function aa(a,b){await navigator.clipboard.writeText(a),S.oR.success(`${b} copied.`)}async function ab(a){A(a);try{let b=window.localStorage.getItem("larkup-vercel-token")||void 0,c=await fetch("/api/projects/deployments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({checkId:a,deployConfig:{credentials:{vercelToken:b}}})}),d=await c.json();if(!c.ok)throw Error(d.error||"Could not check this deployment.");await g()}catch(a){S.oR.error(a instanceof Error?a.message:"Could not check this deployment.")}finally{A(null)}}async function ac(a){let b=await fetch("/api/projects/deployments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updateId:a,endpoint:x})}),c=await b.json();b.ok?(w(null),await g(),S.oR.success("Deployment URL updated.")):S.oR.error(c.error||"Could not update this deployment URL.")}async function ad(){if(F){D(F.id);try{let a=await fetch("/api/projects/deployments",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:F.id})}),b=await a.json();if(!a.ok)throw Error(b.error||"Could not remove this deployment.");F.id,await g(),S.oR.success("Deployment removed from this Project."),G(null)}catch(a){S.oR.error(a instanceof Error?a.message:"Could not remove this deployment.")}finally{D(null)}}}async function ae(a){let b=I[a.id];b?await aa(b,"API key"):S.oR.error("This API key is only available in the browser that started the deployment.")}let af=`curl -X POST ${U}${"knowledge"===k?"/query":"/chat"} -H "Content-Type: application/json"${p?` -H "Authorization: Bearer ${p}"`:""} -d '${"knowledge"===k?'{"query":"hello"}':'{"messages":[{"role":"user","content":"hello"}]}'}'`,ag=JSON.stringify(p||"YOUR_API_KEY"),ah=JSON.stringify(U),ak="assistant"===k?`/**
36
+ * Larkup SDK quick start — Agent Server
37
+ *
38
+ * Agent Server: use LarkupAgentClient for tool-aware conversations.
39
+ * Knowledge Server: use LarkupClient and client.query() for semantic retrieval.
40
+ *
41
+ * This server is in Agent mode, so the active example is below. The Knowledge
42
+ * Server example is kept as a reference; use one client or the other.
43
+ */
44
+ import { LarkupAgentClient } from '@larkup/sdk';
45
+
46
+ const agent = new LarkupAgentClient({
47
+ baseUrl: ${ah},
48
+ apiKey: ${ag},
49
+ });
50
+
51
+ // Capabilities group tools by integration: built-ins, sandbox, each MCP server, and plugins.
52
+ for (const capability of await agent.capabilities()) {
53
+ console.log(\`\${capability.name}: \${capability.tools.map((tool) => tool.name).join(', ')}\`);
54
+ }
55
+
56
+ // Read the saved UI prompt and enabled skill metadata from this runtime.
57
+ console.log((await agent.configuration()).systemPrompt);
58
+
59
+ // Discover the models this deployment can use. Gateway runtimes return all
60
+ // available providers; direct-provider runtimes return their configured choice.
61
+ const catalog = await agent.chatModelCatalog();
62
+ console.table(await agent.chatProviders());
63
+ const selectedModel = (await agent.chatModels('anthropic')).at(0);
64
+
65
+ // Ask the Agent to answer using its enabled tools and instructions.
66
+ console.log(await agent.chatText(selectedModel ? {
67
+ messages: [{ role: 'user', content: 'What can you help me with?' }],
68
+ provider: catalog.configuredProvider,
69
+ modelId: selectedModel.id,
70
+ } : 'What can you help me with?'));
71
+
72
+ // Stream text deltas as the Agent generates them.
73
+ process.stdout.write('Agent: ');
74
+ for await (const text of agent.streamText('Give me a short welcome.')) {
75
+ process.stdout.write(text);
76
+ }
77
+ process.stdout.write('\\n');
78
+
79
+ /* Knowledge Server alternative — use this only in Knowledge mode:
80
+ import { LarkupClient } from '@larkup/sdk';
81
+ const client = new LarkupClient({ baseUrl: ${ah}, apiKey: ${ag} });
82
+ const result = await client.query('Find relevant documents', 5);
83
+ console.log(result.hits);
84
+ for await (const event of client.chat('Summarize the relevant documents.')) {
85
+ if (event.type === 'text-delta') process.stdout.write(event.text ?? '');
86
+ }
87
+ */`:`/**
88
+ * Larkup SDK quick start — Knowledge Server
89
+ *
90
+ * Knowledge Server: use LarkupClient and client.query() for semantic retrieval.
91
+ * Agent Server: use LarkupAgentClient and agent.chatText() for conversations.
92
+ *
93
+ * This server is in Knowledge mode, so the active example is below. The Agent
94
+ * Server example is kept as a reference; use one client or the other.
95
+ */
96
+ import { LarkupClient } from '@larkup/sdk';
97
+
98
+ const client = new LarkupClient({
99
+ baseUrl: ${ah},
100
+ apiKey: ${ag},
101
+ });
102
+
103
+ // Retrieve the most relevant indexed chunks for a query.
104
+ const result = await client.query('Find relevant documents', 5);
105
+ console.log(result.hits);
106
+
107
+ // Inspect models, then optionally choose one for this chat request.
108
+ const catalog = await client.chatModelCatalog();
109
+ const selectedModel = (await client.chatModels('anthropic')).at(0);
110
+
111
+ // Stream a retrieval-grounded response as it is generated.
112
+ process.stdout.write('Answer: ');
113
+ for await (const event of client.chat(selectedModel ? {
114
+ messages: [{ role: 'user', content: 'Summarize the relevant documents.' }],
115
+ provider: catalog.configuredProvider,
116
+ modelId: selectedModel.id,
117
+ } : 'Summarize the relevant documents.')) {
118
+ if (event.type === 'text-delta') process.stdout.write(event.text ?? '');
119
+ }
120
+ process.stdout.write('\\n');
121
+
122
+ /* Agent Server alternative — use this only in Agent mode:
123
+ import { LarkupAgentClient } from '@larkup/sdk';
124
+ const agent = new LarkupAgentClient({ baseUrl: ${ah}, apiKey: ${ag} });
125
+ for await (const text of agent.streamText('What can you help me with?')) {
126
+ process.stdout.write(text);
127
+ }
128
+ */`,al="assistant"===k?`"""
129
+ Larkup SDK quick start — Agent Server
130
+
131
+ Agent Server: use LarkupAgentClient for tool-aware conversations.
132
+ Knowledge Server: use LarkupClient and client.query() for semantic retrieval.
133
+
134
+ This server is in Agent mode, so the active example is below. The Knowledge
135
+ Server alternative is included as comments; use one client or the other.
136
+ """
137
+ from larkup import LarkupAgentClient
138
+
139
+ agent = LarkupAgentClient(
140
+ base_url=${ah},
141
+ api_key=${ag},
142
+ )
143
+
144
+ # Capabilities group tools by integration: built-ins, sandbox, each MCP server, and plugins.
145
+ for capability in agent.capabilities():
146
+ print(capability.name, ", ".join(tool.name for tool in capability.tools))
147
+
148
+ # Read the saved UI prompt and enabled skill metadata from this runtime.
149
+ print(agent.configuration().systemPrompt)
150
+
151
+ # Discover models. Gateway runtimes return all available providers; direct
152
+ # provider runtimes return the configured provider and model.
153
+ catalog = agent.chat_model_catalog()
154
+ models = agent.chat_models("anthropic")
155
+
156
+ # Ask the Agent to answer using its enabled tools and instructions.
157
+ if models:
158
+ from larkup import AgentChatRequest
159
+ print(agent.chat_text(AgentChatRequest(
160
+ messages=[{"role": "user", "content": "What can you help me with?"}],
161
+ provider=catalog.configuredProvider,
162
+ modelId=models[0].id,
163
+ )))
164
+ else:
165
+ print(agent.chat_text("What can you help me with?"))
166
+
167
+ # Stream text deltas as the Agent generates them.
168
+ for text in agent.stream_text("Give me a short welcome."):
169
+ print(text, end="", flush=True)
170
+ print()
171
+
172
+ # Knowledge Server alternative — use this only in Knowledge mode:
173
+ # from larkup import LarkupClient, LarkupClientOptions
174
+ # client = LarkupClient(LarkupClientOptions(base_url=${ah}, api_key=${ag}))
175
+ # result = client.query("Find relevant documents", top_k=5)
176
+ # print(result.hits)`:`"""
177
+ Larkup SDK quick start — Knowledge Server
178
+
179
+ Knowledge Server: use LarkupClient and client.query() for semantic retrieval.
180
+ Agent Server: use LarkupAgentClient and agent.chat_text() for conversations.
181
+
182
+ This server is in Knowledge mode, so the active example is below. The Agent
183
+ Server alternative is included as comments; use one client or the other.
184
+ """
185
+ from larkup import LarkupClient, LarkupClientOptions
186
+
187
+ client = LarkupClient(LarkupClientOptions(
188
+ base_url=${ah},
189
+ api_key=${ag},
190
+ ))
191
+
192
+ # Retrieve the most relevant indexed chunks for a query.
193
+ result = client.query("Find relevant documents", top_k=5)
194
+ print(result.hits)
195
+
196
+ # Inspect models, then optionally choose one for this chat request.
197
+ catalog = client.chat_model_catalog()
198
+ models = client.chat_models("anthropic")
199
+
200
+ # Stream a retrieval-grounded response as it is generated.
201
+ from larkup import ChatRequest
202
+ request = ChatRequest(
203
+ messages=[{"role": "user", "content": "Summarize the relevant documents."}],
204
+ provider=catalog.configuredProvider if models else None,
205
+ modelId=models[0].id if models else None,
206
+ )
207
+ for event in client.chat(request):
208
+ if event.type == "text-delta":
209
+ print(event.text or "", end="", flush=True)
210
+ print()
211
+
212
+ # Agent Server alternative — use this only in Agent mode:
213
+ # from larkup import LarkupAgentClient
214
+ # agent = LarkupAgentClient(base_url=${ah}, api_key=${ag})
215
+ # for text in agent.stream_text("What can you help me with?"):
216
+ # print(text, end="", flush=True)`;return K?(0,l.jsx)(fQ,{target:K,profile:k,onSaved:()=>void g(),onBack:()=>L(null),onDeployed:()=>{u("deployments");let a=new URLSearchParams(h.toString());a.delete("deployTarget"),a.set("tab","deployments"),i.replace(`${j}?${a.toString()}`,{scroll:!1})}}):(0,l.jsxs)("section",{className:"space-y-5",children:[(0,l.jsx)(_.Lt,{open:!!F,onOpenChange:a=>!a&&G(null),children:(0,l.jsxs)(_.EO,{children:[(0,l.jsxs)(_.wd,{children:[(0,l.jsx)(_.r7,{children:"Remove this deployment?"}),(0,l.jsx)(_.$v,{children:"This removes the saved deployment from this Project and clears its locally stored API key. It does not delete the remote deployment from its cloud provider."})]}),(0,l.jsxs)(_.ck,{children:[(0,l.jsx)(_.Zr,{disabled:!!C,children:"Cancel"}),(0,l.jsx)(_.Rx,{onClick:()=>void ad(),disabled:!!C,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:C?(0,l.jsx)(M.A,{className:"size-4 animate-spin"}):"Remove"})]})]})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"text-xl font-semibold",children:"Larkup Server"}),(0,l.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Test locally, then deploy one retrieval and chat server anywhere."})]}),(0,l.jsx)(d9,{activeTab:t,onTabChange:a=>{let b;return u(a),void((b=new URLSearchParams(h.toString())).set("tab",a),i.replace(`${j}?${b.toString()}`,{scroll:!1}))},tabs:[{id:"server",label:"Server",icon:dZ},{id:"connections",label:"Connections",icon:d$.A},{id:"deployments",label:"Cloud deployments",icon:d_.A}],className:"mb-6 pb-0"}),"server"===t&&(0,l.jsx)("div",{className:"pt-2 animate-in fade-in-0 duration-200",children:(0,l.jsxs)("div",{className:"space-y-12",children:[(0,l.jsxs)("section",{children:[(0,l.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(B,{className:"size-4 text-muted-foreground"}),(0,l.jsx)("h2",{className:"text-base font-medium",children:"Local server"})]}),(0,l.jsxs)("span",{className:T?"flex items-center gap-2 text-sm font-medium text-emerald-600":"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,l.jsx)("span",{className:T?"size-2 rounded-full bg-emerald-500":"size-2 rounded-full bg-muted-foreground/40"}),T?`running on :${R?.port}`:"stopped"]})]}),(0,l.jsx)("p",{className:"mt-3 max-w-2xl text-sm text-muted-foreground",children:"Start the server locally to test your AI endpoints. Configuration and API keys are applied automatically."}),(0,l.jsxs)("div",{className:"mt-5 flex flex-wrap items-center gap-3 rounded-xl border bg-white/70 px-4 py-3.5 dark:bg-card/70",children:[(0,l.jsxs)("div",{className:"mr-auto flex items-center gap-2",children:[(0,l.jsx)("span",{className:"text-sm font-medium",children:"knowledge"===k?"Knowledge Server":"Agent Server"}),(0,l.jsx)("span",{className:"text-xs text-muted-foreground",children:"knowledge"===k?"retrieval API":"chat, tools & sandbox"})]}),(0,l.jsx)("span",{className:"text-xs text-muted-foreground",children:"Knowledge"}),(0,l.jsx)(d8.d,{checked:"assistant"===k,"aria-label":"Run as Agent Server",onCheckedChange:a=>void Z(a?"assistant":"knowledge")}),(0,l.jsx)("span",{className:"text-xs text-muted-foreground",children:"Agent"})]}),T?(0,l.jsx)("div",{className:"mt-5 space-y-4",children:(0,l.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,l.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,l.jsxs)(O.$,{variant:"outline",size:"sm",onClick:()=>void aa(ak,"TypeScript SDK code"),children:[(0,l.jsx)(dS(),{src:"/icons/typescript.png",alt:"",width:14,height:14,className:"mr-1.5 size-3.5 object-contain"}),"Copy TypeScript SDK"]}),(0,l.jsxs)(O.$,{variant:"outline",size:"sm",onClick:()=>void aa(al,"Python SDK code"),children:[(0,l.jsx)(dS(),{src:"/icons/python.png",alt:"",width:14,height:14,className:"mr-1.5 size-3.5 object-contain"}),"Copy Python SDK"]}),(0,l.jsxs)(O.$,{variant:"outline",size:"sm",onClick:()=>void aa(af,"cURL command"),children:[(0,l.jsx)(B,{className:"mr-1.5 size-3.5"}),"Copy cURL"]}),(0,l.jsxs)("a",{href:`${U}/reference`,target:"_blank",rel:"noreferrer",className:(0,E.cn)((0,O.r)({variant:"outline",size:"sm"})),children:[(0,l.jsx)(d0.A,{className:"mr-1.5 size-3.5"}),"API reference"]})]}),(0,l.jsxs)(O.$,{variant:"destructive",size:"sm",disabled:c||N,onClick:()=>void $("stop"),children:[c||N?(0,l.jsx)(M.A,{className:"mr-1.5 size-3.5 animate-spin"}):(0,l.jsx)(d1.A,{className:"mr-1.5 size-3.5"}),"Stop server"]})]})}):(0,l.jsx)("div",{className:"mt-5 flex gap-2",children:(0,l.jsxs)(O.$,{disabled:c||N,onClick:()=>void $("start"),children:[c||N?(0,l.jsx)(M.A,{className:"mr-2 size-4 animate-spin"}):(0,l.jsx)(d2.A,{className:"mr-2 size-4"}),"Launch server"]})}),R?.lastError&&(0,l.jsx)("p",{className:"mt-4 rounded-lg border border-destructive/30 bg-destructive/5 p-3 text-sm text-destructive",children:R.lastError})]}),(0,l.jsxs)("div",{className:"grid gap-10 border-t pt-10 md:grid-cols-2",children:[(0,l.jsxs)("section",{children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(d4,{className:"size-4 text-muted-foreground"}),(0,l.jsx)("h2",{className:"text-base font-medium",children:"Deploy to cloud"})]}),(0,l.jsxs)("p",{className:"mt-3 text-sm text-muted-foreground",children:["Deploy your ","knowledge"===k?"Knowledge":"Agent"," Server for production use."]}),(0,l.jsxs)("div",{className:"mt-5 flex items-center gap-2",children:[(0,l.jsx)(fj,{profile:k,onDeployClick:L,onSaved:()=>void g()}),(0,l.jsxs)(O.$,{variant:"outline","aria-label":"Copy API key",onClick:()=>void aa(p,"API key"),disabled:!p,className:"px-3 h-9",children:[(0,l.jsx)(d5.A,{className:"mr-2 size-4"}),"Copy API key"]})]})]}),(0,l.jsxs)("section",{children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(d6.A,{className:"size-4 text-muted-foreground"}),(0,l.jsx)("h2",{className:"text-base font-medium",children:"Server API key"})]}),(0,l.jsxs)("p",{className:"mt-3 text-sm text-muted-foreground",children:["Clients must send this key in the"," ",(0,l.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 text-xs",children:"Authorization"})," ","header."]}),(0,l.jsxs)("div",{className:"mt-5 flex gap-2 items-center",children:[(0,l.jsx)(P.p,{value:p,onChange:a=>W(a.target.value),type:r?"text":"password",placeholder:"sk-...",disabled:T,className:"font-mono text-xs bg-white dark:bg-background"}),(0,l.jsx)(O.$,{variant:"outline",size:"icon","aria-label":r?"Hide API key":"Show API key",onClick:()=>s(a=>!a),disabled:!p,className:"shrink-0 size-10",children:r?(0,l.jsx)(ai.A,{className:"size-4"}):(0,l.jsx)(aj.A,{className:"size-4"})}),(0,l.jsx)(O.$,{variant:"outline",size:"icon","aria-label":"Regenerate API key",onClick:function(){W(fU()),S.oR.success("A new local API key was generated.")},disabled:T,className:"shrink-0 size-10",children:(0,l.jsx)(X.A,{className:"size-4"})})]}),(0,l.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:T?"Stop the server before replacing this key.":"Stored locally in this browser for testing. Generate a new key or paste your own."})]})]})]})}),"connections"===t&&(0,l.jsx)("div",{className:"pt-2 animate-in fade-in-0 duration-200",children:(0,l.jsx)(fg,{embedded:!0})}),"deployments"===t&&(0,l.jsx)("div",{className:"animate-in fade-in-0 duration-200",children:(0,l.jsx)("section",{className:"space-y-5",children:0===V.length?(0,l.jsxs)("div",{className:"mt-5 rounded-xl flex flex-col gap-3 items-center justify-center p-19 text-sm text-muted-foreground",children:[(0,l.jsx)("div",{className:"border bg-white rounded-md p-2",children:(0,l.jsx)(dZ,{className:"size-5"})}),(0,l.jsx)("h1",{className:"text-base font-medium",children:"No remote deployments saved yet. "}),(0,l.jsx)("p",{className:"mt-0 text-sm text-muted-foreground",children:"Each deployment exposes its API endpoint and interactive API reference. Deploy to a cloud provider to get started."}),(0,l.jsx)(fj,{profile:k,onDeployClick:L,onSaved:()=>void g(),compact:!0})]}):(0,l.jsxs)("div",{className:"mt-5 overflow-hidden rounded-xl border bg-white/70 dark:bg-card/70",children:[(0,l.jsxs)("div",{className:"hidden grid-cols-[200px_minmax(0,1fr)_auto_auto] gap-3 border-b bg-muted/30 px-4 py-2 text-xs text-muted-foreground sm:grid",children:[(0,l.jsx)("span",{children:"Provider"}),(0,l.jsx)("span",{children:"API endpoint"}),(0,l.jsx)("span",{children:"Status"}),(0,l.jsx)("span",{children:"Actions"})]}),V.map(a=>{let b,c;return(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-3 border-b px-4 py-3 last:border-b-0 sm:grid sm:grid-cols-[200px_minmax(0,1fr)_auto_auto]",children:[(0,l.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium",children:[e0(a.provider)&&(0,l.jsx)("img",{src:e0(a.provider).icon,alt:"",className:"size-4 object-contain"}),a.provider," \xb7"," ","knowledge"===a.profile?"Knowledge":"Agent"]}),v===a.id?(0,l.jsx)(P.p,{value:x,onChange:a=>y(a.target.value),"aria-label":`Deployment URL for ${a.provider}`,className:"h-8 min-w-0 font-mono text-xs"}):(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-1",children:[(0,l.jsx)("a",{href:a.endpoint,target:"_blank",rel:"noreferrer",className:"min-w-0 max-w-37.5 lg:max-w-75 truncate font-mono text-xs hover:underline",children:a.endpoint}),(0,l.jsx)(O.$,{variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":`Copy API endpoint for ${a.provider} deployment`,title:"Copy API endpoint",onClick:()=>void aa(a.endpoint,"API endpoint"),children:(0,l.jsx)(d5.A,{className:"size-3.5"})})]}),(c=(b=fT[a.status]).Icon,(0,l.jsx)("div",{className:"min-w-0",children:(0,l.jsxs)("span",{className:`flex items-center gap-1.5 text-xs ${b.className}`,children:[(0,l.jsx)(c,{className:`size-3.5 ${"building"===a.status?"animate-spin":""}`}),(0,l.jsx)("span",{children:b.label})]})})),(0,l.jsx)(fi.Bc,{children:(0,l.jsx)("div",{className:"flex items-center gap-2",children:v===a.id?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(O.$,{variant:"outline",size:"sm",onClick:()=>void ac(a.id),children:"Save URL"}),(0,l.jsx)(O.$,{variant:"ghost",size:"sm",onClick:()=>w(null),children:"Cancel"})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(fi.m_,{children:[(0,l.jsx)(fi.k$,{render:(0,l.jsx)(O.$,{variant:"ghost",size:"icon",className:"size-8",onClick:()=>{w(a.id),y(a.endpoint)},"aria-label":"Update URL",children:(0,l.jsx)(d7.A,{className:"size-3.5"})})}),(0,l.jsx)(fi.ZI,{children:"Update URL"})]}),(0,l.jsxs)(fi.m_,{children:[(0,l.jsx)(fi.k$,{render:(0,l.jsx)(O.$,{variant:"ghost",size:"icon",className:"size-8","aria-label":`Copy API key for ${a.provider} deployment`,onClick:()=>void ae(a),disabled:!I[a.id],children:(0,l.jsx)(d6.A,{className:"size-3.5"})})}),(0,l.jsx)(fi.ZI,{children:I[a.id]?"Copy API key":"API key is available only in the browser that started this deployment"})]}),(0,l.jsxs)(fi.m_,{children:[(0,l.jsx)(fi.k$,{render:(0,l.jsx)(O.$,{variant:"ghost",size:"icon",className:"size-8",onClick:()=>void ab(a.id),disabled:z===a.id,"aria-label":"Check Status",children:z===a.id?(0,l.jsx)(M.A,{className:"size-3.5 animate-spin"}):(0,l.jsx)(X.A,{className:"size-3.5"})})}),(0,l.jsx)(fi.ZI,{children:"Check Status"})]}),(0,l.jsxs)(fi.m_,{children:[(0,l.jsx)(fi.k$,{render:(0,l.jsx)(O.$,{variant:"ghost",size:"icon",className:"size-8 text-destructive hover:text-destructive","aria-label":`Remove ${a.provider} deployment`,onClick:()=>G(a),children:(0,l.jsx)(Y.A,{className:"size-3.5"})})}),(0,l.jsx)(fi.ZI,{children:"Remove deployment"})]})]})})})]},a.id)})]})})})]})}let fW={name:"link",size:24,node:[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]};fW.node;let fX=(0,q.A)(fW);var fY=c(43386);let fZ={name:"laptop",size:24,node:[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]]};fZ.node;let f$=(0,q.A)(fZ),f_={name:"maximize",size:24,node:[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]};f_.node;let f0=(0,q.A)(f_);var f1=c(92676),f2=c(53343),f3=c(49857);let f4=()=>({name:"",url:"",transport:"http",connectionType:"direct",proxyUrl:"",proxyAuthToken:"",proxyAuthHeader:"Authorization",headers:{},enabledForLocalChat:!0});function f5(a){if(!a.trim())return{};let b={};for(let c of a.split("\n")){let a=c.indexOf(":");if(a<1)throw Error("Use one header per line: Name: value");b[c.slice(0,a).trim()]=c.slice(a+1).trim()}return b}function f6({status:a,toolCount:b}){return a?"testing"===a?(0,l.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,l.jsx)(M.A,{className:"size-3.5 animate-spin text-amber-500 dark:text-amber-400"}),(0,l.jsx)("span",{className:"text-xs font-medium text-amber-600 dark:text-amber-400",children:"Testing…"})]}):"connected"===a?(0,l.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,l.jsx)(as.A,{className:"size-3.5 rounded-full bg-emerald-600 p-0.5 text-white dark:bg-emerald-500"}),(0,l.jsx)("span",{className:"text-xs font-medium text-emerald-700 dark:text-emerald-400",children:"Connected"}),(0,l.jsxs)(ft.E,{variant:"secondary",className:"ml-0.5 px-1.5 py-0 text-[10px] font-semibold leading-4",children:[b," tool",1!==b?"s":""]})]}):(0,l.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,l.jsx)(dX.A,{className:"size-3.5 text-destructive"}),(0,l.jsx)("span",{className:"text-xs font-medium text-destructive",children:"Disconnected"})]}):null}function f7({connection:a,testResult:b,isTesting:c,onToggle:d,onTest:e,onDelete:f,onEdit:g}){return(0,l.jsxs)("div",{className:"group flex flex-wrap items-center gap-4 rounded-xl border border-border bg-white/70 px-4 py-3.5 transition-colors hover:border-primary/20 hover:bg-white/90 dark:bg-card/60 dark:hover:border-primary/30 dark:hover:bg-card/80 cursor-pointer",onClick:g,role:"button",tabIndex:0,onKeyDown:a=>"Enter"===a.key&&g(),children:[(0,l.jsx)("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg border border-border bg-white dark:border-border/60 dark:bg-secondary/70",children:(0,l.jsx)("img",{src:"/icons/mcp.svg",alt:"",className:"size-5 object-contain"})}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("p",{className:"truncate text-sm font-medium",children:a.name}),(0,l.jsx)(ft.E,{variant:"outline",className:"shrink-0 text-[10px] uppercase tracking-wide",children:"sse"===a.transport?"SSE":"HTTP"}),"proxy"===a.connectionType&&(0,l.jsx)(ft.E,{variant:"outline",className:"shrink-0 text-[10px] uppercase tracking-wide",children:"Proxy"})]}),(0,l.jsx)("p",{className:"mt-0.5 truncate font-mono text-xs text-muted-foreground",children:a.url})]}),(0,l.jsx)(f6,{status:b?.status,toolCount:b?.toolCount??0}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5",onClick:a=>a.stopPropagation(),children:[(0,l.jsx)(d8.d,{checked:a.enabled,onCheckedChange:d,"aria-label":`Enable ${a.name}`}),(0,l.jsx)(fi.Bc,{delay:300,children:(0,l.jsxs)(fi.m_,{children:[(0,l.jsx)(fi.k$,{render:(0,l.jsx)(O.$,{variant:"ghost",size:"icon",className:"size-8 text-muted-foreground hover:text-foreground",onClick:e,disabled:c,children:c?(0,l.jsx)(M.A,{className:"size-3.5 animate-spin"}):(0,l.jsx)(X.A,{className:"size-3.5"})})}),(0,l.jsx)(fi.ZI,{side:"bottom",children:"Test connection"})]})}),(0,l.jsx)(fi.Bc,{delay:300,children:(0,l.jsxs)(fi.m_,{children:[(0,l.jsx)(fi.k$,{render:(0,l.jsx)(O.$,{variant:"ghost",size:"icon",className:"size-8 text-muted-foreground hover:text-destructive",onClick:f,"aria-label":`Remove ${a.name}`,children:(0,l.jsx)(Y.A,{className:"size-3.5"})})}),(0,l.jsx)(fi.ZI,{side:"bottom",children:"Remove connection"})]})})]})]})}function f8(){let[a,b]=(0,m.useState)([]),[c,d]=(0,m.useState)(!0),[e,f]=(0,m.useState)(!1),[g,h]=(0,m.useState)(f4),[i,j]=(0,m.useState)(""),[k,n]=(0,m.useState)(!1),[o,p]=(0,m.useState)(null),[q,r]=(0,m.useState)(null),[s,t]=(0,m.useState)(""),[u,v]=(0,m.useState)(1),[w,x]=(0,m.useState)({}),[y,z]=(0,m.useState)(null),[A,B]=(0,m.useState)(f4),[C,D]=(0,m.useState)(""),[E,F]=(0,m.useState)(!1),G=async a=>{x(b=>({...b,[a]:{status:"testing",toolCount:0}}));try{let b=await fetch(`/api/mcp/${a}/test`,{method:"POST"}),c=await b.json();if(!b.ok)throw Error();x(b=>({...b,[a]:{status:"connected",toolCount:c.toolCount||0}}))}catch(b){x(b=>({...b,[a]:{status:"disconnected",toolCount:0}}))}},H=()=>{h(f4()),j(""),f(!0)},I=async()=>{n(!0);try{let{proxyUrl:a,proxyAuthToken:c,proxyAuthHeader:d,...e}=g,h=await fetch("/api/mcp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,..."proxy"===g.connectionType?{proxyUrl:a,proxyAuthToken:c,proxyAuthHeader:d}:{},headers:f5(i)})}),j=await h.json();if(!h.ok)throw Error(j.error||"Could not add MCP connection");b(a=>[...a,j]),f(!1),G(j.id),S.oR.success("MCP connected")}catch(a){S.oR.error(a instanceof Error?a.message:"Could not add MCP connection")}finally{n(!1)}},J=async(a,c)=>{let d=await fetch(`/api/mcp/${a.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}),e=await d.json();if(!d.ok)throw Error(e.error||"Could not update MCP connection");b(b=>b.map(b=>b.id===a.id?e:b))},K=async a=>{p(a.id),x(b=>({...b,[a.id]:{status:"testing",toolCount:0}}));try{let b=await fetch(`/api/mcp/${a.id}/test`,{method:"POST"}),c=await b.json();if(!b.ok)throw Error(c.error||"Connection test failed");x(b=>({...b,[a.id]:{status:"connected",toolCount:c.toolCount||0}})),S.oR.success(`Connected — ${c.toolCount} tool${1===c.toolCount?"":"s"} found`)}catch(b){x(b=>({...b,[a.id]:{status:"disconnected",toolCount:0}})),S.oR.error(b instanceof Error?b.message:"Connection test failed")}finally{p(null)}},L=async()=>{if(q)try{let a=await fetch(`/api/mcp/${q.id}`,{method:"DELETE"});if(!a.ok)throw Error((await a.json()).error||"Could not remove MCP");b(a=>a.filter(a=>a.id!==q.id)),S.oR.success("MCP connection removed")}catch(a){S.oR.error(a instanceof Error?a.message:"Could not remove MCP")}finally{r(null)}},N=async()=>{if(y){F(!0);try{let{proxyUrl:a,proxyAuthToken:b,proxyAuthHeader:c,...d}=A,e={...d,..."proxy"===A.connectionType?{proxyUrl:a,proxyAuthToken:b,proxyAuthHeader:c}:{},headers:f5(C)};await J(y,e),z(null),G(y.id),S.oR.success("Connection updated")}catch(a){S.oR.error(a instanceof Error?a.message:"Could not update connection")}finally{F(!1)}}},U=a.filter(a=>!s.trim()||a.name.toLowerCase().includes(s.trim().toLowerCase())||a.url.toLowerCase().includes(s.trim().toLowerCase())),V=Math.ceil(U.length/5),W=U.slice((u-1)*5,5*u);return(0,l.jsxs)(T.Zp,{className:"bg-transparent border-none",children:[(0,l.jsxs)(T.Wu,{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"w-full gap-3 flex items-center justify-between",children:[!c&&a.length>0&&(0,l.jsxs)("div",{className:"relative w-full",children:[(0,l.jsx)(dD.A,{className:"absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),(0,l.jsx)(P.p,{placeholder:"Search connections…",className:"h-9 pl-9 w-full bg-white/70",value:s,onChange:a=>t(a.target.value)})]}),(0,l.jsx)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:a.length>0&&(0,l.jsxs)(O.$,{onClick:H,size:"default",className:"gap-1.5 px-3",children:[(0,l.jsx)(ah.A,{className:"size-3.5"})," Add MCP"]})})]}),c?(0,l.jsxs)("div",{className:"flex items-center justify-center py-14 text-sm text-muted-foreground",children:[(0,l.jsx)(M.A,{className:"mr-2 size-4 animate-spin"})," Loading connections…"]}):0===a.length?(0,l.jsx)("div",{className:"rounded-xl px-4 py-20 dark:bg-card/40",children:(0,l.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,l.jsx)("div",{className:"flex size-12 items-center justify-center rounded-xl border border-border dark:bg-secondary/70",children:(0,l.jsx)("img",{src:"/icons/mcp.svg",alt:"MCP",className:"size-7 object-contain"})}),(0,l.jsxs)("div",{className:"text-center",children:[(0,l.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"No MCP connections yet"}),(0,l.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Add a remote MCP endpoint to discover its tools."})]}),(0,l.jsxs)(O.$,{onClick:H,className:"mt-2 gap-1.5",children:[(0,l.jsx)(ah.A,{className:"size-4"})," Add MCP"]})]})}):0===U.length?(0,l.jsxs)("div",{className:"flex flex-col items-center gap-2 rounded-xl border border-dashed border-border bg-white/60 px-4 py-14 dark:bg-card/40",children:[(0,l.jsx)(f1.A,{className:"size-5 text-muted-foreground"}),(0,l.jsxs)("p",{className:"text-sm text-muted-foreground",children:["No connections match “",s,"”"]})]}):(0,l.jsxs)("div",{className:"space-y-2",children:[W.map(a=>(0,l.jsx)(f7,{connection:a,testResult:w[a.id],isTesting:o===a.id,onToggle:b=>void J(a,{enabled:b}).catch(a=>S.oR.error(a.message)),onTest:()=>void K(a),onDelete:()=>r(a),onEdit:()=>{z(a),B({name:a.name,url:a.url,transport:a.transport,connectionType:a.connectionType,proxyUrl:a.proxyUrl??"",proxyAuthToken:a.proxyAuthToken??"",proxyAuthHeader:a.proxyAuthHeader??"Authorization",headers:a.headers??{},enabledForLocalChat:a.enabledForLocalChat}),D(Object.entries(a.headers??{}).map(([a,b])=>`${a}: ${b}`).join("\n"))}},a.id)),V>1&&(0,l.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,l.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Showing ",(u-1)*5+1," to"," ",Math.min(5*u,U.length)," of ",U.length," connections"]}),(0,l.jsxs)("div",{className:"flex items-center gap-1",children:[(0,l.jsx)(O.$,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:1===u,onClick:()=>v(a=>Math.max(1,a-1)),children:(0,l.jsx)(eb.A,{className:"size-3.5"})}),(0,l.jsxs)("span",{className:"text-xs text-muted-foreground mx-2",children:["Page ",u," of ",V]}),(0,l.jsx)(O.$,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:u===V,onClick:()=>v(a=>Math.min(V,a+1)),children:(0,l.jsx)(f2.A,{className:"size-3.5"})})]})]})]})]}),(0,l.jsx)(dx.lG,{open:e,onOpenChange:f,children:(0,l.jsxs)(dx.Cf,{className:"max-h-[calc(100dvh-2rem)] w-full max-w-3xl! overflow-hidden flex flex-col",children:[(0,l.jsxs)(dx.c7,{children:[(0,l.jsx)(dx.L3,{children:"Add MCP connection"}),(0,l.jsx)(dx.rr,{children:"Supports remote Streamable HTTP and SSE. Store MCP credentials in headers, never in a URL."})]}),(0,l.jsxs)("div",{className:"grid gap-4 py-2 max-h-[60vh] overflow-y-auto pr-1",children:[(0,l.jsxs)("div",{className:"grid gap-1.5",children:[(0,l.jsxs)(Q.J,{htmlFor:"mcp-name",children:["Name ",(0,l.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,l.jsx)(P.p,{id:"mcp-name",placeholder:"Customer support",value:g.name,onChange:a=>h({...g,name:a.target.value}),disabled:k})]}),(0,l.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,l.jsxs)("div",{className:"grid gap-1.5",children:[(0,l.jsxs)(Q.J,{children:["Transport ",(0,l.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,l.jsxs)(R.l6,{value:g.transport,onValueChange:a=>h({...g,transport:a}),disabled:k,children:[(0,l.jsx)(R.bq,{className:"w-full",children:"sse"===g.transport?"SSE":"Streamable HTTP"}),(0,l.jsxs)(R.gC,{children:[(0,l.jsx)(R.eb,{value:"http",children:"Streamable HTTP"}),(0,l.jsx)(R.eb,{value:"sse",children:"SSE (legacy)"})]})]})]}),(0,l.jsxs)("div",{className:"grid gap-1.5",children:[(0,l.jsxs)(Q.J,{children:["Connection type ",(0,l.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,l.jsxs)(R.l6,{value:g.connectionType,onValueChange:a=>h({...g,connectionType:a}),disabled:k,children:[(0,l.jsx)(R.bq,{className:"w-full","aria-label":"Connection type",children:"proxy"===g.connectionType?"Proxy":"Direct"}),(0,l.jsxs)(R.gC,{children:[(0,l.jsx)(R.eb,{value:"direct",children:"Direct"}),(0,l.jsx)(R.eb,{value:"proxy",children:"Proxy"})]})]})]})]}),(0,l.jsxs)("div",{className:"grid gap-1.5",children:[(0,l.jsxs)(Q.J,{htmlFor:"mcp-url",children:["Server URL ",(0,l.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,l.jsx)(P.p,{id:"mcp-url",inputMode:"url",placeholder:"https://mcp.example.com/mcp",value:g.url,onChange:a=>h({...g,url:a.target.value}),disabled:k})]}),"proxy"===g.connectionType&&(0,l.jsxs)("div",{className:"grid gap-4 rounded-lg border border-dashed bg-muted/20 p-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-sm font-medium",children:"Proxy configuration"}),(0,l.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"MCP traffic is sent to this proxy instead of the MCP server URL above."})]}),(0,l.jsxs)("div",{className:"grid gap-1.5",children:[(0,l.jsxs)(Q.J,{htmlFor:"mcp-proxy-url",children:["Proxy URL ",(0,l.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,l.jsx)(P.p,{id:"mcp-proxy-url",inputMode:"url",placeholder:"https://proxy.example.com/mcp",value:g.proxyUrl??"",onChange:a=>h({...g,proxyUrl:a.target.value}),disabled:k})]}),(0,l.jsxs)("div",{className:"grid gap-1.5",children:[(0,l.jsxs)(Q.J,{htmlFor:"mcp-proxy-token",children:["Proxy auth token"," ",(0,l.jsx)("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),(0,l.jsx)(P.p,{id:"mcp-proxy-token",type:"password",autoComplete:"new-password",placeholder:"Proxy access token",value:g.proxyAuthToken??"",onChange:a=>h({...g,proxyAuthToken:a.target.value}),disabled:k})]}),(0,l.jsxs)("div",{className:"grid gap-1.5",children:[(0,l.jsx)(Q.J,{htmlFor:"mcp-proxy-auth-header",children:"Proxy auth header"}),(0,l.jsx)(P.p,{id:"mcp-proxy-auth-header",placeholder:"Authorization",value:g.proxyAuthHeader??"Authorization",onChange:a=>h({...g,proxyAuthHeader:a.target.value}),disabled:k})]})]}),(0,l.jsxs)("div",{className:"grid gap-1.5",children:[(0,l.jsxs)(Q.J,{htmlFor:"mcp-headers",children:["Headers ",(0,l.jsx)("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),(0,l.jsx)(dz.T,{id:"mcp-headers",className:"min-h-24 font-mono text-xs",placeholder:"Authorization: Bearer your-token\nX-Workspace: acme",value:i,onChange:a=>j(a.target.value),disabled:k})]})]}),(0,l.jsxs)(dx.Es,{children:[(0,l.jsx)(O.$,{variant:"outline",onClick:()=>f(!1),disabled:k,children:"Cancel"}),(0,l.jsx)(O.$,{onClick:()=>void I(),disabled:k||!g.name.trim()||!g.url.trim(),children:k?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(M.A,{className:"mr-2 size-4 animate-spin"}),"Connecting…"]}):"Add connection"})]})]})}),(0,l.jsx)(dx.lG,{open:null!==y,onOpenChange:a=>!a&&z(null),children:(0,l.jsxs)(dx.Cf,{className:"max-h-[calc(100dvh-2rem)] w-full max-w-3xl! overflow-hidden flex flex-col",children:[(0,l.jsxs)(dx.c7,{children:[(0,l.jsxs)(dx.L3,{className:"flex items-center gap-2",children:[(0,l.jsx)(d7.A,{className:"size-4"}),"Edit connection"]}),(0,l.jsxs)(dx.rr,{children:["Update the configuration for"," ",(0,l.jsx)("span",{className:"font-medium text-foreground",children:y?.name}),"."]})]}),(0,l.jsxs)("div",{className:"grid gap-4 py-2 max-h-[60vh] overflow-y-auto pr-1",children:[(0,l.jsxs)("div",{className:"grid gap-1.5",children:[(0,l.jsxs)(Q.J,{htmlFor:"edit-mcp-name",children:["Name ",(0,l.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,l.jsx)(P.p,{id:"edit-mcp-name",placeholder:"Customer support",value:A.name,onChange:a=>B({...A,name:a.target.value}),disabled:E})]}),(0,l.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,l.jsxs)("div",{className:"grid gap-1.5",children:[(0,l.jsxs)(Q.J,{children:["Transport ",(0,l.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,l.jsxs)(R.l6,{value:A.transport,onValueChange:a=>B({...A,transport:a}),disabled:E,children:[(0,l.jsx)(R.bq,{className:"w-full",children:"sse"===A.transport?"SSE":"Streamable HTTP"}),(0,l.jsxs)(R.gC,{children:[(0,l.jsx)(R.eb,{value:"http",children:"Streamable HTTP"}),(0,l.jsx)(R.eb,{value:"sse",children:"SSE (legacy)"})]})]})]}),(0,l.jsxs)("div",{className:"grid gap-1.5",children:[(0,l.jsxs)(Q.J,{children:["Connection type ",(0,l.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,l.jsxs)(R.l6,{value:A.connectionType,onValueChange:a=>B({...A,connectionType:a}),disabled:E,children:[(0,l.jsx)(R.bq,{className:"w-full","aria-label":"Connection type",children:"proxy"===A.connectionType?"Proxy":"Direct"}),(0,l.jsxs)(R.gC,{children:[(0,l.jsx)(R.eb,{value:"direct",children:"Direct"}),(0,l.jsx)(R.eb,{value:"proxy",children:"Proxy"})]})]})]})]}),(0,l.jsxs)("div",{className:"grid gap-1.5",children:[(0,l.jsxs)(Q.J,{htmlFor:"edit-mcp-url",children:["Server URL ",(0,l.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,l.jsx)(P.p,{id:"edit-mcp-url",inputMode:"url",placeholder:"https://mcp.example.com/mcp",value:A.url,onChange:a=>B({...A,url:a.target.value}),disabled:E})]}),"proxy"===A.connectionType&&(0,l.jsxs)("div",{className:"grid gap-4 rounded-lg border border-dashed bg-muted/20 p-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-sm font-medium",children:"Proxy configuration"}),(0,l.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"MCP traffic is sent to this proxy instead of the MCP server URL above."})]}),(0,l.jsxs)("div",{className:"grid gap-1.5",children:[(0,l.jsxs)(Q.J,{htmlFor:"edit-mcp-proxy-url",children:["Proxy URL ",(0,l.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,l.jsx)(P.p,{id:"edit-mcp-proxy-url",inputMode:"url",placeholder:"https://proxy.example.com/mcp",value:A.proxyUrl??"",onChange:a=>B({...A,proxyUrl:a.target.value}),disabled:E})]}),(0,l.jsxs)("div",{className:"grid gap-1.5",children:[(0,l.jsxs)(Q.J,{htmlFor:"edit-mcp-proxy-token",children:["Proxy auth token"," ",(0,l.jsx)("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),(0,l.jsx)(P.p,{id:"edit-mcp-proxy-token",type:"password",autoComplete:"new-password",placeholder:"Proxy access token",value:A.proxyAuthToken??"",onChange:a=>B({...A,proxyAuthToken:a.target.value}),disabled:E})]}),(0,l.jsxs)("div",{className:"grid gap-1.5",children:[(0,l.jsx)(Q.J,{htmlFor:"edit-mcp-proxy-auth-header",children:"Proxy auth header"}),(0,l.jsx)(P.p,{id:"edit-mcp-proxy-auth-header",placeholder:"Authorization",value:A.proxyAuthHeader??"Authorization",onChange:a=>B({...A,proxyAuthHeader:a.target.value}),disabled:E})]})]}),(0,l.jsxs)("div",{className:"grid gap-1.5",children:[(0,l.jsxs)(Q.J,{htmlFor:"edit-mcp-headers",children:["Headers ",(0,l.jsx)("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),(0,l.jsx)(dz.T,{id:"edit-mcp-headers",className:"min-h-24 font-mono text-xs",placeholder:"Authorization: Bearer your-token\nX-Workspace: acme",value:C,onChange:a=>D(a.target.value),disabled:E})]})]}),(0,l.jsxs)(dx.Es,{children:[(0,l.jsx)(O.$,{variant:"outline",onClick:()=>z(null),disabled:E,children:"Cancel"}),(0,l.jsx)(O.$,{onClick:()=>void N(),disabled:E||!A.name.trim()||!A.url.trim(),children:E?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(M.A,{className:"mr-2 size-4 animate-spin"}),"Saving…"]}):"Save changes"})]})]})}),(0,l.jsx)(f3.K,{open:null!==q,onOpenChange:a=>!a&&r(null),title:"Remove MCP connection",description:`Remove "${q?.name}"? It will no longer be available to Local Chat or Agents.`,actionText:"Remove",variant:"destructive",onAction:()=>void L()})]})}let f9=a=>fetch(a).then(a=>a.json());function ga(a,b){let c=a.match(RegExp(`^${b}:\\s*["']?([^\\n"']+)["']?\\s*$`,"m"));return c?.[1]?.trim()}function gb({open:a,onOpenChange:b,onAdd:c}){let[d,e]=(0,m.useState)("inline"),[f,g]=(0,m.useState)(""),[h,i]=(0,m.useState)(""),[j,k]=(0,m.useState)(""),n=(0,m.useRef)(null);return(0,l.jsx)(dx.lG,{open:a,onOpenChange:b,children:(0,l.jsxs)(dx.Cf,{className:"max-h-[calc(100dvh-2rem)] w-full max-w-3xl! overflow-hidden flex flex-col",children:[(0,l.jsxs)(dx.c7,{children:[(0,l.jsx)(dx.L3,{children:"Add an Agent Skill"}),(0,l.jsx)(dx.rr,{children:"Skills use the open `SKILL.md` format: metadata plus task instructions and optional resources."})]}),(0,l.jsxs)("div",{className:"grid gap-4 py-2 max-h-[60vh] overflow-y-auto pr-1",children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("label",{className:"text-sm font-medium",children:"Skill name"}),(0,l.jsx)(P.p,{"aria-label":"Skill name",value:j,onChange:a=>k(a.target.value),placeholder:"Name (read from metadata if blank)"})]}),(0,l.jsxs)(eW,{value:d,onValueChange:a=>e(a),children:[(0,l.jsx)("div",{className:"flex items-center gap-1 mb-4 border-b border-border",children:["inline","remote"].map(a=>{let b=d===a,c="inline"===a?"Local":"Remote",f="inline"===a?fm.A:fX;return(0,l.jsxs)("button",{type:"button",onClick:()=>e(a),className:(0,E.cn)("relative flex items-center gap-2 px-4 py-2.5 text-sm font-medium transition-colors outline-none",b?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[(0,l.jsx)(f,{className:"size-4"}),c,b&&(0,l.jsx)("span",{"aria-hidden":"true",className:"absolute bottom-0 left-0 right-0 h-0.5 rounded-full bg-primary motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-left-2 motion-safe:duration-200"})]},a)})}),(0,l.jsxs)(e$,{value:"inline",className:"space-y-3 pt-0",children:[(0,l.jsx)("input",{ref:n,type:"file",accept:".md,text/markdown",className:"hidden",onChange:async a=>{let b=a.target.files?.[0];b&&g(await b.text()),a.currentTarget.value=""}}),(0,l.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,l.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Upload a portable SKILL.md or paste its full contents below."}),(0,l.jsxs)(O.$,{variant:"outline",size:"sm",onClick:()=>n.current?.click(),className:"shrink-0 gap-1.5",children:[(0,l.jsx)(fY.A,{className:"size-3.5"}),"Upload"]})]}),(0,l.jsx)(dz.T,{value:f,onChange:a=>g(a.target.value),placeholder:"---\nname: release-checklist\ndescription: Safely prepare a production release.\n---\n\n# Instructions\n...",className:"min-h-40 resize-none font-mono text-xs"})]}),(0,l.jsxs)(e$,{value:"remote",className:"space-y-3 pt-0",children:[(0,l.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Keep a canonical remote `SKILL.md` reference so a deployed agent can resolve the same versioned workflow."}),(0,l.jsx)(P.p,{"aria-label":"Remote SKILL.md URL",value:h,onChange:a=>i(a.target.value),placeholder:"https://example.com/skills/release/SKILL.md"})]})]})]}),(0,l.jsxs)(dx.Es,{className:"mt-2",children:[(0,l.jsx)(O.$,{variant:"outline",onClick:()=>b(!1),children:"Cancel"}),(0,l.jsx)(O.$,{onClick:function(){if("inline"===d&&!f.trim())return S.oR.error("Paste or upload a SKILL.md file first.");if("remote"===d)try{new URL(h)}catch{return S.oR.error("Enter a valid SKILL.md URL.")}let a="inline"===d?ga(f,"name"):"",b="inline"===d?ga(f,"description"):"",e=j.trim()||a||("remote"===d?new URL(h).hostname:"Untitled skill");c({id:crypto.randomUUID(),name:e,description:b||"Custom agent workflow.",source:d,enabled:!0,..."inline"===d?{content:f}:{url:h},updatedAt:new Date().toISOString()}),g(""),i(""),k("")},children:"Add skill"})]})]})})}function gc(){let{data:a,mutate:b}=(0,H.u)("/api/config",f9),{data:c}=(0,H.u)("/api/marketplace",f9),{data:d}=(0,H.u)("/api/projects/runtime",f9),[e,f]=(0,m.useState)(""),[g,h]=(0,m.useState)([]),[i,j]=(0,m.useState)([]),[k,n]=(0,m.useState)(""),[o,p]=(0,m.useState)(!1),[q,r]=(0,m.useState)("prompt"),[s,t]=(0,m.useState)(!1),u=(0,m.useMemo)(()=>(c?.tools??[]).filter(a=>"installed"===a.status).map(a=>({...a,icon:fq,plugin:!0})),[c]),v=(0,m.useMemo)(()=>[...fD.d3,...u],[u]);async function w(e,f){if(a?.config){t(!0);try{let h=e.enabledTools??g,i=(c?.tools??[]).filter(a=>"installed"===a.status&&a.packageName&&(0===h.length||h.includes(a.id))).map(a=>({id:a.id,name:a.name,packageName:a.packageName,version:a.version})),j=await fetch("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a.config,...e,agentPlugins:c?i:a.config.agentPlugins})}),k=await j.json();if(!j.ok)throw Error(k.error??"Could not save Assistant settings.");await b(k,{revalidate:!1}),S.oR.success(d?.runtime?.running?`${f} Restart the running Agent to apply it.`:f)}catch(a){S.oR.error(a instanceof Error?a.message:"Could not save Assistant settings.")}finally{t(!1)}}}let y=i.filter(a=>!k.trim()||a.name.toLowerCase().includes(k.trim().toLowerCase())||a.description.toLowerCase().includes(k.trim().toLowerCase()));if(!a)return(0,l.jsx)("div",{className:"flex h-40 items-center justify-center",children:(0,l.jsx)(M.A,{className:"size-5 animate-spin text-muted-foreground"})});let z=({title:a,tools:b,empty:c})=>(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(x,{className:"size-4 text-muted-foreground"}),(0,l.jsx)("h2",{className:"text-sm font-medium",children:a})]}),0===b.length?(0,l.jsx)("p",{className:"rounded-lg border border-dashed p-5 text-sm text-muted-foreground",children:c}):(0,l.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:b.map(a=>{let b,c=a.icon;return(0,l.jsxs)("div",{className:"flex min-h-22 items-center gap-3 rounded-xl border bg-white/70 px-4 py-4 dark:bg-card/70",children:[(0,l.jsx)("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg border bg-muted/40",children:(0,l.jsx)(c,{className:"size-4.5"})}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("p",{className:"text-sm font-medium",children:[a.name,a.plugin&&(0,l.jsx)("span",{className:"ml-2 rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-normal text-muted-foreground",children:"Plugin"})]}),(0,l.jsx)("p",{className:"mt-0.5 line-clamp-1 text-xs text-muted-foreground",children:a.description})]}),(0,l.jsx)(d8.d,{checked:(b=a.id,0===g.length||g.includes(b)),disabled:s,"aria-label":`Toggle ${a.name}`,onCheckedChange:b=>{var c;let d,e,f;return c=a.id,d=v.map(a=>a.id),e=0===g.length?d:g,void(h(f=b?[...new Set([...e,c])]:e.filter(a=>a!==c)),w({enabledTools:f},`${b?"Enabled":"Disabled"} tool.`))}})]},a.id)})})]});return(0,l.jsxs)("section",{className:"space-y-5",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"text-xl font-semibold tracking-tight",children:"Agent Customization"}),(0,l.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Set the instructions and local capabilities available to this Project’s Agent."})]}),(0,l.jsx)(d9,{activeTab:q,onTabChange:r,tabs:[{id:"prompt",label:"Prompt",icon:B},{id:"tools",label:"Tools",icon:x},{id:"skills",label:"Skills",icon:a=>(0,l.jsx)("img",{src:"/icons/agentskills.png",alt:"",...a})},{id:"mcp",label:"MCP",icon:a=>(0,l.jsx)("img",{src:"/icons/mcp.svg",alt:"",...a})},{id:"sandbox",label:"Sandbox",icon:f$}],className:"mb-6 pb-0"}),"prompt"===q&&(0,l.jsx)("div",{className:"pt-2 animate-in fade-in-0 duration-200",children:(0,l.jsxs)("div",{className:"rounded-xl border bg-white/70 p-5 dark:bg-card/70",children:[(0,l.jsx)("label",{htmlFor:"assistant-system-prompt",className:"text-sm font-medium",children:"System prompt"}),(0,l.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Larkup combines these instructions with its retrieval and tool safety rules."}),(0,l.jsxs)("div",{className:"relative mt-4",children:[(0,l.jsx)(dz.T,{id:"assistant-system-prompt",value:e,onChange:a=>f(a.target.value),placeholder:"You are a helpful research assistant...",className:"min-h-52 max-h-60 resize-none pb-10 font-mono text-sm"}),(0,l.jsxs)(dx.lG,{children:[(0,l.jsx)(dx.zM,{render:(0,l.jsx)("button",{type:"button","aria-label":"Expand system prompt",className:"absolute bottom-2 right-2 rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:(0,l.jsx)(f0,{className:"size-4"})})}),(0,l.jsxs)(dx.Cf,{className:"max-w-[90vw] sm:max-w-4xl w-[90vw] h-[90vh] sm:max-h-200 flex flex-col",children:[(0,l.jsxs)(dx.c7,{className:"shrink-0 space-y-0 p-3 pb-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(dx.L3,{className:"text-lg font-semibold",children:"Edit system prompt"}),(0,l.jsx)(fm.A,{className:"size-4 text-muted-foreground"})]}),(0,l.jsx)(dx.rr,{children:"Edit the complete prompt without resizing the settings page."})]}),(0,l.jsx)("div",{className:"flex-1 min-h-0 mt-2 relative",children:(0,l.jsx)(dz.T,{value:e,onChange:a=>f(a.target.value),placeholder:"You are a helpful research assistant...",className:"h-full w-full rounded-lg border border-border/40 bg-background px-4 py-3 text-sm text-foreground outline-none transition focus:border-border resize-none [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/40 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-transparent font-mono"})}),(0,l.jsx)(dx.Es,{className:"mt-6 justify-end flex items-center gap-2 shrink-0",children:(0,l.jsx)(dx.HM,{render:(0,l.jsx)(O.$,{variant:"outline",className:"px-3"}),children:"Done"})})]})]})]}),(0,l.jsx)("div",{className:"mt-4 flex justify-end",children:(0,l.jsxs)(O.$,{onClick:()=>void w({systemPrompt:e},"Agent prompt saved."),disabled:s,children:[(0,l.jsx)(N.A,{className:"size-4"}),"Save prompt"]})})]})}),"tools"===q&&(0,l.jsxs)("div",{className:"pt-2 animate-in fade-in-0 duration-200 space-y-7",children:[(0,l.jsx)(z,{title:"Built-in tools",tools:fD.d3}),(0,l.jsx)(z,{title:"Marketplace plugins",tools:u,empty:"You have not enabled any local capabilities."})]}),"skills"===q&&(0,l.jsxs)("div",{className:"pt-2 animate-in fade-in-0 duration-200 space-y-4",children:[(0,l.jsx)(gb,{open:o,onOpenChange:p,onAdd:a=>{let b=[...i,a];j(b),w({skills:b},"Skill added."),p(!1)}}),(0,l.jsxs)("div",{className:"w-full gap-3 flex items-center justify-between",children:[i.length>0&&(0,l.jsxs)("div",{className:"relative w-full",children:[(0,l.jsx)(dD.A,{className:"absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),(0,l.jsx)(P.p,{placeholder:"Search skills…",className:"h-9 pl-9 w-full bg-white/70 dark:bg-card/70",value:k,onChange:a=>n(a.target.value)})]}),(0,l.jsx)("div",{className:"flex flex-wrap items-start justify-between gap-4 ml-auto",children:i.length>0&&(0,l.jsxs)(O.$,{onClick:()=>p(!0),size:"default",className:"gap-1.5 px-3",children:[(0,l.jsx)(ah.A,{className:"size-3.5"})," Add skill"]})})]}),0===i.length?(0,l.jsx)("div",{className:"rounded-xl px-4 py-20 dark:bg-card/40",children:(0,l.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,l.jsx)("div",{className:"flex size-12 items-center justify-center rounded-xl border border-border dark:bg-secondary/70",children:(0,l.jsx)("img",{src:"/icons/agentskills.png",alt:"",className:"size-6 object-contain"})}),(0,l.jsxs)("div",{className:"text-center",children:[(0,l.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"No skills added yet"}),(0,l.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Import a SKILL.md or keep a canonical remote skill URL."})]}),(0,l.jsxs)(O.$,{onClick:()=>p(!0),className:"mt-2 gap-1.5",children:[(0,l.jsx)(ah.A,{className:"size-4"})," Add skill"]})]})}):0===y.length?(0,l.jsxs)("div",{className:"flex flex-col items-center gap-2 rounded-xl border border-dashed border-border bg-white/60 px-4 py-14 dark:bg-card/40",children:[(0,l.jsx)(f1.A,{className:"size-5 text-muted-foreground"}),(0,l.jsxs)("p",{className:"text-sm text-muted-foreground",children:["No skills match “",k,"”"]})]}):(0,l.jsx)("div",{className:"grid gap-3",children:y.map(a=>(0,l.jsxs)("div",{className:"flex items-start gap-3 rounded-xl border bg-white/70 p-4 dark:bg-card/70",children:[(0,l.jsx)("div",{className:"mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg border bg-muted/40",children:"remote"===a.source?(0,l.jsx)(fX,{className:"size-4"}):(0,l.jsx)("img",{src:"/icons/agentskills.png",alt:"",className:"size-4 object-contain"})}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)("p",{className:"text-sm font-medium",children:a.name}),(0,l.jsx)("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:"remote"===a.source?"Remote":"SKILL.md"})]}),(0,l.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:a.description}),a.url&&(0,l.jsx)("p",{className:"mt-2 truncate font-mono text-[11px] text-muted-foreground",children:a.url})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(d8.d,{className:"",checked:!1!==a.enabled,disabled:s,"aria-label":`Toggle ${a.name}`,onCheckedChange:b=>{var c;let d;return c=a.id,void(j(d=i.map(a=>a.id===c?{...a,enabled:b}:a)),w({skills:d},`${b?"Enabled":"Disabled"} skill.`))}}),(0,l.jsx)(O.$,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${a.name}`,onClick:()=>{let b=i.filter(b=>b.id!==a.id);j(b),w({skills:b},"Skill removed.")},children:(0,l.jsx)(Y.A,{className:"size-4 hover:text-destructive"})})]})]},a.id))})]}),"mcp"===q&&(0,l.jsx)("div",{className:"pt-2 animate-in fade-in-0 duration-200",children:(0,l.jsx)(f8,{})}),"sandbox"===q&&(0,l.jsx)("div",{className:"pt-2 animate-in fade-in-0 duration-200",children:(0,l.jsx)(fC,{embedded:!0})})]})}let gd={name:"earth",size:24,node:[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],aliases:["globe-2"]};gd.node;let ge=(0,q.A)(gd),gf=a=>fetch(a).then(a=>a.json());function gg(){let{data:a,isLoading:b,mutate:c}=(0,H.u)("/api/config",gf),[d,e]=(0,m.useState)({}),[f,g]=(0,m.useState)(null),[h,i]=(0,m.useState)(!1),[j,k]=(0,m.useState)(!1),[n,o]=(0,m.useState)(!1),[p,q]=(0,m.useState)({status:null}),[r,s]=(0,m.useState)(!1),[t,u]=(0,m.useState)({status:null}),v=d.serperApiKey!==a?.config?.serperApiKey||d.webSearchProvider!==a?.config?.webSearchProvider||d.tavilyApiKey!==a?.config?.tavilyApiKey||d.googleApiKey!==a?.config?.googleApiKey||d.braveApiKey!==a?.config?.braveApiKey||d.bingApiKey!==a?.config?.bingApiKey||d.exaApiKey!==a?.config?.exaApiKey,w=d.webCrawlerProvider!==a?.config?.webCrawlerProvider||d.firecrawlApiKey!==a?.config?.firecrawlApiKey,x=d.scraperProxyServer!==a?.config?.scraperProxyServer||d.scraperProxyUsername!==a?.config?.scraperProxyUsername||d.scraperProxyPassword!==a?.config?.scraperProxyPassword||d.useScraperProxy!==a?.config?.useScraperProxy;async function y(b){g(b);try{let f={...a?.config};"webSearch"===b?(f.serperApiKey=d.serperApiKey,f.webSearchProvider=d.webSearchProvider,f.tavilyApiKey=d.tavilyApiKey,f.googleApiKey=d.googleApiKey,f.braveApiKey=d.braveApiKey,f.bingApiKey=d.bingApiKey,f.exaApiKey=d.exaApiKey):"webCrawler"===b?(f.webCrawlerProvider=d.webCrawlerProvider,f.firecrawlApiKey=d.firecrawlApiKey):"proxy"===b&&(f.scraperProxyServer=d.scraperProxyServer,f.scraperProxyUsername=d.scraperProxyUsername,f.scraperProxyPassword=d.scraperProxyPassword,f.useScraperProxy=d.useScraperProxy);let g=await fetch("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)}),h=await g.json();if(!g.ok)throw Error(h.error??"Failed to save");e(a=>({...a,...h.config})),await c(h,{revalidate:!1}),S.oR.success("Settings saved")}catch(a){S.oR.error(a instanceof Error?a.message:"Failed to save")}finally{g(null)}}async function z(b){if(a?.config){g("webSearchToggle");try{let d=await fetch("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a.config,webSearchEnabled:b})}),f=await d.json();if(!d.ok)throw Error(f.error??"Could not update web search.");e(a=>({...a,...f.config})),await c(f,{revalidate:!1}),S.oR.success(b?"Web search is available to the Agent.":"Web search is disabled for the Agent.")}catch(a){S.oR.error(a instanceof Error?a.message:"Could not update web search.")}finally{g(null)}}}async function A(){if(!d.webSearchProvider)return;k(!0),q({status:null});let a="";("serper"===d.webSearchProvider||"google"===d.webSearchProvider)&&(a=d.serperApiKey||""),"tavily"===d.webSearchProvider&&(a=d.tavilyApiKey||""),"brave"===d.webSearchProvider&&(a=d.braveApiKey||""),"bing"===d.webSearchProvider&&(a=d.bingApiKey||""),"exa"===d.webSearchProvider&&(a=d.exaApiKey||"");try{let b=await fetch("/api/search/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:d.webSearchProvider,apiKey:a})}),c=await b.json();if(!b.ok)throw Error(c.error||"Verification failed");q({status:"success"}),S.oR.success("API Key verified successfully!")}catch(b){let a=b instanceof Error?b.message:"Verification failed";q({status:"error",message:a}),S.oR.error(a)}finally{k(!1)}}async function B(){if("cloud"===d.webCrawlerProvider){s(!0),u({status:null});try{let a=await fetch("/api/search/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:"firecrawl",apiKey:d.firecrawlApiKey||""})}),b=await a.json();if(!a.ok)throw Error(b.error||"Verification failed");u({status:"success"}),S.oR.success("Crawler API Key verified successfully!")}catch(b){let a=b instanceof Error?b.message:"Verification failed";u({status:"error",message:a}),S.oR.error(a)}finally{s(!1)}}}return b?(0,l.jsx)("div",{className:"flex h-40 items-center justify-center",children:(0,l.jsx)(M.A,{className:"size-5 animate-spin text-muted-foreground"})}):(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsx)("div",{className:"flex items-center justify-between",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-lg font-semibold tracking-tight",children:"Search & Scraping"}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:"Manage your web search and scraping integrations."})]})}),(0,l.jsxs)(T.Zp,{children:[(0,l.jsx)(T.aR,{className:"pb-3",children:(0,l.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(T.ZB,{className:"text-sm",children:"Web Search"}),(0,l.jsx)(T.BT,{className:"mt-1 text-xs",children:"Enable AI-powered web search for enriched answers."})]}),(0,l.jsx)(fi.Bc,{children:(0,l.jsxs)(fi.m_,{children:[(0,l.jsx)(fi.k$,{render:(0,l.jsx)("span",{children:(0,l.jsx)(d8.d,{checked:!0===d.webSearchEnabled,disabled:"webSearchToggle"===f,"aria-label":"Enable web search for the Agent",onCheckedChange:a=>void z(a)})})}),(0,l.jsx)(fi.ZI,{children:d.webSearchEnabled?"Web search is enabled for the running Agent.":"Enable web search for the running Agent."})]})})]})}),(0,l.jsxs)(T.Wu,{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Web Search Provider"}),(0,l.jsxs)(R.l6,{value:d.webSearchProvider||"tavily",onValueChange:a=>{e({...d,webSearchProvider:a}),q({status:null})},children:[(0,l.jsx)(R.bq,{className:" w-full",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:["serper"===d.webSearchProvider&&(0,l.jsx)(dS(),{src:"/icons/serper.png",alt:"Serper",width:16,height:16}),"tavily"===d.webSearchProvider&&(0,l.jsx)(dS(),{src:"/icons/tavily.png",alt:"Tavily",width:16,height:16}),"brave"===d.webSearchProvider&&(0,l.jsx)(dS(),{src:"/icons/brave.png",alt:"Brave",width:16,height:16}),"bing"===d.webSearchProvider&&(0,l.jsx)(dS(),{src:"/icons/serpapi.svg",alt:"SerpApi",width:16,height:16}),"exa"===d.webSearchProvider&&(0,l.jsx)(dS(),{src:"/icons/exa.png",alt:"Exa",width:16,height:16}),"local"===d.webSearchProvider&&(0,l.jsx)(ge,{className:"size-4","aria-hidden":"true"}),(0,l.jsx)(R.yv,{placeholder:"Select provider"})]})}),(0,l.jsxs)(R.gC,{children:[(0,l.jsx)(R.eb,{value:"serper",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(dS(),{src:"/icons/serper.png",alt:"Serper",width:16,height:16}),(0,l.jsx)("span",{children:"Serper"})]})}),(0,l.jsx)(R.eb,{value:"tavily",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(dS(),{src:"/icons/tavily.png",alt:"Tavily",width:16,height:16}),(0,l.jsx)("span",{children:"Tavily"})]})}),(0,l.jsx)(R.eb,{value:"brave",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(dS(),{src:"/icons/brave.png",alt:"Brave",width:16,height:16}),(0,l.jsx)("span",{children:"Brave"})]})}),(0,l.jsx)(R.eb,{value:"bing",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(dS(),{src:"/icons/serpapi.svg",alt:"SerpApi",width:16,height:16}),(0,l.jsx)("span",{children:"Bing (via SerpApi)"})]})}),(0,l.jsx)(R.eb,{value:"exa",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(dS(),{src:"/icons/exa.png",alt:"Exa",width:16,height:16}),(0,l.jsx)("span",{children:"Exa"})]})}),(0,l.jsx)(R.eb,{value:"local",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(ge,{className:"size-4","aria-hidden":"true"}),(0,l.jsx)("span",{children:"Built-in web search"})]})})]})]})]}),"local"!==d.webSearchProvider&&(0,l.jsxs)("div",{className:"space-y-1.5 pt-2",children:[(0,l.jsx)("div",{className:"flex items-center justify-between",children:(0,l.jsx)(Q.J,{className:"text-xs",children:"serper"===d.webSearchProvider||"google"===d.webSearchProvider?"Serper API Key":"brave"===d.webSearchProvider?"Brave API Key":"bing"===d.webSearchProvider?"SerpApi API Key":"exa"===d.webSearchProvider?"Exa API Key":"Tavily API Key"})}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsxs)("div",{className:"relative flex-1",children:[(0,l.jsx)(P.p,{type:h?"text":"password",className:"text-sm pr-10",value:"serper"===d.webSearchProvider||"google"===d.webSearchProvider?d.serperApiKey||"":"brave"===d.webSearchProvider?d.braveApiKey||"":"bing"===d.webSearchProvider?d.bingApiKey||"":"exa"===d.webSearchProvider?d.exaApiKey||"":d.tavilyApiKey||"",onChange:a=>{q({status:null}),"serper"===d.webSearchProvider||"google"===d.webSearchProvider?e({...d,serperApiKey:a.target.value}):"brave"===d.webSearchProvider?e({...d,braveApiKey:a.target.value}):"bing"===d.webSearchProvider?e({...d,bingApiKey:a.target.value}):"exa"===d.webSearchProvider?e({...d,exaApiKey:a.target.value}):e({...d,tavilyApiKey:a.target.value})},placeholder:"serper"===d.webSearchProvider||"google"===d.webSearchProvider?"Your Serper API Key":"brave"===d.webSearchProvider?"Your Brave API Key":"bing"===d.webSearchProvider?"Your SerpApi API Key":"exa"===d.webSearchProvider?"Your Exa API Key":"Your Tavily API Key"}),(0,l.jsx)(O.$,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent text-muted-foreground",onClick:()=>i(!h),children:h?(0,l.jsx)(ai.A,{className:"size-4"}):(0,l.jsx)(aj.A,{className:"size-4"})})]}),(0,l.jsx)(O.$,{className:"rounded-lg px-5 h-10",variant:"outline",size:"default",onClick:A,disabled:j,children:j?(0,l.jsx)(M.A,{className:"size-4 animate-spin"}):"Verify"})]}),"success"===p.status&&(0,l.jsx)("p",{className:"text-[11px] text-green-500 font-medium mt-1",children:"✓ API Key Verified"}),"error"===p.status&&(0,l.jsx)("p",{className:"text-[11px] text-red-500 font-medium mt-1",children:p.message})]})]}),(0,l.jsx)(T.wL,{className:"flex justify-end pt-4 border-t",children:(0,l.jsxs)(O.$,{size:"lg",disabled:"webSearch"===f||!v,onClick:()=>y("webSearch"),className:"gap-1.5 px-4",children:["webSearch"===f?(0,l.jsx)(M.A,{className:"size-3.5 animate-spin"}):(0,l.jsx)(N.A,{className:"size-3.5"}),"Save"]})})]}),(0,l.jsxs)(T.Zp,{children:[(0,l.jsxs)(T.aR,{className:"pb-3",children:[(0,l.jsx)(T.ZB,{className:"text-sm",children:"Web Scraper"}),(0,l.jsx)(T.BT,{className:"text-xs",children:"The built-in crawler works through the Larkup API without Docker or local services."})]}),(0,l.jsxs)(T.Wu,{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Web Scraper Provider"}),(0,l.jsxs)(R.l6,{value:d.webCrawlerProvider||"local",onValueChange:a=>{e({...d,webCrawlerProvider:a}),u({status:null})},children:[(0,l.jsx)(R.bq,{className:"w-full",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:["cloud"===d.webCrawlerProvider?(0,l.jsx)(dS(),{src:"/icons/firecrawl.png",alt:"Cloud web crawler",width:16,height:16}):(0,l.jsx)(ge,{className:"size-4","aria-hidden":"true"}),(0,l.jsx)("span",{children:"cloud"===d.webCrawlerProvider?"Cloud web crawler":"Built-in crawler (no setup)"})]})}),(0,l.jsxs)(R.gC,{children:[(0,l.jsx)(R.eb,{value:"local",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(ge,{className:"size-4","aria-hidden":"true"}),(0,l.jsx)("span",{children:"Built-in crawler (no setup)"})]})}),(0,l.jsx)(R.eb,{value:"cloud",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(dS(),{src:"/icons/firecrawl.png",alt:"Cloud web crawler",width:16,height:16}),(0,l.jsx)("span",{children:"Cloud web crawler"})]})})]})]})]}),"cloud"===d.webCrawlerProvider&&(0,l.jsxs)("div",{className:"space-y-1.5 pt-2",children:[(0,l.jsx)("div",{className:"flex items-center justify-between",children:(0,l.jsx)(Q.J,{className:"text-xs",children:"Web crawler API key"})}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsxs)("div",{className:"relative flex-1",children:[(0,l.jsx)(P.p,{type:h?"text":"password",className:"text-sm pr-10",value:d.firecrawlApiKey||"",onChange:a=>{u({status:null}),e({...d,firecrawlApiKey:a.target.value})},placeholder:"fc-..."}),(0,l.jsx)(O.$,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent text-muted-foreground",onClick:()=>i(!h),children:h?(0,l.jsx)(ai.A,{className:"size-4"}):(0,l.jsx)(aj.A,{className:"size-4"})})]}),(0,l.jsx)(O.$,{className:"rounded-lg h-10 px-5",variant:"outline",size:"default",disabled:r,onClick:B,children:r?(0,l.jsx)(M.A,{className:"size-4 animate-spin"}):"Verify"})]}),"success"===t.status&&(0,l.jsx)("p",{className:"text-[11px] text-green-500 font-medium mt-1",children:"✓ Crawler API Key Verified"}),"error"===t.status&&(0,l.jsx)("p",{className:"text-[11px] text-red-500 font-medium mt-1",children:t.message})]})]}),(0,l.jsx)(T.wL,{className:"flex justify-end pt-4 border-t",children:(0,l.jsxs)(O.$,{size:"lg",disabled:"webCrawler"===f||!w,onClick:()=>y("webCrawler"),className:"gap-1.5 px-4",children:["webCrawler"===f?(0,l.jsx)(M.A,{className:"size-3.5 animate-spin"}):(0,l.jsx)(N.A,{className:"size-3.5"}),"Save"]})})]}),(0,l.jsxs)(T.Zp,{children:[(0,l.jsxs)(T.aR,{className:"pb-3 flex flex-row items-center justify-between space-y-0",children:[(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(T.ZB,{className:"text-sm",children:"Local Proxy Settings"}),(0,l.jsx)(T.BT,{className:"text-xs",children:"Configure proxy settings for the local scraper."})]}),(0,l.jsx)(fi.Bc,{children:(0,l.jsxs)(fi.m_,{children:[(0,l.jsx)(fi.k$,{render:(0,l.jsx)("div",{className:"flex items-center space-x-2",children:(0,l.jsx)(d8.d,{checked:d.useScraperProxy||!1,onCheckedChange:a=>e({...d,useScraperProxy:a})})})}),(0,l.jsx)(fi.ZI,{children:(0,l.jsx)("p",{children:"Enable proxy for web scraping"})})]})})]}),(0,l.jsx)(T.Wu,{className:"space-y-4",children:(0,l.jsxs)(eW,{defaultValue:"one-line",className:"w-full ",children:[(0,l.jsx)("div",{className:"flex mb-4",children:(0,l.jsxs)(eY,{className:"grid w-35 grid-cols-2 h-8! bg-muted/10",children:[(0,l.jsx)(eZ,{value:"one-line",className:"text-xs h-6",children:"One Line"}),(0,l.jsx)(eZ,{value:"form",className:"text-xs h-6",children:"Form"})]})}),(0,l.jsx)(e$,{value:"one-line",className:"mt-0 w-full",children:(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Proxy URL"}),(0,l.jsx)(P.p,{className:"text-sm",value:(()=>{if(!d.scraperProxyServer)return"";try{let a=new URL(d.scraperProxyServer);return d.scraperProxyUsername&&(a.username=encodeURIComponent(d.scraperProxyUsername)),d.scraperProxyPassword&&(a.password=encodeURIComponent(d.scraperProxyPassword)),a.toString().replace(/\/$/,"")}catch{return d.scraperProxyServer}})(),onChange:a=>{let b=a.target.value,c=b,f="",g="",h=b.trim();if(h)try{let a=new URL(h);(a.username||a.password)&&(f=decodeURIComponent(a.username),g=decodeURIComponent(a.password),a.username="",a.password="",c=a.toString().replace(/\/$/,""))}catch{let a=h.split(":");4!==a.length||h.startsWith("http")||(c=`http://${a[0]}:${a[1]}`,f=a[2],g=a[3])}e({...d,scraperProxyServer:c,scraperProxyUsername:f,scraperProxyPassword:g})},placeholder:"http://proxy.example.com:8080 (or paste one-liner)"})]})}),(0,l.jsxs)(e$,{value:"form",className:"mt-0 space-y-4",children:[(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Proxy Server"}),(0,l.jsx)(P.p,{className:"text-sm",value:d.scraperProxyServer||"",onChange:a=>e({...d,scraperProxyServer:a.target.value}),placeholder:"http://proxy.example.com:8080"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Proxy Username"}),(0,l.jsx)(P.p,{className:"text-sm",value:d.scraperProxyUsername||"",onChange:a=>e({...d,scraperProxyUsername:a.target.value})})]}),(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Proxy Password"}),(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)(P.p,{type:n?"text":"password",className:"text-sm pr-10",value:d.scraperProxyPassword||"",onChange:a=>e({...d,scraperProxyPassword:a.target.value})}),(0,l.jsx)(O.$,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent text-muted-foreground",onClick:()=>o(!n),children:n?(0,l.jsx)(ai.A,{className:"size-4"}):(0,l.jsx)(aj.A,{className:"size-4"})})]})]})]})]})]})}),(0,l.jsxs)(T.wL,{className:"flex justify-end gap-2 pt-4 border-t",children:[(0,l.jsx)(O.$,{className:"rounded-lg h-9 gap-2",variant:"outline",size:"sm",onClick:async()=>{let a=(async()=>{if(!d.scraperProxyServer)throw Error("Proxy server is required");let a=await fetch("/api/proxy/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({server:d.scraperProxyServer,username:d.scraperProxyUsername,password:d.scraperProxyPassword})}),b=await a.json();if(!a.ok)throw Error(b.error||"Proxy verification failed");return b})();S.oR.promise(a,{loading:"Verifying proxy...",success:"Proxy configuration is valid!",error:a=>a.message||"Proxy verification failed"})},children:"Verify Proxy"}),(0,l.jsxs)(O.$,{size:"lg",disabled:"proxy"===f||!x,onClick:()=>y("proxy"),className:"gap-1.5 px-4",children:["proxy"===f?(0,l.jsx)(M.A,{className:"size-3.5 animate-spin"}):(0,l.jsx)(N.A,{className:"size-3.5"}),"Save"]})]})]})]})}var gh=c(21419),gi=c(58869);let gj=[{value:"hybrid",label:"Hybrid",description:"Combines semantic understanding with keyword matching for best results."},{value:"semantic",label:"Semantic",description:"Uses embeddings to find conceptually similar content."},{value:"lexical",label:"Lexical",description:"Traditional keyword-based search using BM25 scoring."}],gk=a=>fetch(a).then(a=>a.json());function gl(){let{activeProject:a}=(0,an.B)(),b=a?.id,c=b?`/api/config?serverId=${encodeURIComponent(b)}`:"/api/config",{data:d,isLoading:e,mutate:f}=(0,H.u)(c,gk),[g,h]=(0,m.useState)({}),[i,j]=(0,m.useState)(!1),[k,n]=(0,m.useState)({}),[o,p]=(0,m.useState)(null),[q,r]=(0,m.useState)(!1),[s,u]=(0,m.useState)(!1),{data:v}=(0,H.u)("/api/index",a=>fetch(a).then(a=>a.json())),w=v?.run?.status==="completed"?v.run:null,x=JSON.stringify(g)!==JSON.stringify(d?.config??{});async function y(){if(o){if(s)try{if(!(await fetch("/api/documents",{method:"DELETE"})).ok)throw Error("Could not clear the knowledge base.");S.oR.success("Knowledge base cleared.")}catch(a){S.oR.error(a instanceof Error?a.message:"Could not clear the knowledge base.");return}h(a=>({...a,vectorStore:o,storeConfig:{}})),r(!1),p(null)}}async function z(){if(!d?.config)return;let a=!1,b={};if(g.vectorStore){let c=(0,fu.jX)(g.vectorStore);if(c){let d=(0,fu.KB)(c,g.storeConfig||{},g.indexType||"hybrid");Object.keys(d).length>0&&(Object.assign(b,d),a=!0)}}if(n(b),a)return void S.oR.error("Please fill in all required fields",{duration:1/0});j(!0);try{let a={...d.config,...g},b=await fetch(c,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),e=await b.json();if(!b.ok)throw Error(e.error??"Failed to save");await f(e,{revalidate:!1}),S.oR.success("Storage settings saved",{duration:1/0})}catch(a){S.oR.error(a instanceof Error?a.message:"Failed to save",{duration:1/0})}finally{j(!1)}}return e?(0,l.jsx)("div",{className:"flex h-40 items-center justify-center",children:(0,l.jsx)(M.A,{className:"size-5 animate-spin text-muted-foreground"})}):(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-lg font-semibold tracking-tight",children:"Storage"}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Where your processed data is stored and indexed."})]}),(0,l.jsxs)(T.Zp,{children:[(0,l.jsxs)(T.aR,{className:"pb-3",children:[(0,l.jsxs)(T.ZB,{className:"flex items-center gap-2 text-sm",children:[(0,l.jsx)(gh.A,{className:"size-3.5 text-primary"}),"Indexing Strategy"]}),(0,l.jsx)(T.BT,{className:"text-xs",children:"How your documents are indexed for retrieval."})]}),(0,l.jsx)(T.Wu,{className:"space-y-4",children:(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Strategy"}),(0,l.jsxs)(R.l6,{value:g.indexType||"hybrid",onValueChange:a=>{w&&d?.config&&a!==d.config.indexType?(0,S.oR)("Cannot modify configuration",{description:"This project already has indexed data. You must create a new project to change this setting.",duration:1/0}):h(b=>({...b,indexType:a}))},children:[(0,l.jsx)(R.bq,{className:"w-full",children:(0,l.jsx)("span",{className:"font-medium text-sm",children:gj.find(a=>a.value===(g.indexType||"hybrid"))?.label??"Select strategy…"})}),(0,l.jsx)(R.gC,{children:gj.map(a=>(0,l.jsx)(R.eb,{value:a.value,children:(0,l.jsxs)("span",{className:"flex flex-col gap-0.5",children:[(0,l.jsx)("span",{className:"font-medium text-sm",children:a.label}),(0,l.jsx)("span",{className:"text-xs text-muted-foreground",children:a.description})]})},a.value))})]})]})})]}),(0,l.jsxs)(T.Zp,{children:[(0,l.jsxs)(T.aR,{className:"pb-3",children:[(0,l.jsxs)(T.ZB,{className:"flex items-center gap-2 text-sm",children:[(0,l.jsx)(t.A,{className:"size-3.5 text-primary"}),"Storage Engine"]}),(0,l.jsx)(T.BT,{className:"text-xs",children:"Configure your vector database connection."})]}),(0,l.jsxs)(T.Wu,{className:"space-y-5",children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(Q.J,{className:"text-xs",children:"Storage Engine"}),(0,l.jsxs)(R.l6,{value:g.vectorStore||"",onValueChange:a=>{d?.config&&a!==g.vectorStore&&(p(a),u(!1),r(!0))},children:[(0,l.jsx)(R.bq,{className:"w-full",children:g.vectorStore?(0,l.jsxs)("span",{className:"flex items-center gap-2.5",children:[(0,l.jsx)(ao.rb,{src:fE[g.vectorStore]?.iconSrc??"",alt:(0,fu.jX)(g.vectorStore)?.label??g.vectorStore,pillBg:fE[g.vectorStore]?.pillBg??void 0,size:16}),(0,l.jsx)("span",{className:"font-medium text-sm",children:(0,fu.jX)(g.vectorStore)?.label??g.vectorStore})]}):(0,l.jsx)("span",{className:"text-muted-foreground",children:"Select storage engine…"})}),(0,l.jsx)(R.gC,{children:fu.VY.map(a=>{let b=fE[a.id],c="coming-soon"===a.installStatus;return(0,l.jsx)(R.eb,{value:a.id,disabled:c,className:c?"opacity-50":"",children:(0,l.jsxs)("span",{className:"flex items-center gap-2.5 w-full",children:[b&&(0,l.jsx)(ao.rb,{src:b.iconSrc,alt:a.label,pillBg:b.pillBg??void 0,size:16}),(0,l.jsxs)("span",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"font-medium text-sm",children:a.label}),c&&(0,l.jsxs)("span",{className:"h-3.5 px-1 text-[9px] font-medium shrink-0 text-muted-foreground border rounded-full flex items-center bg-transparent",children:[(0,l.jsx)(gi.A,{className:"size-2.5 mr-0.5"}),"Coming Soon"]})]})]})},a.id)})})]})]}),g.vectorStore&&(0,l.jsx)("div",{className:"border-t pt-4",children:(0,l.jsx)(fv,{store:(0,fu.jX)(g.vectorStore),values:g.storeConfig||{},errors:k,onChange:(a,b)=>{h(c=>({...c,storeConfig:{...c.storeConfig,[a]:b}})),k[a]&&n(b=>{let c={...b};return delete c[a],c})},indexType:g.indexType||"hybrid"})})]}),(0,l.jsx)(T.wL,{className:"flex justify-end pt-4 border-t",children:(0,l.jsxs)(O.$,{size:"lg",disabled:i||!x,onClick:z,className:"gap-1.5 px-4",children:[i?(0,l.jsx)(M.A,{className:"size-3.5 animate-spin"}):(0,l.jsx)(N.A,{className:"size-3.5"}),"Save"]})})]}),(0,l.jsx)(_.Lt,{open:q,onOpenChange:r,children:(0,l.jsxs)(_.EO,{children:[(0,l.jsxs)(_.wd,{children:[(0,l.jsx)(_.r7,{children:"Change vector storage?"}),(0,l.jsx)(_.$v,{children:"Your existing indexed vectors stay in the current storage engine and will not be available after this change. Keep the knowledge base to re-index it in the new store, or clear it intentionally below."})]}),(0,l.jsxs)("label",{className:"flex cursor-pointer items-start gap-3 rounded-md border p-3 text-sm",children:[(0,l.jsx)("input",{type:"checkbox",className:"mt-0.5",checked:s,onChange:a=>u(a.target.checked)}),(0,l.jsxs)("span",{children:[(0,l.jsx)("span",{className:"font-medium",children:"Clear knowledge base"}),(0,l.jsx)("span",{className:"block text-xs text-muted-foreground",children:"Permanently remove documents and the current vector index before changing storage."})]})]}),(0,l.jsxs)(_.ck,{children:[(0,l.jsx)(_.Zr,{onClick:()=>p(null),children:"Cancel"}),(0,l.jsx)(_.Rx,{onClick:y,children:s?"Clear and change storage":"Keep documents and continue"})]})]})})]})}var gm=c(47535);let gn={name:"megaphone",size:24,node:[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]]};gn.node;let go=(0,q.A)(gn);var gp=c(12369);let gq={Film:gm.A,ScanEye:al},gr={all:"All",media:"Media",search:"Search",analytics:"Analytics",integration:"Integration",embedding:"Embedding",ai:"AI",automation:"Automation",utility:"Utility"},gs=a=>fetch(a).then(a=>a.json());function gt({embedded:a=!1}){let b=(0,o.useRouter)(),{data:c,isLoading:d,mutate:e}=(0,H.u)("/api/marketplace",gs,{refreshInterval:a=>2e3*!!a?.tools.some(a=>"installing"===a.status||"uninstalling"===a.status)}),[f,g]=(0,m.useState)(new Set),[h,i]=(0,m.useState)(new Set),[j,k]=(0,m.useState)(""),[n,p]=(0,m.useState)("all"),[q,r]=(0,m.useState)(null),[s,t]=(0,m.useState)(null),[u,v]=(0,m.useState)(null),w=(0,m.useCallback)(async(a,c,d=!1)=>{let f=a.id;g(a=>new Set(a).add(f));let h=S.oR.loading(d?"Updating tool…":"Downloading and installing tool…",{description:d?"Your existing configuration will be kept.":"This may take a minute on first install."});try{let g=await fetch(`/api/marketplace/${f}${d?"?force=true":""}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c?{runtimeMode:c}:{})});if(!g.ok){let a=await g.json();throw Error(a.error||"Install failed")}if(S.oR.dismiss(h),"managed-cloud"===c){let a=await fetch(`/api/tools/${encodeURIComponent(f)}/runtime`,{method:"POST"});if(a.ok)S.oR.success("Tool installed and cloud access is ready.",{action:{label:"Open settings",onClick:()=>b.push("/settings?section=tool-settings")}});else{let c=await a.json().catch(()=>({}));S.oR.warning("Tool installed, but cloud setup needs attention.",{description:c.error||"Open Installed Tools to reconnect your cloud runtime.",action:{label:"Open settings",onClick:()=>b.push("/settings?section=tool-settings")}})}}else S.oR.success(d?"Tool updated successfully":"Tool installed successfully",{action:a.runtime?{label:"Open settings",onClick:()=>b.push("/settings?section=tool-settings")}:void 0});await e()}catch(a){S.oR.dismiss(h),S.oR.error(a instanceof Error?a.message:"Failed to install tool")}finally{g(a=>{let b=new Set(a);return b.delete(f),b})}},[e,b]),x=(0,m.useCallback)(async a=>{await w(a,void 0,!0)},[w]),y=(0,m.useCallback)(async a=>{i(b=>new Set(b).add(a));let b=S.oR.loading("Removing tool…",{description:"This may take a moment."});try{if(!(await fetch(`/api/marketplace/${a}?purgeConfig=true`,{method:"DELETE"})).ok)throw Error("Uninstall failed");S.oR.dismiss(b),S.oR.success("Tool removed"),await e()}catch{S.oR.dismiss(b),S.oR.error("Failed to remove tool")}finally{i(b=>{let c=new Set(b);return c.delete(a),c})}},[e]),z=c?.tools??[],A=(0,m.useMemo)(()=>["all",...Array.from(new Set(z.map(a=>a.category))).sort()],[z]),B=(0,m.useMemo)(()=>{let a=z;if("all"!==n&&(a=a.filter(a=>a.category===n)),j.trim()){let b=j.toLowerCase();a=a.filter(a=>a.name.toLowerCase().includes(b)||a.description.toLowerCase().includes(b)||a.tags?.some(a=>a.toLowerCase().includes(b))||a.author.toLowerCase().includes(b))}return a},[z,n,j]),C=(0,m.useMemo)(()=>z.find(a=>a.id===q),[z,q]);return(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[!a&&(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:"Marketplace"}),(0,l.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Extend Larkup with optional tools and capabilities."})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)(dD.A,{className:"absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),(0,l.jsx)(P.p,{type:"text",placeholder:"Search tools…",value:j,onChange:a=>k(a.target.value),className:(0,E.cn)("w-full rounded-lg border border-border bg-background pl-9 pr-3 py-2","text-[13px] text-foreground placeholder:text-muted-foreground/50","outline-none transition-colors","focus:border-foreground/20 bg-white/70")})]}),A.length>2&&(0,l.jsx)("div",{className:"flex items-center gap-1.5 overflow-x-auto",children:A.map(a=>(0,l.jsx)("button",{type:"button",onClick:()=>p(a),className:(0,E.cn)("shrink-0 rounded-md px-2.5 py-1 text-[12px] font-medium transition-colors",n===a?"bg-foreground text-background":"text-muted-foreground hover:bg-secondary hover:text-foreground"),children:gr[a]??a},a))})]}),d?(0,l.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,l.jsx)(M.A,{className:"size-5 animate-spin text-muted-foreground"})}):0===B.length?(0,l.jsx)("div",{className:"py-16 text-center text-sm text-muted-foreground",children:j||"all"!==n?"No tools match your search.":"No tools available yet."}):(0,l.jsx)("div",{className:"flex flex-col gap-2",children:B.map(a=>(0,l.jsx)(gu,{tool:a,installing:f.has(a.id)||"installing"===a.status,uninstalling:h.has(a.id)||"uninstalling"===a.status,onInstall:()=>{let b;(b=a.runtime?.modes??[]).length<2?w(a,b[0]?.id):(v(a.runtime?.defaultMode??b[0]?.id??null),t(a))},onUpdate:()=>void x(a),onUninstall:a=>r(a)},a.id))}),(0,l.jsx)(f3.K,{open:!!q,onOpenChange:a=>!a&&r(null),title:"Remove Tool?",description:(0,l.jsxs)(l.Fragment,{children:["Are you sure you want to remove ",(0,l.jsx)("strong",{children:C?.name}),"?",(0,l.jsx)("br",{}),(0,l.jsx)("br",{}),"Any related installed tools credentials and configurations will be removed too."]}),cancelText:"Cancel",actionText:"Remove",variant:"destructive",icon:(0,l.jsx)(fw.A,{className:"size-5 text-destructive"}),onAction:()=>{q&&y(q)}}),(0,l.jsx)(dx.lG,{open:!!s,onOpenChange:a=>{a||t(null)},children:(0,l.jsxs)(dx.Cf,{children:[(0,l.jsxs)(dx.c7,{children:[(0,l.jsxs)(dx.L3,{children:["Choose how to run ",s?.name]}),(0,l.jsx)(dx.rr,{children:"This choice is saved with the installed tool and can be changed later in Installed Tools."})]}),(0,l.jsx)("div",{className:"grid gap-2",children:s?.runtime?.modes.map(a=>(0,l.jsxs)("button",{type:"button",onClick:()=>v(a.id),className:(0,E.cn)("rounded-lg border px-3 py-3 text-left transition-colors",u===a.id?"border-primary bg-primary/5":"border-border hover:bg-muted/50"),children:[(0,l.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium",children:[a.icon&&(0,l.jsx)("img",{src:a.icon,alt:"",className:"size-4 object-contain"}),a.label]}),(0,l.jsx)("span",{className:"mt-1 block text-xs leading-relaxed text-muted-foreground",children:a.description})]},a.id))}),(0,l.jsx)(O.$,{disabled:!s||!u,onClick:()=>{s&&u&&(t(null),w(s,u))},children:"Install with this runtime"})]})})]})}function gu({tool:a,installing:b,uninstalling:c,onInstall:d,onUpdate:e,onUninstall:f}){var g;let h=gq[a.icon]??gm.A,i="installed"===a.status,j=a.comingSoon;return(0,l.jsxs)("div",{className:(0,E.cn)("group flex min-h-24 items-center gap-4 rounded-xl border border-border bg-white/70 px-4 py-4 dark:bg-card/70","transition-colors hover:border-border/80"),children:[(0,l.jsx)("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted/50 border",children:a.iconUrl?(0,l.jsx)("img",{src:a.iconUrl,alt:"",className:"size-5 object-contain",onError:a=>{a.currentTarget.style.display="none"}}):a.emoji?(0,l.jsx)("span",{className:"text-xl leading-none",children:a.emoji}):(0,l.jsx)(h,{className:"size-5 text-foreground",strokeWidth:1.75})}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"text-[13px] font-medium text-foreground truncate",children:a.name}),(0,l.jsxs)("span",{className:"shrink-0 text-[11px] text-muted-foreground/60",children:["v",a.availableVersion??a.version]}),(0,l.jsx)("span",{className:"shrink-0 text-[11px] text-muted-foreground/40",children:"\xb7"}),(0,l.jsx)("span",{className:"shrink-0 text-[11px] text-muted-foreground/60",children:a.author})]}),(0,l.jsx)("p",{className:"mt-0.5 text-[12px] text-muted-foreground leading-relaxed line-clamp-1",children:a.description}),a.tags&&a.tags.length>0&&(0,l.jsxs)("div",{className:"mt-1.5 flex items-center gap-1 overflow-hidden",children:[a.requiresSandbox&&(0,l.jsx)("span",{className:"rounded-md bg-amber-500/10 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:text-amber-400",children:"Sandbox required"}),a.tags.slice(0,4).map(a=>(0,l.jsx)("span",{className:"rounded-md bg-secondary px-1.5 py-0.5 text-[10px] text-muted-foreground",children:a},a)),a.tags.length>4&&(0,l.jsxs)("span",{className:"text-[10px] text-muted-foreground/50",children:["+",a.tags.length-4]})]})]}),(0,l.jsxs)("div",{className:"hidden sm:flex shrink-0 items-center gap-2 text-[11px] text-muted-foreground/60",children:[(0,l.jsx)("span",{className:"tabular-nums",children:a.installSize}),a.downloads>0&&(0,l.jsxs)("span",{className:"tabular-nums",children:["↓ ",(g=a.downloads)>=1e6?`${(g/1e6).toFixed(1)}M`:g>=1e3?`${(g/1e3).toFixed(1)}K`:String(g)]})]}),(0,l.jsxs)("div",{className:"shrink-0 flex items-center gap-1.5",children:[a.repositoryUrl&&(0,l.jsx)("a",{href:a.repositoryUrl,target:"_blank",rel:"noopener noreferrer",className:"p-1.5 rounded-md text-muted-foreground/40 hover:text-muted-foreground transition-colors",children:(0,l.jsx)(d0.A,{className:"size-3.5"})}),j?(0,l.jsxs)(O.$,{size:"sm",className:"h-7 text-[11px]",variant:"default",disabled:!0,children:[(0,l.jsx)(go,{className:"size-3"}),"Soon"]}):i?(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[a.updateAvailable?(0,l.jsxs)(O.$,{variant:"default",size:"sm",disabled:b,className:"h-7 gap-1.5 px-3 text-[11px]",onClick:e,children:[b?(0,l.jsx)(M.A,{className:"size-3 animate-spin"}):(0,l.jsx)(gp.A,{className:"size-3"}),b?"Updating…":"Update"]}):(0,l.jsxs)("span",{className:"flex items-center gap-1 text-[11px] font-medium text-emerald-600",children:[(0,l.jsx)(as.A,{className:"size-3"}),"Installed"]}),(0,l.jsx)(O.$,{variant:"ghost",size:"sm",disabled:c,className:"size-7 p-0 text-muted-foreground/40 hover:text-destructive",onClick:()=>f(a.id),children:c?(0,l.jsx)(M.A,{className:"size-3 animate-spin"}):(0,l.jsx)(Y.A,{className:"size-3"})})]}):(0,l.jsxs)(O.$,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-[11px] px-3",disabled:b,onClick:d,children:[b?(0,l.jsx)(M.A,{className:"size-3 animate-spin"}):(0,l.jsx)(gp.A,{className:"size-3"}),b?"Installing…":"Install"]})]})]})}let gv={name:"circle-question-mark",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["help-circle","circle-help"]};gv.node;let gw=(0,q.A)(gv),gx=a=>fetch(a).then(a=>a.json()),gy=async a=>{let b=await fetch(a);if(!b.ok)throw Error("Usage is unavailable.");return await b.json()};function gz({description:a}){return a?a.length<=56?(0,l.jsx)("span",{className:"text-xs text-muted-foreground",children:a}):(0,l.jsxs)(fi.m_,{children:[(0,l.jsx)(fi.k$,{className:"text-muted-foreground hover:text-foreground","aria-label":"Show option description",children:(0,l.jsx)(gw,{className:"size-3.5"})}),(0,l.jsx)(fi.ZI,{children:a})]}):null}function gA(a,b){return a&&"auto"!==b&&"vercel_ai_gateway"!==b?a.filter(a=>"auto"===a.value||a.value.startsWith(`${b}/`)):a}function gB({tool:a,runtimeMode:b,toolConfig:c,serverId:d}){let e=!!a.usage&&(!a.usage?.visibleWhenRuntimeMode||a.usage.visibleWhenRuntimeMode.includes(b)),f=new URLSearchParams({runtimeMode:b});d&&f.set("serverId",d);let{data:g,error:h}=(0,H.u)(e?`/api/tools/${encodeURIComponent(a.id)}/usage?${f}`:null,gy,{revalidateOnFocus:!1}),[i,j]=(0,m.useState)(!1),[k,n]=(0,m.useState)(""),[o,p]=(0,m.useState)(""),[q,r]=(0,m.useState)(!1);if(!e||!a.usage)return null;let s=g??{},t=a.usage.visualization,u=t?s[t.usedKey]:void 0,v=t?s[t.limitKey]:void 0,w="number"==typeof u&&"number"==typeof v&&v>0?Math.min(1,Math.max(0,u/v)):null,x=a.usage.support?.userIdConfigKey?c[a.usage.support.userIdConfigKey]:void 0;async function y(){r(!0);try{let b=await fetch(`/api/tools/${encodeURIComponent(a.id)}/usage-request${d?`?serverId=${encodeURIComponent(d)}`:""}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:k,note:o,usage:s})}),c=await b.json().catch(()=>({}));if(!b.ok)throw Error(c.error||"Could not send the request.");S.oR.success("Your access request was sent."),j(!1),p("")}catch(a){S.oR.error(a instanceof Error?a.message:"Could not send the request.")}finally{r(!1)}}return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"rounded-lg border bg-muted/20 px-3 py-3",children:(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[null!==w&&"number"==typeof u&&"number"==typeof v&&(0,l.jsxs)("div",{className:"relative grid size-14 shrink-0 place-items-center rounded-full","aria-label":`${Math.round(100*w)} percent of monthly allowance used`,children:[(0,l.jsxs)("svg",{className:"size-14 -rotate-90",viewBox:"0 0 56 56","aria-hidden":"true",children:[(0,l.jsx)("circle",{cx:"28",cy:"28",r:"23",fill:"none",stroke:"var(--muted)",strokeWidth:"5"}),(0,l.jsx)("circle",{cx:"28",cy:"28",r:"23",fill:"none",stroke:"var(--foreground)",strokeLinecap:"round",strokeWidth:"5",style:{strokeDasharray:`${2*Math.PI*23}`,strokeDashoffset:`${2*Math.PI*23*(1-w)}`,transition:"stroke-dashoffset 500ms ease-out"}})]}),(0,l.jsxs)("span",{className:"pointer-events-none absolute text-[11px] font-semibold tabular-nums",children:[Math.round(100*w),"%"]})]}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:a.usage.label??"Usage"}),(0,l.jsx)("div",{className:"mt-1 flex flex-wrap gap-x-4 gap-y-1 text-xs tabular-nums",children:a.usage.fields.map(a=>{let b=s[a.key];if("number"!=typeof b)return null;let c="minutes"===a.format?`${b.toFixed(2)} min`:String(b);return(0,l.jsxs)("span",{className:"text-muted-foreground",children:[a.label," ",(0,l.jsx)("span",{className:"font-medium text-foreground",children:c})]},a.key)})}),h?(0,l.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Usage is temporarily unavailable. Your cloud allowance has not changed."}):g?null:(0,l.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Usage appears once Cloud access is automatically provisioned. You can request more capacity below when needed."})]}),a.usage.support&&(0,l.jsx)(O.$,{variant:"outline",size:"sm",className:"shrink-0 text-xs",onClick:()=>j(!0),children:a.usage.support.contactLabel??"Request access"})]})}),(0,l.jsx)(dx.lG,{open:i,onOpenChange:j,children:(0,l.jsxs)(dx.Cf,{children:[(0,l.jsxs)(dx.c7,{children:[(0,l.jsx)(dx.L3,{children:a.usage.support?.contactLabel??"Request cloud access"}),(0,l.jsx)(dx.rr,{children:a.usage.support?.description??"Send the Larkup team your usage details."})]}),(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(Q.J,{htmlFor:`${a.id}-usage-email`,children:"Email"}),(0,l.jsx)(P.p,{id:`${a.id}-usage-email`,type:"email",value:k,onChange:a=>n(a.target.value),placeholder:"you@company.com"})]}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(Q.J,{htmlFor:`${a.id}-usage-note`,children:"Note (optional)"}),(0,l.jsx)(dz.T,{id:`${a.id}-usage-note`,value:o,onChange:a=>p(a.target.value),placeholder:"Tell us how you plan to use the tool",className:"min-h-[80px]"})]}),"string"==typeof x&&(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"Your cloud user ID will be included."}),(0,l.jsx)(O.$,{className:"w-full",disabled:!k||q,onClick:()=>void y(),children:q?"Sending…":"Send request"})]})]})})]})}function gC({tool:a,mode:b,hasUnsavedChanges:c,runtimeConfig:d,serverId:e}){let[f,g]=(0,m.useState)({loading:"managed-cloud"===b.id}),[h,i]=(0,m.useState)(!1);if("managed-cloud"===b.id){if(f.loading)return(0,l.jsxs)("div",{className:"flex items-center gap-2 rounded-lg border bg-muted/20 px-3 py-2.5 text-sm text-muted-foreground",children:[(0,l.jsx)(M.A,{className:"size-4 animate-spin"}),"Connecting your private Larkup Cloud runtime…"]});let a=!f.error;return(0,l.jsxs)("div",{className:"rounded-lg border bg-muted/20 px-3 py-2.5",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,l.jsx)("span",{className:`size-2 shrink-0 rounded-full ${a?"bg-emerald-500":"bg-destructive"}`,"aria-label":a?`${b.label} connected`:`${b.label} unavailable`}),(0,l.jsx)("span",{className:"font-medium",children:b.label}),(0,l.jsx)("span",{className:"text-muted-foreground",children:a?"Connected":"Unavailable"})]}),f.error&&(0,l.jsx)("p",{className:"mt-2 text-xs text-destructive",children:f.error}),f.display?.userId&&(0,l.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,l.jsx)(P.p,{"aria-label":"Larkup Cloud user ID",className:"h-8 min-w-0 flex-1 font-mono text-xs border-border/50",readOnly:!0,value:f.display.userId}),(0,l.jsx)(O.$,{"aria-label":"Copy user ID",className:h?"text-black":"",onClick:()=>{navigator.clipboard.writeText(f.display.userId).then(()=>{i(!0),S.oR.success("User ID copied."),window.setTimeout(()=>i(!1),1500)}).catch(()=>S.oR.error("Could not copy the User ID."))},size:"icon-sm",title:"Copy user ID",variant:"outline",children:h?(0,l.jsx)(as.A,{className:"size-3.5 text-green-600"}):(0,l.jsx)(d5.A,{className:"size-3.5"})})]})]})}return"local"===b.id||"local-docker"===b.id||"local-process"===b.id?(0,l.jsx)(gD,{tool:a,hasUnsavedChanges:c,runtimeConfig:d,serverId:e}):(0,l.jsx)("div",{className:"rounded-lg border bg-muted/20 px-3 py-2.5 text-xs text-muted-foreground",children:b.description})}function gD({tool:a,hasUnsavedChanges:b,runtimeConfig:c,serverId:d}){let e=d?`?serverId=${encodeURIComponent(d)}`:"",f=`/api/tools/${encodeURIComponent(a.id)}/host${e}`,{data:g,mutate:h}=(0,H.u)(f,gy,{revalidateOnFocus:!1}),[i,j]=(0,m.useState)(null),[k,n]=(0,m.useState)(!1);async function o(b){j(b);try{let d=await fetch(`/api/tools/${encodeURIComponent(a.id)}/runtime${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:b,config:c})}),f=await d.json().catch(()=>({}));if(!d.ok)throw Error(f.error||`Could not ${b} the local runtime.`);S.oR.success("install"===b?"Local runtime installed.":"start"===b?"Local runtime is running.":"Local runtime stopped."),await h(a=>a?{...a,installed:"install"===b||a.installed,running:"start"===b||"stop"!==b&&a.running}:a,{revalidate:!1}),("stop"===b||"start"===b)&&window.setTimeout(()=>void h(),1500)}catch(a){S.oR.error(a instanceof Error?a.message:`Could not ${b} the local runtime.`)}finally{j(null)}}return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"rounded-lg border bg-muted/20 px-3 py-3",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("div",{className:"mt-0.5 grid size-8 shrink-0 place-items-center rounded-md border bg-background",children:(0,l.jsx)("img",{src:"/docker.png",alt:"Local runtime",className:"size-5 object-contain"})}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("p",{className:"text-sm font-medium",children:"Local runtime"}),(0,l.jsx)("p",{className:"mt-0.5 text-xs leading-relaxed text-muted-foreground",children:"Run the application locally on your computer."}),g?.modelRequirement&&(0,l.jsx)("p",{className:`mt-2 text-xs ${g.modelRequirement.configured?"text-muted-foreground":"text-amber-700 dark:text-amber-300"}`,children:g.modelRequirement.message})]}),(0,l.jsx)("span",{className:`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${g?.running?"bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"bg-muted text-muted-foreground"}`,children:g?.running?"Running":"Stopped"})]}),(0,l.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[g?.installed?g.running?(0,l.jsxs)(O.$,{size:"sm",variant:"destructive",disabled:null!==i,onClick:()=>void o("stop"),children:["stop"===i?(0,l.jsx)(M.A,{className:"size-3.5 animate-spin"}):(0,l.jsx)(d1.A,{className:"size-3.5"}),"Stop"]}):(0,l.jsxs)(O.$,{size:"sm",disabled:null!==i,onClick:()=>void o("start"),children:["start"===i?(0,l.jsx)(M.A,{className:"size-3.5 animate-spin"}):(0,l.jsx)(d2.A,{className:"size-3.5"}),"Start"]}):(0,l.jsxs)(O.$,{size:"sm",disabled:null!==i,onClick:()=>n(!0),children:["install"===i?(0,l.jsx)(M.A,{className:"size-3.5 animate-spin"}):(0,l.jsx)(gp.A,{className:"size-3.5"}),"Install local runtime"]}),g?.installed&&!g.running&&(0,l.jsx)(O.$,{size:"sm",variant:"outline",disabled:null!==i,onClick:()=>n(!0),children:"Reinstall"}),b&&(0,l.jsx)("span",{className:"self-center text-xs text-muted-foreground",children:"Local changes will be applied for this action."})]})]}),(0,l.jsx)(f3.K,{open:k,onOpenChange:n,title:"Install local GPU runtime?",description:(0,l.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,l.jsx)("p",{children:"Video Intelligence runs analysis on this computer. For fast, accurate video understanding, use a powerful CUDA-capable NVIDIA GPU (12 GB+ VRAM recommended); CPU fallback is supported but can be much slower on long videos."}),g?.system&&(0,l.jsxs)("p",{children:[g.system.cpus," CPU cores \xb7 ",g.system.freeMemGB.toFixed(1)," GB RAM currently free."]}),g?.acceleration&&(0,l.jsx)("p",{children:g.acceleration.message}),(0,l.jsx)("p",{children:g?.suitability?.message??"Larkup will check the computer again before it starts."}),(0,l.jsx)("p",{className:"text-amber-700 dark:text-amber-300",children:"Continue only if you are comfortable downloading local models and using this machine's GPU/CPU while indexing runs."}),(0,l.jsx)("p",{children:g?.modelRequirement?.message??"Configure a vision-capable model before indexing video."})]}),actionText:"Install runtime",onAction:()=>void o("install")})]})}function gE({embedded:a=!1}){let{activeProject:b}=(0,an.B)(),c=b?.id,d=c?`/api/config?serverId=${encodeURIComponent(c)}`:"/api/config",{data:e,isLoading:f,error:g}=(0,H.u)("/api/marketplace",gx),{data:h,mutate:i,isLoading:j,error:k}=(0,H.u)(d,gx),[n,o]=(0,m.useState)({}),[p,q]=(0,m.useState)(null),[r,s]=(0,m.useState)(null),[t,u]=(0,m.useState)({}),[w,x]=(0,m.useState)({}),y=(e?.tools??[]).filter(a=>"installed"===a.status&&a.configSchema?.length),z=(a,b)=>{let c=n[a.id]?.[b.key];if("visionProvider"===b.defaultFromGlobalConfigKey||"chatProvider"===b.defaultFromGlobalConfigKey){let c=n[a.id]?.[b.key];if("string"==typeof c&&c)return c;let d=b.defaultFromGlobalConfigKey?h?.config[b.defaultFromGlobalConfigKey]:void 0;return"string"==typeof d&&b.options?.some(a=>a.value===d)?d:b.defaultValue??"vercel_ai_gateway"}if(b.providerField){let d=a.configSchema?.find(a=>a.key===b.providerField),e=d?String(z(a,d)):"vercel_ai_gateway",f=gA(b.options,e)??[];if("string"==typeof c&&"auto"!==c&&f.some(a=>a.value===c))return c;let g=b.defaultFromGlobalConfigKey?h?.config[b.defaultFromGlobalConfigKey]:void 0;return"string"==typeof g&&g&&("auto"===e||"vercel_ai_gateway"===e||g.startsWith(`${e}/`))?g:b.defaultValueByProvider?.[e]??b.defaultValue??f[0]?.value??""}return void 0!==c?c:"toggle"===b.type?"true"===b.defaultValue:b.defaultValue??""};function A(a,b,c){o(d=>({...d,[a]:{...d[a],[b]:c}})),u(b=>({...b,[a]:void 0}))}async function B(a){if(h?.config){q(a);try{let b=await fetch(d,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...h.config,toolConfigs:n})}),e=await b.json();if(!b.ok)throw Error(e.error??"Could not save tool settings.");await i(e,{revalidate:!1});let f=h.config.toolConfigs?.[a]??{},g=n[a]??{};("local"===g.runtimeMode||"local-docker"===g.runtimeMode||"local-process"===g.runtimeMode)&&g.localRuntimeApiKey!==f.localRuntimeApiKey?S.oR.success("Local runtime settings saved.",{description:"Restart the local runtime to apply the shared API key.",action:{label:"Restart runtime",onClick:()=>void fetch(`/api/tools/${encodeURIComponent(a)}/runtime${c?`?serverId=${encodeURIComponent(c)}`:""}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restart"})}).then(async a=>{let b=await a.json().catch(()=>({}));if(!a.ok)throw Error(b.error||"Could not restart local runtime.");S.oR.success("Local runtime restarted.")}).catch(a=>S.oR.error(a instanceof Error?a.message:"Could not restart local runtime."))}}):S.oR.success("Tool configuration saved successfully.")}catch(a){S.oR.error(a instanceof Error?a.message:"Could not save tool settings.")}finally{q(null)}}}async function C(a,b){s(a.id),u(b=>({...b,[a.id]:void 0}));try{let c=b.verification;if(!c)return;let d=Object.fromEntries(Object.entries(c.fields??{[b.key]:"$value"}).map(([c,d])=>[c,String(z(a,"$value"===d?b:a.configSchema?.find(a=>a.key===d)??b))])),e=await fetch(c.endpoint,{method:c.method??"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...d,config:Object.fromEntries((a.configSchema??[]).map(b=>[b.key,z(a,b)])),verifyKey:b.key})}),f=await e.json();if(!e.ok)throw Error(f.error??"Verification failed.");u(b=>({...b,[a.id]:{status:"success"}})),S.oR.success("Connection verified successfully.")}catch(c){let b=c instanceof Error?c.message:"Verification failed.";u(c=>({...c,[a.id]:{status:"error",message:b}})),S.oR.error(b)}finally{s(null)}}return g||k?(0,l.jsxs)("div",{className:"flex flex-col items-center justify-center py-24 text-center",children:[(0,l.jsx)(dX.A,{className:"mb-4 size-6 text-destructive"}),(0,l.jsx)("h3",{className:"text-lg font-medium text-destructive",children:"Failed to load configuration"}),(0,l.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Please try refreshing the page."})]}):f||j||!e||!h?(0,l.jsx)("div",{className:"flex h-40 items-center justify-center",children:(0,l.jsx)(M.A,{className:"size-5 animate-spin text-muted-foreground"})}):y.length?(0,l.jsxs)("div",{className:"space-y-6",children:[!a&&(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"text-xl font-semibold tracking-tight",children:"Installed Tools"}),(0,l.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Configure the options declared by each installed tool."})]}),(0,l.jsx)("div",{className:"grid gap-6",children:y.map(a=>{let b=(a.configSchema??[]).filter(a=>!a.serverManaged),d=JSON.stringify(n[a.id]??{})!==JSON.stringify(h.config.toolConfigs?.[a.id]??{}),e=t[a.id],f=function(a){let b=new Map;for(let c of a){let a=c.group??"";b.set(a,[...b.get(a)??[],c])}return[...b.entries()]}(b.filter(b=>(function a(b,c,d){if(!c.visibleWhen)return!0;let e=b.configSchema?.find(a=>a.key===c.visibleWhen?.field);if(e&&!a(b,e,d))return!1;let f=d[b.id]?.[c.visibleWhen.field]??e?.defaultValue;return(Array.isArray(c.visibleWhen.equals)?c.visibleWhen.equals:[c.visibleWhen.equals]).some(a=>a===f)})(a,b,n))),g=String(z(a,a.configSchema?.find(a=>"runtimeMode"===a.key)??{key:"runtimeMode",label:"Runtime",type:"select",defaultValue:a.runtime?.defaultMode??"managed-cloud"})),i=a.runtime?.modes.find(a=>a.id===g);return(0,l.jsxs)(T.Zp,{className:"overflow-hidden border bg-white shadow-none dark:bg-card",children:[(0,l.jsxs)(T.aR,{className:"pb-4",children:[(0,l.jsxs)(T.ZB,{className:"flex items-center gap-3 text-base",children:[(0,l.jsx)("span",{className:"flex size-9 items-center justify-center rounded-lg border bg-muted/40 text-lg",children:a.emoji??"\uD83D\uDD27"}),a.name]}),(0,l.jsx)(T.BT,{className:"ml-12 text-xs",children:a.description})]}),(0,l.jsxs)(T.Wu,{className:"space-y-5",children:[i&&(0,l.jsx)(gC,{tool:a,mode:i,hasUnsavedChanges:d,runtimeConfig:n[a.id]??{},serverId:c}),(0,l.jsx)(gB,{tool:a,runtimeMode:g,toolConfig:n[a.id]??{},serverId:c}),e&&(0,l.jsxs)("div",{className:"success"===e.status?"flex items-start gap-2 rounded-lg border border-emerald-500/20 bg-emerald-500/10 p-3 text-sm text-emerald-700 dark:text-emerald-400":"flex items-start gap-2 rounded-lg border border-destructive/20 bg-destructive/10 p-3 text-sm text-destructive",children:["success"===e.status?(0,l.jsx)(dW.A,{className:"mt-0.5 size-4 shrink-0"}):(0,l.jsx)(dX.A,{className:"mt-0.5 size-4 shrink-0"}),(0,l.jsx)("span",{children:"success"===e.status?"Connection verified successfully.":e.message})]}),(0,l.jsx)("div",{className:"space-y-6",children:f.map(([b,c],d)=>{let e=c.every(a=>a.visibleWhen?.field==="runtimeMode");return(0,l.jsxs)("section",{className:0===d||"managed-cloud"===g&&e?"":"border-t pt-5",children:[b&&(0,l.jsx)("h2",{className:"mb-4 text-sm font-medium",children:b}),(0,l.jsx)("div",{className:"grid gap-x-5 gap-y-5 md:grid-cols-2",children:c.map(b=>{let d=z(a,b),e=b.providerField?a.configSchema?.find(a=>a.key===b.providerField):void 0,f=b.defaultFromGlobalConfigKey?h?.config[b.defaultFromGlobalConfigKey]:void 0,g="string"==typeof f&&f&&!b.options?.some(a=>a.value===f)?[...b.options??[],{label:`${f} (AI Models)`,value:f,description:"Current workspace default."}]:b.options,i=e?gA(g,String(z(a,e))):g,j=i?.find(a=>a.value===d),k=`${a.id}:${b.key}`,m=w[k],o="full"===b.layout||"half"!==b.layout&&1===c.length;return(0,l.jsxs)("div",{className:o?"space-y-2 md:col-span-2":"space-y-2",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,l.jsxs)(Q.J,{htmlFor:k,className:"text-[13px] font-medium",children:[b.label,b.required&&(0,l.jsx)("span",{className:"ml-1 text-destructive",children:"*"})]}),"toggle"===b.type&&(0,l.jsx)(d8.d,{id:k,checked:!!d,onCheckedChange:c=>A(a.id,b.key,c)})]}),"select"===b.type?(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsxs)(R.l6,{value:String(d),onValueChange:c=>c&&void!function(a,b,c){for(let d of(A(a.id,b.key,c),a.configSchema??[]))d.providerField===b.key&&A(a.id,d.key,d.defaultValueByProvider?.[c]??d.defaultValue??"");if("runtimeMode"!==b.key)return;let d=a.runtime?.modes.find(a=>a.id===c);d&&(d.credentialConfigKey&&("local"===d.id||"local-docker"===d.id||"local-process"===d.id)&&!n[a.id]?.[d.credentialConfigKey]&&A(a.id,d.credentialConfigKey,`lvi_local_${crypto.randomUUID().replace(/-/g,"")}`),"local"!==d.id||n[a.id]?.audioProvider&&n[a.id]?.audioProvider!=="larkup-cloud"&&n[a.id]?.audioProvider!=="local"||A(a.id,"audioProvider","deepgram"))}(a,b,c),children:[(0,l.jsx)(R.bq,{id:k,className:"min-w-0 flex-1",children:(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(j?.image??j?.icon)&&(0,l.jsx)("img",{src:j.image??j.icon,alt:"",className:"size-4 shrink-0 object-contain"}),(0,l.jsx)("span",{className:j?"truncate":"truncate text-muted-foreground",children:j?.label??`Choose ${b.label.toLowerCase()}`})]})}),(0,l.jsx)(R.gC,{children:i?.map(a=>(0,l.jsx)(R.eb,{value:a.value,children:(0,l.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(a.image??a.icon)&&(0,l.jsx)("img",{src:a.image??a.icon,alt:"",className:"size-4 shrink-0 object-contain"}),(0,l.jsxs)("span",{className:"min-w-0",children:[(0,l.jsx)("span",{className:"block",children:a.label}),(0,l.jsx)(gz,{description:a.description})]})]})},a.value))})]}),b.verification&&(0,l.jsx)(O.$,{"aria-label":`Verify ${b.label}`,className:"h-10 px-4",disabled:b.required&&!d||r===a.id,onClick:()=>void C(a,b),size:"default",variant:"outline",children:r===a.id?(0,l.jsx)(M.A,{className:"size-4 animate-spin"}):"Verify"})]}):"toggle"===b.type?null:(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsxs)("div",{className:"relative min-w-0 flex-1",children:[(0,l.jsx)(P.p,{id:k,type:"password"!==b.type||m?"text":"password",value:String(d),onChange:c=>A(a.id,b.key,c.target.value),placeholder:"videoVisionApiKey"!==b.key&&"videoAgentApiKey"!==b.key||d?"password"===b.type?"Enter secret…":b.defaultValue:"Using saved AI Models key",className:"password"===b.type?"pr-10 font-mono text-xs":""}),"password"===b.type&&(0,l.jsx)("button",{type:"button","aria-label":m?`Hide ${b.label}`:`Show ${b.label}`,className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",onClick:()=>x(a=>({...a,[k]:!m})),children:m?(0,l.jsx)(ai.A,{className:"size-4"}):(0,l.jsx)(aj.A,{className:"size-4"})})]}),b.verification&&(0,l.jsx)(O.$,{"aria-label":`Verify ${b.label}`,variant:"outline",size:"default",className:"h-10 px-5",onClick:()=>void C(a,b),disabled:b.required&&!d||r===a.id,children:r===a.id?(0,l.jsx)(M.A,{className:"size-4 animate-spin"}):"Verify"})]}),b.help&&(0,l.jsx)("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:b.help})]},b.key)})})]},b||`default-${d}`)})})]}),(0,l.jsx)(T.wL,{className:"justify-end border-t bg-muted/10",children:(0,l.jsxs)(O.$,{size:"sm",disabled:!d||p===a.id,onClick:()=>void B(a.id),children:[p===a.id?(0,l.jsx)(M.A,{className:"size-3.5 animate-spin"}):(0,l.jsx)(N.A,{className:"size-3.5"}),"Save settings"]})})]},a.id)})})]}):(0,l.jsxs)("div",{className:"flex flex-col items-center justify-center py-24 text-center",children:[(0,l.jsx)("div",{className:"mb-4 flex size-12 items-center justify-center rounded-full bg-primary/10",children:(0,l.jsx)(v.A,{className:"size-6 text-primary"})}),(0,l.jsx)("h3",{className:"mb-2 text-lg font-semibold",children:"No configurable tools installed"}),(0,l.jsx)("p",{className:"max-w-sm text-sm text-muted-foreground",children:"Install a Marketplace tool with settings to configure it here."})]})}var gF=c(49026),gG=c(25192),gH=c(59808),gI=c(64520),gJ=c(94635),gK=c(1847),gL=c(44482),gM=c(37564),gN=c(53906);let gO={name:"message-square",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]};gO.node;let gP=(0,q.A)(gO),gQ={name:"zap",size:24,node:[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]]};gQ.node;let gR=(0,q.A)(gQ),gS=a=>fetch(a).then(a=>a.json());function gT(a,b,c){if("all"===b||!a)return a||[];let d=30;"7d"===b?d=7:"14d"===b?d=14:"30d"===b?d=30:"90d"===b&&(d=90);let e=[],f=new Date,g=new Map(a.map(a=>[a.date,a]));for(let a=d-1;a>=0;a--){let b=new Date(f);b.setDate(b.getDate()-a);let d=b.toISOString().split("T")[0];g.has(d)?e.push(g.get(d)):e.push({date:d,...c()})}return e}function gU(a){return a<1e3?a.toLocaleString():a<1e6?`${(a/1e3).toFixed(+(a<1e4))}K`:`${(a/1e6).toFixed(2)}M`}function gV(){var a;let[b,c]=(0,m.useState)("indexing"),[d,e]=(0,m.useState)("14d"),[f,g]=(0,m.useState)("all"),{data:h,isLoading:i,error:j}=(0,H.u)(`/api/analytics?timeframe=${d}&runtime=${f}`,gS);if(i)return(0,l.jsxs)("div",{className:"p-8 flex-col gap-2 text-center text-muted-foreground animate-pulse flex items-center justify-center h-full",children:[(0,l.jsx)(M.A,{className:"size-6 animate-spin"}),(0,l.jsx)("span",{className:"text-[15px]",children:"Loading analytics data..."})]});if(j||!h)return(0,l.jsx)("div",{className:"p-8 text-center text-destructive",children:"Failed to load analytics data."});let k=!h.serverTimeSeries?.length||h.serverTimeSeries.every(a=>0===a.requests),n=!h.embeddingTimeSeries?.length||h.embeddingTimeSeries.every(a=>0===a.tokens),o=!h.chatTimeSeries?.length||h.chatTimeSeries.every(a=>0===a.tokens),p=({title:a,description:b})=>(0,l.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-md",children:(0,l.jsxs)("div",{className:"flex flex-col items-center space-y-2 dark:bg-zinc-900/90 px-5 py-4 rounded-lg max-w-xl text-center",children:[(0,l.jsx)("div",{className:"p-2 border border-border/70 rounded-lg bg-white",children:(0,l.jsx)(D,{className:"size-6 text-black/80"})}),(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsx)("p",{className:"text-[16px] font-semibold text-foreground",children:a}),(0,l.jsx)("p",{className:"text-[13px] text-muted-foreground",children:b})]})]})});return(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[(0,l.jsxs)(T.Zp,{className:"shadow-none rounded-xl",children:[(0,l.jsxs)(T.aR,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,l.jsx)(T.ZB,{className:"text-sm font-medium",children:"Total Cost"}),(0,l.jsx)(D,{className:"size-4 text-muted-foreground"})]}),(0,l.jsxs)(T.Wu,{children:[(0,l.jsx)("div",{className:"text-2xl font-bold",children:0===(a=h.totalCost)?"$0.00":a<.01?a<1e-4?"<$0.0001":`$${a.toFixed(4)}`:`$${a.toFixed(2)}`}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"Across all paid models"})]})]}),(0,l.jsxs)(T.Zp,{className:"shadow-none rounded-xl",children:[(0,l.jsxs)(T.aR,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,l.jsx)(T.ZB,{className:"text-sm font-medium",children:"Chat Tokens"}),(0,l.jsx)(gP,{className:"size-4 text-muted-foreground"})]}),(0,l.jsxs)(T.Wu,{children:[(0,l.jsx)("div",{className:"text-2xl font-bold",children:gU(h.totalChatTokens)}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"Processed in conversations"})]})]}),(0,l.jsxs)(T.Zp,{className:"shadow-none rounded-xl",children:[(0,l.jsxs)(T.aR,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,l.jsx)(T.ZB,{className:"text-sm font-medium",children:"Embedding Tokens"}),(0,l.jsx)(t.A,{className:"size-4 text-muted-foreground"})]}),(0,l.jsxs)(T.Wu,{children:[(0,l.jsx)("div",{className:"text-2xl font-bold",children:gU(h.totalEmbeddingTokens)}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"Processed during indexing"})]})]}),(0,l.jsxs)(T.Zp,{className:"shadow-none rounded-xl",children:[(0,l.jsxs)(T.aR,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,l.jsx)(T.ZB,{className:"text-sm font-medium",children:"Total Requests"}),(0,l.jsx)(gR,{className:"size-4 text-muted-foreground"})]}),(0,l.jsxs)(T.Wu,{children:[(0,l.jsx)("div",{className:"text-2xl font-bold",children:h.totalRequests.toLocaleString()}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"To local RAG server this week"})]})]})]}),(0,l.jsxs)(eW,{value:b,onValueChange:c,className:"space-y-4",children:[(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[(0,l.jsxs)(eY,{className:"inline-flex bg-white/70 dark:bg-muted/70 h-9 items-center justify-center rounded-lg border border-border p-0.5 text-muted-foreground",children:[(0,l.jsxs)(eZ,{value:"indexing",className:"inline-flex items-center h-9 justify-center whitespace-nowrap rounded-md px-3 py-1 text-xs font-medium transition-all focus-visible:outline-none data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]: hover:text-foreground",children:[(0,l.jsx)(t.A,{className:"size-3.5 mr-1.5"}),"Indexing Usage"]}),(0,l.jsxs)(eZ,{value:"chat",className:"inline-flex items-center h-9 justify-center whitespace-nowrap rounded-md px-3 py-1 text-xs font-medium transition-all focus-visible:outline-none data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]: hover:text-foreground",children:[(0,l.jsx)(gP,{className:"size-3.5 mr-1.5"}),"Chat Usage"]}),(0,l.jsxs)(eZ,{value:"overview",className:"inline-flex items-center h-9 justify-center whitespace-nowrap rounded-md px-3 py-1 text-xs font-medium transition-all focus-visible:outline-none data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]: hover:text-foreground",children:[(0,l.jsx)(D,{className:"size-3.5 mr-1.5"}),"Server Traffic"]})]}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsxs)(R.l6,{value:f,onValueChange:a=>g(a),children:[(0,l.jsx)(R.bq,{className:"h-10! w-32 bg-white text-sm dark:bg-background",children:(0,l.jsx)(R.yv,{})}),(0,l.jsxs)(R.gC,{children:[(0,l.jsx)(R.eb,{value:"all",children:"All runtimes"}),(0,l.jsx)(R.eb,{value:"local",children:"Local"}),(0,l.jsx)(R.eb,{value:"remote",children:"Remote"})]})]}),(0,l.jsxs)(R.l6,{value:d,onValueChange:a=>a&&e(a),children:[(0,l.jsx)(R.bq,{className:"w-35 h-10! text-sm bg-white dark:bg-background focus:ring-0 focus:border-input data-[state=open]:ring-0 data-[state=open]:border-input outline-none focus:outline-none",children:(0,l.jsxs)(R.yv,{placeholder:"Select timeframe",children:["7d"===d&&"Last 7 days","14d"===d&&"Last 14 days","30d"===d&&"Last 30 days","90d"===d&&"Last 90 days","all"===d&&"All time"]})}),(0,l.jsxs)(R.gC,{children:[(0,l.jsx)(R.eb,{value:"7d",children:"Last 7 days"}),(0,l.jsx)(R.eb,{value:"14d",children:"Last 14 days"}),(0,l.jsx)(R.eb,{value:"30d",children:"Last 30 days"}),(0,l.jsx)(R.eb,{value:"90d",children:"Last 90 days"}),(0,l.jsx)(R.eb,{value:"all",children:"All time"})]})]})]})]}),(0,l.jsx)(e$,{value:"overview",className:"space-y-4",children:(0,l.jsxs)(T.Zp,{className:"shadow-none! rounded-xl",children:[(0,l.jsxs)(T.aR,{children:[(0,l.jsx)(T.ZB,{children:"Requests to RAG Server"}),(0,l.jsx)(T.BT,{children:"Daily requests sent to your local or remote deployed RAG endpoints."})]}),(0,l.jsx)(T.Wu,{className:"px-2 sm:p-6",children:(0,l.jsxs)("div",{className:"h-75 w-full relative",children:[k&&(0,l.jsx)(p,{title:"No Server Traffic Yet",description:"Once you start sending requests to the RAG server, usage will appear here."}),(0,l.jsx)(gF.u,{width:"100%",height:"100%",className:"[&_.recharts-surface]:outline-none [&_.recharts-wrapper]:outline-none",children:(0,l.jsxs)(gG.E,{data:gT(h.serverTimeSeries,d,()=>({requests:0,avgLatencyMs:0})),margin:{top:10,right:30,left:0,bottom:0},children:[(0,l.jsx)(gH.d,{strokeDasharray:"3 3",vertical:!1,stroke:"currentColor",strokeOpacity:.1}),(0,l.jsx)(gI.W,{dataKey:"date",stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,minTickGap:20,tickFormatter:a=>{if(!a.includes("-"))return a;let[b,c,d]=a.split("-");return new Date(parseInt(b,10),parseInt(c,10)-1,parseInt(d,10)).toLocaleDateString("en-US",{month:"short",day:"numeric"})}}),(0,l.jsx)(gJ.h,{allowDecimals:!1,stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,tickFormatter:a=>`${a}`}),(0,l.jsx)(gK.m,{contentStyle:{backgroundColor:"var(--color-background)",borderColor:"var(--color-border)",borderRadius:"8px"},itemStyle:{color:"var(--color-foreground)"},cursor:{fill:"var(--color-muted)",opacity:.4}}),(0,l.jsx)(gL.yP,{dataKey:"requests",fill:"#3b82f6",radius:[4,4,0,0],maxBarSize:40,activeBar:{className:"outline-none focus:outline-none"}})]})})]})})]})}),(0,l.jsx)(e$,{value:"indexing",className:"space-y-4",children:(0,l.jsxs)(T.Zp,{className:"shadow-none rounded-xl",children:[(0,l.jsxs)(T.aR,{children:[(0,l.jsx)(T.ZB,{children:"Indexing Token Usage"}),(0,l.jsx)(T.BT,{children:"Daily tokens processed for document indexing."})]}),(0,l.jsx)(T.Wu,{className:"px-2 sm:p-6",children:(0,l.jsxs)("div",{className:"h-75 w-full relative",children:[n&&(0,l.jsx)(p,{title:"No Indexing Data Yet",description:"Add documents to your knowledge bases to see embedding token usage here."}),(0,l.jsx)(gF.u,{width:"100%",height:"100%",className:"[&_.recharts-surface]:outline-none [&_.recharts-wrapper]:outline-none",children:(0,l.jsxs)(gM.Q,{data:gT(h.embeddingTimeSeries,d,()=>({tokens:0,cost:0,requests:0})),margin:{top:10,right:30,left:0,bottom:0},children:[(0,l.jsx)("defs",{children:(0,l.jsxs)("linearGradient",{id:"colorIndexing",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,l.jsx)("stop",{offset:"5%",stopColor:"#f97316",stopOpacity:.3}),(0,l.jsx)("stop",{offset:"95%",stopColor:"#f97316",stopOpacity:0})]})}),(0,l.jsx)(gH.d,{strokeDasharray:"3 3",vertical:!1,stroke:"currentColor",strokeOpacity:.1}),(0,l.jsx)(gI.W,{dataKey:"date",stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,minTickGap:20,tickFormatter:a=>{if(!a.includes("-"))return a;let[b,c,d]=a.split("-");return new Date(parseInt(b,10),parseInt(c,10)-1,parseInt(d,10)).toLocaleDateString("en-US",{month:"short",day:"numeric"})}}),(0,l.jsx)(gJ.h,{allowDecimals:!1,stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,tickFormatter:a=>`${a>=1e3?a/1e3+"k":a}`}),(0,l.jsx)(gK.m,{contentStyle:{backgroundColor:"var(--color-background)",borderColor:"var(--color-border)",borderRadius:"8px"},itemStyle:{color:"var(--color-foreground)"}}),(0,l.jsx)(gN.Gk,{type:"monotone",dataKey:"tokens",stroke:"#f97316",strokeWidth:2,fillOpacity:1,fill:"url(#colorIndexing)",activeDot:{r:4,className:"outline-none focus:outline-none",strokeWidth:0}})]})})]})})]})}),(0,l.jsx)(e$,{value:"chat",className:"space-y-4",children:(0,l.jsxs)(T.Zp,{className:"shadow-none rounded-xl",children:[(0,l.jsxs)(T.aR,{children:[(0,l.jsx)(T.ZB,{children:"Chat Token Usage"}),(0,l.jsx)(T.BT,{children:"Daily tokens processed for chat completions."})]}),(0,l.jsx)(T.Wu,{className:"px-2 sm:p-6",children:(0,l.jsxs)("div",{className:"h-75 w-full relative",children:[o&&(0,l.jsx)(p,{title:"No Chat Data Yet",description:"Chat with the AI to see your token usage metrics here."}),(0,l.jsx)(gF.u,{width:"100%",height:"100%",className:"[&_.recharts-surface]:outline-none [&_.recharts-wrapper]:outline-none",children:(0,l.jsxs)(gM.Q,{data:gT(h.chatTimeSeries,d,()=>({tokens:0,cost:0,requests:0})),margin:{top:10,right:30,left:0,bottom:0},children:[(0,l.jsx)("defs",{children:(0,l.jsxs)("linearGradient",{id:"colorChat",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,l.jsx)("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.3}),(0,l.jsx)("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]})}),(0,l.jsx)(gH.d,{strokeDasharray:"3 3",vertical:!1,stroke:"currentColor",strokeOpacity:.1}),(0,l.jsx)(gI.W,{dataKey:"date",stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,minTickGap:20,tickFormatter:a=>{if(!a.includes("-"))return a;let[b,c,d]=a.split("-");return new Date(parseInt(b,10),parseInt(c,10)-1,parseInt(d,10)).toLocaleDateString("en-US",{month:"short",day:"numeric"})}}),(0,l.jsx)(gJ.h,{allowDecimals:!1,stroke:"currentColor",strokeOpacity:.5,fontSize:12,tickLine:!1,axisLine:!1,tickFormatter:a=>`${a>=1e3?a/1e3+"k":a}`}),(0,l.jsx)(gK.m,{contentStyle:{backgroundColor:"var(--color-background)",borderColor:"var(--color-border)",borderRadius:"8px"},itemStyle:{color:"var(--color-foreground)"}}),(0,l.jsx)(gN.Gk,{type:"monotone",dataKey:"tokens",stroke:"#3b82f6",strokeWidth:2,fillOpacity:1,fill:"url(#colorChat)",activeDot:{r:4,className:"outline-none focus:outline-none",strokeWidth:0}})]})})]})})]})})]})]})}let gW={name:"calendar-clock",size:24,node:[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v3",key:"otl347"}],["path",{d:"M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338",key:"7hb8p4"}],["path",{d:"M3 9h5.859",key:"numkqi"}],["path",{d:"M8 2v3",key:"1ioesn"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]};gW.node;let gX=(0,q.A)(gW),gY=["general","models","storage","search-web","agent-customization","runtime","monitoring","automations","marketplace","tool-settings"];function gZ(){let a=(0,o.useSearchParams)(),b=(0,o.useRouter)(),c=(0,o.usePathname)(),[d,e]=(0,m.useState)(()=>{if(a.has("ai-models"))return"models";let b=a.get("section");return b&&gY.includes(b)?b:b?null:"general"});return(0,l.jsxs)(G,{activeSection:d,onSectionChange:a=>{e(a);let d=`${c}?section=${a}`;window.history.replaceState(null,"",d),b.replace(d,{scroll:!1})},fullWidth:!1,children:["general"===d&&(0,l.jsx)(af,{}),"models"===d&&(0,l.jsx)(dQ,{}),"storage"===d&&(0,l.jsx)(gl,{}),"agent-customization"===d&&(0,l.jsx)(gc,{}),"runtime"===d&&(0,l.jsx)(fV,{}),"marketplace"===d&&(0,l.jsx)(gt,{}),"tool-settings"===d&&(0,l.jsx)(gE,{}),"search-web"===d&&(0,l.jsx)(gg,{}),"monitoring"===d&&(0,l.jsxs)("section",{className:"space-y-6",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"text-xl font-semibold tracking-tight text-foreground",children:"Monitoring"}),(0,l.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Track this Project’s health, latency, errors, and usage by local or remote deployment."})]}),(0,l.jsx)(gV,{})]}),"automations"===d&&(0,l.jsxs)("section",{className:"space-y-2",children:[(0,l.jsx)("h1",{className:"text-xl font-semibold",children:"Jobs"}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:"Source sync and incremental re-index jobs run while the local Project Runtime is on."}),(0,l.jsxs)("div",{className:"rounded-lg flex flex-col items-center justify-center h-32 p-6 text-sm text-muted-foreground",children:[(0,l.jsx)(gX,{className:"size-6 mb-2"}),(0,l.jsx)("p",{children:"Cron tasks are coming soon."})]})]}),null===d&&(0,l.jsxs)("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[(0,l.jsx)("h2",{className:"text-lg font-semibold",children:"Section not found"}),(0,l.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"The settings section you are looking for does not exist or has been removed."})]})]})}function g$(){return(0,l.jsx)(m.Suspense,{children:(0,l.jsx)(gZ,{})})}}};var b=require("../../webpack-runtime.js");b.C(a);var c=b.X(0,[7448,2411,7613,3287,7945,9319,915],()=>b(b.s=18790));module.exports=c})();