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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/README.md +3 -3
  2. package/dist/index.d.mts +9 -8
  3. package/dist/index.d.ts +9 -8
  4. package/dist/index.mjs +1 -1
  5. package/dist/mount.d.mts +3 -2
  6. package/dist/mount.d.ts +3 -2
  7. package/dist/mount.mjs +1 -1
  8. package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -1
  9. package/dist/packem_chunks/ApiTab.mjs +1 -1
  10. package/dist/packem_chunks/AuditPanel.mjs +1 -1
  11. package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -1
  12. package/dist/packem_chunks/ExportImportPanel.mjs +5 -5
  13. package/dist/packem_chunks/FileBrowser.mjs +3 -3
  14. package/dist/packem_chunks/FunctionRunner.mjs +1 -1
  15. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -1
  16. package/dist/packem_chunks/HealthPanel.mjs +1 -1
  17. package/dist/packem_chunks/InsightsPanel.mjs +1 -1
  18. package/dist/packem_chunks/LogsPanel.mjs +1 -1
  19. package/dist/packem_chunks/MailPanel.mjs +1 -1
  20. package/dist/packem_chunks/MetricsPanel.mjs +1 -1
  21. package/dist/packem_chunks/NotificationsPanel.mjs +1 -1
  22. package/dist/packem_chunks/PitrPanel.mjs +1 -1
  23. package/dist/packem_chunks/SchemaViewer.mjs +1 -1
  24. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -1
  25. package/dist/packem_chunks/SettingsPanel.mjs +1 -1
  26. package/dist/packem_chunks/SqlEditorPanel.mjs +7 -7
  27. package/dist/packem_chunks/TableEditor.mjs +1 -1
  28. package/dist/packem_chunks/agents-panel.mjs +1 -1
  29. package/dist/packem_chunks/ai-usage-panel.mjs +1 -1
  30. package/dist/packem_chunks/analytics-panel.mjs +1 -1
  31. package/dist/packem_chunks/architecture-panel.mjs +1 -1
  32. package/dist/packem_chunks/auth-audit-panel.mjs +1 -1
  33. package/dist/packem_chunks/auth-config-panel.mjs +1 -1
  34. package/dist/packem_chunks/auth-sessions-panel.mjs +1 -1
  35. package/dist/packem_chunks/containers-panel.mjs +1 -1
  36. package/dist/packem_chunks/dashboards-panel.mjs +1 -1
  37. package/dist/packem_chunks/evals-panel.mjs +1 -1
  38. package/dist/packem_chunks/fanout-panel.mjs +1 -1
  39. package/dist/packem_chunks/flags-panel.mjs +1 -1
  40. package/dist/packem_chunks/issues-panel.mjs +1 -1
  41. package/dist/packem_chunks/kv-browser.mjs +1 -1
  42. package/dist/packem_chunks/log-drains-panel.mjs +1 -1
  43. package/dist/packem_chunks/migrations-route.mjs +1 -1
  44. package/dist/packem_chunks/organizations-panel.mjs +1 -1
  45. package/dist/packem_chunks/payments-panel.mjs +1 -1
  46. package/dist/packem_chunks/permissions-panel.mjs +1 -1
  47. package/dist/packem_chunks/privacy-requests-panel.mjs +1 -1
  48. package/dist/packem_chunks/queues-panel.mjs +1 -1
  49. package/dist/packem_chunks/reactors-panel.mjs +1 -1
  50. package/dist/packem_chunks/rls-panel.mjs +1 -1
  51. package/dist/packem_chunks/schedule-panel.mjs +1 -1
  52. package/dist/packem_chunks/storage-rules-panel.mjs +1 -1
  53. package/dist/packem_chunks/subscriptions-panel.mjs +1 -1
  54. package/dist/packem_chunks/sync-client-panel.mjs +1 -1
  55. package/dist/packem_chunks/theme-indicator.mjs +1 -0
  56. package/dist/packem_chunks/traces-panel.mjs +1 -1
  57. package/dist/packem_chunks/users-panel.mjs +1 -1
  58. package/dist/packem_chunks/vector-browser.mjs +1 -1
  59. package/dist/packem_chunks/workflows-panel.mjs +1 -1
  60. package/dist/packem_shared/{ApiDocsPanel-Py7C4ibM.mjs → ApiDocsPanel-B_RaW7Br.mjs} +2 -2
  61. package/dist/packem_shared/ApiReferencePanel-u9Rrljdf.mjs +1 -0
  62. package/dist/packem_shared/{CommandPalette-CM1hqAOD.mjs → CommandPalette-5OsK8PNe.mjs} +1 -1
  63. package/dist/packem_shared/{ConfirmButton-DU4p72Er.mjs → ConfirmButton-CIXYF6Mg.mjs} +1 -1
  64. package/dist/packem_shared/{ConnectionBadge-B8Hj5DaE.mjs → ConnectionBadge-BfcoN-VE.mjs} +1 -1
  65. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-CG7Q45ZS.mjs +1 -0
  66. package/dist/packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs +1 -0
  67. package/dist/packem_shared/{DataBrowser-DFjQeYYF.mjs → DataBrowser-Cc1qZX-4.mjs} +1 -1
  68. package/dist/packem_shared/{DataFilters-faurWYyX.mjs → DataFilters--ocFTVT2.mjs} +1 -1
  69. package/dist/packem_shared/GlobalDataBrowser-Hq6gTlkb.mjs +1 -0
  70. package/dist/packem_shared/{HomePanel-C8sb1fFJ.mjs → HomePanel-DeyYLVxc.mjs} +1 -1
  71. package/dist/packem_shared/MigrationsPanel-CMZYYcQ5.mjs +1 -0
  72. package/dist/packem_shared/OpenRpcReferencePanel-E9cDfHRv.mjs +1 -0
  73. package/dist/packem_shared/ScheduledJobs-D4CUj7aX.mjs +1 -0
  74. package/dist/packem_shared/{ShardInput-C6mjgAh4.mjs → ShardInput-CoySruKZ.mjs} +1 -1
  75. package/dist/packem_shared/Studio-BhTqTeGb.mjs +1 -0
  76. package/dist/packem_shared/StudioApp-B1d0beD4.mjs +1 -0
  77. package/dist/packem_shared/{StudioI18nProvider-fVsCSs5L.mjs → StudioI18nProvider-CGXCPnQn.mjs} +1 -1
  78. package/dist/packem_shared/{advisor-view-B8oIluyS.mjs → advisor-view-fNcNYW2Q.mjs} +1 -1
  79. package/dist/packem_shared/{app.d-D45VvUTx.d.mts → app.d-D425h1XO.d.mts} +4 -3
  80. package/dist/packem_shared/{app.d-D45VvUTx.d.ts → app.d-D425h1XO.d.ts} +4 -3
  81. package/dist/packem_shared/{auth-pager-DiDnXsfe.mjs → auth-pager-DW77WeZw.mjs} +1 -1
  82. package/dist/packem_shared/{data-grid-BHTuvSI7.mjs → data-grid-r3isM8Nq.mjs} +1 -1
  83. package/dist/packem_shared/{diagram-export-panel-BMLzao0Y.mjs → diagram-export-panel-aBDQdX4e.mjs} +1 -1
  84. package/dist/packem_shared/{error-alert-CNQjdAhi.mjs → error-alert-54TiaMvZ.mjs} +1 -1
  85. package/dist/packem_shared/{grid-features-8DoaKdS1.mjs → grid-features-2c5SaBtH.mjs} +1 -1
  86. package/dist/packem_shared/{grid-pagination-DgzyzfBh.mjs → grid-pagination-DY2erU65.mjs} +1 -1
  87. package/dist/packem_shared/home-panel-0XMGe1hP.mjs +3 -0
  88. package/dist/packem_shared/{live-status-BuJdUZFU.mjs → live-status-D1GasNsH.mjs} +1 -1
  89. package/dist/packem_shared/{recording-client-neIRrUNz.mjs → recording-client-MbGZ28I0.mjs} +1 -1
  90. package/dist/packem_shared/{reference-view-BrsL8UGn.mjs → reference-view-DCEC5kjY.mjs} +4 -4
  91. package/dist/packem_shared/{schema-diagram-ghsOCED7.mjs → schema-diagram-k7cFl7Wp.mjs} +1 -1
  92. package/dist/packem_shared/{sql-result-table-COsfUSGc.mjs → sql-result-table-CatgdmMh.mjs} +1 -1
  93. package/dist/packem_shared/studio-CA3ZKwVK.mjs +2 -0
  94. package/dist/packem_shared/{table-list-sidebar-B7IOSxLN.mjs → table-list-sidebar-nA7g7uSk.mjs} +1 -1
  95. package/dist/packem_shared/use-admin-query-BW9IuacC.mjs +1 -0
  96. package/dist/packem_shared/use-auth-config-KO9tnI39.mjs +1 -0
  97. package/dist/packem_shared/use-sql-assistant-DXnqbBs-.mjs +1 -0
  98. package/dist/packem_shared/use-studio-client-DCA50tF2.mjs +1 -0
  99. package/dist/standalone/chunk-26OKWFLO.js +1 -0
  100. package/dist/standalone/chunk-2EL4EMYZ.js +1 -0
  101. package/dist/standalone/chunk-2O6KKVH2.js +1 -0
  102. package/dist/standalone/{chunk-WX647YQ7.js → chunk-2WNL74MI.js} +3 -3
  103. package/dist/standalone/chunk-2X6O33OX.js +1 -0
  104. package/dist/standalone/chunk-2ZO7XY3Z.js +1 -0
  105. package/dist/standalone/{chunk-Y3AYVFTK.js → chunk-3GXPALXG.js} +1 -1
  106. package/dist/standalone/chunk-3Y5K3IQO.js +1 -0
  107. package/dist/standalone/{chunk-BOMPSVRC.js → chunk-4C4THJUD.js} +1 -1
  108. package/dist/standalone/{chunk-WVWCUB4S.js → chunk-4IEMXFUB.js} +1 -1
  109. package/dist/standalone/{chunk-5B2RTXBS.js → chunk-4SQBAPY6.js} +1 -1
  110. package/dist/standalone/{chunk-R6U22RSY.js → chunk-5DNGK3NT.js} +1 -1
  111. package/dist/standalone/{chunk-WOEHFC4J.js → chunk-5J32EGHF.js} +1 -1
  112. package/dist/standalone/chunk-5NZWQEEJ.js +1 -0
  113. package/dist/standalone/chunk-6I42AM75.js +1 -0
  114. package/dist/standalone/{chunk-RGMVGZV4.js → chunk-6M7FLLMT.js} +1 -1
  115. package/dist/standalone/{chunk-IWZ7GVQO.js → chunk-6QEXGYWH.js} +1 -1
  116. package/dist/standalone/chunk-7AZYREIY.js +1 -0
  117. package/dist/standalone/{chunk-G43F7LYA.js → chunk-7F3S5OQT.js} +1 -1
  118. package/dist/standalone/chunk-7MN724WR.js +1 -0
  119. package/dist/standalone/{chunk-Q6IT6ZD7.js → chunk-7RGYCU6F.js} +1 -1
  120. package/dist/standalone/{chunk-NRP22GKC.js → chunk-A566HCBX.js} +1 -1
  121. package/dist/standalone/{chunk-253UHWDX.js → chunk-AOHKAKKL.js} +1 -1
  122. package/dist/standalone/{chunk-OYCUPD3Q.js → chunk-AP4PC2M4.js} +1 -1
  123. package/dist/standalone/chunk-B3AXFXAD.js +1 -0
  124. package/dist/standalone/chunk-B7MHW3A5.js +1 -0
  125. package/dist/standalone/{chunk-CWPBPBWJ.js → chunk-BHOLL76W.js} +6 -6
  126. package/dist/standalone/{chunk-I57ZVLUB.js → chunk-BTRYFPZH.js} +1 -1
  127. package/dist/standalone/chunk-BVKQA5OL.js +1 -0
  128. package/dist/standalone/chunk-CGZVMM3P.js +1 -0
  129. package/dist/standalone/chunk-CIVMATZK.js +3 -0
  130. package/dist/standalone/chunk-CLINNLLE.js +1 -0
  131. package/dist/standalone/chunk-CTE6RPXC.js +1 -0
  132. package/dist/standalone/chunk-CW57Q264.js +1 -0
  133. package/dist/standalone/chunk-D7JK65OK.js +1 -0
  134. package/dist/standalone/{chunk-FUYEZFBP.js → chunk-DBVJ5VLI.js} +1 -1
  135. package/dist/standalone/{chunk-XCYFP44W.js → chunk-DS7HZKZ2.js} +1 -1
  136. package/dist/standalone/{chunk-2WDKJ74A.js → chunk-DX55P3KZ.js} +1 -1
  137. package/dist/standalone/{chunk-55UGUCQ6.js → chunk-E26OT26O.js} +1 -1
  138. package/dist/standalone/{chunk-YUPEDAX3.js → chunk-E32FS6PE.js} +2 -2
  139. package/dist/standalone/chunk-E3VSRIQU.js +1 -0
  140. package/dist/standalone/chunk-EDGOSJXL.js +1 -0
  141. package/dist/standalone/chunk-EOR73TZZ.js +1 -0
  142. package/dist/standalone/chunk-F5LTDUMB.js +1 -0
  143. package/dist/standalone/chunk-FLVDICZL.js +1 -0
  144. package/dist/standalone/{chunk-5J4FLDJH.js → chunk-FPIUVV7Q.js} +1 -1
  145. package/dist/standalone/chunk-GMW2DYFU.js +1 -0
  146. package/dist/standalone/{chunk-VFFW3ANI.js → chunk-GPOSJNMV.js} +5 -5
  147. package/dist/standalone/chunk-GQYA5W5T.js +1 -0
  148. package/dist/standalone/chunk-HFYFYNSX.js +1 -0
  149. package/dist/standalone/chunk-HKLF627N.js +1 -0
  150. package/dist/standalone/{chunk-PSMQQV6S.js → chunk-HKPDPKXD.js} +1 -1
  151. package/dist/standalone/chunk-HLAAOW33.js +1 -0
  152. package/dist/standalone/{chunk-75M6ZLLS.js → chunk-HOPAJ5F6.js} +2 -2
  153. package/dist/standalone/{chunk-7Y3SY37W.js → chunk-IBJVVHV5.js} +1 -1
  154. package/dist/standalone/{chunk-VESGIGMQ.js → chunk-IH2CJZF2.js} +1 -1
  155. package/dist/standalone/chunk-JAHK7RRJ.js +1 -0
  156. package/dist/standalone/chunk-JG2C7SS2.js +1 -0
  157. package/dist/standalone/chunk-JGMQQ3S7.js +1 -0
  158. package/dist/standalone/{chunk-3YXASVTP.js → chunk-JTGGWF7R.js} +1 -1
  159. package/dist/standalone/chunk-KFNDET5D.js +1 -0
  160. package/dist/standalone/{chunk-NXQW5E6W.js → chunk-KRPXOSBL.js} +1 -1
  161. package/dist/standalone/{chunk-7Q256NLI.js → chunk-KYONGQQ4.js} +1 -1
  162. package/dist/standalone/{chunk-OPM7ESDV.js → chunk-LIGOLZND.js} +1 -1
  163. package/dist/standalone/{chunk-VQRCJJXS.js → chunk-LKCO3E2B.js} +1 -1
  164. package/dist/standalone/chunk-LOV52GLG.js +1 -0
  165. package/dist/standalone/chunk-LPINY2IJ.js +19 -0
  166. package/dist/standalone/{chunk-XKISL2CG.js → chunk-LRXCL6IA.js} +1 -1
  167. package/dist/standalone/{chunk-OQ6I6OXT.js → chunk-LUHXNZI4.js} +1 -1
  168. package/dist/standalone/chunk-MD67S53Z.js +1 -0
  169. package/dist/standalone/{chunk-HIJGQX6F.js → chunk-MDAXV2XH.js} +1 -1
  170. package/dist/standalone/{chunk-ZN7TURF4.js → chunk-MFNO5BFR.js} +1 -1
  171. package/dist/standalone/chunk-MMJTKSHL.js +1 -0
  172. package/dist/standalone/chunk-NMVFSJM7.js +1 -0
  173. package/dist/standalone/chunk-NVHHB5EV.js +2 -0
  174. package/dist/standalone/chunk-O3FDK56W.js +1 -0
  175. package/dist/standalone/{chunk-C7FJ2JKY.js → chunk-OECMBE6Q.js} +1 -1
  176. package/dist/standalone/chunk-OSJ7HV7B.js +1 -0
  177. package/dist/standalone/chunk-OUFWXYEF.js +1 -0
  178. package/dist/standalone/chunk-OXFKZ4BM.js +1 -0
  179. package/dist/standalone/{chunk-63QLK2KW.js → chunk-P5GAJKDW.js} +1 -1
  180. package/dist/standalone/chunk-P6L6ABWO.js +1 -0
  181. package/dist/standalone/chunk-PZZWUL5U.js +1 -0
  182. package/dist/standalone/chunk-QAQVT4FS.js +1 -0
  183. package/dist/standalone/{chunk-VCFEO3RI.js → chunk-R36QXQZX.js} +1 -1
  184. package/dist/standalone/chunk-R3KLR5EP.js +1 -0
  185. package/dist/standalone/chunk-RXVXXRYD.js +1 -0
  186. package/dist/standalone/chunk-S7XAAH7U.js +1 -0
  187. package/dist/standalone/{chunk-E4PXACVL.js → chunk-SDQH4HR6.js} +1 -1
  188. package/dist/standalone/chunk-SFY646MC.js +1 -0
  189. package/dist/standalone/{chunk-VDC6JP4A.js → chunk-SJLEEYCR.js} +1 -1
  190. package/dist/standalone/{chunk-ZKJS6EBE.js → chunk-SLIDAWNX.js} +1 -1
  191. package/dist/standalone/chunk-SOO2HXV6.js +1 -0
  192. package/dist/standalone/chunk-SXD6JQXF.js +1 -0
  193. package/dist/standalone/{chunk-AUGKHAMQ.js → chunk-SYGCASPT.js} +1 -1
  194. package/dist/standalone/{chunk-2I4NHEKA.js → chunk-TDVDZ7XQ.js} +1 -1
  195. package/dist/standalone/chunk-TRZTGE4R.js +1 -0
  196. package/dist/standalone/chunk-TWMS2TMF.js +1 -0
  197. package/dist/standalone/chunk-U76DVXTR.js +21 -0
  198. package/dist/standalone/chunk-UTX6IBA3.js +1 -0
  199. package/dist/standalone/chunk-UZIBQZ2F.js +1 -0
  200. package/dist/standalone/chunk-VB6YJKPA.js +1 -0
  201. package/dist/standalone/{chunk-CVXNHIQW.js → chunk-VEWQWS3J.js} +1 -1
  202. package/dist/standalone/{chunk-UC7MNI2F.js → chunk-W2BCSK5S.js} +1 -1
  203. package/dist/standalone/chunk-W2XSKODB.js +1 -0
  204. package/dist/standalone/{chunk-MVWZMWPD.js → chunk-W7MRISE3.js} +1 -1
  205. package/dist/standalone/chunk-W7Z35E2E.js +1 -0
  206. package/dist/standalone/chunk-WIET27J3.js +1 -0
  207. package/dist/standalone/chunk-WQGT24W6.js +1 -0
  208. package/dist/standalone/{chunk-GZEWLX7U.js → chunk-WS36BO4R.js} +1 -1
  209. package/dist/standalone/chunk-WZTY3ZYI.js +1 -0
  210. package/dist/standalone/chunk-X5KWBDTF.js +1 -0
  211. package/dist/standalone/chunk-X74GEPSG.js +1 -0
  212. package/dist/standalone/chunk-XBZUJDHD.js +1 -0
  213. package/dist/standalone/chunk-XMEVNOCA.js +1 -0
  214. package/dist/standalone/chunk-XWEDIIIT.js +1 -0
  215. package/dist/standalone/{chunk-GHQ2VDI2.js → chunk-XYR5NST4.js} +1 -1
  216. package/dist/standalone/{chunk-XGCIDUJF.js → chunk-YHTHRYP5.js} +1 -1
  217. package/dist/standalone/{chunk-RX755NMO.js → chunk-YJ2WHOGO.js} +1 -1
  218. package/dist/standalone/chunk-YJWR6ZWC.js +1 -0
  219. package/dist/standalone/{chunk-CGQMJYCW.js → chunk-Z5EV64KS.js} +1 -1
  220. package/dist/standalone/{chunk-LVIL2SFA.js → chunk-ZBFWT34B.js} +1 -1
  221. package/dist/standalone/{chunk-AUAECCXB.js → chunk-ZBON5T5A.js} +1 -1
  222. package/dist/standalone/chunk-ZGSL4DPP.js +1 -0
  223. package/dist/standalone/chunk-ZMQ6PKLN.js +1 -0
  224. package/dist/standalone/{chunk-SJQERRSZ.js → chunk-ZTOREMGH.js} +1 -1
  225. package/dist/standalone/chunk-ZTOXQK4V.js +1 -0
  226. package/dist/standalone/chunk-ZWDORIZY.js +1 -0
  227. package/dist/standalone/chunk-ZZAJHNZ6.js +1 -0
  228. package/dist/standalone/studio.js +1 -1
  229. package/package.json +5 -5
  230. package/dist/packem_chunks/sparkline.mjs +0 -1
  231. package/dist/packem_shared/ApiReferencePanel-DlYVADAy.mjs +0 -1
  232. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-DvhNw0BI.mjs +0 -1
  233. package/dist/packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs +0 -1
  234. package/dist/packem_shared/GlobalDataBrowser-CPfjubP_.mjs +0 -1
  235. package/dist/packem_shared/MigrationsPanel-Dzjf42y8.mjs +0 -1
  236. package/dist/packem_shared/OpenRpcReferencePanel-nYyfjjse.mjs +0 -1
  237. package/dist/packem_shared/ScheduledJobs-BJ1uZW1U.mjs +0 -1
  238. package/dist/packem_shared/Studio-CgqntIfx.mjs +0 -1
  239. package/dist/packem_shared/StudioApp-DfFjQPGJ.mjs +0 -1
  240. package/dist/packem_shared/home-panel-BJXZsAaD.mjs +0 -3
  241. package/dist/packem_shared/studio-CFSjGWyw.mjs +0 -2
  242. package/dist/packem_shared/use-admin-query-CLStXJ7v.mjs +0 -1
  243. package/dist/packem_shared/use-auth-config-DtZeS_qf.mjs +0 -1
  244. package/dist/packem_shared/use-sql-assistant-DxNeNdCs.mjs +0 -1
  245. package/dist/standalone/chunk-2IKDEUCX.js +0 -1
  246. package/dist/standalone/chunk-37WYCOQ2.js +0 -1
  247. package/dist/standalone/chunk-4H5PBJNF.js +0 -1
  248. package/dist/standalone/chunk-4UBF7HMZ.js +0 -1
  249. package/dist/standalone/chunk-533J6WYA.js +0 -1
  250. package/dist/standalone/chunk-5QR2SQIS.js +0 -1
  251. package/dist/standalone/chunk-5ZNIQENA.js +0 -1
  252. package/dist/standalone/chunk-63Z6OJ6G.js +0 -1
  253. package/dist/standalone/chunk-74IYYDDI.js +0 -19
  254. package/dist/standalone/chunk-7EHAUFJY.js +0 -2
  255. package/dist/standalone/chunk-7G4Z6Q7X.js +0 -1
  256. package/dist/standalone/chunk-7RKB5KS7.js +0 -1
  257. package/dist/standalone/chunk-7TN6VTTF.js +0 -1
  258. package/dist/standalone/chunk-AWWECTQT.js +0 -1
  259. package/dist/standalone/chunk-AXL4YZJR.js +0 -1
  260. package/dist/standalone/chunk-COK5BCWN.js +0 -1
  261. package/dist/standalone/chunk-CULVXE3K.js +0 -1
  262. package/dist/standalone/chunk-E4BAGQ53.js +0 -1
  263. package/dist/standalone/chunk-EBTYSPZB.js +0 -1
  264. package/dist/standalone/chunk-EC5PMSQ6.js +0 -1
  265. package/dist/standalone/chunk-ECY2JC5F.js +0 -1
  266. package/dist/standalone/chunk-EWMBX5N2.js +0 -1
  267. package/dist/standalone/chunk-FPI7AMQJ.js +0 -1
  268. package/dist/standalone/chunk-GC5UHRDR.js +0 -1
  269. package/dist/standalone/chunk-GRHO2IUN.js +0 -1
  270. package/dist/standalone/chunk-GUDC24NJ.js +0 -1
  271. package/dist/standalone/chunk-H467GBSD.js +0 -1
  272. package/dist/standalone/chunk-HBO4SMAO.js +0 -15
  273. package/dist/standalone/chunk-HBTGWHTW.js +0 -1
  274. package/dist/standalone/chunk-HCTJKP5J.js +0 -1
  275. package/dist/standalone/chunk-HZTJLEIJ.js +0 -1
  276. package/dist/standalone/chunk-I26MS5PJ.js +0 -1
  277. package/dist/standalone/chunk-IRKWOUXO.js +0 -1
  278. package/dist/standalone/chunk-IUSKFS3B.js +0 -1
  279. package/dist/standalone/chunk-K2EHRNYW.js +0 -1
  280. package/dist/standalone/chunk-L5MI4PTP.js +0 -1
  281. package/dist/standalone/chunk-LXCVA5SP.js +0 -1
  282. package/dist/standalone/chunk-LYQZERWS.js +0 -1
  283. package/dist/standalone/chunk-MPEIBWCJ.js +0 -1
  284. package/dist/standalone/chunk-NCFYQR4L.js +0 -1
  285. package/dist/standalone/chunk-NCPW7WHO.js +0 -1
  286. package/dist/standalone/chunk-NOS2OC45.js +0 -1
  287. package/dist/standalone/chunk-NQZALRU3.js +0 -1
  288. package/dist/standalone/chunk-OQ2ORNN6.js +0 -1
  289. package/dist/standalone/chunk-OVBYLXPD.js +0 -1
  290. package/dist/standalone/chunk-OWQHP4KI.js +0 -1
  291. package/dist/standalone/chunk-PKSRXFSZ.js +0 -1
  292. package/dist/standalone/chunk-Q6ED4KUL.js +0 -1
  293. package/dist/standalone/chunk-QAQDMS6R.js +0 -1
  294. package/dist/standalone/chunk-QC2GLF3I.js +0 -1
  295. package/dist/standalone/chunk-QFK4UI4Q.js +0 -1
  296. package/dist/standalone/chunk-QJ4AALXU.js +0 -1
  297. package/dist/standalone/chunk-QJLHH3ET.js +0 -1
  298. package/dist/standalone/chunk-R3RBUT32.js +0 -1
  299. package/dist/standalone/chunk-RNYOBPQA.js +0 -1
  300. package/dist/standalone/chunk-RWVIV3U7.js +0 -1
  301. package/dist/standalone/chunk-RYBLB23Z.js +0 -1
  302. package/dist/standalone/chunk-S3EWTSAN.js +0 -1
  303. package/dist/standalone/chunk-S4AR74DJ.js +0 -3
  304. package/dist/standalone/chunk-S4Z7K55A.js +0 -1
  305. package/dist/standalone/chunk-SA2OGF3F.js +0 -1
  306. package/dist/standalone/chunk-SFMIR4YV.js +0 -1
  307. package/dist/standalone/chunk-SROQCZ3P.js +0 -1
  308. package/dist/standalone/chunk-T4SIZOJG.js +0 -1
  309. package/dist/standalone/chunk-U37BPX5J.js +0 -1
  310. package/dist/standalone/chunk-UFZVSXRW.js +0 -1
  311. package/dist/standalone/chunk-UQWGBWQ3.js +0 -1
  312. package/dist/standalone/chunk-V6LPISRQ.js +0 -1
  313. package/dist/standalone/chunk-WEPM5G3R.js +0 -1
  314. package/dist/standalone/chunk-WGBAHXMK.js +0 -1
  315. package/dist/standalone/chunk-WGUN4FNJ.js +0 -1
  316. package/dist/standalone/chunk-WJRYEML4.js +0 -1
  317. package/dist/standalone/chunk-WNMY5ZKL.js +0 -1
  318. package/dist/standalone/chunk-YBDF3DET.js +0 -7
  319. package/dist/standalone/chunk-YJI56OCF.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as Pt,b as jt,c as ot}from"./chunk-VEWQWS3J.js";import{a as de}from"./chunk-AOHKAKKL.js";import{a as Et,b as Ot,c as Dt,d as Ft}from"./chunk-TDVDZ7XQ.js";import{a as it}from"./chunk-XWEDIIIT.js";import{a as rt,b as at,c as st,d as At,e as zt,f as lt,g as nt,h as Kt,i as Lt}from"./chunk-ZBFWT34B.js";import{a as Rt}from"./chunk-R36QXQZX.js";import{a as $t}from"./chunk-TRZTGE4R.js";import"./chunk-IH2CJZF2.js";import{e as _t}from"./chunk-UYEZR3BI.js";import{a as kt,b as Ct,c as Mt,d as It,e as je}from"./chunk-FLVDICZL.js";import"./chunk-A566HCBX.js";import"./chunk-SYGCASPT.js";import"./chunk-LIGOLZND.js";import{a as qt}from"./chunk-XBZUJDHD.js";import"./chunk-KRPXOSBL.js";import"./chunk-W2BCSK5S.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import"./chunk-ZGSL4DPP.js";import{a as wt}from"./chunk-5DNGK3NT.js";import{a as St}from"./chunk-KYONGQQ4.js";import{a as yt,b as Nt}from"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import"./chunk-LUHXNZI4.js";import"./chunk-ZTOREMGH.js";import"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as Ye}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as Ge}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import"./chunk-E26OT26O.js";import{a as Ee}from"./chunk-4ZEL6BYL.js";import{c as Fe}from"./chunk-YJ2WHOGO.js";import{d as ct,p as vt}from"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import{a as ht}from"./chunk-3Y5K3IQO.js";import{a as Ze,b as et,c as tt,d as Pe,e as oe,f as B}from"./chunk-CW57Q264.js";import{a as fe,b as Oe,c as De,d as ut,e as xe}from"./chunk-MD67S53Z.js";import{b as mt,f as he,h as gt,i as pt,j as ft,k as xt,o as Je,s as bt}from"./chunk-LPINY2IJ.js";import{a as b,d as Xe,e as Ut,f as Ht,g as Gt}from"./chunk-OXFKZ4BM.js";var me=Xe(Ht(),1),j=Xe(Ut(),1);var t=Xe(Gt(),1);var Bt=b((l,e,s)=>`${l}:${e}:${ct(s??{})}`,"ut"),Tt=b((l,e)=>l==="gauge"?e.last:l==="histogram"?e.sum/Math.max(1,e.count):e.sum,"ht"),Jt=b((l,e)=>Tt(l,e),"Vt"),Vt=b(l=>Tt(l.kind,l),"Gt"),dt=b(l=>Number.isInteger(l)?l.toLocaleString():l.toLocaleString(void 0,{maximumFractionDigits:2}),"Ye"),Wt=b(l=>Array.isArray(l?.series)?l.series:[],"Yt"),Xt="FUNCTION_NOT_FOUND",Yt=b(l=>{let e=new Map;if(!Array.isArray(l?.series))return e;for(let s of l.series)e.set(Bt(s.kind,s.name,s.attributes),s.points);return e},"Wt"),Zt={counter:"secondary",gauge:"default",histogram:"outline"},er=b(l=>{let e=(0,me.c)(18),{name:s,onOpenTrace:a,traceId:r}=l,o=he();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}`,d;return e[3]!==n||e[4]!==c||e[5]!==r?(d=(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]=d):d=e[6],d}let m=`mt-instrument-trace-${s}`,p;e[7]!==a||e[8]!==r?(p=b(()=>{a(r)},"p"),e[7]=a,e[8]=r,e[9]=p):p=e[9];let h;e[10]!==o||e[11]!==r?(h=o("Open the exemplar trace {trace}",{trace:r}),e[10]=o,e[11]=r,e[12]=h):h=e[12];let u;return e[13]!==n||e[14]!==m||e[15]!==p||e[16]!==h?(u=(0,t.jsx)("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":m,onClick:p,title:h,type:"button",children:n}),e[13]=n,e[14]=m,e[15]=p,e[16]=h,e[17]=u):u=e[17],u},"Zt"),tr=b(l=>{let e=(0,me.c)(105),{onOpenTrace:s,shardKey:a}=l,r=he(),o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={},e[0]=o):o=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:m,errorSource:p}=Fe(Ee.getMetricSeries,o,i),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let u;e[4]!==a?(u={live:!0,shardKey:a},e[4]=a,e[5]=u):u=e[5];let{data:c}=Fe(Ee.getMetricHistory,h,u),d,f,g,v,x,S,y,w,I,k,N,z,_;if(e[6]!==n||e[7]!==m||e[8]!==p||e[9]!==c||e[10]!==s||e[11]!==r){w=Symbol.for("react.early_return_sentinel");e:{let L=Wt(n),E=xt(p)===Xt;if(m!==null&&!E){let q;e[25]!==r?(q=r("Instruments"),e[25]=r,e[26]=q):q=e[26];let D;e[27]!==q?(D=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:q}),e[27]=q,e[28]=D):D=e[28];let F;e[29]!==m||e[30]!==r?(F=r("Instruments unavailable: {error}",{error:m}),e[29]=m,e[30]=r,e[31]=F):F=e[31];let P;e[32]!==F?(P=(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"mt-instruments-error",role:"status",children:F}),e[32]=F,e[33]=P):P=e[33];let ie;e[34]!==D||e[35]!==P?(ie=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[D,P]}),e[34]=D,e[35]=P,e[36]=ie):ie=e[36],w=ie;break e}if(L.length===0){w=null;break e}let O=Yt(c),ue;e[37]!==r?(ue=b(q=>r(q==="counter"?"Counter":q==="gauge"?"Gauge":"Histogram"),"de"),e[37]=r,e[38]=ue):ue=e[38];let ge=ue;x="flex flex-col gap-2",S="mt-instruments";let T;e[39]!==r?(T=r("Instruments"),e[39]=r,e[40]=T):T=e[40],e[41]!==T?(y=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:T}),e[41]=T,e[42]=y):y=e[42],v=fe,_="overflow-hidden py-0",g=xe,z="px-0",f=Ze,k="mt-instruments-table";let U;e[43]!==r?(U=r("name"),e[43]=r,e[44]=U):U=e[44];let H;e[45]!==U?(H=(0,t.jsx)(oe,{children:U}),e[45]=U,e[46]=H):H=e[46];let G;e[47]!==r?(G=r("kind"),e[47]=r,e[48]=G):G=e[48];let J;e[49]!==G?(J=(0,t.jsx)(oe,{children:G}),e[49]=G,e[50]=J):J=e[50];let V;e[51]!==r?(V=r("value"),e[51]=r,e[52]=V):V=e[52];let W;e[53]!==V?(W=(0,t.jsx)(oe,{className:"text-right",children:V}),e[53]=V,e[54]=W):W=e[54];let X;e[55]!==r?(X=r("count"),e[55]=r,e[56]=X):X=e[56];let Y;e[57]!==X?(Y=(0,t.jsx)(oe,{className:"text-right",children:X}),e[57]=X,e[58]=Y):Y=e[58];let Z;e[59]!==r?(Z=r("range"),e[59]=r,e[60]=Z):Z=e[60];let ee;e[61]!==Z?(ee=(0,t.jsx)(oe,{className:"text-right",children:Z}),e[61]=Z,e[62]=ee):ee=e[62];let te;e[63]!==r?(te=r("trend"),e[63]=r,e[64]=te):te=e[64];let re;e[65]!==te?(re=(0,t.jsx)(oe,{children:te}),e[65]=te,e[66]=re):re=e[66];let ae;e[67]!==r?(ae=r("trace"),e[67]=r,e[68]=ae):ae=e[68];let se;e[69]!==ae?(se=(0,t.jsx)(oe,{children:ae}),e[69]=ae,e[70]=se):se=e[70];let le;e[71]!==r?(le=r("dimensions"),e[71]=r,e[72]=le):le=e[72];let ne;e[73]!==le?(ne=(0,t.jsx)(oe,{children:le}),e[73]=le,e[74]=ne):ne=e[74],e[75]!==H||e[76]!==J||e[77]!==W||e[78]!==Y||e[79]!==ee||e[80]!==re||e[81]!==se||e[82]!==ne?(N=(0,t.jsx)(et,{children:(0,t.jsxs)(Pe,{children:[H,J,W,Y,ee,re,se,ne]})}),e[75]=H,e[76]=J,e[77]=W,e[78]=Y,e[79]=ee,e[80]=re,e[81]=se,e[82]=ne,e[83]=N):N=e[83],d=tt,I=L.map(q=>{let D=Rt(q.attributes),F=Bt(q.kind,q.name,q.attributes),P=(O.get(F)??[]).map(ie=>Jt(q.kind,ie));return(0,t.jsxs)(Pe,{"data-testid":`mt-instrument-${q.name}`,children:[(0,t.jsx)(B,{className:"font-mono text-xs",title:q.functionPath,children:q.name}),(0,t.jsx)(B,{children:(0,t.jsx)(Ge,{variant:Zt[q.kind],children:ge(q.kind)})}),(0,t.jsx)(B,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${q.name}`,children:dt(Vt(q))}),(0,t.jsx)(B,{className:"text-right tabular-nums text-muted-foreground",children:q.count.toLocaleString()}),(0,t.jsx)(B,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:q.min===q.max?"\u2014":`${dt(q.min)}\u2013${dt(q.max)}`}),(0,t.jsx)(B,{children:P.length>=2?(0,t.jsx)(it,{ariaLabel:r("{name} trend",{name:q.name}),className:"h-6 w-24 text-foreground",series:P,testId:`mt-instrument-trend-${q.name}`}):(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(B,{className:"font-mono text-xs",children:(0,t.jsx)(er,{name:q.name,onOpenTrace:s,traceId:q.exemplarTraceId})}),(0,t.jsx)(B,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:D,children:D===""?"\u2014":D})]},F)})}e[6]=n,e[7]=m,e[8]=p,e[9]=c,e[10]=s,e[11]=r,e[12]=d,e[13]=f,e[14]=g,e[15]=v,e[16]=x,e[17]=S,e[18]=y,e[19]=w,e[20]=I,e[21]=k,e[22]=N,e[23]=z,e[24]=_}else d=e[12],f=e[13],g=e[14],v=e[15],x=e[16],S=e[17],y=e[18],w=e[19],I=e[20],k=e[21],N=e[22],z=e[23],_=e[24];if(w!==Symbol.for("react.early_return_sentinel"))return w;let C;e[84]!==d||e[85]!==I?(C=(0,t.jsx)(d,{children:I}),e[84]=d,e[85]=I,e[86]=C):C=e[86];let R;e[87]!==f||e[88]!==C||e[89]!==k||e[90]!==N?(R=(0,t.jsxs)(f,{"data-testid":k,children:[N,C]}),e[87]=f,e[88]=C,e[89]=k,e[90]=N,e[91]=R):R=e[91];let M;e[92]!==g||e[93]!==R||e[94]!==z?(M=(0,t.jsx)(g,{className:z,children:R}),e[92]=g,e[93]=R,e[94]=z,e[95]=M):M=e[95];let $;e[96]!==v||e[97]!==M||e[98]!==_?($=(0,t.jsx)(v,{className:_,children:M}),e[96]=v,e[97]=M,e[98]=_,e[99]=$):$=e[99];let A;return e[100]!==x||e[101]!==S||e[102]!==y||e[103]!==$?(A=(0,t.jsxs)("section",{className:x,"data-testid":S,children:[y,$]}),e[100]=x,e[101]=S,e[102]=y,e[103]=$,e[104]=A):A=e[104],A},"es"),rr=b(l=>{let e=(0,me.c)(74),{aggregate:s,shardResults:a}=l,r=he(),o;e[0]!==r?(o=r("Shards"),e[0]=r,e[1]=o):o=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]!==o||e[7]!==i?(n=(0,t.jsx)(de,{label:o,testId:"mt-agg-shards",value:i}),e[6]=o,e[7]=i,e[8]=n):n=e[8];let m;e[9]!==r?(m=r("Total requests"),e[9]=r,e[10]=m):m=e[10];let p;e[11]!==s.totalRequests||e[12]!==m?(p=(0,t.jsx)(de,{label:m,testId:"mt-agg-requests",value:s.totalRequests}),e[11]=s.totalRequests,e[12]=m,e[13]=p):p=e[13];let h;e[14]!==r?(h=r("Total errors"),e[14]=r,e[15]=h):h=e[15];let u;e[16]!==s.totalErrors||e[17]!==h?(u=(0,t.jsx)(de,{label:h,testId:"mt-agg-errors",value:s.totalErrors}),e[16]=s.totalErrors,e[17]=h,e[18]=u):u=e[18];let c;e[19]!==r?(c=r("Total database size"),e[19]=r,e[20]=c):c=e[20];let d;e[21]!==s.totalDatabaseSize?(d=Je(s.totalDatabaseSize),e[21]=s.totalDatabaseSize,e[22]=d):d=e[22];let f;e[23]!==c||e[24]!==d?(f=(0,t.jsx)(de,{label:c,testId:"mt-agg-db-size",value:d}),e[23]=c,e[24]=d,e[25]=f):f=e[25];let g;e[26]!==r?(g=r("Combined cache hit rate"),e[26]=r,e[27]=g):g=e[27];let v;e[28]!==s.hitRate||e[29]!==r?(v=s.hitRate===null?r("no cache configured"):`${(s.hitRate*100).toFixed(1)}%`,e[28]=s.hitRate,e[29]=r,e[30]=v):v=e[30];let x;e[31]!==g||e[32]!==v?(x=(0,t.jsx)(de,{label:g,testId:"mt-agg-cache",value:v}),e[31]=g,e[32]=v,e[33]=x):x=e[33];let S;e[34]!==f||e[35]!==x||e[36]!==n||e[37]!==p||e[38]!==u?(S=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[n,p,u,f,x]}),e[34]=f,e[35]=x,e[36]=n,e[37]=p,e[38]=u,e[39]=S):S=e[39];let y;e[40]!==r?(y=r("shard"),e[40]=r,e[41]=y):y=e[41];let w;e[42]!==y?(w=(0,t.jsx)(oe,{children:y}),e[42]=y,e[43]=w):w=e[43];let I;e[44]!==r?(I=r("requests"),e[44]=r,e[45]=I):I=e[45];let k;e[46]!==I?(k=(0,t.jsx)(oe,{children:I}),e[46]=I,e[47]=k):k=e[47];let N;e[48]!==r?(N=r("errors"),e[48]=r,e[49]=N):N=e[49];let z;e[50]!==N?(z=(0,t.jsx)(oe,{children:N}),e[50]=N,e[51]=z):z=e[51];let _;e[52]!==r?(_=r("db size"),e[52]=r,e[53]=_):_=e[53];let C;e[54]!==_?(C=(0,t.jsx)(oe,{children:_}),e[54]=_,e[55]=C):C=e[55];let R;e[56]!==w||e[57]!==k||e[58]!==z||e[59]!==C?(R=(0,t.jsx)(et,{children:(0,t.jsxs)(Pe,{children:[w,k,z,C]})}),e[56]=w,e[57]=k,e[58]=z,e[59]=C,e[60]=R):R=e[60];let M;if(e[61]!==a||e[62]!==r){let E;e[64]!==r?(E=b(O=>(0,t.jsxs)(Pe,{"data-testid":`mt-agg-row-${O.shard}`,children:[(0,t.jsx)(B,{children:O.shard}),O.metrics===null?(0,t.jsx)(B,{className:"text-destructive",colSpan:3,children:O.error??r("unreachable")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B,{className:"tabular-nums",children:O.metrics.requests}),(0,t.jsx)(B,{className:"tabular-nums",children:O.metrics.errors}),(0,t.jsx)(B,{className:"tabular-nums",children:Je(O.metrics.databaseSize)})]})]},O.shard),"L"),e[64]=r,e[65]=E):E=e[65],M=a.map(E),e[61]=a,e[62]=r,e[63]=M}else M=e[63];let $;e[66]!==M?($=(0,t.jsx)(tt,{children:M}),e[66]=M,e[67]=$):$=e[67];let A;e[68]!==R||e[69]!==$?(A=(0,t.jsx)(fe,{className:"overflow-hidden py-0",children:(0,t.jsx)(xe,{className:"px-0",children:(0,t.jsxs)(Ze,{"data-testid":"mt-agg-table",children:[R,$]})})}),e[68]=R,e[69]=$,e[70]=A):A=e[70];let L;return e[71]!==S||e[72]!==A?(L=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[S,A]}),e[71]=S,e[72]=A,e[73]=L):L=e[73],L},"ts"),ar=b(l=>{let e=(0,me.c)(75),{currentDelta:s,errorRate:a,history:r,latencyPercentiles:o,metrics:i}=l,n=he(),{cache:m}=i,p;e[0]!==r||e[1]!==n?(p=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]=p):p=e[2];let h;e[3]!==s||e[4]!==r.length||e[5]!==n?(h=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]=h):h=e[6];let u;e[7]!==n?(u=n("Requests"),e[7]=n,e[8]=u):u=e[8];let c;e[9]!==i.requests||e[10]!==p||e[11]!==h||e[12]!==u?(c=(0,t.jsx)(de,{chart:p,footer:h,label:u,testId:"mt-requests",value:i.requests}),e[9]=i.requests,e[10]=p,e[11]=h,e[12]=u,e[13]=c):c=e[13];let d;e[14]!==a||e[15]!==n?(d=n("{rate} error rate",{rate:a}),e[14]=a,e[15]=n,e[16]=d):d=e[16];let f;e[17]!==n?(f=n("Errors"),e[17]=n,e[18]=f):f=e[18];let g;e[19]!==a||e[20]!==i.errors?(g=(0,t.jsxs)(t.Fragment,{children:[i.errors," (",a,")"]}),e[19]=a,e[20]=i.errors,e[21]=g):g=e[21];let v;e[22]!==d||e[23]!==f||e[24]!==g?(v=(0,t.jsx)(de,{footer:d,label:f,testId:"mt-errors",value:g}),e[22]=d,e[23]=f,e[24]=g,e[25]=v):v=e[25];let x;e[26]!==o.p90?(x=o.p90>0?`P90 ${ot(o.p90)}`:void 0,e[26]=o.p90,e[27]=x):x=e[27];let S;e[28]!==n?(S=n("P95 latency"),e[28]=n,e[29]=S):S=e[29];let y;e[30]!==o.p95?(y=o.p95>0?ot(o.p95):"\u2014",e[30]=o.p95,e[31]=y):y=e[31];let w;e[32]!==S||e[33]!==y||e[34]!==x?(w=(0,t.jsx)(de,{footer:x,label:S,testId:"mt-p95",value:y}),e[32]=S,e[33]=y,e[34]=x,e[35]=w):w=e[35];let I;e[36]!==m||e[37]!==n?(I=m?`${m.entries.toLocaleString()} ${n("cache entries")}`:void 0,e[36]=m,e[37]=n,e[38]=I):I=e[38];let k;e[39]!==n?(k=n("Database size"),e[39]=n,e[40]=k):k=e[40];let N;e[41]!==i.databaseSize?(N=Je(i.databaseSize),e[41]=i.databaseSize,e[42]=N):N=e[42];let z;e[43]!==I||e[44]!==k||e[45]!==N?(z=(0,t.jsx)(de,{footer:I,label:k,testId:"mt-db-size",value:N}),e[43]=I,e[44]=k,e[45]=N,e[46]=z):z=e[46];let _;e[47]!==n?(_=n("Shard"),e[47]=n,e[48]=_):_=e[48];let C;e[49]!==i.shard||e[50]!==_?(C=(0,t.jsx)(de,{label:_,testId:"mt-shard",value:i.shard}),e[49]=i.shard,e[50]=_,e[51]=C):C=e[51];let R;e[52]!==n?(R=n("Uptime"),e[52]=n,e[53]=R):R=e[53];let M;e[54]!==i.uptimeMs?(M=Pt(i.uptimeMs),e[54]=i.uptimeMs,e[55]=M):M=e[55];let $;e[56]!==R||e[57]!==M?($=(0,t.jsx)(de,{label:R,testId:"mt-uptime",value:M}),e[56]=R,e[57]=M,e[58]=$):$=e[58];let A;e[59]!==n?(A=n("Cache hit rate"),e[59]=n,e[60]=A):A=e[60];let L;e[61]!==m||e[62]!==n?(L=m?n("{rate} ({count} entries)",{count:m.entries,rate:jt(m.hits,m.misses)}):n("no cache configured"),e[61]=m,e[62]=n,e[63]=L):L=e[63];let E;e[64]!==A||e[65]!==L?(E=(0,t.jsx)(de,{label:A,testId:"mt-cache",value:L}),e[64]=A,e[65]=L,e[66]=E):E=e[66];let O;return e[67]!==w||e[68]!==z||e[69]!==C||e[70]!==$||e[71]!==E||e[72]!==c||e[73]!==v?(O=(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,v,w,z,C,$,E]}),e[67]=w,e[68]=z,e[69]=C,e[70]=$,e[71]=E,e[72]=c,e[73]=v,e[74]=O):O=e[74],O},"ss"),We=b(l=>l>=100?"critical":l>=50?"warning":"good","Ge"),Qe=b(l=>l<1?`${(l*1e3).toFixed(0)}\u03BCs`:l<1e3?`${l.toFixed(1)}ms`:`${(l/1e3).toFixed(2)}s`,"Le"),Ve=b(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"),sr=b(l=>{let e=(0,me.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},"rs"),lr=b((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},"ls"),nr=b(l=>{let e=(0,me.c)(161),{queryStats:s}=l,a=he(),[r,o]=(0,j.useState)("totalTime"),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];let[n,m]=(0,j.useState)(i),p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=b(_=>{_!==null&&o(_)},"p"),e[1]=p):p=e[1];let h=p,u,c,d,f,g,v,x,S,y,w;if(e[2]!==n||e[3]!==s||e[4]!==r||e[5]!==a){d=Symbol.for("react.early_return_sentinel");e:{let _=lr(s,r),C;e[16]!==s?(C=s.filter(ir),e[16]=s,e[17]=C):C=e[17];let R=C.length,M;e[18]!==s?(M=s.filter(or),e[18]=s,e[19]=M):M=e[19];let $=M.length,A;e[20]!==s?(A=s.filter(dr),e[20]=s,e[21]=A):A=e[21];let L=A.length,E;e[22]===Symbol.for("react.memo_cache_sentinel")?(E=b(K=>{m(ce=>{let Q=new Set(ce);return Q.has(K)?Q.delete(K):Q.add(K),Q})},"L"),e[22]=E):E=e[22];let O=E;if(s.length===0){let K;e[23]!==a?(K=a("No query insights yet"),e[23]=a,e[24]=K):K=e[24];let ce;e[25]!==K?(ce=(0,t.jsx)("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:K}),e[25]=K,e[26]=ce):ce=e[26];let Q;e[27]!==a?(Q=a("Query insights appear once statements are executed against this shard."),e[27]=a,e[28]=Q):Q=e[28];let pe;e[29]!==Q?(pe=(0,t.jsx)("p",{className:"mt-1 text-sm",children:Q}),e[29]=Q,e[30]=pe):pe=e[30];let He;e[31]!==ce||e[32]!==pe?(He=(0,t.jsx)(fe,{children:(0,t.jsx)(xe,{className:"py-12",children:(0,t.jsxs)("div",{className:"text-center text-muted-foreground",children:[ce,pe]})})}),e[31]=ce,e[32]=pe,e[33]=He):He=e[33],d=He;break e}x="space-y-4",S="qi-root";let ue;e[34]!==a?(ue=a("Critical queries"),e[34]=a,e[35]=ue):ue=e[35];let ge;e[36]!==ue?(ge=(0,t.jsx)(Oe,{className:"pb-2",children:(0,t.jsx)(De,{className:"text-sm font-medium",children:ue})}),e[36]=ue,e[37]=ge):ge=e[37];let T;e[38]!==R?(T=(0,t.jsx)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:R}),e[38]=R,e[39]=T):T=e[39];let U;e[40]!==a?(U=a(">100ms avg execution"),e[40]=a,e[41]=U):U=e[41];let H;e[42]!==U?(H=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:U}),e[42]=U,e[43]=H):H=e[43];let G;e[44]!==T||e[45]!==H?(G=(0,t.jsxs)(xe,{children:[T,H]}),e[44]=T,e[45]=H,e[46]=G):G=e[46];let J;e[47]!==ge||e[48]!==G?(J=(0,t.jsxs)(fe,{children:[ge,G]}),e[47]=ge,e[48]=G,e[49]=J):J=e[49];let V;e[50]!==a?(V=a("Moderate queries"),e[50]=a,e[51]=V):V=e[51];let W;e[52]!==V?(W=(0,t.jsx)(Oe,{className:"pb-2",children:(0,t.jsx)(De,{className:"text-sm font-medium",children:V})}),e[52]=V,e[53]=W):W=e[53];let X;e[54]!==$?(X=(0,t.jsx)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:$}),e[54]=$,e[55]=X):X=e[55];let Y;e[56]!==a?(Y=a("50\u2013100ms avg execution"),e[56]=a,e[57]=Y):Y=e[57];let Z;e[58]!==Y?(Z=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:Y}),e[58]=Y,e[59]=Z):Z=e[59];let ee;e[60]!==X||e[61]!==Z?(ee=(0,t.jsxs)(xe,{children:[X,Z]}),e[60]=X,e[61]=Z,e[62]=ee):ee=e[62];let te;e[63]!==W||e[64]!==ee?(te=(0,t.jsxs)(fe,{children:[W,ee]}),e[63]=W,e[64]=ee,e[65]=te):te=e[65];let re;e[66]!==a?(re=a("Fast queries"),e[66]=a,e[67]=re):re=e[67];let ae;e[68]!==re?(ae=(0,t.jsx)(Oe,{className:"pb-2",children:(0,t.jsx)(De,{className:"text-sm font-medium",children:re})}),e[68]=re,e[69]=ae):ae=e[69];let se;e[70]!==L?(se=(0,t.jsx)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:L}),e[70]=L,e[71]=se):se=e[71];let le;e[72]!==a?(le=a("<50ms avg execution"),e[72]=a,e[73]=le):le=e[73];let ne;e[74]!==le?(ne=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:le}),e[74]=le,e[75]=ne):ne=e[75];let q;e[76]!==se||e[77]!==ne?(q=(0,t.jsxs)(xe,{children:[se,ne]}),e[76]=se,e[77]=ne,e[78]=q):q=e[78];let D;e[79]!==ae||e[80]!==q?(D=(0,t.jsxs)(fe,{children:[ae,q]}),e[79]=ae,e[80]=q,e[81]=D):D=e[81],e[82]!==J||e[83]!==te||e[84]!==D?(y=(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[J,te,D]}),e[82]=J,e[83]=te,e[84]=D,e[85]=y):y=e[85];let F;e[86]!==a?(F=a("Query leaderboard"),e[86]=a,e[87]=F):F=e[87];let P;e[88]!==F?(P=(0,t.jsx)("h3",{className:"text-lg font-semibold",children:F}),e[88]=F,e[89]=P):P=e[89];let ie;e[90]!==r||e[91]!==a?(ie=a("Slow queries sorted by {sortField}",{sortField:a(r)}),e[90]=r,e[91]=a,e[92]=ie):ie=e[92];let be;e[93]!==ie?(be=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:ie}),e[93]=ie,e[94]=be):be=e[94];let ve;e[95]!==P||e[96]!==be?(ve=(0,t.jsxs)("div",{children:[P,be]}),e[95]=P,e[96]=be,e[97]=ve):ve=e[97];let ye;e[98]!==a?(ye=a("Sort by"),e[98]=a,e[99]=ye):ye=e[99];let Ne;e[100]!==ye?(Ne=(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:ye}),e[100]=ye,e[101]=Ne):Ne=e[101];let Se;e[102]!==a?(Se=a("Sort queries by"),e[102]=a,e[103]=Se):Se=e[103];let Be;e[104]===Symbol.for("react.memo_cache_sentinel")?(Be=(0,t.jsx)(Ct,{}),e[104]=Be):Be=e[104];let we;e[105]!==Se?(we=(0,t.jsx)(Mt,{"aria-label":Se,className:"w-[140px]","data-testid":"qi-sort",children:Be}),e[105]=Se,e[106]=we):we=e[106];let qe;e[107]!==a?(qe=a("Total time"),e[107]=a,e[108]=qe):qe=e[108];let _e;e[109]!==qe?(_e=(0,t.jsx)(je,{value:"totalTime",children:qe}),e[109]=qe,e[110]=_e):_e=e[110];let ke;e[111]!==a?(ke=a("Avg time"),e[111]=a,e[112]=ke):ke=e[112];let Ce;e[113]!==ke?(Ce=(0,t.jsx)(je,{value:"avgTime",children:ke}),e[113]=ke,e[114]=Ce):Ce=e[114];let Me;e[115]!==a?(Me=a("Execution count"),e[115]=a,e[116]=Me):Me=e[116];let Ie;e[117]!==Me?(Ie=(0,t.jsx)(je,{value:"execCount",children:Me}),e[117]=Me,e[118]=Ie):Ie=e[118];let Re;e[119]!==a?(Re=a("Rows read"),e[119]=a,e[120]=Re):Re=e[120];let $e;e[121]!==Re?($e=(0,t.jsx)(je,{value:"rowsRead",children:Re}),e[121]=Re,e[122]=$e):$e=e[122];let Ae;e[123]!==_e||e[124]!==Ce||e[125]!==Ie||e[126]!==$e?(Ae=(0,t.jsxs)(It,{children:[_e,Ce,Ie,$e]}),e[123]=_e,e[124]=Ce,e[125]=Ie,e[126]=$e,e[127]=Ae):Ae=e[127];let ze;e[128]!==r||e[129]!==we||e[130]!==Ae?(ze=(0,t.jsxs)(kt,{onValueChange:h,value:r,children:[we,Ae]}),e[128]=r,e[129]=we,e[130]=Ae,e[131]=ze):ze=e[131];let Ke;e[132]!==Ne||e[133]!==ze?(Ke=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Ne,ze]}),e[132]=Ne,e[133]=ze,e[134]=Ke):Ke=e[134],e[135]!==ve||e[136]!==Ke?(w=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[ve,Ke]}),e[135]=ve,e[136]=Ke,e[137]=w):w=e[137],c=fe;let Le;e[138]!==a?(Le=a("Statements"),e[138]=a,e[139]=Le):Le=e[139];let Te;e[140]!==Le?(Te=(0,t.jsx)(De,{children:Le}),e[140]=Le,e[141]=Te):Te=e[141],v=(0,t.jsxs)(Oe,{children:[Te,(0,t.jsx)(ut,{children:a("{count} tracked statements",{count:_.length})})]}),u=xe,f="space-y-2";let Ue;e[142]!==n||e[143]!==a?(Ue=b(K=>{let ce=K.normalizedSql,Q=n.has(ce),pe=We(K.avgDurationMs);return(0,t.jsxs)("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[(0,t.jsxs)("button",{"aria-expanded":Q,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:b(()=>{O(ce)},"onClick"),type:"button",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsx)(sr,{level:pe}),(0,t.jsx)("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:K.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:Qe(K.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:Qe(K.avgDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("avg")})]}),K.p95DurationMs!==void 0&&(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Qe(K.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:Ve(K.execCount)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("calls")})]})]})]}),Q&&(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:K.normalizedSql})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[K.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:Qe(K.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:Ve(K.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:Qe(K.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:Ve(K.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:Ve(K.rowsWritten)})]})]})]})]},ce)},"Ke"),e[142]=n,e[143]=a,e[144]=Ue):Ue=e[144],g=_.map(Ue)}e[2]=n,e[3]=s,e[4]=r,e[5]=a,e[6]=u,e[7]=c,e[8]=d,e[9]=f,e[10]=g,e[11]=v,e[12]=x,e[13]=S,e[14]=y,e[15]=w}else u=e[6],c=e[7],d=e[8],f=e[9],g=e[10],v=e[11],x=e[12],S=e[13],y=e[14],w=e[15];if(d!==Symbol.for("react.early_return_sentinel"))return d;let I;e[145]!==f||e[146]!==g?(I=(0,t.jsx)("div",{className:f,children:g}),e[145]=f,e[146]=g,e[147]=I):I=e[147];let k;e[148]!==u||e[149]!==I?(k=(0,t.jsx)(u,{children:I}),e[148]=u,e[149]=I,e[150]=k):k=e[150];let N;e[151]!==c||e[152]!==k||e[153]!==v?(N=(0,t.jsxs)(c,{children:[v,k]}),e[151]=c,e[152]=k,e[153]=v,e[154]=N):N=e[154];let z;return e[155]!==N||e[156]!==x||e[157]!==S||e[158]!==y||e[159]!==w?(z=(0,t.jsxs)("div",{className:x,"data-testid":S,children:[y,w,N]}),e[155]=N,e[156]=x,e[157]=S,e[158]=y,e[159]=w,e[160]=z):z=e[160],z},"as");function ir(l){return We(l.avgDurationMs)==="critical"}b(ir,"is");function or(l){return We(l.avgDurationMs)==="warning"}b(or,"ns");function dr(l){return We(l.avgDurationMs)==="good"}b(dr,"os");var cr=["1m","5m","15m","1h"],mr=b(l=>new Date(l).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),"ds"),ur=b(l=>l.map(e=>({avg:Math.round(e.avgDurationMs*100)/100,execs:e.execCount,label:mr(e.bucketMs)})),"ms"),hr=b(({shardKey:l=""})=>{let e=he(),[s,a]=(0,j.useState)("15m"),r=Fe(Ee.getQueryInsights,{range:s},{live:!0,shardKey:l}).data,o=ur(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:cr.map(i=>(0,t.jsx)("button",{"aria-pressed":i===s,className:mt("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:b(()=>{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")})]}),o.length===0?(0,t.jsx)(ht,{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)(rt,{height:140,width:"100%",children:(0,t.jsxs)(Lt,{data:o,children:[(0,t.jsx)(st,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(lt,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(nt,{allowDecimals:!1,fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(at,{}),(0,t.jsx)(zt,{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)(rt,{height:140,width:"100%",children:(0,t.jsxs)(Kt,{data:o,children:[(0,t.jsx)(st,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(lt,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(nt,{fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(at,{}),(0,t.jsx)(At,{dataKey:"avg",dot:!1,stroke:"var(--color-destructive)",type:"monotone"})]})})]})]}),(0,t.jsx)(nr,{queryStats:r?.entries??[]})]})},"fs"),gr=gt(Ee.getMetrics),pr=[],fr=b((l,e)=>l?e:"overview","gs"),xr=b(l=>{let e=(0,me.c)(14),s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={},e[0]=s):s=e[0];let a;e[1]!==l?(a={live:!0,shardKey:l},e[1]=l,e[2]=a):a=e[2];let r=Fe(Ee.getMetrics,s,a),{data:o}=r,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i={points:[],shard:null},e[3]=i):i=e[3];let[n,m]=(0,j.useState)(i),p=(0,j.useRef)(null),h=(0,j.useRef)(null),u,c;e[4]!==o||e[5]!==l?(u=b(()=>{o!==void 0&&Nt(l)},"u"),c=[o,l],e[4]=o,e[5]=l,e[6]=u,e[7]=c):(u=e[6],c=e[7]),(0,j.useEffect)(u,c);let d,f;e[8]!==o?(d=b(()=>{if(o===void 0)return;let x=o,S=h.current!==null&&h.current!==x.shard,y=h.current===x.shard?p.current:null;if(h.current=x.shard,p.current=x.requests,S){m({points:[],shard:x.shard});return}y!==null&&x.requests>=y&&m(w=>({points:[...w.shard===x.shard?w.points:[],x.requests-y].slice(-30),shard:x.shard}))},"c"),f=[o],e[8]=o,e[9]=d,e[10]=f):(d=e[9],f=e[10]),(0,j.useEffect)(d,f);let g=n.shard!==null&&n.shard===o?.shard?n.points:pr,v;return e[11]!==r||e[12]!==g?(v={...r,history:g},e[11]=r,e[12]=g,e[13]=v):v=e[13],v},"ps"),br=b(l=>{let e=vt(),s=(0,j.useRef)(!0);(0,j.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]);let[a,r]=(0,j.useState)(null),[o,i]=(0,j.useState)(!1),n=b(async()=>{i(!0);let p=l,h=Ot(p,yt());try{let u=await Promise.all(h.map(async c=>{try{let d=await e.query(gr,{},pt(c));return{error:null,metrics:d,shard:c===""?d.shard:c}}catch(d){return{error:ft(d),metrics:null,shard:c===""?"__root__":c}}}));s.current&&r({results:u,shard:p})}finally{s.current&&i(!1)}},"a"),m=a?.shard===l?a.results:null;return{aggregate:m===null?null:Et(m),aggregating:o,clearAggregate:b(()=>{r(null)},"clearAggregate"),runAggregate:b(()=>{bt(n())},"runAggregate"),shardResults:m}},"xs"),vr=b(l=>{if(!l||!("queryStats"in l))return;let e=l.queryStats;if(!(!e||!Array.isArray(e)))return Ft(e)},"bs"),Qt=b(l=>`pb-2 text-sm font-medium transition-colors ${l?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"ot"),yr=b(l=>{let e=(0,me.c)(26),{activeTab:s,onSelect:a,queryCount:r}=l,o=he(),i;e[0]!==a?(i=b(()=>{a("overview")},"n"),e[0]=a,e[1]=i):i=e[1];let n=i,m;e[2]!==a?(m=b(()=>{a("query-insights")},"m"),e[2]=a,e[3]=m):m=e[3];let p=m,h=s==="overview",u;e[4]!==h?(u=Qt(h),e[4]=h,e[5]=u):u=e[5];let c;e[6]!==o?(c=o("Overview"),e[6]=o,e[7]=c):c=e[7];let d;e[8]!==n||e[9]!==u||e[10]!==c?(d=(0,t.jsx)("button",{className:u,"data-testid":"mt-tab-overview",onClick:n,type:"button",children:c}),e[8]=n,e[9]=u,e[10]=c,e[11]=d):d=e[11];let f=s==="query-insights",g;e[12]!==f?(g=Qt(f),e[12]=f,e[13]=g):g=e[13];let v;e[14]!==o?(v=o("Query insights"),e[14]=o,e[15]=v):v=e[15];let x;e[16]!==r?(x=r>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:r}),e[16]=r,e[17]=x):x=e[17];let S;e[18]!==p||e[19]!==x||e[20]!==g||e[21]!==v?(S=(0,t.jsxs)("button",{className:g,"data-testid":"mt-tab-query-insights",onClick:p,type:"button",children:[v,x]}),e[18]=p,e[19]=x,e[20]=g,e[21]=v,e[22]=S):S=e[22];let y;return e[23]!==S||e[24]!==d?(y=(0,t.jsxs)("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[d,S]}),e[23]=S,e[24]=d,e[25]=y):y=e[25],y},"vs"),Nr=b(l=>{let e=(0,me.c)(13),{history:s,metrics:a}=l,r;e[0]!==s?(r=s.at(-1)??0,e[0]=s,e[1]=r):r=e[1];let o;e[2]!==a.errors||e[3]!==a.requests?(o=a.requests===0?"\u2014":`${(a.errors/a.requests*100).toFixed(1)}%`,e[2]=a.errors,e[3]=a.requests,e[4]=o):o=e[4];let i;e[5]!==a?(i=Dt(a),e[5]=a,e[6]=i):i=e[6];let n;return e[7]!==s||e[8]!==a||e[9]!==r||e[10]!==o||e[11]!==i?(n=(0,t.jsx)(ar,{currentDelta:r,errorRate:o,history:s,latencyPercentiles:i,metrics:a}),e[7]=s,e[8]=a,e[9]=r,e[10]=o,e[11]=i,e[12]=n):n=e[12],n},"ys"),Sr=b(l=>{let e=(0,me.c)(25),{aggregating:s,liveError:a,onAggregate:r,onClearAggregate:o,onShardKeyChange:i,shardKey:n}=l,m=he(),p;e[0]!==i||e[1]!==n?(p=(0,t.jsx)(St,{onChange:i,testId:"mt-shard-input",value:n}),e[0]=i,e[1]=n,e[2]=p):p=e[2];let h;e[3]!==a?(h=(0,t.jsx)(qt,{message:a,prefix:"mt"}),e[3]=a,e[4]=h):h=e[4];let u;e[5]!==s||e[6]!==m?(u=m(s?"Aggregating\u2026":"All shards"),e[5]=s,e[6]=m,e[7]=u):u=e[7];let c;e[8]!==s||e[9]!==r||e[10]!==u?(c=(0,t.jsx)(Ye,{"data-testid":"mt-aggregate",disabled:s,onClick:r,size:"sm",type:"button",variant:"secondary",children:u}),e[8]=s,e[9]=r,e[10]=u,e[11]=c):c=e[11];let d;e[12]!==o||e[13]!==m?(d=o!==void 0&&(0,t.jsx)(Ye,{"data-testid":"mt-aggregate-clear",onClick:o,size:"sm",type:"button",variant:"ghost",children:m("Hide")}),e[12]=o,e[13]=m,e[14]=d):d=e[14];let f;e[15]!==m?(f=m("Open in Cloudflare"),e[15]=m,e[16]=f):f=e[16];let g;e[17]!==f?(g=(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:_t,rel:"noreferrer",target:"_blank",children:f}),e[17]=f,e[18]=g):g=e[18];let v;return e[19]!==p||e[20]!==h||e[21]!==c||e[22]!==d||e[23]!==g?(v=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p,h,c,d,g]}),e[19]=p,e[20]=h,e[21]=c,e[22]=d,e[23]=g,e[24]=v):v=e[24],v},"Ns"),Jr=b(l=>{let e=(0,me.c)(41),{initialShardKey:s}=l,{queryShardKey:a,setShardKey:r,shardKey:o}=wt(s),[i,n]=(0,j.useState)("overview"),m=$t(a),{data:p,error:h,history:u,liveError:c}=xr(a),d=p??null,{aggregate:f,aggregating:g,clearAggregate:v,runAggregate:x,shardResults:S}=br(o),y;e[0]!==d?(y=vr(d),e[0]=d,e[1]=y):y=e[1];let w=y,I=w!==void 0,k;e[2]!==i||e[3]!==I?(k=fr(I,i),e[2]=i,e[3]=I,e[4]=k):k=e[4];let N=k,z=S===null?void 0:v,_;e[5]!==g||e[6]!==c||e[7]!==x||e[8]!==r||e[9]!==o||e[10]!==z?(_=(0,t.jsx)(Sr,{aggregating:g,liveError:c,onAggregate:x,onClearAggregate:z,onShardKeyChange:r,shardKey:o}),e[5]=g,e[6]=c,e[7]=x,e[8]=r,e[9]=o,e[10]=z,e[11]=_):_=e[11];let C;e[12]!==h?(C=h!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:h}),e[12]=h,e[13]=C):C=e[13];let R;e[14]!==N||e[15]!==w?(R=w!==void 0&&(0,t.jsx)(yr,{activeTab:N,onSelect:n,queryCount:w.length}),e[14]=N,e[15]=w,e[16]=R):R=e[16];let M;e[17]!==N||e[18]!==a||e[19]!==w?(M=N==="query-insights"&&w!==void 0&&(0,t.jsx)(hr,{shardKey:a}),e[17]=N,e[18]=a,e[19]=w,e[20]=M):M=e[20];let $;e[21]!==N||e[22]!==u||e[23]!==d?($=N==="overview"&&d!==null&&(0,t.jsx)(Nr,{history:u,metrics:d}),e[21]=N,e[22]=u,e[23]=d,e[24]=$):$=e[24];let A;e[25]!==N||e[26]!==m||e[27]!==a?(A=N==="overview"&&(0,t.jsx)(tr,{onOpenTrace:m,shardKey:a}),e[25]=N,e[26]=m,e[27]=a,e[28]=A):A=e[28];let L;e[29]!==f||e[30]!==N||e[31]!==S?(L=N==="overview"&&f!==null&&S!==null&&(0,t.jsx)(rr,{aggregate:f,shardResults:S}),e[29]=f,e[30]=N,e[31]=S,e[32]=L):L=e[32];let E;return e[33]!==A||e[34]!==L||e[35]!==_||e[36]!==C||e[37]!==R||e[38]!==M||e[39]!==$?(E=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[_,C,R,M,$,A,L]}),e[33]=A,e[34]=L,e[35]=_,e[36]=C,e[37]=R,e[38]=M,e[39]=$,e[40]=E):E=e[40],E},"Js");export{Jr as MetricsPanel};
@@ -0,0 +1 @@
1
+ import{a as i,j as a}from"./chunk-4C4THJUD.js";import{a as o}from"./chunk-WZTY3ZYI.js";import{b as n}from"./chunk-LPINY2IJ.js";import{a as r}from"./chunk-OXFKZ4BM.js";function s(e){return a(e.defaultTagName??"div",e,e)}r(s,"useRender");var g=o("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-none border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive font-mono text-[11px] tracking-wide uppercase focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline",success:"bg-success/10 text-success font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-success/15 dark:bg-success/15",warning:"bg-warning/10 text-warning font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-warning/15 dark:bg-warning/15",info:"bg-info/10 text-info font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-info/15 dark:bg-info/15"}},defaultVariants:{variant:"default"}});function x({className:e,variant:t="default",render:d,...u}){return s({defaultTagName:"span",props:i({className:n(g({variant:t}),e)},u),render:d,state:{slot:"badge",variant:t}})}r(x,"f");export{s as a,x as b};
@@ -1 +1 @@
1
- import{a as c,d as p,e as b,f as v}from"./chunk-I26MS5PJ.js";var h=p(v(),1),g=p(b(),1);var y=c((a="local")=>{try{return a==="local"?globalThis.localStorage:globalThis.sessionStorage}catch{return}},"d"),S=c(function(a,s="local"){try{let r=y(s)?.getItem(a)??void 0,t=r===void 0?[]:JSON.parse(r);return Array.isArray(t)?t:[]}catch{return[]}},"g"),I=c((a,s,r="local")=>{let t=y(r);if(t!==void 0)try{t.setItem(a,JSON.stringify(s))}catch{}},"I"),A=c((a,s="local")=>{try{y(s)?.removeItem(a)}catch{}},"A"),T=c(function(a,s){let r=(0,h.c)(10),t=s===void 0?"local":s,u;r[0]!==a||r[1]!==t?(u=c(()=>S(a,t),"i"),r[0]=a,r[1]=t,r[2]=u):u=r[2];let[n,f]=(0,g.useState)(u),i=(0,g.useRef)(`${t}:${a}`),e,l;r[3]!==a||r[4]!==t||r[5]!==n?(e=c(()=>{let m=`${t}:${a}`;if(i.current!==m){i.current=m,f(S(a,t));return}I(a,n,t)},"c"),l=[a,t,n],r[3]=a,r[4]=t,r[5]=n,r[6]=e,r[7]=l):(e=r[6],l=r[7]),(0,g.useEffect)(e,l);let o;return r[8]!==n?(o=[n,f],r[8]=n,r[9]=o):o=r[9],o},"J"),J=c(function(a,s,r){let t=(0,h.c)(6),u="local",[n,f]=T(a,u),i;t[0]!==s||t[1]!==f?(i=c(m=>{f($=>{let d=$[0]??s;return[typeof m=="function"?m(d):m]})},"a"),t[0]=s,t[1]=f,t[2]=i):i=t[2];let e=i,l=n[0]??s,o;return t[3]!==e||t[4]!==l?(o=[l,e],t[3]=e,t[4]=l,t[5]=o):o=t[5],o},"O"),O=c(a=>globalThis.crypto?.randomUUID?.()??`${a}-${globalThis.performance.now().toString(36)}`,"V");export{y as a,S as b,I as c,A as d,T as e,J as f,O as g};
1
+ import{a as c,d as p,e as b,f as v}from"./chunk-OXFKZ4BM.js";var h=p(v(),1),g=p(b(),1);var y=c((a="local")=>{try{return a==="local"?globalThis.localStorage:globalThis.sessionStorage}catch{return}},"d"),S=c(function(a,s="local"){try{let r=y(s)?.getItem(a)??void 0,t=r===void 0?[]:JSON.parse(r);return Array.isArray(t)?t:[]}catch{return[]}},"g"),I=c((a,s,r="local")=>{let t=y(r);if(t!==void 0)try{t.setItem(a,JSON.stringify(s))}catch{}},"I"),A=c((a,s="local")=>{try{y(s)?.removeItem(a)}catch{}},"A"),T=c(function(a,s){let r=(0,h.c)(10),t=s===void 0?"local":s,u;r[0]!==a||r[1]!==t?(u=c(()=>S(a,t),"i"),r[0]=a,r[1]=t,r[2]=u):u=r[2];let[n,f]=(0,g.useState)(u),i=(0,g.useRef)(`${t}:${a}`),e,l;r[3]!==a||r[4]!==t||r[5]!==n?(e=c(()=>{let m=`${t}:${a}`;if(i.current!==m){i.current=m,f(S(a,t));return}I(a,n,t)},"c"),l=[a,t,n],r[3]=a,r[4]=t,r[5]=n,r[6]=e,r[7]=l):(e=r[6],l=r[7]),(0,g.useEffect)(e,l);let o;return r[8]!==n?(o=[n,f],r[8]=n,r[9]=o):o=r[9],o},"J"),J=c(function(a,s,r){let t=(0,h.c)(6),u="local",[n,f]=T(a,u),i;t[0]!==s||t[1]!==f?(i=c(m=>{f($=>{let d=$[0]??s;return[typeof m=="function"?m(d):m]})},"a"),t[0]=s,t[1]=f,t[2]=i):i=t[2];let e=i,l=n[0]??s,o;return t[3]!==e||t[4]!==l?(o=[l,e],t[3]=e,t[4]=l,t[5]=o):o=t[5],o},"O"),O=c(a=>globalThis.crypto?.randomUUID?.()??`${a}-${globalThis.performance.now().toString(36)}`,"V");export{y as a,S as b,I as c,A as d,T as e,J as f,O as g};
@@ -1 +1 @@
1
- import{a as i,d as m,e as v,f as b}from"./chunk-I26MS5PJ.js";var n=m(b(),1),r=m(v(),1);var x=i(function(t,a,s){let e=(0,n.c)(4),o=a===void 0?300:a,[d,f]=(0,r.useState)(t),[p,l]=(0,r.useState)(s);s!==void 0&&s!==p&&(l(s),f(t));let u,c;return e[0]!==o||e[1]!==t?(u=i(()=>{let T=setTimeout(()=>{f(t)},o);return()=>{clearTimeout(T)}},"c"),c=[t,o],e[0]=o,e[1]=t,e[2]=u,e[3]=c):(u=e[2],c=e[3]),(0,r.useEffect)(u,c),d},"T");export{x as a};
1
+ import{a as i,d as m,e as v,f as b}from"./chunk-OXFKZ4BM.js";var n=m(b(),1),r=m(v(),1);var x=i(function(t,a,s){let e=(0,n.c)(4),o=a===void 0?300:a,[d,f]=(0,r.useState)(t),[p,l]=(0,r.useState)(s);s!==void 0&&s!==p&&(l(s),f(t));let u,c;return e[0]!==o||e[1]!==t?(u=i(()=>{let T=setTimeout(()=>{f(t)},o);return()=>{clearTimeout(T)}},"c"),c=[t,o],e[0]=o,e[1]=t,e[2]=u,e[3]=c):(u=e[2],c=e[3]),(0,r.useEffect)(u,c),d},"T");export{x as a};
@@ -0,0 +1 @@
1
+ import{b as h}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{b as A}from"./chunk-YJ2WHOGO.js";import{p as S}from"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import{a as y,e as I}from"./chunk-MD67S53Z.js";import{f as k}from"./chunk-LPINY2IJ.js";import{a as u,d as w,f as z,g as P}from"./chunk-OXFKZ4BM.js";var N=w(z(),1);var a=w(P(),1);var j=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],v=u(e=>{if(e===void 0)return"\u2014";let i=[[86400,"d"],[3600,"h"],[60,"m"]];for(let[t,d]of i)if(e>=t&&e%t===0)return`${String(e/t)}${d}`;return`${String(e)}s`},"v"),p=u(e=>{let i=(0,N.c)(8),{children:t,heading:d,testId:n}=e,l;i[0]!==d?(l=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d})}),i[0]=d,i[1]=l):l=i[1];let s;i[2]!==t?(s=(0,a.jsx)(I,{className:"p-3",children:t}),i[2]=t,i[3]=s):s=i[3];let c;return i[4]!==l||i[5]!==s||i[6]!==n?(c=(0,a.jsxs)(y,{className:"gap-0 py-0","data-testid":n,children:[l,s]}),i[4]=l,i[5]=s,i[6]=n,i[7]=c):c=i[7],c},"h"),o=u(e=>{let i=(0,N.c)(7),{label:t,value:d}=e,n;i[0]!==t?(n=(0,a.jsx)("span",{className:"text-sm",children:t}),i[0]=t,i[1]=n):n=i[1];let l;i[2]!==d?(l=(0,a.jsx)("span",{className:"text-sm text-muted-foreground tabular-nums",children:d}),i[2]=d,i[3]=l):l=i[3];let s;return i[4]!==n||i[5]!==l?(s=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[n,l]}),i[4]=n,i[5]=l,i[6]=s):s=i[6],s},"c"),M=u(()=>{let e=(0,N.c)(20),i=S(),t=k(),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-auth-config"],e[0]=d):d=e[0];let n;e[1]!==i?(n=u(()=>i.getAuthConfig(),"r"),e[1]=i,e[2]=n):n=e[2];let{data:l,error:s}=A(d,n),c;e[3]!==t?(c=u(r=>(0,a.jsx)(h,{variant:r?"success":"outline",children:t(r?"Enabled":"Disabled")}),"u"),e[3]=t,e[4]=c):c=e[4];let m=c,g;e[5]!==s?(g=s!==null&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:s}),e[5]=s,e[6]=g):g=e[6];let f;e[7]!==l||e[8]!==s||e[9]!==t?(f=s===null&&l===void 0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:t("Loading auth configuration\u2026")}),e[7]=l,e[8]=s,e[9]=t,e[10]=f):f=e[10];let x;e[11]!==l||e[12]!==s||e[13]!==m||e[14]!==t?(x=s===null&&l!==void 0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p,{heading:t("Enabled capabilities"),testId:"auth-config-capabilities",children:(0,a.jsx)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:j.map(r=>{let $=l.capabilities[r.key];return(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${r.key}`,children:[(0,a.jsx)("span",{className:"text-sm",children:t(r.label)}),m($)]},r.key)})})}),(0,a.jsx)(p,{heading:t("Plugins"),testId:"auth-config-plugins",children:l.plugins.length===0?(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:t("No plugins enabled.")}):(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:l.plugins.map(C)})}),(0,a.jsx)(p,{heading:t("Sign-in methods"),testId:"auth-config-signin",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Email & password"),value:m(l.emailAndPassword)}),(0,a.jsx)(o,{label:t("Social providers"),value:l.socialProviders.length===0?t("None"):(0,a.jsx)("span",{className:"flex flex-wrap justify-end gap-1",children:l.socialProviders.map(q)})})]})}),l.organization.enabled&&(0,a.jsx)(p,{heading:t("Organizations"),testId:"auth-config-org",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Teams"),value:m(l.organization.teams)}),(0,a.jsx)(o,{label:t("Custom roles"),value:m(l.organization.roles)})]})}),(0,a.jsx)(p,{heading:t("Session policy"),testId:"auth-config-session",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Expires in"),value:v(l.session.expiresIn)}),(0,a.jsx)(o,{label:t("Refresh after"),value:v(l.session.updateAge)}),(0,a.jsx)(o,{label:t("Fresh window"),value:v(l.session.freshAge)}),(0,a.jsx)(o,{label:t("Cookie cache"),value:m(l.session.cookieCache===!0)})]})}),(0,a.jsx)(p,{heading:t("Rate limit"),testId:"auth-config-ratelimit",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Status"),value:m(l.rateLimit.enabled)}),l.rateLimit.enabled&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o,{label:t("Max requests"),value:l.rateLimit.max??"\u2014"}),(0,a.jsx)(o,{label:t("Window"),value:v(l.rateLimit.window)})]})]})}),l.userFields.length>0&&(0,a.jsx)(p,{heading:t("Plugin user fields"),testId:"auth-config-user-fields",children:(0,a.jsx)("ul",{className:"flex flex-col gap-2",children:l.userFields.map(r=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${r.name}`,children:[(0,a.jsxs)("span",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-mono text-xs",children:r.name}),r.plugin!==void 0&&(0,a.jsx)("span",{className:"text-[11px] text-muted-foreground",children:r.plugin})]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(h,{variant:"outline",children:r.type}),r.required&&(0,a.jsx)(h,{variant:"secondary",children:t("required")}),r.unique&&(0,a.jsx)(h,{variant:"secondary",children:t("unique")})]})]},r.name))})}),(0,a.jsx)(y,{className:"gap-0 py-0",children:(0,a.jsx)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:t("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.")})})]}),e[11]=l,e[12]=s,e[13]=m,e[14]=t,e[15]=x):x=e[15];let b;return e[16]!==g||e[17]!==f||e[18]!==x?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[g,f,x]}),e[16]=g,e[17]=f,e[18]=x,e[19]=b):b=e[19],b},"O");function C(e){return(0,a.jsx)(h,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e)}u(C,"P");function q(e){return(0,a.jsx)(h,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e)}u(q,"z");export{M as default};
@@ -1 +1 @@
1
- import{a as s}from"./chunk-RX755NMO.js";import{a as n}from"./chunk-I26MS5PJ.js";var b="__lunora_admin__:",g=new Set(["action","mutation","query"]),c=Symbol("lunora.operationSeq"),_=n(t=>{if(typeof t!="object"||t===null)return;let e=t[c];return typeof e=="number"?e:void 0},"g"),d=n((t,e)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,c,{configurable:!0,enumerable:!1,value:e,writable:!0})}catch{}},"h"),m=n(t=>{if(typeof t!="object"||t===null)return;let e=t.__lunoraRef;return typeof e=="string"&&e.startsWith(b)?e:void 0},"p"),h=n(t=>{if(typeof t!="object"||t===null)return"";let{shardKey:e}=t;return typeof e=="string"?e:""},"O"),w=n(t=>new Proxy(t,{get(e,u,y){let i=Reflect.get(e,u,y);if(typeof i!="function"||typeof u!="string"||!g.has(u))return typeof i=="function"?i.bind(e):i;let f=i;return async(...o)=>{let l=m(o[0]);if(l===void 0)return f.apply(e,o);let p=typeof o[1]=="object"&&o[1]!==null?o[1]:{},a=s.start(l,p,h(o[2]));try{let r=await f.apply(e,o);return s.settle(a,{result:r}),r}catch(r){throw s.settle(a,{error:r instanceof Error?r.message:String(r)}),d(r,a),r}}}}),"E");export{_ as a,w as b};
1
+ import{a as s}from"./chunk-YJ2WHOGO.js";import{a as n}from"./chunk-OXFKZ4BM.js";var b="__lunora_admin__:",g=new Set(["action","mutation","query"]),c=Symbol("lunora.operationSeq"),_=n(t=>{if(typeof t!="object"||t===null)return;let e=t[c];return typeof e=="number"?e:void 0},"g"),d=n((t,e)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,c,{configurable:!0,enumerable:!1,value:e,writable:!0})}catch{}},"h"),m=n(t=>{if(typeof t!="object"||t===null)return;let e=t.__lunoraRef;return typeof e=="string"&&e.startsWith(b)?e:void 0},"p"),h=n(t=>{if(typeof t!="object"||t===null)return"";let{shardKey:e}=t;return typeof e=="string"?e:""},"O"),w=n(t=>new Proxy(t,{get(e,u,y){let i=Reflect.get(e,u,y);if(typeof i!="function"||typeof u!="string"||!g.has(u))return typeof i=="function"?i.bind(e):i;let f=i;return async(...o)=>{let l=m(o[0]);if(l===void 0)return f.apply(e,o);let p=typeof o[1]=="object"&&o[1]!==null?o[1]:{},a=s.start(l,p,h(o[2]));try{let r=await f.apply(e,o);return s.settle(a,{result:r}),r}catch(r){throw s.settle(a,{error:r instanceof Error?r.message:String(r)}),d(r,a),r}}}}),"E");export{_ as a,w as b};
@@ -0,0 +1 @@
1
+ import{b as Me}from"./chunk-LRXCL6IA.js";import{a as ve}from"./chunk-R36QXQZX.js";import{b as ye,c as we}from"./chunk-IH2CJZF2.js";import{a as xe}from"./chunk-YJWR6ZWC.js";import{a as Ne}from"./chunk-XBZUJDHD.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import{a as be}from"./chunk-5DNGK3NT.js";import{a as fe}from"./chunk-KYONGQQ4.js";import{b as he}from"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import{i as me}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as oe}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as ge}from"./chunk-OECMBE6Q.js";import"./chunk-OSJ7HV7B.js";import"./chunk-7F3S5OQT.js";import"./chunk-E26OT26O.js";import{a as ce}from"./chunk-4ZEL6BYL.js";import{c as ie}from"./chunk-YJ2WHOGO.js";import"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import{a as ue}from"./chunk-3Y5K3IQO.js";import{b as te,f as U,p as pe,w as de}from"./chunk-LPINY2IJ.js";import{a as m,d as le,e as Ce,f as Le,g as Te}from"./chunk-OXFKZ4BM.js";var O=le(Le(),1),A=le(Ce(),1);var s=le(Te(),1);var Pe=.5,Ie=4,Se=m(n=>Math.min(100,Math.max(0,n)),"ce"),Ke=m((n,e)=>{if(!Number.isFinite(e)||e<=0)return{leftPercent:0,widthPercent:100};let t=Se(n.offsetMs/e*100),a=n.durationMs/e*100,l=Math.max(Pe,Math.min(Se(a),100-t));return{leftPercent:t,widthPercent:l}},"Ce"),De=m((n,e,t=!1)=>{let a=e.trim().toLowerCase(),l=t?n.filter(r=>!r.ok):n;return a===""?[...l]:l.filter(r=>r.rootName.toLowerCase().includes(a)||r.functionPath.toLowerCase().includes(a)||r.traceId.toLowerCase().includes(a)||r.spans.some(o=>o.name.toLowerCase().includes(a)||o.spanId.toLowerCase().includes(a)))},"Ee"),G=m(n=>Number.isFinite(n)?n>0&&n<1?`${n.toFixed(2)}ms`:`${String(Math.round(n))}ms`:"\u2014","q"),Fe=m(n=>!Number.isFinite(n)||n<=0?[]:Array.from({length:Ie},(e,t)=>{let a=(t+1)/Ie;return{label:G(n*a),percent:a*100}}),"Pe"),ke=m(n=>{if(typeof n=="string")return n;try{return JSON.stringify(n,pe)}catch{return String(n)}},"ue"),ee=m(n=>{let e=(0,O.c)(7),{label:t,value:a}=n,l;e[0]!==t?(l=(0,s.jsx)("dt",{className:"w-40 shrink-0 text-muted-foreground",children:t}),e[0]=t,e[1]=l):l=e[1];let r;e[2]!==a?(r=(0,s.jsx)("dd",{className:"min-w-0 break-all",children:a}),e[2]=a,e[3]=r):r=e[3];let o;return e[4]!==l||e[5]!==r?(o=(0,s.jsxs)("div",{className:"flex gap-2",children:[l,r]}),e[4]=l,e[5]=r,e[6]=o):o=e[6],o},"Y"),je=m(n=>{let e=(0,O.c)(68),{span:t}=n,a=U(),l,r,o,d,i,u;if(e[0]!==t.attributes||e[1]!==t.durationMs||e[2]!==t.error||e[3]!==t.events||e[4]!==t.kind||e[5]!==t.offsetMs||e[6]!==t.parentSpanId||e[7]!==t.spanId||e[8]!==a){let $=Object.entries(t.attributes??{}),_;e[15]!==t.events?(_=t.events??[],e[15]=t.events,e[16]=_):_=e[16],l=_,r="border-t border-border bg-background/60 px-3 py-2 font-mono text-xs",o="tr-span-detail";let y;e[17]!==a?(y=a("Span ID"),e[17]=a,e[18]=y):y=e[18];let w;e[19]!==t.spanId||e[20]!==y?(w=(0,s.jsx)(ee,{label:y,value:t.spanId}),e[19]=t.spanId,e[20]=y,e[21]=w):w=e[21];let M;e[22]!==a?(M=a("Parent span ID"),e[22]=a,e[23]=M):M=e[23];let p;e[24]!==t.parentSpanId||e[25]!==a?(p=t.parentSpanId===""?a("\u2014 (trace root)"):t.parentSpanId,e[24]=t.parentSpanId,e[25]=a,e[26]=p):p=e[26];let h;e[27]!==p||e[28]!==M?(h=(0,s.jsx)(ee,{label:M,value:p}),e[27]=p,e[28]=M,e[29]=h):h=e[29];let b;e[30]!==a?(b=a("Kind"),e[30]=a,e[31]=b):b=e[31];let C=t.kind??"internal",S;e[32]!==b||e[33]!==C?(S=(0,s.jsx)(ee,{label:b,value:C}),e[32]=b,e[33]=C,e[34]=S):S=e[34];let I;e[35]!==a?(I=a("Started at"),e[35]=a,e[36]=I):I=e[36];let g;e[37]!==t.offsetMs||e[38]!==a?(g=a("+{offset}",{offset:G(t.offsetMs)}),e[37]=t.offsetMs,e[38]=a,e[39]=g):g=e[39];let x;e[40]!==I||e[41]!==g?(x=(0,s.jsx)(ee,{label:I,value:g}),e[40]=I,e[41]=g,e[42]=x):x=e[42];let k;e[43]!==a?(k=a("Duration"),e[43]=a,e[44]=k):k=e[44];let f;e[45]!==t.durationMs?(f=G(t.durationMs),e[45]=t.durationMs,e[46]=f):f=e[46];let N;e[47]!==k||e[48]!==f?(N=(0,s.jsx)(ee,{label:k,value:f}),e[47]=k,e[48]=f,e[49]=N):N=e[49],e[50]!==h||e[51]!==S||e[52]!==x||e[53]!==N||e[54]!==w?(d=(0,s.jsxs)("dl",{className:"flex flex-col gap-1",children:[w,h,S,x,N]}),e[50]=h,e[51]=S,e[52]=x,e[53]=N,e[54]=w,e[55]=d):d=e[55],e[56]!==t.error?(i=t.error!==void 0&&(0,s.jsxs)("div",{className:"mt-2 rounded-md border border-destructive/40 bg-destructive/10 px-2 py-1.5","data-testid":"tr-detail-error",children:[(0,s.jsx)("span",{className:"font-semibold text-destructive",children:t.error.type}),(0,s.jsx)("p",{className:"whitespace-pre-wrap break-all text-destructive",children:t.error.message})]}),e[56]=t.error,e[57]=i):i=e[57],u=$.length>0&&(0,s.jsxs)("div",{className:"mt-2","data-testid":"tr-detail-attributes",children:[(0,s.jsx)("p",{className:"mb-1 text-muted-foreground",children:a("Attributes")}),(0,s.jsx)("dl",{className:"flex flex-col gap-1",children:$.map(Ee)})]}),e[0]=t.attributes,e[1]=t.durationMs,e[2]=t.error,e[3]=t.events,e[4]=t.kind,e[5]=t.offsetMs,e[6]=t.parentSpanId,e[7]=t.spanId,e[8]=a,e[9]=l,e[10]=r,e[11]=o,e[12]=d,e[13]=i,e[14]=u}else l=e[9],r=e[10],o=e[11],d=e[12],i=e[13],u=e[14];let c;e[58]!==l||e[59]!==a?(c=l.length>0&&(0,s.jsxs)("div",{className:"mt-2","data-testid":"tr-detail-events",children:[(0,s.jsx)("p",{className:"mb-1 text-muted-foreground",children:a("Events")}),(0,s.jsx)("ul",{className:"flex flex-col gap-1",children:l.map(Oe)})]}),e[58]=l,e[59]=a,e[60]=c):c=e[60];let v;return e[61]!==r||e[62]!==o||e[63]!==d||e[64]!==i||e[65]!==u||e[66]!==c?(v=(0,s.jsxs)("div",{className:r,"data-testid":o,children:[d,i,u,c]}),e[61]=r,e[62]=o,e[63]=d,e[64]=i,e[65]=u,e[66]=c,e[67]=v):v=e[67],v},"Fe");function Ee(n){let[e,t]=n;return(0,s.jsx)(ee,{label:e,value:ke(t)},e)}m(Ee,"Ke");function Ae(n){let[e,t]=n;return`${e}=${ke(t)}`}m(Ae,"Re");function Oe(n){return(0,s.jsxs)("li",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:de(n.ts)}),(0,s.jsx)(oe,{variant:"secondary",children:n.name}),(0,s.jsx)("span",{className:"min-w-0 break-all text-muted-foreground",children:Object.entries(n.attributes??{}).map(Ae).join(" ")})]},`${n.name}:${String(n.ts)}`)}m(Oe,"Ae");var Be=14,_e="grid grid-cols-[14rem_1fr_4rem_16rem_16rem] items-center gap-2 px-3",We=m(n=>{let e=(0,O.c)(17),{traceDurationMs:t}=n,a,l,r,o,d,i;if(e[0]!==t){i=Symbol.for("react.early_return_sentinel");e:{let v=Fe(t);if(v.length===0){i=null;break e}e[7]===Symbol.for("react.memo_cache_sentinel")?(r=te(_e,"border-b border-border py-1 font-mono text-[10px] text-muted-foreground"),e[7]=r):r=e[7],o="tr-ruler",e[8]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsx)("span",{}),e[8]=d):d=e[8],a="relative h-3",l=v.map(Je)}e[0]=t,e[1]=a,e[2]=l,e[3]=r,e[4]=o,e[5]=d,e[6]=i}else a=e[1],l=e[2],r=e[3],o=e[4],d=e[5],i=e[6];if(i!==Symbol.for("react.early_return_sentinel"))return i;let u;e[9]!==a||e[10]!==l?(u=(0,s.jsx)("span",{className:a,children:l}),e[9]=a,e[10]=l,e[11]=u):u=e[11];let c;return e[12]!==r||e[13]!==o||e[14]!==d||e[15]!==u?(c=(0,s.jsxs)("div",{className:r,"data-testid":o,children:[d,u]}),e[12]=r,e[13]=o,e[14]=d,e[15]=u,e[16]=c):c=e[16],c},"je"),qe=m(n=>{let e=(0,O.c)(60),{span:t,traceDurationMs:a}=n,l=U(),[r,o]=(0,A.useState)(!1),d;e[0]!==t||e[1]!==a?(d=Ke(t,a),e[0]=t,e[1]=a,e[2]=d):d=e[2];let{leftPercent:i,widthPercent:u}=d,c;e[3]!==t.attributes?(c=ve(t.attributes),e[3]=t.attributes,e[4]=c):c=e[4];let v=c,$=t.depth*Be,_;e[5]!==$?(_={paddingLeft:$},e[5]=$,e[6]=_):_=e[6];let y=_,w=`${String(i)}%`,M=`${String(u)}%`,p;e[7]!==w||e[8]!==M?(p={left:w,width:M},e[7]=w,e[8]=M,e[9]=p):p=e[9];let h=p,b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=m(()=>{o(Ue)},"h"),e[10]=b):b=e[10];let C=b,S=t.depth,I=`tr-span-detail-${t.spanId}`,g;e[11]!==t.durationMs||e[12]!==t.error||e[13]!==t.name||e[14]!==t.offsetMs||e[15]!==l?(g=l("{name}, {duration}, starts {offset} in{failure}",{duration:G(t.durationMs),failure:t.error===void 0?"":l(", failed: {message}",{message:t.error.message}),name:t.name,offset:G(t.offsetMs)}),e[11]=t.durationMs,e[12]=t.error,e[13]=t.name,e[14]=t.offsetMs,e[15]=l,e[16]=g):g=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=te(_e,"w-full border-b border-border py-1.5 text-left font-mono text-xs hover:bg-muted/50"),e[17]=x):x=e[17];let k=`tr-span-toggle-${t.spanId}`,f;e[18]!==t.ok?(f=t.ok?null:(0,s.jsx)("span",{"aria-hidden":"true",className:"mr-1 text-destructive","data-testid":"tr-span-error",children:"\u25CF"}),e[18]=t.ok,e[19]=f):f=e[19];let N;e[20]!==y||e[21]!==t.name||e[22]!==f?(N=(0,s.jsxs)("span",{className:"truncate",style:y,title:t.name,children:[f,t.name]}),e[20]=y,e[21]=t.name,e[22]=f,e[23]=N):N=e[23];let B=t.ok?"bg-primary/70":"bg-destructive",L;e[24]!==B?(L=te("absolute inset-y-0 rounded-sm",B),e[24]=B,e[25]=L):L=e[25];let E;e[26]!==h||e[27]!==i||e[28]!==L||e[29]!==u?(E=(0,s.jsx)("span",{"aria-hidden":"true",className:"relative h-3 overflow-hidden rounded-sm bg-muted",children:(0,s.jsx)("span",{className:L,"data-left":i,"data-testid":"tr-span-bar","data-width":u,style:h})}),e[26]=h,e[27]=i,e[28]=L,e[29]=u,e[30]=E):E=e[30];let W;e[31]!==t.durationMs?(W=G(t.durationMs),e[31]=t.durationMs,e[32]=W):W=e[32];let D;e[33]!==W?(D=(0,s.jsx)("span",{className:"text-right tabular-nums text-muted-foreground",children:W}),e[33]=W,e[34]=D):D=e[34];let q;e[35]!==t.error?(q=t.error===void 0?null:(0,s.jsx)("span",{className:"text-destructive","data-testid":"tr-span-error-message",title:t.error.message,children:`${t.error.type}: ${t.error.message}`}),e[35]=t.error,e[36]=q):q=e[36];let T;e[37]!==q?(T=(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:q}),e[37]=q,e[38]=T):T=e[38];let z;e[39]!==v?(z=v===""?null:(0,s.jsx)("span",{"data-testid":"tr-span-attributes",title:v,children:v}),e[39]=v,e[40]=z):z=e[40];let P;e[41]!==z?(P=(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:z}),e[41]=z,e[42]=P):P=e[42];let J;e[43]!==r||e[44]!==I||e[45]!==g||e[46]!==k||e[47]!==N||e[48]!==E||e[49]!==D||e[50]!==T||e[51]!==P?(J=(0,s.jsxs)("button",{"aria-controls":I,"aria-expanded":r,"aria-label":g,className:x,"data-testid":k,onClick:C,type:"button",children:[N,E,D,T,P]}),e[43]=r,e[44]=I,e[45]=g,e[46]=k,e[47]=N,e[48]=E,e[49]=D,e[50]=T,e[51]=P,e[52]=J):J=e[52];let F;e[53]!==r||e[54]!==t?(F=r&&(0,s.jsx)("div",{id:`tr-span-detail-${t.spanId}`,children:(0,s.jsx)(je,{span:t})}),e[53]=r,e[54]=t,e[55]=F):F=e[55];let K;return e[56]!==t.depth||e[57]!==J||e[58]!==F?(K=(0,s.jsxs)("li",{"data-depth":S,"data-testid":"tr-span-row",children:[J,F]}),e[56]=t.depth,e[57]=J,e[58]=F,e[59]=K):K=e[59],K},"Be"),ze=m(n=>{let e=(0,O.c)(15),{durationMs:t,spans:a}=n,l=U(),r;e[0]!==t?(r=(0,s.jsx)(We,{traceDurationMs:t}),e[0]=t,e[1]=r):r=e[1];let o;e[2]!==l?(o=l("Trace waterfall"),e[2]=l,e[3]=o):o=e[3];let d;if(e[4]!==t||e[5]!==a){let c;e[7]!==t?(c=m(v=>(0,s.jsx)(qe,{span:v,traceDurationMs:t},v.spanId),"c"),e[7]=t,e[8]=c):c=e[8],d=a.map(c),e[4]=t,e[5]=a,e[6]=d}else d=e[6];let i;e[9]!==o||e[10]!==d?(i=(0,s.jsx)("ul",{"aria-label":o,children:d}),e[9]=o,e[10]=d,e[11]=i):i=e[11];let u;return e[12]!==r||e[13]!==i?(u=(0,s.jsxs)(s.Fragment,{children:[r,i]}),e[12]=r,e[13]=i,e[14]=u):u=e[14],u},"Oe");function Je(n){return(0,s.jsx)("span",{className:te("absolute inset-y-0 border-l border-border/70",n.percent===100?"-translate-x-full pr-1":"pl-1"),style:{left:`${String(n.percent)}%`},children:n.label},n.percent)}m(Je,"We");function Ue(n){return!n}m(Ue,"Ue");var Ge=m(n=>Array.isArray(n?.traces)?n.traces:[],"qe"),He=m(n=>{let e=(0,O.c)(12),{entries:t}=n,a=U(),l;e[0]!==t.length||e[1]!==a?(l=a("Logs ({count})",{count:t.length}),e[0]=t.length,e[1]=a,e[2]=l):l=e[2];let r;e[3]!==l?(r=(0,s.jsx)("p",{className:"mb-1 font-mono text-xs text-muted-foreground",children:l}),e[3]=l,e[4]=r):r=e[4];let o;e[5]!==t?(o=t.map(Ve),e[5]=t,e[6]=o):o=e[6];let d;e[7]!==o?(d=(0,s.jsx)("div",{role:"grid",children:o}),e[7]=o,e[8]=d):d=e[8];let i;return e[9]!==r||e[10]!==d?(i=(0,s.jsxs)("div",{className:"border-t border-border px-3 py-2","data-testid":"tr-logs",children:[r,d]}),e[9]=r,e[10]=d,e[11]=i):i=e[11],i},"ze"),Qe=m(n=>{let e=(0,O.c)(50),{expanded:t,logs:a,onToggle:l,trace:r}=n,o=U(),d;e[0]!==l||e[1]!==r.traceId?(d=m(()=>{l(r.traceId)},"i"),e[0]=l,e[1]=r.traceId,e[2]=d):d=e[2];let i=d,u=`tr-row-${r.traceId}`,c=`tr-waterfall-${r.traceId}`,v=`tr-toggle-${r.traceId}`,$=t?"\u25BE":"\u25B8",_;e[3]!==$?(_=(0,s.jsx)("span",{"aria-hidden":"true",className:"w-3 shrink-0 text-xs text-muted-foreground",children:$}),e[3]=$,e[4]=_):_=e[4];let y;e[5]!==r.rootName?(y=(0,s.jsx)("span",{className:"w-56 shrink-0 truncate text-sm font-medium",title:r.rootName,children:r.rootName}),e[5]=r.rootName,e[6]=y):y=e[6];let w;e[7]!==r.functionPath?(w=(0,s.jsx)("span",{className:"w-48 shrink-0 truncate font-mono text-xs text-muted-foreground",title:r.functionPath,children:r.functionPath}),e[7]=r.functionPath,e[8]=w):w=e[8];let M;e[9]!==r.durationMs?(M=G(r.durationMs),e[9]=r.durationMs,e[10]=M):M=e[10];let p;e[11]!==M?(p=(0,s.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:M}),e[11]=M,e[12]=p):p=e[12];let h;e[13]!==o||e[14]!==r.spans.length?(h=o("{count} spans",{count:r.spans.length}),e[13]=o,e[14]=r.spans.length,e[15]=h):h=e[15];let b;e[16]!==h?(b=(0,s.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:h}),e[16]=h,e[17]=b):b=e[17];let C=r.ok?"secondary":"destructive",S;e[18]!==o||e[19]!==r.ok?(S=r.ok?o("ok"):o("error"),e[18]=o,e[19]=r.ok,e[20]=S):S=e[20];let I;e[21]!==C||e[22]!==S?(I=(0,s.jsx)("span",{className:"shrink-0",children:(0,s.jsx)(oe,{variant:C,children:S})}),e[21]=C,e[22]=S,e[23]=I):I=e[23];let g;e[24]!==r.startTs?(g=de(r.startTs),e[24]=r.startTs,e[25]=g):g=e[25];let x;e[26]!==g?(x=(0,s.jsx)("span",{className:"flex-1 truncate text-right font-mono text-xs tabular-nums text-muted-foreground",children:g}),e[26]=g,e[27]=x):x=e[27];let k;e[28]!==t||e[29]!==i||e[30]!==p||e[31]!==b||e[32]!==I||e[33]!==x||e[34]!==c||e[35]!==v||e[36]!==_||e[37]!==y||e[38]!==w?(k=(0,s.jsxs)("button",{"aria-controls":c,"aria-expanded":t,className:"flex w-full items-center gap-3 px-3 py-2 text-left hover:bg-muted/50","data-testid":v,onClick:i,type:"button",children:[_,y,w,p,b,I,x]}),e[28]=t,e[29]=i,e[30]=p,e[31]=b,e[32]=I,e[33]=x,e[34]=c,e[35]=v,e[36]=_,e[37]=y,e[38]=w,e[39]=k):k=e[39];let f;e[40]!==t||e[41]!==a||e[42]!==r.durationMs||e[43]!==r.spans||e[44]!==r.traceId?(f=t&&(0,s.jsxs)("div",{className:"bg-muted/20","data-testid":`tr-waterfall-${r.traceId}`,id:`tr-waterfall-${r.traceId}`,children:[(0,s.jsx)(ze,{durationMs:r.durationMs,spans:r.spans}),a.length>0&&(0,s.jsx)(He,{entries:a})]}),e[40]=t,e[41]=a,e[42]=r.durationMs,e[43]=r.spans,e[44]=r.traceId,e[45]=f):f=e[45];let N;return e[46]!==k||e[47]!==f||e[48]!==u?(N=(0,s.jsxs)("div",{className:"border-b border-border last:border-b-0","data-testid":u,children:[k,f]}),e[46]=k,e[47]=f,e[48]=u,e[49]=N):N=e[49],N},"Ge"),bt=m(n=>{let e=(0,O.c)(58),{initialShardKey:t}=n,a=U(),[l]=(0,A.useState)(ye),{queryShardKey:r,setShardKey:o,shardKey:d}=be(l?.shardKey!==void 0&&l.shardKey!==""?l.shardKey:t??""),[i,u]=(0,A.useState)(l?.traceId??""),[c,v]=(0,A.useState)(!1),[$,_]=(0,A.useState)(Xe),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0],(0,A.useEffect)(Ye,y);let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w={},e[1]=w):w=e[1];let M;e[2]!==r?(M={live:!0,shardKey:r},e[2]=r,e[3]=M):M=e[3];let{data:p,error:h,errorSource:b,isLoading:C,liveError:S}=ie(ce.getTraces,w,M),I;e[4]===Symbol.for("react.memo_cache_sentinel")?(I={},e[4]=I):I=e[4];let g=$.size>0,x;e[5]!==r||e[6]!==g?(x={enabled:g,live:!0,shardKey:r},e[5]=r,e[6]=g,e[7]=x):x=e[7];let{data:k}=ie(ce.getLogs,I,x),f,N;e[8]!==p||e[9]!==r?(f=m(()=>{p!==void 0&&he(r)},"p"),N=[p,r],e[8]=p,e[9]=r,e[10]=f,e[11]=N):(f=e[10],N=e[11]),(0,A.useEffect)(f,N);let B;if(e[12]!==p||e[13]!==h||e[14]!==b||e[15]!==$||e[16]!==C||e[17]!==S||e[18]!==k?.entries||e[19]!==c||e[20]!==i||e[21]!==o||e[22]!==d||e[23]!==a){let L=Ge(p),E=p?.total??L.length,W=E>L.length,D=De(L,i,c),q=Map.groupBy((k?.entries??[]).toReversed(),Ze),T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=m(j=>{u(j.target.value)},"C"),e[25]=T):T=e[25];let z=T,P;e[26]===Symbol.for("react.memo_cache_sentinel")?(P=m(j=>{_($e=>{let ne=new Set($e);return ne.has(j)?ne.delete(j):ne.add(j),ne})},"E"),e[26]=P):P=e[26];let J=P,F=h===null&&D.length===0&&!C,K;e[27]!==o||e[28]!==d?(K=(0,s.jsx)(fe,{onChange:o,testId:"tr-shard-input",value:d}),e[27]=o,e[28]=d,e[29]=K):K=e[29];let H;e[30]!==a?(H=a("Search traces"),e[30]=a,e[31]=H):H=e[31];let Q;e[32]!==a?(Q=a("search trace, span, or function"),e[32]=a,e[33]=Q):Q=e[33];let V;e[34]!==i||e[35]!==H||e[36]!==Q?(V=(0,s.jsx)(me,{"aria-label":H,className:"h-8 w-56","data-testid":"tr-search",onChange:z,placeholder:Q,value:i}),e[34]=i,e[35]=H,e[36]=Q,e[37]=V):V=e[37];let X;e[38]!==c?(X=(0,s.jsx)(xe,{checked:c,"data-testid":"tr-only-errors",id:"tr-only-errors",onCheckedChange:v}),e[38]=c,e[39]=X):X=e[39];let Y;e[40]!==a?(Y=a("Errors only"),e[40]=a,e[41]=Y):Y=e[41];let Z;e[42]!==X||e[43]!==Y?(Z=(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",htmlFor:"tr-only-errors",children:[X,Y]}),e[42]=X,e[43]=Y,e[44]=Z):Z=e[44];let R;e[45]!==S?(R=(0,s.jsx)(Ne,{message:S,prefix:"tr"}),e[45]=S,e[46]=R):R=e[46];let re;e[47]!==K||e[48]!==V||e[49]!==Z||e[50]!==R?(re=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[K,V,Z,R]}),e[47]=K,e[48]=V,e[49]=Z,e[50]=R,e[51]=re):re=e[51];let ae;e[52]!==h||e[53]!==b?(ae=h!==null&&(0,s.jsx)(ge,{error:b,testId:"tr-error"}),e[52]=h,e[53]=b,e[54]=ae):ae=e[54];let se;e[55]!==F||e[56]!==a?(se=F&&(0,s.jsx)(ue,{description:a("Traces recorded with ctx.trace show up here as your app handles traffic. The span buffer resets when the shard hibernates."),icon:(0,s.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M4 6h10M7 12h13M10 18h7"})}),testId:"tr-empty",title:a("No traces")}),e[55]=F,e[56]=a,e[57]=se):se=e[57],B=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-traces-panel",children:[re,ae,se,h===null&&W&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"tr-truncated",children:a("Showing the {shown} most recent of {total} traces in the buffer.",{shown:L.length,total:E})}),h===null&&D.length>0&&(0,s.jsx)("div",{"aria-label":a("Recent traces"),className:"overflow-hidden rounded-xl border border-border shadow-xs","data-testid":"tr-list",children:D.map(j=>(0,s.jsx)(Qe,{expanded:$.has(j.traceId),logs:q.get(j.traceId)??[],onToggle:J,trace:j},j.traceId))})]}),e[12]=p,e[13]=h,e[14]=b,e[15]=$,e[16]=C,e[17]=S,e[18]=k?.entries,e[19]=c,e[20]=i,e[21]=o,e[22]=d,e[23]=a,e[24]=B}else B=e[24];return B},"bt");function Ve(n,e){return(0,s.jsx)("div",{className:"flex items-center border-b border-border py-1 font-mono text-xs last:border-b-0","data-testid":"tr-log-row",role:"row",children:(0,s.jsx)(Me,{entry:n})},`${String(e)}:${String(n.timestamp)}`)}m(Ve,"He");function Xe(){return new Set}m(Xe,"Je");function Ye(){we()}m(Ye,"Qe");function Ze(n){return n.traceId}m(Ze,"Ve");export{bt as default};
@@ -1 +1 @@
1
- import{a as d,d as n,f as c,g as p}from"./chunk-I26MS5PJ.js";var b=n(c(),1),s=n(p(),1);var y={alignItems:"center",border:"1px solid",borderRadius:4,display:"inline-flex",fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:11,fontWeight:400,gap:6,letterSpacing:"0.06em",lineHeight:1.4,padding:"1px 8px",textTransform:"uppercase"},g={borderRadius:"50%",display:"inline-block",height:7,width:7},h=d((l,e,t,a)=>({badgeStyle:{...y,borderColor:l,color:l},color:l,dotStyle:{...g,backgroundColor:l},hint:a,label:e,title:t}),"i"),S={global:h("var(--royal-amethyst)","Global \xB7 D1","Global table \u2014 a single D1 table shared across all shards","Declared .global() and stored once in Cloudflare D1, shared across every shard and tenant. Auth tables (user, session, \u2026) live here too."),shard:h("var(--sky-sapphire)","Shard-local","Shard-local table \u2014 per-shard SQLite inside a Durable Object","Stored per shard key in a Durable Object's SQLite (.shardBy(...)). You are viewing one shard at a time \u2014 change the shard key to inspect another.")},m=d(l=>{let e=(0,b.c)(9),{tier:t}=l,a=S[t],i=`storage-tier-${t}`,r;e[0]!==a.dotStyle?(r=(0,s.jsx)("span",{"aria-hidden":"true",style:a.dotStyle}),e[0]=a.dotStyle,e[1]=r):r=e[1];let o;return e[2]!==a.badgeStyle||e[3]!==a.label||e[4]!==a.title||e[5]!==i||e[6]!==r||e[7]!==t?(o=(0,s.jsxs)("span",{"data-testid":i,"data-tier":t,style:a.badgeStyle,title:a.title,children:[r,a.label]}),e[2]=a.badgeStyle,e[3]=a.label,e[4]=a.title,e[5]=i,e[6]=r,e[7]=t,e[8]=o):o=e[8],o},"y");export{S as a,m as b};
1
+ import{a as d,d as n,f as c,g as p}from"./chunk-OXFKZ4BM.js";var b=n(c(),1),s=n(p(),1);var y={alignItems:"center",border:"1px solid",borderRadius:4,display:"inline-flex",fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:11,fontWeight:400,gap:6,letterSpacing:"0.06em",lineHeight:1.4,padding:"1px 8px",textTransform:"uppercase"},g={borderRadius:"50%",display:"inline-block",height:7,width:7},h=d((l,e,t,a)=>({badgeStyle:{...y,borderColor:l,color:l},color:l,dotStyle:{...g,backgroundColor:l},hint:a,label:e,title:t}),"i"),S={global:h("var(--royal-amethyst)","Global \xB7 D1","Global table \u2014 a single D1 table shared across all shards","Declared .global() and stored once in Cloudflare D1, shared across every shard and tenant. Auth tables (user, session, \u2026) live here too."),shard:h("var(--sky-sapphire)","Shard-local","Shard-local table \u2014 per-shard SQLite inside a Durable Object","Stored per shard key in a Durable Object's SQLite (.shardBy(...)). You are viewing one shard at a time \u2014 change the shard key to inspect another.")},m=d(l=>{let e=(0,b.c)(9),{tier:t}=l,a=S[t],i=`storage-tier-${t}`,r;e[0]!==a.dotStyle?(r=(0,s.jsx)("span",{"aria-hidden":"true",style:a.dotStyle}),e[0]=a.dotStyle,e[1]=r):r=e[1];let o;return e[2]!==a.badgeStyle||e[3]!==a.label||e[4]!==a.title||e[5]!==i||e[6]!==r||e[7]!==t?(o=(0,s.jsxs)("span",{"data-testid":i,"data-tier":t,style:a.badgeStyle,title:a.title,children:[r,a.label]}),e[2]=a.badgeStyle,e[3]=a.label,e[4]=a.title,e[5]=i,e[6]=r,e[7]=t,e[8]=o):o=e[8],o},"y");export{S as a,m as b};
@@ -1 +1 @@
1
- import{a as n,d as E,e as S,g as m}from"./chunk-I26MS5PJ.js";function u(t,e=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(e,Math.min(t,r))}n(u,"clamp");var p=1;function x(t,e){return Math.max(0,t-e)}n(x,"getMaxScrollOffset");function A(t,e){if(e<=0)return 0;let r=u(t,0,e),l=r,c=e-r,a=l<=p,i=c<=p;return a&&i?l<=c?0:e:a?0:i?e:r}n(A,"normalizeScrollOffset");var f=E(m(),1),o="base-ui-disable-scrollbar",R={className:o,getElement(t){return(0,f.jsx)("style",{nonce:t,href:o,precedence:"base-ui:low",children:`.${o}{scrollbar-width:none}.${o}::-webkit-scrollbar{display:none}`})}};var s=E(S(),1);var b=s.createContext(void 0),C={disableStyleElements:!1};function y(){return s.useContext(b)??C}n(y,"useCSPContext");export{u as a,p as b,x as c,A as d,R as e,y as f};
1
+ import{a as n,d as E,e as S,g as m}from"./chunk-OXFKZ4BM.js";function u(t,e=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(e,Math.min(t,r))}n(u,"clamp");var p=1;function x(t,e){return Math.max(0,t-e)}n(x,"getMaxScrollOffset");function A(t,e){if(e<=0)return 0;let r=u(t,0,e),l=r,c=e-r,a=l<=p,i=c<=p;return a&&i?l<=c?0:e:a?0:i?e:r}n(A,"normalizeScrollOffset");var f=E(m(),1),o="base-ui-disable-scrollbar",R={className:o,getElement(t){return(0,f.jsx)("style",{nonce:t,href:o,precedence:"base-ui:low",children:`.${o}{scrollbar-width:none}.${o}::-webkit-scrollbar{display:none}`})}};var s=E(S(),1);var b=s.createContext(void 0),C={disableStyleElements:!1};function y(){return s.useContext(b)??C}n(y,"useCSPContext");export{u as a,p as b,x as c,A as d,R as e,y as f};
@@ -1 +1 @@
1
- import{a as f}from"./chunk-2IKDEUCX.js";import{a as u,d as x,f as h,g as N}from"./chunk-I26MS5PJ.js";var b=x(h(),1);var t=x(N(),1);var v=u(g=>{let e=(0,b.c)(16),{chart:c,footer:n,label:i,testId:m,value:p}=g,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i}),e[0]=i,e[1]=r):r=e[1];let a;e[2]!==m||e[3]!==p?(a=(0,t.jsx)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":m,children:p}),e[2]=m,e[3]=p,e[4]=a):a=e[4];let s;e[5]!==c||e[6]!==a?(s=(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[a,c]}),e[5]=c,e[6]=a,e[7]=s):s=e[7];let l;e[8]!==r||e[9]!==s?(l=(0,t.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[r,s]}),e[8]=r,e[9]=s,e[10]=l):l=e[10];let o;e[11]!==n?(o=n!=null&&(0,t.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:n}),e[11]=n,e[12]=o):o=e[12];let d;return e[13]!==l||e[14]!==o?(d=(0,t.jsxs)(f,{className:"justify-between gap-0 py-0",children:[l,o]}),e[13]=l,e[14]=o,e[15]=d):d=e[15],d},"j");export{v as a};
1
+ import{a as f}from"./chunk-MD67S53Z.js";import{a as u,d as x,f as h,g as N}from"./chunk-OXFKZ4BM.js";var b=x(h(),1);var t=x(N(),1);var v=u(g=>{let e=(0,b.c)(16),{chart:c,footer:n,label:i,testId:m,value:p}=g,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i}),e[0]=i,e[1]=r):r=e[1];let a;e[2]!==m||e[3]!==p?(a=(0,t.jsx)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":m,children:p}),e[2]=m,e[3]=p,e[4]=a):a=e[4];let s;e[5]!==c||e[6]!==a?(s=(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[a,c]}),e[5]=c,e[6]=a,e[7]=s):s=e[7];let l;e[8]!==r||e[9]!==s?(l=(0,t.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[r,s]}),e[8]=r,e[9]=s,e[10]=l):l=e[10];let o;e[11]!==n?(o=n!=null&&(0,t.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:n}),e[11]=n,e[12]=o):o=e[12];let d;return e[13]!==l||e[14]!==o?(d=(0,t.jsxs)(f,{className:"justify-between gap-0 py-0",children:[l,o]}),e[13]=l,e[14]=o,e[15]=d):d=e[15],d},"j");export{v as a};
@@ -1 +1 @@
1
- import{G as ve,H as Ce,c as Z,d as fe,f as he,fa as Pe,g as ge,ga as G,h as ye,ha as Re,i as Se,ia as we,ja as be,ka as Ee,ta as xe}from"./chunk-NXQW5E6W.js";import{b as Y}from"./chunk-UC7MNI2F.js";import{F as U,H as j,M as V,N,e as de}from"./chunk-MVWZMWPD.js";import{a as Ye}from"./chunk-SJQERRSZ.js";import{a as ue}from"./chunk-7Y3SY37W.js";import{a as v,c as E,e as le,i as pe,r as me,w as W}from"./chunk-AUAECCXB.js";import{c as ce,g as w,i as D}from"./chunk-BOMPSVRC.js";import{a as n,d as R,e as B,g as je}from"./chunk-I26MS5PJ.js";var Te=class{static{n(this,"BasePopupHandle")}attachedStores=[];attachedStoreValue=null;storeListeners=new Set;constructor(t,o,r=!0){this.fallbackStore=t,this.componentName=o,this.throwOnMissingTrigger=r}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(t){return this.storeListeners.add(t),()=>{this.storeListeners.delete(t)}}attachStore(t){return this.attachedStores.push(t),this.setActiveStore(t),()=>{let o=this.attachedStores.lastIndexOf(t);o!==-1&&this.attachedStores.splice(o,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(t){this.attachedStoreValue!==t&&(this.attachedStoreValue=t,this.storeListeners.forEach(o=>{o()}))}openByTrigger(t){let o=this.attachedStore;if(o===null)return;let r;if(t){for(let s=this.attachedStores.length-1;s>=0&&!r;s-=1)r=this.attachedStores[s].context.triggerElements.getById(t);r??=this.fallbackStore.context.triggerElements.getById(t)}if(t&&!r&&this.throwOnMissingTrigger)throw new Error(ce(99,this.componentName,t,this.componentName));o.setOpen(!0,N(V.imperativeAction,void 0,r))}closePopup(){let t=this.attachedStore;t!==null&&t.setOpen(!1,N(V.imperativeAction))}};var ee=R(B(),1),Oe=R(Ye(),1);function rt(e){let t=ee.useCallback(r=>e===void 0?w:e.subscribeStore(r),[e]),o=ee.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,Oe.useSyncExternalStore)(t,o,()=>e?.serverStore)}n(rt,"usePopupHandleStore");var Ae=R(B(),1),te=R(ue(),1);function lt(e,t){let o=Ae.useRef(null);function r(i){te.flushSync(()=>{e.setOpen(!1,N(V.focusOut,i.nativeEvent,i.currentTarget))}),ye(o.current)?.focus()}n(r,"handlePreFocusGuardFocus");function s(i){let u=e.select("positionerElement");if(u&&Se(i,u))e.context.beforeContentFocusGuardRef.current?.focus();else{te.flushSync(()=>{e.setOpen(!1,N(V.focusOut,i.nativeEvent,i.currentTarget))});let a=ge(e.context.triggerFocusTargetRef.current||t.current);for(;a!==null&&de(u,a);){let l=a;if(a=he(a),a===l)break}a?.focus()}}return n(s,"handleFocusTargetFocus"),{preFocusGuardRef:o,handlePreFocusGuardFocus:r,handleFocusTargetFocus:s}}n(lt,"useTriggerFocusGuards");var c=R(B(),1),Le=R(ue(),1);var F=R(B(),1);function oe(e){let t=me(e),o=parseFloat(t.width)||0,r=parseFloat(t.height)||0,s=pe(e),i=s?e.offsetWidth:o,u=s?e.offsetHeight:r;return(Z(o)!==i||Z(r)!==u)&&(o=i,r=u),{width:o,height:r}}n(oe,"getCssDimensions");var H="--popup-width",_="--popup-height";function Ne(e){let{popupElement:t,positionerElement:o,content:r,mounted:s,onMeasureLayout:i,onMeasureLayoutComplete:u,side:a,direction:l}=e,g=j(t,!0),C=U(),p=F.useRef(null),d=F.useRef(!0),m=F.useRef(w),y=E(i),h=E(u),b=F.useMemo(()=>Ge(a,l),[a,l]);v(()=>{if(!s){m.current=w,d.current=!0,p.current=null;return}if(!t||!o)return;m.current=Ve(t,b),ne(t,"auto");let I=q(t,"position","static"),x=q(t,"transform","none"),S=q(t,"scale","1"),T=Ve(o,{[Re]:"max-content",[we]:"max-content"});function X(){I(),x(),T()}n(X,"restoreMeasurementOverrides");function L(){X(),S()}if(n(L,"restoreMeasurementOverridesIncludingScale"),y?.(),d.current||p.current===null){K(o,"max-content");let A=oe(t);return p.current=A,K(o,A),L(),h?.(null,A),d.current=!1,()=>{m.current(),m.current=w}}K(o,"max-content");let O=p.current,P=oe(t);p.current=P,ne(t,O),L(),h?.(O,P),K(o,P);let $=new AbortController;return C.request(()=>{ne(t,P),g(()=>{t.style.setProperty(H,"auto"),t.style.setProperty(_,"auto")},$.signal)}),()=>{$.abort(),C.cancel(),m.current(),m.current=w}},[r,t,o,g,C,s,y,h,b])}n(Ne,"usePopupAutoResize");function Ge(e,t){let o=e==="top",r=e==="left"||e===(t==="rtl"?"inline-end":"inline-start");return!o&&!r?D:{position:"absolute",[o?"bottom":"top"]:"0",[r?"right":"left"]:"0"}}n(Ge,"getPopupAnchoringStyles");function q(e,t,o){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,o),()=>{e.style.setProperty(t,r)}}n(q,"overrideElementStyle");function Ve(e,t){let o=[];for(let[r,s]of Object.entries(t))o.push(q(e,r,s));return o.length?()=>{o.forEach(r=>r())}:w}n(Ve,"applyElementStyles");function ne(e,t){let o=t==="auto"?"auto":`${t.width}px`,r=t==="auto"?"auto":`${t.height}px`;e.style.setProperty(H,o),e.style.setProperty(_,r)}n(ne,"setPopupCssSize");function K(e,t){let o=t==="max-content"?"max-content":`${t.width}px`,r=t==="max-content"?"max-content":`${t.height}px`;e.style.setProperty(be,o),e.style.setProperty(Ee,r)}n(K,"setPositionerCssSize");var Fe={name:"adaptiveOrigin",async fn(e){let{x:t,y:o,rects:{floating:r},elements:{floating:s},platform:i,strategy:u,placement:a}=e,l=le(s),g=l.getComputedStyle(s);if(!(g.transitionDuration!=="0s"&&g.transitionDuration!==""))return{x:t,y:o,data:G};let p=await i.getOffsetParent?.(s),d={width:0,height:0};if(u==="fixed"&&l?.visualViewport)d={width:l.visualViewport.width,height:l.visualViewport.height};else if(p===l){let x=W(s);d={width:x.documentElement.clientWidth,height:x.documentElement.clientHeight}}else await i.isElement?.(p)&&(d=await i.getDimensions(p));let m=fe(a),y=t,h=o;m==="left"&&(y=d.width-(t+r.width)),m==="top"&&(h=d.height-(o+r.height));let b=m==="left"?"right":G.sideX,I=m==="top"?"bottom":G.sideY;return{x:y,y:h,data:{sideX:b,sideY:I}}}};var Me="data-activation-direction";var M=R(je(),1);var Yt={activationDirection:n(e=>e?{[Me]:e}:null,"activationDirection")};function Gt(e){let{store:t,side:o,children:r}=e,s=Y(),i=t.useState("activeTriggerElement"),u=t.useState("activeTriggerId"),a=t.useState("open"),l=t.useState("payload"),g=t.useState("mounted"),C=t.useState("popupElement"),p=t.useState("positionerElement"),d=xe(a?i:null),m=Je(u,l),y=c.useRef(null),[h,b]=c.useState(null),[I,x]=c.useState(null),S=c.useRef(null),T=c.useRef(null),X=j(S,!0),L=U(),O=c.useRef(null),[P,$]=c.useState(null),[A,J]=c.useState(!1);v(()=>(t.set("adaptiveOrigin",Fe),()=>{t.set("adaptiveOrigin",void 0)}),[t]);let ke=E(()=>{S.current?.style.setProperty("animation","none"),S.current?.style.setProperty("transition","none"),T.current?.style.setProperty("display","none")}),Be=E(f=>{S.current?.style.removeProperty("animation"),S.current?.style.removeProperty("transition"),T.current?.style.removeProperty("display"),f&&$(f)}),ie=E(()=>{O.current?.abort();let f=new AbortController;O.current=f,X(()=>{b(null),$(null),y.current=null},f.signal)}),z=c.useRef(null);v(()=>{(!a||!g)&&(z.current=null)},[a,g]),v(()=>{if(i&&d&&i!==d&&z.current!==i&&y.current){b(y.current),J(!0);let f=Xe(d,i);x(f),z.current=i}},[i,d]),v(()=>{h!=null&&(O.current?.abort(),J(!0),L.request(()=>{Le.flushSync(()=>{J(!1)}),ie()}))},[m,h,ie,L]),v(()=>{let f=S.current;if(!f)return;let ae=W(f).createElement("div");for(let Ue of Array.from(f.childNodes))ae.appendChild(Ue.cloneNode(!0));y.current=ae});let se=h!=null,Q;se?Q=(0,M.jsxs)(c.Fragment,{children:[(0,M.jsx)("div",{"data-previous":!0,inert:Pe(!0),ref:T,style:{...P?{[H]:`${P.width}px`,[_]:`${P.height}px`}:null,position:"absolute"},"data-ending-style":A?void 0:""},"previous"),(0,M.jsx)("div",{"data-current":!0,ref:S,"data-starting-style":A?"":void 0,children:r},m)]}):Q=(0,M.jsx)("div",{"data-current":!0,ref:S,children:r},m),v(()=>{let f=T.current;!f||!h||f.replaceChildren(...Array.from(h.childNodes))},[h]),Ne({popupElement:C,positionerElement:p,mounted:g,content:l,onMeasureLayout:ke,onMeasureLayoutComplete:Be,side:o,direction:s});let We={activationDirection:qe(I),transitioning:se};return{children:Q,state:We}}n(Gt,"usePopupViewport");function qe(e){if(e)return`${Ie(e.horizontal,5,"right","left")} ${Ie(e.vertical,5,"down","up")}`}n(qe,"getActivationDirection");function Ie(e,t,o,r){return e>t?o:e<-t?r:""}n(Ie,"getValueWithTolerance");function Xe(e,t){let o=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s={x:o.left+o.width/2,y:o.top+o.height/2},i={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:i.x-s.x,vertical:i.y-s.y}}n(Xe,"calculateRelativePosition");function Je(e,t){let[o,r]=c.useState(0),s=c.useRef(e),i=c.useRef(t),u=c.useRef(!1);return v(()=>{let a=s.current,l=i.current,g=e!==a,C=t!==l;g?(r(p=>p+1),u.current=!C):u.current&&C&&(r(p=>p+1),u.current=!1),s.current=e,i.current=t},[e,t]),`${e??"current"}-${o}`}n(Je,"usePopupContentKey");function zt(e,t,o=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Ce({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:o,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:D,inactiveTriggerProps:D,popupProps:D}}n(zt,"createInitialPopupStoreState");var k=n(e=>e.triggerIdProp??e.activeTriggerId,"activeTriggerIdSelector"),re=n(e=>e.openProp??e.open,"openSelector"),$e=n(e=>(e.popupElement?.id??e.floatingId)||void 0,"popupIdSelector");function He(e,t){return t!==void 0&&re(e)&&k(e)===t}n(He,"triggerOwnsOpenPopup");function ze(e,t){return He(e,t)?!0:t!==void 0&&re(e)&&k(e)==null&&e.triggerCount===1}n(ze,"triggerOwnsOpenPopupOrIsOnlyTrigger");var Qt={open:re,mounted:n(e=>e.mounted,"mounted"),transitionStatus:n(e=>e.transitionStatus,"transitionStatus"),floatingRootContext:n(e=>e.floatingRootContext,"floatingRootContext"),triggerCount:n(e=>e.triggerCount,"triggerCount"),preventUnmountingOnClose:n(e=>e.preventUnmountingOnClose,"preventUnmountingOnClose"),payload:n(e=>e.payload,"payload"),activeTriggerId:k,activeTriggerElement:n(e=>e.mounted?e.activeTriggerElement:null,"activeTriggerElement"),popupId:$e,isTriggerActive:n((e,t)=>t!==void 0&&k(e)===t,"isTriggerActive"),isOpenedByTrigger:n((e,t)=>He(e,t),"isOpenedByTrigger"),isMountedByTrigger:n((e,t)=>t!==void 0&&k(e)===t&&e.mounted,"isMountedByTrigger"),triggerProps:n((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,"triggerProps"),triggerPopupId:n((e,t)=>ze(e,t)?$e(e):void 0,"triggerPopupId"),popupProps:n(e=>e.popupProps,"popupProps"),popupElement:n(e=>e.popupElement,"popupElement"),positionerElement:n(e=>e.positionerElement,"positionerElement")};var _e=class extends ve{static{n(this,"NullStore")}setState(t){}update(t){}set(t,o){}notifyAll(){}};export{Te as a,zt as b,Qt as c,rt as d,_e as e,lt as f,Yt as g,Gt as h};
1
+ import{G as ve,H as Ce,c as Z,d as fe,f as he,fa as Pe,g as ge,ga as G,h as ye,ha as Re,i as Se,ia as we,ja as be,ka as Ee,ta as xe}from"./chunk-KRPXOSBL.js";import{b as Y}from"./chunk-W2BCSK5S.js";import{a as Ye}from"./chunk-ZTOREMGH.js";import{F as U,H as j,M as V,N,e as de}from"./chunk-W7MRISE3.js";import{a as ue}from"./chunk-IBJVVHV5.js";import{a as v,c as E,e as le,i as pe,r as me,w as W}from"./chunk-ZBON5T5A.js";import{c as ce,g as w,i as D}from"./chunk-4C4THJUD.js";import{a as n,d as R,e as B,g as je}from"./chunk-OXFKZ4BM.js";var Te=class{static{n(this,"BasePopupHandle")}attachedStores=[];attachedStoreValue=null;storeListeners=new Set;constructor(t,o,r=!0){this.fallbackStore=t,this.componentName=o,this.throwOnMissingTrigger=r}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(t){return this.storeListeners.add(t),()=>{this.storeListeners.delete(t)}}attachStore(t){return this.attachedStores.push(t),this.setActiveStore(t),()=>{let o=this.attachedStores.lastIndexOf(t);o!==-1&&this.attachedStores.splice(o,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(t){this.attachedStoreValue!==t&&(this.attachedStoreValue=t,this.storeListeners.forEach(o=>{o()}))}openByTrigger(t){let o=this.attachedStore;if(o===null)return;let r;if(t){for(let s=this.attachedStores.length-1;s>=0&&!r;s-=1)r=this.attachedStores[s].context.triggerElements.getById(t);r??=this.fallbackStore.context.triggerElements.getById(t)}if(t&&!r&&this.throwOnMissingTrigger)throw new Error(ce(99,this.componentName,t,this.componentName));o.setOpen(!0,N(V.imperativeAction,void 0,r))}closePopup(){let t=this.attachedStore;t!==null&&t.setOpen(!1,N(V.imperativeAction))}};var ee=R(B(),1),Oe=R(Ye(),1);function rt(e){let t=ee.useCallback(r=>e===void 0?w:e.subscribeStore(r),[e]),o=ee.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,Oe.useSyncExternalStore)(t,o,()=>e?.serverStore)}n(rt,"usePopupHandleStore");var Ae=R(B(),1),te=R(ue(),1);function lt(e,t){let o=Ae.useRef(null);function r(i){te.flushSync(()=>{e.setOpen(!1,N(V.focusOut,i.nativeEvent,i.currentTarget))}),ye(o.current)?.focus()}n(r,"handlePreFocusGuardFocus");function s(i){let u=e.select("positionerElement");if(u&&Se(i,u))e.context.beforeContentFocusGuardRef.current?.focus();else{te.flushSync(()=>{e.setOpen(!1,N(V.focusOut,i.nativeEvent,i.currentTarget))});let a=ge(e.context.triggerFocusTargetRef.current||t.current);for(;a!==null&&de(u,a);){let l=a;if(a=he(a),a===l)break}a?.focus()}}return n(s,"handleFocusTargetFocus"),{preFocusGuardRef:o,handlePreFocusGuardFocus:r,handleFocusTargetFocus:s}}n(lt,"useTriggerFocusGuards");var c=R(B(),1),Le=R(ue(),1);var F=R(B(),1);function oe(e){let t=me(e),o=parseFloat(t.width)||0,r=parseFloat(t.height)||0,s=pe(e),i=s?e.offsetWidth:o,u=s?e.offsetHeight:r;return(Z(o)!==i||Z(r)!==u)&&(o=i,r=u),{width:o,height:r}}n(oe,"getCssDimensions");var H="--popup-width",_="--popup-height";function Ne(e){let{popupElement:t,positionerElement:o,content:r,mounted:s,onMeasureLayout:i,onMeasureLayoutComplete:u,side:a,direction:l}=e,g=j(t,!0),C=U(),p=F.useRef(null),d=F.useRef(!0),m=F.useRef(w),y=E(i),h=E(u),b=F.useMemo(()=>Ge(a,l),[a,l]);v(()=>{if(!s){m.current=w,d.current=!0,p.current=null;return}if(!t||!o)return;m.current=Ve(t,b),ne(t,"auto");let I=q(t,"position","static"),x=q(t,"transform","none"),S=q(t,"scale","1"),T=Ve(o,{[Re]:"max-content",[we]:"max-content"});function X(){I(),x(),T()}n(X,"restoreMeasurementOverrides");function L(){X(),S()}if(n(L,"restoreMeasurementOverridesIncludingScale"),y?.(),d.current||p.current===null){K(o,"max-content");let A=oe(t);return p.current=A,K(o,A),L(),h?.(null,A),d.current=!1,()=>{m.current(),m.current=w}}K(o,"max-content");let O=p.current,P=oe(t);p.current=P,ne(t,O),L(),h?.(O,P),K(o,P);let $=new AbortController;return C.request(()=>{ne(t,P),g(()=>{t.style.setProperty(H,"auto"),t.style.setProperty(_,"auto")},$.signal)}),()=>{$.abort(),C.cancel(),m.current(),m.current=w}},[r,t,o,g,C,s,y,h,b])}n(Ne,"usePopupAutoResize");function Ge(e,t){let o=e==="top",r=e==="left"||e===(t==="rtl"?"inline-end":"inline-start");return!o&&!r?D:{position:"absolute",[o?"bottom":"top"]:"0",[r?"right":"left"]:"0"}}n(Ge,"getPopupAnchoringStyles");function q(e,t,o){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,o),()=>{e.style.setProperty(t,r)}}n(q,"overrideElementStyle");function Ve(e,t){let o=[];for(let[r,s]of Object.entries(t))o.push(q(e,r,s));return o.length?()=>{o.forEach(r=>r())}:w}n(Ve,"applyElementStyles");function ne(e,t){let o=t==="auto"?"auto":`${t.width}px`,r=t==="auto"?"auto":`${t.height}px`;e.style.setProperty(H,o),e.style.setProperty(_,r)}n(ne,"setPopupCssSize");function K(e,t){let o=t==="max-content"?"max-content":`${t.width}px`,r=t==="max-content"?"max-content":`${t.height}px`;e.style.setProperty(be,o),e.style.setProperty(Ee,r)}n(K,"setPositionerCssSize");var Fe={name:"adaptiveOrigin",async fn(e){let{x:t,y:o,rects:{floating:r},elements:{floating:s},platform:i,strategy:u,placement:a}=e,l=le(s),g=l.getComputedStyle(s);if(!(g.transitionDuration!=="0s"&&g.transitionDuration!==""))return{x:t,y:o,data:G};let p=await i.getOffsetParent?.(s),d={width:0,height:0};if(u==="fixed"&&l?.visualViewport)d={width:l.visualViewport.width,height:l.visualViewport.height};else if(p===l){let x=W(s);d={width:x.documentElement.clientWidth,height:x.documentElement.clientHeight}}else await i.isElement?.(p)&&(d=await i.getDimensions(p));let m=fe(a),y=t,h=o;m==="left"&&(y=d.width-(t+r.width)),m==="top"&&(h=d.height-(o+r.height));let b=m==="left"?"right":G.sideX,I=m==="top"?"bottom":G.sideY;return{x:y,y:h,data:{sideX:b,sideY:I}}}};var Me="data-activation-direction";var M=R(je(),1);var Yt={activationDirection:n(e=>e?{[Me]:e}:null,"activationDirection")};function Gt(e){let{store:t,side:o,children:r}=e,s=Y(),i=t.useState("activeTriggerElement"),u=t.useState("activeTriggerId"),a=t.useState("open"),l=t.useState("payload"),g=t.useState("mounted"),C=t.useState("popupElement"),p=t.useState("positionerElement"),d=xe(a?i:null),m=Je(u,l),y=c.useRef(null),[h,b]=c.useState(null),[I,x]=c.useState(null),S=c.useRef(null),T=c.useRef(null),X=j(S,!0),L=U(),O=c.useRef(null),[P,$]=c.useState(null),[A,J]=c.useState(!1);v(()=>(t.set("adaptiveOrigin",Fe),()=>{t.set("adaptiveOrigin",void 0)}),[t]);let ke=E(()=>{S.current?.style.setProperty("animation","none"),S.current?.style.setProperty("transition","none"),T.current?.style.setProperty("display","none")}),Be=E(f=>{S.current?.style.removeProperty("animation"),S.current?.style.removeProperty("transition"),T.current?.style.removeProperty("display"),f&&$(f)}),ie=E(()=>{O.current?.abort();let f=new AbortController;O.current=f,X(()=>{b(null),$(null),y.current=null},f.signal)}),z=c.useRef(null);v(()=>{(!a||!g)&&(z.current=null)},[a,g]),v(()=>{if(i&&d&&i!==d&&z.current!==i&&y.current){b(y.current),J(!0);let f=Xe(d,i);x(f),z.current=i}},[i,d]),v(()=>{h!=null&&(O.current?.abort(),J(!0),L.request(()=>{Le.flushSync(()=>{J(!1)}),ie()}))},[m,h,ie,L]),v(()=>{let f=S.current;if(!f)return;let ae=W(f).createElement("div");for(let Ue of Array.from(f.childNodes))ae.appendChild(Ue.cloneNode(!0));y.current=ae});let se=h!=null,Q;se?Q=(0,M.jsxs)(c.Fragment,{children:[(0,M.jsx)("div",{"data-previous":!0,inert:Pe(!0),ref:T,style:{...P?{[H]:`${P.width}px`,[_]:`${P.height}px`}:null,position:"absolute"},"data-ending-style":A?void 0:""},"previous"),(0,M.jsx)("div",{"data-current":!0,ref:S,"data-starting-style":A?"":void 0,children:r},m)]}):Q=(0,M.jsx)("div",{"data-current":!0,ref:S,children:r},m),v(()=>{let f=T.current;!f||!h||f.replaceChildren(...Array.from(h.childNodes))},[h]),Ne({popupElement:C,positionerElement:p,mounted:g,content:l,onMeasureLayout:ke,onMeasureLayoutComplete:Be,side:o,direction:s});let We={activationDirection:qe(I),transitioning:se};return{children:Q,state:We}}n(Gt,"usePopupViewport");function qe(e){if(e)return`${Ie(e.horizontal,5,"right","left")} ${Ie(e.vertical,5,"down","up")}`}n(qe,"getActivationDirection");function Ie(e,t,o,r){return e>t?o:e<-t?r:""}n(Ie,"getValueWithTolerance");function Xe(e,t){let o=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s={x:o.left+o.width/2,y:o.top+o.height/2},i={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:i.x-s.x,vertical:i.y-s.y}}n(Xe,"calculateRelativePosition");function Je(e,t){let[o,r]=c.useState(0),s=c.useRef(e),i=c.useRef(t),u=c.useRef(!1);return v(()=>{let a=s.current,l=i.current,g=e!==a,C=t!==l;g?(r(p=>p+1),u.current=!C):u.current&&C&&(r(p=>p+1),u.current=!1),s.current=e,i.current=t},[e,t]),`${e??"current"}-${o}`}n(Je,"usePopupContentKey");function zt(e,t,o=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Ce({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:o,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:D,inactiveTriggerProps:D,popupProps:D}}n(zt,"createInitialPopupStoreState");var k=n(e=>e.triggerIdProp??e.activeTriggerId,"activeTriggerIdSelector"),re=n(e=>e.openProp??e.open,"openSelector"),$e=n(e=>(e.popupElement?.id??e.floatingId)||void 0,"popupIdSelector");function He(e,t){return t!==void 0&&re(e)&&k(e)===t}n(He,"triggerOwnsOpenPopup");function ze(e,t){return He(e,t)?!0:t!==void 0&&re(e)&&k(e)==null&&e.triggerCount===1}n(ze,"triggerOwnsOpenPopupOrIsOnlyTrigger");var Qt={open:re,mounted:n(e=>e.mounted,"mounted"),transitionStatus:n(e=>e.transitionStatus,"transitionStatus"),floatingRootContext:n(e=>e.floatingRootContext,"floatingRootContext"),triggerCount:n(e=>e.triggerCount,"triggerCount"),preventUnmountingOnClose:n(e=>e.preventUnmountingOnClose,"preventUnmountingOnClose"),payload:n(e=>e.payload,"payload"),activeTriggerId:k,activeTriggerElement:n(e=>e.mounted?e.activeTriggerElement:null,"activeTriggerElement"),popupId:$e,isTriggerActive:n((e,t)=>t!==void 0&&k(e)===t,"isTriggerActive"),isOpenedByTrigger:n((e,t)=>He(e,t),"isOpenedByTrigger"),isMountedByTrigger:n((e,t)=>t!==void 0&&k(e)===t&&e.mounted,"isMountedByTrigger"),triggerProps:n((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,"triggerProps"),triggerPopupId:n((e,t)=>ze(e,t)?$e(e):void 0,"triggerPopupId"),popupProps:n(e=>e.popupProps,"popupProps"),popupElement:n(e=>e.popupElement,"popupElement"),positionerElement:n(e=>e.positionerElement,"positionerElement")};var _e=class extends ve{static{n(this,"NullStore")}setState(t){}update(t){}set(t,o){}notifyAll(){}};export{Te as a,zt as b,Qt as c,rt as d,_e as e,lt as f,Yt as g,Gt as h};
@@ -0,0 +1 @@
1
+ import{i as A}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as D}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import{p as J}from"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import{a as G}from"./chunk-3Y5K3IQO.js";import{a as Q,b as W,c as Z,d as V,e as C,f as S}from"./chunk-CW57Q264.js";import{a as $,e as z}from"./chunk-MD67S53Z.js";import{f as B,j as F,r as H,s as K}from"./chunk-LPINY2IJ.js";import{a as I,d as M,e as U,f as X,g as Y}from"./chunk-OXFKZ4BM.js";var L=M(X(),1),g=M(U(),1);var t=M(Y(),1);var _=10,E=I(h=>{let e=(0,L.c)(7),{label:i,value:l}=h,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let a=l??"\u2014",n;e[2]!==a?(n=(0,t.jsx)("span",{className:"font-mono text-sm",children:a}),e[2]=a,e[3]=n):n=e[3];let s;return e[4]!==r||e[5]!==n?(s=(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[r,n]}),e[4]=r,e[5]=n,e[6]=s):s=e[6],s},"_"),ee=I(h=>{let e=(0,L.c)(38),{indexes:i,onSelect:l,selected:r}=h,a=B(),n;e[0]!==a?(n=a("name"),e[0]=a,e[1]=n):n=e[1];let s;e[2]!==n?(s=(0,t.jsx)(C,{children:n}),e[2]=n,e[3]=s):s=e[3];let c;e[4]!==a?(c=a("table"),e[4]=a,e[5]=c):c=e[5];let o;e[6]!==c?(o=(0,t.jsx)(C,{children:c}),e[6]=c,e[7]=o):o=e[7];let d;e[8]!==a?(d=a("dimensions"),e[8]=a,e[9]=d):d=e[9];let x;e[10]!==d?(x=(0,t.jsx)(C,{children:d}),e[10]=d,e[11]=x):x=e[11];let m;e[12]!==a?(m=a("metric"),e[12]=a,e[13]=m):m=e[13];let p;e[14]!==m?(p=(0,t.jsx)(C,{children:m}),e[14]=m,e[15]=p):p=e[15];let u;e[16]!==a?(u=a("vectors"),e[16]=a,e[17]=u):u=e[17];let v;e[18]!==u?(v=(0,t.jsx)(C,{children:u}),e[18]=u,e[19]=v):v=e[19];let y;e[20]!==v||e[21]!==s||e[22]!==o||e[23]!==x||e[24]!==p?(y=(0,t.jsx)(W,{children:(0,t.jsxs)(V,{children:[s,o,x,p,v]})}),e[20]=v,e[21]=s,e[22]=o,e[23]=x,e[24]=p,e[25]=y):y=e[25];let k;if(e[26]!==i||e[27]!==l||e[28]!==r){let q;e[30]!==l||e[31]!==r?(q=I(w=>(0,t.jsxs)(V,{className:w.name===r?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":w.name,"data-testid":`vector-row-${w.name}`,onClick:l,children:[(0,t.jsx)(S,{className:"font-mono text-xs",children:w.name}),(0,t.jsx)(S,{className:"font-mono text-xs",children:w.table}),(0,t.jsx)(S,{className:"tabular-nums",children:w.dimensions??"\u2014"}),(0,t.jsx)(S,{children:w.metric??"\u2014"}),(0,t.jsx)(S,{className:"tabular-nums",children:w.vectorsCount??"\u2014"})]},w.name),"q"),e[30]=l,e[31]=r,e[32]=q):q=e[32],k=i.map(q),e[26]=i,e[27]=l,e[28]=r,e[29]=k}else k=e[29];let N;e[33]!==k?(N=(0,t.jsx)(Z,{children:k}),e[33]=k,e[34]=N):N=e[34];let f;return e[35]!==y||e[36]!==N?(f=(0,t.jsx)($,{className:"overflow-hidden py-0",children:(0,t.jsx)(z,{className:"px-0",children:(0,t.jsxs)(Q,{"data-testid":"vector-table",children:[y,N]})})}),e[35]=y,e[36]=N,e[37]=f):f=e[37],f},"X"),te=I(h=>{let e=(0,L.c)(27),{matches:i}=h,l=B();if(i.length===0){let u;e[0]!==l?(u=l("No matches."),e[0]=l,e[1]=u):u=e[1];let v;return e[2]!==u?(v=(0,t.jsx)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:u}),e[2]=u,e[3]=v):v=e[3],v}let r;e[4]!==l?(r=l("id"),e[4]=l,e[5]=r):r=e[5];let a;e[6]!==r?(a=(0,t.jsx)(C,{children:r}),e[6]=r,e[7]=a):a=e[7];let n;e[8]!==l?(n=l("score"),e[8]=l,e[9]=n):n=e[9];let s;e[10]!==n?(s=(0,t.jsx)(C,{children:n}),e[10]=n,e[11]=s):s=e[11];let c;e[12]!==l?(c=l("metadata"),e[12]=l,e[13]=c):c=e[13];let o;e[14]!==c?(o=(0,t.jsx)(C,{children:c}),e[14]=c,e[15]=o):o=e[15];let d;e[16]!==a||e[17]!==s||e[18]!==o?(d=(0,t.jsx)(W,{children:(0,t.jsxs)(V,{children:[a,s,o]})}),e[16]=a,e[17]=s,e[18]=o,e[19]=d):d=e[19];let x;e[20]!==i?(x=i.map(le),e[20]=i,e[21]=x):x=e[21];let m;e[22]!==x?(m=(0,t.jsx)(Z,{children:x}),e[22]=x,e[23]=m):m=e[23];let p;return e[24]!==d||e[25]!==m?(p=(0,t.jsx)($,{className:"mt-3 overflow-hidden py-0",children:(0,t.jsx)(z,{className:"px-0",children:(0,t.jsxs)(Q,{"data-testid":"vector-matches",children:[d,m]})})}),e[24]=d,e[25]=m,e[26]=p):p=e[26],p},"Y"),me=I(({loadIndexes:h,runQuery:e}={})=>{let i=J(),l=B(),[r,a]=(0,g.useState)(null),[n,s]=(0,g.useState)(null),[c,o]=(0,g.useState)(null),[d,x]=(0,g.useState)(""),[m,p]=(0,g.useState)(null),[u,v]=(0,g.useState)(null),[y,k]=(0,g.useState)(!1),N=(0,g.useRef)(0);(0,g.useEffect)(()=>{let b={cancelled:!1};return K((async()=>{try{let j=await(h??(()=>i.listVectorIndexes()))();b.cancelled||(a(j),s(null),o(T=>T??j[0]?.name??null))}catch(j){b.cancelled||(a(null),s(F(j)))}})()),()=>{b.cancelled=!0}},[i,h]);let f=r?.find(b=>b.name===c)??null,q=I(b=>{N.current+=1,o(b.currentTarget.dataset.index??null),p(null),v(null),k(!1)},"q"),w=I(b=>{x(b.target.value)},"y"),O=I(async()=>{let b=d.trim();if(c===null||b==="")return;N.current+=1;let j=N.current;k(!0),v(null);try{let T=await(e??(R=>i.queryVectorIndex(R)))({name:c,text:b,topK:_});if(j!==N.current)return;p(T)}catch(T){if(j!==N.current)return;p(null),v(F(T))}k(!1)},"H"),P=I(()=>{K(O())},"K");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[n!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:n}),r!==null&&r.length===0&&(0,t.jsx)(G,{description:l("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"})}),testId:"vector-empty",title:l("No vector indexes.")}),r!==null&&r.length>0&&(0,t.jsx)(ee,{indexes:r,onSelect:q,selected:c}),f!==null&&(0,t.jsxs)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,t.jsx)(E,{label:l("field"),value:f.field}),(0,t.jsx)(E,{label:l("dimensions"),value:f.dimensions}),(0,t.jsx)(E,{label:l("metric"),value:f.metric}),(0,t.jsx)(E,{label:l("vectors"),value:f.vectorsCount})]}),f.metadata!==void 0&&f.metadata.length>0&&(0,t.jsxs)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[l("metadata"),": ",(0,t.jsx)("span",{className:"font-mono",children:f.metadata.join(", ")})]}),(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,t.jsx)(A,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:w,placeholder:l("Search by similarity\u2026"),value:d}),(0,t.jsx)(D,{"data-testid":"vector-search",disabled:y||d.trim()==="",onClick:P,children:l(y?"Searching\u2026":"Search")})]}),u!==null&&(0,t.jsx)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:u}),m!==null&&(0,t.jsx)(te,{matches:m})]})]})},"ue");function le(h){return(0,t.jsxs)(V,{"data-testid":`vector-match-${h.id}`,children:[(0,t.jsx)(S,{className:"font-mono text-xs",children:h.id}),(0,t.jsx)(S,{className:"tabular-nums",children:h.score.toFixed(4)}),(0,t.jsx)(S,{className:"max-w-md truncate font-mono text-xs",children:h.metadata===void 0?"\u2014":H(h.metadata)})]},h.id)}I(le,"ee");export{me as VectorBrowser};
@@ -0,0 +1 @@
1
+ import{b as g}from"./chunk-P5GAJKDW.js";import"./chunk-OECMBE6Q.js";import"./chunk-OSJ7HV7B.js";import"./chunk-7F3S5OQT.js";import"./chunk-E26OT26O.js";import{a as f}from"./chunk-4ZEL6BYL.js";import{c as m}from"./chunk-YJ2WHOGO.js";import"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import"./chunk-CW57Q264.js";import"./chunk-MD67S53Z.js";import{f as p}from"./chunk-LPINY2IJ.js";import{a as r,d as h,f as S,g as A}from"./chunk-OXFKZ4BM.js";var R=h(S(),1);var k=h(A(),1);var _=r((e,s)=>({"admin-token-weak":e("Weak admin token"),"auth-secret-weak":e("Weak auth secret"),"cookies-insecure":e("Session cookies are not Secure"),"cors-wildcard-credentials":e("Wildcard CORS with credentials"),"csrf-disabled":e("CSRF/origin guard is off"),"dev-args-unredacted":e("Request log keeps un-redacted args"),"security-headers-disabled":e("Security headers are off"),"ws-gate-open":e("User subscriptions are ungated")})[s.kind],"k"),w=r(e=>Array.isArray(e.findings)?e.findings:[],"g"),b=r(e=>({"admin-token-weak":"LUNORA_ADMIN_TOKEN","auth-secret-weak":"AUTH_SECRET","cookies-insecure":"BETTER_AUTH_URL","cors-wildcard-credentials":"LUNORA_ALLOWED_ORIGINS","csrf-disabled":"LUNORA_SECURITY_CSRF","dev-args-unredacted":"request log","security-headers-disabled":"LUNORA_SECURITY_HEADERS","ws-gate-open":"LUNORA_WS_BEARER"})[e.kind],"S"),E=r((e,s)=>({"admin-token-weak":e("Your admin token is {length} characters \u2014 use at least {min} for a brute-force-resistant secret.",{length:s.detail?.length,min:s.detail?.min}),"auth-secret-weak":e("Your auth secret is {length} characters \u2014 use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.",{length:s.detail?.length,min:s.detail?.min}),"cookies-insecure":e("BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production."),"cors-wildcard-credentials":e("LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed \u2014 browsers reject this and it defeats the allowlist. Name explicit origins instead of *."),"csrf-disabled":e("LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable."),"dev-args-unredacted":e("This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy."),"security-headers-disabled":e("LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production."),"ws-gate-open":e("LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: anyone who can reach the worker can open a socket and run ordinary user subscriptions. Admin subscriptions are unaffected \u2014 they need the admin token. Set it if subscribers should present a shared credential.")})[s.kind],"A"),O=r(()=>{let e=(0,R.c)(8),s=p(),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let{data:a,error:d,errorSource:c}=m(f.getSecurityAudit,i),n;if(e[1]!==a||e[2]!==s){let u=a===void 0?null:w(a);n=u===null?null:u.map(t=>({description:E(s,t),entity:b(t),issueType:_(s,t),key:t.kind,level:t.level})),e[1]=a,e[2]=s,e[3]=n}else n=e[3];let l=n,o;return e[4]!==d||e[5]!==c||e[6]!==l?(o=(0,k.jsx)(g,{error:d,errorSource:c,rows:l,testId:"lunora-security-advisor"}),e[4]=d,e[5]=c,e[6]=l,e[7]=o):o=e[7],o},"T");export{O as default};
@@ -1,8 +1,8 @@
1
- import{a as se,b as ae,c as ce,d as de,e as ue}from"./chunk-5QR2SQIS.js";import"./chunk-NRP22GKC.js";import{c as le}from"./chunk-XCYFP44W.js";import"./chunk-NQZALRU3.js";import"./chunk-OPM7ESDV.js";import"./chunk-Y3AYVFTK.js";import"./chunk-QJLHH3ET.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import{a as ie}from"./chunk-LXCVA5SP.js";import{a as oe}from"./chunk-7Q256NLI.js";import{b as H}from"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{a as Z}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{a as C}from"./chunk-4ZEL6BYL.js";import{c as re,d as ne}from"./chunk-RX755NMO.js";import{c as K,d as ee,l as te}from"./chunk-YBDF3DET.js";import"./chunk-QAQDMS6R.js";import{d as A}from"./chunk-HBO4SMAO.js";import{a as P,e as W}from"./chunk-2IKDEUCX.js";import{d as V,f as O,g as E,h as q,q as z}from"./chunk-74IYYDDI.js";import{a as l,d as J,e as qe,f as Fe,g as Oe}from"./chunk-I26MS5PJ.js";var ge=J(Fe(),1);var S=J(qe(),1);var c=J(Oe(),1);var j=class extends Error{static{l(this,"R")}problem;constructor(e){super(e.kind),this.name="CsvFormatError",this.problem=e}},Be="\uFEFF",Ae=l(()=>{let t=[],e=1,r=!1,n=!1,o="start",i="",s=l(()=>{t.push(o==="closing"||i!==""?i:void 0),o="start",i=""},"i"),m=l(a=>{s(),t.some(d=>d!==void 0)&&a.push({cells:t,number:e}),t=[],e+=1},"c"),f=l((a,d)=>{let h=r;if(r=!1,!(h&&a===`
1
+ import{a as se,b as ae,c as ce,d as de,e as ue}from"./chunk-FLVDICZL.js";import"./chunk-A566HCBX.js";import{c as le}from"./chunk-DS7HZKZ2.js";import"./chunk-CTE6RPXC.js";import"./chunk-LIGOLZND.js";import"./chunk-3GXPALXG.js";import"./chunk-NMVFSJM7.js";import"./chunk-AP4PC2M4.js";import"./chunk-KRPXOSBL.js";import"./chunk-W2BCSK5S.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import{a as ie}from"./chunk-ZWDORIZY.js";import{a as oe}from"./chunk-KYONGQQ4.js";import{b as H}from"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import"./chunk-ZTOREMGH.js";import"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as Z}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import{a as E}from"./chunk-4ZEL6BYL.js";import{c as re,d as ne}from"./chunk-YJ2WHOGO.js";import{c as A,f as K,g as ee,p as te}from"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import{a as P,e as W}from"./chunk-MD67S53Z.js";import{f as V,h as O,i as L,j as q,s as z}from"./chunk-LPINY2IJ.js";import{a as l,d as J,e as qe,f as Fe,g as Oe}from"./chunk-OXFKZ4BM.js";var ge=J(Fe(),1);var S=J(qe(),1);var c=J(Oe(),1);var j=class extends Error{static{l(this,"R")}problem;constructor(e){super(e.kind),this.name="CsvFormatError",this.problem=e}},Be="\uFEFF",Ae=l(()=>{let t=[],e=1,r=!1,n=!1,o="start",i="",s=l(()=>{t.push(o==="closing"||i!==""?i:void 0),o="start",i=""},"i"),m=l(a=>{s(),t.some(d=>d!==void 0)&&a.push({cells:t,number:e}),t=[],e+=1},"c"),f=l((a,d)=>{let h=r;if(r=!1,!(h&&a===`
2
2
  `)){if(o==="quoted"){a==='"'?o="closing":i+=a;return}if(o==="closing"&&a==='"'){i+=a,o="quoted";return}if(a===","){s();return}if(a==="\r"){m(d),r=!0;return}if(a===`
3
- `){m(d);return}if(o==="closing")throw new j({kind:"text-after-quote",record:e});if(o==="start"&&a==='"'){o="quoted";return}o="unquoted",i+=a}},"d");return{finish:l(()=>{if(o==="quoted")throw new j({kind:"unterminated-quote",record:e});let a=[];return m(a),a},"finish"),push:l(a=>{let d=[],h=0;for(!n&&a!==""&&(n=!0,h=a.startsWith(Be)?1:0);h<a.length;h+=1)f(a.charAt(h),d);return d},"push")}},"Le"),be=l(async function*(t){let e=Ae();for await(let r of t)yield*e.push(r);yield*e.finish()},"oe"),D=l((t,e,r)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0})},"D"),xe=l(t=>{let e=[],r=new Set;return t.forEach((n,o)=>{let i=(n??"").trim();if(i==="")throw new j({column:o+1,kind:"empty-header"});if(r.has(i))throw new j({kind:"duplicate-header",name:i});r.add(i),e.push(i)}),e},"se"),ye=l(({cells:t,number:e},r,n)=>{if(t.length!==r.length)throw new j({expected:r.length,found:t.length,kind:"ragged",record:e});let o={};return r.forEach((i,s)=>{let m=t[s];m!==void 0?D(o,i,m):n.has(i)&&D(o,i,null)}),{doc:o,record:e}},"ie"),Ke=/^-?\d+$/u,De=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/iu,Re=/^-?\d{11,}$/u,Me=/^(\d{4})-(\d{2})-(\d{2})$/u,Ue=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(Z|[+-]\d{2}:\d{2})?$/u,Je=/\.(\d+)/u,Ve=/[1-9]/u,Ze=/^[+-]?(\d*)(?:\.(\d*))?(?:e([+-]?\d+))?$/iu,me=l(t=>{let[,e="",r="",n="0"]=Ze.exec(t)??[],o=`${e}${r}`,i=0,s=o.length;for(;i<s&&o.charAt(i)==="0";)i+=1;for(;s>i&&o.charAt(s-1)==="0";)s-=1;return i===s?{digits:"",exponent:0}:{digits:o.slice(i,s),exponent:Number(n)-r.length+(o.length-s)}},"z"),Pe=l((t,e)=>{let r=me(t),n=me(e.toExponential());return r.digits===n.digits&&r.exponent===n.exponent?!0:r.digits!==""&&r.exponent>=0&&Number.isInteger(e)&&BigInt(r.digits)*10n**BigInt(r.exponent)===BigInt(Math.abs(e))},"qe"),We=l(t=>{let e=t.trim();if(!De.test(e))return;let r=Number(e);if(Number.isFinite(r))return Pe(e,r)?{number:r}:{inexact:!0}},"Ke"),ze=l((t,e,r)=>{let n=new Date(0);return n.setUTCFullYear(t,e-1,r),n.getUTCMonth()===e-1&&n.getUTCDate()===r},"Xe"),He=l((t,e,r,n)=>Number(t)<=23&&Number(e)<=59&&Number(r)<=59&&(n==="Z"||Number(n.slice(1,3))<=23&&Number(n.slice(4,6))<=59),"Ue"),Ye=l(t=>{let[e="",r,...n]=t.split("T"),o=Me.exec(e),i=r===void 0?void 0:Ue.exec(r);if(o===null||n.length>0||r!==void 0&&i===null)return;let[,s="",m="",f=""]=o;if(!ze(Number(s),Number(m),Number(f)))return;let[,a="0",d="0",h="0",v]=i??[];if(!He(a,d,h,v??"Z"))return;let w=Je.exec(r??"")?.[1]??"";if(Ve.test(w.slice(3)))return;let p=Date.parse(i!==void 0&&v===void 0?`${t}Z`:t);return Number.isFinite(p)?p:void 0},"Ve"),_e=l(t=>{let e=We(t);return e===void 0?{expected:"number",kind:"rejected"}:"number"in e?{kind:"ok",value:e.number}:{expected:"number",inexact:!0,kind:"rejected"}},"He"),Ge=l(t=>{let e=t.trim(),r=Ye(e);return r===void 0&&Re.test(e)&&(r=Number(e)),r===void 0||!Number.isFinite(new Date(r).getTime())?{expected:"date",kind:"rejected"}:{kind:"ok",value:r}},"We"),Qe=l(t=>{try{return K(t),!0}catch{return!1}},"Je"),Xe=l((t,e)=>{if(e==="bigint"){let r=t.trim();if(!Ke.test(r))return{expected:"bigint",kind:"rejected"};let n=BigInt(r);return Qe(n)?{kind:"ok",value:n}:{expected:"bigint",kind:"rejected",tooLong:!0}}if(e==="boolean"){let r=t.trim().toLowerCase();return r==="true"||r==="false"?{kind:"ok",value:r==="true"}:{expected:"boolean",kind:"rejected"}}return e==="number"?_e(t):e==="date"||e==="timestamp"?Ge(t):{kind:"ok",value:t}},"Ye"),ve=l(({doc:t,record:e},r)=>{let n={};for(let[o,i]of Object.entries(t)){if(i===null){D(n,o,null);continue}let s=Xe(i,r.get(o));if(s.kind==="rejected")throw new j({column:o,expected:s.expected,...s.inexact===!0&&{inexact:!0},kind:"cell-type",record:e,...s.tooLong===!0&&{tooLong:!0},value:i});D(n,o,s.value)}return{doc:n,record:e}},"le"),et=l(async function*(t,e,r){let n;for await(let o of be(t))n===void 0?n=xe(o.cells):yield ve(ye(o,n,r),e)},"Ze"),tt=l(t=>new Set(t.filter(e=>e.nullable===!0&&!e.optional).map(e=>e.name)),"Ge"),fe=l(t=>{if(t instanceof j)return t;throw t},"Q"),rt=l(async(t,e,r,n)=>{let o,i,s;for await(let f of be(t)){if(o===void 0){try{o=xe(f.cells)}catch(d){i=fe(d),o=[]}continue}let a;try{a=ve(ye(f,o,r),e)}catch(d){s??=fe(d);continue}n(a)}let m=i??s;if(m!==void 0)throw m},"ze"),nt=O(C.exportShard),Y=O(C.importShard),ot=O(C.listTables),it=O(C.describeTable),lt={},st=l(t=>t.map(e=>JSON.stringify(K(e))).join(`
3
+ `){m(d);return}if(o==="closing")throw new j({kind:"text-after-quote",record:e});if(o==="start"&&a==='"'){o="quoted";return}o="unquoted",i+=a}},"d");return{finish:l(()=>{if(o==="quoted")throw new j({kind:"unterminated-quote",record:e});let a=[];return m(a),a},"finish"),push:l(a=>{let d=[],h=0;for(!n&&a!==""&&(n=!0,h=a.startsWith(Be)?1:0);h<a.length;h+=1)f(a.charAt(h),d);return d},"push")}},"Fe"),be=l(async function*(t){let e=Ae();for await(let r of t)yield*e.push(r);yield*e.finish()},"oe"),D=l((t,e,r)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0})},"D"),xe=l(t=>{let e=[],r=new Set;return t.forEach((n,o)=>{let i=(n??"").trim();if(i==="")throw new j({column:o+1,kind:"empty-header"});if(r.has(i))throw new j({kind:"duplicate-header",name:i});r.add(i),e.push(i)}),e},"se"),ye=l(({cells:t,number:e},r,n)=>{if(t.length!==r.length)throw new j({expected:r.length,found:t.length,kind:"ragged",record:e});let o={};return r.forEach((i,s)=>{let m=t[s];m!==void 0?D(o,i,m):n.has(i)&&D(o,i,null)}),{doc:o,record:e}},"ie"),Ke=/^-?\d+$/u,De=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/iu,Re=/^-?\d{11,}$/u,Me=/^(\d{4})-(\d{2})-(\d{2})$/u,Ue=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(Z|[+-]\d{2}:\d{2})?$/u,Je=/\.(\d+)/u,Ve=/[1-9]/u,Ze=/^[+-]?(\d*)(?:\.(\d*))?(?:e([+-]?\d+))?$/iu,me=l(t=>{let[,e="",r="",n="0"]=Ze.exec(t)??[],o=`${e}${r}`,i=0,s=o.length;for(;i<s&&o.charAt(i)==="0";)i+=1;for(;s>i&&o.charAt(s-1)==="0";)s-=1;return i===s?{digits:"",exponent:0}:{digits:o.slice(i,s),exponent:Number(n)-r.length+(o.length-s)}},"z"),Pe=l((t,e)=>{let r=me(t),n=me(e.toExponential());return r.digits===n.digits&&r.exponent===n.exponent?!0:r.digits!==""&&r.exponent>=0&&Number.isInteger(e)&&BigInt(r.digits)*10n**BigInt(r.exponent)===BigInt(Math.abs(e))},"qe"),We=l(t=>{let e=t.trim();if(!De.test(e))return;let r=Number(e);if(Number.isFinite(r))return Pe(e,r)?{number:r}:{inexact:!0}},"Ke"),ze=l((t,e,r)=>{let n=new Date(0);return n.setUTCFullYear(t,e-1,r),n.getUTCMonth()===e-1&&n.getUTCDate()===r},"Xe"),He=l((t,e,r,n)=>Number(t)<=23&&Number(e)<=59&&Number(r)<=59&&(n==="Z"||Number(n.slice(1,3))<=23&&Number(n.slice(4,6))<=59),"Ue"),Ye=l(t=>{let[e="",r,...n]=t.split("T"),o=Me.exec(e),i=r===void 0?void 0:Ue.exec(r);if(o===null||n.length>0||r!==void 0&&i===null)return;let[,s="",m="",f=""]=o;if(!ze(Number(s),Number(m),Number(f)))return;let[,a="0",d="0",h="0",v]=i??[];if(!He(a,d,h,v??"Z"))return;let w=Je.exec(r??"")?.[1]??"";if(Ve.test(w.slice(3)))return;let p=Date.parse(i!==void 0&&v===void 0?`${t}Z`:t);return Number.isFinite(p)?p:void 0},"Ve"),_e=l(t=>{let e=We(t);return e===void 0?{expected:"number",kind:"rejected"}:"number"in e?{kind:"ok",value:e.number}:{expected:"number",inexact:!0,kind:"rejected"}},"He"),Ge=l(t=>{let e=t.trim(),r=Ye(e);return r===void 0&&Re.test(e)&&(r=Number(e)),r===void 0||!Number.isFinite(new Date(r).getTime())?{expected:"date",kind:"rejected"}:{kind:"ok",value:r}},"We"),Qe=l(t=>{try{return K(t),!0}catch{return!1}},"Je"),Xe=l((t,e)=>{if(e==="bigint"){let r=t.trim();if(!Ke.test(r))return{expected:"bigint",kind:"rejected"};let n=BigInt(r);return Qe(n)?{kind:"ok",value:n}:{expected:"bigint",kind:"rejected",tooLong:!0}}if(e==="boolean"){let r=t.trim().toLowerCase();return r==="true"||r==="false"?{kind:"ok",value:r==="true"}:{expected:"boolean",kind:"rejected"}}return e==="number"?_e(t):e==="date"||e==="timestamp"?Ge(t):{kind:"ok",value:t}},"Ye"),ve=l(({doc:t,record:e},r)=>{let n={};for(let[o,i]of Object.entries(t)){if(i===null){D(n,o,null);continue}let s=Xe(i,r.get(o));if(s.kind==="rejected")throw new j({column:o,expected:s.expected,...s.inexact===!0&&{inexact:!0},kind:"cell-type",record:e,...s.tooLong===!0&&{tooLong:!0},value:i});D(n,o,s.value)}return{doc:n,record:e}},"le"),et=l(async function*(t,e,r){let n;for await(let o of be(t))n===void 0?n=xe(o.cells):yield ve(ye(o,n,r),e)},"Ze"),tt=l(t=>new Set(t.filter(e=>e.nullable===!0&&!e.optional).map(e=>e.name)),"Ge"),fe=l(t=>{if(t instanceof j)return t;throw t},"Q"),rt=l(async(t,e,r,n)=>{let o,i,s;for await(let f of be(t)){if(o===void 0){try{o=xe(f.cells)}catch(d){i=fe(d),o=[]}continue}let a;try{a=ve(ye(f,o,r),e)}catch(d){s??=fe(d);continue}n(a)}let m=i??s;if(m!==void 0)throw m},"ze"),nt=O(E.exportShard),Y=O(E.importShard),ot=O(E.listTables),it=O(E.describeTable),lt={},st=l(t=>t.map(e=>JSON.stringify(K(e))).join(`
4
4
  `),"rt"),at=l((t,e)=>{let r=t.trim();if(r==="")return;let n=ee(JSON.parse(r));if(typeof n!="object"||n===null)throw new A("INTERNAL",`line ${e.toString()}: expected a { table, doc } object`);let o=n;if(typeof o.table!="string"||typeof o.doc!="object"||o.doc===null||Array.isArray(o.doc))throw new A("INTERNAL",`line ${e.toString()}: expected a { table, doc } object`);return o},"ot"),he=1024*1024,G=l(async function*(t){let e=new TextDecoder("utf-8",{fatal:!0});for(let n=0;n<t.size;n+=he){let o=await t.slice(n,n+he).arrayBuffer();yield e.decode(o,{stream:!0})}let r=e.decode();r!==""&&(yield r)},"U"),ct=l(async function*(t){let e="",r=0;for await(let n of G(t)){let o=`${e}${n}`.split(`
5
- `);e=o.pop()??"";for(let i of o)r+=1,yield{line:i,lineNumber:r}}e!==""&&(yield{line:e,lineNumber:r+1})},"st"),dt=l(async function*(t){for await(let{line:e,lineNumber:r}of ct(t)){let n=at(e,r);n!==void 0&&(yield{line:r,row:n})}},"it"),ut=l(async function*(t,e,r,n){for await(let{doc:o,record:i}of et(G(t),r,n))yield{line:i,row:{doc:o,table:e}}},"lt"),mt=l(async(t,e,r,n)=>{try{let{columns:o}=await t.query(it,{table:n},E(r));return{kinds:new Map(o.map(i=>[i.name,i.type])),nullOnEmpty:tt(o)}}catch(o){return{failure:e("Couldn't read the columns of {table}: {message}",{message:q(o),table:n})}}},"at"),pe=50,ft=500,R=9e5,Q=l(t=>new TextEncoder().encode(JSON.stringify(K(t))).byteLength,"V"),_="application/x-ndjson",Ne=l(t=>new A("INTERNAL",`line ${t.toString()}: a single row is over the ${R.toString()}-byte import limit`),"ae"),ht=l(async t=>{let e=0;for await(let{line:r,row:n}of t){if(Q(n)>R)throw Ne(r);e+=1}return e},"dt"),pt=l(async(t,e,r,n)=>{let o={rows:0};if(await rt(G(t),r,n,({doc:i,record:s})=>{o.rows+=1,o.wide===void 0&&Q({doc:i,table:e})>R&&(o.wide=s)}),o.wide!==void 0)throw Ne(o.wide);return o.rows},"ut"),we=l(async(t,e)=>{let r=[],n=0,o=0,i=0;for await(let{line:s,row:m}of t){let f=Q(m),a=s!==i+1;r.length>0&&(a||r.length===ft||n+f>R)&&(await e(r,o),r=[],n=0),r.length===0&&(o=s),r.push(m),n+=f,i=s}r.length>0&&await e(r,o)},"ne"),wt=/\.csv$/iu,gt=l(t=>wt.test(t.name)||t.type==="text/csv","mt"),bt=l((t,e)=>t.expected==="boolean"?e("line {line}: column \u201C{column}\u201D must be true or false, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}):t.tooLong===!0?e("line {line}: column \u201C{column}\u201D holds an integer longer than the import can send.",{column:t.column,line:t.record}):t.expected==="bigint"?e("line {line}: column \u201C{column}\u201D must be an integer, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}):t.expected==="date"?e("line {line}: column \u201C{column}\u201D must be an ISO-8601 date or epoch milliseconds of at least 11 digits, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}):t.inexact===!0?e("line {line}: column \u201C{column}\u201D holds \u201C{value}\u201D, which a number column cannot store exactly. Store a whole number past 9007199254740991 in a bigint column.",{column:t.column,line:t.record,value:t.value}):e("line {line}: column \u201C{column}\u201D must be a number, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}),"ht"),xt=l((t,e)=>t.kind==="duplicate-header"?e("The header \u201C{name}\u201D appears more than once.",{name:t.name}):t.kind==="empty-header"?e("Header column {column} is empty.",{column:t.column}):t.kind==="ragged"?e("line {line}: expected {expected} cells, found {found}.",{expected:t.expected,found:t.found,line:t.record}):t.kind==="cell-type"?bt(t,e):t.kind==="text-after-quote"?e("line {line}: text follows a closing quote.",{line:t.record}):e("line {line}: a quoted field is never closed.",{line:t.record}),"pt"),yt=l((t,e,r)=>{let n=e instanceof j?xt(e.problem,r):q(e);return t===null?r("Invalid NDJSON: {message}",{message:n}):r("Invalid CSV: {message}",{message:n})},"wt"),vt=l(t=>{let e=(0,ge.c)(31),{onChange:r,shardKey:n,value:o}=t,i=V(),s;e[0]!==n?(s={shardKey:n},e[0]=n,e[1]=s):s=e[1];let{data:m}=re(C.listTables,lt,s),f;e[2]!==r?(f=l(T=>{r(T??"")},"d"),e[2]=r,e[3]=f):f=e[3];let a;e[4]!==i?(a=i("Target table"),e[4]=i,e[5]=a):a=e[5];let d;e[6]!==i?(d=i("Choose a table"),e[6]=i,e[7]=d):d=e[7];let h;e[8]!==d?(h=(0,c.jsx)(ae,{placeholder:d}),e[8]=d,e[9]=h):h=e[9];let v;e[10]!==a||e[11]!==h?(v=(0,c.jsx)(ce,{"aria-label":a,className:"w-56","data-testid":"ei-csv-table",children:h}),e[10]=a,e[11]=h,e[12]=v):v=e[12];let w;e[13]!==m?(w=m??[],e[13]=m,e[14]=w):w=e[14];let p;e[15]!==w?(p=w.map(kt),e[15]=w,e[16]=p):p=e[16];let b;e[17]!==p?(b=(0,c.jsx)(de,{children:p}),e[17]=p,e[18]=b):b=e[18];let k;e[19]!==f||e[20]!==v||e[21]!==b||e[22]!==o?(k=(0,c.jsxs)(se,{onValueChange:f,value:o,children:[v,b]}),e[19]=f,e[20]=v,e[21]=b,e[22]=o,e[23]=k):k=e[23];let N;e[24]!==i?(N=i("CSV rows have no table column, so choose the table they go into."),e[24]=i,e[25]=N):N=e[25];let g;e[26]!==N?(g=(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:N}),e[26]=N,e[27]=g):g=e[27];let u;return e[28]!==k||e[29]!==g?(u=(0,c.jsxs)("div",{className:"flex flex-col gap-1.5",children:[k,g]}),e[28]=k,e[29]=g,e[30]=u):u=e[30],u},"gt"),ke=l(t=>Object.values(t).reduce((e,r)=>e+r,0),"ce"),Nt=l(async(t,e,r,n,o,i)=>{let s={conflicts:0,errors:[],inserted:{}},m,f=i===null?{kinds:new Map,nullOnEmpty:new Set}:await mt(t,e,r,i);if("failure"in f)return{failure:{message:f.failure,rows:0},total:s};let{kinds:a,nullOnEmpty:d}=f;try{if(i===null){let u=l(()=>dt(o),"f");m={rows:await ht(u()),source:u}}else m={rows:await pt(o,i,a,d),source:l(()=>ut(o,i,a,d),"source")}}catch(u){return{failure:{message:yt(i,u,e),rows:0},total:s}}let{rows:h,source:v}=m;if(i!==null&&h===0)return{failure:{message:e("The CSV has no data rows after the header."),rows:0},total:s};let w={conflicts:0,errors:[],inserted:{}};n(e("Checking {total} rows before writing\u2026",{total:h}));try{if((await t.query(Y,{dryRun:!0,rows:[],startLine:1},E(r))).dryRun!==!0)return{failure:{message:e("This shard predates import checks, so it would write the file while checking it. Nothing was sent. Update the app and import again."),rows:0},total:s};await we(v(),async(u,T)=>{let I=await t.query(Y,{dryRun:!0,rows:u,startLine:T},E(r));w.errors.push(...I.errors)})}catch(u){return{failure:{message:q(u),rows:0},total:s}}if(w.errors.length>0)return{failure:{message:e("Nothing was written, because some rows would be refused. Fix the rows listed below and import again."),rows:0},total:w};let p=0,b=1,k={},N={},g=l(async(u,T)=>{n(e("Importing rows {from}\u2013{to} of {total}\u2026",{from:p+1,to:p+u.length,total:h})),N.startLine=T;let I=await t.query(Y,{dryRun:!1,rows:u,startLine:T},E(r));N.startLine=void 0,s.conflicts+=I.conflicts,s.errors.push(...I.errors);for(let[L,M]of Object.entries(I.inserted))s.inserted[L]=(s.inserted[L]??0)+M;if(p+=u.length,b=T+u.length,I.errors.length>0){let L=ke(s.inserted);throw k.refused=!0,new Error(L===0?e("The shard refused {count} rows, so the rest of the file was not sent. Nothing was written. Fix the rows listed below and import again.",{count:I.errors.length}):e("The shard refused {count} rows, so the rest of the file was not sent. {written} rows were already written, so do not import the whole file again. Import the refused rows and any rows from line {line} onward, or delete the written rows first and then import the whole file.",{count:I.errors.length,line:T+u.length,written:L}))}},"w");try{return await we(v(),g),{failure:void 0,total:s}}catch(u){return{failure:{message:q(u),nextLine:b,rows:p,unknownFrom:N.startLine,...k},total:s}}},"xt"),Dt=l(({initialShardKey:t})=>{let e=te(),r=ne(),n=V(),[o,i]=(0,S.useState)(t??""),[s,m]=(0,S.useState)(null),[f,a]=(0,S.useState)(null),[d,h]=(0,S.useState)(!1),[v,w]=(0,S.useState)(null),[p,b]=(0,S.useState)(null),[k,N]=(0,S.useState)(null),[g,u]=(0,S.useState)(null),T=s!==null&&gt(s),I=f!==null&&f.shardKey===o?f.table:"",L=s!==null&&(!T||I!==""),M=l(async()=>{let x=o;h(!0),w(null),b(null),u(null);try{let F=await e.query(ot,{},E(x)),y=new Blob([],{type:_}),$=0,B=[];for(let{name:Ee}of F){let{rows:U}=await e.query(nt,{tables:[Ee]},E(x));if(U.length===0)continue;let X=st(U);y=new Blob([y,`${X}
6
- `],{type:_}),$+=U.length,B.length<pe&&B.push(...X.split(`
7
- `).slice(0,pe-B.length))}H(x),u({blob:y,count:$,preview:B.join(`
8
- `),shardKey:x})}catch(F){w(q(F))}},"B"),Te=l(async(x,F)=>{h(!0),w(null),b(null),u(null);let{failure:y,total:$}=await Nt(e,n,o,N,x,F);y===void 0?(H(o),b($)):y.unknownFrom===void 0&&(y.refused===!0||y.rows===0)?($.errors.length>0&&b($),w(y.message)):y.unknownFrom===void 0?(b($),w(n("Import stopped after {rows} rows: {message}. The counts below cover those rows. Rows from line {line} onward were not sent: do not import the whole file again, import from that line onward, or delete the written rows first and then import the whole file.",{line:y.nextLine,message:y.message,rows:y.rows}))):(b($),w(n("Import stopped after {rows} rows: {message}. The counts below cover completed chunks only. The chunk from line {line} may have written rows: check the table for rows from line {line} onward before importing again, or delete the written rows first and then import the whole file.",{line:y.unknownFrom,message:y.message,rows:y.rows}))),r(C.readTablePage),r(C.listTables)},"de"),Ie=p===null?0:ke(p.inserted),je=l(()=>{z(M().finally(()=>{h(!1)}))},"fe"),Se=l(()=>{s!==null&&L&&z(Te(s,T?I:null).finally(()=>{N(null),h(!1)}))},"me"),Le=l(()=>{g!==null&&le(`${g.shardKey.trim()===""?"shard":g.shardKey.trim()}.ndjson`,g.blob,_)},"he"),$e=l(x=>{m(x.target.files?.[0]??null),a(null)},"pe"),Ce=l(x=>{a({shardKey:o,table:x})},"we");return(0,c.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-export-import",children:[(0,c.jsxs)(P,{className:"gap-0 py-0 rounded-xl border border-border bg-card shadow-xs",children:[(0,c.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,c.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Export")})}),(0,c.jsxs)(W,{className:"flex flex-col gap-3 p-4",children:[(0,c.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,c.jsx)(oe,{onChange:i,testId:"ei-shard-input",value:o}),(0,c.jsx)(Z,{"data-testid":"ei-export",disabled:d,onClick:je,type:"button",children:n("Export")})]}),g!==null&&(0,c.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,c.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,c.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-export-result",children:n("Exported {count} rows.",{count:g.count})}),(0,c.jsx)(Z,{"data-testid":"ei-download",onClick:Le,size:"sm",type:"button",variant:"outline",children:n("Download")})]}),g.preview!==""&&(0,c.jsx)("pre",{className:"max-h-60 overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"ei-preview",children:g.preview})]})]})]}),(0,c.jsxs)(P,{className:"gap-0 py-0 rounded-xl border border-border bg-card shadow-xs",children:[(0,c.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,c.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Import")})}),(0,c.jsxs)(W,{className:"flex flex-col gap-3 p-4",children:[(0,c.jsx)("input",{accept:".ndjson,.jsonl,.csv,application/x-ndjson,text/csv","aria-label":n("Import file"),className:"text-sm","data-testid":"ei-file",onChange:$e,type:"file"}),T&&(0,c.jsx)(vt,{onChange:Ce,shardKey:o,value:I}),(0,c.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,c.jsx)(ie,{confirmLabel:n("Import (writes rows)?"),disabled:d||!L,onConfirm:Se,testId:"ei-import",children:n("Import")})}),k!==null&&(0,c.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-progress",role:"status",children:k}),p!==null&&(0,c.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ei-import-result",children:[(0,c.jsx)("p",{className:"text-sm text-muted-foreground",children:n("Inserted {inserted}, {conflicts} conflicts, {errors} errors.",{conflicts:p.conflicts,errors:p.errors.length,inserted:Ie})}),p.errors.length>0&&(0,c.jsx)("ul",{className:"flex flex-col gap-1","data-testid":"ei-import-errors",children:p.errors.map(x=>(0,c.jsx)("li",{className:"text-xs text-destructive",children:n("line {line} ({table}): {message}",{line:x.line,message:x.message,table:x.table})},`${x.table}-${x.line.toString()}`))})]})]})]}),v!==null&&(0,c.jsx)("p",{className:"text-sm text-destructive","data-testid":"ei-error",role:"alert",children:v})]})},"$t");function kt(t){return(0,c.jsx)(ue,{value:t.name,children:t.name},t.name)}l(kt,"vt");export{Dt as ExportImportPanel};
5
+ `);e=o.pop()??"";for(let i of o)r+=1,yield{line:i,lineNumber:r}}e!==""&&(yield{line:e,lineNumber:r+1})},"st"),dt=l(async function*(t){for await(let{line:e,lineNumber:r}of ct(t)){let n=at(e,r);n!==void 0&&(yield{line:r,row:n})}},"it"),ut=l(async function*(t,e,r,n){for await(let{doc:o,record:i}of et(G(t),r,n))yield{line:i,row:{doc:o,table:e}}},"lt"),mt=l(async(t,e,r,n)=>{try{let{columns:o}=await t.query(it,{table:n},L(r));return{kinds:new Map(o.map(i=>[i.name,i.type])),nullOnEmpty:tt(o)}}catch(o){return{failure:e("Couldn't read the columns of {table}: {message}",{message:q(o),table:n})}}},"at"),pe=50,ft=500,R=9e5,Q=l(t=>new TextEncoder().encode(JSON.stringify(K(t))).byteLength,"V"),_="application/x-ndjson",Ne=l(t=>new A("INTERNAL",`line ${t.toString()}: a single row is over the ${R.toString()}-byte import limit`),"ae"),ht=l(async t=>{let e=0;for await(let{line:r,row:n}of t){if(Q(n)>R)throw Ne(r);e+=1}return e},"dt"),pt=l(async(t,e,r,n)=>{let o={rows:0};if(await rt(G(t),r,n,({doc:i,record:s})=>{o.rows+=1,o.wide===void 0&&Q({doc:i,table:e})>R&&(o.wide=s)}),o.wide!==void 0)throw Ne(o.wide);return o.rows},"ut"),we=l(async(t,e)=>{let r=[],n=0,o=0,i=0;for await(let{line:s,row:m}of t){let f=Q(m),a=s!==i+1;r.length>0&&(a||r.length===ft||n+f>R)&&(await e(r,o),r=[],n=0),r.length===0&&(o=s),r.push(m),n+=f,i=s}r.length>0&&await e(r,o)},"ne"),wt=/\.csv$/iu,gt=l(t=>wt.test(t.name)||t.type==="text/csv","mt"),bt=l((t,e)=>t.expected==="boolean"?e("line {line}: column \u201C{column}\u201D must be true or false, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}):t.tooLong===!0?e("line {line}: column \u201C{column}\u201D holds an integer longer than the import can send.",{column:t.column,line:t.record}):t.expected==="bigint"?e("line {line}: column \u201C{column}\u201D must be an integer, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}):t.expected==="date"?e("line {line}: column \u201C{column}\u201D must be an ISO-8601 date or epoch milliseconds of at least 11 digits, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}):t.inexact===!0?e("line {line}: column \u201C{column}\u201D holds \u201C{value}\u201D, which a number column cannot store exactly. Store a whole number past 9007199254740991 in a bigint column.",{column:t.column,line:t.record,value:t.value}):e("line {line}: column \u201C{column}\u201D must be a number, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}),"ht"),xt=l((t,e)=>t.kind==="duplicate-header"?e("The header \u201C{name}\u201D appears more than once.",{name:t.name}):t.kind==="empty-header"?e("Header column {column} is empty.",{column:t.column}):t.kind==="ragged"?e("line {line}: expected {expected} cells, found {found}.",{expected:t.expected,found:t.found,line:t.record}):t.kind==="cell-type"?bt(t,e):t.kind==="text-after-quote"?e("line {line}: text follows a closing quote.",{line:t.record}):e("line {line}: a quoted field is never closed.",{line:t.record}),"pt"),yt=l((t,e,r)=>{let n=e instanceof j?xt(e.problem,r):q(e);return t===null?r("Invalid NDJSON: {message}",{message:n}):r("Invalid CSV: {message}",{message:n})},"wt"),vt=l(t=>{let e=(0,ge.c)(31),{onChange:r,shardKey:n,value:o}=t,i=V(),s;e[0]!==n?(s={shardKey:n},e[0]=n,e[1]=s):s=e[1];let{data:m}=re(E.listTables,lt,s),f;e[2]!==r?(f=l(T=>{r(T??"")},"d"),e[2]=r,e[3]=f):f=e[3];let a;e[4]!==i?(a=i("Target table"),e[4]=i,e[5]=a):a=e[5];let d;e[6]!==i?(d=i("Choose a table"),e[6]=i,e[7]=d):d=e[7];let h;e[8]!==d?(h=(0,c.jsx)(ae,{placeholder:d}),e[8]=d,e[9]=h):h=e[9];let v;e[10]!==a||e[11]!==h?(v=(0,c.jsx)(ce,{"aria-label":a,className:"w-56","data-testid":"ei-csv-table",children:h}),e[10]=a,e[11]=h,e[12]=v):v=e[12];let w;e[13]!==m?(w=m??[],e[13]=m,e[14]=w):w=e[14];let p;e[15]!==w?(p=w.map(kt),e[15]=w,e[16]=p):p=e[16];let b;e[17]!==p?(b=(0,c.jsx)(de,{children:p}),e[17]=p,e[18]=b):b=e[18];let k;e[19]!==f||e[20]!==v||e[21]!==b||e[22]!==o?(k=(0,c.jsxs)(se,{onValueChange:f,value:o,children:[v,b]}),e[19]=f,e[20]=v,e[21]=b,e[22]=o,e[23]=k):k=e[23];let N;e[24]!==i?(N=i("CSV rows have no table column, so choose the table they go into."),e[24]=i,e[25]=N):N=e[25];let g;e[26]!==N?(g=(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:N}),e[26]=N,e[27]=g):g=e[27];let u;return e[28]!==k||e[29]!==g?(u=(0,c.jsxs)("div",{className:"flex flex-col gap-1.5",children:[k,g]}),e[28]=k,e[29]=g,e[30]=u):u=e[30],u},"gt"),ke=l(t=>Object.values(t).reduce((e,r)=>e+r,0),"ce"),Nt=l(async(t,e,r,n,o,i)=>{let s={conflicts:0,errors:[],inserted:{}},m,f=i===null?{kinds:new Map,nullOnEmpty:new Set}:await mt(t,e,r,i);if("failure"in f)return{failure:{message:f.failure,rows:0},total:s};let{kinds:a,nullOnEmpty:d}=f;try{if(i===null){let u=l(()=>dt(o),"f");m={rows:await ht(u()),source:u}}else m={rows:await pt(o,i,a,d),source:l(()=>ut(o,i,a,d),"source")}}catch(u){return{failure:{message:yt(i,u,e),rows:0},total:s}}let{rows:h,source:v}=m;if(i!==null&&h===0)return{failure:{message:e("The CSV has no data rows after the header."),rows:0},total:s};let w={conflicts:0,errors:[],inserted:{}};n(e("Checking {total} rows before writing\u2026",{total:h}));try{if((await t.query(Y,{dryRun:!0,rows:[],startLine:1},L(r))).dryRun!==!0)return{failure:{message:e("This shard predates import checks, so it would write the file while checking it. Nothing was sent. Update the app and import again."),rows:0},total:s};await we(v(),async(u,T)=>{let I=await t.query(Y,{dryRun:!0,rows:u,startLine:T},L(r));w.errors.push(...I.errors)})}catch(u){return{failure:{message:q(u),rows:0},total:s}}if(w.errors.length>0)return{failure:{message:e("Nothing was written, because some rows would be refused. Fix the rows listed below and import again."),rows:0},total:w};let p=0,b=1,k={},N={},g=l(async(u,T)=>{n(e("Importing rows {from}\u2013{to} of {total}\u2026",{from:p+1,to:p+u.length,total:h})),N.startLine=T;let I=await t.query(Y,{dryRun:!1,rows:u,startLine:T},L(r));N.startLine=void 0,s.conflicts+=I.conflicts,s.errors.push(...I.errors);for(let[$,M]of Object.entries(I.inserted))s.inserted[$]=(s.inserted[$]??0)+M;if(p+=u.length,b=T+u.length,I.errors.length>0){let $=ke(s.inserted);throw k.refused=!0,new Error($===0?e("The shard refused {count} rows, so the rest of the file was not sent. Nothing was written. Fix the rows listed below and import again.",{count:I.errors.length}):e("The shard refused {count} rows, so the rest of the file was not sent. {written} rows were already written, so do not import the whole file again. Import the refused rows and any rows from line {line} onward, or delete the written rows first and then import the whole file.",{count:I.errors.length,line:T+u.length,written:$}))}},"w");try{return await we(v(),g),{failure:void 0,total:s}}catch(u){return{failure:{message:q(u),nextLine:b,rows:p,unknownFrom:N.startLine,...k},total:s}}},"xt"),Dt=l(({initialShardKey:t})=>{let e=te(),r=ne(),n=V(),[o,i]=(0,S.useState)(t??""),[s,m]=(0,S.useState)(null),[f,a]=(0,S.useState)(null),[d,h]=(0,S.useState)(!1),[v,w]=(0,S.useState)(null),[p,b]=(0,S.useState)(null),[k,N]=(0,S.useState)(null),[g,u]=(0,S.useState)(null),T=s!==null&&gt(s),I=f!==null&&f.shardKey===o?f.table:"",$=s!==null&&(!T||I!==""),M=l(async()=>{let x=o;h(!0),w(null),b(null),u(null);try{let F=await e.query(ot,{},L(x)),y=new Blob([],{type:_}),C=0,B=[];for(let{name:Le}of F){let{rows:U}=await e.query(nt,{tables:[Le]},L(x));if(U.length===0)continue;let X=st(U);y=new Blob([y,`${X}
6
+ `],{type:_}),C+=U.length,B.length<pe&&B.push(...X.split(`
7
+ `).slice(0,pe-B.length))}H(x),u({blob:y,count:C,preview:B.join(`
8
+ `),shardKey:x})}catch(F){w(q(F))}},"B"),Te=l(async(x,F)=>{h(!0),w(null),b(null),u(null);let{failure:y,total:C}=await Nt(e,n,o,N,x,F);y===void 0?(H(o),b(C)):y.unknownFrom===void 0&&(y.refused===!0||y.rows===0)?(C.errors.length>0&&b(C),w(y.message)):y.unknownFrom===void 0?(b(C),w(n("Import stopped after {rows} rows: {message}. The counts below cover those rows. Rows from line {line} onward were not sent: do not import the whole file again, import from that line onward, or delete the written rows first and then import the whole file.",{line:y.nextLine,message:y.message,rows:y.rows}))):(b(C),w(n("Import stopped after {rows} rows: {message}. The counts below cover completed chunks only. The chunk from line {line} may have written rows: check the table for rows from line {line} onward before importing again, or delete the written rows first and then import the whole file.",{line:y.unknownFrom,message:y.message,rows:y.rows}))),r(E.readTablePage),r(E.listTables)},"de"),Ie=p===null?0:ke(p.inserted),je=l(()=>{z(M().finally(()=>{h(!1)}))},"fe"),Se=l(()=>{s!==null&&$&&z(Te(s,T?I:null).finally(()=>{N(null),h(!1)}))},"me"),$e=l(()=>{g!==null&&le(`${g.shardKey.trim()===""?"shard":g.shardKey.trim()}.ndjson`,g.blob,_)},"he"),Ce=l(x=>{m(x.target.files?.[0]??null),a(null)},"pe"),Ee=l(x=>{a({shardKey:o,table:x})},"we");return(0,c.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-export-import",children:[(0,c.jsxs)(P,{className:"gap-0 py-0 rounded-xl border border-border bg-card shadow-xs",children:[(0,c.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,c.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Export")})}),(0,c.jsxs)(W,{className:"flex flex-col gap-3 p-4",children:[(0,c.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,c.jsx)(oe,{onChange:i,testId:"ei-shard-input",value:o}),(0,c.jsx)(Z,{"data-testid":"ei-export",disabled:d,onClick:je,type:"button",children:n("Export")})]}),g!==null&&(0,c.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,c.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,c.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-export-result",children:n("Exported {count} rows.",{count:g.count})}),(0,c.jsx)(Z,{"data-testid":"ei-download",onClick:$e,size:"sm",type:"button",variant:"outline",children:n("Download")})]}),g.preview!==""&&(0,c.jsx)("pre",{className:"max-h-60 overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"ei-preview",children:g.preview})]})]})]}),(0,c.jsxs)(P,{className:"gap-0 py-0 rounded-xl border border-border bg-card shadow-xs",children:[(0,c.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,c.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Import")})}),(0,c.jsxs)(W,{className:"flex flex-col gap-3 p-4",children:[(0,c.jsx)("input",{accept:".ndjson,.jsonl,.csv,application/x-ndjson,text/csv","aria-label":n("Import file"),className:"text-sm","data-testid":"ei-file",onChange:Ce,type:"file"}),T&&(0,c.jsx)(vt,{onChange:Ee,shardKey:o,value:I}),(0,c.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,c.jsx)(ie,{confirmLabel:n("Import (writes rows)?"),disabled:d||!$,onConfirm:Se,testId:"ei-import",children:n("Import")})}),k!==null&&(0,c.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-progress",role:"status",children:k}),p!==null&&(0,c.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ei-import-result",children:[(0,c.jsx)("p",{className:"text-sm text-muted-foreground",children:n("Inserted {inserted}, {conflicts} conflicts, {errors} errors.",{conflicts:p.conflicts,errors:p.errors.length,inserted:Ie})}),p.errors.length>0&&(0,c.jsx)("ul",{className:"flex flex-col gap-1","data-testid":"ei-import-errors",children:p.errors.map(x=>(0,c.jsx)("li",{className:"text-xs text-destructive",children:n("line {line} ({table}): {message}",{line:x.line,message:x.message,table:x.table})},`${x.table}-${x.line.toString()}`))})]})]})]}),v!==null&&(0,c.jsx)("p",{className:"text-sm text-destructive","data-testid":"ei-error",role:"alert",children:v})]})},"$t");function kt(t){return(0,c.jsx)(ue,{value:t.name,children:t.name},t.name)}l(kt,"vt");export{Dt as ExportImportPanel};
@@ -1 +1 @@
1
- import{a as g}from"./chunk-4ZEL6BYL.js";import{c as k}from"./chunk-RX755NMO.js";import{l as S}from"./chunk-YBDF3DET.js";import{d as _,f as y,g as v,p as C}from"./chunk-74IYYDDI.js";import{a as i,d as N,e as L,f as T,g as F}from"./chunk-I26MS5PJ.js";var w=N(L(),1);var j={},A=y(g.aiGenerateSql),I=y(g.aiTableFilter),O=y(g.aiChartConfig),Q=i(s=>{let e=S(),[l,d]=(0,w.useState)({}),[n,t]=(0,w.useState)({}),a=k(g.aiAvailable,j,{shardKey:s}),[u,c]=(0,w.useState)(!1),x=u||a.data?.available===!1,p=i(o=>{d(r=>({...r,[o]:!0})),t(r=>({...r,[o]:void 0}))},"i"),h=i((o,r)=>{d(b=>({...b,[o]:!1})),r!==void 0&&t(b=>({...b,[o]:r})),r==="no-ai-binding"&&c(!0)},"a"),f=i(async o=>{p("sql");try{let{result:r}=await e.query(A,o,v(s));return h("sql",r.degraded?r.reason:void 0),r.degraded?void 0:r.sql}catch{h("sql","ai-error");return}},"f");return{generate:i(async(o,r)=>f({failedError:r?.error,failedSql:r?.sql,prompt:o}),"generate"),inferChart:i(async o=>{p("chart");try{let{result:r}=await e.query(O,o,v(s));return h("chart",r.degraded?r.reason:void 0),r.degraded?void 0:r.chart}catch{h("chart","ai-error");return}},"inferChart"),pending:i(o=>l[o]===!0,"pending"),reason:i(o=>n[o],"reason"),rewrite:i(async(o,r)=>f({editSql:r,prompt:o}),"rewrite"),suggestFilter:i(async(o,r)=>{p("filter");try{let{result:b}=await e.query(I,{prompt:o,table:r},v(s));return h("filter",b.degraded?b.reason:void 0),b.degraded?void 0:b.clauses}catch{h("filter","ai-error");return}},"suggestFilter"),unavailable:x}},"Q");var q=N(T(),1);var m=N(F(),1);var G=i((s,e)=>{if(e==="")return[{match:!1,offset:0,text:s}];let l=[],d=s.toLowerCase(),n=e.toLowerCase(),t=0;for(let a=d.indexOf(n);a!==-1;a=d.indexOf(n,t))a>t&&l.push({match:!1,offset:t,text:s.slice(t,a)}),l.push({match:!0,offset:a,text:s.slice(a,a+e.length)}),t=a+e.length;return t<s.length&&l.push({match:!1,offset:t,text:s.slice(t)}),l},"N"),U=i(s=>{let e=(0,q.c)(9),{highlight:l,value:d}=s;if(d==null){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,m.jsx)("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=c):c=e[0],c}let n,t,a;if(e[1]!==l||e[2]!==d){a=Symbol.for("react.early_return_sentinel");e:{let c=C(d);if(l===void 0||l===""){a=(0,m.jsx)("span",{title:c,children:c});break e}n=c,t=G(c,l).map(z)}e[1]=l,e[2]=d,e[3]=n,e[4]=t,e[5]=a}else n=e[3],t=e[4],a=e[5];if(a!==Symbol.for("react.early_return_sentinel"))return a;let u;return e[6]!==n||e[7]!==t?(u=(0,m.jsx)("span",{title:n,children:t}),e[6]=n,e[7]=t,e[8]=u):u=e[8],u},"v"),P=i(s=>{let e=(0,q.c)(22),{columns:l,rows:d}=s,n=_(),t;e[0]!==n?(t=n("Field"),e[0]=n,e[1]=t):t=e[1];let a;e[2]!==t?(a=(0,m.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:t}),e[2]=t,e[3]=a):a=e[3];let u;if(e[4]!==d||e[5]!==n){let f;e[7]!==n?(f=i((o,r)=>(0,m.jsx)("th",{className:"border-b border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase tabular-nums text-muted-foreground",children:n("Row {n}",{n:r+1})},r),"c"),e[7]=n,e[8]=f):f=e[8],u=d.map(f),e[4]=d,e[5]=n,e[6]=u}else u=e[6];let c;e[9]!==a||e[10]!==u?(c=(0,m.jsx)("thead",{className:"sticky top-0 z-10 bg-muted",children:(0,m.jsxs)("tr",{children:[a,u]})}),e[9]=a,e[10]=u,e[11]=c):c=e[11];let x;if(e[12]!==l||e[13]!==d){let f;e[15]!==d?(f=i(o=>(0,m.jsxs)("tr",{className:"hover:bg-muted/40",children:[(0,m.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:o}),d.map((r,b)=>(0,m.jsx)("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:(0,m.jsx)(U,{value:r[o]})},b))]},o),"c"),e[15]=d,e[16]=f):f=e[16],x=l.map(f),e[12]=l,e[13]=d,e[14]=x}else x=e[14];let p;e[17]!==x?(p=(0,m.jsx)("tbody",{children:x}),e[17]=x,e[18]=p):p=e[18];let h;return e[19]!==c||e[20]!==p?(h=(0,m.jsx)("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:(0,m.jsxs)("table",{className:"border-collapse text-xs",children:[c,p]})}),e[19]=c,e[20]=p,e[21]=h):h=e[21],h},"T"),V=i(({children:s,layout:e="card",testId:l})=>(0,m.jsx)("div",{className:e==="fill"?"flex min-h-0 flex-1 flex-col overflow-hidden border-t border-border":"overflow-x-auto border border-border bg-card","data-testid":l,children:s}),"j");function z(s){return(0,m.jsx)("mark",{className:s.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:s.text},s.offset)}i(z,"_");export{Q as a,U as b,P as c,V as d};
1
+ import{a as g}from"./chunk-4ZEL6BYL.js";import{c as k}from"./chunk-YJ2WHOGO.js";import{p as C}from"./chunk-U76DVXTR.js";import{f as S,h as y,i as v,r as _}from"./chunk-LPINY2IJ.js";import{a as i,d as N,e as T,f as F,g as L}from"./chunk-OXFKZ4BM.js";var w=N(T(),1);var j={},A=y(g.aiGenerateSql),I=y(g.aiTableFilter),O=y(g.aiChartConfig),Q=i(s=>{let e=C(),[l,d]=(0,w.useState)({}),[n,t]=(0,w.useState)({}),a=k(g.aiAvailable,j,{shardKey:s}),[f,c]=(0,w.useState)(!1),x=f||a.data?.available===!1,p=i(o=>{d(r=>({...r,[o]:!0})),t(r=>({...r,[o]:void 0}))},"i"),h=i((o,r)=>{d(b=>({...b,[o]:!1})),r!==void 0&&t(b=>({...b,[o]:r})),r==="no-ai-binding"&&c(!0)},"a"),u=i(async o=>{p("sql");try{let{result:r}=await e.query(A,o,v(s));return h("sql",r.degraded?r.reason:void 0),r.degraded?void 0:r.sql}catch{h("sql","ai-error");return}},"f");return{generate:i(async(o,r)=>u({failedError:r?.error,failedSql:r?.sql,prompt:o}),"generate"),inferChart:i(async o=>{p("chart");try{let{result:r}=await e.query(O,o,v(s));return h("chart",r.degraded?r.reason:void 0),r.degraded?void 0:r.chart}catch{h("chart","ai-error");return}},"inferChart"),pending:i(o=>l[o]===!0,"pending"),reason:i(o=>n[o],"reason"),rewrite:i(async(o,r)=>u({editSql:r,prompt:o}),"rewrite"),suggestFilter:i(async(o,r)=>{p("filter");try{let{result:b}=await e.query(I,{prompt:o,table:r},v(s));return h("filter",b.degraded?b.reason:void 0),b.degraded?void 0:b.clauses}catch{h("filter","ai-error");return}},"suggestFilter"),unavailable:x}},"Q");var q=N(F(),1);var m=N(L(),1);var G=i((s,e)=>{if(e==="")return[{match:!1,offset:0,text:s}];let l=[],d=s.toLowerCase(),n=e.toLowerCase(),t=0;for(let a=d.indexOf(n);a!==-1;a=d.indexOf(n,t))a>t&&l.push({match:!1,offset:t,text:s.slice(t,a)}),l.push({match:!0,offset:a,text:s.slice(a,a+e.length)}),t=a+e.length;return t<s.length&&l.push({match:!1,offset:t,text:s.slice(t)}),l},"N"),U=i(s=>{let e=(0,q.c)(9),{highlight:l,value:d}=s;if(d==null){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,m.jsx)("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=c):c=e[0],c}let n,t,a;if(e[1]!==l||e[2]!==d){a=Symbol.for("react.early_return_sentinel");e:{let c=_(d);if(l===void 0||l===""){a=(0,m.jsx)("span",{title:c,children:c});break e}n=c,t=G(c,l).map(z)}e[1]=l,e[2]=d,e[3]=n,e[4]=t,e[5]=a}else n=e[3],t=e[4],a=e[5];if(a!==Symbol.for("react.early_return_sentinel"))return a;let f;return e[6]!==n||e[7]!==t?(f=(0,m.jsx)("span",{title:n,children:t}),e[6]=n,e[7]=t,e[8]=f):f=e[8],f},"v"),P=i(s=>{let e=(0,q.c)(22),{columns:l,rows:d}=s,n=S(),t;e[0]!==n?(t=n("Field"),e[0]=n,e[1]=t):t=e[1];let a;e[2]!==t?(a=(0,m.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:t}),e[2]=t,e[3]=a):a=e[3];let f;if(e[4]!==d||e[5]!==n){let u;e[7]!==n?(u=i((o,r)=>(0,m.jsx)("th",{className:"border-b border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase tabular-nums text-muted-foreground",children:n("Row {n}",{n:r+1})},r),"c"),e[7]=n,e[8]=u):u=e[8],f=d.map(u),e[4]=d,e[5]=n,e[6]=f}else f=e[6];let c;e[9]!==a||e[10]!==f?(c=(0,m.jsx)("thead",{className:"sticky top-0 z-10 bg-muted",children:(0,m.jsxs)("tr",{children:[a,f]})}),e[9]=a,e[10]=f,e[11]=c):c=e[11];let x;if(e[12]!==l||e[13]!==d){let u;e[15]!==d?(u=i(o=>(0,m.jsxs)("tr",{className:"hover:bg-muted/40",children:[(0,m.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:o}),d.map((r,b)=>(0,m.jsx)("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:(0,m.jsx)(U,{value:r[o]})},b))]},o),"c"),e[15]=d,e[16]=u):u=e[16],x=l.map(u),e[12]=l,e[13]=d,e[14]=x}else x=e[14];let p;e[17]!==x?(p=(0,m.jsx)("tbody",{children:x}),e[17]=x,e[18]=p):p=e[18];let h;return e[19]!==c||e[20]!==p?(h=(0,m.jsx)("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:(0,m.jsxs)("table",{className:"border-collapse text-xs",children:[c,p]})}),e[19]=c,e[20]=p,e[21]=h):h=e[21],h},"T"),V=i(({children:s,layout:e="card",testId:l})=>(0,m.jsx)("div",{className:e==="fill"?"flex min-h-0 flex-1 flex-col overflow-hidden border-t border-border":"overflow-x-auto border border-border bg-card","data-testid":l,children:s}),"j");function z(s){return(0,m.jsx)("mark",{className:s.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:s.text},s.offset)}i(z,"_");export{Q as a,U as b,P as c,V as d};
@@ -0,0 +1 @@
1
+ import{a as Z}from"./chunk-5DNGK3NT.js";import{a as te}from"./chunk-ZWDORIZY.js";import{a as Y}from"./chunk-KYONGQQ4.js";import{b as X}from"./chunk-SLIDAWNX.js";import{a as W}from"./chunk-DBVJ5VLI.js";import"./chunk-6M7FLLMT.js";import{i as D}from"./chunk-LUHXNZI4.js";import"./chunk-ZTOREMGH.js";import"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{b as ae,c as ne}from"./chunk-WS36BO4R.js";import{a as q,b as ee}from"./chunk-P5GAJKDW.js";import{a as G}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import"./chunk-OECMBE6Q.js";import"./chunk-OSJ7HV7B.js";import"./chunk-7F3S5OQT.js";import"./chunk-E26OT26O.js";import{a as I}from"./chunk-4ZEL6BYL.js";import{c as _}from"./chunk-YJ2WHOGO.js";import{p as V}from"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import"./chunk-CW57Q264.js";import"./chunk-MD67S53Z.js";import{f as M,h as C,i as A,o as Q,s as N}from"./chunk-LPINY2IJ.js";import{a as l,d as j,e as he,f as me,g as pe}from"./chunk-OXFKZ4BM.js";var E=j(me(),1);var c=j(he(),1);var S=j(pe(),1);var ge=l(t=>{let{suggestedIndex:e,table:i}=t;if(typeof i!="string"||i.length===0||typeof e!="object"||e===null)return!1;let{fields:a,name:n}=e;return!Array.isArray(a)||a.length===0||a.some(s=>typeof s!="string"||s.length===0)?!1:typeof n=="string"&&n.length>0},"ye"),be=l((t,e)=>`.index(${JSON.stringify(t)}, [${e.map(i=>JSON.stringify(i)).join(", ")}])`,"ge"),ye=l(t=>{let e=(0,E.c)(19),{fields:i,indexName:a,table:n,testId:s}=t,u=M(),[h,f]=(0,c.useState)(null),m;e[0]!==i||e[1]!==a?(m=l(()=>{let b=be(a,i),$="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if($===void 0){f({copied:!1,declaration:b});return}N($.writeText(b).then(()=>(f({copied:!0,declaration:b}),!0)),()=>{f({copied:!1,declaration:b})})},"m"),e[0]=i,e[1]=a,e[2]=m):m=e[2];let x=m;if(h!==null){let b;return e[3]!==h.copied||e[4]!==h.declaration||e[5]!==u||e[6]!==n||e[7]!==s?(b=h.copied?(0,S.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`${s}-applied`,children:u("Index declaration copied \u2014 add it to {table} in lunora/schema.ts.",{table:n})}):(0,S.jsxs)("span",{className:"flex flex-col gap-1 text-xs text-muted-foreground","data-testid":`${s}-manual`,children:[u("Could not reach the clipboard \u2014 add this to {table} in lunora/schema.ts:",{table:n}),(0,S.jsx)("code",{className:"font-mono break-all select-all",children:h.declaration})]}),e[3]=h.copied,e[4]=h.declaration,e[5]=u,e[6]=n,e[7]=s,e[8]=b):b=e[8],b}let T;e[9]!==u?(T=u("Copy?"),e[9]=u,e[10]=T):T=e[10];let p;e[11]!==u||e[12]!==n?(p=u("Copy index declaration for {table}",{table:n}),e[11]=u,e[12]=n,e[13]=p):p=e[13];let w;return e[14]!==x||e[15]!==T||e[16]!==p||e[17]!==s?(w=(0,S.jsx)(te,{confirmLabel:T,onConfirm:x,testId:s,children:p}),e[14]=x,e[15]=T,e[16]=p,e[17]=s,e[18]=w):w=e[18],w},"ve"),xe=l((t,e)=>{let i=new Map;for(let a of e){let n=`${a.table} ${a.index}`;i.set(n,(i.get(n)??0)+a.reads)}return t.map(a=>({index:a.index,reads:i.get(`${a.table} ${a.index}`)??0,table:a.table}))},"Se"),ve=l(t=>{let e=new Map;for(let i of t)for(let a of i.scannedTables??[])e.set(a.table,(e.get(a.table)??0)+a.scans);return[...e].map(([i,a])=>({scans:a,table:i}))},"Te"),ie=l((t,e)=>e.map(i=>({index:i.name,table:t})),"P"),we=l(t=>{let e=xe(t.declaredIndexes??[],t.indexHits??[]),i=ve(t.functions??[]),a=t.shardTraffic??[],n=t.analyticsMetrics,s=n&&n.indexHits.length>0?n.indexHits:e,u=n&&n.tableScans.length>0?n.tableScans:i,h=n&&n.shardTraffic.length>0?n.shardTraffic:a,f=ne({indexHits:s,schema:{tables:[]},shardTraffic:h,tableScans:u},{lints:ae,source:"runtime"}),m=t.suppressHotScanTables;return(m===void 0?f:f.filter(x=>!(x.metadata.kind==="hot_scan"&&typeof x.metadata.table=="string"&&m.has(x.metadata.table)))).map(x=>q(x))},"we"),Se=C(I.listTables),Te=C(I.listTableIndexes),Ie=C(I.listTablesIndexes),B=l(t=>`${(t*100).toFixed(1)}%`,"H"),re=l(t=>`${(t/1e3).toFixed(2)}s`,"V"),$e=l(t=>{if(t.length<=1)return t[0]??"";let e=t[t.length-1]??"";return`${t.slice(0,-1).join(", ")} and ${e}`},"Ne"),ke=l((t,e)=>({"high-error-rate":t("High error rate"),"high-evictions":t("High cache eviction rate"),"high-write-contention":t("High write contention"),"low-cache-hit-rate":t("Low cache hit rate"),"missing-index":t("Missing index"),"slow-function":t("Slow function"),"storage-headroom":t("Storage headroom")})[e.kind],"ke"),se=l((t,e)=>({"high-error-rate":t("{rate} of calls failed.",{rate:B(e.value)}),"high-evictions":t("{count} entries evicted recently.",{count:e.value}),"high-write-contention":t("{rate} of calls hit a write conflict \u2014 consider sharding to cut contention.",{rate:B(e.value)}),"low-cache-hit-rate":t("{rate} hit rate over recent traffic.",{rate:B(e.value)}),"missing-index":t("Slowest call took {duration} \u2014 it full-scanned {tables} with no index.",{duration:re(e.value),tables:$e(e.tables??[])}),"slow-function":t("Slowest call took {duration}.",{duration:re(e.value)}),"storage-headroom":t("{size} of the 10 GiB per-shard ceiling \u2014 plan a .shardBy() migration while it still has runway.",{size:Q(e.value)})})[e.kind],"U"),Ne=l(t=>{let e=(0,E.c)(10),{onJump:i,table:a}=t,n=M(),s;e[0]!==i||e[1]!==a?(s=l(()=>{i(a)},"i"),e[0]=i,e[1]=a,e[2]=s):s=e[2];let u=s,h=`in-add-index-${a}`,f;e[3]!==n||e[4]!==a?(f=n("Add index on {table}",{table:a}),e[3]=n,e[4]=a,e[5]=f):f=e[5];let m;return e[6]!==u||e[7]!==h||e[8]!==f?(m=(0,S.jsx)(G,{"data-testid":h,onClick:u,size:"sm",type:"button",variant:"outline",children:f}),e[6]=u,e[7]=h,e[8]=f,e[9]=m):m=e[9],m},"Be"),ze=l(({initialShardKey:t,loadShardTraffic:e})=>{let i=V(),a=D(),n=M(),{queryShardKey:s,setShardKey:u,shardKey:h}=Z(t),[f,m]=(0,c.useState)(null),[x,T]=(0,c.useState)(null),p=(0,c.useRef)(""),w=_(I.getMetrics,{},{live:!0,shardKey:s}),b=_(I.getFunctionStats,{},{live:!0,shardKey:s}),$=_(I.getAdvisories,{},{live:!0,shardKey:s}),L=w.data??null,H=b.data?.functions??null,F=$.data?.advisories??null,J=w.data?.indexHits??null,O=w.error!==null&&b.error!==null?w.error:null,oe=e??(r=>i.shardTraffic(r)),le=l(async(r,y)=>{let o=r[0];if(o===void 0||o===""){p.current===y&&T(null);return}try{let g=await oe(o);if(p.current!==y)return;let d=new Map;for(let v of g.shards)d.has(v.shardKey)||d.set(v.shardKey,{requests:v.requests,shardKey:v.shardKey});T([...d.values()])}catch{p.current===y&&T(null)}},"Y"),de=l(async(r,y)=>{let o=await Promise.allSettled(r.map(async d=>[d,await i.query(Te,{table:d},A(y))])),g=[];for(let d of o)if(d.status==="fulfilled"){let[v,k]=d.value;g.push(...ie(v,k.indexes))}return g},"Z"),z=(0,c.useEffectEvent)(async r=>{p.current=r;let y=[];try{let o=await i.query(Se,{},A(r));if(p.current!==r)return;X(r),y=o.map(d=>d.name);let g=[];if(y.length>0)try{let d=await i.query(Ie,{tables:y},A(r));if(p.current!==r)return;for(let[v,k]of Object.entries(d.indexesByTable))g.push(...ie(v,k))}catch{if(g=await de(y,r),p.current!==r)return}m(g)}catch{p.current===r&&m(null)}await le(y,r)});(0,c.useEffect)(()=>{N(z(s))},[s]);let ce=(0,c.useEffectEvent)(()=>{w.refetch(),b.refetch(),$.refetch(),N(z(s))});(0,c.useEffect)(()=>{let r=l(()=>{document.visibilityState==="visible"&&ce()},"r");return document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("visibilitychange",r)}},[]);let U=(0,c.useCallback)(r=>{N(a({search:{table:r},to:"/schema"}))},[a]),K=(0,c.useMemo)(()=>W(L,H),[H,L]),P=(0,c.useMemo)(()=>new Set(K.filter(r=>r.kind==="missing-index").flatMap(r=>r.tables??[])),[K]),R=(0,c.useMemo)(()=>we({declaredIndexes:f??[],functions:H,indexHits:J,shardTraffic:x,suppressHotScanTables:P}),[f,H,J,P,x]),ue=(0,c.useMemo)(()=>{let r=K.map(o=>{let g=o.kind==="missing-index"?o.tables??[]:[];return{action:g.length>0?g.map(d=>(0,S.jsx)(Ne,{onJump:U,table:d},d)):void 0,description:o.message===void 0?se(n,o):`${se(n,o)} \u2014 ${o.message}`,entity:o.fn,issueType:ke(n,o),key:`${o.kind}:${o.fn??""}`,level:o.severity}}),y=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(F??[]).map(o=>{let g=q(o);if(y.has(o.name)&&ge(o.metadata)){let{table:d,suggestedIndex:v}=o.metadata,k=`in-apply-index-${d}-${v.name}`;return{...g,action:(0,S.jsx)(ye,{fields:v.fields,indexName:v.name,table:d,testId:k})}}return g}),...R,...r]},[F,K,U,R,n]),fe=(0,S.jsx)(Y,{onChange:u,testId:"in-shard-input",value:h});return(0,S.jsx)(ee,{error:O,errorSource:O===null?void 0:w.errorSource,rows:ue,testId:"lunora-insights",toolbar:fe})},"Ue");export{ze as InsightsPanel};
@@ -0,0 +1 @@
1
+ import{a as v}from"./chunk-AOHKAKKL.js";import{a as Q}from"./chunk-SOO2HXV6.js";import{a as L}from"./chunk-5DNGK3NT.js";import{a as G}from"./chunk-KYONGQQ4.js";import"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import"./chunk-ZBON5T5A.js";import{b as $}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as W}from"./chunk-OECMBE6Q.js";import"./chunk-OSJ7HV7B.js";import"./chunk-7F3S5OQT.js";import"./chunk-E26OT26O.js";import{a as E}from"./chunk-4ZEL6BYL.js";import{c as B}from"./chunk-YJ2WHOGO.js";import"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import{a as A}from"./chunk-3Y5K3IQO.js";import{a as q,b as H,c as O,d as K,e as T,f as D}from"./chunk-CW57Q264.js";import{a as _}from"./chunk-MD67S53Z.js";import{f as j}from"./chunk-LPINY2IJ.js";import{a as S,d as F,f as J,g as V}from"./chunk-OXFKZ4BM.js";var R=F(J(),1);var t=F(V(),1);var U=S(c=>`${c.toString()} ms`,"D"),X=S(c=>c.totalConnections===0&&c.shapePoke.passes===0&&c.whisper.passes===0&&c.shapeProbe.run===0&&c.shapeProbe.served===0&&c.globalPoll.drains===0&&c.globalPoll.pairsSkipped===0,"J"),z=S(c=>{let e=(0,R.c)(48),{counters:o,includeTiming:a,prefix:r,t:l,title:u}=c,d=`${r}-section`,n;e[0]!==u?(n=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:u}),e[0]=u,e[1]=n):n=e[1];let s=`${r}-stats`,i;e[2]!==l?(i=l("Passes"),e[2]=l,e[3]=i):i=e[3];let m=`${r}-passes`,I;e[4]!==o.passes||e[5]!==i||e[6]!==m?(I=(0,t.jsx)(v,{label:i,testId:m,value:o.passes}),e[4]=o.passes,e[5]=i,e[6]=m,e[7]=I):I=e[7];let g;e[8]!==l?(g=l("Sockets iterated"),e[8]=l,e[9]=g):g=e[9];let k=`${r}-iterated`,p;e[10]!==o.socketsIterated||e[11]!==g||e[12]!==k?(p=(0,t.jsx)(v,{label:g,testId:k,value:o.socketsIterated}),e[10]=o.socketsIterated,e[11]=g,e[12]=k,e[13]=p):p=e[13];let f;e[14]!==l?(f=l("Delivered"),e[14]=l,e[15]=f):f=e[15];let y=`${r}-delivered`,h;e[16]!==o.socketsDelivered||e[17]!==f||e[18]!==y?(h=(0,t.jsx)(v,{label:f,testId:y,value:o.socketsDelivered}),e[16]=o.socketsDelivered,e[17]=f,e[18]=y,e[19]=h):h=e[19];let x;e[20]!==l?(x=l("Peak width"),e[20]=l,e[21]=x):x=e[21];let N=`${r}-peak`,b;e[22]!==o.peakSocketsIterated||e[23]!==x||e[24]!==N?(b=(0,t.jsx)(v,{label:x,testId:N,value:o.peakSocketsIterated}),e[22]=o.peakSocketsIterated,e[23]=x,e[24]=N,e[25]=b):b=e[25];let C;e[26]!==o.totalMs||e[27]!==a||e[28]!==r||e[29]!==l?(C=a&&(0,t.jsx)(v,{label:l("Total time"),testId:`${r}-total-ms`,value:U(o.totalMs)}),e[26]=o.totalMs,e[27]=a,e[28]=r,e[29]=l,e[30]=C):C=e[30];let P;e[31]!==o.maxMs||e[32]!==a||e[33]!==r||e[34]!==l?(P=a&&(0,t.jsx)(v,{label:l("Max time"),testId:`${r}-max-ms`,value:U(o.maxMs)}),e[31]=o.maxMs,e[32]=a,e[33]=r,e[34]=l,e[35]=P):P=e[35];let M;e[36]!==h||e[37]!==b||e[38]!==C||e[39]!==P||e[40]!==s||e[41]!==I||e[42]!==p?(M=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":s,children:[I,p,h,b,C,P]}),e[36]=h,e[37]=b,e[38]=C,e[39]=P,e[40]=s,e[41]=I,e[42]=p,e[43]=M):M=e[43];let w;return e[44]!==d||e[45]!==M||e[46]!==n?(w=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":d,children:[n,M]}),e[44]=d,e[45]=M,e[46]=n,e[47]=w):w=e[47],w},"F"),Y=S(c=>{let e=(0,R.c)(20),{counters:o,t:a}=c,r;e[0]!==a?(r=a("Membership probes"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let u;e[4]!==a?(u=a("Queries run"),e[4]=a,e[5]=u):u=e[5];let d;e[6]!==o.run||e[7]!==u?(d=(0,t.jsx)(v,{label:u,testId:"fanout-probe-run",value:o.run}),e[6]=o.run,e[7]=u,e[8]=d):d=e[8];let n;e[9]!==a?(n=a("Shared from cache"),e[9]=a,e[10]=n):n=e[10];let s;e[11]!==o.served||e[12]!==n?(s=(0,t.jsx)(v,{label:n,testId:"fanout-probe-served",value:o.served}),e[11]=o.served,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==d||e[15]!==s?(i=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-probe-stats",children:[d,s]}),e[14]=d,e[15]=s,e[16]=i):i=e[16];let m;return e[17]!==l||e[18]!==i?(m=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-probe-section",children:[l,i]}),e[17]=l,e[18]=i,e[19]=m):m=e[19],m},"V"),Z=S(c=>{let e=(0,R.c)(20),{counters:o,t:a}=c,r;e[0]!==a?(r=a("Global shape polls"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let u;e[4]!==a?(u=a("Global reads"),e[4]=a,e[5]=u):u=e[5];let d;e[6]!==o.drains||e[7]!==u?(d=(0,t.jsx)(v,{label:u,testId:"fanout-global-poll-drains",value:o.drains}),e[6]=o.drains,e[7]=u,e[8]=d):d=e[8];let n;e[9]!==a?(n=a("Pairs skipped"),e[9]=a,e[10]=n):n=e[10];let s;e[11]!==o.pairsSkipped||e[12]!==n?(s=(0,t.jsx)(v,{label:n,testId:"fanout-global-poll-pairs-skipped",value:o.pairsSkipped}),e[11]=o.pairsSkipped,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==d||e[15]!==s?(i=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-global-poll-stats",children:[d,s]}),e[14]=d,e[15]=s,e[16]=i):i=e[16];let m;return e[17]!==l||e[18]!==i?(m=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-global-poll-section",children:[l,i]}),e[17]=l,e[18]=i,e[19]=m):m=e[19],m},"X"),pe=S(c=>{let e=(0,R.c)(31),{initialShardKey:o}=c,a=j(),{queryShardKey:r,setShardKey:l,shardKey:u}=L(o),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d={},e[0]=d):d=e[0];let n;e[1]!==r?(n={keepPreviousData:!0,shardKey:r},e[1]=r,e[2]=n):n=e[2];let{data:s,error:i,errorSource:m,poll:I}=B(E.getFanoutMetrics,d,n);Q(I,!0);let g;e[3]!==s?(g=s!==void 0&&X(s),e[3]=s,e[4]=g):g=e[4];let k=g,p;e[5]!==l||e[6]!==u?(p=(0,t.jsx)(G,{onChange:l,testId:"fanout-shard-input",value:u}),e[5]=l,e[6]=u,e[7]=p):p=e[7];let f;e[8]!==s||e[9]!==a?(f=s!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[s.promoted&&(0,t.jsx)($,{"data-testid":"fanout-promoted",variant:s.relayCount>=s.maxRelays?"destructive":"default",children:s.relayCount>=s.maxRelays?a("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:s.maxRelays,relayCount:s.relayCount}):a("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:s.maxRelays,relayCount:s.relayCount})}),(0,t.jsx)($,{variant:"secondary",children:a("{count} connections",{count:s.totalConnections})}),(0,t.jsx)($,{variant:"secondary",children:a("peak {count} subscribers",{count:s.peakSubscribers})})]}),e[8]=s,e[9]=a,e[10]=f):f=e[10];let y;e[11]!==p||e[12]!==f?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p,f]}),e[11]=p,e[12]=f,e[13]=y):y=e[13];let h;e[14]!==i||e[15]!==m?(h=i!==null&&(0,t.jsx)(W,{error:m,testId:"fanout-error"}),e[14]=i,e[15]=m,e[16]=h):h=e[16];let x;e[17]!==i||e[18]!==k||e[19]!==a?(x=i===null&&k&&(0,t.jsx)(A,{description:a("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 12h4l3 7 4-14 3 7h2"})}),testId:"fanout-empty",title:a("No fan-out activity yet.")}),e[17]=i,e[18]=k,e[19]=a,e[20]=x):x=e[20];let N;e[21]!==i||e[22]!==k||e[23]!==s||e[24]!==a?(N=i===null&&s!==void 0&&!k&&(0,t.jsxs)(t.Fragment,{children:[s.topics.length>0&&(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:a("Hot topics")}),(0,t.jsx)(_,{className:"overflow-hidden py-0",children:(0,t.jsxs)(q,{"data-testid":"fanout-topics-table",children:[(0,t.jsx)(H,{children:(0,t.jsxs)(K,{children:[(0,t.jsx)(T,{children:a("Topic")}),(0,t.jsx)(T,{children:a("Kind")}),(0,t.jsx)(T,{className:"text-right",children:a("Subscribers")})]})}),(0,t.jsx)(O,{children:s.topics.map(ee)})]})})]}),(0,t.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,t.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:a("Fan-out cost since this instance woke")}),(0,t.jsx)(z,{counters:s.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:a,title:a("Shape pokes")}),(0,t.jsx)(z,{counters:s.whisper,includeTiming:!1,prefix:"fanout-whisper",t:a,title:a("Whisper broadcasts")}),(0,t.jsx)(Y,{counters:s.shapeProbe,t:a}),(0,t.jsx)(Z,{counters:s.globalPoll,t:a})]})]}),e[21]=i,e[22]=k,e[23]=s,e[24]=a,e[25]=N):N=e[25];let b;return e[26]!==y||e[27]!==h||e[28]!==x||e[29]!==N?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[y,h,x,N]}),e[26]=y,e[27]=h,e[28]=x,e[29]=N,e[30]=b):b=e[30],b},"me");function ee(c){return(0,t.jsxs)(K,{"data-testid":"fanout-topic-row",children:[(0,t.jsx)(D,{className:"font-mono text-xs",children:c.topic}),(0,t.jsx)(D,{children:(0,t.jsx)($,{variant:"outline",children:c.kind})}),(0,t.jsx)(D,{className:"text-right font-medium tabular-nums",children:c.subscribers})]},`${c.kind}:${c.topic}`)}S(ee,"Y");export{pe as default};