@lunora/studio 1.0.0-alpha.37 → 1.0.0-alpha.371

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 (489) hide show
  1. package/README.md +4 -4
  2. package/dist/index.d.mts +1629 -0
  3. package/dist/index.d.ts +1021 -809
  4. package/dist/index.mjs +1 -0
  5. package/dist/mount.d.mts +23 -0
  6. package/dist/mount.d.ts +13 -11
  7. package/dist/mount.mjs +1 -0
  8. package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -0
  9. package/dist/packem_chunks/ApiTab.mjs +1 -0
  10. package/dist/packem_chunks/AuditPanel.mjs +1 -0
  11. package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -0
  12. package/dist/packem_chunks/ExportImportPanel.mjs +10 -0
  13. package/dist/packem_chunks/FileBrowser.mjs +4 -0
  14. package/dist/packem_chunks/FunctionRunner.mjs +1 -0
  15. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -0
  16. package/dist/packem_chunks/HealthPanel.mjs +1 -0
  17. package/dist/packem_chunks/InsightsPanel.mjs +1 -0
  18. package/dist/packem_chunks/LogsPanel.mjs +1 -0
  19. package/dist/packem_chunks/MailPanel.mjs +2 -0
  20. package/dist/packem_chunks/MetricsPanel.mjs +1 -0
  21. package/dist/packem_chunks/NotificationsPanel.mjs +1 -0
  22. package/dist/packem_chunks/PitrPanel.mjs +1 -0
  23. package/dist/packem_chunks/SchemaViewer.mjs +1 -0
  24. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -0
  25. package/dist/packem_chunks/SettingsPanel.mjs +1 -0
  26. package/dist/packem_chunks/SqlEditorPanel.mjs +25 -0
  27. package/dist/packem_chunks/TableEditor.mjs +1 -0
  28. package/dist/packem_chunks/agents-panel.mjs +1 -0
  29. package/dist/packem_chunks/ai-knowledge.mjs +1 -0
  30. package/dist/packem_chunks/ai-usage-panel.mjs +1 -0
  31. package/dist/packem_chunks/analytics-panel.mjs +1 -0
  32. package/dist/packem_chunks/architecture-panel.mjs +1 -0
  33. package/dist/packem_chunks/assistant-panel.mjs +3 -0
  34. package/dist/packem_chunks/auth-audit-panel.mjs +1 -0
  35. package/dist/packem_chunks/auth-config-panel.mjs +1 -0
  36. package/dist/packem_chunks/auth-sessions-panel.mjs +1 -0
  37. package/dist/packem_chunks/containers-panel.mjs +1 -0
  38. package/dist/packem_chunks/dashboards-panel.mjs +1 -0
  39. package/dist/packem_chunks/evals-panel.mjs +1 -0
  40. package/dist/packem_chunks/fanout-panel.mjs +1 -0
  41. package/dist/packem_chunks/flags-panel.mjs +1 -0
  42. package/dist/packem_chunks/issues-panel.mjs +1 -0
  43. package/dist/packem_chunks/kv-browser.mjs +1 -0
  44. package/dist/packem_chunks/log-drains-panel.mjs +4 -0
  45. package/dist/packem_chunks/migrations-route.mjs +1 -0
  46. package/dist/packem_chunks/organizations-panel.mjs +1 -0
  47. package/dist/packem_chunks/payments-panel.mjs +1 -0
  48. package/dist/packem_chunks/permissions-panel.mjs +1 -0
  49. package/dist/packem_chunks/privacy-requests-panel.mjs +1 -0
  50. package/dist/packem_chunks/queues-panel.mjs +1 -0
  51. package/dist/packem_chunks/reactors-panel.mjs +1 -0
  52. package/dist/packem_chunks/rls-panel.mjs +1 -0
  53. package/dist/packem_chunks/schedule-panel.mjs +1 -0
  54. package/dist/packem_chunks/storage-rules-panel.mjs +1 -0
  55. package/dist/packem_chunks/subscriptions-panel.mjs +1 -0
  56. package/dist/packem_chunks/sync-client-panel.mjs +1 -0
  57. package/dist/packem_chunks/theme-indicator.mjs +1 -0
  58. package/dist/packem_chunks/traces-panel.mjs +1 -0
  59. package/dist/packem_chunks/users-panel.mjs +1 -0
  60. package/dist/packem_chunks/vector-browser.mjs +1 -0
  61. package/dist/packem_chunks/workflows-panel.mjs +1 -0
  62. package/dist/packem_shared/ADMIN_FUNCTIONS-C6U-ugro.mjs +1 -0
  63. package/dist/packem_shared/ApiDocsPanel-xqgxgYCy.mjs +2 -0
  64. package/dist/packem_shared/ApiReferencePanel-CQxU1Ocx.mjs +1 -0
  65. package/dist/packem_shared/CommandPalette-BZCHLpst.mjs +1 -0
  66. package/dist/packem_shared/ConfirmButton-CIXYF6Mg.mjs +1 -0
  67. package/dist/packem_shared/ConnectionBadge-BfcoN-VE.mjs +1 -0
  68. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Py5Yx7rP.mjs +1 -0
  69. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs +1 -0
  70. package/dist/packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs +1 -0
  71. package/dist/packem_shared/DataBrowser-BrRWqnCr.mjs +4 -0
  72. package/dist/packem_shared/DataFilters--ocFTVT2.mjs +1 -0
  73. package/dist/packem_shared/ErrorBoundary-BWNF98VF.mjs +1 -0
  74. package/dist/packem_shared/GlobalDataBrowser-D8ZheGwm.mjs +1 -0
  75. package/dist/packem_shared/HomePanel-CHq9VBrh.mjs +1 -0
  76. package/dist/packem_shared/MigrationsPanel-BWGgOwmX.mjs +1 -0
  77. package/dist/packem_shared/OpenRpcReferencePanel-BFDG91tn.mjs +1 -0
  78. package/dist/packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.mjs +1 -0
  79. package/dist/packem_shared/ScheduledJobs-QCTRdugp.mjs +1 -0
  80. package/dist/packem_shared/ShardInput-CoySruKZ.mjs +1 -0
  81. package/dist/packem_shared/Studio-pDEG4JTx.mjs +1 -0
  82. package/dist/packem_shared/StudioApp-C4IOJPR6.mjs +1 -0
  83. package/dist/packem_shared/StudioI18nProvider-CGXCPnQn.mjs +1 -0
  84. package/dist/packem_shared/advisor-view-Dj-mZPAq.mjs +5 -0
  85. package/dist/packem_shared/aggregateMetrics-DKFJc-o5.mjs +1 -0
  86. package/dist/packem_shared/alert-PB5W11MM.mjs +1 -0
  87. package/dist/packem_shared/app.d-BXrVLb99.d.mts +360 -0
  88. package/dist/packem_shared/app.d-BXrVLb99.d.ts +360 -0
  89. package/dist/packem_shared/assistant-provider-BQG7QZAu.mjs +1 -0
  90. package/dist/packem_shared/assistant-reason-D6EwMCxT.mjs +1 -0
  91. package/dist/packem_shared/auth-pager-DW77WeZw.mjs +1 -0
  92. package/dist/packem_shared/badge-r_5B4LHP.mjs +1 -0
  93. package/dist/packem_shared/bar-chart-BCsEIQoQ.mjs +6 -0
  94. package/dist/packem_shared/browser-storage-BH1MxLZs.mjs +1 -0
  95. package/dist/packem_shared/button-q0UYSmrn.mjs +1 -0
  96. package/dist/packem_shared/card-By2O8ULa.mjs +1 -0
  97. package/dist/packem_shared/cf-links-C4DVTr8A.mjs +1 -0
  98. package/dist/packem_shared/checkbox-CnS9cyCz.mjs +1 -0
  99. package/dist/packem_shared/control-button-BOZ5K-FC.mjs +1 -0
  100. package/dist/packem_shared/data-grid-B5m1OosL.mjs +1 -0
  101. package/dist/packem_shared/data-view-params-C-_G-biH.mjs +1 -0
  102. package/dist/packem_shared/diagram-export-panel-Vdt-DZnO.mjs +2 -0
  103. package/dist/packem_shared/dropdown-menu-jLZenfWH.mjs +2 -0
  104. package/dist/packem_shared/empty-state-D7jEML_T.mjs +1 -0
  105. package/dist/packem_shared/error-alert-BzZfqmf4.mjs +6 -0
  106. package/dist/packem_shared/grid-features-Drvfswwy.mjs +6 -0
  107. package/dist/packem_shared/grid-pagination-DY2erU65.mjs +1 -0
  108. package/dist/packem_shared/home-panel-DTWHlX5S.mjs +3 -0
  109. package/dist/packem_shared/input-CXhxesPC.mjs +1 -0
  110. package/dist/packem_shared/internal-hIuTpSbx.mjs +2 -0
  111. package/dist/packem_shared/label-DKFzyHq6.mjs +1 -0
  112. package/dist/packem_shared/live-status-D1GasNsH.mjs +1 -0
  113. package/dist/packem_shared/log-fields-BolUoZ9g.mjs +1 -0
  114. package/dist/packem_shared/log-line-BH0iWiBv.mjs +1 -0
  115. package/dist/packem_shared/metrics-format-1sNGG47R.mjs +1 -0
  116. package/dist/packem_shared/modal-shell-CDztwLnv.mjs +1 -0
  117. package/dist/packem_shared/operation-console-provider-DoloEvon.mjs +1 -0
  118. package/dist/packem_shared/recording-client-z4CBi0y8.mjs +1 -0
  119. package/dist/packem_shared/reference-view-DENugPcj.mjs +13 -0
  120. package/dist/packem_shared/schema-diagram-CtVPhOGj.mjs +2 -0
  121. package/dist/packem_shared/scroll-area-CXCQH7VT.mjs +2 -0
  122. package/dist/packem_shared/select-DPyS18Vy.mjs +2 -0
  123. package/dist/packem_shared/shard-history-CaO3C4KQ.mjs +1 -0
  124. package/dist/packem_shared/shortcuts-B9gDaXmw.mjs +1 -0
  125. package/dist/packem_shared/skeleton-DX1gfixl.mjs +1 -0
  126. package/dist/packem_shared/sparkline-B_sPPO_8.mjs +1 -0
  127. package/dist/packem_shared/sql-result-table-DCwooMGW.mjs +1 -0
  128. package/dist/packem_shared/stat-card-BAv73QtB.mjs +1 -0
  129. package/dist/packem_shared/storage-tier-C2mKwYRj.mjs +1 -0
  130. package/dist/packem_shared/studio-DE7i2--m.mjs +2 -0
  131. package/dist/packem_shared/table-D0SBiDu-.mjs +2 -0
  132. package/dist/packem_shared/table-list-sidebar-DUnCjFL7.mjs +1 -0
  133. package/dist/packem_shared/textarea--40GKAyz.mjs +1 -0
  134. package/dist/packem_shared/trace-handoff-BV3EWqy_.mjs +1 -0
  135. package/dist/packem_shared/use-admin-query-CaOm4JS3.mjs +1 -0
  136. package/dist/packem_shared/use-admin-spec-CK7mk3Ui.mjs +1 -0
  137. package/dist/packem_shared/use-assistant-rpc-DCC6ph2u.mjs +1 -0
  138. package/dist/packem_shared/use-async-submit-D0r7-m2J.mjs +1 -0
  139. package/dist/packem_shared/use-auth-config-CG7VvAvQ.mjs +1 -0
  140. package/dist/packem_shared/use-mirrored-ref-CVDf2z1M.mjs +1 -0
  141. package/dist/packem_shared/use-open-trace-BJKMJjeS.mjs +1 -0
  142. package/dist/packem_shared/use-shard-key-BsP3o5wT.mjs +1 -0
  143. package/dist/packem_shared/use-studio-client-DCA50tF2.mjs +1 -0
  144. package/dist/packem_shared/useDebounced-DVeQ5-oW.mjs +1 -0
  145. package/dist/packem_shared/utils-bhneXptQ.mjs +1 -0
  146. package/dist/packem_shared/virtual-rect-D_j7aLxX.mjs +1 -0
  147. package/dist/standalone/chunk-23TGXTY3.js +1 -0
  148. package/dist/standalone/chunk-2BN5NW34.js +1 -0
  149. package/dist/standalone/chunk-2DT3QG6Q.js +1 -0
  150. package/dist/standalone/chunk-2EB7FN5S.js +1 -0
  151. package/dist/standalone/chunk-2STFVRP6.js +1 -0
  152. package/dist/standalone/chunk-2WELEPUX.js +14 -0
  153. package/dist/standalone/chunk-34E6NNQZ.js +1 -0
  154. package/dist/standalone/chunk-35IQT6SS.js +7 -0
  155. package/dist/standalone/chunk-3D67ZJRW.js +1 -0
  156. package/dist/standalone/chunk-3HR74V73.js +1 -0
  157. package/dist/standalone/chunk-3NC6JA7A.js +1 -0
  158. package/dist/standalone/chunk-43VARWUD.js +1 -0
  159. package/dist/standalone/chunk-4AJML27P.js +1 -0
  160. package/dist/standalone/chunk-4EPW63HS.js +1 -0
  161. package/dist/standalone/chunk-4M223MUW.js +1 -0
  162. package/dist/standalone/chunk-4NKJV7YX.js +1 -0
  163. package/dist/standalone/chunk-4PI2OSSP.js +1 -0
  164. package/dist/standalone/chunk-5IXKYP7I.js +1 -0
  165. package/dist/standalone/chunk-5PEAXTYQ.js +1 -0
  166. package/dist/standalone/chunk-5REEK2HD.js +1 -0
  167. package/dist/standalone/chunk-5W5XLOZO.js +1 -0
  168. package/dist/standalone/chunk-5Y67VCSW.js +1 -0
  169. package/dist/standalone/chunk-64WVI7AU.js +1 -0
  170. package/dist/standalone/chunk-6A6AELDJ.js +1 -0
  171. package/dist/standalone/chunk-6DU2UW57.js +33 -0
  172. package/dist/standalone/chunk-6FPV3EK2.js +1 -0
  173. package/dist/standalone/chunk-6G3E4PJ2.js +1 -0
  174. package/dist/standalone/chunk-72PNA5CK.js +1 -0
  175. package/dist/standalone/chunk-73GEDGFE.js +1 -0
  176. package/dist/standalone/chunk-74WS3GUC.js +3 -0
  177. package/dist/standalone/chunk-A2Q3TGIQ.js +1 -0
  178. package/dist/standalone/chunk-AHANHVFC.js +1 -0
  179. package/dist/standalone/chunk-ALXTADCX.js +10 -0
  180. package/dist/standalone/chunk-AXKOMM2J.js +1 -0
  181. package/dist/standalone/chunk-BG2CJOVS.js +1 -0
  182. package/dist/standalone/chunk-BKI3JMXQ.js +1 -0
  183. package/dist/standalone/chunk-BO35TSLE.js +1 -0
  184. package/dist/standalone/chunk-BWT5ANXC.js +1 -0
  185. package/dist/standalone/chunk-C724GMPR.js +1 -0
  186. package/dist/standalone/chunk-CHJYRPLL.js +6 -0
  187. package/dist/standalone/chunk-CKK227GJ.js +1 -0
  188. package/dist/standalone/chunk-CL3JOU6F.js +1 -0
  189. package/dist/standalone/chunk-CVSIFPI5.js +1 -0
  190. package/dist/standalone/chunk-D65UVZIA.js +1 -0
  191. package/dist/standalone/chunk-DA2CAFXI.js +1 -0
  192. package/dist/standalone/chunk-DFOIQN5E.js +1 -0
  193. package/dist/standalone/chunk-EDN4JTLK.js +1 -0
  194. package/dist/standalone/chunk-FVITJ4Q4.js +1 -0
  195. package/dist/standalone/chunk-FWJ7VSGQ.js +1 -0
  196. package/dist/standalone/chunk-FWM5Z6CH.js +1 -0
  197. package/dist/standalone/chunk-G2BUKFAD.js +1 -0
  198. package/dist/standalone/chunk-G6IFVCSL.js +1 -0
  199. package/dist/standalone/chunk-GN3GGVCY.js +1 -0
  200. package/dist/standalone/chunk-GWNGVKLG.js +1 -0
  201. package/dist/standalone/chunk-GXTSE66Z.js +1 -0
  202. package/dist/standalone/chunk-HAVIBMMB.js +1 -0
  203. package/dist/standalone/chunk-HCOF7HOM.js +1 -0
  204. package/dist/standalone/chunk-HDBRX5CX.js +1 -0
  205. package/dist/standalone/chunk-HFBSWKJS.js +1 -0
  206. package/dist/standalone/chunk-HG3MXWXT.js +1 -0
  207. package/dist/standalone/chunk-HRH5FYV6.js +1 -0
  208. package/dist/standalone/chunk-I2EFWZXX.js +3 -0
  209. package/dist/standalone/chunk-IJAZY2M7.js +1 -0
  210. package/dist/standalone/chunk-IOMK34E4.js +1 -0
  211. package/dist/standalone/chunk-J45HAKBU.js +1 -0
  212. package/dist/standalone/chunk-J4KHSWXK.js +1 -0
  213. package/dist/standalone/chunk-J7NEJGZW.js +1 -0
  214. package/dist/standalone/chunk-JMZT3CEW.js +1 -0
  215. package/dist/standalone/chunk-JW3TXMEF.js +59 -0
  216. package/dist/standalone/chunk-K3LRNI56.js +4 -0
  217. package/dist/standalone/chunk-KGLIQIZU.js +1 -0
  218. package/dist/standalone/chunk-KGURUUEC.js +1 -0
  219. package/dist/standalone/chunk-KQQOOBL5.js +1 -0
  220. package/dist/standalone/chunk-KRWSRKJ3.js +1 -0
  221. package/dist/standalone/chunk-KSFVO6OB.js +1 -0
  222. package/dist/standalone/chunk-KSLMSLWZ.js +30 -0
  223. package/dist/standalone/chunk-KTK4NDWQ.js +1 -0
  224. package/dist/standalone/chunk-LHAYLYCA.js +1 -0
  225. package/dist/standalone/chunk-LRQTVCUX.js +1 -0
  226. package/dist/standalone/chunk-MY7J2X2Y.js +1 -0
  227. package/dist/standalone/chunk-MYRTLPF5.js +1 -0
  228. package/dist/standalone/chunk-N77FOL5Q.js +1 -0
  229. package/dist/standalone/chunk-NGVP66OH.js +1 -0
  230. package/dist/standalone/chunk-O3AZ7JKE.js +1 -0
  231. package/dist/standalone/chunk-O4D6HJOQ.js +1 -0
  232. package/dist/standalone/chunk-OLI3R5ZJ.js +1 -0
  233. package/dist/standalone/chunk-ONTGYVAN.js +1 -0
  234. package/dist/standalone/chunk-OYBBHQRO.js +1 -0
  235. package/dist/standalone/chunk-P2JJ33X3.js +1 -0
  236. package/dist/standalone/chunk-P6VNMPWR.js +1 -0
  237. package/dist/standalone/chunk-PD56UWVC.js +1 -0
  238. package/dist/standalone/chunk-PDBW6GTJ.js +1 -0
  239. package/dist/standalone/chunk-PLLNOYT6.js +1 -0
  240. package/dist/standalone/chunk-PRTIYJFL.js +1 -0
  241. package/dist/standalone/chunk-PYK4VXG6.js +1 -0
  242. package/dist/standalone/chunk-QAOZXPLU.js +1 -0
  243. package/dist/standalone/chunk-QCWPTLPV.js +2 -0
  244. package/dist/standalone/chunk-QK46WKIS.js +1 -0
  245. package/dist/standalone/chunk-QNJJIVLQ.js +1 -0
  246. package/dist/standalone/chunk-QRA7AKYO.js +1 -0
  247. package/dist/standalone/chunk-QTEJHIZD.js +1 -0
  248. package/dist/standalone/chunk-QY5JC5H6.js +1 -0
  249. package/dist/standalone/chunk-RIAOZECW.js +1 -0
  250. package/dist/standalone/chunk-RLSKEGNK.js +1 -0
  251. package/dist/standalone/chunk-RPHIAYMR.js +1 -0
  252. package/dist/standalone/chunk-RPKPLAT2.js +1 -0
  253. package/dist/standalone/chunk-RTS5G3ET.js +2 -0
  254. package/dist/standalone/chunk-RXGN7E4K.js +1 -0
  255. package/dist/standalone/chunk-S36FVTKK.js +1 -0
  256. package/dist/standalone/chunk-S6RKBBI5.js +1 -0
  257. package/dist/standalone/chunk-SEPNNN6O.js +1 -0
  258. package/dist/standalone/chunk-STHN562E.js +1 -0
  259. package/dist/standalone/chunk-SY7AVD6C.js +1 -0
  260. package/dist/standalone/chunk-TDYA6E3G.js +1 -0
  261. package/dist/standalone/chunk-TW4O2BA5.js +159 -0
  262. package/dist/standalone/chunk-U2E36H6V.js +5 -0
  263. package/dist/standalone/chunk-U4X2I55T.js +1 -0
  264. package/dist/standalone/chunk-UBX5ZPLV.js +1 -0
  265. package/dist/standalone/chunk-UMDBJGZH.js +1 -0
  266. package/dist/standalone/chunk-UQZUK6MO.js +1 -0
  267. package/dist/standalone/chunk-URNEEX2Q.js +1 -0
  268. package/dist/standalone/chunk-UTE2SZQY.js +1 -0
  269. package/dist/standalone/chunk-VCLCELNQ.js +8 -0
  270. package/dist/standalone/chunk-VHRWGZVT.js +1 -0
  271. package/dist/standalone/chunk-VNH4OBJS.js +1 -0
  272. package/dist/standalone/chunk-VUOEJJUH.js +1 -0
  273. package/dist/standalone/chunk-WMF3KFRB.js +1 -0
  274. package/dist/standalone/chunk-WUJWIBTQ.js +1 -0
  275. package/dist/standalone/chunk-X7TFLK6L.js +5 -0
  276. package/dist/standalone/chunk-XAI64L2D.js +1 -0
  277. package/dist/standalone/chunk-XIJQY7MK.js +4 -0
  278. package/dist/standalone/chunk-XLYFGUEF.js +1 -0
  279. package/dist/standalone/chunk-Y23CK77V.js +1 -0
  280. package/dist/standalone/{chunk-BJGBHGK3.js → chunk-Y2YLTUMD.js} +1 -1
  281. package/dist/standalone/chunk-YEMTJB7N.js +1 -0
  282. package/dist/standalone/chunk-YORPLSI5.js +1 -0
  283. package/dist/standalone/chunk-YUVGMKHG.js +1 -0
  284. package/dist/standalone/chunk-Z4VISCXI.js +1 -0
  285. package/dist/standalone/chunk-ZN6LJWXV.js +6 -0
  286. package/dist/standalone/chunk-ZPQBVYNN.js +1 -0
  287. package/dist/standalone/chunk-ZSWW2UGP.js +1 -0
  288. package/dist/standalone/chunk-ZYARVDS6.js +1 -0
  289. package/dist/standalone/chunk-ZYGPKYEU.js +3 -0
  290. package/dist/standalone/studio.js +9 -214
  291. package/dist/styles.css +2 -2
  292. package/package.json +27 -22
  293. package/dist/index.js +0 -41
  294. package/dist/mount.js +0 -27
  295. package/dist/packem_chunks/ApiTab.js +0 -251
  296. package/dist/packem_chunks/AuditPanel.js +0 -200
  297. package/dist/packem_chunks/ExportImportPanel.js +0 -198
  298. package/dist/packem_chunks/FileBrowser.js +0 -2932
  299. package/dist/packem_chunks/FunctionRunner.js +0 -343
  300. package/dist/packem_chunks/FunctionStatsPanel.js +0 -377
  301. package/dist/packem_chunks/HealthPanel.js +0 -648
  302. package/dist/packem_chunks/InsightsPanel.js +0 -462
  303. package/dist/packem_chunks/LogsPanel.js +0 -827
  304. package/dist/packem_chunks/MailPanel.js +0 -353
  305. package/dist/packem_chunks/MetricsPanel.js +0 -1344
  306. package/dist/packem_chunks/MigrationsPanel.js +0 -239
  307. package/dist/packem_chunks/PitrPanel.js +0 -252
  308. package/dist/packem_chunks/SchemaViewer.js +0 -2513
  309. package/dist/packem_chunks/SecurityAdvisorPanel.js +0 -95
  310. package/dist/packem_chunks/SettingsPanel.js +0 -391
  311. package/dist/packem_chunks/SqlEditorPanel.js +0 -2323
  312. package/dist/packem_chunks/TableEditor.js +0 -313
  313. package/dist/packem_chunks/analytics-panel.js +0 -261
  314. package/dist/packem_chunks/auth-config-panel.js +0 -179
  315. package/dist/packem_chunks/auth-sessions-panel.js +0 -175
  316. package/dist/packem_chunks/containers-panel.js +0 -247
  317. package/dist/packem_chunks/dashboards-panel.js +0 -780
  318. package/dist/packem_chunks/fanout-panel.js +0 -482
  319. package/dist/packem_chunks/flags-panel.js +0 -176
  320. package/dist/packem_chunks/kv-browser.js +0 -1896
  321. package/dist/packem_chunks/log-drains-panel.js +0 -273
  322. package/dist/packem_chunks/organizations-panel.js +0 -670
  323. package/dist/packem_chunks/payments-panel.js +0 -186
  324. package/dist/packem_chunks/permissions-panel.js +0 -805
  325. package/dist/packem_chunks/queues-panel.js +0 -1052
  326. package/dist/packem_chunks/rls-panel.js +0 -315
  327. package/dist/packem_chunks/schedule-panel.js +0 -831
  328. package/dist/packem_chunks/sparkline.js +0 -79
  329. package/dist/packem_chunks/storage-rules-panel.js +0 -140
  330. package/dist/packem_chunks/subscriptions-panel.js +0 -238
  331. package/dist/packem_chunks/users-panel.js +0 -1265
  332. package/dist/packem_chunks/vector-browser.js +0 -281
  333. package/dist/packem_chunks/workflows-panel.js +0 -562
  334. package/dist/packem_shared/ADMIN_FUNCTIONS-BHHJi3Gb.js +0 -52
  335. package/dist/packem_shared/ApiDocsPanel-D4CJf2ad.js +0 -842
  336. package/dist/packem_shared/ApiReferencePanel-Co_wpRF2.js +0 -230
  337. package/dist/packem_shared/CommandPalette-BUPpbpMc.js +0 -373
  338. package/dist/packem_shared/ConfirmButton-C2eVi2Qv.js +0 -59
  339. package/dist/packem_shared/ConnectionBadge-B2DDM2Tn.js +0 -111
  340. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +0 -50
  341. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +0 -89
  342. package/dist/packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js +0 -27
  343. package/dist/packem_shared/DataBrowser-BeVNxSVm.js +0 -4493
  344. package/dist/packem_shared/DataFilters-FNquMaiu.js +0 -249
  345. package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +0 -66
  346. package/dist/packem_shared/GlobalDataBrowser-ErfvIs1S.js +0 -289
  347. package/dist/packem_shared/HomePanel-D9MQk8I7.js +0 -14
  348. package/dist/packem_shared/OpenRpcReferencePanel-DLWzrIx9.js +0 -192
  349. package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +0 -3
  350. package/dist/packem_shared/ScheduledJobs-ClaNpZsg.js +0 -262
  351. package/dist/packem_shared/ShardInput-gx_DZXXn.js +0 -107
  352. package/dist/packem_shared/Studio-C48P1K5W.js +0 -16
  353. package/dist/packem_shared/StudioApp-Cqh-SYm2.js +0 -657
  354. package/dist/packem_shared/StudioI18nProvider-B-tDCZIi.js +0 -48
  355. package/dist/packem_shared/advisor-view-D3-U4kRR.js +0 -159
  356. package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +0 -108
  357. package/dist/packem_shared/alert-CdAET2K_.js +0 -68
  358. package/dist/packem_shared/app.d-CNLRTrWw.d.ts +0 -300
  359. package/dist/packem_shared/badge-B2PKA1-5.js +0 -49
  360. package/dist/packem_shared/bar-chart-DSwcWIRy.js +0 -3246
  361. package/dist/packem_shared/browser-storage-tLOxkIHd.js +0 -185
  362. package/dist/packem_shared/button-BhsN2uZH.js +0 -49
  363. package/dist/packem_shared/card-DURq3ElK.js +0 -175
  364. package/dist/packem_shared/cf-links-BZfRdxSE.js +0 -8
  365. package/dist/packem_shared/checkbox-UNkzAxl-.js +0 -63
  366. package/dist/packem_shared/data-grid-Jz8FqQ2C.js +0 -183
  367. package/dist/packem_shared/data-view-params-Cd6yRVbv.js +0 -96
  368. package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +0 -280
  369. package/dist/packem_shared/empty-state-DY_oe0k6.js +0 -98
  370. package/dist/packem_shared/error-alert-BBT6D22d.js +0 -114
  371. package/dist/packem_shared/grid-features-CUr8Z1_O.js +0 -745
  372. package/dist/packem_shared/home-panel-CoGxi-oj.js +0 -1639
  373. package/dist/packem_shared/input-XH4r1Pt1.js +0 -53
  374. package/dist/packem_shared/internal-DTsYVn-g.js +0 -97
  375. package/dist/packem_shared/label-D8ykjn5J.js +0 -46
  376. package/dist/packem_shared/live-status-FZ0psC1z.js +0 -44
  377. package/dist/packem_shared/modal-shell-hyaJvIJ6.js +0 -100
  378. package/dist/packem_shared/reference-view-CSKyUyPl.js +0 -2141
  379. package/dist/packem_shared/scroll-area-DLhcy-ml.js +0 -93
  380. package/dist/packem_shared/select-UkNYCT3s.js +0 -273
  381. package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
  382. package/dist/packem_shared/skeleton-CGhL0p20.js +0 -45
  383. package/dist/packem_shared/sparkline-BnA1kC9X.js +0 -93
  384. package/dist/packem_shared/storage-tier-CL98eOvn.js +0 -85
  385. package/dist/packem_shared/studio-CPHA_-3I.js +0 -4015
  386. package/dist/packem_shared/table-DsCa9Qp9.js +0 -246
  387. package/dist/packem_shared/table-list-sidebar-B5psdSV1.js +0 -832
  388. package/dist/packem_shared/textarea-D3gaCU_-.js +0 -46
  389. package/dist/packem_shared/use-admin-query-BHPKmPuj.js +0 -106
  390. package/dist/packem_shared/use-auth-capabilities-C-VH0oJJ.js +0 -32
  391. package/dist/packem_shared/useDebounced-Dxncpg6z.js +0 -32
  392. package/dist/packem_shared/utils-B05Dmz_H.js +0 -8
  393. package/dist/packem_shared/virtual-rect-CVMUskSm.js +0 -10
  394. package/dist/standalone/chunk-22W5VKZ6.js +0 -1
  395. package/dist/standalone/chunk-2GGMGPEP.js +0 -1
  396. package/dist/standalone/chunk-2K47A3P6.js +0 -1
  397. package/dist/standalone/chunk-2NGUNNGW.js +0 -1
  398. package/dist/standalone/chunk-2THHW7BC.js +0 -1
  399. package/dist/standalone/chunk-3CJW6NWG.js +0 -4
  400. package/dist/standalone/chunk-3OA7PECS.js +0 -6
  401. package/dist/standalone/chunk-46K3NKPA.js +0 -1
  402. package/dist/standalone/chunk-4QHKBC77.js +0 -1
  403. package/dist/standalone/chunk-5OH3VPZF.js +0 -1
  404. package/dist/standalone/chunk-5OIBXYZM.js +0 -1
  405. package/dist/standalone/chunk-6GFEVKJP.js +0 -1
  406. package/dist/standalone/chunk-6WRZP62V.js +0 -1
  407. package/dist/standalone/chunk-764T6X6X.js +0 -1
  408. package/dist/standalone/chunk-7SLSB2TS.js +0 -4
  409. package/dist/standalone/chunk-7TJJXVSE.js +0 -1
  410. package/dist/standalone/chunk-7VF3IAAW.js +0 -2
  411. package/dist/standalone/chunk-AHILM3ZP.js +0 -1
  412. package/dist/standalone/chunk-AJIUI7DD.js +0 -1
  413. package/dist/standalone/chunk-ATYUMPDM.js +0 -1
  414. package/dist/standalone/chunk-BACPICH6.js +0 -1
  415. package/dist/standalone/chunk-BI35RXKQ.js +0 -1
  416. package/dist/standalone/chunk-BOXSWNXZ.js +0 -1
  417. package/dist/standalone/chunk-BQUQS7QN.js +0 -1
  418. package/dist/standalone/chunk-CKSHCYGC.js +0 -2
  419. package/dist/standalone/chunk-DC72CQY4.js +0 -76
  420. package/dist/standalone/chunk-DORBUITF.js +0 -1
  421. package/dist/standalone/chunk-DVC6YWVP.js +0 -1
  422. package/dist/standalone/chunk-DVKPRFIJ.js +0 -1
  423. package/dist/standalone/chunk-DWDILV2E.js +0 -1
  424. package/dist/standalone/chunk-DWTBY343.js +0 -1
  425. package/dist/standalone/chunk-EUIHTPKI.js +0 -1
  426. package/dist/standalone/chunk-FCSPAJW4.js +0 -1
  427. package/dist/standalone/chunk-GMSGZDDH.js +0 -13
  428. package/dist/standalone/chunk-GTM65MVX.js +0 -1
  429. package/dist/standalone/chunk-HV7G6DFP.js +0 -5
  430. package/dist/standalone/chunk-ILCTSAOB.js +0 -1
  431. package/dist/standalone/chunk-IOFMK4D7.js +0 -1
  432. package/dist/standalone/chunk-J6J54MBP.js +0 -1
  433. package/dist/standalone/chunk-JE2YOAB7.js +0 -4
  434. package/dist/standalone/chunk-JSEXCW5Q.js +0 -1
  435. package/dist/standalone/chunk-K3GNLVYK.js +0 -1
  436. package/dist/standalone/chunk-KEGAWN6Y.js +0 -1
  437. package/dist/standalone/chunk-KJJ3WM6H.js +0 -4
  438. package/dist/standalone/chunk-KZ6INM5M.js +0 -1
  439. package/dist/standalone/chunk-LAK5VSPI.js +0 -1
  440. package/dist/standalone/chunk-LD2R263D.js +0 -1
  441. package/dist/standalone/chunk-LI43EKM6.js +0 -1
  442. package/dist/standalone/chunk-M55U7NHO.js +0 -1
  443. package/dist/standalone/chunk-MPTM7ZU3.js +0 -3
  444. package/dist/standalone/chunk-MPYFGAOW.js +0 -1
  445. package/dist/standalone/chunk-NKJDGOM3.js +0 -1
  446. package/dist/standalone/chunk-O3NAGRTR.js +0 -1
  447. package/dist/standalone/chunk-OCHNCAXJ.js +0 -1
  448. package/dist/standalone/chunk-OIZ4CHPN.js +0 -8
  449. package/dist/standalone/chunk-OY3GVYS7.js +0 -4
  450. package/dist/standalone/chunk-PACH5AHG.js +0 -1
  451. package/dist/standalone/chunk-PN5NCZDX.js +0 -1
  452. package/dist/standalone/chunk-PVZI3CXP.js +0 -19
  453. package/dist/standalone/chunk-PZ7HD5T2.js +0 -1
  454. package/dist/standalone/chunk-Q52CHOSY.js +0 -1
  455. package/dist/standalone/chunk-QAFAJBAW.js +0 -1
  456. package/dist/standalone/chunk-QBAT52GB.js +0 -1
  457. package/dist/standalone/chunk-QLM6FYZW.js +0 -2
  458. package/dist/standalone/chunk-RRAFQ5G2.js +0 -1
  459. package/dist/standalone/chunk-RRCPZMC2.js +0 -22
  460. package/dist/standalone/chunk-RSEEHNFI.js +0 -1
  461. package/dist/standalone/chunk-SEU5V7I6.js +0 -1
  462. package/dist/standalone/chunk-SG3ALJJU.js +0 -1
  463. package/dist/standalone/chunk-SLKF2L74.js +0 -1
  464. package/dist/standalone/chunk-TAD43CG5.js +0 -1
  465. package/dist/standalone/chunk-TBMYIZIO.js +0 -1
  466. package/dist/standalone/chunk-TDL7NEWA.js +0 -1
  467. package/dist/standalone/chunk-TO4JQX7W.js +0 -1
  468. package/dist/standalone/chunk-TOJ3TC35.js +0 -1
  469. package/dist/standalone/chunk-TQ36RWOP.js +0 -1
  470. package/dist/standalone/chunk-U4OAQPBT.js +0 -1
  471. package/dist/standalone/chunk-UK64ZSUW.js +0 -1
  472. package/dist/standalone/chunk-VLXV72QE.js +0 -1
  473. package/dist/standalone/chunk-VTGBPW24.js +0 -1
  474. package/dist/standalone/chunk-WI7GWFEG.js +0 -1
  475. package/dist/standalone/chunk-WXPWVBIY.js +0 -1
  476. package/dist/standalone/chunk-X5P2WRYI.js +0 -1
  477. package/dist/standalone/chunk-X7MMBSNW.js +0 -1
  478. package/dist/standalone/chunk-XLQ4BHBD.js +0 -1
  479. package/dist/standalone/chunk-XNJNSCLM.js +0 -1
  480. package/dist/standalone/chunk-XUGSA2NG.js +0 -1
  481. package/dist/standalone/chunk-Y2ZPNDL7.js +0 -4
  482. package/dist/standalone/chunk-YAECF5LW.js +0 -1
  483. package/dist/standalone/chunk-YEVCU7TB.js +0 -13
  484. package/dist/standalone/chunk-ZHVTQ37P.js +0 -1
  485. package/dist/standalone/chunk-ZIGWVHCS.js +0 -1
  486. package/dist/standalone/chunk-ZPP2KOR4.js +0 -1
  487. package/dist/standalone/chunk-ZPUO7FNI.js +0 -1
  488. package/dist/standalone/chunk-ZU4DZ6NK.js +0 -1
  489. package/dist/standalone/chunk-ZYRGPDZB.js +0 -1
