@lunora/studio 1.0.0-alpha.361 → 1.0.0-alpha.363

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 (327) hide show
  1. package/dist/index.d.mts +4 -1
  2. package/dist/index.d.ts +4 -1
  3. package/dist/index.mjs +1 -1
  4. package/dist/mount.mjs +1 -1
  5. package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -1
  6. package/dist/packem_chunks/ApiTab.mjs +1 -1
  7. package/dist/packem_chunks/AuditPanel.mjs +1 -1
  8. package/dist/packem_chunks/ExportImportPanel.mjs +1 -1
  9. package/dist/packem_chunks/FileBrowser.mjs +1 -1
  10. package/dist/packem_chunks/FunctionRunner.mjs +1 -1
  11. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -1
  12. package/dist/packem_chunks/HealthPanel.mjs +1 -1
  13. package/dist/packem_chunks/InsightsPanel.mjs +1 -1
  14. package/dist/packem_chunks/LogsPanel.mjs +1 -1
  15. package/dist/packem_chunks/MailPanel.mjs +1 -1
  16. package/dist/packem_chunks/MetricsPanel.mjs +1 -1
  17. package/dist/packem_chunks/NotificationsPanel.mjs +1 -1
  18. package/dist/packem_chunks/PitrPanel.mjs +1 -1
  19. package/dist/packem_chunks/SchemaViewer.mjs +1 -1
  20. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -1
  21. package/dist/packem_chunks/SettingsPanel.mjs +1 -1
  22. package/dist/packem_chunks/SqlEditorPanel.mjs +24 -9
  23. package/dist/packem_chunks/TableEditor.mjs +1 -1
  24. package/dist/packem_chunks/agents-panel.mjs +1 -1
  25. package/dist/packem_chunks/ai-knowledge.mjs +1 -0
  26. package/dist/packem_chunks/ai-usage-panel.mjs +1 -1
  27. package/dist/packem_chunks/assistant-panel.mjs +3 -0
  28. package/dist/packem_chunks/auth-audit-panel.mjs +1 -1
  29. package/dist/packem_chunks/containers-panel.mjs +1 -1
  30. package/dist/packem_chunks/dashboards-panel.mjs +1 -1
  31. package/dist/packem_chunks/evals-panel.mjs +1 -1
  32. package/dist/packem_chunks/fanout-panel.mjs +1 -1
  33. package/dist/packem_chunks/flags-panel.mjs +1 -1
  34. package/dist/packem_chunks/issues-panel.mjs +1 -1
  35. package/dist/packem_chunks/kv-browser.mjs +1 -1
  36. package/dist/packem_chunks/log-drains-panel.mjs +1 -1
  37. package/dist/packem_chunks/migrations-route.mjs +1 -1
  38. package/dist/packem_chunks/payments-panel.mjs +1 -1
  39. package/dist/packem_chunks/permissions-panel.mjs +1 -1
  40. package/dist/packem_chunks/privacy-requests-panel.mjs +1 -1
  41. package/dist/packem_chunks/queues-panel.mjs +1 -1
  42. package/dist/packem_chunks/reactors-panel.mjs +1 -1
  43. package/dist/packem_chunks/rls-panel.mjs +1 -1
  44. package/dist/packem_chunks/schedule-panel.mjs +1 -1
  45. package/dist/packem_chunks/storage-rules-panel.mjs +1 -1
  46. package/dist/packem_chunks/subscriptions-panel.mjs +1 -1
  47. package/dist/packem_chunks/traces-panel.mjs +1 -1
  48. package/dist/packem_chunks/workflows-panel.mjs +1 -1
  49. package/dist/packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs +1 -0
  50. package/dist/packem_shared/{ApiDocsPanel-DD2Uns6b.mjs → ApiDocsPanel-B9S9l1Ce.mjs} +1 -1
  51. package/dist/packem_shared/{DataBrowser-CVRWnNWu.mjs → DataBrowser-Dm-jhIUP.mjs} +2 -2
  52. package/dist/packem_shared/{GlobalDataBrowser-DC47T6Zl.mjs → GlobalDataBrowser-C1Y8GUhe.mjs} +1 -1
  53. package/dist/packem_shared/{HomePanel-D12HxHQo.mjs → HomePanel-B5ytwPIo.mjs} +1 -1
  54. package/dist/packem_shared/{MigrationsPanel-DMkxSXNl.mjs → MigrationsPanel-CwLikxDT.mjs} +1 -1
  55. package/dist/packem_shared/Studio-B89ZNMOD.mjs +1 -0
  56. package/dist/packem_shared/{StudioApp-isdWpF9P.mjs → StudioApp-C9l1a3A8.mjs} +1 -1
  57. package/dist/packem_shared/advisor-view-CzieqKMe.mjs +5 -0
  58. package/dist/packem_shared/assistant-provider-Bp72uWsq.mjs +1 -0
  59. package/dist/packem_shared/assistant-reason-D6EwMCxT.mjs +1 -0
  60. package/dist/packem_shared/{cf-links-CBJ5SywP.mjs → cf-links-C4DVTr8A.mjs} +1 -1
  61. package/dist/packem_shared/error-alert-DKXm5h19.mjs +6 -0
  62. package/dist/packem_shared/{home-panel-CDVTuTF8.mjs → home-panel-5fGktYeD.mjs} +1 -1
  63. package/dist/packem_shared/recording-client-z4CBi0y8.mjs +1 -0
  64. package/dist/packem_shared/studio-gZfpz1wC.mjs +2 -0
  65. package/dist/packem_shared/{table-list-sidebar-CNadcIgG.mjs → table-list-sidebar-kpHaDWjy.mjs} +1 -1
  66. package/dist/packem_shared/use-assistant-rpc-GCUK2zPa.mjs +1 -0
  67. package/dist/standalone/chunk-2DT3QG6Q.js +1 -0
  68. package/dist/standalone/chunk-2EB7FN5S.js +1 -0
  69. package/dist/standalone/chunk-2H6VLY2M.js +1 -0
  70. package/dist/standalone/chunk-2NGKUO32.js +1 -0
  71. package/dist/standalone/chunk-2SNHKJXK.js +1 -0
  72. package/dist/standalone/chunk-2W4UO5BC.js +1 -0
  73. package/dist/standalone/chunk-32V7XGNC.js +1 -0
  74. package/dist/standalone/{chunk-SLIDAWNX.js → chunk-3D67ZJRW.js} +1 -1
  75. package/dist/standalone/chunk-3X3NXJBR.js +1 -0
  76. package/dist/standalone/chunk-4EPW63HS.js +1 -0
  77. package/dist/standalone/chunk-4L55URI5.js +2 -0
  78. package/dist/standalone/chunk-4N76XUNG.js +1 -0
  79. package/dist/standalone/{chunk-WS36BO4R.js → chunk-4NKJV7YX.js} +1 -1
  80. package/dist/standalone/chunk-4PI2OSSP.js +1 -0
  81. package/dist/standalone/chunk-53XKGQEE.js +1 -0
  82. package/dist/standalone/chunk-5GYHGDIF.js +8 -0
  83. package/dist/standalone/chunk-5PEAXTYQ.js +1 -0
  84. package/dist/standalone/chunk-5QUTVSHM.js +1 -0
  85. package/dist/standalone/{chunk-BYOGQ2IV.js → chunk-5RX5CQSU.js} +2 -2
  86. package/dist/standalone/{chunk-O2NMPIV2.js → chunk-5WNGRT7N.js} +1 -1
  87. package/dist/standalone/chunk-5Z2U4KBN.js +1 -0
  88. package/dist/standalone/chunk-66BMMNUR.js +1 -0
  89. package/dist/standalone/chunk-6FPV3EK2.js +1 -0
  90. package/dist/standalone/chunk-6G3E4PJ2.js +1 -0
  91. package/dist/standalone/chunk-75TRPM7O.js +1 -0
  92. package/dist/standalone/chunk-7MLX5CGD.js +1 -0
  93. package/dist/standalone/chunk-7QEZ2SFW.js +1 -0
  94. package/dist/standalone/chunk-7TQ7BZ67.js +1 -0
  95. package/dist/standalone/chunk-A2Q3TGIQ.js +1 -0
  96. package/dist/standalone/chunk-AD5J2ANS.js +1 -0
  97. package/dist/standalone/chunk-ALR4VAUE.js +1 -0
  98. package/dist/standalone/chunk-AXE2SDRU.js +1 -0
  99. package/dist/standalone/chunk-AZIKM5BA.js +1 -0
  100. package/dist/standalone/chunk-BAEIW3YS.js +1 -0
  101. package/dist/standalone/chunk-BBDTJG2K.js +1 -0
  102. package/dist/standalone/chunk-BCUOQNI2.js +1 -0
  103. package/dist/standalone/chunk-BG2CJOVS.js +1 -0
  104. package/dist/standalone/chunk-BI6MZHZJ.js +1 -0
  105. package/dist/standalone/chunk-BKI3JMXQ.js +1 -0
  106. package/dist/standalone/chunk-CKEQX655.js +1 -0
  107. package/dist/standalone/{chunk-DX55P3KZ.js → chunk-CL3JOU6F.js} +1 -1
  108. package/dist/standalone/chunk-CP7QNLR4.js +1 -0
  109. package/dist/standalone/chunk-CVSIFPI5.js +1 -0
  110. package/dist/standalone/chunk-D57B4MFK.js +1 -0
  111. package/dist/standalone/chunk-D65UVZIA.js +1 -0
  112. package/dist/standalone/{chunk-DBVJ5VLI.js → chunk-DA2CAFXI.js} +1 -1
  113. package/dist/standalone/chunk-DB6QX4X6.js +1 -0
  114. package/dist/standalone/chunk-DZFXH55R.js +1 -0
  115. package/dist/standalone/chunk-ELSQ4FVH.js +1 -0
  116. package/dist/standalone/chunk-EPWCW2DF.js +1 -0
  117. package/dist/standalone/chunk-FHLODLBC.js +1 -0
  118. package/dist/standalone/chunk-FJLRSFTE.js +1 -0
  119. package/dist/standalone/{chunk-3FS22LNI.js → chunk-FVCBNFQW.js} +3 -3
  120. package/dist/standalone/{chunk-VEWQWS3J.js → chunk-FWM5Z6CH.js} +1 -1
  121. package/dist/standalone/chunk-GJXCPZDN.js +1 -0
  122. package/dist/standalone/chunk-GNI37YCV.js +33 -0
  123. package/dist/standalone/chunk-GVQPNM3T.js +3 -0
  124. package/dist/standalone/chunk-GWNGVKLG.js +1 -0
  125. package/dist/standalone/chunk-GXTSE66Z.js +1 -0
  126. package/dist/standalone/chunk-H3EIPYRZ.js +1 -0
  127. package/dist/standalone/chunk-H5TMLWIS.js +1 -0
  128. package/dist/standalone/{chunk-XIRKBJPD.js → chunk-HBG6SSE2.js} +5 -5
  129. package/dist/standalone/chunk-HC2B7SXW.js +1 -0
  130. package/dist/standalone/chunk-HCOF7HOM.js +1 -0
  131. package/dist/standalone/chunk-HGCOTYPV.js +1 -0
  132. package/dist/standalone/chunk-HLHMHCXS.js +1 -0
  133. package/dist/standalone/chunk-HSF2DCJ2.js +30 -0
  134. package/dist/standalone/chunk-HZDLUAWS.js +1 -0
  135. package/dist/standalone/{chunk-3PAYDWHN.js → chunk-I3SSF2T6.js} +2 -2
  136. package/dist/standalone/chunk-I5QX75DE.js +1 -0
  137. package/dist/standalone/chunk-ICHZ2IBL.js +1 -0
  138. package/dist/standalone/{chunk-7ZIYHKLX.js → chunk-IG5VD7R7.js} +3 -3
  139. package/dist/standalone/{chunk-SU5DTRGK.js → chunk-IHGRWY3Y.js} +1 -1
  140. package/dist/standalone/chunk-J45HAKBU.js +1 -0
  141. package/dist/standalone/chunk-J4PQAVOF.js +1 -0
  142. package/dist/standalone/chunk-JD6PRRFO.js +1 -0
  143. package/dist/standalone/chunk-JOPNP4EO.js +1 -0
  144. package/dist/standalone/chunk-JVP3TR3A.js +1 -0
  145. package/dist/standalone/chunk-KGLIQIZU.js +1 -0
  146. package/dist/standalone/{chunk-ONWGX5Y4.js → chunk-KH6OXCG3.js} +1 -1
  147. package/dist/standalone/chunk-KKMQUBYH.js +1 -0
  148. package/dist/standalone/chunk-L2FYX4FN.js +1 -0
  149. package/dist/standalone/chunk-LDHJRHPZ.js +1 -0
  150. package/dist/standalone/chunk-LSEUUZN4.js +1 -0
  151. package/dist/standalone/chunk-MNYDT3RH.js +1 -0
  152. package/dist/standalone/chunk-MT4ICMXJ.js +1 -0
  153. package/dist/standalone/chunk-MXJTD2OX.js +1 -0
  154. package/dist/standalone/chunk-NGZNXNRD.js +1 -0
  155. package/dist/standalone/chunk-O3AZ7JKE.js +1 -0
  156. package/dist/standalone/chunk-OK2QU2EV.js +1 -0
  157. package/dist/standalone/{chunk-IH2CJZF2.js → chunk-ONTGYVAN.js} +1 -1
  158. package/dist/standalone/chunk-OWRKSQPE.js +1 -0
  159. package/dist/standalone/chunk-OZAOWE7T.js +1 -0
  160. package/dist/standalone/chunk-P5EVJEGC.js +1 -0
  161. package/dist/standalone/chunk-PDBW6GTJ.js +1 -0
  162. package/dist/standalone/chunk-PJUVJTDR.js +1 -0
  163. package/dist/standalone/chunk-Q3IA6HPX.js +1 -0
  164. package/dist/standalone/chunk-QAOZXPLU.js +1 -0
  165. package/dist/standalone/chunk-QKUVJIRX.js +1 -0
  166. package/dist/standalone/chunk-QNM2J7MG.js +1 -0
  167. package/dist/standalone/chunk-QRA7AKYO.js +1 -0
  168. package/dist/standalone/chunk-RBIVXSXT.js +1 -0
  169. package/dist/standalone/chunk-RCXNYW7P.js +1 -0
  170. package/dist/standalone/{chunk-TDVDZ7XQ.js → chunk-RIAOZECW.js} +1 -1
  171. package/dist/standalone/{chunk-LUHXNZI4.js → chunk-RTS5G3ET.js} +1 -1
  172. package/dist/standalone/chunk-S36FVTKK.js +1 -0
  173. package/dist/standalone/chunk-SDDEOSQB.js +1 -0
  174. package/dist/standalone/chunk-SHHGIT7M.js +7 -0
  175. package/dist/standalone/chunk-SR6CPTRT.js +1 -0
  176. package/dist/standalone/chunk-SVQWZPO4.js +1 -0
  177. package/dist/standalone/chunk-T3ZCW3RG.js +1 -0
  178. package/dist/standalone/chunk-TEMI7MVE.js +1 -0
  179. package/dist/standalone/chunk-TKBTZX4K.js +1 -0
  180. package/dist/standalone/chunk-TW4O2BA5.js +159 -0
  181. package/dist/standalone/chunk-U5MPNEM2.js +1 -0
  182. package/dist/standalone/chunk-UD5REVU2.js +1 -0
  183. package/dist/standalone/chunk-ULQNADMJ.js +1 -0
  184. package/dist/standalone/chunk-UPPNZ6MI.js +1 -0
  185. package/dist/standalone/{chunk-PQH2LSJX.js → chunk-UQA2AJGI.js} +1 -1
  186. package/dist/standalone/chunk-UTQLJKHH.js +1 -0
  187. package/dist/standalone/chunk-UVG3ZISC.js +1 -0
  188. package/dist/standalone/chunk-UXBNXITB.js +1 -0
  189. package/dist/standalone/chunk-UZ2ZXB74.js +1 -0
  190. package/dist/standalone/chunk-V3BE427M.js +1 -0
  191. package/dist/standalone/chunk-VQDTA4P6.js +1 -0
  192. package/dist/standalone/chunk-W4LJQYCI.js +1 -0
  193. package/dist/standalone/chunk-WLHQ4FKC.js +1 -0
  194. package/dist/standalone/chunk-XPFVUAPX.js +1 -0
  195. package/dist/standalone/{chunk-SYGCASPT.js → chunk-Y2YLTUMD.js} +1 -1
  196. package/dist/standalone/chunk-Y3IGTWUE.js +1 -0
  197. package/dist/standalone/chunk-Y64STA6O.js +1 -0
  198. package/dist/standalone/chunk-YEVTA35E.js +1 -0
  199. package/dist/standalone/chunk-YEXTJUKQ.js +6 -0
  200. package/dist/standalone/chunk-YFTPHGS2.js +1 -0
  201. package/dist/standalone/{chunk-R36QXQZX.js → chunk-YORPLSI5.js} +1 -1
  202. package/dist/standalone/chunk-Z64BZNPS.js +1 -0
  203. package/dist/standalone/chunk-Z6VILGGP.js +5 -0
  204. package/dist/standalone/chunk-ZBOB33BA.js +1 -0
  205. package/dist/standalone/{chunk-5R2YO7HF.js → chunk-ZOKSVUID.js} +4 -4
  206. package/dist/standalone/{chunk-H7HZ42JY.js → chunk-ZPQBVYNN.js} +1 -1
  207. package/dist/standalone/chunk-ZSWW2UGP.js +1 -0
  208. package/dist/standalone/studio.js +2 -2
  209. package/dist/styles.css +1 -1
  210. package/package.json +7 -6
  211. package/dist/packem_shared/ADMIN_FUNCTIONS-4aGsMs95.mjs +0 -1
  212. package/dist/packem_shared/Studio-MA8kKZLu.mjs +0 -1
  213. package/dist/packem_shared/advisor-view-tBumWci_.mjs +0 -1
  214. package/dist/packem_shared/error-alert-C0R39DO1.mjs +0 -1
  215. package/dist/packem_shared/recording-client-DAipTA_n.mjs +0 -1
  216. package/dist/packem_shared/studio-UhUrPz5J.mjs +0 -2
  217. package/dist/packem_shared/use-sql-assistant-rZPs3LC3.mjs +0 -1
  218. package/dist/standalone/chunk-2AH4ABE5.js +0 -1
  219. package/dist/standalone/chunk-2G57ENH5.js +0 -1
  220. package/dist/standalone/chunk-3GXPALXG.js +0 -1
  221. package/dist/standalone/chunk-3GYLOE4V.js +0 -1
  222. package/dist/standalone/chunk-473JK2PQ.js +0 -1
  223. package/dist/standalone/chunk-4C4THJUD.js +0 -1
  224. package/dist/standalone/chunk-4DAKKAK7.js +0 -1
  225. package/dist/standalone/chunk-4M57OYFX.js +0 -1
  226. package/dist/standalone/chunk-4SQBAPY6.js +0 -1
  227. package/dist/standalone/chunk-5DNGK3NT.js +0 -1
  228. package/dist/standalone/chunk-5GIQ6C5N.js +0 -1
  229. package/dist/standalone/chunk-5WJG7FMH.js +0 -1
  230. package/dist/standalone/chunk-63KDHS3H.js +0 -1
  231. package/dist/standalone/chunk-6B6ARRMI.js +0 -1
  232. package/dist/standalone/chunk-6LMO2D54.js +0 -1
  233. package/dist/standalone/chunk-6M7FLLMT.js +0 -1
  234. package/dist/standalone/chunk-6QEXGYWH.js +0 -1
  235. package/dist/standalone/chunk-6UTZXEW3.js +0 -1
  236. package/dist/standalone/chunk-6VAY6L4J.js +0 -1
  237. package/dist/standalone/chunk-7PADVGQX.js +0 -1
  238. package/dist/standalone/chunk-7RGYCU6F.js +0 -1
  239. package/dist/standalone/chunk-7UM5ROG6.js +0 -1
  240. package/dist/standalone/chunk-A566HCBX.js +0 -1
  241. package/dist/standalone/chunk-A5JISKHE.js +0 -1
  242. package/dist/standalone/chunk-ADNRFCMZ.js +0 -1
  243. package/dist/standalone/chunk-AP4PC2M4.js +0 -1
  244. package/dist/standalone/chunk-BFE2DRP6.js +0 -33
  245. package/dist/standalone/chunk-BPEB4KFE.js +0 -1
  246. package/dist/standalone/chunk-BVX45MU5.js +0 -7
  247. package/dist/standalone/chunk-C6GN7ZXJ.js +0 -1
  248. package/dist/standalone/chunk-CL2VZNDI.js +0 -1
  249. package/dist/standalone/chunk-CNA3TVUK.js +0 -1
  250. package/dist/standalone/chunk-CZ6HBDIL.js +0 -1
  251. package/dist/standalone/chunk-D6S7MXW4.js +0 -1
  252. package/dist/standalone/chunk-E26OT26O.js +0 -1
  253. package/dist/standalone/chunk-FCAXVYAX.js +0 -1
  254. package/dist/standalone/chunk-FXPAJDES.js +0 -1
  255. package/dist/standalone/chunk-HHRYM6UW.js +0 -1
  256. package/dist/standalone/chunk-HPRF5LMA.js +0 -1
  257. package/dist/standalone/chunk-IB22LETR.js +0 -1
  258. package/dist/standalone/chunk-IBJVVHV5.js +0 -1
  259. package/dist/standalone/chunk-IENQRRQT.js +0 -1
  260. package/dist/standalone/chunk-IQ4TTHQT.js +0 -1
  261. package/dist/standalone/chunk-ITH5LRWM.js +0 -1
  262. package/dist/standalone/chunk-J6VFG6M5.js +0 -1
  263. package/dist/standalone/chunk-JSDKOE4U.js +0 -1
  264. package/dist/standalone/chunk-JTGGWF7R.js +0 -1
  265. package/dist/standalone/chunk-JZD7ZN3F.js +0 -1
  266. package/dist/standalone/chunk-K3CWB3AM.js +0 -1
  267. package/dist/standalone/chunk-KNFB3FGW.js +0 -1
  268. package/dist/standalone/chunk-KNXWDE4N.js +0 -1
  269. package/dist/standalone/chunk-KRPXOSBL.js +0 -1
  270. package/dist/standalone/chunk-KRY7BYHT.js +0 -1
  271. package/dist/standalone/chunk-KYAG2YMF.js +0 -1
  272. package/dist/standalone/chunk-KZCEJFZF.js +0 -1
  273. package/dist/standalone/chunk-KZILJQX3.js +0 -8
  274. package/dist/standalone/chunk-LEYUH5TS.js +0 -1
  275. package/dist/standalone/chunk-LFM672WN.js +0 -1
  276. package/dist/standalone/chunk-LIGOLZND.js +0 -1
  277. package/dist/standalone/chunk-LPU6YTSU.js +0 -1
  278. package/dist/standalone/chunk-MWJC3S62.js +0 -1
  279. package/dist/standalone/chunk-NP2AQOLE.js +0 -1
  280. package/dist/standalone/chunk-NVKLYDOH.js +0 -1
  281. package/dist/standalone/chunk-O2X2XYCM.js +0 -1
  282. package/dist/standalone/chunk-O3MDWYXF.js +0 -1
  283. package/dist/standalone/chunk-ONG4JEZD.js +0 -1
  284. package/dist/standalone/chunk-OS26JXYA.js +0 -1
  285. package/dist/standalone/chunk-OXFKZ4BM.js +0 -1
  286. package/dist/standalone/chunk-PGTEGUAB.js +0 -1
  287. package/dist/standalone/chunk-PTBUWRBY.js +0 -1
  288. package/dist/standalone/chunk-Q6HA3L2H.js +0 -1
  289. package/dist/standalone/chunk-QGV5ARD2.js +0 -1
  290. package/dist/standalone/chunk-QWRK4ESB.js +0 -1
  291. package/dist/standalone/chunk-RL2ITK2N.js +0 -1
  292. package/dist/standalone/chunk-RTJO3AR4.js +0 -1
  293. package/dist/standalone/chunk-SFY646MC.js +0 -1
  294. package/dist/standalone/chunk-T5UMHPAB.js +0 -1
  295. package/dist/standalone/chunk-T6HV2FQP.js +0 -2
  296. package/dist/standalone/chunk-T7ZKNNGX.js +0 -1
  297. package/dist/standalone/chunk-TCYPNSTV.js +0 -1
  298. package/dist/standalone/chunk-TQM6XHBA.js +0 -1
  299. package/dist/standalone/chunk-TRMWBRRU.js +0 -1
  300. package/dist/standalone/chunk-TW7KJSMR.js +0 -15
  301. package/dist/standalone/chunk-TYD3V4NB.js +0 -1
  302. package/dist/standalone/chunk-TZKLK52W.js +0 -1
  303. package/dist/standalone/chunk-U4RXQSQ7.js +0 -1
  304. package/dist/standalone/chunk-UNZ2UBVL.js +0 -1
  305. package/dist/standalone/chunk-VJRNOSRY.js +0 -1
  306. package/dist/standalone/chunk-W2BCSK5S.js +0 -1
  307. package/dist/standalone/chunk-W7MRISE3.js +0 -1
  308. package/dist/standalone/chunk-WM72PRE3.js +0 -1
  309. package/dist/standalone/chunk-X4WHMCOZ.js +0 -1
  310. package/dist/standalone/chunk-X74GEPSG.js +0 -1
  311. package/dist/standalone/chunk-XKPD4SFN.js +0 -1
  312. package/dist/standalone/chunk-XMSNLMWU.js +0 -1
  313. package/dist/standalone/chunk-XOPFDWXX.js +0 -1
  314. package/dist/standalone/chunk-XQLOVFPP.js +0 -1
  315. package/dist/standalone/chunk-XSHYZPGF.js +0 -1
  316. package/dist/standalone/chunk-XST3UEHU.js +0 -1
  317. package/dist/standalone/chunk-XYR5NST4.js +0 -1
  318. package/dist/standalone/chunk-Y74LIFSL.js +0 -1
  319. package/dist/standalone/chunk-YHTHRYP5.js +0 -1
  320. package/dist/standalone/chunk-YMEKCV27.js +0 -1
  321. package/dist/standalone/chunk-Z5EV64KS.js +0 -1
  322. package/dist/standalone/chunk-ZBON5T5A.js +0 -1
  323. package/dist/standalone/chunk-ZGSL4DPP.js +0 -1
  324. package/dist/standalone/chunk-ZOQTXWPK.js +0 -1
  325. package/dist/standalone/chunk-ZTOREMGH.js +0 -1
  326. package/dist/standalone/chunk-ZZ5GICTF.js +0 -1
  327. /package/dist/standalone/{chunk-UYEZR3BI.js → chunk-P6VNMPWR.js} +0 -0
