@lunora/studio 1.0.0-alpha.136 → 1.0.0-alpha.138

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 (361) hide show
  1. package/dist/index.d.mts +1515 -0
  2. package/dist/index.d.ts +20 -7
  3. package/dist/index.mjs +1 -0
  4. package/dist/mount.d.mts +21 -0
  5. package/dist/mount.mjs +1 -0
  6. package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -0
  7. package/dist/packem_chunks/ApiTab.mjs +1 -0
  8. package/dist/packem_chunks/AuditPanel.mjs +1 -0
  9. package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -0
  10. package/dist/packem_chunks/{ExportImportPanel.js → ExportImportPanel.mjs} +1 -1
  11. package/dist/packem_chunks/{FileBrowser.js → FileBrowser.mjs} +1 -1
  12. package/dist/packem_chunks/FunctionRunner.mjs +1 -0
  13. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -0
  14. package/dist/packem_chunks/HealthPanel.mjs +1 -0
  15. package/dist/packem_chunks/InsightsPanel.mjs +1 -0
  16. package/dist/packem_chunks/LogsPanel.mjs +1 -0
  17. package/dist/packem_chunks/MailPanel.mjs +2 -0
  18. package/dist/packem_chunks/MetricsPanel.mjs +1 -0
  19. package/dist/packem_chunks/NotificationsPanel.mjs +1 -0
  20. package/dist/packem_chunks/PitrPanel.mjs +1 -0
  21. package/dist/packem_chunks/SchemaViewer.mjs +1 -0
  22. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -0
  23. package/dist/packem_chunks/SettingsPanel.mjs +1 -0
  24. package/dist/packem_chunks/{SqlEditorPanel.js → SqlEditorPanel.mjs} +1 -1
  25. package/dist/packem_chunks/TableEditor.mjs +1 -0
  26. package/dist/packem_chunks/agents-panel.mjs +1 -0
  27. package/dist/packem_chunks/analytics-panel.mjs +1 -0
  28. package/dist/packem_chunks/auth-audit-panel.mjs +1 -0
  29. package/dist/packem_chunks/auth-config-panel.mjs +1 -0
  30. package/dist/packem_chunks/auth-sessions-panel.mjs +1 -0
  31. package/dist/packem_chunks/containers-panel.mjs +1 -0
  32. package/dist/packem_chunks/dashboards-panel.mjs +1 -0
  33. package/dist/packem_chunks/evals-panel.mjs +1 -0
  34. package/dist/packem_chunks/fanout-panel.mjs +1 -0
  35. package/dist/packem_chunks/flags-panel.mjs +1 -0
  36. package/dist/packem_chunks/issues-panel.mjs +1 -0
  37. package/dist/packem_chunks/kv-browser.mjs +1 -0
  38. package/dist/packem_chunks/{log-drains-panel.js → log-drains-panel.mjs} +1 -1
  39. package/dist/packem_chunks/migrations-route.mjs +1 -0
  40. package/dist/packem_chunks/organizations-panel.mjs +1 -0
  41. package/dist/packem_chunks/payments-panel.mjs +1 -0
  42. package/dist/packem_chunks/permissions-panel.mjs +1 -0
  43. package/dist/packem_chunks/queues-panel.mjs +1 -0
  44. package/dist/packem_chunks/reactors-panel.mjs +1 -0
  45. package/dist/packem_chunks/rls-panel.mjs +1 -0
  46. package/dist/packem_chunks/schedule-panel.mjs +1 -0
  47. package/dist/packem_chunks/sparkline.mjs +1 -0
  48. package/dist/packem_chunks/storage-rules-panel.mjs +1 -0
  49. package/dist/packem_chunks/subscriptions-panel.mjs +1 -0
  50. package/dist/packem_chunks/sync-client-panel.mjs +1 -0
  51. package/dist/packem_chunks/traces-panel.mjs +1 -0
  52. package/dist/packem_chunks/users-panel.mjs +1 -0
  53. package/dist/packem_chunks/vector-browser.mjs +1 -0
  54. package/dist/packem_chunks/workflows-panel.mjs +1 -0
  55. package/dist/packem_shared/{ApiDocsPanel-Du1L7Ysj.js → ApiDocsPanel-BOxViKDM.mjs} +1 -1
  56. package/dist/packem_shared/ApiReferencePanel--YThTzHb.mjs +1 -0
  57. package/dist/packem_shared/CommandPalette-C4UrhLxv.mjs +1 -0
  58. package/dist/packem_shared/ConfirmButton-DU4p72Er.mjs +1 -0
  59. package/dist/packem_shared/ConnectionBadge-B_8fcft2.mjs +1 -0
  60. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs +1 -0
  61. package/dist/packem_shared/{DataBrowser-W5TxvLB8.js → DataBrowser-CDzwqq4b.mjs} +1 -1
  62. package/dist/packem_shared/GlobalDataBrowser-BKm77TNC.mjs +1 -0
  63. package/dist/packem_shared/HomePanel-T_fBZTEM.mjs +1 -0
  64. package/dist/packem_shared/MigrationsPanel-CYe0ygT8.mjs +1 -0
  65. package/dist/packem_shared/OpenRpcReferencePanel-Bn5UVD7s.mjs +1 -0
  66. package/dist/packem_shared/ScheduledJobs-DN0yQoo6.mjs +1 -0
  67. package/dist/packem_shared/ShardInput-C6mjgAh4.mjs +1 -0
  68. package/dist/packem_shared/Studio-CHCAslfi.mjs +1 -0
  69. package/dist/packem_shared/StudioApp-DVl_E-VZ.mjs +1 -0
  70. package/dist/packem_shared/StudioI18nProvider-fVsCSs5L.mjs +1 -0
  71. package/dist/packem_shared/advisor-view-5mZH6453.mjs +1 -0
  72. package/dist/packem_shared/alert-PB5W11MM.mjs +1 -0
  73. package/dist/packem_shared/app.d-D1bPR8FO.d.mts +252 -0
  74. package/dist/packem_shared/badge-r_5B4LHP.mjs +1 -0
  75. package/dist/packem_shared/{bar-chart-B6gzp_f9.js → bar-chart-BCsEIQoQ.mjs} +1 -1
  76. package/dist/packem_shared/button-q0UYSmrn.mjs +1 -0
  77. package/dist/packem_shared/card--2hKx4L2.mjs +1 -0
  78. package/dist/packem_shared/checkbox-CnS9cyCz.mjs +1 -0
  79. package/dist/packem_shared/data-grid-BqNXJ9PF.mjs +1 -0
  80. package/dist/packem_shared/dropdown-menu-jLZenfWH.mjs +2 -0
  81. package/dist/packem_shared/empty-state-D7jEML_T.mjs +1 -0
  82. package/dist/packem_shared/error-alert-CczbAfst.mjs +1 -0
  83. package/dist/packem_shared/{grid-features-jBzZGauv.js → grid-features-D8w5isjt.mjs} +1 -1
  84. package/dist/packem_shared/home-panel-CSENDmoB.mjs +3 -0
  85. package/dist/packem_shared/input-CXhxesPC.mjs +1 -0
  86. package/dist/packem_shared/label-DKFzyHq6.mjs +1 -0
  87. package/dist/packem_shared/live-status-BuJdUZFU.mjs +1 -0
  88. package/dist/packem_shared/log-line-Dzg4YZ-K.mjs +1 -0
  89. package/dist/packem_shared/modal-shell-CDztwLnv.mjs +1 -0
  90. package/dist/packem_shared/recording-client-BEZ6tVgo.mjs +1 -0
  91. package/dist/packem_shared/{reference-view-BU2dNK9Z.js → reference-view-CZxBZSRo.mjs} +1 -1
  92. package/dist/packem_shared/schema-diagram-DU83ObYH.mjs +2 -0
  93. package/dist/packem_shared/scroll-area-CXCQH7VT.mjs +2 -0
  94. package/dist/packem_shared/select-Cx8-CokP.mjs +2 -0
  95. package/dist/packem_shared/shard-history-CaO3C4KQ.mjs +1 -0
  96. package/dist/packem_shared/shortcuts-B9gDaXmw.mjs +1 -0
  97. package/dist/packem_shared/skeleton-DX1gfixl.mjs +1 -0
  98. package/dist/packem_shared/sparkline-B_sPPO_8.mjs +1 -0
  99. package/dist/packem_shared/sql-result-table-DysT8h5P.mjs +1 -0
  100. package/dist/packem_shared/stat-card-D0Fe04cX.mjs +1 -0
  101. package/dist/packem_shared/studio-DRHuKwbt.mjs +2 -0
  102. package/dist/packem_shared/table-D0SBiDu-.mjs +2 -0
  103. package/dist/packem_shared/table-list-sidebar-BxZm3sBJ.mjs +1 -0
  104. package/dist/packem_shared/textarea--40GKAyz.mjs +1 -0
  105. package/dist/packem_shared/trace-handoff-BV3EWqy_.mjs +1 -0
  106. package/dist/packem_shared/use-admin-query-Cbj2GuHu.mjs +1 -0
  107. package/dist/packem_shared/use-async-submit-DAKymxcP.mjs +1 -0
  108. package/dist/packem_shared/use-auth-config-gxJL0E1r.mjs +1 -0
  109. package/dist/packem_shared/use-open-trace-B5LJ96_0.mjs +1 -0
  110. package/dist/packem_shared/use-sql-assistant-CFRzdA9E.mjs +1 -0
  111. package/dist/standalone/{chunk-7PIHTTND.js → chunk-25NFR6EB.js} +1 -1
  112. package/dist/standalone/{chunk-R7S3ICRW.js → chunk-2AFIMJPZ.js} +1 -1
  113. package/dist/standalone/{chunk-ENLQ6CZE.js → chunk-2DO5EQCU.js} +1 -1
  114. package/dist/standalone/{chunk-XZBLPJZN.js → chunk-2QSOSRNW.js} +1 -1
  115. package/dist/standalone/{chunk-F7JOSNAT.js → chunk-35DM4JJG.js} +1 -1
  116. package/dist/standalone/{chunk-EHQU74ST.js → chunk-3FFEVZUV.js} +1 -1
  117. package/dist/standalone/{chunk-OE4KGVJW.js → chunk-3ILVYCWG.js} +1 -1
  118. package/dist/standalone/{chunk-TRS5ABTX.js → chunk-3PKWDMXA.js} +1 -1
  119. package/dist/standalone/{chunk-2KR32476.js → chunk-3ZKYTFKY.js} +1 -1
  120. package/dist/standalone/{chunk-XLU6W4LI.js → chunk-43Y54D7O.js} +1 -1
  121. package/dist/standalone/{chunk-AOAJGSYZ.js → chunk-46ZJ3TM4.js} +1 -1
  122. package/dist/standalone/{chunk-2SFSTQS4.js → chunk-4GTO7FL5.js} +1 -1
  123. package/dist/standalone/{chunk-TFMQSCGC.js → chunk-4L4WTGN5.js} +1 -1
  124. package/dist/standalone/{chunk-HOQ2PFO6.js → chunk-56AFJWER.js} +1 -1
  125. package/dist/standalone/chunk-5AUOM7FK.js +1 -0
  126. package/dist/standalone/{chunk-XQS7KSHL.js → chunk-5GFSKIB2.js} +1 -1
  127. package/dist/standalone/{chunk-JV7KTJPY.js → chunk-5JDWLCSH.js} +1 -1
  128. package/dist/standalone/{chunk-WSNONR2E.js → chunk-5PCGB55O.js} +1 -1
  129. package/dist/standalone/{chunk-MCLM2QJI.js → chunk-5WJXVZMZ.js} +1 -1
  130. package/dist/standalone/{chunk-WUW4ZHRL.js → chunk-66UGPQVC.js} +1 -1
  131. package/dist/standalone/{chunk-QHQTOESO.js → chunk-7EYQVAUQ.js} +1 -1
  132. package/dist/standalone/{chunk-AVBOVXQK.js → chunk-7QMV55PO.js} +1 -1
  133. package/dist/standalone/{chunk-JURAVSE7.js → chunk-7QRRR3K6.js} +1 -1
  134. package/dist/standalone/{chunk-EDHW2EEG.js → chunk-7RIRJD2P.js} +1 -1
  135. package/dist/standalone/{chunk-ITNXWR5K.js → chunk-B5FXTB7H.js} +1 -1
  136. package/dist/standalone/{chunk-NNJW6LZK.js → chunk-BFXBBUU6.js} +1 -1
  137. package/dist/standalone/{chunk-DBMUPDVJ.js → chunk-BX3F7MXP.js} +1 -1
  138. package/dist/standalone/{chunk-ZSOLGJFC.js → chunk-C3TOZ4LG.js} +1 -1
  139. package/dist/standalone/{chunk-54TELYX4.js → chunk-C5L4BSYY.js} +1 -1
  140. package/dist/standalone/{chunk-U5D3ABAW.js → chunk-CKZQXAZE.js} +1 -1
  141. package/dist/standalone/{chunk-7SROZWKL.js → chunk-CSUROWL2.js} +1 -1
  142. package/dist/standalone/{chunk-DUDQV6XJ.js → chunk-D27D4UUI.js} +1 -1
  143. package/dist/standalone/chunk-DEJLINCJ.js +1 -0
  144. package/dist/standalone/{chunk-KZ5V7F4W.js → chunk-DQHYNFE4.js} +1 -1
  145. package/dist/standalone/{chunk-METRMDIQ.js → chunk-EA2JKR5D.js} +1 -1
  146. package/dist/standalone/{chunk-BWEXJENB.js → chunk-EBWXFG4H.js} +1 -1
  147. package/dist/standalone/{chunk-4U5PYZLE.js → chunk-ECQTVV2J.js} +1 -1
  148. package/dist/standalone/{chunk-JUWOEHDD.js → chunk-EG6XHY7N.js} +1 -1
  149. package/dist/standalone/{chunk-MOVUB3HI.js → chunk-EIKBBMM4.js} +1 -1
  150. package/dist/standalone/{chunk-5BEXGGHV.js → chunk-EILTQDXX.js} +1 -1
  151. package/dist/standalone/{chunk-XYD65F6K.js → chunk-ERWZGAOA.js} +1 -1
  152. package/dist/standalone/{chunk-ZPGNTTQ3.js → chunk-F7UC63UN.js} +1 -1
  153. package/dist/standalone/{chunk-UANVABQG.js → chunk-FKVZRPV5.js} +1 -1
  154. package/dist/standalone/{chunk-DKSLOJDQ.js → chunk-FO26ZU7E.js} +1 -1
  155. package/dist/standalone/{chunk-RCZTUWG3.js → chunk-FSRSK4LY.js} +1 -1
  156. package/dist/standalone/{chunk-IS2BTYON.js → chunk-GD3ZRVZH.js} +1 -1
  157. package/dist/standalone/{chunk-L4EZAHCD.js → chunk-HEAQVSNS.js} +1 -1
  158. package/dist/standalone/{chunk-GD4GUF75.js → chunk-HODZXHVK.js} +1 -1
  159. package/dist/standalone/chunk-HPUOZHDA.js +1 -0
  160. package/dist/standalone/{chunk-AFKLFS74.js → chunk-I52I2DJG.js} +1 -1
  161. package/dist/standalone/{chunk-OG57FC7W.js → chunk-I5OKDKON.js} +1 -1
  162. package/dist/standalone/{chunk-TB5N24CM.js → chunk-IFLTA2OD.js} +1 -1
  163. package/dist/standalone/{chunk-NXXGISFB.js → chunk-IMOHEGMV.js} +1 -1
  164. package/dist/standalone/{chunk-5U6757U7.js → chunk-JAZCU2PP.js} +1 -1
  165. package/dist/standalone/{chunk-CG5OTGTR.js → chunk-JBIN7W2B.js} +1 -1
  166. package/dist/standalone/{chunk-BA6TK2PS.js → chunk-JHEUUNXM.js} +1 -1
  167. package/dist/standalone/chunk-JJA7KHJK.js +1 -0
  168. package/dist/standalone/{chunk-4YTSKL4R.js → chunk-JVUZEYKQ.js} +1 -1
  169. package/dist/standalone/{chunk-INFALEU6.js → chunk-JYMXJUJ2.js} +1 -1
  170. package/dist/standalone/chunk-K7AJEMKE.js +1 -0
  171. package/dist/standalone/{chunk-ZZBE7O77.js → chunk-KDWJAKFX.js} +1 -1
  172. package/dist/standalone/{chunk-EQFBG7TB.js → chunk-KEZZGUYY.js} +1 -1
  173. package/dist/standalone/{chunk-6DAH3SMG.js → chunk-KTTYWH6A.js} +1 -1
  174. package/dist/standalone/{chunk-LVZKEWNM.js → chunk-LC3XGRNU.js} +1 -1
  175. package/dist/standalone/{chunk-LJFIXPDF.js → chunk-LJC5BM3X.js} +1 -1
  176. package/dist/standalone/{chunk-6XME7G3Q.js → chunk-LWYAZ2H7.js} +1 -1
  177. package/dist/standalone/{chunk-B3QSXX4O.js → chunk-M6MCQSPI.js} +1 -1
  178. package/dist/standalone/{chunk-AFH3KSFW.js → chunk-MIVYBFY3.js} +1 -1
  179. package/dist/standalone/{chunk-BQK2C2Z4.js → chunk-MNAASONZ.js} +1 -1
  180. package/dist/standalone/{chunk-BGOEMFLU.js → chunk-MRJNT4OH.js} +1 -1
  181. package/dist/standalone/{chunk-OQOBY6X3.js → chunk-N6KHKQJH.js} +1 -1
  182. package/dist/standalone/{chunk-V6QPVFDL.js → chunk-NBC6NJFJ.js} +1 -1
  183. package/dist/standalone/{chunk-SPDZUX4P.js → chunk-NCCAMFB6.js} +1 -1
  184. package/dist/standalone/{chunk-NGQTRDBQ.js → chunk-NE7AR3N3.js} +1 -1
  185. package/dist/standalone/chunk-NPERN4YF.js +1 -0
  186. package/dist/standalone/{chunk-YNZQSHFG.js → chunk-O2FV34ZD.js} +1 -1
  187. package/dist/standalone/{chunk-KVSQKUWD.js → chunk-OGUKYRFM.js} +1 -1
  188. package/dist/standalone/{chunk-ZHPDAJBM.js → chunk-OKG3HWSJ.js} +1 -1
  189. package/dist/standalone/{chunk-FUVCG23X.js → chunk-OOESPRIZ.js} +1 -1
  190. package/dist/standalone/{chunk-443UDYWL.js → chunk-OOKV3V3X.js} +1 -1
  191. package/dist/standalone/{chunk-ATES7QMQ.js → chunk-PAUQAU23.js} +1 -1
  192. package/dist/standalone/{chunk-Q7ZPWO67.js → chunk-PKCC4J5W.js} +1 -1
  193. package/dist/standalone/{chunk-DPNEFSEC.js → chunk-PYT4RZJH.js} +1 -1
  194. package/dist/standalone/{chunk-W7ETXRN4.js → chunk-Q3HF6P2M.js} +1 -1
  195. package/dist/standalone/{chunk-TPAZM36C.js → chunk-Q4CAKBWN.js} +1 -1
  196. package/dist/standalone/{chunk-M3NNNOD5.js → chunk-QKEJLVC5.js} +1 -1
  197. package/dist/standalone/{chunk-U6RNLNVU.js → chunk-QSOJFV42.js} +1 -1
  198. package/dist/standalone/{chunk-K6O3UDLX.js → chunk-RK3WWWTT.js} +1 -1
  199. package/dist/standalone/{chunk-XJSWM47N.js → chunk-RLLKECZT.js} +1 -1
  200. package/dist/standalone/{chunk-CAOUXOL7.js → chunk-RPQL45FL.js} +1 -1
  201. package/dist/standalone/{chunk-CKTKI4IY.js → chunk-S3CRZLGS.js} +1 -1
  202. package/dist/standalone/{chunk-L6DNHL3L.js → chunk-S63ID2FC.js} +1 -1
  203. package/dist/standalone/{chunk-VZCS5GXZ.js → chunk-SB35BJ7A.js} +1 -1
  204. package/dist/standalone/{chunk-26VREVWU.js → chunk-SSNHCN4D.js} +1 -1
  205. package/dist/standalone/{chunk-3KLX63D7.js → chunk-T2IE5GKA.js} +1 -1
  206. package/dist/standalone/{chunk-74ASA4WU.js → chunk-TGHH7ZFA.js} +1 -1
  207. package/dist/standalone/{chunk-FJ6G6FNE.js → chunk-TJRQUJFS.js} +1 -1
  208. package/dist/standalone/{chunk-EYGF6TQS.js → chunk-TQCXJX4I.js} +1 -1
  209. package/dist/standalone/{chunk-EYENA7HZ.js → chunk-TRL7AHZK.js} +1 -1
  210. package/dist/standalone/{chunk-CP4ZFBVW.js → chunk-TWTNWOJU.js} +1 -1
  211. package/dist/standalone/{chunk-UUO257GV.js → chunk-TZI3JW3Q.js} +1 -1
  212. package/dist/standalone/{chunk-M3PFFLSD.js → chunk-UBVWMMQG.js} +1 -1
  213. package/dist/standalone/{chunk-CYX3OHJ3.js → chunk-UDCVU3Z5.js} +1 -1
  214. package/dist/standalone/{chunk-BNNRPK47.js → chunk-UKL4FSKP.js} +1 -1
  215. package/dist/standalone/{chunk-PZ4QDWTI.js → chunk-ULIQFBZU.js} +1 -1
  216. package/dist/standalone/{chunk-XVJIEJ5R.js → chunk-USC5APTS.js} +1 -1
  217. package/dist/standalone/{chunk-QO645HJU.js → chunk-UWDFH35E.js} +1 -1
  218. package/dist/standalone/{chunk-YN4VXWMW.js → chunk-VPPKG2IW.js} +1 -1
  219. package/dist/standalone/{chunk-NIX2QSSN.js → chunk-VVOVVU53.js} +1 -1
  220. package/dist/standalone/{chunk-BSACLUQK.js → chunk-WLGZOFKE.js} +2 -2
  221. package/dist/standalone/{chunk-CN2AINNY.js → chunk-WQYWA7U6.js} +1 -1
  222. package/dist/standalone/{chunk-ZJK2XCP3.js → chunk-WR675JUF.js} +1 -1
  223. package/dist/standalone/{chunk-IYWVSMAY.js → chunk-WUWBZPUK.js} +1 -1
  224. package/dist/standalone/{chunk-K76OQSTQ.js → chunk-X43AA6RX.js} +1 -1
  225. package/dist/standalone/{chunk-EGSG64TS.js → chunk-XSLMHPP2.js} +1 -1
  226. package/dist/standalone/{chunk-5JLIP2HH.js → chunk-XZMOZFE6.js} +1 -1
  227. package/dist/standalone/{chunk-6ZPTNC34.js → chunk-Y4Q25F6X.js} +1 -1
  228. package/dist/standalone/{chunk-INQICZYC.js → chunk-Y6CXU7T4.js} +1 -1
  229. package/dist/standalone/{chunk-VR3UJA7B.js → chunk-YEBHHIAY.js} +1 -1
  230. package/dist/standalone/{chunk-MSXT3KG5.js → chunk-YFLOZILV.js} +1 -1
  231. package/dist/standalone/{chunk-MIGH67EO.js → chunk-YFPU55K4.js} +1 -1
  232. package/dist/standalone/{chunk-2I2F6IEF.js → chunk-ZE2Q22OK.js} +1 -1
  233. package/dist/standalone/studio.js +1 -1
  234. package/package.json +11 -9
  235. package/dist/index.js +0 -1
  236. package/dist/mount.js +0 -1
  237. package/dist/packem_chunks/AdvisorHealthPanel.js +0 -1
  238. package/dist/packem_chunks/ApiTab.js +0 -1
  239. package/dist/packem_chunks/AuditPanel.js +0 -1
  240. package/dist/packem_chunks/DeploymentHealthPanel.js +0 -1
  241. package/dist/packem_chunks/FunctionRunner.js +0 -1
  242. package/dist/packem_chunks/FunctionStatsPanel.js +0 -1
  243. package/dist/packem_chunks/HealthPanel.js +0 -1
  244. package/dist/packem_chunks/InsightsPanel.js +0 -1
  245. package/dist/packem_chunks/LogsPanel.js +0 -1
  246. package/dist/packem_chunks/MailPanel.js +0 -2
  247. package/dist/packem_chunks/MetricsPanel.js +0 -1
  248. package/dist/packem_chunks/NotificationsPanel.js +0 -1
  249. package/dist/packem_chunks/PitrPanel.js +0 -1
  250. package/dist/packem_chunks/SchemaViewer.js +0 -1
  251. package/dist/packem_chunks/SecurityAdvisorPanel.js +0 -1
  252. package/dist/packem_chunks/SettingsPanel.js +0 -1
  253. package/dist/packem_chunks/TableEditor.js +0 -1
  254. package/dist/packem_chunks/agents-panel.js +0 -1
  255. package/dist/packem_chunks/analytics-panel.js +0 -1
  256. package/dist/packem_chunks/auth-audit-panel.js +0 -1
  257. package/dist/packem_chunks/auth-config-panel.js +0 -1
  258. package/dist/packem_chunks/auth-sessions-panel.js +0 -1
  259. package/dist/packem_chunks/containers-panel.js +0 -1
  260. package/dist/packem_chunks/dashboards-panel.js +0 -1
  261. package/dist/packem_chunks/evals-panel.js +0 -1
  262. package/dist/packem_chunks/fanout-panel.js +0 -1
  263. package/dist/packem_chunks/flags-panel.js +0 -1
  264. package/dist/packem_chunks/issues-panel.js +0 -1
  265. package/dist/packem_chunks/kv-browser.js +0 -1
  266. package/dist/packem_chunks/migrations-route.js +0 -1
  267. package/dist/packem_chunks/organizations-panel.js +0 -1
  268. package/dist/packem_chunks/payments-panel.js +0 -1
  269. package/dist/packem_chunks/permissions-panel.js +0 -1
  270. package/dist/packem_chunks/queues-panel.js +0 -1
  271. package/dist/packem_chunks/reactors-panel.js +0 -1
  272. package/dist/packem_chunks/rls-panel.js +0 -1
  273. package/dist/packem_chunks/schedule-panel.js +0 -1
  274. package/dist/packem_chunks/sparkline.js +0 -1
  275. package/dist/packem_chunks/storage-rules-panel.js +0 -1
  276. package/dist/packem_chunks/subscriptions-panel.js +0 -1
  277. package/dist/packem_chunks/sync-client-panel.js +0 -1
  278. package/dist/packem_chunks/traces-panel.js +0 -1
  279. package/dist/packem_chunks/users-panel.js +0 -1
  280. package/dist/packem_chunks/vector-browser.js +0 -1
  281. package/dist/packem_chunks/workflows-panel.js +0 -1
  282. package/dist/packem_shared/ApiReferencePanel-uGgGOBYj.js +0 -1
  283. package/dist/packem_shared/CommandPalette-HqiXrWIm.js +0 -1
  284. package/dist/packem_shared/ConfirmButton-Cj2SOapE.js +0 -1
  285. package/dist/packem_shared/ConnectionBadge-Bh16X9-u.js +0 -1
  286. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-1Lrg55IV.js +0 -1
  287. package/dist/packem_shared/GlobalDataBrowser-LFznuyGe.js +0 -1
  288. package/dist/packem_shared/HomePanel-DmB0EKjl.js +0 -1
  289. package/dist/packem_shared/MigrationsPanel-BDNt136v.js +0 -1
  290. package/dist/packem_shared/OpenRpcReferencePanel-DgrpASYD.js +0 -1
  291. package/dist/packem_shared/ScheduledJobs-CiO3eXgI.js +0 -1
  292. package/dist/packem_shared/ShardInput-CdawpUiS.js +0 -1
  293. package/dist/packem_shared/Studio-CkNE_tEy.js +0 -1
  294. package/dist/packem_shared/StudioApp-BZP_0E2n.js +0 -1
  295. package/dist/packem_shared/StudioI18nProvider-Bl547evf.js +0 -1
  296. package/dist/packem_shared/advisor-view-C1KFTXSH.js +0 -1
  297. package/dist/packem_shared/alert-C2SEhYS9.js +0 -1
  298. package/dist/packem_shared/badge-cAk9Di1Q.js +0 -1
  299. package/dist/packem_shared/button-BOPLD1un.js +0 -1
  300. package/dist/packem_shared/card-BGlQzQY-.js +0 -1
  301. package/dist/packem_shared/checkbox-C5w53W-E.js +0 -1
  302. package/dist/packem_shared/data-grid-BFTQnkXq.js +0 -1
  303. package/dist/packem_shared/dropdown-menu-U7Tjg1Nb.js +0 -2
  304. package/dist/packem_shared/empty-state-B939z6K2.js +0 -1
  305. package/dist/packem_shared/error-alert-TYdKetJd.js +0 -1
  306. package/dist/packem_shared/home-panel-DHOa3sxt.js +0 -3
  307. package/dist/packem_shared/input-CY5W3wzv.js +0 -1
  308. package/dist/packem_shared/label-BOUo-DP0.js +0 -1
  309. package/dist/packem_shared/live-status-Bf7rR8o8.js +0 -1
  310. package/dist/packem_shared/log-line-UnE93Ovi.js +0 -1
  311. package/dist/packem_shared/modal-shell-wGW4CKEW.js +0 -1
  312. package/dist/packem_shared/recording-client-CKn4-vUx.js +0 -1
  313. package/dist/packem_shared/schema-diagram-DOaIh1y6.js +0 -2
  314. package/dist/packem_shared/scroll-area-DSJftwu_.js +0 -2
  315. package/dist/packem_shared/select-BPISLTcv.js +0 -2
  316. package/dist/packem_shared/shard-history-DU5b3QDI.js +0 -1
  317. package/dist/packem_shared/shortcuts-lH4Vaqjc.js +0 -1
  318. package/dist/packem_shared/skeleton-DFBBaJU6.js +0 -1
  319. package/dist/packem_shared/sparkline-CYbJzfA1.js +0 -1
  320. package/dist/packem_shared/sql-result-table-CqlZo2QN.js +0 -1
  321. package/dist/packem_shared/stat-card-B9uIvAHg.js +0 -1
  322. package/dist/packem_shared/studio-CXai1O2K.js +0 -2
  323. package/dist/packem_shared/table-BMsuYFhk.js +0 -2
  324. package/dist/packem_shared/table-list-sidebar-BWq_-gtu.js +0 -1
  325. package/dist/packem_shared/textarea-DpO3i-Qo.js +0 -1
  326. package/dist/packem_shared/trace-handoff-z9sy89Ci.js +0 -1
  327. package/dist/packem_shared/use-admin-query-P0RJrjsD.js +0 -1
  328. package/dist/packem_shared/use-async-submit-DdLd0MdK.js +0 -1
  329. package/dist/packem_shared/use-auth-config-z3KRWAqD.js +0 -1
  330. package/dist/packem_shared/use-open-trace-4mqqFWrn.js +0 -1
  331. package/dist/packem_shared/use-sql-assistant-D1K2LqpO.js +0 -1
  332. package/dist/standalone/chunk-35O3VETX.js +0 -1
  333. package/dist/standalone/chunk-57VX76PR.js +0 -1
  334. package/dist/standalone/chunk-76YLMHR3.js +0 -1
  335. package/dist/standalone/chunk-N5OS5NUG.js +0 -1
  336. package/dist/standalone/chunk-O5MAFDY2.js +0 -1
  337. package/dist/standalone/chunk-TNKECJW4.js +0 -1
  338. /package/dist/packem_shared/{ADMIN_FUNCTIONS-B6z7VLYt.js → ADMIN_FUNCTIONS-B6z7VLYt.mjs} +0 -0
  339. /package/dist/packem_shared/{DEFAULT_AUTO_REFRESH_MS-DuULO4XM.js → DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs} +0 -0
  340. /package/dist/packem_shared/{DEFAULT_LOCALE-A1Yg5ORA.js → DEFAULT_LOCALE-A1Yg5ORA.mjs} +0 -0
  341. /package/dist/packem_shared/{DataFilters-3nbW0uax.js → DataFilters-3nbW0uax.mjs} +0 -0
  342. /package/dist/packem_shared/{ErrorBoundary-BWNF98VF.js → ErrorBoundary-BWNF98VF.mjs} +0 -0
  343. /package/dist/packem_shared/{STUDIO_ROOT_CLASS-C6MccdVk.js → STUDIO_ROOT_CLASS-C6MccdVk.mjs} +0 -0
  344. /package/dist/packem_shared/{aggregateMetrics-A-Y7OH6R.js → aggregateMetrics-A-Y7OH6R.mjs} +0 -0
  345. /package/dist/packem_shared/{browser-storage-BH1MxLZs.js → browser-storage-BH1MxLZs.mjs} +0 -0
  346. /package/dist/packem_shared/{cf-links-CBJ5SywP.js → cf-links-CBJ5SywP.mjs} +0 -0
  347. /package/dist/packem_shared/{control-button-BOZ5K-FC.js → control-button-BOZ5K-FC.mjs} +0 -0
  348. /package/dist/packem_shared/{data-view-params-qoSTqjAj.js → data-view-params-qoSTqjAj.mjs} +0 -0
  349. /package/dist/packem_shared/{internal-CwaF9YNk.js → internal-CwaF9YNk.mjs} +0 -0
  350. /package/dist/packem_shared/{log-fields-SBxKyBug.js → log-fields-SBxKyBug.mjs} +0 -0
  351. /package/dist/packem_shared/{operation-console-provider-DoloEvon.js → operation-console-provider-DoloEvon.mjs} +0 -0
  352. /package/dist/packem_shared/{quote-identifier-CGiYFBvY.js → quote-identifier-CGiYFBvY.mjs} +0 -0
  353. /package/dist/packem_shared/{storage-tier-C2mKwYRj.js → storage-tier-C2mKwYRj.mjs} +0 -0
  354. /package/dist/packem_shared/{use-shard-key-BsP3o5wT.js → use-shard-key-BsP3o5wT.mjs} +0 -0
  355. /package/dist/packem_shared/{useDebounced-DVeQ5-oW.js → useDebounced-DVeQ5-oW.mjs} +0 -0
  356. /package/dist/packem_shared/{utils-bhneXptQ.js → utils-bhneXptQ.mjs} +0 -0
  357. /package/dist/packem_shared/{virtual-rect-D_j7aLxX.js → virtual-rect-D_j7aLxX.mjs} +0 -0
  358. /package/dist/packem_shared/{wire-codec-Dl3VeNrd.js → wire-codec-Dl3VeNrd.mjs} +0 -0
  359. /package/dist/standalone/{chunk-DZGOHOOE.js → chunk-CXNZVJ3S.js} +0 -0
  360. /package/dist/standalone/{chunk-W2JBKQNU.js → chunk-UYEZR3BI.js} +0 -0
  361. /package/dist/standalone/{chunk-R5ZTCHCE.js → chunk-YKXDMIHQ.js} +0 -0
