@lunora/studio 1.0.0-alpha.35 → 1.0.0-alpha.351

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 (475) hide show
  1. package/LICENSE.md +6 -0
  2. package/README.md +4 -4
  3. package/dist/index.d.mts +1621 -0
  4. package/dist/index.d.ts +1013 -809
  5. package/dist/index.mjs +1 -0
  6. package/dist/mount.d.mts +23 -0
  7. package/dist/mount.d.ts +13 -11
  8. package/dist/mount.mjs +1 -0
  9. package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -0
  10. package/dist/packem_chunks/ApiTab.mjs +1 -0
  11. package/dist/packem_chunks/AuditPanel.mjs +1 -0
  12. package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -0
  13. package/dist/packem_chunks/ExportImportPanel.mjs +8 -0
  14. package/dist/packem_chunks/FileBrowser.mjs +4 -0
  15. package/dist/packem_chunks/FunctionRunner.mjs +1 -0
  16. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -0
  17. package/dist/packem_chunks/HealthPanel.mjs +1 -0
  18. package/dist/packem_chunks/InsightsPanel.mjs +1 -0
  19. package/dist/packem_chunks/LogsPanel.mjs +1 -0
  20. package/dist/packem_chunks/MailPanel.mjs +2 -0
  21. package/dist/packem_chunks/MetricsPanel.mjs +1 -0
  22. package/dist/packem_chunks/NotificationsPanel.mjs +1 -0
  23. package/dist/packem_chunks/PitrPanel.mjs +1 -0
  24. package/dist/packem_chunks/SchemaViewer.mjs +1 -0
  25. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -0
  26. package/dist/packem_chunks/SettingsPanel.mjs +1 -0
  27. package/dist/packem_chunks/SqlEditorPanel.mjs +10 -0
  28. package/dist/packem_chunks/TableEditor.mjs +1 -0
  29. package/dist/packem_chunks/agents-panel.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/auth-audit-panel.mjs +1 -0
  34. package/dist/packem_chunks/auth-config-panel.mjs +1 -0
  35. package/dist/packem_chunks/auth-sessions-panel.mjs +1 -0
  36. package/dist/packem_chunks/containers-panel.mjs +1 -0
  37. package/dist/packem_chunks/dashboards-panel.mjs +1 -0
  38. package/dist/packem_chunks/evals-panel.mjs +1 -0
  39. package/dist/packem_chunks/fanout-panel.mjs +1 -0
  40. package/dist/packem_chunks/flags-panel.mjs +1 -0
  41. package/dist/packem_chunks/issues-panel.mjs +1 -0
  42. package/dist/packem_chunks/kv-browser.mjs +1 -0
  43. package/dist/packem_chunks/log-drains-panel.mjs +4 -0
  44. package/dist/packem_chunks/migrations-route.mjs +1 -0
  45. package/dist/packem_chunks/organizations-panel.mjs +1 -0
  46. package/dist/packem_chunks/payments-panel.mjs +1 -0
  47. package/dist/packem_chunks/permissions-panel.mjs +1 -0
  48. package/dist/packem_chunks/privacy-requests-panel.mjs +1 -0
  49. package/dist/packem_chunks/queues-panel.mjs +1 -0
  50. package/dist/packem_chunks/reactors-panel.mjs +1 -0
  51. package/dist/packem_chunks/rls-panel.mjs +1 -0
  52. package/dist/packem_chunks/schedule-panel.mjs +1 -0
  53. package/dist/packem_chunks/storage-rules-panel.mjs +1 -0
  54. package/dist/packem_chunks/subscriptions-panel.mjs +1 -0
  55. package/dist/packem_chunks/sync-client-panel.mjs +1 -0
  56. package/dist/packem_chunks/theme-indicator.mjs +1 -0
  57. package/dist/packem_chunks/traces-panel.mjs +1 -0
  58. package/dist/packem_chunks/users-panel.mjs +1 -0
  59. package/dist/packem_chunks/vector-browser.mjs +1 -0
  60. package/dist/packem_chunks/workflows-panel.mjs +1 -0
  61. package/dist/packem_shared/ADMIN_FUNCTIONS-4aGsMs95.mjs +1 -0
  62. package/dist/packem_shared/ApiDocsPanel-E4Vr-8zW.mjs +2 -0
  63. package/dist/packem_shared/ApiReferencePanel-u9Rrljdf.mjs +1 -0
  64. package/dist/packem_shared/CommandPalette-5OsK8PNe.mjs +1 -0
  65. package/dist/packem_shared/ConfirmButton-CIXYF6Mg.mjs +1 -0
  66. package/dist/packem_shared/ConnectionBadge-BfcoN-VE.mjs +1 -0
  67. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-CG7Q45ZS.mjs +1 -0
  68. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs +1 -0
  69. package/dist/packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs +1 -0
  70. package/dist/packem_shared/DataBrowser-C5HbI4TH.mjs +4 -0
  71. package/dist/packem_shared/DataFilters--ocFTVT2.mjs +1 -0
  72. package/dist/packem_shared/ErrorBoundary-BWNF98VF.mjs +1 -0
  73. package/dist/packem_shared/GlobalDataBrowser-D0H2yJSl.mjs +1 -0
  74. package/dist/packem_shared/HomePanel-CcYkDlR-.mjs +1 -0
  75. package/dist/packem_shared/MigrationsPanel-YyCO_T-3.mjs +1 -0
  76. package/dist/packem_shared/OpenRpcReferencePanel-E9cDfHRv.mjs +1 -0
  77. package/dist/packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.mjs +1 -0
  78. package/dist/packem_shared/ScheduledJobs-D4CUj7aX.mjs +1 -0
  79. package/dist/packem_shared/ShardInput-CoySruKZ.mjs +1 -0
  80. package/dist/packem_shared/Studio-4vJzwwNa.mjs +1 -0
  81. package/dist/packem_shared/StudioApp-px2FMPDS.mjs +1 -0
  82. package/dist/packem_shared/StudioI18nProvider-CGXCPnQn.mjs +1 -0
  83. package/dist/packem_shared/advisor-view-fNcNYW2Q.mjs +1 -0
  84. package/dist/packem_shared/aggregateMetrics-DKFJc-o5.mjs +1 -0
  85. package/dist/packem_shared/alert-PB5W11MM.mjs +1 -0
  86. package/dist/packem_shared/app.d-D425h1XO.d.mts +352 -0
  87. package/dist/packem_shared/app.d-D425h1XO.d.ts +352 -0
  88. package/dist/packem_shared/auth-pager-DW77WeZw.mjs +1 -0
  89. package/dist/packem_shared/badge-r_5B4LHP.mjs +1 -0
  90. package/dist/packem_shared/bar-chart-BCsEIQoQ.mjs +6 -0
  91. package/dist/packem_shared/browser-storage-BH1MxLZs.mjs +1 -0
  92. package/dist/packem_shared/button-q0UYSmrn.mjs +1 -0
  93. package/dist/packem_shared/card-By2O8ULa.mjs +1 -0
  94. package/dist/packem_shared/cf-links-CBJ5SywP.mjs +1 -0
  95. package/dist/packem_shared/checkbox-CnS9cyCz.mjs +1 -0
  96. package/dist/packem_shared/control-button-BOZ5K-FC.mjs +1 -0
  97. package/dist/packem_shared/data-grid-r3isM8Nq.mjs +1 -0
  98. package/dist/packem_shared/data-view-params-C-_G-biH.mjs +1 -0
  99. package/dist/packem_shared/diagram-export-panel-aBDQdX4e.mjs +2 -0
  100. package/dist/packem_shared/dropdown-menu-jLZenfWH.mjs +2 -0
  101. package/dist/packem_shared/empty-state-D7jEML_T.mjs +1 -0
  102. package/dist/packem_shared/error-alert-54TiaMvZ.mjs +1 -0
  103. package/dist/packem_shared/grid-features-2c5SaBtH.mjs +6 -0
  104. package/dist/packem_shared/grid-pagination-DY2erU65.mjs +1 -0
  105. package/dist/packem_shared/home-panel-DPiMVQZ2.mjs +3 -0
  106. package/dist/packem_shared/input-CXhxesPC.mjs +1 -0
  107. package/dist/packem_shared/internal-BXEjuLPN.mjs +2 -0
  108. package/dist/packem_shared/label-DKFzyHq6.mjs +1 -0
  109. package/dist/packem_shared/live-status-D1GasNsH.mjs +1 -0
  110. package/dist/packem_shared/log-fields-BolUoZ9g.mjs +1 -0
  111. package/dist/packem_shared/log-line-BWDt_F56.mjs +1 -0
  112. package/dist/packem_shared/metrics-format-1sNGG47R.mjs +1 -0
  113. package/dist/packem_shared/modal-shell-CDztwLnv.mjs +1 -0
  114. package/dist/packem_shared/operation-console-provider-DoloEvon.mjs +1 -0
  115. package/dist/packem_shared/recording-client-MbGZ28I0.mjs +1 -0
  116. package/dist/packem_shared/reference-view-DCEC5kjY.mjs +13 -0
  117. package/dist/packem_shared/schema-diagram-k7cFl7Wp.mjs +2 -0
  118. package/dist/packem_shared/scroll-area-CXCQH7VT.mjs +2 -0
  119. package/dist/packem_shared/select-DPyS18Vy.mjs +2 -0
  120. package/dist/packem_shared/shard-history-CaO3C4KQ.mjs +1 -0
  121. package/dist/packem_shared/shortcuts-B9gDaXmw.mjs +1 -0
  122. package/dist/packem_shared/skeleton-DX1gfixl.mjs +1 -0
  123. package/dist/packem_shared/sparkline-B_sPPO_8.mjs +1 -0
  124. package/dist/packem_shared/sql-result-table-CatgdmMh.mjs +1 -0
  125. package/dist/packem_shared/stat-card-BAv73QtB.mjs +1 -0
  126. package/dist/packem_shared/storage-tier-C2mKwYRj.mjs +1 -0
  127. package/dist/packem_shared/studio-DIUgH7k0.mjs +2 -0
  128. package/dist/packem_shared/table-D0SBiDu-.mjs +2 -0
  129. package/dist/packem_shared/table-list-sidebar-CCRB_iYz.mjs +1 -0
  130. package/dist/packem_shared/textarea--40GKAyz.mjs +1 -0
  131. package/dist/packem_shared/trace-handoff-BV3EWqy_.mjs +1 -0
  132. package/dist/packem_shared/use-admin-query-BW9IuacC.mjs +1 -0
  133. package/dist/packem_shared/use-admin-spec-BdNLZbTO.mjs +1 -0
  134. package/dist/packem_shared/use-async-submit-2eBBD0-m.mjs +1 -0
  135. package/dist/packem_shared/use-auth-config-KO9tnI39.mjs +1 -0
  136. package/dist/packem_shared/use-mirrored-ref-CVDf2z1M.mjs +1 -0
  137. package/dist/packem_shared/use-open-trace-B_0LbTD7.mjs +1 -0
  138. package/dist/packem_shared/use-shard-key-BsP3o5wT.mjs +1 -0
  139. package/dist/packem_shared/use-sql-assistant-BMVlguKF.mjs +1 -0
  140. package/dist/packem_shared/use-studio-client-DCA50tF2.mjs +1 -0
  141. package/dist/packem_shared/useDebounced-DVeQ5-oW.mjs +1 -0
  142. package/dist/packem_shared/utils-bhneXptQ.mjs +1 -0
  143. package/dist/packem_shared/virtual-rect-D_j7aLxX.mjs +1 -0
  144. package/dist/standalone/chunk-22O2JDWR.js +1 -0
  145. package/dist/standalone/chunk-2DV455PX.js +1 -0
  146. package/dist/standalone/chunk-2EMNPL3B.js +1 -0
  147. package/dist/standalone/chunk-2O6KKVH2.js +1 -0
  148. package/dist/standalone/chunk-35BGGOWV.js +1 -0
  149. package/dist/standalone/chunk-3GXPALXG.js +1 -0
  150. package/dist/standalone/chunk-3MQ477EE.js +1 -0
  151. package/dist/standalone/chunk-3Y5K3IQO.js +1 -0
  152. package/dist/standalone/chunk-453GHHZ4.js +1 -0
  153. package/dist/standalone/chunk-4C4THJUD.js +1 -0
  154. package/dist/standalone/chunk-4CITH2NU.js +1 -0
  155. package/dist/standalone/chunk-4EDOPHLM.js +5 -0
  156. package/dist/standalone/chunk-4IEMXFUB.js +1 -0
  157. package/dist/standalone/chunk-4QRVJDM4.js +1 -0
  158. package/dist/standalone/chunk-4SQBAPY6.js +1 -0
  159. package/dist/standalone/chunk-4UWYDYM5.js +1 -0
  160. package/dist/standalone/chunk-57ZNR6IA.js +1 -0
  161. package/dist/standalone/chunk-5DNGK3NT.js +1 -0
  162. package/dist/standalone/chunk-6DYXTEU7.js +1 -0
  163. package/dist/standalone/chunk-6GPEHYCG.js +1 -0
  164. package/dist/standalone/chunk-6GRI2HXU.js +1 -0
  165. package/dist/standalone/chunk-6I42AM75.js +1 -0
  166. package/dist/standalone/chunk-6M7FLLMT.js +1 -0
  167. package/dist/standalone/chunk-6QBK3Z7A.js +1 -0
  168. package/dist/standalone/chunk-6QEXGYWH.js +1 -0
  169. package/dist/standalone/chunk-6UTZXEW3.js +1 -0
  170. package/dist/standalone/chunk-7EAHHRJR.js +1 -0
  171. package/dist/standalone/chunk-7RGYCU6F.js +1 -0
  172. package/dist/standalone/chunk-A566HCBX.js +1 -0
  173. package/dist/standalone/chunk-ACNWZIAH.js +15 -0
  174. package/dist/standalone/chunk-ANACHJRU.js +1 -0
  175. package/dist/standalone/chunk-AOHKAKKL.js +1 -0
  176. package/dist/standalone/chunk-AP4PC2M4.js +1 -0
  177. package/dist/standalone/chunk-BAGJYLSU.js +8 -0
  178. package/dist/standalone/chunk-BCOOULSO.js +1 -0
  179. package/dist/standalone/chunk-BKH2NALB.js +1 -0
  180. package/dist/standalone/chunk-BTOOJXUL.js +59 -0
  181. package/dist/standalone/chunk-C6FNBKCO.js +1 -0
  182. package/dist/standalone/chunk-CTE6RPXC.js +1 -0
  183. package/dist/standalone/chunk-CW57Q264.js +1 -0
  184. package/dist/standalone/chunk-DBVJ5VLI.js +1 -0
  185. package/dist/standalone/chunk-DS7HZKZ2.js +6 -0
  186. package/dist/standalone/chunk-DSTNWB4N.js +1 -0
  187. package/dist/standalone/chunk-DTW4E5AB.js +1 -0
  188. package/dist/standalone/chunk-DX55P3KZ.js +1 -0
  189. package/dist/standalone/chunk-E26OT26O.js +1 -0
  190. package/dist/standalone/chunk-FLVDICZL.js +1 -0
  191. package/dist/standalone/chunk-FNWRS4VQ.js +1 -0
  192. package/dist/standalone/chunk-FST24UXA.js +1 -0
  193. package/dist/standalone/chunk-FXGYX2V6.js +1 -0
  194. package/dist/standalone/chunk-HKLF627N.js +1 -0
  195. package/dist/standalone/chunk-HKPDPKXD.js +1 -0
  196. package/dist/standalone/chunk-HWTX54JM.js +8 -0
  197. package/dist/standalone/chunk-HZCLLEWP.js +1 -0
  198. package/dist/standalone/chunk-IBJVVHV5.js +1 -0
  199. package/dist/standalone/chunk-IH2CJZF2.js +1 -0
  200. package/dist/standalone/chunk-IRCUXARN.js +1 -0
  201. package/dist/standalone/chunk-IVQKQBKK.js +1 -0
  202. package/dist/standalone/chunk-JTGGWF7R.js +1 -0
  203. package/dist/standalone/chunk-K7FZTYAY.js +1 -0
  204. package/dist/standalone/chunk-KNX3KB7E.js +1 -0
  205. package/dist/standalone/chunk-KRPXOSBL.js +1 -0
  206. package/dist/standalone/chunk-KYONGQQ4.js +1 -0
  207. package/dist/standalone/chunk-LIGOLZND.js +1 -0
  208. package/dist/standalone/chunk-LKCO3E2B.js +1 -0
  209. package/dist/standalone/chunk-LPINY2IJ.js +19 -0
  210. package/dist/standalone/chunk-LRXCL6IA.js +1 -0
  211. package/dist/standalone/chunk-LUHXNZI4.js +2 -0
  212. package/dist/standalone/chunk-LYHEBMM6.js +1 -0
  213. package/dist/standalone/chunk-M2RIGPGL.js +1 -0
  214. package/dist/standalone/chunk-MD67S53Z.js +1 -0
  215. package/dist/standalone/chunk-MDAXV2XH.js +4 -0
  216. package/dist/standalone/chunk-MKVZXGJQ.js +1 -0
  217. package/dist/standalone/chunk-NGVP66OH.js +1 -0
  218. package/dist/standalone/chunk-NMVFSJM7.js +1 -0
  219. package/dist/standalone/chunk-OIDFWEJX.js +21 -0
  220. package/dist/standalone/chunk-OJG65AG4.js +1 -0
  221. package/dist/standalone/chunk-OSJ7HV7B.js +1 -0
  222. package/dist/standalone/chunk-OUFWXYEF.js +1 -0
  223. package/dist/standalone/chunk-OXFKZ4BM.js +1 -0
  224. package/dist/standalone/chunk-P6L6ABWO.js +1 -0
  225. package/dist/standalone/chunk-PZZWUL5U.js +1 -0
  226. package/dist/standalone/chunk-Q4N3TJPV.js +1 -0
  227. package/dist/standalone/chunk-QEVFVWGC.js +2 -0
  228. package/dist/standalone/chunk-R36QXQZX.js +1 -0
  229. package/dist/standalone/chunk-RHOQJNDW.js +1 -0
  230. package/dist/standalone/chunk-RQDSPVVH.js +1 -0
  231. package/dist/standalone/chunk-S5S2YICJ.js +1 -0
  232. package/dist/standalone/chunk-S6JFSLBK.js +1 -0
  233. package/dist/standalone/chunk-SDQH4HR6.js +3 -0
  234. package/dist/standalone/chunk-SDTHCM5H.js +1 -0
  235. package/dist/standalone/chunk-SFY646MC.js +1 -0
  236. package/dist/standalone/chunk-SJLEEYCR.js +1 -0
  237. package/dist/standalone/chunk-SLIDAWNX.js +1 -0
  238. package/dist/standalone/chunk-SM2IQWCJ.js +1 -0
  239. package/dist/standalone/{chunk-BJGBHGK3.js → chunk-SYGCASPT.js} +1 -1
  240. package/dist/standalone/chunk-T2QAOXUO.js +14 -0
  241. package/dist/standalone/chunk-T4VAXHRL.js +4 -0
  242. package/dist/standalone/chunk-TBDJVYCB.js +1 -0
  243. package/dist/standalone/chunk-TDVDZ7XQ.js +1 -0
  244. package/dist/standalone/chunk-TRZTGE4R.js +1 -0
  245. package/dist/standalone/chunk-TTD7BKB6.js +1 -0
  246. package/dist/standalone/chunk-UCK6ITED.js +1 -0
  247. package/dist/standalone/chunk-UKKZJRJT.js +1 -0
  248. package/dist/standalone/chunk-UYEZR3BI.js +1 -0
  249. package/dist/standalone/chunk-V74BXQXC.js +1 -0
  250. package/dist/standalone/chunk-VEWQWS3J.js +1 -0
  251. package/dist/standalone/chunk-VHMA6YPT.js +1 -0
  252. package/dist/standalone/chunk-W2BCSK5S.js +1 -0
  253. package/dist/standalone/chunk-W4X4J7BU.js +1 -0
  254. package/dist/standalone/chunk-W6ZKEW5M.js +1 -0
  255. package/dist/standalone/chunk-W7MRISE3.js +1 -0
  256. package/dist/standalone/chunk-WIYDA4XT.js +1 -0
  257. package/dist/standalone/chunk-WS36BO4R.js +1 -0
  258. package/dist/standalone/chunk-WZTY3ZYI.js +1 -0
  259. package/dist/standalone/chunk-X5KWBDTF.js +1 -0
  260. package/dist/standalone/chunk-X74GEPSG.js +1 -0
  261. package/dist/standalone/chunk-X7GSROPX.js +1 -0
  262. package/dist/standalone/chunk-XBZUJDHD.js +1 -0
  263. package/dist/standalone/chunk-XYR5NST4.js +1 -0
  264. package/dist/standalone/chunk-Y7SN6CTX.js +1 -0
  265. package/dist/standalone/chunk-YHTHRYP5.js +1 -0
  266. package/dist/standalone/chunk-YJWR6ZWC.js +1 -0
  267. package/dist/standalone/chunk-YRQHFMEY.js +1 -0
  268. package/dist/standalone/chunk-Z5EV64KS.js +1 -0
  269. package/dist/standalone/chunk-ZBON5T5A.js +1 -0
  270. package/dist/standalone/chunk-ZGSL4DPP.js +1 -0
  271. package/dist/standalone/chunk-ZKPRORLI.js +1 -0
  272. package/dist/standalone/chunk-ZLSNET6H.js +1 -0
  273. package/dist/standalone/chunk-ZM4K2ETZ.js +3 -0
  274. package/dist/standalone/chunk-ZTOREMGH.js +1 -0
  275. package/dist/standalone/chunk-ZWDORIZY.js +1 -0
  276. package/dist/standalone/studio.js +9 -214
  277. package/dist/styles.css +2 -2
  278. package/package.json +26 -22
  279. package/dist/index.js +0 -41
  280. package/dist/mount.js +0 -27
  281. package/dist/packem_chunks/ApiTab.js +0 -251
  282. package/dist/packem_chunks/AuditPanel.js +0 -200
  283. package/dist/packem_chunks/ExportImportPanel.js +0 -198
  284. package/dist/packem_chunks/FileBrowser.js +0 -2932
  285. package/dist/packem_chunks/FunctionRunner.js +0 -343
  286. package/dist/packem_chunks/FunctionStatsPanel.js +0 -377
  287. package/dist/packem_chunks/HealthPanel.js +0 -648
  288. package/dist/packem_chunks/InsightsPanel.js +0 -462
  289. package/dist/packem_chunks/LogsPanel.js +0 -827
  290. package/dist/packem_chunks/MailPanel.js +0 -353
  291. package/dist/packem_chunks/MetricsPanel.js +0 -1344
  292. package/dist/packem_chunks/MigrationsPanel.js +0 -239
  293. package/dist/packem_chunks/PitrPanel.js +0 -252
  294. package/dist/packem_chunks/SchemaViewer.js +0 -2513
  295. package/dist/packem_chunks/SecurityAdvisorPanel.js +0 -95
  296. package/dist/packem_chunks/SettingsPanel.js +0 -391
  297. package/dist/packem_chunks/SqlEditorPanel.js +0 -2323
  298. package/dist/packem_chunks/TableEditor.js +0 -313
  299. package/dist/packem_chunks/analytics-panel.js +0 -261
  300. package/dist/packem_chunks/auth-config-panel.js +0 -179
  301. package/dist/packem_chunks/auth-sessions-panel.js +0 -175
  302. package/dist/packem_chunks/containers-panel.js +0 -247
  303. package/dist/packem_chunks/dashboards-panel.js +0 -780
  304. package/dist/packem_chunks/fanout-panel.js +0 -482
  305. package/dist/packem_chunks/flags-panel.js +0 -176
  306. package/dist/packem_chunks/kv-browser.js +0 -1896
  307. package/dist/packem_chunks/log-drains-panel.js +0 -273
  308. package/dist/packem_chunks/organizations-panel.js +0 -670
  309. package/dist/packem_chunks/payments-panel.js +0 -186
  310. package/dist/packem_chunks/permissions-panel.js +0 -805
  311. package/dist/packem_chunks/queues-panel.js +0 -1052
  312. package/dist/packem_chunks/rls-panel.js +0 -315
  313. package/dist/packem_chunks/schedule-panel.js +0 -831
  314. package/dist/packem_chunks/sparkline.js +0 -79
  315. package/dist/packem_chunks/storage-rules-panel.js +0 -140
  316. package/dist/packem_chunks/subscriptions-panel.js +0 -238
  317. package/dist/packem_chunks/users-panel.js +0 -1265
  318. package/dist/packem_chunks/vector-browser.js +0 -281
  319. package/dist/packem_chunks/workflows-panel.js +0 -562
  320. package/dist/packem_shared/ADMIN_FUNCTIONS-BHHJi3Gb.js +0 -52
  321. package/dist/packem_shared/ApiDocsPanel-D4CJf2ad.js +0 -842
  322. package/dist/packem_shared/ApiReferencePanel-Co_wpRF2.js +0 -230
  323. package/dist/packem_shared/CommandPalette-BUPpbpMc.js +0 -373
  324. package/dist/packem_shared/ConfirmButton-C2eVi2Qv.js +0 -59
  325. package/dist/packem_shared/ConnectionBadge-B2DDM2Tn.js +0 -111
  326. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +0 -50
  327. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +0 -89
  328. package/dist/packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js +0 -27
  329. package/dist/packem_shared/DataBrowser-BeVNxSVm.js +0 -4493
  330. package/dist/packem_shared/DataFilters-FNquMaiu.js +0 -249
  331. package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +0 -66
  332. package/dist/packem_shared/GlobalDataBrowser-ErfvIs1S.js +0 -289
  333. package/dist/packem_shared/HomePanel-D9MQk8I7.js +0 -14
  334. package/dist/packem_shared/OpenRpcReferencePanel-DLWzrIx9.js +0 -192
  335. package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +0 -3
  336. package/dist/packem_shared/ScheduledJobs-ClaNpZsg.js +0 -262
  337. package/dist/packem_shared/ShardInput-gx_DZXXn.js +0 -107
  338. package/dist/packem_shared/Studio-C48P1K5W.js +0 -16
  339. package/dist/packem_shared/StudioApp-Cqh-SYm2.js +0 -657
  340. package/dist/packem_shared/StudioI18nProvider-B-tDCZIi.js +0 -48
  341. package/dist/packem_shared/advisor-view-D3-U4kRR.js +0 -159
  342. package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +0 -108
  343. package/dist/packem_shared/alert-CdAET2K_.js +0 -68
  344. package/dist/packem_shared/app.d-CNLRTrWw.d.ts +0 -300
  345. package/dist/packem_shared/badge-B2PKA1-5.js +0 -49
  346. package/dist/packem_shared/bar-chart-DSwcWIRy.js +0 -3246
  347. package/dist/packem_shared/browser-storage-tLOxkIHd.js +0 -185
  348. package/dist/packem_shared/button-BhsN2uZH.js +0 -49
  349. package/dist/packem_shared/card-DURq3ElK.js +0 -175
  350. package/dist/packem_shared/cf-links-BZfRdxSE.js +0 -8
  351. package/dist/packem_shared/checkbox-UNkzAxl-.js +0 -63
  352. package/dist/packem_shared/data-grid-Jz8FqQ2C.js +0 -183
  353. package/dist/packem_shared/data-view-params-Cd6yRVbv.js +0 -96
  354. package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +0 -280
  355. package/dist/packem_shared/empty-state-DY_oe0k6.js +0 -98
  356. package/dist/packem_shared/error-alert-BBT6D22d.js +0 -114
  357. package/dist/packem_shared/grid-features-CUr8Z1_O.js +0 -745
  358. package/dist/packem_shared/home-panel-CoGxi-oj.js +0 -1639
  359. package/dist/packem_shared/input-XH4r1Pt1.js +0 -53
  360. package/dist/packem_shared/internal-DTsYVn-g.js +0 -97
  361. package/dist/packem_shared/label-D8ykjn5J.js +0 -46
  362. package/dist/packem_shared/live-status-FZ0psC1z.js +0 -44
  363. package/dist/packem_shared/modal-shell-hyaJvIJ6.js +0 -100
  364. package/dist/packem_shared/reference-view-CSKyUyPl.js +0 -2141
  365. package/dist/packem_shared/scroll-area-DLhcy-ml.js +0 -93
  366. package/dist/packem_shared/select-UkNYCT3s.js +0 -273
  367. package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
  368. package/dist/packem_shared/skeleton-CGhL0p20.js +0 -45
  369. package/dist/packem_shared/sparkline-BnA1kC9X.js +0 -93
  370. package/dist/packem_shared/storage-tier-CL98eOvn.js +0 -85
  371. package/dist/packem_shared/studio-CPHA_-3I.js +0 -4015
  372. package/dist/packem_shared/table-DsCa9Qp9.js +0 -246
  373. package/dist/packem_shared/table-list-sidebar-B5psdSV1.js +0 -832
  374. package/dist/packem_shared/textarea-D3gaCU_-.js +0 -46
  375. package/dist/packem_shared/use-admin-query-BHPKmPuj.js +0 -106
  376. package/dist/packem_shared/use-auth-capabilities-C-VH0oJJ.js +0 -32
  377. package/dist/packem_shared/useDebounced-Dxncpg6z.js +0 -32
  378. package/dist/packem_shared/utils-B05Dmz_H.js +0 -8
  379. package/dist/packem_shared/virtual-rect-CVMUskSm.js +0 -10
  380. package/dist/standalone/chunk-25VHPD2I.js +0 -1
  381. package/dist/standalone/chunk-2GGMGPEP.js +0 -1
  382. package/dist/standalone/chunk-2K47A3P6.js +0 -1
  383. package/dist/standalone/chunk-2NGUNNGW.js +0 -1
  384. package/dist/standalone/chunk-3CJW6NWG.js +0 -4
  385. package/dist/standalone/chunk-3OA7PECS.js +0 -6
  386. package/dist/standalone/chunk-46K3NKPA.js +0 -1
  387. package/dist/standalone/chunk-474C2O7W.js +0 -1
  388. package/dist/standalone/chunk-4H2OJBXO.js +0 -1
  389. package/dist/standalone/chunk-4QHKBC77.js +0 -1
  390. package/dist/standalone/chunk-55YA7ZZI.js +0 -76
  391. package/dist/standalone/chunk-5OH3VPZF.js +0 -1
  392. package/dist/standalone/chunk-5OIBXYZM.js +0 -1
  393. package/dist/standalone/chunk-6GFEVKJP.js +0 -1
  394. package/dist/standalone/chunk-6UGM5IHN.js +0 -4
  395. package/dist/standalone/chunk-6WRZP62V.js +0 -1
  396. package/dist/standalone/chunk-764T6X6X.js +0 -1
  397. package/dist/standalone/chunk-7TJJXVSE.js +0 -1
  398. package/dist/standalone/chunk-7VF3IAAW.js +0 -2
  399. package/dist/standalone/chunk-7WNJ4Q7Z.js +0 -8
  400. package/dist/standalone/chunk-AHILM3ZP.js +0 -1
  401. package/dist/standalone/chunk-AJIUI7DD.js +0 -1
  402. package/dist/standalone/chunk-BACPICH6.js +0 -1
  403. package/dist/standalone/chunk-BI35RXKQ.js +0 -1
  404. package/dist/standalone/chunk-BOXSWNXZ.js +0 -1
  405. package/dist/standalone/chunk-BQUQS7QN.js +0 -1
  406. package/dist/standalone/chunk-CKSHCYGC.js +0 -2
  407. package/dist/standalone/chunk-DORBUITF.js +0 -1
  408. package/dist/standalone/chunk-DVC6YWVP.js +0 -1
  409. package/dist/standalone/chunk-DVKPRFIJ.js +0 -1
  410. package/dist/standalone/chunk-DWDILV2E.js +0 -1
  411. package/dist/standalone/chunk-DWTBY343.js +0 -1
  412. package/dist/standalone/chunk-EIQW6ACH.js +0 -1
  413. package/dist/standalone/chunk-EUIHTPKI.js +0 -1
  414. package/dist/standalone/chunk-FCSPAJW4.js +0 -1
  415. package/dist/standalone/chunk-FKO3HO6I.js +0 -4
  416. package/dist/standalone/chunk-GMSGZDDH.js +0 -13
  417. package/dist/standalone/chunk-GTM65MVX.js +0 -1
  418. package/dist/standalone/chunk-HV7G6DFP.js +0 -5
  419. package/dist/standalone/chunk-ILCTSAOB.js +0 -1
  420. package/dist/standalone/chunk-IODYGARQ.js +0 -1
  421. package/dist/standalone/chunk-J6J54MBP.js +0 -1
  422. package/dist/standalone/chunk-JE2YOAB7.js +0 -4
  423. package/dist/standalone/chunk-JFSZIUZT.js +0 -4
  424. package/dist/standalone/chunk-JSEXCW5Q.js +0 -1
  425. package/dist/standalone/chunk-K3GNLVYK.js +0 -1
  426. package/dist/standalone/chunk-KEGAWN6Y.js +0 -1
  427. package/dist/standalone/chunk-KZ6INM5M.js +0 -1
  428. package/dist/standalone/chunk-LD2R263D.js +0 -1
  429. package/dist/standalone/chunk-LI43EKM6.js +0 -1
  430. package/dist/standalone/chunk-M55U7NHO.js +0 -1
  431. package/dist/standalone/chunk-MPTM7ZU3.js +0 -3
  432. package/dist/standalone/chunk-MPYFGAOW.js +0 -1
  433. package/dist/standalone/chunk-NJFMWO6P.js +0 -1
  434. package/dist/standalone/chunk-O3NAGRTR.js +0 -1
  435. package/dist/standalone/chunk-O77VNUFD.js +0 -1
  436. package/dist/standalone/chunk-OCHNCAXJ.js +0 -1
  437. package/dist/standalone/chunk-PACH5AHG.js +0 -1
  438. package/dist/standalone/chunk-PN5NCZDX.js +0 -1
  439. package/dist/standalone/chunk-PVZI3CXP.js +0 -19
  440. package/dist/standalone/chunk-PZ7HD5T2.js +0 -1
  441. package/dist/standalone/chunk-QAFAJBAW.js +0 -1
  442. package/dist/standalone/chunk-QBAT52GB.js +0 -1
  443. package/dist/standalone/chunk-QLM6FYZW.js +0 -2
  444. package/dist/standalone/chunk-RRAFQ5G2.js +0 -1
  445. package/dist/standalone/chunk-RRCPZMC2.js +0 -22
  446. package/dist/standalone/chunk-RSEEHNFI.js +0 -1
  447. package/dist/standalone/chunk-SEU5V7I6.js +0 -1
  448. package/dist/standalone/chunk-SLKF2L74.js +0 -1
  449. package/dist/standalone/chunk-SVR644RF.js +0 -1
  450. package/dist/standalone/chunk-TAD43CG5.js +0 -1
  451. package/dist/standalone/chunk-TBMYIZIO.js +0 -1
  452. package/dist/standalone/chunk-TDL7NEWA.js +0 -1
  453. package/dist/standalone/chunk-TO4JQX7W.js +0 -1
  454. package/dist/standalone/chunk-TQ36RWOP.js +0 -1
  455. package/dist/standalone/chunk-U4OAQPBT.js +0 -1
  456. package/dist/standalone/chunk-UII66UVF.js +0 -1
  457. package/dist/standalone/chunk-UK64ZSUW.js +0 -1
  458. package/dist/standalone/chunk-VLXV72QE.js +0 -1
  459. package/dist/standalone/chunk-VSHUSN6T.js +0 -1
  460. package/dist/standalone/chunk-VTGBPW24.js +0 -1
  461. package/dist/standalone/chunk-WXPWVBIY.js +0 -1
  462. package/dist/standalone/chunk-X6F22DBL.js +0 -1
  463. package/dist/standalone/chunk-X7MMBSNW.js +0 -1
  464. package/dist/standalone/chunk-XGMIDFUK.js +0 -1
  465. package/dist/standalone/chunk-XNJNSCLM.js +0 -1
  466. package/dist/standalone/chunk-XUGSA2NG.js +0 -1
  467. package/dist/standalone/chunk-XZE2RNDA.js +0 -1
  468. package/dist/standalone/chunk-Y2ZPNDL7.js +0 -4
  469. package/dist/standalone/chunk-YAECF5LW.js +0 -1
  470. package/dist/standalone/chunk-YEVCU7TB.js +0 -13
  471. package/dist/standalone/chunk-YV43BOP7.js +0 -1
  472. package/dist/standalone/chunk-ZHVTQ37P.js +0 -1
  473. package/dist/standalone/chunk-ZPP2KOR4.js +0 -1
  474. package/dist/standalone/chunk-ZPUO7FNI.js +0 -1
  475. package/dist/standalone/chunk-ZU4DZ6NK.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as Z}from"./chunk-IBJVVHV5.js";import{a as c,d as P,e as Q}from"./chunk-OXFKZ4BM.js";function B(r){return typeof r=="object"?r.key:r}c(B,"getMeasurementKey");function H(r,a){let t=r.length;return new Proxy(r,{get(s,e,n){if(typeof e=="string"){let o=e.charCodeAt(0);if(o>=48&&o<=57){let i=+e;if(Number.isInteger(i)&&i>=0&&i<t){let l=s[i];if(typeof l!="object"){let u=a[i*2];l=s[i]={index:i,key:l,start:u,size:a[i*2+1],end:u+a[i*2+1],lane:0}}return l}}if(e==="length")return t}return Reflect.get(s,e,n)}})}c(H,"createLazyMeasurementsView");function z(r,a,t){let s=t.initialDeps??[],e,n=!0;function o(){var i;let u=0,g=r();if(!(g.length!==s.length||g.some((d,S)=>s[S]!==d)))return e;s=g;let f=0;return e=a(...g),t?.onChange&&!(n&&t.skipInitialOnChange)&&t.onChange(e),n=!1,e}return c(o,"memoizedFunction"),o.updateDeps=i=>{s=i},o}c(z,"memo");function W(r,a){if(r===void 0)throw new Error(`Unexpected undefined${a?`: ${a}`:""}`);return r}c(W,"notUndefined");var k=c((r,a)=>Math.abs(r-a)<1.01,"approxEqual"),$=c((r,a,t)=>{let s;return Object.assign(function(...e){r.clearTimeout(s),s=r.setTimeout(()=>a.apply(this,e),t)},{cancel:c(()=>{r.clearTimeout(s)},"cancel")})},"debounce");var j,V=c(()=>{if(j!==void 0)return j;if(typeof navigator>"u")return j=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return j=!0;let r=navigator.maxTouchPoints;return j=navigator.platform==="MacIntel"&&r!==void 0&&r>0},"isIOSWebKit");var J=c(r=>{let{offsetWidth:a,offsetHeight:t}=r;return{width:a,height:t}},"getRect"),tt=c(r=>r,"defaultKeyExtractor"),et=c(r=>{let a=Math.max(r.startIndex-r.overscan,0),s=Math.min(r.endIndex+r.overscan,r.count-1)-a+1,e=new Array(s);for(let n=0;n<s;n++)e[n]=a+n;return e},"defaultRangeExtractor"),q=c((r,a)=>{let t=r.scrollElement;if(!t)return;let s=r.targetWindow;if(!s)return;let e=c(o=>{let{width:i,height:l}=o;a({width:Math.round(i),height:Math.round(l)})},"handler");if(e(J(t)),!s.ResizeObserver)return()=>{};let n=new s.ResizeObserver(o=>{let i=c(()=>{let l=o[0];if(l?.borderBoxSize){let u=l.borderBoxSize[0];if(u){e({width:u.inlineSize,height:u.blockSize});return}}e(J(t))},"run");r.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()});return n.observe(t,{box:"border-box"}),()=>{n.unobserve(t)}},"observeElementRect"),F={passive:!0};var st=typeof window>"u"?!0:"onscrollend"in window,nt=c((r,a,t)=>{let s=r.scrollElement;if(!s)return;let e=r.targetWindow;if(!e)return;let n=r.options.useScrollendEvent&&st,o=0,i=n?null:$(e,()=>a(t(s),!1),r.options.isScrollingResetDelay),l=c(h=>()=>{o=t(s),i?.(),a(o,h)},"createHandler"),u=l(!0),g=l(!1);return s.addEventListener("scroll",u,F),n&&s.addEventListener("scrollend",g,F),()=>{s.removeEventListener("scroll",u),n&&s.removeEventListener("scrollend",g),i?.cancel()}},"observeOffset"),U=c((r,a)=>nt(r,a,t=>{let{horizontal:s,isRtl:e}=r.options;return s?t.scrollLeft*(e&&-1||1):t.scrollTop}),"observeElementOffset");var it=c((r,a,t)=>{if(t.options.useCachedMeasurements){let s=t.indexFromElement(r),e=t.options.getItemKey(s);return t.itemSizeCache.get(e)??t.options.estimateSize(s)}if(a?.borderBoxSize){let s=a.borderBoxSize[0];if(s)return Math.round(s[t.options.horizontal?"inlineSize":"blockSize"])}if(!a){let s=t.indexFromElement(r),e=t.options.getItemKey(s),n=t.itemSizeCache.get(e);if(n!==void 0)return n}return r[t.options.horizontal?"offsetWidth":"offsetHeight"]},"measureElement"),ot=c((r,{adjustments:a=0,behavior:t},s)=>{var e,n;(n=(e=s.scrollElement)==null?void 0:e.scrollTo)==null||n.call(e,{[s.options.horizontal?"left":"top"]:r+a,behavior:t})},"scrollWithAdjustments");var X=ot;function lt(r,a,t,s){if(a===0)return!1;let e=s(0),n=new Set,o=0;for(;o<r;){let l=t(o);if(l===e)break;n.add(l),o++}let i=r-o;if(i===0||i>=a)return!1;for(let l=0;l<i;l++)if(s(l)!==t(o+l))return!1;for(let l=i;l<a;l++)if(n.has(s(l)))return!1;return!0}c(lt,"isAppendWithTrim");var D=class{static{c(this,"Virtualizer")}constructor(a){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this._clampedAdjustment=null,this.elementsCache=new Map,this.now=()=>{var t,s,e;return((e=(s=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:s.now)==null?void 0:e.call(s))??Date.now()},this.observer=(()=>{let t=null,s=c(()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(e=>{e.forEach(n=>{let o=c(()=>{let i=n.target,l=this.indexFromElement(i);if(!i.isConnected){this.observer.unobserve(i);for(let[u,g]of this.elementsCache)if(g===i){this.elementsCache.delete(u);break}return}this.isIndexInRange(l)&&this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(i,n,this))},"run");this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})})),"get");return{disconnect:c(()=>{var e;(e=s())==null||e.disconnect(),t=null},"disconnect"),observe:c(e=>{var n;return(n=s())==null?void 0:n.observe(e,{box:"border-box"})},"observe"),unobserve:c(e=>{var n;return(n=s())==null?void 0:n.unobserve(e)},"unobserve")}})(),this.range=null,this.setOptions=t=>{var s;let e={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:tt,rangeExtractor:et,onChange:c(()=>{},"onChange"),measureElement:it,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(let h in t){let f=t[h];f!==void 0&&(e[h]=f)}let n=this.options,o=null,i=null,l=!1;if(n!==void 0&&n.enabled&&e.enabled&&e.anchorTo==="end"&&this.scrollElement!==null){let h=n.count,f=e.count,d=this.getMeasurements(),S=((s=this._singleLaneMeasurements)==null?void 0:s.items)??d,v=c(O=>B(S[O]),"getPreviousKey"),E=h>0?v(0):null,b=h>0?v(h-1):null;if(f!==h||h>0&&f>0&&(e.getItemKey(0)!==E||e.getItemKey(f-1)!==b)){l=!0;let O=h>0?this.getVirtualItemForOffset(this.getScrollOffset())??d[0]:null;O&&(o=[O.key,this.getScrollOffset()-O.start]);let _=e.followOnAppend===!0?"auto":e.followOnAppend||null;_&&f>0&&this.isAtEnd(n.scrollEndThreshold)&&(h===0||e.getItemKey(f-1)!==b)&&(f>h||lt(h,f,v,e.getItemKey))&&(i=_)}}this.options=e,l&&(this.pendingMin=0,this.itemSizeCacheVersion++);let u=!1,g=0;if(o&&this.scrollOffset!==null){let[h,f]=o,d=this.getMeasurements(),{count:S,getItemKey:v}=this.options,E=0;for(;E<S&&v(E)!==h;)E++;if(E<S){let b=d[E];if(b){let m=Math.max(0,b.start+f);!i&&m!==this.scrollOffset&&(g=m-this.scrollOffset,this.scrollOffset=m,u=!0)}}}(u||i)&&(this.pendingScrollAnchor=[u?o[0]:null,u?o[1]:0,i,g])},this.notify=t=>{var s,e;(e=(s=this.options).onChange)==null||e.call(s,this,t)},this.maybeNotify=z(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:c(()=>this.options.debug,"debug"),initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._clampedAdjustment=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t,s;let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,i)=>{if(i&&this._intendedScrollOffset===null&&o===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(o-this._intendedScrollOffset)<1.5&&(o=this._intendedScrollOffset),this._intendedScrollOffset=null,this._clampedAdjustment!==null&&Math.abs(o-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null),this.scrollAdjustments=0;let l=this.getScrollOffset();this.scrollDirection=i?l===o?this.scrollDirection:l<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=i,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){let o=this.scrollElement,i=c(()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},"onTouchStart"),l=c(()=>{this._iosTouching=!1,!(!V()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))},"onTouchEnd");o.addEventListener("touchstart",i,F),o.addEventListener("touchend",l,F),this.unsubs.push(()=>{o.removeEventListener("touchstart",i),o.removeEventListener("touchend",l),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let n=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,n&&this.scrollElement&&this.options.enabled){let[o,i,l,u]=n;o!==null&&!l&&(V()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?u!==0&&(this._iosDeferredAdjustment+=u):((s=this.scrollState)==null?void 0:s.behavior)==="smooth"&&!k(this.getScrollOffset()-u,this.scrollState.lastTargetOffset)||this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),l&&this.scrollToEnd({behavior:l})}this._retryClampedAdjustment()},this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled)return;let{target:t,maxAtWrite:s}=this._clampedAdjustment,e=this.getMaxScrollOffset();e>s+.5&&(this._clampedAdjustment=t>e+.5?{target:t,maxAtWrite:e}:null,this._scrollToOffset(t,{adjustments:void 0,behavior:void 0}))},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let t=this.getScrollOffset(),s=this.getMaxScrollOffset();if(t<0||t>s)return;if(this._iosDeferredAdjustment<0&&t>=s-1){this._iosDeferredAdjustment=0;return}let e=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=e,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=z(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(t,s,e,n,o,i,l,u)=>(this.prevLanes!==void 0&&this.prevLanes!==i&&(this.lanesChangedFlag=!0),this.prevLanes=i,this.pendingMin=null,{count:t,paddingStart:s,scrollMargin:e,getItemKey:n,enabled:o,lanes:i,laneAssignmentMode:l,gap:u}),{key:!1}),this.isIndexInRange=t=>t>=0&&t<this.options.count,this.getMeasurements=z(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:s,scrollMargin:e,getItemKey:n,enabled:o,lanes:i,laneAssignmentMode:l,gap:u},g)=>{var h;let f=this.itemSizeCache;if(!o)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(let m of this.laneAssignments.keys())m>=t&&this.laneAssignments.delete(m);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(m=>{this.itemSizeCache.set(m.key,m.size)}));let d=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),i===1){let m=t*2,p=(h=this._singleLaneMeasurements)==null?void 0:h.flat;if(!p||p.length<m){let x=new Float64Array(m);p&&d>0&&x.set(p.subarray(0,d*2)),p=x}let O=d===0?new Array(t):this._singleLaneMeasurements.items.slice(),_;if(d===0)_=s+e;else{let x=d-1;_=p[x*2]+p[x*2+1]+u}for(let x=d;x<t;x++){let M=n(x);O[x]=M;let T=f.get(M),C=typeof T=="number"?T:this.options.estimateSize(x);p[x*2]=_,p[x*2+1]=C,_+=C+u}this._singleLaneMeasurements={flat:p,items:O};let y=H(O,p);return this.measurementsCache=y,y}let S=this.measurementsCache.slice(0,d),v=new Array(i).fill(void 0),E=new Float64Array(i),b=0;for(let m=0;m<d;m++){let p=S[m];p&&(v[p.lane]===void 0&&b++,v[p.lane]=m,E[p.lane]=p.end)}for(let m=d;m<t;m++){let p=n(m),O=this.laneAssignments.get(m),_,y,x=l==="estimate"||f.has(p);if(O!==void 0&&this.options.lanes>1){_=O;let R=v[_],w=R!==void 0?S[R]:void 0;y=w?w.end+u:s+e}else if(b===i){let R=0,w=E[0],K=v[0];for(let A=1;A<i;A++){let L=E[A];(L<w||L===w&&v[A]<K)&&(R=A,w=L,K=v[A])}_=R,y=w+u,x&&this.laneAssignments.set(m,_)}else _=m%this.options.lanes,y=s+e,x&&this.laneAssignments.set(m,_);let M=f.get(p),T=typeof M=="number"?M:this.options.estimateSize(m),C=y+T;S[m]={index:m,start:y,size:T,end:C,key:p,lane:_},v[_]===void 0&&b++,v[_]=m,E[_]=C}return this.measurementsCache=S,S},{key:!1,debug:c(()=>this.options.debug,"debug")}),this.calculateRange=z(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,s,e,n)=>t.length===0||s===0?(this.range=null,null):(this.range=at(t,s,e,n,n===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:c(()=>this.options.debug,"debug")}),this.getVirtualIndexes=z(()=>{let t=null,s=null,e=this.calculateRange();return e&&(t=e.startIndex,s=e.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,s]},(t,s,e,n,o)=>n===null||o===null?[]:t({startIndex:n,endIndex:o,overscan:s,count:e}),{key:!1,debug:c(()=>this.options.debug,"debug")}),this.indexFromElement=t=>{let s=this.options.indexAttribute,e=t.getAttribute(s);return e?parseInt(e,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;let e=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(e!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,e-n),i=Math.min(this.options.count-1,e+n);return t>=o&&t<=i}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((o,i)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(i))});return}let s=this.indexFromElement(t);if(!this.isIndexInRange(s))return;let e=this.options.getItemKey(s),n=this.elementsCache.get(e);n!==t&&(n&&this.observer.unobserve(n),this.observer.observe(t),this.elementsCache.set(e,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,s)=>{var e,n,o;if(!this.isIndexInRange(t))return;let i,l,u,g=(e=this._singleLaneMeasurements)==null?void 0:e.flat;if(this.options.lanes===1&&g!=null)u=this.options.getItemKey(t),l=g[t*2],i=g[t*2+1];else{let d=this.measurementsCache[t];if(!d)return;u=d.key,l=d.start,i=d.size}let h=this.itemSizeCache.get(u)??i,f=s-h;if(f!==0){let d=this.options.anchorTo==="end"&&((n=this.scrollState)==null?void 0:n.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,S=d?this.getTotalSize():0,v=this.getScrollOffset()+this.scrollAdjustments,b=!this.itemSizeCache.has(u)?l<v:l+h<=v&&this.scrollDirection!=="backward",m=((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:u,start:l,size:i,end:l+i,lane:0},f,this):b);(this.pendingMin===null||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(u,s),this.itemSizeCacheVersion++;let p=!1;d?p=this.applyScrollAdjustment(this.getTotalSize()-S):m&&(p=this.applyScrollAdjustment(f)),this.notify(p),this._retryClampedAdjustment()}},this.getVirtualItems=z(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,s)=>{let e=[];for(let n=0,o=t.length;n<o;n++){let i=t[n],l=s[i];e.push(l)}return e},{key:!1,debug:c(()=>this.options.debug,"debug")}),this.getVirtualItemForOffset=t=>{var s;let e=this.getMeasurements();if(e.length===0)return;let n=(s=this._singleLaneMeasurements)==null?void 0:s.flat,o=this.options.lanes===1&&n!=null,i=Y(0,e.length-1,o?l=>n[l*2]:l=>W(e[l]).start,t);return W(e[i])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,s,e=0)=>{if(!this.scrollElement)return 0;let n=this.getSize(),o=this.getScrollOffset();s==="auto"&&(s=t>=o+n?"end":"start"),s==="center"?t+=(e-n)/2:s==="end"&&(t-=n);let i=this.getMaxScrollOffset();return Math.max(Math.min(i,t),0)},this.getOffsetForIndex=(t,s="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));let e=this.getSize(),n=this.getScrollOffset(),o=this.measurementsCache[t];if(!o)return;if(s==="auto")if(o.end>=n+e-this.options.scrollPaddingEnd)s="end";else if(o.start<=n+this.options.scrollPaddingStart)s="start";else return[n,s];if(s==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),s];let i=s==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,s,o.size),s]},this.scrollToOffset=(t,{align:s="start",behavior:e="auto"}={})=>{this._iosDeferredAdjustment=0;let n=this.getOffsetForAlignment(t,s),o=this.now();this.scrollState={index:null,align:s,behavior:e,startedAt:o,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:e}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:s="auto",behavior:e="auto"}={})=>{this._iosDeferredAdjustment=0,t=Math.max(0,Math.min(t,this.options.count-1));let n=this.getOffsetForIndex(t,s);if(!n)return;let[o,i]=n,l=this.now();this.scrollState={index:t,align:i,behavior:e,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:e}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:s="auto"}={})=>{let e=this.getScrollOffset()+t,n=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:n,lastTargetOffset:e,stableFrames:0},this._scrollToOffset(e,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:t="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:t});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.getTotalSize=()=>{var t,s;let e=this.getMeasurements(),n;if(e.length===0)n=this.options.paddingStart;else if(this.options.lanes===1){let o=e.length-1,i=(t=this._singleLaneMeasurements)==null?void 0:t.flat;i!=null?n=i[o*2]+i[o*2+1]:n=((s=e[o])==null?void 0:s.end)??0}else{let o=Array(this.options.lanes).fill(null),i=e.length-1;for(;i>=0&&o.some(l=>l===null);){let l=e[i];o[l.lane]===null&&(o[l.lane]=l.end),i--}n=Math.max(...o.filter(l=>l!==null))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let t=[];if(this.itemSizeCache.size===0)return t;let s=this.getMeasurements();for(let e of s)e&&this.itemSizeCache.has(e.key)&&t.push({index:e.index,key:e.key,start:e.start,size:e.size,end:e.end,lane:e.lane});return t},this._scrollToOffset=(t,{adjustments:s,behavior:e})=>{this._intendedScrollOffset=t+(s??0),this.options.scrollToFn(t,{behavior:e,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(a)}applyScrollAdjustment(a,t){if(a===0)return!1;if(V()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded))return this._iosDeferredAdjustment+=a,!1;{let s=this.getScrollOffset()+this.scrollAdjustments+a,e=this.scrollElement,n=e!==null&&("scrollHeight"in e||"document"in e)?this.getMaxScrollOffset():null;return this._clampedAdjustment=n!==null&&s>n+.5?{target:s,maxAtWrite:n}:null,this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0}}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,e=s?s[0]:this.scrollState.lastTargetOffset,n=1,o=e!==this.scrollState.lastTargetOffset;if(!o&&k(e,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=n){this.getScrollOffset()!==e&&this._scrollToOffset(e,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){let i=this.getSize()||600,l=Math.abs(e-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&l>i;this.scrollState.lastTargetOffset=e,u||(this.scrollState.behavior="auto"),this._scrollToOffset(e,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}},Y=c((r,a,t,s)=>{for(;r<=a;){let e=(r+a)/2|0,n=t(e);if(n<s)r=e+1;else if(n>s)a=e-1;else return e}return r>0?r-1:0},"findNearestBinarySearch");function rt(r,a,t){let s=0;for(;s<=a;){let e=(s+a)/2|0,n=r[e*2];if(n<t)s=e+1;else if(n>t)a=e-1;else return e}return s>0?s-1:0}c(rt,"findNearestBinarySearchFlat");function at(r,a,t,s,e){let n=r.length-1;if(r.length<=s)return{startIndex:0,endIndex:n};if(s===1&&e!==null){let u=rt(e,n,t),g=u,h=t+a;for(;g<n&&e[g*2]+e[g*2+1]<h;)g++;return{startIndex:u,endIndex:g}}let i=Y(0,n,c(u=>r[u].start,"getStart"),t),l=i;if(s===1)for(;l<n&&r[l].end<t+a;)l++;else if(s>1){let u=Array(s).fill(0);for(;l<n&&u.some(h=>h<t+a);){let h=r[l];u[h.lane]=h.end,l++}let g=Array(s).fill(t+a);for(;i>=0&&g.some(h=>h>=t);){let h=r[i];g[h.lane]=h.start,i--}i=Math.max(0,i-i%s),l=Math.min(n,l+(s-1-l%s))}return{startIndex:i,endIndex:l}}c(at,"calculateRangeImpl");var I=P(Q(),1),G=P(Z(),1);var N=typeof document<"u"?I.useLayoutEffect:I.useEffect;function ht({useFlushSync:r=!0,directDomUpdates:a=!1,directDomUpdatesMode:t="transform",...s}){let e=I.useReducer(h=>h+1,0)[1],n=I.useRef({enabled:a,mode:t,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});n.current.enabled=a,n.current.mode=t;let o=I.useRef(!1),i=c(h=>{let f=n.current;if(!f.enabled||!f.container)return;let d=h.getTotalSize();if(d!==f.lastSize){f.lastSize=d;let S=h.options.horizontal?"width":"height";f.container.style[S]=`${d}px`}},"applyContainerSize"),l=c(h=>{let f=n.current;if(!f.enabled||!f.container)return;i(h);let d=!!h.options.horizontal,S=f.mode==="transform",v=d?"left":"top",E=h.options.scrollMargin,b=h.getVirtualItems();for(let m of b){let p=m.start-E,O=h.elementsCache.get(m.key);O&&f.lastPositions.get(O)!==p&&(f.lastPositions.set(O,p),S?O.style.transform=d?`translate3d(${p}px, 0, 0)`:`translate3d(0, ${p}px, 0)`:O.style[v]=`${p}px`)}},"applyDirectStyles"),u={...s,onChange:c((h,f)=>{var d;let S=n.current,v=!0;if(S.enabled){l(h);let E=h.range,b=S.prevRange;v=!b||b.isScrolling!==h.isScrolling||b.startIndex!==E?.startIndex||b.endIndex!==E?.endIndex,v&&(S.prevRange=E?{startIndex:E.startIndex,endIndex:E.endIndex,isScrolling:h.isScrolling}:null)}v&&(r&&f&&!o.current?(0,G.flushSync)(e):e()),(d=s.onChange)==null||d.call(s,h,f)},"onChange")},[g]=I.useState(()=>{let h=new D(u),f=h.measureElement;return h.measureElement=d=>{o.current=!0;try{f(d)}finally{o.current=!1}},Object.assign(h,{containerRef:c(d=>{let S=n.current;if(S.container=d,S.lastSize=null,d&&S.enabled){let v=h.getTotalSize();S.lastSize=v;let E=h.options.horizontal?"width":"height";d.style[E]=`${v}px`}},"containerRef")})});return g.setOptions(u),N(()=>g._didMount(),[]),N(()=>(i(g),g._willUpdate())),N(()=>{l(g)}),g}c(ht,"useVirtualizerBase");function _t(r){return ht({observeElementRect:q,observeElementOffset:U,scrollToFn:X,...r})}c(_t,"useVirtualizer");export{q as a,U as b,_t as c};
@@ -0,0 +1 @@
1
+ import{i as A}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as D}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import{p as J}from"./chunk-OIDFWEJX.js";import"./chunk-WZTY3ZYI.js";import{a as G}from"./chunk-3Y5K3IQO.js";import{a as Q,b as W,c as Z,d as V,e as C,f as S}from"./chunk-CW57Q264.js";import{a as $,e as z}from"./chunk-MD67S53Z.js";import{f as B,j as F,r as H,s as K}from"./chunk-LPINY2IJ.js";import{a as I,d as M,e as U,f as X,g as Y}from"./chunk-OXFKZ4BM.js";var L=M(X(),1),g=M(U(),1);var t=M(Y(),1);var _=10,E=I(h=>{let e=(0,L.c)(7),{label:i,value:l}=h,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let a=l??"\u2014",n;e[2]!==a?(n=(0,t.jsx)("span",{className:"font-mono text-sm",children:a}),e[2]=a,e[3]=n):n=e[3];let s;return e[4]!==r||e[5]!==n?(s=(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[r,n]}),e[4]=r,e[5]=n,e[6]=s):s=e[6],s},"_"),ee=I(h=>{let e=(0,L.c)(38),{indexes:i,onSelect:l,selected:r}=h,a=B(),n;e[0]!==a?(n=a("name"),e[0]=a,e[1]=n):n=e[1];let s;e[2]!==n?(s=(0,t.jsx)(C,{children:n}),e[2]=n,e[3]=s):s=e[3];let c;e[4]!==a?(c=a("table"),e[4]=a,e[5]=c):c=e[5];let o;e[6]!==c?(o=(0,t.jsx)(C,{children:c}),e[6]=c,e[7]=o):o=e[7];let d;e[8]!==a?(d=a("dimensions"),e[8]=a,e[9]=d):d=e[9];let x;e[10]!==d?(x=(0,t.jsx)(C,{children:d}),e[10]=d,e[11]=x):x=e[11];let m;e[12]!==a?(m=a("metric"),e[12]=a,e[13]=m):m=e[13];let p;e[14]!==m?(p=(0,t.jsx)(C,{children:m}),e[14]=m,e[15]=p):p=e[15];let u;e[16]!==a?(u=a("vectors"),e[16]=a,e[17]=u):u=e[17];let v;e[18]!==u?(v=(0,t.jsx)(C,{children:u}),e[18]=u,e[19]=v):v=e[19];let y;e[20]!==v||e[21]!==s||e[22]!==o||e[23]!==x||e[24]!==p?(y=(0,t.jsx)(W,{children:(0,t.jsxs)(V,{children:[s,o,x,p,v]})}),e[20]=v,e[21]=s,e[22]=o,e[23]=x,e[24]=p,e[25]=y):y=e[25];let k;if(e[26]!==i||e[27]!==l||e[28]!==r){let q;e[30]!==l||e[31]!==r?(q=I(w=>(0,t.jsxs)(V,{className:w.name===r?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":w.name,"data-testid":`vector-row-${w.name}`,onClick:l,children:[(0,t.jsx)(S,{className:"font-mono text-xs",children:w.name}),(0,t.jsx)(S,{className:"font-mono text-xs",children:w.table}),(0,t.jsx)(S,{className:"tabular-nums",children:w.dimensions??"\u2014"}),(0,t.jsx)(S,{children:w.metric??"\u2014"}),(0,t.jsx)(S,{className:"tabular-nums",children:w.vectorsCount??"\u2014"})]},w.name),"q"),e[30]=l,e[31]=r,e[32]=q):q=e[32],k=i.map(q),e[26]=i,e[27]=l,e[28]=r,e[29]=k}else k=e[29];let N;e[33]!==k?(N=(0,t.jsx)(Z,{children:k}),e[33]=k,e[34]=N):N=e[34];let f;return e[35]!==y||e[36]!==N?(f=(0,t.jsx)($,{className:"overflow-hidden py-0",children:(0,t.jsx)(z,{className:"px-0",children:(0,t.jsxs)(Q,{"data-testid":"vector-table",children:[y,N]})})}),e[35]=y,e[36]=N,e[37]=f):f=e[37],f},"X"),te=I(h=>{let e=(0,L.c)(27),{matches:i}=h,l=B();if(i.length===0){let u;e[0]!==l?(u=l("No matches."),e[0]=l,e[1]=u):u=e[1];let v;return e[2]!==u?(v=(0,t.jsx)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:u}),e[2]=u,e[3]=v):v=e[3],v}let r;e[4]!==l?(r=l("id"),e[4]=l,e[5]=r):r=e[5];let a;e[6]!==r?(a=(0,t.jsx)(C,{children:r}),e[6]=r,e[7]=a):a=e[7];let n;e[8]!==l?(n=l("score"),e[8]=l,e[9]=n):n=e[9];let s;e[10]!==n?(s=(0,t.jsx)(C,{children:n}),e[10]=n,e[11]=s):s=e[11];let c;e[12]!==l?(c=l("metadata"),e[12]=l,e[13]=c):c=e[13];let o;e[14]!==c?(o=(0,t.jsx)(C,{children:c}),e[14]=c,e[15]=o):o=e[15];let d;e[16]!==a||e[17]!==s||e[18]!==o?(d=(0,t.jsx)(W,{children:(0,t.jsxs)(V,{children:[a,s,o]})}),e[16]=a,e[17]=s,e[18]=o,e[19]=d):d=e[19];let x;e[20]!==i?(x=i.map(le),e[20]=i,e[21]=x):x=e[21];let m;e[22]!==x?(m=(0,t.jsx)(Z,{children:x}),e[22]=x,e[23]=m):m=e[23];let p;return e[24]!==d||e[25]!==m?(p=(0,t.jsx)($,{className:"mt-3 overflow-hidden py-0",children:(0,t.jsx)(z,{className:"px-0",children:(0,t.jsxs)(Q,{"data-testid":"vector-matches",children:[d,m]})})}),e[24]=d,e[25]=m,e[26]=p):p=e[26],p},"Y"),me=I(({loadIndexes:h,runQuery:e}={})=>{let i=J(),l=B(),[r,a]=(0,g.useState)(null),[n,s]=(0,g.useState)(null),[c,o]=(0,g.useState)(null),[d,x]=(0,g.useState)(""),[m,p]=(0,g.useState)(null),[u,v]=(0,g.useState)(null),[y,k]=(0,g.useState)(!1),N=(0,g.useRef)(0);(0,g.useEffect)(()=>{let b={cancelled:!1};return K((async()=>{try{let j=await(h??(()=>i.listVectorIndexes()))();b.cancelled||(a(j),s(null),o(T=>T??j[0]?.name??null))}catch(j){b.cancelled||(a(null),s(F(j)))}})()),()=>{b.cancelled=!0}},[i,h]);let f=r?.find(b=>b.name===c)??null,q=I(b=>{N.current+=1,o(b.currentTarget.dataset.index??null),p(null),v(null),k(!1)},"q"),w=I(b=>{x(b.target.value)},"y"),O=I(async()=>{let b=d.trim();if(c===null||b==="")return;N.current+=1;let j=N.current;k(!0),v(null);try{let T=await(e??(R=>i.queryVectorIndex(R)))({name:c,text:b,topK:_});if(j!==N.current)return;p(T)}catch(T){if(j!==N.current)return;p(null),v(F(T))}k(!1)},"H"),P=I(()=>{K(O())},"K");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[n!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:n}),r!==null&&r.length===0&&(0,t.jsx)(G,{description:l("Indexes declared with .vectorize() or defineVectorIndex() appear here."),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 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"})}),testId:"vector-empty",title:l("No vector indexes.")}),r!==null&&r.length>0&&(0,t.jsx)(ee,{indexes:r,onSelect:q,selected:c}),f!==null&&(0,t.jsxs)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,t.jsx)(E,{label:l("field"),value:f.field}),(0,t.jsx)(E,{label:l("dimensions"),value:f.dimensions}),(0,t.jsx)(E,{label:l("metric"),value:f.metric}),(0,t.jsx)(E,{label:l("vectors"),value:f.vectorsCount})]}),f.metadata!==void 0&&f.metadata.length>0&&(0,t.jsxs)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[l("metadata"),": ",(0,t.jsx)("span",{className:"font-mono",children:f.metadata.join(", ")})]}),(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,t.jsx)(A,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:w,placeholder:l("Search by similarity\u2026"),value:d}),(0,t.jsx)(D,{"data-testid":"vector-search",disabled:y||d.trim()==="",onClick:P,children:l(y?"Searching\u2026":"Search")})]}),u!==null&&(0,t.jsx)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:u}),m!==null&&(0,t.jsx)(te,{matches:m})]})]})},"ue");function le(h){return(0,t.jsxs)(V,{"data-testid":`vector-match-${h.id}`,children:[(0,t.jsx)(S,{className:"font-mono text-xs",children:h.id}),(0,t.jsx)(S,{className:"tabular-nums",children:h.score.toFixed(4)}),(0,t.jsx)(S,{className:"max-w-md truncate font-mono text-xs",children:h.metadata===void 0?"\u2014":H(h.metadata)})]},h.id)}I(le,"ee");export{me as VectorBrowser};
@@ -0,0 +1 @@
1
+ import{b as u}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as y}from"./chunk-DSTNWB4N.js";import"./chunk-OSJ7HV7B.js";import"./chunk-6QBK3Z7A.js";import"./chunk-E26OT26O.js";import{a as N}from"./chunk-6UTZXEW3.js";import{c as v}from"./chunk-ZKPRORLI.js";import"./chunk-OIDFWEJX.js";import"./chunk-WZTY3ZYI.js";import{a as g}from"./chunk-3Y5K3IQO.js";import{a as w,b,c as S,d as c,e as s,f as o}from"./chunk-CW57Q264.js";import{a as f,e as x}from"./chunk-MD67S53Z.js";import{f as p}from"./chunk-LPINY2IJ.js";import{a as n,d as R,g as T}from"./chunk-OXFKZ4BM.js";var e=R(T(),1);var $={active:"default",failing:"destructive",idle:"secondary"},j=n(a=>a===void 0?"\u2014":`${new Date(a).toISOString().slice(0,19).replace("T"," ")} UTC`,"I"),U=n(a=>{let t=a.runs+a.suppressed;return t===0?void 0:Math.round(a.suppressed/t*100)},"$"),F=n(({initialShardKey:a=""})=>{let t=p(),{data:l,error:E,errorSource:A,liveError:I}=v(N.listReactors,{},{live:!0,shardKey:a}),C=l!==void 0,i=Array.isArray(l?.reactors)?l.reactors:[],d;C&&i.length===0?d=(0,e.jsx)(g,{description:t("No reactor is declared in this deployment. Export an onQueryChange(select, handler) from lunora/ to run server-side logic when a query's result changes."),testId:"reactors-empty",title:t("No reactors declared")}):d=(0,e.jsx)(f,{className:"overflow-hidden py-0",children:(0,e.jsx)(x,{className:"px-0",children:(0,e.jsxs)(w,{"data-testid":"reactors-table",children:[(0,e.jsx)(b,{children:(0,e.jsxs)(c,{children:[(0,e.jsx)(s,{children:t("Reactor")}),(0,e.jsx)(s,{children:t("State")}),(0,e.jsx)(s,{children:t("Ran")}),(0,e.jsx)(s,{children:t("Suppressed")}),(0,e.jsx)(s,{children:t("Errors")}),(0,e.jsx)(s,{children:t("Watches")}),(0,e.jsx)(s,{children:t("Last dispatch")})]})}),(0,e.jsx)(S,{children:i.map(r=>{let m=U(r);return(0,e.jsxs)(c,{"data-testid":`reactors-row-${r.path}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:r.path}),(0,e.jsx)(o,{children:(0,e.jsx)(u,{"data-testid":`reactors-state-${r.path}`,variant:$[r.state],children:r.state})}),(0,e.jsx)(o,{className:"font-mono text-xs",children:r.runs}),(0,e.jsxs)(o,{className:"font-mono text-xs text-muted-foreground",children:[r.suppressed,m===void 0?"":` (${String(m)}%)`]}),(0,e.jsx)(o,{className:"font-mono text-xs",children:r.errors===0?(0,e.jsx)("span",{className:"text-muted-foreground",children:"0"}):(0,e.jsx)("span",{className:"text-destructive",children:r.errors})}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:r.tables===void 0||r.tables.length===0?"\u2014":r.tables.join(", ")}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:j(r.lastRanAt)})]},r.path)})})]})})});let h=i.filter(r=>r.state==="failing");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-reactors-panel",children:[E!==null&&(0,e.jsx)(y,{error:A,testId:"reactors-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t("A reactor runs after a write flush, but only when the result of the query it watches actually changed \u2014 a trigger fires on a row write, a reactor fires on a result changing. Suppressed dispatches are the ones where the read re-ran and nothing had moved.")}),h.length>0&&(0,e.jsx)("div",{className:"flex flex-col gap-2","data-testid":"reactors-failing",children:h.map(r=>(0,e.jsxs)("p",{className:"text-xs text-destructive",role:"alert",children:[(0,e.jsx)("span",{className:"font-mono",children:r.path}),": ",r.lastError??t("last dispatch failed")]},r.path))}),I!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"reactors-live-error",role:"alert",children:t("Live updates unavailable; showing the last reading.")}),d]})},"U");export{F as default};
@@ -0,0 +1 @@
1
+ import{a as u,d as y,e as d}from"./chunk-OXFKZ4BM.js";var t=y(d(),1);var S=u((r,a=400)=>{let e=(r??"").trim(),[o,c]=(0,t.useState)(e),[i,n]=(0,t.useState)(e),m=(0,t.useRef)(r);m.current!==r&&(m.current=r,c(e),n(e));let f=o.trim();return(0,t.useEffect)(()=>{let s=setTimeout(()=>{n(f)},a);return()=>{clearTimeout(s)}},[f,a]),{queryShardKey:i,setShardKey:u(s=>{c(s)},"setShardKey"),shardKey:o}},"f");export{S as a};
@@ -0,0 +1 @@
1
+ import{a as q}from"./chunk-W4X4J7BU.js";import{a as F}from"./chunk-5DNGK3NT.js";import{a as D}from"./chunk-KYONGQQ4.js";import"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import"./chunk-ZBON5T5A.js";import{b as S}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as L}from"./chunk-DSTNWB4N.js";import"./chunk-OSJ7HV7B.js";import"./chunk-6QBK3Z7A.js";import"./chunk-E26OT26O.js";import{a as B}from"./chunk-6UTZXEW3.js";import{c as _}from"./chunk-ZKPRORLI.js";import"./chunk-OIDFWEJX.js";import"./chunk-WZTY3ZYI.js";import{a as j}from"./chunk-3Y5K3IQO.js";import{a as O,b as P,c as W,d as C,e as h,f as p}from"./chunk-CW57Q264.js";import{a as T,e as $}from"./chunk-MD67S53Z.js";import{f as M,p as E}from"./chunk-LPINY2IJ.js";import{a as N,d as A,f as H,g as U}from"./chunk-OXFKZ4BM.js";var R=A(H(),1);var t=A(U(),1);var J=80,Z=N(a=>{if(a===void 0)return"";let e=JSON.stringify(a,E);return e.length>J?`${e.slice(0,J)}\u2026`:e},"G"),z=N(a=>{let e=[];for(let r of a){let n=r.id.toString();if(r.subscriptions.length===0){e.push({admin:r.admin,connectionId:r.id,key:`c${n}`,subscription:null});continue}r.subscriptions.forEach((d,o)=>{e.push({admin:r.admin,connectionId:r.id,key:`c${n}-s${o.toString()}`,subscription:d})})}return e},"J"),w=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),ce=N(a=>{let e=(0,R.c)(22),{initialShardKey:r}=a,n=M(),{queryShardKey:d,setShardKey:o,shardKey:m}=F(r),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];let b;e[1]!==d?(b={keepPreviousData:!0,shardKey:d},e[1]=d,e[2]=b):b=e[2];let{data:s,error:i,errorSource:u,poll:G}=_(B.listSubscriptions,f,b);q(G,!0);let x;if(e[3]!==i||e[4]!==u||e[5]!==s||e[6]!==o||e[7]!==m||e[8]!==n){let k=s===void 0?[]:z(s.connections),c;e[10]!==o||e[11]!==m?(c=(0,t.jsx)(D,{onChange:o,testId:"subs-shard-input",value:m}),e[10]=o,e[11]=m,e[12]=c):c=e[12];let l;e[13]!==s||e[14]!==n?(l=s!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,t.jsx)(S,{variant:"secondary",children:n("{count} connections",{count:s.totalConnections})}),(0,t.jsx)(S,{variant:"secondary",children:n("{count} subscriptions",{count:s.totalSubscriptions})})]}),e[13]=s,e[14]=n,e[15]=l):l=e[15];let g;e[16]!==c||e[17]!==l?(g=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,l]}),e[16]=c,e[17]=l,e[18]=g):g=e[18];let v;e[19]!==i||e[20]!==u?(v=i!==null&&(0,t.jsx)(L,{error:u,testId:"subs-error"}),e[19]=i,e[20]=u,e[21]=v):v=e[21],x=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[g,v,i===null&&s!==void 0&&k.length===0&&(0,t.jsx)(j,{description:n("Active WebSocket subscriptions on this shard."),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:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"})}),testId:"subs-empty",title:n("No active subscriptions.")}),i===null&&k.length>0&&(0,t.jsx)(T,{className:"overflow-hidden py-0",children:(0,t.jsx)($,{className:"px-0",children:(0,t.jsxs)(O,{"data-testid":"subs-table",children:[(0,t.jsx)(P,{children:(0,t.jsxs)(C,{children:[(0,t.jsx)(h,{children:n("Connection")}),(0,t.jsx)(h,{children:n("Function path")}),(0,t.jsx)(h,{children:n("Table")}),(0,t.jsx)(h,{children:n("Arguments")})]})}),(0,t.jsx)(W,{children:k.map(y=>{let{subscription:I}=y,K=Z(I?.args);return(0,t.jsxs)(C,{"data-testid":"subs-row",children:[(0,t.jsx)(p,{className:"font-medium tabular-nums",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:["#",y.connectionId,y.admin&&(0,t.jsx)(S,{variant:"outline",children:n("admin")})]})}),(0,t.jsx)(p,{className:"font-mono text-xs",children:I?.functionPath??w}),(0,t.jsx)(p,{children:I?.table??w}),(0,t.jsx)(p,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:K||void 0,children:K||w})]},y.key)})})]})})})]}),e[3]=i,e[4]=u,e[5]=s,e[6]=o,e[7]=m,e[8]=n,e[9]=x}else x=e[9];return x},"ae");export{ce as default};
@@ -0,0 +1 @@
1
+ import{a as we}from"./chunk-P6L6ABWO.js";import{a as ve}from"./chunk-ZWDORIZY.js";import{i as ie}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as U}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import{a as te}from"./chunk-6UTZXEW3.js";import{c as Ne}from"./chunk-ZKPRORLI.js";import{p as ue}from"./chunk-OIDFWEJX.js";import"./chunk-WZTY3ZYI.js";import{a as de}from"./chunk-3Y5K3IQO.js";import{a as ae,b as re,c as ne,d as j,e as h,f as p}from"./chunk-CW57Q264.js";import{a as Y,e as ee}from"./chunk-MD67S53Z.js";import{f as X,h as ce,i as me,j as z,p as pe,s as q}from"./chunk-LPINY2IJ.js";import{a as s,d as he,e as ke,f as be,g as Se}from"./chunk-OXFKZ4BM.js";var xe=he(be(),1),i=he(ke(),1);var t=he(Se(),1);var Ce=["queued","running","rollingBack","paused","waiting","complete","errored","terminated"],Oe=["pause","resume","restart","terminate"],Ie=s(l=>{let e=(0,xe.c)(7),{busy:w,id:x,onAct:N}=l,b=X(),a;e[0]!==w||e[1]!==x||e[2]!==N||e[3]!==b?(a=Oe.map(m=>m==="restart"?(0,t.jsx)(ve,{confirmLabel:b("Restart?"),disabled:w,onConfirm:s(()=>{N(m)},"onConfirm"),testId:`workflow-instance-${m}-${x}`,children:b(m)},m):(0,t.jsx)(U,{"data-testid":`workflow-instance-${m}-${x}`,disabled:w,onClick:s(()=>{N(m)},"onClick"),size:"sm",type:"button",variant:"ghost",children:b(m)},m)),e[0]=w,e[1]=x,e[2]=N,e[3]=b,e[4]=a):a=e[4];let d;return e[5]!==a?(d=(0,t.jsx)(t.Fragment,{children:a}),e[5]=a,e[6]=d):d=e[6],d},"Ce"),$e="WORKFLOWS_NOT_CONFIGURED",We=s(l=>typeof l=="object"&&l!==null&&l.code===$e,"Oe"),Ae=s(l=>{let e=l.error??l.output;if(e===void 0)return"\u2014";try{return JSON.stringify(e,pe)}catch{return"(unserializable)"}},"Ee"),Te=s(({loadDetail:l,loadInstances:e,readOnly:w,runAction:x,workflowName:N})=>{let b=ue(),a=X(),[d,m]=(0,i.useState)(null),[v,L]=(0,i.useState)(null),[S,B]=(0,i.useState)(""),[C,O]=(0,i.useState)(null),[F,W]=(0,i.useState)(!1),[_,R]=(0,i.useState)(null),g=(0,i.useRef)(0),y=(0,i.useRef)(0),k=(0,i.useRef)(0),A=l??(n=>b.getWorkflowInstance(n)),I=w?void 0:x??(e===void 0?n=>b.setWorkflowInstanceStatus(n):void 0),T=s(async()=>{y.current+=1;let n=y.current;O(null),W(!1);let u=S===""?void 0:S;try{if(e===void 0){let r=await b.listWorkflowInstances({name:N,status:u});if(n!==y.current)return;if(r.configured===!1){m(null),W(!0);return}m(r.instances);return}let f=await e({name:N,status:u});n===y.current&&m(f)}catch(f){if(n!==y.current)return;m(null),We(f)?W(!0):O(z(f))}},"E");(0,i.useEffect)(()=>{g.current+=1,k.current+=1,L(null),q(T())},[N,S]);let P=s(async n=>{k.current+=1;let u=k.current;O(null);try{let f=await A({id:n,name:N});u===k.current&&L(f)}catch(f){u===k.current&&O(z(f))}},"W"),E=s(()=>{k.current+=1,L(null)},"A"),J=s(async(n,u)=>{if(I===void 0)return;let f=g.current;R(n),O(null);try{await I({action:u,id:n,name:N}),f===g.current&&await T()}catch(r){O(z(r))}R(null)},"L");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:a("Instance history")}),(0,t.jsxs)("select",{"aria-label":a("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:s(n=>{B(n.target.value)},"onChange"),value:S,children:[(0,t.jsx)("option",{value:"",children:a("All statuses")}),Ce.map(n=>(0,t.jsx)("option",{value:n,children:n},n))]})]}),C!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:C}),F&&(0,t.jsx)(de,{description:a("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:a("Workflow inspection not configured")}),!F&&d!==null&&d.length===0&&(0,t.jsx)(de,{description:a("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:a("No instances")}),d!==null&&d.length>0&&(0,t.jsx)(Y,{className:"overflow-hidden py-0",children:(0,t.jsx)(ee,{className:"px-0",children:(0,t.jsxs)(ae,{"data-testid":"workflow-instances-table",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(j,{children:[(0,t.jsx)(h,{children:a("Instance id")}),(0,t.jsx)(h,{children:a("Status")}),(0,t.jsx)(h,{children:a("Created")}),(0,t.jsx)(h,{children:a("Ended")}),(0,t.jsx)(h,{"aria-label":a("Actions")})]})}),(0,t.jsx)(ne,{children:d.map(n=>(0,t.jsxs)(j,{"data-testid":`workflow-instance-${n.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:n.id}),(0,t.jsx)(p,{className:"font-mono text-xs",children:n.status}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:n.createdOn??"\u2014"}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:n.endedOn??"\u2014"}),(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,t.jsx)(U,{"data-testid":`workflow-instance-steps-${n.id}`,onClick:s(()=>{q(P(n.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:a("Steps")}),I!==void 0&&(0,t.jsx)(Ie,{busy:_===n.id,id:n.id,onAct:s(u=>{q(J(n.id,u))},"onAct")},N)]})})]},n.id))})]})})}),v!==null&&(0,t.jsx)(Y,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,t.jsxs)(ee,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("span",{className:"font-mono text-xs",children:[a("Steps")," \xB7 ",v.id]}),(0,t.jsx)(U,{"data-testid":"workflow-instance-detail-close",onClick:E,size:"xs",type:"button",variant:"ghost",children:a("Close")})]}),v.steps.length===0?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:a("This instance has no recorded steps yet.")}):(0,t.jsxs)(ae,{"data-testid":"workflow-instance-steps",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(j,{children:[(0,t.jsx)(h,{children:a("Step")}),(0,t.jsx)(h,{children:a("Type")}),(0,t.jsx)(h,{children:a("Attempts")}),(0,t.jsx)(h,{children:a("Started")}),(0,t.jsx)(h,{children:a("Output")})]})}),(0,t.jsx)(ne,{children:v.steps.map((n,u)=>(0,t.jsxs)(j,{"data-testid":`workflow-step-${String(u)}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:n.name}),(0,t.jsx)(p,{className:"text-xs text-muted-foreground",children:n.type??"\u2014"}),(0,t.jsx)(p,{className:"tabular-nums",children:n.attempts??"\u2014"}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:n.start??"\u2014"}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:Ae(n)})]},`${n.name}:${String(u)}`))})]})]})})]})},"_e"),_e=ce(te.createWorkflowInstance),Ee=ce(te.getWorkflowInstanceStatus),Je=ce(te.sendWorkflowEvent),De=s(l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"\u2014";try{return JSON.stringify(l.output,pe)}catch{return"(unserializable)"}},"$e"),ge=s(l=>{let e=l.trim();if(e==="")return{value:void 0};try{return{value:JSON.parse(e)}}catch{return null}},"ve"),Fe=s((l,e)=>l.some(w=>w.exportName===e)?e:l[0]?.exportName??"","Fe"),Pe=s(l=>{let e=(0,xe.c)(72),{eventTypes:w,exportName:x,onSent:N}=l,b=ue(),a=X(),[d,m]=(0,i.useState)(""),[v,L]=(0,i.useState)(""),[S,B]=(0,i.useState)(""),[C,O]=(0,i.useState)(!1),[F,W]=(0,i.useState)(null),_;e[0]!==b||e[1]!==x||e[2]!==N||e[3]!==a||e[4]!==v?(_=s(async(D,oe)=>{try{await b.query(Je,{exportName:x,id:D,payload:oe,type:v},me(""))}catch(fe){W(z(fe));return}try{await N(x,D)}catch(fe){let ye=fe;W(`${a("Event sent, but refreshing the instance failed")}: ${z(ye)}`)}},"_"),e[0]=b,e[1]=x,e[2]=N,e[3]=a,e[4]=v,e[5]=_):_=e[5];let R=_,g;e[6]!==R||e[7]!==d||e[8]!==S||e[9]!==a?(g=s(async()=>{let D=d.trim(),oe=ge(S);if(oe===null){W(a("Payload must be valid JSON"));return}O(!0),W(null),await R(D,oe.value).finally(()=>{O(!1)})},"N"),e[6]=R,e[7]=d,e[8]=S,e[9]=a,e[10]=g):g=e[10];let y=g,k;e[11]!==a?(k=a("Send event"),e[11]=a,e[12]=k):k=e[12];let A;e[13]!==k?(A=(0,t.jsx)("h3",{className:"text-sm font-medium",children:k}),e[13]=k,e[14]=A):A=e[14];let I;e[15]!==F?(I=F!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-event-error",role:"alert",children:F}),e[15]=F,e[16]=I):I=e[16];let T;e[17]!==a?(T=a("Instance id"),e[17]=a,e[18]=T):T=e[18];let P;e[19]===Symbol.for("react.memo_cache_sentinel")?(P=s(D=>{m(D.target.value)},"O"),e[19]=P):P=e[19];let E;e[20]!==a?(E=a("Instance id"),e[20]=a,e[21]=E):E=e[21];let J;e[22]!==d||e[23]!==T||e[24]!==E?(J=(0,t.jsx)(ie,{"aria-label":T,className:"max-w-48","data-testid":"workflows-event-id",onChange:P,placeholder:E,value:d}),e[22]=d,e[23]=T,e[24]=E,e[25]=J):J=e[25];let n;e[26]!==a?(n=a("Event type"),e[26]=a,e[27]=n):n=e[27];let u;e[28]===Symbol.for("react.memo_cache_sentinel")?(u=s(D=>{L(D.target.value)},"L"),e[28]=u):u=e[28];let f;e[29]!==a?(f=a("Event type"),e[29]=a,e[30]=f):f=e[30];let r;e[31]!==n||e[32]!==f||e[33]!==v?(r=(0,t.jsx)(ie,{"aria-label":n,className:"max-w-48","data-testid":"workflows-event-type",list:"workflows-event-types",onChange:u,placeholder:f,value:v}),e[31]=n,e[32]=f,e[33]=v,e[34]=r):r=e[34];let c;e[35]!==w?(c=w.map(je),e[35]=w,e[36]=c):c=e[36];let o;e[37]!==c?(o=(0,t.jsx)("datalist",{"data-testid":"workflows-event-types",id:"workflows-event-types",children:c}),e[37]=c,e[38]=o):o=e[38];let $;e[39]!==x||e[40]!==d||e[41]!==C||e[42]!==v?($=C||x===""||d.trim()===""||v.trim()==="",e[39]=x,e[40]=d,e[41]=C,e[42]=v,e[43]=$):$=e[43];let K;e[44]!==y?(K=s(()=>{q(y())},"z"),e[44]=y,e[45]=K):K=e[45];let G;e[46]!==C||e[47]!==a?(G=a(C?"Sending\u2026":"Send event"),e[46]=C,e[47]=a,e[48]=G):G=e[48];let M;e[49]!==$||e[50]!==K||e[51]!==G?(M=(0,t.jsx)(U,{"data-testid":"workflows-event-button",disabled:$,onClick:K,children:G}),e[49]=$,e[50]=K,e[51]=G,e[52]=M):M=e[52];let Z;e[53]!==r||e[54]!==o||e[55]!==M||e[56]!==J?(Z=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[J,r,o,M]}),e[53]=r,e[54]=o,e[55]=M,e[56]=J,e[57]=Z):Z=e[57];let H;e[58]!==a?(H=a("Payload (JSON)"),e[58]=a,e[59]=H):H=e[59];let se;e[60]===Symbol.for("react.memo_cache_sentinel")?(se=s(D=>{B(D.target.value)},"Y"),e[60]=se):se=e[60];let Q;e[61]!==a?(Q=a("Payload (JSON, optional)"),e[61]=a,e[62]=Q):Q=e[62];let V;e[63]!==S||e[64]!==H||e[65]!==Q?(V=(0,t.jsx)(we,{"aria-label":H,className:"font-mono","data-testid":"workflows-event-payload",onChange:se,placeholder:Q,value:S}),e[63]=S,e[64]=H,e[65]=Q,e[66]=V):V=e[66];let le;return e[67]!==Z||e[68]!==V||e[69]!==A||e[70]!==I?(le=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-event",children:[A,I,Z,V]}),e[67]=Z,e[68]=V,e[69]=A,e[70]=I,e[71]=le):le=e[71],le},"Pe"),Ve=s(()=>{let l=ue(),e=X(),{data:w,error:x}=Ne(te.listWorkflows,{}),[N,b]=(0,i.useState)(""),[a,d]=(0,i.useState)(""),[m,v]=(0,i.useState)(""),[L,S]=(0,i.useState)(!1),[B,C]=(0,i.useState)(null),[O,F]=(0,i.useState)([]),[W,_]=(0,i.useState)(null),R=w!==void 0,g=Array.isArray(w?.workflows)?[...w.workflows].toSorted((r,c)=>r.exportName.localeCompare(c.exportName)):[],y=Fe(g,N),k=g.find(r=>r.exportName===y),A=s(r=>{F(c=>{let o=c.filter($=>!($.exportName===r.exportName&&$.id===r.id));return[r,...o]})},"T"),I=s(async()=>{let r=y;if(r==="")return;let c=ge(m);if(c===null){C(e("Params must be valid JSON"));return}S(!0),C(null);try{let o=a.trim(),$=await l.query(_e,{exportName:r,id:o===""?void 0:o,params:c.value},me(""));A({exportName:r,id:$.id,status:$.status}),d("")}catch(o){C(z(o))}S(!1)},"F"),T=s(()=>{q(I())},"P"),P=s(async(r,c)=>{_(c);try{let o=await l.query(Ee,{exportName:r,id:c},me(""));A({error:o.error,exportName:r,id:o.id,output:o.output,status:o.status})}catch(o){throw _(null),o}_(null)},"O"),E=s(async(r,c)=>{try{await P(r,c)}catch(o){C(z(o))}},"E"),J=s(r=>{b(r.target.value)},"W"),n=s(r=>{d(r.target.value)},"A"),u=s(r=>{v(r.target.value)},"L"),f=s(r=>{let{export:c,id:o}=r.currentTarget.dataset;c!==void 0&&o!==void 0&&q(E(c,o))},"n");return(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[x!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:x}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),R&&g.length===0?(0,t.jsx)(de,{description:e("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:e("No workflows defined")}):(0,t.jsx)(Y,{className:"overflow-hidden py-0",children:(0,t.jsx)(ee,{className:"px-0",children:(0,t.jsxs)(ae,{"data-testid":"workflows-table",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(j,{children:[(0,t.jsx)(h,{children:e("Export")}),(0,t.jsx)(h,{children:e("Name")}),(0,t.jsx)(h,{children:e("Class")})]})}),(0,t.jsx)(ne,{children:g.map(r=>(0,t.jsxs)(j,{"data-testid":`workflows-row-${r.exportName}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:r.exportName}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:r.name}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:r.className})]},r.exportName))})]})})}),g.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:e("Start instance")}),B!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:B}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":e("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:J,value:y,children:g.map(r=>(0,t.jsx)("option",{value:r.exportName,children:r.exportName},r.exportName))}),(0,t.jsx)(ie,{"aria-label":e("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:n,placeholder:e("Instance id (optional)"),value:a}),(0,t.jsx)(U,{"data-testid":"workflows-start-button",disabled:L||y==="",onClick:T,children:e(L?"Starting\u2026":"Start instance")})]}),(0,t.jsx)(we,{"aria-label":e("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:u,placeholder:e("Params (JSON, optional)"),value:m})]}),g.length>0&&(0,t.jsx)(Pe,{eventTypes:w?.eventTypes??[],exportName:y,onSent:P},y),O.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:e("Instances")}),(0,t.jsx)(Y,{className:"overflow-hidden py-0",children:(0,t.jsx)(ee,{className:"px-0",children:(0,t.jsxs)(ae,{"data-testid":"workflows-instances-table",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(j,{children:[(0,t.jsx)(h,{children:e("Workflow")}),(0,t.jsx)(h,{children:e("Instance id")}),(0,t.jsx)(h,{children:e("Status")}),(0,t.jsx)(h,{children:e("Output")}),(0,t.jsx)(h,{})]})}),(0,t.jsx)(ne,{children:O.map(r=>(0,t.jsxs)(j,{"data-testid":`workflows-instance-${r.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:r.exportName}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:r.id}),(0,t.jsx)(p,{className:"font-mono text-xs",children:r.status}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:De(r)}),(0,t.jsx)(p,{children:(0,t.jsx)(U,{"data-export":r.exportName,"data-id":r.id,"data-testid":`workflows-instance-refresh-${r.id}`,disabled:W===r.id,onClick:f,size:"xs",variant:"outline",children:W===r.id?e("Refreshing\u2026"):e("Refresh")})})]},`${r.exportName}:${r.id}`))})]})})})]}),k!==void 0&&(0,t.jsx)(Te,{workflowName:k.name})]})},"Ze");function je(l){return(0,t.jsx)("option",{value:l,children:l},l)}s(je,"De");export{Ve as default};
@@ -0,0 +1 @@
1
+ import{a as C}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as v}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as j}from"./chunk-DSTNWB4N.js";import"./chunk-OSJ7HV7B.js";import"./chunk-6QBK3Z7A.js";import"./chunk-E26OT26O.js";import{a as g}from"./chunk-6UTZXEW3.js";import{c as h}from"./chunk-ZKPRORLI.js";import"./chunk-OIDFWEJX.js";import"./chunk-WZTY3ZYI.js";import{a as $}from"./chunk-3Y5K3IQO.js";import{a as I,b as _,c as q,d as p,e as o,f as i}from"./chunk-CW57Q264.js";import{a as S,e as K}from"./chunk-MD67S53Z.js";import{f as T,w as F}from"./chunk-LPINY2IJ.js";import{a as d,d as k,e as ne,f as oe,g as ie}from"./chunk-OXFKZ4BM.js";var Q=k(oe(),1),G=k(ne(),1);var e=k(ie(),1);var H="agent_threads",de="agent_messages",L="agent_run_queue",J=100,N=250,le={},ce={filters:[],limit:J,offset:0,orderBy:{column:"updatedAt",direction:"desc"},skipCount:!0,table:H},c=d((s,t)=>{let a=s[t];return typeof a=="string"?a:void 0},"c"),B=d((s,t)=>{let a=s[t];return typeof a=="number"?a:void 0},"E"),O=d(s=>{let{usage:t}=s;if(t===null||typeof t!="object")return;let{totalTokens:a}=t;return typeof a=="number"?a:void 0},"H"),me=d(s=>{let{toolCalls:t}=s;return Array.isArray(t)?t.map(a=>a!==null&&typeof a=="object"?a.name:void 0).filter(a=>typeof a=="string"):[]},"de"),ue=d(s=>{switch(s){case"awaiting_input":return"warning";case"cancelled":return"warning";case"error":return"destructive";case"running":return"info";default:return"outline"}},"le"),he=d(s=>{switch(s){case"approved":return"success";case"rejected":return"destructive";default:return"warning"}},"ie"),ge=d(s=>{let t=(0,Q.c)(3),{fetched:a}=s,m=T(),l;return t[0]!==a||t[1]!==m?(l=a<=N?null:(0,e.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"agents-messages-truncated",children:m("Showing the latest {count} messages; older ones are not shown.",{count:N})}),t[0]=a,t[1]=m,t[2]=l):l=t[2],l},"ce"),Te=d(({initialShardKey:s=""})=>{let t=T(),[a,m]=(0,G.useState)(void 0),{data:l}=h(g.listTables,le,{live:!0,shardKey:s}),V=l!==void 0,f=Array.isArray(l)&&l.some(r=>r.name===H),W=Array.isArray(l)&&l.some(r=>r.name===L),{data:E,error:X,errorSource:Y,liveError:Z}=h(g.readTablePage,ce,{enabled:f,live:!0,shardKey:s}),ee={filters:[{column:"threadKey",operator:"eq",value:a??""}],limit:N+1,offset:0,orderBy:{column:"seq",direction:"desc"},skipCount:!0,table:de},{data:P}=h(g.readTablePage,{limit:J,offset:0,orderBy:{column:"position",direction:"asc"},skipCount:!0,table:L},{enabled:W,live:!0,shardKey:s}),{data:U,error:te,errorSource:ae}=h(g.readTablePage,ee,{enabled:f&&a!==void 0,live:!0,shardKey:s}),b=Array.isArray(E?.rows)?E.rows:[],re=Array.isArray(P?.rows)?P.rows:[],z=d(r=>re.filter(n=>c(n,"threadKey")===r).length,"C"),M=Array.isArray(U?.rows)?U.rows:[],R=M.slice(0,N).toReversed(),D=b.find(r=>c(r,"key")===a),x;return V&&!f?x=(0,e.jsx)($,{description:t("No @lunora/agent tables found in this deployment. Add lunora/agents.ts with defineAgent(...) and merge the agent schema extension to run durable AI agents."),testId:"agents-unconfigured",title:t("No agents configured")}):f&&b.length===0?x=(0,e.jsx)($,{description:t("No agent has run yet. Start a run with ctx.agents.<name>.run(...) and its thread appears here."),testId:"agents-empty",title:t("No agent threads yet")}):x=(0,e.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,e.jsx)(S,{className:"overflow-hidden py-0",children:(0,e.jsx)(K,{className:"px-0",children:(0,e.jsxs)(I,{"data-testid":"agents-threads-table",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(o,{children:t("Agent")}),(0,e.jsx)(o,{children:t("Key")}),(0,e.jsx)(o,{children:t("Status")}),(0,e.jsx)(o,{children:t("Queued")}),(0,e.jsx)(o,{children:t("Messages")}),(0,e.jsx)(o,{children:t("Tokens")}),(0,e.jsx)(o,{children:t("Updated")}),(0,e.jsx)(o,{"aria-label":t("Actions")})]})}),(0,e.jsx)(q,{children:b.map(r=>{let n=c(r,"key")??"",u=c(r,"status"),y=O(r);return(0,e.jsxs)(p,{"data-active":n===a?"":void 0,"data-testid":`agents-thread-${n}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:c(r,"agent")??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:n}),(0,e.jsx)(i,{children:(0,e.jsx)(v,{"data-testid":`agents-thread-status-${n}`,variant:ue(u),children:u??"\u2014"})}),(0,e.jsx)(i,{className:"tabular-nums",children:z(n)===0?(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,e.jsx)(v,{"data-testid":`agents-thread-queued-${n}`,variant:"warning",children:z(n)})}),(0,e.jsx)(i,{className:"tabular-nums",children:B(r,"messageCount")??"\u2014"}),(0,e.jsx)(i,{className:"tabular-nums text-muted-foreground",children:y??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:F(B(r,"updatedAt"),"\u2014")}),(0,e.jsx)(i,{className:"text-right",children:(0,e.jsx)(C,{"data-testid":`agents-thread-open-${n}`,onClick:d(()=>{m(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:t("Timeline")})})]},n)})})]})})}),te!==null&&(0,e.jsx)(j,{error:ae,testId:"agents-messages-error"}),a!==void 0&&(0,e.jsx)(S,{className:"overflow-hidden py-0","data-testid":"agents-thread-detail",children:(0,e.jsxs)(K,{className:"flex flex-col gap-3 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t("Timeline")," \xB7 ",a,D!==void 0&&(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",t("Usage"),": ",O(D)??0," ",t("Tokens")]})]}),(0,e.jsx)(C,{"data-testid":"agents-thread-detail-close",onClick:d(()=>{m(void 0)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Close")})]}),(0,e.jsx)(ge,{fetched:M.length}),R.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t("This thread has no messages yet.")}):(0,e.jsxs)(I,{"data-testid":"agents-messages-table",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(o,{children:t("Role")}),(0,e.jsx)(o,{children:t("Content")}),(0,e.jsx)(o,{children:t("Tool")}),(0,e.jsx)(o,{children:t("Approval")})]})}),(0,e.jsx)(q,{children:R.map((r,n)=>{let u=c(r,"role")??"\u2014",y=me(r),se=c(r,"toolName"),w=c(r,"status"),A=B(r,"seq")??n;return(0,e.jsxs)(p,{"data-testid":`agents-message-${String(A)}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs align-top text-muted-foreground",children:u}),(0,e.jsx)(i,{className:"max-w-md font-mono text-xs whitespace-pre-wrap break-words",children:c(r,"content")??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs align-top text-muted-foreground",children:se??(y.length>0?y.join(", "):"\u2014")}),(0,e.jsx)(i,{className:"align-top",children:w===void 0?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"}):(0,e.jsx)(v,{"data-testid":`agents-message-approval-${String(A)}`,variant:he(w),children:w})})]},c(r,"messageKey")??`${u}:${String(A)}`)})})]})]})})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-agents-panel",children:[X!==null&&(0,e.jsx)(j,{error:Y,testId:"agents-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Agents run as durable workflows. Each run persists a thread of assistant and tool messages; select a thread to inspect its timeline, tool calls, approvals, and token usage.")}),Z!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"agents-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")}),x]})},"Ee");export{Te as default};
@@ -0,0 +1 @@
1
+ import{a as i,j as a}from"./chunk-4C4THJUD.js";import{a as o}from"./chunk-WZTY3ZYI.js";import{b as n}from"./chunk-LPINY2IJ.js";import{a as r}from"./chunk-OXFKZ4BM.js";function s(e){return a(e.defaultTagName??"div",e,e)}r(s,"useRender");var g=o("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-none border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive font-mono text-[11px] tracking-wide uppercase focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline",success:"bg-success/10 text-success font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-success/15 dark:bg-success/15",warning:"bg-warning/10 text-warning font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-warning/15 dark:bg-warning/15",info:"bg-info/10 text-info font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-info/15 dark:bg-info/15"}},defaultVariants:{variant:"default"}});function x({className:e,variant:t="default",render:d,...u}){return s({defaultTagName:"span",props:i({className:n(g({variant:t}),e)},u),render:d,state:{slot:"badge",variant:t}})}r(x,"f");export{s as a,x as b};
@@ -0,0 +1 @@
1
+ import{a as c,d as p,e as b,f as v}from"./chunk-OXFKZ4BM.js";var h=p(v(),1),g=p(b(),1);var y=c((a="local")=>{try{return a==="local"?globalThis.localStorage:globalThis.sessionStorage}catch{return}},"d"),S=c(function(a,s="local"){try{let r=y(s)?.getItem(a)??void 0,t=r===void 0?[]:JSON.parse(r);return Array.isArray(t)?t:[]}catch{return[]}},"g"),I=c((a,s,r="local")=>{let t=y(r);if(t!==void 0)try{t.setItem(a,JSON.stringify(s))}catch{}},"I"),A=c((a,s="local")=>{try{y(s)?.removeItem(a)}catch{}},"A"),T=c(function(a,s){let r=(0,h.c)(10),t=s===void 0?"local":s,u;r[0]!==a||r[1]!==t?(u=c(()=>S(a,t),"i"),r[0]=a,r[1]=t,r[2]=u):u=r[2];let[n,f]=(0,g.useState)(u),i=(0,g.useRef)(`${t}:${a}`),e,l;r[3]!==a||r[4]!==t||r[5]!==n?(e=c(()=>{let m=`${t}:${a}`;if(i.current!==m){i.current=m,f(S(a,t));return}I(a,n,t)},"c"),l=[a,t,n],r[3]=a,r[4]=t,r[5]=n,r[6]=e,r[7]=l):(e=r[6],l=r[7]),(0,g.useEffect)(e,l);let o;return r[8]!==n?(o=[n,f],r[8]=n,r[9]=o):o=r[9],o},"J"),J=c(function(a,s,r){let t=(0,h.c)(6),u="local",[n,f]=T(a,u),i;t[0]!==s||t[1]!==f?(i=c(m=>{f($=>{let d=$[0]??s;return[typeof m=="function"?m(d):m]})},"a"),t[0]=s,t[1]=f,t[2]=i):i=t[2];let e=i,l=n[0]??s,o;return t[3]!==e||t[4]!==l?(o=[l,e],t[3]=e,t[4]=l,t[5]=o):o=t[5],o},"O"),O=c(a=>globalThis.crypto?.randomUUID?.()??`${a}-${globalThis.performance.now().toString(36)}`,"V");export{y as a,S as b,I as c,A as d,T as e,J as f,O as g};
@@ -0,0 +1 @@
1
+ import{a as s}from"./chunk-ZKPRORLI.js";import{a as n}from"./chunk-OXFKZ4BM.js";var b="__lunora_admin__:",g=new Set(["action","mutation","query"]),c=Symbol("lunora.operationSeq"),_=n(t=>{if(typeof t!="object"||t===null)return;let e=t[c];return typeof e=="number"?e:void 0},"g"),d=n((t,e)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,c,{configurable:!0,enumerable:!1,value:e,writable:!0})}catch{}},"h"),m=n(t=>{if(typeof t!="object"||t===null)return;let e=t.__lunoraRef;return typeof e=="string"&&e.startsWith(b)?e:void 0},"p"),h=n(t=>{if(typeof t!="object"||t===null)return"";let{shardKey:e}=t;return typeof e=="string"?e:""},"O"),w=n(t=>new Proxy(t,{get(e,u,y){let i=Reflect.get(e,u,y);if(typeof i!="function"||typeof u!="string"||!g.has(u))return typeof i=="function"?i.bind(e):i;let f=i;return async(...o)=>{let l=m(o[0]);if(l===void 0)return f.apply(e,o);let p=typeof o[1]=="object"&&o[1]!==null?o[1]:{},a=s.start(l,p,h(o[2]));try{let r=await f.apply(e,o);return s.settle(a,{result:r}),r}catch(r){throw s.settle(a,{error:r instanceof Error?r.message:String(r)}),d(r,a),r}}}}),"E");export{_ as a,w as b};
@@ -0,0 +1 @@
1
+ import{a as i,d as m,e as v,f as b}from"./chunk-OXFKZ4BM.js";var n=m(b(),1),r=m(v(),1);var x=i(function(t,a,s){let e=(0,n.c)(4),o=a===void 0?300:a,[d,f]=(0,r.useState)(t),[p,l]=(0,r.useState)(s);s!==void 0&&s!==p&&(l(s),f(t));let u,c;return e[0]!==o||e[1]!==t?(u=i(()=>{let T=setTimeout(()=>{f(t)},o);return()=>{clearTimeout(T)}},"c"),c=[t,o],e[0]=o,e[1]=t,e[2]=u,e[3]=c):(u=e[2],c=e[3]),(0,r.useEffect)(u,c),d},"T");export{x as a};
@@ -0,0 +1 @@
1
+ var _={aiAvailable:"__lunora_admin__:aiAvailable",aiChartConfig:"__lunora_admin__:aiChartConfig",aiGenerateSql:"__lunora_admin__:aiGenerateSql",aiTableFilter:"__lunora_admin__:aiTableFilter",assignIssue:"__lunora_admin__:assignIssue",backRelationCounts:"__lunora_admin__:backRelationCounts",clearCapturedMail:"__lunora_admin__:clearCapturedMail",clearQueueMessages:"__lunora_admin__:clearQueueMessages",clearTable:"__lunora_admin__:clearTable",createWorkflowInstance:"__lunora_admin__:createWorkflowInstance",deleteRows:"__lunora_admin__:deleteRows",describeTable:"__lunora_admin__:describeTable",describeTables:"__lunora_admin__:describeTables",explainIssue:"__lunora_admin__:explainIssue",exportShard:"__lunora_admin__:exportShard",facetColumn:"__lunora_admin__:facetColumn",getAdvisories:"__lunora_admin__:getAdvisories",getAdvisorProcedures:"__lunora_admin__:getAdvisorProcedures",getAuditLog:"__lunora_admin__:getAuditLog",getAuthAuditLog:"__lunora_admin__:getAuthAuditLog",getAuthMetrics:"__lunora_admin__:getAuthMetrics",getCapturedMail:"__lunora_admin__:getCapturedMail",getFanoutMetrics:"__lunora_admin__:getFanoutMetrics",getFunctionStats:"__lunora_admin__:getFunctionStats",getIssues:"__lunora_admin__:getIssues",lintSql:"__lunora_admin__:lintSql",listFlags:"__lunora_admin__:listFlags",listReactors:"__lunora_admin__:listReactors",listPushSubscriptions:"__lunora_admin__:listPushSubscriptions",listQueues:"__lunora_admin__:listQueues",listSubscriptions:"__lunora_admin__:listSubscriptions",listTableIndexes:"__lunora_admin__:listTableIndexes",listTablesIndexes:"__lunora_admin__:listTablesIndexes",listWorkflows:"__lunora_admin__:listWorkflows",getLogs:"__lunora_admin__:getLogs",getMetricHistory:"__lunora_admin__:getMetricHistory",getMetricSeries:"__lunora_admin__:getMetricSeries",getMetrics:"__lunora_admin__:getMetrics",getPitrBookmark:"__lunora_admin__:getPitrBookmark",getQueryInsights:"__lunora_admin__:getQueryInsights",getQueueMessages:"__lunora_admin__:getQueueMessages",getRequestLog:"__lunora_admin__:getRequestLog",getSecurityAudit:"__lunora_admin__:getSecurityAudit",getSettings:"__lunora_admin__:getSettings",getTraces:"__lunora_admin__:getTraces",getWorkflowInstanceStatus:"__lunora_admin__:getWorkflowInstanceStatus",ignoreIssue:"__lunora_admin__:ignoreIssue",importShard:"__lunora_admin__:importShard",listTables:"__lunora_admin__:listTables",maskPolicies:"__lunora_admin__:maskPolicies",migrationStatus:"__lunora_admin__:migrationStatus",patchRows:"__lunora_admin__:patchRows",pitrRestore:"__lunora_admin__:pitrRestore",readTablePage:"__lunora_admin__:readTablePage",replayQueueMessage:"__lunora_admin__:replayQueueMessage",resolveIssue:"__lunora_admin__:resolveIssue",rlsPolicies:"__lunora_admin__:rlsPolicies",schemaHistory:"__lunora_admin__:schemaHistory",schemaVersion:"__lunora_admin__:schemaVersion",runAs:"__lunora_admin__:runAs",runMigration:"__lunora_admin__:runMigration",runSql:"__lunora_admin__:runSql",sendQueueMessage:"__lunora_admin__:sendQueueMessage",sendTestMail:"__lunora_admin__:sendTestMail",sendWorkflowEvent:"__lunora_admin__:sendWorkflowEvent",setIssueSeverity:"__lunora_admin__:setIssueSeverity",storageOrphans:"__lunora_admin__:storageOrphans",storageReferences:"__lunora_admin__:storageReferences",storageRules:"__lunora_admin__:storageRules",studioFeatures:"__lunora_admin__:studioFeatures",writeRow:"__lunora_admin__:writeRow"};export{_ as a};
@@ -0,0 +1 @@
1
+ import{a as v}from"./chunk-AOHKAKKL.js";import{a as Q}from"./chunk-W4X4J7BU.js";import{a as L}from"./chunk-5DNGK3NT.js";import{a as G}from"./chunk-KYONGQQ4.js";import"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import"./chunk-ZBON5T5A.js";import{b as $}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as W}from"./chunk-DSTNWB4N.js";import"./chunk-OSJ7HV7B.js";import"./chunk-6QBK3Z7A.js";import"./chunk-E26OT26O.js";import{a as E}from"./chunk-6UTZXEW3.js";import{c as B}from"./chunk-ZKPRORLI.js";import"./chunk-OIDFWEJX.js";import"./chunk-WZTY3ZYI.js";import{a as A}from"./chunk-3Y5K3IQO.js";import{a as q,b as H,c as O,d as K,e as T,f as D}from"./chunk-CW57Q264.js";import{a as _}from"./chunk-MD67S53Z.js";import{f as j}from"./chunk-LPINY2IJ.js";import{a as S,d as F,f as J,g as V}from"./chunk-OXFKZ4BM.js";var R=F(J(),1);var t=F(V(),1);var U=S(c=>`${c.toString()} ms`,"D"),X=S(c=>c.totalConnections===0&&c.shapePoke.passes===0&&c.whisper.passes===0&&c.shapeProbe.run===0&&c.shapeProbe.served===0&&c.globalPoll.drains===0&&c.globalPoll.pairsSkipped===0,"J"),z=S(c=>{let e=(0,R.c)(48),{counters:o,includeTiming:a,prefix:r,t:l,title:u}=c,d=`${r}-section`,n;e[0]!==u?(n=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:u}),e[0]=u,e[1]=n):n=e[1];let s=`${r}-stats`,i;e[2]!==l?(i=l("Passes"),e[2]=l,e[3]=i):i=e[3];let m=`${r}-passes`,I;e[4]!==o.passes||e[5]!==i||e[6]!==m?(I=(0,t.jsx)(v,{label:i,testId:m,value:o.passes}),e[4]=o.passes,e[5]=i,e[6]=m,e[7]=I):I=e[7];let g;e[8]!==l?(g=l("Sockets iterated"),e[8]=l,e[9]=g):g=e[9];let k=`${r}-iterated`,p;e[10]!==o.socketsIterated||e[11]!==g||e[12]!==k?(p=(0,t.jsx)(v,{label:g,testId:k,value:o.socketsIterated}),e[10]=o.socketsIterated,e[11]=g,e[12]=k,e[13]=p):p=e[13];let f;e[14]!==l?(f=l("Delivered"),e[14]=l,e[15]=f):f=e[15];let y=`${r}-delivered`,h;e[16]!==o.socketsDelivered||e[17]!==f||e[18]!==y?(h=(0,t.jsx)(v,{label:f,testId:y,value:o.socketsDelivered}),e[16]=o.socketsDelivered,e[17]=f,e[18]=y,e[19]=h):h=e[19];let x;e[20]!==l?(x=l("Peak width"),e[20]=l,e[21]=x):x=e[21];let N=`${r}-peak`,b;e[22]!==o.peakSocketsIterated||e[23]!==x||e[24]!==N?(b=(0,t.jsx)(v,{label:x,testId:N,value:o.peakSocketsIterated}),e[22]=o.peakSocketsIterated,e[23]=x,e[24]=N,e[25]=b):b=e[25];let C;e[26]!==o.totalMs||e[27]!==a||e[28]!==r||e[29]!==l?(C=a&&(0,t.jsx)(v,{label:l("Total time"),testId:`${r}-total-ms`,value:U(o.totalMs)}),e[26]=o.totalMs,e[27]=a,e[28]=r,e[29]=l,e[30]=C):C=e[30];let P;e[31]!==o.maxMs||e[32]!==a||e[33]!==r||e[34]!==l?(P=a&&(0,t.jsx)(v,{label:l("Max time"),testId:`${r}-max-ms`,value:U(o.maxMs)}),e[31]=o.maxMs,e[32]=a,e[33]=r,e[34]=l,e[35]=P):P=e[35];let M;e[36]!==h||e[37]!==b||e[38]!==C||e[39]!==P||e[40]!==s||e[41]!==I||e[42]!==p?(M=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":s,children:[I,p,h,b,C,P]}),e[36]=h,e[37]=b,e[38]=C,e[39]=P,e[40]=s,e[41]=I,e[42]=p,e[43]=M):M=e[43];let w;return e[44]!==d||e[45]!==M||e[46]!==n?(w=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":d,children:[n,M]}),e[44]=d,e[45]=M,e[46]=n,e[47]=w):w=e[47],w},"F"),Y=S(c=>{let e=(0,R.c)(20),{counters:o,t:a}=c,r;e[0]!==a?(r=a("Membership probes"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let u;e[4]!==a?(u=a("Queries run"),e[4]=a,e[5]=u):u=e[5];let d;e[6]!==o.run||e[7]!==u?(d=(0,t.jsx)(v,{label:u,testId:"fanout-probe-run",value:o.run}),e[6]=o.run,e[7]=u,e[8]=d):d=e[8];let n;e[9]!==a?(n=a("Shared from cache"),e[9]=a,e[10]=n):n=e[10];let s;e[11]!==o.served||e[12]!==n?(s=(0,t.jsx)(v,{label:n,testId:"fanout-probe-served",value:o.served}),e[11]=o.served,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==d||e[15]!==s?(i=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-probe-stats",children:[d,s]}),e[14]=d,e[15]=s,e[16]=i):i=e[16];let m;return e[17]!==l||e[18]!==i?(m=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-probe-section",children:[l,i]}),e[17]=l,e[18]=i,e[19]=m):m=e[19],m},"V"),Z=S(c=>{let e=(0,R.c)(20),{counters:o,t:a}=c,r;e[0]!==a?(r=a("Global shape polls"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let u;e[4]!==a?(u=a("Global reads"),e[4]=a,e[5]=u):u=e[5];let d;e[6]!==o.drains||e[7]!==u?(d=(0,t.jsx)(v,{label:u,testId:"fanout-global-poll-drains",value:o.drains}),e[6]=o.drains,e[7]=u,e[8]=d):d=e[8];let n;e[9]!==a?(n=a("Pairs skipped"),e[9]=a,e[10]=n):n=e[10];let s;e[11]!==o.pairsSkipped||e[12]!==n?(s=(0,t.jsx)(v,{label:n,testId:"fanout-global-poll-pairs-skipped",value:o.pairsSkipped}),e[11]=o.pairsSkipped,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==d||e[15]!==s?(i=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-global-poll-stats",children:[d,s]}),e[14]=d,e[15]=s,e[16]=i):i=e[16];let m;return e[17]!==l||e[18]!==i?(m=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-global-poll-section",children:[l,i]}),e[17]=l,e[18]=i,e[19]=m):m=e[19],m},"X"),pe=S(c=>{let e=(0,R.c)(31),{initialShardKey:o}=c,a=j(),{queryShardKey:r,setShardKey:l,shardKey:u}=L(o),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d={},e[0]=d):d=e[0];let n;e[1]!==r?(n={keepPreviousData:!0,shardKey:r},e[1]=r,e[2]=n):n=e[2];let{data:s,error:i,errorSource:m,poll:I}=B(E.getFanoutMetrics,d,n);Q(I,!0);let g;e[3]!==s?(g=s!==void 0&&X(s),e[3]=s,e[4]=g):g=e[4];let k=g,p;e[5]!==l||e[6]!==u?(p=(0,t.jsx)(G,{onChange:l,testId:"fanout-shard-input",value:u}),e[5]=l,e[6]=u,e[7]=p):p=e[7];let f;e[8]!==s||e[9]!==a?(f=s!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[s.promoted&&(0,t.jsx)($,{"data-testid":"fanout-promoted",variant:s.relayCount>=s.maxRelays?"destructive":"default",children:s.relayCount>=s.maxRelays?a("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:s.maxRelays,relayCount:s.relayCount}):a("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:s.maxRelays,relayCount:s.relayCount})}),(0,t.jsx)($,{variant:"secondary",children:a("{count} connections",{count:s.totalConnections})}),(0,t.jsx)($,{variant:"secondary",children:a("peak {count} subscribers",{count:s.peakSubscribers})})]}),e[8]=s,e[9]=a,e[10]=f):f=e[10];let y;e[11]!==p||e[12]!==f?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p,f]}),e[11]=p,e[12]=f,e[13]=y):y=e[13];let h;e[14]!==i||e[15]!==m?(h=i!==null&&(0,t.jsx)(W,{error:m,testId:"fanout-error"}),e[14]=i,e[15]=m,e[16]=h):h=e[16];let x;e[17]!==i||e[18]!==k||e[19]!==a?(x=i===null&&k&&(0,t.jsx)(A,{description:a("Realtime fan-out cost and per-topic subscriber counts for this shard."),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 12h4l3 7 4-14 3 7h2"})}),testId:"fanout-empty",title:a("No fan-out activity yet.")}),e[17]=i,e[18]=k,e[19]=a,e[20]=x):x=e[20];let N;e[21]!==i||e[22]!==k||e[23]!==s||e[24]!==a?(N=i===null&&s!==void 0&&!k&&(0,t.jsxs)(t.Fragment,{children:[s.topics.length>0&&(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:a("Hot topics")}),(0,t.jsx)(_,{className:"overflow-hidden py-0",children:(0,t.jsxs)(q,{"data-testid":"fanout-topics-table",children:[(0,t.jsx)(H,{children:(0,t.jsxs)(K,{children:[(0,t.jsx)(T,{children:a("Topic")}),(0,t.jsx)(T,{children:a("Kind")}),(0,t.jsx)(T,{className:"text-right",children:a("Subscribers")})]})}),(0,t.jsx)(O,{children:s.topics.map(ee)})]})})]}),(0,t.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,t.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:a("Fan-out cost since this instance woke")}),(0,t.jsx)(z,{counters:s.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:a,title:a("Shape pokes")}),(0,t.jsx)(z,{counters:s.whisper,includeTiming:!1,prefix:"fanout-whisper",t:a,title:a("Whisper broadcasts")}),(0,t.jsx)(Y,{counters:s.shapeProbe,t:a}),(0,t.jsx)(Z,{counters:s.globalPoll,t:a})]})]}),e[21]=i,e[22]=k,e[23]=s,e[24]=a,e[25]=N):N=e[25];let b;return e[26]!==y||e[27]!==h||e[28]!==x||e[29]!==N?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[y,h,x,N]}),e[26]=y,e[27]=h,e[28]=x,e[29]=N,e[30]=b):b=e[30],b},"me");function ee(c){return(0,t.jsxs)(K,{"data-testid":"fanout-topic-row",children:[(0,t.jsx)(D,{className:"font-mono text-xs",children:c.topic}),(0,t.jsx)(D,{children:(0,t.jsx)($,{variant:"outline",children:c.kind})}),(0,t.jsx)(D,{className:"text-right font-medium tabular-nums",children:c.subscribers})]},`${c.kind}:${c.topic}`)}S(ee,"Y");export{pe as default};
@@ -0,0 +1 @@
1
+ import{a as d,d as n,f as c,g as p}from"./chunk-OXFKZ4BM.js";var b=n(c(),1),s=n(p(),1);var y={alignItems:"center",border:"1px solid",borderRadius:4,display:"inline-flex",fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:11,fontWeight:400,gap:6,letterSpacing:"0.06em",lineHeight:1.4,padding:"1px 8px",textTransform:"uppercase"},g={borderRadius:"50%",display:"inline-block",height:7,width:7},h=d((l,e,t,a)=>({badgeStyle:{...y,borderColor:l,color:l},color:l,dotStyle:{...g,backgroundColor:l},hint:a,label:e,title:t}),"i"),S={global:h("var(--royal-amethyst)","Global \xB7 D1","Global table \u2014 a single D1 table shared across all shards","Declared .global() and stored once in Cloudflare D1, shared across every shard and tenant. Auth tables (user, session, \u2026) live here too."),shard:h("var(--sky-sapphire)","Shard-local","Shard-local table \u2014 per-shard SQLite inside a Durable Object","Stored per shard key in a Durable Object's SQLite (.shardBy(...)). You are viewing one shard at a time \u2014 change the shard key to inspect another.")},m=d(l=>{let e=(0,b.c)(9),{tier:t}=l,a=S[t],i=`storage-tier-${t}`,r;e[0]!==a.dotStyle?(r=(0,s.jsx)("span",{"aria-hidden":"true",style:a.dotStyle}),e[0]=a.dotStyle,e[1]=r):r=e[1];let o;return e[2]!==a.badgeStyle||e[3]!==a.label||e[4]!==a.title||e[5]!==i||e[6]!==r||e[7]!==t?(o=(0,s.jsxs)("span",{"data-testid":i,"data-tier":t,style:a.badgeStyle,title:a.title,children:[r,a.label]}),e[2]=a.badgeStyle,e[3]=a.label,e[4]=a.title,e[5]=i,e[6]=r,e[7]=t,e[8]=o):o=e[8],o},"y");export{S as a,m as b};
@@ -0,0 +1 @@
1
+ import{a as n,d as E,e as S,g as m}from"./chunk-OXFKZ4BM.js";function u(t,e=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(e,Math.min(t,r))}n(u,"clamp");var p=1;function x(t,e){return Math.max(0,t-e)}n(x,"getMaxScrollOffset");function A(t,e){if(e<=0)return 0;let r=u(t,0,e),l=r,c=e-r,a=l<=p,i=c<=p;return a&&i?l<=c?0:e:a?0:i?e:r}n(A,"normalizeScrollOffset");var f=E(m(),1),o="base-ui-disable-scrollbar",R={className:o,getElement(t){return(0,f.jsx)("style",{nonce:t,href:o,precedence:"base-ui:low",children:`.${o}{scrollbar-width:none}.${o}::-webkit-scrollbar{display:none}`})}};var s=E(S(),1);var b=s.createContext(void 0),C={disableStyleElements:!1};function y(){return s.useContext(b)??C}n(y,"useCSPContext");export{u as a,p as b,x as c,A as d,R as e,y as f};
@@ -0,0 +1,15 @@
1
+ import{a as Fe,b as Ke}from"./chunk-TBDJVYCB.js";import"./chunk-BTOOJXUL.js";import{a as We}from"./chunk-3MQ477EE.js";import{d as He}from"./chunk-DS7HZKZ2.js";import"./chunk-SYGCASPT.js";import"./chunk-CTE6RPXC.js";import"./chunk-LIGOLZND.js";import"./chunk-3GXPALXG.js";import"./chunk-NMVFSJM7.js";import"./chunk-AP4PC2M4.js";import"./chunk-KRPXOSBL.js";import"./chunk-W2BCSK5S.js";import{a as ze}from"./chunk-6QEXGYWH.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import"./chunk-ZGSL4DPP.js";import"./chunk-ZWDORIZY.js";import{a as Pe}from"./chunk-KYONGQQ4.js";import{b as Oe}from"./chunk-SLIDAWNX.js";import{c as $e,d as pe,e as ve,f as ye,g as Ee}from"./chunk-6M7FLLMT.js";import"./chunk-ZTOREMGH.js";import{i as qe}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import{a as je}from"./chunk-OSJ7HV7B.js";import{a as he}from"./chunk-6UTZXEW3.js";import"./chunk-ZKPRORLI.js";import{p as xe}from"./chunk-OIDFWEJX.js";import"./chunk-WZTY3ZYI.js";import"./chunk-CW57Q264.js";import{b as ie,f as se,h as me,i as fe,j as Ae,s as ae}from"./chunk-LPINY2IJ.js";import{a as i,d as ke,e as ct,f as dt,g as ut}from"./chunk-OXFKZ4BM.js";var X=ke(dt(),1),j=ke(ct(),1);var u=ke(ut(),1);var be=class{static{i(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),d=this.removeEmpty(this.tokenize(r,t)),a=this.removeEmpty(this.tokenize(l,t));return this.diffWithOptionsObj(d,a,t,o)}diffWithOptionsObj(e,n,t,o){var r;let l=i(h=>{if(h=this.postProcess(h,t),o){setTimeout(function(){o(h)},0);return}else return h},"done"),d=n.length,a=e.length,c=1,m=d+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,v=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(v[0],n,e,0,t);if(v[0].oldPos+1>=a&&g+1>=d)return l(this.buildValues(v[0].lastComponent,n,e));let E=-1/0,x=1/0,y=i(()=>{for(let h=Math.max(E,-c);h<=Math.min(x,c);h+=2){let S,w=v[h-1],C=v[h+1];w&&(v[h-1]=void 0);let b=!1;if(C){let N=C.oldPos-h;b=C&&0<=N&&N<d}let k=w&&w.oldPos+1<a;if(!b&&!k){v[h]=void 0;continue}if(!k||b&&w.oldPos<C.oldPos?S=this.addToPath(C,!0,!1,0,t):S=this.addToPath(w,!1,!0,1,t),g=this.extractCommon(S,n,e,h,t),S.oldPos+1>=a&&g+1>=d)return l(this.buildValues(S.lastComponent,n,e))||!0;v[h]=S,S.oldPos+1>=a&&(x=Math.min(x,h-1)),g+1>=d&&(E=Math.max(E,h+1))}c++},"execEditLength");if(o)i(function h(){setTimeout(function(){if(c>m||Date.now()>f)return o(void 0);y()||h()},0)},"exec")();else for(;c<=m&&Date.now()<=f;){let h=y();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,d=t.length,a=e.oldPos,c=a-o,m=0;for(;c+1<l&&a+1<d&&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,d=0,a=0,c=0;for(;d<l;d++){let m=o[d];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,v){let g=t[c+v];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 Te=class extends be{static{i(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=mt}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)}},Be=new Te;function Ie(s,e,n){return Be.diff(s,e,n)}i(Ie,"diffLines");function mt(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}i(mt,"tokenize");var ft="x",Qe=" ",ht={'"':'"',"'":"'","[":"]","`":"`"},Ue=i((s,e)=>{let n=e+2;for(;n<s.length&&s[n]!==`
7
+ `;)n+=1;return n},"He"),Xe=i((s,e)=>{let n=s.indexOf("*/",e+2);return n===-1?-1:n+2},"Fe"),Ze=i(s=>{let e=s.split(""),n=0;for(;n<s.length;){let t=s[n]??"",o=ht[t];if(t==="-"&&s[n+1]==="-"){let r=Ue(s,n);e.fill(Qe,n,r),n=r}else if(t==="/"&&s[n+1]==="*"){let r=Xe(s,n);if(r===-1)return;e.fill(Qe,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(ft,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("")},"We"),pt=/^(?:explain\s+(?:query\s+plan\s+)?)?(?:select|with)\b/iu,bt=/\b(?:alter|attach|create|delete|detach|drop|insert|pragma|reindex|truncate|update|vacuum)\b|\breplace\b(?!\s*\()/iu,gt=/^\w+/u,xt=/;\s*$/u,vt=/\s/u,et=i(s=>{let e=0;for(;e<s.length;){let n=s[e];if(n!==void 0&&vt.test(n))e+=1;else if(n==="-"&&s[e+1]==="-")e=Ue(s,e);else if(n==="/"&&s[e+1]==="*"){let t=Xe(s,e);if(t===-1)break;e=t}else break}return e},"Ke"),yt=i(s=>{let e=et(s),n=s.slice(e).trimEnd();if(n==="")return{code:"SQL_EMPTY",message:"the query is empty"};let t=(Ze(n)??n).replace(xt,""),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(!pt.test(o))return{code:"SQL_NOT_READONLY",length:gt.exec(o)?.[0].length??1,message:l,offset:e};let d=bt.exec(o);if(d!==null)return{code:"SQL_NOT_READONLY",length:d[0].length,message:`${l} (\`${d[0].toUpperCase()}\` is not allowed)`,offset:e+d.index}},"xt"),wt=/^explain\b/iu,St=i(s=>wt.test(s.slice(et(s)))?s:`EXPLAIN QUERY PLAN ${s}`,"yt"),_e=i((s,e)=>{let n=s.trim();if(n==="")return[];let t=e+s.indexOf(n),o=yt(n);return o?.code==="SQL_EMPTY"?[]:[o===void 0?{offset:t,sql:n}:{offset:t,rejection:o,sql:n}]},"ke"),tt=i(s=>{let e=Ze(s);if(e===void 0)return _e(s,0);let n=[],t=0;for(let o=0;o<=e.length;o+=1)o!==e.length&&e[o]!==";"||(n.push(..._e(s.slice(t,o),t)),t=o+1);return n},"ze"),Ct=["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"],Nt=["FROM","WHERE","ORDER BY","GROUP BY","HAVING","LIMIT","OFFSET","UNION","JOIN","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN"],Ne=String.fromCodePoint(0),kt=new RegExp(`${Ne}${String.raw`(\d+)`}${Ne}`,"gu"),qt=Ct.map(s=>({pattern:new RegExp(String.raw`\b${s.replaceAll(" ",String.raw`\s+`)}\b`,"giu"),replacement:s})),Et=Nt.map(s=>({pattern:new RegExp(String.raw`\s+${s.replaceAll(" ",String.raw`\s+`)}\b`,"gu"),replacement:`
10
+ ${s}`})),Tt=i(s=>{let e=[],n=s.replaceAll(/'(?:[^']|'')*'/gu,t=>(e.push(t),`${Ne}${(e.length-1).toString()}${Ne}`)).replaceAll(/\s+/gu," ").trim();for(let{pattern:t,replacement:o}of qt)n=n.replaceAll(t,o);for(let{pattern:t,replacement:o}of Et)n=n.replaceAll(t,o);return n=n.replaceAll(kt,(t,o)=>e[Number(o)]??""),n},"kt"),It=/\b(?:from|join)\s+([a-z_][\w$]*)(?:\s+(?:as\s+)?([a-z_][\w$]*))?/giu,Lt=/(?:\bwith\s+(?:recursive\s+)?|,\s*)([a-z_][\w$]*)\s+as\s*\(/giu,_t=new Set(["cross","full","group","having","inner","join","left","limit","offset","on","order","right","union","using","where","window"]),Rt=/[^\n]/gu,Dt=i((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},"_t"),Mt=i(s=>{let e="",n=0;for(;n<s.length;){let t=Dt(s,n);t===-1?(e+=s.slice(n,n+1),n+=1):(e+=s.slice(n,t).replaceAll(Rt," "),n=t)}return e},"At"),At=i(s=>{let e=new Set;for(let n of s.matchAll(Lt))e.add((n[1]??"").toLowerCase());return e},"qt"),$t=i((s,e)=>{let n=new Map;for(let t of s.matchAll(It)){let o=(t[1]??"").toLowerCase(),r=(t[2]??"").toLowerCase();e.has(o)&&(n.set(o,o),r!==""&&!_t.has(r)&&n.set(r,o))}return n},"Dt"),nt=i((s,e)=>{let n=Mt(s),t=new Set(e.map(o=>o.toLowerCase()));return{ctes:At(n),masked:n,targets:$t(n,t)}},"Ue"),Ot=/^(?:__lunora|sqlite_)/iu,Pt=/\b(?:from|join)\s+([a-z_][\w$]*)/giu,jt=/\b([a-z_][\w$]*)\.([a-z_][\w$]*)/giu,zt=new Set(["cross","full","group","having","inner","join","lateral","left","limit","offset","order","right","select","union","where","window"]),Wt=i((s,e,n)=>{let t=[];for(let o of s.matchAll(Pt)){let r=o[1]??"",l=r.toLowerCase();!e.has(l)&&!n.has(l)&&!zt.has(l)&&!Ot.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},"Pt"),Ht=i((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(d=>d.toLowerCase())));for(let r of s.matchAll(jt)){let l=(r[1]??"").toLowerCase(),d=r[2]??"",a=n.get(l),c=a===void 0?void 0:o.get(a);c!==void 0&&!c.has(d.toLowerCase())&&t.push({length:d.length,message:`\`${a??""}\` has no column \`${d}\``,offset:r.index+r[0].length-d.length,severity:"error",source:"schema"})}return t},"Ht"),Ft=/(?<![\w$."])(?:"([a-z_][\w$]*)"|([a-z_][\w$]*))(?![.(])/giu,Kt=/\bas\s+"?([a-z_][\w$]*)"?/giu,Bt=i((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 d=new Set([...s.matchAll(Kt)].map(c=>(c[1]??"").toLowerCase())),a=[];for(let c of s.matchAll(Ft)){let m=c[1],p=m??c[2]??"",f=p.toLowerCase(),v=r.get(f);v===void 0||l.has(f)||d.has(f)||t.has(f)||n.has(f)||a.push({length:p.length,message:`\`${v}\` is a \`__doc__\` field, not a column \u2014 use \`json_extract(__doc__, '$.${v}')\``,offset:c.index+(m===void 0?0:1),severity:"error",source:"schema"})}return a},"Kt"),Qt=i((s,e)=>{if(s.trim()==="")return[];let n=tt(s),t=new Set(e.tables.map(r=>r.toLowerCase())),o=[];for(let r of n){let{offset:l,rejection:d}=r;if(d!==void 0){o.push({length:d.length,message:d.message,offset:d.offset===void 0?l:l+d.offset,severity:"error",source:"gate"});continue}let{ctes:a,masked:c,targets:m}=nt(r.sql,e.tables);o.push(...[...Wt(c,t,a),...Ht(c,e,m),...Bt(c,e,m,a)].map(p=>({...p,offset:p.offset===void 0?l:l+p.offset})))}return o},"zt"),Yt=me(he.lintSql),Jt=600,Vt=i((s,e,n)=>{let t=xe(),[o,r]=(0,j.useState)([]),l=(0,j.useMemo)(()=>Qt(s,e),[s,e]),d=ze(s,Jt),a=l.some(p=>p.source==="gate")||d.trim()==="",c=(0,j.useCallback)(async p=>{try{let f=await t.query(Yt,{sql:d},fe(n));p.cancelled||r(f.diagnostics??[])}catch{p.cancelled||r([])}},[t,d,n]);(0,j.useEffect)(()=>{if(a){r([]);return}let p={cancelled:!1};return ae(c(p)),()=>{p.cancelled=!0}},[c,a]);let m=d===s;return(0,j.useMemo)(()=>m?[...l,...o]:l,[l,o,m])},"Qt"),we=8,Gt=["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"],Ut=new Set(["AND","BY","HAVING","ON","OR","SELECT","WHERE"]),Xt=/[\w$]/,ot=i(s=>s!==void 0&&Xt.test(s),"je"),rt=i(s=>{let e=s.length;for(;e>0&&ot(s[e-1]);)e-=1;return s.slice(e)},"Qe"),st=i((s,e)=>{let n=e;for(;n>0&&ot(s[n-1]);)n-=1;return{end:e,start:n,text:s.slice(n,e)}},"Ye"),Ye=i((s,e)=>{let n=s.slice(0,e).trimEnd();return n.endsWith(".")||Ut.has(rt(n).toUpperCase())},"De"),Zt=i((s,e,n)=>{let t=s.slice(0,e);if(!t.endsWith("."))return;let o=rt(t.slice(0,-1));if(o!=="")return nt(s,n).targets.get(o.toLowerCase())??o},"Vt"),Re=i((s,e)=>s.toLowerCase().startsWith(e.toLowerCase()),"Ie"),Je=i((s,e,n,t)=>{let o=[];for(let r of s)if(Re(r,e)&&(o.push(t(r)),o.length>=n))break;return o},"Oe"),en=i((s,e,n)=>{let t=new Map;for(let[o,r]of Object.entries(s.columns))for(let l of r)if(Re(l,e)&&!t.has(l)&&(t.set(l,o),t.size>=n))return[...t].map(([d,a])=>({detail:a,kind:"column",label:d}));return[...t].map(([o,r])=>({detail:r,kind:"column",label:o}))},"Xt"),tn=i((s,e,n)=>{let t=st(s,e),o=Zt(s,t.start,n.tables);if(o!==void 0){let a=n.columns[o]??n.columns[o.toLowerCase()]??[];return Je(a,t.text,we,c=>({detail:o,kind:"column",label:c}))}if(t.text===""&&!Ye(s,t.start))return[];let r=Je(n.tables,t.text,we,a=>({kind:"table",label:a})),l=en(n,t.text,we),d=Gt.flatMap(a=>t.text!==""&&Re(a,t.text)&&a.toLowerCase()!==t.text.toLowerCase()?[{kind:"keyword",label:a}]:[]);return(Ye(s,t.start)?[...l,...r,...d]:[...r,...l,...d]).slice(0,we)},"Zt"),nn=i((s,e,n)=>{let t=st(s,e),o=s.slice(0,t.start)+n.label+s.slice(t.end);return{caret:t.start+n.label.length,value:o}},"en"),on=["boxSizing","borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textTransform","width","wordSpacing"],rn=i((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 on)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,d=r.offsetTop-s.scrollTop;return t.remove(),{left:l,top:d}},"nn"),sn=i((s,e,n)=>{let t=(0,X.c)(16),[o,r]=(0,j.useState)(null),l;t[0]!==s||t[1]!==e?(l=i((y,h)=>{let S=tn(y,h,s);if(S.length===0){r(null);return}let w=e.current,{left:C,top:b}=w===null?{left:0,top:0}:rn(w,h);r(k=>k!==null&&k.active===0&&k.left===C&&k.top===b&&k.suggestions.length===S.length&&k.suggestions.every((N,R)=>{let q=S.at(R);return N.kind===q?.kind&&N.label===q.label&&N.detail===q.detail})?k:{active:0,left:C,suggestions:S,top:b})},"r"),t[0]=s,t[1]=e,t[2]=l):l=t[2];let d=l,a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=i(()=>{r(null)},"a"),t[3]=a):a=t[3];let c=a,m;t[4]===Symbol.for("react.memo_cache_sentinel")?(m=i(y=>{r(h=>{if(h===null)return h;let S=h.suggestions.length,w=(h.active+y+S)%S;return{...h,active:w}})},"u"),t[4]=m):m=t[4];let p=m,f;t[5]!==n||t[6]!==o||t[7]!==e?(f=i(y=>{let h=e.current;if(o===null||h===null)return!1;let S=o.suggestions[y??o.active];if(S===void 0)return!1;let w=nn(h.value,h.selectionStart,S);return n(w.value),r(null),requestAnimationFrame(()=>{let C=e.current;C!==null&&(C.focus(),C.setSelectionRange(w.caret,w.caret))}),!0},"d"),t[5]=n,t[6]=o,t[7]=e,t[8]=f):f=t[8];let v=f,g;t[9]!==v?(g=i(()=>v(),"b"),t[9]=v,t[10]=g):g=t[10];let E=g,x;return t[11]!==E||t[12]!==v||t[13]!==d||t[14]!==o?(x={close:c,commit:E,commitAt:v,move:p,refresh:d,state:o},t[11]=E,t[12]=v,t[13]=d,t[14]=o,t[15]=x):x=t[15],x},"sn"),ln={column:"column",keyword:"keyword",table:"table"},an=20,cn=i(s=>{let e=(0,X.c)(17),{listboxId:n,onPick:t,state:o}=s,r=se(),l;e[0]!==o?(l=o===null?void 0:{left:o.left,top:o.top+an},e[0]=o,e[1]=l):l=e[1];let d=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=i((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:i(v=>{v.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(ln[p.kind])})]},`${p.kind}:${p.label}`),"u"),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]!==d||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:d,children:a}),e[13]=n,e[14]=d,e[15]=a,e[16]=c):c=e[16],c},"rn"),dn=me(he.listTables),un=me(he.readTablePage),mn=i(s=>{let e=(0,X.c)(18),n=xe(),t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0];let[o,r]=(0,j.useState)(t),l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l={},e[1]=l):l=e[1];let[d,a]=(0,j.useState)(l),c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c={},e[2]=c):c=e[2];let[m,p]=(0,j.useState)(c),f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=new Set,e[3]=f):f=e[3];let v=(0,j.useRef)(f),g,E;e[4]!==n||e[5]!==s?(g=i(()=>{let C={cancelled:!1};return ae((async()=>{try{let b=await n.query(dn,{},fe(s));C.cancelled||(r(b.map(hn)),a({}),p({}),v.current=new Set)}catch{C.cancelled||(r([]),a({}),p({}),v.current=new Set)}})()),()=>{C.cancelled=!0}},"b"),E=[n,s],e[4]=n,e[5]=s,e[6]=g,e[7]=E):(g=e[6],E=e[7]),(0,j.useEffect)(g,E);let x;e[8]!==n||e[9]!==s?(x=i(C=>{v.current.has(C)||(v.current.add(C),ae((async()=>{try{let b=await n.query(un,{limit:1,offset:0,table:C},fe(s)),{sqlColumns:k}=b;if(k===void 0){v.current.delete(C);return}let N=new Set(k),R=b.columns.filter(q=>!N.has(q));a(q=>({...q,[C]:k})),p(q=>({...q,[C]:R}))}catch{v.current.delete(C)}})()))},"m"),e[8]=n,e[9]=s,e[10]=x):x=e[10];let y=x,h;e[11]!==d||e[12]!==m||e[13]!==o?(h={columns:d,docFields:m,tables:o},e[11]=d,e[12]=m,e[13]=o,e[14]=h):h=e[14];let S=h,w;return e[15]!==y||e[16]!==S?(w={probe:y,schema:S},e[15]=y,e[16]=S,e[17]=w):w=e[17],w},"dn"),Le=/\b(?:from|join|update|into)\s+([a-z_][\w$]*)|\b([a-z_][\w$]*)\s*\./gi,fn=i(s=>{let e=new Set;Le.lastIndex=0;let n=Le.exec(s);for(;n!==null;)e.add(n[1]??n[2]),n=Le.exec(s);return[...e]},"un");function hn(s){return s.name}i(hn,"fn");var pn=i(s=>(s.metaKey||s.ctrlKey)&&!s.shiftKey&&!s.altKey&&s.key.toLowerCase()==="i","mn"),bn=i(s=>{let e=(0,X.c)(44),{inlineEditEnabled:n,onSubmit:t,probe:o,schema:r,setDraft:l}=s,d=(0,j.useId)(),[a,c]=(0,j.useState)(null),m=(0,j.useRef)(null),p=(0,j.useRef)(null),f=(0,j.useRef)(null),v=sn(r,f,l),{close:g,commit:E,commitAt:x,move:y,refresh:h,state:S}=v,w;e[0]!==x?(w=i(M=>{x(M)},"v"),e[0]=x,e[1]=w):w=e[1];let C=w,b;e[2]!==h?(b=i(()=>{let M=f.current;M!==null&&M===document.activeElement&&h(M.value,M.selectionStart)},"h"),e[2]=h,e[3]=b):b=e[3];let k;e[4]!==h||e[5]!==r?(k=[h,r],e[4]=h,e[5]=r,e[6]=k):k=e[6],(0,j.useEffect)(b,k);let N;e[7]!==o||e[8]!==h||e[9]!==l?(N=i(M=>{let{selectionStart:Y,value:U}=M.target;l(U),c(null);for(let W of fn(U))o(W);h(U,Y)},"T"),e[7]=o,e[8]=h,e[9]=l,e[10]=N):N=e[10];let R=N,q;e[11]!==h?(q=i(M=>{let Y=M.currentTarget;h(Y.value,Y.selectionStart)},"R"),e[11]=h,e[12]=q):q=e[12];let T=q,L;e[13]!==g||e[14]!==E||e[15]!==y?(L=i(M=>M.key==="ArrowDown"?(M.preventDefault(),y(1),!0):M.key==="ArrowUp"?(M.preventDefault(),y(-1),!0):M.key==="Escape"?(M.preventDefault(),g(),!0):(M.key==="Enter"||M.key==="Tab")&&!M.metaKey&&!M.ctrlKey&&E()?(M.preventDefault(),!0):!1,"_"),e[13]=g,e[14]=E,e[15]=y,e[16]=L):L=e[16];let _=L,I;e[17]!==S||e[18]!==g||e[19]!==n||e[20]!==_||e[21]!==t?(I=i(M=>{if(!(S!==null&&_(M))){if((M.metaKey||M.ctrlKey)&&M.key==="Enter"){M.preventDefault(),t();return}if(n&&pn(M)){M.preventDefault(),g();let{selectionEnd:Y,selectionStart:U,value:W}=M.currentTarget,[J,G]=U===Y?[0,W.length]:[U,Y];c({end:G,start:J,text:W.slice(J,G)})}}},"A"),e[17]=S,e[18]=g,e[19]=n,e[20]=_,e[21]=t,e[22]=I):I=e[22];let H=I,B;e[23]!==g?(B=i(()=>{requestAnimationFrame(()=>{g()})},"W"),e[23]=g,e[24]=B):B=e[24];let F=B,O;e[25]===Symbol.for("react.memo_cache_sentinel")?(O=i(M=>{let{scrollLeft:Y,scrollTop:U}=M.currentTarget;m.current!==null&&(m.current.scrollTop=U),p.current!==null&&(p.current.scrollTop=U,p.current.scrollLeft=Y)},"$"),e[25]=O):O=e[25];let K=O,$;e[26]===Symbol.for("react.memo_cache_sentinel")?($=i(M=>{let Y=f.current;Y===null||M.offset===void 0||(Y.focus(),Y.setSelectionRange(M.offset,M.offset+(M.length??0)))},"H"),e[26]=$):$=e[26];let D=$,A;e[27]===Symbol.for("react.memo_cache_sentinel")?(A=i(()=>{c(null),f.current?.focus()},"D"),e[27]=A):A=e[27];let Q=A,z;e[28]!==a||e[29]!==l?(z=i(M=>{let Y=f.current;if(a===null||Y===null)return;let{end:U,start:W,text:J}=a;if(Y.value.slice(W,U)!==J){Q();return}l(Y.value.slice(0,W)+M+Y.value.slice(U)),c(null),Y.focus(),requestAnimationFrame(()=>{Y.setSelectionRange(W,W+M.length)})},"P"),e[28]=a,e[29]=l,e[30]=z):z=e[30];let re=z,Z;e[31]!==R||e[32]!==F||e[33]!==H||e[34]!==T?(Z={onBlur:F,onChange:R,onKeyDown:H,onScroll:K,onSelect:T},e[31]=R,e[32]=F,e[33]=H,e[34]=T,e[35]=Z):Z=e[35];let oe;return e[36]!==re||e[37]!==S||e[38]!==g||e[39]!==a||e[40]!==d||e[41]!==C||e[42]!==Z?(oe={acceptInlineEdit:re,autocompleteState:S,closeAutocomplete:g,closeInlineEdit:Q,inlineEdit:a,handlers:Z,listboxId:d,onPickSuggestion:C,editorRef:f,gutterRef:m,overlayRef:p,revealDiagnostic:D},e[36]=re,e[37]=S,e[38]=g,e[39]=a,e[40]=d,e[41]=C,e[42]=Z,e[43]=oe):oe=e[43],oe},"pn"),gn="lunora-studio-sql-tabs",xn="lunora-studio-sql-active-tab",De=12,ge=i((s="",e="")=>({activeId:null,id:Ee("tab"),name:e,sql:s}),"pe"),vn=i(()=>ye(xn,""),"gn"),yn=i(s=>{let e=(0,X.c)(16),[n,t]=ve(gn),[o,r]=vn(),[l]=(0,j.useState)(s),d,a;e[0]!==l||e[1]!==t||e[2]!==n.length?(d=i(()=>{n.length===0&&t([l])},"c"),a=[l,t,n.length],e[0]=l,e[1]=t,e[2]=n.length,e[3]=d,e[4]=a):(d=e[3],a=e[4]),(0,j.useEffect)(d,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,v;return e[11]!==f||e[12]!==r||e[13]!==t||e[14]!==m?(v={activeId:f,setActiveId:r,setTabs:t,tabs:m},e[11]=f,e[12]=r,e[13]=t,e[14]=m,e[15]=v):v=e[15],v},"xn"),lt=i(s=>s.activeId===null&&s.sql.trim()!=="","Ge"),wn=i((s,e)=>[...s,e].slice(-De),"vn"),Sn=i((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}},"yn"),Cn=i((s,e)=>{let n=s.filter(t=>t.id===e);return n.length===0?{activeId:s[0]?.id??"",tabs:[...s]}:{activeId:e,tabs:n}},"Sn"),Nn=i((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}},"wn"),kn=i(s=>{let e=s();return{activeId:e.id,tabs:[e]}},"Cn"),qn=i((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]},"Nn"),Ve={error:null,pane:"results",result:null,running:!1},En=i(s=>{let e=(0,X.c)(66),{activeId:n,setActiveId:t,setTabs:o,tabs:r}=yn(s),l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={},e[0]=l):l=e[0];let[d,a]=(0,j.useState)(l),[c,m]=(0,j.useState)(null),[p,f]=(0,j.useState)(null),v;e[1]!==n||e[2]!==r?(v=r.find(P=>P.id===n)??r[0]??ge(),e[1]=n,e[2]=r,e[3]=v):v=e[3];let g=v,E=d[g.id]??Ve,x;e[4]!==g.id||e[5]!==o?(x=i(P=>{o(V=>V.map(ne=>ne.id===g.id?{...ne,...P}:ne))},"m"),e[4]=g.id,e[5]=o,e[6]=x):x=e[6];let y=x,h;e[7]!==g.id?(h=i(P=>{a(V=>{let ne=V[g.id]??Ve;return{...V,[g.id]:{...ne,...P}}})},"p"),e[7]=g.id,e[8]=h):h=e[8];let S=h,w;e[9]!==t||e[10]!==o||e[11]!==r.length?(w=i(()=>{if(r.length>=De)return;let P=ge();o(V=>wn(V,P)),t(P.id)},"v"),e[9]=t,e[10]=o,e[11]=r.length,e[12]=w):w=e[12];let C=w,b;e[13]!==t||e[14]!==o?(b=i(P=>{m(null),f(null),o(P.tabs),t(P.activeId);let V=new Set(P.tabs.map(Tn));a(ne=>Object.fromEntries(Object.entries(ne).filter(ce=>{let[de]=ce;return V.has(de)})))},"h"),e[13]=t,e[14]=o,e[15]=b):b=e[15];let k=b,N;e[16]!==k||e[17]!==r?(N=i(P=>{k(Sn(r,P,ge))},"T"),e[16]=k,e[17]=r,e[18]=N):N=e[18];let R=N,q;e[19]!==n||e[20]!==k||e[21]!==r?(q=i((P,V)=>{k(P==="others"?Cn(r,V):P==="right"?Nn(r,V,n):kn(ge))},"R"),e[19]=n,e[20]=k,e[21]=r,e[22]=q):q=e[22];let T=q,L;e[23]!==T||e[24]!==c||e[25]!==r?(L=i(P=>{c!==null&&(qn(P,r,c.id).some(In)?f(P):T(P,c.id))},"_"),e[23]=T,e[24]=c,e[25]=r,e[26]=L):L=e[26];let _=L,I;e[27]===Symbol.for("react.memo_cache_sentinel")?(I=i((P,V)=>{V.preventDefault(),f(null),m({id:P,x:V.clientX,y:V.clientY})},"A"),e[27]=I):I=e[27];let H=I,B;e[28]===Symbol.for("react.memo_cache_sentinel")?(B=i(()=>{m(null),f(null)},"W"),e[28]=B):B=e[28];let F=B,O;e[29]===Symbol.for("react.memo_cache_sentinel")?(O=i(P=>{P.preventDefault(),m(null),f(null)},"$"),e[29]=O):O=e[29];let K=O,$;e[30]!==_?($=i(()=>{_("others")},"H"),e[30]=_,e[31]=$):$=e[31];let D=$,A;e[32]!==_?(A=i(()=>{_("right")},"D"),e[32]=_,e[33]=A):A=e[33];let Q=A,z;e[34]!==_?(z=i(()=>{_("all")},"P"),e[34]=_,e[35]=z):z=e[35];let re=z,Z;e[36]!==T||e[37]!==p||e[38]!==c?(Z=i(()=>{c!==null&&p!==null&&T(p,c.id),f(null)},"Z"),e[36]=T,e[37]=p,e[38]=c,e[39]=Z):Z=e[39];let oe=Z,M;e[40]===Symbol.for("react.memo_cache_sentinel")?(M=i(()=>{f(null)},"q"),e[40]=M):M=e[40];let Y=M,U;e[41]!==c?(U=c===null?void 0:{left:c.x,top:c.y},e[41]=c,e[42]=U):U=e[42];let W=U,J;e[43]!==o?(J=i(P=>{o(V=>V.map(ne=>ne.activeId===P?{...ne,activeId:null}:ne))},"U"),e[43]=o,e[44]=J):J=e[44];let G=J,ee;e[45]!==o?(ee=i((P,V)=>{o(ne=>ne.map(ce=>ce.id===P?{...ce,name:V}:ce))},"Y"),e[45]=o,e[46]=ee):ee=e[46];let le=ee,te;return e[47]!==g||e[48]!==n||e[49]!==C||e[50]!==R||e[51]!==oe||e[52]!==re||e[53]!==D||e[54]!==Q||e[55]!==E||e[56]!==S||e[57]!==y||e[58]!==p||e[59]!==le||e[60]!==t||e[61]!==c||e[62]!==W||e[63]!==r||e[64]!==G?(te={activeTab:g,activeTabId:n,addEditorTab:C,cancelBulk:Y,closeEditorTab:R,closeTabMenu:F,confirmBulk:oe,menuStyle:W,onBackdropContextMenu:K,onCloseAll:re,onCloseOthers:D,onCloseToRight:Q,openTabMenu:H,output:E,patchActiveOutput:S,patchActiveTab:y,pendingBulk:p,renameTab:le,setActiveTabId:t,tabMenu:c,tabs:r,unlinkQuery:G},e[47]=g,e[48]=n,e[49]=C,e[50]=R,e[51]=oe,e[52]=re,e[53]=D,e[54]=Q,e[55]=E,e[56]=S,e[57]=y,e[58]=p,e[59]=le,e[60]=t,e[61]=c,e[62]=W,e[63]=r,e[64]=G,e[65]=te):te=e[65],te},"En");function Tn(s){return s.id}i(Tn,"kn");function In(s){return lt(s)}i(In,"Tn");var Ln="lunora-studio-sql-queries",ue="lunora-studio-sql-history",_n="lunora-studio-sql-remember-history",Rn=25,Dn=i(s=>{let e=(0,X.c)(41),{loadIntoActiveTab:n,unlinkQuery:t}=s,o=se(),[r,l]=ve(Ln),[d,a]=ye(_n,!1),[c,m]=ve(ue,d?"local":"session"),p,f;e[0]!==d?(p=i(()=>{d||pe(ue,"local")},"g"),f=[d],e[0]=d,e[1]=p,e[2]=f):(p=e[1],f=e[2]),(0,j.useEffect)(p,f);let[v,g]=(0,j.useState)(""),E=(0,j.useRef)(null),x;e[3]!==m?(x=i(D=>{m(A=>A[0]?.sql===D?A:[{at:Date.now(),sql:D},...A.filter(Q=>Q.sql!==D)].slice(0,Rn))},"m"),e[3]=m,e[4]=x):x=e[4];let y=x,h;e[5]!==n||e[6]!==l||e[7]!==o?(h=i(()=>{let D={id:Ee("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,w;e[9]!==n||e[10]!==r?(w=i(D=>{let A=r.find(Q=>Q.id===D);A!==void 0&&(n(A.sql,D),E.current?.querySelector(`[data-testid="sql-query-${D}"]`)?.scrollIntoView({block:"nearest"}))},"v"),e[9]=n,e[10]=r,e[11]=w):w=e[11];let C=w,b;e[12]!==l||e[13]!==t?(b=i(D=>{l(A=>A.filter(Q=>Q.id!==D)),t(D)},"h"),e[12]=l,e[13]=t,e[14]=b):b=e[14];let k=b,N;e[15]!==n?(N=i(D=>{n(D.currentTarget.dataset.sql??"",null)},"T"),e[15]=n,e[16]=N):N=e[16];let R=N,q;e[17]!==n?(q=i(D=>{n(D.currentTarget.dataset.sql??"",null)},"R"),e[17]=n,e[18]=q):q=e[18];let T=q,L;e[19]!==m?(L=i(()=>{m([]),pe(ue,"local"),pe(ue,"session")},"_"),e[19]=m,e[20]=L):L=e[20];let _=L,I;e[21]!==c||e[22]!==a?(I=i(D=>{$e(ue,c,D?"local":"session"),D||pe(ue,"local"),a(D)},"A"),e[21]=c,e[22]=a,e[23]=I):I=e[23];let H=I,B;e[24]===Symbol.for("react.memo_cache_sentinel")?(B=i(D=>{g(D.target.value)},"W"),e[24]=B):B=e[24];let F=B,O;e[25]!==l?(O=i((D,A)=>{l(Q=>Q.map(z=>z.id===D?{...z,sql:A}:z))},"$"),e[25]=l,e[26]=O):O=e[26];let K=O,$;return e[27]!==_||e[28]!==k||e[29]!==c||e[30]!==T||e[31]!==R||e[32]!==S||e[33]!==r||e[34]!==y||e[35]!==d||e[36]!==v||e[37]!==C||e[38]!==H||e[39]!==K?($={clearHistory:_,deleteQuery:k,history:c,listRef:E,loadFromHistory:T,loadTemplate:R,newQuery:S,onSearchChange:F,queries:r,recordHistory:y,rememberHistory:d,search:v,selectQuery:C,setRememberHistory:H,updateQuerySql:K},e[27]=_,e[28]=k,e[29]=c,e[30]=T,e[31]=R,e[32]=S,e[33]=r,e[34]=y,e[35]=d,e[36]=v,e[37]=C,e[38]=H,e[39]=K,e[40]=$):$=e[40],$},"_n"),Me="p-3 font-mono text-xs leading-5 whitespace-pre-wrap break-words",Mn=i((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},"An"),it=i((s,e)=>e(s==="unsafe-response"?"The model returned a statement that is not read-only, so it was discarded.":s==="too-long"?"The statement is too long to rewrite. Select a shorter part of it.":s==="empty-response"?"The model returned nothing usable.":"The model could not be reached."),"Je"),An=i(s=>{let e=(0,X.c)(51),{assistant:n,failed:t,onGenerated:o}=s,r=se(),[l,d]=(0,j.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]!==n||e[3]!==t||e[4]!==o||e[5]!==c||e[6]!==l||e[7]!==r){let p=n.reason("sql"),f;e[9]!==n||e[10]!==t||e[11]!==o||e[12]!==l?(f=i(T=>{let L=l.trim();L===""&&!T||ae((async()=>{let _=await n.generate(L===""?"fix the failing statement":L,T?t:void 0);_!==void 0&&o(_)})())},"d"),e[9]=n,e[10]=t,e[11]=o,e[12]=l,e[13]=f):f=e[13];let v=f,g;e[14]!==r?(g=r("Describe the query you want"),e[14]=r,e[15]=g):g=e[15];let E;e[16]===Symbol.for("react.memo_cache_sentinel")?(E=i(T=>{d(T.target.value)},"N"),e[16]=E):E=e[16];let x;e[17]!==v?(x=i(T=>{T.key==="Enter"&&(T.preventDefault(),v(!1))},"m"),e[17]=v,e[18]=x):x=e[18];let y;e[19]!==r?(y=r("Describe the query you want"),e[19]=r,e[20]=y):y=e[20];let h;e[21]!==c||e[22]!==l||e[23]!==g||e[24]!==x||e[25]!==y?(h=(0,u.jsx)(qe,{"aria-label":g,className:"h-7 flex-1 text-xs","data-testid":"sql-assistant-prompt",disabled:c,onChange:E,onKeyDown:x,placeholder:y,value:l}),e[21]=c,e[22]=l,e[23]=g,e[24]=x,e[25]=y,e[26]=h):h=e[26];let S=c&&"opacity-60",w;e[27]!==S?(w=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]=w):w=e[28];let C;e[29]!==c||e[30]!==l?(C=c||l.trim()==="",e[29]=c,e[30]=l,e[31]=C):C=e[31];let b;e[32]!==v?(b=i(()=>{v(!1)},"h"),e[32]=v,e[33]=b):b=e[33];let k;e[34]!==c||e[35]!==r?(k=r(c?"Thinking\u2026":"Draft SQL"),e[34]=c,e[35]=r,e[36]=k):k=e[36];let N;e[37]!==w||e[38]!==C||e[39]!==b||e[40]!==k?(N=(0,u.jsx)("button",{className:w,"data-testid":"sql-assistant-generate",disabled:C,onClick:b,type:"button",children:k}),e[37]=w,e[38]=C,e[39]=b,e[40]=k,e[41]=N):N=e[41];let R;e[42]!==t||e[43]!==c||e[44]!==v||e[45]!==r?(R=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:i(()=>{v(!0)},"onClick"),type:"button",children:r("Fix this")}),e[42]=t,e[43]=c,e[44]=v,e[45]=r,e[46]=R):R=e[46];let q;e[47]!==N||e[48]!==R||e[49]!==h?(q=(0,u.jsxs)("div",{className:"flex items-center gap-2",children:[h,N,R]}),e[47]=N,e[48]=R,e[49]=h,e[50]=q):q=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:[q,p!==void 0&&(0,u.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"sql-assistant-reason",role:"status",children:it(p,r)})]}),e[2]=n,e[3]=t,e[4]=o,e[5]=c,e[6]=l,e[7]=r,e[8]=m}else m=e[8];return m},"qn"),$n=i(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=Mn(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 d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=ie("pointer-events-none absolute inset-0 overflow-hidden text-transparent",Me),e[4]=d):d=e[4];let a;return e[5]!==r||e[6]!==o?(a=(0,u.jsx)("div",{"aria-hidden":"true",className:d,"data-testid":"sql-diagnostics-overlay",ref:o,children:r}),e[5]=r,e[6]=o,e[7]=a):a=e[7],a},"Dn"),On={gate:"read-only",plan:"plan",schema:"schema",syntax:"syntax"},Pn=i(s=>{let e=(0,X.c)(10),{diagnostics:n,onSelect:t}=s,o=se();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=i((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:i(()=>{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:On[c.source]}),(0,u.jsx)("span",{className:"min-w-0 text-muted-foreground",children:c.message})]})},`${c.source}-${(c.offset??m).toString()}-${m.toString()}`),"a"),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 d;return e[7]!==r||e[8]!==l?(d=(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]=d):d=e[9],d},"Mn"),jn=i(s=>(s.endsWith(`
12
+ `)?s.slice(0,-1):s).split(`
13
+ `),"$n"),zn=i((s,e)=>{let n=[],t=1,o=1;for(let r of Ie(s,e,{ignoreNewlineAtEof:!0}))for(let l of jn(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},"Bn"),Wn={added:"bg-emerald-500/10 text-emerald-700 dark:text-emerald-400",context:"text-muted-foreground",removed:"bg-destructive/10 text-destructive"},Hn={added:"+",context:" ",removed:"-"},Fn=i(s=>{let e=(0,X.c)(11),{lines:n}=s,t=se(),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",Me),e[2]=r):r=e[2];let l;if(e[3]!==n||e[4]!==t){let a;e[6]!==t?(a=i(c=>(0,u.jsxs)("li",{className:ie("flex gap-2",Wn[c.kind]),"data-kind":c.kind,children:[(0,u.jsx)("span",{"aria-hidden":"true",className:"shrink-0 select-none opacity-60",children:Hn[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)}`),"a"),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 d;return e[8]!==o||e[9]!==l?(d=(0,u.jsx)("ul",{"aria-label":o,className:r,"data-testid":"sql-inline-diff",children:l}),e[8]=o,e[9]=l,e[10]=d):d=e[10],d},"Fn"),Se="rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",Kn=i(s=>{let e=(0,X.c)(41),{onAccept:n,onCancel:t,rpc:o,source:r,whole:l}=s,d=se(),a=(0,j.useRef)(null),c=(0,j.useRef)(null),[m,p]=(0,j.useState)(""),[f,v]=(0,j.useState)(null),g,E;if(e[0]!==f?(g=i(()=>{f===null?a.current?.focus():c.current?.focus()},"b"),E=[f],e[0]=f,e[1]=g,e[2]=E):(g=e[1],E=e[2]),(0,j.useEffect)(g,E),o.unavailable)return null;let x;e[3]!==o?(x=o.pending("sql"),e[3]=o,e[4]=x):x=e[4];let y=x,h;if(e[5]!==m||e[6]!==n||e[7]!==t||e[8]!==y||e[9]!==f||e[10]!==o||e[11]!==r||e[12]!==d||e[13]!==l){let S=o.reason("sql"),w;e[15]!==m||e[16]!==o||e[17]!==r?(w=i(()=>{let _=m.trim();_===""||r.trim()===""||ae((async()=>{let I=await o.rewrite(_,r);I!==void 0&&v(I)})())},"v"),e[15]=m,e[16]=o,e[17]=r,e[18]=w):w=e[18];let C=w,b;e[19]!==t?(b=i(_=>{_.key==="Escape"&&(_.preventDefault(),t())},"h"),e[19]=t,e[20]=b):b=e[20];let k=b,N;e[21]!==d||e[22]!==l?(N=d(l?"Whole query":"Selection"),e[21]=d,e[22]=l,e[23]=N):N=e[23];let R;e[24]!==N?(R=(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:N}),e[24]=N,e[25]=R):R=e[25];let q;e[26]!==m||e[27]!==n||e[28]!==t||e[29]!==k||e[30]!==y||e[31]!==f||e[32]!==C||e[33]!==d?(q=f===null?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(qe,{"aria-label":d("Tell the model what to change"),className:"h-7 flex-1 text-xs","data-testid":"sql-inline-edit-prompt",disabled:y,onChange:i(_=>{p(_.target.value)},"onChange"),onKeyDown:i(_=>{if(_.key==="Enter"){_.preventDefault(),C();return}k(_)},"onKeyDown"),placeholder:d("Tell the model what to change"),ref:a,value:m}),(0,u.jsx)("button",{className:ie(Se,y&&"opacity-60"),"data-testid":"sql-inline-edit-submit",disabled:y||m.trim()==="",onClick:C,onKeyDown:k,type:"button",children:d(y?"Thinking\u2026":"Rewrite")}),(0,u.jsx)("button",{className:Se,"data-testid":"sql-inline-edit-cancel",onClick:t,onKeyDown:k,type:"button",children:d("Cancel")})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("span",{className:"flex-1 text-xs text-muted-foreground",children:d("Proposed edit")}),(0,u.jsx)("button",{className:Se,"data-testid":"sql-inline-edit-accept",onClick:i(()=>{n(f)},"onClick"),onKeyDown:k,ref:c,type:"button",children:d("Accept")}),(0,u.jsx)("button",{className:Se,"data-testid":"sql-inline-edit-reject",onClick:i(()=>{v(null)},"onClick"),onKeyDown:k,type:"button",children:d("Reject")})]}),e[26]=m,e[27]=n,e[28]=t,e[29]=k,e[30]=y,e[31]=f,e[32]=C,e[33]=d,e[34]=q):q=e[34];let T;e[35]!==R||e[36]!==q?(T=(0,u.jsxs)("div",{className:"flex items-center gap-2",children:[R,q]}),e[35]=R,e[36]=q,e[37]=T):T=e[37];let L;e[38]!==f||e[39]!==r?(L=f!==null&&(0,u.jsx)(Fn,{lines:zn(r,f)}),e[38]=f,e[39]=r,e[40]=L):L=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:[T,L,S!==void 0&&(0,u.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"sql-inline-edit-reason",role:"status",children:it(S,d)})]}),e[5]=m,e[6]=n,e[7]=t,e[8]=y,e[9]=f,e[10]=o,e[11]=r,e[12]=d,e[13]=l,e[14]=h}else h=e[14];return h},"Wn"),Bn={minWidth:"2.75rem",paddingInline:"0.5rem"},Qn=i(s=>{let e=(0,X.c)(75),{assistant:n,autocomplete:t,diagnostics:o,draft:r,failed:l,handlers:d,editorRef:a,gutterRef:c,inlineEdit:m,listboxId:p,onAcceptInlineEdit:f,onCancelInlineEdit:v,onGenerated:g,onPickSuggestion:E,onRevealDiagnostic:x,overlayRef:y}=s,h=se(),S,w,C,b,k,N,R,q,T;if(e[0]!==n||e[1]!==r||e[2]!==l||e[3]!==c||e[4]!==m||e[5]!==f||e[6]!==v||e[7]!==g){let z=r.split(`
14
+ `).length;R="flex min-h-0 min-w-0 flex-1 flex-col",e[17]!==n||e[18]!==l||e[19]!==g?(q=(0,u.jsx)(An,{assistant:n,failed:l,onGenerated:g}),e[17]=n,e[18]=l,e[19]=g,e[20]=q):q=e[20],e[21]!==n||e[22]!==r.length||e[23]!==m||e[24]!==f||e[25]!==v?(T=m!==null&&(0,u.jsx)(Kn,{onAccept:f,onCancel:v,rpc:n,source:m.text,whole:m.start===0&&m.end===r.length},`${m.start.toString()}-${m.end.toString()}`),e[21]=n,e[22]=r.length,e[23]=m,e[24]=f,e[25]=v,e[26]=T):T=e[26],N="flex min-h-0 min-w-0 flex-1",S="true",w="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",C=c,b=Bn,k=Array.from({length:z},Yn),e[0]=n,e[1]=r,e[2]=l,e[3]=c,e[4]=m,e[5]=f,e[6]=v,e[7]=g,e[8]=S,e[9]=w,e[10]=C,e[11]=b,e[12]=k,e[13]=N,e[14]=R,e[15]=q,e[16]=T}else S=e[8],w=e[9],C=e[10],b=e[11],k=e[12],N=e[13],R=e[14],q=e[15],T=e[16];let L;e[27]!==S||e[28]!==w||e[29]!==C||e[30]!==b||e[31]!==k?(L=(0,u.jsx)("div",{"aria-hidden":S,className:w,ref:C,style:b,children:k}),e[27]=S,e[28]=w,e[29]=C,e[30]=b,e[31]=k,e[32]=L):L=e[32];let _;e[33]!==o||e[34]!==r||e[35]!==y?(_=(0,u.jsx)($n,{diagnostics:o,draft:r,scrollRef:y}),e[33]=o,e[34]=r,e[35]=y,e[36]=_):_=e[36];let I;e[37]!==t||e[38]!==p?(I=t===null?void 0:`${p}-opt-${t.active.toString()}`,e[37]=t,e[38]=p,e[39]=I):I=e[39];let H=t===null?void 0:p,B=t!==null,F;e[40]!==h?(F=h("SQL query"),e[40]=h,e[41]=F):F=e[41];let O;e[42]!==r||e[43]!==a||e[44]!==d.onBlur||e[45]!==d.onChange||e[46]!==d.onKeyDown||e[47]!==d.onScroll||e[48]!==d.onSelect||e[49]!==I||e[50]!==H||e[51]!==B||e[52]!==F?(O=(0,u.jsx)("textarea",{"aria-activedescendant":I,"aria-autocomplete":"list","aria-controls":H,"aria-expanded":B,"aria-label":F,className:`relative size-full resize-none bg-transparent outline-none ${Me}`,"data-testid":"sql-input",onBlur:d.onBlur,onChange:d.onChange,onKeyDown:d.onKeyDown,onScroll:d.onScroll,onSelect:d.onSelect,placeholder:"SELECT * FROM \u2026",ref:a,role:"combobox",spellCheck:!1,value:r}),e[42]=r,e[43]=a,e[44]=d.onBlur,e[45]=d.onChange,e[46]=d.onKeyDown,e[47]=d.onScroll,e[48]=d.onSelect,e[49]=I,e[50]=H,e[51]=B,e[52]=F,e[53]=O):O=e[53];let K;e[54]!==t||e[55]!==p||e[56]!==E?(K=(0,u.jsx)(cn,{listboxId:p,onPick:E,state:t}),e[54]=t,e[55]=p,e[56]=E,e[57]=K):K=e[57];let $;e[58]!==_||e[59]!==O||e[60]!==K?($=(0,u.jsxs)("div",{className:"relative min-w-0 flex-1 bg-background",children:[_,O,K]}),e[58]=_,e[59]=O,e[60]=K,e[61]=$):$=e[61];let D;e[62]!==L||e[63]!==$||e[64]!==N?(D=(0,u.jsxs)("div",{className:N,children:[L,$]}),e[62]=L,e[63]=$,e[64]=N,e[65]=D):D=e[65];let A;e[66]!==o||e[67]!==x?(A=(0,u.jsx)(Pn,{diagnostics:o,onSelect:x}),e[66]=o,e[67]=x,e[68]=A):A=e[68];let Q;return e[69]!==D||e[70]!==A||e[71]!==R||e[72]!==q||e[73]!==T?(Q=(0,u.jsxs)("div",{className:R,children:[q,T,D,A]}),e[69]=D,e[70]=A,e[71]=R,e[72]=q,e[73]=T,e[74]=Q):Q=e[74],Q},"zn");function Yn(s,e){return(0,u.jsx)("div",{children:e+1},e)}i(Yn,"Un");var at=[{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;"}],Jn=i(s=>{let e=(0,X.c)(29),{active:n,onDelete:t,onSelect:o,query:r}=s,l=se(),d;e[0]!==o||e[1]!==r.id?(d=i(()=>{o(r.id)},"c"),e[0]=o,e[1]=r.id,e[2]=d):d=e[2];let a=d,c;e[3]!==t||e[4]!==r.id?(c=i(b=>{b.stopPropagation(),t(r.id)},"i"),e[3]=t,e[4]=r.id,e[5]=c):c=e[5];let m=c,p=n?"bg-sidebar-accent font-medium text-foreground":"text-muted-foreground",f;e[6]!==p?(f=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",p),e[6]=p,e[7]=f):f=e[7];let v=`sql-query-${r.id}`,g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=(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[8]=g):g=e[8];let E;e[9]!==r.name?(E=(0,u.jsx)("span",{className:"truncate",children:r.name}),e[9]=r.name,e[10]=E):E=e[10];let x;e[11]!==n||e[12]!==a||e[13]!==f||e[14]!==v||e[15]!==E?(x=(0,u.jsxs)("button",{"aria-pressed":n,className:f,"data-testid":v,onClick:a,type:"button",children:[g,E]}),e[11]=n,e[12]=a,e[13]=f,e[14]=v,e[15]=E,e[16]=x):x=e[16];let y;e[17]!==l?(y=l("Delete query"),e[17]=l,e[18]=y):y=e[18];let h;e[19]!==l?(h=l("Delete query"),e[19]=l,e[20]=h):h=e[20];let S;e[21]===Symbol.for("react.memo_cache_sentinel")?(S=(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[21]=S):S=e[21];let w;e[22]!==m||e[23]!==h||e[24]!==y?(w=(0,u.jsx)("button",{"aria-label":y,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:m,title:h,type:"button",children:S}),e[22]=m,e[23]=h,e[24]=y,e[25]=w):w=e[25];let C;return e[26]!==w||e[27]!==x?(C=(0,u.jsxs)("li",{className:"group/q flex items-center",children:[x,w]}),e[26]=w,e[27]=x,e[28]=C):C=e[28],C},"jn"),Ge="sql-history-remember",Vn=i((s,e)=>{let n=e.trim().toLowerCase();return n===""?[...s]:s.filter(t=>t.name.toLowerCase().includes(n))},"Qn"),Gn=i(s=>{let e=(0,X.c)(66),{activeId:n,history:t,listRef:o,onClearHistory:r,onDelete:l,onLoadHistory:d,onLoadTemplate:a,onNew:c,onSearchChange:m,onSelect:p,onToggleRememberHistory:f,queries:v,rememberHistory:g,search:E}=s,x=se(),y,h,S,w,C;if(e[0]!==n||e[1]!==o||e[2]!==l||e[3]!==c||e[4]!==m||e[5]!==p||e[6]!==f||e[7]!==v||e[8]!==E||e[9]!==x){let I=Vn(v,E),H;e[15]!==f?(H=i(z=>{f(z.target.checked)},"M"),e[15]=f,e[16]=H):H=e[16],y=H,S="flex h-full w-64 shrink-0 flex-col border-e border-border bg-sidebar";let B;e[17]!==x?(B=x("Search queries\u2026"),e[17]=x,e[18]=B):B=e[18];let F;e[19]!==m||e[20]!==E||e[21]!==B?(F=(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:m,placeholder:B,type:"text",value:E}),e[19]=m,e[20]=E,e[21]=B,e[22]=F):F=e[22];let O;e[23]!==x?(O=x("New query"),e[23]=x,e[24]=O):O=e[24];let K;e[25]!==x?(K=x("New query"),e[25]=x,e[26]=K):K=e[26];let $;e[27]===Symbol.for("react.memo_cache_sentinel")?($=(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[27]=$):$=e[27];let D;e[28]!==c||e[29]!==O||e[30]!==K?(D=(0,u.jsx)("button",{"aria-label":O,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:K,type:"button",children:$}),e[28]=c,e[29]=O,e[30]=K,e[31]=D):D=e[31],e[32]!==D||e[33]!==F?(w=(0,u.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border p-2",children:[F,D]}),e[32]=D,e[33]=F,e[34]=w):w=e[34],h="flex flex-1 flex-col gap-4 overflow-y-auto p-2";let A;e[35]!==x?(A=x("Private"),e[35]=x,e[36]=A):A=e[36];let Q;e[37]!==A?(Q=(0,u.jsx)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:A}),e[37]=A,e[38]=Q):Q=e[38],C=(0,u.jsxs)("div",{children:[Q,I.length===0?(0,u.jsx)("p",{className:"px-1 py-2 text-xs text-muted-foreground","data-testid":"sql-private-empty",children:x("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:I.map(z=>(0,u.jsx)(Jn,{active:n===z.id,onDelete:l,onSelect:p,query:z},z.id))})]}),e[0]=n,e[1]=o,e[2]=l,e[3]=c,e[4]=m,e[5]=p,e[6]=f,e[7]=v,e[8]=E,e[9]=x,e[10]=y,e[11]=h,e[12]=S,e[13]=w,e[14]=C}else y=e[10],h=e[11],S=e[12],w=e[13],C=e[14];let b;e[39]!==x?(b=x("Reference"),e[39]=x,e[40]=b):b=e[40];let k;e[41]!==b?(k=(0,u.jsx)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:b}),e[41]=b,e[42]=k):k=e[42];let N;e[43]!==a?(N=at.map(I=>(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":I.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"})}),I.label]})},I.label)),e[43]=a,e[44]=N):N=e[44];let R;e[45]!==N?(R=(0,u.jsx)("ul",{className:"flex flex-col gap-px",children:N}),e[45]=N,e[46]=R):R=e[46];let q;e[47]!==k||e[48]!==R?(q=(0,u.jsxs)("div",{children:[k,R]}),e[47]=k,e[48]=R,e[49]=q):q=e[49];let T;e[50]!==t||e[51]!==r||e[52]!==d||e[53]!==y||e[54]!==g||e[55]!==x?(T=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:x("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:x("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:Ge,children:[(0,u.jsx)("input",{checked:g,"data-testid":"sql-history-remember",id:Ge,onChange:y,type:"checkbox"}),x("Keep history on this browser")]}),(0,u.jsx)("ul",{className:"flex flex-col gap-px","data-testid":"sql-history",children:t.map(I=>(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":I.sql,"data-testid":"sql-history-item",onClick:d,title:I.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:I.sql})]})},`${I.at.toString()}:${I.sql}`))})]}),e[50]=t,e[51]=r,e[52]=d,e[53]=y,e[54]=g,e[55]=x,e[56]=T):T=e[56];let L;e[57]!==h||e[58]!==T||e[59]!==C||e[60]!==q?(L=(0,u.jsxs)("div",{className:h,children:[C,q,T]}),e[57]=h,e[58]=T,e[59]=C,e[60]=q,e[61]=L):L=e[61];let _;return e[62]!==L||e[63]!==S||e[64]!==w?(_=(0,u.jsxs)("aside",{className:S,children:[w,L]}),e[62]=L,e[63]=S,e[64]=w,e[65]=_):_=e[65],_},"Yn"),Ce=i(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"}`,"ve"),Un=i(s=>{let e=(0,X.c)(97),{assistant:n,chart:t,className:o,durationMs:r,error:l,onFormat:d,onInferChart:a,onRun:c,onSelectStatement:m,onShardKeyChange:p,onShowChart:f,onShowExplain:v,onShowResults:g,onToggleSplit:E,pane:x,result:y,running:h,script:S,shardKey:w,splitView:C}=s,b=se(),k=x==="results",N;e[0]!==k?(N=Ce(k),e[0]=k,e[1]=N):N=e[1];let R;e[2]!==b?(R=b("Results"),e[2]=b,e[3]=R):R=e[3];let q;e[4]!==g||e[5]!==N||e[6]!==R?(q=(0,u.jsx)("button",{className:N,"data-testid":"sql-tab-results",onClick:g,type:"button",children:R}),e[4]=g,e[5]=N,e[6]=R,e[7]=q):q=e[7];let T=x==="chart",L;e[8]!==T?(L=Ce(T),e[8]=T,e[9]=L):L=e[9];let _;e[10]!==b?(_=b("Chart"),e[10]=b,e[11]=_):_=e[11];let I;e[12]!==f||e[13]!==L||e[14]!==_?(I=(0,u.jsx)("button",{className:L,"data-testid":"sql-tab-chart",onClick:f,type:"button",children:_}),e[12]=f,e[13]=L,e[14]=_,e[15]=I):I=e[15];let H;e[16]!==n||e[17]!==a||e[18]!==x||e[19]!==y||e[20]!==b?(H=!n.unavailable&&x==="chart"&&y!==null&&(0,u.jsx)("button",{className:Ce(!1),"data-testid":"sql-infer-chart",disabled:n.pending("chart"),onClick:a,type:"button",children:n.pending("chart")?b("Thinking\u2026"):b("Suggest chart")}),e[16]=n,e[17]=a,e[18]=x,e[19]=y,e[20]=b,e[21]=H):H=e[21];let B=x==="explain",F;e[22]!==B?(F=Ce(B),e[22]=B,e[23]=F):F=e[23];let O;e[24]!==b?(O=b("Explain"),e[24]=b,e[25]=O):O=e[25];let K;e[26]!==v||e[27]!==F||e[28]!==O?(K=(0,u.jsx)("button",{className:F,"data-testid":"sql-tab-explain",onClick:v,type:"button",children:O}),e[26]=v,e[27]=F,e[28]=O,e[29]=K):K=e[29];let $;e[30]!==b?($=b("Split editor and results"),e[30]=b,e[31]=$):$=e[31];let D=`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 ${C?"bg-accent text-foreground":"text-muted-foreground"}`,A;e[32]!==b?(A=b("Split editor and results"),e[32]=b,e[33]=A):A=e[33];let Q;e[34]===Symbol.for("react.memo_cache_sentinel")?(Q=(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[34]=Q):Q=e[34];let z;e[35]!==E||e[36]!==C||e[37]!==$||e[38]!==D||e[39]!==A?(z=(0,u.jsx)("button",{"aria-label":$,"aria-pressed":C,className:D,"data-testid":"sql-split-toggle",onClick:E,title:A,type:"button",children:Q}),e[35]=E,e[36]=C,e[37]=$,e[38]=D,e[39]=A,e[40]=z):z=e[40];let re;e[41]!==y?(re=y!==null&&y.columns.length>0&&(0,u.jsx)(He,{columns:y.columns,name:"query-result",rows:y.rows}),e[41]=y,e[42]=re):re=e[42];let Z;e[43]!==b?(Z=b("Format"),e[43]=b,e[44]=Z):Z=e[44];let oe;e[45]!==d||e[46]!==h||e[47]!==Z?(oe=(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:h,onClick:d,type:"button",children:Z}),e[45]=d,e[46]=h,e[47]=Z,e[48]=oe):oe=e[48];let M;e[49]!==p||e[50]!==w?(M=(0,u.jsx)(Pe,{onChange:p,testId:"sql-shard-input",value:w}),e[49]=p,e[50]=w,e[51]=M):M=e[51];let Y;e[52]!==h||e[53]!==b?(Y=b(h?"Running\u2026":"Run"),e[52]=h,e[53]=b,e[54]=Y):Y=e[54];let U;e[55]===Symbol.for("react.memo_cache_sentinel")?(U=(0,u.jsx)("kbd",{className:"rounded border border-primary-foreground/30 px-1 font-sans text-[10px]",children:"\u2318\u21B5"}),e[55]=U):U=e[55];let W;e[56]!==c||e[57]!==h||e[58]!==Y?(W=(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:h,onClick:c,type:"button",children:[Y,U]}),e[56]=c,e[57]=h,e[58]=Y,e[59]=W):W=e[59];let J;e[60]!==z||e[61]!==re||e[62]!==oe||e[63]!==M||e[64]!==W?(J=(0,u.jsxs)("div",{className:"ms-auto flex items-center gap-2",children:[z,re,oe,M,W]}),e[60]=z,e[61]=re,e[62]=oe,e[63]=M,e[64]=W,e[65]=J):J=e[65];let G;e[66]!==K||e[67]!==J||e[68]!==q||e[69]!==I||e[70]!==H?(G=(0,u.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border pe-2",children:[q,I,H,K,J]}),e[66]=K,e[67]=J,e[68]=q,e[69]=I,e[70]=H,e[71]=G):G=e[71];let ee;e[72]!==m||e[73]!==S?(ee=S!==void 0&&(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:S.runs.map((ce,de)=>(0,u.jsx)("button",{"aria-pressed":de===S.selected,className:`rounded-md border px-2 py-0.5 font-mono text-[11px] outline-none transition-colors ${de===S.selected?"border-foreground text-foreground":"border-border text-muted-foreground hover:text-foreground"} ${ce.error===null?"":"border-destructive/50 text-destructive"}`,"data-testid":`sql-statement-${de.toString()}`,onClick:i(()=>{m(de)},"onClick"),title:ce.sql,type:"button",children:de+1},`${de.toString()}:${ce.sql}`))}),e[72]=m,e[73]=S,e[74]=ee):ee=e[74];let le;e[75]!==l?(le=l!==null&&(0,u.jsx)(je,{className:"m-3 font-mono text-xs",testId:"sql-error",variant:"destructive",children:l}),e[75]=l,e[76]=le):le=e[76];let te;e[77]!==l||e[78]!==y||e[79]!==b?(te=l===null&&y===null&&(0,u.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-empty",children:b("Click Run to execute your query.")}),e[77]=l,e[78]=y,e[79]=b,e[80]=te):te=e[80];let P;e[81]!==t||e[82]!==r||e[83]!==l||e[84]!==x||e[85]!==y||e[86]!==b?(P=l===null&&y!==null&&(0,u.jsxs)("div",{"data-testid":"sql-result",children:[x==="chart"?(0,u.jsx)(Fe,{axes:t,result:y}):(0,u.jsx)(Ke,{result:y}),(0,u.jsxs)("p",{className:"border-t border-border px-3 py-1.5 text-xs text-muted-foreground","data-testid":"sql-count",children:[y.truncated?b("Showing the first {max} rows.",{max:y.rows.length}):b("{count} rows",{count:y.rowCount}),r!==void 0&&` \xB7 ${b("{ms} ms",{ms:Math.round(r)})}`]})]}),e[81]=t,e[82]=r,e[83]=l,e[84]=x,e[85]=y,e[86]=b,e[87]=P):P=e[87];let V;e[88]!==le||e[89]!==te||e[90]!==P?(V=(0,u.jsxs)("div",{className:"min-h-0 flex-1 overflow-auto",children:[le,te,P]}),e[88]=le,e[89]=te,e[90]=P,e[91]=V):V=e[91];let ne;return e[92]!==o||e[93]!==G||e[94]!==ee||e[95]!==V?(ne=(0,u.jsxs)("div",{className:o,children:[G,ee,V]}),e[92]=o,e[93]=G,e[94]=ee,e[95]=V,e[96]=ne):ne=e[96],ne},"Gn"),Xn=i((s,e)=>s.trim()===""?e:(s.split(`
15
+ `)[0]??s).slice(0,24),"Jn"),Zn=i(s=>{s?.focus(),s?.select()},"Vn"),eo=i(s=>{let e=(0,X.c)(14),{initial:n,onCancel:t,onCommit:o,placeholder:r,testId:l}=s,d=se(),a;e[0]!==o?(a=i(g=>{o(g.currentTarget.value.trim())},"a"),e[0]=o,e[1]=a):a=e[1];let c=a,m;e[2]!==t||e[3]!==o?(m=i(g=>{g.key==="Enter"?o(g.currentTarget.value.trim()):g.key==="Escape"&&t()},"u"),e[2]=t,e[3]=o,e[4]=m):m=e[4];let p=m,f;e[5]!==d?(f=d("Tab title"),e[5]=d,e[6]=f):f=e[6];let v;return e[7]!==n||e[8]!==c||e[9]!==p||e[10]!==r||e[11]!==f||e[12]!==l?(v=(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:Zn,type:"text"}),e[7]=n,e[8]=c,e[9]=p,e[10]=r,e[11]=f,e[12]=l,e[13]=v):v=e[13],v},"Xn"),to=i(s=>{let e=(0,X.c)(29),{idBase:n,onDiscard:t,onKeep:o}=s,r=se(),l=`sql-tab-close-prompt-${n}`,d;e[0]!==r?(d=r("Discard?"),e[0]=r,e[1]=d):d=e[1];let a;e[2]!==d?(a=(0,u.jsx)("span",{className:"text-[11px] text-muted-foreground",children:d}),e[2]=d,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 v;e[9]!==t||e[10]!==c||e[11]!==m||e[12]!==p?(v=(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]=v):v=e[13];let g;e[14]!==r?(g=r("Keep editing"),e[14]=r,e[15]=g):g=e[15];let E=`sql-tab-close-cancel-${n}`,x;e[16]!==r?(x=r("Keep editing"),e[16]=r,e[17]=x):x=e[17];let y;e[18]===Symbol.for("react.memo_cache_sentinel")?(y=(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]=y):y=e[18];let h;e[19]!==o||e[20]!==E||e[21]!==x||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":E,onClick:o,title:x,type:"button",children:y}),e[19]=o,e[20]=E,e[21]=x,e[22]=g,e[23]=h):h=e[23];let S;return e[24]!==l||e[25]!==h||e[26]!==a||e[27]!==v?(S=(0,u.jsxs)("span",{className:"flex shrink-0 items-center gap-1","data-testid":l,role:"group",children:[a,v,h]}),e[24]=l,e[25]=h,e[26]=a,e[27]=v,e[28]=S):S=e[28],S},"Zn"),no=i(s=>{let e=(0,X.c)(47),{active:n,canClose:t,onClose:o,onMenu:r,onRename:l,onSelect:d,tab:a}=s,c=se(),[m,p]=(0,j.useState)(!1),[f,v]=(0,j.useState)(!1),g;e[0]!==r||e[1]!==a.id?(g=i(z=>{r(a.id,z)},"b"),e[0]=r,e[1]=a.id,e[2]=g):g=e[2];let E=g,x;e[3]!==d||e[4]!==a.id?(x=i(()=>{d(a.id)},"m"),e[3]=d,e[4]=a.id,e[5]=x):x=e[5];let y=x,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=i(()=>{p(!0)},"p"),e[6]=h):h=e[6];let S=h,w;e[7]!==o||e[8]!==a?(w=i(z=>{z.stopPropagation(),lt(a)?v(!0):o(a.id)},"v"),e[7]=o,e[8]=a,e[9]=w):w=e[9];let C=w,b;e[10]!==o||e[11]!==a.id?(b=i(z=>{z.stopPropagation(),v(!1),o(a.id)},"h"),e[10]=o,e[11]=a.id,e[12]=b):b=e[12];let k=b,N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=i(z=>{z.stopPropagation(),v(!1)},"T"),e[13]=N):N=e[13];let R=N,q;e[14]!==l||e[15]!==a.id?(q=i(z=>{l(a.id,z),p(!1)},"R"),e[14]=l,e[15]=a.id,e[16]=q):q=e[16];let T=q,L;e[17]===Symbol.for("react.memo_cache_sentinel")?(L=i(()=>{p(!1)},"_"),e[17]=L):L=e[17];let _=L,I;e[18]!==a.name?(I=a.name.trim(),e[18]=a.name,e[19]=I):I=e[19];let H=I,B;e[20]!==c||e[21]!==a.sql?(B=Xn(a.sql,c("Untitled")),e[20]=c,e[21]=a.sql,e[22]=B):B=e[22];let F=B,O=n?"bg-background text-foreground":"bg-muted/40 text-muted-foreground hover:text-foreground",K;e[23]!==O?(K=ie("group/tab flex shrink-0 items-center gap-1 border-e border-border ps-3 pe-1.5 text-xs",O),e[23]=O,e[24]=K):K=e[24];let $=`sql-tab-${a.id}`,D;e[25]!==n||e[26]!==T||e[27]!==H||e[28]!==F||e[29]!==m||e[30]!==y||e[31]!==c||e[32]!==a.id?(D=m?(0,u.jsx)(eo,{initial:H,onCancel:_,onCommit:T,placeholder:F,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:y,onDoubleClick:S,title:c("Double-click to rename"),type:"button",children:H===""?F:H}),e[25]=n,e[26]=T,e[27]=H,e[28]=F,e[29]=m,e[30]=y,e[31]=c,e[32]=a.id,e[33]=D):D=e[33];let A;e[34]!==t||e[35]!==k||e[36]!==f||e[37]!==C||e[38]!==c||e[39]!==a.id?(A=t&&(f?(0,u.jsx)(to,{idBase:a.id,onDiscard:k,onKeep:R}):(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:C,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]=k,e[36]=f,e[37]=C,e[38]=c,e[39]=a.id,e[40]=A):A=e[40];let Q;return e[41]!==E||e[42]!==K||e[43]!==$||e[44]!==D||e[45]!==A?(Q=(0,u.jsxs)("div",{className:K,"data-testid":$,onContextMenu:E,children:[D,A]}),e[41]=E,e[42]=K,e[43]=$,e[44]=D,e[45]=A,e[46]=Q):Q=e[46],Q},"es"),oo=i(s=>{let e=(0,X.c)(43),{model:n,onSelect:t}=s,o=se(),{activeTab:r,addEditorTab:l,cancelBulk:d,closeEditorTab:a,closeTabMenu:c,confirmBulk:m,menuStyle:p,onBackdropContextMenu:f,onCloseAll:v,onCloseOthers:g,onCloseToRight:E,openTabMenu:x,pendingBulk:y,renameTab:h,tabMenu:S,tabs:w}=n,C;if(e[0]!==r||e[1]!==a||e[2]!==t||e[3]!==x||e[4]!==h||e[5]!==w){let I;e[7]!==r||e[8]!==a||e[9]!==t||e[10]!==x||e[11]!==h||e[12]!==w.length?(I=i(H=>(0,u.jsx)(no,{active:H.id===r.id,canClose:w.length>1,onClose:a,onMenu:x,onRename:h,onSelect:t,tab:H},H.id),"A"),e[7]=r,e[8]=a,e[9]=t,e[10]=x,e[11]=h,e[12]=w.length,e[13]=I):I=e[13],C=w.map(I),e[0]=r,e[1]=a,e[2]=t,e[3]=x,e[4]=h,e[5]=w,e[6]=C}else C=e[6];let b;e[14]!==o?(b=o("New tab"),e[14]=o,e[15]=b):b=e[15];let k=w.length>=De,N;e[16]!==o?(N=o("New tab"),e[16]=o,e[17]=N):N=e[17];let R;e[18]===Symbol.for("react.memo_cache_sentinel")?(R=(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]=R):R=e[18];let q;e[19]!==l||e[20]!==b||e[21]!==k||e[22]!==N?(q=(0,u.jsx)("button",{"aria-label":b,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:k,onClick:l,title:N,type:"button",children:R}),e[19]=l,e[20]=b,e[21]=k,e[22]=N,e[23]=q):q=e[23];let T;e[24]!==C||e[25]!==q?(T=(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:[C,q]}),e[24]=C,e[25]=q,e[26]=T):T=e[26];let L;e[27]!==d||e[28]!==c||e[29]!==m||e[30]!==p||e[31]!==f||e[32]!==v||e[33]!==g||e[34]!==E||e[35]!==y||e[36]!==o||e[37]!==S||e[38]!==w?(L=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:y===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:w.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:w.findIndex(I=>I.id===S.id)>=w.length-1,onClick:E,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:v,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:d,type:"button",children:o("Cancel")})]})]})})]}),e[27]=d,e[28]=c,e[29]=m,e[30]=p,e[31]=f,e[32]=v,e[33]=g,e[34]=E,e[35]=y,e[36]=o,e[37]=S,e[38]=w,e[39]=L):L=e[39];let _;return e[40]!==T||e[41]!==L?(_=(0,u.jsxs)(u.Fragment,{children:[T,L]}),e[40]=T,e[41]=L,e[42]=_):_=e[42],_},"ts"),ro=me(he.runSql),so="lunora-studio-sql-split-view",lo=i(()=>ge(at[0]?.sql??""),"os"),io=i(()=>performance.now(),"ls"),ao=i(()=>{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,j.useRef)(e),t;return s[1]===Symbol.for("react.memo_cache_sentinel")?(t={advance:i(o=>{n.current.set(o,(n.current.get(o)??0)+1)},"advance"),begin:i(o=>{let r=n.current.get(o)??0;return()=>(n.current.get(o)??0)===r},"begin")},s[1]=t):t=s[1],t},"rs"),Do=i(({initialShardKey:s,now:e=io})=>{let n=xe(),t=En(lo),{activeTab:o,output:r,patchActiveOutput:l,patchActiveTab:d,setActiveTabId:a,unlinkQuery:c}=t,m=ao(),p=Dn({loadIntoActiveTab:i((W,J)=>{m.advance(o.id),d({activeId:J,sql:W}),l({chart:void 0,durationMs:void 0,error:null,failed:void 0,result:null,running:!1,script:void 0})},"loadIntoActiveTab"),unlinkQuery:c}),{recordHistory:f,updateQuerySql:v}=p,g=o.sql,{activeId:E}=o,{chart:x,error:y,failed:h,result:S,running:w}=r,C=r.pane,[b,k]=(0,j.useState)(s??""),[N,R]=ye(so,!1),{probe:q,schema:T}=mn(b),L=i(W=>{d({sql:W}),E!==null&&v(E,W)},"L"),_=Vt(g,T,b),I=We(b),H=i(()=>{S!==null&&ae((async()=>{let W=await I.inferChart({columns:S.columns,rowCount:S.rowCount,types:Object.fromEntries(S.columns.map(J=>[J,typeof(S.rows[0]?.[J]??"")]))});l({chart:W})})())},"W"),B=i(async W=>{let J=e();try{let G=await n.query(ro,{sql:W},fe(b)),ee=e()-J;return f(W),{durationMs:ee,error:null,result:G,sql:W}}catch(G){return{error:Ae(G),result:null,sql:W}}},"K"),F=i(async W=>{if(g.trim()==="")return;let J=m.begin(o.id);l({running:!0});let G=W==="explain"?_e(St(g),0):tt(g),ee=[];for(let P of G){let V={error:P.rejection?.message??"",result:null,sql:P.sql};ee.push(P.rejection===void 0?await B(P.sql):V)}if(Oe(b),!J())return;let le=Math.max(ee.length-1,0),te=ee[le];l({chart:void 0,durationMs:te?.durationMs,error:te?.error??null,failed:te?.error===null||te===void 0?void 0:{error:te.error,sql:te.sql},pane:W,result:te?.result??null,running:!1,script:ee.length>1?{runs:ee,selected:le}:void 0})},"$"),O=i(W=>{let J=r.script?.runs,G=J?.[W];J===void 0||G===void 0||l({chart:void 0,durationMs:G.durationMs,error:G.error,failed:G.error===null?void 0:{error:G.error,sql:G.sql},result:G.result,script:{runs:J,selected:W}})},"F"),K=i(()=>{ae(F("results"))},"H"),$=bn({inlineEditEnabled:!I.unavailable,onSubmit:i(()=>{ae(F(r.pane))},"onSubmit"),probe:q,schema:T,setDraft:L}),{closeAutocomplete:D,closeInlineEdit:A}=$,Q=i(()=>{L(Tt(g))},"P"),z=i(W=>{D(),A(),a(W)},"oe"),re=i(()=>{l({pane:"results"})},"Z"),Z=i(()=>{ae(F("explain"))},"ne"),oe=i(()=>{l({pane:"chart"})},"q"),M=i(()=>{R(!N)},"j"),Y=N?"flex min-h-0 flex-1 flex-row":"flex min-h-0 flex-1 flex-col",U=N?"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)(Gn,{activeId:E,history:p.history,listRef:p.listRef,onClearHistory:p.clearHistory,onDelete:p.deleteQuery,onLoadHistory:p.loadFromHistory,onLoadTemplate:p.loadTemplate,onNew:p.newQuery,onSearchChange:p.onSearchChange,onSelect:p.selectQuery,onToggleRememberHistory:p.setRememberHistory,queries:p.queries,rememberHistory:p.rememberHistory,search:p.search}),(0,u.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,u.jsx)(oo,{model:t,onSelect:z}),(0,u.jsxs)("div",{className:Y,children:[(0,u.jsx)(Qn,{assistant:I,autocomplete:$.autocompleteState,diagnostics:_,draft:g,editorRef:$.editorRef,failed:h,gutterRef:$.gutterRef,handlers:$.handlers,inlineEdit:$.inlineEdit,listboxId:$.listboxId,onAcceptInlineEdit:$.acceptInlineEdit,onCancelInlineEdit:$.closeInlineEdit,onGenerated:L,onPickSuggestion:$.onPickSuggestion,onRevealDiagnostic:$.revealDiagnostic,overlayRef:$.overlayRef}),(0,u.jsx)(Un,{assistant:I,chart:x,className:U,durationMs:r.durationMs,error:y,onFormat:Q,onInferChart:H,onRun:K,onSelectStatement:O,onShardKeyChange:k,onShowChart:oe,onShowExplain:Z,onShowResults:re,onToggleSplit:M,pane:C,result:S,running:w,script:r.script,shardKey:b,splitView:N})]})]})]})},"Es");export{Do as SqlEditorPanel};
@@ -0,0 +1 @@
1
+ import{a as y,b as D}from"./chunk-7RGYCU6F.js";import{a as _,b as z,c as j,d as E,e as B,f as H,g as L,h as V,i as O,j as T,k as Z,l as q}from"./chunk-HWTX54JM.js";import{i as P}from"./chunk-SDQH4HR6.js";import{a as k}from"./chunk-2O6KKVH2.js";import{b as w}from"./chunk-6I42AM75.js";import{b as N,f as $,s as I}from"./chunk-LPINY2IJ.js";import{a as u,d as S,e as le,f as se,g as de}from"./chunk-OXFKZ4BM.js";var v=S(se(),1);var b=S(le(),1);var s=S(de(),1);function ie(a){let e=(0,v.c)(10),t,n,r;e[0]!==a?({className:t,selected:r,...n}=a,e[0]=a,e[1]=t,e[2]=n,e[3]=r):(t=e[1],n=e[2],r=e[3]);let l=r===!0?"":void 0,o;e[4]!==t?(o=N("rounded-md border border-border bg-card text-card-foreground shadow-sm transition-colors","data-[selected]:border-ring data-[selected]:ring-[3px] data-[selected]:ring-ring/30",t),e[4]=t,e[5]=o):o=e[5];let d;return e[6]!==n||e[7]!==l||e[8]!==o?(d=(0,s.jsx)("div",{"data-slot":"base-node","data-selected":l,className:o,...n}),e[6]=n,e[7]=l,e[8]=o,e[9]=d):d=e[9],d}u(ie,"ie");function ce(a){let e=(0,v.c)(8),t,n;e[0]!==a?({className:t,...n}=a,e[0]=a,e[1]=t,e[2]=n):(t=e[1],n=e[2]);let r;e[3]!==t?(r=N("flex items-center gap-2 rounded-t-md bg-muted/50 px-3 py-1.5",t),e[3]=t,e[4]=r):r=e[4];let l;return e[5]!==n||e[6]!==r?(l=(0,s.jsx)("div",{"data-slot":"base-node-header",className:r,...n}),e[5]=n,e[6]=r,e[7]=l):l=e[7],l}u(ce,"ce");function me(a){let e=(0,v.c)(8),t,n;e[0]!==a?({className:t,...n}=a,e[0]=a,e[1]=t,e[2]=n):(t=e[1],n=e[2]);let r;e[3]!==t?(r=N("flex flex-col",t),e[3]=t,e[4]=r):r=e[4];let l;return e[5]!==n||e[6]!==r?(l=(0,s.jsx)("div",{"data-slot":"base-node-content",className:r,...n}),e[5]=n,e[6]=r,e[7]=l):l=e[7],l}u(me,"de");var ue=3,fe=u((a,e,t)=>{let n=e?a:a.slice(0,ue),r=n.map(o=>JSON.stringify(o)).join(" | "),l=a.length-n.length;return l>0?`${r} ${t("+{count} more",{count:l})}`:r},"fe"),J=u((a,e,t)=>{let n=a.enumValues??[],r=n.length===0?a.type:fe(n,e,t),l=a.ref===void 0?r:`${r} \u2192 ${a.ref}`;return a.optional===!0?`${l}?`:l},"H"),pe=u(a=>{let e=(0,v.c)(23),{data:t,selected:n}=a,r=$(),l;e[0]!==t.label||e[1]!==t.loadError||e[2]!==r?(l=t.loadError===!0?(0,s.jsx)("span",{className:"px-3 py-1.5 text-xs text-destructive","data-testid":`sd-node-${t.label}-error`,children:r("Columns unavailable")}):(0,s.jsx)("span",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"\u2014"}),e[0]=t.label,e[1]=t.loadError,e[2]=r,e[3]=l):l=e[3];let o=l,d=`sd-node-${t.label}`,c;e[4]!==t.label?(c=(0,s.jsx)("span",{className:"truncate font-mono text-xs font-semibold",title:t.label,children:t.label}),e[4]=t.label,e[5]=c):c=e[5];let m;e[6]!==t.tier?(m=(0,s.jsx)("span",{className:"ms-auto",children:(0,s.jsx)(D,{tier:t.tier})}),e[6]=t.tier,e[7]=m):m=e[7];let i;e[8]!==c||e[9]!==m?(i=(0,s.jsxs)(ce,{children:[c,m]}),e[8]=c,e[9]=m,e[10]=i):i=e[10];let f;e[11]!==t.columns||e[12]!==t.label||e[13]!==o||e[14]!==r?(f=t.columns.length===0?o:t.columns.map(h=>(0,s.jsxs)("div",{className:N("relative flex items-center gap-2 border-t border-border px-3 py-1.5 text-xs first:border-t-0",h.pk===!0&&"bg-muted/30"),"data-testid":`sd-col-${t.label}-${h.name}`,children:[(0,s.jsx)(E,{className:"!h-2 !w-2 !-left-1 !border-border !bg-muted-foreground/70",id:h.name,isConnectable:!1,position:_.Left,type:"target"}),(0,s.jsx)("span",{className:"truncate font-mono",title:h.name,children:h.name}),h.pk===!0&&(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),h.ref!==void 0&&(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),(0,s.jsx)("span",{className:"ms-auto truncate text-muted-foreground",title:J(h,!0,r),children:J(h,!1,r)}),(0,s.jsx)(E,{className:"!h-2 !w-2 !-right-1 !border-border !bg-muted-foreground/70",id:h.name,isConnectable:!1,position:_.Right,type:"source"})]},h.name)),e[11]=t.columns,e[12]=t.label,e[13]=o,e[14]=r,e[15]=f):f=e[15];let p;e[16]!==f?(p=(0,s.jsx)(me,{children:f}),e[16]=f,e[17]=p):p=e[17];let x;return e[18]!==n||e[19]!==d||e[20]!==i||e[21]!==p?(x=(0,s.jsxs)(ie,{className:"w-64 overflow-hidden","data-testid":d,selected:n,children:[i,p]}),e[18]=n,e[19]=d,e[20]=i,e[21]=p,e[22]=x):x=e[22],x},"ue"),G=256,Q=112,W=36,M=24,he=480,be=1.4,ge=u(a=>{let e=Math.max(1,Math.round(Math.sqrt(be*a/(G+Q))));return Math.max(he,a/e)},"ge"),xe=38,Ne=28,A=u(a=>xe+Math.max(1,a)*Ne,"B"),ye=u((a,e)=>{let t=new Map;for(let o of a)t.set(o,[]);for(let o of e)o.to!==o.from&&t.has(o.from)&&t.has(o.to)&&t.get(o.from)?.push(o.to);let n=new Map,r=new Set,l=u(o=>{let d=n.get(o);if(d!==void 0)return d;if(r.has(o))return 0;r.add(o);let c=0;for(let m of t.get(o)??[])c=Math.max(c,l(m)+1);return r.delete(o),n.set(o,c),c},"r");for(let o of a)l(o);return n},"Ne"),ve=u((a,e,t)=>{let n=ye(a,e),r=new Map;for(let m of a){let i=n.get(m)??0,f=r.get(i);f===void 0?r.set(i,[m]):f.push(m)}let l=a.reduce((m,i)=>m+A(t.get(i)??0)+W,0),o=ge(l),d=[],c=0;for(let m of[...r.keys()].toSorted((i,f)=>i-f)){let i=0,f=M;for(let p of r.get(m)??[]){let x=A(t.get(p)??0);f>M&&f+x>o&&(i+=1,f=M),d.push({name:p,x:M+(c+i)*(G+Q),y:f}),f+=x+W}c+=i+1}return d},"ye"),we={databaseSchema:pe},U={backgroundColor:y.shard.color},X={backgroundColor:y.global.color},$e={global:!0,shard:!0},Me={},Ce=u(a=>{let e=a.find(t=>t.pk===!0)?.name;return e!==void 0?e:a.some(t=>t.name==="_id")?"_id":a.some(t=>t.name==="id")?"id":a[0]?.name??"_id"},"_e"),Y=u(a=>a.flatMap(e=>e.columns.filter(t=>t.ref!==void 0).map(t=>({column:t.name,from:e.name,to:t.ref}))),"K"),Se=u((a,e,t)=>{let n=a.map(d=>d.name),r=new Map(a.map(d=>[d.name,d.columns.length])),l=ve(n,Y(a),r),o=new Map(a.map(d=>[d.name,d]));return l.flatMap(({name:d,x:c,y:m})=>{let i=o.get(d);return i===void 0?[]:[{className:t[d],data:{columns:i.columns,label:d,loadError:e,tier:i.tier},id:d,position:{x:c,y:m},type:"databaseSchema"}]})},"we"),ke=u(a=>{let e=new Map(a.map(t=>[t.name,t.columns]));return Y(a).flatMap(t=>{let n=e.get(t.to)??[],r=e.get(t.from)??[],l=Ce(n);return!n.some(o=>o.name===l)||!r.some(o=>o.name===t.column)?[]:[{id:`${t.from}.${t.column}->${t.to}`,source:t.to,sourceHandle:l,target:t.from,targetHandle:t.column}]})},"Me"),_e=u(()=>{let a=(0,v.c)(15),e=$(),t;a[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:U}),y.shard.label]}),a[0]=t):t=a[0];let n;a[1]===Symbol.for("react.memo_cache_sentinel")?(n=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:X}),y.global.label]}),a[1]=n):n=a[1];let r;a[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),a[2]=r):r=a[2];let l;a[3]!==e?(l=e("Primary key"),a[3]=e,a[4]=l):l=a[4];let o;a[5]!==l?(o=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[r,l]}),a[5]=l,a[6]=o):o=a[6];let d;a[7]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),a[7]=d):d=a[7];let c;a[8]!==e?(c=e("Foreign key"),a[8]=e,a[9]=c):c=a[9];let m;a[10]!==c?(m=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[d,c]}),a[10]=c,a[11]=m):m=a[11];let i;return a[12]!==o||a[13]!==m?(i=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-xl border border-border bg-card/95 px-2.5 py-1.5 text-[11px] text-muted-foreground shadow-xs",children:[t,n,o,m]}),a[12]=o,a[13]=m,a[14]=i):i=a[14],i},"Ce"),ze=12,Ee=u(a=>{let e=(0,v.c)(9),{containerRef:t,seedKey:n}=a,r=V(),{fitView:l}=j(),o;e[0]!==t||e[1]!==l||e[2]!==r?(o=u(()=>{if(!r)return;let c=u(()=>{I(l({duration:0,maxZoom:1.6,padding:.14}))},"d");c();let m=t.current;if(m===null)return;let i=new ResizeObserver(()=>{c()});return i.observe(m),()=>{i.disconnect()}},"a"),e[0]=t,e[1]=l,e[2]=r,e[3]=o):o=e[3];let d;return e[4]!==t||e[5]!==l||e[6]!==r||e[7]!==n?(d=[t,l,r,n],e[4]=t,e[5]=l,e[6]=r,e[7]=n,e[8]=d):d=e[8],(0,b.useEffect)(o,d),null},"Te"),Ve=u(({columnsError:a,fill:e=!1,nodeClasses:t,tables:n,testIdPrefix:r})=>{let l=$(),[o,d]=(0,b.useState)($e),[c,m]=(0,b.useState)(""),i=(0,b.useMemo)(()=>{let g=c.trim().toLowerCase();return n.filter(K=>o[K.tier]&&K.name.toLowerCase().includes(g))},[n,o,c]),f=(0,b.useMemo)(()=>Se(i,a??!1,t??Me),[i,a,t]),p=(0,b.useMemo)(()=>ke(i),[i]),x=i.map(g=>g.name).join(","),[h,R,ee]=H(f),[te,F,ae]=L(p),C=(0,b.useRef)(null);(0,b.useEffect)(()=>{R(f)},[f,R]),(0,b.useEffect)(()=>{F(p)},[p,F]);let re=u(g=>{m(g.target.value)},"V"),oe=u(()=>{d(g=>({...g,shard:!g.shard}))},"W"),ne=u(()=>{d(g=>({...g,global:!g.global}))},"Y");return n.length===0?(0,s.jsx)("section",{className:"flex flex-col gap-2","data-testid":`${r}-section`,children:(0,s.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":`${r}-empty`,children:l("No tables to graph.")})}):(0,s.jsx)("section",{className:N("flex flex-col",e&&"min-h-0 flex-1"),"data-testid":`${r}-section`,children:(0,s.jsx)("div",{className:N("w-full overflow-hidden border border-border bg-muted/20",e?"min-h-0 flex-1":"h-[560px]"),"data-testid":`${r}-canvas`,ref:C,children:(0,s.jsxs)(B,{edges:te,elementsSelectable:!0,fitView:!0,minZoom:.2,nodes:h,nodesConnectable:!1,nodeTypes:we,onEdgesChange:ae,onNodesChange:ee,children:[(0,s.jsx)(O,{}),(0,s.jsx)(z,{position:"top-left",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card/95 p-2 shadow-xs",children:[(0,s.jsx)(P,{"aria-label":l("Find table\u2026"),className:"h-7 w-44 text-xs","data-testid":`${r}-find`,onChange:re,placeholder:l("Find table\u2026"),value:c}),(0,s.jsxs)("div",{"aria-label":l("Storage tiers"),className:"flex items-center gap-1.5",role:"group",children:[(0,s.jsxs)(k,{"aria-pressed":o.shard,className:"gap-1.5","data-testid":`${r}-tier-shard`,onClick:oe,size:"xs",type:"button",variant:o.shard?"default":"outline",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:U}),y.shard.label]}),(0,s.jsxs)(k,{"aria-pressed":o.global,className:"gap-1.5","data-testid":`${r}-tier-global`,onClick:ne,size:"xs",type:"button",variant:o.global?"default":"outline",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:X}),y.global.label]})]})]})}),(0,s.jsx)(z,{position:"bottom-center",children:(0,s.jsx)(_e,{})}),(0,s.jsx)(T,{showInteractive:!1}),i.length>ze&&(0,s.jsx)(Z,{className:"!border !border-border !bg-card",maskColor:"var(--color-muted)",nodeColor:"var(--color-muted-foreground)",nodeStrokeWidth:0,pannable:!0,zoomable:!0}),(0,s.jsx)(q,{containerRef:C,filenameBase:`${r}-schema-diagram`,testIdPrefix:r}),(0,s.jsx)(Ee,{containerRef:C,seedKey:x})]})})})},"Ke");export{Ve as a};
@@ -0,0 +1 @@
1
+ import{a as f}from"./chunk-MD67S53Z.js";import{a as u,d as x,f as h,g as N}from"./chunk-OXFKZ4BM.js";var b=x(h(),1);var t=x(N(),1);var v=u(g=>{let e=(0,b.c)(16),{chart:c,footer:n,label:i,testId:m,value:p}=g,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i}),e[0]=i,e[1]=r):r=e[1];let a;e[2]!==m||e[3]!==p?(a=(0,t.jsx)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":m,children:p}),e[2]=m,e[3]=p,e[4]=a):a=e[4];let s;e[5]!==c||e[6]!==a?(s=(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[a,c]}),e[5]=c,e[6]=a,e[7]=s):s=e[7];let l;e[8]!==r||e[9]!==s?(l=(0,t.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[r,s]}),e[8]=r,e[9]=s,e[10]=l):l=e[10];let o;e[11]!==n?(o=n!=null&&(0,t.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:n}),e[11]=n,e[12]=o):o=e[12];let d;return e[13]!==l||e[14]!==o?(d=(0,t.jsxs)(f,{className:"justify-between gap-0 py-0",children:[l,o]}),e[13]=l,e[14]=o,e[15]=d):d=e[15],d},"j");export{v as a};
@@ -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-KRPXOSBL.js";import{b as Y}from"./chunk-W2BCSK5S.js";import{a as Ye}from"./chunk-ZTOREMGH.js";import{F as U,H as j,M as V,N,e as de}from"./chunk-W7MRISE3.js";import{a as ue}from"./chunk-IBJVVHV5.js";import{a as v,c as E,e as le,i as pe,r as me,w as W}from"./chunk-ZBON5T5A.js";import{c as ce,g as w,i as D}from"./chunk-4C4THJUD.js";import{a as n,d as R,e as B,g as je}from"./chunk-OXFKZ4BM.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(ce(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=me(e),o=parseFloat(t.width)||0,r=parseFloat(t.height)||0,s=pe(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=le(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};