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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (475) hide show
  1. package/LICENSE.md +6 -0
  2. package/README.md +4 -4
  3. package/dist/index.d.mts +1618 -0
  4. package/dist/index.d.ts +1010 -809
  5. package/dist/index.mjs +1 -0
  6. package/dist/mount.d.mts +23 -0
  7. package/dist/mount.d.ts +13 -11
  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 +8 -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/storage-rules-panel.mjs +1 -0
  54. package/dist/packem_chunks/subscriptions-panel.mjs +1 -0
  55. package/dist/packem_chunks/sync-client-panel.mjs +1 -0
  56. package/dist/packem_chunks/theme-indicator.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-B_RaW7Br.mjs +2 -0
  63. package/dist/packem_shared/ApiReferencePanel-u9Rrljdf.mjs +1 -0
  64. package/dist/packem_shared/CommandPalette-5OsK8PNe.mjs +1 -0
  65. package/dist/packem_shared/ConfirmButton-CIXYF6Mg.mjs +1 -0
  66. package/dist/packem_shared/ConnectionBadge-BfcoN-VE.mjs +1 -0
  67. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-CG7Q45ZS.mjs +1 -0
  68. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs +1 -0
  69. package/dist/packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs +1 -0
  70. package/dist/packem_shared/DataBrowser-Cc1qZX-4.mjs +4 -0
  71. package/dist/packem_shared/DataFilters--ocFTVT2.mjs +1 -0
  72. package/dist/packem_shared/ErrorBoundary-BWNF98VF.mjs +1 -0
  73. package/dist/packem_shared/GlobalDataBrowser-Hq6gTlkb.mjs +1 -0
  74. package/dist/packem_shared/HomePanel-DeyYLVxc.mjs +1 -0
  75. package/dist/packem_shared/MigrationsPanel-CMZYYcQ5.mjs +1 -0
  76. package/dist/packem_shared/OpenRpcReferencePanel-E9cDfHRv.mjs +1 -0
  77. package/dist/packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.mjs +1 -0
  78. package/dist/packem_shared/ScheduledJobs-D4CUj7aX.mjs +1 -0
  79. package/dist/packem_shared/ShardInput-CoySruKZ.mjs +1 -0
  80. package/dist/packem_shared/Studio-BhTqTeGb.mjs +1 -0
  81. package/dist/packem_shared/StudioApp-B1d0beD4.mjs +1 -0
  82. package/dist/packem_shared/StudioI18nProvider-CGXCPnQn.mjs +1 -0
  83. package/dist/packem_shared/advisor-view-fNcNYW2Q.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-D425h1XO.d.mts +352 -0
  87. package/dist/packem_shared/app.d-D425h1XO.d.ts +352 -0
  88. package/dist/packem_shared/auth-pager-DW77WeZw.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-r3isM8Nq.mjs +1 -0
  98. package/dist/packem_shared/data-view-params-C-_G-biH.mjs +1 -0
  99. package/dist/packem_shared/diagram-export-panel-aBDQdX4e.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-54TiaMvZ.mjs +1 -0
  103. package/dist/packem_shared/grid-features-2c5SaBtH.mjs +6 -0
  104. package/dist/packem_shared/grid-pagination-DY2erU65.mjs +1 -0
  105. package/dist/packem_shared/home-panel-0XMGe1hP.mjs +3 -0
  106. package/dist/packem_shared/input-CXhxesPC.mjs +1 -0
  107. package/dist/packem_shared/internal-BXEjuLPN.mjs +2 -0
  108. package/dist/packem_shared/label-DKFzyHq6.mjs +1 -0
  109. package/dist/packem_shared/live-status-D1GasNsH.mjs +1 -0
  110. package/dist/packem_shared/log-fields-BolUoZ9g.mjs +1 -0
  111. package/dist/packem_shared/log-line-BWDt_F56.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-MbGZ28I0.mjs +1 -0
  116. package/dist/packem_shared/reference-view-DCEC5kjY.mjs +13 -0
  117. package/dist/packem_shared/schema-diagram-k7cFl7Wp.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-CatgdmMh.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-CA3ZKwVK.mjs +2 -0
  128. package/dist/packem_shared/table-D0SBiDu-.mjs +2 -0
  129. package/dist/packem_shared/table-list-sidebar-nA7g7uSk.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-BW9IuacC.mjs +1 -0
  133. package/dist/packem_shared/use-admin-spec-BdNLZbTO.mjs +1 -0
  134. package/dist/packem_shared/use-async-submit-2eBBD0-m.mjs +1 -0
  135. package/dist/packem_shared/use-auth-config-KO9tnI39.mjs +1 -0
  136. package/dist/packem_shared/use-mirrored-ref-CVDf2z1M.mjs +1 -0
  137. package/dist/packem_shared/use-open-trace-B_0LbTD7.mjs +1 -0
  138. package/dist/packem_shared/use-shard-key-BsP3o5wT.mjs +1 -0
  139. package/dist/packem_shared/use-sql-assistant-DXnqbBs-.mjs +1 -0
  140. package/dist/packem_shared/use-studio-client-DCA50tF2.mjs +1 -0
  141. package/dist/packem_shared/useDebounced-DVeQ5-oW.mjs +1 -0
  142. package/dist/packem_shared/utils-bhneXptQ.mjs +1 -0
  143. package/dist/packem_shared/virtual-rect-D_j7aLxX.mjs +1 -0
  144. package/dist/standalone/chunk-26OKWFLO.js +1 -0
  145. package/dist/standalone/chunk-2EL4EMYZ.js +1 -0
  146. package/dist/standalone/chunk-2O6KKVH2.js +1 -0
  147. package/dist/standalone/chunk-2WNL74MI.js +4 -0
  148. package/dist/standalone/chunk-2X6O33OX.js +1 -0
  149. package/dist/standalone/chunk-2ZO7XY3Z.js +1 -0
  150. package/dist/standalone/chunk-3GXPALXG.js +1 -0
  151. package/dist/standalone/chunk-3Y5K3IQO.js +1 -0
  152. package/dist/standalone/chunk-4C4THJUD.js +1 -0
  153. package/dist/standalone/chunk-4IEMXFUB.js +1 -0
  154. package/dist/standalone/chunk-4SQBAPY6.js +1 -0
  155. package/dist/standalone/chunk-4ZEL6BYL.js +1 -0
  156. package/dist/standalone/chunk-5DNGK3NT.js +1 -0
  157. package/dist/standalone/chunk-5J32EGHF.js +1 -0
  158. package/dist/standalone/chunk-5NZWQEEJ.js +1 -0
  159. package/dist/standalone/chunk-6I42AM75.js +1 -0
  160. package/dist/standalone/chunk-6M7FLLMT.js +1 -0
  161. package/dist/standalone/chunk-6QEXGYWH.js +1 -0
  162. package/dist/standalone/chunk-7AZYREIY.js +1 -0
  163. package/dist/standalone/chunk-7F3S5OQT.js +1 -0
  164. package/dist/standalone/chunk-7MN724WR.js +1 -0
  165. package/dist/standalone/chunk-7RGYCU6F.js +1 -0
  166. package/dist/standalone/chunk-A566HCBX.js +1 -0
  167. package/dist/standalone/chunk-AOHKAKKL.js +1 -0
  168. package/dist/standalone/chunk-AP4PC2M4.js +1 -0
  169. package/dist/standalone/chunk-B3AXFXAD.js +1 -0
  170. package/dist/standalone/chunk-B7MHW3A5.js +1 -0
  171. package/dist/standalone/chunk-BHOLL76W.js +8 -0
  172. package/dist/standalone/chunk-BTRYFPZH.js +1 -0
  173. package/dist/standalone/chunk-BVKQA5OL.js +1 -0
  174. package/dist/standalone/chunk-CGZVMM3P.js +1 -0
  175. package/dist/standalone/chunk-CIVMATZK.js +3 -0
  176. package/dist/standalone/chunk-CLINNLLE.js +1 -0
  177. package/dist/standalone/chunk-CTE6RPXC.js +1 -0
  178. package/dist/standalone/chunk-CW57Q264.js +1 -0
  179. package/dist/standalone/chunk-D7JK65OK.js +1 -0
  180. package/dist/standalone/chunk-DBVJ5VLI.js +1 -0
  181. package/dist/standalone/chunk-DS7HZKZ2.js +6 -0
  182. package/dist/standalone/chunk-DX55P3KZ.js +1 -0
  183. package/dist/standalone/chunk-E26OT26O.js +1 -0
  184. package/dist/standalone/chunk-E32FS6PE.js +5 -0
  185. package/dist/standalone/chunk-E3VSRIQU.js +1 -0
  186. package/dist/standalone/chunk-EDGOSJXL.js +1 -0
  187. package/dist/standalone/chunk-EOR73TZZ.js +1 -0
  188. package/dist/standalone/chunk-F5LTDUMB.js +1 -0
  189. package/dist/standalone/chunk-FLVDICZL.js +1 -0
  190. package/dist/standalone/chunk-FPIUVV7Q.js +1 -0
  191. package/dist/standalone/chunk-GMW2DYFU.js +1 -0
  192. package/dist/standalone/chunk-GPOSJNMV.js +14 -0
  193. package/dist/standalone/chunk-GQYA5W5T.js +1 -0
  194. package/dist/standalone/chunk-HFYFYNSX.js +1 -0
  195. package/dist/standalone/chunk-HKLF627N.js +1 -0
  196. package/dist/standalone/chunk-HKPDPKXD.js +1 -0
  197. package/dist/standalone/chunk-HLAAOW33.js +1 -0
  198. package/dist/standalone/chunk-HOPAJ5F6.js +15 -0
  199. package/dist/standalone/chunk-IBJVVHV5.js +1 -0
  200. package/dist/standalone/chunk-IH2CJZF2.js +1 -0
  201. package/dist/standalone/chunk-JAHK7RRJ.js +1 -0
  202. package/dist/standalone/chunk-JG2C7SS2.js +1 -0
  203. package/dist/standalone/chunk-JGMQQ3S7.js +1 -0
  204. package/dist/standalone/chunk-JTGGWF7R.js +1 -0
  205. package/dist/standalone/chunk-KFNDET5D.js +1 -0
  206. package/dist/standalone/chunk-KRPXOSBL.js +1 -0
  207. package/dist/standalone/chunk-KYONGQQ4.js +1 -0
  208. package/dist/standalone/chunk-LIGOLZND.js +1 -0
  209. package/dist/standalone/chunk-LKCO3E2B.js +1 -0
  210. package/dist/standalone/chunk-LOV52GLG.js +1 -0
  211. package/dist/standalone/chunk-LPINY2IJ.js +19 -0
  212. package/dist/standalone/chunk-LRXCL6IA.js +1 -0
  213. package/dist/standalone/chunk-LUHXNZI4.js +2 -0
  214. package/dist/standalone/chunk-MD67S53Z.js +1 -0
  215. package/dist/standalone/chunk-MDAXV2XH.js +4 -0
  216. package/dist/standalone/chunk-MFNO5BFR.js +8 -0
  217. package/dist/standalone/chunk-MMJTKSHL.js +1 -0
  218. package/dist/standalone/chunk-NGVP66OH.js +1 -0
  219. package/dist/standalone/chunk-NMVFSJM7.js +1 -0
  220. package/dist/standalone/chunk-NVHHB5EV.js +2 -0
  221. package/dist/standalone/chunk-O3FDK56W.js +1 -0
  222. package/dist/standalone/chunk-OECMBE6Q.js +1 -0
  223. package/dist/standalone/chunk-OSJ7HV7B.js +1 -0
  224. package/dist/standalone/chunk-OUFWXYEF.js +1 -0
  225. package/dist/standalone/chunk-OXFKZ4BM.js +1 -0
  226. package/dist/standalone/chunk-P5GAJKDW.js +1 -0
  227. package/dist/standalone/chunk-P6L6ABWO.js +1 -0
  228. package/dist/standalone/chunk-PZZWUL5U.js +1 -0
  229. package/dist/standalone/chunk-QAQVT4FS.js +1 -0
  230. package/dist/standalone/chunk-R36QXQZX.js +1 -0
  231. package/dist/standalone/chunk-R3KLR5EP.js +1 -0
  232. package/dist/standalone/chunk-RXVXXRYD.js +1 -0
  233. package/dist/standalone/chunk-S7XAAH7U.js +1 -0
  234. package/dist/standalone/chunk-SDQH4HR6.js +3 -0
  235. package/dist/standalone/chunk-SFY646MC.js +1 -0
  236. package/dist/standalone/chunk-SJLEEYCR.js +1 -0
  237. package/dist/standalone/chunk-SLIDAWNX.js +1 -0
  238. package/dist/standalone/chunk-SOO2HXV6.js +1 -0
  239. package/dist/standalone/chunk-SXD6JQXF.js +1 -0
  240. package/dist/standalone/{chunk-BJGBHGK3.js → chunk-SYGCASPT.js} +1 -1
  241. package/dist/standalone/chunk-TDVDZ7XQ.js +1 -0
  242. package/dist/standalone/chunk-TRZTGE4R.js +1 -0
  243. package/dist/standalone/chunk-TWMS2TMF.js +1 -0
  244. package/dist/standalone/chunk-U76DVXTR.js +21 -0
  245. package/dist/standalone/chunk-UTX6IBA3.js +1 -0
  246. package/dist/standalone/chunk-UYEZR3BI.js +1 -0
  247. package/dist/standalone/chunk-UZIBQZ2F.js +1 -0
  248. package/dist/standalone/chunk-VB6YJKPA.js +1 -0
  249. package/dist/standalone/chunk-VEWQWS3J.js +1 -0
  250. package/dist/standalone/chunk-W2BCSK5S.js +1 -0
  251. package/dist/standalone/chunk-W2XSKODB.js +1 -0
  252. package/dist/standalone/chunk-W7MRISE3.js +1 -0
  253. package/dist/standalone/chunk-W7Z35E2E.js +1 -0
  254. package/dist/standalone/chunk-WIET27J3.js +1 -0
  255. package/dist/standalone/chunk-WQGT24W6.js +1 -0
  256. package/dist/standalone/chunk-WS36BO4R.js +1 -0
  257. package/dist/standalone/chunk-WZTY3ZYI.js +1 -0
  258. package/dist/standalone/chunk-X5KWBDTF.js +1 -0
  259. package/dist/standalone/chunk-X74GEPSG.js +1 -0
  260. package/dist/standalone/chunk-XBZUJDHD.js +1 -0
  261. package/dist/standalone/chunk-XMEVNOCA.js +1 -0
  262. package/dist/standalone/chunk-XWEDIIIT.js +1 -0
  263. package/dist/standalone/chunk-XYR5NST4.js +1 -0
  264. package/dist/standalone/chunk-YHTHRYP5.js +1 -0
  265. package/dist/standalone/chunk-YJ2WHOGO.js +1 -0
  266. package/dist/standalone/chunk-YJWR6ZWC.js +1 -0
  267. package/dist/standalone/chunk-Z5EV64KS.js +1 -0
  268. package/dist/standalone/chunk-ZBFWT34B.js +59 -0
  269. package/dist/standalone/chunk-ZBON5T5A.js +1 -0
  270. package/dist/standalone/chunk-ZGSL4DPP.js +1 -0
  271. package/dist/standalone/chunk-ZMQ6PKLN.js +1 -0
  272. package/dist/standalone/chunk-ZTOREMGH.js +1 -0
  273. package/dist/standalone/chunk-ZTOXQK4V.js +1 -0
  274. package/dist/standalone/chunk-ZWDORIZY.js +1 -0
  275. package/dist/standalone/chunk-ZZAJHNZ6.js +1 -0
  276. package/dist/standalone/studio.js +9 -214
  277. package/dist/styles.css +2 -2
  278. package/package.json +26 -22
  279. package/dist/index.js +0 -41
  280. package/dist/mount.js +0 -27
  281. package/dist/packem_chunks/ApiTab.js +0 -251
  282. package/dist/packem_chunks/AuditPanel.js +0 -200
  283. package/dist/packem_chunks/ExportImportPanel.js +0 -198
  284. package/dist/packem_chunks/FileBrowser.js +0 -2932
  285. package/dist/packem_chunks/FunctionRunner.js +0 -343
  286. package/dist/packem_chunks/FunctionStatsPanel.js +0 -377
  287. package/dist/packem_chunks/HealthPanel.js +0 -648
  288. package/dist/packem_chunks/InsightsPanel.js +0 -462
  289. package/dist/packem_chunks/LogsPanel.js +0 -827
  290. package/dist/packem_chunks/MailPanel.js +0 -353
  291. package/dist/packem_chunks/MetricsPanel.js +0 -1344
  292. package/dist/packem_chunks/MigrationsPanel.js +0 -239
  293. package/dist/packem_chunks/PitrPanel.js +0 -252
  294. package/dist/packem_chunks/SchemaViewer.js +0 -2513
  295. package/dist/packem_chunks/SecurityAdvisorPanel.js +0 -95
  296. package/dist/packem_chunks/SettingsPanel.js +0 -391
  297. package/dist/packem_chunks/SqlEditorPanel.js +0 -2323
  298. package/dist/packem_chunks/TableEditor.js +0 -313
  299. package/dist/packem_chunks/analytics-panel.js +0 -261
  300. package/dist/packem_chunks/auth-config-panel.js +0 -179
  301. package/dist/packem_chunks/auth-sessions-panel.js +0 -175
  302. package/dist/packem_chunks/containers-panel.js +0 -247
  303. package/dist/packem_chunks/dashboards-panel.js +0 -780
  304. package/dist/packem_chunks/fanout-panel.js +0 -482
  305. package/dist/packem_chunks/flags-panel.js +0 -176
  306. package/dist/packem_chunks/kv-browser.js +0 -1896
  307. package/dist/packem_chunks/log-drains-panel.js +0 -273
  308. package/dist/packem_chunks/organizations-panel.js +0 -670
  309. package/dist/packem_chunks/payments-panel.js +0 -186
  310. package/dist/packem_chunks/permissions-panel.js +0 -805
  311. package/dist/packem_chunks/queues-panel.js +0 -1052
  312. package/dist/packem_chunks/rls-panel.js +0 -315
  313. package/dist/packem_chunks/schedule-panel.js +0 -831
  314. package/dist/packem_chunks/sparkline.js +0 -79
  315. package/dist/packem_chunks/storage-rules-panel.js +0 -140
  316. package/dist/packem_chunks/subscriptions-panel.js +0 -238
  317. package/dist/packem_chunks/users-panel.js +0 -1265
  318. package/dist/packem_chunks/vector-browser.js +0 -281
  319. package/dist/packem_chunks/workflows-panel.js +0 -562
  320. package/dist/packem_shared/ADMIN_FUNCTIONS-BHHJi3Gb.js +0 -52
  321. package/dist/packem_shared/ApiDocsPanel-D4CJf2ad.js +0 -842
  322. package/dist/packem_shared/ApiReferencePanel-Co_wpRF2.js +0 -230
  323. package/dist/packem_shared/CommandPalette-BUPpbpMc.js +0 -373
  324. package/dist/packem_shared/ConfirmButton-C2eVi2Qv.js +0 -59
  325. package/dist/packem_shared/ConnectionBadge-B2DDM2Tn.js +0 -111
  326. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +0 -50
  327. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +0 -89
  328. package/dist/packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js +0 -27
  329. package/dist/packem_shared/DataBrowser-BeVNxSVm.js +0 -4493
  330. package/dist/packem_shared/DataFilters-FNquMaiu.js +0 -249
  331. package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +0 -66
  332. package/dist/packem_shared/GlobalDataBrowser-ErfvIs1S.js +0 -289
  333. package/dist/packem_shared/HomePanel-D9MQk8I7.js +0 -14
  334. package/dist/packem_shared/OpenRpcReferencePanel-DLWzrIx9.js +0 -192
  335. package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +0 -3
  336. package/dist/packem_shared/ScheduledJobs-ClaNpZsg.js +0 -262
  337. package/dist/packem_shared/ShardInput-gx_DZXXn.js +0 -107
  338. package/dist/packem_shared/Studio-C48P1K5W.js +0 -16
  339. package/dist/packem_shared/StudioApp-Cqh-SYm2.js +0 -657
  340. package/dist/packem_shared/StudioI18nProvider-B-tDCZIi.js +0 -48
  341. package/dist/packem_shared/advisor-view-D3-U4kRR.js +0 -159
  342. package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +0 -108
  343. package/dist/packem_shared/alert-CdAET2K_.js +0 -68
  344. package/dist/packem_shared/app.d-CNLRTrWw.d.ts +0 -300
  345. package/dist/packem_shared/badge-B2PKA1-5.js +0 -49
  346. package/dist/packem_shared/bar-chart-DSwcWIRy.js +0 -3246
  347. package/dist/packem_shared/browser-storage-tLOxkIHd.js +0 -185
  348. package/dist/packem_shared/button-BhsN2uZH.js +0 -49
  349. package/dist/packem_shared/card-DURq3ElK.js +0 -175
  350. package/dist/packem_shared/cf-links-BZfRdxSE.js +0 -8
  351. package/dist/packem_shared/checkbox-UNkzAxl-.js +0 -63
  352. package/dist/packem_shared/data-grid-Jz8FqQ2C.js +0 -183
  353. package/dist/packem_shared/data-view-params-Cd6yRVbv.js +0 -96
  354. package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +0 -280
  355. package/dist/packem_shared/empty-state-DY_oe0k6.js +0 -98
  356. package/dist/packem_shared/error-alert-BBT6D22d.js +0 -114
  357. package/dist/packem_shared/grid-features-CUr8Z1_O.js +0 -745
  358. package/dist/packem_shared/home-panel-CoGxi-oj.js +0 -1639
  359. package/dist/packem_shared/input-XH4r1Pt1.js +0 -53
  360. package/dist/packem_shared/internal-DTsYVn-g.js +0 -97
  361. package/dist/packem_shared/label-D8ykjn5J.js +0 -46
  362. package/dist/packem_shared/live-status-FZ0psC1z.js +0 -44
  363. package/dist/packem_shared/modal-shell-hyaJvIJ6.js +0 -100
  364. package/dist/packem_shared/reference-view-CSKyUyPl.js +0 -2141
  365. package/dist/packem_shared/scroll-area-DLhcy-ml.js +0 -93
  366. package/dist/packem_shared/select-UkNYCT3s.js +0 -273
  367. package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
  368. package/dist/packem_shared/skeleton-CGhL0p20.js +0 -45
  369. package/dist/packem_shared/sparkline-BnA1kC9X.js +0 -93
  370. package/dist/packem_shared/storage-tier-CL98eOvn.js +0 -85
  371. package/dist/packem_shared/studio-CPHA_-3I.js +0 -4015
  372. package/dist/packem_shared/table-DsCa9Qp9.js +0 -246
  373. package/dist/packem_shared/table-list-sidebar-B5psdSV1.js +0 -832
  374. package/dist/packem_shared/textarea-D3gaCU_-.js +0 -46
  375. package/dist/packem_shared/use-admin-query-BHPKmPuj.js +0 -106
  376. package/dist/packem_shared/use-auth-capabilities-C-VH0oJJ.js +0 -32
  377. package/dist/packem_shared/useDebounced-Dxncpg6z.js +0 -32
  378. package/dist/packem_shared/utils-B05Dmz_H.js +0 -8
  379. package/dist/packem_shared/virtual-rect-CVMUskSm.js +0 -10
  380. package/dist/standalone/chunk-25VHPD2I.js +0 -1
  381. package/dist/standalone/chunk-2GGMGPEP.js +0 -1
  382. package/dist/standalone/chunk-2K47A3P6.js +0 -1
  383. package/dist/standalone/chunk-2NGUNNGW.js +0 -1
  384. package/dist/standalone/chunk-3CJW6NWG.js +0 -4
  385. package/dist/standalone/chunk-3OA7PECS.js +0 -6
  386. package/dist/standalone/chunk-46K3NKPA.js +0 -1
  387. package/dist/standalone/chunk-474C2O7W.js +0 -1
  388. package/dist/standalone/chunk-4H2OJBXO.js +0 -1
  389. package/dist/standalone/chunk-4QHKBC77.js +0 -1
  390. package/dist/standalone/chunk-55YA7ZZI.js +0 -76
  391. package/dist/standalone/chunk-5OH3VPZF.js +0 -1
  392. package/dist/standalone/chunk-5OIBXYZM.js +0 -1
  393. package/dist/standalone/chunk-6GFEVKJP.js +0 -1
  394. package/dist/standalone/chunk-6UGM5IHN.js +0 -4
  395. package/dist/standalone/chunk-6WRZP62V.js +0 -1
  396. package/dist/standalone/chunk-764T6X6X.js +0 -1
  397. package/dist/standalone/chunk-7TJJXVSE.js +0 -1
  398. package/dist/standalone/chunk-7VF3IAAW.js +0 -2
  399. package/dist/standalone/chunk-7WNJ4Q7Z.js +0 -8
  400. package/dist/standalone/chunk-AHILM3ZP.js +0 -1
  401. package/dist/standalone/chunk-AJIUI7DD.js +0 -1
  402. package/dist/standalone/chunk-BACPICH6.js +0 -1
  403. package/dist/standalone/chunk-BI35RXKQ.js +0 -1
  404. package/dist/standalone/chunk-BOXSWNXZ.js +0 -1
  405. package/dist/standalone/chunk-BQUQS7QN.js +0 -1
  406. package/dist/standalone/chunk-CKSHCYGC.js +0 -2
  407. package/dist/standalone/chunk-DORBUITF.js +0 -1
  408. package/dist/standalone/chunk-DVC6YWVP.js +0 -1
  409. package/dist/standalone/chunk-DVKPRFIJ.js +0 -1
  410. package/dist/standalone/chunk-DWDILV2E.js +0 -1
  411. package/dist/standalone/chunk-DWTBY343.js +0 -1
  412. package/dist/standalone/chunk-EIQW6ACH.js +0 -1
  413. package/dist/standalone/chunk-EUIHTPKI.js +0 -1
  414. package/dist/standalone/chunk-FCSPAJW4.js +0 -1
  415. package/dist/standalone/chunk-FKO3HO6I.js +0 -4
  416. package/dist/standalone/chunk-GMSGZDDH.js +0 -13
  417. package/dist/standalone/chunk-GTM65MVX.js +0 -1
  418. package/dist/standalone/chunk-HV7G6DFP.js +0 -5
  419. package/dist/standalone/chunk-ILCTSAOB.js +0 -1
  420. package/dist/standalone/chunk-IODYGARQ.js +0 -1
  421. package/dist/standalone/chunk-J6J54MBP.js +0 -1
  422. package/dist/standalone/chunk-JE2YOAB7.js +0 -4
  423. package/dist/standalone/chunk-JFSZIUZT.js +0 -4
  424. package/dist/standalone/chunk-JSEXCW5Q.js +0 -1
  425. package/dist/standalone/chunk-K3GNLVYK.js +0 -1
  426. package/dist/standalone/chunk-KEGAWN6Y.js +0 -1
  427. package/dist/standalone/chunk-KZ6INM5M.js +0 -1
  428. package/dist/standalone/chunk-LD2R263D.js +0 -1
  429. package/dist/standalone/chunk-LI43EKM6.js +0 -1
  430. package/dist/standalone/chunk-M55U7NHO.js +0 -1
  431. package/dist/standalone/chunk-MPTM7ZU3.js +0 -3
  432. package/dist/standalone/chunk-MPYFGAOW.js +0 -1
  433. package/dist/standalone/chunk-NJFMWO6P.js +0 -1
  434. package/dist/standalone/chunk-O3NAGRTR.js +0 -1
  435. package/dist/standalone/chunk-O77VNUFD.js +0 -1
  436. package/dist/standalone/chunk-OCHNCAXJ.js +0 -1
  437. package/dist/standalone/chunk-PACH5AHG.js +0 -1
  438. package/dist/standalone/chunk-PN5NCZDX.js +0 -1
  439. package/dist/standalone/chunk-PVZI3CXP.js +0 -19
  440. package/dist/standalone/chunk-PZ7HD5T2.js +0 -1
  441. package/dist/standalone/chunk-QAFAJBAW.js +0 -1
  442. package/dist/standalone/chunk-QBAT52GB.js +0 -1
  443. package/dist/standalone/chunk-QLM6FYZW.js +0 -2
  444. package/dist/standalone/chunk-RRAFQ5G2.js +0 -1
  445. package/dist/standalone/chunk-RRCPZMC2.js +0 -22
  446. package/dist/standalone/chunk-RSEEHNFI.js +0 -1
  447. package/dist/standalone/chunk-SEU5V7I6.js +0 -1
  448. package/dist/standalone/chunk-SLKF2L74.js +0 -1
  449. package/dist/standalone/chunk-SVR644RF.js +0 -1
  450. package/dist/standalone/chunk-TAD43CG5.js +0 -1
  451. package/dist/standalone/chunk-TBMYIZIO.js +0 -1
  452. package/dist/standalone/chunk-TDL7NEWA.js +0 -1
  453. package/dist/standalone/chunk-TO4JQX7W.js +0 -1
  454. package/dist/standalone/chunk-TQ36RWOP.js +0 -1
  455. package/dist/standalone/chunk-U4OAQPBT.js +0 -1
  456. package/dist/standalone/chunk-UII66UVF.js +0 -1
  457. package/dist/standalone/chunk-UK64ZSUW.js +0 -1
  458. package/dist/standalone/chunk-VLXV72QE.js +0 -1
  459. package/dist/standalone/chunk-VSHUSN6T.js +0 -1
  460. package/dist/standalone/chunk-VTGBPW24.js +0 -1
  461. package/dist/standalone/chunk-WXPWVBIY.js +0 -1
  462. package/dist/standalone/chunk-X6F22DBL.js +0 -1
  463. package/dist/standalone/chunk-X7MMBSNW.js +0 -1
  464. package/dist/standalone/chunk-XGMIDFUK.js +0 -1
  465. package/dist/standalone/chunk-XNJNSCLM.js +0 -1
  466. package/dist/standalone/chunk-XUGSA2NG.js +0 -1
  467. package/dist/standalone/chunk-XZE2RNDA.js +0 -1
  468. package/dist/standalone/chunk-Y2ZPNDL7.js +0 -4
  469. package/dist/standalone/chunk-YAECF5LW.js +0 -1
  470. package/dist/standalone/chunk-YEVCU7TB.js +0 -13
  471. package/dist/standalone/chunk-YV43BOP7.js +0 -1
  472. package/dist/standalone/chunk-ZHVTQ37P.js +0 -1
  473. package/dist/standalone/chunk-ZPP2KOR4.js +0 -1
  474. package/dist/standalone/chunk-ZPUO7FNI.js +0 -1
  475. package/dist/standalone/chunk-ZU4DZ6NK.js +0 -1
