@lunora/studio 1.0.0-alpha.32 → 1.0.0-alpha.320

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 (472) hide show
  1. package/LICENSE.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/index.d.mts +1581 -0
  4. package/dist/index.d.ts +974 -806
  5. package/dist/index.mjs +1 -0
  6. package/dist/mount.d.mts +22 -0
  7. package/dist/mount.d.ts +11 -10
  8. package/dist/mount.mjs +1 -0
  9. package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -0
  10. package/dist/packem_chunks/ApiTab.mjs +1 -0
  11. package/dist/packem_chunks/AuditPanel.mjs +1 -0
  12. package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -0
  13. package/dist/packem_chunks/ExportImportPanel.mjs +3 -0
  14. package/dist/packem_chunks/FileBrowser.mjs +4 -0
  15. package/dist/packem_chunks/FunctionRunner.mjs +1 -0
  16. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -0
  17. package/dist/packem_chunks/HealthPanel.mjs +1 -0
  18. package/dist/packem_chunks/InsightsPanel.mjs +1 -0
  19. package/dist/packem_chunks/LogsPanel.mjs +1 -0
  20. package/dist/packem_chunks/MailPanel.mjs +2 -0
  21. package/dist/packem_chunks/MetricsPanel.mjs +1 -0
  22. package/dist/packem_chunks/NotificationsPanel.mjs +1 -0
  23. package/dist/packem_chunks/PitrPanel.mjs +1 -0
  24. package/dist/packem_chunks/SchemaViewer.mjs +1 -0
  25. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -0
  26. package/dist/packem_chunks/SettingsPanel.mjs +1 -0
  27. package/dist/packem_chunks/SqlEditorPanel.mjs +10 -0
  28. package/dist/packem_chunks/TableEditor.mjs +1 -0
  29. package/dist/packem_chunks/agents-panel.mjs +1 -0
  30. package/dist/packem_chunks/ai-usage-panel.mjs +1 -0
  31. package/dist/packem_chunks/analytics-panel.mjs +1 -0
  32. package/dist/packem_chunks/architecture-panel.mjs +1 -0
  33. package/dist/packem_chunks/auth-audit-panel.mjs +1 -0
  34. package/dist/packem_chunks/auth-config-panel.mjs +1 -0
  35. package/dist/packem_chunks/auth-sessions-panel.mjs +1 -0
  36. package/dist/packem_chunks/containers-panel.mjs +1 -0
  37. package/dist/packem_chunks/dashboards-panel.mjs +1 -0
  38. package/dist/packem_chunks/evals-panel.mjs +1 -0
  39. package/dist/packem_chunks/fanout-panel.mjs +1 -0
  40. package/dist/packem_chunks/flags-panel.mjs +1 -0
  41. package/dist/packem_chunks/issues-panel.mjs +1 -0
  42. package/dist/packem_chunks/kv-browser.mjs +1 -0
  43. package/dist/packem_chunks/log-drains-panel.mjs +4 -0
  44. package/dist/packem_chunks/migrations-route.mjs +1 -0
  45. package/dist/packem_chunks/organizations-panel.mjs +1 -0
  46. package/dist/packem_chunks/payments-panel.mjs +1 -0
  47. package/dist/packem_chunks/permissions-panel.mjs +1 -0
  48. package/dist/packem_chunks/privacy-requests-panel.mjs +1 -0
  49. package/dist/packem_chunks/queues-panel.mjs +1 -0
  50. package/dist/packem_chunks/reactors-panel.mjs +1 -0
  51. package/dist/packem_chunks/rls-panel.mjs +1 -0
  52. package/dist/packem_chunks/schedule-panel.mjs +1 -0
  53. package/dist/packem_chunks/sparkline.mjs +1 -0
  54. package/dist/packem_chunks/storage-rules-panel.mjs +1 -0
  55. package/dist/packem_chunks/subscriptions-panel.mjs +1 -0
  56. package/dist/packem_chunks/sync-client-panel.mjs +1 -0
  57. package/dist/packem_chunks/traces-panel.mjs +1 -0
  58. package/dist/packem_chunks/users-panel.mjs +1 -0
  59. package/dist/packem_chunks/vector-browser.mjs +1 -0
  60. package/dist/packem_chunks/workflows-panel.mjs +1 -0
  61. package/dist/packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs +1 -0
  62. package/dist/packem_shared/ApiDocsPanel-fhDlZGE4.mjs +2 -0
  63. package/dist/packem_shared/ApiReferencePanel-nAf8tNRr.mjs +1 -0
  64. package/dist/packem_shared/CommandPalette-D9ZY-qQd.mjs +1 -0
  65. package/dist/packem_shared/ConfirmButton-DU4p72Er.mjs +1 -0
  66. package/dist/packem_shared/ConnectionBadge-B8Hj5DaE.mjs +1 -0
  67. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs +1 -0
  68. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs +1 -0
  69. package/dist/packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs +1 -0
  70. package/dist/packem_shared/DataBrowser-E68QfaST.mjs +4 -0
  71. package/dist/packem_shared/DataFilters-CYZFt2EK.mjs +1 -0
  72. package/dist/packem_shared/ErrorBoundary-BWNF98VF.mjs +1 -0
  73. package/dist/packem_shared/GlobalDataBrowser-DhObcZDY.mjs +1 -0
  74. package/dist/packem_shared/HomePanel-CUuYsApa.mjs +1 -0
  75. package/dist/packem_shared/MigrationsPanel-CkVIwAbK.mjs +1 -0
  76. package/dist/packem_shared/OpenRpcReferencePanel-BxEr49D9.mjs +1 -0
  77. package/dist/packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.mjs +1 -0
  78. package/dist/packem_shared/ScheduledJobs-BZNcYWBP.mjs +1 -0
  79. package/dist/packem_shared/ShardInput-C6mjgAh4.mjs +1 -0
  80. package/dist/packem_shared/Studio-CZjQXFHC.mjs +1 -0
  81. package/dist/packem_shared/StudioApp-C9ENwcOH.mjs +1 -0
  82. package/dist/packem_shared/StudioI18nProvider-fVsCSs5L.mjs +1 -0
  83. package/dist/packem_shared/advisor-view-DzI2RQhY.mjs +1 -0
  84. package/dist/packem_shared/aggregateMetrics-DKFJc-o5.mjs +1 -0
  85. package/dist/packem_shared/alert-PB5W11MM.mjs +1 -0
  86. package/dist/packem_shared/app.d-D7vL0y8y.d.mts +349 -0
  87. package/dist/packem_shared/app.d-D7vL0y8y.d.ts +349 -0
  88. package/dist/packem_shared/auth-pager-DiDnXsfe.mjs +1 -0
  89. package/dist/packem_shared/badge-r_5B4LHP.mjs +1 -0
  90. package/dist/packem_shared/bar-chart-BCsEIQoQ.mjs +6 -0
  91. package/dist/packem_shared/browser-storage-BH1MxLZs.mjs +1 -0
  92. package/dist/packem_shared/button-q0UYSmrn.mjs +1 -0
  93. package/dist/packem_shared/card-By2O8ULa.mjs +1 -0
  94. package/dist/packem_shared/cf-links-CBJ5SywP.mjs +1 -0
  95. package/dist/packem_shared/checkbox-CnS9cyCz.mjs +1 -0
  96. package/dist/packem_shared/control-button-BOZ5K-FC.mjs +1 -0
  97. package/dist/packem_shared/data-grid-DIiNmDR9.mjs +1 -0
  98. package/dist/packem_shared/data-view-params-DhYmAkcj.mjs +1 -0
  99. package/dist/packem_shared/diagram-export-panel-D5CVNJkp.mjs +2 -0
  100. package/dist/packem_shared/dropdown-menu-jLZenfWH.mjs +2 -0
  101. package/dist/packem_shared/empty-state-D7jEML_T.mjs +1 -0
  102. package/dist/packem_shared/error-alert-DueSEkt-.mjs +1 -0
  103. package/dist/packem_shared/grid-features-OVIMIQan.mjs +6 -0
  104. package/dist/packem_shared/grid-pagination-DgzyzfBh.mjs +1 -0
  105. package/dist/packem_shared/home-panel-BcE8S2Nn.mjs +3 -0
  106. package/dist/packem_shared/input-CXhxesPC.mjs +1 -0
  107. package/dist/packem_shared/internal-Df43vQI0.mjs +2 -0
  108. package/dist/packem_shared/label-DKFzyHq6.mjs +1 -0
  109. package/dist/packem_shared/live-status-BuJdUZFU.mjs +1 -0
  110. package/dist/packem_shared/log-fields-BolUoZ9g.mjs +1 -0
  111. package/dist/packem_shared/log-line-CICyJ_kc.mjs +1 -0
  112. package/dist/packem_shared/metrics-format-1sNGG47R.mjs +1 -0
  113. package/dist/packem_shared/modal-shell-CDztwLnv.mjs +1 -0
  114. package/dist/packem_shared/operation-console-provider-DoloEvon.mjs +1 -0
  115. package/dist/packem_shared/recording-client-CyFiAE2l.mjs +1 -0
  116. package/dist/packem_shared/reference-view-CIHyURU6.mjs +13 -0
  117. package/dist/packem_shared/schema-diagram-C5oilX7l.mjs +2 -0
  118. package/dist/packem_shared/scroll-area-CXCQH7VT.mjs +2 -0
  119. package/dist/packem_shared/select-DPyS18Vy.mjs +2 -0
  120. package/dist/packem_shared/shard-history-CaO3C4KQ.mjs +1 -0
  121. package/dist/packem_shared/shortcuts-B9gDaXmw.mjs +1 -0
  122. package/dist/packem_shared/skeleton-DX1gfixl.mjs +1 -0
  123. package/dist/packem_shared/sparkline-B_sPPO_8.mjs +1 -0
  124. package/dist/packem_shared/sql-result-table-DyK762_A.mjs +1 -0
  125. package/dist/packem_shared/stat-card-BAv73QtB.mjs +1 -0
  126. package/dist/packem_shared/storage-tier-C2mKwYRj.mjs +1 -0
  127. package/dist/packem_shared/studio-fK2DTLde.mjs +2 -0
  128. package/dist/packem_shared/table-D0SBiDu-.mjs +2 -0
  129. package/dist/packem_shared/table-list-sidebar-DkPO_Qtz.mjs +1 -0
  130. package/dist/packem_shared/textarea--40GKAyz.mjs +1 -0
  131. package/dist/packem_shared/trace-handoff-BV3EWqy_.mjs +1 -0
  132. package/dist/packem_shared/use-admin-query-tlBof8Yg.mjs +1 -0
  133. package/dist/packem_shared/use-admin-spec-Bir7V68L.mjs +1 -0
  134. package/dist/packem_shared/use-async-submit-CZqCMTJ_.mjs +1 -0
  135. package/dist/packem_shared/use-auth-config-Z_n4ABCI.mjs +1 -0
  136. package/dist/packem_shared/use-mirrored-ref-CVDf2z1M.mjs +1 -0
  137. package/dist/packem_shared/use-open-trace-DMVhpnyG.mjs +1 -0
  138. package/dist/packem_shared/use-shard-key-BsP3o5wT.mjs +1 -0
  139. package/dist/packem_shared/use-sql-assistant-CZydTzd5.mjs +1 -0
  140. package/dist/packem_shared/useDebounced-DVeQ5-oW.mjs +1 -0
  141. package/dist/packem_shared/utils-bhneXptQ.mjs +1 -0
  142. package/dist/packem_shared/virtual-rect-D_j7aLxX.mjs +1 -0
  143. package/dist/standalone/chunk-253UHWDX.js +1 -0
  144. package/dist/standalone/chunk-2I4NHEKA.js +1 -0
  145. package/dist/standalone/chunk-2IKDEUCX.js +1 -0
  146. package/dist/standalone/chunk-2VA5S3IA.js +1 -0
  147. package/dist/standalone/chunk-37WYCOQ2.js +1 -0
  148. package/dist/standalone/chunk-3J42UGFU.js +1 -0
  149. package/dist/standalone/chunk-3PGRJ3V6.js +1 -0
  150. package/dist/standalone/chunk-3V25YSWQ.js +1 -0
  151. package/dist/standalone/chunk-3YXASVTP.js +1 -0
  152. package/dist/standalone/chunk-4OXIU2KT.js +1 -0
  153. package/dist/standalone/chunk-4TH2NPLW.js +1 -0
  154. package/dist/standalone/chunk-4WD4XGC3.js +1 -0
  155. package/dist/standalone/chunk-4ZEL6BYL.js +1 -0
  156. package/dist/standalone/chunk-55UGUCQ6.js +1 -0
  157. package/dist/standalone/chunk-5B2RTXBS.js +1 -0
  158. package/dist/standalone/chunk-5QR2SQIS.js +1 -0
  159. package/dist/standalone/chunk-6HLARDYO.js +1 -0
  160. package/dist/standalone/chunk-6NTTNUVH.js +1 -0
  161. package/dist/standalone/chunk-6OHCSDVS.js +15 -0
  162. package/dist/standalone/chunk-6QTAHSDD.js +1 -0
  163. package/dist/standalone/chunk-7G4Z6Q7X.js +1 -0
  164. package/dist/standalone/chunk-7RKB5KS7.js +1 -0
  165. package/dist/standalone/chunk-7U2CDNFA.js +1 -0
  166. package/dist/standalone/chunk-7Y3SY37W.js +1 -0
  167. package/dist/standalone/chunk-A43P35OS.js +1 -0
  168. package/dist/standalone/chunk-AJV3ZKEY.js +3 -0
  169. package/dist/standalone/chunk-AN5MJC2Z.js +1 -0
  170. package/dist/standalone/chunk-ARWJGYXL.js +1 -0
  171. package/dist/standalone/chunk-ASEMAFEH.js +1 -0
  172. package/dist/standalone/chunk-AUAECCXB.js +1 -0
  173. package/dist/standalone/{chunk-BJGBHGK3.js → chunk-AUGKHAMQ.js} +1 -1
  174. package/dist/standalone/chunk-BIF3IS4H.js +1 -0
  175. package/dist/standalone/chunk-BOMPSVRC.js +1 -0
  176. package/dist/standalone/chunk-BRE5MCZN.js +1 -0
  177. package/dist/standalone/chunk-CAWYFUK6.js +1 -0
  178. package/dist/standalone/chunk-CCDX5RYT.js +1 -0
  179. package/dist/standalone/chunk-CGQMJYCW.js +1 -0
  180. package/dist/standalone/chunk-CVXNHIQW.js +1 -0
  181. package/dist/standalone/chunk-CYVAA5G2.js +1 -0
  182. package/dist/standalone/chunk-DMPS3Z6Z.js +1 -0
  183. package/dist/standalone/chunk-E4PXACVL.js +3 -0
  184. package/dist/standalone/chunk-ECY2JC5F.js +1 -0
  185. package/dist/standalone/chunk-FPI7AMQJ.js +1 -0
  186. package/dist/standalone/chunk-FQPBYMII.js +15 -0
  187. package/dist/standalone/chunk-FUYEZFBP.js +1 -0
  188. package/dist/standalone/chunk-GHQ2VDI2.js +1 -0
  189. package/dist/standalone/chunk-GS35QQEF.js +1 -0
  190. package/dist/standalone/chunk-GTN6NHUL.js +1 -0
  191. package/dist/standalone/chunk-GWOHQJIL.js +1 -0
  192. package/dist/standalone/chunk-H6AITPPC.js +1 -0
  193. package/dist/standalone/chunk-HCMDAFTX.js +1 -0
  194. package/dist/standalone/chunk-HCTJKP5J.js +1 -0
  195. package/dist/standalone/chunk-HELZ4ROC.js +1 -0
  196. package/dist/standalone/chunk-HJHSQPHW.js +19 -0
  197. package/dist/standalone/chunk-HPXC7ZFN.js +1 -0
  198. package/dist/standalone/chunk-HRVRCCML.js +3 -0
  199. package/dist/standalone/chunk-HXF32KMX.js +1 -0
  200. package/dist/standalone/chunk-I26MS5PJ.js +1 -0
  201. package/dist/standalone/chunk-I5ETS5CZ.js +1 -0
  202. package/dist/standalone/chunk-ICDMV4MP.js +9 -0
  203. package/dist/standalone/chunk-IWZ7GVQO.js +1 -0
  204. package/dist/standalone/chunk-JBWGM4O5.js +1 -0
  205. package/dist/standalone/chunk-JQXA2OYK.js +1 -0
  206. package/dist/standalone/chunk-JSKSPTUJ.js +1 -0
  207. package/dist/standalone/chunk-JWOD73TN.js +1 -0
  208. package/dist/standalone/chunk-JZGTSH2C.js +4 -0
  209. package/dist/standalone/chunk-KWTRRYMT.js +1 -0
  210. package/dist/standalone/chunk-LR4Y6CQF.js +14 -0
  211. package/dist/standalone/chunk-LY625VRG.js +1 -0
  212. package/dist/standalone/chunk-MQCDUPD3.js +1 -0
  213. package/dist/standalone/chunk-MVWZMWPD.js +1 -0
  214. package/dist/standalone/chunk-MXYGUIAL.js +1 -0
  215. package/dist/standalone/chunk-MYDSSTIL.js +1 -0
  216. package/dist/standalone/chunk-MZNJ4SBH.js +1 -0
  217. package/dist/standalone/chunk-N2SJOHD6.js +1 -0
  218. package/dist/standalone/chunk-NBFGB6LQ.js +1 -0
  219. package/dist/standalone/chunk-NCPW7WHO.js +1 -0
  220. package/dist/standalone/chunk-NDTQTKDX.js +6 -0
  221. package/dist/standalone/chunk-NGVP66OH.js +1 -0
  222. package/dist/standalone/chunk-NQZALRU3.js +1 -0
  223. package/dist/standalone/chunk-NRP22GKC.js +1 -0
  224. package/dist/standalone/chunk-NXQW5E6W.js +1 -0
  225. package/dist/standalone/chunk-ODMIUMAO.js +1 -0
  226. package/dist/standalone/chunk-ODQ6AVXD.js +1 -0
  227. package/dist/standalone/chunk-OPM7ESDV.js +1 -0
  228. package/dist/standalone/chunk-OQ6I6OXT.js +2 -0
  229. package/dist/standalone/chunk-OSGXNEFA.js +1 -0
  230. package/dist/standalone/chunk-OWVKR6J4.js +1 -0
  231. package/dist/standalone/chunk-OYCUPD3Q.js +1 -0
  232. package/dist/standalone/chunk-P5QHD7XI.js +1 -0
  233. package/dist/standalone/chunk-PFP4ELTQ.js +1 -0
  234. package/dist/standalone/chunk-PIMTWCRD.js +1 -0
  235. package/dist/standalone/chunk-PNI5SACT.js +1 -0
  236. package/dist/standalone/chunk-PUEVXAMZ.js +1 -0
  237. package/dist/standalone/chunk-Q2KHDNYH.js +8 -0
  238. package/dist/standalone/chunk-Q6ED4KUL.js +1 -0
  239. package/dist/standalone/chunk-Q6IT6ZD7.js +1 -0
  240. package/dist/standalone/{chunk-ZHVTQ37P.js → chunk-QAQDMS6R.js} +1 -1
  241. package/dist/standalone/chunk-QHXHYD2D.js +1 -0
  242. package/dist/standalone/chunk-QJLHH3ET.js +1 -0
  243. package/dist/standalone/chunk-R5P53FO2.js +2 -0
  244. package/dist/standalone/chunk-R6U22RSY.js +1 -0
  245. package/dist/standalone/chunk-RGMVGZV4.js +1 -0
  246. package/dist/standalone/chunk-RWVIV3U7.js +1 -0
  247. package/dist/standalone/chunk-S4Z7K55A.js +1 -0
  248. package/dist/standalone/chunk-SA2OGF3F.js +1 -0
  249. package/dist/standalone/chunk-SJQERRSZ.js +1 -0
  250. package/dist/standalone/chunk-SJUYCXDY.js +1 -0
  251. package/dist/standalone/chunk-SV764LKQ.js +1 -0
  252. package/dist/standalone/chunk-SYMULPR4.js +4 -0
  253. package/dist/standalone/chunk-TTZZ7DNO.js +1 -0
  254. package/dist/standalone/chunk-TVCVRQUC.js +59 -0
  255. package/dist/standalone/chunk-TY5DCOTU.js +5 -0
  256. package/dist/standalone/chunk-UC7MNI2F.js +1 -0
  257. package/dist/standalone/chunk-UG2MMHTH.js +1 -0
  258. package/dist/standalone/chunk-UYEZR3BI.js +1 -0
  259. package/dist/standalone/chunk-VCFEO3RI.js +1 -0
  260. package/dist/standalone/chunk-VESGIGMQ.js +1 -0
  261. package/dist/standalone/chunk-VQPCNZNW.js +1 -0
  262. package/dist/standalone/chunk-VRWHCG2V.js +1 -0
  263. package/dist/standalone/chunk-VY4D6ROH.js +1 -0
  264. package/dist/standalone/chunk-WJRYEML4.js +1 -0
  265. package/dist/standalone/chunk-X2C3EX3E.js +1 -0
  266. package/dist/standalone/chunk-XGCIDUJF.js +1 -0
  267. package/dist/standalone/chunk-XGYH6FFM.js +1 -0
  268. package/dist/standalone/chunk-XHRKNCCI.js +1 -0
  269. package/dist/standalone/chunk-XZTOX6TC.js +1 -0
  270. package/dist/standalone/chunk-Y3AYVFTK.js +1 -0
  271. package/dist/standalone/chunk-YVR4SEPU.js +1 -0
  272. package/dist/standalone/chunk-Z22BDS6N.js +1 -0
  273. package/dist/standalone/chunk-ZKJS6EBE.js +1 -0
  274. package/dist/standalone/chunk-ZRJQQLAF.js +1 -0
  275. package/dist/standalone/chunk-ZTPG3TFT.js +1 -0
  276. package/dist/standalone/studio.js +9 -214
  277. package/dist/styles.css +2 -2
  278. package/package.json +26 -22
  279. package/dist/index.js +0 -41
  280. package/dist/mount.js +0 -27
  281. package/dist/packem_chunks/ApiTab.js +0 -251
  282. package/dist/packem_chunks/AuditPanel.js +0 -200
  283. package/dist/packem_chunks/ExportImportPanel.js +0 -198
  284. package/dist/packem_chunks/FileBrowser.js +0 -2932
  285. package/dist/packem_chunks/FunctionRunner.js +0 -343
  286. package/dist/packem_chunks/FunctionStatsPanel.js +0 -377
  287. package/dist/packem_chunks/HealthPanel.js +0 -648
  288. package/dist/packem_chunks/InsightsPanel.js +0 -462
  289. package/dist/packem_chunks/LogsPanel.js +0 -827
  290. package/dist/packem_chunks/MailPanel.js +0 -441
  291. package/dist/packem_chunks/MetricsPanel.js +0 -1344
  292. package/dist/packem_chunks/MigrationsPanel.js +0 -239
  293. package/dist/packem_chunks/PitrPanel.js +0 -252
  294. package/dist/packem_chunks/SchemaViewer.js +0 -2513
  295. package/dist/packem_chunks/SecurityAdvisorPanel.js +0 -95
  296. package/dist/packem_chunks/SettingsPanel.js +0 -391
  297. package/dist/packem_chunks/SqlEditorPanel.js +0 -2323
  298. package/dist/packem_chunks/TableEditor.js +0 -313
  299. package/dist/packem_chunks/analytics-panel.js +0 -261
  300. package/dist/packem_chunks/auth-config-panel.js +0 -179
  301. package/dist/packem_chunks/auth-sessions-panel.js +0 -175
  302. package/dist/packem_chunks/containers-panel.js +0 -247
  303. package/dist/packem_chunks/dashboards-panel.js +0 -780
  304. package/dist/packem_chunks/fanout-panel.js +0 -482
  305. package/dist/packem_chunks/flags-panel.js +0 -176
  306. package/dist/packem_chunks/kv-browser.js +0 -1896
  307. package/dist/packem_chunks/log-drains-panel.js +0 -273
  308. package/dist/packem_chunks/organizations-panel.js +0 -670
  309. package/dist/packem_chunks/payments-panel.js +0 -186
  310. package/dist/packem_chunks/permissions-panel.js +0 -805
  311. package/dist/packem_chunks/queues-panel.js +0 -148
  312. package/dist/packem_chunks/rls-panel.js +0 -315
  313. package/dist/packem_chunks/schedule-panel.js +0 -831
  314. package/dist/packem_chunks/sparkline.js +0 -79
  315. package/dist/packem_chunks/storage-rules-panel.js +0 -140
  316. package/dist/packem_chunks/subscriptions-panel.js +0 -238
  317. package/dist/packem_chunks/users-panel.js +0 -1265
  318. package/dist/packem_chunks/vector-browser.js +0 -281
  319. package/dist/packem_chunks/workflows-panel.js +0 -562
  320. package/dist/packem_shared/ADMIN_FUNCTIONS-CdaxLGkE.js +0 -48
  321. package/dist/packem_shared/ApiDocsPanel-Cu6mD4u7.js +0 -842
  322. package/dist/packem_shared/ApiReferencePanel-Co_wpRF2.js +0 -230
  323. package/dist/packem_shared/CommandPalette-BUPpbpMc.js +0 -373
  324. package/dist/packem_shared/ConfirmButton-C2eVi2Qv.js +0 -59
  325. package/dist/packem_shared/ConnectionBadge-B2DDM2Tn.js +0 -111
  326. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +0 -50
  327. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +0 -89
  328. package/dist/packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js +0 -27
  329. package/dist/packem_shared/DataBrowser-DSNK1tPg.js +0 -4493
  330. package/dist/packem_shared/DataFilters-FNquMaiu.js +0 -249
  331. package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +0 -66
  332. package/dist/packem_shared/GlobalDataBrowser-ErfvIs1S.js +0 -289
  333. package/dist/packem_shared/HomePanel-DQk3P8xX.js +0 -14
  334. package/dist/packem_shared/OpenRpcReferencePanel-DLWzrIx9.js +0 -192
  335. package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +0 -3
  336. package/dist/packem_shared/ScheduledJobs-ClaNpZsg.js +0 -262
  337. package/dist/packem_shared/ShardInput-gx_DZXXn.js +0 -107
  338. package/dist/packem_shared/Studio-CFTYGEUt.js +0 -16
  339. package/dist/packem_shared/StudioApp-Cy9vUwVl.js +0 -657
  340. package/dist/packem_shared/StudioI18nProvider-B-tDCZIi.js +0 -48
  341. package/dist/packem_shared/advisor-view-D3-U4kRR.js +0 -159
  342. package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +0 -108
  343. package/dist/packem_shared/alert-CdAET2K_.js +0 -68
  344. package/dist/packem_shared/app.d-CNLRTrWw.d.ts +0 -300
  345. package/dist/packem_shared/badge-B2PKA1-5.js +0 -49
  346. package/dist/packem_shared/bar-chart-DSwcWIRy.js +0 -3246
  347. package/dist/packem_shared/browser-storage-tLOxkIHd.js +0 -185
  348. package/dist/packem_shared/button-BhsN2uZH.js +0 -49
  349. package/dist/packem_shared/card-DURq3ElK.js +0 -175
  350. package/dist/packem_shared/cf-links-BZfRdxSE.js +0 -8
  351. package/dist/packem_shared/checkbox-UNkzAxl-.js +0 -63
  352. package/dist/packem_shared/data-grid-Jz8FqQ2C.js +0 -183
  353. package/dist/packem_shared/data-view-params-Cd6yRVbv.js +0 -96
  354. package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +0 -280
  355. package/dist/packem_shared/empty-state-DY_oe0k6.js +0 -98
  356. package/dist/packem_shared/error-alert-BBT6D22d.js +0 -114
  357. package/dist/packem_shared/grid-features-CUr8Z1_O.js +0 -745
  358. package/dist/packem_shared/home-panel-Bo-Mgrkn.js +0 -1639
  359. package/dist/packem_shared/input-XH4r1Pt1.js +0 -53
  360. package/dist/packem_shared/internal-DTsYVn-g.js +0 -97
  361. package/dist/packem_shared/label-D8ykjn5J.js +0 -46
  362. package/dist/packem_shared/live-status-FZ0psC1z.js +0 -44
  363. package/dist/packem_shared/modal-shell-hyaJvIJ6.js +0 -100
  364. package/dist/packem_shared/reference-view-CSKyUyPl.js +0 -2141
  365. package/dist/packem_shared/select-UkNYCT3s.js +0 -273
  366. package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
  367. package/dist/packem_shared/skeleton-CGhL0p20.js +0 -45
  368. package/dist/packem_shared/sparkline-BnA1kC9X.js +0 -93
  369. package/dist/packem_shared/storage-tier-CL98eOvn.js +0 -85
  370. package/dist/packem_shared/studio-Dg2e-dsR.js +0 -4014
  371. package/dist/packem_shared/table-DsCa9Qp9.js +0 -246
  372. package/dist/packem_shared/table-list-sidebar-B5psdSV1.js +0 -832
  373. package/dist/packem_shared/textarea-D3gaCU_-.js +0 -46
  374. package/dist/packem_shared/use-admin-query-BHPKmPuj.js +0 -106
  375. package/dist/packem_shared/use-auth-capabilities-C-VH0oJJ.js +0 -32
  376. package/dist/packem_shared/useDebounced-Dxncpg6z.js +0 -32
  377. package/dist/packem_shared/utils-B05Dmz_H.js +0 -8
  378. package/dist/packem_shared/virtual-rect-CVMUskSm.js +0 -10
  379. package/dist/standalone/chunk-25VHPD2I.js +0 -1
  380. package/dist/standalone/chunk-2GGMGPEP.js +0 -1
  381. package/dist/standalone/chunk-2K47A3P6.js +0 -1
  382. package/dist/standalone/chunk-2NGUNNGW.js +0 -1
  383. package/dist/standalone/chunk-3CJW6NWG.js +0 -4
  384. package/dist/standalone/chunk-3OA7PECS.js +0 -6
  385. package/dist/standalone/chunk-4H2OJBXO.js +0 -1
  386. package/dist/standalone/chunk-4MLAVZP4.js +0 -1
  387. package/dist/standalone/chunk-4QHKBC77.js +0 -1
  388. package/dist/standalone/chunk-55YA7ZZI.js +0 -76
  389. package/dist/standalone/chunk-5OH3VPZF.js +0 -1
  390. package/dist/standalone/chunk-5OIBXYZM.js +0 -1
  391. package/dist/standalone/chunk-6GFEVKJP.js +0 -1
  392. package/dist/standalone/chunk-764T6X6X.js +0 -1
  393. package/dist/standalone/chunk-7M3F6U4L.js +0 -1
  394. package/dist/standalone/chunk-7TJJXVSE.js +0 -1
  395. package/dist/standalone/chunk-7VF3IAAW.js +0 -2
  396. package/dist/standalone/chunk-AHILM3ZP.js +0 -1
  397. package/dist/standalone/chunk-AJIUI7DD.js +0 -1
  398. package/dist/standalone/chunk-AQGOX5DK.js +0 -1
  399. package/dist/standalone/chunk-BACPICH6.js +0 -1
  400. package/dist/standalone/chunk-BET2625I.js +0 -1
  401. package/dist/standalone/chunk-BQUQS7QN.js +0 -1
  402. package/dist/standalone/chunk-CKSHCYGC.js +0 -2
  403. package/dist/standalone/chunk-DCECRP45.js +0 -1
  404. package/dist/standalone/chunk-DFP2DADO.js +0 -1
  405. package/dist/standalone/chunk-DORBUITF.js +0 -1
  406. package/dist/standalone/chunk-DVKPRFIJ.js +0 -1
  407. package/dist/standalone/chunk-DWDILV2E.js +0 -1
  408. package/dist/standalone/chunk-E6WUCLSI.js +0 -1
  409. package/dist/standalone/chunk-E7WLF6IU.js +0 -1
  410. package/dist/standalone/chunk-EVPLBWUT.js +0 -8
  411. package/dist/standalone/chunk-FCSPAJW4.js +0 -1
  412. package/dist/standalone/chunk-FKO3HO6I.js +0 -4
  413. package/dist/standalone/chunk-G2ICR3DL.js +0 -1
  414. package/dist/standalone/chunk-GJ6PGSES.js +0 -13
  415. package/dist/standalone/chunk-GMSGZDDH.js +0 -13
  416. package/dist/standalone/chunk-GTM65MVX.js +0 -1
  417. package/dist/standalone/chunk-GVRM4U6W.js +0 -2
  418. package/dist/standalone/chunk-GZDWDDXN.js +0 -1
  419. package/dist/standalone/chunk-HV7G6DFP.js +0 -5
  420. package/dist/standalone/chunk-ISJAJWYI.js +0 -1
  421. package/dist/standalone/chunk-J6J54MBP.js +0 -1
  422. package/dist/standalone/chunk-JIDZFLTB.js +0 -4
  423. package/dist/standalone/chunk-JSEXCW5Q.js +0 -1
  424. package/dist/standalone/chunk-K3GNLVYK.js +0 -1
  425. package/dist/standalone/chunk-K4ZDRTQM.js +0 -1
  426. package/dist/standalone/chunk-KEGAWN6Y.js +0 -1
  427. package/dist/standalone/chunk-KZ6INM5M.js +0 -1
  428. package/dist/standalone/chunk-LI43EKM6.js +0 -1
  429. package/dist/standalone/chunk-MFPTVCJ6.js +0 -1
  430. package/dist/standalone/chunk-MPYFGAOW.js +0 -1
  431. package/dist/standalone/chunk-O3NAGRTR.js +0 -1
  432. package/dist/standalone/chunk-O77VNUFD.js +0 -1
  433. package/dist/standalone/chunk-OV2WFAJX.js +0 -1
  434. package/dist/standalone/chunk-PA3LN4XJ.js +0 -1
  435. package/dist/standalone/chunk-PD6WPVYU.js +0 -1
  436. package/dist/standalone/chunk-PN5NCZDX.js +0 -1
  437. package/dist/standalone/chunk-PVZI3CXP.js +0 -19
  438. package/dist/standalone/chunk-PZ7HD5T2.js +0 -1
  439. package/dist/standalone/chunk-QAFAJBAW.js +0 -1
  440. package/dist/standalone/chunk-QBAT52GB.js +0 -1
  441. package/dist/standalone/chunk-QHIIRFG7.js +0 -1
  442. package/dist/standalone/chunk-RRCPZMC2.js +0 -22
  443. package/dist/standalone/chunk-RSEEHNFI.js +0 -1
  444. package/dist/standalone/chunk-SEU5V7I6.js +0 -1
  445. package/dist/standalone/chunk-SFJ5F4DX.js +0 -1
  446. package/dist/standalone/chunk-SGDQIWAR.js +0 -4
  447. package/dist/standalone/chunk-SVR644RF.js +0 -1
  448. package/dist/standalone/chunk-SYEIXTEU.js +0 -1
  449. package/dist/standalone/chunk-T5HRXUSY.js +0 -1
  450. package/dist/standalone/chunk-TAD43CG5.js +0 -1
  451. package/dist/standalone/chunk-TBMYIZIO.js +0 -1
  452. package/dist/standalone/chunk-TDL7NEWA.js +0 -1
  453. package/dist/standalone/chunk-TM7CMA7X.js +0 -1
  454. package/dist/standalone/chunk-TQ36RWOP.js +0 -1
  455. package/dist/standalone/chunk-U4OAQPBT.js +0 -1
  456. package/dist/standalone/chunk-UDSVXA42.js +0 -1
  457. package/dist/standalone/chunk-UII66UVF.js +0 -1
  458. package/dist/standalone/chunk-UK64ZSUW.js +0 -1
  459. package/dist/standalone/chunk-VEZO7G5Q.js +0 -3
  460. package/dist/standalone/chunk-VLXV72QE.js +0 -1
  461. package/dist/standalone/chunk-VSHUSN6T.js +0 -1
  462. package/dist/standalone/chunk-VYMCCC6O.js +0 -1
  463. package/dist/standalone/chunk-WXPWVBIY.js +0 -1
  464. package/dist/standalone/chunk-X72PYOEW.js +0 -1
  465. package/dist/standalone/chunk-X7MMBSNW.js +0 -1
  466. package/dist/standalone/chunk-XIGIWZLO.js +0 -4
  467. package/dist/standalone/chunk-XNJNSCLM.js +0 -1
  468. package/dist/standalone/chunk-XUGSA2NG.js +0 -1
  469. package/dist/standalone/chunk-Y2ZPNDL7.js +0 -4
  470. package/dist/standalone/chunk-YM6BBZDN.js +0 -1
  471. package/dist/standalone/chunk-ZPP2KOR4.js +0 -1
  472. package/dist/standalone/chunk-ZPUO7FNI.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as q}from"./chunk-JQXA2OYK.js";import{a as F}from"./chunk-R6U22RSY.js";import{a as D}from"./chunk-YVR4SEPU.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import"./chunk-AUAECCXB.js";import{b as S}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as L}from"./chunk-SJUYCXDY.js";import"./chunk-NCPW7WHO.js";import"./chunk-3V25YSWQ.js";import"./chunk-55UGUCQ6.js";import{a as B}from"./chunk-4ZEL6BYL.js";import{c as _}from"./chunk-VRWHCG2V.js";import"./chunk-ICDMV4MP.js";import"./chunk-QAQDMS6R.js";import"./chunk-FQPBYMII.js";import{a as $}from"./chunk-RWVIV3U7.js";import{a as O,b as P,c as W,d as C,e as h,f as p}from"./chunk-HCTJKP5J.js";import{a as M,e as T}from"./chunk-2IKDEUCX.js";import{d as A,m as E}from"./chunk-HJHSQPHW.js";import{a as N,d as j,f as H,g as U}from"./chunk-I26MS5PJ.js";var R=j(H(),1);var t=j(U(),1);var J=80,Z=N(a=>{if(a===void 0)return"";let e=JSON.stringify(a,E);return e.length>J?`${e.slice(0,J)}\u2026`:e},"G"),z=N(a=>{let e=[];for(let r of a){let n=r.id.toString();if(r.subscriptions.length===0){e.push({admin:r.admin,connectionId:r.id,key:`c${n}`,subscription:null});continue}r.subscriptions.forEach((l,i)=>{e.push({admin:r.admin,connectionId:r.id,key:`c${n}-s${i.toString()}`,subscription:l})})}return e},"J"),w=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),ce=N(a=>{let e=(0,R.c)(22),{initialShardKey:r}=a,n=A(),{queryShardKey:l,setShardKey:i,shardKey:m}=F(r),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];let b;e[1]!==l?(b={keepPreviousData:!0,shardKey:l},e[1]=l,e[2]=b):b=e[2];let{data:s,error:o,errorSource:u,refetch:G}=_(B.listSubscriptions,f,b);q(G,!0);let x;if(e[3]!==o||e[4]!==u||e[5]!==s||e[6]!==i||e[7]!==m||e[8]!==n){let k=s===void 0?[]:z(s.connections),c;e[10]!==i||e[11]!==m?(c=(0,t.jsx)(D,{onChange:i,testId:"subs-shard-input",value:m}),e[10]=i,e[11]=m,e[12]=c):c=e[12];let d;e[13]!==s||e[14]!==n?(d=s!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,t.jsx)(S,{variant:"secondary",children:n("{count} connections",{count:s.totalConnections})}),(0,t.jsx)(S,{variant:"secondary",children:n("{count} subscriptions",{count:s.totalSubscriptions})})]}),e[13]=s,e[14]=n,e[15]=d):d=e[15];let g;e[16]!==c||e[17]!==d?(g=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,d]}),e[16]=c,e[17]=d,e[18]=g):g=e[18];let v;e[19]!==o||e[20]!==u?(v=o!==null&&(0,t.jsx)(L,{error:u,testId:"subs-error"}),e[19]=o,e[20]=u,e[21]=v):v=e[21],x=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[g,v,o===null&&s!==void 0&&k.length===0&&(0,t.jsx)($,{description:n("Active WebSocket subscriptions on this shard."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"})}),testId:"subs-empty",title:n("No active subscriptions.")}),o===null&&k.length>0&&(0,t.jsx)(M,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(O,{"data-testid":"subs-table",children:[(0,t.jsx)(P,{children:(0,t.jsxs)(C,{children:[(0,t.jsx)(h,{children:n("Connection")}),(0,t.jsx)(h,{children:n("Function path")}),(0,t.jsx)(h,{children:n("Table")}),(0,t.jsx)(h,{children:n("Arguments")})]})}),(0,t.jsx)(W,{children:k.map(y=>{let{subscription:I}=y,K=Z(I?.args);return(0,t.jsxs)(C,{"data-testid":"subs-row",children:[(0,t.jsx)(p,{className:"font-medium tabular-nums",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:["#",y.connectionId,y.admin&&(0,t.jsx)(S,{variant:"outline",children:n("admin")})]})}),(0,t.jsx)(p,{className:"font-mono text-xs",children:I?.functionPath??w}),(0,t.jsx)(p,{children:I?.table??w}),(0,t.jsx)(p,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:K||void 0,children:K||w})]},y.key)})})]})})})]}),e[3]=o,e[4]=u,e[5]=s,e[6]=i,e[7]=m,e[8]=n,e[9]=x}else x=e[9];return x},"ae");export{ce as default};
