@lunora/studio 1.0.0-alpha.113 → 1.0.0-alpha.115

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 (153) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/mount.js +1 -1
  3. package/dist/packem_chunks/AdvisorHealthPanel.js +1 -1
  4. package/dist/packem_chunks/ApiTab.js +1 -1
  5. package/dist/packem_chunks/AuditPanel.js +1 -1
  6. package/dist/packem_chunks/DeploymentHealthPanel.js +1 -1
  7. package/dist/packem_chunks/ExportImportPanel.js +1 -1
  8. package/dist/packem_chunks/FileBrowser.js +1 -1
  9. package/dist/packem_chunks/FunctionRunner.js +1 -1
  10. package/dist/packem_chunks/FunctionStatsPanel.js +1 -1
  11. package/dist/packem_chunks/HealthPanel.js +1 -1
  12. package/dist/packem_chunks/InsightsPanel.js +1 -1
  13. package/dist/packem_chunks/LogsPanel.js +1 -1
  14. package/dist/packem_chunks/MailPanel.js +1 -1
  15. package/dist/packem_chunks/MetricsPanel.js +1 -1
  16. package/dist/packem_chunks/NotificationsPanel.js +1 -1
  17. package/dist/packem_chunks/PitrPanel.js +1 -1
  18. package/dist/packem_chunks/SchemaViewer.js +1 -1
  19. package/dist/packem_chunks/SecurityAdvisorPanel.js +1 -1
  20. package/dist/packem_chunks/SettingsPanel.js +1 -1
  21. package/dist/packem_chunks/SqlEditorPanel.js +1 -1
  22. package/dist/packem_chunks/TableEditor.js +1 -1
  23. package/dist/packem_chunks/agents-panel.js +1 -1
  24. package/dist/packem_chunks/analytics-panel.js +1 -1
  25. package/dist/packem_chunks/auth-audit-panel.js +1 -1
  26. package/dist/packem_chunks/auth-config-panel.js +1 -1
  27. package/dist/packem_chunks/auth-sessions-panel.js +1 -1
  28. package/dist/packem_chunks/containers-panel.js +1 -1
  29. package/dist/packem_chunks/dashboards-panel.js +1 -1
  30. package/dist/packem_chunks/evals-panel.js +1 -1
  31. package/dist/packem_chunks/fanout-panel.js +1 -1
  32. package/dist/packem_chunks/flags-panel.js +1 -1
  33. package/dist/packem_chunks/issues-panel.js +1 -1
  34. package/dist/packem_chunks/kv-browser.js +1 -1
  35. package/dist/packem_chunks/log-drains-panel.js +1 -1
  36. package/dist/packem_chunks/migrations-route.js +1 -1
  37. package/dist/packem_chunks/organizations-panel.js +1 -1
  38. package/dist/packem_chunks/payments-panel.js +1 -1
  39. package/dist/packem_chunks/permissions-panel.js +1 -1
  40. package/dist/packem_chunks/queues-panel.js +1 -1
  41. package/dist/packem_chunks/rls-panel.js +1 -1
  42. package/dist/packem_chunks/schedule-panel.js +1 -1
  43. package/dist/packem_chunks/storage-rules-panel.js +1 -1
  44. package/dist/packem_chunks/subscriptions-panel.js +1 -1
  45. package/dist/packem_chunks/sync-client-panel.js +1 -1
  46. package/dist/packem_chunks/traces-panel.js +1 -1
  47. package/dist/packem_chunks/users-panel.js +1 -1
  48. package/dist/packem_chunks/vector-browser.js +1 -1
  49. package/dist/packem_chunks/workflows-panel.js +1 -1
  50. package/dist/packem_shared/{ApiDocsPanel-BL5lMig5.js → ApiDocsPanel-C_dZt4ve.js} +1 -1
  51. package/dist/packem_shared/{ApiReferencePanel-CkCFMCBb.js → ApiReferencePanel-6W_QfOlv.js} +1 -1
  52. package/dist/packem_shared/{CommandPalette-B5yLEABs.js → CommandPalette-BAiOc1hT.js} +1 -1
  53. package/dist/packem_shared/{DataBrowser-BnDIFN-S.js → DataBrowser-CrkvQAMf.js} +1 -1
  54. package/dist/packem_shared/{GlobalDataBrowser-DusjXzRF.js → GlobalDataBrowser-BHFgEqMl.js} +1 -1
  55. package/dist/packem_shared/{HomePanel-BcaHVBJh.js → HomePanel-B8U_LJkK.js} +1 -1
  56. package/dist/packem_shared/{MigrationsPanel-CCOENX4X.js → MigrationsPanel-CW4MNUa4.js} +1 -1
  57. package/dist/packem_shared/{OpenRpcReferencePanel-21OWMH45.js → OpenRpcReferencePanel-Cx-qwpZW.js} +1 -1
  58. package/dist/packem_shared/{ScheduledJobs-CiO3eXgI.js → ScheduledJobs-DRmOKtDa.js} +1 -1
  59. package/dist/packem_shared/Studio-k_HuJZYW.js +1 -0
  60. package/dist/packem_shared/{StudioApp-DCdbsciH.js → StudioApp-CWpwayvp.js} +1 -1
  61. package/dist/packem_shared/{advisor-view-C1KFTXSH.js → advisor-view-CqCG22DB.js} +1 -1
  62. package/dist/packem_shared/{data-grid-BFTQnkXq.js → data-grid-pjv4t5Yi.js} +1 -1
  63. package/dist/packem_shared/{error-alert-TYdKetJd.js → error-alert-CKqB2CiN.js} +1 -1
  64. package/dist/packem_shared/{grid-features-C_yXlMc_.js → grid-features-3wfN2PeE.js} +4 -4
  65. package/dist/packem_shared/{home-panel-BiJHXeDC.js → home-panel-DywiFhDs.js} +1 -1
  66. package/dist/packem_shared/{internal-CwaF9YNk.js → internal-7bgd8inO.js} +1 -1
  67. package/dist/packem_shared/{log-line-UnE93Ovi.js → log-line-D0XBZaDn.js} +1 -1
  68. package/dist/packem_shared/{recording-client-CKn4-vUx.js → recording-client-BPY8sYUl.js} +1 -1
  69. package/dist/packem_shared/{reference-view-CUIDzLf0.js → reference-view-DhxnzBtf.js} +1 -1
  70. package/dist/packem_shared/{result-chart-Ca3YLzt8.js → result-chart-Q-gVLi4_.js} +1 -1
  71. package/dist/packem_shared/{schema-diagram-DHD13TjS.js → schema-diagram-CPcjPZj3.js} +1 -1
  72. package/dist/packem_shared/{studio-B3eEcBK0.js → studio-BFvT56qK.js} +1 -1
  73. package/dist/packem_shared/{table-list-sidebar-Bluzd1_2.js → table-list-sidebar-BCxqrZ0s.js} +1 -1
  74. package/dist/packem_shared/{use-admin-query-P0RJrjsD.js → use-admin-query-DV9xmFl8.js} +1 -1
  75. package/dist/packem_shared/{use-async-submit-DdLd0MdK.js → use-async-submit-C9xXjXWX.js} +1 -1
  76. package/dist/packem_shared/{use-auth-config-z3KRWAqD.js → use-auth-config-DIAyVsa3.js} +1 -1
  77. package/dist/packem_shared/{use-open-trace-4tIa0SXZ.js → use-open-trace-IfIlKEWd.js} +1 -1
  78. package/dist/packem_shared/{use-sql-assistant-CP90nLLh.js → use-sql-assistant-DFO2i-n-.js} +1 -1
  79. package/dist/standalone/chunk-22WJHOC4.js +11 -0
  80. package/dist/standalone/{chunk-ZN6KUP3O.js → chunk-2CHFHPR3.js} +1 -1
  81. package/dist/standalone/{chunk-OG57FC7W.js → chunk-2EJQ7SPV.js} +1 -1
  82. package/dist/standalone/{chunk-FSWPREH3.js → chunk-2Q7HAFRK.js} +1 -1
  83. package/dist/standalone/{chunk-44WNSIGQ.js → chunk-2UIT2HC2.js} +1 -1
  84. package/dist/standalone/{chunk-YUWMB6EV.js → chunk-2UWKGSEA.js} +1 -1
  85. package/dist/standalone/{chunk-ZQLIKKIY.js → chunk-3IXTF53Q.js} +1 -1
  86. package/dist/standalone/{chunk-J6MNOKO5.js → chunk-44FJEOAY.js} +1 -1
  87. package/dist/standalone/{chunk-26VREVWU.js → chunk-5XMZP64Z.js} +1 -1
  88. package/dist/standalone/{chunk-45YWYMD5.js → chunk-6MRGARL5.js} +1 -1
  89. package/dist/standalone/{chunk-3F5I435D.js → chunk-6UOC4ZJL.js} +1 -1
  90. package/dist/standalone/{chunk-FBAZHG35.js → chunk-6ZSAMAYN.js} +1 -1
  91. package/dist/standalone/{chunk-BORG7WUC.js → chunk-7IQT5M4O.js} +1 -1
  92. package/dist/standalone/{chunk-KQIHXYE6.js → chunk-7TFEJVX4.js} +1 -1
  93. package/dist/standalone/{chunk-3QB5JI32.js → chunk-7W6TQTW7.js} +1 -1
  94. package/dist/standalone/{chunk-4MAJFNON.js → chunk-A7WKYEQ4.js} +1 -1
  95. package/dist/standalone/chunk-AG265V66.js +1 -0
  96. package/dist/standalone/{chunk-6SAAMM4S.js → chunk-BE76GAFE.js} +1 -1
  97. package/dist/standalone/{chunk-6ZPTNC34.js → chunk-BKM6PMSO.js} +1 -1
  98. package/dist/standalone/{chunk-D7DUQS2Y.js → chunk-CE7WVPLK.js} +1 -1
  99. package/dist/standalone/{chunk-MSFUDXBA.js → chunk-D4HJ2VM2.js} +1 -1
  100. package/dist/standalone/{chunk-FLCK2WWQ.js → chunk-DC5AAWSA.js} +1 -1
  101. package/dist/standalone/{chunk-6NJAHOGO.js → chunk-DEGERMXH.js} +1 -1
  102. package/dist/standalone/{chunk-JURAVSE7.js → chunk-E6P2ERQV.js} +1 -1
  103. package/dist/standalone/{chunk-TLPWZ5NI.js → chunk-EQSVW6LZ.js} +1 -1
  104. package/dist/standalone/{chunk-T2LDA6WP.js → chunk-FCEPVFIJ.js} +1 -1
  105. package/dist/standalone/chunk-FEEZPSMA.js +1 -0
  106. package/dist/standalone/{chunk-25OIGX2A.js → chunk-FEW2WNS7.js} +1 -1
  107. package/dist/standalone/{chunk-KFZ37KQP.js → chunk-FRSTZO5P.js} +1 -1
  108. package/dist/standalone/{chunk-X6Q5DWLZ.js → chunk-GKHUQDVI.js} +1 -1
  109. package/dist/standalone/{chunk-SL5R7WBN.js → chunk-H2WBIULE.js} +1 -1
  110. package/dist/standalone/{chunk-WIG3HCUJ.js → chunk-H3M57MCN.js} +1 -1
  111. package/dist/standalone/{chunk-UIF57LBO.js → chunk-H4SLAZAN.js} +1 -1
  112. package/dist/standalone/{chunk-6FWN26RH.js → chunk-HLEXBOCL.js} +1 -1
  113. package/dist/standalone/{chunk-QZ55OWAB.js → chunk-HLHO5AHK.js} +1 -1
  114. package/dist/standalone/{chunk-MOUI44OT.js → chunk-INLHZKCS.js} +1 -1
  115. package/dist/standalone/{chunk-L7CJ5PGH.js → chunk-JACBQWRB.js} +1 -1
  116. package/dist/standalone/{chunk-YS7HEZC2.js → chunk-KEMHRM53.js} +1 -1
  117. package/dist/standalone/{chunk-GIRZD3UB.js → chunk-KOH52XKG.js} +1 -1
  118. package/dist/standalone/{chunk-C5E5PLJT.js → chunk-LDVDE3LE.js} +1 -1
  119. package/dist/standalone/{chunk-3RYEUXY2.js → chunk-LFEDP3Y6.js} +1 -1
  120. package/dist/standalone/{chunk-V6QPVFDL.js → chunk-MG7VPUFA.js} +1 -1
  121. package/dist/standalone/{chunk-OE4KGVJW.js → chunk-MLYZZD5C.js} +1 -1
  122. package/dist/standalone/{chunk-WHRG6S5P.js → chunk-NSR345ID.js} +1 -1
  123. package/dist/standalone/{chunk-IWNVQHF7.js → chunk-OAXOITHK.js} +1 -1
  124. package/dist/standalone/chunk-OQS4HFKC.js +1 -0
  125. package/dist/standalone/{chunk-XGIG4EDG.js → chunk-OTZRXUHF.js} +1 -1
  126. package/dist/standalone/{chunk-PJDKRUWT.js → chunk-PNLUMMXO.js} +1 -1
  127. package/dist/standalone/{chunk-AOE75NAT.js → chunk-Q2G22JHG.js} +1 -1
  128. package/dist/standalone/{chunk-BELLXCN7.js → chunk-RUIWLLAI.js} +1 -1
  129. package/dist/standalone/{chunk-S77D4SHR.js → chunk-RVQRXKRJ.js} +1 -1
  130. package/dist/standalone/{chunk-JVAYDDMK.js → chunk-SCXAZ74Y.js} +1 -1
  131. package/dist/standalone/{chunk-2DC6F7NH.js → chunk-SLOB2B2T.js} +1 -1
  132. package/dist/standalone/{chunk-LT4XQDD2.js → chunk-SM764GPA.js} +1 -1
  133. package/dist/standalone/{chunk-5T7KRUPX.js → chunk-U2KBAKZ6.js} +1 -1
  134. package/dist/standalone/chunk-U7J3LXJ4.js +6 -0
  135. package/dist/standalone/{chunk-KEKIGANB.js → chunk-UCA5MYCL.js} +1 -1
  136. package/dist/standalone/{chunk-GPP4VSUO.js → chunk-UJXKS27L.js} +1 -1
  137. package/dist/standalone/{chunk-C7E4I7JZ.js → chunk-UKIDHICQ.js} +1 -1
  138. package/dist/standalone/{chunk-5NRQIDQA.js → chunk-V2KCESII.js} +1 -1
  139. package/dist/standalone/{chunk-OOBJFXYB.js → chunk-W5CYX66B.js} +1 -1
  140. package/dist/standalone/{chunk-2BDM6HNL.js → chunk-WSNFV7ZW.js} +1 -1
  141. package/dist/standalone/{chunk-OLQWBGKT.js → chunk-YYFHDYYT.js} +1 -1
  142. package/dist/standalone/{chunk-PHHMPYEP.js → chunk-ZHDCWHRT.js} +1 -1
  143. package/dist/standalone/{chunk-CEPMQS24.js → chunk-ZIHYXKQJ.js} +1 -1
  144. package/dist/standalone/{chunk-DL3UOEWN.js → chunk-ZIYO55T2.js} +1 -1
  145. package/dist/standalone/{chunk-6JGXSMKV.js → chunk-ZNNKKJRT.js} +1 -1
  146. package/dist/standalone/studio.js +1 -1
  147. package/package.json +5 -5
  148. package/dist/packem_shared/Studio-CHmLCjBR.js +0 -1
  149. package/dist/standalone/chunk-GZMBMNL3.js +0 -6
  150. package/dist/standalone/chunk-RBUVNO22.js +0 -1
  151. package/dist/standalone/chunk-SMKRXJUC.js +0 -1
  152. package/dist/standalone/chunk-T6HLABZW.js +0 -1
  153. package/dist/standalone/chunk-TBXK3FKP.js +0 -11
