@lunora/studio 1.0.0-alpha.357 → 1.0.0-alpha.359

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 (191) hide show
  1. package/dist/index.mjs +1 -1
  2. package/dist/mount.mjs +1 -1
  3. package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -1
  4. package/dist/packem_chunks/ApiTab.mjs +1 -1
  5. package/dist/packem_chunks/AuditPanel.mjs +1 -1
  6. package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -1
  7. package/dist/packem_chunks/ExportImportPanel.mjs +1 -1
  8. package/dist/packem_chunks/FileBrowser.mjs +1 -1
  9. package/dist/packem_chunks/FunctionRunner.mjs +1 -1
  10. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -1
  11. package/dist/packem_chunks/HealthPanel.mjs +1 -1
  12. package/dist/packem_chunks/InsightsPanel.mjs +1 -1
  13. package/dist/packem_chunks/LogsPanel.mjs +1 -1
  14. package/dist/packem_chunks/MailPanel.mjs +1 -1
  15. package/dist/packem_chunks/MetricsPanel.mjs +1 -1
  16. package/dist/packem_chunks/NotificationsPanel.mjs +1 -1
  17. package/dist/packem_chunks/PitrPanel.mjs +1 -1
  18. package/dist/packem_chunks/SchemaViewer.mjs +1 -1
  19. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -1
  20. package/dist/packem_chunks/SettingsPanel.mjs +1 -1
  21. package/dist/packem_chunks/SqlEditorPanel.mjs +1 -1
  22. package/dist/packem_chunks/TableEditor.mjs +1 -1
  23. package/dist/packem_chunks/agents-panel.mjs +1 -1
  24. package/dist/packem_chunks/ai-usage-panel.mjs +1 -1
  25. package/dist/packem_chunks/analytics-panel.mjs +1 -1
  26. package/dist/packem_chunks/architecture-panel.mjs +1 -1
  27. package/dist/packem_chunks/auth-audit-panel.mjs +1 -1
  28. package/dist/packem_chunks/auth-config-panel.mjs +1 -1
  29. package/dist/packem_chunks/auth-sessions-panel.mjs +1 -1
  30. package/dist/packem_chunks/containers-panel.mjs +1 -1
  31. package/dist/packem_chunks/dashboards-panel.mjs +1 -1
  32. package/dist/packem_chunks/evals-panel.mjs +1 -1
  33. package/dist/packem_chunks/fanout-panel.mjs +1 -1
  34. package/dist/packem_chunks/flags-panel.mjs +1 -1
  35. package/dist/packem_chunks/issues-panel.mjs +1 -1
  36. package/dist/packem_chunks/kv-browser.mjs +1 -1
  37. package/dist/packem_chunks/log-drains-panel.mjs +1 -1
  38. package/dist/packem_chunks/migrations-route.mjs +1 -1
  39. package/dist/packem_chunks/organizations-panel.mjs +1 -1
  40. package/dist/packem_chunks/payments-panel.mjs +1 -1
  41. package/dist/packem_chunks/permissions-panel.mjs +1 -1
  42. package/dist/packem_chunks/privacy-requests-panel.mjs +1 -1
  43. package/dist/packem_chunks/queues-panel.mjs +1 -1
  44. package/dist/packem_chunks/reactors-panel.mjs +1 -1
  45. package/dist/packem_chunks/rls-panel.mjs +1 -1
  46. package/dist/packem_chunks/schedule-panel.mjs +1 -1
  47. package/dist/packem_chunks/storage-rules-panel.mjs +1 -1
  48. package/dist/packem_chunks/subscriptions-panel.mjs +1 -1
  49. package/dist/packem_chunks/sync-client-panel.mjs +1 -1
  50. package/dist/packem_chunks/traces-panel.mjs +1 -1
  51. package/dist/packem_chunks/users-panel.mjs +1 -1
  52. package/dist/packem_chunks/vector-browser.mjs +1 -1
  53. package/dist/packem_chunks/workflows-panel.mjs +1 -1
  54. package/dist/packem_shared/{ApiDocsPanel-E4Vr-8zW.mjs → ApiDocsPanel-DD2Uns6b.mjs} +1 -1
  55. package/dist/packem_shared/{ApiReferencePanel-u9Rrljdf.mjs → ApiReferencePanel-CQxU1Ocx.mjs} +1 -1
  56. package/dist/packem_shared/{CommandPalette-5OsK8PNe.mjs → CommandPalette-BZCHLpst.mjs} +1 -1
  57. package/dist/packem_shared/{DEFAULT_AUTO_REFRESH_MS-CG7Q45ZS.mjs → DEFAULT_AUTO_REFRESH_MS-Py5Yx7rP.mjs} +1 -1
  58. package/dist/packem_shared/{DataBrowser-C5HbI4TH.mjs → DataBrowser-CVRWnNWu.mjs} +1 -1
  59. package/dist/packem_shared/{GlobalDataBrowser-D0H2yJSl.mjs → GlobalDataBrowser-DC47T6Zl.mjs} +1 -1
  60. package/dist/packem_shared/{HomePanel-CcYkDlR-.mjs → HomePanel-D12HxHQo.mjs} +1 -1
  61. package/dist/packem_shared/{MigrationsPanel-YyCO_T-3.mjs → MigrationsPanel-DMkxSXNl.mjs} +1 -1
  62. package/dist/packem_shared/{OpenRpcReferencePanel-E9cDfHRv.mjs → OpenRpcReferencePanel-BFDG91tn.mjs} +1 -1
  63. package/dist/packem_shared/{ScheduledJobs-D4CUj7aX.mjs → ScheduledJobs-QCTRdugp.mjs} +1 -1
  64. package/dist/packem_shared/{Studio-4vJzwwNa.mjs → Studio-MA8kKZLu.mjs} +1 -1
  65. package/dist/packem_shared/{StudioApp-px2FMPDS.mjs → StudioApp-isdWpF9P.mjs} +1 -1
  66. package/dist/packem_shared/{advisor-view-fNcNYW2Q.mjs → advisor-view-tBumWci_.mjs} +1 -1
  67. package/dist/packem_shared/{data-grid-r3isM8Nq.mjs → data-grid-B5m1OosL.mjs} +1 -1
  68. package/dist/packem_shared/{diagram-export-panel-aBDQdX4e.mjs → diagram-export-panel-Vdt-DZnO.mjs} +1 -1
  69. package/dist/packem_shared/{error-alert-54TiaMvZ.mjs → error-alert-C0R39DO1.mjs} +1 -1
  70. package/dist/packem_shared/{grid-features-2c5SaBtH.mjs → grid-features-Drvfswwy.mjs} +1 -1
  71. package/dist/packem_shared/{home-panel-DPiMVQZ2.mjs → home-panel-CDVTuTF8.mjs} +1 -1
  72. package/dist/packem_shared/internal-hIuTpSbx.mjs +2 -0
  73. package/dist/packem_shared/{log-line-BWDt_F56.mjs → log-line-BH0iWiBv.mjs} +1 -1
  74. package/dist/packem_shared/{recording-client-MbGZ28I0.mjs → recording-client-DAipTA_n.mjs} +1 -1
  75. package/dist/packem_shared/{reference-view-DCEC5kjY.mjs → reference-view-DENugPcj.mjs} +1 -1
  76. package/dist/packem_shared/{schema-diagram-k7cFl7Wp.mjs → schema-diagram-CtVPhOGj.mjs} +1 -1
  77. package/dist/packem_shared/{sql-result-table-CatgdmMh.mjs → sql-result-table-DCwooMGW.mjs} +1 -1
  78. package/dist/packem_shared/{studio-DIUgH7k0.mjs → studio-UhUrPz5J.mjs} +1 -1
  79. package/dist/packem_shared/{table-list-sidebar-CCRB_iYz.mjs → table-list-sidebar-CNadcIgG.mjs} +1 -1
  80. package/dist/packem_shared/{use-admin-query-BW9IuacC.mjs → use-admin-query-CaOm4JS3.mjs} +1 -1
  81. package/dist/packem_shared/{use-admin-spec-BdNLZbTO.mjs → use-admin-spec-CK7mk3Ui.mjs} +1 -1
  82. package/dist/packem_shared/{use-async-submit-2eBBD0-m.mjs → use-async-submit-D0r7-m2J.mjs} +1 -1
  83. package/dist/packem_shared/{use-auth-config-KO9tnI39.mjs → use-auth-config-CG7VvAvQ.mjs} +1 -1
  84. package/dist/packem_shared/{use-open-trace-B_0LbTD7.mjs → use-open-trace-BJKMJjeS.mjs} +1 -1
  85. package/dist/packem_shared/{use-sql-assistant-BMVlguKF.mjs → use-sql-assistant-rZPs3LC3.mjs} +1 -1
  86. package/dist/standalone/{chunk-5KD75VXP.js → chunk-2AH4ABE5.js} +1 -1
  87. package/dist/standalone/{chunk-VPG46PCA.js → chunk-2G57ENH5.js} +1 -1
  88. package/dist/standalone/{chunk-F7GMBSJP.js → chunk-3FS22LNI.js} +1 -1
  89. package/dist/standalone/{chunk-Q5GY7D5H.js → chunk-3GYLOE4V.js} +1 -1
  90. package/dist/standalone/{chunk-AQJXOPBW.js → chunk-3PAYDWHN.js} +1 -1
  91. package/dist/standalone/{chunk-ILLDX6LU.js → chunk-473JK2PQ.js} +1 -1
  92. package/dist/standalone/chunk-4DAKKAK7.js +1 -0
  93. package/dist/standalone/{chunk-ESUUPILO.js → chunk-4M57OYFX.js} +1 -1
  94. package/dist/standalone/{chunk-7DMOBHYC.js → chunk-5GIQ6C5N.js} +1 -1
  95. package/dist/standalone/{chunk-MDAXV2XH.js → chunk-5R2YO7HF.js} +1 -1
  96. package/dist/standalone/{chunk-TNII7Q2L.js → chunk-5WJG7FMH.js} +1 -1
  97. package/dist/standalone/{chunk-GNVWTK4S.js → chunk-63KDHS3H.js} +1 -1
  98. package/dist/standalone/{chunk-OGKRWT6I.js → chunk-6B6ARRMI.js} +1 -1
  99. package/dist/standalone/{chunk-YJYXN3WQ.js → chunk-6LMO2D54.js} +1 -1
  100. package/dist/standalone/{chunk-2O6KKVH2.js → chunk-6VAY6L4J.js} +1 -1
  101. package/dist/standalone/{chunk-HKLF627N.js → chunk-7PADVGQX.js} +1 -1
  102. package/dist/standalone/{chunk-UWAVY3IF.js → chunk-7UM5ROG6.js} +1 -1
  103. package/dist/standalone/{chunk-4BNWYVLP.js → chunk-7ZIYHKLX.js} +1 -1
  104. package/dist/standalone/{chunk-O6XMGPGY.js → chunk-A5JISKHE.js} +1 -1
  105. package/dist/standalone/{chunk-3QGR4DC7.js → chunk-ADNRFCMZ.js} +1 -1
  106. package/dist/standalone/chunk-BFE2DRP6.js +33 -0
  107. package/dist/standalone/{chunk-NXNUGQHB.js → chunk-BPEB4KFE.js} +1 -1
  108. package/dist/standalone/chunk-BVX45MU5.js +7 -0
  109. package/dist/standalone/{chunk-FIJVZCBO.js → chunk-BYOGQ2IV.js} +1 -1
  110. package/dist/standalone/{chunk-SOVH524I.js → chunk-C6GN7ZXJ.js} +1 -1
  111. package/dist/standalone/{chunk-TAGWTOFD.js → chunk-CL2VZNDI.js} +1 -1
  112. package/dist/standalone/{chunk-P6L6ABWO.js → chunk-CNA3TVUK.js} +1 -1
  113. package/dist/standalone/chunk-CZ6HBDIL.js +1 -0
  114. package/dist/standalone/{chunk-I2PP6Q6F.js → chunk-D6S7MXW4.js} +1 -1
  115. package/dist/standalone/{chunk-LKCO3E2B.js → chunk-FCAXVYAX.js} +1 -1
  116. package/dist/standalone/{chunk-ZWDORIZY.js → chunk-FXPAJDES.js} +1 -1
  117. package/dist/standalone/{chunk-WZTY3ZYI.js → chunk-H7HZ42JY.js} +1 -1
  118. package/dist/standalone/{chunk-CW57Q264.js → chunk-HHRYM6UW.js} +1 -1
  119. package/dist/standalone/{chunk-OT4KZ6Y6.js → chunk-HPRF5LMA.js} +1 -1
  120. package/dist/standalone/{chunk-QSNQXPIX.js → chunk-IB22LETR.js} +1 -1
  121. package/dist/standalone/chunk-IENQRRQT.js +1 -0
  122. package/dist/standalone/{chunk-LRXCL6IA.js → chunk-IQ4TTHQT.js} +1 -1
  123. package/dist/standalone/{chunk-DUQ7KXNS.js → chunk-ITH5LRWM.js} +1 -1
  124. package/dist/standalone/{chunk-MQ3FFFP4.js → chunk-J6VFG6M5.js} +1 -1
  125. package/dist/standalone/{chunk-MD67S53Z.js → chunk-JSDKOE4U.js} +1 -1
  126. package/dist/standalone/{chunk-N5FOHLIG.js → chunk-JZD7ZN3F.js} +1 -1
  127. package/dist/standalone/chunk-K3CWB3AM.js +1 -0
  128. package/dist/standalone/{chunk-64S3IDR2.js → chunk-KNFB3FGW.js} +1 -1
  129. package/dist/standalone/{chunk-OKSZWLJX.js → chunk-KNXWDE4N.js} +1 -1
  130. package/dist/standalone/{chunk-VO6GV6F2.js → chunk-KRY7BYHT.js} +1 -1
  131. package/dist/standalone/chunk-KYAG2YMF.js +1 -0
  132. package/dist/standalone/{chunk-OUFWXYEF.js → chunk-KZCEJFZF.js} +1 -1
  133. package/dist/standalone/{chunk-CDV6T5KM.js → chunk-KZILJQX3.js} +1 -1
  134. package/dist/standalone/{chunk-R5ACA3OC.js → chunk-LEYUH5TS.js} +1 -1
  135. package/dist/standalone/{chunk-Z3NZJ4C2.js → chunk-LFM672WN.js} +1 -1
  136. package/dist/standalone/{chunk-XFTWGZKD.js → chunk-LPU6YTSU.js} +1 -1
  137. package/dist/standalone/{chunk-TRZTGE4R.js → chunk-MWJC3S62.js} +1 -1
  138. package/dist/standalone/{chunk-AZRUSOAH.js → chunk-NP2AQOLE.js} +1 -1
  139. package/dist/standalone/{chunk-SL7LF2SO.js → chunk-NVKLYDOH.js} +1 -1
  140. package/dist/standalone/{chunk-5IIX2STA.js → chunk-O2NMPIV2.js} +1 -1
  141. package/dist/standalone/{chunk-DN3HPAOA.js → chunk-O2X2XYCM.js} +1 -1
  142. package/dist/standalone/{chunk-2CWGRQ5L.js → chunk-O3MDWYXF.js} +1 -1
  143. package/dist/standalone/chunk-ONG4JEZD.js +1 -0
  144. package/dist/standalone/{chunk-DS7HZKZ2.js → chunk-ONWGX5Y4.js} +1 -1
  145. package/dist/standalone/{chunk-X5KWBDTF.js → chunk-OS26JXYA.js} +1 -1
  146. package/dist/standalone/{chunk-E423VRTC.js → chunk-PGTEGUAB.js} +1 -1
  147. package/dist/standalone/{chunk-6I42AM75.js → chunk-PQH2LSJX.js} +1 -1
  148. package/dist/standalone/{chunk-SPPJFTWE.js → chunk-PTBUWRBY.js} +1 -1
  149. package/dist/standalone/{chunk-4IEMXFUB.js → chunk-Q6HA3L2H.js} +1 -1
  150. package/dist/standalone/{chunk-RNHTOEL7.js → chunk-QGV5ARD2.js} +1 -1
  151. package/dist/standalone/{chunk-YJWR6ZWC.js → chunk-QWRK4ESB.js} +1 -1
  152. package/dist/standalone/{chunk-ZZ5564FZ.js → chunk-RL2ITK2N.js} +1 -1
  153. package/dist/standalone/{chunk-2PHY5V5E.js → chunk-RTJO3AR4.js} +1 -1
  154. package/dist/standalone/{chunk-SDQH4HR6.js → chunk-SU5DTRGK.js} +1 -1
  155. package/dist/standalone/{chunk-OSJ7HV7B.js → chunk-T5UMHPAB.js} +1 -1
  156. package/dist/standalone/{chunk-AMLIZFTD.js → chunk-T6HV2FQP.js} +1 -1
  157. package/dist/standalone/{chunk-NQX6SAC6.js → chunk-T7ZKNNGX.js} +1 -1
  158. package/dist/standalone/{chunk-FLVDICZL.js → chunk-TCYPNSTV.js} +1 -1
  159. package/dist/standalone/{chunk-U2YFL6EA.js → chunk-TQM6XHBA.js} +1 -1
  160. package/dist/standalone/{chunk-UHGLZ5RV.js → chunk-TRMWBRRU.js} +1 -1
  161. package/dist/standalone/{chunk-D5LY65EX.js → chunk-TW7KJSMR.js} +1 -1
  162. package/dist/standalone/{chunk-NMVFSJM7.js → chunk-TYD3V4NB.js} +1 -1
  163. package/dist/standalone/{chunk-YHK5UBXI.js → chunk-TZKLK52W.js} +1 -1
  164. package/dist/standalone/{chunk-TIQ3NI77.js → chunk-U4RXQSQ7.js} +1 -1
  165. package/dist/standalone/{chunk-ZXUEBA56.js → chunk-UNZ2UBVL.js} +1 -1
  166. package/dist/standalone/{chunk-SJLEEYCR.js → chunk-VJRNOSRY.js} +1 -1
  167. package/dist/standalone/{chunk-HKPDPKXD.js → chunk-WM72PRE3.js} +1 -1
  168. package/dist/standalone/{chunk-SV34MAIK.js → chunk-X4WHMCOZ.js} +1 -1
  169. package/dist/standalone/{chunk-GZX5XABE.js → chunk-XIRKBJPD.js} +1 -1
  170. package/dist/standalone/{chunk-FXTT2XP3.js → chunk-XKPD4SFN.js} +1 -1
  171. package/dist/standalone/chunk-XMSNLMWU.js +1 -0
  172. package/dist/standalone/{chunk-R66XCM3J.js → chunk-XOPFDWXX.js} +1 -1
  173. package/dist/standalone/{chunk-7W6WESSS.js → chunk-XQLOVFPP.js} +1 -1
  174. package/dist/standalone/{chunk-EEPCLLGE.js → chunk-XSHYZPGF.js} +1 -1
  175. package/dist/standalone/{chunk-KYONGQQ4.js → chunk-XST3UEHU.js} +1 -1
  176. package/dist/standalone/{chunk-AOHKAKKL.js → chunk-Y74LIFSL.js} +1 -1
  177. package/dist/standalone/{chunk-CTE6RPXC.js → chunk-YMEKCV27.js} +1 -1
  178. package/dist/standalone/{chunk-S6OBDEAQ.js → chunk-ZOQTXWPK.js} +1 -1
  179. package/dist/standalone/{chunk-CHGMDVEQ.js → chunk-ZZ5GICTF.js} +1 -1
  180. package/dist/standalone/studio.js +1 -1
  181. package/package.json +6 -6
  182. package/dist/packem_shared/internal-BXEjuLPN.mjs +0 -2
  183. package/dist/standalone/chunk-3Y5K3IQO.js +0 -1
  184. package/dist/standalone/chunk-4SJDWMH3.js +0 -1
  185. package/dist/standalone/chunk-BCIFRJ3Q.js +0 -1
  186. package/dist/standalone/chunk-FKM35PXF.js +0 -21
  187. package/dist/standalone/chunk-IMF6DJKL.js +0 -1
  188. package/dist/standalone/chunk-LPINY2IJ.js +0 -19
  189. package/dist/standalone/chunk-M3KSCNKR.js +0 -1
  190. package/dist/standalone/chunk-PZZWUL5U.js +0 -1
  191. package/dist/standalone/chunk-XBZUJDHD.js +0 -1
