@lunora/studio 1.0.0-alpha.30 → 1.0.0-alpha.301

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 (465) hide show
  1. package/LICENSE.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/index.d.mts +1581 -0
  4. package/dist/index.d.ts +974 -806
  5. package/dist/index.mjs +1 -0
  6. package/dist/mount.d.mts +22 -0
  7. package/dist/mount.d.ts +11 -10
  8. package/dist/mount.mjs +1 -0
  9. package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -0
  10. package/dist/packem_chunks/ApiTab.mjs +1 -0
  11. package/dist/packem_chunks/AuditPanel.mjs +1 -0
  12. package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -0
  13. package/dist/packem_chunks/ExportImportPanel.mjs +3 -0
  14. package/dist/packem_chunks/FileBrowser.mjs +4 -0
  15. package/dist/packem_chunks/FunctionRunner.mjs +1 -0
  16. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -0
  17. package/dist/packem_chunks/HealthPanel.mjs +1 -0
  18. package/dist/packem_chunks/InsightsPanel.mjs +1 -0
  19. package/dist/packem_chunks/LogsPanel.mjs +1 -0
  20. package/dist/packem_chunks/MailPanel.mjs +2 -0
  21. package/dist/packem_chunks/MetricsPanel.mjs +1 -0
  22. package/dist/packem_chunks/NotificationsPanel.mjs +1 -0
  23. package/dist/packem_chunks/PitrPanel.mjs +1 -0
  24. package/dist/packem_chunks/SchemaViewer.mjs +1 -0
  25. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -0
  26. package/dist/packem_chunks/SettingsPanel.mjs +1 -0
  27. package/dist/packem_chunks/SqlEditorPanel.mjs +10 -0
  28. package/dist/packem_chunks/TableEditor.mjs +1 -0
  29. package/dist/packem_chunks/agents-panel.mjs +1 -0
  30. package/dist/packem_chunks/ai-usage-panel.mjs +1 -0
  31. package/dist/packem_chunks/analytics-panel.mjs +1 -0
  32. package/dist/packem_chunks/architecture-panel.mjs +1 -0
  33. package/dist/packem_chunks/auth-audit-panel.mjs +1 -0
  34. package/dist/packem_chunks/auth-config-panel.mjs +1 -0
  35. package/dist/packem_chunks/auth-sessions-panel.mjs +1 -0
  36. package/dist/packem_chunks/containers-panel.mjs +1 -0
  37. package/dist/packem_chunks/dashboards-panel.mjs +1 -0
  38. package/dist/packem_chunks/evals-panel.mjs +1 -0
  39. package/dist/packem_chunks/fanout-panel.mjs +1 -0
  40. package/dist/packem_chunks/flags-panel.mjs +1 -0
  41. package/dist/packem_chunks/issues-panel.mjs +1 -0
  42. package/dist/packem_chunks/kv-browser.mjs +1 -0
  43. package/dist/packem_chunks/log-drains-panel.mjs +4 -0
  44. package/dist/packem_chunks/migrations-route.mjs +1 -0
  45. package/dist/packem_chunks/organizations-panel.mjs +1 -0
  46. package/dist/packem_chunks/payments-panel.mjs +1 -0
  47. package/dist/packem_chunks/permissions-panel.mjs +1 -0
  48. package/dist/packem_chunks/privacy-requests-panel.mjs +1 -0
  49. package/dist/packem_chunks/queues-panel.mjs +1 -0
  50. package/dist/packem_chunks/reactors-panel.mjs +1 -0
  51. package/dist/packem_chunks/rls-panel.mjs +1 -0
  52. package/dist/packem_chunks/schedule-panel.mjs +1 -0
  53. package/dist/packem_chunks/sparkline.mjs +1 -0
  54. package/dist/packem_chunks/storage-rules-panel.mjs +1 -0
  55. package/dist/packem_chunks/subscriptions-panel.mjs +1 -0
  56. package/dist/packem_chunks/sync-client-panel.mjs +1 -0
  57. package/dist/packem_chunks/traces-panel.mjs +1 -0
  58. package/dist/packem_chunks/users-panel.mjs +1 -0
  59. package/dist/packem_chunks/vector-browser.mjs +1 -0
  60. package/dist/packem_chunks/workflows-panel.mjs +1 -0
  61. package/dist/packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs +1 -0
  62. package/dist/packem_shared/ApiDocsPanel-fhDlZGE4.mjs +2 -0
  63. package/dist/packem_shared/ApiReferencePanel-nAf8tNRr.mjs +1 -0
  64. package/dist/packem_shared/CommandPalette-D9ZY-qQd.mjs +1 -0
  65. package/dist/packem_shared/ConfirmButton-DU4p72Er.mjs +1 -0
  66. package/dist/packem_shared/ConnectionBadge-B8Hj5DaE.mjs +1 -0
  67. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs +1 -0
  68. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs +1 -0
  69. package/dist/packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs +1 -0
  70. package/dist/packem_shared/DataBrowser-E68QfaST.mjs +4 -0
  71. package/dist/packem_shared/DataFilters-CYZFt2EK.mjs +1 -0
  72. package/dist/packem_shared/ErrorBoundary-BWNF98VF.mjs +1 -0
  73. package/dist/packem_shared/GlobalDataBrowser-DhObcZDY.mjs +1 -0
  74. package/dist/packem_shared/HomePanel-CUuYsApa.mjs +1 -0
  75. package/dist/packem_shared/MigrationsPanel-CkVIwAbK.mjs +1 -0
  76. package/dist/packem_shared/OpenRpcReferencePanel-BxEr49D9.mjs +1 -0
  77. package/dist/packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.mjs +1 -0
  78. package/dist/packem_shared/ScheduledJobs-BZNcYWBP.mjs +1 -0
  79. package/dist/packem_shared/ShardInput-C6mjgAh4.mjs +1 -0
  80. package/dist/packem_shared/Studio-CZjQXFHC.mjs +1 -0
  81. package/dist/packem_shared/StudioApp-C9ENwcOH.mjs +1 -0
  82. package/dist/packem_shared/StudioI18nProvider-fVsCSs5L.mjs +1 -0
  83. package/dist/packem_shared/advisor-view-DzI2RQhY.mjs +1 -0
  84. package/dist/packem_shared/aggregateMetrics-DKFJc-o5.mjs +1 -0
  85. package/dist/packem_shared/alert-PB5W11MM.mjs +1 -0
  86. package/dist/packem_shared/app.d-D7vL0y8y.d.mts +349 -0
  87. package/dist/packem_shared/app.d-D7vL0y8y.d.ts +349 -0
  88. package/dist/packem_shared/auth-pager-DiDnXsfe.mjs +1 -0
  89. package/dist/packem_shared/badge-r_5B4LHP.mjs +1 -0
  90. package/dist/packem_shared/bar-chart-BCsEIQoQ.mjs +6 -0
  91. package/dist/packem_shared/browser-storage-BH1MxLZs.mjs +1 -0
  92. package/dist/packem_shared/button-q0UYSmrn.mjs +1 -0
  93. package/dist/packem_shared/card-By2O8ULa.mjs +1 -0
  94. package/dist/packem_shared/cf-links-CBJ5SywP.mjs +1 -0
  95. package/dist/packem_shared/checkbox-CnS9cyCz.mjs +1 -0
  96. package/dist/packem_shared/control-button-BOZ5K-FC.mjs +1 -0
  97. package/dist/packem_shared/data-grid-DIiNmDR9.mjs +1 -0
  98. package/dist/packem_shared/data-view-params-DhYmAkcj.mjs +1 -0
  99. package/dist/packem_shared/diagram-export-panel-D5CVNJkp.mjs +2 -0
  100. package/dist/packem_shared/dropdown-menu-jLZenfWH.mjs +2 -0
  101. package/dist/packem_shared/empty-state-D7jEML_T.mjs +1 -0
  102. package/dist/packem_shared/error-alert-DueSEkt-.mjs +1 -0
  103. package/dist/packem_shared/grid-features-OVIMIQan.mjs +6 -0
  104. package/dist/packem_shared/grid-pagination-DgzyzfBh.mjs +1 -0
  105. package/dist/packem_shared/home-panel-BcE8S2Nn.mjs +3 -0
  106. package/dist/packem_shared/input-CXhxesPC.mjs +1 -0
  107. package/dist/packem_shared/internal-Df43vQI0.mjs +2 -0
  108. package/dist/packem_shared/label-DKFzyHq6.mjs +1 -0
  109. package/dist/packem_shared/live-status-BuJdUZFU.mjs +1 -0
  110. package/dist/packem_shared/log-fields-BolUoZ9g.mjs +1 -0
  111. package/dist/packem_shared/log-line-CICyJ_kc.mjs +1 -0
  112. package/dist/packem_shared/metrics-format-1sNGG47R.mjs +1 -0
  113. package/dist/packem_shared/modal-shell-CDztwLnv.mjs +1 -0
  114. package/dist/packem_shared/operation-console-provider-DoloEvon.mjs +1 -0
  115. package/dist/packem_shared/recording-client-CyFiAE2l.mjs +1 -0
  116. package/dist/packem_shared/reference-view-CIHyURU6.mjs +13 -0
  117. package/dist/packem_shared/schema-diagram-C5oilX7l.mjs +2 -0
  118. package/dist/packem_shared/scroll-area-CXCQH7VT.mjs +2 -0
  119. package/dist/packem_shared/select-DPyS18Vy.mjs +2 -0
  120. package/dist/packem_shared/shard-history-CaO3C4KQ.mjs +1 -0
  121. package/dist/packem_shared/shortcuts-B9gDaXmw.mjs +1 -0
  122. package/dist/packem_shared/skeleton-DX1gfixl.mjs +1 -0
  123. package/dist/packem_shared/sparkline-B_sPPO_8.mjs +1 -0
  124. package/dist/packem_shared/sql-result-table-DyK762_A.mjs +1 -0
  125. package/dist/packem_shared/stat-card-BAv73QtB.mjs +1 -0
  126. package/dist/packem_shared/storage-tier-C2mKwYRj.mjs +1 -0
  127. package/dist/packem_shared/studio-fK2DTLde.mjs +2 -0
  128. package/dist/packem_shared/table-D0SBiDu-.mjs +2 -0
  129. package/dist/packem_shared/table-list-sidebar-DkPO_Qtz.mjs +1 -0
  130. package/dist/packem_shared/textarea--40GKAyz.mjs +1 -0
  131. package/dist/packem_shared/trace-handoff-BV3EWqy_.mjs +1 -0
  132. package/dist/packem_shared/use-admin-query-tlBof8Yg.mjs +1 -0
  133. package/dist/packem_shared/use-admin-spec-Bir7V68L.mjs +1 -0
  134. package/dist/packem_shared/use-async-submit-CZqCMTJ_.mjs +1 -0
  135. package/dist/packem_shared/use-auth-config-Z_n4ABCI.mjs +1 -0
  136. package/dist/packem_shared/use-mirrored-ref-CVDf2z1M.mjs +1 -0
  137. package/dist/packem_shared/use-open-trace-DMVhpnyG.mjs +1 -0
  138. package/dist/packem_shared/use-shard-key-BsP3o5wT.mjs +1 -0
  139. package/dist/packem_shared/use-sql-assistant-CZydTzd5.mjs +1 -0
  140. package/dist/packem_shared/useDebounced-DVeQ5-oW.mjs +1 -0
  141. package/dist/packem_shared/utils-bhneXptQ.mjs +1 -0
  142. package/dist/packem_shared/virtual-rect-D_j7aLxX.mjs +1 -0
  143. package/dist/standalone/chunk-24T422OY.js +1 -0
  144. package/dist/standalone/chunk-253UHWDX.js +1 -0
  145. package/dist/standalone/chunk-2I4NHEKA.js +1 -0
  146. package/dist/standalone/chunk-2IKDEUCX.js +1 -0
  147. package/dist/standalone/chunk-2LJRI76T.js +1 -0
  148. package/dist/standalone/chunk-2SGUZAFC.js +1 -0
  149. package/dist/standalone/chunk-2TP3H244.js +1 -0
  150. package/dist/standalone/chunk-2VA5S3IA.js +1 -0
  151. package/dist/standalone/chunk-37WYCOQ2.js +1 -0
  152. package/dist/standalone/chunk-3M7IXVST.js +1 -0
  153. package/dist/standalone/chunk-3YXASVTP.js +1 -0
  154. package/dist/standalone/chunk-45M2SFAD.js +1 -0
  155. package/dist/standalone/chunk-4FAWIWSZ.js +1 -0
  156. package/dist/standalone/chunk-4WD4XGC3.js +1 -0
  157. package/dist/standalone/chunk-4ZEL6BYL.js +1 -0
  158. package/dist/standalone/chunk-55UGUCQ6.js +1 -0
  159. package/dist/standalone/chunk-5B2RTXBS.js +1 -0
  160. package/dist/standalone/chunk-5QR2SQIS.js +1 -0
  161. package/dist/standalone/chunk-5WGHX3BJ.js +1 -0
  162. package/dist/standalone/chunk-6HLARDYO.js +1 -0
  163. package/dist/standalone/chunk-6JBF34XO.js +1 -0
  164. package/dist/standalone/chunk-6PDZ5QSX.js +3 -0
  165. package/dist/standalone/chunk-6QTAHSDD.js +1 -0
  166. package/dist/standalone/chunk-6X76NBY7.js +2 -0
  167. package/dist/standalone/chunk-76CINMOE.js +1 -0
  168. package/dist/standalone/chunk-76GDLOCA.js +1 -0
  169. package/dist/standalone/chunk-7G4Z6Q7X.js +1 -0
  170. package/dist/standalone/chunk-7IIQBGQK.js +1 -0
  171. package/dist/standalone/chunk-7NWLYOGL.js +1 -0
  172. package/dist/standalone/chunk-7PBPAGC2.js +3 -0
  173. package/dist/standalone/chunk-7RKB5KS7.js +1 -0
  174. package/dist/standalone/chunk-7Y3SY37W.js +1 -0
  175. package/dist/standalone/chunk-APWVPIZV.js +1 -0
  176. package/dist/standalone/chunk-AUAECCXB.js +1 -0
  177. package/dist/standalone/{chunk-BJGBHGK3.js → chunk-AUGKHAMQ.js} +1 -1
  178. package/dist/standalone/chunk-AZHAXSRA.js +1 -0
  179. package/dist/standalone/chunk-B6WI7CHG.js +1 -0
  180. package/dist/standalone/chunk-BOMPSVRC.js +1 -0
  181. package/dist/standalone/chunk-BXUP4USX.js +1 -0
  182. package/dist/standalone/chunk-CCDX5RYT.js +1 -0
  183. package/dist/standalone/chunk-CG2BXM3M.js +1 -0
  184. package/dist/standalone/chunk-CGQMJYCW.js +1 -0
  185. package/dist/standalone/chunk-CVXNHIQW.js +1 -0
  186. package/dist/standalone/chunk-CZBYO7MB.js +1 -0
  187. package/dist/standalone/chunk-D2MWAZIR.js +1 -0
  188. package/dist/standalone/chunk-D4KVIMPR.js +4 -0
  189. package/dist/standalone/chunk-DRFPILA5.js +1 -0
  190. package/dist/standalone/chunk-E3LQQON3.js +1 -0
  191. package/dist/standalone/chunk-E4PXACVL.js +3 -0
  192. package/dist/standalone/chunk-ECY2JC5F.js +1 -0
  193. package/dist/standalone/chunk-F4CHPK5T.js +1 -0
  194. package/dist/standalone/chunk-F7CMFUN5.js +1 -0
  195. package/dist/standalone/chunk-FPI7AMQJ.js +1 -0
  196. package/dist/standalone/chunk-FSHFJSTY.js +1 -0
  197. package/dist/standalone/chunk-FUYEZFBP.js +1 -0
  198. package/dist/standalone/chunk-G6EOMCDE.js +9 -0
  199. package/dist/standalone/chunk-G74GIEU4.js +1 -0
  200. package/dist/standalone/chunk-GHQ2VDI2.js +1 -0
  201. package/dist/standalone/chunk-HCTJKP5J.js +1 -0
  202. package/dist/standalone/chunk-HJHSQPHW.js +19 -0
  203. package/dist/standalone/chunk-HLFK7BP6.js +1 -0
  204. package/dist/standalone/chunk-HV77I2E5.js +1 -0
  205. package/dist/standalone/chunk-HX5A6HC7.js +1 -0
  206. package/dist/standalone/chunk-I26MS5PJ.js +1 -0
  207. package/dist/standalone/chunk-IWZ7GVQO.js +1 -0
  208. package/dist/standalone/chunk-J6GRPDN3.js +1 -0
  209. package/dist/standalone/chunk-JQXA2OYK.js +1 -0
  210. package/dist/standalone/chunk-JVZG34HR.js +1 -0
  211. package/dist/standalone/chunk-JZGTSH2C.js +4 -0
  212. package/dist/standalone/chunk-K76MCCBF.js +1 -0
  213. package/dist/standalone/chunk-KNVOVRC7.js +1 -0
  214. package/dist/standalone/chunk-KQSQVNVI.js +1 -0
  215. package/dist/standalone/chunk-L7XFE7ZQ.js +15 -0
  216. package/dist/standalone/chunk-MGVUIQTE.js +5 -0
  217. package/dist/standalone/chunk-MK7SA3YV.js +8 -0
  218. package/dist/standalone/chunk-MVWZMWPD.js +1 -0
  219. package/dist/standalone/chunk-N62W6SXC.js +1 -0
  220. package/dist/standalone/chunk-N7ZLG6XW.js +1 -0
  221. package/dist/standalone/chunk-NCPW7WHO.js +1 -0
  222. package/dist/standalone/chunk-NDTQTKDX.js +6 -0
  223. package/dist/standalone/chunk-NGVP66OH.js +1 -0
  224. package/dist/standalone/chunk-NNYTSWRW.js +1 -0
  225. package/dist/standalone/chunk-NQZALRU3.js +1 -0
  226. package/dist/standalone/chunk-NRP22GKC.js +1 -0
  227. package/dist/standalone/chunk-NXQW5E6W.js +1 -0
  228. package/dist/standalone/chunk-OPM7ESDV.js +1 -0
  229. package/dist/standalone/chunk-OQ6I6OXT.js +2 -0
  230. package/dist/standalone/chunk-OSGXNEFA.js +1 -0
  231. package/dist/standalone/chunk-OYCUPD3Q.js +1 -0
  232. package/dist/standalone/chunk-PD2VK52L.js +1 -0
  233. package/dist/standalone/chunk-PIMTWCRD.js +1 -0
  234. package/dist/standalone/chunk-PSPU5HSH.js +1 -0
  235. package/dist/standalone/chunk-Q6ED4KUL.js +1 -0
  236. package/dist/standalone/chunk-Q6IT6ZD7.js +1 -0
  237. package/dist/standalone/chunk-QAQDMS6R.js +1 -0
  238. package/dist/standalone/chunk-QJLHH3ET.js +1 -0
  239. package/dist/standalone/chunk-R6U22RSY.js +1 -0
  240. package/dist/standalone/chunk-RGMVGZV4.js +1 -0
  241. package/dist/standalone/chunk-RJWFF2KE.js +1 -0
  242. package/dist/standalone/chunk-RWVIV3U7.js +1 -0
  243. package/dist/standalone/chunk-RZ6QAA2I.js +1 -0
  244. package/dist/standalone/chunk-S4Z7K55A.js +1 -0
  245. package/dist/standalone/chunk-SA2OGF3F.js +1 -0
  246. package/dist/standalone/chunk-SJQERRSZ.js +1 -0
  247. package/dist/standalone/chunk-SV764LKQ.js +1 -0
  248. package/dist/standalone/chunk-TVUR3FJ4.js +1 -0
  249. package/dist/standalone/chunk-U5ESUXRC.js +1 -0
  250. package/dist/standalone/chunk-UC7MNI2F.js +1 -0
  251. package/dist/standalone/chunk-UD4LDX2S.js +1 -0
  252. package/dist/standalone/chunk-UX6CSZ3D.js +1 -0
  253. package/dist/standalone/chunk-UYEZR3BI.js +1 -0
  254. package/dist/standalone/chunk-V3A4MT5T.js +1 -0
  255. package/dist/standalone/chunk-VCFEO3RI.js +1 -0
  256. package/dist/standalone/chunk-VESGIGMQ.js +1 -0
  257. package/dist/standalone/chunk-VNLBEXJH.js +1 -0
  258. package/dist/standalone/chunk-VOL6MWI6.js +1 -0
  259. package/dist/standalone/chunk-WIASRPIC.js +59 -0
  260. package/dist/standalone/chunk-WJRYEML4.js +1 -0
  261. package/dist/standalone/chunk-WZ44V6FP.js +1 -0
  262. package/dist/standalone/chunk-XGCIDUJF.js +1 -0
  263. package/dist/standalone/chunk-XHRKNCCI.js +1 -0
  264. package/dist/standalone/chunk-XIAH5TMC.js +1 -0
  265. package/dist/standalone/chunk-XILJ2PEQ.js +1 -0
  266. package/dist/standalone/chunk-XNN6PY57.js +14 -0
  267. package/dist/standalone/chunk-Y3AYVFTK.js +1 -0
  268. package/dist/standalone/chunk-YEB2U5KT.js +1 -0
  269. package/dist/standalone/chunk-YLPATGWK.js +15 -0
  270. package/dist/standalone/chunk-YQL6PSXT.js +1 -0
  271. package/dist/standalone/chunk-YRYRCORI.js +1 -0
  272. package/dist/standalone/chunk-YVR4SEPU.js +1 -0
  273. package/dist/standalone/chunk-YZPYGQZ5.js +1 -0
  274. package/dist/standalone/chunk-Z22BDS6N.js +1 -0
  275. package/dist/standalone/chunk-ZKJS6EBE.js +1 -0
  276. package/dist/standalone/studio.js +9 -214
  277. package/dist/styles.css +2 -2
  278. package/package.json +26 -21
  279. package/dist/index.js +0 -41
  280. package/dist/mount.js +0 -26
  281. package/dist/packem_chunks/ApiTab.js +0 -251
  282. package/dist/packem_chunks/AuditPanel.js +0 -200
  283. package/dist/packem_chunks/ExportImportPanel.js +0 -197
  284. package/dist/packem_chunks/FileBrowser.js +0 -2932
  285. package/dist/packem_chunks/FunctionRunner.js +0 -343
  286. package/dist/packem_chunks/FunctionStatsPanel.js +0 -375
  287. package/dist/packem_chunks/HealthPanel.js +0 -648
  288. package/dist/packem_chunks/InsightsPanel.js +0 -461
  289. package/dist/packem_chunks/LogsPanel.js +0 -827
  290. package/dist/packem_chunks/MailPanel.js +0 -440
  291. package/dist/packem_chunks/MetricsPanel.js +0 -1344
  292. package/dist/packem_chunks/MigrationsPanel.js +0 -239
  293. package/dist/packem_chunks/PitrPanel.js +0 -252
  294. package/dist/packem_chunks/SchemaViewer.js +0 -2512
  295. package/dist/packem_chunks/SecurityAdvisorPanel.js +0 -92
  296. package/dist/packem_chunks/SettingsPanel.js +0 -390
  297. package/dist/packem_chunks/SqlEditorPanel.js +0 -2322
  298. package/dist/packem_chunks/TableEditor.js +0 -313
  299. package/dist/packem_chunks/analytics-panel.js +0 -261
  300. package/dist/packem_chunks/auth-config-panel.js +0 -179
  301. package/dist/packem_chunks/auth-sessions-panel.js +0 -175
  302. package/dist/packem_chunks/dashboards-panel.js +0 -779
  303. package/dist/packem_chunks/fanout-panel.js +0 -481
  304. package/dist/packem_chunks/flags-panel.js +0 -176
  305. package/dist/packem_chunks/kv-browser.js +0 -1896
  306. package/dist/packem_chunks/log-drains-panel.js +0 -273
  307. package/dist/packem_chunks/organizations-panel.js +0 -670
  308. package/dist/packem_chunks/payments-panel.js +0 -185
  309. package/dist/packem_chunks/permissions-panel.js +0 -804
  310. package/dist/packem_chunks/queues-panel.js +0 -147
  311. package/dist/packem_chunks/rls-panel.js +0 -313
  312. package/dist/packem_chunks/schedule-panel.js +0 -831
  313. package/dist/packem_chunks/sparkline.js +0 -79
  314. package/dist/packem_chunks/storage-rules-panel.js +0 -138
  315. package/dist/packem_chunks/subscriptions-panel.js +0 -236
  316. package/dist/packem_chunks/users-panel.js +0 -1265
  317. package/dist/packem_chunks/vector-browser.js +0 -281
  318. package/dist/packem_chunks/workflows-panel.js +0 -562
  319. package/dist/packem_shared/ADMIN_FUNCTIONS-CdaxLGkE.js +0 -48
  320. package/dist/packem_shared/ApiDocsPanel-B6u_wnz-.js +0 -842
  321. package/dist/packem_shared/ApiReferencePanel-Drz4UO0a.js +0 -230
  322. package/dist/packem_shared/CommandPalette-B5BertvU.js +0 -373
  323. package/dist/packem_shared/ConfirmButton-C2eVi2Qv.js +0 -59
  324. package/dist/packem_shared/ConnectionBadge-B2DDM2Tn.js +0 -111
  325. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +0 -50
  326. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +0 -89
  327. package/dist/packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js +0 -27
  328. package/dist/packem_shared/DataBrowser-ANTHLWWh.js +0 -4493
  329. package/dist/packem_shared/DataFilters-FNquMaiu.js +0 -249
  330. package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +0 -66
  331. package/dist/packem_shared/GlobalDataBrowser-CjgTG_wa.js +0 -289
  332. package/dist/packem_shared/HomePanel-c2FodE9t.js +0 -14
  333. package/dist/packem_shared/OpenRpcReferencePanel-CspFdbUT.js +0 -192
  334. package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +0 -3
  335. package/dist/packem_shared/ScheduledJobs-BEJXtsBn.js +0 -262
  336. package/dist/packem_shared/ShardInput-gx_DZXXn.js +0 -107
  337. package/dist/packem_shared/Studio-CVTtA_sB.js +0 -16
  338. package/dist/packem_shared/StudioApp-BSYV2fz6.js +0 -657
  339. package/dist/packem_shared/StudioI18nProvider-B-tDCZIi.js +0 -48
  340. package/dist/packem_shared/advisor-view-DzqyvUU3.js +0 -159
  341. package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +0 -108
  342. package/dist/packem_shared/app.d-B6MyY_al.d.ts +0 -300
  343. package/dist/packem_shared/badge-B2PKA1-5.js +0 -49
  344. package/dist/packem_shared/bar-chart-Bb__F5-u.js +0 -3245
  345. package/dist/packem_shared/browser-storage-d03UsV7v.js +0 -249
  346. package/dist/packem_shared/button-BhsN2uZH.js +0 -49
  347. package/dist/packem_shared/card-DURq3ElK.js +0 -175
  348. package/dist/packem_shared/cf-links-BZfRdxSE.js +0 -8
  349. package/dist/packem_shared/checkbox-UNkzAxl-.js +0 -63
  350. package/dist/packem_shared/data-grid-Dsg6nRjo.js +0 -183
  351. package/dist/packem_shared/data-view-params-Cd6yRVbv.js +0 -96
  352. package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +0 -280
  353. package/dist/packem_shared/empty-state-DY_oe0k6.js +0 -98
  354. package/dist/packem_shared/grid-features-D7nNzBYm.js +0 -745
  355. package/dist/packem_shared/home-panel-aOR_drVv.js +0 -1637
  356. package/dist/packem_shared/input-XH4r1Pt1.js +0 -53
  357. package/dist/packem_shared/internal-FcNZ3beb.js +0 -68
  358. package/dist/packem_shared/label-D8ykjn5J.js +0 -46
  359. package/dist/packem_shared/live-status-FZ0psC1z.js +0 -44
  360. package/dist/packem_shared/modal-shell-hyaJvIJ6.js +0 -100
  361. package/dist/packem_shared/reference-view-Doy1XlQq.js +0 -2140
  362. package/dist/packem_shared/select-UkNYCT3s.js +0 -273
  363. package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
  364. package/dist/packem_shared/skeleton-CGhL0p20.js +0 -45
  365. package/dist/packem_shared/sparkline-KgMPHS4u.js +0 -93
  366. package/dist/packem_shared/storage-tier-CL98eOvn.js +0 -85
  367. package/dist/packem_shared/studio-dMTJ-kRR.js +0 -3987
  368. package/dist/packem_shared/table-DsCa9Qp9.js +0 -246
  369. package/dist/packem_shared/table-list-sidebar-VMo0ftxD.js +0 -832
  370. package/dist/packem_shared/textarea-D3gaCU_-.js +0 -46
  371. package/dist/packem_shared/use-admin-query-BViPA3US.js +0 -105
  372. package/dist/packem_shared/use-auth-capabilities-BHkoBnbZ.js +0 -32
  373. package/dist/packem_shared/useDebounced-Dxncpg6z.js +0 -32
  374. package/dist/packem_shared/utils-B05Dmz_H.js +0 -8
  375. package/dist/packem_shared/virtual-rect-CVMUskSm.js +0 -10
  376. package/dist/standalone/chunk-2DS7JLWL.js +0 -13
  377. package/dist/standalone/chunk-2K47A3P6.js +0 -1
  378. package/dist/standalone/chunk-2NGUNNGW.js +0 -1
  379. package/dist/standalone/chunk-2PDQ4KZ6.js +0 -1
  380. package/dist/standalone/chunk-3BP4BTLR.js +0 -4
  381. package/dist/standalone/chunk-3OA7PECS.js +0 -6
  382. package/dist/standalone/chunk-4QHKBC77.js +0 -1
  383. package/dist/standalone/chunk-57LYXHXH.js +0 -1
  384. package/dist/standalone/chunk-5NSZVXCS.js +0 -1
  385. package/dist/standalone/chunk-5OIBXYZM.js +0 -1
  386. package/dist/standalone/chunk-63XKJQTQ.js +0 -1
  387. package/dist/standalone/chunk-6RC6L33K.js +0 -4
  388. package/dist/standalone/chunk-6VTGE3WJ.js +0 -1
  389. package/dist/standalone/chunk-7PBZKXYA.js +0 -1
  390. package/dist/standalone/chunk-7POIIWC5.js +0 -3
  391. package/dist/standalone/chunk-7RYIQKZA.js +0 -1
  392. package/dist/standalone/chunk-7TJJXVSE.js +0 -1
  393. package/dist/standalone/chunk-AB6QGMBF.js +0 -1
  394. package/dist/standalone/chunk-AHILM3ZP.js +0 -1
  395. package/dist/standalone/chunk-AQGOX5DK.js +0 -1
  396. package/dist/standalone/chunk-ASLGNHAX.js +0 -1
  397. package/dist/standalone/chunk-BHTPZS7L.js +0 -4
  398. package/dist/standalone/chunk-D7HKX4DI.js +0 -1
  399. package/dist/standalone/chunk-DGWTR4G7.js +0 -1
  400. package/dist/standalone/chunk-DSX53PBM.js +0 -1
  401. package/dist/standalone/chunk-DV2MNASX.js +0 -1
  402. package/dist/standalone/chunk-DWDILV2E.js +0 -1
  403. package/dist/standalone/chunk-E7AVZZKO.js +0 -1
  404. package/dist/standalone/chunk-EGJX34WM.js +0 -1
  405. package/dist/standalone/chunk-FCR3HKFV.js +0 -1
  406. package/dist/standalone/chunk-FKO3HO6I.js +0 -4
  407. package/dist/standalone/chunk-FQKNJSRA.js +0 -76
  408. package/dist/standalone/chunk-G2TFEWEQ.js +0 -4
  409. package/dist/standalone/chunk-GABMIICA.js +0 -1
  410. package/dist/standalone/chunk-GTM65MVX.js +0 -1
  411. package/dist/standalone/chunk-GZXPPJVK.js +0 -1
  412. package/dist/standalone/chunk-HFBRE65A.js +0 -1
  413. package/dist/standalone/chunk-HFMQNUBC.js +0 -1
  414. package/dist/standalone/chunk-HG7Q5B3H.js +0 -1
  415. package/dist/standalone/chunk-HTQL7AXU.js +0 -1
  416. package/dist/standalone/chunk-HV7G6DFP.js +0 -5
  417. package/dist/standalone/chunk-ITLLHEVG.js +0 -1
  418. package/dist/standalone/chunk-J6J54MBP.js +0 -1
  419. package/dist/standalone/chunk-JSEXCW5Q.js +0 -1
  420. package/dist/standalone/chunk-KEGAWN6Y.js +0 -1
  421. package/dist/standalone/chunk-KG3QTFWE.js +0 -1
  422. package/dist/standalone/chunk-KGS7KM4A.js +0 -2
  423. package/dist/standalone/chunk-KODWGUAB.js +0 -1
  424. package/dist/standalone/chunk-KZ6INM5M.js +0 -1
  425. package/dist/standalone/chunk-MGFEVTRI.js +0 -1
  426. package/dist/standalone/chunk-N2QDG3MW.js +0 -1
  427. package/dist/standalone/chunk-N4JI6VQD.js +0 -1
  428. package/dist/standalone/chunk-NNISYDNI.js +0 -1
  429. package/dist/standalone/chunk-O4PXDNR3.js +0 -1
  430. package/dist/standalone/chunk-O77VNUFD.js +0 -1
  431. package/dist/standalone/chunk-OD2POGPJ.js +0 -1
  432. package/dist/standalone/chunk-OXCK3ZUG.js +0 -1
  433. package/dist/standalone/chunk-P7DSVO4U.js +0 -1
  434. package/dist/standalone/chunk-PKAM3N5C.js +0 -1
  435. package/dist/standalone/chunk-QGXGBHQO.js +0 -1
  436. package/dist/standalone/chunk-QHA3TAEJ.js +0 -1
  437. package/dist/standalone/chunk-QQWC62X7.js +0 -1
  438. package/dist/standalone/chunk-RMYA7NAH.js +0 -1
  439. package/dist/standalone/chunk-RRCPZMC2.js +0 -22
  440. package/dist/standalone/chunk-S53RUBW5.js +0 -1
  441. package/dist/standalone/chunk-SB4GT6PK.js +0 -1
  442. package/dist/standalone/chunk-SEU5V7I6.js +0 -1
  443. package/dist/standalone/chunk-SHIOUDOT.js +0 -1
  444. package/dist/standalone/chunk-SIDRSX7Y.js +0 -1
  445. package/dist/standalone/chunk-SVR644RF.js +0 -1
  446. package/dist/standalone/chunk-TAD43CG5.js +0 -1
  447. package/dist/standalone/chunk-TBMYIZIO.js +0 -1
  448. package/dist/standalone/chunk-TICVNLPM.js +0 -1
  449. package/dist/standalone/chunk-TQ36RWOP.js +0 -1
  450. package/dist/standalone/chunk-UGMRUEBU.js +0 -1
  451. package/dist/standalone/chunk-UII66UVF.js +0 -1
  452. package/dist/standalone/chunk-VJPQUBN6.js +0 -8
  453. package/dist/standalone/chunk-VLXV72QE.js +0 -1
  454. package/dist/standalone/chunk-VMJKJWG6.js +0 -1
  455. package/dist/standalone/chunk-VPDPN5RR.js +0 -2
  456. package/dist/standalone/chunk-VSEGZA3J.js +0 -1
  457. package/dist/standalone/chunk-VXBZQIGY.js +0 -4
  458. package/dist/standalone/chunk-W7PCVQTE.js +0 -1
  459. package/dist/standalone/chunk-XLILSHPE.js +0 -1
  460. package/dist/standalone/chunk-XURNGQSS.js +0 -1
  461. package/dist/standalone/chunk-YJGANMU7.js +0 -18
  462. package/dist/standalone/chunk-YQQJ4N6U.js +0 -1
  463. package/dist/standalone/chunk-ZH7UES4T.js +0 -2
  464. package/dist/standalone/chunk-ZPUO7FNI.js +0 -1
  465. package/dist/standalone/chunk-ZQCVDXDL.js +0 -1