@@ -1 +1 @@
1
- import{c as I}from"react/compiler-runtime";import{useLunora as $}from"@lunora/react";import{useState as w,useEffect as H}from"react";import{ConfirmButton as M}from"./ConfirmButton-Cj2SOapE.js";import{C as P,a as Q}from"./card-BGlQzQY-.js";import{E as R}from"./empty-state-B939z6K2.js";import{T as q,a as D,b as J,c as l,d as K,e as i}from"./table-BMsuYFhk.js";import{b as V}from"./use-admin-query-P0RJrjsD.js";import{useAutoRefresh as W}from"./DEFAULT_AUTO_REFRESH_MS-DuULO4XM.js";import{useT as z}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{f as G,i as O,b as U}from"./internal-CwaF9YNk.js";import{jsx as t,jsxs as p}from"react/jsx-runtime";const X=s=>Number.isFinite(s)?O(s,"—"):"—",j=s=>s.toSorted((e,u)=>e.scheduledFor-u.scheduledFor),Y=(s,e,u)=>e!==void 0?e:u===void 0?f=>s.cancelScheduledJob(f):void 0,he=s=>{const e=I(16),{cancelJob:u,loadJobs:f}=s===void 0?{}:s,n=$(),o=z(),c=f===void 0;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=["lunora-scheduled-jobs"],e[0]=b):b=e[0];const d=V(b,async()=>{const r=await(f??(()=>n.listScheduledJobs()))();return j(r)}),[F,L]=w(void 0),[A,S]=w(void 0);let v,x;e[1]!==n||e[2]!==c?(v=()=>{if(c)return n.subscribeScheduledJobs(r=>{S(void 0),L(j(r))})},x=[c,n],e[1]=n,e[2]=c,e[3]=v,e[4]=x):(v=e[3],x=e[4]),H(v,x);let y;e[5]!==d?(y=()=>{d.refetch()},e[5]=d,e[6]=y):y=e[6],W(y,!c);const C=Y(n,u,f),a=F??d.data,N=A??d.error,E=async r=>{if(C!==void 0){S(void 0);try{await C(r),c||d.refetch()}catch(_){S(U(_))}}},k="flex flex-col gap-3",B="lunora-scheduled-jobs";let m;e[7]!==N?(m=N!==null&&t("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:N}),e[7]=N,e[8]=m):m=e[8];let h;e[9]!==a?.length||e[10]!==o?(h=a?.length===0&&t(R,{description:o("Jobs queued with runAfter / runAt will appear here."),icon:p("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[t("circle",{cx:"12",cy:"12",r:"9"}),t("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:o("No scheduled jobs.")}),e[9]=a?.length,e[10]=o,e[11]=h):h=e[11];const T=a!==void 0&&a.length>0&&t(P,{className:"overflow-hidden py-0",children:t(Q,{className:"px-0",children:p(q,{"data-testid":"sj-table",children:[t(D,{children:p(J,{children:[t(l,{children:o("function")}),t(l,{children:o("scheduled for")}),t(l,{children:o("pool")}),t(l,{children:o("attempts")}),t(l,{children:o("shard")}),t(l,{children:o("id")}),C!==void 0&&t(l,{"aria-label":o("Actions")})]})}),t(K,{children:a.map(r=>p(J,{"data-testid":`sj-row-${r.id}`,children:[t(i,{className:"font-mono text-xs",children:r.functionPath}),t(i,{className:"text-muted-foreground tabular-nums",children:X(r.scheduledFor)}),t(i,{className:"font-mono text-xs",children:r.pool??""}),t(i,{className:"tabular-nums",children:r.attempts??0}),t(i,{children:r.shardKey??""}),t(i,{className:"font-mono text-xs",children:r.id}),C!==void 0&&t(i,{className:"text-right",children:t(M,{confirmLabel:o("Cancel job?"),onConfirm:()=>{G(E(r.id))},testId:`sj-cancel-${r.id}`,children:o("Cancel")})})]},r.id))})]})})});let g;return e[12]!==T||e[13]!==m||e[14]!==h?(g=p("div",{className:k,"data-testid":B,children:[m,h,T]}),e[12]=T,e[13]=m,e[14]=h,e[15]=g):g=e[15],g};export{he as ScheduledJobs};
1
+ import{c as I}from"react/compiler-runtime";import{useLunora as $}from"@lunora/react";import{useState as w,useEffect as H}from"react";import{ConfirmButton as M}from"./ConfirmButton-Cj2SOapE.js";import{C as P,a as Q}from"./card-BGlQzQY-.js";import{E as R}from"./empty-state-B939z6K2.js";import{T as q,a as D,b as J,c as l,d as K,e as i}from"./table-BMsuYFhk.js";import{b as V}from"./use-admin-query-DV9xmFl8.js";import{useAutoRefresh as W}from"./DEFAULT_AUTO_REFRESH_MS-DuULO4XM.js";import{useT as z}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{f as G,i as O,b as U}from"./internal-7bgd8inO.js";import{jsx as t,jsxs as p}from"react/jsx-runtime";const X=s=>Number.isFinite(s)?O(s,"—"):"—",j=s=>s.toSorted((e,u)=>e.scheduledFor-u.scheduledFor),Y=(s,e,u)=>e!==void 0?e:u===void 0?f=>s.cancelScheduledJob(f):void 0,he=s=>{const e=I(16),{cancelJob:u,loadJobs:f}=s===void 0?{}:s,n=$(),o=z(),c=f===void 0;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=["lunora-scheduled-jobs"],e[0]=b):b=e[0];const d=V(b,async()=>{const r=await(f??(()=>n.listScheduledJobs()))();return j(r)}),[F,L]=w(void 0),[A,S]=w(void 0);let v,x;e[1]!==n||e[2]!==c?(v=()=>{if(c)return n.subscribeScheduledJobs(r=>{S(void 0),L(j(r))})},x=[c,n],e[1]=n,e[2]=c,e[3]=v,e[4]=x):(v=e[3],x=e[4]),H(v,x);let y;e[5]!==d?(y=()=>{d.refetch()},e[5]=d,e[6]=y):y=e[6],W(y,!c);const C=Y(n,u,f),a=F??d.data,N=A??d.error,E=async r=>{if(C!==void 0){S(void 0);try{await C(r),c||d.refetch()}catch(_){S(U(_))}}},k="flex flex-col gap-3",B="lunora-scheduled-jobs";let m;e[7]!==N?(m=N!==null&&t("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:N}),e[7]=N,e[8]=m):m=e[8];let h;e[9]!==a?.length||e[10]!==o?(h=a?.length===0&&t(R,{description:o("Jobs queued with runAfter / runAt will appear here."),icon:p("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[t("circle",{cx:"12",cy:"12",r:"9"}),t("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:o("No scheduled jobs.")}),e[9]=a?.length,e[10]=o,e[11]=h):h=e[11];const T=a!==void 0&&a.length>0&&t(P,{className:"overflow-hidden py-0",children:t(Q,{className:"px-0",children:p(q,{"data-testid":"sj-table",children:[t(D,{children:p(J,{children:[t(l,{children:o("function")}),t(l,{children:o("scheduled for")}),t(l,{children:o("pool")}),t(l,{children:o("attempts")}),t(l,{children:o("shard")}),t(l,{children:o("id")}),C!==void 0&&t(l,{"aria-label":o("Actions")})]})}),t(K,{children:a.map(r=>p(J,{"data-testid":`sj-row-${r.id}`,children:[t(i,{className:"font-mono text-xs",children:r.functionPath}),t(i,{className:"text-muted-foreground tabular-nums",children:X(r.scheduledFor)}),t(i,{className:"font-mono text-xs",children:r.pool??""}),t(i,{className:"tabular-nums",children:r.attempts??0}),t(i,{children:r.shardKey??""}),t(i,{className:"font-mono text-xs",children:r.id}),C!==void 0&&t(i,{className:"text-right",children:t(M,{confirmLabel:o("Cancel job?"),onConfirm:()=>{G(E(r.id))},testId:`sj-cancel-${r.id}`,children:o("Cancel")})})]},r.id))})]})})});let g;return e[12]!==T||e[13]!==m||e[14]!==h?(g=p("div",{className:k,"data-testid":B,children:[m,h,T]}),e[12]=T,e[13]=m,e[14]=h,e[15]=g):g=e[15],g};export{he as ScheduledJobs};
@@ -0,0 +1 @@
1
+ import{S as b}from"./studio-BFvT56qK.js";import"./ErrorBoundary-BWNF98VF.js";import"./operation-console-provider-DoloEvon.js";import"./badge-cAk9Di1Q.js";import"./input-CY5W3wzv.js";import"./skeleton-DFBBaJU6.js";import"./home-panel-DywiFhDs.js";import"./DEFAULT_LOCALE-A1Yg5ORA.js";import"./StudioI18nProvider-Bl547evf.js";import"./data-view-params-qoSTqjAj.js";import"./internal-7bgd8inO.js";import"./utils-bhneXptQ.js";import"./CommandPalette-BAiOc1hT.js";export{b as Studio};
@@ -1 +1 @@
1
- import{c as O}from"react/compiler-runtime";import{LunoraClient as G}from"@lunora/client";import{LunoraProvider as H}from"@lunora/react";import{useState as B,useEffect as R}from"react";import{ErrorBoundary as z}from"./ErrorBoundary-BWNF98VF.js";import{u as U,B as V,T as Y,a as q,S as J}from"./studio-B3eEcBK0.js";import Q from"./useDebounced-DVeQ5-oW.js";import{useT as j,createStudioI18n as X}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{StudioI18nProvider as D}from"./StudioI18nProvider-Bl547evf.js";import{r as Z}from"./internal-CwaF9YNk.js";import{w as $}from"./recording-client-CKn4-vUx.js";import F from"./STUDIO_ROOT_CLASS-C6MccdVk.js";import{a as K}from"./browser-storage-Br_bLeBt.js";import{c as W}from"./utils-bhneXptQ.js";import{B as ee}from"./button-BOPLD1un.js";import{I as te}from"./input-CY5W3wzv.js";import{jsx as g,jsxs as L}from"react/jsx-runtime";const P="lunora-studio-admin-token",oe=()=>{try{return K("session")?.getItem(P)??""}catch{return""}},ne=b=>{const e=K("session");if(e!==void 0)try{b===""?e.removeItem(P):e.setItem(P,b)}catch{}},se="/_lunora/admin/ws-token",ie=1e4,le=b=>{const e=b;return typeof e?.token=="string"&&e.token.length>0&&typeof e.expiresAtMs=="number"},re=b=>{const{adminToken:e,baseUrl:d}=b,o=b.fetchImpl??fetch;let n=d;for(;n.endsWith("/");)n=n.slice(0,-1);const r=`${n}${se}`;let t,s=!1,i;const f=async()=>{const u=await o(r,{headers:{authorization:`Bearer ${e}`},method:"POST"});if(u.status===404||u.status===405)return s=!0,e;if(!u.ok)throw new Error(`ws-token mint failed: ${String(u.status)}`);const l=await u.json().catch(()=>{});if(!le(l))throw new Error("ws-token mint failed: malformed response body");return t=l,l.token};return{getToken:async()=>s?e:t!==void 0&&t.expiresAtMs-ie>Date.now()?t.token:(i??=f().finally(()=>{i=void 0}),i),invalidate:()=>{t=void 0}}},ae=b=>{const e=O(42),{onSubmit:d}=b,o=j(),[n,r]=B("");let t;e[0]!==n?(t=n.trim(),e[0]=n,e[1]=t):t=e[1];const s=t;let i;e[2]!==d||e[3]!==s?(i=_=>{_.preventDefault(),s!==""&&d(s)},e[2]=d,e[3]=s,e[4]=i):i=e[4];const f=i;let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=g("div",{className:"h-10 w-10 text-foreground",children:g(V,{})}),e[5]=u):u=e[5];let l;e[6]!==o?(l=o("Connect to Lunora Studio"),e[6]=o,e[7]=l):l=e[7];let v;e[8]!==l?(v=g("h1",{className:"text-base font-semibold text-foreground",children:l}),e[8]=l,e[9]=v):v=e[9];let k;e[10]!==o?(k=o("Enter your admin token to access the studio."),e[10]=o,e[11]=k):k=e[11];let m;e[12]!==k?(m=g("p",{className:"text-[13px] text-muted-foreground",children:k}),e[12]=k,e[13]=m):m=e[13];let c;e[14]!==v||e[15]!==m?(c=L("div",{className:"flex flex-col items-center gap-3 text-center",children:[u,L("div",{className:"flex flex-col gap-1",children:[v,m]})]}),e[14]=v,e[15]=m,e[16]=c):c=e[16];let h;e[17]!==o?(h=o("admin token"),e[17]=o,e[18]=h):h=e[18];let a;e[19]!==h?(a=g("label",{className:"text-xs font-medium text-foreground",htmlFor:"lunora-studio-login-token",children:h}),e[19]=h,e[20]=a):a=e[20];let p;e[21]===Symbol.for("react.memo_cache_sentinel")?(p=_=>{r(_.target.value)},e[21]=p):p=e[21];let S;e[22]!==n?(S=g(te,{autoComplete:"off",autoFocus:!0,"data-testid":"lunora-studio-login-token",id:"lunora-studio-login-token",onChange:p,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:n}),e[22]=n,e[23]=S):S=e[23];let x;e[24]!==o?(x=o("From your worker's LUNORA_ADMIN_TOKEN — your project's .dev.vars in dev, or a deployment secret in production."),e[24]=o,e[25]=x):x=e[25];let A;e[26]!==x?(A=g("p",{className:"text-[11px] text-muted-foreground",children:x}),e[26]=x,e[27]=A):A=e[27];let T;e[28]!==a||e[29]!==S||e[30]!==A?(T=L("div",{className:"flex flex-col gap-1.5",children:[a,S,A]}),e[28]=a,e[29]=S,e[30]=A,e[31]=T):T=e[31];const E=s==="";let y;e[32]!==o?(y=o("Connect"),e[32]=o,e[33]=y):y=e[33];let w;e[34]!==E||e[35]!==y?(w=g(ee,{"data-testid":"lunora-studio-login-submit",disabled:E,type:"submit",children:y}),e[34]=E,e[35]=y,e[36]=w):w=e[36];let N;return e[37]!==f||e[38]!==T||e[39]!==w||e[40]!==c?(N=L("form",{className:"flex w-full max-w-sm flex-col gap-5 rounded-xl border border-border bg-card p-7 shadow-lg","data-testid":"lunora-studio-login",onSubmit:f,children:[c,T,w]}),e[37]=f,e[38]=T,e[39]=w,e[40]=c,e[41]=N):N=e[41],N},ce=b=>{const e=O(10),{i18n:d,onSubmit:o}=b,{resolvedTheme:n}=U(),r=n==="dark"&&"dark";let t;e[0]!==r?(t=W(F,r,"flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground"),e[0]=r,e[1]=t):t=e[1];let s;e[2]!==o?(s=g(ae,{onSubmit:o}),e[2]=o,e[3]=s):s=e[3];let i;e[4]!==d||e[5]!==s?(i=g(D,{i18n:d,children:s}),e[4]=d,e[5]=s,e[6]=i):i=e[6];let f;return e[7]!==t||e[8]!==i?(f=g("div",{className:t,"data-testid":"lunora-studio-login-root",children:i}),e[7]=t,e[8]=i,e[9]=f):f=e[9],f},de=b=>{const e=O(23),{basePath:d,chrome:o,studio:n}=b,r=j();let t;e[0]!==r?(t=r("Studio failed"),e[0]=r,e[1]=t):t=e[1];let s;e[2]!==r?(s=r("Studio"),e[2]=r,e[3]=s):s=e[3];let i;e[4]!==r?(i=r("Try again"),e[4]=r,e[5]=i):i=e[5];const f=n?.dataEditable,u=n?.functions,l=n?.initialShardKey,v=n?.openApiSpec,k=n?.openRpcSpec,m=n?.runAsIdentity,c=n?.scheduledCancel,h=n?.scheduledLoad,a=n?.schemaEditable;let p;e[6]!==d||e[7]!==o||e[8]!==c||e[9]!==h||e[10]!==a||e[11]!==f||e[12]!==u||e[13]!==l||e[14]!==v||e[15]!==k||e[16]!==m?(p=g(J,{basePath:d,chrome:o,dataEditable:f,functions:u,initialShardKey:l,openApiSpec:v,openRpcSpec:k,runAsIdentity:m,scheduledCancel:c,scheduledLoad:h,schemaEditable:a}),e[6]=d,e[7]=o,e[8]=c,e[9]=h,e[10]=a,e[11]=f,e[12]=u,e[13]=l,e[14]=v,e[15]=k,e[16]=m,e[17]=p):p=e[17];let S;return e[18]!==t||e[19]!==p||e[20]!==s||e[21]!==i?(S=g(z,{fallbackTitle:t,label:s,retryLabel:i,children:p}),e[18]=t,e[19]=p,e[20]=s,e[21]=i,e[22]=S):S=e[22],S},fe=b=>{const e=O(20),{basePath:d,clearToken:o,client:n,i18n:r,onTokenChange:t,rulesInstalled:s,studio:i,token:f}=b,{resolvedTheme:u}=U();let l;e[0]!==o||e[1]!==t||e[2]!==s||e[3]!==f?(l={clearToken:o,onTokenChange:t,rulesInstalled:s,token:f},e[0]=o,e[1]=t,e[2]=s,e[3]=f,e[4]=l):l=e[4];const v=l,k=u==="dark"&&"dark";let m;e[5]!==k?(m=W(F,k,"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground"),e[5]=k,e[6]=m):m=e[6];let c;e[7]!==d||e[8]!==v||e[9]!==i?(c=g(q,{children:g(de,{basePath:d,chrome:v,studio:i})}),e[7]=d,e[8]=v,e[9]=i,e[10]=c):c=e[10];let h;e[11]!==r||e[12]!==c?(h=g(D,{i18n:r,children:c}),e[11]=r,e[12]=c,e[13]=h):h=e[13];let a;e[14]!==n||e[15]!==h?(a=g(H,{client:n,children:h}),e[14]=n,e[15]=h,e[16]=a):a=e[16];let p;return e[17]!==m||e[18]!==a?(p=g("div",{className:m,"data-testid":"lunora-studio-app",children:a}),e[17]=m,e[18]=a,e[19]=p):p=e[19],p},Ee=b=>{const e=O(27);let d;e[0]!==b?(d=b===void 0?{}:b,e[0]=b,e[1]=d):d=e[1];const{adminToken:o,basePath:n,baseUrl:r,client:t,rulesInstalled:s,studio:i,locale:f}=d;let u;e[2]!==o?(u=()=>o??oe(),e[2]=o,e[3]=u):u=e[3];const[l,v]=B(u);let k,m;e[4]!==l?(k=()=>{ne(l)},m=[l],e[4]=l,e[5]=k,e[6]=m):(k=e[5],m=e[6]),R(k,m);const c=Q(l,300);let h;e:{if(t!==void 0){let I;e[7]!==t?(I=$(t),e[7]=t,e[8]=I):I=e[8],h=I;break e}let _;if(e[9]!==r||e[10]!==c){const I=Z(r),C=c===""?void 0:re({adminToken:c,baseUrl:I}),M=new G({url:I,...C===void 0?{}:{wsToken:C.getToken}});C!==void 0&&(M.setAuthToken(c),M.onTokenExpired(C.invalidate)),_=$(M),e[9]=r,e[10]=c,e[11]=_}else _=e[11];h=_}const a=h;let p,S;e[12]!==a||e[13]!==t?(p=()=>()=>{t===void 0&&a.close()},S=[a,t],e[12]=a,e[13]=t,e[14]=p,e[15]=S):(p=e[14],S=e[15]),R(p,S);let x;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=_=>{v(_.target.value)},e[16]=x):x=e[16];const A=x;let T;e[17]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{v("")},e[17]=T):T=e[17];const E=T;let y;e[18]!==f?(y=X(f),e[18]=f,e[19]=y):y=e[19];const w=y;let N;return e[20]!==n||e[21]!==a||e[22]!==w||e[23]!==s||e[24]!==i||e[25]!==l?(N=g(Y,{children:l===""?g(ce,{i18n:w,onSubmit:v}):g(fe,{basePath:n,clearToken:E,client:a,i18n:w,onTokenChange:A,rulesInstalled:s,studio:i,token:l})}),e[20]=n,e[21]=a,e[22]=w,e[23]=s,e[24]=i,e[25]=l,e[26]=N):N=e[26],N};export{Ee as StudioApp};
1
+ import{c as O}from"react/compiler-runtime";import{LunoraClient as G}from"@lunora/client";import{LunoraProvider as H}from"@lunora/react";import{useState as B,useEffect as R}from"react";import{ErrorBoundary as z}from"./ErrorBoundary-BWNF98VF.js";import{u as U,B as V,T as Y,a as q,S as J}from"./studio-BFvT56qK.js";import Q from"./useDebounced-DVeQ5-oW.js";import{useT as j,createStudioI18n as X}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{StudioI18nProvider as D}from"./StudioI18nProvider-Bl547evf.js";import{r as Z}from"./internal-7bgd8inO.js";import{w as $}from"./recording-client-BPY8sYUl.js";import F from"./STUDIO_ROOT_CLASS-C6MccdVk.js";import{a as K}from"./browser-storage-Br_bLeBt.js";import{c as W}from"./utils-bhneXptQ.js";import{B as ee}from"./button-BOPLD1un.js";import{I as te}from"./input-CY5W3wzv.js";import{jsx as g,jsxs as L}from"react/jsx-runtime";const P="lunora-studio-admin-token",oe=()=>{try{return K("session")?.getItem(P)??""}catch{return""}},ne=b=>{const e=K("session");if(e!==void 0)try{b===""?e.removeItem(P):e.setItem(P,b)}catch{}},se="/_lunora/admin/ws-token",ie=1e4,le=b=>{const e=b;return typeof e?.token=="string"&&e.token.length>0&&typeof e.expiresAtMs=="number"},re=b=>{const{adminToken:e,baseUrl:d}=b,o=b.fetchImpl??fetch;let n=d;for(;n.endsWith("/");)n=n.slice(0,-1);const r=`${n}${se}`;let t,s=!1,i;const f=async()=>{const u=await o(r,{headers:{authorization:`Bearer ${e}`},method:"POST"});if(u.status===404||u.status===405)return s=!0,e;if(!u.ok)throw new Error(`ws-token mint failed: ${String(u.status)}`);const l=await u.json().catch(()=>{});if(!le(l))throw new Error("ws-token mint failed: malformed response body");return t=l,l.token};return{getToken:async()=>s?e:t!==void 0&&t.expiresAtMs-ie>Date.now()?t.token:(i??=f().finally(()=>{i=void 0}),i),invalidate:()=>{t=void 0}}},ae=b=>{const e=O(42),{onSubmit:d}=b,o=j(),[n,r]=B("");let t;e[0]!==n?(t=n.trim(),e[0]=n,e[1]=t):t=e[1];const s=t;let i;e[2]!==d||e[3]!==s?(i=_=>{_.preventDefault(),s!==""&&d(s)},e[2]=d,e[3]=s,e[4]=i):i=e[4];const f=i;let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=g("div",{className:"h-10 w-10 text-foreground",children:g(V,{})}),e[5]=u):u=e[5];let l;e[6]!==o?(l=o("Connect to Lunora Studio"),e[6]=o,e[7]=l):l=e[7];let v;e[8]!==l?(v=g("h1",{className:"text-base font-semibold text-foreground",children:l}),e[8]=l,e[9]=v):v=e[9];let k;e[10]!==o?(k=o("Enter your admin token to access the studio."),e[10]=o,e[11]=k):k=e[11];let m;e[12]!==k?(m=g("p",{className:"text-[13px] text-muted-foreground",children:k}),e[12]=k,e[13]=m):m=e[13];let c;e[14]!==v||e[15]!==m?(c=L("div",{className:"flex flex-col items-center gap-3 text-center",children:[u,L("div",{className:"flex flex-col gap-1",children:[v,m]})]}),e[14]=v,e[15]=m,e[16]=c):c=e[16];let h;e[17]!==o?(h=o("admin token"),e[17]=o,e[18]=h):h=e[18];let a;e[19]!==h?(a=g("label",{className:"text-xs font-medium text-foreground",htmlFor:"lunora-studio-login-token",children:h}),e[19]=h,e[20]=a):a=e[20];let p;e[21]===Symbol.for("react.memo_cache_sentinel")?(p=_=>{r(_.target.value)},e[21]=p):p=e[21];let S;e[22]!==n?(S=g(te,{autoComplete:"off",autoFocus:!0,"data-testid":"lunora-studio-login-token",id:"lunora-studio-login-token",onChange:p,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:n}),e[22]=n,e[23]=S):S=e[23];let x;e[24]!==o?(x=o("From your worker's LUNORA_ADMIN_TOKEN — your project's .dev.vars in dev, or a deployment secret in production."),e[24]=o,e[25]=x):x=e[25];let A;e[26]!==x?(A=g("p",{className:"text-[11px] text-muted-foreground",children:x}),e[26]=x,e[27]=A):A=e[27];let T;e[28]!==a||e[29]!==S||e[30]!==A?(T=L("div",{className:"flex flex-col gap-1.5",children:[a,S,A]}),e[28]=a,e[29]=S,e[30]=A,e[31]=T):T=e[31];const E=s==="";let y;e[32]!==o?(y=o("Connect"),e[32]=o,e[33]=y):y=e[33];let w;e[34]!==E||e[35]!==y?(w=g(ee,{"data-testid":"lunora-studio-login-submit",disabled:E,type:"submit",children:y}),e[34]=E,e[35]=y,e[36]=w):w=e[36];let N;return e[37]!==f||e[38]!==T||e[39]!==w||e[40]!==c?(N=L("form",{className:"flex w-full max-w-sm flex-col gap-5 rounded-xl border border-border bg-card p-7 shadow-lg","data-testid":"lunora-studio-login",onSubmit:f,children:[c,T,w]}),e[37]=f,e[38]=T,e[39]=w,e[40]=c,e[41]=N):N=e[41],N},ce=b=>{const e=O(10),{i18n:d,onSubmit:o}=b,{resolvedTheme:n}=U(),r=n==="dark"&&"dark";let t;e[0]!==r?(t=W(F,r,"flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground"),e[0]=r,e[1]=t):t=e[1];let s;e[2]!==o?(s=g(ae,{onSubmit:o}),e[2]=o,e[3]=s):s=e[3];let i;e[4]!==d||e[5]!==s?(i=g(D,{i18n:d,children:s}),e[4]=d,e[5]=s,e[6]=i):i=e[6];let f;return e[7]!==t||e[8]!==i?(f=g("div",{className:t,"data-testid":"lunora-studio-login-root",children:i}),e[7]=t,e[8]=i,e[9]=f):f=e[9],f},de=b=>{const e=O(23),{basePath:d,chrome:o,studio:n}=b,r=j();let t;e[0]!==r?(t=r("Studio failed"),e[0]=r,e[1]=t):t=e[1];let s;e[2]!==r?(s=r("Studio"),e[2]=r,e[3]=s):s=e[3];let i;e[4]!==r?(i=r("Try again"),e[4]=r,e[5]=i):i=e[5];const f=n?.dataEditable,u=n?.functions,l=n?.initialShardKey,v=n?.openApiSpec,k=n?.openRpcSpec,m=n?.runAsIdentity,c=n?.scheduledCancel,h=n?.scheduledLoad,a=n?.schemaEditable;let p;e[6]!==d||e[7]!==o||e[8]!==c||e[9]!==h||e[10]!==a||e[11]!==f||e[12]!==u||e[13]!==l||e[14]!==v||e[15]!==k||e[16]!==m?(p=g(J,{basePath:d,chrome:o,dataEditable:f,functions:u,initialShardKey:l,openApiSpec:v,openRpcSpec:k,runAsIdentity:m,scheduledCancel:c,scheduledLoad:h,schemaEditable:a}),e[6]=d,e[7]=o,e[8]=c,e[9]=h,e[10]=a,e[11]=f,e[12]=u,e[13]=l,e[14]=v,e[15]=k,e[16]=m,e[17]=p):p=e[17];let S;return e[18]!==t||e[19]!==p||e[20]!==s||e[21]!==i?(S=g(z,{fallbackTitle:t,label:s,retryLabel:i,children:p}),e[18]=t,e[19]=p,e[20]=s,e[21]=i,e[22]=S):S=e[22],S},fe=b=>{const e=O(20),{basePath:d,clearToken:o,client:n,i18n:r,onTokenChange:t,rulesInstalled:s,studio:i,token:f}=b,{resolvedTheme:u}=U();let l;e[0]!==o||e[1]!==t||e[2]!==s||e[3]!==f?(l={clearToken:o,onTokenChange:t,rulesInstalled:s,token:f},e[0]=o,e[1]=t,e[2]=s,e[3]=f,e[4]=l):l=e[4];const v=l,k=u==="dark"&&"dark";let m;e[5]!==k?(m=W(F,k,"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground"),e[5]=k,e[6]=m):m=e[6];let c;e[7]!==d||e[8]!==v||e[9]!==i?(c=g(q,{children:g(de,{basePath:d,chrome:v,studio:i})}),e[7]=d,e[8]=v,e[9]=i,e[10]=c):c=e[10];let h;e[11]!==r||e[12]!==c?(h=g(D,{i18n:r,children:c}),e[11]=r,e[12]=c,e[13]=h):h=e[13];let a;e[14]!==n||e[15]!==h?(a=g(H,{client:n,children:h}),e[14]=n,e[15]=h,e[16]=a):a=e[16];let p;return e[17]!==m||e[18]!==a?(p=g("div",{className:m,"data-testid":"lunora-studio-app",children:a}),e[17]=m,e[18]=a,e[19]=p):p=e[19],p},Ee=b=>{const e=O(27);let d;e[0]!==b?(d=b===void 0?{}:b,e[0]=b,e[1]=d):d=e[1];const{adminToken:o,basePath:n,baseUrl:r,client:t,rulesInstalled:s,studio:i,locale:f}=d;let u;e[2]!==o?(u=()=>o??oe(),e[2]=o,e[3]=u):u=e[3];const[l,v]=B(u);let k,m;e[4]!==l?(k=()=>{ne(l)},m=[l],e[4]=l,e[5]=k,e[6]=m):(k=e[5],m=e[6]),R(k,m);const c=Q(l,300);let h;e:{if(t!==void 0){let I;e[7]!==t?(I=$(t),e[7]=t,e[8]=I):I=e[8],h=I;break e}let _;if(e[9]!==r||e[10]!==c){const I=Z(r),C=c===""?void 0:re({adminToken:c,baseUrl:I}),M=new G({url:I,...C===void 0?{}:{wsToken:C.getToken}});C!==void 0&&(M.setAuthToken(c),M.onTokenExpired(C.invalidate)),_=$(M),e[9]=r,e[10]=c,e[11]=_}else _=e[11];h=_}const a=h;let p,S;e[12]!==a||e[13]!==t?(p=()=>()=>{t===void 0&&a.close()},S=[a,t],e[12]=a,e[13]=t,e[14]=p,e[15]=S):(p=e[14],S=e[15]),R(p,S);let x;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=_=>{v(_.target.value)},e[16]=x):x=e[16];const A=x;let T;e[17]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{v("")},e[17]=T):T=e[17];const E=T;let y;e[18]!==f?(y=X(f),e[18]=f,e[19]=y):y=e[19];const w=y;let N;return e[20]!==n||e[21]!==a||e[22]!==w||e[23]!==s||e[24]!==i||e[25]!==l?(N=g(Y,{children:l===""?g(ce,{i18n:w,onSubmit:v}):g(fe,{basePath:n,clearToken:E,client:a,i18n:w,onTokenChange:A,rulesInstalled:s,studio:i,token:l})}),e[20]=n,e[21]=a,e[22]=w,e[23]=s,e[24]=i,e[25]=l,e[26]=N):N=e[26],N};export{Ee as StudioApp};
@@ -1 +1 @@
1
- import{useState as g}from"react";import{E as x}from"./error-alert-TYdKetJd.js";import{C as N,a as y}from"./card-BGlQzQY-.js";import{T as v,a as T,b as d,c as m,d as w,e as l}from"./table-BMsuYFhk.js";import{useT as E}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{c as L}from"./utils-bhneXptQ.js";import{jsxs as o,jsx as t}from"react/jsx-runtime";const C={ERROR:"error",INFO:"info",WARN:"warning"},z=e=>{const a=typeof e.metadata.table=="string"?e.metadata.table:void 0;return{description:`${e.detail} ${e.remediation}`,entity:a,issueType:e.title,key:e.cacheKey,level:C[e.level]}},R=["error","warning","info"],A={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},$=(e,a)=>({error:e("Errors"),info:e("Info"),warning:e("Warnings")})[a],k=(e,a,n)=>({error:e("{count} errors",{count:n}),info:e("{count} suggestions",{count:n}),warning:e("{count} warnings",{count:n})})[a],V=(e,a)=>({error:e("No errors detected"),info:e("No suggestions"),warning:e("No warnings detected")})[a],O=e=>{const a={error:0,info:0,warning:0};for(const n of e??[])a[n.level]+=1;return a},F=({error:e=null,errorSource:a,rows:n,testId:i,toolbar:p})=>{const s=E(),[c,f]=g("error"),b=O(n),u=(n??[]).filter(r=>r.level===c),h=r=>{f(r.currentTarget.dataset.level)};return o("div",{className:"flex flex-col gap-3","data-testid":i,children:[t("div",{className:"flex border-b border-border",role:"tablist",children:R.map(r=>o("button",{"aria-selected":c===r,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":r,"data-testid":`${i}-tab-${r}`,onClick:h,role:"tab",type:"button",children:[o("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[t("span",{"aria-hidden":"true",className:L("size-2 rounded-sm",A[r])}),$(s,r)]}),t("span",{className:"ps-4 text-xs text-muted-foreground",children:k(s,r,b[r])})]},r))}),p!==void 0&&t("div",{className:"flex flex-wrap items-center gap-2",children:p}),e!==null&&t(x,{error:a??e,testId:`${i}-error`}),t(N,{className:"overflow-hidden py-0",children:t(y,{className:"px-0",children:o(v,{children:[t(T,{children:o(d,{children:[t(m,{children:s("Issue type")}),t(m,{children:s("Entity/item")}),t(m,{children:s("Description")})]})}),t(w,{children:u.length===0?t(d,{children:o(l,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${i}-empty`,children:[t("span",{className:"block text-sm font-medium text-foreground",children:V(s,c)}),t("span",{className:"block text-sm",children:s("Nothing to report for this deployment.")})]})}):u.map(r=>o(d,{children:[t(l,{className:"font-medium text-foreground",children:r.issueType}),t(l,{className:"font-mono text-xs text-muted-foreground",children:r.entity??"—"}),o(l,{className:"text-muted-foreground",children:[t("span",{children:r.description}),r.action!==void 0&&t("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:r.action})]})]},r.key))})]})})})]})};export{F as A,z as a};
1
+ import{useState as g}from"react";import{E as x}from"./error-alert-CKqB2CiN.js";import{C as N,a as y}from"./card-BGlQzQY-.js";import{T as v,a as T,b as d,c as m,d as w,e as l}from"./table-BMsuYFhk.js";import{useT as E}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{c as L}from"./utils-bhneXptQ.js";import{jsxs as o,jsx as t}from"react/jsx-runtime";const C={ERROR:"error",INFO:"info",WARN:"warning"},z=e=>{const a=typeof e.metadata.table=="string"?e.metadata.table:void 0;return{description:`${e.detail} ${e.remediation}`,entity:a,issueType:e.title,key:e.cacheKey,level:C[e.level]}},R=["error","warning","info"],A={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},$=(e,a)=>({error:e("Errors"),info:e("Info"),warning:e("Warnings")})[a],k=(e,a,n)=>({error:e("{count} errors",{count:n}),info:e("{count} suggestions",{count:n}),warning:e("{count} warnings",{count:n})})[a],V=(e,a)=>({error:e("No errors detected"),info:e("No suggestions"),warning:e("No warnings detected")})[a],O=e=>{const a={error:0,info:0,warning:0};for(const n of e??[])a[n.level]+=1;return a},F=({error:e=null,errorSource:a,rows:n,testId:i,toolbar:p})=>{const s=E(),[c,f]=g("error"),b=O(n),u=(n??[]).filter(r=>r.level===c),h=r=>{f(r.currentTarget.dataset.level)};return o("div",{className:"flex flex-col gap-3","data-testid":i,children:[t("div",{className:"flex border-b border-border",role:"tablist",children:R.map(r=>o("button",{"aria-selected":c===r,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":r,"data-testid":`${i}-tab-${r}`,onClick:h,role:"tab",type:"button",children:[o("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[t("span",{"aria-hidden":"true",className:L("size-2 rounded-sm",A[r])}),$(s,r)]}),t("span",{className:"ps-4 text-xs text-muted-foreground",children:k(s,r,b[r])})]},r))}),p!==void 0&&t("div",{className:"flex flex-wrap items-center gap-2",children:p}),e!==null&&t(x,{error:a??e,testId:`${i}-error`}),t(N,{className:"overflow-hidden py-0",children:t(y,{className:"px-0",children:o(v,{children:[t(T,{children:o(d,{children:[t(m,{children:s("Issue type")}),t(m,{children:s("Entity/item")}),t(m,{children:s("Description")})]})}),t(w,{children:u.length===0?t(d,{children:o(l,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${i}-empty`,children:[t("span",{className:"block text-sm font-medium text-foreground",children:V(s,c)}),t("span",{className:"block text-sm",children:s("Nothing to report for this deployment.")})]})}):u.map(r=>o(d,{children:[t(l,{className:"font-medium text-foreground",children:r.issueType}),t(l,{className:"font-mono text-xs text-muted-foreground",children:r.entity??"—"}),o(l,{className:"text-muted-foreground",children:[t("span",{children:r.description}),r.action!==void 0&&t("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:r.action})]})]},r.key))})]})})})]})};export{F as A,z as a};
@@ -1 +1 @@
1
- import{c as x}from"react/compiler-runtime";import{useT as w}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{h as y}from"./internal-CwaF9YNk.js";import{jsx as i,jsxs as u}from"react/jsx-runtime";const N=(l,e)=>{if(e==="")return[{match:!1,offset:0,text:l}];const a=[],s=l.toLowerCase(),o=e.toLowerCase();let t=0;for(let r=s.indexOf(o);r!==-1;r=s.indexOf(o,t))r>t&&a.push({match:!1,offset:t,text:l.slice(t,r)}),a.push({match:!0,offset:r,text:l.slice(r,r+e.length)}),t=r+e.length;return t<l.length&&a.push({match:!1,offset:t,text:l.slice(t)}),a},v=l=>{const e=x(9),{highlight:a,value:s}=l;if(s==null){let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=i("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=n):n=e[0],n}let o,t,r;if(e[1]!==a||e[2]!==s){r=Symbol.for("react.early_return_sentinel");e:{const n=y(s);if(a===void 0||a===""){r=i("span",{title:n,children:n});break e}o=n,t=N(n,a).map(_)}e[1]=a,e[2]=s,e[3]=o,e[4]=t,e[5]=r}else o=e[3],t=e[4],r=e[5];if(r!==Symbol.for("react.early_return_sentinel"))return r;let d;return e[6]!==o||e[7]!==t?(d=i("span",{title:o,children:t}),e[6]=o,e[7]=t,e[8]=d):d=e[8],d},T=l=>{const e=x(22),{columns:a,rows:s}=l,o=w();let t;e[0]!==o?(t=o("Field"),e[0]=o,e[1]=t):t=e[1];let r;e[2]!==t?(r=i("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:t}),e[2]=t,e[3]=r):r=e[3];let d;if(e[4]!==s||e[5]!==o){let c;e[7]!==o?(c=(b,p)=>i("th",{className:"border-b border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase tabular-nums text-muted-foreground",children:o("Row {n}",{n:p+1})},p),e[7]=o,e[8]=c):c=e[8],d=s.map(c),e[4]=s,e[5]=o,e[6]=d}else d=e[6];let n;e[9]!==r||e[10]!==d?(n=i("thead",{className:"sticky top-0 z-10 bg-muted",children:u("tr",{children:[r,d]})}),e[9]=r,e[10]=d,e[11]=n):n=e[11];let f;if(e[12]!==a||e[13]!==s){let c;e[15]!==s?(c=b=>u("tr",{className:"hover:bg-muted/40",children:[i("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:b}),s.map((p,g)=>i("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:i(v,{value:p[b]})},g))]},b),e[15]=s,e[16]=c):c=e[16],f=a.map(c),e[12]=a,e[13]=s,e[14]=f}else f=e[14];let m;e[17]!==f?(m=i("tbody",{children:f}),e[17]=f,e[18]=m):m=e[18];let h;return e[19]!==n||e[20]!==m?(h=i("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:u("table",{className:"border-collapse text-xs",children:[n,m]})}),e[19]=n,e[20]=m,e[21]=h):h=e[21],h},j=({children:l,layout:e="card",testId:a})=>i("div",{className:e==="fill"?"flex min-h-0 flex-1 flex-col overflow-hidden border-t border-border":"overflow-x-auto border border-border bg-card","data-testid":a,children:l});function _(l){return i("mark",{className:l.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:l.text},l.offset)}export{v as C,j as G,T};
1
+ import{c as x}from"react/compiler-runtime";import{useT as w}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{h as y}from"./internal-7bgd8inO.js";import{jsx as i,jsxs as u}from"react/jsx-runtime";const N=(l,e)=>{if(e==="")return[{match:!1,offset:0,text:l}];const a=[],s=l.toLowerCase(),o=e.toLowerCase();let t=0;for(let r=s.indexOf(o);r!==-1;r=s.indexOf(o,t))r>t&&a.push({match:!1,offset:t,text:l.slice(t,r)}),a.push({match:!0,offset:r,text:l.slice(r,r+e.length)}),t=r+e.length;return t<l.length&&a.push({match:!1,offset:t,text:l.slice(t)}),a},v=l=>{const e=x(9),{highlight:a,value:s}=l;if(s==null){let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=i("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=n):n=e[0],n}let o,t,r;if(e[1]!==a||e[2]!==s){r=Symbol.for("react.early_return_sentinel");e:{const n=y(s);if(a===void 0||a===""){r=i("span",{title:n,children:n});break e}o=n,t=N(n,a).map(_)}e[1]=a,e[2]=s,e[3]=o,e[4]=t,e[5]=r}else o=e[3],t=e[4],r=e[5];if(r!==Symbol.for("react.early_return_sentinel"))return r;let d;return e[6]!==o||e[7]!==t?(d=i("span",{title:o,children:t}),e[6]=o,e[7]=t,e[8]=d):d=e[8],d},T=l=>{const e=x(22),{columns:a,rows:s}=l,o=w();let t;e[0]!==o?(t=o("Field"),e[0]=o,e[1]=t):t=e[1];let r;e[2]!==t?(r=i("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:t}),e[2]=t,e[3]=r):r=e[3];let d;if(e[4]!==s||e[5]!==o){let c;e[7]!==o?(c=(b,p)=>i("th",{className:"border-b border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase tabular-nums text-muted-foreground",children:o("Row {n}",{n:p+1})},p),e[7]=o,e[8]=c):c=e[8],d=s.map(c),e[4]=s,e[5]=o,e[6]=d}else d=e[6];let n;e[9]!==r||e[10]!==d?(n=i("thead",{className:"sticky top-0 z-10 bg-muted",children:u("tr",{children:[r,d]})}),e[9]=r,e[10]=d,e[11]=n):n=e[11];let f;if(e[12]!==a||e[13]!==s){let c;e[15]!==s?(c=b=>u("tr",{className:"hover:bg-muted/40",children:[i("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:b}),s.map((p,g)=>i("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:i(v,{value:p[b]})},g))]},b),e[15]=s,e[16]=c):c=e[16],f=a.map(c),e[12]=a,e[13]=s,e[14]=f}else f=e[14];let m;e[17]!==f?(m=i("tbody",{children:f}),e[17]=f,e[18]=m):m=e[18];let h;return e[19]!==n||e[20]!==m?(h=i("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:u("table",{className:"border-collapse text-xs",children:[n,m]})}),e[19]=n,e[20]=m,e[21]=h):h=e[21],h},j=({children:l,layout:e="card",testId:a})=>i("div",{className:e==="fill"?"flex min-h-0 flex-1 flex-col overflow-hidden border-t border-border":"overflow-x-auto border border-border bg-card","data-testid":a,children:l});function _(l){return i("mark",{className:l.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:l.text},l.offset)}export{v as C,j as G,T};
@@ -1 +1 @@
1
- import{c as A}from"react/compiler-runtime";import{flattenHint as I}from"@lunora/errors";import{useT as O}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{e as j,a as q,b as E}from"./internal-CwaF9YNk.js";import{o as H}from"./recording-client-CKn4-vUx.js";import{u as S}from"./operation-console-provider-DoloEvon.js";import{A as T}from"./alert-C2SEhYS9.js";import{jsx as v,jsxs as U}from"react/jsx-runtime";const G=y=>{const e=A(38),{className:w,error:t,testId:N}=y,g=O(),o=S();let s,l,i,n,a,c,r,m;if(e[0]!==w||e[1]!==t||e[2]!==o||e[3]!==N){const k=j(t);let h;e[12]!==t?(h=q(t),e[12]=t,e[13]=h):h=e[13],l=h;let b;e[14]!==t?(b=H(t),e[14]=t,e[15]=b):b=e[15];const C=b;let x;e[16]!==o||e[17]!==C?(x=()=>{o?.openConsole({errorsOnly:!0,seq:C})},e[16]=o,e[17]=C,e[18]=x):x=e[18],i=x,s=T,n=w,a=N,c="destructive";let u;e[19]!==t?(u=E(t),e[19]=t,e[20]=u):u=e[20],e[21]!==u?(r=v("p",{className:"font-medium",children:u}),e[21]=u,e[22]=r):r=e[22],m=k===void 0?null:v("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:I(k)}),e[0]=w,e[1]=t,e[2]=o,e[3]=N,e[4]=s,e[5]=l,e[6]=i,e[7]=n,e[8]=a,e[9]=c,e[10]=r,e[11]=m}else s=e[4],l=e[5],i=e[6],n=e[7],a=e[8],c=e[9],r=e[10],m=e[11];let f;e[23]!==l?(f=l===void 0?null:v("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:l,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[23]=l,e[24]=f):f=e[24];let p;e[25]!==o||e[26]!==i||e[27]!==g?(p=o===void 0?null:v("button",{className:"mt-1 block text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"error-show-in-console",onClick:i,type:"button",children:g("Show in console")}),e[25]=o,e[26]=i,e[27]=g,e[28]=p):p=e[28];let d;return e[29]!==s||e[30]!==n||e[31]!==a||e[32]!==c||e[33]!==r||e[34]!==m||e[35]!==f||e[36]!==p?(d=U(s,{className:n,testId:a,variant:c,children:[r,m,f,p]}),e[29]=s,e[30]=n,e[31]=a,e[32]=c,e[33]=r,e[34]=m,e[35]=f,e[36]=p,e[37]=d):d=e[37],d};export{G as E};
1
+ import{c as A}from"react/compiler-runtime";import{flattenHint as I}from"@lunora/errors";import{useT as O}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{e as j,a as q,b as E}from"./internal-7bgd8inO.js";import{o as H}from"./recording-client-BPY8sYUl.js";import{u as S}from"./operation-console-provider-DoloEvon.js";import{A as T}from"./alert-C2SEhYS9.js";import{jsx as v,jsxs as U}from"react/jsx-runtime";const G=y=>{const e=A(38),{className:w,error:t,testId:N}=y,g=O(),o=S();let s,l,i,n,a,c,r,m;if(e[0]!==w||e[1]!==t||e[2]!==o||e[3]!==N){const k=j(t);let h;e[12]!==t?(h=q(t),e[12]=t,e[13]=h):h=e[13],l=h;let b;e[14]!==t?(b=H(t),e[14]=t,e[15]=b):b=e[15];const C=b;let x;e[16]!==o||e[17]!==C?(x=()=>{o?.openConsole({errorsOnly:!0,seq:C})},e[16]=o,e[17]=C,e[18]=x):x=e[18],i=x,s=T,n=w,a=N,c="destructive";let u;e[19]!==t?(u=E(t),e[19]=t,e[20]=u):u=e[20],e[21]!==u?(r=v("p",{className:"font-medium",children:u}),e[21]=u,e[22]=r):r=e[22],m=k===void 0?null:v("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:I(k)}),e[0]=w,e[1]=t,e[2]=o,e[3]=N,e[4]=s,e[5]=l,e[6]=i,e[7]=n,e[8]=a,e[9]=c,e[10]=r,e[11]=m}else s=e[4],l=e[5],i=e[6],n=e[7],a=e[8],c=e[9],r=e[10],m=e[11];let f;e[23]!==l?(f=l===void 0?null:v("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:l,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[23]=l,e[24]=f):f=e[24];let p;e[25]!==o||e[26]!==i||e[27]!==g?(p=o===void 0?null:v("button",{className:"mt-1 block text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"error-show-in-console",onClick:i,type:"button",children:g("Show in console")}),e[25]=o,e[26]=i,e[27]=g,e[28]=p):p=e[28];let d;return e[29]!==s||e[30]!==n||e[31]!==a||e[32]!==c||e[33]!==r||e[34]!==m||e[35]!==f||e[36]!==p?(d=U(s,{className:n,testId:a,variant:c,children:[r,m,f,p]}),e[29]=s,e[30]=n,e[31]=a,e[32]=c,e[33]=r,e[34]=m,e[35]=f,e[36]=p,e[37]=d):d=e[37],d};export{G as E};
@@ -1,6 +1,6 @@
1
- import{c as j}from"react/compiler-runtime";import{useState as G}from"react";import{ConfirmButton as Q}from"./ConfirmButton-Cj2SOapE.js";import{D as v,a as J,b as F,c as I,d as A,e as E,f as B,g as _}from"./dropdown-menu-D_ewqsUU.js";import{M as H}from"./modal-shell-wGW4CKEW.js";import{useT as D}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{h as K,g as W,j as z}from"./internal-CwaF9YNk.js";import{jsx as d,jsxs as k}from"react/jsx-runtime";const R="inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",P=/["\n,]/u,X=/^[=+\-@\t\r]/u,U=t=>{if(t==null)return"";let e;return typeof t=="string"?e=X.test(t)?` ${t}`:t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?e=String(t):e=JSON.stringify(t),P.test(e)?`"${e.replaceAll('"','""')}"`:e},Y=(t,e)=>{const o=t.map(n=>U(n)).join(","),s=e.map(n=>t.map(l=>U(n[l])).join(","));return[o,...s].join(`
2
- `)},Z=t=>JSON.stringify(t,z,2),V=500,q=t=>`"${t.replaceAll('"','""')}"`,ee=t=>t==null?"NULL":typeof t=="number"?Number.isFinite(t)?String(t):"NULL":typeof t=="bigint"?String(t):typeof t=="boolean"?t?"1":"0":`'${(typeof t=="string"?t:JSON.stringify(t)).replaceAll("'","''")}'`,te=(t,e,o)=>{if(e.length===0||o.length===0)return"";const s=e.map(l=>q(l)).join(", "),n=[];for(let l=0;l<o.length;l+=V){const r=o.slice(l,l+V).map(i=>` (${e.map(c=>ee(i[c])).join(", ")})`).join(`,
3
- `);n.push(`INSERT INTO ${q(t)} (${s}) VALUES
1
+ import{c as j}from"react/compiler-runtime";import{useState as G}from"react";import{ConfirmButton as Q}from"./ConfirmButton-Cj2SOapE.js";import{D as v,a as J,b as F,c as I,d as E,e as A,f as B,g as _}from"./dropdown-menu-D_ewqsUU.js";import{M as H}from"./modal-shell-wGW4CKEW.js";import{useT as D}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{h as K,g as W,j as z,s as U}from"./internal-7bgd8inO.js";import{jsx as d,jsxs as k}from"react/jsx-runtime";const R="inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",P=/["\n,]/u,X=/^[=+\-@\t\r]/u,V=t=>{if(t==null)return"";let e;return typeof t=="string"?e=X.test(t)?` ${t}`:t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?e=String(t):e=JSON.stringify(t),P.test(e)?`"${e.replaceAll('"','""')}"`:e},Y=(t,e)=>{const o=t.map(n=>V(n)).join(","),s=e.map(n=>t.map(l=>V(n[l])).join(","));return[o,...s].join(`
2
+ `)},Z=t=>JSON.stringify(t,z,2),q=500,ee=t=>t==null?"NULL":typeof t=="number"?Number.isFinite(t)?String(t):"NULL":typeof t=="bigint"?String(t):typeof t=="boolean"?t?"1":"0":`'${(typeof t=="string"?t:JSON.stringify(t)).replaceAll("'","''")}'`,te=(t,e,o)=>{if(e.length===0||o.length===0)return"";const s=e.map(l=>U(l)).join(", "),n=[];for(let l=0;l<o.length;l+=q){const r=o.slice(l,l+q).map(i=>` (${e.map(c=>ee(i[c])).join(", ")})`).join(`,
3
+ `);n.push(`INSERT INTO ${U(t)} (${s}) VALUES
4
4
  ${r};`)}return n.join(`
5
5
 
6
- `)},M=(t,e,o)=>{if(!("document"in globalThis))return;const s=globalThis.URL.createObjectURL(new globalThis.Blob([e],{type:o})),n=globalThis.document.createElement("a");n.href=s,n.download=t,globalThis.document.body.append(n),n.click(),n.remove(),globalThis.URL.revokeObjectURL(s)},le=t=>{const e=j(36),{columns:o,name:s,rows:n}=t,l=D();let r;e[0]!==o||e[1]!==s||e[2]!==n?(r=()=>{M(`${s}.csv`,Y(o,n),"text/csv;charset=utf-8")},e[0]=o,e[1]=s,e[2]=n,e[3]=r):r=e[3];const i=r;let c;e[4]!==s||e[5]!==n?(c=()=>{M(`${s}.json`,Z(n),"application/json")},e[4]=s,e[5]=n,e[6]=c):c=e[6];const f=c;let p;e[7]!==o||e[8]!==s||e[9]!==n?(p=()=>{M(`${s}.sql`,te(s,o,n),"application/sql;charset=utf-8")},e[7]=o,e[8]=s,e[9]=n,e[10]=p):p=e[10];const a=p,h=n.length===0;let g;e[11]!==h?(g=d(J,{className:R,"data-testid":"grid-export",disabled:h,title:"Exports only the rows loaded on the current page, not the whole table",children:"Export page"}),e[11]=h,e[12]=g):g=e[12];let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=d(A,{children:"Export loaded rows"}),e[13]=N):N=e[13];let m;e[14]!==l?(m=l("CSV"),e[14]=l,e[15]=m):m=e[15];let b;e[16]!==i||e[17]!==m?(b=d(_,{"data-testid":"grid-export-csv",onClick:i,children:m}),e[16]=i,e[17]=m,e[18]=b):b=e[18];let y;e[19]!==l?(y=l("JSON"),e[19]=l,e[20]=y):y=e[20];let C;e[21]!==f||e[22]!==y?(C=d(_,{"data-testid":"grid-export-json",onClick:f,children:y}),e[21]=f,e[22]=y,e[23]=C):C=e[23];let w;e[24]!==l?(w=l("SQL"),e[24]=l,e[25]=w):w=e[25];let u;e[26]!==a||e[27]!==w?(u=d(_,{"data-testid":"grid-export-sql",onClick:a,children:w}),e[26]=a,e[27]=w,e[28]=u):u=e[28];let x;e[29]!==C||e[30]!==u||e[31]!==b?(x=k(F,{align:"end",children:[N,b,C,u]}),e[29]=C,e[30]=u,e[31]=b,e[32]=x):x=e[32];let S;return e[33]!==x||e[34]!==g?(S=k(v,{children:[g,x]}),e[33]=x,e[34]=g,e[35]=S):S=e[35],S},ne=t=>{const e=j(9),{column:o}=t;let s;e[0]!==o?(s=()=>{o.toggleVisibility()},e[0]=o,e[1]=s):s=e[1];const n=s;let l;e[2]!==o?(l=o.getIsVisible(),e[2]=o,e[3]=l):l=e[3];const r=`grid-column-${o.id}`;let i;return e[4]!==o.id||e[5]!==n||e[6]!==l||e[7]!==r?(i=d(E,{checked:l,closeOnClick:!1,"data-testid":r,onCheckedChange:n,children:o.id}),e[4]=o.id,e[5]=n,e[6]=l,e[7]=r,e[8]=i):i=e[8],i},oe=[],se=({backRelations:t=oe,enabledBackRelations:e,onToggleBackRelation:o,table:s})=>{const n=D(),l=s.getIsAllColumnsVisible(),r=()=>{s.toggleAllColumnsVisible(!l)};return k(v,{children:[d(J,{className:R,"data-testid":"grid-columns",children:n("Columns")}),k(F,{align:"end",className:"max-h-80 overflow-y-auto",children:[k(I,{children:[d(A,{children:n("Columns")}),d(E,{checked:l,closeOnClick:!1,"data-testid":"grid-columns-all",onCheckedChange:r,children:n(l?"Hide all":"Show all")}),d(B,{}),s.getAllLeafColumns().filter(i=>!i.id.startsWith("__back__:")).map(i=>d(ne,{column:i},i.id))]}),t.length>0&&o!==void 0&&k(I,{children:[d(B,{}),d(A,{children:n("Related")}),t.map(i=>{const c=`${i.table}.${i.column}`;return d(E,{checked:e?.has(c)===!0,closeOnClick:!1,"data-testid":`grid-back-relation-${c}`,onCheckedChange:()=>{o(c)},children:`← ${i.table}.${i.column}`},c)})]})]})]})},ie=t=>{const e=j(19),{count:o,editable:s,onClear:n,onDelete:l}=t,r=D();let i;e[0]!==o||e[1]!==r?(i=r("{count} selected",{count:o}),e[0]=o,e[1]=r,e[2]=i):i=e[2];let c;e[3]!==i?(c=d("span",{className:"font-medium tabular-nums","data-testid":"grid-selection-count",children:i}),e[3]=i,e[4]=c):c=e[4];let f;e[5]!==r?(f=r("Clear"),e[5]=r,e[6]=f):f=e[6];let p;e[7]!==n||e[8]!==f?(p=d("button",{className:R,"data-testid":"grid-selection-clear",onClick:n,type:"button",children:f}),e[7]=n,e[8]=f,e[9]=p):p=e[9];let a;e[10]!==o||e[11]!==s||e[12]!==l||e[13]!==r?(a=s&&d(Q,{confirmLabel:r("Delete {count} rows?",{count:o}),onConfirm:l,testId:"grid-selection-delete",children:r("Delete {count}",{count:o})}),e[10]=o,e[11]=s,e[12]=l,e[13]=r,e[14]=a):a=e[14];let h;return e[15]!==c||e[16]!==p||e[17]!==a?(h=k("div",{className:"flex items-center gap-2 rounded-md border border-border bg-accent/40 px-3 py-1.5 text-xs","data-testid":"grid-selection-bar",children:[c,p,a]}),e[15]=c,e[16]=p,e[17]=a,e[18]=h):h=e[18],h},he=t=>{const e=j(32),{column:o,onClose:s,value:n}=t,l=D(),[r,i]=G(!1);let c;e[0]!==n?(c=K(n),e[0]=n,e[1]=c):c=e[1];const f=c;let p;e[2]!==f?(p=()=>{W(f)&&i(!0)},e[2]=f,e[3]=p):p=e[3];const a=p;let h;e[4]!==l?(h=l("Cell value"),e[4]=l,e[5]=h):h=e[5];let g;e[6]!==o?(g=d("h2",{className:"truncate font-mono text-sm font-semibold text-foreground",children:o}),e[6]=o,e[7]=g):g=e[7];let N;e[8]!==r||e[9]!==l?(N=l(r?"Copied":"Copy"),e[8]=r,e[9]=l,e[10]=N):N=e[10];let m;e[11]!==a||e[12]!==N?(m=d("button",{className:R,"data-testid":"grid-cell-copy",onClick:a,type:"button",children:N}),e[11]=a,e[12]=N,e[13]=m):m=e[13];let b;e[14]!==l?(b=l("Close"),e[14]=l,e[15]=b):b=e[15];let y;e[16]!==s||e[17]!==b?(y=d("button",{className:R,"data-testid":"grid-cell-close",onClick:s,type:"button",children:b}),e[16]=s,e[17]=b,e[18]=y):y=e[18];let C;e[19]!==m||e[20]!==y?(C=k("div",{className:"flex items-center gap-1.5",children:[m,y]}),e[19]=m,e[20]=y,e[21]=C):C=e[21];let w;e[22]!==g||e[23]!==C?(w=k("div",{className:"flex items-center justify-between",children:[g,C]}),e[22]=g,e[23]=C,e[24]=w):w=e[24];let u;e[25]!==f?(u=d("pre",{className:"min-h-0 flex-1 overflow-auto rounded-md border border-border bg-muted/30 p-3 font-mono text-xs whitespace-pre-wrap","data-testid":"grid-cell-value",children:f}),e[25]=f,e[26]=u):u=e[26];let x;return e[27]!==s||e[28]!==w||e[29]!==u||e[30]!==h?(x=k(H,{className:"max-h-[70vh] w-[min(40rem,90vw)]",label:h,onClose:s,panelTestId:"grid-cell-dialog",testId:"grid-cell-dialog-overlay",variant:"dialog",children:[w,u]}),e[27]=s,e[28]=w,e[29]=u,e[30]=h,e[31]=x):x=e[31],x},be=t=>{const e=j(36),{backRelations:o,enabledBackRelations:s,onToggleBackRelation:n,columns:l,editable:r,name:i,onBulkDelete:c,onToggleTranspose:f,rows:p,table:a,transposed:h}=t,g=D();let N;e[0]!==a?(N=a.getSelectedRowModel(),e[0]=a,e[1]=N):N=e[1];const m=N.rows;let b;e[2]!==a?(b=()=>{a.resetRowSelection()},e[2]=a,e[3]=b):b=e[3];const y=b;let C;e[4]!==c||e[5]!==m||e[6]!==a?(C=()=>{c(m.map(re)),a.resetRowSelection()},e[4]=c,e[5]=m,e[6]=a,e[7]=C):C=e[7];const w=C;let u;e[8]!==l||e[9]!==i||e[10]!==p?(u=d(le,{columns:l,name:i,rows:p}),e[8]=l,e[9]=i,e[10]=p,e[11]=u):u=e[11];let x;e[12]!==o||e[13]!==s||e[14]!==n||e[15]!==a?(x=d(se,{backRelations:o,enabledBackRelations:s,onToggleBackRelation:n,table:a}),e[12]=o,e[13]=s,e[14]=n,e[15]=a,e[16]=x):x=e[16];let S;e[17]!==g?(S=g("Swap rows and columns"),e[17]=g,e[18]=S):S=e[18];let T;e[19]!==g?(T=g("Transpose"),e[19]=g,e[20]=T):T=e[20];let $;e[21]!==f||e[22]!==S||e[23]!==T||e[24]!==h?($=d("button",{"aria-pressed":h,className:R,"data-testid":"grid-transpose",onClick:f,title:S,type:"button",children:T}),e[21]=f,e[22]=S,e[23]=T,e[24]=h,e[25]=$):$=e[25];let L;e[26]!==r||e[27]!==y||e[28]!==w||e[29]!==m.length?(L=m.length>0&&d(ie,{count:m.length,editable:r,onClear:y,onDelete:w}),e[26]=r,e[27]=y,e[28]=w,e[29]=m.length,e[30]=L):L=e[30];let O;return e[31]!==u||e[32]!==x||e[33]!==$||e[34]!==L?(O=k("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"grid-actions",children:[u,x,$,L]}),e[31]=u,e[32]=x,e[33]=$,e[34]=L,e[35]=O):O=e[35],O};function re(t){return t.id}export{he as C,le as E,be as G,ie as S};
6
+ `)},M=(t,e,o)=>{if(!("document"in globalThis))return;const s=globalThis.URL.createObjectURL(new globalThis.Blob([e],{type:o})),n=globalThis.document.createElement("a");n.href=s,n.download=t,globalThis.document.body.append(n),n.click(),n.remove(),globalThis.URL.revokeObjectURL(s)},le=t=>{const e=j(36),{columns:o,name:s,rows:n}=t,l=D();let r;e[0]!==o||e[1]!==s||e[2]!==n?(r=()=>{M(`${s}.csv`,Y(o,n),"text/csv;charset=utf-8")},e[0]=o,e[1]=s,e[2]=n,e[3]=r):r=e[3];const i=r;let c;e[4]!==s||e[5]!==n?(c=()=>{M(`${s}.json`,Z(n),"application/json")},e[4]=s,e[5]=n,e[6]=c):c=e[6];const f=c;let p;e[7]!==o||e[8]!==s||e[9]!==n?(p=()=>{M(`${s}.sql`,te(s,o,n),"application/sql;charset=utf-8")},e[7]=o,e[8]=s,e[9]=n,e[10]=p):p=e[10];const a=p,h=n.length===0;let g;e[11]!==h?(g=d(J,{className:R,"data-testid":"grid-export",disabled:h,title:"Exports only the rows loaded on the current page, not the whole table",children:"Export page"}),e[11]=h,e[12]=g):g=e[12];let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=d(E,{children:"Export loaded rows"}),e[13]=N):N=e[13];let m;e[14]!==l?(m=l("CSV"),e[14]=l,e[15]=m):m=e[15];let b;e[16]!==i||e[17]!==m?(b=d(_,{"data-testid":"grid-export-csv",onClick:i,children:m}),e[16]=i,e[17]=m,e[18]=b):b=e[18];let y;e[19]!==l?(y=l("JSON"),e[19]=l,e[20]=y):y=e[20];let C;e[21]!==f||e[22]!==y?(C=d(_,{"data-testid":"grid-export-json",onClick:f,children:y}),e[21]=f,e[22]=y,e[23]=C):C=e[23];let w;e[24]!==l?(w=l("SQL"),e[24]=l,e[25]=w):w=e[25];let u;e[26]!==a||e[27]!==w?(u=d(_,{"data-testid":"grid-export-sql",onClick:a,children:w}),e[26]=a,e[27]=w,e[28]=u):u=e[28];let x;e[29]!==C||e[30]!==u||e[31]!==b?(x=k(F,{align:"end",children:[N,b,C,u]}),e[29]=C,e[30]=u,e[31]=b,e[32]=x):x=e[32];let S;return e[33]!==x||e[34]!==g?(S=k(v,{children:[g,x]}),e[33]=x,e[34]=g,e[35]=S):S=e[35],S},ne=t=>{const e=j(9),{column:o}=t;let s;e[0]!==o?(s=()=>{o.toggleVisibility()},e[0]=o,e[1]=s):s=e[1];const n=s;let l;e[2]!==o?(l=o.getIsVisible(),e[2]=o,e[3]=l):l=e[3];const r=`grid-column-${o.id}`;let i;return e[4]!==o.id||e[5]!==n||e[6]!==l||e[7]!==r?(i=d(A,{checked:l,closeOnClick:!1,"data-testid":r,onCheckedChange:n,children:o.id}),e[4]=o.id,e[5]=n,e[6]=l,e[7]=r,e[8]=i):i=e[8],i},oe=[],se=({backRelations:t=oe,enabledBackRelations:e,onToggleBackRelation:o,table:s})=>{const n=D(),l=s.getIsAllColumnsVisible(),r=()=>{s.toggleAllColumnsVisible(!l)};return k(v,{children:[d(J,{className:R,"data-testid":"grid-columns",children:n("Columns")}),k(F,{align:"end",className:"max-h-80 overflow-y-auto",children:[k(I,{children:[d(E,{children:n("Columns")}),d(A,{checked:l,closeOnClick:!1,"data-testid":"grid-columns-all",onCheckedChange:r,children:n(l?"Hide all":"Show all")}),d(B,{}),s.getAllLeafColumns().filter(i=>!i.id.startsWith("__back__:")).map(i=>d(ne,{column:i},i.id))]}),t.length>0&&o!==void 0&&k(I,{children:[d(B,{}),d(E,{children:n("Related")}),t.map(i=>{const c=`${i.table}.${i.column}`;return d(A,{checked:e?.has(c)===!0,closeOnClick:!1,"data-testid":`grid-back-relation-${c}`,onCheckedChange:()=>{o(c)},children:`← ${i.table}.${i.column}`},c)})]})]})]})},ie=t=>{const e=j(19),{count:o,editable:s,onClear:n,onDelete:l}=t,r=D();let i;e[0]!==o||e[1]!==r?(i=r("{count} selected",{count:o}),e[0]=o,e[1]=r,e[2]=i):i=e[2];let c;e[3]!==i?(c=d("span",{className:"font-medium tabular-nums","data-testid":"grid-selection-count",children:i}),e[3]=i,e[4]=c):c=e[4];let f;e[5]!==r?(f=r("Clear"),e[5]=r,e[6]=f):f=e[6];let p;e[7]!==n||e[8]!==f?(p=d("button",{className:R,"data-testid":"grid-selection-clear",onClick:n,type:"button",children:f}),e[7]=n,e[8]=f,e[9]=p):p=e[9];let a;e[10]!==o||e[11]!==s||e[12]!==l||e[13]!==r?(a=s&&d(Q,{confirmLabel:r("Delete {count} rows?",{count:o}),onConfirm:l,testId:"grid-selection-delete",children:r("Delete {count}",{count:o})}),e[10]=o,e[11]=s,e[12]=l,e[13]=r,e[14]=a):a=e[14];let h;return e[15]!==c||e[16]!==p||e[17]!==a?(h=k("div",{className:"flex items-center gap-2 rounded-md border border-border bg-accent/40 px-3 py-1.5 text-xs","data-testid":"grid-selection-bar",children:[c,p,a]}),e[15]=c,e[16]=p,e[17]=a,e[18]=h):h=e[18],h},he=t=>{const e=j(32),{column:o,onClose:s,value:n}=t,l=D(),[r,i]=G(!1);let c;e[0]!==n?(c=K(n),e[0]=n,e[1]=c):c=e[1];const f=c;let p;e[2]!==f?(p=()=>{W(f)&&i(!0)},e[2]=f,e[3]=p):p=e[3];const a=p;let h;e[4]!==l?(h=l("Cell value"),e[4]=l,e[5]=h):h=e[5];let g;e[6]!==o?(g=d("h2",{className:"truncate font-mono text-sm font-semibold text-foreground",children:o}),e[6]=o,e[7]=g):g=e[7];let N;e[8]!==r||e[9]!==l?(N=l(r?"Copied":"Copy"),e[8]=r,e[9]=l,e[10]=N):N=e[10];let m;e[11]!==a||e[12]!==N?(m=d("button",{className:R,"data-testid":"grid-cell-copy",onClick:a,type:"button",children:N}),e[11]=a,e[12]=N,e[13]=m):m=e[13];let b;e[14]!==l?(b=l("Close"),e[14]=l,e[15]=b):b=e[15];let y;e[16]!==s||e[17]!==b?(y=d("button",{className:R,"data-testid":"grid-cell-close",onClick:s,type:"button",children:b}),e[16]=s,e[17]=b,e[18]=y):y=e[18];let C;e[19]!==m||e[20]!==y?(C=k("div",{className:"flex items-center gap-1.5",children:[m,y]}),e[19]=m,e[20]=y,e[21]=C):C=e[21];let w;e[22]!==g||e[23]!==C?(w=k("div",{className:"flex items-center justify-between",children:[g,C]}),e[22]=g,e[23]=C,e[24]=w):w=e[24];let u;e[25]!==f?(u=d("pre",{className:"min-h-0 flex-1 overflow-auto rounded-md border border-border bg-muted/30 p-3 font-mono text-xs whitespace-pre-wrap","data-testid":"grid-cell-value",children:f}),e[25]=f,e[26]=u):u=e[26];let x;return e[27]!==s||e[28]!==w||e[29]!==u||e[30]!==h?(x=k(H,{className:"max-h-[70vh] w-[min(40rem,90vw)]",label:h,onClose:s,panelTestId:"grid-cell-dialog",testId:"grid-cell-dialog-overlay",variant:"dialog",children:[w,u]}),e[27]=s,e[28]=w,e[29]=u,e[30]=h,e[31]=x):x=e[31],x},be=t=>{const e=j(36),{backRelations:o,enabledBackRelations:s,onToggleBackRelation:n,columns:l,editable:r,name:i,onBulkDelete:c,onToggleTranspose:f,rows:p,table:a,transposed:h}=t,g=D();let N;e[0]!==a?(N=a.getSelectedRowModel(),e[0]=a,e[1]=N):N=e[1];const m=N.rows;let b;e[2]!==a?(b=()=>{a.resetRowSelection()},e[2]=a,e[3]=b):b=e[3];const y=b;let C;e[4]!==c||e[5]!==m||e[6]!==a?(C=()=>{c(m.map(re)),a.resetRowSelection()},e[4]=c,e[5]=m,e[6]=a,e[7]=C):C=e[7];const w=C;let u;e[8]!==l||e[9]!==i||e[10]!==p?(u=d(le,{columns:l,name:i,rows:p}),e[8]=l,e[9]=i,e[10]=p,e[11]=u):u=e[11];let x;e[12]!==o||e[13]!==s||e[14]!==n||e[15]!==a?(x=d(se,{backRelations:o,enabledBackRelations:s,onToggleBackRelation:n,table:a}),e[12]=o,e[13]=s,e[14]=n,e[15]=a,e[16]=x):x=e[16];let S;e[17]!==g?(S=g("Swap rows and columns"),e[17]=g,e[18]=S):S=e[18];let T;e[19]!==g?(T=g("Transpose"),e[19]=g,e[20]=T):T=e[20];let $;e[21]!==f||e[22]!==S||e[23]!==T||e[24]!==h?($=d("button",{"aria-pressed":h,className:R,"data-testid":"grid-transpose",onClick:f,title:S,type:"button",children:T}),e[21]=f,e[22]=S,e[23]=T,e[24]=h,e[25]=$):$=e[25];let L;e[26]!==r||e[27]!==y||e[28]!==w||e[29]!==m.length?(L=m.length>0&&d(ie,{count:m.length,editable:r,onClear:y,onDelete:w}),e[26]=r,e[27]=y,e[28]=w,e[29]=m.length,e[30]=L):L=e[30];let O;return e[31]!==u||e[32]!==x||e[33]!==$||e[34]!==L?(O=k("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"grid-actions",children:[u,x,$,L]}),e[31]=u,e[32]=x,e[33]=$,e[34]=L,e[35]=O):O=e[35],O};function re(t){return t.id}export{he as C,le as E,be as G,ie as S};
@@ -1,3 +1,3 @@
1
- import{c as $}from"react/compiler-runtime";import{useNavigate as Je}from"@tanstack/react-router";import{useState as Ue,useEffect as Ke,Suspense as st,lazy as nt}from"react";import{B as Ye}from"./badge-cAk9Di1Q.js";import{C as B,a as Ze}from"./card-BGlQzQY-.js";import{E as lt}from"./empty-state-B939z6K2.js";import{u as _e}from"./use-admin-query-P0RJrjsD.js";import{useT as I}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as Ne}from"./ADMIN_FUNCTIONS-4aE59aDq.js";import{c as at,f as Se,d as rt,r as ot,g as it,l as ct}from"./internal-CwaF9YNk.js";import{c as Xe}from"./utils-bhneXptQ.js";import{deriveInsights as dt}from"./DEFAULT_INSIGHT_THRESHOLDS-1Lrg55IV.js";import{useLunora as et}from"@lunora/react";import{jsx as l,jsxs as h}from"react/jsx-runtime";import{B as Ve}from"./button-BOPLD1un.js";const ut=at(Ne.studioFeatures),tt={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},mt=t=>{if(t===null||typeof t!="object")return tt;const e=t,n=s=>typeof e[s]=="boolean"?e[s]:!0;return{analytics:n("analytics"),auth:n("auth"),containers:n("containers"),flags:n("flags"),kv:n("kv"),mail:n("mail"),notifications:n("notifications"),payments:n("payments"),queues:n("queues"),scheduler:n("scheduler"),storage:n("storage"),vectors:n("vectors"),workflows:n("workflows")}},ft=()=>{const t=$(3),e=et(),[n,s]=Ue(tt);let a,r;return t[0]!==e?(a=()=>{Se((async()=>{try{s(mt(await e.query(ut,{},rt(""))))}catch{}})())},r=[e],t[0]=e,t[1]=a,t[2]=r):(a=t[1],r=t[2]),Ke(a,r),n},pt=()=>{const t=$(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:l("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},ht=t=>{const e=$(24),{group:n}=t,s=I(),a=Je();let r;e[0]!==n.tab||e[1]!==a?(r=()=>{Se(a({to:`/${n.tab}`}))},e[0]=n.tab,e[1]=a,e[2]=r):r=e[2];const o=r,i=n.bindings.length;let c;e[3]!==n.label?(c=l("span",{className:"text-sm font-medium text-foreground",children:n.label}),e[3]=n.label,e[4]=c):c=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=l(pt,{}),e[5]=m):m=e[5];let d;e[6]!==c?(d=h("div",{className:"flex items-center justify-between",children:[c,m]}),e[6]=c,e[7]=d):d=e[7];let f;e[8]!==i||e[9]!==s?(f=i===1?s("1 binding"):s("{count} bindings",{count:i}),e[8]=i,e[9]=s,e[10]=f):f=e[10];let u;e[11]!==f?(u=l("span",{className:"text-xs text-muted-foreground",children:f}),e[11]=f,e[12]=u):u=e[12];let p;e[13]!==i||e[14]!==n.bindings?(p=i>0&&l("div",{className:"flex flex-wrap gap-1.5",children:n.bindings.map(bt)}),e[13]=i,e[14]=n.bindings,e[15]=p):p=e[15];let g;e[16]!==d||e[17]!==u||e[18]!==p?(g=h(Ze,{className:"flex flex-col gap-2 py-4",children:[d,u,p]}),e[16]=d,e[17]=u,e[18]=p,e[19]=g):g=e[19];let x;return e[20]!==n.testId||e[21]!==o||e[22]!==g?(x=l(B,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":n.testId,onClick:o,children:g}),e[20]=n.testId,e[21]=o,e[22]=g,e[23]=x):x=e[23],x},We=["kv","files","vectors"],gt=(t,e)=>[...t.filter(n=>n.tab!==e.tab),e].toSorted((n,s)=>We.indexOf(n.tab)-We.indexOf(s.tab)),xt=()=>{const t=$(19),e=et(),n=ft(),s=I();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],t[0]=a):a=t[0];const[r,o]=Ue(a);let i,c;if(t[1]!==e||t[2]!==n.kv||t[3]!==n.storage||t[4]!==n.vectors||t[5]!==s?(i=()=>{const g={cancelled:!1},x=[{enabled:n.kv,label:s("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(yt),tab:"kv",testId:"home-binding-kv"},{enabled:n.storage,label:s("R2 Buckets"),load:()=>e.listStorageBuckets(),tab:"files",testId:"home-binding-r2"},{enabled:n.vectors,label:s("Vectorize Indexes"),load:async()=>(await e.listVectorIndexes()).map(vt),tab:"vectors",testId:"home-binding-vectors"}];for(const b of x)b.enabled&&Se((async()=>{try{const y=await b.load();if(!g.cancelled){const S={bindings:y,label:b.label,tab:b.tab,testId:b.testId};o(A=>gt(A,S))}}catch{}})());return()=>{g.cancelled=!0}},c=[e,n.kv,n.storage,n.vectors,s],t[1]=e,t[2]=n.kv,t[3]=n.storage,t[4]=n.vectors,t[5]=s,t[6]=i,t[7]=c):(i=t[6],c=t[7]),Ke(i,c),r.length===0)return null;let m;t[8]!==s?(m=s("Bindings"),t[8]=s,t[9]=m):m=t[9];let d;t[10]!==m?(d=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:m}),t[10]=m,t[11]=d):d=t[11];let f;t[12]!==r?(f=r.map(Nt),t[12]=r,t[13]=f):f=t[13];let u;t[14]!==f?(u=l("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:f}),t[14]=f,t[15]=u):u=t[15];let p;return t[16]!==d||t[17]!==u?(p=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[d,u]}),t[16]=d,t[17]=u,t[18]=p):p=t[18],p};function bt(t){return l(Ye,{variant:"secondary",children:t},t)}function yt(t){return t.binding}function vt(t){return t.name}function Nt(t){return l(ht,{group:t},t.tab)}const _t=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation — writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action — writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],St=t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),kt=t=>{const e=_t.map(n=>`- ${n.name} — ${n.summary}`).join(`
1
+ import{c as $}from"react/compiler-runtime";import{useNavigate as Je}from"@tanstack/react-router";import{useState as Ue,useEffect as Ke,Suspense as st,lazy as nt}from"react";import{B as Ye}from"./badge-cAk9Di1Q.js";import{C as B,a as Ze}from"./card-BGlQzQY-.js";import{E as lt}from"./empty-state-B939z6K2.js";import{u as _e}from"./use-admin-query-DV9xmFl8.js";import{useT as I}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as Ne}from"./ADMIN_FUNCTIONS-4aE59aDq.js";import{c as at,f as Se,d as rt,r as ot,g as it,l as ct}from"./internal-7bgd8inO.js";import{c as Xe}from"./utils-bhneXptQ.js";import{deriveInsights as dt}from"./DEFAULT_INSIGHT_THRESHOLDS-1Lrg55IV.js";import{useLunora as et}from"@lunora/react";import{jsx as l,jsxs as h}from"react/jsx-runtime";import{B as Ve}from"./button-BOPLD1un.js";const ut=at(Ne.studioFeatures),tt={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},mt=t=>{if(t===null||typeof t!="object")return tt;const e=t,n=s=>typeof e[s]=="boolean"?e[s]:!0;return{analytics:n("analytics"),auth:n("auth"),containers:n("containers"),flags:n("flags"),kv:n("kv"),mail:n("mail"),notifications:n("notifications"),payments:n("payments"),queues:n("queues"),scheduler:n("scheduler"),storage:n("storage"),vectors:n("vectors"),workflows:n("workflows")}},ft=()=>{const t=$(3),e=et(),[n,s]=Ue(tt);let a,r;return t[0]!==e?(a=()=>{Se((async()=>{try{s(mt(await e.query(ut,{},rt(""))))}catch{}})())},r=[e],t[0]=e,t[1]=a,t[2]=r):(a=t[1],r=t[2]),Ke(a,r),n},pt=()=>{const t=$(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:l("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},ht=t=>{const e=$(24),{group:n}=t,s=I(),a=Je();let r;e[0]!==n.tab||e[1]!==a?(r=()=>{Se(a({to:`/${n.tab}`}))},e[0]=n.tab,e[1]=a,e[2]=r):r=e[2];const o=r,i=n.bindings.length;let c;e[3]!==n.label?(c=l("span",{className:"text-sm font-medium text-foreground",children:n.label}),e[3]=n.label,e[4]=c):c=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=l(pt,{}),e[5]=m):m=e[5];let d;e[6]!==c?(d=h("div",{className:"flex items-center justify-between",children:[c,m]}),e[6]=c,e[7]=d):d=e[7];let f;e[8]!==i||e[9]!==s?(f=i===1?s("1 binding"):s("{count} bindings",{count:i}),e[8]=i,e[9]=s,e[10]=f):f=e[10];let u;e[11]!==f?(u=l("span",{className:"text-xs text-muted-foreground",children:f}),e[11]=f,e[12]=u):u=e[12];let p;e[13]!==i||e[14]!==n.bindings?(p=i>0&&l("div",{className:"flex flex-wrap gap-1.5",children:n.bindings.map(bt)}),e[13]=i,e[14]=n.bindings,e[15]=p):p=e[15];let g;e[16]!==d||e[17]!==u||e[18]!==p?(g=h(Ze,{className:"flex flex-col gap-2 py-4",children:[d,u,p]}),e[16]=d,e[17]=u,e[18]=p,e[19]=g):g=e[19];let x;return e[20]!==n.testId||e[21]!==o||e[22]!==g?(x=l(B,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":n.testId,onClick:o,children:g}),e[20]=n.testId,e[21]=o,e[22]=g,e[23]=x):x=e[23],x},We=["kv","files","vectors"],gt=(t,e)=>[...t.filter(n=>n.tab!==e.tab),e].toSorted((n,s)=>We.indexOf(n.tab)-We.indexOf(s.tab)),xt=()=>{const t=$(19),e=et(),n=ft(),s=I();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],t[0]=a):a=t[0];const[r,o]=Ue(a);let i,c;if(t[1]!==e||t[2]!==n.kv||t[3]!==n.storage||t[4]!==n.vectors||t[5]!==s?(i=()=>{const g={cancelled:!1},x=[{enabled:n.kv,label:s("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(yt),tab:"kv",testId:"home-binding-kv"},{enabled:n.storage,label:s("R2 Buckets"),load:()=>e.listStorageBuckets(),tab:"files",testId:"home-binding-r2"},{enabled:n.vectors,label:s("Vectorize Indexes"),load:async()=>(await e.listVectorIndexes()).map(vt),tab:"vectors",testId:"home-binding-vectors"}];for(const b of x)b.enabled&&Se((async()=>{try{const y=await b.load();if(!g.cancelled){const S={bindings:y,label:b.label,tab:b.tab,testId:b.testId};o(A=>gt(A,S))}}catch{}})());return()=>{g.cancelled=!0}},c=[e,n.kv,n.storage,n.vectors,s],t[1]=e,t[2]=n.kv,t[3]=n.storage,t[4]=n.vectors,t[5]=s,t[6]=i,t[7]=c):(i=t[6],c=t[7]),Ke(i,c),r.length===0)return null;let m;t[8]!==s?(m=s("Bindings"),t[8]=s,t[9]=m):m=t[9];let d;t[10]!==m?(d=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:m}),t[10]=m,t[11]=d):d=t[11];let f;t[12]!==r?(f=r.map(Nt),t[12]=r,t[13]=f):f=t[13];let u;t[14]!==f?(u=l("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:f}),t[14]=f,t[15]=u):u=t[15];let p;return t[16]!==d||t[17]!==u?(p=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[d,u]}),t[16]=d,t[17]=u,t[18]=p):p=t[18],p};function bt(t){return l(Ye,{variant:"secondary",children:t},t)}function yt(t){return t.binding}function vt(t){return t.name}function Nt(t){return l(ht,{group:t},t.tab)}const _t=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation — writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action — writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],St=t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),kt=t=>{const e=_t.map(n=>`- ${n.name} — ${n.summary}`).join(`
2
2
  `);return[`You have a Lunora MCP server connected to the deployment at ${t}.`,"It exposes this backend's functions and schema so you can inspect and operate it:",e,"",`Start by calling lunora_list_functions and lunora_list_tables to learn what exists, then lunora_get_function_schema before any run call. The full HTTP API is also documented at ${t}/_lunora/admin/openapi (that endpoint needs the same admin token the MCP server is configured with).`].join(`
3
3
  `)},Ct=1500,wt=()=>{const t=$(35),e=I();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=ot(),t[0]=n):n=t[0];const s=n,[a,r]=Ue(null);let o,i;t[1]!==a?(o=()=>{if(a===null)return;const L=globalThis.setTimeout(()=>{r(null)},Ct);return()=>{globalThis.clearTimeout(L)}},i=[a],t[1]=a,t[2]=o,t[3]=i):(o=t[2],i=t[3]),Ke(o,i);let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=(L,M)=>{it(M)&&r(L)},t[4]=c):c=t[4];const m=c;let d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{m("config",St(s))},t[5]=d):d=t[5];const f=d;let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{m("prompt",kt(s))},t[6]=u):u=t[6];const p=u;let g;t[7]!==e?(g=e("Connect an AI agent"),t[7]=e,t[8]=g):g=t[8];let x;t[9]!==g?(x=l("span",{className:"text-sm font-medium text-foreground",children:g}),t[9]=g,t[10]=x):x=t[10];let b;t[11]!==e?(b=e("Drive this deployment from an AI agent over the Model Context Protocol — it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[11]=e,t[12]=b):b=t[12];let y;t[13]!==b?(y=l("span",{className:"text-xs text-muted-foreground",children:b}),t[13]=b,t[14]=y):y=t[14];let S;t[15]!==x||t[16]!==y?(S=h("div",{className:"flex flex-col gap-1.5 p-4",children:[x,y]}),t[15]=x,t[16]=y,t[17]=S):S=t[17];let A;t[18]===Symbol.for("react.memo_cache_sentinel")?(A=l("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[18]=A):A=t[18];let k;t[19]!==a||t[20]!==e?(k=e(a==="config"?"Copied":"Copy MCP config"),t[19]=a,t[20]=e,t[21]=k):k=t[21];let v;t[22]!==k?(v=l(Ve,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:k}),t[22]=k,t[23]=v):v=t[23];let C;t[24]!==a||t[25]!==e?(C=e(a==="prompt"?"Copied":"Copy agent prompt"),t[24]=a,t[25]=e,t[26]=C):C=t[26];let w;t[27]!==C?(w=l(Ve,{"data-testid":"home-connect-agent-copy-prompt",onClick:p,size:"xs",variant:"outline",children:C}),t[27]=C,t[28]=w):w=t[28];let N;t[29]!==v||t[30]!==w?(N=h("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[A,h("div",{className:"flex flex-wrap gap-2",children:[v,w]})]}),t[29]=v,t[30]=w,t[31]=N):N=t[31];let _;return t[32]!==S||t[33]!==N?(_=h(B,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[S,N]}),t[32]=S,t[33]=N,t[34]=_):_=t[34],_},$t=nt(()=>import("../packem_chunks/sparkline.js")),qe=t=>{if(t<1e3)return`${String(Math.round(t))}ms`;const e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},At=(t,e)=>{const n=Math.max(0,Math.round((e-t)/1e3));if(n<60)return`${String(n)}s ago`;const s=Math.round(n/60);if(s<60)return`${String(s)}m ago`;const a=Math.round(s/60);return a<24?`${String(a)}h ago`:`${String(Math.round(a/24))}d ago`},Qe=(t,e)=>{if(t===void 0||t.length===0)return[];const n=new Map;for(const s of t)n.set(s.bucketMs,(n.get(s.bucketMs)??0)+s[e]);return[...n.entries()].toSorted(([s],[a])=>s-a).map(([,s])=>s)},He=(t,e=!0)=>{if(t.length<4)return null;const n=Math.floor(t.length/2),s=t.slice(0,n).reduce((o,i)=>o+i,0),a=t.slice(n).reduce((o,i)=>o+i,0);if(s===0)return null;const r=(a-s)/s*100;return{positive:e?r>=0:r<=0,text:`${r>=0?"+":""}${r.toFixed(1)}%`}},Re=t=>{const e=$(24),{delta:n,footer:s,label:a,trend:r,unit:o,value:i}=t,c=I();let m;e[0]!==a?(m=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[0]=a,e[1]=m):m=e[1];let d;e[2]!==i?(d=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[2]=i,e[3]=d):d=e[3];let f;e[4]!==o?(f=o!==void 0&&l("span",{className:"text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=f):f=e[5];let u;e[6]!==d||e[7]!==f?(u=h("span",{className:"flex items-baseline gap-1.5",children:[d,f]}),e[6]=d,e[7]=f,e[8]=u):u=e[8];let p;e[9]!==r?(p=r!==void 0&&l(st,{fallback:l("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:l($t,{data:r})}),e[9]=r,e[10]=p):p=e[10];let g;e[11]!==u||e[12]!==p?(g=h("div",{className:"flex items-center justify-between gap-3",children:[u,p]}),e[11]=u,e[12]=p,e[13]=g):g=e[13];let x;e[14]!==m||e[15]!==g?(x=h("div",{className:"flex flex-col gap-2.5 p-4",children:[m,g]}),e[14]=m,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==n||e[18]!==s||e[19]!==c?(b=n==null?s!=null&&l("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:s}):h("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[l("span",{className:Xe("font-semibold",n.positive?"text-success":"text-destructive"),children:n.text})," ",l("span",{className:"text-muted-foreground",children:c("vs. prev.")})]}),e[17]=n,e[18]=s,e[19]=c,e[20]=b):b=e[20];let y;return e[21]!==x||e[22]!==b?(y=h(B,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=y):y=e[23],y},Lt=()=>{const t=$(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:l("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},Fe=t=>{const e=$(7),{command:n,label:s}=t;let a;e[0]!==s?(a=l("div",{className:"p-4",children:l("span",{className:"text-sm font-medium text-foreground",children:s})}),e[0]=s,e[1]=a):a=e[1];let r;e[2]!==n?(r=l("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:l("code",{className:"font-mono text-xs text-muted-foreground",children:n})}),e[2]=n,e[3]=r):r=e[3];let o;return e[4]!==a||e[5]!==r?(o=h(B,{className:"justify-between gap-0 py-0",children:[a,r]}),e[4]=a,e[5]=r,e[6]=o):o=e[6],o},Ge=t=>{const e=$(18),{count:n,onView:s,testId:a,title:r}=t,o=I();let i;e[0]!==r?(i=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=i):i=e[1];let c;e[2]!==n||e[3]!==o?(c=n===null?l("span",{className:"text-xs text-muted-foreground",children:o("No data yet")}):l(Ye,{variant:n>0?"destructive":"success",children:n>0?n:o("All clear")}),e[2]=n,e[3]=o,e[4]=c):c=e[4];let m;e[5]!==i||e[6]!==c?(m=h("div",{className:"flex items-start justify-between gap-2 p-4",children:[i,c]}),e[5]=i,e[6]=c,e[7]=m):m=e[7];let d;e[8]!==o?(d=o("View"),e[8]=o,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=l(Lt,{}),e[10]=f):f=e[10];let u;e[11]!==s||e[12]!==d?(u=h("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:s,type:"button",children:[d,f]}),e[11]=s,e[12]=d,e[13]=u):u=e[13];let p;return e[14]!==m||e[15]!==u||e[16]!==a?(p=h(B,{className:"justify-between gap-0 py-0","data-testid":a,children:[m,u]}),e[14]=m,e[15]=u,e[16]=a,e[17]=p):p=e[17],p},Mt=t=>{const e=$(7),{functions:n}=t,s=I();let a;if(e[0]!==n||e[1]!==s){const r=[...n].toSorted(Rt).slice(0,5);let o;e[3]!==s?(o=s("Top functions"),e[3]=s,e[4]=o):o=e[4];let i;e[5]!==o?(i=l("div",{className:"border-b border-border px-4 py-3",children:l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[5]=o,e[6]=i):i=e[6],a=h(B,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[i,r.length===0?l("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:s("No functions called yet.")}):h("div",{className:"divide-y divide-border",children:[h("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[l("span",{children:s("Function")}),l("span",{className:"text-end",children:s("Calls")}),l("span",{className:"w-12 text-end",children:s("Avg")}),l("span",{className:"w-8 text-end",children:s("Err")})]}),r.map(Et)]})]}),e[0]=n,e[1]=s,e[2]=a}else a=e[2];return a},It=t=>{const e=$(26),{subs:n}=t,s=I();let a;e[0]!==s?(a=s("Live connections"),e[0]=s,e[1]=a):a=e[1];let r;e[2]!==a?(r=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[2]=a,e[3]=r):r=e[3];const o=n?.totalConnections??0;let i;e[4]!==o?(i=o.toLocaleString(),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==i?(c=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let m;e[8]!==s?(m=s("sockets"),e[8]=s,e[9]=m):m=e[9];let d;e[10]!==m?(d=l("span",{className:"text-xs text-muted-foreground",children:m}),e[10]=m,e[11]=d):d=e[11];let f;e[12]!==c||e[13]!==d?(f=h("span",{className:"flex items-baseline gap-1.5",children:[c,d]}),e[12]=c,e[13]=d,e[14]=f):f=e[14];const u=n?.totalSubscriptions??0;let p;e[15]!==u?(p=u.toLocaleString(),e[15]=u,e[16]=p):p=e[16];let g;e[17]!==s?(g=s("active subscriptions"),e[17]=s,e[18]=g):g=e[18];let x;e[19]!==p||e[20]!==g?(x=h("span",{className:"text-[11px] text-muted-foreground",children:[p," ",g]}),e[19]=p,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==r||e[24]!==f?(b=l(B,{"data-testid":"home-live-connections",children:h(Ze,{className:"flex flex-col gap-2.5 py-4",children:[r,f,x]})}),e[22]=x,e[23]=r,e[24]=f,e[25]=b):b=e[25],b},Tt=t=>{const e=$(7),{entries:n}=t,s=I();let a;if(e[0]!==n||e[1]!==s){const r=Date.now();let o;e[3]!==s?(o=s("Recent activity"),e[3]=s,e[4]=o):o=e[4];let i;e[5]!==o?(i=l("div",{className:"border-b border-border px-4 py-3",children:l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[5]=o,e[6]=i):i=e[6],a=h(B,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[i,n.length===0?l("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:s("No recent activity.")}):l("ul",{className:"divide-y divide-border",children:n.slice(0,5).map(c=>h("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[h("span",{className:"flex min-w-0 items-center gap-2",children:[l("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),h("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&h("span",{className:"text-muted-foreground",children:[" · ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),l("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:At(c.ts,r)})]},c.seq))})]}),e[0]=n,e[1]=s,e[2]=a}else a=e[2];return a},Ot=t=>{const e=t.reduce((n,s)=>n+s.calls,0);return e===0?null:t.reduce((n,s)=>n+s.totalDurationMs,0)/e},Zt=t=>{const e=$(151),{initialShardKey:n}=t,s=I(),a=Je(),r=n??"";let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={},e[0]=o):o=e[0];let i;e[1]!==r?(i={shardKey:r},e[1]=r,e[2]=i):i=e[2];const c=_e(Ne.getMetrics,o,i);let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m={},e[3]=m):m=e[3];let d;e[4]!==r?(d={shardKey:r},e[4]=r,e[5]=d):d=e[5];const f=_e(Ne.getFunctionStats,m,d);let u,p;e[6]===Symbol.for("react.memo_cache_sentinel")?(u={},p={shardKey:""},e[6]=u,e[7]=p):(u=e[6],p=e[7]);const g=_e(Ne.getSecurityAudit,u,p);let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==r?(b={shardKey:r},e[9]=r,e[10]=b):b=e[10];const y=_e(Ne.listSubscriptions,x,b);let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S={},e[11]=S):S=e[11];let A;e[12]!==r?(A={shardKey:r},e[12]=r,e[13]=A):A=e[13];const k=_e(Ne.getAuditLog,S,A),v=c.data??null;let C,w,N,_,L,M,D,T,O,P,F,q,R,E,U,K,z,V;if(e[14]!==k.data||e[15]!==g.data||e[16]!==v||e[17]!==c.data||e[18]!==a||e[19]!==f.data||e[20]!==y.data||e[21]!==s){_=Array.isArray(f.data?.functions)?f.data.functions:[],D=y.data??null;let $e;e[40]!==k.data?($e=Array.isArray(k.data?.entries)?k.data.entries:[],e[40]=k.data,e[41]=$e):$e=e[41],w=$e,L=c.data===void 0||f.data===void 0?null:dt(v,_).length,M=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Ae;e[42]!==a?(Ae=()=>{Se(a({to:"/security"}))},e[42]=a,e[43]=Ae):Ae=e[43],V=Ae;let Le;e[44]!==a?(Le=()=>{Se(a({to:"/insights"}))},e[44]=a,e[45]=Le):Le=e[45],z=Le;const Me=Qe(v?.history,"calls"),Ie=Qe(v?.history,"errors"),ze=Ot(_),Te=Math.max(0,..._.map(jt)),j=v?.cache;let Oe;e[46]!==j?(Oe=j!=null&&j.hits+j.misses>0?Math.round(j.hits/(j.hits+j.misses)*100):null,e[46]=j,e[47]=Oe):Oe=e[47],N=Oe,U="flex flex-col gap-6",K="lunora-home",F="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",q="home-health";const je=He(Me);let xe;e[48]!==s?(xe=s("Requests"),e[48]=s,e[49]=xe):xe=e[49];const Be=v?.requests??0;let be;e[50]!==Be?(be=Be.toLocaleString(),e[50]=Be,e[51]=be):be=e[51],e[52]!==Me||e[53]!==je||e[54]!==xe||e[55]!==be?(R=l(Re,{delta:je,label:xe,trend:Me,value:be}),e[52]=Me,e[53]=je,e[54]=xe,e[55]=be,e[56]=R):R=e[56];const De=He(Ie,!1);let ye;e[57]!==s?(ye=s("Errors"),e[57]=s,e[58]=ye):ye=e[58];const Pe=v?.errors??0;let ve;e[59]!==Pe?(ve=Pe.toLocaleString(),e[59]=Pe,e[60]=ve):ve=e[60],e[61]!==Ie||e[62]!==De||e[63]!==ye||e[64]!==ve?(E=l(Re,{delta:De,label:ye,trend:Ie,value:ve}),e[61]=Ie,e[62]=De,e[63]=ye,e[64]=ve,e[65]=E):E=e[65],C=Re,e[66]!==Te||e[67]!==s?(T=Te>0?`${s("max")} ${qe(Te)}`:void 0,e[66]=Te,e[67]=s,e[68]=T):T=e[68],e[69]!==s?(O=s("Avg latency"),e[69]=s,e[70]=O):O=e[70],P=ze===null?"—":qe(ze),e[14]=k.data,e[15]=g.data,e[16]=v,e[17]=c.data,e[18]=a,e[19]=f.data,e[20]=y.data,e[21]=s,e[22]=C,e[23]=w,e[24]=N,e[25]=_,e[26]=L,e[27]=M,e[28]=D,e[29]=T,e[30]=O,e[31]=P,e[32]=F,e[33]=q,e[34]=R,e[35]=E,e[36]=U,e[37]=K,e[38]=z,e[39]=V}else C=e[22],w=e[23],N=e[24],_=e[25],L=e[26],M=e[27],D=e[28],T=e[29],O=e[30],P=e[31],F=e[32],q=e[33],R=e[34],E=e[35],U=e[36],K=e[37],z=e[38],V=e[39];let W;e[71]!==C||e[72]!==T||e[73]!==O||e[74]!==P?(W=l(C,{footer:T,label:O,value:P}),e[71]=C,e[72]=T,e[73]=O,e[74]=P,e[75]=W):W=e[75];let Q;e[76]!==N||e[77]!==s?(Q=N===null?void 0:`${String(N)}% ${s("cache hit")}`,e[76]=N,e[77]=s,e[78]=Q):Q=e[78];let H;e[79]!==s?(H=s("Database size"),e[79]=s,e[80]=H):H=e[80];const Ee=v?.databaseSize??null;let G;e[81]!==Ee?(G=ct(Ee),e[81]=Ee,e[82]=G):G=e[82];let J;e[83]!==Q||e[84]!==H||e[85]!==G?(J=l(Re,{footer:Q,label:H,value:G}),e[83]=Q,e[84]=H,e[85]=G,e[86]=J):J=e[86];let Y;e[87]!==F||e[88]!==q||e[89]!==R||e[90]!==E||e[91]!==W||e[92]!==J?(Y=h("div",{className:F,"data-testid":q,children:[R,E,W,J]}),e[87]=F,e[88]=q,e[89]=R,e[90]=E,e[91]=W,e[92]=J,e[93]=Y):Y=e[93];let ke;e[94]===Symbol.for("react.memo_cache_sentinel")?(ke=l(xt,{}),e[94]=ke):ke=e[94];let Z;e[95]!==_?(Z=l("div",{className:"lg:col-span-2",children:l(Mt,{functions:_})}),e[95]=_,e[96]=Z):Z=e[96];let X;e[97]!==D?(X=l(It,{subs:D}),e[97]=D,e[98]=X):X=e[98];let ee;e[99]!==w?(ee=l(Tt,{entries:w}),e[99]=w,e[100]=ee):ee=e[100];let te;e[101]!==X||e[102]!==ee?(te=h("div",{className:"flex flex-col gap-3",children:[X,ee]}),e[101]=X,e[102]=ee,e[103]=te):te=e[103];let se;e[104]!==Z||e[105]!==te?(se=h("div",{className:"grid gap-3 lg:grid-cols-3",children:[Z,te]}),e[104]=Z,e[105]=te,e[106]=se):se=e[106];let ne;e[107]!==s?(ne=s("Advisors"),e[107]=s,e[108]=ne):ne=e[108];let le;e[109]!==ne?(le=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ne}),e[109]=ne,e[110]=le):le=e[110];let ae;e[111]!==L||e[112]!==M||e[113]!==s||e[114]!==z||e[115]!==V?(ae=M===0&&L===0?l(lt,{description:s("No security or performance issues detected."),icon:h("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[l("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),l("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:s("No issues found")}):h("div",{className:"grid gap-3 sm:grid-cols-2",children:[l(Ge,{count:M,onView:V,testId:"home-security",title:s("Security findings")}),l(Ge,{count:L,onView:z,testId:"home-performance",title:s("Performance issues")})]}),e[111]=L,e[112]=M,e[113]=s,e[114]=z,e[115]=V,e[116]=ae):ae=e[116];let re;e[117]!==le||e[118]!==ae?(re=h("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[le,ae]}),e[117]=le,e[118]=ae,e[119]=re):re=e[119];let oe;e[120]!==s?(oe=s("Get connected"),e[120]=s,e[121]=oe):oe=e[121];let ie;e[122]!==oe?(ie=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:oe}),e[122]=oe,e[123]=ie):ie=e[123];let ce;e[124]!==s?(ce=s("Client SDK"),e[124]=s,e[125]=ce):ce=e[125];let de;e[126]!==ce?(de=l(Fe,{command:"npm i @lunora/client",label:ce}),e[126]=ce,e[127]=de):de=e[127];let ue;e[128]!==s?(ue=s("React"),e[128]=s,e[129]=ue):ue=e[129];let me;e[130]!==ue?(me=l(Fe,{command:"npm i @lunora/react",label:ue}),e[130]=ue,e[131]=me):me=e[131];let fe;e[132]!==s?(fe=s("CLI"),e[132]=s,e[133]=fe):fe=e[133];let pe;e[134]!==fe?(pe=l(Fe,{command:"lunora dev",label:fe}),e[134]=fe,e[135]=pe):pe=e[135];let he;e[136]!==de||e[137]!==me||e[138]!==pe?(he=h("div",{className:"grid gap-3 sm:grid-cols-3",children:[de,me,pe]}),e[136]=de,e[137]=me,e[138]=pe,e[139]=he):he=e[139];let Ce;e[140]===Symbol.for("react.memo_cache_sentinel")?(Ce=l(wt,{}),e[140]=Ce):Ce=e[140];let ge;e[141]!==ie||e[142]!==he?(ge=h("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[ie,he,Ce]}),e[141]=ie,e[142]=he,e[143]=ge):ge=e[143];let we;return e[144]!==U||e[145]!==K||e[146]!==Y||e[147]!==se||e[148]!==re||e[149]!==ge?(we=h("div",{className:U,"data-testid":K,children:[Y,ke,se,re,ge]}),e[144]=U,e[145]=K,e[146]=Y,e[147]=se,e[148]=re,e[149]=ge,e[150]=we):we=e[150],we};function Rt(t,e){return e.calls-t.calls}function Et(t){return h("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[l("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),l("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),l("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:qe(t.calls>0?t.totalDurationMs/t.calls:0)}),l("span",{className:Xe("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}function jt(t){return t.maxDurationMs}export{Zt as H,ft as u};
@@ -1,2 +1,2 @@
1
1
  const a=(t,n,r,o,i)=>{switch(n){case"action":return t.action(r,o,i);case"mutation":return t.mutation(r,o,i);default:return t.query(r,o,i)}},f=t=>({__lunoraRef:t}),u=t=>{const n=t.trim();return n===""?{}:{shardKey:n}},d=t=>t instanceof Error?t.message:String(t),l=t=>{if(t===null||typeof t!="object"||!("code"in t))return;const{code:n}=t;return typeof n=="string"?n:void 0},g=t=>{if(t===null||typeof t!="object"||!("hint"in t))return;const{hint:n}=t;return typeof n=="string"?n:Array.isArray(n)?n.filter(r=>typeof r=="string").join(`
2
- `):void 0},y=t=>{if(t===null||typeof t!="object"||!("docsUrl"in t))return;const n=t.docsUrl;if(typeof n=="string")try{const{protocol:r}=new URL(n);return r==="http:"||r==="https:"?n:void 0}catch{return}},s=t=>{if(t==null)return"—";if(t<1024)return`${t.toString()} B`;const n=["KB","MB","GB","TB"];let r=t/1024,o=0;for(;r>=1024&&o<n.length-1;)r/=1024,o+=1;return`${r.toFixed(1)} ${n[o]??"TB"}`},e=t=>{if(t==null)return"";switch(typeof t){case"bigint":case"boolean":case"number":return t.toString();case"string":return t;case"symbol":return t.toString();default:return t instanceof ArrayBuffer||ArrayBuffer.isView(t)?`<bytes: ${s(t.byteLength)}>`:JSON.stringify(t)}},h=(t,n)=>typeof n=="bigint"||n instanceof ArrayBuffer||ArrayBuffer.isView(n)?e(n):n,c=(t,n)=>{t.catch(r=>{})},m=t=>{if(t!==void 0&&t!=="")return t;const n=globalThis.location;return n?.origin!==void 0&&n.origin!==""?n.origin:"http://localhost:5173"},p=t=>{const n="navigator"in globalThis?globalThis.navigator.clipboard:void 0;return n===void 0?!1:(c(n.writeText(t)),!0)},b=(t,n="")=>{if(t==null||t==="")return n;const r=new Date(t);return Number.isNaN(r.getTime())?String(t):r.toLocaleString()};export{y as a,d as b,f as c,u as d,g as e,c as f,p as g,e as h,b as i,h as j,a as k,s as l,l as m,m as r};
2
+ `):void 0},y=t=>{if(t===null||typeof t!="object"||!("docsUrl"in t))return;const n=t.docsUrl;if(typeof n=="string")try{const{protocol:r}=new URL(n);return r==="http:"||r==="https:"?n:void 0}catch{return}},s=t=>{if(t==null)return"—";if(t<1024)return`${t.toString()} B`;const n=["KB","MB","GB","TB"];let r=t/1024,o=0;for(;r>=1024&&o<n.length-1;)r/=1024,o+=1;return`${r.toFixed(1)} ${n[o]??"TB"}`},e=t=>{if(t==null)return"";switch(typeof t){case"bigint":case"boolean":case"number":return t.toString();case"string":return t;case"symbol":return t.toString();default:return t instanceof ArrayBuffer||ArrayBuffer.isView(t)?`<bytes: ${s(t.byteLength)}>`:JSON.stringify(t)}},h=(t,n)=>typeof n=="bigint"||n instanceof ArrayBuffer||ArrayBuffer.isView(n)?e(n):n,c=(t,n)=>{t.catch(r=>{})},p=t=>{if(t!==void 0&&t!=="")return t;const n=globalThis.location;return n?.origin!==void 0&&n.origin!==""?n.origin:"http://localhost:5173"},m=t=>{const n="navigator"in globalThis?globalThis.navigator.clipboard:void 0;return n===void 0?!1:(c(n.writeText(t)),!0)},b=t=>`"${t.replaceAll('"','""')}"`,B=(t,n="")=>{if(t==null||t==="")return n;const r=new Date(t);return Number.isNaN(r.getTime())?String(t):r.toLocaleString()};export{y as a,d as b,f as c,u as d,g as e,c as f,m as g,e as h,B as i,h as j,a as k,s as l,l as m,p as r,b as s};
@@ -1 +1 @@
1
- import{c as h}from"react/compiler-runtime";import{f as v}from"./log-fields-SBxKyBug.js";import{B as x}from"./badge-cAk9Di1Q.js";import{i as L}from"./internal-CwaF9YNk.js";import{jsx as o,jsxs as g,Fragment as N}from"react/jsx-runtime";const w={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},B=p=>{const e=h(21),{entry:t}=p;let m;e[0]!==t.fields?(m=v(t.fields),e[0]=t.fields,e[1]=m):m=e[1];const c=m;let l;e[2]!==t.timestamp?(l=L(t.timestamp),e[2]=t.timestamp,e[3]=l):l=e[3];let s;e[4]!==l?(s=o("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:l}),e[4]=l,e[5]=s):s=e[5];const f=w[t.level];let r;e[6]!==t.level||e[7]!==f?(r=o("span",{className:"w-20 shrink-0",role:"gridcell",children:o(x,{variant:f,children:t.level})}),e[6]=t.level,e[7]=f,e[8]=r):r=e[8];const u=t.functionPath??"—";let i;e[9]!==u?(i=o("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:u}),e[9]=u,e[10]=i):i=e[10];let a;e[11]!==c?(a=c===""?null:o("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:c}),e[11]=c,e[12]=a):a=e[12];let n;e[13]!==t.message||e[14]!==a?(n=g("span",{className:"flex-1 truncate",role:"gridcell",children:[t.message,a]}),e[13]=t.message,e[14]=a,e[15]=n):n=e[15];let d;return e[16]!==s||e[17]!==r||e[18]!==i||e[19]!==n?(d=g(N,{children:[s,r,i,n]}),e[16]=s,e[17]=r,e[18]=i,e[19]=n,e[20]=d):d=e[20],d};export{B as L,w as a};
1
+ import{c as h}from"react/compiler-runtime";import{f as v}from"./log-fields-SBxKyBug.js";import{B as x}from"./badge-cAk9Di1Q.js";import{i as L}from"./internal-7bgd8inO.js";import{jsx as o,jsxs as g,Fragment as N}from"react/jsx-runtime";const w={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},B=p=>{const e=h(21),{entry:t}=p;let m;e[0]!==t.fields?(m=v(t.fields),e[0]=t.fields,e[1]=m):m=e[1];const c=m;let l;e[2]!==t.timestamp?(l=L(t.timestamp),e[2]=t.timestamp,e[3]=l):l=e[3];let s;e[4]!==l?(s=o("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:l}),e[4]=l,e[5]=s):s=e[5];const f=w[t.level];let r;e[6]!==t.level||e[7]!==f?(r=o("span",{className:"w-20 shrink-0",role:"gridcell",children:o(x,{variant:f,children:t.level})}),e[6]=t.level,e[7]=f,e[8]=r):r=e[8];const u=t.functionPath??"—";let i;e[9]!==u?(i=o("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:u}),e[9]=u,e[10]=i):i=e[10];let a;e[11]!==c?(a=c===""?null:o("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:c}),e[11]=c,e[12]=a):a=e[12];let n;e[13]!==t.message||e[14]!==a?(n=g("span",{className:"flex-1 truncate",role:"gridcell",children:[t.message,a]}),e[13]=t.message,e[14]=a,e[15]=n):n=e[15];let d;return e[16]!==s||e[17]!==r||e[18]!==i||e[19]!==n?(d=g(N,{children:[s,r,i,n]}),e[16]=s,e[17]=r,e[18]=i,e[19]=n,e[20]=d):d=e[20],d};export{B as L,w as a};
@@ -1 +1 @@
1
- import{o as u}from"./use-admin-query-P0RJrjsD.js";const b="__lunora_admin__:",d=new Set(["action","mutation","query"]),r=Symbol("lunora.operationSeq"),g=t=>{if(typeof t!="object"||t===null)return;const n=t[r];return typeof n=="number"?n:void 0},h=(t,n)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,r,{configurable:!0,enumerable:!1,value:n,writable:!0})}catch{}},p=t=>{if(typeof t!="object"||t===null)return;const n=t.__lunoraRef;return typeof n=="string"&&n.startsWith(b)?n:void 0},O=t=>{if(typeof t!="object"||t===null)return"";const{shardKey:n}=t;return typeof n=="string"?n:""},E=t=>new Proxy(t,{get(n,c,a){const i=Reflect.get(n,c,a);if(typeof i!="function"||typeof c!="string"||!d.has(c))return typeof i=="function"?i.bind(n):i;const f=i;return async(...e)=>{const l=p(e[0]);if(l===void 0)return f.apply(n,e);const y=typeof e[1]=="object"&&e[1]!==null?e[1]:{},s=u.start(l,y,O(e[2]));try{const o=await f.apply(n,e);return u.settle(s,{result:o}),o}catch(o){throw u.settle(s,{error:o instanceof Error?o.message:String(o)}),h(o,s),o}}}});export{g as o,E as w};
1
+ import{o as u}from"./use-admin-query-DV9xmFl8.js";const b="__lunora_admin__:",d=new Set(["action","mutation","query"]),r=Symbol("lunora.operationSeq"),g=t=>{if(typeof t!="object"||t===null)return;const n=t[r];return typeof n=="number"?n:void 0},h=(t,n)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,r,{configurable:!0,enumerable:!1,value:n,writable:!0})}catch{}},p=t=>{if(typeof t!="object"||t===null)return;const n=t.__lunoraRef;return typeof n=="string"&&n.startsWith(b)?n:void 0},O=t=>{if(typeof t!="object"||t===null)return"";const{shardKey:n}=t;return typeof n=="string"?n:""},E=t=>new Proxy(t,{get(n,c,a){const i=Reflect.get(n,c,a);if(typeof i!="function"||typeof c!="string"||!d.has(c))return typeof i=="function"?i.bind(n):i;const f=i;return async(...e)=>{const l=p(e[0]);if(l===void 0)return f.apply(n,e);const y=typeof e[1]=="object"&&e[1]!==null?e[1]:{},s=u.start(l,y,O(e[2]));try{const o=await f.apply(n,e);return u.settle(s,{result:o}),o}catch(o){throw u.settle(s,{error:o instanceof Error?o.message:String(o)}),h(o,s),o}}}});export{g as o,E as w};
@@ -1,4 +1,4 @@
1
- import{c as L}from"react/compiler-runtime";import{useState as R,useEffect as oe,createContext as ie,use as ae}from"react";import{b as q,g as V,f as le,k as de,c as ce,d as ue}from"./internal-CwaF9YNk.js";import{SentIcon as fe,Copy01Icon as me,Search01Icon as pe}from"@hugeicons/core-free-icons";import{HugeiconsIcon as W}from"@hugeicons/react";import{I as he}from"./input-CY5W3wzv.js";import{useT as K}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{B as z}from"./button-BOPLD1un.js";import{jsx as i,jsxs as k,Fragment as ge}from"react/jsx-runtime";import{B as xe}from"./badge-cAk9Di1Q.js";import{ShardInput as be}from"./ShardInput-XumEzeT0.js";import{L as G}from"./label-BOUo-DP0.js";import{T as ve}from"./textarea-DpO3i-Qo.js";import{LunoraError as ye}from"@lunora/errors";import{useLunora as Ne}from"@lunora/react";import{c as X}from"./utils-bhneXptQ.js";const xt=function(t,e,r){const s=L(10);let n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n={kind:"loading"},s[0]=n):n=s[0];const[o,l]=R(n);let a,m;s[1]!==r||s[2]!==e||s[3]!==t?(a=()=>{if(t!==void 0)return;let c=!1;return e().then(u=>(c||l(r(u)),u)).catch(u=>{c||l({kind:"error",message:q(u)})}),()=>{c=!0}},m=[r,e,t],s[1]=r,s[2]=e,s[3]=t,s[4]=a,s[5]=m):(a=s[4],m=s[5]),oe(a,m);let d;return s[6]!==r||s[7]!==o||s[8]!==t?(d=t===void 0?o:r(t),s[6]=r,s[7]=o,s[8]=t,s[9]=d):d=s[9],d},ke=t=>typeof t=="number"?"number":typeof t=="boolean"?"boolean":"string",Q=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)},F=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=>F(e)).join(" | "):t.type==="array"?`array<${F(t.items)}>`:t.type??"any",Se=t=>{const e=Q(t);return e!==void 0?t.type??ke(e[0]):F(t)},we=t=>{const e=Q(t);return e===void 0?void 0:e.map(r=>JSON.stringify(r)).join(" | ")},Oe=t=>{const e=[];t.minimum!==void 0?e.push(`${String(t.minimum)} ≤`):t.exclusiveMinimum!==void 0&&e.push(`${String(t.exclusiveMinimum)} <`);const r=e.length>0;e.push("value"),t.maximum!==void 0?e.push(`≤ ${String(t.maximum)}`):t.exclusiveMaximum!==void 0&&e.push(`< ${String(t.exclusiveMaximum)}`);const s=e.length>(r?2:1);return r||s?e.join(" "):void 0},$e=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},M=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 M(t.anyOf[0]);switch(t.type){case"array":return[];case"boolean":return!1;case"number":return 0;case"object":{const e={};for(const[r,s]of Object.entries(t.properties??{}))e[r]=M(s);return e}case"string":return"";default:return null}},D=t=>{const e=L(7),{label:r,value:s}=t;let n;e[0]!==r?(n=i("span",{className:"text-muted-foreground",children:r}),e[0]=r,e[1]=n):n=e[1];let o;e[2]!==s?(o=i("span",{className:"text-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let l;return e[4]!==n||e[5]!==o?(l=k("span",{className:"inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 font-mono text-[10px]",children:[n,o]}),e[4]=n,e[5]=o,e[6]=l):l=e[6],l},Te=t=>{const e=L(40),{name:r,required:s,schema:n}=t,o=K();let l;e[0]!==n?(l=Oe(n),e[0]=n,e[1]=l):l=e[1];const a=l;let m;e[2]!==n?(m=we(n),e[2]=n,e[3]=m):m=e[3];const d=m,c=n["x-lunora-table"],u=n.format!==void 0||a!==void 0||d!==void 0||c!==void 0;let v;e[4]!==n?(v=$e(n),e[4]=n,e[5]=v):v=e[5];const b=v,f=s?"*":"?";let p;e[6]!==f?(p=i("span",{className:"text-muted-foreground",children:f}),e[6]=f,e[7]=p):p=e[7];let y;e[8]!==r||e[9]!==p?(y=k("span",{className:"font-mono text-foreground",children:[r,p]}),e[8]=r,e[9]=p,e[10]=y):y=e[10];let O;e[11]!==n?(O=Se(n),e[11]=n,e[12]=O):O=e[12];let h;e[13]!==O?(h=i("span",{className:"font-mono text-muted-foreground",children:O}),e[13]=O,e[14]=h):h=e[14];let g;e[15]!==y||e[16]!==h?(g=k("div",{className:"flex items-baseline gap-2",children:[y,h]}),e[15]=y,e[16]=h,e[17]=g):g=e[17];let x;e[18]!==n.description?(x=n.description!==void 0&&i("p",{className:"max-w-prose text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=x):x=e[19];let N;e[20]!==u||e[21]!==a||e[22]!==c||e[23]!==n.format||e[24]!==o||e[25]!==d?(N=u&&k("div",{className:"flex flex-wrap gap-1",children:[n.format!==void 0&&i(D,{label:o("Format"),value:n.format}),a!==void 0&&i(D,{label:o("Range"),value:a}),d!==void 0&&i(D,{label:o("Value in"),value:d}),c!==void 0&&i(D,{label:o("relation"),value:c})]}),e[20]=u,e[21]=a,e[22]=c,e[23]=n.format,e[24]=o,e[25]=d,e[26]=N):N=e[26];let S;e[27]!==x||e[28]!==N||e[29]!==g?(S=k("div",{className:"flex flex-col gap-1 py-2",children:[g,x,N]}),e[27]=x,e[28]=N,e[29]=g,e[30]=S):S=e[30];const w=S;if(b===void 0){let T;return e[31]!==w?(T=i("div",{className:"border-b border-border/50 last:border-b-0",children:w}),e[31]=w,e[32]=T):T=e[32],T}let $;e[33]!==w?($=i("summary",{className:"cursor-pointer marker:text-muted-foreground",children:w}),e[33]=w,e[34]=$):$=e[34];let E;e[35]!==b?(E=i("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:i(Y,{schema:b})}),e[35]=b,e[36]=E):E=e[36];let C;return e[37]!==$||e[38]!==E?(C=k("details",{className:"border-b border-border/50 last:border-b-0",children:[$,E]}),e[37]=$,e[38]=E,e[39]=C):C=e[39],C},Y=t=>{const e=L(7),{schema:r}=t;let s;e[0]!==r.required?(s=new Set(r.required),e[0]=r.required,e[1]=s):s=e[1];const n=s;let o;e[2]!==r.properties?(o=Object.entries(r.properties??{}),e[2]=r.properties,e[3]=o):o=e[3];const l=o;let a;return e[4]!==n||e[5]!==l?(a=i("div",{className:"flex flex-col",children:l.map(m=>{const[d,c]=m;return i(Te,{name:d,required:n.has(d),schema:c},d)})}),e[4]=n,e[5]=l,e[6]=a):a=e[6],a},U=t=>{const e=L(10),{schema:r,testId:s}=t;if(r?.type!=="object"||Object.keys(r.properties??{}).length===0){let l;e[0]!==r?(l=F(r),e[0]=r,e[1]=l):l=e[1];let a;return e[2]!==l||e[3]!==s?(a=i("p",{className:"font-mono text-xs text-muted-foreground","data-testid":s,children:l}),e[2]=l,e[3]=s,e[4]=a):a=e[4],a}let n;e[5]!==r?(n=i(Y,{schema:r}),e[5]=r,e[6]=n):n=e[6];let o;return e[7]!==n||e[8]!==s?(o=i("div",{className:"text-xs","data-testid":s,children:n}),e[7]=n,e[8]=s,e[9]=o):o=e[9],o},Ce=["curl","javascript","lunora"],je={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},Ee=t=>`api.${t.replaceAll(/[/:]/g,".")}`,Pe=t=>{const e=M(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},Ae=(t,e,r)=>{const s=`${r}${e.httpPath}`,n=JSON.stringify(Pe(e),void 0,2),o=JSON.stringify(M(e.argsSchema)??{},void 0,2);switch(t){case"curl":{const l=e.method!=="GET"&&e.method!=="HEAD",a=[`curl -X ${e.method} ${JSON.stringify(s)}`];return l&&a.push(' -H "Content-Type: application/json"',` -d '${n}'`),a.join(` \\
1
+ import{c as L}from"react/compiler-runtime";import{useState as R,useEffect as oe,createContext as ie,use as ae}from"react";import{b as q,g as V,f as le,k as de,c as ce,d as ue}from"./internal-7bgd8inO.js";import{SentIcon as fe,Copy01Icon as me,Search01Icon as pe}from"@hugeicons/core-free-icons";import{HugeiconsIcon as W}from"@hugeicons/react";import{I as he}from"./input-CY5W3wzv.js";import{useT as K}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{B as z}from"./button-BOPLD1un.js";import{jsx as i,jsxs as k,Fragment as ge}from"react/jsx-runtime";import{B as xe}from"./badge-cAk9Di1Q.js";import{ShardInput as be}from"./ShardInput-XumEzeT0.js";import{L as G}from"./label-BOUo-DP0.js";import{T as ve}from"./textarea-DpO3i-Qo.js";import{LunoraError as ye}from"@lunora/errors";import{useLunora as Ne}from"@lunora/react";import{c as X}from"./utils-bhneXptQ.js";const xt=function(t,e,r){const s=L(10);let n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n={kind:"loading"},s[0]=n):n=s[0];const[o,l]=R(n);let a,m;s[1]!==r||s[2]!==e||s[3]!==t?(a=()=>{if(t!==void 0)return;let c=!1;return e().then(u=>(c||l(r(u)),u)).catch(u=>{c||l({kind:"error",message:q(u)})}),()=>{c=!0}},m=[r,e,t],s[1]=r,s[2]=e,s[3]=t,s[4]=a,s[5]=m):(a=s[4],m=s[5]),oe(a,m);let d;return s[6]!==r||s[7]!==o||s[8]!==t?(d=t===void 0?o:r(t),s[6]=r,s[7]=o,s[8]=t,s[9]=d):d=s[9],d},ke=t=>typeof t=="number"?"number":typeof t=="boolean"?"boolean":"string",Q=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)},F=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=>F(e)).join(" | "):t.type==="array"?`array<${F(t.items)}>`:t.type??"any",Se=t=>{const e=Q(t);return e!==void 0?t.type??ke(e[0]):F(t)},we=t=>{const e=Q(t);return e===void 0?void 0:e.map(r=>JSON.stringify(r)).join(" | ")},Oe=t=>{const e=[];t.minimum!==void 0?e.push(`${String(t.minimum)} ≤`):t.exclusiveMinimum!==void 0&&e.push(`${String(t.exclusiveMinimum)} <`);const r=e.length>0;e.push("value"),t.maximum!==void 0?e.push(`≤ ${String(t.maximum)}`):t.exclusiveMaximum!==void 0&&e.push(`< ${String(t.exclusiveMaximum)}`);const s=e.length>(r?2:1);return r||s?e.join(" "):void 0},$e=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},M=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 M(t.anyOf[0]);switch(t.type){case"array":return[];case"boolean":return!1;case"number":return 0;case"object":{const e={};for(const[r,s]of Object.entries(t.properties??{}))e[r]=M(s);return e}case"string":return"";default:return null}},D=t=>{const e=L(7),{label:r,value:s}=t;let n;e[0]!==r?(n=i("span",{className:"text-muted-foreground",children:r}),e[0]=r,e[1]=n):n=e[1];let o;e[2]!==s?(o=i("span",{className:"text-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let l;return e[4]!==n||e[5]!==o?(l=k("span",{className:"inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 font-mono text-[10px]",children:[n,o]}),e[4]=n,e[5]=o,e[6]=l):l=e[6],l},Te=t=>{const e=L(40),{name:r,required:s,schema:n}=t,o=K();let l;e[0]!==n?(l=Oe(n),e[0]=n,e[1]=l):l=e[1];const a=l;let m;e[2]!==n?(m=we(n),e[2]=n,e[3]=m):m=e[3];const d=m,c=n["x-lunora-table"],u=n.format!==void 0||a!==void 0||d!==void 0||c!==void 0;let v;e[4]!==n?(v=$e(n),e[4]=n,e[5]=v):v=e[5];const b=v,f=s?"*":"?";let p;e[6]!==f?(p=i("span",{className:"text-muted-foreground",children:f}),e[6]=f,e[7]=p):p=e[7];let y;e[8]!==r||e[9]!==p?(y=k("span",{className:"font-mono text-foreground",children:[r,p]}),e[8]=r,e[9]=p,e[10]=y):y=e[10];let O;e[11]!==n?(O=Se(n),e[11]=n,e[12]=O):O=e[12];let h;e[13]!==O?(h=i("span",{className:"font-mono text-muted-foreground",children:O}),e[13]=O,e[14]=h):h=e[14];let g;e[15]!==y||e[16]!==h?(g=k("div",{className:"flex items-baseline gap-2",children:[y,h]}),e[15]=y,e[16]=h,e[17]=g):g=e[17];let x;e[18]!==n.description?(x=n.description!==void 0&&i("p",{className:"max-w-prose text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=x):x=e[19];let N;e[20]!==u||e[21]!==a||e[22]!==c||e[23]!==n.format||e[24]!==o||e[25]!==d?(N=u&&k("div",{className:"flex flex-wrap gap-1",children:[n.format!==void 0&&i(D,{label:o("Format"),value:n.format}),a!==void 0&&i(D,{label:o("Range"),value:a}),d!==void 0&&i(D,{label:o("Value in"),value:d}),c!==void 0&&i(D,{label:o("relation"),value:c})]}),e[20]=u,e[21]=a,e[22]=c,e[23]=n.format,e[24]=o,e[25]=d,e[26]=N):N=e[26];let S;e[27]!==x||e[28]!==N||e[29]!==g?(S=k("div",{className:"flex flex-col gap-1 py-2",children:[g,x,N]}),e[27]=x,e[28]=N,e[29]=g,e[30]=S):S=e[30];const w=S;if(b===void 0){let T;return e[31]!==w?(T=i("div",{className:"border-b border-border/50 last:border-b-0",children:w}),e[31]=w,e[32]=T):T=e[32],T}let $;e[33]!==w?($=i("summary",{className:"cursor-pointer marker:text-muted-foreground",children:w}),e[33]=w,e[34]=$):$=e[34];let E;e[35]!==b?(E=i("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:i(Y,{schema:b})}),e[35]=b,e[36]=E):E=e[36];let C;return e[37]!==$||e[38]!==E?(C=k("details",{className:"border-b border-border/50 last:border-b-0",children:[$,E]}),e[37]=$,e[38]=E,e[39]=C):C=e[39],C},Y=t=>{const e=L(7),{schema:r}=t;let s;e[0]!==r.required?(s=new Set(r.required),e[0]=r.required,e[1]=s):s=e[1];const n=s;let o;e[2]!==r.properties?(o=Object.entries(r.properties??{}),e[2]=r.properties,e[3]=o):o=e[3];const l=o;let a;return e[4]!==n||e[5]!==l?(a=i("div",{className:"flex flex-col",children:l.map(m=>{const[d,c]=m;return i(Te,{name:d,required:n.has(d),schema:c},d)})}),e[4]=n,e[5]=l,e[6]=a):a=e[6],a},U=t=>{const e=L(10),{schema:r,testId:s}=t;if(r?.type!=="object"||Object.keys(r.properties??{}).length===0){let l;e[0]!==r?(l=F(r),e[0]=r,e[1]=l):l=e[1];let a;return e[2]!==l||e[3]!==s?(a=i("p",{className:"font-mono text-xs text-muted-foreground","data-testid":s,children:l}),e[2]=l,e[3]=s,e[4]=a):a=e[4],a}let n;e[5]!==r?(n=i(Y,{schema:r}),e[5]=r,e[6]=n):n=e[6];let o;return e[7]!==n||e[8]!==s?(o=i("div",{className:"text-xs","data-testid":s,children:n}),e[7]=n,e[8]=s,e[9]=o):o=e[9],o},Ce=["curl","javascript","lunora"],je={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},Ee=t=>`api.${t.replaceAll(/[/:]/g,".")}`,Pe=t=>{const e=M(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},Ae=(t,e,r)=>{const s=`${r}${e.httpPath}`,n=JSON.stringify(Pe(e),void 0,2),o=JSON.stringify(M(e.argsSchema)??{},void 0,2);switch(t){case"curl":{const l=e.method!=="GET"&&e.method!=="HEAD",a=[`curl -X ${e.method} ${JSON.stringify(s)}`];return l&&a.push(' -H "Content-Type: application/json"',` -d '${n}'`),a.join(` \\
2
2
  `)}case"lunora":return e.functionPath===void 0?`await fetch(${JSON.stringify(e.httpPath)}, { method: ${JSON.stringify(e.method)} });`:`import { useLunora } from "@lunora/react";
3
3
  import { api } from "./_generated/api";
4
4
 
@@ -1 +1 @@
1
- import{c as N}from"react/compiler-runtime";import{AreaChart as K,CartesianGrid as g,XAxis as w,Area as S,LineChart as X,Line as B}from"recharts";import{useT as R}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{h as $}from"./internal-CwaF9YNk.js";import{E as q,X as E,B as _,T as j,C as G,a as A,b as L}from"./bar-chart-CCyO67Uf.js";import{jsx as l,jsxs as b}from"react/jsx-runtime";const O=50,T={value:{colors:{dark:["var(--chart-1)"],light:["var(--chart-1)"]},label:"value"}},F=n=>{const e=n.columns.find(t=>n.rows.length>0&&n.rows.every(o=>typeof o[t]=="number"))??null;return{label:n.columns.find(t=>t!==e)??null,value:e}},H=n=>{const e=N(3),{data:a,kind:t}=n;let o;return e[0]!==a||e[1]!==t?(o=l(G,{className:"h-full w-full",config:T,children:t==="area"?b(K,{data:a,children:[l(g,{vertical:!1}),l(w,{axisLine:!1,dataKey:"label",tickLine:!1}),l(A,{content:l(L,{})}),l(S,{dataKey:"value",fill:"var(--color-value-0)",fillOpacity:.2,stroke:"var(--color-value-0)",type:"monotone"})]}):b(X,{data:a,children:[l(g,{vertical:!1}),l(w,{axisLine:!1,dataKey:"label",tickLine:!1}),l(A,{content:l(L,{})}),l(B,{dataKey:"value",dot:!1,stroke:"var(--color-value-0)",strokeWidth:2,type:"monotone"})]})}),e[0]=a,e[1]=t,e[2]=o):o=e[2],o},D=n=>{const e=N(21),{axes:a,result:t}=n,o=R();let d;e[0]!==t?(d=F(t),e[0]=t,e[1]=d):d=e[1];const x=d;let f;e[2]!==t.columns?(f=new Set(t.columns),e[2]=t.columns,e[3]=f):f=e[3];const m=f,h=a!==void 0&&m.has(a.x)?a.x:x.label;let v;e[4]!==a?.y||e[5]!==m?(v=a?.y.find(s=>m.has(s)),e[4]=a?.y,e[5]=m,e[6]=v):v=e[6];const k=v,u=k??x.value;let p;e[7]!==h||e[8]!==t.rows||e[9]!==u?(p=u===null?[]:t.rows.slice(0,O).map((s,c)=>({label:h===null?`#${(c+1).toString()}`:$(s[h]),value:Number(s[u])||0})),e[7]=h,e[8]=t.rows,e[9]=u,e[10]=p):p=e[10];const C=p;if(u===null){let s;e[11]!==o?(s=o("No numeric column to chart."),e[11]=o,e[12]=s):s=e[12];let c;return e[13]!==s?(c=l("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-chart-empty",children:s}),e[13]=s,e[14]=c):c=e[14],c}const r=a!==void 0&&k!==void 0?a.kind:"bar";let i;e[15]!==C||e[16]!==r?(i=r==="bar"?b(q,{className:"h-full w-full",config:T,data:C,children:[l(E,{dataKey:"label"}),l(_,{dataKey:"value"}),l(j,{})]}):l(H,{data:C,kind:r}),e[15]=C,e[16]=r,e[17]=i):i=e[17];let y;return e[18]!==r||e[19]!==i?(y=l("div",{className:"h-80 w-full p-3","data-chart-kind":r,"data-testid":"sql-chart",children:i}),e[18]=r,e[19]=i,e[20]=y):y=e[20],y};export{D as S};
1
+ import{c as N}from"react/compiler-runtime";import{AreaChart as K,CartesianGrid as g,XAxis as w,Area as S,LineChart as X,Line as B}from"recharts";import{useT as R}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{h as $}from"./internal-7bgd8inO.js";import{E as q,X as E,B as _,T as j,C as G,a as A,b as L}from"./bar-chart-CCyO67Uf.js";import{jsx as l,jsxs as b}from"react/jsx-runtime";const O=50,T={value:{colors:{dark:["var(--chart-1)"],light:["var(--chart-1)"]},label:"value"}},F=n=>{const e=n.columns.find(t=>n.rows.length>0&&n.rows.every(o=>typeof o[t]=="number"))??null;return{label:n.columns.find(t=>t!==e)??null,value:e}},H=n=>{const e=N(3),{data:a,kind:t}=n;let o;return e[0]!==a||e[1]!==t?(o=l(G,{className:"h-full w-full",config:T,children:t==="area"?b(K,{data:a,children:[l(g,{vertical:!1}),l(w,{axisLine:!1,dataKey:"label",tickLine:!1}),l(A,{content:l(L,{})}),l(S,{dataKey:"value",fill:"var(--color-value-0)",fillOpacity:.2,stroke:"var(--color-value-0)",type:"monotone"})]}):b(X,{data:a,children:[l(g,{vertical:!1}),l(w,{axisLine:!1,dataKey:"label",tickLine:!1}),l(A,{content:l(L,{})}),l(B,{dataKey:"value",dot:!1,stroke:"var(--color-value-0)",strokeWidth:2,type:"monotone"})]})}),e[0]=a,e[1]=t,e[2]=o):o=e[2],o},D=n=>{const e=N(21),{axes:a,result:t}=n,o=R();let d;e[0]!==t?(d=F(t),e[0]=t,e[1]=d):d=e[1];const x=d;let f;e[2]!==t.columns?(f=new Set(t.columns),e[2]=t.columns,e[3]=f):f=e[3];const m=f,h=a!==void 0&&m.has(a.x)?a.x:x.label;let v;e[4]!==a?.y||e[5]!==m?(v=a?.y.find(s=>m.has(s)),e[4]=a?.y,e[5]=m,e[6]=v):v=e[6];const k=v,u=k??x.value;let p;e[7]!==h||e[8]!==t.rows||e[9]!==u?(p=u===null?[]:t.rows.slice(0,O).map((s,c)=>({label:h===null?`#${(c+1).toString()}`:$(s[h]),value:Number(s[u])||0})),e[7]=h,e[8]=t.rows,e[9]=u,e[10]=p):p=e[10];const C=p;if(u===null){let s;e[11]!==o?(s=o("No numeric column to chart."),e[11]=o,e[12]=s):s=e[12];let c;return e[13]!==s?(c=l("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-chart-empty",children:s}),e[13]=s,e[14]=c):c=e[14],c}const r=a!==void 0&&k!==void 0?a.kind:"bar";let i;e[15]!==C||e[16]!==r?(i=r==="bar"?b(q,{className:"h-full w-full",config:T,data:C,children:[l(E,{dataKey:"label"}),l(_,{dataKey:"value"}),l(j,{})]}):l(H,{data:C,kind:r}),e[15]=C,e[16]=r,e[17]=i):i=e[17];let y;return e[18]!==r||e[19]!==i?(y=l("div",{className:"h-80 w-full p-3","data-chart-kind":r,"data-testid":"sql-chart",children:i}),e[18]=r,e[19]=i,e[20]=y):y=e[20],y};export{D as S};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{c as v}from"react/compiler-runtime";import{Download01Icon as ne}from"@hugeicons/core-free-icons";import{HugeiconsIcon as se}from"@hugeicons/react";import{Handle as B,Position as G,getNodesBounds as re,getViewportForBounds as ae,useNodesState as le,useEdgesState as ie,ReactFlow as ce,Background as de,Panel as M,Controls as me,MiniMap as pe,useNodes as ue,useReactFlow as U,useNodesInitialized as fe}from"@xyflow/react";import{useState as k,useMemo as _,useRef as ge,useEffect as D}from"react";import{S as he,T as N}from"./storage-tier-C2mKwYRj.js";import{B as S}from"./badge-cAk9Di1Q.js";import{B as j}from"./button-BOPLD1un.js";import{D as be,a as xe,b as Ne,g as C}from"./dropdown-menu-D_ewqsUU.js";import{I as ye}from"./input-CY5W3wzv.js";import{useT as T}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{f as L}from"./internal-CwaF9YNk.js";import{c as y}from"./utils-bhneXptQ.js";import{jsx as i,jsxs as f}from"react/jsx-runtime";import{LunoraError as ve}from"@lunora/errors";import{toBlob as we,toSvg as Se}from"html-to-image";function Ee(o){const e=v(10);let t,a,s;e[0]!==o?({className:t,selected:s,...a}=o,e[0]=o,e[1]=t,e[2]=a,e[3]=s):(t=e[1],a=e[2],s=e[3]);const r=s===!0?"":void 0;let n;e[4]!==t?(n=y("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]=n):n=e[5];let l;return e[6]!==a||e[7]!==r||e[8]!==n?(l=i("div",{"data-slot":"base-node","data-selected":r,className:n,...a}),e[6]=a,e[7]=r,e[8]=n,e[9]=l):l=e[9],l}function Te(o){const e=v(8);let t,a;e[0]!==o?({className:t,...a}=o,e[0]=o,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=y("flex items-center gap-2 rounded-t-md bg-muted/50 px-3 py-1.5",t),e[3]=t,e[4]=s):s=e[4];let r;return e[5]!==a||e[6]!==s?(r=i("div",{"data-slot":"base-node-header",className:s,...a}),e[5]=a,e[6]=s,e[7]=r):r=e[7],r}function $e(o){const e=v(8);let t,a;e[0]!==o?({className:t,...a}=o,e[0]=o,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=y("flex flex-col",t),e[3]=t,e[4]=s):s=e[4];let r;return e[5]!==a||e[6]!==s?(r=i("div",{"data-slot":"base-node-content",className:s,...a}),e[5]=a,e[6]=s,e[7]=r):r=e[7],r}const F=o=>{const e=o.ref===void 0?o.type:`${o.type} → ${o.ref}`;return o.optional===!0?`${e}?`:e},_e=o=>{const e=v(22),{data:t,selected:a}=o,s=T();let r;e[0]!==t.label||e[1]!==t.loadError||e[2]!==s?(r=t.loadError===!0?i("span",{className:"px-3 py-1.5 text-xs text-destructive","data-testid":`sd-node-${t.label}-error`,children:s("Columns unavailable")}):i("span",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"—"}),e[0]=t.label,e[1]=t.loadError,e[2]=s,e[3]=r):r=e[3];const n=r,l=`sd-node-${t.label}`;let d;e[4]!==t.label?(d=i("span",{className:"truncate font-mono text-xs font-semibold",title:t.label,children:t.label}),e[4]=t.label,e[5]=d):d=e[5];let m;e[6]!==t.tier?(m=i("span",{className:"ms-auto",children:i(he,{tier:t.tier})}),e[6]=t.tier,e[7]=m):m=e[7];let c;e[8]!==d||e[9]!==m?(c=f(Te,{children:[d,m]}),e[8]=d,e[9]=m,e[10]=c):c=e[10];let p;e[11]!==t.columns||e[12]!==t.label||e[13]!==n?(p=t.columns.length===0?n:t.columns.map(g=>f("div",{className:y("relative flex items-center gap-2 border-t border-border px-3 py-1.5 text-xs first:border-t-0",g.pk===!0&&"bg-muted/30"),"data-testid":`sd-col-${t.label}-${g.name}`,children:[i(B,{className:"!h-2 !w-2 !-left-1 !border-border !bg-muted-foreground/70",id:g.name,isConnectable:!1,position:G.Left,type:"target"}),i("span",{className:"truncate font-mono",title:g.name,children:g.name}),g.pk===!0&&i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),g.ref!==void 0&&i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),i("span",{className:"ms-auto truncate text-muted-foreground",title:F(g),children:F(g)}),i(B,{className:"!h-2 !w-2 !-right-1 !border-border !bg-muted-foreground/70",id:g.name,isConnectable:!1,position:G.Right,type:"source"})]},g.name)),e[11]=t.columns,e[12]=t.label,e[13]=n,e[14]=p):p=e[14];let u;e[15]!==p?(u=i($e,{children:p}),e[15]=p,e[16]=u):u=e[16];let b;return e[17]!==a||e[18]!==l||e[19]!==c||e[20]!==u?(b=f(Ee,{className:"w-64 overflow-hidden","data-testid":l,selected:a,children:[c,u]}),e[17]=a,e[18]=l,e[19]=c,e[20]=u,e[21]=b):b=e[21],b},x=1920,E=1080,K=32,R=(o,e)=>{const t=globalThis.document.createElement("a");t.href=o,t.download=e,globalThis.document.body.append(t),t.click(),t.remove()},Ce=(o,e,t="schema-diagram.json")=>{const a={edges:e,exportedAt:new Date().toISOString(),nodes:o},s=JSON.stringify(a,void 0,2),r=globalThis.URL.createObjectURL(new globalThis.Blob([s],{type:"application/json"}));R(r,t),globalThis.setTimeout(()=>{globalThis.URL.revokeObjectURL(r)},0)},P=(o,e,t,a)=>{const s=re(o),{x:r,y:n,zoom:l}=ae(s,e,t,.1,2,a);return{transform:[r,n,l],zoom:l}},Me=async(o,e,t="schema-diagram.png")=>{const{transform:a}=P(e,x,E,K),[s,r,n]=a,l=await we(o,{backgroundColor:"#ffffff",height:E,style:{transform:`translate(${s.toString()}px, ${r.toString()}px) scale(${n.toString()})`,transformOrigin:"top left",width:`${x.toString()}px`},width:x});if(l===null)throw new ve("INTERNAL","html-to-image produced no blob");const d=globalThis.URL.createObjectURL(l);R(d,t),globalThis.setTimeout(()=>{globalThis.URL.revokeObjectURL(d)},0)},ke=async(o,e,t="schema-diagram.svg")=>{const{transform:a}=P(e,x,E,K),[s,r,n]=a,l=await Se(o,{backgroundColor:"#ffffff",height:E,style:{transform:`translate(${s.toString()}px, ${r.toString()}px) scale(${n.toString()})`,transformOrigin:"top left",width:`${x.toString()}px`},width:x});R(l,t)},W=256,q=112,I=36,w=24,De=480,Le=1.4,Re=o=>{const e=Math.max(1,Math.round(Math.sqrt(Le*o/(W+q))));return Math.max(De,o/e)},Ae=38,Oe=28,z=o=>Ae+Math.max(1,o)*Oe,He=(o,e)=>{const t=new Map;for(const n of o)t.set(n,[]);for(const n of e)n.to!==n.from&&t.has(n.from)&&t.has(n.to)&&t.get(n.from)?.push(n.to);const a=new Map,s=new Set,r=n=>{const l=a.get(n);if(l!==void 0)return l;if(s.has(n))return 0;s.add(n);let d=0;for(const m of t.get(n)??[])d=Math.max(d,r(m)+1);return s.delete(n),a.set(n,d),d};for(const n of o)r(n);return a},Be=(o,e,t)=>{const a=He(o,e),s=new Map;for(const m of o){const c=a.get(m)??0,p=s.get(c);p===void 0?s.set(c,[m]):p.push(m)}const r=o.reduce((m,c)=>m+z(t.get(c)??0)+I,0),n=Re(r),l=[];let d=0;for(const m of[...s.keys()].toSorted((c,p)=>c-p)){let c=0,p=w;for(const u of s.get(m)??[]){const b=z(t.get(u)??0);p>w&&p+b>n&&(c+=1,p=w),l.push({name:u,x:w+(d+c)*(W+q),y:p}),p+=b+I}d+=c+1}return l},Ge={databaseSchema:_e},J={backgroundColor:N.shard.color},V={backgroundColor:N.global.color},je={global:!0,shard:!0},Fe={},Ie=o=>{const e=o.find(t=>t.pk===!0)?.name;return e!==void 0?e:o.some(t=>t.name==="_id")?"_id":o.some(t=>t.name==="id")?"id":o[0]?.name??"_id"},Y=o=>o.flatMap(e=>e.columns.filter(t=>t.ref!==void 0).map(t=>({column:t.name,from:e.name,to:t.ref}))),ze=(o,e,t)=>{const a=o.map(l=>l.name),s=new Map(o.map(l=>[l.name,l.columns.length])),r=Be(a,Y(o),s),n=new Map(o.map(l=>[l.name,l]));return r.flatMap(({name:l,x:d,y:m})=>{const c=n.get(l);return c===void 0?[]:[{className:t[l],data:{columns:c.columns,label:l,loadError:e,tier:c.tier},id:l,position:{x:d,y:m},type:"databaseSchema"}]})},Ue=o=>{const e=new Map(o.map(t=>[t.name,t.columns]));return Y(o).flatMap(t=>{const a=e.get(t.to)??[],s=e.get(t.from)??[],r=Ie(a);return!a.some(n=>n.name===r)||!s.some(n=>n.name===t.column)?[]:[{id:`${t.from}.${t.column}->${t.to}`,source:t.to,sourceHandle:r,target:t.from,targetHandle:t.column}]})},Ke=()=>{const o=v(15),e=T();let t;o[0]===Symbol.for("react.memo_cache_sentinel")?(t=f("span",{className:"flex items-center gap-1",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:J}),N.shard.label]}),o[0]=t):t=o[0];let a;o[1]===Symbol.for("react.memo_cache_sentinel")?(a=f("span",{className:"flex items-center gap-1",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:V}),N.global.label]}),o[1]=a):a=o[1];let s;o[2]===Symbol.for("react.memo_cache_sentinel")?(s=i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),o[2]=s):s=o[2];let r;o[3]!==e?(r=e("Primary key"),o[3]=e,o[4]=r):r=o[4];let n;o[5]!==r?(n=f("span",{className:"flex items-center gap-1",children:[s,r]}),o[5]=r,o[6]=n):n=o[6];let l;o[7]===Symbol.for("react.memo_cache_sentinel")?(l=i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),o[7]=l):l=o[7];let d;o[8]!==e?(d=e("Foreign key"),o[8]=e,o[9]=d):d=o[9];let m;o[10]!==d?(m=f("span",{className:"flex items-center gap-1",children:[l,d]}),o[10]=d,o[11]=m):m=o[11];let c;return o[12]!==n||o[13]!==m?(c=f("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,a,n,m]}),o[12]=n,o[13]=m,o[14]=c):c=o[14],c},Pe=12,We=o=>{const e=v(9),{containerRef:t,seedKey:a}=o,s=fe(),{fitView:r}=U();let n;e[0]!==t||e[1]!==r||e[2]!==s?(n=()=>{if(!s)return;const d=()=>{L(r({duration:0,maxZoom:1.6,padding:.14}))};d();const m=t.current;if(m===null)return;const c=new ResizeObserver(()=>{d()});return c.observe(m),()=>{c.disconnect()}},e[0]=t,e[1]=r,e[2]=s,e[3]=n):n=e[3];let l;return e[4]!==t||e[5]!==r||e[6]!==s||e[7]!==a?(l=[t,r,s,a],e[4]=t,e[5]=r,e[6]=s,e[7]=a,e[8]=l):l=e[8],D(n,l),null},qe=({containerRef:o,testIdPrefix:e})=>{const t=T(),a=ue(),{getEdges:s}=U(),[r,n]=k(null),l=async()=>{const u=o.current?.querySelector(".react-flow__viewport");if(u){n("png");try{await Me(u,a,`${e}-schema-diagram.png`)}finally{n(null)}}},d=async()=>{const u=o.current?.querySelector(".react-flow__viewport");if(u){n("svg");try{await ke(u,a,`${e}-schema-diagram.svg`)}finally{n(null)}}},m=()=>{n("json");try{Ce(a,s(),`${e}-schema-diagram.json`)}finally{n(null)}},c=()=>{L(l())},p=()=>{L(d())};return i(M,{position:"top-right",children:f(be,{children:[f(xe,{className:"group/button inline-flex shrink-0 cursor-pointer items-center justify-center gap-1 rounded-md border border-border bg-background px-2 text-xs font-medium whitespace-nowrap hover:bg-muted disabled:pointer-events-none disabled:opacity-50","data-testid":`${e}-export-trigger`,disabled:r!==null,children:[i(se,{className:"size-3.5",icon:ne,strokeWidth:2}),t("Export")]}),f(Ne,{align:"end",children:[i(C,{"data-testid":`${e}-export-png`,disabled:r!==null,onClick:c,children:t("PNG")}),i(C,{"data-testid":`${e}-export-svg`,disabled:r!==null,onClick:p,children:t("SVG")}),i(C,{"data-testid":`${e}-export-json`,disabled:r!==null,onClick:m,children:t("JSON")})]})]})})},dt=({columnsError:o,fill:e=!1,nodeClasses:t,tables:a,testIdPrefix:s})=>{const r=T(),[n,l]=k(je),[d,m]=k(""),c=_(()=>{const h=d.trim().toLowerCase();return a.filter(H=>n[H.tier]&&H.name.toLowerCase().includes(h))},[a,n,d]),p=_(()=>ze(c,o??!1,t??Fe),[c,o,t]),u=_(()=>Ue(c),[c]),b=c.map(h=>h.name).join(","),[g,A,Q]=le(p),[Z,O,X]=ie(u),$=ge(null);D(()=>{A(p)},[p,A]),D(()=>{O(u)},[u,O]);const ee=h=>{m(h.target.value)},te=()=>{l(h=>({...h,shard:!h.shard}))},oe=()=>{l(h=>({...h,global:!h.global}))};return a.length===0?i("section",{className:"flex flex-col gap-2","data-testid":`${s}-section`,children:i("p",{className:"text-sm text-muted-foreground","data-testid":`${s}-empty`,children:r("No tables to graph.")})}):i("section",{className:y("flex flex-col",e&&"min-h-0 flex-1"),"data-testid":`${s}-section`,children:i("div",{className:y("w-full overflow-hidden border border-border bg-muted/20",e?"min-h-0 flex-1":"h-[560px]"),"data-testid":`${s}-canvas`,ref:$,children:f(ce,{edges:Z,elementsSelectable:!0,fitView:!0,minZoom:.2,nodes:g,nodesConnectable:!1,nodeTypes:Ge,onEdgesChange:X,onNodesChange:Q,children:[i(de,{}),i(M,{position:"top-left",children:f("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card/95 p-2 shadow-xs",children:[i(ye,{"aria-label":r("Find table…"),className:"h-7 w-44 text-xs","data-testid":`${s}-find`,onChange:ee,placeholder:r("Find table…"),value:d}),f("div",{"aria-label":r("Storage tiers"),className:"flex items-center gap-1.5",role:"group",children:[f(j,{"aria-pressed":n.shard,className:"gap-1.5","data-testid":`${s}-tier-shard`,onClick:te,size:"xs",type:"button",variant:n.shard?"default":"outline",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:J}),N.shard.label]}),f(j,{"aria-pressed":n.global,className:"gap-1.5","data-testid":`${s}-tier-global`,onClick:oe,size:"xs",type:"button",variant:n.global?"default":"outline",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:V}),N.global.label]})]})]})}),i(M,{position:"bottom-center",children:i(Ke,{})}),i(me,{showInteractive:!1}),c.length>Pe&&i(pe,{className:"!border !border-border !bg-card",maskColor:"var(--color-muted)",nodeColor:"var(--color-muted-foreground)",nodeStrokeWidth:0,pannable:!0,zoomable:!0}),i(qe,{containerRef:$,testIdPrefix:s}),i(We,{containerRef:$,seedKey:b})]})})})};export{dt as S};
2
+ import{c as v}from"react/compiler-runtime";import{Download01Icon as ne}from"@hugeicons/core-free-icons";import{HugeiconsIcon as se}from"@hugeicons/react";import{Handle as B,Position as G,getNodesBounds as re,getViewportForBounds as ae,useNodesState as le,useEdgesState as ie,ReactFlow as ce,Background as de,Panel as M,Controls as me,MiniMap as pe,useNodes as ue,useReactFlow as U,useNodesInitialized as fe}from"@xyflow/react";import{useState as k,useMemo as _,useRef as ge,useEffect as D}from"react";import{S as he,T as N}from"./storage-tier-C2mKwYRj.js";import{B as S}from"./badge-cAk9Di1Q.js";import{B as j}from"./button-BOPLD1un.js";import{D as be,a as xe,b as Ne,g as C}from"./dropdown-menu-D_ewqsUU.js";import{I as ye}from"./input-CY5W3wzv.js";import{useT as T}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{f as L}from"./internal-7bgd8inO.js";import{c as y}from"./utils-bhneXptQ.js";import{jsx as i,jsxs as f}from"react/jsx-runtime";import{LunoraError as ve}from"@lunora/errors";import{toBlob as we,toSvg as Se}from"html-to-image";function Ee(o){const e=v(10);let t,a,s;e[0]!==o?({className:t,selected:s,...a}=o,e[0]=o,e[1]=t,e[2]=a,e[3]=s):(t=e[1],a=e[2],s=e[3]);const r=s===!0?"":void 0;let n;e[4]!==t?(n=y("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]=n):n=e[5];let l;return e[6]!==a||e[7]!==r||e[8]!==n?(l=i("div",{"data-slot":"base-node","data-selected":r,className:n,...a}),e[6]=a,e[7]=r,e[8]=n,e[9]=l):l=e[9],l}function Te(o){const e=v(8);let t,a;e[0]!==o?({className:t,...a}=o,e[0]=o,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=y("flex items-center gap-2 rounded-t-md bg-muted/50 px-3 py-1.5",t),e[3]=t,e[4]=s):s=e[4];let r;return e[5]!==a||e[6]!==s?(r=i("div",{"data-slot":"base-node-header",className:s,...a}),e[5]=a,e[6]=s,e[7]=r):r=e[7],r}function $e(o){const e=v(8);let t,a;e[0]!==o?({className:t,...a}=o,e[0]=o,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=y("flex flex-col",t),e[3]=t,e[4]=s):s=e[4];let r;return e[5]!==a||e[6]!==s?(r=i("div",{"data-slot":"base-node-content",className:s,...a}),e[5]=a,e[6]=s,e[7]=r):r=e[7],r}const F=o=>{const e=o.ref===void 0?o.type:`${o.type} → ${o.ref}`;return o.optional===!0?`${e}?`:e},_e=o=>{const e=v(22),{data:t,selected:a}=o,s=T();let r;e[0]!==t.label||e[1]!==t.loadError||e[2]!==s?(r=t.loadError===!0?i("span",{className:"px-3 py-1.5 text-xs text-destructive","data-testid":`sd-node-${t.label}-error`,children:s("Columns unavailable")}):i("span",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"—"}),e[0]=t.label,e[1]=t.loadError,e[2]=s,e[3]=r):r=e[3];const n=r,l=`sd-node-${t.label}`;let d;e[4]!==t.label?(d=i("span",{className:"truncate font-mono text-xs font-semibold",title:t.label,children:t.label}),e[4]=t.label,e[5]=d):d=e[5];let m;e[6]!==t.tier?(m=i("span",{className:"ms-auto",children:i(he,{tier:t.tier})}),e[6]=t.tier,e[7]=m):m=e[7];let c;e[8]!==d||e[9]!==m?(c=f(Te,{children:[d,m]}),e[8]=d,e[9]=m,e[10]=c):c=e[10];let p;e[11]!==t.columns||e[12]!==t.label||e[13]!==n?(p=t.columns.length===0?n:t.columns.map(g=>f("div",{className:y("relative flex items-center gap-2 border-t border-border px-3 py-1.5 text-xs first:border-t-0",g.pk===!0&&"bg-muted/30"),"data-testid":`sd-col-${t.label}-${g.name}`,children:[i(B,{className:"!h-2 !w-2 !-left-1 !border-border !bg-muted-foreground/70",id:g.name,isConnectable:!1,position:G.Left,type:"target"}),i("span",{className:"truncate font-mono",title:g.name,children:g.name}),g.pk===!0&&i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),g.ref!==void 0&&i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),i("span",{className:"ms-auto truncate text-muted-foreground",title:F(g),children:F(g)}),i(B,{className:"!h-2 !w-2 !-right-1 !border-border !bg-muted-foreground/70",id:g.name,isConnectable:!1,position:G.Right,type:"source"})]},g.name)),e[11]=t.columns,e[12]=t.label,e[13]=n,e[14]=p):p=e[14];let u;e[15]!==p?(u=i($e,{children:p}),e[15]=p,e[16]=u):u=e[16];let b;return e[17]!==a||e[18]!==l||e[19]!==c||e[20]!==u?(b=f(Ee,{className:"w-64 overflow-hidden","data-testid":l,selected:a,children:[c,u]}),e[17]=a,e[18]=l,e[19]=c,e[20]=u,e[21]=b):b=e[21],b},x=1920,E=1080,K=32,R=(o,e)=>{const t=globalThis.document.createElement("a");t.href=o,t.download=e,globalThis.document.body.append(t),t.click(),t.remove()},Ce=(o,e,t="schema-diagram.json")=>{const a={edges:e,exportedAt:new Date().toISOString(),nodes:o},s=JSON.stringify(a,void 0,2),r=globalThis.URL.createObjectURL(new globalThis.Blob([s],{type:"application/json"}));R(r,t),globalThis.setTimeout(()=>{globalThis.URL.revokeObjectURL(r)},0)},P=(o,e,t,a)=>{const s=re(o),{x:r,y:n,zoom:l}=ae(s,e,t,.1,2,a);return{transform:[r,n,l],zoom:l}},Me=async(o,e,t="schema-diagram.png")=>{const{transform:a}=P(e,x,E,K),[s,r,n]=a,l=await we(o,{backgroundColor:"#ffffff",height:E,style:{transform:`translate(${s.toString()}px, ${r.toString()}px) scale(${n.toString()})`,transformOrigin:"top left",width:`${x.toString()}px`},width:x});if(l===null)throw new ve("INTERNAL","html-to-image produced no blob");const d=globalThis.URL.createObjectURL(l);R(d,t),globalThis.setTimeout(()=>{globalThis.URL.revokeObjectURL(d)},0)},ke=async(o,e,t="schema-diagram.svg")=>{const{transform:a}=P(e,x,E,K),[s,r,n]=a,l=await Se(o,{backgroundColor:"#ffffff",height:E,style:{transform:`translate(${s.toString()}px, ${r.toString()}px) scale(${n.toString()})`,transformOrigin:"top left",width:`${x.toString()}px`},width:x});R(l,t)},W=256,q=112,I=36,w=24,De=480,Le=1.4,Re=o=>{const e=Math.max(1,Math.round(Math.sqrt(Le*o/(W+q))));return Math.max(De,o/e)},Ae=38,Oe=28,z=o=>Ae+Math.max(1,o)*Oe,He=(o,e)=>{const t=new Map;for(const n of o)t.set(n,[]);for(const n of e)n.to!==n.from&&t.has(n.from)&&t.has(n.to)&&t.get(n.from)?.push(n.to);const a=new Map,s=new Set,r=n=>{const l=a.get(n);if(l!==void 0)return l;if(s.has(n))return 0;s.add(n);let d=0;for(const m of t.get(n)??[])d=Math.max(d,r(m)+1);return s.delete(n),a.set(n,d),d};for(const n of o)r(n);return a},Be=(o,e,t)=>{const a=He(o,e),s=new Map;for(const m of o){const c=a.get(m)??0,p=s.get(c);p===void 0?s.set(c,[m]):p.push(m)}const r=o.reduce((m,c)=>m+z(t.get(c)??0)+I,0),n=Re(r),l=[];let d=0;for(const m of[...s.keys()].toSorted((c,p)=>c-p)){let c=0,p=w;for(const u of s.get(m)??[]){const b=z(t.get(u)??0);p>w&&p+b>n&&(c+=1,p=w),l.push({name:u,x:w+(d+c)*(W+q),y:p}),p+=b+I}d+=c+1}return l},Ge={databaseSchema:_e},J={backgroundColor:N.shard.color},V={backgroundColor:N.global.color},je={global:!0,shard:!0},Fe={},Ie=o=>{const e=o.find(t=>t.pk===!0)?.name;return e!==void 0?e:o.some(t=>t.name==="_id")?"_id":o.some(t=>t.name==="id")?"id":o[0]?.name??"_id"},Y=o=>o.flatMap(e=>e.columns.filter(t=>t.ref!==void 0).map(t=>({column:t.name,from:e.name,to:t.ref}))),ze=(o,e,t)=>{const a=o.map(l=>l.name),s=new Map(o.map(l=>[l.name,l.columns.length])),r=Be(a,Y(o),s),n=new Map(o.map(l=>[l.name,l]));return r.flatMap(({name:l,x:d,y:m})=>{const c=n.get(l);return c===void 0?[]:[{className:t[l],data:{columns:c.columns,label:l,loadError:e,tier:c.tier},id:l,position:{x:d,y:m},type:"databaseSchema"}]})},Ue=o=>{const e=new Map(o.map(t=>[t.name,t.columns]));return Y(o).flatMap(t=>{const a=e.get(t.to)??[],s=e.get(t.from)??[],r=Ie(a);return!a.some(n=>n.name===r)||!s.some(n=>n.name===t.column)?[]:[{id:`${t.from}.${t.column}->${t.to}`,source:t.to,sourceHandle:r,target:t.from,targetHandle:t.column}]})},Ke=()=>{const o=v(15),e=T();let t;o[0]===Symbol.for("react.memo_cache_sentinel")?(t=f("span",{className:"flex items-center gap-1",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:J}),N.shard.label]}),o[0]=t):t=o[0];let a;o[1]===Symbol.for("react.memo_cache_sentinel")?(a=f("span",{className:"flex items-center gap-1",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:V}),N.global.label]}),o[1]=a):a=o[1];let s;o[2]===Symbol.for("react.memo_cache_sentinel")?(s=i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),o[2]=s):s=o[2];let r;o[3]!==e?(r=e("Primary key"),o[3]=e,o[4]=r):r=o[4];let n;o[5]!==r?(n=f("span",{className:"flex items-center gap-1",children:[s,r]}),o[5]=r,o[6]=n):n=o[6];let l;o[7]===Symbol.for("react.memo_cache_sentinel")?(l=i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),o[7]=l):l=o[7];let d;o[8]!==e?(d=e("Foreign key"),o[8]=e,o[9]=d):d=o[9];let m;o[10]!==d?(m=f("span",{className:"flex items-center gap-1",children:[l,d]}),o[10]=d,o[11]=m):m=o[11];let c;return o[12]!==n||o[13]!==m?(c=f("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,a,n,m]}),o[12]=n,o[13]=m,o[14]=c):c=o[14],c},Pe=12,We=o=>{const e=v(9),{containerRef:t,seedKey:a}=o,s=fe(),{fitView:r}=U();let n;e[0]!==t||e[1]!==r||e[2]!==s?(n=()=>{if(!s)return;const d=()=>{L(r({duration:0,maxZoom:1.6,padding:.14}))};d();const m=t.current;if(m===null)return;const c=new ResizeObserver(()=>{d()});return c.observe(m),()=>{c.disconnect()}},e[0]=t,e[1]=r,e[2]=s,e[3]=n):n=e[3];let l;return e[4]!==t||e[5]!==r||e[6]!==s||e[7]!==a?(l=[t,r,s,a],e[4]=t,e[5]=r,e[6]=s,e[7]=a,e[8]=l):l=e[8],D(n,l),null},qe=({containerRef:o,testIdPrefix:e})=>{const t=T(),a=ue(),{getEdges:s}=U(),[r,n]=k(null),l=async()=>{const u=o.current?.querySelector(".react-flow__viewport");if(u){n("png");try{await Me(u,a,`${e}-schema-diagram.png`)}finally{n(null)}}},d=async()=>{const u=o.current?.querySelector(".react-flow__viewport");if(u){n("svg");try{await ke(u,a,`${e}-schema-diagram.svg`)}finally{n(null)}}},m=()=>{n("json");try{Ce(a,s(),`${e}-schema-diagram.json`)}finally{n(null)}},c=()=>{L(l())},p=()=>{L(d())};return i(M,{position:"top-right",children:f(be,{children:[f(xe,{className:"group/button inline-flex shrink-0 cursor-pointer items-center justify-center gap-1 rounded-md border border-border bg-background px-2 text-xs font-medium whitespace-nowrap hover:bg-muted disabled:pointer-events-none disabled:opacity-50","data-testid":`${e}-export-trigger`,disabled:r!==null,children:[i(se,{className:"size-3.5",icon:ne,strokeWidth:2}),t("Export")]}),f(Ne,{align:"end",children:[i(C,{"data-testid":`${e}-export-png`,disabled:r!==null,onClick:c,children:t("PNG")}),i(C,{"data-testid":`${e}-export-svg`,disabled:r!==null,onClick:p,children:t("SVG")}),i(C,{"data-testid":`${e}-export-json`,disabled:r!==null,onClick:m,children:t("JSON")})]})]})})},dt=({columnsError:o,fill:e=!1,nodeClasses:t,tables:a,testIdPrefix:s})=>{const r=T(),[n,l]=k(je),[d,m]=k(""),c=_(()=>{const h=d.trim().toLowerCase();return a.filter(H=>n[H.tier]&&H.name.toLowerCase().includes(h))},[a,n,d]),p=_(()=>ze(c,o??!1,t??Fe),[c,o,t]),u=_(()=>Ue(c),[c]),b=c.map(h=>h.name).join(","),[g,A,Q]=le(p),[Z,O,X]=ie(u),$=ge(null);D(()=>{A(p)},[p,A]),D(()=>{O(u)},[u,O]);const ee=h=>{m(h.target.value)},te=()=>{l(h=>({...h,shard:!h.shard}))},oe=()=>{l(h=>({...h,global:!h.global}))};return a.length===0?i("section",{className:"flex flex-col gap-2","data-testid":`${s}-section`,children:i("p",{className:"text-sm text-muted-foreground","data-testid":`${s}-empty`,children:r("No tables to graph.")})}):i("section",{className:y("flex flex-col",e&&"min-h-0 flex-1"),"data-testid":`${s}-section`,children:i("div",{className:y("w-full overflow-hidden border border-border bg-muted/20",e?"min-h-0 flex-1":"h-[560px]"),"data-testid":`${s}-canvas`,ref:$,children:f(ce,{edges:Z,elementsSelectable:!0,fitView:!0,minZoom:.2,nodes:g,nodesConnectable:!1,nodeTypes:Ge,onEdgesChange:X,onNodesChange:Q,children:[i(de,{}),i(M,{position:"top-left",children:f("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card/95 p-2 shadow-xs",children:[i(ye,{"aria-label":r("Find table…"),className:"h-7 w-44 text-xs","data-testid":`${s}-find`,onChange:ee,placeholder:r("Find table…"),value:d}),f("div",{"aria-label":r("Storage tiers"),className:"flex items-center gap-1.5",role:"group",children:[f(j,{"aria-pressed":n.shard,className:"gap-1.5","data-testid":`${s}-tier-shard`,onClick:te,size:"xs",type:"button",variant:n.shard?"default":"outline",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:J}),N.shard.label]}),f(j,{"aria-pressed":n.global,className:"gap-1.5","data-testid":`${s}-tier-global`,onClick:oe,size:"xs",type:"button",variant:n.global?"default":"outline",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:V}),N.global.label]})]})]})}),i(M,{position:"bottom-center",children:i(Ke,{})}),i(me,{showInteractive:!1}),c.length>Pe&&i(pe,{className:"!border !border-border !bg-card",maskColor:"var(--color-muted)",nodeColor:"var(--color-muted-foreground)",nodeStrokeWidth:0,pannable:!0,zoomable:!0}),i(qe,{containerRef:$,testIdPrefix:s}),i(We,{containerRef:$,seedKey:b})]})})})};export{dt as S};