@@ -0,0 +1 @@
1
+ import{a as r,d as p,e as m}from"./chunk-I26MS5PJ.js";function d(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}r(d,"mergeObjects");var y={};function h(e,t,n,o,i){if(!n&&!o&&!i&&!e)return R(t);let c=R(e);return t&&(c=E(c,t)),n&&(c=E(c,n)),o&&(c=E(c,o)),i&&(c=E(c,i)),c}r(h,"mergeProps");function x(e){if(e.length===0)return y;if(e.length===1)return R(e[0]);let t=R(e[0]);for(let n=1;n<e.length;n+=1)t=E(t,e[n]);return t}r(x,"mergePropsN");function R(e){return b(e)?{...T(e,y)}:J(e)}r(R,"createInitialMergedProps");function E(e,t){return b(t)?T(t,e):q(e,t)}r(E,"mergeInto");function J(e){let t={...e};for(let n in t){let o=t[n];O(n,o)&&(t[n]=k(o))}return t}r(J,"copyInitialProps");function q(e,t){if(!t)return e;for(let n in t){let o=t[n];switch(n){case"style":{e[n]=d(e.style,o);break}case"className":{e[n]=g(e.className,o);break}default:O(n,o)?e[n]=K(e[n],o):e[n]=o}}return e}r(q,"mutablyMergeInto");function O(e,t){let n=e.charCodeAt(0),o=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&o===110&&i>=65&&i<=90&&(typeof t=="function"||typeof t>"u")}r(O,"isEventHandler");function b(e){return typeof e=="function"}r(b,"isPropsGetter");function T(e,t){return b(e)?e(t):e??y}r(T,"resolvePropsGetter");function K(e,t){return t?e?(...n)=>{let o=n[0];if(_(o)){let c=o;M(c);let s=t(...n);return c.baseUIHandlerPrevented||e?.(...n),s}let i=t(...n);return e?.(...n),i}:k(t):e}r(K,"mergeEventHandlers");function k(e){return e&&((...t)=>{let n=t[0];return _(n)&&M(n),e(...t)})}r(k,"wrapEventHandler");function M(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}r(M,"makeEventPreventable");function g(e,t){return t?e?t+" "+e:t:e}r(g,"mergeClassNames");function _(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}r(_,"isSyntheticEvent");function Q(e,t){return r(function(o,...i){let c=new URL(e);return c.searchParams.set("code",o.toString()),i.forEach(s=>c.searchParams.append("args[]",s)),`${t} error #${o}; visit ${c} for the full message.`},"formatErrorMessage")}r(Q,"createFormatErrorMessage");var X=Q("https://base-ui.com/production-error","Base UI"),L=X;var a=p(m(),1);var j=p(m(),1);var V={};function v(e,t){let n=j.useRef(V);return n.current===V&&(n.current=e(t)),n}r(v,"useRefWithInit");function A(e,t,n,o){let i=v(S).current;return ee(i,e,t,n,o)&&$(i,[e,t,n,o]),i.callback}r(A,"useMergedRefs");function U(e){let t=v(S).current;return te(t,e)&&$(t,e),t.callback}r(U,"useMergedRefsN");function S(){return{callback:null,cleanup:null,refs:[]}}r(S,"createForkRef");function ee(e,t,n,o,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==o||e.refs[3]!==i}r(ee,"didChange");function te(e,t){return e.refs.length!==t.length||e.refs.some((n,o)=>n!==t[o])}r(te,"didChangeN");function $(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){let o=Array(t.length).fill(null);for(let i=0;i<t.length;i+=1){let c=t[i];if(c!=null)switch(typeof c){case"function":{let s=c(n);typeof s=="function"&&(o[i]=s);break}case"object":{c.current=n;break}default:}}e.cleanup=()=>{for(let i=0;i<t.length;i+=1){let c=t[i];if(c!=null)switch(typeof c){case"function":{let s=o[i];typeof s=="function"?s():c(null);break}case"object":{c.current=null;break}default:}}}}}}r($,"update");var z=p(m(),1);var B=p(m(),1);var ne=parseInt(B.version,10);function Y(e){return ne>=e}r(Y,"isReactVersionAtLeast");function N(e){if(!z.isValidElement(e))return null;let t=e,n=t.props;return(Y(19)?n?.ref:t.ref)??null}r(N,"getReactElementRef");function we(){}r(we,"NOOP");var Ce=Object.freeze([]),l=Object.freeze({});function D(e,t){let n={};for(let o in e){let i=e[o];if(t?.hasOwnProperty(o)){let c=t[o](i);c!=null&&Object.assign(n,c);continue}i===!0?n[`data-${o.toLowerCase()}`]="":i&&(n[`data-${o.toLowerCase()}`]=i.toString())}return n}r(D,"getStateAttributesProps");function F(e,t){return typeof e=="function"?e(t):e}r(F,"resolveClassName");function W(e,t){return typeof e=="function"?e(t):e}r(W,"resolveStyle");var P=p(m(),1);function We(e,t,n={}){let o=t.render;n.enabled!==!1&&(o=ce(o));let i=re(t,n,o);if(n.enabled===!1)return null;let c=n.state??l;return se(e,o,i,c)}r(We,"useRenderElement");function re(e,t,n){let{className:o,style:i}=e,{state:c=l,ref:s,props:I,stateAttributesMapping:Z,enabled:f=!0}=t,w=f?F(o,c):void 0,C=f?W(i,c):void 0,G=f?D(c,Z):l,H=f&&I?oe(I):void 0,u=f?d(G,H)??{}:l;return typeof document<"u"&&(f?Array.isArray(s)?u.ref=U([u.ref,N(n),...s]):u.ref=A(u.ref,N(n),s):A(null,null)),f?(w!==void 0&&(u.className=g(u.className,w)),C!==void 0&&(u.style=d(u.style,C)),u):l}r(re,"useRenderElementProps");function oe(e){return Array.isArray(e)?x(e):h(void 0,e)}r(oe,"resolveRenderFunctionProps");var ie=Symbol.for("react.lazy");function ce(e){if(e?.$$typeof!==ie)return e;let t=a.Children.toArray(e)[0];return a.isValidElement(t)?t:e}r(ce,"unwrapLazyRenderProp");function se(e,t,n,o){if(t){if(typeof t=="function")return t(n,o);let i=h(n,t.props);return i.ref=n.ref,a.cloneElement(t,i)}if(e&&typeof e=="string")return ue(e,n);throw new Error(L(8))}r(se,"evaluateRenderProp");function ue(e,t){return e==="button"?(0,P.createElement)("button",{type:"button",...t,key:t.key}):e==="img"?(0,P.createElement)("img",{alt:"",...t,key:t.key}):a.createElement(e,t)}r(ue,"renderTag");export{h as a,M as b,L as c,v as d,A as e,Y as f,we as g,Ce as h,l as i,We as j};
@@ -0,0 +1 @@
1
+ import{a as Ze}from"./chunk-JBWGM4O5.js";import{a as Me,b as Re}from"./chunk-Q6IT6ZD7.js";import"./chunk-Q2KHDNYH.js";import"./chunk-NQZALRU3.js";import"./chunk-OPM7ESDV.js";import"./chunk-Y3AYVFTK.js";import{a as ke}from"./chunk-37WYCOQ2.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import"./chunk-AUGKHAMQ.js";import{a as Ye}from"./chunk-R6U22RSY.js";import{a as Xe}from"./chunk-YVR4SEPU.js";import{b as We}from"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import{i as Je}from"./chunk-OQ6I6OXT.js";import{i as Ae}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{a as ge}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as Ee}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as je}from"./chunk-4ZEL6BYL.js";import{l as Ue}from"./chunk-ICDMV4MP.js";import"./chunk-QAQDMS6R.js";import"./chunk-FQPBYMII.js";import{a as Qe}from"./chunk-RWVIV3U7.js";import{a as qe,b as Ge,c as Ke,d as Pe,e as Le}from"./chunk-2IKDEUCX.js";import{d as ze,f as Fe,g as $e,h as Oe,p as be}from"./chunk-HJHSQPHW.js";import{a as r,d as Be,e as nt,f as st,g as rt,i as De}from"./chunk-I26MS5PJ.js";var we=Be(st(),1);var x=Be(nt(),1);var t=Be(rt(),1);var ot=Fe(je.listTables),it=Fe(je.listTableIndexes),dt=Fe(je.readTablePage),ct=Fe(je.describeTables),mt={},He=[],ut=r(s=>{let e=(0,we.c)(74),{initialShardKey:u,initialTable:n}=s,l=Ue(),[a,m]=(0,x.useState)("graph"),{queryShardKey:c,setShardKey:d,shardKey:b}=Ye(u),[o,h]=(0,x.useState)(""),[i,y]=(0,x.useState)(null),[p,$]=(0,x.useState)(null),S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S={},e[0]=S):S=e[0];let[K,N]=(0,x.useState)(S),O;e[1]===Symbol.for("react.memo_cache_sentinel")?(O={},e[1]=O):O=e[1];let[E,P]=(0,x.useState)(O),[T,C]=(0,x.useState)(null),z;e[2]===Symbol.for("react.memo_cache_sentinel")?(z={},e[2]=z):z=e[2];let[F,fe]=(0,x.useState)(z),te;e[3]===Symbol.for("react.memo_cache_sentinel")?(te={},e[3]=te):te=e[3];let[_,j]=(0,x.useState)(te),[k,xe]=(0,x.useState)(null),[L,ce]=(0,x.useState)(null),le;e[4]===Symbol.for("react.memo_cache_sentinel")?(le={},e[4]=le):le=e[4];let[W,Ce]=(0,x.useState)(le),[X,me]=(0,x.useState)(null),ve=(0,x.useRef)(0),M;e[5]!==l?(M=r(async g=>{ve.current=ve.current+1;let v=ve.current;$(null);try{let w=await l.query(ot,{},$e(g));if(v!==ve.current)return;We(g),y(w),N({}),P({}),C(null),fe(A=>Object.fromEntries(Object.entries(A).filter(I=>{let[pe]=I;return pe!==g}))),j(A=>Object.fromEntries(Object.entries(A).filter(I=>{let[pe]=I;return pe!==g})))}catch(w){let A=w;if(v!==ve.current)return;y(null),$(Oe(A))}},"D"),e[5]=l,e[6]=M):M=e[6];let B=M,ae;e[7]!==l?(ae=r(async()=>{ce(null);try{xe(await l.listGlobalTables())}catch(g){let v=g;xe(null),ce(Oe(v))}},"se"),e[7]=l,e[8]=ae):ae=e[8];let ue=ae,D,ne;e[9]!==c||e[10]!==B||e[11]!==ue?(D=r(()=>{be(B(c)),be(ue())},"R"),ne=[B,ue,c],e[9]=c,e[10]=B,e[11]=ue,e[12]=D,e[13]=ne):(D=e[12],ne=e[13]),(0,x.useEffect)(D,ne);let R;e[14]!==l||e[15]!==K||e[16]!==T||e[17]!==c?(R=r(async g=>{if(T===g){C(null);return}C(g);let v=`${c}:${g}`;if(K[v]!==void 0)return;let[w,A]=await Promise.allSettled([l.query(dt,{limit:1,offset:0,table:g},$e(c)),l.query(it,{table:g},$e(c))]);w.status==="fulfilled"?N(I=>({...I,[v]:w.value.columns})):$(Oe(w.reason)),A.status==="fulfilled"&&P(I=>({...I,[v]:A.value.indexes}))},"K"),e[14]=l,e[15]=K,e[16]=T,e[17]=c,e[18]=R):R=e[18];let se=R,re;e[19]!==l||e[20]!==W||e[21]!==X?(re=r(async g=>{if(X===g){me(null);return}if(me(g),W[g]===void 0)try{let v=await l.readGlobalTablePage({limit:1,offset:0,table:g});Ce(w=>({...w,[g]:v.columns}))}catch(v){ce(Oe(v))}},"oe"),e[19]=l,e[20]=W,e[21]=X,e[22]=re):re=e[22];let he=re,Y=(0,x.useRef)(void 0),Z,V;e[23]!==n||e[24]!==i||e[25]!==se?(Z=r(()=>{n===void 0||i===null||Y.current===n||i.some(g=>g.name===n)&&(Y.current=n,be(se(n)))},"Q"),V=[n,i,se],e[23]=n,e[24]=i,e[25]=se,e[26]=Z,e[27]=V):(Z=e[26],V=e[27]),(0,x.useEffect)(Z,V);let oe;e[28]!==l?(oe=r(async(g,v,w)=>{let[A,I]=await Promise.all([Promise.allSettled([l.query(ct,{tables:[...v,...w]},$e(g))]),Promise.all(w.map(async Q=>{let Se=await Promise.allSettled([l.readGlobalTablePage({limit:1,offset:0,table:Q})]),Ve=Se[0].status==="fulfilled"?Se[0].value:void 0;return{columns:Ve?.columns??[],refs:Ve?.refs??{},table:Q}}))]),pe=A[0].status==="fulfilled"?A[0].value?.columnsByTable??{}:{},_e=A[0].status==="rejected",Ie=new Map(I.map(ht)),G=[...v,...w].map(Q=>{let Se=pe[Q]??[];return[Q,Se.length>0?Se:Ie.get(Q)??[]]});fe(Q=>({...Q,[g]:Object.fromEntries(G)})),j(Q=>({...Q,[g]:_e}))},"ie"),e[28]=l,e[29]=oe):oe=e[29];let U=oe,ie,J;e[30]!==L||e[31]!==k||e[32]!==U||e[33]!==c||e[34]!==F||e[35]!==i||e[36]!==a?(ie=r(()=>{a!=="graph"||i===null||k===null&&L===null||F[c]!==void 0||be(U(c,i.map(pt),(k??[]).map(gt)))},"re"),J=[a,i,k,L,c,F,U],e[30]=L,e[31]=k,e[32]=U,e[33]=c,e[34]=F,e[35]=i,e[36]=a,e[37]=ie,e[38]=J):(ie=e[37],J=e[38]),(0,x.useEffect)(ie,J);let q=F[c]??mt,H;if(e[39]!==q||e[40]!==k||e[41]!==i){let g;e[43]!==q?(g=r(I=>({columns:q[I.name]??He,name:I.name,tier:"shard"}),"h"),e[43]=q,e[44]=g):g=e[44];let v=(i??[]).map(g),w;e[45]!==q?(w=r(I=>({columns:q[I.name]??He,name:I.name,tier:"global"}),"N"),e[45]=q,e[46]=w):w=e[46];let A=(k??[]).map(w);H=[...v,...A],e[39]=q,e[40]=k,e[41]=i,e[42]=H}else H=e[42];let f=H,ee;if(e[47]!==o||e[48]!==i){let g=o.trim().toLowerCase();ee=(i??[]).filter(v=>v.name.toLowerCase().includes(g)),e[47]=o,e[48]=i,e[49]=ee}else ee=e[49];let de=ee,ye;if(e[50]!==k||e[51]!==o){let g=o.trim().toLowerCase();ye=(k??[]).filter(v=>v.name.toLowerCase().includes(g)),e[50]=k,e[51]=o,e[52]=ye}else ye=e[52];let Te=ye,Ne;return e[53]!==K||e[54]!==f||e[55]!==p||e[56]!==T||e[57]!==Te||e[58]!==de||e[59]!==W||e[60]!==L||e[61]!==X||e[62]!==k||e[63]!==E||e[64]!==B||e[65]!==d||e[66]!==_||e[67]!==b||e[68]!==o||e[69]!==i||e[70]!==se||e[71]!==he||e[72]!==a?(Ne={columns:K,diagramTables:f,error:p,expanded:T,filteredGlobalTables:Te,filteredTables:de,globalColumns:W,globalError:L,globalExpanded:X,globalTables:k,indexes:E,refresh:B,setShardKey:d,setTableFilter:h,setView:m,shardColumnsError:_,shardKey:b,tableFilter:o,tables:i,toggle:se,toggleGlobal:he,view:a},e[53]=K,e[54]=f,e[55]=p,e[56]=T,e[57]=Te,e[58]=de,e[59]=W,e[60]=L,e[61]=X,e[62]=k,e[63]=E,e[64]=B,e[65]=d,e[66]=_,e[67]=b,e[68]=o,e[69]=i,e[70]=se,e[71]=he,e[72]=a,e[73]=Ne):Ne=e[73],Ne},"mt");function ht(s){let{columns:e,refs:u,table:n}=s;return[n,e.map(l=>{let a=u[l];return a===void 0?{name:l,optional:!1,type:""}:{name:l,optional:!1,ref:a,type:"id"}})]}r(ht,"ut");function pt(s){return s.name}r(pt,"ft");function gt(s){return s.name}r(gt,"ht");var bt="/__lunora/schema-edit",ft=r(async s=>{let e=await fetch(bt,{body:JSON.stringify(s),headers:{"Content-Type":"application/json"},method:"POST"}),u=await e.json();return u.needsMigration===!0?{kind:"needs-migration",message:u.message??"This edit needs a migration."}:e.ok&&u.tables!==void 0?{diagnostics:u.diagnostics??[],kind:"ok",tables:u.tables}:{kind:"error",message:u.error??`schema edit failed (${String(e.status)})`}},"gt"),xt=r(s=>{let e=(0,we.c)(32),{hasTables:u,mode:n,onAddColumn:l,onAddIndex:a,onAddTable:m,onDestructive:c}=s,d=ze(),b=n==="addTable"?"default":"outline",o;e[0]!==d?(o=d("Add table"),e[0]=d,e[1]=o):o=e[1];let h;e[2]!==m||e[3]!==b||e[4]!==o?(h=(0,t.jsx)(ge,{"data-testid":"sc-editor-add-table",onClick:m,size:"xs",type:"button",variant:b,children:o}),e[2]=m,e[3]=b,e[4]=o,e[5]=h):h=e[5];let i=!u,y=n==="addColumn"?"default":"outline",p;e[6]!==d?(p=d("Add column"),e[6]=d,e[7]=p):p=e[7];let $;e[8]!==l||e[9]!==i||e[10]!==y||e[11]!==p?($=(0,t.jsx)(ge,{"data-testid":"sc-editor-add-column",disabled:i,onClick:l,size:"xs",type:"button",variant:y,children:p}),e[8]=l,e[9]=i,e[10]=y,e[11]=p,e[12]=$):$=e[12];let S=!u,K=n==="addIndex"?"default":"outline",N;e[13]!==d?(N=d("Add index"),e[13]=d,e[14]=N):N=e[14];let O;e[15]!==a||e[16]!==N||e[17]!==S||e[18]!==K?(O=(0,t.jsx)(ge,{"data-testid":"sc-editor-add-index",disabled:S,onClick:a,size:"xs",type:"button",variant:K,children:N}),e[15]=a,e[16]=N,e[17]=S,e[18]=K,e[19]=O):O=e[19];let E=!u,P=n==="destructive"?"default":"ghost",T;e[20]!==d?(T=d("Rename / drop / change type\u2026"),e[20]=d,e[21]=T):T=e[21];let C;e[22]!==c||e[23]!==E||e[24]!==P||e[25]!==T?(C=(0,t.jsx)(ge,{"data-testid":"sc-editor-destructive",disabled:E,onClick:c,size:"xs",type:"button",variant:P,children:T}),e[22]=c,e[23]=E,e[24]=P,e[25]=T,e[26]=C):C=e[26];let z;return e[27]!==O||e[28]!==C||e[29]!==h||e[30]!==$?(z=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[h,$,O,C]}),e[27]=O,e[28]=C,e[29]=h,e[30]=$,e[31]=z):z=e[31],z},"bt"),vt=r(s=>{let e=(0,we.c)(28),{onOpenMigrations:u,result:n}=s,l=ze();if(n===null){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(t.Fragment,{}),e[0]=o):o=e[0],o}if(n.kind==="error"){let o;return e[1]!==n.message?(o=(0,t.jsx)("p",{className:"mt-3 text-sm text-destructive","data-testid":"sc-editor-error",role:"alert",children:n.message}),e[1]=n.message,e[2]=o):o=e[2],o}if(n.kind==="needs-migration"){let o;e[3]!==n.message||e[4]!==l?(o=n.message===""?l("This edit changes stored data and must go through a migration. Review the migration before applying."):n.message,e[3]=n.message,e[4]=l,e[5]=o):o=e[5];let h;e[6]!==o?(h=(0,t.jsx)("p",{className:"text-sm text-warning",role:"alert",children:o}),e[6]=o,e[7]=h):h=e[7];let i;e[8]!==l?(i=l("Open Migrations"),e[8]=l,e[9]=i):i=e[9];let y;e[10]!==u||e[11]!==i?(y=(0,t.jsx)(ge,{className:"self-start","data-testid":"sc-editor-open-migrations",onClick:u,size:"xs",type:"button",variant:"outline",children:i}),e[10]=u,e[11]=i,e[12]=y):y=e[12];let p;return e[13]!==h||e[14]!==y?(p=(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-2","data-testid":"sc-editor-needs-migration",children:[h,y]}),e[13]=h,e[14]=y,e[15]=p):p=e[15],p}if(n.diagnostics.length===0){let o;return e[16]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(t.Fragment,{}),e[16]=o):o=e[16],o}let a;e[17]!==l?(a=l("Codegen reported diagnostics:"),e[17]=l,e[18]=a):a=e[18];let m;e[19]!==a?(m=(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:a}),e[19]=a,e[20]=m):m=e[20];let c;e[21]!==n.diagnostics?(c=n.diagnostics.map(yt),e[21]=n.diagnostics,e[22]=c):c=e[22];let d;e[23]!==c?(d=(0,t.jsx)("ul",{className:"flex flex-col gap-0.5",children:c}),e[23]=c,e[24]=d):d=e[24];let b;return e[25]!==m||e[26]!==d?(b=(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"sc-editor-diagnostics",children:[m,d]}),e[25]=m,e[26]=d,e[27]=b):b=e[27],b},"xt");function yt(s){return(0,t.jsx)("li",{className:"font-mono text-[11px] text-destructive",children:s},s)}r(yt,"vt");var Nt=[{label:"string",validator:"v.string()"},{label:"number",validator:"v.number()"},{label:"boolean",validator:"v.boolean()"},{label:"bigint",validator:"v.bigint()"},{label:"bytes",validator:"v.bytes()"},{label:"any",validator:"v.any()"}],Ct="v.string()",Tt=r(s=>s.split(",").map(e=>e.trim()).filter(e=>e!==""),"Nt"),wt=r(s=>{let e=(0,we.c)(83),{onApplied:u,tableNames:n}=s,l=ze(),a=Je(),[m,c]=(0,x.useState)(null),[d,b]=(0,x.useState)(!1),[o,h]=(0,x.useState)(null),[i,y]=(0,x.useState)(""),[p,$]=(0,x.useState)(""),[S,K]=(0,x.useState)(Ct),[N,O]=(0,x.useState)(n[0]??""),[E,P]=(0,x.useState)(""),[T,C]=(0,x.useState)(""),[z,F]=(0,x.useState)(!1),fe;e[0]===Symbol.for("react.memo_cache_sentinel")?(fe=r(()=>{c(null),y(""),$(""),P(""),C(""),F(!1)},"pe"),e[0]=fe):fe=e[0];let te=fe,_;e[1]!==u?(_=r(async G=>{b(!0),h(null);try{let Q=await ft(G);h(Q),Q.kind==="ok"&&(u(Q.tables),te())}catch(Q){let Se=Q;h({kind:"error",message:Se instanceof Error?Se.message:String(Se)})}b(!1)},"E"),e[1]=u,e[2]=_):_=e[2];let j=_,k;e[3]!==j||e[4]!==i?(k=r(()=>{be(j({kind:"addTable",table:i.trim()}))},"w"),e[3]=j,e[4]=i,e[5]=k):k=e[5];let xe=k,L;e[6]!==p||e[7]!==j||e[8]!==N||e[9]!==S?(L=r(()=>{be(j({column:p.trim(),kind:"addOptionalColumn",table:N,validator:S}))},"B"),e[6]=p,e[7]=j,e[8]=N,e[9]=S,e[10]=L):L=e[10];let ce=L,le;e[11]!==T||e[12]!==E||e[13]!==j||e[14]!==N||e[15]!==z?(le=r(()=>{be(j({fields:Tt(T),kind:"addIndex",name:E.trim(),table:N,unique:z}))},"le"),e[11]=T,e[12]=E,e[13]=j,e[14]=N,e[15]=z,e[16]=le):le=e[16];let W=le,Ce;e[17]===Symbol.for("react.memo_cache_sentinel")?(Ce=r(()=>{h(null),c("addTable")},"Ne"),e[17]=Ce):Ce=e[17];let X=Ce,me;e[18]===Symbol.for("react.memo_cache_sentinel")?(me=r(()=>{h(null),c("addColumn")},"me"),e[18]=me):me=e[18];let ve=me,M;e[19]===Symbol.for("react.memo_cache_sentinel")?(M=r(()=>{h(null),c("addIndex")},"D"),e[19]=M):M=e[19];let B=M,ae;e[20]!==l?(ae=r(()=>{c("destructive"),h({kind:"needs-migration",message:l("This edit changes stored data and must go through a migration. Review the migration before applying.")})},"se"),e[20]=l,e[21]=ae):ae=e[21];let ue=ae,D;e[22]===Symbol.for("react.memo_cache_sentinel")?(D=r(G=>{y(G.target.value)},"R"),e[22]=D):D=e[22];let ne=D,R;e[23]===Symbol.for("react.memo_cache_sentinel")?(R=r(G=>{$(G.target.value)},"K"),e[23]=R):R=e[23];let se=R,re;e[24]===Symbol.for("react.memo_cache_sentinel")?(re=r(G=>{K(G.target.value)},"oe"),e[24]=re):re=e[24];let he=re,Y;e[25]===Symbol.for("react.memo_cache_sentinel")?(Y=r(G=>{O(G.target.value)},"X"),e[25]=Y):Y=e[25];let Z=Y,V;e[26]===Symbol.for("react.memo_cache_sentinel")?(V=r(G=>{P(G.target.value)},"U"),e[26]=V):V=e[26];let oe=V,U;e[27]===Symbol.for("react.memo_cache_sentinel")?(U=r(G=>{C(G.target.value)},"V"),e[27]=U):U=e[27];let ie=U,J;e[28]===Symbol.for("react.memo_cache_sentinel")?(J=r(G=>{F(G.target.checked)},"Y"),e[28]=J):J=e[28];let q=J,H;e[29]!==a?(H=r(()=>{be(a({to:"/migrations"}))},"Z"),e[29]=a,e[30]=H):H=e[30];let f=H,ee;e[31]!==l?(ee=l("Edit schema"),e[31]=l,e[32]=ee):ee=e[32];let de;e[33]!==ee?(de=(0,t.jsx)(Ke,{children:ee}),e[33]=ee,e[34]=de):de=e[34];let ye;e[35]!==l?(ye=l("Adds a table, column, or index to lunora/schema.ts and reruns codegen."),e[35]=l,e[36]=ye):ye=e[36];let Te;e[37]!==ye?(Te=(0,t.jsx)(Pe,{children:ye}),e[37]=ye,e[38]=Te):Te=e[38];let Ne;e[39]!==de||e[40]!==Te?(Ne=(0,t.jsxs)(Ge,{children:[de,Te]}),e[39]=de,e[40]=Te,e[41]=Ne):Ne=e[41];let g=n.length>0,v;e[42]!==m||e[43]!==ue||e[44]!==g?(v=(0,t.jsx)(xt,{hasTables:g,mode:m,onAddColumn:ve,onAddIndex:B,onAddTable:X,onDestructive:ue}),e[42]=m,e[43]=ue,e[44]=g,e[45]=v):v=e[45];let w;e[46]!==d||e[47]!==m||e[48]!==xe||e[49]!==l||e[50]!==i?(w=m==="addTable"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-table-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-table-name",children:l("Table name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-table-name",id:"sc-editor-table-name",onChange:ne,value:i})]}),(0,t.jsx)(ge,{"data-testid":"sc-editor-table-apply",disabled:d||i.trim()==="",onClick:xe,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(ge,{onClick:te,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[46]=d,e[47]=m,e[48]=xe,e[49]=l,e[50]=i,e[51]=w):w=e[51];let A;e[52]!==d||e[53]!==p||e[54]!==m||e[55]!==ce||e[56]!==l||e[57]!==n||e[58]!==N||e[59]!==S?(A=m==="addColumn"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-column-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-column-table",children:l("Table name")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-table",id:"sc-editor-column-table",onChange:Z,value:N,children:n.map(St)})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-column-name",children:l("Column name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-column-name",id:"sc-editor-column-name",onChange:se,value:p})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-column-type",children:l("Column type")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-type",id:"sc-editor-column-type",onChange:he,value:S,children:Nt.map(kt)})]}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:l("Optional")}),(0,t.jsx)(ge,{"data-testid":"sc-editor-column-apply",disabled:d||p.trim()===""||N==="",onClick:ce,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(ge,{onClick:te,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[52]=d,e[53]=p,e[54]=m,e[55]=ce,e[56]=l,e[57]=n,e[58]=N,e[59]=S,e[60]=A):A=e[60];let I;e[61]!==d||e[62]!==T||e[63]!==E||e[64]!==m||e[65]!==W||e[66]!==l||e[67]!==n||e[68]!==N||e[69]!==z?(I=m==="addIndex"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-index-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-index-table",children:l("Table name")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-index-table",id:"sc-editor-index-table",onChange:Z,value:N,children:n.map(_t)})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-index-name",children:l("Index name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-index-name",id:"sc-editor-index-name",onChange:oe,value:E})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-index-fields",children:l("Index fields (comma-separated)")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-index-fields",id:"sc-editor-index-fields",onChange:ie,value:T})]}),(0,t.jsxs)(ke,{className:"flex items-center gap-1 text-xs",htmlFor:"sc-editor-index-unique",children:[(0,t.jsx)("input",{checked:z,"data-testid":"sc-editor-index-unique",id:"sc-editor-index-unique",onChange:q,type:"checkbox"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:l("Unique")})]}),(0,t.jsx)(ge,{"data-testid":"sc-editor-index-apply",disabled:d||E.trim()===""||T.trim()==="",onClick:W,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(ge,{onClick:te,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[61]=d,e[62]=T,e[63]=E,e[64]=m,e[65]=W,e[66]=l,e[67]=n,e[68]=N,e[69]=z,e[70]=I):I=e[70];let pe;e[71]!==f||e[72]!==o?(pe=(0,t.jsx)(vt,{onOpenMigrations:f,result:o}),e[71]=f,e[72]=o,e[73]=pe):pe=e[73];let _e;e[74]!==v||e[75]!==w||e[76]!==A||e[77]!==I||e[78]!==pe?(_e=(0,t.jsxs)(Le,{children:[v,w,A,I,pe]}),e[74]=v,e[75]=w,e[76]=A,e[77]=I,e[78]=pe,e[79]=_e):_e=e[79];let Ie;return e[80]!==Ne||e[81]!==_e?(Ie=(0,t.jsxs)(qe,{"data-testid":"sc-editor",size:"sm",children:[Ne,_e]}),e[80]=Ne,e[81]=_e,e[82]=Ie):Ie=e[82],Ie},"Tt");function St(s){return(0,t.jsx)("option",{value:s,children:s},s)}r(St,"St");function kt(s){return(0,t.jsx)("option",{value:s.validator,children:s.label},s.validator)}r(kt,"wt");function _t(s){return(0,t.jsx)("option",{value:s,children:s},s)}r(_t,"_t");var et=[],It=r(s=>{let e=(0,we.c)(5),{open:u}=s,n=u&&"rotate-90",l;e[0]!==n?(l=De("size-3.5 shrink-0 text-muted-foreground transition-transform duration-150",n),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[2]=a):a=e[2];let m;return e[3]!==l?(m=(0,t.jsx)("svg",{"aria-hidden":"true",className:l,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:a}),e[3]=l,e[4]=m):m=e[4],m},"Et"),tt=r(s=>{let e=(0,we.c)(20),{children:u,expanded:n,name:l,onToggle:a,rowCount:m,rowTestId:c,toggleTestId:d}=s,b;e[0]!==n?(b=(0,t.jsx)(It,{open:n}),e[0]=n,e[1]=b):b=e[1];let o;e[2]!==l?(o=(0,t.jsx)("span",{className:"truncate font-mono text-xs text-foreground",title:l,children:l}),e[2]=l,e[3]=o):o=e[3];let h;e[4]!==m?(h=(0,t.jsxs)("span",{className:"ms-auto shrink-0 text-xs text-muted-foreground tabular-nums",children:["(",m,")"]}),e[4]=m,e[5]=h):h=e[5];let i;e[6]!==n||e[7]!==a||e[8]!==b||e[9]!==o||e[10]!==h||e[11]!==d?(i=(0,t.jsxs)("button",{"aria-expanded":n,className:"flex w-full items-center gap-2 px-3 py-2 text-start transition-colors hover:bg-muted/50 aria-expanded:bg-muted/40","data-testid":d,onClick:a,type:"button",children:[b,o," ",h]}),e[6]=n,e[7]=a,e[8]=b,e[9]=o,e[10]=h,e[11]=d,e[12]=i):i=e[12];let y;e[13]!==u||e[14]!==n?(y=n&&(0,t.jsx)("div",{className:"px-3 pb-3 ps-8",children:u}),e[13]=u,e[14]=n,e[15]=y):y=e[15];let p;return e[16]!==c||e[17]!==i||e[18]!==y?(p=(0,t.jsxs)("li",{className:"border-t border-border/60 first:border-t-0","data-testid":c,children:[i,y]}),e[16]=c,e[17]=i,e[18]=y,e[19]=p):p=e[19],p},"Je"),lt=r(s=>{let e=(0,we.c)(5),{columns:u,testId:n}=s,l;e[0]!==u?(l=u.map(zt),e[0]=u,e[1]=l):l=e[1];let a;return e[2]!==l||e[3]!==n?(a=(0,t.jsx)("ul",{className:"flex flex-wrap gap-1.5 pt-1","data-testid":n,children:l}),e[2]=l,e[3]=n,e[4]=a):a=e[4],a},"We"),At=r(s=>{let e=(0,we.c)(10),{heading:u,indexes:n,testId:l}=s,a;e[0]!==u?(a=(0,t.jsx)("p",{className:"mb-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:u}),e[0]=u,e[1]=a):a=e[1];let m;e[2]!==n?(m=n.map(Et),e[2]=n,e[3]=m):m=e[3];let c;e[4]!==m||e[5]!==l?(c=(0,t.jsx)("ul",{className:"flex flex-col gap-1","data-testid":l,children:m}),e[4]=m,e[5]=l,e[6]=c):c=e[6];let d;return e[7]!==a||e[8]!==c?(d=(0,t.jsxs)("div",{className:"pt-3",children:[a,c]}),e[7]=a,e[8]=c,e[9]=d):d=e[9],d},"It"),at=r(s=>De("border-b-2 px-3 py-2 font-mono text-[11px] tracking-widest uppercase outline-none transition-colors",s?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"Xe"),Xt=r(s=>{let e=(0,we.c)(85),{initialShardKey:u,initialTable:n,schemaEditable:l}=s,a=ze(),m;e[0]!==u||e[1]!==n?(m={initialShardKey:u,initialTable:n},e[0]=u,e[1]=n,e[2]=m):m=e[2];let{columns:c,diagramTables:d,error:b,expanded:o,filteredGlobalTables:h,filteredTables:i,globalColumns:y,globalError:p,globalExpanded:$,globalTables:S,indexes:K,refresh:N,setShardKey:O,setTableFilter:E,setView:P,shardColumnsError:T,shardKey:C,tableFilter:z,tables:F,toggle:fe,toggleGlobal:te,view:_}=ut(m),j;e[3]!==P?(j=r(()=>{P("list")},"M"),e[3]=P,e[4]=j):j=e[4];let k=j,xe;e[5]!==P?(xe=r(()=>{P("graph")},"ge"),e[5]=P,e[6]=xe):xe=e[6];let L=xe,ce;e[7]!==E?(ce=r(f=>{E(f.target.value)},"ce"),e[7]=E,e[8]=ce):ce=e[8];let le=ce,W;e[9]!==N||e[10]!==C?(W=r(f=>{be(N(C))},"J"),e[9]=N,e[10]=C,e[11]=W):W=e[11];let Ce=W,X;e[12]!==F?(X=F??[],e[12]=F,e[13]=X):X=e[13];let me;e[14]!==X?(me=X.map(Ft),e[14]=X,e[15]=me):me=e[15];let ve=me,M;e[16]!==O||e[17]!==C?(M=(0,t.jsx)(Xe,{onChange:O,testId:"sc-shard-input",value:C}),e[16]=O,e[17]=C,e[18]=M):M=e[18];let B;e[19]!==a?(B=a("Schema view"),e[19]=a,e[20]=B):B=e[20];let ae=_==="graph",ue=_==="graph",D;e[21]!==ue?(D=at(ue),e[21]=ue,e[22]=D):D=e[22];let ne;e[23]!==a?(ne=a("Graph"),e[23]=a,e[24]=ne):ne=e[24];let R;e[25]!==L||e[26]!==ae||e[27]!==D||e[28]!==ne?(R=(0,t.jsx)("button",{"aria-selected":ae,className:D,"data-testid":"sc-view-graph",onClick:L,role:"tab",type:"button",children:ne}),e[25]=L,e[26]=ae,e[27]=D,e[28]=ne,e[29]=R):R=e[29];let se=_==="list",re=_==="list",he;e[30]!==re?(he=at(re),e[30]=re,e[31]=he):he=e[31];let Y;e[32]!==a?(Y=a("Table list"),e[32]=a,e[33]=Y):Y=e[33];let Z;e[34]!==k||e[35]!==se||e[36]!==he||e[37]!==Y?(Z=(0,t.jsx)("button",{"aria-selected":se,className:he,"data-testid":"sc-view-list",onClick:k,role:"tab",type:"button",children:Y}),e[34]=k,e[35]=se,e[36]=he,e[37]=Y,e[38]=Z):Z=e[38];let V;e[39]!==R||e[40]!==Z||e[41]!==B?(V=(0,t.jsxs)("div",{"aria-label":B,className:"flex items-center gap-1","data-testid":"sc-view-toggle",role:"tablist",children:[R,Z]}),e[39]=R,e[40]=Z,e[41]=B,e[42]=V):V=e[42];let oe;e[43]!==V||e[44]!==M?(oe=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[M,V]}),e[43]=V,e[44]=M,e[45]=oe):oe=e[45];let U;e[46]!==Ce||e[47]!==l||e[48]!==ve?(U=l===!0&&(0,t.jsx)(wt,{onApplied:Ce,tableNames:ve}),e[46]=Ce,e[47]=l,e[48]=ve,e[49]=U):U=e[49];let ie;e[50]!==le||e[51]!==a||e[52]!==z||e[53]!==_?(ie=_==="list"&&(0,t.jsx)(Ae,{"aria-label":a("Filter tables"),className:"h-8 max-w-xs","data-testid":"sc-filter",onChange:le,placeholder:a("Filter tables"),value:z}),e[50]=le,e[51]=a,e[52]=z,e[53]=_,e[54]=ie):ie=e[54];let J;e[55]!==d||e[56]!==b||e[57]!==p||e[58]!==T||e[59]!==C||e[60]!==_?(J=_==="graph"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"sc-graph-view",children:[b!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:b}),p!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:p}),(0,t.jsx)(Ze,{columnsError:T[C]===!0,tables:d,testIdPrefix:"sc-graph"})]}),e[55]=d,e[56]=b,e[57]=p,e[58]=T,e[59]=C,e[60]=_,e[61]=J):J=e[61];let q;e[62]!==c||e[63]!==b||e[64]!==o||e[65]!==h||e[66]!==i||e[67]!==y||e[68]!==p||e[69]!==$||e[70]!==S||e[71]!==K||e[72]!==C||e[73]!==a||e[74]!==F||e[75]!==fe||e[76]!==te||e[77]!==_?(q=_==="list"&&(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)(qe,{"data-testid":"sc-shard-section",size:"sm",children:[(0,t.jsxs)(Ge,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(Re,{tier:"shard"}),(0,t.jsx)(Ke,{children:a("Shard tables")}),F!==null&&(0,t.jsx)(Ee,{className:"ms-auto tabular-nums",variant:"outline",children:i.length})]}),(0,t.jsx)(Pe,{children:Me.shard.hint})]}),(0,t.jsxs)(Le,{children:[b!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:b}),F!==null&&F.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-empty",children:a("No tables in this shard.")}),F!==null&&F.length>0&&i.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-no-match",children:a("No tables match your filter.")}),i.length>0&&(0,t.jsx)("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-table-list",children:i.map(f=>{let ee=`${C}:${f.name}`,de=K[ee]??[];return(0,t.jsxs)(tt,{expanded:o===f.name,name:f.name,onToggle:r(()=>{be(fe(f.name))},"onToggle"),rowCount:f.rowCount,rowTestId:`sc-table-${f.name}`,toggleTestId:`sc-toggle-${f.name}`,children:[(0,t.jsx)(lt,{columns:c[ee]??et,testId:`sc-columns-${f.name}`}),de.length>0&&(0,t.jsx)(At,{heading:a("Indexes"),indexes:de,testId:`sc-indexes-${f.name}`})]},f.name)})})]})]}),(0,t.jsxs)(qe,{"data-testid":"sc-global-section",size:"sm",children:[(0,t.jsxs)(Ge,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(Re,{tier:"global"}),(0,t.jsx)(Ke,{children:a("Global tables (D1)")}),S!==null&&(0,t.jsx)(Ee,{className:"ms-auto tabular-nums",variant:"outline",children:h.length})]}),(0,t.jsx)(Pe,{children:Me.global.hint})]}),(0,t.jsxs)(Le,{children:[p!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:p}),S!==null&&S.length===0&&(0,t.jsx)(Qe,{description:Me.global.hint,testId:"sc-global-empty",title:a("No global tables.")}),S!==null&&S.length>0&&h.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-global-no-match",children:a("No tables match your filter.")}),h.length>0&&(0,t.jsx)("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-global-table-list",children:h.map(f=>(0,t.jsx)(tt,{expanded:$===f.name,name:f.name,onToggle:r(()=>{be(te(f.name))},"onToggle"),rowCount:f.rowCount,rowTestId:`sc-global-table-${f.name}`,toggleTestId:`sc-global-toggle-${f.name}`,children:(0,t.jsx)(lt,{columns:y[f.name]??et,testId:`sc-global-columns-${f.name}`})},f.name))})]})]})]}),e[62]=c,e[63]=b,e[64]=o,e[65]=h,e[66]=i,e[67]=y,e[68]=p,e[69]=$,e[70]=S,e[71]=K,e[72]=C,e[73]=a,e[74]=F,e[75]=fe,e[76]=te,e[77]=_,e[78]=q):q=e[78];let H;return e[79]!==oe||e[80]!==U||e[81]!==ie||e[82]!==J||e[83]!==q?(H=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schema",children:[oe,U,ie,J,q]}),e[79]=oe,e[80]=U,e[81]=ie,e[82]=J,e[83]=q,e[84]=H):H=e[84],H},"Qt");function zt(s){return(0,t.jsx)("li",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:s},s)}r(zt,"kt");function Et(s){return(0,t.jsxs)("li",{className:"flex flex-wrap items-center gap-1.5 text-xs",children:[(0,t.jsx)("span",{className:"font-mono",children:s.name}),(0,t.jsx)(Ee,{variant:"outline",children:s.type}),s.unique===!0&&(0,t.jsx)(Ee,{variant:"secondary",children:"unique"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:s.fields.join(", ")})]},`${s.type}:${s.name}`)}r(Et,"At");function Ft(s){return s.name}r(Ft,"$t");export{Xt as SchemaViewer};
@@ -0,0 +1 @@
1
+ import{a as be,b as fe,c as xe,d as Ne,e as Ce}from"./chunk-5QR2SQIS.js";import"./chunk-NRP22GKC.js";import"./chunk-OPM7ESDV.js";import{a as ce}from"./chunk-FPI7AMQJ.js";import{a as ue}from"./chunk-7RKB5KS7.js";import{a as q}from"./chunk-37WYCOQ2.js";import{g as me,h as ve,i as pe,j as ye}from"./chunk-ARWJGYXL.js";import"./chunk-XGCIDUJF.js";import"./chunk-AJV3ZKEY.js";import"./chunk-CCDX5RYT.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import"./chunk-SA2OGF3F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import"./chunk-WJRYEML4.js";import"./chunk-FUYEZFBP.js";import"./chunk-RGMVGZV4.js";import"./chunk-OQ6I6OXT.js";import{i as ae}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{a as $}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as he}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import"./chunk-55UGUCQ6.js";import"./chunk-4ZEL6BYL.js";import"./chunk-VRWHCG2V.js";import{l as G}from"./chunk-ICDMV4MP.js";import"./chunk-QAQDMS6R.js";import"./chunk-FQPBYMII.js";import{a as ke}from"./chunk-RWVIV3U7.js";import{a as se,b as ie,c as oe,d as Q,e as X,f as Y}from"./chunk-HCTJKP5J.js";import{a as re,e as ne}from"./chunk-2IKDEUCX.js";import{d as R,h as Z,l as ge,p as z,s as de}from"./chunk-HJHSQPHW.js";import{a as i,d as le,e as Oe,f as _e,g as De}from"./chunk-I26MS5PJ.js";var P=le(Oe(),1);var ee=le(_e(),1);var a=le(De(),1);var Be=i(l=>{let e=l.trim();if(e==="")return;let n=Number(e);return Number.isFinite(n)&&n>0?Math.floor(n):void 0},"Be"),Le=i(l=>l===void 0?"\u2014":new Date(l*1e3).toISOString(),"Oe"),Je=i(l=>new TextEncoder().encode(l).length,"Ae"),Fe=i(l=>{if(l.trim()!=="")try{return JSON.stringify(JSON.parse(l),void 0,2)}catch{return}},"ge"),Ke=i(l=>{if(l.trim()==="")return!0;try{return JSON.parse(l),!0}catch{return!1}},"xe"),Ee=[{key:"seconds",seconds:1},{key:"minutes",seconds:60},{key:"hours",seconds:3600},{key:"days",seconds:86400}],we=i((l,e)=>{let n=l.trim();if(n==="")return"";let u=Number(n),s=Ee.find(p=>p.key===e)?.seconds??1;return Number.isFinite(u)&&u>0?String(Math.round(u*s)):n},"ue"),Ve=i(l=>{let e=l.trim();if(e==="")return!0;let n=Number(e);return Number.isInteger(n)&&n>=60},"Ce"),Te=i((l,e,n,u)=>{let s=Be(l.ttl);return{expiration:s===void 0?u:void 0,expirationTtl:s,key:e,metadata:l.metadata.trim()===""?void 0:JSON.parse(l.metadata),namespace:n,value:l.value}},"Se"),Me=i(l=>{let e=(0,ee.c)(60),{helper:n,id:u,invalid:s,onChange:p,testId:o}=l,t=R(),[r,y]=(0,P.useState)(""),[c,x]=(0,P.useState)("seconds"),b;e[0]!==p||e[1]!==c?(b=i(f=>{y(f.target.value),p(we(f.target.value,c))},"k"),e[0]=p,e[1]=c,e[2]=b):b=e[2];let _=b,V;e[3]!==r||e[4]!==p?(V=i(f=>{f!==null&&(x(f),p(we(r,f)))},"K"),e[3]=r,e[4]=p,e[5]=V):V=e[5];let T=V,h;e[6]!==t?(h=t("days"),e[6]=t,e[7]=h):h=e[7];let v;e[8]!==t?(v=t("hours"),e[8]=t,e[9]=v):v=e[9];let k;e[10]!==t?(k=t("minutes"),e[10]=t,e[11]=k):k=e[11];let N;e[12]!==t?(N=t("seconds"),e[12]=t,e[13]=N):N=e[13];let C;e[14]!==h||e[15]!==v||e[16]!==k||e[17]!==N?(C={days:h,hours:v,minutes:k,seconds:N},e[14]=h,e[15]=v,e[16]=k,e[17]=N,e[18]=C):C=e[18];let w=C,g;e[19]!==t?(g=t("Expires after"),e[19]=t,e[20]=g):g=e[20];let S;e[21]!==u||e[22]!==g?(S=(0,a.jsx)(q,{className:"text-xs",htmlFor:u,children:g}),e[21]=u,e[22]=g,e[23]=S):S=e[23];let E;e[24]!==t?(E=t("No expiration"),e[24]=t,e[25]=E):E=e[25];let B;e[26]!==r||e[27]!==u||e[28]!==s||e[29]!==_||e[30]!==E||e[31]!==o?(B=(0,a.jsx)(ae,{"aria-invalid":s,className:"flex-1","data-testid":o,id:u,inputMode:"numeric",onChange:_,placeholder:E,value:r}),e[26]=r,e[27]=u,e[28]=s,e[29]=_,e[30]=E,e[31]=o,e[32]=B):B=e[32];let M;e[33]!==t?(M=t("TTL unit"),e[33]=t,e[34]=M):M=e[34];let J=`${o}-unit`,L;e[35]===Symbol.for("react.memo_cache_sentinel")?(L=(0,a.jsx)(fe,{}),e[35]=L):L=e[35];let I;e[36]!==M||e[37]!==J?(I=(0,a.jsx)(xe,{"aria-label":M,className:"w-[7.5rem]","data-testid":J,children:L}),e[36]=M,e[37]=J,e[38]=I):I=e[38];let d;e[39]!==w?(d=Ee.map(f=>(0,a.jsx)(Ce,{value:f.key,children:w[f.key]},f.key)),e[39]=w,e[40]=d):d=e[40];let m;e[41]!==d?(m=(0,a.jsx)(Ne,{children:d}),e[41]=d,e[42]=m):m=e[42];let F;e[43]!==T||e[44]!==I||e[45]!==m||e[46]!==c?(F=(0,a.jsxs)(be,{onValueChange:T,value:c,children:[I,m]}),e[43]=T,e[44]=I,e[45]=m,e[46]=c,e[47]=F):F=e[47];let O;e[48]!==B||e[49]!==F?(O=(0,a.jsxs)("div",{className:"flex gap-2",children:[B,F]}),e[48]=B,e[49]=F,e[50]=O):O=e[50];let K;e[51]!==n||e[52]!==s||e[53]!==t||e[54]!==o?(K=s?(0,a.jsx)("p",{className:"text-xs text-destructive","data-testid":`${o}-invalid`,children:t("TTL must be at least 60 seconds.")}):n!==void 0&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:n}),e[51]=n,e[52]=s,e[53]=t,e[54]=o,e[55]=K):K=e[55];let D;return e[56]!==O||e[57]!==K||e[58]!==S?(D=(0,a.jsxs)("div",{className:"mb-3 grid gap-1",children:[S,O,K]}),e[56]=O,e[57]=K,e[58]=S,e[59]=D):D=e[59],D},"we"),Ie=i(l=>{let e=(0,ee.c)(36),{id:n,invalidTestId:u,onChange:s,testId:p,valid:o,value:t}=l,r=R(),y;e[0]!==t?(y=Fe(t),e[0]=t,e[1]=y):y=e[1];let c=y,x;e[2]!==r?(x=r("Metadata (JSON)"),e[2]=r,e[3]=x):x=e[3];let b;e[4]!==n||e[5]!==x?(b=(0,a.jsx)(q,{className:"text-xs",htmlFor:n,children:x}),e[4]=n,e[5]=x,e[6]=b):b=e[6];let _=`${p}-format`,V=c===void 0,T;e[7]!==c||e[8]!==s?(T=i(()=>{c!==void 0&&s(c)},"V"),e[7]=c,e[8]=s,e[9]=T):T=e[9];let h;e[10]!==r?(h=r("Format JSON"),e[10]=r,e[11]=h):h=e[11];let v;e[12]!==_||e[13]!==V||e[14]!==T||e[15]!==h?(v=(0,a.jsx)($,{"data-testid":_,disabled:V,onClick:T,size:"sm",variant:"outline",children:h}),e[12]=_,e[13]=V,e[14]=T,e[15]=h,e[16]=v):v=e[16];let k;e[17]!==b||e[18]!==v?(k=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[b,v]}),e[17]=b,e[18]=v,e[19]=k):k=e[19];let N=!o,C;e[20]!==s?(C=i(E=>{s(E.target.value)},"N"),e[20]=s,e[21]=C):C=e[21];let w;e[22]!==n||e[23]!==N||e[24]!==C||e[25]!==p||e[26]!==t?(w=(0,a.jsx)(ce,{"aria-invalid":N,className:"min-h-[4rem] font-mono text-xs","data-testid":p,id:n,onChange:C,value:t}),e[22]=n,e[23]=N,e[24]=C,e[25]=p,e[26]=t,e[27]=w):w=e[27];let g;e[28]!==u||e[29]!==r||e[30]!==o?(g=!o&&(0,a.jsx)("p",{className:"text-xs text-destructive","data-testid":u,children:r("Metadata must be valid JSON.")}),e[28]=u,e[29]=r,e[30]=o,e[31]=g):g=e[31];let S;return e[32]!==w||e[33]!==g||e[34]!==k?(S=(0,a.jsxs)("div",{className:"mb-3 grid gap-1",children:[k,w,g]}),e[32]=w,e[33]=g,e[34]=k,e[35]=S):S=e[35],S},"Te"),Pe={busy:!1,error:null,metadata:"",name:"",ttl:"",value:""},$e=i((l,e)=>{switch(e.type){case"setField":return{...l,[e.field]:e.value};case"submitFailed":return{...l,busy:!1,error:e.error};case"submitStart":return{...l,busy:!0,error:null};default:return l}},"Je"),je=i(l=>{let e=(0,ee.c)(73),{namespace:n,onCancel:u,onCreated:s}=l,p=G(),o=R(),[t,r]=(0,P.useReducer)($e,Pe),y;e[0]!==t.metadata?(y=Ke(t.metadata),e[0]=t.metadata,e[1]=y):y=e[1];let c=y,x;e[2]!==t.ttl?(x=Ve(t.ttl),e[2]=t.ttl,e[3]=x):x=e[3];let b=x,_;e[4]!==c||e[5]!==t.busy||e[6]!==t.name||e[7]!==b?(_=t.name.trim()!==""&&c&&b&&!t.busy,e[4]=c,e[5]=t.busy,e[6]=t.name,e[7]=b,e[8]=_):_=e[8];let V=_,T;e[9]!==V||e[10]!==p||e[11]!==n||e[12]!==s||e[13]!==t.metadata||e[14]!==t.name||e[15]!==t.ttl||e[16]!==t.value?(T=i(()=>{V&&(r({type:"submitStart"}),z((async()=>{try{await p.putKvValue(Te({metadata:t.metadata,ttl:t.ttl,value:t.value},t.name,n)),s()}catch(A){r({error:Z(A),type:"submitFailed"})}})()))},"V"),e[9]=V,e[10]=p,e[11]=n,e[12]=s,e[13]=t.metadata,e[14]=t.name,e[15]=t.ttl,e[16]=t.value,e[17]=T):T=e[17];let h=T,v;e[18]!==o?(v=o("Key name"),e[18]=o,e[19]=v):v=e[19];let k;e[20]!==v?(k=(0,a.jsx)(q,{className:"text-xs",htmlFor:"kv-create-name",children:v}),e[20]=v,e[21]=k):k=e[21];let N;e[22]===Symbol.for("react.memo_cache_sentinel")?(N=i(A=>{r({field:"name",type:"setField",value:A.target.value})},"x"),e[22]=N):N=e[22];let C;e[23]!==o?(C=o("Key name"),e[23]=o,e[24]=C):C=e[24];let w;e[25]!==t.name||e[26]!==C?(w=(0,a.jsx)(ae,{autoFocus:!0,"data-testid":"kv-create-name",id:"kv-create-name",onChange:N,placeholder:C,value:t.name}),e[25]=t.name,e[26]=C,e[27]=w):w=e[27];let g;e[28]!==k||e[29]!==w?(g=(0,a.jsxs)("div",{className:"grid gap-1",children:[k,w]}),e[28]=k,e[29]=w,e[30]=g):g=e[30];let S;e[31]!==o?(S=o("Value"),e[31]=o,e[32]=S):S=e[32];let E;e[33]!==S?(E=(0,a.jsx)(q,{className:"text-xs",htmlFor:"kv-create-value",children:S}),e[33]=S,e[34]=E):E=e[34];let B;e[35]===Symbol.for("react.memo_cache_sentinel")?(B=i(A=>{r({field:"value",type:"setField",value:A.target.value})},"O"),e[35]=B):B=e[35];let M;e[36]!==t.value?(M=(0,a.jsx)(ce,{className:"min-h-[6rem] font-mono text-xs","data-testid":"kv-create-value",id:"kv-create-value",onChange:B,value:t.value}),e[36]=t.value,e[37]=M):M=e[37];let J;e[38]!==E||e[39]!==M?(J=(0,a.jsxs)("div",{className:"grid gap-1",children:[E,M]}),e[38]=E,e[39]=M,e[40]=J):J=e[40];let L=!b,I;e[41]===Symbol.for("react.memo_cache_sentinel")?(I=i(A=>{r({field:"ttl",type:"setField",value:A})},"_"),e[41]=I):I=e[41];let d;e[42]!==L?(d=(0,a.jsx)(Me,{id:"kv-create-ttl",invalid:L,onChange:I,testId:"kv-create-ttl"}),e[42]=L,e[43]=d):d=e[43];let m;e[44]===Symbol.for("react.memo_cache_sentinel")?(m=i(A=>{r({field:"metadata",type:"setField",value:A})},"u"),e[44]=m):m=e[44];let F;e[45]!==c||e[46]!==t.metadata?(F=(0,a.jsx)(Ie,{id:"kv-create-metadata",invalidTestId:"kv-create-metadata-invalid",onChange:m,testId:"kv-create-metadata",valid:c,value:t.metadata}),e[45]=c,e[46]=t.metadata,e[47]=F):F=e[47];let O=!V,K;e[48]!==t.busy||e[49]!==o?(K=t.busy?o("Creating\u2026"):o("Create key"),e[48]=t.busy,e[49]=o,e[50]=K):K=e[50];let D;e[51]!==h||e[52]!==O||e[53]!==K?(D=(0,a.jsx)($,{"data-testid":"kv-create-submit",disabled:O,onClick:h,children:K}),e[51]=h,e[52]=O,e[53]=K,e[54]=D):D=e[54];let f=t.busy,j;e[55]!==o?(j=o("Cancel"),e[55]=o,e[56]=j):j=e[56];let H;e[57]!==u||e[58]!==t.busy||e[59]!==j?(H=(0,a.jsx)($,{"data-testid":"kv-create-cancel",disabled:f,onClick:u,variant:"outline",children:j}),e[57]=u,e[58]=t.busy,e[59]=j,e[60]=H):H=e[60];let U;e[61]!==D||e[62]!==H?(U=(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[D,H]}),e[61]=D,e[62]=H,e[63]=U):U=e[63];let W;e[64]!==t.error?(W=t.error!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"kv-create-error",role:"alert",children:t.error}),e[64]=t.error,e[65]=W):W=e[65];let te;return e[66]!==g||e[67]!==J||e[68]!==d||e[69]!==F||e[70]!==U||e[71]!==W?(te=(0,a.jsxs)("div",{className:"grid gap-3 px-4 pb-4","data-testid":"kv-create-form",children:[g,J,d,F,U,W]}),e[66]=g,e[67]=J,e[68]=d,e[69]=F,e[70]=U,e[71]=W,e[72]=te):te=e[72],te},"Pe"),Ae={busy:"",editedMetadata:"",editedTtl:"",editedValue:"",loadError:null,loading:!0,value:null,writeError:null},ze=i((l,e)=>{switch(e.type){case"deleteStart":return{...l,busy:"deleting",writeError:null};case"editMetadata":return{...l,editedMetadata:e.value};case"editTtl":return{...l,editedTtl:e.value};case"editValue":return{...l,editedValue:e.value};case"loaded":return{...l,editedMetadata:e.metadata===null||e.metadata===void 0?"":JSON.stringify(e.metadata,null,2),editedValue:e.value??"",loading:!1,value:e.value};case"loadFailed":return{...l,loadError:e.error,loading:!1};case"saveOk":return{...l,busy:"",value:l.editedValue};case"saveStart":return{...l,busy:"saving",writeError:null};case"writeFailed":return{...l,busy:"",writeError:e.error};default:return l}},"je"),He=i(l=>{let e=(0,ee.c)(67),{expiration:n,keyName:u,namespace:s,onDeleted:p}=l,o=G(),t=R(),[r,y]=(0,P.useReducer)(ze,Ae),c,x;e[0]!==o||e[1]!==u||e[2]!==s?(c=i(()=>{let f={cancelled:!1};return z((async()=>{try{let j=await o.getKvValue({key:u,namespace:s});f.cancelled||y({metadata:j.metadata,type:"loaded",value:j.value})}catch(j){let H=j;f.cancelled||y({error:Z(H),type:"loadFailed"})}})()),()=>{f.cancelled=!0}},"o"),x=[o,s,u],e[0]=o,e[1]=u,e[2]=s,e[3]=c,e[4]=x):(c=e[3],x=e[4]),(0,P.useEffect)(c,x);let b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=i(f=>{y({type:"editValue",value:f.target.value})},"k"),e[5]=b):b=e[5];let _=b,V;e[6]===Symbol.for("react.memo_cache_sentinel")?(V=i(f=>{y({type:"editMetadata",value:f})},"K"),e[6]=V):V=e[6];let T=V,h;e[7]!==r.editedValue?(h=Fe(r.editedValue),e[7]=r.editedValue,e[8]=h):h=e[8];let v=h,k;e[9]!==r.editedMetadata?(k=Ke(r.editedMetadata),e[9]=r.editedMetadata,e[10]=k):k=e[10];let N=k,C;e[11]!==r.editedTtl?(C=Ve(r.editedTtl),e[11]=r.editedTtl,e[12]=C):C=e[12];let w=C,g;e[13]!==v?(g=i(()=>{v!==void 0&&y({type:"editValue",value:v})},"y"),e[13]=v,e[14]=g):g=e[14];let S=g,E;e[15]!==o||e[16]!==n||e[17]!==u||e[18]!==N||e[19]!==s||e[20]!==r.editedMetadata||e[21]!==r.editedTtl||e[22]!==r.editedValue||e[23]!==t?(E=i(()=>{if(!N){y({error:t("Metadata must be valid JSON."),type:"writeFailed"});return}y({type:"saveStart"}),z((async()=>{try{await o.putKvValue(Te({metadata:r.editedMetadata,ttl:r.editedTtl,value:r.editedValue},u,s,n)),y({type:"saveOk"})}catch(f){y({error:Z(f),type:"writeFailed"})}})())},"F"),e[15]=o,e[16]=n,e[17]=u,e[18]=N,e[19]=s,e[20]=r.editedMetadata,e[21]=r.editedTtl,e[22]=r.editedValue,e[23]=t,e[24]=E):E=e[24];let B=E,M;e[25]!==o||e[26]!==u||e[27]!==s||e[28]!==p?(M=i(()=>{y({type:"deleteStart"}),z((async()=>{try{await o.deleteKvKey({key:u,namespace:s}),p(u)}catch(f){y({error:Z(f),type:"writeFailed"})}})())},"I"),e[25]=o,e[26]=u,e[27]=s,e[28]=p,e[29]=M):M=e[29];let J=M,L;e[30]!==u?(L=i(()=>{de(u)},"A"),e[30]=u,e[31]=L):L=e[31];let I;e[32]!==t?(I=t("Copy key"),e[32]=t,e[33]=I):I=e[33];let d;e[34]!==L||e[35]!==I?(d=(0,a.jsx)("div",{className:"mb-2 flex justify-end",children:(0,a.jsx)($,{"data-testid":"kv-copy-key-btn",onClick:L,size:"sm",variant:"outline",children:I})}),e[34]=L,e[35]=I,e[36]=d):d=e[36];let m;e[37]!==r.loadError?(m=r.loadError!==null&&(0,a.jsx)("p",{className:"mb-2 text-sm text-destructive","data-testid":"kv-value-error",role:"alert",children:r.loadError}),e[37]=r.loadError,e[38]=m):m=e[38];let F;e[39]!==r.loading||e[40]!==t?(F=r.loading&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"kv-value-loading",children:t("Loading\u2026")}),e[39]=r.loading,e[40]=t,e[41]=F):F=e[41];let O;e[42]!==v||e[43]!==N||e[44]!==J||e[45]!==S||e[46]!==B||e[47]!==r.busy||e[48]!==r.editedMetadata||e[49]!==r.editedValue||e[50]!==r.loading||e[51]!==r.value||e[52]!==r.writeError||e[53]!==t||e[54]!==w?(O=!r.loading&&r.value!==null&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[(0,a.jsx)(q,{className:"text-xs",htmlFor:"kv-value-editor",children:t("Value")}),v!==void 0&&(0,a.jsx)(he,{variant:"secondary",children:t("JSON")}),(0,a.jsx)("span",{className:"ml-auto text-xs tabular-nums text-muted-foreground","data-testid":"kv-value-size",children:ge(Je(r.editedValue))})]}),(0,a.jsx)("textarea",{"aria-label":t("KV value"),className:"mb-2 min-h-[8rem] w-full rounded border border-border bg-muted/30 p-2 font-mono text-xs","data-testid":"kv-value-editor",id:"kv-value-editor",onChange:_,value:r.editedValue}),(0,a.jsxs)("div",{className:"mb-3 flex flex-wrap gap-2",children:[(0,a.jsx)($,{"data-testid":"kv-format-btn",disabled:v===void 0,onClick:S,size:"sm",variant:"outline",children:t("Format JSON")}),(0,a.jsx)($,{"data-testid":"kv-copy-value-btn",onClick:i(()=>{de(r.editedValue)},"onClick"),size:"sm",variant:"outline",children:t("Copy value")})]}),(0,a.jsx)(Me,{helper:t("Leave blank to keep the current expiration."),id:"kv-ttl-input",invalid:!w,onChange:i(f=>{y({type:"editTtl",value:f})},"onChange"),testId:"kv-ttl-input"}),(0,a.jsx)(Ie,{id:"kv-metadata-editor",invalidTestId:"kv-metadata-invalid",onChange:T,testId:"kv-metadata-editor",valid:N,value:r.editedMetadata}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsx)($,{"data-testid":"kv-save-btn",disabled:r.busy!==""||!N||!w,onClick:B,children:r.busy==="saving"?t("Saving\u2026"):t("Save")}),(0,a.jsx)($,{"data-testid":"kv-delete-btn",disabled:r.busy!=="",onClick:J,variant:"destructive",children:r.busy==="deleting"?t("Deleting\u2026"):t("Delete")})]}),r.writeError!==null&&(0,a.jsx)("p",{className:"mt-2 text-sm text-destructive","data-testid":"kv-save-error",role:"alert",children:r.writeError})]}),e[42]=v,e[43]=N,e[44]=J,e[45]=S,e[46]=B,e[47]=r.busy,e[48]=r.editedMetadata,e[49]=r.editedValue,e[50]=r.loading,e[51]=r.value,e[52]=r.writeError,e[53]=t,e[54]=w,e[55]=O):O=e[55];let K;e[56]!==r.loadError||e[57]!==r.loading||e[58]!==r.value||e[59]!==t?(K=!r.loading&&r.value===null&&r.loadError===null&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"kv-absent",children:t("Key is absent or has no value.")}),e[56]=r.loadError,e[57]=r.loading,e[58]=r.value,e[59]=t,e[60]=K):K=e[60];let D;return e[61]!==d||e[62]!==m||e[63]!==F||e[64]!==O||e[65]!==K?(D=(0,a.jsxs)("div",{className:"px-4 pb-4","data-testid":"kv-value-section",children:[d,m,F,O,K]}),e[61]=d,e[62]=m,e[63]=F,e[64]=O,e[65]=K,e[66]=D):D=e[66],D},"He"),Se=100,Ze={appliedPrefix:"",bulk:[],bulkBusy:!1,bulkError:null,cursor:null,keys:null,listComplete:!1,loadError:null,loading:!1,prefixInput:"",reloadNonce:0,selectedKey:null},Re=i((l,e)=>{switch(e.type){case"appendPage":return e.generation!==l.reloadNonce?l:{...l,cursor:e.cursor,keys:[...l.keys??[],...e.keys],listComplete:e.listComplete,loading:!1};case"applyFilter":return{...l,appliedPrefix:l.prefixInput,bulk:[],bulkError:null,cursor:null,keys:null,listComplete:!1,reloadNonce:l.reloadNonce+1,selectedKey:null};case"bulkDeleted":{let n=new Set(e.deleted);return{...l,bulk:l.bulk.filter(u=>!n.has(u)),bulkBusy:!1,bulkError:e.error,keys:l.keys===null?null:l.keys.filter(u=>!n.has(u.name)),selectedKey:l.selectedKey!==null&&n.has(l.selectedKey)?null:l.selectedKey}}case"bulkDeleteStart":return{...l,bulkBusy:!0,bulkError:null};case"firstPage":return{...l,cursor:e.cursor,keys:e.keys,listComplete:e.listComplete,loading:!1};case"keyDeleted":return{...l,bulk:l.bulk.filter(n=>n!==e.name),keys:l.keys===null?null:l.keys.filter(n=>n.name!==e.name),selectedKey:null};case"loadFailed":return e.generation!==void 0&&e.generation!==l.reloadNonce?l:{...l,loadError:e.error,loading:!1};case"loadStart":return{...l,loadError:null,loading:!0};case"prefixInput":return{...l,prefixInput:e.value};case"reload":return{...l,bulk:[],bulkError:null,reloadNonce:l.reloadNonce+1,selectedKey:null};case"selectKey":return{...l,selectedKey:e.name};case"toggleAllBulk":return{...l,bulk:e.names};case"toggleBulk":return{...l,bulk:l.bulk.includes(e.name)?l.bulk.filter(n=>n!==e.name):[...l.bulk,e.name]};default:return l}},"ze"),Ue=i(({namespace:l})=>{let e=G(),n=R(),[u,s]=(0,P.useReducer)(Re,Ze),{appliedPrefix:p,bulk:o,bulkBusy:t,bulkError:r,cursor:y,keys:c,listComplete:x,loadError:b,loading:_,prefixInput:V,reloadNonce:T,selectedKey:h}=u,[v,k]=(0,P.useState)(!1);(0,P.useEffect)(()=>{let d={cancelled:!1};return z((async()=>{s({type:"loadStart"});try{let m=await e.listKvKeys({limit:Se,namespace:l,prefix:p===""?void 0:p});d.cancelled||s({cursor:m.cursor??null,keys:m.keys,listComplete:m.listComplete,type:"firstPage"})}catch(m){d.cancelled||s({error:Z(m),type:"loadFailed"})}})()),()=>{d.cancelled=!0}},[e,l,p,T]);let N=i(d=>{s({type:"prefixInput",value:d.target.value})},"x"),C=i(()=>{s({type:"applyFilter"})},"N"),w=i(d=>{s({name:d.currentTarget.dataset.key??null,type:"selectKey"})},"C"),g=i(()=>{if(y===null)return;s({type:"loadStart"});let d=T;z((async()=>{try{let m=await e.listKvKeys({cursor:y,limit:Se,namespace:l,prefix:p===""?void 0:p});s({cursor:m.cursor??null,generation:d,keys:m.keys,listComplete:m.listComplete,type:"appendPage"})}catch(m){s({error:Z(m),generation:d,type:"loadFailed"})}})())},"y"),S=i(d=>{s({name:d,type:"keyDeleted"})},"S"),E=i(d=>{s({name:d,type:"toggleBulk"})},"F"),B=i(d=>{s({names:d&&c!==null?c.map(m=>m.name):[],type:"toggleAllBulk"})},"O"),M=i(()=>{if(o.length===0)return;let d=[...o];s({type:"bulkDeleteStart"}),z((async()=>{let m=await Promise.allSettled(d.map(K=>e.deleteKvKey({key:K,namespace:l}))),F=d.filter((K,D)=>m[D]?.status==="fulfilled"),O=d.length-F.length;s({deleted:F,error:O>0?n("Failed to delete {count} keys.",{count:O}):null,type:"bulkDeleted"})})())},"I"),J=i(()=>{k(!1),s({type:"reload"})},"D"),L=c!==null&&c.length>0&&o.length===c.length,I=new Set(o);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("section",{className:"border border-border bg-card p-3","data-testid":"kv-keys-section",children:[(0,a.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[(0,a.jsx)(ae,{"aria-label":n("Filter keys by prefix"),className:"min-w-[16rem] flex-1","data-testid":"kv-prefix-input",onChange:N,placeholder:n("Filter by prefix\u2026"),value:V}),(0,a.jsx)($,{"data-testid":"kv-filter-btn",disabled:_,onClick:C,children:n("Filter")}),(0,a.jsx)($,{"data-testid":"kv-new-key-btn",onClick:i(()=>{k(d=>!d)},"onClick"),variant:"outline",children:n("New key")}),o.length>0&&(0,a.jsx)($,{"data-testid":"kv-bulk-delete-btn",disabled:t,onClick:M,variant:"destructive",children:t?n("Deleting\u2026"):n("Delete {count}",{count:o.length})})]}),r!==null&&(0,a.jsx)("p",{className:"mb-2 text-sm text-destructive","data-testid":"kv-bulk-error",role:"alert",children:r}),b!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"kv-keys-error",role:"alert",children:b}),c!==null&&c.length===0&&!_&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"kv-no-keys",children:n("No keys.")}),c!==null&&c.length>0&&(0,a.jsx)(re,{className:"overflow-hidden py-0",children:(0,a.jsx)(ne,{className:"px-0",children:(0,a.jsxs)(se,{"data-testid":"kv-key-table",children:[(0,a.jsx)(ie,{children:(0,a.jsxs)(Q,{children:[(0,a.jsx)(X,{className:"w-10",children:(0,a.jsx)(ue,{"aria-label":n("Select all"),checked:L,"data-testid":"kv-select-all",onCheckedChange:B})}),(0,a.jsx)(X,{children:n("Key")}),(0,a.jsx)(X,{children:n("Expiration")})]})}),(0,a.jsx)(oe,{children:c.map(d=>(0,a.jsxs)(Q,{className:d.name===h?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-key":d.name,"data-testid":`kv-key-row-${d.name}`,onClick:w,children:[(0,a.jsx)(Y,{onClick:i(m=>{m.stopPropagation()},"onClick"),children:(0,a.jsx)(ue,{"aria-label":n("Select {name}",{name:d.name}),checked:I.has(d.name),"data-testid":`kv-select-${d.name}`,onCheckedChange:i(()=>{E(d.name)},"onCheckedChange")})}),(0,a.jsx)(Y,{className:"font-mono text-xs",children:d.name}),(0,a.jsx)(Y,{className:"tabular-nums text-xs",children:Le(d.expiration)})]},d.name))})]})})}),!x&&y!==null&&(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)($,{"data-testid":"kv-load-more",disabled:_,onClick:g,variant:"outline",children:n(_?"Loading\u2026":"Load more")})})]}),(0,a.jsx)(me,{onOpenChange:i(d=>{d||k(!1)},"onOpenChange"),open:v,children:(0,a.jsxs)(ve,{className:"w-full gap-0 overflow-y-auto sm:max-w-md","data-testid":"kv-create-sheet",side:"right",children:[(0,a.jsx)(pe,{children:(0,a.jsx)(ye,{children:n("New key")})}),(0,a.jsx)(je,{namespace:l,onCancel:i(()=>{k(!1)},"onCancel"),onCreated:J})]})}),(0,a.jsx)(me,{onOpenChange:i(d=>{d||s({name:null,type:"selectKey"})},"onOpenChange"),open:h!==null,children:(0,a.jsxs)(ve,{className:"w-full gap-0 overflow-y-auto sm:max-w-md","data-testid":"kv-editor-sheet",side:"right",children:[(0,a.jsx)(pe,{children:(0,a.jsx)(ye,{className:"truncate font-mono text-xs",children:h})}),h!==null&&(0,a.jsx)(He,{expiration:c?.find(d=>d.name===h)?.expiration,keyName:h,namespace:l,onDeleted:S},`${l}:${h}`)]})})]})},"Ue"),it=i(({loadNamespaces:l}={})=>{let e=G(),n=R(),[u,s]=(0,P.useState)(null),[p,o]=(0,P.useState)(null),[t,r]=(0,P.useState)(null);(0,P.useEffect)(()=>{let c={cancelled:!1};return z((async()=>{try{let x=await(l??(()=>e.listKvNamespaces()))();c.cancelled||(s(x),o(null),r(b=>b??x[0]?.binding??null))}catch(x){c.cancelled||(s(null),o(Z(x)))}})()),()=>{c.cancelled=!0}},[e,l]);let y=i(c=>{r(c.currentTarget.dataset.ns??null)},"f");return(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-kv-browser",children:[p!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"kv-ns-error",role:"alert",children:p}),u!==null&&u.length===0&&(0,a.jsx)(ke,{description:n("Add a kv_namespaces binding to wrangler.jsonc \u2014 it appears here automatically, no wiring needed."),icon:(0,a.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M5 5h14v4H5V5Zm0 5h14v4H5v-4Zm0 5h14v4H5v-4Z"})}),testId:"kv-empty",title:n("No KV namespaces.")}),u!==null&&u.length>0&&(0,a.jsx)(re,{className:"overflow-hidden py-0",children:(0,a.jsx)(ne,{className:"px-0",children:(0,a.jsxs)(se,{"data-testid":"kv-namespace-table",children:[(0,a.jsx)(ie,{children:(0,a.jsx)(Q,{children:(0,a.jsx)(X,{children:n("Namespace")})})}),(0,a.jsx)(oe,{children:u.map(c=>(0,a.jsx)(Q,{className:c.binding===t?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-ns":c.binding,"data-testid":`kv-ns-row-${c.binding}`,onClick:y,children:(0,a.jsx)(Y,{className:"font-mono text-xs",children:c.binding})},c.binding))})]})})}),t!==null&&(0,a.jsx)(Ue,{namespace:t},t)]})},"ut");export{it as KvBrowser};
@@ -0,0 +1 @@
1
+ import{a as s}from"./chunk-I26MS5PJ.js";var u=new Set(["contains","eq","gt","gte","lt","lte","ne"]),a=s(r=>typeof r=="number"&&Number.isSafeInteger(r)?String(r):r,"i"),o=s(r=>{if(typeof r!="string")return;let e=r.trim();return e===""?void 0:e},"e"),v=s(r=>{if(r===null||typeof r!="object")return!1;let e=r;return typeof e.column=="string"&&typeof e.operator=="string"&&u.has(e.operator)},"p"),h=s(r=>{if(typeof r!="string"||r==="")return[];try{let e=JSON.parse(r);return Array.isArray(e)?e.filter(v):[]}catch{return[]}},"f"),g=s(r=>{if(typeof r!="string"||r==="")return;let e=r.lastIndexOf(":");if(e<=0)return;let i=r.slice(0,e),n=r.slice(e+1);if(!(n!=="asc"&&n!=="desc"))return{column:i,direction:n}},"u"),p=/^[\da-f]{16}$/u,b=s(r=>{let e={};if(typeof r.pins=="string"&&r.pins!==""){let c=r.pins.split(",").filter(f=>f!==""&&f.length<=64).slice(0,12);c.length>0&&(e.pins=c.join(","))}r.schema==="global"&&(e.schema="global");let i=o(r.table);i!==void 0&&(e.table=i);let n=o(a(r.shard));n!==void 0&&(e.shard=n);let d=o(a(r.search));d!==void 0&&(e.search=d);let t=o(r.order);t!==void 0&&g(t)!==void 0&&(e.order=t);let l=o(r.filters);return l!==void 0&&h(l).length>0&&(e.filters=l),e},"b"),y=s(r=>{let e=h(r.filters),i=g(r.order);return{filters:e.length>0?e:void 0,orderBy:i,search:o(a(r.search)),shard:o(a(r.shard)),table:o(r.table),tier:r.schema==="global"?"global":"shard"}},"v"),m=s(r=>{let e=r.filters??[];return{filters:e.length>0?JSON.stringify(e):void 0,order:r.orderBy===void 0?void 0:`${r.orderBy.column}:${r.orderBy.direction}`,schema:r.tier==="global"?"global":void 0,search:r.search!==void 0&&r.search!==""?r.search:void 0,shard:r.shard!==void 0&&r.shard!==""?r.shard:void 0,table:r.table!==void 0&&r.table!==""?r.table:void 0}},"y"),S=s(r=>{let{version:e}=r;return typeof e=="string"&&p.test(e)?{version:e}:{}},"S");export{b as a,y as b,m as c,S as d};
@@ -0,0 +1 @@
1
+ import{a as f,d as r,e as m,f as n}from"./chunk-I26MS5PJ.js";var u=r(n(),1),s=r(m(),1);function a(t){let e=(0,u.c)(2),c=(0,s.useRef)(t),o;return e[0]!==t?(o=f(()=>{c.current=t},"t"),e[0]=t,e[1]=o):o=e[1],(0,s.useEffect)(o),c}f(a,"m");export{a};
@@ -0,0 +1 @@
1
+ import{a as i}from"./chunk-I26MS5PJ.js";var e=i(t=>{let r=Math.floor(t/1e3),o=Math.floor(r/3600),n=Math.floor(r%3600/60),a=r%60;return o>0?`${o.toString()}h ${n.toString()}m`:n>0?`${n.toString()}m ${a.toString()}s`:`${a.toString()}s`},"e"),m=i((t,r)=>{let o=t+r;return o===0?"\u2014":`${(t/o*100).toFixed(1)}%`},"a"),s=i(t=>t<=0?"\u2014":t<1?`${(t*1e3).toFixed(0)}\u03BCs`:t<1e3?`${t.toFixed(1)}ms`:`${(t/1e3).toFixed(2)}s`,"s"),c=i((t,r)=>new Intl.NumberFormat(r,t===0||Math.abs(t)>=1?{currency:"USD",maximumFractionDigits:2,minimumFractionDigits:2,style:"currency"}:{currency:"USD",maximumSignificantDigits:3,style:"currency"}).format(t),"c"),u=i((t,r)=>new Intl.NumberFormat(r,{maximumFractionDigits:0}).format(t),"m");export{e as a,m as b,s as c,c as d,u as e};
@@ -0,0 +1 @@
1
+ import{a as D}from"./chunk-JQXA2OYK.js";import{a as k}from"./chunk-AJV3ZKEY.js";import"./chunk-FUYEZFBP.js";import"./chunk-OQ6I6OXT.js";import"./chunk-SJQERRSZ.js";import"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as N}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as B}from"./chunk-SJUYCXDY.js";import"./chunk-NCPW7WHO.js";import"./chunk-3V25YSWQ.js";import"./chunk-55UGUCQ6.js";import{a as u}from"./chunk-4ZEL6BYL.js";import{c as p}from"./chunk-VRWHCG2V.js";import{e as R}from"./chunk-ICDMV4MP.js";import"./chunk-QAQDMS6R.js";import"./chunk-FQPBYMII.js";import{a as S}from"./chunk-RWVIV3U7.js";import{a as A,b as C,c as _,d as b,e as l,f as o}from"./chunk-HCTJKP5J.js";import{a as v,e as w}from"./chunk-2IKDEUCX.js";import{d as j,t as I}from"./chunk-HJHSQPHW.js";import{a as m,d as H,g as Q}from"./chunk-I26MS5PJ.js";var e=H(Q(),1);var P="payment_subscriptions",O="payment_events",V=[P,O],Y={},E=new Set(["active","trialing"]),z=new Set(["past_due","unpaid"]),s=m((a,t)=>{if(a[t]!==void 0)return a[t];let h=a.__doc__;return typeof h=="string"?R(h)?.[t]:void 0},"a"),n=m(a=>typeof a=="string"?a:typeof a=="number"||typeof a=="bigint"||typeof a=="boolean"?String(a):"","s"),J=m(a=>E.has(a)?"default":z.has(a)?"destructive":"outline","q"),de=m(({limit:a=100})=>{let t=j(),h=k(),{data:x}=p(u.listTables,Y,{live:!0}),F=x!==void 0,L=Array.isArray(x)&&V.every(r=>x.some(i=>i.name===r)),c=h.payments&&L,d=p(u.readTablePage,{filters:[],limit:a,offset:0,orderBy:{column:"updatedAt",direction:"desc"},search:"",table:P},{enabled:c}),f=p(u.readTablePage,{filters:[],limit:25,offset:0,orderBy:{column:"processedAt",direction:"desc"},search:"",table:O},{enabled:c}),g=p(u.facetColumn,{column:"state",table:P},{enabled:c});D(()=>{c&&(d.refetch(),f.refetch(),g.refetch())},!0);let y=d.data?.rows??[],M=f.data?.rows??[],U=d.error??f.error,q=d.error===null?f.errorSource:d.errorSource,G=d.data?.total??y.length,T=g.data?.values===void 0?y.filter(r=>E.has(n(s(r,"state")))).length:g.data.values.reduce((r,i)=>r+(E.has(n(i.value))?i.count:0),0);return F&&!c?(0,e.jsx)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:(0,e.jsx)(S,{description:t("No @lunora/payment tables found in this deployment. Add `.extend(paymentExtension)` to lunora/schema.ts and wire `payment` on createShardDO() to sync customers and subscriptions."),testId:"payments-unconfigured",title:t("No payments configured")})}):(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,e.jsx)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,e.jsxs)(v,{className:"justify-between gap-0 py-0",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Subscriptions")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:T}),(0,e.jsx)(N,{variant:"default",children:t("{count} active",{count:T})})]})]}),(0,e.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:t("{total} total",{total:G})})]})}),U===null?void 0:(0,e.jsx)(B,{error:q}),y.length===0&&!d.isLoading?(0,e.jsx)(S,{testId:"payments-empty",title:t("No subscriptions yet")}):(0,e.jsx)(v,{className:"overflow-hidden py-0",children:(0,e.jsx)(w,{className:"px-0",children:(0,e.jsxs)(A,{children:[(0,e.jsx)(C,{children:(0,e.jsxs)(b,{children:[(0,e.jsx)(l,{children:t("Provider")}),(0,e.jsx)(l,{children:t("Reference")}),(0,e.jsx)(l,{children:t("Plan")}),(0,e.jsx)(l,{children:t("State")}),(0,e.jsx)(l,{children:t("Renews")})]})}),(0,e.jsx)(_,{children:y.map(r=>{let i=n(s(r,"state"));return(0,e.jsxs)(b,{"data-testid":"payment-subscription-row",children:[(0,e.jsx)(o,{children:n(s(r,"provider"))}),(0,e.jsx)(o,{children:n(s(r,"referenceId"))}),(0,e.jsx)(o,{children:n(s(r,"priceId"))}),(0,e.jsx)(o,{children:(0,e.jsx)(N,{variant:J(i),children:i})}),(0,e.jsx)(o,{children:I(s(r,"currentPeriodEnd"))})]},n(s(r,"providerSubscriptionId")))})})]})})}),(0,e.jsxs)(v,{className:"overflow-hidden py-0",children:[(0,e.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Recent webhook events")})}),(0,e.jsx)(w,{className:"px-0",children:(0,e.jsx)(A,{children:(0,e.jsx)(_,{children:M.map(r=>(0,e.jsxs)(b,{"data-testid":"payment-event-row",children:[(0,e.jsx)(o,{children:n(s(r,"provider"))}),(0,e.jsx)(o,{className:"font-medium",children:n(s(r,"type"))}),(0,e.jsx)(o,{className:"text-muted-foreground",children:n(s(r,"providerEventId"))}),(0,e.jsx)(o,{children:I(s(r,"processedAt"))})]},n(s(r,"providerEventId"))))})})})]})]})},"oe");export{de as PaymentsPanel};
@@ -0,0 +1 @@
1
+ import{a as Q}from"./chunk-FPI7AMQJ.js";import{a as x}from"./chunk-37WYCOQ2.js";import{a as H}from"./chunk-YVR4SEPU.js";import{b as G}from"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import{i as z}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as h}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as k}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as U}from"./chunk-4ZEL6BYL.js";import{c as w,d as D,l as K}from"./chunk-ICDMV4MP.js";import"./chunk-QAQDMS6R.js";import"./chunk-FQPBYMII.js";import{d as _,e as B,f as P,h as W,m as q,p as E,t as M}from"./chunk-HJHSQPHW.js";import{a as s,d as J,e as le,g as ce}from"./chunk-I26MS5PJ.js";var i=J(le(),1);var e=J(ce(),1);var ue=s(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"le"),me=s(r=>r===void 0||r.length===0?"()":`(${r.map(o=>`${o.name}${o.optional?"?":""}: ${ue(o)}`).join(", ")})`,"ce"),fe=s(r=>{switch(r){case"array":return[];case"bigint":return w(0n);case"boolean":return!1;case"bytes":return w(new ArrayBuffer(0));case"number":return 0;case"object":case"record":return{};default:return""}},"ue"),pe=s(r=>{let o={};for(let a of r??[])a.optional||(o[a.name]=fe(a.kind));return JSON.stringify(o,void 0,2)},"me"),he=P(U.runAs),xe=10,ge=s(r=>r===void 0?"undefined":JSON.stringify(r,q,2),"pe"),Re=s(({functions:r,runAsIdentity:o=!1}={})=>{let a=_(),u=K(),[V,X]=(0,i.useState)(null),[I,Y]=(0,i.useState)(null),g=r??V??[],[S,F]=(0,i.useState)(""),[m,b]=(0,i.useState)("{}"),[c,$]=(0,i.useState)(""),[f,Z]=(0,i.useState)(""),[v,p]=(0,i.useState)("idle"),[ee,y]=(0,i.useState)(void 0),[C,N]=(0,i.useState)(null),[A,te]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(r!==void 0)return;let t=!1;return u.listFunctions().then(d=>(t||X(d),d)).catch(d=>{t||Y(W(d))}),()=>{t=!0}},[u,r]);let R=S===""?g[0]?.path??"":S,n=g.find(t=>t.path===R),re=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:D(JSON.parse(m))}catch(l){p("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},L=c.trim()===""?{}:{shardKey:c.trim()},O=o?f.trim():"",T=s(l=>{te(j=>[{argsText:m,at:Date.now(),id:(j[0]?.id??0)+1,kind:n.kind,path:n.path,shardKey:c,status:l},...j].slice(0,xe))},"$");p("running"),N(null);try{let l=O===""?await B(u,n.kind,d,t,L):await u.query(he,{args:t,functionPath:n.path,userId:O},L);G(c),y(l),p("success"),T("success")}catch(l){y(void 0),N(l.message),p("error"),T("error")}},"M"),ae=s(t=>{F(t.path),b(t.argsText),$(t.shardKey)},"P"),se=s(t=>{F(t.target.value)},"z"),ne=s(t=>{b(t.target.value)},"W"),ie=s(t=>{Z(t.target.value)},"q"),oe=s(()=>{E(re())},"H"),de=s(()=>{b(pe(n?.args))},"V");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[I!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:I}),(0,e.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(x,{htmlFor:"function-select",children:a("Function")}),(0,e.jsx)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:se,value:R,children:g.map(t=>(0,e.jsxs)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path))}),n!==void 0&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"mr-1.5 font-medium",children:a("Signature")}),(0,e.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:me(n.args)})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)(x,{htmlFor:"args-input",children:a("Arguments")}),(0,e.jsx)(h,{"data-testid":"prefill-button",disabled:n===void 0,onClick:de,size:"xs",type:"button",variant:"ghost",children:a("Prefill")})]}),(0,e.jsx)(Q,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:ne,value:m})]}),(0,e.jsx)(H,{onChange:$,testId:"shard-input",value:c}),o&&(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsx)(x,{htmlFor:"run-as-input",children:a("Run as identity (userId)")}),(0,e.jsx)(z,{"aria-label":a("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:ie,placeholder:a("Leave empty to run as admin"),value:f}),(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground",children:a("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(h,{"data-testid":"run-button",disabled:v==="running"||n===void 0,onClick:oe,type:"button",children:a("Run")}),n!==void 0&&(0,e.jsx)(k,{variant:"outline",children:n.kind}),o&&f.trim()!==""&&(0,e.jsx)(k,{"data-testid":"run-as-badge",variant:"secondary",children:a("as {userId}",{userId:f.trim()})})]})]}),v==="error"&&C!==null&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:C}),v==="success"&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:ge(ee)}),A.length>0&&(0,e.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:A.map((t,d)=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsx)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"})," ",(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]})," ",(0,e.jsx)("time",{className:"text-xs text-muted-foreground",children:M(t.at)})," ",(0,e.jsx)(h,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:s(()=>{ae(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Load")})]},t.id))})]})},"$e");export{Re as FunctionRunner};
@@ -0,0 +1,3 @@
1
+ import{D as xe,I as Ge,J as Ce,K as Qe,L as Ze,M as et,N as tt,b as Q,d as He,f as qe,l as Xe}from"./chunk-MVWZMWPD.js";import{a as O,c as L,i as Je,w as ve}from"./chunk-AUAECCXB.js";import{a as $e,c as be,d as ie,g as M,i as ge,j as J}from"./chunk-BOMPSVRC.js";import{a as t,c as Mt,d as E,e as k,f as St,g as ae,i as ze}from"./chunk-I26MS5PJ.js";var ht=E(St(),1);var Et=E(k(),1);var Te={};Mt(Te,{Control:()=>Ct,Description:()=>vt,Error:()=>bt,Item:()=>It,Label:()=>Rt,Root:()=>pt,Validity:()=>yt});var P=E(k(),1);var Fe=E(k(),1);var rt="data-valid",ot="data-invalid";var se={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ot={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},it={disabled:!1,...Ot},H={valid(r){return r===null?null:r?{[rt]:""}:{[ot]:""}}};var wt={invalid:void 0,name:void 0,validityData:{state:se,errors:[],error:"",value:"",initialValue:null},setValidityData:M,disabled:void 0,setTouched:M,setDirty:M,setFilled:M,setFocused:M,validationMode:"onSubmit",shouldValidateOnChange:t(()=>!1,"shouldValidateOnChange"),state:it,registerFieldControl:M,validation:{getValidationProps:t((r,e=ge)=>e,"getValidationProps"),inputRef:{current:null},registeredInputs:new Map,registerInput:M,getInputControl:t(()=>null,"getInputControl"),commit:t(async()=>{},"commit"),change:M}},Oe=Fe.createContext(wt);function Y(r=!0){let e=Fe.useContext(Oe);if(e.setValidityData===M&&!r)throw new Error(be(28));return e}t(Y,"useFieldRootContext");var ye=E(k(),1);var _t=ye.createContext(void 0);function nt(r=!1){let e=ye.useContext(_t);if(!e&&!r)throw new Error(be(86));return e}t(nt,"useFieldsetRootContext");var Ie=E(k(),1);var Pt=Ie.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:M,validationMode:"onSubmit",submitCountRef:{current:0}});function Z(){return Ie.useContext(Pt)}t(Z,"useFormContext");var ne=E(k(),1);var Ee=E(k(),1);var we=Ee.createContext({controlId:void 0,registerControlId:M,resetControlId:M,labelId:void 0,setLabelId:M,messageIds:[],setMessageIds:M,getDescriptionProps:t(r=>r,"getDescriptionProps")});function U(){return Ee.useContext(we)}t(U,"useLabelableContext");var at=E(ae(),1);var Ve=t(function(e){let o=Q(),[s,c]=ne.useState(o),[d,l]=ne.useState(),[R,f]=ne.useState([]),u=s===void 0?o:s,a=ie(()=>new Map),{messageIds:b}=U(),C=L((D,I)=>{let x=a.current;I===void 0?x.delete(D):x.set(D,I),c(w=>{if(x.size===0)return w;let A;for(let i of x.values()){if(i===w)return w;A===void 0&&(A=i)}return A})}),g=L(()=>{a.current.size===0&&c(o)}),v=ne.useCallback(D=>{let I=D["aria-describedby"]?D["aria-describedby"].split(" "):[];return I.push(...b,...R),{...D,"aria-describedby":Array.from(new Set(I)).join(" ")||void 0}},[b,R]),N=ne.useMemo(()=>({controlId:u,registerControlId:C,resetControlId:g,labelId:d,setLabelId:l,messageIds:R,setMessageIds:f,getDescriptionProps:v}),[u,C,g,d,l,R,f,v]);return(0,at.jsx)(we.Provider,{value:N,children:e.children})},"LabelableProvider");var _e=E(k(),1);function st(r={}){let{id:e,enabled:o=!0}=r,{controlId:s,registerControlId:c,resetControlId:d}=U(),l=Q(),R=ie(()=>Symbol()),f=_e.useRef(!1),u=_e.useRef(!1),a=L(()=>{!f.current||c===M||(f.current=!1,c(R.current,void 0))});return O(()=>{if(!o||c===M){a();return}let b;if(e!==void 0)u.current=!0,b=e;else if(u.current)b=l;else{d();return}if(b===void 0){a();return}f.current=!0,c(R.current,b)},[e,o,c,d,l,R,a]),O(()=>a,[a]),(o?s:void 0)??e??l}t(st,"useLabelableId");function lt(r,e){let o=Q(r);return O(()=>(e(o),()=>{e(s=>s===o?void 0:s)}),[o,e]),o}t(lt,"useRegisteredLabelId");function dt(r={}){let{id:e,fallbackControlId:o,native:s=!1,setLabelId:c,focusControl:d}=r,{controlId:l,setLabelId:R}=U(),f=L(g=>{R(g),c?.(g)}),u=lt(e,f),a=l??o;function b(g){if(d){d(g,a);return}if(!a)return;let v=ve(g.currentTarget).getElementById(a);Je(v)&&At(v)}t(b,"focusControl");function C(g){qe(g.nativeEvent)?.closest("button,input,select,textarea")||(!g.defaultPrevented&&g.detail>1&&g.preventDefault(),!s&&b(g))}return t(C,"handleInteraction"),s?{id:u,htmlFor:a,onMouseDown:C}:{id:u,onClick:C,onPointerDown(g){g.preventDefault()}}}t(dt,"useLabel");function At(r){r.focus({focusVisible:!0})}t(At,"focusElementWithVisible");var oe=E(k(),1);function le(r,e){return{...r,state:{...r.state,valid:!e&&r.state.valid}}}t(le,"getCombinedFieldValidityData");var Pe=Object.keys(se);function kt(r,e){return r.matches(":disabled")?!1:!e||r.form===e?!0:r.form===null&&!r.hasAttribute("form")}t(kt,"isEligibleInput");function ut(r,e){let o=null;for(let s of r.keys())if(kt(s,e)){if(!s.validity.valid)return s;o??=s}return o}t(ut,"findRepresentativeInput");function ct(r){return{...se,valid:!r,customError:r}}t(ct,"makeState");function Ae(r){return r&&r.validationMessage?[r.validationMessage]:[]}t(Ae,"getNativeErrors");function ft(r){let{elementRef:e,formRef:o}=Z(),{setValidityData:s,validate:c,validityData:d,validationDebounceTime:l,invalid:R,markedDirtyRef:f,state:u,shouldValidateOnChange:a,validationMode:b,registeredFieldIdRef:C}=r,{controlId:g,getDescriptionProps:v}=U(),N=xe(),D=oe.useRef(null),I=ie(()=>new Map).current,x=oe.useRef(0),w=oe.useRef(null),A=oe.useCallback((S,j)=>(I.set(S,j),()=>{I.delete(S)}),[I]),i=L(()=>{let S=ut(I,e.current);return S&&I.get(S)?.controlRef.current||null}),V=L(async(S,j=!1)=>{x.current+=1;let h=x.current;function $(n,m=R){let p=C.current??g;if(p==null)return;let y=o.current.fields.get(p);if(!y)return;let W=le(n,m);o.current.fields.set(p,{...y,validityData:W})}t($,"updateRegisteredFieldValidity");function ee(n,m){let p=n.valid===!1?m:[];return{value:S,state:n,error:p[0]??"",errors:p,initialValue:d.initialValue}}t(ee,"makeValidityData");function te(n,m){let p=n.validity.customError?n.validationMessage:"",y=m.replace(/\r\n?/g,`
2
+ `);n.setCustomValidity(y),w.current=[n,y,p]}t(te,"setCustomValidity");function X(){let n=w.current;w.current=null,n&&(!n[0].willValidate||n[0].validationMessage===n[1])&&n[0].setCustomValidity(n[2])}t(X,"clearCustomValidity");function _(n,m,p){let y=ee(n,m);$(y,p),s(y)}t(_,"publish");function q(n){let m=Pe.reduce((y,W)=>(y[W]=n.validity[W],y),{}),p=!1;for(let y of Pe)if(y!=="valid"){if(y==="valueMissing"&&m[y])p=!0;else if(m[y])return m}return p&&!f.current&&(m.valid=!0,m.valueMissing=!1),m}t(q,"getState");function re(){return I.size>0?ut(I,e.current):D.current}t(re,"resolveRepresentativeInput");let T=re();function G(){return T=re(),T?.willValidate?q(T):ct(!1)}if(t(G,"refreshState"),j){if(u.valid!==!1||!T)return;if(!T.validity.valueMissing){X();let n=re(),m=n?.validity.customError?Ae(n):[];_(ct(m.length>0),m,!1);return}for(let n of Pe)if(n!=="valid"&&n!=="valueMissing"&&n!=="customError"&&T.validity[n])return}N.clear(),X();let B=G(),K=Ae(T),ue=a();if(K.length===0||ue){let n=Array.from(o.current.fields.values()).reduce((y,W)=>(W.name&&(y[W.name]=W.getValue()),y),{}),m=c(S,n),p;if(typeof m=="object"&&m!==null&&"then"in m){if(B.valid===!1?_(B,K):(b==="onSubmit"||!d.state.customError)&&(B.valid=null,_(B,K)),p=await m,h!==x.current)return;B=G()}else p=m;K=p?[].concat(p).filter(Boolean):[],K.length>0?(B.valid=!1,B.customError=!0,T?.willValidate&&te(T,K.join(`
3
+ `))):K=Ae(T)}_(B,K)}),F=L((S,j=!1)=>{if(N.clear(),x.current+=1,j)return;let h=a();h&&S!==""&&l?N.start(l,()=>{V(S)}):V(S,!h)}),z=oe.useCallback((S,j={})=>$e(v(j),u.valid===!1&&!u.disabled&&!S?{"aria-invalid":!0}:ge),[v,u.disabled,u.valid]);return oe.useMemo(()=>({getValidationProps:z,inputRef:D,registeredInputs:I,registerInput:A,getInputControl:i,commit:V,change:F}),[z,I,A,i,V,F])}t(ft,"useFieldValidation");var he=E(k(),1);function mt(r){let{change:e,commit:o,invalid:s,markedDirtyRef:c,name:d,setRegisteredFieldName:l,registeredFieldIdRef:R,setValidityData:f,validityData:u}=r,{formRef:a}=Z(),b=he.useRef(null),C=he.useRef(null),g=he.useRef(!1),v=L(()=>{let i=C.current;if(i)return i.getValue?i.getValue():i.value});function N(i){return i.value===void 0?v():i.value}t(N,"getRegistrationValue");let D=L(()=>{let i=C.current;if(c.current=!0,!i){o(u.value);return}o(N(i))});function I(){let i=C.current;!i||!i.id||a.current.fields.set(i.id,{getValue:v,name:d??i.name,controlRef:i.controlRef,validityData:le(u,s),validate:D})}t(I,"refreshRegistration");function x(i=C.current?.id){i&&a.current.fields.delete(i)}t(x,"deleteRegistration");function w(i){if(g.current)return;g.current=!0;let V=N(i);f(F=>F.initialValue===V?F:{...F,initialValue:V})}t(w,"captureInitialValue"),O(()=>{let i=C.current;!i||!i.id||(l(d?void 0:i.name),a.current.fields.set(i.id,{getValue:v,name:d??i.name,controlRef:i.controlRef,validityData:le(u,s),validate:D}))},[a,v,s,d,l,D,u]),O(()=>{let i=a.current.fields;return()=>{let V=C.current?.id;V&&i.delete(V)}},[a]);let A=L((i,V)=>{if(!V){b.current===i&&(b.current=null,e(void 0,!0),x(),C.current=null,l(void 0),R.current=void 0);return}let F=C.current?.id,z=b.current;z&&z!==i&&e(void 0,!0),b.current=i,C.current=V,d||l(V.name),R.current=V.id,F&&F!==V.id&&x(F),w(V),I()});return[D,A]}t(mt,"useFieldControlRegistration");var De=E(ae(),1);var Ut=P.forwardRef(t(function(e,o){let{errors:s,validationMode:c,submitCountRef:d}=Z(),{render:l,className:R,validate:f,validationDebounceTime:u=0,validationMode:a=c,name:b,disabled:C=!1,invalid:g,dirty:v,touched:N,actionsRef:D,style:I,...x}=e,w=nt(!0)?.disabled,A=L(f||(()=>null)),i=w||C,[V,F]=P.useState(!1),[z,S]=P.useState(!1),[j,h]=P.useState(!1),[$,ee]=P.useState(!1),te=v??z,X=N??V,_=P.useRef(te),q=P.useRef(void 0),[re,T]=P.useState(),G=b??re;O(()=>{v!==void 0&&(_.current=v)},[v]);let B=L(Re=>{v===void 0&&(Re&&(_.current=!0),S(Re))}),K=L(Re=>{N===void 0&&F(Re)}),ue=L(()=>a==="onChange"||a==="onSubmit"&&d.current>0),n=G&&Object.hasOwn(s,G)?s[G]:null,m=!!(Array.isArray(n)?n.length:n),p=g===!0||m,[y,W]=P.useState({state:se,error:"",errors:[],value:null,initialValue:null}),We=!p&&(i?null:y.state.valid),me=P.useMemo(()=>({disabled:i,touched:X,dirty:te,valid:We,filled:j,focused:$}),[i,X,te,We,j,$]),pe=ft({setValidityData:W,validate:A,validityData:y,validationDebounceTime:u,invalid:p,markedDirtyRef:_,state:me,shouldValidateOnChange:ue,validationMode:a,registeredFieldIdRef:q}),[Ye,Ke]=mt({change:pe.change,commit:pe.commit,invalid:p,markedDirtyRef:_,name:b,setRegisteredFieldName:T,registeredFieldIdRef:q,setValidityData:W,validityData:y});P.useImperativeHandle(D,()=>({validate:Ye}),[Ye]);let Lt=P.useMemo(()=>({invalid:p,name:G,validityData:y,setValidityData:W,disabled:i,setTouched:K,setDirty:B,setFilled:h,setFocused:ee,validationMode:a,shouldValidateOnChange:ue,state:me,registerFieldControl:Ke,validation:pe}),[p,G,y,i,K,B,h,ee,a,ue,me,Ke,pe]),Nt=J("div",e,{ref:o,state:me,props:x,stateAttributesMapping:H});return(0,De.jsx)(Oe.Provider,{value:Lt,children:Nt})},"FieldRootInner")),pt=P.forwardRef(t(function(e,o){return(0,De.jsx)(Ve,{children:(0,De.jsx)(Ut,{...e,ref:o})})},"FieldRoot"));var ce=E(k(),1);var Le=E(k(),1);var ke=Le.createContext({disabled:!1});function Ne(){return Le.useContext(ke)}t(Ne,"useFieldItemContext");var Rt=ce.forwardRef(t(function(e,o){let{render:s,className:c,style:d,id:l,nativeLabel:R=!0,...f}=e,u=Y(!1),a=Ne(),{labelId:b}=U(),C={...u.state,disabled:u.disabled||a.disabled},g=ce.useRef(null),v=dt({id:b??l,native:R});return J("label",e,{ref:[o,g],state:C,props:[v,f],stateAttributesMapping:H})},"FieldLabel"));var de=E(k(),1);var Ue=E(ae(),1);var jt={...H,...Xe},bt=de.forwardRef(t(function(e,o){let{render:s,id:c,className:d,match:l,style:R,...f}=e,u=Q(c),{validityData:a,state:b,name:C}=Y(!1),{setMessageIds:g}=U(),{errors:v}=Z(),N=C&&Object.hasOwn(v,C)?v[C]:null,D=!!(Array.isArray(N)?N.length:N),I=typeof l=="string",x=!1;l===!0?x=!0:b.disabled?x=!1:I?x=!!a.state[l]:x=D||a.state.valid===!1;let{mounted:w,transitionStatus:A,setMounted:i}=Ce(x);O(()=>{if(!(!x||!u))return g(_=>_.concat(u)),()=>{g(_=>_.filter(q=>q!==u))}},[x,u,g]);let V=de.useRef(null),[F,z]=de.useState(null),[S,j]=de.useState(null),h=a.error;!I&&D?h=N:a.errors.length>1&&(h=a.errors);let $=h;Array.isArray(h)&&($=h.length>1?(0,Ue.jsx)("ul",{children:h.map(_=>(0,Ue.jsx)("li",{children:_},_))}):h[0]);let ee=Array.isArray(h)?JSON.stringify(h):h;x&&ee!==S&&(j(ee),z($)),Ge({open:x,ref:V,onComplete(){x||i(!1)}});let te={...b,transitionStatus:A},X=J("div",e,{ref:[o,V],state:te,props:[{id:u,children:x?$:F},f],stateAttributesMapping:jt,enabled:w});return w?X:null},"FieldError"));var gt=E(k(),1);var vt=gt.forwardRef(t(function(e,o){let{render:s,id:c,className:d,style:l,...R}=e,f=Q(c),u=Y(!1),a=Ne(),{setMessageIds:b}=U(),C={...u.state,disabled:u.disabled||a.disabled};return O(()=>{if(f)return b(v=>v.concat(f)),()=>{b(v=>v.filter(N=>N!==f))}},[f,b]),J("p",e,{ref:o,state:C,props:[{id:f},R],stateAttributesMapping:H})},"FieldDescription"));var Me=E(k(),1);function xt(r,e,o,s,c=!0,d){let{registerFieldControl:l}=Y(),R=ie(()=>Symbol());O(()=>{let f=R.current;if(!c){l(f,void 0);return}l(f,{controlRef:r,getValue:s,id:e,name:d,value:o})},[r,c,s,e,d,l,R,o]),O(()=>{let f=R.current;return()=>{l(f,void 0)}},[l,R])}t(xt,"useRegisterFieldControl");var Ct=Me.forwardRef(t(function(e,o){let{render:s,className:c,id:d,name:l,value:R,disabled:f=!1,onValueChange:u,defaultValue:a,autoFocus:b=!1,style:C,...g}=e,{state:v,name:N,disabled:D,setTouched:I,setDirty:x,validityData:w,setFocused:A,setFilled:i,validationMode:V,validation:F}=Y(),{clearErrors:z,elementRef:S,submitCountRef:j}=Z(),h=D||f,$=N??l,ee={...v,disabled:h},{labelId:te}=U(),X=st({id:d}),[_]=Qe({controlled:R,default:a,name:"FieldControl",state:"value"}),q=R!==void 0,re=q?_:void 0,T=re==null?void 0:String(re),G=L(()=>F.inputRef.current?.value);xt(F.inputRef,X,T,G,!h,l),O(()=>{let n=T??F.inputRef.current?.value;n!==void 0&&i(n!=="")},[T,F.inputRef,i]),Ze(T,()=>{T!==void 0&&(z($),x(T!==(w.initialValue??"")),F.change(T))});let B=Me.useRef(null),K=xe();return O(()=>{b&&B.current===He(ve(B.current))&&A(!0)},[b,A]),J("input",e,{ref:[o,B],state:ee,props:[{id:X,disabled:h,name:$,ref:F.inputRef,"aria-labelledby":te,autoFocus:b,...q?{value:re}:{defaultValue:a},onChange(n){let m=n.currentTarget.value,p=tt(et.none,n.nativeEvent);u?.(m,p),!q&&(x(m!==(w.initialValue??"")),i(m!==""),!n.nativeEvent.defaultPrevented&&!p.isCanceled&&(z($),F.change(m)))},onFocus(){A(!0)},onBlur(n){if(I(!0),A(!1),V==="onBlur"){let m=n.currentTarget.value;F.commit(m),q&&queueMicrotask(()=>{let p=F.inputRef.current?.value;p!==void 0&&p!==m&&p!==(w.initialValue??"")&&F.commit(p)})}},onKeyDown(n){if(n.currentTarget.tagName==="INPUT"&&n.key==="Enter"){I(!0);let m=n.currentTarget.value,p=n.currentTarget.form;if(p&&p===S.current&&!n.defaultPrevented){let y=n.currentTarget,W=j.current;K.start(0,()=>{j.current===W&&F.commit(y.value)})}else F.commit(m)}}},g,n=>F.getValidationProps(h,n)],stateAttributesMapping:H})},"FieldControl"));var fe=E(k(),1);var Ft=E(ae(),1);var yt=t(function(e){let{children:o}=e,{validityData:s,invalid:c}=Y(!1),d=fe.useMemo(()=>le(s,c),[s,c]),l=d.state.valid===!1,{transitionStatus:R}=Ce(l),f=fe.useMemo(()=>({...d,validity:d.state,transitionStatus:R}),[d,R]);return(0,Ft.jsx)(fe.Fragment,{children:o(f)})},"FieldValidity");var Se=E(k(),1);var je=E(ae(),1);var It=Se.forwardRef(t(function(e,o){let{render:s,className:c,style:d,disabled:l=!1,...R}=e,{state:f,disabled:u}=Y(!1),a=u||l,b={...f,disabled:a},C=Se.useMemo(()=>({disabled:a}),[a]),g=J("div",e,{ref:o,state:b,props:R,stateAttributesMapping:H});return(0,je.jsx)(Ve,{children:(0,je.jsx)(ke.Provider,{value:C,children:g})})},"FieldItem"));var Vt=E(ae(),1);var Be=Et.forwardRef(t(function(e,o){return(0,Vt.jsx)(Te.Control,{ref:o,...e})},"Input"));var Dt=E(ae(),1);function Pi(r){let e=(0,ht.c)(10),o,s,c;e[0]!==r?({className:o,type:c,...s}=r,e[0]=r,e[1]=o,e[2]=s,e[3]=c):(o=e[1],s=e[2],c=e[3]);let d;e[4]!==o?(d=ze("h-8 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",o),e[4]=o,e[5]=d):d=e[5];let l;return e[6]!==s||e[7]!==d||e[8]!==c?(l=(0,Dt.jsx)(Be,{type:c,"data-slot":"input",className:d,...s}),e[6]=s,e[7]=d,e[8]=c,e[9]=l):l=e[9],l}t(Pi,"m");export{H as a,Y as b,Z as c,U as d,st as e,dt as f,Ne as g,xt as h,Pi as i};
@@ -0,0 +1 @@
1
+ import{a as pe,d as ne,e as kt,f as me}from"./chunk-NRP22GKC.js";import{a as de,b as Ut}from"./chunk-UC7MNI2F.js";import{D as gt,b as ie,c as fe,e as Lt,f as ue}from"./chunk-MVWZMWPD.js";import{a as ht,c as lt}from"./chunk-AUAECCXB.js";import{c as At,j as X}from"./chunk-BOMPSVRC.js";import{a as o,c as Ge,d as O,e as Q,f as Ke,g as _t,i as oe}from"./chunk-I26MS5PJ.js";var je=O(Ke(),1);var at={};Ge(at,{Content:()=>Le,Corner:()=>Fe,Root:()=>ye,Scrollbar:()=>_e,Thumb:()=>ke,Viewport:()=>We});var s=O(Q(),1);var $t=O(Q(),1);var le=$t.createContext(void 0);function j(){let e=$t.useContext(le);if(e===void 0)throw new Error(At(53));return e}o(j,"useScrollAreaRootContext");function I(e,t,l){if(!e)return 0;let v=getComputedStyle(e),g=`${t}${l==="x"?"Inline":"Block"}`,p=parseFloat(v[`${g}Start`]);return l==="x"&&t==="margin"?p*2:p+parseFloat(v[`${g}End`])}o(I,"getOffset");var he="data-has-overflow-x",Se="data-has-overflow-y",xe="data-overflow-x-start",be="data-overflow-x-end",Re="data-overflow-y-start",we="data-overflow-y-end";var Et=o(e=>t=>t?{[e]:""}:null,"attr"),st={hasOverflowX:Et(he),hasOverflowY:Et(Se),overflowXStart:Et(xe),overflowXEnd:Et(be),overflowYStart:Et(Re),overflowYEnd:Et(we),cornerHidden:o(()=>null,"cornerHidden")};var Ft="--scroll-area-corner-height",jt="--scroll-area-corner-width";var Ae="data-orientation";var Ee=O(_t(),1);var Je={x:0,y:0},ge={width:0,height:0},Qe={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},tr={x:!0,y:!0,corner:!0},ye=s.forwardRef(o(function(t,l){let{render:v,className:g,overflowEdgeThreshold:p,style:x,...c}=t,{xStart:m,xEnd:b,yStart:E,yEnd:P}=er(p),_=ie(),y=gt(),T=gt(),{nonce:L,disableStyleElements:U}=me(),[it,k]=s.useState(!1),[B,tt]=s.useState(!1),[et,rt]=s.useState(!1),[ft,M]=s.useState(!1),[xt,d]=s.useState(!1),[$,G]=s.useState(ge),[bt,ut]=s.useState(ge),[R,ot]=s.useState(Qe),[H,h]=s.useState(tr),K=s.useRef(null),n=s.useRef(null),a=s.useRef(null),f=s.useRef(null),u=s.useRef(null),S=s.useRef(null),F=s.useRef(null),A=s.useRef(null),C=s.useRef(0),N=s.useRef(0),Z=s.useRef(0),dt=s.useRef(0),D=s.useRef("vertical"),Y=s.useRef(Je),W=s.useRef(null);function z(r){let i=r?rt:tt,w=r?y:T;i(!0),w.start(500,()=>{i(!1)})}o(z,"startScrolling");let q=lt(r=>{let i=r.x-Y.current.x,w=r.y-Y.current.y;Y.current=r,w!==0&&z(!0),i!==0&&z(!1)}),J=lt(()=>{let r=n.current;r&&W.current===null&&(W.current=r.style.scrollSnapType,r.style.scrollSnapType="none")}),Mt=lt(r=>{if(r.button!==0||A.current!==null&&(D.current==="vertical"?u.current:S.current)?.hasPointerCapture(A.current))return;A.current=r.pointerId,C.current=r.clientY,N.current=r.clientX,D.current=r.currentTarget.getAttribute(Ae);let i=n.current;i&&(Z.current=i.scrollTop,dt.current=i.scrollLeft,J()),(D.current==="vertical"?u.current:S.current)?.setPointerCapture(r.pointerId)}),yt=lt(r=>{if(r.pointerId!==A.current)return;A.current=null,(D.current==="vertical"?rt:tt)(!1),W.current!==null&&(n.current&&(n.current.style.scrollSnapType=W.current),W.current=null);let i=D.current==="vertical"?u.current:S.current;i?.hasPointerCapture(r.pointerId)&&i.releasePointerCapture(r.pointerId)}),Rt=lt(r=>{if(r.pointerId!==A.current)return;if(r.buttons%2===0){yt(r);return}let i=n.current;if(!i)return;let w=D.current==="vertical",nt=w?u.current:S.current,vt=w?a.current:f.current;if(!nt||!vt)return;let Dt=w?"y":"x",Yt=I(vt,"padding",Dt),Xt=I(nt,"margin",Dt),Pt=w?nt.offsetHeight:nt.offsetWidth,Ot=(w?vt.offsetHeight:vt.offsetWidth)-Pt-Yt-Xt,Wt=w?r.clientY-C.current:r.clientX-N.current,ee=Ot<=0?0:Wt/Ot,re=w?i.scrollHeight:i.scrollWidth,Tt=w?i.clientHeight:i.clientWidth,It=(w?Z.current:dt.current)+ee*(re-Tt);w?i.scrollTop=It:i.scrollLeft=It,r.preventDefault(),z(w)});function wt(r){M(r.pointerType==="touch")}o(wt,"handleTouchModalityChange");function pt(r){if(wt(r),r.pointerType!=="touch"){let i=Lt(K.current,r.target);k(i)}}o(pt,"handlePointerEnterOrMove");let mt=s.useMemo(()=>({scrolling:B||et,hasOverflowX:!H.x,hasOverflowY:!H.y,overflowXStart:R.xStart,overflowXEnd:R.xEnd,overflowYStart:R.yStart,overflowYEnd:R.yEnd,cornerHidden:H.corner}),[B,et,H.x,H.y,H.corner,R]),Ct={role:"presentation",onPointerEnter:pt,onPointerMove:pt,onPointerDown:wt,onPointerLeave(){k(!1)},style:{position:"relative",[Ft]:`${$.height}px`,[jt]:`${$.width}px`}},Ht=X("div",t,{state:mt,ref:[l,K],props:[Ct,c],stateAttributesMapping:st}),Qt=s.useMemo(()=>({handlePointerDown:Mt,handlePointerMove:Rt,handlePointerUp:yt,handleScroll:q,disableViewportSnap:J,cornerSize:$,setCornerSize:G,thumbSize:bt,setThumbSize:ut,hasMeasuredScrollbar:xt,setHasMeasuredScrollbar:d,touchModality:ft,cornerRef:F,scrollingX:B,scrollingY:et,hovering:it,setHovering:k,viewportRef:n,scrollbarYRef:a,scrollbarXRef:f,thumbYRef:u,thumbXRef:S,rootId:_,hiddenState:H,setHiddenState:h,overflowEdges:R,setOverflowEdges:ot,viewportState:mt,overflowEdgeThreshold:{xStart:m,xEnd:b,yStart:E,yEnd:P}}),[Mt,Rt,yt,q,J,$,bt,xt,ft,B,et,it,_,H,R,mt,m,b,E,P]);return(0,Ee.jsxs)(le.Provider,{value:Qt,children:[!U&&kt.getElement(L),Ht]})},"ScrollAreaRoot"));function er(e){let t=typeof e=="number"?{xStart:e,xEnd:e,yStart:e,yEnd:e}:e;return{xStart:Math.max(0,t?.xStart||0),xEnd:Math.max(0,t?.xEnd||0),yStart:Math.max(0,t?.yStart||0),yEnd:Math.max(0,t?.yEnd||0)}}o(er,"normalizeOverflowEdgeThreshold");var St=O(Q(),1);var Bt=O(Q(),1);var se=Bt.createContext(void 0);function Ce(){let e=Bt.useContext(se);if(e===void 0)throw new Error(At(55));return e}o(Ce,"useScrollAreaViewportContext");var Oe="--scroll-area-overflow-x-start",Te="--scroll-area-overflow-x-end",Ne="--scroll-area-overflow-y-start",Ve="--scroll-area-overflow-y-end";var Gt="--scroll-area-thumb-height",Kt="--scroll-area-thumb-width";var Xe=O(_t(),1);var Pe=[Oe,Te,Ne,Ve],De=!1;function or(){De||fe.engine.webkit||(typeof CSS<"u"&&"registerProperty"in CSS&&Pe.forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),De=!0)}o(or,"removeCSSVariableInheritance");var We=St.forwardRef(o(function(t,l){let{render:v,className:g,style:p,...x}=t,{viewportRef:c,scrollbarYRef:m,scrollbarXRef:b,thumbYRef:E,thumbXRef:P,cornerRef:_,cornerSize:y,setCornerSize:T,setThumbSize:L,rootId:U,setHiddenState:it,hiddenState:k,setHasMeasuredScrollbar:B,handleScroll:tt,touchModality:et,setHovering:rt,setOverflowEdges:ft,overflowEdgeThreshold:M,viewportState:xt}=j(),d=Ut(),$=St.useRef(!0),G=St.useRef([NaN,NaN,NaN,NaN]),bt=gt(),ut=gt(),R=lt(()=>{let n=c.current,a=m.current,f=b.current,u=E.current,S=P.current,F=_.current;if(!n)return;let A=n.scrollHeight,C=n.scrollWidth,N=n.clientHeight,Z=n.clientWidth,dt=n.scrollTop,D=n.scrollLeft,Y=G.current,W=Number.isNaN(Y[0]);if(Y[0]=N,Y[1]=A,Y[2]=Z,Y[3]=C,W&&B(!0),A===0||C===0)return;let z=nr(n),q=z.y,J=z.x,Mt=Z/C,yt=N/A,Rt=Math.max(0,C-Z),wt=Math.max(0,A-N),pt=0,mt=0;J||(pt=ne(d==="rtl"?-D:D,Rt),mt=Rt-pt);let Ct=q?0:ne(dt,wt),Ht=q?0:wt-Ct,Qt=J?0:Z,r=q?0:N,i=0,w=0;!J&&!q&&(i=a?.offsetWidth||0,w=f?.offsetHeight||0);let nt=y.width===0&&y.height===0,vt=nt?i:0,Dt=nt?w:0,Yt=I(f,"padding","x"),Xt=I(a,"padding","y"),Pt=I(S,"margin","x"),te=I(u,"margin","y"),Ot=Qt-Yt-Pt,Wt=r-Xt-te,ee=f?Math.min(f.offsetWidth-vt,Ot):Ot,re=a?Math.min(a.offsetHeight-Dt,Wt):Wt,Tt=Math.max(16,ee*Mt),zt=Math.max(16,re*yt);if(L(V=>Zt(V,{width:Tt,height:zt})),a&&u){let V=a.offsetHeight-zt-Xt-te,Nt=Ye(u,Gt,dt,wt,A,zt,V);u.style.transform=`translate3d(0,${Nt}px,0)`}if(f&&S){let V=f.offsetWidth-Tt-Yt-Pt,Nt=d==="rtl"?-D:D,ce=Ye(S,Kt,Nt,Rt,C,Tt,V);S.style.transform=`translate3d(${d==="rtl"?-ce:ce}px,0,0)`}let It=[pt,mt,Ct,Ht];Pe.forEach((V,Nt)=>{n.style.setProperty(V,`${It[Nt]}px`)}),F&&T(V=>Zt(V,{width:i,height:w})),it(V=>Zt(V,z));let Be={xStart:!J&&pt>M.xStart,xEnd:!J&&mt>M.xEnd,yStart:!q&&Ct>M.yStart,yEnd:!q&&Ht>M.yEnd};ft(V=>Zt(V,Be))});ht(()=>{or()},[]),ht(()=>{queueMicrotask(R)},[R,k,d,M.xStart,M.xEnd,M.yStart,M.yEnd]),ht(()=>{c.current?.matches(":hover")&&rt(!0)},[c,rt]),ht(()=>{let n=c.current;if(typeof ResizeObserver>"u"||!n)return;let a=!1,f=new ResizeObserver(()=>{if(!a){a=!0;let u=G.current;if(u[0]===n.clientHeight&&u[1]===n.scrollHeight&&u[2]===n.clientWidth&&u[3]===n.scrollWidth)return}R()});return f.observe(n),ut.start(0,()=>{let u=n.getAnimations({subtree:!0});u.length!==0&&Promise.allSettled(u.map(S=>S.finished)).then(R).catch(()=>{})}),()=>{f.disconnect(),ut.clear()}},[R,c,ut]);function ot(){$.current=!1}o(ot,"handleUserInteraction");let H={role:"presentation",...U&&{"data-id":`${U}-viewport`},tabIndex:k.x&&k.y?-1:0,className:kt.className,style:{overflow:"scroll"},onScroll(){c.current&&(R(),(et||!$.current)&&tt({x:c.current.scrollLeft,y:c.current.scrollTop}),bt.start(100,()=>{$.current=!0}))},onWheel:ot,onPointerMove:ot,onPointerEnter:ot,onKeyDown:ot},h=X("div",t,{ref:[l,c],state:xt,props:[H,x],stateAttributesMapping:st}),K=St.useMemo(()=>({computeThumbPosition:R}),[R]);return(0,Xe.jsx)(se.Provider,{value:K,children:h})},"ScrollAreaViewport"));function nr(e){let t=e.clientHeight>=e.scrollHeight,l=e.clientWidth>=e.scrollWidth;return{y:t,x:l,corner:t||l}}o(nr,"getHiddenState");function Zt(e,t){for(let l in t)if(e[l]!==t[l])return t;return e}o(Zt,"pickState");function Ye(e,t,l,v,g,p,x){let c=pe(l,0,v),m=l-c,b=Math.max(16,p*g/(g+Math.abs(m)));return e.style.setProperty(t,m?`${b}px`:""),(v?c/v*x:0)+(m>0?p-b:0)}o(Ye,"applyOverscrollThumb");var Jt=O(Q(),1);var qt=O(Q(),1);var ae=qt.createContext(void 0);function ze(){let e=qt.useContext(ae);if(e===void 0)throw new Error(At(54));return e}o(ze,"useScrollAreaScrollbarContext");var Ie=O(_t(),1);var _e=Jt.forwardRef(o(function(t,l){let{render:v,className:g,orientation:p="vertical",keepMounted:x=!1,style:c,...m}=t,{hovering:b,scrollingX:E,scrollingY:P,hiddenState:_,scrollbarYRef:y,scrollbarXRef:T,viewportRef:L,thumbYRef:U,thumbXRef:it,handlePointerDown:k,handlePointerUp:B,handleScroll:tt,disableViewportSnap:et,rootId:rt,thumbSize:ft,hasMeasuredScrollbar:M,viewportState:xt}=j(),d=p==="vertical",$={...xt,hovering:b,scrolling:d?P:E,orientation:p},G=Ut(),bt=!M&&!x,ut=d?_.y:_.x,R=x||!ut;Jt.useEffect(()=>{if(!R)return;let h=L.current,K=d?y.current:T.current;if(!K)return;function n(a){if(!h||a.ctrlKey)return;let f=!d,u=f?"scrollLeft":"scrollTop",S=f?a.deltaX:a.deltaY;if(S===0)return;let F=f?h.scrollWidth-h.clientWidth:h.scrollHeight-h.clientHeight,A=f&&G==="rtl"?-F:0,C=f&&G==="rtl"?0:F,N=h[u];N<=A&&S<0||N>=C&&S>0||(a.preventDefault(),h[u]=Math.min(C,Math.max(A,N+S)),tt({x:h.scrollLeft,y:h.scrollTop}))}return o(n,"handleWheel"),de(K,"wheel",n,{passive:!1})},[G,tt,d,T,y,R,L]);let ot={...rt&&{"data-id":`${rt}-scrollbar`},"aria-hidden":!0,onPointerDown(h){if(h.button!==0)return;let K=ue(h.nativeEvent),n=d?U.current:it.current;if(n&&Lt(n,K))return;let a=L.current;if(!a)return;let f=d?y.current:T.current;if(!n||!f)return;let u=d?"y":"x",S=I(n,"margin",u),F=I(f,"padding",u),A=d?n.offsetHeight:n.offsetWidth,C=f.getBoundingClientRect(),N=d?h.clientY-C.top-A/2-F+S/2:h.clientX-C.left-A/2-F+S/2,Z=d?a.scrollHeight:a.scrollWidth,dt=d?a.clientHeight:a.clientWidth,Y=(d?f.offsetHeight:f.offsetWidth)-A-F-S;if(Y<=0)return;let W=N/Y,z=Z-dt;et(),d?a.scrollTop=W*z:G==="rtl"?a.scrollLeft=-(1-W)*z:a.scrollLeft=W*z,tt({x:a.scrollLeft,y:a.scrollTop}),k(h)},onMouseDown(h){h.preventDefault()},onPointerUp:B,onPointerCancel:B,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",visibility:bt?"hidden":void 0,...d?{top:0,bottom:`var(${Ft})`,insetInlineEnd:0,[Gt]:`${ft.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(${jt})`,bottom:0,[Kt]:`${ft.width}px`}}},H=X("div",t,{ref:[l,d?y:T],state:$,props:[ot,m],stateAttributesMapping:st});return R?(0,Ie.jsx)(ae.Provider,{value:p,children:H}):null},"ScrollAreaScrollbar"));var Vt=O(Q(),1);var Le=Vt.forwardRef(o(function(t,l){let{render:v,className:g,style:p,...x}=t,{computeThumbPosition:c}=Ce(),{hasMeasuredScrollbar:m,viewportState:b}=j(),E=Vt.useRef(null),P=Vt.useRef(m);return ht(()=>{if(typeof ResizeObserver>"u")return;let y=!1,T=new ResizeObserver(()=>{!y&&(y=!0,!P.current)||c()});return E.current&&T.observe(E.current),()=>{T.disconnect()}},[c]),X("div",t,{ref:[l,E],state:b,stateAttributesMapping:st,props:[{role:"presentation",style:{minWidth:"fit-content"}},x]})},"ScrollAreaContent"));var Ue=O(Q(),1);var ke=Ue.forwardRef(o(function(t,l){let{render:v,className:g,style:p,...x}=t,{thumbYRef:c,thumbXRef:m,handlePointerDown:b,handlePointerMove:E,handlePointerUp:P,scrollingX:_,scrollingY:y,hasMeasuredScrollbar:T}=j(),L=ze(),U=L==="vertical";return X("div",t,{ref:[l,U?c:m],state:{scrolling:U?y:_,orientation:L},props:[{onPointerDown:b,onPointerMove:E,onPointerUp:P,onPointerCancel:P,style:{visibility:T?void 0:"hidden",...U?{height:"var(--scroll-area-thumb-height)"}:{width:"var(--scroll-area-thumb-width)"}}},x]})},"ScrollAreaThumb"));var $e=O(Q(),1);var Fe=$e.forwardRef(o(function(t,l){let{render:v,className:g,style:p,...x}=t,{cornerRef:c,cornerSize:m,hiddenState:b}=j(),E=X("div",t,{ref:[l,c],props:[{"aria-hidden":!0,style:{position:"absolute",bottom:0,insetInlineEnd:0,width:m.width,height:m.height}},x]});return b.corner?null:E},"ScrollAreaCorner"));var ct=O(_t(),1);function No(e){let t=(0,je.c)(14),l,v,g;t[0]!==e?({className:v,children:l,...g}=e,t[0]=e,t[1]=l,t[2]=v,t[3]=g):(l=t[1],v=t[2],g=t[3]);let p;t[4]!==v?(p=oe("relative",v),t[4]=v,t[5]=p):p=t[5];let x;t[6]!==l?(x=(0,ct.jsx)(at.Viewport,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:l}),t[6]=l,t[7]=x):x=t[7];let c,m;t[8]===Symbol.for("react.memo_cache_sentinel")?(c=(0,ct.jsx)(lr,{}),m=(0,ct.jsx)(at.Corner,{}),t[8]=c,t[9]=m):(c=t[8],m=t[9]);let b;return t[10]!==g||t[11]!==p||t[12]!==x?(b=(0,ct.jsxs)(at.Root,{"data-slot":"scroll-area",className:p,...g,children:[x,c,m]}),t[10]=g,t[11]=p,t[12]=x,t[13]=b):b=t[13],b}o(No,"z");function lr({className:e,orientation:t="vertical",...l}){return(0,ct.jsx)(at.Scrollbar,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:oe("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-s data-vertical:border-s-transparent",e),...l,children:(0,ct.jsx)(at.Thumb,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-md bg-border"})})}o(lr,"h");export{No as a};
@@ -0,0 +1 @@
1
+ import{a as d,d as o,f as c,g as b,i as s}from"./chunk-I26MS5PJ.js";var l=o(c(),1);var u=o(b(),1);function p(n){let i=(0,l.c)(8),r,e;i[0]!==n?({className:r,...e}=n,i[0]=n,i[1]=r,i[2]=e):(r=i[1],e=i[2]);let t;i[3]!==r?(t=s("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-2.5 py-2 text-xs transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",r),i[3]=r,i[4]=t):t=i[4];let a;return i[5]!==e||i[6]!==t?(a=(0,u.jsx)("textarea",{"data-slot":"textarea",className:t,...e}),i[5]=e,i[6]=t,i[7]=a):a=i[7],a}d(p,"b");export{p as a};
@@ -0,0 +1,15 @@
1
+ import{a}from"./chunk-I26MS5PJ.js";var r="https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/",n="https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-1xxx-errors/",f=/string or blob too big/iu,l={BAD_REQUEST:{status:400,title:"Bad request"},UNAUTHORIZED:{status:401,title:"Unauthorized"},FORBIDDEN:{status:403,title:"Forbidden"},NOT_FOUND:{status:404,title:"Not found"},DELIVERY_FENCED:{status:409,title:"Delivery authorization changed",hint:"The operation may have committed. Retry with the same transport key; a committed result from an older authority epoch returns DELIVERY_RECEIPT_FENCED. Do not automatically retry with a new transport key."},DELIVERY_RECEIPT_FENCED:{status:409,title:"Committed receipt authorization changed",hint:"The operation committed, but its stored result belongs to an older authority epoch. Do not automatically retry with a new transport ID. Recover through the application's durable operation key under current authorization."},CONFLICT:{hint:["Another write changed this row while your mutation was running (optimistic concurrency conflict).","","Re-read the row and retry the mutation with the fresh value. Lunora serializes a DO's mutations, so a persistent conflict usually means the handler conflicts **with itself** (e.g. a trigger or cascade touching the same row) \u2014 split that work rather than adding a retry loop."],status:409,title:"Conflict"},NOT_UNIQUE:{hint:["`.unique()` matched more than one document \u2014 it expects the query to identify at most one row.","","- If several matches are legitimate, use `.first()` (take one) or `.collect()` (take all) instead.","- Otherwise tighten the query (e.g. filter on a unique/indexed field) so it can only match one row."],status:400,title:"Query matched more than one document"},VALIDATION_ERROR:{status:400,title:"Validation failed"},TOO_MANY_REQUESTS:{status:429,title:"Too many requests"},UNPROCESSABLE:{status:422,title:"Unprocessable"},NOT_IMPLEMENTED:{status:501,title:"Not implemented"},FUNCTION_NOT_FOUND:{status:404,title:"Function not found"},METHOD_NOT_ALLOWED:{status:405,title:"Method not allowed"},PAYLOAD_TOO_LARGE:{status:413,title:"Payload too large"},INTERNAL:{internal:!0,status:500,title:"Internal error"},INTERNAL_SERVER_ERROR:{internal:!0,status:500,title:"Internal error"},RPC_FAILED:{internal:!0,status:500,title:"Internal error"},COUNT_RLS_UNSUPPORTED:{status:422,title:"count() is unsupported under an RLS policy"},MASK_UNSUPPORTED:{status:422,title:"Aggregation over a masked column is unsupported"},RELATION_PREDICATE_UNSUPPORTED:{status:422,title:"Relation predicate is unsupported in a write policy"},RLS_REQUIRED:{hint:["This table is secure-by-default: it has no `.public()` marker and no RLS policy resolved for the caller, so the read fails closed.","","Add a read policy with `.rls(...)`, or mark the table `.public()` if it is intentionally world-readable."],status:403,title:"RLS policy required"},RUN_DEPTH_EXCEEDED:{internal:!0,status:500,title:"Run depth exceeded"},RUN_KIND_FORBIDDEN:{status:500,title:"Function kind may not be composed from a query"},TRANSACTION_LIMIT_EXCEEDED:{hint:["A single mutation may only read and write a bounded amount before it is stopped.","","Narrow the read with an index (`.withIndex(...)`) instead of scanning the table, or split the write across several mutations \u2014 for a large backfill use `defineMigration` + `lunora migrate up`, which batches and checkpoints for you.","","The ceilings are deliberately conservative \u2014 they exist to stop one request taking down the whole shard. A deployment that genuinely needs bigger transactions can raise them by overriding the `transactionLimits()` seam on its generated shard class."],status:413,title:"Transaction limit exceeded"},MIGRATION_NOT_FOUND:{status:404,title:"Data migration not found"},MIGRATION_DRIFT:{hint:["An applied SQL migration is never re-run, so the runner stopped before applying anything.","","- **Its text changed after it ran:** revert the edit and put the change in a new migration. If the edit is inert (a comment, whitespace, line endings), record the new hash with the `UPDATE` the message prints.","- **Tracking rows predate versions and match no migration:** set each row's `version` with the `UPDATE` the message prints, so the runner can tell what already ran."],status:409,title:"Migration drift"},UNKNOWN_TABLE:{status:404,title:"Unknown table"},GLOBAL_TABLE_NOT_EDITABLE:{status:400,title:"Global table is not editable"},SHARD_ERROR:{status:503,title:"Shard error"},SHARD_UNAVAILABLE:{status:503,title:"Shard unavailable"},SHARD_TIMEOUT:{status:504,title:"Shard timeout"},SHARD_HTTP_ERROR:{status:502,title:"Shard HTTP error"},SUBSCRIPTION_PERSIST_FAILED:{status:500,title:"Subscription persist failed"},TOO_MANY_SUBSCRIPTIONS:{status:429,title:"Too many subscriptions"},OFFLINE_IDENTITY_CHANGED:{status:409,title:"Offline identity changed"},IDENTITY_MISMATCH:{hint:["A write queued offline was replayed on a session that now belongs to someone else (a sign-out, or another user's sign-in, while it waited), so the worker refused it rather than commit it as them.","","`@lunora/client` re-resolves the session on this refusal and settles the write itself. If every replay is refused while the same user stays signed in, your worker's `resolveIdentity` returns a different `userId` than better-auth's `user.id`, or the RPC request carries no session cookie."],status:409,title:"Session changed since the write was queued"},CODEGEN_DIAGNOSTIC:{status:500,title:"Codegen diagnostic"},JURISDICTION_MOVE:{hint:["The schema declares `.jurisdiction(...)` and the project has DO-backed auth (`.auth({ namespace })`). Pinning the auth object to the jurisdiction resolves it to a new, empty one: every user, account and session stays in the unpinned object until copied across. Voice sessions are pinned without an acknowledgement: they store nothing, and their transcripts are rows in the already-pinned shards.","",'Acknowledge with `.jurisdiction("eu", { pinAuth: true })` and deploy, then copy the auth tables across with the `__lunora_admin__:copyAuthToJurisdiction` admin op and, once the counts check out, purge the unpinned copy with `__lunora_admin__:purgeUnpinnedAuth` (see [Pinning auth and voice](/docs/concepts/data-residency#pinning-auth-and-voice)). For D1-mode auth the acknowledgement changes nothing.'],status:422,title:"Unacknowledged jurisdiction move"},SCHEMA_SNAPSHOT_PARSE:{status:500,title:"Schema snapshot parse error"},ENV_INVALID:{internal:!0,status:500,title:"Invalid environment"},X402_FACILITATOR_ERROR:{internal:!0,status:502,title:"Payment facilitator error"},AUTH_HEADERS_MISSING:{internal:!0,status:500,title:"Auth headers missing"},PRIVACY_COVERAGE:{status:500,title:"Privacy coverage check failed"},PRIVACY_REQUEST_OPEN:{status:409,title:"A privacy request is already open"},PRIVACY_SESSION_NOT_FRESH:{status:403,title:"Recent sign-in required"},EMAIL_DOMAIN_BLOCKED:{hint:["This address's domain is on the disposable/throwaway blocklist (or your configured deny-list).","","Sign up with a permanent mailbox. To tune the policy, pass `blockDisposable` / `allowDomains` / `denyDomains` in the `EmailGateConfig` you hand `assertEmailAllowed` / `classifyEmail` / `emailGateMiddleware` (`@lunora/auth/email-guard`)."],status:400,title:"Email domain not allowed"},EMAIL_UNDELIVERABLE:{hint:["The address's domain publishes no MX (or fallback A/AAAA) records, so it can't receive mail.","","Check for a typo in the domain. MX verification is opt-in (`mx: true`) and needs DNS \u2014 leave it off on the edge path if DNS is unavailable."],status:400,title:"Email domain cannot receive mail"},ANALYTICS_SQL_QUERY_ERROR:{status:502,title:"Analytics SQL query error"},BROWSER_RUN_ERROR:{status:502,title:"Browser Run API error"},BROWSER_TOO_MANY_REDIRECTS:{status:502,title:"Too many redirects"},R2_SQL_ERROR:{status:502,title:"R2 SQL API error"},WORKFLOWS_REST_ERROR:{status:502,title:"Cloudflare Workflows REST API error"},CONFIG_INVALID:{internal:!0,status:500,title:"Payment configuration invalid"},CURRENCY_MISMATCH:{status:400,title:"Currency mismatch"},PROVIDER_ERROR:{status:502,title:"Payment provider error"},WEBHOOK_EVENT_ID_MISSING:{status:400,title:"Webhook event id missing"},WEBHOOK_SIGNATURE_INVALID:{status:400,title:"Webhook signature invalid"},WEBHOOK_TIMESTAMP_INVALID:{status:400,title:"Webhook timestamp outside tolerance"},ADMIN_FORBIDDEN:{status:403,title:"Admin access forbidden"},ADMIN_TOKEN_NOT_CONFIGURED:{status:400,title:"Admin token not configured"},AUTH_MIGRATOR_UNSUPPORTED:{hint:["better-auth migrates only through its Kysely adapter, so `ensureMigrated` / `compileMigrationsSql` need the raw D1 binding as `database` \u2014 a custom adapter (`lunoraD1Adapter`, `lunoraAuthAdapter`, `lunoraDoAdapter`) cannot be migrated through, and neither can an absent `database`.","","Build a SECOND, migration-only instance over the raw binding \u2014 `createMigrationAuth({ ...options, database: env.DB })` (from `@lunora/auth/migrate`) \u2014 and hand that one to `ensureMigrated`. Keep the adapter on the instance that serves requests: the adapter exists to dodge a dev-runner hang in `$context`, which the migration instance never resolves.","","To compile the SQL off-platform (`compileMigrationsSql`), diff against an empty local database \u2014 `new DatabaseSync(':memory:')` from `node:sqlite` \u2014 rather than passing no `database` at all."],status:500,title:"Auth migrator cannot drive the configured database"},AUTH_NOT_CONFIGURED:{status:400,title:"Auth admin not configured"},AUTH_OP_NOT_SUPPORTED:{status:400,title:"Auth admin operation not supported"},AUTH_CIMD_FETCH_NOT_PUBLIC:{hint:'Add "global_fetch_strictly_public" to "compatibility_flags" in wrangler.jsonc, so CIMD metadata fetches cannot reach private addresses. `lunora doctor` reports it as `cimd-fetch-not-strictly-public`.',status:500,title:"CIMD transport needs the global_fetch_strictly_public flag"},AUTH_MCP_RESOURCE_AMBIGUOUS:{hint:'Use `mcp` from "@lunora/auth/plugins" (not `@better-auth/mcp`) and pass the plugin object as is: it records its `resource`, which the worker needs to serve the protected-resource metadata when the provider names several resources.',status:500,title:"MCP resource cannot be told apart from the provider's other resources"},AUTH_MCP_RESOURCE_INVALID:{hint:"Pass `resource` to `requireMcpAuth` (and `mcp()`) as the absolute URL of the MCP route, e.g. `https://app.example.com/mcp`: issued tokens are audience-bound to it.",status:500,title:"MCP resource missing or not an absolute URL"},MCP_STEP_UP_MISCONFIGURED:{hint:"Give `createAuthedMcpFetchHandler`'s `stepUp` a non-empty `scope` (such as `lunora:write`) and a `challenge` (`createInsufficientScopeError` from `@lunora/auth/plugins`), or leave `stepUp` out.",status:500,title:"MCP step-up misconfigured"},BACKUP_NOT_CONFIGURED:{status:500,title:"Scheduled backup not configured"},BACKUP_RETENTION_NOT_CONFIGURED:{hint:["`lunora backup prune` removes snapshots past the retention window, and this worker has no window: set `backupRetain` (how many to keep) and `backupCron` (which decides whose snapshots retention owns) on `createWorker`.","","Nothing was deleted. A default is deliberately not invented here \u2014 retention deleting on its own is exactly what this command exists to replace."],status:400,title:"Backup retention window not configured"},BACKUP_TOO_LARGE:{hint:["The scheduled backup is assembled inside the Worker isolate, so it caps the snapshot it will build. Nothing was written.","","The cap is on the NDJSON, not on peak memory: the export fan-out resolves every shard's rows before the first row is encoded, so a snapshot under the cap can still exhaust the isolate. It is set well below the isolate's limit for that reason.","","Narrow the snapshot with `backupTables`, or take this backup off-platform with `lunora backup create --bucket`, which runs on a machine rather than in an isolate. Backing up more often does not help \u2014 every run is a full snapshot."],status:507,title:"Backup too large to assemble in a Worker"},CRON_JOBS_NOT_CONFIGURED:{status:400,title:"Cron jobs not configured"},CRON_JOB_NOT_FOUND:{status:404,title:"Cron job not found"},EXPORT_SHARD_FAILED:{hint:["One or more shards failed to export, so the snapshot would have been short. Nothing is written when this fires \u2014 a partial export must never be mistaken for a complete one.","","The message names each failed shard key and its error. Re-run the export once those shards are reachable; a shard that fails repeatedly is usually over the per-request memory budget, which `backupTables` narrows."],status:502,title:"Export failed on one or more shards"},EXPORT_TAP_NOT_CONFIGURED:{status:400,title:"Export tap not configured"},FUNCTIONS_NOT_CONFIGURED:{status:400,title:"Functions registry not configured"},GLOBALS_NOT_CONFIGURED:{status:400,title:"Global-table introspector not configured"},ID_COLLISION:{hint:["The imported row carries an `_id` that is already held by a DIFFERENT table in this shard. Ids are per-table, so inserting it would leave two tables claiming one id and make a later lookup resolve to whichever one it reached first.","","This is reported per row rather than aborting the import: the remaining rows still apply. Re-mint the id on the source side, or import that table into a shard that does not already hold it."],status:409,title:"Document id already belongs to another table"},KV_NOT_CONFIGURED:{status:400,title:"KV introspector not configured"},MIGRATION_ID_REQUIRED:{status:400,title:"Migration id required"},PITR_UNAVAILABLE:{status:409,title:"Point-in-time recovery unavailable"},SCHEDULER_NOT_CONFIGURED:{status:400,title:"Scheduler not configured"},STORAGE_CHECKSUM_MISMATCH:{hint:["The upload body did not match the declared `expectedSize` or `expectedSha256`, so nothing was written \u2014 this check fails closed.","","Re-read the bytes from the source export and retry the transfer. A persistent mismatch means the source blob is corrupt or truncated; fix the export rather than bypassing the check."],status:400,title:"Storage checksum mismatch"},STORAGE_DELETE_NOT_CONFIGURED:{status:400,title:"Storage delete not configured"},STORAGE_DOWNLOAD_NOT_CONFIGURED:{hint:["`GET /_lunora/admin/storage/object` needs a `storageDownload` function on the worker. The generated app worker wires it up; a hand-written `createWorker({ ... })` has to pass `(key, opts) => pick(opts?.bucket).download(key)` \u2014 forwarding `opts.bucket` to the right bucket, and wrapping rather than passing `createStorage(...).download` itself, whose second parameter is a byte range.","","Without it a bucket-backed `lunora backup restore --bucket` cannot read the snapshot. The object is still readable out of band with `wrangler r2 object get`."],status:400,title:"Storage download not configured"},STORAGE_NOT_CONFIGURED:{status:400,title:"Storage not configured"},STORAGE_OBJECT_NOT_FOUND:{status:404,title:"Storage object not found"},STORAGE_UPLOAD_NOT_CONFIGURED:{status:400,title:"Storage upload not configured"},STORAGE_URL_NOT_CONFIGURED:{status:400,title:"Storage signed URL not configured"},AI_UNKNOWN_IMAGE_MODEL:{status:400,title:"Unknown image model"},RAG_DIMENSION_MISMATCH:{hint:["A stored vector and the query embedding have different widths, so they cannot be compared.","","This is what changing a RAG index's `embeddingModel` (or a provider's `dimensions` option) without reindexing looks like. Either put the previous model back, or reindex the namespace under the new one \u2014 bump `embeddingModelVersion` so the index rebuilds instead of mixing widths."],status:409,title:"Embedding dimension mismatch"},VECTORS_NOT_CONFIGURED:{status:400,title:"Vector index introspector not configured"},VECTOR_QUERY_UNSUPPORTED:{status:400,title:"Vector index querying not enabled"},WORKFLOWS_NOT_CONFIGURED:{status:501,title:"Workflows not configured"},AUTH_AUDIT_NOT_CONFIGURED:{status:400,title:"Auth audit reader not configured"},AUTH_AUDIT_READ_FAILED:{internal:!0,status:500,title:"Auth audit read failed"},AUTH_MOVE_NOT_CONFIGURED:{hint:"The copy needs DO-backed auth (`.auth({ namespace })`) pinned with `.jurisdiction(\u2026, { pinAuth: true })`, and the auth object's `internalSecret` set.",status:400,title:"Auth jurisdiction move not configured"},AUTH_MOVE_TARGET_NOT_EMPTY:{hint:"The pinned auth object holds users the copy did not write (someone signed up there), so copying into it would merge two user bases. Pass `force: true` to copy anyway: a copied row that collides with one of the pinned object's rows is left out and counted under `conflicts`.",status:409,title:"Pinned auth object is not empty"},AUTH_MOVE_CONFLICT:{hint:"A copied row has the same key or unique value (such as an email) as a row the pinned auth object holds on its own, or the pinned object changed a row the source changed too. Nothing from that page was written. Pass `force: true` to keep the pinned object's rows and count the collisions under `conflicts`.",status:409,title:"Auth copy conflict"},AUTH_MOVE_SOURCE_CHANGED:{hint:"The un-pinned auth object changed after the copy read it (an update, a delete, or a new row), for example during a gradual rollout or a rollback. Run the copy again: it reconciles the changed tables. Then purge.",status:409,title:"Un-pinned auth object changed since the copy"},AUTH_MOVE_SOURCE_PURGED:{hint:"The un-pinned auth object was already purged. Its tables may exist again (a rollback served requests there), but they hold only rows written since, so the copy refuses rather than read them as deletions and remove the pinned object's users. Nothing is left to copy.",status:409,title:"Un-pinned auth object already purged"},AUTH_MOVE_INCOMPLETE:{hint:"Run `__lunora_admin__:copyAuthToJurisdiction` until it answers `done: true`, check the per-table counts, then purge.",status:409,title:"Auth copy not finished"},AUTH_MOVE_FAILED:{hint:"The message names the step, the table and the class of the SQLite error; the auth object's log has the full error. The copy resumes where it stopped once the cause is fixed.",status:500,title:"Auth jurisdiction move failed"},CRON_EXPR_INVALID:{status:500,title:"Invalid cron expression"},CRON_EXPR_NOT_STATIC:{status:500,title:"Cron expression is not statically analyzable"},CRON_JOB_FAILED:{internal:!0,status:500,title:"Cron job failed"},CRON_NAME_NOT_STATIC:{status:500,title:"Cron job name is not statically analyzable"},CRON_NON_STATIC_FN:{status:500,title:"Cron function reference is not statically analyzable"},CRON_NON_STATIC_VALUE:{status:500,title:"Cron value is not statically analyzable"},CRON_SCHEDULE_INVALID:{status:500,title:"Invalid cron schedule"},CRON_SCHEDULE_NOT_STATIC:{status:500,title:"Cron schedule is not statically analyzable"},DUPLICATE_CRON_NAME:{status:500,title:"Duplicate cron job name"},DUPLICATE_AGENT_CLASS:{status:500,title:"Duplicate agent generated class name"},DUPLICATE_AGENT_NAME:{status:500,title:"Duplicate agent name"},DUPLICATE_MIGRATION_ID:{status:500,title:"Duplicate migration id"},DUPLICATE_QUEUE_BINDING:{status:500,title:"Duplicate queue binding"},DUPLICATE_QUEUE_NAME:{status:500,title:"Duplicate queue name"},DUPLICATE_ROOM_NAME:{status:500,title:"Duplicate room name"},ROOM_NAME_NOT_LITERAL:{status:500,title:"Room name is not a string literal"},DUPLICATE_SOCKET_PATH:{status:500,title:"Duplicate socket route path"},SOCKET_AUTH_NOT_LITERAL:{status:500,title:"Socket route auth is not a literal boolean"},SOCKET_PATH_INVALID:{status:500,title:"Socket route path is not a plain URL path"},SOCKET_PATH_NOT_LITERAL:{status:500,title:"Socket route path is not a string literal"},LIVE_STREAM_DUPLICATE:{status:500,title:"Duplicate live stream id or export name"},LIVE_STREAM_NOT_EXPORTED:{status:500,title:"Live stream is not a named export"},LIVE_STREAM_NOT_LITERAL:{status:500,title:"Live stream declaration is not a literal"},LIVE_TOPIC_INVALID:{status:500,title:"Live topic name or key field is not allowed"},DUPLICATE_WORKFLOW_CLASS:{status:500,title:"Duplicate workflow generated class name"},MIGRATION_ID_NOT_STATIC:{status:500,title:"Migration id is not statically analyzable"},NAMESPACE_COLLISION:{status:500,title:"Function namespace collision"},BAD_ROW:{status:400,title:"Malformed import row"},BAD_SUBSCRIPTION_ARGS:{status:400,title:"Invalid subscription arguments"},BATCH_LIMIT_EXCEEDED:{status:400,title:"Batch limit exceeded"},CROSS_SHARD_RANK_UNSUPPORTED:{status:400,title:"Cross-shard rank() is unsupported"},DISPATCH_UNAUTHENTICATED:{hint:"The scheduler could not authenticate to the worker. Check that `LUNORA_SCHEDULER_SECRET` matches on both sides, or that `LUNORA_ADMIN_TOKEN` is set and current.",status:403,title:"Dispatch caller not authenticated"},DISPATCH_IN_PROGRESS:{hint:"A dispatch with this idempotency id is still running on the shard. Retry it; once the first attempt settles the same id is served from the replay cache.",status:409,title:"Dispatch already in progress"},FORBIDDEN_FANOUT:{status:403,title:"Fan-out forbidden"},GLOBAL_SEARCH_SCORES_UNSUPPORTED:{status:400,title:"collectWithScores() is unsupported on a global table"},FORBIDDEN_ORIGIN:{status:403,title:"Origin forbidden"},FORBIDDEN_SHARD:{status:403,title:"Shard access forbidden"},FORBIDDEN_TOPIC:{status:403,title:"Live topic publish forbidden"},LIVE_CONTROL_SUPERSEDED:{status:409,title:"A later live control call already applied"},GLOBAL_NOT_CONFIGURED:{status:400,title:"Global table import not configured"},INVALID_INPUT:{status:400,title:"Invalid input"},INVALID_SCHEDULE_ID:{status:400,title:"Invalid schedule id"},RATE_LIMITED:{status:429,title:"Rate limited"},REPLICA_NOT_READY:{status:421,title:"Replica not caught up"},REPLICA_READ_ONLY:{status:421,title:"Replica is read-only"},SEARCH_INDEX_BUILDING:{status:503,title:"Search index is still building"},SERVICE_UNAVAILABLE:{status:503,title:"Service unavailable"},SHAPE_MEMORY_TABLE:{status:400,title:"Shape over a memory table is unsupported"},SHAPE_CROSS_SHARD_JOIN:{status:400,title:"Shape cross-shard join is unsupported"},SHAPE_RELATION_PREDICATE:{status:400,title:"Shape filtered by a relation is unsupported"},UNAUTHENTICATED:{status:401,title:"Unauthenticated"},WIRE_DECODE_FAILED:{status:502,title:"Could not decode a server frame"},WIRE_ENCODE_FAILED:{status:500,title:"Could not encode a return value"},UNKNOWN_COLUMN:{status:404,title:"Unknown column"},CDC_LOG_TRIMMED:{status:409,title:"CDC log trimmed"},CDC_TIMELINE_FORKED:{status:409,title:"CDC timeline forked"},CDC_PAYLOAD_COMPACTED:{status:409,title:"CDC payloads compacted"},EXPIRED:{status:404,title:"Session expired"},LIVE_CONNECTION_LIMIT:{status:503,title:"Live connection limit reached"},LIVE_CONNECTION_NOT_FOUND:{status:404,title:"Live connection not found"},LIVE_STREAMS_UNSUPPORTED:{status:501,title:"Live streams are not served by this worker"},NESTED_TRANSACTION:{internal:!0,status:500,title:"Nested transaction"},OUT_OF_ORDER:{status:409,title:"Out-of-order mutation"},SHAPE_GLOBAL_TOO_LARGE:{status:413,title:"Global shape too large"},SHAPE_NOT_FOUND:{status:404,title:"Shape not found"},SHAPE_REQUIRES_CDC:{status:409,title:"Shape requires change-data-capture"},SQL_UNAVAILABLE:{internal:!0,status:500,title:"SQL storage unavailable"},STREAM_ID_IN_USE:{status:409,title:"Stream id already in use"},STREAM_INTERRUPTED:{status:503,title:"Durable stream interrupted"},STREAM_TOO_LONG:{status:507,title:"Durable stream exceeded its chunk ceiling"},TOKEN_EXPIRED:{hint:["The caller's credential verified but its expiry has passed. The worker refuses an HTTP call with this code before it runs; a shard drops a socket with close code `4001` and the same code.","","It is a refusal of the credential, not of the call: `@lunora/client` holds a queued write, fires `onTokenExpired`, and re-sends it after `setAuthToken`. The held write survives the refresh only if you pass the same `subject` (the user id) with the new token, `setAuthToken(freshToken, user.id)`; without one a refresh reads as a user switch and the write is rejected `OFFLINE_IDENTITY_CHANGED`. Under a cookie session there is no token to replace: renew the cookie and the write is re-sent on a backoff. The worker can only tell expired from anonymous if your `resolveIdentity` returns the identity with its past `exp` (or `expiresAtMs`), or throws a `LunoraError` with this code. Returning `null` runs the call anonymous."],status:401,title:"Authentication token expired"},TOO_MANY_LIVE_TOPICS:{status:429,title:"Too many live topics"},TOO_MANY_STREAMS:{status:429,title:"Too many streams"},TOO_MANY_WHISPER_TOPICS:{hint:"Reuse a stable set of whisper topic names, or reconnect \u2014 the per-socket verdict memo is in-memory, so a new connection starts empty. Leaving a topic does not free its entry.",status:429,title:"Too many whisper topics"},UNKNOWN_ADMIN_OP:{status:404,title:"Unknown admin operation"},SOCKET_TAG_BUDGET_EXCEEDED:{status:400,title:"Socket tag budget exceeded"},RELAY_CANNOT_SEED:{status:500,title:"Relay cannot seed"},RELAY_MISCONFIGURED:{status:500,title:"Relay misconfigured"},RELAY_SEED_FAILED:{status:502,title:"Relay seed failed"},RELAY_SHAPE_UNROUTABLE:{status:500,title:"Relay shape unroutable"},MISCONFIGURED:{internal:!0,status:500,title:"Worker misconfigured"},LUNORA_RUNTIME_UNAVAILABLE:{status:500,title:"Lunora runtime unavailable"},INTERNAL_ERROR:{internal:!0,status:500,title:"Internal error"},BROWSER_TIMEOUT:{status:504,title:"Browser operation timed out"},CLIENT_CLOSED:{status:400,title:"Client is closed"},HTTP_STREAM_BAD_CHUNK:{status:502,title:"Malformed HTTP stream chunk"},HTTP_STREAM_CALLBACK:{status:500,title:"HTTP stream callback threw"},HTTP_STREAM_INTERRUPTED:{status:502,title:"HTTP stream interrupted"},HTTP_STREAM_MISSING_PARAM:{status:400,title:"HTTP stream missing path parameter"},HTTP_STREAM_NO_BODY:{status:502,title:"HTTP stream response has no body"},HTTP_STREAM_STATUS:{status:502,title:"HTTP stream request failed"},HTTP_STREAM_TRANSPORT:{status:502,title:"HTTP stream transport error"},STREAM_BACKPRESSURE:{status:429,title:"Stream backpressure"},STREAM_DISCONNECTED:{status:503,title:"Stream disconnected"},STREAM_QUEUE_OVERFLOW:{status:429,title:"Stream queue overflow"},UNKNOWN_MUTATION_FN:{status:404,title:"Unknown mutation function"},LOCAL_DEPENDENCY_MISSING:{hint:["The command Lunora tried to run is not on your PATH, so nothing ran.","","Install it (or put it on PATH) and retry \u2014 `wrangler` ships as a dependency of a Lunora app, so `pnpm install` usually fixes that one; `git` and `docker` are installed separately."],status:500,title:"Required local tool not found"}},c=a(e=>Object.hasOwn(l,e)?l[e]:void 0,"h");var m=[{body:["A single row exceeded the storage engine's per-row ceiling \u2014 2 MB on a Durable Object's SQLite, and 2,000,000 bytes on D1.","","The limit is on the STORED bytes, which are UTF-8: a document of multi-byte text (CJK, emoji) costs up to 3x its character count. `v.bytes()` and `v.bigint()` columns cost more again on a shard-local table, where the row stores both a SQL-comparable projection and the original.","","Keep the large payload out of the row and store a reference to it:","","```ts","const key = `uploads/${crypto.randomUUID()}`;","await ctx.storage.uploads.put(key, bytes);",'await ctx.db.insert("documents", { storageKey: key, title });',"```","","R2 has no practical object-size ceiling, and the row stays small enough to read, index, and replicate."].join(`
2
+ `),header:"Row too large for the storage engine",id:"lunora-row-too-big",test:a(e=>f.test(e),"test")},{body:["Lunora codegen couldn't find a schema to generate from.","","Create `lunora/schema.ts` exporting a `defineSchema(...)` call:","","```ts",'import { defineSchema, defineTable, v } from "@lunora/server";',"","export default defineSchema({"," messages: defineTable({ body: v.string() }),","});","```","","Or run `lunora init` to scaffold Lunora (a sample `lunora/schema.ts` included) into your app."].join(`
3
+ `),header:"No Lunora schema found",id:"lunora-schema-missing",test:a(e=>e.includes("defineSchema() not found")||e.includes("schema.ts not found at"),"test")},{body:["`defineSchema(...)` must be called with an **inline object literal** mapping table names to `defineTable(...)`:","","```ts","export default defineSchema({"," todos: defineTable({ title: v.string(), done: v.boolean() }),","});","```","","Codegen reads the schema statically, so it can't follow a variable or a spread \u2014 pass the object literal directly."].join(`
4
+ `),header:"`defineSchema()` needs an inline object literal",id:"lunora-schema-not-object-literal",test:a(e=>e.includes("defineSchema() expects an object literal"),"test")},{body:["This table name collides with a built-in `ctx.db` member, so the generated client can't expose it.","","Rename the table to anything that isn't a `ctx.db` member (the error names the one it hit) \u2014 e.g. `userAccounts` instead of `insert`, or `pageViews` instead of `count`."].join(`
5
+ `),header:"Table name is reserved",id:"lunora-table-reserved",test:a(e=>e.includes("is reserved")&&e.includes("ctx.db"),"test")},{body:["Two tables resolve to the same name \u2014 usually a base table and a schema **extension** both defining it.","","Rename one of them, or drop the duplicate from the extension. Each table name must be unique across `defineSchema(...)` and every `.extend(...)`."].join(`
6
+ `),header:"Duplicate table name",id:"lunora-table-duplicate",test:a(e=>e.includes("already exists")&&e.includes(".extend("),"test")},{body:['`.jurisdiction(...)` accepts only a **string literal** of `"eu"`, `"us"`, or `"fedramp"`:',"","```ts",'defineSchema({ /* \u2026 */ }).jurisdiction("eu");',"```"].join(`
7
+ `),header:"Invalid `.jurisdiction(...)` value",id:"lunora-jurisdiction",test:a(e=>e.includes("unknown jurisdiction")||e.includes("jurisdiction")&&e.includes('"eu", "us", or "fedramp"'),"test")},{body:["The `unique` flag on an index must be a **literal** `true` or `false`, not a computed value \u2014 codegen needs to read it statically:","","```ts",'defineTable({ email: v.string() }).index("by_email", ["email"], { unique: true });',"```"].join(`
8
+ `),header:"`unique` must be a literal",id:"lunora-unique-literal",test:a(e=>e.includes("must be a literal")&&e.includes("unique"),"test")},{body:["A declared container/workflow class isn't re-exported by your worker entry, so `wrangler deploy` would reject it.","","Add the generated re-export shown in the error to your worker entry (e.g. `src/index.ts`):","","```ts",'export * from "./lunora/_generated/containers";',"```"].join(`
9
+ `),header:"Binding not exported by your worker entry",id:"lunora-worker-entry-export-gap",test:a(e=>e.includes("not exported by your worker entry"),"test")},{body:["A row with the same value already exists in a `unique` index.","","- If you meant to upsert, use `ctx.db.<table>().upsert(...)` (or `.patch(...)` an existing row) instead of `.insert(...)`.",`- Otherwise pick a value that isn't already taken, and consider surfacing a friendly "already exists" message to the user.`].join(`
10
+ `),header:"Unique constraint violation",id:"lunora-runtime-unique",test:a(e=>e.includes("unique constraint violation on"),"test")},{body:l.CONFLICT.hint.join(`
11
+ `),header:"Optimistic concurrency conflict",id:"lunora-runtime-occ",test:a(e=>e.includes("optimistic concurrency conflict"),"test")}],u=[{causes:"the origin returned an empty, unknown, or malformed response Cloudflare couldn't interpret (often an origin crash or an oversized response header)",code:"520",docsUrl:r,family:"5xx",fix:"check your origin's logs for a crash, ensure it returns a valid HTTP response, and keep response headers under the size limit",summary:"Cloudflare got an unknown/empty response from your origin web server.",title:"Web server returns an unknown error"},{causes:"the origin refused the connection \u2014 the web server is down, or a firewall is blocking Cloudflare's IP ranges",code:"521",docsUrl:r,family:"5xx",fix:"confirm the origin process is running and allowlist Cloudflare's published IP ranges in your firewall/security groups",summary:"Cloudflare could not connect to your origin because it refused the connection.",title:"Web server is down"},{causes:"Cloudflare could not establish a TCP connection to the origin in time \u2014 the origin is overloaded, a firewall is dropping packets, or the origin IP is wrong",code:"522",docsUrl:r,family:"5xx",fix:"verify the origin is reachable and not overloaded, and that the DNS record points at the correct origin IP",summary:"The connection to your origin timed out before it was established.",title:"Connection timed out"},{causes:"Cloudflare cannot route to the origin at all \u2014 a bad DNS record, an origin IP that changed, or invalid routing",code:"523",docsUrl:r,family:"5xx",fix:"verify the DNS A/AAAA record points at a reachable origin IP and that no upstream network is blocking Cloudflare",summary:"Cloudflare could not reach your origin server.",title:"Origin is unreachable"},{causes:"Cloudflare made a TCP connection but the origin did not return an HTTP response within 100 seconds \u2014 a slow handler or long-running request",code:"524",docsUrl:r,family:"5xx",fix:"speed up the slow origin handler, or move long work off the request path into a background job (a Durable Object, Queue, or Workflow)",summary:"Cloudflare connected to your origin but it did not respond in time.",title:"A timeout occurred"},{causes:"the TLS handshake between Cloudflare and the origin failed \u2014 a missing/invalid origin certificate, or a cipher/SNI mismatch under Full (Strict) SSL",code:"525",docsUrl:r,family:"5xx",fix:"install a valid certificate on the origin and align your Cloudflare SSL/TLS mode with the origin's certificate setup",summary:"The SSL handshake with your origin failed.",title:"SSL handshake failed"},{causes:"Cloudflare could not validate the origin's certificate under Full (Strict) SSL \u2014 it is expired, self-signed, or issued for the wrong hostname",code:"526",docsUrl:r,family:"5xx",fix:"install a valid, publicly-trusted certificate on the origin (or use a Cloudflare Origin CA cert), matching the request hostname",summary:"Cloudflare could not validate your origin's SSL certificate.",title:"Invalid SSL certificate"},{causes:"a DNS record points at a Cloudflare IP or another prohibited address instead of your real origin",code:"1000",docsUrl:n,family:"1xxx",fix:"point the DNS record at your real origin IP, not a Cloudflare-owned or loopback address",summary:"DNS points to a prohibited IP.",title:"DNS points to prohibited IP"},{causes:"Cloudflare could not resolve the requested hostname \u2014 a Worker fetched an unresolvable host, or a DNS record is misconfigured",code:"1001",docsUrl:n,family:"1xxx",fix:"check the hostname you're requesting and the DNS records for the zone resolve to a valid origin",summary:"Cloudflare could not resolve the origin DNS.",title:"DNS resolution error"},{causes:"a Worker or DNS record targets a restricted IP (for example a Cloudflare-owned or loopback address)",code:"1002",docsUrl:n,family:"1xxx",fix:"change the Worker fetch target or DNS record to a valid, non-restricted origin address",summary:"DNS points to a prohibited IP (Worker/restricted).",title:"DNS points to a prohibited IP"},{causes:"the visitor's IP was blocked by an IP Access Rule, WAF rule, or security configuration on the zone",code:"1006",docsUrl:n,family:"1xxx",fix:"review the zone's Firewall/WAF and IP Access Rules to see why the address was banned, and adjust if it was blocked in error",summary:"Access denied: the visitor's IP has been banned.",title:"Access denied: your IP has been banned"},{causes:"your Worker threw an unhandled JavaScript exception during the request",code:"1101",docsUrl:n,family:"1xxx",fix:"reproduce with `wrangler tail` (or the Workers Logs / Studio Logs panel) to get the stack trace, then handle the throwing code path",summary:"A Worker threw a JavaScript exception.",title:"Worker threw a JavaScript exception"},{causes:"the Worker used more CPU time than a single invocation is allowed \u2014 usually a hot loop or heavy synchronous work",code:"1102",docsUrl:n,family:"1xxx",fix:"reduce per-request CPU (optimize hot loops, avoid heavy synchronous work) or offload the heavy work to a Durable Object, Queue, or Workflow",summary:"A Worker exceeded its CPU-time resource limit.",title:"Worker exceeded resource limits"}],d=a(e=>e!==void 0&&e>="0"&&e<="9","l"),g=a((e,t)=>{for(let o=e.indexOf(t);o!==-1;o=e.indexOf(t,o+t.length))if(!d(e[o-1])&&!d(e[o+t.length]))return!0;return!1},"_"),A=a((e,t)=>{for(let o of[`error ${t}`,`error: ${t}`])for(let i=e.indexOf(o);i!==-1;i=e.indexOf(o,i+o.length))if(!d(e[i+o.length]))return!0;return!1},"E"),O=/error|cloudflare/iu,p=a(e=>({body:[e.summary,"",`**Likely cause:** ${e.causes}.`,"",`**Fix:** ${e.fix}.`,"",`See [Cloudflare's ${e.family} error docs](${e.docsUrl}).`].join(`
12
+ `),header:`Cloudflare Error ${e.code}: ${e.title}`,id:`cloudflare-error-${e.code}`}),"c"),E=a(e=>{if(!O.test(e))return;let t=e.toLowerCase(),o=t.includes("error"),i=t.includes("cloudflare");if(o){for(let s of u)if(A(t,s.code))return p(s)}if(i){for(let s of u)if(g(t,s.code))return p(s)}},"f"),R=a(e=>(typeof e=="string"?e:e.join(`
13
+ `)).split(`
14
+ `).filter(t=>!t.startsWith("```")).join(`
15
+ `).replaceAll(/\*\*(.+?)\*\*/gu,"$1").replaceAll(/`([^`]+)`/gu,"$1"),"A"),_=a(e=>{for(let t of m)if(t.test(e))return{body:t.body,header:t.header,id:t.id}},"u"),I=a(e=>_(e)??E(e),"O");var T=Symbol.for("@lunora/errors/LunoraError"),h=class e extends Error{static{a(this,"a")}static[Symbol.hasInstance](t){return this!==e?Function.prototype[Symbol.hasInstance].call(this,t):typeof t=="object"&&t!==null&&t[T]===!0}type="VisulimaError";hint;title;loc;code;status;docsUrl;data;constructor(t,o,i={}){let s=c(t);super(o??t,i.cause===void 0?void 0:{cause:i.cause}),this.name=i.name??"LunoraError",this.hint=i.hint??s?.hint,this.title=i.title??s?.title,this.loc=i.location,this.code=t,this.status=i.status??s?.status??500,this.docsUrl=i.docsUrl??s?.docsUrl,this.data=i.data,Object.defineProperty(this,T,{value:!0})}};export{l as a,R as b,I as c,h as d};
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-I26MS5PJ.js";var u={highErrorRate:.05,highWriteContention:.1,lowCacheHitRate:.5,minCacheSamples:10,minConflictCalls:5,minErrorCalls:5,slowFunctionMs:1e3,storageCriticalBytes:5368709120,storageWarnBytes:1073741824},h={error:0,info:2,warning:1},g=e((a,i)=>{let s=[];if(a.maxDurationMs>=i.slowFunctionMs){let t=a.scannedTables??[];t.length>0?s.push({fn:a.path,kind:"missing-index",severity:"warning",tables:t.map(r=>r.table),value:a.maxDurationMs}):s.push({fn:a.path,kind:"slow-function",severity:"info",value:a.maxDurationMs})}a.calls>=i.minErrorCalls&&a.errors/a.calls>=i.highErrorRate&&s.push({fn:a.path,kind:"high-error-rate",message:a.lastErrorMessage??void 0,severity:"error",value:a.errors/a.calls});let n=a.conflicts??0;return n>0&&a.calls>=i.minConflictCalls&&n/a.calls>=i.highWriteContention&&s.push({fn:a.path,kind:"high-write-contention",severity:"warning",value:n/a.calls}),s},"h"),v=e((a,i,s=u)=>{let n=[];if(typeof a?.databaseSize=="number"&&a.databaseSize>=s.storageWarnBytes&&n.push({kind:"storage-headroom",severity:a.databaseSize>=s.storageCriticalBytes?"error":"warning",value:a.databaseSize}),a?.cache){let{evictions:t,hits:r,misses:c}=a.cache,o=r+c;if(o>=s.minCacheSamples){let l=r/o;l<s.lowCacheHitRate&&n.push({kind:"low-cache-hit-rate",severity:"warning",value:l})}t>0&&t>r&&n.push({kind:"high-evictions",severity:"warning",value:t})}for(let t of i??[])n.push(...g(t,s));return n.toSorted((t,r)=>h[t.severity]-h[r.severity])},"u");export{v as a};
@@ -0,0 +1 @@
1
+ import{d as v,e as U}from"./chunk-I26MS5PJ.js";var a=[["path",{d:"M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]];var o=[["path",{d:"M17.9998 15C17.9998 15 13.5809 9.00001 11.9998 9C10.4187 8.99999 5.99985 15 5.99985 15",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]];var r=[["path",{d:"M18 6L6.00081 17.9992M17.9992 18L6 6.00085",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]];var s=[["path",{d:"M2.99969 17.0002C2.99969 17.9302 2.99969 18.3952 3.10192 18.7767C3.37932 19.8119 4.18796 20.6206 5.22324 20.898C5.60474 21.0002 6.06972 21.0002 6.99969 21.0002L16.9997 21.0002C17.9297 21.0002 18.3947 21.0002 18.7762 20.898C19.8114 20.6206 20.6201 19.8119 20.8975 18.7767C20.9997 18.3952 20.9997 17.9302 20.9997 17.0002",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M16.4998 11.5002C16.4998 11.5002 13.1856 16.0002 11.9997 16.0002C10.8139 16.0002 7.49976 11.5002 7.49976 11.5002M11.9997 15.0002V3.00016",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]];var m=[["path",{d:"M2 12C2 8.31087 2 6.4663 2.81382 5.15877C3.1149 4.67502 3.48891 4.25427 3.91891 3.91554C5.08116 3 6.72077 3 10 3H14C17.2792 3 18.9188 3 20.0811 3.91554C20.5111 4.25427 20.8851 4.67502 21.1862 5.15877C22 6.4663 22 8.31087 22 12C22 15.6891 22 17.5337 21.1862 18.8412C20.8851 19.325 20.5111 19.7457 20.0811 20.0845C18.9188 21 17.2792 21 14 21H10C6.72077 21 5.08116 21 3.91891 20.0845C3.48891 19.7457 3.1149 19.325 2.81382 18.8412C2 17.5337 2 15.6891 2 12Z",stroke:"currentColor",strokeWidth:"1.5",key:"0"}],["path",{d:"M9.5 3L9.5 21",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}],["path",{d:"M5 7H6M5 10H6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"2"}]];var S=[["path",{d:"M5 14L8.5 17.5L19 6.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]];var h=[["path",{d:"M18 14C18 14 13.5811 19 12 19C10.4188 19 6 14 6 14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M18 9.99996C18 9.99996 13.5811 5.00001 12 5C10.4188 4.99999 6 10 6 10",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]];var e=[["path",{d:"M7.5 14.5C7.5 11.2002 7.5 9.55025 8.52513 8.52513C9.55025 7.5 11.2002 7.5 14.5 7.5C17.7998 7.5 19.4497 7.5 20.4749 8.52513C21.5 9.55025 21.5 11.2002 21.5 14.5C21.5 17.7998 21.5 19.4497 20.4749 20.4749C19.4497 21.5 17.7998 21.5 14.5 21.5C11.2002 21.5 9.55025 21.5 8.52513 20.4749C7.5 19.4497 7.5 17.7998 7.5 14.5Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M7.5 16.5C6.10355 16.5 5.40533 16.5 4.84402 16.3036C3.83866 15.9518 3.0482 15.1613 2.69641 14.156C2.5 13.5947 2.5 12.8964 2.5 11.5V9.5C2.5 6.20017 2.5 4.55025 3.52513 3.52513C4.55025 2.5 6.20017 2.5 9.5 2.5H11.5C12.8964 2.5 13.5947 2.5 14.156 2.69641C15.1613 3.0482 15.9518 3.83866 16.3036 4.84402C16.5 5.40533 16.5 6.10355 16.5 7.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]];var f=[["path",{d:"M17 17L21 21",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M19 11C19 6.58172 15.4183 3 11 3C6.58172 3 3 6.58172 3 11C3 15.4183 6.58172 19 11 19C15.4183 19 19 15.4183 19 11Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]];var k=[["path",{d:"M21.0477 3.05293C18.8697 0.707363 2.48648 6.4532 2.50001 8.551C2.51535 10.9299 8.89809 11.6617 10.6672 12.1581C11.7311 12.4565 12.016 12.7625 12.2613 13.8781C13.3723 18.9305 13.9301 21.4435 15.2014 21.4996C17.2278 21.5892 23.1733 5.342 21.0477 3.05293Z",stroke:"currentColor",strokeWidth:"1.5",key:"0"}],["path",{d:"M11.4999 12.5L14.9999 9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]];var n=v(U(),1),q={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none"},A=(0,n.forwardRef)(({color:u="currentColor",size:d=24,strokeWidth:c,absoluteStrokeWidth:M=!1,className:w="",altIcon:F,showAlt:B=!1,icon:P,primaryColor:I,secondaryColor:i,disableSecondaryOpacity:L=!1,...T},D)=>{let x=c!==void 0?M?Number(c)*24/Number(d):c:void 0,C=x!==void 0?{strokeWidth:x,stroke:"currentColor"}:{},R={ref:D,...q,width:d,height:d,color:I||u,className:w,...C,...T},y=[...B&&F?F:P].sort(([,p],[,t])=>{let l=p.opacity!==void 0;return t.opacity!==void 0?1:l?-1:0}).map(([p,t])=>{let l=t.opacity!==void 0,g=l&&!L?t.opacity:void 0,b=i?{...t.stroke!==void 0?{stroke:l?i:I||u}:{fill:l?i:I||u}}:{};return(0,n.createElement)(p,{...t,...C,...b,opacity:g,key:t.key})});return(0,n.createElement)("svg",R,y)});A.displayName="HugeiconsIcon";export{a,o as b,r as c,e as d,s as e,f,k as g,m as h,S as i,h as j,A as k};
@@ -0,0 +1 @@
1
+ import{a as Ot,b as Qt,c as ot}from"./chunk-CVXNHIQW.js";import{a as me}from"./chunk-253UHWDX.js";import{a as Kt,b as At,c as Pt,d as $t}from"./chunk-2I4NHEKA.js";import{a as it}from"./chunk-ODMIUMAO.js";import{a as It,b as Rt,c as Tt,d as zt,e as Qe}from"./chunk-5QR2SQIS.js";import{a as Ft}from"./chunk-VCFEO3RI.js";import{a as Lt}from"./chunk-6QTAHSDD.js";import"./chunk-VESGIGMQ.js";import"./chunk-NRP22GKC.js";import{e as Ct}from"./chunk-UYEZR3BI.js";import"./chunk-OPM7ESDV.js";import{a as Dt}from"./chunk-SV764LKQ.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import{a as Ze,b as et,c as tt,d as Nt,e as yt,f as rt,g as at,h as wt,i as St}from"./chunk-TVCVRQUC.js";import"./chunk-AUGKHAMQ.js";import"./chunk-WJRYEML4.js";import{a as Mt}from"./chunk-R6U22RSY.js";import{a as _t}from"./chunk-YVR4SEPU.js";import{a as qt,b as kt}from"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-OQ6I6OXT.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{a as Je}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as Ge}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import"./chunk-55UGUCQ6.js";import{a as Ke}from"./chunk-4ZEL6BYL.js";import{c as $e}from"./chunk-VRWHCG2V.js";import{a as ct,l as mt}from"./chunk-ICDMV4MP.js";import"./chunk-QAQDMS6R.js";import"./chunk-FQPBYMII.js";import{a as gt}from"./chunk-RWVIV3U7.js";import{a as st,b as lt,c as nt,d as Oe,e as ce,f as V}from"./chunk-HCTJKP5J.js";import{a as fe,b as Ae,c as Pe,d as ht,e as pe}from"./chunk-2IKDEUCX.js";import{d as ge,f as ft,g as pt,h as xt,i as bt,l as Ve,p as vt}from"./chunk-HJHSQPHW.js";import{a as d,d as Ye,e as Et,f as Ht,g as Ut,i as ut}from"./chunk-I26MS5PJ.js";var B=Ye(Et(),1);var xe=Ye(Ht(),1);var t=Ye(Ut(),1);var jt=d((l,e,s)=>`${l}:${e}:${ct(s??{})}`,"ut"),Bt=d((l,e)=>l==="gauge"?e.last:l==="histogram"?e.sum/Math.max(1,e.count):e.sum,"ft"),Gt=d((l,e)=>Bt(l,e),"jt"),Vt=d(l=>Bt(l.kind,l),"Gt"),dt=d(l=>Number.isInteger(l)?l.toLocaleString():l.toLocaleString(void 0,{maximumFractionDigits:2}),"We"),Wt=d(l=>Array.isArray(l?.series)?l.series:[],"Jt"),Xt="FUNCTION_NOT_FOUND",Yt=d(l=>{let e=new Map;if(!Array.isArray(l?.series))return e;for(let s of l.series)e.set(jt(s.kind,s.name,s.attributes),s.points);return e},"Xt"),Jt={counter:"secondary",gauge:"default",histogram:"outline"},Zt=d(l=>{let e=(0,xe.c)(18),{name:s,onOpenTrace:a,traceId:r}=l,h=ge();if(r===void 0){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[0]=c):c=e[0],c}let i;e[1]!==r?(i=r.slice(0,8),e[1]=r,e[2]=i):i=e[2];let n=i;if(a===void 0){let c=`mt-instrument-trace-${s}`,p;return e[3]!==n||e[4]!==c||e[5]!==r?(p=(0,t.jsx)("span",{className:"text-muted-foreground","data-testid":c,title:r,children:n}),e[3]=n,e[4]=c,e[5]=r,e[6]=p):p=e[6],p}let g=`mt-instrument-trace-${s}`,v;e[7]!==a||e[8]!==r?(v=d(()=>{a(r)},"v"),e[7]=a,e[8]=r,e[9]=v):v=e[9];let S;e[10]!==h||e[11]!==r?(S=h("Open the exemplar trace {trace}",{trace:r}),e[10]=h,e[11]=r,e[12]=S):S=e[12];let f;return e[13]!==n||e[14]!==g||e[15]!==v||e[16]!==S?(f=(0,t.jsx)("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":g,onClick:v,title:S,type:"button",children:n}),e[13]=n,e[14]=g,e[15]=v,e[16]=S,e[17]=f):f=e[17],f},"Zt"),er=d(l=>{let e=(0,xe.c)(105),{onOpenTrace:s,shardKey:a}=l,r=ge(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={},e[0]=h):h=e[0];let i;e[1]!==a?(i={live:!0,shardKey:a},e[1]=a,e[2]=i):i=e[2];let{data:n,error:g,errorSource:v}=$e(Ke.getMetricSeries,h,i),S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S={},e[3]=S):S=e[3];let f;e[4]!==a?(f={live:!0,shardKey:a},e[4]=a,e[5]=f):f=e[5];let{data:c}=$e(Ke.getMetricHistory,S,f),p,N,q,M,o,k,x,b,_,D,u,C,I;if(e[6]!==n||e[7]!==g||e[8]!==v||e[9]!==c||e[10]!==s||e[11]!==r){b=Symbol.for("react.early_return_sentinel");e:{let A=Wt(n),P=bt(v)===Xt;if(g!==null&&!P){let m;e[25]!==r?(m=r("Instruments"),e[25]=r,e[26]=m):m=e[26];let j;e[27]!==m?(j=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:m}),e[27]=m,e[28]=j):j=e[28];let E;e[29]!==g||e[30]!==r?(E=r("Instruments unavailable: {error}",{error:g}),e[29]=g,e[30]=r,e[31]=E):E=e[31];let H;e[32]!==E?(H=(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"mt-instruments-error",role:"status",children:E}),e[32]=E,e[33]=H):H=e[33];let de;e[34]!==j||e[35]!==H?(de=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[j,H]}),e[34]=j,e[35]=H,e[36]=de):de=e[36],b=de;break e}if(A.length===0){b=null;break e}let $=Yt(c),L;e[37]!==r?(L=d(m=>r(m==="counter"?"Counter":m==="gauge"?"Gauge":"Histogram"),"L"),e[37]=r,e[38]=L):L=e[38];let U=L;o="flex flex-col gap-2",k="mt-instruments";let Q;e[39]!==r?(Q=r("Instruments"),e[39]=r,e[40]=Q):Q=e[40],e[41]!==Q?(x=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:Q}),e[41]=Q,e[42]=x):x=e[42],M=fe,I="overflow-hidden py-0",q=pe,C="px-0",N=st,D="mt-instruments-table";let K;e[43]!==r?(K=r("name"),e[43]=r,e[44]=K):K=e[44];let O;e[45]!==K?(O=(0,t.jsx)(ce,{children:K}),e[45]=K,e[46]=O):O=e[46];let W;e[47]!==r?(W=r("kind"),e[47]=r,e[48]=W):W=e[48];let X;e[49]!==W?(X=(0,t.jsx)(ce,{children:W}),e[49]=W,e[50]=X):X=e[50];let Y;e[51]!==r?(Y=r("value"),e[51]=r,e[52]=Y):Y=e[52];let J;e[53]!==Y?(J=(0,t.jsx)(ce,{className:"text-right",children:Y}),e[53]=Y,e[54]=J):J=e[54];let Z;e[55]!==r?(Z=r("count"),e[55]=r,e[56]=Z):Z=e[56];let ee;e[57]!==Z?(ee=(0,t.jsx)(ce,{className:"text-right",children:Z}),e[57]=Z,e[58]=ee):ee=e[58];let te;e[59]!==r?(te=r("range"),e[59]=r,e[60]=te):te=e[60];let re;e[61]!==te?(re=(0,t.jsx)(ce,{className:"text-right",children:te}),e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==r?(ae=r("trend"),e[63]=r,e[64]=ae):ae=e[64];let se;e[65]!==ae?(se=(0,t.jsx)(ce,{children:ae}),e[65]=ae,e[66]=se):se=e[66];let le;e[67]!==r?(le=r("trace"),e[67]=r,e[68]=le):le=e[68];let ne;e[69]!==le?(ne=(0,t.jsx)(ce,{children:le}),e[69]=le,e[70]=ne):ne=e[70];let ie;e[71]!==r?(ie=r("dimensions"),e[71]=r,e[72]=ie):ie=e[72];let oe;e[73]!==ie?(oe=(0,t.jsx)(ce,{children:ie}),e[73]=ie,e[74]=oe):oe=e[74],e[75]!==O||e[76]!==X||e[77]!==J||e[78]!==ee||e[79]!==re||e[80]!==se||e[81]!==ne||e[82]!==oe?(u=(0,t.jsx)(lt,{children:(0,t.jsxs)(Oe,{children:[O,X,J,ee,re,se,ne,oe]})}),e[75]=O,e[76]=X,e[77]=J,e[78]=ee,e[79]=re,e[80]=se,e[81]=ne,e[82]=oe,e[83]=u):u=e[83],p=nt,_=A.map(m=>{let j=Ft(m.attributes),E=jt(m.kind,m.name,m.attributes),H=($.get(E)??[]).map(de=>Gt(m.kind,de));return(0,t.jsxs)(Oe,{"data-testid":`mt-instrument-${m.name}`,children:[(0,t.jsx)(V,{className:"font-mono text-xs",title:m.functionPath,children:m.name}),(0,t.jsx)(V,{children:(0,t.jsx)(Ge,{variant:Jt[m.kind],children:U(m.kind)})}),(0,t.jsx)(V,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${m.name}`,children:dt(Vt(m))}),(0,t.jsx)(V,{className:"text-right tabular-nums text-muted-foreground",children:m.count.toLocaleString()}),(0,t.jsx)(V,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:m.min===m.max?"\u2014":`${dt(m.min)}\u2013${dt(m.max)}`}),(0,t.jsx)(V,{children:H.length>=2?(0,t.jsx)(it,{ariaLabel:r("{name} trend",{name:m.name}),className:"h-6 w-24 text-foreground",series:H,testId:`mt-instrument-trend-${m.name}`}):(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(V,{className:"font-mono text-xs",children:(0,t.jsx)(Zt,{name:m.name,onOpenTrace:s,traceId:m.exemplarTraceId})}),(0,t.jsx)(V,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:j,children:j===""?"\u2014":j})]},E)})}e[6]=n,e[7]=g,e[8]=v,e[9]=c,e[10]=s,e[11]=r,e[12]=p,e[13]=N,e[14]=q,e[15]=M,e[16]=o,e[17]=k,e[18]=x,e[19]=b,e[20]=_,e[21]=D,e[22]=u,e[23]=C,e[24]=I}else p=e[12],N=e[13],q=e[14],M=e[15],o=e[16],k=e[17],x=e[18],b=e[19],_=e[20],D=e[21],u=e[22],C=e[23],I=e[24];if(b!==Symbol.for("react.early_return_sentinel"))return b;let R;e[84]!==p||e[85]!==_?(R=(0,t.jsx)(p,{children:_}),e[84]=p,e[85]=_,e[86]=R):R=e[86];let T;e[87]!==N||e[88]!==R||e[89]!==D||e[90]!==u?(T=(0,t.jsxs)(N,{"data-testid":D,children:[u,R]}),e[87]=N,e[88]=R,e[89]=D,e[90]=u,e[91]=T):T=e[91];let w;e[92]!==q||e[93]!==T||e[94]!==C?(w=(0,t.jsx)(q,{className:C,children:T}),e[92]=q,e[93]=T,e[94]=C,e[95]=w):w=e[95];let y;e[96]!==M||e[97]!==w||e[98]!==I?(y=(0,t.jsx)(M,{className:I,children:w}),e[96]=M,e[97]=w,e[98]=I,e[99]=y):y=e[99];let F;return e[100]!==o||e[101]!==k||e[102]!==x||e[103]!==y?(F=(0,t.jsxs)("section",{className:o,"data-testid":k,children:[x,y]}),e[100]=o,e[101]=k,e[102]=x,e[103]=y,e[104]=F):F=e[104],F},"er"),tr=d(l=>{let e=(0,xe.c)(74),{aggregate:s,shardResults:a}=l,r=ge(),h;e[0]!==r?(h=r("Shards"),e[0]=r,e[1]=h):h=e[1];let i;e[2]!==s.failed||e[3]!==s.reachable||e[4]!==r?(i=s.failed>0?r("{reachable} reachable, {failed} unreachable",{failed:s.failed,reachable:s.reachable}):r("{reachable} reachable",{reachable:s.reachable}),e[2]=s.failed,e[3]=s.reachable,e[4]=r,e[5]=i):i=e[5];let n;e[6]!==h||e[7]!==i?(n=(0,t.jsx)(me,{label:h,testId:"mt-agg-shards",value:i}),e[6]=h,e[7]=i,e[8]=n):n=e[8];let g;e[9]!==r?(g=r("Total requests"),e[9]=r,e[10]=g):g=e[10];let v;e[11]!==s.totalRequests||e[12]!==g?(v=(0,t.jsx)(me,{label:g,testId:"mt-agg-requests",value:s.totalRequests}),e[11]=s.totalRequests,e[12]=g,e[13]=v):v=e[13];let S;e[14]!==r?(S=r("Total errors"),e[14]=r,e[15]=S):S=e[15];let f;e[16]!==s.totalErrors||e[17]!==S?(f=(0,t.jsx)(me,{label:S,testId:"mt-agg-errors",value:s.totalErrors}),e[16]=s.totalErrors,e[17]=S,e[18]=f):f=e[18];let c;e[19]!==r?(c=r("Total database size"),e[19]=r,e[20]=c):c=e[20];let p;e[21]!==s.totalDatabaseSize?(p=Ve(s.totalDatabaseSize),e[21]=s.totalDatabaseSize,e[22]=p):p=e[22];let N;e[23]!==c||e[24]!==p?(N=(0,t.jsx)(me,{label:c,testId:"mt-agg-db-size",value:p}),e[23]=c,e[24]=p,e[25]=N):N=e[25];let q;e[26]!==r?(q=r("Combined cache hit rate"),e[26]=r,e[27]=q):q=e[27];let M;e[28]!==s.hitRate||e[29]!==r?(M=s.hitRate===null?r("no cache configured"):`${(s.hitRate*100).toFixed(1)}%`,e[28]=s.hitRate,e[29]=r,e[30]=M):M=e[30];let o;e[31]!==q||e[32]!==M?(o=(0,t.jsx)(me,{label:q,testId:"mt-agg-cache",value:M}),e[31]=q,e[32]=M,e[33]=o):o=e[33];let k;e[34]!==N||e[35]!==o||e[36]!==n||e[37]!==v||e[38]!==f?(k=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[n,v,f,N,o]}),e[34]=N,e[35]=o,e[36]=n,e[37]=v,e[38]=f,e[39]=k):k=e[39];let x;e[40]!==r?(x=r("shard"),e[40]=r,e[41]=x):x=e[41];let b;e[42]!==x?(b=(0,t.jsx)(ce,{children:x}),e[42]=x,e[43]=b):b=e[43];let _;e[44]!==r?(_=r("requests"),e[44]=r,e[45]=_):_=e[45];let D;e[46]!==_?(D=(0,t.jsx)(ce,{children:_}),e[46]=_,e[47]=D):D=e[47];let u;e[48]!==r?(u=r("errors"),e[48]=r,e[49]=u):u=e[49];let C;e[50]!==u?(C=(0,t.jsx)(ce,{children:u}),e[50]=u,e[51]=C):C=e[51];let I;e[52]!==r?(I=r("db size"),e[52]=r,e[53]=I):I=e[53];let R;e[54]!==I?(R=(0,t.jsx)(ce,{children:I}),e[54]=I,e[55]=R):R=e[55];let T;e[56]!==b||e[57]!==D||e[58]!==C||e[59]!==R?(T=(0,t.jsx)(lt,{children:(0,t.jsxs)(Oe,{children:[b,D,C,R]})}),e[56]=b,e[57]=D,e[58]=C,e[59]=R,e[60]=T):T=e[60];let w;if(e[61]!==a||e[62]!==r){let P;e[64]!==r?(P=d($=>(0,t.jsxs)(Oe,{"data-testid":`mt-agg-row-${$.shard}`,children:[(0,t.jsx)(V,{children:$.shard}),$.metrics===null?(0,t.jsx)(V,{className:"text-destructive",colSpan:3,children:$.error??r("unreachable")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(V,{className:"tabular-nums",children:$.metrics.requests}),(0,t.jsx)(V,{className:"tabular-nums",children:$.metrics.errors}),(0,t.jsx)(V,{className:"tabular-nums",children:Ve($.metrics.databaseSize)})]})]},$.shard),"z"),e[64]=r,e[65]=P):P=e[65],w=a.map(P),e[61]=a,e[62]=r,e[63]=w}else w=e[63];let y;e[66]!==w?(y=(0,t.jsx)(nt,{children:w}),e[66]=w,e[67]=y):y=e[67];let F;e[68]!==T||e[69]!==y?(F=(0,t.jsx)(fe,{className:"overflow-hidden py-0",children:(0,t.jsx)(pe,{className:"px-0",children:(0,t.jsxs)(st,{"data-testid":"mt-agg-table",children:[T,y]})})}),e[68]=T,e[69]=y,e[70]=F):F=e[70];let A;return e[71]!==k||e[72]!==F?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[k,F]}),e[71]=k,e[72]=F,e[73]=A):A=e[73],A},"tr"),rr=d(l=>{let e=(0,xe.c)(75),{currentDelta:s,errorRate:a,history:r,latencyPercentiles:h,metrics:i}=l,n=ge(),{cache:g}=i,v;e[0]!==r||e[1]!==n?(v=r.length>=2?(0,t.jsx)(it,{ariaLabel:n("Requests per interval over time"),className:"h-7 w-24 text-foreground",series:r,testId:"mt-sparkline"}):void 0,e[0]=r,e[1]=n,e[2]=v):v=e[2];let S;e[3]!==s||e[4]!==r.length||e[5]!==n?(S=r.length>=2?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-semibold text-foreground",children:`+${s.toLocaleString()}`})," ",n("last interval")]}):(0,t.jsx)("span",{"data-testid":"mt-sparkline-empty",children:n("collecting samples\u2026")}),e[3]=s,e[4]=r.length,e[5]=n,e[6]=S):S=e[6];let f;e[7]!==n?(f=n("Requests"),e[7]=n,e[8]=f):f=e[8];let c;e[9]!==i.requests||e[10]!==v||e[11]!==S||e[12]!==f?(c=(0,t.jsx)(me,{chart:v,footer:S,label:f,testId:"mt-requests",value:i.requests}),e[9]=i.requests,e[10]=v,e[11]=S,e[12]=f,e[13]=c):c=e[13];let p;e[14]!==a||e[15]!==n?(p=n("{rate} error rate",{rate:a}),e[14]=a,e[15]=n,e[16]=p):p=e[16];let N;e[17]!==n?(N=n("Errors"),e[17]=n,e[18]=N):N=e[18];let q;e[19]!==a||e[20]!==i.errors?(q=(0,t.jsxs)(t.Fragment,{children:[i.errors," (",a,")"]}),e[19]=a,e[20]=i.errors,e[21]=q):q=e[21];let M;e[22]!==p||e[23]!==N||e[24]!==q?(M=(0,t.jsx)(me,{footer:p,label:N,testId:"mt-errors",value:q}),e[22]=p,e[23]=N,e[24]=q,e[25]=M):M=e[25];let o;e[26]!==h.p90?(o=h.p90>0?`P90 ${ot(h.p90)}`:void 0,e[26]=h.p90,e[27]=o):o=e[27];let k;e[28]!==n?(k=n("P95 latency"),e[28]=n,e[29]=k):k=e[29];let x;e[30]!==h.p95?(x=h.p95>0?ot(h.p95):"\u2014",e[30]=h.p95,e[31]=x):x=e[31];let b;e[32]!==k||e[33]!==x||e[34]!==o?(b=(0,t.jsx)(me,{footer:o,label:k,testId:"mt-p95",value:x}),e[32]=k,e[33]=x,e[34]=o,e[35]=b):b=e[35];let _;e[36]!==g||e[37]!==n?(_=g?`${g.entries.toLocaleString()} ${n("cache entries")}`:void 0,e[36]=g,e[37]=n,e[38]=_):_=e[38];let D;e[39]!==n?(D=n("Database size"),e[39]=n,e[40]=D):D=e[40];let u;e[41]!==i.databaseSize?(u=Ve(i.databaseSize),e[41]=i.databaseSize,e[42]=u):u=e[42];let C;e[43]!==_||e[44]!==D||e[45]!==u?(C=(0,t.jsx)(me,{footer:_,label:D,testId:"mt-db-size",value:u}),e[43]=_,e[44]=D,e[45]=u,e[46]=C):C=e[46];let I;e[47]!==n?(I=n("Shard"),e[47]=n,e[48]=I):I=e[48];let R;e[49]!==i.shard||e[50]!==I?(R=(0,t.jsx)(me,{label:I,testId:"mt-shard",value:i.shard}),e[49]=i.shard,e[50]=I,e[51]=R):R=e[51];let T;e[52]!==n?(T=n("Uptime"),e[52]=n,e[53]=T):T=e[53];let w;e[54]!==i.uptimeMs?(w=Ot(i.uptimeMs),e[54]=i.uptimeMs,e[55]=w):w=e[55];let y;e[56]!==T||e[57]!==w?(y=(0,t.jsx)(me,{label:T,testId:"mt-uptime",value:w}),e[56]=T,e[57]=w,e[58]=y):y=e[58];let F;e[59]!==n?(F=n("Cache hit rate"),e[59]=n,e[60]=F):F=e[60];let A;e[61]!==g||e[62]!==n?(A=g?n("{rate} ({count} entries)",{count:g.entries,rate:Qt(g.hits,g.misses)}):n("no cache configured"),e[61]=g,e[62]=n,e[63]=A):A=e[63];let P;e[64]!==F||e[65]!==A?(P=(0,t.jsx)(me,{label:F,testId:"mt-cache",value:A}),e[64]=F,e[65]=A,e[66]=P):P=e[66];let $;return e[67]!==b||e[68]!==C||e[69]!==R||e[70]!==y||e[71]!==P||e[72]!==c||e[73]!==M?($=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4","data-testid":"mt-stats",children:[c,M,b,C,R,y,P]}),e[67]=b,e[68]=C,e[69]=R,e[70]=y,e[71]=P,e[72]=c,e[73]=M,e[74]=$):$=e[74],$},"rr"),Xe=d(l=>l>=100?"critical":l>=50?"warning":"good","Ge"),je=d(l=>l<1?`${(l*1e3).toFixed(0)}\u03BCs`:l<1e3?`${l.toFixed(1)}ms`:`${(l/1e3).toFixed(2)}s`,"Ee"),We=d(l=>l>=1e9?`${(l/1e9).toFixed(1)}B`:l>=1e6?`${(l/1e6).toFixed(1)}M`:l>=1e3?`${(l/1e3).toFixed(1)}K`:l.toLocaleString(),"Ue"),ar=d(l=>{let e=(0,xe.c)(3),{level:s}=l;if(s==="critical"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(Ge,{variant:"destructive",children:"Slow"}),e[0]=r):r=e[0],r}if(s==="warning"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-warning/10 px-2 py-0.5 text-xs font-medium text-warning",children:"Moderate"}),e[1]=r):r=e[1],r}let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-success/10 px-2 py-0.5 text-xs font-medium text-success",children:"Fast"}),e[2]=a):a=e[2],a},"sr"),sr=d((l,e)=>{let s=[...l];return s.sort((a,r)=>{switch(e){case"avgTime":return r.avgDurationMs-a.avgDurationMs;case"execCount":return r.execCount-a.execCount;case"rowsRead":return r.rowsRead-a.rowsRead;default:return r.totalDurationMs-a.totalDurationMs}}),s},"lr"),lr=d(l=>{let e=(0,xe.c)(161),{queryStats:s}=l,a=ge(),[r,h]=(0,B.useState)("totalTime"),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];let[n,g]=(0,B.useState)(i),v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=d(I=>{I!==null&&h(I)},"v"),e[1]=v):v=e[1];let S=v,f,c,p,N,q,M,o,k,x,b;if(e[2]!==n||e[3]!==s||e[4]!==r||e[5]!==a){p=Symbol.for("react.early_return_sentinel");e:{let I=sr(s,r),R;e[16]!==s?(R=s.filter(nr),e[16]=s,e[17]=R):R=e[17];let T=R.length,w;e[18]!==s?(w=s.filter(ir),e[18]=s,e[19]=w):w=e[19];let y=w.length,F;e[20]!==s?(F=s.filter(or),e[20]=s,e[21]=F):F=e[21];let A=F.length,P;e[22]===Symbol.for("react.memo_cache_sentinel")?(P=d(z=>{g(ue=>{let G=new Set(ue);return G.has(z)?G.delete(z):G.add(z),G})},"z"),e[22]=P):P=e[22];let $=P;if(s.length===0){let z;e[23]!==a?(z=a("No query insights yet"),e[23]=a,e[24]=z):z=e[24];let ue;e[25]!==z?(ue=(0,t.jsx)("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:z}),e[25]=z,e[26]=ue):ue=e[26];let G;e[27]!==a?(G=a("Query insights appear once statements are executed against this shard."),e[27]=a,e[28]=G):G=e[28];let he;e[29]!==G?(he=(0,t.jsx)("p",{className:"mt-1 text-sm",children:G}),e[29]=G,e[30]=he):he=e[30];let Ue;e[31]!==ue||e[32]!==he?(Ue=(0,t.jsx)(fe,{children:(0,t.jsx)(pe,{className:"py-12",children:(0,t.jsxs)("div",{className:"text-center text-muted-foreground",children:[ue,he]})})}),e[31]=ue,e[32]=he,e[33]=Ue):Ue=e[33],p=Ue;break e}o="space-y-4",k="qi-root";let L;e[34]!==a?(L=a("Critical queries"),e[34]=a,e[35]=L):L=e[35];let U;e[36]!==L?(U=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Pe,{className:"text-sm font-medium",children:L})}),e[36]=L,e[37]=U):U=e[37];let Q;e[38]!==T?(Q=(0,t.jsx)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:T}),e[38]=T,e[39]=Q):Q=e[39];let K;e[40]!==a?(K=a(">100ms avg execution"),e[40]=a,e[41]=K):K=e[41];let O;e[42]!==K?(O=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:K}),e[42]=K,e[43]=O):O=e[43];let W;e[44]!==Q||e[45]!==O?(W=(0,t.jsxs)(pe,{children:[Q,O]}),e[44]=Q,e[45]=O,e[46]=W):W=e[46];let X;e[47]!==U||e[48]!==W?(X=(0,t.jsxs)(fe,{children:[U,W]}),e[47]=U,e[48]=W,e[49]=X):X=e[49];let Y;e[50]!==a?(Y=a("Moderate queries"),e[50]=a,e[51]=Y):Y=e[51];let J;e[52]!==Y?(J=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Pe,{className:"text-sm font-medium",children:Y})}),e[52]=Y,e[53]=J):J=e[53];let Z;e[54]!==y?(Z=(0,t.jsx)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:y}),e[54]=y,e[55]=Z):Z=e[55];let ee;e[56]!==a?(ee=a("50\u2013100ms avg execution"),e[56]=a,e[57]=ee):ee=e[57];let te;e[58]!==ee?(te=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ee}),e[58]=ee,e[59]=te):te=e[59];let re;e[60]!==Z||e[61]!==te?(re=(0,t.jsxs)(pe,{children:[Z,te]}),e[60]=Z,e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==J||e[64]!==re?(ae=(0,t.jsxs)(fe,{children:[J,re]}),e[63]=J,e[64]=re,e[65]=ae):ae=e[65];let se;e[66]!==a?(se=a("Fast queries"),e[66]=a,e[67]=se):se=e[67];let le;e[68]!==se?(le=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Pe,{className:"text-sm font-medium",children:se})}),e[68]=se,e[69]=le):le=e[69];let ne;e[70]!==A?(ne=(0,t.jsx)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:A}),e[70]=A,e[71]=ne):ne=e[71];let ie;e[72]!==a?(ie=a("<50ms avg execution"),e[72]=a,e[73]=ie):ie=e[73];let oe;e[74]!==ie?(oe=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ie}),e[74]=ie,e[75]=oe):oe=e[75];let m;e[76]!==ne||e[77]!==oe?(m=(0,t.jsxs)(pe,{children:[ne,oe]}),e[76]=ne,e[77]=oe,e[78]=m):m=e[78];let j;e[79]!==le||e[80]!==m?(j=(0,t.jsxs)(fe,{children:[le,m]}),e[79]=le,e[80]=m,e[81]=j):j=e[81],e[82]!==X||e[83]!==ae||e[84]!==j?(x=(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[X,ae,j]}),e[82]=X,e[83]=ae,e[84]=j,e[85]=x):x=e[85];let E;e[86]!==a?(E=a("Query leaderboard"),e[86]=a,e[87]=E):E=e[87];let H;e[88]!==E?(H=(0,t.jsx)("h3",{className:"text-lg font-semibold",children:E}),e[88]=E,e[89]=H):H=e[89];let de;e[90]!==r||e[91]!==a?(de=a("Slow queries sorted by {sortField}",{sortField:a(r)}),e[90]=r,e[91]=a,e[92]=de):de=e[92];let be;e[93]!==de?(be=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:de}),e[93]=de,e[94]=be):be=e[94];let ve;e[95]!==H||e[96]!==be?(ve=(0,t.jsxs)("div",{children:[H,be]}),e[95]=H,e[96]=be,e[97]=ve):ve=e[97];let Ne;e[98]!==a?(Ne=a("Sort by"),e[98]=a,e[99]=Ne):Ne=e[99];let ye;e[100]!==Ne?(ye=(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:Ne}),e[100]=Ne,e[101]=ye):ye=e[101];let we;e[102]!==a?(we=a("Sort queries by"),e[102]=a,e[103]=we):we=e[103];let Be;e[104]===Symbol.for("react.memo_cache_sentinel")?(Be=(0,t.jsx)(Rt,{}),e[104]=Be):Be=e[104];let Se;e[105]!==we?(Se=(0,t.jsx)(Tt,{"aria-label":we,className:"w-[140px]","data-testid":"qi-sort",children:Be}),e[105]=we,e[106]=Se):Se=e[106];let qe;e[107]!==a?(qe=a("Total time"),e[107]=a,e[108]=qe):qe=e[108];let ke;e[109]!==qe?(ke=(0,t.jsx)(Qe,{value:"totalTime",children:qe}),e[109]=qe,e[110]=ke):ke=e[110];let _e;e[111]!==a?(_e=a("Avg time"),e[111]=a,e[112]=_e):_e=e[112];let Me;e[113]!==_e?(Me=(0,t.jsx)(Qe,{value:"avgTime",children:_e}),e[113]=_e,e[114]=Me):Me=e[114];let De;e[115]!==a?(De=a("Execution count"),e[115]=a,e[116]=De):De=e[116];let Ce;e[117]!==De?(Ce=(0,t.jsx)(Qe,{value:"execCount",children:De}),e[117]=De,e[118]=Ce):Ce=e[118];let Ie;e[119]!==a?(Ie=a("Rows read"),e[119]=a,e[120]=Ie):Ie=e[120];let Re;e[121]!==Ie?(Re=(0,t.jsx)(Qe,{value:"rowsRead",children:Ie}),e[121]=Ie,e[122]=Re):Re=e[122];let Te;e[123]!==ke||e[124]!==Me||e[125]!==Ce||e[126]!==Re?(Te=(0,t.jsxs)(zt,{children:[ke,Me,Ce,Re]}),e[123]=ke,e[124]=Me,e[125]=Ce,e[126]=Re,e[127]=Te):Te=e[127];let ze;e[128]!==r||e[129]!==Se||e[130]!==Te?(ze=(0,t.jsxs)(It,{onValueChange:S,value:r,children:[Se,Te]}),e[128]=r,e[129]=Se,e[130]=Te,e[131]=ze):ze=e[131];let Fe;e[132]!==ye||e[133]!==ze?(Fe=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[ye,ze]}),e[132]=ye,e[133]=ze,e[134]=Fe):Fe=e[134],e[135]!==ve||e[136]!==Fe?(b=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[ve,Fe]}),e[135]=ve,e[136]=Fe,e[137]=b):b=e[137],c=fe;let Le;e[138]!==a?(Le=a("Statements"),e[138]=a,e[139]=Le):Le=e[139];let Ee;e[140]!==Le?(Ee=(0,t.jsx)(Pe,{children:Le}),e[140]=Le,e[141]=Ee):Ee=e[141],M=(0,t.jsxs)(Ae,{children:[Ee,(0,t.jsx)(ht,{children:a("{count} tracked statements",{count:I.length})})]}),f=pe,N="space-y-2";let He;e[142]!==n||e[143]!==a?(He=d(z=>{let ue=z.normalizedSql,G=n.has(ue),he=Xe(z.avgDurationMs);return(0,t.jsxs)("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[(0,t.jsxs)("button",{"aria-expanded":G,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:d(()=>{$(ue)},"onClick"),type:"button",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsx)(ar,{level:he}),(0,t.jsx)("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:z.normalizedSql})]}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-4",children:[(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:je(z.totalDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("total")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:je(z.avgDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("avg")})]}),z.p95DurationMs!==void 0&&(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:je(z.p95DurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("p95")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:We(z.execCount)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("calls")})]})]})]}),G&&(0,t.jsxs)("div",{className:"space-y-3 border-t bg-muted/30 p-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"mb-2 text-sm font-medium",children:a("Full statement")}),(0,t.jsx)("pre",{className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-sm whitespace-pre-wrap break-all",children:z.normalizedSql})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[z.p50DurationMs!==void 0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("p50")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:je(z.p50DurationMs)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Exec count")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:We(z.execCount)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Total time")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:je(z.totalDurationMs)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Rows read")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:We(z.rowsRead)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Rows written")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:We(z.rowsWritten)})]})]})]})]},ue)},"Ke"),e[142]=n,e[143]=a,e[144]=He):He=e[144],q=I.map(He)}e[2]=n,e[3]=s,e[4]=r,e[5]=a,e[6]=f,e[7]=c,e[8]=p,e[9]=N,e[10]=q,e[11]=M,e[12]=o,e[13]=k,e[14]=x,e[15]=b}else f=e[6],c=e[7],p=e[8],N=e[9],q=e[10],M=e[11],o=e[12],k=e[13],x=e[14],b=e[15];if(p!==Symbol.for("react.early_return_sentinel"))return p;let _;e[145]!==N||e[146]!==q?(_=(0,t.jsx)("div",{className:N,children:q}),e[145]=N,e[146]=q,e[147]=_):_=e[147];let D;e[148]!==f||e[149]!==_?(D=(0,t.jsx)(f,{children:_}),e[148]=f,e[149]=_,e[150]=D):D=e[150];let u;e[151]!==c||e[152]!==D||e[153]!==M?(u=(0,t.jsxs)(c,{children:[M,D]}),e[151]=c,e[152]=D,e[153]=M,e[154]=u):u=e[154];let C;return e[155]!==u||e[156]!==o||e[157]!==k||e[158]!==x||e[159]!==b?(C=(0,t.jsxs)("div",{className:o,"data-testid":k,children:[x,b,u]}),e[155]=u,e[156]=o,e[157]=k,e[158]=x,e[159]=b,e[160]=C):C=e[160],C},"ar");function nr(l){return Xe(l.avgDurationMs)==="critical"}d(nr,"ir");function ir(l){return Xe(l.avgDurationMs)==="warning"}d(ir,"nr");function or(l){return Xe(l.avgDurationMs)==="good"}d(or,"or");var dr=["1m","5m","15m","1h"],cr=d(l=>new Date(l).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),"dr"),mr=d(l=>l.map(e=>({avg:Math.round(e.avgDurationMs*100)/100,execs:e.execCount,label:cr(e.bucketMs)})),"mr"),ur=d(({shardKey:l=""})=>{let e=ge(),[s,a]=(0,B.useState)("15m"),r=$e(Ke.getQueryInsights,{range:s},{live:!0,shardKey:l}).data,h=mr(r?.buckets??[]);return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"qi-range",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("div",{className:"flex gap-1 rounded-lg border border-border p-0.5","data-testid":"qi-ranges",role:"group",children:dr.map(i=>(0,t.jsx)("button",{"aria-pressed":i===s,className:ut("rounded px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",i===s&&"bg-accent font-medium text-foreground"),"data-testid":`qi-range-${i}`,onClick:d(()=>{a(i)},"onClick"),type:"button",children:i},i))}),r?.capped===!0&&(0,t.jsx)(Ge,{"data-testid":"qi-capped",variant:"secondary",children:e("showing a capped set")})]}),h.length===0?(0,t.jsx)(gt,{description:e("Statements executed in the selected window appear here, with throughput and latency over time."),testId:"qi-empty",title:e("No queries in this window.")}):(0,t.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,t.jsxs)("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-throughput",children:[(0,t.jsx)("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Throughput")}),(0,t.jsx)(Ze,{height:140,width:"100%",children:(0,t.jsxs)(St,{data:h,children:[(0,t.jsx)(tt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(rt,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(at,{allowDecimals:!1,fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(et,{}),(0,t.jsx)(yt,{dataKey:"execs",fill:"var(--color-primary)",fillOpacity:.15,stroke:"var(--color-primary)",type:"monotone"})]})})]}),(0,t.jsxs)("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-latency",children:[(0,t.jsx)("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Mean latency (ms)")}),(0,t.jsx)(Ze,{height:140,width:"100%",children:(0,t.jsxs)(wt,{data:h,children:[(0,t.jsx)(tt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(rt,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(at,{fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(et,{}),(0,t.jsx)(Nt,{dataKey:"avg",dot:!1,stroke:"var(--color-destructive)",type:"monotone"})]})})]})]}),(0,t.jsx)(lr,{queryStats:r?.entries??[]})]})},"ur"),hr=ft(Ke.getMetrics),gr=d((l,e)=>l?e:"overview","hr"),Or=d(({initialShardKey:l})=>{let e=mt(),s=ge(),{queryShardKey:a,setShardKey:r,shardKey:h}=Mt(l),[i,n]=(0,B.useState)("overview"),[g,v]=(0,B.useState)([]),S=(0,B.useRef)(null),f=(0,B.useRef)(null),c=(0,B.useRef)(!0);(0,B.useEffect)(()=>(c.current=!0,()=>{c.current=!1}),[]);let p=Lt(a),{data:N,error:q,liveError:M}=$e(Ke.getMetrics,{},{live:!0,shardKey:a}),o=N??null;(0,B.useEffect)(()=>{if(N===void 0)return;kt(a);let L=N,U=S.current,Q=f.current!==null&&f.current!==L.shard;if(f.current=L.shard,S.current=L.requests,Q){v([]);return}U!==null&&L.requests>=U&&v(K=>[...K,L.requests-U].slice(-30))},[N,a]);let[k,x]=(0,B.useState)(null),[b,_]=(0,B.useState)(!1),D=d(async()=>{_(!0);let L=h,U=At(L,qt());try{let Q=await Promise.all(U.map(async K=>{try{let O=await e.query(hr,{},pt(K));return{error:null,metrics:O,shard:K===""?O.shard:K}}catch(O){return{error:xt(O),metrics:null,shard:K===""?"__root__":K}}}));c.current&&x({results:Q,shard:L})}finally{c.current&&_(!1)}},"R"),u=k?.shard===h?k.results:null,C=u===null?null:Kt(u),I=o===null||o.requests===0?"\u2014":`${(o.errors/o.requests*100).toFixed(1)}%`,R=g.length>0?g.at(-1):0,T=o?Pt(o):{p90:0,p95:0},w=(0,B.useMemo)(()=>{if(!o||!("queryStats"in o))return;let L=o.queryStats;if(!(!L||!Array.isArray(L)))return $t(L)},[o]),y=gr(w!==void 0,i),F=d(()=>{vt(D())},"A"),A=d(()=>{x(null)},"F"),P=d(()=>{n("overview")},"z"),$=d(()=>{n("query-insights")},"O");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(_t,{onChange:r,testId:"mt-shard-input",value:h}),(0,t.jsx)(Dt,{message:M,prefix:"mt"}),(0,t.jsx)(Je,{"data-testid":"mt-aggregate",disabled:b,onClick:F,size:"sm",type:"button",variant:"secondary",children:s(b?"Aggregating\u2026":"All shards")}),u!==null&&(0,t.jsx)(Je,{"data-testid":"mt-aggregate-clear",onClick:A,size:"sm",type:"button",variant:"ghost",children:s("Hide")}),(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:Ct,rel:"noreferrer",target:"_blank",children:s("Open in Cloudflare")})]}),q!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:q}),w!==void 0&&(0,t.jsxs)("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[(0,t.jsx)("button",{className:`pb-2 text-sm font-medium transition-colors ${y==="overview"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-overview",onClick:P,type:"button",children:s("Overview")}),(0,t.jsxs)("button",{className:`pb-2 text-sm font-medium transition-colors ${y==="query-insights"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-query-insights",onClick:$,type:"button",children:[s("Query insights"),w.length>0&&(0,t.jsx)("span",{className:"ml-1.5 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:w.length})]})]}),y==="query-insights"&&w!==void 0&&(0,t.jsx)(ur,{shardKey:a}),y==="overview"&&o!==null&&(0,t.jsx)(rr,{currentDelta:R,errorRate:I,history:g,latencyPercentiles:T,metrics:o}),y==="overview"&&o===null&&null,y==="overview"&&(0,t.jsx)(er,{onOpenTrace:p,shardKey:a}),y==="overview"&&C!==null&&u!==null&&(0,t.jsx)(tr,{aggregate:C,shardResults:u})]})},"Qr");export{Or as MetricsPanel};