@@ -1 +1 @@
1
- import{a as y,b as D}from"./chunk-7RGYCU6F.js";import{a as _,b as z,c as j,d as E,e as B,f as H,g as L,h as V,i as O,j as T,k as Z,l as q}from"./chunk-CDV6T5KM.js";import{i as P}from"./chunk-SDQH4HR6.js";import{a as k}from"./chunk-2O6KKVH2.js";import{b as w}from"./chunk-6I42AM75.js";import{b as N,f as $,s as I}from"./chunk-LPINY2IJ.js";import{a as u,d as S,e as le,f as se,g as de}from"./chunk-OXFKZ4BM.js";var v=S(se(),1);var b=S(le(),1);var s=S(de(),1);function ie(a){let e=(0,v.c)(10),t,n,r;e[0]!==a?({className:t,selected:r,...n}=a,e[0]=a,e[1]=t,e[2]=n,e[3]=r):(t=e[1],n=e[2],r=e[3]);let l=r===!0?"":void 0,o;e[4]!==t?(o=N("rounded-md border border-border bg-card text-card-foreground shadow-sm transition-colors","data-[selected]:border-ring data-[selected]:ring-[3px] data-[selected]:ring-ring/30",t),e[4]=t,e[5]=o):o=e[5];let d;return e[6]!==n||e[7]!==l||e[8]!==o?(d=(0,s.jsx)("div",{"data-slot":"base-node","data-selected":l,className:o,...n}),e[6]=n,e[7]=l,e[8]=o,e[9]=d):d=e[9],d}u(ie,"ie");function ce(a){let e=(0,v.c)(8),t,n;e[0]!==a?({className:t,...n}=a,e[0]=a,e[1]=t,e[2]=n):(t=e[1],n=e[2]);let r;e[3]!==t?(r=N("flex items-center gap-2 rounded-t-md bg-muted/50 px-3 py-1.5",t),e[3]=t,e[4]=r):r=e[4];let l;return e[5]!==n||e[6]!==r?(l=(0,s.jsx)("div",{"data-slot":"base-node-header",className:r,...n}),e[5]=n,e[6]=r,e[7]=l):l=e[7],l}u(ce,"ce");function me(a){let e=(0,v.c)(8),t,n;e[0]!==a?({className:t,...n}=a,e[0]=a,e[1]=t,e[2]=n):(t=e[1],n=e[2]);let r;e[3]!==t?(r=N("flex flex-col",t),e[3]=t,e[4]=r):r=e[4];let l;return e[5]!==n||e[6]!==r?(l=(0,s.jsx)("div",{"data-slot":"base-node-content",className:r,...n}),e[5]=n,e[6]=r,e[7]=l):l=e[7],l}u(me,"de");var ue=3,fe=u((a,e,t)=>{let n=e?a:a.slice(0,ue),r=n.map(o=>JSON.stringify(o)).join(" | "),l=a.length-n.length;return l>0?`${r} ${t("+{count} more",{count:l})}`:r},"fe"),J=u((a,e,t)=>{let n=a.enumValues??[],r=n.length===0?a.type:fe(n,e,t),l=a.ref===void 0?r:`${r} \u2192 ${a.ref}`;return a.optional===!0?`${l}?`:l},"H"),pe=u(a=>{let e=(0,v.c)(23),{data:t,selected:n}=a,r=$(),l;e[0]!==t.label||e[1]!==t.loadError||e[2]!==r?(l=t.loadError===!0?(0,s.jsx)("span",{className:"px-3 py-1.5 text-xs text-destructive","data-testid":`sd-node-${t.label}-error`,children:r("Columns unavailable")}):(0,s.jsx)("span",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"\u2014"}),e[0]=t.label,e[1]=t.loadError,e[2]=r,e[3]=l):l=e[3];let o=l,d=`sd-node-${t.label}`,c;e[4]!==t.label?(c=(0,s.jsx)("span",{className:"truncate font-mono text-xs font-semibold",title:t.label,children:t.label}),e[4]=t.label,e[5]=c):c=e[5];let m;e[6]!==t.tier?(m=(0,s.jsx)("span",{className:"ms-auto",children:(0,s.jsx)(D,{tier:t.tier})}),e[6]=t.tier,e[7]=m):m=e[7];let i;e[8]!==c||e[9]!==m?(i=(0,s.jsxs)(ce,{children:[c,m]}),e[8]=c,e[9]=m,e[10]=i):i=e[10];let f;e[11]!==t.columns||e[12]!==t.label||e[13]!==o||e[14]!==r?(f=t.columns.length===0?o:t.columns.map(h=>(0,s.jsxs)("div",{className:N("relative flex items-center gap-2 border-t border-border px-3 py-1.5 text-xs first:border-t-0",h.pk===!0&&"bg-muted/30"),"data-testid":`sd-col-${t.label}-${h.name}`,children:[(0,s.jsx)(E,{className:"!h-2 !w-2 !-left-1 !border-border !bg-muted-foreground/70",id:h.name,isConnectable:!1,position:_.Left,type:"target"}),(0,s.jsx)("span",{className:"truncate font-mono",title:h.name,children:h.name}),h.pk===!0&&(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),h.ref!==void 0&&(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),(0,s.jsx)("span",{className:"ms-auto truncate text-muted-foreground",title:J(h,!0,r),children:J(h,!1,r)}),(0,s.jsx)(E,{className:"!h-2 !w-2 !-right-1 !border-border !bg-muted-foreground/70",id:h.name,isConnectable:!1,position:_.Right,type:"source"})]},h.name)),e[11]=t.columns,e[12]=t.label,e[13]=o,e[14]=r,e[15]=f):f=e[15];let p;e[16]!==f?(p=(0,s.jsx)(me,{children:f}),e[16]=f,e[17]=p):p=e[17];let x;return e[18]!==n||e[19]!==d||e[20]!==i||e[21]!==p?(x=(0,s.jsxs)(ie,{className:"w-64 overflow-hidden","data-testid":d,selected:n,children:[i,p]}),e[18]=n,e[19]=d,e[20]=i,e[21]=p,e[22]=x):x=e[22],x},"ue"),G=256,Q=112,W=36,M=24,he=480,be=1.4,ge=u(a=>{let e=Math.max(1,Math.round(Math.sqrt(be*a/(G+Q))));return Math.max(he,a/e)},"ge"),xe=38,Ne=28,A=u(a=>xe+Math.max(1,a)*Ne,"B"),ye=u((a,e)=>{let t=new Map;for(let o of a)t.set(o,[]);for(let o of e)o.to!==o.from&&t.has(o.from)&&t.has(o.to)&&t.get(o.from)?.push(o.to);let n=new Map,r=new Set,l=u(o=>{let d=n.get(o);if(d!==void 0)return d;if(r.has(o))return 0;r.add(o);let c=0;for(let m of t.get(o)??[])c=Math.max(c,l(m)+1);return r.delete(o),n.set(o,c),c},"r");for(let o of a)l(o);return n},"Ne"),ve=u((a,e,t)=>{let n=ye(a,e),r=new Map;for(let m of a){let i=n.get(m)??0,f=r.get(i);f===void 0?r.set(i,[m]):f.push(m)}let l=a.reduce((m,i)=>m+A(t.get(i)??0)+W,0),o=ge(l),d=[],c=0;for(let m of[...r.keys()].toSorted((i,f)=>i-f)){let i=0,f=M;for(let p of r.get(m)??[]){let x=A(t.get(p)??0);f>M&&f+x>o&&(i+=1,f=M),d.push({name:p,x:M+(c+i)*(G+Q),y:f}),f+=x+W}c+=i+1}return d},"ye"),we={databaseSchema:pe},U={backgroundColor:y.shard.color},X={backgroundColor:y.global.color},$e={global:!0,shard:!0},Me={},Ce=u(a=>{let e=a.find(t=>t.pk===!0)?.name;return e!==void 0?e:a.some(t=>t.name==="_id")?"_id":a.some(t=>t.name==="id")?"id":a[0]?.name??"_id"},"_e"),Y=u(a=>a.flatMap(e=>e.columns.filter(t=>t.ref!==void 0).map(t=>({column:t.name,from:e.name,to:t.ref}))),"K"),Se=u((a,e,t)=>{let n=a.map(d=>d.name),r=new Map(a.map(d=>[d.name,d.columns.length])),l=ve(n,Y(a),r),o=new Map(a.map(d=>[d.name,d]));return l.flatMap(({name:d,x:c,y:m})=>{let i=o.get(d);return i===void 0?[]:[{className:t[d],data:{columns:i.columns,label:d,loadError:e,tier:i.tier},id:d,position:{x:c,y:m},type:"databaseSchema"}]})},"we"),ke=u(a=>{let e=new Map(a.map(t=>[t.name,t.columns]));return Y(a).flatMap(t=>{let n=e.get(t.to)??[],r=e.get(t.from)??[],l=Ce(n);return!n.some(o=>o.name===l)||!r.some(o=>o.name===t.column)?[]:[{id:`${t.from}.${t.column}->${t.to}`,source:t.to,sourceHandle:l,target:t.from,targetHandle:t.column}]})},"Me"),_e=u(()=>{let a=(0,v.c)(15),e=$(),t;a[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:U}),y.shard.label]}),a[0]=t):t=a[0];let n;a[1]===Symbol.for("react.memo_cache_sentinel")?(n=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:X}),y.global.label]}),a[1]=n):n=a[1];let r;a[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),a[2]=r):r=a[2];let l;a[3]!==e?(l=e("Primary key"),a[3]=e,a[4]=l):l=a[4];let o;a[5]!==l?(o=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[r,l]}),a[5]=l,a[6]=o):o=a[6];let d;a[7]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),a[7]=d):d=a[7];let c;a[8]!==e?(c=e("Foreign key"),a[8]=e,a[9]=c):c=a[9];let m;a[10]!==c?(m=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[d,c]}),a[10]=c,a[11]=m):m=a[11];let i;return a[12]!==o||a[13]!==m?(i=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-xl border border-border bg-card/95 px-2.5 py-1.5 text-[11px] text-muted-foreground shadow-xs",children:[t,n,o,m]}),a[12]=o,a[13]=m,a[14]=i):i=a[14],i},"Ce"),ze=12,Ee=u(a=>{let e=(0,v.c)(9),{containerRef:t,seedKey:n}=a,r=V(),{fitView:l}=j(),o;e[0]!==t||e[1]!==l||e[2]!==r?(o=u(()=>{if(!r)return;let c=u(()=>{I(l({duration:0,maxZoom:1.6,padding:.14}))},"d");c();let m=t.current;if(m===null)return;let i=new ResizeObserver(()=>{c()});return i.observe(m),()=>{i.disconnect()}},"a"),e[0]=t,e[1]=l,e[2]=r,e[3]=o):o=e[3];let d;return e[4]!==t||e[5]!==l||e[6]!==r||e[7]!==n?(d=[t,l,r,n],e[4]=t,e[5]=l,e[6]=r,e[7]=n,e[8]=d):d=e[8],(0,b.useEffect)(o,d),null},"Te"),Ve=u(({columnsError:a,fill:e=!1,nodeClasses:t,tables:n,testIdPrefix:r})=>{let l=$(),[o,d]=(0,b.useState)($e),[c,m]=(0,b.useState)(""),i=(0,b.useMemo)(()=>{let g=c.trim().toLowerCase();return n.filter(K=>o[K.tier]&&K.name.toLowerCase().includes(g))},[n,o,c]),f=(0,b.useMemo)(()=>Se(i,a??!1,t??Me),[i,a,t]),p=(0,b.useMemo)(()=>ke(i),[i]),x=i.map(g=>g.name).join(","),[h,R,ee]=H(f),[te,F,ae]=L(p),C=(0,b.useRef)(null);(0,b.useEffect)(()=>{R(f)},[f,R]),(0,b.useEffect)(()=>{F(p)},[p,F]);let re=u(g=>{m(g.target.value)},"V"),oe=u(()=>{d(g=>({...g,shard:!g.shard}))},"W"),ne=u(()=>{d(g=>({...g,global:!g.global}))},"Y");return n.length===0?(0,s.jsx)("section",{className:"flex flex-col gap-2","data-testid":`${r}-section`,children:(0,s.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":`${r}-empty`,children:l("No tables to graph.")})}):(0,s.jsx)("section",{className:N("flex flex-col",e&&"min-h-0 flex-1"),"data-testid":`${r}-section`,children:(0,s.jsx)("div",{className:N("w-full overflow-hidden border border-border bg-muted/20",e?"min-h-0 flex-1":"h-[560px]"),"data-testid":`${r}-canvas`,ref:C,children:(0,s.jsxs)(B,{edges:te,elementsSelectable:!0,fitView:!0,minZoom:.2,nodes:h,nodesConnectable:!1,nodeTypes:we,onEdgesChange:ae,onNodesChange:ee,children:[(0,s.jsx)(O,{}),(0,s.jsx)(z,{position:"top-left",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card/95 p-2 shadow-xs",children:[(0,s.jsx)(P,{"aria-label":l("Find table\u2026"),className:"h-7 w-44 text-xs","data-testid":`${r}-find`,onChange:re,placeholder:l("Find table\u2026"),value:c}),(0,s.jsxs)("div",{"aria-label":l("Storage tiers"),className:"flex items-center gap-1.5",role:"group",children:[(0,s.jsxs)(k,{"aria-pressed":o.shard,className:"gap-1.5","data-testid":`${r}-tier-shard`,onClick:oe,size:"xs",type:"button",variant:o.shard?"default":"outline",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:U}),y.shard.label]}),(0,s.jsxs)(k,{"aria-pressed":o.global,className:"gap-1.5","data-testid":`${r}-tier-global`,onClick:ne,size:"xs",type:"button",variant:o.global?"default":"outline",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:X}),y.global.label]})]})]})}),(0,s.jsx)(z,{position:"bottom-center",children:(0,s.jsx)(_e,{})}),(0,s.jsx)(T,{showInteractive:!1}),i.length>ze&&(0,s.jsx)(Z,{className:"!border !border-border !bg-card",maskColor:"var(--color-muted)",nodeColor:"var(--color-muted-foreground)",nodeStrokeWidth:0,pannable:!0,zoomable:!0}),(0,s.jsx)(q,{containerRef:C,filenameBase:`${r}-schema-diagram`,testIdPrefix:r}),(0,s.jsx)(Ee,{containerRef:C,seedKey:x})]})})})},"Ke");export{Ve as a};
1
+ import{a as y,b as D}from"./chunk-7RGYCU6F.js";import{a as _,b as z,c as j,d as E,e as B,f as H,g as L,h as V,i as O,j as T,k as Z,l as q}from"./chunk-KZILJQX3.js";import{i as P}from"./chunk-SU5DTRGK.js";import{a as k}from"./chunk-6VAY6L4J.js";import{b as w}from"./chunk-PQH2LSJX.js";import{h as N,l as $,y as I}from"./chunk-BFE2DRP6.js";import{a as u,d as S,e as le,f as se,g as de}from"./chunk-OXFKZ4BM.js";var v=S(se(),1);var b=S(le(),1);var s=S(de(),1);function ie(a){let e=(0,v.c)(10),t,n,r;e[0]!==a?({className:t,selected:r,...n}=a,e[0]=a,e[1]=t,e[2]=n,e[3]=r):(t=e[1],n=e[2],r=e[3]);let l=r===!0?"":void 0,o;e[4]!==t?(o=N("rounded-md border border-border bg-card text-card-foreground shadow-sm transition-colors","data-[selected]:border-ring data-[selected]:ring-[3px] data-[selected]:ring-ring/30",t),e[4]=t,e[5]=o):o=e[5];let d;return e[6]!==n||e[7]!==l||e[8]!==o?(d=(0,s.jsx)("div",{"data-slot":"base-node","data-selected":l,className:o,...n}),e[6]=n,e[7]=l,e[8]=o,e[9]=d):d=e[9],d}u(ie,"ie");function ce(a){let e=(0,v.c)(8),t,n;e[0]!==a?({className:t,...n}=a,e[0]=a,e[1]=t,e[2]=n):(t=e[1],n=e[2]);let r;e[3]!==t?(r=N("flex items-center gap-2 rounded-t-md bg-muted/50 px-3 py-1.5",t),e[3]=t,e[4]=r):r=e[4];let l;return e[5]!==n||e[6]!==r?(l=(0,s.jsx)("div",{"data-slot":"base-node-header",className:r,...n}),e[5]=n,e[6]=r,e[7]=l):l=e[7],l}u(ce,"ce");function me(a){let e=(0,v.c)(8),t,n;e[0]!==a?({className:t,...n}=a,e[0]=a,e[1]=t,e[2]=n):(t=e[1],n=e[2]);let r;e[3]!==t?(r=N("flex flex-col",t),e[3]=t,e[4]=r):r=e[4];let l;return e[5]!==n||e[6]!==r?(l=(0,s.jsx)("div",{"data-slot":"base-node-content",className:r,...n}),e[5]=n,e[6]=r,e[7]=l):l=e[7],l}u(me,"de");var ue=3,fe=u((a,e,t)=>{let n=e?a:a.slice(0,ue),r=n.map(o=>JSON.stringify(o)).join(" | "),l=a.length-n.length;return l>0?`${r} ${t("+{count} more",{count:l})}`:r},"fe"),J=u((a,e,t)=>{let n=a.enumValues??[],r=n.length===0?a.type:fe(n,e,t),l=a.ref===void 0?r:`${r} \u2192 ${a.ref}`;return a.optional===!0?`${l}?`:l},"H"),pe=u(a=>{let e=(0,v.c)(23),{data:t,selected:n}=a,r=$(),l;e[0]!==t.label||e[1]!==t.loadError||e[2]!==r?(l=t.loadError===!0?(0,s.jsx)("span",{className:"px-3 py-1.5 text-xs text-destructive","data-testid":`sd-node-${t.label}-error`,children:r("Columns unavailable")}):(0,s.jsx)("span",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"\u2014"}),e[0]=t.label,e[1]=t.loadError,e[2]=r,e[3]=l):l=e[3];let o=l,d=`sd-node-${t.label}`,c;e[4]!==t.label?(c=(0,s.jsx)("span",{className:"truncate font-mono text-xs font-semibold",title:t.label,children:t.label}),e[4]=t.label,e[5]=c):c=e[5];let m;e[6]!==t.tier?(m=(0,s.jsx)("span",{className:"ms-auto",children:(0,s.jsx)(D,{tier:t.tier})}),e[6]=t.tier,e[7]=m):m=e[7];let i;e[8]!==c||e[9]!==m?(i=(0,s.jsxs)(ce,{children:[c,m]}),e[8]=c,e[9]=m,e[10]=i):i=e[10];let f;e[11]!==t.columns||e[12]!==t.label||e[13]!==o||e[14]!==r?(f=t.columns.length===0?o:t.columns.map(h=>(0,s.jsxs)("div",{className:N("relative flex items-center gap-2 border-t border-border px-3 py-1.5 text-xs first:border-t-0",h.pk===!0&&"bg-muted/30"),"data-testid":`sd-col-${t.label}-${h.name}`,children:[(0,s.jsx)(E,{className:"!h-2 !w-2 !-left-1 !border-border !bg-muted-foreground/70",id:h.name,isConnectable:!1,position:_.Left,type:"target"}),(0,s.jsx)("span",{className:"truncate font-mono",title:h.name,children:h.name}),h.pk===!0&&(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),h.ref!==void 0&&(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),(0,s.jsx)("span",{className:"ms-auto truncate text-muted-foreground",title:J(h,!0,r),children:J(h,!1,r)}),(0,s.jsx)(E,{className:"!h-2 !w-2 !-right-1 !border-border !bg-muted-foreground/70",id:h.name,isConnectable:!1,position:_.Right,type:"source"})]},h.name)),e[11]=t.columns,e[12]=t.label,e[13]=o,e[14]=r,e[15]=f):f=e[15];let p;e[16]!==f?(p=(0,s.jsx)(me,{children:f}),e[16]=f,e[17]=p):p=e[17];let x;return e[18]!==n||e[19]!==d||e[20]!==i||e[21]!==p?(x=(0,s.jsxs)(ie,{className:"w-64 overflow-hidden","data-testid":d,selected:n,children:[i,p]}),e[18]=n,e[19]=d,e[20]=i,e[21]=p,e[22]=x):x=e[22],x},"ue"),G=256,Q=112,W=36,M=24,he=480,be=1.4,ge=u(a=>{let e=Math.max(1,Math.round(Math.sqrt(be*a/(G+Q))));return Math.max(he,a/e)},"ge"),xe=38,Ne=28,A=u(a=>xe+Math.max(1,a)*Ne,"B"),ye=u((a,e)=>{let t=new Map;for(let o of a)t.set(o,[]);for(let o of e)o.to!==o.from&&t.has(o.from)&&t.has(o.to)&&t.get(o.from)?.push(o.to);let n=new Map,r=new Set,l=u(o=>{let d=n.get(o);if(d!==void 0)return d;if(r.has(o))return 0;r.add(o);let c=0;for(let m of t.get(o)??[])c=Math.max(c,l(m)+1);return r.delete(o),n.set(o,c),c},"r");for(let o of a)l(o);return n},"Ne"),ve=u((a,e,t)=>{let n=ye(a,e),r=new Map;for(let m of a){let i=n.get(m)??0,f=r.get(i);f===void 0?r.set(i,[m]):f.push(m)}let l=a.reduce((m,i)=>m+A(t.get(i)??0)+W,0),o=ge(l),d=[],c=0;for(let m of[...r.keys()].toSorted((i,f)=>i-f)){let i=0,f=M;for(let p of r.get(m)??[]){let x=A(t.get(p)??0);f>M&&f+x>o&&(i+=1,f=M),d.push({name:p,x:M+(c+i)*(G+Q),y:f}),f+=x+W}c+=i+1}return d},"ye"),we={databaseSchema:pe},U={backgroundColor:y.shard.color},X={backgroundColor:y.global.color},$e={global:!0,shard:!0},Me={},Ce=u(a=>{let e=a.find(t=>t.pk===!0)?.name;return e!==void 0?e:a.some(t=>t.name==="_id")?"_id":a.some(t=>t.name==="id")?"id":a[0]?.name??"_id"},"_e"),Y=u(a=>a.flatMap(e=>e.columns.filter(t=>t.ref!==void 0).map(t=>({column:t.name,from:e.name,to:t.ref}))),"K"),Se=u((a,e,t)=>{let n=a.map(d=>d.name),r=new Map(a.map(d=>[d.name,d.columns.length])),l=ve(n,Y(a),r),o=new Map(a.map(d=>[d.name,d]));return l.flatMap(({name:d,x:c,y:m})=>{let i=o.get(d);return i===void 0?[]:[{className:t[d],data:{columns:i.columns,label:d,loadError:e,tier:i.tier},id:d,position:{x:c,y:m},type:"databaseSchema"}]})},"we"),ke=u(a=>{let e=new Map(a.map(t=>[t.name,t.columns]));return Y(a).flatMap(t=>{let n=e.get(t.to)??[],r=e.get(t.from)??[],l=Ce(n);return!n.some(o=>o.name===l)||!r.some(o=>o.name===t.column)?[]:[{id:`${t.from}.${t.column}->${t.to}`,source:t.to,sourceHandle:l,target:t.from,targetHandle:t.column}]})},"Me"),_e=u(()=>{let a=(0,v.c)(15),e=$(),t;a[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:U}),y.shard.label]}),a[0]=t):t=a[0];let n;a[1]===Symbol.for("react.memo_cache_sentinel")?(n=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:X}),y.global.label]}),a[1]=n):n=a[1];let r;a[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),a[2]=r):r=a[2];let l;a[3]!==e?(l=e("Primary key"),a[3]=e,a[4]=l):l=a[4];let o;a[5]!==l?(o=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[r,l]}),a[5]=l,a[6]=o):o=a[6];let d;a[7]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),a[7]=d):d=a[7];let c;a[8]!==e?(c=e("Foreign key"),a[8]=e,a[9]=c):c=a[9];let m;a[10]!==c?(m=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[d,c]}),a[10]=c,a[11]=m):m=a[11];let i;return a[12]!==o||a[13]!==m?(i=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-xl border border-border bg-card/95 px-2.5 py-1.5 text-[11px] text-muted-foreground shadow-xs",children:[t,n,o,m]}),a[12]=o,a[13]=m,a[14]=i):i=a[14],i},"Ce"),ze=12,Ee=u(a=>{let e=(0,v.c)(9),{containerRef:t,seedKey:n}=a,r=V(),{fitView:l}=j(),o;e[0]!==t||e[1]!==l||e[2]!==r?(o=u(()=>{if(!r)return;let c=u(()=>{I(l({duration:0,maxZoom:1.6,padding:.14}))},"d");c();let m=t.current;if(m===null)return;let i=new ResizeObserver(()=>{c()});return i.observe(m),()=>{i.disconnect()}},"a"),e[0]=t,e[1]=l,e[2]=r,e[3]=o):o=e[3];let d;return e[4]!==t||e[5]!==l||e[6]!==r||e[7]!==n?(d=[t,l,r,n],e[4]=t,e[5]=l,e[6]=r,e[7]=n,e[8]=d):d=e[8],(0,b.useEffect)(o,d),null},"Te"),Ve=u(({columnsError:a,fill:e=!1,nodeClasses:t,tables:n,testIdPrefix:r})=>{let l=$(),[o,d]=(0,b.useState)($e),[c,m]=(0,b.useState)(""),i=(0,b.useMemo)(()=>{let g=c.trim().toLowerCase();return n.filter(K=>o[K.tier]&&K.name.toLowerCase().includes(g))},[n,o,c]),f=(0,b.useMemo)(()=>Se(i,a??!1,t??Me),[i,a,t]),p=(0,b.useMemo)(()=>ke(i),[i]),x=i.map(g=>g.name).join(","),[h,R,ee]=H(f),[te,F,ae]=L(p),C=(0,b.useRef)(null);(0,b.useEffect)(()=>{R(f)},[f,R]),(0,b.useEffect)(()=>{F(p)},[p,F]);let re=u(g=>{m(g.target.value)},"V"),oe=u(()=>{d(g=>({...g,shard:!g.shard}))},"W"),ne=u(()=>{d(g=>({...g,global:!g.global}))},"Y");return n.length===0?(0,s.jsx)("section",{className:"flex flex-col gap-2","data-testid":`${r}-section`,children:(0,s.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":`${r}-empty`,children:l("No tables to graph.")})}):(0,s.jsx)("section",{className:N("flex flex-col",e&&"min-h-0 flex-1"),"data-testid":`${r}-section`,children:(0,s.jsx)("div",{className:N("w-full overflow-hidden border border-border bg-muted/20",e?"min-h-0 flex-1":"h-[560px]"),"data-testid":`${r}-canvas`,ref:C,children:(0,s.jsxs)(B,{edges:te,elementsSelectable:!0,fitView:!0,minZoom:.2,nodes:h,nodesConnectable:!1,nodeTypes:we,onEdgesChange:ae,onNodesChange:ee,children:[(0,s.jsx)(O,{}),(0,s.jsx)(z,{position:"top-left",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card/95 p-2 shadow-xs",children:[(0,s.jsx)(P,{"aria-label":l("Find table\u2026"),className:"h-7 w-44 text-xs","data-testid":`${r}-find`,onChange:re,placeholder:l("Find table\u2026"),value:c}),(0,s.jsxs)("div",{"aria-label":l("Storage tiers"),className:"flex items-center gap-1.5",role:"group",children:[(0,s.jsxs)(k,{"aria-pressed":o.shard,className:"gap-1.5","data-testid":`${r}-tier-shard`,onClick:oe,size:"xs",type:"button",variant:o.shard?"default":"outline",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:U}),y.shard.label]}),(0,s.jsxs)(k,{"aria-pressed":o.global,className:"gap-1.5","data-testid":`${r}-tier-global`,onClick:ne,size:"xs",type:"button",variant:o.global?"default":"outline",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:X}),y.global.label]})]})]})}),(0,s.jsx)(z,{position:"bottom-center",children:(0,s.jsx)(_e,{})}),(0,s.jsx)(T,{showInteractive:!1}),i.length>ze&&(0,s.jsx)(Z,{className:"!border !border-border !bg-card",maskColor:"var(--color-muted)",nodeColor:"var(--color-muted-foreground)",nodeStrokeWidth:0,pannable:!0,zoomable:!0}),(0,s.jsx)(q,{containerRef:C,filenameBase:`${r}-schema-diagram`,testIdPrefix:r}),(0,s.jsx)(Ee,{containerRef:C,seedKey:x})]})})})},"Ke");export{Ve as a};
@@ -1 +1 @@
1
- import{a as D}from"./chunk-ILLDX6LU.js";import{a as k}from"./chunk-FIJVZCBO.js";import"./chunk-DBVJ5VLI.js";import"./chunk-LUHXNZI4.js";import"./chunk-ZTOREMGH.js";import"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as N}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as B}from"./chunk-IMF6DJKL.js";import"./chunk-OSJ7HV7B.js";import"./chunk-SL7LF2SO.js";import"./chunk-E26OT26O.js";import{a as u}from"./chunk-6UTZXEW3.js";import{c as p}from"./chunk-4SJDWMH3.js";import{h as R}from"./chunk-FKM35PXF.js";import"./chunk-WZTY3ZYI.js";import{a as S}from"./chunk-3Y5K3IQO.js";import{a as A,b as C,c as P,d as b,e as l,f as n}from"./chunk-CW57Q264.js";import{a as v,e as w}from"./chunk-MD67S53Z.js";import{f as j,w as I}from"./chunk-LPINY2IJ.js";import{a as m,d as H,g as Q}from"./chunk-OXFKZ4BM.js";var e=H(Q(),1);var _="payment_subscriptions",O="payment_events",V=[_,O],Y={},E=new Set(["active","trialing"]),z=new Set(["past_due","unpaid"]),s=m((a,t)=>{if(a[t]!==void 0)return a[t];let h=a.__doc__;return typeof h=="string"?R(h)?.[t]:void 0},"a"),o=m(a=>typeof a=="string"?a:typeof a=="number"||typeof a=="bigint"||typeof a=="boolean"?String(a):"","s"),J=m(a=>E.has(a)?"default":z.has(a)?"destructive":"outline","q"),ie=m(({limit:a=100})=>{let t=j(),h=k(),{data:x}=p(u.listTables,Y,{live:!0}),F=x!==void 0,L=Array.isArray(x)&&V.every(r=>x.some(d=>d.name===r)),c=h.payments&&L,i=p(u.readTablePage,{filters:[],limit:a,offset:0,orderBy:{column:"updatedAt",direction:"desc"},search:"",table:_},{enabled:c}),f=p(u.readTablePage,{filters:[],limit:25,offset:0,orderBy:{column:"processedAt",direction:"desc"},search:"",table:O},{enabled:c}),g=p(u.facetColumn,{column:"state",table:_},{enabled:c});D(()=>{if(c)return Promise.all([i.poll(),f.poll(),g.poll()])},!0);let y=i.data?.rows??[],M=f.data?.rows??[],U=i.error??f.error,q=i.error===null?f.errorSource:i.errorSource,G=i.data?.total??y.length,T=g.data?.values===void 0?y.filter(r=>E.has(o(s(r,"state")))).length:g.data.values.reduce((r,d)=>r+(E.has(o(d.value))?d.count:0),0);return F&&!c?(0,e.jsx)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:(0,e.jsx)(S,{description:t("No @lunora/payment tables found in this deployment. Add `.extend(paymentExtension)` to lunora/schema.ts and wire `payment` on createShardDO() to sync customers and subscriptions."),testId:"payments-unconfigured",title:t("No payments configured")})}):(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,e.jsx)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,e.jsxs)(v,{className:"justify-between gap-0 py-0",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Subscriptions")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:T}),(0,e.jsx)(N,{variant:"default",children:t("{count} active",{count:T})})]})]}),(0,e.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:t("{total} total",{total:G})})]})}),U===null?void 0:(0,e.jsx)(B,{error:q}),y.length===0&&!i.isLoading?(0,e.jsx)(S,{testId:"payments-empty",title:t("No subscriptions yet")}):(0,e.jsx)(v,{className:"overflow-hidden py-0",children:(0,e.jsx)(w,{className:"px-0",children:(0,e.jsxs)(A,{children:[(0,e.jsx)(C,{children:(0,e.jsxs)(b,{children:[(0,e.jsx)(l,{children:t("Provider")}),(0,e.jsx)(l,{children:t("Reference")}),(0,e.jsx)(l,{children:t("Plan")}),(0,e.jsx)(l,{children:t("State")}),(0,e.jsx)(l,{children:t("Renews")})]})}),(0,e.jsx)(P,{children:y.map(r=>{let d=o(s(r,"state"));return(0,e.jsxs)(b,{"data-testid":"payment-subscription-row",children:[(0,e.jsx)(n,{children:o(s(r,"provider"))}),(0,e.jsx)(n,{children:o(s(r,"referenceId"))}),(0,e.jsx)(n,{children:o(s(r,"priceId"))}),(0,e.jsx)(n,{children:(0,e.jsx)(N,{variant:J(d),children:d})}),(0,e.jsx)(n,{children:I(s(r,"currentPeriodEnd"))})]},o(s(r,"providerSubscriptionId")))})})]})})}),(0,e.jsxs)(v,{className:"overflow-hidden py-0",children:[(0,e.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Recent webhook events")})}),(0,e.jsx)(w,{className:"px-0",children:(0,e.jsx)(A,{children:(0,e.jsx)(P,{children:M.map(r=>(0,e.jsxs)(b,{"data-testid":"payment-event-row",children:[(0,e.jsx)(n,{children:o(s(r,"provider"))}),(0,e.jsx)(n,{className:"font-medium",children:o(s(r,"type"))}),(0,e.jsx)(n,{className:"text-muted-foreground",children:o(s(r,"providerEventId"))}),(0,e.jsx)(n,{children:I(s(r,"processedAt"))})]},o(s(r,"providerEventId"))))})})})]})]})},"oe");export{ie as PaymentsPanel};
1
+ import{a as D}from"./chunk-473JK2PQ.js";import{a as k}from"./chunk-BYOGQ2IV.js";import"./chunk-DBVJ5VLI.js";import"./chunk-LUHXNZI4.js";import"./chunk-ZTOREMGH.js";import"./chunk-6VAY6L4J.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as N}from"./chunk-PQH2LSJX.js";import"./chunk-4C4THJUD.js";import{a as B}from"./chunk-CZ6HBDIL.js";import"./chunk-T5UMHPAB.js";import"./chunk-NVKLYDOH.js";import"./chunk-E26OT26O.js";import{a as u}from"./chunk-6UTZXEW3.js";import{c as p}from"./chunk-4DAKKAK7.js";import{e as R}from"./chunk-BVX45MU5.js";import"./chunk-H7HZ42JY.js";import{a as S}from"./chunk-XMSNLMWU.js";import{a as A,b as C,c as P,d as b,e as l,f as n}from"./chunk-HHRYM6UW.js";import{a as v,e as w}from"./chunk-JSDKOE4U.js";import{C as I,l as j}from"./chunk-BFE2DRP6.js";import{a as m,d as H,g as Q}from"./chunk-OXFKZ4BM.js";var e=H(Q(),1);var _="payment_subscriptions",O="payment_events",V=[_,O],Y={},E=new Set(["active","trialing"]),z=new Set(["past_due","unpaid"]),s=m((a,t)=>{if(a[t]!==void 0)return a[t];let h=a.__doc__;return typeof h=="string"?R(h)?.[t]:void 0},"a"),o=m(a=>typeof a=="string"?a:typeof a=="number"||typeof a=="bigint"||typeof a=="boolean"?String(a):"","s"),J=m(a=>E.has(a)?"default":z.has(a)?"destructive":"outline","q"),ie=m(({limit:a=100})=>{let t=j(),h=k(),{data:x}=p(u.listTables,Y,{live:!0}),F=x!==void 0,L=Array.isArray(x)&&V.every(r=>x.some(d=>d.name===r)),c=h.payments&&L,i=p(u.readTablePage,{filters:[],limit:a,offset:0,orderBy:{column:"updatedAt",direction:"desc"},search:"",table:_},{enabled:c}),f=p(u.readTablePage,{filters:[],limit:25,offset:0,orderBy:{column:"processedAt",direction:"desc"},search:"",table:O},{enabled:c}),g=p(u.facetColumn,{column:"state",table:_},{enabled:c});D(()=>{if(c)return Promise.all([i.poll(),f.poll(),g.poll()])},!0);let y=i.data?.rows??[],M=f.data?.rows??[],U=i.error??f.error,q=i.error===null?f.errorSource:i.errorSource,G=i.data?.total??y.length,T=g.data?.values===void 0?y.filter(r=>E.has(o(s(r,"state")))).length:g.data.values.reduce((r,d)=>r+(E.has(o(d.value))?d.count:0),0);return F&&!c?(0,e.jsx)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:(0,e.jsx)(S,{description:t("No @lunora/payment tables found in this deployment. Add `.extend(paymentExtension)` to lunora/schema.ts and wire `payment` on createShardDO() to sync customers and subscriptions."),testId:"payments-unconfigured",title:t("No payments configured")})}):(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,e.jsx)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,e.jsxs)(v,{className:"justify-between gap-0 py-0",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Subscriptions")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:T}),(0,e.jsx)(N,{variant:"default",children:t("{count} active",{count:T})})]})]}),(0,e.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:t("{total} total",{total:G})})]})}),U===null?void 0:(0,e.jsx)(B,{error:q}),y.length===0&&!i.isLoading?(0,e.jsx)(S,{testId:"payments-empty",title:t("No subscriptions yet")}):(0,e.jsx)(v,{className:"overflow-hidden py-0",children:(0,e.jsx)(w,{className:"px-0",children:(0,e.jsxs)(A,{children:[(0,e.jsx)(C,{children:(0,e.jsxs)(b,{children:[(0,e.jsx)(l,{children:t("Provider")}),(0,e.jsx)(l,{children:t("Reference")}),(0,e.jsx)(l,{children:t("Plan")}),(0,e.jsx)(l,{children:t("State")}),(0,e.jsx)(l,{children:t("Renews")})]})}),(0,e.jsx)(P,{children:y.map(r=>{let d=o(s(r,"state"));return(0,e.jsxs)(b,{"data-testid":"payment-subscription-row",children:[(0,e.jsx)(n,{children:o(s(r,"provider"))}),(0,e.jsx)(n,{children:o(s(r,"referenceId"))}),(0,e.jsx)(n,{children:o(s(r,"priceId"))}),(0,e.jsx)(n,{children:(0,e.jsx)(N,{variant:J(d),children:d})}),(0,e.jsx)(n,{children:I(s(r,"currentPeriodEnd"))})]},o(s(r,"providerSubscriptionId")))})})]})})}),(0,e.jsxs)(v,{className:"overflow-hidden py-0",children:[(0,e.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Recent webhook events")})}),(0,e.jsx)(w,{className:"px-0",children:(0,e.jsx)(A,{children:(0,e.jsx)(P,{children:M.map(r=>(0,e.jsxs)(b,{"data-testid":"payment-event-row",children:[(0,e.jsx)(n,{children:o(s(r,"provider"))}),(0,e.jsx)(n,{className:"font-medium",children:o(s(r,"type"))}),(0,e.jsx)(n,{className:"text-muted-foreground",children:o(s(r,"providerEventId"))}),(0,e.jsx)(n,{children:I(s(r,"processedAt"))})]},o(s(r,"providerEventId"))))})})})]})]})},"oe");export{ie as PaymentsPanel};
@@ -1,4 +1,4 @@
1
- import{a as Fe,b as Ke}from"./chunk-DN3HPAOA.js";import"./chunk-5IIX2STA.js";import{a as We}from"./chunk-N5FOHLIG.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-6UTZXEW3.js";import"./chunk-4SJDWMH3.js";import{p as xe}from"./chunk-FKM35PXF.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(`
1
+ import{a as Fe,b as Ke}from"./chunk-O2X2XYCM.js";import"./chunk-O2NMPIV2.js";import{a as We}from"./chunk-JZD7ZN3F.js";import{d as He}from"./chunk-ONWGX5Y4.js";import"./chunk-SYGCASPT.js";import"./chunk-YMEKCV27.js";import"./chunk-LIGOLZND.js";import"./chunk-3GXPALXG.js";import"./chunk-TYD3V4NB.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-FXPAJDES.js";import{a as Pe}from"./chunk-XST3UEHU.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-SU5DTRGK.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import"./chunk-6VAY6L4J.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import{a as je}from"./chunk-T5UMHPAB.js";import{a as he}from"./chunk-6UTZXEW3.js";import"./chunk-4DAKKAK7.js";import{m as xe}from"./chunk-BVX45MU5.js";import"./chunk-H7HZ42JY.js";import"./chunk-HHRYM6UW.js";import{h as ie,l as se,n as me,o as fe,p as Ae,y as ae}from"./chunk-BFE2DRP6.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
2
  `))&&(e=e.trim()),(!t.newlineIsToken||!n.includes(`
3
3
  `))&&(n=n.trim())):t.ignoreNewlineAtEof&&!t.newlineIsToken&&(e.endsWith(`
4
4
  `)&&(e=e.slice(0,-1)),n.endsWith(`
@@ -1 +1 @@
1
- import{b as k}from"./chunk-LPINY2IJ.js";import{a as n,d as v,f as N,g as z}from"./chunk-OXFKZ4BM.js";var y=v(N(),1);var u=v(z(),1);var C={dialog:"fixed inset-0 z-[1000] flex justify-center bg-black/20 pt-[10vh]",drawer:"fixed inset-0 z-[1000] flex justify-end bg-black/20"},I={dialog:"flex h-fit w-[min(28rem,92vw)] flex-col gap-3 rounded-lg border border-border bg-background p-4 shadow-xl",drawer:"flex h-full w-[min(34rem,100vw)] flex-col gap-4 overflow-auto border-l border-border bg-background p-4 shadow-xl"},A=n(j=>{let e=(0,y.c)(18),{className:i,children:c,label:b,onClose:r,panelTestId:f,testId:g,variant:h}=j,o;e[0]!==r?(o=n(s=>{s.target===s.currentTarget&&r()},"r"),e[0]=r,e[1]=o):o=e[1];let m=o,t;e[2]!==r?(t=n(s=>{s.key==="Escape"&&r()},"a"),e[2]=r,e[3]=t):t=e[3];let p=t,x=C[h],w=I[h],l;e[4]!==i||e[5]!==w?(l=k(w,i),e[4]=i,e[5]=w,e[6]=l):l=e[6];let a;e[7]!==c||e[8]!==b||e[9]!==f||e[10]!==l?(a=(0,u.jsx)("div",{"aria-label":b,className:l,"data-testid":f,role:"dialog",children:c}),e[7]=c,e[8]=b,e[9]=f,e[10]=l,e[11]=a):a=e[11];let d;return e[12]!==m||e[13]!==p||e[14]!==x||e[15]!==a||e[16]!==g?(d=(0,u.jsx)("div",{className:x,"data-testid":g,onClick:m,onKeyDown:p,role:"presentation",children:a}),e[12]=m,e[13]=p,e[14]=x,e[15]=a,e[16]=g,e[17]=d):d=e[17],d},"_");export{A as a};
1
+ import{h as k}from"./chunk-BFE2DRP6.js";import{a as n,d as v,f as N,g as z}from"./chunk-OXFKZ4BM.js";var y=v(N(),1);var u=v(z(),1);var C={dialog:"fixed inset-0 z-[1000] flex justify-center bg-black/20 pt-[10vh]",drawer:"fixed inset-0 z-[1000] flex justify-end bg-black/20"},I={dialog:"flex h-fit w-[min(28rem,92vw)] flex-col gap-3 rounded-lg border border-border bg-background p-4 shadow-xl",drawer:"flex h-full w-[min(34rem,100vw)] flex-col gap-4 overflow-auto border-l border-border bg-background p-4 shadow-xl"},A=n(j=>{let e=(0,y.c)(18),{className:i,children:c,label:b,onClose:r,panelTestId:f,testId:g,variant:h}=j,o;e[0]!==r?(o=n(s=>{s.target===s.currentTarget&&r()},"r"),e[0]=r,e[1]=o):o=e[1];let m=o,t;e[2]!==r?(t=n(s=>{s.key==="Escape"&&r()},"a"),e[2]=r,e[3]=t):t=e[3];let p=t,x=C[h],w=I[h],l;e[4]!==i||e[5]!==w?(l=k(w,i),e[4]=i,e[5]=w,e[6]=l):l=e[6];let a;e[7]!==c||e[8]!==b||e[9]!==f||e[10]!==l?(a=(0,u.jsx)("div",{"aria-label":b,className:l,"data-testid":f,role:"dialog",children:c}),e[7]=c,e[8]=b,e[9]=f,e[10]=l,e[11]=a):a=e[11];let d;return e[12]!==m||e[13]!==p||e[14]!==x||e[15]!==a||e[16]!==g?(d=(0,u.jsx)("div",{className:x,"data-testid":g,onClick:m,onKeyDown:p,role:"presentation",children:a}),e[12]=m,e[13]=p,e[14]=x,e[15]=a,e[16]=g,e[17]=d):d=e[17],d},"_");export{A as a};
@@ -1 +1 @@
1
- import{a as Z}from"./chunk-5DNGK3NT.js";import{a as te}from"./chunk-ZWDORIZY.js";import{a as Y}from"./chunk-KYONGQQ4.js";import{b as X}from"./chunk-SLIDAWNX.js";import{a as W}from"./chunk-DBVJ5VLI.js";import"./chunk-6M7FLLMT.js";import{i as D}from"./chunk-LUHXNZI4.js";import"./chunk-ZTOREMGH.js";import"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{b as ae,c as ne}from"./chunk-WS36BO4R.js";import{a as q,b as ee}from"./chunk-NXNUGQHB.js";import{a as G}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import"./chunk-IMF6DJKL.js";import"./chunk-OSJ7HV7B.js";import"./chunk-SL7LF2SO.js";import"./chunk-E26OT26O.js";import{a as I}from"./chunk-6UTZXEW3.js";import{c as _}from"./chunk-4SJDWMH3.js";import{p as V}from"./chunk-FKM35PXF.js";import"./chunk-WZTY3ZYI.js";import"./chunk-CW57Q264.js";import"./chunk-MD67S53Z.js";import{f as M,h as C,i as A,o as Q,s as N}from"./chunk-LPINY2IJ.js";import{a as l,d as j,e as he,f as me,g as pe}from"./chunk-OXFKZ4BM.js";var E=j(me(),1);var c=j(he(),1);var S=j(pe(),1);var ge=l(t=>{let{suggestedIndex:e,table:i}=t;if(typeof i!="string"||i.length===0||typeof e!="object"||e===null)return!1;let{fields:a,name:n}=e;return!Array.isArray(a)||a.length===0||a.some(s=>typeof s!="string"||s.length===0)?!1:typeof n=="string"&&n.length>0},"ye"),be=l((t,e)=>`.index(${JSON.stringify(t)}, [${e.map(i=>JSON.stringify(i)).join(", ")}])`,"ge"),ye=l(t=>{let e=(0,E.c)(19),{fields:i,indexName:a,table:n,testId:s}=t,u=M(),[h,f]=(0,c.useState)(null),m;e[0]!==i||e[1]!==a?(m=l(()=>{let b=be(a,i),$="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if($===void 0){f({copied:!1,declaration:b});return}N($.writeText(b).then(()=>(f({copied:!0,declaration:b}),!0)),()=>{f({copied:!1,declaration:b})})},"m"),e[0]=i,e[1]=a,e[2]=m):m=e[2];let x=m;if(h!==null){let b;return e[3]!==h.copied||e[4]!==h.declaration||e[5]!==u||e[6]!==n||e[7]!==s?(b=h.copied?(0,S.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`${s}-applied`,children:u("Index declaration copied \u2014 add it to {table} in lunora/schema.ts.",{table:n})}):(0,S.jsxs)("span",{className:"flex flex-col gap-1 text-xs text-muted-foreground","data-testid":`${s}-manual`,children:[u("Could not reach the clipboard \u2014 add this to {table} in lunora/schema.ts:",{table:n}),(0,S.jsx)("code",{className:"font-mono break-all select-all",children:h.declaration})]}),e[3]=h.copied,e[4]=h.declaration,e[5]=u,e[6]=n,e[7]=s,e[8]=b):b=e[8],b}let T;e[9]!==u?(T=u("Copy?"),e[9]=u,e[10]=T):T=e[10];let p;e[11]!==u||e[12]!==n?(p=u("Copy index declaration for {table}",{table:n}),e[11]=u,e[12]=n,e[13]=p):p=e[13];let w;return e[14]!==x||e[15]!==T||e[16]!==p||e[17]!==s?(w=(0,S.jsx)(te,{confirmLabel:T,onConfirm:x,testId:s,children:p}),e[14]=x,e[15]=T,e[16]=p,e[17]=s,e[18]=w):w=e[18],w},"ve"),xe=l((t,e)=>{let i=new Map;for(let a of e){let n=`${a.table} ${a.index}`;i.set(n,(i.get(n)??0)+a.reads)}return t.map(a=>({index:a.index,reads:i.get(`${a.table} ${a.index}`)??0,table:a.table}))},"Se"),ve=l(t=>{let e=new Map;for(let i of t)for(let a of i.scannedTables??[])e.set(a.table,(e.get(a.table)??0)+a.scans);return[...e].map(([i,a])=>({scans:a,table:i}))},"Te"),ie=l((t,e)=>e.map(i=>({index:i.name,table:t})),"P"),we=l(t=>{let e=xe(t.declaredIndexes??[],t.indexHits??[]),i=ve(t.functions??[]),a=t.shardTraffic??[],n=t.analyticsMetrics,s=n&&n.indexHits.length>0?n.indexHits:e,u=n&&n.tableScans.length>0?n.tableScans:i,h=n&&n.shardTraffic.length>0?n.shardTraffic:a,f=ne({indexHits:s,schema:{tables:[]},shardTraffic:h,tableScans:u},{lints:ae,source:"runtime"}),m=t.suppressHotScanTables;return(m===void 0?f:f.filter(x=>!(x.metadata.kind==="hot_scan"&&typeof x.metadata.table=="string"&&m.has(x.metadata.table)))).map(x=>q(x))},"we"),Se=C(I.listTables),Te=C(I.listTableIndexes),Ie=C(I.listTablesIndexes),B=l(t=>`${(t*100).toFixed(1)}%`,"H"),re=l(t=>`${(t/1e3).toFixed(2)}s`,"V"),$e=l(t=>{if(t.length<=1)return t[0]??"";let e=t[t.length-1]??"";return`${t.slice(0,-1).join(", ")} and ${e}`},"Ne"),ke=l((t,e)=>({"high-error-rate":t("High error rate"),"high-evictions":t("High cache eviction rate"),"high-write-contention":t("High write contention"),"low-cache-hit-rate":t("Low cache hit rate"),"missing-index":t("Missing index"),"slow-function":t("Slow function"),"storage-headroom":t("Storage headroom")})[e.kind],"ke"),se=l((t,e)=>({"high-error-rate":t("{rate} of calls failed.",{rate:B(e.value)}),"high-evictions":t("{count} entries evicted recently.",{count:e.value}),"high-write-contention":t("{rate} of calls hit a write conflict \u2014 consider sharding to cut contention.",{rate:B(e.value)}),"low-cache-hit-rate":t("{rate} hit rate over recent traffic.",{rate:B(e.value)}),"missing-index":t("Slowest call took {duration} \u2014 it full-scanned {tables} with no index.",{duration:re(e.value),tables:$e(e.tables??[])}),"slow-function":t("Slowest call took {duration}.",{duration:re(e.value)}),"storage-headroom":t("{size} of the 10 GiB per-shard ceiling \u2014 plan a .shardBy() migration while it still has runway.",{size:Q(e.value)})})[e.kind],"U"),Ne=l(t=>{let e=(0,E.c)(10),{onJump:i,table:a}=t,n=M(),s;e[0]!==i||e[1]!==a?(s=l(()=>{i(a)},"i"),e[0]=i,e[1]=a,e[2]=s):s=e[2];let u=s,h=`in-add-index-${a}`,f;e[3]!==n||e[4]!==a?(f=n("Add index on {table}",{table:a}),e[3]=n,e[4]=a,e[5]=f):f=e[5];let m;return e[6]!==u||e[7]!==h||e[8]!==f?(m=(0,S.jsx)(G,{"data-testid":h,onClick:u,size:"sm",type:"button",variant:"outline",children:f}),e[6]=u,e[7]=h,e[8]=f,e[9]=m):m=e[9],m},"Be"),ze=l(({initialShardKey:t,loadShardTraffic:e})=>{let i=V(),a=D(),n=M(),{queryShardKey:s,setShardKey:u,shardKey:h}=Z(t),[f,m]=(0,c.useState)(null),[x,T]=(0,c.useState)(null),p=(0,c.useRef)(""),w=_(I.getMetrics,{},{live:!0,shardKey:s}),b=_(I.getFunctionStats,{},{live:!0,shardKey:s}),$=_(I.getAdvisories,{},{live:!0,shardKey:s}),L=w.data??null,H=b.data?.functions??null,F=$.data?.advisories??null,J=w.data?.indexHits??null,O=w.error!==null&&b.error!==null?w.error:null,oe=e??(r=>i.shardTraffic(r)),le=l(async(r,y)=>{let o=r[0];if(o===void 0||o===""){p.current===y&&T(null);return}try{let g=await oe(o);if(p.current!==y)return;let d=new Map;for(let v of g.shards)d.has(v.shardKey)||d.set(v.shardKey,{requests:v.requests,shardKey:v.shardKey});T([...d.values()])}catch{p.current===y&&T(null)}},"Y"),de=l(async(r,y)=>{let o=await Promise.allSettled(r.map(async d=>[d,await i.query(Te,{table:d},A(y))])),g=[];for(let d of o)if(d.status==="fulfilled"){let[v,k]=d.value;g.push(...ie(v,k.indexes))}return g},"Z"),z=(0,c.useEffectEvent)(async r=>{p.current=r;let y=[];try{let o=await i.query(Se,{},A(r));if(p.current!==r)return;X(r),y=o.map(d=>d.name);let g=[];if(y.length>0)try{let d=await i.query(Ie,{tables:y},A(r));if(p.current!==r)return;for(let[v,k]of Object.entries(d.indexesByTable))g.push(...ie(v,k))}catch{if(g=await de(y,r),p.current!==r)return}m(g)}catch{p.current===r&&m(null)}await le(y,r)});(0,c.useEffect)(()=>{N(z(s))},[s]);let ce=(0,c.useEffectEvent)(()=>{w.refetch(),b.refetch(),$.refetch(),N(z(s))});(0,c.useEffect)(()=>{let r=l(()=>{document.visibilityState==="visible"&&ce()},"r");return document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("visibilitychange",r)}},[]);let U=(0,c.useCallback)(r=>{N(a({search:{table:r},to:"/schema"}))},[a]),K=(0,c.useMemo)(()=>W(L,H),[H,L]),P=(0,c.useMemo)(()=>new Set(K.filter(r=>r.kind==="missing-index").flatMap(r=>r.tables??[])),[K]),R=(0,c.useMemo)(()=>we({declaredIndexes:f??[],functions:H,indexHits:J,shardTraffic:x,suppressHotScanTables:P}),[f,H,J,P,x]),ue=(0,c.useMemo)(()=>{let r=K.map(o=>{let g=o.kind==="missing-index"?o.tables??[]:[];return{action:g.length>0?g.map(d=>(0,S.jsx)(Ne,{onJump:U,table:d},d)):void 0,description:o.message===void 0?se(n,o):`${se(n,o)} \u2014 ${o.message}`,entity:o.fn,issueType:ke(n,o),key:`${o.kind}:${o.fn??""}`,level:o.severity}}),y=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(F??[]).map(o=>{let g=q(o);if(y.has(o.name)&&ge(o.metadata)){let{table:d,suggestedIndex:v}=o.metadata,k=`in-apply-index-${d}-${v.name}`;return{...g,action:(0,S.jsx)(ye,{fields:v.fields,indexName:v.name,table:d,testId:k})}}return g}),...R,...r]},[F,K,U,R,n]),fe=(0,S.jsx)(Y,{onChange:u,testId:"in-shard-input",value:h});return(0,S.jsx)(ee,{error:O,errorSource:O===null?void 0:w.errorSource,rows:ue,testId:"lunora-insights",toolbar:fe})},"Ue");export{ze as InsightsPanel};
1
+ import{a as Z}from"./chunk-5DNGK3NT.js";import{a as te}from"./chunk-FXPAJDES.js";import{a as Y}from"./chunk-XST3UEHU.js";import{b as X}from"./chunk-SLIDAWNX.js";import{a as W}from"./chunk-DBVJ5VLI.js";import"./chunk-6M7FLLMT.js";import{i as D}from"./chunk-LUHXNZI4.js";import"./chunk-ZTOREMGH.js";import"./chunk-SU5DTRGK.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{b as ae,c as ne}from"./chunk-WS36BO4R.js";import{a as q,b as ee}from"./chunk-BPEB4KFE.js";import{a as G}from"./chunk-6VAY6L4J.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import"./chunk-CZ6HBDIL.js";import"./chunk-T5UMHPAB.js";import"./chunk-NVKLYDOH.js";import"./chunk-E26OT26O.js";import{a as I}from"./chunk-6UTZXEW3.js";import{c as _}from"./chunk-4DAKKAK7.js";import{m as V}from"./chunk-BVX45MU5.js";import"./chunk-H7HZ42JY.js";import"./chunk-HHRYM6UW.js";import"./chunk-JSDKOE4U.js";import{l as M,n as C,o as A,u as Q,y as N}from"./chunk-BFE2DRP6.js";import{a as l,d as j,e as he,f as me,g as pe}from"./chunk-OXFKZ4BM.js";var E=j(me(),1);var c=j(he(),1);var S=j(pe(),1);var ge=l(t=>{let{suggestedIndex:e,table:i}=t;if(typeof i!="string"||i.length===0||typeof e!="object"||e===null)return!1;let{fields:a,name:n}=e;return!Array.isArray(a)||a.length===0||a.some(s=>typeof s!="string"||s.length===0)?!1:typeof n=="string"&&n.length>0},"ye"),be=l((t,e)=>`.index(${JSON.stringify(t)}, [${e.map(i=>JSON.stringify(i)).join(", ")}])`,"ge"),ye=l(t=>{let e=(0,E.c)(19),{fields:i,indexName:a,table:n,testId:s}=t,u=M(),[h,f]=(0,c.useState)(null),m;e[0]!==i||e[1]!==a?(m=l(()=>{let b=be(a,i),$="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if($===void 0){f({copied:!1,declaration:b});return}N($.writeText(b).then(()=>(f({copied:!0,declaration:b}),!0)),()=>{f({copied:!1,declaration:b})})},"m"),e[0]=i,e[1]=a,e[2]=m):m=e[2];let x=m;if(h!==null){let b;return e[3]!==h.copied||e[4]!==h.declaration||e[5]!==u||e[6]!==n||e[7]!==s?(b=h.copied?(0,S.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`${s}-applied`,children:u("Index declaration copied \u2014 add it to {table} in lunora/schema.ts.",{table:n})}):(0,S.jsxs)("span",{className:"flex flex-col gap-1 text-xs text-muted-foreground","data-testid":`${s}-manual`,children:[u("Could not reach the clipboard \u2014 add this to {table} in lunora/schema.ts:",{table:n}),(0,S.jsx)("code",{className:"font-mono break-all select-all",children:h.declaration})]}),e[3]=h.copied,e[4]=h.declaration,e[5]=u,e[6]=n,e[7]=s,e[8]=b):b=e[8],b}let T;e[9]!==u?(T=u("Copy?"),e[9]=u,e[10]=T):T=e[10];let p;e[11]!==u||e[12]!==n?(p=u("Copy index declaration for {table}",{table:n}),e[11]=u,e[12]=n,e[13]=p):p=e[13];let w;return e[14]!==x||e[15]!==T||e[16]!==p||e[17]!==s?(w=(0,S.jsx)(te,{confirmLabel:T,onConfirm:x,testId:s,children:p}),e[14]=x,e[15]=T,e[16]=p,e[17]=s,e[18]=w):w=e[18],w},"ve"),xe=l((t,e)=>{let i=new Map;for(let a of e){let n=`${a.table} ${a.index}`;i.set(n,(i.get(n)??0)+a.reads)}return t.map(a=>({index:a.index,reads:i.get(`${a.table} ${a.index}`)??0,table:a.table}))},"Se"),ve=l(t=>{let e=new Map;for(let i of t)for(let a of i.scannedTables??[])e.set(a.table,(e.get(a.table)??0)+a.scans);return[...e].map(([i,a])=>({scans:a,table:i}))},"Te"),ie=l((t,e)=>e.map(i=>({index:i.name,table:t})),"P"),we=l(t=>{let e=xe(t.declaredIndexes??[],t.indexHits??[]),i=ve(t.functions??[]),a=t.shardTraffic??[],n=t.analyticsMetrics,s=n&&n.indexHits.length>0?n.indexHits:e,u=n&&n.tableScans.length>0?n.tableScans:i,h=n&&n.shardTraffic.length>0?n.shardTraffic:a,f=ne({indexHits:s,schema:{tables:[]},shardTraffic:h,tableScans:u},{lints:ae,source:"runtime"}),m=t.suppressHotScanTables;return(m===void 0?f:f.filter(x=>!(x.metadata.kind==="hot_scan"&&typeof x.metadata.table=="string"&&m.has(x.metadata.table)))).map(x=>q(x))},"we"),Se=C(I.listTables),Te=C(I.listTableIndexes),Ie=C(I.listTablesIndexes),B=l(t=>`${(t*100).toFixed(1)}%`,"H"),re=l(t=>`${(t/1e3).toFixed(2)}s`,"V"),$e=l(t=>{if(t.length<=1)return t[0]??"";let e=t[t.length-1]??"";return`${t.slice(0,-1).join(", ")} and ${e}`},"Ne"),ke=l((t,e)=>({"high-error-rate":t("High error rate"),"high-evictions":t("High cache eviction rate"),"high-write-contention":t("High write contention"),"low-cache-hit-rate":t("Low cache hit rate"),"missing-index":t("Missing index"),"slow-function":t("Slow function"),"storage-headroom":t("Storage headroom")})[e.kind],"ke"),se=l((t,e)=>({"high-error-rate":t("{rate} of calls failed.",{rate:B(e.value)}),"high-evictions":t("{count} entries evicted recently.",{count:e.value}),"high-write-contention":t("{rate} of calls hit a write conflict \u2014 consider sharding to cut contention.",{rate:B(e.value)}),"low-cache-hit-rate":t("{rate} hit rate over recent traffic.",{rate:B(e.value)}),"missing-index":t("Slowest call took {duration} \u2014 it full-scanned {tables} with no index.",{duration:re(e.value),tables:$e(e.tables??[])}),"slow-function":t("Slowest call took {duration}.",{duration:re(e.value)}),"storage-headroom":t("{size} of the 10 GiB per-shard ceiling \u2014 plan a .shardBy() migration while it still has runway.",{size:Q(e.value)})})[e.kind],"U"),Ne=l(t=>{let e=(0,E.c)(10),{onJump:i,table:a}=t,n=M(),s;e[0]!==i||e[1]!==a?(s=l(()=>{i(a)},"i"),e[0]=i,e[1]=a,e[2]=s):s=e[2];let u=s,h=`in-add-index-${a}`,f;e[3]!==n||e[4]!==a?(f=n("Add index on {table}",{table:a}),e[3]=n,e[4]=a,e[5]=f):f=e[5];let m;return e[6]!==u||e[7]!==h||e[8]!==f?(m=(0,S.jsx)(G,{"data-testid":h,onClick:u,size:"sm",type:"button",variant:"outline",children:f}),e[6]=u,e[7]=h,e[8]=f,e[9]=m):m=e[9],m},"Be"),ze=l(({initialShardKey:t,loadShardTraffic:e})=>{let i=V(),a=D(),n=M(),{queryShardKey:s,setShardKey:u,shardKey:h}=Z(t),[f,m]=(0,c.useState)(null),[x,T]=(0,c.useState)(null),p=(0,c.useRef)(""),w=_(I.getMetrics,{},{live:!0,shardKey:s}),b=_(I.getFunctionStats,{},{live:!0,shardKey:s}),$=_(I.getAdvisories,{},{live:!0,shardKey:s}),L=w.data??null,H=b.data?.functions??null,F=$.data?.advisories??null,J=w.data?.indexHits??null,O=w.error!==null&&b.error!==null?w.error:null,oe=e??(r=>i.shardTraffic(r)),le=l(async(r,y)=>{let o=r[0];if(o===void 0||o===""){p.current===y&&T(null);return}try{let g=await oe(o);if(p.current!==y)return;let d=new Map;for(let v of g.shards)d.has(v.shardKey)||d.set(v.shardKey,{requests:v.requests,shardKey:v.shardKey});T([...d.values()])}catch{p.current===y&&T(null)}},"Y"),de=l(async(r,y)=>{let o=await Promise.allSettled(r.map(async d=>[d,await i.query(Te,{table:d},A(y))])),g=[];for(let d of o)if(d.status==="fulfilled"){let[v,k]=d.value;g.push(...ie(v,k.indexes))}return g},"Z"),z=(0,c.useEffectEvent)(async r=>{p.current=r;let y=[];try{let o=await i.query(Se,{},A(r));if(p.current!==r)return;X(r),y=o.map(d=>d.name);let g=[];if(y.length>0)try{let d=await i.query(Ie,{tables:y},A(r));if(p.current!==r)return;for(let[v,k]of Object.entries(d.indexesByTable))g.push(...ie(v,k))}catch{if(g=await de(y,r),p.current!==r)return}m(g)}catch{p.current===r&&m(null)}await le(y,r)});(0,c.useEffect)(()=>{N(z(s))},[s]);let ce=(0,c.useEffectEvent)(()=>{w.refetch(),b.refetch(),$.refetch(),N(z(s))});(0,c.useEffect)(()=>{let r=l(()=>{document.visibilityState==="visible"&&ce()},"r");return document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("visibilitychange",r)}},[]);let U=(0,c.useCallback)(r=>{N(a({search:{table:r},to:"/schema"}))},[a]),K=(0,c.useMemo)(()=>W(L,H),[H,L]),P=(0,c.useMemo)(()=>new Set(K.filter(r=>r.kind==="missing-index").flatMap(r=>r.tables??[])),[K]),R=(0,c.useMemo)(()=>we({declaredIndexes:f??[],functions:H,indexHits:J,shardTraffic:x,suppressHotScanTables:P}),[f,H,J,P,x]),ue=(0,c.useMemo)(()=>{let r=K.map(o=>{let g=o.kind==="missing-index"?o.tables??[]:[];return{action:g.length>0?g.map(d=>(0,S.jsx)(Ne,{onJump:U,table:d},d)):void 0,description:o.message===void 0?se(n,o):`${se(n,o)} \u2014 ${o.message}`,entity:o.fn,issueType:ke(n,o),key:`${o.kind}:${o.fn??""}`,level:o.severity}}),y=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(F??[]).map(o=>{let g=q(o);if(y.has(o.name)&&ge(o.metadata)){let{table:d,suggestedIndex:v}=o.metadata,k=`in-apply-index-${d}-${v.name}`;return{...g,action:(0,S.jsx)(ye,{fields:v.fields,indexName:v.name,table:d,testId:k})}}return g}),...R,...r]},[F,K,U,R,n]),fe=(0,S.jsx)(Y,{onChange:u,testId:"in-shard-input",value:h});return(0,S.jsx)(ee,{error:O,errorSource:O===null?void 0:w.errorSource,rows:ue,testId:"lunora-insights",toolbar:fe})},"Ue");export{ze as InsightsPanel};
@@ -1 +1 @@
1
- import{b as de}from"./chunk-UYEZR3BI.js";import{a as te,b as re,c as ne}from"./chunk-YHTHRYP5.js";import"./chunk-6M7FLLMT.js";import{b as Y}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as ae}from"./chunk-IMF6DJKL.js";import"./chunk-OSJ7HV7B.js";import"./chunk-SL7LF2SO.js";import"./chunk-E26OT26O.js";import{a as ee}from"./chunk-6UTZXEW3.js";import{c as Z}from"./chunk-4SJDWMH3.js";import"./chunk-FKM35PXF.js";import"./chunk-WZTY3ZYI.js";import{a as le,b as oe,c as se,d as H,e as z,f as G}from"./chunk-CW57Q264.js";import{a as P,e as q}from"./chunk-MD67S53Z.js";import{f as X}from"./chunk-LPINY2IJ.js";import{a as g,d as W,f as ce,g as me}from"./chunk-OXFKZ4BM.js";var J=W(ce(),1);var t=W(me(),1);var ue={binding:"outline",secret:"destructive",var:"secondary"},pe=g((n,e)=>{if(n===void 0)return[];let u=[];return n.workerUrl!==void 0&&u.push({label:e("URL"),value:n.workerUrl}),n.environment!==void 0&&u.push({label:e("Environment"),value:n.environment}),n.deploymentId!==void 0&&u.push({label:e("Deployment"),value:n.deploymentId}),n.versionTag!==void 0&&u.push({label:e("Version"),value:n.versionTag}),u},"ce"),ie=g(n=>{let e=(0,J.c)(18),{modifier:u,name:r,label:p}=n,A=te(),x;e[0]!==r?(x=g(o=>{if(!["Escape","Tab"].includes(o.key)){if(o.shiftKey){o.preventDefault();return}o.preventDefault(),re(r,o.key)}},"b"),e[0]=r,e[1]=x):x=e[1];let i=x,c=`set-shortcut-${r}`,m;e[2]!==p?(m=(0,t.jsx)("dt",{className:"text-muted-foreground",children:p}),e[2]=p,e[3]=m):m=e[3];let h;e[4]!==u?(h=(0,t.jsx)("kbd",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:u}),e[4]=u,e[5]=h):h=e[5];let l=`set-shortcut-input-${r}`,f=A[r],s;e[6]!==p||e[7]!==i||e[8]!==l||e[9]!==f?(s=(0,t.jsx)("input",{"aria-label":p,className:"h-7 w-12 rounded-md border border-border bg-background text-center font-mono text-xs uppercase outline-none focus-visible:border-ring","data-testid":l,onKeyDown:i,readOnly:!0,value:f}),e[6]=p,e[7]=i,e[8]=l,e[9]=f,e[10]=s):s=e[10];let a;e[11]!==h||e[12]!==s?(a=(0,t.jsxs)("dd",{className:"flex items-center gap-1.5",children:[h,s]}),e[11]=h,e[12]=s,e[13]=a):a=e[13];let d;return e[14]!==c||e[15]!==m||e[16]!==a?(d=(0,t.jsxs)("div",{className:"contents","data-testid":c,children:[m,a]}),e[14]=c,e[15]=m,e[16]=a,e[17]=d):d=e[17],d},"z"),Se=g(n=>{let e=(0,J.c)(85),{initialShardKey:u}=n,r=X(),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let A=u??"",x;e[1]!==A?(x={shardKey:A},e[1]=A,e[2]=x):x=e[2];let{data:i,error:c,errorSource:m,isLoading:h}=Z(ee.getSettings,p,x),l,f,s,a,d,o,b;if(e[3]!==c||e[4]!==m||e[5]!==i?.deploy||e[6]!==i?.settings||e[7]!==r){let Q=pe(i?.deploy,r),M;e[15]!==i?.settings?(M=i?.settings??[],e[15]=i?.settings,e[16]=M):M=e[16],l=M,f="flex flex-col gap-4",s="lunora-settings";let V;e[17]!==r?(V=r("Open in Cloudflare"),e[17]=r,e[18]=V):V=e[18],e[19]!==V?(a=(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:de,rel:"noreferrer",target:"_blank",children:V})}),e[19]=V,e[20]=a):a=e[20];let $;e[21]!==r?($=r("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[21]=r,e[22]=$):$=e[22],e[23]!==$?(d=(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:$}),e[23]=$,e[24]=d):d=e[24],e[25]!==c||e[26]!==m?(o=c!==null&&(0,t.jsx)(ae,{error:m,testId:"set-error"}),e[25]=c,e[26]=m,e[27]=o):o=e[27],b=Q.length>0&&(0,t.jsxs)(P,{className:"py-0","data-testid":"set-deploy",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Deployment")})}),(0,t.jsx)(q,{className:"py-3",children:(0,t.jsx)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:Q.map(he)})})]}),e[3]=c,e[4]=m,e[5]=i?.deploy,e[6]=i?.settings,e[7]=r,e[8]=l,e[9]=f,e[10]=s,e[11]=a,e[12]=d,e[13]=o,e[14]=b}else l=e[8],f=e[9],s=e[10],a=e[11],d=e[12],o=e[13],b=e[14];let y;e[28]!==r?(y=r("Keyboard shortcuts"),e[28]=r,e[29]=y):y=e[29];let v;e[30]!==y?(v=(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y}),e[30]=y,e[31]=v):v=e[31];let N;e[32]!==r?(N=r("Reset"),e[32]=r,e[33]=N):N=e[33];let k;e[34]!==N?(k=(0,t.jsx)("button",{className:"rounded px-1 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:text-foreground","data-testid":"set-shortcut-reset",onClick:ne,type:"button",children:N}),e[34]=N,e[35]=k):k=e[35];let w;e[36]!==v||e[37]!==k?(w=(0,t.jsxs)("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[v,k]}),e[36]=v,e[37]=k,e[38]=w):w=e[38];let C;e[39]!==r?(C=r("Command palette"),e[39]=r,e[40]=C):C=e[40];let S;e[41]!==C?(S=(0,t.jsx)(ie,{label:C,modifier:"\u2318/Ctrl",name:"palette"}),e[41]=C,e[42]=S):S=e[42];let T;e[43]!==r?(T=r("Operation console"),e[43]=r,e[44]=T):T=e[44];let D;e[45]!==T?(D=(0,t.jsx)(ie,{label:T,modifier:"Ctrl",name:"console"}),e[45]=T,e[46]=D):D=e[46];let _;e[47]!==S||e[48]!==D?(_=(0,t.jsxs)("dl",{className:"grid grid-cols-[10rem_minmax(0,1fr)] items-center gap-x-4 gap-y-2 text-sm",children:[S,D]}),e[47]=S,e[48]=D,e[49]=_):_=e[49];let E;e[50]!==r?(E=r("Stored in this browser. Focus a box and press a key to rebind it."),e[50]=r,e[51]=E):E=e[51];let I;e[52]!==E?(I=(0,t.jsx)("p",{className:"pt-3 text-xs text-muted-foreground",children:E}),e[52]=E,e[53]=I):I=e[53];let K;e[54]!==_||e[55]!==I?(K=(0,t.jsxs)(q,{className:"py-3",children:[_,I]}),e[54]=_,e[55]=I,e[56]=K):K=e[56];let O;e[57]!==w||e[58]!==K?(O=(0,t.jsxs)(P,{className:"py-0","data-testid":"set-preferences",children:[w,K]}),e[57]=w,e[58]=K,e[59]=O):O=e[59];let U;e[60]!==r?(U=r("Environment & bindings"),e[60]=r,e[61]=U):U=e[61];let j;e[62]!==U?(j=(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:U})}),e[62]=U,e[63]=j):j=e[63];let F;e[64]!==c||e[65]!==h||e[66]!==l.length||e[67]!==r?(F=c===null&&!h&&l.length===0&&(0,t.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:r("No environment variables or bindings.")}),e[64]=c,e[65]=h,e[66]=l.length,e[67]=r,e[68]=F):F=e[68];let L;e[69]!==l||e[70]!==r?(L=l.length>0&&(0,t.jsx)(q,{className:"px-0 py-0",children:(0,t.jsxs)(le,{"data-testid":"set-table",children:[(0,t.jsx)(oe,{children:(0,t.jsxs)(H,{children:[(0,t.jsx)(z,{children:r("name")}),(0,t.jsx)(z,{children:r("kind")}),(0,t.jsx)(z,{children:r("value")})]})}),(0,t.jsx)(se,{children:l.map(fe)})]})}),e[69]=l,e[70]=r,e[71]=L):L=e[71];let R;e[72]!==j||e[73]!==F||e[74]!==L?(R=(0,t.jsxs)(P,{className:"py-0",children:[j,F,L]}),e[72]=j,e[73]=F,e[74]=L,e[75]=R):R=e[75];let B;return e[76]!==O||e[77]!==R||e[78]!==f||e[79]!==s||e[80]!==a||e[81]!==d||e[82]!==o||e[83]!==b?(B=(0,t.jsxs)("div",{className:f,"data-testid":s,children:[a,d,o,b,O,R]}),e[76]=O,e[77]=R,e[78]=f,e[79]=s,e[80]=a,e[81]=d,e[82]=o,e[83]=b,e[84]=B):B=e[84],B},"Ce");function he(n){return(0,t.jsxs)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,t.jsx)("dt",{className:"text-muted-foreground",children:n.label}),(0,t.jsx)("dd",{className:"truncate font-mono text-xs",title:n.value,children:n.value})]},n.label)}g(he,"me");function fe(n){return(0,t.jsxs)(H,{"data-testid":"set-row",children:[(0,t.jsx)(G,{className:"font-mono text-xs font-medium",children:n.name}),(0,t.jsx)(G,{children:(0,t.jsx)(Y,{variant:ue[n.kind],children:n.bindingType??n.kind})}),(0,t.jsx)(G,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:n.value??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},n.name)}g(fe,"fe");export{Se as SettingsPanel};
1
+ import{b as de}from"./chunk-UYEZR3BI.js";import{a as te,b as re,c as ne}from"./chunk-YHTHRYP5.js";import"./chunk-6M7FLLMT.js";import{b as Y}from"./chunk-PQH2LSJX.js";import"./chunk-4C4THJUD.js";import{a as ae}from"./chunk-CZ6HBDIL.js";import"./chunk-T5UMHPAB.js";import"./chunk-NVKLYDOH.js";import"./chunk-E26OT26O.js";import{a as ee}from"./chunk-6UTZXEW3.js";import{c as Z}from"./chunk-4DAKKAK7.js";import"./chunk-BVX45MU5.js";import"./chunk-H7HZ42JY.js";import{a as le,b as oe,c as se,d as H,e as z,f as G}from"./chunk-HHRYM6UW.js";import{a as P,e as q}from"./chunk-JSDKOE4U.js";import{l as X}from"./chunk-BFE2DRP6.js";import{a as g,d as W,f as ce,g as me}from"./chunk-OXFKZ4BM.js";var J=W(ce(),1);var t=W(me(),1);var ue={binding:"outline",secret:"destructive",var:"secondary"},pe=g((n,e)=>{if(n===void 0)return[];let u=[];return n.workerUrl!==void 0&&u.push({label:e("URL"),value:n.workerUrl}),n.environment!==void 0&&u.push({label:e("Environment"),value:n.environment}),n.deploymentId!==void 0&&u.push({label:e("Deployment"),value:n.deploymentId}),n.versionTag!==void 0&&u.push({label:e("Version"),value:n.versionTag}),u},"ce"),ie=g(n=>{let e=(0,J.c)(18),{modifier:u,name:r,label:p}=n,A=te(),x;e[0]!==r?(x=g(o=>{if(!["Escape","Tab"].includes(o.key)){if(o.shiftKey){o.preventDefault();return}o.preventDefault(),re(r,o.key)}},"b"),e[0]=r,e[1]=x):x=e[1];let i=x,c=`set-shortcut-${r}`,m;e[2]!==p?(m=(0,t.jsx)("dt",{className:"text-muted-foreground",children:p}),e[2]=p,e[3]=m):m=e[3];let h;e[4]!==u?(h=(0,t.jsx)("kbd",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:u}),e[4]=u,e[5]=h):h=e[5];let l=`set-shortcut-input-${r}`,f=A[r],s;e[6]!==p||e[7]!==i||e[8]!==l||e[9]!==f?(s=(0,t.jsx)("input",{"aria-label":p,className:"h-7 w-12 rounded-md border border-border bg-background text-center font-mono text-xs uppercase outline-none focus-visible:border-ring","data-testid":l,onKeyDown:i,readOnly:!0,value:f}),e[6]=p,e[7]=i,e[8]=l,e[9]=f,e[10]=s):s=e[10];let a;e[11]!==h||e[12]!==s?(a=(0,t.jsxs)("dd",{className:"flex items-center gap-1.5",children:[h,s]}),e[11]=h,e[12]=s,e[13]=a):a=e[13];let d;return e[14]!==c||e[15]!==m||e[16]!==a?(d=(0,t.jsxs)("div",{className:"contents","data-testid":c,children:[m,a]}),e[14]=c,e[15]=m,e[16]=a,e[17]=d):d=e[17],d},"z"),Se=g(n=>{let e=(0,J.c)(85),{initialShardKey:u}=n,r=X(),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let A=u??"",x;e[1]!==A?(x={shardKey:A},e[1]=A,e[2]=x):x=e[2];let{data:i,error:c,errorSource:m,isLoading:h}=Z(ee.getSettings,p,x),l,f,s,a,d,o,b;if(e[3]!==c||e[4]!==m||e[5]!==i?.deploy||e[6]!==i?.settings||e[7]!==r){let Q=pe(i?.deploy,r),M;e[15]!==i?.settings?(M=i?.settings??[],e[15]=i?.settings,e[16]=M):M=e[16],l=M,f="flex flex-col gap-4",s="lunora-settings";let V;e[17]!==r?(V=r("Open in Cloudflare"),e[17]=r,e[18]=V):V=e[18],e[19]!==V?(a=(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:de,rel:"noreferrer",target:"_blank",children:V})}),e[19]=V,e[20]=a):a=e[20];let $;e[21]!==r?($=r("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[21]=r,e[22]=$):$=e[22],e[23]!==$?(d=(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:$}),e[23]=$,e[24]=d):d=e[24],e[25]!==c||e[26]!==m?(o=c!==null&&(0,t.jsx)(ae,{error:m,testId:"set-error"}),e[25]=c,e[26]=m,e[27]=o):o=e[27],b=Q.length>0&&(0,t.jsxs)(P,{className:"py-0","data-testid":"set-deploy",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Deployment")})}),(0,t.jsx)(q,{className:"py-3",children:(0,t.jsx)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:Q.map(he)})})]}),e[3]=c,e[4]=m,e[5]=i?.deploy,e[6]=i?.settings,e[7]=r,e[8]=l,e[9]=f,e[10]=s,e[11]=a,e[12]=d,e[13]=o,e[14]=b}else l=e[8],f=e[9],s=e[10],a=e[11],d=e[12],o=e[13],b=e[14];let y;e[28]!==r?(y=r("Keyboard shortcuts"),e[28]=r,e[29]=y):y=e[29];let v;e[30]!==y?(v=(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y}),e[30]=y,e[31]=v):v=e[31];let N;e[32]!==r?(N=r("Reset"),e[32]=r,e[33]=N):N=e[33];let k;e[34]!==N?(k=(0,t.jsx)("button",{className:"rounded px-1 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:text-foreground","data-testid":"set-shortcut-reset",onClick:ne,type:"button",children:N}),e[34]=N,e[35]=k):k=e[35];let w;e[36]!==v||e[37]!==k?(w=(0,t.jsxs)("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[v,k]}),e[36]=v,e[37]=k,e[38]=w):w=e[38];let C;e[39]!==r?(C=r("Command palette"),e[39]=r,e[40]=C):C=e[40];let S;e[41]!==C?(S=(0,t.jsx)(ie,{label:C,modifier:"\u2318/Ctrl",name:"palette"}),e[41]=C,e[42]=S):S=e[42];let T;e[43]!==r?(T=r("Operation console"),e[43]=r,e[44]=T):T=e[44];let D;e[45]!==T?(D=(0,t.jsx)(ie,{label:T,modifier:"Ctrl",name:"console"}),e[45]=T,e[46]=D):D=e[46];let _;e[47]!==S||e[48]!==D?(_=(0,t.jsxs)("dl",{className:"grid grid-cols-[10rem_minmax(0,1fr)] items-center gap-x-4 gap-y-2 text-sm",children:[S,D]}),e[47]=S,e[48]=D,e[49]=_):_=e[49];let E;e[50]!==r?(E=r("Stored in this browser. Focus a box and press a key to rebind it."),e[50]=r,e[51]=E):E=e[51];let I;e[52]!==E?(I=(0,t.jsx)("p",{className:"pt-3 text-xs text-muted-foreground",children:E}),e[52]=E,e[53]=I):I=e[53];let K;e[54]!==_||e[55]!==I?(K=(0,t.jsxs)(q,{className:"py-3",children:[_,I]}),e[54]=_,e[55]=I,e[56]=K):K=e[56];let O;e[57]!==w||e[58]!==K?(O=(0,t.jsxs)(P,{className:"py-0","data-testid":"set-preferences",children:[w,K]}),e[57]=w,e[58]=K,e[59]=O):O=e[59];let U;e[60]!==r?(U=r("Environment & bindings"),e[60]=r,e[61]=U):U=e[61];let j;e[62]!==U?(j=(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:U})}),e[62]=U,e[63]=j):j=e[63];let F;e[64]!==c||e[65]!==h||e[66]!==l.length||e[67]!==r?(F=c===null&&!h&&l.length===0&&(0,t.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:r("No environment variables or bindings.")}),e[64]=c,e[65]=h,e[66]=l.length,e[67]=r,e[68]=F):F=e[68];let L;e[69]!==l||e[70]!==r?(L=l.length>0&&(0,t.jsx)(q,{className:"px-0 py-0",children:(0,t.jsxs)(le,{"data-testid":"set-table",children:[(0,t.jsx)(oe,{children:(0,t.jsxs)(H,{children:[(0,t.jsx)(z,{children:r("name")}),(0,t.jsx)(z,{children:r("kind")}),(0,t.jsx)(z,{children:r("value")})]})}),(0,t.jsx)(se,{children:l.map(fe)})]})}),e[69]=l,e[70]=r,e[71]=L):L=e[71];let R;e[72]!==j||e[73]!==F||e[74]!==L?(R=(0,t.jsxs)(P,{className:"py-0",children:[j,F,L]}),e[72]=j,e[73]=F,e[74]=L,e[75]=R):R=e[75];let B;return e[76]!==O||e[77]!==R||e[78]!==f||e[79]!==s||e[80]!==a||e[81]!==d||e[82]!==o||e[83]!==b?(B=(0,t.jsxs)("div",{className:f,"data-testid":s,children:[a,d,o,b,O,R]}),e[76]=O,e[77]=R,e[78]=f,e[79]=s,e[80]=a,e[81]=d,e[82]=o,e[83]=b,e[84]=B):B=e[84],B},"Ce");function he(n){return(0,t.jsxs)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,t.jsx)("dt",{className:"text-muted-foreground",children:n.label}),(0,t.jsx)("dd",{className:"truncate font-mono text-xs",title:n.value,children:n.value})]},n.label)}g(he,"me");function fe(n){return(0,t.jsxs)(H,{"data-testid":"set-row",children:[(0,t.jsx)(G,{className:"font-mono text-xs font-medium",children:n.name}),(0,t.jsx)(G,{children:(0,t.jsx)(Y,{variant:ue[n.kind],children:n.bindingType??n.kind})}),(0,t.jsx)(G,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:n.value??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},n.name)}g(fe,"fe");export{Se as SettingsPanel};
@@ -1 +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-IMF6DJKL.js";import"./chunk-OSJ7HV7B.js";import"./chunk-SL7LF2SO.js";import"./chunk-E26OT26O.js";import{a as Q}from"./chunk-6UTZXEW3.js";import{c as J}from"./chunk-4SJDWMH3.js";import"./chunk-FKM35PXF.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};
1
+ import{a as re}from"./chunk-KYAG2YMF.js";import{a as X}from"./chunk-5DNGK3NT.js";import{a as V}from"./chunk-XST3UEHU.js";import"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import"./chunk-SU5DTRGK.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as R}from"./chunk-6VAY6L4J.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as O}from"./chunk-PQH2LSJX.js";import"./chunk-4C4THJUD.js";import{a as Y}from"./chunk-CZ6HBDIL.js";import"./chunk-T5UMHPAB.js";import"./chunk-NVKLYDOH.js";import"./chunk-E26OT26O.js";import{a as Q}from"./chunk-6UTZXEW3.js";import{c as J}from"./chunk-4DAKKAK7.js";import"./chunk-BVX45MU5.js";import"./chunk-H7HZ42JY.js";import{a as G}from"./chunk-XMSNLMWU.js";import{a as Z,b as ee,c as te,d as P,e as n,f as o}from"./chunk-HHRYM6UW.js";import{a as U,e as W}from"./chunk-JSDKOE4U.js";import{C as H,h as L,l as z}from"./chunk-BFE2DRP6.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};
@@ -1 +1 @@
1
- import{j as g}from"./chunk-LPINY2IJ.js";import{a,d as b,e as x,f as y}from"./chunk-OXFKZ4BM.js";var k=b(y(),1),n=b(x(),1);var _=a(function(o,d,s){let t=(0,k.c)(15),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c={kind:"loading"},t[0]=c):c=t[0];let[h,E]=(0,n.useState)(c),r;t[1]!==d?(r=a(async()=>d(),"f"),t[1]=d,t[2]=r):r=t[2];let p=(0,n.useEffectEvent)(r),f;t[3]!==s?(f=a(e=>s(e),"m"),t[3]=s,t[4]=f):f=t[4];let v=(0,n.useEffectEvent)(f),i;t[5]!==v||t[6]!==p||t[7]!==o?(i=a(()=>{if(o!==void 0)return;let e=!1;return p().then(l=>(e||E(v(l)),l)).catch(l=>{e||E({kind:"error",message:g(l)})}),()=>{e=!0}},"u"),t[5]=v,t[6]=p,t[7]=o,t[8]=i):i=t[8];let m;t[9]!==o?(m=[o],t[9]=o,t[10]=m):m=t[10],(0,n.useEffect)(i,m);let u;return t[11]!==s||t[12]!==h||t[13]!==o?(u=o===void 0?h:s(o),t[11]=s,t[12]=h,t[13]=o,t[14]=u):u=t[14],u},"$");export{_ as a};
1
+ import{p as g}from"./chunk-BFE2DRP6.js";import{a,d as b,e as x,f as y}from"./chunk-OXFKZ4BM.js";var k=b(y(),1),n=b(x(),1);var _=a(function(o,d,s){let t=(0,k.c)(15),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c={kind:"loading"},t[0]=c):c=t[0];let[h,E]=(0,n.useState)(c),r;t[1]!==d?(r=a(async()=>d(),"f"),t[1]=d,t[2]=r):r=t[2];let p=(0,n.useEffectEvent)(r),f;t[3]!==s?(f=a(e=>s(e),"m"),t[3]=s,t[4]=f):f=t[4];let v=(0,n.useEffectEvent)(f),i;t[5]!==v||t[6]!==p||t[7]!==o?(i=a(()=>{if(o!==void 0)return;let e=!1;return p().then(l=>(e||E(v(l)),l)).catch(l=>{e||E({kind:"error",message:g(l)})}),()=>{e=!0}},"u"),t[5]=v,t[6]=p,t[7]=o,t[8]=i):i=t[8];let m;t[9]!==o?(m=[o],t[9]=o,t[10]=m):m=t[10],(0,n.useEffect)(i,m);let u;return t[11]!==s||t[12]!==h||t[13]!==o?(u=o===void 0?h:s(o),t[11]=s,t[12]=h,t[13]=o,t[14]=u):u=t[14],u},"$");export{_ as a};
@@ -1 +1 @@
1
- import{f as P}from"./chunk-LPINY2IJ.js";import{a as x,d as k,f as w,g as z}from"./chunk-OXFKZ4BM.js";var $=k(w(),1);var n=k(z(),1);var S=[25,50,100,250],j=x(b=>{let e=(0,$.c)(18),{onChange:p,options:m,prefix:o,value:f}=b,t=P(),u;e[0]!==p?(u=x(v=>{p(Number.parseInt(v.target.value,10))},"c"),e[0]=p,e[1]=u):u=e[1];let a=u,g=`${o}-page-size`,i;e[2]!==t?(i=t("Rows per page"),e[2]=t,e[3]=i):i=e[3];let s;e[4]!==i?(s=(0,n.jsx)("span",{children:i}),e[4]=i,e[5]=s):s=e[5];let c=`${o}-page-size`,l=`${o}-page-size`,r;e[6]!==m?(r=m.map(T),e[6]=m,e[7]=r):r=e[7];let d;e[8]!==a||e[9]!==c||e[10]!==l||e[11]!==r||e[12]!==f?(d=(0,n.jsx)("select",{className:"h-6 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":c,id:l,onChange:a,value:f,children:r}),e[8]=a,e[9]=c,e[10]=l,e[11]=r,e[12]=f,e[13]=d):d=e[13];let h;return e[14]!==g||e[15]!==s||e[16]!==d?(h=(0,n.jsxs)("label",{className:"flex items-center gap-1.5",htmlFor:g,children:[s,d]}),e[14]=g,e[15]=s,e[16]=d,e[17]=h):h=e[17],h},"C"),E=x(b=>{let e=(0,$.c)(25),{onJump:p,page:m,pages:o,prefix:f}=b,t=P(),u;e[0]!==p||e[1]!==o?(u=x(y=>{let C=Number.parseInt(y,10);Number.isNaN(C)||p(Math.min(Math.max(1,C),Math.max(1,o)))},"c"),e[0]=p,e[1]=o,e[2]=u):u=e[2];let a=u,g;e[3]!==a?(g=x(y=>{y.key==="Enter"&&a(y.currentTarget.value)},"b"),e[3]=a,e[4]=g):g=e[4];let i=g,s;e[5]!==a?(s=x(y=>{a(y.currentTarget.value)},"o"),e[5]=a,e[6]=s):s=e[6];let c=s,l;e[7]!==t?(l=t("Page"),e[7]=t,e[8]=l):l=e[8];let r;e[9]!==t?(r=t("Page"),e[9]=t,e[10]=r):r=e[10];let d=`${f}-page-jump`,h=Math.max(1,o),v;e[11]!==c||e[12]!==i||e[13]!==m||e[14]!==r||e[15]!==d||e[16]!==h?(v=(0,n.jsx)("input",{"aria-label":r,className:"h-6 w-12 rounded-md border border-border bg-background px-1 text-center tabular-nums outline-none focus-visible:border-ring","data-testid":d,defaultValue:m,max:h,min:1,onBlur:c,onKeyDown:i,type:"number"},m),e[11]=c,e[12]=i,e[13]=m,e[14]=r,e[15]=d,e[16]=h,e[17]=v):v=e[17];let N;e[18]!==o||e[19]!==t?(N=t("of {pages}",{pages:o}),e[18]=o,e[19]=t,e[20]=N):N=e[20];let M;return e[21]!==l||e[22]!==v||e[23]!==N?(M=(0,n.jsxs)("span",{className:"flex items-center gap-1.5 tabular-nums",children:[l,v,N]}),e[21]=l,e[22]=v,e[23]=N,e[24]=M):M=e[24],M},"j"),I=x(({hasNext:b,hasPrevious:e,onJumpToPage:p,onNext:m,onPageSizeChange:o,onPrevious:f,pageSize:t,pageSizeOptions:u=S,prefix:a,rangeEnd:g,rangeStart:i,total:s})=>{let c=P(),l="rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",r=t!==void 0&&t>0?Math.max(1,Math.ceil(s/t)):1,d=t!==void 0&&t>0?Math.floor(Math.max(0,i-1)/t)+1:1;return(0,n.jsxs)("div",{className:"flex w-full items-center justify-between gap-3 text-xs text-muted-foreground",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[t!==void 0&&o!==void 0&&(0,n.jsx)(j,{onChange:o,options:u,prefix:a,value:t}),(0,n.jsx)("span",{className:"tabular-nums","data-testid":`${a}-page-info`,children:c("{rangeStart}-{rangeEnd} of {total}",{rangeEnd:g,rangeStart:i,total:s})})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("button",{className:l,"data-testid":`${a}-prev`,disabled:!e,onClick:f,type:"button",children:c("Previous")}),t!==void 0&&p!==void 0&&(0,n.jsx)(E,{onJump:p,page:d,pages:r,prefix:a}),(0,n.jsx)("button",{className:l,"data-testid":`${a}-next`,disabled:!b,onClick:m,type:"button",children:c("Next")})]})]})},"_");function T(b){return(0,n.jsx)("option",{value:b,children:b},b)}x(T,"E");export{I as a};
1
+ import{l as P}from"./chunk-BFE2DRP6.js";import{a as x,d as k,f as w,g as z}from"./chunk-OXFKZ4BM.js";var $=k(w(),1);var n=k(z(),1);var S=[25,50,100,250],j=x(b=>{let e=(0,$.c)(18),{onChange:p,options:m,prefix:o,value:f}=b,t=P(),u;e[0]!==p?(u=x(v=>{p(Number.parseInt(v.target.value,10))},"c"),e[0]=p,e[1]=u):u=e[1];let a=u,g=`${o}-page-size`,i;e[2]!==t?(i=t("Rows per page"),e[2]=t,e[3]=i):i=e[3];let s;e[4]!==i?(s=(0,n.jsx)("span",{children:i}),e[4]=i,e[5]=s):s=e[5];let c=`${o}-page-size`,l=`${o}-page-size`,r;e[6]!==m?(r=m.map(T),e[6]=m,e[7]=r):r=e[7];let d;e[8]!==a||e[9]!==c||e[10]!==l||e[11]!==r||e[12]!==f?(d=(0,n.jsx)("select",{className:"h-6 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":c,id:l,onChange:a,value:f,children:r}),e[8]=a,e[9]=c,e[10]=l,e[11]=r,e[12]=f,e[13]=d):d=e[13];let h;return e[14]!==g||e[15]!==s||e[16]!==d?(h=(0,n.jsxs)("label",{className:"flex items-center gap-1.5",htmlFor:g,children:[s,d]}),e[14]=g,e[15]=s,e[16]=d,e[17]=h):h=e[17],h},"C"),E=x(b=>{let e=(0,$.c)(25),{onJump:p,page:m,pages:o,prefix:f}=b,t=P(),u;e[0]!==p||e[1]!==o?(u=x(y=>{let C=Number.parseInt(y,10);Number.isNaN(C)||p(Math.min(Math.max(1,C),Math.max(1,o)))},"c"),e[0]=p,e[1]=o,e[2]=u):u=e[2];let a=u,g;e[3]!==a?(g=x(y=>{y.key==="Enter"&&a(y.currentTarget.value)},"b"),e[3]=a,e[4]=g):g=e[4];let i=g,s;e[5]!==a?(s=x(y=>{a(y.currentTarget.value)},"o"),e[5]=a,e[6]=s):s=e[6];let c=s,l;e[7]!==t?(l=t("Page"),e[7]=t,e[8]=l):l=e[8];let r;e[9]!==t?(r=t("Page"),e[9]=t,e[10]=r):r=e[10];let d=`${f}-page-jump`,h=Math.max(1,o),v;e[11]!==c||e[12]!==i||e[13]!==m||e[14]!==r||e[15]!==d||e[16]!==h?(v=(0,n.jsx)("input",{"aria-label":r,className:"h-6 w-12 rounded-md border border-border bg-background px-1 text-center tabular-nums outline-none focus-visible:border-ring","data-testid":d,defaultValue:m,max:h,min:1,onBlur:c,onKeyDown:i,type:"number"},m),e[11]=c,e[12]=i,e[13]=m,e[14]=r,e[15]=d,e[16]=h,e[17]=v):v=e[17];let N;e[18]!==o||e[19]!==t?(N=t("of {pages}",{pages:o}),e[18]=o,e[19]=t,e[20]=N):N=e[20];let M;return e[21]!==l||e[22]!==v||e[23]!==N?(M=(0,n.jsxs)("span",{className:"flex items-center gap-1.5 tabular-nums",children:[l,v,N]}),e[21]=l,e[22]=v,e[23]=N,e[24]=M):M=e[24],M},"j"),I=x(({hasNext:b,hasPrevious:e,onJumpToPage:p,onNext:m,onPageSizeChange:o,onPrevious:f,pageSize:t,pageSizeOptions:u=S,prefix:a,rangeEnd:g,rangeStart:i,total:s})=>{let c=P(),l="rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",r=t!==void 0&&t>0?Math.max(1,Math.ceil(s/t)):1,d=t!==void 0&&t>0?Math.floor(Math.max(0,i-1)/t)+1:1;return(0,n.jsxs)("div",{className:"flex w-full items-center justify-between gap-3 text-xs text-muted-foreground",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[t!==void 0&&o!==void 0&&(0,n.jsx)(j,{onChange:o,options:u,prefix:a,value:t}),(0,n.jsx)("span",{className:"tabular-nums","data-testid":`${a}-page-info`,children:c("{rangeStart}-{rangeEnd} of {total}",{rangeEnd:g,rangeStart:i,total:s})})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("button",{className:l,"data-testid":`${a}-prev`,disabled:!e,onClick:f,type:"button",children:c("Previous")}),t!==void 0&&p!==void 0&&(0,n.jsx)(E,{onJump:p,page:d,pages:r,prefix:a}),(0,n.jsx)("button",{className:l,"data-testid":`${a}-next`,disabled:!b,onClick:m,type:"button",children:c("Next")})]})]})},"_");function T(b){return(0,n.jsx)("option",{value:b,children:b},b)}x(T,"E");export{I as a};
@@ -1 +1 @@
1
- import{b as Me}from"./chunk-LRXCL6IA.js";import{a as ve}from"./chunk-R36QXQZX.js";import{b as ye,c as we}from"./chunk-IH2CJZF2.js";import{a as xe}from"./chunk-YJWR6ZWC.js";import{a as Ne}from"./chunk-XBZUJDHD.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import{a as be}from"./chunk-5DNGK3NT.js";import{a as fe}from"./chunk-KYONGQQ4.js";import{b as he}from"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import{i as me}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as oe}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as ge}from"./chunk-IMF6DJKL.js";import"./chunk-OSJ7HV7B.js";import"./chunk-SL7LF2SO.js";import"./chunk-E26OT26O.js";import{a as ce}from"./chunk-6UTZXEW3.js";import{c as ie}from"./chunk-4SJDWMH3.js";import"./chunk-FKM35PXF.js";import"./chunk-WZTY3ZYI.js";import{a as ue}from"./chunk-3Y5K3IQO.js";import{b as te,f as U,p as pe,w as de}from"./chunk-LPINY2IJ.js";import{a as m,d as le,e as Ce,f as Le,g as Te}from"./chunk-OXFKZ4BM.js";var O=le(Le(),1),A=le(Ce(),1);var s=le(Te(),1);var Pe=.5,Ie=4,Se=m(n=>Math.min(100,Math.max(0,n)),"ce"),Ke=m((n,e)=>{if(!Number.isFinite(e)||e<=0)return{leftPercent:0,widthPercent:100};let t=Se(n.offsetMs/e*100),a=n.durationMs/e*100,l=Math.max(Pe,Math.min(Se(a),100-t));return{leftPercent:t,widthPercent:l}},"Ce"),De=m((n,e,t=!1)=>{let a=e.trim().toLowerCase(),l=t?n.filter(r=>!r.ok):n;return a===""?[...l]:l.filter(r=>r.rootName.toLowerCase().includes(a)||r.functionPath.toLowerCase().includes(a)||r.traceId.toLowerCase().includes(a)||r.spans.some(o=>o.name.toLowerCase().includes(a)||o.spanId.toLowerCase().includes(a)))},"Ee"),G=m(n=>Number.isFinite(n)?n>0&&n<1?`${n.toFixed(2)}ms`:`${String(Math.round(n))}ms`:"\u2014","q"),Fe=m(n=>!Number.isFinite(n)||n<=0?[]:Array.from({length:Ie},(e,t)=>{let a=(t+1)/Ie;return{label:G(n*a),percent:a*100}}),"Pe"),ke=m(n=>{if(typeof n=="string")return n;try{return JSON.stringify(n,pe)}catch{return String(n)}},"ue"),ee=m(n=>{let e=(0,O.c)(7),{label:t,value:a}=n,l;e[0]!==t?(l=(0,s.jsx)("dt",{className:"w-40 shrink-0 text-muted-foreground",children:t}),e[0]=t,e[1]=l):l=e[1];let r;e[2]!==a?(r=(0,s.jsx)("dd",{className:"min-w-0 break-all",children:a}),e[2]=a,e[3]=r):r=e[3];let o;return e[4]!==l||e[5]!==r?(o=(0,s.jsxs)("div",{className:"flex gap-2",children:[l,r]}),e[4]=l,e[5]=r,e[6]=o):o=e[6],o},"Y"),je=m(n=>{let e=(0,O.c)(68),{span:t}=n,a=U(),l,r,o,d,i,u;if(e[0]!==t.attributes||e[1]!==t.durationMs||e[2]!==t.error||e[3]!==t.events||e[4]!==t.kind||e[5]!==t.offsetMs||e[6]!==t.parentSpanId||e[7]!==t.spanId||e[8]!==a){let $=Object.entries(t.attributes??{}),_;e[15]!==t.events?(_=t.events??[],e[15]=t.events,e[16]=_):_=e[16],l=_,r="border-t border-border bg-background/60 px-3 py-2 font-mono text-xs",o="tr-span-detail";let y;e[17]!==a?(y=a("Span ID"),e[17]=a,e[18]=y):y=e[18];let w;e[19]!==t.spanId||e[20]!==y?(w=(0,s.jsx)(ee,{label:y,value:t.spanId}),e[19]=t.spanId,e[20]=y,e[21]=w):w=e[21];let M;e[22]!==a?(M=a("Parent span ID"),e[22]=a,e[23]=M):M=e[23];let p;e[24]!==t.parentSpanId||e[25]!==a?(p=t.parentSpanId===""?a("\u2014 (trace root)"):t.parentSpanId,e[24]=t.parentSpanId,e[25]=a,e[26]=p):p=e[26];let h;e[27]!==p||e[28]!==M?(h=(0,s.jsx)(ee,{label:M,value:p}),e[27]=p,e[28]=M,e[29]=h):h=e[29];let b;e[30]!==a?(b=a("Kind"),e[30]=a,e[31]=b):b=e[31];let C=t.kind??"internal",S;e[32]!==b||e[33]!==C?(S=(0,s.jsx)(ee,{label:b,value:C}),e[32]=b,e[33]=C,e[34]=S):S=e[34];let I;e[35]!==a?(I=a("Started at"),e[35]=a,e[36]=I):I=e[36];let g;e[37]!==t.offsetMs||e[38]!==a?(g=a("+{offset}",{offset:G(t.offsetMs)}),e[37]=t.offsetMs,e[38]=a,e[39]=g):g=e[39];let x;e[40]!==I||e[41]!==g?(x=(0,s.jsx)(ee,{label:I,value:g}),e[40]=I,e[41]=g,e[42]=x):x=e[42];let k;e[43]!==a?(k=a("Duration"),e[43]=a,e[44]=k):k=e[44];let f;e[45]!==t.durationMs?(f=G(t.durationMs),e[45]=t.durationMs,e[46]=f):f=e[46];let N;e[47]!==k||e[48]!==f?(N=(0,s.jsx)(ee,{label:k,value:f}),e[47]=k,e[48]=f,e[49]=N):N=e[49],e[50]!==h||e[51]!==S||e[52]!==x||e[53]!==N||e[54]!==w?(d=(0,s.jsxs)("dl",{className:"flex flex-col gap-1",children:[w,h,S,x,N]}),e[50]=h,e[51]=S,e[52]=x,e[53]=N,e[54]=w,e[55]=d):d=e[55],e[56]!==t.error?(i=t.error!==void 0&&(0,s.jsxs)("div",{className:"mt-2 rounded-md border border-destructive/40 bg-destructive/10 px-2 py-1.5","data-testid":"tr-detail-error",children:[(0,s.jsx)("span",{className:"font-semibold text-destructive",children:t.error.type}),(0,s.jsx)("p",{className:"whitespace-pre-wrap break-all text-destructive",children:t.error.message})]}),e[56]=t.error,e[57]=i):i=e[57],u=$.length>0&&(0,s.jsxs)("div",{className:"mt-2","data-testid":"tr-detail-attributes",children:[(0,s.jsx)("p",{className:"mb-1 text-muted-foreground",children:a("Attributes")}),(0,s.jsx)("dl",{className:"flex flex-col gap-1",children:$.map(Ee)})]}),e[0]=t.attributes,e[1]=t.durationMs,e[2]=t.error,e[3]=t.events,e[4]=t.kind,e[5]=t.offsetMs,e[6]=t.parentSpanId,e[7]=t.spanId,e[8]=a,e[9]=l,e[10]=r,e[11]=o,e[12]=d,e[13]=i,e[14]=u}else l=e[9],r=e[10],o=e[11],d=e[12],i=e[13],u=e[14];let c;e[58]!==l||e[59]!==a?(c=l.length>0&&(0,s.jsxs)("div",{className:"mt-2","data-testid":"tr-detail-events",children:[(0,s.jsx)("p",{className:"mb-1 text-muted-foreground",children:a("Events")}),(0,s.jsx)("ul",{className:"flex flex-col gap-1",children:l.map(Oe)})]}),e[58]=l,e[59]=a,e[60]=c):c=e[60];let v;return e[61]!==r||e[62]!==o||e[63]!==d||e[64]!==i||e[65]!==u||e[66]!==c?(v=(0,s.jsxs)("div",{className:r,"data-testid":o,children:[d,i,u,c]}),e[61]=r,e[62]=o,e[63]=d,e[64]=i,e[65]=u,e[66]=c,e[67]=v):v=e[67],v},"Fe");function Ee(n){let[e,t]=n;return(0,s.jsx)(ee,{label:e,value:ke(t)},e)}m(Ee,"Ke");function Ae(n){let[e,t]=n;return`${e}=${ke(t)}`}m(Ae,"Re");function Oe(n){return(0,s.jsxs)("li",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:de(n.ts)}),(0,s.jsx)(oe,{variant:"secondary",children:n.name}),(0,s.jsx)("span",{className:"min-w-0 break-all text-muted-foreground",children:Object.entries(n.attributes??{}).map(Ae).join(" ")})]},`${n.name}:${String(n.ts)}`)}m(Oe,"Ae");var Be=14,_e="grid grid-cols-[14rem_1fr_4rem_16rem_16rem] items-center gap-2 px-3",We=m(n=>{let e=(0,O.c)(17),{traceDurationMs:t}=n,a,l,r,o,d,i;if(e[0]!==t){i=Symbol.for("react.early_return_sentinel");e:{let v=Fe(t);if(v.length===0){i=null;break e}e[7]===Symbol.for("react.memo_cache_sentinel")?(r=te(_e,"border-b border-border py-1 font-mono text-[10px] text-muted-foreground"),e[7]=r):r=e[7],o="tr-ruler",e[8]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsx)("span",{}),e[8]=d):d=e[8],a="relative h-3",l=v.map(Je)}e[0]=t,e[1]=a,e[2]=l,e[3]=r,e[4]=o,e[5]=d,e[6]=i}else a=e[1],l=e[2],r=e[3],o=e[4],d=e[5],i=e[6];if(i!==Symbol.for("react.early_return_sentinel"))return i;let u;e[9]!==a||e[10]!==l?(u=(0,s.jsx)("span",{className:a,children:l}),e[9]=a,e[10]=l,e[11]=u):u=e[11];let c;return e[12]!==r||e[13]!==o||e[14]!==d||e[15]!==u?(c=(0,s.jsxs)("div",{className:r,"data-testid":o,children:[d,u]}),e[12]=r,e[13]=o,e[14]=d,e[15]=u,e[16]=c):c=e[16],c},"je"),qe=m(n=>{let e=(0,O.c)(60),{span:t,traceDurationMs:a}=n,l=U(),[r,o]=(0,A.useState)(!1),d;e[0]!==t||e[1]!==a?(d=Ke(t,a),e[0]=t,e[1]=a,e[2]=d):d=e[2];let{leftPercent:i,widthPercent:u}=d,c;e[3]!==t.attributes?(c=ve(t.attributes),e[3]=t.attributes,e[4]=c):c=e[4];let v=c,$=t.depth*Be,_;e[5]!==$?(_={paddingLeft:$},e[5]=$,e[6]=_):_=e[6];let y=_,w=`${String(i)}%`,M=`${String(u)}%`,p;e[7]!==w||e[8]!==M?(p={left:w,width:M},e[7]=w,e[8]=M,e[9]=p):p=e[9];let h=p,b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=m(()=>{o(Ue)},"h"),e[10]=b):b=e[10];let C=b,S=t.depth,I=`tr-span-detail-${t.spanId}`,g;e[11]!==t.durationMs||e[12]!==t.error||e[13]!==t.name||e[14]!==t.offsetMs||e[15]!==l?(g=l("{name}, {duration}, starts {offset} in{failure}",{duration:G(t.durationMs),failure:t.error===void 0?"":l(", failed: {message}",{message:t.error.message}),name:t.name,offset:G(t.offsetMs)}),e[11]=t.durationMs,e[12]=t.error,e[13]=t.name,e[14]=t.offsetMs,e[15]=l,e[16]=g):g=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=te(_e,"w-full border-b border-border py-1.5 text-left font-mono text-xs hover:bg-muted/50"),e[17]=x):x=e[17];let k=`tr-span-toggle-${t.spanId}`,f;e[18]!==t.ok?(f=t.ok?null:(0,s.jsx)("span",{"aria-hidden":"true",className:"mr-1 text-destructive","data-testid":"tr-span-error",children:"\u25CF"}),e[18]=t.ok,e[19]=f):f=e[19];let N;e[20]!==y||e[21]!==t.name||e[22]!==f?(N=(0,s.jsxs)("span",{className:"truncate",style:y,title:t.name,children:[f,t.name]}),e[20]=y,e[21]=t.name,e[22]=f,e[23]=N):N=e[23];let B=t.ok?"bg-primary/70":"bg-destructive",L;e[24]!==B?(L=te("absolute inset-y-0 rounded-sm",B),e[24]=B,e[25]=L):L=e[25];let E;e[26]!==h||e[27]!==i||e[28]!==L||e[29]!==u?(E=(0,s.jsx)("span",{"aria-hidden":"true",className:"relative h-3 overflow-hidden rounded-sm bg-muted",children:(0,s.jsx)("span",{className:L,"data-left":i,"data-testid":"tr-span-bar","data-width":u,style:h})}),e[26]=h,e[27]=i,e[28]=L,e[29]=u,e[30]=E):E=e[30];let W;e[31]!==t.durationMs?(W=G(t.durationMs),e[31]=t.durationMs,e[32]=W):W=e[32];let D;e[33]!==W?(D=(0,s.jsx)("span",{className:"text-right tabular-nums text-muted-foreground",children:W}),e[33]=W,e[34]=D):D=e[34];let q;e[35]!==t.error?(q=t.error===void 0?null:(0,s.jsx)("span",{className:"text-destructive","data-testid":"tr-span-error-message",title:t.error.message,children:`${t.error.type}: ${t.error.message}`}),e[35]=t.error,e[36]=q):q=e[36];let T;e[37]!==q?(T=(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:q}),e[37]=q,e[38]=T):T=e[38];let z;e[39]!==v?(z=v===""?null:(0,s.jsx)("span",{"data-testid":"tr-span-attributes",title:v,children:v}),e[39]=v,e[40]=z):z=e[40];let P;e[41]!==z?(P=(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:z}),e[41]=z,e[42]=P):P=e[42];let J;e[43]!==r||e[44]!==I||e[45]!==g||e[46]!==k||e[47]!==N||e[48]!==E||e[49]!==D||e[50]!==T||e[51]!==P?(J=(0,s.jsxs)("button",{"aria-controls":I,"aria-expanded":r,"aria-label":g,className:x,"data-testid":k,onClick:C,type:"button",children:[N,E,D,T,P]}),e[43]=r,e[44]=I,e[45]=g,e[46]=k,e[47]=N,e[48]=E,e[49]=D,e[50]=T,e[51]=P,e[52]=J):J=e[52];let F;e[53]!==r||e[54]!==t?(F=r&&(0,s.jsx)("div",{id:`tr-span-detail-${t.spanId}`,children:(0,s.jsx)(je,{span:t})}),e[53]=r,e[54]=t,e[55]=F):F=e[55];let K;return e[56]!==t.depth||e[57]!==J||e[58]!==F?(K=(0,s.jsxs)("li",{"data-depth":S,"data-testid":"tr-span-row",children:[J,F]}),e[56]=t.depth,e[57]=J,e[58]=F,e[59]=K):K=e[59],K},"Be"),ze=m(n=>{let e=(0,O.c)(15),{durationMs:t,spans:a}=n,l=U(),r;e[0]!==t?(r=(0,s.jsx)(We,{traceDurationMs:t}),e[0]=t,e[1]=r):r=e[1];let o;e[2]!==l?(o=l("Trace waterfall"),e[2]=l,e[3]=o):o=e[3];let d;if(e[4]!==t||e[5]!==a){let c;e[7]!==t?(c=m(v=>(0,s.jsx)(qe,{span:v,traceDurationMs:t},v.spanId),"c"),e[7]=t,e[8]=c):c=e[8],d=a.map(c),e[4]=t,e[5]=a,e[6]=d}else d=e[6];let i;e[9]!==o||e[10]!==d?(i=(0,s.jsx)("ul",{"aria-label":o,children:d}),e[9]=o,e[10]=d,e[11]=i):i=e[11];let u;return e[12]!==r||e[13]!==i?(u=(0,s.jsxs)(s.Fragment,{children:[r,i]}),e[12]=r,e[13]=i,e[14]=u):u=e[14],u},"Oe");function Je(n){return(0,s.jsx)("span",{className:te("absolute inset-y-0 border-l border-border/70",n.percent===100?"-translate-x-full pr-1":"pl-1"),style:{left:`${String(n.percent)}%`},children:n.label},n.percent)}m(Je,"We");function Ue(n){return!n}m(Ue,"Ue");var Ge=m(n=>Array.isArray(n?.traces)?n.traces:[],"qe"),He=m(n=>{let e=(0,O.c)(12),{entries:t}=n,a=U(),l;e[0]!==t.length||e[1]!==a?(l=a("Logs ({count})",{count:t.length}),e[0]=t.length,e[1]=a,e[2]=l):l=e[2];let r;e[3]!==l?(r=(0,s.jsx)("p",{className:"mb-1 font-mono text-xs text-muted-foreground",children:l}),e[3]=l,e[4]=r):r=e[4];let o;e[5]!==t?(o=t.map(Ve),e[5]=t,e[6]=o):o=e[6];let d;e[7]!==o?(d=(0,s.jsx)("div",{role:"grid",children:o}),e[7]=o,e[8]=d):d=e[8];let i;return e[9]!==r||e[10]!==d?(i=(0,s.jsxs)("div",{className:"border-t border-border px-3 py-2","data-testid":"tr-logs",children:[r,d]}),e[9]=r,e[10]=d,e[11]=i):i=e[11],i},"ze"),Qe=m(n=>{let e=(0,O.c)(50),{expanded:t,logs:a,onToggle:l,trace:r}=n,o=U(),d;e[0]!==l||e[1]!==r.traceId?(d=m(()=>{l(r.traceId)},"i"),e[0]=l,e[1]=r.traceId,e[2]=d):d=e[2];let i=d,u=`tr-row-${r.traceId}`,c=`tr-waterfall-${r.traceId}`,v=`tr-toggle-${r.traceId}`,$=t?"\u25BE":"\u25B8",_;e[3]!==$?(_=(0,s.jsx)("span",{"aria-hidden":"true",className:"w-3 shrink-0 text-xs text-muted-foreground",children:$}),e[3]=$,e[4]=_):_=e[4];let y;e[5]!==r.rootName?(y=(0,s.jsx)("span",{className:"w-56 shrink-0 truncate text-sm font-medium",title:r.rootName,children:r.rootName}),e[5]=r.rootName,e[6]=y):y=e[6];let w;e[7]!==r.functionPath?(w=(0,s.jsx)("span",{className:"w-48 shrink-0 truncate font-mono text-xs text-muted-foreground",title:r.functionPath,children:r.functionPath}),e[7]=r.functionPath,e[8]=w):w=e[8];let M;e[9]!==r.durationMs?(M=G(r.durationMs),e[9]=r.durationMs,e[10]=M):M=e[10];let p;e[11]!==M?(p=(0,s.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:M}),e[11]=M,e[12]=p):p=e[12];let h;e[13]!==o||e[14]!==r.spans.length?(h=o("{count} spans",{count:r.spans.length}),e[13]=o,e[14]=r.spans.length,e[15]=h):h=e[15];let b;e[16]!==h?(b=(0,s.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:h}),e[16]=h,e[17]=b):b=e[17];let C=r.ok?"secondary":"destructive",S;e[18]!==o||e[19]!==r.ok?(S=r.ok?o("ok"):o("error"),e[18]=o,e[19]=r.ok,e[20]=S):S=e[20];let I;e[21]!==C||e[22]!==S?(I=(0,s.jsx)("span",{className:"shrink-0",children:(0,s.jsx)(oe,{variant:C,children:S})}),e[21]=C,e[22]=S,e[23]=I):I=e[23];let g;e[24]!==r.startTs?(g=de(r.startTs),e[24]=r.startTs,e[25]=g):g=e[25];let x;e[26]!==g?(x=(0,s.jsx)("span",{className:"flex-1 truncate text-right font-mono text-xs tabular-nums text-muted-foreground",children:g}),e[26]=g,e[27]=x):x=e[27];let k;e[28]!==t||e[29]!==i||e[30]!==p||e[31]!==b||e[32]!==I||e[33]!==x||e[34]!==c||e[35]!==v||e[36]!==_||e[37]!==y||e[38]!==w?(k=(0,s.jsxs)("button",{"aria-controls":c,"aria-expanded":t,className:"flex w-full items-center gap-3 px-3 py-2 text-left hover:bg-muted/50","data-testid":v,onClick:i,type:"button",children:[_,y,w,p,b,I,x]}),e[28]=t,e[29]=i,e[30]=p,e[31]=b,e[32]=I,e[33]=x,e[34]=c,e[35]=v,e[36]=_,e[37]=y,e[38]=w,e[39]=k):k=e[39];let f;e[40]!==t||e[41]!==a||e[42]!==r.durationMs||e[43]!==r.spans||e[44]!==r.traceId?(f=t&&(0,s.jsxs)("div",{className:"bg-muted/20","data-testid":`tr-waterfall-${r.traceId}`,id:`tr-waterfall-${r.traceId}`,children:[(0,s.jsx)(ze,{durationMs:r.durationMs,spans:r.spans}),a.length>0&&(0,s.jsx)(He,{entries:a})]}),e[40]=t,e[41]=a,e[42]=r.durationMs,e[43]=r.spans,e[44]=r.traceId,e[45]=f):f=e[45];let N;return e[46]!==k||e[47]!==f||e[48]!==u?(N=(0,s.jsxs)("div",{className:"border-b border-border last:border-b-0","data-testid":u,children:[k,f]}),e[46]=k,e[47]=f,e[48]=u,e[49]=N):N=e[49],N},"Ge"),bt=m(n=>{let e=(0,O.c)(58),{initialShardKey:t}=n,a=U(),[l]=(0,A.useState)(ye),{queryShardKey:r,setShardKey:o,shardKey:d}=be(l?.shardKey!==void 0&&l.shardKey!==""?l.shardKey:t??""),[i,u]=(0,A.useState)(l?.traceId??""),[c,v]=(0,A.useState)(!1),[$,_]=(0,A.useState)(Xe),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0],(0,A.useEffect)(Ye,y);let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w={},e[1]=w):w=e[1];let M;e[2]!==r?(M={live:!0,shardKey:r},e[2]=r,e[3]=M):M=e[3];let{data:p,error:h,errorSource:b,isLoading:C,liveError:S}=ie(ce.getTraces,w,M),I;e[4]===Symbol.for("react.memo_cache_sentinel")?(I={},e[4]=I):I=e[4];let g=$.size>0,x;e[5]!==r||e[6]!==g?(x={enabled:g,live:!0,shardKey:r},e[5]=r,e[6]=g,e[7]=x):x=e[7];let{data:k}=ie(ce.getLogs,I,x),f,N;e[8]!==p||e[9]!==r?(f=m(()=>{p!==void 0&&he(r)},"p"),N=[p,r],e[8]=p,e[9]=r,e[10]=f,e[11]=N):(f=e[10],N=e[11]),(0,A.useEffect)(f,N);let B;if(e[12]!==p||e[13]!==h||e[14]!==b||e[15]!==$||e[16]!==C||e[17]!==S||e[18]!==k?.entries||e[19]!==c||e[20]!==i||e[21]!==o||e[22]!==d||e[23]!==a){let L=Ge(p),E=p?.total??L.length,W=E>L.length,D=De(L,i,c),q=Map.groupBy((k?.entries??[]).toReversed(),Ze),T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=m(j=>{u(j.target.value)},"C"),e[25]=T):T=e[25];let z=T,P;e[26]===Symbol.for("react.memo_cache_sentinel")?(P=m(j=>{_($e=>{let ne=new Set($e);return ne.has(j)?ne.delete(j):ne.add(j),ne})},"E"),e[26]=P):P=e[26];let J=P,F=h===null&&D.length===0&&!C,K;e[27]!==o||e[28]!==d?(K=(0,s.jsx)(fe,{onChange:o,testId:"tr-shard-input",value:d}),e[27]=o,e[28]=d,e[29]=K):K=e[29];let H;e[30]!==a?(H=a("Search traces"),e[30]=a,e[31]=H):H=e[31];let Q;e[32]!==a?(Q=a("search trace, span, or function"),e[32]=a,e[33]=Q):Q=e[33];let V;e[34]!==i||e[35]!==H||e[36]!==Q?(V=(0,s.jsx)(me,{"aria-label":H,className:"h-8 w-56","data-testid":"tr-search",onChange:z,placeholder:Q,value:i}),e[34]=i,e[35]=H,e[36]=Q,e[37]=V):V=e[37];let X;e[38]!==c?(X=(0,s.jsx)(xe,{checked:c,"data-testid":"tr-only-errors",id:"tr-only-errors",onCheckedChange:v}),e[38]=c,e[39]=X):X=e[39];let Y;e[40]!==a?(Y=a("Errors only"),e[40]=a,e[41]=Y):Y=e[41];let Z;e[42]!==X||e[43]!==Y?(Z=(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",htmlFor:"tr-only-errors",children:[X,Y]}),e[42]=X,e[43]=Y,e[44]=Z):Z=e[44];let R;e[45]!==S?(R=(0,s.jsx)(Ne,{message:S,prefix:"tr"}),e[45]=S,e[46]=R):R=e[46];let re;e[47]!==K||e[48]!==V||e[49]!==Z||e[50]!==R?(re=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[K,V,Z,R]}),e[47]=K,e[48]=V,e[49]=Z,e[50]=R,e[51]=re):re=e[51];let ae;e[52]!==h||e[53]!==b?(ae=h!==null&&(0,s.jsx)(ge,{error:b,testId:"tr-error"}),e[52]=h,e[53]=b,e[54]=ae):ae=e[54];let se;e[55]!==F||e[56]!==a?(se=F&&(0,s.jsx)(ue,{description:a("Traces recorded with ctx.trace show up here as your app handles traffic. The span buffer resets when the shard hibernates."),icon:(0,s.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M4 6h10M7 12h13M10 18h7"})}),testId:"tr-empty",title:a("No traces")}),e[55]=F,e[56]=a,e[57]=se):se=e[57],B=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-traces-panel",children:[re,ae,se,h===null&&W&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"tr-truncated",children:a("Showing the {shown} most recent of {total} traces in the buffer.",{shown:L.length,total:E})}),h===null&&D.length>0&&(0,s.jsx)("div",{"aria-label":a("Recent traces"),className:"overflow-hidden rounded-xl border border-border shadow-xs","data-testid":"tr-list",children:D.map(j=>(0,s.jsx)(Qe,{expanded:$.has(j.traceId),logs:q.get(j.traceId)??[],onToggle:J,trace:j},j.traceId))})]}),e[12]=p,e[13]=h,e[14]=b,e[15]=$,e[16]=C,e[17]=S,e[18]=k?.entries,e[19]=c,e[20]=i,e[21]=o,e[22]=d,e[23]=a,e[24]=B}else B=e[24];return B},"bt");function Ve(n,e){return(0,s.jsx)("div",{className:"flex items-center border-b border-border py-1 font-mono text-xs last:border-b-0","data-testid":"tr-log-row",role:"row",children:(0,s.jsx)(Me,{entry:n})},`${String(e)}:${String(n.timestamp)}`)}m(Ve,"He");function Xe(){return new Set}m(Xe,"Je");function Ye(){we()}m(Ye,"Qe");function Ze(n){return n.traceId}m(Ze,"Ve");export{bt as default};
1
+ import{b as Me}from"./chunk-IQ4TTHQT.js";import{a as ve}from"./chunk-R36QXQZX.js";import{b as ye,c as we}from"./chunk-IH2CJZF2.js";import{a as xe}from"./chunk-QWRK4ESB.js";import{a as Ne}from"./chunk-KYAG2YMF.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import{a as be}from"./chunk-5DNGK3NT.js";import{a as fe}from"./chunk-XST3UEHU.js";import{b as he}from"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import{i as me}from"./chunk-SU5DTRGK.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as oe}from"./chunk-PQH2LSJX.js";import"./chunk-4C4THJUD.js";import{a as ge}from"./chunk-CZ6HBDIL.js";import"./chunk-T5UMHPAB.js";import"./chunk-NVKLYDOH.js";import"./chunk-E26OT26O.js";import{a as ce}from"./chunk-6UTZXEW3.js";import{c as ie}from"./chunk-4DAKKAK7.js";import"./chunk-BVX45MU5.js";import"./chunk-H7HZ42JY.js";import{a as ue}from"./chunk-XMSNLMWU.js";import{C as de,h as te,l as U,v as pe}from"./chunk-BFE2DRP6.js";import{a as m,d as le,e as Ce,f as Le,g as Te}from"./chunk-OXFKZ4BM.js";var O=le(Le(),1),A=le(Ce(),1);var s=le(Te(),1);var Pe=.5,Ie=4,Se=m(n=>Math.min(100,Math.max(0,n)),"ce"),Ke=m((n,e)=>{if(!Number.isFinite(e)||e<=0)return{leftPercent:0,widthPercent:100};let t=Se(n.offsetMs/e*100),a=n.durationMs/e*100,l=Math.max(Pe,Math.min(Se(a),100-t));return{leftPercent:t,widthPercent:l}},"Ce"),De=m((n,e,t=!1)=>{let a=e.trim().toLowerCase(),l=t?n.filter(r=>!r.ok):n;return a===""?[...l]:l.filter(r=>r.rootName.toLowerCase().includes(a)||r.functionPath.toLowerCase().includes(a)||r.traceId.toLowerCase().includes(a)||r.spans.some(o=>o.name.toLowerCase().includes(a)||o.spanId.toLowerCase().includes(a)))},"Ee"),G=m(n=>Number.isFinite(n)?n>0&&n<1?`${n.toFixed(2)}ms`:`${String(Math.round(n))}ms`:"\u2014","q"),Fe=m(n=>!Number.isFinite(n)||n<=0?[]:Array.from({length:Ie},(e,t)=>{let a=(t+1)/Ie;return{label:G(n*a),percent:a*100}}),"Pe"),ke=m(n=>{if(typeof n=="string")return n;try{return JSON.stringify(n,pe)}catch{return String(n)}},"ue"),ee=m(n=>{let e=(0,O.c)(7),{label:t,value:a}=n,l;e[0]!==t?(l=(0,s.jsx)("dt",{className:"w-40 shrink-0 text-muted-foreground",children:t}),e[0]=t,e[1]=l):l=e[1];let r;e[2]!==a?(r=(0,s.jsx)("dd",{className:"min-w-0 break-all",children:a}),e[2]=a,e[3]=r):r=e[3];let o;return e[4]!==l||e[5]!==r?(o=(0,s.jsxs)("div",{className:"flex gap-2",children:[l,r]}),e[4]=l,e[5]=r,e[6]=o):o=e[6],o},"Y"),je=m(n=>{let e=(0,O.c)(68),{span:t}=n,a=U(),l,r,o,d,i,u;if(e[0]!==t.attributes||e[1]!==t.durationMs||e[2]!==t.error||e[3]!==t.events||e[4]!==t.kind||e[5]!==t.offsetMs||e[6]!==t.parentSpanId||e[7]!==t.spanId||e[8]!==a){let $=Object.entries(t.attributes??{}),_;e[15]!==t.events?(_=t.events??[],e[15]=t.events,e[16]=_):_=e[16],l=_,r="border-t border-border bg-background/60 px-3 py-2 font-mono text-xs",o="tr-span-detail";let y;e[17]!==a?(y=a("Span ID"),e[17]=a,e[18]=y):y=e[18];let w;e[19]!==t.spanId||e[20]!==y?(w=(0,s.jsx)(ee,{label:y,value:t.spanId}),e[19]=t.spanId,e[20]=y,e[21]=w):w=e[21];let M;e[22]!==a?(M=a("Parent span ID"),e[22]=a,e[23]=M):M=e[23];let p;e[24]!==t.parentSpanId||e[25]!==a?(p=t.parentSpanId===""?a("\u2014 (trace root)"):t.parentSpanId,e[24]=t.parentSpanId,e[25]=a,e[26]=p):p=e[26];let h;e[27]!==p||e[28]!==M?(h=(0,s.jsx)(ee,{label:M,value:p}),e[27]=p,e[28]=M,e[29]=h):h=e[29];let b;e[30]!==a?(b=a("Kind"),e[30]=a,e[31]=b):b=e[31];let C=t.kind??"internal",S;e[32]!==b||e[33]!==C?(S=(0,s.jsx)(ee,{label:b,value:C}),e[32]=b,e[33]=C,e[34]=S):S=e[34];let I;e[35]!==a?(I=a("Started at"),e[35]=a,e[36]=I):I=e[36];let g;e[37]!==t.offsetMs||e[38]!==a?(g=a("+{offset}",{offset:G(t.offsetMs)}),e[37]=t.offsetMs,e[38]=a,e[39]=g):g=e[39];let x;e[40]!==I||e[41]!==g?(x=(0,s.jsx)(ee,{label:I,value:g}),e[40]=I,e[41]=g,e[42]=x):x=e[42];let k;e[43]!==a?(k=a("Duration"),e[43]=a,e[44]=k):k=e[44];let f;e[45]!==t.durationMs?(f=G(t.durationMs),e[45]=t.durationMs,e[46]=f):f=e[46];let N;e[47]!==k||e[48]!==f?(N=(0,s.jsx)(ee,{label:k,value:f}),e[47]=k,e[48]=f,e[49]=N):N=e[49],e[50]!==h||e[51]!==S||e[52]!==x||e[53]!==N||e[54]!==w?(d=(0,s.jsxs)("dl",{className:"flex flex-col gap-1",children:[w,h,S,x,N]}),e[50]=h,e[51]=S,e[52]=x,e[53]=N,e[54]=w,e[55]=d):d=e[55],e[56]!==t.error?(i=t.error!==void 0&&(0,s.jsxs)("div",{className:"mt-2 rounded-md border border-destructive/40 bg-destructive/10 px-2 py-1.5","data-testid":"tr-detail-error",children:[(0,s.jsx)("span",{className:"font-semibold text-destructive",children:t.error.type}),(0,s.jsx)("p",{className:"whitespace-pre-wrap break-all text-destructive",children:t.error.message})]}),e[56]=t.error,e[57]=i):i=e[57],u=$.length>0&&(0,s.jsxs)("div",{className:"mt-2","data-testid":"tr-detail-attributes",children:[(0,s.jsx)("p",{className:"mb-1 text-muted-foreground",children:a("Attributes")}),(0,s.jsx)("dl",{className:"flex flex-col gap-1",children:$.map(Ee)})]}),e[0]=t.attributes,e[1]=t.durationMs,e[2]=t.error,e[3]=t.events,e[4]=t.kind,e[5]=t.offsetMs,e[6]=t.parentSpanId,e[7]=t.spanId,e[8]=a,e[9]=l,e[10]=r,e[11]=o,e[12]=d,e[13]=i,e[14]=u}else l=e[9],r=e[10],o=e[11],d=e[12],i=e[13],u=e[14];let c;e[58]!==l||e[59]!==a?(c=l.length>0&&(0,s.jsxs)("div",{className:"mt-2","data-testid":"tr-detail-events",children:[(0,s.jsx)("p",{className:"mb-1 text-muted-foreground",children:a("Events")}),(0,s.jsx)("ul",{className:"flex flex-col gap-1",children:l.map(Oe)})]}),e[58]=l,e[59]=a,e[60]=c):c=e[60];let v;return e[61]!==r||e[62]!==o||e[63]!==d||e[64]!==i||e[65]!==u||e[66]!==c?(v=(0,s.jsxs)("div",{className:r,"data-testid":o,children:[d,i,u,c]}),e[61]=r,e[62]=o,e[63]=d,e[64]=i,e[65]=u,e[66]=c,e[67]=v):v=e[67],v},"Fe");function Ee(n){let[e,t]=n;return(0,s.jsx)(ee,{label:e,value:ke(t)},e)}m(Ee,"Ke");function Ae(n){let[e,t]=n;return`${e}=${ke(t)}`}m(Ae,"Re");function Oe(n){return(0,s.jsxs)("li",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:de(n.ts)}),(0,s.jsx)(oe,{variant:"secondary",children:n.name}),(0,s.jsx)("span",{className:"min-w-0 break-all text-muted-foreground",children:Object.entries(n.attributes??{}).map(Ae).join(" ")})]},`${n.name}:${String(n.ts)}`)}m(Oe,"Ae");var Be=14,_e="grid grid-cols-[14rem_1fr_4rem_16rem_16rem] items-center gap-2 px-3",We=m(n=>{let e=(0,O.c)(17),{traceDurationMs:t}=n,a,l,r,o,d,i;if(e[0]!==t){i=Symbol.for("react.early_return_sentinel");e:{let v=Fe(t);if(v.length===0){i=null;break e}e[7]===Symbol.for("react.memo_cache_sentinel")?(r=te(_e,"border-b border-border py-1 font-mono text-[10px] text-muted-foreground"),e[7]=r):r=e[7],o="tr-ruler",e[8]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsx)("span",{}),e[8]=d):d=e[8],a="relative h-3",l=v.map(Je)}e[0]=t,e[1]=a,e[2]=l,e[3]=r,e[4]=o,e[5]=d,e[6]=i}else a=e[1],l=e[2],r=e[3],o=e[4],d=e[5],i=e[6];if(i!==Symbol.for("react.early_return_sentinel"))return i;let u;e[9]!==a||e[10]!==l?(u=(0,s.jsx)("span",{className:a,children:l}),e[9]=a,e[10]=l,e[11]=u):u=e[11];let c;return e[12]!==r||e[13]!==o||e[14]!==d||e[15]!==u?(c=(0,s.jsxs)("div",{className:r,"data-testid":o,children:[d,u]}),e[12]=r,e[13]=o,e[14]=d,e[15]=u,e[16]=c):c=e[16],c},"je"),qe=m(n=>{let e=(0,O.c)(60),{span:t,traceDurationMs:a}=n,l=U(),[r,o]=(0,A.useState)(!1),d;e[0]!==t||e[1]!==a?(d=Ke(t,a),e[0]=t,e[1]=a,e[2]=d):d=e[2];let{leftPercent:i,widthPercent:u}=d,c;e[3]!==t.attributes?(c=ve(t.attributes),e[3]=t.attributes,e[4]=c):c=e[4];let v=c,$=t.depth*Be,_;e[5]!==$?(_={paddingLeft:$},e[5]=$,e[6]=_):_=e[6];let y=_,w=`${String(i)}%`,M=`${String(u)}%`,p;e[7]!==w||e[8]!==M?(p={left:w,width:M},e[7]=w,e[8]=M,e[9]=p):p=e[9];let h=p,b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=m(()=>{o(Ue)},"h"),e[10]=b):b=e[10];let C=b,S=t.depth,I=`tr-span-detail-${t.spanId}`,g;e[11]!==t.durationMs||e[12]!==t.error||e[13]!==t.name||e[14]!==t.offsetMs||e[15]!==l?(g=l("{name}, {duration}, starts {offset} in{failure}",{duration:G(t.durationMs),failure:t.error===void 0?"":l(", failed: {message}",{message:t.error.message}),name:t.name,offset:G(t.offsetMs)}),e[11]=t.durationMs,e[12]=t.error,e[13]=t.name,e[14]=t.offsetMs,e[15]=l,e[16]=g):g=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=te(_e,"w-full border-b border-border py-1.5 text-left font-mono text-xs hover:bg-muted/50"),e[17]=x):x=e[17];let k=`tr-span-toggle-${t.spanId}`,f;e[18]!==t.ok?(f=t.ok?null:(0,s.jsx)("span",{"aria-hidden":"true",className:"mr-1 text-destructive","data-testid":"tr-span-error",children:"\u25CF"}),e[18]=t.ok,e[19]=f):f=e[19];let N;e[20]!==y||e[21]!==t.name||e[22]!==f?(N=(0,s.jsxs)("span",{className:"truncate",style:y,title:t.name,children:[f,t.name]}),e[20]=y,e[21]=t.name,e[22]=f,e[23]=N):N=e[23];let B=t.ok?"bg-primary/70":"bg-destructive",L;e[24]!==B?(L=te("absolute inset-y-0 rounded-sm",B),e[24]=B,e[25]=L):L=e[25];let E;e[26]!==h||e[27]!==i||e[28]!==L||e[29]!==u?(E=(0,s.jsx)("span",{"aria-hidden":"true",className:"relative h-3 overflow-hidden rounded-sm bg-muted",children:(0,s.jsx)("span",{className:L,"data-left":i,"data-testid":"tr-span-bar","data-width":u,style:h})}),e[26]=h,e[27]=i,e[28]=L,e[29]=u,e[30]=E):E=e[30];let W;e[31]!==t.durationMs?(W=G(t.durationMs),e[31]=t.durationMs,e[32]=W):W=e[32];let D;e[33]!==W?(D=(0,s.jsx)("span",{className:"text-right tabular-nums text-muted-foreground",children:W}),e[33]=W,e[34]=D):D=e[34];let q;e[35]!==t.error?(q=t.error===void 0?null:(0,s.jsx)("span",{className:"text-destructive","data-testid":"tr-span-error-message",title:t.error.message,children:`${t.error.type}: ${t.error.message}`}),e[35]=t.error,e[36]=q):q=e[36];let T;e[37]!==q?(T=(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:q}),e[37]=q,e[38]=T):T=e[38];let z;e[39]!==v?(z=v===""?null:(0,s.jsx)("span",{"data-testid":"tr-span-attributes",title:v,children:v}),e[39]=v,e[40]=z):z=e[40];let P;e[41]!==z?(P=(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:z}),e[41]=z,e[42]=P):P=e[42];let J;e[43]!==r||e[44]!==I||e[45]!==g||e[46]!==k||e[47]!==N||e[48]!==E||e[49]!==D||e[50]!==T||e[51]!==P?(J=(0,s.jsxs)("button",{"aria-controls":I,"aria-expanded":r,"aria-label":g,className:x,"data-testid":k,onClick:C,type:"button",children:[N,E,D,T,P]}),e[43]=r,e[44]=I,e[45]=g,e[46]=k,e[47]=N,e[48]=E,e[49]=D,e[50]=T,e[51]=P,e[52]=J):J=e[52];let F;e[53]!==r||e[54]!==t?(F=r&&(0,s.jsx)("div",{id:`tr-span-detail-${t.spanId}`,children:(0,s.jsx)(je,{span:t})}),e[53]=r,e[54]=t,e[55]=F):F=e[55];let K;return e[56]!==t.depth||e[57]!==J||e[58]!==F?(K=(0,s.jsxs)("li",{"data-depth":S,"data-testid":"tr-span-row",children:[J,F]}),e[56]=t.depth,e[57]=J,e[58]=F,e[59]=K):K=e[59],K},"Be"),ze=m(n=>{let e=(0,O.c)(15),{durationMs:t,spans:a}=n,l=U(),r;e[0]!==t?(r=(0,s.jsx)(We,{traceDurationMs:t}),e[0]=t,e[1]=r):r=e[1];let o;e[2]!==l?(o=l("Trace waterfall"),e[2]=l,e[3]=o):o=e[3];let d;if(e[4]!==t||e[5]!==a){let c;e[7]!==t?(c=m(v=>(0,s.jsx)(qe,{span:v,traceDurationMs:t},v.spanId),"c"),e[7]=t,e[8]=c):c=e[8],d=a.map(c),e[4]=t,e[5]=a,e[6]=d}else d=e[6];let i;e[9]!==o||e[10]!==d?(i=(0,s.jsx)("ul",{"aria-label":o,children:d}),e[9]=o,e[10]=d,e[11]=i):i=e[11];let u;return e[12]!==r||e[13]!==i?(u=(0,s.jsxs)(s.Fragment,{children:[r,i]}),e[12]=r,e[13]=i,e[14]=u):u=e[14],u},"Oe");function Je(n){return(0,s.jsx)("span",{className:te("absolute inset-y-0 border-l border-border/70",n.percent===100?"-translate-x-full pr-1":"pl-1"),style:{left:`${String(n.percent)}%`},children:n.label},n.percent)}m(Je,"We");function Ue(n){return!n}m(Ue,"Ue");var Ge=m(n=>Array.isArray(n?.traces)?n.traces:[],"qe"),He=m(n=>{let e=(0,O.c)(12),{entries:t}=n,a=U(),l;e[0]!==t.length||e[1]!==a?(l=a("Logs ({count})",{count:t.length}),e[0]=t.length,e[1]=a,e[2]=l):l=e[2];let r;e[3]!==l?(r=(0,s.jsx)("p",{className:"mb-1 font-mono text-xs text-muted-foreground",children:l}),e[3]=l,e[4]=r):r=e[4];let o;e[5]!==t?(o=t.map(Ve),e[5]=t,e[6]=o):o=e[6];let d;e[7]!==o?(d=(0,s.jsx)("div",{role:"grid",children:o}),e[7]=o,e[8]=d):d=e[8];let i;return e[9]!==r||e[10]!==d?(i=(0,s.jsxs)("div",{className:"border-t border-border px-3 py-2","data-testid":"tr-logs",children:[r,d]}),e[9]=r,e[10]=d,e[11]=i):i=e[11],i},"ze"),Qe=m(n=>{let e=(0,O.c)(50),{expanded:t,logs:a,onToggle:l,trace:r}=n,o=U(),d;e[0]!==l||e[1]!==r.traceId?(d=m(()=>{l(r.traceId)},"i"),e[0]=l,e[1]=r.traceId,e[2]=d):d=e[2];let i=d,u=`tr-row-${r.traceId}`,c=`tr-waterfall-${r.traceId}`,v=`tr-toggle-${r.traceId}`,$=t?"\u25BE":"\u25B8",_;e[3]!==$?(_=(0,s.jsx)("span",{"aria-hidden":"true",className:"w-3 shrink-0 text-xs text-muted-foreground",children:$}),e[3]=$,e[4]=_):_=e[4];let y;e[5]!==r.rootName?(y=(0,s.jsx)("span",{className:"w-56 shrink-0 truncate text-sm font-medium",title:r.rootName,children:r.rootName}),e[5]=r.rootName,e[6]=y):y=e[6];let w;e[7]!==r.functionPath?(w=(0,s.jsx)("span",{className:"w-48 shrink-0 truncate font-mono text-xs text-muted-foreground",title:r.functionPath,children:r.functionPath}),e[7]=r.functionPath,e[8]=w):w=e[8];let M;e[9]!==r.durationMs?(M=G(r.durationMs),e[9]=r.durationMs,e[10]=M):M=e[10];let p;e[11]!==M?(p=(0,s.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:M}),e[11]=M,e[12]=p):p=e[12];let h;e[13]!==o||e[14]!==r.spans.length?(h=o("{count} spans",{count:r.spans.length}),e[13]=o,e[14]=r.spans.length,e[15]=h):h=e[15];let b;e[16]!==h?(b=(0,s.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:h}),e[16]=h,e[17]=b):b=e[17];let C=r.ok?"secondary":"destructive",S;e[18]!==o||e[19]!==r.ok?(S=r.ok?o("ok"):o("error"),e[18]=o,e[19]=r.ok,e[20]=S):S=e[20];let I;e[21]!==C||e[22]!==S?(I=(0,s.jsx)("span",{className:"shrink-0",children:(0,s.jsx)(oe,{variant:C,children:S})}),e[21]=C,e[22]=S,e[23]=I):I=e[23];let g;e[24]!==r.startTs?(g=de(r.startTs),e[24]=r.startTs,e[25]=g):g=e[25];let x;e[26]!==g?(x=(0,s.jsx)("span",{className:"flex-1 truncate text-right font-mono text-xs tabular-nums text-muted-foreground",children:g}),e[26]=g,e[27]=x):x=e[27];let k;e[28]!==t||e[29]!==i||e[30]!==p||e[31]!==b||e[32]!==I||e[33]!==x||e[34]!==c||e[35]!==v||e[36]!==_||e[37]!==y||e[38]!==w?(k=(0,s.jsxs)("button",{"aria-controls":c,"aria-expanded":t,className:"flex w-full items-center gap-3 px-3 py-2 text-left hover:bg-muted/50","data-testid":v,onClick:i,type:"button",children:[_,y,w,p,b,I,x]}),e[28]=t,e[29]=i,e[30]=p,e[31]=b,e[32]=I,e[33]=x,e[34]=c,e[35]=v,e[36]=_,e[37]=y,e[38]=w,e[39]=k):k=e[39];let f;e[40]!==t||e[41]!==a||e[42]!==r.durationMs||e[43]!==r.spans||e[44]!==r.traceId?(f=t&&(0,s.jsxs)("div",{className:"bg-muted/20","data-testid":`tr-waterfall-${r.traceId}`,id:`tr-waterfall-${r.traceId}`,children:[(0,s.jsx)(ze,{durationMs:r.durationMs,spans:r.spans}),a.length>0&&(0,s.jsx)(He,{entries:a})]}),e[40]=t,e[41]=a,e[42]=r.durationMs,e[43]=r.spans,e[44]=r.traceId,e[45]=f):f=e[45];let N;return e[46]!==k||e[47]!==f||e[48]!==u?(N=(0,s.jsxs)("div",{className:"border-b border-border last:border-b-0","data-testid":u,children:[k,f]}),e[46]=k,e[47]=f,e[48]=u,e[49]=N):N=e[49],N},"Ge"),bt=m(n=>{let e=(0,O.c)(58),{initialShardKey:t}=n,a=U(),[l]=(0,A.useState)(ye),{queryShardKey:r,setShardKey:o,shardKey:d}=be(l?.shardKey!==void 0&&l.shardKey!==""?l.shardKey:t??""),[i,u]=(0,A.useState)(l?.traceId??""),[c,v]=(0,A.useState)(!1),[$,_]=(0,A.useState)(Xe),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0],(0,A.useEffect)(Ye,y);let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w={},e[1]=w):w=e[1];let M;e[2]!==r?(M={live:!0,shardKey:r},e[2]=r,e[3]=M):M=e[3];let{data:p,error:h,errorSource:b,isLoading:C,liveError:S}=ie(ce.getTraces,w,M),I;e[4]===Symbol.for("react.memo_cache_sentinel")?(I={},e[4]=I):I=e[4];let g=$.size>0,x;e[5]!==r||e[6]!==g?(x={enabled:g,live:!0,shardKey:r},e[5]=r,e[6]=g,e[7]=x):x=e[7];let{data:k}=ie(ce.getLogs,I,x),f,N;e[8]!==p||e[9]!==r?(f=m(()=>{p!==void 0&&he(r)},"p"),N=[p,r],e[8]=p,e[9]=r,e[10]=f,e[11]=N):(f=e[10],N=e[11]),(0,A.useEffect)(f,N);let B;if(e[12]!==p||e[13]!==h||e[14]!==b||e[15]!==$||e[16]!==C||e[17]!==S||e[18]!==k?.entries||e[19]!==c||e[20]!==i||e[21]!==o||e[22]!==d||e[23]!==a){let L=Ge(p),E=p?.total??L.length,W=E>L.length,D=De(L,i,c),q=Map.groupBy((k?.entries??[]).toReversed(),Ze),T;e[25]===Symbol.for("react.memo_cache_sentinel")?(T=m(j=>{u(j.target.value)},"C"),e[25]=T):T=e[25];let z=T,P;e[26]===Symbol.for("react.memo_cache_sentinel")?(P=m(j=>{_($e=>{let ne=new Set($e);return ne.has(j)?ne.delete(j):ne.add(j),ne})},"E"),e[26]=P):P=e[26];let J=P,F=h===null&&D.length===0&&!C,K;e[27]!==o||e[28]!==d?(K=(0,s.jsx)(fe,{onChange:o,testId:"tr-shard-input",value:d}),e[27]=o,e[28]=d,e[29]=K):K=e[29];let H;e[30]!==a?(H=a("Search traces"),e[30]=a,e[31]=H):H=e[31];let Q;e[32]!==a?(Q=a("search trace, span, or function"),e[32]=a,e[33]=Q):Q=e[33];let V;e[34]!==i||e[35]!==H||e[36]!==Q?(V=(0,s.jsx)(me,{"aria-label":H,className:"h-8 w-56","data-testid":"tr-search",onChange:z,placeholder:Q,value:i}),e[34]=i,e[35]=H,e[36]=Q,e[37]=V):V=e[37];let X;e[38]!==c?(X=(0,s.jsx)(xe,{checked:c,"data-testid":"tr-only-errors",id:"tr-only-errors",onCheckedChange:v}),e[38]=c,e[39]=X):X=e[39];let Y;e[40]!==a?(Y=a("Errors only"),e[40]=a,e[41]=Y):Y=e[41];let Z;e[42]!==X||e[43]!==Y?(Z=(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",htmlFor:"tr-only-errors",children:[X,Y]}),e[42]=X,e[43]=Y,e[44]=Z):Z=e[44];let R;e[45]!==S?(R=(0,s.jsx)(Ne,{message:S,prefix:"tr"}),e[45]=S,e[46]=R):R=e[46];let re;e[47]!==K||e[48]!==V||e[49]!==Z||e[50]!==R?(re=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[K,V,Z,R]}),e[47]=K,e[48]=V,e[49]=Z,e[50]=R,e[51]=re):re=e[51];let ae;e[52]!==h||e[53]!==b?(ae=h!==null&&(0,s.jsx)(ge,{error:b,testId:"tr-error"}),e[52]=h,e[53]=b,e[54]=ae):ae=e[54];let se;e[55]!==F||e[56]!==a?(se=F&&(0,s.jsx)(ue,{description:a("Traces recorded with ctx.trace show up here as your app handles traffic. The span buffer resets when the shard hibernates."),icon:(0,s.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M4 6h10M7 12h13M10 18h7"})}),testId:"tr-empty",title:a("No traces")}),e[55]=F,e[56]=a,e[57]=se):se=e[57],B=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-traces-panel",children:[re,ae,se,h===null&&W&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"tr-truncated",children:a("Showing the {shown} most recent of {total} traces in the buffer.",{shown:L.length,total:E})}),h===null&&D.length>0&&(0,s.jsx)("div",{"aria-label":a("Recent traces"),className:"overflow-hidden rounded-xl border border-border shadow-xs","data-testid":"tr-list",children:D.map(j=>(0,s.jsx)(Qe,{expanded:$.has(j.traceId),logs:q.get(j.traceId)??[],onToggle:J,trace:j},j.traceId))})]}),e[12]=p,e[13]=h,e[14]=b,e[15]=$,e[16]=C,e[17]=S,e[18]=k?.entries,e[19]=c,e[20]=i,e[21]=o,e[22]=d,e[23]=a,e[24]=B}else B=e[24];return B},"bt");function Ve(n,e){return(0,s.jsx)("div",{className:"flex items-center border-b border-border py-1 font-mono text-xs last:border-b-0","data-testid":"tr-log-row",role:"row",children:(0,s.jsx)(Me,{entry:n})},`${String(e)}:${String(n.timestamp)}`)}m(Ve,"He");function Xe(){return new Set}m(Xe,"Je");function Ye(){we()}m(Ye,"Qe");function Ze(n){return n.traceId}m(Ze,"Ve");export{bt as default};
@@ -1,4 +1,4 @@
1
- import{a as le}from"./chunk-SJLEEYCR.js";import{a as Pe}from"./chunk-P6L6ABWO.js";import{a as he}from"./chunk-OUFWXYEF.js";import{a as V}from"./chunk-HKLF627N.js";import{d as Ne,f as ke,g as we,k as oe}from"./chunk-XYR5NST4.js";import{a as Ce}from"./chunk-KYONGQQ4.js";import"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import{i as ve}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as U}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as ye}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as $e}from"./chunk-6UTZXEW3.js";import{a as be,p as F}from"./chunk-FKM35PXF.js";import"./chunk-WZTY3ZYI.js";import{a as E}from"./chunk-3Y5K3IQO.js";import{b as ue,f as M,g as Se,h as se,i as ie,j as fe,p as Ie,s as Oe,v as ae}from"./chunk-LPINY2IJ.js";import{a as u,d as L,e as me,f as te,g as re}from"./chunk-OXFKZ4BM.js";var Qe=L(te(),1),xe=L(me(),1);var Y=L(te(),1),X=L(me(),1);var R=L(re(),1);var Xe=se($e.listTables),Ye=["react","client","cli"],Ze={action:"action",mutation:"mutation",query:"query"},Te=u(t=>{let e=t.indexOf(":");return e===-1?{file:"",fn:t}:{file:t.slice(0,e),fn:t.slice(e+1)}},"Q"),et=u(({file:t,fn:e,kind:a})=>`await client.${Ze[a]}(api.${t}.${e}, { /* args */ });`,"ae"),tt=u(t=>{let e=`api.${t.file}.${t.fn}`;switch(t.kind){case"action":return`const { call: ${t.fn} } = useAction(${e});`;case"mutation":return`const ${t.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},"se"),rt=u(({file:t,fn:e})=>`lunora run ${t}:${e} --args '{ }'`,"oe"),at=u(t=>["// Read rows",`const rows = await ctx.db.query("${t}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${t}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${t}">;`,`type RowId = Id<"${t}">;`].join(`
1
+ import{a as le}from"./chunk-VJRNOSRY.js";import{a as Pe}from"./chunk-CNA3TVUK.js";import{a as he}from"./chunk-KZCEJFZF.js";import{a as V}from"./chunk-7PADVGQX.js";import{d as Ne,f as ke,g as we,k as oe}from"./chunk-XYR5NST4.js";import{a as Ce}from"./chunk-XST3UEHU.js";import"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import{i as ve}from"./chunk-SU5DTRGK.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as U}from"./chunk-6VAY6L4J.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as ye}from"./chunk-PQH2LSJX.js";import"./chunk-4C4THJUD.js";import{a as $e}from"./chunk-6UTZXEW3.js";import{m as F}from"./chunk-BVX45MU5.js";import"./chunk-H7HZ42JY.js";import{a as E}from"./chunk-XMSNLMWU.js";import{B as ae,b as be,h as ue,l as M,m as Se,n as se,o as ie,p as fe,v as Ie,y as Oe}from"./chunk-BFE2DRP6.js";import{a as u,d as L,e as me,f as te,g as re}from"./chunk-OXFKZ4BM.js";var Qe=L(te(),1),xe=L(me(),1);var Y=L(te(),1),X=L(me(),1);var R=L(re(),1);var Xe=se($e.listTables),Ye=["react","client","cli"],Ze={action:"action",mutation:"mutation",query:"query"},Te=u(t=>{let e=t.indexOf(":");return e===-1?{file:"",fn:t}:{file:t.slice(0,e),fn:t.slice(e+1)}},"Q"),et=u(({file:t,fn:e,kind:a})=>`await client.${Ze[a]}(api.${t}.${e}, { /* args */ });`,"ae"),tt=u(t=>{let e=`api.${t.file}.${t.fn}`;switch(t.kind){case"action":return`const { call: ${t.fn} } = useAction(${e});`;case"mutation":return`const ${t.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},"se"),rt=u(({file:t,fn:e})=>`lunora run ${t}:${e} --args '{ }'`,"oe"),at=u(t=>["// Read rows",`const rows = await ctx.db.query("${t}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${t}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${t}">;`,`type RowId = Id<"${t}">;`].join(`
2
2
  `),"ce"),nt=u((t,e)=>{switch(t){case"cli":return rt(e);case"client":return et(e);default:return tt(e)}},"re"),Re=u(t=>{let e=(0,Y.c)(19),{code:a,label:r,testId:n}=t,s=M(),o;e[0]!==a?(o=u(()=>{ae(a)},"c"),e[0]=a,e[1]=o):o=e[1];let i=o,c;e[2]!==r?(c=(0,R.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:r}),e[2]=r,e[3]=c):c=e[3];let m=`${n}-copy`,l;e[4]!==s?(l=s("Copy"),e[4]=s,e[5]=l):l=e[5];let p;e[6]!==i||e[7]!==m||e[8]!==l?(p=(0,R.jsx)(U,{"data-testid":m,onClick:i,size:"xs",type:"button",variant:"ghost",children:l}),e[6]=i,e[7]=m,e[8]=l,e[9]=p):p=e[9];let f;e[10]!==c||e[11]!==p?(f=(0,R.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[c,p]}),e[10]=c,e[11]=p,e[12]=f):f=e[12];let h;e[13]!==a||e[14]!==n?(h=(0,R.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":n,children:a}),e[13]=a,e[14]=n,e[15]=h):h=e[15];let g;return e[16]!==f||e[17]!==h?(g=(0,R.jsxs)("div",{className:"flex flex-col gap-1.5",children:[f,h]}),e[16]=f,e[17]=h,e[18]=g):g=e[18],g},"U"),ot=u(t=>{let e=(0,Y.c)(46),{file:a,fn:r,kind:n}=t,s=M(),[o,i]=(0,X.useState)("react"),c,m,l;if(e[0]!==a||e[1]!==r||e[2]!==n||e[3]!==s||e[4]!==o){let w={file:a,fn:r,kind:n},P;e[8]!==s?(P=s("CLI"),e[8]=s,e[9]=P):P=e[9];let O;e[10]!==s?(O=s("Client"),e[10]=s,e[11]=O):O=e[11];let S;e[12]!==s?(S=s("React"),e[12]=s,e[13]=S):S=e[13];let T;e[14]!==P||e[15]!==O||e[16]!==S?(T={cli:P,client:O,react:S},e[14]=P,e[15]=O,e[16]=S,e[17]=T):T=e[17],l=T;let A;e[18]===Symbol.for("react.memo_cache_sentinel")?(A=u(_=>{i(_.currentTarget.dataset.tab)},"B"),e[18]=A):A=e[18],c=A,m=nt(o,w),e[0]=a,e[1]=r,e[2]=n,e[3]=s,e[4]=o,e[5]=c,e[6]=m,e[7]=l}else c=e[5],m=e[6],l=e[7];let p=m,f=`api.${a}.${r}`,h;e[19]!==f?(h=(0,R.jsx)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-fn-title",children:f}),e[19]=f,e[20]=h):h=e[20];let g;e[21]!==n||e[22]!==s?(g=s("Call this {kind} from your app.",{kind:n}),e[21]=n,e[22]=s,e[23]=g):g=e[23];let x;e[24]!==g?(x=(0,R.jsx)("p",{className:"text-xs text-muted-foreground",children:g}),e[24]=g,e[25]=x):x=e[25];let v;e[26]!==h||e[27]!==x?(v=(0,R.jsxs)("div",{children:[h,x]}),e[26]=h,e[27]=x,e[28]=v):v=e[28];let N;e[29]!==s?(N=s("Snippet flavour"),e[29]=s,e[30]=N):N=e[30];let y;e[31]!==c||e[32]!==o||e[33]!==l?(y=Ye.map(w=>(0,R.jsx)(U,{"aria-selected":o===w,"data-tab":w,"data-testid":`api-tab-${w}`,onClick:c,role:"tab",size:"xs",type:"button",variant:o===w?"default":"outline",children:l[w]},w)),e[31]=c,e[32]=o,e[33]=l,e[34]=y):y=e[34];let b;e[35]!==N||e[36]!==y?(b=(0,R.jsx)("div",{"aria-label":N,className:"flex gap-1.5","data-testid":"api-tabs",role:"tablist",children:y}),e[35]=N,e[36]=y,e[37]=b):b=e[37];let I=l[o],C=`api-snippet-${o}`,$;e[38]!==p||e[39]!==I||e[40]!==C?($=(0,R.jsx)(Re,{code:p,label:I,testId:C}),e[38]=p,e[39]=I,e[40]=C,e[41]=$):$=e[41];let k;return e[42]!==$||e[43]!==v||e[44]!==b?(k=(0,R.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"api-fn-doc",children:[v,b,$]}),e[42]=$,e[43]=v,e[44]=b,e[45]=k):k=e[45],k},"de"),st=u(t=>{let e=(0,Y.c)(19),{name:a}=t,r=M(),n;e[0]!==a?(n=at(a),e[0]=a,e[1]=n):n=e[1];let s=n,o;e[2]!==a?(o=(0,R.jsx)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-table-title",children:a}),e[2]=a,e[3]=o):o=e[3];let i;e[4]!==r?(i=r("Read and write this table through the typed data model."),e[4]=r,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,R.jsx)("p",{className:"text-xs text-muted-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let m;e[8]!==o||e[9]!==c?(m=(0,R.jsxs)("div",{children:[o,c]}),e[8]=o,e[9]=c,e[10]=m):m=e[10];let l;e[11]!==r?(l=r("Data model"),e[11]=r,e[12]=l):l=e[12];let p;e[13]!==s||e[14]!==l?(p=(0,R.jsx)(Re,{code:s,label:l,testId:"api-snippet-table"}),e[13]=s,e[14]=l,e[15]=p):p=e[15];let f;return e[16]!==m||e[17]!==p?(f=(0,R.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"api-table-doc",children:[m,p]}),e[16]=m,e[17]=p,e[18]=f):f=e[18],f},"fe"),je=u(t=>{let e=(0,Y.c)(8),{active:a,label:r,onSelect:n,testId:s,value:o}=t,i;e[0]!==n||e[1]!==o?(i=u(()=>{n(o)},"m"),e[0]=n,e[1]=o,e[2]=i):i=e[2];let c=i,m=a?"page":void 0,l;return e[3]!==r||e[4]!==c||e[5]!==m||e[6]!==s?(l=(0,R.jsx)("button",{"aria-current":m,className:"w-full truncate rounded-md px-2 py-1 text-start font-mono text-xs text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-testid":s,onClick:c,type:"button",children:r}),e[3]=r,e[4]=c,e[5]=m,e[6]=s,e[7]=l):l=e[7],l},"G"),it=u(t=>{let e=new Map;for(let a of t){let{file:r,fn:n}=Te(a.path),s=e.get(r)??[];s.push({fn:n,kind:a.kind,path:a.path}),e.set(r,s)}return[...e.entries()].map(([a,r])=>({file:a,items:r.toSorted((n,s)=>n.fn.localeCompare(s.fn))})).toSorted((a,r)=>a.file.localeCompare(r.file))},"pe"),Ae=u(t=>{let e=(0,Y.c)(58),{functions:a,initialShardKey:r}=t,n=M(),s=F(),[o,i]=(0,X.useState)(null),[c,m]=(0,X.useState)(null),l,p;e[0]!==s||e[1]!==r?(l=u(()=>{let _=!1;return s.query(Xe,{},ie(r??"")).then(j=>(_||i(j),j)).catch(()=>{_||i([])}),()=>{_=!0}},"o"),p=[s,r],e[0]=s,e[1]=r,e[2]=l,e[3]=p):(l=e[2],p=e[3]),(0,X.useEffect)(l,p);let f,h,g,x,v,N,y,b,I,C;if(e[4]!==a||e[5]!==c||e[6]!==n||e[7]!==o){let _=a??[],j=it(_),q=(o??[]).map(lt).toSorted(dt),J;e[18]===Symbol.for("react.memo_cache_sentinel")?(J=u(K=>{m({kind:"fn",path:K})},"P"),e[18]=J):J=e[18];let W=J,Q;e[19]===Symbol.for("react.memo_cache_sentinel")?(Q=u(K=>{m({kind:"table",name:K})},"j"),e[19]=Q):Q=e[19];let Ve=Q;h=c?.kind==="fn"?_.find(K=>K.path===c.path):void 0,f=_.length>0||q.length>0,g=h===void 0?void 0:Te(h.path),I="grid min-h-0 gap-6 md:grid-cols-[16rem_minmax(0,1fr)]",C="lunora-api-docs",e[20]!==n?(x=n("API resources"),e[20]=n,e[21]=x):x=e[21],v="flex flex-col gap-4 overflow-y-auto",N="api-rail";let ne;e[22]!==c||e[23]!==n?(ne=u(K=>(0,R.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,R.jsx)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:K.file||n("(root)")}),K.items.map(ee=>(0,R.jsx)(je,{active:c?.kind==="fn"&&c.path===ee.path,label:ee.fn,onSelect:W,testId:`api-rail-fn-${ee.path}`,value:ee.path},ee.path))]},K.file),"q"),e[22]=c,e[23]=n,e[24]=ne):ne=e[24],y=j.map(ne),b=q.length>0&&(0,R.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,R.jsx)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Tables")}),q.map(K=>(0,R.jsx)(je,{active:c?.kind==="table"&&c.name===K,label:K,onSelect:Ve,testId:`api-rail-table-${K}`,value:K},K))]}),e[4]=a,e[5]=c,e[6]=n,e[7]=o,e[8]=f,e[9]=h,e[10]=g,e[11]=x,e[12]=v,e[13]=N,e[14]=y,e[15]=b,e[16]=I,e[17]=C}else f=e[8],h=e[9],g=e[10],x=e[11],v=e[12],N=e[13],y=e[14],b=e[15],I=e[16],C=e[17];let $;e[25]!==f||e[26]!==n?($=!f&&(0,R.jsx)("p",{className:"px-2 text-xs text-muted-foreground","data-testid":"api-rail-empty",children:n("No functions or tables to document yet.")}),e[25]=f,e[26]=n,e[27]=$):$=e[27];let k;e[28]!==$||e[29]!==x||e[30]!==v||e[31]!==N||e[32]!==y||e[33]!==b?(k=(0,R.jsxs)("nav",{"aria-label":x,className:v,"data-testid":N,children:[y,b,$]}),e[28]=$,e[29]=x,e[30]=v,e[31]=N,e[32]=y,e[33]=b,e[34]=k):k=e[34];let w;e[35]!==c||e[36]!==n?(w=c===null&&(0,R.jsx)(E,{description:n("Select a function or table to see how to call it from your app."),testId:"api-empty",title:n("API usage snippets")}),e[35]=c,e[36]=n,e[37]=w):w=e[37];let P;e[38]!==c?.kind||e[39]!==h||e[40]!==g?(P=c?.kind==="fn"&&h!==void 0&&g!==void 0&&(0,R.jsx)(ot,{file:g.file,fn:g.fn,kind:h.kind},h.path),e[38]=c?.kind,e[39]=h,e[40]=g,e[41]=P):P=e[41];let O;e[42]!==c?.kind||e[43]!==h||e[44]!==n?(O=c?.kind==="fn"&&h===void 0&&(0,R.jsx)(E,{testId:"api-empty",title:n("API usage snippets")}),e[42]=c?.kind,e[43]=h,e[44]=n,e[45]=O):O=e[45];let S;e[46]!==c?(S=c?.kind==="table"&&(0,R.jsx)(st,{name:c.name}),e[46]=c,e[47]=S):S=e[47];let T;e[48]!==w||e[49]!==P||e[50]!==O||e[51]!==S?(T=(0,R.jsxs)("div",{className:"min-w-0",children:[w,P,O,S]}),e[48]=w,e[49]=P,e[50]=O,e[51]=S,e[52]=T):T=e[52];let A;return e[53]!==k||e[54]!==T||e[55]!==I||e[56]!==C?(A=(0,R.jsxs)("div",{className:I,"data-testid":C,children:[k,T]}),e[53]=k,e[54]=T,e[55]=I,e[56]=C,e[57]=A):A=e[57],A},"ke");function lt(t){return t.name}u(lt,"ue");function dt(t,e){return t.localeCompare(e)}u(dt,"me");var We=L(te(),1);var B=L(te(),1);var z=L(me(),1);var d=L(re(),1);var ct=u(t=>typeof t=="number"?"number":typeof t=="boolean"?"boolean":"string","we"),Me=u(t=>{if(t.enum!==void 0&&t.enum.length>0)return t.enum;if(t.anyOf!==void 0&&t.anyOf.length>0&&t.anyOf.every(e=>e.const!==void 0))return t.anyOf.map(e=>e.const)},"Q"),ce=u(t=>t===void 0?"any":t.const!==void 0?JSON.stringify(t.const):t.enum!==void 0&&t.enum.length>0?t.enum.map(e=>JSON.stringify(e)).join(" | "):t.anyOf!==void 0&&t.anyOf.length>0?t.anyOf.map(e=>ce(e)).join(" | "):t.type==="array"?`array<${ce(t.items)}>`:t.type??"any","z"),pt=u(t=>{let e=Me(t);return e!==void 0?t.type??ct(e[0]):ce(t)},"ke"),mt=u(t=>{let e=Me(t);return e===void 0?void 0:e.map(a=>JSON.stringify(a)).join(" | ")},"Oe"),ut=u(t=>{let e=[];t.minimum!==void 0?e.push(`${String(t.minimum)} \u2264`):t.exclusiveMinimum!==void 0&&e.push(`${String(t.exclusiveMinimum)} <`);let a=e.length>0;e.push("value"),t.maximum!==void 0?e.push(`\u2264 ${String(t.maximum)}`):t.exclusiveMaximum!==void 0&&e.push(`< ${String(t.exclusiveMaximum)}`);let r=e.length>(a?2:1);return a||r?e.join(" "):void 0},"$e"),ft=u(t=>{if(t.type==="object"&&t.properties!==void 0)return t;if(t.type==="array"&&t.items?.type==="object"&&t.items.properties!==void 0)return t.items},"Te"),Z=u(t=>{if(t===void 0)return null;if(t.const!==void 0)return t.const;if(t.enum!==void 0&&t.enum.length>0)return t.enum[0];if(t.anyOf!==void 0&&t.anyOf.length>0)return Z(t.anyOf[0]);switch(t.type){case"array":return[];case"boolean":return!1;case"number":return 0;case"object":{let e={};for(let[a,r]of Object.entries(t.properties??{}))e[a]=Z(r);return e}case"string":return"";default:return null}},"D"),de=u(t=>{let e=(0,B.c)(7),{label:a,value:r}=t,n;e[0]!==a?(n=(0,d.jsx)("span",{className:"text-muted-foreground",children:a}),e[0]=a,e[1]=n):n=e[1];let s;e[2]!==r?(s=(0,d.jsx)("span",{className:"text-foreground",children:r}),e[2]=r,e[3]=s):s=e[3];let o;return e[4]!==n||e[5]!==s?(o=(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 font-mono text-[10px]",children:[n,s]}),e[4]=n,e[5]=s,e[6]=o):o=e[6],o},"K"),ht=u(t=>{let e=(0,B.c)(40),{name:a,required:r,schema:n}=t,s=M(),o;e[0]!==n?(o=ut(n),e[0]=n,e[1]=o):o=e[1];let i=o,c;e[2]!==n?(c=mt(n),e[2]=n,e[3]=c):c=e[3];let m=c,l=n["x-lunora-table"],p=n.format!==void 0||i!==void 0||m!==void 0||l!==void 0,f;e[4]!==n?(f=ft(n),e[4]=n,e[5]=f):f=e[5];let h=f,g=r?"*":"?",x;e[6]!==g?(x=(0,d.jsx)("span",{className:"text-muted-foreground",children:g}),e[6]=g,e[7]=x):x=e[7];let v;e[8]!==a||e[9]!==x?(v=(0,d.jsxs)("span",{className:"font-mono text-foreground",children:[a,x]}),e[8]=a,e[9]=x,e[10]=v):v=e[10];let N;e[11]!==n?(N=pt(n),e[11]=n,e[12]=N):N=e[12];let y;e[13]!==N?(y=(0,d.jsx)("span",{className:"font-mono text-muted-foreground",children:N}),e[13]=N,e[14]=y):y=e[14];let b;e[15]!==v||e[16]!==y?(b=(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[v,y]}),e[15]=v,e[16]=y,e[17]=b):b=e[17];let I;e[18]!==n.description?(I=n.description!==void 0&&(0,d.jsx)("p",{className:"max-w-prose text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=I):I=e[19];let C;e[20]!==p||e[21]!==i||e[22]!==l||e[23]!==n.format||e[24]!==s||e[25]!==m?(C=p&&(0,d.jsxs)("div",{className:"flex flex-wrap gap-1",children:[n.format!==void 0&&(0,d.jsx)(de,{label:s("Format"),value:n.format}),i!==void 0&&(0,d.jsx)(de,{label:s("Range"),value:i}),m!==void 0&&(0,d.jsx)(de,{label:s("Value in"),value:m}),l!==void 0&&(0,d.jsx)(de,{label:s("relation"),value:l})]}),e[20]=p,e[21]=i,e[22]=l,e[23]=n.format,e[24]=s,e[25]=m,e[26]=C):C=e[26];let $;e[27]!==I||e[28]!==C||e[29]!==b?($=(0,d.jsxs)("div",{className:"flex flex-col gap-1 py-2",children:[b,I,C]}),e[27]=I,e[28]=C,e[29]=b,e[30]=$):$=e[30];let k=$;if(h===void 0){let S;return e[31]!==k?(S=(0,d.jsx)("div",{className:"border-b border-border/50 last:border-b-0",children:k}),e[31]=k,e[32]=S):S=e[32],S}let w;e[33]!==k?(w=(0,d.jsx)("summary",{className:"cursor-pointer marker:text-muted-foreground",children:k}),e[33]=k,e[34]=w):w=e[34];let P;e[35]!==h?(P=(0,d.jsx)("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:(0,d.jsx)(qe,{schema:h})}),e[35]=h,e[36]=P):P=e[36];let O;return e[37]!==w||e[38]!==P?(O=(0,d.jsxs)("details",{className:"border-b border-border/50 last:border-b-0",children:[w,P]}),e[37]=w,e[38]=P,e[39]=O):O=e[39],O},"Ce"),qe=u(t=>{let e=(0,B.c)(7),{schema:a}=t,r;e[0]!==a.required?(r=new Set(a.required),e[0]=a.required,e[1]=r):r=e[1];let n=r,s;e[2]!==a.properties?(s=Object.entries(a.properties??{}),e[2]=a.properties,e[3]=s):s=e[3];let o=s,i;return e[4]!==n||e[5]!==o?(i=(0,d.jsx)("div",{className:"flex flex-col",children:o.map(c=>{let[m,l]=c;return(0,d.jsx)(ht,{name:m,required:n.has(m),schema:l},m)})}),e[4]=n,e[5]=o,e[6]=i):i=e[6],i},"Z"),_e=u(t=>{let e=(0,B.c)(10),{schema:a,testId:r}=t;if(a?.type!=="object"||Object.keys(a.properties??{}).length===0){let o;e[0]!==a?(o=ce(a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==o||e[3]!==r?(i=(0,d.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":r,children:o}),e[2]=o,e[3]=r,e[4]=i):i=e[4],i}let n;e[5]!==a?(n=(0,d.jsx)(qe,{schema:a}),e[5]=a,e[6]=n):n=e[6];let s;return e[7]!==n||e[8]!==r?(s=(0,d.jsx)("div",{className:"text-xs","data-testid":r,children:n}),e[7]=n,e[8]=r,e[9]=s):s=e[9],s},"V"),gt=["curl","javascript","lunora"],xt={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},bt=u(t=>`api.${t.replaceAll(/[/:]/g,".")}`,"Ae"),yt=u(t=>{let e=Z(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},"je"),vt=u((t,e,a)=>{let r=`${a}${e.httpPath}`,n=JSON.stringify(yt(e),void 0,2),s=JSON.stringify(Z(e.argsSchema)??{},void 0,2);switch(t){case"curl":{let o=e.method!=="GET"&&e.method!=="HEAD",i=[`curl -X ${e.method} ${JSON.stringify(r)}`];return o&&i.push(' -H "Content-Type: application/json"',` -d '${n}'`),i.join(` \\
