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

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 +1618 -0
  4. package/dist/index.d.ts +1010 -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-B8yyk5BX.mjs +1 -0
  62. package/dist/packem_shared/ApiDocsPanel-B_RaW7Br.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-Cc1qZX-4.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-Hq6gTlkb.mjs +1 -0
  74. package/dist/packem_shared/HomePanel-DeyYLVxc.mjs +1 -0
  75. package/dist/packem_shared/MigrationsPanel-CMZYYcQ5.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-BhTqTeGb.mjs +1 -0
  81. package/dist/packem_shared/StudioApp-B1d0beD4.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-0XMGe1hP.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-CA3ZKwVK.mjs +2 -0
  128. package/dist/packem_shared/table-D0SBiDu-.mjs +2 -0
  129. package/dist/packem_shared/table-list-sidebar-nA7g7uSk.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-DXnqbBs-.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-26OKWFLO.js +1 -0
  145. package/dist/standalone/chunk-2EL4EMYZ.js +1 -0
  146. package/dist/standalone/chunk-2O6KKVH2.js +1 -0
  147. package/dist/standalone/chunk-2WNL74MI.js +4 -0
  148. package/dist/standalone/chunk-2X6O33OX.js +1 -0
  149. package/dist/standalone/chunk-2ZO7XY3Z.js +1 -0
  150. package/dist/standalone/chunk-3GXPALXG.js +1 -0
  151. package/dist/standalone/chunk-3Y5K3IQO.js +1 -0
  152. package/dist/standalone/chunk-4C4THJUD.js +1 -0
  153. package/dist/standalone/chunk-4IEMXFUB.js +1 -0
  154. package/dist/standalone/chunk-4SQBAPY6.js +1 -0
  155. package/dist/standalone/chunk-4ZEL6BYL.js +1 -0
  156. package/dist/standalone/chunk-5DNGK3NT.js +1 -0
  157. package/dist/standalone/chunk-5J32EGHF.js +1 -0
  158. package/dist/standalone/chunk-5NZWQEEJ.js +1 -0
  159. package/dist/standalone/chunk-6I42AM75.js +1 -0
  160. package/dist/standalone/chunk-6M7FLLMT.js +1 -0
  161. package/dist/standalone/chunk-6QEXGYWH.js +1 -0
  162. package/dist/standalone/chunk-7AZYREIY.js +1 -0
  163. package/dist/standalone/chunk-7F3S5OQT.js +1 -0
  164. package/dist/standalone/chunk-7MN724WR.js +1 -0
  165. package/dist/standalone/chunk-7RGYCU6F.js +1 -0
  166. package/dist/standalone/chunk-A566HCBX.js +1 -0
  167. package/dist/standalone/chunk-AOHKAKKL.js +1 -0
  168. package/dist/standalone/chunk-AP4PC2M4.js +1 -0
  169. package/dist/standalone/chunk-B3AXFXAD.js +1 -0
  170. package/dist/standalone/chunk-B7MHW3A5.js +1 -0
  171. package/dist/standalone/chunk-BHOLL76W.js +8 -0
  172. package/dist/standalone/chunk-BTRYFPZH.js +1 -0
  173. package/dist/standalone/chunk-BVKQA5OL.js +1 -0
  174. package/dist/standalone/chunk-CGZVMM3P.js +1 -0
  175. package/dist/standalone/chunk-CIVMATZK.js +3 -0
  176. package/dist/standalone/chunk-CLINNLLE.js +1 -0
  177. package/dist/standalone/chunk-CTE6RPXC.js +1 -0
  178. package/dist/standalone/chunk-CW57Q264.js +1 -0
  179. package/dist/standalone/chunk-D7JK65OK.js +1 -0
  180. package/dist/standalone/chunk-DBVJ5VLI.js +1 -0
  181. package/dist/standalone/chunk-DS7HZKZ2.js +6 -0
  182. package/dist/standalone/chunk-DX55P3KZ.js +1 -0
  183. package/dist/standalone/chunk-E26OT26O.js +1 -0
  184. package/dist/standalone/chunk-E32FS6PE.js +5 -0
  185. package/dist/standalone/chunk-E3VSRIQU.js +1 -0
  186. package/dist/standalone/chunk-EDGOSJXL.js +1 -0
  187. package/dist/standalone/chunk-EOR73TZZ.js +1 -0
  188. package/dist/standalone/chunk-F5LTDUMB.js +1 -0
  189. package/dist/standalone/chunk-FLVDICZL.js +1 -0
  190. package/dist/standalone/chunk-FPIUVV7Q.js +1 -0
  191. package/dist/standalone/chunk-GMW2DYFU.js +1 -0
  192. package/dist/standalone/chunk-GPOSJNMV.js +14 -0
  193. package/dist/standalone/chunk-GQYA5W5T.js +1 -0
  194. package/dist/standalone/chunk-HFYFYNSX.js +1 -0
  195. package/dist/standalone/chunk-HKLF627N.js +1 -0
  196. package/dist/standalone/chunk-HKPDPKXD.js +1 -0
  197. package/dist/standalone/chunk-HLAAOW33.js +1 -0
  198. package/dist/standalone/chunk-HOPAJ5F6.js +15 -0
  199. package/dist/standalone/chunk-IBJVVHV5.js +1 -0
  200. package/dist/standalone/chunk-IH2CJZF2.js +1 -0
  201. package/dist/standalone/chunk-JAHK7RRJ.js +1 -0
  202. package/dist/standalone/chunk-JG2C7SS2.js +1 -0
  203. package/dist/standalone/chunk-JGMQQ3S7.js +1 -0
  204. package/dist/standalone/chunk-JTGGWF7R.js +1 -0
  205. package/dist/standalone/chunk-KFNDET5D.js +1 -0
  206. package/dist/standalone/chunk-KRPXOSBL.js +1 -0
  207. package/dist/standalone/chunk-KYONGQQ4.js +1 -0
  208. package/dist/standalone/chunk-LIGOLZND.js +1 -0
  209. package/dist/standalone/chunk-LKCO3E2B.js +1 -0
  210. package/dist/standalone/chunk-LOV52GLG.js +1 -0
  211. package/dist/standalone/chunk-LPINY2IJ.js +19 -0
  212. package/dist/standalone/chunk-LRXCL6IA.js +1 -0
  213. package/dist/standalone/chunk-LUHXNZI4.js +2 -0
  214. package/dist/standalone/chunk-MD67S53Z.js +1 -0
  215. package/dist/standalone/chunk-MDAXV2XH.js +4 -0
  216. package/dist/standalone/chunk-MFNO5BFR.js +8 -0
  217. package/dist/standalone/chunk-MMJTKSHL.js +1 -0
  218. package/dist/standalone/chunk-NGVP66OH.js +1 -0
  219. package/dist/standalone/chunk-NMVFSJM7.js +1 -0
  220. package/dist/standalone/chunk-NVHHB5EV.js +2 -0
  221. package/dist/standalone/chunk-O3FDK56W.js +1 -0
  222. package/dist/standalone/chunk-OECMBE6Q.js +1 -0
  223. package/dist/standalone/chunk-OSJ7HV7B.js +1 -0
  224. package/dist/standalone/chunk-OUFWXYEF.js +1 -0
  225. package/dist/standalone/chunk-OXFKZ4BM.js +1 -0
  226. package/dist/standalone/chunk-P5GAJKDW.js +1 -0
  227. package/dist/standalone/chunk-P6L6ABWO.js +1 -0
  228. package/dist/standalone/chunk-PZZWUL5U.js +1 -0
  229. package/dist/standalone/chunk-QAQVT4FS.js +1 -0
  230. package/dist/standalone/chunk-R36QXQZX.js +1 -0
  231. package/dist/standalone/chunk-R3KLR5EP.js +1 -0
  232. package/dist/standalone/chunk-RXVXXRYD.js +1 -0
  233. package/dist/standalone/chunk-S7XAAH7U.js +1 -0
  234. package/dist/standalone/chunk-SDQH4HR6.js +3 -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-SOO2HXV6.js +1 -0
  239. package/dist/standalone/chunk-SXD6JQXF.js +1 -0
  240. package/dist/standalone/{chunk-BJGBHGK3.js → chunk-SYGCASPT.js} +1 -1
  241. package/dist/standalone/chunk-TDVDZ7XQ.js +1 -0
  242. package/dist/standalone/chunk-TRZTGE4R.js +1 -0
  243. package/dist/standalone/chunk-TWMS2TMF.js +1 -0
  244. package/dist/standalone/chunk-U76DVXTR.js +21 -0
  245. package/dist/standalone/chunk-UTX6IBA3.js +1 -0
  246. package/dist/standalone/chunk-UYEZR3BI.js +1 -0
  247. package/dist/standalone/chunk-UZIBQZ2F.js +1 -0
  248. package/dist/standalone/chunk-VB6YJKPA.js +1 -0
  249. package/dist/standalone/chunk-VEWQWS3J.js +1 -0
  250. package/dist/standalone/chunk-W2BCSK5S.js +1 -0
  251. package/dist/standalone/chunk-W2XSKODB.js +1 -0
  252. package/dist/standalone/chunk-W7MRISE3.js +1 -0
  253. package/dist/standalone/chunk-W7Z35E2E.js +1 -0
  254. package/dist/standalone/chunk-WIET27J3.js +1 -0
  255. package/dist/standalone/chunk-WQGT24W6.js +1 -0
  256. package/dist/standalone/chunk-WS36BO4R.js +1 -0
  257. package/dist/standalone/chunk-WZTY3ZYI.js +1 -0
  258. package/dist/standalone/chunk-X5KWBDTF.js +1 -0
  259. package/dist/standalone/chunk-X74GEPSG.js +1 -0
  260. package/dist/standalone/chunk-XBZUJDHD.js +1 -0
  261. package/dist/standalone/chunk-XMEVNOCA.js +1 -0
  262. package/dist/standalone/chunk-XWEDIIIT.js +1 -0
  263. package/dist/standalone/chunk-XYR5NST4.js +1 -0
  264. package/dist/standalone/chunk-YHTHRYP5.js +1 -0
  265. package/dist/standalone/chunk-YJ2WHOGO.js +1 -0
  266. package/dist/standalone/chunk-YJWR6ZWC.js +1 -0
  267. package/dist/standalone/chunk-Z5EV64KS.js +1 -0
  268. package/dist/standalone/chunk-ZBFWT34B.js +59 -0
  269. package/dist/standalone/chunk-ZBON5T5A.js +1 -0
  270. package/dist/standalone/chunk-ZGSL4DPP.js +1 -0
  271. package/dist/standalone/chunk-ZMQ6PKLN.js +1 -0
  272. package/dist/standalone/chunk-ZTOREMGH.js +1 -0
  273. package/dist/standalone/chunk-ZTOXQK4V.js +1 -0
  274. package/dist/standalone/chunk-ZWDORIZY.js +1 -0
  275. package/dist/standalone/chunk-ZZAJHNZ6.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{b as h}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{b as A}from"./chunk-YJ2WHOGO.js";import{p as S}from"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import{a as y,e as I}from"./chunk-MD67S53Z.js";import{f as k}from"./chunk-LPINY2IJ.js";import{a as u,d as w,f as z,g as P}from"./chunk-OXFKZ4BM.js";var N=w(z(),1);var a=w(P(),1);var j=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],v=u(e=>{if(e===void 0)return"\u2014";let i=[[86400,"d"],[3600,"h"],[60,"m"]];for(let[t,d]of i)if(e>=t&&e%t===0)return`${String(e/t)}${d}`;return`${String(e)}s`},"v"),p=u(e=>{let i=(0,N.c)(8),{children:t,heading:d,testId:n}=e,l;i[0]!==d?(l=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d})}),i[0]=d,i[1]=l):l=i[1];let s;i[2]!==t?(s=(0,a.jsx)(I,{className:"p-3",children:t}),i[2]=t,i[3]=s):s=i[3];let c;return i[4]!==l||i[5]!==s||i[6]!==n?(c=(0,a.jsxs)(y,{className:"gap-0 py-0","data-testid":n,children:[l,s]}),i[4]=l,i[5]=s,i[6]=n,i[7]=c):c=i[7],c},"h"),o=u(e=>{let i=(0,N.c)(7),{label:t,value:d}=e,n;i[0]!==t?(n=(0,a.jsx)("span",{className:"text-sm",children:t}),i[0]=t,i[1]=n):n=i[1];let l;i[2]!==d?(l=(0,a.jsx)("span",{className:"text-sm text-muted-foreground tabular-nums",children:d}),i[2]=d,i[3]=l):l=i[3];let s;return i[4]!==n||i[5]!==l?(s=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[n,l]}),i[4]=n,i[5]=l,i[6]=s):s=i[6],s},"c"),M=u(()=>{let e=(0,N.c)(20),i=S(),t=k(),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-auth-config"],e[0]=d):d=e[0];let n;e[1]!==i?(n=u(()=>i.getAuthConfig(),"r"),e[1]=i,e[2]=n):n=e[2];let{data:l,error:s}=A(d,n),c;e[3]!==t?(c=u(r=>(0,a.jsx)(h,{variant:r?"success":"outline",children:t(r?"Enabled":"Disabled")}),"u"),e[3]=t,e[4]=c):c=e[4];let m=c,g;e[5]!==s?(g=s!==null&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:s}),e[5]=s,e[6]=g):g=e[6];let f;e[7]!==l||e[8]!==s||e[9]!==t?(f=s===null&&l===void 0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:t("Loading auth configuration\u2026")}),e[7]=l,e[8]=s,e[9]=t,e[10]=f):f=e[10];let x;e[11]!==l||e[12]!==s||e[13]!==m||e[14]!==t?(x=s===null&&l!==void 0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p,{heading:t("Enabled capabilities"),testId:"auth-config-capabilities",children:(0,a.jsx)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:j.map(r=>{let $=l.capabilities[r.key];return(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${r.key}`,children:[(0,a.jsx)("span",{className:"text-sm",children:t(r.label)}),m($)]},r.key)})})}),(0,a.jsx)(p,{heading:t("Plugins"),testId:"auth-config-plugins",children:l.plugins.length===0?(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:t("No plugins enabled.")}):(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:l.plugins.map(C)})}),(0,a.jsx)(p,{heading:t("Sign-in methods"),testId:"auth-config-signin",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Email & password"),value:m(l.emailAndPassword)}),(0,a.jsx)(o,{label:t("Social providers"),value:l.socialProviders.length===0?t("None"):(0,a.jsx)("span",{className:"flex flex-wrap justify-end gap-1",children:l.socialProviders.map(q)})})]})}),l.organization.enabled&&(0,a.jsx)(p,{heading:t("Organizations"),testId:"auth-config-org",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Teams"),value:m(l.organization.teams)}),(0,a.jsx)(o,{label:t("Custom roles"),value:m(l.organization.roles)})]})}),(0,a.jsx)(p,{heading:t("Session policy"),testId:"auth-config-session",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Expires in"),value:v(l.session.expiresIn)}),(0,a.jsx)(o,{label:t("Refresh after"),value:v(l.session.updateAge)}),(0,a.jsx)(o,{label:t("Fresh window"),value:v(l.session.freshAge)}),(0,a.jsx)(o,{label:t("Cookie cache"),value:m(l.session.cookieCache===!0)})]})}),(0,a.jsx)(p,{heading:t("Rate limit"),testId:"auth-config-ratelimit",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Status"),value:m(l.rateLimit.enabled)}),l.rateLimit.enabled&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o,{label:t("Max requests"),value:l.rateLimit.max??"\u2014"}),(0,a.jsx)(o,{label:t("Window"),value:v(l.rateLimit.window)})]})]})}),l.userFields.length>0&&(0,a.jsx)(p,{heading:t("Plugin user fields"),testId:"auth-config-user-fields",children:(0,a.jsx)("ul",{className:"flex flex-col gap-2",children:l.userFields.map(r=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${r.name}`,children:[(0,a.jsxs)("span",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-mono text-xs",children:r.name}),r.plugin!==void 0&&(0,a.jsx)("span",{className:"text-[11px] text-muted-foreground",children:r.plugin})]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(h,{variant:"outline",children:r.type}),r.required&&(0,a.jsx)(h,{variant:"secondary",children:t("required")}),r.unique&&(0,a.jsx)(h,{variant:"secondary",children:t("unique")})]})]},r.name))})}),(0,a.jsx)(y,{className:"gap-0 py-0",children:(0,a.jsx)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:t("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.")})})]}),e[11]=l,e[12]=s,e[13]=m,e[14]=t,e[15]=x):x=e[15];let b;return e[16]!==g||e[17]!==f||e[18]!==x?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[g,f,x]}),e[16]=g,e[17]=f,e[18]=x,e[19]=b):b=e[19],b},"O");function C(e){return(0,a.jsx)(h,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e)}u(C,"P");function q(e){return(0,a.jsx)(h,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e)}u(q,"z");export{M as default};
@@ -0,0 +1 @@
1
+ import{a as s}from"./chunk-YJ2WHOGO.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{b as Me}from"./chunk-LRXCL6IA.js";import{a as ve}from"./chunk-R36QXQZX.js";import{b as ye,c as we}from"./chunk-IH2CJZF2.js";import{a as xe}from"./chunk-YJWR6ZWC.js";import{a as Ne}from"./chunk-XBZUJDHD.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import{a as be}from"./chunk-5DNGK3NT.js";import{a as fe}from"./chunk-KYONGQQ4.js";import{b as he}from"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import{i as me}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as oe}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as ge}from"./chunk-OECMBE6Q.js";import"./chunk-OSJ7HV7B.js";import"./chunk-7F3S5OQT.js";import"./chunk-E26OT26O.js";import{a as ce}from"./chunk-4ZEL6BYL.js";import{c as ie}from"./chunk-YJ2WHOGO.js";import"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import{a as ue}from"./chunk-3Y5K3IQO.js";import{b as te,f as U,p as pe,w as de}from"./chunk-LPINY2IJ.js";import{a as m,d as le,e as Ce,f as Le,g as Te}from"./chunk-OXFKZ4BM.js";var O=le(Le(),1),A=le(Ce(),1);var s=le(Te(),1);var Pe=.5,Ie=4,Se=m(n=>Math.min(100,Math.max(0,n)),"ce"),Ke=m((n,e)=>{if(!Number.isFinite(e)||e<=0)return{leftPercent:0,widthPercent:100};let t=Se(n.offsetMs/e*100),a=n.durationMs/e*100,l=Math.max(Pe,Math.min(Se(a),100-t));return{leftPercent:t,widthPercent:l}},"Ce"),De=m((n,e,t=!1)=>{let a=e.trim().toLowerCase(),l=t?n.filter(r=>!r.ok):n;return a===""?[...l]:l.filter(r=>r.rootName.toLowerCase().includes(a)||r.functionPath.toLowerCase().includes(a)||r.traceId.toLowerCase().includes(a)||r.spans.some(o=>o.name.toLowerCase().includes(a)||o.spanId.toLowerCase().includes(a)))},"Ee"),G=m(n=>Number.isFinite(n)?n>0&&n<1?`${n.toFixed(2)}ms`:`${String(Math.round(n))}ms`:"\u2014","q"),Fe=m(n=>!Number.isFinite(n)||n<=0?[]:Array.from({length:Ie},(e,t)=>{let a=(t+1)/Ie;return{label:G(n*a),percent:a*100}}),"Pe"),ke=m(n=>{if(typeof n=="string")return n;try{return JSON.stringify(n,pe)}catch{return String(n)}},"ue"),ee=m(n=>{let e=(0,O.c)(7),{label:t,value:a}=n,l;e[0]!==t?(l=(0,s.jsx)("dt",{className:"w-40 shrink-0 text-muted-foreground",children:t}),e[0]=t,e[1]=l):l=e[1];let r;e[2]!==a?(r=(0,s.jsx)("dd",{className:"min-w-0 break-all",children:a}),e[2]=a,e[3]=r):r=e[3];let o;return e[4]!==l||e[5]!==r?(o=(0,s.jsxs)("div",{className:"flex gap-2",children:[l,r]}),e[4]=l,e[5]=r,e[6]=o):o=e[6],o},"Y"),je=m(n=>{let e=(0,O.c)(68),{span:t}=n,a=U(),l,r,o,d,i,u;if(e[0]!==t.attributes||e[1]!==t.durationMs||e[2]!==t.error||e[3]!==t.events||e[4]!==t.kind||e[5]!==t.offsetMs||e[6]!==t.parentSpanId||e[7]!==t.spanId||e[8]!==a){let $=Object.entries(t.attributes??{}),_;e[15]!==t.events?(_=t.events??[],e[15]=t.events,e[16]=_):_=e[16],l=_,r="border-t border-border bg-background/60 px-3 py-2 font-mono text-xs",o="tr-span-detail";let y;e[17]!==a?(y=a("Span ID"),e[17]=a,e[18]=y):y=e[18];let w;e[19]!==t.spanId||e[20]!==y?(w=(0,s.jsx)(ee,{label:y,value:t.spanId}),e[19]=t.spanId,e[20]=y,e[21]=w):w=e[21];let M;e[22]!==a?(M=a("Parent span ID"),e[22]=a,e[23]=M):M=e[23];let p;e[24]!==t.parentSpanId||e[25]!==a?(p=t.parentSpanId===""?a("\u2014 (trace root)"):t.parentSpanId,e[24]=t.parentSpanId,e[25]=a,e[26]=p):p=e[26];let h;e[27]!==p||e[28]!==M?(h=(0,s.jsx)(ee,{label:M,value:p}),e[27]=p,e[28]=M,e[29]=h):h=e[29];let b;e[30]!==a?(b=a("Kind"),e[30]=a,e[31]=b):b=e[31];let C=t.kind??"internal",S;e[32]!==b||e[33]!==C?(S=(0,s.jsx)(ee,{label:b,value:C}),e[32]=b,e[33]=C,e[34]=S):S=e[34];let I;e[35]!==a?(I=a("Started at"),e[35]=a,e[36]=I):I=e[36];let g;e[37]!==t.offsetMs||e[38]!==a?(g=a("+{offset}",{offset:G(t.offsetMs)}),e[37]=t.offsetMs,e[38]=a,e[39]=g):g=e[39];let x;e[40]!==I||e[41]!==g?(x=(0,s.jsx)(ee,{label:I,value:g}),e[40]=I,e[41]=g,e[42]=x):x=e[42];let k;e[43]!==a?(k=a("Duration"),e[43]=a,e[44]=k):k=e[44];let f;e[45]!==t.durationMs?(f=G(t.durationMs),e[45]=t.durationMs,e[46]=f):f=e[46];let N;e[47]!==k||e[48]!==f?(N=(0,s.jsx)(ee,{label:k,value:f}),e[47]=k,e[48]=f,e[49]=N):N=e[49],e[50]!==h||e[51]!==S||e[52]!==x||e[53]!==N||e[54]!==w?(d=(0,s.jsxs)("dl",{className:"flex flex-col gap-1",children:[w,h,S,x,N]}),e[50]=h,e[51]=S,e[52]=x,e[53]=N,e[54]=w,e[55]=d):d=e[55],e[56]!==t.error?(i=t.error!==void 0&&(0,s.jsxs)("div",{className:"mt-2 rounded-md border border-destructive/40 bg-destructive/10 px-2 py-1.5","data-testid":"tr-detail-error",children:[(0,s.jsx)("span",{className:"font-semibold text-destructive",children:t.error.type}),(0,s.jsx)("p",{className:"whitespace-pre-wrap break-all text-destructive",children:t.error.message})]}),e[56]=t.error,e[57]=i):i=e[57],u=$.length>0&&(0,s.jsxs)("div",{className:"mt-2","data-testid":"tr-detail-attributes",children:[(0,s.jsx)("p",{className:"mb-1 text-muted-foreground",children:a("Attributes")}),(0,s.jsx)("dl",{className:"flex flex-col gap-1",children:$.map(Ee)})]}),e[0]=t.attributes,e[1]=t.durationMs,e[2]=t.error,e[3]=t.events,e[4]=t.kind,e[5]=t.offsetMs,e[6]=t.parentSpanId,e[7]=t.spanId,e[8]=a,e[9]=l,e[10]=r,e[11]=o,e[12]=d,e[13]=i,e[14]=u}else l=e[9],r=e[10],o=e[11],d=e[12],i=e[13],u=e[14];let c;e[58]!==l||e[59]!==a?(c=l.length>0&&(0,s.jsxs)("div",{className:"mt-2","data-testid":"tr-detail-events",children:[(0,s.jsx)("p",{className:"mb-1 text-muted-foreground",children:a("Events")}),(0,s.jsx)("ul",{className:"flex flex-col gap-1",children:l.map(Oe)})]}),e[58]=l,e[59]=a,e[60]=c):c=e[60];let v;return e[61]!==r||e[62]!==o||e[63]!==d||e[64]!==i||e[65]!==u||e[66]!==c?(v=(0,s.jsxs)("div",{className:r,"data-testid":o,children:[d,i,u,c]}),e[61]=r,e[62]=o,e[63]=d,e[64]=i,e[65]=u,e[66]=c,e[67]=v):v=e[67],v},"Fe");function Ee(n){let[e,t]=n;return(0,s.jsx)(ee,{label:e,value:ke(t)},e)}m(Ee,"Ke");function Ae(n){let[e,t]=n;return`${e}=${ke(t)}`}m(Ae,"Re");function Oe(n){return(0,s.jsxs)("li",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:de(n.ts)}),(0,s.jsx)(oe,{variant:"secondary",children:n.name}),(0,s.jsx)("span",{className:"min-w-0 break-all text-muted-foreground",children:Object.entries(n.attributes??{}).map(Ae).join(" ")})]},`${n.name}:${String(n.ts)}`)}m(Oe,"Ae");var Be=14,_e="grid grid-cols-[14rem_1fr_4rem_16rem_16rem] items-center gap-2 px-3",We=m(n=>{let e=(0,O.c)(17),{traceDurationMs:t}=n,a,l,r,o,d,i;if(e[0]!==t){i=Symbol.for("react.early_return_sentinel");e:{let v=Fe(t);if(v.length===0){i=null;break e}e[7]===Symbol.for("react.memo_cache_sentinel")?(r=te(_e,"border-b border-border py-1 font-mono text-[10px] text-muted-foreground"),e[7]=r):r=e[7],o="tr-ruler",e[8]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsx)("span",{}),e[8]=d):d=e[8],a="relative h-3",l=v.map(Je)}e[0]=t,e[1]=a,e[2]=l,e[3]=r,e[4]=o,e[5]=d,e[6]=i}else a=e[1],l=e[2],r=e[3],o=e[4],d=e[5],i=e[6];if(i!==Symbol.for("react.early_return_sentinel"))return i;let u;e[9]!==a||e[10]!==l?(u=(0,s.jsx)("span",{className:a,children:l}),e[9]=a,e[10]=l,e[11]=u):u=e[11];let c;return e[12]!==r||e[13]!==o||e[14]!==d||e[15]!==u?(c=(0,s.jsxs)("div",{className:r,"data-testid":o,children:[d,u]}),e[12]=r,e[13]=o,e[14]=d,e[15]=u,e[16]=c):c=e[16],c},"je"),qe=m(n=>{let e=(0,O.c)(60),{span:t,traceDurationMs:a}=n,l=U(),[r,o]=(0,A.useState)(!1),d;e[0]!==t||e[1]!==a?(d=Ke(t,a),e[0]=t,e[1]=a,e[2]=d):d=e[2];let{leftPercent:i,widthPercent:u}=d,c;e[3]!==t.attributes?(c=ve(t.attributes),e[3]=t.attributes,e[4]=c):c=e[4];let v=c,$=t.depth*Be,_;e[5]!==$?(_={paddingLeft:$},e[5]=$,e[6]=_):_=e[6];let y=_,w=`${String(i)}%`,M=`${String(u)}%`,p;e[7]!==w||e[8]!==M?(p={left:w,width:M},e[7]=w,e[8]=M,e[9]=p):p=e[9];let h=p,b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=m(()=>{o(Ue)},"h"),e[10]=b):b=e[10];let C=b,S=t.depth,I=`tr-span-detail-${t.spanId}`,g;e[11]!==t.durationMs||e[12]!==t.error||e[13]!==t.name||e[14]!==t.offsetMs||e[15]!==l?(g=l("{name}, {duration}, starts {offset} in{failure}",{duration:G(t.durationMs),failure:t.error===void 0?"":l(", failed: {message}",{message:t.error.message}),name:t.name,offset:G(t.offsetMs)}),e[11]=t.durationMs,e[12]=t.error,e[13]=t.name,e[14]=t.offsetMs,e[15]=l,e[16]=g):g=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=te(_e,"w-full border-b border-border py-1.5 text-left font-mono text-xs hover:bg-muted/50"),e[17]=x):x=e[17];let k=`tr-span-toggle-${t.spanId}`,f;e[18]!==t.ok?(f=t.ok?null:(0,s.jsx)("span",{"aria-hidden":"true",className:"mr-1 text-destructive","data-testid":"tr-span-error",children:"\u25CF"}),e[18]=t.ok,e[19]=f):f=e[19];let N;e[20]!==y||e[21]!==t.name||e[22]!==f?(N=(0,s.jsxs)("span",{className:"truncate",style:y,title:t.name,children:[f,t.name]}),e[20]=y,e[21]=t.name,e[22]=f,e[23]=N):N=e[23];let B=t.ok?"bg-primary/70":"bg-destructive",L;e[24]!==B?(L=te("absolute inset-y-0 rounded-sm",B),e[24]=B,e[25]=L):L=e[25];let E;e[26]!==h||e[27]!==i||e[28]!==L||e[29]!==u?(E=(0,s.jsx)("span",{"aria-hidden":"true",className:"relative h-3 overflow-hidden rounded-sm bg-muted",children:(0,s.jsx)("span",{className:L,"data-left":i,"data-testid":"tr-span-bar","data-width":u,style:h})}),e[26]=h,e[27]=i,e[28]=L,e[29]=u,e[30]=E):E=e[30];let W;e[31]!==t.durationMs?(W=G(t.durationMs),e[31]=t.durationMs,e[32]=W):W=e[32];let D;e[33]!==W?(D=(0,s.jsx)("span",{className:"text-right tabular-nums text-muted-foreground",children:W}),e[33]=W,e[34]=D):D=e[34];let q;e[35]!==t.error?(q=t.error===void 0?null:(0,s.jsx)("span",{className:"text-destructive","data-testid":"tr-span-error-message",title:t.error.message,children:`${t.error.type}: ${t.error.message}`}),e[35]=t.error,e[36]=q):q=e[36];let T;e[37]!==q?(T=(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:q}),e[37]=q,e[38]=T):T=e[38];let z;e[39]!==v?(z=v===""?null:(0,s.jsx)("span",{"data-testid":"tr-span-attributes",title:v,children:v}),e[39]=v,e[40]=z):z=e[40];let P;e[41]!==z?(P=(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:z}),e[41]=z,e[42]=P):P=e[42];let J;e[43]!==r||e[44]!==I||e[45]!==g||e[46]!==k||e[47]!==N||e[48]!==E||e[49]!==D||e[50]!==T||e[51]!==P?(J=(0,s.jsxs)("button",{"aria-controls":I,"aria-expanded":r,"aria-label":g,className:x,"data-testid":k,onClick:C,type:"button",children:[N,E,D,T,P]}),e[43]=r,e[44]=I,e[45]=g,e[46]=k,e[47]=N,e[48]=E,e[49]=D,e[50]=T,e[51]=P,e[52]=J):J=e[52];let F;e[53]!==r||e[54]!==t?(F=r&&(0,s.jsx)("div",{id:`tr-span-detail-${t.spanId}`,children:(0,s.jsx)(je,{span:t})}),e[53]=r,e[54]=t,e[55]=F):F=e[55];let K;return e[56]!==t.depth||e[57]!==J||e[58]!==F?(K=(0,s.jsxs)("li",{"data-depth":S,"data-testid":"tr-span-row",children:[J,F]}),e[56]=t.depth,e[57]=J,e[58]=F,e[59]=K):K=e[59],K},"Be"),ze=m(n=>{let e=(0,O.c)(15),{durationMs:t,spans:a}=n,l=U(),r;e[0]!==t?(r=(0,s.jsx)(We,{traceDurationMs:t}),e[0]=t,e[1]=r):r=e[1];let o;e[2]!==l?(o=l("Trace waterfall"),e[2]=l,e[3]=o):o=e[3];let d;if(e[4]!==t||e[5]!==a){let c;e[7]!==t?(c=m(v=>(0,s.jsx)(qe,{span:v,traceDurationMs:t},v.spanId),"c"),e[7]=t,e[8]=c):c=e[8],d=a.map(c),e[4]=t,e[5]=a,e[6]=d}else d=e[6];let i;e[9]!==o||e[10]!==d?(i=(0,s.jsx)("ul",{"aria-label":o,children:d}),e[9]=o,e[10]=d,e[11]=i):i=e[11];let u;return e[12]!==r||e[13]!==i?(u=(0,s.jsxs)(s.Fragment,{children:[r,i]}),e[12]=r,e[13]=i,e[14]=u):u=e[14],u},"Oe");function Je(n){return(0,s.jsx)("span",{className:te("absolute inset-y-0 border-l border-border/70",n.percent===100?"-translate-x-full pr-1":"pl-1"),style:{left:`${String(n.percent)}%`},children:n.label},n.percent)}m(Je,"We");function Ue(n){return!n}m(Ue,"Ue");var Ge=m(n=>Array.isArray(n?.traces)?n.traces:[],"qe"),He=m(n=>{let e=(0,O.c)(12),{entries:t}=n,a=U(),l;e[0]!==t.length||e[1]!==a?(l=a("Logs ({count})",{count:t.length}),e[0]=t.length,e[1]=a,e[2]=l):l=e[2];let r;e[3]!==l?(r=(0,s.jsx)("p",{className:"mb-1 font-mono text-xs text-muted-foreground",children:l}),e[3]=l,e[4]=r):r=e[4];let o;e[5]!==t?(o=t.map(Ve),e[5]=t,e[6]=o):o=e[6];let d;e[7]!==o?(d=(0,s.jsx)("div",{role:"grid",children:o}),e[7]=o,e[8]=d):d=e[8];let i;return e[9]!==r||e[10]!==d?(i=(0,s.jsxs)("div",{className:"border-t border-border px-3 py-2","data-testid":"tr-logs",children:[r,d]}),e[9]=r,e[10]=d,e[11]=i):i=e[11],i},"ze"),Qe=m(n=>{let e=(0,O.c)(50),{expanded:t,logs:a,onToggle:l,trace:r}=n,o=U(),d;e[0]!==l||e[1]!==r.traceId?(d=m(()=>{l(r.traceId)},"i"),e[0]=l,e[1]=r.traceId,e[2]=d):d=e[2];let i=d,u=`tr-row-${r.traceId}`,c=`tr-waterfall-${r.traceId}`,v=`tr-toggle-${r.traceId}`,$=t?"\u25BE":"\u25B8",_;e[3]!==$?(_=(0,s.jsx)("span",{"aria-hidden":"true",className:"w-3 shrink-0 text-xs text-muted-foreground",children:$}),e[3]=$,e[4]=_):_=e[4];let y;e[5]!==r.rootName?(y=(0,s.jsx)("span",{className:"w-56 shrink-0 truncate text-sm font-medium",title:r.rootName,children:r.rootName}),e[5]=r.rootName,e[6]=y):y=e[6];let w;e[7]!==r.functionPath?(w=(0,s.jsx)("span",{className:"w-48 shrink-0 truncate font-mono text-xs text-muted-foreground",title:r.functionPath,children:r.functionPath}),e[7]=r.functionPath,e[8]=w):w=e[8];let M;e[9]!==r.durationMs?(M=G(r.durationMs),e[9]=r.durationMs,e[10]=M):M=e[10];let p;e[11]!==M?(p=(0,s.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:M}),e[11]=M,e[12]=p):p=e[12];let h;e[13]!==o||e[14]!==r.spans.length?(h=o("{count} spans",{count:r.spans.length}),e[13]=o,e[14]=r.spans.length,e[15]=h):h=e[15];let b;e[16]!==h?(b=(0,s.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:h}),e[16]=h,e[17]=b):b=e[17];let C=r.ok?"secondary":"destructive",S;e[18]!==o||e[19]!==r.ok?(S=r.ok?o("ok"):o("error"),e[18]=o,e[19]=r.ok,e[20]=S):S=e[20];let I;e[21]!==C||e[22]!==S?(I=(0,s.jsx)("span",{className:"shrink-0",children:(0,s.jsx)(oe,{variant:C,children:S})}),e[21]=C,e[22]=S,e[23]=I):I=e[23];let g;e[24]!==r.startTs?(g=de(r.startTs),e[24]=r.startTs,e[25]=g):g=e[25];let x;e[26]!==g?(x=(0,s.jsx)("span",{className:"flex-1 truncate text-right font-mono text-xs tabular-nums text-muted-foreground",children:g}),e[26]=g,e[27]=x):x=e[27];let k;e[28]!==t||e[29]!==i||e[30]!==p||e[31]!==b||e[32]!==I||e[33]!==x||e[34]!==c||e[35]!==v||e[36]!==_||e[37]!==y||e[38]!==w?(k=(0,s.jsxs)("button",{"aria-controls":c,"aria-expanded":t,className:"flex w-full items-center gap-3 px-3 py-2 text-left hover:bg-muted/50","data-testid":v,onClick:i,type:"button",children:[_,y,w,p,b,I,x]}),e[28]=t,e[29]=i,e[30]=p,e[31]=b,e[32]=I,e[33]=x,e[34]=c,e[35]=v,e[36]=_,e[37]=y,e[38]=w,e[39]=k):k=e[39];let f;e[40]!==t||e[41]!==a||e[42]!==r.durationMs||e[43]!==r.spans||e[44]!==r.traceId?(f=t&&(0,s.jsxs)("div",{className:"bg-muted/20","data-testid":`tr-waterfall-${r.traceId}`,id:`tr-waterfall-${r.traceId}`,children:[(0,s.jsx)(ze,{durationMs:r.durationMs,spans:r.spans}),a.length>0&&(0,s.jsx)(He,{entries:a})]}),e[40]=t,e[41]=a,e[42]=r.durationMs,e[43]=r.spans,e[44]=r.traceId,e[45]=f):f=e[45];let N;return e[46]!==k||e[47]!==f||e[48]!==u?(N=(0,s.jsxs)("div",{className:"border-b border-border last:border-b-0","data-testid":u,children:[k,f]}),e[46]=k,e[47]=f,e[48]=u,e[49]=N):N=e[49],N},"Ge"),bt=m(n=>{let e=(0,O.c)(58),{initialShardKey:t}=n,a=U(),[l]=(0,A.useState)(ye),{queryShardKey:r,setShardKey:o,shardKey:d}=be(l?.shardKey!==void 0&&l.shardKey!==""?l.shardKey:t??""),[i,u]=(0,A.useState)(l?.traceId??""),[c,v]=(0,A.useState)(!1),[$,_]=(0,A.useState)(Xe),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0],(0,A.useEffect)(Ye,y);let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w={},e[1]=w):w=e[1];let M;e[2]!==r?(M={live:!0,shardKey:r},e[2]=r,e[3]=M):M=e[3];let{data:p,error:h,errorSource:b,isLoading:C,liveError:S}=ie(ce.getTraces,w,M),I;e[4]===Symbol.for("react.memo_cache_sentinel")?(I={},e[4]=I):I=e[4];let g=$.size>0,x;e[5]!==r||e[6]!==g?(x={enabled:g,live:!0,shardKey:r},e[5]=r,e[6]=g,e[7]=x):x=e[7];let{data:k}=ie(ce.getLogs,I,x),f,N;e[8]!==p||e[9]!==r?(f=m(()=>{p!==void 0&&he(r)},"p"),N=[p,r],e[8]=p,e[9]=r,e[10]=f,e[11]=N):(f=e[10],N=e[11]),(0,A.useEffect)(f,N);let B;if(e[12]!==p||e[13]!==h||e[14]!==b||e[15]!==$||e[16]!==C||e[17]!==S||e[18]!==k?.entries||e[19]!==c||e[20]!==i||e[21]!==o||e[22]!==d||e[23]!==a){let L=Ge(p),E=p?.total??L.length,W=E>L.length,D=De(L,i,c),q=Map.groupBy((k?.entries??[]).toReversed(),Ze),T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=m(j=>{u(j.target.value)},"C"),e[25]=T):T=e[25];let z=T,P;e[26]===Symbol.for("react.memo_cache_sentinel")?(P=m(j=>{_($e=>{let ne=new Set($e);return ne.has(j)?ne.delete(j):ne.add(j),ne})},"E"),e[26]=P):P=e[26];let J=P,F=h===null&&D.length===0&&!C,K;e[27]!==o||e[28]!==d?(K=(0,s.jsx)(fe,{onChange:o,testId:"tr-shard-input",value:d}),e[27]=o,e[28]=d,e[29]=K):K=e[29];let H;e[30]!==a?(H=a("Search traces"),e[30]=a,e[31]=H):H=e[31];let Q;e[32]!==a?(Q=a("search trace, span, or function"),e[32]=a,e[33]=Q):Q=e[33];let V;e[34]!==i||e[35]!==H||e[36]!==Q?(V=(0,s.jsx)(me,{"aria-label":H,className:"h-8 w-56","data-testid":"tr-search",onChange:z,placeholder:Q,value:i}),e[34]=i,e[35]=H,e[36]=Q,e[37]=V):V=e[37];let X;e[38]!==c?(X=(0,s.jsx)(xe,{checked:c,"data-testid":"tr-only-errors",id:"tr-only-errors",onCheckedChange:v}),e[38]=c,e[39]=X):X=e[39];let Y;e[40]!==a?(Y=a("Errors only"),e[40]=a,e[41]=Y):Y=e[41];let Z;e[42]!==X||e[43]!==Y?(Z=(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",htmlFor:"tr-only-errors",children:[X,Y]}),e[42]=X,e[43]=Y,e[44]=Z):Z=e[44];let R;e[45]!==S?(R=(0,s.jsx)(Ne,{message:S,prefix:"tr"}),e[45]=S,e[46]=R):R=e[46];let re;e[47]!==K||e[48]!==V||e[49]!==Z||e[50]!==R?(re=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[K,V,Z,R]}),e[47]=K,e[48]=V,e[49]=Z,e[50]=R,e[51]=re):re=e[51];let ae;e[52]!==h||e[53]!==b?(ae=h!==null&&(0,s.jsx)(ge,{error:b,testId:"tr-error"}),e[52]=h,e[53]=b,e[54]=ae):ae=e[54];let se;e[55]!==F||e[56]!==a?(se=F&&(0,s.jsx)(ue,{description:a("Traces recorded with ctx.trace show up here as your app handles traffic. The span buffer resets when the shard hibernates."),icon:(0,s.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M4 6h10M7 12h13M10 18h7"})}),testId:"tr-empty",title:a("No traces")}),e[55]=F,e[56]=a,e[57]=se):se=e[57],B=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-traces-panel",children:[re,ae,se,h===null&&W&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"tr-truncated",children:a("Showing the {shown} most recent of {total} traces in the buffer.",{shown:L.length,total:E})}),h===null&&D.length>0&&(0,s.jsx)("div",{"aria-label":a("Recent traces"),className:"overflow-hidden rounded-xl border border-border shadow-xs","data-testid":"tr-list",children:D.map(j=>(0,s.jsx)(Qe,{expanded:$.has(j.traceId),logs:q.get(j.traceId)??[],onToggle:J,trace:j},j.traceId))})]}),e[12]=p,e[13]=h,e[14]=b,e[15]=$,e[16]=C,e[17]=S,e[18]=k?.entries,e[19]=c,e[20]=i,e[21]=o,e[22]=d,e[23]=a,e[24]=B}else B=e[24];return B},"bt");function Ve(n,e){return(0,s.jsx)("div",{className:"flex items-center border-b border-border py-1 font-mono text-xs last:border-b-0","data-testid":"tr-log-row",role:"row",children:(0,s.jsx)(Me,{entry:n})},`${String(e)}:${String(n.timestamp)}`)}m(Ve,"He");function Xe(){return new Set}m(Xe,"Je");function Ye(){we()}m(Ye,"Qe");function Ze(n){return n.traceId}m(Ze,"Ve");export{bt 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 @@
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};
@@ -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-U76DVXTR.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 g}from"./chunk-P5GAJKDW.js";import"./chunk-OECMBE6Q.js";import"./chunk-OSJ7HV7B.js";import"./chunk-7F3S5OQT.js";import"./chunk-E26OT26O.js";import{a as f}from"./chunk-4ZEL6BYL.js";import{c as m}from"./chunk-YJ2WHOGO.js";import"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import"./chunk-CW57Q264.js";import"./chunk-MD67S53Z.js";import{f as p}from"./chunk-LPINY2IJ.js";import{a as r,d as h,f as S,g as A}from"./chunk-OXFKZ4BM.js";var R=h(S(),1);var k=h(A(),1);var _=r((e,s)=>({"admin-token-weak":e("Weak admin token"),"auth-secret-weak":e("Weak auth secret"),"cookies-insecure":e("Session cookies are not Secure"),"cors-wildcard-credentials":e("Wildcard CORS with credentials"),"csrf-disabled":e("CSRF/origin guard is off"),"dev-args-unredacted":e("Request log keeps un-redacted args"),"security-headers-disabled":e("Security headers are off"),"ws-gate-open":e("User subscriptions are ungated")})[s.kind],"k"),w=r(e=>Array.isArray(e.findings)?e.findings:[],"g"),b=r(e=>({"admin-token-weak":"LUNORA_ADMIN_TOKEN","auth-secret-weak":"AUTH_SECRET","cookies-insecure":"BETTER_AUTH_URL","cors-wildcard-credentials":"LUNORA_ALLOWED_ORIGINS","csrf-disabled":"LUNORA_SECURITY_CSRF","dev-args-unredacted":"request log","security-headers-disabled":"LUNORA_SECURITY_HEADERS","ws-gate-open":"LUNORA_WS_BEARER"})[e.kind],"S"),E=r((e,s)=>({"admin-token-weak":e("Your admin token is {length} characters \u2014 use at least {min} for a brute-force-resistant secret.",{length:s.detail?.length,min:s.detail?.min}),"auth-secret-weak":e("Your auth secret is {length} characters \u2014 use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.",{length:s.detail?.length,min:s.detail?.min}),"cookies-insecure":e("BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production."),"cors-wildcard-credentials":e("LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed \u2014 browsers reject this and it defeats the allowlist. Name explicit origins instead of *."),"csrf-disabled":e("LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable."),"dev-args-unredacted":e("This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy."),"security-headers-disabled":e("LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production."),"ws-gate-open":e("LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: anyone who can reach the worker can open a socket and run ordinary user subscriptions. Admin subscriptions are unaffected \u2014 they need the admin token. Set it if subscribers should present a shared credential.")})[s.kind],"A"),O=r(()=>{let e=(0,R.c)(8),s=p(),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let{data:a,error:d,errorSource:c}=m(f.getSecurityAudit,i),n;if(e[1]!==a||e[2]!==s){let u=a===void 0?null:w(a);n=u===null?null:u.map(t=>({description:E(s,t),entity:b(t),issueType:_(s,t),key:t.kind,level:t.level})),e[1]=a,e[2]=s,e[3]=n}else n=e[3];let l=n,o;return e[4]!==d||e[5]!==c||e[6]!==l?(o=(0,k.jsx)(g,{error:d,errorSource:c,rows:l,testId:"lunora-security-advisor"}),e[4]=d,e[5]=c,e[6]=l,e[7]=o):o=e[7],o},"T");export{O as default};
@@ -0,0 +1,8 @@
1
+ import{a as se,b as ae,c as ce,d as de,e as ue}from"./chunk-FLVDICZL.js";import"./chunk-A566HCBX.js";import{c as le}from"./chunk-DS7HZKZ2.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"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import{a as ie}from"./chunk-ZWDORIZY.js";import{a as oe}from"./chunk-KYONGQQ4.js";import{b as H}from"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import"./chunk-ZTOREMGH.js";import"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as Z}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import{a as E}from"./chunk-4ZEL6BYL.js";import{c as re,d as ne}from"./chunk-YJ2WHOGO.js";import{c as A,f as K,g as ee,p as te}from"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import{a as P,e as W}from"./chunk-MD67S53Z.js";import{f as V,h as O,i as L,j as q,s as z}from"./chunk-LPINY2IJ.js";import{a as l,d as J,e as qe,f as Fe,g as Oe}from"./chunk-OXFKZ4BM.js";var ge=J(Fe(),1);var S=J(qe(),1);var c=J(Oe(),1);var j=class extends Error{static{l(this,"R")}problem;constructor(e){super(e.kind),this.name="CsvFormatError",this.problem=e}},Be="\uFEFF",Ae=l(()=>{let t=[],e=1,r=!1,n=!1,o="start",i="",s=l(()=>{t.push(o==="closing"||i!==""?i:void 0),o="start",i=""},"i"),m=l(a=>{s(),t.some(d=>d!==void 0)&&a.push({cells:t,number:e}),t=[],e+=1},"c"),f=l((a,d)=>{let h=r;if(r=!1,!(h&&a===`
2
+ `)){if(o==="quoted"){a==='"'?o="closing":i+=a;return}if(o==="closing"&&a==='"'){i+=a,o="quoted";return}if(a===","){s();return}if(a==="\r"){m(d),r=!0;return}if(a===`
3
+ `){m(d);return}if(o==="closing")throw new j({kind:"text-after-quote",record:e});if(o==="start"&&a==='"'){o="quoted";return}o="unquoted",i+=a}},"d");return{finish:l(()=>{if(o==="quoted")throw new j({kind:"unterminated-quote",record:e});let a=[];return m(a),a},"finish"),push:l(a=>{let d=[],h=0;for(!n&&a!==""&&(n=!0,h=a.startsWith(Be)?1:0);h<a.length;h+=1)f(a.charAt(h),d);return d},"push")}},"Fe"),be=l(async function*(t){let e=Ae();for await(let r of t)yield*e.push(r);yield*e.finish()},"oe"),D=l((t,e,r)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0})},"D"),xe=l(t=>{let e=[],r=new Set;return t.forEach((n,o)=>{let i=(n??"").trim();if(i==="")throw new j({column:o+1,kind:"empty-header"});if(r.has(i))throw new j({kind:"duplicate-header",name:i});r.add(i),e.push(i)}),e},"se"),ye=l(({cells:t,number:e},r,n)=>{if(t.length!==r.length)throw new j({expected:r.length,found:t.length,kind:"ragged",record:e});let o={};return r.forEach((i,s)=>{let m=t[s];m!==void 0?D(o,i,m):n.has(i)&&D(o,i,null)}),{doc:o,record:e}},"ie"),Ke=/^-?\d+$/u,De=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/iu,Re=/^-?\d{11,}$/u,Me=/^(\d{4})-(\d{2})-(\d{2})$/u,Ue=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(Z|[+-]\d{2}:\d{2})?$/u,Je=/\.(\d+)/u,Ve=/[1-9]/u,Ze=/^[+-]?(\d*)(?:\.(\d*))?(?:e([+-]?\d+))?$/iu,me=l(t=>{let[,e="",r="",n="0"]=Ze.exec(t)??[],o=`${e}${r}`,i=0,s=o.length;for(;i<s&&o.charAt(i)==="0";)i+=1;for(;s>i&&o.charAt(s-1)==="0";)s-=1;return i===s?{digits:"",exponent:0}:{digits:o.slice(i,s),exponent:Number(n)-r.length+(o.length-s)}},"z"),Pe=l((t,e)=>{let r=me(t),n=me(e.toExponential());return r.digits===n.digits&&r.exponent===n.exponent?!0:r.digits!==""&&r.exponent>=0&&Number.isInteger(e)&&BigInt(r.digits)*10n**BigInt(r.exponent)===BigInt(Math.abs(e))},"qe"),We=l(t=>{let e=t.trim();if(!De.test(e))return;let r=Number(e);if(Number.isFinite(r))return Pe(e,r)?{number:r}:{inexact:!0}},"Ke"),ze=l((t,e,r)=>{let n=new Date(0);return n.setUTCFullYear(t,e-1,r),n.getUTCMonth()===e-1&&n.getUTCDate()===r},"Xe"),He=l((t,e,r,n)=>Number(t)<=23&&Number(e)<=59&&Number(r)<=59&&(n==="Z"||Number(n.slice(1,3))<=23&&Number(n.slice(4,6))<=59),"Ue"),Ye=l(t=>{let[e="",r,...n]=t.split("T"),o=Me.exec(e),i=r===void 0?void 0:Ue.exec(r);if(o===null||n.length>0||r!==void 0&&i===null)return;let[,s="",m="",f=""]=o;if(!ze(Number(s),Number(m),Number(f)))return;let[,a="0",d="0",h="0",v]=i??[];if(!He(a,d,h,v??"Z"))return;let w=Je.exec(r??"")?.[1]??"";if(Ve.test(w.slice(3)))return;let p=Date.parse(i!==void 0&&v===void 0?`${t}Z`:t);return Number.isFinite(p)?p:void 0},"Ve"),_e=l(t=>{let e=We(t);return e===void 0?{expected:"number",kind:"rejected"}:"number"in e?{kind:"ok",value:e.number}:{expected:"number",inexact:!0,kind:"rejected"}},"He"),Ge=l(t=>{let e=t.trim(),r=Ye(e);return r===void 0&&Re.test(e)&&(r=Number(e)),r===void 0||!Number.isFinite(new Date(r).getTime())?{expected:"date",kind:"rejected"}:{kind:"ok",value:r}},"We"),Qe=l(t=>{try{return K(t),!0}catch{return!1}},"Je"),Xe=l((t,e)=>{if(e==="bigint"){let r=t.trim();if(!Ke.test(r))return{expected:"bigint",kind:"rejected"};let n=BigInt(r);return Qe(n)?{kind:"ok",value:n}:{expected:"bigint",kind:"rejected",tooLong:!0}}if(e==="boolean"){let r=t.trim().toLowerCase();return r==="true"||r==="false"?{kind:"ok",value:r==="true"}:{expected:"boolean",kind:"rejected"}}return e==="number"?_e(t):e==="date"||e==="timestamp"?Ge(t):{kind:"ok",value:t}},"Ye"),ve=l(({doc:t,record:e},r)=>{let n={};for(let[o,i]of Object.entries(t)){if(i===null){D(n,o,null);continue}let s=Xe(i,r.get(o));if(s.kind==="rejected")throw new j({column:o,expected:s.expected,...s.inexact===!0&&{inexact:!0},kind:"cell-type",record:e,...s.tooLong===!0&&{tooLong:!0},value:i});D(n,o,s.value)}return{doc:n,record:e}},"le"),et=l(async function*(t,e,r){let n;for await(let o of be(t))n===void 0?n=xe(o.cells):yield ve(ye(o,n,r),e)},"Ze"),tt=l(t=>new Set(t.filter(e=>e.nullable===!0&&!e.optional).map(e=>e.name)),"Ge"),fe=l(t=>{if(t instanceof j)return t;throw t},"Q"),rt=l(async(t,e,r,n)=>{let o,i,s;for await(let f of be(t)){if(o===void 0){try{o=xe(f.cells)}catch(d){i=fe(d),o=[]}continue}let a;try{a=ve(ye(f,o,r),e)}catch(d){s??=fe(d);continue}n(a)}let m=i??s;if(m!==void 0)throw m},"ze"),nt=O(E.exportShard),Y=O(E.importShard),ot=O(E.listTables),it=O(E.describeTable),lt={},st=l(t=>t.map(e=>JSON.stringify(K(e))).join(`
4
+ `),"rt"),at=l((t,e)=>{let r=t.trim();if(r==="")return;let n=ee(JSON.parse(r));if(typeof n!="object"||n===null)throw new A("INTERNAL",`line ${e.toString()}: expected a { table, doc } object`);let o=n;if(typeof o.table!="string"||typeof o.doc!="object"||o.doc===null||Array.isArray(o.doc))throw new A("INTERNAL",`line ${e.toString()}: expected a { table, doc } object`);return o},"ot"),he=1024*1024,G=l(async function*(t){let e=new TextDecoder("utf-8",{fatal:!0});for(let n=0;n<t.size;n+=he){let o=await t.slice(n,n+he).arrayBuffer();yield e.decode(o,{stream:!0})}let r=e.decode();r!==""&&(yield r)},"U"),ct=l(async function*(t){let e="",r=0;for await(let n of G(t)){let o=`${e}${n}`.split(`
5
+ `);e=o.pop()??"";for(let i of o)r+=1,yield{line:i,lineNumber:r}}e!==""&&(yield{line:e,lineNumber:r+1})},"st"),dt=l(async function*(t){for await(let{line:e,lineNumber:r}of ct(t)){let n=at(e,r);n!==void 0&&(yield{line:r,row:n})}},"it"),ut=l(async function*(t,e,r,n){for await(let{doc:o,record:i}of et(G(t),r,n))yield{line:i,row:{doc:o,table:e}}},"lt"),mt=l(async(t,e,r,n)=>{try{let{columns:o}=await t.query(it,{table:n},L(r));return{kinds:new Map(o.map(i=>[i.name,i.type])),nullOnEmpty:tt(o)}}catch(o){return{failure:e("Couldn't read the columns of {table}: {message}",{message:q(o),table:n})}}},"at"),pe=50,ft=500,R=9e5,Q=l(t=>new TextEncoder().encode(JSON.stringify(K(t))).byteLength,"V"),_="application/x-ndjson",Ne=l(t=>new A("INTERNAL",`line ${t.toString()}: a single row is over the ${R.toString()}-byte import limit`),"ae"),ht=l(async t=>{let e=0;for await(let{line:r,row:n}of t){if(Q(n)>R)throw Ne(r);e+=1}return e},"dt"),pt=l(async(t,e,r,n)=>{let o={rows:0};if(await rt(G(t),r,n,({doc:i,record:s})=>{o.rows+=1,o.wide===void 0&&Q({doc:i,table:e})>R&&(o.wide=s)}),o.wide!==void 0)throw Ne(o.wide);return o.rows},"ut"),we=l(async(t,e)=>{let r=[],n=0,o=0,i=0;for await(let{line:s,row:m}of t){let f=Q(m),a=s!==i+1;r.length>0&&(a||r.length===ft||n+f>R)&&(await e(r,o),r=[],n=0),r.length===0&&(o=s),r.push(m),n+=f,i=s}r.length>0&&await e(r,o)},"ne"),wt=/\.csv$/iu,gt=l(t=>wt.test(t.name)||t.type==="text/csv","mt"),bt=l((t,e)=>t.expected==="boolean"?e("line {line}: column \u201C{column}\u201D must be true or false, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}):t.tooLong===!0?e("line {line}: column \u201C{column}\u201D holds an integer longer than the import can send.",{column:t.column,line:t.record}):t.expected==="bigint"?e("line {line}: column \u201C{column}\u201D must be an integer, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}):t.expected==="date"?e("line {line}: column \u201C{column}\u201D must be an ISO-8601 date or epoch milliseconds of at least 11 digits, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}):t.inexact===!0?e("line {line}: column \u201C{column}\u201D holds \u201C{value}\u201D, which a number column cannot store exactly. Store a whole number past 9007199254740991 in a bigint column.",{column:t.column,line:t.record,value:t.value}):e("line {line}: column \u201C{column}\u201D must be a number, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}),"ht"),xt=l((t,e)=>t.kind==="duplicate-header"?e("The header \u201C{name}\u201D appears more than once.",{name:t.name}):t.kind==="empty-header"?e("Header column {column} is empty.",{column:t.column}):t.kind==="ragged"?e("line {line}: expected {expected} cells, found {found}.",{expected:t.expected,found:t.found,line:t.record}):t.kind==="cell-type"?bt(t,e):t.kind==="text-after-quote"?e("line {line}: text follows a closing quote.",{line:t.record}):e("line {line}: a quoted field is never closed.",{line:t.record}),"pt"),yt=l((t,e,r)=>{let n=e instanceof j?xt(e.problem,r):q(e);return t===null?r("Invalid NDJSON: {message}",{message:n}):r("Invalid CSV: {message}",{message:n})},"wt"),vt=l(t=>{let e=(0,ge.c)(31),{onChange:r,shardKey:n,value:o}=t,i=V(),s;e[0]!==n?(s={shardKey:n},e[0]=n,e[1]=s):s=e[1];let{data:m}=re(E.listTables,lt,s),f;e[2]!==r?(f=l(T=>{r(T??"")},"d"),e[2]=r,e[3]=f):f=e[3];let a;e[4]!==i?(a=i("Target table"),e[4]=i,e[5]=a):a=e[5];let d;e[6]!==i?(d=i("Choose a table"),e[6]=i,e[7]=d):d=e[7];let h;e[8]!==d?(h=(0,c.jsx)(ae,{placeholder:d}),e[8]=d,e[9]=h):h=e[9];let v;e[10]!==a||e[11]!==h?(v=(0,c.jsx)(ce,{"aria-label":a,className:"w-56","data-testid":"ei-csv-table",children:h}),e[10]=a,e[11]=h,e[12]=v):v=e[12];let w;e[13]!==m?(w=m??[],e[13]=m,e[14]=w):w=e[14];let p;e[15]!==w?(p=w.map(kt),e[15]=w,e[16]=p):p=e[16];let b;e[17]!==p?(b=(0,c.jsx)(de,{children:p}),e[17]=p,e[18]=b):b=e[18];let k;e[19]!==f||e[20]!==v||e[21]!==b||e[22]!==o?(k=(0,c.jsxs)(se,{onValueChange:f,value:o,children:[v,b]}),e[19]=f,e[20]=v,e[21]=b,e[22]=o,e[23]=k):k=e[23];let N;e[24]!==i?(N=i("CSV rows have no table column, so choose the table they go into."),e[24]=i,e[25]=N):N=e[25];let g;e[26]!==N?(g=(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:N}),e[26]=N,e[27]=g):g=e[27];let u;return e[28]!==k||e[29]!==g?(u=(0,c.jsxs)("div",{className:"flex flex-col gap-1.5",children:[k,g]}),e[28]=k,e[29]=g,e[30]=u):u=e[30],u},"gt"),ke=l(t=>Object.values(t).reduce((e,r)=>e+r,0),"ce"),Nt=l(async(t,e,r,n,o,i)=>{let s={conflicts:0,errors:[],inserted:{}},m,f=i===null?{kinds:new Map,nullOnEmpty:new Set}:await mt(t,e,r,i);if("failure"in f)return{failure:{message:f.failure,rows:0},total:s};let{kinds:a,nullOnEmpty:d}=f;try{if(i===null){let u=l(()=>dt(o),"f");m={rows:await ht(u()),source:u}}else m={rows:await pt(o,i,a,d),source:l(()=>ut(o,i,a,d),"source")}}catch(u){return{failure:{message:yt(i,u,e),rows:0},total:s}}let{rows:h,source:v}=m;if(i!==null&&h===0)return{failure:{message:e("The CSV has no data rows after the header."),rows:0},total:s};let w={conflicts:0,errors:[],inserted:{}};n(e("Checking {total} rows before writing\u2026",{total:h}));try{if((await t.query(Y,{dryRun:!0,rows:[],startLine:1},L(r))).dryRun!==!0)return{failure:{message:e("This shard predates import checks, so it would write the file while checking it. Nothing was sent. Update the app and import again."),rows:0},total:s};await we(v(),async(u,T)=>{let I=await t.query(Y,{dryRun:!0,rows:u,startLine:T},L(r));w.errors.push(...I.errors)})}catch(u){return{failure:{message:q(u),rows:0},total:s}}if(w.errors.length>0)return{failure:{message:e("Nothing was written, because some rows would be refused. Fix the rows listed below and import again."),rows:0},total:w};let p=0,b=1,k={},N={},g=l(async(u,T)=>{n(e("Importing rows {from}\u2013{to} of {total}\u2026",{from:p+1,to:p+u.length,total:h})),N.startLine=T;let I=await t.query(Y,{dryRun:!1,rows:u,startLine:T},L(r));N.startLine=void 0,s.conflicts+=I.conflicts,s.errors.push(...I.errors);for(let[$,M]of Object.entries(I.inserted))s.inserted[$]=(s.inserted[$]??0)+M;if(p+=u.length,b=T+u.length,I.errors.length>0){let $=ke(s.inserted);throw k.refused=!0,new Error($===0?e("The shard refused {count} rows, so the rest of the file was not sent. Nothing was written. Fix the rows listed below and import again.",{count:I.errors.length}):e("The shard refused {count} rows, so the rest of the file was not sent. {written} rows were already written, so do not import the whole file again. Import the refused rows and any rows from line {line} onward, or delete the written rows first and then import the whole file.",{count:I.errors.length,line:T+u.length,written:$}))}},"w");try{return await we(v(),g),{failure:void 0,total:s}}catch(u){return{failure:{message:q(u),nextLine:b,rows:p,unknownFrom:N.startLine,...k},total:s}}},"xt"),Dt=l(({initialShardKey:t})=>{let e=te(),r=ne(),n=V(),[o,i]=(0,S.useState)(t??""),[s,m]=(0,S.useState)(null),[f,a]=(0,S.useState)(null),[d,h]=(0,S.useState)(!1),[v,w]=(0,S.useState)(null),[p,b]=(0,S.useState)(null),[k,N]=(0,S.useState)(null),[g,u]=(0,S.useState)(null),T=s!==null&&gt(s),I=f!==null&&f.shardKey===o?f.table:"",$=s!==null&&(!T||I!==""),M=l(async()=>{let x=o;h(!0),w(null),b(null),u(null);try{let F=await e.query(ot,{},L(x)),y=new Blob([],{type:_}),C=0,B=[];for(let{name:Le}of F){let{rows:U}=await e.query(nt,{tables:[Le]},L(x));if(U.length===0)continue;let X=st(U);y=new Blob([y,`${X}
6
+ `],{type:_}),C+=U.length,B.length<pe&&B.push(...X.split(`
7
+ `).slice(0,pe-B.length))}H(x),u({blob:y,count:C,preview:B.join(`
8
+ `),shardKey:x})}catch(F){w(q(F))}},"B"),Te=l(async(x,F)=>{h(!0),w(null),b(null),u(null);let{failure:y,total:C}=await Nt(e,n,o,N,x,F);y===void 0?(H(o),b(C)):y.unknownFrom===void 0&&(y.refused===!0||y.rows===0)?(C.errors.length>0&&b(C),w(y.message)):y.unknownFrom===void 0?(b(C),w(n("Import stopped after {rows} rows: {message}. The counts below cover those rows. Rows from line {line} onward were not sent: do not import the whole file again, import from that line onward, or delete the written rows first and then import the whole file.",{line:y.nextLine,message:y.message,rows:y.rows}))):(b(C),w(n("Import stopped after {rows} rows: {message}. The counts below cover completed chunks only. The chunk from line {line} may have written rows: check the table for rows from line {line} onward before importing again, or delete the written rows first and then import the whole file.",{line:y.unknownFrom,message:y.message,rows:y.rows}))),r(E.readTablePage),r(E.listTables)},"de"),Ie=p===null?0:ke(p.inserted),je=l(()=>{z(M().finally(()=>{h(!1)}))},"fe"),Se=l(()=>{s!==null&&$&&z(Te(s,T?I:null).finally(()=>{N(null),h(!1)}))},"me"),$e=l(()=>{g!==null&&le(`${g.shardKey.trim()===""?"shard":g.shardKey.trim()}.ndjson`,g.blob,_)},"he"),Ce=l(x=>{m(x.target.files?.[0]??null),a(null)},"pe"),Ee=l(x=>{a({shardKey:o,table:x})},"we");return(0,c.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-export-import",children:[(0,c.jsxs)(P,{className:"gap-0 py-0 rounded-xl border border-border bg-card shadow-xs",children:[(0,c.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,c.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Export")})}),(0,c.jsxs)(W,{className:"flex flex-col gap-3 p-4",children:[(0,c.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,c.jsx)(oe,{onChange:i,testId:"ei-shard-input",value:o}),(0,c.jsx)(Z,{"data-testid":"ei-export",disabled:d,onClick:je,type:"button",children:n("Export")})]}),g!==null&&(0,c.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,c.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,c.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-export-result",children:n("Exported {count} rows.",{count:g.count})}),(0,c.jsx)(Z,{"data-testid":"ei-download",onClick:$e,size:"sm",type:"button",variant:"outline",children:n("Download")})]}),g.preview!==""&&(0,c.jsx)("pre",{className:"max-h-60 overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"ei-preview",children:g.preview})]})]})]}),(0,c.jsxs)(P,{className:"gap-0 py-0 rounded-xl border border-border bg-card shadow-xs",children:[(0,c.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,c.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Import")})}),(0,c.jsxs)(W,{className:"flex flex-col gap-3 p-4",children:[(0,c.jsx)("input",{accept:".ndjson,.jsonl,.csv,application/x-ndjson,text/csv","aria-label":n("Import file"),className:"text-sm","data-testid":"ei-file",onChange:Ce,type:"file"}),T&&(0,c.jsx)(vt,{onChange:Ee,shardKey:o,value:I}),(0,c.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,c.jsx)(ie,{confirmLabel:n("Import (writes rows)?"),disabled:d||!$,onConfirm:Se,testId:"ei-import",children:n("Import")})}),k!==null&&(0,c.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-progress",role:"status",children:k}),p!==null&&(0,c.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ei-import-result",children:[(0,c.jsx)("p",{className:"text-sm text-muted-foreground",children:n("Inserted {inserted}, {conflicts} conflicts, {errors} errors.",{conflicts:p.conflicts,errors:p.errors.length,inserted:Ie})}),p.errors.length>0&&(0,c.jsx)("ul",{className:"flex flex-col gap-1","data-testid":"ei-import-errors",children:p.errors.map(x=>(0,c.jsx)("li",{className:"text-xs text-destructive",children:n("line {line} ({table}): {message}",{line:x.line,message:x.message,table:x.table})},`${x.table}-${x.line.toString()}`))})]})]})]}),v!==null&&(0,c.jsx)("p",{className:"text-sm text-destructive","data-testid":"ei-error",role:"alert",children:v})]})},"$t");function kt(t){return(0,c.jsx)(ue,{value:t.name,children:t.name},t.name)}l(kt,"vt");export{Dt as ExportImportPanel};
@@ -0,0 +1 @@
1
+ import{a as g}from"./chunk-4ZEL6BYL.js";import{c as k}from"./chunk-YJ2WHOGO.js";import{p as C}from"./chunk-U76DVXTR.js";import{f as S,h as y,i as v,r as _}from"./chunk-LPINY2IJ.js";import{a as i,d as N,e as T,f as F,g as L}from"./chunk-OXFKZ4BM.js";var w=N(T(),1);var j={},A=y(g.aiGenerateSql),I=y(g.aiTableFilter),O=y(g.aiChartConfig),Q=i(s=>{let e=C(),[l,d]=(0,w.useState)({}),[n,t]=(0,w.useState)({}),a=k(g.aiAvailable,j,{shardKey:s}),[f,c]=(0,w.useState)(!1),x=f||a.data?.available===!1,p=i(o=>{d(r=>({...r,[o]:!0})),t(r=>({...r,[o]:void 0}))},"i"),h=i((o,r)=>{d(b=>({...b,[o]:!1})),r!==void 0&&t(b=>({...b,[o]:r})),r==="no-ai-binding"&&c(!0)},"a"),u=i(async o=>{p("sql");try{let{result:r}=await e.query(A,o,v(s));return h("sql",r.degraded?r.reason:void 0),r.degraded?void 0:r.sql}catch{h("sql","ai-error");return}},"f");return{generate:i(async(o,r)=>u({failedError:r?.error,failedSql:r?.sql,prompt:o}),"generate"),inferChart:i(async o=>{p("chart");try{let{result:r}=await e.query(O,o,v(s));return h("chart",r.degraded?r.reason:void 0),r.degraded?void 0:r.chart}catch{h("chart","ai-error");return}},"inferChart"),pending:i(o=>l[o]===!0,"pending"),reason:i(o=>n[o],"reason"),rewrite:i(async(o,r)=>u({editSql:r,prompt:o}),"rewrite"),suggestFilter:i(async(o,r)=>{p("filter");try{let{result:b}=await e.query(I,{prompt:o,table:r},v(s));return h("filter",b.degraded?b.reason:void 0),b.degraded?void 0:b.clauses}catch{h("filter","ai-error");return}},"suggestFilter"),unavailable:x}},"Q");var q=N(F(),1);var m=N(L(),1);var G=i((s,e)=>{if(e==="")return[{match:!1,offset:0,text:s}];let l=[],d=s.toLowerCase(),n=e.toLowerCase(),t=0;for(let a=d.indexOf(n);a!==-1;a=d.indexOf(n,t))a>t&&l.push({match:!1,offset:t,text:s.slice(t,a)}),l.push({match:!0,offset:a,text:s.slice(a,a+e.length)}),t=a+e.length;return t<s.length&&l.push({match:!1,offset:t,text:s.slice(t)}),l},"N"),U=i(s=>{let e=(0,q.c)(9),{highlight:l,value:d}=s;if(d==null){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,m.jsx)("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=c):c=e[0],c}let n,t,a;if(e[1]!==l||e[2]!==d){a=Symbol.for("react.early_return_sentinel");e:{let c=_(d);if(l===void 0||l===""){a=(0,m.jsx)("span",{title:c,children:c});break e}n=c,t=G(c,l).map(z)}e[1]=l,e[2]=d,e[3]=n,e[4]=t,e[5]=a}else n=e[3],t=e[4],a=e[5];if(a!==Symbol.for("react.early_return_sentinel"))return a;let f;return e[6]!==n||e[7]!==t?(f=(0,m.jsx)("span",{title:n,children:t}),e[6]=n,e[7]=t,e[8]=f):f=e[8],f},"v"),P=i(s=>{let e=(0,q.c)(22),{columns:l,rows:d}=s,n=S(),t;e[0]!==n?(t=n("Field"),e[0]=n,e[1]=t):t=e[1];let a;e[2]!==t?(a=(0,m.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:t}),e[2]=t,e[3]=a):a=e[3];let f;if(e[4]!==d||e[5]!==n){let u;e[7]!==n?(u=i((o,r)=>(0,m.jsx)("th",{className:"border-b border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase tabular-nums text-muted-foreground",children:n("Row {n}",{n:r+1})},r),"c"),e[7]=n,e[8]=u):u=e[8],f=d.map(u),e[4]=d,e[5]=n,e[6]=f}else f=e[6];let c;e[9]!==a||e[10]!==f?(c=(0,m.jsx)("thead",{className:"sticky top-0 z-10 bg-muted",children:(0,m.jsxs)("tr",{children:[a,f]})}),e[9]=a,e[10]=f,e[11]=c):c=e[11];let x;if(e[12]!==l||e[13]!==d){let u;e[15]!==d?(u=i(o=>(0,m.jsxs)("tr",{className:"hover:bg-muted/40",children:[(0,m.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:o}),d.map((r,b)=>(0,m.jsx)("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:(0,m.jsx)(U,{value:r[o]})},b))]},o),"c"),e[15]=d,e[16]=u):u=e[16],x=l.map(u),e[12]=l,e[13]=d,e[14]=x}else x=e[14];let p;e[17]!==x?(p=(0,m.jsx)("tbody",{children:x}),e[17]=x,e[18]=p):p=e[18];let h;return e[19]!==c||e[20]!==p?(h=(0,m.jsx)("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:(0,m.jsxs)("table",{className:"border-collapse text-xs",children:[c,p]})}),e[19]=c,e[20]=p,e[21]=h):h=e[21],h},"T"),V=i(({children:s,layout:e="card",testId:l})=>(0,m.jsx)("div",{className:e==="fill"?"flex min-h-0 flex-1 flex-col overflow-hidden border-t border-border":"overflow-x-auto border border-border bg-card","data-testid":l,children:s}),"j");function z(s){return(0,m.jsx)("mark",{className:s.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:s.text},s.offset)}i(z,"_");export{Q as a,U as b,P as c,V as d};
@@ -0,0 +1 @@
1
+ import{a as Z}from"./chunk-5DNGK3NT.js";import{a as te}from"./chunk-ZWDORIZY.js";import{a as Y}from"./chunk-KYONGQQ4.js";import{b as X}from"./chunk-SLIDAWNX.js";import{a as W}from"./chunk-DBVJ5VLI.js";import"./chunk-6M7FLLMT.js";import{i as D}from"./chunk-LUHXNZI4.js";import"./chunk-ZTOREMGH.js";import"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{b as ae,c as ne}from"./chunk-WS36BO4R.js";import{a as q,b as ee}from"./chunk-P5GAJKDW.js";import{a as G}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import"./chunk-OECMBE6Q.js";import"./chunk-OSJ7HV7B.js";import"./chunk-7F3S5OQT.js";import"./chunk-E26OT26O.js";import{a as I}from"./chunk-4ZEL6BYL.js";import{c as _}from"./chunk-YJ2WHOGO.js";import{p as V}from"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import"./chunk-CW57Q264.js";import"./chunk-MD67S53Z.js";import{f as M,h as C,i as A,o as Q,s as N}from"./chunk-LPINY2IJ.js";import{a as l,d as j,e as he,f as me,g as pe}from"./chunk-OXFKZ4BM.js";var E=j(me(),1);var c=j(he(),1);var S=j(pe(),1);var ge=l(t=>{let{suggestedIndex:e,table:i}=t;if(typeof i!="string"||i.length===0||typeof e!="object"||e===null)return!1;let{fields:a,name:n}=e;return!Array.isArray(a)||a.length===0||a.some(s=>typeof s!="string"||s.length===0)?!1:typeof n=="string"&&n.length>0},"ye"),be=l((t,e)=>`.index(${JSON.stringify(t)}, [${e.map(i=>JSON.stringify(i)).join(", ")}])`,"ge"),ye=l(t=>{let e=(0,E.c)(19),{fields:i,indexName:a,table:n,testId:s}=t,u=M(),[h,f]=(0,c.useState)(null),m;e[0]!==i||e[1]!==a?(m=l(()=>{let b=be(a,i),$="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if($===void 0){f({copied:!1,declaration:b});return}N($.writeText(b).then(()=>(f({copied:!0,declaration:b}),!0)),()=>{f({copied:!1,declaration:b})})},"m"),e[0]=i,e[1]=a,e[2]=m):m=e[2];let x=m;if(h!==null){let b;return e[3]!==h.copied||e[4]!==h.declaration||e[5]!==u||e[6]!==n||e[7]!==s?(b=h.copied?(0,S.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`${s}-applied`,children:u("Index declaration copied \u2014 add it to {table} in lunora/schema.ts.",{table:n})}):(0,S.jsxs)("span",{className:"flex flex-col gap-1 text-xs text-muted-foreground","data-testid":`${s}-manual`,children:[u("Could not reach the clipboard \u2014 add this to {table} in lunora/schema.ts:",{table:n}),(0,S.jsx)("code",{className:"font-mono break-all select-all",children:h.declaration})]}),e[3]=h.copied,e[4]=h.declaration,e[5]=u,e[6]=n,e[7]=s,e[8]=b):b=e[8],b}let T;e[9]!==u?(T=u("Copy?"),e[9]=u,e[10]=T):T=e[10];let p;e[11]!==u||e[12]!==n?(p=u("Copy index declaration for {table}",{table:n}),e[11]=u,e[12]=n,e[13]=p):p=e[13];let w;return e[14]!==x||e[15]!==T||e[16]!==p||e[17]!==s?(w=(0,S.jsx)(te,{confirmLabel:T,onConfirm:x,testId:s,children:p}),e[14]=x,e[15]=T,e[16]=p,e[17]=s,e[18]=w):w=e[18],w},"ve"),xe=l((t,e)=>{let i=new Map;for(let a of e){let n=`${a.table} ${a.index}`;i.set(n,(i.get(n)??0)+a.reads)}return t.map(a=>({index:a.index,reads:i.get(`${a.table} ${a.index}`)??0,table:a.table}))},"Se"),ve=l(t=>{let e=new Map;for(let i of t)for(let a of i.scannedTables??[])e.set(a.table,(e.get(a.table)??0)+a.scans);return[...e].map(([i,a])=>({scans:a,table:i}))},"Te"),ie=l((t,e)=>e.map(i=>({index:i.name,table:t})),"P"),we=l(t=>{let e=xe(t.declaredIndexes??[],t.indexHits??[]),i=ve(t.functions??[]),a=t.shardTraffic??[],n=t.analyticsMetrics,s=n&&n.indexHits.length>0?n.indexHits:e,u=n&&n.tableScans.length>0?n.tableScans:i,h=n&&n.shardTraffic.length>0?n.shardTraffic:a,f=ne({indexHits:s,schema:{tables:[]},shardTraffic:h,tableScans:u},{lints:ae,source:"runtime"}),m=t.suppressHotScanTables;return(m===void 0?f:f.filter(x=>!(x.metadata.kind==="hot_scan"&&typeof x.metadata.table=="string"&&m.has(x.metadata.table)))).map(x=>q(x))},"we"),Se=C(I.listTables),Te=C(I.listTableIndexes),Ie=C(I.listTablesIndexes),B=l(t=>`${(t*100).toFixed(1)}%`,"H"),re=l(t=>`${(t/1e3).toFixed(2)}s`,"V"),$e=l(t=>{if(t.length<=1)return t[0]??"";let e=t[t.length-1]??"";return`${t.slice(0,-1).join(", ")} and ${e}`},"Ne"),ke=l((t,e)=>({"high-error-rate":t("High error rate"),"high-evictions":t("High cache eviction rate"),"high-write-contention":t("High write contention"),"low-cache-hit-rate":t("Low cache hit rate"),"missing-index":t("Missing index"),"slow-function":t("Slow function"),"storage-headroom":t("Storage headroom")})[e.kind],"ke"),se=l((t,e)=>({"high-error-rate":t("{rate} of calls failed.",{rate:B(e.value)}),"high-evictions":t("{count} entries evicted recently.",{count:e.value}),"high-write-contention":t("{rate} of calls hit a write conflict \u2014 consider sharding to cut contention.",{rate:B(e.value)}),"low-cache-hit-rate":t("{rate} hit rate over recent traffic.",{rate:B(e.value)}),"missing-index":t("Slowest call took {duration} \u2014 it full-scanned {tables} with no index.",{duration:re(e.value),tables:$e(e.tables??[])}),"slow-function":t("Slowest call took {duration}.",{duration:re(e.value)}),"storage-headroom":t("{size} of the 10 GiB per-shard ceiling \u2014 plan a .shardBy() migration while it still has runway.",{size:Q(e.value)})})[e.kind],"U"),Ne=l(t=>{let e=(0,E.c)(10),{onJump:i,table:a}=t,n=M(),s;e[0]!==i||e[1]!==a?(s=l(()=>{i(a)},"i"),e[0]=i,e[1]=a,e[2]=s):s=e[2];let u=s,h=`in-add-index-${a}`,f;e[3]!==n||e[4]!==a?(f=n("Add index on {table}",{table:a}),e[3]=n,e[4]=a,e[5]=f):f=e[5];let m;return e[6]!==u||e[7]!==h||e[8]!==f?(m=(0,S.jsx)(G,{"data-testid":h,onClick:u,size:"sm",type:"button",variant:"outline",children:f}),e[6]=u,e[7]=h,e[8]=f,e[9]=m):m=e[9],m},"Be"),ze=l(({initialShardKey:t,loadShardTraffic:e})=>{let i=V(),a=D(),n=M(),{queryShardKey:s,setShardKey:u,shardKey:h}=Z(t),[f,m]=(0,c.useState)(null),[x,T]=(0,c.useState)(null),p=(0,c.useRef)(""),w=_(I.getMetrics,{},{live:!0,shardKey:s}),b=_(I.getFunctionStats,{},{live:!0,shardKey:s}),$=_(I.getAdvisories,{},{live:!0,shardKey:s}),L=w.data??null,H=b.data?.functions??null,F=$.data?.advisories??null,J=w.data?.indexHits??null,O=w.error!==null&&b.error!==null?w.error:null,oe=e??(r=>i.shardTraffic(r)),le=l(async(r,y)=>{let o=r[0];if(o===void 0||o===""){p.current===y&&T(null);return}try{let g=await oe(o);if(p.current!==y)return;let d=new Map;for(let v of g.shards)d.has(v.shardKey)||d.set(v.shardKey,{requests:v.requests,shardKey:v.shardKey});T([...d.values()])}catch{p.current===y&&T(null)}},"Y"),de=l(async(r,y)=>{let o=await Promise.allSettled(r.map(async d=>[d,await i.query(Te,{table:d},A(y))])),g=[];for(let d of o)if(d.status==="fulfilled"){let[v,k]=d.value;g.push(...ie(v,k.indexes))}return g},"Z"),z=(0,c.useEffectEvent)(async r=>{p.current=r;let y=[];try{let o=await i.query(Se,{},A(r));if(p.current!==r)return;X(r),y=o.map(d=>d.name);let g=[];if(y.length>0)try{let d=await i.query(Ie,{tables:y},A(r));if(p.current!==r)return;for(let[v,k]of Object.entries(d.indexesByTable))g.push(...ie(v,k))}catch{if(g=await de(y,r),p.current!==r)return}m(g)}catch{p.current===r&&m(null)}await le(y,r)});(0,c.useEffect)(()=>{N(z(s))},[s]);let ce=(0,c.useEffectEvent)(()=>{w.refetch(),b.refetch(),$.refetch(),N(z(s))});(0,c.useEffect)(()=>{let r=l(()=>{document.visibilityState==="visible"&&ce()},"r");return document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("visibilitychange",r)}},[]);let U=(0,c.useCallback)(r=>{N(a({search:{table:r},to:"/schema"}))},[a]),K=(0,c.useMemo)(()=>W(L,H),[H,L]),P=(0,c.useMemo)(()=>new Set(K.filter(r=>r.kind==="missing-index").flatMap(r=>r.tables??[])),[K]),R=(0,c.useMemo)(()=>we({declaredIndexes:f??[],functions:H,indexHits:J,shardTraffic:x,suppressHotScanTables:P}),[f,H,J,P,x]),ue=(0,c.useMemo)(()=>{let r=K.map(o=>{let g=o.kind==="missing-index"?o.tables??[]:[];return{action:g.length>0?g.map(d=>(0,S.jsx)(Ne,{onJump:U,table:d},d)):void 0,description:o.message===void 0?se(n,o):`${se(n,o)} \u2014 ${o.message}`,entity:o.fn,issueType:ke(n,o),key:`${o.kind}:${o.fn??""}`,level:o.severity}}),y=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(F??[]).map(o=>{let g=q(o);if(y.has(o.name)&&ge(o.metadata)){let{table:d,suggestedIndex:v}=o.metadata,k=`in-apply-index-${d}-${v.name}`;return{...g,action:(0,S.jsx)(ye,{fields:v.fields,indexName:v.name,table:d,testId:k})}}return g}),...R,...r]},[F,K,U,R,n]),fe=(0,S.jsx)(Y,{onChange:u,testId:"in-shard-input",value:h});return(0,S.jsx)(ee,{error:O,errorSource:O===null?void 0:w.errorSource,rows:ue,testId:"lunora-insights",toolbar:fe})},"Ue");export{ze as InsightsPanel};
@@ -0,0 +1 @@
1
+ import{a as v}from"./chunk-AOHKAKKL.js";import{a as Q}from"./chunk-SOO2HXV6.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-OECMBE6Q.js";import"./chunk-OSJ7HV7B.js";import"./chunk-7F3S5OQT.js";import"./chunk-E26OT26O.js";import{a as E}from"./chunk-4ZEL6BYL.js";import{c as B}from"./chunk-YJ2WHOGO.js";import"./chunk-U76DVXTR.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,3 @@
1
+ import{a as at}from"./chunk-DBVJ5VLI.js";import{i as Ee}from"./chunk-LUHXNZI4.js";import{a as Fe}from"./chunk-2O6KKVH2.js";import{b as We}from"./chunk-6I42AM75.js";import{a as D}from"./chunk-4ZEL6BYL.js";import{c as _e}from"./chunk-YJ2WHOGO.js";import{p as Te}from"./chunk-U76DVXTR.js";import{a as Ze}from"./chunk-3Y5K3IQO.js";import{a as j,e as Ue}from"./chunk-MD67S53Z.js";import{b as Ve,f as $,h as Qe,i as Xe,o as et,s as Ne,u as tt,v as nt}from"./chunk-LPINY2IJ.js";import{a as c,d as ze,e as dt,f as mt,g as ut}from"./chunk-OXFKZ4BM.js";var _=ze(mt(),1);var B=ze(dt(),1);var a=ze(ut(),1);var pt=Qe(D.studioFeatures),Ge={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,privacy:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},ft=c(t=>{if(t===null||typeof t!="object")return;let{id:e,name:r,unsupported:n}=t;if(!(typeof e!="string"||typeof r!="string"||!Array.isArray(n)))return{id:e,name:r,unsupported:n.filter(s=>typeof s=="string")}},"ut"),ht=c(t=>{if(t===null||typeof t!="object")return Ge;let e=t,r=c(n=>typeof e[n]=="boolean"?e[n]:!0,"n");return{analytics:r("analytics"),auth:r("auth"),containers:r("containers"),flags:r("flags"),kv:r("kv"),mail:r("mail"),notifications:r("notifications"),payments:r("payments"),privacy:r("privacy"),platform:ft(e.platform),queues:r("queues"),scheduler:r("scheduler"),storage:r("storage"),vectors:r("vectors"),workflows:r("workflows")}},"mt"),gt={...Ge,settled:!1},xt=c(()=>{let t=(0,_.c)(3),e=Te(),[r,n]=(0,B.useState)(void 0),s,l;return t[0]!==e?(s=c(()=>{let i=new AbortController;return Ne((async()=>{let o;try{o={...ht(await e.query(pt,{},Xe(""))),settled:!0}}catch{o={...Ge,settled:!0}}i.signal.aborted||n({client:e,features:o})})()),()=>{i.abort()}},"l"),l=[e],t[0]=e,t[1]=s,t[2]=l):(s=t[1],l=t[2]),(0,B.useEffect)(s,l),r?.client===e?r.features:gt},"pt"),bt=c(()=>{let t=(0,_.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},"ht"),yt=c(t=>{let e=(0,_.c)(24),{group:r}=t,n=$(),s=Ee(),l;e[0]!==r.tab||e[1]!==s?(l=c(()=>{Ne(s({to:`/${r.tab}`}))},"r"),e[0]=r.tab,e[1]=s,e[2]=l):l=e[2];let i=l,o=r.bindings.length,d;e[3]!==r.label?(d=(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:r.label}),e[3]=r.label,e[4]=d):d=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)(bt,{}),e[5]=u):u=e[5];let p;e[6]!==d?(p=(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[d,u]}),e[6]=d,e[7]=p):p=e[7];let m;e[8]!==o||e[9]!==n?(m=o===1?n("1 binding"):n("{count} bindings",{count:o}),e[8]=o,e[9]=n,e[10]=m):m=e[10];let f;e[11]!==m?(f=(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:m}),e[11]=m,e[12]=f):f=e[12];let h;e[13]!==o||e[14]!==r.bindings?(h=o>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:r.bindings.map(_t)}),e[13]=o,e[14]=r.bindings,e[15]=h):h=e[15];let g;e[16]!==p||e[17]!==f||e[18]!==h?(g=(0,a.jsxs)(Ue,{className:"flex flex-col gap-2 py-4",children:[p,f,h]}),e[16]=p,e[17]=f,e[18]=h,e[19]=g):g=e[19];let x;return e[20]!==r.testId||e[21]!==i||e[22]!==g?(x=(0,a.jsx)(j,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":r.testId,onClick:i,children:g}),e[20]=r.testId,e[21]=i,e[22]=g,e[23]=x):x=e[23],x},"gt"),rt=["kv","files","vectors"],vt=c((t,e)=>[...t.filter(r=>r.tab!==e.tab),e].toSorted((r,n)=>rt.indexOf(r.tab)-rt.indexOf(n.tab)),"xt"),Nt=c(()=>{let t=(0,_.c)(19),e=Te(),r=xt(),n=$(),s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],t[0]=s):s=t[0];let[l,i]=(0,B.useState)(s),o,d;if(t[1]!==e||t[2]!==r.kv||t[3]!==r.storage||t[4]!==r.vectors||t[5]!==n?(o=c(()=>{let g={cancelled:!1},x=[{enabled:r.kv,label:n("KV Namespaces"),load:c(async()=>(await e.listKvNamespaces()).map(wt),"load"),tab:"kv",testId:"home-binding-kv"},{enabled:r.storage,label:n("R2 Buckets"),load:c(()=>e.listStorageBuckets(),"load"),tab:"files",testId:"home-binding-r2"},{enabled:r.vectors,label:n("Vectorize Indexes"),load:c(async()=>(await e.listVectorIndexes()).map(kt),"load"),tab:"vectors",testId:"home-binding-vectors"}];for(let b of x)b.enabled&&Ne((async()=>{try{let v=await b.load();if(!g.cancelled){let w={bindings:v,label:b.label,tab:b.tab,testId:b.testId};i(k=>vt(k,w))}}catch{}})());return()=>{g.cancelled=!0}},"o"),d=[e,r.kv,r.storage,r.vectors,n],t[1]=e,t[2]=r.kv,t[3]=r.storage,t[4]=r.vectors,t[5]=n,t[6]=o,t[7]=d):(o=t[6],d=t[7]),(0,B.useEffect)(o,d),l.length===0)return null;let u;t[8]!==n?(u=n("Bindings"),t[8]=n,t[9]=u):u=t[9];let p;t[10]!==u?(p=(0,a.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:u}),t[10]=u,t[11]=p):p=t[11];let m;t[12]!==l?(m=l.map(St),t[12]=l,t[13]=m):m=t[13];let f;t[14]!==m?(f=(0,a.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:m}),t[14]=m,t[15]=f):f=t[15];let h;return t[16]!==p||t[17]!==f?(h=(0,a.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[p,f]}),t[16]=p,t[17]=f,t[18]=h):h=t[18],h},"bt");function _t(t){return(0,a.jsx)(We,{variant:"secondary",children:t},t)}c(_t,"yt");function wt(t){return t.binding}c(wt,"vt");function kt(t){return t.name}c(kt,"Nt");function St(t){return(0,a.jsx)(yt,{group:t},t.tab)}c(St,"_t");var Mt=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation \u2014 writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action \u2014 writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],At=c(t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),"wt"),Ct=c(t=>{let e=Mt.map(r=>`- ${r.name} \u2014 ${r.summary}`).join(`
2
+ `);return[`You have a Lunora MCP server connected to the deployment at ${t}.`,"It exposes this backend's functions and schema so you can inspect and operate it:",e,"",`Start by calling lunora_list_functions and lunora_list_tables to learn what exists, then lunora_get_function_schema before any run call. The full HTTP API is also documented at ${t}/_lunora/admin/openapi (that endpoint needs the same admin token the MCP server is configured with).`].join(`
3
+ `)},"kt"),It=1500,Lt=c(()=>{let t=(0,_.c)(40),e=$(),{url:r}=Te(),n;t[0]!==r?(n=tt(r),t[0]=r,t[1]=n):n=t[1];let s=n,[l,i]=(0,B.useState)(null),o,d;t[2]!==l?(o=c(()=>{if(l===null)return;let L=globalThis.setTimeout(()=>{i(null)},It);return()=>{globalThis.clearTimeout(L)}},"o"),d=[l],t[2]=l,t[3]=o,t[4]=d):(o=t[3],d=t[4]),(0,B.useEffect)(o,d);let u;t[5]===Symbol.for("react.memo_cache_sentinel")?(u=c((L,T)=>{nt(T)&&i(L)},"u"),t[5]=u):u=t[5];let p=u,m;t[6]!==s?(m=c(()=>{p("config",At(s))},"d"),t[6]=s,t[7]=m):m=t[7];let f=m,h;t[8]!==s?(h=c(()=>{p("prompt",Ct(s))},"p"),t[8]=s,t[9]=h):h=t[9];let g=h,x;t[10]!==e?(x=e("Connect an AI agent"),t[10]=e,t[11]=x):x=t[11];let b;t[12]!==x?(b=(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:x}),t[12]=x,t[13]=b):b=t[13];let v;t[14]!==e?(v=e("Drive this deployment from an AI agent over the Model Context Protocol \u2014 it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[14]=e,t[15]=v):v=t[15];let w;t[16]!==v?(w=(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:v}),t[16]=v,t[17]=w):w=t[17];let k;t[18]!==b||t[19]!==w?(k=(0,a.jsxs)("div",{className:"flex flex-col gap-1.5 p-4",children:[b,w]}),t[18]=b,t[19]=w,t[20]=k):k=t[20];let I;t[21]===Symbol.for("react.memo_cache_sentinel")?(I=(0,a.jsx)("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[21]=I):I=t[21];let y;t[22]!==l||t[23]!==e?(y=e(l==="config"?"Copied":"Copy MCP config"),t[22]=l,t[23]=e,t[24]=y):y=t[24];let S;t[25]!==f||t[26]!==y?(S=(0,a.jsx)(Fe,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:y}),t[25]=f,t[26]=y,t[27]=S):S=t[27];let M;t[28]!==l||t[29]!==e?(M=e(l==="prompt"?"Copied":"Copy agent prompt"),t[28]=l,t[29]=e,t[30]=M):M=t[30];let A;t[31]!==g||t[32]!==M?(A=(0,a.jsx)(Fe,{"data-testid":"home-connect-agent-copy-prompt",onClick:g,size:"xs",variant:"outline",children:M}),t[31]=g,t[32]=M,t[33]=A):A=t[33];let N;t[34]!==S||t[35]!==A?(N=(0,a.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[I,(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[S,A]})]}),t[34]=S,t[35]=A,t[36]=N):N=t[36];let C;return t[37]!==k||t[38]!==N?(C=(0,a.jsxs)(j,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[k,N]}),t[37]=k,t[38]=N,t[39]=C):C=t[39],C},"At"),$t=112,st=32,Oe=5,lt=1,jt=3,Tt=c(t=>{let e=t.slice(-16),r=Math.max(0,...e),n=st-Oe*2,s=($t-Oe*2)/e.length;return e.map((l,i)=>{let o=r>0?Math.max(0,l)/r*n:0;return{height:Math.max(0,o-jt),width:Math.max(0,s-lt*2),x:Oe+i*s+lt,y:st-Oe-o}})},"It"),Ot=c(t=>{let e=(0,_.c)(4),{data:r}=t,n;e[0]!==r?(n=Tt(r).map(qt),e[0]=r,e[1]=n):n=e[1];let s;return e[2]!==n?(s=(0,a.jsx)("svg",{"aria-hidden":"true",className:"h-8 w-28 fill-foreground","data-testid":"home-sparkline",viewBox:"0 0 112 32",children:n}),e[2]=n,e[3]=s):s=e[3],s},"Tt");function qt(t){return(0,a.jsx)("rect",{height:t.height,rx:2,width:t.width,x:t.x,y:t.y},t.x)}c(qt,"Lt");var Rt=3,Kt=c((t,e)=>{if(e==null)return t("cache not enabled");let r=e.hits+e.misses;return r===0?t("no cache traffic yet"):`${Math.round(e.hits/r*100).toString()}% ${t("cache hit")}`},"Rt"),Je=c(t=>{if(t<1e3)return`${String(Math.round(t))}ms`;let e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},"Fe"),Bt=c((t,e)=>{let r=Math.max(0,Math.round((e-t)/1e3));if(r<60)return`${String(r)}s ago`;let n=Math.round(r/60);if(n<60)return`${String(n)}m ago`;let s=Math.round(n/60);return s<24?`${String(s)}h ago`:`${String(Math.round(s/24))}d ago`},"Et"),ot=c((t,e)=>{if(t===void 0||t.length===0)return[];let r=new Map;for(let n of t)r.set(n.bucketMs,(r.get(n.bucketMs)??0)+n[e]);return[...r.entries()].toSorted(([n],[s])=>n-s).map(([,n])=>n)},"Je"),it=c((t,e=!0)=>{if(t.length<4)return null;let r=Math.floor(t.length/2),n=t.slice(0,r).reduce((i,o)=>i+o,0),s=t.slice(r).reduce((i,o)=>i+o,0);if(n===0)return null;let l=(s-n)/n*100;return{positive:e?l>=0:l<=0,text:`${l>=0?"+":""}${l.toFixed(1)}%`}},"Ye"),qe=c(t=>{let e=(0,_.c)(24),{delta:r,footer:n,label:s,trend:l,unit:i,value:o}=t,d=$(),u;e[0]!==s?(u=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s}),e[0]=s,e[1]=u):u=e[1];let p;e[2]!==o?(p=(0,a.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:o}),e[2]=o,e[3]=p):p=e[3];let m;e[4]!==i?(m=i!==void 0&&(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[4]=i,e[5]=m):m=e[5];let f;e[6]!==p||e[7]!==m?(f=(0,a.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[p,m]}),e[6]=p,e[7]=m,e[8]=f):f=e[8];let h;e[9]!==l?(h=l!==void 0&&l.length>=Rt&&(0,a.jsx)(Ot,{data:l}),e[9]=l,e[10]=h):h=e[10];let g;e[11]!==f||e[12]!==h?(g=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[f,h]}),e[11]=f,e[12]=h,e[13]=g):g=e[13];let x;e[14]!==u||e[15]!==g?(x=(0,a.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[u,g]}),e[14]=u,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==r||e[18]!==n||e[19]!==d?(b=r==null?n!=null&&(0,a.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:n}):(0,a.jsxs)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[(0,a.jsx)("span",{className:Ve("font-semibold",r.positive?"text-success":"text-destructive"),children:r.text})," ",(0,a.jsx)("span",{className:"text-muted-foreground",children:d("vs. prev.")})]}),e[17]=r,e[18]=n,e[19]=d,e[20]=b):b=e[20];let v;return e[21]!==x||e[22]!==b?(v=(0,a.jsxs)(j,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=v):v=e[23],v},"Oe"),Dt=c(()=>{let t=(0,_.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},"Bt"),He=c(t=>{let e=(0,_.c)(7),{command:r,label:n}=t,s;e[0]!==n?(s=(0,a.jsx)("div",{className:"p-4",children:(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:n})}),e[0]=n,e[1]=s):s=e[1];let l;e[2]!==r?(l=(0,a.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:(0,a.jsx)("code",{className:"font-mono text-xs text-muted-foreground",children:r})}),e[2]=r,e[3]=l):l=e[3];let i;return e[4]!==s||e[5]!==l?(i=(0,a.jsxs)(j,{className:"justify-between gap-0 py-0",children:[s,l]}),e[4]=s,e[5]=l,e[6]=i):i=e[6],i},"je"),ct=c(t=>{let e=(0,_.c)(18),{count:r,onView:n,testId:s,title:l}=t,i=$(),o;e[0]!==l?(o=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=o):o=e[1];let d;e[2]!==r||e[3]!==i?(d=r===null?(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:i("No data yet")}):(0,a.jsx)(We,{variant:r>0?"destructive":"success",children:r>0?r:i("All clear")}),e[2]=r,e[3]=i,e[4]=d):d=e[4];let u;e[5]!==o||e[6]!==d?(u=(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2 p-4",children:[o,d]}),e[5]=o,e[6]=d,e[7]=u):u=e[7];let p;e[8]!==i?(p=i("View"),e[8]=i,e[9]=p):p=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(Dt,{}),e[10]=m):m=e[10];let f;e[11]!==n||e[12]!==p?(f=(0,a.jsxs)("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:n,type:"button",children:[p,m]}),e[11]=n,e[12]=p,e[13]=f):f=e[13];let h;return e[14]!==u||e[15]!==f||e[16]!==s?(h=(0,a.jsxs)(j,{className:"justify-between gap-0 py-0","data-testid":s,children:[u,f]}),e[14]=u,e[15]=f,e[16]=s,e[17]=h):h=e[17],h},"Ze"),Pt=c(t=>{let e=(0,_.c)(7),{functions:r}=t,n=$(),s;if(e[0]!==r||e[1]!==n){let l=[...r].toSorted(Wt).slice(0,5),i;e[3]!==n?(i=n("Top functions"),e[3]=n,e[4]=i):i=e[4];let o;e[5]!==i?(o=(0,a.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i})}),e[5]=i,e[6]=o):o=e[6],s=(0,a.jsxs)(j,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[o,l.length===0?(0,a.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:n("No functions called yet.")}):(0,a.jsxs)("div",{className:"divide-y divide-border",children:[(0,a.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[(0,a.jsx)("span",{children:n("Function")}),(0,a.jsx)("span",{className:"text-end",children:n("Calls")}),(0,a.jsx)("span",{className:"w-12 text-end",children:n("Avg")}),(0,a.jsx)("span",{className:"w-8 text-end",children:n("Err")})]}),l.map(Ft)]})]}),e[0]=r,e[1]=n,e[2]=s}else s=e[2];return s},"Pt"),zt=c(t=>{let e=(0,_.c)(26),{subs:r}=t,n=$(),s;e[0]!==n?(s=n("Live connections"),e[0]=n,e[1]=s):s=e[1];let l;e[2]!==s?(l=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s}),e[2]=s,e[3]=l):l=e[3];let i=r?.totalConnections??0,o;e[4]!==i?(o=i.toLocaleString(),e[4]=i,e[5]=o):o=e[5];let d;e[6]!==o?(d=(0,a.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:o}),e[6]=o,e[7]=d):d=e[7];let u;e[8]!==n?(u=n("sockets"),e[8]=n,e[9]=u):u=e[9];let p;e[10]!==u?(p=(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:u}),e[10]=u,e[11]=p):p=e[11];let m;e[12]!==d||e[13]!==p?(m=(0,a.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[d,p]}),e[12]=d,e[13]=p,e[14]=m):m=e[14];let f=r?.totalSubscriptions??0,h;e[15]!==f?(h=f.toLocaleString(),e[15]=f,e[16]=h):h=e[16];let g;e[17]!==n?(g=n("active subscriptions"),e[17]=n,e[18]=g):g=e[18];let x;e[19]!==h||e[20]!==g?(x=(0,a.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[h," ",g]}),e[19]=h,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==l||e[24]!==m?(b=(0,a.jsx)(j,{"data-testid":"home-live-connections",children:(0,a.jsxs)(Ue,{className:"flex flex-col gap-2.5 py-4",children:[l,m,x]})}),e[22]=x,e[23]=l,e[24]=m,e[25]=b):b=e[25],b},"Dt"),Et=c(t=>{let e=(0,_.c)(7),{entries:r}=t,n=$(),s;if(e[0]!==r||e[1]!==n){let l=Date.now(),i;e[3]!==n?(i=n("Recent activity"),e[3]=n,e[4]=i):i=e[4];let o;e[5]!==i?(o=(0,a.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i})}),e[5]=i,e[6]=o):o=e[6],s=(0,a.jsxs)(j,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[o,r.length===0?(0,a.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:n("No recent activity.")}):(0,a.jsx)("ul",{className:"divide-y divide-border",children:r.slice(0,5).map(d=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,a.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),(0,a.jsxs)("span",{className:"truncate text-foreground",children:[d.op,d.table!==void 0&&(0,a.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",d.table,d.id===void 0?"":`#${d.id}`]})]})]}),(0,a.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:Bt(d.ts,l)})]},d.seq))})]}),e[0]=r,e[1]=n,e[2]=s}else s=e[2];return s},"jt"),Vt=c(t=>{let e=t.reduce((r,n)=>r+n.calls,0);return e===0?null:t.reduce((r,n)=>r+n.totalDurationMs,0)/e},"Ft"),sn=c(t=>{let e=(0,_.c)(149),{initialShardKey:r}=t,n=$(),s=Ee(),l=r??"",i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let o;e[1]!==l?(o={shardKey:l},e[1]=l,e[2]=o):o=e[2];let d=_e(D.getMetrics,i,o),u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u={},e[3]=u):u=e[3];let p;e[4]!==l?(p={shardKey:l},e[4]=l,e[5]=p):p=e[5];let m=_e(D.getFunctionStats,u,p),f,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(f={},h={shardKey:""},e[6]=f,e[7]=h):(f=e[6],h=e[7]);let g=_e(D.getSecurityAudit,f,h),x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==l?(b={shardKey:l},e[9]=l,e[10]=b):b=e[10];let v=_e(D.listSubscriptions,x,b),w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w={},e[11]=w):w=e[11];let k;e[12]!==l?(k={shardKey:l},e[12]=l,e[13]=k):k=e[13];let I=_e(D.getAuditLog,w,k),y=d.data??null,S,M,A,N,C,L,T,O,q,P,z,E,R,K,V,W,F,U;if(e[14]!==I.data||e[15]!==g.data||e[16]!==y||e[17]!==d.data||e[18]!==s||e[19]!==m.data||e[20]!==v.data||e[21]!==n){N=Array.isArray(m.data?.functions)?m.data.functions:[],T=v.data??null;let Me;e[40]!==I.data?(Me=Array.isArray(I.data?.entries)?I.data.entries:[],e[40]=I.data,e[41]=Me):Me=e[41],M=Me,C=d.data===void 0||m.data===void 0?null:at(y,N).length,L=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Ae;e[42]!==s?(Ae=c(()=>{Ne(s({to:"/security"}))},"Ce"),e[42]=s,e[43]=Ae):Ae=e[43],U=Ae;let Ce;e[44]!==s?(Ce=c(()=>{Ne(s({to:"/insights"}))},"Ae"),e[44]=s,e[45]=Ce):Ce=e[45],F=Ce;let Ie=ot(y?.history,"calls"),Le=ot(y?.history,"errors"),Ye=Vt(N),$e=Math.max(0,...N.map(Ut)),je;e[46]!==y||e[47]!==n?(je=y===null?void 0:Kt(n,y.cache),e[46]=y,e[47]=n,e[48]=je):je=e[48],A=je,V="flex flex-col gap-6",W="lunora-home",z="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",E="home-health";let Ke=it(Ie),xe;e[49]!==n?(xe=n("Requests"),e[49]=n,e[50]=xe):xe=e[50];let Be=y?.requests??0,be;e[51]!==Be?(be=Be.toLocaleString(),e[51]=Be,e[52]=be):be=e[52],e[53]!==Ie||e[54]!==Ke||e[55]!==xe||e[56]!==be?(R=(0,a.jsx)(qe,{delta:Ke,label:xe,trend:Ie,value:be}),e[53]=Ie,e[54]=Ke,e[55]=xe,e[56]=be,e[57]=R):R=e[57];let De=it(Le,!1),ye;e[58]!==n?(ye=n("Errors"),e[58]=n,e[59]=ye):ye=e[59];let Pe=y?.errors??0,ve;e[60]!==Pe?(ve=Pe.toLocaleString(),e[60]=Pe,e[61]=ve):ve=e[61],e[62]!==Le||e[63]!==De||e[64]!==ye||e[65]!==ve?(K=(0,a.jsx)(qe,{delta:De,label:ye,trend:Le,value:ve}),e[62]=Le,e[63]=De,e[64]=ye,e[65]=ve,e[66]=K):K=e[66],S=qe,e[67]!==$e||e[68]!==n?(O=$e>0?`${n("max")} ${Je($e)}`:void 0,e[67]=$e,e[68]=n,e[69]=O):O=e[69],e[70]!==n?(q=n("Avg latency"),e[70]=n,e[71]=q):q=e[71],P=Ye===null?"\u2014":Je(Ye),e[14]=I.data,e[15]=g.data,e[16]=y,e[17]=d.data,e[18]=s,e[19]=m.data,e[20]=v.data,e[21]=n,e[22]=S,e[23]=M,e[24]=A,e[25]=N,e[26]=C,e[27]=L,e[28]=T,e[29]=O,e[30]=q,e[31]=P,e[32]=z,e[33]=E,e[34]=R,e[35]=K,e[36]=V,e[37]=W,e[38]=F,e[39]=U}else S=e[22],M=e[23],A=e[24],N=e[25],C=e[26],L=e[27],T=e[28],O=e[29],q=e[30],P=e[31],z=e[32],E=e[33],R=e[34],K=e[35],V=e[36],W=e[37],F=e[38],U=e[39];let H;e[72]!==S||e[73]!==O||e[74]!==q||e[75]!==P?(H=(0,a.jsx)(S,{footer:O,label:q,value:P}),e[72]=S,e[73]=O,e[74]=q,e[75]=P,e[76]=H):H=e[76];let J;e[77]!==n?(J=n("Database size"),e[77]=n,e[78]=J):J=e[78];let Re=y?.databaseSize??null,G;e[79]!==Re?(G=et(Re),e[79]=Re,e[80]=G):G=e[80];let Y;e[81]!==A||e[82]!==J||e[83]!==G?(Y=(0,a.jsx)(qe,{footer:A,label:J,value:G}),e[81]=A,e[82]=J,e[83]=G,e[84]=Y):Y=e[84];let Z;e[85]!==z||e[86]!==E||e[87]!==R||e[88]!==K||e[89]!==H||e[90]!==Y?(Z=(0,a.jsxs)("div",{className:z,"data-testid":E,children:[R,K,H,Y]}),e[85]=z,e[86]=E,e[87]=R,e[88]=K,e[89]=H,e[90]=Y,e[91]=Z):Z=e[91];let we;e[92]===Symbol.for("react.memo_cache_sentinel")?(we=(0,a.jsx)(Nt,{}),e[92]=we):we=e[92];let Q;e[93]!==N?(Q=(0,a.jsx)("div",{className:"lg:col-span-2",children:(0,a.jsx)(Pt,{functions:N})}),e[93]=N,e[94]=Q):Q=e[94];let X;e[95]!==T?(X=(0,a.jsx)(zt,{subs:T}),e[95]=T,e[96]=X):X=e[96];let ee;e[97]!==M?(ee=(0,a.jsx)(Et,{entries:M}),e[97]=M,e[98]=ee):ee=e[98];let te;e[99]!==X||e[100]!==ee?(te=(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[X,ee]}),e[99]=X,e[100]=ee,e[101]=te):te=e[101];let ne;e[102]!==Q||e[103]!==te?(ne=(0,a.jsxs)("div",{className:"grid gap-3 lg:grid-cols-3",children:[Q,te]}),e[102]=Q,e[103]=te,e[104]=ne):ne=e[104];let ae;e[105]!==n?(ae=n("Advisors"),e[105]=n,e[106]=ae):ae=e[106];let re;e[107]!==ae?(re=(0,a.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ae}),e[107]=ae,e[108]=re):re=e[108];let se;e[109]!==C||e[110]!==L||e[111]!==n||e[112]!==F||e[113]!==U?(se=L===0&&C===0?(0,a.jsx)(Ze,{description:n("No security or performance issues detected."),icon:(0,a.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,a.jsx)("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),(0,a.jsx)("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:n("No issues found")}):(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,a.jsx)(ct,{count:L,onView:U,testId:"home-security",title:n("Security findings")}),(0,a.jsx)(ct,{count:C,onView:F,testId:"home-performance",title:n("Performance issues")})]}),e[109]=C,e[110]=L,e[111]=n,e[112]=F,e[113]=U,e[114]=se):se=e[114];let le;e[115]!==re||e[116]!==se?(le=(0,a.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[re,se]}),e[115]=re,e[116]=se,e[117]=le):le=e[117];let oe;e[118]!==n?(oe=n("Get connected"),e[118]=n,e[119]=oe):oe=e[119];let ie;e[120]!==oe?(ie=(0,a.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:oe}),e[120]=oe,e[121]=ie):ie=e[121];let ce;e[122]!==n?(ce=n("Client SDK"),e[122]=n,e[123]=ce):ce=e[123];let de;e[124]!==ce?(de=(0,a.jsx)(He,{command:"npm i @lunora/client",label:ce}),e[124]=ce,e[125]=de):de=e[125];let me;e[126]!==n?(me=n("React"),e[126]=n,e[127]=me):me=e[127];let ue;e[128]!==me?(ue=(0,a.jsx)(He,{command:"npm i @lunora/react",label:me}),e[128]=me,e[129]=ue):ue=e[129];let pe;e[130]!==n?(pe=n("CLI"),e[130]=n,e[131]=pe):pe=e[131];let fe;e[132]!==pe?(fe=(0,a.jsx)(He,{command:"lunora dev",label:pe}),e[132]=pe,e[133]=fe):fe=e[133];let he;e[134]!==de||e[135]!==ue||e[136]!==fe?(he=(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[de,ue,fe]}),e[134]=de,e[135]=ue,e[136]=fe,e[137]=he):he=e[137];let ke;e[138]===Symbol.for("react.memo_cache_sentinel")?(ke=(0,a.jsx)(Lt,{}),e[138]=ke):ke=e[138];let ge;e[139]!==ie||e[140]!==he?(ge=(0,a.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[ie,he,ke]}),e[139]=ie,e[140]=he,e[141]=ge):ge=e[141];let Se;return e[142]!==V||e[143]!==W||e[144]!==Z||e[145]!==ne||e[146]!==le||e[147]!==ge?(Se=(0,a.jsxs)("div",{className:V,"data-testid":W,children:[Z,we,ne,le,ge]}),e[142]=V,e[143]=W,e[144]=Z,e[145]=ne,e[146]=le,e[147]=ge,e[148]=Se):Se=e[148],Se},"as");function Wt(t,e){return e.calls-t.calls}c(Wt,"Ut");function Ft(t){return(0,a.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[(0,a.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),(0,a.jsx)("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),(0,a.jsx)("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:Je(t.calls>0?t.totalDurationMs/t.calls:0)}),(0,a.jsx)("span",{className:Ve("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}c(Ft,"qt");function Ut(t){return t.maxDurationMs}c(Ut,"Kt");export{xt as a,sn as b};
@@ -0,0 +1 @@
1
+ import{a as He}from"./chunk-Z5EV64KS.js";import{a as Se}from"./chunk-OUFWXYEF.js";import{a as Ge}from"./chunk-SOO2HXV6.js";import{a as qe}from"./chunk-ZWDORIZY.js";import{i as Ue}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as Ze}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as Ke}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as je}from"./chunk-4ZEL6BYL.js";import{p as $e}from"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import{f as Pe,h as Fe,i as me,j as Ce,k as Oe,s as Re}from"./chunk-LPINY2IJ.js";import{a as s,d as Me,e as ot,f as at,g as lt}from"./chunk-OXFKZ4BM.js";var De=Me(at(),1),m=Me(ot(),1);var r=Me(lt(),1);var ze=Fe(je.getPitrBookmark),st=Fe(je.pitrRestore),nt=/^\d+$/u,Je=s(ie=>{let e=ie.trim(),h=nt.test(e)?Number(e):Date.parse(e),l=new Date(h);return Number.isNaN(l.getTime())?void 0:{epochMs:h,iso:l.toISOString()}},"De"),it=s(ie=>{let e=(0,De.c)(9),{text:h}=ie,l=Pe();if(h.trim()==="")return null;let t,o,p;if(e[0]!==l||e[1]!==h){let y=Je(h);t="font-mono text-xs text-muted-foreground",o="pitr-time-resolved",p=y===void 0?l("Not a time \u2014 use epoch-ms or ISO 8601."):l("Resolves to {instant} (a date-time without an offset is read in this browser's time zone; a bare date is UTC)",{instant:y.iso}),e[0]=l,e[1]=h,e[2]=t,e[3]=o,e[4]=p}else t=e[2],o=e[3],p=e[4];let N;return e[5]!==t||e[6]!==o||e[7]!==p?(N=(0,r.jsx)("p",{className:t,"data-testid":o,children:p}),e[5]=t,e[6]=o,e[7]=p,e[8]=N):N=e[8],N},"lt"),vt=s(ie=>{let e=(0,De.c)(140),{initialShardKey:h}=ie,l=$e(),t=Pe(),o=h??"",p=He(o),[N,y]=(0,m.useState)(null),[f,Qe]=(0,m.useState)(""),[ce,Ee]=(0,m.useState)(null),[c,We]=(0,m.useState)(""),[b,Xe]=(0,m.useState)(!1),[i,Ye]=(0,m.useState)(null),[ue,w]=(0,m.useState)(null),[de,I]=(0,m.useState)(!1),[C,Ve]=(0,m.useState)(!1),pe;e[0]!==l||e[1]!==o?(pe=s(async a=>{I(!0),w(null);let d;try{d={current:(await l.query(ze,{},me(o))).current,error:null,unavailable:!1}}catch(n){let g=n;d={current:null,error:Ce(g),unavailable:Oe(g)==="PITR_UNAVAILABLE"}}a?.aborted!==!0&&(d.error===null?y(d.current):w(d.error),Ve(d.unavailable),I(!1))},"fe"),e[0]=l,e[1]=o,e[2]=pe):pe=e[2];let x=pe,he,fe;e[3]!==x?(he=s(()=>{let a=new AbortController;return Re(x(a.signal)),()=>{a.abort()}},"ue"),fe=[x],e[3]=x,e[4]=he,e[5]=fe):(he=e[4],fe=e[5]),(0,m.useEffect)(he,fe);let be;e[6]!==l||e[7]!==o?(be=s(async()=>{let a=await l.query(ze,{},me(o));y(a.current)},"he"),e[6]=l,e[7]=o,e[8]=be):be=e[8],Ge(be,!C);let xe;e[9]===Symbol.for("react.memo_cache_sentinel")?(xe=s(a=>{Qe(a.target.value)},"be"),e[9]=xe):xe=e[9];let et=xe,ke;e[10]===Symbol.for("react.memo_cache_sentinel")?(ke=s(a=>{We(a.target.value)},"xe"),e[10]=ke):ke=e[10];let tt=ke,Ne;e[11]===Symbol.for("react.memo_cache_sentinel")?(Ne=s(a=>{Xe(a.target.checked)},"ke"),e[11]=Ne):Ne=e[11];let rt=Ne,ve,R,u,k,v,ge;if(e[12]!==c||e[13]!==l||e[14]!==ce||e[15]!==x||e[16]!==o||e[17]!==p||e[18]!==t||e[19]!==f){u=Je(f),R=s(()=>{if(u===void 0)return;let d=o;Re((async()=>{I(!0),w(null);let n;try{n={result:await l.query(ze,{time:u.epochMs},me(d))}}catch(g){n={error:Ce(g)}}p.current===d&&("result"in n?(Ee(n.result.forTime===void 0?null:{bookmark:n.result.forTime,shard:d}),y(n.result.current)):(Ee(null),w(n.error)),I(!1))})())},"C"),v=ce?.shard===o?ce.bookmark:null;let a;e[26]!==l||e[27]!==x||e[28]!==o?(a=s(d=>{Re((async()=>{I(!0),w(null);try{let n=await l.mutation(st,d,me(o));Ye(n),await x()}catch(n){let g=n;w(Ce(g)),Oe(g)==="PITR_UNAVAILABLE"&&Ve(!0)}I(!1)})())},"o"),e[26]=l,e[27]=x,e[28]=o,e[29]=a):a=e[29],k=a,ve=c.trim()!==""||u!==void 0,ge=t("Restore {shard} to {target}?",{shard:o===""?t("root"):o,target:c.trim()===""?u?.iso??"":t("the given bookmark")}),e[12]=c,e[13]=l,e[14]=ce,e[15]=x,e[16]=o,e[17]=p,e[18]=t,e[19]=f,e[20]=ve,e[21]=R,e[22]=u,e[23]=k,e[24]=v,e[25]=ge}else ve=e[20],R=e[21],u=e[22],k=e[23],v=e[24],ge=e[25];let Te=ge,ye;e[30]!==c||e[31]!==u?.epochMs||e[32]!==b||e[33]!==k?(ye=s(()=>{let a=b?{restart:!0}:{};c.trim()===""?a.time=u?.epochMs:a.bookmark=c.trim(),k(a)},"Ne"),e[30]=c,e[31]=u?.epochMs,e[32]=b,e[33]=k,e[34]=ye):ye=e[34];let Be=ye,we;e[35]!==b||e[36]!==i||e[37]!==k?(we=s(()=>{i!==null&&k(b?{bookmark:i.undoBookmark,restart:!0}:{bookmark:i.undoBookmark})},"ye"),e[35]=b,e[36]=i,e[37]=k,e[38]=we):we=e[38];let Ae=we,S;e[39]!==t?(S=t("Shard"),e[39]=t,e[40]=S):S=e[40];let T;e[41]!==o||e[42]!==t?(T=o===""?t("root"):o,e[41]=o,e[42]=t,e[43]=T):T=e[43];let B;e[44]!==T?(B=(0,r.jsx)("span",{className:"font-mono",children:T}),e[44]=T,e[45]=B):B=e[45];let A;e[46]!==S||e[47]!==B?(A=(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[S,": ",B]})}),e[46]=S,e[47]=B,e[48]=A):A=e[48];let _;e[49]!==t?(_=t("In-place recovery to any moment in the last 30 days. For older or portable recovery, use the snapshot backup tier."),e[49]=t,e[50]=_):_=e[50];let L;e[51]!==_?(L=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"pitr-note",children:_}),e[51]=_,e[52]=L):L=e[52];let M;e[53]!==ue?(M=ue!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"pitr-error",role:"alert",children:ue}),e[53]=ue,e[54]=M):M=e[54];let P;e[55]!==t?(P=t("Current bookmark"),e[55]=t,e[56]=P):P=e[56];let U;e[57]!==P?(U=(0,r.jsx)("h3",{className:"mb-2 text-sm font-semibold",children:P}),e[57]=P,e[58]=U):U=e[58];let F;e[59]!==N?(F=N??(0,r.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[59]=N,e[60]=F):F=e[60];let O;e[61]!==F?(O=(0,r.jsx)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-current",children:F}),e[61]=F,e[62]=O):O=e[62];let j;e[63]!==U||e[64]!==O?(j=(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-3 shadow-xs",children:[U,O]}),e[63]=U,e[64]=O,e[65]=j):j=e[65];let q;e[66]!==t?(q=t("Restore"),e[66]=t,e[67]=q):q=e[67];let z;e[68]!==q?(z=(0,r.jsx)("h3",{className:"text-sm font-semibold",children:q}),e[68]=q,e[69]=z):z=e[69];let D;e[70]!==t?(D=t("Time (ISO or epoch-ms, last 30 days)"),e[70]=t,e[71]=D):D=e[71];let E;e[72]!==D?(E=(0,r.jsx)(Se,{htmlFor:"pitr-time",children:D}),e[72]=D,e[73]=E):E=e[73];let V;e[74]!==f?(V=(0,r.jsx)(Ue,{"data-testid":"pitr-time",id:"pitr-time",onChange:et,placeholder:"2026-06-01T00:00:00.000Z",value:f}),e[74]=f,e[75]=V):V=e[75];let _e=de||C||u===void 0,K;e[76]!==t?(K=t("Preview"),e[76]=t,e[77]=K):K=e[77];let Z;e[78]!==R||e[79]!==_e||e[80]!==K?(Z=(0,r.jsx)(Ze,{"data-testid":"pitr-preview",disabled:_e,onClick:R,size:"sm",type:"button",variant:"outline",children:K}),e[78]=R,e[79]=_e,e[80]=K,e[81]=Z):Z=e[81];let $;e[82]!==V||e[83]!==Z?($=(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[V,Z]}),e[82]=V,e[83]=Z,e[84]=$):$=e[84];let G;e[85]!==f?(G=(0,r.jsx)(it,{text:f}),e[85]=f,e[86]=G):G=e[86];let H;e[87]!==v||e[88]!==t?(H=v!==null&&(0,r.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-preview-bookmark",children:[t("Bookmark for that time"),": ",v]}),e[87]=v,e[88]=t,e[89]=H):H=e[89];let J;e[90]!==E||e[91]!==$||e[92]!==G||e[93]!==H?(J=(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[E,$,G,H]}),e[90]=E,e[91]=$,e[92]=G,e[93]=H,e[94]=J):J=e[94];let Q;e[95]!==t?(Q=t("Or an explicit bookmark (wins over time)"),e[95]=t,e[96]=Q):Q=e[96];let W;e[97]!==Q?(W=(0,r.jsx)(Se,{htmlFor:"pitr-bookmark",children:Q}),e[97]=Q,e[98]=W):W=e[98];let X;e[99]!==t?(X=t("bookmark string"),e[99]=t,e[100]=X):X=e[100];let Y;e[101]!==c||e[102]!==X?(Y=(0,r.jsx)(Ue,{"data-testid":"pitr-bookmark",id:"pitr-bookmark",onChange:tt,placeholder:X,value:c}),e[101]=c,e[102]=X,e[103]=Y):Y=e[103];let ee;e[104]!==W||e[105]!==Y?(ee=(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[W,Y]}),e[104]=W,e[105]=Y,e[106]=ee):ee=e[106];let te;e[107]!==b?(te=(0,r.jsx)("input",{checked:b,className:"size-4 accent-primary","data-testid":"pitr-restart",id:"pitr-restart",onChange:rt,type:"checkbox"}),e[107]=b,e[108]=te):te=e[108];let re;e[109]!==t?(re=t("Restart the shard now so recovery applies immediately"),e[109]=t,e[110]=re):re=e[110];let oe;e[111]!==te||e[112]!==re?(oe=(0,r.jsxs)(Se,{className:"flex items-center gap-2 text-xs font-normal text-muted-foreground",htmlFor:"pitr-restart",children:[te,re]}),e[111]=te,e[112]=re,e[113]=oe):oe=e[113];let Le=de||C||!ve,ae;e[114]!==t?(ae=t("Restore"),e[114]=t,e[115]=ae):ae=e[115];let le;e[116]!==Te||e[117]!==Be||e[118]!==Le||e[119]!==ae?(le=(0,r.jsx)("div",{children:(0,r.jsx)(qe,{confirmLabel:Te,disabled:Le,onConfirm:Be,testId:"pitr-restore",children:ae})}),e[116]=Te,e[117]=Be,e[118]=Le,e[119]=ae,e[120]=le):le=e[120];let se;e[121]!==z||e[122]!==J||e[123]!==ee||e[124]!==oe||e[125]!==le?(se=(0,r.jsxs)("section",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-3 shadow-xs",children:[z,J,ee,oe,le]}),e[121]=z,e[122]=J,e[123]=ee,e[124]=oe,e[125]=le,e[126]=se):se=e[126];let ne;e[127]!==de||e[128]!==Ae||e[129]!==i||e[130]!==t||e[131]!==C?(ne=i!==null&&(0,r.jsxs)("section",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs","data-testid":"pitr-result",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold",children:t("Restore armed")}),(0,r.jsx)(Ke,{variant:i.restarted?"destructive":"secondary",children:i.restarted?t("restarted now"):t("on next restart")})]}),(0,r.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground",children:[t("Restored to"),": ",i.restoredTo]}),(0,r.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-undo-bookmark",children:[t("Undo bookmark"),": ",i.undoBookmark]}),(0,r.jsx)("div",{children:(0,r.jsx)(qe,{confirmLabel:t("Confirm undo"),disabled:de||C,onConfirm:Ae,testId:"pitr-undo",children:t("Undo restore")})})]}),e[127]=de,e[128]=Ae,e[129]=i,e[130]=t,e[131]=C,e[132]=ne):ne=e[132];let Ie;return e[133]!==A||e[134]!==L||e[135]!==M||e[136]!==j||e[137]!==se||e[138]!==ne?(Ie=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-pitr",children:[A,L,M,j,se,ne]}),e[133]=A,e[134]=L,e[135]=M,e[136]=j,e[137]=se,e[138]=ne,e[139]=Ie):Ie=e[139],Ie},"Nt");export{vt as PitrPanel};
@@ -0,0 +1 @@
1
+ import{a as ae,b as tn,c as on}from"./chunk-LIGOLZND.js";import{a as nn}from"./chunk-3GXPALXG.js";import{a as ho,b as ko,c as wo,d as _o,e as Lo,f as Go,g as qo,h as Qo}from"./chunk-AP4PC2M4.js";import{$ as dt,A as Ro,B as xo,C as ct,E as Mo,G as bo,I as Co,J as vo,M as Io,N as Eo,O as yo,P as Po,R as So,S as No,T as Oo,U as To,W as Ut,Y as Do,_ as Ao,aa as Vo,ba as Bo,ca as pt,ea as Uo,fa as Ho,j as uo,k as co,la as zo,ma as Yo,na as Ko,oa as $o,p as Gt,qa as Wo,r as po,ra as Jo,s as lo,sa as Xo,u as mo,v as it,w as at,x as fo,y as ut,z as go}from"./chunk-KRPXOSBL.js";import{b as jo}from"./chunk-W2BCSK5S.js";import{i as Zo,k as en}from"./chunk-XYR5NST4.js";import{D as Ne,H as nt,I as Ue,J as rt,K as st,M as y,N as re,a as Bt,b as Z,c as tt,e as Lt,l as so,o as io,p as Ft,q as ao,r as ot}from"./chunk-W7MRISE3.js";import{a as lt,b as Fo,c as He}from"./chunk-JTGGWF7R.js";import{a as ie,c as Se,i as oo,q as no,t as ro,w as $e}from"./chunk-ZBON5T5A.js";import{a as he,c as G,d as Ze,e as et,g as Ge,h as Ke,i as se,j as O}from"./chunk-4C4THJUD.js";import{b as Fe}from"./chunk-LPINY2IJ.js";import{a as o,c as sr,d as M,e as E,f as ir,g as me}from"./chunk-OXFKZ4BM.js";var Ve=M(ir(),1);var ee={};sr(ee,{Arrow:()=>sn,Backdrop:()=>un,CheckboxItem:()=>fn,CheckboxItemIndicator:()=>gn,Group:()=>Mn,GroupLabel:()=>bn,Handle:()=>qe,Item:()=>vn,LinkItem:()=>In,Popup:()=>yn,Portal:()=>Nn,Positioner:()=>On,RadioGroup:()=>kn,RadioItem:()=>Dn,RadioItemIndicator:()=>An,Root:()=>Dt,Separator:()=>nn,SubmenuRoot:()=>Un,SubmenuTrigger:()=>Jn,Trigger:()=>Kn,Viewport:()=>Wn,createHandle:()=>Xn});var rn=M(E(),1);var mt=M(E(),1);var Ht=mt.createContext(void 0);function K(t){let e=mt.useContext(Ht);if(e===void 0&&!t)throw new Error(G(33));return e}o(K,"useMenuPositionerContext");var ft=M(E(),1);var jt=ft.createContext(void 0);function D(t){let e=ft.useContext(jt);if(e===void 0&&!t)throw new Error(G(36));return e}o(D,"useMenuRootContext");var sn=rn.forwardRef(o(function(e,n){let{render:s,className:u,style:c,...i}=e,{store:p}=D(),{arrowRef:r,side:m,align:f,arrowUncentered:R,arrowStyles:h}=K(),P={open:p.useState("open"),side:m,align:f,uncentered:R};return O("div",e,{ref:[r,n],stateAttributesMapping:ao,state:P,props:{style:h,"aria-hidden":!0,...i}})},"MenuArrow"));var an=M(E(),1);var gt=M(E(),1);var ar=gt.createContext(void 0);function Oe(t=!0){let e=gt.useContext(ar);if(e===void 0&&!t)throw new Error(G(25));return e}o(Oe,"useContextMenuRootContext");var un=an.forwardRef(o(function(e,n){let{render:s,className:u,style:c,...i}=e,{store:p}=D(),r=p.useState("open"),m=p.useState("mounted"),f=p.useState("transitionStatus"),R=p.useState("lastOpenChangeReason"),h=Oe(),x={open:r,transitionStatus:f};return O("div",e,{ref:h?.backdropRef?[n,h.backdropRef]:n,state:x,stateAttributesMapping:ot,props:[{role:"presentation",hidden:!m,style:{pointerEvents:R===y.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},i]})},"MenuBackdrop"));var Mt=M(E(),1);var Rt=M(E(),1);var zt=Rt.createContext(void 0);function cn(){let t=Rt.useContext(zt);if(t===void 0)throw new Error(G(30));return t}o(cn,"useMenuCheckboxItemContext");var je=M(E(),1);var dn=M(E(),1);function xt(t){let{closeOnClick:e,highlighted:n,id:s,nodeId:u,store:c,typingRef:i,itemRef:p,itemMetadata:r}=t,{events:m}=c.useState("floatingTreeRoot"),f=c.useState("open"),R=Oe(!0),h=R!==void 0;return dn.useMemo(()=>({id:s,role:"menuitem",tabIndex:f&&n?0:-1,onKeyDown(x){x.key===" "&&i?.current&&x.preventDefault()},onMouseMove(x){u&&m.emit("itemhover",{nodeId:u,target:x.currentTarget})},onClick(x){e&&m.emit("close",{domEvent:x,reason:y.itemPress})},onMouseUp(x){if(R){let P=R.initialCursorPointRef.current;if(R.initialCursorPointRef.current=null,h&&P&&Math.abs(x.clientX-P.x)<=1&&Math.abs(x.clientY-P.y)<=1||h&&!tt.os.mac&&x.button===2)return}p.current&&c.context.allowMouseUpTriggerRef.current&&(!h||x.button===2)&&r.type==="regular-item"&&Fo(p.current,x,{detail:1})}}),[e,n,s,m,u,f,c,i,p,R,h,r])}o(xt,"useMenuItemCommonProps");var Te={type:"regular-item"};function ke(t){let{closeOnClick:e,disabled:n,highlighted:s,id:u,store:c,typingRef:i=c.context.typingRef,nativeButton:p,itemMetadata:r,nodeId:m}=t,f=je.useRef(null),{getButtonProps:R,buttonRef:h}=He({disabled:n,focusableWhenDisabled:!0,native:p,composite:!0}),x=xt({closeOnClick:e,highlighted:s,id:u,nodeId:m,store:c,typingRef:i,itemRef:f,itemMetadata:r}),P=je.useCallback(A=>he(x,{onMouseEnter(){r.type==="submenu-trigger"&&r.setActive()}},A,R),[x,R,r]),S=et(f,h);return je.useMemo(()=>({getItemProps:P,itemRef:S}),[P,S])}o(ke,"useMenuItem");var pn="data-checked",ln="data-unchecked";var we={checked(t){return t?{[pn]:""}:{[ln]:""}},...so};var mn=M(me(),1);var fn=Mt.forwardRef(o(function(e,n){let{render:s,className:u,id:c,label:i,nativeButton:p=!1,disabled:r=!1,closeOnClick:m=!1,checked:f,defaultChecked:R,onCheckedChange:h,style:x,...P}=e,S=ae({guess:!0,label:i}),A=K(!0),d=Z(c),{store:g}=D(),l=g.useState("disabled"),V=r||l,v=g.useState("isActive",S.index),C=g.useState("itemProps"),[B,b]=st({controlled:f,default:R??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:z,itemRef:F}=ke({closeOnClick:m,disabled:V,highlighted:v,id:d,store:g,nativeButton:p,nodeId:A?.context.nodeId,itemMetadata:Te}),N=Mt.useMemo(()=>({disabled:V,highlighted:v,checked:B}),[V,v,B]);function a(Y){let T=re(y.itemPress,Y.nativeEvent,void 0,{preventUnmountOnClose:Ge});h?.(!B,T),!T.isCanceled&&b(k=>!k)}o(a,"handleClick");let H=O("div",e,{state:N,stateAttributesMapping:we,props:[C,{role:"menuitemcheckbox","aria-checked":B,onClick:a},P,z],ref:[F,n,S.ref]});return(0,mn.jsx)(zt.Provider,{value:N,children:H})},"MenuCheckboxItem"));var ht=M(E(),1);var gn=ht.forwardRef(o(function(e,n){let{render:s,className:u,style:c,keepMounted:i=!1,...p}=e,r=cn(),m=ht.useRef(null),{transitionStatus:f,mounted:R,setMounted:h}=rt(r.checked);Ue({batch:!0,enabled:!r.checked,open:r.checked,ref:m,onComplete(){r.checked||h(!1)}});let x={checked:r.checked,disabled:r.disabled,highlighted:r.highlighted,transitionStatus:f};return O("span",e,{state:x,ref:[n,m],stateAttributesMapping:we,props:{"aria-hidden":!0,...p},enabled:i||R})},"MenuCheckboxItemIndicator"));var Ct=M(E(),1);var bt=M(E(),1);var We=bt.createContext(void 0);function Rn(){let t=bt.useContext(We);if(t===void 0)throw new Error(G(31));return t}o(Rn,"useMenuGroupRootContext");var xn=M(me(),1);var Mn=Ct.forwardRef(o(function(e,n){let{render:s,className:u,style:c,...i}=e,[p,r]=Ct.useState(void 0),m=O("div",e,{ref:n,props:{role:"group","aria-labelledby":p,...i}});return(0,xn.jsx)(We.Provider,{value:r,children:m})},"MenuGroup"));var hn=M(E(),1);var bn=hn.forwardRef(o(function(e,n){let{render:s,className:u,style:c,id:i,...p}=e,r=Z(i),m=Rn();return ie(()=>(m(r),()=>{m(f=>f===r?void 0:f)}),[m,r]),O("div",e,{ref:n,props:{id:r,"aria-hidden":!0,...p}})},"MenuGroupLabel"));var Cn=M(E(),1);var vn=Cn.forwardRef(o(function(e,n){let{render:s,className:u,id:c,label:i,nativeButton:p=!1,disabled:r=!1,closeOnClick:m=!0,style:f,...R}=e,h=ae({guess:!0,label:i}),x=K(!0),P=Z(c),{store:S}=D(),A=S.useState("disabled"),d=r||A,g=S.useState("isActive",h.index),l=S.useState("itemProps"),{getItemProps:V,itemRef:v}=ke({closeOnClick:m,disabled:d,highlighted:g,id:P,store:S,nativeButton:p,nodeId:x?.context.nodeId,itemMetadata:Te});return O("div",e,{state:{disabled:d,highlighted:g},props:[l,R,V],ref:[v,n,h.ref]})},"MenuItem"));var vt=M(E(),1);var In=vt.forwardRef(o(function(e,n){let{render:s,className:u,id:c,label:i,closeOnClick:p=!1,style:r,...m}=e,f=vt.useRef(null),R=ae({guess:!0,label:i}),x=K(!0)?.context.nodeId,P=Z(c),{store:S}=D(),A=S.useState("isActive",R.index),d=S.useState("itemProps"),g=S.context.typingRef,{getButtonProps:l,buttonRef:V}=He({native:!1,composite:!0}),v=xt({closeOnClick:p,highlighted:A,id:P,nodeId:x,store:S,typingRef:g,itemRef:f,itemMetadata:Te});function C(b){return he(v,b,l)}return o(C,"getItemProps"),O("a",e,{state:{highlighted:A},props:[d,m,C],ref:[f,V,n,R.ref]})},"MenuLinkItem"));var It=M(E(),1);var En=M(me(),1);var yn=It.forwardRef(o(function(e,n){let{render:s,className:u,style:c,finalFocus:i,...p}=e,{store:r}=D(),{side:m,align:f}=K(),R=Xo(!0)!=null,h=r.useState("open"),x=r.useState("transitionStatus"),P=r.useState("popupProps"),S=r.useState("mounted"),A=r.useState("instantType"),d=r.useState("activeTriggerElement"),g=r.useState("parent"),l=r.useState("lastOpenChangeReason"),V=r.useState("rootId"),v=r.useState("floatingRootContext"),C=r.useState("floatingTreeRoot"),B=r.useState("closeDelay"),b=r.useState("hoverEnabled"),z=r.useState("disabled"),F=r.useState("openMethod"),N=g.type==="context-menu";Ue({open:h,ref:r.context.popupRef,onComplete(){h&&r.context.onOpenChangeComplete?.(!0)}}),It.useEffect(()=>{function k(ue){r.setOpen(!1,re(ue.reason,ue.domEvent))}return o(k,"handleClose"),C.events.on("close",k),()=>{C.events.off("close",k)}},[C.events,r]),Ao(v,{enabled:b&&!z&&!N&&g.type!=="menubar",closeDelay:B});let a=r.useStateSetter("popupElement"),H={transitionStatus:x,side:m,align:f,open:h,nested:g.type==="menu",instant:A},Y=O("div",e,{state:H,ref:[n,r.context.popupRef,a],stateAttributesMapping:ot,props:[P,{onKeyDown(k){R&&Jo.has(k.key)&&k.stopPropagation()}},Ko(x),p,{"data-rootownerid":V}]}),T=g.type===void 0||N;return(d||g.type==="menubar"&&l!==y.outsidePress)&&(T=!0),(0,En.jsx)(xo,{context:v,openInteractionType:F,modal:N,disabled:!S,returnFocus:i===void 0?T:i,initialFocus:g.type!=="menu",restoreFocus:!0,externalTree:g.type!=="menubar"?C:void 0,previousFocusableElement:d,nextFocusableElement:g.type===void 0?r.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:g.type===void 0?r.context.beforeContentFocusGuardRef:void 0,children:Y})},"MenuPopup"));var Sn=M(E(),1);var Et=M(E(),1);var Yt=Et.createContext(void 0);function Pn(){let t=Et.useContext(Yt);if(t===void 0)throw new Error(G(32));return t}o(Pn,"useMenuPortalContext");var Kt=M(me(),1);var Nn=Sn.forwardRef(o(function(e,n){let{keepMounted:s=!1,...u}=e,{store:c,parent:i}=D();if(!(c.useState("mounted")||s))return null;let m=i.type==="menu"||i.type==="menubar"?"group":void 0;return(0,Kt.jsx)(Yt.Provider,{value:s,children:(0,Kt.jsx)(mo,{ref:n,...u,portalOwnerRole:m})})},"MenuPortal"));var be=M(E(),1);var ze=M(me(),1);var On=be.forwardRef(o(function(e,n){let{anchor:s,positionMethod:u="absolute",className:c,render:i,side:p,align:r,sideOffset:m=0,alignOffset:f=0,collisionBoundary:R="clipping-ancestors",collisionPadding:h=5,arrowPadding:x=5,sticky:P=!1,disableAnchorTracking:S=!1,collisionAvoidance:A=po,style:d,...g}=e,{store:l}=D(),V=Pn(),v=Oe(!0),C=l.useState("parent"),B=l.useState("floatingRootContext"),b=l.useState("floatingTreeRoot"),z=l.useState("mounted"),F=l.useState("open"),N=l.useState("modal"),a=l.useState("openMethod"),H=l.useState("activeTriggerElement"),Y=l.useState("transitionStatus"),T=l.useState("positionerElement"),k=l.useState("instantType"),ue=l.useState("adaptiveOrigin"),te=l.useState("lastOpenChangeReason"),W=l.useState("floatingNodeId"),ye=l.useState("floatingParentNodeId"),w=B.useState("domReferenceElement"),fe=be.useRef(null),ge=nt(T),ce=s,Ce=m,Re=f,de=r,X=A;C.type==="context-menu"&&(ce=s??C.context?.anchor,de=de??"start",!p&&de!=="center"&&(Re=e.alignOffset??2,Ce=e.sideOffset??-5));let oe=p,pe=de;C.type==="menu"?(oe=oe??"inline-end",pe=pe??"start",X=e.collisionAvoidance??lo):C.type==="menubar"&&(oe=oe??(C.context.orientation==="vertical"?"inline-end":"bottom"),pe=pe??"start");let q=C.type==="context-menu",ne=zo({anchor:ce,floatingRootContext:B,positionMethod:v?"fixed":u,mounted:z,side:oe,sideOffset:Ce,align:pe,alignOffset:Re,arrowPadding:q?0:x,collisionBoundary:R,collisionPadding:h,sticky:P,nodeId:W,keepMounted:V,disableAnchorTracking:S,collisionAvoidance:X,shift:q?{crossAxis:!("side"in X&&X.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:b,adaptiveOrigin:ue});be.useEffect(()=>{function L(_){_.open&&(_.parentNodeId===W&&l.set("hoverEnabled",!1),_.nodeId!==W&&_.parentNodeId===l.select("floatingParentNodeId")&&l.setOpen(!1,re(y.siblingOpen)))}return o(L,"onMenuOpenChange"),b.events.on("menuopenchange",L),()=>{b.events.off("menuopenchange",L)}},[l,b.events,W]),be.useEffect(()=>{if(l.select("floatingParentNodeId")==null)return;function L(_){if(_.open||_.nodeId!==l.select("floatingParentNodeId"))return;let Ie=_.reason??y.siblingOpen;l.setOpen(!1,re(Ie))}return o(L,"onParentClose"),b.events.on("menuopenchange",L),()=>{b.events.off("menuopenchange",L)}},[b.events,l]);let le=Ne();be.useEffect(()=>{F||le.clear()},[F,le]),be.useEffect(()=>{function L(_){if(!(!F||_.nodeId!==l.select("floatingParentNodeId")))if(_.target&&H&&H!==_.target){let Ie=l.select("closeDelay");Ie>0?le.isStarted()||le.start(Ie,()=>{l.setOpen(!1,re(y.siblingOpen))}):l.setOpen(!1,re(y.siblingOpen))}else le.clear()}return o(L,"onItemHover"),b.events.on("itemhover",L),()=>{b.events.off("itemhover",L)}},[b.events,F,H,l,le]),be.useEffect(()=>{let L={open:F,nodeId:W,parentNodeId:ye,reason:l.select("lastOpenChangeReason")};b.events.emit("menuopenchange",L)},[b.events,F,l,W,ye]),ie(()=>{let L=w,_=fe.current;if(L&&(fe.current=L),_&&L&&L!==_){l.set("instantType",void 0);let Ie=new AbortController;return ge(()=>{l.set("instantType","trigger-change")},Ie.signal),()=>{Ie.abort()}}},[w,ge,l]);let Be={open:F,side:ne.side,align:ne.align,anchorHidden:ne.anchorHidden,nested:C.type==="menu",instant:k},Le=C.type==="menubar"&&C.context.modal,xe=N&&te!==y.triggerHover;Wo(F&&(Le||xe),a==="touch",T,H);let Me=$o(e,Be,{styles:ne.positionerStyles,transitionStatus:Y,props:g,refs:[n,l.useStateSetter("positionerElement")],hidden:!z,inert:!F}),Pe=z&&C.type!=="menu"&&(C.type!=="menubar"&&N&&te!==y.triggerHover||C.type==="menubar"&&C.context.modal),ve=null;return C.type==="menubar"?ve=C.context.contentElement:C.type===void 0&&(ve=H),(0,ze.jsxs)(Ht.Provider,{value:ne,children:[Pe&&(0,ze.jsx)(Yo,{ref:C.type==="context-menu"||C.type==="nested-context-menu"?C.context.internalBackdropRef:null,inert:Ho(!F),cutout:ve}),(0,ze.jsx)(go,{id:W,children:(0,ze.jsx)(tn,{elementsRef:l.context.itemDomElements,labelsRef:l.context.itemLabels,children:Me})})]})},"MenuPositioner"));var _e=M(E(),1);var yt=M(E(),1);var $t=yt.createContext(void 0);function Tn(){let t=yt.useContext($t);if(t===void 0)throw new Error(G(34));return t}o(Tn,"useMenuRadioGroupContext");var Wt=M(me(),1);var kn=_e.memo(_e.forwardRef(o(function(e,n){let{render:s,className:u,value:c,defaultValue:i,onValueChange:p,disabled:r=!1,style:m,"aria-labelledby":f,...R}=e,[h,x]=_e.useState(void 0),[P,S]=st({controlled:c,default:i,name:"MenuRadioGroup"}),A=Se((V,v)=>{p?.(V,v),!v.isCanceled&&S(V)}),g=O("div",e,{state:{disabled:r},ref:n,props:{role:"group","aria-labelledby":f??h,"aria-disabled":r||void 0,...R}}),l=_e.useMemo(()=>({value:P,setValue:A,disabled:r}),[P,A,r]);return(0,Wt.jsx)(We.Provider,{value:x,children:(0,Wt.jsx)($t.Provider,{value:l,children:g})})},"MenuRadioGroup")));var St=M(E(),1);var Pt=M(E(),1);var Jt=Pt.createContext(void 0);function wn(){let t=Pt.useContext(Jt);if(t===void 0)throw new Error(G(35));return t}o(wn,"useMenuRadioItemContext");var _n=M(me(),1);var Dn=St.forwardRef(o(function(e,n){let{render:s,className:u,id:c,label:i,nativeButton:p=!1,disabled:r=!1,closeOnClick:m=!1,value:f,style:R,...h}=e,x=ae({guess:!0,label:i}),P=K(!0),S=Z(c),{store:A}=D(),d=A.useState("isActive",x.index),g=A.useState("itemProps"),{value:l,setValue:V,disabled:v}=Tn(),C=A.useState("disabled"),B=r||v||C,b=l===f,{getItemProps:z,itemRef:F}=ke({closeOnClick:m,disabled:B,highlighted:d,id:S,store:A,nativeButton:p,nodeId:P?.context.nodeId,itemMetadata:Te}),N=St.useMemo(()=>({disabled:B,highlighted:d,checked:b}),[B,d,b]);function a(Y){let T=re(y.itemPress,Y.nativeEvent,void 0,{preventUnmountOnClose:Ge});V(f,T)}o(a,"handleClick");let H=O("div",e,{state:N,stateAttributesMapping:we,props:[g,{role:"menuitemradio","aria-checked":b,onClick:a},h,z],ref:[F,n,x.ref]});return(0,_n.jsx)(Jt.Provider,{value:N,children:H})},"MenuRadioItem"));var Nt=M(E(),1);var An=Nt.forwardRef(o(function(e,n){let{render:s,className:u,style:c,keepMounted:i=!1,...p}=e,r=wn(),m=Nt.useRef(null),{transitionStatus:f,mounted:R,setMounted:h}=rt(r.checked);Ue({batch:!0,enabled:!r.checked,open:r.checked,ref:m,onComplete(){r.checked||h(!1)}});let x={checked:r.checked,disabled:r.disabled,highlighted:r.highlighted,transitionStatus:f};return O("span",e,{state:x,stateAttributesMapping:we,ref:[n,m],props:{"aria-hidden":!0,...p},enabled:i||R})},"MenuRadioItemIndicator"));var U=M(E(),1);var Ot=M(E(),1);var cr=Ot.createContext(null);function Tt(t){let e=Ot.useContext(cr);if(e===null&&!t)throw new Error(G(5));return e}o(Tt,"useMenubarContext");var Je=M(E(),1);var Vn={...wo,disabled:o(t=>t.parent.type==="menubar"&&t.parent.context.disabled||t.disabled,"disabled"),modal:o(t=>(t.parent.type===void 0||t.parent.type==="context-menu")&&(t.modal??!0),"modal"),openMethod:o(t=>t.openMethod,"openMethod"),allowMouseEnter:o(t=>t.allowMouseEnter,"allowMouseEnter"),highlightItemOnHover:o(t=>t.highlightItemOnHover,"highlightItemOnHover"),parent:o(t=>t.parent,"parent"),rootId:o(t=>t.parent.type==="menu"?t.parent.store.select("rootId"):t.parent.type!==void 0?t.parent.context.rootId:t.rootId,"rootId"),activeIndex:o(t=>t.activeIndex,"activeIndex"),isActive:o((t,e)=>t.activeIndex===e,"isActive"),hoverEnabled:o(t=>t.hoverEnabled,"hoverEnabled"),instantType:o(t=>t.instantType,"instantType"),lastOpenChangeReason:o(t=>t.openChangeReason,"lastOpenChangeReason"),floatingTreeRoot:o(t=>t.parent.type==="menu"?t.parent.store.select("floatingTreeRoot"):t.floatingTreeRoot,"floatingTreeRoot"),floatingNodeId:o(t=>t.floatingNodeId,"floatingNodeId"),floatingParentNodeId:o(t=>t.floatingParentNodeId,"floatingParentNodeId"),itemProps:o(t=>t.itemProps,"itemProps"),closeDelay:o(t=>t.closeDelay,"closeDelay"),adaptiveOrigin:o(t=>t.adaptiveOrigin,"adaptiveOrigin"),keyboardEventRelay:o(t=>{if(t.keyboardEventRelay)return t.keyboardEventRelay;if(t.parent.type==="menu")return t.parent.store.select("keyboardEventRelay")},"keyboardEventRelay")},kt=class extends bo{static{o(this,"MenuStore")}constructor(e,n,s=!1){let u=new Ut,c=Fn(u,n,s,e);super(c,Ln(u),Vn),this.unsubscribeParentListener=this.observe("parent",i=>{if(this.unsubscribeParentListener?.(),i.type==="menu"){let p=i.store.select("rootId"),r=i.store.select("floatingTreeRoot"),m=i.store.select("keyboardEventRelay");this.unsubscribeParentListener=i.store.subscribe(()=>{let f=i.store.select("rootId"),R=i.store.select("floatingTreeRoot"),h=i.store.select("keyboardEventRelay");p===f&&r===R&&m===h||(p=f,r=R,m=h,this.notifyAll())}),this.context.allowMouseUpTriggerRef=i.store.context.allowMouseUpTriggerRef;return}i.type!==void 0&&(this.context.allowMouseUpTriggerRef=i.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:e,eventDetails:n})}unsubscribeParentListener=null};function Bn(){let t=new Ut,e=new Lo(Object.freeze(Fn(t)),Object.freeze(Ln(t)),Vn);return Object.assign(e,{setOpen:Ge})}o(Bn,"createNullMenuStore");function Ln(t){return{positionerRef:Je.createRef(),popupRef:Je.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Je.createRef(),beforeContentFocusGuardRef:Je.createRef(),onOpenChangeComplete:void 0,triggerElements:t}}o(Ln,"createInitialContext");function Fn(t,e,n=!1,s){return{...ko(t,e,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new it,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:se,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...s}}o(Fn,"createInitialState");var wt=M(E(),1);var Xt=wt.createContext(void 0);function _t(){return wt.useContext(Xt)}o(_t,"useMenuSubmenuRootContext");var Xe=M(me(),1);var Dt=uo(o(function(e){let{children:n,open:s,onOpenChange:u,onOpenChangeComplete:c,defaultOpen:i=!1,disabled:p=!1,modal:r,loopFocus:m=!0,orientation:f="vertical",actionsRef:R,closeParentOnEsc:h=!1,handle:x,triggerId:P,defaultTriggerId:S=null,highlightItemOnHover:A=!0}=e,d=Oe(!0),g=D(!0),l=Tt(!0),V=_t(),v=U.useMemo(()=>V&&g?{type:"menu",store:g.store}:l?{type:"menubar",context:l}:d&&!g?{type:"context-menu",context:d}:{type:void 0},[d,g,l,V]),C=Bt(),B=Bt(),b=at(),z=v.type==="menu"?v.store:void 0,F=(s??i)&&z?.state.transitionStatus==="starting",N=Ze(()=>F?z?.state.instantType:void 0).current,a=dr({open:i,openProp:s,activeTriggerId:S,triggerIdProp:P,parent:v,disabled:p,highlightItemOnHover:A,modal:v.type===void 0?r:void 0,rootId:C,instantType:N},B,b!=null);a.useControlledProp("openProp",s),a.useControlledProp("triggerIdProp",P),a.useContextCallback("onOpenChangeComplete",c);let H=a.useState("floatingTreeRoot"),Y=ut(H),T=a.useState("open"),k=a.useState("activeTriggerElement"),ue=a.useState("positionerElement"),te=a.useState("hoverEnabled"),W=a.useState("disabled"),ye=a.useState("lastOpenChangeReason"),w=a.useState("parent"),fe=a.useState("activeIndex"),ge=a.useState("payload"),ce=a.useState("floatingParentNodeId"),Ce=U.useRef(null),Re=U.useRef(w.type!=="context-menu"),de=Ne(),X=U.useRef(!0),oe=Ne(),pe=ce!=null,{openMethod:q,triggerProps:ne}=Uo(T);a.useSyncedValues({disabled:p,highlightItemOnHover:A,modal:w.type===void 0?r:void 0,openMethod:q,rootId:C}),No(a);let{forceUnmount:le,transitionStatus:Be}=Oo(T,a,()=>{a.set("allowMouseEnter",!1)},F),Le=nt(a.context.popupRef);U.useEffect(()=>{if(N===void 0)return;let I=o(()=>{a.state.instantType===N&&a.set("instantType",void 0)},"clearSeededInstantType");if(!T){I();return}if(Be!==void 0)return;if(a.context.popupRef.current==null){I();return}let j=new AbortController;return Le(I,j.signal),()=>{j.abort()}},[N,T,Be,Le,a]),ie(()=>{d&&!g?a.update({parent:{type:"context-menu",context:d},floatingNodeId:Y,floatingParentNodeId:b}):g&&a.update({floatingNodeId:Y,floatingParentNodeId:b})},[d,g,Y,b,a]),U.useEffect(()=>{if(T||(Ce.current=null),w.type==="context-menu"){if(!T){de.clear(),Re.current=!1;return}de.start(500,()=>{Re.current=!0})}},[de,T,w.type]),ie(()=>{!T&&!te&&a.set("hoverEnabled",!0)},[T,te,a]);let xe=Se((I,j)=>{let Q=j.reason;if(!I&&!a.select("open")||T===I&&j.trigger===k&&ye===Q)return;let nr=Po(j);if(!I&&j.trigger==null&&(j.trigger=k??void 0),u?.(I,j),j.isCanceled)return;a.state.floatingRootContext.dispatchOpenChange(I,j);let Vt=j.event;if(I===!1&&Vt?.type==="click"&&Vt.pointerType==="touch"&&!X.current)return;I&&Q===y.triggerFocus?(X.current=!1,oe.start(300,()=>{X.current=!0})):(X.current=!0,oe.clear());let to=(Q===y.triggerPress||Q===y.itemPress)&&Vt.detail===0,rr=!I&&(Q===y.escapeKey||Q==null);Ce.current=j.event;let Ye=yo(a.state,I,j.trigger,nr());Ye.openChangeReason=Q,w.type==="menubar"&&(Q===y.triggerFocus||Q===y.focusOut||Q===y.triggerHover||Q===y.listNavigation||Q===y.siblingOpen)?Ye.instantType="group":to||rr?Ye.instantType=to?"click":"dismiss":Ye.instantType=void 0,a.update(Ye)}),Me=Co({popupStore:a,floatingRootContext:a.state.floatingRootContext,floatingId:B,nested:b!=null,onOpenChange:xe}),Pe=Me.context.events;ie(()=>{let I=o(({open:j,eventDetails:Q})=>xe(j,Q),"handleSetOpenEvent");return Pe.on("setOpen",I),()=>{Pe?.off("setOpen",I)}},[Pe,xe]);let ve=U.useCallback(()=>{a.setOpen(!1,re(y.imperativeAction))},[a]);U.useImperativeHandle(R,()=>({unmount:le,close:ve}),[le,ve]);let L;w.type==="context-menu"&&(L=w.context),U.useImperativeHandle(L?.positionerRef,()=>ue,[ue]),U.useImperativeHandle(L?.actionsRef,()=>({setOpen:xe}),[xe]);let _=Mo(Me,{enabled:!W,bubbles:{escapeKey:h&&w.type==="menu"},outsidePress(){return w.type!=="context-menu"||Ce.current?.type==="contextmenu"?!0:Re.current},externalTree:pe?H:void 0}),Ie=jo(),qn=U.useCallback(I=>{a.select("activeIndex")!==I&&a.set("activeIndex",I)},[a]),Ae=Vo(Me,{enabled:!W,listRef:a.context.itemDomElements,activeIndex:fe,nested:w.type!==void 0,loopFocus:m,orientation:f,parentOrientation:w.type==="menubar"?w.context.orientation:void 0,rtl:Ie==="rtl",disabledIndices:Ke,onNavigate:qn,openOnArrowKeyDown:w.type!=="context-menu",externalTree:pe?H:void 0,focusItemOnHover:A}),Qn=U.useCallback(I=>{a.context.typingRef.current=I},[a]),Qe=Bo(Me,{enabled:!W,listRef:a.context.itemLabels,elementsRef:a.context.itemDomElements,activeIndex:fe,resetMs:500,onMatch:o(I=>{T&&I!==fe&&a.set("activeIndex",I)},"onMatch"),onTyping:Qn}),Zn=U.useMemo(()=>{let I=he(Qe.reference,Ae.reference,_.reference,{onMouseMove(){a.set("allowMouseEnter",!0)}},ne);return I["aria-haspopup"]="menu",I["aria-expanded"]=T,I},[a,Qe.reference,Ae.reference,_.reference,ne,T]),Zt=U.useMemo(()=>{let I=he(Ae.trigger,_.trigger,ne);return I["aria-haspopup"]="menu",I["aria-expanded"]=!1,I},[Ae.trigger,_.trigger,ne]);Ze(()=>(a.update({inactiveTriggerProps:Zt}),null));let er=U.useMemo(()=>he(vo,{id:B,role:"menu","aria-orientation":f==="horizontal"?"horizontal":void 0,"aria-labelledby":k?.id,onMouseMove(){a.set("allowMouseEnter",!0),w.type==="menu"&&a.set("hoverEnabled",!1)},onClick(){a.select("hoverEnabled")&&a.set("hoverEnabled",!1)},onKeyDown(I){let j=a.select("keyboardEventRelay");j&&!I.isPropagationStopped()&&j(I)}},Qe.floating,Ae.floating,_.floating),[k,B,f,w.type,a,Qe.floating,Ae.floating,_.floating]),tr=Ae.item??se;To(a,{floatingRootContext:Me,activeTriggerProps:Zn,inactiveTriggerProps:Zt,popupProps:er,itemProps:tr});let or=U.useMemo(()=>({store:a,parent:v}),[a,v]),eo=(0,Xe.jsxs)(jt.Provider,{value:or,children:[x&&(0,Xe.jsx)(Io,{handle:x,store:a}),typeof n=="function"?n({payload:ge}):n]});return w.type===void 0||w.type==="context-menu"?(0,Xe.jsx)(Ro,{externalTree:H,children:eo}):eo},"MenuRoot"));function dr(t,e,n){return Ze(()=>new kt(t,e,n)).current}o(dr,"useMenuRootStore");var Gn=M(E(),1);var qt=M(me(),1);function Un(t){let e=D().store,n=Gn.useMemo(()=>({parentMenu:e}),[e]);return(0,qt.jsx)(Xt.Provider,{value:n,children:(0,qt.jsx)(Dt,{...t})})}o(Un,"MenuSubmenuRoot");var $=M(E(),1);var Hn=M(E(),1);function jn(t={}){let{highlightItemOnHover:e,highlightedIndex:n,onHighlightedIndexChange:s}=lt(),{ref:u,index:c}=ae(t),i=n===c,p=Hn.useRef(null),r=et(u,p);return{compositeProps:{tabIndex:i?0:-1,onFocus(){s(c)},onMouseMove(){let f=p.current;if(!e||!f)return;let R=f.hasAttribute("disabled")||f.ariaDisabled==="true";!i&&!R&&f.focus()}},compositeRef:r,index:c}}o(jn,"useCompositeItem");function zn(t){let{render:e,className:n,style:s,state:u=se,props:c=Ke,refs:i=Ke,metadata:p,stateAttributesMapping:r,tag:m="div",...f}=t,{compositeProps:R,compositeRef:h}=jn({metadata:p});return O(m,t,{state:u,ref:[h,...i],props:[R,...c,f],stateAttributesMapping:r})}o(zn,"CompositeItem");function Qt(t){if(oo(t)&&t.hasAttribute("data-rootownerid"))return t.getAttribute("data-rootownerid");if(!no(t))return Qt(ro(t))}o(Qt,"findRootOwnerId");var At=M(E(),1);function Yn(t){let{enabled:e=!0,mouseDownAction:n,open:s}=t,u=At.useRef(!1);return At.useMemo(()=>e?{onMouseDown:o(c=>{(n==="open"&&!s||n==="close"&&s)&&(u.current=!0,$e(c.currentTarget).addEventListener("click",()=>{u.current=!1},{once:!0}))},"onMouseDown"),onClick:o(c=>{u.current&&(u.current=!1,c.preventBaseUIHandler())},"onClick")}:se,[e,n,s])}o(Yn,"useMixedToggleClickHandler");var De=M(me(),1);var Kn=co(o(function(e,n){let{render:s,className:u,style:c,disabled:i=!1,nativeButton:p=!0,id:r,openOnHover:m,delay:f=100,closeDelay:R=0,handle:h,payload:x,...P}=e,S=D(!0),d=_o(h)??S?.store;if(!d)throw new Error(G(85));let g=Z(r),l=d.useState("isTriggerActive",g),V=d.useState("floatingRootContext"),v=d.useState("isOpenedByTrigger",g),C=d.useState("triggerPopupId",g),B=$.useRef(null),b=lr(),z=lt(!0),F=fo(),N=$.useMemo(()=>F??new it,[F]),a=ut(N),H=at(),{registerTrigger:Y,isMountedByThisTrigger:T}=So(g,B,d,{payload:x,closeDelay:R,parent:b,floatingTreeRoot:N,floatingNodeId:a,floatingParentNodeId:H,keyboardEventRelay:z?.relayKeyboardEvent}),k=b.type==="menubar",ue=d.useState("disabled"),te=i||ue||k&&b.context.disabled,{getButtonProps:W,buttonRef:ye}=He({disabled:te,native:p});$.useEffect(()=>{!v&&b.type===void 0&&(d.context.allowMouseUpTriggerRef.current=!1)},[d,v,b.type]);let w=$.useRef(null),fe=Ne(),ge=Se(L=>{if(!w.current)return;fe.clear(),d.context.allowMouseUpTriggerRef.current=!1;let _=L.target;Lt(w.current,_)||Lt(d.select("positionerElement"),_)||_===w.current||_!=null&&Qt(_)===d.select("rootId")||on(L,w.current)||N.events.emit("close",{domEvent:L,reason:y.cancelOpen})});$.useEffect(()=>{v&&d.select("lastOpenChangeReason")===y.triggerHover&&$e(w.current).addEventListener("mouseup",ge,{once:!0})},[v,ge,d]);let ce=k&&b.context.hasSubmenuOpen,Re=dt(V,{enabled:(m??ce)&&!te&&(!k||ce&&!T),handleClose:pt({blockPointerEvents:!k}),mouseOnly:!0,move:!1,restMs:b.type===void 0?f:void 0,delay:{close:R},triggerElementRef:B,externalTree:N,isActiveTrigger:l,isClosing:o(()=>d.select("transitionStatus")==="ending","isClosing")}),de=pr(v,d.select("lastOpenChangeReason")),X=ct(V,{enabled:!te,event:v&&k?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:b.type===void 0?de:!1}),oe=Do(V,{enabled:!te&&ce}),pe=Yn({open:v,enabled:k,mouseDownAction:"open"}),q=$.useMemo(()=>he(oe.reference,X.reference),[oe.reference,X.reference]),ne=d.useState("triggerProps",T),{preFocusGuardRef:le,handlePreFocusGuardFocus:Be,handleFocusTargetFocus:Le}=Go(d,B),xe={disabled:te,open:v},Me=[w,n,ye,Y,B],Pe=[q,Re??se,ne,{"aria-haspopup":"menu","aria-controls":C,id:g,onMouseDown:o(L=>{if(d.select("open"))return;fe.start(200,()=>{d.context.allowMouseUpTriggerRef.current=!0}),$e(L.currentTarget).addEventListener("mouseup",ge,{once:!0})},"onMouseDown")},k?{role:"menuitem"}:{},pe,P,W],ve=O("button",e,{enabled:!k,stateAttributesMapping:Ft,state:xe,ref:Me,props:Pe});return k?(0,De.jsx)(zn,{tag:"button",render:s,className:u,style:c,state:xe,refs:Me,props:Pe,stateAttributesMapping:Ft}):v?(0,De.jsxs)($.Fragment,{children:[(0,De.jsx)(Gt,{ref:le,onFocus:Be},`${g}-pre-focus-guard`),(0,De.jsx)($.Fragment,{children:ve},g),(0,De.jsx)(Gt,{ref:d.context.triggerFocusTargetRef,onFocus:Le},`${g}-post-focus-guard`)]}):(0,De.jsx)($.Fragment,{children:ve},g)},"MenuTrigger"));function pr(t,e){let n=Ne(),[s,u]=$.useState(!1);return ie(()=>{t&&e===y.triggerHover?(u(!0),n.start(500,()=>{u(!1)})):t||(n.clear(),u(!1))},[t,e,n]),s}o(pr,"useStickIfOpen");function lr(){let t=Tt(!0);return $.useMemo(()=>t?{type:"menubar",context:t}:{type:void 0},[t])}o(lr,"useMenuParent");var $n=M(E(),1);var Wn=$n.forwardRef(o(function(e,n){let{render:s,className:u,style:c,children:i,...p}=e,{store:r}=D(),{side:m}=K(),f=r.useState("instantType"),{children:R,state:h}=Qo({store:r,side:m,children:i}),x={activationDirection:h.activationDirection,transitioning:h.transitioning,instant:f};return O("div",e,{state:x,ref:n,props:[p,{children:R}],stateAttributesMapping:qo})},"MenuViewport"));var Ee=M(E(),1);var mr={"aria-expanded":void 0},Jn=Ee.forwardRef(o(function(e,n){let{render:s,className:u,style:c,label:i,id:p,nativeButton:r=!1,openOnHover:m=!0,delay:f=100,closeDelay:R=0,disabled:h=!1,...x}=e,P=_t();if(!P?.parentMenu)throw new Error(G(37));let S=ae({guess:!0,label:i}),A=K(),{store:d}=D(),g=Z(p),l=d.useState("open"),V=d.useState("floatingRootContext"),v=d.useState("floatingTreeRoot"),C=d.useState("triggerPopupId",g),B=Eo(g,d),b=Se(q=>{B(q),q!==null&&d.select("open")&&d.select("activeTriggerId")==null&&d.update({activeTriggerId:g??null,activeTriggerElement:q,closeDelay:R})}),z=Ee.useRef(null),F=Ee.useCallback(q=>{z.current=q,d.set("activeTriggerElement",q)},[d]);ie(()=>(b(z.current),()=>b(null)),[b,g,d]),d.useSyncedValue("closeDelay",R);let N=P.parentMenu,a=d.useState("disabled"),H=N.useState("disabled"),Y=h||a||H,T=N.useState("itemProps"),k=N.useState("isActive",S.index),ue=Ee.useMemo(()=>({type:"submenu-trigger",setActive(){N.select("highlightItemOnHover")&&N.set("activeIndex",S.index)}}),[N,S.index]),{getItemProps:te,itemRef:W}=ke({closeOnClick:!1,disabled:Y,highlighted:k,id:g,store:d,typingRef:N.context.typingRef,nativeButton:r,itemMetadata:ue,nodeId:A?.context.nodeId}),ye=d.useState("hoverEnabled"),w=dt(V,{enabled:ye&&m&&!Y,handleClose:pt({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:f,delay:{open:f,close:R},shouldOpen:f>0?()=>N.select("allowMouseEnter"):void 0,triggerElementRef:z,externalTree:v,isClosing:o(()=>d.select("transitionStatus")==="ending","isClosing"),guardStaleOpen:!0}),ge=ct(V,{enabled:!Y,event:"mousedown",toggle:!m,ignoreMouse:m,stickIfOpen:!1}).reference??se,ce=d.useState("triggerProps",!0);delete ce.id;let Ce={disabled:Y,highlighted:k,open:l},Re=d.useState("openMethod"),X=d.useState("lastOpenChangeReason")===y.listNavigation||Re==="keyboard",oe=l&&X&&tt.screenReader.voiceOver;return O("div",e,{state:Ce,stateAttributesMapping:io,props:[ge,w,ce,T,oe?mr:void 0,{"aria-controls":C,tabIndex:l||k?0:-1,onBlur(){k&&N.set("activeIndex",null)}},x,te],ref:[n,S.ref,W,b,F]})},"MenuSubmenuTrigger"));var qe=class extends ho{static{o(this,"MenuHandle")}constructor(){super(Bn(),"Menu")}open(e){this.openByTrigger(e)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}};function Xn(){return new qe}o(Xn,"createMenuHandle");var J=M(me(),1);function Xc(t){let e=(0,Ve.c)(4),n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=(0,J.jsx)(ee.Root,{"data-slot":"dropdown-menu",...n}),e[2]=n,e[3]=s):s=e[3],s}o(Xc,"N");function qc(t){let e=(0,Ve.c)(4),n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=(0,J.jsx)(ee.Trigger,{"data-slot":"dropdown-menu-trigger",...n}),e[2]=n,e[3]=s):s=e[3],s}o(qc,"z");function Qc({align:t="start",alignOffset:e=0,side:n="bottom",sideOffset:s=4,className:u,...c}){return(0,J.jsx)(ee.Portal,{children:(0,J.jsx)(ee.Positioner,{className:"isolate z-50 outline-none",align:t,alignOffset:e,side:n,sideOffset:s,children:(0,J.jsx)(ee.Popup,{"data-slot":"dropdown-menu-content",className:Fe("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!",u),...c})})})}o(Qc,"D");function Zc(t){let e=(0,Ve.c)(4),n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=(0,J.jsx)(ee.Group,{"data-slot":"dropdown-menu-group",...n}),e[2]=n,e[3]=s):s=e[3],s}o(Zc,"M");function ed(t){let e=(0,Ve.c)(10),n,s,u;e[0]!==t?({className:n,inset:s,...u}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=u):(n=e[1],s=e[2],u=e[3]);let c;e[4]!==n?(c=Fe("px-2 py-2 text-xs text-muted-foreground data-inset:ps-7",n),e[4]=n,e[5]=c):c=e[5];let i;return e[6]!==s||e[7]!==u||e[8]!==c?(i=(0,J.jsx)(ee.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":s,className:c,...u}),e[6]=s,e[7]=u,e[8]=c,e[9]=i):i=e[9],i}o(ed,"y");function td({className:t,inset:e,variant:n="default",...s}){return(0,J.jsx)(ee.Item,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":n,className:Fe("group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-md px-2 py-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:ps-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",t),...s})}o(td,"I");function od(t){let e=(0,Ve.c)(15),n,s,u,c,i;e[0]!==t?({className:u,children:s,checked:n,inset:c,...i}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=u,e[4]=c,e[5]=i):(n=e[1],s=e[2],u=e[3],c=e[4],i=e[5]);let p;e[6]!==u?(p=Fe("relative flex cursor-default items-center gap-2 rounded-md py-2 pe-8 ps-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:ps-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",u),e[6]=u,e[7]=p):p=e[7];let r;e[8]===Symbol.for("react.memo_cache_sentinel")?(r=(0,J.jsx)("span",{className:"pointer-events-none absolute end-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:(0,J.jsx)(ee.CheckboxItemIndicator,{children:(0,J.jsx)(en,{icon:Zo,strokeWidth:2})})}),e[8]=r):r=e[8];let m;return e[9]!==n||e[10]!==s||e[11]!==c||e[12]!==i||e[13]!==p?(m=(0,J.jsxs)(ee.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item","data-inset":c,className:p,checked:n,...i,children:[r,s]}),e[9]=n,e[10]=s,e[11]=c,e[12]=i,e[13]=p,e[14]=m):m=e[14],m}o(od,"_");function nd(t){let e=(0,Ve.c)(8),n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let u;e[3]!==n?(u=Fe("-mx-1 h-px bg-border",n),e[3]=n,e[4]=u):u=e[4];let c;return e[5]!==s||e[6]!==u?(c=(0,J.jsx)(ee.Separator,{"data-slot":"dropdown-menu-separator",className:u,...s}),e[5]=s,e[6]=u,e[7]=c):c=e[7],c}o(nd,"C");export{Xc as a,qc as b,Qc as c,Zc as d,ed as e,td as f,od as g,nd as h};
@@ -0,0 +1 @@
1
+ import{b as d}from"./chunk-LPINY2IJ.js";import{a as c,d as b,f as m,g as i}from"./chunk-OXFKZ4BM.js";var n=b(m(),1);var o=b(i(),1);function p(r){let e=(0,n.c)(8),t,a;e[0]!==r?({className:t,...a}=r,e[0]=r,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let l;e[3]!==t?(l=d("w-full caption-bottom text-xs",t),e[3]=t,e[4]=l):l=e[4];let s;return e[5]!==a||e[6]!==l?(s=(0,o.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto overflow-y-clip",children:(0,o.jsx)("table",{"data-slot":"table",className:l,...a})}),e[5]=a,e[6]=l,e[7]=s):s=e[7],s}c(p,"f");function f(r){let e=(0,n.c)(8),t,a;e[0]!==r?({className:t,...a}=r,e[0]=r,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let l;e[3]!==t?(l=d("bg-muted/50 [&_tr]:border-b",t),e[3]=t,e[4]=l):l=e[4];let s;return e[5]!==a||e[6]!==l?(s=(0,o.jsx)("thead",{"data-slot":"table-header",className:l,...a}),e[5]=a,e[6]=l,e[7]=s):s=e[7],s}c(f,"p");function h(r){let e=(0,n.c)(8),t,a;e[0]!==r?({className:t,...a}=r,e[0]=r,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let l;e[3]!==t?(l=d("[&_tr:last-child]:border-0",t),e[3]=t,e[4]=l):l=e[4];let s;return e[5]!==a||e[6]!==l?(s=(0,o.jsx)("tbody",{"data-slot":"table-body",className:l,...a}),e[5]=a,e[6]=l,e[7]=s):s=e[7],s}c(h,"m");function x(r){let e=(0,n.c)(8),t,a;e[0]!==r?({className:t,...a}=r,e[0]=r,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let l;e[3]!==t?(l=d("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",t),e[3]=t,e[4]=l):l=e[4];let s;return e[5]!==a||e[6]!==l?(s=(0,o.jsx)("tr",{"data-slot":"table-row",className:l,...a}),e[5]=a,e[6]=l,e[7]=s):s=e[7],s}c(x,"u");function N(r){let e=(0,n.c)(8),t,a;e[0]!==r?({className:t,...a}=r,e[0]=r,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let l;e[3]!==t?(l=d("h-9 border-e border-border px-3 text-start align-middle font-mono text-[11px] font-medium tracking-wide whitespace-nowrap text-muted-foreground uppercase last:border-e-0 [&:has([role=checkbox])]:pe-0",t),e[3]=t,e[4]=l):l=e[4];let s;return e[5]!==a||e[6]!==l?(s=(0,o.jsx)("th",{"data-slot":"table-head",className:l,...a}),e[5]=a,e[6]=l,e[7]=s):s=e[7],s}c(N,"h");function w(r){let e=(0,n.c)(8),t,a;e[0]!==r?({className:t,...a}=r,e[0]=r,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let l;e[3]!==t?(l=d("border-e border-border px-3 py-1.5 align-middle whitespace-nowrap last:border-e-0 [&:has([role=checkbox])]:pe-0",t),e[3]=t,e[4]=l):l=e[4];let s;return e[5]!==a||e[6]!==l?(s=(0,o.jsx)("td",{"data-slot":"table-cell",className:l,...a}),e[5]=a,e[6]=l,e[7]=s):s=e[7],s}c(w,"x");export{p as a,f as b,h as c,x as d,N as e,w as f};
@@ -0,0 +1 @@
1
+ import{b as C}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as J}from"./chunk-OECMBE6Q.js";import"./chunk-OSJ7HV7B.js";import"./chunk-7F3S5OQT.js";import"./chunk-E26OT26O.js";import{a as H}from"./chunk-4ZEL6BYL.js";import{c as z}from"./chunk-YJ2WHOGO.js";import"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import{a as E}from"./chunk-3Y5K3IQO.js";import{a as G,b as M,c as U,d as P,e as d,f as c}from"./chunk-CW57Q264.js";import{a as D,e as _}from"./chunk-MD67S53Z.js";import{f as q}from"./chunk-LPINY2IJ.js";import{a as S,d as O,f as Q,g as V}from"./chunk-OXFKZ4BM.js";var L=O(Q(),1);var r=O(V(),1);var K=["read","insert","update","delete"],B=S((e,s)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[s],"z"),W=S(e=>{let s=new Map;for(let a of e){let t=s.get(a.table)??{operations:new Set,procedures:new Set,table:a.table};t.operations.add(a.on),t.procedures.add(a.procedure),s.set(a.table,t)}return[...s.values()].toSorted((a,t)=>a.table.localeCompare(t.table))},"J"),ie=S(()=>{let e=(0,L.c)(49),s=q(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:t,error:R,errorSource:k}=z(H.rlsPolicies,a),p=t!==void 0,m,n,h,l,f,u,x,b,o;if(e[1]!==t||e[2]!==R||e[3]!==k||e[4]!==p||e[5]!==s){let $=W(Array.isArray(t?.policies)?t.policies:[]),j;e[15]!==t?(j=Array.isArray(t?.roles)?t.roles:[],e[15]=t,e[16]=j):j=e[16],n=j,x="flex flex-col gap-6",b="lunora-rls-panel",e[17]!==R||e[18]!==k?(o=R!==null&&(0,r.jsx)(J,{error:k,testId:"rls-error"}),e[17]=R,e[18]=k,e[19]=o):o=e[19],u="flex flex-col gap-2",m=D,h="overflow-hidden py-0";let I;e[20]!==s?(I=s("Policies"),e[20]=s,e[21]=I):I=e[21],e[22]!==I?(l=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:I})}),e[22]=I,e[23]=l):l=e[23],f=p&&$.length===0?(0,r.jsx)(E,{description:s("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:s("No policies defined")}):(0,r.jsx)(_,{className:"px-0",children:(0,r.jsxs)(G,{"data-testid":"rls-policies-table",children:[(0,r.jsx)(M,{children:(0,r.jsxs)(P,{children:[(0,r.jsx)(d,{children:s("Table")}),K.map(i=>(0,r.jsx)(d,{children:B(s,i)},i)),(0,r.jsx)(d,{children:s("Guarded by")})]})}),(0,r.jsx)(U,{children:$.map(i=>(0,r.jsxs)(P,{"data-testid":`rls-table-${i.table}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:i.table}),K.map(F=>(0,r.jsx)(c,{children:i.operations.has(F)?(0,r.jsx)(C,{variant:"secondary",children:s("Guarded")}):(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"})},F)),(0,r.jsx)(c,{className:"font-mono text-xs text-muted-foreground",children:[...i.procedures].join(", ")})]},i.table))})]})}),e[1]=t,e[2]=R,e[3]=k,e[4]=p,e[5]=s,e[6]=m,e[7]=n,e[8]=h,e[9]=l,e[10]=f,e[11]=u,e[12]=x,e[13]=b,e[14]=o}else m=e[6],n=e[7],h=e[8],l=e[9],f=e[10],u=e[11],x=e[12],b=e[13],o=e[14];let N;e[24]!==m||e[25]!==h||e[26]!==l||e[27]!==f?(N=(0,r.jsxs)(m,{className:h,children:[l,f]}),e[24]=m,e[25]=h,e[26]=l,e[27]=f,e[28]=N):N=e[28];let g;e[29]!==u||e[30]!==N?(g=(0,r.jsx)("section",{className:u,children:N}),e[29]=u,e[30]=N,e[31]=g):g=e[31];let y;e[32]!==s?(y=s("Roles"),e[32]=s,e[33]=y):y=e[33];let w;e[34]!==y?(w=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y})}),e[34]=y,e[35]=w):w=e[35];let v;e[36]!==p||e[37]!==n||e[38]!==s?(v=p&&n.length===0?(0,r.jsx)(E,{description:s("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:s("No roles defined")}):(0,r.jsx)(_,{className:"px-0",children:(0,r.jsxs)(G,{"data-testid":"rls-roles-table",children:[(0,r.jsx)(M,{children:(0,r.jsxs)(P,{children:[(0,r.jsx)(d,{children:s("Role")}),(0,r.jsx)(d,{children:s("Description")}),(0,r.jsx)(d,{children:s("Permissions")})]})}),(0,r.jsx)(U,{children:n.map(Y)})]})}),e[36]=p,e[37]=n,e[38]=s,e[39]=v):v=e[39];let A;e[40]!==w||e[41]!==v?(A=(0,r.jsx)("section",{className:"flex flex-col gap-2",children:(0,r.jsxs)(D,{className:"overflow-hidden py-0",children:[w,v]})}),e[40]=w,e[41]=v,e[42]=A):A=e[42];let T;return e[43]!==A||e[44]!==x||e[45]!==b||e[46]!==o||e[47]!==g?(T=(0,r.jsxs)("div",{className:x,"data-testid":b,children:[o,g,A]}),e[43]=A,e[44]=x,e[45]=b,e[46]=o,e[47]=g,e[48]=T):T=e[48],T},"oe");function X(e){return(0,r.jsx)(C,{variant:"outline",children:e},e)}S(X,"K");function Y(e){return(0,r.jsxs)(P,{"data-testid":`rls-role-${e.name}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:e.name}),(0,r.jsx)(c,{className:"text-muted-foreground",children:e.description??""}),(0,r.jsx)(c,{children:e.permissions.length===0?(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"}):(0,r.jsx)("span",{className:"flex flex-wrap gap-1",children:e.permissions.map(X)})})]},e.name)}S(Y,"V");export{ie as default};
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-OXFKZ4BM.js";var u={highErrorRate:.05,highWriteContention:.1,lowCacheHitRate:.5,minCacheSamples:10,minConflictCalls:5,minErrorCalls:5,slowFunctionMs:1e3,storageCriticalBytes:5368709120,storageWarnBytes:1073741824},h={error:0,info:2,warning:1},g=e((a,i)=>{let s=[];if(a.maxDurationMs>=i.slowFunctionMs){let t=a.scannedTables??[];t.length>0?s.push({fn:a.path,kind:"missing-index",severity:"warning",tables:t.map(r=>r.table),value:a.maxDurationMs}):s.push({fn:a.path,kind:"slow-function",severity:"info",value:a.maxDurationMs})}a.calls>=i.minErrorCalls&&a.errors/a.calls>=i.highErrorRate&&s.push({fn:a.path,kind:"high-error-rate",message:a.lastErrorMessage??void 0,severity:"error",value:a.errors/a.calls});let n=a.conflicts??0;return n>0&&a.calls>=i.minConflictCalls&&n/a.calls>=i.highWriteContention&&s.push({fn:a.path,kind:"high-write-contention",severity:"warning",value:n/a.calls}),s},"h"),v=e((a,i,s=u)=>{let n=[];if(typeof a?.databaseSize=="number"&&a.databaseSize>=s.storageWarnBytes&&n.push({kind:"storage-headroom",severity:a.databaseSize>=s.storageCriticalBytes?"error":"warning",value:a.databaseSize}),a?.cache){let{evictions:t,hits:r,misses:c}=a.cache,o=r+c;if(o>=s.minCacheSamples){let l=r/o;l<s.lowCacheHitRate&&n.push({kind:"low-cache-hit-rate",severity:"warning",value:l})}t>0&&t>r&&n.push({kind:"high-evictions",severity:"warning",value:t})}for(let t of i??[])n.push(...g(t,s));return n.toSorted((t,r)=>h[t.severity]-h[r.severity])},"u");export{v as a};
@@ -0,0 +1,6 @@
1
+ import{a as V,b as F,c as J,d as K,e as B,f as A,g as I,h as M}from"./chunk-CTE6RPXC.js";import{a as P}from"./chunk-NMVFSJM7.js";import{a as z}from"./chunk-ZWDORIZY.js";import{f as L,p as D,r as U,s as Q,v as W}from"./chunk-LPINY2IJ.js";import{a as g,d as q,e as ee,f as te,g as le}from"./chunk-OXFKZ4BM.js";var _=q(te(),1),E=q(ee(),1);var T="inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",fe=`${T} aria-pressed:bg-accent aria-pressed:text-accent-foreground`;var s=q(le(),1);var X=g(l=>`"${l.replaceAll('"','""')}"`,"q"),ne=/["\n\r,]/u,oe=/^[=+\-@\t\r]/u,Y=g(l=>{if(l==null)return"";let e;return typeof l=="string"?e=oe.test(l)?` ${l}`:l:typeof l=="number"||typeof l=="boolean"||typeof l=="bigint"?e=String(l):e=U(l),ne.test(e)?`"${e.replaceAll('"','""')}"`:e},"J"),ae=g((l,e)=>{let n=l.map(t=>Y(t)).join(","),o=e.map(t=>l.map(c=>Y(t[c])).join(","));return[n,...o].join(`
2
+ `)},"ne"),se=g(l=>JSON.stringify(l,D,2),"oe"),Z=500,re=g(l=>l==null?"NULL":typeof l=="number"?Number.isFinite(l)?String(l):"NULL":typeof l=="bigint"?String(l):typeof l=="boolean"?l?"1":"0":`'${(typeof l=="string"?l:U(l)).replaceAll("'","''")}'`,"K"),G="__doc__",ie=g((l,e,n,o)=>{if(e.length===0||n.length===0)return"";let t=o?.includes(G)===!0&&!e.includes(G)?e.filter(d=>!o.includes(d)):void 0,c=t===void 0?e:o,r=g((d,b)=>re(t===void 0||b!==G?d[b]:JSON.stringify(Object.fromEntries(t.map(u=>[u,d[u]])),D)),"i"),a=c.map(d=>X(d)).join(", "),i=[];for(let d=0;d<n.length;d+=Z){let b=n.slice(d,d+Z).map(u=>` (${c.map(m=>r(u,m)).join(", ")})`).join(`,
3
+ `);i.push(`INSERT INTO ${X(l)} (${a}) VALUES
4
+ ${b};`)}return i.join(`
5
+
6
+ `)},"se"),H=g((l,e,n)=>{if(!("document"in globalThis))return;let o=globalThis.URL.createObjectURL(new globalThis.Blob([e],{type:n})),t=globalThis.document.createElement("a");t.href=o,t.download=l,globalThis.document.body.append(t),t.click(),t.remove(),globalThis.URL.revokeObjectURL(o)},"M"),ce=g(l=>{let e=(0,_.c)(37),{columns:n,name:o,rows:t,sqlColumns:c}=l,r=L(),a;e[0]!==n||e[1]!==o||e[2]!==t?(a=g(()=>{H(`${o}.csv`,ae(n,t),"text/csv;charset=utf-8")},"s"),e[0]=n,e[1]=o,e[2]=t,e[3]=a):a=e[3];let i=a,d;e[4]!==o||e[5]!==t?(d=g(()=>{H(`${o}.json`,se(t),"application/json")},"a"),e[4]=o,e[5]=t,e[6]=d):d=e[6];let b=d,u;e[7]!==n||e[8]!==o||e[9]!==t||e[10]!==c?(u=g(()=>{H(`${o}.sql`,ie(o,n,t,c),"application/sql;charset=utf-8")},"f"),e[7]=n,e[8]=o,e[9]=t,e[10]=c,e[11]=u):u=e[11];let m=u,w=t.length===0,p;e[12]!==w?(p=(0,s.jsx)(F,{className:T,"data-testid":"grid-export",disabled:w,title:"Exports only the rows loaded on the current page, not the whole table",children:"Export page"}),e[12]=w,e[13]=p):p=e[13];let k;e[14]===Symbol.for("react.memo_cache_sentinel")?(k=(0,s.jsx)(B,{children:"Export loaded rows"}),e[14]=k):k=e[14];let h;e[15]!==r?(h=r("CSV"),e[15]=r,e[16]=h):h=e[16];let y;e[17]!==i||e[18]!==h?(y=(0,s.jsx)(A,{"data-testid":"grid-export-csv",onClick:i,children:h}),e[17]=i,e[18]=h,e[19]=y):y=e[19];let N;e[20]!==r?(N=r("JSON"),e[20]=r,e[21]=N):N=e[21];let x;e[22]!==b||e[23]!==N?(x=(0,s.jsx)(A,{"data-testid":"grid-export-json",onClick:b,children:N}),e[22]=b,e[23]=N,e[24]=x):x=e[24];let S;e[25]!==r?(S=r("SQL"),e[25]=r,e[26]=S):S=e[26];let f;e[27]!==m||e[28]!==S?(f=(0,s.jsx)(A,{"data-testid":"grid-export-sql",onClick:m,children:S}),e[27]=m,e[28]=S,e[29]=f):f=e[29];let C;e[30]!==x||e[31]!==f||e[32]!==y?(C=(0,s.jsxs)(J,{align:"end",children:[k,y,x,f]}),e[30]=x,e[31]=f,e[32]=y,e[33]=C):C=e[33];let v;return e[34]!==C||e[35]!==p?(v=(0,s.jsxs)(V,{children:[p,C]}),e[34]=C,e[35]=p,e[36]=v):v=e[36],v},"ie"),de=g(l=>{let e=(0,_.c)(9),{column:n}=l,o;e[0]!==n?(o=g(()=>{n.toggleVisibility()},"o"),e[0]=n,e[1]=o):o=e[1];let t=o,c;e[2]!==n?(c=n.getIsVisible(),e[2]=n,e[3]=c):c=e[3];let r=`grid-column-${n.id}`,a;return e[4]!==n.id||e[5]!==t||e[6]!==c||e[7]!==r?(a=(0,s.jsx)(I,{checked:c,closeOnClick:!1,"data-testid":r,onCheckedChange:t,children:n.id}),e[4]=n.id,e[5]=t,e[6]=c,e[7]=r,e[8]=a):a=e[8],a},"re"),me=[],ue=g(({backRelations:l=me,enabledBackRelations:e,onToggleBackRelation:n,table:o})=>{let t=L(),c=o.getIsAllColumnsVisible(),r=g(()=>{o.toggleAllColumnsVisible(!c)},"i");return(0,s.jsxs)(V,{children:[(0,s.jsx)(F,{className:T,"data-testid":"grid-columns",children:t("Columns")}),(0,s.jsxs)(J,{align:"end",className:"max-h-80 overflow-y-auto",children:[(0,s.jsxs)(K,{children:[(0,s.jsx)(B,{children:t("Columns")}),(0,s.jsx)(I,{checked:c,closeOnClick:!1,"data-testid":"grid-columns-all",onCheckedChange:r,children:t(c?"Hide all":"Show all")}),(0,s.jsx)(M,{}),o.getAllLeafColumns().filter(a=>!a.id.startsWith("__back__:")).map(a=>(0,s.jsx)(de,{column:a},a.id))]}),l.length>0&&n!==void 0&&(0,s.jsxs)(K,{children:[(0,s.jsx)(M,{}),(0,s.jsx)(B,{children:t("Related")}),l.map(a=>{let i=`${a.table}.${a.column}`;return(0,s.jsx)(I,{checked:e?.has(i)===!0,closeOnClick:!1,"data-testid":`grid-back-relation-${i}`,onCheckedChange:g(()=>{n(i)},"onCheckedChange"),children:`\u2190 ${a.table}.${a.column}`},i)})]})]})]})},"ae"),ge=g(l=>{let e=(0,_.c)(19),{count:n,editable:o,onClear:t,onDelete:c}=l,r=L(),a;e[0]!==n||e[1]!==r?(a=r("{count} selected",{count:n}),e[0]=n,e[1]=r,e[2]=a):a=e[2];let i;e[3]!==a?(i=(0,s.jsx)("span",{className:"font-medium tabular-nums","data-testid":"grid-selection-count",children:a}),e[3]=a,e[4]=i):i=e[4];let d;e[5]!==r?(d=r("Clear"),e[5]=r,e[6]=d):d=e[6];let b;e[7]!==t||e[8]!==d?(b=(0,s.jsx)("button",{className:T,"data-testid":"grid-selection-clear",onClick:t,type:"button",children:d}),e[7]=t,e[8]=d,e[9]=b):b=e[9];let u;e[10]!==n||e[11]!==o||e[12]!==c||e[13]!==r?(u=o&&(0,s.jsx)(z,{confirmLabel:r("Delete {count} rows and everything that cascades?",{count:n}),onConfirm:c,testId:"grid-selection-delete",children:r("Delete {count}",{count:n})}),e[10]=n,e[11]=o,e[12]=c,e[13]=r,e[14]=u):u=e[14];let m;return e[15]!==i||e[16]!==b||e[17]!==u?(m=(0,s.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border bg-accent/40 px-3 py-1.5 text-xs","data-testid":"grid-selection-bar",children:[i,b,u]}),e[15]=i,e[16]=b,e[17]=u,e[18]=m):m=e[18],m},"de"),be=/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu,pe=g(l=>{let e=(0,_.c)(9),{bucket:n,objectKey:o,resolveUrl:t}=l,[c,r]=(0,E.useState)(null),[a,i]=(0,E.useState)(!1),d,b;e[0]!==n||e[1]!==o||e[2]!==t?(d=g(()=>{let p={cancelled:!1};return Q((async()=>{try{let k=await t(o,n);p.cancelled||r(k)}catch{p.cancelled||i(!0)}})()),()=>{p.cancelled=!0}},"a"),b=[n,o,t],e[0]=n,e[1]=o,e[2]=t,e[3]=d,e[4]=b):(d=e[3],b=e[4]),(0,E.useEffect)(d,b);let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=g(()=>{i(!0)},"f"),e[5]=u):u=e[5];let m=u;if(c===null||a)return null;let w;return e[6]!==o||e[7]!==c?(w=(0,s.jsx)("div",{className:"flex max-h-64 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",children:(0,s.jsx)("img",{alt:o,className:"max-h-64 object-contain","data-testid":"grid-cell-image",onError:m,src:c})}),e[6]=o,e[7]=c,e[8]=w):w=e[8],w},"me"),Se=g(l=>{let e=(0,_.c)(41),{bucket:n,column:o,onClose:t,onFilter:c,resolveUrl:r,value:a}=l,i=L(),[d,b]=(0,E.useState)(!1),u;e[0]!==a?(u=U(a),e[0]=a,e[1]=u):u=e[1];let m=u,w;e[2]!==m?(w=g(()=>{W(m)&&b(!0)},"N"),e[2]=m,e[3]=w):w=e[3];let p=w,k;e[4]!==i?(k=i("Cell value"),e[4]=i,e[5]=k):k=e[5];let h;e[6]!==o?(h=(0,s.jsx)("h2",{className:"truncate font-mono text-sm font-semibold text-foreground",children:o}),e[6]=o,e[7]=h):h=e[7];let y;e[8]!==c||e[9]!==i?(y=c!==void 0&&(0,s.jsx)("button",{className:T,"data-testid":"grid-cell-filter",onClick:c,type:"button",children:i("Filter by this value")}),e[8]=c,e[9]=i,e[10]=y):y=e[10];let N;e[11]!==d||e[12]!==i?(N=i(d?"Copied":"Copy"),e[11]=d,e[12]=i,e[13]=N):N=e[13];let x;e[14]!==p||e[15]!==N?(x=(0,s.jsx)("button",{className:T,"data-testid":"grid-cell-copy",onClick:p,type:"button",children:N}),e[14]=p,e[15]=N,e[16]=x):x=e[16];let S;e[17]!==i?(S=i("Close"),e[17]=i,e[18]=S):S=e[18];let f;e[19]!==t||e[20]!==S?(f=(0,s.jsx)("button",{className:T,"data-testid":"grid-cell-close",onClick:t,type:"button",children:S}),e[19]=t,e[20]=S,e[21]=f):f=e[21];let C;e[22]!==y||e[23]!==x||e[24]!==f?(C=(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[y,x,f]}),e[22]=y,e[23]=x,e[24]=f,e[25]=C):C=e[25];let v;e[26]!==C||e[27]!==h?(v=(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[h,C]}),e[26]=C,e[27]=h,e[28]=v):v=e[28];let j;e[29]!==n||e[30]!==r||e[31]!==a?(j=r!==void 0&&typeof a=="string"&&be.test(a)&&(0,s.jsx)(pe,{bucket:n,objectKey:a,resolveUrl:r}),e[29]=n,e[30]=r,e[31]=a,e[32]=j):j=e[32];let $;e[33]!==m?($=(0,s.jsx)("pre",{className:"min-h-0 flex-1 overflow-auto rounded-md border border-border bg-muted/30 p-3 font-mono text-xs whitespace-pre-wrap","data-testid":"grid-cell-value",children:m}),e[33]=m,e[34]=$):$=e[34];let R;return e[35]!==t||e[36]!==v||e[37]!==j||e[38]!==$||e[39]!==k?(R=(0,s.jsxs)(P,{className:"max-h-[70vh] w-[min(40rem,90vw)]",label:k,onClose:t,panelTestId:"grid-cell-dialog",testId:"grid-cell-dialog-overlay",variant:"dialog",children:[v,j,$]}),e[35]=t,e[36]=v,e[37]=j,e[38]=$,e[39]=k,e[40]=R):R=e[40],R},"ke"),je=g(l=>{let e=(0,_.c)(37),{backRelations:n,enabledBackRelations:o,onToggleBackRelation:t,columns:c,editable:r,name:a,onBulkDelete:i,onToggleTranspose:d,rows:b,sqlColumns:u,table:m,transposed:w}=l,p=L(),k;e[0]!==m?(k=m.getSelectedRowModel(),e[0]=m,e[1]=k):k=e[1];let h=k.rows,y;e[2]!==m?(y=g(()=>{m.resetRowSelection()},"y"),e[2]=m,e[3]=y):y=e[3];let N=y,x;e[4]!==i||e[5]!==h||e[6]!==m?(x=g(()=>{i(h.map(he)),m.resetRowSelection()},"x"),e[4]=i,e[5]=h,e[6]=m,e[7]=x):x=e[7];let S=x,f;e[8]!==c||e[9]!==a||e[10]!==b||e[11]!==u?(f=(0,s.jsx)(ce,{columns:c,name:a,rows:b,sqlColumns:u}),e[8]=c,e[9]=a,e[10]=b,e[11]=u,e[12]=f):f=e[12];let C;e[13]!==n||e[14]!==o||e[15]!==t||e[16]!==m?(C=(0,s.jsx)(ue,{backRelations:n,enabledBackRelations:o,onToggleBackRelation:t,table:m}),e[13]=n,e[14]=o,e[15]=t,e[16]=m,e[17]=C):C=e[17];let v;e[18]!==p?(v=p("Swap rows and columns"),e[18]=p,e[19]=v):v=e[19];let j;e[20]!==p?(j=p("Transpose"),e[20]=p,e[21]=j):j=e[21];let $;e[22]!==d||e[23]!==v||e[24]!==j||e[25]!==w?($=(0,s.jsx)("button",{"aria-pressed":w,className:T,"data-testid":"grid-transpose",onClick:d,title:v,type:"button",children:j}),e[22]=d,e[23]=v,e[24]=j,e[25]=w,e[26]=$):$=e[26];let R;e[27]!==r||e[28]!==N||e[29]!==S||e[30]!==h.length?(R=h.length>0&&(0,s.jsx)(ge,{count:h.length,editable:r,onClear:N,onDelete:S}),e[27]=r,e[28]=N,e[29]=S,e[30]=h.length,e[31]=R):R=e[31];let O;return e[32]!==f||e[33]!==C||e[34]!==$||e[35]!==R?(O=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"grid-actions",children:[f,C,$,R]}),e[32]=f,e[33]=C,e[34]=$,e[35]=R,e[36]=O):O=e[36],O},"Se");function he(l){return l.id}g(he,"ue");export{T as a,fe as b,H as c,ce as d,ge as e,Se as f,je as g};
@@ -0,0 +1 @@
1
+ import{a as s}from"./chunk-OXFKZ4BM.js";var v=new Set(["contains","eq","gt","gte","has","lt","lte","ne"]),a=s(r=>typeof r=="number"&&Number.isSafeInteger(r)?String(r):r,"i"),n=s(r=>{if(typeof r!="string")return;let e=r.trim();return e===""?void 0:e},"s"),p=s(r=>{if(r===null||typeof r!="object")return!1;let e=r,o=e.path===void 0||Array.isArray(e.path)&&e.path.every(i=>typeof i=="string");return typeof e.column=="string"&&typeof e.operator=="string"&&v.has(e.operator)&&o},"g"),f=s(r=>{if(typeof r!="string"||r==="")return[];try{let e=JSON.parse(r);return Array.isArray(e)?e.filter(p):[]}catch{return[]}},"f"),g=s(r=>{if(typeof r!="string"||r==="")return;let e=r.lastIndexOf(":");if(e<=0)return;let o=r.slice(0,e),i=r.slice(e+1);if(!(i!=="asc"&&i!=="desc"))return{column:o,direction:i}},"p"),u=/^[\da-f]{16}$/u,y=s(r=>{let e={};if(typeof r.pins=="string"&&r.pins!==""){let c=r.pins.split(",").filter(h=>h!==""&&h.length<=64).slice(0,12);c.length>0&&(e.pins=c.join(","))}r.schema==="global"&&(e.schema="global");let o=n(r.table);o!==void 0&&(e.table=o);let i=n(a(r.shard));i!==void 0&&(e.shard=i);let d=n(a(r.search));d!==void 0&&(e.search=d);let t=n(r.order);t!==void 0&&g(t)!==void 0&&(e.order=t);let l=n(r.filters);return l!==void 0&&f(l).length>0&&(e.filters=l),e},"y"),b=s(r=>{let e=f(r.filters),o=g(r.order);return{filters:e.length>0?e:void 0,orderBy:o,search:n(a(r.search)),shard:n(a(r.shard)),table:n(r.table),tier:r.schema==="global"?"global":"shard"}},"b"),m=s(r=>{let e=r.filters??[];return{filters:e.length>0?JSON.stringify(e):void 0,order:r.orderBy===void 0?void 0:`${r.orderBy.column}:${r.orderBy.direction}`,schema:r.tier==="global"?"global":void 0,search:r.search!==void 0&&r.search!==""?r.search:void 0,shard:r.shard!==void 0&&r.shard!==""?r.shard:void 0,table:r.table!==void 0&&r.table!==""?r.table:void 0}},"v"),S=s(r=>{let{version:e}=r;return typeof e=="string"&&u.test(e)?{version:e}:{}},"S");export{y as a,b,m as c,S as d};