@lunora/studio 1.0.0-alpha.90 → 1.0.0-alpha.91

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 (148) 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/fanout-panel.js +1 -1
  31. package/dist/packem_chunks/flags-panel.js +1 -1
  32. package/dist/packem_chunks/issues-panel.js +1 -1
  33. package/dist/packem_chunks/kv-browser.js +1 -1
  34. package/dist/packem_chunks/log-drains-panel.js +1 -1
  35. package/dist/packem_chunks/migrations-route.js +1 -1
  36. package/dist/packem_chunks/organizations-panel.js +1 -1
  37. package/dist/packem_chunks/payments-panel.js +1 -1
  38. package/dist/packem_chunks/permissions-panel.js +1 -1
  39. package/dist/packem_chunks/queues-panel.js +1 -1
  40. package/dist/packem_chunks/rls-panel.js +1 -1
  41. package/dist/packem_chunks/schedule-panel.js +1 -1
  42. package/dist/packem_chunks/storage-rules-panel.js +1 -1
  43. package/dist/packem_chunks/subscriptions-panel.js +1 -1
  44. package/dist/packem_chunks/sync-client-panel.js +1 -1
  45. package/dist/packem_chunks/traces-panel.js +1 -1
  46. package/dist/packem_chunks/users-panel.js +1 -1
  47. package/dist/packem_chunks/vector-browser.js +1 -1
  48. package/dist/packem_chunks/workflows-panel.js +1 -1
  49. package/dist/packem_shared/{ApiDocsPanel-DLMeLZ5-.js → ApiDocsPanel-Cu_QmzO0.js} +1 -1
  50. package/dist/packem_shared/{ApiReferencePanel-9q8BbJl-.js → ApiReferencePanel-DuIU1P8B.js} +1 -1
  51. package/dist/packem_shared/{CommandPalette--SQwfTW1.js → CommandPalette-mPR8-vIm.js} +1 -1
  52. package/dist/packem_shared/DataBrowser-BPRDaOHx.js +1 -0
  53. package/dist/packem_shared/{GlobalDataBrowser-DpkjHfDg.js → GlobalDataBrowser-CeA8bDjX.js} +1 -1
  54. package/dist/packem_shared/HomePanel-DLP1nQdC.js +1 -0
  55. package/dist/packem_shared/{MigrationsPanel-dygzHUvg.js → MigrationsPanel-dm_M75mR.js} +1 -1
  56. package/dist/packem_shared/{OpenRpcReferencePanel-qOZcWXMs.js → OpenRpcReferencePanel-DXeffPFr.js} +1 -1
  57. package/dist/packem_shared/{ScheduledJobs-D8kBZWBu.js → ScheduledJobs-DDJG9Je7.js} +1 -1
  58. package/dist/packem_shared/{Studio-forQt-PC.js → Studio-BYg65qWq.js} +1 -1
  59. package/dist/packem_shared/{StudioApp-B1AWsBzi.js → StudioApp-D0UOg0a_.js} +1 -1
  60. package/dist/packem_shared/{advisor-view-Pa8HLtBv.js → advisor-view-Coipc04R.js} +1 -1
  61. package/dist/packem_shared/{data-grid-DcxyIXwG.js → data-grid-Ci4-tZkk.js} +1 -1
  62. package/dist/packem_shared/{error-alert-t6cpEi0z.js → error-alert--Ie7ofJ0.js} +1 -1
  63. package/dist/packem_shared/{grid-features-jnrD0SpX.js → grid-features-Db_BNYRo.js} +3 -3
  64. package/dist/packem_shared/{home-panel-CeeqqV0z.js → home-panel-BtxdqXDe.js} +1 -1
  65. package/dist/packem_shared/internal-zkEvTqy8.js +2 -0
  66. package/dist/packem_shared/{recording-client-DRAZEmzE.js → recording-client-DtUxwVNY.js} +1 -1
  67. package/dist/packem_shared/{reference-view-DnYYWr7I.js → reference-view-DncEStdm.js} +1 -1
  68. package/dist/packem_shared/{result-chart-DzJOVsaw.js → result-chart-Gywg9DOk.js} +1 -1
  69. package/dist/packem_shared/{schema-diagram-cg-bz_VL.js → schema-diagram-DTRaCp6Y.js} +1 -1
  70. package/dist/packem_shared/{studio-BtC7WPbz.js → studio-Drf4en3j.js} +1 -1
  71. package/dist/packem_shared/{table-list-sidebar-D9Bd4qgi.js → table-list-sidebar-fz0m_4I4.js} +1 -1
  72. package/dist/packem_shared/{use-admin-query-QJ-ibl5u.js → use-admin-query-CnnyWJXM.js} +1 -1
  73. package/dist/packem_shared/{use-async-submit-q3ymBJkD.js → use-async-submit-BFIMhRqh.js} +1 -1
  74. package/dist/packem_shared/{use-auth-config-BObBpdsi.js → use-auth-config-0EnNCdLu.js} +1 -1
  75. package/dist/packem_shared/{use-sql-assistant-C6dl2_Ty.js → use-sql-assistant-Dtw55kKM.js} +1 -1
  76. package/dist/packem_shared/wire-codec-BUrWLklj.js +1 -0
  77. package/dist/standalone/{chunk-ZPLWCC4I.js → chunk-2NX5QU44.js} +1 -1
  78. package/dist/standalone/{chunk-WB5IUUUU.js → chunk-2QWHVQ6P.js} +1 -1
  79. package/dist/standalone/{chunk-WLZ7YPBH.js → chunk-3FIN5PH4.js} +4 -4
  80. package/dist/standalone/{chunk-XZSGE5ST.js → chunk-3XQMTTW2.js} +1 -1
  81. package/dist/standalone/{chunk-SHMNA6UL.js → chunk-4D7XIQ5Q.js} +1 -1
  82. package/dist/standalone/{chunk-SF4MF2FT.js → chunk-4PLB4ZNI.js} +1 -1
  83. package/dist/standalone/{chunk-PB7FNRDB.js → chunk-4VEAVSAZ.js} +1 -1
  84. package/dist/standalone/{chunk-3AV5CV6K.js → chunk-6QKJ6JPJ.js} +1 -1
  85. package/dist/standalone/{chunk-IC64YIX5.js → chunk-6WWX4FJB.js} +1 -1
  86. package/dist/standalone/{chunk-62EKHKTS.js → chunk-6XKVQES4.js} +1 -1
  87. package/dist/standalone/{chunk-C3HXK3A5.js → chunk-7QMX3D4D.js} +1 -1
  88. package/dist/standalone/{chunk-ULCZDGWQ.js → chunk-7YXDJXNL.js} +1 -1
  89. package/dist/standalone/{chunk-DMCYISRF.js → chunk-A7647FJE.js} +1 -1
  90. package/dist/standalone/{chunk-D3HXVA33.js → chunk-AQT6EPZT.js} +1 -1
  91. package/dist/standalone/{chunk-QXXIJAD5.js → chunk-AREBQI6D.js} +1 -1
  92. package/dist/standalone/{chunk-TBBJPPZ3.js → chunk-BCGEI67L.js} +1 -1
  93. package/dist/standalone/chunk-BENJFRZL.js +1 -0
  94. package/dist/standalone/{chunk-LQAKPCFX.js → chunk-BYIS2KWZ.js} +1 -1
  95. package/dist/standalone/{chunk-QYIOW7CD.js → chunk-C6GLTSPO.js} +1 -1
  96. package/dist/standalone/{chunk-JFW3YNVQ.js → chunk-CMP33R3N.js} +1 -1
  97. package/dist/standalone/{chunk-5ZXDB6LB.js → chunk-CRHCAN4W.js} +1 -1
  98. package/dist/standalone/{chunk-BRQMMGOS.js → chunk-CUAGAM2B.js} +1 -1
  99. package/dist/standalone/chunk-DBWOWJYT.js +11 -0
  100. package/dist/standalone/{chunk-QV6KV4SD.js → chunk-ESEEVSPC.js} +1 -1
  101. package/dist/standalone/chunk-F3TP5L34.js +1 -0
  102. package/dist/standalone/{chunk-6MKDYZ7A.js → chunk-FBNRATNR.js} +1 -1
  103. package/dist/standalone/{chunk-LAHYLAT4.js → chunk-HKG5I64M.js} +1 -1
  104. package/dist/standalone/{chunk-GKSRVABT.js → chunk-HWOD25QD.js} +1 -1
  105. package/dist/standalone/{chunk-XR7RBXKA.js → chunk-IBVBIKUI.js} +1 -1
  106. package/dist/standalone/{chunk-CTNB2KIA.js → chunk-IGCNMZSB.js} +1 -1
  107. package/dist/standalone/{chunk-IAKPXGTQ.js → chunk-IUUSMC2R.js} +1 -1
  108. package/dist/standalone/{chunk-OG4N2XHD.js → chunk-IUYFXK4X.js} +9 -9
  109. package/dist/standalone/{chunk-E7TB4USI.js → chunk-IZ3ISXSM.js} +1 -1
  110. package/dist/standalone/{chunk-BUTBQGUU.js → chunk-J3FR2XBV.js} +1 -1
  111. package/dist/standalone/{chunk-QP7IQOKF.js → chunk-JWXKUXYA.js} +1 -1
  112. package/dist/standalone/{chunk-OG2AMGOC.js → chunk-KUFAOKU3.js} +1 -1
  113. package/dist/standalone/{chunk-PM37X2V3.js → chunk-LDYOCGEG.js} +1 -1
  114. package/dist/standalone/{chunk-CT6ZDXLL.js → chunk-LUU4SDHW.js} +1 -1
  115. package/dist/standalone/chunk-LYQY7L72.js +4 -0
  116. package/dist/standalone/{chunk-GSKOAKQ2.js → chunk-LZH7RDRV.js} +1 -1
  117. package/dist/standalone/{chunk-LJISXTZJ.js → chunk-ML5IJMH6.js} +1 -1
  118. package/dist/standalone/{chunk-DG7YINFM.js → chunk-N233NOIN.js} +1 -1
  119. package/dist/standalone/{chunk-QWBRD6PX.js → chunk-NH3VWHCL.js} +1 -1
  120. package/dist/standalone/{chunk-ARP36PTE.js → chunk-NNRFDPSD.js} +1 -1
  121. package/dist/standalone/{chunk-AQX2QFCN.js → chunk-O2QUUHGF.js} +1 -1
  122. package/dist/standalone/{chunk-U6TNNM5U.js → chunk-Q2Q7FR3R.js} +1 -1
  123. package/dist/standalone/{chunk-Z7G74IH4.js → chunk-Q4AI6JRP.js} +1 -1
  124. package/dist/standalone/{chunk-AZAGCJVI.js → chunk-QGA2HITH.js} +1 -1
  125. package/dist/standalone/{chunk-6VTLIGVX.js → chunk-QWJ4HKPY.js} +1 -1
  126. package/dist/standalone/{chunk-Y7JXGNXD.js → chunk-QZGTDXV5.js} +1 -1
  127. package/dist/standalone/{chunk-24JLZ2Z5.js → chunk-RHPP74O4.js} +1 -1
  128. package/dist/standalone/{chunk-AUQKJYHL.js → chunk-RKGCSNAW.js} +1 -1
  129. package/dist/standalone/{chunk-X665E2HU.js → chunk-RMN2JN4S.js} +1 -1
  130. package/dist/standalone/{chunk-S4ILMYP5.js → chunk-RNOSWEMO.js} +1 -1
  131. package/dist/standalone/{chunk-MHAXZQVO.js → chunk-ULYM26IH.js} +1 -1
  132. package/dist/standalone/{chunk-PGC523I2.js → chunk-WOEGO5M6.js} +1 -1
  133. package/dist/standalone/{chunk-67DKQC23.js → chunk-XDEDCAYN.js} +1 -1
  134. package/dist/standalone/{chunk-YOUKADZH.js → chunk-XGMZESWC.js} +1 -1
  135. package/dist/standalone/{chunk-T6OAYQTX.js → chunk-XKKP2VFZ.js} +1 -1
  136. package/dist/standalone/{chunk-SP5SBO2W.js → chunk-XTEWLG3J.js} +2 -2
  137. package/dist/standalone/{chunk-BL6NO3U3.js → chunk-XXXMUP6L.js} +1 -1
  138. package/dist/standalone/{chunk-LJIFMW67.js → chunk-ZKTWHB7Q.js} +1 -1
  139. package/dist/standalone/{chunk-53KJRSHE.js → chunk-ZNMZQXWN.js} +1 -1
  140. package/dist/standalone/{chunk-YU5CI2FD.js → chunk-ZWSTXAG3.js} +1 -1
  141. package/dist/standalone/studio.js +1 -1
  142. package/package.json +1 -1
  143. package/dist/packem_shared/DataBrowser-CZZ_WkJ-.js +0 -1
  144. package/dist/packem_shared/HomePanel-3baDsDBU.js +0 -1
  145. package/dist/packem_shared/internal-BSIsQVC6.js +0 -2
  146. package/dist/standalone/chunk-4COKHD2C.js +0 -1
  147. package/dist/standalone/chunk-V2U5CL3S.js +0 -11
  148. package/dist/standalone/chunk-VFQDHG7I.js +0 -4