@@ -0,0 +1 @@
1
+ import{c as U}from"react/compiler-runtime";import{useState as ee,useEffect as le}from"react";import{E as ge}from"../packem_shared/error-alert-CczbAfst.mjs";import{L as be}from"../packem_shared/live-status-BuJdUZFU.mjs";import{ShardInput as xe}from"../packem_shared/ShardInput-C6mjgAh4.mjs";import{B as fe}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as ye}from"../packem_shared/checkbox-CnS9cyCz.mjs";import{E as Ne}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as ve}from"../packem_shared/input-CXhxesPC.mjs";import{u as oe}from"../packem_shared/use-admin-query-Cbj2GuHu.mjs";import{u as Se}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{useT as Z}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as ie}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.mjs";import{i as me}from"../packem_shared/internal-CwaF9YNk.mjs";import{r as we}from"../packem_shared/shard-history-CaO3C4KQ.mjs";import{p as _e,c as Ie}from"../packem_shared/trace-handoff-BV3EWqy_.mjs";import{L as ke}from"../packem_shared/log-line-Dzg4YZ-K.mjs";import{f as Me}from"../packem_shared/log-fields-SBxKyBug.mjs";import{c as ne}from"../packem_shared/utils-bhneXptQ.mjs";import{jsx as n,jsxs as k,Fragment as $e}from"react/jsx-runtime";const Te=.5,de=4,ce=a=>Math.min(100,Math.max(0,a)),Le=(a,e)=>{if(!Number.isFinite(e)||e<=0)return{leftPercent:0,widthPercent:100};const t=ce(a.offsetMs/e*100),s=a.durationMs/e*100,l=Math.max(Te,Math.min(ce(s),100-t));return{leftPercent:t,widthPercent:l}},Ce=(a,e,t=!1)=>{const s=e.trim().toLowerCase(),l=t?a.filter(r=>!r.ok):a;return s===""?[...l]:l.filter(r=>r.rootName.toLowerCase().includes(s)||r.functionPath.toLowerCase().includes(s)||r.traceId.toLowerCase().includes(s)||r.spans.some(o=>o.name.toLowerCase().includes(s)||o.spanId.toLowerCase().includes(s)))},q=a=>Number.isFinite(a)?a>0&&a<1?`${a.toFixed(2)}ms`:`${String(Math.round(a))}ms`:"—",Ee=a=>!Number.isFinite(a)||a<=0?[]:Array.from({length:de},(e,t)=>{const s=(t+1)/de;return{label:q(a*s),percent:s*100}}),ue=a=>{if(typeof a=="string")return a;try{return JSON.stringify(a)}catch{return String(a)}},Y=a=>{const e=U(7),{label:t,value:s}=a;let l;e[0]!==t?(l=n("dt",{className:"w-40 shrink-0 text-muted-foreground",children:t}),e[0]=t,e[1]=l):l=e[1];let r;e[2]!==s?(r=n("dd",{className:"min-w-0 break-all",children:s}),e[2]=s,e[3]=r):r=e[3];let o;return e[4]!==l||e[5]!==r?(o=k("div",{className:"flex gap-2",children:[l,r]}),e[4]=l,e[5]=r,e[6]=o):o=e[6],o},Pe=a=>{const e=U(68),{span:t}=a,s=Z();let l,r,o,i,d,f;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]!==s){const $=Object.entries(t.attributes??{});let M;e[15]!==t.events?(M=t.events??[],e[15]=t.events,e[16]=M):M=e[16],l=M,r="border-t border-border bg-background/60 px-3 py-2 font-mono text-xs",o="tr-span-detail";let N;e[17]!==s?(N=s("Span ID"),e[17]=s,e[18]=N):N=e[18];let v;e[19]!==t.spanId||e[20]!==N?(v=n(Y,{label:N,value:t.spanId}),e[19]=t.spanId,e[20]=N,e[21]=v):v=e[21];let S;e[22]!==s?(S=s("Parent span ID"),e[22]=s,e[23]=S):S=e[23];let m;e[24]!==t.parentSpanId||e[25]!==s?(m=t.parentSpanId===""?s("— (trace root)"):t.parentSpanId,e[24]=t.parentSpanId,e[25]=s,e[26]=m):m=e[26];let u;e[27]!==m||e[28]!==S?(u=n(Y,{label:S,value:m}),e[27]=m,e[28]=S,e[29]=u):u=e[29];let h;e[30]!==s?(h=s("Kind"),e[30]=s,e[31]=h):h=e[31];const T=t.kind??"internal";let _;e[32]!==h||e[33]!==T?(_=n(Y,{label:h,value:T}),e[32]=h,e[33]=T,e[34]=_):_=e[34];let w;e[35]!==s?(w=s("Started at"),e[35]=s,e[36]=w):w=e[36];let g;e[37]!==t.offsetMs||e[38]!==s?(g=s("+{offset}",{offset:q(t.offsetMs)}),e[37]=t.offsetMs,e[38]=s,e[39]=g):g=e[39];let b;e[40]!==w||e[41]!==g?(b=n(Y,{label:w,value:g}),e[40]=w,e[41]=g,e[42]=b):b=e[42];let I;e[43]!==s?(I=s("Duration"),e[43]=s,e[44]=I):I=e[44];let p;e[45]!==t.durationMs?(p=q(t.durationMs),e[45]=t.durationMs,e[46]=p):p=e[46];let x;e[47]!==I||e[48]!==p?(x=n(Y,{label:I,value:p}),e[47]=I,e[48]=p,e[49]=x):x=e[49],e[50]!==u||e[51]!==_||e[52]!==b||e[53]!==x||e[54]!==v?(i=k("dl",{className:"flex flex-col gap-1",children:[v,u,_,b,x]}),e[50]=u,e[51]=_,e[52]=b,e[53]=x,e[54]=v,e[55]=i):i=e[55],e[56]!==t.error?(d=t.error!==void 0&&k("div",{className:"mt-2 rounded-md border border-destructive/40 bg-destructive/10 px-2 py-1.5","data-testid":"tr-detail-error",children:[n("span",{className:"font-semibold text-destructive",children:t.error.type}),n("p",{className:"whitespace-pre-wrap break-all text-destructive",children:t.error.message})]}),e[56]=t.error,e[57]=d):d=e[57],f=$.length>0&&k("div",{className:"mt-2","data-testid":"tr-detail-attributes",children:[n("p",{className:"mb-1 text-muted-foreground",children:s("Attributes")}),n("dl",{className:"flex flex-col gap-1",children:$.map(Fe)})]}),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]=s,e[9]=l,e[10]=r,e[11]=o,e[12]=i,e[13]=d,e[14]=f}else l=e[9],r=e[10],o=e[11],i=e[12],d=e[13],f=e[14];let c;e[58]!==l||e[59]!==s?(c=l.length>0&&k("div",{className:"mt-2","data-testid":"tr-detail-events",children:[n("p",{className:"mb-1 text-muted-foreground",children:s("Events")}),n("ul",{className:"flex flex-col gap-1",children:l.map(Ae)})]}),e[58]=l,e[59]=s,e[60]=c):c=e[60];let y;return e[61]!==r||e[62]!==o||e[63]!==i||e[64]!==d||e[65]!==f||e[66]!==c?(y=k("div",{className:r,"data-testid":o,children:[i,d,f,c]}),e[61]=r,e[62]=o,e[63]=i,e[64]=d,e[65]=f,e[66]=c,e[67]=y):y=e[67],y};function Fe(a){const[e,t]=a;return n(Y,{label:e,value:ue(t)},e)}function Ke(a){const[e,t]=a;return`${e}=${ue(t)}`}function Ae(a){return k("li",{className:"flex gap-2",children:[n("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:me(a.ts)}),n(fe,{variant:"secondary",children:a.name}),n("span",{className:"min-w-0 break-all text-muted-foreground",children:Object.entries(a.attributes??{}).map(Ke).join(" ")})]},`${a.name}:${String(a.ts)}`)}const De=14,pe="grid grid-cols-[14rem_1fr_4rem_16rem_16rem] items-center gap-2 px-3",Re=a=>{const e=U(17),{traceDurationMs:t}=a;let s,l,r,o,i,d;if(e[0]!==t){d=Symbol.for("react.early_return_sentinel");e:{const y=Ee(t);if(y.length===0){d=null;break e}e[7]===Symbol.for("react.memo_cache_sentinel")?(r=ne(pe,"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")?(i=n("span",{}),e[8]=i):i=e[8],s="relative h-3",l=y.map(je)}e[0]=t,e[1]=s,e[2]=l,e[3]=r,e[4]=o,e[5]=i,e[6]=d}else s=e[1],l=e[2],r=e[3],o=e[4],i=e[5],d=e[6];if(d!==Symbol.for("react.early_return_sentinel"))return d;let f;e[9]!==s||e[10]!==l?(f=n("span",{className:s,children:l}),e[9]=s,e[10]=l,e[11]=f):f=e[11];let c;return e[12]!==r||e[13]!==o||e[14]!==i||e[15]!==f?(c=k("div",{className:r,"data-testid":o,children:[i,f]}),e[12]=r,e[13]=o,e[14]=i,e[15]=f,e[16]=c):c=e[16],c},Be=a=>{const e=U(60),{span:t,traceDurationMs:s}=a,l=Z(),[r,o]=ee(!1);let i;e[0]!==t||e[1]!==s?(i=Le(t,s),e[0]=t,e[1]=s,e[2]=i):i=e[2];const{leftPercent:d,widthPercent:f}=i;let c;e[3]!==t.attributes?(c=Me(t.attributes),e[3]=t.attributes,e[4]=c):c=e[4];const y=c,$=t.depth*De;let M;e[5]!==$?(M={paddingLeft:$},e[5]=$,e[6]=M):M=e[6];const N=M,v=`${String(d)}%`,S=`${String(f)}%`;let m;e[7]!==v||e[8]!==S?(m={left:v,width:S},e[7]=v,e[8]=S,e[9]=m):m=e[9];const u=m;let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{o(We)},e[10]=h):h=e[10];const T=h,_=t.depth,w=`tr-span-detail-${t.spanId}`;let 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:q(t.durationMs),failure:t.error===void 0?"":l(", failed: {message}",{message:t.error.message}),name:t.name,offset:q(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 b;e[17]===Symbol.for("react.memo_cache_sentinel")?(b=ne(pe,"w-full border-b border-border py-1.5 text-left font-mono text-xs hover:bg-muted/50"),e[17]=b):b=e[17];const I=`tr-span-toggle-${t.spanId}`;let p;e[18]!==t.ok?(p=t.ok?null:n("span",{"aria-hidden":"true",className:"mr-1 text-destructive","data-testid":"tr-span-error",children:"●"}),e[18]=t.ok,e[19]=p):p=e[19];let x;e[20]!==N||e[21]!==t.name||e[22]!==p?(x=k("span",{className:"truncate",style:N,title:t.name,children:[p,t.name]}),e[20]=N,e[21]=t.name,e[22]=p,e[23]=x):x=e[23];const R=t.ok?"bg-primary/70":"bg-destructive";let L;e[24]!==R?(L=ne("absolute inset-y-0 rounded-sm",R),e[24]=R,e[25]=L):L=e[25];let D;e[26]!==u||e[27]!==d||e[28]!==L||e[29]!==f?(D=n("span",{"aria-hidden":"true",className:"relative h-3 overflow-hidden rounded-sm bg-muted",children:n("span",{className:L,"data-left":d,"data-testid":"tr-span-bar","data-width":f,style:u})}),e[26]=u,e[27]=d,e[28]=L,e[29]=f,e[30]=D):D=e[30];let B;e[31]!==t.durationMs?(B=q(t.durationMs),e[31]=t.durationMs,e[32]=B):B=e[32];let F;e[33]!==B?(F=n("span",{className:"text-right tabular-nums text-muted-foreground",children:B}),e[33]=B,e[34]=F):F=e[34];let O;e[35]!==t.error?(O=t.error===void 0?null:n("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]=O):O=e[36];let C;e[37]!==O?(C=n("span",{className:"truncate text-muted-foreground",children:O}),e[37]=O,e[38]=C):C=e[38];let j;e[39]!==y?(j=y===""?null:n("span",{"data-testid":"tr-span-attributes",title:y,children:y}),e[39]=y,e[40]=j):j=e[40];let E;e[41]!==j?(E=n("span",{className:"truncate text-muted-foreground",children:j}),e[41]=j,e[42]=E):E=e[42];let W;e[43]!==r||e[44]!==w||e[45]!==g||e[46]!==I||e[47]!==x||e[48]!==D||e[49]!==F||e[50]!==C||e[51]!==E?(W=k("button",{"aria-controls":w,"aria-expanded":r,"aria-label":g,className:b,"data-testid":I,onClick:T,type:"button",children:[x,D,F,C,E]}),e[43]=r,e[44]=w,e[45]=g,e[46]=I,e[47]=x,e[48]=D,e[49]=F,e[50]=C,e[51]=E,e[52]=W):W=e[52];let K;e[53]!==r||e[54]!==t?(K=r&&n("div",{id:`tr-span-detail-${t.spanId}`,children:n(Pe,{span:t})}),e[53]=r,e[54]=t,e[55]=K):K=e[55];let P;return e[56]!==t.depth||e[57]!==W||e[58]!==K?(P=k("li",{"data-depth":_,"data-testid":"tr-span-row",children:[W,K]}),e[56]=t.depth,e[57]=W,e[58]=K,e[59]=P):P=e[59],P},Oe=a=>{const e=U(15),{durationMs:t,spans:s}=a,l=Z();let r;e[0]!==t?(r=n(Re,{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 i;if(e[4]!==t||e[5]!==s){let c;e[7]!==t?(c=y=>n(Be,{span:y,traceDurationMs:t},y.spanId),e[7]=t,e[8]=c):c=e[8],i=s.map(c),e[4]=t,e[5]=s,e[6]=i}else i=e[6];let d;e[9]!==o||e[10]!==i?(d=n("ul",{"aria-label":o,children:i}),e[9]=o,e[10]=i,e[11]=d):d=e[11];let f;return e[12]!==r||e[13]!==d?(f=k($e,{children:[r,d]}),e[12]=r,e[13]=d,e[14]=f):f=e[14],f};function je(a){return n("span",{className:ne("absolute inset-y-0 border-l border-border/70",a.percent===100?"-translate-x-full pr-1":"pl-1"),style:{left:`${String(a.percent)}%`},children:a.label},a.percent)}function We(a){return!a}const Ue=a=>Array.isArray(a?.traces)?a.traces:[],qe=a=>{const e=U(12),{entries:t}=a,s=Z();let l;e[0]!==t.length||e[1]!==s?(l=s("Logs ({count})",{count:t.length}),e[0]=t.length,e[1]=s,e[2]=l):l=e[2];let r;e[3]!==l?(r=n("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(Ge),e[5]=t,e[6]=o):o=e[6];let i;e[7]!==o?(i=n("div",{role:"grid",children:o}),e[7]=o,e[8]=i):i=e[8];let d;return e[9]!==r||e[10]!==i?(d=k("div",{className:"border-t border-border px-3 py-2","data-testid":"tr-logs",children:[r,i]}),e[9]=r,e[10]=i,e[11]=d):d=e[11],d},ze=a=>{const e=U(50),{expanded:t,logs:s,onToggle:l,trace:r}=a,o=Z();let i;e[0]!==l||e[1]!==r.traceId?(i=()=>{l(r.traceId)},e[0]=l,e[1]=r.traceId,e[2]=i):i=e[2];const d=i,f=`tr-row-${r.traceId}`,c=`tr-waterfall-${r.traceId}`,y=`tr-toggle-${r.traceId}`,$=t?"▾":"▸";let M;e[3]!==$?(M=n("span",{"aria-hidden":"true",className:"w-3 shrink-0 text-xs text-muted-foreground",children:$}),e[3]=$,e[4]=M):M=e[4];let N;e[5]!==r.rootName?(N=n("span",{className:"w-56 shrink-0 truncate text-sm font-medium",title:r.rootName,children:r.rootName}),e[5]=r.rootName,e[6]=N):N=e[6];let v;e[7]!==r.functionPath?(v=n("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]=v):v=e[8];let S;e[9]!==r.durationMs?(S=q(r.durationMs),e[9]=r.durationMs,e[10]=S):S=e[10];let m;e[11]!==S?(m=n("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:S}),e[11]=S,e[12]=m):m=e[12];let u;e[13]!==o||e[14]!==r.spans.length?(u=o("{count} spans",{count:r.spans.length}),e[13]=o,e[14]=r.spans.length,e[15]=u):u=e[15];let h;e[16]!==u?(h=n("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:u}),e[16]=u,e[17]=h):h=e[17];const T=r.ok?"secondary":"destructive";let _;e[18]!==o||e[19]!==r.ok?(_=r.ok?o("ok"):o("error"),e[18]=o,e[19]=r.ok,e[20]=_):_=e[20];let w;e[21]!==T||e[22]!==_?(w=n("span",{className:"shrink-0",children:n(fe,{variant:T,children:_})}),e[21]=T,e[22]=_,e[23]=w):w=e[23];let g;e[24]!==r.startTs?(g=me(r.startTs),e[24]=r.startTs,e[25]=g):g=e[25];let b;e[26]!==g?(b=n("span",{className:"flex-1 truncate text-right font-mono text-xs tabular-nums text-muted-foreground",children:g}),e[26]=g,e[27]=b):b=e[27];let I;e[28]!==t||e[29]!==d||e[30]!==m||e[31]!==h||e[32]!==w||e[33]!==b||e[34]!==c||e[35]!==y||e[36]!==M||e[37]!==N||e[38]!==v?(I=k("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":y,onClick:d,type:"button",children:[M,N,v,m,h,w,b]}),e[28]=t,e[29]=d,e[30]=m,e[31]=h,e[32]=w,e[33]=b,e[34]=c,e[35]=y,e[36]=M,e[37]=N,e[38]=v,e[39]=I):I=e[39];let p;e[40]!==t||e[41]!==s||e[42]!==r.durationMs||e[43]!==r.spans||e[44]!==r.traceId?(p=t&&k("div",{className:"bg-muted/20","data-testid":`tr-waterfall-${r.traceId}`,id:`tr-waterfall-${r.traceId}`,children:[n(Oe,{durationMs:r.durationMs,spans:r.spans}),s.length>0&&n(qe,{entries:s})]}),e[40]=t,e[41]=s,e[42]=r.durationMs,e[43]=r.spans,e[44]=r.traceId,e[45]=p):p=e[45];let x;return e[46]!==I||e[47]!==p||e[48]!==f?(x=k("div",{className:"border-b border-border last:border-b-0","data-testid":f,children:[I,p]}),e[46]=I,e[47]=p,e[48]=f,e[49]=x):x=e[49],x},gt=a=>{const e=U(58),{initialShardKey:t}=a,s=Z(),[l]=ee(_e),{queryShardKey:r,setShardKey:o,shardKey:i}=Se(l?.shardKey!==void 0&&l.shardKey!==""?l.shardKey:t??""),[d,f]=ee(l?.traceId??""),[c,y]=ee(!1),[$,M]=ee(He);let N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N=[],e[0]=N):N=e[0],le(Je,N);let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v={},e[1]=v):v=e[1];let S;e[2]!==r?(S={live:!0,shardKey:r},e[2]=r,e[3]=S):S=e[3];const{data:m,error:u,errorSource:h,isLoading:T,liveError:_}=oe(ie.getTraces,v,S);let w;e[4]===Symbol.for("react.memo_cache_sentinel")?(w={},e[4]=w):w=e[4];const g=$.size>0;let b;e[5]!==r||e[6]!==g?(b={enabled:g,live:!0,shardKey:r},e[5]=r,e[6]=g,e[7]=b):b=e[7];const{data:I}=oe(ie.getLogs,w,b);let p,x;e[8]!==m||e[9]!==r?(p=()=>{m!==void 0&&we(r)},x=[m,r],e[8]=m,e[9]=r,e[10]=p,e[11]=x):(p=e[10],x=e[11]),le(p,x);let R;if(e[12]!==m||e[13]!==u||e[14]!==h||e[15]!==$||e[16]!==T||e[17]!==_||e[18]!==I?.entries||e[19]!==c||e[20]!==d||e[21]!==o||e[22]!==i||e[23]!==s){const L=Ue(m),D=m?.total??L.length,B=D>L.length,F=Ce(L,d,c),O=Map.groupBy((I?.entries??[]).toReversed(),Qe);let C;e[25]===Symbol.for("react.memo_cache_sentinel")?(C=A=>{f(A.target.value)},e[25]=C):C=e[25];const j=C;let E;e[26]===Symbol.for("react.memo_cache_sentinel")?(E=A=>{M(he=>{const ae=new Set(he);return ae.has(A)?ae.delete(A):ae.add(A),ae})},e[26]=E):E=e[26];const W=E,K=u===null&&F.length===0&&!T;let P;e[27]!==o||e[28]!==i?(P=n(xe,{onChange:o,testId:"tr-shard-input",value:i}),e[27]=o,e[28]=i,e[29]=P):P=e[29];let z;e[30]!==s?(z=s("Search traces"),e[30]=s,e[31]=z):z=e[31];let G;e[32]!==s?(G=s("search trace, span, or function"),e[32]=s,e[33]=G):G=e[33];let H;e[34]!==d||e[35]!==z||e[36]!==G?(H=n(ve,{"aria-label":z,className:"h-8 w-56","data-testid":"tr-search",onChange:j,placeholder:G,value:d}),e[34]=d,e[35]=z,e[36]=G,e[37]=H):H=e[37];let J;e[38]!==c?(J=n(ye,{checked:c,"data-testid":"tr-only-errors",id:"tr-only-errors",onCheckedChange:y}),e[38]=c,e[39]=J):J=e[39];let Q;e[40]!==s?(Q=s("Errors only"),e[40]=s,e[41]=Q):Q=e[41];let V;e[42]!==J||e[43]!==Q?(V=k("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",htmlFor:"tr-only-errors",children:[J,Q]}),e[42]=J,e[43]=Q,e[44]=V):V=e[44];let X;e[45]!==_?(X=n(be,{message:_,prefix:"tr"}),e[45]=_,e[46]=X):X=e[46];let te;e[47]!==P||e[48]!==H||e[49]!==V||e[50]!==X?(te=k("div",{className:"flex flex-wrap items-center gap-2",children:[P,H,V,X]}),e[47]=P,e[48]=H,e[49]=V,e[50]=X,e[51]=te):te=e[51];let re;e[52]!==u||e[53]!==h?(re=u!==null&&n(ge,{error:h,testId:"tr-error"}),e[52]=u,e[53]=h,e[54]=re):re=e[54];let se;e[55]!==K||e[56]!==s?(se=K&&n(Ne,{description:s("Traces recorded with ctx.trace show up here as your app handles traffic. The span buffer resets when the shard hibernates."),icon:n("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:n("path",{d:"M4 6h10M7 12h13M10 18h7"})}),testId:"tr-empty",title:s("No traces")}),e[55]=K,e[56]=s,e[57]=se):se=e[57],R=k("div",{className:"flex flex-col gap-4","data-testid":"lunora-traces-panel",children:[te,re,se,u===null&&B&&n("p",{className:"text-xs text-muted-foreground","data-testid":"tr-truncated",children:s("Showing the {shown} most recent of {total} traces in the buffer.",{shown:L.length,total:D})}),u===null&&F.length>0&&n("div",{"aria-label":s("Recent traces"),className:"overflow-hidden rounded-xl border border-border shadow-xs","data-testid":"tr-list",children:F.map(A=>n(ze,{expanded:$.has(A.traceId),logs:O.get(A.traceId)??[],onToggle:W,trace:A},A.traceId))})]}),e[12]=m,e[13]=u,e[14]=h,e[15]=$,e[16]=T,e[17]=_,e[18]=I?.entries,e[19]=c,e[20]=d,e[21]=o,e[22]=i,e[23]=s,e[24]=R}else R=e[24];return R};function Ge(a,e){return n("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:n(ke,{entry:a})},`${String(e)}:${String(a.timestamp)}`)}function He(){return new Set}function Je(){Ie()}function Qe(a){return a.traceId}export{gt as default};
@@ -0,0 +1 @@
1
+ import{useLunora as ge}from"@lunora/react";import{useState as F,useEffect as Ve}from"react";import{B as M}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as U}from"../packem_shared/button-q0UYSmrn.mjs";import{C as Fe,a as Ie}from"../packem_shared/card--2hKx4L2.mjs";import{E as Qe}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as B}from"../packem_shared/input-CXhxesPC.mjs";import{T as Re,a as Pe,b as O,c as D,d as Te,e as R}from"../packem_shared/table-D0SBiDu-.mjs";import{b as Ze}from"../packem_shared/use-admin-query-Cbj2GuHu.mjs";import{c as Ne}from"react/compiler-runtime";import{u as qe,D as We}from"../packem_shared/use-auth-config-gxJL0E1r.mjs";import{useAutoRefresh as Je}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";import Ke from"../packem_shared/useDebounced-DVeQ5-oW.mjs";import{useT as ke}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{i as Se,h as Ae,f as Ee,b as je}from"../packem_shared/internal-CwaF9YNk.mjs";import{C as Xe}from"../packem_shared/checkbox-CnS9cyCz.mjs";import{L as V}from"../packem_shared/label-DKFzyHq6.mjs";import{M as Ye}from"../packem_shared/modal-shell-CDztwLnv.mjs";import{u as _e}from"../packem_shared/use-async-submit-DAKymxcP.mjs";import{jsxs as i,jsx as t,Fragment as et}from"react/jsx-runtime";We.capabilities;const tt=()=>{const u=Ne(3),{config:e,ready:a}=qe();let l;return u[0]!==e.capabilities||u[1]!==a?(l={capabilities:e.capabilities,ready:a},u[0]=e.capabilities,u[1]=a,u[2]=l):l=u[2],l},st={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},lt=(u,e)=>u.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:u.type!=="number"||!Number.isNaN(Number(e.trim())),at=(u,e)=>{if(u.type==="boolean")return e===!0?{value:!0}:u.required?{value:!1}:void 0;const a=typeof e=="string"?e.trim():"";if(a!==""){if(u.type==="number"){const l=Number(a);return Number.isNaN(l)?void 0:{value:l}}return{value:a}}},nt=u=>{const e=Ne(105),{onClose:a,onCreated:l}=u,c=ge(),s=ke(),{config:d}=qe(),{busy:n,error:r,run:m}=_e(),[k,S]=F(""),[x,w]=F(""),[y,A]=F(""),[h,g]=F("");let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[p,o]=F(b);let C;e[1]===Symbol.for("react.memo_cache_sentinel")?(C=f=>{S(f.target.value)},e[1]=C):C=e[1];const v=C;let I;e[2]===Symbol.for("react.memo_cache_sentinel")?(I=f=>{w(f.target.value)},e[2]=I):I=e[2];const $=I;let T;e[3]===Symbol.for("react.memo_cache_sentinel")?(T=f=>{A(f.target.value)},e[3]=T):T=e[3];const ze=T;let q;e[4]===Symbol.for("react.memo_cache_sentinel")?(q=f=>{g(f.target.value)},e[4]=q):q=e[4];const Be=q;let Y;e[5]===Symbol.for("react.memo_cache_sentinel")?(Y=(f,P)=>{o(H=>({...H,[f]:P}))},e[5]=Y):Y=e[5];const Ue=Y;let G;e[6]!==p?(G=f=>p[f.name]??(f.type==="boolean"?!1:""),e[6]=p,e[7]=G):G=e[7];const E=G;let Q;if(e[8]!==d.userFields||e[9]!==E){let f;e[11]!==E?(f=P=>!P.required||lt(P,E(P)),e[11]=E,e[12]=f):f=e[12],Q=d.userFields.every(f),e[8]=d.userFields,e[9]=E,e[10]=Q}else Q=e[10];const we=Q;let Z;e[13]!==n||e[14]!==k||e[15]!==x||e[16]!==we?(Z=!n&&k.trim()!==""&&x.trim()!==""&&we,e[13]=n,e[14]=k,e[15]=x,e[16]=we,e[17]=Z):Z=e[17];const $e=Z;let W;e[18]!==d.userFields||e[19]!==E?(W=()=>{const f={};for(const P of d.userFields){const H=at(P,E(P));H!==void 0&&(f[P.name]=H.value)}return Object.keys(f).length===0?void 0:f},e[18]=d.userFields,e[19]=E,e[20]=W):W=e[20];const Ce=W;let J;e[21]!==Ce||e[22]!==c||e[23]!==k||e[24]!==x||e[25]!==a||e[26]!==l||e[27]!==y||e[28]!==h||e[29]!==m?(J=()=>{m(async()=>{await c.createAuthUser({data:Ce(),email:k.trim(),name:x.trim(),password:y===""?void 0:y,role:h.trim()===""?void 0:h.trim()}),l(),a()})},e[21]=Ce,e[22]=c,e[23]=k,e[24]=x,e[25]=a,e[26]=l,e[27]=y,e[28]=h,e[29]=m,e[30]=J):J=e[30];const N=J;let z;e[31]!==s?(z=s("Create user"),e[31]=s,e[32]=z):z=e[32];let L;e[33]!==s?(L=s("Create user"),e[33]=s,e[34]=L):L=e[34];let j;e[35]!==L?(j=t("h2",{className:"text-sm font-semibold text-foreground",children:L}),e[35]=L,e[36]=j):j=e[36];let K;e[37]!==s?(K=s("email"),e[37]=s,e[38]=K):K=e[38];let X;e[39]!==K?(X=t(V,{htmlFor:"uc-email",children:K}),e[39]=K,e[40]=X):X=e[40];let _;e[41]!==k?(_=t(B,{"data-testid":"uc-email",id:"uc-email",onChange:v,type:"email",value:k}),e[41]=k,e[42]=_):_=e[42];let ee;e[43]!==X||e[44]!==_?(ee=i("div",{className:"flex flex-col gap-1",children:[X,_]}),e[43]=X,e[44]=_,e[45]=ee):ee=e[45];let te;e[46]!==s?(te=s("name"),e[46]=s,e[47]=te):te=e[47];let se;e[48]!==te?(se=t(V,{htmlFor:"uc-name",children:te}),e[48]=te,e[49]=se):se=e[49];let le;e[50]!==x?(le=t(B,{"data-testid":"uc-name",id:"uc-name",onChange:$,value:x}),e[50]=x,e[51]=le):le=e[51];let ae;e[52]!==se||e[53]!==le?(ae=i("div",{className:"flex flex-col gap-1",children:[se,le]}),e[52]=se,e[53]=le,e[54]=ae):ae=e[54];let ne;e[55]!==s?(ne=s("Password (optional)"),e[55]=s,e[56]=ne):ne=e[56];let re;e[57]!==ne?(re=t(V,{htmlFor:"uc-password",children:ne}),e[57]=ne,e[58]=re):re=e[58];let ie;e[59]!==y?(ie=t(B,{"data-testid":"uc-password",id:"uc-password",onChange:ze,type:"password",value:y}),e[59]=y,e[60]=ie):ie=e[60];let oe;e[61]!==re||e[62]!==ie?(oe=i("div",{className:"flex flex-col gap-1",children:[re,ie]}),e[61]=re,e[62]=ie,e[63]=oe):oe=e[63];let de;e[64]!==s?(de=s("Role (optional)"),e[64]=s,e[65]=de):de=e[65];let ce;e[66]!==de?(ce=t(V,{htmlFor:"uc-role",children:de}),e[66]=de,e[67]=ce):ce=e[67];let ue;e[68]!==h?(ue=t(B,{"data-testid":"uc-role",id:"uc-role",onChange:Be,value:h}),e[68]=h,e[69]=ue):ue=e[69];let me;e[70]!==ce||e[71]!==ue?(me=i("div",{className:"flex flex-col gap-1",children:[ce,ue]}),e[70]=ce,e[71]=ue,e[72]=me):me=e[72];let he;e[73]!==d.userFields||e[74]!==E||e[75]!==s?(he=d.userFields.length>0&&i("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[t("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Plugin fields")}),d.userFields.map(f=>{const P=`uc-field-${f.name}`,H=f.required?"":` (${s("optional")})`;if(f.type==="boolean"){const Me=E(f)===!0;return i("label",{className:"flex items-center gap-2",htmlFor:P,children:[t(Xe,{checked:Me,"data-testid":P,id:P,onCheckedChange:Ge=>{Ue(f.name,Ge)}}),i("span",{className:"text-sm",children:[f.name,H]})]},f.name)}const He=E(f);return i("div",{className:"flex flex-col gap-1",children:[i(V,{htmlFor:P,children:[f.name,H]}),t(B,{"data-testid":P,id:P,onChange:Me=>{Ue(f.name,Me.target.value)},type:st[f.type],value:typeof He=="string"?He:""})]},f.name)})]}),e[73]=d.userFields,e[74]=E,e[75]=s,e[76]=he):he=e[76];let fe;e[77]!==r?(fe=r!==null&&t("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:r}),e[77]=r,e[78]=fe):fe=e[78];let pe;e[79]!==s?(pe=s("Cancel"),e[79]=s,e[80]=pe):pe=e[80];let be;e[81]!==a||e[82]!==pe?(be=t(U,{"data-testid":"uc-cancel",onClick:a,size:"sm",type:"button",variant:"outline",children:pe}),e[81]=a,e[82]=pe,e[83]=be):be=e[83];const Le=!$e;let ve;e[84]!==n||e[85]!==s?(ve=s(n?"Creating…":"Create"),e[84]=n,e[85]=s,e[86]=ve):ve=e[86];let xe;e[87]!==N||e[88]!==Le||e[89]!==ve?(xe=t(U,{"data-testid":"uc-submit",disabled:Le,onClick:N,size:"sm",type:"button",children:ve}),e[87]=N,e[88]=Le,e[89]=ve,e[90]=xe):xe=e[90];let ye;e[91]!==be||e[92]!==xe?(ye=i("div",{className:"flex justify-end gap-2 pt-1",children:[be,xe]}),e[91]=be,e[92]=xe,e[93]=ye):ye=e[93];let De;return e[94]!==a||e[95]!==z||e[96]!==j||e[97]!==ee||e[98]!==ae||e[99]!==oe||e[100]!==me||e[101]!==he||e[102]!==fe||e[103]!==ye?(De=i(Ye,{label:z,onClose:a,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[j,ee,ae,oe,me,he,fe,ye]}),e[94]=a,e[95]=z,e[96]=j,e[97]=ee,e[98]=ae,e[99]=oe,e[100]=me,e[101]=he,e[102]=fe,e[103]=ye,e[104]=De):De=e[104],De},Oe=u=>{const e=Ne(2),{children:a}=u;let l;return e[0]!==a?(l=t("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[0]=a,e[1]=l):l=e[1],l},rt=u=>{const e=Ne(29),{busy:a,runAction:l,userId:c,version:s}=u,d=ge(),n=ke(),[r,m]=F(null),[k,S]=F(null);let x;e[0]!==d||e[1]!==c?(x=()=>{Ee((async()=>{S(null);try{const v=await d.listAuthSessions({limit:50,userId:c});m(v.rows)}catch(v){const I=v;m(null),S(je(I))}})())},e[0]=d,e[1]=c,e[2]=x):x=e[2];let w;e[3]!==d||e[4]!==c||e[5]!==s?(w=[d,c,s],e[3]=d,e[4]=c,e[5]=s,e[6]=w):w=e[6],Ve(x,w);let y;e[7]!==d||e[8]!==l?(y=v=>{l(()=>d.revokeAuthSession({sessionId:v}))},e[7]=d,e[8]=l,e[9]=y):y=e[9];const A=y;let h;e[10]!==n?(h=n("Sessions"),e[10]=n,e[11]=h):h=e[11];let g;e[12]!==h?(g=t(Oe,{children:h}),e[12]=h,e[13]=g):g=e[13];let b;e[14]!==k?(b=k!==null&&t("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:k}),e[14]=k,e[15]=b):b=e[15];let p;e[16]!==r||e[17]!==n?(p=r!==null&&r.length===0&&t("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:n("No active sessions.")}),e[16]=r,e[17]=n,e[18]=p):p=e[18];let o;e[19]!==a||e[20]!==A||e[21]!==r||e[22]!==n?(o=r!==null&&r.length>0&&t(Fe,{className:"overflow-hidden py-0",children:t(Ie,{className:"px-0",children:i(Re,{"data-testid":"ud-sessions-table",children:[t(Pe,{children:i(O,{children:[t(D,{children:n("expires")}),t(D,{children:n("ip")}),t(D,{children:n("user agent")}),t(D,{"aria-label":n("Actions")})]})}),t(Te,{children:r.map(v=>i(O,{"data-testid":`ud-session-${v.id}`,children:[t(R,{className:"text-muted-foreground tabular-nums",children:Se(v.expiresAt)}),t(R,{children:v.ipAddress??""}),t(R,{className:"max-w-40 truncate",children:v.userAgent??""}),t(R,{children:t(U,{"data-testid":`ud-revoke-${v.id}`,disabled:a,onClick:()=>{A(v.id)},size:"xs",type:"button",variant:"ghost",children:n("Revoke")})})]},v.id))})]})})}),e[19]=a,e[20]=A,e[21]=r,e[22]=n,e[23]=o):o=e[23];let C;return e[24]!==g||e[25]!==b||e[26]!==p||e[27]!==o?(C=i("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[g,b,p,o]}),e[24]=g,e[25]=b,e[26]=p,e[27]=o,e[28]=C):C=e[28],C},it=u=>{const e=Ne(30),{busy:a,runAction:l,userId:c,version:s}=u,d=ge(),n=ke(),[r,m]=F(null),[k,S]=F(null);let x;e[0]!==d||e[1]!==c?(x=()=>{Ee((async()=>{S(null);try{m(await d.listAuthAccounts({userId:c}))}catch(v){const I=v;m(null),S(je(I))}})())},e[0]=d,e[1]=c,e[2]=x):x=e[2];let w;e[3]!==d||e[4]!==c||e[5]!==s?(w=[d,c,s],e[3]=d,e[4]=c,e[5]=s,e[6]=w):w=e[6],Ve(x,w);let y;e[7]!==d||e[8]!==l||e[9]!==c?(y=v=>{l(()=>d.unlinkAuthAccount({accountId:v,userId:c}))},e[7]=d,e[8]=l,e[9]=c,e[10]=y):y=e[10];const A=y;let h;e[11]!==n?(h=n("Linked accounts"),e[11]=n,e[12]=h):h=e[12];let g;e[13]!==h?(g=t(Oe,{children:h}),e[13]=h,e[14]=g):g=e[14];let b;e[15]!==k?(b=k!==null&&t("p",{className:"text-sm text-destructive",role:"alert",children:k}),e[15]=k,e[16]=b):b=e[16];let p;e[17]!==r||e[18]!==n?(p=r!==null&&r.length===0&&t("p",{className:"text-sm text-muted-foreground",children:n("No linked accounts.")}),e[17]=r,e[18]=n,e[19]=p):p=e[19];let o;e[20]!==r||e[21]!==a||e[22]!==A||e[23]!==n?(o=r!==null&&r.length>0&&t(Fe,{className:"overflow-hidden py-0",children:t(Ie,{className:"px-0",children:i(Re,{"data-testid":"ud-accounts-table",children:[t(Pe,{children:i(O,{children:[t(D,{children:n("provider")}),t(D,{children:n("created")}),t(D,{"aria-label":n("Actions")})]})}),t(Te,{children:r.map(v=>{const I=Ae(v.id);return i(O,{"data-testid":`ud-account-${I}`,children:[t(R,{children:Ae(v.providerId)}),t(R,{className:"text-muted-foreground tabular-nums",children:Se(v.createdAt)}),t(R,{children:t(U,{"data-testid":`ud-unlink-${I}`,disabled:a,onClick:()=>{A(I)},size:"xs",type:"button",variant:"ghost",children:n("Unlink")})})]},I)})})]})})}),e[20]=r,e[21]=a,e[22]=A,e[23]=n,e[24]=o):o=e[24];let C;return e[25]!==g||e[26]!==b||e[27]!==p||e[28]!==o?(C=i("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[g,b,p,o]}),e[25]=g,e[26]=b,e[27]=p,e[28]=o,e[29]=C):C=e[29],C},ot=u=>{const e=Ne(40),{busy:a,capabilities:l,runAction:c,userId:s,version:d}=u,n=ge(),r=ke(),[m,k]=F(null);let S;e[0]!==l.passkey||e[1]!==n||e[2]!==s?(S=()=>{l.passkey&&Ee((async()=>{try{k(await n.listAuthPasskeys({userId:s}))}catch{k(null)}})())},e[0]=l.passkey,e[1]=n,e[2]=s,e[3]=S):S=e[3];let x;e[4]!==l.passkey||e[5]!==n||e[6]!==s||e[7]!==d?(x=[l.passkey,n,s,d],e[4]=l.passkey,e[5]=n,e[6]=s,e[7]=d,e[8]=x):x=e[8],Ve(S,x);let w;e[9]!==n||e[10]!==c||e[11]!==s?(w=()=>{c(()=>n.disableAuthTwoFactor({userId:s}))},e[9]=n,e[10]=c,e[11]=s,e[12]=w):w=e[12];const y=w;let A;e[13]!==n||e[14]!==c?(A=I=>{c(()=>n.deleteAuthPasskey({passkeyId:I}))},e[13]=n,e[14]=c,e[15]=A):A=e[15];const h=A;let g;e[16]!==r?(g=r("Security"),e[16]=r,e[17]=g):g=e[17];let b;e[18]!==g?(b=t(Oe,{children:g}),e[18]=g,e[19]=b):b=e[19];let p;e[20]!==a||e[21]!==l.twoFactor||e[22]!==y||e[23]!==r?(p=l.twoFactor&&t(U,{"data-testid":"ud-disable-2fa",disabled:a,onClick:y,size:"sm",type:"button",variant:"outline",children:r("Disable two-factor")}),e[20]=a,e[21]=l.twoFactor,e[22]=y,e[23]=r,e[24]=p):p=e[24];let o;e[25]!==l.passkey||e[26]!==m||e[27]!==r?(o=l.passkey&&m!==null&&m.length===0&&t("p",{className:"text-sm text-muted-foreground",children:r("No passkeys.")}),e[25]=l.passkey,e[26]=m,e[27]=r,e[28]=o):o=e[28];let C;e[29]!==a||e[30]!==l.passkey||e[31]!==h||e[32]!==m||e[33]!==r?(C=l.passkey&&m!==null&&m.length>0&&t(Fe,{className:"overflow-hidden py-0",children:t(Ie,{className:"px-0",children:i(Re,{"data-testid":"ud-passkeys-table",children:[t(Pe,{children:i(O,{children:[t(D,{children:r("name")}),t(D,{children:r("created")}),t(D,{"aria-label":r("Actions")})]})}),t(Te,{children:m.map(I=>{const $=Ae(I.id);return i(O,{"data-testid":`ud-passkey-${$}`,children:[t(R,{children:Ae(I.name)||$}),t(R,{className:"text-muted-foreground tabular-nums",children:Se(I.createdAt)}),t(R,{children:t(U,{"data-testid":`ud-delete-passkey-${$}`,disabled:a,onClick:()=>{h($)},size:"xs",type:"button",variant:"ghost",children:r("Delete")})})]},$)})})]})})}),e[29]=a,e[30]=l.passkey,e[31]=h,e[32]=m,e[33]=r,e[34]=C):C=e[34];let v;return e[35]!==b||e[36]!==p||e[37]!==o||e[38]!==C?(v=i("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[b,p,o,C]}),e[35]=b,e[36]=p,e[37]=o,e[38]=C,e[39]=v):v=e[39],v},dt=/(?:at|expires)$/iu,ct=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),ut=(u,e)=>typeof e=="number"&&dt.test(u)?Se(e):Ae(e),mt=({capabilities:u,onChanged:e,onClose:a,user:l})=>{const c=ge(),s=ke(),d=l.banned===!0,[n,r]=F(null),[m,k]=F(!1),[S,x]=F(0),[w,y]=F(typeof l.role=="string"?l.role:""),[A,h]=F(""),[g,b]=F(""),[p,o]=F(""),[C,v]=F(null),[I,$]=F(!1),T=(N,z)=>{Ee((async()=>{k(!0),r(null);try{const L=await N();z?.refresh!==!1&&(x(j=>j+1),e()),z?.onResult?.(L)}catch(L){r(je(L))}k(!1)})())},ze=N=>{y(N.target.value)},q=N=>{h(N.target.value)},Be=N=>{b(N.target.value)},Y=N=>{o(N.target.value)},Ue=()=>{const N=w.trim();N!==""&&T(async()=>{await c.setAuthUserRole({role:N,userId:l.id})})},G=()=>{const N=Number.parseInt(g,10),z=Number.isFinite(N)&&N>0?N*86400:void 0;T(async()=>{await c.banAuthUser({expiresInSeconds:z,reason:A.trim()===""?void 0:A.trim(),userId:l.id})})},E=()=>{T(async()=>{await c.unbanAuthUser({userId:l.id})})},Q=()=>{T(async()=>{await c.setAuthUserPassword({newPassword:p,userId:l.id}),o("")})},we=()=>{T(()=>c.impersonateAuthUser({userId:l.id}),{onResult:N=>{v(N.token)},refresh:!1})},Z=()=>{T(async()=>{await c.revokeAuthUserSessions({userId:l.id})})},$e=()=>{T(async()=>{await c.removeAuthUser({userId:l.id}),a()})},W=()=>{$(!0)},Ce=()=>{$(!1)},J=Object.entries(l).filter(([N])=>!ct.has(N));return i(Ye,{label:s("User details"),onClose:a,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[i("div",{className:"flex items-start justify-between gap-2",children:[i("div",{className:"flex flex-col gap-1",children:[t("h2",{className:"text-sm font-semibold text-foreground",children:l.name??l.email??l.id}),t("p",{className:"font-mono text-xs text-muted-foreground",children:l.id}),i("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof l.role=="string"&&l.role!==""&&t(M,{variant:"secondary",children:l.role}),d?t(M,{variant:"destructive",children:s("Banned")}):t(M,{variant:"outline",children:s("Active")}),l.emailVerified===!0?t(M,{variant:"secondary",children:s("verified")}):t(M,{variant:"outline",children:s("unverified")})]})]}),t(U,{"data-testid":"ud-close",onClick:a,size:"sm",type:"button",variant:"ghost",children:s("Close")})]}),n!==null&&t("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:n}),u.admin&&i(Fe,{className:"gap-0 py-0",children:[t("header",{className:"border-b border-border px-4 py-3",children:t("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Actions")})}),i(Ie,{className:"flex flex-col gap-3 p-3",children:[i("div",{className:"flex items-end gap-2",children:[i("div",{className:"flex flex-1 flex-col gap-1",children:[t(V,{htmlFor:"ud-role",children:s("Role")}),t(B,{"data-testid":"ud-role-input",id:"ud-role",onChange:ze,value:w})]}),t(U,{"data-testid":"ud-set-role",disabled:m||w.trim()==="",onClick:Ue,size:"sm",type:"button",variant:"outline",children:s("Set role")})]}),d?t(U,{"data-testid":"ud-unban",disabled:m,onClick:E,size:"sm",type:"button",variant:"outline",children:s("Unban")}):i("div",{className:"flex items-end gap-2",children:[i("div",{className:"flex flex-1 flex-col gap-1",children:[t(V,{htmlFor:"ud-ban-reason",children:s("Ban reason (optional)")}),t(B,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:q,value:A})]}),i("div",{className:"flex w-24 flex-col gap-1",children:[t(V,{htmlFor:"ud-ban-days",children:s("Days")}),t(B,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:Be,type:"number",value:g})]}),t(U,{"data-testid":"ud-ban",disabled:m,onClick:G,size:"sm",type:"button",variant:"destructive",children:s("Ban user")})]}),i("div",{className:"flex items-end gap-2",children:[i("div",{className:"flex flex-1 flex-col gap-1",children:[t(V,{htmlFor:"ud-password",children:s("New password")}),t(B,{"data-testid":"ud-password",id:"ud-password",onChange:Y,type:"password",value:p})]}),t(U,{"data-testid":"ud-set-password",disabled:m||p==="",onClick:Q,size:"sm",type:"button",variant:"outline",children:s("Set password")})]}),i("div",{className:"flex flex-wrap gap-2",children:[t(U,{"data-testid":"ud-impersonate",disabled:m,onClick:we,size:"sm",type:"button",variant:"outline",children:s("Impersonate")}),t(U,{"data-testid":"ud-revoke-all",disabled:m,onClick:Z,size:"sm",type:"button",variant:"outline",children:s("Revoke all sessions")}),I?i(et,{children:[t(U,{"data-testid":"ud-delete-confirm",disabled:m,onClick:$e,size:"sm",type:"button",variant:"destructive",children:s("Confirm delete")}),t(U,{"data-testid":"ud-delete-cancel",onClick:Ce,size:"sm",type:"button",variant:"ghost",children:s("Cancel")})]}):t(U,{"data-testid":"ud-delete",disabled:m,onClick:W,size:"sm",type:"button",variant:"destructive",children:s("Delete user")})]}),C!==null&&i("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[t(V,{htmlFor:"ud-token",children:s("Impersonation token")}),t(B,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:C})]})]})]}),t(rt,{busy:m,runAction:T,userId:l.id,version:S}),u.accounts&&t(it,{busy:m,runAction:T,userId:l.id,version:S}),(u.twoFactor||u.passkey)&&t(ot,{busy:m,capabilities:u,runAction:T,userId:l.id,version:S}),i("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[t("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Fields")}),t("dl",{className:"flex flex-col",children:J.map(([N,z])=>i("div",{className:"flex flex-col border-t border-border py-1.5",children:[t("dt",{className:"text-xs font-semibold text-muted-foreground",children:N}),t("dd",{className:"m-0 font-mono text-xs break-words",children:ut(N,z)})]},N))})]})]})},ht=50,Et=({pageSize:u=ht}={})=>{const e=ge(),a=ke(),[l,c]=F(""),[s,d]=F(""),n=Ke(l),[r,m]=F(null),[k,S]=F(!1),{capabilities:x}=tt(),w=n.trim(),y=s.trim(),A=Ze(["lunora-auth-users",w,y,u],()=>e.listAuthUsers({filterField:y===""?void 0:"role",filterValue:y===""?void 0:y,limit:u,search:w===""?void 0:w}),{keepPreviousData:!0}),h=A.data?.rows??null,g=A.error,b=()=>{A.refetch()};Je(()=>{A.refetch()},!0);const p=r===null?null:h?.find(o=>o.id===r)??null;return i("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[i("div",{className:"flex flex-wrap items-center gap-2",children:[t(B,{"aria-label":a("Search users"),className:"w-56","data-testid":"us-search",onChange:o=>{c(o.target.value)},placeholder:a("Search by email or name…"),value:l}),t(B,{"aria-label":a("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:o=>{d(o.target.value)},placeholder:a("Filter by role"),value:s}),t(U,{"data-testid":"us-new",onClick:()=>{S(!0)},size:"sm",type:"button",children:a("New user")})]}),g!==null&&t("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:g}),h!==null&&h.length===0&&t(Qe,{description:a("Users who sign up to your app will appear here."),icon:t("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:t("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"})}),testId:"us-empty",title:a("No users.")}),h!==null&&h.length>0&&t(Fe,{className:"overflow-hidden py-0",children:t(Ie,{className:"px-0",children:i(Re,{"data-testid":"us-table",children:[t(Pe,{children:i(O,{children:[t(D,{children:a("id")}),t(D,{children:a("email")}),t(D,{children:a("name")}),t(D,{children:a("role")}),t(D,{children:a("status")}),t(D,{children:a("verified")}),t(D,{children:a("created")}),t(D,{"aria-label":a("Actions")})]})}),t(Te,{children:h.map(o=>i(O,{"data-testid":`us-row-${o.id}`,children:[t(R,{className:"font-mono text-xs",children:o.id}),t(R,{children:o.email??""}),t(R,{children:o.name??""}),t(R,{children:typeof o.role=="string"&&o.role!==""?t(M,{variant:"secondary",children:o.role}):""}),t(R,{children:o.banned===!0?t(M,{variant:"destructive",children:a("Banned")}):t(M,{variant:"success",children:a("Active")})}),t(R,{children:o.emailVerified===!0?t(M,{variant:"success",children:a("yes")}):t(M,{variant:"outline",children:a("no")})}),t(R,{className:"text-muted-foreground tabular-nums",children:Se(o.createdAt)}),t(R,{children:t(U,{"data-testid":`us-manage-${o.id}`,onClick:()=>{m(o.id)},size:"xs",type:"button",variant:"ghost",children:a("Manage")})})]},o.id))})]})})}),p!==null&&t(mt,{capabilities:x,onChanged:b,onClose:()=>{m(null)},user:p}),k&&t(nt,{onClose:()=>{S(!1)},onCreated:b})]})};export{Et as UsersPanel};
@@ -0,0 +1 @@
1
+ import{c as H}from"react/compiler-runtime";import{useLunora as K}from"@lunora/react";import{useState as h,useEffect as z}from"react";import{B as O}from"../packem_shared/button-q0UYSmrn.mjs";import{C as E,a as q}from"../packem_shared/card--2hKx4L2.mjs";import{E as P}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as R}from"../packem_shared/input-CXhxesPC.mjs";import{T as B,a as j,b,c as d,d as L,e as i}from"../packem_shared/table-D0SBiDu-.mjs";import{useT as U}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as M,b as V,h as W}from"../packem_shared/internal-CwaF9YNk.mjs";import{jsxs as n,jsx as e}from"react/jsx-runtime";const Z=10,g=x=>{const a=H(7),{label:m,value:r}=x;let l;a[0]!==m?(l=e("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:m}),a[0]=m,a[1]=l):l=a[1];const f=r??"—";let s;a[2]!==f?(s=e("span",{className:"font-mono text-sm",children:f}),a[2]=f,a[3]=s):s=a[3];let u;return a[4]!==l||a[5]!==s?(u=n("div",{className:"flex flex-col gap-0.5",children:[l,s]}),a[4]=l,a[5]=s,a[6]=u):u=a[6],u},se=({loadIndexes:x,runQuery:a}={})=>{const m=K(),r=U(),[l,f]=h(null),[s,u]=h(null),[v,C]=h(null),[N,F]=h(""),[p,y]=h(null),[S,w]=h(null),[k,I]=h(!1);z(()=>{const t={cancelled:!1};return M((async()=>{try{const o=await(x??(()=>m.listVectorIndexes()))();t.cancelled||(f(o),u(null),C(T=>T??o[0]?.name??null))}catch(o){t.cancelled||(f(null),u(V(o)))}})()),()=>{t.cancelled=!0}},[m,x]);const c=l?.find(t=>t.name===v)??null,Q=t=>{C(t.currentTarget.dataset.index??null),y(null),w(null)},$=t=>{F(t.target.value)},A=async()=>{const t=N.trim();if(!(v===null||t==="")){I(!0),w(null);try{const o=await(a??(T=>m.queryVectorIndex(T)))({name:v,text:t,topK:Z});y(o)}catch(o){y(null),w(V(o))}I(!1)}},D=()=>{M(A())};return n("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[s!==null&&e("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:s}),l!==null&&l.length===0&&e(P,{description:r("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:e("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:e("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"})}),testId:"vector-empty",title:r("No vector indexes.")}),l!==null&&l.length>0&&e(E,{className:"overflow-hidden py-0",children:e(q,{className:"px-0",children:n(B,{"data-testid":"vector-table",children:[e(j,{children:n(b,{children:[e(d,{children:r("name")}),e(d,{children:r("table")}),e(d,{children:r("dimensions")}),e(d,{children:r("metric")}),e(d,{children:r("vectors")})]})}),e(L,{children:l.map(t=>n(b,{className:t.name===v?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":t.name,"data-testid":`vector-row-${t.name}`,onClick:Q,children:[e(i,{className:"font-mono text-xs",children:t.name}),e(i,{className:"font-mono text-xs",children:t.table}),e(i,{className:"tabular-nums",children:t.dimensions??"—"}),e(i,{children:t.metric??"—"}),e(i,{className:"tabular-nums",children:t.vectorsCount??"—"})]},t.name))})]})})}),c!==null&&n("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[n("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[e(g,{label:r("field"),value:c.field}),e(g,{label:r("dimensions"),value:c.dimensions}),e(g,{label:r("metric"),value:c.metric}),e(g,{label:r("vectors"),value:c.vectorsCount})]}),c.metadata!==void 0&&c.metadata.length>0&&n("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[r("metadata"),": ",e("span",{className:"font-mono",children:c.metadata.join(", ")})]}),n("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e(R,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:$,placeholder:r("Search by similarity…"),value:N}),e(O,{"data-testid":"vector-search",disabled:k||N.trim()==="",onClick:D,children:r(k?"Searching…":"Search")})]}),S!==null&&e("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:S}),p!==null&&p.length===0&&e("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:r("No matches.")}),p!==null&&p.length>0&&e(E,{className:"mt-3 overflow-hidden py-0",children:e(q,{className:"px-0",children:n(B,{"data-testid":"vector-matches",children:[e(j,{children:n(b,{children:[e(d,{children:r("id")}),e(d,{children:r("score")}),e(d,{children:r("metadata")})]})}),e(L,{children:p.map(t=>n(b,{"data-testid":`vector-match-${t.id}`,children:[e(i,{className:"font-mono text-xs",children:t.id}),e(i,{className:"tabular-nums",children:t.score.toFixed(4)}),e(i,{className:"max-w-md truncate font-mono text-xs",children:t.metadata===void 0?"—":W(t.metadata)})]},t.id))})]})})})]})]})};export{se as VectorBrowser};
@@ -0,0 +1 @@
1
+ import{useLunora as X}from"@lunora/react";import{useState as m,useEffect as te}from"react";import{B as E}from"../packem_shared/button-q0UYSmrn.mjs";import{C as P,a as U}from"../packem_shared/card--2hKx4L2.mjs";import{E as H}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as re}from"../packem_shared/input-CXhxesPC.mjs";import{T as j,a as z,b as x,c as i,d as J,e as d}from"../packem_shared/table-D0SBiDu-.mjs";import{T as se}from"../packem_shared/textarea--40GKAyz.mjs";import{u as ae}from"../packem_shared/use-admin-query-Cbj2GuHu.mjs";import{useT as Y}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as M}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.mjs";import{f as W,b as A,d as V,c as Z}from"../packem_shared/internal-CwaF9YNk.mjs";import{jsxs as n,jsx as e}from"react/jsx-runtime";const ne=["queued","running","paused","waiting","complete","errored","terminated"],oe=["pause","resume","terminate"],le="WORKFLOWS_NOT_CONFIGURED",ie=o=>typeof o=="object"&&o!==null&&o.code===le,de=o=>{const s=o.error??o.output;if(s===void 0)return"—";try{return JSON.stringify(s)}catch{return"(unserializable)"}},ce=({loadDetail:o,loadInstances:s,readOnly:N,runAction:R,workflowName:w})=>{const O=X(),a=Y(),[h,g]=m(null),[k,I]=m(null),[v,_]=m(""),[b,f]=m(null),[$,S]=m(!1),[F,D]=m(null),p=o??(r=>O.getWorkflowInstance(r)),C=N?void 0:R??(s===void 0?r=>O.setWorkflowInstanceStatus(r):void 0),L=async()=>{f(null),S(!1);const r=v===""?void 0:v;try{if(s===void 0){const l=await O.listWorkflowInstances({name:w,status:r});if(l.configured===!1){g(null),S(!0);return}g(l.instances);return}g(await s({name:w,status:r}))}catch(l){g(null),ie(l)?S(!0):f(A(l))}};te(()=>{I(null),W(L())},[w,v]);const K=async r=>{f(null);try{I(await p({id:r,name:w}))}catch(l){f(A(l))}},q=async(r,l)=>{if(C!==void 0){D(r),f(null);try{await C({action:l,id:r,name:w}),await L()}catch(G){f(A(G))}D(null)}};return n("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[n("div",{className:"flex items-center justify-between gap-2",children:[e("h3",{className:"text-sm font-medium",children:a("Instance history")}),n("select",{"aria-label":a("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:r=>{_(r.target.value)},value:v,children:[e("option",{value:"",children:a("All statuses")}),ne.map(r=>e("option",{value:r,children:r},r))]})]}),b!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:b}),$&&e(H,{description:a("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:a("Workflow inspection not configured")}),!$&&h!==null&&h.length===0&&e(H,{description:a("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:a("No instances")}),h!==null&&h.length>0&&e(P,{className:"overflow-hidden py-0",children:e(U,{className:"px-0",children:n(j,{"data-testid":"workflow-instances-table",children:[e(z,{children:n(x,{children:[e(i,{children:a("Instance id")}),e(i,{children:a("Status")}),e(i,{children:a("Created")}),e(i,{children:a("Ended")}),e(i,{"aria-label":a("Actions")})]})}),e(J,{children:h.map(r=>n(x,{"data-testid":`workflow-instance-${r.id}`,children:[e(d,{className:"font-mono text-xs",children:r.id}),e(d,{className:"font-mono text-xs",children:r.status}),e(d,{className:"text-muted-foreground tabular-nums",children:r.createdOn??"—"}),e(d,{className:"text-muted-foreground tabular-nums",children:r.endedOn??"—"}),e(d,{className:"text-right",children:n("div",{className:"flex justify-end gap-1.5",children:[e(E,{"data-testid":`workflow-instance-steps-${r.id}`,onClick:()=>{W(K(r.id))},size:"sm",type:"button",variant:"outline",children:a("Steps")}),C!==void 0&&oe.map(l=>e(E,{"data-testid":`workflow-instance-${l}-${r.id}`,disabled:F===r.id,onClick:()=>{W(q(r.id,l))},size:"sm",type:"button",variant:"ghost",children:a(l)},l))]})})]},r.id))})]})})}),k!==null&&e(P,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:n(U,{className:"flex flex-col gap-2 px-4 py-3",children:[n("div",{className:"flex items-center justify-between",children:[n("span",{className:"font-mono text-xs",children:[a("Steps")," · ",k.id]}),e(E,{"data-testid":"workflow-instance-detail-close",onClick:()=>{I(null)},size:"xs",type:"button",variant:"ghost",children:a("Close")})]}),k.steps.length===0?e("p",{className:"text-xs text-muted-foreground",children:a("This instance has no recorded steps yet.")}):n(j,{"data-testid":"workflow-instance-steps",children:[e(z,{children:n(x,{children:[e(i,{children:a("Step")}),e(i,{children:a("Type")}),e(i,{children:a("Attempts")}),e(i,{children:a("Started")}),e(i,{children:a("Output")})]})}),e(J,{children:k.steps.map((r,l)=>n(x,{"data-testid":`workflow-step-${String(l)}`,children:[e(d,{className:"font-mono text-xs",children:r.name}),e(d,{className:"text-xs text-muted-foreground",children:r.type??"—"}),e(d,{className:"tabular-nums",children:r.attempts??"—"}),e(d,{className:"text-muted-foreground tabular-nums",children:r.start??"—"}),e(d,{className:"font-mono text-xs text-muted-foreground",children:de(r)})]},`${r.name}:${String(l)}`))})]})]})})]})},me=Z(M.createWorkflowInstance),ue=Z(M.getWorkflowInstanceStatus),fe=o=>{if(o.error)return`${o.error.name}: ${o.error.message}`;if(o.output===void 0)return"—";try{return JSON.stringify(o.output)}catch{return"(unserializable)"}},he=(o,s)=>o.some(N=>N.exportName===s)?s:o[0]?.exportName??"",Te=()=>{const o=X(),s=Y(),{data:N,error:R}=ae(M.listWorkflows,{}),[w,O]=m(""),[a,h]=m(""),[g,k]=m(""),[I,v]=m(!1),[_,b]=m(null),[f,$]=m([]),[S,F]=m(null),D=N!==void 0,p=Array.isArray(N?.workflows)?[...N.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],T=he(p,w),B=p.find(t=>t.exportName===T),C=t=>{$(u=>{const c=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...c]})},L=async()=>{const t=T;if(t==="")return;let u;const c=g.trim();if(c!=="")try{u=JSON.parse(c)}catch{b(s("Params must be valid JSON"));return}v(!0),b(null);try{const y=a.trim(),Q=await o.query(me,{exportName:t,id:y===""?void 0:y,params:u},V(""));C({exportName:t,id:Q.id,status:Q.status}),h("")}catch(y){b(A(y))}v(!1)},K=()=>{W(L())},q=async(t,u)=>{F(u);try{const c=await o.query(ue,{exportName:t,id:u},V(""));C({error:c.error,exportName:t,id:c.id,output:c.output,status:c.status})}catch(c){b(A(c))}F(null)},r=t=>{O(t.target.value)},l=t=>{h(t.target.value)},G=t=>{k(t.target.value)},ee=t=>{const{export:u,id:c}=t.currentTarget.dataset;u!==void 0&&c!==void 0&&W(q(u,c))};return n("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[R!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:R}),e("p",{className:"text-sm text-muted-foreground",children:s("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),D&&p.length===0?e(H,{description:s("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:s("No workflows defined")}):e(P,{className:"overflow-hidden py-0",children:e(U,{className:"px-0",children:n(j,{"data-testid":"workflows-table",children:[e(z,{children:n(x,{children:[e(i,{children:s("Export")}),e(i,{children:s("Name")}),e(i,{children:s("Class")}),e(i,{children:s("Binding")})]})}),e(J,{children:p.map(t=>n(x,{"data-testid":`workflows-row-${t.exportName}`,children:[e(d,{className:"font-mono text-xs",children:t.exportName}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.name}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.className}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),p.length>0&&n("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[e("h3",{className:"text-sm font-medium",children:s("Start instance")}),_!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:_}),n("div",{className:"flex flex-wrap items-center gap-2",children:[e("select",{"aria-label":s("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:r,value:T,children:p.map(t=>e("option",{value:t.exportName,children:t.exportName},t.exportName))}),e(re,{"aria-label":s("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:l,placeholder:s("Instance id (optional)"),value:a}),e(E,{"data-testid":"workflows-start-button",disabled:I||T==="",onClick:K,children:s(I?"Starting…":"Start instance")})]}),e(se,{"aria-label":s("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:G,placeholder:s("Params (JSON, optional)"),value:g})]}),f.length>0&&n("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[e("h3",{className:"text-sm font-medium",children:s("Instances")}),e(P,{className:"overflow-hidden py-0",children:e(U,{className:"px-0",children:n(j,{"data-testid":"workflows-instances-table",children:[e(z,{children:n(x,{children:[e(i,{children:s("Workflow")}),e(i,{children:s("Instance id")}),e(i,{children:s("Status")}),e(i,{children:s("Output")}),e(i,{})]})}),e(J,{children:f.map(t=>n(x,{"data-testid":`workflows-instance-${t.id}`,children:[e(d,{className:"font-mono text-xs",children:t.exportName}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.id}),e(d,{className:"font-mono text-xs",children:t.status}),e(d,{className:"font-mono text-xs text-muted-foreground",children:fe(t)}),e(d,{children:e(E,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:S===t.id,onClick:ee,size:"xs",variant:"outline",children:S===t.id?s("Refreshing…"):s("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),B!==void 0&&e(ce,{workflowName:B.name})]})};export{Te as default};
@@ -1,2 +1,2 @@
1
- import{c as F}from"react/compiler-runtime";import{useLunora as V}from"@lunora/react";import{useState as z,useEffect as W}from"react";import{B as H}from"./button-BOPLD1un.js";import{E as K}from"./empty-state-B939z6K2.js";import{useT as M}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as X}from"./ADMIN_FUNCTIONS-B6z7VLYt.js";import{c as Z,d as ee,g as te}from"./internal-CwaF9YNk.js";import{jsxs as R,jsx as u}from"react/jsx-runtime";const le=Z(X.listTables),ne=["react","client","cli"],ae={action:"action",mutation:"mutation",query:"query"},Q=a=>{const e=a.indexOf(":");return e===-1?{file:"",fn:a}:{file:a.slice(0,e),fn:a.slice(e+1)}},ie=({file:a,fn:e,kind:i})=>`await client.${ae[i]}(api.${a}.${e}, { /* args */ });`,se=a=>{const e=`api.${a.file}.${a.fn}`;switch(a.kind){case"action":return`const { call: ${a.fn} } = useAction(${e});`;case"mutation":return`const ${a.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},oe=({file:a,fn:e})=>`lunora run ${a}:${e} --args '{ }'`,ce=a=>["// Read rows",`const rows = await ctx.db.query("${a}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${a}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${a}">;`,`type RowId = Id<"${a}">;`].join(`
1
+ import{c as F}from"react/compiler-runtime";import{useLunora as V}from"@lunora/react";import{useState as z,useEffect as W}from"react";import{B as H}from"./button-q0UYSmrn.mjs";import{E as K}from"./empty-state-D7jEML_T.mjs";import{useT as M}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as X}from"./ADMIN_FUNCTIONS-B6z7VLYt.mjs";import{c as Z,d as ee,g as te}from"./internal-CwaF9YNk.mjs";import{jsxs as R,jsx as u}from"react/jsx-runtime";const le=Z(X.listTables),ne=["react","client","cli"],ae={action:"action",mutation:"mutation",query:"query"},Q=a=>{const e=a.indexOf(":");return e===-1?{file:"",fn:a}:{file:a.slice(0,e),fn:a.slice(e+1)}},ie=({file:a,fn:e,kind:i})=>`await client.${ae[i]}(api.${a}.${e}, { /* args */ });`,se=a=>{const e=`api.${a.file}.${a.fn}`;switch(a.kind){case"action":return`const { call: ${a.fn} } = useAction(${e});`;case"mutation":return`const ${a.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},oe=({file:a,fn:e})=>`lunora run ${a}:${e} --args '{ }'`,ce=a=>["// Read rows",`const rows = await ctx.db.query("${a}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${a}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${a}">;`,`type RowId = Id<"${a}">;`].join(`
2
2
  `),re=(a,e)=>{switch(a){case"cli":return oe(e);case"client":return ie(e);default:return se(e)}},U=a=>{const e=F(19),{code:i,label:s,testId:l}=a,n=M();let c;e[0]!==i?(c=()=>{te(i)},e[0]=i,e[1]=c):c=e[1];const m=c;let t;e[2]!==s?(t=u("span",{className:"text-xs font-medium text-muted-foreground",children:s}),e[2]=s,e[3]=t):t=e[3];const d=`${l}-copy`;let o;e[4]!==n?(o=n("Copy"),e[4]=n,e[5]=o):o=e[5];let f;e[6]!==m||e[7]!==d||e[8]!==o?(f=u(H,{"data-testid":d,onClick:m,size:"xs",type:"button",variant:"ghost",children:o}),e[6]=m,e[7]=d,e[8]=o,e[9]=f):f=e[9];let p;e[10]!==t||e[11]!==f?(p=R("div",{className:"flex items-center justify-between gap-2",children:[t,f]}),e[10]=t,e[11]=f,e[12]=p):p=e[12];let r;e[13]!==i||e[14]!==l?(r=u("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":l,children:i}),e[13]=i,e[14]=l,e[15]=r):r=e[15];let b;return e[16]!==p||e[17]!==r?(b=R("div",{className:"flex flex-col gap-1.5",children:[p,r]}),e[16]=p,e[17]=r,e[18]=b):b=e[18],b},de=a=>{const e=F(46),{file:i,fn:s,kind:l}=a,n=M(),[c,m]=z("react");let t,d,o;if(e[0]!==i||e[1]!==s||e[2]!==l||e[3]!==n||e[4]!==c){const x={file:i,fn:s,kind:l};let k;e[8]!==n?(k=n("CLI"),e[8]=n,e[9]=k):k=e[9];let w;e[10]!==n?(w=n("Client"),e[10]=n,e[11]=w):w=e[11];let I;e[12]!==n?(I=n("React"),e[12]=n,e[13]=I):I=e[13];let C;e[14]!==k||e[15]!==w||e[16]!==I?(C={cli:k,client:w,react:I},e[14]=k,e[15]=w,e[16]=I,e[17]=C):C=e[17],o=C;let B;e[18]===Symbol.for("react.memo_cache_sentinel")?(B=D=>{m(D.currentTarget.dataset.tab)},e[18]=B):B=e[18],t=B,d=re(c,x),e[0]=i,e[1]=s,e[2]=l,e[3]=n,e[4]=c,e[5]=t,e[6]=d,e[7]=o}else t=e[5],d=e[6],o=e[7];const f=d,p=`api.${i}.${s}`;let r;e[19]!==p?(r=u("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-fn-title",children:p}),e[19]=p,e[20]=r):r=e[20];let b;e[21]!==l||e[22]!==n?(b=n("Call this {kind} from your app.",{kind:l}),e[21]=l,e[22]=n,e[23]=b):b=e[23];let h;e[24]!==b?(h=u("p",{className:"text-xs text-muted-foreground",children:b}),e[24]=b,e[25]=h):h=e[25];let v;e[26]!==r||e[27]!==h?(v=R("div",{children:[r,h]}),e[26]=r,e[27]=h,e[28]=v):v=e[28];let $;e[29]!==n?($=n("Snippet flavour"),e[29]=n,e[30]=$):$=e[30];let y;e[31]!==t||e[32]!==c||e[33]!==o?(y=ne.map(x=>u(H,{"aria-selected":c===x,"data-tab":x,"data-testid":`api-tab-${x}`,onClick:t,role:"tab",size:"xs",type:"button",variant:c===x?"default":"outline",children:o[x]},x)),e[31]=t,e[32]=c,e[33]=o,e[34]=y):y=e[34];let N;e[35]!==$||e[36]!==y?(N=u("div",{"aria-label":$,className:"flex gap-1.5","data-testid":"api-tabs",role:"tablist",children:y}),e[35]=$,e[36]=y,e[37]=N):N=e[37];const _=o[c],A=`api-snippet-${c}`;let S;e[38]!==f||e[39]!==_||e[40]!==A?(S=u(U,{code:f,label:_,testId:A}),e[38]=f,e[39]=_,e[40]=A,e[41]=S):S=e[41];let T;return e[42]!==S||e[43]!==v||e[44]!==N?(T=R("div",{className:"flex flex-col gap-3","data-testid":"api-fn-doc",children:[v,N,S]}),e[42]=S,e[43]=v,e[44]=N,e[45]=T):T=e[45],T},fe=a=>{const e=F(19),{name:i}=a,s=M();let l;e[0]!==i?(l=ce(i),e[0]=i,e[1]=l):l=e[1];const n=l;let c;e[2]!==i?(c=u("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-table-title",children:i}),e[2]=i,e[3]=c):c=e[3];let m;e[4]!==s?(m=s("Read and write this table through the typed data model."),e[4]=s,e[5]=m):m=e[5];let t;e[6]!==m?(t=u("p",{className:"text-xs text-muted-foreground",children:m}),e[6]=m,e[7]=t):t=e[7];let d;e[8]!==c||e[9]!==t?(d=R("div",{children:[c,t]}),e[8]=c,e[9]=t,e[10]=d):d=e[10];let o;e[11]!==s?(o=s("Data model"),e[11]=s,e[12]=o):o=e[12];let f;e[13]!==n||e[14]!==o?(f=u(U,{code:n,label:o,testId:"api-snippet-table"}),e[13]=n,e[14]=o,e[15]=f):f=e[15];let p;return e[16]!==d||e[17]!==f?(p=R("div",{className:"flex flex-col gap-3","data-testid":"api-table-doc",children:[d,f]}),e[16]=d,e[17]=f,e[18]=p):p=e[18],p},G=a=>{const e=F(8),{active:i,label:s,onSelect:l,testId:n,value:c}=a;let m;e[0]!==l||e[1]!==c?(m=()=>{l(c)},e[0]=l,e[1]=c,e[2]=m):m=e[2];const t=m,d=i?"page":void 0;let o;return e[3]!==s||e[4]!==t||e[5]!==d||e[6]!==n?(o=u("button",{"aria-current":d,className:"w-full truncate rounded-md px-2 py-1 text-start font-mono text-xs text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-testid":n,onClick:t,type:"button",children:s}),e[3]=s,e[4]=t,e[5]=d,e[6]=n,e[7]=o):o=e[7],o},pe=a=>{const e=new Map;for(const i of a){const{file:s,fn:l}=Q(i.path),n=e.get(s)??[];n.push({fn:l,kind:i.kind,path:i.path}),e.set(s,n)}return[...e.entries()].map(([i,s])=>({file:i,items:s.toSorted((l,n)=>l.fn.localeCompare(n.fn))})).toSorted((i,s)=>i.file.localeCompare(s.file))},ke=a=>{const e=F(58),{functions:i,initialShardKey:s}=a,l=M(),n=V(),[c,m]=z(null),[t,d]=z(null);let o,f;e[0]!==n||e[1]!==s?(o=()=>{let D=!1;return n.query(le,{},ee(s??"")).then(L=>(D||m(L),L)).catch(()=>{D||m([])}),()=>{D=!0}},f=[n,s],e[0]=n,e[1]=s,e[2]=o,e[3]=f):(o=e[2],f=e[3]),W(o,f);let p,r,b,h,v,$,y,N,_,A;if(e[4]!==i||e[5]!==t||e[6]!==l||e[7]!==c){const D=i??[],L=pe(D),O=(c??[]).map(ue).toSorted(me);let P;e[18]===Symbol.for("react.memo_cache_sentinel")?(P=g=>{d({kind:"fn",path:g})},e[18]=P):P=e[18];const Y=P;let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=g=>{d({kind:"table",name:g})},e[19]=j):j=e[19];const J=j;r=t?.kind==="fn"?D.find(g=>g.path===t.path):void 0,p=D.length>0||O.length>0,b=r===void 0?void 0:Q(r.path),_="grid min-h-0 gap-6 md:grid-cols-[16rem_minmax(0,1fr)]",A="lunora-api-docs",e[20]!==l?(h=l("API resources"),e[20]=l,e[21]=h):h=e[21],v="flex flex-col gap-4 overflow-y-auto",$="api-rail";let q;e[22]!==t||e[23]!==l?(q=g=>R("div",{className:"flex flex-col gap-1",children:[u("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:g.file||l("(root)")}),g.items.map(E=>u(G,{active:t?.kind==="fn"&&t.path===E.path,label:E.fn,onSelect:Y,testId:`api-rail-fn-${E.path}`,value:E.path},E.path))]},g.file),e[22]=t,e[23]=l,e[24]=q):q=e[24],y=L.map(q),N=O.length>0&&R("div",{className:"flex flex-col gap-1",children:[u("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l("Tables")}),O.map(g=>u(G,{active:t?.kind==="table"&&t.name===g,label:g,onSelect:J,testId:`api-rail-table-${g}`,value:g},g))]}),e[4]=i,e[5]=t,e[6]=l,e[7]=c,e[8]=p,e[9]=r,e[10]=b,e[11]=h,e[12]=v,e[13]=$,e[14]=y,e[15]=N,e[16]=_,e[17]=A}else p=e[8],r=e[9],b=e[10],h=e[11],v=e[12],$=e[13],y=e[14],N=e[15],_=e[16],A=e[17];let S;e[25]!==p||e[26]!==l?(S=!p&&u("p",{className:"px-2 text-xs text-muted-foreground","data-testid":"api-rail-empty",children:l("No functions or tables to document yet.")}),e[25]=p,e[26]=l,e[27]=S):S=e[27];let T;e[28]!==S||e[29]!==h||e[30]!==v||e[31]!==$||e[32]!==y||e[33]!==N?(T=R("nav",{"aria-label":h,className:v,"data-testid":$,children:[y,N,S]}),e[28]=S,e[29]=h,e[30]=v,e[31]=$,e[32]=y,e[33]=N,e[34]=T):T=e[34];let x;e[35]!==t||e[36]!==l?(x=t===null&&u(K,{description:l("Select a function or table to see how to call it from your app."),testId:"api-empty",title:l("API usage snippets")}),e[35]=t,e[36]=l,e[37]=x):x=e[37];let k;e[38]!==t?.kind||e[39]!==r||e[40]!==b?(k=t?.kind==="fn"&&r!==void 0&&b!==void 0&&u(de,{file:b.file,fn:b.fn,kind:r.kind},r.path),e[38]=t?.kind,e[39]=r,e[40]=b,e[41]=k):k=e[41];let w;e[42]!==t?.kind||e[43]!==r||e[44]!==l?(w=t?.kind==="fn"&&r===void 0&&u(K,{testId:"api-empty",title:l("API usage snippets")}),e[42]=t?.kind,e[43]=r,e[44]=l,e[45]=w):w=e[45];let I;e[46]!==t?(I=t?.kind==="table"&&u(fe,{name:t.name}),e[46]=t,e[47]=I):I=e[47];let C;e[48]!==x||e[49]!==k||e[50]!==w||e[51]!==I?(C=R("div",{className:"min-w-0",children:[x,k,w,I]}),e[48]=x,e[49]=k,e[50]=w,e[51]=I,e[52]=C):C=e[52];let B;return e[53]!==T||e[54]!==C||e[55]!==_||e[56]!==A?(B=R("div",{className:_,"data-testid":A,children:[T,C]}),e[53]=T,e[54]=C,e[55]=_,e[56]=A,e[57]=B):B=e[57],B};function ue(a){return a.name}function me(a,e){return a.localeCompare(e)}export{oe as buildCliSnippet,ie as buildClientSnippet,se as buildReactSnippet,ce as buildTableSnippet,ke as default,Q as splitPath};
@@ -0,0 +1 @@
1
+ import{c as k}from"react/compiler-runtime";import{useLunora as v}from"@lunora/react";import{E as h}from"./empty-state-D7jEML_T.mjs";import{S as g}from"./skeleton-DX1gfixl.mjs";import{u as O,R as S}from"./reference-view-CZxBZSRo.mjs";import{useT as A}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{jsxs as I,jsx as m}from"react/jsx-runtime";const P=["get","post","put","patch","delete","head","options","trace"],y=r=>r?.content?.["application/json"]?.schema,j=(r,e)=>Object.entries(r.responses??{}).map(([i,s])=>{const c=s.$ref?.replace("#/components/responses/",""),n=c===void 0?s:e.components?.responses?.[c]??s;return{description:n.description,schema:y(n),status:i}}),b=(r,e,i,s,c)=>{const n=y(s.requestBody),l=n?.properties?.functionPath?.const,t=typeof l=="string"?l:void 0,f=t===void 0?n:n?.properties?.args,a=s.operationId??`${i} ${e}`;return{argsSchema:f,description:s.description,functionPath:t,httpPath:e,key:r,kind:s["x-lunora-function-kind"],method:i.toUpperCase(),operationId:a,requestSchema:n,responses:j(s,c),summary:s.summary??a,tags:s.tags??[],title:s.summary??a}},x=r=>{const e=[];for(const[i,s]of Object.entries(r.paths??{})){const c=i.includes("#")?i.slice(0,i.indexOf("#")):i;for(const n of P){const l=s[n];l!==void 0&&e.push(b(i,c,n,l,r))}}return e},w=r=>{const e=r??{},i=x(e),s=new Map((e.tags??[]).map(t=>[t.name,t.description])),c=new Set,n=[],l=t=>{if(c.has(t))return;c.add(t);const f=i.filter(a=>(a.tags[0]??"")===t);f.length>0&&n.push({description:s.get(t),name:t,operations:f})};for(const t of e.tags??[])l(t.name);for(const t of i)l(t.tags[0]??"");return{groups:n,operationByKey:new Map(i.map(t=>[t.key,t])),server:e.servers?.[0]?.url,title:e.info?.title??"API reference",version:e.info?.version}},R=r=>{const{paths:e}=r;return e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0},T=r=>{const e=r;return R(e)?{kind:"empty"}:{kind:"ready",spec:e}},B=r=>{const e=k(23),{spec:i}=r,s=A(),c=v();let n;e[0]!==c?(n=()=>c.fetchOpenApi(),e[0]=c,e[1]=n):n=e[1];const t=O(i,n,T);let f;e[2]!==t.kind||e[3]!==t.spec?(f=t.kind==="ready"?w(t.spec):void 0,e[2]=t.kind,e[3]=t.spec,e[4]=f):f=e[4];const a=f;if(t.kind==="loading"){let o;return e[5]===Symbol.for("react.memo_cache_sentinel")?(o=I("div",{className:"flex flex-col gap-4","data-testid":"api-reference-loading",children:[m(g,{className:"h-8 w-48"}),m(g,{className:"h-64 w-full"})]}),e[5]=o):o=e[5],o}if(t.kind==="error"){let o;e[6]!==t.message||e[7]!==s?(o=s("Couldn't load the OpenAPI spec: {message}",{message:t.message}),e[6]=t.message,e[7]=s,e[8]=o):o=e[8];let p;e[9]!==s?(p=s("API reference unavailable"),e[9]=s,e[10]=p):p=e[10];let d;return e[11]!==o||e[12]!==p?(d=m(h,{description:o,testId:"api-reference-error",title:p}),e[11]=o,e[12]=p,e[13]=d):d=e[13],d}if(t.kind==="empty"||a===void 0){let o;e[14]!==s?(o=s("Run `lunora codegen` and wire `_generated/openapi.json` to the worker to render the API reference here."),e[14]=s,e[15]=o):o=e[15];let p;e[16]!==s?(p=s("No OpenAPI spec configured"),e[16]=s,e[17]=p):p=e[17];let d;return e[18]!==o||e[19]!==p?(d=m(h,{description:o,testId:"api-reference-empty",title:p}),e[18]=o,e[19]=p,e[20]=d):d=e[20],d}let u;return e[21]!==a?(u=m(S,{model:a}),e[21]=a,e[22]=u):u=e[22],u};export{B as default};
@@ -0,0 +1 @@
1
+ import{c as U}from"react/compiler-runtime";import{Dialog as D}from"@base-ui/react/dialog";import{useNavigate as H}from"@tanstack/react-router";import{useState as B,useRef as Q,useEffect as V}from"react";import{useT as W}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as X}from"./internal-CwaF9YNk.mjs";import{u as G}from"./shortcuts-B9gDaXmw.mjs";import{c as J}from"./utils-bhneXptQ.mjs";import{jsx as r,jsxs as A}from"react/jsx-runtime";const F="lunora:command-palette",ce=()=>{"window"in globalThis&&globalThis.dispatchEvent(new Event(F))},Y=v=>{const e=U(18),{active:f,index:o,item:n,onActivate:h,onSelect:b}=v;let g;e[0]!==n||e[1]!==b?(g=()=>{b(n)},e[0]=n,e[1]=b,e[2]=g):g=e[2];const c=g;let x;e[3]!==o||e[4]!==h?(x=()=>{h(o)},e[3]=o,e[4]=h,e[5]=x):x=e[5];const d=x,m=f?"bg-accent text-accent-foreground":"text-foreground";let u;e[6]!==m?(u=J("flex w-full items-center justify-between gap-3 rounded-md px-3 py-2 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground",m),e[6]=m,e[7]=u):u=e[7];let s;e[8]!==n.label?(s=r("span",{children:n.label}),e[8]=n.label,e[9]=s):s=e[9];let i;e[10]!==n.group?(i=r("span",{className:"text-xs text-muted-foreground",children:n.group}),e[10]=n.group,e[11]=i):i=e[11];let p;return e[12]!==c||e[13]!==d||e[14]!==u||e[15]!==s||e[16]!==i?(p=r("li",{children:A("button",{className:u,onClick:c,onMouseEnter:d,type:"button",children:[s,i]})}),e[12]=c,e[13]=d,e[14]=u,e[15]=s,e[16]=i,e[17]=p):p=e[17],p},Z=(v,e)=>{const f=e.trim().toLowerCase();return f===""?v:v.filter(o=>o.label.toLowerCase().includes(f)||o.group.toLowerCase().includes(f))},de=v=>{const e=U(40),{items:f}=v,o=W(),n=H(),{palette:h}=G(),[b,g]=B(!1),[c,x]=B(""),[d,m]=B(0),u=Q(null);let s,i;e[0]!==h?(s=()=>{const t=S=>{if(!(S.metaKey||S.ctrlKey)||S.key.toLowerCase()!==h)return;const{target:_}=S;_ instanceof HTMLElement&&(_.isContentEditable||["INPUT","SELECT","TEXTAREA"].includes(_.tagName))||(S.preventDefault(),g(!0))},l=()=>{g(!0)};return globalThis.addEventListener("keydown",t),globalThis.addEventListener(F,l),()=>{globalThis.removeEventListener("keydown",t),globalThis.removeEventListener(F,l)}},i=[h],e[0]=h,e[1]=s,e[2]=i):(s=e[1],i=e[2]),V(s,i);let p;e[3]!==f||e[4]!==c?(p=Z(f,c),e[3]=f,e[4]=c,e[5]=p):p=e[5];const a=p;let I;e[6]===Symbol.for("react.memo_cache_sentinel")?(I=t=>{g(t),t||(x(""),m(0))},e[6]=I):I=e[6];const M=I;let K;e[7]!==n?(K=t=>{if(M(!1),t.run!==void 0){t.run();return}t.to!==void 0&&X(n({to:t.to}))},e[7]=n,e[8]=K):K=e[8];const w=K;let P;e[9]===Symbol.for("react.memo_cache_sentinel")?(P=t=>{x(t.target.value),m(0)},e[9]=P):P=e[9];const q=P;let z;e[10]!==d||e[11]!==a||e[12]!==w?(z=t=>{e:switch(t.key){case"ArrowDown":{t.preventDefault(),m(l=>a.length===0?0:(l+1)%a.length);break e}case"ArrowUp":{t.preventDefault(),m(l=>a.length===0?0:(l-1+a.length)%a.length);break e}case"Enter":{t.preventDefault();const l=a[d];l!==void 0&&w(l);break e}}},e[10]=d,e[11]=a,e[12]=w,e[13]=z):z=e[13];const j=z;let R;e[14]===Symbol.for("react.memo_cache_sentinel")?(R=r(D.Backdrop,{className:"fixed inset-0 z-50 bg-black/40 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0"}),e[14]=R):R=e[14];let y;e[15]!==o?(y=o("Command palette"),e[15]=o,e[16]=y):y=e[16];let E;e[17]!==y?(E=r(D.Title,{className:"sr-only",children:y}),e[17]=y,e[18]=E):E=e[18];let O;e[19]===Symbol.for("react.memo_cache_sentinel")?(O=A("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.8,viewBox:"0 0 24 24",children:[r("circle",{cx:"11",cy:"11",r:"7"}),r("path",{d:"m21 21-4.3-4.3",strokeLinecap:"round"})]}),e[19]=O):O=e[19];let N;e[20]!==o?(N=o("Search…"),e[20]=o,e[21]=N):N=e[21];let C;e[22]!==j||e[23]!==c||e[24]!==N?(C=A("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[O,r("input",{className:"h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground","data-testid":"dash-command-input",onChange:q,onKeyDown:j,placeholder:N,ref:u,type:"text",value:c})]}),e[22]=j,e[23]=c,e[24]=N,e[25]=C):C=e[25];let T;e[26]!==d||e[27]!==a||e[28]!==w||e[29]!==o?(T=a.length===0?r("li",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:o("No results.")}):a.map((t,l)=>r(Y,{active:l===d,index:l,item:t,onActivate:m,onSelect:w},t.to??`${t.group}:${t.label}`)),e[26]=d,e[27]=a,e[28]=w,e[29]=o,e[30]=T):T=e[30];let k;e[31]!==T?(k=r("ul",{className:"max-h-80 overflow-y-auto p-1.5","data-testid":"dash-command-list",children:T}),e[31]=T,e[32]=k):k=e[32];let L;e[33]!==E||e[34]!==C||e[35]!==k?(L=A(D.Portal,{children:[R,A(D.Popup,{className:"fixed start-1/2 top-24 z-50 w-[36rem] max-w-[90vw] -translate-x-1/2 overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-lg outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95","data-testid":"dash-command-palette",initialFocus:u,children:[E,C,k]})]}),e[33]=E,e[34]=C,e[35]=k,e[36]=L):L=e[36];let $;return e[37]!==b||e[38]!==L?($=r(D.Root,{onOpenChange:M,open:b,children:L}),e[37]=b,e[38]=L,e[39]=$):$=e[39],$};export{de as CommandPalette,ce as openCommandPalette};
@@ -0,0 +1 @@
1
+ import{useState as u}from"react";import{useT as C}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{B as o}from"./button-q0UYSmrn.mjs";import{jsx as e,jsxs as d}from"react/jsx-runtime";const k=({children:s,confirmLabel:a,disabled:i=!1,onConfirm:c,testId:t})=>{const r=C(),[m,n]=u(!1),f=()=>{n(!0)},l=()=>{n(!1)},p=()=>{n(!1),c()};return m?d("span",{className:"inline-flex items-center gap-1","data-testid":`${t}-prompt`,role:"group",children:[e(o,{"data-testid":`${t}-confirm`,disabled:i,onClick:p,size:"sm",type:"button",variant:"destructive",children:a??r("Confirm")}),e(o,{"data-testid":`${t}-cancel`,onClick:l,size:"sm",type:"button",variant:"ghost",children:r("Cancel")})]}):e(o,{"data-testid":t,disabled:i,onClick:f,size:"sm",type:"button",variant:"outline",children:s})};export{k as ConfirmButton};
@@ -0,0 +1 @@
1
+ import{c as r}from"react/compiler-runtime";import{useConnectionStatus as f}from"@lunora/react";import{useT as d}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{c as u}from"./utils-bhneXptQ.mjs";import{jsx as m,jsxs as g}from"react/jsx-runtime";const p={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive"},T=()=>{const e=r(16),n=d(),o=f();let s;e:switch(o){case"connected":{let t;e[0]!==n?(t=n("Connected"),e[0]=n,e[1]=t):t=e[1],s=t;break e}case"connecting":{let t;e[2]!==n?(t=n("Connecting…"),e[2]=n,e[3]=t):t=e[3],s=t;break e}case"idle":{let t;e[4]!==n?(t=n("Idle"),e[4]=n,e[5]=t):t=e[5],s=t;break e}case"offline":{let t;e[6]!==n?(t=n("Offline"),e[6]=n,e[7]=t):t=e[7],s=t;break e}default:s=o}const l=p[o];let i;e[8]!==l?(i=u("size-2 rounded-full",l),e[8]=l,e[9]=i):i=e[9];let c;e[10]!==i?(c=m("span",{"aria-hidden":"true",className:i}),e[10]=i,e[11]=c):c=e[11];let a;return e[12]!==o||e[13]!==c||e[14]!==s?(a=g("span",{"aria-live":"polite",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","data-status":o,"data-testid":"dash-connection",role:"status",children:[c,s]}),e[12]=o,e[13]=c,e[14]=s,e[15]=a):a=e[15],a};export{T as default};
@@ -0,0 +1 @@
1
+ const g={highErrorRate:.05,highWriteContention:.1,lowCacheHitRate:.5,minCacheSamples:10,minConflictCalls:5,minErrorCalls:5,slowFunctionMs:1e3,storageCriticalBytes:5368709120,storageWarnBytes:1073741824},l={error:0,info:2,warning:1},h=(e,r)=>{const i=[];if(e.maxDurationMs>=r.slowFunctionMs){const n=e.scannedTables??[];n.length>0?i.push({fn:e.path,kind:"missing-index",severity:"warning",tables:n.map(s=>s.table),value:e.maxDurationMs}):i.push({fn:e.path,kind:"slow-function",severity:"info",value:e.maxDurationMs})}e.calls>=r.minErrorCalls&&e.errors/e.calls>=r.highErrorRate&&i.push({fn:e.path,kind:"high-error-rate",message:e.lastErrorMessage??void 0,severity:"error",value:e.errors/e.calls});const a=e.conflicts??0;return a>0&&e.calls>=r.minConflictCalls&&a/e.calls>=r.highWriteContention&&i.push({fn:e.path,kind:"high-write-contention",severity:"warning",value:a/e.calls}),i},u=(e,r,i=g)=>{const a=[];if(typeof e?.databaseSize=="number"&&e.databaseSize>=i.storageWarnBytes&&a.push({kind:"storage-headroom",severity:e.databaseSize>=i.storageCriticalBytes?"error":"warning",value:e.databaseSize}),e?.cache){const{evictions:n,hits:s,misses:c}=e.cache,o=s+c;if(o>=i.minCacheSamples){const t=s/o;t<i.lowCacheHitRate&&a.push({kind:"low-cache-hit-rate",severity:"warning",value:t})}n>0&&n>s&&a.push({kind:"high-evictions",severity:"warning",value:n})}for(const n of r??[])a.push(...h(n,i));return a.toSorted((n,s)=>l[n.severity]-l[s.severity])};export{g as DEFAULT_INSIGHT_THRESHOLDS,u as deriveInsights};
@@ -1,4 +1,4 @@
1
- import{c as L}from"react/compiler-runtime";import{useLunora as ot}from"@lunora/react";import{useState as M,useMemo as dt,useRef as He,useCallback as et,useEffect as Le}from"react";import{ShardInput as gn}from"./ShardInput-CdawpUiS.js";import{u as Xe}from"./use-admin-query-P0RJrjsD.js";import{ADMIN_FUNCTIONS as le}from"./ADMIN_FUNCTIONS-B6z7VLYt.js";import{b as $t}from"./browser-storage-BH1MxLZs.js";import{h as Be,f as be,j as pn,c as Te,d as we,i as bn}from"./internal-CwaF9YNk.js";import{m as hn,c as Dt,d as lt,G as xn,a as vn,u as rt,b as wn,T as yn,D as Sn}from"./table-list-sidebar-BWq_-gtu.js";import{u as Cn}from"./use-sql-assistant-D1K2LqpO.js";import{ConfirmButton as ut}from"./ConfirmButton-Cj2SOapE.js";import{E as Nn}from"./empty-state-B939z6K2.js";import{useT as re}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{C as ft,a as Ie}from"./control-button-BOZ5K-FC.js";import{useReactTable as kn,getSortedRowModel as Tn,getCoreRowModel as En,flexRender as _n}from"@tanstack/react-table";import{useVirtualizer as Rn}from"@tanstack/react-virtual";import{C as gt}from"./checkbox-C5w53W-E.js";import{c as tt}from"./utils-bhneXptQ.js";import{f as $n}from"./virtual-rect-D_j7aLxX.js";import{C as it,G as Dn,T as In}from"./data-grid-BFTQnkXq.js";import{jsxs as _,jsx as f,Fragment as nt}from"react/jsx-runtime";import{DataFilters as Mn,toFilterClauses as Ve}from"./DataFilters-3nbW0uax.js";import{G as An,C as On}from"./grid-features-jBzZGauv.js";import{M as It}from"./modal-shell-wGW4CKEW.js";import{e as Fn,a as Pn,i as Vn,d as Ln}from"./wire-codec-Dl3VeNrd.js";import vt from"./useDebounced-DVeQ5-oW.js";import{r as Bn,l as zn}from"./shard-history-DU5b3QDI.js";const wt=(o,e)=>{const n=[];for(const[s,t]of Object.entries(e))for(const a of t)a.ref===o&&n.push({column:a.name,table:s});return n.sort((s,t)=>s.table.localeCompare(t.table)||s.column.localeCompare(t.column)),n},pt=o=>`${o.table}.${o.column}`,jn=(o,e,n,s,t=300)=>{if(s<=0)return{ids:new Set(o.map(u=>u.id)),leadPx:0,tailPx:0};const a=n-t,l=n+s+t,i=new Set;let r=0,c=0,g=0;for(const u of o){const m=u.getSize(),d=e.has(u.id),p=r+m>a&&r<l;d||p?i.add(u.id):r<a?c+=m:g+=m,r+=m}return{ids:i,leadPx:c,tailPx:g}},Gn=(o,e)=>{const n=new Map;let s=0;for(const t of o)e.has(t.id)&&(n.set(t.id,s),s+=t.getSize());return n},Jn=()=>{const o=L(11);let e;o[0]===Symbol.for("react.memo_cache_sentinel")?(e={},o[0]=e):e=o[0];const[n,s]=M(e);let t;o[1]===Symbol.for("react.memo_cache_sentinel")?(t=(d,p,b)=>{s(h=>({...h,[d]:{...h[d],[p]:b}}))},o[1]=t):t=o[1];const a=t;let l;o[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{s({})},o[2]=l):l=o[2];const i=l;let r;o[3]!==n?(r=(d,p)=>{const b=n[d];return b!==void 0&&p in b?{value:b[p]}:void 0},o[3]=n,o[4]=r):r=o[4];const c=r;let g;o[5]!==n?(g=Object.values(n).reduce(Kn,0),o[5]=n,o[6]=g):g=o[6];const u=g;let m;return o[7]!==u||o[8]!==n||o[9]!==c?(m={clear:i,count:u,stage:a,staged:n,stagedValue:c},o[7]=u,o[8]=n,o[9]=c,o[10]=m):m=o[10],m},Mt=(o,e)=>{if(typeof e=="number"){const n=Number(o);return o.trim()===""||Number.isNaN(n)?o:n}if(typeof e=="boolean"){if(o==="true")return!0;if(o==="false")return!1}return o},qn=o=>{const e=L(29),{changes:n,committing:s,onCommit:t,onDiscard:a}=o,l=re();let i;e[0]!==n.length||e[1]!==l?(i=l("{count} pending changes",{count:n.length}),e[0]=n.length,e[1]=l,e[2]=i):i=e[2];let r;e[3]!==i?(r=f("span",{className:"font-mono text-[11px] tracking-wide uppercase text-warning","data-testid":"db-staged-count",children:i}),e[3]=i,e[4]=r):r=e[4];let c;e[5]!==s||e[6]!==l?(c=l(s?"Committing…":"Commit"),e[5]=s,e[6]=l,e[7]=c):c=e[7];let g;e[8]!==s||e[9]!==t||e[10]!==c?(g=f("button",{className:"ms-auto rounded-md bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"db-staged-commit",disabled:s,onClick:t,type:"button",children:c}),e[8]=s,e[9]=t,e[10]=c,e[11]=g):g=e[11];let u;e[12]!==l?(u=l("Discard"),e[12]=l,e[13]=u):u=e[13];let m;e[14]!==s||e[15]!==a||e[16]!==u?(m=f("button",{className:"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","data-testid":"db-staged-discard",disabled:s,onClick:a,type:"button",children:u}),e[14]=s,e[15]=a,e[16]=u,e[17]=m):m=e[17];let d;e[18]!==r||e[19]!==g||e[20]!==m?(d=_("div",{className:"flex flex-wrap items-center gap-2",children:[r,g,m]}),e[18]=r,e[19]=g,e[20]=m,e[21]=d):d=e[21];let p;e[22]!==n?(p=n.map(Wn),e[22]=n,e[23]=p):p=e[23];let b;e[24]!==p?(b=f("ul",{className:"flex flex-col gap-1","data-testid":"db-staged-list",children:p}),e[24]=p,e[25]=b):b=e[25];let h;return e[26]!==d||e[27]!==b?(h=_("div",{className:"flex flex-col gap-2 border border-warning/40 bg-warning/5 p-3","data-testid":"db-staged",children:[d,b]}),e[26]=d,e[27]=b,e[28]=h):h=e[28],h};function Kn(o,e){return o+Object.keys(e).length}function Wn(o){return _("li",{className:"flex flex-wrap items-center gap-2 font-mono text-xs",children:[_("span",{className:"text-muted-foreground",children:[o.rowId,".",o.column]}),f("span",{className:"text-destructive line-through",children:Be(o.oldValue)}),f("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"→"}),f("span",{className:"text-foreground",children:Be(o.newValue)})]},`${o.rowId}:${o.column}`)}const yt=400,Hn=36,Qn={flex:"1 1 0%",minHeight:0,overflow:"auto",position:"relative"},Un={width:"100%"},Yn=/\n$/u,Xn={alignItems:"center",display:"flex",left:0,position:"absolute",top:0,width:"100%"},Zn={display:"flex",width:"100%"},St={flex:"0 0 8.5rem",padding:"0.375rem 0.75rem"},eo="2.5rem",At={alignItems:"center",display:"flex",flex:"0 0 2.5rem",justifyContent:"center",left:0,padding:"0.375rem 0",position:"sticky",zIndex:2},bt=o=>({flex:"0 0 auto",overflow:"hidden",padding:"0.375rem 0.75rem",position:"relative",textOverflow:"ellipsis",whiteSpace:"nowrap",width:`${o.toString()}px`}),Ot=(o,e)=>({...bt(o),left:`calc(${eo} + ${e.toString()}px)`,position:"sticky",zIndex:2}),Ct="rounded-md px-2 py-0.5 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",to=(o,e,n)=>e.enabled&&e.columns.has(n)?void 0:o,mt="__back__:",no=o=>`${mt}${o.table}.${o.column}`,oo=o=>{const e=L(3),{counts:n,rowId:s}=o;if(n===void 0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=f("span",{className:"text-muted-foreground/50",children:"—"}),e[0]=l):l=e[0],l}const t=n[s]??0;let a;return e[1]!==t?(a=f("span",{className:"tabular-nums",children:t}),e[1]=t,e[2]=a):a=e[2],a},ke=o=>{for(const e of["id","__id__","_id"]){const n=o[e];if(typeof n=="string"||typeof n=="number")return String(n)}return null},so=(o,e)=>{if(e.enumValues!==void 0&&e.enumValues.length>0)return e.enumValues.includes(o)||o===""&&e.nullable===!0?{value:o===""?null:o}:void 0;if(e.type==="boolean")return o==="true"||o==="false"?{value:o==="true"}:void 0;if(e.type==="number"){const n=Number(o);return o.trim()===""||!Number.isFinite(n)?void 0:{value:n}}return{value:o}},lo=(o,e,n)=>{if(n!==void 0&&n.type!=="any")return so(o,n);const s=Mt(o,e);return typeof e=="number"&&typeof s!="number"?void 0:{value:s}},ro=({anchor:o,columnIds:e,columnMeta:n,editableColumn:s,rows:t,text:a})=>{const l=a.replaceAll(`\r
1
+ import{c as L}from"react/compiler-runtime";import{useLunora as ot}from"@lunora/react";import{useState as M,useMemo as dt,useRef as He,useCallback as et,useEffect as Le}from"react";import{ShardInput as gn}from"./ShardInput-C6mjgAh4.mjs";import{u as Xe}from"./use-admin-query-Cbj2GuHu.mjs";import{ADMIN_FUNCTIONS as le}from"./ADMIN_FUNCTIONS-B6z7VLYt.mjs";import{b as $t}from"./browser-storage-BH1MxLZs.mjs";import{h as Be,f as be,j as pn,c as Te,d as we,i as bn}from"./internal-CwaF9YNk.mjs";import{m as hn,c as Dt,d as lt,G as xn,a as vn,u as rt,b as wn,T as yn,D as Sn}from"./table-list-sidebar-BxZm3sBJ.mjs";import{u as Cn}from"./use-sql-assistant-CFRzdA9E.mjs";import{ConfirmButton as ut}from"./ConfirmButton-DU4p72Er.mjs";import{E as Nn}from"./empty-state-D7jEML_T.mjs";import{useT as re}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{C as ft,a as Ie}from"./control-button-BOZ5K-FC.mjs";import{useReactTable as kn,getSortedRowModel as Tn,getCoreRowModel as En,flexRender as _n}from"@tanstack/react-table";import{useVirtualizer as Rn}from"@tanstack/react-virtual";import{C as gt}from"./checkbox-CnS9cyCz.mjs";import{c as tt}from"./utils-bhneXptQ.mjs";import{f as $n}from"./virtual-rect-D_j7aLxX.mjs";import{C as it,G as Dn,T as In}from"./data-grid-BqNXJ9PF.mjs";import{jsxs as _,jsx as f,Fragment as nt}from"react/jsx-runtime";import{DataFilters as Mn,toFilterClauses as Ve}from"./DataFilters-3nbW0uax.mjs";import{G as An,C as On}from"./grid-features-D8w5isjt.mjs";import{M as It}from"./modal-shell-CDztwLnv.mjs";import{e as Fn,a as Pn,i as Vn,d as Ln}from"./wire-codec-Dl3VeNrd.mjs";import vt from"./useDebounced-DVeQ5-oW.mjs";import{r as Bn,l as zn}from"./shard-history-CaO3C4KQ.mjs";const wt=(o,e)=>{const n=[];for(const[s,t]of Object.entries(e))for(const a of t)a.ref===o&&n.push({column:a.name,table:s});return n.sort((s,t)=>s.table.localeCompare(t.table)||s.column.localeCompare(t.column)),n},pt=o=>`${o.table}.${o.column}`,jn=(o,e,n,s,t=300)=>{if(s<=0)return{ids:new Set(o.map(u=>u.id)),leadPx:0,tailPx:0};const a=n-t,l=n+s+t,i=new Set;let r=0,c=0,g=0;for(const u of o){const m=u.getSize(),d=e.has(u.id),p=r+m>a&&r<l;d||p?i.add(u.id):r<a?c+=m:g+=m,r+=m}return{ids:i,leadPx:c,tailPx:g}},Gn=(o,e)=>{const n=new Map;let s=0;for(const t of o)e.has(t.id)&&(n.set(t.id,s),s+=t.getSize());return n},Jn=()=>{const o=L(11);let e;o[0]===Symbol.for("react.memo_cache_sentinel")?(e={},o[0]=e):e=o[0];const[n,s]=M(e);let t;o[1]===Symbol.for("react.memo_cache_sentinel")?(t=(d,p,b)=>{s(h=>({...h,[d]:{...h[d],[p]:b}}))},o[1]=t):t=o[1];const a=t;let l;o[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{s({})},o[2]=l):l=o[2];const i=l;let r;o[3]!==n?(r=(d,p)=>{const b=n[d];return b!==void 0&&p in b?{value:b[p]}:void 0},o[3]=n,o[4]=r):r=o[4];const c=r;let g;o[5]!==n?(g=Object.values(n).reduce(Kn,0),o[5]=n,o[6]=g):g=o[6];const u=g;let m;return o[7]!==u||o[8]!==n||o[9]!==c?(m={clear:i,count:u,stage:a,staged:n,stagedValue:c},o[7]=u,o[8]=n,o[9]=c,o[10]=m):m=o[10],m},Mt=(o,e)=>{if(typeof e=="number"){const n=Number(o);return o.trim()===""||Number.isNaN(n)?o:n}if(typeof e=="boolean"){if(o==="true")return!0;if(o==="false")return!1}return o},qn=o=>{const e=L(29),{changes:n,committing:s,onCommit:t,onDiscard:a}=o,l=re();let i;e[0]!==n.length||e[1]!==l?(i=l("{count} pending changes",{count:n.length}),e[0]=n.length,e[1]=l,e[2]=i):i=e[2];let r;e[3]!==i?(r=f("span",{className:"font-mono text-[11px] tracking-wide uppercase text-warning","data-testid":"db-staged-count",children:i}),e[3]=i,e[4]=r):r=e[4];let c;e[5]!==s||e[6]!==l?(c=l(s?"Committing…":"Commit"),e[5]=s,e[6]=l,e[7]=c):c=e[7];let g;e[8]!==s||e[9]!==t||e[10]!==c?(g=f("button",{className:"ms-auto rounded-md bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"db-staged-commit",disabled:s,onClick:t,type:"button",children:c}),e[8]=s,e[9]=t,e[10]=c,e[11]=g):g=e[11];let u;e[12]!==l?(u=l("Discard"),e[12]=l,e[13]=u):u=e[13];let m;e[14]!==s||e[15]!==a||e[16]!==u?(m=f("button",{className:"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","data-testid":"db-staged-discard",disabled:s,onClick:a,type:"button",children:u}),e[14]=s,e[15]=a,e[16]=u,e[17]=m):m=e[17];let d;e[18]!==r||e[19]!==g||e[20]!==m?(d=_("div",{className:"flex flex-wrap items-center gap-2",children:[r,g,m]}),e[18]=r,e[19]=g,e[20]=m,e[21]=d):d=e[21];let p;e[22]!==n?(p=n.map(Wn),e[22]=n,e[23]=p):p=e[23];let b;e[24]!==p?(b=f("ul",{className:"flex flex-col gap-1","data-testid":"db-staged-list",children:p}),e[24]=p,e[25]=b):b=e[25];let h;return e[26]!==d||e[27]!==b?(h=_("div",{className:"flex flex-col gap-2 border border-warning/40 bg-warning/5 p-3","data-testid":"db-staged",children:[d,b]}),e[26]=d,e[27]=b,e[28]=h):h=e[28],h};function Kn(o,e){return o+Object.keys(e).length}function Wn(o){return _("li",{className:"flex flex-wrap items-center gap-2 font-mono text-xs",children:[_("span",{className:"text-muted-foreground",children:[o.rowId,".",o.column]}),f("span",{className:"text-destructive line-through",children:Be(o.oldValue)}),f("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"→"}),f("span",{className:"text-foreground",children:Be(o.newValue)})]},`${o.rowId}:${o.column}`)}const yt=400,Hn=36,Qn={flex:"1 1 0%",minHeight:0,overflow:"auto",position:"relative"},Un={width:"100%"},Yn=/\n$/u,Xn={alignItems:"center",display:"flex",left:0,position:"absolute",top:0,width:"100%"},Zn={display:"flex",width:"100%"},St={flex:"0 0 8.5rem",padding:"0.375rem 0.75rem"},eo="2.5rem",At={alignItems:"center",display:"flex",flex:"0 0 2.5rem",justifyContent:"center",left:0,padding:"0.375rem 0",position:"sticky",zIndex:2},bt=o=>({flex:"0 0 auto",overflow:"hidden",padding:"0.375rem 0.75rem",position:"relative",textOverflow:"ellipsis",whiteSpace:"nowrap",width:`${o.toString()}px`}),Ot=(o,e)=>({...bt(o),left:`calc(${eo} + ${e.toString()}px)`,position:"sticky",zIndex:2}),Ct="rounded-md px-2 py-0.5 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",to=(o,e,n)=>e.enabled&&e.columns.has(n)?void 0:o,mt="__back__:",no=o=>`${mt}${o.table}.${o.column}`,oo=o=>{const e=L(3),{counts:n,rowId:s}=o;if(n===void 0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=f("span",{className:"text-muted-foreground/50",children:"—"}),e[0]=l):l=e[0],l}const t=n[s]??0;let a;return e[1]!==t?(a=f("span",{className:"tabular-nums",children:t}),e[1]=t,e[2]=a):a=e[2],a},ke=o=>{for(const e of["id","__id__","_id"]){const n=o[e];if(typeof n=="string"||typeof n=="number")return String(n)}return null},so=(o,e)=>{if(e.enumValues!==void 0&&e.enumValues.length>0)return e.enumValues.includes(o)||o===""&&e.nullable===!0?{value:o===""?null:o}:void 0;if(e.type==="boolean")return o==="true"||o==="false"?{value:o==="true"}:void 0;if(e.type==="number"){const n=Number(o);return o.trim()===""||!Number.isFinite(n)?void 0:{value:n}}return{value:o}},lo=(o,e,n)=>{if(n!==void 0&&n.type!=="any")return so(o,n);const s=Mt(o,e);return typeof e=="number"&&typeof s!="number"?void 0:{value:s}},ro=({anchor:o,columnIds:e,columnMeta:n,editableColumn:s,rows:t,text:a})=>{const l=a.replaceAll(`\r
2
2
  `,`
3
3
  `).replace(Yn,"").split(`
4
4
  `),i=[];let r=0;for(const[c,g]of l.entries()){const u=t[o.row+c],m=u===void 0?null:ke(u),d=g.split(" ");if(u===void 0||m===null){r+=d.length;continue}for(const[p,b]of d.entries()){const h=e[o.col+p],y=h===void 0||!s(h)?void 0:lo(b,u[h],n?.[h]);h===void 0||y===void 0?r+=1:i.push({column:h,rowId:m,value:y.value})}}return{edits:i,skipped:r}},Ft=(o,e)=>ke(o)??`row-${e.toString()}`,io=8,ao=o=>{const e=L(17),{anchor:n,mask:s,state:t}=o,a=re();let l;e[0]!==n.left||e[1]!==n.top?(l={left:n.left,position:"fixed",top:n.top,zIndex:50},e[0]=n.left,e[1]=n.top,e[2]=l):l=e[2];const i=l;let r;if(t==="loading"){let g;e[3]!==a?(g=a("Loading…"),e[3]=a,e[4]=g):g=e[4];let u;e[5]!==g?(u=f("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:g}),e[5]=g,e[6]=u):u=e[6],r=u}else if(t.row===null){let g;e[7]!==a?(g=a("No matching row."),e[7]=a,e[8]=g):g=e[8];let u;e[9]!==g?(u=f("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:g}),e[9]=g,e[10]=u):u=e[10],r=u}else{let g;if(e[11]!==s||e[12]!==t.row){const u=Object.entries(Dt(t.row,s)).slice(0,io);g=f("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 px-3 py-2",children:u.map(yo)}),e[11]=s,e[12]=t.row,e[13]=g}else g=e[13];r=g}let c;return e[14]!==r||e[15]!==i?(c=f("div",{className:"pointer-events-none w-72 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground","data-testid":"db-ref-preview",role:"tooltip",style:i,children:r}),e[14]=r,e[15]=i,e[16]=c):c=e[16],c},co=o=>{const e=L(24),{column:n,id:s,maskViewFor:t,onNavigate:a,onPreview:l,target:i}=o,[r,c]=M(null),[g,u]=M("idle");let m;e[0]!==s||e[1]!==a||e[2]!==i?(m=()=>{a(i,s)},e[0]=s,e[1]=a,e[2]=i,e[3]=m):m=e[3];const d=m;let p;e[4]!==s||e[5]!==l||e[6]!==g||e[7]!==i?(p=C=>{const S=C.currentTarget.getBoundingClientRect();if(c({left:S.left,top:S.bottom+4}),g!=="idle")return;u("loading"),be((async()=>{try{u({row:await l(i,s)})}catch{u({row:null})}})())},e[4]=s,e[5]=l,e[6]=g,e[7]=i,e[8]=p):p=e[8];const b=p;let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{c(null)},e[9]=h):h=e[9];const y=h,x=`db-ref-${n}`,v=`Open ${i} ${s}`;let w;e[10]!==s||e[11]!==d||e[12]!==b||e[13]!==x||e[14]!==v?(w=_("button",{"data-testid":x,onBlur:y,onClick:d,onFocus:b,onMouseEnter:b,onMouseLeave:y,title:v,type:"button",children:[s," ↗"]}),e[10]=s,e[11]=d,e[12]=b,e[13]=x,e[14]=v,e[15]=w):w=e[15];let N;e[16]!==r||e[17]!==t||e[18]!==g||e[19]!==i?(N=r!==null&&g!=="idle"&&f(ao,{anchor:r,mask:t(i,g==="loading"||g.row===null?[]:Object.keys(g.row)),state:g}),e[16]=r,e[17]=t,e[18]=g,e[19]=i,e[20]=N):N=e[20];let T;return e[21]!==w||e[22]!==N?(T=_(nt,{children:[w,N]}),e[21]=w,e[22]=N,e[23]=T):T=e[23],T},uo=o=>o==="asc"?" ▲":o==="desc"?" ▼":"",fo="absolute end-1 top-1/2 hidden -translate-y-1/2 items-center justify-center rounded text-muted-foreground outline-none group-hover/cell:flex hover:text-foreground focus-visible:flex",Nt=o=>{const e=L(8),{column:n,onExpand:s,value:t}=o;let a;e[0]!==n||e[1]!==s||e[2]!==t?(a=()=>{s(n,t)},e[0]=n,e[1]=s,e[2]=t,e[3]=a):a=e[3];const l=a,i=`db-expand-${n}`;let r;e[4]===Symbol.for("react.memo_cache_sentinel")?(r=f("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:f("path",{d:"M9 21H5a2 2 0 0 1-2-2v-4m18 0v4a2 2 0 0 1-2 2h-4M3 9V5a2 2 0 0 1 2-2h4m6 0h4a2 2 0 0 1 2 2v4"})}),e[4]=r):r=e[4];let c;return e[5]!==l||e[6]!==i?(c=f("button",{"aria-label":"Expand cell",className:fo,"data-testid":i,onClick:l,type:"button",children:r}),e[5]=l,e[6]=i,e[7]=c):c=e[7],c},mo=o=>{const e=L(15),{column:n,initial:s,onCancel:t,onCommit:a,recordId:l}=o,i=He(null);let r,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{i.current?.select()},c=[],e[0]=r,e[1]=c):(r=e[0],c=e[1]),Le(r,c);let g;e[2]!==t||e[3]!==a?(g=y=>{y.key==="Enter"?(y.preventDefault(),a(y.currentTarget.value)):y.key==="Escape"&&(y.preventDefault(),t())},e[2]=t,e[3]=a,e[4]=g):g=e[4];const u=g;let m;e[5]!==a?(m=y=>{a(y.currentTarget.value)},e[5]=a,e[6]=m):m=e[6];const d=m,p=`db-cell-input-${l}-${n}`;let b;e[7]!==s?(b=Be(s),e[7]=s,e[8]=b):b=e[8];let h;return e[9]!==n||e[10]!==d||e[11]!==u||e[12]!==p||e[13]!==b?(h=f("input",{"aria-label":n,className:"w-full rounded border border-ring bg-background px-1 py-0.5 font-mono text-xs outline-none","data-testid":p,defaultValue:b,onBlur:d,onKeyDown:u,ref:i}),e[9]=n,e[10]=d,e[11]=u,e[12]=p,e[13]=b,e[14]=h):h=e[14],h},go=o=>{const e=L(70),{cell:n,edit:s,highlight:t,mask:a,refs:l}=o,i=n.column.id;let r,c,g,u;if(e[0]!==n||e[1]!==i||e[2]!==s||e[3]!==a||e[4]!==l.columns||e[5]!==l.maskViewFor||e[6]!==l.onNavigate||e[7]!==l.onPreview){u=Symbol.for("react.early_return_sentinel");e:{c=n.getValue(),r=ke(n.row.original);const $=l.columns?.[i];if(a.enabled&&a.columns.has(i)){const E=`db-masked-${i}`,D=f(it,{value:hn(c,i,a)});let R;e[12]!==E||e[13]!==D?(R=f("span",{className:"text-muted-foreground italic","data-testid":E,title:"Masked (preview)",children:D}),e[12]=E,e[13]=D,e[14]=R):R=e[14],u=R;break e}if($!==void 0&&(typeof c=="string"||typeof c=="number")&&String(c)!==""){const E=String(c),D=`${$}:${String(c)}`;let R;e[15]!==i||e[16]!==l.maskViewFor||e[17]!==l.onNavigate||e[18]!==l.onPreview||e[19]!==E||e[20]!==D||e[21]!==$?(R=f(co,{column:i,id:E,maskViewFor:l.maskViewFor,onNavigate:l.onNavigate,onPreview:l.onPreview,target:$},D),e[15]=i,e[16]=l.maskViewFor,e[17]=l.onNavigate,e[18]=l.onPreview,e[19]=E,e[20]=D,e[21]=$,e[22]=R):R=e[22],u=R;break e}if(r===null){let E;e[23]!==c?(E=f(it,{value:c}),e[23]=c,e[24]=E):E=e[24];let D;e[25]!==i||e[26]!==s.onExpandCell||e[27]!==c?(D=f(Nt,{column:i,onExpand:s.onExpandCell,value:c}),e[25]=i,e[26]=s.onExpandCell,e[27]=c,e[28]=D):D=e[28];let R;e[29]!==E||e[30]!==D?(R=_(nt,{children:[E,D]}),e[29]=E,e[30]=D,e[31]=R):R=e[31],u=R;break e}g=s.stagedValue(r,i)}e[0]=n,e[1]=i,e[2]=s,e[3]=a,e[4]=l.columns,e[5]=l.maskViewFor,e[6]=l.onNavigate,e[7]=l.onPreview,e[8]=r,e[9]=c,e[10]=g,e[11]=u}else r=e[8],c=e[9],g=e[10],u=e[11];if(u!==Symbol.for("react.early_return_sentinel"))return u;const m=g,d=m===void 0?c:m.value;let p;e[32]!==i||e[33]!==s?(p=s.editable&&s.editableColumn(i),e[32]=i,e[33]=s,e[34]=p):p=e[34];const b=p;if(s.editingCell!==null&&s.editingCell.rowId===r&&s.editingCell.column===i){let $;e[35]!==i||e[36]!==s||e[37]!==r||e[38]!==c?($=D=>{s.stage(r,i,Mt(D,c)),s.cancelEdit()},e[35]=i,e[36]=s,e[37]=r,e[38]=c,e[39]=$):$=e[39];let E;return e[40]!==i||e[41]!==d||e[42]!==s.cancelEdit||e[43]!==r||e[44]!==$?(E=f(mo,{column:i,initial:d,onCancel:s.cancelEdit,onCommit:$,recordId:r}),e[40]=i,e[41]=d,e[42]=s.cancelEdit,e[43]=r,e[44]=$,e[45]=E):E=e[45],E}let y;m!==void 0?y="rounded bg-warning/15 px-1":b&&(y="cursor-text");let x;e[46]!==b||e[47]!==i||e[48]!==s||e[49]!==r?(x=b?()=>{s.startEdit(r,i)}:void 0,e[46]=b,e[47]=i,e[48]=s,e[49]=r,e[50]=x):x=e[50];const v=x,w=y,N=`db-cell-${r}-${i}`;let T;e[51]!==i||e[52]!==t||e[53]!==a?(T=to(t,a,i),e[51]=i,e[52]=t,e[53]=a,e[54]=T):T=e[54];let C;e[55]!==d||e[56]!==T?(C=f(it,{highlight:T,value:d}),e[55]=d,e[56]=T,e[57]=C):C=e[57];let S;e[58]!==y||e[59]!==v||e[60]!==N||e[61]!==C?(S=f("span",{className:w,"data-testid":N,onDoubleClick:v,children:C}),e[58]=y,e[59]=v,e[60]=N,e[61]=C,e[62]=S):S=e[62];let k;e[63]!==i||e[64]!==d||e[65]!==s.onExpandCell?(k=f(Nt,{column:i,onExpand:s.onExpandCell,value:d}),e[63]=i,e[64]=d,e[65]=s.onExpandCell,e[66]=k):k=e[66];let A;return e[67]!==k||e[68]!==S?(A=_(nt,{children:[S,k]}),e[67]=k,e[68]=S,e[69]=A):A=e[69],A},po=o=>{o.preventDefault()},kt={any:"?",array:"[]",bigint:"#",boolean:"01",bytes:"0x",id:"→",number:"#",object:"{}",storage:"◫",string:"T",union:"|"},bo=({declaredType:o,draggedRef:e,header:n,masked:s=!1,onTogglePin:t,pinnedOffset:a,table:l})=>{const i=()=>{e.current=n.column.id},r=()=>{const c=e.current,g=n.column.id;if(e.current=null,c===null||c===g)return;const u=l.getState().columnOrder,d=(u.length>0?u:l.getAllLeafColumns().map(b=>b.id)).filter(b=>b!==c),p=d.indexOf(g);d.splice(p===-1?d.length:p,0,c),l.setColumnOrder(d)};return _("th",{className:tt("group/head text-start text-xs font-medium text-muted-foreground",a!==void 0&&"border-e border-border bg-muted"),draggable:!0,onDragOver:po,onDragStart:i,onDrop:r,style:a===void 0?bt(n.getSize()):Ot(n.getSize(),a),children:[_("button",{className:"inline-flex max-w-full cursor-grab items-center gap-1 truncate outline-none hover:text-foreground","data-testid":`db-sort-${n.column.id}`,onClick:n.column.getToggleSortingHandler(),type:"button",children:[_n(n.column.columnDef.header,n.getContext()),uo(n.column.getIsSorted())]}),o!==void 0&&kt[o]!==void 0&&f("span",{className:"ms-1 font-mono text-[0.625rem] text-muted-foreground/70","data-testid":`db-type-${n.column.id}`,title:o,children:kt[o]}),s&&f("span",{className:"ms-1 inline-flex items-center rounded-sm bg-warning/15 px-1 text-[0.625rem] font-medium uppercase text-warning","data-testid":`db-mask-chip-${n.column.id}`,title:"This column is masked by a mask() policy",children:"masked"}),f("button",{"aria-label":a===void 0?`Pin ${n.column.id}`:`Unpin ${n.column.id}`,"aria-pressed":a!==void 0,className:tt("ms-1 rounded-sm px-1 text-[0.625rem] outline-none transition-opacity hover:bg-accent focus-visible:bg-accent",a===void 0?"opacity-0 group-hover/head:opacity-100 focus-visible:opacity-100":"opacity-100 text-foreground"),"data-testid":`db-pin-${n.column.id}`,onClick:()=>{t(n.column.id)},type:"button",children:"📌"}),f("span",{"aria-hidden":"true",className:"absolute inset-y-0 end-0 w-1 cursor-col-resize touch-none select-none hover:bg-ring/60 data-[resizing=true]:bg-ring","data-resizing":n.column.getIsResizing(),"data-testid":`db-resize-${n.column.id}`,onMouseDown:n.getResizeHandler(),onTouchStart:n.getResizeHandler()})]})},ho=o=>{const e=L(13),{table:n}=o,s=re();let t;e[0]!==n?(t=g=>{n.toggleAllRowsSelected(g)},e[0]=n,e[1]=t):t=e[1];const a=t;let l;e[2]!==s?(l=s("Select all rows"),e[2]=s,e[3]=l):l=e[3];let i;e[4]!==n?(i=n.getIsAllRowsSelected(),e[4]=n,e[5]=i):i=e[5];let r;e[6]!==n?(r=n.getIsSomeRowsSelected()&&!n.getIsAllRowsSelected(),e[6]=n,e[7]=r):r=e[7];let c;return e[8]!==a||e[9]!==l||e[10]!==i||e[11]!==r?(c=f("th",{className:"bg-muted",style:At,children:f(gt,{"aria-label":l,checked:i,"data-testid":"db-select-all",indeterminate:r,onCheckedChange:a})}),e[8]=a,e[9]=l,e[10]=i,e[11]=r,e[12]=c):c=e[12],c},xo=o=>{const e=L(17),{row:n}=o,s=re();let t;e[0]!==n.original?(t=ke(n.original),e[0]=n.original,e[1]=t):t=e[1];const a=t;let l;e[2]!==n?(l=p=>{n.toggleSelected(p)},e[2]=n,e[3]=l):l=e[3];const i=l;let r;e[4]!==s?(r=s("Select row"),e[4]=s,e[5]=r):r=e[5];let c;e[6]!==n?(c=n.getIsSelected(),e[6]=n,e[7]=c):c=e[7];let g;e[8]!==n.index||e[9]!==n.original?(g=Ft(n.original,n.index),e[8]=n.index,e[9]=n.original,e[10]=g):g=e[10];const u=`db-select-${g}`,m=a===null;let d;return e[11]!==i||e[12]!==r||e[13]!==c||e[14]!==u||e[15]!==m?(d=f("td",{className:"bg-background",style:At,children:f(gt,{"aria-label":r,checked:c,"data-testid":u,disabled:m,onCheckedChange:i})}),e[11]=i,e[12]=r,e[13]=c,e[14]=u,e[15]=m,e[16]=d):d=e[16],d},vo=o=>{const e=L(91),{columnMeta:n,edit:s,editable:t,mask:a,onDelete:l,onEdit:i,onInspect:r,highlight:c,backRelationCounts:g,onTogglePin:u,pinnedColumns:m,refs:d,tableModel:p}=o,b=re(),{attachScroll:h,scrollLeft:y,scrollToIndex:x,table:v,tableRows:w,tbodyStyle:N,viewportWidth:T,virtualRows:C}=p,S=He(null),[k,A]=M(null);let $;e[0]===Symbol.for("react.memo_cache_sentinel")?($={columns:"",count:0},e[0]=$):$=e[0];const[E,D]=M($);let R;e[1]!==v?(R=v.getVisibleLeafColumns(),e[1]=v,e[2]=R):R=e[2];const q=R.length;let O;e[3]!==k||e[4]!==q||e[5]!==s||e[6]!==v||e[7]!==w?(O=oe=>{if(!["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter"].includes(oe.key))return;oe.preventDefault();const W=k??{col:0,row:0};if(oe.key==="Enter"){const z=w[W.row],ge=v.getVisibleLeafColumns()[W.col];if(z!==void 0&&ge!==void 0){const K=ke(z.original);K!==null&&s.editableColumn(ge.id)&&s.startEdit(K,ge.id)}A(W);return}let{col:ee,row:Q}=W;e:switch(oe.key){case"ArrowDown":{Q=Math.min(Q+1,w.length-1);break e}case"ArrowRight":{ee=Math.min(ee+1,q-1);break e}case"ArrowUp":{Q=Math.max(Q-1,0);break e}default:ee=Math.max(ee-1,0)}A({col:ee,row:Q})},e[3]=k,e[4]=q,e[5]=s,e[6]=v,e[7]=w,e[8]=O):O=e[8];const B=O;let F;e[9]!==k||e[10]!==n||e[11]!==s||e[12]!==v||e[13]!==w?(F=oe=>{const W=s.editable?oe.clipboardData.getData("text/plain"):"";if(W==="")return;oe.preventDefault();const ee=v.getVisibleLeafColumns().map(So),Q=ro({anchor:k??{col:0,row:0},columnIds:ee,columnMeta:n,editableColumn:s.editableColumn,rows:w.map(Co),text:W});for(const z of Q.edits)s.stage(z.rowId,z.column,z.value);D({columns:ee.join("\0"),count:Q.skipped})},e[9]=k,e[10]=n,e[11]=s,e[12]=v,e[13]=w,e[14]=F):F=e[14];const J=F;let H,G;e[15]!==k||e[16]!==x?(H=()=>{k!==null&&x(k.row)},G=[k,x],e[15]=k,e[16]=x,e[17]=H,e[18]=G):(H=e[17],G=e[18]),Le(H,G);let U,ye,ie,he,xe,Se,ce,Ce,de,Z,Ne,ue,fe,se,me,Y;if(e[19]!==k||e[20]!==h||e[21]!==g||e[22]!==n||e[23]!==s||e[24]!==t||e[25]!==c||e[26]!==a||e[27]!==l||e[28]!==i||e[29]!==B||e[30]!==J||e[31]!==r||e[32]!==u||e[33]!==E.columns||e[34]!==E.count||e[35]!==m||e[36]!==d||e[37]!==y||e[38]!==b||e[39]!==v||e[40]!==w||e[41]!==N||e[42]!==T||e[43]!==C){const oe=v.getVisibleLeafColumns().map(No),W=jn(oe,m,y,T),ee=Gn(v.getVisibleLeafColumns().map(ko),m),Q=K=>{const Ee=w[K.index],{original:Ae}=Ee,Oe=ke(Ae),Fe=Ft(Ae,K.index),ze={...Xn,height:`${K.size.toString()}px`,transform:`translateY(${K.start.toString()}px)`};return _("tr",{className:"border-b border-border text-xs transition-colors hover:bg-muted/50","data-testid":"db-row",style:ze,children:[f(xo,{row:Ee}),W.leadPx>0&&f("td",{"aria-hidden":"true",style:{flex:`0 0 ${W.leadPx.toString()}px`}}),Ee.getVisibleCells().map((pe,je)=>{if(!W.ids.has(pe.column.id))return null;const Pe=ee.get(pe.column.id),Ke=k!==null&&k.row===K.index&&k.col===je?" ring-1 ring-ring ring-inset":"";return f("td",{className:tt("group/cell truncate font-mono text-muted-foreground",Pe!==void 0&&"border-e border-border bg-background",Ke),onPointerDown:()=>{A({col:je,row:K.index})},style:Pe===void 0?bt(pe.column.getSize()):Ot(pe.column.getSize(),Pe),children:pe.column.id.startsWith(mt)?f(oo,{counts:g[pe.column.id.slice(mt.length)],rowId:Fe}):f(go,{cell:pe,edit:s,highlight:c,mask:a,refs:d})},pe.id)}),W.tailPx>0&&f("td",{"aria-hidden":"true",style:{flex:`0 0 ${W.tailPx.toString()}px`}}),_("td",{className:"flex items-center gap-1",style:St,children:[f("button",{className:Ct,"data-testid":`db-inspect-${Fe}`,onClick:()=>{r(Ae)},type:"button",children:"Details"}),t&&_(nt,{children:[f("button",{className:Ct,"data-testid":`db-edit-${Fe}`,disabled:Oe===null,onClick:()=>{i(Oe,Ae)},type:"button",children:"Edit"}),f(ut,{confirmLabel:"Delete?",disabled:Oe===null,onConfirm:()=>{l(Oe)},testId:`db-delete-${Fe}`,children:"Delete"})]})]})]},Ee.id)};U=Dn,ue="fill",e[60]!==E.columns||e[61]!==E.count||e[62]!==b||e[63]!==v?(fe=E.count>0&&E.columns===v.getVisibleLeafColumns().map(To).join("\0")&&f("p",{className:"border-b border-warning/40 bg-warning/5 px-3 py-1.5 text-xs text-warning","data-testid":"db-paste-skipped",children:b("{count} pasted cells were skipped",{count:E.count})}),e[60]=E.columns,e[61]=E.count,e[62]=b,e[63]=v,e[64]=fe):fe=e[64],xe="db-scroll",Se=B,ce=J,Ce=h,de="grid",Z=Qn,Ne=0,Y="w-full text-xs",ye="db-rows",ie=Un;let z;e[65]!==v?(z=f(ho,{table:v}),e[65]=v,e[66]=z):z=e[66];let ge;e[67]===Symbol.for("react.memo_cache_sentinel")?(ge=f("th",{"aria-label":"Row actions",style:St}),e[67]=ge):ge=e[67],he=f("thead",{className:"bg-muted/50",children:_("tr",{className:"border-b border-border",style:Zn,children:[z,W.leadPx>0&&f("th",{"aria-hidden":"true",style:{flex:`0 0 ${W.leadPx.toString()}px`}}),v.getFlatHeaders().map(K=>W.ids.has(K.column.id)?f(bo,{declaredType:n?.[K.column.id]?.type,draggedRef:S,header:K,masked:a.columns.has(K.column.id),onTogglePin:u,pinnedOffset:ee.get(K.column.id),table:v},K.id):null),W.tailPx>0&&f("th",{"aria-hidden":"true",style:{flex:`0 0 ${W.tailPx.toString()}px`}}),ge]})}),se=N,me=C.map(K=>Q(K)),e[19]=k,e[20]=h,e[21]=g,e[22]=n,e[23]=s,e[24]=t,e[25]=c,e[26]=a,e[27]=l,e[28]=i,e[29]=B,e[30]=J,e[31]=r,e[32]=u,e[33]=E.columns,e[34]=E.count,e[35]=m,e[36]=d,e[37]=y,e[38]=b,e[39]=v,e[40]=w,e[41]=N,e[42]=T,e[43]=C,e[44]=U,e[45]=ye,e[46]=ie,e[47]=he,e[48]=xe,e[49]=Se,e[50]=ce,e[51]=Ce,e[52]=de,e[53]=Z,e[54]=Ne,e[55]=ue,e[56]=fe,e[57]=se,e[58]=me,e[59]=Y}else U=e[44],ye=e[45],ie=e[46],he=e[47],xe=e[48],Se=e[49],ce=e[50],Ce=e[51],de=e[52],Z=e[53],Ne=e[54],ue=e[55],fe=e[56],se=e[57],me=e[58],Y=e[59];let j;e[68]!==se||e[69]!==me?(j=f("tbody",{style:se,children:me}),e[68]=se,e[69]=me,e[70]=j):j=e[70];let te;e[71]!==ye||e[72]!==ie||e[73]!==he||e[74]!==j||e[75]!==Y?(te=_("table",{className:Y,"data-testid":ye,style:ie,children:[he,j]}),e[71]=ye,e[72]=ie,e[73]=he,e[74]=j,e[75]=Y,e[76]=te):te=e[76];let ne;e[77]!==xe||e[78]!==Se||e[79]!==ce||e[80]!==Ce||e[81]!==de||e[82]!==Z||e[83]!==Ne||e[84]!==te?(ne=f("div",{"data-testid":xe,onKeyDown:Se,onPaste:ce,ref:Ce,role:de,style:Z,tabIndex:Ne,children:te}),e[77]=xe,e[78]=Se,e[79]=ce,e[80]=Ce,e[81]=de,e[82]=Z,e[83]=Ne,e[84]=te,e[85]=ne):ne=e[85];let Me;return e[86]!==U||e[87]!==ue||e[88]!==fe||e[89]!==ne?(Me=_(U,{layout:ue,children:[fe,ne]}),e[86]=U,e[87]=ue,e[88]=fe,e[89]=ne,e[90]=Me):Me=e[90],Me},wo=(o,e,n,s=[])=>{const t=o?.columns,a=o?.rows,l=o?.refs,i=dt(()=>{if(t===void 0)return[];const S=t.map(k=>({accessorFn:A=>A[k],header:l?.[k]===void 0?k:`${k} →`,id:k}));for(const k of s)S.push({accessorFn:()=>{},enableSorting:!1,header:`← ${k.table}`,id:no(k)});return S},[s,t,l]),r=dt(()=>a??[],[a]),[c,g]=M({}),[u,m]=M({}),d=kn({columnResizeMode:"onChange",columns:i,data:r,defaultColumn:{minSize:80,size:200},enableColumnResizing:!0,enableRowSelection:S=>ke(S.original)!==null,getCoreRowModel:En(),getRowId:(S,k)=>ke(S)??`row-${k.toString()}`,getSortedRowModel:Tn(),manualSorting:!0,onColumnVisibilityChange:m,onRowSelectionChange:g,onSortingChange:n,state:{columnVisibility:u,rowSelection:c,sorting:e}}),p=d.getRowModel().rows,b=He(null),h=Rn({count:p.length,estimateSize:()=>Hn,getScrollElement:()=>b.current,initialRect:{height:yt,width:0},observeElementRect:(S,k)=>$n(S,k,yt),overscan:8}),y=et(S=>{h.scrollToIndex(S)},[h]),[x,v]=M({left:0,width:0}),w=et(S=>{if(b.current=S,S===null)return;const k=()=>{v($=>$.left===S.scrollLeft&&$.width===S.clientWidth?$:{left:S.scrollLeft,width:S.clientWidth})};S.addEventListener("scroll",k,{passive:!0});const A=new ResizeObserver(k);return A.observe(S),()=>{S.removeEventListener("scroll",k),A.disconnect(),b.current=null}},[]),N=h.getVirtualItems(),C={display:"block",height:`${h.getTotalSize().toString()}px`,position:"relative"};return{attachScroll:w,scrollLeft:x.left,scrollToIndex:y,table:d,tableRows:p,tbodyStyle:C,viewportWidth:x.width,virtualRows:N}};function yo(o){const[e,n]=o;return _("div",{className:"contents",children:[f("dt",{className:"truncate font-mono text-[11px] text-muted-foreground",children:e}),f("dd",{className:"truncate font-mono text-[11px] text-foreground",title:Be(n),children:Be(n)})]},e)}function So(o){return o.id}function Co(o){return o.original}function No(o){return{getSize:()=>o.getSize(),id:o.id}}function ko(o){return{getSize:()=>o.getSize(),id:o.id}}function To(o){return o.id}const Eo=o=>{const e=L(22),{onCommit:n}=o,s=re(),[t,a]=M(""),l=He(null);let i,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{l.current?.focus()},r=[],e[0]=i,e[1]=r):(i=e[0],r=e[1]),Le(i,r);let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=v=>{a(v.target.value)},e[2]=c):c=e[2];const g=c;let u;e[3]!==t||e[4]!==n?(u=()=>{const v=t.trim();v!==""&&n(v)},e[3]=t,e[4]=n,e[5]=u):u=e[5];const m=u;let d;e[6]!==s?(d=s("Query name"),e[6]=s,e[7]=d):d=e[7];let p;e[8]!==s?(p=s("Query name"),e[8]=s,e[9]=p):p=e[9];let b;e[10]!==t||e[11]!==d||e[12]!==p?(b=f("input",{"aria-label":d,className:"h-7 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"db-save-query-name",onChange:g,placeholder:p,ref:l,value:t}),e[10]=t,e[11]=d,e[12]=p,e[13]=b):b=e[13];let h;e[14]!==s?(h=s("Save"),e[14]=s,e[15]=h):h=e[15];let y;e[16]!==m||e[17]!==h?(y=f("button",{className:ft,"data-testid":"db-save-query-confirm",onClick:m,type:"button",children:h}),e[16]=m,e[17]=h,e[18]=y):y=e[18];let x;return e[19]!==b||e[20]!==y?(x=_("span",{className:"inline-flex items-center gap-1",children:[b,y]}),e[19]=b,e[20]=y,e[21]=x):x=e[21],x},_o=o=>{const e=L(27),{onApply:n,onCopyLink:s,onDelete:t,onSave:a,saved:l}=o,i=re(),[r,c]=M(!1);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{c(!0)},e[0]=g):g=e[0];const u=g;let m;e[1]!==a?(m=C=>{a(C),c(!1)},e[1]=a,e[2]=m):m=e[2];const d=m;let p;e[3]!==n||e[4]!==l?(p=C=>{const S=l[Number(C.currentTarget.dataset.index)];S!==void 0&&n(S)},e[3]=n,e[4]=l,e[5]=p):p=e[5];const b=p;let h;e[6]!==t||e[7]!==l?(h=C=>{const S=l[Number(C.currentTarget.dataset.index)];S!==void 0&&t(S.name)},e[6]=t,e[7]=l,e[8]=h):h=e[8];const y=h;let x;e[9]!==i?(x=i("Copy link"),e[9]=i,e[10]=x):x=e[10];let v;e[11]!==s||e[12]!==x?(v=f("button",{className:ft,"data-testid":"db-copy-link",onClick:s,type:"button",children:x}),e[11]=s,e[12]=x,e[13]=v):v=e[13];let w;e[14]!==d||e[15]!==r||e[16]!==i?(w=r?f(Eo,{onCommit:d}):f("button",{className:ft,"data-testid":"db-save-query",onClick:u,type:"button",children:i("Save query")}),e[14]=d,e[15]=r,e[16]=i,e[17]=w):w=e[17];let N;e[18]!==b||e[19]!==y||e[20]!==l||e[21]!==i?(N=l.length>0&&_("div",{className:"flex flex-wrap items-center gap-1","data-testid":"db-saved-queries",children:[f("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:i("Saved")}),l.map((C,S)=>_("span",{className:"inline-flex items-center overflow-hidden rounded-md border border-border",children:[f("button",{className:"px-2 py-0.5 text-xs text-foreground transition-colors hover:bg-accent","data-index":S,"data-testid":`db-saved-query-${C.name}`,onClick:b,type:"button",children:C.name}),f("button",{"aria-label":i("Delete saved query {name}",{name:C.name}),className:"border-l border-border px-1 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive","data-index":S,"data-testid":`db-saved-query-delete-${C.name}`,onClick:y,type:"button",children:"✕"})]},C.name))]}),e[18]=b,e[19]=y,e[20]=l,e[21]=i,e[22]=N):N=e[22];let T;return e[23]!==v||e[24]!==w||e[25]!==N?(T=_("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"db-query-bar",children:[v,w,N]}),e[23]=v,e[24]=w,e[25]=N,e[26]=T):T=e[26],T},qe="w-full rounded-md border border-border bg-background px-2 py-1 font-mono text-xs outline-none focus-visible:border-ring",Pt=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,Tt=(o,e)=>typeof e=="boolean"?"boolean":typeof e=="number"?Pt.test(o)?"date":"number":e!==null&&typeof e=="object"?"json":"text",Ro=(o,e,n)=>n===void 0?Tt(o,e):n.enumValues!==void 0&&n.enumValues.length>0?"enum":n.type==="boolean"?"boolean":n.type==="number"?Pt.test(o)?"date":"number":Tt(o,e),$o=o=>{try{const e=JSON.parse(o);return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}catch{return null}},Do=o=>{const e=new Date(o),n=s=>String(s).padStart(2,"0");return`${e.getFullYear().toString()}-${n(e.getMonth()+1)}-${n(e.getDate())}T${n(e.getHours())}:${n(e.getMinutes())}`},Je="\0clear",Io=o=>{const e=L(23),{column:n,nullable:s,onChange:t,value:a}=o,l=re();let i;e[0]!==n||e[1]!==t?(i=x=>{t(n,x)},e[0]=n,e[1]=t,e[2]=i):i=e[2];const r=i;let c;e[3]!==n||e[4]!==t?(c=x=>{t(n,x.target.value===Je?null:x.target.value==="true")},e[3]=n,e[4]=t,e[5]=c):c=e[5];const g=c;if(!s&&a!==null){const x=a===!0,v=`db-field-${n}`;let w;return e[6]!==n||e[7]!==r||e[8]!==x||e[9]!==v?(w=f(gt,{"aria-label":n,checked:x,"data-testid":v,onCheckedChange:r}),e[6]=n,e[7]=r,e[8]=x,e[9]=v,e[10]=w):w=e[10],w}const u=`db-field-${n}`,m=a===!0||a===!1?String(a):Je;let d;e[11]!==l?(d=l("(none)"),e[11]=l,e[12]=d):d=e[12];let p;e[13]!==d?(p=f("option",{value:Je,children:d}),e[13]=d,e[14]=p):p=e[14];let b,h;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=f("option",{value:"true",children:"true"}),h=f("option",{value:"false",children:"false"}),e[15]=b,e[16]=h):(b=e[15],h=e[16]);let y;return e[17]!==n||e[18]!==g||e[19]!==u||e[20]!==m||e[21]!==p?(y=_("select",{"aria-label":n,className:qe,"data-testid":u,onChange:g,value:m,children:[p,b,h]}),e[17]=n,e[18]=g,e[19]=u,e[20]=m,e[21]=p,e[22]=y):y=e[22],y},Mo=o=>{const e=L(23),{column:n,nullable:s,onChange:t,options:a,value:l}=o,i=re(),r=typeof l=="string"?l:null;let c;e[0]!==a||e[1]!==r?(c=r!==null&&!a.includes(r),e[0]=a,e[1]=r,e[2]=c):c=e[2];const g=c;let u;e[3]!==n||e[4]!==t?(u=v=>{t(n,v.target.value===Je?null:v.target.value)},e[3]=n,e[4]=t,e[5]=u):u=e[5];const m=u,d=`db-field-${n}`,p=r??Je;let b;e[6]!==s||e[7]!==r||e[8]!==i?(b=(s||r===null)&&f("option",{value:Je,children:i("(none)")}),e[6]=s,e[7]=r,e[8]=i,e[9]=b):b=e[9];let h;e[10]!==r||e[11]!==g?(h=g&&f("option",{value:r,children:r}),e[10]=r,e[11]=g,e[12]=h):h=e[12];let y;e[13]!==a?(y=a.map(Bo),e[13]=a,e[14]=y):y=e[14];let x;return e[15]!==n||e[16]!==m||e[17]!==d||e[18]!==p||e[19]!==b||e[20]!==h||e[21]!==y?(x=_("select",{"aria-label":n,className:qe,"data-testid":d,onChange:m,value:p,children:[b,h,y]}),e[15]=n,e[16]=m,e[17]=d,e[18]=p,e[19]=b,e[20]=h,e[21]=y,e[22]=x):x=e[22],x},Ao=o=>{const e=L(8),{column:n,onChange:s,value:t}=o;let a;e[0]!==n||e[1]!==s?(a=g=>{const u=Number(g.target.value);g.target.value!==""&&!Number.isNaN(u)&&s(n,u)},e[0]=n,e[1]=s,e[2]=a):a=e[2];const l=a,i=`db-field-${n}`,r=typeof t=="number"?t:"";let c;return e[3]!==n||e[4]!==l||e[5]!==i||e[6]!==r?(c=f("input",{"aria-label":n,className:qe,"data-testid":i,onChange:l,type:"number",value:r}),e[3]=n,e[4]=l,e[5]=i,e[6]=r,e[7]=c):c=e[7],c},Oo=o=>{const e=L(10),{column:n,onChange:s,value:t}=o;let a;e[0]!==n||e[1]!==s?(a=g=>{const u=new Date(g.target.value).getTime();Number.isNaN(u)||s(n,u)},e[0]=n,e[1]=s,e[2]=a):a=e[2];const l=a,i=`db-field-${n}`;let r;e[3]!==t?(r=typeof t=="number"?Do(t):"",e[3]=t,e[4]=r):r=e[4];let c;return e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==r?(c=f("input",{"aria-label":n,className:qe,"data-testid":i,onChange:l,type:"datetime-local",value:r}),e[5]=n,e[6]=l,e[7]=i,e[8]=r,e[9]=c):c=e[9],c},Fo=o=>{const e=L(8),{column:n,onChange:s,value:t}=o;let a;e[0]!==n||e[1]!==s?(a=g=>{s(n,g.target.value)},e[0]=n,e[1]=s,e[2]=a):a=e[2];const l=a,i=`db-field-${n}`,r=typeof t=="string"?t:"";let c;return e[3]!==n||e[4]!==l||e[5]!==i||e[6]!==r?(c=f("input",{"aria-label":n,className:qe,"data-testid":i,onChange:l,type:"text",value:r}),e[3]=n,e[4]=l,e[5]=i,e[6]=r,e[7]=c):c=e[7],c},Po=o=>{const e=L(20),{column:n,onChange:s,value:t}=o,a=re();let l;e[0]!==t?(l=()=>JSON.stringify(t,null,2),e[0]=t,e[1]=l):l=e[1];const[i,r]=M(l),[c,g]=M(!1);let u;e[2]!==n||e[3]!==s?(u=v=>{const w=v.target.value;r(w);try{s(n,JSON.parse(w)),g(!1)}catch{g(!0)}},e[2]=n,e[3]=s,e[4]=u):u=e[4];const m=u,d=c&&"border-destructive";let p;e[5]!==d?(p=tt(qe,"min-h-16",d),e[5]=d,e[6]=p):p=e[6];const b=`db-field-${n}`;let h;e[7]!==n||e[8]!==m||e[9]!==p||e[10]!==b||e[11]!==i?(h=f("textarea",{"aria-label":n,className:p,"data-testid":b,onChange:m,value:i}),e[7]=n,e[8]=m,e[9]=p,e[10]=b,e[11]=i,e[12]=h):h=e[12];let y;e[13]!==n||e[14]!==c||e[15]!==a?(y=c&&f("span",{className:"text-xs text-destructive","data-testid":`db-field-error-${n}`,children:a("Invalid JSON")}),e[13]=n,e[14]=c,e[15]=a,e[16]=y):y=e[16];let x;return e[17]!==h||e[18]!==y?(x=_("div",{className:"flex flex-col gap-1",children:[h,y]}),e[17]=h,e[18]=y,e[19]=x):x=e[19],x},Vo=o=>{const e=L(56),{column:n,meta:s,onChange:t,target:a,value:l}=o;let i;e[0]!==n||e[1]!==s||e[2]!==l?(i=Ro(n,l,s),e[0]=n,e[1]=s,e[2]=l,e[3]=i):i=e[3];const r=i,c=`db-field-${n}`;let g;e[4]!==n?(g=f("span",{className:"font-mono",children:n}),e[4]=n,e[5]=g):g=e[5];let u;e[6]!==n||e[7]!==s?(u=s!==void 0&&f("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide","data-testid":`db-field-type-${n}`,children:s.type}),e[6]=n,e[7]=s,e[8]=u):u=e[8];let m;e[9]!==a?(m=a!==void 0&&_("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide uppercase",children:["→ ",a]}),e[9]=a,e[10]=m):m=e[10];let d;e[11]!==g||e[12]!==u||e[13]!==m?(d=_("span",{className:"flex items-center gap-1.5 font-medium text-muted-foreground",children:[g,u,m]}),e[11]=g,e[12]=u,e[13]=m,e[14]=d):d=e[14];let p;e[15]!==n||e[16]!==r||e[17]!==s?.nullable||e[18]!==t||e[19]!==l?(p=r==="boolean"&&f(Io,{column:n,nullable:s?.nullable===!0,onChange:t,value:l}),e[15]=n,e[16]=r,e[17]=s?.nullable,e[18]=t,e[19]=l,e[20]=p):p=e[20];let b;e[21]!==n||e[22]!==r||e[23]!==s||e[24]!==t||e[25]!==l?(b=r==="enum"&&s?.enumValues!==void 0&&f(Mo,{column:n,nullable:s.nullable===!0,onChange:t,options:s.enumValues,value:l}),e[21]=n,e[22]=r,e[23]=s,e[24]=t,e[25]=l,e[26]=b):b=e[26];let h;e[27]!==n||e[28]!==r||e[29]!==t||e[30]!==l?(h=r==="number"&&f(Ao,{column:n,onChange:t,value:l}),e[27]=n,e[28]=r,e[29]=t,e[30]=l,e[31]=h):h=e[31];let y;e[32]!==n||e[33]!==r||e[34]!==t||e[35]!==l?(y=r==="date"&&f(Oo,{column:n,onChange:t,value:l}),e[32]=n,e[33]=r,e[34]=t,e[35]=l,e[36]=y):y=e[36];let x;e[37]!==n||e[38]!==r||e[39]!==t||e[40]!==l?(x=r==="json"&&f(Po,{column:n,onChange:t,value:l}),e[37]=n,e[38]=r,e[39]=t,e[40]=l,e[41]=x):x=e[41];let v;e[42]!==n||e[43]!==r||e[44]!==t||e[45]!==l?(v=r==="text"&&f(Fo,{column:n,onChange:t,value:l}),e[42]=n,e[43]=r,e[44]=t,e[45]=l,e[46]=v):v=e[46];let w;return e[47]!==y||e[48]!==x||e[49]!==v||e[50]!==c||e[51]!==d||e[52]!==p||e[53]!==b||e[54]!==h?(w=_("label",{className:"flex flex-col gap-1 text-xs",htmlFor:c,children:[d,p,b,h,y,x,v]}),e[47]=y,e[48]=x,e[49]=v,e[50]=c,e[51]=d,e[52]=p,e[53]=b,e[54]=h,e[55]=w):w=e[55],w},Lo=o=>{const e=L(49),{columnMeta:n,documentText:s,onCancel:t,onDocumentTextChange:a,onSave:l,refs:i}=o,r=re();let c;e[0]!==s?(c=$o(s),e[0]=s,e[1]=c):c=e[1];const g=c,[u,m]=M(!1),d=!u&&g!==null;let p;e[2]!==g||e[3]!==a?(p=(H,G)=>{a(JSON.stringify({...g,[H]:G},null,2))},e[2]=g,e[3]=a,e[4]=p):p=e[4];const b=p;let h;e[5]!==a?(h=H=>{a(H.target.value)},e[5]=a,e[6]=h):h=e[6];const y=h;let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{m(!1)},e[7]=x):x=e[7];const v=x;let w;e[8]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{m(!0)},e[8]=w):w=e[8];const N=w,T=g===null;let C;e[9]!==r?(C=r("Form"),e[9]=r,e[10]=C):C=e[10];let S;e[11]!==d||e[12]!==T||e[13]!==C?(S=f("button",{"aria-pressed":d,className:Ie,"data-testid":"db-editor-form",disabled:T,onClick:v,type:"button",children:C}),e[11]=d,e[12]=T,e[13]=C,e[14]=S):S=e[14];const k=!d;let A;e[15]!==r?(A=r("JSON"),e[15]=r,e[16]=A):A=e[16];let $;e[17]!==A||e[18]!==k?($=f("button",{"aria-pressed":k,className:Ie,"data-testid":"db-editor-json",onClick:N,type:"button",children:A}),e[17]=A,e[18]=k,e[19]=$):$=e[19];let E;e[20]!==$||e[21]!==S?(E=_("div",{className:"flex items-center gap-1.5",children:[S,$]}),e[20]=$,e[21]=S,e[22]=E):E=e[22];let D;e[23]!==n||e[24]!==s||e[25]!==g||e[26]!==b||e[27]!==y||e[28]!==i||e[29]!==d||e[30]!==r?(D=d?f("div",{className:"flex flex-col gap-3","data-testid":"db-editor-fields",children:Object.entries(g).map(H=>{const[G,U]=H;return f(Vo,{column:G,meta:n?.[G],onChange:b,target:i?.[G],value:U},G)})}):f("textarea",{"aria-label":r("Row document JSON"),className:"min-h-28 w-full rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"db-editor-doc",onChange:y,value:s}),e[23]=n,e[24]=s,e[25]=g,e[26]=b,e[27]=y,e[28]=i,e[29]=d,e[30]=r,e[31]=D):D=e[31];let R;e[32]!==r?(R=r("Save"),e[32]=r,e[33]=R):R=e[33];let q;e[34]!==l||e[35]!==R?(q=f("button",{className:Ie,"data-testid":"db-editor-save",onClick:l,type:"button",children:R}),e[34]=l,e[35]=R,e[36]=q):q=e[36];let O;e[37]!==r?(O=r("Cancel"),e[37]=r,e[38]=O):O=e[38];let B;e[39]!==t||e[40]!==O?(B=f("button",{className:Ie,"data-testid":"db-editor-cancel",onClick:t,type:"button",children:O}),e[39]=t,e[40]=O,e[41]=B):B=e[41];let F;e[42]!==q||e[43]!==B?(F=_("div",{className:"flex items-center gap-1.5",children:[q,B]}),e[42]=q,e[43]=B,e[44]=F):F=e[44];let J;return e[45]!==E||e[46]!==D||e[47]!==F?(J=_("div",{className:"flex flex-col gap-2 border border-border bg-card p-3","data-testid":"db-editor",children:[E,D,F]}),e[45]=E,e[46]=D,e[47]=F,e[48]=J):J=e[48],J};function Bo(o){return f("option",{value:o,children:o},o)}const zo=o=>{const e=L(61),{columns:n,editable:s,filter:t,filters:a,hasMaskedColumns:l,liveError:i,maskOn:r,onAddRow:c,onBulkDelete:g,onAskAiFilter:u,onClearTable:m,onFilterChange:d,onFiltersChange:p,onGenerateRows:b,onShowJson:h,onShowTable:y,onToggleMask:x,total:v,viewMode:w}=o,N=re(),T=w==="table";let C;e[0]!==y||e[1]!==T?(C=f("button",{"aria-pressed":T,className:Ie,"data-testid":"db-view-table",onClick:y,type:"button",children:"Table"}),e[0]=y,e[1]=T,e[2]=C):C=e[2];const S=w==="json";let k;e[3]!==h||e[4]!==S?(k=f("button",{"aria-pressed":S,className:Ie,"data-testid":"db-view-json",onClick:h,type:"button",children:"JSON"}),e[3]=h,e[4]=S,e[5]=k):k=e[5];let A;e[6]!==i||e[7]!==N?(A=i===void 0?N("Live — changes stream in automatically"):N("Live unavailable: {liveError}",{liveError:i}),e[6]=i,e[7]=N,e[8]=A):A=e[8];const $=`size-1.5 rounded-full ${i===void 0?"bg-success":"bg-muted-foreground/50"}`;let E;e[9]!==$?(E=f("span",{"aria-hidden":"true",className:$}),e[9]=$,e[10]=E):E=e[10];let D;e[11]!==i||e[12]!==N?(D=N(i===void 0?"Live":"Live unavailable"),e[11]=i,e[12]=N,e[13]=D):D=e[13];let R;e[14]!==A||e[15]!==E||e[16]!==D?(R=_("span",{className:"inline-flex items-center gap-1.5 px-1 text-xs font-medium text-muted-foreground","data-testid":"db-live-indicator",role:"status",title:A,children:[E,D]}),e[14]=A,e[15]=E,e[16]=D,e[17]=R):R=e[17];let q;e[18]!==l||e[19]!==r||e[20]!==x||e[21]!==N?(q=l&&f("button",{"aria-pressed":r,className:Ie,"data-testid":"db-mask-toggle",onClick:x,type:"button",children:N("Mask sensitive columns")}),e[18]=l,e[19]=r,e[20]=x,e[21]=N,e[22]=q):q=e[22];let O;e[23]!==s||e[24]!==c?(O=s&&f("button",{className:Ie,"data-testid":"db-add-row",onClick:c,type:"button",children:"Add row"}),e[23]=s,e[24]=c,e[25]=O):O=e[25];let B;e[26]!==s||e[27]!==b||e[28]!==N?(B=s&&f("button",{className:Ie,"data-testid":"db-generate-rows",onClick:b,type:"button",children:N("Generate rows")}),e[26]=s,e[27]=b,e[28]=N,e[29]=B):B=e[29];let F;e[30]!==s||e[31]!==t||e[32]!==a||e[33]!==g||e[34]!==v?(F=s&&v>0&&(t!==""||a.length>0)&&f(ut,{confirmLabel:`Delete ${v.toString()} matching?`,onConfirm:g,testId:"db-bulk-delete",children:`Delete ${v.toString()} matching`}),e[30]=s,e[31]=t,e[32]=a,e[33]=g,e[34]=v,e[35]=F):F=e[35];let J;e[36]!==s||e[37]!==t||e[38]!==a||e[39]!==m||e[40]!==v?(J=s&&v>0&&t===""&&a.length===0&&f(ut,{confirmLabel:`Clear all ${v.toString()} rows?`,onConfirm:m,testId:"db-clear-table",children:`Clear table (${v.toString()})`}),e[36]=s,e[37]=t,e[38]=a,e[39]=m,e[40]=v,e[41]=J):J=e[41];let H;e[42]!==q||e[43]!==O||e[44]!==B||e[45]!==F||e[46]!==J||e[47]!==C||e[48]!==k||e[49]!==R?(H=_("div",{className:"flex flex-wrap items-center gap-1.5",children:[C,k,R,q,O,B,F,J]}),e[42]=q,e[43]=O,e[44]=B,e[45]=F,e[46]=J,e[47]=C,e[48]=k,e[49]=R,e[50]=H):H=e[50];let G;e[51]!==n||e[52]!==t||e[53]!==a||e[54]!==u||e[55]!==d||e[56]!==p?(G=f(Mn,{columns:n,filters:a,onAskAi:u,onFiltersChange:p,onSearchChange:d,search:t}),e[51]=n,e[52]=t,e[53]=a,e[54]=u,e[55]=d,e[56]=p,e[57]=G):G=e[57];let U;return e[58]!==H||e[59]!==G?(U=_("div",{className:"flex flex-col gap-2","data-testid":"db-view-toggle",children:[H,G]}),e[58]=H,e[59]=G,e[60]=U):U=e[60],U},jo=o=>{const e=L(104),{assistant:n,backRelations:s,browser:t,columnMeta:a,edit:l,editable:i,onAskAiFilter:r,onInspect:c,onOpenGenerateRows:g,onSaveQuery:u,page:m,preferences:d,queryBar:p,references:b}=o,h=d.maskColumns.size>0,y=n.unavailable?void 0:r;let x;e[0]!==t.addRow||e[1]!==t.bulkDelete||e[2]!==t.clearTable||e[3]!==t.columns||e[4]!==t.filter||e[5]!==t.filters||e[6]!==t.liveError||e[7]!==t.onFilterChange||e[8]!==t.onFiltersChange||e[9]!==t.showJson||e[10]!==t.showTable||e[11]!==t.total||e[12]!==t.viewMode||e[13]!==i||e[14]!==g||e[15]!==d.maskOn||e[16]!==d.onToggleMask||e[17]!==h||e[18]!==y?(x=f(zo,{columns:t.columns,editable:i,filter:t.filter,filters:t.filters,hasMaskedColumns:h,liveError:t.liveError,maskOn:d.maskOn,onAddRow:t.addRow,onAskAiFilter:y,onBulkDelete:t.bulkDelete,onClearTable:t.clearTable,onFilterChange:t.onFilterChange,onFiltersChange:t.onFiltersChange,onGenerateRows:g,onShowJson:t.showJson,onShowTable:t.showTable,onToggleMask:d.onToggleMask,total:t.total,viewMode:t.viewMode}),e[0]=t.addRow,e[1]=t.bulkDelete,e[2]=t.clearTable,e[3]=t.columns,e[4]=t.filter,e[5]=t.filters,e[6]=t.liveError,e[7]=t.onFilterChange,e[8]=t.onFiltersChange,e[9]=t.showJson,e[10]=t.showTable,e[11]=t.total,e[12]=t.viewMode,e[13]=i,e[14]=g,e[15]=d.maskOn,e[16]=d.onToggleMask,e[17]=h,e[18]=y,e[19]=x):x=e[19];let v;e[20]!==u||e[21]!==p?(v=p!==void 0&&f(_o,{onApply:p.onApplyQuery,onCopyLink:p.onCopyLink,onDelete:p.onDeleteQuery,onSave:u,saved:p.saved}),e[20]=u,e[21]=p,e[22]=v):v=e[22];let w;e[23]!==s||e[24]!==t.onBulkDeleteSelected||e[25]!==t.selectedTable||e[26]!==t.table||e[27]!==t.viewMode||e[28]!==i||e[29]!==m||e[30]!==d.maskView||e[31]!==d.onToggleTranspose||e[32]!==d.transposed?(w=t.viewMode==="table"&&m.rows.length>0&&f(An,{backRelations:s.available,columns:m.columns,editable:i,enabledBackRelations:s.enabled,name:t.selectedTable??"export",onBulkDelete:t.onBulkDeleteSelected,onToggleBackRelation:s.onToggle,onToggleTranspose:d.onToggleTranspose,rows:lt(m.rows,d.maskView),table:t.table.table,transposed:d.transposed}),e[23]=s,e[24]=t.onBulkDeleteSelected,e[25]=t.selectedTable,e[26]=t.table,e[27]=t.viewMode,e[28]=i,e[29]=m,e[30]=d.maskView,e[31]=d.onToggleTranspose,e[32]=d.transposed,e[33]=w):w=e[33];let N;e[34]!==t.cancelEdit||e[35]!==t.editing||e[36]!==t.saveEdit||e[37]!==t.setEditorDocumentText||e[38]!==a||e[39]!==i||e[40]!==m?(N=i&&t.editing!==null&&f(Lo,{columnMeta:a,documentText:t.editing.docText,onCancel:t.cancelEdit,onDocumentTextChange:t.setEditorDocumentText,onSave:t.saveEdit,refs:m.refs}),e[34]=t.cancelEdit,e[35]=t.editing,e[36]=t.saveEdit,e[37]=t.setEditorDocumentText,e[38]=a,e[39]=i,e[40]=m,e[41]=N):N=e[41];let T;e[42]!==t.committing||e[43]!==t.discardStaged||e[44]!==t.onCommitStaged||e[45]!==t.stagedChanges||e[46]!==i?(T=i&&t.stagedChanges.length>0&&f(qn,{changes:t.stagedChanges,committing:t.committing,onCommit:t.onCommitStaged,onDiscard:t.discardStaged}),e[42]=t.committing,e[43]=t.discardStaged,e[44]=t.onCommitStaged,e[45]=t.stagedChanges,e[46]=i,e[47]=T):T=e[47];let C;e[48]!==t.writeError?(C=t.writeError!==null&&f("p",{className:"text-sm text-destructive","data-testid":"db-write-error",role:"alert",children:t.writeError}),e[48]=t.writeError,e[49]=C):C=e[49];let S;e[50]!==x||e[51]!==v||e[52]!==w||e[53]!==N||e[54]!==T||e[55]!==C?(S=_("div",{className:"flex shrink-0 flex-col gap-2 border-b border-border px-4 py-3",children:[x,v,w,N,T,C]}),e[50]=x,e[51]=v,e[52]=w,e[53]=N,e[54]=T,e[55]=C,e[56]=S):S=e[56];let k;e[57]!==t.viewMode||e[58]!==m?(k=t.viewMode==="table"&&m.rows.length===0&&f("div",{className:"flex flex-1 items-center justify-center p-6",children:f(Nn,{description:"Rows you insert into this table will show up here.",icon:f("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:f("path",{d:"M4 5h16v14H4V5Zm0 5h16M10 10v9M4 14.5h16"})}),testId:"db-empty-rows",title:"This table is empty."})}),e[57]=t.viewMode,e[58]=m,e[59]=k):k=e[59];let A;e[60]!==t.viewMode||e[61]!==m||e[62]!==d.maskView||e[63]!==d.transposed?(A=t.viewMode==="table"&&m.rows.length>0&&d.transposed&&f(In,{columns:m.columns,rows:lt(m.rows,d.maskView)}),e[60]=t.viewMode,e[61]=m,e[62]=d.maskView,e[63]=d.transposed,e[64]=A):A=e[64];let $;e[65]!==s||e[66]!==t.filter||e[67]!==t.onRowDelete||e[68]!==t.onRowEdit||e[69]!==t.table||e[70]!==t.viewMode||e[71]!==a||e[72]!==l||e[73]!==i||e[74]!==c||e[75]!==m||e[76]!==d.maskView||e[77]!==d.onTogglePin||e[78]!==d.pinnedColumns||e[79]!==d.transposed||e[80]!==b?($=t.viewMode==="table"&&m.rows.length>0&&!d.transposed&&f(vo,{backRelationCounts:s.counts,columnMeta:a,edit:l,editable:i,highlight:t.filter,mask:d.maskView,onDelete:t.onRowDelete,onEdit:t.onRowEdit,onInspect:c,onTogglePin:d.onTogglePin,pinnedColumns:d.pinnedColumns,refs:b,tableModel:t.table}),e[65]=s,e[66]=t.filter,e[67]=t.onRowDelete,e[68]=t.onRowEdit,e[69]=t.table,e[70]=t.viewMode,e[71]=a,e[72]=l,e[73]=i,e[74]=c,e[75]=m,e[76]=d.maskView,e[77]=d.onTogglePin,e[78]=d.pinnedColumns,e[79]=d.transposed,e[80]=b,e[81]=$):$=e[81];let E;e[82]!==t.viewMode||e[83]!==m||e[84]!==d.maskView?(E=t.viewMode==="json"&&f("pre",{className:"min-h-0 flex-1 overflow-auto border-t border-border bg-muted/30 p-3 text-xs","data-testid":"db-json",children:JSON.stringify(lt(m.rows,d.maskView),pn,2)}),e[82]=t.viewMode,e[83]=m,e[84]=d.maskView,e[85]=E):E=e[85];let D;e[86]!==t.changePageSize||e[87]!==t.goNext||e[88]!==t.goPrevious||e[89]!==t.hasNext||e[90]!==t.hasPrevious||e[91]!==t.jumpToPage||e[92]!==t.pageSize||e[93]!==t.rangeEnd||e[94]!==t.rangeStart||e[95]!==t.total?(D=f("div",{className:"flex shrink-0 items-center border-t border-border px-4 py-2",children:f(xn,{hasNext:t.hasNext,hasPrevious:t.hasPrevious,onJumpToPage:t.jumpToPage,onNext:t.goNext,onPageSizeChange:t.changePageSize,onPrevious:t.goPrevious,pageSize:t.pageSize,prefix:"db",rangeEnd:t.rangeEnd,rangeStart:t.rangeStart,total:t.total})}),e[86]=t.changePageSize,e[87]=t.goNext,e[88]=t.goPrevious,e[89]=t.hasNext,e[90]=t.hasPrevious,e[91]=t.jumpToPage,e[92]=t.pageSize,e[93]=t.rangeEnd,e[94]=t.rangeStart,e[95]=t.total,e[96]=D):D=e[96];let R;return e[97]!==k||e[98]!==A||e[99]!==$||e[100]!==E||e[101]!==D||e[102]!==S?(R=_("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"db-page",children:[S,k,A,$,E,D]}),e[97]=k,e[98]=A,e[99]=$,e[100]=E,e[101]=D,e[102]=S,e[103]=R):R=e[103],R},Go="/__lunora/seed",at=200,Jo=50,qo=(o,e)=>{const n=[];for(const s of o)s.pk!==!0&&s.ref!==void 0&&s.type==="id"&&(e[s.ref]??[]).length===0&&n.push(s.name);return n},Ko=async o=>{const e=await fetch(Go,{body:JSON.stringify(o),headers:{"Content-Type":"application/json"},method:"POST"}),n=await e.json();return e.ok&&n.rows!==void 0?{kind:"ok",rows:n.rows}:{kind:"error",message:n.error??`seed request failed (${String(e.status)})`}},Wo="rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",Ho="rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50",Qo=({columns:o,fkPools:e,onClose:n,onInsertRows:s,table:t})=>{const a=re(),[l,i]=M(10),[r,c]=M(!1),[g,u]=M(void 0),[m,d]=M(void 0),[p,b]=M(0),h=w=>{const N=Number(w.target.value);!Number.isNaN(N)&&N>=1&&i(Math.min(N,at))},y=async()=>{u(void 0),d(void 0),b(0),c(!0);try{const w=await Ko({count:l,existingIds:e,seed:Date.now(),table:t});if(w.kind==="error"){u(w.message);return}const{rows:N}=w;if(N.length===0){u(a("No rows generated — all columns were skipped."));return}const T=await s(N);if(T.error!==void 0){u(T.error);return}d(T.inserted),b(T.conflicts);const C=qo(o,e);C.length>0&&u(a("Inserted {count} rows. Skipped FK columns: {cols}",{cols:C.join(", "),count:T.inserted.toString()}))}finally{c(!1)}},x=()=>{be(y())},v=o.filter(w=>w.pk!==!0);return _(It,{label:a("Generate dummy rows"),onClose:n,panelTestId:"gen-rows-panel",testId:"gen-rows-overlay",variant:"dialog",children:[_("div",{className:"flex items-start justify-between",children:[_("div",{className:"flex flex-col gap-0.5",children:[f("h3",{className:"text-base text-foreground","data-testid":"gen-rows-title",children:a("Generate dummy rows")}),f("p",{className:"text-xs text-muted-foreground","data-testid":"gen-rows-desc",children:a("Seed {table} with Faker-generated rows. Existing rows are not affected.",{table:t})})]}),f("button",{className:"text-xs text-muted-foreground hover:text-foreground","data-testid":"gen-rows-close",onClick:n,type:"button",children:a("Close")})]}),_("div",{className:"flex items-center gap-2",children:[f("label",{className:"text-xs font-medium text-foreground",htmlFor:"gen-rows-count",children:a("Row count")}),f("input",{className:"w-20 rounded-md border border-border bg-background px-2 py-1 text-xs outline-none focus-visible:border-ring","data-testid":"gen-rows-count",id:"gen-rows-count",max:at,min:1,onChange:h,type:"number",value:l}),f("span",{className:"text-xs text-muted-foreground",children:a("(max {max})",{max:at.toString()})})]}),v.length>0&&_("div",{className:"flex flex-col gap-1",children:[f("p",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:a("Columns to seed")}),f("ul",{className:"flex flex-col gap-0.5","data-testid":"gen-rows-columns",children:v.map(w=>{const N=w.ref!==void 0&&w.type==="id",T=N&&(e[w.ref??""]??[]).length===0,C=T?"rounded bg-destructive/10 px-1 text-destructive":"rounded bg-muted px-1 text-muted-foreground",S=T?`gen-rows-fk-empty-${w.name}`:`gen-rows-fk-ok-${w.name}`,k=T?a("FK: no rows in {ref} — will skip",{ref:w.ref??""}):a("→ {ref}",{ref:w.ref??""});return _("li",{className:"flex items-center gap-1.5 font-mono text-xs",children:[f("span",{className:"text-foreground",children:w.name}),_("span",{className:"text-muted-foreground",children:["(",w.type,")"]}),w.optional&&f("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide uppercase",children:"optional"}),N&&f("span",{className:C,"data-testid":S,children:k})]},w.name)})})]}),g!==void 0&&f("p",{className:"text-xs text-destructive","data-testid":"gen-rows-error",role:"alert",children:g}),m!==void 0&&g===void 0&&f("p",{className:"text-xs text-success","data-testid":"gen-rows-success",children:p>0?a("Inserted {inserted} of {total} rows — {conflicts} skipped as id conflicts.",{conflicts:p.toString(),inserted:m.toString(),total:(m+p).toString()}):a("Inserted {count} rows successfully.",{count:m.toString()})}),_("div",{className:"flex justify-end gap-2",children:[f("button",{className:Wo,"data-testid":"gen-rows-cancel",onClick:n,type:"button",children:a("Cancel")}),f("button",{className:Ho,"data-testid":"gen-rows-generate",disabled:r,onClick:x,type:"button",children:a(r?"Inserting…":"Generate & insert")})]})]})},Uo=Te(le.backRelationCounts),Yo=(o,e,n,s)=>{const t=L(16),a=ot();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l={},t[0]=l):l=t[0];const[i,r]=M(l);let c;if(t[1]!==o||t[2]!==e){let y;t[4]!==o?(y=x=>o.has(pt(x)),t[4]=o,t[5]=y):y=t[5],c=e.filter(y),t[1]=o,t[2]=e,t[3]=c}else c=t[3];const g=c;let u;t[6]!==n||t[7]!==g?(u=JSON.stringify([g,n]),t[6]=n,t[7]=g,t[8]=u):u=t[8];const m=u;let d;t[9]!==a||t[10]!==s||t[11]!==m?(d=async y=>{const[x,v]=JSON.parse(m);if(x.length===0||v.length===0){y.cancelled||r({});return}try{const w=await a.query(Uo,{ids:v,relations:x},we(s));y.cancelled||r(Object.fromEntries(w.relations.map(Xo)))}catch{}},t[9]=a,t[10]=s,t[11]=m,t[12]=d):d=t[12];const p=d;let b,h;return t[13]!==p?(b=()=>{const y={cancelled:!1};return be(p(y)),()=>{y.cancelled=!0}},h=[p],t[13]=p,t[14]=b,t[15]=h):(b=t[14],h=t[15]),Le(b,h),i};function Xo(o){return[pt(o),o.counts]}const Ze=o=>{const e=o[0];return e===void 0?void 0:{column:e.id,direction:e.desc?"desc":"asc"}},Vt=o=>o==null?"":typeof o=="object"?JSON.stringify(o):String(o),Et=o=>o.map(e=>({column:e.column,operator:e.operator,value:e.value===void 0?"":Vt(e.value)})),_t=o=>o===void 0?[]:[{desc:o.direction==="desc",id:o.column}],Zo=o=>[o.column,o.operator,o.value],Ye=(o,e,n,s)=>JSON.stringify([o??"",e??"",(n??[]).map(t=>Zo(t)),s===void 0?null:[s.column,s.direction]]),Rt=200,es=20,ts=Te(le.readTablePage),ns=Te(le.facetColumn),ct=Te(le.writeRow),os=Te(le.deleteRows),ss=Te(le.clearTable),ls={},ht=new Set(["__doc__","__id__","_creationTime","_id","id"]),rs=o=>{const e=o.__doc__;if(typeof e=="string"){const s=Ln(e);if(s!==void 0)return s}const n={};for(const[s,t]of Object.entries(o))ht.has(s)||(n[s]=t);return n},is=({filters:o,offset:e,pageSize:n,search:s,sorting:t,table:a})=>({filters:Ve(o),limit:n,offset:e,orderBy:Ze(t),search:s,skipCount:!0,table:a}),as=({filters:o,search:e,table:n})=>({filters:Ve(o),limit:1,search:e,table:n}),cs=(o,e)=>{const n=new Map;for(const t of o?.rows??[]){const a=ke(t);a!==null&&n.set(a,t)}const s=[];for(const[t,a]of Object.entries(e))for(const[l,i]of Object.entries(a))s.push({column:l,newValue:i,oldValue:n.get(t)?.[l],rowId:t});return s},ds=o=>!ht.has(o),us=({initialFilters:o,initialOrderBy:e,initialSearch:n,initialShardKey:s,onSelectTable:t,onViewChange:a,pageSize:l,resolveBackRelations:i,tableParam:r})=>{const c=ot(),[g,u]=M(l),[m,d]=M(s??""),p=r===void 0||r===""?null:r,[b,h]=M(0),[y,x]=M("table"),[v,w]=M(()=>_t(e)),[N,T]=M(n??""),[C,S]=M(()=>Et(o??[])),{clearFacets:k,facets:A,refetchFacets:$,toggleFacet:E}=vn(),[D,R]=M(null),[q,O]=M(null),B=Jn(),[F,J]=M(null),[H,G]=M(!1),[U,ye]=M(r),[ie,he]=M(()=>Ye(s,n,o,e)),[xe,Se]=M(0),[ce,Ce]=M(()=>Ye(s,n,o,e)),de=r!==U,Z=Ye(s,n,o,e),ue=de||!de&&Z!==ie&&Z!==ce;if(ue){ye(r),he(Z),Se(V=>V+1),w(_t(e)),T(n??"");const I=Et(o??[]);S(I),d(s??""),k(),B.clear(),J(null),h(0)}else Z!==ie&&he(Z);const fe=ue?n??"":N,se=ue?s??"":m,me=`${r??""}:${xe.toString()}`,Y=vt(fe.trim(),300,me),j=vt(se.trim(),400,me),te=Ye(j,Y,Ve(C),Ze(v));te!==ce&&Ce(te);const ne=Xe(le.listTables,ls,{live:!0,shardKey:j}),Me=ne.data??null,oe=ne.error,W=is({filters:C,offset:b,pageSize:g,search:Y,sorting:v,table:p??""}),ee=as({filters:C,search:Y,table:p??""}),Q=Xe(le.readTablePage,W,{enabled:p!==null,keepPreviousData:!1,live:!0,shardKey:j}),z=Q.data??null,ge=Q.error,{liveError:K}=Q,Ee=Xe(le.readTablePage,ee,{enabled:p!==null,live:!0,shardKey:j});Le(()=>{ne.data!==void 0&&Bn(j)},[ne.data,j]);const Ae=I=>{t?.(I)},Oe=(I,V)=>{t?.(I,{search:V})},Fe=async(I,V)=>{try{return(await c.query(ts,{filters:[],limit:es,offset:0,search:V,table:I},we(j))).rows.find(ve=>ke(ve)===V)??null}catch{return null}},ze=(I,V,ae,ve)=>De=>c.query(ns,{column:De,filters:Ve(ae),search:ve,table:V},we(I)),pe=I=>{E(I,p===null?null:ze(j,p,C,Y))},je=(I,V)=>{const ae=Vt(V);S(ve=>[...ve.filter(De=>De.column!==I),{column:I,operator:"eq",value:ae}]),h(0)},Pe=rt(ze),Ke=rt($),Qe=rt(a);Le(()=>{p!==null&&Ke.current(Pe.current(j,p,C,Y))},[j,p,C,Y]),Le(()=>{p===null||Qe.current===void 0||U!==r||ie!==Z||Qe.current({filters:Ve(C),orderBy:Ze(v),search:Y,shard:j})},[p,r,U,ie,Z,C,v,Y,j]);const We=I=>{p!==null&&h(Math.max(0,I))},st=(I,V)=>{J({column:V,rowId:I})},P=()=>{J(null)},X=async()=>{if(p!==null){O(null),G(!0);try{for(const[I,V]of Object.entries(B.staged))await c.query(ct,{doc:V,id:I,op:"patch",table:p},we(j));B.clear(),J(null),Q.refetch()}catch(I){O(I.message)}G(!1)}},_e=()=>{B.clear(),J(null)},Re=cs(z,B.staged),$e=async(I,V,ae)=>{if(p===null)return;O(null);let ve;if(I!=="delete"){let De;try{De=ae===void 0||ae.trim()===""?{}:JSON.parse(ae)}catch(Ge){O(`Invalid JSON: ${Ge.message}`);return}try{const Ge=Pn(De);if(!Vn(Ge)){O("The document must be a JSON object.");return}ve=Ge}catch(Ge){O(`Invalid document: ${Ge.message}`);return}}try{await c.query(ct,{doc:ve,id:V??void 0,op:I,table:p},we(j)),R(null),Q.refetch()}catch(De){O(De.message)}},Ue=async(I,V)=>{if(p!==null){O(null);try{let ae="cap-hit";for(let ve=0;ve<Rt;ve+=1)if(!(await c.query(I,V,we(j))).hasMore){ae="completed";break}h(0),Q.refetch(),ae==="cap-hit"&&O(`Stopped after ${Rt.toString()} batches — rows still match this delete. Run it again to remove the rest.`)}catch(ae){O(ae.message)}}},Lt=I=>{w(I),h(0)},Bt=dt(()=>p===null?[]:i?.(p)??[],[i,p]),zt=wo(z,v,Lt,Bt),jt={filters:Ve(C),orderBy:Ze(v),search:Y,shard:m,table:p??void 0},xt=Ee.data?.total??(z===null?0:b+z.rows.length),Gt=b>0,Jt=z!==null&&b+z.rows.length<xt,qt=z===null||z.rows.length===0?0:b+1,Kt=z===null?0:b+z.rows.length,Wt=()=>{ne.refetch()},Ht=()=>{x("table")},Qt=()=>{x("json")},Ut=()=>{be(Ue(os,{filters:Ve(C),search:Y,table:p}))},Yt=()=>{be(Ue(ss,{table:p}))},Xt=I=>{T(I.target.value),h(0)},Zt=I=>{S(I),h(0)},en=()=>{O(null);const I={};for(const V of z?.columns??[])ht.has(V)||(I[V]="");R({docText:JSON.stringify(I,null,2),id:""})},tn=I=>{R(V=>V===null?V:{docText:I,id:V.id})},nn=()=>{D!==null&&be($e(D.id===""?"insert":"patch",D.id===""?null:D.id,D.docText))},on=()=>{R(null),O(null)},sn=()=>{We(b-g)},ln=()=>{We(b+g)},rn=I=>{We(Math.max(0,(I-1)*g))},an=I=>{u(I),h(0)},cn=(I,V)=>{O(null),R({docText:JSON.stringify(Fn(rs(V)),null,2),id:I})},dn=I=>{be($e("delete",I))},un=async I=>{if(!(p===null||I.length===0)){O(null);try{for(const V of I)await c.query(ct,{id:V,op:"delete",table:p},we(j));Q.refetch()}catch(V){O(V.message)}}},fn=I=>{be(un(I))},mn=()=>{be(X())};return{addRow:en,bulkDelete:Ut,cancelCellEdit:P,cancelEdit:on,changePageSize:an,clearTable:Yt,columns:z?.columns??[],committing:H,currentView:jt,discardStaged:_e,editableColumn:ds,editing:D,editingCell:F,facetFilter:je,facets:A,filter:N,filters:C,goNext:ln,goPrevious:sn,hasNext:Jt,hasPrevious:Gt,jumpToPage:rn,liveError:K,loadTables:Wt,navigateToRef:Oe,onBulkDeleteSelected:fn,onCommitStaged:mn,onFilterChange:Xt,onFiltersChange:Zt,onRowDelete:dn,onRowEdit:cn,page:z,previewRef:Fe,pageError:ge,pageSize:g,rangeEnd:Kt,rangeStart:qt,queryShardKey:j,saveEdit:nn,selectedTable:p,selectTable:Ae,setEditorDocumentText:tn,setShardKey:d,shardKey:m,showJson:Qt,showTable:Ht,stage:B.stage,stagedChanges:Re,stagedValue:B.stagedValue,startCellEdit:st,table:zt,tables:Me,tablesError:oe,toggleFacet:pe,total:xt,viewMode:y,writeError:q}},fs="lunora-studio-pinned-columns",ms=o=>{const e=L(21),{columns:n,initialPins:s,selectedTable:t}=o;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];const[l,i]=$t(fs,a),r=t??"",c=l[r];let g;e[1]!==s||e[2]!==c?(g=c===void 0?new Set((s??"").split(",").filter(gs)):new Set(c),e[1]=s,e[2]=c,e[3]=g):g=e[3];const u=g;let m;e[4]!==r||e[5]!==u||e[6]!==i?(m=k=>{i(A=>{const $=A[r]??[...u],E=$.includes(k)?$.filter(D=>D!==k):[...$,k];return{...A,[r]:E}})},e[4]=r,e[5]=u,e[6]=i,e[7]=m):m=e[7];const d=m,[p,b]=M(!1);let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{b(ps)},e[8]=h):h=e[8];const y=h;let x;e[9]!==n||e[10]!==t?(x={columns:n,selectedTable:t},e[9]=n,e[10]=t,e[11]=x):x=e[11];const{maskColumns:v,maskOn:w,maskView:N,maskViewFor:T,onToggleMask:C}=wn(x);let S;return e[12]!==v||e[13]!==w||e[14]!==N||e[15]!==T||e[16]!==C||e[17]!==d||e[18]!==u||e[19]!==p?(S={maskColumns:v,maskOn:w,maskView:N,maskViewFor:T,onToggleMask:C,onTogglePin:d,onToggleTranspose:y,pinnedColumns:u,transposed:p},e[12]=v,e[13]=w,e[14]=N,e[15]=T,e[16]=C,e[17]=d,e[18]=u,e[19]=p,e[20]=S):S=e[20],S};function gs(o){return o!==""}function ps(o){return!o}const bs=Te(le.describeTable),hs=Te(le.readTablePage),xs=Te(le.importShard),vs=o=>{const e=o._id??o.id??o.__id__??"";return typeof e=="string"?e:typeof e=="number"?String(e):""},ws=o=>{const e=Object.values(o.inserted).reduce((r,c)=>r+c,0),[n]=o.errors;if(n===void 0)return{conflicts:o.conflicts,error:void 0,inserted:e};const s=o.errors.length-1,t=e+o.conflicts+o.errors.length,a=s===1?"error":"errors",l=s>0?` (+${s.toString()} more ${a})`:"",i=`Inserted ${e.toString()} of ${t.toString()} rows — row ${n.line.toString()} (${n.table}): ${n.message}${l}`;return{conflicts:o.conflicts,error:i,inserted:e}},ys=o=>{const e=ot(),[n,s]=M(!1),[t,a]=M(void 0),[l,i]=M(void 0),[r,c]=M(void 0),[g,u]=M({}),[m,d]=M(!1),[p,b]=M(void 0),h=async(w,N)=>{s(!0),a(w),i(N),c(void 0),u({}),b(void 0),d(!0);try{const T=await e.query(bs,{table:w},we(N)),{columns:C}=T;c(C);const S={},k=C.filter(A=>A.ref!==void 0&&A.type==="id"&&A.pk!==!0);for(const A of k){if(A.ref===void 0)continue;const{ref:$}=A;if(S[$]===void 0)try{const E=await e.query(hs,{filters:[],limit:Jo,offset:0,search:"",table:$},we(N));S[$]=E.rows.flatMap(D=>vs(D)||[])}catch{S[$]=[]}}u(S)}catch(T){b(T.message)}d(!1)};return{closeDialog:()=>{s(!1),a(void 0),i(void 0),c(void 0),u({}),b(void 0)},columnMeta:r,error:p,fkPools:g,insertBatch:async(w,N)=>{if(t===void 0||l===void 0)return{conflicts:0,error:"No table selected.",inserted:0};try{const T=await e.query(xs,{rows:w.map(S=>({doc:S,table:t}))},we(l)),C=ws(T);return C.error!==void 0||(N(),o()),C}catch(T){return{conflicts:0,error:T.message,inserted:0}}},loading:m,open:n,openDialog:(w,N)=>{be(h(w,N))},shardKey:l,table:t}},Ss=()=>{const o=L(6),[e,n]=M(null);let s;o[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>{n(null)},o[0]=s):s=o[0];const t=s,[a,l]=M(null);let i;o[1]===Symbol.for("react.memo_cache_sentinel")?(i=(m,d)=>{l({column:m,value:d})},o[1]=i):i=o[1];const r=i;let c;o[2]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{l(null)},o[2]=c):c=o[2];const g=c;let u;return o[3]!==a||o[4]!==e?(u={closeExpandedCell:g,closeInspect:t,expandedCell:a,inspecting:e,onExpandCell:r,onInspect:n},o[3]=a,o[4]=e,o[5]=u):u=o[5],u},Cs=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,Ns=(o,e)=>typeof e=="number"&&Cs.test(o),ks=o=>{const e=L(31),{column:n,masked:s,onNavigate:t,target:a,value:l}=o;let i;e[0]!==t||e[1]!==a||e[2]!==l?(i=()=>{a!==void 0&&t(a,String(l))},e[0]=t,e[1]=a,e[2]=l,e[3]=i):i=e[3];const r=i;if(l==null){let u;return e[4]===Symbol.for("react.memo_cache_sentinel")?(u=f("span",{className:"italic text-muted-foreground",children:"null"}),e[4]=u):u=e[4],u}if(s){const u=`rd-masked-${n}`;let m;e[5]!==l?(m=Be(l),e[5]=l,e[6]=m):m=e[6];let d;return e[7]!==u||e[8]!==m?(d=f("span",{className:"italic text-muted-foreground","data-testid":u,title:"Masked (preview)",children:m}),e[7]=u,e[8]=m,e[9]=d):d=e[9],d}if(a!==void 0&&(typeof l=="string"||typeof l=="number")&&String(l)!==""){const u=`rd-ref-${n}`,m=`Open ${a} ${String(l)}`,d=String(l);let p;return e[10]!==r||e[11]!==u||e[12]!==m||e[13]!==d?(p=_("button",{"data-testid":u,onClick:r,title:m,type:"button",children:[d," ↗"]}),e[10]=r,e[11]=u,e[12]=m,e[13]=d,e[14]=p):p=e[14],p}if(Ns(n,l)){const u=`rd-ts-${n}`;let m;e[15]!==l?(m=l.toString(),e[15]=l,e[16]=m):m=e[16];let d;e[17]!==l?(d=bn(l),e[17]=l,e[18]=d):d=e[18];let p;return e[19]!==u||e[20]!==m||e[21]!==d?(p=f("span",{"data-testid":u,title:m,children:d}),e[19]=u,e[20]=m,e[21]=d,e[22]=p):p=e[22],p}if(typeof l=="object"){let u;e[23]!==l?(u=JSON.stringify(l,null,2),e[23]=l,e[24]=u):u=e[24];let m;return e[25]!==u?(m=f("pre",{className:"m-0 overflow-auto rounded-md bg-muted/50 p-2 text-xs",children:u}),e[25]=u,e[26]=m):m=e[26],m}let c;e[27]!==l?(c=Be(l),e[27]=l,e[28]=c):c=e[28];let g;return e[29]!==c?(g=f("span",{children:c}),e[29]=c,e[30]=g):g=e[30],g},Ts=o=>{const e=L(23),{columns:n,mask:s,onClose:t,onNavigate:a,refs:l,row:i}=o;let r;e[0]!==t||e[1]!==a?(r=(b,h)=>{a(b,h),t()},e[0]=t,e[1]=a,e[2]=r):r=e[2];const c=r;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=f("h3",{className:"m-0 text-base text-foreground",children:"Row detail"}),e[3]=g):g=e[3];let u;e[4]!==t?(u=_("div",{className:"mb-3 flex items-center justify-between",children:[g,f("button",{"data-testid":"rd-close",onClick:t,type:"button",children:"Close"})]}),e[4]=t,e[5]=u):u=e[5];let m;if(e[6]!==n||e[7]!==s||e[8]!==c||e[9]!==l||e[10]!==i){let b;e[12]!==s||e[13]!==c||e[14]!==l||e[15]!==i?(b=h=>_("div",{className:"border-t border-border py-2 first:border-t-0","data-testid":`rd-field-${h}`,children:[f("dt",{className:"mb-0.5 text-xs font-semibold text-muted-foreground",children:h}),f("dd",{className:"m-0",children:f(ks,{column:h,masked:s.enabled&&s.columns.has(h),onNavigate:c,target:l?.[h],value:i[h]})})]},h),e[12]=s,e[13]=c,e[14]=l,e[15]=i,e[16]=b):b=e[16],m=n.map(b),e[6]=n,e[7]=s,e[8]=c,e[9]=l,e[10]=i,e[11]=m}else m=e[11];let d;e[17]!==m?(d=f("dl",{"data-testid":"rd-fields",children:m}),e[17]=m,e[18]=d):d=e[18];let p;return e[19]!==t||e[20]!==u||e[21]!==d?(p=_(It,{label:"Row detail",onClose:t,panelTestId:"rd-panel",testId:"rd-overlay",variant:"drawer",children:[u,d]}),e[19]=t,e[20]=u,e[21]=d,e[22]=p):p=e[22],p},Es=50,_s=o=>{const e=L(8),{active:n,onPick:s,shard:t}=o;let a;e[0]!==s||e[1]!==t?(a=()=>{s(t)},e[0]=s,e[1]=t,e[2]=a):a=e[2];const l=a,i=`w-full rounded px-2 py-0.5 text-left text-xs transition-colors hover:bg-accent ${n?"bg-accent font-medium":""}`,r=`shard-explorer-item-${t}`;let c;return e[3]!==l||e[4]!==t||e[5]!==i||e[6]!==r?(c=f("button",{className:i,"data-testid":r,onClick:l,type:"button",children:t}),e[3]=l,e[4]=t,e[5]=i,e[6]=r,e[7]=c):c=e[7],c},Rs=({onFetchTables:o,onSelect:e})=>{const n=re(),[s]=M(()=>zn()),[t,a]=M(!1),[l,i]=M(void 0),[r,c]=M(void 0),[g,u]=M(!1),[m,d]=M(void 0),p=He(0),b=()=>{a(x=>!x)},h=async x=>{e(x),i(x),c(void 0),d(void 0),u(!0),p.current+=1;const v=p.current;try{const w=await o(x);p.current===v&&c(w?.slice(0,Es))}catch(w){p.current===v&&d(w.message)}p.current===v&&u(!1)},y=x=>{be(h(x))};return s.length===0?null:_("div",{"data-testid":"shard-explorer",children:[_("button",{"aria-controls":"shard-explorer-panel","aria-expanded":t,className:"inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"shard-explorer-toggle",onClick:b,type:"button",children:[n("Shards seen"),f("span",{"aria-hidden":"true",className:`ml-0.5 transition-transform ${t?"rotate-180":""}`,children:"▾"})]}),t&&_("div",{className:"mt-1 flex flex-col gap-1 rounded-md border border-border bg-popover p-2","data-testid":"shard-explorer-panel",id:"shard-explorer-panel",children:[f("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-hint",children:n("Recently visited shards — click to switch")}),f("ul",{className:"flex flex-col gap-0.5","data-testid":"shard-explorer-list",children:s.map(x=>f("li",{children:f(_s,{active:l===x,onPick:y,shard:x})},x))}),l!==void 0&&_("div",{className:"mt-1 border-t border-border pt-1","data-testid":"shard-explorer-summary",children:[f("p",{className:"mb-1 text-xs font-medium text-foreground","data-testid":"shard-explorer-summary-title",children:n("{shard} tables",{shard:l})}),g&&f("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-loading",children:n("Loading…")}),m!==void 0&&f("p",{className:"text-xs text-destructive","data-testid":"shard-explorer-error",role:"alert",children:m}),!g&&m===void 0&&r?.length===0&&f("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-empty",children:n("No tables in this shard.")}),!g&&m===void 0&&r!==void 0&&r.length>0&&f("ul",{className:"flex flex-col gap-0.5","data-testid":"shard-explorer-tables",children:r.map(x=>_("li",{className:"flex items-center justify-between text-xs",children:[f("span",{"data-testid":`shard-explorer-table-${x.name}`,children:x.name}),f("span",{className:"text-muted-foreground","data-testid":`shard-explorer-rowcount-${x.name}`,children:x.rowCount})]},x.name))})]})]})]})},$s="lunora-studio-back-relations",Ds={},Is=50,Ms=[],As=Te(le.listTables),Os=o=>{const e=L(10),{onFetchShardTables:n,onShardChange:s,schemaSwitch:t,shardKey:a}=o;let l;e[0]!==s||e[1]!==a?(l=f(gn,{onChange:s,testId:"db-shard-input",value:a}),e[0]=s,e[1]=a,e[2]=l):l=e[2];let i;e[3]!==n||e[4]!==s?(i=f(Rs,{onFetchTables:n,onSelect:s}),e[3]=n,e[4]=s,e[5]=i):i=e[5];let r;return e[6]!==t||e[7]!==l||e[8]!==i?(r=_("div",{className:"flex shrink-0 flex-col items-stretch gap-2 border-b border-border p-3",children:[t,l,i]}),e[6]=t,e[7]=l,e[8]=i,e[9]=r):r=e[9],r},cl=({editable:o=!1,globalTableNames:e,initialFilters:n,initialOrderBy:s,initialPins:t,initialSearch:a,initialShardKey:l,onNavigateToGlobal:i,onSelectTable:r,onViewChange:c,pageSize:g=Is,queryBar:u,schemaSwitch:m,tableParam:d})=>{const b=Xe(le.describeTables,{},{shardKey:l??""}).data?.columnsByTable??Ds,[h,y]=$t($s,{}),x=et(P=>{const X=new Set(h[P]);return wt(P,b).filter(_e=>X.has(pt(_e)))},[h,b]),v=us({initialFilters:n,initialOrderBy:s,initialSearch:a,initialShardKey:l,onSelectTable:r,onViewChange:c,pageSize:g,resolveBackRelations:x,tableParam:d}),{cancelCellEdit:w,columns:N,currentView:T,editableColumn:C,editingCell:S,facetFilter:k,facets:A,loadTables:$,navigateToRef:E,onFiltersChange:D,page:R,pageError:q,previewRef:O,queryShardKey:B,selectedTable:F,selectTable:J,setShardKey:H,shardKey:G,stage:U,stagedValue:ye,startCellEdit:ie,tables:he,tablesError:xe,toggleFacet:Se}=v,ce=Cn(G),Ce=P=>{be((async()=>{const _e=await ce.suggestFilter(P,F??"");_e!==void 0&&D(_e.map(Re=>{const $e=Re.value,Ue=typeof $e=="string"||typeof $e=="number"||typeof $e=="boolean"?String($e):"";return{column:Re.column,operator:Re.operator,value:Ue}}))})())},de=F===null?[]:wt(F,b),Z=new Set(h[F??""]),Ne=[];for(const P of R?.rows??[]){const X=P._id??P.id;typeof X=="string"&&X!==""&&Ne.push(X)}const ue=Yo(Z,de,Ne,B),fe=P=>{y(X=>{const _e=F??"",Re=X[_e]??[];return{...X,[_e]:Re.includes(P)?Re.filter($e=>$e!==P):[...Re,P]}})},se=ms({columns:N,initialPins:t,selectedTable:F}),me=Ss(),{closeExpandedCell:Y,closeInspect:j,expandedCell:te,inspecting:ne,onExpandCell:Me}=me,oe=ot(),W=Object.fromEntries((b[F??""]??[]).map(P=>[P.name,P])),ee=new Map;for(const P of b[F??""]??[])P.isStorage===!0&&ee.set(P.name,P.bucket);const Q=et(async(P,X)=>oe.signedStorageUrl(P,X===void 0?{}:{bucket:X}),[oe]),z=async P=>await oe.query(As,{},we(P)),ge=()=>{F!==null&&J(F)},{closeDialog:K,columnMeta:Ee,fkPools:Ae,insertBatch:Oe,open:Fe,openDialog:ze}=ys(ge),pe=()=>{F!==null&&ze(F,G)},je=P=>Oe(P,K),Pe=(P,X)=>{if(i!==void 0&&e?.has(P)===!0){i(P,X);return}E(P,X)},Ke=u?.onSaveQuery,Qe=P=>{Ke?.(P,T)},We={cancelEdit:w,editable:o,editableColumn:C,editingCell:S,onExpandCell:Me,stage:U,stagedValue:ye,startEdit:ie},st={columns:R?.refs,maskViewFor:se.maskViewFor,onNavigate:Pe,onPreview:O};return _("div",{className:"flex h-full min-w-0","data-testid":"lunora-data-browser",children:[f(yn,{header:f(Os,{onFetchShardTables:z,onShardChange:H,schemaSwitch:m,shardKey:G}),onReload:$,onSelect:J,prefix:"db",selected:F,tables:he??Ms}),_("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[xe!==null&&f("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"db-tables-error",role:"alert",children:xe}),R===null&&q===null&&f("div",{className:"flex flex-1 items-center justify-center p-6",children:f("p",{className:"text-sm text-muted-foreground",children:"Select a table to browse its rows."})}),q!==null&&f("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"db-page-error",role:"alert",children:q}),R!==null&&f(jo,{assistant:ce,backRelations:{available:de,counts:ue,enabled:Z,onToggle:fe},browser:v,columnMeta:W,edit:We,editable:o,onAskAiFilter:Ce,onInspect:me.onInspect,onOpenGenerateRows:pe,onSaveQuery:Qe,page:R,preferences:se,queryBar:u,references:st})]}),R!==null&&f(Sn,{columns:N,facets:A,mask:se.maskView,onFacetFilter:k,onToggleFacet:Se}),ne!==null&&R!==null&&f(Ts,{columns:R.columns,mask:se.maskView,onClose:j,onNavigate:Pe,refs:R.refs,row:Dt(ne,se.maskView)}),te!==null&&f(On,{bucket:ee.get(te.column),column:te.column,onClose:Y,resolveUrl:ee.has(te.column)?Q:void 0,value:te.value}),Fe&&F!==null&&Ee!==void 0&&f(Qo,{columns:Ee,fkPools:Ae,onClose:K,onInsertRows:je,table:F})]})};export{cl as DataBrowser};
@@ -0,0 +1 @@
1
+ import{useLunora as de}from"@lunora/react";import{useState as A,useRef as U,useEffect as H}from"react";import{b as I}from"./use-admin-query-Cbj2GuHu.mjs";import{useAutoRefresh as me}from"./DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";import{m as Q,G as ue,u as fe,a as ge,b as pe,T as be,D as he}from"./table-list-sidebar-BxZm3sBJ.mjs";import{useT as V}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{b as xe}from"./cf-links-CBJ5SywP.mjs";import{c as W}from"react/compiler-runtime";import{c as ke,a as Ne,b as Z,e as ve,d as ye,T as we}from"./table-D0SBiDu-.mjs";import{a as Te}from"./control-button-BOZ5K-FC.mjs";import{C as q,G as Se}from"./data-grid-BqNXJ9PF.mjs";import{jsx as r,jsxs as F}from"react/jsx-runtime";import{E as Ce}from"./empty-state-D7jEML_T.mjs";const Pe=(t,e)=>{const o=t._id;return typeof o=="string"||typeof o=="number"?String(o):`row-${e.toString()}`},Fe=t=>t==null?"∅":t===""?"(empty)":typeof t=="object"?JSON.stringify(t):String(t),Ee=t=>{const e=W(45),{filters:o,hasMaskedColumns:f,mask:s,maskOn:u,onChangePageSize:i,onJumpToPage:R,onNext:d,onPrevious:T,onRemoveFilter:g,onToggleMask:L,page:c,pageSize:E,pagination:S}=t,C=V(),{hasNext:z,hasPrevious:D,rangeEnd:j,rangeStart:P,total:k}=S;let N;e[0]!==f||e[1]!==u||e[2]!==L||e[3]!==C?(N=f&&r("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border px-4 py-2",children:r("button",{"aria-pressed":u,className:Te,"data-testid":"gdb-mask-toggle",onClick:L,type:"button",children:C("Mask sensitive columns")})}),e[0]=f,e[1]=u,e[2]=L,e[3]=C,e[4]=N):N=e[4];let p;e[5]!==o||e[6]!==s||e[7]!==g||e[8]!==C?(p=o.length>0&&r("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border px-4 py-2 text-xs","data-testid":"gdb-filters",children:o.map((n,m)=>{const G=Fe(Q(n.value,n.column,s));return F("span",{className:"inline-flex items-center gap-1 rounded border border-border bg-muted px-1.5 py-0.5","data-testid":"gdb-filter-chip",children:[r("span",{className:"font-medium text-foreground",children:n.column}),r("span",{className:"text-muted-foreground",children:"="}),r("span",{className:"font-mono text-foreground",children:G}),r("button",{"aria-label":C("Remove filter"),className:"ml-0.5 text-muted-foreground hover:text-foreground","data-testid":"gdb-filter-remove",onClick:()=>{g(m)},type:"button",children:"✕"})]},`${n.column}:${G}`)})}),e[5]=o,e[6]=s,e[7]=g,e[8]=C,e[9]=p):p=e[9];let a;if(e[10]!==s||e[11]!==c.columns){let n;e[13]!==s?(n=m=>F(ke,{children:[m,s.columns.has(m)&&r("span",{className:"ms-1 inline-flex items-center rounded-sm bg-warning/15 px-1 text-[0.625rem] font-medium uppercase text-warning","data-testid":`gdb-mask-chip-${m}`,title:"This column is masked by a mask() policy",children:"masked"})]},m),e[13]=s,e[14]=n):n=e[14],a=c.columns.map(n),e[10]=s,e[11]=c.columns,e[12]=a}else a=e[12];let b;e[15]!==a?(b=r(Ne,{children:r(Z,{children:a})}),e[15]=a,e[16]=b):b=e[16];let v;if(e[17]!==s||e[18]!==c.columns||e[19]!==c.rows){let n;e[21]!==s||e[22]!==c.columns?(n=(m,G)=>r(Z,{"data-testid":"gdb-row",children:c.columns.map(w=>r(ve,{className:"max-w-xs truncate font-mono text-xs",children:s.enabled&&s.columns.has(w)?r("span",{className:"text-muted-foreground italic","data-testid":`gdb-masked-${w}`,title:"Masked (preview)",children:r(q,{value:Q(m[w],w,s)})}):r(q,{value:m[w]})},w))},Pe(m,G)),e[21]=s,e[22]=c.columns,e[23]=n):n=e[23],v=c.rows.map(n),e[17]=s,e[18]=c.columns,e[19]=c.rows,e[20]=v}else v=e[20];let y;e[24]!==v?(y=r(ye,{children:v}),e[24]=v,e[25]=y):y=e[25];let h;e[26]!==b||e[27]!==y?(h=r(Se,{layout:"fill",children:r("div",{className:"min-h-0 flex-1 overflow-auto",children:F(we,{"data-testid":"gdb-rows",children:[b,y]})})}),e[26]=b,e[27]=y,e[28]=h):h=e[28];let x;e[29]!==z||e[30]!==D||e[31]!==i||e[32]!==R||e[33]!==d||e[34]!==T||e[35]!==E||e[36]!==j||e[37]!==P||e[38]!==k?(x=r("div",{className:"flex shrink-0 items-center border-t border-border px-4 py-2",children:r(ue,{hasNext:z,hasPrevious:D,onJumpToPage:R,onNext:d,onPageSizeChange:i,onPrevious:T,pageSize:E,prefix:"gdb",rangeEnd:j,rangeStart:P,total:k})}),e[29]=z,e[30]=D,e[31]=i,e[32]=R,e[33]=d,e[34]=T,e[35]=E,e[36]=j,e[37]=P,e[38]=k,e[39]=x):x=e[39];let M;return e[40]!==N||e[41]!==p||e[42]!==h||e[43]!==x?(M=F("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"gdb-page",children:[N,p,h,x]}),e[40]=N,e[41]=p,e[42]=h,e[43]=x,e[44]=M):M=e[44],M},Me=()=>{const t=W(8),e=V();let o;t[0]!==e?(o=e("Tables marked .global() (D1-backed, region-replicated) will appear here."),t[0]=e,t[1]=o):o=t[1];let f;t[2]===Symbol.for("react.memo_cache_sentinel")?(f=F("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M3 12h18M12 3a14 14 0 0 1 0 18 14 14 0 0 1 0-18Z"})]}),t[2]=f):f=t[2];let s;t[3]!==e?(s=e("No global tables."),t[3]=e,t[4]=s):s=t[4];let u;return t[5]!==o||t[6]!==s?(u=r("div",{className:"flex flex-1 items-center justify-center p-6",children:r(Ce,{description:o,icon:f,testId:"gdb-empty",title:s})}),t[5]=o,t[6]=s,t[7]=u):u=t[7],u},Ge=50,Oe=[],K=[],Ie=({initialTable:t,onSelectTable:e,pageSize:o=Ge,schemaSwitch:f}={})=>{const s=de(),u=V(),[i,R]=A(t??null),[d,T]=A(0),[g,L]=A(o),[c,E]=A([]),S=fe(c),{clearFacets:C,facets:z,refetchFacets:D,toggleFacet:j}=ge(),P=I(["lunora-global-tables"],()=>s.listGlobalTables()),k=P.data??null,N=P.error,p=I(["lunora-global-page",i??"",d,g,JSON.stringify(c)],()=>s.readGlobalTablePage({filters:c,limit:g,offset:d,table:i??""}),{enabled:i!==null,keepPreviousData:!1}),a=p.data??null,b=p.error,v=(l,O)=>$=>s.facetGlobalColumn({column:$,filters:O,table:l}),y=(l,O)=>{D(v(l,O))};me(()=>{P.refetch(),i!==null&&(p.refetch(),y(i,S.current))},!0);const h=U(void 0),x=l=>{R(l),h.current=l,E([]),S.current=[],C(),T(0),e?.(l)},M=l=>{j(l,i===null?null:v(i,S.current))},n=l=>{E(l),S.current=l,T(0),i!==null&&y(i,l)},m=(l,O)=>{n([...S.current.filter($=>$.column!==l),{column:l,value:O}])},G=l=>{n(S.current.filter((O,$)=>$!==l))},w=U(x);H(()=>{w.current=x}),H(()=>{if(t===void 0||t===""||h.current===t)return;h.current=t;const l=t;queueMicrotask(()=>{w.current(l)})},[t]);const B=l=>{i!==null&&T(Math.max(0,l))},{maskColumns:X,maskOn:Y,maskView:_,onToggleMask:ee}=pe({columns:a?.columns??K,selectedTable:i}),J=a?.total??0,te=d>0,re=a!==null&&d+a.rows.length<J,se=a===null||a.rows.length===0?0:d+1,le=a===null?0:d+a.rows.length,ae=()=>{P.refetch()},oe=()=>{B(d-g)},ne=()=>{B(d+g)},ie=l=>{B(Math.max(0,(l-1)*g))},ce=l=>{L(l),T(0)};return F("div",{className:"flex h-full min-w-0","data-testid":"lunora-global-data-browser",children:[r(be,{header:F("div",{className:"flex shrink-0 flex-col items-stretch gap-2 border-b border-border p-3",children:[f,r("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"gdb-cf-link",href:xe,rel:"noreferrer",target:"_blank",children:u("Open in Cloudflare")})]}),onReload:ae,onSelect:x,prefix:"gdb",selected:i,tables:k??Oe}),F("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[N!==null&&r("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"gdb-tables-error",role:"alert",children:N}),k!==null&&k.length===0&&r(Me,{}),b!==null&&r("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"gdb-page-error",role:"alert",children:b}),k!==null&&k.length>0&&a===null&&b===null&&r("div",{className:"flex flex-1 items-center justify-center p-6",children:r("p",{className:"text-sm text-muted-foreground",children:u("Select a table to browse its rows.")})}),a!==null&&r(Ee,{filters:c,hasMaskedColumns:X.size>0,mask:_,maskOn:Y,onChangePageSize:ce,onJumpToPage:ie,onNext:ne,onPrevious:oe,onRemoveFilter:G,onToggleMask:ee,page:a,pageSize:g,pagination:{hasNext:re,hasPrevious:te,rangeEnd:le,rangeStart:se,total:J}})]}),r(he,{columns:a?.columns??K,facets:z,mask:_,onFacetFilter:m,onToggleFacet:M})]})};export{Ie as GlobalDataBrowser};
@@ -0,0 +1 @@
1
+ import"./badge-r_5B4LHP.mjs";import"./card--2hKx4L2.mjs";import"./empty-state-D7jEML_T.mjs";import"./use-admin-query-Cbj2GuHu.mjs";import"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import"./ADMIN_FUNCTIONS-B6z7VLYt.mjs";import"./internal-CwaF9YNk.mjs";import"./utils-bhneXptQ.mjs";import"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{H as n}from"./home-panel-CSENDmoB.mjs";export{n as HomePanel};
@@ -0,0 +1 @@
1
+ import{c as Ce}from"react/compiler-runtime";import{useLunora as Se}from"@lunora/react";import{useState as Q,useEffect as Ie}from"react";import{ConfirmButton as Ee}from"./ConfirmButton-DU4p72Er.mjs";import{E as Me}from"./error-alert-CczbAfst.mjs";import{L as Te}from"./live-status-BuJdUZFU.mjs";import{ShardInput as _e}from"./ShardInput-C6mjgAh4.mjs";import{B as ke}from"./badge-r_5B4LHP.mjs";import{B as Le}from"./button-q0UYSmrn.mjs";import{C as we,a as De}from"./card--2hKx4L2.mjs";import{E as Be}from"./empty-state-D7jEML_T.mjs";import{I as Ae}from"./input-CXhxesPC.mjs";import{L as ue}from"./label-DKFzyHq6.mjs";import{T as Ke,a as je,b as fe,c as u,d as Fe,e as f}from"./table-D0SBiDu-.mjs";import{u as Oe}from"./use-admin-query-Cbj2GuHu.mjs";import{u as qe}from"./use-shard-key-BsP3o5wT.mjs";import{useT as He}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as he}from"./ADMIN_FUNCTIONS-B6z7VLYt.mjs";import{i as Qe,c as Ue,f as $e,d as ze,b as Ge}from"./internal-CwaF9YNk.mjs";import{r as Pe}from"./shard-history-CaO3C4KQ.mjs";import{jsx as r,jsxs as s}from"react/jsx-runtime";const We=Ue(he.runMigration),yt=i=>{const e=Ce(98),{initialShardKey:pe}=i,re=Se(),t=He(),{queryShardKey:d,setShardKey:ie,shardKey:a}=qe(pe),[h,ge]=Q(""),[p,ye]=Q("up"),[l,be]=Q(!0),[g,ce]=Q(!1),[c,ne]=Q(null),[U,se]=Q(null);let $;e[0]!==a?($=a.trim(),e[0]=a,e[1]=$):$=e[1];const z=$===d;let G;e[2]===Symbol.for("react.memo_cache_sentinel")?(G={},e[2]=G):G=e[2];let P;e[3]!==d?(P={live:!0,shardKey:d},e[3]=d,e[4]=P):P=e[4];const n=Oe(he.migrationStatus,G,P),o=n.data?.migrations??null,ae=n.error,{errorSource:le,liveError:oe}=n;let W,J;e[5]!==d||e[6]!==n.data?(W=()=>{n.data!==void 0&&Pe(d)},J=[n.data,d],e[5]=d,e[6]=n.data,e[7]=W,e[8]=J):(W=e[7],J=e[8]),Ie(W,J);let V;if(e[9]!==re||e[10]!==p||e[11]!==l||e[12]!==h||e[13]!==a||e[14]!==n||e[15]!==t){const m=async()=>{const me=h.trim();if(me===""){se(t("Enter a migration id")),ne(null);return}ce(!0),se(null);try{const de=await re.query(We,{direction:p,dryRun:l,id:me},ze(a));ne(de),n.refetch()}catch(de){const Ne=de;ne(null),se(Ge(Ne))}ce(!1)};V=()=>{$e(m())},e[9]=re,e[10]=p,e[11]=l,e[12]=h,e[13]=a,e[14]=n,e[15]=t,e[16]=V}else V=e[16];const X=V;let Y;e[17]===Symbol.for("react.memo_cache_sentinel")?(Y=m=>{ge(m.target.value)},e[17]=Y):Y=e[17];const ve=Y;let Z;e[18]===Symbol.for("react.memo_cache_sentinel")?(Z=m=>{ye(m.target.value==="down"?"down":"up")},e[18]=Z):Z=e[18];const xe=Z;let ee;e[19]===Symbol.for("react.memo_cache_sentinel")?(ee=m=>{be(m.target.checked)},e[19]=ee):ee=e[19];const Re=ee;let y;e[20]!==ie||e[21]!==a?(y=r(_e,{onChange:ie,testId:"mg-shard-input",value:a}),e[20]=ie,e[21]=a,e[22]=y):y=e[22];let b;e[23]!==oe?(b=r(Te,{message:oe,prefix:"mg"}),e[23]=oe,e[24]=b):b=e[24];let v;e[25]!==y||e[26]!==b?(v=s("div",{className:"flex flex-wrap items-center gap-2",children:[y,b]}),e[25]=y,e[26]=b,e[27]=v):v=e[27];let x;e[28]!==ae||e[29]!==le?(x=ae!==null&&r(Me,{error:le,testId:"mg-status-error"}),e[28]=ae,e[29]=le,e[30]=x):x=e[30];let R;e[31]!==o||e[32]!==t?(R=o!==null&&o.length===0&&r(Be,{description:t("Data migrations you run against this shard will be tracked here."),icon:r("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:r("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:t("No migrations have run on this shard.")}),e[31]=o,e[32]=t,e[33]=R):R=e[33];let N;e[34]!==o||e[35]!==t?(N=o!==null&&o.length>0&&r(we,{className:"overflow-hidden py-0",children:r(De,{className:"px-0",children:s(Ke,{"data-testid":"mg-table",children:[r(je,{children:s(fe,{children:[r(u,{children:t("id")}),r(u,{children:t("direction")}),r(u,{children:t("status")}),r(u,{children:t("processed")}),r(u,{children:t("changed")}),r(u,{children:t("updated")}),r(u,{children:t("error")})]})}),r(Fe,{children:o.map(Je)})]})})}),e[34]=o,e[35]=t,e[36]=N):N=e[36];let C;e[37]!==t?(C=t("Run migration"),e[37]=t,e[38]=C):C=e[38];let S;e[39]!==C?(S=r(ue,{children:C}),e[39]=C,e[40]=S):S=e[40];let I;e[41]!==t?(I=t("Migration id"),e[41]=t,e[42]=I):I=e[42];let E;e[43]!==t?(E=t("migration id"),e[43]=t,e[44]=E):E=e[44];let M;e[45]!==h||e[46]!==I||e[47]!==E?(M=r(Ae,{"aria-label":I,className:"w-auto","data-testid":"mg-id-input",onChange:ve,placeholder:E,value:h}),e[45]=h,e[46]=I,e[47]=E,e[48]=M):M=e[48];let T;e[49]!==t?(T=t("Direction"),e[49]=t,e[50]=T):T=e[50];let _;e[51]!==t?(_=t("up"),e[51]=t,e[52]=_):_=e[52];let k;e[53]!==_?(k=r("option",{value:"up",children:_}),e[53]=_,e[54]=k):k=e[54];let L;e[55]!==t?(L=t("down"),e[55]=t,e[56]=L):L=e[56];let w;e[57]!==L?(w=r("option",{value:"down",children:L}),e[57]=L,e[58]=w):w=e[58];let D;e[59]!==p||e[60]!==T||e[61]!==k||e[62]!==w?(D=s("select",{"aria-label":T,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:xe,value:p,children:[k,w]}),e[59]=p,e[60]=T,e[61]=k,e[62]=w,e[63]=D):D=e[63];let B;e[64]!==l?(B=r("input",{checked:l,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:Re,type:"checkbox"}),e[64]=l,e[65]=B):B=e[65];let A;e[66]!==t?(A=t("Dry run"),e[66]=t,e[67]=A):A=e[67];let K;e[68]!==B||e[69]!==A?(K=s(ue,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[B,A]}),e[68]=B,e[69]=A,e[70]=K):K=e[70];let j;e[71]!==l||e[72]!==X||e[73]!==g||e[74]!==z||e[75]!==t?(j=l?r(Le,{"data-testid":"mg-run",disabled:g||!z,onClick:X,type:"button",children:t(g?"Running…":"Run")}):r(Ee,{confirmLabel:t(g?"Running…":"Run migration?"),disabled:g||!z,onConfirm:X,testId:"mg-run",children:t("Run")}),e[71]=l,e[72]=X,e[73]=g,e[74]=z,e[75]=t,e[76]=j):j=e[76];let F;e[77]!==M||e[78]!==D||e[79]!==K||e[80]!==j?(F=s("div",{className:"flex flex-wrap items-center gap-2",children:[M,D,K,j]}),e[77]=M,e[78]=D,e[79]=K,e[80]=j,e[81]=F):F=e[81];let O;e[82]!==S||e[83]!==F?(O=s("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[S,F]}),e[82]=S,e[83]=F,e[84]=O):O=e[84];let q;e[85]!==U?(q=U!==null&&r("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:U}),e[85]=U,e[86]=q):q=e[86];let H;e[87]!==c||e[88]!==t?(H=c!==null&&s("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[c.dryRun?t("Dry run: "):"",t("{status} — processed",{status:c.status}),c.processed,t(", changed"),c.changed]}),e[87]=c,e[88]=t,e[89]=H):H=e[89];let te;return e[90]!==v||e[91]!==x||e[92]!==R||e[93]!==N||e[94]!==O||e[95]!==q||e[96]!==H?(te=s("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[v,x,R,N,O,q,H]}),e[90]=v,e[91]=x,e[92]=R,e[93]=N,e[94]=O,e[95]=q,e[96]=H,e[97]=te):te=e[97],te};function Je(i){return s(fe,{"data-testid":`mg-row-${i.id}`,children:[r(f,{children:i.id}),r(f,{children:i.direction}),r(f,{children:r(ke,{variant:"secondary",children:i.status})}),r(f,{children:i.processed}),r(f,{children:i.changed}),r(f,{children:Qe(i.updatedAt)}),r(f,{children:i.error??""})]},i.id)}export{yt as MigrationsPanel};
@@ -0,0 +1 @@
1
+ import{c as k}from"react/compiler-runtime";import{useLunora as O}from"@lunora/react";import{E as g}from"./empty-state-D7jEML_T.mjs";import{S as y}from"./skeleton-DX1gfixl.mjs";import{u as R,R as S}from"./reference-view-CZxBZSRo.mjs";import{useT as P}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{jsxs as h,jsx as l}from"react/jsx-runtime";const x=n=>(n.params??[]).find(e=>e.name==="args")??(n.params??[])[0],v=n=>n["x-tags"]?.[0]?.name??(n.name.includes(":")?n.name.slice(0,n.name.indexOf(":")):""),w=n=>{const e=x(n)?.schema;return{argsSchema:e,description:n.description,functionPath:n.name,httpPath:"/_lunora/rpc",key:n.name,kind:n["x-lunora-function-kind"],method:"POST",operationId:n.name,requestSchema:e,responses:[{description:n.result?.name,schema:n.result?.schema,status:"200"}],summary:n.summary??n.name,tags:[v(n)],title:n.summary??n.name}},I=n=>{const e=n??{},m=(e.methods??[]).map(a=>w(a)),r=new Map;for(const a of m){const i=a.tags[0]??"",s=r.get(i)??[];s.push(a),r.set(i,s)}return{groups:[...r.entries()].map(([a,i])=>({name:a,operations:i.toSorted((s,p)=>s.operationId.localeCompare(p.operationId))})).toSorted((a,i)=>a.name.localeCompare(i.name)),operationByKey:new Map(m.map(a=>[a.key,a])),title:e.info?.title??"API reference",version:e.info?.version}},C=n=>n.methods===void 0||n.methods.length===0,N=n=>{const e=n;return C(e)?{kind:"empty"}:{kind:"ready",spec:e}},T=n=>{const e=k(23),{spec:m}=n,r=P(),f=O();let a;e[0]!==f?(a=()=>f.fetchOpenRpc(),e[0]=f,e[1]=a):a=e[1];const s=R(m,a,N);let p;e[2]!==s.kind||e[3]!==s.spec?(p=s.kind==="ready"?I(s.spec):void 0,e[2]=s.kind,e[3]=s.spec,e[4]=p):p=e[4];const u=p;if(s.kind==="loading"){let t;return e[5]===Symbol.for("react.memo_cache_sentinel")?(t=h("div",{className:"flex flex-col gap-4","data-testid":"openrpc-reference-loading",children:[l(y,{className:"h-8 w-48"}),l(y,{className:"h-64 w-full"})]}),e[5]=t):t=e[5],t}if(s.kind==="error"){let t;e[6]!==s.message||e[7]!==r?(t=r("Couldn't load the OpenRPC spec: {message}",{message:s.message}),e[6]=s.message,e[7]=r,e[8]=t):t=e[8];let o;e[9]!==r?(o=r("API reference unavailable"),e[9]=r,e[10]=o):o=e[10];let c;return e[11]!==t||e[12]!==o?(c=l(g,{description:t,testId:"openrpc-reference-error",title:o}),e[11]=t,e[12]=o,e[13]=c):c=e[13],c}if(s.kind==="empty"||u===void 0){let t;e[14]!==r?(t=r("Run `lunora codegen --api-spec openrpc` and wire `_generated/openrpc.json` to the worker to render the OpenRPC reference here."),e[14]=r,e[15]=t):t=e[15];let o;e[16]!==r?(o=r("No OpenRPC spec configured"),e[16]=r,e[17]=o):o=e[17];let c;return e[18]!==t||e[19]!==o?(c=l(g,{description:t,testId:"openrpc-reference-empty",title:o}),e[18]=t,e[19]=o,e[20]=c):c=e[20],c}let d;return e[21]!==u?(d=l(S,{model:u}),e[21]=u,e[22]=d):d=e[22],d};export{T as default};
@@ -0,0 +1 @@
1
+ import{c as I}from"react/compiler-runtime";import{useLunora as $}from"@lunora/react";import{useState as w,useEffect as H}from"react";import{ConfirmButton as M}from"./ConfirmButton-DU4p72Er.mjs";import{C as P,a as Q}from"./card--2hKx4L2.mjs";import{E as R}from"./empty-state-D7jEML_T.mjs";import{T as q,a as D,b as J,c as l,d as K,e as i}from"./table-D0SBiDu-.mjs";import{b as V}from"./use-admin-query-Cbj2GuHu.mjs";import{useAutoRefresh as W}from"./DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";import{useT as z}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as G,i as O,b as U}from"./internal-CwaF9YNk.mjs";import{jsx as t,jsxs as p}from"react/jsx-runtime";const X=s=>Number.isFinite(s)?O(s,"—"):"—",j=s=>s.toSorted((e,u)=>e.scheduledFor-u.scheduledFor),Y=(s,e,u)=>e!==void 0?e:u===void 0?f=>s.cancelScheduledJob(f):void 0,he=s=>{const e=I(16),{cancelJob:u,loadJobs:f}=s===void 0?{}:s,n=$(),o=z(),c=f===void 0;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=["lunora-scheduled-jobs"],e[0]=b):b=e[0];const d=V(b,async()=>{const r=await(f??(()=>n.listScheduledJobs()))();return j(r)}),[F,L]=w(void 0),[A,S]=w(void 0);let v,x;e[1]!==n||e[2]!==c?(v=()=>{if(c)return n.subscribeScheduledJobs(r=>{S(void 0),L(j(r))})},x=[c,n],e[1]=n,e[2]=c,e[3]=v,e[4]=x):(v=e[3],x=e[4]),H(v,x);let y;e[5]!==d?(y=()=>{d.refetch()},e[5]=d,e[6]=y):y=e[6],W(y,!c);const C=Y(n,u,f),a=F??d.data,N=A??d.error,E=async r=>{if(C!==void 0){S(void 0);try{await C(r),c||d.refetch()}catch(_){S(U(_))}}},k="flex flex-col gap-3",B="lunora-scheduled-jobs";let m;e[7]!==N?(m=N!==null&&t("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:N}),e[7]=N,e[8]=m):m=e[8];let h;e[9]!==a?.length||e[10]!==o?(h=a?.length===0&&t(R,{description:o("Jobs queued with runAfter / runAt will appear here."),icon:p("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[t("circle",{cx:"12",cy:"12",r:"9"}),t("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:o("No scheduled jobs.")}),e[9]=a?.length,e[10]=o,e[11]=h):h=e[11];const T=a!==void 0&&a.length>0&&t(P,{className:"overflow-hidden py-0",children:t(Q,{className:"px-0",children:p(q,{"data-testid":"sj-table",children:[t(D,{children:p(J,{children:[t(l,{children:o("function")}),t(l,{children:o("scheduled for")}),t(l,{children:o("pool")}),t(l,{children:o("attempts")}),t(l,{children:o("shard")}),t(l,{children:o("id")}),C!==void 0&&t(l,{"aria-label":o("Actions")})]})}),t(K,{children:a.map(r=>p(J,{"data-testid":`sj-row-${r.id}`,children:[t(i,{className:"font-mono text-xs",children:r.functionPath}),t(i,{className:"text-muted-foreground tabular-nums",children:X(r.scheduledFor)}),t(i,{className:"font-mono text-xs",children:r.pool??""}),t(i,{className:"tabular-nums",children:r.attempts??0}),t(i,{children:r.shardKey??""}),t(i,{className:"font-mono text-xs",children:r.id}),C!==void 0&&t(i,{className:"text-right",children:t(M,{confirmLabel:o("Cancel job?"),onConfirm:()=>{G(E(r.id))},testId:`sj-cancel-${r.id}`,children:o("Cancel")})})]},r.id))})]})})});let g;return e[12]!==T||e[13]!==m||e[14]!==h?(g=p("div",{className:k,"data-testid":B,children:[m,h,T]}),e[12]=T,e[13]=m,e[14]=h,e[15]=g):g=e[15],g};export{he as ScheduledJobs};
@@ -0,0 +1 @@
1
+ import{c as S}from"react/compiler-runtime";import{useId as x,useState as C}from"react";import{useT as b}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{l as j}from"./shard-history-CaO3C4KQ.mjs";import{I as k}from"./input-CXhxesPC.mjs";import{jsx as I,jsxs as y,Fragment as _}from"react/jsx-runtime";const A=r=>{const t=S(21),{id:p,onChange:f,testId:e,value:u}=r,n=b(),c=x(),[i]=C($);let d;t[0]!==f?(d=v=>{f(v.target.value)},t[0]=f,t[1]=d):d=t[1];const h=d;let o;t[2]!==n?(o=n("Shard key"),t[2]=n,t[3]=o):o=t[3];const g=i.length>0?c:void 0;let l;t[4]!==n?(l=n("shard key (optional)"),t[4]=n,t[5]=l):l=t[5];let s;t[6]!==p||t[7]!==h||t[8]!==o||t[9]!==g||t[10]!==l||t[11]!==e||t[12]!==u?(s=I(k,{"aria-label":o,className:"h-8 w-48","data-testid":e,id:p,list:g,onChange:h,placeholder:l,value:u}),t[6]=p,t[7]=h,t[8]=o,t[9]=g,t[10]=l,t[11]=e,t[12]=u,t[13]=s):s=t[13];let a;t[14]!==c||t[15]!==i||t[16]!==e?(a=i.length>0&&I("datalist",{"data-testid":`${e}-recents`,id:c,children:i.map(w)}),t[14]=c,t[15]=i,t[16]=e,t[17]=a):a=t[17];let m;return t[18]!==s||t[19]!==a?(m=y(_,{children:[s,a]}),t[18]=s,t[19]=a,t[20]=m):m=t[20],m};function $(){return j()}function w(r){return I("option",{"aria-label":r,value:r},r)}export{A as ShardInput};
@@ -0,0 +1 @@
1
+ import{S as b}from"./studio-DRHuKwbt.mjs";import"./ErrorBoundary-BWNF98VF.mjs";import"./operation-console-provider-DoloEvon.mjs";import"./badge-r_5B4LHP.mjs";import"./input-CXhxesPC.mjs";import"./skeleton-DX1gfixl.mjs";import"./home-panel-CSENDmoB.mjs";import"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import"./StudioI18nProvider-fVsCSs5L.mjs";import"./data-view-params-qoSTqjAj.mjs";import"./internal-CwaF9YNk.mjs";import"./utils-bhneXptQ.mjs";import"./CommandPalette-C4UrhLxv.mjs";export{b as Studio};
@@ -0,0 +1 @@
1
+ import{c as O}from"react/compiler-runtime";import{LunoraClient as G}from"@lunora/client";import{LunoraProvider as H}from"@lunora/react";import{useState as B,useEffect as R}from"react";import{ErrorBoundary as z}from"./ErrorBoundary-BWNF98VF.mjs";import{u as U,B as V,T as Y,a as q,S as J}from"./studio-DRHuKwbt.mjs";import Q from"./useDebounced-DVeQ5-oW.mjs";import{useT as j,createStudioI18n as X}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{StudioI18nProvider as D}from"./StudioI18nProvider-fVsCSs5L.mjs";import{r as Z}from"./internal-CwaF9YNk.mjs";import{w as $}from"./recording-client-BEZ6tVgo.mjs";import F from"./STUDIO_ROOT_CLASS-C6MccdVk.mjs";import{a as K}from"./browser-storage-BH1MxLZs.mjs";import{c as W}from"./utils-bhneXptQ.mjs";import{B as ee}from"./button-q0UYSmrn.mjs";import{I as te}from"./input-CXhxesPC.mjs";import{jsx as g,jsxs as L}from"react/jsx-runtime";const P="lunora-studio-admin-token",oe=()=>{try{return K("session")?.getItem(P)??""}catch{return""}},ne=b=>{const e=K("session");if(e!==void 0)try{b===""?e.removeItem(P):e.setItem(P,b)}catch{}},se="/_lunora/admin/ws-token",ie=1e4,le=b=>{const e=b;return typeof e?.token=="string"&&e.token.length>0&&typeof e.expiresAtMs=="number"},re=b=>{const{adminToken:e,baseUrl:d}=b,o=b.fetchImpl??fetch;let n=d;for(;n.endsWith("/");)n=n.slice(0,-1);const r=`${n}${se}`;let t,s=!1,i;const f=async()=>{const u=await o(r,{headers:{authorization:`Bearer ${e}`},method:"POST"});if(u.status===404||u.status===405)return s=!0,e;if(!u.ok)throw new Error(`ws-token mint failed: ${String(u.status)}`);const l=await u.json().catch(()=>{});if(!le(l))throw new Error("ws-token mint failed: malformed response body");return t=l,l.token};return{getToken:async()=>s?e:t!==void 0&&t.expiresAtMs-ie>Date.now()?t.token:(i??=f().finally(()=>{i=void 0}),i),invalidate:()=>{t=void 0}}},ae=b=>{const e=O(42),{onSubmit:d}=b,o=j(),[n,r]=B("");let t;e[0]!==n?(t=n.trim(),e[0]=n,e[1]=t):t=e[1];const s=t;let i;e[2]!==d||e[3]!==s?(i=_=>{_.preventDefault(),s!==""&&d(s)},e[2]=d,e[3]=s,e[4]=i):i=e[4];const f=i;let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=g("div",{className:"h-10 w-10 text-foreground",children:g(V,{})}),e[5]=u):u=e[5];let l;e[6]!==o?(l=o("Connect to Lunora Studio"),e[6]=o,e[7]=l):l=e[7];let v;e[8]!==l?(v=g("h1",{className:"text-base font-semibold text-foreground",children:l}),e[8]=l,e[9]=v):v=e[9];let k;e[10]!==o?(k=o("Enter your admin token to access the studio."),e[10]=o,e[11]=k):k=e[11];let m;e[12]!==k?(m=g("p",{className:"text-[13px] text-muted-foreground",children:k}),e[12]=k,e[13]=m):m=e[13];let c;e[14]!==v||e[15]!==m?(c=L("div",{className:"flex flex-col items-center gap-3 text-center",children:[u,L("div",{className:"flex flex-col gap-1",children:[v,m]})]}),e[14]=v,e[15]=m,e[16]=c):c=e[16];let h;e[17]!==o?(h=o("admin token"),e[17]=o,e[18]=h):h=e[18];let a;e[19]!==h?(a=g("label",{className:"text-xs font-medium text-foreground",htmlFor:"lunora-studio-login-token",children:h}),e[19]=h,e[20]=a):a=e[20];let p;e[21]===Symbol.for("react.memo_cache_sentinel")?(p=_=>{r(_.target.value)},e[21]=p):p=e[21];let S;e[22]!==n?(S=g(te,{autoComplete:"off",autoFocus:!0,"data-testid":"lunora-studio-login-token",id:"lunora-studio-login-token",onChange:p,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:n}),e[22]=n,e[23]=S):S=e[23];let x;e[24]!==o?(x=o("From your worker's LUNORA_ADMIN_TOKEN — your project's .dev.vars in dev, or a deployment secret in production."),e[24]=o,e[25]=x):x=e[25];let A;e[26]!==x?(A=g("p",{className:"text-[11px] text-muted-foreground",children:x}),e[26]=x,e[27]=A):A=e[27];let T;e[28]!==a||e[29]!==S||e[30]!==A?(T=L("div",{className:"flex flex-col gap-1.5",children:[a,S,A]}),e[28]=a,e[29]=S,e[30]=A,e[31]=T):T=e[31];const E=s==="";let y;e[32]!==o?(y=o("Connect"),e[32]=o,e[33]=y):y=e[33];let w;e[34]!==E||e[35]!==y?(w=g(ee,{"data-testid":"lunora-studio-login-submit",disabled:E,type:"submit",children:y}),e[34]=E,e[35]=y,e[36]=w):w=e[36];let N;return e[37]!==f||e[38]!==T||e[39]!==w||e[40]!==c?(N=L("form",{className:"flex w-full max-w-sm flex-col gap-5 rounded-xl border border-border bg-card p-7 shadow-lg","data-testid":"lunora-studio-login",onSubmit:f,children:[c,T,w]}),e[37]=f,e[38]=T,e[39]=w,e[40]=c,e[41]=N):N=e[41],N},ce=b=>{const e=O(10),{i18n:d,onSubmit:o}=b,{resolvedTheme:n}=U(),r=n==="dark"&&"dark";let t;e[0]!==r?(t=W(F,r,"flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground"),e[0]=r,e[1]=t):t=e[1];let s;e[2]!==o?(s=g(ae,{onSubmit:o}),e[2]=o,e[3]=s):s=e[3];let i;e[4]!==d||e[5]!==s?(i=g(D,{i18n:d,children:s}),e[4]=d,e[5]=s,e[6]=i):i=e[6];let f;return e[7]!==t||e[8]!==i?(f=g("div",{className:t,"data-testid":"lunora-studio-login-root",children:i}),e[7]=t,e[8]=i,e[9]=f):f=e[9],f},de=b=>{const e=O(23),{basePath:d,chrome:o,studio:n}=b,r=j();let t;e[0]!==r?(t=r("Studio failed"),e[0]=r,e[1]=t):t=e[1];let s;e[2]!==r?(s=r("Studio"),e[2]=r,e[3]=s):s=e[3];let i;e[4]!==r?(i=r("Try again"),e[4]=r,e[5]=i):i=e[5];const f=n?.dataEditable,u=n?.functions,l=n?.initialShardKey,v=n?.openApiSpec,k=n?.openRpcSpec,m=n?.runAsIdentity,c=n?.scheduledCancel,h=n?.scheduledLoad,a=n?.schemaEditable;let p;e[6]!==d||e[7]!==o||e[8]!==c||e[9]!==h||e[10]!==a||e[11]!==f||e[12]!==u||e[13]!==l||e[14]!==v||e[15]!==k||e[16]!==m?(p=g(J,{basePath:d,chrome:o,dataEditable:f,functions:u,initialShardKey:l,openApiSpec:v,openRpcSpec:k,runAsIdentity:m,scheduledCancel:c,scheduledLoad:h,schemaEditable:a}),e[6]=d,e[7]=o,e[8]=c,e[9]=h,e[10]=a,e[11]=f,e[12]=u,e[13]=l,e[14]=v,e[15]=k,e[16]=m,e[17]=p):p=e[17];let S;return e[18]!==t||e[19]!==p||e[20]!==s||e[21]!==i?(S=g(z,{fallbackTitle:t,label:s,retryLabel:i,children:p}),e[18]=t,e[19]=p,e[20]=s,e[21]=i,e[22]=S):S=e[22],S},fe=b=>{const e=O(20),{basePath:d,clearToken:o,client:n,i18n:r,onTokenChange:t,rulesInstalled:s,studio:i,token:f}=b,{resolvedTheme:u}=U();let l;e[0]!==o||e[1]!==t||e[2]!==s||e[3]!==f?(l={clearToken:o,onTokenChange:t,rulesInstalled:s,token:f},e[0]=o,e[1]=t,e[2]=s,e[3]=f,e[4]=l):l=e[4];const v=l,k=u==="dark"&&"dark";let m;e[5]!==k?(m=W(F,k,"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground"),e[5]=k,e[6]=m):m=e[6];let c;e[7]!==d||e[8]!==v||e[9]!==i?(c=g(q,{children:g(de,{basePath:d,chrome:v,studio:i})}),e[7]=d,e[8]=v,e[9]=i,e[10]=c):c=e[10];let h;e[11]!==r||e[12]!==c?(h=g(D,{i18n:r,children:c}),e[11]=r,e[12]=c,e[13]=h):h=e[13];let a;e[14]!==n||e[15]!==h?(a=g(H,{client:n,children:h}),e[14]=n,e[15]=h,e[16]=a):a=e[16];let p;return e[17]!==m||e[18]!==a?(p=g("div",{className:m,"data-testid":"lunora-studio-app",children:a}),e[17]=m,e[18]=a,e[19]=p):p=e[19],p},Ee=b=>{const e=O(27);let d;e[0]!==b?(d=b===void 0?{}:b,e[0]=b,e[1]=d):d=e[1];const{adminToken:o,basePath:n,baseUrl:r,client:t,rulesInstalled:s,studio:i,locale:f}=d;let u;e[2]!==o?(u=()=>o??oe(),e[2]=o,e[3]=u):u=e[3];const[l,v]=B(u);let k,m;e[4]!==l?(k=()=>{ne(l)},m=[l],e[4]=l,e[5]=k,e[6]=m):(k=e[5],m=e[6]),R(k,m);const c=Q(l,300);let h;e:{if(t!==void 0){let I;e[7]!==t?(I=$(t),e[7]=t,e[8]=I):I=e[8],h=I;break e}let _;if(e[9]!==r||e[10]!==c){const I=Z(r),C=c===""?void 0:re({adminToken:c,baseUrl:I}),M=new G({url:I,...C===void 0?{}:{wsToken:C.getToken}});C!==void 0&&(M.setAuthToken(c),M.onTokenExpired(C.invalidate)),_=$(M),e[9]=r,e[10]=c,e[11]=_}else _=e[11];h=_}const a=h;let p,S;e[12]!==a||e[13]!==t?(p=()=>()=>{t===void 0&&a.close()},S=[a,t],e[12]=a,e[13]=t,e[14]=p,e[15]=S):(p=e[14],S=e[15]),R(p,S);let x;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=_=>{v(_.target.value)},e[16]=x):x=e[16];const A=x;let T;e[17]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{v("")},e[17]=T):T=e[17];const E=T;let y;e[18]!==f?(y=X(f),e[18]=f,e[19]=y):y=e[19];const w=y;let N;return e[20]!==n||e[21]!==a||e[22]!==w||e[23]!==s||e[24]!==i||e[25]!==l?(N=g(Y,{children:l===""?g(ce,{i18n:w,onSubmit:v}):g(fe,{basePath:n,clearToken:E,client:a,i18n:w,onTokenChange:A,rulesInstalled:s,studio:i,token:l})}),e[20]=n,e[21]=a,e[22]=w,e[23]=s,e[24]=i,e[25]=l,e[26]=N):N=e[26],N};export{Ee as StudioApp};