3
3
  `)}case"lunora":return e.functionPath===void 0?`await fetch(${JSON.stringify(e.httpPath)}, { method: ${JSON.stringify(e.method)} });`:`import { useLunora } from "@lunora/react";
4
4
  import { api } from "./_generated/api";
@@ -1 +1 @@
1
- import{a as O}from"./chunk-ILLDX6LU.js";import{a as H}from"./chunk-ZWDORIZY.js";import{a as ee}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as Z}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{b as E}from"./chunk-4SJDWMH3.js";import{p as W}from"./chunk-FKM35PXF.js";import"./chunk-WZTY3ZYI.js";import{a as R}from"./chunk-3Y5K3IQO.js";import{a as K,b as V,c as z,d as F,e as u,f as p}from"./chunk-CW57Q264.js";import{a as A,e as T}from"./chunk-MD67S53Z.js";import{f as M,j as G,s as _,w as X}from"./chunk-LPINY2IJ.js";import{a as c,d as P,e as oe,f as re,g as ae}from"./chunk-OXFKZ4BM.js";var U=P(re(),1),Y=P(oe(),1);var t=P(ae(),1);var se=P(re(),1),Q=P(oe(),1);var h=P(ae(),1);var ie=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","X"),le=c(a=>a.toSorted((e,i)=>e.scheduledFor-i.scheduledFor),"F"),ce=c((a,e,i)=>e!==void 0?e:i===void 0?d=>a.cancelScheduledJob(d):void 0,"Y"),de=c(a=>{let e=(0,se.c)(16),{cancelJob:i,loadJobs:d}=a===void 0?{}:a,f=W(),r=M(),l=d===void 0,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-scheduled-jobs"],e[0]=o):o=e[0];let N=E(o,async()=>{let v=await(d??(()=>f.listScheduledJobs()))();return le(v)}),[x,n]=(0,Q.useState)(void 0),[s,m]=(0,Q.useState)(void 0),y,k;e[1]!==f||e[2]!==l?(y=c(()=>{if(l)return f.subscribeScheduledJobs(v=>{m(void 0),n(le(v))})},"v"),k=[l,f],e[1]=f,e[2]=l,e[3]=y,e[4]=k):(y=e[3],k=e[4]),(0,Q.useEffect)(y,k);let g;e[5]!==N?(g=c(()=>N.poll(),"y"),e[5]=N,e[6]=g):g=e[6],O(g,!l);let J=ce(f,i,d),b=x??N.data,j=s??N.error,L=c(async v=>{if(J!==void 0){m(void 0);try{await J(v),l||N.refetch()}catch(D){m(G(D))}}},"E"),q="flex flex-col gap-3",B="lunora-scheduled-jobs",S;e[7]!==j?(S=j!==null&&(0,h.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:j}),e[7]=j,e[8]=S):S=e[8];let $;e[9]!==b?.length||e[10]!==r?($=b?.length===0&&(0,h.jsx)(R,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,h.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,h.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,h.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=b?.length,e[10]=r,e[11]=$):$=e[11];let I=b!==void 0&&b.length>0&&(0,h.jsx)(A,{className:"overflow-hidden py-0",children:(0,h.jsx)(T,{className:"px-0",children:(0,h.jsxs)(K,{"data-testid":"sj-table",children:[(0,h.jsx)(V,{children:(0,h.jsxs)(F,{children:[(0,h.jsx)(u,{children:r("function")}),(0,h.jsx)(u,{children:r("scheduled for")}),(0,h.jsx)(u,{children:r("pool")}),(0,h.jsx)(u,{children:r("attempts")}),(0,h.jsx)(u,{children:r("shard")}),(0,h.jsx)(u,{children:r("id")}),J!==void 0&&(0,h.jsx)(u,{"aria-label":r("Actions")})]})}),(0,h.jsx)(z,{children:b.map(v=>(0,h.jsxs)(F,{"data-testid":`sj-row-${v.id}`,children:[(0,h.jsx)(p,{className:"font-mono text-xs",children:v.workflow??v.functionPath}),(0,h.jsx)(p,{className:"text-muted-foreground tabular-nums",children:ie(v.scheduledFor)}),(0,h.jsx)(p,{className:"font-mono text-xs",children:v.pool??""}),(0,h.jsx)(p,{className:"tabular-nums",children:v.attempts??0}),(0,h.jsx)(p,{children:v.shardKey??""}),(0,h.jsx)(p,{className:"font-mono text-xs",children:v.id}),J!==void 0&&(0,h.jsx)(p,{className:"text-right",children:(0,h.jsx)(H,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{_(L(v.id))},"onConfirm"),testId:`sj-cancel-${v.id}`,children:r("Cancel")})})]},v.id))})]})})}),w;return e[12]!==I||e[13]!==S||e[14]!==$?(w=(0,h.jsxs)("div",{className:q,"data-testid":B,children:[S,$,I]}),e[12]=I,e[13]=S,e[14]=$,e[15]=w):w=e[15],w},"he");var he={kind:"idle"},me=c((a,e,i)=>i!==void 0?i:e===void 0?d=>a.runCronJob(d):void 0,"re"),ue=c(({loadCronJobs:a,runCronJob:e}={})=>{let i=W(),d=M(),[f,r]=(0,Y.useState)({}),l=E(["lunora-cron-jobs",a?"custom":"default"],()=>(a??(()=>i.getCronJobs()))()),{data:o,error:N}=l,x=me(i,a,e),n=c(async s=>{if(x!==void 0){r(m=>({...m,[s]:{kind:"running"}}));try{await x(s),r(m=>({...m,[s]:{kind:"ok"}})),l.refetch()}catch(m){r(y=>({...y,[s]:{kind:"error",message:G(m)}}))}}},"i");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),o?.length===0&&(0,t.jsx)(R,{description:d("Triggers declared with the cronJobs() builder appear here."),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)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:d("No cron triggers.")}),o!==void 0&&o.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"cron-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:d("name")}),(0,t.jsx)(u,{children:d("schedule")}),(0,t.jsx)(u,{children:d("target")}),(0,t.jsx)(u,{children:d("shard")}),x!==void 0&&(0,t.jsx)(u,{"aria-label":d("Actions")})]})}),(0,t.jsx)(z,{children:o.map(s=>{let m=f[s.name]??he;return(0,t.jsxs)(F,{"data-testid":`cron-row-${s.name}`,children:[(0,t.jsx)(p,{children:s.name}),(0,t.jsx)(p,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,t.jsx)(p,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,t.jsx)(Z,{variant:"outline",children:d("function")}):(0,t.jsx)(Z,{variant:"secondary",children:d("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,t.jsx)(p,{children:s.shardKey??""}),x!==void 0&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[m.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:d("ran")}),m.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:m.message}),(0,t.jsx)(H,{confirmLabel:d("Run now?"),disabled:m.kind==="running",onConfirm:c(()=>{_(n(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:m.kind==="running"?d("Running\u2026"):d("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"le"),pe=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","se"),fe=c(a=>{let e=(0,U.c)(34),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadJobs:d,removeJob:f,retryJob:r}=i,l=W(),o=M(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let x;e[3]!==l||e[4]!==d?(x=c(async()=>(await(d??(()=>l.listDeadJobs()))()).toSorted(be),"h"),e[3]=l,e[4]=d,e[5]=x):x=e[5];let n=E(N,x),s=n.data,[m,y]=(0,Y.useState)(void 0),k=n.error??m,g=d===void 0,J;e[6]!==l||e[7]!==g||e[8]!==r?(J=r??(g?C=>l.retryDeadJob(C):void 0),e[6]=l,e[7]=g,e[8]=r,e[9]=J):J=e[9];let b=J,j;e[10]!==l||e[11]!==g||e[12]!==f?(j=f??(g?C=>l.removeDeadJob(C):void 0),e[10]=l,e[11]=g,e[12]=f,e[13]=j):j=e[13];let L=j,q;e[14]!==n?(q=c(()=>n.poll(),"$"),e[14]=n,e[15]=q):q=e[15],O(q,!0);let B;e[16]!==n?(B=c(async C=>{y(void 0);try{await C,n.refetch()}catch(ne){y(G(ne))}},"I"),e[16]=n,e[17]=B):B=e[17];let S=B,$=b!==void 0||L!==void 0,I;e[18]!==k?(I=k!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:k}),e[18]=k,e[19]=I):I=e[19];let w;e[20]!==s?.length||e[21]!==o?(w=s?.length===0&&(0,t.jsx)(R,{description:o("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:o("No dead-letter jobs.")}),e[20]=s?.length,e[21]=o,e[22]=w):w=e[22];let v;e[23]!==S||e[24]!==$||e[25]!==s||e[26]!==L||e[27]!==b||e[28]!==o?(v=s!==void 0&&s.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"dlq-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:o("function")}),(0,t.jsx)(u,{children:o("attempts")}),(0,t.jsx)(u,{children:o("last tried")}),(0,t.jsx)(u,{children:o("pool")}),(0,t.jsx)(u,{children:o("shard")}),(0,t.jsx)(u,{children:o("id")}),$&&(0,t.jsx)(u,{"aria-label":o("Actions")})]})}),(0,t.jsx)(z,{children:s.map(C=>(0,t.jsxs)(F,{"data-testid":`dlq-row-${C.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:C.workflow??C.functionPath}),(0,t.jsx)(p,{className:"tabular-nums",children:C.attempts??0}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:pe(C.scheduledFor)}),(0,t.jsx)(p,{className:"font-mono text-xs",children:C.pool??""}),(0,t.jsx)(p,{children:C.shardKey??""}),(0,t.jsx)(p,{className:"font-mono text-xs",children:C.id}),$&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[b!==void 0&&(0,t.jsx)(ee,{"data-testid":`dlq-retry-${C.id}`,onClick:c(()=>{_(S(b(C.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Retry")}),L!==void 0&&(0,t.jsx)(H,{confirmLabel:o("Drop job?"),onConfirm:c(()=>{_(S(L(C.id)))},"onConfirm"),testId:`dlq-remove-${C.id}`,children:o("Drop")})]})})]},C.id))})]})})}),e[23]=S,e[24]=$,e[25]=s,e[26]=L,e[27]=b,e[28]=o,e[29]=v):v=e[29];let D;return e[30]!==v||e[31]!==I||e[32]!==w?(D=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[I,w,v]}),e[30]=v,e[31]=I,e[32]=w,e[33]=D):D=e[33],D},"ne");function be(a,e){return(e.attempts??0)-(a.attempts??0)}c(be,"oe");var te=c(a=>{let e=(0,U.c)(8),{label:i,testId:d,value:f}=a,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==d||e[3]!==f?(l=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":d,children:f}),e[2]=d,e[3]=f,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o=(0,t.jsx)(A,{className:"flex-1 py-0",children:(0,t.jsxs)(T,{className:"flex flex-col gap-1 p-4",children:[r,l]})}),e[5]=r,e[6]=l,e[7]=o):o=e[7],o},"E"),ve=c(a=>{let e=(0,U.c)(25),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadStatus:d}=i,f=W(),r=M(),l=d===void 0,o;e[2]!==l?(o=["lunora-scheduler-status",l],e[2]=l,e[3]=o):o=e[3];let N;e[4]!==f||e[5]!==d?(N=c(async()=>{let j=await(d??(()=>f.schedulerStatus()))();return{...j,pools:j.pools.toSorted(xe)}},"y"),e[4]=f,e[5]=d,e[6]=N):N=e[6];let x=E(o,N),{data:n,error:s}=x,m;e[7]!==x?(m=c(()=>x.poll(),"d"),e[7]=x,e[8]=m):m=e[8],O(m,!0);let y;e[9]!==s?(y=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=y):y=e[10];let k;e[11]!==n||e[12]!==r?(k=n!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(te,{label:r("backlog"),testId:"pools-backlog",value:n.backlog}),(0,t.jsx)(te,{label:r("in flight"),testId:"pools-inflight",value:n.inFlight}),(0,t.jsx)(te,{label:r("pools"),testId:"pools-count",value:n.pools.length})]}),e[11]=n,e[12]=r,e[13]=k):k=e[13];let g;e[14]!==n?.pools.length||e[15]!==r?(g=n?.pools.length===0&&(0,t.jsx)(R,{description:r("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:r("No workpools.")}),e[14]=n?.pools.length,e[15]=r,e[16]=g):g=e[16];let J;e[17]!==n||e[18]!==r?(J=n!==void 0&&n.pools.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"pools-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:r("pool")}),(0,t.jsx)(u,{children:r("queued")}),(0,t.jsx)(u,{children:r("in flight")}),(0,t.jsx)(u,{children:r("max concurrency")})]})}),(0,t.jsx)(z,{children:n.pools.map(ge)})]})})}),e[17]=n,e[18]=r,e[19]=J):J=e[19];let b;return e[20]!==y||e[21]!==k||e[22]!==g||e[23]!==J?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[y,k,g,J]}),e[20]=y,e[21]=k,e[22]=g,e[23]=J,e[24]=b):b=e[24],b},"ae");function xe(a,e){return e.queued-a.queued}c(xe,"ie");function ge(a){return(0,t.jsxs)(F,{"data-testid":`pools-row-${a.name}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:a.name}),(0,t.jsx)(p,{className:"tabular-nums",children:a.queued}),(0,t.jsxs)(p,{className:"tabular-nums",children:[a.inFlight," / ",a.maxConcurrency]}),(0,t.jsx)(p,{className:"tabular-nums",children:a.maxConcurrency})]},a.name)}c(ge,"de");var Ne=["jobs","dead","pools","cron"],Ve=c(a=>{let e=(0,U.c)(41),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadCronJobs:d,scheduledCancel:f,scheduledLoad:r}=i,l=M(),[o,N]=(0,Y.useState)("jobs"),x;e[2]!==l?(x=l("Cron triggers"),e[2]=l,e[3]=x):x=e[3];let n;e[4]!==l?(n=l("Dead letter"),e[4]=l,e[5]=n):n=e[5];let s;e[6]!==l?(s=l("Scheduled jobs"),e[6]=l,e[7]=s):s=e[7];let m;e[8]!==l?(m=l("Pools"),e[8]=l,e[9]=m):m=e[9];let y;e[10]!==x||e[11]!==n||e[12]!==s||e[13]!==m?(y={cron:x,dead:n,jobs:s,pools:m},e[10]=x,e[11]=n,e[12]=s,e[13]=m,e[14]=y):y=e[14];let k=y,g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=c(w=>{N(w.currentTarget.dataset.view)},"f"),e[15]=g):g=e[15];let J=g,b;e[16]!==l?(b=l("Schedule view"),e[16]=l,e[17]=b):b=e[17];let j;e[18]!==o||e[19]!==k?(j=Ne.map(w=>(0,t.jsx)(ee,{"aria-selected":o===w,"data-testid":`schedule-view-${w}`,"data-view":w,onClick:J,role:"tab",size:"sm",type:"button",variant:o===w?"default":"outline",children:k[w]},w)),e[18]=o,e[19]=k,e[20]=j):j=e[20];let L;e[21]!==b||e[22]!==j?(L=(0,t.jsx)("div",{"aria-label":b,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:j}),e[21]=b,e[22]=j,e[23]=L):L=e[23];let q;e[24]!==f||e[25]!==r||e[26]!==o?(q=o==="jobs"&&(0,t.jsx)(de,{cancelJob:f,loadJobs:r}),e[24]=f,e[25]=r,e[26]=o,e[27]=q):q=e[27];let B;e[28]!==o?(B=o==="dead"&&(0,t.jsx)(fe,{}),e[28]=o,e[29]=B):B=e[29];let S;e[30]!==o?(S=o==="pools"&&(0,t.jsx)(ve,{}),e[30]=o,e[31]=S):S=e[31];let $;e[32]!==d||e[33]!==o?($=o==="cron"&&(0,t.jsx)(ue,{loadCronJobs:d}),e[32]=d,e[33]=o,e[34]=$):$=e[34];let I;return e[35]!==L||e[36]!==q||e[37]!==B||e[38]!==S||e[39]!==$?(I=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[L,q,B,S,$]}),e[35]=L,e[36]=q,e[37]=B,e[38]=S,e[39]=$,e[40]=I):I=e[40],I},"Ie");export{Ve as SchedulePanel};
1
+ import{a as O}from"./chunk-473JK2PQ.js";import{a as H}from"./chunk-FXPAJDES.js";import{a as ee}from"./chunk-6VAY6L4J.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as Z}from"./chunk-PQH2LSJX.js";import"./chunk-4C4THJUD.js";import{b as E}from"./chunk-4DAKKAK7.js";import{m as W}from"./chunk-BVX45MU5.js";import"./chunk-H7HZ42JY.js";import{a as R}from"./chunk-XMSNLMWU.js";import{a as K,b as V,c as z,d as F,e as u,f as p}from"./chunk-HHRYM6UW.js";import{a as A,e as T}from"./chunk-JSDKOE4U.js";import{C as X,l as M,p as G,y as _}from"./chunk-BFE2DRP6.js";import{a as c,d as P,e as oe,f as re,g as ae}from"./chunk-OXFKZ4BM.js";var U=P(re(),1),Y=P(oe(),1);var t=P(ae(),1);var se=P(re(),1),Q=P(oe(),1);var h=P(ae(),1);var ie=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","X"),le=c(a=>a.toSorted((e,i)=>e.scheduledFor-i.scheduledFor),"F"),ce=c((a,e,i)=>e!==void 0?e:i===void 0?d=>a.cancelScheduledJob(d):void 0,"Y"),de=c(a=>{let e=(0,se.c)(16),{cancelJob:i,loadJobs:d}=a===void 0?{}:a,f=W(),r=M(),l=d===void 0,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-scheduled-jobs"],e[0]=o):o=e[0];let N=E(o,async()=>{let v=await(d??(()=>f.listScheduledJobs()))();return le(v)}),[x,n]=(0,Q.useState)(void 0),[s,m]=(0,Q.useState)(void 0),y,k;e[1]!==f||e[2]!==l?(y=c(()=>{if(l)return f.subscribeScheduledJobs(v=>{m(void 0),n(le(v))})},"v"),k=[l,f],e[1]=f,e[2]=l,e[3]=y,e[4]=k):(y=e[3],k=e[4]),(0,Q.useEffect)(y,k);let g;e[5]!==N?(g=c(()=>N.poll(),"y"),e[5]=N,e[6]=g):g=e[6],O(g,!l);let J=ce(f,i,d),b=x??N.data,j=s??N.error,L=c(async v=>{if(J!==void 0){m(void 0);try{await J(v),l||N.refetch()}catch(D){m(G(D))}}},"E"),q="flex flex-col gap-3",B="lunora-scheduled-jobs",S;e[7]!==j?(S=j!==null&&(0,h.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:j}),e[7]=j,e[8]=S):S=e[8];let $;e[9]!==b?.length||e[10]!==r?($=b?.length===0&&(0,h.jsx)(R,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,h.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,h.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,h.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=b?.length,e[10]=r,e[11]=$):$=e[11];let I=b!==void 0&&b.length>0&&(0,h.jsx)(A,{className:"overflow-hidden py-0",children:(0,h.jsx)(T,{className:"px-0",children:(0,h.jsxs)(K,{"data-testid":"sj-table",children:[(0,h.jsx)(V,{children:(0,h.jsxs)(F,{children:[(0,h.jsx)(u,{children:r("function")}),(0,h.jsx)(u,{children:r("scheduled for")}),(0,h.jsx)(u,{children:r("pool")}),(0,h.jsx)(u,{children:r("attempts")}),(0,h.jsx)(u,{children:r("shard")}),(0,h.jsx)(u,{children:r("id")}),J!==void 0&&(0,h.jsx)(u,{"aria-label":r("Actions")})]})}),(0,h.jsx)(z,{children:b.map(v=>(0,h.jsxs)(F,{"data-testid":`sj-row-${v.id}`,children:[(0,h.jsx)(p,{className:"font-mono text-xs",children:v.workflow??v.functionPath}),(0,h.jsx)(p,{className:"text-muted-foreground tabular-nums",children:ie(v.scheduledFor)}),(0,h.jsx)(p,{className:"font-mono text-xs",children:v.pool??""}),(0,h.jsx)(p,{className:"tabular-nums",children:v.attempts??0}),(0,h.jsx)(p,{children:v.shardKey??""}),(0,h.jsx)(p,{className:"font-mono text-xs",children:v.id}),J!==void 0&&(0,h.jsx)(p,{className:"text-right",children:(0,h.jsx)(H,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{_(L(v.id))},"onConfirm"),testId:`sj-cancel-${v.id}`,children:r("Cancel")})})]},v.id))})]})})}),w;return e[12]!==I||e[13]!==S||e[14]!==$?(w=(0,h.jsxs)("div",{className:q,"data-testid":B,children:[S,$,I]}),e[12]=I,e[13]=S,e[14]=$,e[15]=w):w=e[15],w},"he");var he={kind:"idle"},me=c((a,e,i)=>i!==void 0?i:e===void 0?d=>a.runCronJob(d):void 0,"re"),ue=c(({loadCronJobs:a,runCronJob:e}={})=>{let i=W(),d=M(),[f,r]=(0,Y.useState)({}),l=E(["lunora-cron-jobs",a?"custom":"default"],()=>(a??(()=>i.getCronJobs()))()),{data:o,error:N}=l,x=me(i,a,e),n=c(async s=>{if(x!==void 0){r(m=>({...m,[s]:{kind:"running"}}));try{await x(s),r(m=>({...m,[s]:{kind:"ok"}})),l.refetch()}catch(m){r(y=>({...y,[s]:{kind:"error",message:G(m)}}))}}},"i");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),o?.length===0&&(0,t.jsx)(R,{description:d("Triggers declared with the cronJobs() builder appear here."),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)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:d("No cron triggers.")}),o!==void 0&&o.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"cron-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:d("name")}),(0,t.jsx)(u,{children:d("schedule")}),(0,t.jsx)(u,{children:d("target")}),(0,t.jsx)(u,{children:d("shard")}),x!==void 0&&(0,t.jsx)(u,{"aria-label":d("Actions")})]})}),(0,t.jsx)(z,{children:o.map(s=>{let m=f[s.name]??he;return(0,t.jsxs)(F,{"data-testid":`cron-row-${s.name}`,children:[(0,t.jsx)(p,{children:s.name}),(0,t.jsx)(p,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,t.jsx)(p,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,t.jsx)(Z,{variant:"outline",children:d("function")}):(0,t.jsx)(Z,{variant:"secondary",children:d("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,t.jsx)(p,{children:s.shardKey??""}),x!==void 0&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[m.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:d("ran")}),m.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:m.message}),(0,t.jsx)(H,{confirmLabel:d("Run now?"),disabled:m.kind==="running",onConfirm:c(()=>{_(n(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:m.kind==="running"?d("Running\u2026"):d("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"le"),pe=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","se"),fe=c(a=>{let e=(0,U.c)(34),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadJobs:d,removeJob:f,retryJob:r}=i,l=W(),o=M(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let x;e[3]!==l||e[4]!==d?(x=c(async()=>(await(d??(()=>l.listDeadJobs()))()).toSorted(be),"h"),e[3]=l,e[4]=d,e[5]=x):x=e[5];let n=E(N,x),s=n.data,[m,y]=(0,Y.useState)(void 0),k=n.error??m,g=d===void 0,J;e[6]!==l||e[7]!==g||e[8]!==r?(J=r??(g?C=>l.retryDeadJob(C):void 0),e[6]=l,e[7]=g,e[8]=r,e[9]=J):J=e[9];let b=J,j;e[10]!==l||e[11]!==g||e[12]!==f?(j=f??(g?C=>l.removeDeadJob(C):void 0),e[10]=l,e[11]=g,e[12]=f,e[13]=j):j=e[13];let L=j,q;e[14]!==n?(q=c(()=>n.poll(),"$"),e[14]=n,e[15]=q):q=e[15],O(q,!0);let B;e[16]!==n?(B=c(async C=>{y(void 0);try{await C,n.refetch()}catch(ne){y(G(ne))}},"I"),e[16]=n,e[17]=B):B=e[17];let S=B,$=b!==void 0||L!==void 0,I;e[18]!==k?(I=k!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:k}),e[18]=k,e[19]=I):I=e[19];let w;e[20]!==s?.length||e[21]!==o?(w=s?.length===0&&(0,t.jsx)(R,{description:o("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:o("No dead-letter jobs.")}),e[20]=s?.length,e[21]=o,e[22]=w):w=e[22];let v;e[23]!==S||e[24]!==$||e[25]!==s||e[26]!==L||e[27]!==b||e[28]!==o?(v=s!==void 0&&s.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"dlq-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:o("function")}),(0,t.jsx)(u,{children:o("attempts")}),(0,t.jsx)(u,{children:o("last tried")}),(0,t.jsx)(u,{children:o("pool")}),(0,t.jsx)(u,{children:o("shard")}),(0,t.jsx)(u,{children:o("id")}),$&&(0,t.jsx)(u,{"aria-label":o("Actions")})]})}),(0,t.jsx)(z,{children:s.map(C=>(0,t.jsxs)(F,{"data-testid":`dlq-row-${C.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:C.workflow??C.functionPath}),(0,t.jsx)(p,{className:"tabular-nums",children:C.attempts??0}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:pe(C.scheduledFor)}),(0,t.jsx)(p,{className:"font-mono text-xs",children:C.pool??""}),(0,t.jsx)(p,{children:C.shardKey??""}),(0,t.jsx)(p,{className:"font-mono text-xs",children:C.id}),$&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[b!==void 0&&(0,t.jsx)(ee,{"data-testid":`dlq-retry-${C.id}`,onClick:c(()=>{_(S(b(C.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Retry")}),L!==void 0&&(0,t.jsx)(H,{confirmLabel:o("Drop job?"),onConfirm:c(()=>{_(S(L(C.id)))},"onConfirm"),testId:`dlq-remove-${C.id}`,children:o("Drop")})]})})]},C.id))})]})})}),e[23]=S,e[24]=$,e[25]=s,e[26]=L,e[27]=b,e[28]=o,e[29]=v):v=e[29];let D;return e[30]!==v||e[31]!==I||e[32]!==w?(D=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[I,w,v]}),e[30]=v,e[31]=I,e[32]=w,e[33]=D):D=e[33],D},"ne");function be(a,e){return(e.attempts??0)-(a.attempts??0)}c(be,"oe");var te=c(a=>{let e=(0,U.c)(8),{label:i,testId:d,value:f}=a,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==d||e[3]!==f?(l=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":d,children:f}),e[2]=d,e[3]=f,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o=(0,t.jsx)(A,{className:"flex-1 py-0",children:(0,t.jsxs)(T,{className:"flex flex-col gap-1 p-4",children:[r,l]})}),e[5]=r,e[6]=l,e[7]=o):o=e[7],o},"E"),ve=c(a=>{let e=(0,U.c)(25),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadStatus:d}=i,f=W(),r=M(),l=d===void 0,o;e[2]!==l?(o=["lunora-scheduler-status",l],e[2]=l,e[3]=o):o=e[3];let N;e[4]!==f||e[5]!==d?(N=c(async()=>{let j=await(d??(()=>f.schedulerStatus()))();return{...j,pools:j.pools.toSorted(xe)}},"y"),e[4]=f,e[5]=d,e[6]=N):N=e[6];let x=E(o,N),{data:n,error:s}=x,m;e[7]!==x?(m=c(()=>x.poll(),"d"),e[7]=x,e[8]=m):m=e[8],O(m,!0);let y;e[9]!==s?(y=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=y):y=e[10];let k;e[11]!==n||e[12]!==r?(k=n!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(te,{label:r("backlog"),testId:"pools-backlog",value:n.backlog}),(0,t.jsx)(te,{label:r("in flight"),testId:"pools-inflight",value:n.inFlight}),(0,t.jsx)(te,{label:r("pools"),testId:"pools-count",value:n.pools.length})]}),e[11]=n,e[12]=r,e[13]=k):k=e[13];let g;e[14]!==n?.pools.length||e[15]!==r?(g=n?.pools.length===0&&(0,t.jsx)(R,{description:r("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:r("No workpools.")}),e[14]=n?.pools.length,e[15]=r,e[16]=g):g=e[16];let J;e[17]!==n||e[18]!==r?(J=n!==void 0&&n.pools.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"pools-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:r("pool")}),(0,t.jsx)(u,{children:r("queued")}),(0,t.jsx)(u,{children:r("in flight")}),(0,t.jsx)(u,{children:r("max concurrency")})]})}),(0,t.jsx)(z,{children:n.pools.map(ge)})]})})}),e[17]=n,e[18]=r,e[19]=J):J=e[19];let b;return e[20]!==y||e[21]!==k||e[22]!==g||e[23]!==J?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[y,k,g,J]}),e[20]=y,e[21]=k,e[22]=g,e[23]=J,e[24]=b):b=e[24],b},"ae");function xe(a,e){return e.queued-a.queued}c(xe,"ie");function ge(a){return(0,t.jsxs)(F,{"data-testid":`pools-row-${a.name}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:a.name}),(0,t.jsx)(p,{className:"tabular-nums",children:a.queued}),(0,t.jsxs)(p,{className:"tabular-nums",children:[a.inFlight," / ",a.maxConcurrency]}),(0,t.jsx)(p,{className:"tabular-nums",children:a.maxConcurrency})]},a.name)}c(ge,"de");var Ne=["jobs","dead","pools","cron"],Ve=c(a=>{let e=(0,U.c)(41),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadCronJobs:d,scheduledCancel:f,scheduledLoad:r}=i,l=M(),[o,N]=(0,Y.useState)("jobs"),x;e[2]!==l?(x=l("Cron triggers"),e[2]=l,e[3]=x):x=e[3];let n;e[4]!==l?(n=l("Dead letter"),e[4]=l,e[5]=n):n=e[5];let s;e[6]!==l?(s=l("Scheduled jobs"),e[6]=l,e[7]=s):s=e[7];let m;e[8]!==l?(m=l("Pools"),e[8]=l,e[9]=m):m=e[9];let y;e[10]!==x||e[11]!==n||e[12]!==s||e[13]!==m?(y={cron:x,dead:n,jobs:s,pools:m},e[10]=x,e[11]=n,e[12]=s,e[13]=m,e[14]=y):y=e[14];let k=y,g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=c(w=>{N(w.currentTarget.dataset.view)},"f"),e[15]=g):g=e[15];let J=g,b;e[16]!==l?(b=l("Schedule view"),e[16]=l,e[17]=b):b=e[17];let j;e[18]!==o||e[19]!==k?(j=Ne.map(w=>(0,t.jsx)(ee,{"aria-selected":o===w,"data-testid":`schedule-view-${w}`,"data-view":w,onClick:J,role:"tab",size:"sm",type:"button",variant:o===w?"default":"outline",children:k[w]},w)),e[18]=o,e[19]=k,e[20]=j):j=e[20];let L;e[21]!==b||e[22]!==j?(L=(0,t.jsx)("div",{"aria-label":b,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:j}),e[21]=b,e[22]=j,e[23]=L):L=e[23];let q;e[24]!==f||e[25]!==r||e[26]!==o?(q=o==="jobs"&&(0,t.jsx)(de,{cancelJob:f,loadJobs:r}),e[24]=f,e[25]=r,e[26]=o,e[27]=q):q=e[27];let B;e[28]!==o?(B=o==="dead"&&(0,t.jsx)(fe,{}),e[28]=o,e[29]=B):B=e[29];let S;e[30]!==o?(S=o==="pools"&&(0,t.jsx)(ve,{}),e[30]=o,e[31]=S):S=e[31];let $;e[32]!==d||e[33]!==o?($=o==="cron"&&(0,t.jsx)(ue,{loadCronJobs:d}),e[32]=d,e[33]=o,e[34]=$):$=e[34];let I;return e[35]!==L||e[36]!==q||e[37]!==B||e[38]!==S||e[39]!==$?(I=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[L,q,B,S,$]}),e[35]=L,e[36]=q,e[37]=B,e[38]=S,e[39]=$,e[40]=I):I=e[40],I},"Ie");export{Ve as SchedulePanel};
@@ -0,0 +1 @@
1
+ import{h}from"./chunk-BFE2DRP6.js";import{a as u,d as g,f as b,g as j}from"./chunk-OXFKZ4BM.js";var v=g(b(),1);var t=g(j(),1);var z=u(N=>{let e=(0,v.c)(19),{action:a,className:x,description:c,icon:m,testId:f,title:p}=N,s;e[0]!==x?(s=h("flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-border px-6 py-14 text-center",x),e[0]=x,e[1]=s):s=e[1];let r;e[2]!==m?(r=m!==void 0&&(0,t.jsx)("span",{className:"flex size-10 items-center justify-center rounded-lg bg-muted text-muted-foreground [&_svg]:size-5",children:m}),e[2]=m,e[3]=r):r=e[3];let d;e[4]!==p?(d=(0,t.jsx)("p",{className:"text-sm font-medium text-foreground",children:p}),e[4]=p,e[5]=d):d=e[5];let l;e[6]!==c?(l=c!==void 0&&(0,t.jsx)("p",{className:"max-w-sm text-sm text-muted-foreground",children:c}),e[6]=c,e[7]=l):l=e[7];let o;e[8]!==d||e[9]!==l?(o=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[d,l]}),e[8]=d,e[9]=l,e[10]=o):o=e[10];let i;e[11]!==a?(i=a!==void 0&&(0,t.jsx)("div",{className:"mt-1 flex items-center gap-2",children:a}),e[11]=a,e[12]=i):i=e[12];let n;return e[13]!==s||e[14]!==r||e[15]!==o||e[16]!==i||e[17]!==f?(n=(0,t.jsxs)("div",{className:s,"data-testid":f,children:[r,o,i]}),e[13]=s,e[14]=r,e[15]=o,e[16]=i,e[17]=f,e[18]=n):n=e[18],n},"y");export{z as a};