@@ -1 +1 @@
1
- import{c as y}from"react/compiler-runtime";import{useLunora as k}from"@lunora/react";import{E as u}from"./empty-state-Cg7t_8qu.js";import{n as h}from"./skeleton-C1wQ9M5t.js";import{u as v,U as j}from"./reference-view-DnYYWr7I.js";import{useT as I}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{jsxs as w,jsx as f}from"react/jsx-runtime";const x=["get","post","put","patch","delete","head","options","trace"],g=i=>i?.content?.["application/json"]?.schema,P=(i,e)=>Object.entries(i.responses??{}).map(([a,t])=>{const c=t.$ref?.replace("#/components/responses/",""),n=c===void 0?t:e.components?.responses?.[c]??t;return{description:n.description,schema:g(n),status:a}}),A=(i,e,a,t,c)=>{const n=g(t.requestBody),r=n?.properties?.functionPath?.const,s=typeof r=="string"?r:void 0,m=s===void 0?n:n?.properties?.args,d=t.operationId??`${a} ${e}`;return{argsSchema:m,description:t.description,functionPath:s,httpPath:e,key:i,kind:t["x-lunora-function-kind"],method:a.toUpperCase(),operationId:d,requestSchema:n,responses:P(t,c),summary:t.summary??d,tags:t.tags??[],title:t.summary??d}},O=i=>{const e=[];for(const[a,t]of Object.entries(i.paths??{})){const c=a.includes("#")?a.slice(0,a.indexOf("#")):a;for(const n of x){const r=t[n];r!==void 0&&e.push(A(a,c,n,r,i))}}return e},b=i=>{const e=i??{},a=O(e),t=new Map((e.tags??[]).map(s=>[s.name,s.description])),c=new Set,n=[],r=s=>{if(c.has(s))return;c.add(s);const m=a.filter(d=>(d.tags[0]??"")===s);m.length>0&&n.push({description:t.get(s),name:s,operations:m})};for(const s of e.tags??[])r(s.name);for(const s of a)r(s.tags[0]??"");return{groups:n,operationByKey:new Map(a.map(s=>[s.key,s])),server:e.servers?.[0]?.url,title:e.info?.title??"API reference",version:e.info?.version}},S=i=>{const{paths:e}=i;return e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0},$=i=>{const e=i;return S(e)?{kind:"empty"}:{kind:"ready",spec:e}},U=i=>{const e=y(23),{spec:a}=i,t=I(),c=k();let n;e[0]!==c?(n=()=>c.fetchOpenApi(),e[0]=c,e[1]=n):n=e[1];const r=v(a,n,$);let s;e[2]!==r.kind||e[3]!==r.spec?(s=r.kind==="ready"?b(r.spec):void 0,e[2]=r.kind,e[3]=r.spec,e[4]=s):s=e[4];const m=s;if(r.kind==="loading"){let o;return e[5]===Symbol.for("react.memo_cache_sentinel")?(o=w("div",{className:"flex flex-col gap-4","data-testid":"api-reference-loading",children:[f(h,{className:"h-8 w-48"}),f(h,{className:"h-64 w-full"})]}),e[5]=o):o=e[5],o}if(r.kind==="error"){let o;e[6]!==r.message||e[7]!==t?(o=t("Couldn't load the OpenAPI spec: {message}",{message:r.message}),e[6]=r.message,e[7]=t,e[8]=o):o=e[8];let p;e[9]!==t?(p=t("API reference unavailable"),e[9]=t,e[10]=p):p=e[10];let l;return e[11]!==o||e[12]!==p?(l=f(u,{description:o,testId:"api-reference-error",title:p}),e[11]=o,e[12]=p,e[13]=l):l=e[13],l}if(r.kind==="empty"||m===void 0){let o;e[14]!==t?(o=t("Run `lunora codegen` and wire `_generated/openapi.json` to the worker to render the API reference here."),e[14]=t,e[15]=o):o=e[15];let p;e[16]!==t?(p=t("No OpenAPI spec configured"),e[16]=t,e[17]=p):p=e[17];let l;return e[18]!==o||e[19]!==p?(l=f(u,{description:o,testId:"api-reference-empty",title:p}),e[18]=o,e[19]=p,e[20]=l):l=e[20],l}let d;return e[21]!==m?(d=f(j,{model:m}),e[21]=m,e[22]=d):d=e[22],d};export{U as default};
1
+ import{c as y}from"react/compiler-runtime";import{useLunora as k}from"@lunora/react";import{E as u}from"./empty-state-Cg7t_8qu.js";import{n as h}from"./skeleton-C1wQ9M5t.js";import{u as v,U as j}from"./reference-view-DncEStdm.js";import{useT as I}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{jsxs as w,jsx as f}from"react/jsx-runtime";const x=["get","post","put","patch","delete","head","options","trace"],g=i=>i?.content?.["application/json"]?.schema,P=(i,e)=>Object.entries(i.responses??{}).map(([a,t])=>{const c=t.$ref?.replace("#/components/responses/",""),n=c===void 0?t:e.components?.responses?.[c]??t;return{description:n.description,schema:g(n),status:a}}),A=(i,e,a,t,c)=>{const n=g(t.requestBody),r=n?.properties?.functionPath?.const,s=typeof r=="string"?r:void 0,m=s===void 0?n:n?.properties?.args,d=t.operationId??`${a} ${e}`;return{argsSchema:m,description:t.description,functionPath:s,httpPath:e,key:i,kind:t["x-lunora-function-kind"],method:a.toUpperCase(),operationId:d,requestSchema:n,responses:P(t,c),summary:t.summary??d,tags:t.tags??[],title:t.summary??d}},O=i=>{const e=[];for(const[a,t]of Object.entries(i.paths??{})){const c=a.includes("#")?a.slice(0,a.indexOf("#")):a;for(const n of x){const r=t[n];r!==void 0&&e.push(A(a,c,n,r,i))}}return e},b=i=>{const e=i??{},a=O(e),t=new Map((e.tags??[]).map(s=>[s.name,s.description])),c=new Set,n=[],r=s=>{if(c.has(s))return;c.add(s);const m=a.filter(d=>(d.tags[0]??"")===s);m.length>0&&n.push({description:t.get(s),name:s,operations:m})};for(const s of e.tags??[])r(s.name);for(const s of a)r(s.tags[0]??"");return{groups:n,operationByKey:new Map(a.map(s=>[s.key,s])),server:e.servers?.[0]?.url,title:e.info?.title??"API reference",version:e.info?.version}},S=i=>{const{paths:e}=i;return e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0},$=i=>{const e=i;return S(e)?{kind:"empty"}:{kind:"ready",spec:e}},U=i=>{const e=y(23),{spec:a}=i,t=I(),c=k();let n;e[0]!==c?(n=()=>c.fetchOpenApi(),e[0]=c,e[1]=n):n=e[1];const r=v(a,n,$);let s;e[2]!==r.kind||e[3]!==r.spec?(s=r.kind==="ready"?b(r.spec):void 0,e[2]=r.kind,e[3]=r.spec,e[4]=s):s=e[4];const m=s;if(r.kind==="loading"){let o;return e[5]===Symbol.for("react.memo_cache_sentinel")?(o=w("div",{className:"flex flex-col gap-4","data-testid":"api-reference-loading",children:[f(h,{className:"h-8 w-48"}),f(h,{className:"h-64 w-full"})]}),e[5]=o):o=e[5],o}if(r.kind==="error"){let o;e[6]!==r.message||e[7]!==t?(o=t("Couldn't load the OpenAPI spec: {message}",{message:r.message}),e[6]=r.message,e[7]=t,e[8]=o):o=e[8];let p;e[9]!==t?(p=t("API reference unavailable"),e[9]=t,e[10]=p):p=e[10];let l;return e[11]!==o||e[12]!==p?(l=f(u,{description:o,testId:"api-reference-error",title:p}),e[11]=o,e[12]=p,e[13]=l):l=e[13],l}if(r.kind==="empty"||m===void 0){let o;e[14]!==t?(o=t("Run `lunora codegen` and wire `_generated/openapi.json` to the worker to render the API reference here."),e[14]=t,e[15]=o):o=e[15];let p;e[16]!==t?(p=t("No OpenAPI spec configured"),e[16]=t,e[17]=p):p=e[17];let l;return e[18]!==o||e[19]!==p?(l=f(u,{description:o,testId:"api-reference-empty",title:p}),e[18]=o,e[19]=p,e[20]=l):l=e[20],l}let d;return e[21]!==m?(d=f(j,{model:m}),e[21]=m,e[22]=d):d=e[22],d};export{U as default};
@@ -1 +1 @@
1
- import{c as I}from"react/compiler-runtime";import{Dialog as L}from"@base-ui/react/dialog";import{useNavigate as M}from"@tanstack/react-router";import{useState as R,useRef as O,useEffect as U}from"react";import{useT as W}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{f as X}from"./internal-BSIsQVC6.js";import{c as Y}from"./utils-bhneXptQ.js";import{jsx as l,jsxs as S}from"react/jsx-runtime";const z="lunora:command-palette",re=()=>{"window"in globalThis&&globalThis.dispatchEvent(new Event(z))},q=g=>{const e=I(18),{active:u,index:a,item:n,onActivate:f,onSelect:h}=g;let s;e[0]!==n||e[1]!==h?(s=()=>{h(n)},e[0]=n,e[1]=h,e[2]=s):s=e[2];const b=s;let c;e[3]!==a||e[4]!==f?(c=()=>{f(a)},e[3]=a,e[4]=f,e[5]=c):c=e[5];const p=c,x=u?"bg-accent text-accent-foreground":"text-foreground";let i;e[6]!==x?(i=Y("flex w-full items-center justify-between gap-3 rounded-md px-3 py-2 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground",x),e[6]=x,e[7]=i):i=e[7];let d;e[8]!==n.label?(d=l("span",{children:n.label}),e[8]=n.label,e[9]=d):d=e[9];let m;e[10]!==n.group?(m=l("span",{className:"text-xs text-muted-foreground",children:n.group}),e[10]=n.group,e[11]=m):m=e[11];let t;return e[12]!==b||e[13]!==p||e[14]!==i||e[15]!==d||e[16]!==m?(t=l("li",{children:S("button",{className:i,onClick:b,onMouseEnter:p,type:"button",children:[d,m]})}),e[12]=b,e[13]=p,e[14]=i,e[15]=d,e[16]=m,e[17]=t):t=e[17],t},G=(g,e)=>{const u=e.trim().toLowerCase();return u===""?g:g.filter(a=>a.label.toLowerCase().includes(u)||a.group.toLowerCase().includes(u))},le=g=>{const e=I(39),{items:u}=g,a=W(),n=M(),[f,h]=R(!1),[s,b]=R(""),[c,p]=R(0),x=O(null);let i,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{const o=B=>{(B.metaKey||B.ctrlKey)&&B.key.toLowerCase()==="k"&&(B.preventDefault(),h(!0))},r=()=>{h(!0)};return globalThis.addEventListener("keydown",o),globalThis.addEventListener(z,r),()=>{globalThis.removeEventListener("keydown",o),globalThis.removeEventListener(z,r)}},d=[],e[0]=i,e[1]=d):(i=e[0],d=e[1]),U(i,d);let m;e[2]!==u||e[3]!==s?(m=G(u,s),e[2]=u,e[3]=s,e[4]=m):m=e[4];const t=m;let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T=o=>{h(o),o||(b(""),p(0))},e[5]=T):T=e[5];const H=T;let D;e[6]!==n?(D=o=>{H(!1),X(n({to:o.to}))},e[6]=n,e[7]=D):D=e[7];const v=D;let A;e[8]===Symbol.for("react.memo_cache_sentinel")?(A=o=>{b(o.target.value),p(0)},e[8]=A):A=e[8];const J=A;let j;e[9]!==c||e[10]!==t||e[11]!==v?(j=o=>{e:switch(o.key){case"ArrowDown":{o.preventDefault(),p(r=>t.length===0?0:(r+1)%t.length);break e}case"ArrowUp":{o.preventDefault(),p(r=>t.length===0?0:(r-1+t.length)%t.length);break e}case"Enter":{o.preventDefault();const r=t[c];r!==void 0&&v(r);break e}}},e[9]=c,e[10]=t,e[11]=v,e[12]=j):j=e[12];const F=j;let K;e[13]===Symbol.for("react.memo_cache_sentinel")?(K=l(L.Backdrop,{className:"fixed inset-0 z-50 bg-black/40 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0"}),e[13]=K):K=e[13];let w;e[14]!==a?(w=a("Command palette"),e[14]=a,e[15]=w):w=e[15];let y;e[16]!==w?(y=l(L.Title,{className:"sr-only",children:w}),e[16]=w,e[17]=y):y=e[17];let P;e[18]===Symbol.for("react.memo_cache_sentinel")?(P=S("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.8,viewBox:"0 0 24 24",children:[l("circle",{cx:"11",cy:"11",r:"7"}),l("path",{d:"m21 21-4.3-4.3",strokeLinecap:"round"})]}),e[18]=P):P=e[18];let k;e[19]!==a?(k=a("Search…"),e[19]=a,e[20]=k):k=e[20];let N;e[21]!==F||e[22]!==s||e[23]!==k?(N=S("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[P,l("input",{className:"h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground","data-testid":"dash-command-input",onChange:J,onKeyDown:F,placeholder:k,ref:x,type:"text",value:s})]}),e[21]=F,e[22]=s,e[23]=k,e[24]=N):N=e[24];let C;e[25]!==c||e[26]!==t||e[27]!==v||e[28]!==a?(C=t.length===0?l("li",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:a("No results.")}):t.map((o,r)=>l(q,{active:r===c,index:r,item:o,onActivate:p,onSelect:v},o.to)),e[25]=c,e[26]=t,e[27]=v,e[28]=a,e[29]=C):C=e[29];let _;e[30]!==C?(_=l("ul",{className:"max-h-80 overflow-y-auto p-1.5","data-testid":"dash-command-list",children:C}),e[30]=C,e[31]=_):_=e[31];let E;e[32]!==y||e[33]!==N||e[34]!==_?(E=S(L.Portal,{children:[K,S(L.Popup,{className:"fixed start-1/2 top-24 z-50 w-[36rem] max-w-[90vw] -translate-x-1/2 overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-lg outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95","data-testid":"dash-command-palette",initialFocus:x,children:[y,N,_]})]}),e[32]=y,e[33]=N,e[34]=_,e[35]=E):E=e[35];let $;return e[36]!==f||e[37]!==E?($=l(L.Root,{onOpenChange:H,open:f,children:E}),e[36]=f,e[37]=E,e[38]=$):$=e[38],$};export{le as CommandPalette,re as openCommandPalette};
1
+ import{c as I}from"react/compiler-runtime";import{Dialog as L}from"@base-ui/react/dialog";import{useNavigate as M}from"@tanstack/react-router";import{useState as R,useRef as O,useEffect as U}from"react";import{useT as W}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{f as X}from"./internal-zkEvTqy8.js";import{c as Y}from"./utils-bhneXptQ.js";import{jsx as l,jsxs as S}from"react/jsx-runtime";const z="lunora:command-palette",re=()=>{"window"in globalThis&&globalThis.dispatchEvent(new Event(z))},q=g=>{const e=I(18),{active:u,index:a,item:n,onActivate:f,onSelect:h}=g;let s;e[0]!==n||e[1]!==h?(s=()=>{h(n)},e[0]=n,e[1]=h,e[2]=s):s=e[2];const b=s;let c;e[3]!==a||e[4]!==f?(c=()=>{f(a)},e[3]=a,e[4]=f,e[5]=c):c=e[5];const p=c,x=u?"bg-accent text-accent-foreground":"text-foreground";let i;e[6]!==x?(i=Y("flex w-full items-center justify-between gap-3 rounded-md px-3 py-2 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground",x),e[6]=x,e[7]=i):i=e[7];let d;e[8]!==n.label?(d=l("span",{children:n.label}),e[8]=n.label,e[9]=d):d=e[9];let m;e[10]!==n.group?(m=l("span",{className:"text-xs text-muted-foreground",children:n.group}),e[10]=n.group,e[11]=m):m=e[11];let t;return e[12]!==b||e[13]!==p||e[14]!==i||e[15]!==d||e[16]!==m?(t=l("li",{children:S("button",{className:i,onClick:b,onMouseEnter:p,type:"button",children:[d,m]})}),e[12]=b,e[13]=p,e[14]=i,e[15]=d,e[16]=m,e[17]=t):t=e[17],t},G=(g,e)=>{const u=e.trim().toLowerCase();return u===""?g:g.filter(a=>a.label.toLowerCase().includes(u)||a.group.toLowerCase().includes(u))},le=g=>{const e=I(39),{items:u}=g,a=W(),n=M(),[f,h]=R(!1),[s,b]=R(""),[c,p]=R(0),x=O(null);let i,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{const o=B=>{(B.metaKey||B.ctrlKey)&&B.key.toLowerCase()==="k"&&(B.preventDefault(),h(!0))},r=()=>{h(!0)};return globalThis.addEventListener("keydown",o),globalThis.addEventListener(z,r),()=>{globalThis.removeEventListener("keydown",o),globalThis.removeEventListener(z,r)}},d=[],e[0]=i,e[1]=d):(i=e[0],d=e[1]),U(i,d);let m;e[2]!==u||e[3]!==s?(m=G(u,s),e[2]=u,e[3]=s,e[4]=m):m=e[4];const t=m;let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T=o=>{h(o),o||(b(""),p(0))},e[5]=T):T=e[5];const H=T;let D;e[6]!==n?(D=o=>{H(!1),X(n({to:o.to}))},e[6]=n,e[7]=D):D=e[7];const v=D;let A;e[8]===Symbol.for("react.memo_cache_sentinel")?(A=o=>{b(o.target.value),p(0)},e[8]=A):A=e[8];const J=A;let j;e[9]!==c||e[10]!==t||e[11]!==v?(j=o=>{e:switch(o.key){case"ArrowDown":{o.preventDefault(),p(r=>t.length===0?0:(r+1)%t.length);break e}case"ArrowUp":{o.preventDefault(),p(r=>t.length===0?0:(r-1+t.length)%t.length);break e}case"Enter":{o.preventDefault();const r=t[c];r!==void 0&&v(r);break e}}},e[9]=c,e[10]=t,e[11]=v,e[12]=j):j=e[12];const F=j;let K;e[13]===Symbol.for("react.memo_cache_sentinel")?(K=l(L.Backdrop,{className:"fixed inset-0 z-50 bg-black/40 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0"}),e[13]=K):K=e[13];let w;e[14]!==a?(w=a("Command palette"),e[14]=a,e[15]=w):w=e[15];let y;e[16]!==w?(y=l(L.Title,{className:"sr-only",children:w}),e[16]=w,e[17]=y):y=e[17];let P;e[18]===Symbol.for("react.memo_cache_sentinel")?(P=S("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.8,viewBox:"0 0 24 24",children:[l("circle",{cx:"11",cy:"11",r:"7"}),l("path",{d:"m21 21-4.3-4.3",strokeLinecap:"round"})]}),e[18]=P):P=e[18];let k;e[19]!==a?(k=a("Search…"),e[19]=a,e[20]=k):k=e[20];let N;e[21]!==F||e[22]!==s||e[23]!==k?(N=S("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[P,l("input",{className:"h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground","data-testid":"dash-command-input",onChange:J,onKeyDown:F,placeholder:k,ref:x,type:"text",value:s})]}),e[21]=F,e[22]=s,e[23]=k,e[24]=N):N=e[24];let C;e[25]!==c||e[26]!==t||e[27]!==v||e[28]!==a?(C=t.length===0?l("li",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:a("No results.")}):t.map((o,r)=>l(q,{active:r===c,index:r,item:o,onActivate:p,onSelect:v},o.to)),e[25]=c,e[26]=t,e[27]=v,e[28]=a,e[29]=C):C=e[29];let _;e[30]!==C?(_=l("ul",{className:"max-h-80 overflow-y-auto p-1.5","data-testid":"dash-command-list",children:C}),e[30]=C,e[31]=_):_=e[31];let E;e[32]!==y||e[33]!==N||e[34]!==_?(E=S(L.Portal,{children:[K,S(L.Popup,{className:"fixed start-1/2 top-24 z-50 w-[36rem] max-w-[90vw] -translate-x-1/2 overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-lg outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95","data-testid":"dash-command-palette",initialFocus:x,children:[y,N,_]})]}),e[32]=y,e[33]=N,e[34]=_,e[35]=E):E=e[35];let $;return e[36]!==f||e[37]!==E?($=l(L.Root,{onOpenChange:H,open:f,children:E}),e[36]=f,e[37]=E,e[38]=$):$=e[38],$};export{le as CommandPalette,re as openCommandPalette};
@@ -0,0 +1 @@
1
+ import{c as j}from"react/compiler-runtime";import{useLunora as Je}from"@lunora/react";import{useState as P,useMemo as ot,useRef as je,useCallback as rt,useEffect as Re}from"react";import{ShardInput as cn}from"./ShardInput-BVn2iCU0.js";import{N as ze}from"./use-admin-query-CnnyWJXM.js";import{ADMIN_FUNCTIONS as ee}from"./ADMIN_FUNCTIONS-4aE59aDq.js";import{b as $t}from"./browser-storage-xjTyMKY0.js";import{h as Me,f as se,j as un,d as ue,g as ve,i as mn}from"./internal-zkEvTqy8.js";import{k as gn}from"./use-sql-assistant-Dtw55kKM.js";import{ConfirmButton as lt}from"./ConfirmButton-CTL3f3kr.js";import{E as fn}from"./empty-state-Cg7t_8qu.js";import{useT as me}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{useReactTable as bn,getSortedRowModel as pn,getCoreRowModel as hn,flexRender as xn}from"@tanstack/react-table";import{useVirtualizer as vn}from"@tanstack/react-virtual";import{f as it}from"./checkbox-StT4Gob6.js";import{c as Ve}from"./utils-bhneXptQ.js";import{l as wn}from"./virtual-rect-1o1veP7R.js";import{g as Ye,k as yn,v as Sn}from"./data-grid-Ci4-tZkk.js";import{jsx as m,jsxs as T,Fragment as qe}from"react/jsx-runtime";import{DataFilters as Nn,toFilterClauses as Ee}from"./DataFilters-B26ZeqBZ.js";import{c as Cn,r as kn}from"./grid-features-Db_BNYRo.js";import{_ as $n,u as Tn,i as et,a as En,$ as Rn}from"./table-list-sidebar-fz0m_4I4.js";import{M as Tt}from"./modal-shell-CUwwWC2o.js";import{a as _n,s as Mn,m as Pn,O as Dn}from"./wire-codec-BUrWLklj.js";import bt from"./useDebounced-CU-uftxO.js";import{r as In,l as On}from"./shard-history-DMEW5VBE.js";const pt=(r,e)=>{const n=[];for(const[o,t]of Object.entries(e))for(const l of t)l.ref===r&&n.push({column:l.name,table:o});return n.sort((o,t)=>o.table.localeCompare(t.table)||o.column.localeCompare(t.column)),n},dt=r=>`${r.table}.${r.column}`,Fn=/([a-z\d])([A-Z])/gu,zn=/[\s_-]+/u,jn=new Set(["access_token","api_key","apikey","card_number","client_secret","credit_card","cvv","passwd","password","private_key","pwd","refresh_token","secret","ssn","token"]),An=r=>{const e=r.replaceAll(Fn,"$1 $2").split(zn).map(o=>o.toLowerCase()).filter(o=>o.length>0),n=new Set(e);for(let o=0;o<e.length-1;o+=1){const t=e[o],l=e[o+1];t===void 0||l===void 0||(n.add(`${t}${l}`),n.add(`${t}_${l}`))}return[...n]},ht="•••",Ln=r=>{let e=2166136261;for(let n=0;n<r.length;n+=1)e^=r.codePointAt(n)??0,e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")},Et=(r,e)=>{try{return e==="redact"?null:e==="hash"?r==null?r:Ln(typeof r=="bigint"?r.toString():typeof r=="string"?r:JSON.stringify(r)):ht}catch{return ht}},Bn=(r,e)=>{const n=new Map;for(const o of r)o.table===e&&n.set(o.column,o.strategy);return n},Vn=r=>{for(const e of An(r))if(jn.has(e))return!0;return!1},qn=(r,e)=>{const n=e.filter(t=>!r.has(t)&&Vn(t));if(n.length===0)return r;const o=new Map(r);for(const t of n)o.set(t,"redact");return o},Jn=(r,e,n)=>{if(!n.enabled)return r;const o=n.columns.get(e);return o===void 0?r:Et(r,o)},xt=(r,e)=>!e.enabled||e.columns.size===0?r:r.map(n=>{const o={...n};for(const[t,l]of e.columns)t in o&&(o[t]=Et(o[t],l));return o}),Kn=(r,e,n,o,t=300)=>{if(o<=0)return{ids:new Set(r.map(c=>c.id)),leadPx:0,tailPx:0};const l=n-t,i=n+o+t,a=new Set;let d=0,s=0,g=0;for(const c of r){const u=c.getSize(),b=e.has(c.id),f=d+u>l&&d<i;b||f?a.add(c.id):d<l?s+=u:g+=u,d+=u}return{ids:a,leadPx:s,tailPx:g}},Gn=(r,e)=>{const n=new Map;let o=0;for(const t of r)e.has(t.id)&&(n.set(t.id,o),o+=t.getSize());return n},Hn=()=>{const r=j(11);let e;r[0]===Symbol.for("react.memo_cache_sentinel")?(e={},r[0]=e):e=r[0];const[n,o]=P(e);let t;r[1]===Symbol.for("react.memo_cache_sentinel")?(t=(b,f,p)=>{o(v=>({...v,[b]:{...v[b],[f]:p}}))},r[1]=t):t=r[1];const l=t;let i;r[2]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{o({})},r[2]=i):i=r[2];const a=i;let d;r[3]!==n?(d=(b,f)=>{const p=n[b];return p!==void 0&&f in p?{value:p[f]}:void 0},r[3]=n,r[4]=d):d=r[4];const s=d;let g;r[5]!==n?(g=Object.values(n).reduce(Un,0),r[5]=n,r[6]=g):g=r[6];const c=g;let u;return r[7]!==c||r[8]!==n||r[9]!==s?(u={clear:a,count:c,stage:l,staged:n,stagedValue:s},r[7]=c,r[8]=n,r[9]=s,r[10]=u):u=r[10],u},Qn=(r,e)=>{if(typeof e=="number"){const n=Number(r);return r.trim()===""||Number.isNaN(n)?r:n}if(typeof e=="boolean"){if(r==="true")return!0;if(r==="false")return!1}return r},Wn=r=>{const e=j(29),{changes:n,committing:o,onCommit:t,onDiscard:l}=r,i=me();let a;e[0]!==n.length||e[1]!==i?(a=i("{count} pending changes",{count:n.length}),e[0]=n.length,e[1]=i,e[2]=a):a=e[2];let d;e[3]!==a?(d=m("span",{className:"font-mono text-[11px] tracking-wide uppercase text-warning","data-testid":"db-staged-count",children:a}),e[3]=a,e[4]=d):d=e[4];let s;e[5]!==o||e[6]!==i?(s=i(o?"Committing…":"Commit"),e[5]=o,e[6]=i,e[7]=s):s=e[7];let g;e[8]!==o||e[9]!==t||e[10]!==s?(g=m("button",{className:"ms-auto rounded-md bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"db-staged-commit",disabled:o,onClick:t,type:"button",children:s}),e[8]=o,e[9]=t,e[10]=s,e[11]=g):g=e[11];let c;e[12]!==i?(c=i("Discard"),e[12]=i,e[13]=c):c=e[13];let u;e[14]!==o||e[15]!==l||e[16]!==c?(u=m("button",{className:"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","data-testid":"db-staged-discard",disabled:o,onClick:l,type:"button",children:c}),e[14]=o,e[15]=l,e[16]=c,e[17]=u):u=e[17];let b;e[18]!==d||e[19]!==g||e[20]!==u?(b=T("div",{className:"flex flex-wrap items-center gap-2",children:[d,g,u]}),e[18]=d,e[19]=g,e[20]=u,e[21]=b):b=e[21];let f;e[22]!==n?(f=n.map(Zn),e[22]=n,e[23]=f):f=e[23];let p;e[24]!==f?(p=m("ul",{className:"flex flex-col gap-1","data-testid":"db-staged-list",children:f}),e[24]=f,e[25]=p):p=e[25];let v;return e[26]!==b||e[27]!==p?(v=T("div",{className:"flex flex-col gap-2 border border-warning/40 bg-warning/5 p-3","data-testid":"db-staged",children:[b,p]}),e[26]=b,e[27]=p,e[28]=v):v=e[28],v};function Un(r,e){return r+Object.keys(e).length}function Zn(r){return T("li",{className:"flex flex-wrap items-center gap-2 font-mono text-xs",children:[T("span",{className:"text-muted-foreground",children:[r.rowId,".",r.column]}),m("span",{className:"text-destructive line-through",children:Me(r.oldValue)}),m("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"→"}),m("span",{className:"text-foreground",children:Me(r.newValue)})]},`${r.rowId}:${r.column}`)}const vt=400,Xn=36,Yn={flex:"1 1 0%",minHeight:0,overflow:"auto",position:"relative"},eo={width:"100%"},to={alignItems:"center",display:"flex",left:0,position:"absolute",top:0,width:"100%"},no={display:"flex",width:"100%"},wt={flex:"0 0 8.5rem",padding:"0.375rem 0.75rem"},oo="2.5rem",Rt={alignItems:"center",display:"flex",flex:"0 0 2.5rem",justifyContent:"center",left:0,padding:"0.375rem 0",position:"sticky",zIndex:2},ct=r=>({flex:"0 0 auto",overflow:"hidden",padding:"0.375rem 0.75rem",position:"relative",textOverflow:"ellipsis",whiteSpace:"nowrap",width:`${r.toString()}px`}),_t=(r,e)=>({...ct(r),left:`calc(${oo} + ${e.toString()}px)`,position:"sticky",zIndex:2}),yt="rounded-md px-2 py-0.5 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",ro=(r,e,n)=>e.enabled&&e.columns.has(n)?void 0:r,at="__back__:",lo=r=>`${at}${r.table}.${r.column}`,ao=r=>{const e=j(3),{counts:n,rowId:o}=r;if(n===void 0){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=m("span",{className:"text-muted-foreground/50",children:"—"}),e[0]=i):i=e[0],i}const t=n[o]??0;let l;return e[1]!==t?(l=m("span",{className:"tabular-nums",children:t}),e[1]=t,e[2]=l):l=e[2],l},ye=r=>{for(const e of["id","__id__","_id"]){const n=r[e];if(typeof n=="string"||typeof n=="number")return String(n)}return null},Mt=(r,e)=>ye(r)??`row-${e.toString()}`,so=8,io=r=>{const e=j(16),{anchor:n,state:o}=r,t=me();let l;e[0]!==n.left||e[1]!==n.top?(l={left:n.left,position:"fixed",top:n.top,zIndex:50},e[0]=n.left,e[1]=n.top,e[2]=l):l=e[2];const i=l;let a;if(o==="loading"){let s;e[3]!==t?(s=t("Loading…"),e[3]=t,e[4]=s):s=e[4];let g;e[5]!==s?(g=m("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:s}),e[5]=s,e[6]=g):g=e[6],a=g}else if(o.row===null){let s;e[7]!==t?(s=t("No matching row."),e[7]=t,e[8]=s):s=e[8];let g;e[9]!==s?(g=m("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:s}),e[9]=s,e[10]=g):g=e[10],a=g}else{let s;if(e[11]!==o.row){const g=Object.entries(o.row).slice(0,so);s=m("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 px-3 py-2",children:g.map(yo)}),e[11]=o.row,e[12]=s}else s=e[12];a=s}let d;return e[13]!==a||e[14]!==i?(d=m("div",{className:"pointer-events-none w-72 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground","data-testid":"db-ref-preview",role:"tooltip",style:i,children:a}),e[13]=a,e[14]=i,e[15]=d):d=e[15],d},co=r=>{const e=j(22),{column:n,id:o,onNavigate:t,onPreview:l,target:i}=r,[a,d]=P(null),[s,g]=P("idle");let c;e[0]!==o||e[1]!==t||e[2]!==i?(c=()=>{t(i,o)},e[0]=o,e[1]=t,e[2]=i,e[3]=c):c=e[3];const u=c;let b;e[4]!==o||e[5]!==l||e[6]!==s||e[7]!==i?(b=$=>{const h=$.currentTarget.getBoundingClientRect();d({left:h.left,top:h.bottom+4}),s==="idle"&&(g("loading"),se((async()=>{try{g({row:await l(i,o)})}catch{g({row:null})}})()))},e[4]=o,e[5]=l,e[6]=s,e[7]=i,e[8]=b):b=e[8];const f=b;let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{d(null)},e[9]=p):p=e[9];const v=p,x=`db-ref-${n}`,w=`Open ${i} ${o}`;let y;e[10]!==o||e[11]!==u||e[12]!==f||e[13]!==x||e[14]!==w?(y=T("button",{"data-testid":x,onBlur:v,onClick:u,onFocus:f,onMouseEnter:f,onMouseLeave:v,title:w,type:"button",children:[o," ↗"]}),e[10]=o,e[11]=u,e[12]=f,e[13]=x,e[14]=w,e[15]=y):y=e[15];let S;e[16]!==a||e[17]!==s?(S=a!==null&&s!=="idle"&&m(io,{anchor:a,state:s}),e[16]=a,e[17]=s,e[18]=S):S=e[18];let N;return e[19]!==y||e[20]!==S?(N=T(qe,{children:[y,S]}),e[19]=y,e[20]=S,e[21]=N):N=e[21],N},uo=r=>r==="asc"?" ▲":r==="desc"?" ▼":"",mo="absolute end-1 top-1/2 hidden -translate-y-1/2 items-center justify-center rounded text-muted-foreground outline-none group-hover/cell:flex hover:text-foreground focus-visible:flex",St=r=>{const e=j(8),{column:n,onExpand:o,value:t}=r;let l;e[0]!==n||e[1]!==o||e[2]!==t?(l=()=>{o(n,t)},e[0]=n,e[1]=o,e[2]=t,e[3]=l):l=e[3];const i=l,a=`db-expand-${n}`;let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=m("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:m("path",{d:"M9 21H5a2 2 0 0 1-2-2v-4m18 0v4a2 2 0 0 1-2 2h-4M3 9V5a2 2 0 0 1 2-2h4m6 0h4a2 2 0 0 1 2 2v4"})}),e[4]=d):d=e[4];let s;return e[5]!==i||e[6]!==a?(s=m("button",{"aria-label":"Expand cell",className:mo,"data-testid":a,onClick:i,type:"button",children:d}),e[5]=i,e[6]=a,e[7]=s):s=e[7],s},go=r=>{const e=j(15),{column:n,initial:o,onCancel:t,onCommit:l,recordId:i}=r,a=je(null);let d,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{a.current?.select()},s=[],e[0]=d,e[1]=s):(d=e[0],s=e[1]),Re(d,s);let g;e[2]!==t||e[3]!==l?(g=x=>{x.key==="Enter"?(x.preventDefault(),l(x.currentTarget.value)):x.key==="Escape"&&(x.preventDefault(),t())},e[2]=t,e[3]=l,e[4]=g):g=e[4];const c=g;let u;e[5]!==l?(u=x=>{l(x.currentTarget.value)},e[5]=l,e[6]=u):u=e[6];const b=u,f=`db-cell-input-${i}-${n}`;let p;e[7]!==o?(p=Me(o),e[7]=o,e[8]=p):p=e[8];let v;return e[9]!==n||e[10]!==b||e[11]!==c||e[12]!==f||e[13]!==p?(v=m("input",{"aria-label":n,className:"w-full rounded border border-ring bg-background px-1 py-0.5 font-mono text-xs outline-none","data-testid":f,defaultValue:p,onBlur:b,onKeyDown:c,ref:a}),e[9]=n,e[10]=b,e[11]=c,e[12]=f,e[13]=p,e[14]=v):v=e[14],v},fo=r=>{const e=j(68),{cell:n,edit:o,highlight:t,mask:l,refs:i}=r,a=n.column.id;let d,s,g,c;if(e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==l||e[4]!==i.columns||e[5]!==i.onNavigate||e[6]!==i.onPreview){c=Symbol.for("react.early_return_sentinel");e:{s=n.getValue(),d=ye(n.row.original);const E=i.columns?.[a];if(l.enabled&&l.columns.has(a)){const R=`db-masked-${a}`,_=m(Ye,{value:Jn(s,a,l)});let k;e[11]!==R||e[12]!==_?(k=m("span",{className:"text-muted-foreground italic","data-testid":R,title:"Masked (preview)",children:_}),e[11]=R,e[12]=_,e[13]=k):k=e[13],c=k;break e}if(E!==void 0&&(typeof s=="string"||typeof s=="number")&&String(s)!==""){const R=String(s),_=`${E}:${String(s)}`;let k;e[14]!==a||e[15]!==i.onNavigate||e[16]!==i.onPreview||e[17]!==R||e[18]!==_||e[19]!==E?(k=m(co,{column:a,id:R,onNavigate:i.onNavigate,onPreview:i.onPreview,target:E},_),e[14]=a,e[15]=i.onNavigate,e[16]=i.onPreview,e[17]=R,e[18]=_,e[19]=E,e[20]=k):k=e[20],c=k;break e}if(d===null){let R;e[21]!==s?(R=m(Ye,{value:s}),e[21]=s,e[22]=R):R=e[22];let _;e[23]!==a||e[24]!==o.onExpandCell||e[25]!==s?(_=m(St,{column:a,onExpand:o.onExpandCell,value:s}),e[23]=a,e[24]=o.onExpandCell,e[25]=s,e[26]=_):_=e[26];let k;e[27]!==R||e[28]!==_?(k=T(qe,{children:[R,_]}),e[27]=R,e[28]=_,e[29]=k):k=e[29],c=k;break e}g=o.stagedValue(d,a)}e[0]=n,e[1]=a,e[2]=o,e[3]=l,e[4]=i.columns,e[5]=i.onNavigate,e[6]=i.onPreview,e[7]=d,e[8]=s,e[9]=g,e[10]=c}else d=e[7],s=e[8],g=e[9],c=e[10];if(c!==Symbol.for("react.early_return_sentinel"))return c;const u=g,b=u===void 0?s:u.value;let f;e[30]!==a||e[31]!==o?(f=o.editable&&o.editableColumn(a),e[30]=a,e[31]=o,e[32]=f):f=e[32];const p=f;if(o.editingCell!==null&&o.editingCell.rowId===d&&o.editingCell.column===a){let E;e[33]!==a||e[34]!==o||e[35]!==d||e[36]!==s?(E=_=>{o.stage(d,a,Qn(_,s)),o.cancelEdit()},e[33]=a,e[34]=o,e[35]=d,e[36]=s,e[37]=E):E=e[37];let R;return e[38]!==a||e[39]!==b||e[40]!==o.cancelEdit||e[41]!==d||e[42]!==E?(R=m(go,{column:a,initial:b,onCancel:o.cancelEdit,onCommit:E,recordId:d}),e[38]=a,e[39]=b,e[40]=o.cancelEdit,e[41]=d,e[42]=E,e[43]=R):R=e[43],R}let v;u!==void 0?v="rounded bg-warning/15 px-1":p&&(v="cursor-text");let x;e[44]!==p||e[45]!==a||e[46]!==o||e[47]!==d?(x=p?()=>{o.startEdit(d,a)}:void 0,e[44]=p,e[45]=a,e[46]=o,e[47]=d,e[48]=x):x=e[48];const w=x,y=v,S=`db-cell-${d}-${a}`;let N;e[49]!==a||e[50]!==t||e[51]!==l?(N=ro(t,l,a),e[49]=a,e[50]=t,e[51]=l,e[52]=N):N=e[52];let $;e[53]!==b||e[54]!==N?($=m(Ye,{highlight:N,value:b}),e[53]=b,e[54]=N,e[55]=$):$=e[55];let h;e[56]!==v||e[57]!==w||e[58]!==S||e[59]!==$?(h=m("span",{className:y,"data-testid":S,onDoubleClick:w,children:$}),e[56]=v,e[57]=w,e[58]=S,e[59]=$,e[60]=h):h=e[60];let C;e[61]!==a||e[62]!==b||e[63]!==o.onExpandCell?(C=m(St,{column:a,onExpand:o.onExpandCell,value:b}),e[61]=a,e[62]=b,e[63]=o.onExpandCell,e[64]=C):C=e[64];let D;return e[65]!==C||e[66]!==h?(D=T(qe,{children:[h,C]}),e[65]=C,e[66]=h,e[67]=D):D=e[67],D},bo=r=>{r.preventDefault()},po=({draggedRef:r,header:e,masked:n=!1,onTogglePin:o,pinnedOffset:t,table:l})=>{const i=()=>{r.current=e.column.id},a=()=>{const d=r.current,s=e.column.id;if(r.current=null,d===null||d===s)return;const g=l.getState().columnOrder,c=(g.length>0?g:l.getAllLeafColumns().map(b=>b.id)).filter(b=>b!==d),u=c.indexOf(s);c.splice(u===-1?c.length:u,0,d),l.setColumnOrder(c)};return T("th",{className:Ve("group/head text-start text-xs font-medium text-muted-foreground",t!==void 0&&"border-e border-border bg-muted"),draggable:!0,onDragOver:bo,onDragStart:i,onDrop:a,style:t===void 0?ct(e.getSize()):_t(e.getSize(),t),children:[T("button",{className:"inline-flex max-w-full cursor-grab items-center gap-1 truncate outline-none hover:text-foreground","data-testid":`db-sort-${e.column.id}`,onClick:e.column.getToggleSortingHandler(),type:"button",children:[xn(e.column.columnDef.header,e.getContext()),uo(e.column.getIsSorted())]}),n&&m("span",{className:"ms-1 inline-flex items-center rounded-sm bg-warning/15 px-1 text-[0.625rem] font-medium uppercase text-warning","data-testid":`db-mask-chip-${e.column.id}`,title:"This column is masked by a mask() policy",children:"masked"}),m("button",{"aria-label":t===void 0?`Pin ${e.column.id}`:`Unpin ${e.column.id}`,"aria-pressed":t!==void 0,className:Ve("ms-1 rounded-sm px-1 text-[0.625rem] outline-none transition-opacity hover:bg-accent focus-visible:bg-accent",t===void 0?"opacity-0 group-hover/head:opacity-100 focus-visible:opacity-100":"opacity-100 text-foreground"),"data-testid":`db-pin-${e.column.id}`,onClick:()=>{o(e.column.id)},type:"button",children:"📌"}),m("span",{"aria-hidden":"true",className:"absolute inset-y-0 end-0 w-1 cursor-col-resize touch-none select-none hover:bg-ring/60 data-[resizing=true]:bg-ring","data-resizing":e.column.getIsResizing(),"data-testid":`db-resize-${e.column.id}`,onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler()})]})},ho=r=>{const e=j(13),{table:n}=r,o=me();let t;e[0]!==n?(t=g=>{n.toggleAllRowsSelected(g)},e[0]=n,e[1]=t):t=e[1];const l=t;let i;e[2]!==o?(i=o("Select all rows"),e[2]=o,e[3]=i):i=e[3];let a;e[4]!==n?(a=n.getIsAllRowsSelected(),e[4]=n,e[5]=a):a=e[5];let d;e[6]!==n?(d=n.getIsSomeRowsSelected()&&!n.getIsAllRowsSelected(),e[6]=n,e[7]=d):d=e[7];let s;return e[8]!==l||e[9]!==i||e[10]!==a||e[11]!==d?(s=m("th",{className:"bg-muted",style:Rt,children:m(it,{"aria-label":i,checked:a,"data-testid":"db-select-all",indeterminate:d,onCheckedChange:l})}),e[8]=l,e[9]=i,e[10]=a,e[11]=d,e[12]=s):s=e[12],s},xo=r=>{const e=j(17),{row:n}=r,o=me();let t;e[0]!==n.original?(t=ye(n.original),e[0]=n.original,e[1]=t):t=e[1];const l=t;let i;e[2]!==n?(i=f=>{n.toggleSelected(f)},e[2]=n,e[3]=i):i=e[3];const a=i;let d;e[4]!==o?(d=o("Select row"),e[4]=o,e[5]=d):d=e[5];let s;e[6]!==n?(s=n.getIsSelected(),e[6]=n,e[7]=s):s=e[7];let g;e[8]!==n.index||e[9]!==n.original?(g=Mt(n.original,n.index),e[8]=n.index,e[9]=n.original,e[10]=g):g=e[10];const c=`db-select-${g}`,u=l===null;let b;return e[11]!==a||e[12]!==d||e[13]!==s||e[14]!==c||e[15]!==u?(b=m("td",{className:"bg-background",style:Rt,children:m(it,{"aria-label":d,checked:s,"data-testid":c,disabled:u,onCheckedChange:a})}),e[11]=a,e[12]=d,e[13]=s,e[14]=c,e[15]=u,e[16]=b):b=e[16],b},vo=r=>{const e=j(70),{edit:n,editable:o,mask:t,onDelete:l,onEdit:i,onInspect:a,highlight:d,backRelationCounts:s,onTogglePin:g,pinnedColumns:c,refs:u,tableModel:b}=r,{attachScroll:f,scrollLeft:p,scrollToIndex:v,table:x,tableRows:w,tbodyStyle:y,viewportWidth:S,virtualRows:N}=b,$=je(null),[h,C]=P(null);let D;e[0]!==x?(D=x.getVisibleLeafColumns(),e[0]=x,e[1]=D):D=e[1];const E=D.length;let R;e[2]!==h||e[3]!==E||e[4]!==n||e[5]!==x||e[6]!==w?(R=pe=>{if(!["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter"].includes(pe.key))return;pe.preventDefault();const W=h??{col:0,row:0};if(pe.key==="Enter"){const L=w[W.row],Y=x.getVisibleLeafColumns()[W.col];if(L!==void 0&&Y!==void 0){const q=ye(L.original);q!==null&&n.editableColumn(Y.id)&&n.startEdit(q,Y.id)}C(W);return}let{col:te,row:Q}=W;e:switch(pe.key){case"ArrowDown":{Q=Math.min(Q+1,w.length-1);break e}case"ArrowRight":{te=Math.min(te+1,E-1);break e}case"ArrowUp":{Q=Math.max(Q-1,0);break e}default:te=Math.max(te-1,0)}C({col:te,row:Q})},e[2]=h,e[3]=E,e[4]=n,e[5]=x,e[6]=w,e[7]=R):R=e[7];const _=R;let k,F;e[8]!==h||e[9]!==v?(k=()=>{h!==null&&v(h.row)},F=[h,v],e[8]=h,e[9]=v,e[10]=k,e[11]=F):(k=e[10],F=e[11]),Re(k,F);let B,O,I,G,A,V,H,Z,ge,oe,re,fe,ie,de;if(e[12]!==h||e[13]!==f||e[14]!==s||e[15]!==n||e[16]!==o||e[17]!==d||e[18]!==t||e[19]!==l||e[20]!==i||e[21]!==_||e[22]!==a||e[23]!==g||e[24]!==c||e[25]!==u||e[26]!==p||e[27]!==x||e[28]!==w||e[29]!==y||e[30]!==S||e[31]!==N){const pe=x.getVisibleLeafColumns().map(So),W=Kn(pe,c,p,S),te=Gn(x.getVisibleLeafColumns().map(No),c),Q=q=>{const Se=w[q.index],{original:Ne}=Se,Ce=ye(Ne),ke=Mt(Ne,q.index),ae={...to,height:`${q.size.toString()}px`,transform:`translateY(${q.start.toString()}px)`};return T("tr",{className:"border-b border-border text-xs transition-colors hover:bg-muted/50","data-testid":"db-row",style:ae,children:[m(xo,{row:Se}),W.leadPx>0&&m("td",{"aria-hidden":"true",style:{flex:`0 0 ${W.leadPx.toString()}px`}}),Se.getVisibleCells().map((J,Pe)=>{if(!W.ids.has(J.column.id))return null;const Te=te.get(J.column.id),De=h!==null&&h.row===q.index&&h.col===Pe?" ring-1 ring-ring ring-inset":"";return m("td",{className:Ve("group/cell truncate font-mono text-muted-foreground",Te!==void 0&&"border-e border-border bg-background",De),style:Te===void 0?ct(J.column.getSize()):_t(J.column.getSize(),Te),children:J.column.id.startsWith(at)?m(ao,{counts:s[J.column.id.slice(at.length)],rowId:ke}):m(fo,{cell:J,edit:n,highlight:d,mask:t,refs:u})},J.id)}),W.tailPx>0&&m("td",{"aria-hidden":"true",style:{flex:`0 0 ${W.tailPx.toString()}px`}}),T("td",{className:"flex items-center gap-1",style:wt,children:[m("button",{className:yt,"data-testid":`db-inspect-${ke}`,onClick:()=>{a(Ne)},type:"button",children:"Details"}),o&&T(qe,{children:[m("button",{className:yt,"data-testid":`db-edit-${ke}`,disabled:Ce===null,onClick:()=>{i(Ce,Ne)},type:"button",children:"Edit"}),m(lt,{confirmLabel:"Delete?",disabled:Ce===null,onConfirm:()=>{l(Ce)},testId:`db-delete-${ke}`,children:"Delete"})]})]})]},Se.id)};B=yn,ge="fill",I="db-scroll",G=_,A=f,V="grid",H=Yn,Z=0,fe="w-full text-xs",ie="db-rows",de=eo;let L;e[46]!==x?(L=m(ho,{table:x}),e[46]=x,e[47]=L):L=e[47];let Y;e[48]===Symbol.for("react.memo_cache_sentinel")?(Y=m("th",{"aria-label":"Row actions",style:wt}),e[48]=Y):Y=e[48],O=m("thead",{className:"bg-muted/50",children:T("tr",{className:"border-b border-border",style:no,children:[L,W.leadPx>0&&m("th",{"aria-hidden":"true",style:{flex:`0 0 ${W.leadPx.toString()}px`}}),x.getFlatHeaders().map(q=>W.ids.has(q.column.id)?m(po,{draggedRef:$,header:q,masked:t.columns.has(q.column.id),onTogglePin:g,pinnedOffset:te.get(q.column.id),table:x},q.id):null),W.tailPx>0&&m("th",{"aria-hidden":"true",style:{flex:`0 0 ${W.tailPx.toString()}px`}}),Y]})}),oe=y,re=N.map(q=>Q(q)),e[12]=h,e[13]=f,e[14]=s,e[15]=n,e[16]=o,e[17]=d,e[18]=t,e[19]=l,e[20]=i,e[21]=_,e[22]=a,e[23]=g,e[24]=c,e[25]=u,e[26]=p,e[27]=x,e[28]=w,e[29]=y,e[30]=S,e[31]=N,e[32]=B,e[33]=O,e[34]=I,e[35]=G,e[36]=A,e[37]=V,e[38]=H,e[39]=Z,e[40]=ge,e[41]=oe,e[42]=re,e[43]=fe,e[44]=ie,e[45]=de}else B=e[32],O=e[33],I=e[34],G=e[35],A=e[36],V=e[37],H=e[38],Z=e[39],ge=e[40],oe=e[41],re=e[42],fe=e[43],ie=e[44],de=e[45];let ce;e[49]!==oe||e[50]!==re?(ce=m("tbody",{style:oe,children:re}),e[49]=oe,e[50]=re,e[51]=ce):ce=e[51];let le;e[52]!==O||e[53]!==ce||e[54]!==fe||e[55]!==ie||e[56]!==de?(le=T("table",{className:fe,"data-testid":ie,style:de,children:[O,ce]}),e[52]=O,e[53]=ce,e[54]=fe,e[55]=ie,e[56]=de,e[57]=le):le=e[57];let X;e[58]!==I||e[59]!==G||e[60]!==A||e[61]!==V||e[62]!==H||e[63]!==Z||e[64]!==le?(X=m("div",{"data-testid":I,onKeyDown:G,ref:A,role:V,style:H,tabIndex:Z,children:le}),e[58]=I,e[59]=G,e[60]=A,e[61]=V,e[62]=H,e[63]=Z,e[64]=le,e[65]=X):X=e[65];let be;return e[66]!==B||e[67]!==ge||e[68]!==X?(be=m(B,{layout:ge,children:X}),e[66]=B,e[67]=ge,e[68]=X,e[69]=be):be=e[69],be},wo=(r,e,n,o=[])=>{const t=r?.columns,l=r?.rows,i=r?.refs,a=ot(()=>{if(t===void 0)return[];const h=t.map(C=>({accessorFn:D=>D[C],header:i?.[C]===void 0?C:`${C} →`,id:C}));for(const C of o)h.push({accessorFn:()=>{},enableSorting:!1,header:`← ${C.table}`,id:lo(C)});return h},[o,t,i]),d=ot(()=>l??[],[l]),[s,g]=P({}),[c,u]=P({}),b=bn({columnResizeMode:"onChange",columns:a,data:d,defaultColumn:{minSize:80,size:200},enableColumnResizing:!0,enableRowSelection:h=>ye(h.original)!==null,getCoreRowModel:hn(),getRowId:(h,C)=>ye(h)??`row-${C.toString()}`,getSortedRowModel:pn(),manualSorting:!0,onColumnVisibilityChange:u,onRowSelectionChange:g,onSortingChange:n,state:{columnVisibility:c,rowSelection:s,sorting:e}}),f=b.getRowModel().rows,p=je(null),v=vn({count:f.length,estimateSize:()=>Xn,getScrollElement:()=>p.current,initialRect:{height:vt,width:0},observeElementRect:(h,C)=>wn(h,C,vt),overscan:8}),x=rt(h=>{v.scrollToIndex(h)},[v]),[w,y]=P({left:0,width:0}),S=rt(h=>{if(p.current=h,h===null)return;const C=()=>{y(E=>E.left===h.scrollLeft&&E.width===h.clientWidth?E:{left:h.scrollLeft,width:h.clientWidth})};h.addEventListener("scroll",C,{passive:!0});const D=new ResizeObserver(C);return D.observe(h),()=>{h.removeEventListener("scroll",C),D.disconnect(),p.current=null}},[]),N=v.getVirtualItems(),$={display:"block",height:`${v.getTotalSize().toString()}px`,position:"relative"};return{attachScroll:S,scrollLeft:w.left,scrollToIndex:x,table:b,tableRows:f,tbodyStyle:$,viewportWidth:w.width,virtualRows:N}};function yo(r){const[e,n]=r;return T("div",{className:"contents",children:[m("dt",{className:"truncate font-mono text-[11px] text-muted-foreground",children:e}),m("dd",{className:"truncate font-mono text-[11px] text-foreground",title:Me(n),children:Me(n)})]},e)}function So(r){return{getSize:()=>r.getSize(),id:r.id}}function No(r){return{getSize:()=>r.getSize(),id:r.id}}const st="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",Co=r=>{const e=j(22),{onCommit:n}=r,o=me(),[t,l]=P(""),i=je(null);let a,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{i.current?.focus()},d=[],e[0]=a,e[1]=d):(a=e[0],d=e[1]),Re(a,d);let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=y=>{l(y.target.value)},e[2]=s):s=e[2];const g=s;let c;e[3]!==t||e[4]!==n?(c=()=>{const y=t.trim();y!==""&&n(y)},e[3]=t,e[4]=n,e[5]=c):c=e[5];const u=c;let b;e[6]!==o?(b=o("Query name"),e[6]=o,e[7]=b):b=e[7];let f;e[8]!==o?(f=o("Query name"),e[8]=o,e[9]=f):f=e[9];let p;e[10]!==t||e[11]!==b||e[12]!==f?(p=m("input",{"aria-label":b,className:"h-7 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"db-save-query-name",onChange:g,placeholder:f,ref:i,value:t}),e[10]=t,e[11]=b,e[12]=f,e[13]=p):p=e[13];let v;e[14]!==o?(v=o("Save"),e[14]=o,e[15]=v):v=e[15];let x;e[16]!==u||e[17]!==v?(x=m("button",{className:st,"data-testid":"db-save-query-confirm",onClick:u,type:"button",children:v}),e[16]=u,e[17]=v,e[18]=x):x=e[18];let w;return e[19]!==p||e[20]!==x?(w=T("span",{className:"inline-flex items-center gap-1",children:[p,x]}),e[19]=p,e[20]=x,e[21]=w):w=e[21],w},ko=r=>{const e=j(27),{onApply:n,onCopyLink:o,onDelete:t,onSave:l,saved:i}=r,a=me(),[d,s]=P(!1);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{s(!0)},e[0]=g):g=e[0];const c=g;let u;e[1]!==l?(u=h=>{l(h),s(!1)},e[1]=l,e[2]=u):u=e[2];const b=u;let f;e[3]!==n||e[4]!==i?(f=h=>{const C=i[Number(h.currentTarget.dataset.index)];C!==void 0&&n(C)},e[3]=n,e[4]=i,e[5]=f):f=e[5];const p=f;let v;e[6]!==t||e[7]!==i?(v=h=>{const C=i[Number(h.currentTarget.dataset.index)];C!==void 0&&t(C.name)},e[6]=t,e[7]=i,e[8]=v):v=e[8];const x=v;let w;e[9]!==a?(w=a("Copy link"),e[9]=a,e[10]=w):w=e[10];let y;e[11]!==o||e[12]!==w?(y=m("button",{className:st,"data-testid":"db-copy-link",onClick:o,type:"button",children:w}),e[11]=o,e[12]=w,e[13]=y):y=e[13];let S;e[14]!==b||e[15]!==d||e[16]!==a?(S=d?m(Co,{onCommit:b}):m("button",{className:st,"data-testid":"db-save-query",onClick:c,type:"button",children:a("Save query")}),e[14]=b,e[15]=d,e[16]=a,e[17]=S):S=e[17];let N;e[18]!==p||e[19]!==x||e[20]!==i||e[21]!==a?(N=i.length>0&&T("div",{className:"flex flex-wrap items-center gap-1","data-testid":"db-saved-queries",children:[m("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:a("Saved")}),i.map((h,C)=>T("span",{className:"inline-flex items-center overflow-hidden rounded-md border border-border",children:[m("button",{className:"px-2 py-0.5 text-xs text-foreground transition-colors hover:bg-accent","data-index":C,"data-testid":`db-saved-query-${h.name}`,onClick:p,type:"button",children:h.name}),m("button",{"aria-label":a("Delete saved query {name}",{name:h.name}),className:"border-l border-border px-1 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive","data-index":C,"data-testid":`db-saved-query-delete-${h.name}`,onClick:x,type:"button",children:"✕"})]},h.name))]}),e[18]=p,e[19]=x,e[20]=i,e[21]=a,e[22]=N):N=e[22];let $;return e[23]!==y||e[24]!==S||e[25]!==N?($=T("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"db-query-bar",children:[y,S,N]}),e[23]=y,e[24]=S,e[25]=N,e[26]=$):$=e[26],$},Ae="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 aria-pressed:bg-accent aria-pressed:text-accent-foreground disabled:pointer-events-none disabled:opacity-50",Ke="w-full rounded-md border border-border bg-background px-2 py-1 font-mono text-xs outline-none focus-visible:border-ring",$o=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,To=(r,e)=>typeof e=="boolean"?"boolean":typeof e=="number"?$o.test(r)?"date":"number":e!==null&&typeof e=="object"?"json":"text",Eo=r=>{try{const e=JSON.parse(r);return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}catch{return null}},Ro=r=>{const e=new Date(r),n=o=>String(o).padStart(2,"0");return`${e.getFullYear().toString()}-${n(e.getMonth()+1)}-${n(e.getDate())}T${n(e.getHours())}:${n(e.getMinutes())}`},_o=r=>{const e=j(8),{column:n,onChange:o,value:t}=r;let l;e[0]!==n||e[1]!==o?(l=g=>{o(n,g)},e[0]=n,e[1]=o,e[2]=l):l=e[2];const i=l,a=t===!0,d=`db-field-${n}`;let s;return e[3]!==n||e[4]!==i||e[5]!==a||e[6]!==d?(s=m(it,{"aria-label":n,checked:a,"data-testid":d,onCheckedChange:i}),e[3]=n,e[4]=i,e[5]=a,e[6]=d,e[7]=s):s=e[7],s},Mo=r=>{const e=j(8),{column:n,onChange:o,value:t}=r;let l;e[0]!==n||e[1]!==o?(l=g=>{const c=Number(g.target.value);g.target.value!==""&&!Number.isNaN(c)&&o(n,c)},e[0]=n,e[1]=o,e[2]=l):l=e[2];const i=l,a=`db-field-${n}`,d=typeof t=="number"?t:"";let s;return e[3]!==n||e[4]!==i||e[5]!==a||e[6]!==d?(s=m("input",{"aria-label":n,className:Ke,"data-testid":a,onChange:i,type:"number",value:d}),e[3]=n,e[4]=i,e[5]=a,e[6]=d,e[7]=s):s=e[7],s},Po=r=>{const e=j(10),{column:n,onChange:o,value:t}=r;let l;e[0]!==n||e[1]!==o?(l=g=>{const c=new Date(g.target.value).getTime();Number.isNaN(c)||o(n,c)},e[0]=n,e[1]=o,e[2]=l):l=e[2];const i=l,a=`db-field-${n}`;let d;e[3]!==t?(d=typeof t=="number"?Ro(t):"",e[3]=t,e[4]=d):d=e[4];let s;return e[5]!==n||e[6]!==i||e[7]!==a||e[8]!==d?(s=m("input",{"aria-label":n,className:Ke,"data-testid":a,onChange:i,type:"datetime-local",value:d}),e[5]=n,e[6]=i,e[7]=a,e[8]=d,e[9]=s):s=e[9],s},Do=r=>{const e=j(8),{column:n,onChange:o,value:t}=r;let l;e[0]!==n||e[1]!==o?(l=g=>{o(n,g.target.value)},e[0]=n,e[1]=o,e[2]=l):l=e[2];const i=l,a=`db-field-${n}`,d=typeof t=="string"?t:"";let s;return e[3]!==n||e[4]!==i||e[5]!==a||e[6]!==d?(s=m("input",{"aria-label":n,className:Ke,"data-testid":a,onChange:i,type:"text",value:d}),e[3]=n,e[4]=i,e[5]=a,e[6]=d,e[7]=s):s=e[7],s},Io=r=>{const e=j(20),{column:n,onChange:o,value:t}=r,l=me();let i;e[0]!==t?(i=()=>JSON.stringify(t,null,2),e[0]=t,e[1]=i):i=e[1];const[a,d]=P(i),[s,g]=P(!1);let c;e[2]!==n||e[3]!==o?(c=y=>{const S=y.target.value;d(S);try{o(n,JSON.parse(S)),g(!1)}catch{g(!0)}},e[2]=n,e[3]=o,e[4]=c):c=e[4];const u=c,b=s&&"border-destructive";let f;e[5]!==b?(f=Ve(Ke,"min-h-16",b),e[5]=b,e[6]=f):f=e[6];const p=`db-field-${n}`;let v;e[7]!==n||e[8]!==u||e[9]!==f||e[10]!==p||e[11]!==a?(v=m("textarea",{"aria-label":n,className:f,"data-testid":p,onChange:u,value:a}),e[7]=n,e[8]=u,e[9]=f,e[10]=p,e[11]=a,e[12]=v):v=e[12];let x;e[13]!==n||e[14]!==s||e[15]!==l?(x=s&&m("span",{className:"text-xs text-destructive","data-testid":`db-field-error-${n}`,children:l("Invalid JSON")}),e[13]=n,e[14]=s,e[15]=l,e[16]=x):x=e[16];let w;return e[17]!==v||e[18]!==x?(w=T("div",{className:"flex flex-col gap-1",children:[v,x]}),e[17]=v,e[18]=x,e[19]=w):w=e[19],w},Oo=r=>{const e=j(43),{column:n,onChange:o,target:t,value:l}=r;let i;e[0]!==n||e[1]!==l?(i=To(n,l),e[0]=n,e[1]=l,e[2]=i):i=e[2];const a=i,d=`db-field-${n}`;let s;e[3]!==n?(s=m("span",{className:"font-mono",children:n}),e[3]=n,e[4]=s):s=e[4];let g;e[5]!==t?(g=t!==void 0&&T("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide uppercase",children:["→ ",t]}),e[5]=t,e[6]=g):g=e[6];let c;e[7]!==s||e[8]!==g?(c=T("span",{className:"flex items-center gap-1.5 font-medium text-muted-foreground",children:[s,g]}),e[7]=s,e[8]=g,e[9]=c):c=e[9];let u;e[10]!==n||e[11]!==a||e[12]!==o||e[13]!==l?(u=a==="boolean"&&m(_o,{column:n,onChange:o,value:l}),e[10]=n,e[11]=a,e[12]=o,e[13]=l,e[14]=u):u=e[14];let b;e[15]!==n||e[16]!==a||e[17]!==o||e[18]!==l?(b=a==="number"&&m(Mo,{column:n,onChange:o,value:l}),e[15]=n,e[16]=a,e[17]=o,e[18]=l,e[19]=b):b=e[19];let f;e[20]!==n||e[21]!==a||e[22]!==o||e[23]!==l?(f=a==="date"&&m(Po,{column:n,onChange:o,value:l}),e[20]=n,e[21]=a,e[22]=o,e[23]=l,e[24]=f):f=e[24];let p;e[25]!==n||e[26]!==a||e[27]!==o||e[28]!==l?(p=a==="json"&&m(Io,{column:n,onChange:o,value:l}),e[25]=n,e[26]=a,e[27]=o,e[28]=l,e[29]=p):p=e[29];let v;e[30]!==n||e[31]!==a||e[32]!==o||e[33]!==l?(v=a==="text"&&m(Do,{column:n,onChange:o,value:l}),e[30]=n,e[31]=a,e[32]=o,e[33]=l,e[34]=v):v=e[34];let x;return e[35]!==v||e[36]!==d||e[37]!==c||e[38]!==u||e[39]!==b||e[40]!==f||e[41]!==p?(x=T("label",{className:"flex flex-col gap-1 text-xs",htmlFor:d,children:[c,u,b,f,p,v]}),e[35]=v,e[36]=d,e[37]=c,e[38]=u,e[39]=b,e[40]=f,e[41]=p,e[42]=x):x=e[42],x},Fo=r=>{const e=j(48),{documentText:n,onCancel:o,onDocumentTextChange:t,onSave:l,refs:i}=r,a=me();let d;e[0]!==n?(d=Eo(n),e[0]=n,e[1]=d):d=e[1];const s=d,[g,c]=P(!1),u=!g&&s!==null;let b;e[2]!==s||e[3]!==t?(b=(A,V)=>{t(JSON.stringify({...s,[A]:V},null,2))},e[2]=s,e[3]=t,e[4]=b):b=e[4];const f=b;let p;e[5]!==t?(p=A=>{t(A.target.value)},e[5]=t,e[6]=p):p=e[6];const v=p;let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{c(!1)},e[7]=x):x=e[7];const w=x;let y;e[8]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{c(!0)},e[8]=y):y=e[8];const S=y,N=s===null;let $;e[9]!==a?($=a("Form"),e[9]=a,e[10]=$):$=e[10];let h;e[11]!==u||e[12]!==N||e[13]!==$?(h=m("button",{"aria-pressed":u,className:Ae,"data-testid":"db-editor-form",disabled:N,onClick:w,type:"button",children:$}),e[11]=u,e[12]=N,e[13]=$,e[14]=h):h=e[14];const C=!u;let D;e[15]!==a?(D=a("JSON"),e[15]=a,e[16]=D):D=e[16];let E;e[17]!==D||e[18]!==C?(E=m("button",{"aria-pressed":C,className:Ae,"data-testid":"db-editor-json",onClick:S,type:"button",children:D}),e[17]=D,e[18]=C,e[19]=E):E=e[19];let R;e[20]!==E||e[21]!==h?(R=T("div",{className:"flex items-center gap-1.5",children:[h,E]}),e[20]=E,e[21]=h,e[22]=R):R=e[22];let _;e[23]!==n||e[24]!==s||e[25]!==f||e[26]!==v||e[27]!==i||e[28]!==u||e[29]!==a?(_=u?m("div",{className:"flex flex-col gap-3","data-testid":"db-editor-fields",children:Object.entries(s).map(A=>{const[V,H]=A;return m(Oo,{column:V,onChange:f,target:i?.[V],value:H},V)})}):m("textarea",{"aria-label":a("Row document JSON"),className:"min-h-28 w-full rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"db-editor-doc",onChange:v,value:n}),e[23]=n,e[24]=s,e[25]=f,e[26]=v,e[27]=i,e[28]=u,e[29]=a,e[30]=_):_=e[30];let k;e[31]!==a?(k=a("Save"),e[31]=a,e[32]=k):k=e[32];let F;e[33]!==l||e[34]!==k?(F=m("button",{className:Ae,"data-testid":"db-editor-save",onClick:l,type:"button",children:k}),e[33]=l,e[34]=k,e[35]=F):F=e[35];let B;e[36]!==a?(B=a("Cancel"),e[36]=a,e[37]=B):B=e[37];let O;e[38]!==o||e[39]!==B?(O=m("button",{className:Ae,"data-testid":"db-editor-cancel",onClick:o,type:"button",children:B}),e[38]=o,e[39]=B,e[40]=O):O=e[40];let I;e[41]!==F||e[42]!==O?(I=T("div",{className:"flex items-center gap-1.5",children:[F,O]}),e[41]=F,e[42]=O,e[43]=I):I=e[43];let G;return e[44]!==R||e[45]!==_||e[46]!==I?(G=T("div",{className:"flex flex-col gap-2 border border-border bg-card p-3","data-testid":"db-editor",children:[R,_,I]}),e[44]=R,e[45]=_,e[46]=I,e[47]=G):G=e[47],G},Fe="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 aria-pressed:bg-accent aria-pressed:text-accent-foreground",zo=r=>{const e=j(61),{columns:n,editable:o,filter:t,filters:l,hasMaskedColumns:i,liveError:a,maskOn:d,onAddRow:s,onBulkDelete:g,onAskAiFilter:c,onClearTable:u,onFilterChange:b,onFiltersChange:f,onGenerateRows:p,onShowJson:v,onShowTable:x,onToggleMask:w,total:y,viewMode:S}=r,N=me(),$=S==="table";let h;e[0]!==x||e[1]!==$?(h=m("button",{"aria-pressed":$,className:Fe,"data-testid":"db-view-table",onClick:x,type:"button",children:"Table"}),e[0]=x,e[1]=$,e[2]=h):h=e[2];const C=S==="json";let D;e[3]!==v||e[4]!==C?(D=m("button",{"aria-pressed":C,className:Fe,"data-testid":"db-view-json",onClick:v,type:"button",children:"JSON"}),e[3]=v,e[4]=C,e[5]=D):D=e[5];let E;e[6]!==a||e[7]!==N?(E=a===void 0?N("Live — changes stream in automatically"):N("Live unavailable: {liveError}",{liveError:a}),e[6]=a,e[7]=N,e[8]=E):E=e[8];const R=`size-1.5 rounded-full ${a===void 0?"bg-success":"bg-muted-foreground/50"}`;let _;e[9]!==R?(_=m("span",{"aria-hidden":"true",className:R}),e[9]=R,e[10]=_):_=e[10];let k;e[11]!==a||e[12]!==N?(k=N(a===void 0?"Live":"Live unavailable"),e[11]=a,e[12]=N,e[13]=k):k=e[13];let F;e[14]!==E||e[15]!==_||e[16]!==k?(F=T("span",{className:"inline-flex items-center gap-1.5 px-1 text-xs font-medium text-muted-foreground","data-testid":"db-live-indicator",role:"status",title:E,children:[_,k]}),e[14]=E,e[15]=_,e[16]=k,e[17]=F):F=e[17];let B;e[18]!==i||e[19]!==d||e[20]!==w||e[21]!==N?(B=i&&m("button",{"aria-pressed":d,className:Fe,"data-testid":"db-mask-toggle",onClick:w,type:"button",children:N("Mask sensitive columns")}),e[18]=i,e[19]=d,e[20]=w,e[21]=N,e[22]=B):B=e[22];let O;e[23]!==o||e[24]!==s?(O=o&&m("button",{className:Fe,"data-testid":"db-add-row",onClick:s,type:"button",children:"Add row"}),e[23]=o,e[24]=s,e[25]=O):O=e[25];let I;e[26]!==o||e[27]!==p||e[28]!==N?(I=o&&m("button",{className:Fe,"data-testid":"db-generate-rows",onClick:p,type:"button",children:N("Generate rows")}),e[26]=o,e[27]=p,e[28]=N,e[29]=I):I=e[29];let G;e[30]!==o||e[31]!==t||e[32]!==l||e[33]!==g||e[34]!==y?(G=o&&y>0&&(t!==""||l.length>0)&&m(lt,{confirmLabel:`Delete ${y.toString()} matching?`,onConfirm:g,testId:"db-bulk-delete",children:`Delete ${y.toString()} matching`}),e[30]=o,e[31]=t,e[32]=l,e[33]=g,e[34]=y,e[35]=G):G=e[35];let A;e[36]!==o||e[37]!==t||e[38]!==l||e[39]!==u||e[40]!==y?(A=o&&y>0&&t===""&&l.length===0&&m(lt,{confirmLabel:`Clear all ${y.toString()} rows?`,onConfirm:u,testId:"db-clear-table",children:`Clear table (${y.toString()})`}),e[36]=o,e[37]=t,e[38]=l,e[39]=u,e[40]=y,e[41]=A):A=e[41];let V;e[42]!==B||e[43]!==O||e[44]!==I||e[45]!==G||e[46]!==A||e[47]!==h||e[48]!==D||e[49]!==F?(V=T("div",{className:"flex flex-wrap items-center gap-1.5",children:[h,D,F,B,O,I,G,A]}),e[42]=B,e[43]=O,e[44]=I,e[45]=G,e[46]=A,e[47]=h,e[48]=D,e[49]=F,e[50]=V):V=e[50];let H;e[51]!==n||e[52]!==t||e[53]!==l||e[54]!==c||e[55]!==b||e[56]!==f?(H=m(Nn,{columns:n,filters:l,onAskAi:c,onFiltersChange:f,onSearchChange:b,search:t}),e[51]=n,e[52]=t,e[53]=l,e[54]=c,e[55]=b,e[56]=f,e[57]=H):H=e[57];let Z;return e[58]!==V||e[59]!==H?(Z=T("div",{className:"flex flex-col gap-2","data-testid":"db-view-toggle",children:[V,H]}),e[58]=V,e[59]=H,e[60]=Z):Z=e[60],Z},jo=r=>{const e=j(101),{assistant:n,backRelations:o,browser:t,edit:l,editable:i,onAskAiFilter:a,onInspect:d,onOpenGenerateRows:s,onSaveQuery:g,page:c,preferences:u,queryBar:b,references:f}=r,p=u.maskColumns.size>0,v=n.unavailable?void 0:a;let x;e[0]!==t.addRow||e[1]!==t.bulkDelete||e[2]!==t.clearTable||e[3]!==t.columns||e[4]!==t.filter||e[5]!==t.filters||e[6]!==t.liveError||e[7]!==t.onFilterChange||e[8]!==t.onFiltersChange||e[9]!==t.showJson||e[10]!==t.showTable||e[11]!==t.total||e[12]!==t.viewMode||e[13]!==i||e[14]!==s||e[15]!==u.maskOn||e[16]!==u.onToggleMask||e[17]!==p||e[18]!==v?(x=m(zo,{columns:t.columns,editable:i,filter:t.filter,filters:t.filters,hasMaskedColumns:p,liveError:t.liveError,maskOn:u.maskOn,onAddRow:t.addRow,onAskAiFilter:v,onBulkDelete:t.bulkDelete,onClearTable:t.clearTable,onFilterChange:t.onFilterChange,onFiltersChange:t.onFiltersChange,onGenerateRows:s,onShowJson:t.showJson,onShowTable:t.showTable,onToggleMask:u.onToggleMask,total:t.total,viewMode:t.viewMode}),e[0]=t.addRow,e[1]=t.bulkDelete,e[2]=t.clearTable,e[3]=t.columns,e[4]=t.filter,e[5]=t.filters,e[6]=t.liveError,e[7]=t.onFilterChange,e[8]=t.onFiltersChange,e[9]=t.showJson,e[10]=t.showTable,e[11]=t.total,e[12]=t.viewMode,e[13]=i,e[14]=s,e[15]=u.maskOn,e[16]=u.onToggleMask,e[17]=p,e[18]=v,e[19]=x):x=e[19];let w;e[20]!==g||e[21]!==b?(w=b!==void 0&&m(ko,{onApply:b.onApplyQuery,onCopyLink:b.onCopyLink,onDelete:b.onDeleteQuery,onSave:g,saved:b.saved}),e[20]=g,e[21]=b,e[22]=w):w=e[22];let y;e[23]!==o||e[24]!==t.onBulkDeleteSelected||e[25]!==t.selectedTable||e[26]!==t.table||e[27]!==t.viewMode||e[28]!==i||e[29]!==c||e[30]!==u.onToggleTranspose||e[31]!==u.transposed?(y=t.viewMode==="table"&&c.rows.length>0&&m(Cn,{backRelations:o.available,columns:c.columns,editable:i,enabledBackRelations:o.enabled,name:t.selectedTable??"export",onBulkDelete:t.onBulkDeleteSelected,onToggleBackRelation:o.onToggle,onToggleTranspose:u.onToggleTranspose,rows:c.rows,table:t.table.table,transposed:u.transposed}),e[23]=o,e[24]=t.onBulkDeleteSelected,e[25]=t.selectedTable,e[26]=t.table,e[27]=t.viewMode,e[28]=i,e[29]=c,e[30]=u.onToggleTranspose,e[31]=u.transposed,e[32]=y):y=e[32];let S;e[33]!==t.cancelEdit||e[34]!==t.editing||e[35]!==t.saveEdit||e[36]!==t.setEditorDocumentText||e[37]!==i||e[38]!==c?(S=i&&t.editing!==null&&m(Fo,{documentText:t.editing.docText,onCancel:t.cancelEdit,onDocumentTextChange:t.setEditorDocumentText,onSave:t.saveEdit,refs:c.refs}),e[33]=t.cancelEdit,e[34]=t.editing,e[35]=t.saveEdit,e[36]=t.setEditorDocumentText,e[37]=i,e[38]=c,e[39]=S):S=e[39];let N;e[40]!==t.committing||e[41]!==t.discardStaged||e[42]!==t.onCommitStaged||e[43]!==t.stagedChanges||e[44]!==i?(N=i&&t.stagedChanges.length>0&&m(Wn,{changes:t.stagedChanges,committing:t.committing,onCommit:t.onCommitStaged,onDiscard:t.discardStaged}),e[40]=t.committing,e[41]=t.discardStaged,e[42]=t.onCommitStaged,e[43]=t.stagedChanges,e[44]=i,e[45]=N):N=e[45];let $;e[46]!==t.writeError?($=t.writeError!==null&&m("p",{className:"text-sm text-destructive","data-testid":"db-write-error",role:"alert",children:t.writeError}),e[46]=t.writeError,e[47]=$):$=e[47];let h;e[48]!==x||e[49]!==w||e[50]!==y||e[51]!==S||e[52]!==N||e[53]!==$?(h=T("div",{className:"flex shrink-0 flex-col gap-2 border-b border-border px-4 py-3",children:[x,w,y,S,N,$]}),e[48]=x,e[49]=w,e[50]=y,e[51]=S,e[52]=N,e[53]=$,e[54]=h):h=e[54];let C;e[55]!==t.viewMode||e[56]!==c?(C=t.viewMode==="table"&&c.rows.length===0&&m("div",{className:"flex flex-1 items-center justify-center p-6",children:m(fn,{description:"Rows you insert into this table will show up here.",icon:m("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:m("path",{d:"M4 5h16v14H4V5Zm0 5h16M10 10v9M4 14.5h16"})}),testId:"db-empty-rows",title:"This table is empty."})}),e[55]=t.viewMode,e[56]=c,e[57]=C):C=e[57];let D;e[58]!==t.viewMode||e[59]!==c||e[60]!==u.maskView||e[61]!==u.transposed?(D=t.viewMode==="table"&&c.rows.length>0&&u.transposed&&m(Sn,{columns:c.columns,rows:xt(c.rows,u.maskView)}),e[58]=t.viewMode,e[59]=c,e[60]=u.maskView,e[61]=u.transposed,e[62]=D):D=e[62];let E;e[63]!==o||e[64]!==t.filter||e[65]!==t.onRowDelete||e[66]!==t.onRowEdit||e[67]!==t.table||e[68]!==t.viewMode||e[69]!==l||e[70]!==i||e[71]!==d||e[72]!==c||e[73]!==u.maskView||e[74]!==u.onTogglePin||e[75]!==u.pinnedColumns||e[76]!==u.transposed||e[77]!==f?(E=t.viewMode==="table"&&c.rows.length>0&&!u.transposed&&m(vo,{backRelationCounts:o.counts,edit:l,editable:i,highlight:t.filter,mask:u.maskView,onDelete:t.onRowDelete,onEdit:t.onRowEdit,onInspect:d,onTogglePin:u.onTogglePin,pinnedColumns:u.pinnedColumns,refs:f,tableModel:t.table}),e[63]=o,e[64]=t.filter,e[65]=t.onRowDelete,e[66]=t.onRowEdit,e[67]=t.table,e[68]=t.viewMode,e[69]=l,e[70]=i,e[71]=d,e[72]=c,e[73]=u.maskView,e[74]=u.onTogglePin,e[75]=u.pinnedColumns,e[76]=u.transposed,e[77]=f,e[78]=E):E=e[78];let R;e[79]!==t.viewMode||e[80]!==c||e[81]!==u.maskView?(R=t.viewMode==="json"&&m("pre",{className:"min-h-0 flex-1 overflow-auto border-t border-border bg-muted/30 p-3 text-xs","data-testid":"db-json",children:JSON.stringify(xt(c.rows,u.maskView),un,2)}),e[79]=t.viewMode,e[80]=c,e[81]=u.maskView,e[82]=R):R=e[82];let _;e[83]!==t.changePageSize||e[84]!==t.goNext||e[85]!==t.goPrevious||e[86]!==t.hasNext||e[87]!==t.hasPrevious||e[88]!==t.jumpToPage||e[89]!==t.pageSize||e[90]!==t.rangeEnd||e[91]!==t.rangeStart||e[92]!==t.total?(_=m("div",{className:"flex shrink-0 items-center border-t border-border px-4 py-2",children:m($n,{hasNext:t.hasNext,hasPrevious:t.hasPrevious,onJumpToPage:t.jumpToPage,onNext:t.goNext,onPageSizeChange:t.changePageSize,onPrevious:t.goPrevious,pageSize:t.pageSize,prefix:"db",rangeEnd:t.rangeEnd,rangeStart:t.rangeStart,total:t.total})}),e[83]=t.changePageSize,e[84]=t.goNext,e[85]=t.goPrevious,e[86]=t.hasNext,e[87]=t.hasPrevious,e[88]=t.jumpToPage,e[89]=t.pageSize,e[90]=t.rangeEnd,e[91]=t.rangeStart,e[92]=t.total,e[93]=_):_=e[93];let k;return e[94]!==C||e[95]!==D||e[96]!==E||e[97]!==R||e[98]!==_||e[99]!==h?(k=T("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"db-page",children:[h,C,D,E,R,_]}),e[94]=C,e[95]=D,e[96]=E,e[97]=R,e[98]=_,e[99]=h,e[100]=k):k=e[100],k},Ao="/__lunora/seed",tt=200,Lo=50,Bo=(r,e)=>{const n=[];for(const o of r)o.pk!==!0&&o.ref!==void 0&&o.type==="id"&&(e[o.ref]??[]).length===0&&n.push(o.name);return n},Vo=async r=>{const e=await fetch(Ao,{body:JSON.stringify(r),headers:{"Content-Type":"application/json"},method:"POST"}),n=await e.json();return e.ok&&n.rows!==void 0?{kind:"ok",rows:n.rows}:{kind:"error",message:n.error??`seed request failed (${String(e.status)})`}},qo="rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",Jo="rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50",Ko=({columns:r,fkPools:e,onClose:n,onInsertRows:o,table:t})=>{const l=me(),[i,a]=P(10),[d,s]=P(!1),[g,c]=P(void 0),[u,b]=P(void 0),[f,p]=P(0),v=S=>{const N=Number(S.target.value);!Number.isNaN(N)&&N>=1&&a(Math.min(N,tt))},x=async()=>{c(void 0),b(void 0),p(0),s(!0);try{const S=await Vo({count:i,existingIds:e,seed:Date.now(),table:t});if(S.kind==="error"){c(S.message);return}const{rows:N}=S;if(N.length===0){c(l("No rows generated — all columns were skipped."));return}const $=await o(N);if($.error!==void 0){c($.error);return}b($.inserted),p($.conflicts);const h=Bo(r,e);h.length>0&&c(l("Inserted {count} rows. Skipped FK columns: {cols}",{cols:h.join(", "),count:$.inserted.toString()}))}finally{s(!1)}},w=()=>{se(x())},y=r.filter(S=>S.pk!==!0);return T(Tt,{label:l("Generate dummy rows"),onClose:n,panelTestId:"gen-rows-panel",testId:"gen-rows-overlay",variant:"dialog",children:[T("div",{className:"flex items-start justify-between",children:[T("div",{className:"flex flex-col gap-0.5",children:[m("h3",{className:"text-base text-foreground","data-testid":"gen-rows-title",children:l("Generate dummy rows")}),m("p",{className:"text-xs text-muted-foreground","data-testid":"gen-rows-desc",children:l("Seed {table} with Faker-generated rows. Existing rows are not affected.",{table:t})})]}),m("button",{className:"text-xs text-muted-foreground hover:text-foreground","data-testid":"gen-rows-close",onClick:n,type:"button",children:l("Close")})]}),T("div",{className:"flex items-center gap-2",children:[m("label",{className:"text-xs font-medium text-foreground",htmlFor:"gen-rows-count",children:l("Row count")}),m("input",{className:"w-20 rounded-md border border-border bg-background px-2 py-1 text-xs outline-none focus-visible:border-ring","data-testid":"gen-rows-count",id:"gen-rows-count",max:tt,min:1,onChange:v,type:"number",value:i}),m("span",{className:"text-xs text-muted-foreground",children:l("(max {max})",{max:tt.toString()})})]}),y.length>0&&T("div",{className:"flex flex-col gap-1",children:[m("p",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:l("Columns to seed")}),m("ul",{className:"flex flex-col gap-0.5","data-testid":"gen-rows-columns",children:y.map(S=>{const N=S.ref!==void 0&&S.type==="id",$=N&&(e[S.ref??""]??[]).length===0,h=$?"rounded bg-destructive/10 px-1 text-destructive":"rounded bg-muted px-1 text-muted-foreground",C=$?`gen-rows-fk-empty-${S.name}`:`gen-rows-fk-ok-${S.name}`,D=$?l("FK: no rows in {ref} — will skip",{ref:S.ref??""}):l("→ {ref}",{ref:S.ref??""});return T("li",{className:"flex items-center gap-1.5 font-mono text-xs",children:[m("span",{className:"text-foreground",children:S.name}),T("span",{className:"text-muted-foreground",children:["(",S.type,")"]}),S.optional&&m("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide uppercase",children:"optional"}),N&&m("span",{className:h,"data-testid":C,children:D})]},S.name)})})]}),g!==void 0&&m("p",{className:"text-xs text-destructive","data-testid":"gen-rows-error",role:"alert",children:g}),u!==void 0&&g===void 0&&m("p",{className:"text-xs text-success","data-testid":"gen-rows-success",children:f>0?l("Inserted {inserted} of {total} rows — {conflicts} skipped as id conflicts.",{conflicts:f.toString(),inserted:u.toString(),total:(u+f).toString()}):l("Inserted {count} rows successfully.",{count:u.toString()})}),T("div",{className:"flex justify-end gap-2",children:[m("button",{className:qo,"data-testid":"gen-rows-cancel",onClick:n,type:"button",children:l("Cancel")}),m("button",{className:Jo,"data-testid":"gen-rows-generate",disabled:d,onClick:w,type:"button",children:l(d?"Inserting…":"Generate & insert")})]})]})},Go=ve(ee.backRelationCounts),Ho=(r,e,n,o)=>{const t=j(16),l=Je();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={},t[0]=i):i=t[0];const[a,d]=P(i);let s;if(t[1]!==r||t[2]!==e){let x;t[4]!==r?(x=w=>r.has(dt(w)),t[4]=r,t[5]=x):x=t[5],s=e.filter(x),t[1]=r,t[2]=e,t[3]=s}else s=t[3];const g=s;let c;t[6]!==n||t[7]!==g?(c=JSON.stringify([g,n]),t[6]=n,t[7]=g,t[8]=c):c=t[8];const u=c;let b;t[9]!==l||t[10]!==o||t[11]!==u?(b=async x=>{const[w,y]=JSON.parse(u);if(w.length===0||y.length===0){x.cancelled||d({});return}try{const S=await l.query(Go,{ids:y,relations:w},ue(o));x.cancelled||d(Object.fromEntries(S.relations.map(Qo)))}catch{}},t[9]=l,t[10]=o,t[11]=u,t[12]=b):b=t[12];const f=b;let p,v;return t[13]!==f?(p=()=>{const x={cancelled:!1};return se(f(x)),()=>{x.cancelled=!0}},v=[f],t[13]=f,t[14]=p,t[15]=v):(p=t[14],v=t[15]),Re(p,v),a};function Qo(r){return[dt(r),r.counts]}const Be=r=>{const e=r[0];return e===void 0?void 0:{column:e.id,direction:e.desc?"desc":"asc"}},Pt=r=>r==null?"":typeof r=="object"?JSON.stringify(r):String(r),Nt=r=>r.map(e=>({column:e.column,operator:e.operator,value:e.value===void 0?"":Pt(e.value)})),Ct=r=>r===void 0?[]:[{desc:r.direction==="desc",id:r.column}],Wo=r=>[r.column,r.operator,r.value],Le=(r,e,n,o)=>JSON.stringify([r??"",e??"",(n??[]).map(t=>Wo(t)),o===void 0?null:[o.column,o.direction]]),kt=200,Uo=20,Zo=ve(ee.readTablePage),Xo=ve(ee.facetColumn),nt=ve(ee.writeRow),Yo=ve(ee.deleteRows),er=ve(ee.clearTable),tr={},ut=new Set(["__doc__","__id__","_creationTime","_id","id"]),nr=r=>{const e=r.__doc__;if(typeof e=="string"){const o=Dn(e);if(o!==void 0)return o}const n={};for(const[o,t]of Object.entries(r))ut.has(o)||(n[o]=t);return n},or=({filters:r,offset:e,pageSize:n,search:o,sorting:t,table:l})=>({filters:Ee(r),limit:n,offset:e,orderBy:Be(t),search:o,skipCount:!0,table:l}),rr=({filters:r,search:e,table:n})=>({filters:Ee(r),limit:1,search:e,table:n}),lr=(r,e)=>{const n=new Map;for(const t of r?.rows??[]){const l=ye(t);l!==null&&n.set(l,t)}const o=[];for(const[t,l]of Object.entries(e))for(const[i,a]of Object.entries(l))o.push({column:i,newValue:a,oldValue:n.get(t)?.[i],rowId:t});return o},ar=r=>!ut.has(r),sr=({initialFilters:r,initialOrderBy:e,initialSearch:n,initialShardKey:o,onSelectTable:t,onViewChange:l,pageSize:i,resolveBackRelations:a,tableParam:d})=>{const s=Je(),[g,c]=P(i),[u,b]=P(o??""),f=d===void 0||d===""?null:d,[p,v]=P(0),[x,w]=P("table"),[y,S]=P(()=>Ct(e)),[N,$]=P(n??""),[h,C]=P(()=>Nt(r??[])),{clearFacets:D,facets:E,refetchFacets:R,toggleFacet:_}=Tn(),[k,F]=P(null),[B,O]=P(null),I=Hn(),[G,A]=P(null),[V,H]=P(!1),[Z,ge]=P(d),[oe,re]=P(()=>Le(o,n,r,e)),[fe,ie]=P(0),[de,ce]=P(()=>Le(o,n,r,e)),le=d!==Z,X=Le(o,n,r,e),be=le||!le&&X!==oe&&X!==de;if(be){ge(d),re(X),ie(z=>z+1),S(Ct(e)),$(n??"");const M=Nt(r??[]);C(M),b(o??""),D(),I.clear(),A(null),v(0)}else X!==oe&&re(X);const pe=be?n??"":N,W=be?o??"":u,te=`${d??""}:${fe.toString()}`,Q=bt(pe.trim(),300,te),L=bt(W.trim(),400,te),Y=Le(L,Q,Ee(h),Be(y));Y!==de&&ce(Y);const q=ze(ee.listTables,tr,{live:!0,shardKey:L}),Se=q.data??null,Ne=q.error,Ce=or({filters:h,offset:p,pageSize:g,search:Q,sorting:y,table:f??""}),ke=rr({filters:h,search:Q,table:f??""}),ae=ze(ee.readTablePage,Ce,{enabled:f!==null,keepPreviousData:!1,live:!0,shardKey:L}),J=ae.data??null,Pe=ae.error,{liveError:Te}=ae,De=ze(ee.readTablePage,ke,{enabled:f!==null,live:!0,shardKey:L});Re(()=>{q.data!==void 0&&In(L)},[q.data,L]);const Ge=M=>{t?.(M)},He=(M,z)=>{t?.(M,{search:z})},Qe=async(M,z)=>{try{return(await s.query(Zo,{filters:[],limit:Uo,offset:0,search:z,table:M},ue(L))).rows.find(ne=>ye(ne)===z)??null}catch{return null}},Ie=(M,z,ne,we)=>$e=>s.query(Xo,{column:$e,filters:Ee(ne),search:we,table:z},ue(M)),We=M=>{_(M,f===null?null:Ie(L,f,h,Q))},Ue=(M,z)=>{const ne=Pt(z);C(we=>[...we.filter($e=>$e.column!==M),{column:M,operator:"eq",value:ne}]),v(0)},Ze=et(Ie),Xe=et(R),K=et(l);Re(()=>{f!==null&&Xe.current(Ze.current(L,f,h,Q))},[L,f,h,Q]),Re(()=>{f===null||K.current===void 0||Z!==d||oe!==X||K.current({filters:Ee(h),orderBy:Be(y),search:Q,shard:L})},[f,d,Z,oe,X,h,y,Q,L]);const U=M=>{f!==null&&v(Math.max(0,M))},he=(M,z)=>{A({column:z,rowId:M})},xe=()=>{A(null)},Oe=async()=>{if(f!==null){O(null),H(!0);try{for(const[M,z]of Object.entries(I.staged))await s.query(nt,{doc:z,id:M,op:"patch",table:f},ue(L));I.clear(),A(null),ae.refetch()}catch(M){O(M.message)}H(!1)}},Dt=()=>{I.clear(),A(null)},It=lr(J,I.staged),mt=async(M,z,ne)=>{if(f===null)return;O(null);let we;if(M!=="delete"){let $e;try{$e=ne===void 0||ne.trim()===""?{}:JSON.parse(ne)}catch(_e){O(`Invalid JSON: ${_e.message}`);return}try{const _e=Mn($e);if(!Pn(_e)){O("The document must be a JSON object.");return}we=_e}catch(_e){O(`Invalid document: ${_e.message}`);return}}try{await s.query(nt,{doc:we,id:z??void 0,op:M,table:f},ue(L)),F(null),ae.refetch()}catch($e){O($e.message)}},gt=async(M,z)=>{if(f!==null){O(null);try{let ne="cap-hit";for(let we=0;we<kt;we+=1)if(!(await s.query(M,z,ue(L))).hasMore){ne="completed";break}v(0),ae.refetch(),ne==="cap-hit"&&O(`Stopped after ${kt.toString()} batches — rows still match this delete. Run it again to remove the rest.`)}catch(ne){O(ne.message)}}},Ot=M=>{S(M),v(0)},Ft=ot(()=>f===null?[]:a?.(f)??[],[a,f]),zt=wo(J,y,Ot,Ft),jt={filters:Ee(h),orderBy:Be(y),search:Q,shard:u,table:f??void 0},ft=De.data?.total??(J===null?0:p+J.rows.length),At=p>0,Lt=J!==null&&p+J.rows.length<ft,Bt=J===null||J.rows.length===0?0:p+1,Vt=J===null?0:p+J.rows.length,qt=()=>{q.refetch()},Jt=()=>{w("table")},Kt=()=>{w("json")},Gt=()=>{se(gt(Yo,{filters:Ee(h),search:Q,table:f}))},Ht=()=>{se(gt(er,{table:f}))},Qt=M=>{$(M.target.value),v(0)},Wt=M=>{C(M),v(0)},Ut=()=>{O(null);const M={};for(const z of J?.columns??[])ut.has(z)||(M[z]="");F({docText:JSON.stringify(M,null,2),id:""})},Zt=M=>{F(z=>z===null?z:{docText:M,id:z.id})},Xt=()=>{k!==null&&se(mt(k.id===""?"insert":"patch",k.id===""?null:k.id,k.docText))},Yt=()=>{F(null),O(null)},en=()=>{U(p-g)},tn=()=>{U(p+g)},nn=M=>{U(Math.max(0,(M-1)*g))},on=M=>{c(M),v(0)},rn=(M,z)=>{O(null),F({docText:JSON.stringify(_n(nr(z)),null,2),id:M})},ln=M=>{se(mt("delete",M))},an=async M=>{if(!(f===null||M.length===0)){O(null);try{for(const z of M)await s.query(nt,{id:z,op:"delete",table:f},ue(L));ae.refetch()}catch(z){O(z.message)}}},sn=M=>{se(an(M))},dn=()=>{se(Oe())};return{addRow:Ut,bulkDelete:Gt,cancelCellEdit:xe,cancelEdit:Yt,changePageSize:on,clearTable:Ht,columns:J?.columns??[],committing:V,currentView:jt,discardStaged:Dt,editableColumn:ar,editing:k,editingCell:G,facetFilter:Ue,facets:E,filter:N,filters:h,goNext:tn,goPrevious:en,hasNext:Lt,hasPrevious:At,jumpToPage:nn,liveError:Te,loadTables:qt,navigateToRef:He,onBulkDeleteSelected:sn,onCommitStaged:dn,onFilterChange:Qt,onFiltersChange:Wt,onRowDelete:ln,onRowEdit:rn,page:J,previewRef:Qe,pageError:Pe,pageSize:g,rangeEnd:Vt,rangeStart:Bt,queryShardKey:L,saveEdit:Xt,selectedTable:f,selectTable:Ge,setEditorDocumentText:Zt,setShardKey:b,shardKey:u,showJson:Kt,showTable:Jt,stage:I.stage,stagedChanges:It,stagedValue:I.stagedValue,startCellEdit:he,table:zt,tables:Se,tablesError:Ne,toggleFacet:We,total:ft,viewMode:x,writeError:B}},ir=[],dr=()=>{const r=j(1);let e;r[0]===Symbol.for("react.memo_cache_sentinel")?(e={},r[0]=e):e=r[0];const{data:n}=ze(ee.maskPolicies,e);return Array.isArray(n?.columns)?n.columns:ir},cr="lunora-studio-pinned-columns",ur=r=>{const e=j(24),{columns:n,initialPins:o,selectedTable:t}=r;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={},e[0]=l):l=e[0];const[i,a]=$t(cr,l),d=t??"",s=i[d];let g;e[1]!==o||e[2]!==s?(g=s===void 0?new Set((o??"").split(",").filter(mr)):new Set(s),e[1]=o,e[2]=s,e[3]=g):g=e[3];const c=g;let u;e[4]!==d||e[5]!==c||e[6]!==a?(u=_=>{a(k=>{const F=k[d]??[...c],B=F.includes(_)?F.filter(O=>O!==_):[...F,_];return{...k,[d]:B}})},e[4]=d,e[5]=c,e[6]=a,e[7]=u):u=e[7];const b=u,[f,p]=P(!1);let v;e[8]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{p(gr)},e[8]=v):v=e[8];const x=v,w=dr(),[y,S]=P(!0);let N;e[9]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{S(fr)},e[9]=N):N=e[9];const $=N;let h;if(e[10]!==n||e[11]!==w||e[12]!==t){const _=Bn(w,t??"");h=qn(_,n),e[10]=n,e[11]=w,e[12]=t,e[13]=h}else h=e[13];const C=h;let D;e[14]!==C||e[15]!==y?(D={columns:C,enabled:y},e[14]=C,e[15]=y,e[16]=D):D=e[16];const E=D;let R;return e[17]!==C||e[18]!==y||e[19]!==E||e[20]!==b||e[21]!==c||e[22]!==f?(R={maskColumns:C,maskOn:y,maskView:E,onToggleMask:$,onTogglePin:b,onToggleTranspose:x,pinnedColumns:c,transposed:f},e[17]=C,e[18]=y,e[19]=E,e[20]=b,e[21]=c,e[22]=f,e[23]=R):R=e[23],R};function mr(r){return r!==""}function gr(r){return!r}function fr(r){return!r}const br=ve(ee.describeTable),pr=ve(ee.readTablePage),hr=ve(ee.importShard),xr=r=>{const e=r._id??r.id??r.__id__??"";return typeof e=="string"?e:typeof e=="number"?String(e):""},vr=r=>{const e=Object.values(r.inserted).reduce((d,s)=>d+s,0),[n]=r.errors;if(n===void 0)return{conflicts:r.conflicts,error:void 0,inserted:e};const o=r.errors.length-1,t=e+r.conflicts+r.errors.length,l=o===1?"error":"errors",i=o>0?` (+${o.toString()} more ${l})`:"",a=`Inserted ${e.toString()} of ${t.toString()} rows — row ${n.line.toString()} (${n.table}): ${n.message}${i}`;return{conflicts:r.conflicts,error:a,inserted:e}},wr=r=>{const e=Je(),[n,o]=P(!1),[t,l]=P(void 0),[i,a]=P(void 0),[d,s]=P(void 0),[g,c]=P({}),[u,b]=P(!1),[f,p]=P(void 0),v=async(x,w)=>{o(!0),l(x),a(w),s(void 0),c({}),p(void 0),b(!0);try{const y=await e.query(br,{table:x},ue(w)),{columns:S}=y;s(S);const N={},$=S.filter(h=>h.ref!==void 0&&h.type==="id"&&h.pk!==!0);for(const h of $){if(h.ref===void 0)continue;const{ref:C}=h;if(N[C]===void 0)try{const D=await e.query(pr,{filters:[],limit:Lo,offset:0,search:"",table:C},ue(w));N[C]=D.rows.flatMap(E=>xr(E)||[])}catch{N[C]=[]}}c(N)}catch(y){p(y.message)}b(!1)};return{closeDialog:()=>{o(!1),l(void 0),a(void 0),s(void 0),c({}),p(void 0)},columnMeta:d,error:f,fkPools:g,insertBatch:async(x,w)=>{if(t===void 0||i===void 0)return{conflicts:0,error:"No table selected.",inserted:0};try{const y=await e.query(hr,{rows:x.map(N=>({doc:N,table:t}))},ue(i)),S=vr(y);return S.error!==void 0||(w(),r()),S}catch(y){return{conflicts:0,error:y.message,inserted:0}}},loading:u,open:n,openDialog:(x,w)=>{se(v(x,w))},shardKey:i,table:t}},yr=()=>{const r=j(6),[e,n]=P(null);let o;r[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{n(null)},r[0]=o):o=r[0];const t=o,[l,i]=P(null);let a;r[1]===Symbol.for("react.memo_cache_sentinel")?(a=(u,b)=>{i({column:u,value:b})},r[1]=a):a=r[1];const d=a;let s;r[2]===Symbol.for("react.memo_cache_sentinel")?(s=()=>{i(null)},r[2]=s):s=r[2];const g=s;let c;return r[3]!==l||r[4]!==e?(c={closeExpandedCell:g,closeInspect:t,expandedCell:l,inspecting:e,onExpandCell:d,onInspect:n},r[3]=l,r[4]=e,r[5]=c):c=r[5],c},Sr=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,Nr=(r,e)=>typeof e=="number"&&Sr.test(r),Cr=r=>{const e=j(26),{column:n,onNavigate:o,target:t,value:l}=r;let i;e[0]!==o||e[1]!==t||e[2]!==l?(i=()=>{t!==void 0&&o(t,String(l))},e[0]=o,e[1]=t,e[2]=l,e[3]=i):i=e[3];const a=i;if(l==null){let g;return e[4]===Symbol.for("react.memo_cache_sentinel")?(g=m("span",{className:"italic text-muted-foreground",children:"null"}),e[4]=g):g=e[4],g}if(t!==void 0&&(typeof l=="string"||typeof l=="number")&&String(l)!==""){const g=`rd-ref-${n}`,c=`Open ${t} ${String(l)}`,u=String(l);let b;return e[5]!==a||e[6]!==g||e[7]!==c||e[8]!==u?(b=T("button",{"data-testid":g,onClick:a,title:c,type:"button",children:[u," ↗"]}),e[5]=a,e[6]=g,e[7]=c,e[8]=u,e[9]=b):b=e[9],b}if(Nr(n,l)){const g=`rd-ts-${n}`;let c;e[10]!==l?(c=l.toString(),e[10]=l,e[11]=c):c=e[11];let u;e[12]!==l?(u=mn(l),e[12]=l,e[13]=u):u=e[13];let b;return e[14]!==g||e[15]!==c||e[16]!==u?(b=m("span",{"data-testid":g,title:c,children:u}),e[14]=g,e[15]=c,e[16]=u,e[17]=b):b=e[17],b}if(typeof l=="object"){let g;e[18]!==l?(g=JSON.stringify(l,null,2),e[18]=l,e[19]=g):g=e[19];let c;return e[20]!==g?(c=m("pre",{className:"m-0 overflow-auto rounded-md bg-muted/50 p-2 text-xs",children:g}),e[20]=g,e[21]=c):c=e[21],c}let d;e[22]!==l?(d=Me(l),e[22]=l,e[23]=d):d=e[23];let s;return e[24]!==d?(s=m("span",{children:d}),e[24]=d,e[25]=s):s=e[25],s},kr=r=>{const e=j(21),{columns:n,onClose:o,onNavigate:t,refs:l,row:i}=r;let a;e[0]!==o||e[1]!==t?(a=(f,p)=>{t(f,p),o()},e[0]=o,e[1]=t,e[2]=a):a=e[2];const d=a;let s;e[3]===Symbol.for("react.memo_cache_sentinel")?(s=m("h3",{className:"m-0 text-base text-foreground",children:"Row detail"}),e[3]=s):s=e[3];let g;e[4]!==o?(g=T("div",{className:"mb-3 flex items-center justify-between",children:[s,m("button",{"data-testid":"rd-close",onClick:o,type:"button",children:"Close"})]}),e[4]=o,e[5]=g):g=e[5];let c;if(e[6]!==n||e[7]!==d||e[8]!==l||e[9]!==i){let f;e[11]!==d||e[12]!==l||e[13]!==i?(f=p=>T("div",{className:"border-t border-border py-2 first:border-t-0","data-testid":`rd-field-${p}`,children:[m("dt",{className:"mb-0.5 text-xs font-semibold text-muted-foreground",children:p}),m("dd",{className:"m-0",children:m(Cr,{column:p,onNavigate:d,target:l?.[p],value:i[p]})})]},p),e[11]=d,e[12]=l,e[13]=i,e[14]=f):f=e[14],c=n.map(f),e[6]=n,e[7]=d,e[8]=l,e[9]=i,e[10]=c}else c=e[10];let u;e[15]!==c?(u=m("dl",{"data-testid":"rd-fields",children:c}),e[15]=c,e[16]=u):u=e[16];let b;return e[17]!==o||e[18]!==g||e[19]!==u?(b=T(Tt,{label:"Row detail",onClose:o,panelTestId:"rd-panel",testId:"rd-overlay",variant:"drawer",children:[g,u]}),e[17]=o,e[18]=g,e[19]=u,e[20]=b):b=e[20],b},$r=50,Tr=r=>{const e=j(8),{active:n,onPick:o,shard:t}=r;let l;e[0]!==o||e[1]!==t?(l=()=>{o(t)},e[0]=o,e[1]=t,e[2]=l):l=e[2];const i=l,a=`w-full rounded px-2 py-0.5 text-left text-xs transition-colors hover:bg-accent ${n?"bg-accent font-medium":""}`,d=`shard-explorer-item-${t}`;let s;return e[3]!==i||e[4]!==t||e[5]!==a||e[6]!==d?(s=m("button",{className:a,"data-testid":d,onClick:i,type:"button",children:t}),e[3]=i,e[4]=t,e[5]=a,e[6]=d,e[7]=s):s=e[7],s},Er=({onFetchTables:r,onSelect:e})=>{const n=me(),[o]=P(()=>On()),[t,l]=P(!1),[i,a]=P(void 0),[d,s]=P(void 0),[g,c]=P(!1),[u,b]=P(void 0),f=je(0),p=()=>{l(w=>!w)},v=async w=>{e(w),a(w),s(void 0),b(void 0),c(!0),f.current+=1;const y=f.current;try{const S=await r(w);f.current===y&&s(S?.slice(0,$r))}catch(S){f.current===y&&b(S.message)}f.current===y&&c(!1)},x=w=>{se(v(w))};return o.length===0?null:T("div",{"data-testid":"shard-explorer",children:[T("button",{"aria-controls":"shard-explorer-panel","aria-expanded":t,className:"inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"shard-explorer-toggle",onClick:p,type:"button",children:[n("Shards seen"),m("span",{"aria-hidden":"true",className:`ml-0.5 transition-transform ${t?"rotate-180":""}`,children:"▾"})]}),t&&T("div",{className:"mt-1 flex flex-col gap-1 rounded-md border border-border bg-popover p-2","data-testid":"shard-explorer-panel",id:"shard-explorer-panel",children:[m("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-hint",children:n("Recently visited shards — click to switch")}),m("ul",{className:"flex flex-col gap-0.5","data-testid":"shard-explorer-list",children:o.map(w=>m("li",{children:m(Tr,{active:i===w,onPick:x,shard:w})},w))}),i!==void 0&&T("div",{className:"mt-1 border-t border-border pt-1","data-testid":"shard-explorer-summary",children:[m("p",{className:"mb-1 text-xs font-medium text-foreground","data-testid":"shard-explorer-summary-title",children:n("{shard} tables",{shard:i})}),g&&m("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-loading",children:n("Loading…")}),u!==void 0&&m("p",{className:"text-xs text-destructive","data-testid":"shard-explorer-error",role:"alert",children:u}),!g&&u===void 0&&d?.length===0&&m("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-empty",children:n("No tables in this shard.")}),!g&&u===void 0&&d!==void 0&&d.length>0&&m("ul",{className:"flex flex-col gap-0.5","data-testid":"shard-explorer-tables",children:d.map(w=>T("li",{className:"flex items-center justify-between text-xs",children:[m("span",{"data-testid":`shard-explorer-table-${w.name}`,children:w.name}),m("span",{className:"text-muted-foreground","data-testid":`shard-explorer-rowcount-${w.name}`,children:w.rowCount})]},w.name))})]})]})]})},Rr="lunora-studio-back-relations",_r={},Mr=50,Pr=[],Dr=ve(ee.listTables),Ir=r=>{const e=j(10),{onFetchShardTables:n,onShardChange:o,schemaSwitch:t,shardKey:l}=r;let i;e[0]!==o||e[1]!==l?(i=m(cn,{onChange:o,testId:"db-shard-input",value:l}),e[0]=o,e[1]=l,e[2]=i):i=e[2];let a;e[3]!==n||e[4]!==o?(a=m(Er,{onFetchTables:n,onSelect:o}),e[3]=n,e[4]=o,e[5]=a):a=e[5];let d;return e[6]!==t||e[7]!==i||e[8]!==a?(d=T("div",{className:"flex shrink-0 flex-col items-stretch gap-2 border-b border-border p-3",children:[t,i,a]}),e[6]=t,e[7]=i,e[8]=a,e[9]=d):d=e[9],d},sl=({editable:r=!1,globalTableNames:e,initialFilters:n,initialOrderBy:o,initialPins:t,initialSearch:l,initialShardKey:i,onNavigateToGlobal:a,onSelectTable:d,onViewChange:s,pageSize:g=Mr,queryBar:c,schemaSwitch:u,tableParam:b})=>{const f=ze(ee.describeTables,{},{shardKey:i??""}).data?.columnsByTable??_r,[p,v]=$t(Rr,{}),x=rt(K=>{const U=new Set(p[K]);return pt(K,f).filter(he=>U.has(dt(he)))},[p,f]),w=sr({initialFilters:n,initialOrderBy:o,initialSearch:l,initialShardKey:i,onSelectTable:d,onViewChange:s,pageSize:g,resolveBackRelations:x,tableParam:b}),{cancelCellEdit:y,columns:S,currentView:N,editableColumn:$,editingCell:h,facetFilter:C,facets:D,loadTables:E,navigateToRef:R,onFiltersChange:_,page:k,pageError:F,previewRef:B,queryShardKey:O,selectedTable:I,selectTable:G,setShardKey:A,shardKey:V,stage:H,stagedValue:Z,startCellEdit:ge,tables:oe,tablesError:re,toggleFacet:fe}=w,ie=gn(V),de=K=>{se((async()=>{const U=await ie.suggestFilter(K,I??"");U!==void 0&&_(U.map(he=>{const xe=he.value,Oe=typeof xe=="string"||typeof xe=="number"||typeof xe=="boolean"?String(xe):"";return{column:he.column,operator:he.operator,value:Oe}}))})())},ce=I===null?[]:pt(I,f),le=new Set(p[I??""]),X=[];for(const K of k?.rows??[]){const U=K._id??K.id;typeof U=="string"&&U!==""&&X.push(U)}const be=Ho(le,ce,X,O),pe=K=>{v(U=>{const he=I??"",xe=U[he]??[];return{...U,[he]:xe.includes(K)?xe.filter(Oe=>Oe!==K):[...xe,K]}})},W=ur({columns:S,initialPins:t,selectedTable:I}),te=yr(),{closeExpandedCell:Q,closeInspect:L,expandedCell:Y,inspecting:q,onExpandCell:Se}=te,Ne=Je(),Ce=async K=>await Ne.query(Dr,{},ue(K)),ke=()=>{I!==null&&G(I)},{closeDialog:ae,columnMeta:J,fkPools:Pe,insertBatch:Te,open:De,openDialog:Ge}=wr(ke),He=()=>{I!==null&&Ge(I,V)},Qe=K=>Te(K,ae),Ie=(K,U)=>{if(a!==void 0&&e?.has(K)===!0){a(K,U);return}R(K,U)},We=c?.onSaveQuery,Ue=K=>{We?.(K,N)},Ze={cancelEdit:y,editable:r,editableColumn:$,editingCell:h,onExpandCell:Se,stage:H,stagedValue:Z,startEdit:ge},Xe={columns:k?.refs,onNavigate:Ie,onPreview:B};return T("div",{className:"flex h-full min-w-0","data-testid":"lunora-data-browser",children:[m(En,{header:m(Ir,{onFetchShardTables:Ce,onShardChange:A,schemaSwitch:u,shardKey:V}),onReload:E,onSelect:G,prefix:"db",selected:I,tables:oe??Pr}),T("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[re!==null&&m("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"db-tables-error",role:"alert",children:re}),k===null&&F===null&&m("div",{className:"flex flex-1 items-center justify-center p-6",children:m("p",{className:"text-sm text-muted-foreground",children:"Select a table to browse its rows."})}),F!==null&&m("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"db-page-error",role:"alert",children:F}),k!==null&&m(jo,{assistant:ie,backRelations:{available:ce,counts:be,enabled:le,onToggle:pe},browser:w,edit:Ze,editable:r,onAskAiFilter:de,onInspect:te.onInspect,onOpenGenerateRows:He,onSaveQuery:Ue,page:k,preferences:W,queryBar:c,references:Xe})]}),k!==null&&m(Rn,{columns:S,facets:D,onFacetFilter:C,onToggleFacet:fe}),q!==null&&k!==null&&m(kr,{columns:k.columns,onClose:L,onNavigate:Ie,refs:k.refs,row:q}),Y!==null&&m(kn,{column:Y.column,onClose:Q,value:Y.value}),De&&I!==null&&J!==void 0&&m(Ko,{columns:J,fkPools:Pe,onClose:ae,onInsertRows:Qe,table:I})]})};export{sl as DataBrowser};
@@ -1 +1 @@
1
- import{useLunora as oe}from"@lunora/react";import{useState as L,useRef as G,useEffect as B}from"react";import{O as I}from"./use-admin-query-QJ-ibl5u.js";import{useAutoRefresh as ne}from"./DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js";import{_ as ae,i as se,u as ie,a as ce,$ as de}from"./table-list-sidebar-D9Bd4qgi.js";import{useT as J}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{b as ue}from"./cf-links-Dmg86v1D.js";import{c as A}from"react/compiler-runtime";import{d as me,m as U,f as fe,n as pe,p as ge,u as he}from"./table-DdJBrClo.js";import{k as be,g as xe}from"./data-grid-DcxyIXwG.js";import{jsx as r,jsxs as $}from"react/jsx-runtime";import{E as ve}from"./empty-state-Cg7t_8qu.js";const Ne=(t,e)=>{const a=t._id;return typeof a=="string"||typeof a=="number"?String(a):`row-${e.toString()}`},q=t=>t==null?"∅":t===""?"(empty)":typeof t=="object"?JSON.stringify(t):String(t),we=t=>{const e=A(33),{filters:a,onChangePageSize:f,onJumpToPage:i,onNext:u,onPrevious:s,onRemoveFilter:F,page:o,pageSize:b,pagination:x}=t,C=J(),{hasNext:v,hasPrevious:k,rangeEnd:p,rangeStart:R,total:_}=x;let N;e[0]!==a||e[1]!==F||e[2]!==C?(N=a.length>0&&r("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border px-4 py-2 text-xs","data-testid":"gdb-filters",children:a.map((d,y)=>$("span",{className:"inline-flex items-center gap-1 rounded border border-border bg-muted px-1.5 py-0.5","data-testid":"gdb-filter-chip",children:[r("span",{className:"font-medium text-foreground",children:d.column}),r("span",{className:"text-muted-foreground",children:"="}),r("span",{className:"font-mono text-foreground",children:q(d.value)}),r("button",{"aria-label":C("Remove filter"),className:"ml-0.5 text-muted-foreground hover:text-foreground","data-testid":"gdb-filter-remove",onClick:()=>{F(y)},type:"button",children:"✕"})]},`${d.column}:${q(d.value)}`))}),e[0]=a,e[1]=F,e[2]=C,e[3]=N):N=e[3];let w;e[4]!==o.columns?(w=o.columns.map(Se),e[4]=o.columns,e[5]=w):w=e[5];let m;e[6]!==w?(m=r(me,{children:r(U,{children:w})}),e[6]=w,e[7]=m):m=e[7];let c;if(e[8]!==o.columns||e[9]!==o.rows){let d;e[11]!==o.columns?(d=(y,E)=>r(U,{"data-testid":"gdb-row",children:o.columns.map(P=>r(he,{className:"max-w-xs truncate font-mono text-xs",children:r(xe,{value:y[P]})},P))},Ne(y,E)),e[11]=o.columns,e[12]=d):d=e[12],c=o.rows.map(d),e[8]=o.columns,e[9]=o.rows,e[10]=c}else c=e[10];let h;e[13]!==c?(h=r(fe,{children:c}),e[13]=c,e[14]=h):h=e[14];let g;e[15]!==m||e[16]!==h?(g=r(be,{layout:"fill",children:r("div",{className:"min-h-0 flex-1 overflow-auto",children:$(pe,{"data-testid":"gdb-rows",children:[m,h]})})}),e[15]=m,e[16]=h,e[17]=g):g=e[17];let n;e[18]!==v||e[19]!==k||e[20]!==f||e[21]!==i||e[22]!==u||e[23]!==s||e[24]!==b||e[25]!==p||e[26]!==R||e[27]!==_?(n=r("div",{className:"flex shrink-0 items-center border-t border-border px-4 py-2",children:r(ae,{hasNext:v,hasPrevious:k,onJumpToPage:i,onNext:u,onPageSizeChange:f,onPrevious:s,pageSize:b,prefix:"gdb",rangeEnd:p,rangeStart:R,total:_})}),e[18]=v,e[19]=k,e[20]=f,e[21]=i,e[22]=u,e[23]=s,e[24]=b,e[25]=p,e[26]=R,e[27]=_,e[28]=n):n=e[28];let S;return e[29]!==N||e[30]!==g||e[31]!==n?(S=$("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"gdb-page",children:[N,g,n]}),e[29]=N,e[30]=g,e[31]=n,e[32]=S):S=e[32],S};function Se(t){return r(ge,{children:t},t)}const ye=()=>{const t=A(8),e=J();let a;t[0]!==e?(a=e("Tables marked .global() (D1-backed, region-replicated) will appear here."),t[0]=e,t[1]=a):a=t[1];let f;t[2]===Symbol.for("react.memo_cache_sentinel")?(f=$("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M3 12h18M12 3a14 14 0 0 1 0 18 14 14 0 0 1 0-18Z"})]}),t[2]=f):f=t[2];let i;t[3]!==e?(i=e("No global tables."),t[3]=e,t[4]=i):i=t[4];let u;return t[5]!==a||t[6]!==i?(u=r("div",{className:"flex flex-1 items-center justify-center p-6",children:r(ve,{description:a,icon:f,testId:"gdb-empty",title:i})}),t[5]=a,t[6]=i,t[7]=u):u=t[7],u},$e=50,ke=[],Pe=[],De=({initialTable:t,onSelectTable:e,pageSize:a=$e,schemaSwitch:f}={})=>{const i=oe(),u=J(),[s,F]=L(t??null),[o,b]=L(0),[x,C]=L(a),[v,k]=L([]),p=se(v),{clearFacets:R,facets:_,refetchFacets:N,toggleFacet:w}=ie(),m=I(["lunora-global-tables"],()=>i.listGlobalTables()),c=m.data??null,h=m.error,g=I(["lunora-global-page",s??"",o,x,JSON.stringify(v)],()=>i.readGlobalTablePage({filters:v,limit:x,offset:o,table:s??""}),{enabled:s!==null,keepPreviousData:!1}),n=g.data??null,S=g.error,d=(l,T)=>z=>i.facetGlobalColumn({column:z,filters:T,table:l}),y=(l,T)=>{N(d(l,T))};ne(()=>{m.refetch(),s!==null&&(g.refetch(),y(s,p.current))},!0);const E=G(void 0),P=l=>{F(l),E.current=l,k([]),p.current=[],R(),b(0),e?.(l)},W=l=>{w(l,s===null?null:d(s,p.current))},M=l=>{k(l),p.current=l,b(0),s!==null&&y(s,l)},Z=(l,T)=>{M([...p.current.filter(z=>z.column!==l),{column:l,value:T}])},H=l=>{M(p.current.filter((T,z)=>z!==l))},O=G(P);B(()=>{O.current=P}),B(()=>{if(t===void 0||t===""||E.current===t)return;E.current=t;const l=t;queueMicrotask(()=>{O.current(l)})},[t]);const j=l=>{s!==null&&b(Math.max(0,l))},D=n?.total??0,K=o>0,Q=n!==null&&o+n.rows.length<D,V=n===null||n.rows.length===0?0:o+1,X=n===null?0:o+n.rows.length,Y=()=>{m.refetch()},ee=()=>{j(o-x)},te=()=>{j(o+x)},re=l=>{j(Math.max(0,(l-1)*x))},le=l=>{C(l),b(0)};return $("div",{className:"flex h-full min-w-0","data-testid":"lunora-global-data-browser",children:[r(ce,{header:$("div",{className:"flex shrink-0 flex-col items-stretch gap-2 border-b border-border p-3",children:[f,r("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"gdb-cf-link",href:ue,rel:"noreferrer",target:"_blank",children:u("Open in Cloudflare")})]}),onReload:Y,onSelect:P,prefix:"gdb",selected:s,tables:c??ke}),$("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[h!==null&&r("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"gdb-tables-error",role:"alert",children:h}),c!==null&&c.length===0&&r(ye,{}),S!==null&&r("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"gdb-page-error",role:"alert",children:S}),c!==null&&c.length>0&&n===null&&S===null&&r("div",{className:"flex flex-1 items-center justify-center p-6",children:r("p",{className:"text-sm text-muted-foreground",children:u("Select a table to browse its rows.")})}),n!==null&&r(we,{filters:v,onChangePageSize:le,onJumpToPage:re,onNext:te,onPrevious:ee,onRemoveFilter:H,page:n,pageSize:x,pagination:{hasNext:Q,hasPrevious:K,rangeEnd:X,rangeStart:V,total:D}})]}),r(de,{columns:n?.columns??Pe,facets:_,onFacetFilter:Z,onToggleFacet:W})]})};export{De as GlobalDataBrowser};
1
+ import{useLunora as oe}from"@lunora/react";import{useState as L,useRef as G,useEffect as B}from"react";import{O as I}from"./use-admin-query-CnnyWJXM.js";import{useAutoRefresh as ne}from"./DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js";import{_ as ae,i as se,u as ie,a as ce,$ as de}from"./table-list-sidebar-fz0m_4I4.js";import{useT as J}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{b as ue}from"./cf-links-Dmg86v1D.js";import{c as A}from"react/compiler-runtime";import{d as me,m as U,f as fe,n as pe,p as ge,u as he}from"./table-DdJBrClo.js";import{k as be,g as xe}from"./data-grid-Ci4-tZkk.js";import{jsx as r,jsxs as $}from"react/jsx-runtime";import{E as ve}from"./empty-state-Cg7t_8qu.js";const Ne=(t,e)=>{const a=t._id;return typeof a=="string"||typeof a=="number"?String(a):`row-${e.toString()}`},q=t=>t==null?"∅":t===""?"(empty)":typeof t=="object"?JSON.stringify(t):String(t),we=t=>{const e=A(33),{filters:a,onChangePageSize:f,onJumpToPage:i,onNext:u,onPrevious:s,onRemoveFilter:F,page:o,pageSize:b,pagination:x}=t,C=J(),{hasNext:v,hasPrevious:k,rangeEnd:p,rangeStart:R,total:_}=x;let N;e[0]!==a||e[1]!==F||e[2]!==C?(N=a.length>0&&r("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border px-4 py-2 text-xs","data-testid":"gdb-filters",children:a.map((d,y)=>$("span",{className:"inline-flex items-center gap-1 rounded border border-border bg-muted px-1.5 py-0.5","data-testid":"gdb-filter-chip",children:[r("span",{className:"font-medium text-foreground",children:d.column}),r("span",{className:"text-muted-foreground",children:"="}),r("span",{className:"font-mono text-foreground",children:q(d.value)}),r("button",{"aria-label":C("Remove filter"),className:"ml-0.5 text-muted-foreground hover:text-foreground","data-testid":"gdb-filter-remove",onClick:()=>{F(y)},type:"button",children:"✕"})]},`${d.column}:${q(d.value)}`))}),e[0]=a,e[1]=F,e[2]=C,e[3]=N):N=e[3];let w;e[4]!==o.columns?(w=o.columns.map(Se),e[4]=o.columns,e[5]=w):w=e[5];let m;e[6]!==w?(m=r(me,{children:r(U,{children:w})}),e[6]=w,e[7]=m):m=e[7];let c;if(e[8]!==o.columns||e[9]!==o.rows){let d;e[11]!==o.columns?(d=(y,E)=>r(U,{"data-testid":"gdb-row",children:o.columns.map(P=>r(he,{className:"max-w-xs truncate font-mono text-xs",children:r(xe,{value:y[P]})},P))},Ne(y,E)),e[11]=o.columns,e[12]=d):d=e[12],c=o.rows.map(d),e[8]=o.columns,e[9]=o.rows,e[10]=c}else c=e[10];let h;e[13]!==c?(h=r(fe,{children:c}),e[13]=c,e[14]=h):h=e[14];let g;e[15]!==m||e[16]!==h?(g=r(be,{layout:"fill",children:r("div",{className:"min-h-0 flex-1 overflow-auto",children:$(pe,{"data-testid":"gdb-rows",children:[m,h]})})}),e[15]=m,e[16]=h,e[17]=g):g=e[17];let n;e[18]!==v||e[19]!==k||e[20]!==f||e[21]!==i||e[22]!==u||e[23]!==s||e[24]!==b||e[25]!==p||e[26]!==R||e[27]!==_?(n=r("div",{className:"flex shrink-0 items-center border-t border-border px-4 py-2",children:r(ae,{hasNext:v,hasPrevious:k,onJumpToPage:i,onNext:u,onPageSizeChange:f,onPrevious:s,pageSize:b,prefix:"gdb",rangeEnd:p,rangeStart:R,total:_})}),e[18]=v,e[19]=k,e[20]=f,e[21]=i,e[22]=u,e[23]=s,e[24]=b,e[25]=p,e[26]=R,e[27]=_,e[28]=n):n=e[28];let S;return e[29]!==N||e[30]!==g||e[31]!==n?(S=$("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"gdb-page",children:[N,g,n]}),e[29]=N,e[30]=g,e[31]=n,e[32]=S):S=e[32],S};function Se(t){return r(ge,{children:t},t)}const ye=()=>{const t=A(8),e=J();let a;t[0]!==e?(a=e("Tables marked .global() (D1-backed, region-replicated) will appear here."),t[0]=e,t[1]=a):a=t[1];let f;t[2]===Symbol.for("react.memo_cache_sentinel")?(f=$("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M3 12h18M12 3a14 14 0 0 1 0 18 14 14 0 0 1 0-18Z"})]}),t[2]=f):f=t[2];let i;t[3]!==e?(i=e("No global tables."),t[3]=e,t[4]=i):i=t[4];let u;return t[5]!==a||t[6]!==i?(u=r("div",{className:"flex flex-1 items-center justify-center p-6",children:r(ve,{description:a,icon:f,testId:"gdb-empty",title:i})}),t[5]=a,t[6]=i,t[7]=u):u=t[7],u},$e=50,ke=[],Pe=[],De=({initialTable:t,onSelectTable:e,pageSize:a=$e,schemaSwitch:f}={})=>{const i=oe(),u=J(),[s,F]=L(t??null),[o,b]=L(0),[x,C]=L(a),[v,k]=L([]),p=se(v),{clearFacets:R,facets:_,refetchFacets:N,toggleFacet:w}=ie(),m=I(["lunora-global-tables"],()=>i.listGlobalTables()),c=m.data??null,h=m.error,g=I(["lunora-global-page",s??"",o,x,JSON.stringify(v)],()=>i.readGlobalTablePage({filters:v,limit:x,offset:o,table:s??""}),{enabled:s!==null,keepPreviousData:!1}),n=g.data??null,S=g.error,d=(l,T)=>z=>i.facetGlobalColumn({column:z,filters:T,table:l}),y=(l,T)=>{N(d(l,T))};ne(()=>{m.refetch(),s!==null&&(g.refetch(),y(s,p.current))},!0);const E=G(void 0),P=l=>{F(l),E.current=l,k([]),p.current=[],R(),b(0),e?.(l)},W=l=>{w(l,s===null?null:d(s,p.current))},M=l=>{k(l),p.current=l,b(0),s!==null&&y(s,l)},Z=(l,T)=>{M([...p.current.filter(z=>z.column!==l),{column:l,value:T}])},H=l=>{M(p.current.filter((T,z)=>z!==l))},O=G(P);B(()=>{O.current=P}),B(()=>{if(t===void 0||t===""||E.current===t)return;E.current=t;const l=t;queueMicrotask(()=>{O.current(l)})},[t]);const j=l=>{s!==null&&b(Math.max(0,l))},D=n?.total??0,K=o>0,Q=n!==null&&o+n.rows.length<D,V=n===null||n.rows.length===0?0:o+1,X=n===null?0:o+n.rows.length,Y=()=>{m.refetch()},ee=()=>{j(o-x)},te=()=>{j(o+x)},re=l=>{j(Math.max(0,(l-1)*x))},le=l=>{C(l),b(0)};return $("div",{className:"flex h-full min-w-0","data-testid":"lunora-global-data-browser",children:[r(ce,{header:$("div",{className:"flex shrink-0 flex-col items-stretch gap-2 border-b border-border p-3",children:[f,r("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"gdb-cf-link",href:ue,rel:"noreferrer",target:"_blank",children:u("Open in Cloudflare")})]}),onReload:Y,onSelect:P,prefix:"gdb",selected:s,tables:c??ke}),$("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[h!==null&&r("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"gdb-tables-error",role:"alert",children:h}),c!==null&&c.length===0&&r(ye,{}),S!==null&&r("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"gdb-page-error",role:"alert",children:S}),c!==null&&c.length>0&&n===null&&S===null&&r("div",{className:"flex flex-1 items-center justify-center p-6",children:r("p",{className:"text-sm text-muted-foreground",children:u("Select a table to browse its rows.")})}),n!==null&&r(we,{filters:v,onChangePageSize:le,onJumpToPage:re,onNext:te,onPrevious:ee,onRemoveFilter:H,page:n,pageSize:x,pagination:{hasNext:Q,hasPrevious:K,rangeEnd:X,rangeStart:V,total:D}})]}),r(de,{columns:n?.columns??Pe,facets:_,onFacetFilter:Z,onToggleFacet:W})]})};export{De as GlobalDataBrowser};
@@ -0,0 +1 @@
1
+ import"react/compiler-runtime";import"@tanstack/react-router";import"react";import"./badge-BbuuAio7.js";import"./card-CIDGUN6K.js";import"./empty-state-Cg7t_8qu.js";import"./use-admin-query-CnnyWJXM.js";import"./DEFAULT_LOCALE-BZ4NojpD.js";import"./ADMIN_FUNCTIONS-4aE59aDq.js";import"./internal-zkEvTqy8.js";import"./utils-bhneXptQ.js";import"./DEFAULT_INSIGHT_THRESHOLDS-B-hcFVoi.js";import{H as b}from"./home-panel-BtxdqXDe.js";import"react/jsx-runtime";export{b as HomePanel};
@@ -1 +1 @@
1
- import{c as we}from"react/compiler-runtime";import{useLunora as $e}from"@lunora/react";import{useState as W,useEffect as ke}from"react";import{ConfirmButton as Re}from"./ConfirmButton-CTL3f3kr.js";import{E as Ce}from"./error-alert-t6cpEi0z.js";import{L as _e}from"./live-status-CmuRLFKf.js";import{ShardInput as Ee}from"./ShardInput-BVn2iCU0.js";import{g as Le}from"./badge-BbuuAio7.js";import{u as Me}from"./button-BkCrNcAs.js";import{c as Ie,u as De}from"./card-CIDGUN6K.js";import{E as Ke}from"./empty-state-Cg7t_8qu.js";import{u as Ae}from"./input-JHu63lTv.js";import{p as ue}from"./label-6uP1obNF.js";import{n as je,d as Fe,m as he,p as u,f as Te,u as h}from"./table-DdJBrClo.js";import{N as qe}from"./use-admin-query-QJ-ibl5u.js";import{S as Be}from"./use-shard-key-B2JtNa5m.js";import{useT as Oe}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as pe}from"./ADMIN_FUNCTIONS-4aE59aDq.js";import{i as We,f as ze,d as Je,b as Pe,g as Ue}from"./internal-BSIsQVC6.js";import{r as Ge}from"./shard-history-DMEW5VBE.js";import{jsx as t,jsxs as i}from"react/jsx-runtime";const Qe=Ue(pe.runMigration),yr=n=>{const e=we(98),{initialShardKey:ge}=n,te=$e(),r=Oe(),{queryShardKey:s,setShardKey:ne,shardKey:o}=Be(ge),[p,fe]=W(""),[g,ye]=W("up"),[l,be]=W(!0),[f,ce]=W(!1),[c,ae]=W(null),[z,ie]=W(null);let J;e[0]!==o?(J=o.trim(),e[0]=o,e[1]=J):J=e[1];const P=J===s;let U;e[2]===Symbol.for("react.memo_cache_sentinel")?(U={},e[2]=U):U=e[2];let G;e[3]!==s?(G={live:!0,shardKey:s},e[3]=s,e[4]=G):G=e[4];const a=qe(pe.migrationStatus,U,G),d=a.data?.migrations??null,oe=a.error,{errorSource:le,liveError:de}=a;let Q,V;e[5]!==s||e[6]!==a.data?(Q=()=>{a.data!==void 0&&Ge(s)},V=[a.data,s],e[5]=s,e[6]=a.data,e[7]=Q,e[8]=V):(Q=e[7],V=e[8]),ke(Q,V);let X;if(e[9]!==te||e[10]!==g||e[11]!==l||e[12]!==p||e[13]!==o||e[14]!==a||e[15]!==r){const m=async()=>{const me=p.trim();if(me===""){ie(r("Enter a migration id")),ae(null);return}ce(!0),ie(null);try{const se=await te.query(Qe,{direction:g,dryRun:l,id:me},Je(o));ae(se),a.refetch()}catch(se){const Se=se;ae(null),ie(Pe(Se))}ce(!1)};X=()=>{ze(m())},e[9]=te,e[10]=g,e[11]=l,e[12]=p,e[13]=o,e[14]=a,e[15]=r,e[16]=X}else X=e[16];const Y=X;let Z;e[17]===Symbol.for("react.memo_cache_sentinel")?(Z=m=>{fe(m.target.value)},e[17]=Z):Z=e[17];const ve=Z;let H;e[18]===Symbol.for("react.memo_cache_sentinel")?(H=m=>{ye(m.target.value==="down"?"down":"up")},e[18]=H):H=e[18];const xe=H;let ee;e[19]===Symbol.for("react.memo_cache_sentinel")?(ee=m=>{be(m.target.checked)},e[19]=ee):ee=e[19];const Ne=ee;let y;e[20]!==ne||e[21]!==o?(y=t(Ee,{onChange:ne,testId:"mg-shard-input",value:o}),e[20]=ne,e[21]=o,e[22]=y):y=e[22];let b;e[23]!==de?(b=t(_e,{message:de,prefix:"mg"}),e[23]=de,e[24]=b):b=e[24];let v;e[25]!==y||e[26]!==b?(v=i("div",{className:"flex flex-wrap items-center gap-2",children:[y,b]}),e[25]=y,e[26]=b,e[27]=v):v=e[27];let x;e[28]!==oe||e[29]!==le?(x=oe!==null&&t(Ce,{error:le,testId:"mg-status-error"}),e[28]=oe,e[29]=le,e[30]=x):x=e[30];let N;e[31]!==d||e[32]!==r?(N=d!==null&&d.length===0&&t(Ke,{description:r("Data migrations you run against this shard will be tracked here."),icon:t("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:t("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:r("No migrations have run on this shard.")}),e[31]=d,e[32]=r,e[33]=N):N=e[33];let S;e[34]!==d||e[35]!==r?(S=d!==null&&d.length>0&&t(Ie,{className:"overflow-hidden py-0",children:t(De,{className:"px-0",children:i(je,{"data-testid":"mg-table",children:[t(Fe,{children:i(he,{children:[t(u,{children:r("id")}),t(u,{children:r("direction")}),t(u,{children:r("status")}),t(u,{children:r("processed")}),t(u,{children:r("changed")}),t(u,{children:r("updated")}),t(u,{children:r("error")})]})}),t(Te,{children:d.map(Ve)})]})})}),e[34]=d,e[35]=r,e[36]=S):S=e[36];let w;e[37]!==r?(w=r("Run migration"),e[37]=r,e[38]=w):w=e[38];let $;e[39]!==w?($=t(ue,{children:w}),e[39]=w,e[40]=$):$=e[40];let k;e[41]!==r?(k=r("Migration id"),e[41]=r,e[42]=k):k=e[42];let R;e[43]!==r?(R=r("migration id"),e[43]=r,e[44]=R):R=e[44];let C;e[45]!==p||e[46]!==k||e[47]!==R?(C=t(Ae,{"aria-label":k,className:"w-auto","data-testid":"mg-id-input",onChange:ve,placeholder:R,value:p}),e[45]=p,e[46]=k,e[47]=R,e[48]=C):C=e[48];let _;e[49]!==r?(_=r("Direction"),e[49]=r,e[50]=_):_=e[50];let E;e[51]!==r?(E=r("up"),e[51]=r,e[52]=E):E=e[52];let L;e[53]!==E?(L=t("option",{value:"up",children:E}),e[53]=E,e[54]=L):L=e[54];let M;e[55]!==r?(M=r("down"),e[55]=r,e[56]=M):M=e[56];let I;e[57]!==M?(I=t("option",{value:"down",children:M}),e[57]=M,e[58]=I):I=e[58];let D;e[59]!==g||e[60]!==_||e[61]!==L||e[62]!==I?(D=i("select",{"aria-label":_,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:xe,value:g,children:[L,I]}),e[59]=g,e[60]=_,e[61]=L,e[62]=I,e[63]=D):D=e[63];let K;e[64]!==l?(K=t("input",{checked:l,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:Ne,type:"checkbox"}),e[64]=l,e[65]=K):K=e[65];let A;e[66]!==r?(A=r("Dry run"),e[66]=r,e[67]=A):A=e[67];let j;e[68]!==K||e[69]!==A?(j=i(ue,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[K,A]}),e[68]=K,e[69]=A,e[70]=j):j=e[70];let F;e[71]!==l||e[72]!==Y||e[73]!==f||e[74]!==P||e[75]!==r?(F=l?t(Me,{"data-testid":"mg-run",disabled:f||!P,onClick:Y,type:"button",children:r(f?"Running…":"Run")}):t(Re,{confirmLabel:r(f?"Running…":"Run migration?"),disabled:f||!P,onConfirm:Y,testId:"mg-run",children:r("Run")}),e[71]=l,e[72]=Y,e[73]=f,e[74]=P,e[75]=r,e[76]=F):F=e[76];let T;e[77]!==C||e[78]!==D||e[79]!==j||e[80]!==F?(T=i("div",{className:"flex flex-wrap items-center gap-2",children:[C,D,j,F]}),e[77]=C,e[78]=D,e[79]=j,e[80]=F,e[81]=T):T=e[81];let q;e[82]!==$||e[83]!==T?(q=i("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[$,T]}),e[82]=$,e[83]=T,e[84]=q):q=e[84];let B;e[85]!==z?(B=z!==null&&t("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:z}),e[85]=z,e[86]=B):B=e[86];let O;e[87]!==c||e[88]!==r?(O=c!==null&&i("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[c.dryRun?r("Dry run: "):"",r("{status} — processed",{status:c.status}),c.processed,r(", changed"),c.changed]}),e[87]=c,e[88]=r,e[89]=O):O=e[89];let re;return e[90]!==v||e[91]!==x||e[92]!==N||e[93]!==S||e[94]!==q||e[95]!==B||e[96]!==O?(re=i("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[v,x,N,S,q,B,O]}),e[90]=v,e[91]=x,e[92]=N,e[93]=S,e[94]=q,e[95]=B,e[96]=O,e[97]=re):re=e[97],re};function Ve(n){return i(he,{"data-testid":`mg-row-${n.id}`,children:[t(h,{children:n.id}),t(h,{children:n.direction}),t(h,{children:t(Le,{variant:"secondary",children:n.status})}),t(h,{children:n.processed}),t(h,{children:n.changed}),t(h,{children:We(n.updatedAt)}),t(h,{children:n.error??""})]},n.id)}export{yr as MigrationsPanel};
1
+ import{c as we}from"react/compiler-runtime";import{useLunora as $e}from"@lunora/react";import{useState as W,useEffect as ke}from"react";import{ConfirmButton as Re}from"./ConfirmButton-CTL3f3kr.js";import{E as Ce}from"./error-alert--Ie7ofJ0.js";import{L as _e}from"./live-status-CmuRLFKf.js";import{ShardInput as Ee}from"./ShardInput-BVn2iCU0.js";import{g as Le}from"./badge-BbuuAio7.js";import{u as Me}from"./button-BkCrNcAs.js";import{c as Ie,u as De}from"./card-CIDGUN6K.js";import{E as Ke}from"./empty-state-Cg7t_8qu.js";import{u as Ae}from"./input-JHu63lTv.js";import{p as ue}from"./label-6uP1obNF.js";import{n as je,d as Fe,m as he,p as u,f as Te,u as h}from"./table-DdJBrClo.js";import{N as qe}from"./use-admin-query-CnnyWJXM.js";import{S as Be}from"./use-shard-key-B2JtNa5m.js";import{useT as Oe}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as pe}from"./ADMIN_FUNCTIONS-4aE59aDq.js";import{i as We,f as ze,d as Je,b as Pe,g as Ue}from"./internal-zkEvTqy8.js";import{r as Ge}from"./shard-history-DMEW5VBE.js";import{jsx as t,jsxs as i}from"react/jsx-runtime";const Qe=Ue(pe.runMigration),yr=n=>{const e=we(98),{initialShardKey:ge}=n,te=$e(),r=Oe(),{queryShardKey:s,setShardKey:ne,shardKey:o}=Be(ge),[p,fe]=W(""),[g,ye]=W("up"),[l,be]=W(!0),[f,ce]=W(!1),[c,ae]=W(null),[z,ie]=W(null);let J;e[0]!==o?(J=o.trim(),e[0]=o,e[1]=J):J=e[1];const P=J===s;let U;e[2]===Symbol.for("react.memo_cache_sentinel")?(U={},e[2]=U):U=e[2];let G;e[3]!==s?(G={live:!0,shardKey:s},e[3]=s,e[4]=G):G=e[4];const a=qe(pe.migrationStatus,U,G),d=a.data?.migrations??null,oe=a.error,{errorSource:le,liveError:de}=a;let Q,V;e[5]!==s||e[6]!==a.data?(Q=()=>{a.data!==void 0&&Ge(s)},V=[a.data,s],e[5]=s,e[6]=a.data,e[7]=Q,e[8]=V):(Q=e[7],V=e[8]),ke(Q,V);let X;if(e[9]!==te||e[10]!==g||e[11]!==l||e[12]!==p||e[13]!==o||e[14]!==a||e[15]!==r){const m=async()=>{const me=p.trim();if(me===""){ie(r("Enter a migration id")),ae(null);return}ce(!0),ie(null);try{const se=await te.query(Qe,{direction:g,dryRun:l,id:me},Je(o));ae(se),a.refetch()}catch(se){const Se=se;ae(null),ie(Pe(Se))}ce(!1)};X=()=>{ze(m())},e[9]=te,e[10]=g,e[11]=l,e[12]=p,e[13]=o,e[14]=a,e[15]=r,e[16]=X}else X=e[16];const Y=X;let Z;e[17]===Symbol.for("react.memo_cache_sentinel")?(Z=m=>{fe(m.target.value)},e[17]=Z):Z=e[17];const ve=Z;let H;e[18]===Symbol.for("react.memo_cache_sentinel")?(H=m=>{ye(m.target.value==="down"?"down":"up")},e[18]=H):H=e[18];const xe=H;let ee;e[19]===Symbol.for("react.memo_cache_sentinel")?(ee=m=>{be(m.target.checked)},e[19]=ee):ee=e[19];const Ne=ee;let y;e[20]!==ne||e[21]!==o?(y=t(Ee,{onChange:ne,testId:"mg-shard-input",value:o}),e[20]=ne,e[21]=o,e[22]=y):y=e[22];let b;e[23]!==de?(b=t(_e,{message:de,prefix:"mg"}),e[23]=de,e[24]=b):b=e[24];let v;e[25]!==y||e[26]!==b?(v=i("div",{className:"flex flex-wrap items-center gap-2",children:[y,b]}),e[25]=y,e[26]=b,e[27]=v):v=e[27];let x;e[28]!==oe||e[29]!==le?(x=oe!==null&&t(Ce,{error:le,testId:"mg-status-error"}),e[28]=oe,e[29]=le,e[30]=x):x=e[30];let N;e[31]!==d||e[32]!==r?(N=d!==null&&d.length===0&&t(Ke,{description:r("Data migrations you run against this shard will be tracked here."),icon:t("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:t("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:r("No migrations have run on this shard.")}),e[31]=d,e[32]=r,e[33]=N):N=e[33];let S;e[34]!==d||e[35]!==r?(S=d!==null&&d.length>0&&t(Ie,{className:"overflow-hidden py-0",children:t(De,{className:"px-0",children:i(je,{"data-testid":"mg-table",children:[t(Fe,{children:i(he,{children:[t(u,{children:r("id")}),t(u,{children:r("direction")}),t(u,{children:r("status")}),t(u,{children:r("processed")}),t(u,{children:r("changed")}),t(u,{children:r("updated")}),t(u,{children:r("error")})]})}),t(Te,{children:d.map(Ve)})]})})}),e[34]=d,e[35]=r,e[36]=S):S=e[36];let w;e[37]!==r?(w=r("Run migration"),e[37]=r,e[38]=w):w=e[38];let $;e[39]!==w?($=t(ue,{children:w}),e[39]=w,e[40]=$):$=e[40];let k;e[41]!==r?(k=r("Migration id"),e[41]=r,e[42]=k):k=e[42];let R;e[43]!==r?(R=r("migration id"),e[43]=r,e[44]=R):R=e[44];let C;e[45]!==p||e[46]!==k||e[47]!==R?(C=t(Ae,{"aria-label":k,className:"w-auto","data-testid":"mg-id-input",onChange:ve,placeholder:R,value:p}),e[45]=p,e[46]=k,e[47]=R,e[48]=C):C=e[48];let _;e[49]!==r?(_=r("Direction"),e[49]=r,e[50]=_):_=e[50];let E;e[51]!==r?(E=r("up"),e[51]=r,e[52]=E):E=e[52];let L;e[53]!==E?(L=t("option",{value:"up",children:E}),e[53]=E,e[54]=L):L=e[54];let M;e[55]!==r?(M=r("down"),e[55]=r,e[56]=M):M=e[56];let I;e[57]!==M?(I=t("option",{value:"down",children:M}),e[57]=M,e[58]=I):I=e[58];let D;e[59]!==g||e[60]!==_||e[61]!==L||e[62]!==I?(D=i("select",{"aria-label":_,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:xe,value:g,children:[L,I]}),e[59]=g,e[60]=_,e[61]=L,e[62]=I,e[63]=D):D=e[63];let K;e[64]!==l?(K=t("input",{checked:l,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:Ne,type:"checkbox"}),e[64]=l,e[65]=K):K=e[65];let A;e[66]!==r?(A=r("Dry run"),e[66]=r,e[67]=A):A=e[67];let j;e[68]!==K||e[69]!==A?(j=i(ue,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[K,A]}),e[68]=K,e[69]=A,e[70]=j):j=e[70];let F;e[71]!==l||e[72]!==Y||e[73]!==f||e[74]!==P||e[75]!==r?(F=l?t(Me,{"data-testid":"mg-run",disabled:f||!P,onClick:Y,type:"button",children:r(f?"Running…":"Run")}):t(Re,{confirmLabel:r(f?"Running…":"Run migration?"),disabled:f||!P,onConfirm:Y,testId:"mg-run",children:r("Run")}),e[71]=l,e[72]=Y,e[73]=f,e[74]=P,e[75]=r,e[76]=F):F=e[76];let T;e[77]!==C||e[78]!==D||e[79]!==j||e[80]!==F?(T=i("div",{className:"flex flex-wrap items-center gap-2",children:[C,D,j,F]}),e[77]=C,e[78]=D,e[79]=j,e[80]=F,e[81]=T):T=e[81];let q;e[82]!==$||e[83]!==T?(q=i("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[$,T]}),e[82]=$,e[83]=T,e[84]=q):q=e[84];let B;e[85]!==z?(B=z!==null&&t("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:z}),e[85]=z,e[86]=B):B=e[86];let O;e[87]!==c||e[88]!==r?(O=c!==null&&i("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[c.dryRun?r("Dry run: "):"",r("{status} — processed",{status:c.status}),c.processed,r(", changed"),c.changed]}),e[87]=c,e[88]=r,e[89]=O):O=e[89];let re;return e[90]!==v||e[91]!==x||e[92]!==N||e[93]!==S||e[94]!==q||e[95]!==B||e[96]!==O?(re=i("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[v,x,N,S,q,B,O]}),e[90]=v,e[91]=x,e[92]=N,e[93]=S,e[94]=q,e[95]=B,e[96]=O,e[97]=re):re=e[97],re};function Ve(n){return i(he,{"data-testid":`mg-row-${n.id}`,children:[t(h,{children:n.id}),t(h,{children:n.direction}),t(h,{children:t(Le,{variant:"secondary",children:n.status})}),t(h,{children:n.processed}),t(h,{children:n.changed}),t(h,{children:We(n.updatedAt)}),t(h,{children:n.error??""})]},n.id)}export{yr as MigrationsPanel};
@@ -1 +1 @@
1
- import{c as g}from"react/compiler-runtime";import{useLunora as y}from"@lunora/react";import{E as f}from"./empty-state-Cg7t_8qu.js";import{n as h}from"./skeleton-C1wQ9M5t.js";import{u as k,U as x}from"./reference-view-DnYYWr7I.js";import{useT as P}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{jsxs as S,jsx as p}from"react/jsx-runtime";const v=t=>(t.params??[]).find(e=>e.name==="args")??(t.params??[])[0],w=t=>t["x-tags"]?.[0]?.name??(t.name.includes(":")?t.name.slice(0,t.name.indexOf(":")):""),I=t=>{const e=v(t)?.schema;return{argsSchema:e,description:t.description,functionPath:t.name,httpPath:"/_lunora/rpc",key:t.name,kind:t["x-lunora-function-kind"],method:"POST",operationId:t.name,requestSchema:e,responses:[{description:t.result?.name,schema:t.result?.schema,status:"200"}],summary:t.summary??t.name,tags:[w(t)],title:t.summary??t.name}},C=t=>{const e=t??{},d=(e.methods??[]).map(a=>I(a)),o=new Map;for(const a of d){const m=a.tags[0]??"",r=o.get(m)??[];r.push(a),o.set(m,r)}return{groups:[...o.entries()].map(([a,m])=>({name:a,operations:m.toSorted((r,c)=>r.operationId.localeCompare(c.operationId))})).toSorted((a,m)=>a.name.localeCompare(m.name)),operationByKey:new Map(d.map(a=>[a.key,a])),title:e.info?.title??"API reference",version:e.info?.version}},O=t=>t.methods===void 0||t.methods.length===0,R=t=>{const e=t;return O(e)?{kind:"empty"}:{kind:"ready",spec:e}},T=t=>{const e=g(23),{spec:d}=t,o=P(),a=y();let m;e[0]!==a?(m=()=>a.fetchOpenRpc(),e[0]=a,e[1]=m):m=e[1];const r=k(d,m,R);let c;e[2]!==r.kind||e[3]!==r.spec?(c=r.kind==="ready"?C(r.spec):void 0,e[2]=r.kind,e[3]=r.spec,e[4]=c):c=e[4];const l=c;if(r.kind==="loading"){let n;return e[5]===Symbol.for("react.memo_cache_sentinel")?(n=S("div",{className:"flex flex-col gap-4","data-testid":"openrpc-reference-loading",children:[p(h,{className:"h-8 w-48"}),p(h,{className:"h-64 w-full"})]}),e[5]=n):n=e[5],n}if(r.kind==="error"){let n;e[6]!==r.message||e[7]!==o?(n=o("Couldn't load the OpenRPC spec: {message}",{message:r.message}),e[6]=r.message,e[7]=o,e[8]=n):n=e[8];let s;e[9]!==o?(s=o("API reference unavailable"),e[9]=o,e[10]=s):s=e[10];let i;return e[11]!==n||e[12]!==s?(i=p(f,{description:n,testId:"openrpc-reference-error",title:s}),e[11]=n,e[12]=s,e[13]=i):i=e[13],i}if(r.kind==="empty"||l===void 0){let n;e[14]!==o?(n=o("Run `lunora codegen --api-spec openrpc` and wire `_generated/openrpc.json` to the worker to render the OpenRPC reference here."),e[14]=o,e[15]=n):n=e[15];let s;e[16]!==o?(s=o("No OpenRPC spec configured"),e[16]=o,e[17]=s):s=e[17];let i;return e[18]!==n||e[19]!==s?(i=p(f,{description:n,testId:"openrpc-reference-empty",title:s}),e[18]=n,e[19]=s,e[20]=i):i=e[20],i}let u;return e[21]!==l?(u=p(x,{model:l}),e[21]=l,e[22]=u):u=e[22],u};export{T as default};
1
+ import{c as g}from"react/compiler-runtime";import{useLunora as y}from"@lunora/react";import{E as f}from"./empty-state-Cg7t_8qu.js";import{n as h}from"./skeleton-C1wQ9M5t.js";import{u as k,U as x}from"./reference-view-DncEStdm.js";import{useT as P}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{jsxs as S,jsx as p}from"react/jsx-runtime";const v=t=>(t.params??[]).find(e=>e.name==="args")??(t.params??[])[0],w=t=>t["x-tags"]?.[0]?.name??(t.name.includes(":")?t.name.slice(0,t.name.indexOf(":")):""),I=t=>{const e=v(t)?.schema;return{argsSchema:e,description:t.description,functionPath:t.name,httpPath:"/_lunora/rpc",key:t.name,kind:t["x-lunora-function-kind"],method:"POST",operationId:t.name,requestSchema:e,responses:[{description:t.result?.name,schema:t.result?.schema,status:"200"}],summary:t.summary??t.name,tags:[w(t)],title:t.summary??t.name}},C=t=>{const e=t??{},d=(e.methods??[]).map(a=>I(a)),o=new Map;for(const a of d){const m=a.tags[0]??"",r=o.get(m)??[];r.push(a),o.set(m,r)}return{groups:[...o.entries()].map(([a,m])=>({name:a,operations:m.toSorted((r,c)=>r.operationId.localeCompare(c.operationId))})).toSorted((a,m)=>a.name.localeCompare(m.name)),operationByKey:new Map(d.map(a=>[a.key,a])),title:e.info?.title??"API reference",version:e.info?.version}},O=t=>t.methods===void 0||t.methods.length===0,R=t=>{const e=t;return O(e)?{kind:"empty"}:{kind:"ready",spec:e}},T=t=>{const e=g(23),{spec:d}=t,o=P(),a=y();let m;e[0]!==a?(m=()=>a.fetchOpenRpc(),e[0]=a,e[1]=m):m=e[1];const r=k(d,m,R);let c;e[2]!==r.kind||e[3]!==r.spec?(c=r.kind==="ready"?C(r.spec):void 0,e[2]=r.kind,e[3]=r.spec,e[4]=c):c=e[4];const l=c;if(r.kind==="loading"){let n;return e[5]===Symbol.for("react.memo_cache_sentinel")?(n=S("div",{className:"flex flex-col gap-4","data-testid":"openrpc-reference-loading",children:[p(h,{className:"h-8 w-48"}),p(h,{className:"h-64 w-full"})]}),e[5]=n):n=e[5],n}if(r.kind==="error"){let n;e[6]!==r.message||e[7]!==o?(n=o("Couldn't load the OpenRPC spec: {message}",{message:r.message}),e[6]=r.message,e[7]=o,e[8]=n):n=e[8];let s;e[9]!==o?(s=o("API reference unavailable"),e[9]=o,e[10]=s):s=e[10];let i;return e[11]!==n||e[12]!==s?(i=p(f,{description:n,testId:"openrpc-reference-error",title:s}),e[11]=n,e[12]=s,e[13]=i):i=e[13],i}if(r.kind==="empty"||l===void 0){let n;e[14]!==o?(n=o("Run `lunora codegen --api-spec openrpc` and wire `_generated/openrpc.json` to the worker to render the OpenRPC reference here."),e[14]=o,e[15]=n):n=e[15];let s;e[16]!==o?(s=o("No OpenRPC spec configured"),e[16]=o,e[17]=s):s=e[17];let i;return e[18]!==n||e[19]!==s?(i=p(f,{description:n,testId:"openrpc-reference-empty",title:s}),e[18]=n,e[19]=s,e[20]=i):i=e[20],i}let u;return e[21]!==l?(u=p(x,{model:l}),e[21]=l,e[22]=u):u=e[22],u};export{T as default};
@@ -1 +1 @@
1
- import{c as I}from"react/compiler-runtime";import{useLunora as M}from"@lunora/react";import{useState as J,useEffect as R}from"react";import{ConfirmButton as T}from"./ConfirmButton-CTL3f3kr.js";import{c as q,u as K}from"./card-CIDGUN6K.js";import{E as O}from"./empty-state-Cg7t_8qu.js";import{n as P,d as V,m as $,p as s,f as W,u as d}from"./table-DdJBrClo.js";import{O as X}from"./use-admin-query-QJ-ibl5u.js";import{useAutoRefresh as Y}from"./DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js";import{useT as z}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{f as D,i as G,b as H}from"./internal-BSIsQVC6.js";import{jsx as o,jsxs as p}from"react/jsx-runtime";const Q=i=>Number.isFinite(i)?G(i,"—"):"—",A=i=>i.toSorted((e,u)=>e.scheduledFor-u.scheduledFor),U=(i,e,u)=>e!==void 0?e:u===void 0?f=>i.cancelScheduledJob(f):void 0,me=i=>{const e=I(16),{cancelJob:u,loadJobs:f}=i===void 0?{}:i,l=M(),t=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 a=X(b,async()=>{const r=await(f??(()=>l.listScheduledJobs()))();return A(r)}),[C,F]=J(void 0),[L,S]=J(void 0);let v,x;e[1]!==l||e[2]!==c?(v=()=>{if(c)return l.subscribeScheduledJobs(r=>{S(void 0),F(A(r))})},x=[c,l],e[1]=l,e[2]=c,e[3]=v,e[4]=x):(v=e[3],x=e[4]),R(v,x);let j;e[5]!==a?(j=()=>{a.refetch()},e[5]=a,e[6]=j):j=e[6],Y(j,!c);const N=U(l,u,f),n=C??a.data,g=L??a.error,k=async r=>{if(N!==void 0){S(void 0);try{await N(r),c||a.refetch()}catch(B){S(H(B))}}},E="flex flex-col gap-3",_="lunora-scheduled-jobs";let m;e[7]!==g?(m=g!==null&&o("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:g}),e[7]=g,e[8]=m):m=e[8];let h;e[9]!==n?.length||e[10]!==t?(h=n?.length===0&&o(O,{description:t("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:[o("circle",{cx:"12",cy:"12",r:"9"}),o("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:t("No scheduled jobs.")}),e[9]=n?.length,e[10]=t,e[11]=h):h=e[11];const w=n!==void 0&&n.length>0&&o(q,{className:"overflow-hidden py-0",children:o(K,{className:"px-0",children:p(P,{"data-testid":"sj-table",children:[o(V,{children:p($,{children:[o(s,{children:t("function")}),o(s,{children:t("scheduled for")}),o(s,{children:t("pool")}),o(s,{children:t("attempts")}),o(s,{children:t("shard")}),o(s,{children:t("id")}),N!==void 0&&o(s,{"aria-label":t("Actions")})]})}),o(W,{children:n.map(r=>p($,{"data-testid":`sj-row-${r.id}`,children:[o(d,{className:"font-mono text-xs",children:r.functionPath}),o(d,{className:"text-muted-foreground tabular-nums",children:Q(r.scheduledFor)}),o(d,{className:"font-mono text-xs",children:r.pool??""}),o(d,{className:"tabular-nums",children:r.attempts??0}),o(d,{children:r.shardKey??""}),o(d,{className:"font-mono text-xs",children:r.id}),N!==void 0&&o(d,{className:"text-right",children:o(T,{confirmLabel:t("Cancel job?"),onConfirm:()=>{D(k(r.id))},testId:`sj-cancel-${r.id}`,children:t("Cancel")})})]},r.id))})]})})});let y;return e[12]!==w||e[13]!==m||e[14]!==h?(y=p("div",{className:E,"data-testid":_,children:[m,h,w]}),e[12]=w,e[13]=m,e[14]=h,e[15]=y):y=e[15],y};export{me as ScheduledJobs};
1
+ import{c as I}from"react/compiler-runtime";import{useLunora as M}from"@lunora/react";import{useState as J,useEffect as R}from"react";import{ConfirmButton as T}from"./ConfirmButton-CTL3f3kr.js";import{c as q,u as K}from"./card-CIDGUN6K.js";import{E as O}from"./empty-state-Cg7t_8qu.js";import{n as P,d as V,m as $,p as s,f as W,u as d}from"./table-DdJBrClo.js";import{O as X}from"./use-admin-query-CnnyWJXM.js";import{useAutoRefresh as Y}from"./DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js";import{useT as z}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{f as D,i as G,b as H}from"./internal-zkEvTqy8.js";import{jsx as o,jsxs as p}from"react/jsx-runtime";const Q=i=>Number.isFinite(i)?G(i,"—"):"—",A=i=>i.toSorted((e,u)=>e.scheduledFor-u.scheduledFor),U=(i,e,u)=>e!==void 0?e:u===void 0?f=>i.cancelScheduledJob(f):void 0,me=i=>{const e=I(16),{cancelJob:u,loadJobs:f}=i===void 0?{}:i,l=M(),t=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 a=X(b,async()=>{const r=await(f??(()=>l.listScheduledJobs()))();return A(r)}),[C,F]=J(void 0),[L,S]=J(void 0);let v,x;e[1]!==l||e[2]!==c?(v=()=>{if(c)return l.subscribeScheduledJobs(r=>{S(void 0),F(A(r))})},x=[c,l],e[1]=l,e[2]=c,e[3]=v,e[4]=x):(v=e[3],x=e[4]),R(v,x);let j;e[5]!==a?(j=()=>{a.refetch()},e[5]=a,e[6]=j):j=e[6],Y(j,!c);const N=U(l,u,f),n=C??a.data,g=L??a.error,k=async r=>{if(N!==void 0){S(void 0);try{await N(r),c||a.refetch()}catch(B){S(H(B))}}},E="flex flex-col gap-3",_="lunora-scheduled-jobs";let m;e[7]!==g?(m=g!==null&&o("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:g}),e[7]=g,e[8]=m):m=e[8];let h;e[9]!==n?.length||e[10]!==t?(h=n?.length===0&&o(O,{description:t("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:[o("circle",{cx:"12",cy:"12",r:"9"}),o("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:t("No scheduled jobs.")}),e[9]=n?.length,e[10]=t,e[11]=h):h=e[11];const w=n!==void 0&&n.length>0&&o(q,{className:"overflow-hidden py-0",children:o(K,{className:"px-0",children:p(P,{"data-testid":"sj-table",children:[o(V,{children:p($,{children:[o(s,{children:t("function")}),o(s,{children:t("scheduled for")}),o(s,{children:t("pool")}),o(s,{children:t("attempts")}),o(s,{children:t("shard")}),o(s,{children:t("id")}),N!==void 0&&o(s,{"aria-label":t("Actions")})]})}),o(W,{children:n.map(r=>p($,{"data-testid":`sj-row-${r.id}`,children:[o(d,{className:"font-mono text-xs",children:r.functionPath}),o(d,{className:"text-muted-foreground tabular-nums",children:Q(r.scheduledFor)}),o(d,{className:"font-mono text-xs",children:r.pool??""}),o(d,{className:"tabular-nums",children:r.attempts??0}),o(d,{children:r.shardKey??""}),o(d,{className:"font-mono text-xs",children:r.id}),N!==void 0&&o(d,{className:"text-right",children:o(T,{confirmLabel:t("Cancel job?"),onConfirm:()=>{D(k(r.id))},testId:`sj-cancel-${r.id}`,children:t("Cancel")})})]},r.id))})]})})});let y;return e[12]!==w||e[13]!==m||e[14]!==h?(y=p("div",{className:E,"data-testid":_,children:[m,h,w]}),e[12]=w,e[13]=m,e[14]=h,e[15]=y):y=e[15],y};export{me as ScheduledJobs};
@@ -1 +1 @@
1
- import"react/compiler-runtime";import"@tanstack/react-router";import"react";import{S as j}from"./studio-BtC7WPbz.js";import"./ErrorBoundary-DvzYskH7.js";import"./operation-console-provider-BMJNtiyB.js";import"./badge-BbuuAio7.js";import"./input-JHu63lTv.js";import"./skeleton-C1wQ9M5t.js";import"./home-panel-CeeqqV0z.js";import"./DEFAULT_LOCALE-BZ4NojpD.js";import"./StudioI18nProvider-CZ5h4nrV.js";import"./data-view-params-ClrV7XgF.js";import"./internal-BSIsQVC6.js";import"./utils-bhneXptQ.js";import"./CommandPalette--SQwfTW1.js";import"react/jsx-runtime";export{j as Studio};
1
+ import"react/compiler-runtime";import"@tanstack/react-router";import"react";import{S as j}from"./studio-Drf4en3j.js";import"./ErrorBoundary-DvzYskH7.js";import"./operation-console-provider-BMJNtiyB.js";import"./badge-BbuuAio7.js";import"./input-JHu63lTv.js";import"./skeleton-C1wQ9M5t.js";import"./home-panel-BtxdqXDe.js";import"./DEFAULT_LOCALE-BZ4NojpD.js";import"./StudioI18nProvider-CZ5h4nrV.js";import"./data-view-params-ClrV7XgF.js";import"./internal-zkEvTqy8.js";import"./utils-bhneXptQ.js";import"./CommandPalette-mPR8-vIm.js";import"react/jsx-runtime";export{j as Studio};
@@ -1 +1 @@
1
- import{c as E}from"react/compiler-runtime";import{LunoraClient as z}from"@lunora/client";import{LunoraProvider as q}from"@lunora/react";import{useState as K,useEffect as U}from"react";import{ErrorBoundary as G}from"./ErrorBoundary-DvzYskH7.js";import{b as R,f as H,a as J,m as Q,S as V}from"./studio-BtC7WPbz.js";import X from"./useDebounced-CU-uftxO.js";import{useT as D,createStudioI18n as Y}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{StudioI18nProvider as M}from"./StudioI18nProvider-CZ5h4nrV.js";import{r as Z}from"./internal-BSIsQVC6.js";import{h as j}from"./recording-client-DRAZEmzE.js";import F from"./STUDIO_ROOT_CLASS-C6MccdVk.js";import{a as B}from"./browser-storage-xjTyMKY0.js";import{c as W}from"./utils-bhneXptQ.js";import{u as ee}from"./button-BkCrNcAs.js";import{u as te}from"./input-JHu63lTv.js";import{jsx as b,jsxs as C}from"react/jsx-runtime";const O="lunora-studio-admin-token",oe=()=>{try{return B("session")?.getItem(O)??""}catch{return""}},ne=k=>{const e=B("session");if(e!==void 0)try{k===""?e.removeItem(O):e.setItem(O,k)}catch{}},re="/_lunora/admin/ws-token",le=k=>{const e=k;return typeof e?.token=="string"&&e.token.length>0&&typeof e.expiresAtMs=="number"},ae=k=>{const{adminToken:e,baseUrl:c}=k,o=k.fetchImpl??fetch;let n=c;for(;n.endsWith("/");)n=n.slice(0,-1);const s=`${n}${re}`;let t,r=!1,l;const m=async()=>{const f=await o(s,{headers:{authorization:`Bearer ${e}`},method:"POST"});if(f.status===404||f.status===405)return r=!0,e;if(!f.ok)throw new Error(`ws-token mint failed: ${String(f.status)}`);const a=await f.json().catch(()=>{});if(!le(a))throw new Error("ws-token mint failed: malformed response body");return t=a,a.token};return{getToken:async()=>r?e:t!==void 0&&t.expiresAtMs-1e4>Date.now()?t.token:(l??=m().finally(()=>{l=void 0}),l),invalidate:()=>{t=void 0}}},se=k=>{const e=E(42),{onSubmit:c}=k,o=D(),[n,s]=K("");let t;e[0]!==n?(t=n.trim(),e[0]=n,e[1]=t):t=e[1];const r=t;let l;e[2]!==c||e[3]!==r?(l=N=>{N.preventDefault(),r!==""&&c(r)},e[2]=c,e[3]=r,e[4]=l):l=e[4];const m=l;let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=b("div",{className:"h-10 w-10 text-foreground",children:b(H,{})}),e[5]=f):f=e[5];let a;e[6]!==o?(a=o("Connect to Lunora Studio"),e[6]=o,e[7]=a):a=e[7];let v;e[8]!==a?(v=b("h1",{className:"text-base font-semibold text-foreground",children:a}),e[8]=a,e[9]=v):v=e[9];let g;e[10]!==o?(g=o("Enter your admin token to access the studio."),e[10]=o,e[11]=g):g=e[11];let u;e[12]!==g?(u=b("p",{className:"text-[13px] text-muted-foreground",children:g}),e[12]=g,e[13]=u):u=e[13];let d;e[14]!==v||e[15]!==u?(d=C("div",{className:"flex flex-col items-center gap-3 text-center",children:[f,C("div",{className:"flex flex-col gap-1",children:[v,u]})]}),e[14]=v,e[15]=u,e[16]=d):d=e[16];let h;e[17]!==o?(h=o("admin token"),e[17]=o,e[18]=h):h=e[18];let i;e[19]!==h?(i=b("label",{className:"text-xs font-medium text-foreground",htmlFor:"lunora-studio-login-token",children:h}),e[19]=h,e[20]=i):i=e[20];let p;e[21]===Symbol.for("react.memo_cache_sentinel")?(p=N=>{s(N.target.value)},e[21]=p):p=e[21];let x;e[22]!==n?(x=b(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]=x):x=e[23];let y;e[24]!==o?(y=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]=y):y=e[25];let I;e[26]!==y?(I=b("p",{className:"text-[11px] text-muted-foreground",children:y}),e[26]=y,e[27]=I):I=e[27];let S;e[28]!==i||e[29]!==x||e[30]!==I?(S=C("div",{className:"flex flex-col gap-1.5",children:[i,x,I]}),e[28]=i,e[29]=x,e[30]=I,e[31]=S):S=e[31];const _=r==="";let T;e[32]!==o?(T=o("Connect"),e[32]=o,e[33]=T):T=e[33];let w;e[34]!==_||e[35]!==T?(w=b(ee,{"data-testid":"lunora-studio-login-submit",disabled:_,type:"submit",children:T}),e[34]=_,e[35]=T,e[36]=w):w=e[36];let $;return e[37]!==m||e[38]!==S||e[39]!==w||e[40]!==d?($=C("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:m,children:[d,S,w]}),e[37]=m,e[38]=S,e[39]=w,e[40]=d,e[41]=$):$=e[41],$},ie=k=>{const e=E(10),{i18n:c,onSubmit:o}=k,{resolvedTheme:n}=R(),s=n==="dark"&&"dark";let t;e[0]!==s?(t=W(F,s,"flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground"),e[0]=s,e[1]=t):t=e[1];let r;e[2]!==o?(r=b(se,{onSubmit:o}),e[2]=o,e[3]=r):r=e[3];let l;e[4]!==c||e[5]!==r?(l=b(M,{i18n:c,children:r}),e[4]=c,e[5]=r,e[6]=l):l=e[6];let m;return e[7]!==t||e[8]!==l?(m=b("div",{className:t,"data-testid":"lunora-studio-login-root",children:l}),e[7]=t,e[8]=l,e[9]=m):m=e[9],m},de=k=>{const e=E(23),{basePath:c,chrome:o,studio:n}=k,s=D();let t;e[0]!==s?(t=s("Studio failed"),e[0]=s,e[1]=t):t=e[1];let r;e[2]!==s?(r=s("Studio"),e[2]=s,e[3]=r):r=e[3];let l;e[4]!==s?(l=s("Try again"),e[4]=s,e[5]=l):l=e[5];const m=n?.dataEditable,f=n?.functions,a=n?.initialShardKey,v=n?.openApiSpec,g=n?.openRpcSpec,u=n?.runAsIdentity,d=n?.scheduledCancel,h=n?.scheduledLoad,i=n?.schemaEditable;let p;e[6]!==c||e[7]!==o||e[8]!==d||e[9]!==h||e[10]!==i||e[11]!==m||e[12]!==f||e[13]!==a||e[14]!==v||e[15]!==g||e[16]!==u?(p=b(V,{basePath:c,chrome:o,dataEditable:m,functions:f,initialShardKey:a,openApiSpec:v,openRpcSpec:g,runAsIdentity:u,scheduledCancel:d,scheduledLoad:h,schemaEditable:i}),e[6]=c,e[7]=o,e[8]=d,e[9]=h,e[10]=i,e[11]=m,e[12]=f,e[13]=a,e[14]=v,e[15]=g,e[16]=u,e[17]=p):p=e[17];let x;return e[18]!==t||e[19]!==p||e[20]!==r||e[21]!==l?(x=b(G,{fallbackTitle:t,label:r,retryLabel:l,children:p}),e[18]=t,e[19]=p,e[20]=r,e[21]=l,e[22]=x):x=e[22],x},ce=k=>{const e=E(20),{basePath:c,clearToken:o,client:n,i18n:s,onTokenChange:t,rulesInstalled:r,studio:l,token:m}=k,{resolvedTheme:f}=R();let a;e[0]!==o||e[1]!==t||e[2]!==r||e[3]!==m?(a={clearToken:o,onTokenChange:t,rulesInstalled:r,token:m},e[0]=o,e[1]=t,e[2]=r,e[3]=m,e[4]=a):a=e[4];const v=a,g=f==="dark"&&"dark";let u;e[5]!==g?(u=W(F,g,"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground"),e[5]=g,e[6]=u):u=e[6];let d;e[7]!==c||e[8]!==v||e[9]!==l?(d=b(Q,{children:b(de,{basePath:c,chrome:v,studio:l})}),e[7]=c,e[8]=v,e[9]=l,e[10]=d):d=e[10];let h;e[11]!==s||e[12]!==d?(h=b(M,{i18n:s,children:d}),e[11]=s,e[12]=d,e[13]=h):h=e[13];let i;e[14]!==n||e[15]!==h?(i=b(q,{client:n,children:h}),e[14]=n,e[15]=h,e[16]=i):i=e[16];let p;return e[17]!==u||e[18]!==i?(p=b("div",{className:u,"data-testid":"lunora-studio-app",children:i}),e[17]=u,e[18]=i,e[19]=p):p=e[19],p},Ae=k=>{const e=E(27);let c;e[0]!==k?(c=k===void 0?{}:k,e[0]=k,e[1]=c):c=e[1];const{adminToken:o,basePath:n,baseUrl:s,client:t,rulesInstalled:r,studio:l,locale:m}=c;let f;e[2]!==o?(f=()=>o??oe(),e[2]=o,e[3]=f):f=e[3];const[a,v]=K(f);let g,u;e[4]!==a?(g=()=>{ne(a)},u=[a],e[4]=a,e[5]=g,e[6]=u):(g=e[5],u=e[6]),U(g,u);const d=X(a,300);let h;e:{if(t!==void 0){let A;e[7]!==t?(A=j(t),e[7]=t,e[8]=A):A=e[8],h=A;break e}let N;if(e[9]!==s||e[10]!==d){const A=Z(s),P=d===""?void 0:ae({adminToken:d,baseUrl:A}),L=new z({url:A,...P===void 0?{}:{wsToken:P.getToken}});P!==void 0&&(L.setAuthToken(d),L.onTokenExpired(P.invalidate)),N=j(L),e[9]=s,e[10]=d,e[11]=N}else N=e[11];h=N}const i=h;let p,x;e[12]!==i||e[13]!==t?(p=()=>()=>{t===void 0&&i.close()},x=[i,t],e[12]=i,e[13]=t,e[14]=p,e[15]=x):(p=e[14],x=e[15]),U(p,x);let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=N=>{v(N.target.value)},e[16]=y):y=e[16];const I=y;let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{v("")},e[17]=S):S=e[17];const _=S;let T;e[18]!==m?(T=Y(m),e[18]=m,e[19]=T):T=e[19];const w=T;let $;return e[20]!==n||e[21]!==i||e[22]!==w||e[23]!==r||e[24]!==l||e[25]!==a?($=b(J,{children:a===""?b(ie,{i18n:w,onSubmit:v}):b(ce,{basePath:n,clearToken:_,client:i,i18n:w,onTokenChange:I,rulesInstalled:r,studio:l,token:a})}),e[20]=n,e[21]=i,e[22]=w,e[23]=r,e[24]=l,e[25]=a,e[26]=$):$=e[26],$};export{Ae as StudioApp};
1
+ import{c as E}from"react/compiler-runtime";import{LunoraClient as z}from"@lunora/client";import{LunoraProvider as q}from"@lunora/react";import{useState as K,useEffect as U}from"react";import{ErrorBoundary as G}from"./ErrorBoundary-DvzYskH7.js";import{b as R,f as H,a as J,m as Q,S as V}from"./studio-Drf4en3j.js";import X from"./useDebounced-CU-uftxO.js";import{useT as D,createStudioI18n as Y}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{StudioI18nProvider as M}from"./StudioI18nProvider-CZ5h4nrV.js";import{r as Z}from"./internal-zkEvTqy8.js";import{h as j}from"./recording-client-DtUxwVNY.js";import F from"./STUDIO_ROOT_CLASS-C6MccdVk.js";import{a as B}from"./browser-storage-xjTyMKY0.js";import{c as W}from"./utils-bhneXptQ.js";import{u as ee}from"./button-BkCrNcAs.js";import{u as te}from"./input-JHu63lTv.js";import{jsx as b,jsxs as C}from"react/jsx-runtime";const O="lunora-studio-admin-token",oe=()=>{try{return B("session")?.getItem(O)??""}catch{return""}},ne=k=>{const e=B("session");if(e!==void 0)try{k===""?e.removeItem(O):e.setItem(O,k)}catch{}},re="/_lunora/admin/ws-token",le=k=>{const e=k;return typeof e?.token=="string"&&e.token.length>0&&typeof e.expiresAtMs=="number"},ae=k=>{const{adminToken:e,baseUrl:c}=k,o=k.fetchImpl??fetch;let n=c;for(;n.endsWith("/");)n=n.slice(0,-1);const s=`${n}${re}`;let t,r=!1,l;const m=async()=>{const f=await o(s,{headers:{authorization:`Bearer ${e}`},method:"POST"});if(f.status===404||f.status===405)return r=!0,e;if(!f.ok)throw new Error(`ws-token mint failed: ${String(f.status)}`);const a=await f.json().catch(()=>{});if(!le(a))throw new Error("ws-token mint failed: malformed response body");return t=a,a.token};return{getToken:async()=>r?e:t!==void 0&&t.expiresAtMs-1e4>Date.now()?t.token:(l??=m().finally(()=>{l=void 0}),l),invalidate:()=>{t=void 0}}},se=k=>{const e=E(42),{onSubmit:c}=k,o=D(),[n,s]=K("");let t;e[0]!==n?(t=n.trim(),e[0]=n,e[1]=t):t=e[1];const r=t;let l;e[2]!==c||e[3]!==r?(l=N=>{N.preventDefault(),r!==""&&c(r)},e[2]=c,e[3]=r,e[4]=l):l=e[4];const m=l;let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=b("div",{className:"h-10 w-10 text-foreground",children:b(H,{})}),e[5]=f):f=e[5];let a;e[6]!==o?(a=o("Connect to Lunora Studio"),e[6]=o,e[7]=a):a=e[7];let v;e[8]!==a?(v=b("h1",{className:"text-base font-semibold text-foreground",children:a}),e[8]=a,e[9]=v):v=e[9];let g;e[10]!==o?(g=o("Enter your admin token to access the studio."),e[10]=o,e[11]=g):g=e[11];let u;e[12]!==g?(u=b("p",{className:"text-[13px] text-muted-foreground",children:g}),e[12]=g,e[13]=u):u=e[13];let d;e[14]!==v||e[15]!==u?(d=C("div",{className:"flex flex-col items-center gap-3 text-center",children:[f,C("div",{className:"flex flex-col gap-1",children:[v,u]})]}),e[14]=v,e[15]=u,e[16]=d):d=e[16];let h;e[17]!==o?(h=o("admin token"),e[17]=o,e[18]=h):h=e[18];let i;e[19]!==h?(i=b("label",{className:"text-xs font-medium text-foreground",htmlFor:"lunora-studio-login-token",children:h}),e[19]=h,e[20]=i):i=e[20];let p;e[21]===Symbol.for("react.memo_cache_sentinel")?(p=N=>{s(N.target.value)},e[21]=p):p=e[21];let x;e[22]!==n?(x=b(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]=x):x=e[23];let y;e[24]!==o?(y=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]=y):y=e[25];let I;e[26]!==y?(I=b("p",{className:"text-[11px] text-muted-foreground",children:y}),e[26]=y,e[27]=I):I=e[27];let S;e[28]!==i||e[29]!==x||e[30]!==I?(S=C("div",{className:"flex flex-col gap-1.5",children:[i,x,I]}),e[28]=i,e[29]=x,e[30]=I,e[31]=S):S=e[31];const _=r==="";let T;e[32]!==o?(T=o("Connect"),e[32]=o,e[33]=T):T=e[33];let w;e[34]!==_||e[35]!==T?(w=b(ee,{"data-testid":"lunora-studio-login-submit",disabled:_,type:"submit",children:T}),e[34]=_,e[35]=T,e[36]=w):w=e[36];let $;return e[37]!==m||e[38]!==S||e[39]!==w||e[40]!==d?($=C("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:m,children:[d,S,w]}),e[37]=m,e[38]=S,e[39]=w,e[40]=d,e[41]=$):$=e[41],$},ie=k=>{const e=E(10),{i18n:c,onSubmit:o}=k,{resolvedTheme:n}=R(),s=n==="dark"&&"dark";let t;e[0]!==s?(t=W(F,s,"flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground"),e[0]=s,e[1]=t):t=e[1];let r;e[2]!==o?(r=b(se,{onSubmit:o}),e[2]=o,e[3]=r):r=e[3];let l;e[4]!==c||e[5]!==r?(l=b(M,{i18n:c,children:r}),e[4]=c,e[5]=r,e[6]=l):l=e[6];let m;return e[7]!==t||e[8]!==l?(m=b("div",{className:t,"data-testid":"lunora-studio-login-root",children:l}),e[7]=t,e[8]=l,e[9]=m):m=e[9],m},de=k=>{const e=E(23),{basePath:c,chrome:o,studio:n}=k,s=D();let t;e[0]!==s?(t=s("Studio failed"),e[0]=s,e[1]=t):t=e[1];let r;e[2]!==s?(r=s("Studio"),e[2]=s,e[3]=r):r=e[3];let l;e[4]!==s?(l=s("Try again"),e[4]=s,e[5]=l):l=e[5];const m=n?.dataEditable,f=n?.functions,a=n?.initialShardKey,v=n?.openApiSpec,g=n?.openRpcSpec,u=n?.runAsIdentity,d=n?.scheduledCancel,h=n?.scheduledLoad,i=n?.schemaEditable;let p;e[6]!==c||e[7]!==o||e[8]!==d||e[9]!==h||e[10]!==i||e[11]!==m||e[12]!==f||e[13]!==a||e[14]!==v||e[15]!==g||e[16]!==u?(p=b(V,{basePath:c,chrome:o,dataEditable:m,functions:f,initialShardKey:a,openApiSpec:v,openRpcSpec:g,runAsIdentity:u,scheduledCancel:d,scheduledLoad:h,schemaEditable:i}),e[6]=c,e[7]=o,e[8]=d,e[9]=h,e[10]=i,e[11]=m,e[12]=f,e[13]=a,e[14]=v,e[15]=g,e[16]=u,e[17]=p):p=e[17];let x;return e[18]!==t||e[19]!==p||e[20]!==r||e[21]!==l?(x=b(G,{fallbackTitle:t,label:r,retryLabel:l,children:p}),e[18]=t,e[19]=p,e[20]=r,e[21]=l,e[22]=x):x=e[22],x},ce=k=>{const e=E(20),{basePath:c,clearToken:o,client:n,i18n:s,onTokenChange:t,rulesInstalled:r,studio:l,token:m}=k,{resolvedTheme:f}=R();let a;e[0]!==o||e[1]!==t||e[2]!==r||e[3]!==m?(a={clearToken:o,onTokenChange:t,rulesInstalled:r,token:m},e[0]=o,e[1]=t,e[2]=r,e[3]=m,e[4]=a):a=e[4];const v=a,g=f==="dark"&&"dark";let u;e[5]!==g?(u=W(F,g,"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground"),e[5]=g,e[6]=u):u=e[6];let d;e[7]!==c||e[8]!==v||e[9]!==l?(d=b(Q,{children:b(de,{basePath:c,chrome:v,studio:l})}),e[7]=c,e[8]=v,e[9]=l,e[10]=d):d=e[10];let h;e[11]!==s||e[12]!==d?(h=b(M,{i18n:s,children:d}),e[11]=s,e[12]=d,e[13]=h):h=e[13];let i;e[14]!==n||e[15]!==h?(i=b(q,{client:n,children:h}),e[14]=n,e[15]=h,e[16]=i):i=e[16];let p;return e[17]!==u||e[18]!==i?(p=b("div",{className:u,"data-testid":"lunora-studio-app",children:i}),e[17]=u,e[18]=i,e[19]=p):p=e[19],p},Ae=k=>{const e=E(27);let c;e[0]!==k?(c=k===void 0?{}:k,e[0]=k,e[1]=c):c=e[1];const{adminToken:o,basePath:n,baseUrl:s,client:t,rulesInstalled:r,studio:l,locale:m}=c;let f;e[2]!==o?(f=()=>o??oe(),e[2]=o,e[3]=f):f=e[3];const[a,v]=K(f);let g,u;e[4]!==a?(g=()=>{ne(a)},u=[a],e[4]=a,e[5]=g,e[6]=u):(g=e[5],u=e[6]),U(g,u);const d=X(a,300);let h;e:{if(t!==void 0){let A;e[7]!==t?(A=j(t),e[7]=t,e[8]=A):A=e[8],h=A;break e}let N;if(e[9]!==s||e[10]!==d){const A=Z(s),P=d===""?void 0:ae({adminToken:d,baseUrl:A}),L=new z({url:A,...P===void 0?{}:{wsToken:P.getToken}});P!==void 0&&(L.setAuthToken(d),L.onTokenExpired(P.invalidate)),N=j(L),e[9]=s,e[10]=d,e[11]=N}else N=e[11];h=N}const i=h;let p,x;e[12]!==i||e[13]!==t?(p=()=>()=>{t===void 0&&i.close()},x=[i,t],e[12]=i,e[13]=t,e[14]=p,e[15]=x):(p=e[14],x=e[15]),U(p,x);let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=N=>{v(N.target.value)},e[16]=y):y=e[16];const I=y;let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{v("")},e[17]=S):S=e[17];const _=S;let T;e[18]!==m?(T=Y(m),e[18]=m,e[19]=T):T=e[19];const w=T;let $;return e[20]!==n||e[21]!==i||e[22]!==w||e[23]!==r||e[24]!==l||e[25]!==a?($=b(J,{children:a===""?b(ie,{i18n:w,onSubmit:v}):b(ce,{basePath:n,clearToken:_,client:i,i18n:w,onTokenChange:I,rulesInstalled:r,studio:l,token:a})}),e[20]=n,e[21]=i,e[22]=w,e[23]=r,e[24]=l,e[25]=a,e[26]=$):$=e[26],$};export{Ae as StudioApp};
@@ -1 +1 @@
1
- import{useState as x}from"react";import{E as b}from"./error-alert-t6cpEi0z.js";import{c as N,u as v}from"./card-CIDGUN6K.js";import{n as w,d as y,m as c,p as m,f as $,u as l}from"./table-DdJBrClo.js";import{useT as k}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{c as E}from"./utils-bhneXptQ.js";import{jsxs as i,jsx as t}from"react/jsx-runtime";const I={ERROR:"error",INFO:"info",WARN:"warning"},q=e=>{const n=typeof e.metadata.table=="string"?e.metadata.table:void 0;return{description:`${e.detail} ${e.remediation}`,entity:n,issueType:e.title,key:e.cacheKey,level:I[e.level]}},T=["error","warning","info"],A={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},R=(e,n)=>({error:e("Errors"),info:e("Info"),warning:e("Warnings")})[n],O=(e,n,o)=>({error:e("{count} errors",{count:o}),info:e("{count} suggestions",{count:o}),warning:e("{count} warnings",{count:o})})[n],S=(e,n)=>({error:e("No errors detected"),info:e("No suggestions"),warning:e("No warnings detected")})[n],j=e=>{const n={error:0,info:0,warning:0};for(const o of e??[])n[o.level]+=1;return n},B=({error:e=null,errorSource:n,rows:o,testId:a,toolbar:f})=>{const s=k(),[d,p]=x("error"),g=j(o),u=(o??[]).filter(r=>r.level===d),h=r=>{p(r.currentTarget.dataset.level)};return i("div",{className:"flex flex-col gap-3","data-testid":a,children:[t("div",{className:"flex border-b border-border",role:"tablist",children:T.map(r=>i("button",{"aria-selected":d===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":`${a}-tab-${r}`,onClick:h,role:"tab",type:"button",children:[i("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[t("span",{"aria-hidden":"true",className:E("size-2 rounded-sm",A[r])}),R(s,r)]}),t("span",{className:"ps-4 text-xs text-muted-foreground",children:O(s,r,g[r])})]},r))}),f!==void 0&&t("div",{className:"flex flex-wrap items-center gap-2",children:f}),e!==null&&t(b,{error:n??e,testId:`${a}-error`}),t(N,{className:"overflow-hidden py-0",children:t(v,{className:"px-0",children:i(w,{children:[t(y,{children:i(c,{children:[t(m,{children:s("Issue type")}),t(m,{children:s("Entity/item")}),t(m,{children:s("Description")})]})}),t($,{children:u.length===0?t(c,{children:i(l,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${a}-empty`,children:[t("span",{className:"block text-sm font-medium text-foreground",children:S(s,d)}),t("span",{className:"block text-sm",children:s("Nothing to report for this deployment.")})]})}):u.map(r=>i(c,{children:[t(l,{className:"font-medium text-foreground",children:r.issueType}),t(l,{className:"font-mono text-xs text-muted-foreground",children:r.entity??"—"}),i(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{B as A,q as E};
1
+ import{useState as x}from"react";import{E as b}from"./error-alert--Ie7ofJ0.js";import{c as N,u as v}from"./card-CIDGUN6K.js";import{n as w,d as y,m as c,p as m,f as $,u as l}from"./table-DdJBrClo.js";import{useT as k}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{c as E}from"./utils-bhneXptQ.js";import{jsxs as i,jsx as t}from"react/jsx-runtime";const I={ERROR:"error",INFO:"info",WARN:"warning"},q=e=>{const n=typeof e.metadata.table=="string"?e.metadata.table:void 0;return{description:`${e.detail} ${e.remediation}`,entity:n,issueType:e.title,key:e.cacheKey,level:I[e.level]}},T=["error","warning","info"],A={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},R=(e,n)=>({error:e("Errors"),info:e("Info"),warning:e("Warnings")})[n],O=(e,n,o)=>({error:e("{count} errors",{count:o}),info:e("{count} suggestions",{count:o}),warning:e("{count} warnings",{count:o})})[n],S=(e,n)=>({error:e("No errors detected"),info:e("No suggestions"),warning:e("No warnings detected")})[n],j=e=>{const n={error:0,info:0,warning:0};for(const o of e??[])n[o.level]+=1;return n},B=({error:e=null,errorSource:n,rows:o,testId:a,toolbar:f})=>{const s=k(),[d,p]=x("error"),g=j(o),u=(o??[]).filter(r=>r.level===d),h=r=>{p(r.currentTarget.dataset.level)};return i("div",{className:"flex flex-col gap-3","data-testid":a,children:[t("div",{className:"flex border-b border-border",role:"tablist",children:T.map(r=>i("button",{"aria-selected":d===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":`${a}-tab-${r}`,onClick:h,role:"tab",type:"button",children:[i("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[t("span",{"aria-hidden":"true",className:E("size-2 rounded-sm",A[r])}),R(s,r)]}),t("span",{className:"ps-4 text-xs text-muted-foreground",children:O(s,r,g[r])})]},r))}),f!==void 0&&t("div",{className:"flex flex-wrap items-center gap-2",children:f}),e!==null&&t(b,{error:n??e,testId:`${a}-error`}),t(N,{className:"overflow-hidden py-0",children:t(v,{className:"px-0",children:i(w,{children:[t(y,{children:i(c,{children:[t(m,{children:s("Issue type")}),t(m,{children:s("Entity/item")}),t(m,{children:s("Description")})]})}),t($,{children:u.length===0?t(c,{children:i(l,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${a}-empty`,children:[t("span",{className:"block text-sm font-medium text-foreground",children:S(s,d)}),t("span",{className:"block text-sm",children:s("Nothing to report for this deployment.")})]})}):u.map(r=>i(c,{children:[t(l,{className:"font-medium text-foreground",children:r.issueType}),t(l,{className:"font-mono text-xs text-muted-foreground",children:r.entity??"—"}),i(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{B as A,q as E};
@@ -1 +1 @@
1
- import{c as x}from"react/compiler-runtime";import{useT as w}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{h as y}from"./internal-BSIsQVC6.js";import{jsx as d,jsxs as p}from"react/jsx-runtime";const N=(l,e)=>{if(e==="")return[{match:!1,offset:0,text:l}];const a=[],n=l.toLowerCase(),o=e.toLowerCase();let t=0;for(let r=n.indexOf(o);r!==-1;r=n.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:n}=l;if(n==null){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=d("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=s):s=e[0],s}let o,t,r;if(e[1]!==a||e[2]!==n){r=Symbol.for("react.early_return_sentinel");e:{const s=y(n);if(a===void 0||a===""){r=d("span",{title:s,children:s});break e}o=s,t=N(s,a).map(k)}e[1]=a,e[2]=n,e[3]=o,e[4]=t,e[5]=r}else o=e[3],t=e[4],r=e[5];if(r!==Symbol.for("react.early_return_sentinel"))return r;let c;return e[6]!==o||e[7]!==t?(c=d("span",{title:o,children:t}),e[6]=o,e[7]=t,e[8]=c):c=e[8],c},j=l=>{const e=x(22),{columns:a,rows:n}=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=d("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:t}),e[2]=t,e[3]=r):r=e[3];let c;if(e[4]!==n||e[5]!==o){let i;e[7]!==o?(i=(h,u)=>d("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:u+1})},u),e[7]=o,e[8]=i):i=e[8],c=n.map(i),e[4]=n,e[5]=o,e[6]=c}else c=e[6];let s;e[9]!==r||e[10]!==c?(s=d("thead",{className:"sticky top-0 z-10 bg-muted",children:p("tr",{children:[r,c]})}),e[9]=r,e[10]=c,e[11]=s):s=e[11];let m;if(e[12]!==a||e[13]!==n){let i;e[15]!==n?(i=h=>p("tr",{className:"hover:bg-muted/40",children:[d("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:h}),n.map((u,g)=>d("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:d(v,{value:u[h]})},g))]},h),e[15]=n,e[16]=i):i=e[16],m=a.map(i),e[12]=a,e[13]=n,e[14]=m}else m=e[14];let f;e[17]!==m?(f=d("tbody",{children:m}),e[17]=m,e[18]=f):f=e[18];let b;return e[19]!==s||e[20]!==f?(b=d("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:p("table",{className:"border-collapse text-xs",children:[s,f]})}),e[19]=s,e[20]=f,e[21]=b):b=e[21],b},O=({children:l,layout:e="card",testId:a})=>d("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 k(l){return d("mark",{className:l.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:l.text},l.offset)}export{v as g,O as k,j as v};
1
+ import{c as x}from"react/compiler-runtime";import{useT as w}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{h as y}from"./internal-zkEvTqy8.js";import{jsx as d,jsxs as p}from"react/jsx-runtime";const N=(l,e)=>{if(e==="")return[{match:!1,offset:0,text:l}];const a=[],n=l.toLowerCase(),o=e.toLowerCase();let t=0;for(let r=n.indexOf(o);r!==-1;r=n.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:n}=l;if(n==null){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=d("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=s):s=e[0],s}let o,t,r;if(e[1]!==a||e[2]!==n){r=Symbol.for("react.early_return_sentinel");e:{const s=y(n);if(a===void 0||a===""){r=d("span",{title:s,children:s});break e}o=s,t=N(s,a).map(k)}e[1]=a,e[2]=n,e[3]=o,e[4]=t,e[5]=r}else o=e[3],t=e[4],r=e[5];if(r!==Symbol.for("react.early_return_sentinel"))return r;let c;return e[6]!==o||e[7]!==t?(c=d("span",{title:o,children:t}),e[6]=o,e[7]=t,e[8]=c):c=e[8],c},j=l=>{const e=x(22),{columns:a,rows:n}=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=d("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:t}),e[2]=t,e[3]=r):r=e[3];let c;if(e[4]!==n||e[5]!==o){let i;e[7]!==o?(i=(h,u)=>d("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:u+1})},u),e[7]=o,e[8]=i):i=e[8],c=n.map(i),e[4]=n,e[5]=o,e[6]=c}else c=e[6];let s;e[9]!==r||e[10]!==c?(s=d("thead",{className:"sticky top-0 z-10 bg-muted",children:p("tr",{children:[r,c]})}),e[9]=r,e[10]=c,e[11]=s):s=e[11];let m;if(e[12]!==a||e[13]!==n){let i;e[15]!==n?(i=h=>p("tr",{className:"hover:bg-muted/40",children:[d("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:h}),n.map((u,g)=>d("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:d(v,{value:u[h]})},g))]},h),e[15]=n,e[16]=i):i=e[16],m=a.map(i),e[12]=a,e[13]=n,e[14]=m}else m=e[14];let f;e[17]!==m?(f=d("tbody",{children:m}),e[17]=m,e[18]=f):f=e[18];let b;return e[19]!==s||e[20]!==f?(b=d("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:p("table",{className:"border-collapse text-xs",children:[s,f]})}),e[19]=s,e[20]=f,e[21]=b):b=e[21],b},O=({children:l,layout:e="card",testId:a})=>d("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 k(l){return d("mark",{className:l.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:l.text},l.offset)}export{v as g,O as k,j as v};
@@ -1 +1 @@
1
- import{c as A}from"react/compiler-runtime";import{flattenHint as $}from"@lunora/errors";import{useT as j}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{e as E,a as H,b as I}from"./internal-BSIsQVC6.js";import{b as O}from"./recording-client-DRAZEmzE.js";import{u as V}from"./operation-console-provider-BMJNtiyB.js";import{A as q}from"./alert-CVcOFuDR.js";import{jsx as v,jsxs as D}from"react/jsx-runtime";const G=C=>{const e=A(38),{className:N,error:r,testId:g}=C,w=j(),t=V();let l,s,n,i,a,c,o,m;if(e[0]!==N||e[1]!==r||e[2]!==t||e[3]!==g){const y=E(r);let b;e[12]!==r?(b=H(r),e[12]=r,e[13]=b):b=e[13],s=b;let h;e[14]!==r?(h=O(r),e[14]=r,e[15]=h):h=e[15];const k=h;let x;e[16]!==t||e[17]!==k?(x=()=>{t?.openConsole({errorsOnly:!0,seq:k})},e[16]=t,e[17]=k,e[18]=x):x=e[18],n=x,l=q,i=N,a=g,c="destructive";let p;e[19]!==r?(p=I(r),e[19]=r,e[20]=p):p=e[20],e[21]!==p?(o=v("p",{className:"font-medium",children:p}),e[21]=p,e[22]=o):o=e[22],m=y===void 0?null:v("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:$(y)}),e[0]=N,e[1]=r,e[2]=t,e[3]=g,e[4]=l,e[5]=s,e[6]=n,e[7]=i,e[8]=a,e[9]=c,e[10]=o,e[11]=m}else l=e[4],s=e[5],n=e[6],i=e[7],a=e[8],c=e[9],o=e[10],m=e[11];let u;e[23]!==s?(u=s===void 0?null:v("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:s,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[23]=s,e[24]=u):u=e[24];let d;e[25]!==t||e[26]!==n||e[27]!==w?(d=t===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:n,type:"button",children:w("Show in console")}),e[25]=t,e[26]=n,e[27]=w,e[28]=d):d=e[28];let f;return e[29]!==l||e[30]!==i||e[31]!==a||e[32]!==c||e[33]!==o||e[34]!==m||e[35]!==u||e[36]!==d?(f=D(l,{className:i,testId:a,variant:c,children:[o,m,u,d]}),e[29]=l,e[30]=i,e[31]=a,e[32]=c,e[33]=o,e[34]=m,e[35]=u,e[36]=d,e[37]=f):f=e[37],f};export{G as E};
1
+ import{c as A}from"react/compiler-runtime";import{flattenHint as $}from"@lunora/errors";import{useT as j}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{e as E,a as H,b as I}from"./internal-zkEvTqy8.js";import{b as O}from"./recording-client-DtUxwVNY.js";import{u as V}from"./operation-console-provider-BMJNtiyB.js";import{A as q}from"./alert-CVcOFuDR.js";import{jsx as v,jsxs as D}from"react/jsx-runtime";const G=C=>{const e=A(38),{className:N,error:r,testId:g}=C,w=j(),t=V();let l,s,n,i,a,c,o,m;if(e[0]!==N||e[1]!==r||e[2]!==t||e[3]!==g){const y=E(r);let b;e[12]!==r?(b=H(r),e[12]=r,e[13]=b):b=e[13],s=b;let h;e[14]!==r?(h=O(r),e[14]=r,e[15]=h):h=e[15];const k=h;let x;e[16]!==t||e[17]!==k?(x=()=>{t?.openConsole({errorsOnly:!0,seq:k})},e[16]=t,e[17]=k,e[18]=x):x=e[18],n=x,l=q,i=N,a=g,c="destructive";let p;e[19]!==r?(p=I(r),e[19]=r,e[20]=p):p=e[20],e[21]!==p?(o=v("p",{className:"font-medium",children:p}),e[21]=p,e[22]=o):o=e[22],m=y===void 0?null:v("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:$(y)}),e[0]=N,e[1]=r,e[2]=t,e[3]=g,e[4]=l,e[5]=s,e[6]=n,e[7]=i,e[8]=a,e[9]=c,e[10]=o,e[11]=m}else l=e[4],s=e[5],n=e[6],i=e[7],a=e[8],c=e[9],o=e[10],m=e[11];let u;e[23]!==s?(u=s===void 0?null:v("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:s,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[23]=s,e[24]=u):u=e[24];let d;e[25]!==t||e[26]!==n||e[27]!==w?(d=t===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:n,type:"button",children:w("Show in console")}),e[25]=t,e[26]=n,e[27]=w,e[28]=d):d=e[28];let f;return e[29]!==l||e[30]!==i||e[31]!==a||e[32]!==c||e[33]!==o||e[34]!==m||e[35]!==u||e[36]!==d?(f=D(l,{className:i,testId:a,variant:c,children:[o,m,u,d]}),e[29]=l,e[30]=i,e[31]=a,e[32]=c,e[33]=o,e[34]=m,e[35]=u,e[36]=d,e[37]=f):f=e[37],f};export{G as E};
@@ -1,6 +1,6 @@
1
- import{c as j}from"react/compiler-runtime";import{useState as H}from"react";import{ConfirmButton as Q}from"./ConfirmButton-CTL3f3kr.js";import{$ as M,_ as I,N as B,b as q,h as F,M as V,P as U,I as _}from"./dropdown-menu-C3RQ_HlW.js";import{M as W}from"./modal-shell-CUwwWC2o.js";import{useT as L}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{h as z,c as G}from"./internal-BSIsQVC6.js";import{jsx as d,jsxs as N}from"react/jsx-runtime";const T="inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",K=/["\n,]/u,P=/^[=+\-@\t\r]/u,E=t=>{if(t==null)return"";let e;return typeof t=="string"?e=P.test(t)?` ${t}`:t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?e=String(t):e=JSON.stringify(t),K.test(e)?`"${e.replaceAll('"','""')}"`:e},X=(t,e)=>{const n=t.map(o=>E(o)).join(","),a=e.map(o=>t.map(l=>E(o[l])).join(","));return[n,...a].join(`
2
- `)},Y=t=>JSON.stringify(t,null,2),D=500,J=t=>`"${t.replaceAll('"','""')}"`,Z=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("'","''")}'`,ee=(t,e,n)=>{if(e.length===0||n.length===0)return"";const a=e.map(l=>J(l)).join(", "),o=[];for(let l=0;l<n.length;l+=D){const i=n.slice(l,l+D).map(r=>` (${e.map(s=>Z(r[s])).join(", ")})`).join(`,
1
+ import{c as j}from"react/compiler-runtime";import{useState as H}from"react";import{ConfirmButton as Q}from"./ConfirmButton-CTL3f3kr.js";import{$ as M,_ as I,N as B,b as q,h as F,M as _,P as U,I as V}from"./dropdown-menu-C3RQ_HlW.js";import{M as W}from"./modal-shell-CUwwWC2o.js";import{useT as L}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{h as z,c as G,j as K}from"./internal-zkEvTqy8.js";import{jsx as d,jsxs as N}from"react/jsx-runtime";const T="inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",P=/["\n,]/u,X=/^[=+\-@\t\r]/u,E=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 n=t.map(o=>E(o)).join(","),a=e.map(o=>t.map(l=>E(o[l])).join(","));return[n,...a].join(`
2
+ `)},Z=t=>JSON.stringify(t,K,2),D=500,J=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,n)=>{if(e.length===0||n.length===0)return"";const a=e.map(l=>J(l)).join(", "),o=[];for(let l=0;l<n.length;l+=D){const i=n.slice(l,l+D).map(r=>` (${e.map(s=>ee(r[s])).join(", ")})`).join(`,
3
3
  `);o.push(`INSERT INTO ${J(t)} (${a}) VALUES
4
4
  ${i};`)}return o.join(`
5
5
 
6
- `)},A=(t,e,n)=>{if(!("document"in globalThis))return;const a=globalThis.URL.createObjectURL(new globalThis.Blob([e],{type:n})),o=globalThis.document.createElement("a");o.href=a,o.download=t,globalThis.document.body.append(o),o.click(),o.remove(),globalThis.URL.revokeObjectURL(a)},te=t=>{const e=j(36),{columns:n,name:a,rows:o}=t,l=L();let i;e[0]!==n||e[1]!==a||e[2]!==o?(i=()=>{A(`${a}.csv`,X(n,o),"text/csv;charset=utf-8")},e[0]=n,e[1]=a,e[2]=o,e[3]=i):i=e[3];const r=i;let s;e[4]!==a||e[5]!==o?(s=()=>{A(`${a}.json`,Y(o),"application/json")},e[4]=a,e[5]=o,e[6]=s):s=e[6];const m=s;let g;e[7]!==n||e[8]!==a||e[9]!==o?(g=()=>{A(`${a}.sql`,ee(a,n,o),"application/sql;charset=utf-8")},e[7]=n,e[8]=a,e[9]=o,e[10]=g):g=e[10];const c=g,b=o.length===0;let p;e[11]!==b?(p=d(M,{className:T,"data-testid":"grid-export",disabled:b,title:"Exports only the rows loaded on the current page, not the whole table",children:"Export page"}),e[11]=b,e[12]=p):p=e[12];let $;e[13]===Symbol.for("react.memo_cache_sentinel")?($=d(I,{children:"Export loaded rows"}),e[13]=$):$=e[13];let u;e[14]!==l?(u=l("CSV"),e[14]=l,e[15]=u):u=e[15];let f;e[16]!==r||e[17]!==u?(f=d(B,{"data-testid":"grid-export-csv",onClick:r,children:u}),e[16]=r,e[17]=u,e[18]=f):f=e[18];let k;e[19]!==l?(k=l("JSON"),e[19]=l,e[20]=k):k=e[20];let C;e[21]!==m||e[22]!==k?(C=d(B,{"data-testid":"grid-export-json",onClick:m,children:k}),e[21]=m,e[22]=k,e[23]=C):C=e[23];let y;e[24]!==l?(y=l("SQL"),e[24]=l,e[25]=y):y=e[25];let h;e[26]!==c||e[27]!==y?(h=d(B,{"data-testid":"grid-export-sql",onClick:c,children:y}),e[26]=c,e[27]=y,e[28]=h):h=e[28];let x;e[29]!==C||e[30]!==h||e[31]!==f?(x=N(q,{align:"end",children:[$,f,C,h]}),e[29]=C,e[30]=h,e[31]=f,e[32]=x):x=e[32];let w;return e[33]!==x||e[34]!==p?(w=N(F,{children:[p,x]}),e[33]=x,e[34]=p,e[35]=w):w=e[35],w},le=t=>{const e=j(9),{column:n}=t;let a;e[0]!==n?(a=()=>{n.toggleVisibility()},e[0]=n,e[1]=a):a=e[1];const o=a;let l;e[2]!==n?(l=n.getIsVisible(),e[2]=n,e[3]=l):l=e[3];const i=`grid-column-${n.id}`;let r;return e[4]!==n.id||e[5]!==o||e[6]!==l||e[7]!==i?(r=d(U,{checked:l,closeOnClick:!1,"data-testid":i,onCheckedChange:o,children:n.id}),e[4]=n.id,e[5]=o,e[6]=l,e[7]=i,e[8]=r):r=e[8],r},ne=[],oe=({backRelations:t=ne,enabledBackRelations:e,onToggleBackRelation:n,table:a})=>{const o=L(),l=a.getIsAllColumnsVisible(),i=()=>{a.toggleAllColumnsVisible(!l)};return N(F,{children:[d(M,{className:T,"data-testid":"grid-columns",children:o("Columns")}),N(q,{align:"end",className:"max-h-80 overflow-y-auto",children:[N(V,{children:[d(I,{children:o("Columns")}),d(U,{checked:l,closeOnClick:!1,"data-testid":"grid-columns-all",onCheckedChange:i,children:o(l?"Hide all":"Show all")}),d(_,{}),a.getAllLeafColumns().filter(r=>!r.id.startsWith("__back__:")).map(r=>d(le,{column:r},r.id))]}),t.length>0&&n!==void 0&&N(V,{children:[d(_,{}),d(I,{children:o("Related")}),t.map(r=>{const s=`${r.table}.${r.column}`;return d(U,{checked:e?.has(s)===!0,closeOnClick:!1,"data-testid":`grid-back-relation-${s}`,onCheckedChange:()=>{n(s)},children:`← ${r.table}.${r.column}`},s)})]})]})]})},ae=t=>{const e=j(19),{count:n,editable:a,onClear:o,onDelete:l}=t,i=L();let r;e[0]!==n||e[1]!==i?(r=i("{count} selected",{count:n}),e[0]=n,e[1]=i,e[2]=r):r=e[2];let s;e[3]!==r?(s=d("span",{className:"font-medium tabular-nums","data-testid":"grid-selection-count",children:r}),e[3]=r,e[4]=s):s=e[4];let m;e[5]!==i?(m=i("Clear"),e[5]=i,e[6]=m):m=e[6];let g;e[7]!==o||e[8]!==m?(g=d("button",{className:T,"data-testid":"grid-selection-clear",onClick:o,type:"button",children:m}),e[7]=o,e[8]=m,e[9]=g):g=e[9];let c;e[10]!==n||e[11]!==a||e[12]!==l||e[13]!==i?(c=a&&d(Q,{confirmLabel:i("Delete {count} rows?",{count:n}),onConfirm:l,testId:"grid-selection-delete",children:i("Delete {count}",{count:n})}),e[10]=n,e[11]=a,e[12]=l,e[13]=i,e[14]=c):c=e[14];let b;return e[15]!==s||e[16]!==g||e[17]!==c?(b=N("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:[s,g,c]}),e[15]=s,e[16]=g,e[17]=c,e[18]=b):b=e[18],b},he=t=>{const e=j(32),{column:n,onClose:a,value:o}=t,l=L(),[i,r]=H(!1);let s;e[0]!==o?(s=z(o),e[0]=o,e[1]=s):s=e[1];const m=s;let g;e[2]!==m?(g=()=>{G(m)&&r(!0)},e[2]=m,e[3]=g):g=e[3];const c=g;let b;e[4]!==l?(b=l("Cell value"),e[4]=l,e[5]=b):b=e[5];let p;e[6]!==n?(p=d("h2",{className:"truncate font-mono text-sm font-semibold text-foreground",children:n}),e[6]=n,e[7]=p):p=e[7];let $;e[8]!==i||e[9]!==l?($=l(i?"Copied":"Copy"),e[8]=i,e[9]=l,e[10]=$):$=e[10];let u;e[11]!==c||e[12]!==$?(u=d("button",{className:T,"data-testid":"grid-cell-copy",onClick:c,type:"button",children:$}),e[11]=c,e[12]=$,e[13]=u):u=e[13];let f;e[14]!==l?(f=l("Close"),e[14]=l,e[15]=f):f=e[15];let k;e[16]!==a||e[17]!==f?(k=d("button",{className:T,"data-testid":"grid-cell-close",onClick:a,type:"button",children:f}),e[16]=a,e[17]=f,e[18]=k):k=e[18];let C;e[19]!==u||e[20]!==k?(C=N("div",{className:"flex items-center gap-1.5",children:[u,k]}),e[19]=u,e[20]=k,e[21]=C):C=e[21];let y;e[22]!==p||e[23]!==C?(y=N("div",{className:"flex items-center justify-between",children:[p,C]}),e[22]=p,e[23]=C,e[24]=y):y=e[24];let h;e[25]!==m?(h=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:m}),e[25]=m,e[26]=h):h=e[26];let x;return e[27]!==a||e[28]!==y||e[29]!==h||e[30]!==b?(x=N(W,{className:"max-h-[70vh] w-[min(40rem,90vw)]",label:b,onClose:a,panelTestId:"grid-cell-dialog",testId:"grid-cell-dialog-overlay",variant:"dialog",children:[y,h]}),e[27]=a,e[28]=y,e[29]=h,e[30]=b,e[31]=x):x=e[31],x},be=t=>{const e=j(36),{backRelations:n,enabledBackRelations:a,onToggleBackRelation:o,columns:l,editable:i,name:r,onBulkDelete:s,onToggleTranspose:m,rows:g,table:c,transposed:b}=t,p=L();let $;e[0]!==c?($=c.getSelectedRowModel(),e[0]=c,e[1]=$):$=e[1];const u=$.rows;let f;e[2]!==c?(f=()=>{c.resetRowSelection()},e[2]=c,e[3]=f):f=e[3];const k=f;let C;e[4]!==s||e[5]!==u||e[6]!==c?(C=()=>{s(u.map(re)),c.resetRowSelection()},e[4]=s,e[5]=u,e[6]=c,e[7]=C):C=e[7];const y=C;let h;e[8]!==l||e[9]!==r||e[10]!==g?(h=d(te,{columns:l,name:r,rows:g}),e[8]=l,e[9]=r,e[10]=g,e[11]=h):h=e[11];let x;e[12]!==n||e[13]!==a||e[14]!==o||e[15]!==c?(x=d(oe,{backRelations:n,enabledBackRelations:a,onToggleBackRelation:o,table:c}),e[12]=n,e[13]=a,e[14]=o,e[15]=c,e[16]=x):x=e[16];let w;e[17]!==p?(w=p("Swap rows and columns"),e[17]=p,e[18]=w):w=e[18];let v;e[19]!==p?(v=p("Transpose"),e[19]=p,e[20]=v):v=e[20];let R;e[21]!==m||e[22]!==w||e[23]!==v||e[24]!==b?(R=d("button",{"aria-pressed":b,className:T,"data-testid":"grid-transpose",onClick:m,title:w,type:"button",children:v}),e[21]=m,e[22]=w,e[23]=v,e[24]=b,e[25]=R):R=e[25];let S;e[26]!==i||e[27]!==k||e[28]!==y||e[29]!==u.length?(S=u.length>0&&d(ae,{count:u.length,editable:i,onClear:k,onDelete:y}),e[26]=i,e[27]=k,e[28]=y,e[29]=u.length,e[30]=S):S=e[30];let O;return e[31]!==h||e[32]!==x||e[33]!==R||e[34]!==S?(O=N("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"grid-actions",children:[h,x,R,S]}),e[31]=h,e[32]=x,e[33]=R,e[34]=S,e[35]=O):O=e[35],O};function re(t){return t.id}export{te as K,he as i,be as r,ae as z};
6
+ `)},A=(t,e,n)=>{if(!("document"in globalThis))return;const a=globalThis.URL.createObjectURL(new globalThis.Blob([e],{type:n})),o=globalThis.document.createElement("a");o.href=a,o.download=t,globalThis.document.body.append(o),o.click(),o.remove(),globalThis.URL.revokeObjectURL(a)},le=t=>{const e=j(36),{columns:n,name:a,rows:o}=t,l=L();let i;e[0]!==n||e[1]!==a||e[2]!==o?(i=()=>{A(`${a}.csv`,Y(n,o),"text/csv;charset=utf-8")},e[0]=n,e[1]=a,e[2]=o,e[3]=i):i=e[3];const r=i;let s;e[4]!==a||e[5]!==o?(s=()=>{A(`${a}.json`,Z(o),"application/json")},e[4]=a,e[5]=o,e[6]=s):s=e[6];const m=s;let g;e[7]!==n||e[8]!==a||e[9]!==o?(g=()=>{A(`${a}.sql`,te(a,n,o),"application/sql;charset=utf-8")},e[7]=n,e[8]=a,e[9]=o,e[10]=g):g=e[10];const c=g,b=o.length===0;let p;e[11]!==b?(p=d(M,{className:T,"data-testid":"grid-export",disabled:b,title:"Exports only the rows loaded on the current page, not the whole table",children:"Export page"}),e[11]=b,e[12]=p):p=e[12];let $;e[13]===Symbol.for("react.memo_cache_sentinel")?($=d(I,{children:"Export loaded rows"}),e[13]=$):$=e[13];let u;e[14]!==l?(u=l("CSV"),e[14]=l,e[15]=u):u=e[15];let f;e[16]!==r||e[17]!==u?(f=d(B,{"data-testid":"grid-export-csv",onClick:r,children:u}),e[16]=r,e[17]=u,e[18]=f):f=e[18];let k;e[19]!==l?(k=l("JSON"),e[19]=l,e[20]=k):k=e[20];let C;e[21]!==m||e[22]!==k?(C=d(B,{"data-testid":"grid-export-json",onClick:m,children:k}),e[21]=m,e[22]=k,e[23]=C):C=e[23];let y;e[24]!==l?(y=l("SQL"),e[24]=l,e[25]=y):y=e[25];let h;e[26]!==c||e[27]!==y?(h=d(B,{"data-testid":"grid-export-sql",onClick:c,children:y}),e[26]=c,e[27]=y,e[28]=h):h=e[28];let x;e[29]!==C||e[30]!==h||e[31]!==f?(x=N(q,{align:"end",children:[$,f,C,h]}),e[29]=C,e[30]=h,e[31]=f,e[32]=x):x=e[32];let w;return e[33]!==x||e[34]!==p?(w=N(F,{children:[p,x]}),e[33]=x,e[34]=p,e[35]=w):w=e[35],w},ne=t=>{const e=j(9),{column:n}=t;let a;e[0]!==n?(a=()=>{n.toggleVisibility()},e[0]=n,e[1]=a):a=e[1];const o=a;let l;e[2]!==n?(l=n.getIsVisible(),e[2]=n,e[3]=l):l=e[3];const i=`grid-column-${n.id}`;let r;return e[4]!==n.id||e[5]!==o||e[6]!==l||e[7]!==i?(r=d(U,{checked:l,closeOnClick:!1,"data-testid":i,onCheckedChange:o,children:n.id}),e[4]=n.id,e[5]=o,e[6]=l,e[7]=i,e[8]=r):r=e[8],r},oe=[],ae=({backRelations:t=oe,enabledBackRelations:e,onToggleBackRelation:n,table:a})=>{const o=L(),l=a.getIsAllColumnsVisible(),i=()=>{a.toggleAllColumnsVisible(!l)};return N(F,{children:[d(M,{className:T,"data-testid":"grid-columns",children:o("Columns")}),N(q,{align:"end",className:"max-h-80 overflow-y-auto",children:[N(_,{children:[d(I,{children:o("Columns")}),d(U,{checked:l,closeOnClick:!1,"data-testid":"grid-columns-all",onCheckedChange:i,children:o(l?"Hide all":"Show all")}),d(V,{}),a.getAllLeafColumns().filter(r=>!r.id.startsWith("__back__:")).map(r=>d(ne,{column:r},r.id))]}),t.length>0&&n!==void 0&&N(_,{children:[d(V,{}),d(I,{children:o("Related")}),t.map(r=>{const s=`${r.table}.${r.column}`;return d(U,{checked:e?.has(s)===!0,closeOnClick:!1,"data-testid":`grid-back-relation-${s}`,onCheckedChange:()=>{n(s)},children:`← ${r.table}.${r.column}`},s)})]})]})]})},re=t=>{const e=j(19),{count:n,editable:a,onClear:o,onDelete:l}=t,i=L();let r;e[0]!==n||e[1]!==i?(r=i("{count} selected",{count:n}),e[0]=n,e[1]=i,e[2]=r):r=e[2];let s;e[3]!==r?(s=d("span",{className:"font-medium tabular-nums","data-testid":"grid-selection-count",children:r}),e[3]=r,e[4]=s):s=e[4];let m;e[5]!==i?(m=i("Clear"),e[5]=i,e[6]=m):m=e[6];let g;e[7]!==o||e[8]!==m?(g=d("button",{className:T,"data-testid":"grid-selection-clear",onClick:o,type:"button",children:m}),e[7]=o,e[8]=m,e[9]=g):g=e[9];let c;e[10]!==n||e[11]!==a||e[12]!==l||e[13]!==i?(c=a&&d(Q,{confirmLabel:i("Delete {count} rows?",{count:n}),onConfirm:l,testId:"grid-selection-delete",children:i("Delete {count}",{count:n})}),e[10]=n,e[11]=a,e[12]=l,e[13]=i,e[14]=c):c=e[14];let b;return e[15]!==s||e[16]!==g||e[17]!==c?(b=N("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:[s,g,c]}),e[15]=s,e[16]=g,e[17]=c,e[18]=b):b=e[18],b},be=t=>{const e=j(32),{column:n,onClose:a,value:o}=t,l=L(),[i,r]=H(!1);let s;e[0]!==o?(s=z(o),e[0]=o,e[1]=s):s=e[1];const m=s;let g;e[2]!==m?(g=()=>{G(m)&&r(!0)},e[2]=m,e[3]=g):g=e[3];const c=g;let b;e[4]!==l?(b=l("Cell value"),e[4]=l,e[5]=b):b=e[5];let p;e[6]!==n?(p=d("h2",{className:"truncate font-mono text-sm font-semibold text-foreground",children:n}),e[6]=n,e[7]=p):p=e[7];let $;e[8]!==i||e[9]!==l?($=l(i?"Copied":"Copy"),e[8]=i,e[9]=l,e[10]=$):$=e[10];let u;e[11]!==c||e[12]!==$?(u=d("button",{className:T,"data-testid":"grid-cell-copy",onClick:c,type:"button",children:$}),e[11]=c,e[12]=$,e[13]=u):u=e[13];let f;e[14]!==l?(f=l("Close"),e[14]=l,e[15]=f):f=e[15];let k;e[16]!==a||e[17]!==f?(k=d("button",{className:T,"data-testid":"grid-cell-close",onClick:a,type:"button",children:f}),e[16]=a,e[17]=f,e[18]=k):k=e[18];let C;e[19]!==u||e[20]!==k?(C=N("div",{className:"flex items-center gap-1.5",children:[u,k]}),e[19]=u,e[20]=k,e[21]=C):C=e[21];let y;e[22]!==p||e[23]!==C?(y=N("div",{className:"flex items-center justify-between",children:[p,C]}),e[22]=p,e[23]=C,e[24]=y):y=e[24];let h;e[25]!==m?(h=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:m}),e[25]=m,e[26]=h):h=e[26];let x;return e[27]!==a||e[28]!==y||e[29]!==h||e[30]!==b?(x=N(W,{className:"max-h-[70vh] w-[min(40rem,90vw)]",label:b,onClose:a,panelTestId:"grid-cell-dialog",testId:"grid-cell-dialog-overlay",variant:"dialog",children:[y,h]}),e[27]=a,e[28]=y,e[29]=h,e[30]=b,e[31]=x):x=e[31],x},fe=t=>{const e=j(36),{backRelations:n,enabledBackRelations:a,onToggleBackRelation:o,columns:l,editable:i,name:r,onBulkDelete:s,onToggleTranspose:m,rows:g,table:c,transposed:b}=t,p=L();let $;e[0]!==c?($=c.getSelectedRowModel(),e[0]=c,e[1]=$):$=e[1];const u=$.rows;let f;e[2]!==c?(f=()=>{c.resetRowSelection()},e[2]=c,e[3]=f):f=e[3];const k=f;let C;e[4]!==s||e[5]!==u||e[6]!==c?(C=()=>{s(u.map(ie)),c.resetRowSelection()},e[4]=s,e[5]=u,e[6]=c,e[7]=C):C=e[7];const y=C;let h;e[8]!==l||e[9]!==r||e[10]!==g?(h=d(le,{columns:l,name:r,rows:g}),e[8]=l,e[9]=r,e[10]=g,e[11]=h):h=e[11];let x;e[12]!==n||e[13]!==a||e[14]!==o||e[15]!==c?(x=d(ae,{backRelations:n,enabledBackRelations:a,onToggleBackRelation:o,table:c}),e[12]=n,e[13]=a,e[14]=o,e[15]=c,e[16]=x):x=e[16];let w;e[17]!==p?(w=p("Swap rows and columns"),e[17]=p,e[18]=w):w=e[18];let R;e[19]!==p?(R=p("Transpose"),e[19]=p,e[20]=R):R=e[20];let v;e[21]!==m||e[22]!==w||e[23]!==R||e[24]!==b?(v=d("button",{"aria-pressed":b,className:T,"data-testid":"grid-transpose",onClick:m,title:w,type:"button",children:R}),e[21]=m,e[22]=w,e[23]=R,e[24]=b,e[25]=v):v=e[25];let S;e[26]!==i||e[27]!==k||e[28]!==y||e[29]!==u.length?(S=u.length>0&&d(re,{count:u.length,editable:i,onClear:k,onDelete:y}),e[26]=i,e[27]=k,e[28]=y,e[29]=u.length,e[30]=S):S=e[30];let O;return e[31]!==h||e[32]!==x||e[33]!==v||e[34]!==S?(O=N("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"grid-actions",children:[h,x,v,S]}),e[31]=h,e[32]=x,e[33]=v,e[34]=S,e[35]=O):O=e[35],O};function ie(t){return t.id}export{le as K,fe as c,be as r,re as z};