@@ -0,0 +1,4 @@
1
+ import{c as Ue}from"./chunk-P6VNMPWR.js";import{a as ke}from"./chunk-VHRWGZVT.js";import{e as _e}from"./chunk-CHJYRPLL.js";import"./chunk-SY7AVD6C.js";import"./chunk-QNJJIVLQ.js";import"./chunk-UBX5ZPLV.js";import"./chunk-VNH4OBJS.js";import{a as De}from"./chunk-G6IFVCSL.js";import"./chunk-KTK4NDWQ.js";import"./chunk-XLYFGUEF.js";import"./chunk-D65UVZIA.js";import"./chunk-NGVP66OH.js";import"./chunk-QAOZXPLU.js";import{a as Ee}from"./chunk-PRTIYJFL.js";import"./chunk-3D67ZJRW.js";import{a as $e}from"./chunk-G2BUKFAD.js";import"./chunk-ZSWW2UGP.js";import"./chunk-QRA7AKYO.js";import{i as Ke}from"./chunk-74WS3GUC.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as ee}from"./chunk-KSFVO6OB.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as ve}from"./chunk-MY7J2X2Y.js";import{b as ae}from"./chunk-BWT5ANXC.js";import"./chunk-YUVGMKHG.js";import{a as Le,b as Ie,c as Re,d as de,e as te,f as X}from"./chunk-AXKOMM2J.js";import{a as xe}from"./chunk-6A6AELDJ.js";import{a as Fe,e as Oe}from"./chunk-2BN5NW34.js";import{n as ze}from"./chunk-35IQT6SS.js";import"./chunk-ZPQBVYNN.js";import{B as Te,h as pe,i as be,j as le,o as ye,s as Z,v as je}from"./chunk-6DU2UW57.js";import"./chunk-PDBW6GTJ.js";import{a as yt}from"./chunk-GWNGVKLG.js";import{a as bt,b as xt}from"./chunk-6G3E4PJ2.js";import{a as h,d as ge}from"./chunk-5PEAXTYQ.js";var B=ge(yt(),1),z=ge(bt(),1);var o=ge(xt(),1);var Ae=h((d,e,t)=>{let{onCopy:r,onDelete:l,onDownload:n,onToggleSelect:c}=t,i=h(()=>{r(d.key)},"c"),s=h(()=>{n(d.key)},"o"),u=h(()=>{l(d.key)},"f"),m=h(()=>{c(d.key)},"h");return{copy:i,download:s,name:d.key.slice(e.length),remove:u,toggle:m}},"Re"),We=h(d=>{let e=(0,B.c)(31),{busy:t,buttonClassName:r,copied:l,objectKey:n,onCopy:c,onDelete:i,onDownload:s,t:u}=d,m=`storage-copy-${n}`,f;e[0]!==l||e[1]!==u?(f=u(l?"Copied":"Copy URL"),e[0]=l,e[1]=u,e[2]=f):f=e[2];let g;e[3]!==t||e[4]!==r||e[5]!==c||e[6]!==m||e[7]!==f?(g=(0,o.jsx)(ee,{className:r,"data-testid":m,disabled:t,onClick:c,size:"sm",type:"button",variant:"ghost",children:f}),e[3]=t,e[4]=r,e[5]=c,e[6]=m,e[7]=f,e[8]=g):g=e[8];let w=`storage-download-${n}`,a;e[9]!==u?(a=u("Download"),e[9]=u,e[10]=a):a=e[10];let k;e[11]!==t||e[12]!==r||e[13]!==s||e[14]!==w||e[15]!==a?(k=(0,o.jsx)(ee,{className:r,"data-testid":w,disabled:t,onClick:s,size:"sm",type:"button",variant:"ghost",children:a}),e[11]=t,e[12]=r,e[13]=s,e[14]=w,e[15]=a,e[16]=k):k=e[16];let S;e[17]!==u?(S=u("Delete object?"),e[17]=u,e[18]=S):S=e[18];let x=`storage-delete-${n}`,b;e[19]!==u?(b=u("Delete"),e[19]=u,e[20]=b):b=e[20];let y;e[21]!==t||e[22]!==i||e[23]!==S||e[24]!==x||e[25]!==b?(y=(0,o.jsx)($e,{confirmLabel:S,disabled:t,onConfirm:i,testId:x,children:b}),e[21]=t,e[22]=i,e[23]=S,e[24]=x,e[25]=b,e[26]=y):y=e[26];let v;return e[27]!==y||e[28]!==g||e[29]!==k?(v=(0,o.jsxs)(o.Fragment,{children:[g,k,y]}),e[27]=y,e[28]=g,e[29]=k,e[30]=v):v=e[30],v},"ze"),He=h(d=>{let e=(0,B.c)(14),{objectKey:t,references:r,t:l}=d;if(r===void 0)return null;if(r.length===0){let m=`storage-orphan-${t}`,f;e[0]!==l?(f=l("Orphan"),e[0]=l,e[1]=f):f=e[1];let g;return e[2]!==m||e[3]!==f?(g=(0,o.jsx)(ae,{"data-testid":m,variant:"warning",children:f}),e[2]=m,e[3]=f,e[4]=g):g=e[4],g}let n;e[5]!==r?(n=r.map(vt).join(`
2
+ `),e[5]=r,e[6]=n):n=e[6];let c=n,i=`storage-refs-${t}`,s;e[7]!==r.length||e[8]!==l?(s=r.length===1?l("1 record"):l("{count} records",{count:r.length}),e[7]=r.length,e[8]=l,e[9]=s):s=e[9];let u;return e[10]!==c||e[11]!==i||e[12]!==s?(u=(0,o.jsx)(ae,{"data-testid":i,title:c,variant:"secondary",children:s}),e[10]=c,e[11]=i,e[12]=s,e[13]=u):u=e[13],u},"De"),Ze=h(d=>{let e=(0,B.c)(7),{objectKey:t,onToggle:r,selected:l,t:n}=d,c;e[0]!==n?(c=n("Select row"),e[0]=n,e[1]=c):c=e[1];let i=`storage-select-${t}`,s;return e[2]!==r||e[3]!==l||e[4]!==c||e[5]!==i?(s=(0,o.jsx)(ke,{"aria-label":c,checked:l,"data-testid":i,onCheckedChange:r}),e[2]=r,e[3]=l,e[4]=c,e[5]=i,e[6]=s):s=e[6],s},"je");function vt(d){return`${d.table}\xB7${d.id}`}h(vt,"kt");var kt=h(d=>{let e=(0,B.c)(10),{colSpan:t,name:r,onEnter:l}=d,n;e[0]!==r||e[1]!==l?(n=h(()=>{l(r)},"l"),e[0]=r,e[1]=l,e[2]=n):n=e[2];let c=n,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,o.jsx)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,o.jsx)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"})}),e[3]=i):i=e[3];let s;e[4]!==c||e[5]!==r?(s=(0,o.jsxs)("button",{className:"inline-flex items-center gap-2 font-mono text-xs outline-none hover:text-foreground focus-visible:text-foreground","data-testid":"fb-folder",onClick:c,type:"button",children:[i,r]}),e[4]=c,e[5]=r,e[6]=s):s=e[6];let u;return e[7]!==t||e[8]!==s?(u=(0,o.jsx)(de,{children:(0,o.jsx)(X,{colSpan:t,children:s})}),e[7]=t,e[8]=s,e[9]=u):u=e[9],u},"St"),wt=h(d=>{let e=(0,B.c)(37),{busy:t,copiedKey:r,handlers:l,object:n,prefix:c,references:i,selected:s,showReferences:u,t:m}=d,f;e[0]!==l||e[1]!==n||e[2]!==c?(f=Ae(n,c,l),e[0]=l,e[1]=n,e[2]=c,e[3]=f):f=e[3];let{copy:g,download:w,name:a,remove:k,toggle:S}=f,x;e[4]!==n.key||e[5]!==s||e[6]!==m||e[7]!==S?(x=(0,o.jsx)(X,{className:"w-8",children:(0,o.jsx)(Ze,{objectKey:n.key,onToggle:S,selected:s,t:m})}),e[4]=n.key,e[5]=s,e[6]=m,e[7]=S,e[8]=x):x=e[8];let b;e[9]!==a?(b=(0,o.jsx)(X,{className:"font-mono text-xs",children:a}),e[9]=a,e[10]=b):b=e[10];let y;e[11]!==n.size?(y=ye(n.size),e[11]=n.size,e[12]=y):y=e[12];let v;e[13]!==y?(v=(0,o.jsx)(X,{className:"tabular-nums text-muted-foreground",children:y}),e[13]=y,e[14]=v):v=e[14];let j=n.httpMetadata?.contentType??"",N;e[15]!==j?(N=(0,o.jsx)(X,{children:j}),e[15]=j,e[16]=N):N=e[16];let C;e[17]!==n.key||e[18]!==i||e[19]!==u||e[20]!==m?(C=u&&(0,o.jsx)(X,{children:(0,o.jsx)(He,{objectKey:n.key,references:i,t:m})}),e[17]=n.key,e[18]=i,e[19]=u,e[20]=m,e[21]=C):C=e[21];let T=r===n.key,D;e[22]!==t||e[23]!==g||e[24]!==w||e[25]!==n.key||e[26]!==k||e[27]!==m||e[28]!==T?(D=(0,o.jsx)(X,{className:"text-right",children:(0,o.jsx)("span",{className:"inline-flex items-center gap-1",children:(0,o.jsx)(We,{busy:t,copied:T,objectKey:n.key,onCopy:g,onDelete:k,onDownload:w,t:m})})}),e[22]=t,e[23]=g,e[24]=w,e[25]=n.key,e[26]=k,e[27]=m,e[28]=T,e[29]=D):D=e[29];let F;return e[30]!==D||e[31]!==x||e[32]!==b||e[33]!==v||e[34]!==N||e[35]!==C?(F=(0,o.jsxs)(de,{"data-testid":"fb-row",children:[x,b,v,N,C,D]}),e[30]=D,e[31]=x,e[32]=b,e[33]=v,e[34]=N,e[35]=C,e[36]=F):F=e[36],F},"wt"),St=h(d=>{let e=(0,B.c)(65),{allSelected:t,busy:r,copiedKey:l,files:n,folders:c,handlers:i,onEnterFolder:s,prefix:u,references:m,selected:f,showReferences:g,someSelected:w,t:a,toggleSelectAll:k}=d,S;e[0]!==a?(S=a("Select all rows"),e[0]=a,e[1]=S):S=e[1];let x;e[2]!==t||e[3]!==w||e[4]!==S||e[5]!==k?(x=(0,o.jsx)(te,{className:"w-8",children:(0,o.jsx)(ke,{"aria-label":S,checked:t,"data-testid":"storage-select-all",indeterminate:w,onCheckedChange:k})}),e[2]=t,e[3]=w,e[4]=S,e[5]=k,e[6]=x):x=e[6];let b;e[7]!==a?(b=a("key"),e[7]=a,e[8]=b):b=e[8];let y;e[9]!==b?(y=(0,o.jsx)(te,{children:b}),e[9]=b,e[10]=y):y=e[10];let v;e[11]!==a?(v=a("size"),e[11]=a,e[12]=v):v=e[12];let j;e[13]!==v?(j=(0,o.jsx)(te,{children:v}),e[13]=v,e[14]=j):j=e[14];let N;e[15]!==a?(N=a("content-type"),e[15]=a,e[16]=N):N=e[16];let C;e[17]!==N?(C=(0,o.jsx)(te,{children:N}),e[17]=N,e[18]=C):C=e[18];let T;e[19]!==g||e[20]!==a?(T=g&&(0,o.jsx)(te,{children:a("used by")}),e[19]=g,e[20]=a,e[21]=T):T=e[21];let D;e[22]!==a?(D=a("Actions"),e[22]=a,e[23]=D):D=e[23];let F;e[24]!==D?(F=(0,o.jsx)(te,{"aria-label":D}),e[24]=D,e[25]=F):F=e[25];let $;e[26]!==F||e[27]!==x||e[28]!==y||e[29]!==j||e[30]!==C||e[31]!==T?($=(0,o.jsx)(Ie,{children:(0,o.jsxs)(de,{children:[x,y,j,C,T,F]})}),e[26]=F,e[27]=x,e[28]=y,e[29]=j,e[30]=C,e[31]=T,e[32]=$):$=e[32];let O;if(e[33]!==c||e[34]!==s||e[35]!==g){let E;e[37]!==s||e[38]!==g?(E=h(I=>(0,o.jsx)(kt,{colSpan:g?6:5,name:I,onEnter:s},I),"D"),e[37]=s,e[38]=g,e[39]=E):E=e[39],O=c.map(E),e[33]=c,e[34]=s,e[35]=g,e[36]=O}else O=e[36];let R;if(e[40]!==r||e[41]!==l||e[42]!==n||e[43]!==i||e[44]!==u||e[45]!==m||e[46]!==f||e[47]!==g||e[48]!==a){let E;e[50]!==r||e[51]!==l||e[52]!==i||e[53]!==u||e[54]!==m||e[55]!==f||e[56]!==g||e[57]!==a?(E=h(I=>(0,o.jsx)(wt,{busy:r,copiedKey:l,handlers:i,object:I,prefix:u,references:m[I.key],selected:f.has(I.key),showReferences:g,t:a},I.key),"D"),e[50]=r,e[51]=l,e[52]=i,e[53]=u,e[54]=m,e[55]=f,e[56]=g,e[57]=a,e[58]=E):E=e[58],R=n.map(E),e[40]=r,e[41]=l,e[42]=n,e[43]=i,e[44]=u,e[45]=m,e[46]=f,e[47]=g,e[48]=a,e[49]=R}else R=e[49];let L;e[59]!==O||e[60]!==R?(L=(0,o.jsxs)(Re,{children:[O,R]}),e[59]=O,e[60]=R,e[61]=L):L=e[61];let _;return e[62]!==$||e[63]!==L?(_=(0,o.jsx)(Fe,{className:"overflow-hidden py-0",children:(0,o.jsx)(Oe,{className:"px-0",children:(0,o.jsxs)(Le,{"data-testid":"fb-table",children:[$,L]})})}),e[62]=$,e[63]=L,e[64]=_):_=e[64],_},"Ct"),Nt=[{label:"15m",seconds:900},{label:"1h",seconds:3600},{label:"24h",seconds:86400},{label:"7d",seconds:604800}],Ct=3600,Me=h((d,e)=>{if(e==="size")return d.size;if(e==="type")return d.httpMetadata?.contentType??"";if(e==="date"){if(d.uploaded===void 0)return 0;let t=new Date(d.uploaded).getTime();return Number.isNaN(t)?0:t}return e.startsWith("tag:")?d.customMetadata?.[e.slice(4)]??"":d.key},"we"),jt=h((d,e,t)=>{let r=t==="desc"?-1:1;return d.toSorted((l,n)=>{let c=Me(l,e),i=Me(n,e);return(typeof c=="number"&&typeof i=="number"?c-i:String(c).localeCompare(String(i)))*r})},"Et"),zt=h((d,e)=>{let t=new Set,r=[];for(let l of d){let n=l.key.slice(e.length),c=n.indexOf("/");c===-1?r.push(l):t.add(n.slice(0,c+1))}return{files:r,folders:[...t].toSorted((l,n)=>l.localeCompare(n))}},"_t"),Dt=h(d=>{let e=(0,B.c)(59),{bucket:t,buckets:r,busy:l,draftPrefix:n,expiry:c,fileInputRef:i,onBucketChange:s,onExpiryChange:u,onFileChange:m,onList:f,onPrefixChange:g,onUploadClick:w,t:a}=d,k;e[0]!==g?(k=h(A=>{g(A.target.value)},"v"),e[0]=g,e[1]=k):k=e[1];let S=k,x;e[2]!==s?(x=h(A=>{s(A.target.value)},"y"),e[2]=s,e[3]=x):x=e[3];let b=x,y;e[4]!==u?(y=h(A=>{u(Number.parseInt(A.target.value,10))},"b"),e[4]=u,e[5]=y):y=e[5];let v=y,j;e[6]!==t||e[7]!==r||e[8]!==b||e[9]!==a?(j=r.length>0&&(0,o.jsx)("select",{"aria-label":a("Bucket"),className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-bucket",onChange:b,value:t,children:r.map($t)}),e[6]=t,e[7]=r,e[8]=b,e[9]=a,e[10]=j):j=e[10];let N;e[11]!==a?(N=a("Key prefix"),e[11]=a,e[12]=N):N=e[12];let C;e[13]!==a?(C=a("key prefix (optional)"),e[13]=a,e[14]=C):C=e[14];let T;e[15]!==n||e[16]!==S||e[17]!==N||e[18]!==C?(T=(0,o.jsx)(Ke,{"aria-label":N,className:"h-8 w-64 max-w-full","data-testid":"fb-prefix-input",onChange:S,placeholder:C,value:n}),e[15]=n,e[16]=S,e[17]=N,e[18]=C,e[19]=T):T=e[19];let D;e[20]!==a?(D=a("List"),e[20]=a,e[21]=D):D=e[21];let F;e[22]!==l||e[23]!==f||e[24]!==D?(F=(0,o.jsx)(ee,{"data-testid":"fb-list",disabled:l,onClick:f,size:"sm",type:"button",children:D}),e[22]=l,e[23]=f,e[24]=D,e[25]=F):F=e[25];let $;e[26]!==l||e[27]!==a?($=a(l?"Uploading\u2026":"Upload"),e[26]=l,e[27]=a,e[28]=$):$=e[28];let O;e[29]!==l||e[30]!==w||e[31]!==$?(O=(0,o.jsx)(ee,{"data-testid":"storage-upload",disabled:l,onClick:w,size:"sm",type:"button",variant:"outline",children:$}),e[29]=l,e[30]=w,e[31]=$,e[32]=O):O=e[32];let R;e[33]!==i||e[34]!==m?(R=(0,o.jsx)("input",{className:"hidden","data-testid":"storage-file-input",onChange:m,ref:i,type:"file"}),e[33]=i,e[34]=m,e[35]=R):R=e[35];let L;e[36]!==a?(L=a("Link expiry"),e[36]=a,e[37]=L):L=e[37];let _;e[38]!==a?(_=Nt.map(A=>(0,o.jsx)("option",{value:A.seconds,children:a(A.label)},A.seconds)),e[38]=a,e[39]=_):_=e[39];let E;e[40]!==c||e[41]!==v||e[42]!==_?(E=(0,o.jsx)("select",{className:"h-8 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":"storage-expiry",id:"storage-expiry",onChange:v,value:c,children:_}),e[40]=c,e[41]=v,e[42]=_,e[43]=E):E=e[43];let I;e[44]!==L||e[45]!==E?(I=(0,o.jsxs)("label",{className:"ml-auto flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"storage-expiry",children:[L,E]}),e[44]=L,e[45]=E,e[46]=I):I=e[46];let M;e[47]!==a?(M=a("Open in Cloudflare"),e[47]=a,e[48]=M):M=e[48];let P;e[49]!==M?(P=(0,o.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"fb-cf-link",href:Ue,rel:"noreferrer",target:"_blank",children:M}),e[49]=M,e[50]=P):P=e[50];let W;return e[51]!==O||e[52]!==R||e[53]!==I||e[54]!==P||e[55]!==j||e[56]!==T||e[57]!==F?(W=(0,o.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[j,T,F,O,R,I,P]}),e[51]=O,e[52]=R,e[53]=I,e[54]=P,e[55]=j,e[56]=T,e[57]=F,e[58]=W):W=e[58],W},"$t"),Tt=h(d=>{let e=(0,B.c)(66),{onSortKeyChange:t,onThumbSizeChange:r,showGrid:l,showList:n,sortDirection:c,sortKey:i,t:s,tagKeys:u,thumbSize:m,toggleSortDirection:f,view:g}=d,w;e[0]!==t?(w=h(q=>{t(q.target.value)},"k"),e[0]=t,e[1]=w):w=e[1];let a=w,k;e[2]!==r?(k=h(q=>{r(Number.parseInt(q.target.value,10))},"v"),e[2]=r,e[3]=k):k=e[3];let S=k,x=g==="list",b;e[4]!==s?(b=s("List"),e[4]=s,e[5]=b):b=e[5];let y;e[6]!==n||e[7]!==x||e[8]!==b?(y=(0,o.jsx)("button",{"aria-pressed":x,className:"px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-testid":"fb-view-list",onClick:n,type:"button",children:b}),e[6]=n,e[7]=x,e[8]=b,e[9]=y):y=e[9];let v=g==="grid",j;e[10]!==s?(j=s("Grid"),e[10]=s,e[11]=j):j=e[11];let N;e[12]!==l||e[13]!==v||e[14]!==j?(N=(0,o.jsx)("button",{"aria-pressed":v,className:"border-s border-border px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-testid":"fb-view-grid",onClick:l,type:"button",children:j}),e[12]=l,e[13]=v,e[14]=j,e[15]=N):N=e[15];let C;e[16]!==y||e[17]!==N?(C=(0,o.jsxs)("div",{className:"inline-flex overflow-hidden rounded-md border border-border",children:[y,N]}),e[16]=y,e[17]=N,e[18]=C):C=e[18];let T;e[19]!==s?(T=s("Sort"),e[19]=s,e[20]=T):T=e[20];let D;e[21]!==s?(D=s("Name"),e[21]=s,e[22]=D):D=e[22];let F;e[23]!==D?(F=(0,o.jsx)("option",{value:"name",children:D}),e[23]=D,e[24]=F):F=e[24];let $;e[25]!==s?($=s("size"),e[25]=s,e[26]=$):$=e[26];let O;e[27]!==$?(O=(0,o.jsx)("option",{value:"size",children:$}),e[27]=$,e[28]=O):O=e[28];let R;e[29]!==s?(R=s("Type"),e[29]=s,e[30]=R):R=e[30];let L;e[31]!==R?(L=(0,o.jsx)("option",{value:"type",children:R}),e[31]=R,e[32]=L):L=e[32];let _;e[33]!==s?(_=s("Modified"),e[33]=s,e[34]=_):_=e[34];let E;e[35]!==_?(E=(0,o.jsx)("option",{value:"date",children:_}),e[35]=_,e[36]=E):E=e[36];let I;e[37]!==u?(I=u.map(Kt),e[37]=u,e[38]=I):I=e[38];let M;e[39]!==a||e[40]!==i||e[41]!==F||e[42]!==O||e[43]!==L||e[44]!==E||e[45]!==I?(M=(0,o.jsxs)("select",{className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-sort",id:"fb-sort",onChange:a,value:i,children:[F,O,L,E,I]}),e[39]=a,e[40]=i,e[41]=F,e[42]=O,e[43]=L,e[44]=E,e[45]=I,e[46]=M):M=e[46];let P;e[47]!==T||e[48]!==M?(P=(0,o.jsxs)("label",{className:"flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-sort",children:[T,M]}),e[47]=T,e[48]=M,e[49]=P):P=e[49];let W;e[50]!==s?(W=s("Toggle sort direction"),e[50]=s,e[51]=W):W=e[51];let A=c==="asc"?"\u2191":"\u2193",H;e[52]!==W||e[53]!==A||e[54]!==f?(H=(0,o.jsx)("button",{"aria-label":W,className:"flex size-8 items-center justify-center rounded-md border border-border tabular-nums outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"fb-sort-dir",onClick:f,type:"button",children:A}),e[52]=W,e[53]=A,e[54]=f,e[55]=H):H=e[55];let V;e[56]!==S||e[57]!==s||e[58]!==m||e[59]!==g?(V=g==="grid"&&(0,o.jsxs)("label",{className:"ml-auto flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-thumb-size",children:[s("Thumbnail size"),(0,o.jsx)("input",{className:"accent-primary","data-testid":"fb-thumb-size",id:"fb-thumb-size",max:240,min:80,onChange:S,step:8,type:"range",value:m})]}),e[56]=S,e[57]=s,e[58]=m,e[59]=g,e[60]=V):V=e[60];let re;return e[61]!==P||e[62]!==H||e[63]!==V||e[64]!==C?(re=(0,o.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs","data-testid":"fb-controls",children:[C,P,H,V]}),e[61]=P,e[62]=H,e[63]=V,e[64]=C,e[65]=re):re=e[65],re},"Ft");function $t(d){return(0,o.jsx)("option",{value:d,children:d},d)}h($t,"Rt");function Kt(d){return(0,o.jsx)("option",{value:`tag:${d}`,children:d},d)}h(Kt,"zt");var Ft=/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu,Ot=h(d=>(d.httpMetadata?.contentType??"").startsWith("image/")||Ft.test(d.key),"jt"),Et=h(()=>{let d=(0,B.c)(1),e;return d[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,o.jsx)("svg",{"aria-hidden":"true",className:"size-8 text-muted-foreground/60",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.4,viewBox:"0 0 24 24",children:(0,o.jsx)("path",{d:"M7 3h7l5 5v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm7 0v5h5"})}),d[0]=e):e=d[0],e},"Kt"),Lt=h(d=>{let e=(0,B.c)(13),{object:t,resolveUrl:r}=d,[l,n]=(0,z.useState)(null),[c,i]=(0,z.useState)(!1),s;e[0]!==t?(s=Ot(t),e[0]=t,e[1]=s):s=e[1];let u=s,m,f;e[2]!==u||e[3]!==t.key||e[4]!==r?(m=h(()=>{if(!u)return;let k={cancelled:!1};return Z((async()=>{try{let S=await r(t.key);k.cancelled||n(S)}catch{k.cancelled||i(!0)}})()),()=>{k.cancelled=!0}},"h"),f=[u,t.key,r],e[2]=u,e[3]=t.key,e[4]=r,e[5]=m,e[6]=f):(m=e[5],f=e[6]),(0,z.useEffect)(m,f);let g;e[7]===Symbol.for("react.memo_cache_sentinel")?(g=h(()=>{i(!0)},"m"),e[7]=g):g=e[7];let w=g,a;return e[8]!==c||e[9]!==u||e[10]!==t.key||e[11]!==l?(a=(0,o.jsx)("div",{className:"flex aspect-square w-full items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",children:u&&l!==null&&!c?(0,o.jsx)("img",{alt:t.key,className:"size-full object-cover",loading:"lazy",onError:w,src:l}):(0,o.jsx)(Et,{})}),e[8]=c,e[9]=u,e[10]=t.key,e[11]=l,e[12]=a):a=e[12],a},"Bt"),It=h(d=>{let e=(0,B.c)(42),{busy:t,copiedKey:r,handlers:l,object:n,prefix:c,references:i,resolveUrl:s,selected:u,showReferences:m,t:f}=d,g;e[0]!==l||e[1]!==n||e[2]!==c?(g=Ae(n,c,l),e[0]=l,e[1]=n,e[2]=c,e[3]=g):g=e[3];let{copy:w,download:a,name:k,remove:S,toggle:x}=g,b;e[4]!==n||e[5]!==s?(b=(0,o.jsx)(Lt,{object:n,resolveUrl:s}),e[4]=n,e[5]=s,e[6]=b):b=e[6];let y;e[7]!==n.key||e[8]!==u||e[9]!==f||e[10]!==x?(y=(0,o.jsx)("span",{className:"absolute left-1.5 top-1.5 rounded bg-background/80 p-0.5",children:(0,o.jsx)(Ze,{objectKey:n.key,onToggle:x,selected:u,t:f})}),e[7]=n.key,e[8]=u,e[9]=f,e[10]=x,e[11]=y):y=e[11];let v;e[12]!==b||e[13]!==y?(v=(0,o.jsxs)("div",{className:"relative",children:[b,y]}),e[12]=b,e[13]=y,e[14]=v):v=e[14];let j;e[15]!==k?(j=(0,o.jsx)("p",{className:"truncate font-mono text-xs",title:k,children:k}),e[15]=k,e[16]=j):j=e[16];let N;e[17]!==n.size?(N=ye(n.size),e[17]=n.size,e[18]=N):N=e[18];let C;e[19]!==N?(C=(0,o.jsx)("p",{className:"text-[11px] tabular-nums text-muted-foreground",children:N}),e[19]=N,e[20]=C):C=e[20];let T;e[21]!==n.key||e[22]!==i||e[23]!==m||e[24]!==f?(T=m&&(0,o.jsx)("div",{className:"mt-1",children:(0,o.jsx)(He,{objectKey:n.key,references:i,t:f})}),e[21]=n.key,e[22]=i,e[23]=m,e[24]=f,e[25]=T):T=e[25];let D;e[26]!==j||e[27]!==C||e[28]!==T?(D=(0,o.jsxs)("div",{className:"min-w-0",children:[j,C,T]}),e[26]=j,e[27]=C,e[28]=T,e[29]=D):D=e[29];let F=r===n.key,$;e[30]!==t||e[31]!==w||e[32]!==a||e[33]!==n.key||e[34]!==S||e[35]!==f||e[36]!==F?($=(0,o.jsx)("div",{className:"flex items-center gap-1",children:(0,o.jsx)(We,{busy:t,buttonClassName:"h-7 px-2 text-xs",copied:F,objectKey:n.key,onCopy:w,onDelete:S,onDownload:a,t:f})}),e[30]=t,e[31]=w,e[32]=a,e[33]=n.key,e[34]=S,e[35]=f,e[36]=F,e[37]=$):$=e[37];let O;return e[38]!==$||e[39]!==v||e[40]!==D?(O=(0,o.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"fb-tile",children:[v,D,$]}),e[38]=$,e[39]=v,e[40]=D,e[41]=O):O=e[41],O},"Lt"),Rt=h(d=>{let e=(0,B.c)(9),{name:t,onEnter:r}=d,l;e[0]!==t||e[1]!==r?(l=h(()=>{r(t)},"n"),e[0]=t,e[1]=r,e[2]=l):l=e[2];let n=l,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=(0,o.jsx)("span",{className:"flex aspect-square w-full items-center justify-center rounded-md border border-border bg-muted/30 transition-colors hover:bg-accent",children:(0,o.jsx)("svg",{"aria-hidden":"true",className:"size-10 text-muted-foreground",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.4,viewBox:"0 0 24 24",children:(0,o.jsx)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"})})}),e[3]=c):c=e[3];let i;e[4]!==t?(i=(0,o.jsx)("span",{className:"truncate font-mono text-xs",title:t,children:t}),e[4]=t,e[5]=i):i=e[5];let s;return e[6]!==n||e[7]!==i?(s=(0,o.jsxs)("button",{className:"flex flex-col gap-1.5 text-left outline-none","data-testid":"fb-folder",onClick:n,type:"button",children:[c,i]}),e[6]=n,e[7]=i,e[8]=s):s=e[8],s},"It"),_t=h(d=>{let e=(0,B.c)(34),{busy:t,copiedKey:r,files:l,folders:n,handlers:c,onEnterFolder:i,prefix:s,references:u,resolveUrl:m,selected:f,showReferences:g,size:w,t:a}=d,k;e[0]!==w?(k=w.toString(),e[0]=w,e[1]=k):k=e[1];let S=`repeat(auto-fill, minmax(${k}px, 1fr))`,x;e[2]!==S?(x={gridTemplateColumns:S},e[2]=S,e[3]=x):x=e[3];let b=x,y;if(e[4]!==n||e[5]!==i){let N;e[7]!==i?(N=h(C=>(0,o.jsx)(Rt,{name:C,onEnter:i},C),"w"),e[7]=i,e[8]=N):N=e[8],y=n.map(N),e[4]=n,e[5]=i,e[6]=y}else y=e[6];let v;if(e[9]!==t||e[10]!==r||e[11]!==l||e[12]!==c||e[13]!==s||e[14]!==u||e[15]!==m||e[16]!==f||e[17]!==g||e[18]!==a){let N;e[20]!==t||e[21]!==r||e[22]!==c||e[23]!==s||e[24]!==u||e[25]!==m||e[26]!==f||e[27]!==g||e[28]!==a?(N=h(C=>(0,o.jsx)(It,{busy:t,copiedKey:r,handlers:c,object:C,prefix:s,references:u[C.key],resolveUrl:m,selected:f.has(C.key),showReferences:g,t:a},C.key),"w"),e[20]=t,e[21]=r,e[22]=c,e[23]=s,e[24]=u,e[25]=m,e[26]=f,e[27]=g,e[28]=a,e[29]=N):N=e[29],v=l.map(N),e[9]=t,e[10]=r,e[11]=l,e[12]=c,e[13]=s,e[14]=u,e[15]=m,e[16]=f,e[17]=g,e[18]=a,e[19]=v}else v=e[19];let j;return e[30]!==b||e[31]!==y||e[32]!==v?(j=(0,o.jsxs)("div",{className:"grid gap-4","data-testid":"fb-gallery",style:b,children:[y,v]}),e[30]=b,e[31]=y,e[32]=v,e[33]=j):j=e[33],j},"Ot"),Ut=h(d=>{let e=(0,B.c)(23),{reference:t,t:r}=d,l=`fb-dangling-${t.table}-${t.id}-${t.column}`,n=`${t.table}\xB7${t.id}`,c;e[0]!==n?(c=(0,o.jsx)(ae,{variant:"secondary",children:n}),e[0]=n,e[1]=c):c=e[1];let i;e[2]!==t.column?(i=(0,o.jsx)("span",{className:"text-muted-foreground",children:t.column}),e[2]=t.column,e[3]=i):i=e[3];let s;e[4]!==r?(s=r("\u2192"),e[4]=r,e[5]=s):s=e[5];let u;e[6]!==s?(u=(0,o.jsx)("span",{className:"text-muted-foreground/60",children:s}),e[6]=s,e[7]=u):u=e[7];let m;e[8]!==t.key?(m=(0,o.jsx)("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-foreground",children:t.key}),e[8]=t.key,e[9]=m):m=e[9];let f;e[10]!==c||e[11]!==i||e[12]!==u||e[13]!==m?(f=(0,o.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[c,i,u,m]}),e[10]=c,e[11]=i,e[12]=u,e[13]=m,e[14]=f):f=e[14];let g;e[15]!==r?(g=r("Missing object"),e[15]=r,e[16]=g):g=e[16];let w;e[17]!==g?(w=(0,o.jsx)(ae,{className:"border-destructive/40 text-destructive",variant:"outline",children:g}),e[17]=g,e[18]=w):w=e[18];let a;return e[19]!==l||e[20]!==w||e[21]!==f?(a=(0,o.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 rounded-md border border-border/60 px-3 py-2 text-xs","data-testid":l,children:[f,w]}),e[19]=l,e[20]=w,e[21]=f,e[22]=a):a=e[22],a},"At"),Mt=h(d=>{let e=(0,B.c)(42),{busy:t,onCheck:r,references:l,t:n,truncated:c}=d,i;e[0]!==n?(i=n("Integrity"),e[0]=n,e[1]=i):i=e[1];let s;e[2]!==i?(s=(0,o.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:i}),e[2]=i,e[3]=s):s=e[3];let u;e[4]!==n?(u=n("Orphaned objects"),e[4]=n,e[5]=u):u=e[5];let m;e[6]!==u?(m=(0,o.jsx)("span",{className:"text-sm font-medium text-foreground",children:u}),e[6]=u,e[7]=m):m=e[7];let f;e[8]!==n?(f=n("Find records whose file reference points at an object the bucket no longer has."),e[8]=n,e[9]=f):f=e[9];let g;e[10]!==f?(g=(0,o.jsx)("span",{className:"text-xs text-muted-foreground",children:f}),e[10]=f,e[11]=g):g=e[11];let w;e[12]!==s||e[13]!==m||e[14]!==g?(w=(0,o.jsxs)("div",{className:"flex flex-col gap-1",children:[s,m,g]}),e[12]=s,e[13]=m,e[14]=g,e[15]=w):w=e[15];let a;e[16]!==t||e[17]!==n?(a=n(t?"Checking\u2026":"Check for orphans"),e[16]=t,e[17]=n,e[18]=a):a=e[18];let k;e[19]!==t||e[20]!==r||e[21]!==a?(k=(0,o.jsx)(ee,{"data-testid":"fb-orphans-check",disabled:t,onClick:r,size:"sm",type:"button",variant:"outline",children:a}),e[19]=t,e[20]=r,e[21]=a,e[22]=k):k=e[22];let S;e[23]!==w||e[24]!==k?(S=(0,o.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[w,k]}),e[23]=w,e[24]=k,e[25]=S):S=e[25];let x;e[26]!==l||e[27]!==n||e[28]!==c?(x=c&&(0,o.jsx)("p",{className:"text-xs text-warning","data-testid":"fb-orphans-truncated",children:l===void 0||l.length===0?n("The bucket is larger than the scan's key limit, so dangling references could not be checked."):n("Showing the first {count} dangling references \u2014 the scan was truncated.",{count:l.length})}),e[26]=l,e[27]=n,e[28]=c,e[29]=x):x=e[29];let b;e[30]!==l?.length||e[31]!==n||e[32]!==c?(b=l?.length===0&&!c&&(0,o.jsx)(ve,{description:n("Every record's file reference points at an object that exists in the bucket."),testId:"fb-orphans-empty",title:n("No dangling references.")}),e[30]=l?.length,e[31]=n,e[32]=c,e[33]=b):b=e[33];let y;e[34]!==l||e[35]!==n?(y=l!==void 0&&l.length>0&&(0,o.jsx)("ul",{className:"flex flex-col gap-1.5","data-testid":"fb-orphans-list",children:l.map(j=>(0,o.jsx)(Ut,{reference:j,t:n},`${j.table}\xB7${j.id}\xB7${j.column}`))}),e[34]=l,e[35]=n,e[36]=y):y=e[36];let v;return e[37]!==S||e[38]!==x||e[39]!==b||e[40]!==y?(v=(0,o.jsxs)("section",{className:"flex flex-col gap-2 rounded-lg border border-border/60 p-3","data-testid":"fb-orphans",children:[S,x,b,y]}),e[37]=S,e[38]=x,e[39]=b,e[40]=y,e[41]=v):v=e[41],v},"Ut"),Bt=h(function(d,e){let t=(0,B.c)(18),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=new Set,t[0]=r):r=t[0];let[l,n]=(0,z.useState)(r),c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=h(x=>{n(b=>{let y=new Set(b);return y.has(x)?y.delete(x):y.add(x),y})},"a"),t[1]=c):c=t[1];let i=c,s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=h(()=>{n(new Set)},"o"),t[2]=s):s=t[2];let u=s,m,f,g;if(t[3]!==d||t[4]!==e||t[5]!==l){let x;t[9]!==e?(x=h(b=>e(b),"y"),t[9]=e,t[10]=x):x=t[10],f=d.map(x),m=f.length>0&&f.every(b=>l.has(b)),g=!m&&f.some(b=>l.has(b)),t[3]=d,t[4]=e,t[5]=l,t[6]=m,t[7]=f,t[8]=g}else m=t[6],f=t[7],g=t[8];let w=g,a;t[11]!==f?(a=h(()=>{n(x=>f.every(b=>x.has(b))?new Set:new Set(f))},"i"),t[11]=f,t[12]=a):a=t[12];let k=a,S;return t[13]!==m||t[14]!==l||t[15]!==w||t[16]!==k?(S={allSelected:m,clear:u,selected:l,someSelected:w,toggle:i,toggleAll:k},t[13]=m,t[14]=l,t[15]=w,t[16]=k,t[17]=S):S=t[17],S},"Mt"),Pt=pe(xe.storageReferences),At=pe(xe.storageOrphans),Be=1e4,Wt=1e3,Ht=h(async d=>{let e=[],t,r=!0,l=!1;for(;r&&e.length<Be;){let n=await d.list({cursor:t,limit:Wt}),c=Be-e.length;for(let i of n.objects.slice(0,c))e.push(i.key);l||=n.objects.length>c,t=n.cursor,r=t!==void 0}return{liveKeys:e,truncated:l||r}},"qt"),Zt=3600,qt=h((d,e)=>{if(!("document"in globalThis))return;let t=globalThis.document.createElement("a");t.href=d,t.download=e,t.rel="noopener",globalThis.document.body.append(t),t.click(),t.remove()},"Vt"),Gt=h(d=>d.key,"Zt"),Vt=h(({initialPrefix:d,pageSize:e})=>{let t=ze(),[r,l]=(0,z.useState)(d??""),[n,c]=(0,z.useState)(d??""),[i,s]=(0,z.useState)(Ct),[u,m]=(0,z.useState)("list"),[f,g]=(0,z.useState)(128),[w,a]=(0,z.useState)("name"),[k,S]=(0,z.useState)("asc"),[x,b]=(0,z.useState)(void 0),[y,v]=(0,z.useState)(void 0),[j,N]=(0,z.useState)(!1),[C,T]=(0,z.useState)(void 0),[D,F]=(0,z.useState)(void 0),[$,O]=(0,z.useState)(""),[R,L]=(0,z.useState)({}),[_,E]=(0,z.useState)(!1),[I,M]=(0,z.useState)(void 0),[P,W]=(0,z.useState)(!1),[A,H]=(0,z.useState)(!1),[V,re]=(0,z.useState)([]),[q,we]=(0,z.useState)(""),ne=(0,z.useRef)(0),Q=(0,z.useRef)(0),ce=(0,z.useRef)(0);(0,z.useEffect)(()=>{let p={cancelled:!1};return Z((async()=>{try{let K=await t.listStorageBuckets();if(!p.cancelled){re(K);let[U]=K;U!==void 0&&we(J=>J===""?U:J)}}catch{}})()),()=>{p.cancelled=!0}},[t]);let G=(0,z.useMemo)(()=>({list:h(p=>t.listStorageObjects({...p,bucket:q}),"list"),remove:h(p=>t.deleteStorageObject(p,{bucket:q}),"remove"),signedUrl:h((p,K)=>t.signedStorageUrl(p,{...K,bucket:q}),"signedUrl"),upload:h(p=>t.uploadStorageObject({...p,bucket:q}),"upload")}),[q,t]),Y=(0,z.useCallback)(async(p,K,U,J=!1)=>{ne.current+=1;let me=ne.current;v(void 0),N(!0);try{let oe=await G.list({cursor:K,limit:e,prefix:p});if(me!==ne.current)return;b(Ce=>U&&Ce!==void 0?[...Ce,...oe.objects]:oe.objects),F(oe.cursor)}catch(oe){if(me!==ne.current)return;if(U||b(void 0),v(le(oe)),J)throw oe}finally{me===ne.current&&N(!1)}},[e,G]);(0,z.useEffect)(()=>{Z(Y(d??"",void 0,!1))},[Y,d]);let qe=(x?.length??0)<=e;De(()=>Y(r,void 0,!1,!0),qe);let{files:ue,folders:Ge}=zt(x??[],r),Ve=(0,z.useMemo)(()=>{let p=new Set;for(let K of ue)for(let U of Object.keys(K.customMetadata??{}))p.add(U);return[...p].toSorted((K,U)=>K.localeCompare(U))},[ue]),ie=jt(ue,w,k),fe=(0,z.useMemo)(()=>[...new Set(ie.map(p=>p.key))].toSorted((p,K)=>p.localeCompare(K)).join(`
3
+ `),[ie]);(0,z.useEffect)(()=>{let p=fe===""?[]:fe.split(`
4
+ `);if(p.length===0){L({});return}let K={current:!0};return Z((async()=>{try{let U=await t.query(Pt,{keys:p},be($));K.current&&(L(U.references??{}),E(Object.keys(U.storageColumns??{}).length>0))}catch{K.current&&(L({}),E(!1))}})()),()=>{K.current=!1}},[t,fe,$]);let{allSelected:Qe,clear:se,selected:Se,someSelected:Xe,toggle:Ye,toggleAll:Je}=Bt(ie,Gt),et=h(()=>{l(n),se(),Z(Y(n,void 0,!1))},"Me"),tt=h(()=>{Z(Y(r,D,!0))},"Ge"),Ne=h(p=>{l(p),c(p),se(),Z(Y(p,void 0,!1))},"ve"),rt=h(p=>{Ne(`${r}${p}`)},"He"),nt=h(p=>G.signedUrl(p,{expiresInSeconds:Zt}),"Pe"),ot=h(()=>{m("list")},"qe"),lt=h(()=>{m("grid")},"We"),st=h(p=>{a(p)},"Ve"),at=h(()=>{S(p=>p==="asc"?"desc":"asc")},"Ze"),ct=h(p=>{g(p)},"Xe"),it=h(p=>{s(p)},"Ye"),he=h(p=>{let K=ce.current;v(void 0),N(!0),Z((async()=>{try{await p(),K===ce.current&&await Y(r,void 0,!1)}catch(U){v(le(U))}K===ce.current&&N(!1)})())},"me"),dt=h(()=>{he(async()=>{for(let p of Se)await G.remove(p);se()})},"Je"),ut=h(p=>{v(void 0),Z((async()=>{try{let K=await G.signedUrl(p,{expiresInSeconds:i});je(K)&&T(p)}catch(K){v(le(K))}})())},"Qe"),ft=h(p=>{v(void 0),Z((async()=>{try{let K=await G.signedUrl(p,{expiresInSeconds:i}),U=p.slice(p.lastIndexOf("/")+1)||p;qt(K,U)}catch(K){v(le(K))}})())},"et");(0,z.useEffect)(()=>{if(C===void 0)return;let p=globalThis.setTimeout(()=>{T(void 0)},2e3);return()=>{globalThis.clearTimeout(p)}},[C]);let ht=h(p=>{he(async()=>{await G.remove(p)})},"tt"),mt=h(p=>{let K=`${r}${p.name}`;he(async()=>{let U=await p.arrayBuffer();await G.upload({body:U,contentType:p.type===""?void 0:p.type,key:K})})},"st");(0,z.useEffect)(()=>{Q.current+=1,M(void 0),H(!1)},[$]);let gt=h(()=>{Q.current+=1;let p=Q.current;v(void 0),W(!0),Z((async()=>{try{let{liveKeys:K,truncated:U}=await Ht(G);if(U)p===Q.current&&(M(void 0),H(!0));else{let J=await t.query(At,{liveKeys:K},be($));p===Q.current&&(M(J.references??[]),H(J.truncated===!0))}}catch(K){p===Q.current&&(M(void 0),H(!1),v(le(K)))}p===Q.current&&W(!1)})())},"lt"),pt=h(p=>{ne.current+=1,Q.current+=1,ce.current+=1,we(p),l(d??""),c(d??""),b(void 0),M(void 0),H(!1),se()},"nt");return{allSelected:Qe,bucket:q,buckets:V,bulkDelete:dt,busy:j,checkOrphans:gt,clearSelection:se,copiedKey:C,danglingBusy:P,danglingReferences:I,danglingTruncated:A,draftPrefix:n,enterFolder:rt,error:y,expiry:i,files:ie,folders:Ge,hasObjects:x!==void 0&&x.length>0,hasStorageColumns:_,listFirst:et,loaded:x!==void 0,loadMore:tt,navigate:Ne,nextCursor:D,onCopy:ut,onDelete:ht,onDownload:ft,onExpiryChange:it,onFile:mt,onSortKeyChange:st,onThumbSizeChange:ct,prefix:r,referenceShard:$,references:R,resolveUrl:nt,selectBucket:pt,selected:Se,setDraftPrefix:c,setReferenceShard:O,showGrid:lt,showList:ot,someSelected:Xe,sortDirection:k,sortKey:w,tagKeys:Ve,thumbSize:f,toggleSelect:Ye,toggleSelectAll:Je,toggleSortDirection:at,view:u}},"Xt"),Qt=100,Pe=h(d=>{let e=(0,B.c)(6),{label:t,onNavigate:r,target:l}=d,n;e[0]!==r||e[1]!==l?(n=h(()=>{r(l)},"l"),e[0]=r,e[1]=l,e[2]=n):n=e[2];let c=n,i;return e[3]!==c||e[4]!==t?(i=(0,o.jsx)("button",{className:"rounded px-1 text-muted-foreground outline-none hover:text-foreground focus-visible:text-foreground",onClick:c,type:"button",children:t}),e[3]=c,e[4]=t,e[5]=i):i=e[5],i},"Ne"),Xt=h(d=>{let e=(0,B.c)(11),{onNavigate:t,prefix:r,t:l}=d,n;if(e[0]!==t||e[1]!==r||e[2]!==l){let c=r.split("/").filter(Yt),i;e[4]!==l?(i=l("Folder path"),e[4]=l,e[5]=i):i=e[5];let s;e[6]!==l?(s=l("root"),e[6]=l,e[7]=s):s=e[7];let u;e[8]!==t||e[9]!==s?(u=(0,o.jsx)(Pe,{label:s,onNavigate:t,target:""}),e[8]=t,e[9]=s,e[10]=u):u=e[10],n=(0,o.jsxs)("nav",{"aria-label":i,className:"flex flex-wrap items-center gap-0.5 text-xs","data-testid":"fb-breadcrumbs",children:[u,c.map((m,f)=>(0,o.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,o.jsx)("span",{className:"text-muted-foreground/50",children:"/"}),(0,o.jsx)(Pe,{label:m,onNavigate:t,target:`${c.slice(0,f+1).join("/")}/`})]},`${m}-${f.toString()}`))]}),e[0]=t,e[1]=r,e[2]=l,e[3]=n}else n=e[3];return n},"Jt"),gr=h(({initialPrefix:d,pageSize:e=Qt})=>{let t=Te(),r=Vt({initialPrefix:d,pageSize:e}),l=(0,z.useRef)(null),{onCopy:n,onDelete:c,onDownload:i,onFile:s,toggleSelect:u}=r,m={onCopy:n,onDelete:c,onDownload:i,onToggleSelect:u},f=h(()=>{l.current?.click()},"u"),g=h(a=>{let k=a.target,S=k.files?.[0];k.value="",S&&s(S)},"m"),w=r.loaded&&!r.hasObjects;return(0,o.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-file-browser",children:[(0,o.jsx)(Dt,{bucket:r.bucket,buckets:r.buckets,busy:r.busy,draftPrefix:r.draftPrefix,expiry:r.expiry,fileInputRef:l,onBucketChange:r.selectBucket,onExpiryChange:r.onExpiryChange,onFileChange:g,onList:r.listFirst,onPrefixChange:r.setDraftPrefix,onUploadClick:f,t}),r.loaded&&(0,o.jsx)(Xt,{onNavigate:r.navigate,prefix:r.prefix,t}),r.hasObjects&&(0,o.jsx)(Tt,{onSortKeyChange:r.onSortKeyChange,onThumbSizeChange:r.onThumbSizeChange,showGrid:r.showGrid,showList:r.showList,sortDirection:r.sortDirection,sortKey:r.sortKey,t,tagKeys:r.tagKeys,thumbSize:r.thumbSize,toggleSortDirection:r.toggleSortDirection,view:r.view}),r.hasStorageColumns&&(0,o.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"fb-references-shard",children:[(0,o.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"fb-reference-shard-input",children:t("References shard")}),(0,o.jsx)(Ee,{id:"fb-reference-shard-input",onChange:r.setReferenceShard,testId:"fb-reference-shard-input",value:r.referenceShard}),(0,o.jsx)("span",{className:"text-xs text-muted-foreground",children:t("Which shard's records are checked for references to these files. Empty = root shard.")})]}),r.hasStorageColumns&&(0,o.jsx)(Mt,{busy:r.danglingBusy,onCheck:r.checkOrphans,references:r.danglingReferences,t,truncated:r.danglingTruncated}),r.selected.size>0&&(0,o.jsx)(_e,{count:r.selected.size,editable:!0,onClear:r.clearSelection,onDelete:r.bulkDelete}),r.error!==void 0&&(0,o.jsx)("p",{className:"text-sm text-destructive","data-testid":"storage-error",role:"alert",children:r.error}),w&&(0,o.jsx)(ve,{description:t("Objects you upload to your R2 buckets will appear here."),icon:(0,o.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,o.jsx)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"}),(0,o.jsx)("path",{d:"M12 11v5m-2.5-2.5h5"})]}),testId:"fb-empty",title:t("No objects.")}),r.hasObjects&&r.view==="list"&&(0,o.jsx)(St,{allSelected:r.allSelected,busy:r.busy,copiedKey:r.copiedKey,files:r.files,folders:r.folders,handlers:m,onEnterFolder:r.enterFolder,prefix:r.prefix,references:r.references,selected:r.selected,showReferences:r.hasStorageColumns,someSelected:r.someSelected,t,toggleSelectAll:r.toggleSelectAll}),r.hasObjects&&r.view==="grid"&&(0,o.jsx)(_t,{busy:r.busy,copiedKey:r.copiedKey,files:r.files,folders:r.folders,handlers:m,onEnterFolder:r.enterFolder,prefix:r.prefix,references:r.references,resolveUrl:r.resolveUrl,selected:r.selected,showReferences:r.hasStorageColumns,size:r.thumbSize,t}),r.nextCursor!==void 0&&(0,o.jsx)("div",{children:(0,o.jsx)(ee,{"data-testid":"fb-next",disabled:r.busy,onClick:r.loadMore,size:"sm",type:"button",variant:"outline",children:t("Load more")})})]})},"xs");function Yt(d){return d!==""}h(Yt,"Qt");export{gr as FileBrowser};
@@ -0,0 +1 @@
1
+ "use client";import{e}from"./chunk-TW4O2BA5.js";import"./chunk-4EPW63HS.js";import"./chunk-PDBW6GTJ.js";import"./chunk-6G3E4PJ2.js";import"./chunk-5PEAXTYQ.js";export{e as Mermaid};
@@ -0,0 +1 @@
1
+ import{x as i}from"./chunk-6DU2UW57.js";import{a as d}from"./chunk-GWNGVKLG.js";import{b as p}from"./chunk-6G3E4PJ2.js";import{a as l,d as m}from"./chunk-5PEAXTYQ.js";var n=m(d(),1);var c=m(p(),1);function f(r){let t=(0,n.c)(8),e,s;t[0]!==r?({className:e,...s}=r,t[0]=r,t[1]=e,t[2]=s):(e=t[1],s=t[2]);let a;t[3]!==e?(a=i("animate-pulse rounded-md bg-muted",e),t[3]=e,t[4]=a):a=t[4];let o;return t[5]!==s||t[6]!==a?(o=(0,c.jsx)("div",{"data-slot":"skeleton",className:a,...s}),t[5]=s,t[6]=a,t[7]=o):o=t[7],o}l(f,"p");export{f as a};
@@ -0,0 +1 @@
1
+ import{a as je}from"./chunk-Z4VISCXI.js";import{a as Be,b as Ue,c as We,d as De,e as we}from"./chunk-64WVI7AU.js";import"./chunk-O3AZ7JKE.js";import{a as qe}from"./chunk-3HR74V73.js";import"./chunk-VNH4OBJS.js";import"./chunk-XLYFGUEF.js";import"./chunk-D65UVZIA.js";import"./chunk-NGVP66OH.js";import"./chunk-QAOZXPLU.js";import{a as ze}from"./chunk-J45HAKBU.js";import{a as _e}from"./chunk-PRTIYJFL.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import"./chunk-QRA7AKYO.js";import{i as Ae}from"./chunk-74WS3GUC.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as le}from"./chunk-KSFVO6OB.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as Ee}from"./chunk-MY7J2X2Y.js";import{b as me}from"./chunk-BWT5ANXC.js";import"./chunk-YUVGMKHG.js";import{a as Le,b as Re,c as Ve,d as pe,e as B,f as L}from"./chunk-AXKOMM2J.js";import"./chunk-4PI2OSSP.js";import{a as U}from"./chunk-6A6AELDJ.js";import{c as Ce}from"./chunk-34E6NNQZ.js";import{a as Ke,e as Te}from"./chunk-2BN5NW34.js";import{n as be}from"./chunk-35IQT6SS.js";import"./chunk-ZPQBVYNN.js";import{B as ue,e as Se,f as $e,h as ie,i as Ne,j as ke,s as re,w as Me}from"./chunk-6DU2UW57.js";import"./chunk-PDBW6GTJ.js";import{a as Ge}from"./chunk-GWNGVKLG.js";import{a as Oe,b as He}from"./chunk-6G3E4PJ2.js";import{a as d,d as ye}from"./chunk-5PEAXTYQ.js";var ge=ye(Ge(),1);var ne=ye(Oe(),1);var t=ye(He(),1);var Ie="none",Je=["all","open","resolved","ignored"],Pe=["critical","high","medium","low"],Qe=ie(U.resolveIssue),Xe=ie(U.ignoreIssue),Fe=ie(U.assignIssue),Ye=ie(U.setIssueSeverity),Ze=ie(U.explainIssue),es=d(n=>Array.isArray(n?.issues)?n.issues:[],"Xe"),ss=d(n=>n==="resolved"?"success":n==="ignored"?"secondary":"warning","Je"),ts=d(n=>n==="critical"?"destructive":n==="high"?"warning":n==="medium"?"info":"secondary","Ze"),as=d(n=>{let e=(0,ge.c)(44),{expanded:u,issue:s,shardKey:$}=n,i=be(),l=ue(),[a,o]=(0,ne.useState)(void 0),{busy:_,error:A,run:R}=je(),K;e[0]!==i||e[1]!==s||e[2]!==R||e[3]!==$?(K=d(()=>{o(void 0),R(async()=>{let g={culprit:s.culprit,sampleMessage:s.sampleMessage,title:s.title},S=await i.query(Ze,g,Ne($));o(S)})},"C"),e[0]=i,e[1]=s,e[2]=R,e[3]=$,e[4]=K):K=e[4];let z=K;if(!u)return null;let k;if(e[5]!==s.sampleMessage){let g=$e(s.sampleMessage);k=g===void 0?void 0:Se(g.body),e[5]=s.sampleMessage,e[6]=k}else k=e[6];let T=k,E=`issues-detail-${s.hash}`,h;e[7]!==s.sampleMessage?(h=(0,t.jsx)("p",{className:"whitespace-pre-wrap font-mono text-xs text-muted-foreground",children:s.sampleMessage}),e[7]=s.sampleMessage,e[8]=h):h=e[8];let x;e[9]!==l?(x=l("Suggested fix"),e[9]=l,e[10]=x):x=e[10];let M;e[11]!==x?(M=(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:x}),e[11]=x,e[12]=M):M=e[12];let v;e[13]!==T||e[14]!==s.hash||e[15]!==l?(v=T===void 0?(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":`issues-hint-empty-${s.hash}`,children:l("No known fix for this error yet.")}):(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm","data-testid":`issues-hint-${s.hash}`,children:T}),e[13]=T,e[14]=s.hash,e[15]=l,e[16]=v):v=e[16];let y;e[17]!==M||e[18]!==v?(y=(0,t.jsxs)("div",{children:[M,v]}),e[17]=M,e[18]=v,e[19]=y):y=e[19];let b=`issues-explain-${s.hash}`,w;e[20]!==_||e[21]!==l?(w=l(_?"Explaining\u2026":"Explain in plain language"),e[20]=_,e[21]=l,e[22]=w):w=e[22];let m;e[23]!==_||e[24]!==z||e[25]!==w||e[26]!==b?(m=(0,t.jsx)("div",{children:(0,t.jsx)(le,{"data-testid":b,disabled:_,onClick:z,size:"sm",type:"button",variant:"outline",children:w})}),e[23]=_,e[24]=z,e[25]=w,e[26]=b,e[27]=m):m=e[27];let f;e[28]!==A||e[29]!==s.hash?(f=A!==null&&(0,t.jsx)("p",{className:"text-xs text-destructive","data-testid":`issues-explain-error-${s.hash}`,role:"alert",children:A}),e[28]=A,e[29]=s.hash,e[30]=f):f=e[30];let p;e[31]!==a||e[32]!==s.hash||e[33]!==l?(p=a!==void 0&&(a.degraded?(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":`issues-degraded-${s.hash}`,children:a.reason==="no-ai-binding"?l("No AI binding is configured. Wire an AI binding to enable plain-language explanations \u2014 the suggested fix above is always available."):l("The AI model could not explain this error right now. The suggested fix above still applies.")}):(0,t.jsxs)("div",{"data-testid":`issues-explanation-${s.hash}`,children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:l("AI explanation")}),(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:a.explanation}),a.groundedId===void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":`issues-ungrounded-${s.hash}`,children:l("No catalog fix matched this error, so this explanation is the model's own reading of the message. Verify before acting on it.")}),(0,t.jsx)("p",{className:"mt-1 text-[0.7rem] text-muted-foreground",children:l("Generated by {model}",{model:a.model})})]})),e[31]=a,e[32]=s.hash,e[33]=l,e[34]=p):p=e[34];let c;e[35]!==m||e[36]!==f||e[37]!==p||e[38]!==h||e[39]!==y?(c=(0,t.jsx)(L,{className:"bg-muted/30",colSpan:7,children:(0,t.jsxs)("div",{className:"flex flex-col gap-3 py-1",children:[h,y,m,f,p]})}),e[35]=m,e[36]=f,e[37]=p,e[38]=h,e[39]=y,e[40]=c):c=e[40];let I;return e[41]!==c||e[42]!==E?(I=(0,t.jsx)(pe,{"data-testid":E,children:c}),e[41]=c,e[42]=E,e[43]=I):I=e[43],I},"et"),is=d(n=>{let e=(0,ge.c)(119),{busy:u,issue:s,rowError:$,runTriage:i,shardKey:l}=n,a=ue(),[o,_]=(0,ne.useState)(!1),A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=d(()=>{_(rs)},"A"),e[0]=A):A=e[0];let R=A,K;e[1]!==s.hash||e[2]!==i?(K=d(ae=>{let ce=ae===null||ae===Ie?null:ae;re(i(s.hash,Ye,{severity:ce}))},"C"),e[1]=s.hash,e[2]=i,e[3]=K):K=e[3];let z=K,k;e[4]!==s.hash||e[5]!==i?(k=d(ae=>{if(ae.key!=="Enter")return;let ce=ae.currentTarget.value.trim();re(i(s.hash,Fe,{assignee:ce===""?null:ce}))},"T"),e[4]=s.hash,e[5]=i,e[6]=k):k=e[6];let T=k,E=`issues-row-${s.hash}`,h;e[7]!==a?(h=a("Toggle issue details"),e[7]=a,e[8]=h):h=e[8];let x=`issues-toggle-${s.hash}`,M=`mt-1 size-3 shrink-0 text-muted-foreground transition-transform ${o?"rotate-90":""}`,v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[9]=v):v=e[9];let y;e[10]!==M?(y=(0,t.jsx)("svg",{"aria-hidden":"true",className:M,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:v}),e[10]=M,e[11]=y):y=e[11];let b;e[12]!==s.title?(b=(0,t.jsx)("span",{className:"block truncate font-medium",title:s.title,children:s.title}),e[12]=s.title,e[13]=b):b=e[13];let w;e[14]!==s.culprit?(w=(0,t.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",title:s.culprit,children:s.culprit}),e[14]=s.culprit,e[15]=w):w=e[15];let m;e[16]!==b||e[17]!==w?(m=(0,t.jsxs)("span",{className:"min-w-0",children:[b,w]}),e[16]=b,e[17]=w,e[18]=m):m=e[18];let f;e[19]!==o||e[20]!==m||e[21]!==h||e[22]!==x||e[23]!==y?(f=(0,t.jsxs)("button",{"aria-expanded":o,"aria-label":h,className:"flex w-full items-start gap-2 text-left","data-testid":x,onClick:R,type:"button",children:[y,m]}),e[19]=o,e[20]=m,e[21]=h,e[22]=x,e[23]=y,e[24]=f):f=e[24];let p;e[25]!==s.hash||e[26]!==$?(p=$!==void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-destructive","data-testid":`issues-action-error-${s.hash}`,role:"alert",children:$}),e[25]=s.hash,e[26]=$,e[27]=p):p=e[27];let c;e[28]!==f||e[29]!==p?(c=(0,t.jsxs)(L,{className:"max-w-80",children:[f,p]}),e[28]=f,e[29]=p,e[30]=c):c=e[30];let I=`issues-status-${s.hash}`,g;e[31]!==s.status?(g=ss(s.status),e[31]=s.status,e[32]=g):g=e[32];let S;e[33]!==s.status||e[34]!==I||e[35]!==g?(S=(0,t.jsx)(L,{children:(0,t.jsx)(me,{"data-testid":I,variant:g,children:s.status})}),e[33]=s.status,e[34]=I,e[35]=g,e[36]=S):S=e[36];let V=s.severity??Ie,r;e[37]!==a?(r=a("Set severity"),e[37]=a,e[38]=r):r=e[38];let oe=`issues-severity-${s.hash}`,j;e[39]!==a?(j=a("\u2014"),e[39]=a,e[40]=j):j=e[40];let N;e[41]!==s.severity||e[42]!==a?(N=s.severity===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:a("\u2014")}):(0,t.jsx)(me,{variant:ts(s.severity),children:s.severity}),e[41]=s.severity,e[42]=a,e[43]=N):N=e[43];let C;e[44]!==j||e[45]!==N?(C=(0,t.jsx)(Ue,{placeholder:j,children:N}),e[44]=j,e[45]=N,e[46]=C):C=e[46];let q;e[47]!==r||e[48]!==oe||e[49]!==C?(q=(0,t.jsx)(We,{"aria-label":r,className:"h-7 w-[110px]","data-testid":oe,children:C}),e[47]=r,e[48]=oe,e[49]=C,e[50]=q):q=e[50];let de;e[51]===Symbol.for("react.memo_cache_sentinel")?(de=Pe.map(ls),e[51]=de):de=e[51];let W;e[52]!==a?(W=a("Clear"),e[52]=a,e[53]=W):W=e[53];let D;e[54]!==W?(D=(0,t.jsxs)(De,{children:[de,(0,t.jsx)(we,{value:Ie,children:W})]}),e[54]=W,e[55]=D):D=e[55];let F;e[56]!==u||e[57]!==z||e[58]!==V||e[59]!==q||e[60]!==D?(F=(0,t.jsx)(L,{children:(0,t.jsxs)(Be,{disabled:u,onValueChange:z,value:V,children:[q,D]})}),e[56]=u,e[57]=z,e[58]=V,e[59]=q,e[60]=D,e[61]=F):F=e[61];let O;e[62]!==a?(O=a("Assignee"),e[62]=a,e[63]=O):O=e[63];let fe=`issues-assignee-${s.hash}`,xe=s.assignee??"",ve=s.assignee??"",G;e[64]!==a?(G=a("Unassigned"),e[64]=a,e[65]=G):G=e[65];let H;e[66]!==u||e[67]!==T||e[68]!==O||e[69]!==fe||e[70]!==xe||e[71]!==ve||e[72]!==G?(H=(0,t.jsx)(L,{children:(0,t.jsx)(Ae,{"aria-label":O,className:"h-7 w-32","data-testid":fe,defaultValue:xe,disabled:u,onKeyDown:T,placeholder:G},ve)}),e[66]=u,e[67]=T,e[68]=O,e[69]=fe,e[70]=xe,e[71]=ve,e[72]=G,e[73]=H):H=e[73];let J;e[74]!==s.count?(J=(0,t.jsx)(L,{className:"text-right",children:(0,t.jsx)(me,{variant:"secondary",children:s.count})}),e[74]=s.count,e[75]=J):J=e[75];let P;e[76]!==s.lastSeen?(P=Me(s.lastSeen),e[76]=s.lastSeen,e[77]=P):P=e[77];let Q;e[78]!==P?(Q=(0,t.jsx)(L,{className:"text-xs tabular-nums text-muted-foreground",children:P}),e[78]=P,e[79]=Q):Q=e[79];let X;e[80]!==u||e[81]!==s.hash||e[82]!==s.status||e[83]!==i||e[84]!==a?(X=s.status!=="resolved"&&(0,t.jsx)(le,{"data-testid":`issues-resolve-${s.hash}`,disabled:u,onClick:d(()=>{re(i(s.hash,Qe,{}))},"onClick"),size:"xs",variant:"outline",children:a("Resolve")}),e[80]=u,e[81]=s.hash,e[82]=s.status,e[83]=i,e[84]=a,e[85]=X):X=e[85];let Y;e[86]!==u||e[87]!==s.hash||e[88]!==s.status||e[89]!==i||e[90]!==a?(Y=s.status!=="ignored"&&(0,t.jsx)(le,{"data-testid":`issues-ignore-${s.hash}`,disabled:u,onClick:d(()=>{re(i(s.hash,Xe,{}))},"onClick"),size:"xs",variant:"ghost",children:a("Ignore")}),e[86]=u,e[87]=s.hash,e[88]=s.status,e[89]=i,e[90]=a,e[91]=Y):Y=e[91];let Z;e[92]!==u||e[93]!==s.assignee||e[94]!==s.hash||e[95]!==s.status||e[96]!==i||e[97]!==a?(Z=s.status!=="open"&&(0,t.jsx)(le,{"data-testid":`issues-reopen-${s.hash}`,disabled:u,onClick:d(()=>{re(i(s.hash,Fe,{assignee:s.assignee??null}))},"onClick"),size:"xs",variant:"ghost",children:a("Reopen")}),e[92]=u,e[93]=s.assignee,e[94]=s.hash,e[95]=s.status,e[96]=i,e[97]=a,e[98]=Z):Z=e[98];let ee;e[99]!==X||e[100]!==Y||e[101]!==Z?(ee=(0,t.jsx)(L,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1",children:[X,Y,Z]})}),e[99]=X,e[100]=Y,e[101]=Z,e[102]=ee):ee=e[102];let se;e[103]!==c||e[104]!==S||e[105]!==F||e[106]!==H||e[107]!==J||e[108]!==Q||e[109]!==E||e[110]!==ee?(se=(0,t.jsxs)(pe,{"data-testid":E,children:[c,S,F,H,J,Q,ee]}),e[103]=c,e[104]=S,e[105]=F,e[106]=H,e[107]=J,e[108]=Q,e[109]=E,e[110]=ee,e[111]=se):se=e[111];let te;e[112]!==o||e[113]!==s||e[114]!==l?(te=(0,t.jsx)(as,{expanded:o,issue:s,shardKey:l},s.sampleMessage),e[112]=o,e[113]=s,e[114]=l,e[115]=te):te=e[115];let he;return e[116]!==se||e[117]!==te?(he=(0,t.jsxs)(t.Fragment,{children:[se,te]}),e[116]=se,e[117]=te,e[118]=he):he=e[118],he},"tt"),ks=d(n=>{let e=(0,ge.c)(38),{initialShardKey:u}=n,s=ue(),$=be(),{queryShardKey:i,setShardKey:l,shardKey:a}=ze(u),[o,_]=(0,ne.useState)("all"),[A,R]=(0,ne.useState)(ns),[K,z]=(0,ne.useState)(os),k;e[0]!==o?(k=o==="all"?{}:{status:o},e[0]=o,e[1]=k):k=e[1];let T;e[2]!==i?(T={live:!0,shardKey:i},e[2]=i,e[3]=T):T=e[3];let{data:E,error:h,liveError:x}=Ce(U.getIssues,k,T),M=E!==void 0,v;if(e[4]!==K||e[5]!==A||e[6]!==$||e[7]!==E||e[8]!==h||e[9]!==x||e[10]!==M||e[11]!==i||e[12]!==l||e[13]!==a||e[14]!==o||e[15]!==s){let y=es(E),b;e[17]!==$||e[18]!==i?(b=d(async(r,oe,j)=>{z(N=>{if(!N.has(r))return N;let C=new Map(N);return C.delete(r),C}),R(N=>new Set(N).add(r));try{await $.query(oe,{...j,hash:r},Ne(i))}catch(N){let C=ke(N);z(q=>new Map(q).set(r,C))}R(N=>{let C=new Set(N);return C.delete(r),C})},"v"),e[17]=$,e[18]=i,e[19]=b):b=e[19];let w=b,m;e[20]!==s?(m=d(r=>s(r==="all"?"All":r==="open"?"Open":r==="resolved"?"Resolved":"Ignored"),"u"),e[20]=s,e[21]=m):m=e[21];let f=m,p;e[22]!==h?(p=h!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"issues-error",role:"alert",children:h}),e[22]=h,e[23]=p):p=e[23];let c;e[24]!==l||e[25]!==a?(c=(0,t.jsx)(_e,{onChange:l,testId:"issues-shard-input",value:a}),e[24]=l,e[25]=a,e[26]=c):c=e[26];let I;e[27]!==x?(I=(0,t.jsx)(qe,{message:x,prefix:"issues"}),e[27]=x,e[28]=I):I=e[28];let g;e[29]!==o||e[30]!==f?(g=Je.map(r=>(0,t.jsx)(le,{"data-active":o===r?"":void 0,"data-testid":`issues-filter-${r}`,onClick:d(()=>{_(r)},"onClick"),size:"xs",variant:o===r?"default":"outline",children:f(r)},r)),e[29]=o,e[30]=f,e[31]=g):g=e[31];let S;e[32]!==g?(S=(0,t.jsx)("div",{className:"ms-auto flex items-center gap-1","data-testid":"issues-status-filter",role:"group",children:g}),e[32]=g,e[33]=S):S=e[33];let V;e[34]!==S||e[35]!==c||e[36]!==I?(V=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,I,S]}),e[34]=S,e[35]=c,e[36]=I,e[37]=V):V=e[37],v=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[p,V,M&&y.length===0?(0,t.jsx)(Ee,{description:s("No grouped errors yet. When a function throws or a container crashes, matching errors fold into a single issue here."),testId:"issues-empty",title:s("No issues")}):(0,t.jsx)(Ke,{className:"overflow-hidden py-0",children:(0,t.jsx)(Te,{className:"px-0",children:(0,t.jsxs)(Le,{"data-testid":"issues-table",children:[(0,t.jsx)(Re,{children:(0,t.jsxs)(pe,{children:[(0,t.jsx)(B,{children:s("Issue")}),(0,t.jsx)(B,{children:s("Status")}),(0,t.jsx)(B,{children:s("Severity")}),(0,t.jsx)(B,{children:s("Assignee")}),(0,t.jsx)(B,{className:"text-right",children:s("Events")}),(0,t.jsx)(B,{children:s("Last seen")}),(0,t.jsx)(B,{className:"text-right",children:s("Actions")})]})}),(0,t.jsx)(Ve,{children:y.map(r=>(0,t.jsx)(is,{busy:A.has(r.hash),issue:r,rowError:K.get(r.hash),runTriage:w,shardKey:i},r.hash))})]})})})]}),e[4]=K,e[5]=A,e[6]=$,e[7]=E,e[8]=h,e[9]=x,e[10]=M,e[11]=i,e[12]=l,e[13]=a,e[14]=o,e[15]=s,e[16]=v}else v=e[16];return v},"Tt");function rs(n){return!n}d(rs,"st");function ls(n){return(0,t.jsx)(we,{value:n,children:n},n)}d(ls,"at");function ns(){return new Set}d(ns,"it");function os(){return new Map}d(os,"lt");export{ks as default};
@@ -0,0 +1 @@
1
+ import{b as c}from"./chunk-34E6NNQZ.js";import{n as l}from"./chunk-35IQT6SS.js";import{a as g}from"./chunk-GWNGVKLG.js";import{a as r,d as f}from"./chunk-5PEAXTYQ.js";var m=f(g(),1);var p={capabilities:{accounts:!0,admin:!0,inviteOnly:!1,organization:!1,passkey:!1,twoFactor:!1},emailAndPassword:!1,organization:{enabled:!1,roles:!1,teams:!1},plugins:[],rateLimit:{enabled:!1},session:{},socialProviders:[],userFields:[]},h=r(()=>{let o=(0,m.c)(6),t=l(),a;o[0]===Symbol.for("react.memo_cache_sentinel")?(a=["lunora-auth-config"],o[0]=a):a=o[0];let e;o[1]!==t?(e=r(()=>t.getAuthConfig(),"t"),o[1]=t,o[2]=e):e=o[2];let{data:d,isLoading:u}=c(a,e),n=d??p,s=!u,i;return o[3]!==n||o[4]!==s?(i={config:n,ready:s},o[3]=n,o[4]=s,o[5]=i):i=o[5],i},"y");export{h as a};
@@ -0,0 +1 @@
1
+ import{c as u}from"./chunk-JMZT3CEW.js";import{j as c}from"./chunk-YUVGMKHG.js";import{a as l}from"./chunk-ZPQBVYNN.js";import{x as d}from"./chunk-6DU2UW57.js";import{a as h,b as z}from"./chunk-6G3E4PJ2.js";import{a as t,d as o}from"./chunk-5PEAXTYQ.js";var p=o(h(),1);var a=p.forwardRef(t(function(e,r){let{render:n,className:k,disabled:s=!1,focusableWhenDisabled:g=!1,nativeButton:f=!0,style:B,...b}=e,{getButtonProps:m,buttonRef:x}=u({disabled:s,focusableWhenDisabled:g,native:f});return c("button",e,{state:{disabled:s},ref:[r,x],props:[b,m]})},"Button"));var v=o(z(),1);var y=l("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",xs:"h-6 gap-1 rounded-md px-2 text-xs has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-md px-2.5 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",icon:"size-8","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-md","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function W({className:i,variant:e="default",size:r="default",...n}){return(0,v.jsx)(a,{"data-slot":"button",className:d(y({variant:e,size:r,className:i})),...n})}t(W,"v");export{W as a};
@@ -0,0 +1,30 @@
1
+ import{a as et,b as tt}from"./chunk-4AJML27P.js";import"./chunk-JW3TXMEF.js";import"./chunk-CKK227GJ.js";import{d as Ze}from"./chunk-CHJYRPLL.js";import"./chunk-SY7AVD6C.js";import{a as Ae}from"./chunk-CVSIFPI5.js";import{a as Ye}from"./chunk-PLLNOYT6.js";import"./chunk-Y2YLTUMD.js";import"./chunk-QNJJIVLQ.js";import"./chunk-UBX5ZPLV.js";import"./chunk-VNH4OBJS.js";import{a as Je}from"./chunk-2DT3QG6Q.js";import"./chunk-KTK4NDWQ.js";import"./chunk-XLYFGUEF.js";import"./chunk-D65UVZIA.js";import"./chunk-NGVP66OH.js";import"./chunk-QAOZXPLU.js";import"./chunk-BG2CJOVS.js";import{a as Ve}from"./chunk-PRTIYJFL.js";import{b as Ge}from"./chunk-3D67ZJRW.js";import"./chunk-G2BUKFAD.js";import{c as Ue,d as we,e as Ne,f as Ee,g as Me}from"./chunk-ZSWW2UGP.js";import"./chunk-QRA7AKYO.js";import{i as ye}from"./chunk-74WS3GUC.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import"./chunk-KSFVO6OB.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import"./chunk-YUVGMKHG.js";import{a as Xe}from"./chunk-TDYA6E3G.js";import"./chunk-AXKOMM2J.js";import{b as Ke}from"./chunk-XAI64L2D.js";import{a as ve}from"./chunk-6A6AELDJ.js";import"./chunk-34E6NNQZ.js";import{n as Ce}from"./chunk-35IQT6SS.js";import"./chunk-ZPQBVYNN.js";import{B as J,h as ge,i as xe,j as Fe,r as Qe,s as se,x as ie}from"./chunk-6DU2UW57.js";import"./chunk-PDBW6GTJ.js";import{a as wt}from"./chunk-GWNGVKLG.js";import{a as yt,b as St}from"./chunk-6G3E4PJ2.js";import{a as d,d as De}from"./chunk-5PEAXTYQ.js";var X=De(wt(),1),H=De(yt(),1);var u=De(St(),1);var Se=class{static{d(this,"Diff")}diff(e,n,t={}){let o;typeof t=="function"?(o=t,t={}):"callback"in t&&(o=t.callback);let r=this.castInput(e,t),l=this.castInput(n,t),i=this.removeEmpty(this.tokenize(r,t)),a=this.removeEmpty(this.tokenize(l,t));return this.diffWithOptionsObj(i,a,t,o)}diffWithOptionsObj(e,n,t,o){var r;let l=d(h=>{if(h=this.postProcess(h,t),o){setTimeout(function(){o(h)},0);return}else return h},"done"),i=n.length,a=e.length,c=1,m=i+a;t.maxEditLength!=null&&(m=Math.min(m,t.maxEditLength));let p=(r=t.timeout)!==null&&r!==void 0?r:1/0,f=Date.now()+p,b=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(b[0],n,e,0,t);if(b[0].oldPos+1>=a&&g+1>=i)return l(this.buildValues(b[0].lastComponent,n,e));let k=-1/0,q=1/0,N=d(()=>{for(let h=Math.max(k,-c);h<=Math.min(q,c);h+=2){let S,x=b[h-1],v=b[h+1];x&&(b[h-1]=void 0);let y=!1;if(v){let E=v.oldPos-h;y=v&&0<=E&&E<i}let w=x&&x.oldPos+1<a;if(!y&&!w){b[h]=void 0;continue}if(!w||y&&x.oldPos<v.oldPos?S=this.addToPath(v,!0,!1,0,t):S=this.addToPath(x,!1,!0,1,t),g=this.extractCommon(S,n,e,h,t),S.oldPos+1>=a&&g+1>=i)return l(this.buildValues(S.lastComponent,n,e))||!0;b[h]=S,S.oldPos+1>=a&&(q=Math.min(q,h-1)),g+1>=i&&(k=Math.max(k,h+1))}c++},"execEditLength");if(o)d(function h(){setTimeout(function(){if(c>m||Date.now()>f)return o(void 0);N()||h()},0)},"exec")();else for(;c<=m&&Date.now()<=f;){let h=N();if(h)return h}}addToPath(e,n,t,o,r){let l=e.lastComponent;return l&&!r.oneChangePerToken&&l.added===n&&l.removed===t?{oldPos:e.oldPos+o,lastComponent:{count:l.count+1,added:n,removed:t,previousComponent:l.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:n,removed:t,previousComponent:l}}}extractCommon(e,n,t,o,r){let l=n.length,i=t.length,a=e.oldPos,c=a-o,m=0;for(;c+1<l&&a+1<i&&this.equals(t[a+1],n[c+1],r);)c++,a++,m++,r.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return m&&!r.oneChangePerToken&&(e.lastComponent={count:m,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,c}equals(e,n,t){return t.comparator?t.comparator(e,n):e===n||!!t.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){let n=[];for(let t=0;t<e.length;t++)e[t]&&n.push(e[t]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,t){let o=[],r;for(;e;)o.push(e),r=e.previousComponent,delete e.previousComponent,e=r;o.reverse();let l=o.length,i=0,a=0,c=0;for(;i<l;i++){let m=o[i];if(m.removed)m.value=this.join(t.slice(c,c+m.count)),c+=m.count;else{if(!m.added&&this.useLongestToken){let p=n.slice(a,a+m.count);p=p.map(function(f,b){let g=t[c+b];return g.length>f.length?g:f}),m.value=this.join(p)}else m.value=this.join(n.slice(a,a+m.count));a+=m.count,m.added||(c+=m.count)}}return o}};var Pe=class extends Se{static{d(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=qt}equals(e,n,t){return t.ignoreWhitespace?((!t.newlineIsToken||!e.includes(`
2
+ `))&&(e=e.trim()),(!t.newlineIsToken||!n.includes(`
3
+ `))&&(n=n.trim())):t.ignoreNewlineAtEof&&!t.newlineIsToken&&(e.endsWith(`
4
+ `)&&(e=e.slice(0,-1)),n.endsWith(`
5
+ `)&&(n=n.slice(0,-1))),super.equals(e,n,t)}},nt=new Pe;function $e(s,e,n){return nt.diff(s,e,n)}d($e,"diffLines");function qt(s,e){e.stripTrailingCr&&(s=s.replace(/\r\n/g,`
6
+ `));let n=[],t=s.split(/(\n|\r\n)/);t[t.length-1]||t.pop();for(let o=0;o<t.length;o++){let r=t[o];o%2&&!e.newlineIsToken?n[n.length-1]+=r:n.push(r)}return n}d(qt,"tokenize");var kt="x",ot=" ",Ct={'"':'"',"'":"'","[":"]","`":"`"},at=d((s,e)=>{let n=e+2;for(;n<s.length&&s[n]!==`
7
+ `;)n+=1;return n},"Je"),ct=d((s,e)=>{let n=s.indexOf("*/",e+2);return n===-1?-1:n+2},"Xe"),dt=d(s=>{let e=s.split(""),n=0;for(;n<s.length;){let t=s[n]??"",o=Ct[t];if(t==="-"&&s[n+1]==="-"){let r=at(s,n);e.fill(ot,n,r),n=r}else if(t==="/"&&s[n+1]==="*"){let r=ct(s,n);if(r===-1)return;e.fill(ot,n,r),n=r}else if(o!==void 0){let r=n+1;for(;r<s.length;)if(s[r]!==o)r+=1;else if(o!=="]"&&s[r+1]===o)r+=2;else break;if(r>=s.length)return;e.fill(kt,n,r+1),n=r+1}else n+=1}for(let t=0;t<s.length;t+=1)s[t]===`
8
+ `&&(e[t]=`
9
+ `);return e.join("")},"Ze"),Nt=/^(?:explain\s+(?:query\s+plan\s+)?)?(?:select|with)\b/iu,Et=/\b(?:alter|attach|create|delete|detach|drop|insert|pragma|reindex|truncate|update|vacuum)\b|\breplace\b(?!\s*\()/iu,Tt=/^\w+/u,Lt=/;\s*$/u,It=/\s/u,ut=d(s=>{let e=0;for(;e<s.length;){let n=s[e];if(n!==void 0&&It.test(n))e+=1;else if(n==="-"&&s[e+1]==="-")e=at(s,e);else if(n==="/"&&s[e+1]==="*"){let t=ct(s,e);if(t===-1)break;e=t}else break}return e},"et"),Rt=d(s=>{let e=ut(s),n=s.slice(e).trimEnd();if(n==="")return{code:"SQL_EMPTY",message:"the query is empty"};let t=(dt(n)??n).replace(Lt,""),o=n.slice(0,t.length),r=t.indexOf(";");if(r!==-1)return{code:"SQL_MULTIPLE_STATEMENTS",length:1,message:"only a single statement may be run",offset:e+r};let l="the SQL editor is read-only \u2014 only SELECT / WITH / EXPLAIN queries are allowed";if(!Nt.test(o))return{code:"SQL_NOT_READONLY",length:Tt.exec(o)?.[0].length??1,message:l,offset:e};let i=Et.exec(o);if(i!==null)return{code:"SQL_NOT_READONLY",length:i[0].length,message:`${l} (\`${i[0].toUpperCase()}\` is not allowed)`,offset:e+i.index}},"It"),_t=/^explain\b/iu,Dt=d(s=>_t.test(s.slice(ut(s)))?s:`EXPLAIN QUERY PLAN ${s}`,"At"),ze=d((s,e)=>{let n=s.trim();if(n==="")return[];let t=e+s.indexOf(n),o=Rt(n);return o?.code==="SQL_EMPTY"?[]:[o===void 0?{offset:t,sql:n}:{offset:t,rejection:o,sql:n}]},"Oe"),mt=d(s=>{let e=dt(s);if(e===void 0)return ze(s,0);let n=[],t=0;for(let o=0;o<=e.length;o+=1)o!==e.length&&e[o]!==";"||(n.push(...ze(s.slice(t,o),t)),t=o+1);return n},"tt"),Mt=["ORDER BY","GROUP BY","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN","EXPLAIN QUERY PLAN","SELECT","DISTINCT","FROM","WHERE","HAVING","LIMIT","OFFSET","JOIN","ON","AND","OR","AS","ASC","DESC","WITH","UNION","EXPLAIN"],At=["FROM","WHERE","ORDER BY","GROUP BY","HAVING","LIMIT","OFFSET","UNION","JOIN","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN"],_e=String.fromCodePoint(0),Pt=new RegExp(`${_e}${String.raw`(\d+)`}${_e}`,"gu"),$t=Mt.map(s=>({pattern:new RegExp(String.raw`\b${s.replaceAll(" ",String.raw`\s+`)}\b`,"giu"),replacement:s})),Ot=At.map(s=>({pattern:new RegExp(String.raw`\s+${s.replaceAll(" ",String.raw`\s+`)}\b`,"gu"),replacement:`
10
+ ${s}`})),zt=d(s=>{let e=[],n=s.replaceAll(/'(?:[^']|'')*'/gu,t=>(e.push(t),`${_e}${(e.length-1).toString()}${_e}`)).replaceAll(/\s+/gu," ").trim();for(let{pattern:t,replacement:o}of $t)n=n.replaceAll(t,o);for(let{pattern:t,replacement:o}of Ot)n=n.replaceAll(t,o);return n=n.replaceAll(Pt,(t,o)=>e[Number(o)]??""),n},"Bt"),jt=/\b(?:from|join)\s+([a-z_][\w$]*)(?:\s+(?:as\s+)?([a-z_][\w$]*))?/giu,Ht=/(?:\bwith\s+(?:recursive\s+)?|,\s*)([a-z_][\w$]*)\s+as\s*\(/giu,Bt=new Set(["cross","full","group","having","inner","join","left","limit","offset","on","order","right","union","using","where","window"]),Wt=/[^\n]/gu,Ft=d((s,e)=>{let n=s[e];if(n==="'"){let t=e+1;for(;t<s.length&&s[t]!=="'";)t+=1;return Math.min(t+1,s.length)}if(n==="-"&&s[e+1]==="-"){let t=s.indexOf(`
11
+ `,e);return t===-1?s.length:t}if(n==="/"&&s[e+1]==="*"){let t=s.indexOf("*/",e+2);return t===-1?s.length:t+2}return-1},"Qt"),Qt=d(s=>{let e="",n=0;for(;n<s.length;){let t=Ft(s,n);t===-1?(e+=s.slice(n,n+1),n+=1):(e+=s.slice(n,t).replaceAll(Wt," "),n=t)}return e},"jt"),Kt=d(s=>{let e=new Set;for(let n of s.matchAll(Ht))e.add((n[1]??"").toLowerCase());return e},"zt"),Ut=d((s,e)=>{let n=new Map;for(let t of s.matchAll(jt)){let o=(t[1]??"").toLowerCase(),r=(t[2]??"").toLowerCase();e.has(o)&&(n.set(o,o),r!==""&&!Bt.has(r)&&n.set(r,o))}return n},"Kt"),ft=d((s,e)=>{let n=Qt(s),t=new Set(e.map(o=>o.toLowerCase()));return{ctes:Kt(n),masked:n,targets:Ut(n,t)}},"nt"),Gt=/^(?:__lunora|sqlite_)/iu,Vt=/\b(?:from|join)\s+([a-z_][\w$]*)/giu,Xt=/\b([a-z_][\w$]*)\.([a-z_][\w$]*)/giu,Yt=new Set(["cross","full","group","having","inner","join","lateral","left","limit","offset","order","right","select","union","where","window"]),Jt=d((s,e,n)=>{let t=[];for(let o of s.matchAll(Vt)){let r=o[1]??"",l=r.toLowerCase();!e.has(l)&&!n.has(l)&&!Yt.has(l)&&!Gt.test(r)&&t.push({length:r.length,message:`unknown table \`${r}\``,offset:o.index+o[0].length-r.length,severity:"error",source:"schema"})}return t},"Jt"),Zt=d((s,e,n)=>{let t=[],o=new Map;for(let[r,l]of Object.entries(e.columns))o.set(r.toLowerCase(),new Set(l.map(i=>i.toLowerCase())));for(let r of s.matchAll(Xt)){let l=(r[1]??"").toLowerCase(),i=r[2]??"",a=n.get(l),c=a===void 0?void 0:o.get(a);c!==void 0&&!c.has(i.toLowerCase())&&t.push({length:i.length,message:`\`${a??""}\` has no column \`${i}\``,offset:r.index+r[0].length-i.length,severity:"error",source:"schema"})}return t},"Xt"),en=/(?<![\w$."])(?:"([a-z_][\w$]*)"|([a-z_][\w$]*))(?![.(])/giu,tn=/\bas\s+"?([a-z_][\w$]*)"?/giu,nn=d((s,e,n,t)=>{let o=[...new Set(n.values())],r=new Map,l=new Set;for(let c of o){for(let m of e.columns[c]??[])l.add(m.toLowerCase());for(let m of e.docFields?.[c]??[])r.set(m.toLowerCase(),m)}if(r.size===0)return[];let i=new Set([...s.matchAll(tn)].map(c=>(c[1]??"").toLowerCase())),a=[];for(let c of s.matchAll(en)){let m=c[1],p=m??c[2]??"",f=p.toLowerCase(),b=r.get(f);b===void 0||l.has(f)||i.has(f)||t.has(f)||n.has(f)||a.push({length:p.length,message:`\`${b}\` is a \`__doc__\` field, not a column \u2014 use \`json_extract(__doc__, '$.${b}')\``,offset:c.index+(m===void 0?0:1),severity:"error",source:"schema"})}return a},"tn"),on=d((s,e)=>{if(s.trim()==="")return[];let n=mt(s),t=new Set(e.tables.map(r=>r.toLowerCase())),o=[];for(let r of n){let{offset:l,rejection:i}=r;if(i!==void 0){o.push({length:i.length,message:i.message,offset:i.offset===void 0?l:l+i.offset,severity:"error",source:"gate"});continue}let{ctes:a,masked:c,targets:m}=ft(r.sql,e.tables);o.push(...[...Jt(c,t,a),...Zt(c,e,m),...nn(c,e,m,a)].map(p=>({...p,offset:p.offset===void 0?l:l+p.offset})))}return o},"nn"),rn=ge(ve.lintSql),ln=600,sn=d((s,e,n)=>{let t=Ce(),[o,r]=(0,H.useState)([]),l=(0,H.useMemo)(()=>on(s,e),[s,e]),i=Je(s,ln),a=l.some(p=>p.source==="gate")||i.trim()==="",c=(0,H.useCallback)(async p=>{try{let f=await t.query(rn,{sql:i},xe(n));p.cancelled||r(f.diagnostics??[])}catch{p.cancelled||r([])}},[t,i,n]);(0,H.useEffect)(()=>{if(a){r([]);return}let p={cancelled:!1};return se(c(p)),()=>{p.cancelled=!0}},[c,a]);let m=i===s;return(0,H.useMemo)(()=>m?[...l,...o]:l,[l,o,m])},"ln"),Te=8,an=["AND","ASC","AS","BY","COUNT","DESC","DISTINCT","EXPLAIN","FROM","GROUP","HAVING","INNER","JOIN","LEFT","LIKE","LIMIT","NOT","NULL","OFFSET","ON","ORDER","OR","QUERY","SELECT","WHERE","WITH"],cn=new Set(["AND","BY","HAVING","ON","OR","SELECT","WHERE"]),dn=/[\w$]/,ht=d(s=>s!==void 0&&dn.test(s),"st"),pt=d(s=>{let e=s.length;for(;e>0&&ht(s[e-1]);)e-=1;return s.slice(e)},"ot"),bt=d((s,e)=>{let n=e;for(;n>0&&ht(s[n-1]);)n-=1;return{end:e,start:n,text:s.slice(n,e)}},"lt"),rt=d((s,e)=>{let n=s.slice(0,e).trimEnd();return n.endsWith(".")||cn.has(pt(n).toUpperCase())},"je"),un=d((s,e,n)=>{let t=s.slice(0,e);if(!t.endsWith("."))return;let o=pt(t.slice(0,-1));if(o!=="")return ft(s,n).targets.get(o.toLowerCase())??o},"dn"),je=d((s,e)=>s.toLowerCase().startsWith(e.toLowerCase()),"Be"),lt=d((s,e,n,t)=>{let o=[];for(let r of s)if(je(r,e)&&(o.push(t(r)),o.length>=n))break;return o},"ze"),mn=d((s,e,n)=>{let t=new Map;for(let[o,r]of Object.entries(s.columns))for(let l of r)if(je(l,e)&&!t.has(l)&&(t.set(l,o),t.size>=n))return[...t].map(([i,a])=>({detail:a,kind:"column",label:i}));return[...t].map(([o,r])=>({detail:r,kind:"column",label:o}))},"un"),fn=d((s,e,n)=>{let t=bt(s,e),o=un(s,t.start,n.tables);if(o!==void 0){let a=n.columns[o]??n.columns[o.toLowerCase()]??[];return lt(a,t.text,Te,c=>({detail:o,kind:"column",label:c}))}if(t.text===""&&!rt(s,t.start))return[];let r=lt(n.tables,t.text,Te,a=>({kind:"table",label:a})),l=mn(n,t.text,Te),i=an.flatMap(a=>t.text!==""&&je(a,t.text)&&a.toLowerCase()!==t.text.toLowerCase()?[{kind:"keyword",label:a}]:[]);return(rt(s,t.start)?[...l,...r,...i]:[...r,...l,...i]).slice(0,Te)},"fn"),hn=d((s,e,n)=>{let t=bt(s,e),o=s.slice(0,t.start)+n.label+s.slice(t.end);return{caret:t.start+n.label.length,value:o}},"mn"),pn=["boxSizing","borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textTransform","width","wordSpacing"],bn=d((s,e)=>{let n=globalThis.getComputedStyle(s),t=globalThis.document.createElement("div"),{style:o}=t;o.position="absolute",o.visibility="hidden",o.whiteSpace="pre-wrap",o.overflowWrap="break-word";for(let a of pn)o[a]=n[a];t.textContent=s.value.slice(0,Math.max(0,e));let r=globalThis.document.createElement("span");r.textContent=s.value.slice(Math.max(0,e))||".",t.append(r),globalThis.document.body.append(t);let l=r.offsetLeft-s.scrollLeft,i=r.offsetTop-s.scrollTop;return t.remove(),{left:l,top:i}},"hn"),gn=d((s,e,n)=>{let t=(0,X.c)(16),[o,r]=(0,H.useState)(null),l;t[0]!==s||t[1]!==e?(l=d((N,h)=>{let S=fn(N,h,s);if(S.length===0){r(null);return}let x=e.current,{left:v,top:y}=x===null?{left:0,top:0}:bn(x,h);r(w=>w!==null&&w.active===0&&w.left===v&&w.top===y&&w.suggestions.length===S.length&&w.suggestions.every((E,I)=>{let T=S.at(I);return E.kind===T?.kind&&E.label===T.label&&E.detail===T.detail})?w:{active:0,left:v,suggestions:S,top:y})},"l"),t[0]=s,t[1]=e,t[2]=l):l=t[2];let i=l,a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=d(()=>{r(null)},"c"),t[3]=a):a=t[3];let c=a,m;t[4]===Symbol.for("react.memo_cache_sentinel")?(m=d(N=>{r(h=>{if(h===null)return h;let S=h.suggestions.length,x=(h.active+N+S)%S;return{...h,active:x}})},"d"),t[4]=m):m=t[4];let p=m,f;t[5]!==n||t[6]!==o||t[7]!==e?(f=d(N=>{let h=e.current;if(o===null||h===null)return!1;let S=o.suggestions[N??o.active];if(S===void 0)return!1;let x=hn(h.value,h.selectionStart,S);return n(x.value),r(null),requestAnimationFrame(()=>{let v=e.current;v!==null&&(v.focus(),v.setSelectionRange(x.caret,x.caret))}),!0},"f"),t[5]=n,t[6]=o,t[7]=e,t[8]=f):f=t[8];let b=f,g;t[9]!==b?(g=d(()=>b(),"g"),t[9]=b,t[10]=g):g=t[10];let k=g,q;return t[11]!==k||t[12]!==b||t[13]!==i||t[14]!==o?(q={close:c,commit:k,commitAt:b,move:p,refresh:i,state:o},t[11]=k,t[12]=b,t[13]=i,t[14]=o,t[15]=q):q=t[15],q},"bn"),xn={column:"column",keyword:"keyword",table:"table"},vn=20,yn=d(s=>{let e=(0,X.c)(17),{listboxId:n,onPick:t,state:o}=s,r=J(),l;e[0]!==o?(l=o===null?void 0:{left:o.left,top:o.top+vn},e[0]=o,e[1]=l):l=e[1];let i=l;if(o===null)return null;let a;if(e[2]!==n||e[3]!==t||e[4]!==o.active||e[5]!==o.suggestions||e[6]!==r){let m;e[8]!==n||e[9]!==t||e[10]!==o.active||e[11]!==r?(m=d((p,f)=>(0,u.jsxs)("li",{"aria-selected":f===o.active,className:ie("flex cursor-pointer items-center gap-2 px-2 py-1 text-[13px]",f===o.active?"bg-accent text-accent-foreground":"text-foreground"),"data-testid":"sql-autocomplete-item",id:`${n}-opt-${f.toString()}`,onMouseDown:d(b=>{b.preventDefault(),t(f)},"onMouseDown"),role:"option",children:[(0,u.jsx)("span",{className:"truncate font-mono",children:p.label}),p.detail!==void 0&&(0,u.jsx)("span",{className:"ms-auto truncate text-xs text-muted-foreground",children:p.detail}),(0,u.jsx)("span",{className:"shrink-0 font-mono text-[10px] tracking-wide text-muted-foreground/70 uppercase",children:r(xn[p.kind])})]},`${p.kind}:${p.label}`),"d"),e[8]=n,e[9]=t,e[10]=o.active,e[11]=r,e[12]=m):m=e[12],a=o.suggestions.map(m),e[2]=n,e[3]=t,e[4]=o.active,e[5]=o.suggestions,e[6]=r,e[7]=a}else a=e[7];let c;return e[13]!==n||e[14]!==i||e[15]!==a?(c=(0,u.jsx)("ul",{className:"absolute z-30 max-h-56 w-72 overflow-auto rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-md","data-testid":"sql-autocomplete",id:n,role:"listbox",style:i,children:a}),e[13]=n,e[14]=i,e[15]=a,e[16]=c):c=e[16],c},"vn"),wn=ge(ve.listTables),Sn=ge(ve.readTablePage),qn=d(s=>{let e=(0,X.c)(18),n=Ce(),t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0];let[o,r]=(0,H.useState)(t),l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l={},e[1]=l):l=e[1];let[i,a]=(0,H.useState)(l),c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c={},e[2]=c):c=e[2];let[m,p]=(0,H.useState)(c),f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=new Set,e[3]=f):f=e[3];let b=(0,H.useRef)(f),g,k;e[4]!==n||e[5]!==s?(g=d(()=>{let v={cancelled:!1};return se((async()=>{try{let y=await n.query(wn,{},xe(s));v.cancelled||(r(y.map(Cn)),a({}),p({}),b.current=new Set)}catch{v.cancelled||(r([]),a({}),p({}),b.current=new Set)}})()),()=>{v.cancelled=!0}},"g"),k=[n,s],e[4]=n,e[5]=s,e[6]=g,e[7]=k):(g=e[6],k=e[7]),(0,H.useEffect)(g,k);let q;e[8]!==n||e[9]!==s?(q=d(v=>{b.current.has(v)||(b.current.add(v),se((async()=>{try{let y=await n.query(Sn,{limit:1,offset:0,table:v},xe(s)),{sqlColumns:w}=y;if(w===void 0){b.current.delete(v);return}let E=new Set(w),I=y.columns.filter(T=>!E.has(T));a(T=>({...T,[v]:w})),p(T=>({...T,[v]:I}))}catch{b.current.delete(v)}})()))},"v"),e[8]=n,e[9]=s,e[10]=q):q=e[10];let N=q,h;e[11]!==i||e[12]!==m||e[13]!==o?(h={columns:i,docFields:m,tables:o},e[11]=i,e[12]=m,e[13]=o,e[14]=h):h=e[14];let S=h,x;return e[15]!==N||e[16]!==S?(x={probe:N,schema:S},e[15]=N,e[16]=S,e[17]=x):x=e[17],x},"wn"),Oe=/\b(?:from|join|update|into)\s+([a-z_][\w$]*)|\b([a-z_][\w$]*)\s*\./gi,kn=d(s=>{let e=new Set;Oe.lastIndex=0;let n=Oe.exec(s);for(;n!==null;)e.add(n[1]??n[2]),n=Oe.exec(s);return[...e]},"Cn");function Cn(s){return s.name}d(Cn,"kn");var Nn=d(s=>(s.metaKey||s.ctrlKey)&&!s.shiftKey&&!s.altKey&&s.key.toLowerCase()==="i","Nn"),En=d(s=>{let e=(0,X.c)(44),{inlineEditEnabled:n,onSubmit:t,probe:o,schema:r,setDraft:l}=s,i=(0,H.useId)(),[a,c]=(0,H.useState)(null),m=(0,H.useRef)(null),p=(0,H.useRef)(null),f=(0,H.useRef)(null),b=gn(r,f,l),{close:g,commit:k,commitAt:q,move:N,refresh:h,state:S}=b,x;e[0]!==q?(x=d(P=>{q(P)},"x"),e[0]=q,e[1]=x):x=e[1];let v=x,y;e[2]!==h?(y=d(()=>{let P=f.current;P!==null&&P===document.activeElement&&h(P.value,P.selectionStart)},"y"),e[2]=h,e[3]=y):y=e[3];let w;e[4]!==h||e[5]!==r?(w=[h,r],e[4]=h,e[5]=r,e[6]=w):w=e[6],(0,H.useEffect)(y,w);let E;e[7]!==o||e[8]!==h||e[9]!==l?(E=d(P=>{let{selectionStart:G,value:Z}=P.target;l(Z),c(null);for(let V of kn(Z))o(V);h(Z,G)},"w"),e[7]=o,e[8]=h,e[9]=l,e[10]=E):E=e[10];let I=E,T;e[11]!==h?(T=d(P=>{let G=P.currentTarget;h(G.value,G.selectionStart)},"q"),e[11]=h,e[12]=T):T=e[12];let L=T,C;e[13]!==g||e[14]!==k||e[15]!==N?(C=d(P=>P.key==="ArrowDown"?(P.preventDefault(),N(1),!0):P.key==="ArrowUp"?(P.preventDefault(),N(-1),!0):P.key==="Escape"?(P.preventDefault(),g(),!0):(P.key==="Enter"||P.key==="Tab")&&!P.metaKey&&!P.ctrlKey&&k()?(P.preventDefault(),!0):!1,"E"),e[13]=g,e[14]=k,e[15]=N,e[16]=C):C=e[16];let R=C,_;e[17]!==S||e[18]!==g||e[19]!==n||e[20]!==R||e[21]!==t?(_=d(P=>{if(!(S!==null&&R(P))){if((P.metaKey||P.ctrlKey)&&P.key==="Enter"){P.preventDefault(),t();return}if(n&&Nn(P)){P.preventDefault(),g();let{selectionEnd:G,selectionStart:Z,value:V}=P.currentTarget,[le,ae]=Z===G?[0,V.length]:[Z,G];c({end:ae,start:le,text:V.slice(le,ae)})}}},"L"),e[17]=S,e[18]=g,e[19]=n,e[20]=R,e[21]=t,e[22]=_):_=e[22];let M=_,z;e[23]!==g?(z=d(()=>{requestAnimationFrame(()=>{g()})},"$"),e[23]=g,e[24]=z):z=e[24];let j=z,B;e[25]===Symbol.for("react.memo_cache_sentinel")?(B=d(P=>{let{scrollLeft:G,scrollTop:Z}=P.currentTarget;m.current!==null&&(m.current.scrollTop=Z),p.current!==null&&(p.current.scrollTop=Z,p.current.scrollLeft=G)},"B"),e[25]=B):B=e[25];let W=B,$;e[26]===Symbol.for("react.memo_cache_sentinel")?($=d(P=>{let G=f.current;G===null||P.offset===void 0||(G.focus(),G.setSelectionRange(P.offset,P.offset+(P.length??0)))},"P"),e[26]=$):$=e[26];let K=$,O;e[27]===Symbol.for("react.memo_cache_sentinel")?(O=d(()=>{c(null),f.current?.focus()},"M"),e[27]=O):O=e[27];let D=O,A;e[28]!==a||e[29]!==l?(A=d(P=>{let G=f.current;if(a===null||G===null)return;let{end:Z,start:V,text:le}=a;if(G.value.slice(V,Z)!==le){c(null);return}l(G.value.slice(0,V)+P+G.value.slice(Z)),c(null),G.focus(),requestAnimationFrame(()=>{G.setSelectionRange(V,V+P.length)})},"D"),e[28]=a,e[29]=l,e[30]=A):A=e[30];let Q=A,F;e[31]!==I||e[32]!==j||e[33]!==M||e[34]!==L?(F={onBlur:j,onChange:I,onKeyDown:M,onScroll:W,onSelect:L},e[31]=I,e[32]=j,e[33]=M,e[34]=L,e[35]=F):F=e[35];let ee;return e[36]!==Q||e[37]!==S||e[38]!==g||e[39]!==a||e[40]!==i||e[41]!==v||e[42]!==F?(ee={acceptInlineEdit:Q,autocompleteState:S,closeAutocomplete:g,closeInlineEdit:D,inlineEdit:a,handlers:F,listboxId:i,onPickSuggestion:v,editorRef:f,gutterRef:m,overlayRef:p,revealDiagnostic:K},e[36]=Q,e[37]=S,e[38]=g,e[39]=a,e[40]=i,e[41]=v,e[42]=F,e[43]=ee):ee=e[43],ee},"En"),Tn="lunora-studio-sql-tabs",Ln="lunora-studio-sql-active-tab",He=12,qe=d((s="",e="")=>({activeId:null,id:Me("tab"),name:e,sql:s}),"Se"),In=d(()=>Ee(Ln,""),"Rn"),Rn=d(s=>{let e=(0,X.c)(16),[n,t]=Ne(Tn),[o,r]=In(),[l]=(0,H.useState)(s),i,a;e[0]!==l||e[1]!==t||e[2]!==n.length?(i=d(()=>{n.length===0&&t([l])},"i"),a=[l,t,n.length],e[0]=l,e[1]=t,e[2]=n.length,e[3]=i,e[4]=a):(i=e[3],a=e[4]),(0,H.useEffect)(i,a);let c;e[5]!==l||e[6]!==n?(c=n.length===0?[l]:n,e[5]=l,e[6]=n,e[7]=c):c=e[7];let m=c,p;e[8]!==o||e[9]!==m?(p=m.some(g=>g.id===o)?o:m[0]?.id??"",e[8]=o,e[9]=m,e[10]=p):p=e[10];let f=p,b;return e[11]!==f||e[12]!==r||e[13]!==t||e[14]!==m?(b={activeId:f,setActiveId:r,setTabs:t,tabs:m},e[11]=f,e[12]=r,e[13]=t,e[14]=m,e[15]=b):b=e[15],b},"In"),gt=d(s=>s.activeId===null&&s.sql.trim()!=="","rt"),_n=d((s,e)=>[...s,e].slice(-He),"Ln"),Dn=d((s,e,n)=>{let t=s.findIndex(r=>r.id===e);if(t===-1)return{activeId:s[0]?.id??"",tabs:[...s]};let o=s.filter(r=>r.id!==e);if(o.length===0){let r=n();return{activeId:r.id,tabs:[r]}}return{activeId:o[Math.min(t,o.length-1)].id,tabs:o}},"An"),Mn=d((s,e)=>{let n=s.filter(t=>t.id===e);return n.length===0?{activeId:s[0]?.id??"",tabs:[...s]}:{activeId:e,tabs:n}},"_n"),An=d((s,e,n)=>{let t=s.findIndex(r=>r.id===e);if(t===-1)return{activeId:n,tabs:[...s]};let o=s.slice(0,t+1);return{activeId:o.some(r=>r.id===n)?n:e,tabs:o}},"Dn"),Pn=d(s=>{let e=s();return{activeId:e.id,tabs:[e]}},"On"),$n=d((s,e,n)=>{if(s==="others")return e.filter(t=>t.id!==n);if(s==="right"){let t=e.findIndex(o=>o.id===n);return t===-1?[]:e.slice(t+1)}return[...e]},"Mn"),st={error:null,pane:"results",result:null,running:!1},On=d(s=>{let e=(0,X.c)(69),{activeId:n,setActiveId:t,setTabs:o,tabs:r}=Rn(s),l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={},e[0]=l):l=e[0];let[i,a]=(0,H.useState)(l),[c,m]=(0,H.useState)(null),[p,f]=(0,H.useState)(null),b;e[1]!==n||e[2]!==r?(b=r.find(Y=>Y.id===n)??r[0]??qe(),e[1]=n,e[2]=r,e[3]=b):b=e[3];let g=b,k=i[g.id]??st,q;e[4]!==g.id||e[5]!==o?(q=d(Y=>{o(te=>te.map(ne=>ne.id===g.id?{...ne,...Y}:ne))},"v"),e[4]=g.id,e[5]=o,e[6]=q):q=e[6];let N=q,h;e[7]!==g.id?(h=d(Y=>{a(te=>{let ne=te[g.id]??st;return{...te,[g.id]:{...ne,...Y}}})},"p"),e[7]=g.id,e[8]=h):h=e[8];let S=h,x;e[9]!==t||e[10]!==o||e[11]!==r.length?(x=d(Y=>{if(r.length>=He)return!1;let te=qe(Y);return o(ne=>_n(ne,te)),t(te.id),!0},"x"),e[9]=t,e[10]=o,e[11]=r.length,e[12]=x):x=e[12];let v=x,y;e[13]!==v?(y=d(()=>{v("")},"y"),e[13]=v,e[14]=y):y=e[14];let w=y,E;e[15]!==t||e[16]!==o?(E=d(Y=>{m(null),f(null),o(Y.tabs),t(Y.activeId);let te=new Set(Y.tabs.map(zn));a(ne=>Object.fromEntries(Object.entries(ne).filter(U=>{let[oe]=U;return te.has(oe)})))},"w"),e[15]=t,e[16]=o,e[17]=E):E=e[17];let I=E,T;e[18]!==I||e[19]!==r?(T=d(Y=>{I(Dn(r,Y,qe))},"q"),e[18]=I,e[19]=r,e[20]=T):T=e[20];let L=T,C;e[21]!==n||e[22]!==I||e[23]!==r?(C=d((Y,te)=>{I(Y==="others"?Mn(r,te):Y==="right"?An(r,te,n):Pn(qe))},"E"),e[21]=n,e[22]=I,e[23]=r,e[24]=C):C=e[24];let R=C,_;e[25]!==R||e[26]!==c||e[27]!==r?(_=d(Y=>{c!==null&&($n(Y,r,c.id).some(jn)?f(Y):R(Y,c.id))},"L"),e[25]=R,e[26]=c,e[27]=r,e[28]=_):_=e[28];let M=_,z;e[29]===Symbol.for("react.memo_cache_sentinel")?(z=d((Y,te)=>{te.preventDefault(),f(null),m({id:Y,x:te.clientX,y:te.clientY})},"$"),e[29]=z):z=e[29];let j=z,B;e[30]===Symbol.for("react.memo_cache_sentinel")?(B=d(()=>{m(null),f(null)},"B"),e[30]=B):B=e[30];let W=B,$;e[31]===Symbol.for("react.memo_cache_sentinel")?($=d(Y=>{Y.preventDefault(),m(null),f(null)},"P"),e[31]=$):$=e[31];let K=$,O;e[32]!==M?(O=d(()=>{M("others")},"M"),e[32]=M,e[33]=O):O=e[33];let D=O,A;e[34]!==M?(A=d(()=>{M("right")},"D"),e[34]=M,e[35]=A):A=e[35];let Q=A,F;e[36]!==M?(F=d(()=>{M("all")},"j"),e[36]=M,e[37]=F):F=e[37];let ee=F,P;e[38]!==R||e[39]!==p||e[40]!==c?(P=d(()=>{c!==null&&p!==null&&R(p,c.id),f(null)},"O"),e[38]=R,e[39]=p,e[40]=c,e[41]=P):P=e[41];let G=P,Z;e[42]===Symbol.for("react.memo_cache_sentinel")?(Z=d(()=>{f(null)},"X"),e[42]=Z):Z=e[42];let V=Z,le;e[43]!==c?(le=c===null?void 0:{left:c.x,top:c.y},e[43]=c,e[44]=le):le=e[44];let ae=le,ue;e[45]!==o?(ue=d(Y=>{o(te=>te.map(ne=>ne.activeId===Y?{...ne,activeId:null}:ne))},"pe"),e[45]=o,e[46]=ue):ue=e[46];let pe=ue,me;e[47]!==o?(me=d((Y,te)=>{o(ne=>ne.map(U=>U.id===Y?{...U,name:te}:U))},"he"),e[47]=o,e[48]=me):me=e[48];let be=me,fe;return e[49]!==g||e[50]!==n||e[51]!==w||e[52]!==L||e[53]!==G||e[54]!==ee||e[55]!==D||e[56]!==Q||e[57]!==v||e[58]!==k||e[59]!==S||e[60]!==N||e[61]!==p||e[62]!==be||e[63]!==t||e[64]!==c||e[65]!==ae||e[66]!==r||e[67]!==pe?(fe={activeTab:g,activeTabId:n,addEditorTab:w,cancelBulk:V,closeEditorTab:L,closeTabMenu:W,confirmBulk:G,menuStyle:ae,onBackdropContextMenu:K,onCloseAll:ee,onCloseOthers:D,onCloseToRight:Q,openEditorTab:v,openTabMenu:j,output:k,patchActiveOutput:S,patchActiveTab:N,pendingBulk:p,renameTab:be,setActiveTabId:t,tabMenu:c,tabs:r,unlinkQuery:pe},e[49]=g,e[50]=n,e[51]=w,e[52]=L,e[53]=G,e[54]=ee,e[55]=D,e[56]=Q,e[57]=v,e[58]=k,e[59]=S,e[60]=N,e[61]=p,e[62]=be,e[63]=t,e[64]=c,e[65]=ae,e[66]=r,e[67]=pe,e[68]=fe):fe=e[68],fe},"$n");function zn(s){return s.id}d(zn,"Bn");function jn(s){return gt(s)}d(jn,"Pn");var Hn="lunora-studio-sql-queries",he="lunora-studio-sql-history",Bn="lunora-studio-sql-remember-history",Wn=25,Fn=d(s=>{let e=(0,X.c)(44),{loadIntoActiveTab:n,unlinkQuery:t}=s,o=J(),[r,l]=Ne(Hn),[i,a]=Ee(Bn,!1),[c,m]=Ne(he,i?"local":"session"),p,f;e[0]!==i?(p=d(()=>{i||we(he,"local")},"m"),f=[i],e[0]=i,e[1]=p,e[2]=f):(p=e[1],f=e[2]),(0,H.useEffect)(p,f);let[b,g]=(0,H.useState)(""),k=(0,H.useRef)(null),q;e[3]!==m?(q=d(D=>{m(A=>A[0]?.sql===D?A:[{at:Date.now(),sql:D},...A.filter(Q=>Q.sql!==D)].slice(0,Wn))},"v"),e[3]=m,e[4]=q):q=e[4];let N=q,h;e[5]!==n||e[6]!==l||e[7]!==o?(h=d(()=>{let D={id:Me("q"),name:o("Untitled query"),sql:""};l(A=>[D,...A]),n("",D.id)},"p"),e[5]=n,e[6]=l,e[7]=o,e[8]=h):h=e[8];let S=h,x;e[9]!==n||e[10]!==r?(x=d(D=>{let A=r.find(Q=>Q.id===D);A!==void 0&&(n(A.sql,D),k.current?.querySelector(`[data-testid="sql-query-${D}"]`)?.scrollIntoView({block:"nearest"}))},"x"),e[9]=n,e[10]=r,e[11]=x):x=e[11];let v=x,y;e[12]!==l||e[13]!==t?(y=d(D=>{l(A=>A.filter(Q=>Q.id!==D)),t(D)},"y"),e[12]=l,e[13]=t,e[14]=y):y=e[14];let w=y,E;e[15]!==n?(E=d(D=>{n(D.currentTarget.dataset.sql??"",null)},"w"),e[15]=n,e[16]=E):E=e[16];let I=E,T;e[17]!==n?(T=d(D=>{n(D.currentTarget.dataset.sql??"",null)},"q"),e[17]=n,e[18]=T):T=e[18];let L=T,C;e[19]!==m?(C=d(()=>{m([]),we(he,"local"),we(he,"session")},"E"),e[19]=m,e[20]=C):C=e[20];let R=C,_;e[21]!==c||e[22]!==a?(_=d(D=>{Ue(he,c,D?"local":"session"),D||we(he,"local"),a(D)},"L"),e[21]=c,e[22]=a,e[23]=_):_=e[23];let M=_,z;e[24]===Symbol.for("react.memo_cache_sentinel")?(z=d(D=>{g(D.target.value)},"$"),e[24]=z):z=e[24];let j=z,B;e[25]!==l?(B=d((D,A,Q)=>{l(F=>F.map(ee=>ee.id===D?{id:ee.id,name:A,sql:ee.sql,...Q===""?{}:{description:Q}}:ee))},"B"),e[25]=l,e[26]=B):B=e[26];let W=B,$;e[27]!==l?($=d((D,A)=>{l(Q=>Q.map(F=>F.id===D?{...F,sql:A}:F))},"P"),e[27]=l,e[28]=$):$=e[28];let K=$,O;return e[29]!==R||e[30]!==w||e[31]!==c||e[32]!==L||e[33]!==I||e[34]!==S||e[35]!==r||e[36]!==N||e[37]!==i||e[38]!==W||e[39]!==b||e[40]!==v||e[41]!==M||e[42]!==K?(O={clearHistory:R,deleteQuery:w,history:c,listRef:k,loadFromHistory:L,loadTemplate:I,newQuery:S,onSearchChange:j,queries:r,recordHistory:N,rememberHistory:i,renameQuery:W,search:b,selectQuery:v,setRememberHistory:M,updateQuerySql:K},e[29]=R,e[30]=w,e[31]=c,e[32]=L,e[33]=I,e[34]=S,e[35]=r,e[36]=N,e[37]=i,e[38]=W,e[39]=b,e[40]=v,e[41]=M,e[42]=K,e[43]=O):O=e[43],O},"Qn"),Be="p-3 font-mono text-xs leading-5 whitespace-pre-wrap break-words",Qn=d((s,e)=>{let n=[];for(let o of s){if(o.offset===void 0||o.length===void 0||o.length<=0)continue;let r=Math.max(0,Math.min(o.offset,e)),l=Math.max(r,Math.min(o.offset+o.length,e));r!==l&&n.push({end:l,severity:o.severity,start:r})}n.sort((o,r)=>o.start-r.start);let t=[];for(let o of n)o.start>=(t.at(-1)?.end??0)&&t.push(o);return t},"jn"),Kn=d(s=>{let e=(0,X.c)(51),{rpc:n,failed:t,onGenerated:o}=s,r=J(),[l,i]=(0,H.useState)("");if(n.unavailable)return null;let a;e[0]!==n?(a=n.pending("sql"),e[0]=n,e[1]=a):a=e[1];let c=a,m;if(e[2]!==t||e[3]!==o||e[4]!==c||e[5]!==l||e[6]!==n||e[7]!==r){let p=n.reason("sql"),f;e[9]!==t||e[10]!==o||e[11]!==l||e[12]!==n?(f=d(L=>{let C=l.trim();C===""&&!L||se((async()=>{let R=await n.generate(C===""?"fix the failing statement":C,L?t:void 0);R!==void 0&&o(R)})())},"f"),e[9]=t,e[10]=o,e[11]=l,e[12]=n,e[13]=f):f=e[13];let b=f,g;e[14]!==r?(g=r("Describe the query you want"),e[14]=r,e[15]=g):g=e[15];let k;e[16]===Symbol.for("react.memo_cache_sentinel")?(k=d(L=>{i(L.target.value)},"R"),e[16]=k):k=e[16];let q;e[17]!==b?(q=d(L=>{L.key==="Enter"&&(L.preventDefault(),b(!1))},"v"),e[17]=b,e[18]=q):q=e[18];let N;e[19]!==r?(N=r("Describe the query you want"),e[19]=r,e[20]=N):N=e[20];let h;e[21]!==c||e[22]!==l||e[23]!==g||e[24]!==q||e[25]!==N?(h=(0,u.jsx)(ye,{"aria-label":g,className:"h-7 flex-1 text-xs","data-testid":"sql-assistant-prompt",disabled:c,onChange:k,onKeyDown:q,placeholder:N,value:l}),e[21]=c,e[22]=l,e[23]=g,e[24]=q,e[25]=N,e[26]=h):h=e[26];let S=c&&"opacity-60",x;e[27]!==S?(x=ie("rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",S),e[27]=S,e[28]=x):x=e[28];let v;e[29]!==c||e[30]!==l?(v=c||l.trim()==="",e[29]=c,e[30]=l,e[31]=v):v=e[31];let y;e[32]!==b?(y=d(()=>{b(!1)},"y"),e[32]=b,e[33]=y):y=e[33];let w;e[34]!==c||e[35]!==r?(w=r(c?"Thinking\u2026":"Draft SQL"),e[34]=c,e[35]=r,e[36]=w):w=e[36];let E;e[37]!==x||e[38]!==v||e[39]!==y||e[40]!==w?(E=(0,u.jsx)("button",{className:x,"data-testid":"sql-assistant-generate",disabled:v,onClick:y,type:"button",children:w}),e[37]=x,e[38]=v,e[39]=y,e[40]=w,e[41]=E):E=e[41];let I;e[42]!==t||e[43]!==c||e[44]!==b||e[45]!==r?(I=t!==void 0&&(0,u.jsx)("button",{className:"rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"sql-assistant-fix",disabled:c,onClick:d(()=>{b(!0)},"onClick"),type:"button",children:r("Fix this")}),e[42]=t,e[43]=c,e[44]=b,e[45]=r,e[46]=I):I=e[46];let T;e[47]!==E||e[48]!==I||e[49]!==h?(T=(0,u.jsxs)("div",{className:"flex items-center gap-2",children:[h,E,I]}),e[47]=E,e[48]=I,e[49]=h,e[50]=T):T=e[50],m=(0,u.jsxs)("div",{className:"flex flex-col gap-1 border-b border-border px-3 py-2","data-testid":"sql-assistant",children:[T,p!==void 0&&(0,u.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"sql-assistant-reason",role:"status",children:Ae(p,r)})]}),e[2]=t,e[3]=o,e[4]=c,e[5]=l,e[6]=n,e[7]=r,e[8]=m}else m=e[8];return m},"zn"),Un=d(s=>{let e=(0,X.c)(8),{diagnostics:n,draft:t,scrollRef:o}=s,r,l;if(e[0]!==n||e[1]!==t){l=Symbol.for("react.early_return_sentinel");e:{let c=Qn(n,t.length);if(c.length===0){l=null;break e}r=[];let m=0;for(let[p,f]of c.entries())f.start>m&&r.push(t.slice(m,f.start)),r.push((0,u.jsx)("span",{className:ie("decoration-wavy underline underline-offset-4",f.severity==="error"?"decoration-destructive":"decoration-amber-500"),children:t.slice(f.start,f.end)},`${f.start.toString()}-${p.toString()}`)),m=f.end;r.push(t.slice(m))}e[0]=n,e[1]=t,e[2]=r,e[3]=l}else r=e[2],l=e[3];if(l!==Symbol.for("react.early_return_sentinel"))return l;let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=ie("pointer-events-none absolute inset-0 overflow-hidden text-transparent",Be),e[4]=i):i=e[4];let a;return e[5]!==r||e[6]!==o?(a=(0,u.jsx)("div",{"aria-hidden":"true",className:i,"data-testid":"sql-diagnostics-overlay",ref:o,children:r}),e[5]=r,e[6]=o,e[7]=a):a=e[7],a},"Kn"),Gn={gate:"read-only",plan:"plan",schema:"schema",syntax:"syntax"},Vn=d(s=>{let e=(0,X.c)(10),{diagnostics:n,onSelect:t}=s,o=J();if(n.length===0)return null;let r;e[0]!==o?(r=o("SQL problems"),e[0]=o,e[1]=r):r=e[1];let l;if(e[2]!==n||e[3]!==t){let a;e[5]!==t?(a=d((c,m)=>(0,u.jsx)("li",{children:(0,u.jsxs)("button",{className:"flex w-full items-start gap-2 px-3 py-1 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-problem",onClick:d(()=>{t(c)},"onClick"),type:"button",children:[(0,u.jsx)("span",{className:ie("mt-px shrink-0 rounded px-1 font-mono text-[10px] uppercase",c.severity==="error"?"bg-destructive/15 text-destructive":"bg-amber-500/15 text-amber-600"),children:Gn[c.source]}),(0,u.jsx)("span",{className:"min-w-0 text-muted-foreground",children:c.message})]})},`${c.source}-${(c.offset??m).toString()}-${m.toString()}`),"c"),e[5]=t,e[6]=a):a=e[6],l=n.map(a),e[2]=n,e[3]=t,e[4]=l}else l=e[4];let i;return e[7]!==r||e[8]!==l?(i=(0,u.jsx)("ul",{"aria-label":r,className:"max-h-24 shrink-0 overflow-y-auto border-t border-border bg-muted/30","data-testid":"sql-problems",children:l}),e[7]=r,e[8]=l,e[9]=i):i=e[9],i},"Yn"),Xn=d(s=>(s.endsWith(`
12
+ `)?s.slice(0,-1):s).split(`
13
+ `),"Gn"),Yn=d((s,e)=>{let n=[],t=1,o=1;for(let r of $e(s,e,{ignoreNewlineAtEof:!0}))for(let l of Xn(r.value))r.added?(n.push({after:o,kind:"added",text:l}),o+=1):r.removed?(n.push({before:t,kind:"removed",text:l}),t+=1):(n.push({after:o,before:t,kind:"context",text:l}),t+=1,o+=1);return n},"Vn"),Jn={added:"bg-emerald-500/10 text-emerald-700 dark:text-emerald-400",context:"text-muted-foreground",removed:"bg-destructive/10 text-destructive"},Zn={added:"+",context:" ",removed:"-"},eo=d(s=>{let e=(0,X.c)(11),{lines:n}=s,t=J(),o;e[0]!==t?(o=t("Proposed edit"),e[0]=t,e[1]=o):o=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=ie("max-h-48 overflow-auto rounded-md border border-border bg-background",Be),e[2]=r):r=e[2];let l;if(e[3]!==n||e[4]!==t){let a;e[6]!==t?(a=d(c=>(0,u.jsxs)("li",{className:ie("flex gap-2",Jn[c.kind]),"data-kind":c.kind,children:[(0,u.jsx)("span",{"aria-hidden":"true",className:"shrink-0 select-none opacity-60",children:Zn[c.kind]}),c.kind!=="context"&&(0,u.jsx)("span",{className:"sr-only",children:c.kind==="added"?t("Added"):t("Removed")}),(0,u.jsx)("span",{className:"min-w-0",children:c.text===""?"\xA0":c.text})]},`${String(c.before)}:${String(c.after)}`),"c"),e[6]=t,e[7]=a):a=e[7],l=n.map(a),e[3]=n,e[4]=t,e[5]=l}else l=e[5];let i;return e[8]!==o||e[9]!==l?(i=(0,u.jsx)("ul",{"aria-label":o,className:r,"data-testid":"sql-inline-diff",children:l}),e[8]=o,e[9]=l,e[10]=i):i=e[10],i},"Zn"),Le="rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",to=d(s=>{let e=(0,X.c)(41),{onAccept:n,onCancel:t,rpc:o,source:r,whole:l}=s,i=J(),a=(0,H.useRef)(null),c=(0,H.useRef)(null),[m,p]=(0,H.useState)(""),[f,b]=(0,H.useState)(null),g,k;if(e[0]!==f?(g=d(()=>{f===null?a.current?.focus():c.current?.focus()},"g"),k=[f],e[0]=f,e[1]=g,e[2]=k):(g=e[1],k=e[2]),(0,H.useEffect)(g,k),o.unavailable)return null;let q;e[3]!==o?(q=o.pending("sql"),e[3]=o,e[4]=q):q=e[4];let N=q,h;if(e[5]!==m||e[6]!==n||e[7]!==t||e[8]!==N||e[9]!==f||e[10]!==o||e[11]!==r||e[12]!==i||e[13]!==l){let S=o.reason("sql"),x;e[15]!==m||e[16]!==o||e[17]!==r?(x=d(()=>{let R=m.trim();R===""||r.trim()===""||se((async()=>{let _=await o.rewrite(R,r);_!==void 0&&b(_)})())},"x"),e[15]=m,e[16]=o,e[17]=r,e[18]=x):x=e[18];let v=x,y;e[19]!==t?(y=d(R=>{R.key==="Escape"&&(R.preventDefault(),t())},"y"),e[19]=t,e[20]=y):y=e[20];let w=y,E;e[21]!==i||e[22]!==l?(E=i(l?"Whole query":"Selection"),e[21]=i,e[22]=l,e[23]=E):E=e[23];let I;e[24]!==E?(I=(0,u.jsx)("span",{className:"shrink-0 rounded bg-muted px-1 font-mono text-[10px] uppercase text-muted-foreground","data-testid":"sql-inline-edit-scope",children:E}),e[24]=E,e[25]=I):I=e[25];let T;e[26]!==m||e[27]!==n||e[28]!==t||e[29]!==w||e[30]!==N||e[31]!==f||e[32]!==v||e[33]!==i?(T=f===null?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(ye,{"aria-label":i("Tell the model what to change"),className:"h-7 flex-1 text-xs","data-testid":"sql-inline-edit-prompt",disabled:N,onChange:d(R=>{p(R.target.value)},"onChange"),onKeyDown:d(R=>{if(R.key==="Enter"){R.preventDefault(),v();return}w(R)},"onKeyDown"),placeholder:i("Tell the model what to change"),ref:a,value:m}),(0,u.jsx)("button",{className:ie(Le,N&&"opacity-60"),"data-testid":"sql-inline-edit-submit",disabled:N||m.trim()==="",onClick:v,onKeyDown:w,type:"button",children:i(N?"Thinking\u2026":"Rewrite")}),(0,u.jsx)("button",{className:Le,"data-testid":"sql-inline-edit-cancel",onClick:t,onKeyDown:w,type:"button",children:i("Cancel")})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("span",{className:"flex-1 text-xs text-muted-foreground",children:i("Proposed edit")}),(0,u.jsx)("button",{className:Le,"data-testid":"sql-inline-edit-accept",onClick:d(()=>{n(f)},"onClick"),onKeyDown:w,ref:c,type:"button",children:i("Accept")}),(0,u.jsx)("button",{className:Le,"data-testid":"sql-inline-edit-reject",onClick:d(()=>{b(null)},"onClick"),onKeyDown:w,type:"button",children:i("Reject")})]}),e[26]=m,e[27]=n,e[28]=t,e[29]=w,e[30]=N,e[31]=f,e[32]=v,e[33]=i,e[34]=T):T=e[34];let L;e[35]!==I||e[36]!==T?(L=(0,u.jsxs)("div",{className:"flex items-center gap-2",children:[I,T]}),e[35]=I,e[36]=T,e[37]=L):L=e[37];let C;e[38]!==f||e[39]!==r?(C=f!==null&&(0,u.jsx)(eo,{lines:Yn(r,f)}),e[38]=f,e[39]=r,e[40]=C):C=e[40],h=(0,u.jsxs)("div",{className:"flex flex-col gap-1 border-b border-border bg-muted/20 px-3 py-2","data-testid":"sql-inline-edit",children:[L,C,S!==void 0&&(0,u.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"sql-inline-edit-reason",role:"status",children:Ae(S,i)})]}),e[5]=m,e[6]=n,e[7]=t,e[8]=N,e[9]=f,e[10]=o,e[11]=r,e[12]=i,e[13]=l,e[14]=h}else h=e[14];return h},"es"),no={minWidth:"2.75rem",paddingInline:"0.5rem"},oo=d(s=>{let e=(0,X.c)(75),{rpc:n,autocomplete:t,diagnostics:o,draft:r,failed:l,handlers:i,editorRef:a,gutterRef:c,inlineEdit:m,listboxId:p,onAcceptInlineEdit:f,onCancelInlineEdit:b,onGenerated:g,onPickSuggestion:k,onRevealDiagnostic:q,overlayRef:N}=s,h=J(),S,x,v,y,w,E,I,T,L;if(e[0]!==r||e[1]!==l||e[2]!==c||e[3]!==m||e[4]!==f||e[5]!==b||e[6]!==g||e[7]!==n){let A=r.split(`
14
+ `).length;I="flex min-h-0 min-w-0 flex-1 flex-col",e[17]!==l||e[18]!==g||e[19]!==n?(T=(0,u.jsx)(Kn,{failed:l,onGenerated:g,rpc:n}),e[17]=l,e[18]=g,e[19]=n,e[20]=T):T=e[20],e[21]!==r.length||e[22]!==m||e[23]!==f||e[24]!==b||e[25]!==n?(L=m!==null&&(0,u.jsx)(to,{onAccept:f,onCancel:b,rpc:n,source:m.text,whole:m.start===0&&m.end===r.length},`${m.start.toString()}-${m.end.toString()}`),e[21]=r.length,e[22]=m,e[23]=f,e[24]=b,e[25]=n,e[26]=L):L=e[26],E="flex min-h-0 min-w-0 flex-1",S="true",x="shrink-0 select-none overflow-hidden border-e border-border bg-muted/30 py-3 text-end font-mono text-xs leading-5 text-muted-foreground/60",v=c,y=no,w=Array.from({length:A},ro),e[0]=r,e[1]=l,e[2]=c,e[3]=m,e[4]=f,e[5]=b,e[6]=g,e[7]=n,e[8]=S,e[9]=x,e[10]=v,e[11]=y,e[12]=w,e[13]=E,e[14]=I,e[15]=T,e[16]=L}else S=e[8],x=e[9],v=e[10],y=e[11],w=e[12],E=e[13],I=e[14],T=e[15],L=e[16];let C;e[27]!==S||e[28]!==x||e[29]!==v||e[30]!==y||e[31]!==w?(C=(0,u.jsx)("div",{"aria-hidden":S,className:x,ref:v,style:y,children:w}),e[27]=S,e[28]=x,e[29]=v,e[30]=y,e[31]=w,e[32]=C):C=e[32];let R;e[33]!==o||e[34]!==r||e[35]!==N?(R=(0,u.jsx)(Un,{diagnostics:o,draft:r,scrollRef:N}),e[33]=o,e[34]=r,e[35]=N,e[36]=R):R=e[36];let _;e[37]!==t||e[38]!==p?(_=t===null?void 0:`${p}-opt-${t.active.toString()}`,e[37]=t,e[38]=p,e[39]=_):_=e[39];let M=t===null?void 0:p,z=t!==null,j;e[40]!==h?(j=h("SQL query"),e[40]=h,e[41]=j):j=e[41];let B;e[42]!==r||e[43]!==a||e[44]!==i.onBlur||e[45]!==i.onChange||e[46]!==i.onKeyDown||e[47]!==i.onScroll||e[48]!==i.onSelect||e[49]!==_||e[50]!==M||e[51]!==z||e[52]!==j?(B=(0,u.jsx)("textarea",{"aria-activedescendant":_,"aria-autocomplete":"list","aria-controls":M,"aria-expanded":z,"aria-label":j,className:`relative size-full resize-none bg-transparent outline-none ${Be}`,"data-testid":"sql-input",onBlur:i.onBlur,onChange:i.onChange,onKeyDown:i.onKeyDown,onScroll:i.onScroll,onSelect:i.onSelect,placeholder:"SELECT * FROM \u2026",ref:a,role:"combobox",spellCheck:!1,value:r}),e[42]=r,e[43]=a,e[44]=i.onBlur,e[45]=i.onChange,e[46]=i.onKeyDown,e[47]=i.onScroll,e[48]=i.onSelect,e[49]=_,e[50]=M,e[51]=z,e[52]=j,e[53]=B):B=e[53];let W;e[54]!==t||e[55]!==p||e[56]!==k?(W=(0,u.jsx)(yn,{listboxId:p,onPick:k,state:t}),e[54]=t,e[55]=p,e[56]=k,e[57]=W):W=e[57];let $;e[58]!==R||e[59]!==B||e[60]!==W?($=(0,u.jsxs)("div",{className:"relative min-w-0 flex-1 bg-background",children:[R,B,W]}),e[58]=R,e[59]=B,e[60]=W,e[61]=$):$=e[61];let K;e[62]!==C||e[63]!==$||e[64]!==E?(K=(0,u.jsxs)("div",{className:E,children:[C,$]}),e[62]=C,e[63]=$,e[64]=E,e[65]=K):K=e[65];let O;e[66]!==o||e[67]!==q?(O=(0,u.jsx)(Vn,{diagnostics:o,onSelect:q}),e[66]=o,e[67]=q,e[68]=O):O=e[68];let D;return e[69]!==K||e[70]!==O||e[71]!==I||e[72]!==T||e[73]!==L?(D=(0,u.jsxs)("div",{className:I,children:[T,L,K,O]}),e[69]=K,e[70]=O,e[71]=I,e[72]=T,e[73]=L,e[74]=D):D=e[74],D},"ns");function ro(s,e){return(0,u.jsx)("div",{children:e+1},e)}d(ro,"ss");var lo=d(s=>{let e=(0,X.c)(62),{onCancel:n,onSave:t,query:o,rpc:r}=s,l=J(),[i,a]=(0,H.useState)(o.name),[c,m]=(0,H.useState)(o.description??""),p;e[0]!==o.sql||e[1]!==r?(p=r!==void 0&&!r.unavailable&&o.sql.trim()!=="",e[0]=o.sql,e[1]=r,e[2]=p):p=e[2];let f=p,b;e[3]!==r?(b=r?.pending("name"),e[3]=r,e[4]=b):b=e[4];let g=b===!0,k;e[5]!==r?(k=r?.reason("name"),e[5]=r,e[6]=k):k=e[6];let q=k,N;e[7]!==c||e[8]!==i||e[9]!==o.sql||e[10]!==r?(N=d(()=>{if(r===void 0)return;let O=i,D=c;se((async()=>{let A=await r.nameQuery(o.sql);A!==void 0&&(a(Q=>Q===O?A.title:Q),m(Q=>Q===D?A.description:Q))})())},"S"),e[7]=c,e[8]=i,e[9]=o.sql,e[10]=r,e[11]=N):N=e[11];let h=N,S;e[12]!==c||e[13]!==i||e[14]!==t?(S=d(O=>{O.preventDefault();let D=i.trim();D!==""&&t(D,c.trim())},"N"),e[12]=c,e[13]=i,e[14]=t,e[15]=S):S=e[15];let x=S,v=`sql-query-rename-${o.id}`,y;e[16]!==l?(y=l("Query name"),e[16]=l,e[17]=y):y=e[17];let w;e[18]===Symbol.for("react.memo_cache_sentinel")?(w=d(O=>{a(O.target.value)},"C"),e[18]=w):w=e[18];let E;e[19]!==l?(E=l("Query name"),e[19]=l,e[20]=E):E=e[20];let I;e[21]!==i||e[22]!==y||e[23]!==E?(I=(0,u.jsx)(ye,{"aria-label":y,autoFocus:!0,className:"h-7 text-xs","data-testid":"sql-query-name",onChange:w,placeholder:E,value:i}),e[21]=i,e[22]=y,e[23]=E,e[24]=I):I=e[24];let T;e[25]!==l?(T=l("Query description"),e[25]=l,e[26]=T):T=e[26];let L;e[27]===Symbol.for("react.memo_cache_sentinel")?(L=d(O=>{m(O.target.value)},"T"),e[27]=L):L=e[27];let C;e[28]!==l?(C=l("Query description"),e[28]=l,e[29]=C):C=e[29];let R;e[30]!==c||e[31]!==T||e[32]!==C?(R=(0,u.jsx)(ye,{"aria-label":T,className:"h-7 text-xs","data-testid":"sql-query-description",onChange:L,placeholder:C,value:c}),e[30]=c,e[31]=T,e[32]=C,e[33]=R):R=e[33];let _;e[34]!==l?(_=l("Save"),e[34]=l,e[35]=_):_=e[35];let M;e[36]!==_?(M=(0,u.jsx)("button",{className:"rounded-md border border-border px-2 py-0.5 text-[11px] outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"sql-query-rename-save",type:"submit",children:_}),e[36]=_,e[37]=M):M=e[37];let z;e[38]!==l?(z=l("Cancel"),e[38]=l,e[39]=z):z=e[39];let j;e[40]!==n||e[41]!==z?(j=(0,u.jsx)("button",{className:"rounded-md px-2 py-0.5 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:text-foreground","data-testid":"sql-query-rename-cancel",onClick:n,type:"button",children:z}),e[40]=n,e[41]=z,e[42]=j):j=e[42];let B;e[43]!==f||e[44]!==g||e[45]!==h||e[46]!==l?(B=f&&(0,u.jsx)("button",{className:"ms-auto rounded-md border border-border px-2 py-0.5 text-[11px] outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"sql-query-suggest-name",disabled:g,onClick:h,type:"button",children:l(g?"Thinking\u2026":"Suggest")}),e[43]=f,e[44]=g,e[45]=h,e[46]=l,e[47]=B):B=e[47];let W;e[48]!==M||e[49]!==j||e[50]!==B?(W=(0,u.jsxs)("div",{className:"flex items-center gap-1",children:[M,j,B]}),e[48]=M,e[49]=j,e[50]=B,e[51]=W):W=e[51];let $;e[52]!==q||e[53]!==l?($=q!==void 0&&(0,u.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"sql-query-name-reason",role:"status",children:l(q==="ai-error"?"The model could not be reached.":"The model returned nothing usable.")}),e[52]=q,e[53]=l,e[54]=$):$=e[54];let K;return e[55]!==x||e[56]!==I||e[57]!==R||e[58]!==W||e[59]!==$||e[60]!==v?(K=(0,u.jsxs)("form",{className:"flex flex-col gap-1 rounded-md bg-sidebar-accent p-1.5","data-testid":v,onSubmit:x,children:[I,R,W,$]}),e[55]=x,e[56]=I,e[57]=R,e[58]=W,e[59]=$,e[60]=v,e[61]=K):K=e[61],K},"os"),xt=[{label:"List tables",sql:"SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name;"},{label:"Table row count",sql:"SELECT COUNT(*) AS rows FROM messages;"},{label:"Recent rows",sql:"SELECT id, _creationTime, __doc__ FROM messages ORDER BY _creationTime DESC LIMIT 50;"},{label:"Index list",sql:"SELECT name, tbl_name FROM sqlite_master WHERE type = 'index' ORDER BY tbl_name;"}],so=d(s=>{let e=(0,X.c)(44),{active:n,onDelete:t,onRename:o,onSelect:r,query:l}=s,i=J(),a;e[0]!==r||e[1]!==l.id?(a=d(()=>{r(l.id)},"c"),e[0]=r,e[1]=l.id,e[2]=a):a=e[2];let c=a,m;e[3]!==t||e[4]!==l.id?(m=d(_=>{_.stopPropagation(),t(l.id)},"d"),e[3]=t,e[4]=l.id,e[5]=m):m=e[5];let p=m,f;e[6]!==o||e[7]!==l.id?(f=d(_=>{_.stopPropagation(),o(l.id)},"f"),e[6]=o,e[7]=l.id,e[8]=f):f=e[8];let b=f,g=n?"bg-sidebar-accent font-medium text-foreground":"text-muted-foreground",k;e[9]!==g?(k=ie("flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] outline-none transition-colors hover:bg-sidebar-accent focus-visible:bg-sidebar-accent",g),e[9]=g,e[10]=k):k=e[10];let q=`sql-query-${l.id}`,N;e[11]===Symbol.for("react.memo_cache_sentinel")?(N=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M4 6h16M4 12h10M4 18h7"})}),e[11]=N):N=e[11];let h;e[12]!==l.name?(h=(0,u.jsx)("span",{className:"truncate",children:l.name}),e[12]=l.name,e[13]=h):h=e[13];let S;e[14]!==n||e[15]!==c||e[16]!==l.description||e[17]!==k||e[18]!==q||e[19]!==h?(S=(0,u.jsxs)("button",{"aria-pressed":n,className:k,"data-testid":q,onClick:c,title:l.description,type:"button",children:[N,h]}),e[14]=n,e[15]=c,e[16]=l.description,e[17]=k,e[18]=q,e[19]=h,e[20]=S):S=e[20];let x;e[21]!==i?(x=i("Rename query"),e[21]=i,e[22]=x):x=e[22];let v=`sql-query-rename-open-${l.id}`,y;e[23]!==i?(y=i("Rename query"),e[23]=i,e[24]=y):y=e[24];let w;e[25]===Symbol.for("react.memo_cache_sentinel")?(w=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M4 20h4L19 9l-4-4L4 16zM14 6l4 4"})}),e[25]=w):w=e[25];let E;e[26]!==b||e[27]!==x||e[28]!==v||e[29]!==y?(E=(0,u.jsx)("button",{"aria-label":x,className:"hidden size-6 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground group-hover/q:flex","data-testid":v,onClick:b,title:y,type:"button",children:w}),e[26]=b,e[27]=x,e[28]=v,e[29]=y,e[30]=E):E=e[30];let I;e[31]!==i?(I=i("Delete query"),e[31]=i,e[32]=I):I=e[32];let T;e[33]!==i?(T=i("Delete query"),e[33]=i,e[34]=T):T=e[34];let L;e[35]===Symbol.for("react.memo_cache_sentinel")?(L=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"})}),e[35]=L):L=e[35];let C;e[36]!==p||e[37]!==I||e[38]!==T?(C=(0,u.jsx)("button",{"aria-label":I,className:"me-1 hidden size-6 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive group-hover/q:flex",onClick:p,title:T,type:"button",children:L}),e[36]=p,e[37]=I,e[38]=T,e[39]=C):C=e[39];let R;return e[40]!==E||e[41]!==C||e[42]!==S?(R=(0,u.jsxs)("li",{className:"group/q flex items-center",children:[S,E,C]}),e[40]=E,e[41]=C,e[42]=S,e[43]=R):R=e[43],R},"ls"),it="sql-history-remember",io=d((s,e)=>{let n=e.trim().toLowerCase();return n===""?[...s]:s.filter(t=>t.name.toLowerCase().includes(n))},"rs"),ao=d(s=>{let e=(0,X.c)(53),{activeId:n,history:t,listRef:o,onClearHistory:r,onDelete:l,onLoadHistory:i,onLoadTemplate:a,onNew:c,onRename:m,onSearchChange:p,onSelect:f,onToggleRememberHistory:b,queries:g,rememberHistory:k,rpc:q,search:N}=s,h=J(),S=io(g,N),[x,v]=(0,H.useState)(null),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=d(()=>{v(null)},"y"),e[0]=y):y=e[0];let w=y,E;e[1]!==b?(E=d(V=>{b(V.target.checked)},"w"),e[1]=b,e[2]=E):E=e[2];let I=E,T="flex h-full w-64 shrink-0 flex-col border-e border-border bg-sidebar",L;e[3]!==h?(L=h("Search queries\u2026"),e[3]=h,e[4]=L):L=e[4];let C;e[5]!==p||e[6]!==N||e[7]!==L?(C=(0,u.jsx)("input",{className:"h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"sql-search",onChange:p,placeholder:L,type:"text",value:N}),e[5]=p,e[6]=N,e[7]=L,e[8]=C):C=e[8];let R;e[9]!==h?(R=h("New query"),e[9]=h,e[10]=R):R=e[10];let _;e[11]!==h?(_=h("New query"),e[11]=h,e[12]=_):_=e[12];let M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M12 5v14M5 12h14"})}),e[13]=M):M=e[13];let z;e[14]!==c||e[15]!==R||e[16]!==_?(z=(0,u.jsx)("button",{"aria-label":R,className:"flex size-8 shrink-0 items-center justify-center rounded-md border border-border text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"sql-new",onClick:c,title:_,type:"button",children:M}),e[14]=c,e[15]=R,e[16]=_,e[17]=z):z=e[17];let j;e[18]!==C||e[19]!==z?(j=(0,u.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border p-2",children:[C,z]}),e[18]=C,e[19]=z,e[20]=j):j=e[20];let B="flex flex-1 flex-col gap-4 overflow-y-auto p-2",W;e[21]!==h?(W=h("Private"),e[21]=h,e[22]=W):W=e[22];let $;e[23]!==W?($=(0,u.jsx)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:W}),e[23]=W,e[24]=$):$=e[24];let K=S.length===0?(0,u.jsx)("p",{className:"px-1 py-2 text-xs text-muted-foreground","data-testid":"sql-private-empty",children:h("No saved queries yet \u2014 they save to this browser as you type.")}):(0,u.jsx)("ul",{className:"flex flex-col gap-px","data-testid":"sql-private",ref:o,children:S.map(V=>x===V.id?(0,u.jsx)("li",{children:(0,u.jsx)(lo,{onCancel:w,onSave:d((le,ae)=>{m(V.id,le,ae),w()},"onSave"),query:V,rpc:q})},V.id):(0,u.jsx)(so,{active:n===V.id,onDelete:l,onRename:v,onSelect:f,query:V},V.id))}),O;e[25]!==$||e[26]!==K?(O=(0,u.jsxs)("div",{children:[$,K]}),e[25]=$,e[26]=K,e[27]=O):O=e[27];let D;e[28]!==h?(D=h("Reference"),e[28]=h,e[29]=D):D=e[29];let A;e[30]!==D?(A=(0,u.jsx)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:D}),e[30]=D,e[31]=A):A=e[31];let Q;e[32]!==a?(Q=xt.map(V=>(0,u.jsx)("li",{children:(0,u.jsxs)("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-foreground focus-visible:bg-sidebar-accent","data-sql":V.sql,onClick:a,type:"button",children:[(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M7 4h7l4 4v12H7zM14 4v4h4"})}),V.label]})},V.label)),e[32]=a,e[33]=Q):Q=e[33];let F;e[34]!==Q?(F=(0,u.jsx)("ul",{className:"flex flex-col gap-px",children:Q}),e[34]=Q,e[35]=F):F=e[35];let ee;e[36]!==A||e[37]!==F?(ee=(0,u.jsxs)("div",{children:[A,F]}),e[36]=A,e[37]=F,e[38]=ee):ee=e[38];let P;e[39]!==t||e[40]!==r||e[41]!==i||e[42]!==I||e[43]!==k||e[44]!==h?(P=t.length>0&&(0,u.jsxs)("div",{children:[(0,u.jsxs)("div",{className:"flex items-center justify-between px-1 pb-1",children:[(0,u.jsx)("p",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h("History")}),(0,u.jsx)("button",{className:"rounded px-1 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:text-foreground","data-testid":"sql-history-clear",onClick:r,type:"button",children:h("Clear history")})]}),(0,u.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 px-1 pb-1.5 text-[11px] text-muted-foreground",htmlFor:it,children:[(0,u.jsx)("input",{checked:k,"data-testid":"sql-history-remember",id:it,onChange:I,type:"checkbox"}),h("Keep history on this browser")]}),(0,u.jsx)("ul",{className:"flex flex-col gap-px","data-testid":"sql-history",children:t.map(V=>(0,u.jsx)("li",{children:(0,u.jsxs)("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-foreground focus-visible:bg-sidebar-accent","data-sql":V.sql,"data-testid":"sql-history-item",onClick:i,title:V.sql,type:"button",children:[(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M12 8v4l3 2M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18Z"})}),(0,u.jsx)("span",{className:"truncate font-mono",children:V.sql})]})},`${V.at.toString()}:${V.sql}`))})]}),e[39]=t,e[40]=r,e[41]=i,e[42]=I,e[43]=k,e[44]=h,e[45]=P):P=e[45];let G;e[46]!==O||e[47]!==ee||e[48]!==P?(G=(0,u.jsxs)("div",{className:B,children:[O,ee,P]}),e[46]=O,e[47]=ee,e[48]=P,e[49]=G):G=e[49];let Z;return e[50]!==j||e[51]!==G?(Z=(0,u.jsxs)("aside",{className:T,children:[j,G]}),e[50]=j,e[51]=G,e[52]=Z):Z=e[52],Z},"is"),Ie=d(s=>`border-b-2 px-3 py-2 text-sm outline-none transition-colors ${s?"border-foreground font-medium text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,"Ee"),co=d(s=>{let e=(0,X.c)(16),{chatOpen:n,onToggle:t}=s,o=J(),r;e[0]!==o?(r=o("Ask about your data"),e[0]=o,e[1]=r):r=e[1];let l=`inline-flex items-center gap-1.5 rounded-md border border-border px-2 py-1.5 outline-none transition-colors hover:bg-accent focus-visible:bg-accent ${n?"bg-accent text-foreground":"text-muted-foreground"}`,i;e[2]!==o?(i=o("Ask about your data"),e[2]=o,e[3]=i):i=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M21 12a8 8 0 0 1-8 8H7l-4 3 1.2-4.2A8 8 0 1 1 21 12Z"})}),e[4]=a):a=e[4];let c;e[5]!==o?(c=o("Assistant"),e[5]=o,e[6]=c):c=e[6];let m;e[7]!==c?(m=(0,u.jsx)("span",{className:"text-xs",children:c}),e[7]=c,e[8]=m):m=e[8];let p;return e[9]!==n||e[10]!==t||e[11]!==r||e[12]!==l||e[13]!==i||e[14]!==m?(p=(0,u.jsxs)("button",{"aria-label":r,"aria-pressed":n,className:l,"data-testid":"sql-chat-toggle",onClick:t,title:i,type:"button",children:[a,m]}),e[9]=n,e[10]=t,e[11]=r,e[12]=l,e[13]=i,e[14]=m,e[15]=p):p=e[15],p},"as"),uo=d(s=>{let e=(0,X.c)(11),{onToggle:n,splitView:t}=s,o=J(),r;e[0]!==o?(r=o("Split editor and results"),e[0]=o,e[1]=r):r=e[1];let l=`inline-flex items-center rounded-md border border-border px-2 py-1.5 outline-none transition-colors hover:bg-accent focus-visible:bg-accent ${t?"bg-accent text-foreground":"text-muted-foreground"}`,i;e[2]!==o?(i=o("Split editor and results"),e[2]=o,e[3]=i):i=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=(0,u.jsxs)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:[(0,u.jsx)("rect",{height:"16",rx:"2",width:"18",x:"3",y:"4"}),(0,u.jsx)("path",{d:"M12 4v16"})]}),e[4]=a):a=e[4];let c;return e[5]!==n||e[6]!==t||e[7]!==r||e[8]!==l||e[9]!==i?(c=(0,u.jsx)("button",{"aria-label":r,"aria-pressed":t,className:l,"data-testid":"sql-split-toggle",onClick:n,title:i,type:"button",children:a}),e[5]=n,e[6]=t,e[7]=r,e[8]=l,e[9]=i,e[10]=c):c=e[10],c},"cs"),mo=d(s=>{let e=(0,X.c)(8),{disabled:n,onExplainPlan:t,onExplainSql:o,pane:r}=s,l=J();if(r==="explain"){let a;return e[0]!==n||e[1]!==t||e[2]!==l?(a=t===void 0?null:(0,u.jsx)("button",{className:"inline-flex items-center rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50","data-testid":"sql-explain-plan",disabled:n,onClick:t,type:"button",children:l("Read this plan")}),e[0]=n,e[1]=t,e[2]=l,e[3]=a):a=e[3],a}let i;return e[4]!==n||e[5]!==o||e[6]!==l?(i=o===void 0?null:(0,u.jsx)("button",{className:"inline-flex items-center rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50","data-testid":"sql-explain-query",disabled:n,onClick:o,type:"button",children:l("Explain this query")}),e[4]=n,e[5]=o,e[6]=l,e[7]=i):i=e[7],i},"ds"),fo=d(s=>{let e=(0,X.c)(8),{onRun:n,running:t}=s,o=J(),r;e[0]!==t||e[1]!==o?(r=o(t?"Running\u2026":"Run"),e[0]=t,e[1]=o,e[2]=r):r=e[2];let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=(0,u.jsx)("kbd",{className:"rounded border border-primary-foreground/30 px-1 font-sans text-[10px]",children:"\u2318\u21B5"}),e[3]=l):l=e[3];let i;return e[4]!==n||e[5]!==t||e[6]!==r?(i=(0,u.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"sql-run",disabled:t,onClick:n,type:"button",children:[r,l]}),e[4]=n,e[5]=t,e[6]=r,e[7]=i):i=e[7],i},"us"),ho=d(s=>{let e=(0,X.c)(35),{onInferChart:n,onShowChart:t,onShowExplain:o,onShowResults:r,pane:l,result:i,rpc:a}=s,c=J(),m=l==="results",p;e[0]!==m?(p=Ie(m),e[0]=m,e[1]=p):p=e[1];let f;e[2]!==c?(f=c("Results"),e[2]=c,e[3]=f):f=e[3];let b;e[4]!==r||e[5]!==p||e[6]!==f?(b=(0,u.jsx)("button",{className:p,"data-testid":"sql-tab-results",onClick:r,type:"button",children:f}),e[4]=r,e[5]=p,e[6]=f,e[7]=b):b=e[7];let g=l==="chart",k;e[8]!==g?(k=Ie(g),e[8]=g,e[9]=k):k=e[9];let q;e[10]!==c?(q=c("Chart"),e[10]=c,e[11]=q):q=e[11];let N;e[12]!==t||e[13]!==k||e[14]!==q?(N=(0,u.jsx)("button",{className:k,"data-testid":"sql-tab-chart",onClick:t,type:"button",children:q}),e[12]=t,e[13]=k,e[14]=q,e[15]=N):N=e[15];let h;e[16]!==n||e[17]!==l||e[18]!==i||e[19]!==a||e[20]!==c?(h=!a.unavailable&&l==="chart"&&i!==null&&(0,u.jsx)("button",{className:Ie(!1),"data-testid":"sql-infer-chart",disabled:a.pending("chart"),onClick:n,type:"button",children:a.pending("chart")?c("Thinking\u2026"):c("Suggest chart")}),e[16]=n,e[17]=l,e[18]=i,e[19]=a,e[20]=c,e[21]=h):h=e[21];let S=l==="explain",x;e[22]!==S?(x=Ie(S),e[22]=S,e[23]=x):x=e[23];let v;e[24]!==c?(v=c("Explain"),e[24]=c,e[25]=v):v=e[25];let y;e[26]!==o||e[27]!==x||e[28]!==v?(y=(0,u.jsx)("button",{className:x,"data-testid":"sql-tab-explain",onClick:o,type:"button",children:v}),e[26]=o,e[27]=x,e[28]=v,e[29]=y):y=e[29];let w;return e[30]!==y||e[31]!==b||e[32]!==N||e[33]!==h?(w=(0,u.jsxs)(u.Fragment,{children:[b,N,h,y]}),e[30]=y,e[31]=b,e[32]=N,e[33]=h,e[34]=w):w=e[34],w},"fs"),po=d(s=>{let e=(0,X.c)(9),{onSelectStatement:n,script:t}=s,o;if(e[0]!==n||e[1]!==t.runs||e[2]!==t.selected){let l;e[4]!==n||e[5]!==t.selected?(l=d((i,a)=>(0,u.jsx)("button",{"aria-pressed":a===t.selected,className:`rounded-md border px-2 py-0.5 font-mono text-[11px] outline-none transition-colors ${a===t.selected?"border-foreground text-foreground":"border-border text-muted-foreground hover:text-foreground"} ${i.error===null?"":"border-destructive/50 text-destructive"}`,"data-testid":`sql-statement-${a.toString()}`,onClick:d(()=>{n(a)},"onClick"),title:i.sql,type:"button",children:a+1},`${a.toString()}:${i.sql}`),"l"),e[4]=n,e[5]=t.selected,e[6]=l):l=e[6],o=t.runs.map(l),e[0]=n,e[1]=t.runs,e[2]=t.selected,e[3]=o}else o=e[3];let r;return e[7]!==o?(r=(0,u.jsx)("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-border px-3 py-1.5","data-testid":"sql-statements",children:o}),e[7]=o,e[8]=r):r=e[8],r},"ms"),bo=d(s=>{let e=(0,X.c)(9),{error:n,onDebugError:t,rpc:o}=s,r=J(),l;e[0]!==n?(l=(0,u.jsx)(Xe,{className:"w-full font-mono text-xs",testId:"sql-error",variant:"destructive",children:n}),e[0]=n,e[1]=l):l=e[1];let i;e[2]!==t||e[3]!==o||e[4]!==r?(i=!o.unavailable&&t!==void 0&&(0,u.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"sql-debug-error",disabled:o.pending("chat"),onClick:t,type:"button",children:[(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M21 12a8 8 0 0 1-8 8H7l-4 3 1.2-4.2A8 8 0 1 1 21 12Z"})}),o.pending("chat")?r("Thinking\u2026"):r("Debug with AI")]}),e[2]=t,e[3]=o,e[4]=r,e[5]=i):i=e[5];let a;return e[6]!==l||e[7]!==i?(a=(0,u.jsxs)("div",{className:"m-3 flex flex-col items-start gap-2",children:[l,i]}),e[6]=l,e[7]=i,e[8]=a):a=e[8],a},"ps"),go=d(s=>{let e=(0,X.c)(18),{chart:n,durationMs:t,pane:o,result:r}=s,l=J(),i;e[0]!==n||e[1]!==o||e[2]!==r?(i=o==="chart"?(0,u.jsx)(et,{axes:n,result:r}):(0,u.jsx)(tt,{result:r}),e[0]=n,e[1]=o,e[2]=r,e[3]=i):i=e[3];let a;e[4]!==r.rowCount||e[5]!==r.rows||e[6]!==r.truncated||e[7]!==l?(a=r.truncated?l("Showing the first {max} rows.",{max:r.rows.length}):l("{count} rows",{count:r.rowCount}),e[4]=r.rowCount,e[5]=r.rows,e[6]=r.truncated,e[7]=l,e[8]=a):a=e[8];let c;e[9]!==t||e[10]!==l?(c=t!==void 0&&` \xB7 ${l("{ms} ms",{ms:Math.round(t)})}`,e[9]=t,e[10]=l,e[11]=c):c=e[11];let m;e[12]!==a||e[13]!==c?(m=(0,u.jsxs)("p",{className:"border-t border-border px-3 py-1.5 text-xs text-muted-foreground","data-testid":"sql-count",children:[a,c]}),e[12]=a,e[13]=c,e[14]=m):m=e[14];let p;return e[15]!==i||e[16]!==m?(p=(0,u.jsxs)("div",{"data-testid":"sql-result",children:[i,m]}),e[15]=i,e[16]=m,e[17]=p):p=e[17],p},"hs"),xo=d(s=>{let e=(0,X.c)(13),{chart:n,durationMs:t,error:o,onDebugError:r,pane:l,result:i,rpc:a}=s,c=J();if(o!==null){let p;return e[0]!==o||e[1]!==r||e[2]!==a?(p=(0,u.jsx)(bo,{error:o,onDebugError:r,rpc:a}),e[0]=o,e[1]=r,e[2]=a,e[3]=p):p=e[3],p}if(i===null){let p;e[4]!==c?(p=c("Click Run to execute your query."),e[4]=c,e[5]=p):p=e[5];let f;return e[6]!==p?(f=(0,u.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-empty",children:p}),e[6]=p,e[7]=f):f=e[7],f}let m;return e[8]!==n||e[9]!==t||e[10]!==l||e[11]!==i?(m=(0,u.jsx)(go,{chart:n,durationMs:t,pane:l,result:i}),e[8]=n,e[9]=t,e[10]=l,e[11]=i,e[12]=m):m=e[12],m},"bs"),vo=d(s=>{let e=(0,X.c)(63),{rpc:n,chart:t,className:o,durationMs:r,error:l,onFormat:i,onInferChart:a,onRun:c,onSelectStatement:m,onShardKeyChange:p,onShowChart:f,onShowExplain:b,onShowResults:g,chatOpen:k,onDebugError:q,onExplainPlan:N,onExplainSql:h,onToggleChat:S,onToggleSplit:x,pane:v,result:y,running:w,script:E,shardKey:I,splitView:T}=s,L=J(),C;e[0]!==a||e[1]!==f||e[2]!==b||e[3]!==g||e[4]!==v||e[5]!==y||e[6]!==n?(C=(0,u.jsx)(ho,{onInferChart:a,onShowChart:f,onShowExplain:b,onShowResults:g,pane:v,result:y,rpc:n}),e[0]=a,e[1]=f,e[2]=b,e[3]=g,e[4]=v,e[5]=y,e[6]=n,e[7]=C):C=e[7];let R;e[8]!==k||e[9]!==S?(R=S!==void 0&&(0,u.jsx)(co,{chatOpen:k,onToggle:S}),e[8]=k,e[9]=S,e[10]=R):R=e[10];let _;e[11]!==x||e[12]!==T?(_=(0,u.jsx)(uo,{onToggle:x,splitView:T}),e[11]=x,e[12]=T,e[13]=_):_=e[13];let M;e[14]!==y?(M=y!==null&&y.columns.length>0&&(0,u.jsx)(Ze,{columns:y.columns,name:"query-result",rows:y.rows}),e[14]=y,e[15]=M):M=e[15];let z;e[16]!==L?(z=L("Format"),e[16]=L,e[17]=z):z=e[17];let j;e[18]!==i||e[19]!==w||e[20]!==z?(j=(0,u.jsx)("button",{className:"inline-flex items-center rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50","data-testid":"sql-format",disabled:w,onClick:i,type:"button",children:z}),e[18]=i,e[19]=w,e[20]=z,e[21]=j):j=e[21];let B;e[22]!==n||e[23]!==w?(B=w||n.pending("chat"),e[22]=n,e[23]=w,e[24]=B):B=e[24];let W;e[25]!==N||e[26]!==h||e[27]!==v||e[28]!==B?(W=(0,u.jsx)(mo,{disabled:B,onExplainPlan:N,onExplainSql:h,pane:v}),e[25]=N,e[26]=h,e[27]=v,e[28]=B,e[29]=W):W=e[29];let $;e[30]!==p||e[31]!==I?($=(0,u.jsx)(Ve,{onChange:p,testId:"sql-shard-input",value:I}),e[30]=p,e[31]=I,e[32]=$):$=e[32];let K;e[33]!==c||e[34]!==w?(K=(0,u.jsx)(fo,{onRun:c,running:w}),e[33]=c,e[34]=w,e[35]=K):K=e[35];let O;e[36]!==K||e[37]!==R||e[38]!==_||e[39]!==M||e[40]!==j||e[41]!==W||e[42]!==$?(O=(0,u.jsxs)("div",{className:"ms-auto flex items-center gap-2",children:[R,_,M,j,W,$,K]}),e[36]=K,e[37]=R,e[38]=_,e[39]=M,e[40]=j,e[41]=W,e[42]=$,e[43]=O):O=e[43];let D;e[44]!==C||e[45]!==O?(D=(0,u.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border pe-2",children:[C,O]}),e[44]=C,e[45]=O,e[46]=D):D=e[46];let A;e[47]!==m||e[48]!==E?(A=E!==void 0&&(0,u.jsx)(po,{onSelectStatement:m,script:E}),e[47]=m,e[48]=E,e[49]=A):A=e[49];let Q;e[50]!==t||e[51]!==r||e[52]!==l||e[53]!==q||e[54]!==v||e[55]!==y||e[56]!==n?(Q=(0,u.jsx)("div",{className:"min-h-0 flex-1 overflow-auto",children:(0,u.jsx)(xo,{chart:t,durationMs:r,error:l,onDebugError:q,pane:v,result:y,rpc:n})}),e[50]=t,e[51]=r,e[52]=l,e[53]=q,e[54]=v,e[55]=y,e[56]=n,e[57]=Q):Q=e[57];let F;return e[58]!==o||e[59]!==D||e[60]!==A||e[61]!==Q?(F=(0,u.jsxs)("div",{className:o,children:[D,A,Q]}),e[58]=o,e[59]=D,e[60]=A,e[61]=Q,e[62]=F):F=e[62],F},"gs"),yo=d((s,e)=>s.trim()===""?e:(s.split(`
15
+ `)[0]??s).slice(0,24),"xs"),wo=d(s=>{s?.focus(),s?.select()},"vs"),So=d(s=>{let e=(0,X.c)(14),{initial:n,onCancel:t,onCommit:o,placeholder:r,testId:l}=s,i=J(),a;e[0]!==o?(a=d(g=>{o(g.currentTarget.value.trim())},"c"),e[0]=o,e[1]=a):a=e[1];let c=a,m;e[2]!==t||e[3]!==o?(m=d(g=>{g.key==="Enter"?o(g.currentTarget.value.trim()):g.key==="Escape"&&t()},"d"),e[2]=t,e[3]=o,e[4]=m):m=e[4];let p=m,f;e[5]!==i?(f=i("Tab title"),e[5]=i,e[6]=f):f=e[6];let b;return e[7]!==n||e[8]!==c||e[9]!==p||e[10]!==r||e[11]!==f||e[12]!==l?(b=(0,u.jsx)("input",{"aria-label":f,className:"w-40 rounded border border-ring bg-background px-1 py-0.5 text-xs outline-none","data-testid":l,defaultValue:n,onBlur:c,onKeyDown:p,placeholder:r,ref:wo,type:"text"}),e[7]=n,e[8]=c,e[9]=p,e[10]=r,e[11]=f,e[12]=l,e[13]=b):b=e[13],b},"ys"),qo=d(s=>{let e=(0,X.c)(29),{idBase:n,onDiscard:t,onKeep:o}=s,r=J(),l=`sql-tab-close-prompt-${n}`,i;e[0]!==r?(i=r("Discard?"),e[0]=r,e[1]=i):i=e[1];let a;e[2]!==i?(a=(0,u.jsx)("span",{className:"text-[11px] text-muted-foreground",children:i}),e[2]=i,e[3]=a):a=e[3];let c;e[4]!==r?(c=r("Discard changes"),e[4]=r,e[5]=c):c=e[5];let m=`sql-tab-close-confirm-${n}`,p;e[6]!==r?(p=r("Discard changes"),e[6]=r,e[7]=p):p=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.4,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M5 13l4 4L19 7"})}),e[8]=f):f=e[8];let b;e[9]!==t||e[10]!==c||e[11]!==m||e[12]!==p?(b=(0,u.jsx)("button",{"aria-label":c,className:"flex size-5 items-center justify-center rounded text-destructive hover:bg-destructive/10","data-testid":m,onClick:t,title:p,type:"button",children:f}),e[9]=t,e[10]=c,e[11]=m,e[12]=p,e[13]=b):b=e[13];let g;e[14]!==r?(g=r("Keep editing"),e[14]=r,e[15]=g):g=e[15];let k=`sql-tab-close-cancel-${n}`,q;e[16]!==r?(q=r("Keep editing"),e[16]=r,e[17]=q):q=e[17];let N;e[18]===Symbol.for("react.memo_cache_sentinel")?(N=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.4,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M6 6l12 12M18 6 6 18"})}),e[18]=N):N=e[18];let h;e[19]!==o||e[20]!==k||e[21]!==q||e[22]!==g?(h=(0,u.jsx)("button",{"aria-label":g,className:"flex size-5 items-center justify-center rounded text-muted-foreground hover:bg-accent","data-testid":k,onClick:o,title:q,type:"button",children:N}),e[19]=o,e[20]=k,e[21]=q,e[22]=g,e[23]=h):h=e[23];let S;return e[24]!==l||e[25]!==h||e[26]!==a||e[27]!==b?(S=(0,u.jsxs)("span",{className:"flex shrink-0 items-center gap-1","data-testid":l,role:"group",children:[a,b,h]}),e[24]=l,e[25]=h,e[26]=a,e[27]=b,e[28]=S):S=e[28],S},"Ss"),ko=d(s=>{let e=(0,X.c)(47),{active:n,canClose:t,onClose:o,onMenu:r,onRename:l,onSelect:i,tab:a}=s,c=J(),[m,p]=(0,H.useState)(!1),[f,b]=(0,H.useState)(!1),g;e[0]!==r||e[1]!==a.id?(g=d(A=>{r(a.id,A)},"g"),e[0]=r,e[1]=a.id,e[2]=g):g=e[2];let k=g,q;e[3]!==i||e[4]!==a.id?(q=d(()=>{i(a.id)},"v"),e[3]=i,e[4]=a.id,e[5]=q):q=e[5];let N=q,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=d(()=>{p(!0)},"p"),e[6]=h):h=e[6];let S=h,x;e[7]!==o||e[8]!==a?(x=d(A=>{A.stopPropagation(),gt(a)?b(!0):o(a.id)},"x"),e[7]=o,e[8]=a,e[9]=x):x=e[9];let v=x,y;e[10]!==o||e[11]!==a.id?(y=d(A=>{A.stopPropagation(),b(!1),o(a.id)},"y"),e[10]=o,e[11]=a.id,e[12]=y):y=e[12];let w=y,E;e[13]===Symbol.for("react.memo_cache_sentinel")?(E=d(A=>{A.stopPropagation(),b(!1)},"w"),e[13]=E):E=e[13];let I=E,T;e[14]!==l||e[15]!==a.id?(T=d(A=>{l(a.id,A),p(!1)},"q"),e[14]=l,e[15]=a.id,e[16]=T):T=e[16];let L=T,C;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=d(()=>{p(!1)},"E"),e[17]=C):C=e[17];let R=C,_;e[18]!==a.name?(_=a.name.trim(),e[18]=a.name,e[19]=_):_=e[19];let M=_,z;e[20]!==c||e[21]!==a.sql?(z=yo(a.sql,c("Untitled")),e[20]=c,e[21]=a.sql,e[22]=z):z=e[22];let j=z,B=n?"bg-background text-foreground":"bg-muted/40 text-muted-foreground hover:text-foreground",W;e[23]!==B?(W=ie("group/tab flex shrink-0 items-center gap-1 border-e border-border ps-3 pe-1.5 text-xs",B),e[23]=B,e[24]=W):W=e[24];let $=`sql-tab-${a.id}`,K;e[25]!==n||e[26]!==L||e[27]!==M||e[28]!==j||e[29]!==m||e[30]!==N||e[31]!==c||e[32]!==a.id?(K=m?(0,u.jsx)(So,{initial:M,onCancel:R,onCommit:L,placeholder:j,testId:`sql-tab-rename-${a.id}`}):(0,u.jsx)("button",{"aria-pressed":n,className:"max-w-40 truncate py-1.5 outline-none","data-testid":`sql-tab-select-${a.id}`,onClick:N,onDoubleClick:S,title:c("Double-click to rename"),type:"button",children:M===""?j:M}),e[25]=n,e[26]=L,e[27]=M,e[28]=j,e[29]=m,e[30]=N,e[31]=c,e[32]=a.id,e[33]=K):K=e[33];let O;e[34]!==t||e[35]!==w||e[36]!==f||e[37]!==v||e[38]!==c||e[39]!==a.id?(O=t&&(f?(0,u.jsx)(qo,{idBase:a.id,onDiscard:w,onKeep:I}):(0,u.jsx)("button",{"aria-label":c("Close tab"),className:"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive","data-testid":`sql-tab-close-${a.id}`,onClick:v,title:c("Close tab"),type:"button",children:(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M6 6l12 12M18 6 6 18"})})})),e[34]=t,e[35]=w,e[36]=f,e[37]=v,e[38]=c,e[39]=a.id,e[40]=O):O=e[40];let D;return e[41]!==k||e[42]!==W||e[43]!==$||e[44]!==K||e[45]!==O?(D=(0,u.jsxs)("div",{className:W,"data-testid":$,onContextMenu:k,children:[K,O]}),e[41]=k,e[42]=W,e[43]=$,e[44]=K,e[45]=O,e[46]=D):D=e[46],D},"ws"),Co=d(s=>{let e=(0,X.c)(43),{model:n,onSelect:t}=s,o=J(),{activeTab:r,addEditorTab:l,cancelBulk:i,closeEditorTab:a,closeTabMenu:c,confirmBulk:m,menuStyle:p,onBackdropContextMenu:f,onCloseAll:b,onCloseOthers:g,onCloseToRight:k,openTabMenu:q,pendingBulk:N,renameTab:h,tabMenu:S,tabs:x}=n,v;if(e[0]!==r||e[1]!==a||e[2]!==t||e[3]!==q||e[4]!==h||e[5]!==x){let _;e[7]!==r||e[8]!==a||e[9]!==t||e[10]!==q||e[11]!==h||e[12]!==x.length?(_=d(M=>(0,u.jsx)(ko,{active:M.id===r.id,canClose:x.length>1,onClose:a,onMenu:q,onRename:h,onSelect:t,tab:M},M.id),"L"),e[7]=r,e[8]=a,e[9]=t,e[10]=q,e[11]=h,e[12]=x.length,e[13]=_):_=e[13],v=x.map(_),e[0]=r,e[1]=a,e[2]=t,e[3]=q,e[4]=h,e[5]=x,e[6]=v}else v=e[6];let y;e[14]!==o?(y=o("New tab"),e[14]=o,e[15]=y):y=e[15];let w=x.length>=He,E;e[16]!==o?(E=o("New tab"),e[16]=o,e[17]=E):E=e[17];let I;e[18]===Symbol.for("react.memo_cache_sentinel")?(I=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M12 5v14M5 12h14"})}),e[18]=I):I=e[18];let T;e[19]!==l||e[20]!==y||e[21]!==w||e[22]!==E?(T=(0,u.jsx)("button",{"aria-label":y,className:"flex size-8 shrink-0 items-center justify-center text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-add",disabled:w,onClick:l,title:E,type:"button",children:I}),e[19]=l,e[20]=y,e[21]=w,e[22]=E,e[23]=T):T=e[23];let L;e[24]!==v||e[25]!==T?(L=(0,u.jsxs)("div",{className:"flex shrink-0 items-stretch overflow-x-auto border-b border-border bg-muted/30","data-testid":"sql-tab-strip",role:"tablist",children:[v,T]}),e[24]=v,e[25]=T,e[26]=L):L=e[26];let C;e[27]!==i||e[28]!==c||e[29]!==m||e[30]!==p||e[31]!==f||e[32]!==b||e[33]!==g||e[34]!==k||e[35]!==N||e[36]!==o||e[37]!==S||e[38]!==x?(C=S!==null&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{className:"fixed inset-0 z-40","data-testid":"sql-tab-menu-backdrop",onClick:c,onContextMenu:f,role:"presentation"}),(0,u.jsx)("div",{className:"fixed z-50 min-w-44 rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-md","data-testid":"sql-tab-menu",role:"menu",style:p,children:N===null?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-menu-close-others",disabled:x.length<=1,onClick:g,role:"menuitem",type:"button",children:o("Close other tabs")}),(0,u.jsx)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-menu-close-right",disabled:x.findIndex(_=>_.id===S.id)>=x.length-1,onClick:k,role:"menuitem",type:"button",children:o("Close tabs to the right")}),(0,u.jsx)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-tab-menu-close-all",onClick:b,role:"menuitem",type:"button",children:o("Close all tabs")})]}):(0,u.jsxs)("div",{className:"px-3 py-1.5","data-testid":"sql-tab-menu-confirm",children:[(0,u.jsx)("p",{className:"pb-1.5 text-xs text-muted-foreground",children:o("Discard unsaved tabs?")}),(0,u.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,u.jsx)("button",{className:"rounded px-2 py-1 text-xs font-medium text-destructive outline-none hover:bg-destructive/10 focus-visible:bg-destructive/10","data-testid":"sql-tab-menu-confirm-discard",onClick:m,type:"button",children:o("Discard")}),(0,u.jsx)("button",{className:"rounded px-2 py-1 text-xs text-muted-foreground outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-tab-menu-confirm-cancel",onClick:i,type:"button",children:o("Cancel")})]})]})})]}),e[27]=i,e[28]=c,e[29]=m,e[30]=p,e[31]=f,e[32]=b,e[33]=g,e[34]=k,e[35]=N,e[36]=o,e[37]=S,e[38]=x,e[39]=C):C=e[39];let R;return e[40]!==L||e[41]!==C?(R=(0,u.jsxs)(u.Fragment,{children:[L,C]}),e[40]=L,e[41]=C,e[42]=R):R=e[42],R},"Cs"),No=ge(ve.runSql),Eo="lunora-studio-sql-split-view",To=d(()=>qe(xt[0]?.sql??""),"Es"),Lo=d(()=>performance.now(),"Ts"),Io=d(()=>{let s=(0,X.c)(2),e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=new Map,s[0]=e):e=s[0];let n=(0,H.useRef)(e),t;return s[1]===Symbol.for("react.memo_cache_sentinel")?(t={advance:d(o=>{n.current.set(o,(n.current.get(o)??0)+1)},"advance"),begin:d(o=>{let r=n.current.get(o)??0;return()=>(n.current.get(o)??0)===r},"begin")},s[1]=t):t=s[1],t},"qs"),Ro=d((s,e)=>{let n=s.tables[0];return n===void 0?[e("What tables does this app have?")]:[e("What tables does this app have?"),e("Show me the most recent rows in {table}",{table:n}),e("Is anything wrong with my schema?")]},"Rs"),Re=d(s=>s.tables.map(e=>({columns:[...s.columns[e]??[]],table:e})),"Te"),or=d(({initialShardKey:s,now:e=Lo})=>{let n=Ce(),t=On(To),{activeTab:o,openEditorTab:r,output:l,patchActiveOutput:i,patchActiveTab:a,setActiveTabId:c,unlinkQuery:m}=t,p=Io(),f=Fn({loadIntoActiveTab:d((U,oe)=>{p.advance(o.id),a({activeId:oe,sql:U}),i({chart:void 0,durationMs:void 0,error:null,failed:void 0,result:null,running:!1,script:void 0})},"loadIntoActiveTab"),unlinkQuery:m}),{recordHistory:b,updateQuerySql:g}=f,k=o.sql,{activeId:q}=o,{chart:N,error:h,failed:S,result:x,running:v}=l,y=l.pane,[w,E]=(0,H.useState)(s??""),[I,T]=Ee(Eo,!1),L=J(),C=Ke(),{probe:R,schema:_}=qn(w),M=(0,H.useCallback)(U=>{a({sql:U}),q!==null&&g(q,U)},[q,a,g]),z=C?.setHasEditor;(0,H.useEffect)(()=>{if(z!==void 0)return z(!0),()=>{z(!1)}},[z]);let j=C?.insertRequest,B=C?.takeInsert;(0,H.useEffect)(()=>{j===void 0||B===void 0||(B(j.id),k.trim()===""&&q===null?M(j.sql):r(j.sql)||a({activeId:null,sql:k.trim()===""?j.sql:`${k.trimEnd()}
16
+
17
+ ${j.sql}`}))},[q,k,j,r,a,B,M]);let W=sn(k,_,w),$=Ye(w),K=d(()=>{x!==null&&se((async()=>{let U=await $.inferChart({columns:x.columns,rowCount:x.rowCount,types:Object.fromEntries(x.columns.map(oe=>[oe,typeof(x.rows[0]?.[oe]??"")]))});i({chart:U})})())},"M"),O=d(async U=>{let oe=e();try{let re=await n.query(No,{sql:U},xe(w)),ce=e()-oe;return b(U),{durationMs:ce,error:null,result:re,sql:U}}catch(re){return{error:Fe(re),result:null,sql:U}}},"A"),D=d(async U=>{if(k.trim()==="")return;let oe=p.begin(o.id);i({running:!0,...U==="explain"?{explained:k.trim()}:{}});let re=U==="explain"?ze(Dt(k),0):mt(k),ce=[];for(let ke of re){let vt={error:ke.rejection?.message??"",result:null,sql:ke.sql};ce.push(ke.rejection===void 0?await O(ke.sql):vt)}if(Ge(w),!oe())return;let We=Math.max(ce.length-1,0),de=ce[We];i({chart:void 0,durationMs:de?.durationMs,error:de?.error??null,failed:de?.error===null||de===void 0?void 0:{error:de.error,sql:de.sql},pane:U,result:de?.result??null,running:!1,script:ce.length>1?{runs:ce,selected:We}:void 0})},"D"),A=d(U=>{let oe=l.script?.runs,re=oe?.[U];oe===void 0||re===void 0||i({chart:void 0,durationMs:re.durationMs,error:re.error,failed:re.error===null?void 0:{error:re.error,sql:re.sql},result:re.result,script:{runs:oe,selected:U}})},"z"),Q=d(()=>{se(D("results"))},"j"),F=En({inlineEditEnabled:!$.unavailable,onSubmit:d(()=>{se(D(l.pane))},"onSubmit"),probe:R,schema:_,setDraft:M}),{closeAutocomplete:ee,closeInlineEdit:P}=F,G=d(()=>{M(zt(k))},"X"),Z=d(U=>{ee(),P(),c(U)},"Y"),V=d(()=>{i({pane:"results"})},"oe"),le=d(()=>{se(D("explain"))},"re"),ae=d(()=>{i({pane:"chart"})},"pe"),ue=d(()=>{T(!I)},"ve"),pe=d(()=>{if(C!==void 0){if(C.open){C.close();return}C.openAssistant({schema:Re(_),shardKey:w,suggestions:Ro(_,L),title:L("SQL console")})}},"he"),me=d(U=>{C?.rebindShard(w,U),E(U)},"ye"),be=d(()=>{S!==void 0&&C?.openAssistant({ask:L(`This statement failed:
18
+ {sql}
19
+
20
+ The database said: {error}
21
+
22
+ Why, and what should it be?`,{error:S.error,sql:S.sql}),schema:Re(_),shardKey:w,title:L("Debug query")})},"be"),fe=d(()=>{let U=k.trim();U!==""&&C?.openAssistant({ask:L(`Explain what this query does, step by step:
23
+ {statement}`,{statement:U}),schema:Re(_),shardKey:w,title:L("Explain query")})},"V"),Y=d(()=>{let U=l.explained;if(x===null||x.rows.length===0||U===void 0)return;let oe=x.rows.map(re=>x.columns.map(ce=>Qe(re[ce])).join(" | ")).join(`
24
+ `);C?.openAssistant({ask:L(`SQLite planned this query:
25
+ {statement}
26
+
27
+ as:
28
+ {plan}
29
+
30
+ What is it doing, and is anything here slow?`,{plan:oe,statement:U}),schema:Re(_),shardKey:w,title:L("Read plan")})},"ee"),te=I?"flex min-h-0 flex-1 flex-row":"flex min-h-0 flex-1 flex-col",ne=I?"flex w-2/5 min-h-0 min-w-0 shrink-0 flex-col border-s border-border":"flex h-2/5 min-h-0 shrink-0 flex-col border-t border-border";return(0,u.jsxs)("div",{className:"flex h-full min-w-0","data-testid":"lunora-sql-editor",children:[(0,u.jsx)(ao,{activeId:q,history:f.history,listRef:f.listRef,onClearHistory:f.clearHistory,onDelete:f.deleteQuery,onLoadHistory:f.loadFromHistory,onLoadTemplate:f.loadTemplate,onNew:f.newQuery,onRename:f.renameQuery,onSearchChange:f.onSearchChange,onSelect:f.selectQuery,onToggleRememberHistory:f.setRememberHistory,queries:f.queries,rememberHistory:f.rememberHistory,rpc:$,search:f.search}),(0,u.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,u.jsx)(Co,{model:t,onSelect:Z}),(0,u.jsxs)("div",{className:te,children:[(0,u.jsx)(oo,{autocomplete:F.autocompleteState,diagnostics:W,draft:k,editorRef:F.editorRef,failed:S,gutterRef:F.gutterRef,handlers:F.handlers,inlineEdit:F.inlineEdit,listboxId:F.listboxId,onAcceptInlineEdit:F.acceptInlineEdit,onCancelInlineEdit:F.closeInlineEdit,onGenerated:M,onPickSuggestion:F.onPickSuggestion,onRevealDiagnostic:F.revealDiagnostic,overlayRef:F.overlayRef,rpc:$}),(0,u.jsx)(vo,{chart:N,chatOpen:C?.open===!0,className:ne,durationMs:l.durationMs,error:h,onDebugError:S===void 0?void 0:be,onExplainPlan:C===void 0||C.unavailable||y!=="explain"?void 0:Y,onExplainSql:C===void 0||C.unavailable?void 0:fe,onFormat:G,onInferChart:K,onRun:Q,onSelectStatement:A,onShardKeyChange:me,onShowChart:ae,onShowExplain:le,onShowResults:V,onToggleChat:C===void 0||C.unavailable?void 0:pe,onToggleSplit:ue,pane:y,result:x,rpc:$,running:v,script:l.script,shardKey:w,splitView:I})]})]})]})},"Vs");export{or as SqlEditorPanel};
@@ -0,0 +1 @@
1
+ import{G as ve,H as Ce,c as Z,d as fe,f as he,fa as Pe,g as ge,ga as G,h as ye,ha as Re,i as Se,ia as we,ja as be,ka as Ee,ta as xe}from"./chunk-XLYFGUEF.js";import{b as Y}from"./chunk-D65UVZIA.js";import{a as Ye}from"./chunk-QRA7AKYO.js";import{F as U,H as j,M as V,N,e as de}from"./chunk-HFBSWKJS.js";import{a as ue}from"./chunk-4EPW63HS.js";import{b as ce,f as le,o as pe,u as E,v,w as W}from"./chunk-VUOEJJUH.js";import{d as me,g as w,i as D}from"./chunk-YUVGMKHG.js";import{a as B,b as je}from"./chunk-6G3E4PJ2.js";import{a as n,d as R}from"./chunk-5PEAXTYQ.js";var Te=class{static{n(this,"BasePopupHandle")}attachedStores=[];attachedStoreValue=null;storeListeners=new Set;constructor(t,o,r=!0){this.fallbackStore=t,this.componentName=o,this.throwOnMissingTrigger=r}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(t){return this.storeListeners.add(t),()=>{this.storeListeners.delete(t)}}attachStore(t){return this.attachedStores.push(t),this.setActiveStore(t),()=>{let o=this.attachedStores.lastIndexOf(t);o!==-1&&this.attachedStores.splice(o,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(t){this.attachedStoreValue!==t&&(this.attachedStoreValue=t,this.storeListeners.forEach(o=>{o()}))}openByTrigger(t){let o=this.attachedStore;if(o===null)return;let r;if(t){for(let s=this.attachedStores.length-1;s>=0&&!r;s-=1)r=this.attachedStores[s].context.triggerElements.getById(t);r??=this.fallbackStore.context.triggerElements.getById(t)}if(t&&!r&&this.throwOnMissingTrigger)throw new Error(me(99,this.componentName,t,this.componentName));o.setOpen(!0,N(V.imperativeAction,void 0,r))}closePopup(){let t=this.attachedStore;t!==null&&t.setOpen(!1,N(V.imperativeAction))}};var ee=R(B(),1),Oe=R(Ye(),1);function rt(e){let t=ee.useCallback(r=>e===void 0?w:e.subscribeStore(r),[e]),o=ee.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,Oe.useSyncExternalStore)(t,o,()=>e?.serverStore)}n(rt,"usePopupHandleStore");var Ae=R(B(),1),te=R(ue(),1);function lt(e,t){let o=Ae.useRef(null);function r(i){te.flushSync(()=>{e.setOpen(!1,N(V.focusOut,i.nativeEvent,i.currentTarget))}),ye(o.current)?.focus()}n(r,"handlePreFocusGuardFocus");function s(i){let u=e.select("positionerElement");if(u&&Se(i,u))e.context.beforeContentFocusGuardRef.current?.focus();else{te.flushSync(()=>{e.setOpen(!1,N(V.focusOut,i.nativeEvent,i.currentTarget))});let a=ge(e.context.triggerFocusTargetRef.current||t.current);for(;a!==null&&de(u,a);){let l=a;if(a=he(a),a===l)break}a?.focus()}}return n(s,"handleFocusTargetFocus"),{preFocusGuardRef:o,handlePreFocusGuardFocus:r,handleFocusTargetFocus:s}}n(lt,"useTriggerFocusGuards");var c=R(B(),1),Le=R(ue(),1);var F=R(B(),1);function oe(e){let t=pe(e),o=parseFloat(t.width)||0,r=parseFloat(t.height)||0,s=le(e),i=s?e.offsetWidth:o,u=s?e.offsetHeight:r;return(Z(o)!==i||Z(r)!==u)&&(o=i,r=u),{width:o,height:r}}n(oe,"getCssDimensions");var H="--popup-width",_="--popup-height";function Ne(e){let{popupElement:t,positionerElement:o,content:r,mounted:s,onMeasureLayout:i,onMeasureLayoutComplete:u,side:a,direction:l}=e,g=j(t,!0),C=U(),p=F.useRef(null),d=F.useRef(!0),m=F.useRef(w),y=E(i),h=E(u),b=F.useMemo(()=>Ge(a,l),[a,l]);v(()=>{if(!s){m.current=w,d.current=!0,p.current=null;return}if(!t||!o)return;m.current=Ve(t,b),ne(t,"auto");let I=q(t,"position","static"),x=q(t,"transform","none"),S=q(t,"scale","1"),T=Ve(o,{[Re]:"max-content",[we]:"max-content"});function X(){I(),x(),T()}n(X,"restoreMeasurementOverrides");function L(){X(),S()}if(n(L,"restoreMeasurementOverridesIncludingScale"),y?.(),d.current||p.current===null){K(o,"max-content");let A=oe(t);return p.current=A,K(o,A),L(),h?.(null,A),d.current=!1,()=>{m.current(),m.current=w}}K(o,"max-content");let O=p.current,P=oe(t);p.current=P,ne(t,O),L(),h?.(O,P),K(o,P);let $=new AbortController;return C.request(()=>{ne(t,P),g(()=>{t.style.setProperty(H,"auto"),t.style.setProperty(_,"auto")},$.signal)}),()=>{$.abort(),C.cancel(),m.current(),m.current=w}},[r,t,o,g,C,s,y,h,b])}n(Ne,"usePopupAutoResize");function Ge(e,t){let o=e==="top",r=e==="left"||e===(t==="rtl"?"inline-end":"inline-start");return!o&&!r?D:{position:"absolute",[o?"bottom":"top"]:"0",[r?"right":"left"]:"0"}}n(Ge,"getPopupAnchoringStyles");function q(e,t,o){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,o),()=>{e.style.setProperty(t,r)}}n(q,"overrideElementStyle");function Ve(e,t){let o=[];for(let[r,s]of Object.entries(t))o.push(q(e,r,s));return o.length?()=>{o.forEach(r=>r())}:w}n(Ve,"applyElementStyles");function ne(e,t){let o=t==="auto"?"auto":`${t.width}px`,r=t==="auto"?"auto":`${t.height}px`;e.style.setProperty(H,o),e.style.setProperty(_,r)}n(ne,"setPopupCssSize");function K(e,t){let o=t==="max-content"?"max-content":`${t.width}px`,r=t==="max-content"?"max-content":`${t.height}px`;e.style.setProperty(be,o),e.style.setProperty(Ee,r)}n(K,"setPositionerCssSize");var Fe={name:"adaptiveOrigin",async fn(e){let{x:t,y:o,rects:{floating:r},elements:{floating:s},platform:i,strategy:u,placement:a}=e,l=ce(s),g=l.getComputedStyle(s);if(!(g.transitionDuration!=="0s"&&g.transitionDuration!==""))return{x:t,y:o,data:G};let p=await i.getOffsetParent?.(s),d={width:0,height:0};if(u==="fixed"&&l?.visualViewport)d={width:l.visualViewport.width,height:l.visualViewport.height};else if(p===l){let x=W(s);d={width:x.documentElement.clientWidth,height:x.documentElement.clientHeight}}else await i.isElement?.(p)&&(d=await i.getDimensions(p));let m=fe(a),y=t,h=o;m==="left"&&(y=d.width-(t+r.width)),m==="top"&&(h=d.height-(o+r.height));let b=m==="left"?"right":G.sideX,I=m==="top"?"bottom":G.sideY;return{x:y,y:h,data:{sideX:b,sideY:I}}}};var Me="data-activation-direction";var M=R(je(),1);var Yt={activationDirection:n(e=>e?{[Me]:e}:null,"activationDirection")};function Gt(e){let{store:t,side:o,children:r}=e,s=Y(),i=t.useState("activeTriggerElement"),u=t.useState("activeTriggerId"),a=t.useState("open"),l=t.useState("payload"),g=t.useState("mounted"),C=t.useState("popupElement"),p=t.useState("positionerElement"),d=xe(a?i:null),m=Je(u,l),y=c.useRef(null),[h,b]=c.useState(null),[I,x]=c.useState(null),S=c.useRef(null),T=c.useRef(null),X=j(S,!0),L=U(),O=c.useRef(null),[P,$]=c.useState(null),[A,J]=c.useState(!1);v(()=>(t.set("adaptiveOrigin",Fe),()=>{t.set("adaptiveOrigin",void 0)}),[t]);let ke=E(()=>{S.current?.style.setProperty("animation","none"),S.current?.style.setProperty("transition","none"),T.current?.style.setProperty("display","none")}),Be=E(f=>{S.current?.style.removeProperty("animation"),S.current?.style.removeProperty("transition"),T.current?.style.removeProperty("display"),f&&$(f)}),ie=E(()=>{O.current?.abort();let f=new AbortController;O.current=f,X(()=>{b(null),$(null),y.current=null},f.signal)}),z=c.useRef(null);v(()=>{(!a||!g)&&(z.current=null)},[a,g]),v(()=>{if(i&&d&&i!==d&&z.current!==i&&y.current){b(y.current),J(!0);let f=Xe(d,i);x(f),z.current=i}},[i,d]),v(()=>{h!=null&&(O.current?.abort(),J(!0),L.request(()=>{Le.flushSync(()=>{J(!1)}),ie()}))},[m,h,ie,L]),v(()=>{let f=S.current;if(!f)return;let ae=W(f).createElement("div");for(let Ue of Array.from(f.childNodes))ae.appendChild(Ue.cloneNode(!0));y.current=ae});let se=h!=null,Q;se?Q=(0,M.jsxs)(c.Fragment,{children:[(0,M.jsx)("div",{"data-previous":!0,inert:Pe(!0),ref:T,style:{...P?{[H]:`${P.width}px`,[_]:`${P.height}px`}:null,position:"absolute"},"data-ending-style":A?void 0:""},"previous"),(0,M.jsx)("div",{"data-current":!0,ref:S,"data-starting-style":A?"":void 0,children:r},m)]}):Q=(0,M.jsx)("div",{"data-current":!0,ref:S,children:r},m),v(()=>{let f=T.current;!f||!h||f.replaceChildren(...Array.from(h.childNodes))},[h]),Ne({popupElement:C,positionerElement:p,mounted:g,content:l,onMeasureLayout:ke,onMeasureLayoutComplete:Be,side:o,direction:s});let We={activationDirection:qe(I),transitioning:se};return{children:Q,state:We}}n(Gt,"usePopupViewport");function qe(e){if(e)return`${Ie(e.horizontal,5,"right","left")} ${Ie(e.vertical,5,"down","up")}`}n(qe,"getActivationDirection");function Ie(e,t,o,r){return e>t?o:e<-t?r:""}n(Ie,"getValueWithTolerance");function Xe(e,t){let o=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s={x:o.left+o.width/2,y:o.top+o.height/2},i={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:i.x-s.x,vertical:i.y-s.y}}n(Xe,"calculateRelativePosition");function Je(e,t){let[o,r]=c.useState(0),s=c.useRef(e),i=c.useRef(t),u=c.useRef(!1);return v(()=>{let a=s.current,l=i.current,g=e!==a,C=t!==l;g?(r(p=>p+1),u.current=!C):u.current&&C&&(r(p=>p+1),u.current=!1),s.current=e,i.current=t},[e,t]),`${e??"current"}-${o}`}n(Je,"usePopupContentKey");function zt(e,t,o=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Ce({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:o,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:D,inactiveTriggerProps:D,popupProps:D}}n(zt,"createInitialPopupStoreState");var k=n(e=>e.triggerIdProp??e.activeTriggerId,"activeTriggerIdSelector"),re=n(e=>e.openProp??e.open,"openSelector"),$e=n(e=>(e.popupElement?.id??e.floatingId)||void 0,"popupIdSelector");function He(e,t){return t!==void 0&&re(e)&&k(e)===t}n(He,"triggerOwnsOpenPopup");function ze(e,t){return He(e,t)?!0:t!==void 0&&re(e)&&k(e)==null&&e.triggerCount===1}n(ze,"triggerOwnsOpenPopupOrIsOnlyTrigger");var Qt={open:re,mounted:n(e=>e.mounted,"mounted"),transitionStatus:n(e=>e.transitionStatus,"transitionStatus"),floatingRootContext:n(e=>e.floatingRootContext,"floatingRootContext"),triggerCount:n(e=>e.triggerCount,"triggerCount"),preventUnmountingOnClose:n(e=>e.preventUnmountingOnClose,"preventUnmountingOnClose"),payload:n(e=>e.payload,"payload"),activeTriggerId:k,activeTriggerElement:n(e=>e.mounted?e.activeTriggerElement:null,"activeTriggerElement"),popupId:$e,isTriggerActive:n((e,t)=>t!==void 0&&k(e)===t,"isTriggerActive"),isOpenedByTrigger:n((e,t)=>He(e,t),"isOpenedByTrigger"),isMountedByTrigger:n((e,t)=>t!==void 0&&k(e)===t&&e.mounted,"isMountedByTrigger"),triggerProps:n((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,"triggerProps"),triggerPopupId:n((e,t)=>ze(e,t)?$e(e):void 0,"triggerPopupId"),popupProps:n(e=>e.popupProps,"popupProps"),popupElement:n(e=>e.popupElement,"popupElement"),positionerElement:n(e=>e.positionerElement,"positionerElement")};var _e=class extends ve{static{n(this,"NullStore")}setState(t){}update(t){}set(t,o){}notifyAll(){}};export{Te as a,zt as b,Qt as c,rt as d,_e as e,lt as f,Yt as g,Gt as h};
@@ -0,0 +1 @@
1
+ import{a as q}from"./chunk-RPKPLAT2.js";import"./chunk-JW3TXMEF.js";import{a as k}from"./chunk-HAVIBMMB.js";import"./chunk-ONTGYVAN.js";import"./chunk-Y2YLTUMD.js";import"./chunk-BG2CJOVS.js";import{a as A}from"./chunk-J45HAKBU.js";import{a as $}from"./chunk-PRTIYJFL.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import"./chunk-RTS5G3ET.js";import"./chunk-QRA7AKYO.js";import"./chunk-74WS3GUC.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import"./chunk-VUOEJJUH.js";import{a as E}from"./chunk-MY7J2X2Y.js";import{b as j}from"./chunk-BWT5ANXC.js";import"./chunk-YUVGMKHG.js";import{a as F}from"./chunk-ZN6LJWXV.js";import"./chunk-TDYA6E3G.js";import"./chunk-C724GMPR.js";import"./chunk-XAI64L2D.js";import"./chunk-4PI2OSSP.js";import{a as S}from"./chunk-6A6AELDJ.js";import{c as I}from"./chunk-34E6NNQZ.js";import{a as w,e as O}from"./chunk-2BN5NW34.js";import"./chunk-35IQT6SS.js";import"./chunk-ZPQBVYNN.js";import{B as T,w as C}from"./chunk-6DU2UW57.js";import"./chunk-PDBW6GTJ.js";import{a as D}from"./chunk-GWNGVKLG.js";import{b as H}from"./chunk-6G3E4PJ2.js";import{a as p,d as _}from"./chunk-5PEAXTYQ.js";var K=_(D(),1);var m=_(H(),1);var L=p(s=>s.length===0?void 0:{max:Math.max(...s),mean:s.reduce((e,t)=>e+t,0)/s.length,min:Math.min(...s)},"F"),B=/^gen_ai\.evaluation\.(.+)\.score$/u,P=p(s=>{let e=[];for(let t of s)for(let n of t.spans)for(let[a,l]of Object.entries(n.attributes??{})){let o=B.exec(a);if(!o||typeof l!="number")continue;let i=o[1],c=n.attributes?.[`gen_ai.evaluation.${i}.label`];e.push({...typeof c=="string"?{label:c}:{},name:i,score:l,spanName:n.name,startTs:t.startTs+n.offsetMs,traceId:t.traceId})}return e.toSorted((t,n)=>n.startTs-t.startTs)},"q"),Q=p(s=>{let e=[];for(let t of s?.series??[]){let n=B.exec(t.name);n&&e.push({name:n[1],points:t.points})}return e},"D"),R=p((s,e)=>{let t=new Set([...s.map(a=>a.name),...e.map(a=>a.name)]),n=[];for(let a of t){let l=s.filter(r=>r.name===a),o=e.find(r=>r.name===a)?.points??[],i=o.at(-1)?.last??l[0]?.score,c=o.length>0?{max:Math.max(...o.map(r=>r.max)),mean:o.reduce((r,d)=>r+d.sum,0)/o.reduce((r,d)=>r+d.count,0),min:Math.min(...o.map(r=>r.min))}:L(l.map(r=>r.score));n.push({...i===void 0?{}:{latest:i},...c,name:a,points:o,runs:l})}return n.toSorted((a,l)=>a.name.localeCompare(l.name))},"H"),U=p(s=>Array.isArray(s?.traces)?s.traces:[],"L"),N=p(s=>s===void 0?"\u2014":s.toFixed(2),"y"),z=p(s=>{let e=(0,K.c)(34),{card:t,onOpenTrace:n}=s,a=T(),l;e[0]!==t.name?(l=(0,m.jsx)("h3",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"ev-name",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let o;e[2]!==t.latest?(o=N(t.latest),e[2]=t.latest,e[3]=o):o=e[3];let i;e[4]!==o?(i=(0,m.jsx)("span",{className:"font-mono text-lg text-foreground","data-testid":"ev-latest",children:o}),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==l||e[7]!==i?(c=(0,m.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=c):c=e[8];let r;e[9]!==t.max||e[10]!==t.mean||e[11]!==t.min||e[12]!==a?(r=a("min {min} \xB7 mean {mean} \xB7 max {max}",{max:N(t.max),mean:N(t.mean),min:N(t.min)}),e[9]=t.max,e[10]=t.mean,e[11]=t.min,e[12]=a,e[13]=r):r=e[13];let d;e[14]!==r?(d=(0,m.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"ev-summary",children:r}),e[14]=r,e[15]=d):d=e[15];let u;e[16]!==t.name||e[17]!==t.points||e[18]!==a?(u=t.points.length>1?(0,m.jsx)(q,{ariaLabel:a("Score trend for {name}",{name:t.name}),className:"h-10 w-full",series:t.points.map(G),testId:"ev-trend"}):(0,m.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ev-no-trend",children:a("No durable history yet \u2014 pass ctx.metrics to recordEvaluation to chart a trend.")}),e[16]=t.name,e[17]=t.points,e[18]=a,e[19]=u):u=e[19];let h;if(e[20]!==t.runs||e[21]!==n||e[22]!==a){let v;e[24]!==n||e[25]!==a?(v=p(f=>(0,m.jsxs)("div",{className:"flex items-center justify-between gap-2 font-mono text-xs","data-testid":"ev-run",children:[(0,m.jsxs)("span",{className:"truncate text-muted-foreground",children:[C(f.startTs)," \xB7 ",f.spanName]}),(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[f.label===void 0?null:(0,m.jsx)(j,{variant:"outline",children:f.label}),(0,m.jsx)("span",{className:"text-foreground",children:N(f.score)}),n===void 0?null:(0,m.jsx)("button",{className:"text-muted-foreground underline-offset-2 hover:underline",onClick:p(()=>{n(f.traceId)},"onClick"),title:a("Open the trace {trace}",{trace:f.traceId}),type:"button",children:f.traceId.slice(0,8)})]})]},`${f.traceId}:${f.spanName}`),"x"),e[24]=n,e[25]=a,e[26]=v):v=e[26],h=t.runs.slice(0,5).map(v),e[20]=t.runs,e[21]=n,e[22]=a,e[23]=h}else h=e[23];let x;e[27]!==h?(x=(0,m.jsx)("div",{className:"flex flex-col gap-1",children:h}),e[27]=h,e[28]=x):x=e[28];let g;return e[29]!==c||e[30]!==d||e[31]!==u||e[32]!==x?(g=(0,m.jsx)(w,{"data-testid":"ev-card",children:(0,m.jsxs)(O,{className:"flex flex-col gap-3 p-4",children:[c,d,u,x]})}),e[29]=c,e[30]=d,e[31]=u,e[32]=x,e[33]=g):g=e[33],g},"P"),oe=p(s=>{let e=(0,K.c)(21),{initialShardKey:t}=s,n=T(),{queryShardKey:a,setShardKey:l,shardKey:o}=A(t),i=k(a),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let r;e[1]!==a?(r={live:!0,shardKey:a},e[1]=a,e[2]=r):r=e[2];let{data:d,error:u}=I(S.getTraces,c,r),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let x;e[4]!==a?(x={live:!0,shardKey:a},e[4]=a,e[5]=x):x=e[5];let{data:g}=I(S.getMetricHistory,h,x),v;if(e[6]!==d||e[7]!==u||e[8]!==g||e[9]!==i||e[10]!==a||e[11]!==l||e[12]!==o||e[13]!==n){let f=R(P(U(d)),Q(g)),y;e[15]!==l||e[16]!==o?(y=(0,m.jsx)($,{onChange:l,testId:"ev-shard-input",value:o}),e[15]=l,e[16]=o,e[17]=y):y=e[17];let b;e[18]!==u||e[19]!==a?(b=u===null?null:(0,m.jsx)(F,{error:u,shardKey:a,testId:"ev-error"}),e[18]=u,e[19]=a,e[20]=b):b=e[20],v=(0,m.jsxs)("section",{className:"flex flex-col gap-4","data-testid":"ev-panel",children:[y,b,f.length===0?(0,m.jsx)(E,{description:n("Call recordEvaluation from a graded run and its score shows up here."),testId:"ev-empty",title:n("No evals recorded")}):(0,m.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:f.map(M=>(0,m.jsx)(z,{card:M,onOpenTrace:i},M.name))})]}),e[6]=d,e[7]=u,e[8]=g,e[9]=i,e[10]=a,e[11]=l,e[12]=o,e[13]=n,e[14]=v}else v=e[14];return v},"re");function G(s){return s.last}p(G,"Q");export{oe as default};
@@ -0,0 +1 @@
1
+ import{a as $e}from"./chunk-PLLNOYT6.js";import{g as Le}from"./chunk-STHN562E.js";import"./chunk-GXTSE66Z.js";import"./chunk-I2EFWZXX.js";import"./chunk-CL3JOU6F.js";import{a as ae}from"./chunk-G6IFVCSL.js";import"./chunk-KTK4NDWQ.js";import"./chunk-XLYFGUEF.js";import"./chunk-D65UVZIA.js";import"./chunk-NGVP66OH.js";import"./chunk-KGURUUEC.js";import"./chunk-QAOZXPLU.js";import{a as ge}from"./chunk-J45HAKBU.js";import{a as be}from"./chunk-PRTIYJFL.js";import"./chunk-3D67ZJRW.js";import"./chunk-DA2CAFXI.js";import{a as ue}from"./chunk-G2BUKFAD.js";import"./chunk-ZSWW2UGP.js";import"./chunk-RTS5G3ET.js";import"./chunk-QRA7AKYO.js";import{i as Je}from"./chunk-74WS3GUC.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as ce}from"./chunk-KSFVO6OB.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as se}from"./chunk-MY7J2X2Y.js";import{b as oe}from"./chunk-BWT5ANXC.js";import"./chunk-YUVGMKHG.js";import{a as ee,b as te,c as re,d as z,e as L,f as K}from"./chunk-AXKOMM2J.js";import"./chunk-XAI64L2D.js";import"./chunk-4PI2OSSP.js";import{a as me}from"./chunk-6A6AELDJ.js";import{b as ne,c as ve}from"./chunk-34E6NNQZ.js";import{a as Z,e as H}from"./chunk-2BN5NW34.js";import{l as je,n as de}from"./chunk-35IQT6SS.js";import"./chunk-ZPQBVYNN.js";import{B as V,h as fe,i as Ae,j as ie,k as xe,s as Y,w as le,x as Ie}from"./chunk-6DU2UW57.js";import"./chunk-PDBW6GTJ.js";import{a as Ce}from"./chunk-GWNGVKLG.js";import{a as we,b as Se}from"./chunk-6G3E4PJ2.js";import{a as y,d as he}from"./chunk-5PEAXTYQ.js";var G=he(Ce(),1),Q=he(we(),1);var t=he(Se(),1);var Fe=he(Ce(),1),pe=he(we(),1);var D=he(Se(),1);var Me=y(r=>Number.isFinite(r)?le(r,"\u2014"):"\u2014","X"),Ke=y(r=>r.toSorted((e,o)=>e.scheduledFor-o.scheduledFor),"F"),Be=y((r,e,o)=>e!==void 0?e:o===void 0?n=>r.cancelScheduledJob(n):void 0,"Y"),Te=y(r=>{let e=(0,Fe.c)(16),{cancelJob:o,loadJobs:n}=r===void 0?{}:r,l=de(),s=V(),a=n===void 0,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["lunora-scheduled-jobs"],e[0]=i):i=e[0];let c=ne(i,async()=>{let x=await(n??(()=>l.listScheduledJobs()))();return Ke(x)}),[N,p]=(0,pe.useState)(void 0),[h,m]=(0,pe.useState)(void 0),k,f;e[1]!==l||e[2]!==a?(k=y(()=>{if(a)return l.subscribeScheduledJobs(x=>{m(void 0),p(Ke(x))})},"v"),f=[a,l],e[1]=l,e[2]=a,e[3]=k,e[4]=f):(k=e[3],f=e[4]),(0,pe.useEffect)(k,f);let d;e[5]!==c?(d=y(()=>c.poll(),"y"),e[5]=c,e[6]=d):d=e[6],ae(d,!a);let u=Be(l,o,n),v=N??c.data,b=h??c.error,S=y(async x=>{if(u!==void 0){m(void 0);try{await u(x),a||c.refetch()}catch(A){m(ie(A))}}},"E"),I="flex flex-col gap-3",w="lunora-scheduled-jobs",C;e[7]!==b?(C=b!==null&&(0,D.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:b}),e[7]=b,e[8]=C):C=e[8];let J;e[9]!==v?.length||e[10]!==s?(J=v?.length===0&&(0,D.jsx)(se,{description:s("Jobs queued with runAfter / runAt will appear here."),icon:(0,D.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,D.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,D.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:s("No scheduled jobs.")}),e[9]=v?.length,e[10]=s,e[11]=J):J=e[11];let $=v!==void 0&&v.length>0&&(0,D.jsx)(Z,{className:"overflow-hidden py-0",children:(0,D.jsx)(H,{className:"px-0",children:(0,D.jsxs)(ee,{"data-testid":"sj-table",children:[(0,D.jsx)(te,{children:(0,D.jsxs)(z,{children:[(0,D.jsx)(L,{children:s("function")}),(0,D.jsx)(L,{children:s("scheduled for")}),(0,D.jsx)(L,{children:s("pool")}),(0,D.jsx)(L,{children:s("attempts")}),(0,D.jsx)(L,{children:s("shard")}),(0,D.jsx)(L,{children:s("id")}),u!==void 0&&(0,D.jsx)(L,{"aria-label":s("Actions")})]})}),(0,D.jsx)(re,{children:v.map(x=>(0,D.jsxs)(z,{"data-testid":`sj-row-${x.id}`,children:[(0,D.jsx)(K,{className:"font-mono text-xs",children:x.workflow??x.functionPath}),(0,D.jsx)(K,{className:"text-muted-foreground tabular-nums",children:Me(x.scheduledFor)}),(0,D.jsx)(K,{className:"font-mono text-xs",children:x.pool??""}),(0,D.jsx)(K,{className:"tabular-nums",children:x.attempts??0}),(0,D.jsx)(K,{children:x.shardKey??""}),(0,D.jsx)(K,{className:"font-mono text-xs",children:x.id}),u!==void 0&&(0,D.jsx)(K,{className:"text-right",children:(0,D.jsx)(ue,{confirmLabel:s("Cancel job?"),onConfirm:y(()=>{Y(S(x.id))},"onConfirm"),testId:`sj-cancel-${x.id}`,children:s("Cancel")})})]},x.id))})]})})}),j;return e[12]!==$||e[13]!==C||e[14]!==J?(j=(0,D.jsxs)("div",{className:I,"data-testid":w,children:[C,J,$]}),e[12]=$,e[13]=C,e[14]=J,e[15]=j):j=e[15],j},"he");var _e={failed:"destructive",skipped:"warning",succeeded:"success"},Re=25,Pe=y(r=>r<1e3?`${String(r)} ms`:`${(r/1e3).toFixed(1)} s`,"Ee"),Oe=y(r=>{let e=(0,G.c)(39),{inFlight:o,last:n}=r,l=V();if(o!==void 0){let u;e[0]!==l?(u=l("running"),e[0]=l,e[1]=u):u=e[1];let v;e[2]!==u?(v=(0,t.jsx)(oe,{variant:"info",children:u}),e[2]=u,e[3]=v):v=e[3];let b;e[4]!==o.startedAt?(b=le(o.startedAt,"\u2014"),e[4]=o.startedAt,e[5]=b):b=e[5];let S;e[6]!==b?(S=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:b}),e[6]=b,e[7]=S):S=e[7];let I;e[8]!==o.skipped||e[9]!==l?(I=o.skipped>0&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l("{count} ticks skipped",{count:o.skipped})}),e[8]=o.skipped,e[9]=l,e[10]=I):I=e[10];let w;return e[11]!==v||e[12]!==S||e[13]!==I?(w=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[v,S,I]}),e[11]=v,e[12]=S,e[13]=I,e[14]=w):w=e[14],w}if(n===void 0){let u;e[15]!==l?(u=l("never"),e[15]=l,e[16]=u):u=e[16];let v;return e[17]!==u?(v=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:u}),e[17]=u,e[18]=v):v=e[18],v}let s;e[19]!==l?(s=l("failed"),e[19]=l,e[20]=s):s=e[20];let a;e[21]!==l?(a=l("skipped"),e[21]=l,e[22]=a):a=e[22];let i;e[23]!==l?(i=l("succeeded"),e[23]=l,e[24]=i):i=e[24];let c;e[25]!==s||e[26]!==a||e[27]!==i?(c={failed:s,skipped:a,succeeded:i},e[25]=s,e[26]=a,e[27]=i,e[28]=c):c=e[28];let N=c,p=_e[n.status],h=N[n.status],m;e[29]!==p||e[30]!==h?(m=(0,t.jsx)(oe,{variant:p,children:h}),e[29]=p,e[30]=h,e[31]=m):m=e[31];let k;e[32]!==n.startedAt?(k=le(n.startedAt,"\u2014"),e[32]=n.startedAt,e[33]=k):k=e[33];let f;e[34]!==k?(f=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:k}),e[34]=k,e[35]=f):f=e[35];let d;return e[36]!==m||e[37]!==f?(d=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[m,f]}),e[36]=m,e[37]=f,e[38]=d):d=e[38],d},"Re"),Ee=y(r=>{let e=(0,G.c)(80),{runs:o}=r,n=V();if(o.length===0)return;let l,s,a,i,c,N,p,h,m,k,f;if(e[0]!==o||e[1]!==n){let I=o.toSorted(Ue).slice(0,Re),w;e[13]!==n?(w=n("failed"),e[13]=n,e[14]=w):w=e[14];let C;e[15]!==n?(C=n("skipped"),e[15]=n,e[16]=C):C=e[16];let J;e[17]!==n?(J=n("succeeded"),e[17]=n,e[18]=J):J=e[18];let $;e[19]!==J||e[20]!==w||e[21]!==C?($={failed:w,skipped:C,succeeded:J},e[19]=J,e[20]=w,e[21]=C,e[22]=$):$=e[22];let j=$;m="flex flex-col gap-2",k="cron-run-history";let x;e[23]!==n?(x=n("Recent runs"),e[23]=n,e[24]=x):x=e[24],e[25]!==x?(f=(0,t.jsx)("h3",{className:"text-sm font-medium",children:x}),e[25]=x,e[26]=f):f=e[26],i=Z,h="overflow-hidden py-0",a=H,p="px-0",s=ee;let A;e[27]!==n?(A=n("name"),e[27]=n,e[28]=A):A=e[28];let g;e[29]!==A?(g=(0,t.jsx)(L,{children:A}),e[29]=A,e[30]=g):g=e[30];let F;e[31]!==n?(F=n("status"),e[31]=n,e[32]=F):F=e[32];let _;e[33]!==F?(_=(0,t.jsx)(L,{children:F}),e[33]=F,e[34]=_):_=e[34];let T;e[35]!==n?(T=n("started"),e[35]=n,e[36]=T):T=e[36];let M;e[37]!==T?(M=(0,t.jsx)(L,{children:T}),e[37]=T,e[38]=M):M=e[38];let R;e[39]!==n?(R=n("duration"),e[39]=n,e[40]=R):R=e[40];let W;e[41]!==R?(W=(0,t.jsx)(L,{children:R}),e[41]=R,e[42]=W):W=e[42];let B;e[43]!==n?(B=n("skipped"),e[43]=n,e[44]=B):B=e[44];let E;e[45]!==B?(E=(0,t.jsx)(L,{children:B}),e[45]=B,e[46]=E):E=e[46];let U;e[47]!==n?(U=n("error"),e[47]=n,e[48]=U):U=e[48];let P;e[49]!==U?(P=(0,t.jsx)(L,{children:U}),e[49]=U,e[50]=P):P=e[50],e[51]!==g||e[52]!==_||e[53]!==M||e[54]!==W||e[55]!==E||e[56]!==P?(N=(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[g,_,M,W,E,P]})}),e[51]=g,e[52]=_,e[53]=M,e[54]=W,e[55]=E,e[56]=P,e[57]=N):N=e[57],l=re;let X;e[58]!==j?(X=y(q=>(0,t.jsxs)(z,{"data-testid":`cron-run-row-${q.runId}`,children:[(0,t.jsx)(K,{children:q.name}),(0,t.jsx)(K,{children:(0,t.jsx)(oe,{variant:_e[q.status],children:j[q.status]})}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:le(q.startedAt,"\u2014")}),(0,t.jsx)(K,{className:"tabular-nums",children:q.status==="skipped"?"":Pe(q.durationMs)}),(0,t.jsx)(K,{className:"tabular-nums",children:q.skipped>0?q.skipped:""}),(0,t.jsx)(K,{className:"text-xs text-destructive",children:q.error??""})]},q.runId),"W"),e[58]=j,e[59]=X):X=e[59],c=I.map(X),e[0]=o,e[1]=n,e[2]=l,e[3]=s,e[4]=a,e[5]=i,e[6]=c,e[7]=N,e[8]=p,e[9]=h,e[10]=m,e[11]=k,e[12]=f}else l=e[2],s=e[3],a=e[4],i=e[5],c=e[6],N=e[7],p=e[8],h=e[9],m=e[10],k=e[11],f=e[12];let d;e[60]!==l||e[61]!==c?(d=(0,t.jsx)(l,{children:c}),e[60]=l,e[61]=c,e[62]=d):d=e[62];let u;e[63]!==s||e[64]!==N||e[65]!==d?(u=(0,t.jsxs)(s,{children:[N,d]}),e[63]=s,e[64]=N,e[65]=d,e[66]=u):u=e[66];let v;e[67]!==a||e[68]!==p||e[69]!==u?(v=(0,t.jsx)(a,{className:p,children:u}),e[67]=a,e[68]=p,e[69]=u,e[70]=v):v=e[70];let b;e[71]!==i||e[72]!==v||e[73]!==h?(b=(0,t.jsx)(i,{className:h,children:v}),e[71]=i,e[72]=v,e[73]=h,e[74]=b):b=e[74];let S;return e[75]!==b||e[76]!==m||e[77]!==k||e[78]!==f?(S=(0,t.jsxs)("div",{className:m,"data-testid":k,children:[f,b]}),e[75]=b,e[76]=m,e[77]=k,e[78]=f,e[79]=S):S=e[79],S},"Le");function Ue(r,e){return e.startedAt-r.startedAt}y(Ue,"Oe");var We=y(()=>{let r=(0,G.c)(50),e=V(),o=$e(""),[n,l]=(0,Q.useState)(""),[s,a]=(0,Q.useState)(void 0),[i,c]=(0,Q.useState)(!1);if(o.unavailable)return null;let N;r[0]!==o?(N=o.pending("cron"),r[0]=o,r[1]=N):N=r[1];let p=N,h;r[2]!==o?(h=o.reason("cron"),r[2]=o,r[3]=h):h=r[3];let m=h,k;r[4]!==n||r[5]!==o?(k=y(()=>{let T=n.trim();T!==""&&Y((async()=>{let M=await o.suggestCron(T);c(!1),a(M)})())},"y"),r[4]=n,r[5]=o,r[6]=k):k=r[6];let f=k,d;r[7]!==s?(d=y(()=>{let T="navigator"in globalThis?globalThis.navigator.clipboard:void 0;T===void 0||s===void 0||Y((async()=>{try{await T.writeText(s),c(!0)}catch{c(!1)}})())},"d"),r[7]=s,r[8]=d):d=r[8];let u=d,v;r[9]!==e?(v=e("Describe a schedule"),r[9]=e,r[10]=v):v=r[10];let b;r[11]===Symbol.for("react.memo_cache_sentinel")?(b=y(T=>{l(T.target.value)},"b"),r[11]=b):b=r[11];let S;r[12]!==f?(S=y(T=>{T.key==="Enter"&&(T.preventDefault(),f())},"w"),r[12]=f,r[13]=S):S=r[13];let I;r[14]!==e?(I=e("Describe a schedule"),r[14]=e,r[15]=I):I=r[15];let w;r[16]!==p||r[17]!==n||r[18]!==v||r[19]!==S||r[20]!==I?(w=(0,t.jsx)(Je,{"aria-label":v,className:"h-7 flex-1 text-xs","data-testid":"cron-assistant-prompt",disabled:p,onChange:b,onKeyDown:S,placeholder:I,value:n}),r[16]=p,r[17]=n,r[18]=v,r[19]=S,r[20]=I,r[21]=w):w=r[21];let C=p&&"opacity-60",J;r[22]!==C?(J=Ie("rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",C),r[22]=C,r[23]=J):J=r[23];let $;r[24]!==p||r[25]!==n?($=p||n.trim()==="",r[24]=p,r[25]=n,r[26]=$):$=r[26];let j;r[27]!==p||r[28]!==e?(j=e(p?"Thinking\u2026":"Suggest schedule"),r[27]=p,r[28]=e,r[29]=j):j=r[29];let x;r[30]!==f||r[31]!==J||r[32]!==$||r[33]!==j?(x=(0,t.jsx)("button",{className:J,"data-testid":"cron-assistant-generate",disabled:$,onClick:f,type:"button",children:j}),r[30]=f,r[31]=J,r[32]=$,r[33]=j,r[34]=x):x=r[34];let A;r[35]!==x||r[36]!==w?(A=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[w,x]}),r[35]=x,r[36]=w,r[37]=A):A=r[37];let g;r[38]!==i||r[39]!==u||r[40]!==s||r[41]!==e?(g=s!==void 0&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs tabular-nums","data-testid":"cron-assistant-result",children:s}),(0,t.jsx)("button",{className:"rounded-md border border-border px-2 py-0.5 text-[11px] outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"cron-assistant-copy",onClick:u,type:"button",children:e(i?"Copied":"Copy")}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:e("Add it to lunora/crons.ts \u2014 triggers are compiled into the worker.")})]}),r[38]=i,r[39]=u,r[40]=s,r[41]=e,r[42]=g):g=r[42];let F;r[43]!==m||r[44]!==e?(F=m!==void 0&&(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"cron-assistant-reason",role:"status",children:e(m==="ai-error"?"The model could not be reached.":"The model did not return a schedule Cron Triggers accept.")}),r[43]=m,r[44]=e,r[45]=F):F=r[45];let _;return r[46]!==A||r[47]!==g||r[48]!==F?(_=(0,t.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"cron-assistant",children:[A,g,F]}),r[46]=A,r[47]=g,r[48]=F,r[49]=_):_=r[49],_},"Ke"),ze={kind:"idle"},qe="SCHEDULER_NOT_CONFIGURED",ye={inFlight:[],runs:[]},Ve=y((r,e,o)=>o!==void 0?o:e===void 0?n=>r.runCronJob(n):void 0,"Fe"),Ge=y(({loadCronJobs:r,loadCronRuns:e,runCronJob:o}={})=>{let n=de(),l=V(),[s,a]=(0,Q.useState)({}),i=ne(["lunora-cron-jobs",r?"custom":"default"],()=>(r??(()=>n.getCronJobs()))()),{data:c,error:N}=i,p=e??(r===void 0?()=>n.listCronRuns():void 0),h=ne(["lunora-cron-runs",e?"custom":"default"],async()=>p===void 0?ye:p().catch(d=>{if(xe(d)===qe)return ye;throw d})),m=h.data??ye;ae(()=>h.poll(),p!==void 0);let k=Ve(n,r,o),f=y(async d=>{if(k!==void 0){a(u=>({...u,[d]:{kind:"running"}}));try{await k(d),a(u=>({...u,[d]:{kind:"ok"}})),i.refetch(),h.refetch()}catch(u){a(v=>({...v,[d]:{kind:"error",message:ie(u)}}))}}},"p");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[(0,t.jsx)(We,{}),N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-runs-error",role:"alert",children:h.error}),c?.length===0&&(0,t.jsx)(se,{description:l("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:l("No cron triggers.")}),c!==void 0&&c.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"cron-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:l("name")}),(0,t.jsx)(L,{children:l("schedule")}),(0,t.jsx)(L,{children:l("target")}),(0,t.jsx)(L,{children:l("shard")}),(0,t.jsx)(L,{children:l("last run")}),k!==void 0&&(0,t.jsx)(L,{"aria-label":l("Actions")})]})}),(0,t.jsx)(re,{children:c.map(d=>{let u=s[d.name]??ze;return(0,t.jsxs)(z,{"data-testid":`cron-row-${d.name}`,children:[(0,t.jsx)(K,{children:d.name}),(0,t.jsx)(K,{className:"font-mono text-xs tabular-nums",children:d.cron}),(0,t.jsx)(K,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[d.workflow===void 0?(0,t.jsx)(oe,{variant:"outline",children:l("function")}):(0,t.jsx)(oe,{variant:"secondary",children:l("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:d.workflow??d.functionPath})]})}),(0,t.jsx)(K,{children:d.shardKey??""}),(0,t.jsx)(K,{"data-testid":`cron-last-run-${d.name}`,children:(0,t.jsx)(Oe,{inFlight:m.inFlight.find(v=>v.name===d.name),last:m.runs.find(v=>v.name===d.name)})}),k!==void 0&&(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[u.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${d.name}`,children:l("ran")}),u.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${d.name}`,role:"alert",children:u.message}),(0,t.jsx)(ue,{confirmLabel:l("Run now?"),disabled:u.kind==="running",onConfirm:y(()=>{Y(f(d.name))},"onConfirm"),testId:`cron-run-${d.name}`,children:u.kind==="running"?l("Running\u2026"):l("Run now")})]})})]},`${d.cron}:${d.name}`)})})]})})}),(0,t.jsx)(Ee,{runs:m.runs})]})},"Je"),Qe=y(r=>Number.isFinite(r)?le(r,"\u2014"):"\u2014","Me"),Xe=y(r=>{let e=(0,G.c)(34),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{loadJobs:n,removeJob:l,retryJob:s}=o,a=de(),i=V(),c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-dead-jobs"],e[2]=c):c=e[2];let N;e[3]!==a||e[4]!==n?(N=y(async()=>(await(n??(()=>a.listDeadJobs()))()).toSorted(Ye),"v"),e[3]=a,e[4]=n,e[5]=N):N=e[5];let p=ne(c,N),h=p.data,[m,k]=(0,Q.useState)(void 0),f=p.error??m,d=n===void 0,u;e[6]!==a||e[7]!==d||e[8]!==s?(u=s??(d?g=>a.retryDeadJob(g):void 0),e[6]=a,e[7]=d,e[8]=s,e[9]=u):u=e[9];let v=u,b;e[10]!==a||e[11]!==d||e[12]!==l?(b=l??(d?g=>a.removeDeadJob(g):void 0),e[10]=a,e[11]=d,e[12]=l,e[13]=b):b=e[13];let S=b,I;e[14]!==p?(I=y(()=>p.poll(),"S"),e[14]=p,e[15]=I):I=e[15],ae(I,!0);let w;e[16]!==p?(w=y(async g=>{k(void 0);try{await g,p.refetch()}catch(F){k(ie(F))}},"N"),e[16]=p,e[17]=w):w=e[17];let C=w,J=v!==void 0||S!==void 0,$;e[18]!==f?($=f!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:f}),e[18]=f,e[19]=$):$=e[19];let j;e[20]!==h?.length||e[21]!==i?(j=h?.length===0&&(0,t.jsx)(se,{description:i("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:i("No dead-letter jobs.")}),e[20]=h?.length,e[21]=i,e[22]=j):j=e[22];let x;e[23]!==C||e[24]!==J||e[25]!==h||e[26]!==S||e[27]!==v||e[28]!==i?(x=h!==void 0&&h.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"dlq-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:i("function")}),(0,t.jsx)(L,{children:i("attempts")}),(0,t.jsx)(L,{children:i("last tried")}),(0,t.jsx)(L,{children:i("pool")}),(0,t.jsx)(L,{children:i("shard")}),(0,t.jsx)(L,{children:i("id")}),J&&(0,t.jsx)(L,{"aria-label":i("Actions")})]})}),(0,t.jsx)(re,{children:h.map(g=>(0,t.jsxs)(z,{"data-testid":`dlq-row-${g.id}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:g.workflow??g.functionPath}),(0,t.jsx)(K,{className:"tabular-nums",children:g.attempts??0}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:Qe(g.scheduledFor)}),(0,t.jsx)(K,{className:"font-mono text-xs",children:g.pool??""}),(0,t.jsx)(K,{children:g.shardKey??""}),(0,t.jsx)(K,{className:"font-mono text-xs",children:g.id}),J&&(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[v!==void 0&&(0,t.jsx)(ce,{"data-testid":`dlq-retry-${g.id}`,onClick:y(()=>{Y(C(v(g.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:i("Retry")}),S!==void 0&&(0,t.jsx)(ue,{confirmLabel:i("Drop job?"),onConfirm:y(()=>{Y(C(S(g.id)))},"onConfirm"),testId:`dlq-remove-${g.id}`,children:i("Drop")})]})})]},g.id))})]})})}),e[23]=C,e[24]=J,e[25]=h,e[26]=S,e[27]=v,e[28]=i,e[29]=x):x=e[29];let A;return e[30]!==x||e[31]!==$||e[32]!==j?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,j,x]}),e[30]=x,e[31]=$,e[32]=j,e[33]=A):A=e[33],A},"Pe");function Ye(r,e){return(e.attempts??0)-(r.attempts??0)}y(Ye,"qe");var Ze={canceled:"secondary",failed:"destructive",pending:"outline",running:"info",succeeded:"success"},He=y(r=>{let e=(0,G.c)(47),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{loadJobs:n}=o,l=de(),s=V(),a;e[2]!==l||e[3]!==n?(a=n??(async O=>l.listScheduledHistory(O===void 0?{}:{cursor:O})),e[2]=l,e[3]=n,e[4]=a):a=e[4];let i=a,c=n?"custom":"default",N;e[5]!==c?(N=["lunora-job-history",c],e[5]=c,e[6]=N):N=e[6];let p;e[7]!==i?(p=y(async()=>i(),"f"),e[7]=i,e[8]=p):p=e[8];let h=ne(N,p),[m,k]=(0,Q.useState)(void 0),[f,d]=(0,Q.useState)(!1),[u,v]=(0,Q.useState)(void 0),b=h.data?.records,S;e[9]!==b?(S=new Set(b?.map(et)),e[9]=b,e[10]=S):S=e[10];let I=S,w=b===void 0?void 0:[...b,...(m?.records??[]).filter(O=>!I.has(O.id))],C=m===void 0?h.data?.cursor:m.cursor,J;e[11]!==i||e[12]!==C?(J=y(async()=>{d(!0),v(void 0);try{let O=await i(C);k(De=>({cursor:O.cursor,records:[...De?.records??[],...O.records]})),d(!1)}catch(O){v(ie(O)),d(!1)}},"L"),e[11]=i,e[12]=C,e[13]=J):J=e[13];let $=J,j;e[14]!==s?(j=s("canceled"),e[14]=s,e[15]=j):j=e[15];let x;e[16]!==s?(x=s("failed"),e[16]=s,e[17]=x):x=e[17];let A;e[18]!==s?(A=s("pending"),e[18]=s,e[19]=A):A=e[19];let g;e[20]!==s?(g=s("running"),e[20]=s,e[21]=g):g=e[21];let F;e[22]!==s?(F=s("succeeded"),e[22]=s,e[23]=F):F=e[23];let _;e[24]!==A||e[25]!==g||e[26]!==F||e[27]!==j||e[28]!==x?(_={canceled:j,failed:x,pending:A,running:g,succeeded:F},e[24]=A,e[25]=g,e[26]=F,e[27]=j,e[28]=x,e[29]=_):_=e[29];let T=_,M;e[30]!==h?(M=y(()=>h.poll(),"_"),e[30]=h,e[31]=M):M=e[31],ae(M,m===void 0);let R="flex flex-col gap-3",W="lunora-job-history",B;e[32]!==h.error?(B=h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"job-history-error",role:"alert",children:h.error}),e[32]=h.error,e[33]=B):B=e[33];let E=w?.length===0&&(0,t.jsx)(se,{description:s("Jobs that succeed, fail or are cancelled stay here for seven days."),testId:"job-history-empty",title:s("No finished jobs.")}),U=w!==void 0&&w.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"job-history-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:s("function")}),(0,t.jsx)(L,{children:s("state")}),(0,t.jsx)(L,{children:s("finished")}),(0,t.jsx)(L,{children:s("error")}),(0,t.jsx)(L,{children:s("id")})]})}),(0,t.jsx)(re,{children:w.map(O=>(0,t.jsxs)(z,{"data-testid":`job-history-row-${O.id}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:O.workflow??O.functionPath}),(0,t.jsx)(K,{children:(0,t.jsx)(oe,{"data-testid":`job-history-state-${O.id}`,variant:Ze[O.state],children:T[O.state]})}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:le(O.completedAt,"\u2014")}),(0,t.jsx)(K,{className:"text-xs text-destructive",children:O.error??""}),(0,t.jsx)(K,{className:"font-mono text-xs",children:O.id})]},O.id))})]})})}),P;e[34]!==u?(P=u!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:u}),e[34]=u,e[35]=P):P=e[35];let X;e[36]!==f||e[37]!==C||e[38]!==$||e[39]!==s?(X=C!==void 0&&(0,t.jsx)("div",{children:(0,t.jsx)(ce,{"data-testid":"job-history-load-more",disabled:f,onClick:y(()=>{Y($())},"onClick"),variant:"outline",children:s(f?"Loading\u2026":"Load more")})}),e[36]=f,e[37]=C,e[38]=$,e[39]=s,e[40]=X):X=e[40];let q;return e[41]!==B||e[42]!==E||e[43]!==U||e[44]!==P||e[45]!==X?(q=(0,t.jsxs)("div",{className:R,"data-testid":W,children:[B,E,U,P,X]}),e[41]=B,e[42]=E,e[43]=U,e[44]=P,e[45]=X,e[46]=q):q=e[46],q},"Be");function et(r){return r.id}y(et,"He");var tt=fe(me.dropOutboxEntry),rt=fe(me.retryOutboxEntry),lt=y(()=>{let r=(0,G.c)(8),e=V(),o;r[0]!==e?(o=e("Jobs whose mutation committed but that the scheduler has not accepted yet wait here."),r[0]=e,r[1]=o):o=r[1];let n;r[2]===Symbol.for("react.memo_cache_sentinel")?(n=(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 4h16v12H4zM4 16l4 4h8l4-4"})}),r[2]=n):n=r[2];let l;r[3]!==e?(l=e("Nothing is waiting for the scheduler."),r[3]=e,r[4]=l):l=r[4];let s;return r[5]!==o||r[6]!==l?(s=(0,t.jsx)(se,{description:o,icon:n,testId:"outbox-empty",title:l}),r[5]=o,r[6]=l,r[7]=s):s=r[7],s},"ze"),at=y(r=>{let e=(0,G.c)(58),{entry:o,onAct:n}=r,l=V(),s=`outbox-row-${o.id}`,a;e[0]!==o.target||e[1]!==l?(a=o.target??l("unreadable"),e[0]=o.target,e[1]=l,e[2]=a):a=e[2];let i;e[3]!==a?(i=(0,t.jsx)(K,{className:"font-mono text-xs",children:a}),e[3]=a,e[4]=i):i=e[4];let c=o.parked?"destructive":"secondary",N;e[5]!==o.parked||e[6]!==l?(N=o.parked?l("parked"):l("retrying"),e[5]=o.parked,e[6]=l,e[7]=N):N=e[7];let p;e[8]!==c||e[9]!==N?(p=(0,t.jsx)(oe,{variant:c,children:N}),e[8]=c,e[9]=N,e[10]=p):p=e[10];let h;e[11]!==o.forever||e[12]!==l?(h=o.forever&&(0,t.jsx)(oe,{variant:"outline",children:l("forever")}),e[11]=o.forever,e[12]=l,e[13]=h):h=e[13];let m;e[14]!==p||e[15]!==h?(m=(0,t.jsx)(K,{children:(0,t.jsxs)("div",{className:"flex gap-1",children:[p,h]})}),e[14]=p,e[15]=h,e[16]=m):m=e[16];let k;e[17]!==o.attempts?(k=(0,t.jsx)(K,{className:"tabular-nums",children:o.attempts}),e[17]=o.attempts,e[18]=k):k=e[18];let f;e[19]!==o.nextAttemptAt||e[20]!==o.parked?(f=o.parked?"\u2014":le(o.nextAttemptAt,"\u2014"),e[19]=o.nextAttemptAt,e[20]=o.parked,e[21]=f):f=e[21];let d;e[22]!==f?(d=(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:f}),e[22]=f,e[23]=d):d=e[23];let u;e[24]!==o.id?(u=(0,t.jsx)(K,{className:"font-mono text-xs",children:o.id}),e[24]=o.id,e[25]=u):u=e[25];let v=`outbox-retry-${o.id}`,b;e[26]!==o.id||e[27]!==n?(b=y(()=>{Y(n(rt,o.id))},"b"),e[26]=o.id,e[27]=n,e[28]=b):b=e[28];let S;e[29]!==l?(S=l("Retry now"),e[29]=l,e[30]=S):S=e[30];let I;e[31]!==v||e[32]!==b||e[33]!==S?(I=(0,t.jsx)(ce,{"data-testid":v,onClick:b,size:"sm",type:"button",variant:"outline",children:S}),e[31]=v,e[32]=b,e[33]=S,e[34]=I):I=e[34];let w;e[35]!==l?(w=l("Drop job?"),e[35]=l,e[36]=w):w=e[36];let C;e[37]!==o.id||e[38]!==n?(C=y(()=>{Y(n(tt,o.id))},"T"),e[37]=o.id,e[38]=n,e[39]=C):C=e[39];let J=`outbox-drop-${o.id}`,$;e[40]!==l?($=l("Drop"),e[40]=l,e[41]=$):$=e[41];let j;e[42]!==w||e[43]!==C||e[44]!==J||e[45]!==$?(j=(0,t.jsx)(ue,{confirmLabel:w,onConfirm:C,testId:J,children:$}),e[42]=w,e[43]=C,e[44]=J,e[45]=$,e[46]=j):j=e[46];let x;e[47]!==I||e[48]!==j?(x=(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[I,j]})}),e[47]=I,e[48]=j,e[49]=x):x=e[49];let A;return e[50]!==s||e[51]!==d||e[52]!==u||e[53]!==x||e[54]!==i||e[55]!==m||e[56]!==k?(A=(0,t.jsxs)(z,{"data-testid":s,children:[i,m,k,d,u,x]}),e[50]=s,e[51]=d,e[52]=u,e[53]=x,e[54]=i,e[55]=m,e[56]=k,e[57]=A):A=e[57],A},"We"),ot=y(r=>{let e=(0,G.c)(41),{entries:o,onAct:n}=r,l=V(),s;e[0]!==l?(s=l("function"),e[0]=l,e[1]=s):s=e[1];let a;e[2]!==s?(a=(0,t.jsx)(L,{children:s}),e[2]=s,e[3]=a):a=e[3];let i;e[4]!==l?(i=l("state"),e[4]=l,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,t.jsx)(L,{children:i}),e[6]=i,e[7]=c):c=e[7];let N;e[8]!==l?(N=l("attempts"),e[8]=l,e[9]=N):N=e[9];let p;e[10]!==N?(p=(0,t.jsx)(L,{children:N}),e[10]=N,e[11]=p):p=e[11];let h;e[12]!==l?(h=l("next attempt"),e[12]=l,e[13]=h):h=e[13];let m;e[14]!==h?(m=(0,t.jsx)(L,{children:h}),e[14]=h,e[15]=m):m=e[15];let k;e[16]!==l?(k=l("id"),e[16]=l,e[17]=k):k=e[17];let f;e[18]!==k?(f=(0,t.jsx)(L,{children:k}),e[18]=k,e[19]=f):f=e[19];let d;e[20]!==l?(d=l("Actions"),e[20]=l,e[21]=d):d=e[21];let u;e[22]!==d?(u=(0,t.jsx)(L,{"aria-label":d}),e[22]=d,e[23]=u):u=e[23];let v;e[24]!==f||e[25]!==u||e[26]!==a||e[27]!==c||e[28]!==p||e[29]!==m?(v=(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[a,c,p,m,f,u]})}),e[24]=f,e[25]=u,e[26]=a,e[27]=c,e[28]=p,e[29]=m,e[30]=v):v=e[30];let b;if(e[31]!==o||e[32]!==n){let w;e[34]!==n?(w=y(C=>(0,t.jsx)(at,{entry:C,onAct:n},C.id),"N"),e[34]=n,e[35]=w):w=e[35],b=o.map(w),e[31]=o,e[32]=n,e[33]=b}else b=e[33];let S;e[36]!==b?(S=(0,t.jsx)(re,{children:b}),e[36]=b,e[37]=S):S=e[37];let I;return e[38]!==v||e[39]!==S?(I=(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"outbox-table",children:[v,S]})})}),e[38]=v,e[39]=S,e[40]=I):I=e[40],I},"Ge"),nt=y(r=>{let e=(0,G.c)(11),{cursor:o,nextCursor:n,onFirst:l,onNext:s}=r,a=V();if(o===void 0&&n===void 0)return;let i;e[0]!==o||e[1]!==l||e[2]!==a?(i=o!==void 0&&(0,t.jsx)(ce,{"data-testid":"outbox-first-page",onClick:l,size:"sm",type:"button",variant:"outline",children:a("First page")}),e[0]=o,e[1]=l,e[2]=a,e[3]=i):i=e[3];let c;e[4]!==n||e[5]!==s||e[6]!==a?(c=n!==void 0&&(0,t.jsx)(ce,{"data-testid":"outbox-next-page",onClick:y(()=>{s(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:a("Next page")}),e[4]=n,e[5]=s,e[6]=a,e[7]=c):c=e[7];let N;return e[8]!==i||e[9]!==c?(N=(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[i,c]}),e[8]=i,e[9]=c,e[10]=N):N=e[10],N},"Ye"),st=y(r=>{let e=(0,G.c)(38),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n}=o,l=je(),s=V(),{queryShardKey:a,setShardKey:i,shardKey:c}=ge(n),N;e[2]!==a?(N={cursor:void 0,shardKey:a},e[2]=a,e[3]=N):N=e[3];let[p,h]=(0,Q.useState)(N);p.shardKey!==a&&h({cursor:void 0,shardKey:a});let m=p.shardKey===a?p.cursor:void 0,k=c.trim()!==a,f;e[4]!==m?(f=m===void 0?{}:{cursor:m},e[4]=m,e[5]=f):f=e[5];let d;e[6]!==a?(d={shardKey:a},e[6]=a,e[7]=d):d=e[7];let{data:u,error:v,poll:b,refetch:S}=ve(me.getScheduleOutbox,f,d),I=k?void 0:u?.entries,w=k?void 0:u?.nextCursor,[C,J]=(0,Q.useState)(void 0),$=v??(C?.shardKey===a?C.message:void 0);ae(b,!0);let j;e[8]!==l||e[9]!==a||e[10]!==S||e[11]!==s?(j=y(async(B,E)=>{J(void 0);try{(await l.query(B,{id:E},Ae(a))).retried===!1&&J({message:s("That job is no longer in the outbox."),shardKey:a}),S()}catch(U){J({message:ie(U),shardKey:a})}},"A"),e[8]=l,e[9]=a,e[10]=S,e[11]=s,e[12]=j):j=e[12];let x=j,A;e[13]!==i||e[14]!==c?(A=(0,t.jsx)(be,{onChange:i,testId:"outbox-shard-input",value:c}),e[13]=i,e[14]=c,e[15]=A):A=e[15];let g;e[16]!==$?(g=$!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"outbox-error",role:"alert",children:$}),e[16]=$,e[17]=g):g=e[17];let F;e[18]!==m||e[19]!==I?.length?(F=I?.length===0&&m===void 0&&(0,t.jsx)(lt,{}),e[18]=m,e[19]=I?.length,e[20]=F):F=e[20];let _;e[21]!==x||e[22]!==I?(_=I!==void 0&&I.length>0&&(0,t.jsx)(ot,{entries:I,onAct:x}),e[21]=x,e[22]=I,e[23]=_):_=e[23];let T,M;e[24]!==a?(T=y(()=>{h({cursor:void 0,shardKey:a})},"E"),M=y(B=>{h({cursor:B,shardKey:a})},"_"),e[24]=a,e[25]=T,e[26]=M):(T=e[25],M=e[26]);let R;e[27]!==m||e[28]!==w||e[29]!==T||e[30]!==M?(R=(0,t.jsx)(nt,{cursor:m,nextCursor:w,onFirst:T,onNext:M}),e[27]=m,e[28]=w,e[29]=T,e[30]=M,e[31]=R):R=e[31];let W;return e[32]!==R||e[33]!==A||e[34]!==g||e[35]!==F||e[36]!==_?(W=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-schedule-outbox",children:[A,g,F,_,R]}),e[32]=R,e[33]=A,e[34]=g,e[35]=F,e[36]=_,e[37]=W):W=e[37],W},"je"),it="scheduler.lag_ms",Ne=y(r=>{let e=r.attributes?.function;return typeof e=="string"?e:r.functionPath},"he"),ke=y(r=>{let e=(0,G.c)(8),{label:o,testId:n,value:l}=r,s;e[0]!==o?(s=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:o}),e[0]=o,e[1]=s):s=e[1];let a;e[2]!==n||e[3]!==l?(a=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":n,children:l}),e[2]=n,e[3]=l,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=(0,t.jsx)(Z,{className:"flex-1 py-0",children:(0,t.jsxs)(H,{className:"flex flex-col gap-1 p-4",children:[s,a]})}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i},"fe"),dt=y(r=>{let e=(0,G.c)(65),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n,loadStatus:l}=o,s=de(),a=V(),i=l===void 0,c;e[2]!==i?(c=["lunora-scheduler-status",i],e[2]=i,e[3]=c):c=e[3];let N;e[4]!==s||e[5]!==l?(N=y(async()=>{let B=await(l??(()=>s.schedulerStatus()))();return{...B,pools:B.pools.toSorted(ct)}},"v"),e[4]=s,e[5]=l,e[6]=N):N=e[6];let p=ne(c,N),{data:h,error:m}=p,{queryShardKey:k,setShardKey:f,shardKey:d}=ge(n),u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u={},e[7]=u):u=e[7];let v;e[8]!==k?(v={shardKey:k},e[8]=k,e[9]=v):v=e[9];let b=ve(me.getMetricSeries,u,v),{data:S,errorSource:I}=b,w;e[10]!==I||e[11]!==b.error?(w=xe(I)==="FUNCTION_NOT_FOUND"?null:b.error,e[10]=I,e[11]=b.error,e[12]=w):w=e[12];let C=w,J;e[13]!==p?(J=y(()=>p.poll(),"L"),e[13]=p,e[14]=J):J=e[14],ae(J,!0);let $;e[15]!==b?($=y(()=>b.poll(),"$"),e[15]=b,e[16]=$):$=e[16],ae($,!0);let j,x,A,g,F,_,T,M;if(e[17]!==m||e[18]!==S||e[19]!==C||e[20]!==f||e[21]!==d||e[22]!==h||e[23]!==a){let B=(Array.isArray(S?.series)?S.series:[]).filter(ht).toSorted(ut);j="flex flex-col gap-3",x="lunora-scheduler-pools",e[32]!==m?(A=m!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:m}),e[32]=m,e[33]=A):A=e[33],e[34]!==h||e[35]!==a?(g=h!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(ke,{label:a("backlog"),testId:"pools-backlog",value:h.backlog}),(0,t.jsx)(ke,{label:a("in flight"),testId:"pools-inflight",value:h.inFlight}),(0,t.jsx)(ke,{label:a("pools"),testId:"pools-count",value:h.pools.length})]}),e[34]=h,e[35]=a,e[36]=g):g=e[36],e[37]!==h?.pools.length||e[38]!==a?(F=h?.pools.length===0&&(0,t.jsx)(se,{description:a("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:a("No workpools.")}),e[37]=h?.pools.length,e[38]=a,e[39]=F):F=e[39];let E;e[40]!==f||e[41]!==d?(E=(0,t.jsx)(be,{onChange:f,testId:"lag-shard-input",value:d}),e[40]=f,e[41]=d,e[42]=E):E=e[42];let U;e[43]!==a?(U=a("Start lag per job on this shard since it last woke; the series reset when the shard hibernates."),e[43]=a,e[44]=U):U=e[44];let P;e[45]!==U?(P=(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"lag-scope",children:U}),e[45]=U,e[46]=P):P=e[46],e[47]!==E||e[48]!==P?(_=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[E,P]}),e[47]=E,e[48]=P,e[49]=_):_=e[49],e[50]!==C?(T=C!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"lag-error",role:"alert",children:C}),e[50]=C,e[51]=T):T=e[51],M=C===null&&B.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"lag-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:a("function")}),(0,t.jsx)(L,{children:a("runs")}),(0,t.jsx)(L,{children:a("mean lag (ms)")}),(0,t.jsx)(L,{children:a("max lag (ms)")}),(0,t.jsx)(L,{children:a("last lag (ms)")})]})}),(0,t.jsx)(re,{children:B.map(mt)})]})})}),e[17]=m,e[18]=S,e[19]=C,e[20]=f,e[21]=d,e[22]=h,e[23]=a,e[24]=j,e[25]=x,e[26]=A,e[27]=g,e[28]=F,e[29]=_,e[30]=T,e[31]=M}else j=e[24],x=e[25],A=e[26],g=e[27],F=e[28],_=e[29],T=e[30],M=e[31];let R;e[52]!==h||e[53]!==a?(R=h!==void 0&&h.pools.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"pools-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:a("pool")}),(0,t.jsx)(L,{children:a("queued")}),(0,t.jsx)(L,{children:a("in flight")}),(0,t.jsx)(L,{children:a("max concurrency")})]})}),(0,t.jsx)(re,{children:h.pools.map(pt)})]})})}),e[52]=h,e[53]=a,e[54]=R):R=e[54];let W;return e[55]!==j||e[56]!==x||e[57]!==A||e[58]!==g||e[59]!==F||e[60]!==_||e[61]!==T||e[62]!==M||e[63]!==R?(W=(0,t.jsxs)("div",{className:j,"data-testid":x,children:[A,g,F,_,T,M,R]}),e[55]=j,e[56]=x,e[57]=A,e[58]=g,e[59]=F,e[60]=_,e[61]=T,e[62]=M,e[63]=R,e[64]=W):W=e[64],W},"Ze");function ct(r,e){return e.queued-r.queued}y(ct,"et");function ht(r){return r.name===it&&r.kind==="histogram"&&r.count>0}y(ht,"tt");function ut(r,e){return e.max-r.max}y(ut,"st");function mt(r){return(0,t.jsxs)(z,{"data-testid":`lag-row-${Ne(r)}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:Ne(r)}),(0,t.jsx)(K,{className:"tabular-nums",children:r.count}),(0,t.jsx)(K,{className:"tabular-nums",children:Math.round(r.sum/r.count)}),(0,t.jsx)(K,{className:"tabular-nums",children:r.max}),(0,t.jsx)(K,{className:"tabular-nums",children:r.last})]},Ne(r))}y(mt,"lt");function pt(r){return(0,t.jsxs)(z,{"data-testid":`pools-row-${r.name}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:r.name}),(0,t.jsx)(K,{className:"tabular-nums",children:r.queued}),(0,t.jsxs)(K,{className:"tabular-nums",children:[r.inFlight," / ",r.maxConcurrency]}),(0,t.jsx)(K,{className:"tabular-nums",children:r.maxConcurrency})]},r.name)}y(pt,"rt");var ft=["jobs","outbox","history","dead","pools","cron"],Vt=y(r=>{let e=(0,G.c)(55),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n,loadCronJobs:l,scheduledCancel:s,scheduledLoad:a}=o,i=V(),[c,N]=(0,Q.useState)("jobs"),p;e[2]!==i?(p=i("Cron triggers"),e[2]=i,e[3]=p):p=e[3];let h;e[4]!==i?(h=i("Dead letter"),e[4]=i,e[5]=h):h=e[5];let m;e[6]!==i?(m=i("History"),e[6]=i,e[7]=m):m=e[7];let k;e[8]!==i?(k=i("Scheduled jobs"),e[8]=i,e[9]=k):k=e[9];let f;e[10]!==i?(f=i("Outbox"),e[10]=i,e[11]=f):f=e[11];let d;e[12]!==i?(d=i("Pools"),e[12]=i,e[13]=d):d=e[13];let u;e[14]!==p||e[15]!==h||e[16]!==m||e[17]!==k||e[18]!==f||e[19]!==d?(u={cron:p,dead:h,history:m,jobs:k,outbox:f,pools:d},e[14]=p,e[15]=h,e[16]=m,e[17]=k,e[18]=f,e[19]=d,e[20]=u):u=e[20];let v=u,b;e[21]===Symbol.for("react.memo_cache_sentinel")?(b=y(T=>{N(T.currentTarget.dataset.view)},"b"),e[21]=b):b=e[21];let S=b,I;e[22]===Symbol.for("react.memo_cache_sentinel")?(I=(0,t.jsx)(Le,{}),e[22]=I):I=e[22];let w;e[23]!==i?(w=i("Schedule view"),e[23]=i,e[24]=w):w=e[24];let C;e[25]!==c||e[26]!==v?(C=ft.map(T=>(0,t.jsx)(ce,{"aria-selected":c===T,"data-testid":`schedule-view-${T}`,"data-view":T,onClick:S,role:"tab",size:"sm",type:"button",variant:c===T?"default":"outline",children:v[T]},T)),e[25]=c,e[26]=v,e[27]=C):C=e[27];let J;e[28]!==w||e[29]!==C?(J=(0,t.jsx)("div",{"aria-label":w,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:C}),e[28]=w,e[29]=C,e[30]=J):J=e[30];let $;e[31]!==s||e[32]!==a||e[33]!==c?($=c==="jobs"&&(0,t.jsx)(Te,{cancelJob:s,loadJobs:a}),e[31]=s,e[32]=a,e[33]=c,e[34]=$):$=e[34];let j;e[35]!==c?(j=c==="outbox"&&(0,t.jsx)(st,{}),e[35]=c,e[36]=j):j=e[36];let x;e[37]!==c?(x=c==="history"&&(0,t.jsx)(He,{}),e[37]=c,e[38]=x):x=e[38];let A;e[39]!==c?(A=c==="dead"&&(0,t.jsx)(Xe,{}),e[39]=c,e[40]=A):A=e[40];let g;e[41]!==n||e[42]!==c?(g=c==="pools"&&(0,t.jsx)(dt,{initialShardKey:n}),e[41]=n,e[42]=c,e[43]=g):g=e[43];let F;e[44]!==l||e[45]!==c?(F=c==="cron"&&(0,t.jsx)(Ge,{loadCronJobs:l}),e[44]=l,e[45]=c,e[46]=F):F=e[46];let _;return e[47]!==J||e[48]!==$||e[49]!==j||e[50]!==x||e[51]!==A||e[52]!==g||e[53]!==F?(_=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[I,J,$,j,x,A,g,F]}),e[47]=J,e[48]=$,e[49]=j,e[50]=x,e[51]=A,e[52]=g,e[53]=F,e[54]=_):_=e[54],_},"It");export{Vt as SchedulePanel};
@@ -0,0 +1 @@
1
+ import{x as h}from"./chunk-6DU2UW57.js";import{a as b}from"./chunk-GWNGVKLG.js";import{b as j}from"./chunk-6G3E4PJ2.js";import{a as u,d as g}from"./chunk-5PEAXTYQ.js";var v=g(b(),1);var t=g(j(),1);var z=u(N=>{let e=(0,v.c)(19),{action:a,className:x,description:c,icon:m,testId:f,title:p}=N,s;e[0]!==x?(s=h("flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-border px-6 py-14 text-center",x),e[0]=x,e[1]=s):s=e[1];let r;e[2]!==m?(r=m!==void 0&&(0,t.jsx)("span",{className:"flex size-10 items-center justify-center rounded-lg bg-muted text-muted-foreground [&_svg]:size-5",children:m}),e[2]=m,e[3]=r):r=e[3];let d;e[4]!==p?(d=(0,t.jsx)("p",{className:"text-sm font-medium text-foreground",children:p}),e[4]=p,e[5]=d):d=e[5];let l;e[6]!==c?(l=c!==void 0&&(0,t.jsx)("p",{className:"max-w-sm text-sm text-muted-foreground",children:c}),e[6]=c,e[7]=l):l=e[7];let o;e[8]!==d||e[9]!==l?(o=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[d,l]}),e[8]=d,e[9]=l,e[10]=o):o=e[10];let i;e[11]!==a?(i=a!==void 0&&(0,t.jsx)("div",{className:"mt-1 flex items-center gap-2",children:a}),e[11]=a,e[12]=i):i=e[12];let n;return e[13]!==s||e[14]!==r||e[15]!==o||e[16]!==i||e[17]!==f?(n=(0,t.jsxs)("div",{className:s,"data-testid":f,children:[r,o,i]}),e[13]=s,e[14]=r,e[15]=o,e[16]=i,e[17]=f,e[18]=n):n=e[18],n},"y");export{z as a};