@@ -0,0 +1,15 @@
1
+ import{a as Fe,b as Ke}from"./chunk-FPIUVV7Q.js";import"./chunk-ZBFWT34B.js";import{a as We}from"./chunk-BTRYFPZH.js";import{d as He}from"./chunk-DS7HZKZ2.js";import"./chunk-SYGCASPT.js";import"./chunk-CTE6RPXC.js";import"./chunk-LIGOLZND.js";import"./chunk-3GXPALXG.js";import"./chunk-NMVFSJM7.js";import"./chunk-AP4PC2M4.js";import"./chunk-KRPXOSBL.js";import"./chunk-W2BCSK5S.js";import{a as ze}from"./chunk-6QEXGYWH.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import"./chunk-ZGSL4DPP.js";import"./chunk-ZWDORIZY.js";import{a as Pe}from"./chunk-KYONGQQ4.js";import{b as Oe}from"./chunk-SLIDAWNX.js";import{c as $e,d as pe,e as ve,f as ye,g as Ee}from"./chunk-6M7FLLMT.js";import"./chunk-ZTOREMGH.js";import{i as qe}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import{a as je}from"./chunk-OSJ7HV7B.js";import{a as he}from"./chunk-4ZEL6BYL.js";import"./chunk-YJ2WHOGO.js";import{p as xe}from"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import"./chunk-CW57Q264.js";import{b as ie,f as se,h as me,i as fe,j as Ae,s as ae}from"./chunk-LPINY2IJ.js";import{a as i,d as ke,e as ct,f as dt,g as ut}from"./chunk-OXFKZ4BM.js";var X=ke(dt(),1),j=ke(ct(),1);var u=ke(ut(),1);var be=class{static{i(this,"Diff")}diff(e,n,t={}){let o;typeof t=="function"?(o=t,t={}):"callback"in t&&(o=t.callback);let r=this.castInput(e,t),l=this.castInput(n,t),d=this.removeEmpty(this.tokenize(r,t)),a=this.removeEmpty(this.tokenize(l,t));return this.diffWithOptionsObj(d,a,t,o)}diffWithOptionsObj(e,n,t,o){var r;let l=i(h=>{if(h=this.postProcess(h,t),o){setTimeout(function(){o(h)},0);return}else return h},"done"),d=n.length,a=e.length,c=1,m=d+a;t.maxEditLength!=null&&(m=Math.min(m,t.maxEditLength));let p=(r=t.timeout)!==null&&r!==void 0?r:1/0,f=Date.now()+p,v=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(v[0],n,e,0,t);if(v[0].oldPos+1>=a&&g+1>=d)return l(this.buildValues(v[0].lastComponent,n,e));let E=-1/0,x=1/0,y=i(()=>{for(let h=Math.max(E,-c);h<=Math.min(x,c);h+=2){let S,w=v[h-1],C=v[h+1];w&&(v[h-1]=void 0);let b=!1;if(C){let N=C.oldPos-h;b=C&&0<=N&&N<d}let k=w&&w.oldPos+1<a;if(!b&&!k){v[h]=void 0;continue}if(!k||b&&w.oldPos<C.oldPos?S=this.addToPath(C,!0,!1,0,t):S=this.addToPath(w,!1,!0,1,t),g=this.extractCommon(S,n,e,h,t),S.oldPos+1>=a&&g+1>=d)return l(this.buildValues(S.lastComponent,n,e))||!0;v[h]=S,S.oldPos+1>=a&&(x=Math.min(x,h-1)),g+1>=d&&(E=Math.max(E,h+1))}c++},"execEditLength");if(o)i(function h(){setTimeout(function(){if(c>m||Date.now()>f)return o(void 0);y()||h()},0)},"exec")();else for(;c<=m&&Date.now()<=f;){let h=y();if(h)return h}}addToPath(e,n,t,o,r){let l=e.lastComponent;return l&&!r.oneChangePerToken&&l.added===n&&l.removed===t?{oldPos:e.oldPos+o,lastComponent:{count:l.count+1,added:n,removed:t,previousComponent:l.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:n,removed:t,previousComponent:l}}}extractCommon(e,n,t,o,r){let l=n.length,d=t.length,a=e.oldPos,c=a-o,m=0;for(;c+1<l&&a+1<d&&this.equals(t[a+1],n[c+1],r);)c++,a++,m++,r.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return m&&!r.oneChangePerToken&&(e.lastComponent={count:m,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,c}equals(e,n,t){return t.comparator?t.comparator(e,n):e===n||!!t.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){let n=[];for(let t=0;t<e.length;t++)e[t]&&n.push(e[t]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,t){let o=[],r;for(;e;)o.push(e),r=e.previousComponent,delete e.previousComponent,e=r;o.reverse();let l=o.length,d=0,a=0,c=0;for(;d<l;d++){let m=o[d];if(m.removed)m.value=this.join(t.slice(c,c+m.count)),c+=m.count;else{if(!m.added&&this.useLongestToken){let p=n.slice(a,a+m.count);p=p.map(function(f,v){let g=t[c+v];return g.length>f.length?g:f}),m.value=this.join(p)}else m.value=this.join(n.slice(a,a+m.count));a+=m.count,m.added||(c+=m.count)}}return o}};var Te=class extends be{static{i(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=mt}equals(e,n,t){return t.ignoreWhitespace?((!t.newlineIsToken||!e.includes(`
2
+ `))&&(e=e.trim()),(!t.newlineIsToken||!n.includes(`
3
+ `))&&(n=n.trim())):t.ignoreNewlineAtEof&&!t.newlineIsToken&&(e.endsWith(`
4
+ `)&&(e=e.slice(0,-1)),n.endsWith(`
5
+ `)&&(n=n.slice(0,-1))),super.equals(e,n,t)}},Be=new Te;function Ie(s,e,n){return Be.diff(s,e,n)}i(Ie,"diffLines");function mt(s,e){e.stripTrailingCr&&(s=s.replace(/\r\n/g,`
6
+ `));let n=[],t=s.split(/(\n|\r\n)/);t[t.length-1]||t.pop();for(let o=0;o<t.length;o++){let r=t[o];o%2&&!e.newlineIsToken?n[n.length-1]+=r:n.push(r)}return n}i(mt,"tokenize");var ft="x",Qe=" ",ht={'"':'"',"'":"'","[":"]","`":"`"},Ue=i((s,e)=>{let n=e+2;for(;n<s.length&&s[n]!==`
7
+ `;)n+=1;return n},"He"),Xe=i((s,e)=>{let n=s.indexOf("*/",e+2);return n===-1?-1:n+2},"Fe"),Ze=i(s=>{let e=s.split(""),n=0;for(;n<s.length;){let t=s[n]??"",o=ht[t];if(t==="-"&&s[n+1]==="-"){let r=Ue(s,n);e.fill(Qe,n,r),n=r}else if(t==="/"&&s[n+1]==="*"){let r=Xe(s,n);if(r===-1)return;e.fill(Qe,n,r),n=r}else if(o!==void 0){let r=n+1;for(;r<s.length;)if(s[r]!==o)r+=1;else if(o!=="]"&&s[r+1]===o)r+=2;else break;if(r>=s.length)return;e.fill(ft,n,r+1),n=r+1}else n+=1}for(let t=0;t<s.length;t+=1)s[t]===`
8
+ `&&(e[t]=`
9
+ `);return e.join("")},"We"),pt=/^(?:explain\s+(?:query\s+plan\s+)?)?(?:select|with)\b/iu,bt=/\b(?:alter|attach|create|delete|detach|drop|insert|pragma|reindex|truncate|update|vacuum)\b|\breplace\b(?!\s*\()/iu,gt=/^\w+/u,xt=/;\s*$/u,vt=/\s/u,et=i(s=>{let e=0;for(;e<s.length;){let n=s[e];if(n!==void 0&&vt.test(n))e+=1;else if(n==="-"&&s[e+1]==="-")e=Ue(s,e);else if(n==="/"&&s[e+1]==="*"){let t=Xe(s,e);if(t===-1)break;e=t}else break}return e},"Ke"),yt=i(s=>{let e=et(s),n=s.slice(e).trimEnd();if(n==="")return{code:"SQL_EMPTY",message:"the query is empty"};let t=(Ze(n)??n).replace(xt,""),o=n.slice(0,t.length),r=t.indexOf(";");if(r!==-1)return{code:"SQL_MULTIPLE_STATEMENTS",length:1,message:"only a single statement may be run",offset:e+r};let l="the SQL editor is read-only \u2014 only SELECT / WITH / EXPLAIN queries are allowed";if(!pt.test(o))return{code:"SQL_NOT_READONLY",length:gt.exec(o)?.[0].length??1,message:l,offset:e};let d=bt.exec(o);if(d!==null)return{code:"SQL_NOT_READONLY",length:d[0].length,message:`${l} (\`${d[0].toUpperCase()}\` is not allowed)`,offset:e+d.index}},"xt"),wt=/^explain\b/iu,St=i(s=>wt.test(s.slice(et(s)))?s:`EXPLAIN QUERY PLAN ${s}`,"yt"),_e=i((s,e)=>{let n=s.trim();if(n==="")return[];let t=e+s.indexOf(n),o=yt(n);return o?.code==="SQL_EMPTY"?[]:[o===void 0?{offset:t,sql:n}:{offset:t,rejection:o,sql:n}]},"ke"),tt=i(s=>{let e=Ze(s);if(e===void 0)return _e(s,0);let n=[],t=0;for(let o=0;o<=e.length;o+=1)o!==e.length&&e[o]!==";"||(n.push(..._e(s.slice(t,o),t)),t=o+1);return n},"ze"),Ct=["ORDER BY","GROUP BY","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN","EXPLAIN QUERY PLAN","SELECT","DISTINCT","FROM","WHERE","HAVING","LIMIT","OFFSET","JOIN","ON","AND","OR","AS","ASC","DESC","WITH","UNION","EXPLAIN"],Nt=["FROM","WHERE","ORDER BY","GROUP BY","HAVING","LIMIT","OFFSET","UNION","JOIN","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN"],Ne=String.fromCodePoint(0),kt=new RegExp(`${Ne}${String.raw`(\d+)`}${Ne}`,"gu"),qt=Ct.map(s=>({pattern:new RegExp(String.raw`\b${s.replaceAll(" ",String.raw`\s+`)}\b`,"giu"),replacement:s})),Et=Nt.map(s=>({pattern:new RegExp(String.raw`\s+${s.replaceAll(" ",String.raw`\s+`)}\b`,"gu"),replacement:`
10
+ ${s}`})),Tt=i(s=>{let e=[],n=s.replaceAll(/'(?:[^']|'')*'/gu,t=>(e.push(t),`${Ne}${(e.length-1).toString()}${Ne}`)).replaceAll(/\s+/gu," ").trim();for(let{pattern:t,replacement:o}of qt)n=n.replaceAll(t,o);for(let{pattern:t,replacement:o}of Et)n=n.replaceAll(t,o);return n=n.replaceAll(kt,(t,o)=>e[Number(o)]??""),n},"kt"),It=/\b(?:from|join)\s+([a-z_][\w$]*)(?:\s+(?:as\s+)?([a-z_][\w$]*))?/giu,Lt=/(?:\bwith\s+(?:recursive\s+)?|,\s*)([a-z_][\w$]*)\s+as\s*\(/giu,_t=new Set(["cross","full","group","having","inner","join","left","limit","offset","on","order","right","union","using","where","window"]),Rt=/[^\n]/gu,Dt=i((s,e)=>{let n=s[e];if(n==="'"){let t=e+1;for(;t<s.length&&s[t]!=="'";)t+=1;return Math.min(t+1,s.length)}if(n==="-"&&s[e+1]==="-"){let t=s.indexOf(`
11
+ `,e);return t===-1?s.length:t}if(n==="/"&&s[e+1]==="*"){let t=s.indexOf("*/",e+2);return t===-1?s.length:t+2}return-1},"_t"),Mt=i(s=>{let e="",n=0;for(;n<s.length;){let t=Dt(s,n);t===-1?(e+=s.slice(n,n+1),n+=1):(e+=s.slice(n,t).replaceAll(Rt," "),n=t)}return e},"At"),At=i(s=>{let e=new Set;for(let n of s.matchAll(Lt))e.add((n[1]??"").toLowerCase());return e},"qt"),$t=i((s,e)=>{let n=new Map;for(let t of s.matchAll(It)){let o=(t[1]??"").toLowerCase(),r=(t[2]??"").toLowerCase();e.has(o)&&(n.set(o,o),r!==""&&!_t.has(r)&&n.set(r,o))}return n},"Dt"),nt=i((s,e)=>{let n=Mt(s),t=new Set(e.map(o=>o.toLowerCase()));return{ctes:At(n),masked:n,targets:$t(n,t)}},"Ue"),Ot=/^(?:__lunora|sqlite_)/iu,Pt=/\b(?:from|join)\s+([a-z_][\w$]*)/giu,jt=/\b([a-z_][\w$]*)\.([a-z_][\w$]*)/giu,zt=new Set(["cross","full","group","having","inner","join","lateral","left","limit","offset","order","right","select","union","where","window"]),Wt=i((s,e,n)=>{let t=[];for(let o of s.matchAll(Pt)){let r=o[1]??"",l=r.toLowerCase();!e.has(l)&&!n.has(l)&&!zt.has(l)&&!Ot.test(r)&&t.push({length:r.length,message:`unknown table \`${r}\``,offset:o.index+o[0].length-r.length,severity:"error",source:"schema"})}return t},"Pt"),Ht=i((s,e,n)=>{let t=[],o=new Map;for(let[r,l]of Object.entries(e.columns))o.set(r.toLowerCase(),new Set(l.map(d=>d.toLowerCase())));for(let r of s.matchAll(jt)){let l=(r[1]??"").toLowerCase(),d=r[2]??"",a=n.get(l),c=a===void 0?void 0:o.get(a);c!==void 0&&!c.has(d.toLowerCase())&&t.push({length:d.length,message:`\`${a??""}\` has no column \`${d}\``,offset:r.index+r[0].length-d.length,severity:"error",source:"schema"})}return t},"Ht"),Ft=/(?<![\w$."])(?:"([a-z_][\w$]*)"|([a-z_][\w$]*))(?![.(])/giu,Kt=/\bas\s+"?([a-z_][\w$]*)"?/giu,Bt=i((s,e,n,t)=>{let o=[...new Set(n.values())],r=new Map,l=new Set;for(let c of o){for(let m of e.columns[c]??[])l.add(m.toLowerCase());for(let m of e.docFields?.[c]??[])r.set(m.toLowerCase(),m)}if(r.size===0)return[];let d=new Set([...s.matchAll(Kt)].map(c=>(c[1]??"").toLowerCase())),a=[];for(let c of s.matchAll(Ft)){let m=c[1],p=m??c[2]??"",f=p.toLowerCase(),v=r.get(f);v===void 0||l.has(f)||d.has(f)||t.has(f)||n.has(f)||a.push({length:p.length,message:`\`${v}\` is a \`__doc__\` field, not a column \u2014 use \`json_extract(__doc__, '$.${v}')\``,offset:c.index+(m===void 0?0:1),severity:"error",source:"schema"})}return a},"Kt"),Qt=i((s,e)=>{if(s.trim()==="")return[];let n=tt(s),t=new Set(e.tables.map(r=>r.toLowerCase())),o=[];for(let r of n){let{offset:l,rejection:d}=r;if(d!==void 0){o.push({length:d.length,message:d.message,offset:d.offset===void 0?l:l+d.offset,severity:"error",source:"gate"});continue}let{ctes:a,masked:c,targets:m}=nt(r.sql,e.tables);o.push(...[...Wt(c,t,a),...Ht(c,e,m),...Bt(c,e,m,a)].map(p=>({...p,offset:p.offset===void 0?l:l+p.offset})))}return o},"zt"),Yt=me(he.lintSql),Jt=600,Vt=i((s,e,n)=>{let t=xe(),[o,r]=(0,j.useState)([]),l=(0,j.useMemo)(()=>Qt(s,e),[s,e]),d=ze(s,Jt),a=l.some(p=>p.source==="gate")||d.trim()==="",c=(0,j.useCallback)(async p=>{try{let f=await t.query(Yt,{sql:d},fe(n));p.cancelled||r(f.diagnostics??[])}catch{p.cancelled||r([])}},[t,d,n]);(0,j.useEffect)(()=>{if(a){r([]);return}let p={cancelled:!1};return ae(c(p)),()=>{p.cancelled=!0}},[c,a]);let m=d===s;return(0,j.useMemo)(()=>m?[...l,...o]:l,[l,o,m])},"Qt"),we=8,Gt=["AND","ASC","AS","BY","COUNT","DESC","DISTINCT","EXPLAIN","FROM","GROUP","HAVING","INNER","JOIN","LEFT","LIKE","LIMIT","NOT","NULL","OFFSET","ON","ORDER","OR","QUERY","SELECT","WHERE","WITH"],Ut=new Set(["AND","BY","HAVING","ON","OR","SELECT","WHERE"]),Xt=/[\w$]/,ot=i(s=>s!==void 0&&Xt.test(s),"je"),rt=i(s=>{let e=s.length;for(;e>0&&ot(s[e-1]);)e-=1;return s.slice(e)},"Qe"),st=i((s,e)=>{let n=e;for(;n>0&&ot(s[n-1]);)n-=1;return{end:e,start:n,text:s.slice(n,e)}},"Ye"),Ye=i((s,e)=>{let n=s.slice(0,e).trimEnd();return n.endsWith(".")||Ut.has(rt(n).toUpperCase())},"De"),Zt=i((s,e,n)=>{let t=s.slice(0,e);if(!t.endsWith("."))return;let o=rt(t.slice(0,-1));if(o!=="")return nt(s,n).targets.get(o.toLowerCase())??o},"Vt"),Re=i((s,e)=>s.toLowerCase().startsWith(e.toLowerCase()),"Ie"),Je=i((s,e,n,t)=>{let o=[];for(let r of s)if(Re(r,e)&&(o.push(t(r)),o.length>=n))break;return o},"Oe"),en=i((s,e,n)=>{let t=new Map;for(let[o,r]of Object.entries(s.columns))for(let l of r)if(Re(l,e)&&!t.has(l)&&(t.set(l,o),t.size>=n))return[...t].map(([d,a])=>({detail:a,kind:"column",label:d}));return[...t].map(([o,r])=>({detail:r,kind:"column",label:o}))},"Xt"),tn=i((s,e,n)=>{let t=st(s,e),o=Zt(s,t.start,n.tables);if(o!==void 0){let a=n.columns[o]??n.columns[o.toLowerCase()]??[];return Je(a,t.text,we,c=>({detail:o,kind:"column",label:c}))}if(t.text===""&&!Ye(s,t.start))return[];let r=Je(n.tables,t.text,we,a=>({kind:"table",label:a})),l=en(n,t.text,we),d=Gt.flatMap(a=>t.text!==""&&Re(a,t.text)&&a.toLowerCase()!==t.text.toLowerCase()?[{kind:"keyword",label:a}]:[]);return(Ye(s,t.start)?[...l,...r,...d]:[...r,...l,...d]).slice(0,we)},"Zt"),nn=i((s,e,n)=>{let t=st(s,e),o=s.slice(0,t.start)+n.label+s.slice(t.end);return{caret:t.start+n.label.length,value:o}},"en"),on=["boxSizing","borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textTransform","width","wordSpacing"],rn=i((s,e)=>{let n=globalThis.getComputedStyle(s),t=globalThis.document.createElement("div"),{style:o}=t;o.position="absolute",o.visibility="hidden",o.whiteSpace="pre-wrap",o.overflowWrap="break-word";for(let a of on)o[a]=n[a];t.textContent=s.value.slice(0,Math.max(0,e));let r=globalThis.document.createElement("span");r.textContent=s.value.slice(Math.max(0,e))||".",t.append(r),globalThis.document.body.append(t);let l=r.offsetLeft-s.scrollLeft,d=r.offsetTop-s.scrollTop;return t.remove(),{left:l,top:d}},"nn"),sn=i((s,e,n)=>{let t=(0,X.c)(16),[o,r]=(0,j.useState)(null),l;t[0]!==s||t[1]!==e?(l=i((y,h)=>{let S=tn(y,h,s);if(S.length===0){r(null);return}let w=e.current,{left:C,top:b}=w===null?{left:0,top:0}:rn(w,h);r(k=>k!==null&&k.active===0&&k.left===C&&k.top===b&&k.suggestions.length===S.length&&k.suggestions.every((N,R)=>{let q=S.at(R);return N.kind===q?.kind&&N.label===q.label&&N.detail===q.detail})?k:{active:0,left:C,suggestions:S,top:b})},"r"),t[0]=s,t[1]=e,t[2]=l):l=t[2];let d=l,a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=i(()=>{r(null)},"a"),t[3]=a):a=t[3];let c=a,m;t[4]===Symbol.for("react.memo_cache_sentinel")?(m=i(y=>{r(h=>{if(h===null)return h;let S=h.suggestions.length,w=(h.active+y+S)%S;return{...h,active:w}})},"u"),t[4]=m):m=t[4];let p=m,f;t[5]!==n||t[6]!==o||t[7]!==e?(f=i(y=>{let h=e.current;if(o===null||h===null)return!1;let S=o.suggestions[y??o.active];if(S===void 0)return!1;let w=nn(h.value,h.selectionStart,S);return n(w.value),r(null),requestAnimationFrame(()=>{let C=e.current;C!==null&&(C.focus(),C.setSelectionRange(w.caret,w.caret))}),!0},"d"),t[5]=n,t[6]=o,t[7]=e,t[8]=f):f=t[8];let v=f,g;t[9]!==v?(g=i(()=>v(),"b"),t[9]=v,t[10]=g):g=t[10];let E=g,x;return t[11]!==E||t[12]!==v||t[13]!==d||t[14]!==o?(x={close:c,commit:E,commitAt:v,move:p,refresh:d,state:o},t[11]=E,t[12]=v,t[13]=d,t[14]=o,t[15]=x):x=t[15],x},"sn"),ln={column:"column",keyword:"keyword",table:"table"},an=20,cn=i(s=>{let e=(0,X.c)(17),{listboxId:n,onPick:t,state:o}=s,r=se(),l;e[0]!==o?(l=o===null?void 0:{left:o.left,top:o.top+an},e[0]=o,e[1]=l):l=e[1];let d=l;if(o===null)return null;let a;if(e[2]!==n||e[3]!==t||e[4]!==o.active||e[5]!==o.suggestions||e[6]!==r){let m;e[8]!==n||e[9]!==t||e[10]!==o.active||e[11]!==r?(m=i((p,f)=>(0,u.jsxs)("li",{"aria-selected":f===o.active,className:ie("flex cursor-pointer items-center gap-2 px-2 py-1 text-[13px]",f===o.active?"bg-accent text-accent-foreground":"text-foreground"),"data-testid":"sql-autocomplete-item",id:`${n}-opt-${f.toString()}`,onMouseDown:i(v=>{v.preventDefault(),t(f)},"onMouseDown"),role:"option",children:[(0,u.jsx)("span",{className:"truncate font-mono",children:p.label}),p.detail!==void 0&&(0,u.jsx)("span",{className:"ms-auto truncate text-xs text-muted-foreground",children:p.detail}),(0,u.jsx)("span",{className:"shrink-0 font-mono text-[10px] tracking-wide text-muted-foreground/70 uppercase",children:r(ln[p.kind])})]},`${p.kind}:${p.label}`),"u"),e[8]=n,e[9]=t,e[10]=o.active,e[11]=r,e[12]=m):m=e[12],a=o.suggestions.map(m),e[2]=n,e[3]=t,e[4]=o.active,e[5]=o.suggestions,e[6]=r,e[7]=a}else a=e[7];let c;return e[13]!==n||e[14]!==d||e[15]!==a?(c=(0,u.jsx)("ul",{className:"absolute z-30 max-h-56 w-72 overflow-auto rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-md","data-testid":"sql-autocomplete",id:n,role:"listbox",style:d,children:a}),e[13]=n,e[14]=d,e[15]=a,e[16]=c):c=e[16],c},"rn"),dn=me(he.listTables),un=me(he.readTablePage),mn=i(s=>{let e=(0,X.c)(18),n=xe(),t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0];let[o,r]=(0,j.useState)(t),l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l={},e[1]=l):l=e[1];let[d,a]=(0,j.useState)(l),c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c={},e[2]=c):c=e[2];let[m,p]=(0,j.useState)(c),f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=new Set,e[3]=f):f=e[3];let v=(0,j.useRef)(f),g,E;e[4]!==n||e[5]!==s?(g=i(()=>{let C={cancelled:!1};return ae((async()=>{try{let b=await n.query(dn,{},fe(s));C.cancelled||(r(b.map(hn)),a({}),p({}),v.current=new Set)}catch{C.cancelled||(r([]),a({}),p({}),v.current=new Set)}})()),()=>{C.cancelled=!0}},"b"),E=[n,s],e[4]=n,e[5]=s,e[6]=g,e[7]=E):(g=e[6],E=e[7]),(0,j.useEffect)(g,E);let x;e[8]!==n||e[9]!==s?(x=i(C=>{v.current.has(C)||(v.current.add(C),ae((async()=>{try{let b=await n.query(un,{limit:1,offset:0,table:C},fe(s)),{sqlColumns:k}=b;if(k===void 0){v.current.delete(C);return}let N=new Set(k),R=b.columns.filter(q=>!N.has(q));a(q=>({...q,[C]:k})),p(q=>({...q,[C]:R}))}catch{v.current.delete(C)}})()))},"m"),e[8]=n,e[9]=s,e[10]=x):x=e[10];let y=x,h;e[11]!==d||e[12]!==m||e[13]!==o?(h={columns:d,docFields:m,tables:o},e[11]=d,e[12]=m,e[13]=o,e[14]=h):h=e[14];let S=h,w;return e[15]!==y||e[16]!==S?(w={probe:y,schema:S},e[15]=y,e[16]=S,e[17]=w):w=e[17],w},"dn"),Le=/\b(?:from|join|update|into)\s+([a-z_][\w$]*)|\b([a-z_][\w$]*)\s*\./gi,fn=i(s=>{let e=new Set;Le.lastIndex=0;let n=Le.exec(s);for(;n!==null;)e.add(n[1]??n[2]),n=Le.exec(s);return[...e]},"un");function hn(s){return s.name}i(hn,"fn");var pn=i(s=>(s.metaKey||s.ctrlKey)&&!s.shiftKey&&!s.altKey&&s.key.toLowerCase()==="i","mn"),bn=i(s=>{let e=(0,X.c)(44),{inlineEditEnabled:n,onSubmit:t,probe:o,schema:r,setDraft:l}=s,d=(0,j.useId)(),[a,c]=(0,j.useState)(null),m=(0,j.useRef)(null),p=(0,j.useRef)(null),f=(0,j.useRef)(null),v=sn(r,f,l),{close:g,commit:E,commitAt:x,move:y,refresh:h,state:S}=v,w;e[0]!==x?(w=i(M=>{x(M)},"v"),e[0]=x,e[1]=w):w=e[1];let C=w,b;e[2]!==h?(b=i(()=>{let M=f.current;M!==null&&M===document.activeElement&&h(M.value,M.selectionStart)},"h"),e[2]=h,e[3]=b):b=e[3];let k;e[4]!==h||e[5]!==r?(k=[h,r],e[4]=h,e[5]=r,e[6]=k):k=e[6],(0,j.useEffect)(b,k);let N;e[7]!==o||e[8]!==h||e[9]!==l?(N=i(M=>{let{selectionStart:Y,value:U}=M.target;l(U),c(null);for(let W of fn(U))o(W);h(U,Y)},"T"),e[7]=o,e[8]=h,e[9]=l,e[10]=N):N=e[10];let R=N,q;e[11]!==h?(q=i(M=>{let Y=M.currentTarget;h(Y.value,Y.selectionStart)},"R"),e[11]=h,e[12]=q):q=e[12];let T=q,L;e[13]!==g||e[14]!==E||e[15]!==y?(L=i(M=>M.key==="ArrowDown"?(M.preventDefault(),y(1),!0):M.key==="ArrowUp"?(M.preventDefault(),y(-1),!0):M.key==="Escape"?(M.preventDefault(),g(),!0):(M.key==="Enter"||M.key==="Tab")&&!M.metaKey&&!M.ctrlKey&&E()?(M.preventDefault(),!0):!1,"_"),e[13]=g,e[14]=E,e[15]=y,e[16]=L):L=e[16];let _=L,I;e[17]!==S||e[18]!==g||e[19]!==n||e[20]!==_||e[21]!==t?(I=i(M=>{if(!(S!==null&&_(M))){if((M.metaKey||M.ctrlKey)&&M.key==="Enter"){M.preventDefault(),t();return}if(n&&pn(M)){M.preventDefault(),g();let{selectionEnd:Y,selectionStart:U,value:W}=M.currentTarget,[J,G]=U===Y?[0,W.length]:[U,Y];c({end:G,start:J,text:W.slice(J,G)})}}},"A"),e[17]=S,e[18]=g,e[19]=n,e[20]=_,e[21]=t,e[22]=I):I=e[22];let H=I,B;e[23]!==g?(B=i(()=>{requestAnimationFrame(()=>{g()})},"W"),e[23]=g,e[24]=B):B=e[24];let F=B,O;e[25]===Symbol.for("react.memo_cache_sentinel")?(O=i(M=>{let{scrollLeft:Y,scrollTop:U}=M.currentTarget;m.current!==null&&(m.current.scrollTop=U),p.current!==null&&(p.current.scrollTop=U,p.current.scrollLeft=Y)},"$"),e[25]=O):O=e[25];let K=O,$;e[26]===Symbol.for("react.memo_cache_sentinel")?($=i(M=>{let Y=f.current;Y===null||M.offset===void 0||(Y.focus(),Y.setSelectionRange(M.offset,M.offset+(M.length??0)))},"H"),e[26]=$):$=e[26];let D=$,A;e[27]===Symbol.for("react.memo_cache_sentinel")?(A=i(()=>{c(null),f.current?.focus()},"D"),e[27]=A):A=e[27];let Q=A,z;e[28]!==a||e[29]!==l?(z=i(M=>{let Y=f.current;if(a===null||Y===null)return;let{end:U,start:W,text:J}=a;if(Y.value.slice(W,U)!==J){Q();return}l(Y.value.slice(0,W)+M+Y.value.slice(U)),c(null),Y.focus(),requestAnimationFrame(()=>{Y.setSelectionRange(W,W+M.length)})},"P"),e[28]=a,e[29]=l,e[30]=z):z=e[30];let re=z,Z;e[31]!==R||e[32]!==F||e[33]!==H||e[34]!==T?(Z={onBlur:F,onChange:R,onKeyDown:H,onScroll:K,onSelect:T},e[31]=R,e[32]=F,e[33]=H,e[34]=T,e[35]=Z):Z=e[35];let oe;return e[36]!==re||e[37]!==S||e[38]!==g||e[39]!==a||e[40]!==d||e[41]!==C||e[42]!==Z?(oe={acceptInlineEdit:re,autocompleteState:S,closeAutocomplete:g,closeInlineEdit:Q,inlineEdit:a,handlers:Z,listboxId:d,onPickSuggestion:C,editorRef:f,gutterRef:m,overlayRef:p,revealDiagnostic:D},e[36]=re,e[37]=S,e[38]=g,e[39]=a,e[40]=d,e[41]=C,e[42]=Z,e[43]=oe):oe=e[43],oe},"pn"),gn="lunora-studio-sql-tabs",xn="lunora-studio-sql-active-tab",De=12,ge=i((s="",e="")=>({activeId:null,id:Ee("tab"),name:e,sql:s}),"pe"),vn=i(()=>ye(xn,""),"gn"),yn=i(s=>{let e=(0,X.c)(16),[n,t]=ve(gn),[o,r]=vn(),[l]=(0,j.useState)(s),d,a;e[0]!==l||e[1]!==t||e[2]!==n.length?(d=i(()=>{n.length===0&&t([l])},"c"),a=[l,t,n.length],e[0]=l,e[1]=t,e[2]=n.length,e[3]=d,e[4]=a):(d=e[3],a=e[4]),(0,j.useEffect)(d,a);let c;e[5]!==l||e[6]!==n?(c=n.length===0?[l]:n,e[5]=l,e[6]=n,e[7]=c):c=e[7];let m=c,p;e[8]!==o||e[9]!==m?(p=m.some(g=>g.id===o)?o:m[0]?.id??"",e[8]=o,e[9]=m,e[10]=p):p=e[10];let f=p,v;return e[11]!==f||e[12]!==r||e[13]!==t||e[14]!==m?(v={activeId:f,setActiveId:r,setTabs:t,tabs:m},e[11]=f,e[12]=r,e[13]=t,e[14]=m,e[15]=v):v=e[15],v},"xn"),lt=i(s=>s.activeId===null&&s.sql.trim()!=="","Ge"),wn=i((s,e)=>[...s,e].slice(-De),"vn"),Sn=i((s,e,n)=>{let t=s.findIndex(r=>r.id===e);if(t===-1)return{activeId:s[0]?.id??"",tabs:[...s]};let o=s.filter(r=>r.id!==e);if(o.length===0){let r=n();return{activeId:r.id,tabs:[r]}}return{activeId:o[Math.min(t,o.length-1)].id,tabs:o}},"yn"),Cn=i((s,e)=>{let n=s.filter(t=>t.id===e);return n.length===0?{activeId:s[0]?.id??"",tabs:[...s]}:{activeId:e,tabs:n}},"Sn"),Nn=i((s,e,n)=>{let t=s.findIndex(r=>r.id===e);if(t===-1)return{activeId:n,tabs:[...s]};let o=s.slice(0,t+1);return{activeId:o.some(r=>r.id===n)?n:e,tabs:o}},"wn"),kn=i(s=>{let e=s();return{activeId:e.id,tabs:[e]}},"Cn"),qn=i((s,e,n)=>{if(s==="others")return e.filter(t=>t.id!==n);if(s==="right"){let t=e.findIndex(o=>o.id===n);return t===-1?[]:e.slice(t+1)}return[...e]},"Nn"),Ve={error:null,pane:"results",result:null,running:!1},En=i(s=>{let e=(0,X.c)(66),{activeId:n,setActiveId:t,setTabs:o,tabs:r}=yn(s),l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={},e[0]=l):l=e[0];let[d,a]=(0,j.useState)(l),[c,m]=(0,j.useState)(null),[p,f]=(0,j.useState)(null),v;e[1]!==n||e[2]!==r?(v=r.find(P=>P.id===n)??r[0]??ge(),e[1]=n,e[2]=r,e[3]=v):v=e[3];let g=v,E=d[g.id]??Ve,x;e[4]!==g.id||e[5]!==o?(x=i(P=>{o(V=>V.map(ne=>ne.id===g.id?{...ne,...P}:ne))},"m"),e[4]=g.id,e[5]=o,e[6]=x):x=e[6];let y=x,h;e[7]!==g.id?(h=i(P=>{a(V=>{let ne=V[g.id]??Ve;return{...V,[g.id]:{...ne,...P}}})},"p"),e[7]=g.id,e[8]=h):h=e[8];let S=h,w;e[9]!==t||e[10]!==o||e[11]!==r.length?(w=i(()=>{if(r.length>=De)return;let P=ge();o(V=>wn(V,P)),t(P.id)},"v"),e[9]=t,e[10]=o,e[11]=r.length,e[12]=w):w=e[12];let C=w,b;e[13]!==t||e[14]!==o?(b=i(P=>{m(null),f(null),o(P.tabs),t(P.activeId);let V=new Set(P.tabs.map(Tn));a(ne=>Object.fromEntries(Object.entries(ne).filter(ce=>{let[de]=ce;return V.has(de)})))},"h"),e[13]=t,e[14]=o,e[15]=b):b=e[15];let k=b,N;e[16]!==k||e[17]!==r?(N=i(P=>{k(Sn(r,P,ge))},"T"),e[16]=k,e[17]=r,e[18]=N):N=e[18];let R=N,q;e[19]!==n||e[20]!==k||e[21]!==r?(q=i((P,V)=>{k(P==="others"?Cn(r,V):P==="right"?Nn(r,V,n):kn(ge))},"R"),e[19]=n,e[20]=k,e[21]=r,e[22]=q):q=e[22];let T=q,L;e[23]!==T||e[24]!==c||e[25]!==r?(L=i(P=>{c!==null&&(qn(P,r,c.id).some(In)?f(P):T(P,c.id))},"_"),e[23]=T,e[24]=c,e[25]=r,e[26]=L):L=e[26];let _=L,I;e[27]===Symbol.for("react.memo_cache_sentinel")?(I=i((P,V)=>{V.preventDefault(),f(null),m({id:P,x:V.clientX,y:V.clientY})},"A"),e[27]=I):I=e[27];let H=I,B;e[28]===Symbol.for("react.memo_cache_sentinel")?(B=i(()=>{m(null),f(null)},"W"),e[28]=B):B=e[28];let F=B,O;e[29]===Symbol.for("react.memo_cache_sentinel")?(O=i(P=>{P.preventDefault(),m(null),f(null)},"$"),e[29]=O):O=e[29];let K=O,$;e[30]!==_?($=i(()=>{_("others")},"H"),e[30]=_,e[31]=$):$=e[31];let D=$,A;e[32]!==_?(A=i(()=>{_("right")},"D"),e[32]=_,e[33]=A):A=e[33];let Q=A,z;e[34]!==_?(z=i(()=>{_("all")},"P"),e[34]=_,e[35]=z):z=e[35];let re=z,Z;e[36]!==T||e[37]!==p||e[38]!==c?(Z=i(()=>{c!==null&&p!==null&&T(p,c.id),f(null)},"Z"),e[36]=T,e[37]=p,e[38]=c,e[39]=Z):Z=e[39];let oe=Z,M;e[40]===Symbol.for("react.memo_cache_sentinel")?(M=i(()=>{f(null)},"q"),e[40]=M):M=e[40];let Y=M,U;e[41]!==c?(U=c===null?void 0:{left:c.x,top:c.y},e[41]=c,e[42]=U):U=e[42];let W=U,J;e[43]!==o?(J=i(P=>{o(V=>V.map(ne=>ne.activeId===P?{...ne,activeId:null}:ne))},"U"),e[43]=o,e[44]=J):J=e[44];let G=J,ee;e[45]!==o?(ee=i((P,V)=>{o(ne=>ne.map(ce=>ce.id===P?{...ce,name:V}:ce))},"Y"),e[45]=o,e[46]=ee):ee=e[46];let le=ee,te;return e[47]!==g||e[48]!==n||e[49]!==C||e[50]!==R||e[51]!==oe||e[52]!==re||e[53]!==D||e[54]!==Q||e[55]!==E||e[56]!==S||e[57]!==y||e[58]!==p||e[59]!==le||e[60]!==t||e[61]!==c||e[62]!==W||e[63]!==r||e[64]!==G?(te={activeTab:g,activeTabId:n,addEditorTab:C,cancelBulk:Y,closeEditorTab:R,closeTabMenu:F,confirmBulk:oe,menuStyle:W,onBackdropContextMenu:K,onCloseAll:re,onCloseOthers:D,onCloseToRight:Q,openTabMenu:H,output:E,patchActiveOutput:S,patchActiveTab:y,pendingBulk:p,renameTab:le,setActiveTabId:t,tabMenu:c,tabs:r,unlinkQuery:G},e[47]=g,e[48]=n,e[49]=C,e[50]=R,e[51]=oe,e[52]=re,e[53]=D,e[54]=Q,e[55]=E,e[56]=S,e[57]=y,e[58]=p,e[59]=le,e[60]=t,e[61]=c,e[62]=W,e[63]=r,e[64]=G,e[65]=te):te=e[65],te},"En");function Tn(s){return s.id}i(Tn,"kn");function In(s){return lt(s)}i(In,"Tn");var Ln="lunora-studio-sql-queries",ue="lunora-studio-sql-history",_n="lunora-studio-sql-remember-history",Rn=25,Dn=i(s=>{let e=(0,X.c)(41),{loadIntoActiveTab:n,unlinkQuery:t}=s,o=se(),[r,l]=ve(Ln),[d,a]=ye(_n,!1),[c,m]=ve(ue,d?"local":"session"),p,f;e[0]!==d?(p=i(()=>{d||pe(ue,"local")},"g"),f=[d],e[0]=d,e[1]=p,e[2]=f):(p=e[1],f=e[2]),(0,j.useEffect)(p,f);let[v,g]=(0,j.useState)(""),E=(0,j.useRef)(null),x;e[3]!==m?(x=i(D=>{m(A=>A[0]?.sql===D?A:[{at:Date.now(),sql:D},...A.filter(Q=>Q.sql!==D)].slice(0,Rn))},"m"),e[3]=m,e[4]=x):x=e[4];let y=x,h;e[5]!==n||e[6]!==l||e[7]!==o?(h=i(()=>{let D={id:Ee("q"),name:o("Untitled query"),sql:""};l(A=>[D,...A]),n("",D.id)},"p"),e[5]=n,e[6]=l,e[7]=o,e[8]=h):h=e[8];let S=h,w;e[9]!==n||e[10]!==r?(w=i(D=>{let A=r.find(Q=>Q.id===D);A!==void 0&&(n(A.sql,D),E.current?.querySelector(`[data-testid="sql-query-${D}"]`)?.scrollIntoView({block:"nearest"}))},"v"),e[9]=n,e[10]=r,e[11]=w):w=e[11];let C=w,b;e[12]!==l||e[13]!==t?(b=i(D=>{l(A=>A.filter(Q=>Q.id!==D)),t(D)},"h"),e[12]=l,e[13]=t,e[14]=b):b=e[14];let k=b,N;e[15]!==n?(N=i(D=>{n(D.currentTarget.dataset.sql??"",null)},"T"),e[15]=n,e[16]=N):N=e[16];let R=N,q;e[17]!==n?(q=i(D=>{n(D.currentTarget.dataset.sql??"",null)},"R"),e[17]=n,e[18]=q):q=e[18];let T=q,L;e[19]!==m?(L=i(()=>{m([]),pe(ue,"local"),pe(ue,"session")},"_"),e[19]=m,e[20]=L):L=e[20];let _=L,I;e[21]!==c||e[22]!==a?(I=i(D=>{$e(ue,c,D?"local":"session"),D||pe(ue,"local"),a(D)},"A"),e[21]=c,e[22]=a,e[23]=I):I=e[23];let H=I,B;e[24]===Symbol.for("react.memo_cache_sentinel")?(B=i(D=>{g(D.target.value)},"W"),e[24]=B):B=e[24];let F=B,O;e[25]!==l?(O=i((D,A)=>{l(Q=>Q.map(z=>z.id===D?{...z,sql:A}:z))},"$"),e[25]=l,e[26]=O):O=e[26];let K=O,$;return e[27]!==_||e[28]!==k||e[29]!==c||e[30]!==T||e[31]!==R||e[32]!==S||e[33]!==r||e[34]!==y||e[35]!==d||e[36]!==v||e[37]!==C||e[38]!==H||e[39]!==K?($={clearHistory:_,deleteQuery:k,history:c,listRef:E,loadFromHistory:T,loadTemplate:R,newQuery:S,onSearchChange:F,queries:r,recordHistory:y,rememberHistory:d,search:v,selectQuery:C,setRememberHistory:H,updateQuerySql:K},e[27]=_,e[28]=k,e[29]=c,e[30]=T,e[31]=R,e[32]=S,e[33]=r,e[34]=y,e[35]=d,e[36]=v,e[37]=C,e[38]=H,e[39]=K,e[40]=$):$=e[40],$},"_n"),Me="p-3 font-mono text-xs leading-5 whitespace-pre-wrap break-words",Mn=i((s,e)=>{let n=[];for(let o of s){if(o.offset===void 0||o.length===void 0||o.length<=0)continue;let r=Math.max(0,Math.min(o.offset,e)),l=Math.max(r,Math.min(o.offset+o.length,e));r!==l&&n.push({end:l,severity:o.severity,start:r})}n.sort((o,r)=>o.start-r.start);let t=[];for(let o of n)o.start>=(t.at(-1)?.end??0)&&t.push(o);return t},"An"),it=i((s,e)=>e(s==="unsafe-response"?"The model returned a statement that is not read-only, so it was discarded.":s==="too-long"?"The statement is too long to rewrite. Select a shorter part of it.":s==="empty-response"?"The model returned nothing usable.":"The model could not be reached."),"Je"),An=i(s=>{let e=(0,X.c)(51),{assistant:n,failed:t,onGenerated:o}=s,r=se(),[l,d]=(0,j.useState)("");if(n.unavailable)return null;let a;e[0]!==n?(a=n.pending("sql"),e[0]=n,e[1]=a):a=e[1];let c=a,m;if(e[2]!==n||e[3]!==t||e[4]!==o||e[5]!==c||e[6]!==l||e[7]!==r){let p=n.reason("sql"),f;e[9]!==n||e[10]!==t||e[11]!==o||e[12]!==l?(f=i(T=>{let L=l.trim();L===""&&!T||ae((async()=>{let _=await n.generate(L===""?"fix the failing statement":L,T?t:void 0);_!==void 0&&o(_)})())},"d"),e[9]=n,e[10]=t,e[11]=o,e[12]=l,e[13]=f):f=e[13];let v=f,g;e[14]!==r?(g=r("Describe the query you want"),e[14]=r,e[15]=g):g=e[15];let E;e[16]===Symbol.for("react.memo_cache_sentinel")?(E=i(T=>{d(T.target.value)},"N"),e[16]=E):E=e[16];let x;e[17]!==v?(x=i(T=>{T.key==="Enter"&&(T.preventDefault(),v(!1))},"m"),e[17]=v,e[18]=x):x=e[18];let y;e[19]!==r?(y=r("Describe the query you want"),e[19]=r,e[20]=y):y=e[20];let h;e[21]!==c||e[22]!==l||e[23]!==g||e[24]!==x||e[25]!==y?(h=(0,u.jsx)(qe,{"aria-label":g,className:"h-7 flex-1 text-xs","data-testid":"sql-assistant-prompt",disabled:c,onChange:E,onKeyDown:x,placeholder:y,value:l}),e[21]=c,e[22]=l,e[23]=g,e[24]=x,e[25]=y,e[26]=h):h=e[26];let S=c&&"opacity-60",w;e[27]!==S?(w=ie("rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",S),e[27]=S,e[28]=w):w=e[28];let C;e[29]!==c||e[30]!==l?(C=c||l.trim()==="",e[29]=c,e[30]=l,e[31]=C):C=e[31];let b;e[32]!==v?(b=i(()=>{v(!1)},"h"),e[32]=v,e[33]=b):b=e[33];let k;e[34]!==c||e[35]!==r?(k=r(c?"Thinking\u2026":"Draft SQL"),e[34]=c,e[35]=r,e[36]=k):k=e[36];let N;e[37]!==w||e[38]!==C||e[39]!==b||e[40]!==k?(N=(0,u.jsx)("button",{className:w,"data-testid":"sql-assistant-generate",disabled:C,onClick:b,type:"button",children:k}),e[37]=w,e[38]=C,e[39]=b,e[40]=k,e[41]=N):N=e[41];let R;e[42]!==t||e[43]!==c||e[44]!==v||e[45]!==r?(R=t!==void 0&&(0,u.jsx)("button",{className:"rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"sql-assistant-fix",disabled:c,onClick:i(()=>{v(!0)},"onClick"),type:"button",children:r("Fix this")}),e[42]=t,e[43]=c,e[44]=v,e[45]=r,e[46]=R):R=e[46];let q;e[47]!==N||e[48]!==R||e[49]!==h?(q=(0,u.jsxs)("div",{className:"flex items-center gap-2",children:[h,N,R]}),e[47]=N,e[48]=R,e[49]=h,e[50]=q):q=e[50],m=(0,u.jsxs)("div",{className:"flex flex-col gap-1 border-b border-border px-3 py-2","data-testid":"sql-assistant",children:[q,p!==void 0&&(0,u.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"sql-assistant-reason",role:"status",children:it(p,r)})]}),e[2]=n,e[3]=t,e[4]=o,e[5]=c,e[6]=l,e[7]=r,e[8]=m}else m=e[8];return m},"qn"),$n=i(s=>{let e=(0,X.c)(8),{diagnostics:n,draft:t,scrollRef:o}=s,r,l;if(e[0]!==n||e[1]!==t){l=Symbol.for("react.early_return_sentinel");e:{let c=Mn(n,t.length);if(c.length===0){l=null;break e}r=[];let m=0;for(let[p,f]of c.entries())f.start>m&&r.push(t.slice(m,f.start)),r.push((0,u.jsx)("span",{className:ie("decoration-wavy underline underline-offset-4",f.severity==="error"?"decoration-destructive":"decoration-amber-500"),children:t.slice(f.start,f.end)},`${f.start.toString()}-${p.toString()}`)),m=f.end;r.push(t.slice(m))}e[0]=n,e[1]=t,e[2]=r,e[3]=l}else r=e[2],l=e[3];if(l!==Symbol.for("react.early_return_sentinel"))return l;let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=ie("pointer-events-none absolute inset-0 overflow-hidden text-transparent",Me),e[4]=d):d=e[4];let a;return e[5]!==r||e[6]!==o?(a=(0,u.jsx)("div",{"aria-hidden":"true",className:d,"data-testid":"sql-diagnostics-overlay",ref:o,children:r}),e[5]=r,e[6]=o,e[7]=a):a=e[7],a},"Dn"),On={gate:"read-only",plan:"plan",schema:"schema",syntax:"syntax"},Pn=i(s=>{let e=(0,X.c)(10),{diagnostics:n,onSelect:t}=s,o=se();if(n.length===0)return null;let r;e[0]!==o?(r=o("SQL problems"),e[0]=o,e[1]=r):r=e[1];let l;if(e[2]!==n||e[3]!==t){let a;e[5]!==t?(a=i((c,m)=>(0,u.jsx)("li",{children:(0,u.jsxs)("button",{className:"flex w-full items-start gap-2 px-3 py-1 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-problem",onClick:i(()=>{t(c)},"onClick"),type:"button",children:[(0,u.jsx)("span",{className:ie("mt-px shrink-0 rounded px-1 font-mono text-[10px] uppercase",c.severity==="error"?"bg-destructive/15 text-destructive":"bg-amber-500/15 text-amber-600"),children:On[c.source]}),(0,u.jsx)("span",{className:"min-w-0 text-muted-foreground",children:c.message})]})},`${c.source}-${(c.offset??m).toString()}-${m.toString()}`),"a"),e[5]=t,e[6]=a):a=e[6],l=n.map(a),e[2]=n,e[3]=t,e[4]=l}else l=e[4];let d;return e[7]!==r||e[8]!==l?(d=(0,u.jsx)("ul",{"aria-label":r,className:"max-h-24 shrink-0 overflow-y-auto border-t border-border bg-muted/30","data-testid":"sql-problems",children:l}),e[7]=r,e[8]=l,e[9]=d):d=e[9],d},"Mn"),jn=i(s=>(s.endsWith(`
12
+ `)?s.slice(0,-1):s).split(`
13
+ `),"$n"),zn=i((s,e)=>{let n=[],t=1,o=1;for(let r of Ie(s,e,{ignoreNewlineAtEof:!0}))for(let l of jn(r.value))r.added?(n.push({after:o,kind:"added",text:l}),o+=1):r.removed?(n.push({before:t,kind:"removed",text:l}),t+=1):(n.push({after:o,before:t,kind:"context",text:l}),t+=1,o+=1);return n},"Bn"),Wn={added:"bg-emerald-500/10 text-emerald-700 dark:text-emerald-400",context:"text-muted-foreground",removed:"bg-destructive/10 text-destructive"},Hn={added:"+",context:" ",removed:"-"},Fn=i(s=>{let e=(0,X.c)(11),{lines:n}=s,t=se(),o;e[0]!==t?(o=t("Proposed edit"),e[0]=t,e[1]=o):o=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=ie("max-h-48 overflow-auto rounded-md border border-border bg-background",Me),e[2]=r):r=e[2];let l;if(e[3]!==n||e[4]!==t){let a;e[6]!==t?(a=i(c=>(0,u.jsxs)("li",{className:ie("flex gap-2",Wn[c.kind]),"data-kind":c.kind,children:[(0,u.jsx)("span",{"aria-hidden":"true",className:"shrink-0 select-none opacity-60",children:Hn[c.kind]}),c.kind!=="context"&&(0,u.jsx)("span",{className:"sr-only",children:c.kind==="added"?t("Added"):t("Removed")}),(0,u.jsx)("span",{className:"min-w-0",children:c.text===""?"\xA0":c.text})]},`${String(c.before)}:${String(c.after)}`),"a"),e[6]=t,e[7]=a):a=e[7],l=n.map(a),e[3]=n,e[4]=t,e[5]=l}else l=e[5];let d;return e[8]!==o||e[9]!==l?(d=(0,u.jsx)("ul",{"aria-label":o,className:r,"data-testid":"sql-inline-diff",children:l}),e[8]=o,e[9]=l,e[10]=d):d=e[10],d},"Fn"),Se="rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",Kn=i(s=>{let e=(0,X.c)(41),{onAccept:n,onCancel:t,rpc:o,source:r,whole:l}=s,d=se(),a=(0,j.useRef)(null),c=(0,j.useRef)(null),[m,p]=(0,j.useState)(""),[f,v]=(0,j.useState)(null),g,E;if(e[0]!==f?(g=i(()=>{f===null?a.current?.focus():c.current?.focus()},"b"),E=[f],e[0]=f,e[1]=g,e[2]=E):(g=e[1],E=e[2]),(0,j.useEffect)(g,E),o.unavailable)return null;let x;e[3]!==o?(x=o.pending("sql"),e[3]=o,e[4]=x):x=e[4];let y=x,h;if(e[5]!==m||e[6]!==n||e[7]!==t||e[8]!==y||e[9]!==f||e[10]!==o||e[11]!==r||e[12]!==d||e[13]!==l){let S=o.reason("sql"),w;e[15]!==m||e[16]!==o||e[17]!==r?(w=i(()=>{let _=m.trim();_===""||r.trim()===""||ae((async()=>{let I=await o.rewrite(_,r);I!==void 0&&v(I)})())},"v"),e[15]=m,e[16]=o,e[17]=r,e[18]=w):w=e[18];let C=w,b;e[19]!==t?(b=i(_=>{_.key==="Escape"&&(_.preventDefault(),t())},"h"),e[19]=t,e[20]=b):b=e[20];let k=b,N;e[21]!==d||e[22]!==l?(N=d(l?"Whole query":"Selection"),e[21]=d,e[22]=l,e[23]=N):N=e[23];let R;e[24]!==N?(R=(0,u.jsx)("span",{className:"shrink-0 rounded bg-muted px-1 font-mono text-[10px] uppercase text-muted-foreground","data-testid":"sql-inline-edit-scope",children:N}),e[24]=N,e[25]=R):R=e[25];let q;e[26]!==m||e[27]!==n||e[28]!==t||e[29]!==k||e[30]!==y||e[31]!==f||e[32]!==C||e[33]!==d?(q=f===null?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(qe,{"aria-label":d("Tell the model what to change"),className:"h-7 flex-1 text-xs","data-testid":"sql-inline-edit-prompt",disabled:y,onChange:i(_=>{p(_.target.value)},"onChange"),onKeyDown:i(_=>{if(_.key==="Enter"){_.preventDefault(),C();return}k(_)},"onKeyDown"),placeholder:d("Tell the model what to change"),ref:a,value:m}),(0,u.jsx)("button",{className:ie(Se,y&&"opacity-60"),"data-testid":"sql-inline-edit-submit",disabled:y||m.trim()==="",onClick:C,onKeyDown:k,type:"button",children:d(y?"Thinking\u2026":"Rewrite")}),(0,u.jsx)("button",{className:Se,"data-testid":"sql-inline-edit-cancel",onClick:t,onKeyDown:k,type:"button",children:d("Cancel")})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("span",{className:"flex-1 text-xs text-muted-foreground",children:d("Proposed edit")}),(0,u.jsx)("button",{className:Se,"data-testid":"sql-inline-edit-accept",onClick:i(()=>{n(f)},"onClick"),onKeyDown:k,ref:c,type:"button",children:d("Accept")}),(0,u.jsx)("button",{className:Se,"data-testid":"sql-inline-edit-reject",onClick:i(()=>{v(null)},"onClick"),onKeyDown:k,type:"button",children:d("Reject")})]}),e[26]=m,e[27]=n,e[28]=t,e[29]=k,e[30]=y,e[31]=f,e[32]=C,e[33]=d,e[34]=q):q=e[34];let T;e[35]!==R||e[36]!==q?(T=(0,u.jsxs)("div",{className:"flex items-center gap-2",children:[R,q]}),e[35]=R,e[36]=q,e[37]=T):T=e[37];let L;e[38]!==f||e[39]!==r?(L=f!==null&&(0,u.jsx)(Fn,{lines:zn(r,f)}),e[38]=f,e[39]=r,e[40]=L):L=e[40],h=(0,u.jsxs)("div",{className:"flex flex-col gap-1 border-b border-border bg-muted/20 px-3 py-2","data-testid":"sql-inline-edit",children:[T,L,S!==void 0&&(0,u.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"sql-inline-edit-reason",role:"status",children:it(S,d)})]}),e[5]=m,e[6]=n,e[7]=t,e[8]=y,e[9]=f,e[10]=o,e[11]=r,e[12]=d,e[13]=l,e[14]=h}else h=e[14];return h},"Wn"),Bn={minWidth:"2.75rem",paddingInline:"0.5rem"},Qn=i(s=>{let e=(0,X.c)(75),{assistant:n,autocomplete:t,diagnostics:o,draft:r,failed:l,handlers:d,editorRef:a,gutterRef:c,inlineEdit:m,listboxId:p,onAcceptInlineEdit:f,onCancelInlineEdit:v,onGenerated:g,onPickSuggestion:E,onRevealDiagnostic:x,overlayRef:y}=s,h=se(),S,w,C,b,k,N,R,q,T;if(e[0]!==n||e[1]!==r||e[2]!==l||e[3]!==c||e[4]!==m||e[5]!==f||e[6]!==v||e[7]!==g){let z=r.split(`
14
+ `).length;R="flex min-h-0 min-w-0 flex-1 flex-col",e[17]!==n||e[18]!==l||e[19]!==g?(q=(0,u.jsx)(An,{assistant:n,failed:l,onGenerated:g}),e[17]=n,e[18]=l,e[19]=g,e[20]=q):q=e[20],e[21]!==n||e[22]!==r.length||e[23]!==m||e[24]!==f||e[25]!==v?(T=m!==null&&(0,u.jsx)(Kn,{onAccept:f,onCancel:v,rpc:n,source:m.text,whole:m.start===0&&m.end===r.length},`${m.start.toString()}-${m.end.toString()}`),e[21]=n,e[22]=r.length,e[23]=m,e[24]=f,e[25]=v,e[26]=T):T=e[26],N="flex min-h-0 min-w-0 flex-1",S="true",w="shrink-0 select-none overflow-hidden border-e border-border bg-muted/30 py-3 text-end font-mono text-xs leading-5 text-muted-foreground/60",C=c,b=Bn,k=Array.from({length:z},Yn),e[0]=n,e[1]=r,e[2]=l,e[3]=c,e[4]=m,e[5]=f,e[6]=v,e[7]=g,e[8]=S,e[9]=w,e[10]=C,e[11]=b,e[12]=k,e[13]=N,e[14]=R,e[15]=q,e[16]=T}else S=e[8],w=e[9],C=e[10],b=e[11],k=e[12],N=e[13],R=e[14],q=e[15],T=e[16];let L;e[27]!==S||e[28]!==w||e[29]!==C||e[30]!==b||e[31]!==k?(L=(0,u.jsx)("div",{"aria-hidden":S,className:w,ref:C,style:b,children:k}),e[27]=S,e[28]=w,e[29]=C,e[30]=b,e[31]=k,e[32]=L):L=e[32];let _;e[33]!==o||e[34]!==r||e[35]!==y?(_=(0,u.jsx)($n,{diagnostics:o,draft:r,scrollRef:y}),e[33]=o,e[34]=r,e[35]=y,e[36]=_):_=e[36];let I;e[37]!==t||e[38]!==p?(I=t===null?void 0:`${p}-opt-${t.active.toString()}`,e[37]=t,e[38]=p,e[39]=I):I=e[39];let H=t===null?void 0:p,B=t!==null,F;e[40]!==h?(F=h("SQL query"),e[40]=h,e[41]=F):F=e[41];let O;e[42]!==r||e[43]!==a||e[44]!==d.onBlur||e[45]!==d.onChange||e[46]!==d.onKeyDown||e[47]!==d.onScroll||e[48]!==d.onSelect||e[49]!==I||e[50]!==H||e[51]!==B||e[52]!==F?(O=(0,u.jsx)("textarea",{"aria-activedescendant":I,"aria-autocomplete":"list","aria-controls":H,"aria-expanded":B,"aria-label":F,className:`relative size-full resize-none bg-transparent outline-none ${Me}`,"data-testid":"sql-input",onBlur:d.onBlur,onChange:d.onChange,onKeyDown:d.onKeyDown,onScroll:d.onScroll,onSelect:d.onSelect,placeholder:"SELECT * FROM \u2026",ref:a,role:"combobox",spellCheck:!1,value:r}),e[42]=r,e[43]=a,e[44]=d.onBlur,e[45]=d.onChange,e[46]=d.onKeyDown,e[47]=d.onScroll,e[48]=d.onSelect,e[49]=I,e[50]=H,e[51]=B,e[52]=F,e[53]=O):O=e[53];let K;e[54]!==t||e[55]!==p||e[56]!==E?(K=(0,u.jsx)(cn,{listboxId:p,onPick:E,state:t}),e[54]=t,e[55]=p,e[56]=E,e[57]=K):K=e[57];let $;e[58]!==_||e[59]!==O||e[60]!==K?($=(0,u.jsxs)("div",{className:"relative min-w-0 flex-1 bg-background",children:[_,O,K]}),e[58]=_,e[59]=O,e[60]=K,e[61]=$):$=e[61];let D;e[62]!==L||e[63]!==$||e[64]!==N?(D=(0,u.jsxs)("div",{className:N,children:[L,$]}),e[62]=L,e[63]=$,e[64]=N,e[65]=D):D=e[65];let A;e[66]!==o||e[67]!==x?(A=(0,u.jsx)(Pn,{diagnostics:o,onSelect:x}),e[66]=o,e[67]=x,e[68]=A):A=e[68];let Q;return e[69]!==D||e[70]!==A||e[71]!==R||e[72]!==q||e[73]!==T?(Q=(0,u.jsxs)("div",{className:R,children:[q,T,D,A]}),e[69]=D,e[70]=A,e[71]=R,e[72]=q,e[73]=T,e[74]=Q):Q=e[74],Q},"zn");function Yn(s,e){return(0,u.jsx)("div",{children:e+1},e)}i(Yn,"Un");var at=[{label:"List tables",sql:"SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name;"},{label:"Table row count",sql:"SELECT COUNT(*) AS rows FROM messages;"},{label:"Recent rows",sql:"SELECT id, _creationTime, __doc__ FROM messages ORDER BY _creationTime DESC LIMIT 50;"},{label:"Index list",sql:"SELECT name, tbl_name FROM sqlite_master WHERE type = 'index' ORDER BY tbl_name;"}],Jn=i(s=>{let e=(0,X.c)(29),{active:n,onDelete:t,onSelect:o,query:r}=s,l=se(),d;e[0]!==o||e[1]!==r.id?(d=i(()=>{o(r.id)},"c"),e[0]=o,e[1]=r.id,e[2]=d):d=e[2];let a=d,c;e[3]!==t||e[4]!==r.id?(c=i(b=>{b.stopPropagation(),t(r.id)},"i"),e[3]=t,e[4]=r.id,e[5]=c):c=e[5];let m=c,p=n?"bg-sidebar-accent font-medium text-foreground":"text-muted-foreground",f;e[6]!==p?(f=ie("flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] outline-none transition-colors hover:bg-sidebar-accent focus-visible:bg-sidebar-accent",p),e[6]=p,e[7]=f):f=e[7];let v=`sql-query-${r.id}`,g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M4 6h16M4 12h10M4 18h7"})}),e[8]=g):g=e[8];let E;e[9]!==r.name?(E=(0,u.jsx)("span",{className:"truncate",children:r.name}),e[9]=r.name,e[10]=E):E=e[10];let x;e[11]!==n||e[12]!==a||e[13]!==f||e[14]!==v||e[15]!==E?(x=(0,u.jsxs)("button",{"aria-pressed":n,className:f,"data-testid":v,onClick:a,type:"button",children:[g,E]}),e[11]=n,e[12]=a,e[13]=f,e[14]=v,e[15]=E,e[16]=x):x=e[16];let y;e[17]!==l?(y=l("Delete query"),e[17]=l,e[18]=y):y=e[18];let h;e[19]!==l?(h=l("Delete query"),e[19]=l,e[20]=h):h=e[20];let S;e[21]===Symbol.for("react.memo_cache_sentinel")?(S=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"})}),e[21]=S):S=e[21];let w;e[22]!==m||e[23]!==h||e[24]!==y?(w=(0,u.jsx)("button",{"aria-label":y,className:"me-1 hidden size-6 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive group-hover/q:flex",onClick:m,title:h,type:"button",children:S}),e[22]=m,e[23]=h,e[24]=y,e[25]=w):w=e[25];let C;return e[26]!==w||e[27]!==x?(C=(0,u.jsxs)("li",{className:"group/q flex items-center",children:[x,w]}),e[26]=w,e[27]=x,e[28]=C):C=e[28],C},"jn"),Ge="sql-history-remember",Vn=i((s,e)=>{let n=e.trim().toLowerCase();return n===""?[...s]:s.filter(t=>t.name.toLowerCase().includes(n))},"Qn"),Gn=i(s=>{let e=(0,X.c)(66),{activeId:n,history:t,listRef:o,onClearHistory:r,onDelete:l,onLoadHistory:d,onLoadTemplate:a,onNew:c,onSearchChange:m,onSelect:p,onToggleRememberHistory:f,queries:v,rememberHistory:g,search:E}=s,x=se(),y,h,S,w,C;if(e[0]!==n||e[1]!==o||e[2]!==l||e[3]!==c||e[4]!==m||e[5]!==p||e[6]!==f||e[7]!==v||e[8]!==E||e[9]!==x){let I=Vn(v,E),H;e[15]!==f?(H=i(z=>{f(z.target.checked)},"M"),e[15]=f,e[16]=H):H=e[16],y=H,S="flex h-full w-64 shrink-0 flex-col border-e border-border bg-sidebar";let B;e[17]!==x?(B=x("Search queries\u2026"),e[17]=x,e[18]=B):B=e[18];let F;e[19]!==m||e[20]!==E||e[21]!==B?(F=(0,u.jsx)("input",{className:"h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"sql-search",onChange:m,placeholder:B,type:"text",value:E}),e[19]=m,e[20]=E,e[21]=B,e[22]=F):F=e[22];let O;e[23]!==x?(O=x("New query"),e[23]=x,e[24]=O):O=e[24];let K;e[25]!==x?(K=x("New query"),e[25]=x,e[26]=K):K=e[26];let $;e[27]===Symbol.for("react.memo_cache_sentinel")?($=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M12 5v14M5 12h14"})}),e[27]=$):$=e[27];let D;e[28]!==c||e[29]!==O||e[30]!==K?(D=(0,u.jsx)("button",{"aria-label":O,className:"flex size-8 shrink-0 items-center justify-center rounded-md border border-border text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"sql-new",onClick:c,title:K,type:"button",children:$}),e[28]=c,e[29]=O,e[30]=K,e[31]=D):D=e[31],e[32]!==D||e[33]!==F?(w=(0,u.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border p-2",children:[F,D]}),e[32]=D,e[33]=F,e[34]=w):w=e[34],h="flex flex-1 flex-col gap-4 overflow-y-auto p-2";let A;e[35]!==x?(A=x("Private"),e[35]=x,e[36]=A):A=e[36];let Q;e[37]!==A?(Q=(0,u.jsx)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:A}),e[37]=A,e[38]=Q):Q=e[38],C=(0,u.jsxs)("div",{children:[Q,I.length===0?(0,u.jsx)("p",{className:"px-1 py-2 text-xs text-muted-foreground","data-testid":"sql-private-empty",children:x("No saved queries yet \u2014 they save to this browser as you type.")}):(0,u.jsx)("ul",{className:"flex flex-col gap-px","data-testid":"sql-private",ref:o,children:I.map(z=>(0,u.jsx)(Jn,{active:n===z.id,onDelete:l,onSelect:p,query:z},z.id))})]}),e[0]=n,e[1]=o,e[2]=l,e[3]=c,e[4]=m,e[5]=p,e[6]=f,e[7]=v,e[8]=E,e[9]=x,e[10]=y,e[11]=h,e[12]=S,e[13]=w,e[14]=C}else y=e[10],h=e[11],S=e[12],w=e[13],C=e[14];let b;e[39]!==x?(b=x("Reference"),e[39]=x,e[40]=b):b=e[40];let k;e[41]!==b?(k=(0,u.jsx)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:b}),e[41]=b,e[42]=k):k=e[42];let N;e[43]!==a?(N=at.map(I=>(0,u.jsx)("li",{children:(0,u.jsxs)("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-foreground focus-visible:bg-sidebar-accent","data-sql":I.sql,onClick:a,type:"button",children:[(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M7 4h7l4 4v12H7zM14 4v4h4"})}),I.label]})},I.label)),e[43]=a,e[44]=N):N=e[44];let R;e[45]!==N?(R=(0,u.jsx)("ul",{className:"flex flex-col gap-px",children:N}),e[45]=N,e[46]=R):R=e[46];let q;e[47]!==k||e[48]!==R?(q=(0,u.jsxs)("div",{children:[k,R]}),e[47]=k,e[48]=R,e[49]=q):q=e[49];let T;e[50]!==t||e[51]!==r||e[52]!==d||e[53]!==y||e[54]!==g||e[55]!==x?(T=t.length>0&&(0,u.jsxs)("div",{children:[(0,u.jsxs)("div",{className:"flex items-center justify-between px-1 pb-1",children:[(0,u.jsx)("p",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:x("History")}),(0,u.jsx)("button",{className:"rounded px-1 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:text-foreground","data-testid":"sql-history-clear",onClick:r,type:"button",children:x("Clear history")})]}),(0,u.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 px-1 pb-1.5 text-[11px] text-muted-foreground",htmlFor:Ge,children:[(0,u.jsx)("input",{checked:g,"data-testid":"sql-history-remember",id:Ge,onChange:y,type:"checkbox"}),x("Keep history on this browser")]}),(0,u.jsx)("ul",{className:"flex flex-col gap-px","data-testid":"sql-history",children:t.map(I=>(0,u.jsx)("li",{children:(0,u.jsxs)("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-foreground focus-visible:bg-sidebar-accent","data-sql":I.sql,"data-testid":"sql-history-item",onClick:d,title:I.sql,type:"button",children:[(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M12 8v4l3 2M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18Z"})}),(0,u.jsx)("span",{className:"truncate font-mono",children:I.sql})]})},`${I.at.toString()}:${I.sql}`))})]}),e[50]=t,e[51]=r,e[52]=d,e[53]=y,e[54]=g,e[55]=x,e[56]=T):T=e[56];let L;e[57]!==h||e[58]!==T||e[59]!==C||e[60]!==q?(L=(0,u.jsxs)("div",{className:h,children:[C,q,T]}),e[57]=h,e[58]=T,e[59]=C,e[60]=q,e[61]=L):L=e[61];let _;return e[62]!==L||e[63]!==S||e[64]!==w?(_=(0,u.jsxs)("aside",{className:S,children:[w,L]}),e[62]=L,e[63]=S,e[64]=w,e[65]=_):_=e[65],_},"Yn"),Ce=i(s=>`border-b-2 px-3 py-2 text-sm outline-none transition-colors ${s?"border-foreground font-medium text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,"ve"),Un=i(s=>{let e=(0,X.c)(97),{assistant:n,chart:t,className:o,durationMs:r,error:l,onFormat:d,onInferChart:a,onRun:c,onSelectStatement:m,onShardKeyChange:p,onShowChart:f,onShowExplain:v,onShowResults:g,onToggleSplit:E,pane:x,result:y,running:h,script:S,shardKey:w,splitView:C}=s,b=se(),k=x==="results",N;e[0]!==k?(N=Ce(k),e[0]=k,e[1]=N):N=e[1];let R;e[2]!==b?(R=b("Results"),e[2]=b,e[3]=R):R=e[3];let q;e[4]!==g||e[5]!==N||e[6]!==R?(q=(0,u.jsx)("button",{className:N,"data-testid":"sql-tab-results",onClick:g,type:"button",children:R}),e[4]=g,e[5]=N,e[6]=R,e[7]=q):q=e[7];let T=x==="chart",L;e[8]!==T?(L=Ce(T),e[8]=T,e[9]=L):L=e[9];let _;e[10]!==b?(_=b("Chart"),e[10]=b,e[11]=_):_=e[11];let I;e[12]!==f||e[13]!==L||e[14]!==_?(I=(0,u.jsx)("button",{className:L,"data-testid":"sql-tab-chart",onClick:f,type:"button",children:_}),e[12]=f,e[13]=L,e[14]=_,e[15]=I):I=e[15];let H;e[16]!==n||e[17]!==a||e[18]!==x||e[19]!==y||e[20]!==b?(H=!n.unavailable&&x==="chart"&&y!==null&&(0,u.jsx)("button",{className:Ce(!1),"data-testid":"sql-infer-chart",disabled:n.pending("chart"),onClick:a,type:"button",children:n.pending("chart")?b("Thinking\u2026"):b("Suggest chart")}),e[16]=n,e[17]=a,e[18]=x,e[19]=y,e[20]=b,e[21]=H):H=e[21];let B=x==="explain",F;e[22]!==B?(F=Ce(B),e[22]=B,e[23]=F):F=e[23];let O;e[24]!==b?(O=b("Explain"),e[24]=b,e[25]=O):O=e[25];let K;e[26]!==v||e[27]!==F||e[28]!==O?(K=(0,u.jsx)("button",{className:F,"data-testid":"sql-tab-explain",onClick:v,type:"button",children:O}),e[26]=v,e[27]=F,e[28]=O,e[29]=K):K=e[29];let $;e[30]!==b?($=b("Split editor and results"),e[30]=b,e[31]=$):$=e[31];let D=`inline-flex items-center rounded-md border border-border px-2 py-1.5 outline-none transition-colors hover:bg-accent focus-visible:bg-accent ${C?"bg-accent text-foreground":"text-muted-foreground"}`,A;e[32]!==b?(A=b("Split editor and results"),e[32]=b,e[33]=A):A=e[33];let Q;e[34]===Symbol.for("react.memo_cache_sentinel")?(Q=(0,u.jsxs)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:[(0,u.jsx)("rect",{height:"16",rx:"2",width:"18",x:"3",y:"4"}),(0,u.jsx)("path",{d:"M12 4v16"})]}),e[34]=Q):Q=e[34];let z;e[35]!==E||e[36]!==C||e[37]!==$||e[38]!==D||e[39]!==A?(z=(0,u.jsx)("button",{"aria-label":$,"aria-pressed":C,className:D,"data-testid":"sql-split-toggle",onClick:E,title:A,type:"button",children:Q}),e[35]=E,e[36]=C,e[37]=$,e[38]=D,e[39]=A,e[40]=z):z=e[40];let re;e[41]!==y?(re=y!==null&&y.columns.length>0&&(0,u.jsx)(He,{columns:y.columns,name:"query-result",rows:y.rows}),e[41]=y,e[42]=re):re=e[42];let Z;e[43]!==b?(Z=b("Format"),e[43]=b,e[44]=Z):Z=e[44];let oe;e[45]!==d||e[46]!==h||e[47]!==Z?(oe=(0,u.jsx)("button",{className:"inline-flex items-center rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50","data-testid":"sql-format",disabled:h,onClick:d,type:"button",children:Z}),e[45]=d,e[46]=h,e[47]=Z,e[48]=oe):oe=e[48];let M;e[49]!==p||e[50]!==w?(M=(0,u.jsx)(Pe,{onChange:p,testId:"sql-shard-input",value:w}),e[49]=p,e[50]=w,e[51]=M):M=e[51];let Y;e[52]!==h||e[53]!==b?(Y=b(h?"Running\u2026":"Run"),e[52]=h,e[53]=b,e[54]=Y):Y=e[54];let U;e[55]===Symbol.for("react.memo_cache_sentinel")?(U=(0,u.jsx)("kbd",{className:"rounded border border-primary-foreground/30 px-1 font-sans text-[10px]",children:"\u2318\u21B5"}),e[55]=U):U=e[55];let W;e[56]!==c||e[57]!==h||e[58]!==Y?(W=(0,u.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"sql-run",disabled:h,onClick:c,type:"button",children:[Y,U]}),e[56]=c,e[57]=h,e[58]=Y,e[59]=W):W=e[59];let J;e[60]!==z||e[61]!==re||e[62]!==oe||e[63]!==M||e[64]!==W?(J=(0,u.jsxs)("div",{className:"ms-auto flex items-center gap-2",children:[z,re,oe,M,W]}),e[60]=z,e[61]=re,e[62]=oe,e[63]=M,e[64]=W,e[65]=J):J=e[65];let G;e[66]!==K||e[67]!==J||e[68]!==q||e[69]!==I||e[70]!==H?(G=(0,u.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border pe-2",children:[q,I,H,K,J]}),e[66]=K,e[67]=J,e[68]=q,e[69]=I,e[70]=H,e[71]=G):G=e[71];let ee;e[72]!==m||e[73]!==S?(ee=S!==void 0&&(0,u.jsx)("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-border px-3 py-1.5","data-testid":"sql-statements",children:S.runs.map((ce,de)=>(0,u.jsx)("button",{"aria-pressed":de===S.selected,className:`rounded-md border px-2 py-0.5 font-mono text-[11px] outline-none transition-colors ${de===S.selected?"border-foreground text-foreground":"border-border text-muted-foreground hover:text-foreground"} ${ce.error===null?"":"border-destructive/50 text-destructive"}`,"data-testid":`sql-statement-${de.toString()}`,onClick:i(()=>{m(de)},"onClick"),title:ce.sql,type:"button",children:de+1},`${de.toString()}:${ce.sql}`))}),e[72]=m,e[73]=S,e[74]=ee):ee=e[74];let le;e[75]!==l?(le=l!==null&&(0,u.jsx)(je,{className:"m-3 font-mono text-xs",testId:"sql-error",variant:"destructive",children:l}),e[75]=l,e[76]=le):le=e[76];let te;e[77]!==l||e[78]!==y||e[79]!==b?(te=l===null&&y===null&&(0,u.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-empty",children:b("Click Run to execute your query.")}),e[77]=l,e[78]=y,e[79]=b,e[80]=te):te=e[80];let P;e[81]!==t||e[82]!==r||e[83]!==l||e[84]!==x||e[85]!==y||e[86]!==b?(P=l===null&&y!==null&&(0,u.jsxs)("div",{"data-testid":"sql-result",children:[x==="chart"?(0,u.jsx)(Fe,{axes:t,result:y}):(0,u.jsx)(Ke,{result:y}),(0,u.jsxs)("p",{className:"border-t border-border px-3 py-1.5 text-xs text-muted-foreground","data-testid":"sql-count",children:[y.truncated?b("Showing the first {max} rows.",{max:y.rows.length}):b("{count} rows",{count:y.rowCount}),r!==void 0&&` \xB7 ${b("{ms} ms",{ms:Math.round(r)})}`]})]}),e[81]=t,e[82]=r,e[83]=l,e[84]=x,e[85]=y,e[86]=b,e[87]=P):P=e[87];let V;e[88]!==le||e[89]!==te||e[90]!==P?(V=(0,u.jsxs)("div",{className:"min-h-0 flex-1 overflow-auto",children:[le,te,P]}),e[88]=le,e[89]=te,e[90]=P,e[91]=V):V=e[91];let ne;return e[92]!==o||e[93]!==G||e[94]!==ee||e[95]!==V?(ne=(0,u.jsxs)("div",{className:o,children:[G,ee,V]}),e[92]=o,e[93]=G,e[94]=ee,e[95]=V,e[96]=ne):ne=e[96],ne},"Gn"),Xn=i((s,e)=>s.trim()===""?e:(s.split(`
15
+ `)[0]??s).slice(0,24),"Jn"),Zn=i(s=>{s?.focus(),s?.select()},"Vn"),eo=i(s=>{let e=(0,X.c)(14),{initial:n,onCancel:t,onCommit:o,placeholder:r,testId:l}=s,d=se(),a;e[0]!==o?(a=i(g=>{o(g.currentTarget.value.trim())},"a"),e[0]=o,e[1]=a):a=e[1];let c=a,m;e[2]!==t||e[3]!==o?(m=i(g=>{g.key==="Enter"?o(g.currentTarget.value.trim()):g.key==="Escape"&&t()},"u"),e[2]=t,e[3]=o,e[4]=m):m=e[4];let p=m,f;e[5]!==d?(f=d("Tab title"),e[5]=d,e[6]=f):f=e[6];let v;return e[7]!==n||e[8]!==c||e[9]!==p||e[10]!==r||e[11]!==f||e[12]!==l?(v=(0,u.jsx)("input",{"aria-label":f,className:"w-40 rounded border border-ring bg-background px-1 py-0.5 text-xs outline-none","data-testid":l,defaultValue:n,onBlur:c,onKeyDown:p,placeholder:r,ref:Zn,type:"text"}),e[7]=n,e[8]=c,e[9]=p,e[10]=r,e[11]=f,e[12]=l,e[13]=v):v=e[13],v},"Xn"),to=i(s=>{let e=(0,X.c)(29),{idBase:n,onDiscard:t,onKeep:o}=s,r=se(),l=`sql-tab-close-prompt-${n}`,d;e[0]!==r?(d=r("Discard?"),e[0]=r,e[1]=d):d=e[1];let a;e[2]!==d?(a=(0,u.jsx)("span",{className:"text-[11px] text-muted-foreground",children:d}),e[2]=d,e[3]=a):a=e[3];let c;e[4]!==r?(c=r("Discard changes"),e[4]=r,e[5]=c):c=e[5];let m=`sql-tab-close-confirm-${n}`,p;e[6]!==r?(p=r("Discard changes"),e[6]=r,e[7]=p):p=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.4,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M5 13l4 4L19 7"})}),e[8]=f):f=e[8];let v;e[9]!==t||e[10]!==c||e[11]!==m||e[12]!==p?(v=(0,u.jsx)("button",{"aria-label":c,className:"flex size-5 items-center justify-center rounded text-destructive hover:bg-destructive/10","data-testid":m,onClick:t,title:p,type:"button",children:f}),e[9]=t,e[10]=c,e[11]=m,e[12]=p,e[13]=v):v=e[13];let g;e[14]!==r?(g=r("Keep editing"),e[14]=r,e[15]=g):g=e[15];let E=`sql-tab-close-cancel-${n}`,x;e[16]!==r?(x=r("Keep editing"),e[16]=r,e[17]=x):x=e[17];let y;e[18]===Symbol.for("react.memo_cache_sentinel")?(y=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.4,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M6 6l12 12M18 6 6 18"})}),e[18]=y):y=e[18];let h;e[19]!==o||e[20]!==E||e[21]!==x||e[22]!==g?(h=(0,u.jsx)("button",{"aria-label":g,className:"flex size-5 items-center justify-center rounded text-muted-foreground hover:bg-accent","data-testid":E,onClick:o,title:x,type:"button",children:y}),e[19]=o,e[20]=E,e[21]=x,e[22]=g,e[23]=h):h=e[23];let S;return e[24]!==l||e[25]!==h||e[26]!==a||e[27]!==v?(S=(0,u.jsxs)("span",{className:"flex shrink-0 items-center gap-1","data-testid":l,role:"group",children:[a,v,h]}),e[24]=l,e[25]=h,e[26]=a,e[27]=v,e[28]=S):S=e[28],S},"Zn"),no=i(s=>{let e=(0,X.c)(47),{active:n,canClose:t,onClose:o,onMenu:r,onRename:l,onSelect:d,tab:a}=s,c=se(),[m,p]=(0,j.useState)(!1),[f,v]=(0,j.useState)(!1),g;e[0]!==r||e[1]!==a.id?(g=i(z=>{r(a.id,z)},"b"),e[0]=r,e[1]=a.id,e[2]=g):g=e[2];let E=g,x;e[3]!==d||e[4]!==a.id?(x=i(()=>{d(a.id)},"m"),e[3]=d,e[4]=a.id,e[5]=x):x=e[5];let y=x,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=i(()=>{p(!0)},"p"),e[6]=h):h=e[6];let S=h,w;e[7]!==o||e[8]!==a?(w=i(z=>{z.stopPropagation(),lt(a)?v(!0):o(a.id)},"v"),e[7]=o,e[8]=a,e[9]=w):w=e[9];let C=w,b;e[10]!==o||e[11]!==a.id?(b=i(z=>{z.stopPropagation(),v(!1),o(a.id)},"h"),e[10]=o,e[11]=a.id,e[12]=b):b=e[12];let k=b,N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=i(z=>{z.stopPropagation(),v(!1)},"T"),e[13]=N):N=e[13];let R=N,q;e[14]!==l||e[15]!==a.id?(q=i(z=>{l(a.id,z),p(!1)},"R"),e[14]=l,e[15]=a.id,e[16]=q):q=e[16];let T=q,L;e[17]===Symbol.for("react.memo_cache_sentinel")?(L=i(()=>{p(!1)},"_"),e[17]=L):L=e[17];let _=L,I;e[18]!==a.name?(I=a.name.trim(),e[18]=a.name,e[19]=I):I=e[19];let H=I,B;e[20]!==c||e[21]!==a.sql?(B=Xn(a.sql,c("Untitled")),e[20]=c,e[21]=a.sql,e[22]=B):B=e[22];let F=B,O=n?"bg-background text-foreground":"bg-muted/40 text-muted-foreground hover:text-foreground",K;e[23]!==O?(K=ie("group/tab flex shrink-0 items-center gap-1 border-e border-border ps-3 pe-1.5 text-xs",O),e[23]=O,e[24]=K):K=e[24];let $=`sql-tab-${a.id}`,D;e[25]!==n||e[26]!==T||e[27]!==H||e[28]!==F||e[29]!==m||e[30]!==y||e[31]!==c||e[32]!==a.id?(D=m?(0,u.jsx)(eo,{initial:H,onCancel:_,onCommit:T,placeholder:F,testId:`sql-tab-rename-${a.id}`}):(0,u.jsx)("button",{"aria-pressed":n,className:"max-w-40 truncate py-1.5 outline-none","data-testid":`sql-tab-select-${a.id}`,onClick:y,onDoubleClick:S,title:c("Double-click to rename"),type:"button",children:H===""?F:H}),e[25]=n,e[26]=T,e[27]=H,e[28]=F,e[29]=m,e[30]=y,e[31]=c,e[32]=a.id,e[33]=D):D=e[33];let A;e[34]!==t||e[35]!==k||e[36]!==f||e[37]!==C||e[38]!==c||e[39]!==a.id?(A=t&&(f?(0,u.jsx)(to,{idBase:a.id,onDiscard:k,onKeep:R}):(0,u.jsx)("button",{"aria-label":c("Close tab"),className:"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive","data-testid":`sql-tab-close-${a.id}`,onClick:C,title:c("Close tab"),type:"button",children:(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M6 6l12 12M18 6 6 18"})})})),e[34]=t,e[35]=k,e[36]=f,e[37]=C,e[38]=c,e[39]=a.id,e[40]=A):A=e[40];let Q;return e[41]!==E||e[42]!==K||e[43]!==$||e[44]!==D||e[45]!==A?(Q=(0,u.jsxs)("div",{className:K,"data-testid":$,onContextMenu:E,children:[D,A]}),e[41]=E,e[42]=K,e[43]=$,e[44]=D,e[45]=A,e[46]=Q):Q=e[46],Q},"es"),oo=i(s=>{let e=(0,X.c)(43),{model:n,onSelect:t}=s,o=se(),{activeTab:r,addEditorTab:l,cancelBulk:d,closeEditorTab:a,closeTabMenu:c,confirmBulk:m,menuStyle:p,onBackdropContextMenu:f,onCloseAll:v,onCloseOthers:g,onCloseToRight:E,openTabMenu:x,pendingBulk:y,renameTab:h,tabMenu:S,tabs:w}=n,C;if(e[0]!==r||e[1]!==a||e[2]!==t||e[3]!==x||e[4]!==h||e[5]!==w){let I;e[7]!==r||e[8]!==a||e[9]!==t||e[10]!==x||e[11]!==h||e[12]!==w.length?(I=i(H=>(0,u.jsx)(no,{active:H.id===r.id,canClose:w.length>1,onClose:a,onMenu:x,onRename:h,onSelect:t,tab:H},H.id),"A"),e[7]=r,e[8]=a,e[9]=t,e[10]=x,e[11]=h,e[12]=w.length,e[13]=I):I=e[13],C=w.map(I),e[0]=r,e[1]=a,e[2]=t,e[3]=x,e[4]=h,e[5]=w,e[6]=C}else C=e[6];let b;e[14]!==o?(b=o("New tab"),e[14]=o,e[15]=b):b=e[15];let k=w.length>=De,N;e[16]!==o?(N=o("New tab"),e[16]=o,e[17]=N):N=e[17];let R;e[18]===Symbol.for("react.memo_cache_sentinel")?(R=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M12 5v14M5 12h14"})}),e[18]=R):R=e[18];let q;e[19]!==l||e[20]!==b||e[21]!==k||e[22]!==N?(q=(0,u.jsx)("button",{"aria-label":b,className:"flex size-8 shrink-0 items-center justify-center text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-add",disabled:k,onClick:l,title:N,type:"button",children:R}),e[19]=l,e[20]=b,e[21]=k,e[22]=N,e[23]=q):q=e[23];let T;e[24]!==C||e[25]!==q?(T=(0,u.jsxs)("div",{className:"flex shrink-0 items-stretch overflow-x-auto border-b border-border bg-muted/30","data-testid":"sql-tab-strip",role:"tablist",children:[C,q]}),e[24]=C,e[25]=q,e[26]=T):T=e[26];let L;e[27]!==d||e[28]!==c||e[29]!==m||e[30]!==p||e[31]!==f||e[32]!==v||e[33]!==g||e[34]!==E||e[35]!==y||e[36]!==o||e[37]!==S||e[38]!==w?(L=S!==null&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{className:"fixed inset-0 z-40","data-testid":"sql-tab-menu-backdrop",onClick:c,onContextMenu:f,role:"presentation"}),(0,u.jsx)("div",{className:"fixed z-50 min-w-44 rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-md","data-testid":"sql-tab-menu",role:"menu",style:p,children:y===null?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-menu-close-others",disabled:w.length<=1,onClick:g,role:"menuitem",type:"button",children:o("Close other tabs")}),(0,u.jsx)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-menu-close-right",disabled:w.findIndex(I=>I.id===S.id)>=w.length-1,onClick:E,role:"menuitem",type:"button",children:o("Close tabs to the right")}),(0,u.jsx)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-tab-menu-close-all",onClick:v,role:"menuitem",type:"button",children:o("Close all tabs")})]}):(0,u.jsxs)("div",{className:"px-3 py-1.5","data-testid":"sql-tab-menu-confirm",children:[(0,u.jsx)("p",{className:"pb-1.5 text-xs text-muted-foreground",children:o("Discard unsaved tabs?")}),(0,u.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,u.jsx)("button",{className:"rounded px-2 py-1 text-xs font-medium text-destructive outline-none hover:bg-destructive/10 focus-visible:bg-destructive/10","data-testid":"sql-tab-menu-confirm-discard",onClick:m,type:"button",children:o("Discard")}),(0,u.jsx)("button",{className:"rounded px-2 py-1 text-xs text-muted-foreground outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-tab-menu-confirm-cancel",onClick:d,type:"button",children:o("Cancel")})]})]})})]}),e[27]=d,e[28]=c,e[29]=m,e[30]=p,e[31]=f,e[32]=v,e[33]=g,e[34]=E,e[35]=y,e[36]=o,e[37]=S,e[38]=w,e[39]=L):L=e[39];let _;return e[40]!==T||e[41]!==L?(_=(0,u.jsxs)(u.Fragment,{children:[T,L]}),e[40]=T,e[41]=L,e[42]=_):_=e[42],_},"ts"),ro=me(he.runSql),so="lunora-studio-sql-split-view",lo=i(()=>ge(at[0]?.sql??""),"os"),io=i(()=>performance.now(),"ls"),ao=i(()=>{let s=(0,X.c)(2),e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=new Map,s[0]=e):e=s[0];let n=(0,j.useRef)(e),t;return s[1]===Symbol.for("react.memo_cache_sentinel")?(t={advance:i(o=>{n.current.set(o,(n.current.get(o)??0)+1)},"advance"),begin:i(o=>{let r=n.current.get(o)??0;return()=>(n.current.get(o)??0)===r},"begin")},s[1]=t):t=s[1],t},"rs"),Do=i(({initialShardKey:s,now:e=io})=>{let n=xe(),t=En(lo),{activeTab:o,output:r,patchActiveOutput:l,patchActiveTab:d,setActiveTabId:a,unlinkQuery:c}=t,m=ao(),p=Dn({loadIntoActiveTab:i((W,J)=>{m.advance(o.id),d({activeId:J,sql:W}),l({chart:void 0,durationMs:void 0,error:null,failed:void 0,result:null,running:!1,script:void 0})},"loadIntoActiveTab"),unlinkQuery:c}),{recordHistory:f,updateQuerySql:v}=p,g=o.sql,{activeId:E}=o,{chart:x,error:y,failed:h,result:S,running:w}=r,C=r.pane,[b,k]=(0,j.useState)(s??""),[N,R]=ye(so,!1),{probe:q,schema:T}=mn(b),L=i(W=>{d({sql:W}),E!==null&&v(E,W)},"L"),_=Vt(g,T,b),I=We(b),H=i(()=>{S!==null&&ae((async()=>{let W=await I.inferChart({columns:S.columns,rowCount:S.rowCount,types:Object.fromEntries(S.columns.map(J=>[J,typeof(S.rows[0]?.[J]??"")]))});l({chart:W})})())},"W"),B=i(async W=>{let J=e();try{let G=await n.query(ro,{sql:W},fe(b)),ee=e()-J;return f(W),{durationMs:ee,error:null,result:G,sql:W}}catch(G){return{error:Ae(G),result:null,sql:W}}},"K"),F=i(async W=>{if(g.trim()==="")return;let J=m.begin(o.id);l({running:!0});let G=W==="explain"?_e(St(g),0):tt(g),ee=[];for(let P of G){let V={error:P.rejection?.message??"",result:null,sql:P.sql};ee.push(P.rejection===void 0?await B(P.sql):V)}if(Oe(b),!J())return;let le=Math.max(ee.length-1,0),te=ee[le];l({chart:void 0,durationMs:te?.durationMs,error:te?.error??null,failed:te?.error===null||te===void 0?void 0:{error:te.error,sql:te.sql},pane:W,result:te?.result??null,running:!1,script:ee.length>1?{runs:ee,selected:le}:void 0})},"$"),O=i(W=>{let J=r.script?.runs,G=J?.[W];J===void 0||G===void 0||l({chart:void 0,durationMs:G.durationMs,error:G.error,failed:G.error===null?void 0:{error:G.error,sql:G.sql},result:G.result,script:{runs:J,selected:W}})},"F"),K=i(()=>{ae(F("results"))},"H"),$=bn({inlineEditEnabled:!I.unavailable,onSubmit:i(()=>{ae(F(r.pane))},"onSubmit"),probe:q,schema:T,setDraft:L}),{closeAutocomplete:D,closeInlineEdit:A}=$,Q=i(()=>{L(Tt(g))},"P"),z=i(W=>{D(),A(),a(W)},"oe"),re=i(()=>{l({pane:"results"})},"Z"),Z=i(()=>{ae(F("explain"))},"ne"),oe=i(()=>{l({pane:"chart"})},"q"),M=i(()=>{R(!N)},"j"),Y=N?"flex min-h-0 flex-1 flex-row":"flex min-h-0 flex-1 flex-col",U=N?"flex w-2/5 min-h-0 min-w-0 shrink-0 flex-col border-s border-border":"flex h-2/5 min-h-0 shrink-0 flex-col border-t border-border";return(0,u.jsxs)("div",{className:"flex h-full min-w-0","data-testid":"lunora-sql-editor",children:[(0,u.jsx)(Gn,{activeId:E,history:p.history,listRef:p.listRef,onClearHistory:p.clearHistory,onDelete:p.deleteQuery,onLoadHistory:p.loadFromHistory,onLoadTemplate:p.loadTemplate,onNew:p.newQuery,onSearchChange:p.onSearchChange,onSelect:p.selectQuery,onToggleRememberHistory:p.setRememberHistory,queries:p.queries,rememberHistory:p.rememberHistory,search:p.search}),(0,u.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,u.jsx)(oo,{model:t,onSelect:z}),(0,u.jsxs)("div",{className:Y,children:[(0,u.jsx)(Qn,{assistant:I,autocomplete:$.autocompleteState,diagnostics:_,draft:g,editorRef:$.editorRef,failed:h,gutterRef:$.gutterRef,handlers:$.handlers,inlineEdit:$.inlineEdit,listboxId:$.listboxId,onAcceptInlineEdit:$.acceptInlineEdit,onCancelInlineEdit:$.closeInlineEdit,onGenerated:L,onPickSuggestion:$.onPickSuggestion,onRevealDiagnostic:$.revealDiagnostic,overlayRef:$.overlayRef}),(0,u.jsx)(Un,{assistant:I,chart:x,className:U,durationMs:r.durationMs,error:y,onFormat:Q,onInferChart:H,onRun:K,onSelectStatement:O,onShardKeyChange:k,onShowChart:oe,onShowExplain:Z,onShowResults:re,onToggleSplit:M,pane:C,result:S,running:w,script:r.script,shardKey:b,splitView:N})]})]})]})},"Es");export{Do as SqlEditorPanel};
@@ -0,0 +1 @@
1
+ import{a as f,b as s,e as O}from"./chunk-OXFKZ4BM.js";var _=s(i=>{"use strict";var E=O();function o(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}f(o,"formatProdErrorMessage");function a(){}f(a,"noop");var n={d:{f:a,r:f(function(){throw Error(o(522))},"r"),D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},S=Symbol.for("react.portal"),T=Symbol.for("react.recoverable"),l=Symbol.for("react.optimistic_key");function P(r,e,t){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:S,key:c==null?null:c===l?l:""+c,children:r,containerInfo:e,implementation:t}}f(P,"createPortal$1");var y=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}f(u,"getCrossOriginStringAs");i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n;i.browser=function(r){return{$$typeof:T,_reason:r}};i.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(o(299));return P(r,e,null,t)};i.flushSync=function(r){var e=y.T,t=n.p;try{if(y.T=null,n.p=2,r)return r()}finally{y.T=e,n.p=t,n.d.f()}};i.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,n.d.C(r,e))};i.prefetchDNS=function(r){typeof r=="string"&&n.d.D(r)};i.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var t=e.as,c=u(t,e.crossOrigin),g=typeof e.integrity=="string"?e.integrity:void 0,d=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;t==="style"?n.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:c,integrity:g,fetchPriority:d}):t==="script"&&n.d.X(r,{crossOrigin:c,integrity:g,fetchPriority:d,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};i.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var t=u(e.as,e.crossOrigin);n.d.M(r,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0})}}else e==null&&n.d.M(r)};i.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var t=e.as,c=u(t,e.crossOrigin);n.d.L(r,t,{crossOrigin:c,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};i.preloadModule=function(r,e){if(typeof r=="string")if(e){var t=u(e.as,e.crossOrigin);n.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0})}else n.d.m(r)};i.requestFormReset=function(r){n.d.r(r)};i.unstable_batchedUpdates=function(r,e){return r(e)};i.useFormState=function(r,e,t){return y.H.useFormState(r,e,t)};i.useFormStatus=function(){return y.H.useHostTransitionStatus()};i.version="19.3.0"});var R=s((C,m)=>{"use strict";function v(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(v)}catch(r){console.error(r)}}f(v,"checkDCE");v(),m.exports=_()});export{R as a};
@@ -0,0 +1 @@
1
+ import{a as r,c as o}from"./chunk-6M7FLLMT.js";import{a as e}from"./chunk-OXFKZ4BM.js";var a="lunora:traces:pending-filter",i=e(s=>{o(a,s,"session")},"i"),d=e(()=>{let s=r("session");if(s!==void 0)try{let n=s.getItem(a);if(n===null)return;let t=JSON.parse(n);return typeof t.traceId!="string"?void 0:{traceId:t.traceId,...typeof t.shardKey=="string"?{shardKey:t.shardKey}:{}}}catch{return}},"c"),p=e(()=>{try{r("session")?.removeItem(a)}catch{}},"d");export{i as a,d as b,p as c};
@@ -0,0 +1 @@
1
+ import{a as le,d as ae,e as ke,i as Ne,j as we,l as Se}from"./chunk-MFNO5BFR.js";import"./chunk-SYGCASPT.js";import"./chunk-CTE6RPXC.js";import"./chunk-LIGOLZND.js";import"./chunk-3GXPALXG.js";import{a as ye}from"./chunk-SJLEEYCR.js";import"./chunk-AP4PC2M4.js";import"./chunk-KRPXOSBL.js";import"./chunk-W2BCSK5S.js";import{a as ne}from"./chunk-HKLF627N.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import{i as ue}from"./chunk-LUHXNZI4.js";import"./chunk-ZTOREMGH.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as oe}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{p as ge}from"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import{a as re}from"./chunk-3Y5K3IQO.js";import{a as be,b as xe,c as ve,d as J,e as T,f as _}from"./chunk-CW57Q264.js";import{a as fe,e as he}from"./chunk-MD67S53Z.js";import{b as me,f as Y,s as pe}from"./chunk-LPINY2IJ.js";import{a as c,d as te,e as Ae,f as qe,g as je}from"./chunk-OXFKZ4BM.js";var z=te(qe(),1);var E=te(Ae(),1);var o=te(je(),1);var Le=["call","schedule","read","write","enqueue","publish","subscribe","start","trigger","invoke"],Me=new Set(["enqueue","publish","schedule","start","subscribe","trigger"]),$e={cron:1,function:2,http:0,queue:4,service:7,table:6,topic:3,workflow:5},Be={stroke:"var(--muted-foreground)"},De={fill:"var(--muted-foreground)",fontSize:10},Fe={fill:"var(--background)"},Q="",se=260,Oe=120,Ce=44,de=40,_e=12,ie=16,Re=c(r=>{if(typeof r!="object"||r===null)return;let e=r;return["edges","nodes","modules","unresolved"].every(d=>Array.isArray(e[d]))?e:void 0},"Ge"),ze={cron:c(()=>({to:"/schedule"}),"cron"),function:c(()=>({to:"/functions"}),"function"),http:c(()=>({to:"/api"}),"http"),queue:c(()=>({to:"/queues"}),"queue"),service:c(()=>({to:"/functions"}),"service"),table:c(r=>({search:{table:r.name},to:"/data"}),"table"),topic:c(()=>({to:"/queues"}),"topic"),workflow:c(()=>({to:"/workflows"}),"workflow")},Pe=c(r=>ze[r.kind](r),"Me"),H=c(r=>r.module??Q,"R"),Te=c((r,e,d)=>{let t=new Set;for(let a of r.nodes)(e===void 0||H(a)===e)&&t.add(a.id);if(e===void 0)return t;let l=new Set(t);for(let a of r.edges)d.has(a.kind)&&(t.has(a.from)&&l.add(a.to),t.has(a.to)&&l.add(a.from));return l},"Pe"),Ee=c((r,e,d,t)=>{let l=`lane:${r}`;return[{data:{label:e},id:l,position:{x:d*(se+Oe),y:0},selectable:!1,style:{height:Ce+t.length*(de+_e)+ie,width:se},type:"lane"},...t.map((a,i)=>({className:"flex cursor-pointer items-center truncate rounded-md border border-border bg-card px-2 text-xs text-foreground hover:border-ring",data:{label:`${a.detail??a.kind} \xB7 ${a.name}`,link:Pe(a)},extent:"parent",id:a.id,parentId:l,position:{x:ie,y:Ce+i*(de+_e)},style:{height:de,width:se-ie*2},type:"member"}))]},"Re"),He=c((r,e)=>{let d=Te(r,e.lane,e.kinds),t=new Map;for(let n of r.nodes)d.has(n.id)&&t.set(H(n),[...t.get(H(n))??[],n]);let l=[...r.modules.map(n=>({label:n.installed===!0?`${n.name} \xB7 ${e.componentLabel}`:n.name,lane:n.name})),{label:e.appLaneLabel,lane:Q}],a=[],i=0;for(let{label:n,lane:f}of l){let m=(t.get(f)??[]).toSorted((h,s)=>$e[h.kind]-$e[s.kind]||h.name.localeCompare(s.name));m.length>0&&(a.push(...Ee(f,n,i,m)),i+=1)}let u=[];for(let n of r.edges)e.kinds.has(n.kind)&&d.has(n.from)&&d.has(n.to)&&u.push({animated:Me.has(n.kind),id:`${n.from}|${n.kind}|${n.to}`,label:n.kind,labelBgStyle:Fe,labelStyle:De,source:n.from,style:Be,target:n.to,type:"smoothstep"});return{edges:u,nodes:a}},"Fe"),ce="*",Ve=c(r=>{let e=(0,z.c)(2),{data:d}=r,t=String(d.label),l;return e[0]!==t?(l=(0,o.jsx)("div",{className:"size-full rounded-lg border border-dashed border-border bg-background/60 px-3 py-2 text-xs font-medium text-muted-foreground",children:t}),e[0]=t,e[1]=l):l=e[1],l},"qe"),Ie={opacity:0},Ze=c(r=>{let e=(0,z.c)(10),{data:d}=r,t=ue(),{label:l,link:a}=d,i;e[0]!==a||e[1]!==t?(i=c(()=>{pe(t(a))},"u"),e[0]=a,e[1]=t,e[2]=i):i=e[2];let u=i,n;e[3]===Symbol.for("react.memo_cache_sentinel")?(n=(0,o.jsx)(ae,{isConnectable:!1,position:le.Left,style:Ie,type:"target"}),e[3]=n):n=e[3];let f;e[4]!==l||e[5]!==u?(f=(0,o.jsx)("button",{className:"size-full cursor-pointer truncate rounded-md text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",onClick:u,type:"button",children:l}),e[4]=l,e[5]=u,e[6]=f):f=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=(0,o.jsx)(ae,{isConnectable:!1,position:le.Right,style:Ie,type:"source"}),e[7]=m):m=e[7];let h;return e[8]!==f?(h=(0,o.jsxs)(o.Fragment,{children:[n,f,m]}),e[8]=f,e[9]=h):h=e[9],h},"je"),Ge={lane:Ve,member:Ze},Ke=c(r=>{let e=Re(r);return e===void 0?{kind:"error",message:"the response is not an architecture manifest"}:e.modules.length===0?{kind:"empty"}:{kind:"ready",spec:e}},"ze"),We=c(r=>{let e=(0,z.c)(54),{manifest:d}=r,t=Y(),l,a,i,u,n,f,m,h,s,p;if(e[0]!==d.modules||e[1]!==d.nodes||e[2]!==t){let P=new Map;for(let g of d.nodes)g.kind==="function"&&P.set(H(g),(P.get(H(g))??0)+1);let j=c(g=>P.get(g)??0,"I");n=j(Q),u=fe,p="overflow-hidden py-0",i=he,s="px-0",a=be,m="architecture-catalog";let I;e[13]!==t?(I=t("Module"),e[13]=t,e[14]=I):I=e[14];let L;e[15]!==I?(L=(0,o.jsx)(T,{children:I}),e[15]=I,e[16]=L):L=e[16];let A;e[17]!==t?(A=t("Description"),e[17]=t,e[18]=A):A=e[18];let q;e[19]!==A?(q=(0,o.jsx)(T,{children:A}),e[19]=A,e[20]=q):q=e[20];let v;e[21]!==t?(v=t("Owned tables"),e[21]=t,e[22]=v):v=e[22];let y;e[23]!==v?(y=(0,o.jsx)(T,{children:v}),e[23]=v,e[24]=y):y=e[24];let k;e[25]!==t?(k=t("Functions"),e[25]=t,e[26]=k):k=e[26];let N;e[27]!==k?(N=(0,o.jsx)(T,{children:k}),e[27]=k,e[28]=N):N=e[28],e[29]!==y||e[30]!==N||e[31]!==L||e[32]!==q?(h=(0,o.jsx)(xe,{children:(0,o.jsxs)(J,{children:[L,q,y,N]})}),e[29]=y,e[30]=N,e[31]=L,e[32]=q,e[33]=h):h=e[33],l=ve,f=d.modules.map(g=>(0,o.jsxs)(J,{"data-testid":`architecture-module-${g.name}`,children:[(0,o.jsxs)(_,{className:"font-mono text-xs",children:[g.name,g.installed===!0&&(0,o.jsx)(oe,{className:"ml-2","data-testid":`architecture-component-${g.name}`,variant:"outline",children:t("Component")})]}),(0,o.jsx)(_,{className:"text-xs text-muted-foreground",children:g.description??(g.installed===!0?t("Installed component"):"\u2014")}),(0,o.jsx)(_,{className:"font-mono text-xs text-muted-foreground",children:g.tables.length===0?"\u2014":g.tables.join(", ")}),(0,o.jsx)(_,{className:"text-xs",children:j(g.name)})]},g.name)),e[0]=d.modules,e[1]=d.nodes,e[2]=t,e[3]=l,e[4]=a,e[5]=i,e[6]=u,e[7]=n,e[8]=f,e[9]=m,e[10]=h,e[11]=s,e[12]=p}else l=e[3],a=e[4],i=e[5],u=e[6],n=e[7],f=e[8],m=e[9],h=e[10],s=e[11],p=e[12];let b;e[34]!==n||e[35]!==t?(b=n>0&&(0,o.jsxs)(J,{"data-testid":"architecture-module-app",children:[(0,o.jsx)(_,{className:"text-xs italic text-muted-foreground",children:t("Outside any module")}),(0,o.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,o.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,o.jsx)(_,{className:"text-xs",children:n})]}),e[34]=n,e[35]=t,e[36]=b):b=e[36];let x;e[37]!==l||e[38]!==f||e[39]!==b?(x=(0,o.jsxs)(l,{children:[f,b]}),e[37]=l,e[38]=f,e[39]=b,e[40]=x):x=e[40];let S;e[41]!==a||e[42]!==m||e[43]!==h||e[44]!==x?(S=(0,o.jsxs)(a,{"data-testid":m,children:[h,x]}),e[41]=a,e[42]=m,e[43]=h,e[44]=x,e[45]=S):S=e[45];let $;e[46]!==i||e[47]!==s||e[48]!==S?($=(0,o.jsx)(i,{className:s,children:S}),e[46]=i,e[47]=s,e[48]=S,e[49]=$):$=e[49];let C;return e[50]!==u||e[51]!==p||e[52]!==$?(C=(0,o.jsx)(u,{className:p,children:$}),e[50]=u,e[51]=p,e[52]=$,e[53]=C):C=e[53],C},"Ye"),Ye=c(r=>{let e=(0,z.c)(52),{manifest:d}=r,t=Y(),[l,a]=(0,E.useState)(ce),[i,u]=(0,E.useState)(Je),n;e[0]!==d.edges?(n=c(w=>d.edges.some(X=>X.kind===w),"s"),e[0]=d.edges,e[1]=n):n=e[1];let f=Le.filter(n),m;e[2]!==t?(m=t("Outside any module"),e[2]=t,e[3]=m):m=e[3];let h=m,s;e[4]!==t?(s=t("Component"),e[4]=t,e[5]=s):s=e[5];let p=s,b;e[6]!==h||e[7]!==p||e[8]!==i||e[9]!==l||e[10]!==d?(b=He(d,{appLaneLabel:h,componentLabel:p,kinds:i,...l===ce?{}:{lane:l}}),e[6]=h,e[7]=p,e[8]=i,e[9]=l,e[10]=d,e[11]=b):b=e[11];let{edges:x,nodes:S}=b,$=(0,E.useRef)(null),C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=c(w=>{a(w.target.value)},"_"),e[12]=C):C=e[12];let P=C,j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=c(w=>{u(X=>{let ee=new Set(X);return ee.delete(w)||ee.add(w),ee})},"I"),e[13]=j):j=e[13];let I=j,L="flex flex-col gap-2",A="architecture-diagram",q="flex flex-wrap items-center gap-2",v;e[14]!==t?(v=t("Module"),e[14]=t,e[15]=v):v=e[15];let y;e[16]!==t?(y=t("All modules"),e[16]=t,e[17]=y):y=e[17];let k;e[18]!==y?(k=(0,o.jsx)("option",{value:ce,children:y}),e[18]=y,e[19]=k):k=e[19];let N;e[20]!==d.modules?(N=d.modules.map(Qe),e[20]=d.modules,e[21]=N):N=e[21];let g;e[22]!==t?(g=t("Outside any module"),e[22]=t,e[23]=g):g=e[23];let M;e[24]!==g?(M=(0,o.jsx)("option",{value:Q,children:g}),e[24]=g,e[25]=M):M=e[25];let B;e[26]!==l||e[27]!==v||e[28]!==k||e[29]!==N||e[30]!==M?(B=(0,o.jsxs)("select",{"aria-label":v,className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"architecture-module-filter",onChange:P,value:l,children:[k,N,M]}),e[26]=l,e[27]=v,e[28]=k,e[29]=N,e[30]=M,e[31]=B):B=e[31];let D;e[32]!==x.length||e[33]!==t?(D=t("{count} edges shown",{count:x.length}),e[32]=x.length,e[33]=t,e[34]=D):D=e[34];let F;e[35]!==D?(F=(0,o.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"architecture-edge-count",children:D}),e[35]=D,e[36]=F):F=e[36];let V;e[37]!==i?(V=c(w=>(0,o.jsx)("button",{"aria-pressed":i.has(w),className:me("rounded-full border border-border px-2.5 py-0.5 text-xs",i.has(w)?"bg-muted":"text-muted-foreground line-through"),"data-testid":`architecture-kind-${w}`,onClick:c(()=>{I(w)},"onClick"),type:"button",children:w},w),"q"),e[37]=i,e[38]=V):V=e[38];let U=f.map(V),O;e[39]!==B||e[40]!==F||e[41]!==U?(O=(0,o.jsxs)("div",{className:q,children:[B,F,U]}),e[39]=B,e[40]=F,e[41]=U,e[42]=O):O=e[42];let Z,G,K;e[43]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,o.jsx)(Ne,{}),G=(0,o.jsx)(we,{showInteractive:!1}),K=(0,o.jsx)(Se,{containerRef:$,filenameBase:"architecture",testIdPrefix:"architecture"}),e[43]=Z,e[44]=G,e[45]=K):(Z=e[43],G=e[44],K=e[45]);let R;e[46]!==x||e[47]!==S?(R=(0,o.jsx)("div",{className:"h-[600px] w-full overflow-hidden border border-border bg-muted/20","data-testid":"architecture-canvas",ref:$,children:(0,o.jsxs)(ke,{edges:x,edgesFocusable:!1,fitView:!0,minZoom:.1,nodes:S,nodesConnectable:!1,nodesDraggable:!1,nodeTypes:Ge,children:[Z,G,K]})}),e[46]=x,e[47]=S,e[48]=R):R=e[48];let W;return e[49]!==O||e[50]!==R?(W=(0,o.jsxs)("section",{className:L,"data-testid":A,children:[O,R]}),e[49]=O,e[50]=R,e[51]=W):W=e[51],W},"Ve"),mt=c(r=>{let e=(0,z.c)(28),{manifest:d}=r,t=Y(),l=ge(),a;e[0]!==l?(a=c(()=>l.fetchArchitecture(),"r"),e[0]=l,e[1]=a):a=e[1];let i=ye(d,a,Ke);if(i.kind==="loading"){let s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,o.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"architecture-loading",children:[(0,o.jsx)(ne,{className:"h-8 w-48"}),(0,o.jsx)(ne,{className:"h-64 w-full"})]}),e[2]=s):s=e[2],s}if(i.kind==="error"){let s;e[3]!==i.message||e[4]!==t?(s=t("Couldn't load the architecture manifest: {message}",{message:i.message}),e[3]=i.message,e[4]=t,e[5]=s):s=e[5];let p;e[6]!==t?(p=t("Architecture unavailable"),e[6]=t,e[7]=p):p=e[7];let b;return e[8]!==s||e[9]!==p?(b=(0,o.jsx)(re,{description:s,testId:"architecture-error",title:p}),e[8]=s,e[9]=p,e[10]=b):b=e[10],b}if(i.kind==="empty"){let s;e[11]!==t?(s=t("Add a lunora/<folder>/module.ts that default-exports defineModule(...) and run lunora codegen to map your modules here. Installed components join the map once you declare one."),e[11]=t,e[12]=s):s=e[12];let p;e[13]!==t?(p=t("No modules declared"),e[13]=t,e[14]=p):p=e[14];let b;return e[15]!==s||e[16]!==p?(b=(0,o.jsx)(re,{description:s,testId:"architecture-empty",title:p}),e[15]=s,e[16]=p,e[17]=b):b=e[17],b}let{spec:u}=i,n,f;e[18]!==u?(n=(0,o.jsx)(We,{manifest:u}),f=(0,o.jsx)(Ye,{manifest:u}),e[18]=u,e[19]=n,e[20]=f):(n=e[19],f=e[20]);let m;e[21]!==u.unresolved||e[22]!==t?(m=u.unresolved.length>0&&(0,o.jsxs)("details",{className:"text-sm","data-testid":"architecture-unresolved",children:[(0,o.jsxs)("summary",{className:"cursor-pointer text-muted-foreground",children:[t("{count} call sites could not be drawn",{count:u.unresolved.length})," ",(0,o.jsx)(oe,{variant:"outline",children:u.unresolved.length})]}),(0,o.jsx)("ul",{className:"mt-2 flex flex-col gap-1 font-mono text-xs",children:u.unresolved.map(Ue)})]}),e[21]=u.unresolved,e[22]=t,e[23]=m):m=e[23];let h;return e[24]!==n||e[25]!==f||e[26]!==m?(h=(0,o.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"architecture-panel",children:[n,f,m]}),e[24]=n,e[25]=f,e[26]=m,e[27]=h):h=e[27],h},"mt");function Je(){return new Set(Le)}c(Je,"We");function Qe(r){return(0,o.jsx)("option",{value:r.name,children:r.name},r.name)}c(Qe,"Ze");function Ue(r){return(0,o.jsxs)("li",{children:[r.file,":",r.line," \xB7 ",r.kind," \xB7 ",r.reason]},`${r.file}:${String(r.line)}:${r.kind}:${r.reason}`)}c(Ue,"Je");export{mt as default};
@@ -0,0 +1 @@
1
+ import{a as re}from"./chunk-XBZUJDHD.js";import{a as X}from"./chunk-5DNGK3NT.js";import{a as V}from"./chunk-KYONGQQ4.js";import"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as R}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as O}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as Y}from"./chunk-OECMBE6Q.js";import"./chunk-OSJ7HV7B.js";import"./chunk-7F3S5OQT.js";import"./chunk-E26OT26O.js";import{a as Q}from"./chunk-4ZEL6BYL.js";import{c as J}from"./chunk-YJ2WHOGO.js";import"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import{a as G}from"./chunk-3Y5K3IQO.js";import{a as Z,b as ee,c as te,d as P,e as n,f as o}from"./chunk-CW57Q264.js";import{a as U,e as W}from"./chunk-MD67S53Z.js";import{b as L,f as z,w as H}from"./chunk-LPINY2IJ.js";import{a as l,d as B,e as de,f as me,g as he}from"./chunk-OXFKZ4BM.js";var se=B(me(),1),le=B(de(),1);var t=B(he(),1);var ue={action:"outline",mutation:"default",query:"secondary"},ae=l(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"q"),fe=l(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"de"),pe=l(r=>{let e=r.conflicts??0;return r.calls===0?"\u2014":e===0?"0":`${e.toString()} (${(e/r.calls*100).toFixed(1)}%)`},"me"),xe={calls:l((r,e)=>e.calls-r.calls,"calls"),recent:l((r,e)=>e.lastCalledAt-r.lastCalledAt,"recent"),slowest:l((r,e)=>e.maxDurationMs-r.maxDurationMs,"slowest")},Ee=l(r=>{let e=(0,se.c)(47),{functions:K,initialShardKey:ne}=r,s=z(),{queryShardKey:_,setShardKey:N,shardKey:v}=X(ne),[i,oe]=(0,le.useState)("recent"),w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w={},e[0]=w):w=e[0];let C;e[1]!==_?(C={live:!0,shardKey:_},e[1]=_,e[2]=C):C=e[2];let{data:ie,error:c,errorSource:S,liveError:b}=J(Q.getFunctionStats,w,C),k=ie?.functions??null,$;e[3]!==K?($=new Map((K??[]).map(ge)),e[3]=K,e[4]=$):$=e[4];let T=$,F;e[5]===Symbol.for("react.memo_cache_sentinel")?(F=l(M=>{oe(M.currentTarget.dataset.sort)},"E"),e[5]=F):F=e[5];let ce=F,I;if(e[6]!==c||e[7]!==S||e[8]!==T||e[9]!==b||e[10]!==N||e[11]!==v||e[12]!==i||e[13]!==k||e[14]!==s){let M=k===null?[]:k.toSorted(xe[i]),d;e[16]!==s?(d=s("Recent"),e[16]=s,e[17]=d):d=e[17];let m;e[18]!==d?(m={key:"recent",label:d},e[18]=d,e[19]=m):m=e[19];let h;e[20]!==s?(h=s("Most called"),e[20]=s,e[21]=h):h=e[21];let u;e[22]!==h?(u={key:"calls",label:h},e[22]=h,e[23]=u):u=e[23];let f;e[24]!==s?(f=s("Slowest"),e[24]=s,e[25]=f):f=e[25];let p;e[26]!==f?(p={key:"slowest",label:f},e[26]=f,e[27]=p):p=e[27];let A;e[28]!==p||e[29]!==m||e[30]!==u?(A=[m,u,p],e[28]=p,e[29]=m,e[30]=u,e[31]=A):A=e[31];let j=A,x;e[32]!==N||e[33]!==v?(x=(0,t.jsx)(V,{onChange:N,testId:"fs-shard-input",value:v}),e[32]=N,e[33]=v,e[34]=x):x=e[34];let g;e[35]!==b?(g=(0,t.jsx)(re,{message:b,prefix:"fs"}),e[35]=b,e[36]=g):g=e[36];let y;e[37]!==j||e[38]!==i?(y=(0,t.jsx)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:j.map(a=>(0,t.jsx)(R,{"data-sort":a.key,"data-testid":`fs-sort-${a.key}`,onClick:ce,size:"sm",type:"button",variant:i===a.key?"secondary":"ghost",children:a.label},a.key))}),e[37]=j,e[38]=i,e[39]=y):y=e[39];let D;e[40]!==x||e[41]!==g||e[42]!==y?(D=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[x,g,y]}),e[40]=x,e[41]=g,e[42]=y,e[43]=D):D=e[43];let E;e[44]!==c||e[45]!==S?(E=c!==null&&(0,t.jsx)(Y,{error:S,testId:"fs-error"}),e[44]=c,e[45]=S,e[46]=E):E=e[46],I=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[D,E,k!==null&&M.length===0&&c===null&&(0,t.jsx)(G,{description:s("Per-function call counts, error rates, and latency land here after your first request."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M3 3v18h18"}),(0,t.jsx)("path",{d:"M7 14l4-4 3 3 5-6"})]}),testId:"fs-empty",title:s("No functions have run on this shard yet.")}),M.length>0&&(0,t.jsx)(U,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"px-0",children:(0,t.jsxs)(Z,{"data-testid":"fs-table",children:[(0,t.jsx)(ee,{children:(0,t.jsxs)(P,{children:[(0,t.jsx)(n,{children:s("function")}),(0,t.jsx)(n,{children:s("kind")}),(0,t.jsx)(n,{className:"text-right",children:s("calls")}),(0,t.jsx)(n,{className:"text-right",children:s("errors")}),(0,t.jsx)(n,{className:"text-right",children:s("conflicts")}),(0,t.jsx)(n,{className:"text-right",children:s("avg")}),(0,t.jsx)(n,{className:"text-right",children:s("max")}),(0,t.jsx)(n,{children:s("last run")}),(0,t.jsx)(n,{children:s("last error")})]})}),(0,t.jsx)(te,{children:M.map(a=>{let q=T.get(a.path);return(0,t.jsxs)(P,{"data-testid":`fs-row-${a.path}`,children:[(0,t.jsx)(o,{className:"font-medium",children:a.path}),(0,t.jsx)(o,{children:q===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,t.jsx)(O,{variant:ue[q],children:q})}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls}),(0,t.jsx)(o,{className:L("text-right tabular-nums",a.errors>0&&"text-destructive"),children:fe(a)}),(0,t.jsx)(o,{className:L("text-right tabular-nums",(a.conflicts??0)>0&&"text-warning"),children:pe(a)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.totalDurationMs/a.calls)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.maxDurationMs)}),(0,t.jsx)(o,{className:"text-muted-foreground",children:H(a.lastCalledAt,"\u2014")}),(0,t.jsx)(o,{className:"max-w-[24ch] truncate text-destructive",title:a.lastErrorMessage??void 0,children:a.lastErrorMessage??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.path)})})]})})})]}),e[6]=c,e[7]=S,e[8]=T,e[9]=b,e[10]=N,e[11]=v,e[12]=i,e[13]=k,e[14]=s,e[15]=I}else I=e[15];return I},"Ae");function ge(r){return[r.path,r.kind]}l(ge,"fe");export{Ee as FunctionStatsPanel};
@@ -0,0 +1 @@
1
+ import{a as Se}from"./chunk-P6L6ABWO.js";import{a as _}from"./chunk-OUFWXYEF.js";import{a as Ie}from"./chunk-XBZUJDHD.js";import{a as Ce}from"./chunk-ZWDORIZY.js";import{a as ve}from"./chunk-KYONGQQ4.js";import"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import{i as V}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as z}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as E}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as Ne}from"./chunk-OECMBE6Q.js";import"./chunk-OSJ7HV7B.js";import"./chunk-7F3S5OQT.js";import"./chunk-E26OT26O.js";import{a as X}from"./chunk-4ZEL6BYL.js";import{c as re}from"./chunk-YJ2WHOGO.js";import{g as pe,p as ce}from"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import{a as de}from"./chunk-3Y5K3IQO.js";import{a as ke,b as we,c as Pe,d as me,e as le,f as ie}from"./chunk-CW57Q264.js";import{a as se,b as ue,c as fe,d as he,e as ne}from"./chunk-MD67S53Z.js";import{f as K,h as xe,i as ge,j as ye,p as be,s as ae}from"./chunk-LPINY2IJ.js";import{a as f,d as oe,e as Fe,f as Te,g as Ee}from"./chunk-OXFKZ4BM.js";var y=oe(Fe(),1);var ee=oe(Te(),1);var a=oe(Ee(),1);var _e=["read","insert","update","delete"],ze=f((t,e)=>({delete:t("Delete"),insert:t("Insert"),read:t("Read"),update:t("Update")})[e],"_e"),$e=f(t=>t.file===""?t.procedure:`${t.file}:${t.procedure}`,"Fe"),De=f(t=>{let e=new Set;for(let l of t?.advisories??[])if(l.name==="rls_uncovered_table"){let{table:o}=l.metadata;typeof o=="string"&&o!==""&&e.add(o)}return e},"Oe"),Le=f((t,e,l)=>{let o=new Map,i=f(n=>{let s=o.get(n);if(s!==void 0)return s;let p={cells:{delete:{},insert:{},read:{},update:{}},maskedColumns:new Set,table:n,uncovered:l.has(n)};return o.set(n,p),p},"r");for(let n of t)i(n.table).cells[n.on]={path:$e(n),procedure:n.procedure};for(let n of e)i(n.table).maskedColumns.add(n.column);for(let n of l)i(n);return[...o.values()].toSorted((n,s)=>n.table.localeCompare(s.table))},"De"),Oe=f(t=>{let e=(0,ee.c)(17),l;e[0]!==t?(l=t===void 0?{}:t,e[0]=t,e[1]=l):l=e[1];let{onProbe:o}=l,i=K(),n,s;e[2]===Symbol.for("react.memo_cache_sentinel")?(n={},s={live:!0},e[2]=n,e[3]=s):(n=e[2],s=e[3]);let p=re(X.rlsPolicies,n,s),r;e[4]===Symbol.for("react.memo_cache_sentinel")?(r={},e[4]=r):r=e[4];let m=re(X.maskPolicies,r),d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d={},e[5]=d):d=e[5];let c=re(X.getAdvisories,d),h;if(e[6]!==c.data||e[7]!==m.data||e[8]!==o||e[9]!==p||e[10]!==i){let g=null;p.data!==void 0&&(g=Array.isArray(p.data.policies)?p.data.policies:[]);let $=Array.isArray(m.data?.columns)?m.data.columns:[],H=c.data??null,{error:C,errorSource:w,liveError:S}=p,A=g===null?[]:Le(g,$,De(H)),k;e[12]!==S?(k=(0,a.jsx)("div",{className:"flex items-center justify-end",children:(0,a.jsx)(Ie,{message:S,prefix:"pm"})}),e[12]=S,e[13]=k):k=e[13];let R;e[14]!==C||e[15]!==w?(R=C!==null&&(0,a.jsx)(Ne,{error:w,testId:"pm-error"}),e[14]=C,e[15]=w,e[16]=R):R=e[16],h=(0,a.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-matrix",children:[k,R,g!==null&&A.length===0?(0,a.jsx)(de,{description:i("Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix."),testId:"pm-empty",title:i("No policy")}):(0,a.jsxs)(ke,{"data-testid":"pm-table",children:[(0,a.jsx)(we,{children:(0,a.jsxs)(me,{children:[(0,a.jsx)(le,{children:i("Table")}),_e.map(x=>(0,a.jsx)(le,{children:ze(i,x)},x)),(0,a.jsx)(le,{children:i("Masked columns")})]})}),(0,a.jsx)(Pe,{children:A.map(x=>(0,a.jsxs)(me,{"data-testid":`pm-row-${x.table}`,children:[(0,a.jsx)(ie,{className:"font-mono text-xs",children:(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[x.table,x.uncovered&&(0,a.jsx)(E,{"data-testid":`pm-uncovered-${x.table}`,title:i("Uncovered \u2014 reachable without a policy"),variant:"destructive",children:i("Uncovered \u2014 reachable without a policy")})]})}),_e.map(I=>{let v=x.cells[I];return(0,a.jsx)(ie,{"data-testid":`pm-cell-${x.table}-${I}`,children:v.procedure===void 0?(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:i("No policy")}):(0,a.jsxs)("span",{className:"flex flex-col gap-1",children:[(0,a.jsx)(E,{variant:"secondary",children:i("Covered by {procedure}",{procedure:v.procedure})}),o!==void 0&&(0,a.jsx)(z,{className:"h-auto justify-start p-0 text-[11px]","data-testid":`pm-probe-${x.table}-${I}`,onClick:f(()=>{o(x.table,I,v.path??"")},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Probe this")})]})},I)}),(0,a.jsx)(ie,{children:x.maskedColumns.size===0?(0,a.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"}):(0,a.jsx)("span",{className:"flex flex-wrap gap-1",children:[...x.maskedColumns].map(qe)})})]},x.table))})]})]}),e[6]=c.data,e[7]=m.data,e[8]=o,e[9]=p,e[10]=i,e[11]=h}else h=e[11];return h},"Le");function qe(t){return(0,a.jsx)(E,{variant:"outline",children:t},t)}f(qe,"$e");var Ue=xe(X.runAs),We=new Set(["FORBIDDEN","RLS_REQUIRED","UNAUTHORIZED"]),je=f(t=>{let e=t?.code;return typeof e=="string"?e:void 0},"Me"),Be=f(()=>{let t=ce();return async({args:e,functionPath:l,shardKey:o="",userId:i})=>{if(i.trim()==="")return{kind:"invalid",message:"No identity to probe: enter the userId whose access you want to test."};let n=Ue;try{return{kind:"allowed",value:await t.query(n,{args:e,functionPath:l,userId:i},ge(o))}}catch(s){let p=s instanceof Error?s.message:String(s),r=je(s);return r!==void 0&&We.has(r)?{kind:"denied",message:p}:{kind:"errored",message:p}}}},"ze"),Me=f(t=>t===void 0?"undefined":JSON.stringify(t,be,2),"qe"),Je=f(t=>{let e=(0,ee.c)(43),{outcome:l}=t,o=K();if(l.kind==="allowed"){let r;e[0]!==o?(r=o("Allowed"),e[0]=o,e[1]=r):r=e[1];let m;e[2]!==r?(m=(0,a.jsx)(E,{variant:"secondary",children:r}),e[2]=r,e[3]=m):m=e[3];let d;e[4]!==l.value?(d=Me(l.value),e[4]=l.value,e[5]=d):d=e[5];let c;e[6]!==d?(c=(0,a.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-result",children:d}),e[6]=d,e[7]=c):c=e[7];let h;return e[8]!==m||e[9]!==c?(h=(0,a.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-allowed",children:[m,c]}),e[8]=m,e[9]=c,e[10]=h):h=e[10],h}if(l.kind==="denied"){let r;e[11]!==o?(r=o("Denied"),e[11]=o,e[12]=r):r=e[12];let m;e[13]!==r?(m=(0,a.jsx)(E,{variant:"destructive",children:r}),e[13]=r,e[14]=m):m=e[14];let d;e[15]!==l.message?(d=(0,a.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"pp-denied",role:"alert",children:l.message}),e[15]=l.message,e[16]=d):d=e[16];let c;return e[17]!==m||e[18]!==d?(c=(0,a.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-denied",children:[m,d]}),e[17]=m,e[18]=d,e[19]=c):c=e[19],c}if(l.kind==="errored"){let r;e[20]!==o?(r=o("Errored"),e[20]=o,e[21]=r):r=e[21];let m;e[22]!==r?(m=(0,a.jsx)(E,{variant:"outline",children:r}),e[22]=r,e[23]=m):m=e[23];let d;e[24]!==o?(d=o("The call failed for a reason that is not an access verdict, so it says nothing about the policy."),e[24]=o,e[25]=d):d=e[25];let c;e[26]!==d?(c=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:d}),e[26]=d,e[27]=c):c=e[27];let h;e[28]!==l.message?(h=(0,a.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-errored",role:"alert",children:l.message}),e[28]=l.message,e[29]=h):h=e[29];let g;return e[30]!==m||e[31]!==c||e[32]!==h?(g=(0,a.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-errored",children:[m,c,h]}),e[30]=m,e[31]=c,e[32]=h,e[33]=g):g=e[33],g}let i;e[34]!==o?(i=o("Not run"),e[34]=o,e[35]=i):i=e[35];let n;e[36]!==i?(n=(0,a.jsx)(E,{variant:"outline",children:i}),e[36]=i,e[37]=n):n=e[37];let s;e[38]!==l.message?(s=(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"pp-invalid",role:"status",children:l.message}),e[38]=l.message,e[39]=s):s=e[39];let p;return e[40]!==n||e[41]!==s?(p=(0,a.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-invalid",children:[n,s]}),e[40]=n,e[41]=s,e[42]=p):p=e[42],p},"Be"),He=f(t=>{let e=(0,ee.c)(17),{disabled:l,executesWrites:o,functionPath:i,onRun:n,running:s,userId:p}=t,r=K(),m;e[0]!==s||e[1]!==r?(m=r(s?"Probing\u2026":"Run probe"),e[0]=s,e[1]=r,e[2]=m):m=e[2];let d=m,c;e[3]!==l||e[4]!==o||e[5]!==i||e[6]!==d||e[7]!==n||e[8]!==r||e[9]!==p?(c=o?(0,a.jsx)(Ce,{confirmLabel:r("This will execute `{functionPath}` as user `{userId}`.",{functionPath:i,userId:p}),disabled:l,onConfirm:n,testId:"pp-run",children:d}):(0,a.jsx)(z,{"data-testid":"pp-run",disabled:l,onClick:n,type:"button",children:d}),e[3]=l,e[4]=o,e[5]=i,e[6]=d,e[7]=n,e[8]=r,e[9]=p,e[10]=c):c=e[10];let h;e[11]!==r||e[12]!==p?(h=p!==""&&(0,a.jsx)(E,{"data-testid":"pp-as-badge",variant:"secondary",children:r("as {userId}",{userId:p})}),e[11]=r,e[12]=p,e[13]=h):h=e[13];let g;return e[14]!==c||e[15]!==h?(g=(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[c,h]}),e[14]=c,e[15]=h,e[16]=g):g=e[16],g},"je"),Ke=f(({functions:t,prefill:e,runAsIdentity:l=!1}={})=>{let o=ce(),i=K(),n=Be(),[s,p]=(0,y.useState)(null),[r,m]=(0,y.useState)(null),d=t??s??[],[c,h]=(0,y.useState)(""),[g,$]=(0,y.useState)("{}"),[H,C]=(0,y.useState)(""),[w,S]=(0,y.useState)(""),[A,k]=(0,y.useState)(!1),[R,x]=(0,y.useState)(null),[I,v]=(0,y.useState)(null),[F,D]=(0,y.useState)(!1),T=(0,y.useRef)(-1),P=(0,y.useRef)(0);(0,y.useEffect)(()=>{if(t!==void 0)return;let u=!1;return o.listFunctions().then(N=>(u||p(N),N)).catch(N=>{u||m(ye(N))}),()=>{u=!0}},[o,t]),(0,y.useEffect)(()=>{if(e===void 0||T.current===e.nonce)return;T.current=e.nonce,P.current+=1;let u=e.functionPath;queueMicrotask(()=>{h(u),x(null)})},[e]);let Q=F?d:d.filter(u=>u.kind==="query"||u.path===c),b=c===""?Q[0]?.path??"":c,L=d.find(u=>u.path===b),Z=b!==""&&L?.kind!=="query",O=f(async()=>{if(b==="")return;let u;try{u=g.trim()===""?{}:pe(JSON.parse(g))}catch(J){v(i("Invalid JSON args: {message}",{message:J.message})),x(null);return}P.current+=1;let N=P.current;v(null),k(!0);try{let J=await n({args:u,functionPath:b,shardKey:H.trim(),userId:w.trim()});N===P.current&&x(J)}finally{k(!1)}},"L"),q=f(()=>{ae(O())},"$"),U=f(u=>{h(u.target.value)},"U"),W=f(u=>{$(u.target.value)},"W"),j=f(u=>{S(u.target.value)},"M"),B=f(u=>{D(u.target.checked),!u.target.checked&&Z&&h("")},"z"),M=!l||A||b==="";return(0,a.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-playground",children:[r!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"pp-discover-error",role:"alert",children:r}),!l&&(0,a.jsx)(de,{description:i("Dev only: runs the selected function as this user over the admin gate so you can test auth and RLS."),testId:"pp-gate",title:i("Set `runAsIdentity` to forge an identity and probe access.")}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 rounded-md border border-border p-3",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)(_,{htmlFor:"pp-function",children:i("Function")}),(0,a.jsx)("select",{"aria-label":i("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","data-testid":"pp-function",id:"pp-function",onChange:U,value:b,children:Q.map(u=>(0,a.jsxs)("option",{value:u.path,children:[u.path," (",u.kind,")"]},u.path))}),(0,a.jsxs)(_,{className:"flex items-center gap-1.5 text-xs font-normal",htmlFor:"pp-include-writes",children:[(0,a.jsx)("input",{checked:F,className:"size-4 accent-primary","data-testid":"pp-include-writes",id:"pp-include-writes",onChange:B,type:"checkbox"}),i("Include mutations and actions")]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)(_,{htmlFor:"pp-args",children:i("Arguments")}),(0,a.jsx)(Se,{"aria-label":i("Arguments"),className:"font-mono text-xs","data-testid":"pp-args",id:"pp-args",onChange:W,value:g})]}),(0,a.jsx)(ve,{onChange:C,testId:"pp-shard",value:H}),(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)(_,{htmlFor:"pp-user",children:i("Run as (userId)")}),(0,a.jsx)(V,{"aria-label":i("Identity (userId) to run as"),className:"font-mono text-xs","data-testid":"pp-user",id:"pp-user",onChange:j,placeholder:i("Required \u2014 the identity to probe as"),value:w})]}),(0,a.jsx)(He,{disabled:M,executesWrites:Z,functionPath:b,onRun:q,running:A,userId:w.trim()})]}),I!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"pp-args-error",role:"alert",children:I}),R!==null&&(0,a.jsx)(Je,{outcome:R})]})},"Qe"),Ve="/__lunora/policy-scaffold",Qe={"already-wired":"That procedure already has an rls(...) policy wired in.","file-exists":"A policy file with that name already exists \u2014 pick another name or edit it by hand.","invalid-identifier":"Name, table, and policy-set must be plain identifiers (letters, digits, _ or $).","unknown-procedure":"No exported procedure was found at that file path.","unsupported-procedure-shape":"That procedure uses the bare query({\u2026}) form \u2014 convert it to the builder form (c.use(\u2026).query(\u2026)) before wiring RLS."},Ze=f(async t=>{let e=await fetch(Ve,{body:JSON.stringify(t),headers:{"Content-Type":"application/json"},method:"POST"}),l=await e.json();if(l.needsManualEdit===!0)return{kind:"needs-manual-edit",message:l.message??"This change must be made by hand."};if(e.ok)return{diagnostics:l.diagnostics??[],kind:"ok",label:l.fileName??l.exportName??""};let o=l.error;return{kind:"error",message:o===void 0?`policy scaffold failed (${String(e.status)})`:Qe[o]??o}},"Ke"),Ae={exportName:"",filePath:"",policyName:"",policies:"",tableName:""},Ye=f(()=>{let t=(0,ee.c)(69),e=K(),[l,o]=(0,y.useState)(null),[i,n]=(0,y.useState)(!1),[s,p]=(0,y.useState)(null),[r,m]=(0,y.useState)(Ae),d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=f(te=>{let Y=te.target.name,{value:G}=te.target;m(Re=>({...Re,[Y]:G}))},"c"),t[0]=d):d=t[0];let c=d,h;t[1]===Symbol.for("react.memo_cache_sentinel")?(h=f(()=>{o(null),m(Ae)},"h"),t[1]=h):h=t[1];let g=h,$;t[2]===Symbol.for("react.memo_cache_sentinel")?($=f(async te=>{n(!0),p(null);try{let Y=await Ze(te);p(Y),Y.kind==="ok"&&g()}catch(Y){let G=Y;p({kind:"error",message:G instanceof Error?G.message:String(G)})}n(!1)},"F"),t[2]=$):$=t[2];let H=$,C;t[3]!==r.policyName||t[4]!==r.tableName?(C=f(()=>{ae(H({kind:"scaffoldPolicy",name:r.policyName.trim(),table:r.tableName.trim()}))},"w"),t[3]=r.policyName,t[4]=r.tableName,t[5]=C):C=t[5];let w=C,S;t[6]!==r.exportName||t[7]!==r.filePath||t[8]!==r.policies?(S=f(()=>{ae(H({exportName:r.exportName.trim(),filePath:r.filePath.trim(),kind:"wireRls",policies:r.policies.trim()}))},"P"),t[6]=r.exportName,t[7]=r.filePath,t[8]=r.policies,t[9]=S):S=t[9];let A=S,k;t[10]===Symbol.for("react.memo_cache_sentinel")?(k=f(()=>{p(null),o("scaffold")},"k"),t[10]=k):k=t[10];let R=k,x;t[11]===Symbol.for("react.memo_cache_sentinel")?(x=f(()=>{p(null),o("wire")},"x"),t[11]=x):x=t[11];let I=x,v;t[12]!==e?(v=e("Scaffold access rules"),t[12]=e,t[13]=v):v=t[13];let F;t[14]!==v?(F=(0,a.jsx)(fe,{children:v}),t[14]=v,t[15]=F):F=t[15];let D;t[16]!==e?(D=e("Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only."),t[16]=e,t[17]=D):D=t[17];let T;t[18]!==D?(T=(0,a.jsx)(he,{children:D}),t[18]=D,t[19]=T):T=t[19];let P;t[20]!==T||t[21]!==F?(P=(0,a.jsxs)(ue,{children:[F,T]}),t[20]=T,t[21]=F,t[22]=P):P=t[22];let Q=l==="scaffold"?"default":"outline",b;t[23]!==e?(b=e("New policy file"),t[23]=e,t[24]=b):b=t[24];let L;t[25]!==Q||t[26]!==b?(L=(0,a.jsx)(z,{"data-testid":"policy-scaffolder-new",onClick:R,size:"xs",type:"button",variant:Q,children:b}),t[25]=Q,t[26]=b,t[27]=L):L=t[27];let Z=l==="wire"?"default":"outline",O;t[28]!==e?(O=e("Wire into a procedure"),t[28]=e,t[29]=O):O=t[29];let q;t[30]!==Z||t[31]!==O?(q=(0,a.jsx)(z,{"data-testid":"policy-scaffolder-wire",onClick:I,size:"xs",type:"button",variant:Z,children:O}),t[30]=Z,t[31]=O,t[32]=q):q=t[32];let U;t[33]!==L||t[34]!==q?(U=(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[L,q]}),t[33]=L,t[34]=q,t[35]=U):U=t[35];let W;t[36]!==i||t[37]!==r.policyName||t[38]!==r.tableName||t[39]!==l||t[40]!==w||t[41]!==e?(W=l==="scaffold"&&(0,a.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-new-form",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,a.jsx)(_,{htmlFor:"policy-scaffolder-name",children:e("Policy name")}),(0,a.jsx)(V,{"data-testid":"policy-scaffolder-name",id:"policy-scaffolder-name",name:"policyName",onChange:c,value:r.policyName})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,a.jsx)(_,{htmlFor:"policy-scaffolder-table",children:e("Table name")}),(0,a.jsx)(V,{"data-testid":"policy-scaffolder-table",id:"policy-scaffolder-table",name:"tableName",onChange:c,value:r.tableName})]}),(0,a.jsx)(z,{"data-testid":"policy-scaffolder-create",disabled:i||r.policyName.trim()===""||r.tableName.trim()==="",onClick:w,size:"xs",type:"button",children:e(i?"Creating\u2026":"Create policy file")}),(0,a.jsx)(z,{onClick:g,size:"xs",type:"button",variant:"ghost",children:e("Cancel")})]}),t[36]=i,t[37]=r.policyName,t[38]=r.tableName,t[39]=l,t[40]=w,t[41]=e,t[42]=W):W=t[42];let j;t[43]!==i||t[44]!==r.exportName||t[45]!==r.filePath||t[46]!==r.policies||t[47]!==l||t[48]!==A||t[49]!==e?(j=l==="wire"&&(0,a.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-wire-form",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,a.jsx)(_,{htmlFor:"policy-scaffolder-file",children:e("Procedure file path")}),(0,a.jsx)(V,{"data-testid":"policy-scaffolder-file",id:"policy-scaffolder-file",name:"filePath",onChange:c,value:r.filePath})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,a.jsx)(_,{htmlFor:"policy-scaffolder-export",children:e("Exported procedure")}),(0,a.jsx)(V,{"data-testid":"policy-scaffolder-export",id:"policy-scaffolder-export",name:"exportName",onChange:c,value:r.exportName})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,a.jsx)(_,{htmlFor:"policy-scaffolder-policies",children:e("Policy set identifier")}),(0,a.jsx)(V,{"data-testid":"policy-scaffolder-policies",id:"policy-scaffolder-policies",name:"policies",onChange:c,value:r.policies})]}),(0,a.jsx)(z,{"data-testid":"policy-scaffolder-apply",disabled:i||r.filePath.trim()===""||r.exportName.trim()===""||r.policies.trim()==="",onClick:A,size:"xs",type:"button",children:e(i?"Wiring\u2026":"Wire RLS")}),(0,a.jsx)(z,{onClick:g,size:"xs",type:"button",variant:"ghost",children:e("Cancel")})]}),t[43]=i,t[44]=r.exportName,t[45]=r.filePath,t[46]=r.policies,t[47]=l,t[48]=A,t[49]=e,t[50]=j):j=t[50];let B;t[51]!==s?(B=s?.kind==="error"&&(0,a.jsx)("p",{className:"mt-3 text-sm text-destructive","data-testid":"policy-scaffolder-error",role:"alert",children:s.message}),t[51]=s,t[52]=B):B=t[52];let M;t[53]!==s?.kind||t[54]!==e?(M=s?.kind==="needs-manual-edit"&&(0,a.jsx)("p",{className:"mt-3 text-sm text-amber-600 dark:text-amber-500","data-testid":"policy-scaffolder-manual",role:"alert",children:e("This change must be made by hand \u2014 the scaffolder only adds new, deny-by-default rules.")}),t[53]=s?.kind,t[54]=e,t[55]=M):M=t[55];let u;t[56]!==s||t[57]!==e?(u=s?.kind==="ok"&&(0,a.jsxs)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"policy-scaffolder-ok",children:[(0,a.jsx)("p",{className:"text-sm text-emerald-600 dark:text-emerald-500",children:e("Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.",{label:s.label})}),s.diagnostics.length>0&&(0,a.jsx)("ul",{className:"flex flex-col gap-0.5","data-testid":"policy-scaffolder-diagnostics",children:s.diagnostics.map(Ge)})]}),t[56]=s,t[57]=e,t[58]=u):u=t[58];let N;t[59]!==U||t[60]!==W||t[61]!==j||t[62]!==B||t[63]!==M||t[64]!==u?(N=(0,a.jsxs)(ne,{children:[U,W,j,B,M,u]}),t[59]=U,t[60]=W,t[61]=j,t[62]=B,t[63]=M,t[64]=u,t[65]=N):N=t[65];let J;return t[66]!==P||t[67]!==N?(J=(0,a.jsxs)(se,{"data-testid":"policy-scaffolder",size:"sm",children:[P,N]}),t[66]=P,t[67]=N,t[68]=J):J=t[68],J},"Ve");function Ge(t){return(0,a.jsx)("li",{className:"font-mono text-[11px] text-destructive",children:t},t)}f(Ge,"Ye");var gt=f(({functions:t,runAsIdentity:e=!1,schemaEditable:l=!1}={})=>{let o=K(),[i,n]=(0,y.useState)(void 0),s=f((p,r,m)=>{m!==""&&n(d=>({functionPath:m,nonce:(d?.nonce??0)+1}))},"i");return(0,a.jsxs)("div",{className:"flex flex-col gap-8","data-testid":"lunora-permissions",children:[(0,a.jsxs)("section",{className:"flex flex-col gap-3",children:[(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o("Permissions")})}),(0,a.jsx)(Oe,{onProbe:s})]}),(0,a.jsx)("section",{className:"flex flex-col gap-3",children:(0,a.jsxs)(se,{className:"gap-0 py-0",children:[(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o("Probe")})}),(0,a.jsxs)(ne,{className:"px-4 py-4",children:[(0,a.jsx)("p",{className:"mb-3 text-sm text-muted-foreground",children:o("Pick a function and an identity, then run it to see the access outcome.")}),(0,a.jsx)(Ke,{functions:t,prefill:i,runAsIdentity:e})]})]})}),l&&(0,a.jsx)("section",{className:"flex flex-col gap-2",children:(0,a.jsx)(Ye,{})})]})},"bt");export{gt as PermissionsPanel};
@@ -0,0 +1 @@
1
+ import{a as M,c as O,e as S,i as E}from"./chunk-ZBON5T5A.js";import{a as I,b as B,c as U}from"./chunk-4C4THJUD.js";import{a as s,d as k,e as w}from"./chunk-OXFKZ4BM.js";var f=k(w(),1);var g=k(w(),1);var z=g.createContext(void 0);function W(o=!1){let t=g.useContext(z);if(t===void 0&&!o)throw new Error(U(16));return t}s(W,"useCompositeRootContext");var H=k(w(),1);function A(o){let{focusableWhenDisabled:t,disabled:r,composite:l=!1,tabIndex:n=0,isNativeButton:u}=o,d=l&&t!==!1,b=l&&t===!1;return{props:H.useMemo(()=>{let a={onKeyDown(p){r&&t&&p.key!=="Tab"&&p.preventDefault()}};return l||(a.tabIndex=n,!u&&r&&(a.tabIndex=t?n:-1)),(u&&(t||d)||!u&&r)&&(a["aria-disabled"]=r),u&&(!t||b)&&(a.disabled=r),a},[l,r,t,d,b,u,n])}}s(A,"useFocusableWhenDisabled");function h(o,t,{detail:r=0}={}){o.dispatchEvent(new(S(o)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:r,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}s(h,"dispatchClickWithModifiers");function le(o={}){let{disabled:t=!1,focusableWhenDisabled:r,tabIndex:l=0,native:n=!0,composite:u}=o,d=f.useRef(null),b=W(!0),i=u??b!==void 0,{props:a}=A({focusableWhenDisabled:r,disabled:t,composite:i,tabIndex:l,isNativeButton:n}),p=f.useCallback(()=>{let c=d.current;K(c)&&i&&t&&a.disabled===void 0&&c.disabled&&(c.disabled=!1)},[t,a.disabled,i]);M(p,[p]);let F=f.useCallback((c={})=>{let{onClick:x,onMouseDown:C,onKeyUp:V,onKeyDown:_,onPointerDown:$,...v}=c;return I({onClick(e){if(t){e.preventDefault();return}x?.(e)},onMouseDown(e){t||C?.(e)},onKeyDown(e){if(t||(B(e),_?.(e),e.baseUIHandlerPrevented))return;let R=e.target===e.currentTarget,m=e.currentTarget,P=K(m),N=!n&&G(m),j=R&&(n?P:!N),T=e.key==="Enter",y=e.key===" ",D=m.getAttribute("role"),q=D?.startsWith("menuitem")||D==="option"||D==="gridcell";if(R&&i&&y){if(e.defaultPrevented&&q)return;e.preventDefault(),(!n||P)&&(e.preventBaseUIHandler(),h(m,e));return}if(!j||n||!y&&!T){R&&N&&y&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),T&&(e.preventBaseUIHandler(),h(m,e)))},onKeyUp(e){if(!t){if(B(e),V?.(e),e.target===e.currentTarget&&n&&i&&K(e.currentTarget)&&e.key===" "){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!n&&!i&&!e.defaultPrevented&&e.key===" "&&(e.preventBaseUIHandler(),h(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}$?.(e)}},n?{type:"button"}:{role:"button"},a,v)},[t,a,i,n]),L=O(c=>{d.current=c,p()});return{getButtonProps:F,buttonRef:L}}s(le,"useButton");function K(o){return E(o)&&o.tagName==="BUTTON"}s(K,"isButtonElement");function G(o){return E(o)&&o.tagName==="A"&&!!o.href}s(G,"isValidLinkElement");export{W as a,h as b,le as c};