@@ -0,0 +1,14 @@
1
+ import{a as le}from"./chunk-6HLARDYO.js";import{a as je}from"./chunk-FPI7AMQJ.js";import{a as he}from"./chunk-37WYCOQ2.js";import{a as V}from"./chunk-SA2OGF3F.js";import{d as Ne,f as ke,g as we,k as oe}from"./chunk-GHQ2VDI2.js";import{a as Pe}from"./chunk-YVR4SEPU.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import{i as ve}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as W}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as ye}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as $e}from"./chunk-4ZEL6BYL.js";import{l as F}from"./chunk-G6EOMCDE.js";import"./chunk-QAQDMS6R.js";import{d as be}from"./chunk-YLPATGWK.js";import{a as U}from"./chunk-RWVIV3U7.js";import{d as J,e as Se,f as se,g as ie,h as fe,m as Ie,p as Oe,s as ae}from"./chunk-HJHSQPHW.js";import{a as u,d as K,e as me,f as te,g as re,i as ue}from"./chunk-I26MS5PJ.js";var Ge=K(te(),1),xe=K(me(),1);var Y=K(te(),1);var X=K(me(),1);var R=K(re(),1);var Ve=se($e.listTables),Xe=["react","client","cli"],Ye={action:"action",mutation:"mutation",query:"query"},Ce=u(t=>{let e=t.indexOf(":");return e===-1?{file:"",fn:t}:{file:t.slice(0,e),fn:t.slice(e+1)}},"Q"),Ze=u(({file:t,fn:e,kind:a})=>`await client.${Ye[a]}(api.${t}.${e}, { /* args */ });`,"ie"),et=u(t=>{let e=`api.${t.file}.${t.fn}`;switch(t.kind){case"action":return`const { call: ${t.fn} } = useAction(${e});`;case"mutation":return`const ${t.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},"se"),tt=u(({file:t,fn:e})=>`lunora run ${t}:${e} --args '{ }'`,"oe"),rt=u(t=>["// Read rows",`const rows = await ctx.db.query("${t}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${t}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${t}">;`,`type RowId = Id<"${t}">;`].join(`
2
+ `),"ce"),at=u((t,e)=>{switch(t){case"cli":return tt(e);case"client":return Ze(e);default:return et(e)}},"re"),Re=u(t=>{let e=(0,Y.c)(19),{code:a,label:r,testId:n}=t,s=J(),o;e[0]!==a?(o=u(()=>{ae(a)},"c"),e[0]=a,e[1]=o):o=e[1];let i=o,c;e[2]!==r?(c=(0,R.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:r}),e[2]=r,e[3]=c):c=e[3];let m=`${n}-copy`,l;e[4]!==s?(l=s("Copy"),e[4]=s,e[5]=l):l=e[5];let p;e[6]!==i||e[7]!==m||e[8]!==l?(p=(0,R.jsx)(W,{"data-testid":m,onClick:i,size:"xs",type:"button",variant:"ghost",children:l}),e[6]=i,e[7]=m,e[8]=l,e[9]=p):p=e[9];let f;e[10]!==c||e[11]!==p?(f=(0,R.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[c,p]}),e[10]=c,e[11]=p,e[12]=f):f=e[12];let h;e[13]!==a||e[14]!==n?(h=(0,R.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":n,children:a}),e[13]=a,e[14]=n,e[15]=h):h=e[15];let g;return e[16]!==f||e[17]!==h?(g=(0,R.jsxs)("div",{className:"flex flex-col gap-1.5",children:[f,h]}),e[16]=f,e[17]=h,e[18]=g):g=e[18],g},"U"),nt=u(t=>{let e=(0,Y.c)(46),{file:a,fn:r,kind:n}=t,s=J(),[o,i]=(0,X.useState)("react"),c,m,l;if(e[0]!==a||e[1]!==r||e[2]!==n||e[3]!==s||e[4]!==o){let w={file:a,fn:r,kind:n},j;e[8]!==s?(j=s("CLI"),e[8]=s,e[9]=j):j=e[9];let O;e[10]!==s?(O=s("Client"),e[10]=s,e[11]=O):O=e[11];let S;e[12]!==s?(S=s("React"),e[12]=s,e[13]=S):S=e[13];let C;e[14]!==j||e[15]!==O||e[16]!==S?(C={cli:j,client:O,react:S},e[14]=j,e[15]=O,e[16]=S,e[17]=C):C=e[17],l=C;let A;e[18]===Symbol.for("react.memo_cache_sentinel")?(A=u(_=>{i(_.currentTarget.dataset.tab)},"B"),e[18]=A):A=e[18],c=A,m=at(o,w),e[0]=a,e[1]=r,e[2]=n,e[3]=s,e[4]=o,e[5]=c,e[6]=m,e[7]=l}else c=e[5],m=e[6],l=e[7];let p=m,f=`api.${a}.${r}`,h;e[19]!==f?(h=(0,R.jsx)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-fn-title",children:f}),e[19]=f,e[20]=h):h=e[20];let g;e[21]!==n||e[22]!==s?(g=s("Call this {kind} from your app.",{kind:n}),e[21]=n,e[22]=s,e[23]=g):g=e[23];let x;e[24]!==g?(x=(0,R.jsx)("p",{className:"text-xs text-muted-foreground",children:g}),e[24]=g,e[25]=x):x=e[25];let v;e[26]!==h||e[27]!==x?(v=(0,R.jsxs)("div",{children:[h,x]}),e[26]=h,e[27]=x,e[28]=v):v=e[28];let N;e[29]!==s?(N=s("Snippet flavour"),e[29]=s,e[30]=N):N=e[30];let y;e[31]!==c||e[32]!==o||e[33]!==l?(y=Xe.map(w=>(0,R.jsx)(W,{"aria-selected":o===w,"data-tab":w,"data-testid":`api-tab-${w}`,onClick:c,role:"tab",size:"xs",type:"button",variant:o===w?"default":"outline",children:l[w]},w)),e[31]=c,e[32]=o,e[33]=l,e[34]=y):y=e[34];let b;e[35]!==N||e[36]!==y?(b=(0,R.jsx)("div",{"aria-label":N,className:"flex gap-1.5","data-testid":"api-tabs",role:"tablist",children:y}),e[35]=N,e[36]=y,e[37]=b):b=e[37];let I=l[o],P=`api-snippet-${o}`,$;e[38]!==p||e[39]!==I||e[40]!==P?($=(0,R.jsx)(Re,{code:p,label:I,testId:P}),e[38]=p,e[39]=I,e[40]=P,e[41]=$):$=e[41];let k;return e[42]!==$||e[43]!==v||e[44]!==b?(k=(0,R.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"api-fn-doc",children:[v,b,$]}),e[42]=$,e[43]=v,e[44]=b,e[45]=k):k=e[45],k},"de"),ot=u(t=>{let e=(0,Y.c)(19),{name:a}=t,r=J(),n;e[0]!==a?(n=rt(a),e[0]=a,e[1]=n):n=e[1];let s=n,o;e[2]!==a?(o=(0,R.jsx)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-table-title",children:a}),e[2]=a,e[3]=o):o=e[3];let i;e[4]!==r?(i=r("Read and write this table through the typed data model."),e[4]=r,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,R.jsx)("p",{className:"text-xs text-muted-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let m;e[8]!==o||e[9]!==c?(m=(0,R.jsxs)("div",{children:[o,c]}),e[8]=o,e[9]=c,e[10]=m):m=e[10];let l;e[11]!==r?(l=r("Data model"),e[11]=r,e[12]=l):l=e[12];let p;e[13]!==s||e[14]!==l?(p=(0,R.jsx)(Re,{code:s,label:l,testId:"api-snippet-table"}),e[13]=s,e[14]=l,e[15]=p):p=e[15];let f;return e[16]!==m||e[17]!==p?(f=(0,R.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"api-table-doc",children:[m,p]}),e[16]=m,e[17]=p,e[18]=f):f=e[18],f},"fe"),Te=u(t=>{let e=(0,Y.c)(8),{active:a,label:r,onSelect:n,testId:s,value:o}=t,i;e[0]!==n||e[1]!==o?(i=u(()=>{n(o)},"m"),e[0]=n,e[1]=o,e[2]=i):i=e[2];let c=i,m=a?"page":void 0,l;return e[3]!==r||e[4]!==c||e[5]!==m||e[6]!==s?(l=(0,R.jsx)("button",{"aria-current":m,className:"w-full truncate rounded-md px-2 py-1 text-start font-mono text-xs text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-testid":s,onClick:c,type:"button",children:r}),e[3]=r,e[4]=c,e[5]=m,e[6]=s,e[7]=l):l=e[7],l},"G"),st=u(t=>{let e=new Map;for(let a of t){let{file:r,fn:n}=Ce(a.path),s=e.get(r)??[];s.push({fn:n,kind:a.kind,path:a.path}),e.set(r,s)}return[...e.entries()].map(([a,r])=>({file:a,items:r.toSorted((n,s)=>n.fn.localeCompare(s.fn))})).toSorted((a,r)=>a.file.localeCompare(r.file))},"pe"),Ae=u(t=>{let e=(0,Y.c)(58),{functions:a,initialShardKey:r}=t,n=J(),s=F(),[o,i]=(0,X.useState)(null),[c,m]=(0,X.useState)(null),l,p;e[0]!==s||e[1]!==r?(l=u(()=>{let _=!1;return s.query(Ve,{},ie(r??"")).then(T=>(_||i(T),T)).catch(()=>{_||i([])}),()=>{_=!0}},"o"),p=[s,r],e[0]=s,e[1]=r,e[2]=l,e[3]=p):(l=e[2],p=e[3]),(0,X.useEffect)(l,p);let f,h,g,x,v,N,y,b,I,P;if(e[4]!==a||e[5]!==c||e[6]!==n||e[7]!==o){let _=a??[],T=st(_),L=(o??[]).map(it).toSorted(lt),E;e[18]===Symbol.for("react.memo_cache_sentinel")?(E=u(M=>{m({kind:"fn",path:M})},"P"),e[18]=E):E=e[18];let D=E,Q;e[19]===Symbol.for("react.memo_cache_sentinel")?(Q=u(M=>{m({kind:"table",name:M})},"j"),e[19]=Q):Q=e[19];let Qe=Q;h=c?.kind==="fn"?_.find(M=>M.path===c.path):void 0,f=_.length>0||L.length>0,g=h===void 0?void 0:Ce(h.path),I="grid min-h-0 gap-6 md:grid-cols-[16rem_minmax(0,1fr)]",P="lunora-api-docs",e[20]!==n?(x=n("API resources"),e[20]=n,e[21]=x):x=e[21],v="flex flex-col gap-4 overflow-y-auto",N="api-rail";let ne;e[22]!==c||e[23]!==n?(ne=u(M=>(0,R.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,R.jsx)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:M.file||n("(root)")}),M.items.map(ee=>(0,R.jsx)(Te,{active:c?.kind==="fn"&&c.path===ee.path,label:ee.fn,onSelect:D,testId:`api-rail-fn-${ee.path}`,value:ee.path},ee.path))]},M.file),"q"),e[22]=c,e[23]=n,e[24]=ne):ne=e[24],y=T.map(ne),b=L.length>0&&(0,R.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,R.jsx)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Tables")}),L.map(M=>(0,R.jsx)(Te,{active:c?.kind==="table"&&c.name===M,label:M,onSelect:Qe,testId:`api-rail-table-${M}`,value:M},M))]}),e[4]=a,e[5]=c,e[6]=n,e[7]=o,e[8]=f,e[9]=h,e[10]=g,e[11]=x,e[12]=v,e[13]=N,e[14]=y,e[15]=b,e[16]=I,e[17]=P}else f=e[8],h=e[9],g=e[10],x=e[11],v=e[12],N=e[13],y=e[14],b=e[15],I=e[16],P=e[17];let $;e[25]!==f||e[26]!==n?($=!f&&(0,R.jsx)("p",{className:"px-2 text-xs text-muted-foreground","data-testid":"api-rail-empty",children:n("No functions or tables to document yet.")}),e[25]=f,e[26]=n,e[27]=$):$=e[27];let k;e[28]!==$||e[29]!==x||e[30]!==v||e[31]!==N||e[32]!==y||e[33]!==b?(k=(0,R.jsxs)("nav",{"aria-label":x,className:v,"data-testid":N,children:[y,b,$]}),e[28]=$,e[29]=x,e[30]=v,e[31]=N,e[32]=y,e[33]=b,e[34]=k):k=e[34];let w;e[35]!==c||e[36]!==n?(w=c===null&&(0,R.jsx)(U,{description:n("Select a function or table to see how to call it from your app."),testId:"api-empty",title:n("API usage snippets")}),e[35]=c,e[36]=n,e[37]=w):w=e[37];let j;e[38]!==c?.kind||e[39]!==h||e[40]!==g?(j=c?.kind==="fn"&&h!==void 0&&g!==void 0&&(0,R.jsx)(nt,{file:g.file,fn:g.fn,kind:h.kind},h.path),e[38]=c?.kind,e[39]=h,e[40]=g,e[41]=j):j=e[41];let O;e[42]!==c?.kind||e[43]!==h||e[44]!==n?(O=c?.kind==="fn"&&h===void 0&&(0,R.jsx)(U,{testId:"api-empty",title:n("API usage snippets")}),e[42]=c?.kind,e[43]=h,e[44]=n,e[45]=O):O=e[45];let S;e[46]!==c?(S=c?.kind==="table"&&(0,R.jsx)(ot,{name:c.name}),e[46]=c,e[47]=S):S=e[47];let C;e[48]!==w||e[49]!==j||e[50]!==O||e[51]!==S?(C=(0,R.jsxs)("div",{className:"min-w-0",children:[w,j,O,S]}),e[48]=w,e[49]=j,e[50]=O,e[51]=S,e[52]=C):C=e[52];let A;return e[53]!==k||e[54]!==C||e[55]!==I||e[56]!==P?(A=(0,R.jsxs)("div",{className:I,"data-testid":P,children:[k,C]}),e[53]=k,e[54]=C,e[55]=I,e[56]=P,e[57]=A):A=e[57],A},"ke");function it(t){return t.name}u(it,"ue");function lt(t,e){return t.localeCompare(e)}u(lt,"me");var De=K(te(),1);var z=K(te(),1);var q=K(me(),1);var d=K(re(),1);var dt=u(t=>typeof t=="number"?"number":typeof t=="boolean"?"boolean":"string","we"),Je=u(t=>{if(t.enum!==void 0&&t.enum.length>0)return t.enum;if(t.anyOf!==void 0&&t.anyOf.length>0&&t.anyOf.every(e=>e.const!==void 0))return t.anyOf.map(e=>e.const)},"Q"),ce=u(t=>t===void 0?"any":t.const!==void 0?JSON.stringify(t.const):t.enum!==void 0&&t.enum.length>0?t.enum.map(e=>JSON.stringify(e)).join(" | "):t.anyOf!==void 0&&t.anyOf.length>0?t.anyOf.map(e=>ce(e)).join(" | "):t.type==="array"?`array<${ce(t.items)}>`:t.type??"any","z"),ct=u(t=>{let e=Je(t);return e!==void 0?t.type??dt(e[0]):ce(t)},"ke"),pt=u(t=>{let e=Je(t);return e===void 0?void 0:e.map(a=>JSON.stringify(a)).join(" | ")},"Oe"),mt=u(t=>{let e=[];t.minimum!==void 0?e.push(`${String(t.minimum)} \u2264`):t.exclusiveMinimum!==void 0&&e.push(`${String(t.exclusiveMinimum)} <`);let a=e.length>0;e.push("value"),t.maximum!==void 0?e.push(`\u2264 ${String(t.maximum)}`):t.exclusiveMaximum!==void 0&&e.push(`< ${String(t.exclusiveMaximum)}`);let r=e.length>(a?2:1);return a||r?e.join(" "):void 0},"$e"),ut=u(t=>{if(t.type==="object"&&t.properties!==void 0)return t;if(t.type==="array"&&t.items?.type==="object"&&t.items.properties!==void 0)return t.items},"Te"),Z=u(t=>{if(t===void 0)return null;if(t.const!==void 0)return t.const;if(t.enum!==void 0&&t.enum.length>0)return t.enum[0];if(t.anyOf!==void 0&&t.anyOf.length>0)return Z(t.anyOf[0]);switch(t.type){case"array":return[];case"boolean":return!1;case"number":return 0;case"object":{let e={};for(let[a,r]of Object.entries(t.properties??{}))e[a]=Z(r);return e}case"string":return"";default:return null}},"D"),de=u(t=>{let e=(0,z.c)(7),{label:a,value:r}=t,n;e[0]!==a?(n=(0,d.jsx)("span",{className:"text-muted-foreground",children:a}),e[0]=a,e[1]=n):n=e[1];let s;e[2]!==r?(s=(0,d.jsx)("span",{className:"text-foreground",children:r}),e[2]=r,e[3]=s):s=e[3];let o;return e[4]!==n||e[5]!==s?(o=(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 font-mono text-[10px]",children:[n,s]}),e[4]=n,e[5]=s,e[6]=o):o=e[6],o},"K"),ft=u(t=>{let e=(0,z.c)(40),{name:a,required:r,schema:n}=t,s=J(),o;e[0]!==n?(o=mt(n),e[0]=n,e[1]=o):o=e[1];let i=o,c;e[2]!==n?(c=pt(n),e[2]=n,e[3]=c):c=e[3];let m=c,l=n["x-lunora-table"],p=n.format!==void 0||i!==void 0||m!==void 0||l!==void 0,f;e[4]!==n?(f=ut(n),e[4]=n,e[5]=f):f=e[5];let h=f,g=r?"*":"?",x;e[6]!==g?(x=(0,d.jsx)("span",{className:"text-muted-foreground",children:g}),e[6]=g,e[7]=x):x=e[7];let v;e[8]!==a||e[9]!==x?(v=(0,d.jsxs)("span",{className:"font-mono text-foreground",children:[a,x]}),e[8]=a,e[9]=x,e[10]=v):v=e[10];let N;e[11]!==n?(N=ct(n),e[11]=n,e[12]=N):N=e[12];let y;e[13]!==N?(y=(0,d.jsx)("span",{className:"font-mono text-muted-foreground",children:N}),e[13]=N,e[14]=y):y=e[14];let b;e[15]!==v||e[16]!==y?(b=(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[v,y]}),e[15]=v,e[16]=y,e[17]=b):b=e[17];let I;e[18]!==n.description?(I=n.description!==void 0&&(0,d.jsx)("p",{className:"max-w-prose text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=I):I=e[19];let P;e[20]!==p||e[21]!==i||e[22]!==l||e[23]!==n.format||e[24]!==s||e[25]!==m?(P=p&&(0,d.jsxs)("div",{className:"flex flex-wrap gap-1",children:[n.format!==void 0&&(0,d.jsx)(de,{label:s("Format"),value:n.format}),i!==void 0&&(0,d.jsx)(de,{label:s("Range"),value:i}),m!==void 0&&(0,d.jsx)(de,{label:s("Value in"),value:m}),l!==void 0&&(0,d.jsx)(de,{label:s("relation"),value:l})]}),e[20]=p,e[21]=i,e[22]=l,e[23]=n.format,e[24]=s,e[25]=m,e[26]=P):P=e[26];let $;e[27]!==I||e[28]!==P||e[29]!==b?($=(0,d.jsxs)("div",{className:"flex flex-col gap-1 py-2",children:[b,I,P]}),e[27]=I,e[28]=P,e[29]=b,e[30]=$):$=e[30];let k=$;if(h===void 0){let S;return e[31]!==k?(S=(0,d.jsx)("div",{className:"border-b border-border/50 last:border-b-0",children:k}),e[31]=k,e[32]=S):S=e[32],S}let w;e[33]!==k?(w=(0,d.jsx)("summary",{className:"cursor-pointer marker:text-muted-foreground",children:k}),e[33]=k,e[34]=w):w=e[34];let j;e[35]!==h?(j=(0,d.jsx)("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:(0,d.jsx)(Le,{schema:h})}),e[35]=h,e[36]=j):j=e[36];let O;return e[37]!==w||e[38]!==j?(O=(0,d.jsxs)("details",{className:"border-b border-border/50 last:border-b-0",children:[w,j]}),e[37]=w,e[38]=j,e[39]=O):O=e[39],O},"Ee"),Le=u(t=>{let e=(0,z.c)(7),{schema:a}=t,r;e[0]!==a.required?(r=new Set(a.required),e[0]=a.required,e[1]=r):r=e[1];let n=r,s;e[2]!==a.properties?(s=Object.entries(a.properties??{}),e[2]=a.properties,e[3]=s):s=e[3];let o=s,i;return e[4]!==n||e[5]!==o?(i=(0,d.jsx)("div",{className:"flex flex-col",children:o.map(c=>{let[m,l]=c;return(0,d.jsx)(ft,{name:m,required:n.has(m),schema:l},m)})}),e[4]=n,e[5]=o,e[6]=i):i=e[6],i},"Z"),_e=u(t=>{let e=(0,z.c)(10),{schema:a,testId:r}=t;if(a?.type!=="object"||Object.keys(a.properties??{}).length===0){let o;e[0]!==a?(o=ce(a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==o||e[3]!==r?(i=(0,d.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":r,children:o}),e[2]=o,e[3]=r,e[4]=i):i=e[4],i}let n;e[5]!==a?(n=(0,d.jsx)(Le,{schema:a}),e[5]=a,e[6]=n):n=e[6];let s;return e[7]!==n||e[8]!==r?(s=(0,d.jsx)("div",{className:"text-xs","data-testid":r,children:n}),e[7]=n,e[8]=r,e[9]=s):s=e[9],s},"V"),ht=["curl","javascript","lunora"],gt={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},xt=u(t=>`api.${t.replaceAll(/[/:]/g,".")}`,"je"),bt=u(t=>{let e=Z(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},"Ae"),yt=u((t,e,a)=>{let r=`${a}${e.httpPath}`,n=JSON.stringify(bt(e),void 0,2),s=JSON.stringify(Z(e.argsSchema)??{},void 0,2);switch(t){case"curl":{let o=e.method!=="GET"&&e.method!=="HEAD",i=[`curl -X ${e.method} ${JSON.stringify(r)}`];return o&&i.push(' -H "Content-Type: application/json"',` -d '${n}'`),i.join(` \\
3
+ `)}case"lunora":return e.functionPath===void 0?`await fetch(${JSON.stringify(e.httpPath)}, { method: ${JSON.stringify(e.method)} });`:`import { useLunora } from "@lunora/react";
4
+ import { api } from "./_generated/api";
5
+
6
+ const client = useLunora();
7
+ await client.${e.kind??"query"}(${xt(e.functionPath)}, ${s});`;default:{let o=e.method!=="GET"&&e.method!=="HEAD"?`{
8
+ method: ${JSON.stringify(e.method)},
9
+ headers: { "Content-Type": "application/json" },
10
+ body: JSON.stringify(${n}),
11
+ }`:`{ method: ${JSON.stringify(e.method)} }`;return`const response = await fetch(${JSON.stringify(r)}, ${o});
12
+ const data = await response.json();`}}},"Ie"),vt=u(t=>{let e=(0,z.c)(24),{operation:a,server:r}=t,n=J(),[s,o]=(0,q.useState)("curl"),i;e[0]!==a||e[1]!==s||e[2]!==r?(i=yt(s,a,r),e[0]=a,e[1]=s,e[2]=r,e[3]=i):i=e[3];let c=i,m;e[4]!==c?(m=u(()=>{ae(c)},"d"),e[4]=c,e[5]=m):m=e[5];let l=m,p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=u(I=>{o(I.currentTarget.dataset.sample)},"u"),e[6]=p):p=e[6];let f=p,h;e[7]!==s?(h=ht.map(I=>(0,d.jsx)("button",{"aria-selected":s===I,className:"rounded px-2 py-0.5 text-xs text-muted-foreground transition-colors hover:text-foreground aria-selected:bg-muted aria-selected:font-medium aria-selected:text-foreground","data-sample":I,"data-testid":`api-sample-${I}`,onClick:f,role:"tab",type:"button",children:gt[I]},I)),e[7]=s,e[8]=h):h=e[8];let g;e[9]!==h?(g=(0,d.jsx)("div",{className:"flex gap-1",role:"tablist",children:h}),e[9]=h,e[10]=g):g=e[10];let x;e[11]!==n?(x=n("Copy"),e[11]=n,e[12]=x):x=e[12];let v;e[13]!==l||e[14]!==x?(v=(0,d.jsx)(W,{"data-testid":"api-sample-copy",onClick:l,size:"xs",type:"button",variant:"ghost",children:x}),e[13]=l,e[14]=x,e[15]=v):v=e[15];let N;e[16]!==g||e[17]!==v?(N=(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[g,v]}),e[16]=g,e[17]=v,e[18]=N):N=e[18];let y;e[19]!==c?(y=(0,d.jsx)("pre",{className:"overflow-auto px-3 pb-3 font-mono text-xs","data-testid":"api-sample-source",children:c}),e[19]=c,e[20]=y):y=e[20];let b;return e[21]!==N||e[22]!==y?(b=(0,d.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card","data-testid":"api-code-samples",children:[N,y]}),e[21]=N,e[22]=y,e[23]=b):b=e[23],b},"Pe"),Nt={blue:"text-info",emerald:"text-success",neutral:"text-muted-foreground",orange:"text-warning",red:"text-destructive",violet:"text-royal-amethyst"},kt=u(t=>{switch(t.toUpperCase()){case"DELETE":return"red";case"GET":return"emerald";case"PATCH":return"orange";case"POST":return"blue";case"PUT":return"orange";default:return"neutral"}},"_e"),wt=u(t=>{switch(t){case"action":return"violet";case"mutation":return"orange";case"query":return"emerald";default:return"neutral"}},"Be"),ge=u(t=>{let e=(0,z.c)(7),{kind:a,method:r,testId:n}=t,s;e[0]!==a||e[1]!==r?(s=a??r.toUpperCase(),e[0]=a,e[1]=r,e[2]=s):s=e[2];let o=s,i=a===void 0?kt(r):wt(a),c=`${Nt[i]} font-mono text-[10px] tracking-wide uppercase`,m;return e[3]!==o||e[4]!==c||e[5]!==n?(m=(0,d.jsx)(ye,{className:c,"data-testid":n,variant:"ghost",children:o}),e[3]=o,e[4]=c,e[5]=n,e[6]=m):m=e[6],m},"q"),Me=u(t=>t.startsWith("2")?"text-emerald-600 dark:text-emerald-400":t==="default"||t.startsWith("4")||t.startsWith("5")?"text-red-600 dark:text-red-400":"text-muted-foreground","ee"),qe=u(t=>t.startsWith("2")?"bg-emerald-500":t==="default"||t.startsWith("4")||t.startsWith("5")?"bg-red-500":"bg-muted-foreground","te"),St=new Set([" ",`
13
+ `,"\r"]),Ee=" ",It=u(t=>{let e="";for(let n of t)St.has(n)||(e+=n);let a=0,r=e.length;for(;a<r&&(e[a]??"")<=Ee;)a+=1;for(;r>a&&(e[r-1]??"")<=Ee;)r-=1;return e.slice(a,r)},"Je"),Ot=/^(?:[a-z][\d+.a-z-]*:)?\/\//i,$t=u((t,e)=>{let a=globalThis.location?.origin??"",r=e===""?a:e,n=It(t);if(r===""){if(Ot.test(n))throw new Error(`restDispatch: refusing to send the admin token off-origin (${n} names its own host and there is no origin to check it against)`);return n}let s=new URL(n,r);if(s.origin!==new URL(r).origin)throw new Error(`restDispatch: refusing to send the admin token off-origin (${s.origin} is not ${r})`);return s.toString()},"Ke"),Pt=u(async(t,e,a,r)=>{let n=t.method!=="GET"&&t.method!=="HEAD",s=$t(t.httpPath,a),o=await(await fetch(s,{body:n?JSON.stringify(e):void 0,headers:{...n?{"content-type":"application/json"}:{},...r===null||r===""?{}:{authorization:`Bearer ${r}`}},method:t.method})).text();try{return JSON.parse(o)}catch{return o}},"ze"),jt=u(t=>JSON.stringify(Z(t.argsSchema)??{},void 0,2),"Fe"),Ke=(0,q.createContext)(null),ze=u(()=>{let t=(0,q.use)(Ke);if(t===null)throw new be("INTERNAL","useOperationRun must be used within an OperationRunProvider");return t},"se"),Tt=u(({children:t,operation:e})=>{let a=J(),r=F(),[n,s]=(0,q.useState)(()=>jt(e)),[o,i]=(0,q.useState)(""),[c,m]=(0,q.useState)("idle"),[l,p]=(0,q.useState)(void 0),[f,h]=(0,q.useState)(null),[g,x]=(0,q.useState)(null),v=u(async()=>{let N;try{N=n.trim()===""?{}:JSON.parse(n)}catch(b){m("error"),p(void 0),x(null),h(a("Invalid JSON args: {message}",{message:fe(b)}));return}m("running"),h(null);let y=performance.now();try{let b=await(e.functionPath===void 0?Pt(e,N,r.url,r.getAuthToken()):Se(r,e.kind,se(e.functionPath),N,ie(o)));p(b),x(Math.round(performance.now()-y)),m("success")}catch(b){p(void 0),x(Math.round(performance.now()-y)),h(fe(b)),m("error")}},"v");return(0,d.jsx)(Ke,{value:{argsText:n,durationMs:g,error:f,operation:e,response:l,send:u(()=>{Oe(v())},"send"),setArgsText:s,setShardKey:i,shardKey:o,status:c},children:t})},"We"),Ct=u(()=>{let t=(0,z.c)(48),e=J(),{argsText:a,operation:r,send:n,setArgsText:s,setShardKey:o,shardKey:i,status:c}=ze(),m;t[0]!==s?(m=u(T=>{s(T.target.value)},"d"),t[0]=s,t[1]=m):m=t[1];let l=m,p;t[2]!==n?(p=u(T=>{T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&(T.preventDefault(),n())},"u"),t[2]=n,t[3]=p):p=t[3];let f=p,h=c==="running",g;t[4]!==r.kind||t[5]!==r.method?(g=(0,d.jsx)(ge,{kind:r.kind,method:r.method,testId:"api-try-method"}),t[4]=r.kind,t[5]=r.method,t[6]=g):g=t[6];let x=r.functionPath??r.httpPath,v;t[7]!==x?(v=(0,d.jsx)("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:x}),t[7]=x,t[8]=v):v=t[8];let N=h?"animate-pulse":void 0,y;t[9]!==N?(y=(0,d.jsx)(oe,{className:N,icon:we,strokeWidth:2}),t[9]=N,t[10]=y):y=t[10];let b;t[11]!==h||t[12]!==e?(b=e(h?"Sending\u2026":"Send"),t[11]=h,t[12]=e,t[13]=b):b=t[13];let I;t[14]!==h||t[15]!==n||t[16]!==y||t[17]!==b?(I=(0,d.jsxs)(W,{"data-testid":"api-try-send",disabled:h,onClick:n,size:"sm",type:"button",children:[y,b]}),t[14]=h,t[15]=n,t[16]=y,t[17]=b,t[18]=I):I=t[18];let P;t[19]!==g||t[20]!==v||t[21]!==I?(P=(0,d.jsxs)("div",{className:"flex items-center gap-2 border-b border-border bg-muted px-3 py-2",children:[g,v,I]}),t[19]=g,t[20]=v,t[21]=I,t[22]=P):P=t[22];let $;t[23]!==e?($=e("Arguments (JSON)"),t[23]=e,t[24]=$):$=t[24];let k;t[25]!==$?(k=(0,d.jsx)(he,{htmlFor:"api-try-args",children:$}),t[25]=$,t[26]=k):k=t[26];let w;t[27]!==a?(w=a.split(`
14
+ `),t[27]=a,t[28]=w):w=t[28];let j=Math.min(12,Math.max(3,w.length)),O;t[29]!==a||t[30]!==l||t[31]!==f||t[32]!==j?(O=(0,d.jsx)(je,{className:"font-mono text-xs","data-testid":"api-try-args",id:"api-try-args",onChange:l,onKeyDown:f,rows:j,spellCheck:!1,value:a}),t[29]=a,t[30]=l,t[31]=f,t[32]=j,t[33]=O):O=t[33];let S;t[34]!==k||t[35]!==O?(S=(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[k,O]}),t[34]=k,t[35]=O,t[36]=S):S=t[36];let C;t[37]!==r.functionPath||t[38]!==o||t[39]!==i||t[40]!==e?(C=r.functionPath!==void 0&&(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,d.jsx)(he,{htmlFor:"shard-input",children:e("Shard key (optional)")}),(0,d.jsx)(Pe,{id:"shard-input",onChange:o,testId:"shard-input",value:i})]}),t[37]=r.functionPath,t[38]=o,t[39]=i,t[40]=e,t[41]=C):C=t[41];let A;t[42]!==S||t[43]!==C?(A=(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-3",children:[S,C]}),t[42]=S,t[43]=C,t[44]=A):A=t[44];let _;return t[45]!==A||t[46]!==P?(_=(0,d.jsxs)("div",{className:"overflow-hidden rounded-xl border border-border bg-card","data-testid":"api-try-it",children:[P,A]}),t[45]=A,t[46]=P,t[47]=_):_=t[47],_},"qe"),Rt=u(t=>{let e=(0,z.c)(51),{operation:a}=t,r=J(),n=`api-operation-${a.operationId}`,s=a.key,o;e[0]!==a.kind||e[1]!==a.method?(o=(0,d.jsx)(ge,{kind:a.kind,method:a.method,testId:"api-operation-method"}),e[0]=a.kind,e[1]=a.method,e[2]=o):o=e[2];let i=a.functionPath??a.httpPath,c;e[3]!==i?(c=(0,d.jsx)("code",{className:"truncate font-mono text-xs text-muted-foreground",children:i}),e[3]=i,e[4]=c):c=e[4];let m;e[5]!==o||e[6]!==c?(m=(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[o,c]}),e[5]=o,e[6]=c,e[7]=m):m=e[7];let l;e[8]!==a.title?(l=(0,d.jsx)("h1",{className:"text-lg font-semibold text-foreground","data-testid":"api-operation-title",children:a.title}),e[8]=a.title,e[9]=l):l=e[9];let p;e[10]!==a.description?(p=a.description!==void 0&&(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:a.description}),e[10]=a.description,e[11]=p):p=e[11];let f;e[12]!==m||e[13]!==l||e[14]!==p?(f=(0,d.jsxs)("header",{className:"sticky top-0 z-10 -mx-6 -mt-6 flex flex-col gap-2 border-b border-border bg-background px-6 pt-6 pb-3",children:[m,l,p]}),e[12]=m,e[13]=l,e[14]=p,e[15]=f):f=e[15];let h;e[16]!==r?(h=r("Try it"),e[16]=r,e[17]=h):h=e[17];let g;e[18]!==h?(g=(0,d.jsx)("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[18]=h,e[19]=g):g=e[19];let x;e[20]===Symbol.for("react.memo_cache_sentinel")?(x=(0,d.jsx)(Ct,{}),e[20]=x):x=e[20];let v;e[21]!==g?(v=(0,d.jsxs)("section",{className:"flex flex-col gap-2",children:[g,x]}),e[21]=g,e[22]=v):v=e[22];let N;e[23]!==r?(N=r("Request arguments"),e[23]=r,e[24]=N):N=e[24];let y;e[25]!==N?(y=(0,d.jsx)("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:N}),e[25]=N,e[26]=y):y=e[26];let b;e[27]!==a.argsSchema?(b=(0,d.jsx)(_e,{schema:a.argsSchema,testId:"api-operation-args"}),e[27]=a.argsSchema,e[28]=b):b=e[28];let I;e[29]!==y||e[30]!==b?(I=(0,d.jsxs)("section",{className:"flex flex-col gap-2",children:[y,b]}),e[29]=y,e[30]=b,e[31]=I):I=e[31];let P;e[32]!==r?(P=r("Response body"),e[32]=r,e[33]=P):P=e[33];let $;e[34]!==P?($=(0,d.jsx)("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:P}),e[34]=P,e[35]=$):$=e[35];let k;if(e[36]!==a.responses||e[37]!==r){let O;e[39]!==r?(O=u(S=>(0,d.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-xl border border-border bg-card p-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsxs)("span",{className:`inline-flex items-center gap-1.5 font-mono text-xs font-semibold ${Me(S.status)}`,children:[(0,d.jsx)("span",{className:`size-1.5 rounded-full ${qe(S.status)}`}),S.status]}),S.schema!==void 0&&(0,d.jsx)("span",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:r("application/json")})]}),S.description!==void 0&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:S.description}),S.schema!==void 0&&(0,d.jsx)(_e,{schema:S.schema,testId:`api-response-${S.status}`})]},S.status),"E"),e[39]=r,e[40]=O):O=e[40],k=a.responses.map(O),e[36]=a.responses,e[37]=r,e[38]=k}else k=e[38];let w;e[41]!==$||e[42]!==k?(w=(0,d.jsxs)("section",{className:"flex flex-col gap-3",children:[$,k]}),e[41]=$,e[42]=k,e[43]=w):w=e[43];let j;return e[44]!==a.key||e[45]!==n||e[46]!==v||e[47]!==I||e[48]!==w||e[49]!==f?(j=(0,d.jsxs)("div",{className:"flex flex-col gap-6 duration-200 animate-in fade-in-0 slide-in-from-bottom-1","data-testid":n,children:[f,v,I,w]},s),e[44]=a.key,e[45]=n,e[46]=v,e[47]=I,e[48]=w,e[49]=f,e[50]=j):j=e[50],j},"He"),At={boolean:"text-royal-amethyst",key:"text-sky-sapphire",number:"text-warning",plain:"",string:"text-success"},_t=/"(?:[^"\\]|\\.)*"|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?/g,Et=/^\s*:/,Jt=u((t,e,a)=>a.startsWith('"')?Et.test(t.slice(e))?"key":"string":a==="true"||a==="false"||a==="null"?"boolean":"number","Xe"),Lt=u(t=>{let e=[],a=0;for(let r of t.matchAll(_t)){let{index:n}=r,s=r[0],o=n+s.length;n>a&&e.push({kind:"plain",start:a,text:t.slice(a,n)}),e.push({kind:Jt(t,o,s),start:n,text:s}),a=o}return a<t.length&&e.push({kind:"plain",start:a,text:t.slice(a)}),e},"Ye"),Mt=u(t=>{let e=(0,z.c)(4),{code:a}=t,r;e[0]!==a?(r=Lt(a).map(qt),e[0]=a,e[1]=r):r=e[1];let n;return e[2]!==r?(n=(0,d.jsx)(d.Fragment,{children:r}),e[2]=r,e[3]=n):n=e[3],n},"Qe");function qt(t){return(0,d.jsx)("span",{className:At[t.kind],children:t.text},t.start)}u(qt,"Ze");var Be="__live__",Kt=u(t=>t.schema===void 0?"":JSON.stringify(Z(t.schema),void 0,2),"et"),zt=u((t,e,a)=>a?t??"":e===void 0?"":JSON.stringify(e,Ie,2),"tt"),Bt=u(t=>{let e=(0,z.c)(18),{active:a,running:r,showError:n}=t,s=J();if(r){let p;e[0]!==s?(p=s("Sending\u2026"),e[0]=s,e[1]=p):p=e[1];let f;return e[2]!==p?(f=(0,d.jsx)("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-running",children:p}),e[2]=p,e[3]=f):f=e[3],f}if(a===void 0||a.body===""){let p;e[4]!==a?.live||e[5]!==s?(p=a?.live===!0?s("Send a request to see the response."):s("No example for this response."),e[4]=a?.live,e[5]=s,e[6]=p):p=e[6];let f;return e[7]!==p?(f=(0,d.jsx)("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-idle",children:p}),e[7]=p,e[8]=f):f=e[8],f}let o=n&&"text-destructive",i;e[9]!==o?(i=ue("max-h-[28rem] overflow-auto px-3 py-3 font-mono text-xs",o),e[9]=o,e[10]=i):i=e[10];let c=n?"api-response-error":"api-response-body",m;e[11]!==a.body||e[12]!==n?(m=n?a.body:(0,d.jsx)(Mt,{code:a.body}),e[11]=a.body,e[12]=n,e[13]=m):m=e[13];let l;return e[14]!==i||e[15]!==c||e[16]!==m?(l=(0,d.jsx)("pre",{className:i,"data-testid":c,children:m}),e[14]=i,e[15]=c,e[16]=m,e[17]=l):l=e[17],l},"rt"),Dt=u(({durationMs:t,error:e,failed:a,operation:r,ran:n,response:s,t:o})=>{let i=r.responses.map(c=>({body:Kt(c),durationMs:null,id:c.status,label:c.status,live:!1,status:c.status}));return n?[{body:zt(e,s,a),durationMs:t,id:Be,label:o("Live"),live:!0,status:a?"error":"200"},...i]:i},"st"),Wt=u(()=>{let t=(0,z.c)(19),e=J(),{durationMs:a,error:r,operation:n,response:s,status:o}=ze(),i=o==="running",c=o==="error",m=o==="success"||c,l=Dt({durationMs:a,error:r,failed:c,operation:n,ran:m,response:s,t:e}),p=m?Be:l.find(Ut)?.id??l[0]?.id??"",[f,h]=(0,q.useState)(null),g=l.find(T=>T.id===(f??p))??l[0],x;t[0]===Symbol.for("react.memo_cache_sentinel")?(x=u(T=>{let{id:L}=T.currentTarget.dataset;L!==void 0&&h(L)},"m"),t[0]=x):x=t[0];let v=x,N=u(()=>{g!==void 0&&ae(g.body)},"w"),y=g?.live===!0?g.durationMs:null,b=g?.live===!0&&g.status==="error",I="flex min-h-0 flex-col rounded-xl border border-border bg-card",P="api-response-panel",$;t[1]!==e?($=e("Response"),t[1]=e,t[2]=$):$=t[2];let k;t[3]!==$?(k=(0,d.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:$}),t[3]=$,t[4]=k):k=t[4];let w=y!==null&&(0,d.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground",children:e("{ms} ms",{ms:y})}),j=g!==void 0&&g.body!==""&&(0,d.jsx)(W,{"aria-label":e("Copy"),"data-testid":"api-response-copy",onClick:N,size:"icon-xs",type:"button",variant:"ghost",children:(0,d.jsx)(oe,{icon:Ne,strokeWidth:2})}),O;t[5]!==w||t[6]!==j?(O=(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[w,j]}),t[5]=w,t[6]=j,t[7]=O):O=t[7];let S;t[8]!==k||t[9]!==O?(S=(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[k,O]}),t[8]=k,t[9]=O,t[10]=S):S=t[10];let C=l.length>0&&(0,d.jsx)("div",{className:"flex gap-1 overflow-x-auto border-b border-border px-2 py-1.5",role:"tablist",children:l.map(T=>{let L=T.id===g?.id;return(0,d.jsxs)("button",{"aria-selected":L,className:ue("inline-flex items-center gap-1.5 rounded px-2 py-0.5 font-mono text-xs transition-colors hover:text-foreground aria-selected:bg-muted aria-selected:font-medium",L?Me(T.status):"text-muted-foreground"),"data-id":T.id,"data-testid":T.live?"api-response-tab-live":`api-response-tab-${T.status}`,onClick:v,role:"tab",type:"button",children:[(0,d.jsx)("span",{className:`size-1.5 rounded-full ${qe(T.status)}`}),T.label]},T.id)})}),A;t[11]!==g||t[12]!==i||t[13]!==b?(A=(0,d.jsx)(Bt,{active:g,running:i,showError:b}),t[11]=g,t[12]=i,t[13]=b,t[14]=A):A=t[14];let _;return t[15]!==A||t[16]!==S||t[17]!==C?(_=(0,d.jsxs)("div",{className:I,"data-testid":P,children:[S,C,A]}),t[15]=A,t[16]=S,t[17]=C,t[18]=_):_=t[18],_},"nt");function Ut(t){return t.status.startsWith("2")}u(Ut,"ot");var Ft=u((t,e)=>{let a=e.trim().toLowerCase();return a===""?t:t.map(r=>({...r,operations:r.operations.filter(n=>`${n.summary} ${n.operationId}`.toLowerCase().includes(a))})).filter(r=>r.operations.length>0)},"it"),pe=u(t=>{let e=(0,z.c)(53),{model:a}=t,r=J(),n=a.groups[0]?.operations[0]?.key??"",[s,o]=(0,q.useState)(n),[i,c]=(0,q.useState)(""),m;e[0]!==n||e[1]!==a.operationByKey||e[2]!==s?(m=a.operationByKey.get(s)??a.operationByKey.get(n),e[0]=n,e[1]=a.operationByKey,e[2]=s,e[3]=m):m=e[3];let l=m,p,f,h,g,x,v,N,y,b,I;if(e[4]!==i||e[5]!==a.groups||e[6]!==a.server||e[7]!==l?.key||e[8]!==r){p=Ft(a.groups,i);let O;e[19]===Symbol.for("react.memo_cache_sentinel")?(O=u(E=>{let{key:D}=E.currentTarget.dataset;D!==void 0&&o(D)},"E"),e[19]=O):O=e[19];let S=O,C;e[20]===Symbol.for("react.memo_cache_sentinel")?(C=u(E=>{c(E.target.value)},"j"),e[20]=C):C=e[20];let A=C;f=a.server??"",b="grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[16rem_minmax(0,1fr)_22rem]",I="api-reference",e[21]!==r?(x=r("API operations"),e[21]=r,e[22]=x):x=e[22],v="flex min-h-0 flex-col overflow-y-auto border-r border-border",N="api-reference-nav";let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=(0,d.jsx)(oe,{className:"pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-muted-foreground",icon:ke,strokeWidth:2}),e[23]=_):_=e[23];let T;e[24]!==r?(T=r("Filter operations"),e[24]=r,e[25]=T):T=e[25],e[26]!==i||e[27]!==T?(y=(0,d.jsx)("div",{className:"sticky top-0 z-10 border-b border-border bg-sidebar p-2",children:(0,d.jsxs)("div",{className:"relative",children:[_,(0,d.jsx)(ve,{className:"h-7 pl-7","data-testid":"api-filter",onChange:A,placeholder:T,value:i})]})}),e[26]=i,e[27]=T,e[28]=y):y=e[28],h="flex flex-col gap-4 p-2";let L;e[29]!==l?.key||e[30]!==r?(L=u(E=>(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-2",children:[(0,d.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:E.name||r("(root)")}),(0,d.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground/70",children:E.operations.length})]}),E.operations.map(D=>{let Q=D.key===l?.key;return(0,d.jsxs)("button",{"aria-current":Q?"page":void 0,className:"flex items-center justify-between gap-2 rounded-md border-l-2 border-transparent px-2 py-1 text-start text-xs text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground aria-[current=page]:border-primary aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-key":D.key,"data-testid":`api-nav-${D.operationId}`,onClick:S,type:"button",children:[(0,d.jsx)("span",{className:"truncate",children:D.summary}),(0,d.jsx)(ge,{kind:D.kind,method:D.method})]},D.key)})]},E.name),"L"),e[29]=l?.key,e[30]=r,e[31]=L):L=e[31],g=p.map(L),e[4]=i,e[5]=a.groups,e[6]=a.server,e[7]=l?.key,e[8]=r,e[9]=p,e[10]=f,e[11]=h,e[12]=g,e[13]=x,e[14]=v,e[15]=N,e[16]=y,e[17]=b,e[18]=I}else p=e[9],f=e[10],h=e[11],g=e[12],x=e[13],v=e[14],N=e[15],y=e[16],b=e[17],I=e[18];let P;e[32]!==p.length||e[33]!==r?(P=p.length===0&&(0,d.jsx)("p",{className:"px-2 py-1 text-xs text-muted-foreground","data-testid":"api-nav-empty",children:r("No operations match your filter.")}),e[32]=p.length,e[33]=r,e[34]=P):P=e[34];let $;e[35]!==P||e[36]!==h||e[37]!==g?($=(0,d.jsxs)("div",{className:h,children:[g,P]}),e[35]=P,e[36]=h,e[37]=g,e[38]=$):$=e[38];let k;e[39]!==$||e[40]!==x||e[41]!==v||e[42]!==N||e[43]!==y?(k=(0,d.jsxs)("nav",{"aria-label":x,className:v,"data-testid":N,children:[y,$]}),e[39]=$,e[40]=x,e[41]=v,e[42]=N,e[43]=y,e[44]=k):k=e[44];let w;e[45]!==l||e[46]!==f?(w=l===void 0?(0,d.jsx)("div",{className:"lg:col-span-2"}):(0,d.jsxs)(Tt,{operation:l,children:[(0,d.jsx)("div",{className:"min-w-0 overflow-y-auto p-6","data-testid":"api-reference-main",children:(0,d.jsx)(Rt,{operation:l})}),(0,d.jsxs)("aside",{className:"flex min-w-0 flex-col gap-4 overflow-y-auto border-border p-4 lg:border-l","data-testid":"api-reference-aside",children:[(0,d.jsx)(vt,{operation:l,server:f}),(0,d.jsx)(Wt,{})]})]},l.key),e[45]=l,e[46]=f,e[47]=w):w=e[47];let j;return e[48]!==k||e[49]!==w||e[50]!==b||e[51]!==I?(j=(0,d.jsxs)("div",{className:b,"data-testid":I,children:[k,w]}),e[48]=k,e[49]=w,e[50]=b,e[51]=I,e[52]=j):j=e[52],j},"wt");var H=K(re(),1);var Ht=["get","post","put","patch","delete","head","options","trace"],We=u(t=>t?.content?.["application/json"]?.schema,"y"),Gt=u((t,e)=>Object.entries(t.responses??{}).map(([a,r])=>{let n=r.$ref?.replace("#/components/responses/",""),s=n===void 0?r:e.components?.responses?.[n]??r;return{description:s.description,schema:We(s),status:a}}),"j"),Qt=u((t,e,a,r,n)=>{let s=We(r.requestBody),o=s?.properties?.functionPath?.const,i=typeof o=="string"?o:void 0,c=i===void 0?s:s?.properties?.args,m=r.operationId??`${a} ${e}`;return{argsSchema:c,description:r.description,functionPath:i,httpPath:e,key:t,kind:r["x-lunora-function-kind"],method:a.toUpperCase(),operationId:m,requestSchema:s,responses:Gt(r,n),summary:r.summary??m,tags:r.tags??[],title:r.summary??m}},"b"),Vt=u(t=>{let e=[];for(let[a,r]of Object.entries(t.paths??{})){let n=a.includes("#")?a.slice(0,a.indexOf("#")):a;for(let s of Ht){let o=r[s];o!==void 0&&e.push(Qt(a,n,s,o,t))}}return e},"x"),Xt=u(t=>{let e=t??{},a=Vt(e),r=new Map((e.tags??[]).map(i=>[i.name,i.description])),n=new Set,s=[],o=u(i=>{if(n.has(i))return;n.add(i);let c=a.filter(m=>(m.tags[0]??"")===i);c.length>0&&s.push({description:r.get(i),name:i,operations:c})},"l");for(let i of e.tags??[])o(i.name);for(let i of a)o(i.tags[0]??"");return{groups:s,operationByKey:new Map(a.map(i=>[i.key,i])),server:e.servers?.[0]?.url,title:e.info?.title??"API reference",version:e.info?.version}},"w"),Yt=u(t=>{let{paths:e}=t;return e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0},"R"),Zt=u(t=>{let e=t;return Yt(e)?{kind:"empty"}:{kind:"ready",spec:e}},"T"),Ue=u(t=>{let e=(0,De.c)(23),{spec:a}=t,r=J(),n=F(),s;e[0]!==n?(s=u(()=>n.fetchOpenApi(),"n"),e[0]=n,e[1]=s):s=e[1];let o=le(a,s,Zt),i;e[2]!==o.kind||e[3]!==o.spec?(i=o.kind==="ready"?Xt(o.spec):void 0,e[2]=o.kind,e[3]=o.spec,e[4]=i):i=e[4];let c=i;if(o.kind==="loading"){let l;return e[5]===Symbol.for("react.memo_cache_sentinel")?(l=(0,H.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"api-reference-loading",children:[(0,H.jsx)(V,{className:"h-8 w-48"}),(0,H.jsx)(V,{className:"h-64 w-full"})]}),e[5]=l):l=e[5],l}if(o.kind==="error"){let l;e[6]!==o.message||e[7]!==r?(l=r("Couldn't load the OpenAPI spec: {message}",{message:o.message}),e[6]=o.message,e[7]=r,e[8]=l):l=e[8];let p;e[9]!==r?(p=r("API reference unavailable"),e[9]=r,e[10]=p):p=e[10];let f;return e[11]!==l||e[12]!==p?(f=(0,H.jsx)(U,{description:l,testId:"api-reference-error",title:p}),e[11]=l,e[12]=p,e[13]=f):f=e[13],f}if(o.kind==="empty"||c===void 0){let l;e[14]!==r?(l=r("Run `lunora codegen` and wire `_generated/openapi.json` to the worker to render the API reference here."),e[14]=r,e[15]=l):l=e[15];let p;e[16]!==r?(p=r("No OpenAPI spec configured"),e[16]=r,e[17]=p):p=e[17];let f;return e[18]!==l||e[19]!==p?(f=(0,H.jsx)(U,{description:l,testId:"api-reference-empty",title:p}),e[18]=l,e[19]=p,e[20]=f):f=e[20],f}let m;return e[21]!==c?(m=(0,H.jsx)(pe,{model:c}),e[21]=c,e[22]=m):m=e[22],m},"H");var Fe=K(te(),1);var G=K(re(),1);var er=u(t=>(t.params??[]).find(e=>e.name==="args")??(t.params??[])[0],"x"),tr=u(t=>t["x-tags"]?.[0]?.name??(t.name.includes(":")?t.name.slice(0,t.name.indexOf(":")):""),"v"),rr=u(t=>{let e=er(t)?.schema;return{argsSchema:e,description:t.description,functionPath:t.name,httpPath:"/_lunora/rpc",key:t.name,kind:t["x-lunora-function-kind"],method:"POST",operationId:t.name,requestSchema:e,responses:[{description:t.result?.name,schema:t.result?.schema,status:"200"}],summary:t.summary??t.name,tags:[tr(t)],title:t.summary??t.name}},"w"),ar=u(t=>{let e=t??{},a=(e.methods??[]).map(n=>rr(n)),r=new Map;for(let n of a){let s=n.tags[0]??"",o=r.get(s)??[];o.push(n),r.set(s,o)}return{groups:[...r.entries()].map(([n,s])=>({name:n,operations:s.toSorted((o,i)=>o.operationId.localeCompare(i.operationId))})).toSorted((n,s)=>n.name.localeCompare(s.name)),operationByKey:new Map(a.map(n=>[n.key,n])),title:e.info?.title??"API reference",version:e.info?.version}},"I"),nr=u(t=>t.methods===void 0||t.methods.length===0,"C"),or=u(t=>{let e=t;return nr(e)?{kind:"empty"}:{kind:"ready",spec:e}},"N"),He=u(t=>{let e=(0,Fe.c)(23),{spec:a}=t,r=J(),n=F(),s;e[0]!==n?(s=u(()=>n.fetchOpenRpc(),"a"),e[0]=n,e[1]=s):s=e[1];let o=le(a,s,or),i;e[2]!==o.kind||e[3]!==o.spec?(i=o.kind==="ready"?ar(o.spec):void 0,e[2]=o.kind,e[3]=o.spec,e[4]=i):i=e[4];let c=i;if(o.kind==="loading"){let l;return e[5]===Symbol.for("react.memo_cache_sentinel")?(l=(0,G.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"openrpc-reference-loading",children:[(0,G.jsx)(V,{className:"h-8 w-48"}),(0,G.jsx)(V,{className:"h-64 w-full"})]}),e[5]=l):l=e[5],l}if(o.kind==="error"){let l;e[6]!==o.message||e[7]!==r?(l=r("Couldn't load the OpenRPC spec: {message}",{message:o.message}),e[6]=o.message,e[7]=r,e[8]=l):l=e[8];let p;e[9]!==r?(p=r("API reference unavailable"),e[9]=r,e[10]=p):p=e[10];let f;return e[11]!==l||e[12]!==p?(f=(0,G.jsx)(U,{description:l,testId:"openrpc-reference-error",title:p}),e[11]=l,e[12]=p,e[13]=f):f=e[13],f}if(o.kind==="empty"||c===void 0){let l;e[14]!==r?(l=r("Run `lunora codegen --api-spec openrpc` and wire `_generated/openrpc.json` to the worker to render the OpenRPC reference here."),e[14]=r,e[15]=l):l=e[15];let p;e[16]!==r?(p=r("No OpenRPC spec configured"),e[16]=r,e[17]=p):p=e[17];let f;return e[18]!==l||e[19]!==p?(f=(0,G.jsx)(U,{description:l,testId:"openrpc-reference-empty",title:p}),e[18]=l,e[19]=p,e[20]=f):f=e[20],f}let m;return e[21]!==c?(m=(0,G.jsx)(pe,{model:c}),e[21]=c,e[22]=m):m=e[22],m},"q");var B=K(re(),1);var sr=["reference","snippets"],ir=["openapi","openrpc"],Yr=u(t=>{let e=(0,Ge.c)(51),{functions:a,initialShardKey:r,openApiSpec:n,openRpcSpec:s}=t,o=J(),[i,c]=(0,xe.useState)("reference"),[m,l]=(0,xe.useState)("openapi"),p;e[0]!==o?(p=o("Reference"),e[0]=o,e[1]=p):p=e[1];let f;e[2]!==o?(f=o("Snippets"),e[2]=o,e[3]=f):f=e[3];let h;e[4]!==p||e[5]!==f?(h={reference:p,snippets:f},e[4]=p,e[5]=f,e[6]=h):h=e[6];let g=h,x;e[7]!==o?(x=o("OpenAPI"),e[7]=o,e[8]=x):x=e[8];let v;e[9]!==o?(v=o("OpenRPC"),e[9]=o,e[10]=v):v=e[10];let N;e[11]!==x||e[12]!==v?(N={openapi:x,openrpc:v},e[11]=x,e[12]=v,e[13]=N):N=e[13];let y=N,b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=u(E=>{c(E.currentTarget.dataset.view)},"S"),e[14]=b):b=e[14];let I=b,P;e[15]===Symbol.for("react.memo_cache_sentinel")?(P=u(E=>{l(E.currentTarget.dataset.format)},"A"),e[15]=P):P=e[15];let $=P,k;e[16]!==o?(k=o("API view"),e[16]=o,e[17]=k):k=e[17];let w;e[18]!==i||e[19]!==g?(w=sr.map(E=>(0,B.jsx)(W,{"aria-selected":i===E,"data-testid":`api-view-${E}`,"data-view":E,onClick:I,role:"tab",size:"sm",type:"button",variant:i===E?"default":"outline",children:g[E]},E)),e[18]=i,e[19]=g,e[20]=w):w=e[20];let j;e[21]!==w||e[22]!==k?(j=(0,B.jsx)("div",{"aria-label":k,className:"flex gap-1.5","data-testid":"api-view-toggle",role:"tablist",children:w}),e[21]=w,e[22]=k,e[23]=j):j=e[23];let O;e[24]!==m||e[25]!==y||e[26]!==o||e[27]!==i?(O=i==="reference"&&(0,B.jsx)("div",{"aria-label":o("API spec format"),className:"flex gap-1.5","data-testid":"api-format-toggle",role:"tablist",children:ir.map(E=>(0,B.jsx)(W,{"aria-selected":m===E,"data-format":E,"data-testid":`api-format-${E}`,onClick:$,role:"tab",size:"sm",type:"button",variant:m===E?"default":"outline",children:y[E]},E))}),e[24]=m,e[25]=y,e[26]=o,e[27]=i,e[28]=O):O=e[28];let S;e[29]!==j||e[30]!==O?(S=(0,B.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-3 border-b border-border px-6 py-3",children:[j,O]}),e[29]=j,e[30]=O,e[31]=S):S=e[31];let C;e[32]!==a||e[33]!==r||e[34]!==i?(C=i==="snippets"&&(0,B.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-6",children:(0,B.jsx)(Ae,{functions:a,initialShardKey:r})}),e[32]=a,e[33]=r,e[34]=i,e[35]=C):C=e[35];let A;e[36]!==m||e[37]!==n||e[38]!==i?(A=i==="reference"&&m==="openapi"&&(0,B.jsx)(Ue,{spec:n}),e[36]=m,e[37]=n,e[38]=i,e[39]=A):A=e[39];let _;e[40]!==m||e[41]!==s||e[42]!==i?(_=i==="reference"&&m==="openrpc"&&(0,B.jsx)(He,{spec:s}),e[40]=m,e[41]=s,e[42]=i,e[43]=_):_=e[43];let T;e[44]!==C||e[45]!==A||e[46]!==_?(T=(0,B.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[C,A,_]}),e[44]=C,e[45]=A,e[46]=_,e[47]=T):T=e[47];let L;return e[48]!==S||e[49]!==T?(L=(0,B.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"lunora-api-tab",children:[S,T]}),e[48]=S,e[49]=T,e[50]=L):L=e[50],L},"k");export{Yr as default};
@@ -0,0 +1 @@
1
+ import{j as o}from"./chunk-BOMPSVRC.js";import{a as r,d as i,e as p}from"./chunk-I26MS5PJ.js";var a=i(p(),1);var R=a.forwardRef(r(function(e,n){let{className:l,render:m,orientation:t="horizontal",style:f,...s}=e;return o("div",e,{state:{orientation:t},ref:n,props:[{role:"separator","aria-orientation":t},s]})},"SeparatorComponent"));export{R as a};
@@ -0,0 +1 @@
1
+ import{b as g}from"./chunk-KNVOVRC7.js";import"./chunk-N7ZLG6XW.js";import"./chunk-NCPW7WHO.js";import"./chunk-NNYTSWRW.js";import"./chunk-55UGUCQ6.js";import{a as f}from"./chunk-4ZEL6BYL.js";import{c as m}from"./chunk-B6WI7CHG.js";import"./chunk-G6EOMCDE.js";import"./chunk-QAQDMS6R.js";import"./chunk-YLPATGWK.js";import"./chunk-HCTJKP5J.js";import"./chunk-2IKDEUCX.js";import{d as p}from"./chunk-HJHSQPHW.js";import{a as r,d as h,f as S,g as A}from"./chunk-I26MS5PJ.js";var R=h(S(),1);var k=h(A(),1);var _=r((e,s)=>({"admin-token-weak":e("Weak admin token"),"auth-secret-weak":e("Weak auth secret"),"cookies-insecure":e("Session cookies are not Secure"),"cors-wildcard-credentials":e("Wildcard CORS with credentials"),"csrf-disabled":e("CSRF/origin guard is off"),"dev-args-unredacted":e("Request log keeps un-redacted args"),"security-headers-disabled":e("Security headers are off"),"ws-gate-open":e("User subscriptions are ungated")})[s.kind],"k"),w=r(e=>Array.isArray(e.findings)?e.findings:[],"g"),b=r(e=>({"admin-token-weak":"LUNORA_ADMIN_TOKEN","auth-secret-weak":"AUTH_SECRET","cookies-insecure":"BETTER_AUTH_URL","cors-wildcard-credentials":"LUNORA_ALLOWED_ORIGINS","csrf-disabled":"LUNORA_SECURITY_CSRF","dev-args-unredacted":"request log","security-headers-disabled":"LUNORA_SECURITY_HEADERS","ws-gate-open":"LUNORA_WS_BEARER"})[e.kind],"S"),E=r((e,s)=>({"admin-token-weak":e("Your admin token is {length} characters \u2014 use at least {min} for a brute-force-resistant secret.",{length:s.detail?.length,min:s.detail?.min}),"auth-secret-weak":e("Your auth secret is {length} characters \u2014 use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.",{length:s.detail?.length,min:s.detail?.min}),"cookies-insecure":e("BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production."),"cors-wildcard-credentials":e("LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed \u2014 browsers reject this and it defeats the allowlist. Name explicit origins instead of *."),"csrf-disabled":e("LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable."),"dev-args-unredacted":e("This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy."),"security-headers-disabled":e("LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production."),"ws-gate-open":e("LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: anyone who can reach the worker can open a socket and run ordinary user subscriptions. Admin subscriptions are unaffected \u2014 they need the admin token. Set it if subscribers should present a shared credential.")})[s.kind],"A"),O=r(()=>{let e=(0,R.c)(8),s=p(),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let{data:a,error:d,errorSource:c}=m(f.getSecurityAudit,i),n;if(e[1]!==a||e[2]!==s){let u=a===void 0?null:w(a);n=u===null?null:u.map(t=>({description:E(s,t),entity:b(t),issueType:_(s,t),key:t.kind,level:t.level})),e[1]=a,e[2]=s,e[3]=n}else n=e[3];let l=n,o;return e[4]!==d||e[5]!==c||e[6]!==l?(o=(0,k.jsx)(g,{error:d,errorSource:c,rows:l,testId:"lunora-security-advisor"}),e[4]=d,e[5]=c,e[6]=l,e[7]=o):o=e[7],o},"T");export{O as default};
@@ -0,0 +1,15 @@
1
+ import{a}from"./chunk-I26MS5PJ.js";var r="https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/",n="https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-1xxx-errors/",g=/string or blob too big/iu,l={BAD_REQUEST:{status:400,title:"Bad request"},UNAUTHORIZED:{status:401,title:"Unauthorized"},FORBIDDEN:{status:403,title:"Forbidden"},NOT_FOUND:{status:404,title:"Not found"},CONFLICT:{hint:["Another write changed this row while your mutation was running (optimistic concurrency conflict).","","Re-read the row and retry the mutation with the fresh value. Lunora serializes a DO's mutations, so a persistent conflict usually means the handler conflicts **with itself** (e.g. a trigger or cascade touching the same row) \u2014 split that work rather than adding a retry loop."],status:409,title:"Conflict"},NOT_UNIQUE:{hint:["`.unique()` matched more than one document \u2014 it expects the query to identify at most one row.","","- If several matches are legitimate, use `.first()` (take one) or `.collect()` (take all) instead.","- Otherwise tighten the query (e.g. filter on a unique/indexed field) so it can only match one row."],status:400,title:"Query matched more than one document"},VALIDATION_ERROR:{status:400,title:"Validation failed"},TOO_MANY_REQUESTS:{status:429,title:"Too many requests"},UNPROCESSABLE:{status:422,title:"Unprocessable"},NOT_IMPLEMENTED:{status:501,title:"Not implemented"},FUNCTION_NOT_FOUND:{status:404,title:"Function not found"},METHOD_NOT_ALLOWED:{status:405,title:"Method not allowed"},PAYLOAD_TOO_LARGE:{status:413,title:"Payload too large"},INTERNAL:{internal:!0,status:500,title:"Internal error"},INTERNAL_SERVER_ERROR:{internal:!0,status:500,title:"Internal error"},RPC_FAILED:{internal:!0,status:500,title:"Internal error"},COUNT_RLS_UNSUPPORTED:{status:422,title:"count() is unsupported under an RLS policy"},MASK_UNSUPPORTED:{status:422,title:"Aggregation over a masked column is unsupported"},RELATION_PREDICATE_UNSUPPORTED:{status:422,title:"Relation predicate is unsupported in a write policy"},RLS_REQUIRED:{hint:["This table is secure-by-default: it has no `.public()` marker and no RLS policy resolved for the caller, so the read fails closed.","","Add a read policy with `.rls(...)`, or mark the table `.public()` if it is intentionally world-readable."],status:403,title:"RLS policy required"},RUN_DEPTH_EXCEEDED:{internal:!0,status:500,title:"Run depth exceeded"},RUN_KIND_FORBIDDEN:{status:500,title:"Function kind may not be composed from a query"},TRANSACTION_LIMIT_EXCEEDED:{hint:["A single mutation may only read and write a bounded amount before it is stopped.","","Narrow the read with an index (`.withIndex(...)`) instead of scanning the table, or split the write across several mutations \u2014 for a large backfill use `defineMigration` + `lunora migrate up`, which batches and checkpoints for you.","","The ceilings are deliberately conservative \u2014 they exist to stop one request taking down the whole shard. A deployment that genuinely needs bigger transactions can raise them by overriding the `transactionLimits()` seam on its generated shard class."],status:413,title:"Transaction limit exceeded"},MIGRATION_NOT_FOUND:{status:404,title:"Data migration not found"},MIGRATION_DRIFT:{hint:["An applied SQL migration is never re-run, so the runner stopped before applying anything.","","- **Its text changed after it ran:** revert the edit and put the change in a new migration. If the edit is inert (a comment, whitespace, line endings), record the new hash with the `UPDATE` the message prints.","- **Tracking rows predate versions and match no migration:** set each row's `version` with the `UPDATE` the message prints, so the runner can tell what already ran."],status:409,title:"Migration drift"},UNKNOWN_TABLE:{status:404,title:"Unknown table"},GLOBAL_TABLE_NOT_EDITABLE:{status:400,title:"Global table is not editable"},SHARD_ERROR:{status:503,title:"Shard error"},SHARD_UNAVAILABLE:{status:503,title:"Shard unavailable"},SHARD_TIMEOUT:{status:504,title:"Shard timeout"},SHARD_HTTP_ERROR:{status:502,title:"Shard HTTP error"},SUBSCRIPTION_PERSIST_FAILED:{status:500,title:"Subscription persist failed"},TOO_MANY_SUBSCRIPTIONS:{status:429,title:"Too many subscriptions"},OFFLINE_IDENTITY_CHANGED:{status:409,title:"Offline identity changed"},IDENTITY_MISMATCH:{hint:["A write queued offline was replayed on a session that now belongs to someone else (a sign-out, or another user's sign-in, while it waited), so the worker refused it rather than commit it as them.","","`@lunora/client` re-resolves the session on this refusal and settles the write itself. If every replay is refused while the same user stays signed in, your worker's `resolveIdentity` returns a different `userId` than better-auth's `user.id`, or the RPC request carries no session cookie."],status:409,title:"Session changed since the write was queued"},CODEGEN_DIAGNOSTIC:{status:500,title:"Codegen diagnostic"},JURISDICTION_MOVE:{hint:["The schema declares `.jurisdiction(...)` and the project has DO-backed auth (`.auth({ namespace })`). Pinning the auth object to the jurisdiction resolves it to a new, empty one: every user, account and session stays in the unpinned object until copied across. Voice sessions are pinned without an acknowledgement: they store nothing, and their transcripts are rows in the already-pinned shards.","",'Acknowledge with `.jurisdiction("eu", { pinAuth: true })` and deploy, then copy the auth tables across with the `__lunora_admin__:copyAuthToJurisdiction` admin op and, once the counts check out, purge the unpinned copy with `__lunora_admin__:purgeUnpinnedAuth` (see [Pinning auth and voice](/docs/concepts/data-residency#pinning-auth-and-voice)). For D1-mode auth the acknowledgement changes nothing.'],status:422,title:"Unacknowledged jurisdiction move"},SCHEMA_SNAPSHOT_PARSE:{status:500,title:"Schema snapshot parse error"},ENV_INVALID:{internal:!0,status:500,title:"Invalid environment"},X402_FACILITATOR_ERROR:{internal:!0,status:502,title:"Payment facilitator error"},AUTH_HEADERS_MISSING:{internal:!0,status:500,title:"Auth headers missing"},PRIVACY_COVERAGE:{status:500,title:"Privacy coverage check failed"},PRIVACY_REQUEST_OPEN:{status:409,title:"A privacy request is already open"},PRIVACY_SESSION_NOT_FRESH:{status:403,title:"Recent sign-in required"},EMAIL_DOMAIN_BLOCKED:{hint:["This address's domain is on the disposable/throwaway blocklist (or your configured deny-list).","","Sign up with a permanent mailbox. To tune the policy, pass `blockDisposable` / `allowDomains` / `denyDomains` in the `EmailGateConfig` you hand `assertEmailAllowed` / `classifyEmail` / `emailGateMiddleware` (`@lunora/auth/email-guard`)."],status:400,title:"Email domain not allowed"},EMAIL_UNDELIVERABLE:{hint:["The address's domain publishes no MX (or fallback A/AAAA) records, so it can't receive mail.","","Check for a typo in the domain. MX verification is opt-in (`mx: true`) and needs DNS \u2014 leave it off on the edge path if DNS is unavailable."],status:400,title:"Email domain cannot receive mail"},ANALYTICS_SQL_QUERY_ERROR:{status:502,title:"Analytics SQL query error"},BROWSER_RUN_ERROR:{status:502,title:"Browser Run API error"},BROWSER_TOO_MANY_REDIRECTS:{status:502,title:"Too many redirects"},R2_SQL_ERROR:{status:502,title:"R2 SQL API error"},WORKFLOWS_REST_ERROR:{status:502,title:"Cloudflare Workflows REST API error"},CONFIG_INVALID:{internal:!0,status:500,title:"Payment configuration invalid"},CURRENCY_MISMATCH:{status:400,title:"Currency mismatch"},PROVIDER_ERROR:{status:502,title:"Payment provider error"},WEBHOOK_EVENT_ID_MISSING:{status:400,title:"Webhook event id missing"},WEBHOOK_SIGNATURE_INVALID:{status:400,title:"Webhook signature invalid"},WEBHOOK_TIMESTAMP_INVALID:{status:400,title:"Webhook timestamp outside tolerance"},ADMIN_FORBIDDEN:{status:403,title:"Admin access forbidden"},ADMIN_TOKEN_NOT_CONFIGURED:{status:400,title:"Admin token not configured"},AUTH_MIGRATOR_UNSUPPORTED:{hint:["better-auth migrates only through its Kysely adapter, so `ensureMigrated` / `compileMigrationsSql` need the raw D1 binding as `database` \u2014 a custom adapter (`lunoraD1Adapter`, `lunoraAuthAdapter`, `lunoraDoAdapter`) cannot be migrated through, and neither can an absent `database`.","","Build a SECOND, migration-only instance over the raw binding \u2014 `createMigrationAuth({ ...options, database: env.DB })` (from `@lunora/auth/migrate`) \u2014 and hand that one to `ensureMigrated`. Keep the adapter on the instance that serves requests: the adapter exists to dodge a dev-runner hang in `$context`, which the migration instance never resolves.","","To compile the SQL off-platform (`compileMigrationsSql`), diff against an empty local database \u2014 `new DatabaseSync(':memory:')` from `node:sqlite` \u2014 rather than passing no `database` at all."],status:500,title:"Auth migrator cannot drive the configured database"},AUTH_NOT_CONFIGURED:{status:400,title:"Auth admin not configured"},AUTH_OP_NOT_SUPPORTED:{status:400,title:"Auth admin operation not supported"},AUTH_CIMD_FETCH_NOT_PUBLIC:{hint:'Add "global_fetch_strictly_public" to "compatibility_flags" in wrangler.jsonc, so CIMD metadata fetches cannot reach private addresses. `lunora doctor` reports it as `cimd-fetch-not-strictly-public`.',status:500,title:"CIMD transport needs the global_fetch_strictly_public flag"},AUTH_MCP_RESOURCE_AMBIGUOUS:{hint:'Use `mcp` from "@lunora/auth/plugins" (not `@better-auth/mcp`) and pass the plugin object as is: it records its `resource`, which the worker needs to serve the protected-resource metadata when the provider names several resources.',status:500,title:"MCP resource cannot be told apart from the provider's other resources"},AUTH_MCP_RESOURCE_INVALID:{hint:"Pass `resource` to `requireMcpAuth` (and `mcp()`) as the absolute URL of the MCP route, e.g. `https://app.example.com/mcp`: issued tokens are audience-bound to it.",status:500,title:"MCP resource missing or not an absolute URL"},MCP_STEP_UP_MISCONFIGURED:{hint:"Give `createAuthedMcpFetchHandler`'s `stepUp` a non-empty `scope` (such as `lunora:write`) and a `challenge` (`createInsufficientScopeError` from `@lunora/auth/plugins`), or leave `stepUp` out.",status:500,title:"MCP step-up misconfigured"},BACKUP_NOT_CONFIGURED:{status:500,title:"Scheduled backup not configured"},BACKUP_RETENTION_NOT_CONFIGURED:{hint:["`lunora backup prune` removes snapshots past the retention window, and this worker has no window: set `backupRetain` (how many to keep) and `backupCron` (which decides whose snapshots retention owns) on `createWorker`.","","Nothing was deleted. A default is deliberately not invented here \u2014 retention deleting on its own is exactly what this command exists to replace."],status:400,title:"Backup retention window not configured"},BACKUP_TOO_LARGE:{hint:["The scheduled backup is assembled inside the Worker isolate, so it caps the snapshot it will build. Nothing was written.","","The cap is on the NDJSON, not on peak memory: the export fan-out resolves every shard's rows before the first row is encoded, so a snapshot under the cap can still exhaust the isolate. It is set well below the isolate's limit for that reason.","","Narrow the snapshot with `backupTables`, or take this backup off-platform with `lunora backup create --bucket`, which runs on a machine rather than in an isolate. Backing up more often does not help \u2014 every run is a full snapshot."],status:507,title:"Backup too large to assemble in a Worker"},CRON_JOBS_NOT_CONFIGURED:{status:400,title:"Cron jobs not configured"},CRON_JOB_NOT_FOUND:{status:404,title:"Cron job not found"},EXPORT_SHARD_FAILED:{hint:["One or more shards failed to export, so the snapshot would have been short. Nothing is written when this fires \u2014 a partial export must never be mistaken for a complete one.","","The message names each failed shard key and its error. Re-run the export once those shards are reachable; a shard that fails repeatedly is usually over the per-request memory budget, which `backupTables` narrows."],status:502,title:"Export failed on one or more shards"},EXPORT_TAP_NOT_CONFIGURED:{status:400,title:"Export tap not configured"},FUNCTIONS_NOT_CONFIGURED:{status:400,title:"Functions registry not configured"},GLOBALS_NOT_CONFIGURED:{status:400,title:"Global-table introspector not configured"},ID_COLLISION:{hint:["The imported row carries an `_id` that is already held by a DIFFERENT table in this shard. Ids are per-table, so inserting it would leave two tables claiming one id and make a later lookup resolve to whichever one it reached first.","","This is reported per row rather than aborting the import: the remaining rows still apply. Re-mint the id on the source side, or import that table into a shard that does not already hold it."],status:409,title:"Document id already belongs to another table"},KV_NOT_CONFIGURED:{status:400,title:"KV introspector not configured"},MIGRATION_ID_REQUIRED:{status:400,title:"Migration id required"},PITR_UNAVAILABLE:{status:409,title:"Point-in-time recovery unavailable"},SCHEDULER_NOT_CONFIGURED:{status:400,title:"Scheduler not configured"},STORAGE_CHECKSUM_MISMATCH:{hint:["The upload body did not match the declared `expectedSize` or `expectedSha256`, so nothing was written \u2014 this check fails closed.","","Re-read the bytes from the source export and retry the transfer. A persistent mismatch means the source blob is corrupt or truncated; fix the export rather than bypassing the check."],status:400,title:"Storage checksum mismatch"},STORAGE_DELETE_NOT_CONFIGURED:{status:400,title:"Storage delete not configured"},STORAGE_DOWNLOAD_NOT_CONFIGURED:{hint:["`GET /_lunora/admin/storage/object` needs a `storageDownload` function on the worker. The generated app worker wires it up; a hand-written `createWorker({ ... })` has to pass `(key, opts) => pick(opts?.bucket).download(key)` \u2014 forwarding `opts.bucket` to the right bucket, and wrapping rather than passing `createStorage(...).download` itself, whose second parameter is a byte range.","","Without it a bucket-backed `lunora backup restore --bucket` cannot read the snapshot. The object is still readable out of band with `wrangler r2 object get`."],status:400,title:"Storage download not configured"},STORAGE_NOT_CONFIGURED:{status:400,title:"Storage not configured"},STORAGE_OBJECT_NOT_FOUND:{status:404,title:"Storage object not found"},STORAGE_UPLOAD_NOT_CONFIGURED:{status:400,title:"Storage upload not configured"},STORAGE_URL_NOT_CONFIGURED:{status:400,title:"Storage signed URL not configured"},RAG_DIMENSION_MISMATCH:{hint:["A stored vector and the query embedding have different widths, so they cannot be compared.","","This is what changing a RAG index's `embeddingModel` (or a provider's `dimensions` option) without reindexing looks like. Either put the previous model back, or reindex the namespace under the new one \u2014 bump `embeddingModelVersion` so the index rebuilds instead of mixing widths."],status:409,title:"Embedding dimension mismatch"},VECTORS_NOT_CONFIGURED:{status:400,title:"Vector index introspector not configured"},VECTOR_QUERY_UNSUPPORTED:{status:400,title:"Vector index querying not enabled"},WORKFLOWS_NOT_CONFIGURED:{status:501,title:"Workflows not configured"},AUTH_AUDIT_NOT_CONFIGURED:{status:400,title:"Auth audit reader not configured"},AUTH_AUDIT_READ_FAILED:{internal:!0,status:500,title:"Auth audit read failed"},AUTH_MOVE_NOT_CONFIGURED:{hint:"The copy needs DO-backed auth (`.auth({ namespace })`) pinned with `.jurisdiction(\u2026, { pinAuth: true })`, and the auth object's `internalSecret` set.",status:400,title:"Auth jurisdiction move not configured"},AUTH_MOVE_TARGET_NOT_EMPTY:{hint:"The pinned auth object holds users the copy did not write (someone signed up there), so copying into it would merge two user bases. Pass `force: true` to copy anyway: a copied row that collides with one of the pinned object's rows is left out and counted under `conflicts`.",status:409,title:"Pinned auth object is not empty"},AUTH_MOVE_CONFLICT:{hint:"A copied row has the same key or unique value (such as an email) as a row the pinned auth object holds on its own, or the pinned object changed a row the source changed too. Nothing from that page was written. Pass `force: true` to keep the pinned object's rows and count the collisions under `conflicts`.",status:409,title:"Auth copy conflict"},AUTH_MOVE_SOURCE_CHANGED:{hint:"The un-pinned auth object changed after the copy read it (an update, a delete, or a new row), for example during a gradual rollout or a rollback. Run the copy again: it reconciles the changed tables. Then purge.",status:409,title:"Un-pinned auth object changed since the copy"},AUTH_MOVE_SOURCE_PURGED:{hint:"The un-pinned auth object was already purged. Its tables may exist again (a rollback served requests there), but they hold only rows written since, so the copy refuses rather than read them as deletions and remove the pinned object's users. Nothing is left to copy.",status:409,title:"Un-pinned auth object already purged"},AUTH_MOVE_INCOMPLETE:{hint:"Run `__lunora_admin__:copyAuthToJurisdiction` until it answers `done: true`, check the per-table counts, then purge.",status:409,title:"Auth copy not finished"},AUTH_MOVE_FAILED:{hint:"The message names the step, the table and the class of the SQLite error; the auth object's log has the full error. The copy resumes where it stopped once the cause is fixed.",status:500,title:"Auth jurisdiction move failed"},CRON_EXPR_INVALID:{status:500,title:"Invalid cron expression"},CRON_EXPR_NOT_STATIC:{status:500,title:"Cron expression is not statically analyzable"},CRON_JOB_FAILED:{internal:!0,status:500,title:"Cron job failed"},CRON_NAME_NOT_STATIC:{status:500,title:"Cron job name is not statically analyzable"},CRON_NON_STATIC_FN:{status:500,title:"Cron function reference is not statically analyzable"},CRON_NON_STATIC_VALUE:{status:500,title:"Cron value is not statically analyzable"},CRON_SCHEDULE_INVALID:{status:500,title:"Invalid cron schedule"},CRON_SCHEDULE_NOT_STATIC:{status:500,title:"Cron schedule is not statically analyzable"},DUPLICATE_CRON_NAME:{status:500,title:"Duplicate cron job name"},DUPLICATE_AGENT_CLASS:{status:500,title:"Duplicate agent generated class name"},DUPLICATE_AGENT_NAME:{status:500,title:"Duplicate agent name"},DUPLICATE_MIGRATION_ID:{status:500,title:"Duplicate migration id"},DUPLICATE_QUEUE_BINDING:{status:500,title:"Duplicate queue binding"},DUPLICATE_QUEUE_NAME:{status:500,title:"Duplicate queue name"},DUPLICATE_WORKFLOW_CLASS:{status:500,title:"Duplicate workflow generated class name"},MIGRATION_ID_NOT_STATIC:{status:500,title:"Migration id is not statically analyzable"},NAMESPACE_COLLISION:{status:500,title:"Function namespace collision"},BAD_ROW:{status:400,title:"Malformed import row"},BAD_SUBSCRIPTION_ARGS:{status:400,title:"Invalid subscription arguments"},BATCH_LIMIT_EXCEEDED:{status:400,title:"Batch limit exceeded"},CROSS_SHARD_RANK_UNSUPPORTED:{status:400,title:"Cross-shard rank() is unsupported"},DISPATCH_UNAUTHENTICATED:{hint:"The scheduler could not authenticate to the worker. Check that `LUNORA_SCHEDULER_SECRET` matches on both sides, or that `LUNORA_ADMIN_TOKEN` is set and current.",status:403,title:"Dispatch caller not authenticated"},DISPATCH_IN_PROGRESS:{hint:"A dispatch with this idempotency id is still running on the shard. Retry it; once the first attempt settles the same id is served from the replay cache.",status:409,title:"Dispatch already in progress"},FORBIDDEN_FANOUT:{status:403,title:"Fan-out forbidden"},GLOBAL_SEARCH_SCORES_UNSUPPORTED:{status:400,title:"collectWithScores() is unsupported on a global table"},FORBIDDEN_ORIGIN:{status:403,title:"Origin forbidden"},FORBIDDEN_SHARD:{status:403,title:"Shard access forbidden"},GLOBAL_NOT_CONFIGURED:{status:400,title:"Global table import not configured"},INVALID_INPUT:{status:400,title:"Invalid input"},INVALID_SCHEDULE_ID:{status:400,title:"Invalid schedule id"},RATE_LIMITED:{status:429,title:"Rate limited"},REPLICA_NOT_READY:{status:421,title:"Replica not caught up"},REPLICA_READ_ONLY:{status:421,title:"Replica is read-only"},SEARCH_INDEX_BUILDING:{status:503,title:"Search index is still building"},SERVICE_UNAVAILABLE:{status:503,title:"Service unavailable"},SHAPE_MEMORY_TABLE:{status:400,title:"Shape over a memory table is unsupported"},SHAPE_CROSS_SHARD_JOIN:{status:400,title:"Shape cross-shard join is unsupported"},SHAPE_RELATION_PREDICATE:{status:400,title:"Shape filtered by a relation is unsupported"},UNAUTHENTICATED:{status:401,title:"Unauthenticated"},WIRE_DECODE_FAILED:{status:502,title:"Could not decode a server frame"},WIRE_ENCODE_FAILED:{status:500,title:"Could not encode a return value"},UNKNOWN_COLUMN:{status:404,title:"Unknown column"},CDC_LOG_TRIMMED:{status:409,title:"CDC log trimmed"},CDC_TIMELINE_FORKED:{status:409,title:"CDC timeline forked"},CDC_PAYLOAD_COMPACTED:{status:409,title:"CDC payloads compacted"},EXPIRED:{status:404,title:"Session expired"},NESTED_TRANSACTION:{internal:!0,status:500,title:"Nested transaction"},OUT_OF_ORDER:{status:409,title:"Out-of-order mutation"},SHAPE_GLOBAL_TOO_LARGE:{status:413,title:"Global shape too large"},SHAPE_NOT_FOUND:{status:404,title:"Shape not found"},SHAPE_REQUIRES_CDC:{status:409,title:"Shape requires change-data-capture"},SQL_UNAVAILABLE:{internal:!0,status:500,title:"SQL storage unavailable"},STREAM_ID_IN_USE:{status:409,title:"Stream id already in use"},STREAM_INTERRUPTED:{status:503,title:"Durable stream interrupted"},STREAM_TOO_LONG:{status:507,title:"Durable stream exceeded its chunk ceiling"},TOKEN_EXPIRED:{hint:["The caller's credential verified but its expiry has passed. The worker refuses an HTTP call with this code before it runs; a shard drops a socket with close code `4001` and the same code.","","It is a refusal of the credential, not of the call: `@lunora/client` holds a queued write, fires `onTokenExpired`, and re-sends it after `setAuthToken`. The held write survives the refresh only if you pass the same `subject` (the user id) with the new token, `setAuthToken(freshToken, user.id)`; without one a refresh reads as a user switch and the write is rejected `OFFLINE_IDENTITY_CHANGED`. Under a cookie session there is no token to replace: renew the cookie and the write is re-sent on a backoff. The worker can only tell expired from anonymous if your `resolveIdentity` returns the identity with its past `exp` (or `expiresAtMs`), or throws a `LunoraError` with this code. Returning `null` runs the call anonymous."],status:401,title:"Authentication token expired"},TOO_MANY_STREAMS:{status:429,title:"Too many streams"},TOO_MANY_WHISPER_TOPICS:{hint:"Reuse a stable set of whisper topic names, or reconnect \u2014 the per-socket verdict memo is in-memory, so a new connection starts empty. Leaving a topic does not free its entry.",status:429,title:"Too many whisper topics"},UNKNOWN_ADMIN_OP:{status:404,title:"Unknown admin operation"},SOCKET_TAG_BUDGET_EXCEEDED:{status:400,title:"Socket tag budget exceeded"},RELAY_CANNOT_SEED:{status:500,title:"Relay cannot seed"},RELAY_MISCONFIGURED:{status:500,title:"Relay misconfigured"},RELAY_SEED_FAILED:{status:502,title:"Relay seed failed"},RELAY_SHAPE_UNROUTABLE:{status:500,title:"Relay shape unroutable"},MISCONFIGURED:{internal:!0,status:500,title:"Worker misconfigured"},LUNORA_RUNTIME_UNAVAILABLE:{status:500,title:"Lunora runtime unavailable"},INTERNAL_ERROR:{internal:!0,status:500,title:"Internal error"},BROWSER_TIMEOUT:{status:504,title:"Browser operation timed out"},CLIENT_CLOSED:{status:400,title:"Client is closed"},HTTP_STREAM_BAD_CHUNK:{status:502,title:"Malformed HTTP stream chunk"},HTTP_STREAM_INTERRUPTED:{status:502,title:"HTTP stream interrupted"},HTTP_STREAM_MISSING_PARAM:{status:400,title:"HTTP stream missing path parameter"},HTTP_STREAM_NO_BODY:{status:502,title:"HTTP stream response has no body"},HTTP_STREAM_STATUS:{status:502,title:"HTTP stream request failed"},HTTP_STREAM_TRANSPORT:{status:502,title:"HTTP stream transport error"},STREAM_BACKPRESSURE:{status:429,title:"Stream backpressure"},STREAM_DISCONNECTED:{status:503,title:"Stream disconnected"},STREAM_QUEUE_OVERFLOW:{status:429,title:"Stream queue overflow"},UNKNOWN_MUTATION_FN:{status:404,title:"Unknown mutation function"},LOCAL_DEPENDENCY_MISSING:{hint:["The command Lunora tried to run is not on your PATH, so nothing ran.","","Install it (or put it on PATH) and retry \u2014 `wrangler` ships as a dependency of a Lunora app, so `pnpm install` usually fixes that one; `git` and `docker` are installed separately."],status:500,title:"Required local tool not found"}},c=a(e=>Object.hasOwn(l,e)?l[e]:void 0,"h");var m=[{body:["A single row exceeded the storage engine's per-row ceiling \u2014 2 MB on a Durable Object's SQLite, and 2,000,000 bytes on D1.","","The limit is on the STORED bytes, which are UTF-8: a document of multi-byte text (CJK, emoji) costs up to 3x its character count. `v.bytes()` and `v.bigint()` columns cost more again on a shard-local table, where the row stores both a SQL-comparable projection and the original.","","Keep the large payload out of the row and store a reference to it:","","```ts","const key = `uploads/${crypto.randomUUID()}`;","await ctx.storage.uploads.put(key, bytes);",'await ctx.db.insert("documents", { storageKey: key, title });',"```","","R2 has no practical object-size ceiling, and the row stays small enough to read, index, and replicate."].join(`
2
+ `),header:"Row too large for the storage engine",id:"lunora-row-too-big",test:a(e=>g.test(e),"test")},{body:["Lunora codegen couldn't find a schema to generate from.","","Create `lunora/schema.ts` exporting a `defineSchema(...)` call:","","```ts",'import { defineSchema, defineTable, v } from "@lunora/server";',"","export default defineSchema({"," messages: defineTable({ body: v.string() }),","});","```","","Or run `lunora init` to scaffold Lunora (a sample `lunora/schema.ts` included) into your app."].join(`
3
+ `),header:"No Lunora schema found",id:"lunora-schema-missing",test:a(e=>e.includes("defineSchema() not found")||e.includes("schema.ts not found at"),"test")},{body:["`defineSchema(...)` must be called with an **inline object literal** mapping table names to `defineTable(...)`:","","```ts","export default defineSchema({"," todos: defineTable({ title: v.string(), done: v.boolean() }),","});","```","","Codegen reads the schema statically, so it can't follow a variable or a spread \u2014 pass the object literal directly."].join(`
4
+ `),header:"`defineSchema()` needs an inline object literal",id:"lunora-schema-not-object-literal",test:a(e=>e.includes("defineSchema() expects an object literal"),"test")},{body:["This table name collides with a built-in `ctx.db` member, so the generated client can't expose it.","","Rename the table to anything that isn't a `ctx.db` member (the error names the one it hit) \u2014 e.g. `userAccounts` instead of `insert`, or `pageViews` instead of `count`."].join(`
5
+ `),header:"Table name is reserved",id:"lunora-table-reserved",test:a(e=>e.includes("is reserved")&&e.includes("ctx.db"),"test")},{body:["Two tables resolve to the same name \u2014 usually a base table and a schema **extension** both defining it.","","Rename one of them, or drop the duplicate from the extension. Each table name must be unique across `defineSchema(...)` and every `.extend(...)`."].join(`
6
+ `),header:"Duplicate table name",id:"lunora-table-duplicate",test:a(e=>e.includes("already exists")&&e.includes(".extend("),"test")},{body:['`.jurisdiction(...)` accepts only a **string literal** of `"eu"`, `"us"`, or `"fedramp"`:',"","```ts",'defineSchema({ /* \u2026 */ }).jurisdiction("eu");',"```"].join(`
7
+ `),header:"Invalid `.jurisdiction(...)` value",id:"lunora-jurisdiction",test:a(e=>e.includes("unknown jurisdiction")||e.includes("jurisdiction")&&e.includes('"eu", "us", or "fedramp"'),"test")},{body:["The `unique` flag on an index must be a **literal** `true` or `false`, not a computed value \u2014 codegen needs to read it statically:","","```ts",'defineTable({ email: v.string() }).index("by_email", ["email"], { unique: true });',"```"].join(`
8
+ `),header:"`unique` must be a literal",id:"lunora-unique-literal",test:a(e=>e.includes("must be a literal")&&e.includes("unique"),"test")},{body:["A declared container/workflow class isn't re-exported by your worker entry, so `wrangler deploy` would reject it.","","Add the generated re-export shown in the error to your worker entry (e.g. `src/index.ts`):","","```ts",'export * from "./lunora/_generated/containers";',"```"].join(`
9
+ `),header:"Binding not exported by your worker entry",id:"lunora-worker-entry-export-gap",test:a(e=>e.includes("not exported by your worker entry"),"test")},{body:["A row with the same value already exists in a `unique` index.","","- If you meant to upsert, use `ctx.db.<table>().upsert(...)` (or `.patch(...)` an existing row) instead of `.insert(...)`.",`- Otherwise pick a value that isn't already taken, and consider surfacing a friendly "already exists" message to the user.`].join(`
10
+ `),header:"Unique constraint violation",id:"lunora-runtime-unique",test:a(e=>e.includes("unique constraint violation on"),"test")},{body:l.CONFLICT.hint.join(`
11
+ `),header:"Optimistic concurrency conflict",id:"lunora-runtime-occ",test:a(e=>e.includes("optimistic concurrency conflict"),"test")}],d=[{causes:"the origin returned an empty, unknown, or malformed response Cloudflare couldn't interpret (often an origin crash or an oversized response header)",code:"520",docsUrl:r,family:"5xx",fix:"check your origin's logs for a crash, ensure it returns a valid HTTP response, and keep response headers under the size limit",summary:"Cloudflare got an unknown/empty response from your origin web server.",title:"Web server returns an unknown error"},{causes:"the origin refused the connection \u2014 the web server is down, or a firewall is blocking Cloudflare's IP ranges",code:"521",docsUrl:r,family:"5xx",fix:"confirm the origin process is running and allowlist Cloudflare's published IP ranges in your firewall/security groups",summary:"Cloudflare could not connect to your origin because it refused the connection.",title:"Web server is down"},{causes:"Cloudflare could not establish a TCP connection to the origin in time \u2014 the origin is overloaded, a firewall is dropping packets, or the origin IP is wrong",code:"522",docsUrl:r,family:"5xx",fix:"verify the origin is reachable and not overloaded, and that the DNS record points at the correct origin IP",summary:"The connection to your origin timed out before it was established.",title:"Connection timed out"},{causes:"Cloudflare cannot route to the origin at all \u2014 a bad DNS record, an origin IP that changed, or invalid routing",code:"523",docsUrl:r,family:"5xx",fix:"verify the DNS A/AAAA record points at a reachable origin IP and that no upstream network is blocking Cloudflare",summary:"Cloudflare could not reach your origin server.",title:"Origin is unreachable"},{causes:"Cloudflare made a TCP connection but the origin did not return an HTTP response within 100 seconds \u2014 a slow handler or long-running request",code:"524",docsUrl:r,family:"5xx",fix:"speed up the slow origin handler, or move long work off the request path into a background job (a Durable Object, Queue, or Workflow)",summary:"Cloudflare connected to your origin but it did not respond in time.",title:"A timeout occurred"},{causes:"the TLS handshake between Cloudflare and the origin failed \u2014 a missing/invalid origin certificate, or a cipher/SNI mismatch under Full (Strict) SSL",code:"525",docsUrl:r,family:"5xx",fix:"install a valid certificate on the origin and align your Cloudflare SSL/TLS mode with the origin's certificate setup",summary:"The SSL handshake with your origin failed.",title:"SSL handshake failed"},{causes:"Cloudflare could not validate the origin's certificate under Full (Strict) SSL \u2014 it is expired, self-signed, or issued for the wrong hostname",code:"526",docsUrl:r,family:"5xx",fix:"install a valid, publicly-trusted certificate on the origin (or use a Cloudflare Origin CA cert), matching the request hostname",summary:"Cloudflare could not validate your origin's SSL certificate.",title:"Invalid SSL certificate"},{causes:"a DNS record points at a Cloudflare IP or another prohibited address instead of your real origin",code:"1000",docsUrl:n,family:"1xxx",fix:"point the DNS record at your real origin IP, not a Cloudflare-owned or loopback address",summary:"DNS points to a prohibited IP.",title:"DNS points to prohibited IP"},{causes:"Cloudflare could not resolve the requested hostname \u2014 a Worker fetched an unresolvable host, or a DNS record is misconfigured",code:"1001",docsUrl:n,family:"1xxx",fix:"check the hostname you're requesting and the DNS records for the zone resolve to a valid origin",summary:"Cloudflare could not resolve the origin DNS.",title:"DNS resolution error"},{causes:"a Worker or DNS record targets a restricted IP (for example a Cloudflare-owned or loopback address)",code:"1002",docsUrl:n,family:"1xxx",fix:"change the Worker fetch target or DNS record to a valid, non-restricted origin address",summary:"DNS points to a prohibited IP (Worker/restricted).",title:"DNS points to a prohibited IP"},{causes:"the visitor's IP was blocked by an IP Access Rule, WAF rule, or security configuration on the zone",code:"1006",docsUrl:n,family:"1xxx",fix:"review the zone's Firewall/WAF and IP Access Rules to see why the address was banned, and adjust if it was blocked in error",summary:"Access denied: the visitor's IP has been banned.",title:"Access denied: your IP has been banned"},{causes:"your Worker threw an unhandled JavaScript exception during the request",code:"1101",docsUrl:n,family:"1xxx",fix:"reproduce with `wrangler tail` (or the Workers Logs / Studio Logs panel) to get the stack trace, then handle the throwing code path",summary:"A Worker threw a JavaScript exception.",title:"Worker threw a JavaScript exception"},{causes:"the Worker used more CPU time than a single invocation is allowed \u2014 usually a hot loop or heavy synchronous work",code:"1102",docsUrl:n,family:"1xxx",fix:"reduce per-request CPU (optimize hot loops, avoid heavy synchronous work) or offload the heavy work to a Durable Object, Queue, or Workflow",summary:"A Worker exceeded its CPU-time resource limit.",title:"Worker exceeded resource limits"}],u=a(e=>e!==void 0&&e>="0"&&e<="9","l"),T=a((e,t)=>{for(let o=e.indexOf(t);o!==-1;o=e.indexOf(t,o+t.length))if(!u(e[o-1])&&!u(e[o+t.length]))return!0;return!1},"_"),A=a((e,t)=>{for(let o of[`error ${t}`,`error: ${t}`])for(let i=e.indexOf(o);i!==-1;i=e.indexOf(o,i+o.length))if(!u(e[i+o.length]))return!0;return!1},"f"),O=/error|cloudflare/iu,p=a(e=>({body:[e.summary,"",`**Likely cause:** ${e.causes}.`,"",`**Fix:** ${e.fix}.`,"",`See [Cloudflare's ${e.family} error docs](${e.docsUrl}).`].join(`
12
+ `),header:`Cloudflare Error ${e.code}: ${e.title}`,id:`cloudflare-error-${e.code}`}),"c"),f=a(e=>{if(!O.test(e))return;let t=e.toLowerCase(),o=t.includes("error"),i=t.includes("cloudflare");if(o){for(let s of d)if(A(t,s.code))return p(s)}if(i){for(let s of d)if(T(t,s.code))return p(s)}},"T"),b=a(e=>(typeof e=="string"?e:e.join(`
13
+ `)).split(`
14
+ `).filter(t=>!t.startsWith("```")).join(`
15
+ `).replaceAll(/\*\*(.+?)\*\*/gu,"$1").replaceAll(/`([^`]+)`/gu,"$1"),"A"),_=a(e=>{for(let t of m)if(t.test(e))return{body:t.body,header:t.header,id:t.id}},"d"),R=a(e=>_(e)??f(e),"b");var E=Symbol.for("@lunora/errors/LunoraError"),h=class e extends Error{static{a(this,"a")}static[Symbol.hasInstance](t){return this!==e?Function.prototype[Symbol.hasInstance].call(this,t):typeof t=="object"&&t!==null&&t[E]===!0}type="VisulimaError";hint;title;loc;code;status;docsUrl;data;constructor(t,o,i={}){let s=c(t);super(o??t,i.cause===void 0?void 0:{cause:i.cause}),this.name=i.name??"LunoraError",this.hint=i.hint??s?.hint,this.title=i.title??s?.title,this.loc=i.location,this.code=t,this.status=i.status??s?.status??500,this.docsUrl=i.docsUrl??s?.docsUrl,this.data=i.data,Object.defineProperty(this,E,{value:!0})}};export{l as a,b,R as c,h as d};
@@ -0,0 +1 @@
1
+ import{a as wt}from"./chunk-FPI7AMQJ.js";import{a as Tt}from"./chunk-HX5A6HC7.js";import{a as se}from"./chunk-OSGXNEFA.js";import{a as $t}from"./chunk-QJLHH3ET.js";import{a as Ot}from"./chunk-37WYCOQ2.js";import{a as zt,b as _t}from"./chunk-4WD4XGC3.js";import"./chunk-Z22BDS6N.js";import{a as kt}from"./chunk-JQXA2OYK.js";import{i as V}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as j}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{b as ge}from"./chunk-B6WI7CHG.js";import{l as oe}from"./chunk-G6EOMCDE.js";import"./chunk-QAQDMS6R.js";import"./chunk-YLPATGWK.js";import{a as ue}from"./chunk-RWVIV3U7.js";import{a as Ct,b as It,c as xt,d as Ve,e as me,f as de}from"./chunk-HCTJKP5J.js";import{a as vt,e as yt}from"./chunk-2IKDEUCX.js";import{d as Q,h as Nt,o as A,p as At,t as Dt}from"./chunk-HJHSQPHW.js";import{a as c,d as pt,e as Jt,f as Ut,g as Ht}from"./chunk-I26MS5PJ.js";var H=pt(Ut(),1);var F=pt(Jt(),1);var a=pt(Ht(),1);var Lt=c(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"Tt"),Kt=c(t=>{let e=Lt(t),r={};for(let[d,h]of Object.entries(e)){if(!Array.isArray(h)||h.some(i=>typeof i!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);r[d]=h}return r},"Qt"),Pt=c(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"$t"),G=c(t=>{let e=(0,H.c)(6),{children:r,htmlFor:d,label:h}=t,i;e[0]!==d||e[1]!==h?(i=(0,a.jsx)(Ot,{htmlFor:d,children:h}),e[0]=d,e[1]=h,e[2]=i):i=e[2];let o;return e[3]!==r||e[4]!==i?(o=(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[i,r]}),e[3]=r,e[4]=i,e[5]=o):o=e[5],o},"V"),ce=c(({busy:t,canSubmit:e,children:r,destructive:d=!1,error:h,onClose:i,onSubmit:o,submitLabel:l,testId:n,title:m})=>{let s=Q();return(0,a.jsxs)($t,{label:m,onClose:i,panelTestId:`${n}-panel`,testId:`${n}-overlay`,variant:"dialog",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:m}),r,h!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":`${n}-error`,role:"alert",children:h}),(0,a.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,a.jsx)(j,{"data-testid":`${n}-cancel`,onClick:i,size:"sm",type:"button",variant:"outline",children:s("Cancel")}),(0,a.jsx)(j,{"data-testid":`${n}-submit`,disabled:t||!e,onClick:o,size:"sm",type:"button",variant:d?"destructive":"default",children:t?s("Saving\u2026"):l})]})]})},"me"),Rt=c(t=>{let e=(0,H.c)(79),{mode:r,onClose:d,onDone:h,org:i}=t,o=oe(),l=Q(),{busy:n,error:m,run:s}=se(),f;e[0]!==i?(f=i?A(i.name):"",e[0]=i,e[1]=f):f=e[1];let[u,b]=(0,F.useState)(f),v;e[2]!==i?(v=i?A(i.slug):"",e[2]=i,e[3]=v):v=e[3];let[g,p]=(0,F.useState)(v),k;e[4]!==i?(k=i?A(i.logo):"",e[4]=i,e[5]=k):k=e[5];let[y,I]=(0,F.useState)(k),[C,w]=(0,F.useState)(""),x;e[6]!==r||e[7]!==i?.metadata?(x=r==="edit"?Pt(i?.metadata):"",e[6]=r,e[7]=i?.metadata,e[8]=x):x=e[8];let[z,N]=(0,F.useState)(x),_;e[9]!==o||e[10]!==y||e[11]!==z||e[12]!==r||e[13]!==u||e[14]!==d||e[15]!==h||e[16]!==i?.id||e[17]!==C||e[18]!==s||e[19]!==g?(_=c(()=>{s(async()=>{let S=z.trim()===""?void 0:Lt(z);r==="create"?await o.createAuthOrganization({logo:y.trim()===""?void 0:y.trim(),metadata:S,name:u.trim(),ownerId:C.trim()===""?void 0:C.trim(),slug:g.trim()===""?void 0:g.trim()}):await o.updateAuthOrganization({logo:y.trim()===""?void 0:y.trim(),metadata:S,name:u.trim()===""?void 0:u.trim(),organizationId:A(i?.id),slug:g.trim()===""?void 0:g.trim()}),h(),d()})},"O"),e[9]=o,e[10]=y,e[11]=z,e[12]=r,e[13]=u,e[14]=d,e[15]=h,e[16]=i?.id,e[17]=C,e[18]=s,e[19]=g,e[20]=_):_=e[20];let D=_,O;e[21]!==r||e[22]!==u?(O=u.trim()!==""||r==="edit",e[21]=r,e[22]=u,e[23]=O):O=e[23];let T;e[24]!==r||e[25]!==l?(T=l(r==="create"?"Create":"Save"),e[24]=r,e[25]=l,e[26]=T):T=e[26];let $;e[27]!==r||e[28]!==l?($=l(r==="create"?"New organization":"Edit organization"),e[27]=r,e[28]=l,e[29]=$):$=e[29];let E;e[30]!==l?(E=l("name"),e[30]=l,e[31]=E):E=e[31];let Z;e[32]===Symbol.for("react.memo_cache_sentinel")?(Z=c(S=>{b(S.target.value)},"H"),e[32]=Z):Z=e[32];let B;e[33]!==u?(B=(0,a.jsx)(V,{"data-testid":"org-form-name",id:"org-form-name",onChange:Z,value:u}),e[33]=u,e[34]=B):B=e[34];let K;e[35]!==B||e[36]!==E?(K=(0,a.jsx)(G,{htmlFor:"org-form-name",label:E,children:B}),e[35]=B,e[36]=E,e[37]=K):K=e[37];let J;e[38]!==l?(J=l("Slug (optional \u2014 derived from name)"),e[38]=l,e[39]=J):J=e[39];let P;e[40]===Symbol.for("react.memo_cache_sentinel")?(P=c(S=>{p(S.target.value)},"P"),e[40]=P):P=e[40];let U;e[41]!==g?(U=(0,a.jsx)(V,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:P,value:g}),e[41]=g,e[42]=U):U=e[42];let L;e[43]!==J||e[44]!==U?(L=(0,a.jsx)(G,{htmlFor:"org-form-slug",label:J,children:U}),e[43]=J,e[44]=U,e[45]=L):L=e[45];let Y;e[46]!==l?(Y=l("Logo URL (optional)"),e[46]=l,e[47]=Y):Y=e[47];let M;e[48]===Symbol.for("react.memo_cache_sentinel")?(M=c(S=>{I(S.target.value)},"M"),e[48]=M):M=e[48];let R;e[49]!==y?(R=(0,a.jsx)(V,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:M,value:y}),e[49]=y,e[50]=R):R=e[50];let q;e[51]!==Y||e[52]!==R?(q=(0,a.jsx)(G,{htmlFor:"org-form-logo",label:Y,children:R}),e[51]=Y,e[52]=R,e[53]=q):q=e[53];let W;e[54]!==r||e[55]!==C||e[56]!==l?(W=r==="create"&&(0,a.jsx)(G,{htmlFor:"org-form-owner",label:l("Owner user id (optional)"),children:(0,a.jsx)(V,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:c(S=>{w(S.target.value)},"onChange"),value:C})}),e[54]=r,e[55]=C,e[56]=l,e[57]=W):W=e[57];let te;e[58]!==l?(te=l("Metadata (JSON, optional)"),e[58]=l,e[59]=te):te=e[59];let ae;e[60]===Symbol.for("react.memo_cache_sentinel")?(ae=c(S=>{N(S.target.value)},"oe"),e[60]=ae):ae=e[60];let re;e[61]!==z?(re=(0,a.jsx)(wt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:ae,value:z}),e[61]=z,e[62]=re):re=e[62];let ee;e[63]!==te||e[64]!==re?(ee=(0,a.jsx)(G,{htmlFor:"org-form-metadata",label:te,children:re}),e[63]=te,e[64]=re,e[65]=ee):ee=e[65];let le;return e[66]!==n||e[67]!==m||e[68]!==d||e[69]!==D||e[70]!==K||e[71]!==L||e[72]!==q||e[73]!==W||e[74]!==ee||e[75]!==O||e[76]!==T||e[77]!==$?(le=(0,a.jsxs)(ce,{busy:n,canSubmit:O,error:m,onClose:d,onSubmit:D,submitLabel:T,testId:"org-form",title:$,children:[K,L,q,W,ee]}),e[66]=n,e[67]=m,e[68]=d,e[69]=D,e[70]=K,e[71]=L,e[72]=q,e[73]=W,e[74]=ee,e[75]=O,e[76]=T,e[77]=$,e[78]=le):le=e[78],le},"yt"),Qt=c(t=>{let e=(0,H.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=oe(),o=Q(),{busy:l,error:n,run:m}=se(),[s,f]=(0,F.useState)(""),[u,b]=(0,F.useState)(""),v;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==h||e[4]!==u||e[5]!==m||e[6]!==s?(v=c(()=>{m(async()=>{await i.addAuthOrgMember({organizationId:h,role:u.trim()===""?void 0:u.trim(),userId:s.trim()}),d(),r()})},"p"),e[0]=i,e[1]=r,e[2]=d,e[3]=h,e[4]=u,e[5]=m,e[6]=s,e[7]=v):v=e[7];let g=v,p;e[8]!==s?(p=s.trim(),e[8]=s,e[9]=p):p=e[9];let k=p!=="",y;e[10]!==o?(y=o("Add member"),e[10]=o,e[11]=y):y=e[11];let I;e[12]!==o?(I=o("Add member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("User id"),e[14]=o,e[15]=C):C=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=c($=>{f($.target.value)},"I"),e[16]=w):w=e[16];let x;e[17]!==s?(x=(0,a.jsx)(V,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:w,value:s}),e[17]=s,e[18]=x):x=e[18];let z;e[19]!==C||e[20]!==x?(z=(0,a.jsx)(G,{htmlFor:"org-add-member-user",label:C,children:x}),e[19]=C,e[20]=x,e[21]=z):z=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=c($=>{b($.target.value)},"O"),e[24]=_):_=e[24];let D;e[25]!==u?(D=(0,a.jsx)(V,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:_,value:u}),e[25]=u,e[26]=D):D=e[26];let O;e[27]!==N||e[28]!==D?(O=(0,a.jsx)(G,{htmlFor:"org-add-member-role",label:N,children:D}),e[27]=N,e[28]=D,e[29]=O):O=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==g||e[34]!==O||e[35]!==k||e[36]!==y||e[37]!==I||e[38]!==z?(T=(0,a.jsxs)(ce,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-add-member",title:I,children:[z,O]}),e[30]=l,e[31]=n,e[32]=r,e[33]=g,e[34]=O,e[35]=k,e[36]=y,e[37]=I,e[38]=z,e[39]=T):T=e[39],T},"Jt"),Zt=c(t=>{let e=(0,H.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=oe(),o=Q(),{busy:l,error:n,run:m}=se(),[s,f]=(0,F.useState)(""),[u,b]=(0,F.useState)(""),v;e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==d||e[4]!==h||e[5]!==u||e[6]!==m?(v=c(()=>{m(async()=>{await i.inviteAuthOrgMember({email:s.trim(),organizationId:h,role:u.trim()===""?void 0:u.trim()}),d(),r()})},"p"),e[0]=i,e[1]=s,e[2]=r,e[3]=d,e[4]=h,e[5]=u,e[6]=m,e[7]=v):v=e[7];let g=v,p;e[8]!==s?(p=s.trim(),e[8]=s,e[9]=p):p=e[9];let k=p!=="",y;e[10]!==o?(y=o("Send invitation"),e[10]=o,e[11]=y):y=e[11];let I;e[12]!==o?(I=o("Invite member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("email"),e[14]=o,e[15]=C):C=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=c($=>{f($.target.value)},"I"),e[16]=w):w=e[16];let x;e[17]!==s?(x=(0,a.jsx)(V,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:w,type:"email",value:s}),e[17]=s,e[18]=x):x=e[18];let z;e[19]!==C||e[20]!==x?(z=(0,a.jsx)(G,{htmlFor:"org-invite-member-email",label:C,children:x}),e[19]=C,e[20]=x,e[21]=z):z=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=c($=>{b($.target.value)},"O"),e[24]=_):_=e[24];let D;e[25]!==u?(D=(0,a.jsx)(V,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:_,value:u}),e[25]=u,e[26]=D):D=e[26];let O;e[27]!==N||e[28]!==D?(O=(0,a.jsx)(G,{htmlFor:"org-invite-member-role",label:N,children:D}),e[27]=N,e[28]=D,e[29]=O):O=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==g||e[34]!==O||e[35]!==k||e[36]!==y||e[37]!==I||e[38]!==z?(T=(0,a.jsxs)(ce,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-invite-member",title:I,children:[z,O]}),e[30]=l,e[31]=n,e[32]=r,e[33]=g,e[34]=O,e[35]=k,e[36]=y,e[37]=I,e[38]=z,e[39]=T):T=e[39],T},"Ut"),Yt=c(t=>{let e=(0,H.c)(32),{member:r,onClose:d,onDone:h}=t,i=oe(),o=Q(),{busy:l,error:n,run:m}=se(),s;e[0]!==r.role?(s=c(()=>A(r.role),"a"),e[0]=r.role,e[1]=s):s=e[1];let[f,u]=(0,F.useState)(s),b;e[2]!==i||e[3]!==r.id||e[4]!==d||e[5]!==h||e[6]!==f||e[7]!==m?(b=c(()=>{m(async()=>{await i.setAuthOrgMemberRole({memberId:A(r.id),role:f.trim()}),h(),d()})},"g"),e[2]=i,e[3]=r.id,e[4]=d,e[5]=h,e[6]=f,e[7]=m,e[8]=b):b=e[8];let v=b,g;e[9]!==f?(g=f.trim(),e[9]=f,e[10]=g):g=e[10];let p=g!=="",k;e[11]!==o?(k=o("Save"),e[11]=o,e[12]=k):k=e[12];let y;e[13]!==o?(y=o("Change member role"),e[13]=o,e[14]=y):y=e[14];let I;e[15]!==o?(I=o("Role"),e[15]=o,e[16]=I):I=e[16];let C;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=c(N=>{u(N.target.value)},"y"),e[17]=C):C=e[17];let w;e[18]!==f?(w=(0,a.jsx)(V,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:C,value:f}),e[18]=f,e[19]=w):w=e[19];let x;e[20]!==I||e[21]!==w?(x=(0,a.jsx)(G,{htmlFor:"org-member-role-value",label:I,children:w}),e[20]=I,e[21]=w,e[22]=x):x=e[22];let z;return e[23]!==l||e[24]!==n||e[25]!==d||e[26]!==v||e[27]!==x||e[28]!==p||e[29]!==k||e[30]!==y?(z=(0,a.jsx)(ce,{busy:l,canSubmit:p,error:n,onClose:d,onSubmit:v,submitLabel:k,testId:"org-member-role",title:y,children:x}),e[23]=l,e[24]=n,e[25]=d,e[26]=v,e[27]=x,e[28]=p,e[29]=k,e[30]=y,e[31]=z):z=e[31],z},"Gt"),Mt=c(t=>{let e=(0,H.c)(36),{mode:r,onClose:d,onDone:h,organizationId:i,team:o}=t,l=oe(),n=Q(),{busy:m,error:s,run:f}=se(),u;e[0]!==o?(u=o?A(o.name):"",e[0]=o,e[1]=u):u=e[1];let[b,v]=(0,F.useState)(u),g;e[2]!==l||e[3]!==r||e[4]!==b||e[5]!==d||e[6]!==h||e[7]!==i||e[8]!==f||e[9]!==o?.id?(g=c(()=>{f(async()=>{await(r==="create"?l.createAuthOrgTeam({name:b.trim(),organizationId:i}):l.updateAuthOrgTeam({name:b.trim(),teamId:A(o?.id)})),h(),d()})},"f"),e[2]=l,e[3]=r,e[4]=b,e[5]=d,e[6]=h,e[7]=i,e[8]=f,e[9]=o?.id,e[10]=g):g=e[10];let p=g,k;e[11]!==b?(k=b.trim(),e[11]=b,e[12]=k):k=e[12];let y=k!=="",I;e[13]!==r||e[14]!==n?(I=n(r==="create"?"Create":"Save"),e[13]=r,e[14]=n,e[15]=I):I=e[15];let C;e[16]!==r||e[17]!==n?(C=n(r==="create"?"New team":"Rename team"),e[16]=r,e[17]=n,e[18]=C):C=e[18];let w;e[19]!==n?(w=n("name"),e[19]=n,e[20]=w):w=e[20];let x;e[21]===Symbol.for("react.memo_cache_sentinel")?(x=c(D=>{v(D.target.value)},"x"),e[21]=x):x=e[21];let z;e[22]!==b?(z=(0,a.jsx)(V,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:x,value:b}),e[22]=b,e[23]=z):z=e[23];let N;e[24]!==w||e[25]!==z?(N=(0,a.jsx)(G,{htmlFor:"org-team-form-name",label:w,children:z}),e[24]=w,e[25]=z,e[26]=N):N=e[26];let _;return e[27]!==m||e[28]!==s||e[29]!==d||e[30]!==p||e[31]!==N||e[32]!==y||e[33]!==I||e[34]!==C?(_=(0,a.jsx)(ce,{busy:m,canSubmit:y,error:s,onClose:d,onSubmit:p,submitLabel:I,testId:"org-team-form",title:C,children:N}),e[27]=m,e[28]=s,e[29]=d,e[30]=p,e[31]=N,e[32]=y,e[33]=I,e[34]=C,e[35]=_):_=e[35],_},"Ct"),qt=c(t=>{let e=(0,H.c)(30),{onClose:r,onDone:d,teamId:h}=t,i=oe(),o=Q(),{busy:l,error:n,run:m}=se(),[s,f]=(0,F.useState)(""),u;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==m||e[4]!==h||e[5]!==s?(u=c(()=>{m(async()=>{await i.addAuthOrgTeamMember({teamId:h,userId:s.trim()}),d(),r()})},"c"),e[0]=i,e[1]=r,e[2]=d,e[3]=m,e[4]=h,e[5]=s,e[6]=u):u=e[6];let b=u,v;e[7]!==s?(v=s.trim(),e[7]=s,e[8]=v):v=e[8];let g=v!=="",p;e[9]!==o?(p=o("Add member"),e[9]=o,e[10]=p):p=e[10];let k;e[11]!==o?(k=o("Add team member"),e[11]=o,e[12]=k):k=e[12];let y;e[13]!==o?(y=o("User id"),e[13]=o,e[14]=y):y=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=c(z=>{f(z.target.value)},"C"),e[15]=I):I=e[15];let C;e[16]!==s?(C=(0,a.jsx)(V,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:s}),e[16]=s,e[17]=C):C=e[17];let w;e[18]!==y||e[19]!==C?(w=(0,a.jsx)(G,{htmlFor:"org-team-add-member-user",label:y,children:C}),e[18]=y,e[19]=C,e[20]=w):w=e[20];let x;return e[21]!==l||e[22]!==n||e[23]!==r||e[24]!==b||e[25]!==g||e[26]!==p||e[27]!==k||e[28]!==w?(x=(0,a.jsx)(ce,{busy:l,canSubmit:g,error:n,onClose:r,onSubmit:b,submitLabel:p,testId:"org-team-add-member",title:k,children:w}),e[21]=l,e[22]=n,e[23]=r,e[24]=b,e[25]=g,e[26]=p,e[27]=k,e[28]=w,e[29]=x):x=e[29],x},"Ht"),Ft=c(t=>{let e=(0,H.c)(47),{mode:r,onClose:d,onDone:h,organizationId:i,role:o}=t,l=oe(),n=Q(),{busy:m,error:s,run:f}=se(),u;e[0]!==o?(u=o?A(o.role):"",e[0]=o,e[1]=u):u=e[1];let[b,v]=(0,F.useState)(u),g;e[2]!==r||e[3]!==o?.permission?(g=r==="edit"?Pt(o?.permission):"",e[2]=r,e[3]=o?.permission,e[4]=g):g=e[4];let[p,k]=(0,F.useState)(g),y;e[5]!==l||e[6]!==r||e[7]!==b||e[8]!==d||e[9]!==h||e[10]!==i||e[11]!==p||e[12]!==o?.id||e[13]!==f?(y=c(()=>{f(async()=>{let $=Kt(p);await(r==="create"?l.createAuthOrgRole({organizationId:i,permission:$,role:b.trim()}):l.updateAuthOrgRole({permission:$,roleId:A(o?.id)})),h(),d()})},"v"),e[5]=l,e[6]=r,e[7]=b,e[8]=d,e[9]=h,e[10]=i,e[11]=p,e[12]=o?.id,e[13]=f,e[14]=y):y=e[14];let I=y,C;e[15]!==r||e[16]!==b||e[17]!==p?(C=p.trim()!==""&&(r==="edit"||b.trim()!==""),e[15]=r,e[16]=b,e[17]=p,e[18]=C):C=e[18];let w;e[19]!==r||e[20]!==n?(w=n(r==="create"?"Create":"Save"),e[19]=r,e[20]=n,e[21]=w):w=e[21];let x;e[22]!==r||e[23]!==n?(x=n(r==="create"?"New role":"Edit role"),e[22]=r,e[23]=n,e[24]=x):x=e[24];let z;e[25]!==r||e[26]!==b||e[27]!==n?(z=r==="create"&&(0,a.jsx)(G,{htmlFor:"org-role-form-name",label:n("Role name"),children:(0,a.jsx)(V,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:c($=>{v($.target.value)},"onChange"),value:b})}),e[25]=r,e[26]=b,e[27]=n,e[28]=z):z=e[28];let N;e[29]!==n?(N=n('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=n,e[30]=N):N=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=c($=>{k($.target.value)},"O"),e[31]=_):_=e[31];let D;e[32]!==p?(D=(0,a.jsx)(wt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:_,value:p}),e[32]=p,e[33]=D):D=e[33];let O;e[34]!==D||e[35]!==N?(O=(0,a.jsx)(G,{htmlFor:"org-role-form-permission",label:N,children:D}),e[34]=D,e[35]=N,e[36]=O):O=e[36];let T;return e[37]!==m||e[38]!==s||e[39]!==d||e[40]!==I||e[41]!==O||e[42]!==C||e[43]!==w||e[44]!==x||e[45]!==z?(T=(0,a.jsxs)(ce,{busy:m,canSubmit:C,error:s,onClose:d,onSubmit:I,submitLabel:w,testId:"org-role-form",title:x,children:[z,O]}),e[37]=m,e[38]=s,e[39]=d,e[40]=I,e[41]=O,e[42]=C,e[43]=w,e[44]=x,e[45]=z,e[46]=T):T=e[46],T},"xt"),Bt=c(t=>{let e=(0,H.c)(18),{action:r,message:d,onClose:h,onDone:i,testId:o,title:l}=t,n=Q(),{busy:m,error:s,run:f}=se(),u;e[0]!==r||e[1]!==h||e[2]!==i||e[3]!==f?(u=c(()=>{f(async()=>{await r(),i(),h()})},"c"),e[0]=r,e[1]=h,e[2]=i,e[3]=f,e[4]=u):u=e[4];let b=u,v;e[5]!==n?(v=n("Delete"),e[5]=n,e[6]=v):v=e[6];let g;e[7]!==d?(g=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:d}),e[7]=d,e[8]=g):g=e[8];let p;return e[9]!==m||e[10]!==s||e[11]!==h||e[12]!==b||e[13]!==v||e[14]!==g||e[15]!==o||e[16]!==l?(p=(0,a.jsx)(ce,{busy:m,canSubmit:!0,destructive:!0,error:s,onClose:h,onSubmit:b,submitLabel:v,testId:o,title:l,children:g}),e[9]=m,e[10]=s,e[11]=h,e[12]=b,e[13]=v,e[14]=g,e[15]=o,e[16]=l,e[17]=p):p=e[17],p},"Mt"),Xe=c(t=>{let e=(0,H.c)(13),{action:r,children:d,heading:h,testId:i}=t,o;e[0]!==h?(o=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[0]=h,e[1]=o):o=e[1];let l;e[2]!==r?(l=r!==void 0&&(0,a.jsx)("div",{className:"flex items-center gap-2",children:r}),e[2]=r,e[3]=l):l=e[3];let n;e[4]!==o||e[5]!==l?(n=(0,a.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o,l]}),e[4]=o,e[5]=l,e[6]=n):n=e[6];let m;e[7]!==d?(m=(0,a.jsx)(yt,{className:"px-0",children:d}),e[7]=d,e[8]=m):m=e[8];let s;return e[9]!==n||e[10]!==m||e[11]!==i?(s=(0,a.jsxs)(vt,{className:"overflow-hidden py-0","data-testid":i,children:[n,m]}),e[9]=n,e[10]=m,e[11]=i,e[12]=s):s=e[12],s},"We"),We=c(t=>{let e=(0,H.c)(23),{columns:r,rowActions:d,rowPrefix:h,rows:i}=t,o=Q(),l;e[0]!==r?(l=r.map(Gt),e[0]=r,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("Actions"),e[2]=o,e[3]=n):n=e[3];let m;e[4]!==n?(m=(0,a.jsx)(me,{"aria-label":n}),e[4]=n,e[5]=m):m=e[5];let s;e[6]!==l||e[7]!==m?(s=(0,a.jsx)(It,{children:(0,a.jsxs)(Ve,{children:[l,m]})}),e[6]=l,e[7]=m,e[8]=s):s=e[8];let f;if(e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i){let v;e[14]!==r||e[15]!==d||e[16]!==h?(v=c((g,p)=>{let k=A(g.id),y=k===""?`index-${p.toString()}`:k;return(0,a.jsxs)(Ve,{"data-testid":`${h}-${y}`,children:[r.map(I=>(0,a.jsx)(de,{className:I.className,children:I.render(g)},I.head)),(0,a.jsx)(de,{children:(0,a.jsx)("div",{className:"flex justify-end gap-1",children:d(g)})})]},y)},"p"),e[14]=r,e[15]=d,e[16]=h,e[17]=v):v=e[17],f=i.map(v),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=f}else f=e[13];let u;e[18]!==f?(u=(0,a.jsx)(xt,{children:f}),e[18]=f,e[19]=u):u=e[19];let b;return e[20]!==s||e[21]!==u?(b=(0,a.jsxs)(Ct,{children:[s,u]}),e[20]=s,e[21]=u,e[22]=b):b=e[22],b},"Xe");function Gt(t){return(0,a.jsx)(me,{children:t.head},t.head)}c(Gt,"Zt");var Vt=c(t=>{let e=(0,H.c)(30),{actionBusy:r,onRemoveMember:d,memberColumns:h,members:i,onDialog:o}=t,l=Q(),n;e[0]!==o?(n=c(()=>{o({kind:"add-member"})},"r"),e[0]=o,e[1]=n):n=e[1];let m;e[2]!==l?(m=l("Add member"),e[2]=l,e[3]=m):m=e[3];let s;e[4]!==n||e[5]!==m?(s=(0,a.jsx)(j,{"data-testid":"org-open-add-member",onClick:n,size:"xs",type:"button",variant:"outline",children:m}),e[4]=n,e[5]=m,e[6]=s):s=e[6];let f;e[7]!==o?(f=c(()=>{o({kind:"invite-member"})},"h"),e[7]=o,e[8]=f):f=e[8];let u;e[9]!==l?(u=l("Invite member"),e[9]=l,e[10]=u):u=e[10];let b;e[11]!==f||e[12]!==u?(b=(0,a.jsx)(j,{"data-testid":"org-open-invite-member",onClick:f,size:"xs",type:"button",variant:"outline",children:u}),e[11]=f,e[12]=u,e[13]=b):b=e[13];let v;e[14]!==s||e[15]!==b?(v=(0,a.jsxs)(a.Fragment,{children:[s,b]}),e[14]=s,e[15]=b,e[16]=v):v=e[16];let g;e[17]!==l?(g=l("Members"),e[17]=l,e[18]=g):g=e[18];let p;e[19]!==r||e[20]!==h||e[21]!==i||e[22]!==o||e[23]!==d||e[24]!==l?(p=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ue,{testId:"org-members-empty",title:l("No members.")})}):(0,a.jsx)(We,{columns:h,rowActions:c(y=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j,{"data-testid":`org-member-role-${A(y.id)}`,onClick:c(()=>{o({kind:"member-role",member:y})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Change role")}),(0,a.jsx)(j,{"data-testid":`org-remove-member-${A(y.id)}`,disabled:r,onClick:c(()=>{d(A(y.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Remove")})]}),"rowActions"),rowPrefix:"org-member",rows:i}),e[19]=r,e[20]=h,e[21]=i,e[22]=o,e[23]=d,e[24]=l,e[25]=p):p=e[25];let k;return e[26]!==v||e[27]!==g||e[28]!==p?(k=(0,a.jsx)(Xe,{action:v,heading:g,testId:"org-members",children:p}),e[26]=v,e[27]=g,e[28]=p,e[29]=k):k=e[29],k},"qt"),Xt=c(t=>{let e=(0,H.c)(21),{onConfirmDeleteTeam:r,onDialog:d,onSelectTeam:h,selectedTeam:i,teamColumns:o,teams:l}=t,n=Q(),m;e[0]!==d?(m=c(()=>{d({kind:"team-create"})},"m"),e[0]=d,e[1]=m):m=e[1];let s;e[2]!==n?(s=n("New team"),e[2]=n,e[3]=s):s=e[3];let f;e[4]!==m||e[5]!==s?(f=(0,a.jsx)(j,{"data-testid":"org-open-create-team",onClick:m,size:"xs",type:"button",variant:"outline",children:s}),e[4]=m,e[5]=s,e[6]=f):f=e[6];let u;e[7]!==n?(u=n("Teams"),e[7]=n,e[8]=u):u=e[8];let b;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==n||e[14]!==o||e[15]!==l?(b=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ue,{testId:"org-teams-empty",title:n("No teams.")})}):(0,a.jsx)(We,{columns:o,rowActions:c(g=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j,{"aria-pressed":i===A(g.id),"data-testid":`org-team-select-${A(g.id)}`,onClick:c(()=>{h(A(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Members")}),(0,a.jsx)(j,{"data-testid":`org-team-rename-${A(g.id)}`,onClick:c(()=>{d({kind:"team-rename",team:g})},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Rename")}),(0,a.jsx)(j,{"data-testid":`org-team-delete-${A(g.id)}`,onClick:c(()=>{r(g)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})]}),"rowActions"),rowPrefix:"org-team",rows:l}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=n,e[14]=o,e[15]=l,e[16]=b):b=e[16];let v;return e[17]!==f||e[18]!==u||e[19]!==b?(v=(0,a.jsx)(Xe,{action:f,heading:u,testId:"org-teams",children:b}),e[17]=f,e[18]=u,e[19]=b,e[20]=v):v=e[20],v},"Kt"),Wt=c(t=>{let e=(0,H.c)(20),{actionBusy:r,onRemoveTeamMember:d,onDialog:h,selectedTeam:i,teamMemberColumns:o,teamMembers:l}=t,n=Q(),m;e[0]!==h||e[1]!==i?(m=c(()=>{h({kind:"team-add-member",teamId:i})},"m"),e[0]=h,e[1]=i,e[2]=m):m=e[2];let s;e[3]!==n?(s=n("Add member"),e[3]=n,e[4]=s):s=e[4];let f;e[5]!==m||e[6]!==s?(f=(0,a.jsx)(j,{"data-testid":"org-open-add-team-member",onClick:m,size:"xs",type:"button",variant:"outline",children:s}),e[5]=m,e[6]=s,e[7]=f):f=e[7];let u;e[8]!==n?(u=n("Team members"),e[8]=n,e[9]=u):u=e[9];let b;e[10]!==r||e[11]!==d||e[12]!==n||e[13]!==o||e[14]!==l?(b=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ue,{testId:"org-team-members-empty",title:n("No team members.")})}):(0,a.jsx)(We,{columns:o,rowActions:c(g=>(0,a.jsx)(j,{"data-testid":`org-team-remove-member-${A(g.id)}`,disabled:r,onClick:c(()=>{d(A(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Remove")}),"rowActions"),rowPrefix:"org-team-member",rows:l}),e[10]=r,e[11]=d,e[12]=n,e[13]=o,e[14]=l,e[15]=b):b=e[15];let v;return e[16]!==f||e[17]!==u||e[18]!==b?(v=(0,a.jsx)(Xe,{action:f,heading:u,testId:"org-team-members",children:b}),e[16]=f,e[17]=u,e[18]=b,e[19]=v):v=e[19],v},"Vt"),er=c(t=>{let e=(0,H.c)(19),{onConfirmDeleteRole:r,onDialog:d,roleColumns:h,roles:i}=t,o=Q(),l;e[0]!==d?(l=c(()=>{d({kind:"role-create"})},"i"),e[0]=d,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("New role"),e[2]=o,e[3]=n):n=e[3];let m;e[4]!==l||e[5]!==n?(m=(0,a.jsx)(j,{"data-testid":"org-open-create-role",onClick:l,size:"xs",type:"button",variant:"outline",children:n}),e[4]=l,e[5]=n,e[6]=m):m=e[6];let s;e[7]!==o?(s=o("Roles"),e[7]=o,e[8]=s):s=e[8];let f;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==o?(f=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ue,{testId:"org-roles-empty",title:o("No custom roles.")})}):(0,a.jsx)(We,{columns:h,rowActions:c(b=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j,{"data-testid":`org-role-edit-${A(b.id)}`,onClick:c(()=>{d({kind:"role-edit",role:b})},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Edit")}),(0,a.jsx)(j,{"data-testid":`org-role-delete-${A(b.id)}`,onClick:c(()=>{r(A(b.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Delete")})]}),"rowActions"),rowPrefix:"org-role",rows:i}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=o,e[14]=f):f=e[14];let u;return e[15]!==m||e[16]!==s||e[17]!==f?(u=(0,a.jsx)(Xe,{action:m,heading:s,testId:"org-roles",children:f}),e[15]=m,e[16]=s,e[17]=f,e[18]=u):u=e[18],u},"Wt"),Et=200,tr=c(t=>{let e=(0,H.c)(207),{organizationId:r,rolesEnabled:d,teamsEnabled:h}=t,i=oe(),o=Q(),[l,n]=(0,F.useState)(null),[m,s]=(0,F.useState)(null),[f,u]=(0,F.useState)(!1),[b,v]=(0,F.useState)(null),[g,p]=_t(r),k;e[0]!==g||e[1]!==r?(k=["lunora-auth-org-members",r,g],e[0]=g,e[1]=r,e[2]=k):k=e[2];let y;e[3]!==i||e[4]!==g||e[5]!==r?(y=c(()=>i.listAuthOrgMembers({limit:Et,offset:g,organizationId:r}),"v"),e[3]=i,e[4]=g,e[5]=r,e[6]=y):y=e[6];let I=ge(k,y),C;e[7]!==r?(C=["lunora-auth-org-invitations",r],e[7]=r,e[8]=C):C=e[8];let w;e[9]!==i||e[10]!==r?(w=c(()=>i.listAuthOrgInvitations({limit:200,organizationId:r}),"I"),e[9]=i,e[10]=r,e[11]=w):w=e[11];let x=ge(C,w),z;e[12]!==r?(z=["lunora-auth-org-teams",r],e[12]=r,e[13]=z):z=e[13];let N;e[14]!==i||e[15]!==r?(N=c(()=>i.listAuthOrgTeams({limit:200,organizationId:r}),"D"),e[14]=i,e[15]=r,e[16]=N):N=e[16];let _;e[17]!==h?(_={enabled:h},e[17]=h,e[18]=_):_=e[18];let D=ge(z,N,_),O;e[19]!==r?(O=["lunora-auth-org-roles",r],e[19]=r,e[20]=O):O=e[20];let T;e[21]!==i||e[22]!==r?(T=c(()=>i.listAuthOrgRoles({limit:200,organizationId:r}),"_"),e[21]=i,e[22]=r,e[23]=T):T=e[23];let $;e[24]!==d?($={enabled:d},e[24]=d,e[25]=$):$=e[25];let E=ge(O,T,$),Z;e[26]!==m?(Z=["lunora-auth-org-team-members",m],e[26]=m,e[27]=Z):Z=e[27];let B;e[28]!==i||e[29]!==m?(B=c(()=>i.listAuthOrgTeamMembers({limit:200,teamId:m??""}),"B"),e[28]=i,e[29]=m,e[30]=B):B=e[30];let K=m!==null,J;e[31]!==K?(J={enabled:K},e[31]=K,e[32]=J):J=e[32];let P=ge(Z,B,J),U;e[33]!==I.data?.rows?(U=I.data?.rows??[],e[33]=I.data?.rows,e[34]=U):U=e[34];let L=U,Y;e[35]!==x.data?.rows?(Y=x.data?.rows??[],e[35]=x.data?.rows,e[36]=Y):Y=e[36];let M=Y,R;e[37]!==D.data?.rows?(R=D.data?.rows??[],e[37]=D.data?.rows,e[38]=R):R=e[38];let q=R,W;e[39]!==E.data?.rows?(W=E.data?.rows??[],e[39]=E.data?.rows,e[40]=W):W=e[40];let te=W,ae;e[41]!==m||e[42]!==P?(ae=m===null?[]:P.data?.rows??[],e[41]=m,e[42]=P,e[43]=ae):ae=e[43];let re=ae,ee=I.error??x.error??D.error??E.error??P.error,le;e[44]!==x||e[45]!==I||e[46]!==d||e[47]!==E||e[48]!==m||e[49]!==P||e[50]!==h||e[51]!==D?(le=c(()=>{I.refetch(),x.refetch(),h&&D.refetch(),d&&E.refetch(),m!==null&&P.refetch()},"ie"),e[44]=x,e[45]=I,e[46]=d,e[47]=E,e[48]=m,e[49]=P,e[50]=h,e[51]=D,e[52]=le):le=e[52];let S=le;kt(S,!0);let et;e[53]===Symbol.for("react.memo_cache_sentinel")?(et=c(()=>{n(null)},"Ye"),e[53]=et):et=e[53];let ne=et,tt;e[54]!==S?(tt=c(X=>{At((async()=>{u(!0),v(null);try{await X(),S(),u(!1)}catch(mt){v(Nt(mt)),u(!1)}})())},"et"),e[54]=S,e[55]=tt):tt=e[55];let ie=tt,rt;e[56]!==i||e[57]!==o?(rt=c(X=>{let mt=A(X.id);n({action:c(async()=>{await i.removeAuthOrgTeam({teamId:mt}),s(St=>St===mt?null:St)},"action"),kind:"confirm",message:o("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:o("Delete team")})},"tt"),e[56]=i,e[57]=o,e[58]=rt):rt=e[58];let dt=rt,he;e[59]!==o?(he=o("userId"),e[59]=o,e[60]=he):he=e[60];let be;e[61]!==he?(be={head:he,render:rr},e[61]=he,e[62]=be):be=e[62];let fe;e[63]!==o?(fe=o("role"),e[63]=o,e[64]=fe):fe=e[64];let pe;e[65]!==fe?(pe={head:fe,render:or},e[65]=fe,e[66]=pe):pe=e[66];let ot;e[67]!==be||e[68]!==pe?(ot=[be,pe],e[67]=be,e[68]=pe,e[69]=ot):ot=e[69];let ct=ot,ve;e[70]!==o?(ve=o("email"),e[70]=o,e[71]=ve):ve=e[71];let ye;e[72]!==ve?(ye={head:ve,render:ar},e[72]=ve,e[73]=ye):ye=e[73];let Ce;e[74]!==o?(Ce=o("role"),e[74]=o,e[75]=Ce):Ce=e[75];let Ie;e[76]!==Ce?(Ie={head:Ce,render:lr},e[76]=Ce,e[77]=Ie):Ie=e[77];let xe;e[78]!==o?(xe=o("status"),e[78]=o,e[79]=xe):xe=e[79];let we;e[80]!==xe?(we={head:xe,render:nr},e[80]=xe,e[81]=we):we=e[81];let at;e[82]!==ye||e[83]!==Ie||e[84]!==we?(at=[ye,Ie,we],e[82]=ye,e[83]=Ie,e[84]=we,e[85]=at):at=e[85];let ut=at,ke;e[86]!==o?(ke=o("id"),e[86]=o,e[87]=ke):ke=e[87];let ze;e[88]!==ke?(ze={className:"font-mono text-xs",head:ke,render:ir},e[88]=ke,e[89]=ze):ze=e[89];let Se;e[90]!==o?(Se=o("name"),e[90]=o,e[91]=Se):Se=e[91];let Ne;e[92]!==Se?(Ne={head:Se,render:sr},e[92]=Se,e[93]=Ne):Ne=e[93];let lt;e[94]!==ze||e[95]!==Ne?(lt=[ze,Ne],e[94]=ze,e[95]=Ne,e[96]=lt):lt=e[96];let gt=lt,Ae;e[97]!==o?(Ae=o("userId"),e[97]=o,e[98]=Ae):Ae=e[98];let nt;e[99]!==Ae?(nt=[{head:Ae,render:mr}],e[99]=Ae,e[100]=nt):nt=e[100];let ht=nt,De;e[101]!==o?(De=o("role"),e[101]=o,e[102]=De):De=e[102];let Oe;e[103]!==De?(Oe={head:De,render:dr},e[103]=De,e[104]=Oe):Oe=e[104];let _e;e[105]!==o?(_e=o("Permission"),e[105]=o,e[106]=_e):_e=e[106];let Te;e[107]!==_e?(Te={className:"font-mono text-xs whitespace-pre-wrap",head:_e,render:cr},e[107]=_e,e[108]=Te):Te=e[108];let it;e[109]!==Oe||e[110]!==Te?(it=[Oe,Te],e[109]=Oe,e[110]=Te,e[111]=it):it=e[111];let bt=it,$e;e[112]!==ee?($e=ee!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:ee}),e[112]=ee,e[113]=$e):$e=e[113];let Re;e[114]!==b?(Re=b!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:b}),e[114]=b,e[115]=Re):Re=e[115];let Me;e[116]!==i||e[117]!==ie?(Me=c(X=>{ie(()=>i.removeAuthOrgMember({memberId:X}))},"$e"),e[116]=i,e[117]=ie,e[118]=Me):Me=e[118];let Fe;e[119]!==f||e[120]!==ct||e[121]!==L||e[122]!==Me?(Fe=(0,a.jsx)(Vt,{actionBusy:f,memberColumns:ct,members:L,onDialog:n,onRemoveMember:Me}),e[119]=f,e[120]=ct,e[121]=L,e[122]=Me,e[123]=Fe):Fe=e[123];let ft=I.data?.total,Ee;e[124]!==L.length||e[125]!==g||e[126]!==p||e[127]!==ft?(Ee=(0,a.jsx)(zt,{count:L.length,offset:g,onOffsetChange:p,pageSize:Et,prefix:"org-members",total:ft}),e[124]=L.length,e[125]=g,e[126]=p,e[127]=ft,e[128]=Ee):Ee=e[128];let je;e[129]!==f||e[130]!==i||e[131]!==ut||e[132]!==M||e[133]!==ie||e[134]!==o?(je=M.length>0&&(0,a.jsx)(Xe,{heading:o("Invitations"),testId:"org-invitations",children:(0,a.jsx)(We,{columns:ut,rowActions:c(X=>(0,a.jsx)(j,{"data-testid":`org-cancel-invitation-${A(X.id)}`,disabled:f,onClick:c(()=>{ie(()=>i.cancelAuthOrgInvitation({invitationId:A(X.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Cancel")}),"rowActions"),rowPrefix:"org-invitation",rows:M})}),e[129]=f,e[130]=i,e[131]=ut,e[132]=M,e[133]=ie,e[134]=o,e[135]=je):je=e[135];let Le;e[136]!==dt||e[137]!==m||e[138]!==gt||e[139]!==q||e[140]!==h?(Le=h&&(0,a.jsx)(Xt,{onConfirmDeleteTeam:dt,onDialog:n,onSelectTeam:s,selectedTeam:m,teamColumns:gt,teams:q}),e[136]=dt,e[137]=m,e[138]=gt,e[139]=q,e[140]=h,e[141]=Le):Le=e[141];let Pe;e[142]!==f||e[143]!==i||e[144]!==ie||e[145]!==m||e[146]!==ht||e[147]!==re||e[148]!==h?(Pe=h&&m!==null&&(0,a.jsx)(Wt,{actionBusy:f,onDialog:n,onRemoveTeamMember:c(X=>{ie(()=>i.removeAuthOrgTeamMember({teamMemberId:X}))},"onRemoveTeamMember"),selectedTeam:m,teamMemberColumns:ht,teamMembers:re}),e[142]=f,e[143]=i,e[144]=ie,e[145]=m,e[146]=ht,e[147]=re,e[148]=h,e[149]=Pe):Pe=e[149];let Be;e[150]!==i||e[151]!==bt||e[152]!==te||e[153]!==d||e[154]!==o?(Be=d&&(0,a.jsx)(er,{onConfirmDeleteRole:c(X=>{n({action:c(()=>i.deleteAuthOrgRole({roleId:X}),"action"),kind:"confirm",message:o("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:o("Delete role")})},"onConfirmDeleteRole"),onDialog:n,roleColumns:bt,roles:te}),e[150]=i,e[151]=bt,e[152]=te,e[153]=d,e[154]=o,e[155]=Be):Be=e[155];let Je;e[156]!==l?.kind||e[157]!==r||e[158]!==S?(Je=l?.kind==="add-member"&&(0,a.jsx)(Qt,{onClose:ne,onDone:S,organizationId:r}),e[156]=l?.kind,e[157]=r,e[158]=S,e[159]=Je):Je=e[159];let Ue;e[160]!==l?.kind||e[161]!==r||e[162]!==S?(Ue=l?.kind==="invite-member"&&(0,a.jsx)(Zt,{onClose:ne,onDone:S,organizationId:r}),e[160]=l?.kind,e[161]=r,e[162]=S,e[163]=Ue):Ue=e[163];let He;e[164]!==l||e[165]!==S?(He=l?.kind==="member-role"&&(0,a.jsx)(Yt,{member:l.member,onClose:ne,onDone:S}),e[164]=l,e[165]=S,e[166]=He):He=e[166];let Ke;e[167]!==l?.kind||e[168]!==r||e[169]!==S?(Ke=l?.kind==="team-create"&&(0,a.jsx)(Mt,{mode:"create",onClose:ne,onDone:S,organizationId:r}),e[167]=l?.kind,e[168]=r,e[169]=S,e[170]=Ke):Ke=e[170];let Qe;e[171]!==l||e[172]!==r||e[173]!==S?(Qe=l?.kind==="team-rename"&&(0,a.jsx)(Mt,{mode:"edit",onClose:ne,onDone:S,organizationId:r,team:l.team}),e[171]=l,e[172]=r,e[173]=S,e[174]=Qe):Qe=e[174];let Ze;e[175]!==l||e[176]!==S?(Ze=l?.kind==="team-add-member"&&(0,a.jsx)(qt,{onClose:ne,onDone:S,teamId:l.teamId}),e[175]=l,e[176]=S,e[177]=Ze):Ze=e[177];let Ye;e[178]!==l?.kind||e[179]!==r||e[180]!==S?(Ye=l?.kind==="role-create"&&(0,a.jsx)(Ft,{mode:"create",onClose:ne,onDone:S,organizationId:r}),e[178]=l?.kind,e[179]=r,e[180]=S,e[181]=Ye):Ye=e[181];let qe;e[182]!==l||e[183]!==r||e[184]!==S?(qe=l?.kind==="role-edit"&&(0,a.jsx)(Ft,{mode:"edit",onClose:ne,onDone:S,organizationId:r,role:l.role}),e[182]=l,e[183]=r,e[184]=S,e[185]=qe):qe=e[185];let Ge;e[186]!==l||e[187]!==S?(Ge=l?.kind==="confirm"&&(0,a.jsx)(Bt,{action:l.action,message:l.message,onClose:ne,onDone:S,testId:l.testId,title:l.title}),e[186]=l,e[187]=S,e[188]=Ge):Ge=e[188];let st;return e[189]!==$e||e[190]!==Re||e[191]!==Fe||e[192]!==Ee||e[193]!==je||e[194]!==Le||e[195]!==Pe||e[196]!==Be||e[197]!==Je||e[198]!==Ue||e[199]!==He||e[200]!==Ke||e[201]!==Qe||e[202]!==Ze||e[203]!==Ye||e[204]!==qe||e[205]!==Ge?(st=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[$e,Re,Fe,Ee,je,Le,Pe,Be,Je,Ue,He,Ke,Qe,Ze,Ye,qe,Ge]}),e[189]=$e,e[190]=Re,e[191]=Fe,e[192]=Ee,e[193]=je,e[194]=Le,e[195]=Pe,e[196]=Be,e[197]=Je,e[198]=Ue,e[199]=He,e[200]=Ke,e[201]=Qe,e[202]=Ze,e[203]=Ye,e[204]=qe,e[205]=Ge,e[206]=st):st=e[206],st},"Xt");function rr(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:A(t.userId)})}c(rr,"Yt");function or(t){return A(t.role)}c(or,"el");function ar(t){return A(t.email)}c(ar,"tl");function lr(t){return A(t.role)}c(lr,"ll");function nr(t){return A(t.status)}c(nr,"ol");function ir(t){return A(t.id)}c(ir,"il");function sr(t){return A(t.name)}c(sr,"rl");function mr(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:A(t.userId)})}c(mr,"nl");function dr(t){return A(t.role)}c(dr,"sl");function cr(t){return A(t.permission)}c(cr,"al");var jt=100,Ar=c(()=>{let t=(0,H.c)(69),e=oe(),r=Q(),{config:d,ready:h}=Tt(),i=d.capabilities.organization,[o,l]=(0,F.useState)(null),[n,m]=(0,F.useState)(null),[s,f]=(0,F.useState)(0),u;t[0]!==s?(u=["lunora-auth-orgs",s],t[0]=s,t[1]=u):u=t[1];let b;t[2]!==e||t[3]!==s?(b=c(()=>e.listAuthOrganizations({limit:jt,offset:s}),"g"),t[2]=e,t[3]=s,t[4]=b):b=t[4];let v;t[5]!==i?(v={enabled:i},t[5]=i,t[6]=v):v=t[6];let g=ge(u,b,v),p=g.data?.rows??null,k;t[7]!==g?(k=c(()=>{g.refetch()},"S"),t[7]=g,t[8]=k):k=t[8],kt(k,i);let y;t[9]===Symbol.for("react.memo_cache_sentinel")?(y=c(()=>{m(null)},"v"),t[9]=y):y=t[9];let I=y,C;t[10]!==g?(C=c(()=>{g.refetch()},"y"),t[10]=g,t[11]=C):C=t[11];let w=C,x;t[12]===Symbol.for("react.memo_cache_sentinel")?(x=c(M=>{l(M)},"x"),t[12]=x):x=t[12];let z=x;if(h&&!i){let M;t[13]!==r?(M=r("Enable the organization() plugin in your auth config to manage organizations here."),t[13]=r,t[14]=M):M=t[14];let R;t[15]!==r?(R=r("Organizations are not enabled."),t[15]=r,t[16]=R):R=t[16];let q;return t[17]!==M||t[18]!==R?(q=(0,a.jsx)(ue,{description:M,testId:"org-disabled",title:R}),t[17]=M,t[18]=R,t[19]=q):q=t[19],q}let N;t[20]!==r?(N=r("Organizations"),t[20]=r,t[21]=N):N=t[21];let _;t[22]!==N?(_=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:N}),t[22]=N,t[23]=_):_=t[23];let D;t[24]===Symbol.for("react.memo_cache_sentinel")?(D=c(()=>{m({kind:"create"})},"A"),t[24]=D):D=t[24];let O;t[25]!==r?(O=r("New organization"),t[25]=r,t[26]=O):O=t[26];let T;t[27]!==O?(T=(0,a.jsx)(j,{"data-testid":"org-new",onClick:D,size:"sm",type:"button",children:O}),t[27]=O,t[28]=T):T=t[28];let $;t[29]!==T||t[30]!==_?($=(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[_,T]}),t[29]=T,t[30]=_,t[31]=$):$=t[31];let E;t[32]!==g.error?(E=g.error!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error}),t[32]=g.error,t[33]=E):E=t[33];let Z;t[34]!==p||t[35]!==r?(Z=p!==null&&p.length===0&&(0,a.jsx)(ue,{testId:"org-empty",title:r("No organizations.")}),t[34]=p,t[35]=r,t[36]=Z):Z=t[36];let B;t[37]!==p||t[38]!==o||t[39]!==r?(B=p!==null&&p.length>0&&(0,a.jsx)(vt,{className:"overflow-hidden py-0",children:(0,a.jsx)(yt,{className:"px-0",children:(0,a.jsxs)(Ct,{"data-testid":"org-table",children:[(0,a.jsx)(It,{children:(0,a.jsxs)(Ve,{children:[(0,a.jsx)(me,{children:r("id")}),(0,a.jsx)(me,{children:r("name")}),(0,a.jsx)(me,{children:r("slug")}),(0,a.jsx)(me,{children:r("created")}),(0,a.jsx)(me,{"aria-label":r("Actions")})]})}),(0,a.jsx)(xt,{children:p.map(M=>{let R=A(M.id);return(0,a.jsxs)(Ve,{"data-testid":`org-row-${R}`,children:[(0,a.jsx)(de,{className:"font-mono text-xs",children:R}),(0,a.jsx)(de,{children:A(M.name)}),(0,a.jsx)(de,{children:A(M.slug)}),(0,a.jsx)(de,{className:"text-muted-foreground tabular-nums",children:Dt(M.createdAt)}),(0,a.jsx)(de,{children:(0,a.jsxs)("div",{className:"flex justify-end gap-1",children:[(0,a.jsx)(j,{"aria-pressed":o===R,"data-testid":`org-select-${R}`,onClick:c(()=>{z(R)},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Manage")}),(0,a.jsx)(j,{"data-testid":`org-edit-${R}`,onClick:c(()=>{m({kind:"edit",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Edit")}),(0,a.jsx)(j,{"data-testid":`org-delete-${R}`,onClick:c(()=>{m({kind:"delete",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Delete")})]})})]},R)})})]})})}),t[37]=p,t[38]=o,t[39]=r,t[40]=B):B=t[40];let K;t[41]!==s||t[42]!==p||t[43]!==g.data?.total?(K=p!==null&&(0,a.jsx)(zt,{count:p.length,offset:s,onOffsetChange:f,pageSize:jt,prefix:"org",total:g.data?.total}),t[41]=s,t[42]=p,t[43]=g.data?.total,t[44]=K):K=t[44];let J;t[45]!==d.organization||t[46]!==o?(J=o!==null&&(0,a.jsx)(tr,{organizationId:o,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams}),t[45]=d.organization,t[46]=o,t[47]=J):J=t[47];let P;t[48]!==n?.kind||t[49]!==w?(P=n?.kind==="create"&&(0,a.jsx)(Rt,{mode:"create",onClose:I,onDone:w}),t[48]=n?.kind,t[49]=w,t[50]=P):P=t[50];let U;t[51]!==n||t[52]!==w?(U=n?.kind==="edit"&&(0,a.jsx)(Rt,{mode:"edit",onClose:I,onDone:w,org:n.org}),t[51]=n,t[52]=w,t[53]=U):U=t[53];let L;t[54]!==e||t[55]!==n||t[56]!==w||t[57]!==r?(L=n?.kind==="delete"&&(0,a.jsx)(Bt,{action:c(async()=>{let M=A(n.org.id);await e.deleteAuthOrganization({organizationId:M}),l(R=>R===M?null:R)},"action"),message:r("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:I,onDone:w,testId:"org-delete",title:r("Delete organization")}),t[54]=e,t[55]=n,t[56]=w,t[57]=r,t[58]=L):L=t[58];let Y;return t[59]!==$||t[60]!==E||t[61]!==Z||t[62]!==B||t[63]!==K||t[64]!==J||t[65]!==P||t[66]!==U||t[67]!==L?(Y=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[$,E,Z,B,K,J,P,U,L]}),t[59]=$,t[60]=E,t[61]=Z,t[62]=B,t[63]=K,t[64]=J,t[65]=P,t[66]=U,t[67]=L,t[68]=Y):Y=t[68],Y},"Al");export{Ar as default};
@@ -0,0 +1 @@
1
+ import{a as Ze}from"./chunk-76GDLOCA.js";import{a as Me,b as Re}from"./chunk-Q6IT6ZD7.js";import"./chunk-MK7SA3YV.js";import"./chunk-NQZALRU3.js";import"./chunk-OPM7ESDV.js";import"./chunk-Y3AYVFTK.js";import{a as ke}from"./chunk-37WYCOQ2.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import"./chunk-AUGKHAMQ.js";import{a as Ye}from"./chunk-R6U22RSY.js";import{a as Xe}from"./chunk-YVR4SEPU.js";import{b as We}from"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import{i as Je}from"./chunk-OQ6I6OXT.js";import{i as Ae}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{a as ge}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as Ee}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as je}from"./chunk-4ZEL6BYL.js";import{l as Ue}from"./chunk-G6EOMCDE.js";import"./chunk-QAQDMS6R.js";import"./chunk-YLPATGWK.js";import{a as Qe}from"./chunk-RWVIV3U7.js";import{a as qe,b as Ge,c as Ke,d as Pe,e as Le}from"./chunk-2IKDEUCX.js";import{d as ze,f as Fe,g as $e,h as Oe,p as be}from"./chunk-HJHSQPHW.js";import{a as r,d as Be,e as nt,f as st,g as rt,i as De}from"./chunk-I26MS5PJ.js";var we=Be(st(),1);var x=Be(nt(),1);var t=Be(rt(),1);var ot=Fe(je.listTables),it=Fe(je.listTableIndexes),dt=Fe(je.readTablePage),ct=Fe(je.describeTables),mt={},He=[],ut=r(s=>{let e=(0,we.c)(74),{initialShardKey:u,initialTable:n}=s,l=Ue(),[a,m]=(0,x.useState)("graph"),{queryShardKey:c,setShardKey:d,shardKey:b}=Ye(u),[o,h]=(0,x.useState)(""),[i,y]=(0,x.useState)(null),[p,$]=(0,x.useState)(null),S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S={},e[0]=S):S=e[0];let[K,N]=(0,x.useState)(S),O;e[1]===Symbol.for("react.memo_cache_sentinel")?(O={},e[1]=O):O=e[1];let[E,P]=(0,x.useState)(O),[T,C]=(0,x.useState)(null),z;e[2]===Symbol.for("react.memo_cache_sentinel")?(z={},e[2]=z):z=e[2];let[F,fe]=(0,x.useState)(z),te;e[3]===Symbol.for("react.memo_cache_sentinel")?(te={},e[3]=te):te=e[3];let[_,j]=(0,x.useState)(te),[k,xe]=(0,x.useState)(null),[L,ce]=(0,x.useState)(null),le;e[4]===Symbol.for("react.memo_cache_sentinel")?(le={},e[4]=le):le=e[4];let[W,Ce]=(0,x.useState)(le),[X,me]=(0,x.useState)(null),ve=(0,x.useRef)(0),M;e[5]!==l?(M=r(async g=>{ve.current=ve.current+1;let v=ve.current;$(null);try{let w=await l.query(ot,{},$e(g));if(v!==ve.current)return;We(g),y(w),N({}),P({}),C(null),fe(A=>Object.fromEntries(Object.entries(A).filter(I=>{let[pe]=I;return pe!==g}))),j(A=>Object.fromEntries(Object.entries(A).filter(I=>{let[pe]=I;return pe!==g})))}catch(w){let A=w;if(v!==ve.current)return;y(null),$(Oe(A))}},"D"),e[5]=l,e[6]=M):M=e[6];let B=M,ae;e[7]!==l?(ae=r(async()=>{ce(null);try{xe(await l.listGlobalTables())}catch(g){let v=g;xe(null),ce(Oe(v))}},"se"),e[7]=l,e[8]=ae):ae=e[8];let ue=ae,D,ne;e[9]!==c||e[10]!==B||e[11]!==ue?(D=r(()=>{be(B(c)),be(ue())},"R"),ne=[B,ue,c],e[9]=c,e[10]=B,e[11]=ue,e[12]=D,e[13]=ne):(D=e[12],ne=e[13]),(0,x.useEffect)(D,ne);let R;e[14]!==l||e[15]!==K||e[16]!==T||e[17]!==c?(R=r(async g=>{if(T===g){C(null);return}C(g);let v=`${c}:${g}`;if(K[v]!==void 0)return;let[w,A]=await Promise.allSettled([l.query(dt,{limit:1,offset:0,table:g},$e(c)),l.query(it,{table:g},$e(c))]);w.status==="fulfilled"?N(I=>({...I,[v]:w.value.columns})):$(Oe(w.reason)),A.status==="fulfilled"&&P(I=>({...I,[v]:A.value.indexes}))},"K"),e[14]=l,e[15]=K,e[16]=T,e[17]=c,e[18]=R):R=e[18];let se=R,re;e[19]!==l||e[20]!==W||e[21]!==X?(re=r(async g=>{if(X===g){me(null);return}if(me(g),W[g]===void 0)try{let v=await l.readGlobalTablePage({limit:1,offset:0,table:g});Ce(w=>({...w,[g]:v.columns}))}catch(v){ce(Oe(v))}},"oe"),e[19]=l,e[20]=W,e[21]=X,e[22]=re):re=e[22];let he=re,Y=(0,x.useRef)(void 0),Z,V;e[23]!==n||e[24]!==i||e[25]!==se?(Z=r(()=>{n===void 0||i===null||Y.current===n||i.some(g=>g.name===n)&&(Y.current=n,be(se(n)))},"Q"),V=[n,i,se],e[23]=n,e[24]=i,e[25]=se,e[26]=Z,e[27]=V):(Z=e[26],V=e[27]),(0,x.useEffect)(Z,V);let oe;e[28]!==l?(oe=r(async(g,v,w)=>{let[A,I]=await Promise.all([Promise.allSettled([l.query(ct,{tables:[...v,...w]},$e(g))]),Promise.all(w.map(async Q=>{let Se=await Promise.allSettled([l.readGlobalTablePage({limit:1,offset:0,table:Q})]),Ve=Se[0].status==="fulfilled"?Se[0].value:void 0;return{columns:Ve?.columns??[],refs:Ve?.refs??{},table:Q}}))]),pe=A[0].status==="fulfilled"?A[0].value?.columnsByTable??{}:{},_e=A[0].status==="rejected",Ie=new Map(I.map(ht)),G=[...v,...w].map(Q=>{let Se=pe[Q]??[];return[Q,Se.length>0?Se:Ie.get(Q)??[]]});fe(Q=>({...Q,[g]:Object.fromEntries(G)})),j(Q=>({...Q,[g]:_e}))},"ie"),e[28]=l,e[29]=oe):oe=e[29];let U=oe,ie,J;e[30]!==L||e[31]!==k||e[32]!==U||e[33]!==c||e[34]!==F||e[35]!==i||e[36]!==a?(ie=r(()=>{a!=="graph"||i===null||k===null&&L===null||F[c]!==void 0||be(U(c,i.map(pt),(k??[]).map(gt)))},"re"),J=[a,i,k,L,c,F,U],e[30]=L,e[31]=k,e[32]=U,e[33]=c,e[34]=F,e[35]=i,e[36]=a,e[37]=ie,e[38]=J):(ie=e[37],J=e[38]),(0,x.useEffect)(ie,J);let q=F[c]??mt,H;if(e[39]!==q||e[40]!==k||e[41]!==i){let g;e[43]!==q?(g=r(I=>({columns:q[I.name]??He,name:I.name,tier:"shard"}),"h"),e[43]=q,e[44]=g):g=e[44];let v=(i??[]).map(g),w;e[45]!==q?(w=r(I=>({columns:q[I.name]??He,name:I.name,tier:"global"}),"N"),e[45]=q,e[46]=w):w=e[46];let A=(k??[]).map(w);H=[...v,...A],e[39]=q,e[40]=k,e[41]=i,e[42]=H}else H=e[42];let f=H,ee;if(e[47]!==o||e[48]!==i){let g=o.trim().toLowerCase();ee=(i??[]).filter(v=>v.name.toLowerCase().includes(g)),e[47]=o,e[48]=i,e[49]=ee}else ee=e[49];let de=ee,ye;if(e[50]!==k||e[51]!==o){let g=o.trim().toLowerCase();ye=(k??[]).filter(v=>v.name.toLowerCase().includes(g)),e[50]=k,e[51]=o,e[52]=ye}else ye=e[52];let Te=ye,Ne;return e[53]!==K||e[54]!==f||e[55]!==p||e[56]!==T||e[57]!==Te||e[58]!==de||e[59]!==W||e[60]!==L||e[61]!==X||e[62]!==k||e[63]!==E||e[64]!==B||e[65]!==d||e[66]!==_||e[67]!==b||e[68]!==o||e[69]!==i||e[70]!==se||e[71]!==he||e[72]!==a?(Ne={columns:K,diagramTables:f,error:p,expanded:T,filteredGlobalTables:Te,filteredTables:de,globalColumns:W,globalError:L,globalExpanded:X,globalTables:k,indexes:E,refresh:B,setShardKey:d,setTableFilter:h,setView:m,shardColumnsError:_,shardKey:b,tableFilter:o,tables:i,toggle:se,toggleGlobal:he,view:a},e[53]=K,e[54]=f,e[55]=p,e[56]=T,e[57]=Te,e[58]=de,e[59]=W,e[60]=L,e[61]=X,e[62]=k,e[63]=E,e[64]=B,e[65]=d,e[66]=_,e[67]=b,e[68]=o,e[69]=i,e[70]=se,e[71]=he,e[72]=a,e[73]=Ne):Ne=e[73],Ne},"mt");function ht(s){let{columns:e,refs:u,table:n}=s;return[n,e.map(l=>{let a=u[l];return a===void 0?{name:l,optional:!1,type:""}:{name:l,optional:!1,ref:a,type:"id"}})]}r(ht,"ut");function pt(s){return s.name}r(pt,"ft");function gt(s){return s.name}r(gt,"ht");var bt="/__lunora/schema-edit",ft=r(async s=>{let e=await fetch(bt,{body:JSON.stringify(s),headers:{"Content-Type":"application/json"},method:"POST"}),u=await e.json();return u.needsMigration===!0?{kind:"needs-migration",message:u.message??"This edit needs a migration."}:e.ok&&u.tables!==void 0?{diagnostics:u.diagnostics??[],kind:"ok",tables:u.tables}:{kind:"error",message:u.error??`schema edit failed (${String(e.status)})`}},"gt"),xt=r(s=>{let e=(0,we.c)(32),{hasTables:u,mode:n,onAddColumn:l,onAddIndex:a,onAddTable:m,onDestructive:c}=s,d=ze(),b=n==="addTable"?"default":"outline",o;e[0]!==d?(o=d("Add table"),e[0]=d,e[1]=o):o=e[1];let h;e[2]!==m||e[3]!==b||e[4]!==o?(h=(0,t.jsx)(ge,{"data-testid":"sc-editor-add-table",onClick:m,size:"xs",type:"button",variant:b,children:o}),e[2]=m,e[3]=b,e[4]=o,e[5]=h):h=e[5];let i=!u,y=n==="addColumn"?"default":"outline",p;e[6]!==d?(p=d("Add column"),e[6]=d,e[7]=p):p=e[7];let $;e[8]!==l||e[9]!==i||e[10]!==y||e[11]!==p?($=(0,t.jsx)(ge,{"data-testid":"sc-editor-add-column",disabled:i,onClick:l,size:"xs",type:"button",variant:y,children:p}),e[8]=l,e[9]=i,e[10]=y,e[11]=p,e[12]=$):$=e[12];let S=!u,K=n==="addIndex"?"default":"outline",N;e[13]!==d?(N=d("Add index"),e[13]=d,e[14]=N):N=e[14];let O;e[15]!==a||e[16]!==N||e[17]!==S||e[18]!==K?(O=(0,t.jsx)(ge,{"data-testid":"sc-editor-add-index",disabled:S,onClick:a,size:"xs",type:"button",variant:K,children:N}),e[15]=a,e[16]=N,e[17]=S,e[18]=K,e[19]=O):O=e[19];let E=!u,P=n==="destructive"?"default":"ghost",T;e[20]!==d?(T=d("Rename / drop / change type\u2026"),e[20]=d,e[21]=T):T=e[21];let C;e[22]!==c||e[23]!==E||e[24]!==P||e[25]!==T?(C=(0,t.jsx)(ge,{"data-testid":"sc-editor-destructive",disabled:E,onClick:c,size:"xs",type:"button",variant:P,children:T}),e[22]=c,e[23]=E,e[24]=P,e[25]=T,e[26]=C):C=e[26];let z;return e[27]!==O||e[28]!==C||e[29]!==h||e[30]!==$?(z=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[h,$,O,C]}),e[27]=O,e[28]=C,e[29]=h,e[30]=$,e[31]=z):z=e[31],z},"bt"),vt=r(s=>{let e=(0,we.c)(28),{onOpenMigrations:u,result:n}=s,l=ze();if(n===null){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(t.Fragment,{}),e[0]=o):o=e[0],o}if(n.kind==="error"){let o;return e[1]!==n.message?(o=(0,t.jsx)("p",{className:"mt-3 text-sm text-destructive","data-testid":"sc-editor-error",role:"alert",children:n.message}),e[1]=n.message,e[2]=o):o=e[2],o}if(n.kind==="needs-migration"){let o;e[3]!==n.message||e[4]!==l?(o=n.message===""?l("This edit changes stored data and must go through a migration. Review the migration before applying."):n.message,e[3]=n.message,e[4]=l,e[5]=o):o=e[5];let h;e[6]!==o?(h=(0,t.jsx)("p",{className:"text-sm text-warning",role:"alert",children:o}),e[6]=o,e[7]=h):h=e[7];let i;e[8]!==l?(i=l("Open Migrations"),e[8]=l,e[9]=i):i=e[9];let y;e[10]!==u||e[11]!==i?(y=(0,t.jsx)(ge,{className:"self-start","data-testid":"sc-editor-open-migrations",onClick:u,size:"xs",type:"button",variant:"outline",children:i}),e[10]=u,e[11]=i,e[12]=y):y=e[12];let p;return e[13]!==h||e[14]!==y?(p=(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-2","data-testid":"sc-editor-needs-migration",children:[h,y]}),e[13]=h,e[14]=y,e[15]=p):p=e[15],p}if(n.diagnostics.length===0){let o;return e[16]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(t.Fragment,{}),e[16]=o):o=e[16],o}let a;e[17]!==l?(a=l("Codegen reported diagnostics:"),e[17]=l,e[18]=a):a=e[18];let m;e[19]!==a?(m=(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:a}),e[19]=a,e[20]=m):m=e[20];let c;e[21]!==n.diagnostics?(c=n.diagnostics.map(yt),e[21]=n.diagnostics,e[22]=c):c=e[22];let d;e[23]!==c?(d=(0,t.jsx)("ul",{className:"flex flex-col gap-0.5",children:c}),e[23]=c,e[24]=d):d=e[24];let b;return e[25]!==m||e[26]!==d?(b=(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"sc-editor-diagnostics",children:[m,d]}),e[25]=m,e[26]=d,e[27]=b):b=e[27],b},"xt");function yt(s){return(0,t.jsx)("li",{className:"font-mono text-[11px] text-destructive",children:s},s)}r(yt,"vt");var Nt=[{label:"string",validator:"v.string()"},{label:"number",validator:"v.number()"},{label:"boolean",validator:"v.boolean()"},{label:"bigint",validator:"v.bigint()"},{label:"bytes",validator:"v.bytes()"},{label:"any",validator:"v.any()"}],Ct="v.string()",Tt=r(s=>s.split(",").map(e=>e.trim()).filter(e=>e!==""),"Nt"),wt=r(s=>{let e=(0,we.c)(83),{onApplied:u,tableNames:n}=s,l=ze(),a=Je(),[m,c]=(0,x.useState)(null),[d,b]=(0,x.useState)(!1),[o,h]=(0,x.useState)(null),[i,y]=(0,x.useState)(""),[p,$]=(0,x.useState)(""),[S,K]=(0,x.useState)(Ct),[N,O]=(0,x.useState)(n[0]??""),[E,P]=(0,x.useState)(""),[T,C]=(0,x.useState)(""),[z,F]=(0,x.useState)(!1),fe;e[0]===Symbol.for("react.memo_cache_sentinel")?(fe=r(()=>{c(null),y(""),$(""),P(""),C(""),F(!1)},"pe"),e[0]=fe):fe=e[0];let te=fe,_;e[1]!==u?(_=r(async G=>{b(!0),h(null);try{let Q=await ft(G);h(Q),Q.kind==="ok"&&(u(Q.tables),te())}catch(Q){let Se=Q;h({kind:"error",message:Se instanceof Error?Se.message:String(Se)})}b(!1)},"E"),e[1]=u,e[2]=_):_=e[2];let j=_,k;e[3]!==j||e[4]!==i?(k=r(()=>{be(j({kind:"addTable",table:i.trim()}))},"w"),e[3]=j,e[4]=i,e[5]=k):k=e[5];let xe=k,L;e[6]!==p||e[7]!==j||e[8]!==N||e[9]!==S?(L=r(()=>{be(j({column:p.trim(),kind:"addOptionalColumn",table:N,validator:S}))},"B"),e[6]=p,e[7]=j,e[8]=N,e[9]=S,e[10]=L):L=e[10];let ce=L,le;e[11]!==T||e[12]!==E||e[13]!==j||e[14]!==N||e[15]!==z?(le=r(()=>{be(j({fields:Tt(T),kind:"addIndex",name:E.trim(),table:N,unique:z}))},"le"),e[11]=T,e[12]=E,e[13]=j,e[14]=N,e[15]=z,e[16]=le):le=e[16];let W=le,Ce;e[17]===Symbol.for("react.memo_cache_sentinel")?(Ce=r(()=>{h(null),c("addTable")},"Ne"),e[17]=Ce):Ce=e[17];let X=Ce,me;e[18]===Symbol.for("react.memo_cache_sentinel")?(me=r(()=>{h(null),c("addColumn")},"me"),e[18]=me):me=e[18];let ve=me,M;e[19]===Symbol.for("react.memo_cache_sentinel")?(M=r(()=>{h(null),c("addIndex")},"D"),e[19]=M):M=e[19];let B=M,ae;e[20]!==l?(ae=r(()=>{c("destructive"),h({kind:"needs-migration",message:l("This edit changes stored data and must go through a migration. Review the migration before applying.")})},"se"),e[20]=l,e[21]=ae):ae=e[21];let ue=ae,D;e[22]===Symbol.for("react.memo_cache_sentinel")?(D=r(G=>{y(G.target.value)},"R"),e[22]=D):D=e[22];let ne=D,R;e[23]===Symbol.for("react.memo_cache_sentinel")?(R=r(G=>{$(G.target.value)},"K"),e[23]=R):R=e[23];let se=R,re;e[24]===Symbol.for("react.memo_cache_sentinel")?(re=r(G=>{K(G.target.value)},"oe"),e[24]=re):re=e[24];let he=re,Y;e[25]===Symbol.for("react.memo_cache_sentinel")?(Y=r(G=>{O(G.target.value)},"X"),e[25]=Y):Y=e[25];let Z=Y,V;e[26]===Symbol.for("react.memo_cache_sentinel")?(V=r(G=>{P(G.target.value)},"U"),e[26]=V):V=e[26];let oe=V,U;e[27]===Symbol.for("react.memo_cache_sentinel")?(U=r(G=>{C(G.target.value)},"V"),e[27]=U):U=e[27];let ie=U,J;e[28]===Symbol.for("react.memo_cache_sentinel")?(J=r(G=>{F(G.target.checked)},"Y"),e[28]=J):J=e[28];let q=J,H;e[29]!==a?(H=r(()=>{be(a({to:"/migrations"}))},"Z"),e[29]=a,e[30]=H):H=e[30];let f=H,ee;e[31]!==l?(ee=l("Edit schema"),e[31]=l,e[32]=ee):ee=e[32];let de;e[33]!==ee?(de=(0,t.jsx)(Ke,{children:ee}),e[33]=ee,e[34]=de):de=e[34];let ye;e[35]!==l?(ye=l("Adds a table, column, or index to lunora/schema.ts and reruns codegen."),e[35]=l,e[36]=ye):ye=e[36];let Te;e[37]!==ye?(Te=(0,t.jsx)(Pe,{children:ye}),e[37]=ye,e[38]=Te):Te=e[38];let Ne;e[39]!==de||e[40]!==Te?(Ne=(0,t.jsxs)(Ge,{children:[de,Te]}),e[39]=de,e[40]=Te,e[41]=Ne):Ne=e[41];let g=n.length>0,v;e[42]!==m||e[43]!==ue||e[44]!==g?(v=(0,t.jsx)(xt,{hasTables:g,mode:m,onAddColumn:ve,onAddIndex:B,onAddTable:X,onDestructive:ue}),e[42]=m,e[43]=ue,e[44]=g,e[45]=v):v=e[45];let w;e[46]!==d||e[47]!==m||e[48]!==xe||e[49]!==l||e[50]!==i?(w=m==="addTable"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-table-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-table-name",children:l("Table name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-table-name",id:"sc-editor-table-name",onChange:ne,value:i})]}),(0,t.jsx)(ge,{"data-testid":"sc-editor-table-apply",disabled:d||i.trim()==="",onClick:xe,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(ge,{onClick:te,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[46]=d,e[47]=m,e[48]=xe,e[49]=l,e[50]=i,e[51]=w):w=e[51];let A;e[52]!==d||e[53]!==p||e[54]!==m||e[55]!==ce||e[56]!==l||e[57]!==n||e[58]!==N||e[59]!==S?(A=m==="addColumn"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-column-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-column-table",children:l("Table name")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-table",id:"sc-editor-column-table",onChange:Z,value:N,children:n.map(St)})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-column-name",children:l("Column name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-column-name",id:"sc-editor-column-name",onChange:se,value:p})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-column-type",children:l("Column type")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-type",id:"sc-editor-column-type",onChange:he,value:S,children:Nt.map(kt)})]}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:l("Optional")}),(0,t.jsx)(ge,{"data-testid":"sc-editor-column-apply",disabled:d||p.trim()===""||N==="",onClick:ce,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(ge,{onClick:te,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[52]=d,e[53]=p,e[54]=m,e[55]=ce,e[56]=l,e[57]=n,e[58]=N,e[59]=S,e[60]=A):A=e[60];let I;e[61]!==d||e[62]!==T||e[63]!==E||e[64]!==m||e[65]!==W||e[66]!==l||e[67]!==n||e[68]!==N||e[69]!==z?(I=m==="addIndex"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-index-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-index-table",children:l("Table name")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-index-table",id:"sc-editor-index-table",onChange:Z,value:N,children:n.map(_t)})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-index-name",children:l("Index name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-index-name",id:"sc-editor-index-name",onChange:oe,value:E})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(ke,{htmlFor:"sc-editor-index-fields",children:l("Index fields (comma-separated)")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-index-fields",id:"sc-editor-index-fields",onChange:ie,value:T})]}),(0,t.jsxs)(ke,{className:"flex items-center gap-1 text-xs",htmlFor:"sc-editor-index-unique",children:[(0,t.jsx)("input",{checked:z,"data-testid":"sc-editor-index-unique",id:"sc-editor-index-unique",onChange:q,type:"checkbox"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:l("Unique")})]}),(0,t.jsx)(ge,{"data-testid":"sc-editor-index-apply",disabled:d||E.trim()===""||T.trim()==="",onClick:W,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(ge,{onClick:te,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[61]=d,e[62]=T,e[63]=E,e[64]=m,e[65]=W,e[66]=l,e[67]=n,e[68]=N,e[69]=z,e[70]=I):I=e[70];let pe;e[71]!==f||e[72]!==o?(pe=(0,t.jsx)(vt,{onOpenMigrations:f,result:o}),e[71]=f,e[72]=o,e[73]=pe):pe=e[73];let _e;e[74]!==v||e[75]!==w||e[76]!==A||e[77]!==I||e[78]!==pe?(_e=(0,t.jsxs)(Le,{children:[v,w,A,I,pe]}),e[74]=v,e[75]=w,e[76]=A,e[77]=I,e[78]=pe,e[79]=_e):_e=e[79];let Ie;return e[80]!==Ne||e[81]!==_e?(Ie=(0,t.jsxs)(qe,{"data-testid":"sc-editor",size:"sm",children:[Ne,_e]}),e[80]=Ne,e[81]=_e,e[82]=Ie):Ie=e[82],Ie},"Tt");function St(s){return(0,t.jsx)("option",{value:s,children:s},s)}r(St,"St");function kt(s){return(0,t.jsx)("option",{value:s.validator,children:s.label},s.validator)}r(kt,"wt");function _t(s){return(0,t.jsx)("option",{value:s,children:s},s)}r(_t,"_t");var et=[],It=r(s=>{let e=(0,we.c)(5),{open:u}=s,n=u&&"rotate-90",l;e[0]!==n?(l=De("size-3.5 shrink-0 text-muted-foreground transition-transform duration-150",n),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[2]=a):a=e[2];let m;return e[3]!==l?(m=(0,t.jsx)("svg",{"aria-hidden":"true",className:l,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:a}),e[3]=l,e[4]=m):m=e[4],m},"Et"),tt=r(s=>{let e=(0,we.c)(20),{children:u,expanded:n,name:l,onToggle:a,rowCount:m,rowTestId:c,toggleTestId:d}=s,b;e[0]!==n?(b=(0,t.jsx)(It,{open:n}),e[0]=n,e[1]=b):b=e[1];let o;e[2]!==l?(o=(0,t.jsx)("span",{className:"truncate font-mono text-xs text-foreground",title:l,children:l}),e[2]=l,e[3]=o):o=e[3];let h;e[4]!==m?(h=(0,t.jsxs)("span",{className:"ms-auto shrink-0 text-xs text-muted-foreground tabular-nums",children:["(",m,")"]}),e[4]=m,e[5]=h):h=e[5];let i;e[6]!==n||e[7]!==a||e[8]!==b||e[9]!==o||e[10]!==h||e[11]!==d?(i=(0,t.jsxs)("button",{"aria-expanded":n,className:"flex w-full items-center gap-2 px-3 py-2 text-start transition-colors hover:bg-muted/50 aria-expanded:bg-muted/40","data-testid":d,onClick:a,type:"button",children:[b,o," ",h]}),e[6]=n,e[7]=a,e[8]=b,e[9]=o,e[10]=h,e[11]=d,e[12]=i):i=e[12];let y;e[13]!==u||e[14]!==n?(y=n&&(0,t.jsx)("div",{className:"px-3 pb-3 ps-8",children:u}),e[13]=u,e[14]=n,e[15]=y):y=e[15];let p;return e[16]!==c||e[17]!==i||e[18]!==y?(p=(0,t.jsxs)("li",{className:"border-t border-border/60 first:border-t-0","data-testid":c,children:[i,y]}),e[16]=c,e[17]=i,e[18]=y,e[19]=p):p=e[19],p},"Je"),lt=r(s=>{let e=(0,we.c)(5),{columns:u,testId:n}=s,l;e[0]!==u?(l=u.map(zt),e[0]=u,e[1]=l):l=e[1];let a;return e[2]!==l||e[3]!==n?(a=(0,t.jsx)("ul",{className:"flex flex-wrap gap-1.5 pt-1","data-testid":n,children:l}),e[2]=l,e[3]=n,e[4]=a):a=e[4],a},"We"),At=r(s=>{let e=(0,we.c)(10),{heading:u,indexes:n,testId:l}=s,a;e[0]!==u?(a=(0,t.jsx)("p",{className:"mb-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:u}),e[0]=u,e[1]=a):a=e[1];let m;e[2]!==n?(m=n.map(Et),e[2]=n,e[3]=m):m=e[3];let c;e[4]!==m||e[5]!==l?(c=(0,t.jsx)("ul",{className:"flex flex-col gap-1","data-testid":l,children:m}),e[4]=m,e[5]=l,e[6]=c):c=e[6];let d;return e[7]!==a||e[8]!==c?(d=(0,t.jsxs)("div",{className:"pt-3",children:[a,c]}),e[7]=a,e[8]=c,e[9]=d):d=e[9],d},"It"),at=r(s=>De("border-b-2 px-3 py-2 font-mono text-[11px] tracking-widest uppercase outline-none transition-colors",s?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"Xe"),Xt=r(s=>{let e=(0,we.c)(85),{initialShardKey:u,initialTable:n,schemaEditable:l}=s,a=ze(),m;e[0]!==u||e[1]!==n?(m={initialShardKey:u,initialTable:n},e[0]=u,e[1]=n,e[2]=m):m=e[2];let{columns:c,diagramTables:d,error:b,expanded:o,filteredGlobalTables:h,filteredTables:i,globalColumns:y,globalError:p,globalExpanded:$,globalTables:S,indexes:K,refresh:N,setShardKey:O,setTableFilter:E,setView:P,shardColumnsError:T,shardKey:C,tableFilter:z,tables:F,toggle:fe,toggleGlobal:te,view:_}=ut(m),j;e[3]!==P?(j=r(()=>{P("list")},"M"),e[3]=P,e[4]=j):j=e[4];let k=j,xe;e[5]!==P?(xe=r(()=>{P("graph")},"ge"),e[5]=P,e[6]=xe):xe=e[6];let L=xe,ce;e[7]!==E?(ce=r(f=>{E(f.target.value)},"ce"),e[7]=E,e[8]=ce):ce=e[8];let le=ce,W;e[9]!==N||e[10]!==C?(W=r(f=>{be(N(C))},"J"),e[9]=N,e[10]=C,e[11]=W):W=e[11];let Ce=W,X;e[12]!==F?(X=F??[],e[12]=F,e[13]=X):X=e[13];let me;e[14]!==X?(me=X.map(Ft),e[14]=X,e[15]=me):me=e[15];let ve=me,M;e[16]!==O||e[17]!==C?(M=(0,t.jsx)(Xe,{onChange:O,testId:"sc-shard-input",value:C}),e[16]=O,e[17]=C,e[18]=M):M=e[18];let B;e[19]!==a?(B=a("Schema view"),e[19]=a,e[20]=B):B=e[20];let ae=_==="graph",ue=_==="graph",D;e[21]!==ue?(D=at(ue),e[21]=ue,e[22]=D):D=e[22];let ne;e[23]!==a?(ne=a("Graph"),e[23]=a,e[24]=ne):ne=e[24];let R;e[25]!==L||e[26]!==ae||e[27]!==D||e[28]!==ne?(R=(0,t.jsx)("button",{"aria-selected":ae,className:D,"data-testid":"sc-view-graph",onClick:L,role:"tab",type:"button",children:ne}),e[25]=L,e[26]=ae,e[27]=D,e[28]=ne,e[29]=R):R=e[29];let se=_==="list",re=_==="list",he;e[30]!==re?(he=at(re),e[30]=re,e[31]=he):he=e[31];let Y;e[32]!==a?(Y=a("Table list"),e[32]=a,e[33]=Y):Y=e[33];let Z;e[34]!==k||e[35]!==se||e[36]!==he||e[37]!==Y?(Z=(0,t.jsx)("button",{"aria-selected":se,className:he,"data-testid":"sc-view-list",onClick:k,role:"tab",type:"button",children:Y}),e[34]=k,e[35]=se,e[36]=he,e[37]=Y,e[38]=Z):Z=e[38];let V;e[39]!==R||e[40]!==Z||e[41]!==B?(V=(0,t.jsxs)("div",{"aria-label":B,className:"flex items-center gap-1","data-testid":"sc-view-toggle",role:"tablist",children:[R,Z]}),e[39]=R,e[40]=Z,e[41]=B,e[42]=V):V=e[42];let oe;e[43]!==V||e[44]!==M?(oe=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[M,V]}),e[43]=V,e[44]=M,e[45]=oe):oe=e[45];let U;e[46]!==Ce||e[47]!==l||e[48]!==ve?(U=l===!0&&(0,t.jsx)(wt,{onApplied:Ce,tableNames:ve}),e[46]=Ce,e[47]=l,e[48]=ve,e[49]=U):U=e[49];let ie;e[50]!==le||e[51]!==a||e[52]!==z||e[53]!==_?(ie=_==="list"&&(0,t.jsx)(Ae,{"aria-label":a("Filter tables"),className:"h-8 max-w-xs","data-testid":"sc-filter",onChange:le,placeholder:a("Filter tables"),value:z}),e[50]=le,e[51]=a,e[52]=z,e[53]=_,e[54]=ie):ie=e[54];let J;e[55]!==d||e[56]!==b||e[57]!==p||e[58]!==T||e[59]!==C||e[60]!==_?(J=_==="graph"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"sc-graph-view",children:[b!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:b}),p!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:p}),(0,t.jsx)(Ze,{columnsError:T[C]===!0,tables:d,testIdPrefix:"sc-graph"})]}),e[55]=d,e[56]=b,e[57]=p,e[58]=T,e[59]=C,e[60]=_,e[61]=J):J=e[61];let q;e[62]!==c||e[63]!==b||e[64]!==o||e[65]!==h||e[66]!==i||e[67]!==y||e[68]!==p||e[69]!==$||e[70]!==S||e[71]!==K||e[72]!==C||e[73]!==a||e[74]!==F||e[75]!==fe||e[76]!==te||e[77]!==_?(q=_==="list"&&(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)(qe,{"data-testid":"sc-shard-section",size:"sm",children:[(0,t.jsxs)(Ge,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(Re,{tier:"shard"}),(0,t.jsx)(Ke,{children:a("Shard tables")}),F!==null&&(0,t.jsx)(Ee,{className:"ms-auto tabular-nums",variant:"outline",children:i.length})]}),(0,t.jsx)(Pe,{children:Me.shard.hint})]}),(0,t.jsxs)(Le,{children:[b!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:b}),F!==null&&F.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-empty",children:a("No tables in this shard.")}),F!==null&&F.length>0&&i.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-no-match",children:a("No tables match your filter.")}),i.length>0&&(0,t.jsx)("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-table-list",children:i.map(f=>{let ee=`${C}:${f.name}`,de=K[ee]??[];return(0,t.jsxs)(tt,{expanded:o===f.name,name:f.name,onToggle:r(()=>{be(fe(f.name))},"onToggle"),rowCount:f.rowCount,rowTestId:`sc-table-${f.name}`,toggleTestId:`sc-toggle-${f.name}`,children:[(0,t.jsx)(lt,{columns:c[ee]??et,testId:`sc-columns-${f.name}`}),de.length>0&&(0,t.jsx)(At,{heading:a("Indexes"),indexes:de,testId:`sc-indexes-${f.name}`})]},f.name)})})]})]}),(0,t.jsxs)(qe,{"data-testid":"sc-global-section",size:"sm",children:[(0,t.jsxs)(Ge,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(Re,{tier:"global"}),(0,t.jsx)(Ke,{children:a("Global tables (D1)")}),S!==null&&(0,t.jsx)(Ee,{className:"ms-auto tabular-nums",variant:"outline",children:h.length})]}),(0,t.jsx)(Pe,{children:Me.global.hint})]}),(0,t.jsxs)(Le,{children:[p!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:p}),S!==null&&S.length===0&&(0,t.jsx)(Qe,{description:Me.global.hint,testId:"sc-global-empty",title:a("No global tables.")}),S!==null&&S.length>0&&h.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-global-no-match",children:a("No tables match your filter.")}),h.length>0&&(0,t.jsx)("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-global-table-list",children:h.map(f=>(0,t.jsx)(tt,{expanded:$===f.name,name:f.name,onToggle:r(()=>{be(te(f.name))},"onToggle"),rowCount:f.rowCount,rowTestId:`sc-global-table-${f.name}`,toggleTestId:`sc-global-toggle-${f.name}`,children:(0,t.jsx)(lt,{columns:y[f.name]??et,testId:`sc-global-columns-${f.name}`})},f.name))})]})]})]}),e[62]=c,e[63]=b,e[64]=o,e[65]=h,e[66]=i,e[67]=y,e[68]=p,e[69]=$,e[70]=S,e[71]=K,e[72]=C,e[73]=a,e[74]=F,e[75]=fe,e[76]=te,e[77]=_,e[78]=q):q=e[78];let H;return e[79]!==oe||e[80]!==U||e[81]!==ie||e[82]!==J||e[83]!==q?(H=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schema",children:[oe,U,ie,J,q]}),e[79]=oe,e[80]=U,e[81]=ie,e[82]=J,e[83]=q,e[84]=H):H=e[84],H},"Qt");function zt(s){return(0,t.jsx)("li",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:s},s)}r(zt,"kt");function Et(s){return(0,t.jsxs)("li",{className:"flex flex-wrap items-center gap-1.5 text-xs",children:[(0,t.jsx)("span",{className:"font-mono",children:s.name}),(0,t.jsx)(Ee,{variant:"outline",children:s.type}),s.unique===!0&&(0,t.jsx)(Ee,{variant:"secondary",children:"unique"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:s.fields.join(", ")})]},`${s.type}:${s.name}`)}r(Et,"At");function Ft(s){return s.name}r(Ft,"$t");export{Xt as SchemaViewer};
@@ -0,0 +1 @@
1
+ import{a as k}from"./chunk-ZKJS6EBE.js";import{i as j}from"./chunk-E4PXACVL.js";import{d as b}from"./chunk-HJHSQPHW.js";import{a as m,d as S,e as w,f as $,g as A}from"./chunk-I26MS5PJ.js";var y=S($(),1),h=S(w(),1);var a=S(A(),1);var z=m(i=>{let t=(0,y.c)(21),{id:f,onChange:g,testId:e,value:v}=i,s=b(),u=(0,h.useId)(),[d]=(0,h.useState)(F),c;t[0]!==g?(c=m(C=>{g(C.target.value)},"d"),t[0]=g,t[1]=c):c=t[1];let I=c,o;t[2]!==s?(o=s("Shard key"),t[2]=s,t[3]=o):o=t[3];let x=d.length>0?u:void 0,r;t[4]!==s?(r=s("shard key (optional)"),t[4]=s,t[5]=r):r=t[5];let l;t[6]!==f||t[7]!==I||t[8]!==o||t[9]!==x||t[10]!==r||t[11]!==e||t[12]!==v?(l=(0,a.jsx)(j,{"aria-label":o,className:"h-8 w-48","data-testid":e,id:f,list:x,onChange:I,placeholder:r,value:v}),t[6]=f,t[7]=I,t[8]=o,t[9]=x,t[10]=r,t[11]=e,t[12]=v,t[13]=l):l=t[13];let n;t[14]!==u||t[15]!==d||t[16]!==e?(n=d.length>0&&(0,a.jsx)("datalist",{"data-testid":`${e}-recents`,id:u,children:d.map(N)}),t[14]=u,t[15]=d,t[16]=e,t[17]=n):n=t[17];let p;return t[18]!==l||t[19]!==n?(p=(0,a.jsxs)(a.Fragment,{children:[l,n]}),t[18]=l,t[19]=n,t[20]=p):p=t[20],p},"A");function F(){return k()}m(F,"$");function N(i){return(0,a.jsx)("option",{"aria-label":i,value:i},i)}m(N,"w");export{z as a};
@@ -0,0 +1 @@
1
+ import{i as R}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as W}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{l as F}from"./chunk-G6EOMCDE.js";import"./chunk-QAQDMS6R.js";import"./chunk-YLPATGWK.js";import{a as Z}from"./chunk-RWVIV3U7.js";import{a as L,b as T,c as E,d as N,e as c,f as d}from"./chunk-HCTJKP5J.js";import{a as S,e as V}from"./chunk-2IKDEUCX.js";import{d as Q,h as q,o as A,p as B}from"./chunk-HJHSQPHW.js";import{a as h,d as j,e as U,f as X,g as Y}from"./chunk-I26MS5PJ.js";var D=j(X(),1);var n=j(U(),1);var e=j(Y(),1);var _=10,y=h(g=>{let r=(0,D.c)(7),{label:i,value:a}=g,l;r[0]!==i?(l=(0,e.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:i}),r[0]=i,r[1]=l):l=r[1];let x=a??"\u2014",s;r[2]!==x?(s=(0,e.jsx)("span",{className:"font-mono text-sm",children:x}),r[2]=x,r[3]=s):s=r[3];let m;return r[4]!==l||r[5]!==s?(m=(0,e.jsxs)("div",{className:"flex flex-col gap-0.5",children:[l,s]}),r[4]=l,r[5]=s,r[6]=m):m=r[6],m},"y"),de=h(({loadIndexes:g,runQuery:r}={})=>{let i=F(),a=Q(),[l,x]=(0,n.useState)(null),[s,m]=(0,n.useState)(null),[b,M]=(0,n.useState)(null),[w,G]=(0,n.useState)(""),[p,k]=(0,n.useState)(null),[$,C]=(0,n.useState)(null),[z,I]=(0,n.useState)(!1),f=(0,n.useRef)(0);(0,n.useEffect)(()=>{let t={cancelled:!1};return B((async()=>{try{let u=await(g??(()=>i.listVectorIndexes()))();t.cancelled||(x(u),m(null),M(v=>v??u[0]?.name??null))}catch(u){t.cancelled||(x(null),m(q(u)))}})()),()=>{t.cancelled=!0}},[i,g]);let o=l?.find(t=>t.name===b)??null,H=h(t=>{f.current+=1,M(t.currentTarget.dataset.index??null),k(null),C(null),I(!1)},"$"),J=h(t=>{G(t.target.value)},"A"),K=h(async()=>{let t=w.trim();if(b===null||t==="")return;f.current+=1;let u=f.current;I(!0),C(null);try{let v=await(r??(P=>i.queryVectorIndex(P)))({name:b,text:t,topK:_});if(u!==f.current)return;k(v)}catch(v){if(u!==f.current)return;k(null),C(q(v))}I(!1)},"D"),O=h(()=>{B(K())},"H");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[s!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:s}),l!==null&&l.length===0&&(0,e.jsx)(Z,{description:a("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"})}),testId:"vector-empty",title:a("No vector indexes.")}),l!==null&&l.length>0&&(0,e.jsx)(S,{className:"overflow-hidden py-0",children:(0,e.jsx)(V,{className:"px-0",children:(0,e.jsxs)(L,{"data-testid":"vector-table",children:[(0,e.jsx)(T,{children:(0,e.jsxs)(N,{children:[(0,e.jsx)(c,{children:a("name")}),(0,e.jsx)(c,{children:a("table")}),(0,e.jsx)(c,{children:a("dimensions")}),(0,e.jsx)(c,{children:a("metric")}),(0,e.jsx)(c,{children:a("vectors")})]})}),(0,e.jsx)(E,{children:l.map(t=>(0,e.jsxs)(N,{className:t.name===b?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":t.name,"data-testid":`vector-row-${t.name}`,onClick:H,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.name}),(0,e.jsx)(d,{className:"font-mono text-xs",children:t.table}),(0,e.jsx)(d,{className:"tabular-nums",children:t.dimensions??"\u2014"}),(0,e.jsx)(d,{children:t.metric??"\u2014"}),(0,e.jsx)(d,{className:"tabular-nums",children:t.vectorsCount??"\u2014"})]},t.name))})]})})}),o!==null&&(0,e.jsxs)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,e.jsx)(y,{label:a("field"),value:o.field}),(0,e.jsx)(y,{label:a("dimensions"),value:o.dimensions}),(0,e.jsx)(y,{label:a("metric"),value:o.metric}),(0,e.jsx)(y,{label:a("vectors"),value:o.vectorsCount})]}),o.metadata!==void 0&&o.metadata.length>0&&(0,e.jsxs)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[a("metadata"),": ",(0,e.jsx)("span",{className:"font-mono",children:o.metadata.join(", ")})]}),(0,e.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,e.jsx)(R,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:J,placeholder:a("Search by similarity\u2026"),value:w}),(0,e.jsx)(W,{"data-testid":"vector-search",disabled:z||w.trim()==="",onClick:O,children:a(z?"Searching\u2026":"Search")})]}),$!==null&&(0,e.jsx)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:$}),p!==null&&p.length===0&&(0,e.jsx)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:a("No matches.")}),p!==null&&p.length>0&&(0,e.jsx)(S,{className:"mt-3 overflow-hidden py-0",children:(0,e.jsx)(V,{className:"px-0",children:(0,e.jsxs)(L,{"data-testid":"vector-matches",children:[(0,e.jsx)(T,{children:(0,e.jsxs)(N,{children:[(0,e.jsx)(c,{children:a("id")}),(0,e.jsx)(c,{children:a("score")}),(0,e.jsx)(c,{children:a("metadata")})]})}),(0,e.jsx)(E,{children:p.map(t=>(0,e.jsxs)(N,{"data-testid":`vector-match-${t.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.id}),(0,e.jsx)(d,{className:"tabular-nums",children:t.score.toFixed(4)}),(0,e.jsx)(d,{className:"max-w-md truncate font-mono text-xs",children:t.metadata===void 0?"\u2014":A(t.metadata)})]},t.id))})]})})})]})]})},"de");export{de as VectorBrowser};
@@ -0,0 +1 @@
1
+ import{d as P}from"./chunk-HJHSQPHW.js";import{a as x,d as k,f as w,g as z}from"./chunk-I26MS5PJ.js";var $=k(w(),1);var n=k(z(),1);var S=[25,50,100,250],j=x(b=>{let e=(0,$.c)(18),{onChange:p,options:m,prefix:o,value:f}=b,t=P(),u;e[0]!==p?(u=x(v=>{p(Number.parseInt(v.target.value,10))},"c"),e[0]=p,e[1]=u):u=e[1];let a=u,g=`${o}-page-size`,i;e[2]!==t?(i=t("Rows per page"),e[2]=t,e[3]=i):i=e[3];let s;e[4]!==i?(s=(0,n.jsx)("span",{children:i}),e[4]=i,e[5]=s):s=e[5];let c=`${o}-page-size`,l=`${o}-page-size`,r;e[6]!==m?(r=m.map(T),e[6]=m,e[7]=r):r=e[7];let d;e[8]!==a||e[9]!==c||e[10]!==l||e[11]!==r||e[12]!==f?(d=(0,n.jsx)("select",{className:"h-6 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":c,id:l,onChange:a,value:f,children:r}),e[8]=a,e[9]=c,e[10]=l,e[11]=r,e[12]=f,e[13]=d):d=e[13];let h;return e[14]!==g||e[15]!==s||e[16]!==d?(h=(0,n.jsxs)("label",{className:"flex items-center gap-1.5",htmlFor:g,children:[s,d]}),e[14]=g,e[15]=s,e[16]=d,e[17]=h):h=e[17],h},"C"),E=x(b=>{let e=(0,$.c)(25),{onJump:p,page:m,pages:o,prefix:f}=b,t=P(),u;e[0]!==p||e[1]!==o?(u=x(y=>{let C=Number.parseInt(y,10);Number.isNaN(C)||p(Math.min(Math.max(1,C),Math.max(1,o)))},"c"),e[0]=p,e[1]=o,e[2]=u):u=e[2];let a=u,g;e[3]!==a?(g=x(y=>{y.key==="Enter"&&a(y.currentTarget.value)},"b"),e[3]=a,e[4]=g):g=e[4];let i=g,s;e[5]!==a?(s=x(y=>{a(y.currentTarget.value)},"o"),e[5]=a,e[6]=s):s=e[6];let c=s,l;e[7]!==t?(l=t("Page"),e[7]=t,e[8]=l):l=e[8];let r;e[9]!==t?(r=t("Page"),e[9]=t,e[10]=r):r=e[10];let d=`${f}-page-jump`,h=Math.max(1,o),v;e[11]!==c||e[12]!==i||e[13]!==m||e[14]!==r||e[15]!==d||e[16]!==h?(v=(0,n.jsx)("input",{"aria-label":r,className:"h-6 w-12 rounded-md border border-border bg-background px-1 text-center tabular-nums outline-none focus-visible:border-ring","data-testid":d,defaultValue:m,max:h,min:1,onBlur:c,onKeyDown:i,type:"number"},m),e[11]=c,e[12]=i,e[13]=m,e[14]=r,e[15]=d,e[16]=h,e[17]=v):v=e[17];let N;e[18]!==o||e[19]!==t?(N=t("of {pages}",{pages:o}),e[18]=o,e[19]=t,e[20]=N):N=e[20];let M;return e[21]!==l||e[22]!==v||e[23]!==N?(M=(0,n.jsxs)("span",{className:"flex items-center gap-1.5 tabular-nums",children:[l,v,N]}),e[21]=l,e[22]=v,e[23]=N,e[24]=M):M=e[24],M},"j"),I=x(({hasNext:b,hasPrevious:e,onJumpToPage:p,onNext:m,onPageSizeChange:o,onPrevious:f,pageSize:t,pageSizeOptions:u=S,prefix:a,rangeEnd:g,rangeStart:i,total:s})=>{let c=P(),l="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",r=t!==void 0&&t>0?Math.max(1,Math.ceil(s/t)):1,d=t!==void 0&&t>0?Math.floor(Math.max(0,i-1)/t)+1:1;return(0,n.jsxs)("div",{className:"flex w-full items-center justify-between gap-3 text-xs text-muted-foreground",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[t!==void 0&&o!==void 0&&(0,n.jsx)(j,{onChange:o,options:u,prefix:a,value:t}),(0,n.jsx)("span",{className:"tabular-nums","data-testid":`${a}-page-info`,children:c("{rangeStart}-{rangeEnd} of {total}",{rangeEnd:g,rangeStart:i,total:s})})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("button",{className:l,"data-testid":`${a}-prev`,disabled:!e,onClick:f,type:"button",children:c("Previous")}),t!==void 0&&p!==void 0&&(0,n.jsx)(E,{onJump:p,page:d,pages:r,prefix:a}),(0,n.jsx)("button",{className:l,"data-testid":`${a}-next`,disabled:!b,onClick:m,type:"button",children:c("Next")})]})]})},"_");function T(b){return(0,n.jsx)("option",{value:b,children:b},b)}x(T,"E");export{I as a};
@@ -0,0 +1 @@
1
+ import{b as o,c as i}from"./chunk-RGMVGZV4.js";import{a as t}from"./chunk-I26MS5PJ.js";var a="lunora-studio-recent-shards",c=10,n=t(()=>o(a,"session").filter(s=>typeof s=="string"),"o"),u=t(s=>{let r=s.trim();if(r==="")return n();let e=[r,...n().filter(l=>l!==r)].slice(0,c);return i(a,e,"session"),e},"l");export{n as a,u as b};