@@ -1,3 +1,3 @@
1
- import{D as xe,I as Ge,J as Ce,K as Qe,L as Ze,M as et,N as tt,b as Q,d as He,f as qe,l as Xe}from"./chunk-W7MRISE3.js";import{a as O,c as L,i as Je,w as ve}from"./chunk-ZBON5T5A.js";import{a as $e,c as be,d as ie,g as M,i as ge,j as J}from"./chunk-4C4THJUD.js";import{h as ze}from"./chunk-BFE2DRP6.js";import{a as t,c as Mt,d as E,e as k,f as St,g as ae}from"./chunk-OXFKZ4BM.js";var ht=E(St(),1);var Et=E(k(),1);var Te={};Mt(Te,{Control:()=>Ct,Description:()=>vt,Error:()=>bt,Item:()=>It,Label:()=>Rt,Root:()=>pt,Validity:()=>yt});var P=E(k(),1);var Fe=E(k(),1);var rt="data-valid",ot="data-invalid";var se={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ot={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},it={disabled:!1,...Ot},H={valid(r){return r===null?null:r?{[rt]:""}:{[ot]:""}}};var wt={invalid:void 0,name:void 0,validityData:{state:se,errors:[],error:"",value:"",initialValue:null},setValidityData:M,disabled:void 0,setTouched:M,setDirty:M,setFilled:M,setFocused:M,validationMode:"onSubmit",shouldValidateOnChange:t(()=>!1,"shouldValidateOnChange"),state:it,registerFieldControl:M,validation:{getValidationProps:t((r,e=ge)=>e,"getValidationProps"),inputRef:{current:null},registeredInputs:new Map,registerInput:M,getInputControl:t(()=>null,"getInputControl"),commit:t(async()=>{},"commit"),change:M}},Oe=Fe.createContext(wt);function Y(r=!0){let e=Fe.useContext(Oe);if(e.setValidityData===M&&!r)throw new Error(be(28));return e}t(Y,"useFieldRootContext");var ye=E(k(),1);var _t=ye.createContext(void 0);function nt(r=!1){let e=ye.useContext(_t);if(!e&&!r)throw new Error(be(86));return e}t(nt,"useFieldsetRootContext");var Ie=E(k(),1);var Pt=Ie.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:M,validationMode:"onSubmit",submitCountRef:{current:0}});function Z(){return Ie.useContext(Pt)}t(Z,"useFormContext");var ne=E(k(),1);var Ee=E(k(),1);var we=Ee.createContext({controlId:void 0,registerControlId:M,resetControlId:M,labelId:void 0,setLabelId:M,messageIds:[],setMessageIds:M,getDescriptionProps:t(r=>r,"getDescriptionProps")});function U(){return Ee.useContext(we)}t(U,"useLabelableContext");var at=E(ae(),1);var Ve=t(function(e){let o=Q(),[s,c]=ne.useState(o),[d,l]=ne.useState(),[R,f]=ne.useState([]),u=s===void 0?o:s,a=ie(()=>new Map),{messageIds:b}=U(),C=L((D,I)=>{let x=a.current;I===void 0?x.delete(D):x.set(D,I),c(w=>{if(x.size===0)return w;let A;for(let i of x.values()){if(i===w)return w;A===void 0&&(A=i)}return A})}),g=L(()=>{a.current.size===0&&c(o)}),v=ne.useCallback(D=>{let I=D["aria-describedby"]?D["aria-describedby"].split(" "):[];return I.push(...b,...R),{...D,"aria-describedby":Array.from(new Set(I)).join(" ")||void 0}},[b,R]),N=ne.useMemo(()=>({controlId:u,registerControlId:C,resetControlId:g,labelId:d,setLabelId:l,messageIds:R,setMessageIds:f,getDescriptionProps:v}),[u,C,g,d,l,R,f,v]);return(0,at.jsx)(we.Provider,{value:N,children:e.children})},"LabelableProvider");var _e=E(k(),1);function st(r={}){let{id:e,enabled:o=!0}=r,{controlId:s,registerControlId:c,resetControlId:d}=U(),l=Q(),R=ie(()=>Symbol()),f=_e.useRef(!1),u=_e.useRef(!1),a=L(()=>{!f.current||c===M||(f.current=!1,c(R.current,void 0))});return O(()=>{if(!o||c===M){a();return}let b;if(e!==void 0)u.current=!0,b=e;else if(u.current)b=l;else{d();return}if(b===void 0){a();return}f.current=!0,c(R.current,b)},[e,o,c,d,l,R,a]),O(()=>a,[a]),(o?s:void 0)??e??l}t(st,"useLabelableId");function lt(r,e){let o=Q(r);return O(()=>(e(o),()=>{e(s=>s===o?void 0:s)}),[o,e]),o}t(lt,"useRegisteredLabelId");function dt(r={}){let{id:e,fallbackControlId:o,native:s=!1,setLabelId:c,focusControl:d}=r,{controlId:l,setLabelId:R}=U(),f=L(g=>{R(g),c?.(g)}),u=lt(e,f),a=l??o;function b(g){if(d){d(g,a);return}if(!a)return;let v=ve(g.currentTarget).getElementById(a);Je(v)&&At(v)}t(b,"focusControl");function C(g){qe(g.nativeEvent)?.closest("button,input,select,textarea")||(!g.defaultPrevented&&g.detail>1&&g.preventDefault(),!s&&b(g))}return t(C,"handleInteraction"),s?{id:u,htmlFor:a,onMouseDown:C}:{id:u,onClick:C,onPointerDown(g){g.preventDefault()}}}t(dt,"useLabel");function At(r){r.focus({focusVisible:!0})}t(At,"focusElementWithVisible");var oe=E(k(),1);function le(r,e){return{...r,state:{...r.state,valid:!e&&r.state.valid}}}t(le,"getCombinedFieldValidityData");var Pe=Object.keys(se);function kt(r,e){return r.matches(":disabled")?!1:!e||r.form===e?!0:r.form===null&&!r.hasAttribute("form")}t(kt,"isEligibleInput");function ut(r,e){let o=null;for(let s of r.keys())if(kt(s,e)){if(!s.validity.valid)return s;o??=s}return o}t(ut,"findRepresentativeInput");function ct(r){return{...se,valid:!r,customError:r}}t(ct,"makeState");function Ae(r){return r&&r.validationMessage?[r.validationMessage]:[]}t(Ae,"getNativeErrors");function ft(r){let{elementRef:e,formRef:o}=Z(),{setValidityData:s,validate:c,validityData:d,validationDebounceTime:l,invalid:R,markedDirtyRef:f,state:u,shouldValidateOnChange:a,validationMode:b,registeredFieldIdRef:C}=r,{controlId:g,getDescriptionProps:v}=U(),N=xe(),D=oe.useRef(null),I=ie(()=>new Map).current,x=oe.useRef(0),w=oe.useRef(null),A=oe.useCallback((S,j)=>(I.set(S,j),()=>{I.delete(S)}),[I]),i=L(()=>{let S=ut(I,e.current);return S&&I.get(S)?.controlRef.current||null}),V=L(async(S,j=!1)=>{x.current+=1;let h=x.current;function $(n,m=R){let p=C.current??g;if(p==null)return;let y=o.current.fields.get(p);if(!y)return;let W=le(n,m);o.current.fields.set(p,{...y,validityData:W})}t($,"updateRegisteredFieldValidity");function ee(n,m){let p=n.valid===!1?m:[];return{value:S,state:n,error:p[0]??"",errors:p,initialValue:d.initialValue}}t(ee,"makeValidityData");function te(n,m){let p=n.validity.customError?n.validationMessage:"",y=m.replace(/\r\n?/g,`
1
+ import{D as xe,I as Ge,J as Ce,K as Qe,L as Ze,M as et,N as tt,b as Q,d as He,f as qe,l as Xe}from"./chunk-OWRKSQPE.js";import{a as O,c as L,i as Je,w as ve}from"./chunk-UD5REVU2.js";import{a as $e,c as be,d as ie,g as M,i as ge,j as J}from"./chunk-T3ZCW3RG.js";import{x as ze}from"./chunk-GNI37YCV.js";import{a as St}from"./chunk-GWNGVKLG.js";import{a as k,b as ae}from"./chunk-6G3E4PJ2.js";import{a as t,c as Mt,d as E}from"./chunk-5PEAXTYQ.js";var ht=E(St(),1);var Et=E(k(),1);var Te={};Mt(Te,{Control:()=>Ct,Description:()=>vt,Error:()=>bt,Item:()=>It,Label:()=>Rt,Root:()=>pt,Validity:()=>yt});var P=E(k(),1);var Fe=E(k(),1);var rt="data-valid",ot="data-invalid";var se={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ot={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},it={disabled:!1,...Ot},H={valid(r){return r===null?null:r?{[rt]:""}:{[ot]:""}}};var wt={invalid:void 0,name:void 0,validityData:{state:se,errors:[],error:"",value:"",initialValue:null},setValidityData:M,disabled:void 0,setTouched:M,setDirty:M,setFilled:M,setFocused:M,validationMode:"onSubmit",shouldValidateOnChange:t(()=>!1,"shouldValidateOnChange"),state:it,registerFieldControl:M,validation:{getValidationProps:t((r,e=ge)=>e,"getValidationProps"),inputRef:{current:null},registeredInputs:new Map,registerInput:M,getInputControl:t(()=>null,"getInputControl"),commit:t(async()=>{},"commit"),change:M}},Oe=Fe.createContext(wt);function Y(r=!0){let e=Fe.useContext(Oe);if(e.setValidityData===M&&!r)throw new Error(be(28));return e}t(Y,"useFieldRootContext");var ye=E(k(),1);var _t=ye.createContext(void 0);function nt(r=!1){let e=ye.useContext(_t);if(!e&&!r)throw new Error(be(86));return e}t(nt,"useFieldsetRootContext");var Ie=E(k(),1);var Pt=Ie.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:M,validationMode:"onSubmit",submitCountRef:{current:0}});function Z(){return Ie.useContext(Pt)}t(Z,"useFormContext");var ne=E(k(),1);var Ee=E(k(),1);var we=Ee.createContext({controlId:void 0,registerControlId:M,resetControlId:M,labelId:void 0,setLabelId:M,messageIds:[],setMessageIds:M,getDescriptionProps:t(r=>r,"getDescriptionProps")});function U(){return Ee.useContext(we)}t(U,"useLabelableContext");var at=E(ae(),1);var Ve=t(function(e){let o=Q(),[s,c]=ne.useState(o),[d,l]=ne.useState(),[R,f]=ne.useState([]),u=s===void 0?o:s,a=ie(()=>new Map),{messageIds:b}=U(),C=L((D,I)=>{let x=a.current;I===void 0?x.delete(D):x.set(D,I),c(w=>{if(x.size===0)return w;let A;for(let i of x.values()){if(i===w)return w;A===void 0&&(A=i)}return A})}),g=L(()=>{a.current.size===0&&c(o)}),v=ne.useCallback(D=>{let I=D["aria-describedby"]?D["aria-describedby"].split(" "):[];return I.push(...b,...R),{...D,"aria-describedby":Array.from(new Set(I)).join(" ")||void 0}},[b,R]),N=ne.useMemo(()=>({controlId:u,registerControlId:C,resetControlId:g,labelId:d,setLabelId:l,messageIds:R,setMessageIds:f,getDescriptionProps:v}),[u,C,g,d,l,R,f,v]);return(0,at.jsx)(we.Provider,{value:N,children:e.children})},"LabelableProvider");var _e=E(k(),1);function st(r={}){let{id:e,enabled:o=!0}=r,{controlId:s,registerControlId:c,resetControlId:d}=U(),l=Q(),R=ie(()=>Symbol()),f=_e.useRef(!1),u=_e.useRef(!1),a=L(()=>{!f.current||c===M||(f.current=!1,c(R.current,void 0))});return O(()=>{if(!o||c===M){a();return}let b;if(e!==void 0)u.current=!0,b=e;else if(u.current)b=l;else{d();return}if(b===void 0){a();return}f.current=!0,c(R.current,b)},[e,o,c,d,l,R,a]),O(()=>a,[a]),(o?s:void 0)??e??l}t(st,"useLabelableId");function lt(r,e){let o=Q(r);return O(()=>(e(o),()=>{e(s=>s===o?void 0:s)}),[o,e]),o}t(lt,"useRegisteredLabelId");function dt(r={}){let{id:e,fallbackControlId:o,native:s=!1,setLabelId:c,focusControl:d}=r,{controlId:l,setLabelId:R}=U(),f=L(g=>{R(g),c?.(g)}),u=lt(e,f),a=l??o;function b(g){if(d){d(g,a);return}if(!a)return;let v=ve(g.currentTarget).getElementById(a);Je(v)&&At(v)}t(b,"focusControl");function C(g){qe(g.nativeEvent)?.closest("button,input,select,textarea")||(!g.defaultPrevented&&g.detail>1&&g.preventDefault(),!s&&b(g))}return t(C,"handleInteraction"),s?{id:u,htmlFor:a,onMouseDown:C}:{id:u,onClick:C,onPointerDown(g){g.preventDefault()}}}t(dt,"useLabel");function At(r){r.focus({focusVisible:!0})}t(At,"focusElementWithVisible");var oe=E(k(),1);function le(r,e){return{...r,state:{...r.state,valid:!e&&r.state.valid}}}t(le,"getCombinedFieldValidityData");var Pe=Object.keys(se);function kt(r,e){return r.matches(":disabled")?!1:!e||r.form===e?!0:r.form===null&&!r.hasAttribute("form")}t(kt,"isEligibleInput");function ut(r,e){let o=null;for(let s of r.keys())if(kt(s,e)){if(!s.validity.valid)return s;o??=s}return o}t(ut,"findRepresentativeInput");function ct(r){return{...se,valid:!r,customError:r}}t(ct,"makeState");function Ae(r){return r&&r.validationMessage?[r.validationMessage]:[]}t(Ae,"getNativeErrors");function ft(r){let{elementRef:e,formRef:o}=Z(),{setValidityData:s,validate:c,validityData:d,validationDebounceTime:l,invalid:R,markedDirtyRef:f,state:u,shouldValidateOnChange:a,validationMode:b,registeredFieldIdRef:C}=r,{controlId:g,getDescriptionProps:v}=U(),N=xe(),D=oe.useRef(null),I=ie(()=>new Map).current,x=oe.useRef(0),w=oe.useRef(null),A=oe.useCallback((S,j)=>(I.set(S,j),()=>{I.delete(S)}),[I]),i=L(()=>{let S=ut(I,e.current);return S&&I.get(S)?.controlRef.current||null}),V=L(async(S,j=!1)=>{x.current+=1;let h=x.current;function $(n,m=R){let p=C.current??g;if(p==null)return;let y=o.current.fields.get(p);if(!y)return;let W=le(n,m);o.current.fields.set(p,{...y,validityData:W})}t($,"updateRegisteredFieldValidity");function ee(n,m){let p=n.valid===!1?m:[];return{value:S,state:n,error:p[0]??"",errors:p,initialValue:d.initialValue}}t(ee,"makeValidityData");function te(n,m){let p=n.validity.customError?n.validationMessage:"",y=m.replace(/\r\n?/g,`
2
2
  `);n.setCustomValidity(y),w.current=[n,y,p]}t(te,"setCustomValidity");function X(){let n=w.current;w.current=null,n&&(!n[0].willValidate||n[0].validationMessage===n[1])&&n[0].setCustomValidity(n[2])}t(X,"clearCustomValidity");function _(n,m,p){let y=ee(n,m);$(y,p),s(y)}t(_,"publish");function q(n){let m=Pe.reduce((y,W)=>(y[W]=n.validity[W],y),{}),p=!1;for(let y of Pe)if(y!=="valid"){if(y==="valueMissing"&&m[y])p=!0;else if(m[y])return m}return p&&!f.current&&(m.valid=!0,m.valueMissing=!1),m}t(q,"getState");function re(){return I.size>0?ut(I,e.current):D.current}t(re,"resolveRepresentativeInput");let T=re();function G(){return T=re(),T?.willValidate?q(T):ct(!1)}if(t(G,"refreshState"),j){if(u.valid!==!1||!T)return;if(!T.validity.valueMissing){X();let n=re(),m=n?.validity.customError?Ae(n):[];_(ct(m.length>0),m,!1);return}for(let n of Pe)if(n!=="valid"&&n!=="valueMissing"&&n!=="customError"&&T.validity[n])return}N.clear(),X();let B=G(),K=Ae(T),ue=a();if(K.length===0||ue){let n=Array.from(o.current.fields.values()).reduce((y,W)=>(W.name&&(y[W.name]=W.getValue()),y),{}),m=c(S,n),p;if(typeof m=="object"&&m!==null&&"then"in m){if(B.valid===!1?_(B,K):(b==="onSubmit"||!d.state.customError)&&(B.valid=null,_(B,K)),p=await m,h!==x.current)return;B=G()}else p=m;K=p?[].concat(p).filter(Boolean):[],K.length>0?(B.valid=!1,B.customError=!0,T?.willValidate&&te(T,K.join(`
3
3
  `))):K=Ae(T)}_(B,K)}),F=L((S,j=!1)=>{if(N.clear(),x.current+=1,j)return;let h=a();h&&S!==""&&l?N.start(l,()=>{V(S)}):V(S,!h)}),z=oe.useCallback((S,j={})=>$e(v(j),u.valid===!1&&!u.disabled&&!S?{"aria-invalid":!0}:ge),[v,u.disabled,u.valid]);return oe.useMemo(()=>({getValidationProps:z,inputRef:D,registeredInputs:I,registerInput:A,getInputControl:i,commit:V,change:F}),[z,I,A,i,V,F])}t(ft,"useFieldValidation");var he=E(k(),1);function mt(r){let{change:e,commit:o,invalid:s,markedDirtyRef:c,name:d,setRegisteredFieldName:l,registeredFieldIdRef:R,setValidityData:f,validityData:u}=r,{formRef:a}=Z(),b=he.useRef(null),C=he.useRef(null),g=he.useRef(!1),v=L(()=>{let i=C.current;if(i)return i.getValue?i.getValue():i.value});function N(i){return i.value===void 0?v():i.value}t(N,"getRegistrationValue");let D=L(()=>{let i=C.current;if(c.current=!0,!i){o(u.value);return}o(N(i))});function I(){let i=C.current;!i||!i.id||a.current.fields.set(i.id,{getValue:v,name:d??i.name,controlRef:i.controlRef,validityData:le(u,s),validate:D})}t(I,"refreshRegistration");function x(i=C.current?.id){i&&a.current.fields.delete(i)}t(x,"deleteRegistration");function w(i){if(g.current)return;g.current=!0;let V=N(i);f(F=>F.initialValue===V?F:{...F,initialValue:V})}t(w,"captureInitialValue"),O(()=>{let i=C.current;!i||!i.id||(l(d?void 0:i.name),a.current.fields.set(i.id,{getValue:v,name:d??i.name,controlRef:i.controlRef,validityData:le(u,s),validate:D}))},[a,v,s,d,l,D,u]),O(()=>{let i=a.current.fields;return()=>{let V=C.current?.id;V&&i.delete(V)}},[a]);let A=L((i,V)=>{if(!V){b.current===i&&(b.current=null,e(void 0,!0),x(),C.current=null,l(void 0),R.current=void 0);return}let F=C.current?.id,z=b.current;z&&z!==i&&e(void 0,!0),b.current=i,C.current=V,d||l(V.name),R.current=V.id,F&&F!==V.id&&x(F),w(V),I()});return[D,A]}t(mt,"useFieldControlRegistration");var De=E(ae(),1);var Ut=P.forwardRef(t(function(e,o){let{errors:s,validationMode:c,submitCountRef:d}=Z(),{render:l,className:R,validate:f,validationDebounceTime:u=0,validationMode:a=c,name:b,disabled:C=!1,invalid:g,dirty:v,touched:N,actionsRef:D,style:I,...x}=e,w=nt(!0)?.disabled,A=L(f||(()=>null)),i=w||C,[V,F]=P.useState(!1),[z,S]=P.useState(!1),[j,h]=P.useState(!1),[$,ee]=P.useState(!1),te=v??z,X=N??V,_=P.useRef(te),q=P.useRef(void 0),[re,T]=P.useState(),G=b??re;O(()=>{v!==void 0&&(_.current=v)},[v]);let B=L(Re=>{v===void 0&&(Re&&(_.current=!0),S(Re))}),K=L(Re=>{N===void 0&&F(Re)}),ue=L(()=>a==="onChange"||a==="onSubmit"&&d.current>0),n=G&&Object.hasOwn(s,G)?s[G]:null,m=!!(Array.isArray(n)?n.length:n),p=g===!0||m,[y,W]=P.useState({state:se,error:"",errors:[],value:null,initialValue:null}),We=!p&&(i?null:y.state.valid),me=P.useMemo(()=>({disabled:i,touched:X,dirty:te,valid:We,filled:j,focused:$}),[i,X,te,We,j,$]),pe=ft({setValidityData:W,validate:A,validityData:y,validationDebounceTime:u,invalid:p,markedDirtyRef:_,state:me,shouldValidateOnChange:ue,validationMode:a,registeredFieldIdRef:q}),[Ye,Ke]=mt({change:pe.change,commit:pe.commit,invalid:p,markedDirtyRef:_,name:b,setRegisteredFieldName:T,registeredFieldIdRef:q,setValidityData:W,validityData:y});P.useImperativeHandle(D,()=>({validate:Ye}),[Ye]);let Lt=P.useMemo(()=>({invalid:p,name:G,validityData:y,setValidityData:W,disabled:i,setTouched:K,setDirty:B,setFilled:h,setFocused:ee,validationMode:a,shouldValidateOnChange:ue,state:me,registerFieldControl:Ke,validation:pe}),[p,G,y,i,K,B,h,ee,a,ue,me,Ke,pe]),Nt=J("div",e,{ref:o,state:me,props:x,stateAttributesMapping:H});return(0,De.jsx)(Oe.Provider,{value:Lt,children:Nt})},"FieldRootInner")),pt=P.forwardRef(t(function(e,o){return(0,De.jsx)(Ve,{children:(0,De.jsx)(Ut,{...e,ref:o})})},"FieldRoot"));var ce=E(k(),1);var Le=E(k(),1);var ke=Le.createContext({disabled:!1});function Ne(){return Le.useContext(ke)}t(Ne,"useFieldItemContext");var Rt=ce.forwardRef(t(function(e,o){let{render:s,className:c,style:d,id:l,nativeLabel:R=!0,...f}=e,u=Y(!1),a=Ne(),{labelId:b}=U(),C={...u.state,disabled:u.disabled||a.disabled},g=ce.useRef(null),v=dt({id:b??l,native:R});return J("label",e,{ref:[o,g],state:C,props:[v,f],stateAttributesMapping:H})},"FieldLabel"));var de=E(k(),1);var Ue=E(ae(),1);var jt={...H,...Xe},bt=de.forwardRef(t(function(e,o){let{render:s,id:c,className:d,match:l,style:R,...f}=e,u=Q(c),{validityData:a,state:b,name:C}=Y(!1),{setMessageIds:g}=U(),{errors:v}=Z(),N=C&&Object.hasOwn(v,C)?v[C]:null,D=!!(Array.isArray(N)?N.length:N),I=typeof l=="string",x=!1;l===!0?x=!0:b.disabled?x=!1:I?x=!!a.state[l]:x=D||a.state.valid===!1;let{mounted:w,transitionStatus:A,setMounted:i}=Ce(x);O(()=>{if(!(!x||!u))return g(_=>_.concat(u)),()=>{g(_=>_.filter(q=>q!==u))}},[x,u,g]);let V=de.useRef(null),[F,z]=de.useState(null),[S,j]=de.useState(null),h=a.error;!I&&D?h=N:a.errors.length>1&&(h=a.errors);let $=h;Array.isArray(h)&&($=h.length>1?(0,Ue.jsx)("ul",{children:h.map(_=>(0,Ue.jsx)("li",{children:_},_))}):h[0]);let ee=Array.isArray(h)?JSON.stringify(h):h;x&&ee!==S&&(j(ee),z($)),Ge({open:x,ref:V,onComplete(){x||i(!1)}});let te={...b,transitionStatus:A},X=J("div",e,{ref:[o,V],state:te,props:[{id:u,children:x?$:F},f],stateAttributesMapping:jt,enabled:w});return w?X:null},"FieldError"));var gt=E(k(),1);var vt=gt.forwardRef(t(function(e,o){let{render:s,id:c,className:d,style:l,...R}=e,f=Q(c),u=Y(!1),a=Ne(),{setMessageIds:b}=U(),C={...u.state,disabled:u.disabled||a.disabled};return O(()=>{if(f)return b(v=>v.concat(f)),()=>{b(v=>v.filter(N=>N!==f))}},[f,b]),J("p",e,{ref:o,state:C,props:[{id:f},R],stateAttributesMapping:H})},"FieldDescription"));var Me=E(k(),1);function xt(r,e,o,s,c=!0,d){let{registerFieldControl:l}=Y(),R=ie(()=>Symbol());O(()=>{let f=R.current;if(!c){l(f,void 0);return}l(f,{controlRef:r,getValue:s,id:e,name:d,value:o})},[r,c,s,e,d,l,R,o]),O(()=>{let f=R.current;return()=>{l(f,void 0)}},[l,R])}t(xt,"useRegisterFieldControl");var Ct=Me.forwardRef(t(function(e,o){let{render:s,className:c,id:d,name:l,value:R,disabled:f=!1,onValueChange:u,defaultValue:a,autoFocus:b=!1,style:C,...g}=e,{state:v,name:N,disabled:D,setTouched:I,setDirty:x,validityData:w,setFocused:A,setFilled:i,validationMode:V,validation:F}=Y(),{clearErrors:z,elementRef:S,submitCountRef:j}=Z(),h=D||f,$=N??l,ee={...v,disabled:h},{labelId:te}=U(),X=st({id:d}),[_]=Qe({controlled:R,default:a,name:"FieldControl",state:"value"}),q=R!==void 0,re=q?_:void 0,T=re==null?void 0:String(re),G=L(()=>F.inputRef.current?.value);xt(F.inputRef,X,T,G,!h,l),O(()=>{let n=T??F.inputRef.current?.value;n!==void 0&&i(n!=="")},[T,F.inputRef,i]),Ze(T,()=>{T!==void 0&&(z($),x(T!==(w.initialValue??"")),F.change(T))});let B=Me.useRef(null),K=xe();return O(()=>{b&&B.current===He(ve(B.current))&&A(!0)},[b,A]),J("input",e,{ref:[o,B],state:ee,props:[{id:X,disabled:h,name:$,ref:F.inputRef,"aria-labelledby":te,autoFocus:b,...q?{value:re}:{defaultValue:a},onChange(n){let m=n.currentTarget.value,p=tt(et.none,n.nativeEvent);u?.(m,p),!q&&(x(m!==(w.initialValue??"")),i(m!==""),!n.nativeEvent.defaultPrevented&&!p.isCanceled&&(z($),F.change(m)))},onFocus(){A(!0)},onBlur(n){if(I(!0),A(!1),V==="onBlur"){let m=n.currentTarget.value;F.commit(m),q&&queueMicrotask(()=>{let p=F.inputRef.current?.value;p!==void 0&&p!==m&&p!==(w.initialValue??"")&&F.commit(p)})}},onKeyDown(n){if(n.currentTarget.tagName==="INPUT"&&n.key==="Enter"){I(!0);let m=n.currentTarget.value,p=n.currentTarget.form;if(p&&p===S.current&&!n.defaultPrevented){let y=n.currentTarget,W=j.current;K.start(0,()=>{j.current===W&&F.commit(y.value)})}else F.commit(m)}}},g,n=>F.getValidationProps(h,n)],stateAttributesMapping:H})},"FieldControl"));var fe=E(k(),1);var Ft=E(ae(),1);var yt=t(function(e){let{children:o}=e,{validityData:s,invalid:c}=Y(!1),d=fe.useMemo(()=>le(s,c),[s,c]),l=d.state.valid===!1,{transitionStatus:R}=Ce(l),f=fe.useMemo(()=>({...d,validity:d.state,transitionStatus:R}),[d,R]);return(0,Ft.jsx)(fe.Fragment,{children:o(f)})},"FieldValidity");var Se=E(k(),1);var je=E(ae(),1);var It=Se.forwardRef(t(function(e,o){let{render:s,className:c,style:d,disabled:l=!1,...R}=e,{state:f,disabled:u}=Y(!1),a=u||l,b={...f,disabled:a},C=Se.useMemo(()=>({disabled:a}),[a]),g=J("div",e,{ref:o,state:b,props:R,stateAttributesMapping:H});return(0,je.jsx)(Ve,{children:(0,je.jsx)(ke.Provider,{value:C,children:g})})},"FieldItem"));var Vt=E(ae(),1);var Be=Et.forwardRef(t(function(e,o){return(0,Vt.jsx)(Te.Control,{ref:o,...e})},"Input"));var Dt=E(ae(),1);function Pi(r){let e=(0,ht.c)(10),o,s,c;e[0]!==r?({className:o,type:c,...s}=r,e[0]=r,e[1]=o,e[2]=s,e[3]=c):(o=e[1],s=e[2],c=e[3]);let d;e[4]!==o?(d=ze("h-8 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",o),e[4]=o,e[5]=d):d=e[5];let l;return e[6]!==s||e[7]!==d||e[8]!==c?(l=(0,Dt.jsx)(Be,{type:c,"data-slot":"input",className:d,...s}),e[6]=s,e[7]=d,e[8]=c,e[9]=l):l=e[9],l}t(Pi,"m");export{H as a,Y as b,Z as c,U as d,st as e,dt as f,Ne as g,xt as h,Pi as i};
@@ -0,0 +1 @@
1
+ import{a as d}from"./chunk-6G3E4PJ2.js";import{a as u,d as y}from"./chunk-5PEAXTYQ.js";var t=y(d(),1);var S=u((r,a=400)=>{let e=(r??"").trim(),[o,c]=(0,t.useState)(e),[i,n]=(0,t.useState)(e),m=(0,t.useRef)(r);m.current!==r&&(m.current=r,c(e),n(e));let f=o.trim();return(0,t.useEffect)(()=>{let s=setTimeout(()=>{n(f)},a);return()=>{clearTimeout(s)}},[f,a]),{queryShardKey:i,setShardKey:u(s=>{c(s)},"setShardKey"),shardKey:o}},"f");export{S as a};
@@ -0,0 +1 @@
1
+ import{a as d}from"./chunk-UXBNXITB.js";import{a as S}from"./chunk-GWNGVKLG.js";import{a as P,b as G}from"./chunk-6G3E4PJ2.js";import{a as m,d as w}from"./chunk-5PEAXTYQ.js";var M=w(S(),1),v=w(P(),1);var N=w(G(),1);var z=m(r=>{let t=(0,M.c)(18),{count:a,offset:e,onOffsetChange:f,pageSize:o,prefix:s,total:n}=r;if(n===void 0)return null;let c=Math.max(0,Math.floor((n-1)/o)*o),p=e+a<n,x=e>0,i;t[0]!==e||t[1]!==f||t[2]!==o?(i=m(()=>{f(e+o)},"r"),t[0]=e,t[1]=f,t[2]=o,t[3]=i):i=t[3];let l;t[4]!==c||t[5]!==e||t[6]!==f||t[7]!==o?(l=m(()=>{f(Math.max(0,Math.min(e-o,c)))},"l"),t[4]=c,t[5]=e,t[6]=f,t[7]=o,t[8]=l):l=t[8];let h=a===0?0:e+a,g=a===0?0:e+1,u;return t[9]!==s||t[10]!==p||t[11]!==x||t[12]!==i||t[13]!==l||t[14]!==h||t[15]!==g||t[16]!==n?(u=(0,N.jsx)(d,{hasNext:p,hasPrevious:x,onNext:i,onPrevious:l,prefix:s,rangeEnd:h,rangeStart:g,total:n}),t[9]=s,t[10]=p,t[11]=x,t[12]=i,t[13]=l,t[14]=h,t[15]=g,t[16]=n,t[17]=u):u=t[17],u},"G"),A=m(r=>{let t=(0,M.c)(7),a;t[0]!==r?(a={offset:0,owner:r},t[0]=r,t[1]=a):a=t[1];let[e,f]=(0,v.useState)(a);e.owner!==r&&f({offset:0,owner:r});let o=e.owner===r?e.offset:0,s;t[2]!==r?(s=m(c=>{f({offset:c,owner:r})},"a"),t[2]=r,t[3]=s):s=t[3];let n;return t[4]!==o||t[5]!==s?(n=[o,s],t[4]=o,t[5]=s,t[6]=n):n=t[6],n},"N");export{z as a,A as b};
@@ -0,0 +1 @@
1
+ import{a as nn}from"./chunk-NGZNXNRD.js";import{a as ae,b as tn,c as on}from"./chunk-2SNHKJXK.js";import{a as ho,b as ko,c as wo,d as _o,e as Lo,f as Go,g as qo,h as Qo}from"./chunk-BCUOQNI2.js";import{$ as dt,A as Ro,B as xo,C as ct,E as Mo,G as bo,I as Co,J as vo,M as Io,N as Eo,O as yo,P as Po,R as So,S as No,T as Oo,U as To,W as Ut,Y as Do,_ as Ao,aa as Vo,ba as Bo,ca as pt,ea as Uo,fa as Ho,j as uo,k as co,la as zo,ma as Yo,na as Ko,oa as $o,p as Gt,qa as Wo,r as po,ra as Jo,s as lo,sa as Xo,u as mo,v as it,w as at,x as fo,y as ut,z as go}from"./chunk-P5EVJEGC.js";import{b as jo}from"./chunk-D65UVZIA.js";import{i as Zo,k as en}from"./chunk-QAOZXPLU.js";import{D as Ne,H as nt,I as Ue,J as rt,K as st,M as y,N as re,a as Bt,b as Z,c as tt,e as Lt,l as so,o as io,p as Ft,q as ao,r as ot}from"./chunk-OWRKSQPE.js";import{a as lt,b as Fo,c as He}from"./chunk-CKEQX655.js";import{a as ie,c as Se,i as oo,q as no,t as ro,w as $e}from"./chunk-UD5REVU2.js";import{a as he,c as G,d as Ze,e as et,g as Ge,h as Ke,i as se,j as O}from"./chunk-T3ZCW3RG.js";import{x as Fe}from"./chunk-GNI37YCV.js";import{a as ir}from"./chunk-GWNGVKLG.js";import{a as E,b as me}from"./chunk-6G3E4PJ2.js";import{a as o,c as sr,d as M}from"./chunk-5PEAXTYQ.js";var Ve=M(ir(),1);var ee={};sr(ee,{Arrow:()=>sn,Backdrop:()=>un,CheckboxItem:()=>fn,CheckboxItemIndicator:()=>gn,Group:()=>Mn,GroupLabel:()=>bn,Handle:()=>qe,Item:()=>vn,LinkItem:()=>In,Popup:()=>yn,Portal:()=>Nn,Positioner:()=>On,RadioGroup:()=>kn,RadioItem:()=>Dn,RadioItemIndicator:()=>An,Root:()=>Dt,Separator:()=>nn,SubmenuRoot:()=>Un,SubmenuTrigger:()=>Jn,Trigger:()=>Kn,Viewport:()=>Wn,createHandle:()=>Xn});var rn=M(E(),1);var mt=M(E(),1);var Ht=mt.createContext(void 0);function K(t){let e=mt.useContext(Ht);if(e===void 0&&!t)throw new Error(G(33));return e}o(K,"useMenuPositionerContext");var ft=M(E(),1);var jt=ft.createContext(void 0);function D(t){let e=ft.useContext(jt);if(e===void 0&&!t)throw new Error(G(36));return e}o(D,"useMenuRootContext");var sn=rn.forwardRef(o(function(e,n){let{render:s,className:u,style:c,...i}=e,{store:p}=D(),{arrowRef:r,side:m,align:f,arrowUncentered:R,arrowStyles:h}=K(),P={open:p.useState("open"),side:m,align:f,uncentered:R};return O("div",e,{ref:[r,n],stateAttributesMapping:ao,state:P,props:{style:h,"aria-hidden":!0,...i}})},"MenuArrow"));var an=M(E(),1);var gt=M(E(),1);var ar=gt.createContext(void 0);function Oe(t=!0){let e=gt.useContext(ar);if(e===void 0&&!t)throw new Error(G(25));return e}o(Oe,"useContextMenuRootContext");var un=an.forwardRef(o(function(e,n){let{render:s,className:u,style:c,...i}=e,{store:p}=D(),r=p.useState("open"),m=p.useState("mounted"),f=p.useState("transitionStatus"),R=p.useState("lastOpenChangeReason"),h=Oe(),x={open:r,transitionStatus:f};return O("div",e,{ref:h?.backdropRef?[n,h.backdropRef]:n,state:x,stateAttributesMapping:ot,props:[{role:"presentation",hidden:!m,style:{pointerEvents:R===y.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},i]})},"MenuBackdrop"));var Mt=M(E(),1);var Rt=M(E(),1);var zt=Rt.createContext(void 0);function cn(){let t=Rt.useContext(zt);if(t===void 0)throw new Error(G(30));return t}o(cn,"useMenuCheckboxItemContext");var je=M(E(),1);var dn=M(E(),1);function xt(t){let{closeOnClick:e,highlighted:n,id:s,nodeId:u,store:c,typingRef:i,itemRef:p,itemMetadata:r}=t,{events:m}=c.useState("floatingTreeRoot"),f=c.useState("open"),R=Oe(!0),h=R!==void 0;return dn.useMemo(()=>({id:s,role:"menuitem",tabIndex:f&&n?0:-1,onKeyDown(x){x.key===" "&&i?.current&&x.preventDefault()},onMouseMove(x){u&&m.emit("itemhover",{nodeId:u,target:x.currentTarget})},onClick(x){e&&m.emit("close",{domEvent:x,reason:y.itemPress})},onMouseUp(x){if(R){let P=R.initialCursorPointRef.current;if(R.initialCursorPointRef.current=null,h&&P&&Math.abs(x.clientX-P.x)<=1&&Math.abs(x.clientY-P.y)<=1||h&&!tt.os.mac&&x.button===2)return}p.current&&c.context.allowMouseUpTriggerRef.current&&(!h||x.button===2)&&r.type==="regular-item"&&Fo(p.current,x,{detail:1})}}),[e,n,s,m,u,f,c,i,p,R,h,r])}o(xt,"useMenuItemCommonProps");var Te={type:"regular-item"};function ke(t){let{closeOnClick:e,disabled:n,highlighted:s,id:u,store:c,typingRef:i=c.context.typingRef,nativeButton:p,itemMetadata:r,nodeId:m}=t,f=je.useRef(null),{getButtonProps:R,buttonRef:h}=He({disabled:n,focusableWhenDisabled:!0,native:p,composite:!0}),x=xt({closeOnClick:e,highlighted:s,id:u,nodeId:m,store:c,typingRef:i,itemRef:f,itemMetadata:r}),P=je.useCallback(A=>he(x,{onMouseEnter(){r.type==="submenu-trigger"&&r.setActive()}},A,R),[x,R,r]),S=et(f,h);return je.useMemo(()=>({getItemProps:P,itemRef:S}),[P,S])}o(ke,"useMenuItem");var pn="data-checked",ln="data-unchecked";var we={checked(t){return t?{[pn]:""}:{[ln]:""}},...so};var mn=M(me(),1);var fn=Mt.forwardRef(o(function(e,n){let{render:s,className:u,id:c,label:i,nativeButton:p=!1,disabled:r=!1,closeOnClick:m=!1,checked:f,defaultChecked:R,onCheckedChange:h,style:x,...P}=e,S=ae({guess:!0,label:i}),A=K(!0),d=Z(c),{store:g}=D(),l=g.useState("disabled"),V=r||l,v=g.useState("isActive",S.index),C=g.useState("itemProps"),[B,b]=st({controlled:f,default:R??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:z,itemRef:F}=ke({closeOnClick:m,disabled:V,highlighted:v,id:d,store:g,nativeButton:p,nodeId:A?.context.nodeId,itemMetadata:Te}),N=Mt.useMemo(()=>({disabled:V,highlighted:v,checked:B}),[V,v,B]);function a(Y){let T=re(y.itemPress,Y.nativeEvent,void 0,{preventUnmountOnClose:Ge});h?.(!B,T),!T.isCanceled&&b(k=>!k)}o(a,"handleClick");let H=O("div",e,{state:N,stateAttributesMapping:we,props:[C,{role:"menuitemcheckbox","aria-checked":B,onClick:a},P,z],ref:[F,n,S.ref]});return(0,mn.jsx)(zt.Provider,{value:N,children:H})},"MenuCheckboxItem"));var ht=M(E(),1);var gn=ht.forwardRef(o(function(e,n){let{render:s,className:u,style:c,keepMounted:i=!1,...p}=e,r=cn(),m=ht.useRef(null),{transitionStatus:f,mounted:R,setMounted:h}=rt(r.checked);Ue({batch:!0,enabled:!r.checked,open:r.checked,ref:m,onComplete(){r.checked||h(!1)}});let x={checked:r.checked,disabled:r.disabled,highlighted:r.highlighted,transitionStatus:f};return O("span",e,{state:x,ref:[n,m],stateAttributesMapping:we,props:{"aria-hidden":!0,...p},enabled:i||R})},"MenuCheckboxItemIndicator"));var Ct=M(E(),1);var bt=M(E(),1);var We=bt.createContext(void 0);function Rn(){let t=bt.useContext(We);if(t===void 0)throw new Error(G(31));return t}o(Rn,"useMenuGroupRootContext");var xn=M(me(),1);var Mn=Ct.forwardRef(o(function(e,n){let{render:s,className:u,style:c,...i}=e,[p,r]=Ct.useState(void 0),m=O("div",e,{ref:n,props:{role:"group","aria-labelledby":p,...i}});return(0,xn.jsx)(We.Provider,{value:r,children:m})},"MenuGroup"));var hn=M(E(),1);var bn=hn.forwardRef(o(function(e,n){let{render:s,className:u,style:c,id:i,...p}=e,r=Z(i),m=Rn();return ie(()=>(m(r),()=>{m(f=>f===r?void 0:f)}),[m,r]),O("div",e,{ref:n,props:{id:r,"aria-hidden":!0,...p}})},"MenuGroupLabel"));var Cn=M(E(),1);var vn=Cn.forwardRef(o(function(e,n){let{render:s,className:u,id:c,label:i,nativeButton:p=!1,disabled:r=!1,closeOnClick:m=!0,style:f,...R}=e,h=ae({guess:!0,label:i}),x=K(!0),P=Z(c),{store:S}=D(),A=S.useState("disabled"),d=r||A,g=S.useState("isActive",h.index),l=S.useState("itemProps"),{getItemProps:V,itemRef:v}=ke({closeOnClick:m,disabled:d,highlighted:g,id:P,store:S,nativeButton:p,nodeId:x?.context.nodeId,itemMetadata:Te});return O("div",e,{state:{disabled:d,highlighted:g},props:[l,R,V],ref:[v,n,h.ref]})},"MenuItem"));var vt=M(E(),1);var In=vt.forwardRef(o(function(e,n){let{render:s,className:u,id:c,label:i,closeOnClick:p=!1,style:r,...m}=e,f=vt.useRef(null),R=ae({guess:!0,label:i}),x=K(!0)?.context.nodeId,P=Z(c),{store:S}=D(),A=S.useState("isActive",R.index),d=S.useState("itemProps"),g=S.context.typingRef,{getButtonProps:l,buttonRef:V}=He({native:!1,composite:!0}),v=xt({closeOnClick:p,highlighted:A,id:P,nodeId:x,store:S,typingRef:g,itemRef:f,itemMetadata:Te});function C(b){return he(v,b,l)}return o(C,"getItemProps"),O("a",e,{state:{highlighted:A},props:[d,m,C],ref:[f,V,n,R.ref]})},"MenuLinkItem"));var It=M(E(),1);var En=M(me(),1);var yn=It.forwardRef(o(function(e,n){let{render:s,className:u,style:c,finalFocus:i,...p}=e,{store:r}=D(),{side:m,align:f}=K(),R=Xo(!0)!=null,h=r.useState("open"),x=r.useState("transitionStatus"),P=r.useState("popupProps"),S=r.useState("mounted"),A=r.useState("instantType"),d=r.useState("activeTriggerElement"),g=r.useState("parent"),l=r.useState("lastOpenChangeReason"),V=r.useState("rootId"),v=r.useState("floatingRootContext"),C=r.useState("floatingTreeRoot"),B=r.useState("closeDelay"),b=r.useState("hoverEnabled"),z=r.useState("disabled"),F=r.useState("openMethod"),N=g.type==="context-menu";Ue({open:h,ref:r.context.popupRef,onComplete(){h&&r.context.onOpenChangeComplete?.(!0)}}),It.useEffect(()=>{function k(ue){r.setOpen(!1,re(ue.reason,ue.domEvent))}return o(k,"handleClose"),C.events.on("close",k),()=>{C.events.off("close",k)}},[C.events,r]),Ao(v,{enabled:b&&!z&&!N&&g.type!=="menubar",closeDelay:B});let a=r.useStateSetter("popupElement"),H={transitionStatus:x,side:m,align:f,open:h,nested:g.type==="menu",instant:A},Y=O("div",e,{state:H,ref:[n,r.context.popupRef,a],stateAttributesMapping:ot,props:[P,{onKeyDown(k){R&&Jo.has(k.key)&&k.stopPropagation()}},Ko(x),p,{"data-rootownerid":V}]}),T=g.type===void 0||N;return(d||g.type==="menubar"&&l!==y.outsidePress)&&(T=!0),(0,En.jsx)(xo,{context:v,openInteractionType:F,modal:N,disabled:!S,returnFocus:i===void 0?T:i,initialFocus:g.type!=="menu",restoreFocus:!0,externalTree:g.type!=="menubar"?C:void 0,previousFocusableElement:d,nextFocusableElement:g.type===void 0?r.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:g.type===void 0?r.context.beforeContentFocusGuardRef:void 0,children:Y})},"MenuPopup"));var Sn=M(E(),1);var Et=M(E(),1);var Yt=Et.createContext(void 0);function Pn(){let t=Et.useContext(Yt);if(t===void 0)throw new Error(G(32));return t}o(Pn,"useMenuPortalContext");var Kt=M(me(),1);var Nn=Sn.forwardRef(o(function(e,n){let{keepMounted:s=!1,...u}=e,{store:c,parent:i}=D();if(!(c.useState("mounted")||s))return null;let m=i.type==="menu"||i.type==="menubar"?"group":void 0;return(0,Kt.jsx)(Yt.Provider,{value:s,children:(0,Kt.jsx)(mo,{ref:n,...u,portalOwnerRole:m})})},"MenuPortal"));var be=M(E(),1);var ze=M(me(),1);var On=be.forwardRef(o(function(e,n){let{anchor:s,positionMethod:u="absolute",className:c,render:i,side:p,align:r,sideOffset:m=0,alignOffset:f=0,collisionBoundary:R="clipping-ancestors",collisionPadding:h=5,arrowPadding:x=5,sticky:P=!1,disableAnchorTracking:S=!1,collisionAvoidance:A=po,style:d,...g}=e,{store:l}=D(),V=Pn(),v=Oe(!0),C=l.useState("parent"),B=l.useState("floatingRootContext"),b=l.useState("floatingTreeRoot"),z=l.useState("mounted"),F=l.useState("open"),N=l.useState("modal"),a=l.useState("openMethod"),H=l.useState("activeTriggerElement"),Y=l.useState("transitionStatus"),T=l.useState("positionerElement"),k=l.useState("instantType"),ue=l.useState("adaptiveOrigin"),te=l.useState("lastOpenChangeReason"),W=l.useState("floatingNodeId"),ye=l.useState("floatingParentNodeId"),w=B.useState("domReferenceElement"),fe=be.useRef(null),ge=nt(T),ce=s,Ce=m,Re=f,de=r,X=A;C.type==="context-menu"&&(ce=s??C.context?.anchor,de=de??"start",!p&&de!=="center"&&(Re=e.alignOffset??2,Ce=e.sideOffset??-5));let oe=p,pe=de;C.type==="menu"?(oe=oe??"inline-end",pe=pe??"start",X=e.collisionAvoidance??lo):C.type==="menubar"&&(oe=oe??(C.context.orientation==="vertical"?"inline-end":"bottom"),pe=pe??"start");let q=C.type==="context-menu",ne=zo({anchor:ce,floatingRootContext:B,positionMethod:v?"fixed":u,mounted:z,side:oe,sideOffset:Ce,align:pe,alignOffset:Re,arrowPadding:q?0:x,collisionBoundary:R,collisionPadding:h,sticky:P,nodeId:W,keepMounted:V,disableAnchorTracking:S,collisionAvoidance:X,shift:q?{crossAxis:!("side"in X&&X.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:b,adaptiveOrigin:ue});be.useEffect(()=>{function L(_){_.open&&(_.parentNodeId===W&&l.set("hoverEnabled",!1),_.nodeId!==W&&_.parentNodeId===l.select("floatingParentNodeId")&&l.setOpen(!1,re(y.siblingOpen)))}return o(L,"onMenuOpenChange"),b.events.on("menuopenchange",L),()=>{b.events.off("menuopenchange",L)}},[l,b.events,W]),be.useEffect(()=>{if(l.select("floatingParentNodeId")==null)return;function L(_){if(_.open||_.nodeId!==l.select("floatingParentNodeId"))return;let Ie=_.reason??y.siblingOpen;l.setOpen(!1,re(Ie))}return o(L,"onParentClose"),b.events.on("menuopenchange",L),()=>{b.events.off("menuopenchange",L)}},[b.events,l]);let le=Ne();be.useEffect(()=>{F||le.clear()},[F,le]),be.useEffect(()=>{function L(_){if(!(!F||_.nodeId!==l.select("floatingParentNodeId")))if(_.target&&H&&H!==_.target){let Ie=l.select("closeDelay");Ie>0?le.isStarted()||le.start(Ie,()=>{l.setOpen(!1,re(y.siblingOpen))}):l.setOpen(!1,re(y.siblingOpen))}else le.clear()}return o(L,"onItemHover"),b.events.on("itemhover",L),()=>{b.events.off("itemhover",L)}},[b.events,F,H,l,le]),be.useEffect(()=>{let L={open:F,nodeId:W,parentNodeId:ye,reason:l.select("lastOpenChangeReason")};b.events.emit("menuopenchange",L)},[b.events,F,l,W,ye]),ie(()=>{let L=w,_=fe.current;if(L&&(fe.current=L),_&&L&&L!==_){l.set("instantType",void 0);let Ie=new AbortController;return ge(()=>{l.set("instantType","trigger-change")},Ie.signal),()=>{Ie.abort()}}},[w,ge,l]);let Be={open:F,side:ne.side,align:ne.align,anchorHidden:ne.anchorHidden,nested:C.type==="menu",instant:k},Le=C.type==="menubar"&&C.context.modal,xe=N&&te!==y.triggerHover;Wo(F&&(Le||xe),a==="touch",T,H);let Me=$o(e,Be,{styles:ne.positionerStyles,transitionStatus:Y,props:g,refs:[n,l.useStateSetter("positionerElement")],hidden:!z,inert:!F}),Pe=z&&C.type!=="menu"&&(C.type!=="menubar"&&N&&te!==y.triggerHover||C.type==="menubar"&&C.context.modal),ve=null;return C.type==="menubar"?ve=C.context.contentElement:C.type===void 0&&(ve=H),(0,ze.jsxs)(Ht.Provider,{value:ne,children:[Pe&&(0,ze.jsx)(Yo,{ref:C.type==="context-menu"||C.type==="nested-context-menu"?C.context.internalBackdropRef:null,inert:Ho(!F),cutout:ve}),(0,ze.jsx)(go,{id:W,children:(0,ze.jsx)(tn,{elementsRef:l.context.itemDomElements,labelsRef:l.context.itemLabels,children:Me})})]})},"MenuPositioner"));var _e=M(E(),1);var yt=M(E(),1);var $t=yt.createContext(void 0);function Tn(){let t=yt.useContext($t);if(t===void 0)throw new Error(G(34));return t}o(Tn,"useMenuRadioGroupContext");var Wt=M(me(),1);var kn=_e.memo(_e.forwardRef(o(function(e,n){let{render:s,className:u,value:c,defaultValue:i,onValueChange:p,disabled:r=!1,style:m,"aria-labelledby":f,...R}=e,[h,x]=_e.useState(void 0),[P,S]=st({controlled:c,default:i,name:"MenuRadioGroup"}),A=Se((V,v)=>{p?.(V,v),!v.isCanceled&&S(V)}),g=O("div",e,{state:{disabled:r},ref:n,props:{role:"group","aria-labelledby":f??h,"aria-disabled":r||void 0,...R}}),l=_e.useMemo(()=>({value:P,setValue:A,disabled:r}),[P,A,r]);return(0,Wt.jsx)(We.Provider,{value:x,children:(0,Wt.jsx)($t.Provider,{value:l,children:g})})},"MenuRadioGroup")));var St=M(E(),1);var Pt=M(E(),1);var Jt=Pt.createContext(void 0);function wn(){let t=Pt.useContext(Jt);if(t===void 0)throw new Error(G(35));return t}o(wn,"useMenuRadioItemContext");var _n=M(me(),1);var Dn=St.forwardRef(o(function(e,n){let{render:s,className:u,id:c,label:i,nativeButton:p=!1,disabled:r=!1,closeOnClick:m=!1,value:f,style:R,...h}=e,x=ae({guess:!0,label:i}),P=K(!0),S=Z(c),{store:A}=D(),d=A.useState("isActive",x.index),g=A.useState("itemProps"),{value:l,setValue:V,disabled:v}=Tn(),C=A.useState("disabled"),B=r||v||C,b=l===f,{getItemProps:z,itemRef:F}=ke({closeOnClick:m,disabled:B,highlighted:d,id:S,store:A,nativeButton:p,nodeId:P?.context.nodeId,itemMetadata:Te}),N=St.useMemo(()=>({disabled:B,highlighted:d,checked:b}),[B,d,b]);function a(Y){let T=re(y.itemPress,Y.nativeEvent,void 0,{preventUnmountOnClose:Ge});V(f,T)}o(a,"handleClick");let H=O("div",e,{state:N,stateAttributesMapping:we,props:[g,{role:"menuitemradio","aria-checked":b,onClick:a},h,z],ref:[F,n,x.ref]});return(0,_n.jsx)(Jt.Provider,{value:N,children:H})},"MenuRadioItem"));var Nt=M(E(),1);var An=Nt.forwardRef(o(function(e,n){let{render:s,className:u,style:c,keepMounted:i=!1,...p}=e,r=wn(),m=Nt.useRef(null),{transitionStatus:f,mounted:R,setMounted:h}=rt(r.checked);Ue({batch:!0,enabled:!r.checked,open:r.checked,ref:m,onComplete(){r.checked||h(!1)}});let x={checked:r.checked,disabled:r.disabled,highlighted:r.highlighted,transitionStatus:f};return O("span",e,{state:x,stateAttributesMapping:we,ref:[n,m],props:{"aria-hidden":!0,...p},enabled:i||R})},"MenuRadioItemIndicator"));var U=M(E(),1);var Ot=M(E(),1);var cr=Ot.createContext(null);function Tt(t){let e=Ot.useContext(cr);if(e===null&&!t)throw new Error(G(5));return e}o(Tt,"useMenubarContext");var Je=M(E(),1);var Vn={...wo,disabled:o(t=>t.parent.type==="menubar"&&t.parent.context.disabled||t.disabled,"disabled"),modal:o(t=>(t.parent.type===void 0||t.parent.type==="context-menu")&&(t.modal??!0),"modal"),openMethod:o(t=>t.openMethod,"openMethod"),allowMouseEnter:o(t=>t.allowMouseEnter,"allowMouseEnter"),highlightItemOnHover:o(t=>t.highlightItemOnHover,"highlightItemOnHover"),parent:o(t=>t.parent,"parent"),rootId:o(t=>t.parent.type==="menu"?t.parent.store.select("rootId"):t.parent.type!==void 0?t.parent.context.rootId:t.rootId,"rootId"),activeIndex:o(t=>t.activeIndex,"activeIndex"),isActive:o((t,e)=>t.activeIndex===e,"isActive"),hoverEnabled:o(t=>t.hoverEnabled,"hoverEnabled"),instantType:o(t=>t.instantType,"instantType"),lastOpenChangeReason:o(t=>t.openChangeReason,"lastOpenChangeReason"),floatingTreeRoot:o(t=>t.parent.type==="menu"?t.parent.store.select("floatingTreeRoot"):t.floatingTreeRoot,"floatingTreeRoot"),floatingNodeId:o(t=>t.floatingNodeId,"floatingNodeId"),floatingParentNodeId:o(t=>t.floatingParentNodeId,"floatingParentNodeId"),itemProps:o(t=>t.itemProps,"itemProps"),closeDelay:o(t=>t.closeDelay,"closeDelay"),adaptiveOrigin:o(t=>t.adaptiveOrigin,"adaptiveOrigin"),keyboardEventRelay:o(t=>{if(t.keyboardEventRelay)return t.keyboardEventRelay;if(t.parent.type==="menu")return t.parent.store.select("keyboardEventRelay")},"keyboardEventRelay")},kt=class extends bo{static{o(this,"MenuStore")}constructor(e,n,s=!1){let u=new Ut,c=Fn(u,n,s,e);super(c,Ln(u),Vn),this.unsubscribeParentListener=this.observe("parent",i=>{if(this.unsubscribeParentListener?.(),i.type==="menu"){let p=i.store.select("rootId"),r=i.store.select("floatingTreeRoot"),m=i.store.select("keyboardEventRelay");this.unsubscribeParentListener=i.store.subscribe(()=>{let f=i.store.select("rootId"),R=i.store.select("floatingTreeRoot"),h=i.store.select("keyboardEventRelay");p===f&&r===R&&m===h||(p=f,r=R,m=h,this.notifyAll())}),this.context.allowMouseUpTriggerRef=i.store.context.allowMouseUpTriggerRef;return}i.type!==void 0&&(this.context.allowMouseUpTriggerRef=i.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:e,eventDetails:n})}unsubscribeParentListener=null};function Bn(){let t=new Ut,e=new Lo(Object.freeze(Fn(t)),Object.freeze(Ln(t)),Vn);return Object.assign(e,{setOpen:Ge})}o(Bn,"createNullMenuStore");function Ln(t){return{positionerRef:Je.createRef(),popupRef:Je.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Je.createRef(),beforeContentFocusGuardRef:Je.createRef(),onOpenChangeComplete:void 0,triggerElements:t}}o(Ln,"createInitialContext");function Fn(t,e,n=!1,s){return{...ko(t,e,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new it,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:se,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...s}}o(Fn,"createInitialState");var wt=M(E(),1);var Xt=wt.createContext(void 0);function _t(){return wt.useContext(Xt)}o(_t,"useMenuSubmenuRootContext");var Xe=M(me(),1);var Dt=uo(o(function(e){let{children:n,open:s,onOpenChange:u,onOpenChangeComplete:c,defaultOpen:i=!1,disabled:p=!1,modal:r,loopFocus:m=!0,orientation:f="vertical",actionsRef:R,closeParentOnEsc:h=!1,handle:x,triggerId:P,defaultTriggerId:S=null,highlightItemOnHover:A=!0}=e,d=Oe(!0),g=D(!0),l=Tt(!0),V=_t(),v=U.useMemo(()=>V&&g?{type:"menu",store:g.store}:l?{type:"menubar",context:l}:d&&!g?{type:"context-menu",context:d}:{type:void 0},[d,g,l,V]),C=Bt(),B=Bt(),b=at(),z=v.type==="menu"?v.store:void 0,F=(s??i)&&z?.state.transitionStatus==="starting",N=Ze(()=>F?z?.state.instantType:void 0).current,a=dr({open:i,openProp:s,activeTriggerId:S,triggerIdProp:P,parent:v,disabled:p,highlightItemOnHover:A,modal:v.type===void 0?r:void 0,rootId:C,instantType:N},B,b!=null);a.useControlledProp("openProp",s),a.useControlledProp("triggerIdProp",P),a.useContextCallback("onOpenChangeComplete",c);let H=a.useState("floatingTreeRoot"),Y=ut(H),T=a.useState("open"),k=a.useState("activeTriggerElement"),ue=a.useState("positionerElement"),te=a.useState("hoverEnabled"),W=a.useState("disabled"),ye=a.useState("lastOpenChangeReason"),w=a.useState("parent"),fe=a.useState("activeIndex"),ge=a.useState("payload"),ce=a.useState("floatingParentNodeId"),Ce=U.useRef(null),Re=U.useRef(w.type!=="context-menu"),de=Ne(),X=U.useRef(!0),oe=Ne(),pe=ce!=null,{openMethod:q,triggerProps:ne}=Uo(T);a.useSyncedValues({disabled:p,highlightItemOnHover:A,modal:w.type===void 0?r:void 0,openMethod:q,rootId:C}),No(a);let{forceUnmount:le,transitionStatus:Be}=Oo(T,a,()=>{a.set("allowMouseEnter",!1)},F),Le=nt(a.context.popupRef);U.useEffect(()=>{if(N===void 0)return;let I=o(()=>{a.state.instantType===N&&a.set("instantType",void 0)},"clearSeededInstantType");if(!T){I();return}if(Be!==void 0)return;if(a.context.popupRef.current==null){I();return}let j=new AbortController;return Le(I,j.signal),()=>{j.abort()}},[N,T,Be,Le,a]),ie(()=>{d&&!g?a.update({parent:{type:"context-menu",context:d},floatingNodeId:Y,floatingParentNodeId:b}):g&&a.update({floatingNodeId:Y,floatingParentNodeId:b})},[d,g,Y,b,a]),U.useEffect(()=>{if(T||(Ce.current=null),w.type==="context-menu"){if(!T){de.clear(),Re.current=!1;return}de.start(500,()=>{Re.current=!0})}},[de,T,w.type]),ie(()=>{!T&&!te&&a.set("hoverEnabled",!0)},[T,te,a]);let xe=Se((I,j)=>{let Q=j.reason;if(!I&&!a.select("open")||T===I&&j.trigger===k&&ye===Q)return;let nr=Po(j);if(!I&&j.trigger==null&&(j.trigger=k??void 0),u?.(I,j),j.isCanceled)return;a.state.floatingRootContext.dispatchOpenChange(I,j);let Vt=j.event;if(I===!1&&Vt?.type==="click"&&Vt.pointerType==="touch"&&!X.current)return;I&&Q===y.triggerFocus?(X.current=!1,oe.start(300,()=>{X.current=!0})):(X.current=!0,oe.clear());let to=(Q===y.triggerPress||Q===y.itemPress)&&Vt.detail===0,rr=!I&&(Q===y.escapeKey||Q==null);Ce.current=j.event;let Ye=yo(a.state,I,j.trigger,nr());Ye.openChangeReason=Q,w.type==="menubar"&&(Q===y.triggerFocus||Q===y.focusOut||Q===y.triggerHover||Q===y.listNavigation||Q===y.siblingOpen)?Ye.instantType="group":to||rr?Ye.instantType=to?"click":"dismiss":Ye.instantType=void 0,a.update(Ye)}),Me=Co({popupStore:a,floatingRootContext:a.state.floatingRootContext,floatingId:B,nested:b!=null,onOpenChange:xe}),Pe=Me.context.events;ie(()=>{let I=o(({open:j,eventDetails:Q})=>xe(j,Q),"handleSetOpenEvent");return Pe.on("setOpen",I),()=>{Pe?.off("setOpen",I)}},[Pe,xe]);let ve=U.useCallback(()=>{a.setOpen(!1,re(y.imperativeAction))},[a]);U.useImperativeHandle(R,()=>({unmount:le,close:ve}),[le,ve]);let L;w.type==="context-menu"&&(L=w.context),U.useImperativeHandle(L?.positionerRef,()=>ue,[ue]),U.useImperativeHandle(L?.actionsRef,()=>({setOpen:xe}),[xe]);let _=Mo(Me,{enabled:!W,bubbles:{escapeKey:h&&w.type==="menu"},outsidePress(){return w.type!=="context-menu"||Ce.current?.type==="contextmenu"?!0:Re.current},externalTree:pe?H:void 0}),Ie=jo(),qn=U.useCallback(I=>{a.select("activeIndex")!==I&&a.set("activeIndex",I)},[a]),Ae=Vo(Me,{enabled:!W,listRef:a.context.itemDomElements,activeIndex:fe,nested:w.type!==void 0,loopFocus:m,orientation:f,parentOrientation:w.type==="menubar"?w.context.orientation:void 0,rtl:Ie==="rtl",disabledIndices:Ke,onNavigate:qn,openOnArrowKeyDown:w.type!=="context-menu",externalTree:pe?H:void 0,focusItemOnHover:A}),Qn=U.useCallback(I=>{a.context.typingRef.current=I},[a]),Qe=Bo(Me,{enabled:!W,listRef:a.context.itemLabels,elementsRef:a.context.itemDomElements,activeIndex:fe,resetMs:500,onMatch:o(I=>{T&&I!==fe&&a.set("activeIndex",I)},"onMatch"),onTyping:Qn}),Zn=U.useMemo(()=>{let I=he(Qe.reference,Ae.reference,_.reference,{onMouseMove(){a.set("allowMouseEnter",!0)}},ne);return I["aria-haspopup"]="menu",I["aria-expanded"]=T,I},[a,Qe.reference,Ae.reference,_.reference,ne,T]),Zt=U.useMemo(()=>{let I=he(Ae.trigger,_.trigger,ne);return I["aria-haspopup"]="menu",I["aria-expanded"]=!1,I},[Ae.trigger,_.trigger,ne]);Ze(()=>(a.update({inactiveTriggerProps:Zt}),null));let er=U.useMemo(()=>he(vo,{id:B,role:"menu","aria-orientation":f==="horizontal"?"horizontal":void 0,"aria-labelledby":k?.id,onMouseMove(){a.set("allowMouseEnter",!0),w.type==="menu"&&a.set("hoverEnabled",!1)},onClick(){a.select("hoverEnabled")&&a.set("hoverEnabled",!1)},onKeyDown(I){let j=a.select("keyboardEventRelay");j&&!I.isPropagationStopped()&&j(I)}},Qe.floating,Ae.floating,_.floating),[k,B,f,w.type,a,Qe.floating,Ae.floating,_.floating]),tr=Ae.item??se;To(a,{floatingRootContext:Me,activeTriggerProps:Zn,inactiveTriggerProps:Zt,popupProps:er,itemProps:tr});let or=U.useMemo(()=>({store:a,parent:v}),[a,v]),eo=(0,Xe.jsxs)(jt.Provider,{value:or,children:[x&&(0,Xe.jsx)(Io,{handle:x,store:a}),typeof n=="function"?n({payload:ge}):n]});return w.type===void 0||w.type==="context-menu"?(0,Xe.jsx)(Ro,{externalTree:H,children:eo}):eo},"MenuRoot"));function dr(t,e,n){return Ze(()=>new kt(t,e,n)).current}o(dr,"useMenuRootStore");var Gn=M(E(),1);var qt=M(me(),1);function Un(t){let e=D().store,n=Gn.useMemo(()=>({parentMenu:e}),[e]);return(0,qt.jsx)(Xt.Provider,{value:n,children:(0,qt.jsx)(Dt,{...t})})}o(Un,"MenuSubmenuRoot");var $=M(E(),1);var Hn=M(E(),1);function jn(t={}){let{highlightItemOnHover:e,highlightedIndex:n,onHighlightedIndexChange:s}=lt(),{ref:u,index:c}=ae(t),i=n===c,p=Hn.useRef(null),r=et(u,p);return{compositeProps:{tabIndex:i?0:-1,onFocus(){s(c)},onMouseMove(){let f=p.current;if(!e||!f)return;let R=f.hasAttribute("disabled")||f.ariaDisabled==="true";!i&&!R&&f.focus()}},compositeRef:r,index:c}}o(jn,"useCompositeItem");function zn(t){let{render:e,className:n,style:s,state:u=se,props:c=Ke,refs:i=Ke,metadata:p,stateAttributesMapping:r,tag:m="div",...f}=t,{compositeProps:R,compositeRef:h}=jn({metadata:p});return O(m,t,{state:u,ref:[h,...i],props:[R,...c,f],stateAttributesMapping:r})}o(zn,"CompositeItem");function Qt(t){if(oo(t)&&t.hasAttribute("data-rootownerid"))return t.getAttribute("data-rootownerid");if(!no(t))return Qt(ro(t))}o(Qt,"findRootOwnerId");var At=M(E(),1);function Yn(t){let{enabled:e=!0,mouseDownAction:n,open:s}=t,u=At.useRef(!1);return At.useMemo(()=>e?{onMouseDown:o(c=>{(n==="open"&&!s||n==="close"&&s)&&(u.current=!0,$e(c.currentTarget).addEventListener("click",()=>{u.current=!1},{once:!0}))},"onMouseDown"),onClick:o(c=>{u.current&&(u.current=!1,c.preventBaseUIHandler())},"onClick")}:se,[e,n,s])}o(Yn,"useMixedToggleClickHandler");var De=M(me(),1);var Kn=co(o(function(e,n){let{render:s,className:u,style:c,disabled:i=!1,nativeButton:p=!0,id:r,openOnHover:m,delay:f=100,closeDelay:R=0,handle:h,payload:x,...P}=e,S=D(!0),d=_o(h)??S?.store;if(!d)throw new Error(G(85));let g=Z(r),l=d.useState("isTriggerActive",g),V=d.useState("floatingRootContext"),v=d.useState("isOpenedByTrigger",g),C=d.useState("triggerPopupId",g),B=$.useRef(null),b=lr(),z=lt(!0),F=fo(),N=$.useMemo(()=>F??new it,[F]),a=ut(N),H=at(),{registerTrigger:Y,isMountedByThisTrigger:T}=So(g,B,d,{payload:x,closeDelay:R,parent:b,floatingTreeRoot:N,floatingNodeId:a,floatingParentNodeId:H,keyboardEventRelay:z?.relayKeyboardEvent}),k=b.type==="menubar",ue=d.useState("disabled"),te=i||ue||k&&b.context.disabled,{getButtonProps:W,buttonRef:ye}=He({disabled:te,native:p});$.useEffect(()=>{!v&&b.type===void 0&&(d.context.allowMouseUpTriggerRef.current=!1)},[d,v,b.type]);let w=$.useRef(null),fe=Ne(),ge=Se(L=>{if(!w.current)return;fe.clear(),d.context.allowMouseUpTriggerRef.current=!1;let _=L.target;Lt(w.current,_)||Lt(d.select("positionerElement"),_)||_===w.current||_!=null&&Qt(_)===d.select("rootId")||on(L,w.current)||N.events.emit("close",{domEvent:L,reason:y.cancelOpen})});$.useEffect(()=>{v&&d.select("lastOpenChangeReason")===y.triggerHover&&$e(w.current).addEventListener("mouseup",ge,{once:!0})},[v,ge,d]);let ce=k&&b.context.hasSubmenuOpen,Re=dt(V,{enabled:(m??ce)&&!te&&(!k||ce&&!T),handleClose:pt({blockPointerEvents:!k}),mouseOnly:!0,move:!1,restMs:b.type===void 0?f:void 0,delay:{close:R},triggerElementRef:B,externalTree:N,isActiveTrigger:l,isClosing:o(()=>d.select("transitionStatus")==="ending","isClosing")}),de=pr(v,d.select("lastOpenChangeReason")),X=ct(V,{enabled:!te,event:v&&k?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:b.type===void 0?de:!1}),oe=Do(V,{enabled:!te&&ce}),pe=Yn({open:v,enabled:k,mouseDownAction:"open"}),q=$.useMemo(()=>he(oe.reference,X.reference),[oe.reference,X.reference]),ne=d.useState("triggerProps",T),{preFocusGuardRef:le,handlePreFocusGuardFocus:Be,handleFocusTargetFocus:Le}=Go(d,B),xe={disabled:te,open:v},Me=[w,n,ye,Y,B],Pe=[q,Re??se,ne,{"aria-haspopup":"menu","aria-controls":C,id:g,onMouseDown:o(L=>{if(d.select("open"))return;fe.start(200,()=>{d.context.allowMouseUpTriggerRef.current=!0}),$e(L.currentTarget).addEventListener("mouseup",ge,{once:!0})},"onMouseDown")},k?{role:"menuitem"}:{},pe,P,W],ve=O("button",e,{enabled:!k,stateAttributesMapping:Ft,state:xe,ref:Me,props:Pe});return k?(0,De.jsx)(zn,{tag:"button",render:s,className:u,style:c,state:xe,refs:Me,props:Pe,stateAttributesMapping:Ft}):v?(0,De.jsxs)($.Fragment,{children:[(0,De.jsx)(Gt,{ref:le,onFocus:Be},`${g}-pre-focus-guard`),(0,De.jsx)($.Fragment,{children:ve},g),(0,De.jsx)(Gt,{ref:d.context.triggerFocusTargetRef,onFocus:Le},`${g}-post-focus-guard`)]}):(0,De.jsx)($.Fragment,{children:ve},g)},"MenuTrigger"));function pr(t,e){let n=Ne(),[s,u]=$.useState(!1);return ie(()=>{t&&e===y.triggerHover?(u(!0),n.start(500,()=>{u(!1)})):t||(n.clear(),u(!1))},[t,e,n]),s}o(pr,"useStickIfOpen");function lr(){let t=Tt(!0);return $.useMemo(()=>t?{type:"menubar",context:t}:{type:void 0},[t])}o(lr,"useMenuParent");var $n=M(E(),1);var Wn=$n.forwardRef(o(function(e,n){let{render:s,className:u,style:c,children:i,...p}=e,{store:r}=D(),{side:m}=K(),f=r.useState("instantType"),{children:R,state:h}=Qo({store:r,side:m,children:i}),x={activationDirection:h.activationDirection,transitioning:h.transitioning,instant:f};return O("div",e,{state:x,ref:n,props:[p,{children:R}],stateAttributesMapping:qo})},"MenuViewport"));var Ee=M(E(),1);var mr={"aria-expanded":void 0},Jn=Ee.forwardRef(o(function(e,n){let{render:s,className:u,style:c,label:i,id:p,nativeButton:r=!1,openOnHover:m=!0,delay:f=100,closeDelay:R=0,disabled:h=!1,...x}=e,P=_t();if(!P?.parentMenu)throw new Error(G(37));let S=ae({guess:!0,label:i}),A=K(),{store:d}=D(),g=Z(p),l=d.useState("open"),V=d.useState("floatingRootContext"),v=d.useState("floatingTreeRoot"),C=d.useState("triggerPopupId",g),B=Eo(g,d),b=Se(q=>{B(q),q!==null&&d.select("open")&&d.select("activeTriggerId")==null&&d.update({activeTriggerId:g??null,activeTriggerElement:q,closeDelay:R})}),z=Ee.useRef(null),F=Ee.useCallback(q=>{z.current=q,d.set("activeTriggerElement",q)},[d]);ie(()=>(b(z.current),()=>b(null)),[b,g,d]),d.useSyncedValue("closeDelay",R);let N=P.parentMenu,a=d.useState("disabled"),H=N.useState("disabled"),Y=h||a||H,T=N.useState("itemProps"),k=N.useState("isActive",S.index),ue=Ee.useMemo(()=>({type:"submenu-trigger",setActive(){N.select("highlightItemOnHover")&&N.set("activeIndex",S.index)}}),[N,S.index]),{getItemProps:te,itemRef:W}=ke({closeOnClick:!1,disabled:Y,highlighted:k,id:g,store:d,typingRef:N.context.typingRef,nativeButton:r,itemMetadata:ue,nodeId:A?.context.nodeId}),ye=d.useState("hoverEnabled"),w=dt(V,{enabled:ye&&m&&!Y,handleClose:pt({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:f,delay:{open:f,close:R},shouldOpen:f>0?()=>N.select("allowMouseEnter"):void 0,triggerElementRef:z,externalTree:v,isClosing:o(()=>d.select("transitionStatus")==="ending","isClosing"),guardStaleOpen:!0}),ge=ct(V,{enabled:!Y,event:"mousedown",toggle:!m,ignoreMouse:m,stickIfOpen:!1}).reference??se,ce=d.useState("triggerProps",!0);delete ce.id;let Ce={disabled:Y,highlighted:k,open:l},Re=d.useState("openMethod"),X=d.useState("lastOpenChangeReason")===y.listNavigation||Re==="keyboard",oe=l&&X&&tt.screenReader.voiceOver;return O("div",e,{state:Ce,stateAttributesMapping:io,props:[ge,w,ce,T,oe?mr:void 0,{"aria-controls":C,tabIndex:l||k?0:-1,onBlur(){k&&N.set("activeIndex",null)}},x,te],ref:[n,S.ref,W,b,F]})},"MenuSubmenuTrigger"));var qe=class extends ho{static{o(this,"MenuHandle")}constructor(){super(Bn(),"Menu")}open(e){this.openByTrigger(e)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}};function Xn(){return new qe}o(Xn,"createMenuHandle");var J=M(me(),1);function Xc(t){let e=(0,Ve.c)(4),n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=(0,J.jsx)(ee.Root,{"data-slot":"dropdown-menu",...n}),e[2]=n,e[3]=s):s=e[3],s}o(Xc,"N");function qc(t){let e=(0,Ve.c)(4),n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=(0,J.jsx)(ee.Trigger,{"data-slot":"dropdown-menu-trigger",...n}),e[2]=n,e[3]=s):s=e[3],s}o(qc,"z");function Qc({align:t="start",alignOffset:e=0,side:n="bottom",sideOffset:s=4,className:u,...c}){return(0,J.jsx)(ee.Portal,{children:(0,J.jsx)(ee.Positioner,{className:"isolate z-50 outline-none",align:t,alignOffset:e,side:n,sideOffset:s,children:(0,J.jsx)(ee.Popup,{"data-slot":"dropdown-menu-content",className:Fe("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!",u),...c})})})}o(Qc,"D");function Zc(t){let e=(0,Ve.c)(4),n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=(0,J.jsx)(ee.Group,{"data-slot":"dropdown-menu-group",...n}),e[2]=n,e[3]=s):s=e[3],s}o(Zc,"M");function ed(t){let e=(0,Ve.c)(10),n,s,u;e[0]!==t?({className:n,inset:s,...u}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=u):(n=e[1],s=e[2],u=e[3]);let c;e[4]!==n?(c=Fe("px-2 py-2 text-xs text-muted-foreground data-inset:ps-7",n),e[4]=n,e[5]=c):c=e[5];let i;return e[6]!==s||e[7]!==u||e[8]!==c?(i=(0,J.jsx)(ee.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":s,className:c,...u}),e[6]=s,e[7]=u,e[8]=c,e[9]=i):i=e[9],i}o(ed,"y");function td({className:t,inset:e,variant:n="default",...s}){return(0,J.jsx)(ee.Item,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":n,className:Fe("group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-md px-2 py-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:ps-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",t),...s})}o(td,"I");function od(t){let e=(0,Ve.c)(15),n,s,u,c,i;e[0]!==t?({className:u,children:s,checked:n,inset:c,...i}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=u,e[4]=c,e[5]=i):(n=e[1],s=e[2],u=e[3],c=e[4],i=e[5]);let p;e[6]!==u?(p=Fe("relative flex cursor-default items-center gap-2 rounded-md py-2 pe-8 ps-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:ps-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",u),e[6]=u,e[7]=p):p=e[7];let r;e[8]===Symbol.for("react.memo_cache_sentinel")?(r=(0,J.jsx)("span",{className:"pointer-events-none absolute end-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:(0,J.jsx)(ee.CheckboxItemIndicator,{children:(0,J.jsx)(en,{icon:Zo,strokeWidth:2})})}),e[8]=r):r=e[8];let m;return e[9]!==n||e[10]!==s||e[11]!==c||e[12]!==i||e[13]!==p?(m=(0,J.jsxs)(ee.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item","data-inset":c,className:p,checked:n,...i,children:[r,s]}),e[9]=n,e[10]=s,e[11]=c,e[12]=i,e[13]=p,e[14]=m):m=e[14],m}o(od,"_");function nd(t){let e=(0,Ve.c)(8),n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let u;e[3]!==n?(u=Fe("-mx-1 h-px bg-border",n),e[3]=n,e[4]=u):u=e[4];let c;return e[5]!==s||e[6]!==u?(c=(0,J.jsx)(ee.Separator,{"data-slot":"dropdown-menu-separator",className:u,...s}),e[5]=s,e[6]=u,e[7]=c):c=e[7],c}o(nd,"C");export{Xc as a,qc as b,Qc as c,Zc as d,ed as e,td as f,od as g,nd as h};
@@ -0,0 +1 @@
1
+ import{j as u,s as f}from"./chunk-GNI37YCV.js";import{a as S}from"./chunk-GWNGVKLG.js";import{a as h}from"./chunk-6G3E4PJ2.js";import{a as s,d as l}from"./chunk-5PEAXTYQ.js";var i=l(S(),1),c=l(h(),1);var g=s(()=>{let t=(0,i.c)(4),[a,n]=(0,c.useState)(!1),[e,m]=(0,c.useState)(null),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s(p=>{f((async()=>{n(!0),m(null);try{await p()}catch(b){m(u(b))}n(!1)})())},"e"),t[0]=r):r=t[0];let y=r,o;return t[1]!==a||t[2]!==e?(o={busy:a,error:e,run:y},t[1]=a,t[2]=e,t[3]=o):o=t[3],o},"g");export{g as a};
@@ -0,0 +1 @@
1
+ import{B as y,r as w}from"./chunk-GNI37YCV.js";import{a as v}from"./chunk-GWNGVKLG.js";import{b as _}from"./chunk-6G3E4PJ2.js";import{a as m,d as g}from"./chunk-5PEAXTYQ.js";var x=g(v(),1);var a=g(_(),1);var k=m((s,e)=>{if(e==="")return[{match:!1,offset:0,text:s}];let n=[],l=s.toLowerCase(),o=e.toLowerCase(),t=0;for(let r=l.indexOf(o);r!==-1;r=l.indexOf(o,t))r>t&&n.push({match:!1,offset:t,text:s.slice(t,r)}),n.push({match:!0,offset:r,text:s.slice(r,r+e.length)}),t=r+e.length;return t<s.length&&n.push({match:!1,offset:t,text:s.slice(t)}),n},"N"),L=m(s=>{let e=(0,x.c)(9),{highlight:n,value:l}=s;if(l==null){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=(0,a.jsx)("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=d):d=e[0],d}let o,t,r;if(e[1]!==n||e[2]!==l){r=Symbol.for("react.early_return_sentinel");e:{let d=w(l);if(n===void 0||n===""){r=(0,a.jsx)("span",{title:d,children:d});break e}o=d,t=k(d,n).map(j)}e[1]=n,e[2]=l,e[3]=o,e[4]=t,e[5]=r}else o=e[3],t=e[4],r=e[5];if(r!==Symbol.for("react.early_return_sentinel"))return r;let c;return e[6]!==o||e[7]!==t?(c=(0,a.jsx)("span",{title:o,children:t}),e[6]=o,e[7]=t,e[8]=c):c=e[8],c},"v"),O=m(s=>{let e=(0,x.c)(22),{columns:n,rows:l}=s,o=y(),t;e[0]!==o?(t=o("Field"),e[0]=o,e[1]=t):t=e[1];let r;e[2]!==t?(r=(0,a.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]=r):r=e[3];let c;if(e[4]!==l||e[5]!==o){let i;e[7]!==o?(i=m((b,p)=>(0,a.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:o("Row {n}",{n:p+1})},p),"c"),e[7]=o,e[8]=i):i=e[8],c=l.map(i),e[4]=l,e[5]=o,e[6]=c}else c=e[6];let d;e[9]!==r||e[10]!==c?(d=(0,a.jsx)("thead",{className:"sticky top-0 z-10 bg-muted",children:(0,a.jsxs)("tr",{children:[r,c]})}),e[9]=r,e[10]=c,e[11]=d):d=e[11];let f;if(e[12]!==n||e[13]!==l){let i;e[15]!==l?(i=m(b=>(0,a.jsxs)("tr",{className:"hover:bg-muted/40",children:[(0,a.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:b}),l.map((p,N)=>(0,a.jsx)("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:(0,a.jsx)(L,{value:p[b]})},N))]},b),"c"),e[15]=l,e[16]=i):i=e[16],f=n.map(i),e[12]=n,e[13]=l,e[14]=f}else f=e[14];let h;e[17]!==f?(h=(0,a.jsx)("tbody",{children:f}),e[17]=f,e[18]=h):h=e[18];let u;return e[19]!==d||e[20]!==h?(u=(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:(0,a.jsxs)("table",{className:"border-collapse text-xs",children:[d,h]})}),e[19]=d,e[20]=h,e[21]=u):u=e[21],u},"T"),T=m(({children:s,layout:e="card",testId:n})=>(0,a.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":n,children:s}),"j");function j(s){return(0,a.jsx)("mark",{className:s.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:s.text},s.offset)}m(j,"_");export{L as a,O as b,T as c};
@@ -0,0 +1 @@
1
+ "use client";import{e}from"./chunk-TW4O2BA5.js";import"./chunk-4EPW63HS.js";import"./chunk-PDBW6GTJ.js";import"./chunk-6G3E4PJ2.js";import"./chunk-5PEAXTYQ.js";export{e as Mermaid};
@@ -1,4 +1,4 @@
1
- import{a as V,b as F,c as J,d as K,e as B,f as A,g as I,h as M}from"./chunk-YMEKCV27.js";import{a as P}from"./chunk-TYD3V4NB.js";import{a as z}from"./chunk-FXPAJDES.js";import{B as W,l as L,v as D,x as U,y as Q}from"./chunk-BFE2DRP6.js";import{a as g,d as q,e as ee,f as te,g as le}from"./chunk-OXFKZ4BM.js";var _=q(te(),1),E=q(ee(),1);var T="inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",fe=`${T} aria-pressed:bg-accent aria-pressed:text-accent-foreground`;var s=q(le(),1);var X=g(l=>`"${l.replaceAll('"','""')}"`,"q"),ne=/["\n\r,]/u,oe=/^[=+\-@\t\r]/u,Y=g(l=>{if(l==null)return"";let e;return typeof l=="string"?e=oe.test(l)?` ${l}`:l:typeof l=="number"||typeof l=="boolean"||typeof l=="bigint"?e=String(l):e=U(l),ne.test(e)?`"${e.replaceAll('"','""')}"`:e},"J"),ae=g((l,e)=>{let n=l.map(t=>Y(t)).join(","),o=e.map(t=>l.map(c=>Y(t[c])).join(","));return[n,...o].join(`
1
+ import{a as P}from"./chunk-66BMMNUR.js";import{a as V,b as F,c as J,d as K,e as B,f as A,g as I,h as M}from"./chunk-JD6PRRFO.js";import{a as z}from"./chunk-YEVTA35E.js";import{B as L,p as D,r as U,s as Q,v as W}from"./chunk-GNI37YCV.js";import{a as te}from"./chunk-GWNGVKLG.js";import{a as ee,b as le}from"./chunk-6G3E4PJ2.js";import{a as g,d as q}from"./chunk-5PEAXTYQ.js";var _=q(te(),1),E=q(ee(),1);var T="inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",fe=`${T} aria-pressed:bg-accent aria-pressed:text-accent-foreground`;var s=q(le(),1);var X=g(l=>`"${l.replaceAll('"','""')}"`,"q"),ne=/["\n\r,]/u,oe=/^[=+\-@\t\r]/u,Y=g(l=>{if(l==null)return"";let e;return typeof l=="string"?e=oe.test(l)?` ${l}`:l:typeof l=="number"||typeof l=="boolean"||typeof l=="bigint"?e=String(l):e=U(l),ne.test(e)?`"${e.replaceAll('"','""')}"`:e},"J"),ae=g((l,e)=>{let n=l.map(t=>Y(t)).join(","),o=e.map(t=>l.map(c=>Y(t[c])).join(","));return[n,...o].join(`
2
2
  `)},"ne"),se=g(l=>JSON.stringify(l,D,2),"oe"),Z=500,re=g(l=>l==null?"NULL":typeof l=="number"?Number.isFinite(l)?String(l):"NULL":typeof l=="bigint"?String(l):typeof l=="boolean"?l?"1":"0":`'${(typeof l=="string"?l:U(l)).replaceAll("'","''")}'`,"K"),G="__doc__",ie=g((l,e,n,o)=>{if(e.length===0||n.length===0)return"";let t=o?.includes(G)===!0&&!e.includes(G)?e.filter(d=>!o.includes(d)):void 0,c=t===void 0?e:o,r=g((d,b)=>re(t===void 0||b!==G?d[b]:JSON.stringify(Object.fromEntries(t.map(u=>[u,d[u]])),D)),"i"),a=c.map(d=>X(d)).join(", "),i=[];for(let d=0;d<n.length;d+=Z){let b=n.slice(d,d+Z).map(u=>` (${c.map(m=>r(u,m)).join(", ")})`).join(`,
3
3
  `);i.push(`INSERT INTO ${X(l)} (${a}) VALUES
4
4
  ${b};`)}return i.join(`
@@ -0,0 +1 @@
1
+ import{a as dt}from"./chunk-3X3NXJBR.js";import{a as st}from"./chunk-ELSQ4FVH.js";import"./chunk-HCOF7HOM.js";import{a as De}from"./chunk-TKBTZX4K.js";import"./chunk-5GYHGDIF.js";import"./chunk-Y2YLTUMD.js";import"./chunk-JD6PRRFO.js";import"./chunk-NGZNXNRD.js";import"./chunk-2SNHKJXK.js";import"./chunk-BCUOQNI2.js";import"./chunk-P5EVJEGC.js";import"./chunk-D65UVZIA.js";import"./chunk-NGVP66OH.js";import"./chunk-QAOZXPLU.js";import{a as at}from"./chunk-J45HAKBU.js";import{a as ot}from"./chunk-YEVTA35E.js";import{a as tt}from"./chunk-FHLODLBC.js";import{b as et}from"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import{h as Be,i as We}from"./chunk-RTS5G3ET.js";import"./chunk-QRA7AKYO.js";import{i as Ge}from"./chunk-IHGRWY3Y.js";import"./chunk-OWRKSQPE.js";import"./chunk-4EPW63HS.js";import{a as Ze}from"./chunk-V3BE427M.js";import"./chunk-CKEQX655.js";import"./chunk-UD5REVU2.js";import{a as qe}from"./chunk-RCXNYW7P.js";import{b as Ve}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as Te}from"./chunk-YEXTJUKQ.js";import"./chunk-LSEUUZN4.js";import{a as rt,b as it,c as nt,d as _e,e as q,f as T}from"./chunk-7QEZ2SFW.js";import"./chunk-OZAOWE7T.js";import"./chunk-BBDTJG2K.js";import"./chunk-4PI2OSSP.js";import{a as F}from"./chunk-2W4UO5BC.js";import{c as de}from"./chunk-4N76XUNG.js";import{a as Xe,e as Ye}from"./chunk-OK2QU2EV.js";import{m as Qe}from"./chunk-SHHGIT7M.js";import"./chunk-ZPQBVYNN.js";import{B as ce,h as Ue,i as ze,j as He,s as Oe,w as je,x as le}from"./chunk-GNI37YCV.js";import"./chunk-PDBW6GTJ.js";import{a as Ae}from"./chunk-GWNGVKLG.js";import{a as Je,b as Pe}from"./chunk-6G3E4PJ2.js";import{a as s,d as se}from"./chunk-5PEAXTYQ.js";var be=se(Ae(),1),he=se(Je(),1);var lt=se(Ae(),1),S=se(Je(),1);var m=se(Pe(),1);var qt=Ue(F.runMigration),ct=s(t=>{let e=(0,lt.c)(98),{initialShardKey:r}=t,i=Qe(),a=ce(),{queryShardKey:o,setShardKey:n,shardKey:d}=at(r),[l,f]=(0,S.useState)(""),[h,g]=(0,S.useState)("up"),[p,b]=(0,S.useState)(!0),[y,x]=(0,S.useState)(!1),[v,u]=(0,S.useState)(null),[w,k]=(0,S.useState)(null),L;e[0]!==d?(L=d.trim(),e[0]=d,e[1]=L):L=e[1];let C=L===o,j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j={},e[2]=j):j=e[2];let M;e[3]!==o?(M={live:!0,shardKey:o},e[3]=o,e[4]=M):M=e[4];let $=de(F.migrationStatus,j,M),N=$.data?.migrations??null,Ie=$.error,{errorSource:Fe,liveError:Re}=$,ye,ve;e[5]!==o||e[6]!==$.data?(ye=s(()=>{$.data!==void 0&&et(o)},"W"),ve=[$.data,o],e[5]=o,e[6]=$.data,e[7]=ye,e[8]=ve):(ye=e[7],ve=e[8]),(0,S.useEffect)(ye,ve);let xe;if(e[9]!==i||e[10]!==h||e[11]!==p||e[12]!==l||e[13]!==d||e[14]!==$||e[15]!==a){let I=s(async()=>{let Ee=l.trim();if(Ee===""){k(a("Enter a migration id")),u(null);return}x(!0),k(null);try{let Le=await i.query(qt,{direction:h,dryRun:p,id:Ee},ze(d));u(Le),$.refetch()}catch(Le){let jt=Le;u(null),k(He(jt))}x(!1)},"u");xe=s(()=>{Oe(I())},"V"),e[9]=i,e[10]=h,e[11]=p,e[12]=l,e[13]=d,e[14]=$,e[15]=a,e[16]=xe}else xe=e[16];let ke=xe,we;e[17]===Symbol.for("react.memo_cache_sentinel")?(we=s(I=>{f(I.target.value)},"Y"),e[17]=we):we=e[17];let Nt=we,$e;e[18]===Symbol.for("react.memo_cache_sentinel")?($e=s(I=>{g(I.target.value==="down"?"down":"up")},"Z"),e[18]=$e):$e=e[18];let St=$e,Ne;e[19]===Symbol.for("react.memo_cache_sentinel")?(Ne=s(I=>{b(I.target.checked)},"ee"),e[19]=Ne):Ne=e[19];let Ot=Ne,_;e[20]!==n||e[21]!==d?(_=(0,m.jsx)(tt,{onChange:n,testId:"mg-shard-input",value:d}),e[20]=n,e[21]=d,e[22]=_):_=e[22];let D;e[23]!==Re?(D=(0,m.jsx)(st,{message:Re,prefix:"mg"}),e[23]=Re,e[24]=D):D=e[24];let K;e[25]!==_||e[26]!==D?(K=(0,m.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[_,D]}),e[25]=_,e[26]=D,e[27]=K):K=e[27];let E;e[28]!==Ie||e[29]!==Fe?(E=Ie!==null&&(0,m.jsx)(Te,{error:Fe,testId:"mg-status-error"}),e[28]=Ie,e[29]=Fe,e[30]=E):E=e[30];let J;e[31]!==N||e[32]!==a?(J=N!==null&&N.length===0&&(0,m.jsx)(qe,{description:a("Data migrations you run against this shard will be tracked here."),icon:(0,m.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,m.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:a("No migrations have run on this shard.")}),e[31]=N,e[32]=a,e[33]=J):J=e[33];let A;e[34]!==N||e[35]!==a?(A=N!==null&&N.length>0&&(0,m.jsx)(Xe,{className:"overflow-hidden py-0",children:(0,m.jsx)(Ye,{className:"px-0",children:(0,m.jsxs)(rt,{"data-testid":"mg-table",children:[(0,m.jsx)(it,{children:(0,m.jsxs)(_e,{children:[(0,m.jsx)(q,{children:a("id")}),(0,m.jsx)(q,{children:a("direction")}),(0,m.jsx)(q,{children:a("status")}),(0,m.jsx)(q,{children:a("processed")}),(0,m.jsx)(q,{children:a("changed")}),(0,m.jsx)(q,{children:a("updated")}),(0,m.jsx)(q,{children:a("error")})]})}),(0,m.jsx)(nt,{children:N.map(Tt)})]})})}),e[34]=N,e[35]=a,e[36]=A):A=e[36];let P;e[37]!==a?(P=a("Run migration"),e[37]=a,e[38]=P):P=e[38];let B;e[39]!==P?(B=(0,m.jsx)(De,{children:P}),e[39]=P,e[40]=B):B=e[40];let W;e[41]!==a?(W=a("Migration id"),e[41]=a,e[42]=W):W=e[42];let U;e[43]!==a?(U=a("migration id"),e[43]=a,e[44]=U):U=e[44];let z;e[45]!==l||e[46]!==W||e[47]!==U?(z=(0,m.jsx)(Ge,{"aria-label":W,className:"w-auto","data-testid":"mg-id-input",onChange:Nt,placeholder:U,value:l}),e[45]=l,e[46]=W,e[47]=U,e[48]=z):z=e[48];let H;e[49]!==a?(H=a("Direction"),e[49]=a,e[50]=H):H=e[50];let Q;e[51]!==a?(Q=a("up"),e[51]=a,e[52]=Q):Q=e[52];let V;e[53]!==Q?(V=(0,m.jsx)("option",{value:"up",children:Q}),e[53]=Q,e[54]=V):V=e[54];let G;e[55]!==a?(G=a("down"),e[55]=a,e[56]=G):G=e[56];let Z;e[57]!==G?(Z=(0,m.jsx)("option",{value:"down",children:G}),e[57]=G,e[58]=Z):Z=e[58];let X;e[59]!==h||e[60]!==H||e[61]!==V||e[62]!==Z?(X=(0,m.jsxs)("select",{"aria-label":H,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:St,value:h,children:[V,Z]}),e[59]=h,e[60]=H,e[61]=V,e[62]=Z,e[63]=X):X=e[63];let Y;e[64]!==p?(Y=(0,m.jsx)("input",{checked:p,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:Ot,type:"checkbox"}),e[64]=p,e[65]=Y):Y=e[65];let ee;e[66]!==a?(ee=a("Dry run"),e[66]=a,e[67]=ee):ee=e[67];let te;e[68]!==Y||e[69]!==ee?(te=(0,m.jsxs)(De,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[Y,ee]}),e[68]=Y,e[69]=ee,e[70]=te):te=e[70];let ae;e[71]!==p||e[72]!==ke||e[73]!==y||e[74]!==C||e[75]!==a?(ae=p?(0,m.jsx)(Ze,{"data-testid":"mg-run",disabled:y||!C,onClick:ke,type:"button",children:a(y?"Running\u2026":"Run")}):(0,m.jsx)(ot,{confirmLabel:a(y?"Running\u2026":"Run migration?"),disabled:y||!C,onConfirm:ke,testId:"mg-run",children:a("Run")}),e[71]=p,e[72]=ke,e[73]=y,e[74]=C,e[75]=a,e[76]=ae):ae=e[76];let re;e[77]!==z||e[78]!==X||e[79]!==te||e[80]!==ae?(re=(0,m.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[z,X,te,ae]}),e[77]=z,e[78]=X,e[79]=te,e[80]=ae,e[81]=re):re=e[81];let ie;e[82]!==B||e[83]!==re?(ie=(0,m.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[B,re]}),e[82]=B,e[83]=re,e[84]=ie):ie=e[84];let ne;e[85]!==w?(ne=w!==null&&(0,m.jsx)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:w}),e[85]=w,e[86]=ne):ne=e[86];let oe;e[87]!==v||e[88]!==a?(oe=v!==null&&(0,m.jsxs)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[v.dryRun?a("Dry run: "):"",a("{status} \u2014 processed",{status:v.status}),v.processed,a(", changed"),v.changed]}),e[87]=v,e[88]=a,e[89]=oe):oe=e[89];let Se;return e[90]!==K||e[91]!==E||e[92]!==J||e[93]!==A||e[94]!==ie||e[95]!==ne||e[96]!==oe?(Se=(0,m.jsxs)("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[K,E,J,A,ie,ne,oe]}),e[90]=K,e[91]=E,e[92]=J,e[93]=A,e[94]=ie,e[95]=ne,e[96]=oe,e[97]=Se):Se=e[97],Se},"yt");function Tt(t){return(0,m.jsxs)(_e,{"data-testid":`mg-row-${t.id}`,children:[(0,m.jsx)(T,{children:t.id}),(0,m.jsx)(T,{children:t.direction}),(0,m.jsx)(T,{children:(0,m.jsx)(Ve,{variant:"secondary",children:t.status})}),(0,m.jsx)(T,{children:t.processed}),(0,m.jsx)(T,{children:t.changed}),(0,m.jsx)(T,{children:je(t.updatedAt)}),(0,m.jsx)(T,{children:t.error??""})]},t.id)}s(Tt,"Je");var c=se(Pe(),1);var Ke=1;function Ct(t){let e={},r=Object.keys(t);r.sort();for(let i of r)e[i]=t[i];return e}s(Ct,"me");var me=s(t=>typeof t=="object"&&t!==null,"O"),Mt=s(t=>me(t)&&me(t.fields)&&me(t.indexes)&&me(t.relations)&&typeof t.shardMode=="string","ue"),It=s(t=>{if(t===void 0||t.trim()==="")return{status:"absent"};let e;try{e=JSON.parse(t)}catch(r){return{error:`baseline is not valid JSON: ${r instanceof Error?r.message:String(r)}`,status:"invalid"}}if(!me(e)||e.version!==Ke||!me(e.tables))return{error:`baseline is malformed or written by an incompatible version (expected version ${String(Ke)})`,status:"invalid"};for(let[r,i]of Object.entries(e.tables))if(!Mt(i))return{error:`baseline table "${r}" has an invalid structure`,status:"invalid"};return{snapshot:{jurisdiction:typeof e.jurisdiction=="string"?e.jurisdiction:void 0,migrationIds:Array.isArray(e.migrationIds)?e.migrationIds:[],tables:e.tables,version:Ke},status:"ok"}},"fe"),Ft=s((t,e)=>t.unique===e.unique&&t.fields.length===e.fields.length&&t.fields.every((r,i)=>r===e.fields[i]),"he"),mt=s(t=>t.unique!==void 0,"V"),ge=s(({nullable:t,optional:e,refined:r,unique:i,...a})=>JSON.stringify(Ct(a)),"q"),ut=s(t=>({form:JSON.stringify([ge(t),t.optional===!0,t.nullable===!0]),refined:t.refined===!0}),"G"),ht=s(t=>t.kind==="union"&&t.members?t.members.map(e=>ut(e)):[ut({...t,nullable:!1,optional:!1})],"Q"),Rt=s((t,e)=>{if(e.kind!=="union")return!1;let r=ht(e);return ht(t).every(i=>r.some(a=>a.form===i.form&&(i.refined||!a.refined)))},"pe"),O=s(t=>{switch(t.kind){case"array":return`array(${t.of?O(t.of):"?"})`;case"from":return t.output===void 0?"from":`from(${t.output})`;case"id":return`id(${t.ref??"?"})`;case"literal":return`literal(${t.literal??"?"})`;case"object":return`object({ ${Object.keys(t.fields??{}).join(", ")} })`;case"record":return`record(${t.key?O(t.key):"?"}, ${t.of?O(t.of):"?"})`;case"union":return(t.members??[]).map(e=>O(e)).join(" | ");default:return t.kind}},"x"),fe=s((t,e,r)=>({remediation:"backfill",scope:"table",severity:"breaking",summary:r,table:t,type:e}),"F"),pe=s((t,e,r)=>({remediation:"none",scope:"table",severity:"safe",summary:r,table:t,type:e}),"T"),kt=s((t,e)=>{let r=JSON.stringify(t),i=JSON.stringify(e);return r===i?0:r<i?-1:1},"Z"),ue=s(t=>({...t,...t.kind==="from"?{output:void 0}:{},...t.fields?{fields:Object.fromEntries(Object.entries(t.fields).map(([e,r])=>[e,ue(r)]))}:{},...t.key?{key:ue(t.key)}:{},...t.of?{of:ue(t.of)}:{},...t.members?{members:t.members.map(e=>ue(e)).toSorted(kt)}:{}}),"S"),ft=s(t=>t.kind==="union"?t.members??[]:[t],"U"),Lt=s((t,e)=>{let r=[...t],i=[...e],a=new Set,o=new Set,n=s((d,l)=>{for(let[f,h]of r.entries()){if(o.has(f))continue;let g=i.findIndex((p,b)=>!a.has(b)&&d(h,p));g!==-1&&(a.add(g),o.add(f),l&&([r[f],i[g]]=Me(h,i[g])))}},"s");return n((d,l)=>JSON.stringify(d)===JSON.stringify(l),!1),n((d,l)=>ge(ue(d))===ge(ue(l)),!0),[r,i]},"ge"),Me=s((t,e)=>{if(t.kind==="union"||e.kind==="union"){let[a,o]=Lt(ft(t),ft(e)),n=s((d,l)=>d.kind==="union"?{...d,members:l.toSorted(kt)}:l[0],"s");return[n(t,a),n(e,o)]}if(t.kind!==e.kind)return[t,e];if(t.kind==="from")return t.output===void 0||e.output===void 0?[{...t,output:void 0},{...e,output:void 0}]:[t,e];let r={...t.fields?{fields:{...t.fields}}:{}},i={...e.fields?{fields:{...e.fields}}:{}};for(let a of["key","of"])t[a]&&e[a]&&([r[a],i[a]]=Me(t[a],e[a]));for(let a of Object.keys(t.fields??{})){let o=t.fields?.[a],n=e.fields?.[a];o&&n&&r.fields&&i.fields&&([r.fields[a],i.fields[a]]=Me(o,n))}return[{...t,...r},{...e,...i}]},"I"),_t=s((t,e,r,i,a)=>{let[o,n]=Me(r,i);if(o.kind===n.kind&&(!a||ge(o)===ge(n)))return;if(a&&Rt(o,n))return pe(t,"widenedFieldShape",`field ${t}.${e} widened: ${O(o)} \u2192 ${O(n)} \u2014 every stored value stays valid`);if(o.kind!==n.kind)return fe(t,"changedFieldKind",`field ${t}.${e} changed type: ${o.kind} \u2192 ${n.kind} \u2014 add a data migration to convert existing values`);let d=Object.values(n.fields??{});return a&&o.kind==="object"&&Object.keys(o.fields??{}).length===0&&d.length>0&&d.every(l=>l.optional)?pe(t,"widenedFieldShape",`field ${t}.${e} now records its optional object shape \u2014 stored values stay valid`):fe(t,"changedFieldShape",`field ${t}.${e} changed shape: ${O(o)} \u2192 ${O(n)} \u2014 stored values were written against the old shape; add a data migration to convert them`)},"be"),Dt=s((t,e,r,i)=>{let a=[];return r.unique!==i.unique&&a.push(i.unique===!0?fe(t,"addedFieldConstraint",`field ${t}.${e} became unique \u2014 existing duplicates would violate it; add a data migration to de-duplicate first`):pe(t,"relaxedFieldConstraint",`field ${t}.${e} is no longer unique`)),r.nullable!==i.nullable&&a.push(i.nullable===!0?pe(t,"relaxedFieldConstraint",`field ${t}.${e} became nullable`):fe(t,"addedFieldConstraint",`field ${t}.${e} is no longer nullable \u2014 rows holding NULL would be invalid; add a data migration to backfill them`)),r.refined!==i.refined&&a.push(i.refined===!0?fe(t,"addedFieldConstraint",`field ${t}.${e} gained a validation refinement \u2014 stored values were never checked against it; add a data migration if any could fail`):pe(t,"relaxedFieldConstraint",`field ${t}.${e} dropped its validation refinement`)),a},"ye"),wt=s((t,e,r,i)=>{let a=[],o=mt(r)&&mt(i),n=_t(t,e,r,i,o);return n&&a.push(n),o&&a.push(...Dt(t,e,r,i)),r.optional&&!i.optional?a.push({remediation:"backfill",severity:"breaking",summary:`field ${t}.${e} became required \u2014 rows missing it would be invalid; add a data migration to backfill it`,table:t,scope:"table",type:"fieldOptionalToRequired"}):!r.optional&&i.optional&&a.push({remediation:"none",scope:"table",severity:"safe",summary:`field ${t}.${e} became optional`,table:t,type:"fieldRequiredToOptional"}),a},"N"),Kt=s((t,e,r)=>r.optional?{remediation:"none",scope:"table",severity:"safe",summary:`added optional field ${t}.${e}`,table:t,type:"addedOptionalField"}:{remediation:"backfill",severity:"breaking",summary:`added required field ${t}.${e} \u2014 existing rows have no value; add a data migration to backfill it`,table:t,scope:"table",type:"addedRequiredField"},"ve"),Et=s((t,e,r,i)=>{for(let[a,o]of Object.entries(r.fields)){let n=e.fields[a];n===void 0?i.push(Kt(t,a,o)):i.push(...wt(t,a,n,o))}for(let a of Object.keys(e.fields))r.fields[a]===void 0&&i.push({remediation:"backfill",severity:"breaking",summary:`removed field ${t}.${a} \u2014 add a data migration if stored data must be cleaned up`,table:t,scope:"table",type:"removedField"})},"xe"),Jt=s((t,e,r,i)=>{for(let[a,o]of Object.entries(r.indexes)){let n=e.indexes[a];if(n===void 0){i.push(o.unique?{remediation:"backfill",scope:"table",severity:"breaking",summary:`added unique index ${a} on ${t} \u2014 existing duplicates would violate it; add a data migration to de-duplicate first`,table:t,type:"addedIndex"}:{remediation:"none",scope:"table",severity:"safe",summary:`added index ${a} on ${t}`,table:t,type:"addedIndex"});continue}Ft(n,o)||i.push({remediation:"code",severity:"breaking",summary:`index ${a} on ${t} changed shape \u2014 a query may have relied on the old index`,table:t,scope:"table",type:"changedIndex"})}for(let a of Object.keys(e.indexes))r.indexes[a]===void 0&&i.push({remediation:"code",severity:"breaking",summary:`removed index ${a} on ${t} \u2014 a query that used \`.withIndex("${a}")\` would break`,table:t,scope:"table",type:"removedIndex"})},"ke"),At=s((t,e,r,i)=>{for(let a of Object.keys(r.relations))e.relations[a]===void 0&&i.push({remediation:"none",scope:"schema",severity:"safe",summary:`added relation ${t}.${a}`,table:t,type:"addedRelation"});for(let a of Object.keys(e.relations))r.relations[a]===void 0&&i.push({remediation:"code",scope:"schema",severity:"breaking",summary:`removed relation ${t}.${a}`,table:t,type:"removedRelation"})},"$e"),pt="shardBy:_unknown_",Ce="global",Pt=s((t,e)=>t===Ce&&e.startsWith(`${Ce}:`)||e===Ce&&t.startsWith(`${Ce}:`),"we"),Bt=s((t,e,r)=>{if(e===r)return r!==pt?void 0:{remediation:"rehome",scope:"table",severity:"breaking",summary:`table ${t} declares a non-literal .shardBy(...) key, so codegen cannot read which column partitions it \u2014 every such key records as "${pt}" and two DIFFERENT keys would compare equal. Pass the shard key as a string literal; until then this is reported on every run, because the alternative is a silent pass on a re-home that strands every row (export/import is the only way back).`,table:t,type:"changedShardMode"};if(!Pt(e,r))return{remediation:"rehome",severity:"breaking",summary:`table ${t} changed shard mode: ${e} \u2192 ${r} \u2014 its physical storage moves, and existing rows do NOT follow the schema; re-home them with an export/import round trip (https://lunora.sh/docs/concepts/sharding#migrating-a-populated-table)`,table:t,scope:"table",type:"changedShardMode"}},"Oe"),gt=s(t=>t.memory!==void 0,"B"),bt=s(t=>t.after??0,"K"),R=s(t=>t.after===void 0?`.ttl("${t.field}")`:`.ttl("${t.field}", { after: ${String(t.after)} })`,"w"),Wt=s((t,e,r)=>{if(e===void 0&&r===void 0)return;let i=s(d=>({remediation:"backfill",scope:"table",severity:"breaking",summary:d,table:t,type:"changedTtlPolicy"}),"i"),a=s(d=>({remediation:"none",scope:"table",severity:"safe",summary:d,table:t,type:"changedTtlPolicy"}),"o");if(r===void 0)return a(`table ${t} dropped its TTL policy \u2014 its rows are no longer swept`);if(e===void 0)return i(`table ${t} gained a TTL policy ${R(r)} \u2014 every row already past the cutoff is deleted on the next alarm sweep; add a data migration to refresh or clear "${r.field}" on the rows written before it`);if(e.field!==r.field)return i(`table ${t} moved its TTL to a different column: ${R(e)} \u2192 ${R(r)} \u2014 rows are now expired by a column they were never written against; add a data migration to populate "${r.field}"`);let o=bt(e),n=bt(r);return n<o?i(`table ${t} shortened its TTL: ${R(e)} \u2192 ${R(r)} \u2014 rows that were not expired under the old offset are deleted on the next alarm sweep; add a data migration to refresh "${r.field}" on the rows that must survive`):n>o?a(`table ${t} lengthened its TTL: ${R(e)} \u2192 ${R(r)}`):void 0},"Se"),Ut=s((t,e,r)=>{let i=[];return e.memory!==r.memory&&i.push(r.memory===!0?{remediation:"rehome",scope:"table",severity:"breaking",summary:`table ${t} became a .memory() table \u2014 every row is deleted in every shard on the next Durable Object cold start, and no data migration survives that; export the rows first if they must be kept, or revert`,table:t,type:"changedMemoryMode"}:{remediation:"none",scope:"table",severity:"safe",summary:`table ${t} is no longer a .memory() table \u2014 its rows now survive a cold start`,table:t,type:"changedMemoryMode"}),e.commitOrdered!==r.commitOrdered&&i.push(r.commitOrdered===!0?{remediation:"backfill",scope:"table",severity:"breaking",summary:`table ${t} became .commitOrdered() \u2014 rows written before it carry no _commitSeq, so a \`_commitSeq > cursor\` changefeed never offers them; add a data migration over the table to stamp them (the rewrite allocates a sequence)`,table:t,type:"changedCommitOrdering"}:{remediation:"code",scope:"table",severity:"breaking",summary:`table ${t} is no longer .commitOrdered() \u2014 new rows carry no _commitSeq, so a \`_commitSeq > cursor\` changefeed stops advancing without erroring; update the consumers before deploying`,table:t,type:"changedCommitOrdering"}),i},"je"),zt=s((t,e,r,i)=>{let a=Bt(t,e.shardMode,r.shardMode);if(a&&i.push(a),gt(e)&&gt(r)){i.push(...Ut(t,e,r));let o=Wt(t,e.ttl,r.ttl);o&&i.push(o)}Et(t,e,r,i),Jt(t,e,r,i),At(t,e,r,i)},"Fe"),Ht=s((t,e)=>{let r=[],i=t?.tables??{};for(let[a,o]of Object.entries(e.tables)){let n=i[a];if(n===void 0){r.push({remediation:"none",scope:"table",severity:"safe",summary:`added table ${a}`,table:a,type:"addedTable"});continue}zt(a,n,o,r)}for(let a of Object.keys(i))e.tables[a]===void 0&&r.push({remediation:"rehome",scope:"table",severity:"breaking",summary:`removed table ${a} \u2014 its rows stay in each shard's SQLite, unreachable through the schema; export the shard first if the data must be kept`,table:a,type:"removedTable"});if(t!==void 0&&t.jurisdiction!==e.jurisdiction){let a=t.jurisdiction??"(none)",o=e.jurisdiction??"(none)";r.push({remediation:"rehome",scope:"schema",severity:"breaking",summary:`Durable Object jurisdiction changed from ${a} to ${o} \u2014 this re-homes every DO and strands all existing shard, scheduler, and session-DO data in the old region (no in-place migration; export then import to move it). Revert the change, or override the gate to proceed intentionally.`,type:"changedJurisdiction"})}return{changes:r}},"Te"),yt=s(t=>Object.entries(t.fields).map(([e,r])=>({name:e,optional:r.optional,ref:Object.values(t.relations).find(i=>i.field===e&&i.kind==="one")?.table,type:O(r)})),"Y"),vt=s((t,e,r)=>{let i={},a=e?.fields??{},o=r?.fields??{};for(let[n,d]of Object.entries(o)){let l=a[n];l===void 0?i[n]=e===void 0?"unchanged":"added":i[n]=wt(t,n,l,d).length===0?"unchanged":"changed"}for(let n of Object.keys(a))o[n]===void 0&&(i[n]="removed");return i},"z"),Qt=s((t,e)=>{let{changes:r}=Ht(t,e),i=new Set(r.filter(n=>n.scope==="table"&&n.table!==void 0).map(n=>n.table)),a=[],o=s((n,d)=>n?"added":i.has(d)?"changed":"context","r");for(let[n,d]of Object.entries(e.tables)){let l=t?.tables[n],f=o(l===void 0,n);a.push({columns:yt(d),fieldStatus:vt(n,l,d),name:n,shardMode:d.shardMode,status:f})}for(let[n,d]of Object.entries(t?.tables??{}))e.tables[n]===void 0&&a.push({columns:yt(d),fieldStatus:vt(n,d,void 0),name:n,shardMode:d.shardMode,status:"removed"});return a.sort((n,d)=>n.name.localeCompare(d.name)),{breakingCount:r.filter(n=>n.severity==="breaking").length,changes:r,tables:a}},"Me"),xt=s(t=>{let e=It(t);return e.status==="ok"?e.snapshot:void 0},"X"),Vt={added:"ring-2 ring-emerald-500/60",changed:"ring-2 ring-amber-500/70",context:"opacity-55",removed:"opacity-70 ring-2 ring-destructive/60"},Gt=s(t=>t==="global"||t.startsWith("global:")?"global":"shard","Ce"),Zt=s(t=>{let e=(0,be.c)(24),{appliedAt:r,hash:i,onSelect:a,selected:o,seq:n}=t,d=o?"border-s-primary bg-accent/60 text-foreground":"border-s-transparent text-muted-foreground hover:bg-accent/30 hover:text-foreground",l;e[0]!==d?(l=le("flex w-full flex-col items-start gap-1 border-s-2 px-4 py-3 text-start outline-none transition-colors",d),e[0]=d,e[1]=l):l=e[1];let f=`sh-version-${i}`,h;e[2]!==i||e[3]!==a?(h=s(()=>{a(i)},"f"),e[2]=i,e[3]=a,e[4]=h):h=e[4];let g;e[5]!==n?(g=(0,c.jsxs)("span",{className:"font-mono text-[13px] tabular-nums",children:["v",n]}),e[5]=n,e[6]=g):g=e[6];let p;e[7]!==i?(p=i.slice(0,7),e[7]=i,e[8]=p):p=e[8];let b;e[9]!==p?(b=(0,c.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-wider text-muted-foreground/70 uppercase",children:p}),e[9]=p,e[10]=b):b=e[10];let y;e[11]!==g||e[12]!==b?(y=(0,c.jsxs)("span",{className:"flex w-full items-baseline gap-2",children:[g,b]}),e[11]=g,e[12]=b,e[13]=y):y=e[13];let x;e[14]!==r?(x=je(r),e[14]=r,e[15]=x):x=e[15];let v;e[16]!==x?(v=(0,c.jsx)("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground/70",children:x}),e[16]=x,e[17]=v):v=e[17];let u;return e[18]!==v||e[19]!==l||e[20]!==f||e[21]!==h||e[22]!==y?(u=(0,c.jsx)("li",{children:(0,c.jsxs)("button",{className:l,"data-testid":f,onClick:h,type:"button",children:[y,v]})}),e[18]=v,e[19]=l,e[20]=f,e[21]=h,e[22]=y,e[23]=u):u=e[23],u},"Ie"),Xt=s(t=>{let e=(0,be.c)(26),{breaking:r,count:i,first:a}=t,o=ce();if(a){let b;e[0]!==i?(b=(0,c.jsx)("span",{className:"text-3xl leading-none font-light tracking-tight tabular-nums",children:i}),e[0]=i,e[1]=b):b=e[1];let y;e[2]!==o?(y=o("tables"),e[2]=o,e[3]=y):y=e[3];let x;e[4]!==y?(x=(0,c.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:y}),e[4]=y,e[5]=x):x=e[5];let v;return e[6]!==b||e[7]!==x?(v=(0,c.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[b,x]}),e[6]=b,e[7]=x,e[8]=v):v=e[8],v}let n=r>0&&"text-destructive",d;e[9]!==n?(d=le("text-3xl leading-none font-light tracking-tight tabular-nums",n),e[9]=n,e[10]=d):d=e[10];let l;e[11]!==i||e[12]!==d?(l=(0,c.jsx)("span",{className:d,children:i}),e[11]=i,e[12]=d,e[13]=l):l=e[13];let f;e[14]!==i||e[15]!==o?(f=o(i===1?"change":"changes"),e[14]=i,e[15]=o,e[16]=f):f=e[16];let h;e[17]!==f?(h=(0,c.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:f}),e[17]=f,e[18]=h):h=e[18];let g;e[19]!==r||e[20]!==o?(g=r>0&&(0,c.jsxs)("span",{className:"font-mono text-[11px] tracking-widest text-destructive uppercase",children:["\xB7 ",o("{count} breaking",{count:r})]}),e[19]=r,e[20]=o,e[21]=g):g=e[21];let p;return e[22]!==l||e[23]!==h||e[24]!==g?(p=(0,c.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[l,h,g]}),e[22]=l,e[23]=h,e[24]=g,e[25]=p):p=e[25],p},"Re"),$t={addedFieldConstraint:{action:"added",kind:"constraint"},addedIndex:{action:"added",kind:"index"},addedOptionalField:{action:"added",kind:"field?"},addedRelation:{action:"added",kind:"relation"},addedRequiredField:{action:"added",kind:"field"},addedTable:{action:"added",kind:"table"},changedCommitOrdering:{action:"changed",kind:"commit ordering"},changedFieldKind:{action:"changed",kind:"field kind"},changedFieldShape:{action:"changed",kind:"field shape"},changedIndex:{action:"changed",kind:"index"},changedJurisdiction:{action:"changed",kind:"jurisdiction"},changedMemoryMode:{action:"changed",kind:"memory mode"},changedShardMode:{action:"changed",kind:"shard mode"},changedTtlPolicy:{action:"changed",kind:"TTL policy"},fieldOptionalToRequired:{action:"changed",kind:"field \u2192 required"},fieldRequiredToOptional:{action:"changed",kind:"field \u2192 optional"},relaxedFieldConstraint:{action:"removed",kind:"constraint"},removedField:{action:"removed",kind:"field"},removedIndex:{action:"removed",kind:"index"},removedRelation:{action:"removed",kind:"relation"},removedTable:{action:"removed",kind:"table"},widenedFieldShape:{action:"changed",kind:"field \u2192 wider"}},Yt=s((t,e)=>{let r=`${$t[t.type].action} ${e} `;return t.summary.startsWith(r)?t.summary.slice(r.length):t.summary},"Ee"),ea=s(t=>{let e=new Map;for(let i of t){let a=i.table??"",o=e.get(a);o===void 0?e.set(a,[i]):o.push(i)}let r=[...e].map(([i,a])=>({changes:a,table:i}));return[...r.filter(i=>i.table!==""),...r.filter(i=>i.table==="")]},"Ae"),ta=s(t=>{let e=(0,be.c)(2),{children:r}=t,i;return e[0]!==r?(i=(0,c.jsx)("div",{className:"px-4 pt-4 pb-2 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:r}),e[0]=r,e[1]=i):i=e[1],i},"De"),aa=s(({pane:t,shardKey:e=""})=>{let r=ce(),i=We(),a=Be({strict:!1}).version,o=s(u=>{Oe(i({search:{version:u},to:"/migrations"}))},"s"),n=de(F.schemaHistory,{},{shardKey:e}),d=n.data?.versions??[],l=a!==void 0&&d.some(u=>u.hash===a)?a:d[0]?.hash,f=d.findIndex(u=>u.hash===l),h=f===-1?void 0:d[f+1]?.hash,g=de(F.schemaVersion,{hash:l??""},{enabled:l!==void 0,shardKey:e}),p=de(F.schemaVersion,{hash:h??""},{enabled:h!==void 0,shardKey:e}),b=(0,he.useMemo)(()=>{let u=xt(g.data?.version?.snapshotJson);if(u!==void 0)return Qt(xt(p.data?.version?.snapshotJson),u)},[g.data,p.data]),y=(0,he.useMemo)(()=>(b?.tables??[]).map(u=>({columns:u.columns,name:u.name,tier:Gt(u.shardMode)})),[b]),x=(0,he.useMemo)(()=>{let u={};for(let w of b?.tables??[])u[w.name]=Vt[w.status];return u},[b]);if(n.error!==null)return(0,c.jsx)(Te,{error:n.errorSource,testId:"sh-error"});if(d.length===0)return(0,c.jsx)(qe,{description:r("Each distinct schema shape this shard runs is recorded here, so you can see what changed and when."),testId:"sh-empty",title:r("No schema versions recorded yet.")});let v=b?.changes??[];return(0,c.jsxs)("div",{className:"flex min-h-0 flex-1 gap-4","data-testid":"lunora-schema-history",children:[(0,c.jsxs)("nav",{className:"flex w-56 shrink-0 flex-col overflow-hidden border-e border-border","data-testid":"sh-timeline-rail",children:[(0,c.jsx)(ta,{children:r("Schema versions")}),(0,c.jsx)("ul",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-timeline",children:d.map(u=>(0,c.jsx)(Zt,{appliedAt:u.appliedAt,hash:u.hash,onSelect:o,selected:u.hash===l,seq:u.seq},u.hash))})]}),(0,c.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4 pe-1 pt-4",children:[(0,c.jsx)(Xt,{breaking:b?.breakingCount??0,count:h===void 0?y.length:v.length,first:h===void 0}),t==="diagram"?(0,c.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,c.jsx)(dt,{fill:!0,nodeClasses:x,tables:y,testIdPrefix:"sh"})}):(0,c.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-changes",children:ea(v).map(u=>{let w=(b?.tables??[]).find(k=>k.name===u.table);return(0,c.jsxs)("section",{className:"mb-6",children:[(0,c.jsxs)("div",{className:"flex items-baseline gap-3 border-b border-border/60 pb-1.5",children:[(0,c.jsx)("span",{className:"font-mono text-[13px] text-foreground",children:u.table===""?r("schema"):u.table}),w!==void 0&&(0,c.jsx)("span",{className:"font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums uppercase",children:r("{count} columns",{count:w.columns.length})}),u.changes.length>1&&(0,c.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums",children:u.changes.length})]}),(0,c.jsx)("ul",{children:u.changes.map(k=>{let{action:L,kind:C}=$t[k.type],j=k.severity==="breaking",M=Yt(k,C);return(0,c.jsxs)("li",{className:"flex items-baseline gap-4 border-s-2 py-1.5 ps-3 transition-colors hover:bg-accent/30",children:[(0,c.jsx)("span",{"aria-hidden":"true",className:le("-ms-3 h-3 w-0.5 shrink-0 self-center",j?"bg-destructive":"bg-transparent")}),(0,c.jsxs)("span",{className:"w-44 shrink-0 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:[r(L)," ",C]}),M!==u.table&&(0,c.jsx)("span",{className:le("min-w-0 font-mono text-[13px]",j?"text-destructive":"text-foreground"),children:M}),j&&(0,c.jsx)("span",{className:"ms-auto shrink-0 font-mono text-[10px] tracking-widest text-destructive uppercase",children:r("breaking")})]},`${k.type}-${k.summary}`)})})]},u.table)})})]})]})},"Le"),ra=s(t=>le("-mb-px border-b-2 px-3 py-2.5 font-mono text-[11px] tracking-wider uppercase transition-colors outline-none","hover:bg-accent/40 focus-visible:bg-accent/40",t?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"Je"),Ra=s(t=>{let e=(0,be.c)(11),{initialShardKey:r}=t,i=ce(),[a,o]=(0,he.useState)("diagram"),n;e[0]!==a?(n=s((g,p,b,y)=>(0,c.jsxs)("button",{"aria-selected":a===g,className:ra(a===g),"data-testid":b,onClick:s(()=>{o(g)},"onClick"),role:"tab",type:"button",children:[p,y!==void 0&&(0,c.jsx)("span",{className:"ms-2 tabular-nums text-muted-foreground/70",children:y})]}),"s"),e[0]=a,e[1]=n):n=e[1];let d=n,l;e[2]!==i||e[3]!==d?(l=(0,c.jsxs)("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-3","data-testid":"mg-panes",role:"tablist",children:[d("diagram",i("Diagram"),"mg-pane-diagram"),d("changes",i("Changes"),"mg-pane-changes"),d("data",i("Data migrations"),"mg-pane-data")]}),e[2]=i,e[3]=d,e[4]=l):l=e[4];let f;e[5]!==r||e[6]!==a?(f=(0,c.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:a==="data"?(0,c.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4",children:(0,c.jsx)(ct,{initialShardKey:r})}):(0,c.jsx)(aa,{pane:a,shardKey:r})}),e[5]=r,e[6]=a,e[7]=f):f=e[7];let h;return e[8]!==l||e[9]!==f?(h=(0,c.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col pt-4","data-testid":"lunora-migrations-route",children:[l,f]}),e[8]=l,e[9]=f,e[10]=h):h=e[10],h},"Ze");export{Ra as default};
@@ -0,0 +1 @@
1
+ import{a as r}from"./chunk-5PEAXTYQ.js";var d=[{headings:["Vocabulary","The mental model","The components","Request lifecycle","The data tiers","Compute tiers","The consistency model","The real-time engine"],id:"architecture",summary:"The full picture \u2014 topology, request lifecycle, the data tiers, the consistency model, and the design decisions behind them.",title:"Architecture"},{headings:["How telemetry reaches the cloud","Traces","Issues","Logs","Metrics","Scoped ingest keys","Bring your own OpenTelemetry","Retention & scale"],id:"cloud/monitoring",summary:"The Lunora cloud is a managed OpenTelemetry backend + control plane \u2014 deploy to it and your traces, logs, metrics, and AI generations flow i",title:"Monitoring"},{headings:["When to use an action vs a mutation","ActionCtx","Calling queries and mutations from an action","Scheduling follow-up work"],id:"concepts/actions",summary:"Non-deterministic functions for external APIs and side effects \u2014 the action builder and its ActionCtx.",title:"Actions"},{headings:["Keep your session authority","Declare ownership once","Call Lunora from your own Worker","Dev proxy: two silent failures","Run both engines during the migration","Test it without a worker","When something is stuck"],id:"concepts/adopt-in-an-existing-app",summary:"Add Lunora to a working product that already has its own auth, Worker, and data layer \u2014 without rewriting either.",title:"Adopt in an existing app"},{headings:["Static lints","Runtime lints","Running advisors"],id:"concepts/advisors",summary:"Splinter-style lints that catch schema, performance, and security problems \u2014 many before you deploy.",title:"Advisors"},{headings:["Agent skills","Agent mode","The docs server","The local server","The MCP server","Keeping generated types honest"],id:"concepts/ai-tooling",summary:"Teach Claude Code, Cursor, and Copilot how to use Lunora \u2014 agent skills, agent-aware dev mode, the docs server, and the MCP server.",title:"AI coding agents"},{headings:["What lands in your project","Wire it up","The cards","Enabling the optional flows","Password rules","Username availability","Being an OAuth provider","Avatar and logo uploads"],id:"concepts/auth-ui",summary:"Copy-in sign-in, settings, and organization screens for React, Vue, Svelte, Solid, and Angular \u2014 the code lands in your project and you own ",title:"Auth UI"},{headings:["ctx.auth inside functions","@lunora/auth on the server","Routing /api/auth/*","The client side","Feeding row-level security","See also"],id:"concepts/authentication",summary:"How ctx.auth threads the signed-in user through queries, mutations, and actions \u2014 and feeds row-level security.",title:"Authentication"},{headings:["Point-in-time recovery","Snapshot backups","Export and import","Streaming data out continuously","Practising a restore"],id:"concepts/backups",summary:"Snapshot a deployment, recover a shard to any moment in the last 30 days, and move data in and out as NDJSON.",title:"Backups, export & import"},{headings:["Schema first","Reads","Writes","Inputs and safety","Scaling","Lean on Advisors"],id:"concepts/best-practices",summary:"The opinionated idioms that keep a Lunora app fast, safe, and reactive.",title:"Best practices"},{headings:["Enabling Workers Cache","Declarative cache headers on httpRoute","Programmatic cache purging","Why only HTTP actions?","Memoizing an expensive action result","Scaffolding cache-aware routes","Best practices"],id:"concepts/caching",summary:"Edge caching with Cloudflare Workers Cache \u2014 declarative headers on HTTP routes and programmatic cache purging from actions.",title:"Caching"},{headings:["The short version","Rows or events?","Live topics, whispers and rooms","Streams","Write a row, then tell the page","Things to know before you rely on a live topic"],id:"concepts/choosing-a-data-channel",summary:"Live query, stream, live topic, whisper, room or socket? Which one to use for which job.",title:"Choosing a data channel"},{headings:["Declaring it","What _commitSeq guarantees","Refreshed on every write","Three things it is not","When to reach for it"],id:"concepts/commit-ordering",summary:"Declare .commitOrdered() so every row carries _commitSeq \u2014 a per-shard sequence that orders commits, and the cursor a changefeed can page on",title:"Commit ordering"},{headings:["Defining one","Installing one","What the namespace guarantees","What a component does NOT get","In the architecture view","Migrations","See also"],id:"concepts/components",summary:"Package backend features \u2014 tables, functions, and context \u2014 as an installable unit that cannot collide with the app that installs it.",title:"Components"},{headings:["Constraint kinds","Unique","Non-null","Foreign-key integrity","Error codes"],id:"concepts/constraints",summary:"Unique, non-null and foreign-key integrity declared on the schema and enforced at write time.",title:"Constraints"},{headings:["What it pins","Pinning auth and voice","Pinning mail","Set it once: changing it strands data","Runbook: moving an app to a new jurisdiction"],id:"concepts/data-residency",summary:"Pin Durable Objects to a Cloudflare jurisdiction with .jurisdiction(), and the export\u2192import runbook for moving regions.",title:"Data residency"},{headings:["The type table","Numbers, bigints, and dates","Optional versus null","Values that JSON cannot carry","Size limits","Types outside the schema"],id:"concepts/data-types",summary:"The value types a Lunora document can hold, how each is stored, and which ones need the wire codec to survive JSON.",title:"Data types"},{headings:["Start with lunora doctor","Catch it before it runs","The error overlay","Structured logging with ctx.log","The Studio","Find the slow or failing function","Watch production","Debugging authentication"],id:"concepts/debugging",summary:"The tools to reach for when something is broken \u2014 doctor, the error overlay, ctx.log, the Studio, insights, and live logs.",title:"Debugging"},{headings:["How ids are minted","Typing a reference with v.id","Reading and following ids","Validating an id that came from outside","Ids in exports and imports"],id:"concepts/document-ids",summary:"Every row carries an _id and a _creationTime \u2014 how they are minted, how v.id types a reference, and what an id does and does not guarantee.",title:"Document IDs"},{headings:["Locally: .dev.vars","In production: secrets and vars","Accessing env inside your app","The rule: never commit secrets"],id:"concepts/environment-variables",summary:"Configure secrets and vars \u2014 .dev.vars locally, wrangler secrets in production, env bindings inside functions.",title:"Environment variables"},{headings:["Multiple environments","Linking a checkout to a deployment","Preview deployments","Moving traffic between versions","Build once, deploy many","Custom domains","Trying a deploy without an account","Who changed what"],id:"concepts/environments",summary:"Running staging next to production, shipping a preview per pull request, and rolling traffic back when something goes wrong.",title:"Environments & releases"},{headings:["Throwing from a handler","Expected vs. unexpected","Reading error state on the client","Optimistic updates roll back on rejection","See also"],id:"concepts/error-handling",summary:"Throwing inside handlers, how errors travel to the client, and reading error state without losing optimistic safety.",title:"Error handling"},{headings:["What reaches your tracker","Wire it once, to both halves","Sentry","PostHog","Datadog, Axiom, Better Stack, and the rest","Source maps","Privacy"],id:"concepts/error-tracking",summary:"Send Lunora's failed calls and error logs to Sentry, PostHog, Datadog, or any error tracker, with the thrown error's real stack and nothing ",title:"Error tracking"},{headings:["External provider or @lunora/auth?","The resolver","Client: hand over the token, refresh it","WebSockets and live queries","RLS with org claims","Memoization and revocation","Composing with @lunora/auth or Cloudflare Access","Walkthrough: Clerk"],id:"concepts/external-auth",summary:"Use Clerk, WorkOS AuthKit, Auth0, Supabase or any OIDC JWT issuer as your identity provider \u2014 verify its token at the Worker and feed ctx.au",title:"External auth"},{headings:["Which contexts expose what","Uploading","Serving files","Named buckets","Deleting","See also"],id:"concepts/file-storage",summary:"Typed R2 buckets exposed as ctx.storage \u2014 uploading, serving via signed URLs, and deleting files from your functions.",title:"File storage"},{headings:["Where the work happens","Choosing between them","When a bare filter is fine","How the advisors catch this","Composing","Inside an object column"],id:"concepts/filtering",summary:".filter() is a JavaScript predicate applied after rows are loaded \u2014 when to use it, and when to reach for an index instead.",title:"Filtering"},{headings:["The three context types","Surfaces on every ctx","ctx field matrix","Add-on surfaces (codegen-wired)"],id:"concepts/function-context",summary:"The ctx object passed to every query, mutation, and action \u2014 and what each kind is allowed to do with it.",title:"Function context"},{headings:["api.ts and internal.ts: function references","server.ts: typed helpers","dataModel.ts: Id and Doc","Importing the generated code","lunora/* vs @lunora/* imports","Linting and formatting","Regenerating"],id:"concepts/generated-code",summary:"What @lunora/codegen emits from your schema.ts, and how api / Id / Doc keep server and client in sync.",title:"Generated code"},{headings:["Declaring a point column and a geo index",'"Places near me": near(point, radiusMeters)',"Bounding box: within(box)","Single-shard scope","How the Advisors catch geo mistakes"],id:"concepts/geospatial",summary:'Store lat/lng points with v.geoPoint, index them with .geoIndex, and answer "places near me" and bounding-box reads with withGeoIndex.',title:"Geospatial"},{headings:["httpAction","HttpActionCtx","Typed routes with httpRoute","How routes mount in the worker"],id:"concepts/http-endpoints",summary:"Public HTTP routes with httpAction and the Hono-based httpRouter.",title:"HTTP endpoints"},{headings:["Declaring an index","Querying with withIndex","Why every filtered read should hit an index","How the Advisors catch unindexed reads","Checking a read with explain","Aggregate indexes"],id:"concepts/indexes",summary:"Declare B-tree indexes on tables and query them with withIndex \u2014 every filtered read should hit one.",title:"Indexes"},{headings:["Calling internal functions","Internal functions and scheduling"],id:"concepts/internal-functions",summary:"internalQuery / internalMutation / internalAction \u2014 server-only functions never exposed to the client.",title:"Internal functions"},{headings:["Declare the stream","Publish","Follow a topic in the browser","Authorization","Where delivery stops","Platform support","React Native"],id:"concepts/live-streams",summary:"Publish events to named topics from the server and follow many of them over one SSE connection.",title:"Live topic streams"},{headings:["Turn CDC on first","Why the DO topology fits","Shapes \u2014 partial replication","The poke diff protocol","Custom mutators \u2014 optimistic, server-authoritative","The client store","Cross-shard joins \u2014 the one limit"],id:"concepts/local-first",summary:"Shapes, the poke diff protocol, and custom mutators \u2014 the Zero-class sync engine.",title:"Local-first sync"},{headings:["Strategies","Roles and bypass","What's masked, what isn't","Sensitive arguments","Tooling","See also"],id:"concepts/masking",summary:"Column-level redaction on the read path \u2014 the companion to row-level security.",title:"Data masking"},{headings:["The lifetime","Rebuilding: onShardInit","What .memory() buys, and what it does not","Restrictions","Choosing between .memory() and .ttl()"],id:"concepts/memory-tables",summary:"Declare .memory() for state the shard rebuilds rather than remembers \u2014 presence, cursors, live counters \u2014 and onShardInit to bring it back a",title:"Memory tables"},{headings:["Attaching middleware","Augmenting ctx","Composing concerns"],id:"concepts/middleware",summary:"Compose cross-cutting concerns \u2014 auth checks, rate limiting, logging \u2014 and augment ctx for downstream handlers.",title:"Middleware"},{headings:["The deploy gate tells you when you need one","Schema migrations (global tables)","Data migrations (sharded tables)","Inspecting run-state in the Studio","One-off data edits without a deploy","Resetting local state"],id:"concepts/migrations",summary:"Schema-change SQL for global tables and online, resumable data migrations.",title:"Migrations"},{headings:["Queues and topics","What you get","Table ownership","Installed components"],id:"concepts/modules",summary:"Group lunora/ folders into modules and get a module catalog and an architecture diagram from codegen.",title:"Modules"},{headings:["Running as one node in a dev graph","Deploying from external IaC","Consuming the generated API from a sibling package","Calling the backend from a sibling Worker"],id:"concepts/monorepos-and-iac",summary:"Running the Lunora worker as one node in a larger dev graph, deploying it from Terraform/Pulumi/Alchemy, and consuming its generated API fro",title:"Monorepos and external IaC"},{headings:["The output is pinned to your CLI version","Wiring it into your project","What you get, and what you don't","Conformance"],id:"concepts/non-js-sdks",summary:"Generate a typed, self-contained Lunora client for Python, Go, Ruby, Rust, Swift, Java, Kotlin or Dart/Flutter \u2014 vendored into your project ",title:"Non-JS SDKs"},{headings:["Configure defineNotify","VAPID / FCM config via .dev.vars","Register a browser push subscription","Send from an action","Queue-backed fan-out"],id:"concepts/notifications",summary:"Configure defineNotify in lunora/notify.ts for Web Push + FCM, register browser subscriptions, and send via ctx.notify / ctx.push from an ac",title:"Push notifications"},{headings:["Sinks","Structured logging with ctx.log","Tracing sub-operations with ctx.trace","Database telemetry (ctx.db and ctx.sql)","Trace sampling","Source maps","Application metrics with ctx.metrics","Container telemetry"],id:"concepts/observability",summary:"Ship Lunora's logs, traces, and metrics to any OTLP collector \u2014 the otlpSink worker option, ctx.log/ctx.trace/ctx.metrics, the zero-config c",title:"Observability"},{headings:["Mutations are serialized, not retried","Where conflicts still happen","Handling a conflict on the client","Diagnosing a persistent conflict","Atomicity across shards",".global() tables"],id:"concepts/occ",summary:"Why mutations in one shard are serialized rather than retried, where optimistic-concurrency conflicts still arise, and what atomicity means ",title:"OCC & atomicity"},{headings:["Passing the adapters explicitly","What gets persisted","Surviving a breaking deploy","Multiple tabs","Sync status","Connection status UI","Boot with no network (the app shell)","The reconciliation model"],id:"concepts/offline-first",summary:"Persist reads and writes to disk so the app boots, renders, and accepts edits with no network.",title:"Offline-first"},{headings:["PaginationOptions","PaginationResult","Paging through a query","Ordering rows that hold NULL","Load more / infinite lists on the client",'Total count ("42 of 1,203")'],id:"concepts/pagination",summary:"Keyset pagination with .paginate(options) \u2014 page through a query and build an infinite list on the client.",title:"Pagination"},{headings:["ctx.db","ctx.auth","ctx.scheduler"],id:"concepts/queries-mutations",summary:"query / mutation / action \u2014 what each is for and how ctx is shaped.",title:"Queries & mutations"},{headings:["How this differs from a trigger","The convergence contract","What the handler receives","Execution and identity","Reads that should not wake you","Watching them work"],id:"concepts/reactors",summary:"Declare onQueryChange to run server logic when a query's result changes \u2014 the actor pattern, with no client on the other end and nothing pol",title:"Reactors (server-side reactivity)"},{headings:["Where a shard is created","Replica reads","Sockets near the client"],id:"concepts/read-replicas",summary:"Serve one-shot queries from a copy of the shard in the caller's region, pin where a shard is created, and terminate sockets near the client.",title:"Read replicas & placement"},{headings:["Hibernation","How an update reaches a subscriber","Reconnect","When WebSockets are blocked","Durable streams","Whispers (ephemeral peer messages)","Why no MQTT / Pub/Sub"],id:"concepts/realtime",summary:"How subscriptions, deltas, and hibernation fit together.",title:"Real-time"},{headings:["Using items","The manifest","Validation","Building the catalog","Distributing"],id:"concepts/registry-items",summary:"Package a reusable capability \u2014 schema, functions, bindings and env vars \u2014 as a registry item others install with one command.",title:"Authoring registry items"},{headings:["A worked example","The edge set","Directions","Depth, limit and score","Cycles and paging","It is an ordinary read","Fusing the graph into retrieval","From an AI agent"],id:"concepts/relation-graph",summary:"Traverse the foreign-key graph your schema already declares with ctx.db.related \u2014 depth-bounded, cycle-safe, scored by proximity, and fusabl",title:"Relation graph"},{headings:["The descriptors","Many-to-many","Index your foreign keys","Querying across a relation","Writing through a relation","Relations vs the relation graph"],id:"concepts/relations",summary:"Modeling many-to-one, one-to-many and many-to-many relationships with the one / many relation descriptors, foreign-key columns, join tables ",title:"Relations"},{headings:["Default-closed","URLs and methods","Arguments","Choosing a shard","Authentication","Rate limiting","Caching","OpenAPI"],id:"concepts/rest-api",summary:"Publish a query, mutation, or action as a plain REST endpoint with .expose({ rest: true }) \u2014 default-closed, routed through the procedure so",title:"Public REST API"},{headings:["Policies","Permissions and roles","Relation predicates","What's covered, what isn't","Testing policies","See also"],id:"concepts/rls",summary:"Server-side authorization that decides which rows a procedure can read or write.",title:"Row-level security"},{headings:["Node compatibility","Where the constraints bite","Bundling","The worker entry","Build once, deploy many"],id:"concepts/runtime",summary:"Everything runs on the Workers runtime \u2014 what that means for Node APIs, dependencies, and the 64 MiB bundle you have to fit into.",title:"Runtime & bundling"},{headings:["Deferring a function","Recurring jobs (Cron Triggers)","How dispatch works","See also"],id:"concepts/scheduling",summary:"Defer follow-up work with ctx.scheduler.runAfter / runAt, and run recurring jobs via Cron Triggers.",title:"Scheduling"},{headings:["Validators","Tier modifiers","Indexes"],id:"concepts/schema",summary:"Declarative tables, validators, indexes and sharding.",title:"Schema"},{headings:["Declaring a search index","Language","Running a search query","Matching rules","Filter fields","Relevance ordering, .take(n) and pagination","Limits","Backfill and staged"],id:"concepts/search",summary:"Declare a search index on a table and run relevance-ordered full-text queries.",title:"Full-text search"},{headings:["The HTTP edge","Auth, cookies, and secrets","Protecting public procedures","Securing sharded access","Advisor catalog","Config-time validation"],id:"concepts/security",summary:"Lunora's secure-by-default posture \u2014 the protections you get for free, how to opt out, and the advisor lints that catch the gaps.",title:"Security"},{headings:["From an SSR loader","From a script","From the terminal","From Python","From any language, over HTTP","Writing a new SDK"],id:"concepts/server-clients",summary:"Calling a Lunora deployment without a live subscription \u2014 from SSR loaders, scripts, other languages, or plain HTTP.",title:"Server-side & non-reactive clients"},{headings:["Declare a service","Call it from an action","What Lunora wires","Test an action that calls one","Make the service private","Smart Placement","Platforms","Migrating from URLs and HMAC"],id:"concepts/services",summary:"Call sibling Cloudflare Workers from actions over typed service bindings, run them in one dev session, and deploy them before the app.",title:"Services"},{headings:["When to shard","Migrating a populated table","What stays in the root DO","Going global","Cross-shard reads","The shard registry","Securing shard access"],id:"concepts/sharding",summary:"Default __root__ DO, opt-in .shardBy(), and .global() escape hatch.",title:"Sharding"},{headings:["The one caveat that matters","The read surface","_scheduled_functions","_storage"],id:"concepts/system-tables",summary:"Read pending scheduled jobs and stored file metadata through ctx.db.system \u2014 a read-only, eventually consistent view outside the mutation sn",title:"System tables"},{headings:["Install","Configure","Write a test","Run in CI"],id:"concepts/testing-ai-features",summary:"Drive a Lunora app's AI flows in a real browser with the e2e runner, and judge non-deterministic model output with natural-language assertio",title:"Testing AI features end to end"},{headings:["The in-memory harness","Asserting reactive results","Mail-catcher helpers (E2E)","Running in CI"],id:"concepts/testing",summary:"Unit-test queries, mutations, and actions in memory with lunoraTest \u2014 no worker, no network.",title:"Testing"},{headings:["Declaring a TTL","Sweep semantics: coarse, batched, bounded","Not on .global() tables","Interaction with soft delete","How the Advisors catch TTL mistakes"],id:"concepts/ttl",summary:"Declare a table-level .ttl() so a DO alarm sweep auto-deletes expired rows \u2014 sessions, OTPs, and other ephemeral data.",title:"TTL & auto-expiry"},{headings:["Where types come from","Do not restate what is inferred","Reach for Doc and Id","Pin the client contract with .output()","Optional versus null in types","Bringing your own validators","Project configuration","Keeping types honest in CI"],id:"concepts/typescript",summary:"Getting the most out of Lunora's end-to-end types \u2014 where types come from, what to annotate, and what to let inference do.",title:"TypeScript"},{headings:["Job 1: column types in defineTable","Job 2: argument and return validation","Return-type inference to the client","Common validators","Coming from zod","ValidationError"],id:"concepts/validation",summary:"The v.* validators that type your columns and parse query / mutation / action inputs and outputs end to end.",title:"Validation"},{headings:["Declaring an index","Automatic write sync","ctx.vectors","RAG with @lunora/ai","Binding & config wiring"],id:"concepts/vector-search",summary:"Typed Vectorize indexes on ctx.vectors \u2014 automatic write sync, similarity search, and RAG with embeddings.",title:"Vector search"},{headings:["The specification","Conformance fixtures","SDKs built on it"],id:"concepts/wire-protocol",summary:"The language-independent Lunora client\u2194server wire protocol and the golden fixtures every SDK is tested against.",title:"Wire protocol"},{headings:["wrangler.jsonc","lunora.config.ts","Secrets","Containers","Deploy","Durable Object class limit","Worker size","Streaming logs"],id:"deployment",summary:"Wrangler bindings, secrets, and the deploy flow.",title:"Deployment"},{headings:["Redacted codes","Build-time errors","Throwing your own","Error codes"],id:"errors",summary:"Every well-known Lunora error code \u2014 its HTTP status, what it means, and what to do about it.",title:"Errors & warnings reference"},{headings:["Branching on one","The same number, in the document","Where the numbers come from","From your own code"],id:"exit-codes",summary:"The exit code every lunora command terminates with \u2014 what each number means, and how it is derived from the error catalog.",title:"CLI exit codes"},{headings:["Install","Provide the client","Live queries","Mutations","Connection status","Reactive loaders"],id:"frameworks/angular",summary:"Use Lunora with Angular \u2014 provideLunora in your app config, signal-based liveQuery, imperative mutate, and a connectionStatus signal.",title:"Angular"},{headings:["Install","Exports","The integration","Single-worker composition with withLunora","Reactive-loader server helpers","Deploy"],id:"frameworks/astro",summary:"Compose Astro's @astrojs/cloudflare worker with Lunora realtime, plus reactive-loader server helpers for .astro frontmatter.",title:"Astro"},{headings:["One worker, two dispatch flows","Mount Lunora inside your framework","The per-framework matrix","Client adapters","Scaffolding","Vite composition"],id:"frameworks/bring-your-framework",summary:"Compose any meta-framework's SSR with Lunora realtime in one Cloudflare Worker.",title:"Bring your framework"},{headings:["One worker, two dispatch flows","Class A: Lunora owns the worker entry","Class B: the framework owns the CF adapter","Class C: SPA / SSR-less","Wrangler reconciliation"],id:"frameworks/deploy",summary:"One worker, one deploy \u2014 how a composed Lunora + meta-framework app ships to Cloudflare.",title:"Deploy your framework"},{headings:["Why two workers","Wiring them together","Client and server entry points","Loading data in a Server Component","Providing the client","Developing","Deploying"],id:"frameworks/nextjs",summary:"Run Lunora alongside Next.js on Cloudflare with the two-worker split \u2014 RSC loaders that hydrate into live subscriptions.",title:"Next.js"},{headings:["Install","Setup","How it works","Provide the client","Reactive loaders","Feature flags","Verify before deploy","Alternative: two-worker split"],id:"frameworks/nuxt",summary:"Run Lunora and Nuxt as one Cloudflare Worker \u2014 the @lunora/nuxt module mounts /_lunora/** into Nitro, plus reactive-loader server helpers.",title:"Nuxt"},{headings:["Scaffold a new app","Install","Create the client","Provide it","Live queries and mutations","HTTP streams","Local-first (shapes, custom mutators, TanStack DB)","Authentication (better-auth + Expo)"],id:"frameworks/react-native",summary:"Use Lunora in a React Native / Expo app \u2014 the same live hooks, plus an AsyncStorage-backed client and a better-auth Expo bridge.",title:"React Native / Expo"},{headings:["Install","Provide the client","Live queries","Mutations","Auth","Reactive loaders","One worker, one deploy"],id:"frameworks/react",summary:"Use Lunora with React \u2014 a provider, live useQuery/useMutation hooks, and the SSR-seed \u2192 live reactive-loader handoff.",title:"React"},{headings:["The problem with static loaders","The handoff","Why there's no flash","Identity continuity (SSR \u2192 client)","Sharding carries through","Status"],id:"frameworks/reactive-loaders",summary:"Your loaders are live \u2014 SSR data that hydrates into a real-time subscription with no flash.",title:"Reactive loaders"},{headings:["Install","Solid 1.x and Solid 2.0","Provide the client","Live queries","Mutations","Reactive loaders"],id:"frameworks/solid",summary:"Use Lunora with SolidJS \u2014 a provider, live createQuery/createMutation primitives, and the SSR-seed \u2192 live reactive-loader handoff.",title:"Solid"},{headings:["Install","Provide the client","Live queries","Mutations","Reactive loaders","One worker, one deploy"],id:"frameworks/svelte",summary:"Use Lunora with Svelte 5 / SvelteKit \u2014 context-provided client, live query/mutation stores, and the SSR-seed \u2192 live reactive-loader handoff.",title:"Svelte"},{headings:["What you're proving","1. Scaffold","2. Dev","3. Prove SSR preload (curl the raw HTML)","4. Prove the live subscription attaches","5. Prove live update (two tabs)","Identity check (optional, with auth)",'What "pass" looks like'],id:"frameworks/verify-live-loaders",summary:"How to actually prove live loaders work \u2014 scaffold, SSR-curl the preloaded value, two-tab live update.",title:"Manual end-to-end verification"},{headings:["Install","Provide the client","Live queries","Mutations","Reactive loaders","Worker composition"],id:"frameworks/vue",summary:"Use Lunora with Vue 3 \u2014 a client plugin, live useQuery/useMutation composables, and the SSR-seed \u2192 live reactive-loader handoff.",title:"Vue"},{headings:["Requirements"],id:"getting-started",summary:"Scaffold a Lunora app and run the dev loop in under a minute.",title:"Getting started"},{headings:["Durable Objects","Statement limits (Durable Objects **and** D1)","D1","R2","Workers","Worker startup (error 10021)","Queues","Pipelines"],id:"limits",summary:"Cloudflare ceilings you should keep in your head.",title:"Limits"},{headings:["Two translations, not one","Schema: transposing the relation graph","Procedures: the shape deltas","Writes: .returning() does not survive","Components decompose by hand"],id:"migrating/from-a-convex-toolkit",summary:"The second translation step a Drizzle-style schema DSL and a tRPC-style procedure builder add on top of the raw Convex mapping.",title:"Migrating from a Convex toolkit"},{headings:["Bump strategy","Breaking changes already landed","Recommended (non-breaking) follow-ups","See also"],id:"migrating/from-alpha",summary:"How a 1.0.0-alpha.* app moves to stable \u2014 dependency bumps plus every breaking change already landed on the road to 1.0.",title:"Upgrading from alpha to 1.0"},{headings:["At a glance","Schema","Queries, mutations, actions","React","Auth","Scheduler","File storage","Subscriptions"],id:"migrating/from-convex",summary:"Side-by-side mapping \u2014 schema, queries, mutations, actions, React hooks.",title:"Migrating from Convex"},{headings:["At a glance","Schema","Reads: onSnapshot \u2192 useQuery","Writes: setDoc \u2192 mutation","Cloud Functions \u2192 actions","Auth","File storage","Scheduled work"],id:"migrating/from-firebase",summary:"Side-by-side mapping \u2014 Firestore, Cloud Functions, Auth, Storage, and real-time listeners.",title:"Migrating from Firebase"},{headings:["At a glance","Schema","Reads: supabase.from(...).select() \u2192 useQuery","Writes: .insert() \u2192 mutation","Row-level security","Edge Functions \u2192 actions","Auth","File storage"],id:"migrating/from-supabase",summary:"Side-by-side mapping \u2014 Postgres tables, RLS, Edge Functions, Auth, Storage, and Realtime.",title:"Migrating from Supabase"},{headings:["No arbitrary external SQL or ad-hoc cross-dataset joins","RPC-first, not REST-first","Cross-shard writes are eventual, not atomic","No data warehouse hosting in the framework","No managed control plane as a hard dependency","Also deliberately absent","See also"],id:"non-goals",summary:"The things Lunora deliberately does not do \u2014 each with the reason it's a boundary and the escape hatch when you need past it.",title:"Design boundaries"},{headings:["Why Lunora","Own it, or let us run it","How Lunora compares","Where it's rough","What ships in v1.0.0-alpha.1","Start building"],id:"overview",summary:"The Convex-style real-time backend that runs on your own Cloudflare account \u2014 typed end to end, live by default, ~$0 at idle.",title:"Overview"},{headings:["Bindings and wrangler config","Secrets","LUNORA_ADMIN_TOKEN and the admin plane","Rate limiting and abuse","Auth and row-level security","Migrations","Observability","Health and readiness endpoint"],id:"production-checklist",summary:"Everything to verify before a Lunora app takes real traffic \u2014 bindings, secrets, admin tokens, rate limits, RLS, migrations, observability.",title:"Production checklist"},{headings:["Pick a starting point","Adding Lunora to an app you already have","What you get either way","Next steps"],id:"quickstarts",summary:"Every starting point Lunora scaffolds \u2014 pick your framework, run one command, and get a live backend wired to it.",title:"Quickstarts"},{headings:["1. See where you stand","2. Create the usage alerts","3. Add the budget alert by hand","4. Check delivery","In CI"],id:"runaway-bill",summary:"Set Cloudflare usage alerts well above normal with `lunora cloudflare alerts`, add the budget alert the API cannot, and check what actually ",title:"Protect yourself from a runaway bill"},{headings:["Why startup grows with the app","Measure it locally","The fix: load function modules on demand","Keep heavy packages off the startup path"],id:"startup-cpu-limit",summary:'Why a large app fails to deploy with "Script startup exceeded CPU time limit", how to measure it, and how lazy function loading and lighter ',title:"Worker startup CPU limit (error 10021)"},{headings:["1. Scaffold","2. Model the data","3. Generate the migration","4. Write the query","5. Write the mutation","6. Wire the React app","7. Run the dev loop","8. Deploy"],id:"tutorial/realtime-chat",summary:"End-to-end Lunora walkthrough \u2014 schema, query, mutation, subscription, React, sharding.",title:"Build a real-time chat app in 15 minutes"},{headings:["Know when to act","Step 1: shard the messages","Step 2: put identities in a global table","Step 3: keep fan-out off the hot path","Step 4: lock down shard access","Step 5: migrate the data you already have","Checking your work","What you learned"],id:"tutorial/scaling",summary:"Take the chat app from one Durable Object to many \u2014 shard by channel, put identities in a global table, and keep cross-shard reads off the h",title:"Tutorial: scaling the chat app"},{headings:["Release channels","What SemVer means here","Stability tiers",'What "experimental" means',"See also"],id:"versioning",summary:"What SemVer means for Lunora packages \u2014 release channels, stability tiers, and the experimental surface.",title:"Versioning & stability"}],l="https://lunora.sh/docs/",u=4,m=3,g=200,p=4,y=3,f=2,w=1,v=r(t=>t.slice(0,g).toLowerCase().split(/[^a-z0-9.]+/u).filter(a=>a.length>=m),"w"),b=r((t,a)=>{let i=t.id.toLowerCase(),e=t.title.toLowerCase(),s=t.summary.toLowerCase(),c=t.headings.map(n=>n.toLowerCase()),o=0;for(let n of a)i.includes(n)&&(o+=p),e.includes(n)&&(o+=y),c.some(h=>h.includes(n))&&(o+=f),s.includes(n)&&(o+=w);return o},"v"),k=r(t=>{let a=v(typeof t=="string"?t:""),i=a.length===0?[]:d.map(e=>({candidate:e,rank:b(e,a)})).filter(e=>e.rank>0).sort((e,s)=>s.rank-e.rank).slice(0,u).map(e=>({...e.candidate,url:`${l}${e.candidate.id}`}));return{entries:i.length===0?d.map(e=>e.id):i}},"b"),S=r(t=>{let{entries:a}=k(t);return a.every(i=>typeof i=="string")?[`Documentation pages under ${l}: ${a.join(", ")}`]:a.map(i=>{let e=i;return`${e.title} (${e.url}): ${e.summary} Sections: ${e.headings.join(", ")}`})},"k");export{S as knowledgeExcerpts};
@@ -0,0 +1 @@
1
+ import{a as Ze}from"./chunk-3X3NXJBR.js";import{a as Me,b as Re}from"./chunk-HCOF7HOM.js";import{a as ke}from"./chunk-TKBTZX4K.js";import"./chunk-5GYHGDIF.js";import"./chunk-Y2YLTUMD.js";import"./chunk-JD6PRRFO.js";import"./chunk-NGZNXNRD.js";import"./chunk-2SNHKJXK.js";import"./chunk-BCUOQNI2.js";import"./chunk-P5EVJEGC.js";import"./chunk-D65UVZIA.js";import"./chunk-NGVP66OH.js";import"./chunk-QAOZXPLU.js";import{a as Ye}from"./chunk-J45HAKBU.js";import{a as Xe}from"./chunk-FHLODLBC.js";import{b as We}from"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import{i as Ue}from"./chunk-RTS5G3ET.js";import"./chunk-QRA7AKYO.js";import{i as Ae}from"./chunk-IHGRWY3Y.js";import"./chunk-OWRKSQPE.js";import"./chunk-4EPW63HS.js";import{a as be}from"./chunk-V3BE427M.js";import"./chunk-CKEQX655.js";import"./chunk-UD5REVU2.js";import{a as Qe}from"./chunk-RCXNYW7P.js";import{b as je}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as $e}from"./chunk-2W4UO5BC.js";import{a as qe,b as Ge,c as Ke,d as Pe,e as Le}from"./chunk-OK2QU2EV.js";import{m as Je}from"./chunk-SHHGIT7M.js";import"./chunk-ZPQBVYNN.js";import{B as Oe,h as ze,i as Ee,j as Fe,s as ge,x as De}from"./chunk-GNI37YCV.js";import"./chunk-PDBW6GTJ.js";import{a as st}from"./chunk-GWNGVKLG.js";import{a as nt,b as rt}from"./chunk-6G3E4PJ2.js";import{a as r,d as Be}from"./chunk-5PEAXTYQ.js";var we=Be(st(),1);var x=Be(nt(),1);var t=Be(rt(),1);var ot=ze($e.listTables),it=ze($e.listTableIndexes),dt=ze($e.readTablePage),ct=ze($e.describeTables),mt={},He=[],ut=r(s=>{let e=(0,we.c)(74),{initialShardKey:u,initialTable:n}=s,l=Je(),[a,m]=(0,x.useState)("graph"),{queryShardKey:c,setShardKey:d,shardKey:b}=Ye(u),[o,h]=(0,x.useState)(""),[i,y]=(0,x.useState)(null),[p,$]=(0,x.useState)(null),S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S={},e[0]=S):S=e[0];let[K,N]=(0,x.useState)(S),O;e[1]===Symbol.for("react.memo_cache_sentinel")?(O={},e[1]=O):O=e[1];let[E,P]=(0,x.useState)(O),[T,C]=(0,x.useState)(null),z;e[2]===Symbol.for("react.memo_cache_sentinel")?(z={},e[2]=z):z=e[2];let[F,fe]=(0,x.useState)(z),te;e[3]===Symbol.for("react.memo_cache_sentinel")?(te={},e[3]=te):te=e[3];let[_,j]=(0,x.useState)(te),[k,xe]=(0,x.useState)(null),[L,ce]=(0,x.useState)(null),le;e[4]===Symbol.for("react.memo_cache_sentinel")?(le={},e[4]=le):le=e[4];let[W,Ce]=(0,x.useState)(le),[X,me]=(0,x.useState)(null),ve=(0,x.useRef)(0),M;e[5]!==l?(M=r(async g=>{ve.current=ve.current+1;let v=ve.current;$(null);try{let w=await l.query(ot,{},Ee(g));if(v!==ve.current)return;We(g),y(w),N({}),P({}),C(null),fe(A=>Object.fromEntries(Object.entries(A).filter(I=>{let[pe]=I;return pe!==g}))),j(A=>Object.fromEntries(Object.entries(A).filter(I=>{let[pe]=I;return pe!==g})))}catch(w){let A=w;if(v!==ve.current)return;y(null),$(Fe(A))}},"D"),e[5]=l,e[6]=M):M=e[6];let B=M,ae;e[7]!==l?(ae=r(async()=>{ce(null);try{xe(await l.listGlobalTables())}catch(g){let v=g;xe(null),ce(Fe(v))}},"se"),e[7]=l,e[8]=ae):ae=e[8];let ue=ae,D,ne;e[9]!==c||e[10]!==B||e[11]!==ue?(D=r(()=>{ge(B(c)),ge(ue())},"R"),ne=[B,ue,c],e[9]=c,e[10]=B,e[11]=ue,e[12]=D,e[13]=ne):(D=e[12],ne=e[13]),(0,x.useEffect)(D,ne);let R;e[14]!==l||e[15]!==K||e[16]!==T||e[17]!==c?(R=r(async g=>{if(T===g){C(null);return}C(g);let v=`${c}:${g}`;if(K[v]!==void 0)return;let[w,A]=await Promise.allSettled([l.query(dt,{limit:1,offset:0,table:g},Ee(c)),l.query(it,{table:g},Ee(c))]);w.status==="fulfilled"?N(I=>({...I,[v]:w.value.columns})):$(Fe(w.reason)),A.status==="fulfilled"&&P(I=>({...I,[v]:A.value.indexes}))},"K"),e[14]=l,e[15]=K,e[16]=T,e[17]=c,e[18]=R):R=e[18];let se=R,re;e[19]!==l||e[20]!==W||e[21]!==X?(re=r(async g=>{if(X===g){me(null);return}if(me(g),W[g]===void 0)try{let v=await l.readGlobalTablePage({limit:1,offset:0,table:g});Ce(w=>({...w,[g]:v.columns}))}catch(v){ce(Fe(v))}},"oe"),e[19]=l,e[20]=W,e[21]=X,e[22]=re):re=e[22];let he=re,Y=(0,x.useRef)(void 0),Z,V;e[23]!==n||e[24]!==i||e[25]!==se?(Z=r(()=>{n===void 0||i===null||Y.current===n||i.some(g=>g.name===n)&&(Y.current=n,ge(se(n)))},"Q"),V=[n,i,se],e[23]=n,e[24]=i,e[25]=se,e[26]=Z,e[27]=V):(Z=e[26],V=e[27]),(0,x.useEffect)(Z,V);let oe;e[28]!==l?(oe=r(async(g,v,w)=>{let[A,I]=await Promise.all([Promise.allSettled([l.query(ct,{tables:[...v,...w]},Ee(g))]),Promise.all(w.map(async Q=>{let Se=await Promise.allSettled([l.readGlobalTablePage({limit:1,offset:0,table:Q})]),Ve=Se[0].status==="fulfilled"?Se[0].value:void 0;return{columns:Ve?.columns??[],refs:Ve?.refs??{},table:Q}}))]),pe=A[0].status==="fulfilled"?A[0].value?.columnsByTable??{}:{},_e=A[0].status==="rejected",Ie=new Map(I.map(ht)),G=[...v,...w].map(Q=>{let Se=pe[Q]??[];return[Q,Se.length>0?Se:Ie.get(Q)??[]]});fe(Q=>({...Q,[g]:Object.fromEntries(G)})),j(Q=>({...Q,[g]:_e}))},"ie"),e[28]=l,e[29]=oe):oe=e[29];let U=oe,ie,J;e[30]!==L||e[31]!==k||e[32]!==U||e[33]!==c||e[34]!==F||e[35]!==i||e[36]!==a?(ie=r(()=>{a!=="graph"||i===null||k===null&&L===null||F[c]!==void 0||ge(U(c,i.map(pt),(k??[]).map(gt)))},"re"),J=[a,i,k,L,c,F,U],e[30]=L,e[31]=k,e[32]=U,e[33]=c,e[34]=F,e[35]=i,e[36]=a,e[37]=ie,e[38]=J):(ie=e[37],J=e[38]),(0,x.useEffect)(ie,J);let q=F[c]??mt,H;if(e[39]!==q||e[40]!==k||e[41]!==i){let g;e[43]!==q?(g=r(I=>({columns:q[I.name]??He,name:I.name,tier:"shard"}),"h"),e[43]=q,e[44]=g):g=e[44];let v=(i??[]).map(g),w;e[45]!==q?(w=r(I=>({columns:q[I.name]??He,name:I.name,tier:"global"}),"N"),e[45]=q,e[46]=w):w=e[46];let A=(k??[]).map(w);H=[...v,...A],e[39]=q,e[40]=k,e[41]=i,e[42]=H}else H=e[42];let f=H,ee;if(e[47]!==o||e[48]!==i){let g=o.trim().toLowerCase();ee=(i??[]).filter(v=>v.name.toLowerCase().includes(g)),e[47]=o,e[48]=i,e[49]=ee}else ee=e[49];let de=ee,ye;if(e[50]!==k||e[51]!==o){let g=o.trim().toLowerCase();ye=(k??[]).filter(v=>v.name.toLowerCase().includes(g)),e[50]=k,e[51]=o,e[52]=ye}else ye=e[52];let Te=ye,Ne;return e[53]!==K||e[54]!==f||e[55]!==p||e[56]!==T||e[57]!==Te||e[58]!==de||e[59]!==W||e[60]!==L||e[61]!==X||e[62]!==k||e[63]!==E||e[64]!==B||e[65]!==d||e[66]!==_||e[67]!==b||e[68]!==o||e[69]!==i||e[70]!==se||e[71]!==he||e[72]!==a?(Ne={columns:K,diagramTables:f,error:p,expanded:T,filteredGlobalTables:Te,filteredTables:de,globalColumns:W,globalError:L,globalExpanded:X,globalTables:k,indexes:E,refresh:B,setShardKey:d,setTableFilter:h,setView:m,shardColumnsError:_,shardKey:b,tableFilter:o,tables:i,toggle:se,toggleGlobal:he,view:a},e[53]=K,e[54]=f,e[55]=p,e[56]=T,e[57]=Te,e[58]=de,e[59]=W,e[60]=L,e[61]=X,e[62]=k,e[63]=E,e[64]=B,e[65]=d,e[66]=_,e[67]=b,e[68]=o,e[69]=i,e[70]=se,e[71]=he,e[72]=a,e[73]=Ne):Ne=e[73],Ne},"mt");function ht(s){let{columns:e,refs:u,table:n}=s;return[n,e.map(l=>{let a=u[l];return a===void 0?{name:l,optional:!1,type:""}:{name:l,optional:!1,ref:a,type:"id"}})]}r(ht,"ut");function pt(s){return s.name}r(pt,"ft");function gt(s){return s.name}r(gt,"ht");var bt="/__lunora/schema-edit",ft=r(async s=>{let e=await fetch(bt,{body:JSON.stringify(s),headers:{"Content-Type":"application/json"},method:"POST"}),u=await e.json();return u.needsMigration===!0?{kind:"needs-migration",message:u.message??"This edit needs a migration."}:e.ok&&u.tables!==void 0?{diagnostics:u.diagnostics??[],kind:"ok",tables:u.tables}:{kind:"error",message:u.error??`schema edit failed (${String(e.status)})`}},"gt"),xt=r(s=>{let e=(0,we.c)(32),{hasTables:u,mode:n,onAddColumn:l,onAddIndex:a,onAddTable:m,onDestructive:c}=s,d=Oe(),b=n==="addTable"?"default":"outline",o;e[0]!==d?(o=d("Add table"),e[0]=d,e[1]=o):o=e[1];let h;e[2]!==m||e[3]!==b||e[4]!==o?(h=(0,t.jsx)(be,{"data-testid":"sc-editor-add-table",onClick:m,size:"xs",type:"button",variant:b,children:o}),e[2]=m,e[3]=b,e[4]=o,e[5]=h):h=e[5];let i=!u,y=n==="addColumn"?"default":"outline",p;e[6]!==d?(p=d("Add column"),e[6]=d,e[7]=p):p=e[7];let $;e[8]!==l||e[9]!==i||e[10]!==y||e[11]!==p?($=(0,t.jsx)(be,{"data-testid":"sc-editor-add-column",disabled:i,onClick:l,size:"xs",type:"button",variant:y,children:p}),e[8]=l,e[9]=i,e[10]=y,e[11]=p,e[12]=$):$=e[12];let S=!u,K=n==="addIndex"?"default":"outline",N;e[13]!==d?(N=d("Add index"),e[13]=d,e[14]=N):N=e[14];let O;e[15]!==a||e[16]!==N||e[17]!==S||e[18]!==K?(O=(0,t.jsx)(be,{"data-testid":"sc-editor-add-index",disabled:S,onClick:a,size:"xs",type:"button",variant:K,children:N}),e[15]=a,e[16]=N,e[17]=S,e[18]=K,e[19]=O):O=e[19];let E=!u,P=n==="destructive"?"default":"ghost",T;e[20]!==d?(T=d("Rename / drop / change type\u2026"),e[20]=d,e[21]=T):T=e[21];let C;e[22]!==c||e[23]!==E||e[24]!==P||e[25]!==T?(C=(0,t.jsx)(be,{"data-testid":"sc-editor-destructive",disabled:E,onClick:c,size:"xs",type:"button",variant:P,children:T}),e[22]=c,e[23]=E,e[24]=P,e[25]=T,e[26]=C):C=e[26];let z;return e[27]!==O||e[28]!==C||e[29]!==h||e[30]!==$?(z=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[h,$,O,C]}),e[27]=O,e[28]=C,e[29]=h,e[30]=$,e[31]=z):z=e[31],z},"bt"),vt=r(s=>{let e=(0,we.c)(28),{onOpenMigrations:u,result:n}=s,l=Oe();if(n===null){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(t.Fragment,{}),e[0]=o):o=e[0],o}if(n.kind==="error"){let o;return e[1]!==n.message?(o=(0,t.jsx)("p",{className:"mt-3 text-sm text-destructive","data-testid":"sc-editor-error",role:"alert",children:n.message}),e[1]=n.message,e[2]=o):o=e[2],o}if(n.kind==="needs-migration"){let o;e[3]!==n.message||e[4]!==l?(o=n.message===""?l("This edit changes stored data and must go through a migration. Review the migration before applying."):n.message,e[3]=n.message,e[4]=l,e[5]=o):o=e[5];let h;e[6]!==o?(h=(0,t.jsx)("p",{className:"text-sm text-warning",role:"alert",children:o}),e[6]=o,e[7]=h):h=e[7];let i;e[8]!==l?(i=l("Open Migrations"),e[8]=l,e[9]=i):i=e[9];let y;e[10]!==u||e[11]!==i?(y=(0,t.jsx)(be,{className:"self-start","data-testid":"sc-editor-open-migrations",onClick:u,size:"xs",type:"button",variant:"outline",children:i}),e[10]=u,e[11]=i,e[12]=y):y=e[12];let p;return e[13]!==h||e[14]!==y?(p=(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-2","data-testid":"sc-editor-needs-migration",children:[h,y]}),e[13]=h,e[14]=y,e[15]=p):p=e[15],p}if(n.diagnostics.length===0){let o;return e[16]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(t.Fragment,{}),e[16]=o):o=e[16],o}let a;e[17]!==l?(a=l("Codegen reported diagnostics:"),e[17]=l,e[18]=a):a=e[18];let m;e[19]!==a?(m=(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:a}),e[19]=a,e[20]=m):m=e[20];let c;e[21]!==n.diagnostics?(c=n.diagnostics.map(yt),e[21]=n.diagnostics,e[22]=c):c=e[22];let d;e[23]!==c?(d=(0,t.jsx)("ul",{className:"flex flex-col gap-0.5",children:c}),e[23]=c,e[24]=d):d=e[24];let b;return e[25]!==m||e[26]!==d?(b=(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"sc-editor-diagnostics",children:[m,d]}),e[25]=m,e[26]=d,e[27]=b):b=e[27],b},"xt");function yt(s){return(0,t.jsx)("li",{className:"font-mono text-[11px] text-destructive",children:s},s)}r(yt,"vt");var Nt=[{label:"string",validator:"v.string()"},{label:"number",validator:"v.number()"},{label:"boolean",validator:"v.boolean()"},{label:"bigint",validator:"v.bigint()"},{label:"bytes",validator:"v.bytes()"},{label:"any",validator:"v.any()"}],Ct="v.string()",Tt=r(s=>s.split(",").map(e=>e.trim()).filter(e=>e!==""),"Nt"),wt=r(s=>{let e=(0,we.c)(83),{onApplied:u,tableNames:n}=s,l=Oe(),a=Ue(),[m,c]=(0,x.useState)(null),[d,b]=(0,x.useState)(!1),[o,h]=(0,x.useState)(null),[i,y]=(0,x.useState)(""),[p,$]=(0,x.useState)(""),[S,K]=(0,x.useState)(Ct),[N,O]=(0,x.useState)(n[0]??""),[E,P]=(0,x.useState)(""),[T,C]=(0,x.useState)(""),[z,F]=(0,x.useState)(!1),fe;e[0]===Symbol.for("react.memo_cache_sentinel")?(fe=r(()=>{c(null),y(""),$(""),P(""),C(""),F(!1)},"pe"),e[0]=fe):fe=e[0];let te=fe,_;e[1]!==u?(_=r(async G=>{b(!0),h(null);try{let Q=await ft(G);h(Q),Q.kind==="ok"&&(u(Q.tables),te())}catch(Q){let Se=Q;h({kind:"error",message:Se instanceof Error?Se.message:String(Se)})}b(!1)},"E"),e[1]=u,e[2]=_):_=e[2];let j=_,k;e[3]!==j||e[4]!==i?(k=r(()=>{ge(j({kind:"addTable",table:i.trim()}))},"w"),e[3]=j,e[4]=i,e[5]=k):k=e[5];let xe=k,L;e[6]!==p||e[7]!==j||e[8]!==N||e[9]!==S?(L=r(()=>{ge(j({column:p.trim(),kind:"addOptionalColumn",table:N,validator:S}))},"B"),e[6]=p,e[7]=j,e[8]=N,e[9]=S,e[10]=L):L=e[10];let ce=L,le;e[11]!==T||e[12]!==E||e[13]!==j||e[14]!==N||e[15]!==z?(le=r(()=>{ge(j({fields:Tt(T),kind:"addIndex",name:E.trim(),table:N,unique:z}))},"le"),e[11]=T,e[12]=E,e[13]=j,e[14]=N,e[15]=z,e[16]=le):le=e[16];let W=le,Ce;e[17]===Symbol.for("react.memo_cache_sentinel")?(Ce=r(()=>{h(null),c("addTable")},"Ne"),e[17]=Ce):Ce=e[17];let X=Ce,me;e[18]===Symbol.for("react.memo_cache_sentinel")?(me=r(()=>{h(null),c("addColumn")},"me"),e[18]=me):me=e[18];let ve=me,M;e[19]===Symbol.for("react.memo_cache_sentinel")?(M=r(()=>{h(null),c("addIndex")},"D"),e[19]=M):M=e[19];let B=M,ae;e[20]!==l?(ae=r(()=>{c("destructive"),h({kind:"needs-migration",message:l("This edit changes stored data and must go through a migration. Review the migration before applying.")})},"se"),e[20]=l,e[21]=ae):ae=e[21];let ue=ae,D;e[22]===Symbol.for("react.memo_cache_sentinel")?(D=r(G=>{y(G.target.value)},"R"),e[22]=D):D=e[22];let ne=D,R;e[23]===Symbol.for("react.memo_cache_sentinel")?(R=r(G=>{$(G.target.value)},"K"),e[23]=R):R=e[23];let se=R,re;e[24]===Symbol.for("react.memo_cache_sentinel")?(re=r(G=>{K(G.target.value)},"oe"),e[24]=re):re=e[24];let he=re,Y;e[25]===Symbol.for("react.memo_cache_sentinel")?(Y=r(G=>{O(G.target.value)},"X"),e[25]=Y):Y=e[25];let Z=Y,V;e[26]===Symbol.for("react.memo_cache_sentinel")?(V=r(G=>{P(G.target.value)},"U"),e[26]=V):V=e[26];let oe=V,U;e[27]===Symbol.for("react.memo_cache_sentinel")?(U=r(G=>{C(G.target.value)},"V"),e[27]=U):U=e[27];let ie=U,J;e[28]===Symbol.for("react.memo_cache_sentinel")?(J=r(G=>{F(G.target.checked)},"Y"),e[28]=J):J=e[28];let q=J,H;e[29]!==a?(H=r(()=>{ge(a({to:"/migrations"}))},"Z"),e[29]=a,e[30]=H):H=e[30];let f=H,ee;e[31]!==l?(ee=l("Edit schema"),e[31]=l,e[32]=ee):ee=e[32];let de;e[33]!==ee?(de=(0,t.jsx)(Ke,{children:ee}),e[33]=ee,e[34]=de):de=e[34];let ye;e[35]!==l?(ye=l("Adds a table, column, or index to lunora/schema.ts and reruns codegen."),e[35]=l,e[36]=ye):ye=e[36];let Te;e[37]!==ye?(Te=(0,t.jsx)(Pe,{children:ye}),e[37]=ye,e[38]=Te):Te=e[38];let Ne;e[39]!==de||e[40]!==Te?(Ne=(0,t.jsxs)(Ge,{children:[de,Te]}),e[39]=de,e[40]=Te,e[41]=Ne):Ne=e[41];let g=n.length>0,v;e[42]!==m||e[43]!==ue||e[44]!==g?(v=(0,t.jsx)(xt,{hasTables:g,mode:m,onAddColumn:ve,onAddIndex:B,onAddTable:X,onDestructive:ue}),e[42]=m,e[43]=ue,e[44]=g,e[45]=v):v=e[45];let w;e[46]!==d||e[47]!==m||e[48]!==xe||e[49]!==l||e[50]!==i?(w=m==="addTable"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-table-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-table-name",children:l("Table name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-table-name",id:"sc-editor-table-name",onChange:ne,value:i})]}),(0,t.jsx)(be,{"data-testid":"sc-editor-table-apply",disabled:d||i.trim()==="",onClick:xe,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(be,{onClick:te,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[46]=d,e[47]=m,e[48]=xe,e[49]=l,e[50]=i,e[51]=w):w=e[51];let A;e[52]!==d||e[53]!==p||e[54]!==m||e[55]!==ce||e[56]!==l||e[57]!==n||e[58]!==N||e[59]!==S?(A=m==="addColumn"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-column-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-column-table",children:l("Table name")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-table",id:"sc-editor-column-table",onChange:Z,value:N,children:n.map(St)})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-column-name",children:l("Column name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-column-name",id:"sc-editor-column-name",onChange:se,value:p})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-column-type",children:l("Column type")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-type",id:"sc-editor-column-type",onChange:he,value:S,children:Nt.map(kt)})]}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:l("Optional")}),(0,t.jsx)(be,{"data-testid":"sc-editor-column-apply",disabled:d||p.trim()===""||N==="",onClick:ce,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(be,{onClick:te,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[52]=d,e[53]=p,e[54]=m,e[55]=ce,e[56]=l,e[57]=n,e[58]=N,e[59]=S,e[60]=A):A=e[60];let I;e[61]!==d||e[62]!==T||e[63]!==E||e[64]!==m||e[65]!==W||e[66]!==l||e[67]!==n||e[68]!==N||e[69]!==z?(I=m==="addIndex"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-index-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-index-table",children:l("Table name")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-index-table",id:"sc-editor-index-table",onChange:Z,value:N,children:n.map(_t)})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-index-name",children:l("Index name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-index-name",id:"sc-editor-index-name",onChange:oe,value:E})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-index-fields",children:l("Index fields (comma-separated)")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-index-fields",id:"sc-editor-index-fields",onChange:ie,value:T})]}),(0,t.jsxs)(ke,{className:"flex items-center gap-1 text-xs",htmlFor:"sc-editor-index-unique",children:[(0,t.jsx)("input",{checked:z,"data-testid":"sc-editor-index-unique",id:"sc-editor-index-unique",onChange:q,type:"checkbox"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:l("Unique")})]}),(0,t.jsx)(be,{"data-testid":"sc-editor-index-apply",disabled:d||E.trim()===""||T.trim()==="",onClick:W,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(be,{onClick:te,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[61]=d,e[62]=T,e[63]=E,e[64]=m,e[65]=W,e[66]=l,e[67]=n,e[68]=N,e[69]=z,e[70]=I):I=e[70];let pe;e[71]!==f||e[72]!==o?(pe=(0,t.jsx)(vt,{onOpenMigrations:f,result:o}),e[71]=f,e[72]=o,e[73]=pe):pe=e[73];let _e;e[74]!==v||e[75]!==w||e[76]!==A||e[77]!==I||e[78]!==pe?(_e=(0,t.jsxs)(Le,{children:[v,w,A,I,pe]}),e[74]=v,e[75]=w,e[76]=A,e[77]=I,e[78]=pe,e[79]=_e):_e=e[79];let Ie;return e[80]!==Ne||e[81]!==_e?(Ie=(0,t.jsxs)(qe,{"data-testid":"sc-editor",size:"sm",children:[Ne,_e]}),e[80]=Ne,e[81]=_e,e[82]=Ie):Ie=e[82],Ie},"Tt");function St(s){return(0,t.jsx)("option",{value:s,children:s},s)}r(St,"St");function kt(s){return(0,t.jsx)("option",{value:s.validator,children:s.label},s.validator)}r(kt,"wt");function _t(s){return(0,t.jsx)("option",{value:s,children:s},s)}r(_t,"_t");var et=[],It=r(s=>{let e=(0,we.c)(5),{open:u}=s,n=u&&"rotate-90",l;e[0]!==n?(l=De("size-3.5 shrink-0 text-muted-foreground transition-transform duration-150",n),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[2]=a):a=e[2];let m;return e[3]!==l?(m=(0,t.jsx)("svg",{"aria-hidden":"true",className:l,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:a}),e[3]=l,e[4]=m):m=e[4],m},"Et"),tt=r(s=>{let e=(0,we.c)(20),{children:u,expanded:n,name:l,onToggle:a,rowCount:m,rowTestId:c,toggleTestId:d}=s,b;e[0]!==n?(b=(0,t.jsx)(It,{open:n}),e[0]=n,e[1]=b):b=e[1];let o;e[2]!==l?(o=(0,t.jsx)("span",{className:"truncate font-mono text-xs text-foreground",title:l,children:l}),e[2]=l,e[3]=o):o=e[3];let h;e[4]!==m?(h=(0,t.jsxs)("span",{className:"ms-auto shrink-0 text-xs text-muted-foreground tabular-nums",children:["(",m,")"]}),e[4]=m,e[5]=h):h=e[5];let i;e[6]!==n||e[7]!==a||e[8]!==b||e[9]!==o||e[10]!==h||e[11]!==d?(i=(0,t.jsxs)("button",{"aria-expanded":n,className:"flex w-full items-center gap-2 px-3 py-2 text-start transition-colors hover:bg-muted/50 aria-expanded:bg-muted/40","data-testid":d,onClick:a,type:"button",children:[b,o," ",h]}),e[6]=n,e[7]=a,e[8]=b,e[9]=o,e[10]=h,e[11]=d,e[12]=i):i=e[12];let y;e[13]!==u||e[14]!==n?(y=n&&(0,t.jsx)("div",{className:"px-3 pb-3 ps-8",children:u}),e[13]=u,e[14]=n,e[15]=y):y=e[15];let p;return e[16]!==c||e[17]!==i||e[18]!==y?(p=(0,t.jsxs)("li",{className:"border-t border-border/60 first:border-t-0","data-testid":c,children:[i,y]}),e[16]=c,e[17]=i,e[18]=y,e[19]=p):p=e[19],p},"Je"),lt=r(s=>{let e=(0,we.c)(5),{columns:u,testId:n}=s,l;e[0]!==u?(l=u.map(zt),e[0]=u,e[1]=l):l=e[1];let a;return e[2]!==l||e[3]!==n?(a=(0,t.jsx)("ul",{className:"flex flex-wrap gap-1.5 pt-1","data-testid":n,children:l}),e[2]=l,e[3]=n,e[4]=a):a=e[4],a},"We"),At=r(s=>{let e=(0,we.c)(10),{heading:u,indexes:n,testId:l}=s,a;e[0]!==u?(a=(0,t.jsx)("p",{className:"mb-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:u}),e[0]=u,e[1]=a):a=e[1];let m;e[2]!==n?(m=n.map(Et),e[2]=n,e[3]=m):m=e[3];let c;e[4]!==m||e[5]!==l?(c=(0,t.jsx)("ul",{className:"flex flex-col gap-1","data-testid":l,children:m}),e[4]=m,e[5]=l,e[6]=c):c=e[6];let d;return e[7]!==a||e[8]!==c?(d=(0,t.jsxs)("div",{className:"pt-3",children:[a,c]}),e[7]=a,e[8]=c,e[9]=d):d=e[9],d},"It"),at=r(s=>De("border-b-2 px-3 py-2 font-mono text-[11px] tracking-widest uppercase outline-none transition-colors",s?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"Xe"),Xt=r(s=>{let e=(0,we.c)(85),{initialShardKey:u,initialTable:n,schemaEditable:l}=s,a=Oe(),m;e[0]!==u||e[1]!==n?(m={initialShardKey:u,initialTable:n},e[0]=u,e[1]=n,e[2]=m):m=e[2];let{columns:c,diagramTables:d,error:b,expanded:o,filteredGlobalTables:h,filteredTables:i,globalColumns:y,globalError:p,globalExpanded:$,globalTables:S,indexes:K,refresh:N,setShardKey:O,setTableFilter:E,setView:P,shardColumnsError:T,shardKey:C,tableFilter:z,tables:F,toggle:fe,toggleGlobal:te,view:_}=ut(m),j;e[3]!==P?(j=r(()=>{P("list")},"M"),e[3]=P,e[4]=j):j=e[4];let k=j,xe;e[5]!==P?(xe=r(()=>{P("graph")},"ge"),e[5]=P,e[6]=xe):xe=e[6];let L=xe,ce;e[7]!==E?(ce=r(f=>{E(f.target.value)},"ce"),e[7]=E,e[8]=ce):ce=e[8];let le=ce,W;e[9]!==N||e[10]!==C?(W=r(f=>{ge(N(C))},"J"),e[9]=N,e[10]=C,e[11]=W):W=e[11];let Ce=W,X;e[12]!==F?(X=F??[],e[12]=F,e[13]=X):X=e[13];let me;e[14]!==X?(me=X.map(Ft),e[14]=X,e[15]=me):me=e[15];let ve=me,M;e[16]!==O||e[17]!==C?(M=(0,t.jsx)(Xe,{onChange:O,testId:"sc-shard-input",value:C}),e[16]=O,e[17]=C,e[18]=M):M=e[18];let B;e[19]!==a?(B=a("Schema view"),e[19]=a,e[20]=B):B=e[20];let ae=_==="graph",ue=_==="graph",D;e[21]!==ue?(D=at(ue),e[21]=ue,e[22]=D):D=e[22];let ne;e[23]!==a?(ne=a("Graph"),e[23]=a,e[24]=ne):ne=e[24];let R;e[25]!==L||e[26]!==ae||e[27]!==D||e[28]!==ne?(R=(0,t.jsx)("button",{"aria-selected":ae,className:D,"data-testid":"sc-view-graph",onClick:L,role:"tab",type:"button",children:ne}),e[25]=L,e[26]=ae,e[27]=D,e[28]=ne,e[29]=R):R=e[29];let se=_==="list",re=_==="list",he;e[30]!==re?(he=at(re),e[30]=re,e[31]=he):he=e[31];let Y;e[32]!==a?(Y=a("Table list"),e[32]=a,e[33]=Y):Y=e[33];let Z;e[34]!==k||e[35]!==se||e[36]!==he||e[37]!==Y?(Z=(0,t.jsx)("button",{"aria-selected":se,className:he,"data-testid":"sc-view-list",onClick:k,role:"tab",type:"button",children:Y}),e[34]=k,e[35]=se,e[36]=he,e[37]=Y,e[38]=Z):Z=e[38];let V;e[39]!==R||e[40]!==Z||e[41]!==B?(V=(0,t.jsxs)("div",{"aria-label":B,className:"flex items-center gap-1","data-testid":"sc-view-toggle",role:"tablist",children:[R,Z]}),e[39]=R,e[40]=Z,e[41]=B,e[42]=V):V=e[42];let oe;e[43]!==V||e[44]!==M?(oe=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[M,V]}),e[43]=V,e[44]=M,e[45]=oe):oe=e[45];let U;e[46]!==Ce||e[47]!==l||e[48]!==ve?(U=l===!0&&(0,t.jsx)(wt,{onApplied:Ce,tableNames:ve}),e[46]=Ce,e[47]=l,e[48]=ve,e[49]=U):U=e[49];let ie;e[50]!==le||e[51]!==a||e[52]!==z||e[53]!==_?(ie=_==="list"&&(0,t.jsx)(Ae,{"aria-label":a("Filter tables"),className:"h-8 max-w-xs","data-testid":"sc-filter",onChange:le,placeholder:a("Filter tables"),value:z}),e[50]=le,e[51]=a,e[52]=z,e[53]=_,e[54]=ie):ie=e[54];let J;e[55]!==d||e[56]!==b||e[57]!==p||e[58]!==T||e[59]!==C||e[60]!==_?(J=_==="graph"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"sc-graph-view",children:[b!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:b}),p!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:p}),(0,t.jsx)(Ze,{columnsError:T[C]===!0,tables:d,testIdPrefix:"sc-graph"})]}),e[55]=d,e[56]=b,e[57]=p,e[58]=T,e[59]=C,e[60]=_,e[61]=J):J=e[61];let q;e[62]!==c||e[63]!==b||e[64]!==o||e[65]!==h||e[66]!==i||e[67]!==y||e[68]!==p||e[69]!==$||e[70]!==S||e[71]!==K||e[72]!==C||e[73]!==a||e[74]!==F||e[75]!==fe||e[76]!==te||e[77]!==_?(q=_==="list"&&(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)(qe,{"data-testid":"sc-shard-section",size:"sm",children:[(0,t.jsxs)(Ge,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(Re,{tier:"shard"}),(0,t.jsx)(Ke,{children:a("Shard tables")}),F!==null&&(0,t.jsx)(je,{className:"ms-auto tabular-nums",variant:"outline",children:i.length})]}),(0,t.jsx)(Pe,{children:Me.shard.hint})]}),(0,t.jsxs)(Le,{children:[b!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:b}),F!==null&&F.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-empty",children:a("No tables in this shard.")}),F!==null&&F.length>0&&i.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-no-match",children:a("No tables match your filter.")}),i.length>0&&(0,t.jsx)("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-table-list",children:i.map(f=>{let ee=`${C}:${f.name}`,de=K[ee]??[];return(0,t.jsxs)(tt,{expanded:o===f.name,name:f.name,onToggle:r(()=>{ge(fe(f.name))},"onToggle"),rowCount:f.rowCount,rowTestId:`sc-table-${f.name}`,toggleTestId:`sc-toggle-${f.name}`,children:[(0,t.jsx)(lt,{columns:c[ee]??et,testId:`sc-columns-${f.name}`}),de.length>0&&(0,t.jsx)(At,{heading:a("Indexes"),indexes:de,testId:`sc-indexes-${f.name}`})]},f.name)})})]})]}),(0,t.jsxs)(qe,{"data-testid":"sc-global-section",size:"sm",children:[(0,t.jsxs)(Ge,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(Re,{tier:"global"}),(0,t.jsx)(Ke,{children:a("Global tables (D1)")}),S!==null&&(0,t.jsx)(je,{className:"ms-auto tabular-nums",variant:"outline",children:h.length})]}),(0,t.jsx)(Pe,{children:Me.global.hint})]}),(0,t.jsxs)(Le,{children:[p!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:p}),S!==null&&S.length===0&&(0,t.jsx)(Qe,{description:Me.global.hint,testId:"sc-global-empty",title:a("No global tables.")}),S!==null&&S.length>0&&h.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-global-no-match",children:a("No tables match your filter.")}),h.length>0&&(0,t.jsx)("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-global-table-list",children:h.map(f=>(0,t.jsx)(tt,{expanded:$===f.name,name:f.name,onToggle:r(()=>{ge(te(f.name))},"onToggle"),rowCount:f.rowCount,rowTestId:`sc-global-table-${f.name}`,toggleTestId:`sc-global-toggle-${f.name}`,children:(0,t.jsx)(lt,{columns:y[f.name]??et,testId:`sc-global-columns-${f.name}`})},f.name))})]})]})]}),e[62]=c,e[63]=b,e[64]=o,e[65]=h,e[66]=i,e[67]=y,e[68]=p,e[69]=$,e[70]=S,e[71]=K,e[72]=C,e[73]=a,e[74]=F,e[75]=fe,e[76]=te,e[77]=_,e[78]=q):q=e[78];let H;return e[79]!==oe||e[80]!==U||e[81]!==ie||e[82]!==J||e[83]!==q?(H=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schema",children:[oe,U,ie,J,q]}),e[79]=oe,e[80]=U,e[81]=ie,e[82]=J,e[83]=q,e[84]=H):H=e[84],H},"Qt");function zt(s){return(0,t.jsx)("li",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:s},s)}r(zt,"kt");function Et(s){return(0,t.jsxs)("li",{className:"flex flex-wrap items-center gap-1.5 text-xs",children:[(0,t.jsx)("span",{className:"font-mono",children:s.name}),(0,t.jsx)(je,{variant:"outline",children:s.type}),s.unique===!0&&(0,t.jsx)(je,{variant:"secondary",children:"unique"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:s.fields.join(", ")})]},`${s.type}:${s.name}`)}r(Et,"At");function Ft(s){return s.name}r(Ft,"$t");export{Xt as SchemaViewer};
@@ -0,0 +1 @@
1
+ import{a as b}from"./chunk-ZPQBVYNN.js";import{x as v}from"./chunk-GNI37YCV.js";import{a as x}from"./chunk-GWNGVKLG.js";import{b as g}from"./chunk-6G3E4PJ2.js";import{a as c,d as l}from"./chunk-5PEAXTYQ.js";var u=l(x(),1);var s=l(g(),1);var p=b("flex items-start gap-2 rounded-md border px-3 py-2 text-sm [&>svg]:mt-0.5 [&>svg]:size-4 [&>svg]:shrink-0",{defaultVariants:{variant:"default"},variants:{variant:{default:"border-border bg-muted/40 text-foreground",destructive:"border-destructive/40 bg-destructive/5 text-destructive",warning:"border-amber-500/40 bg-amber-500/5 text-amber-700 dark:text-amber-400"}}}),j=c(f=>{let t=(0,u.c)(10),{children:d,className:i,icon:m,testId:o,variant:n}=f,e;t[0]!==i||t[1]!==n?(e=v(p({variant:n}),i),t[0]=i,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==d?(r=(0,s.jsx)("div",{className:"min-w-0 flex-1",children:d}),t[3]=d,t[4]=r):r=t[4];let a;return t[5]!==m||t[6]!==e||t[7]!==r||t[8]!==o?(a=(0,s.jsxs)("div",{className:e,"data-testid":o,role:"alert",children:[m,r]}),t[5]=m,t[6]=e,t[7]=r,t[8]=o,t[9]=a):a=t[9],a},"N");export{j as a};
@@ -0,0 +1 @@
1
+ import{a as Z}from"./chunk-J45HAKBU.js";import{a as te}from"./chunk-YEVTA35E.js";import{a as Y}from"./chunk-FHLODLBC.js";import{b as X}from"./chunk-3D67ZJRW.js";import{a as W}from"./chunk-DA2CAFXI.js";import"./chunk-ZSWW2UGP.js";import{i as D}from"./chunk-RTS5G3ET.js";import"./chunk-QRA7AKYO.js";import"./chunk-IHGRWY3Y.js";import"./chunk-OWRKSQPE.js";import"./chunk-4EPW63HS.js";import{b as ae,c as ne}from"./chunk-4NKJV7YX.js";import{a as q,b as ee}from"./chunk-Z6VILGGP.js";import{a as V}from"./chunk-V3BE427M.js";import"./chunk-CKEQX655.js";import"./chunk-UD5REVU2.js";import"./chunk-T3ZCW3RG.js";import"./chunk-YEXTJUKQ.js";import"./chunk-LSEUUZN4.js";import"./chunk-7QEZ2SFW.js";import"./chunk-OZAOWE7T.js";import"./chunk-BBDTJG2K.js";import"./chunk-4PI2OSSP.js";import{a as I}from"./chunk-2W4UO5BC.js";import{c as A}from"./chunk-4N76XUNG.js";import"./chunk-OK2QU2EV.js";import{m as Q}from"./chunk-SHHGIT7M.js";import"./chunk-ZPQBVYNN.js";import{B as _,h as M,i as C,o as G,s as N}from"./chunk-GNI37YCV.js";import"./chunk-PDBW6GTJ.js";import{a as me}from"./chunk-GWNGVKLG.js";import{a as he,b as pe}from"./chunk-6G3E4PJ2.js";import{a as l,d as j}from"./chunk-5PEAXTYQ.js";var E=j(me(),1);var c=j(he(),1);var S=j(pe(),1);var ge=l(t=>{let{suggestedIndex:e,table:r}=t;if(typeof r!="string"||r.length===0||typeof e!="object"||e===null)return!1;let{fields:a,name:n}=e;return!Array.isArray(a)||a.length===0||a.some(i=>typeof i!="string"||i.length===0)?!1:typeof n=="string"&&n.length>0},"xe"),be=l((t,e)=>`.index(${JSON.stringify(t)}, [${e.map(r=>JSON.stringify(r)).join(", ")}])`,"ge"),xe=l(t=>{let e=(0,E.c)(19),{fields:r,indexName:a,table:n,testId:i}=t,u=_(),[h,f]=(0,c.useState)(null),m;e[0]!==r||e[1]!==a?(m=l(()=>{let b=be(a,r),$="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]=r,e[1]=a,e[2]=m):m=e[2];let y=m;if(h!==null){let b;return e[3]!==h.copied||e[4]!==h.declaration||e[5]!==u||e[6]!==n||e[7]!==i?(b=h.copied?(0,S.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`${i}-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":`${i}-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]=i,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]!==y||e[15]!==T||e[16]!==p||e[17]!==i?(w=(0,S.jsx)(te,{confirmLabel:T,onConfirm:y,testId:i,children:p}),e[14]=y,e[15]=T,e[16]=p,e[17]=i,e[18]=w):w=e[18],w},"ve"),ye=l((t,e)=>{let r=new Map;for(let a of e){let n=`${a.table} ${a.index}`;r.set(n,(r.get(n)??0)+a.reads)}return t.map(a=>({index:a.index,reads:r.get(`${a.table} ${a.index}`)??0,table:a.table}))},"Se"),ve=l(t=>{let e=new Map;for(let r of t)for(let a of r.scannedTables??[])e.set(a.table,(e.get(a.table)??0)+a.scans);return[...e].map(([r,a])=>({scans:a,table:r}))},"Te"),re=l((t,e)=>e.map(r=>({index:r.name,table:t})),"P"),we=l(t=>{let e=ye(t.declaredIndexes??[],t.indexHits??[]),r=ve(t.functions??[]),a=t.shardTraffic??[],n=t.analyticsMetrics,i=n&&n.indexHits.length>0?n.indexHits:e,u=n&&n.tableScans.length>0?n.tableScans:r,h=n&&n.shardTraffic.length>0?n.shardTraffic:a,f=ne({indexHits:i,schema:{tables:[]},shardTraffic:h,tableScans:u},{lints:ae,source:"runtime"}),m=t.suppressHotScanTables;return(m===void 0?f:f.filter(y=>!(y.metadata.kind==="hot_scan"&&typeof y.metadata.table=="string"&&m.has(y.metadata.table)))).map(y=>q(y))},"we"),Se=M(I.listTables),Te=M(I.listTableIndexes),Ie=M(I.listTablesIndexes),B=l(t=>`${(t*100).toFixed(1)}%`,"H"),se=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"),ie=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:se(e.value),tables:$e(e.tables??[])}),"slow-function":t("Slowest call took {duration}.",{duration:se(e.value)}),"storage-headroom":t("{size} of the 10 GiB per-shard ceiling \u2014 plan a .shardBy() migration while it still has runway.",{size:G(e.value)})})[e.kind],"U"),Ne=l(t=>{let e=(0,E.c)(10),{onJump:r,table:a}=t,n=_(),i;e[0]!==r||e[1]!==a?(i=l(()=>{r(a)},"o"),e[0]=r,e[1]=a,e[2]=i):i=e[2];let u=i,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)(V,{"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 r=Q(),a=D(),n=_(),{queryShardKey:i,setShardKey:u,shardKey:h}=Z(t),[f,m]=(0,c.useState)(null),[y,T]=(0,c.useState)(null),p=(0,c.useRef)(""),w=A(I.getMetrics,{},{live:!0,shardKey:i}),b=A(I.getFunctionStats,{},{live:!0,shardKey:i}),$=A(I.getAdvisories,{},{live:!0,shardKey:i}),L=w.data??null,K=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??(s=>r.shardTraffic(s)),le=l(async(s,x)=>{let o=s[0];if(o===void 0||o===""){p.current===x&&T(null);return}try{let g=await oe(o);if(p.current!==x)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===x&&T(null)}},"Y"),de=l(async(s,x)=>{let o=await Promise.allSettled(s.map(async d=>[d,await r.query(Te,{table:d},C(x))])),g=[];for(let d of o)if(d.status==="fulfilled"){let[v,k]=d.value;g.push(...re(v,k.indexes))}return g},"Z"),z=(0,c.useEffectEvent)(async s=>{p.current=s;let x=[];try{let o=await r.query(Se,{},C(s));if(p.current!==s)return;X(s),x=o.map(d=>d.name);let g=[];if(x.length>0)try{let d=await r.query(Ie,{tables:x},C(s));if(p.current!==s)return;for(let[v,k]of Object.entries(d.indexesByTable))g.push(...re(v,k))}catch{if(g=await de(x,s),p.current!==s)return}m(g)}catch{p.current===s&&m(null)}await le(x,s)});(0,c.useEffect)(()=>{N(z(i))},[i]);let ce=(0,c.useEffectEvent)(()=>{w.refetch(),b.refetch(),$.refetch(),N(z(i))});(0,c.useEffect)(()=>{let s=l(()=>{document.visibilityState==="visible"&&ce()},"r");return document.addEventListener("visibilitychange",s),()=>{document.removeEventListener("visibilitychange",s)}},[]);let U=(0,c.useCallback)(s=>{N(a({search:{table:s},to:"/schema"}))},[a]),H=(0,c.useMemo)(()=>W(L,K),[K,L]),P=(0,c.useMemo)(()=>new Set(H.filter(s=>s.kind==="missing-index").flatMap(s=>s.tables??[])),[H]),R=(0,c.useMemo)(()=>we({declaredIndexes:f??[],functions:K,indexHits:J,shardTraffic:y,suppressHotScanTables:P}),[f,K,J,P,y]),ue=(0,c.useMemo)(()=>{let s=H.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?ie(n,o):`${ie(n,o)} \u2014 ${o.message}`,entity:o.fn,issueType:ke(n,o),key:`${o.kind}:${o.fn??""}`,level:o.severity}}),x=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(F??[]).map(o=>{let g=q(o);if(x.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)(xe,{fields:v.fields,indexName:v.name,table:d,testId:k})}}return g}),...R,...s]},[F,H,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,shardKey:i,testId:"lunora-insights",toolbar:fe})},"Ue");export{ze as InsightsPanel};
@@ -0,0 +1 @@
1
+ import{a as O}from"./chunk-PJUVJTDR.js";import{a as C}from"./chunk-TKBTZX4K.js";import{a as c}from"./chunk-RCXNYW7P.js";import{b as N}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as k}from"./chunk-YEXTJUKQ.js";import"./chunk-LSEUUZN4.js";import{a as w,b as T,c as A,d as f,e as s,f as l}from"./chunk-7QEZ2SFW.js";import"./chunk-OZAOWE7T.js";import"./chunk-BBDTJG2K.js";import"./chunk-4PI2OSSP.js";import{a as v}from"./chunk-2W4UO5BC.js";import{c as p}from"./chunk-4N76XUNG.js";import{a as b,e as S}from"./chunk-OK2QU2EV.js";import"./chunk-SHHGIT7M.js";import"./chunk-ZPQBVYNN.js";import{B as y}from"./chunk-GNI37YCV.js";import"./chunk-PDBW6GTJ.js";import"./chunk-GWNGVKLG.js";import{a as R,b as V}from"./chunk-6G3E4PJ2.js";import{a as n,d as x}from"./chunk-5PEAXTYQ.js";var F=x(R(),1);var e=x(V(),1);var $=n(a=>{let t=a.trim();if(t.length===0)return{context:void 0,error:null};try{let o=JSON.parse(t);return o===null||typeof o!="object"||Array.isArray(o)?{context:void 0,error:"Targeting context must be a JSON object."}:{context:o,error:null}}catch{return{context:void 0,error:"Targeting context is not valid JSON."}}},"H"),q='{ "targetingKey": "user-123", "plan": "premium" }',D=n(a=>a.type==="object"?JSON.stringify(a.value):String(a.value),"R"),Y=n(({initialShardKey:a=""})=>{let t=y(),[o,j]=(0,F.useState)(""),{context:g,error:m}=$(o),I=g===void 0?{}:{context:g},{data:i,error:J,errorSource:K,liveError:E}=p(v.listFlags,I,{live:!0,shardKey:a}),u=i!==void 0,L=i?.configured??!1,h=Array.isArray(i?.flags)?[...i.flags].toSorted((r,B)=>r.key.localeCompare(B.key)):[],d;return u&&!L?d=(0,e.jsx)(c,{description:t("No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags."),testId:"flags-unconfigured",title:t("No flags provider configured")}):u&&h.length===0?d=(0,e.jsx)(c,{description:t('A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean("key", false) in a query, mutation, or action.'),testId:"flags-empty",title:t("No flags read")}):d=(0,e.jsx)(b,{className:"overflow-hidden py-0",children:(0,e.jsx)(S,{className:"px-0",children:(0,e.jsxs)(w,{"data-testid":"flags-table",children:[(0,e.jsx)(T,{children:(0,e.jsxs)(f,{children:[(0,e.jsx)(s,{children:t("Key")}),(0,e.jsx)(s,{children:t("Type")}),(0,e.jsx)(s,{children:t("Value")}),(0,e.jsx)(s,{children:t("Reason")}),(0,e.jsx)(s,{children:t("Variant")})]})}),(0,e.jsx)(A,{children:h.map(r=>(0,e.jsxs)(f,{"data-testid":`flags-row-${r.key}`,children:[(0,e.jsx)(l,{className:"font-mono text-xs",children:r.key}),(0,e.jsx)(l,{className:"font-mono text-xs text-muted-foreground",children:r.type}),(0,e.jsx)(l,{className:"font-mono text-xs",children:D(r)}),(0,e.jsx)(l,{children:r.errorCode===void 0?(0,e.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:r.reason??"\u2014"}):(0,e.jsx)(N,{"data-testid":`flags-error-${r.key}`,variant:"destructive",children:r.errorCode})}),(0,e.jsx)(l,{className:"font-mono text-xs text-muted-foreground",children:r.variant??"\u2014"})]},r.key))})]})})}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-flags-panel",children:[J!==null&&(0,e.jsx)(k,{error:K,shardKey:a,testId:"flags-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t('Feature flags are read in code with ctx.flags.<type>("key", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.')}),(0,e.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,e.jsx)(C,{htmlFor:"flags-targeting-context",children:t("Targeting context (JSON)")}),(0,e.jsx)(O,{className:"font-mono text-xs","data-testid":"flags-context-input",id:"flags-targeting-context",onChange:n(r=>{j(r.target.value)},"onChange"),placeholder:q,rows:3,value:o}),m!==null&&(0,e.jsx)("p",{className:"text-xs text-destructive","data-testid":"flags-context-error",role:"alert",children:t(m)}),E!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"flags-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")})]}),d]})},"W");export{Y as default};