@lunora/studio 1.0.0-alpha.221 → 1.0.0-alpha.222

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 (159) hide show
  1. package/dist/index.d.mts +11 -3
  2. package/dist/index.d.ts +11 -3
  3. package/dist/index.mjs +1 -1
  4. package/dist/mount.mjs +1 -1
  5. package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -1
  6. package/dist/packem_chunks/ApiTab.mjs +1 -1
  7. package/dist/packem_chunks/AuditPanel.mjs +1 -1
  8. package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -1
  9. package/dist/packem_chunks/ExportImportPanel.mjs +1 -1
  10. package/dist/packem_chunks/FileBrowser.mjs +1 -1
  11. package/dist/packem_chunks/FunctionRunner.mjs +1 -1
  12. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -1
  13. package/dist/packem_chunks/HealthPanel.mjs +1 -1
  14. package/dist/packem_chunks/InsightsPanel.mjs +1 -1
  15. package/dist/packem_chunks/LogsPanel.mjs +1 -1
  16. package/dist/packem_chunks/MailPanel.mjs +1 -1
  17. package/dist/packem_chunks/MetricsPanel.mjs +1 -1
  18. package/dist/packem_chunks/NotificationsPanel.mjs +1 -1
  19. package/dist/packem_chunks/PitrPanel.mjs +1 -1
  20. package/dist/packem_chunks/SchemaViewer.mjs +1 -1
  21. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -1
  22. package/dist/packem_chunks/SettingsPanel.mjs +1 -1
  23. package/dist/packem_chunks/SqlEditorPanel.mjs +1 -1
  24. package/dist/packem_chunks/TableEditor.mjs +1 -1
  25. package/dist/packem_chunks/agents-panel.mjs +1 -1
  26. package/dist/packem_chunks/analytics-panel.mjs +1 -1
  27. package/dist/packem_chunks/auth-audit-panel.mjs +1 -1
  28. package/dist/packem_chunks/auth-config-panel.mjs +1 -1
  29. package/dist/packem_chunks/auth-sessions-panel.mjs +1 -1
  30. package/dist/packem_chunks/containers-panel.mjs +1 -1
  31. package/dist/packem_chunks/dashboards-panel.mjs +1 -1
  32. package/dist/packem_chunks/evals-panel.mjs +1 -1
  33. package/dist/packem_chunks/fanout-panel.mjs +1 -1
  34. package/dist/packem_chunks/flags-panel.mjs +1 -1
  35. package/dist/packem_chunks/issues-panel.mjs +1 -1
  36. package/dist/packem_chunks/kv-browser.mjs +1 -1
  37. package/dist/packem_chunks/log-drains-panel.mjs +1 -1
  38. package/dist/packem_chunks/migrations-route.mjs +1 -1
  39. package/dist/packem_chunks/organizations-panel.mjs +1 -1
  40. package/dist/packem_chunks/payments-panel.mjs +1 -1
  41. package/dist/packem_chunks/permissions-panel.mjs +1 -1
  42. package/dist/packem_chunks/queues-panel.mjs +1 -1
  43. package/dist/packem_chunks/reactors-panel.mjs +1 -1
  44. package/dist/packem_chunks/rls-panel.mjs +1 -1
  45. package/dist/packem_chunks/schedule-panel.mjs +1 -1
  46. package/dist/packem_chunks/storage-rules-panel.mjs +1 -1
  47. package/dist/packem_chunks/subscriptions-panel.mjs +1 -1
  48. package/dist/packem_chunks/sync-client-panel.mjs +1 -1
  49. package/dist/packem_chunks/traces-panel.mjs +1 -1
  50. package/dist/packem_chunks/users-panel.mjs +1 -1
  51. package/dist/packem_chunks/vector-browser.mjs +1 -1
  52. package/dist/packem_chunks/workflows-panel.mjs +1 -1
  53. package/dist/packem_shared/{ApiDocsPanel-DzvVLAev.mjs → ApiDocsPanel-fhDlZGE4.mjs} +1 -1
  54. package/dist/packem_shared/{ApiReferencePanel--1Y4o_-l.mjs → ApiReferencePanel-CHoHM5ME.mjs} +1 -1
  55. package/dist/packem_shared/{CommandPalette-D7GxhPrH.mjs → CommandPalette-D9ZY-qQd.mjs} +1 -1
  56. package/dist/packem_shared/DataBrowser-DWSaSSRj.mjs +4 -0
  57. package/dist/packem_shared/{GlobalDataBrowser-DSexMt80.mjs → GlobalDataBrowser-CR138dEZ.mjs} +1 -1
  58. package/dist/packem_shared/{HomePanel-BkCmY0Hl.mjs → HomePanel-fJZRA0b0.mjs} +1 -1
  59. package/dist/packem_shared/{MigrationsPanel-DLQRarWw.mjs → MigrationsPanel-QjQ4Gp9s.mjs} +1 -1
  60. package/dist/packem_shared/{OpenRpcReferencePanel-a_mbqw67.mjs → OpenRpcReferencePanel-C8ctFJVm.mjs} +1 -1
  61. package/dist/packem_shared/{ScheduledJobs-DSqsMB51.mjs → ScheduledJobs-nPx7NmOE.mjs} +1 -1
  62. package/dist/packem_shared/{Studio-BE_SzY44.mjs → Studio-DQq17PO6.mjs} +1 -1
  63. package/dist/packem_shared/{StudioApp-kVjMop0V.mjs → StudioApp-DikgPBVJ.mjs} +1 -1
  64. package/dist/packem_shared/{advisor-view-DtkbHW2O.mjs → advisor-view-BzzJg9D_.mjs} +1 -1
  65. package/dist/packem_shared/{data-grid-BPu1a997.mjs → data-grid-DIiNmDR9.mjs} +1 -1
  66. package/dist/packem_shared/{error-alert-dQk3g8WI.mjs → error-alert-DueSEkt-.mjs} +1 -1
  67. package/dist/packem_shared/{grid-features-ByxOklon.mjs → grid-features-OVIMIQan.mjs} +1 -1
  68. package/dist/packem_shared/home-panel-DBSHjxil.mjs +3 -0
  69. package/dist/packem_shared/{internal-CyDwqA67.mjs → internal-Df43vQI0.mjs} +1 -1
  70. package/dist/packem_shared/{log-line-BHZD2Aj4.mjs → log-line-BHWXobrl.mjs} +1 -1
  71. package/dist/packem_shared/{recording-client-CjRFjhya.mjs → recording-client-CyFiAE2l.mjs} +1 -1
  72. package/dist/packem_shared/{reference-view-vNXUVPlA.mjs → reference-view-DSeKRrUU.mjs} +4 -4
  73. package/dist/packem_shared/{schema-diagram-DADlbs2X.mjs → schema-diagram-CQ4vn0CN.mjs} +1 -1
  74. package/dist/packem_shared/{sql-result-table-DS4o0GoC.mjs → sql-result-table-DyK762_A.mjs} +1 -1
  75. package/dist/packem_shared/studio-ajWxPNfI.mjs +2 -0
  76. package/dist/packem_shared/{table-list-sidebar-D30qERKx.mjs → table-list-sidebar-DxvakjpR.mjs} +1 -1
  77. package/dist/packem_shared/{use-admin-query-CR9mHt0P.mjs → use-admin-query-tlBof8Yg.mjs} +1 -1
  78. package/dist/packem_shared/{use-async-submit-LWIKsZ8r.mjs → use-async-submit-CZqCMTJ_.mjs} +1 -1
  79. package/dist/packem_shared/{use-auth-config-HmTOvrWd.mjs → use-auth-config-B9hH2tQa.mjs} +1 -1
  80. package/dist/packem_shared/{use-open-trace-DdGxsEB9.mjs → use-open-trace-DMVhpnyG.mjs} +1 -1
  81. package/dist/packem_shared/{use-sql-assistant-D4XQ0v0R.mjs → use-sql-assistant-pjfGp-Ol.mjs} +1 -1
  82. package/dist/standalone/{chunk-EQVY6WGK.js → chunk-2H7LJELF.js} +1 -1
  83. package/dist/standalone/{chunk-AM7VTTNL.js → chunk-2PLDVCEP.js} +1 -1
  84. package/dist/standalone/{chunk-DXT2DY4I.js → chunk-2QSGCPIS.js} +1 -1
  85. package/dist/standalone/chunk-2UECQGYG.js +1 -0
  86. package/dist/standalone/{chunk-PVNT7VXC.js → chunk-4DLM7KCA.js} +1 -1
  87. package/dist/standalone/{chunk-FCEQTBLC.js → chunk-4IX7Z3XP.js} +1 -1
  88. package/dist/standalone/{chunk-3C25RFTP.js → chunk-4RLMVWJL.js} +1 -1
  89. package/dist/standalone/{chunk-3TE3V2QL.js → chunk-4ZHQUGP5.js} +1 -1
  90. package/dist/standalone/{chunk-2HF37UQN.js → chunk-5CEDU7OP.js} +1 -1
  91. package/dist/standalone/{chunk-GGAUC5ZI.js → chunk-5JAOC6KI.js} +1 -1
  92. package/dist/standalone/{chunk-PSBP27ZK.js → chunk-6LYYH4KG.js} +1 -1
  93. package/dist/standalone/{chunk-MMMRSTCL.js → chunk-6UFH4FWY.js} +1 -1
  94. package/dist/standalone/chunk-6ZPT7CTC.js +5 -0
  95. package/dist/standalone/{chunk-PY5P53RV.js → chunk-AANB526D.js} +1 -1
  96. package/dist/standalone/{chunk-4AZDQAT2.js → chunk-ANAVNSAK.js} +1 -1
  97. package/dist/standalone/{chunk-MDUTVBJZ.js → chunk-B2HYHTIX.js} +1 -1
  98. package/dist/standalone/{chunk-KFEWMJQS.js → chunk-BF5GZZ2N.js} +1 -1
  99. package/dist/standalone/{chunk-VQM2MKYO.js → chunk-BNFLBJXF.js} +1 -1
  100. package/dist/standalone/{chunk-WINPNKYC.js → chunk-BOASUV37.js} +1 -1
  101. package/dist/standalone/{chunk-LJVH6HRQ.js → chunk-BWLFO2IE.js} +1 -1
  102. package/dist/standalone/{chunk-6HDT763N.js → chunk-C5JRZI3P.js} +1 -1
  103. package/dist/standalone/{chunk-YBCFAAQJ.js → chunk-C7JZ7GM3.js} +1 -1
  104. package/dist/standalone/{chunk-UYKO4I36.js → chunk-CFIBDQF7.js} +1 -1
  105. package/dist/standalone/{chunk-RBJMRBC3.js → chunk-D73MZIDA.js} +1 -1
  106. package/dist/standalone/{chunk-I3TUOZM3.js → chunk-DHJHD5RD.js} +1 -1
  107. package/dist/standalone/{chunk-PSPSEIFN.js → chunk-DPJRFJGG.js} +1 -1
  108. package/dist/standalone/{chunk-ZUGCPRKB.js → chunk-EBNLDFWL.js} +1 -1
  109. package/dist/standalone/{chunk-Q2F2DRGB.js → chunk-EIISOYGA.js} +1 -1
  110. package/dist/standalone/{chunk-GYKK64E7.js → chunk-EIREQDTV.js} +1 -1
  111. package/dist/standalone/{chunk-ZHM5ZHPC.js → chunk-EJSI4PMU.js} +1 -1
  112. package/dist/standalone/{chunk-2HAWCLCS.js → chunk-EUBMVV62.js} +1 -1
  113. package/dist/standalone/{chunk-V2JKX5UU.js → chunk-FRX3HV4O.js} +2 -2
  114. package/dist/standalone/{chunk-I4VOJYXE.js → chunk-FZXPE3EA.js} +1 -1
  115. package/dist/standalone/{chunk-V2LIXSFE.js → chunk-HZ23X7G4.js} +1 -1
  116. package/dist/standalone/{chunk-DX6246CW.js → chunk-IVHSLEDF.js} +1 -1
  117. package/dist/standalone/{chunk-6RNWWWLS.js → chunk-IVSO7SEU.js} +1 -1
  118. package/dist/standalone/{chunk-GL7PC32W.js → chunk-KRYLPBID.js} +1 -1
  119. package/dist/standalone/{chunk-VQTSESFP.js → chunk-LCRAEP3B.js} +1 -1
  120. package/dist/standalone/{chunk-RE4RWXYW.js → chunk-LD7EXQJA.js} +1 -1
  121. package/dist/standalone/chunk-MK64Z2KK.js +3 -0
  122. package/dist/standalone/{chunk-DKLSANZA.js → chunk-MRAMNVDG.js} +1 -1
  123. package/dist/standalone/{chunk-3ZMF2GJ5.js → chunk-MU57Q7EJ.js} +1 -1
  124. package/dist/standalone/{chunk-ZJZNCJHY.js → chunk-NFS7FTAR.js} +1 -1
  125. package/dist/standalone/{chunk-EDEQELIO.js → chunk-NGBD2OUY.js} +1 -1
  126. package/dist/standalone/{chunk-2R6ZRXPJ.js → chunk-NNOKBVJ7.js} +1 -1
  127. package/dist/standalone/{chunk-UTPXXTQ6.js → chunk-NO3SWCXH.js} +1 -1
  128. package/dist/standalone/{chunk-PIKO7SSB.js → chunk-NSTYZZ5L.js} +1 -1
  129. package/dist/standalone/{chunk-6WPU62WQ.js → chunk-NX7UAIZ2.js} +1 -1
  130. package/dist/standalone/{chunk-TZHEXHD4.js → chunk-OCZPVECA.js} +1 -1
  131. package/dist/standalone/{chunk-4P2KFEUN.js → chunk-PJZYLISI.js} +1 -1
  132. package/dist/standalone/{chunk-H4OORJHB.js → chunk-PQPPJGH4.js} +1 -1
  133. package/dist/standalone/{chunk-6CGJCPHC.js → chunk-QYCKDIIK.js} +1 -1
  134. package/dist/standalone/{chunk-JQ63BDVF.js → chunk-QZRXRMVF.js} +1 -1
  135. package/dist/standalone/{chunk-2RMFAASK.js → chunk-SQKUZR6R.js} +1 -1
  136. package/dist/standalone/{chunk-2JLOP2EL.js → chunk-SRVHSFKC.js} +1 -1
  137. package/dist/standalone/{chunk-JNDBJAO6.js → chunk-TS5SE5EM.js} +1 -1
  138. package/dist/standalone/{chunk-FS4GMDIW.js → chunk-TXJX5ASO.js} +1 -1
  139. package/dist/standalone/{chunk-J345HOFQ.js → chunk-U775EN4P.js} +1 -1
  140. package/dist/standalone/{chunk-YV6JXZJO.js → chunk-UXXDN6Z3.js} +1 -1
  141. package/dist/standalone/{chunk-RVBRSHYE.js → chunk-VWJ4BY6M.js} +1 -1
  142. package/dist/standalone/{chunk-PUBYZCHW.js → chunk-WLA5B3GY.js} +1 -1
  143. package/dist/standalone/{chunk-PAE3ULFR.js → chunk-YGZGLWD5.js} +1 -1
  144. package/dist/standalone/{chunk-6P7CYZPR.js → chunk-YHYYGVE2.js} +1 -1
  145. package/dist/standalone/{chunk-K4HVLN3Z.js → chunk-YTMEMOHR.js} +1 -1
  146. package/dist/standalone/{chunk-IJPXZZZ5.js → chunk-Z5O2NQAV.js} +1 -1
  147. package/dist/standalone/{chunk-SEBIGECV.js → chunk-ZXEE2Z4S.js} +1 -1
  148. package/dist/standalone/chunk-ZY35EIK4.js +1 -0
  149. package/dist/standalone/studio.js +1 -1
  150. package/dist/styles.css +1 -1
  151. package/package.json +5 -5
  152. package/dist/packem_shared/DataBrowser-CKbaOtDh.mjs +0 -4
  153. package/dist/packem_shared/home-panel-B_HN6YMA.mjs +0 -3
  154. package/dist/packem_shared/studio-BVQq3QLR.mjs +0 -2
  155. package/dist/standalone/chunk-3GFF4BA4.js +0 -3
  156. package/dist/standalone/chunk-FCPY75TQ.js +0 -1
  157. package/dist/standalone/chunk-HR7W3Z5I.js +0 -1
  158. package/dist/standalone/chunk-KGCUFNFC.js +0 -5
  159. /package/dist/standalone/{chunk-6B7FVPW3.js → chunk-PTZD7RUZ.js} +0 -0
@@ -1,4 +0,0 @@
1
- import{c as B}from"react/compiler-runtime";import{useLunora as at}from"@lunora/react";import{useState as D,useEffect as Be,useMemo as Tt,useRef as Ge,useCallback as lt}from"react";import{ShardInput as Bn}from"./ShardInput-C6mjgAh4.mjs";import{u as Xe}from"./use-admin-query-CR9mHt0P.mjs";import{ADMIN_FUNCTIONS as pe}from"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{b as Zt}from"./browser-storage-BH1MxLZs.mjs";import{f as Ne,i as Oe,j as en,b as Vt,c as Ee,d as Te,m as jn,h as zn}from"./internal-CyDwqA67.mjs";import{m as qn,c as tn,d as vt,a as Kn,u as wt,b as Gn,T as Jn,D as Wn}from"./table-list-sidebar-D30qERKx.mjs";import{u as Hn}from"./use-sql-assistant-D4XQ0v0R.mjs";import{d as Rt,i as nn,e as on,a as Un}from"./wire-codec-Bk4XZGE4.mjs";import{B as yt}from"./button-q0UYSmrn.mjs";import{I as Qn}from"./input-CXhxesPC.mjs";import{L as Bt}from"./label-DKFzyHq6.mjs";import{M as it}from"./modal-shell-CDztwLnv.mjs";import{useT as xe}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{jsx as d,jsxs as E,Fragment as Ze}from"react/jsx-runtime";import{ConfirmButton as jt}from"./ConfirmButton-DU4p72Er.mjs";import{E as Yn}from"./empty-state-D7jEML_T.mjs";import{C as Et,a as De}from"./control-button-BOZ5K-FC.mjs";import{tableFeatures as Xn,sortFn_text as Zn,sortFn_datetime as eo,sortFn_basic as to,sortFn_alphanumeric as no,rowSortingFeature as oo,rowSelectionFeature as so,columnVisibilityFeature as lo,columnSizingFeature as ro,columnResizingFeature as ao,columnOrderingFeature as io,createSortedRowModel as co,useTable as uo,flexRender as fo}from"@tanstack/react-table";import{useVirtualizer as mo}from"@tanstack/react-virtual";import{C as $t}from"./checkbox-CnS9cyCz.mjs";import{c as rt}from"./utils-bhneXptQ.mjs";import{f as go}from"./virtual-rect-D_j7aLxX.mjs";import{C as Ct,G as po,T as bo}from"./data-grid-BPu1a997.mjs";import{DataFilters as ho,toFilterClauses as Fe}from"./DataFilters-Cocu-WWE.mjs";import{G as xo,C as vo}from"./grid-features-ByxOklon.mjs";import{G as wo}from"./grid-pagination-DgzyzfBh.mjs";import zt from"./useDebounced-DVeQ5-oW.mjs";import{r as yo,l as Co}from"./shard-history-CaO3C4KQ.mjs";const No=s=>({tables:Object.entries(s).map(([e,n])=>({fields:n.map(o=>o.name),indexes:[],name:e,relations:n.filter(o=>o.ref!==void 0).map(o=>({field:o.name,kind:"one",name:o.name,onDelete:o.onDelete,references:o.ref,table:e}))}))}),So=s=>{const e=new Map,n=new Set;for(const o of s.tables)for(const t of o.relations){if(t.kind!=="one"||t.onDelete==="set null")continue;const c=t.references,l=`${c}\0${o.name}\0${t.field}`;if(n.has(l))continue;n.add(l);const r=e.get(c)??[];r.push({...t,table:o.name}),e.set(c,r)}return e},ko=(s,e)=>{const n=[],o=[s];for(;o.length>0;){const t=o.shift();if(t===void 0)break;e(t)&&n.push(t);for(const c of t.children)o.push(c)}return n},qt=(s,e)=>{const n=[];for(const[o,t]of Object.entries(e))for(const c of t)c.ref===s&&n.push({column:c.name,table:o});return n.sort((o,t)=>o.table.localeCompare(t.table)||o.column.localeCompare(t.column)),n},Dt=s=>`${s.table}.${s.column}`,To=s=>{const e=B(111),{columns:n,onApply:o,onClose:t,shardKey:c,table:l,total:r,uniqueColumns:a}=s,i=xe(),[m,f]=D(n[0]??""),[p,b]=D("");let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=ee=>{f(ee.target.value)},e[0]=u):u=e[0];const g=u;let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=ee=>{b(ee.target.value)},e[1]=h):h=e[1];const x=h;let v;e[2]!==p?(v=p.trim(),e[2]=p,e[3]=v):v=e[3];const y=v==="";let C,N;if(e[4]!==y||e[5]!==i||e[6]!==p){if(!y)try{N=Rt(JSON.parse(p))}catch(ee){C=i("Invalid JSON: {message}",{message:ee.message})}e[4]=y,e[5]=i,e[6]=p,e[7]=C,e[8]=N}else C=e[7],N=e[8];let k;e[9]!==m||e[10]!==r||e[11]!==a?(k=a.has(m)&&r>1,e[9]=m,e[10]=r,e[11]=a,e[12]=k):k=e[12];const S=k,w=m!==""&&!y&&C===void 0&&!S;let T;e[13]!==w||e[14]!==m||e[15]!==o||e[16]!==t||e[17]!==N?(T=()=>{w&&(o({[m]:N}),t())},e[13]=w,e[14]=m,e[15]=o,e[16]=t,e[17]=N,e[18]=T):T=e[18];const I=T;let R;e[19]!==i?(R=i("Set a column on matching rows"),e[19]=i,e[20]=R):R=e[20];let _;e[21]!==i?(_=i("Set a column on matching rows"),e[21]=i,e[22]=_):_=e[22];let $;e[23]!==_?($=d("h3",{className:"text-base text-foreground","data-testid":"bulk-patch-title",children:_}),e[23]=_,e[24]=$):$=e[24];let A;e[25]!==i||e[26]!==l||e[27]!==r?(A=i("Writes {total} rows of {table} through the schema-aware writer — validators and indexes apply, exactly like a mutation.",{table:l,total:r.toString()}),e[25]=i,e[26]=l,e[27]=r,e[28]=A):A=e[28];let M;e[29]!==A?(M=d("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-desc",children:A}),e[29]=A,e[30]=M):M=e[30];let F;e[31]!==c||e[32]!==i?(F=c===""?i("Shard: root"):i("Shard: {shardKey} — rows in other shards are not touched.",{shardKey:c}),e[31]=c,e[32]=i,e[33]=F):F=e[33];let q;e[34]!==F?(q=d("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-shard",children:F}),e[34]=F,e[35]=q):q=e[35];let G;e[36]!==M||e[37]!==q||e[38]!==$?(G=E("div",{className:"flex flex-col gap-0.5",children:[$,M,q]}),e[36]=M,e[37]=q,e[38]=$,e[39]=G):G=e[39];let O;e[40]!==i?(O=i("Close"),e[40]=i,e[41]=O):O=e[41];let V;e[42]!==t||e[43]!==O?(V=d(yt,{"data-testid":"bulk-patch-close",onClick:t,size:"xs",variant:"ghost",children:O}),e[42]=t,e[43]=O,e[44]=V):V=e[44];let J;e[45]!==G||e[46]!==V?(J=E("div",{className:"flex items-start justify-between",children:[G,V]}),e[45]=G,e[46]=V,e[47]=J):J=e[47];let j;e[48]!==i?(j=i("Column"),e[48]=i,e[49]=j):j=e[49];let Y;e[50]!==j?(Y=d(Bt,{htmlFor:"bulk-patch-column",children:j}),e[50]=j,e[51]=Y):Y=e[51];let U;e[52]!==i?(U=i("Column"),e[52]=i,e[53]=U):U=e[53];let H;e[54]!==n?(H=n.map(Eo),e[54]=n,e[55]=H):H=e[55];let te;e[56]!==m||e[57]!==U||e[58]!==H?(te=d("select",{"aria-label":U,className:"h-8 rounded-md border border-input bg-transparent px-2 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"bulk-patch-column",id:"bulk-patch-column",onChange:g,value:m,children:H}),e[56]=m,e[57]=U,e[58]=H,e[59]=te):te=e[59];let le;e[60]!==i?(le=i("Value"),e[60]=i,e[61]=le):le=e[61];let ue;e[62]!==le?(ue=d(Bt,{htmlFor:"bulk-patch-value",children:le}),e[62]=le,e[63]=ue):ue=e[63];let fe;e[64]!==p?(fe=d(Qn,{className:"flex-1 font-mono","data-testid":"bulk-patch-value",id:"bulk-patch-value",onChange:x,placeholder:"true",value:p}),e[64]=p,e[65]=fe):fe=e[65];let ge;e[66]!==Y||e[67]!==te||e[68]!==ue||e[69]!==fe?(ge=E("div",{className:"flex items-center gap-2",children:[Y,te,ue,fe]}),e[66]=Y,e[67]=te,e[68]=ue,e[69]=fe,e[70]=ge):ge=e[70];let ae;e[71]!==C?(ae=C!==void 0&&d("p",{className:"text-xs text-destructive","data-testid":"bulk-patch-error",role:"alert",children:C}),e[71]=C,e[72]=ae):ae=e[72];let me;e[73]!==m||e[74]!==i||e[75]!==r||e[76]!==S?(me=S&&d("p",{className:"text-xs text-destructive","data-testid":"bulk-patch-unique",role:"alert",children:i("{column} has a unique index — the same value cannot be set on {total} rows.",{column:m,total:r.toString()})}),e[73]=m,e[74]=i,e[75]=r,e[76]=S,e[77]=me):me=e[77];let ie;e[78]!==y||e[79]!==i||e[80]!==S?(ie=y&&!S&&d("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-hint",children:i('Enter a JSON value — for example true, 0, null, or "done".')}),e[78]=y,e[79]=i,e[80]=S,e[81]=ie):ie=e[81];let Q;e[82]!==w||e[83]!==m||e[84]!==p?(Q=w&&d("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"bulk-patch-preview",children:`${m} = ${p.trim()}`}),e[82]=w,e[83]=m,e[84]=p,e[85]=Q):Q=e[85];let be;e[86]!==i?(be=i("Cancel"),e[86]=i,e[87]=be):be=e[87];let Z;e[88]!==t||e[89]!==be?(Z=d(yt,{"data-testid":"bulk-patch-cancel",onClick:t,size:"xs",variant:"outline",children:be}),e[88]=t,e[89]=be,e[90]=Z):Z=e[90];const ve=!w;let ce;e[91]!==i||e[92]!==r?(ce=i("Set on {total} rows",{total:r.toString()}),e[91]=i,e[92]=r,e[93]=ce):ce=e[93];let de;e[94]!==I||e[95]!==ve||e[96]!==ce?(de=d(yt,{"data-testid":"bulk-patch-apply",disabled:ve,onClick:I,size:"xs",children:ce}),e[94]=I,e[95]=ve,e[96]=ce,e[97]=de):de=e[97];let W;e[98]!==Z||e[99]!==de?(W=E("div",{className:"flex justify-end gap-2",children:[Z,de]}),e[98]=Z,e[99]=de,e[100]=W):W=e[100];let K;return e[101]!==t||e[102]!==J||e[103]!==ge||e[104]!==ae||e[105]!==me||e[106]!==ie||e[107]!==Q||e[108]!==W||e[109]!==R?(K=E(it,{label:R,onClose:t,panelTestId:"bulk-patch-panel",testId:"bulk-patch-overlay",variant:"dialog",children:[J,ge,ae,me,ie,Q,W]}),e[101]=t,e[102]=J,e[103]=ge,e[104]=ae,e[105]=me,e[106]=ie,e[107]=Q,e[108]=W,e[109]=R,e[110]=K):K=e[110],K};function Eo(s){return d("option",{value:s,children:s},s)}const Kt=6,ot=100,_o=s=>({paddingLeft:s*16}),Ro=s=>{const e=B(2),{table:n}=s,o=`cascade-restrict-${n}`;let t;return e[0]!==o?(t=d("span",{className:"rounded bg-destructive/10 px-1 text-destructive","data-testid":o,children:"restrict — will block delete"}),e[0]=o,e[1]=t):t=e[1],t},$o=s=>{const e=B(2),{table:n}=s,o=`cascade-cascade-${n}`;let t;return e[0]!==o?(t=d("span",{className:"rounded bg-warning/10 px-1 text-warning","data-testid":o,children:"cascade"}),e[0]=o,e[1]=t):t=e[1],t},Do=s=>{const e=B(2),{table:n}=s,o=`cascade-undeclared-${n}`;let t;return e[0]!==o?(t=d("span",{className:"rounded bg-muted px-1 text-muted-foreground","data-testid":o,children:"references — no delete action declared"}),e[0]=o,e[1]=t):t=e[1],t},Po=s=>s.relation===void 0||s.relation.onDelete==="cascade"?d($o,{table:s.table}):s.isRestrict?d(Ro,{table:s.table}):d(Do,{table:s.table}),sn=s=>{const e=B(35),{depth:n,node:o}=s,t=`cascade-row-${o.table}`;let c;e[0]!==n?(c=_o(n),e[0]=n,e[1]=c):c=e[1];let l;e[2]!==n?(l=n>0&&d("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"└"}),e[2]=n,e[3]=l):l=e[3];let r;e[4]!==o.table?(r=d("span",{className:"font-medium text-foreground",children:o.table}),e[4]=o.table,e[5]=r):r=e[5];let a;e[6]!==o.relation||e[7]!==o.table?(a=o.relation!==void 0&&E("span",{className:"text-muted-foreground","data-testid":`cascade-col-${o.table}-${o.relation.field}`,children:["via ",o.relation.field]}),e[6]=o.relation,e[7]=o.table,e[8]=a):a=e[8];let i;e[9]!==o.rowCount?(i=o.rowCount.toString(),e[9]=o.rowCount,e[10]=i):i=e[10];let m;e[11]!==i?(m=E("span",{className:"text-muted-foreground",children:["(",i," rows)"]}),e[11]=i,e[12]=m):m=e[12];let f;e[13]!==o?(f=Po(o),e[13]=o,e[14]=f):f=e[14];let p;e[15]!==o.capNote||e[16]!==o.table?(p=o.capNote!==void 0&&E("span",{className:"italic text-muted-foreground","data-testid":`cascade-cap-${o.table}`,children:["(",o.capNote,")"]}),e[15]=o.capNote,e[16]=o.table,e[17]=p):p=e[17];let b;e[18]!==t||e[19]!==c||e[20]!==l||e[21]!==r||e[22]!==a||e[23]!==m||e[24]!==f||e[25]!==p?(b=E("li",{className:"flex flex-wrap items-center gap-1.5 py-1 font-mono text-xs","data-testid":t,style:c,children:[l,r,a,m,f,p]}),e[18]=t,e[19]=c,e[20]=l,e[21]=r,e[22]=a,e[23]=m,e[24]=f,e[25]=p,e[26]=b):b=e[26];let u;if(e[27]!==n||e[28]!==o.children){let h;e[30]!==n?(h=(x,v)=>d(sn,{depth:n+1,node:x},`${x.table}-${x.relation?.field??"root"}-${v.toString()}`),e[30]=n,e[31]=h):h=e[31],u=o.children.map(h),e[27]=n,e[28]=o.children,e[29]=u}else u=e[29];let g;return e[32]!==b||e[33]!==u?(g=E(Ze,{children:[b,u]}),e[32]=b,e[33]=u,e[34]=g):g=e[34],g},Ao=s=>{const e=s._id??s.id??s.__id__??"";return typeof e=="string"?e:typeof e=="number"?e.toString():""},Io=async(s,e,n,o)=>{try{const t=await o(s,e,n),c=t.rows.flatMap(a=>Ao(a)||[]).slice(0,ot),l=t.total??0;return{capNote:l>ot?`showing first ${ot.toString()} of ${l.toString()}`:void 0,rowCount:l,rowIds:c}}catch{return{capNote:"count unavailable",rowCount:0,rowIds:[]}}},ln=async(s,e,n,o,t,c,l)=>{const{capNote:r,rowCount:a,rowIds:i}=n===void 0?{capNote:void 0,rowCount:1,rowIds:[e]}:await Io(s,n.field,e,l),m=n?.onDelete==="restrict",f=[],p=`${s}:${e}`,b=c>=Kt;if(!t.has(p)&&!b){t.add(p);const g=o.get(s)??[];for(const h of g)for(const x of i.slice(0,10)){const v=await ln(h.table,x,h,o,t,c+1,l);(v.rowCount>0||c===0)&&f.push(v)}t.delete(p)}let u=r;if(b){const g=`depth capped at ${Kt.toString()}`;u=r===void 0?g:`${r}; ${g}`}return{capNote:u,children:f,isRestrict:m,relation:n,rowCount:a,rowIds:i,table:s}},Fo=({onClose:s,onConfirm:e,readPage:n,rowId:o,schema:t,table:c})=>{const l=xe(),[r,a]=D(!0),[i,m]=D(null),[f,p]=D(null);Be(()=>{let g=!1;return Ne((async()=>{try{a(!0),p(null);const x=So(t);if(!((x.get(c)??[]).length>0)){g||(m({capNote:void 0,children:[],isRestrict:!1,relation:void 0,rowCount:1,rowIds:[o],table:c}),a(!1));return}const y=await ln(c,o,void 0,x,new Set,0,n);g||(m(y),a(!1))}catch(x){g||(p(x.message),a(!1))}})()),()=>{g=!0}},[o,c]);const b=i!==null&&ko(i,g=>g.isRestrict).length>0,u=()=>{e(),s()};return E(it,{label:"Cascade impact preview",onClose:s,panelTestId:"cascade-panel",testId:"cascade-overlay",variant:"dialog",children:[E("div",{className:"flex items-start justify-between",children:[E("div",{className:"flex flex-col gap-0.5",children:[d("h3",{className:"text-base text-foreground","data-testid":"cascade-title",children:l("Cascade impact")}),d("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-desc",children:l("Delete preview — rows that would cascade or be blocked")})]}),d("button",{className:"text-xs text-muted-foreground hover:text-foreground","data-testid":"cascade-close",onClick:s,type:"button",children:l("Close")})]}),r&&d("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-loading",children:l("Loading…")}),f!==null&&d("p",{className:"text-xs text-destructive","data-testid":"cascade-error",role:"alert",children:f}),!r&&i!==null&&d("ul",{className:"flex flex-col","data-testid":"cascade-tree",children:d(sn,{depth:0,node:i})}),!r&&i!==null&&i.children.length===0&&d("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-no-impact",children:l("No related rows found.")}),b&&d("p",{className:"text-sm font-medium text-destructive","data-testid":"cascade-blocker-warning",role:"alert",children:l("Restrict relations will block this delete.")}),E("div",{className:"flex justify-end gap-2",children:[d("button",{className:"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","data-testid":"cascade-cancel",onClick:s,type:"button",children:l("Cancel")}),d("button",{className:"rounded-md bg-destructive px-3 py-1.5 text-xs font-medium text-destructive-foreground outline-none transition-colors hover:bg-destructive/90 focus-visible:bg-destructive/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"cascade-confirm",disabled:r,onClick:u,type:"button",children:l("Delete")})]})]})},Oo=(s,e,n,o,t=300)=>{if(o<=0)return{ids:new Set(s.map(f=>f.id)),leadPx:0,tailPx:0};const c=n-t,l=n+o+t,r=new Set;let a=0,i=0,m=0;for(const f of s){const p=f.getSize(),b=e.has(f.id),u=a+p>c&&a<l;b||u?r.add(f.id):a<c?i+=p:m+=p,a+=p}return{ids:r,leadPx:i,tailPx:m}},Mo=(s,e)=>{const n=new Map;let o=0;for(const t of s)e.has(t.id)&&(n.set(t.id,o),o+=t.getSize());return n},Lo=Xn({columnOrderingFeature:io,columnResizingFeature:ao,columnSizingFeature:ro,columnVisibilityFeature:lo,rowSelectionFeature:so,rowSortingFeature:oo,sortedRowModel:co(),sortFns:{alphanumeric:no,basic:to,datetime:eo,text:Zn}}),Vo=()=>{const s=B(12);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={},s[0]=e):e=s[0];const[n,o]=D(e);let t;s[1]===Symbol.for("react.memo_cache_sentinel")?(t=(g,h,x)=>{o(v=>({...v,[g]:{...v[g],[h]:x}}))},s[1]=t):t=s[1];const c=t;let l;s[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{o({})},s[2]=l):l=s[2];const r=l;let a;s[3]===Symbol.for("react.memo_cache_sentinel")?(a=(g,h)=>{o(x=>{const v=x[g];if(v===void 0)return x;const y=Object.fromEntries(Object.entries(v).filter(C=>{const[N,k]=C;return!(N in h)||!Object.is(k,h[N])}));return Object.keys(y).length===0?Object.fromEntries(Object.entries(x).filter(C=>{const[N]=C;return N!==g})):{...x,[g]:y}})},s[3]=a):a=s[3];const i=a;let m;s[4]!==n?(m=(g,h)=>{const x=n[g];return x!==void 0&&h in x?{value:x[h]}:void 0},s[4]=n,s[5]=m):m=s[5];const f=m;let p;s[6]!==n?(p=Object.values(n).reduce(jo,0),s[6]=n,s[7]=p):p=s[7];const b=p;let u;return s[8]!==b||s[9]!==n||s[10]!==f?(u={clear:r,count:b,drop:i,stage:c,staged:n,stagedValue:f},s[8]=b,s[9]=n,s[10]=f,s[11]=u):u=s[11],u},rn=(s,e)=>{if(typeof e=="number"){const n=Number(s);return s.trim()===""||Number.isNaN(n)?s:n}if(typeof e=="boolean"){if(s==="true")return!0;if(s==="false")return!1}return s},Bo=s=>{const e=B(29),{changes:n,committing:o,onCommit:t,onDiscard:c}=s,l=xe();let r;e[0]!==n.length||e[1]!==l?(r=l("{count} pending changes",{count:n.length}),e[0]=n.length,e[1]=l,e[2]=r):r=e[2];let a;e[3]!==r?(a=d("span",{className:"font-mono text-[11px] tracking-wide uppercase text-warning","data-testid":"db-staged-count",children:r}),e[3]=r,e[4]=a):a=e[4];let i;e[5]!==o||e[6]!==l?(i=l(o?"Committing…":"Commit"),e[5]=o,e[6]=l,e[7]=i):i=e[7];let m;e[8]!==o||e[9]!==t||e[10]!==i?(m=d("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:i}),e[8]=o,e[9]=t,e[10]=i,e[11]=m):m=e[11];let f;e[12]!==l?(f=l("Discard"),e[12]=l,e[13]=f):f=e[13];let p;e[14]!==o||e[15]!==c||e[16]!==f?(p=d("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:c,type:"button",children:f}),e[14]=o,e[15]=c,e[16]=f,e[17]=p):p=e[17];let b;e[18]!==a||e[19]!==m||e[20]!==p?(b=E("div",{className:"flex flex-wrap items-center gap-2",children:[a,m,p]}),e[18]=a,e[19]=m,e[20]=p,e[21]=b):b=e[21];let u;e[22]!==n?(u=n.map(zo),e[22]=n,e[23]=u):u=e[23];let g;e[24]!==u?(g=d("ul",{className:"flex flex-col gap-1","data-testid":"db-staged-list",children:u}),e[24]=u,e[25]=g):g=e[25];let h;return e[26]!==b||e[27]!==g?(h=E("div",{className:"flex flex-col gap-2 border border-warning/40 bg-warning/5 p-3","data-testid":"db-staged",children:[b,g]}),e[26]=b,e[27]=g,e[28]=h):h=e[28],h};function jo(s,e){return s+Object.keys(e).length}function zo(s){return E("li",{className:"flex flex-wrap items-center gap-2 font-mono text-xs",children:[E("span",{className:"text-muted-foreground",children:[s.rowId,".",s.column]}),d("span",{className:"text-destructive line-through",children:Oe(s.oldValue)}),d("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"→"}),d("span",{className:"text-foreground",children:Oe(s.newValue)})]},`${s.rowId}:${s.column}`)}const Gt=400,qo=36,Ko={flex:"1 1 0%",minHeight:0,overflow:"auto",position:"relative"},Go={width:"100%"},Jo=/\n$/u,Wo={alignItems:"center",display:"flex",left:0,position:"absolute",top:0,width:"100%"},Ho={display:"flex",width:"100%"},Jt={flex:"0 0 8.5rem",padding:"0.375rem 0.75rem"},Uo="2.5rem",an={alignItems:"center",display:"flex",flex:"0 0 2.5rem",justifyContent:"center",left:0,padding:"0.375rem 0",position:"sticky",zIndex:2},Pt=s=>({flex:"0 0 auto",overflow:"hidden",padding:"0.375rem 0.75rem",position:"relative",textOverflow:"ellipsis",whiteSpace:"nowrap",width:`${s.toString()}px`}),cn=(s,e)=>({...Pt(s),left:`calc(${Uo} + ${e.toString()}px)`,position:"sticky",zIndex:2}),Nt="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",Qo=(s,e,n)=>e.enabled&&e.columns.has(n)?void 0:s,_t="__back__:",Yo=s=>`${_t}${s.table}.${s.column}`,Xo=s=>{const e=B(3),{counts:n,rowId:o}=s;if(n===void 0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=d("span",{className:"text-muted-foreground/50",children:"—"}),e[0]=l):l=e[0],l}const t=n[o]??0;let c;return e[1]!==t?(c=d("span",{className:"tabular-nums",children:t}),e[1]=t,e[2]=c):c=e[2],c},Pe=s=>{for(const e of["id","__id__","_id"]){const n=s[e];if(typeof n=="string"||typeof n=="number")return String(n)}return null},Zo=(s,e)=>{if(e.enumValues!==void 0&&e.enumValues.length>0)return e.enumValues.includes(s)||s===""&&e.nullable===!0?{value:s===""?null:s}:void 0;if(e.type==="boolean")return s==="true"||s==="false"?{value:s==="true"}:void 0;if(e.type==="number"){const n=Number(s);return s.trim()===""||!Number.isFinite(n)?void 0:{value:n}}return{value:s}},es=(s,e,n)=>{if(n!==void 0&&n.type!=="any")return Zo(s,n);const o=rn(s,e);return typeof e=="number"&&typeof o!="number"?void 0:{value:o}},ts=({anchor:s,columnIds:e,columnMeta:n,editableColumn:o,rows:t,text:c})=>{const l=c.replaceAll(`\r
2
- `,`
3
- `).replace(Jo,"").split(`
4
- `),r=[];let a=0;for(const[i,m]of l.entries()){const f=t[s.row+i],p=f===void 0?null:Pe(f),b=m.split(" ");if(f===void 0||p===null){a+=b.length;continue}for(const[u,g]of b.entries()){const h=e[s.col+u],x=h===void 0||!o(h)?void 0:es(g,f[h],n?.[h]);h===void 0||x===void 0?a+=1:r.push({column:h,rowId:p,value:x.value})}}return{edits:r,skipped:a}},dn=(s,e)=>Pe(s)??`row-${e.toString()}`,ns=8,os=s=>{const e=B(17),{anchor:n,mask:o,state:t}=s,c=xe();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 r=l;let a;if(t==="loading"){let m;e[3]!==c?(m=c("Loading…"),e[3]=c,e[4]=m):m=e[4];let f;e[5]!==m?(f=d("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:m}),e[5]=m,e[6]=f):f=e[6],a=f}else if(t.row===null){let m;e[7]!==c?(m=c("No matching row."),e[7]=c,e[8]=m):m=e[8];let f;e[9]!==m?(f=d("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:m}),e[9]=m,e[10]=f):f=e[10],a=f}else{let m;if(e[11]!==o||e[12]!==t.row){const f=Object.entries(tn(t.row,o)).slice(0,ns);m=d("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 px-3 py-2",children:f.map(ps)}),e[11]=o,e[12]=t.row,e[13]=m}else m=e[13];a=m}let i;return e[14]!==a||e[15]!==r?(i=d("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:r,children:a}),e[14]=a,e[15]=r,e[16]=i):i=e[16],i},ss=s=>{const e=B(24),{column:n,id:o,maskViewFor:t,onNavigate:c,onPreview:l,target:r}=s,[a,i]=D(null),[m,f]=D("idle");let p;e[0]!==o||e[1]!==c||e[2]!==r?(p=()=>{c(r,o)},e[0]=o,e[1]=c,e[2]=r,e[3]=p):p=e[3];const b=p;let u;e[4]!==o||e[5]!==l||e[6]!==m||e[7]!==r?(u=S=>{const w=S.currentTarget.getBoundingClientRect();if(i({left:w.left,top:w.bottom+4}),m!=="idle")return;f("loading"),Ne((async()=>{try{f({row:await l(r,o)})}catch{f({row:null})}})())},e[4]=o,e[5]=l,e[6]=m,e[7]=r,e[8]=u):u=e[8];const g=u;let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{i(null)},e[9]=h):h=e[9];const x=h,v=`db-ref-${n}`,y=`Open ${r} ${o}`;let C;e[10]!==o||e[11]!==b||e[12]!==g||e[13]!==v||e[14]!==y?(C=E("button",{"data-testid":v,onBlur:x,onClick:b,onFocus:g,onMouseEnter:g,onMouseLeave:x,title:y,type:"button",children:[o," ↗"]}),e[10]=o,e[11]=b,e[12]=g,e[13]=v,e[14]=y,e[15]=C):C=e[15];let N;e[16]!==a||e[17]!==t||e[18]!==m||e[19]!==r?(N=a!==null&&m!=="idle"&&d(os,{anchor:a,mask:t(r,m==="loading"||m.row===null?[]:Object.keys(m.row)),state:m}),e[16]=a,e[17]=t,e[18]=m,e[19]=r,e[20]=N):N=e[20];let k;return e[21]!==C||e[22]!==N?(k=E(Ze,{children:[C,N]}),e[21]=C,e[22]=N,e[23]=k):k=e[23],k},ls=s=>s==="asc"?" ▲":s==="desc"?" ▼":"",rs="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",Wt=s=>{const e=B(8),{column:n,onExpand:o,value:t}=s;let c;e[0]!==n||e[1]!==o||e[2]!==t?(c=()=>{o(n,t)},e[0]=n,e[1]=o,e[2]=t,e[3]=c):c=e[3];const l=c,r=`db-expand-${n}`;let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=d("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:d("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]=a):a=e[4];let i;return e[5]!==l||e[6]!==r?(i=d("button",{"aria-label":"Expand cell",className:rs,"data-testid":r,onClick:l,type:"button",children:a}),e[5]=l,e[6]=r,e[7]=i):i=e[7],i},as=s=>{const e=B(15),{column:n,initial:o,onCancel:t,onCommit:c,recordId:l}=s,r=Ge(null);let a,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{r.current?.select()},i=[],e[0]=a,e[1]=i):(a=e[0],i=e[1]),Be(a,i);let m;e[2]!==t||e[3]!==c?(m=x=>{x.key==="Enter"?(x.preventDefault(),c(x.currentTarget.value)):x.key==="Escape"&&(x.preventDefault(),t())},e[2]=t,e[3]=c,e[4]=m):m=e[4];const f=m;let p;e[5]!==c?(p=x=>{c(x.currentTarget.value)},e[5]=c,e[6]=p):p=e[6];const b=p,u=`db-cell-input-${l}-${n}`;let g;e[7]!==o?(g=Oe(o),e[7]=o,e[8]=g):g=e[8];let h;return e[9]!==n||e[10]!==b||e[11]!==f||e[12]!==u||e[13]!==g?(h=d("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":u,defaultValue:g,onBlur:b,onKeyDown:f,ref:r}),e[9]=n,e[10]=b,e[11]=f,e[12]=u,e[13]=g,e[14]=h):h=e[14],h},is=s=>{const e=B(70),{cell:n,edit:o,highlight:t,mask:c,refs:l}=s,r=n.column.id;let a,i,m,f;if(e[0]!==n||e[1]!==r||e[2]!==o||e[3]!==c||e[4]!==l.columns||e[5]!==l.maskViewFor||e[6]!==l.onNavigate||e[7]!==l.onPreview){f=Symbol.for("react.early_return_sentinel");e:{i=n.getValue(),a=Pe(n.row.original);const R=l.columns?.[r];if(c.enabled&&c.columns.has(r)){const _=`db-masked-${r}`,$=d(Ct,{value:qn(i,r,c)});let A;e[12]!==_||e[13]!==$?(A=d("span",{className:"text-muted-foreground italic","data-testid":_,title:"Masked (preview)",children:$}),e[12]=_,e[13]=$,e[14]=A):A=e[14],f=A;break e}if(R!==void 0&&(typeof i=="string"||typeof i=="number")&&String(i)!==""){const _=String(i),$=`${R}:${String(i)}`;let A;e[15]!==r||e[16]!==l.maskViewFor||e[17]!==l.onNavigate||e[18]!==l.onPreview||e[19]!==_||e[20]!==$||e[21]!==R?(A=d(ss,{column:r,id:_,maskViewFor:l.maskViewFor,onNavigate:l.onNavigate,onPreview:l.onPreview,target:R},$),e[15]=r,e[16]=l.maskViewFor,e[17]=l.onNavigate,e[18]=l.onPreview,e[19]=_,e[20]=$,e[21]=R,e[22]=A):A=e[22],f=A;break e}if(a===null){let _;e[23]!==i?(_=d(Ct,{value:i}),e[23]=i,e[24]=_):_=e[24];let $;e[25]!==r||e[26]!==o.onExpandCell||e[27]!==i?($=d(Wt,{column:r,onExpand:o.onExpandCell,value:i}),e[25]=r,e[26]=o.onExpandCell,e[27]=i,e[28]=$):$=e[28];let A;e[29]!==_||e[30]!==$?(A=E(Ze,{children:[_,$]}),e[29]=_,e[30]=$,e[31]=A):A=e[31],f=A;break e}m=o.stagedValue(a,r)}e[0]=n,e[1]=r,e[2]=o,e[3]=c,e[4]=l.columns,e[5]=l.maskViewFor,e[6]=l.onNavigate,e[7]=l.onPreview,e[8]=a,e[9]=i,e[10]=m,e[11]=f}else a=e[8],i=e[9],m=e[10],f=e[11];if(f!==Symbol.for("react.early_return_sentinel"))return f;const p=m,b=p===void 0?i:p.value;let u;e[32]!==r||e[33]!==o?(u=o.editable&&o.editableColumn(r),e[32]=r,e[33]=o,e[34]=u):u=e[34];const g=u;if(o.editingCell!==null&&o.editingCell.rowId===a&&o.editingCell.column===r){let R;e[35]!==r||e[36]!==o||e[37]!==a||e[38]!==i?(R=$=>{o.stage(a,r,rn($,i)),o.cancelEdit()},e[35]=r,e[36]=o,e[37]=a,e[38]=i,e[39]=R):R=e[39];let _;return e[40]!==r||e[41]!==b||e[42]!==o.cancelEdit||e[43]!==a||e[44]!==R?(_=d(as,{column:r,initial:b,onCancel:o.cancelEdit,onCommit:R,recordId:a}),e[40]=r,e[41]=b,e[42]=o.cancelEdit,e[43]=a,e[44]=R,e[45]=_):_=e[45],_}let x;p!==void 0?x="rounded bg-warning/15 px-1":g&&(x="cursor-text");let v;e[46]!==g||e[47]!==r||e[48]!==o||e[49]!==a?(v=g?()=>{o.startEdit(a,r)}:void 0,e[46]=g,e[47]=r,e[48]=o,e[49]=a,e[50]=v):v=e[50];const y=v,C=x,N=`db-cell-${a}-${r}`;let k;e[51]!==r||e[52]!==t||e[53]!==c?(k=Qo(t,c,r),e[51]=r,e[52]=t,e[53]=c,e[54]=k):k=e[54];let S;e[55]!==b||e[56]!==k?(S=d(Ct,{highlight:k,value:b}),e[55]=b,e[56]=k,e[57]=S):S=e[57];let w;e[58]!==x||e[59]!==y||e[60]!==N||e[61]!==S?(w=d("span",{className:C,"data-testid":N,onDoubleClick:y,children:S}),e[58]=x,e[59]=y,e[60]=N,e[61]=S,e[62]=w):w=e[62];let T;e[63]!==r||e[64]!==b||e[65]!==o.onExpandCell?(T=d(Wt,{column:r,onExpand:o.onExpandCell,value:b}),e[63]=r,e[64]=b,e[65]=o.onExpandCell,e[66]=T):T=e[66];let I;return e[67]!==T||e[68]!==w?(I=E(Ze,{children:[w,T]}),e[67]=T,e[68]=w,e[69]=I):I=e[69],I},cs=s=>{s.preventDefault()},Ht={any:"?",array:"[]",bigint:"#",boolean:"01",bytes:"0x",id:"→",number:"#",object:"{}",storage:"◫",string:"T",union:"|"},ds=({declaredType:s,draggedRef:e,header:n,masked:o=!1,onTogglePin:t,pinnedOffset:c,table:l})=>{const r=()=>{e.current=n.column.id},a=()=>{const i=e.current,m=n.column.id;if(e.current=null,i===null||i===m)return;const f=l.atoms.columnOrder.get(),b=(f.length>0?f:l.getAllLeafColumns().map(g=>g.id)).filter(g=>g!==i),u=b.indexOf(m);b.splice(u===-1?b.length:u,0,i),l.setColumnOrder(b)};return E("th",{className:rt("group/head text-start text-xs font-medium text-muted-foreground",c!==void 0&&"border-e border-border bg-muted"),"data-testid":`db-head-${n.column.id}`,draggable:!0,onDragOver:cs,onDragStart:r,onDrop:a,style:c===void 0?Pt(n.getSize()):cn(n.getSize(),c),children:[E("button",{className:"inline-flex max-w-full cursor-grab items-center gap-1 truncate outline-none hover:text-foreground","data-testid":`db-sort-${n.column.id}`,onClick:n.column.getToggleSortingHandler(),type:"button",children:[fo(n.column.columnDef.header,n.getContext()),ls(n.column.getIsSorted())]}),s!==void 0&&Ht[s]!==void 0&&d("span",{className:"ms-1 font-mono text-[0.625rem] text-muted-foreground/70","data-testid":`db-type-${n.column.id}`,title:s,children:Ht[s]}),o&&d("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-${n.column.id}`,title:"This column is masked by a mask() policy",children:"masked"}),d("button",{"aria-label":c===void 0?`Pin ${n.column.id}`:`Unpin ${n.column.id}`,"aria-pressed":c!==void 0,className:rt("ms-1 rounded-sm px-1 text-[0.625rem] outline-none transition-opacity hover:bg-accent focus-visible:bg-accent",c===void 0?"opacity-0 group-hover/head:opacity-100 focus-visible:opacity-100":"opacity-100 text-foreground"),"data-testid":`db-pin-${n.column.id}`,onClick:()=>{t(n.column.id)},type:"button",children:"📌"}),d("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":n.column.getIsResizing(),"data-testid":`db-resize-${n.column.id}`,onMouseDown:n.getResizeHandler(),onTouchStart:n.getResizeHandler()})]})},us=s=>{const e=B(13),{table:n}=s,o=xe();let t;e[0]!==n?(t=m=>{n.toggleAllRowsSelected(m)},e[0]=n,e[1]=t):t=e[1];const c=t;let l;e[2]!==o?(l=o("Select all rows"),e[2]=o,e[3]=l):l=e[3];let r;e[4]!==n?(r=n.getIsAllRowsSelected(),e[4]=n,e[5]=r):r=e[5];let a;e[6]!==n?(a=n.getIsSomeRowsSelected()&&!n.getIsAllRowsSelected(),e[6]=n,e[7]=a):a=e[7];let i;return e[8]!==c||e[9]!==l||e[10]!==r||e[11]!==a?(i=d("th",{className:"bg-muted",style:an,children:d($t,{"aria-label":l,checked:r,"data-testid":"db-select-all",indeterminate:a,onCheckedChange:c})}),e[8]=c,e[9]=l,e[10]=r,e[11]=a,e[12]=i):i=e[12],i},fs=s=>{const e=B(17),{row:n}=s,o=xe();let t;e[0]!==n.original?(t=Pe(n.original),e[0]=n.original,e[1]=t):t=e[1];const c=t;let l;e[2]!==n?(l=u=>{n.toggleSelected(u)},e[2]=n,e[3]=l):l=e[3];const r=l;let a;e[4]!==o?(a=o("Select row"),e[4]=o,e[5]=a):a=e[5];let i;e[6]!==n?(i=n.getIsSelected(),e[6]=n,e[7]=i):i=e[7];let m;e[8]!==n.index||e[9]!==n.original?(m=dn(n.original,n.index),e[8]=n.index,e[9]=n.original,e[10]=m):m=e[10];const f=`db-select-${m}`,p=c===null;let b;return e[11]!==r||e[12]!==a||e[13]!==i||e[14]!==f||e[15]!==p?(b=d("td",{className:"bg-background",style:an,children:d($t,{"aria-label":a,checked:i,"data-testid":f,disabled:p,onCheckedChange:r})}),e[11]=r,e[12]=a,e[13]=i,e[14]=f,e[15]=p,e[16]=b):b=e[16],b},ms=s=>{const e=B(91),{columnMeta:n,edit:o,editable:t,mask:c,onDelete:l,onEdit:r,onInspect:a,highlight:i,backRelationCounts:m,onTogglePin:f,pinnedColumns:p,refs:b,tableModel:u}=s,g=xe(),{attachScroll:h,scrollLeft:x,scrollToIndex:v,table:y,tableRows:C,tbodyStyle:N,viewportWidth:k,virtualRows:S}=u,w=Ge(null),[T,I]=D(null);let R;e[0]===Symbol.for("react.memo_cache_sentinel")?(R={columns:"",count:0},e[0]=R):R=e[0];const[_,$]=D(R);let A;e[1]!==y?(A=y.getVisibleLeafColumns(),e[1]=y,e[2]=A):A=e[2];const M=A.length;let F;e[3]!==T||e[4]!==M||e[5]!==o||e[6]!==y||e[7]!==C?(F=ee=>{if(!["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter"].includes(ee.key))return;ee.preventDefault();const X=T??{col:0,row:0};if(ee.key==="Enter"){const we=C[X.row],ye=y.getVisibleLeafColumns()[X.col];if(we!==void 0&&ye!==void 0){const ne=Pe(we.original);ne!==null&&o.editableColumn(ye.id)&&o.startEdit(ne,ye.id)}I(X);return}let{col:he,row:re}=X;e:switch(ee.key){case"ArrowDown":{re=Math.min(re+1,C.length-1);break e}case"ArrowRight":{he=Math.min(he+1,M-1);break e}case"ArrowUp":{re=Math.max(re-1,0);break e}default:he=Math.max(he-1,0)}I({col:he,row:re})},e[3]=T,e[4]=M,e[5]=o,e[6]=y,e[7]=C,e[8]=F):F=e[8];const q=F;let G;e[9]!==T||e[10]!==n||e[11]!==o||e[12]!==y||e[13]!==C?(G=ee=>{const X=o.editable?ee.clipboardData.getData("text/plain"):"";if(X==="")return;ee.preventDefault();const he=y.getVisibleLeafColumns().map(bs),re=ts({anchor:T??{col:0,row:0},columnIds:he,columnMeta:n,editableColumn:o.editableColumn,rows:C.map(hs),text:X});for(const we of re.edits)o.stage(we.rowId,we.column,we.value);$({columns:he.join("\0"),count:re.skipped})},e[9]=T,e[10]=n,e[11]=o,e[12]=y,e[13]=C,e[14]=G):G=e[14];const O=G;let V,J;e[15]!==T||e[16]!==v?(V=()=>{T!==null&&v(T.row)},J=[T,v],e[15]=T,e[16]=v,e[17]=V,e[18]=J):(V=e[17],J=e[18]),Be(V,J);let j,Y,U,H,te,le,ue,fe,ge,ae,me,ie,Q,be,Z,ve;if(e[19]!==T||e[20]!==h||e[21]!==m||e[22]!==n||e[23]!==o||e[24]!==t||e[25]!==i||e[26]!==c||e[27]!==l||e[28]!==r||e[29]!==q||e[30]!==O||e[31]!==a||e[32]!==f||e[33]!==_.columns||e[34]!==_.count||e[35]!==p||e[36]!==b||e[37]!==x||e[38]!==g||e[39]!==y||e[40]!==C||e[41]!==N||e[42]!==k||e[43]!==S){const ee=y.getVisibleLeafColumns().map(xs),X=Oo(ee,p,x,k),he=Mo(y.getVisibleLeafColumns().map(vs),p),re=ne=>{const Me=C[ne.index],{original:Ce}=Me,oe=Pe(Ce),Ae=dn(Ce,ne.index),We={...Wo,height:`${ne.size.toString()}px`,transform:`translateY(${ne.start.toString()}px)`};return E("tr",{className:"border-b border-border text-xs transition-colors hover:bg-muted/50","data-testid":"db-row",style:We,children:[d(fs,{row:Me}),X.leadPx>0&&d("td",{"aria-hidden":"true",style:{flex:`0 0 ${X.leadPx.toString()}px`}}),Me.getVisibleCells().map((ke,ze)=>{if(!X.ids.has(ke.column.id))return null;const je=he.get(ke.column.id),He=T!==null&&T.row===ne.index&&T.col===ze?" ring-1 ring-ring ring-inset":"";return d("td",{className:rt("group/cell truncate font-mono text-muted-foreground",je!==void 0&&"border-e border-border bg-background",He),onPointerDown:()=>{I({col:ze,row:ne.index})},style:je===void 0?Pt(ke.column.getSize()):cn(ke.column.getSize(),je),children:ke.column.id.startsWith(_t)?d(Xo,{counts:m[ke.column.id.slice(_t.length)],rowId:Ae}):d(is,{cell:ke,edit:o,highlight:i,mask:c,refs:b})},ke.id)}),X.tailPx>0&&d("td",{"aria-hidden":"true",style:{flex:`0 0 ${X.tailPx.toString()}px`}}),E("td",{className:"flex items-center gap-1",style:Jt,children:[d("button",{className:Nt,"data-testid":`db-inspect-${Ae}`,onClick:()=>{a(Ce)},type:"button",children:"Details"}),t&&E(Ze,{children:[d("button",{className:Nt,"data-testid":`db-edit-${Ae}`,disabled:oe===null,onClick:()=>{r(oe,Ce)},type:"button",children:"Edit"}),d("button",{className:Nt,"data-testid":`db-delete-${Ae}`,disabled:oe===null,onClick:()=>{l(oe)},type:"button",children:"Delete"})]})]})]},Me.id)};j=po,ie="fill",e[60]!==_.columns||e[61]!==_.count||e[62]!==g||e[63]!==y?(Q=_.count>0&&_.columns===y.getVisibleLeafColumns().map(ws).join("\0")&&d("p",{className:"border-b border-warning/40 bg-warning/5 px-3 py-1.5 text-xs text-warning","data-testid":"db-paste-skipped",children:g("{count} pasted cells were skipped",{count:_.count})}),e[60]=_.columns,e[61]=_.count,e[62]=g,e[63]=y,e[64]=Q):Q=e[64],te="db-scroll",le=q,ue=O,fe=h,ge="grid",ae=Ko,me=0,ve="w-full text-xs",Y="db-rows",U=Go;let we;e[65]!==y?(we=d(us,{table:y}),e[65]=y,e[66]=we):we=e[66];let ye;e[67]===Symbol.for("react.memo_cache_sentinel")?(ye=d("th",{"aria-label":"Row actions",style:Jt}),e[67]=ye):ye=e[67],H=d("thead",{className:"bg-muted/50",children:E("tr",{className:"border-b border-border",style:Ho,children:[we,X.leadPx>0&&d("th",{"aria-hidden":"true",style:{flex:`0 0 ${X.leadPx.toString()}px`}}),y.getFlatHeaders().map(ne=>X.ids.has(ne.column.id)?d(ds,{declaredType:n?.[ne.column.id]?.type,draggedRef:w,header:ne,masked:c.columns.has(ne.column.id),onTogglePin:f,pinnedOffset:he.get(ne.column.id),table:y},ne.id):null),X.tailPx>0&&d("th",{"aria-hidden":"true",style:{flex:`0 0 ${X.tailPx.toString()}px`}}),ye]})}),be=N,Z=S.map(ne=>re(ne)),e[19]=T,e[20]=h,e[21]=m,e[22]=n,e[23]=o,e[24]=t,e[25]=i,e[26]=c,e[27]=l,e[28]=r,e[29]=q,e[30]=O,e[31]=a,e[32]=f,e[33]=_.columns,e[34]=_.count,e[35]=p,e[36]=b,e[37]=x,e[38]=g,e[39]=y,e[40]=C,e[41]=N,e[42]=k,e[43]=S,e[44]=j,e[45]=Y,e[46]=U,e[47]=H,e[48]=te,e[49]=le,e[50]=ue,e[51]=fe,e[52]=ge,e[53]=ae,e[54]=me,e[55]=ie,e[56]=Q,e[57]=be,e[58]=Z,e[59]=ve}else j=e[44],Y=e[45],U=e[46],H=e[47],te=e[48],le=e[49],ue=e[50],fe=e[51],ge=e[52],ae=e[53],me=e[54],ie=e[55],Q=e[56],be=e[57],Z=e[58],ve=e[59];let ce;e[68]!==be||e[69]!==Z?(ce=d("tbody",{style:be,children:Z}),e[68]=be,e[69]=Z,e[70]=ce):ce=e[70];let de;e[71]!==Y||e[72]!==U||e[73]!==H||e[74]!==ce||e[75]!==ve?(de=E("table",{className:ve,"data-testid":Y,style:U,children:[H,ce]}),e[71]=Y,e[72]=U,e[73]=H,e[74]=ce,e[75]=ve,e[76]=de):de=e[76];let W;e[77]!==te||e[78]!==le||e[79]!==ue||e[80]!==fe||e[81]!==ge||e[82]!==ae||e[83]!==me||e[84]!==de?(W=d("div",{"data-testid":te,onKeyDown:le,onPaste:ue,ref:fe,role:ge,style:ae,tabIndex:me,children:de}),e[77]=te,e[78]=le,e[79]=ue,e[80]=fe,e[81]=ge,e[82]=ae,e[83]=me,e[84]=de,e[85]=W):W=e[85];let K;return e[86]!==j||e[87]!==ie||e[88]!==Q||e[89]!==W?(K=E(j,{layout:ie,children:[Q,W]}),e[86]=j,e[87]=ie,e[88]=Q,e[89]=W,e[90]=K):K=e[90],K},gs=(s,e,n,o=[])=>{const t=s?.columns,c=s?.rows,l=s?.refs,r=Tt(()=>{if(t===void 0)return[];const w=t.map(T=>({accessorFn:I=>I[T],header:l?.[T]===void 0?T:`${T} →`,id:T}));for(const T of o)w.push({accessorFn:()=>{},enableSorting:!1,header:`← ${T.table}`,id:Yo(T)});return w},[o,t,l]),a=Tt(()=>c??[],[c]),[i,m]=D({}),[f,p]=D({}),b=uo({columnResizeMode:"onChange",columns:r,data:a,defaultColumn:{minSize:80,size:200},enableColumnResizing:!0,enableRowSelection:w=>Pe(w.original)!==null,features:Lo,getRowId:(w,T)=>Pe(w)??`row-${T.toString()}`,manualSorting:!0,onColumnVisibilityChange:p,onRowSelectionChange:m,onSortingChange:n,state:{columnVisibility:f,rowSelection:i,sorting:e}}),u=b.getRowModel().rows,g=Ge(null),h=mo({count:u.length,estimateSize:()=>qo,getScrollElement:()=>g.current,initialRect:{height:Gt,width:0},observeElementRect:(w,T)=>go(w,T,Gt),overscan:8}),x=lt(w=>{h.scrollToIndex(w)},[h]),[v,y]=D({left:0,width:0}),C=lt(w=>{if(g.current=w,w===null)return;const T=()=>{y(R=>R.left===w.scrollLeft&&R.width===w.clientWidth?R:{left:w.scrollLeft,width:w.clientWidth})};w.addEventListener("scroll",T,{passive:!0});const I=new ResizeObserver(T);return I.observe(w),()=>{w.removeEventListener("scroll",T),I.disconnect(),g.current=null}},[]),N=h.getVirtualItems(),S={display:"block",height:`${h.getTotalSize().toString()}px`,position:"relative"};return{attachScroll:C,scrollLeft:v.left,scrollToIndex:x,table:b,tableRows:u,tbodyStyle:S,viewportWidth:v.width,virtualRows:N}};function ps(s){const[e,n]=s;return E("div",{className:"contents",children:[d("dt",{className:"truncate font-mono text-[11px] text-muted-foreground",children:e}),d("dd",{className:"truncate font-mono text-[11px] text-foreground",title:Oe(n),children:Oe(n)})]},e)}function bs(s){return s.id}function hs(s){return s.original}function xs(s){return{getSize:()=>s.getSize(),id:s.id}}function vs(s){return{getSize:()=>s.getSize(),id:s.id}}function ws(s){return s.id}const ys=s=>{const e=B(22),{onCommit:n}=s,o=xe(),[t,c]=D(""),l=Ge(null);let r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{l.current?.focus()},a=[],e[0]=r,e[1]=a):(r=e[0],a=e[1]),Be(r,a);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=y=>{c(y.target.value)},e[2]=i):i=e[2];const m=i;let f;e[3]!==t||e[4]!==n?(f=()=>{const y=t.trim();y!==""&&n(y)},e[3]=t,e[4]=n,e[5]=f):f=e[5];const p=f;let b;e[6]!==o?(b=o("Query name"),e[6]=o,e[7]=b):b=e[7];let u;e[8]!==o?(u=o("Query name"),e[8]=o,e[9]=u):u=e[9];let g;e[10]!==t||e[11]!==b||e[12]!==u?(g=d("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:m,placeholder:u,ref:l,value:t}),e[10]=t,e[11]=b,e[12]=u,e[13]=g):g=e[13];let h;e[14]!==o?(h=o("Save"),e[14]=o,e[15]=h):h=e[15];let x;e[16]!==p||e[17]!==h?(x=d("button",{className:Et,"data-testid":"db-save-query-confirm",onClick:p,type:"button",children:h}),e[16]=p,e[17]=h,e[18]=x):x=e[18];let v;return e[19]!==g||e[20]!==x?(v=E("span",{className:"inline-flex items-center gap-1",children:[g,x]}),e[19]=g,e[20]=x,e[21]=v):v=e[21],v},Cs=s=>{const e=B(27),{onApply:n,onCopyLink:o,onDelete:t,onSave:c,saved:l}=s,r=xe(),[a,i]=D(!1);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=()=>{i(!0)},e[0]=m):m=e[0];const f=m;let p;e[1]!==c?(p=S=>{c(S),i(!1)},e[1]=c,e[2]=p):p=e[2];const b=p;let u;e[3]!==n||e[4]!==l?(u=S=>{const w=l[Number(S.currentTarget.dataset.index)];w!==void 0&&n(w)},e[3]=n,e[4]=l,e[5]=u):u=e[5];const g=u;let h;e[6]!==t||e[7]!==l?(h=S=>{const w=l[Number(S.currentTarget.dataset.index)];w!==void 0&&t(w.name)},e[6]=t,e[7]=l,e[8]=h):h=e[8];const x=h;let v;e[9]!==r?(v=r("Copy link"),e[9]=r,e[10]=v):v=e[10];let y;e[11]!==o||e[12]!==v?(y=d("button",{className:Et,"data-testid":"db-copy-link",onClick:o,type:"button",children:v}),e[11]=o,e[12]=v,e[13]=y):y=e[13];let C;e[14]!==b||e[15]!==a||e[16]!==r?(C=a?d(ys,{onCommit:b}):d("button",{className:Et,"data-testid":"db-save-query",onClick:f,type:"button",children:r("Save query")}),e[14]=b,e[15]=a,e[16]=r,e[17]=C):C=e[17];let N;e[18]!==g||e[19]!==x||e[20]!==l||e[21]!==r?(N=l.length>0&&E("div",{className:"flex flex-wrap items-center gap-1","data-testid":"db-saved-queries",children:[d("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:r("Saved")}),l.map((S,w)=>E("span",{className:"inline-flex items-center overflow-hidden rounded-md border border-border",children:[d("button",{className:"px-2 py-0.5 text-xs text-foreground transition-colors hover:bg-accent","data-index":w,"data-testid":`db-saved-query-${S.name}`,onClick:g,type:"button",children:S.name}),d("button",{"aria-label":r("Delete saved query {name}",{name:S.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":w,"data-testid":`db-saved-query-delete-${S.name}`,onClick:x,type:"button",children:"✕"})]},S.name))]}),e[18]=g,e[19]=x,e[20]=l,e[21]=r,e[22]=N):N=e[22];let k;return e[23]!==y||e[24]!==C||e[25]!==N?(k=E("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"db-query-bar",children:[y,C,N]}),e[23]=y,e[24]=C,e[25]=N,e[26]=k):k=e[26],k},Je="w-full rounded-md border border-border bg-background px-2 py-1 font-mono text-xs outline-none focus-visible:border-ring",un=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,Ut=(s,e)=>typeof e=="boolean"?"boolean":typeof e=="number"?un.test(s)?"date":"number":e!==null&&typeof e=="object"?"json":"text",Ns=(s,e,n)=>n===void 0?Ut(s,e):n.enumValues!==void 0&&n.enumValues.length>0?"enum":n.type==="boolean"?"boolean":n.type==="number"?un.test(s)?"date":"number":Ut(s,e),Ss=s=>{try{const e=JSON.parse(s);return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}catch{return null}},ks=s=>{const e=new Date(s),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())}`},Ke="\0clear",Ts=s=>{const e=B(23),{column:n,nullable:o,onChange:t,value:c}=s,l=xe();let r;e[0]!==n||e[1]!==t?(r=v=>{t(n,v)},e[0]=n,e[1]=t,e[2]=r):r=e[2];const a=r;let i;e[3]!==n||e[4]!==t?(i=v=>{t(n,v.target.value===Ke?null:v.target.value==="true")},e[3]=n,e[4]=t,e[5]=i):i=e[5];const m=i;if(!o&&c!==null){const v=c===!0,y=`db-field-${n}`;let C;return e[6]!==n||e[7]!==a||e[8]!==v||e[9]!==y?(C=d($t,{"aria-label":n,checked:v,"data-testid":y,onCheckedChange:a}),e[6]=n,e[7]=a,e[8]=v,e[9]=y,e[10]=C):C=e[10],C}const f=`db-field-${n}`,p=c===!0||c===!1?String(c):Ke;let b;e[11]!==l?(b=l("(none)"),e[11]=l,e[12]=b):b=e[12];let u;e[13]!==b?(u=d("option",{value:Ke,children:b}),e[13]=b,e[14]=u):u=e[14];let g,h;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=d("option",{value:"true",children:"true"}),h=d("option",{value:"false",children:"false"}),e[15]=g,e[16]=h):(g=e[15],h=e[16]);let x;return e[17]!==n||e[18]!==m||e[19]!==f||e[20]!==p||e[21]!==u?(x=E("select",{"aria-label":n,className:Je,"data-testid":f,onChange:m,value:p,children:[u,g,h]}),e[17]=n,e[18]=m,e[19]=f,e[20]=p,e[21]=u,e[22]=x):x=e[22],x},Es=s=>{const e=B(23),{column:n,nullable:o,onChange:t,options:c,value:l}=s,r=xe(),a=typeof l=="string"?l:null;let i;e[0]!==c||e[1]!==a?(i=a!==null&&!c.includes(a),e[0]=c,e[1]=a,e[2]=i):i=e[2];const m=i;let f;e[3]!==n||e[4]!==t?(f=y=>{t(n,y.target.value===Ke?null:y.target.value)},e[3]=n,e[4]=t,e[5]=f):f=e[5];const p=f,b=`db-field-${n}`,u=a??Ke;let g;e[6]!==o||e[7]!==a||e[8]!==r?(g=(o||a===null)&&d("option",{value:Ke,children:r("(none)")}),e[6]=o,e[7]=a,e[8]=r,e[9]=g):g=e[9];let h;e[10]!==a||e[11]!==m?(h=m&&d("option",{value:a,children:a}),e[10]=a,e[11]=m,e[12]=h):h=e[12];let x;e[13]!==c?(x=c.map(Is),e[13]=c,e[14]=x):x=e[14];let v;return e[15]!==n||e[16]!==p||e[17]!==b||e[18]!==u||e[19]!==g||e[20]!==h||e[21]!==x?(v=E("select",{"aria-label":n,className:Je,"data-testid":b,onChange:p,value:u,children:[g,h,x]}),e[15]=n,e[16]=p,e[17]=b,e[18]=u,e[19]=g,e[20]=h,e[21]=x,e[22]=v):v=e[22],v},_s=s=>{const e=B(8),{column:n,onChange:o,value:t}=s;let c;e[0]!==n||e[1]!==o?(c=m=>{const f=Number(m.target.value);m.target.value!==""&&!Number.isNaN(f)&&o(n,f)},e[0]=n,e[1]=o,e[2]=c):c=e[2];const l=c,r=`db-field-${n}`,a=typeof t=="number"?t:"";let i;return e[3]!==n||e[4]!==l||e[5]!==r||e[6]!==a?(i=d("input",{"aria-label":n,className:Je,"data-testid":r,onChange:l,type:"number",value:a}),e[3]=n,e[4]=l,e[5]=r,e[6]=a,e[7]=i):i=e[7],i},Rs=s=>{const e=B(10),{column:n,onChange:o,value:t}=s;let c;e[0]!==n||e[1]!==o?(c=m=>{const f=new Date(m.target.value).getTime();Number.isNaN(f)||o(n,f)},e[0]=n,e[1]=o,e[2]=c):c=e[2];const l=c,r=`db-field-${n}`;let a;e[3]!==t?(a=typeof t=="number"?ks(t):"",e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==n||e[6]!==l||e[7]!==r||e[8]!==a?(i=d("input",{"aria-label":n,className:Je,"data-testid":r,onChange:l,type:"datetime-local",value:a}),e[5]=n,e[6]=l,e[7]=r,e[8]=a,e[9]=i):i=e[9],i},$s=s=>{const e=B(8),{column:n,onChange:o,value:t}=s;let c;e[0]!==n||e[1]!==o?(c=m=>{o(n,m.target.value)},e[0]=n,e[1]=o,e[2]=c):c=e[2];const l=c,r=`db-field-${n}`,a=typeof t=="string"?t:"";let i;return e[3]!==n||e[4]!==l||e[5]!==r||e[6]!==a?(i=d("input",{"aria-label":n,className:Je,"data-testid":r,onChange:l,type:"text",value:a}),e[3]=n,e[4]=l,e[5]=r,e[6]=a,e[7]=i):i=e[7],i},Ds=s=>{const e=B(20),{column:n,onChange:o,value:t}=s,c=xe();let l;e[0]!==t?(l=()=>JSON.stringify(t,null,2),e[0]=t,e[1]=l):l=e[1];const[r,a]=D(l),[i,m]=D(!1);let f;e[2]!==n||e[3]!==o?(f=y=>{const C=y.target.value;a(C);try{o(n,JSON.parse(C)),m(!1)}catch{m(!0)}},e[2]=n,e[3]=o,e[4]=f):f=e[4];const p=f,b=i&&"border-destructive";let u;e[5]!==b?(u=rt(Je,"min-h-16",b),e[5]=b,e[6]=u):u=e[6];const g=`db-field-${n}`;let h;e[7]!==n||e[8]!==p||e[9]!==u||e[10]!==g||e[11]!==r?(h=d("textarea",{"aria-label":n,className:u,"data-testid":g,onChange:p,value:r}),e[7]=n,e[8]=p,e[9]=u,e[10]=g,e[11]=r,e[12]=h):h=e[12];let x;e[13]!==n||e[14]!==i||e[15]!==c?(x=i&&d("span",{className:"text-xs text-destructive","data-testid":`db-field-error-${n}`,children:c("Invalid JSON")}),e[13]=n,e[14]=i,e[15]=c,e[16]=x):x=e[16];let v;return e[17]!==h||e[18]!==x?(v=E("div",{className:"flex flex-col gap-1",children:[h,x]}),e[17]=h,e[18]=x,e[19]=v):v=e[19],v},Ps=s=>{const e=B(56),{column:n,meta:o,onChange:t,target:c,value:l}=s;let r;e[0]!==n||e[1]!==o||e[2]!==l?(r=Ns(n,l,o),e[0]=n,e[1]=o,e[2]=l,e[3]=r):r=e[3];const a=r,i=`db-field-${n}`;let m;e[4]!==n?(m=d("span",{className:"font-mono",children:n}),e[4]=n,e[5]=m):m=e[5];let f;e[6]!==n||e[7]!==o?(f=o!==void 0&&d("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide","data-testid":`db-field-type-${n}`,children:o.type}),e[6]=n,e[7]=o,e[8]=f):f=e[8];let p;e[9]!==c?(p=c!==void 0&&E("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide uppercase",children:["→ ",c]}),e[9]=c,e[10]=p):p=e[10];let b;e[11]!==m||e[12]!==f||e[13]!==p?(b=E("span",{className:"flex items-center gap-1.5 font-medium text-muted-foreground",children:[m,f,p]}),e[11]=m,e[12]=f,e[13]=p,e[14]=b):b=e[14];let u;e[15]!==n||e[16]!==a||e[17]!==o?.nullable||e[18]!==t||e[19]!==l?(u=a==="boolean"&&d(Ts,{column:n,nullable:o?.nullable===!0,onChange:t,value:l}),e[15]=n,e[16]=a,e[17]=o?.nullable,e[18]=t,e[19]=l,e[20]=u):u=e[20];let g;e[21]!==n||e[22]!==a||e[23]!==o||e[24]!==t||e[25]!==l?(g=a==="enum"&&o?.enumValues!==void 0&&d(Es,{column:n,nullable:o.nullable===!0,onChange:t,options:o.enumValues,value:l}),e[21]=n,e[22]=a,e[23]=o,e[24]=t,e[25]=l,e[26]=g):g=e[26];let h;e[27]!==n||e[28]!==a||e[29]!==t||e[30]!==l?(h=a==="number"&&d(_s,{column:n,onChange:t,value:l}),e[27]=n,e[28]=a,e[29]=t,e[30]=l,e[31]=h):h=e[31];let x;e[32]!==n||e[33]!==a||e[34]!==t||e[35]!==l?(x=a==="date"&&d(Rs,{column:n,onChange:t,value:l}),e[32]=n,e[33]=a,e[34]=t,e[35]=l,e[36]=x):x=e[36];let v;e[37]!==n||e[38]!==a||e[39]!==t||e[40]!==l?(v=a==="json"&&d(Ds,{column:n,onChange:t,value:l}),e[37]=n,e[38]=a,e[39]=t,e[40]=l,e[41]=v):v=e[41];let y;e[42]!==n||e[43]!==a||e[44]!==t||e[45]!==l?(y=a==="text"&&d($s,{column:n,onChange:t,value:l}),e[42]=n,e[43]=a,e[44]=t,e[45]=l,e[46]=y):y=e[46];let C;return e[47]!==x||e[48]!==v||e[49]!==y||e[50]!==i||e[51]!==b||e[52]!==u||e[53]!==g||e[54]!==h?(C=E("label",{className:"flex flex-col gap-1 text-xs",htmlFor:i,children:[b,u,g,h,x,v,y]}),e[47]=x,e[48]=v,e[49]=y,e[50]=i,e[51]=b,e[52]=u,e[53]=g,e[54]=h,e[55]=C):C=e[55],C},As=s=>{const e=B(49),{columnMeta:n,documentText:o,onCancel:t,onDocumentTextChange:c,onSave:l,refs:r}=s,a=xe();let i;e[0]!==o?(i=Ss(o),e[0]=o,e[1]=i):i=e[1];const m=i,[f,p]=D(!1),b=!f&&m!==null;let u;e[2]!==m||e[3]!==c?(u=(V,J)=>{c(JSON.stringify({...m,[V]:J},null,2))},e[2]=m,e[3]=c,e[4]=u):u=e[4];const g=u;let h;e[5]!==c?(h=V=>{c(V.target.value)},e[5]=c,e[6]=h):h=e[6];const x=h;let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{p(!1)},e[7]=v):v=e[7];const y=v;let C;e[8]===Symbol.for("react.memo_cache_sentinel")?(C=()=>{p(!0)},e[8]=C):C=e[8];const N=C,k=m===null;let S;e[9]!==a?(S=a("Form"),e[9]=a,e[10]=S):S=e[10];let w;e[11]!==b||e[12]!==k||e[13]!==S?(w=d("button",{"aria-pressed":b,className:De,"data-testid":"db-editor-form",disabled:k,onClick:y,type:"button",children:S}),e[11]=b,e[12]=k,e[13]=S,e[14]=w):w=e[14];const T=!b;let I;e[15]!==a?(I=a("JSON"),e[15]=a,e[16]=I):I=e[16];let R;e[17]!==I||e[18]!==T?(R=d("button",{"aria-pressed":T,className:De,"data-testid":"db-editor-json",onClick:N,type:"button",children:I}),e[17]=I,e[18]=T,e[19]=R):R=e[19];let _;e[20]!==R||e[21]!==w?(_=E("div",{className:"flex items-center gap-1.5",children:[w,R]}),e[20]=R,e[21]=w,e[22]=_):_=e[22];let $;e[23]!==n||e[24]!==o||e[25]!==m||e[26]!==g||e[27]!==x||e[28]!==r||e[29]!==b||e[30]!==a?($=b?d("div",{className:"flex flex-col gap-3","data-testid":"db-editor-fields",children:Object.entries(m).map(V=>{const[J,j]=V;return d(Ps,{column:J,meta:n?.[J],onChange:g,target:r?.[J],value:j},J)})}):d("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:x,value:o}),e[23]=n,e[24]=o,e[25]=m,e[26]=g,e[27]=x,e[28]=r,e[29]=b,e[30]=a,e[31]=$):$=e[31];let A;e[32]!==a?(A=a("Save"),e[32]=a,e[33]=A):A=e[33];let M;e[34]!==l||e[35]!==A?(M=d("button",{className:De,"data-testid":"db-editor-save",onClick:l,type:"button",children:A}),e[34]=l,e[35]=A,e[36]=M):M=e[36];let F;e[37]!==a?(F=a("Cancel"),e[37]=a,e[38]=F):F=e[38];let q;e[39]!==t||e[40]!==F?(q=d("button",{className:De,"data-testid":"db-editor-cancel",onClick:t,type:"button",children:F}),e[39]=t,e[40]=F,e[41]=q):q=e[41];let G;e[42]!==M||e[43]!==q?(G=E("div",{className:"flex items-center gap-1.5",children:[M,q]}),e[42]=M,e[43]=q,e[44]=G):G=e[44];let O;return e[45]!==_||e[46]!==$||e[47]!==G?(O=E("div",{className:"flex flex-col gap-2 border border-border bg-card p-3","data-testid":"db-editor",children:[_,$,G]}),e[45]=_,e[46]=$,e[47]=G,e[48]=O):O=e[48],O};function Is(s){return d("option",{value:s,children:s},s)}const Fs=s=>{const e=B(71),{columns:n,editable:o,filter:t,filters:c,hasMaskedColumns:l,hasPredicate:r,liveError:a,maskOn:i,onAddRow:m,onBulkDelete:f,onBulkPatch:p,onAskAiFilter:b,onClearTable:u,onFilterChange:g,onFiltersChange:h,onGenerateRows:x,onShowJson:v,onShowTable:y,onToggleMask:C,total:N,totalKnown:k,viewMode:S}=s,w=xe(),T=S==="table";let I;e[0]!==y||e[1]!==T?(I=d("button",{"aria-pressed":T,className:De,"data-testid":"db-view-table",onClick:y,type:"button",children:"Table"}),e[0]=y,e[1]=T,e[2]=I):I=e[2];const R=S==="json";let _;e[3]!==v||e[4]!==R?(_=d("button",{"aria-pressed":R,className:De,"data-testid":"db-view-json",onClick:v,type:"button",children:"JSON"}),e[3]=v,e[4]=R,e[5]=_):_=e[5];let $;e[6]!==a||e[7]!==w?($=a===void 0?w("Live — changes stream in automatically"):w("Live unavailable: {liveError}",{liveError:a}),e[6]=a,e[7]=w,e[8]=$):$=e[8];const A=`size-1.5 rounded-full ${a===void 0?"bg-success":"bg-muted-foreground/50"}`;let M;e[9]!==A?(M=d("span",{"aria-hidden":"true",className:A}),e[9]=A,e[10]=M):M=e[10];let F;e[11]!==a||e[12]!==w?(F=w(a===void 0?"Live":"Live unavailable"),e[11]=a,e[12]=w,e[13]=F):F=e[13];let q;e[14]!==$||e[15]!==M||e[16]!==F?(q=E("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:$,children:[M,F]}),e[14]=$,e[15]=M,e[16]=F,e[17]=q):q=e[17];let G;e[18]!==l||e[19]!==i||e[20]!==C||e[21]!==w?(G=l&&d("button",{"aria-pressed":i,className:De,"data-testid":"db-mask-toggle",onClick:C,type:"button",children:w("Mask sensitive columns")}),e[18]=l,e[19]=i,e[20]=C,e[21]=w,e[22]=G):G=e[22];let O;e[23]!==o||e[24]!==m?(O=o&&d("button",{className:De,"data-testid":"db-add-row",onClick:m,type:"button",children:"Add row"}),e[23]=o,e[24]=m,e[25]=O):O=e[25];let V;e[26]!==o||e[27]!==x||e[28]!==w?(V=o&&d("button",{className:De,"data-testid":"db-generate-rows",onClick:x,type:"button",children:w("Generate rows")}),e[26]=o,e[27]=x,e[28]=w,e[29]=V):V=e[29];let J;e[30]!==o||e[31]!==r||e[32]!==f||e[33]!==w||e[34]!==N||e[35]!==k?(J=o&&N>0&&r&&d(jt,{confirmLabel:k?w("Permanently delete {total} matching rows and everything that cascades?",{total:N.toString()}):w("Permanently delete all matching rows and everything that cascades?"),onConfirm:f,testId:"db-bulk-delete",children:k?w("Delete {total} matching",{total:N.toString()}):w("Delete matching")}),e[30]=o,e[31]=r,e[32]=f,e[33]=w,e[34]=N,e[35]=k,e[36]=J):J=e[36];let j;e[37]!==o||e[38]!==r||e[39]!==p||e[40]!==w||e[41]!==N||e[42]!==k?(j=o&&k&&N>0&&r&&d("button",{className:De,"data-testid":"db-bulk-patch",onClick:p,type:"button",children:w("Set column on {total} matching",{total:N.toString()})}),e[37]=o,e[38]=r,e[39]=p,e[40]=w,e[41]=N,e[42]=k,e[43]=j):j=e[43];let Y;e[44]!==o||e[45]!==r||e[46]!==u||e[47]!==w||e[48]!==N||e[49]!==k?(Y=o&&N>0&&!r&&d(jt,{confirmLabel:k?w("Permanently clear all {total} rows and everything that cascades?",{total:N.toString()}):w("Permanently clear every row and everything that cascades?"),onConfirm:u,testId:"db-clear-table",children:k?w("Clear table ({total})",{total:N.toString()}):w("Clear table")}),e[44]=o,e[45]=r,e[46]=u,e[47]=w,e[48]=N,e[49]=k,e[50]=Y):Y=e[50];let U;e[51]!==G||e[52]!==O||e[53]!==V||e[54]!==J||e[55]!==j||e[56]!==Y||e[57]!==I||e[58]!==_||e[59]!==q?(U=E("div",{className:"flex flex-wrap items-center gap-1.5",children:[I,_,q,G,O,V,J,j,Y]}),e[51]=G,e[52]=O,e[53]=V,e[54]=J,e[55]=j,e[56]=Y,e[57]=I,e[58]=_,e[59]=q,e[60]=U):U=e[60];let H;e[61]!==n||e[62]!==t||e[63]!==c||e[64]!==b||e[65]!==g||e[66]!==h?(H=d(ho,{columns:n,filters:c,onAskAi:b,onFiltersChange:h,onSearchChange:g,search:t}),e[61]=n,e[62]=t,e[63]=c,e[64]=b,e[65]=g,e[66]=h,e[67]=H):H=e[67];let te;return e[68]!==U||e[69]!==H?(te=E("div",{className:"flex flex-col gap-2","data-testid":"db-view-toggle",children:[U,H]}),e[68]=U,e[69]=H,e[70]=te):te=e[70],te},Os=s=>{const e=B(110),{assistant:n,backRelations:o,browser:t,columnMeta:c,edit:l,editable:r,onAskAiFilter:a,onInspect:i,onOpenBulkPatch:m,onOpenGenerateRows:f,onRowDelete:p,onSaveQuery:b,page:u,preferences:g,queryBar:h,references:x}=s,v=g.maskColumns.size>0,y=n.unavailable?void 0:a;let C;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.hasPredicate||e[7]!==t.liveError||e[8]!==t.onFilterChange||e[9]!==t.onFiltersChange||e[10]!==t.showJson||e[11]!==t.showTable||e[12]!==t.total||e[13]!==t.totalKnown||e[14]!==t.viewMode||e[15]!==r||e[16]!==m||e[17]!==f||e[18]!==g.maskOn||e[19]!==g.onToggleMask||e[20]!==v||e[21]!==y?(C=d(Fs,{columns:t.columns,editable:r,filter:t.filter,filters:t.filters,hasMaskedColumns:v,hasPredicate:t.hasPredicate,liveError:t.liveError,maskOn:g.maskOn,onAddRow:t.addRow,onAskAiFilter:y,onBulkDelete:t.bulkDelete,onBulkPatch:m,onClearTable:t.clearTable,onFilterChange:t.onFilterChange,onFiltersChange:t.onFiltersChange,onGenerateRows:f,onShowJson:t.showJson,onShowTable:t.showTable,onToggleMask:g.onToggleMask,total:t.total,totalKnown:t.totalKnown,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.hasPredicate,e[7]=t.liveError,e[8]=t.onFilterChange,e[9]=t.onFiltersChange,e[10]=t.showJson,e[11]=t.showTable,e[12]=t.total,e[13]=t.totalKnown,e[14]=t.viewMode,e[15]=r,e[16]=m,e[17]=f,e[18]=g.maskOn,e[19]=g.onToggleMask,e[20]=v,e[21]=y,e[22]=C):C=e[22];let N;e[23]!==b||e[24]!==h?(N=h!==void 0&&d(Cs,{onApply:h.onApplyQuery,onCopyLink:h.onCopyLink,onDelete:h.onDeleteQuery,onSave:b,saved:h.saved}),e[23]=b,e[24]=h,e[25]=N):N=e[25];let k;e[26]!==o||e[27]!==t.onBulkDeleteSelected||e[28]!==t.selectedTable||e[29]!==t.table||e[30]!==t.viewMode||e[31]!==r||e[32]!==u||e[33]!==g.maskView||e[34]!==g.onToggleTranspose||e[35]!==g.transposed?(k=t.viewMode==="table"&&u.rows.length>0&&d(xo,{backRelations:o.available,columns:u.columns,editable:r,enabledBackRelations:o.enabled,name:t.selectedTable??"export",onBulkDelete:t.onBulkDeleteSelected,onToggleBackRelation:o.onToggle,onToggleTranspose:g.onToggleTranspose,rows:vt(u.rows,g.maskView),sqlColumns:u.sqlColumns,table:t.table.table,transposed:g.transposed}),e[26]=o,e[27]=t.onBulkDeleteSelected,e[28]=t.selectedTable,e[29]=t.table,e[30]=t.viewMode,e[31]=r,e[32]=u,e[33]=g.maskView,e[34]=g.onToggleTranspose,e[35]=g.transposed,e[36]=k):k=e[36];let S;e[37]!==t.cancelEdit||e[38]!==t.editing||e[39]!==t.saveEdit||e[40]!==t.setEditorDocumentText||e[41]!==c||e[42]!==r||e[43]!==u?(S=r&&t.editing!==null&&d(As,{columnMeta:c,documentText:t.editing.docText,onCancel:t.cancelEdit,onDocumentTextChange:t.setEditorDocumentText,onSave:t.saveEdit,refs:u.refs}),e[37]=t.cancelEdit,e[38]=t.editing,e[39]=t.saveEdit,e[40]=t.setEditorDocumentText,e[41]=c,e[42]=r,e[43]=u,e[44]=S):S=e[44];let w;e[45]!==t.committing||e[46]!==t.discardStaged||e[47]!==t.onCommitStaged||e[48]!==t.stagedChanges||e[49]!==r?(w=r&&t.stagedChanges.length>0&&d(Bo,{changes:t.stagedChanges,committing:t.committing,onCommit:t.onCommitStaged,onDiscard:t.discardStaged}),e[45]=t.committing,e[46]=t.discardStaged,e[47]=t.onCommitStaged,e[48]=t.stagedChanges,e[49]=r,e[50]=w):w=e[50];let T;e[51]!==t.writeError?(T=t.writeError!==null&&d("p",{className:"text-sm text-destructive","data-testid":"db-write-error",role:"alert",children:t.writeError}),e[51]=t.writeError,e[52]=T):T=e[52];let I;e[53]!==t.writeNotice?(I=t.writeNotice!==null&&d("p",{className:"text-sm text-muted-foreground","data-testid":"db-write-notice",role:"status",children:t.writeNotice}),e[53]=t.writeNotice,e[54]=I):I=e[54];let R;e[55]!==C||e[56]!==N||e[57]!==k||e[58]!==S||e[59]!==w||e[60]!==T||e[61]!==I?(R=E("div",{className:"flex shrink-0 flex-col gap-2 border-b border-border px-4 py-3",children:[C,N,k,S,w,T,I]}),e[55]=C,e[56]=N,e[57]=k,e[58]=S,e[59]=w,e[60]=T,e[61]=I,e[62]=R):R=e[62];let _;e[63]!==t.viewMode||e[64]!==u?(_=t.viewMode==="table"&&u.rows.length===0&&d("div",{className:"flex flex-1 items-center justify-center p-6",children:d(Yn,{description:"Rows you insert into this table will show up here.",icon:d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"M4 5h16v14H4V5Zm0 5h16M10 10v9M4 14.5h16"})}),testId:"db-empty-rows",title:"This table is empty."})}),e[63]=t.viewMode,e[64]=u,e[65]=_):_=e[65];let $;e[66]!==t.viewMode||e[67]!==u||e[68]!==g.maskView||e[69]!==g.transposed?($=t.viewMode==="table"&&u.rows.length>0&&g.transposed&&d(bo,{columns:u.columns,rows:vt(u.rows,g.maskView)}),e[66]=t.viewMode,e[67]=u,e[68]=g.maskView,e[69]=g.transposed,e[70]=$):$=e[70];let A;e[71]!==o||e[72]!==t.filter||e[73]!==t.onRowEdit||e[74]!==t.table||e[75]!==t.viewMode||e[76]!==c||e[77]!==l||e[78]!==r||e[79]!==i||e[80]!==p||e[81]!==u||e[82]!==g.maskView||e[83]!==g.onTogglePin||e[84]!==g.pinnedColumns||e[85]!==g.transposed||e[86]!==x?(A=t.viewMode==="table"&&u.rows.length>0&&!g.transposed&&d(ms,{backRelationCounts:o.counts,columnMeta:c,edit:l,editable:r,highlight:t.filter,mask:g.maskView,onDelete:p,onEdit:t.onRowEdit,onInspect:i,onTogglePin:g.onTogglePin,pinnedColumns:g.pinnedColumns,refs:x,tableModel:t.table}),e[71]=o,e[72]=t.filter,e[73]=t.onRowEdit,e[74]=t.table,e[75]=t.viewMode,e[76]=c,e[77]=l,e[78]=r,e[79]=i,e[80]=p,e[81]=u,e[82]=g.maskView,e[83]=g.onTogglePin,e[84]=g.pinnedColumns,e[85]=g.transposed,e[86]=x,e[87]=A):A=e[87];let M;e[88]!==t.viewMode||e[89]!==u||e[90]!==g.maskView?(M=t.viewMode==="json"&&d("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(vt(u.rows,g.maskView),en,2)}),e[88]=t.viewMode,e[89]=u,e[90]=g.maskView,e[91]=M):M=e[91];let F;e[92]!==t.changePageSize||e[93]!==t.goNext||e[94]!==t.goPrevious||e[95]!==t.hasNext||e[96]!==t.hasPrevious||e[97]!==t.jumpToPage||e[98]!==t.pageSize||e[99]!==t.rangeEnd||e[100]!==t.rangeStart||e[101]!==t.total?(F=d("div",{className:"flex shrink-0 items-center border-t border-border px-4 py-2",children:d(wo,{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[92]=t.changePageSize,e[93]=t.goNext,e[94]=t.goPrevious,e[95]=t.hasNext,e[96]=t.hasPrevious,e[97]=t.jumpToPage,e[98]=t.pageSize,e[99]=t.rangeEnd,e[100]=t.rangeStart,e[101]=t.total,e[102]=F):F=e[102];let q;return e[103]!==R||e[104]!==_||e[105]!==$||e[106]!==A||e[107]!==M||e[108]!==F?(q=E("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"db-page",children:[R,_,$,A,M,F]}),e[103]=R,e[104]=_,e[105]=$,e[106]=A,e[107]=M,e[108]=F,e[109]=q):q=e[109],q},Ms="/__lunora/seed",St=200,Ls=50,Vs=(s,e)=>{const n=[];for(const o of s)o.pk!==!0&&o.ref!==void 0&&o.type==="id"&&(e[o.ref]??[]).length===0&&n.push(o.name);return n},Bs=s=>Array.isArray(s)&&s.every(e=>nn(e)),js=async s=>{let e;try{e=await fetch(Ms,{body:JSON.stringify(s),headers:{"Content-Type":"application/json"},method:"POST"})}catch(o){return{kind:"error",message:`seed request failed: ${Vt(o)}`}}let n;try{n=await e.json()??{}}catch{return{kind:"error",message:`seed request failed (${String(e.status)})`}}if(e.ok&&n.rows!==void 0){let o;try{o=Rt(n.rows)}catch(t){return{kind:"error",message:`seed response could not be decoded: ${Vt(t)}`}}return Bs(o)?{kind:"ok",rows:o}:{kind:"error",message:"seed response did not carry a list of row documents"}}return n.error==="fk-parents-empty"?{kind:"error",message:`no rows to reference in ${(Array.isArray(n.tables)?n.tables.filter(t=>typeof t=="string"):[]).join(", ")} — seed those tables first`}:{kind:"error",message:typeof n.error=="string"?n.error:`seed request failed (${String(e.status)})`}},zs="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",qs="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",Ks=({columns:s,fkPools:e,onClose:n,onInsertRows:o,table:t})=>{const c=xe(),[l,r]=D(10),[a,i]=D(!1),[m,f]=D(void 0),[p,b]=D(void 0),[u,g]=D(0),h=N=>{const k=Number(N.target.value);!Number.isNaN(k)&&k>=1&&r(Math.min(k,St))},x=async()=>{f(void 0),b(void 0),g(0),i(!0);try{const N=await js({count:l,existingIds:e,seed:Date.now(),table:t});if(N.kind==="error"){f(N.message);return}const{rows:k}=N;if(k.length===0){f(c("No rows generated — all columns were skipped."));return}const S=await o(k);if(S.error!==void 0){f(S.error);return}b(S.inserted),g(S.conflicts)}finally{i(!1)}},v=()=>{Ne(x())},y=s.filter(N=>N.pk!==!0),C=Vs(s,e);return E(it,{label:c("Generate dummy rows"),onClose:n,panelTestId:"gen-rows-panel",testId:"gen-rows-overlay",variant:"dialog",children:[E("div",{className:"flex items-start justify-between",children:[E("div",{className:"flex flex-col gap-0.5",children:[d("h3",{className:"text-base text-foreground","data-testid":"gen-rows-title",children:c("Generate dummy rows")}),d("p",{className:"text-xs text-muted-foreground","data-testid":"gen-rows-desc",children:c("Seed {table} with Faker-generated rows. Existing rows are not affected.",{table:t})})]}),d("button",{className:"text-xs text-muted-foreground hover:text-foreground","data-testid":"gen-rows-close",onClick:n,type:"button",children:c("Close")})]}),E("div",{className:"flex items-center gap-2",children:[d("label",{className:"text-xs font-medium text-foreground",htmlFor:"gen-rows-count",children:c("Row count")}),d("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:St,min:1,onChange:h,type:"number",value:l}),d("span",{className:"text-xs text-muted-foreground",children:c("(max {max})",{max:St.toString()})})]}),y.length>0&&E("div",{className:"flex flex-col gap-1",children:[d("p",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:c("Columns to seed")}),d("ul",{className:"flex flex-col gap-0.5","data-testid":"gen-rows-columns",children:y.map(N=>{const k=N.ref!==void 0&&N.type==="id",S=k&&(e[N.ref??""]??[]).length===0,w=S?"rounded bg-destructive/10 px-1 text-destructive":"rounded bg-muted px-1 text-muted-foreground",T=S?`gen-rows-fk-empty-${N.name}`:`gen-rows-fk-ok-${N.name}`,I=S?c("FK: no rows in {ref} — seed it first",{ref:N.ref??""}):c("→ {ref}",{ref:N.ref??""});return E("li",{className:"flex items-center gap-1.5 font-mono text-xs",children:[d("span",{className:"text-foreground",children:N.name}),E("span",{className:"text-muted-foreground",children:["(",N.type,")"]}),N.optional&&d("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide uppercase",children:"optional"}),k&&d("span",{className:w,"data-testid":T,children:I})]},N.name)})})]}),C.length>0&&d("p",{className:"text-xs text-destructive","data-testid":"gen-rows-blocked",role:"alert",children:c("Cannot generate rows: these columns reference tables with no rows: {cols}. Seed those tables first.",{cols:C.join(", ")})}),m!==void 0&&d("p",{className:"text-xs text-destructive","data-testid":"gen-rows-error",role:"alert",children:m}),p!==void 0&&m===void 0&&d("p",{className:"text-xs text-success","data-testid":"gen-rows-success",children:u>0?c("Inserted {inserted} of {total} rows — {conflicts} skipped as id conflicts.",{conflicts:u.toString(),inserted:p.toString(),total:(p+u).toString()}):c("Inserted {count} rows successfully.",{count:p.toString()})}),E("div",{className:"flex justify-end gap-2",children:[d("button",{className:zs,"data-testid":"gen-rows-cancel",onClick:n,type:"button",children:c("Cancel")}),d("button",{className:qs,"data-testid":"gen-rows-generate",disabled:a||C.length>0,onClick:v,type:"button",children:c(a?"Inserting…":"Generate & insert")})]})]})},Gs=Ee(pe.backRelationCounts),Js=(s,e,n,o)=>{const t=B(16),c=at();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l={},t[0]=l):l=t[0];const[r,a]=D(l);let i;if(t[1]!==s||t[2]!==e){let x;t[4]!==s?(x=v=>s.has(Dt(v)),t[4]=s,t[5]=x):x=t[5],i=e.filter(x),t[1]=s,t[2]=e,t[3]=i}else i=t[3];const m=i;let f;t[6]!==n||t[7]!==m?(f=JSON.stringify([m,n]),t[6]=n,t[7]=m,t[8]=f):f=t[8];const p=f;let b;t[9]!==c||t[10]!==o||t[11]!==p?(b=async x=>{const[v,y]=JSON.parse(p);if(v.length===0||y.length===0){x.cancelled||a({});return}try{const C=await c.query(Gs,{ids:y,relations:v},Te(o));x.cancelled||a(Object.fromEntries(C.relations.map(Ws)))}catch{}},t[9]=c,t[10]=o,t[11]=p,t[12]=b):b=t[12];const u=b;let g,h;return t[13]!==u?(g=()=>{const x={cancelled:!1};return Ne(u(x)),()=>{x.cancelled=!0}},h=[u],t[13]=u,t[14]=g,t[15]=h):(g=t[14],h=t[15]),Be(g,h),r};function Ws(s){return[Dt(s),s.counts]}const Hs=async s=>{const{args:e,maxBatches:n,openCursor:o,query:t}=s;let c=o,l=0,r="cap-hit";for(let a=0;a<n;a+=1){const i=await t({...e,after:c});if(l+=i.count,c=i.cursor,!i.hasMore){r="completed";break}}return{cursor:r==="cap-hit"?c:void 0,outcome:r,written:l}},st=s=>{const e=s[0];return e===void 0?void 0:{column:e.id,direction:e.desc?"desc":"asc"}},fn=s=>Oe(s),Qt=s=>s.map(e=>({column:e.column,...e.value===void 0?{}:{literal:[e.value]},operator:e.operator,value:e.value===void 0?"":fn(e.value)})),Yt=s=>s===void 0?[]:[{desc:s.direction==="desc",id:s.column}],Us=s=>[s.column,s.operator,s.value],nt=(s,e,n,o)=>JSON.stringify([s??"",e??"",(n??[]).map(t=>Us(t)),o===void 0?null:[o.column,o.direction]]),At=200,Qs=20,Ys=Ee(pe.readTablePage),Xs=Ee(pe.facetColumn),kt=Ee(pe.writeRow),Zs=Ee(pe.deleteRows),el=Ee(pe.clearTable),tl=Ee(pe.patchRows),nl={},It=new Set(["__doc__","__id__","_creationTime","_id","id"]),ol=s=>{const e=s.__doc__;if(typeof e=="string"){const o=Un(e);if(o!==void 0)return o}const n={};for(const[o,t]of Object.entries(s))It.has(o)||(n[o]=t);return n},sl=(s,e,n)=>JSON.stringify([s.__lunoraRef,n,on(e)]),ll=({filters:s,offset:e,pageSize:n,search:o,sorting:t,table:c})=>({filters:Fe(s),limit:n,offset:e,orderBy:st(t),search:o,skipCount:!0,table:c}),rl=({filters:s,search:e,table:n})=>({filters:Fe(s),limit:1,search:e,table:n}),al=(s,e)=>{const n=new Map;for(const t of s?.rows??[]){const c=Pe(t);c!==null&&n.set(c,t)}const o=[];for(const[t,c]of Object.entries(e))for(const[l,r]of Object.entries(c))o.push({column:l,newValue:r,oldValue:n.get(t)?.[l],rowId:t});return o},il=s=>!It.has(s),cl=`Stopped after ${At.toString()} batches — rows still match. Run it again to remove the rest.`,dl=`Stopped after ${At.toString()} batches — rows still match. Run it again to set the rest.`,Xt={resumable:!1,truncated:cl,verb:"deleted"},ul={resumable:!0,truncated:dl,verb:"written"},fl=({initialFilters:s,initialOrderBy:e,initialSearch:n,initialShardKey:o,onSelectTable:t,onViewChange:c,pageSize:l,resolveBackRelations:r,tableParam:a})=>{const i=at(),[m,f]=D(l),[p,b]=D(o??""),u=a===void 0||a===""?null:a,[g,h]=D(0),[x,v]=D("table"),[y,C]=D(()=>Yt(e)),[N,k]=D(n??""),[S,w]=D(()=>Qt(s??[])),{clearFacets:T,facets:I,refetchFacets:R,toggleFacet:_}=Kn(),[$,A]=D(null),[M,F]=D(null),[q,G]=D(null),O=Ge(null),V=Vo(),[J,j]=D(null),[Y,U]=D(!1),[H,te]=D(a),[le,ue]=D(()=>nt(o,n,s,e)),[fe,ge]=D(0),[ae,me]=D(()=>nt(o,n,s,e)),ie=a!==H,Q=nt(o,n,s,e),Z=ie||!ie&&Q!==le&&Q!==ae;if(Z){te(a),ue(Q),ge(z=>z+1),C(Yt(e)),k(n??"");const P=Qt(s??[]);w(P),b(o??""),T(),V.clear(),j(null),A(null),h(0),F(null),G(null),O.current=null}else Q!==le&&ue(Q);const ve=Z?n??"":N,ce=Z?o??"":p,de=`${a??""}:${fe.toString()}`,W=zt(ve.trim(),300,de),K=zt(ce.trim(),400,de),[ee,X]=D(K);ee!==K&&(X(K),V.clear(),j(null),A(null));const he=nt(K,W,Fe(S),st(y));he!==ae&&me(he);const re=Xe(pe.listTables,nl,{live:!0,shardKey:K}),we=re.data??null,ye=re.error,ne=ll({filters:S,offset:g,pageSize:m,search:W,sorting:y,table:u??""}),Me=rl({filters:S,search:W,table:u??""}),Ce=Xe(pe.readTablePage,ne,{enabled:u!==null,keepPreviousData:!1,live:!0,shardKey:K}),oe=Ce.data??null,Ae=Ce.error,{liveError:We}=Ce,ke=Xe(pe.readTablePage,Me,{enabled:u!==null,live:!0,shardKey:K});Be(()=>{re.data!==void 0&&yo(K)},[re.data,K]);const ze=P=>{t?.(P)},je=(P,z)=>{t?.(P,{search:z})},He=async(P,z)=>{try{return(await i.query(Ys,{filters:[],limit:Qs,offset:0,search:z,table:P},Te(K))).rows.find(Re=>Pe(Re)===z)??null}catch{return null}},et=(P,z,Se,Re)=>$e=>i.query(Xs,{column:$e,filters:Fe(Se),search:Re,table:z},Te(P)),ct=P=>{_(P,u===null?null:et(K,u,S,W))},tt=(P,z)=>{const Se={column:P,literal:[jn(z)],operator:"eq",value:fn(z)};w(Re=>[...Re.filter($e=>$e.column!==P),Se]),h(0)},dt=wt(et),ut=wt(R),Ue=wt(c);Be(()=>{u!==null&&ut.current(dt.current(K,u,S,W))},[K,u,S,W]),Be(()=>{u===null||Ue.current===void 0||H!==a||le!==Q||Ue.current({filters:Fe(S),orderBy:st(y),search:W,shard:K})},[u,a,H,le,Q,S,y,W,K]);const Qe=P=>{u!==null&&h(Math.max(0,P))},ft=(P,z)=>{j({column:z,rowId:P})},mt=()=>{j(null)},gt=async()=>{if(u!==null){F(null),U(!0);try{for(const[P,z]of Object.entries(V.staged))await i.query(kt,{doc:z,id:P,op:"patch",table:u},Te(K)),V.drop(P,z)}catch(P){F(P.message)}j(null),Ce.refetch(),U(!1)}},pt=()=>{V.clear(),j(null)},bt=P=>{b(P),V.clear(),j(null),A(null),h(0),O.current=null},ht=al(oe,V.staged),L=async(P,z,Se)=>{if(u===null)return;F(null);let Re;if(P!=="delete"){let $e;try{$e=Se===void 0||Se.trim()===""?{}:JSON.parse(Se)}catch(Ve){F(`Invalid JSON: ${Ve.message}`);return}try{const Ve=Rt($e);if(!nn(Ve)){F("The document must be a JSON object.");return}Re=Ve}catch(Ve){F(`Invalid document: ${Ve.message}`);return}}try{await i.query(kt,{doc:Re,id:z??void 0,op:P,table:u},Te(K)),A(null),Ce.refetch()}catch($e){F($e.message)}},se=async(P,z,Se)=>{if(u===null)return 0;F(null),G(null);const Re=sl(P,z,K),$e=O.current?.key===Re?O.current.after:void 0,Ve=Se.resumable?$e??"":void 0;let qe=0;try{const Ye=await Hs({args:z,maxBatches:At,openCursor:Ve,query:async Vn=>{const Lt=await i.query(P,Vn,Te(K));return qe+=Lt.count,Lt}});return O.current=Ye.cursor===void 0?null:{after:Ye.cursor,key:Re},Ye.outcome==="cap-hit"&&F(Se.truncated),G(`${qe.toString()} ${qe===1?"row":"rows"} ${Se.verb}.`),qe}catch(Ye){return F(`${Ye.message} (at least ${qe.toString()} rows were already ${Se.verb})`),O.current=null,qe}finally{h(0),Ce.refetch()}},_e=P=>{C(P),h(0)},Ie=Tt(()=>u===null?[]:r?.(u)??[],[r,u]),Le=gs(oe,y,_e,Ie),xt={filters:Fe(S),orderBy:st(y),search:W,shard:p,table:u??void 0},Ft=ke.data?.total,Ot=Ft!==void 0,Mt=Ft??(oe===null?0:g+oe.rows.length),mn=g>0,gn=W!==""||Fe(S).length>0,pn=oe!==null&&(Ot?g+oe.rows.length<Mt:oe.rows.length===m),bn=oe===null||oe.rows.length===0?0:g+1,hn=oe===null?0:g+oe.rows.length,xn=()=>{re.refetch()},vn=()=>{v("table")},wn=()=>{v("json")},yn=()=>{Ne(se(Zs,{filters:Fe(S),search:W,table:u},Xt))},Cn=()=>{Ne(se(el,{table:u},Xt))},Nn=P=>{Ne(se(tl,{doc:P,filters:Fe(S),search:W,table:u},ul))},Sn=P=>{k(P.target.value),h(0)},kn=P=>{w(P),h(0)},Tn=()=>{F(null);const P={};for(const z of oe?.columns??[])It.has(z)||(P[z]="");A({docText:JSON.stringify(P,null,2),id:""})},En=P=>{A(z=>z===null?z:{docText:P,id:z.id})},_n=()=>{$!==null&&Ne(L($.id===""?"insert":"patch",$.id===""?null:$.id,$.docText))},Rn=()=>{A(null),F(null)},$n=()=>{Qe(g-m)},Dn=()=>{Qe(g+m)},Pn=P=>{Qe(Math.max(0,(P-1)*m))},An=P=>{f(P),h(0)},In=(P,z)=>{F(null),A({docText:JSON.stringify(on(ol(z)),null,2),id:P})},Fn=P=>{Ne(L("delete",P))},On=async P=>{if(!(u===null||P.length===0)){F(null);try{for(const z of P)await i.query(kt,{id:z,op:"delete",table:u},Te(K));Ce.refetch()}catch(z){F(z.message)}}},Mn=P=>{Ne(On(P))},Ln=()=>{Ne(gt())};return{addRow:Tn,bulkDelete:yn,bulkPatch:Nn,cancelCellEdit:mt,cancelEdit:Rn,changePageSize:An,clearTable:Cn,columns:oe?.columns??[],committing:Y,currentView:xt,discardStaged:pt,editableColumn:il,editing:$,editingCell:J,facetFilter:tt,facets:I,filter:N,filters:S,goNext:Dn,goPrevious:$n,hasNext:pn,hasPredicate:gn,hasPrevious:mn,jumpToPage:Pn,liveError:We,loadTables:xn,navigateToRef:je,onBulkDeleteSelected:Mn,onCommitStaged:Ln,onFilterChange:Sn,onFiltersChange:kn,onRowDelete:Fn,onRowEdit:In,page:oe,previewRef:He,pageError:Ae,pageSize:m,rangeEnd:hn,rangeStart:bn,queryShardKey:K,saveEdit:_n,selectedTable:u,selectTable:ze,setEditorDocumentText:En,setShardKey:bt,shardKey:p,showJson:wn,showTable:vn,stage:V.stage,stagedChanges:ht,stagedValue:V.stagedValue,startCellEdit:ft,table:Le,tables:we,tablesError:ye,toggleFacet:ct,total:Mt,totalKnown:Ot,viewMode:x,writeError:M,writeNotice:q}},ml="lunora-studio-pinned-columns",gl=s=>{const e=B(21),{columns:n,initialPins:o,selectedTable:t}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];const[l,r]=Zt(ml,c),a=t??"",i=l[a];let m;e[1]!==o||e[2]!==i?(m=i===void 0?new Set((o??"").split(",").filter(pl)):new Set(i),e[1]=o,e[2]=i,e[3]=m):m=e[3];const f=m;let p;e[4]!==a||e[5]!==f||e[6]!==r?(p=T=>{r(I=>{const R=I[a]??[...f],_=R.includes(T)?R.filter($=>$!==T):[...R,T];return{...I,[a]:_}})},e[4]=a,e[5]=f,e[6]=r,e[7]=p):p=e[7];const b=p,[u,g]=D(!1);let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{g(bl)},e[8]=h):h=e[8];const x=h;let v;e[9]!==n||e[10]!==t?(v={columns:n,selectedTable:t},e[9]=n,e[10]=t,e[11]=v):v=e[11];const{maskColumns:y,maskOn:C,maskView:N,maskViewFor:k,onToggleMask:S}=Gn(v);let w;return e[12]!==y||e[13]!==C||e[14]!==N||e[15]!==k||e[16]!==S||e[17]!==b||e[18]!==f||e[19]!==u?(w={maskColumns:y,maskOn:C,maskView:N,maskViewFor:k,onToggleMask:S,onTogglePin:b,onToggleTranspose:x,pinnedColumns:f,transposed:u},e[12]=y,e[13]=C,e[14]=N,e[15]=k,e[16]=S,e[17]=b,e[18]=f,e[19]=u,e[20]=w):w=e[20],w};function pl(s){return s!==""}function bl(s){return!s}const hl=Ee(pe.describeTable),xl=Ee(pe.readTablePage),vl=Ee(pe.importShard),wl=s=>{const e=s._id??s.id??s.__id__??"";return typeof e=="string"?e:typeof e=="number"?String(e):""},yl=s=>{const e=Object.values(s.inserted).reduce((a,i)=>a+i,0),[n]=s.errors;if(n===void 0)return{conflicts:s.conflicts,error:void 0,inserted:e};const o=s.errors.length-1,t=e+s.conflicts+s.errors.length,c=o===1?"error":"errors",l=o>0?` (+${o.toString()} more ${c})`:"",r=`Inserted ${e.toString()} of ${t.toString()} rows — row ${n.line.toString()} (${n.table}): ${n.message}${l}`;return{conflicts:s.conflicts,error:r,inserted:e}},Cl=s=>{const e=at(),[n,o]=D(!1),[t,c]=D(void 0),[l,r]=D(void 0),[a,i]=D(void 0),[m,f]=D({}),[p,b]=D(!1),[u,g]=D(void 0),h=async(C,N)=>{o(!0),c(C),r(N),i(void 0),f({}),g(void 0),b(!0);try{const k=await e.query(hl,{table:C},Te(N)),{columns:S}=k;i(S);const w={},T=S.filter(I=>I.ref!==void 0&&I.type==="id"&&I.pk!==!0);for(const I of T){if(I.ref===void 0)continue;const{ref:R}=I;if(w[R]===void 0)try{const _=await e.query(xl,{filters:[],limit:Ls,offset:0,search:"",table:R},Te(N));w[R]=_.rows.flatMap($=>wl($)||[])}catch{w[R]=[]}}f(w)}catch(k){g(k.message)}b(!1)};return{closeDialog:()=>{o(!1),c(void 0),r(void 0),i(void 0),f({}),g(void 0)},columnMeta:a,error:u,fkPools:m,insertBatch:async(C,N)=>{if(t===void 0||l===void 0)return{conflicts:0,error:"No table selected.",inserted:0};try{const k=await e.query(vl,{rows:C.map(w=>({doc:w,table:t}))},Te(l)),S=yl(k);return S.error!==void 0||(N(),s()),S}catch(k){return{conflicts:0,error:k.message,inserted:0}}},loading:p,open:n,openDialog:(C,N)=>{Ne(h(C,N))},shardKey:l,table:t}},Nl=()=>{const s=B(6),[e,n]=D(null);let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{n(null)},s[0]=o):o=s[0];const t=o,[c,l]=D(null);let r;s[1]===Symbol.for("react.memo_cache_sentinel")?(r=(p,b)=>{l({column:p,value:b})},s[1]=r):r=s[1];const a=r;let i;s[2]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{l(null)},s[2]=i):i=s[2];const m=i;let f;return s[3]!==c||s[4]!==e?(f={closeExpandedCell:m,closeInspect:t,expandedCell:c,inspecting:e,onExpandCell:a,onInspect:n},s[3]=c,s[4]=e,s[5]=f):f=s[5],f},Sl=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,kl=(s,e)=>typeof e=="number"&&Sl.test(s),Tl=s=>{const e=B(36),{column:n,masked:o,onNavigate:t,target:c,value:l}=s;let r;e[0]!==t||e[1]!==c||e[2]!==l?(r=()=>{c!==void 0&&t(c,String(l))},e[0]=t,e[1]=c,e[2]=l,e[3]=r):r=e[3];const a=r;if(l==null){let f;return e[4]===Symbol.for("react.memo_cache_sentinel")?(f=d("span",{className:"italic text-muted-foreground",children:"null"}),e[4]=f):f=e[4],f}if(o){const f=`rd-masked-${n}`;let p;e[5]!==l?(p=Oe(l),e[5]=l,e[6]=p):p=e[6];let b;return e[7]!==f||e[8]!==p?(b=d("span",{className:"italic text-muted-foreground","data-testid":f,title:"Masked (preview)",children:p}),e[7]=f,e[8]=p,e[9]=b):b=e[9],b}if(c!==void 0&&(typeof l=="string"||typeof l=="number")&&String(l)!==""){const f=`rd-ref-${n}`,p=`Open ${c} ${String(l)}`,b=String(l);let u;return e[10]!==a||e[11]!==f||e[12]!==p||e[13]!==b?(u=E("button",{"data-testid":f,onClick:a,title:p,type:"button",children:[b," ↗"]}),e[10]=a,e[11]=f,e[12]=p,e[13]=b,e[14]=u):u=e[14],u}if(kl(n,l)){const f=`rd-ts-${n}`;let p;e[15]!==l?(p=l.toString(),e[15]=l,e[16]=p):p=e[16];let b;e[17]!==l?(b=zn(l),e[17]=l,e[18]=b):b=e[18];let u;return e[19]!==f||e[20]!==p||e[21]!==b?(u=d("span",{"data-testid":f,title:p,children:b}),e[19]=f,e[20]=p,e[21]=b,e[22]=u):u=e[22],u}if(l instanceof ArrayBuffer||ArrayBuffer.isView(l)){const f=`rd-bytes-${n}`;let p;e[23]!==l?(p=Oe(l),e[23]=l,e[24]=p):p=e[24];let b;return e[25]!==f||e[26]!==p?(b=d("span",{"data-testid":f,children:p}),e[25]=f,e[26]=p,e[27]=b):b=e[27],b}if(typeof l=="object"){let f;e[28]!==l?(f=JSON.stringify(l,en,2),e[28]=l,e[29]=f):f=e[29];let p;return e[30]!==f?(p=d("pre",{className:"m-0 overflow-auto rounded-md bg-muted/50 p-2 text-xs",children:f}),e[30]=f,e[31]=p):p=e[31],p}let i;e[32]!==l?(i=Oe(l),e[32]=l,e[33]=i):i=e[33];let m;return e[34]!==i?(m=d("span",{children:i}),e[34]=i,e[35]=m):m=e[35],m},El=s=>{const e=B(23),{columns:n,mask:o,onClose:t,onNavigate:c,refs:l,row:r}=s;let a;e[0]!==t||e[1]!==c?(a=(g,h)=>{c(g,h),t()},e[0]=t,e[1]=c,e[2]=a):a=e[2];const i=a;let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=d("h3",{className:"m-0 text-base text-foreground",children:"Row detail"}),e[3]=m):m=e[3];let f;e[4]!==t?(f=E("div",{className:"mb-3 flex items-center justify-between",children:[m,d("button",{"data-testid":"rd-close",onClick:t,type:"button",children:"Close"})]}),e[4]=t,e[5]=f):f=e[5];let p;if(e[6]!==n||e[7]!==o||e[8]!==i||e[9]!==l||e[10]!==r){let g;e[12]!==o||e[13]!==i||e[14]!==l||e[15]!==r?(g=h=>E("div",{className:"border-t border-border py-2 first:border-t-0","data-testid":`rd-field-${h}`,children:[d("dt",{className:"mb-0.5 text-xs font-semibold text-muted-foreground",children:h}),d("dd",{className:"m-0",children:d(Tl,{column:h,masked:o.enabled&&o.columns.has(h),onNavigate:i,target:l?.[h],value:r[h]})})]},h),e[12]=o,e[13]=i,e[14]=l,e[15]=r,e[16]=g):g=e[16],p=n.map(g),e[6]=n,e[7]=o,e[8]=i,e[9]=l,e[10]=r,e[11]=p}else p=e[11];let b;e[17]!==p?(b=d("dl",{"data-testid":"rd-fields",children:p}),e[17]=p,e[18]=b):b=e[18];let u;return e[19]!==t||e[20]!==f||e[21]!==b?(u=E(it,{label:"Row detail",onClose:t,panelTestId:"rd-panel",testId:"rd-overlay",variant:"drawer",children:[f,b]}),e[19]=t,e[20]=f,e[21]=b,e[22]=u):u=e[22],u},_l=50,Rl=s=>{const e=B(8),{active:n,onPick:o,shard:t}=s;let c;e[0]!==o||e[1]!==t?(c=()=>{o(t)},e[0]=o,e[1]=t,e[2]=c):c=e[2];const l=c,r=`w-full rounded px-2 py-0.5 text-left text-xs transition-colors hover:bg-accent ${n?"bg-accent font-medium":""}`,a=`shard-explorer-item-${t}`;let i;return e[3]!==l||e[4]!==t||e[5]!==r||e[6]!==a?(i=d("button",{className:r,"data-testid":a,onClick:l,type:"button",children:t}),e[3]=l,e[4]=t,e[5]=r,e[6]=a,e[7]=i):i=e[7],i},$l=({onFetchTables:s,onSelect:e})=>{const n=xe(),[o]=D(()=>Co()),[t,c]=D(!1),[l,r]=D(void 0),[a,i]=D(void 0),[m,f]=D(!1),[p,b]=D(void 0),u=Ge(0),g=()=>{c(v=>!v)},h=async v=>{e(v),r(v),i(void 0),b(void 0),f(!0),u.current+=1;const y=u.current;try{const C=await s(v);u.current===y&&i(C?.slice(0,_l))}catch(C){u.current===y&&b(C.message)}u.current===y&&f(!1)},x=v=>{Ne(h(v))};return o.length===0?null:E("div",{"data-testid":"shard-explorer",children:[E("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:g,type:"button",children:[n("Shards seen"),d("span",{"aria-hidden":"true",className:`ml-0.5 transition-transform ${t?"rotate-180":""}`,children:"▾"})]}),t&&E("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:[d("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-hint",children:n("Recently visited shards — click to switch")}),d("ul",{className:"flex flex-col gap-0.5","data-testid":"shard-explorer-list",children:o.map(v=>d("li",{children:d(Rl,{active:l===v,onPick:x,shard:v})},v))}),l!==void 0&&E("div",{className:"mt-1 border-t border-border pt-1","data-testid":"shard-explorer-summary",children:[d("p",{className:"mb-1 text-xs font-medium text-foreground","data-testid":"shard-explorer-summary-title",children:n("{shard} tables",{shard:l})}),m&&d("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-loading",children:n("Loading…")}),p!==void 0&&d("p",{className:"text-xs text-destructive","data-testid":"shard-explorer-error",role:"alert",children:p}),!m&&p===void 0&&a?.length===0&&d("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-empty",children:n("No tables in this shard.")}),!m&&p===void 0&&a!==void 0&&a.length>0&&d("ul",{className:"flex flex-col gap-0.5","data-testid":"shard-explorer-tables",children:a.map(v=>E("li",{className:"flex items-center justify-between text-xs",children:[d("span",{"data-testid":`shard-explorer-table-${v.name}`,children:v.name}),d("span",{className:"text-muted-foreground","data-testid":`shard-explorer-rowcount-${v.name}`,children:v.rowCount})]},v.name))})]})]})]})},Dl="lunora-studio-back-relations",Pl=s=>new Set((s??[]).filter(e=>e.unique===!0&&e.fields.length===1).map(e=>e.fields[0]??"")),Al={},Il=50,Fl=[],Ol=Ee(pe.listTables),Ml=Ee(pe.readTablePage),Ll=s=>{const e=B(10),{onFetchShardTables:n,onShardChange:o,schemaSwitch:t,shardKey:c}=s;let l;e[0]!==o||e[1]!==c?(l=d(Bn,{onChange:o,testId:"db-shard-input",value:c}),e[0]=o,e[1]=c,e[2]=l):l=e[2];let r;e[3]!==n||e[4]!==o?(r=d($l,{onFetchTables:n,onSelect:o}),e[3]=n,e[4]=o,e[5]=r):r=e[5];let a;return e[6]!==t||e[7]!==l||e[8]!==r?(a=E("div",{className:"flex shrink-0 flex-col items-stretch gap-2 border-b border-border p-3",children:[t,l,r]}),e[6]=t,e[7]=l,e[8]=r,e[9]=a):a=e[9],a},br=({editable:s=!1,globalTableNames:e,initialFilters:n,initialOrderBy:o,initialPins:t,initialSearch:c,initialShardKey:l,onNavigateToGlobal:r,onSelectTable:a,onViewChange:i,pageSize:m=Il,queryBar:f,schemaSwitch:p,tableParam:b})=>{const u=Xe(pe.describeTables,{},{shardKey:l??""}),g=Xe(pe.listTablesIndexes,{},{shardKey:l??""}),h=u.data?.columnsByTable??Al,[x,v]=Zt(Dl,{}),y=lt(L=>{const se=new Set(x[L]);return qt(L,h).filter(_e=>se.has(Dt(_e)))},[x,h]),C=fl({initialFilters:n,initialOrderBy:o,initialSearch:c,initialShardKey:l,onSelectTable:a,onViewChange:i,pageSize:m,resolveBackRelations:y,tableParam:b}),{cancelCellEdit:N,columns:k,currentView:S,editableColumn:w,editingCell:T,facetFilter:I,facets:R,loadTables:_,navigateToRef:$,onFiltersChange:A,page:M,pageError:F,previewRef:q,queryShardKey:G,selectedTable:O,selectTable:V,setShardKey:J,shardKey:j,stage:Y,stagedValue:U,startCellEdit:H,tables:te,tablesError:le,toggleFacet:ue}=C,fe=Hn(j),ge=L=>{Ne((async()=>{const _e=await fe.suggestFilter(L,O??"");_e!==void 0&&A(_e.map(Ie=>{const Le=Ie.value,xt=typeof Le=="string"||typeof Le=="number"||typeof Le=="boolean"?String(Le):"";return{column:Ie.column,operator:Ie.operator,value:xt}}))})())},ae=O===null?[]:qt(O,h),me=new Set(x[O??""]),ie=[];for(const L of M?.rows??[]){const se=L._id??L.id;typeof se=="string"&&se!==""&&ie.push(se)}const Q=Js(me,ae,ie,G),be=L=>{v(se=>{const _e=O??"",Ie=se[_e]??[];return{...se,[_e]:Ie.includes(L)?Ie.filter(Le=>Le!==L):[...Ie,L]}})},Z=gl({columns:k,initialPins:t,selectedTable:O}),ve=Nl(),[ce,de]=D(null),{closeExpandedCell:W,closeInspect:K,expandedCell:ee,inspecting:X,onExpandCell:he}=ve,re=at(),we=Object.fromEntries((h[O??""]??[]).map(L=>[L.name,L])),ye=new Map;for(const L of h[O??""]??[])L.isStorage===!0&&ye.set(L.name,L.bucket);const ne=lt(async(L,se)=>re.signedStorageUrl(L,se===void 0?{}:{bucket:se}),[re]),Me=async L=>await re.query(Ol,{},Te(L)),Ce=()=>{O!==null&&V(O)},{closeDialog:oe,columnMeta:Ae,fkPools:We,insertBatch:ke,open:ze,openDialog:je}=Cl(Ce),He=()=>{O!==null&&je(O,j)},et=L=>ke(L,oe),[ct,tt]=D(!1),dt=()=>{tt(!0)},ut=()=>{tt(!1)},Ue=(L,se)=>{if(r!==void 0&&e?.has(L)===!0){r(L,se);return}$(L,se)},Qe=f?.onSaveQuery,ft=L=>{Qe?.(L,S)},mt={cancelEdit:N,editable:s,editableColumn:w,editingCell:T,onExpandCell:he,stage:Y,stagedValue:U,startEdit:H},gt=L=>{L!==null&&de(L)},pt=()=>{C.onRowDelete(ce)},bt=async(L,se,_e)=>await re.query(Ml,{filters:[{column:se,operator:"eq",value:_e}],limit:ot,offset:0,orderBy:[],table:L},Te(G)),ht={columns:M?.refs,maskViewFor:Z.maskViewFor,onNavigate:Ue,onPreview:q};return E("div",{className:"flex h-full min-w-0","data-testid":"lunora-data-browser",children:[d(Jn,{header:d(Ll,{onFetchShardTables:Me,onShardChange:J,schemaSwitch:p,shardKey:j}),onReload:_,onSelect:V,prefix:"db",selected:O,tables:te??Fl}),E("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[le!==null&&d("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"db-tables-error",role:"alert",children:le}),M===null&&F===null&&d("div",{className:"flex flex-1 items-center justify-center p-6",children:d("p",{className:"text-sm text-muted-foreground",children:"Select a table to browse its rows."})}),F!==null&&d("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}),M!==null&&d(Os,{assistant:fe,backRelations:{available:ae,counts:Q,enabled:me,onToggle:be},browser:C,columnMeta:we,edit:mt,editable:s,onAskAiFilter:ge,onInspect:ve.onInspect,onOpenBulkPatch:dt,onOpenGenerateRows:He,onRowDelete:gt,onSaveQuery:ft,page:M,preferences:Z,queryBar:f,references:ht})]}),M!==null&&d(Wn,{columns:k,facets:R,mask:Z.maskView,onFacetFilter:I,onToggleFacet:ue}),X!==null&&M!==null&&d(El,{columns:M.columns,mask:Z.maskView,onClose:K,onNavigate:Ue,refs:M.refs,row:tn(X,Z.maskView)}),ce!==null&&O!==null&&d(Fo,{onClose:()=>{de(null)},onConfirm:pt,readPage:bt,rowId:ce,schema:No(h),table:O}),ee!==null&&d(vo,{bucket:ye.get(ee.column),column:ee.column,onClose:W,resolveUrl:ye.has(ee.column)?ne:void 0,value:ee.value}),ct&&O!==null&&d(To,{columns:C.columns.filter(L=>C.editableColumn(L)),onApply:C.bulkPatch,onClose:ut,shardKey:C.queryShardKey,table:O,total:C.total,uniqueColumns:Pl(g.data?.indexesByTable[O])}),ze&&O!==null&&Ae!==void 0&&d(Ks,{columns:Ae,fkPools:We,onClose:oe,onInsertRows:et,table:O})]})};export{br as DataBrowser};
@@ -1,3 +0,0 @@
1
- import{c as $}from"react/compiler-runtime";import{useNavigate as Ge}from"@tanstack/react-router";import{useState as Pe,useEffect as qe,Suspense as et,lazy as tt}from"react";import{B as Je}from"./badge-r_5B4LHP.mjs";import{C as F,a as Ye}from"./card--2hKx4L2.mjs";import{E as st}from"./empty-state-D7jEML_T.mjs";import{u as ve}from"./use-admin-query-CR9mHt0P.mjs";import{useT as I}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as ye}from"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{c as nt,f as Ne,d as lt,w as at,g as rt,l as ot}from"./internal-CyDwqA67.mjs";import{c as Ze}from"./utils-bhneXptQ.mjs";import{deriveInsights as it}from"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{useLunora as Ue}from"@lunora/react";import{jsx as l,jsxs as h}from"react/jsx-runtime";import{B as ze}from"./button-q0UYSmrn.mjs";const ct=nt(ye.studioFeatures),Xe={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},dt=t=>{if(t===null||typeof t!="object")return Xe;const e=t,n=s=>typeof e[s]=="boolean"?e[s]:!0;return{analytics:n("analytics"),auth:n("auth"),containers:n("containers"),flags:n("flags"),kv:n("kv"),mail:n("mail"),notifications:n("notifications"),payments:n("payments"),queues:n("queues"),scheduler:n("scheduler"),storage:n("storage"),vectors:n("vectors"),workflows:n("workflows")}},ut=()=>{const t=$(3),e=Ue(),[n,s]=Pe(Xe);let r,a;return t[0]!==e?(r=()=>{Ne((async()=>{try{s(dt(await e.query(ct,{},lt(""))))}catch{}})())},a=[e],t[0]=e,t[1]=r,t[2]=a):(r=t[1],a=t[2]),qe(r,a),n},mt=()=>{const t=$(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:l("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},ft=t=>{const e=$(24),{group:n}=t,s=I(),r=Ge();let a;e[0]!==n.tab||e[1]!==r?(a=()=>{Ne(r({to:`/${n.tab}`}))},e[0]=n.tab,e[1]=r,e[2]=a):a=e[2];const i=a,o=n.bindings.length;let c;e[3]!==n.label?(c=l("span",{className:"text-sm font-medium text-foreground",children:n.label}),e[3]=n.label,e[4]=c):c=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=l(mt,{}),e[5]=u):u=e[5];let m;e[6]!==c?(m=h("div",{className:"flex items-center justify-between",children:[c,u]}),e[6]=c,e[7]=m):m=e[7];let d;e[8]!==o||e[9]!==s?(d=o===1?s("1 binding"):s("{count} bindings",{count:o}),e[8]=o,e[9]=s,e[10]=d):d=e[10];let f;e[11]!==d?(f=l("span",{className:"text-xs text-muted-foreground",children:d}),e[11]=d,e[12]=f):f=e[12];let p;e[13]!==o||e[14]!==n.bindings?(p=o>0&&l("div",{className:"flex flex-wrap gap-1.5",children:n.bindings.map(gt)}),e[13]=o,e[14]=n.bindings,e[15]=p):p=e[15];let g;e[16]!==m||e[17]!==f||e[18]!==p?(g=h(Ye,{className:"flex flex-col gap-2 py-4",children:[m,f,p]}),e[16]=m,e[17]=f,e[18]=p,e[19]=g):g=e[19];let x;return e[20]!==n.testId||e[21]!==i||e[22]!==g?(x=l(F,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":n.testId,onClick:i,children:g}),e[20]=n.testId,e[21]=i,e[22]=g,e[23]=x):x=e[23],x},Ve=["kv","files","vectors"],pt=(t,e)=>[...t.filter(n=>n.tab!==e.tab),e].toSorted((n,s)=>Ve.indexOf(n.tab)-Ve.indexOf(s.tab)),ht=()=>{const t=$(19),e=Ue(),n=ut(),s=I();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=[],t[0]=r):r=t[0];const[a,i]=Pe(r);let o,c;if(t[1]!==e||t[2]!==n.kv||t[3]!==n.storage||t[4]!==n.vectors||t[5]!==s?(o=()=>{const g={cancelled:!1},x=[{enabled:n.kv,label:s("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(xt),tab:"kv",testId:"home-binding-kv"},{enabled:n.storage,label:s("R2 Buckets"),load:()=>e.listStorageBuckets(),tab:"files",testId:"home-binding-r2"},{enabled:n.vectors,label:s("Vectorize Indexes"),load:async()=>(await e.listVectorIndexes()).map(bt),tab:"vectors",testId:"home-binding-vectors"}];for(const b of x)b.enabled&&Ne((async()=>{try{const v=await b.load();if(!g.cancelled){const _={bindings:v,label:b.label,tab:b.tab,testId:b.testId};i(S=>pt(S,_))}}catch{}})());return()=>{g.cancelled=!0}},c=[e,n.kv,n.storage,n.vectors,s],t[1]=e,t[2]=n.kv,t[3]=n.storage,t[4]=n.vectors,t[5]=s,t[6]=o,t[7]=c):(o=t[6],c=t[7]),qe(o,c),a.length===0)return null;let u;t[8]!==s?(u=s("Bindings"),t[8]=s,t[9]=u):u=t[9];let m;t[10]!==u?(m=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:u}),t[10]=u,t[11]=m):m=t[11];let d;t[12]!==a?(d=a.map(yt),t[12]=a,t[13]=d):d=t[13];let f;t[14]!==d?(f=l("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:d}),t[14]=d,t[15]=f):f=t[15];let p;return t[16]!==m||t[17]!==f?(p=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[m,f]}),t[16]=m,t[17]=f,t[18]=p):p=t[18],p};function gt(t){return l(Je,{variant:"secondary",children:t},t)}function xt(t){return t.binding}function bt(t){return t.name}function yt(t){return l(ft,{group:t},t.tab)}const vt=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation — writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action — writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],Nt=t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),_t=t=>{const e=vt.map(n=>`- ${n.name} — ${n.summary}`).join(`
2
- `);return[`You have a Lunora MCP server connected to the deployment at ${t}.`,"It exposes this backend's functions and schema so you can inspect and operate it:",e,"",`Start by calling lunora_list_functions and lunora_list_tables to learn what exists, then lunora_get_function_schema before any run call. The full HTTP API is also documented at ${t}/_lunora/admin/openapi (that endpoint needs the same admin token the MCP server is configured with).`].join(`
3
- `)},St=1500,kt=()=>{const t=$(40),e=I(),{url:n}=Ue();let s;t[0]!==n?(s=at(n),t[0]=n,t[1]=s):s=t[1];const r=s,[a,i]=Pe(null);let o,c;t[2]!==a?(o=()=>{if(a===null)return;const M=globalThis.setTimeout(()=>{i(null)},St);return()=>{globalThis.clearTimeout(M)}},c=[a],t[2]=a,t[3]=o,t[4]=c):(o=t[3],c=t[4]),qe(o,c);let u;t[5]===Symbol.for("react.memo_cache_sentinel")?(u=(M,T)=>{rt(T)&&i(M)},t[5]=u):u=t[5];const m=u;let d;t[6]!==r?(d=()=>{m("config",Nt(r))},t[6]=r,t[7]=d):d=t[7];const f=d;let p;t[8]!==r?(p=()=>{m("prompt",_t(r))},t[8]=r,t[9]=p):p=t[9];const g=p;let x;t[10]!==e?(x=e("Connect an AI agent"),t[10]=e,t[11]=x):x=t[11];let b;t[12]!==x?(b=l("span",{className:"text-sm font-medium text-foreground",children:x}),t[12]=x,t[13]=b):b=t[13];let v;t[14]!==e?(v=e("Drive this deployment from an AI agent over the Model Context Protocol — it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[14]=e,t[15]=v):v=t[15];let _;t[16]!==v?(_=l("span",{className:"text-xs text-muted-foreground",children:v}),t[16]=v,t[17]=_):_=t[17];let S;t[18]!==b||t[19]!==_?(S=h("div",{className:"flex flex-col gap-1.5 p-4",children:[b,_]}),t[18]=b,t[19]=_,t[20]=S):S=t[20];let L;t[21]===Symbol.for("react.memo_cache_sentinel")?(L=l("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[21]=L):L=t[21];let y;t[22]!==a||t[23]!==e?(y=e(a==="config"?"Copied":"Copy MCP config"),t[22]=a,t[23]=e,t[24]=y):y=t[24];let k;t[25]!==f||t[26]!==y?(k=l(ze,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:y}),t[25]=f,t[26]=y,t[27]=k):k=t[27];let w;t[28]!==a||t[29]!==e?(w=e(a==="prompt"?"Copied":"Copy agent prompt"),t[28]=a,t[29]=e,t[30]=w):w=t[30];let C;t[31]!==g||t[32]!==w?(C=l(ze,{"data-testid":"home-connect-agent-copy-prompt",onClick:g,size:"xs",variant:"outline",children:w}),t[31]=g,t[32]=w,t[33]=C):C=t[33];let N;t[34]!==k||t[35]!==C?(N=h("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[L,h("div",{className:"flex flex-wrap gap-2",children:[k,C]})]}),t[34]=k,t[35]=C,t[36]=N):N=t[36];let A;return t[37]!==S||t[38]!==N?(A=h(F,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[S,N]}),t[37]=S,t[38]=N,t[39]=A):A=t[39],A},wt=tt(()=>import("../packem_chunks/sparkline.mjs")),Ct=(t,e)=>{if(e==null)return t("cache not enabled");const n=e.hits+e.misses;return n===0?t("no cache traffic yet"):`${Math.round(e.hits/n*100).toString()}% ${t("cache hit")}`},De=t=>{if(t<1e3)return`${String(Math.round(t))}ms`;const e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},$t=(t,e)=>{const n=Math.max(0,Math.round((e-t)/1e3));if(n<60)return`${String(n)}s ago`;const s=Math.round(n/60);if(s<60)return`${String(s)}m ago`;const r=Math.round(s/60);return r<24?`${String(r)}h ago`:`${String(Math.round(r/24))}d ago`},We=(t,e)=>{if(t===void 0||t.length===0)return[];const n=new Map;for(const s of t)n.set(s.bucketMs,(n.get(s.bucketMs)??0)+s[e]);return[...n.entries()].toSorted(([s],[r])=>s-r).map(([,s])=>s)},Qe=(t,e=!0)=>{if(t.length<4)return null;const n=Math.floor(t.length/2),s=t.slice(0,n).reduce((i,o)=>i+o,0),r=t.slice(n).reduce((i,o)=>i+o,0);if(s===0)return null;const a=(r-s)/s*100;return{positive:e?a>=0:a<=0,text:`${a>=0?"+":""}${a.toFixed(1)}%`}},Te=t=>{const e=$(24),{delta:n,footer:s,label:r,trend:a,unit:i,value:o}=t,c=I();let u;e[0]!==r?(u=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=u):u=e[1];let m;e[2]!==o?(m=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:o}),e[2]=o,e[3]=m):m=e[3];let d;e[4]!==i?(d=i!==void 0&&l("span",{className:"text-xs text-muted-foreground",children:i}),e[4]=i,e[5]=d):d=e[5];let f;e[6]!==m||e[7]!==d?(f=h("span",{className:"flex items-baseline gap-1.5",children:[m,d]}),e[6]=m,e[7]=d,e[8]=f):f=e[8];let p;e[9]!==a?(p=a!==void 0&&l(et,{fallback:l("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:l(wt,{data:a})}),e[9]=a,e[10]=p):p=e[10];let g;e[11]!==f||e[12]!==p?(g=h("div",{className:"flex items-center justify-between gap-3",children:[f,p]}),e[11]=f,e[12]=p,e[13]=g):g=e[13];let x;e[14]!==u||e[15]!==g?(x=h("div",{className:"flex flex-col gap-2.5 p-4",children:[u,g]}),e[14]=u,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==n||e[18]!==s||e[19]!==c?(b=n==null?s!=null&&l("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:s}):h("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[l("span",{className:Ze("font-semibold",n.positive?"text-success":"text-destructive"),children:n.text})," ",l("span",{className:"text-muted-foreground",children:c("vs. prev.")})]}),e[17]=n,e[18]=s,e[19]=c,e[20]=b):b=e[20];let v;return e[21]!==x||e[22]!==b?(v=h(F,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=v):v=e[23],v},At=()=>{const t=$(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:l("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},je=t=>{const e=$(7),{command:n,label:s}=t;let r;e[0]!==s?(r=l("div",{className:"p-4",children:l("span",{className:"text-sm font-medium text-foreground",children:s})}),e[0]=s,e[1]=r):r=e[1];let a;e[2]!==n?(a=l("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:l("code",{className:"font-mono text-xs text-muted-foreground",children:n})}),e[2]=n,e[3]=a):a=e[3];let i;return e[4]!==r||e[5]!==a?(i=h(F,{className:"justify-between gap-0 py-0",children:[r,a]}),e[4]=r,e[5]=a,e[6]=i):i=e[6],i},He=t=>{const e=$(18),{count:n,onView:s,testId:r,title:a}=t,i=I();let o;e[0]!==a?(o=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[0]=a,e[1]=o):o=e[1];let c;e[2]!==n||e[3]!==i?(c=n===null?l("span",{className:"text-xs text-muted-foreground",children:i("No data yet")}):l(Je,{variant:n>0?"destructive":"success",children:n>0?n:i("All clear")}),e[2]=n,e[3]=i,e[4]=c):c=e[4];let u;e[5]!==o||e[6]!==c?(u=h("div",{className:"flex items-start justify-between gap-2 p-4",children:[o,c]}),e[5]=o,e[6]=c,e[7]=u):u=e[7];let m;e[8]!==i?(m=i("View"),e[8]=i,e[9]=m):m=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=l(At,{}),e[10]=d):d=e[10];let f;e[11]!==s||e[12]!==m?(f=h("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:s,type:"button",children:[m,d]}),e[11]=s,e[12]=m,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f||e[16]!==r?(p=h(F,{className:"justify-between gap-0 py-0","data-testid":r,children:[u,f]}),e[14]=u,e[15]=f,e[16]=r,e[17]=p):p=e[17],p},Lt=t=>{const e=$(7),{functions:n}=t,s=I();let r;if(e[0]!==n||e[1]!==s){const a=[...n].toSorted(Ot).slice(0,5);let i;e[3]!==s?(i=s("Top functions"),e[3]=s,e[4]=i):i=e[4];let o;e[5]!==i?(o=l("div",{className:"border-b border-border px-4 py-3",children:l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i})}),e[5]=i,e[6]=o):o=e[6],r=h(F,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[o,a.length===0?l("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:s("No functions called yet.")}):h("div",{className:"divide-y divide-border",children:[h("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[l("span",{children:s("Function")}),l("span",{className:"text-end",children:s("Calls")}),l("span",{className:"w-12 text-end",children:s("Avg")}),l("span",{className:"w-8 text-end",children:s("Err")})]}),a.map(Rt)]})]}),e[0]=n,e[1]=s,e[2]=r}else r=e[2];return r},Mt=t=>{const e=$(26),{subs:n}=t,s=I();let r;e[0]!==s?(r=s("Live connections"),e[0]=s,e[1]=r):r=e[1];let a;e[2]!==r?(a=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[2]=r,e[3]=a):a=e[3];const i=n?.totalConnections??0;let o;e[4]!==i?(o=i.toLocaleString(),e[4]=i,e[5]=o):o=e[5];let c;e[6]!==o?(c=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:o}),e[6]=o,e[7]=c):c=e[7];let u;e[8]!==s?(u=s("sockets"),e[8]=s,e[9]=u):u=e[9];let m;e[10]!==u?(m=l("span",{className:"text-xs text-muted-foreground",children:u}),e[10]=u,e[11]=m):m=e[11];let d;e[12]!==c||e[13]!==m?(d=h("span",{className:"flex items-baseline gap-1.5",children:[c,m]}),e[12]=c,e[13]=m,e[14]=d):d=e[14];const f=n?.totalSubscriptions??0;let p;e[15]!==f?(p=f.toLocaleString(),e[15]=f,e[16]=p):p=e[16];let g;e[17]!==s?(g=s("active subscriptions"),e[17]=s,e[18]=g):g=e[18];let x;e[19]!==p||e[20]!==g?(x=h("span",{className:"text-[11px] text-muted-foreground",children:[p," ",g]}),e[19]=p,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==a||e[24]!==d?(b=l(F,{"data-testid":"home-live-connections",children:h(Ye,{className:"flex flex-col gap-2.5 py-4",children:[a,d,x]})}),e[22]=x,e[23]=a,e[24]=d,e[25]=b):b=e[25],b},It=t=>{const e=$(7),{entries:n}=t,s=I();let r;if(e[0]!==n||e[1]!==s){const a=Date.now();let i;e[3]!==s?(i=s("Recent activity"),e[3]=s,e[4]=i):i=e[4];let o;e[5]!==i?(o=l("div",{className:"border-b border-border px-4 py-3",children:l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i})}),e[5]=i,e[6]=o):o=e[6],r=h(F,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[o,n.length===0?l("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:s("No recent activity.")}):l("ul",{className:"divide-y divide-border",children:n.slice(0,5).map(c=>h("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[h("span",{className:"flex min-w-0 items-center gap-2",children:[l("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),h("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&h("span",{className:"text-muted-foreground",children:[" · ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),l("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:$t(c.ts,a)})]},c.seq))})]}),e[0]=n,e[1]=s,e[2]=r}else r=e[2];return r},Tt=t=>{const e=t.reduce((n,s)=>n+s.calls,0);return e===0?null:t.reduce((n,s)=>n+s.totalDurationMs,0)/e},Yt=t=>{const e=$(149),{initialShardKey:n}=t,s=I(),r=Ge(),a=n??"";let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let o;e[1]!==a?(o={shardKey:a},e[1]=a,e[2]=o):o=e[2];const c=ve(ye.getMetrics,i,o);let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u={},e[3]=u):u=e[3];let m;e[4]!==a?(m={shardKey:a},e[4]=a,e[5]=m):m=e[5];const d=ve(ye.getFunctionStats,u,m);let f,p;e[6]===Symbol.for("react.memo_cache_sentinel")?(f={},p={shardKey:""},e[6]=f,e[7]=p):(f=e[6],p=e[7]);const g=ve(ye.getSecurityAudit,f,p);let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==a?(b={shardKey:a},e[9]=a,e[10]=b):b=e[10];const v=ve(ye.listSubscriptions,x,b);let _;e[11]===Symbol.for("react.memo_cache_sentinel")?(_={},e[11]=_):_=e[11];let S;e[12]!==a?(S={shardKey:a},e[12]=a,e[13]=S):S=e[13];const L=ve(ye.getAuditLog,_,S),y=c.data??null;let k,w,C,N,A,M,T,O,R,j,D,P,E,B,q,U,K,z;if(e[14]!==L.data||e[15]!==g.data||e[16]!==y||e[17]!==c.data||e[18]!==r||e[19]!==d.data||e[20]!==v.data||e[21]!==s){N=Array.isArray(d.data?.functions)?d.data.functions:[],T=v.data??null;let we;e[40]!==L.data?(we=Array.isArray(L.data?.entries)?L.data.entries:[],e[40]=L.data,e[41]=we):we=e[41],w=we,A=c.data===void 0||d.data===void 0?null:it(y,N).length,M=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Ce;e[42]!==r?(Ce=()=>{Ne(r({to:"/security"}))},e[42]=r,e[43]=Ce):Ce=e[43],z=Ce;let $e;e[44]!==r?($e=()=>{Ne(r({to:"/insights"}))},e[44]=r,e[45]=$e):$e=e[45],K=$e;const Ae=We(y?.history,"calls"),Le=We(y?.history,"errors"),Ke=Tt(N),Me=Math.max(0,...N.map(Et));let Ie;e[46]!==y||e[47]!==s?(Ie=y===null?void 0:Ct(s,y.cache),e[46]=y,e[47]=s,e[48]=Ie):Ie=e[48],C=Ie,q="flex flex-col gap-6",U="lunora-home",D="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",P="home-health";const Re=Qe(Ae);let he;e[49]!==s?(he=s("Requests"),e[49]=s,e[50]=he):he=e[50];const Ee=y?.requests??0;let ge;e[51]!==Ee?(ge=Ee.toLocaleString(),e[51]=Ee,e[52]=ge):ge=e[52],e[53]!==Ae||e[54]!==Re||e[55]!==he||e[56]!==ge?(E=l(Te,{delta:Re,label:he,trend:Ae,value:ge}),e[53]=Ae,e[54]=Re,e[55]=he,e[56]=ge,e[57]=E):E=e[57];const Be=Qe(Le,!1);let xe;e[58]!==s?(xe=s("Errors"),e[58]=s,e[59]=xe):xe=e[59];const Fe=y?.errors??0;let be;e[60]!==Fe?(be=Fe.toLocaleString(),e[60]=Fe,e[61]=be):be=e[61],e[62]!==Le||e[63]!==Be||e[64]!==xe||e[65]!==be?(B=l(Te,{delta:Be,label:xe,trend:Le,value:be}),e[62]=Le,e[63]=Be,e[64]=xe,e[65]=be,e[66]=B):B=e[66],k=Te,e[67]!==Me||e[68]!==s?(O=Me>0?`${s("max")} ${De(Me)}`:void 0,e[67]=Me,e[68]=s,e[69]=O):O=e[69],e[70]!==s?(R=s("Avg latency"),e[70]=s,e[71]=R):R=e[71],j=Ke===null?"—":De(Ke),e[14]=L.data,e[15]=g.data,e[16]=y,e[17]=c.data,e[18]=r,e[19]=d.data,e[20]=v.data,e[21]=s,e[22]=k,e[23]=w,e[24]=C,e[25]=N,e[26]=A,e[27]=M,e[28]=T,e[29]=O,e[30]=R,e[31]=j,e[32]=D,e[33]=P,e[34]=E,e[35]=B,e[36]=q,e[37]=U,e[38]=K,e[39]=z}else k=e[22],w=e[23],C=e[24],N=e[25],A=e[26],M=e[27],T=e[28],O=e[29],R=e[30],j=e[31],D=e[32],P=e[33],E=e[34],B=e[35],q=e[36],U=e[37],K=e[38],z=e[39];let V;e[72]!==k||e[73]!==O||e[74]!==R||e[75]!==j?(V=l(k,{footer:O,label:R,value:j}),e[72]=k,e[73]=O,e[74]=R,e[75]=j,e[76]=V):V=e[76];let W;e[77]!==s?(W=s("Database size"),e[77]=s,e[78]=W):W=e[78];const Oe=y?.databaseSize??null;let Q;e[79]!==Oe?(Q=ot(Oe),e[79]=Oe,e[80]=Q):Q=e[80];let H;e[81]!==C||e[82]!==W||e[83]!==Q?(H=l(Te,{footer:C,label:W,value:Q}),e[81]=C,e[82]=W,e[83]=Q,e[84]=H):H=e[84];let G;e[85]!==D||e[86]!==P||e[87]!==E||e[88]!==B||e[89]!==V||e[90]!==H?(G=h("div",{className:D,"data-testid":P,children:[E,B,V,H]}),e[85]=D,e[86]=P,e[87]=E,e[88]=B,e[89]=V,e[90]=H,e[91]=G):G=e[91];let _e;e[92]===Symbol.for("react.memo_cache_sentinel")?(_e=l(ht,{}),e[92]=_e):_e=e[92];let J;e[93]!==N?(J=l("div",{className:"lg:col-span-2",children:l(Lt,{functions:N})}),e[93]=N,e[94]=J):J=e[94];let Y;e[95]!==T?(Y=l(Mt,{subs:T}),e[95]=T,e[96]=Y):Y=e[96];let Z;e[97]!==w?(Z=l(It,{entries:w}),e[97]=w,e[98]=Z):Z=e[98];let X;e[99]!==Y||e[100]!==Z?(X=h("div",{className:"flex flex-col gap-3",children:[Y,Z]}),e[99]=Y,e[100]=Z,e[101]=X):X=e[101];let ee;e[102]!==J||e[103]!==X?(ee=h("div",{className:"grid gap-3 lg:grid-cols-3",children:[J,X]}),e[102]=J,e[103]=X,e[104]=ee):ee=e[104];let te;e[105]!==s?(te=s("Advisors"),e[105]=s,e[106]=te):te=e[106];let se;e[107]!==te?(se=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:te}),e[107]=te,e[108]=se):se=e[108];let ne;e[109]!==A||e[110]!==M||e[111]!==s||e[112]!==K||e[113]!==z?(ne=M===0&&A===0?l(st,{description:s("No security or performance issues detected."),icon:h("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[l("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),l("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:s("No issues found")}):h("div",{className:"grid gap-3 sm:grid-cols-2",children:[l(He,{count:M,onView:z,testId:"home-security",title:s("Security findings")}),l(He,{count:A,onView:K,testId:"home-performance",title:s("Performance issues")})]}),e[109]=A,e[110]=M,e[111]=s,e[112]=K,e[113]=z,e[114]=ne):ne=e[114];let le;e[115]!==se||e[116]!==ne?(le=h("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[se,ne]}),e[115]=se,e[116]=ne,e[117]=le):le=e[117];let ae;e[118]!==s?(ae=s("Get connected"),e[118]=s,e[119]=ae):ae=e[119];let re;e[120]!==ae?(re=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ae}),e[120]=ae,e[121]=re):re=e[121];let oe;e[122]!==s?(oe=s("Client SDK"),e[122]=s,e[123]=oe):oe=e[123];let ie;e[124]!==oe?(ie=l(je,{command:"npm i @lunora/client",label:oe}),e[124]=oe,e[125]=ie):ie=e[125];let ce;e[126]!==s?(ce=s("React"),e[126]=s,e[127]=ce):ce=e[127];let de;e[128]!==ce?(de=l(je,{command:"npm i @lunora/react",label:ce}),e[128]=ce,e[129]=de):de=e[129];let ue;e[130]!==s?(ue=s("CLI"),e[130]=s,e[131]=ue):ue=e[131];let me;e[132]!==ue?(me=l(je,{command:"lunora dev",label:ue}),e[132]=ue,e[133]=me):me=e[133];let fe;e[134]!==ie||e[135]!==de||e[136]!==me?(fe=h("div",{className:"grid gap-3 sm:grid-cols-3",children:[ie,de,me]}),e[134]=ie,e[135]=de,e[136]=me,e[137]=fe):fe=e[137];let Se;e[138]===Symbol.for("react.memo_cache_sentinel")?(Se=l(kt,{}),e[138]=Se):Se=e[138];let pe;e[139]!==re||e[140]!==fe?(pe=h("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[re,fe,Se]}),e[139]=re,e[140]=fe,e[141]=pe):pe=e[141];let ke;return e[142]!==q||e[143]!==U||e[144]!==G||e[145]!==ee||e[146]!==le||e[147]!==pe?(ke=h("div",{className:q,"data-testid":U,children:[G,_e,ee,le,pe]}),e[142]=q,e[143]=U,e[144]=G,e[145]=ee,e[146]=le,e[147]=pe,e[148]=ke):ke=e[148],ke};function Ot(t,e){return e.calls-t.calls}function Rt(t){return h("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[l("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),l("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),l("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:De(t.calls>0?t.totalDurationMs/t.calls:0)}),l("span",{className:Ze("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}function Et(t){return t.maxDurationMs}export{Yt as H,Ct as c,ut as u};
@@ -1,2 +0,0 @@
1
- 'use client';
2
- import{c as k}from"react/compiler-runtime";import{createRootRoute as ts,createRoute as Pt,createBrowserHistory as ss,createMemoryHistory as as,createRouter as os,useNavigate as Et,useSearch as ns,RouterProvider as rs,useRouterState as ls,Outlet as is}from"@tanstack/react-router";import*as rt from"react";import{use as St,createContext as It,useState as dt,useEffect as lt,useSyncExternalStore as ds,lazy as A,Suspense as cs}from"react";import{c as L}from"./utils-bhneXptQ.mjs";import{jsx as n,jsxs as w,Fragment as $t}from"react/jsx-runtime";import{ErrorBoundary as us}from"./ErrorBoundary-BWNF98VF.mjs";import{O as ms,u as fs}from"./operation-console-provider-DoloEvon.mjs";import{useT as te}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{LunoraError as Ht}from"@lunora/errors";import{B as ct}from"./badge-r_5B4LHP.mjs";import{I as Bt}from"./input-CXhxesPC.mjs";import{Popover as it}from"@base-ui/react/popover";import{Cancel01Icon as hs,SidebarLeftIcon as ps}from"@hugeicons/core-free-icons";import{HugeiconsIcon as zt}from"@hugeicons/react";import{mergeProps as Vt}from"@base-ui/react/merge-props";import{useRender as Ot}from"@base-ui/react/use-render";import{cva as gs}from"class-variance-authority";import{B as Dt}from"./button-q0UYSmrn.mjs";import{Dialog as ae}from"@base-ui/react/dialog";import{Tooltip as se}from"@base-ui/react/tooltip";import{S as yt}from"./skeleton-DX1gfixl.mjs";import{H as bs,u as vs}from"./home-panel-B_HN6YMA.mjs";import{g as xs,f as Mt}from"./internal-CyDwqA67.mjs";import{o as pt}from"./use-admin-query-CR9mHt0P.mjs";import{StudioI18nProvider as ys}from"./StudioI18nProvider-fVsCSs5L.mjs";import{v as ws,a as ks}from"./data-view-params-DhYmAkcj.mjs";import{CommandPalette as Ms,openCommandPalette as Ns}from"./CommandPalette-D7GxhPrH.mjs";import{motion as Ss}from"motion/react";import{u as Cs}from"./shortcuts-B9gDaXmw.mjs";const Zt="(prefers-color-scheme: dark)",Ft=()=>{try{return globalThis.localStorage}catch{return}},Ps=t=>t==="system"||t==="light"||t==="dark",qt=()=>globalThis.matchMedia,Wt="lunora-studio-theme",wt=["system","light","dark"],_s=(t="system")=>{try{const e=Ft()?.getItem(Wt);return Ps(e)?e:t}catch{return t}},_t=t=>{const e=Ft();if(e!==void 0)try{e.setItem(Wt,t)}catch{}},Ts=()=>{try{return qt()?.(Zt).matches?"dark":"light"}catch{return"light"}},Ls=(t,e)=>t==="system"?e:t,As=t=>{let e;try{e=qt()?.(Zt)}catch{e=void 0}if(e===void 0)return()=>{};const s=a=>{t(a.matches?"dark":"light")};return e.addEventListener("change",s),()=>{e.removeEventListener("change",s)}},Ct=It(null),Rs=({children:t,defaultTheme:e="system"})=>{const[s,a]=dt(()=>_s(e)),[o,r]=dt(()=>Ts());lt(()=>As(r),[]);const l=u=>{_t(u),a(u)},d={cycleTheme:()=>{a(u=>{const c=wt[(wt.indexOf(u)+1)%wt.length]??u;return _t(c),c})},resolvedTheme:Ls(s,o),setTheme:l,systemTheme:o,theme:s};return n(Ct,{value:d,children:t})},Es=t=>{const e=k(3),{children:s}=t,a=St(Ct);let o;return e[0]!==s||e[1]!==a?(o=a===null?n(Rs,{children:s}):s,e[0]=s,e[1]=a,e[2]=o):o=e[2],o},Is=()=>{const t=St(Ct);if(t===null)throw new Ht("INTERNAL","useTheme must be used within a <ThemeProvider>");return t};function vn({delay:t=0,...e}){return n(se.Provider,{"data-slot":"tooltip-provider",delay:t,...e})}function $s(t){const e=k(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a=n(se.Root,{"data-slot":"tooltip",...s}),e[2]=s,e[3]=a):a=e[3],a}function Hs(t){const e=k(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a=n(se.Trigger,{"data-slot":"tooltip-trigger",...s}),e[2]=s,e[3]=a):a=e[3],a}function Bs({className:t,side:e="top",sideOffset:s=4,align:a="center",alignOffset:o=0,children:r,...l}){return n(se.Portal,{children:n(se.Positioner,{align:a,alignOffset:o,side:e,sideOffset:s,className:"isolate z-50",children:w(se.Popup,{"data-slot":"tooltip-content",className:L("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pe-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-md data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 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",t),...l,children:[r,n(se.Arrow,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-md bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-start-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-end-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const zs=t=>{const e=k(5),{className:s}=t;let a;e[0]!==s?(a=L("h-full w-full text-foreground",s),e[0]=s,e[1]=a):a=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=n("path",{d:"M 259.500 10.552 C 220.080 15.859, 182.424 32.566, 152.500 58.025 C 110.179 94.031, 85.380 137.183, 77.518 188.500 C 75.410 202.255, 74.569 225.677, 75.796 236.466 C 76.757 244.917, 76.683 245.692, 74.518 249.966 C 63.118 272.466, 53.141 303.876, 51.382 322.799 L 50.718 329.943 71.960 320.471 C 83.643 315.262, 93.326 311, 93.478 311 C 93.630 311, 96.547 316.063, 99.959 322.250 C 103.371 328.438, 107.249 334.850, 108.577 336.500 L 110.990 339.500 110.981 336 C 110.977 334.075, 111.499 324.991, 112.143 315.813 L 113.312 299.127 121.406 293.336 C 132.495 285.403, 149.593 271.554, 161 261.268 C 171.556 251.748, 189.116 235, 188.540 235 C 188.337 235, 183.069 238.648, 176.835 243.106 C 142.318 267.789, 68.537 314, 63.646 314 C 61.843 314, 72.791 281.179, 80.905 262.259 C 92.233 235.845, 107.473 212.389, 132.106 183.453 L 138.451 176 148.268 176 C 176.192 176, 197.512 187.154, 212.868 209.797 C 216.470 215.108, 217.035 216.595, 216.477 219.297 C 211.386 243.968, 202.359 274.496, 193.797 296 C 183.898 320.861, 167.147 352.101, 152.395 373.215 L 147.004 380.930 152.891 385.830 C 161.400 392.911, 165.563 396, 166.594 395.998 C 167.092 395.998, 168.772 391.641, 170.327 386.317 C 176.279 365.934, 188.422 338.749, 200.942 317.778 C 223.060 280.731, 256.432 244.369, 294.500 215.836 C 309.956 204.252, 313.937 201.603, 314.719 202.385 C 315.116 202.783, 315.449 213.096, 315.460 225.304 C 315.474 241.855, 315.021 250.405, 313.680 258.924 C 307.009 301.272, 291.175 336.677, 263.112 372 C 255.259 381.883, 227.182 410.673, 218.516 417.727 L 213.532 421.783 223.439 424.880 C 281.705 443.093, 349.165 436.018, 398.616 406.508 C 446.728 377.797, 483.322 331.466, 497.366 281.481 C 503.381 260.075, 504.480 250.741, 504.491 221 C 504.501 191.997, 503.598 184.047, 497.987 163.732 C 484.768 115.871, 452.505 72.708, 407.718 42.964 C 381.051 25.254, 352.818 14.828, 319.695 10.460 C 305.932 8.645, 273.298 8.695, 259.500 10.552",fillRule:"evenodd"}),e[2]=o):o=e[2];let r;return e[3]!==a?(r=n("svg",{"aria-hidden":"true",className:a,fill:"currentColor",viewBox:"0 0 543 446",children:o}),e[3]=a,e[4]=r):r=e[4],r},jt="lunora.studio.rulesBannerDismissed",Vs=()=>{try{return globalThis.localStorage.getItem(jt)==="1"}catch{return!1}},Os=()=>{try{globalThis.localStorage.setItem(jt,"1")}catch{}},Ds=()=>{const t=k(18),e=te(),[s,a]=dt(Zs);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(!0),Os()},t[0]=o):o=t[0];const r=o;if(s)return null;let l;t[1]===Symbol.for("react.memo_cache_sentinel")?(l=n("span",{"aria-hidden":"true",className:"text-warning",children:"⚠"}),t[1]=l):l=t[1];let i;t[2]!==e?(i=e("Lunora AI rules aren't installed."),t[2]=e,t[3]=i):i=t[3];let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d=n("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px]",children:"lunora rules install"}),t[4]=d):d=t[4];let u;t[5]!==e?(u=e("lets your coding agent use Lunora correctly."),t[5]=e,t[6]=u):u=t[6];let c;t[7]!==i||t[8]!==u?(c=w("span",{children:[i," ",d," ",u]}),t[7]=i,t[8]=u,t[9]=c):c=t[9];let f;t[10]!==e?(f=e("Dismiss"),t[10]=e,t[11]=f):f=t[11];let p;t[12]===Symbol.for("react.memo_cache_sentinel")?(p=n("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:n("path",{d:"M18 6 6 18M6 6l12 12"})}),t[12]=p):p=t[12];let m;t[13]!==f?(m=n("button",{"aria-label":f,className:"ms-auto flex size-5 items-center justify-center rounded text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent","data-testid":"dash-app-rules-banner-dismiss",onClick:r,type:"button",children:p}),t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==c||t[16]!==m?(h=w("div",{className:"flex shrink-0 items-center gap-2 border-b border-warning/30 bg-warning/10 px-6 py-2 text-[12px] text-foreground","data-testid":"dash-app-rules-banner",role:"note",children:[l,c,m]}),t[15]=c,t[16]=m,t[17]=h):h=t[17],h};function Zs(){return Vs()}function Ut(t){const e=k(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a=n(it.Root,{"data-slot":"popover",...s}),e[2]=s,e[3]=a):a=e[3],a}function Gt(t){const e=k(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a=n(it.Trigger,{"data-slot":"popover-trigger",...s}),e[2]=s,e[3]=a):a=e[3],a}function Kt({align:t="end",alignOffset:e=0,className:s,keepMounted:a=!1,side:o="bottom",sideOffset:r=6,...l}){return n(it.Portal,{keepMounted:a,children:n(it.Positioner,{align:t,alignOffset:e,className:"isolate z-50 outline-none",side:o,sideOffset:r,children:n(it.Popup,{className:L("z-50 w-72 origin-(--transform-origin) rounded-lg border border-border bg-popover p-3 text-popover-foreground shadow-md 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",s),"data-slot":"popover-content",...l})})})}const kt=768;function Fs(){const t=k(2),[e,s]=dt(void 0);let a,o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{const r=globalThis.matchMedia(`(max-width: ${kt-1}px)`),l=()=>{s(globalThis.innerWidth<kt)};return r.addEventListener("change",l),s(globalThis.innerWidth<kt),()=>{r.removeEventListener("change",l)}},o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),lt(a,o),!!e}function qs(t){const e=k(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a=n(ae.Root,{"data-slot":"sheet",...s}),e[2]=s,e[3]=a):a=e[3],a}function Ws(t){const e=k(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a=n(ae.Portal,{"data-slot":"sheet-portal",...s}),e[2]=s,e[3]=a):a=e[3],a}function js(t){const e=k(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=L("fixed inset-0 z-50 bg-black/10 text-xs/relaxed transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:",s),e[3]=s,e[4]=o):o=e[4];let r;return e[5]!==a||e[6]!==o?(r=n(ae.Backdrop,{"data-slot":"sheet-overlay",className:o,...a}),e[5]=a,e[6]=o,e[7]=r):r=e[7],r}function Us({className:t,children:e,side:s="right",showCloseButton:a=!0,...o}){return w(Ws,{children:[n(js,{}),w(ae.Popup,{"data-slot":"sheet-content","data-side":s,className:L("fixed z-50 flex flex-col bg-popover bg-clip-padding text-xs/relaxed text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-e data-[side=left]:data-ending-style:translate-x-[-2.5rem] rtl:data-[side=left]:data-ending-style:-translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] rtl:data-[side=left]:data-starting-style:-translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-s data-[side=right]:data-ending-style:translate-x-[2.5rem] rtl:data-[side=right]:data-ending-style:-translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] rtl:data-[side=right]:data-starting-style:-translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",t),...o,children:[e,a&&w(ae.Close,{"data-slot":"sheet-close",render:n(Dt,{variant:"ghost",className:"absolute top-3 end-3",size:"icon-sm"}),children:[n(zt,{icon:hs,strokeWidth:2}),n("span",{className:"sr-only",children:"Close"})]})]})]})}function Gs(t){const e=k(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=L("flex flex-col gap-0.5 p-4",s),e[3]=s,e[4]=o):o=e[4];let r;return e[5]!==a||e[6]!==o?(r=n("div",{"data-slot":"sheet-header",className:o,...a}),e[5]=a,e[6]=o,e[7]=r):r=e[7],r}function Ks(t){const e=k(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=L("text-sm font-medium text-foreground",s),e[3]=s,e[4]=o):o=e[4];let r;return e[5]!==a||e[6]!==o?(r=n(ae.Title,{"data-slot":"sheet-title",className:o,...a}),e[5]=a,e[6]=o,e[7]=r):r=e[7],r}function Qs(t){const e=k(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=L("text-xs/relaxed text-muted-foreground",s),e[3]=s,e[4]=o):o=e[4];let r;return e[5]!==a||e[6]!==o?(r=n(ae.Description,{"data-slot":"sheet-description",className:o,...a}),e[5]=a,e[6]=o,e[7]=r):r=e[7],r}const Ys="sidebar_state",Js=3600*24*7,Xs="16rem",ea="18rem",ta="3rem",sa="b",Qt=rt.createContext(null);function gt(){const t=rt.useContext(Qt);if(!t)throw new Ht("INTERNAL","useSidebar must be used within a SidebarProvider.");return t}function aa({defaultOpen:t=!0,open:e,onOpenChange:s,className:a,style:o,children:r,...l}){const i=Fs(),[d,u]=rt.useState(!1),[c,f]=rt.useState(t),p=e??c,m=g=>{const v=typeof g=="function"?g(p):g;s?s(v):f(v),document.cookie=`${Ys}=${v}; path=/; max-age=${Js}`},h=()=>i?u(g=>!g):m(g=>!g),b=rt.useEffectEvent(()=>{h()});rt.useEffect(()=>{const g=v=>{v.key===sa&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),b())};return globalThis.addEventListener("keydown",g),()=>globalThis.removeEventListener("keydown",g)},[]);const y={state:p?"expanded":"collapsed",open:p,setOpen:m,isMobile:i,openMobile:d,setOpenMobile:u,toggleSidebar:h};return n(Qt.Provider,{value:y,children:n("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Xs,"--sidebar-width-icon":ta,...o},className:L("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",a),...l,children:r})})}function oa({side:t="left",variant:e="sidebar",collapsible:s="offcanvas",className:a,children:o,dir:r,...l}){const{isMobile:i,state:d,openMobile:u,setOpenMobile:c}=gt();return s==="none"?n("div",{"data-slot":"sidebar",className:L("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",a),...l,children:o}):i?n(qs,{open:u,onOpenChange:c,...l,children:w(Us,{dir:r,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":ea},side:t,children:[w(Gs,{className:"sr-only",children:[n(Ks,{children:"Sidebar"}),n(Qs,{children:"Displays the mobile sidebar."})]}),n("div",{className:"flex h-full w-full flex-col",children:o})]})}):w("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":d,"data-collapsible":d==="collapsed"?s:"","data-variant":e,"data-side":t,"data-slot":"sidebar",children:[n("div",{"data-slot":"sidebar-gap",className:L("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",e==="floating"||e==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),n("div",{"data-slot":"sidebar-container","data-side":t,className:L("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",e==="floating"||e==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-e group-data-[side=right]:border-s",a),...l,children:n("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-none group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:o})})]})}function na(t){const e=k(15);let s,a,o;e[0]!==t?({className:s,onClick:a,...o}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=o):(s=e[1],a=e[2],o=e[3]);const{toggleSidebar:r}=gt();let l;e[4]!==s?(l=L(s),e[4]=s,e[5]=l):l=e[5];let i;e[6]!==a||e[7]!==r?(i=f=>{a?.(f),r()},e[6]=a,e[7]=r,e[8]=i):i=e[8];let d,u;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=n(zt,{icon:ps,strokeWidth:2,className:"rtl:rotate-180"}),u=n("span",{className:"sr-only",children:"Toggle Sidebar"}),e[9]=d,e[10]=u):(d=e[9],u=e[10]);let c;return e[11]!==o||e[12]!==l||e[13]!==i?(c=w(Dt,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:l,onClick:i,...o,children:[d,u]}),e[11]=o,e[12]=l,e[13]=i,e[14]=c):c=e[14],c}function ra(t){const e=k(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=L("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ms-0 md:peer-data-[variant=inset]:rounded-none md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ms-2",s),e[3]=s,e[4]=o):o=e[4];let r;return e[5]!==a||e[6]!==o?(r=n("main",{"data-slot":"sidebar-inset",className:o,...a}),e[5]=a,e[6]=o,e[7]=r):r=e[7],r}function la(t){const e=k(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=L("flex flex-col gap-2 p-2",s),e[3]=s,e[4]=o):o=e[4];let r;return e[5]!==a||e[6]!==o?(r=n("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:o,...a}),e[5]=a,e[6]=o,e[7]=r):r=e[7],r}function ia(t){const e=k(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=L("flex flex-col gap-2 p-2",s),e[3]=s,e[4]=o):o=e[4];let r;return e[5]!==a||e[6]!==o?(r=n("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:o,...a}),e[5]=a,e[6]=o,e[7]=r):r=e[7],r}function da(t){const e=k(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=L("flex min-h-0 flex-1 flex-col gap-0 overflow-x-hidden overflow-y-auto [scrollbar-color:color-mix(in_oklch,var(--muted-foreground)_25%,transparent)_transparent] [scrollbar-width:thin] [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-muted-foreground/25 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar]:w-1.5 hover:[scrollbar-color:color-mix(in_oklch,var(--muted-foreground)_50%,transparent)_transparent] hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/50",s),e[3]=s,e[4]=o):o=e[4];let r;return e[5]!==a||e[6]!==o?(r=n("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:o,...a}),e[5]=a,e[6]=o,e[7]=r):r=e[7],r}function ca(t){const e=k(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=L("relative flex w-full min-w-0 flex-col p-2",s),e[3]=s,e[4]=o):o=e[4];let r;return e[5]!==a||e[6]!==o?(r=n("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:o,...a}),e[5]=a,e[6]=o,e[7]=r):r=e[7],r}function ua(t){const e=k(10);let s,a,o,r;if(e[0]!==t){const{className:d,render:u,...c}=t;s=u,r=Ot,a="div",o=Vt({className:L("flex h-8 shrink-0 items-center rounded-none px-2 text-xs text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",d)},c),e[0]=t,e[1]=s,e[2]=a,e[3]=o,e[4]=r}else s=e[1],a=e[2],o=e[3],r=e[4];let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l={slot:"sidebar-group-label",sidebar:"group-label"},e[5]=l):l=e[5];let i;return e[6]!==s||e[7]!==a||e[8]!==o?(i={defaultTagName:a,props:o,render:s,state:l},e[6]=s,e[7]=a,e[8]=o,e[9]=i):i=e[9],r(i)}function ma(t){const e=k(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=L("w-full text-xs",s),e[3]=s,e[4]=o):o=e[4];let r;return e[5]!==a||e[6]!==o?(r=n("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:o,...a}),e[5]=a,e[6]=o,e[7]=r):r=e[7],r}function Tt(t){const e=k(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=L("flex w-full min-w-0 flex-col gap-0",s),e[3]=s,e[4]=o):o=e[4];let r;return e[5]!==a||e[6]!==o?(r=n("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:o,...a}),e[5]=a,e[6]=o,e[7]=r):r=e[7],r}function Lt(t){const e=k(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=L("group/menu-item relative",s),e[3]=s,e[4]=o):o=e[4];let r;return e[5]!==a||e[6]!==o?(r=n("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:o,...a}),e[5]=a,e[6]=o,e[7]=r):r=e[7],r}const fa=gs("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-none p-2 text-start text-xs ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pe-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-xs",sm:"h-7 text-xs",lg:"h-12 text-xs group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function Yt({render:t,isActive:e=!1,variant:s="default",size:a="default",tooltip:o,className:r,...l}){const{isMobile:i,state:d}=gt(),u=Ot({defaultTagName:"button",props:Vt({className:L(fa({variant:s,size:a}),r)},l),render:o?n(Hs,{render:t}):t,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:a,active:e}});return o?(typeof o=="string"&&(o={children:o}),w($s,{children:[u,n(Bs,{side:"right",align:"center",hidden:d!=="collapsed"||i,...o})]})):u}const ha=t=>t.replace("__lunora_admin__:",""),pa=()=>ds(pt.subscribe,pt.getSnapshot,pt.getSnapshot),ga=t=>t==="error"?"destructive":t==="pending"?"secondary":"default",ba=t=>{const e=k(56),{entry:s,focused:a}=t,o=te();let r;e[0]!==a?(r=I=>{I!==null&&a&&I.scrollIntoView({block:"nearest"})},e[0]=a,e[1]=r):r=e[1];const l=r;let i;e[2]!==s.functionPath||e[3]!==s.shardKey||e[4]!==s.summary?(i=()=>{xs(`${s.functionPath} ${s.summary}${s.shardKey===""?"":` (shard ${s.shardKey})`}`)},e[2]=s.functionPath,e[3]=s.shardKey,e[4]=s.summary,e[5]=i):i=e[5];const d=i,u=a&&"bg-accent ring-1 ring-inset ring-primary/40";let c;e[6]!==u?(c=L("border-b border-border/60 last:border-b-0",u),e[6]=u,e[7]=c):c=e[7];let f;e[8]!==s.status?(f=ga(s.status),e[8]=s.status,e[9]=f):f=e[9];const p=s.status==="pending"?"…":s.status;let m;e[10]!==f||e[11]!==p?(m=n(ct,{className:"mt-px shrink-0",variant:f,children:p}),e[10]=f,e[11]=p,e[12]=m):m=e[12];let h;e[13]!==s.functionPath?(h=ha(s.functionPath),e[13]=s.functionPath,e[14]=h):h=e[14];let b;e[15]!==h?(b=n("span",{className:"shrink-0 font-mono text-[11px] text-foreground",children:h}),e[15]=h,e[16]=b):b=e[16];let x;e[17]!==s.kind||e[18]!==o?(x=s.kind==="subscription"&&n(ct,{className:"shrink-0",variant:"outline",children:o("live")}),e[17]=s.kind,e[18]=o,e[19]=x):x=e[19];let y;e[20]!==s.summary?(y=s.summary!==""&&n("span",{className:"min-w-0 truncate text-muted-foreground",children:s.summary}),e[20]=s.summary,e[21]=y):y=e[21];let g;e[22]!==s.shardKey?(g=s.shardKey!==""&&n("span",{className:"font-mono",children:s.shardKey}),e[22]=s.shardKey,e[23]=g):g=e[23];let v;e[24]!==s.resultCount||e[25]!==o?(v=s.resultCount!==void 0&&n("span",{children:o("{count} rows",{count:s.resultCount})}),e[24]=s.resultCount,e[25]=o,e[26]=v):v=e[26];let N;e[27]!==s.pushes||e[28]!==o?(N=s.pushes!==void 0&&s.pushes>0&&n("span",{children:o("{count} pushes",{count:s.pushes})}),e[27]=s.pushes,e[28]=o,e[29]=N):N=e[29];let S;e[30]!==s.durationMs?(S=s.durationMs!==void 0&&w("span",{children:[s.durationMs,"ms"]}),e[30]=s.durationMs,e[31]=S):S=e[31];let P;e[32]!==o?(P=o("Copy"),e[32]=o,e[33]=P):P=e[33];let M;e[34]!==d||e[35]!==P?(M=n("button",{"aria-label":P,className:"rounded px-1 outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"oc-copy",onClick:d,type:"button",children:"⧉"}),e[34]=d,e[35]=P,e[36]=M):M=e[36];let T;e[37]!==g||e[38]!==v||e[39]!==N||e[40]!==S||e[41]!==M?(T=w("span",{className:"ms-auto flex shrink-0 items-center gap-2 text-[11px] text-muted-foreground",children:[g,v,N,S,M]}),e[37]=g,e[38]=v,e[39]=N,e[40]=S,e[41]=M,e[42]=T):T=e[42];let _;e[43]!==x||e[44]!==y||e[45]!==T||e[46]!==m||e[47]!==b?(_=w("div",{className:"flex items-start gap-2 px-3 py-1.5 text-xs",children:[m,b,x,y,T]}),e[43]=x,e[44]=y,e[45]=T,e[46]=m,e[47]=b,e[48]=_):_=e[48];let C;e[49]!==s.error?(C=s.error!==void 0&&n("p",{className:"px-3 pb-1.5 font-mono text-[11px] text-destructive","data-testid":"oc-error",children:s.error}),e[49]=s.error,e[50]=C):C=e[50];let R;return e[51]!==l||e[52]!==_||e[53]!==C||e[54]!==c?(R=w("li",{className:c,"data-testid":"oc-row",ref:l,children:[_,C]}),e[51]=l,e[52]=_,e[53]=C,e[54]=c,e[55]=R):R=e[55],R},va=t=>{const e=k(62),{focusSeq:s,onClose:a,onShownChange:o,shown:r}=t,l=te(),i=pa(),[d,u]=dt("");let c;if(e[0]!==i||e[1]!==s||e[2]!==d||e[3]!==a||e[4]!==o||e[5]!==r||e[6]!==l){const f=d.trim().toLowerCase(),p=i.filter($=>(r==="errors"?$.status==="error":!0)&&(f===""||`${$.functionPath} ${$.summary} ${$.shardKey}`.toLowerCase().includes(f))).toReversed();let m;e[8]!==i?(m=i.filter(xa),e[8]=i,e[9]=m):m=e[9];const h=m.length;let b;e[10]!==l?(b=l("Operation console"),e[10]=l,e[11]=b):b=e[11];let x;e[12]!==l?(x=l("Operation console"),e[12]=l,e[13]=x):x=e[13];let y;e[14]!==x?(y=n("span",{className:"text-xs font-medium",children:x}),e[14]=x,e[15]=y):y=e[15];let g;e[16]!==i.length||e[17]!==l?(g=l("{count} calls",{count:i.length}),e[16]=i.length,e[17]=l,e[18]=g):g=e[18];let v;e[19]!==g?(v=n(ct,{variant:"secondary",children:g}),e[19]=g,e[20]=v):v=e[20];let N;e[21]!==h||e[22]!==l?(N=h>0&&n(ct,{variant:"destructive",children:l("{count} failed",{count:h})}),e[21]=h,e[22]=l,e[23]=N):N=e[23];const S=r==="errors",P=r==="errors"&&"bg-accent";let M;e[24]!==P?(M=L("rounded px-2 py-0.5 text-xs outline-none hover:bg-accent focus-visible:bg-accent",P),e[24]=P,e[25]=M):M=e[25];let T;e[26]!==o||e[27]!==r?(T=()=>{o(r==="errors"?"all":"errors")},e[26]=o,e[27]=r,e[28]=T):T=e[28];let _;e[29]!==l?(_=l("Errors"),e[29]=l,e[30]=_):_=e[30];let C;e[31]!==M||e[32]!==T||e[33]!==_||e[34]!==S?(C=n("button",{"aria-pressed":S,className:M,"data-testid":"oc-filter-errors",onClick:T,type:"button",children:_}),e[31]=M,e[32]=T,e[33]=_,e[34]=S,e[35]=C):C=e[35];let R;e[36]!==l?(R=l("Filter"),e[36]=l,e[37]=R):R=e[37];let I;e[38]===Symbol.for("react.memo_cache_sentinel")?(I=$=>{u($.target.value)},e[38]=I):I=e[38];let H;e[39]!==l?(H=l("Filter"),e[39]=l,e[40]=H):H=e[40];let V;e[41]!==d||e[42]!==R||e[43]!==H?(V=n(Bt,{"aria-label":R,className:"h-7 w-40 text-xs","data-testid":"oc-search",onChange:I,placeholder:H,value:d}),e[41]=d,e[42]=R,e[43]=H,e[44]=V):V=e[44];let O;e[45]!==l?(O=l("Clear"),e[45]=l,e[46]=O):O=e[46];let B;e[47]!==O?(B=n("button",{className:"ms-auto rounded px-2 py-0.5 text-xs text-muted-foreground outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"oc-clear",onClick:ya,type:"button",children:O}),e[47]=O,e[48]=B):B=e[48];let z;e[49]!==l?(z=l("Hide"),e[49]=l,e[50]=z):z=e[50];let D;e[51]!==a||e[52]!==z?(D=n("button",{"aria-label":z,className:"rounded px-2 py-0.5 text-xs text-muted-foreground outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"oc-close",onClick:a,type:"button",children:"✕"}),e[51]=a,e[52]=z,e[53]=D):D=e[53];let F;e[54]!==C||e[55]!==V||e[56]!==B||e[57]!==D||e[58]!==y||e[59]!==v||e[60]!==N?(F=w("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",children:[y,v,N,C,V,B,D]}),e[54]=C,e[55]=V,e[56]=B,e[57]=D,e[58]=y,e[59]=v,e[60]=N,e[61]=F):F=e[61],c=w("section",{"aria-label":b,className:"flex max-h-80 flex-col border-t border-border bg-card","data-testid":"lunora-operation-console",children:[F,p.length===0?n("p",{className:"p-3 text-xs text-muted-foreground","data-testid":"oc-empty",children:l("Every admin call this studio makes is recorded here.")}):n("ul",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"oc-rows",children:p.map($=>n(ba,{entry:$,focused:$.seq===s},$.seq))})]}),e[0]=i,e[1]=s,e[2]=d,e[3]=a,e[4]=o,e[5]=r,e[6]=l,e[7]=c}else c=e[7];return c};function xa(t){return t.status==="error"}function ya(){pt.clear()}const wa=()=>{const t=k(316),e=te();let s;t[0]!==e?(s=e("Health score"),t[0]=e,t[1]=s):s=t[1];let a;t[2]!==e?(a=e("Agents"),t[2]=e,t[3]=a):a=t[3];let o;t[4]!==e?(o=e("Evals"),t[4]=e,t[5]=o):o=t[5];let r;t[6]!==e?(r=e("Analytics"),t[6]=e,t[7]=r):r=t[7];let l;t[8]!==e?(l=e("API"),t[8]=e,t[9]=l):l=t[9];let i;t[10]!==e?(i=e("Audit"),t[10]=e,t[11]=i):i=t[11];let d;t[12]!==e?(d=e("Auth audit"),t[12]=e,t[13]=d):d=t[13];let u;t[14]!==e?(u=e("Configuration"),t[14]=e,t[15]=u):u=t[15];let c;t[16]!==e?(c=e("Sessions"),t[16]=e,t[17]=c):c=t[17];let f;t[18]!==e?(f=e("Containers"),t[18]=e,t[19]=f):f=t[19];let p;t[20]!==e?(p=e("Dashboards"),t[20]=e,t[21]=p):p=t[21];let m;t[22]!==e?(m=e("Data"),t[22]=e,t[23]=m):m=t[23];let h;t[24]!==e?(h=e("Deployment health"),t[24]=e,t[25]=h):h=t[25];let b;t[26]!==e?(b=e("Log drains"),t[26]=e,t[27]=b):b=t[27];let x;t[28]!==e?(x=e("Export / Import"),t[28]=e,t[29]=x):x=t[29];let y;t[30]!==e?(y=e("Fan-out"),t[30]=e,t[31]=y):y=t[31];let g;t[32]!==e?(g=e("Files"),t[32]=e,t[33]=g):g=t[33];let v;t[34]!==e?(v=e("Flags"),t[34]=e,t[35]=v):v=t[35];let N;t[36]!==e?(N=e("Functions"),t[36]=e,t[37]=N):N=t[37];let S;t[38]!==e?(S=e("Health"),t[38]=e,t[39]=S):S=t[39];let P;t[40]!==e?(P=e("Home"),t[40]=e,t[41]=P):P=t[41];let M;t[42]!==e?(M=e("Performance"),t[42]=e,t[43]=M):M=t[43];let T;t[44]!==e?(T=e("Issues"),t[44]=e,t[45]=T):T=t[45];let _;t[46]!==e?(_=e("KV"),t[46]=e,t[47]=_):_=t[47];let C;t[48]!==e?(C=e("Logs"),t[48]=e,t[49]=C):C=t[49];let R;t[50]!==e?(R=e("Metrics"),t[50]=e,t[51]=R):R=t[51];let I;t[52]!==e?(I=e("Migrations"),t[52]=e,t[53]=I):I=t[53];let H;t[54]!==e?(H=e("Notifications"),t[54]=e,t[55]=H):H=t[55];let V;t[56]!==e?(V=e("Organizations"),t[56]=e,t[57]=V):V=t[57];let O;t[58]!==e?(O=e("Time Travel"),t[58]=e,t[59]=O):O=t[59];let B;t[60]!==e?(B=e("Mail"),t[60]=e,t[61]=B):B=t[61];let z;t[62]!==e?(z=e("Payments"),t[62]=e,t[63]=z):z=t[63];let D;t[64]!==e?(D=e("Permissions"),t[64]=e,t[65]=D):D=t[65];let F;t[66]!==e?(F=e("Queues"),t[66]=e,t[67]=F):F=t[67];let $;t[68]!==e?($=e("Reactors"),t[68]=e,t[69]=$):$=t[69];let q;t[70]!==e?(q=e("Realtime"),t[70]=e,t[71]=q):q=t[71];let ee;t[72]!==e?(ee=e("RLS Policies"),t[72]=e,t[73]=ee):ee=t[73];let W;t[74]!==e?(W=e("Scheduled"),t[74]=e,t[75]=W):W=t[75];let Y;t[76]!==e?(Y=e("Schema"),t[76]=e,t[77]=Y):Y=t[77];let j;t[78]!==e?(j=e("Security"),t[78]=e,t[79]=j):j=t[79];let U;t[80]!==e?(U=e("Settings"),t[80]=e,t[81]=U):U=t[81];let G;t[82]!==e?(G=e("SQL editor"),t[82]=e,t[83]=G):G=t[83];let K;t[84]!==e?(K=e("Traces"),t[84]=e,t[85]=K):K=t[85];let Q;t[86]!==e?(Q=e("Access Rules"),t[86]=e,t[87]=Q):Q=t[87];let J;t[88]!==e?(J=e("Users"),t[88]=e,t[89]=J):J=t[89];let Z;t[90]!==e?(Z=e("Vectors"),t[90]=e,t[91]=Z):Z=t[91];let X;t[92]!==e?(X=e("Workflows"),t[92]=e,t[93]=X):X=t[93];let ut;t[94]!==s||t[95]!==a||t[96]!==p||t[97]!==m||t[98]!==h||t[99]!==b||t[100]!==x||t[101]!==y||t[102]!==g||t[103]!==v||t[104]!==N||t[105]!==S||t[106]!==o||t[107]!==P||t[108]!==M||t[109]!==T||t[110]!==_||t[111]!==C||t[112]!==R||t[113]!==I||t[114]!==H||t[115]!==V||t[116]!==O||t[117]!==r||t[118]!==B||t[119]!==z||t[120]!==D||t[121]!==F||t[122]!==$||t[123]!==q||t[124]!==ee||t[125]!==W||t[126]!==Y||t[127]!==j||t[128]!==l||t[129]!==U||t[130]!==G||t[131]!==K||t[132]!==Q||t[133]!==J||t[134]!==Z||t[135]!==X||t[136]!==i||t[137]!==d||t[138]!==u||t[139]!==c||t[140]!==f?(ut={advisorHealth:s,agents:a,evals:o,analytics:r,api:l,audit:i,authAudit:d,authConfig:u,authSessions:c,containers:f,dashboards:p,data:m,deploymentHealth:h,drains:b,export:x,fanout:y,files:g,flags:v,functions:N,health:S,home:P,insights:M,issues:T,kv:_,logs:C,metrics:R,migrations:I,notifications:H,organizations:V,pitr:O,mail:B,payments:z,permissions:D,queues:F,reactors:$,realtime:q,rls:ee,schedule:W,schema:Y,security:j,settings:U,sql:G,traces:K,storageRules:Q,users:J,vectors:Z,workflows:X},t[94]=s,t[95]=a,t[96]=p,t[97]=m,t[98]=h,t[99]=b,t[100]=x,t[101]=y,t[102]=g,t[103]=v,t[104]=N,t[105]=S,t[106]=o,t[107]=P,t[108]=M,t[109]=T,t[110]=_,t[111]=C,t[112]=R,t[113]=I,t[114]=H,t[115]=V,t[116]=O,t[117]=r,t[118]=B,t[119]=z,t[120]=D,t[121]=F,t[122]=$,t[123]=q,t[124]=ee,t[125]=W,t[126]=Y,t[127]=j,t[128]=l,t[129]=U,t[130]=G,t[131]=K,t[132]=Q,t[133]=J,t[134]=Z,t[135]=X,t[136]=i,t[137]=d,t[138]=u,t[139]=c,t[140]=f,t[141]=ut):ut=t[141];const bt=ut;let oe;t[142]!==e?(oe=e("Advisors"),t[142]=e,t[143]=oe):oe=t[143];let ne;t[144]!==e?(ne=e("Auth"),t[144]=e,t[145]=ne):ne=t[145];let re;t[146]!==e?(re=e("Database"),t[146]=e,t[147]=re):re=t[147];let le;t[148]!==e?(le=e("Functions"),t[148]=e,t[149]=le):le=t[149];let ie;t[150]!==e?(ie=e("Observability"),t[150]=e,t[151]=ie):ie=t[151];let de;t[152]!==e?(de=e("Operations"),t[152]=e,t[153]=de):de=t[153];let ce;t[154]!==e?(ce=e("Overview"),t[154]=e,t[155]=ce):ce=t[155];let ue;t[156]!==e?(ue=e("Settings"),t[156]=e,t[157]=ue):ue=t[157];let me;t[158]!==e?(me=e("Storage"),t[158]=e,t[159]=me):me=t[159];let mt;t[160]!==oe||t[161]!==ne||t[162]!==re||t[163]!==le||t[164]!==ie||t[165]!==de||t[166]!==ce||t[167]!==ue||t[168]!==me?(mt={advisors:oe,auth:ne,database:re,functions:le,observability:ie,operations:de,overview:ce,settings:ue,storage:me},t[160]=oe,t[161]=ne,t[162]=re,t[163]=le,t[164]=ie,t[165]=de,t[166]=ce,t[167]=ue,t[168]=me,t[169]=mt):mt=t[169];const vt=mt;let fe;t[170]!==e?(fe=e("Score your app's advisor findings: a grade, the coverage split, and every procedure ranked worst-first."),t[170]=e,t[171]=fe):fe=t[171];let he;t[172]!==e?(he=e("Inspect agent threads, message timelines, tool calls, and token usage."),t[172]=e,t[173]=he):he=t[173];let pe;t[174]!==e?(pe=e("Scores recorded by recordEvaluation — the latest verdict per eval, its trend, and the graded runs behind it."),t[174]=e,t[175]=pe):pe=t[175];let ge;t[176]!==e?(ge=e("Usage and latency from Analytics Engine — request volume, p50/p95, and hot shards."),t[176]=e,t[177]=ge):ge=t[177];let be;t[178]!==e?(be=e("Interactive OpenAPI reference and copy-paste snippets for your functions."),t[178]=e,t[179]=be):be=t[179];let ve;t[180]!==e?(ve=e("A durable log of admin state-changing operations."),t[180]=e,t[181]=ve):ve=t[181];let xe;t[182]!==e?(xe=e("Authentication and security events — sign-ins, MFA, and session changes."),t[182]=e,t[183]=xe):xe=t[183];let ye;t[184]!==e?(ye=e("Enabled plugins and session config (read-only)."),t[184]=e,t[185]=ye):ye=t[185];let we;t[186]!==e?(we=e("Browse and revoke active sessions across all users."),t[186]=e,t[187]=we):we=t[187];let ke;t[188]!==e?(ke=e("Live Cloudflare Containers — current lifecycle state per instance from the log stream."),t[188]=e,t[189]=ke):ke=t[189];let Me;t[190]!==e?(Me=e("Chart widgets backed by saved read-only SQL queries."),t[190]=e,t[191]=Me):Me=t[191];let Ne;t[192]!==e?(Ne=e("Browse and edit rows across your shard and global tables."),t[192]=e,t[193]=Ne):Ne=t[193];let Se;t[194]!==e?(Se=e("Live liveness, readiness, and per-binding health from the deployment's /_lunora/health endpoint."),t[194]=e,t[195]=Se):Se=t[195];let Ce;t[196]!==e?(Ce=e("Forward logs to Logpush, Tail Workers, or a webhook collector."),t[196]=e,t[197]=Ce):Ce=t[197];let Pe;t[198]!==e?(Pe=e("Export a shard to NDJSON, or import rows from it."),t[198]=e,t[199]=Pe):Pe=t[199];let _e;t[200]!==e?(_e=e("Realtime fan-out cost and per-topic subscriber counts for this shard."),t[200]=e,t[201]=_e):_e=t[201];let Te;t[202]!==e?(Te=e("Browse objects in your R2 storage buckets."),t[202]=e,t[203]=Te):Te=t[203];let Le;t[204]!==e?(Le=e("Inspect feature flags and their live evaluation under a targeting context."),t[204]=e,t[205]=Le):Le=t[205];let Ae;t[206]!==e?(Ae=e("Run registered queries, mutations, and actions."),t[206]=e,t[207]=Ae):Ae=t[207];let Re;t[208]!==e?(Re=e("At-a-glance connection, error, and shard signals."),t[208]=e,t[209]=Re):Re=t[209];let Ee;t[210]!==e?(Ee=e("Connection, health, and advisor summary for your deployment."),t[210]=e,t[211]=Ee):Ee=t[211];let Ie;t[212]!==e?(Ie=e("Surface slow functions, error spikes, and cache problems."),t[212]=e,t[213]=Ie):Ie=t[213];let $e;t[214]!==e?($e=e("Grouped error triage — Worker throws and container crashes folded by fingerprint."),t[214]=e,t[215]=$e):$e=t[215];let He;t[216]!==e?(He=e("A live stream of recent function logs."),t[216]=e,t[217]=He):He=t[217];let Be;t[218]!==e?(Be=e("Per-shard health and aggregate metrics."),t[218]=e,t[219]=Be):Be=t[219];let ze;t[220]!==e?(ze=e("Review migration status and run them."),t[220]=e,t[221]=ze):ze=t[221];let Ve;t[222]!==e?(Ve=e("Registered push devices — endpoint, kind, last-send status, and delivery errors."),t[222]=e,t[223]=Ve):Ve=t[223];let Oe;t[224]!==e?(Oe=e("Browse and manage organizations, members, and invitations."),t[224]=e,t[225]=Oe):Oe=t[225];let De;t[226]!==e?(De=e("Restore a shard to a point in the last 30 days."),t[226]=e,t[227]=De):De=t[227];let Ze;t[228]!==e?(Ze=e("Email your app sent, captured in dev."),t[228]=e,t[229]=Ze):Ze=t[229];let Fe;t[230]!==e?(Fe=e("Synced customers, subscriptions, and webhook events."),t[230]=e,t[231]=Fe):Fe=t[231];let qe;t[232]!==e?(qe=e("Inspect access policies per table, and probe a function as any identity."),t[232]=e,t[233]=qe):qe=t[233];let We;t[234]!==e?(We=e("Inspect declared Cloudflare Queues — their producer bindings, consumer mode, and dead-letter queue."),t[234]=e,t[235]=We):We=t[235];let je;t[236]!==e?(je=e("Server-side onQueryChange reactors: what has run, what was suppressed, and what is failing."),t[236]=e,t[237]=je):je=t[237];let Ue;t[238]!==e?(Ue=e("Active WebSocket subscriptions on this shard."),t[238]=e,t[239]=Ue):Ue=t[239];let Ge;t[240]!==e?(Ge=e("Inspect row-level-security policies and roles, per table."),t[240]=e,t[241]=Ge):Ge=t[241];let Ke;t[242]!==e?(Ke=e("Inspect and cancel scheduled jobs."),t[242]=e,t[243]=Ke):Ke=t[243];let Qe;t[244]!==e?(Qe=e("Inspect each table and its columns."),t[244]=e,t[245]=Qe):Qe=t[245];let Ye;t[246]!==e?(Ye=e("Review admin gates, credentials, and log redaction."),t[246]=e,t[247]=Ye):Ye=t[247];let Je;t[248]!==e?(Je=e("Read-only deployment config — vars, secrets, and bindings."),t[248]=e,t[249]=Je):Je=t[249];let Xe;t[250]!==e?(Xe=e("Run read-only SQL against a shard."),t[250]=e,t[251]=Xe):Xe=t[251];let et;t[252]!==e?(et=e("Browse and edit key-value pairs in your Workers KV namespaces."),t[252]=e,t[253]=et):et=t[253];let tt;t[254]!==e?(tt=e("Inspect storage access rules — per bucket, operation, and key prefix."),t[254]=e,t[255]=tt):tt=t[255];let st;t[256]!==e?(st=e("Recent ctx.trace waterfalls for this shard — the drill-down from a log line."),t[256]=e,t[257]=st):st=t[257];let at;t[258]!==e?(at=e("Manage auth users — roles, bans, sessions, and identity."),t[258]=e,t[259]=at):at=t[259];let ot;t[260]!==e?(ot=e("Browse Vectorize indexes and run similarity searches."),t[260]=e,t[261]=ot):ot=t[261];let nt;t[262]!==e?(nt=e("Inspect declared Cloudflare Workflows and their bindings."),t[262]=e,t[263]=nt):nt=t[263];let ft;t[264]!==tt||t[265]!==st||t[266]!==at||t[267]!==ot||t[268]!==nt||t[269]!==fe||t[270]!==he||t[271]!==pe||t[272]!==ge||t[273]!==be||t[274]!==ve||t[275]!==xe||t[276]!==ye||t[277]!==we||t[278]!==ke||t[279]!==Me||t[280]!==Ne||t[281]!==Se||t[282]!==Ce||t[283]!==Pe||t[284]!==_e||t[285]!==Te||t[286]!==Le||t[287]!==Ae||t[288]!==Re||t[289]!==Ee||t[290]!==Ie||t[291]!==$e||t[292]!==He||t[293]!==Be||t[294]!==ze||t[295]!==Ve||t[296]!==Oe||t[297]!==De||t[298]!==Ze||t[299]!==Fe||t[300]!==qe||t[301]!==We||t[302]!==je||t[303]!==Ue||t[304]!==Ge||t[305]!==Ke||t[306]!==Qe||t[307]!==Ye||t[308]!==Je||t[309]!==Xe||t[310]!==et?(ft={advisorHealth:fe,agents:he,evals:pe,analytics:ge,api:be,audit:ve,authAudit:xe,authConfig:ye,authSessions:we,containers:ke,dashboards:Me,data:Ne,deploymentHealth:Se,drains:Ce,export:Pe,fanout:_e,files:Te,flags:Le,functions:Ae,health:Re,home:Ee,insights:Ie,issues:$e,logs:He,metrics:Be,migrations:ze,notifications:Ve,organizations:Oe,pitr:De,mail:Ze,payments:Fe,permissions:qe,queues:We,reactors:je,realtime:Ue,rls:Ge,schedule:Ke,schema:Qe,security:Ye,settings:Je,sql:Xe,kv:et,storageRules:tt,traces:st,users:at,vectors:ot,workflows:nt},t[264]=tt,t[265]=st,t[266]=at,t[267]=ot,t[268]=nt,t[269]=fe,t[270]=he,t[271]=pe,t[272]=ge,t[273]=be,t[274]=ve,t[275]=xe,t[276]=ye,t[277]=we,t[278]=ke,t[279]=Me,t[280]=Ne,t[281]=Se,t[282]=Ce,t[283]=Pe,t[284]=_e,t[285]=Te,t[286]=Le,t[287]=Ae,t[288]=Re,t[289]=Ee,t[290]=Ie,t[291]=$e,t[292]=He,t[293]=Be,t[294]=ze,t[295]=Ve,t[296]=Oe,t[297]=De,t[298]=Ze,t[299]=Fe,t[300]=qe,t[301]=We,t[302]=je,t[303]=Ue,t[304]=Ge,t[305]=Ke,t[306]=Qe,t[307]=Ye,t[308]=Je,t[309]=Xe,t[310]=et,t[311]=ft):ft=t[311];const xt=ft;let ht;return t[312]!==vt||t[313]!==xt||t[314]!==bt?(ht={groupLabel:vt,tabDescription:xt,tabLabel:bt},t[312]=vt,t[313]=xt,t[314]=bt,t[315]=ht):ht=t[315],ht},ka=()=>{const t=k(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=w("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:[n("rect",{height:"14",rx:"2",width:"20",x:"2",y:"3"}),n("path",{d:"M8 21h8M12 17v4"})]}),t[0]=e):e=t[0],e},Ma=()=>{const t=k(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=w("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:[n("circle",{cx:"12",cy:"12",r:"4"}),n("path",{d:"M12 2v2m0 16v2M4.9 4.9l1.4 1.4m11.4 11.4 1.4 1.4M2 12h2m16 0h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"})]}),t[0]=e):e=t[0],e},Na=()=>{const t=k(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:n("path",{d:"M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z"})}),t[0]=e):e=t[0],e},Sa=[{Icon:ka,value:"system"},{Icon:Ma,value:"light"},{Icon:Na,value:"dark"}],Ca=()=>{const t=k(19),{theme:e,setTheme:s}=Is(),a=te();let o;t[0]!==a?(o=a("Dark theme"),t[0]=a,t[1]=o):o=t[1];let r;t[2]!==a?(r=a("Light theme"),t[2]=a,t[3]=r):r=t[3];let l;t[4]!==a?(l=a("System theme"),t[4]=a,t[5]=l):l=t[5];let i;t[6]!==o||t[7]!==r||t[8]!==l?(i={dark:o,light:r,system:l},t[6]=o,t[7]=r,t[8]=l,t[9]=i):i=t[9];const d=i;let u;t[10]!==a?(u=a("Theme"),t[10]=a,t[11]=u):u=t[11];let c;t[12]!==d||t[13]!==s||t[14]!==e?(c=Sa.map(p=>{const{Icon:m,value:h}=p,b=e===h;return w("button",{"aria-checked":b,"aria-label":d[h],className:L("relative flex size-7 cursor-pointer items-center justify-center rounded-md outline-none transition-colors focus-visible:bg-accent",b?"text-foreground":"text-muted-foreground hover:text-foreground"),"data-testid":`dash-app-theme-${h}`,onClick:()=>{s(h)},role:"radio",title:d[h],type:"button",children:[b&&n(Ss.span,{className:"absolute inset-0 rounded-md border border-muted-foreground/40 bg-background/40",layoutId:"studio-theme-active",transition:{bounce:.1,duration:.45,type:"spring"}}),n("span",{className:"relative",children:n(m,{})})]},h)}),t[12]=d,t[13]=s,t[14]=e,t[15]=c):c=t[15];let f;return t[16]!==u||t[17]!==c?(f=n("div",{"aria-label":u,className:"inline-flex items-center gap-0.5 overflow-hidden rounded-md border border-border bg-muted/60 p-0.5","data-testid":"dash-app-theme",role:"radiogroup",children:c}),t[16]=u,t[17]=c,t[18]=f):f=t[18],f},Pa=t=>{const e=k(23),{domain:s,onOpenCommandPalette:a,page:o}=t,r=te();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n(na,{className:"-ms-1"}),e[0]=l):l=e[0];let i;e[1]!==r?(i=r("Breadcrumb"),e[1]=r,e[2]=i):i=e[2];let d;e[3]!==s?(d=n("span",{className:"text-muted-foreground",children:s}),e[3]=s,e[4]=d):d=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=n("svg",{"aria-hidden":"true",className:"size-3.5 text-muted-foreground/60",fill:"none",stroke:"currentColor",strokeWidth:1.7,viewBox:"0 0 24 24",children:n("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),e[5]=u):u=e[5];let c;e[6]!==o?(c=n("span",{className:"font-medium text-foreground",children:o}),e[6]=o,e[7]=c):c=e[7];let f;e[8]!==i||e[9]!==d||e[10]!==c?(f=w("nav",{"aria-label":i,className:"flex items-center gap-1.5 text-[13px]",children:[d,u,c]}),e[8]=i,e[9]=d,e[10]=c,e[11]=f):f=e[11];let p;e[12]===Symbol.for("react.memo_cache_sentinel")?(p=w("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeWidth:1.8,viewBox:"0 0 24 24",children:[n("circle",{cx:"11",cy:"11",r:"7"}),n("path",{d:"m21 21-4.3-4.3",strokeLinecap:"round"})]}),e[12]=p):p=e[12];let m;e[13]!==r?(m=r("Search…"),e[13]=r,e[14]=m):m=e[14];let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=n("kbd",{className:"ms-auto rounded border border-border bg-background px-1 font-sans text-[10px] text-muted-foreground",children:"⌘K"}),e[15]=h):h=e[15];let b;e[16]!==a||e[17]!==m?(b=w("button",{className:"mx-auto hidden h-8 w-72 items-center gap-2 rounded-lg border border-border bg-muted/40 px-3 text-xs text-muted-foreground transition-colors hover:bg-muted md:flex","data-testid":"dash-app-search",onClick:a,type:"button",children:[p,m,h]}),e[16]=a,e[17]=m,e[18]=b):b=e[18];let x;e[19]===Symbol.for("react.memo_cache_sentinel")?(x=n("div",{className:"ms-auto flex items-center gap-1.5 md:ms-0",children:n(Ca,{})}),e[19]=x):x=e[19];let y;return e[20]!==b||e[21]!==f?(y=w("header",{className:"flex h-11 shrink-0 items-center gap-2 border-b border-border px-4","data-testid":"dash-app-header",children:[l,f,b,x]}),e[20]=b,e[21]=f,e[22]=y):y=e[22],y},_a=t=>{const e=k(4),{console:s}=Cs();let a,o;e[0]!==s||e[1]!==t?(a=()=>{if(t===void 0)return;const r=l=>{if(!l.ctrlKey||l.metaKey||l.altKey||l.shiftKey||l.repeat||l.key.toLowerCase()!==s)return;const{target:i}=l;i instanceof HTMLElement&&(i.isContentEditable||["INPUT","SELECT","TEXTAREA"].includes(i.tagName))||(l.preventDefault(),t())};return globalThis.addEventListener("keydown",r),()=>{globalThis.removeEventListener("keydown",r)}},o=[s,t],e[0]=s,e[1]=t,e[2]=a,e[3]=o):(a=e[2],o=e[3]),lt(a,o)},E=(t,e)=>A(()=>t().then(s=>({default:s[e]}))),Ta=E(()=>import("../packem_chunks/InsightsPanel.mjs"),"InsightsPanel"),La=A(()=>import("../packem_chunks/rls-panel.mjs")),Aa=A(()=>import("../packem_chunks/AdvisorHealthPanel.mjs")),Ra=A(()=>import("../packem_chunks/SecurityAdvisorPanel.mjs")),Ea=A(()=>import("../packem_chunks/agents-panel.mjs")),Ia=E(()=>import("../packem_chunks/analytics-panel.mjs"),"AnalyticsPanel"),$a=A(()=>import("../packem_chunks/ApiTab.mjs")),Ha=A(()=>import("../packem_chunks/auth-audit-panel.mjs")),Ba=A(()=>import("../packem_chunks/auth-config-panel.mjs")),za=A(()=>import("../packem_chunks/auth-sessions-panel.mjs")),Va=A(()=>import("../packem_chunks/organizations-panel.mjs")),Oa=E(()=>import("../packem_chunks/users-panel.mjs"),"UsersPanel"),Da=A(()=>import("../packem_chunks/containers-panel.mjs")),Za=E(()=>import("../packem_chunks/DeploymentHealthPanel.mjs"),"DeploymentHealthPanel"),Fa=E(()=>import("../packem_chunks/TableEditor.mjs"),"TableEditor"),qa=E(()=>import("../packem_chunks/ExportImportPanel.mjs"),"ExportImportPanel"),Wa=A(()=>import("../packem_chunks/migrations-route.mjs")),ja={data:ks,migrations:ws},Ua=E(()=>import("../packem_chunks/PitrPanel.mjs"),"PitrPanel"),Ga=A(()=>import("../packem_chunks/flags-panel.mjs")),Ka=A(()=>import("../packem_chunks/reactors-panel.mjs")),Qa=E(()=>import("../packem_chunks/FunctionRunner.mjs"),"FunctionRunner"),Ya=E(()=>import("../packem_chunks/FunctionStatsPanel.mjs"),"FunctionStatsPanel"),Ja=A(()=>import("../packem_chunks/issues-panel.mjs")),Xa=E(()=>import("../packem_chunks/AuditPanel.mjs"),"AuditPanel"),eo=A(()=>import("../packem_chunks/log-drains-panel.mjs")),to=A(()=>import("../packem_chunks/LogsPanel.mjs").then(t=>({default:t.LogsPanel}))),so=E(()=>import("../packem_chunks/MailPanel.mjs"),"MailPanel"),ao=E(()=>import("../packem_chunks/schedule-panel.mjs"),"SchedulePanel"),oo=A(()=>import("../packem_chunks/subscriptions-panel.mjs")),no=A(()=>import("../packem_chunks/sync-client-panel.mjs")),ro=E(()=>import("../packem_chunks/kv-browser.mjs"),"KvBrowser"),lo=A(()=>import("../packem_chunks/NotificationsPanel.mjs")),io=E(()=>import("../packem_chunks/payments-panel.mjs"),"PaymentsPanel"),co=E(()=>import("../packem_chunks/permissions-panel.mjs"),"PermissionsPanel"),uo=A(()=>import("../packem_chunks/queues-panel.mjs")),mo=A(()=>import("../packem_chunks/dashboards-panel.mjs")),fo=A(()=>import("../packem_chunks/fanout-panel.mjs")),ho=E(()=>import("../packem_chunks/HealthPanel.mjs"),"HealthPanel"),po=E(()=>import("../packem_chunks/MetricsPanel.mjs"),"MetricsPanel"),go=E(()=>import("../packem_chunks/SchemaViewer.mjs"),"SchemaViewer"),bo=E(()=>import("../packem_chunks/SettingsPanel.mjs"),"SettingsPanel"),vo=E(()=>import("../packem_chunks/SqlEditorPanel.mjs"),"SqlEditorPanel"),xo=E(()=>import("../packem_chunks/FileBrowser.mjs"),"FileBrowser"),yo=A(()=>import("../packem_chunks/storage-rules-panel.mjs")),wo=A(()=>import("../packem_chunks/traces-panel.mjs")),ko=A(()=>import("../packem_chunks/evals-panel.mjs")),Mo=E(()=>import("../packem_chunks/vector-browser.mjs"),"VectorBrowser"),No=A(()=>import("../packem_chunks/workflows-panel.mjs")),Jt=It(null),So={analytics:n("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"}),api:n("path",{d:"m9 8-4 4 4 4m6-8 4 4-4 4M13 5l-2 14"}),audit:n("path",{d:"M7 4h7l4 4v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1Zm6 0v5h5M9 13h6M9 16h6M9 10h2"}),authAudit:n("path",{d:"M12 3 5 6v5c0 4.5 3 7.8 7 9 4-1.2 7-4.5 7-9V6l-7-3Zm-3 8h6m-6 3h6"}),authConfig:n("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm7.4-3a7.4 7.4 0 0 0-.1-1.2l2-1.6-2-3.4-2.4 1a7.3 7.3 0 0 0-2-1.2l-.4-2.6h-3.6l-.4 2.6a7.3 7.3 0 0 0-2 1.2l-2.4-1-2 3.4 2 1.6a7.4 7.4 0 0 0 0 2.4l-2 1.6 2 3.4 2.4-1a7.3 7.3 0 0 0 2 1.2l.4 2.6h3.6l.4-2.6a7.3 7.3 0 0 0 2-1.2l2.4 1 2-3.4-2-1.6a7.4 7.4 0 0 0 .1-1.2Z"}),agents:n("path",{d:"M12 8V5m0 0a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM6 8h12a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2Zm3 5h.01M15 13h.01M9 21h6"}),authSessions:n("path",{d:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-13.5V12l4 2"}),containers:n("path",{d:"M3 7.5 12 3l9 4.5v9L12 21l-9-4.5v-9Zm0 0 9 4.5m0 0 9-4.5m-9 4.5V21"}),dashboards:n("path",{d:"M4 5h7v6H4V5Zm9 0h7v4h-7V5ZM4 14h7v5H4v-5Zm9-1h7v6h-7v-6Z"}),deploymentHealth:n("path",{d:"M12 3 5 6v5c0 4.5 3 7.8 7 9 4-1.2 7-4.5 7-9V6l-7-3Zm-3 8 2 3 4-5"}),drains:n("path",{d:"M5 5h14M7 5v6a5 5 0 0 0 10 0V5M10 16h4v3h-4zM12 19v2"}),data:n("path",{d:"M5 6c0-1.4 3.1-2.5 7-2.5s7 1.1 7 2.5-3.1 2.5-7 2.5S5 7.4 5 6Zm0 0v12c0 1.4 3.1 2.5 7 2.5s7-1.1 7-2.5V6M5 12c0 1.4 3.1 2.5 7 2.5s7-1.1 7-2.5"}),export:n("path",{d:"M12 3v11m0 0 4-4m-4 4-4-4M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"}),fanout:n("path",{d:"M12 5a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm-7 16a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm14 0a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM12 7v3.5M12 10.5 6 17m6-6.5 6 6.5"}),files:n("path",{d:"M4 7a2 2 0 0 1 2-2h3l2 2.5h7a2 2 0 0 1 2 2V18a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7Z"}),flags:n("path",{d:"M6 21V4m0 0h11l-2 3 2 3H6"}),functions:n("path",{d:"m9 8-4 4 4 4m6-8 4 4-4 4"}),evals:n("path",{d:"M4 19V5m0 14h16M8 15l3-4 3 3 4-6M8 15v.01"}),health:n("path",{d:"M3 12h4l2 6 4-14 2 8h6"}),home:n("path",{d:"M3 11.5 12 4l9 7.5M5 10v9a1 1 0 0 0 1 1h4v-6h4v6h4a1 1 0 0 0 1-1v-9"}),insights:n("path",{d:"M12 3a6 6 0 0 0-3.6 10.8c.5.4.8.9.9 1.5l.2 1.2h5l.2-1.2c.1-.6.4-1.1.9-1.5A6 6 0 0 0 12 3ZM9.5 20.5h5M10 18h4"}),issues:n("path",{d:"M10.3 4.3 2.5 18a2 2 0 0 0 1.7 3h15.6a2 2 0 0 0 1.7-3L13.7 4.3a2 2 0 0 0-3.4 0ZM12 9v4m0 3v.01"}),kv:n("path",{d:"M5 5h14v4H5V5Zm0 5h14v4H5v-4Zm0 5h14v4H5v-4Z"}),logs:n("path",{d:"M5 6h14M5 10h14M5 14h9M5 18h11"}),mail:n("path",{d:"M4 5h16v14H4V5Zm0 1.5 8 6 8-6"}),payments:n("path",{d:"M3 7h18v10H3V7Zm0 3h18M7 14h4"}),metrics:n("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"}),migrations:n("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"}),notifications:n("path",{d:"M15 17h5l-1.4-1.4A2 2 0 0 1 18 14.2V11a6 6 0 0 0-4-5.7V5a2 2 0 1 0-4 0v.3A6 6 0 0 0 6 11v3.2a2 2 0 0 1-.6 1.4L4 17h5m6 0v1a3 3 0 1 1-6 0v-1m6 0H9"}),organizations:n("path",{d:"M3 21V8l6-4 6 4v13M9 21v-5h2v5M15 11h6v10M18 14v.01M18 17v.01M6 9v.01M6 12v.01M6 15v.01"}),permissions:n("path",{d:"M12 3 5 6v5c0 4.5 3 7.8 7 9 4-1.2 7-4.5 7-9V6l-7-3Zm-3 8 2.2 2.2L15 9.5M8.5 16h7"}),pitr:n("path",{d:"M12 21a9 9 0 1 0-9-9M12 7.5V12l3 2M3 12l-2-2m2 2 2-2"}),queues:n("path",{d:"M4 6h16M4 10h16M4 14h10M4 18h10m4-2 3 2-3 2v-4Z"}),reactors:n("path",{d:"M4 4v6h6M20 20v-6h-6M20 9a8 8 0 0 0-14.7-3M4 15a8 8 0 0 0 14.7 3"}),realtime:n("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"}),rls:n("path",{d:"M12 3 5 6v5c0 4.5 3 7.8 7 9 4-1.2 7-4.5 7-9V6l-7-3ZM8.5 10h7M8.5 13h7"}),schedule:n("path",{d:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-13.5V12l4 2"}),schema:n("path",{d:"M4 5h16v14H4V5Zm0 5h16M10 10v9M4 14.5h16"}),sql:n("path",{d:"M4 5h16v14H4V5Zm3 4 3 3-3 3m6 0h4"}),storageRules:n("path",{d:"M7 10V7a5 5 0 0 1 10 0v3m-11 0h12a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1Zm6 4v2"}),advisorHealth:n("path",{d:"M3 12h4l2-5 3 10 2-5h5"}),security:n("path",{d:"M12 3 5 6v5c0 4.5 3 7.8 7 9 4-1.2 7-4.5 7-9V6l-7-3Zm-2.5 8.5 2 2 4-4"}),traces:n("path",{d:"M3 6h9M6 12h12M10 18h7"}),settings:n("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm7.4-3a7.4 7.4 0 0 0-.1-1.2l2-1.6-2-3.4-2.4 1a7.3 7.3 0 0 0-2-1.2l-.4-2.6H10.5l-.4 2.6a7.3 7.3 0 0 0-2 1.2l-2.4-1-2 3.4 2 1.6a7.4 7.4 0 0 0 0 2.4l-2 1.6 2 3.4 2.4-1a7.3 7.3 0 0 0 2 1.2l.4 2.6h3.6l.4-2.6a7.3 7.3 0 0 0 2-1.2l2.4 1 2-3.4-2-1.6a7.4 7.4 0 0 0 .1-1.2Z"}),users:n("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85M16 3.13A4 4 0 0 1 16 11"}),vectors:n("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"}),workflows:n("path",{d:"M5 5h5v5H5V5Zm9 9h5v5h-5v-5ZM7.5 10v2a2 2 0 0 0 2 2H14m2.5-4V8a2 2 0 0 0-2-2H10"})},At=[{key:"overview",tabs:["home","dashboards"]},{key:"database",tabs:["data","sql","schema","migrations","vectors","pitr","export"]},{key:"functions",tabs:["functions","api","workflows","agents","queues"]},{key:"auth",tabs:["users","organizations","authSessions","authAudit","authConfig"]},{key:"storage",tabs:["files","storageRules","kv"]},{key:"observability",tabs:["issues","logs","traces","evals","audit","realtime","reactors","fanout","containers","metrics","analytics","health","deploymentHealth"]},{key:"advisors",tabs:["advisorHealth","security","rls","permissions","insights"]},{key:"operations",tabs:["schedule","mail","drains","notifications","payments","flags"]},{key:"settings",tabs:["settings"]}],Co={analytics:"analytics",authAudit:"auth",authConfig:"auth",authSessions:"auth",containers:"containers",files:"storage",flags:"flags",kv:"kv",mail:"mail",notifications:"notifications",organizations:"auth",payments:"payments",queues:"queues",schedule:"scheduler",storageRules:"storage",users:"auth",vectors:"vectors",workflows:"workflows"},Rt=(t,e)=>{const s=Co[t];return s===void 0||e[s]},Nt=t=>{const e=k(2),{tab:s}=t,a=So[s];let o;return e[0]!==a?(o=n("svg",{"aria-hidden":"true",className:"size-4 shrink-0",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:a}),e[0]=a,e[1]=o):o=e[1],o},Po=t=>t,Xt=Po(["home","data","sql","functions","api","workflows","agents","queues","containers","schema","migrations","vectors","export","pitr","users","organizations","authSessions","authAudit","authConfig","files","storageRules","kv","dashboards","metrics","analytics","health","deploymentHealth","advisorHealth","security","rls","permissions","insights","issues","logs","traces","evals","reactors","realtime","fanout","mail","notifications","payments","audit","schedule","drains","flags","settings"]),_o=new Set(["api","data","migrations","sql"]),To=t=>{const e=t.split("/").findLast(Boolean)??"";return Xt.includes(e)?e:"home"},Lo=t=>{const e=k(19),{chrome:s,connected:a}=t,o=te();let r;e[0]!==o?(r=o("admin token"),e[0]=o,e[1]=r):r=e[1];let l;e[2]!==r?(l=n("label",{className:"text-xs font-medium text-foreground",htmlFor:"dash-app-token",children:r}),e[2]=r,e[3]=l):l=e[3];let i;e[4]!==s.onTokenChange||e[5]!==s.token?(i=n(Bt,{className:"h-8","data-testid":"dash-app-token",id:"dash-app-token",onChange:s.onTokenChange,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:s.token}),e[4]=s.onTokenChange,e[5]=s.token,e[6]=i):i=e[6];let d;e[7]!==a||e[8]!==o?(d=a&&w("p",{className:"flex items-start gap-1.5 text-[11px] text-muted-foreground","data-testid":"dash-app-token-warning",role:"note",children:[n("span",{"aria-hidden":"true",className:"text-warning",children:"⚠"}),o("Token rides the WebSocket URL — it can surface in browser DevTools and server logs. Use a dev-only token.")]}),e[7]=a,e[8]=o,e[9]=d):d=e[9];let u;e[10]!==s.clearToken||e[11]!==a||e[12]!==o?(u=a&&n("button",{className:"self-start rounded-md border border-border px-2.5 py-1 text-xs font-medium outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"dash-app-clear-token",onClick:s.clearToken,type:"button",children:o("Clear")}),e[10]=s.clearToken,e[11]=a,e[12]=o,e[13]=u):u=e[13];let c;return e[14]!==l||e[15]!==i||e[16]!==d||e[17]!==u?(c=w("div",{className:"flex flex-col gap-2",children:[l,i,d,u]}),e[14]=l,e[15]=i,e[16]=d,e[17]=u,e[18]=c):c=e[18],c},Ao=t=>{const e=k(25),{current:s,group:a,groupLabel:o,selectTab:r,tabDescription:l,tabLabel:i}=t,d=a.tabs.includes(s)?"page":void 0,u=o[a.key],c=a.tabs[0];let f;e[0]!==c?(f=n(Nt,{tab:c}),e[0]=c,e[1]=f):f=e[1];let p;e[2]!==d||e[3]!==u||e[4]!==f?(p=n(Gt,{"aria-current":d,"aria-label":u,className:"mx-auto flex size-8 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent data-[popup-open]:bg-sidebar-accent data-[popup-open]:text-sidebar-accent-foreground data-[popup-open]:shadow-xs aria-[current=page]:bg-sidebar-accent aria-[current=page]:text-sidebar-accent-foreground aria-[current=page]:shadow-xs",delay:120,openOnHover:!0,children:f}),e[2]=d,e[3]=u,e[4]=f,e[5]=p):p=e[5];const m=o[a.key];let h;e[6]!==m?(h=n("div",{className:"px-2 py-1.5 text-[11px] font-medium tracking-wider text-muted-foreground uppercase",children:m}),e[6]=m,e[7]=h):h=e[7];let b;if(e[8]!==s||e[9]!==a.tabs||e[10]!==r||e[11]!==l||e[12]!==i){let g;e[14]!==s||e[15]!==r||e[16]!==l||e[17]!==i?(g=v=>w("button",{"aria-current":s===v?"page":void 0,className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent aria-[current=page]:bg-accent aria-[current=page]:font-medium [&_svg]:opacity-70 aria-[current=page]:[&_svg]:opacity-100","data-tab":v,"data-testid":`dash-tab-${v}`,onClick:r,title:l[v],type:"button",children:[n(Nt,{tab:v}),n("span",{children:i[v]})]},v),e[14]=s,e[15]=r,e[16]=l,e[17]=i,e[18]=g):g=e[18],b=a.tabs.map(g),e[8]=s,e[9]=a.tabs,e[10]=r,e[11]=l,e[12]=i,e[13]=b}else b=e[13];let x;e[19]!==h||e[20]!==b?(x=w(Kt,{align:"start",className:"w-56 p-1",side:"right",sideOffset:8,children:[h,b]}),e[19]=h,e[20]=b,e[21]=x):x=e[21];let y;return e[22]!==p||e[23]!==x?(y=w(Ut,{children:[p,x]}),e[22]=p,e[23]=x,e[24]=y):y=e[24],y},Ro=t=>{const e=k(45),{chrome:s,collapsed:a,connected:o}=t,r=te();if(s===null){let v;e[0]!==r?(v=r("Admin"),e[0]=r,e[1]=v):v=e[1];let N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=n("span",{className:"flex size-8 items-center justify-center rounded-full bg-sidebar-accent text-[11px] font-medium",children:"C"}),e[2]=N):N=e[2];let S;e[3]!==r?(S=r("Admin"),e[3]=r,e[4]=S):S=e[4];let P;e[5]!==S?(P=n("span",{className:"truncate text-[13px] font-medium",children:S}),e[5]=S,e[6]=P):P=e[6];let M;e[7]!==r?(M=r("Studio"),e[7]=r,e[8]=M):M=e[8];let T;e[9]!==M?(T=n("span",{className:"truncate text-[11px] text-muted-foreground",children:M}),e[9]=M,e[10]=T):T=e[10];let _;e[11]!==P||e[12]!==T?(_=w("span",{className:"grid flex-1 text-start leading-tight",children:[P,T]}),e[11]=P,e[12]=T,e[13]=_):_=e[13];let C;return e[14]!==v||e[15]!==_?(C=w(Yt,{className:"data-active:bg-transparent",size:"lg",tooltip:v,children:[N,_]}),e[14]=v,e[15]=_,e[16]=C):C=e[16],C}const l=a?"mx-auto size-8 justify-center":"w-full p-2";let i;e[17]!==l?(i=L("flex items-center gap-2 rounded-md text-start outline-none transition-colors hover:bg-sidebar-accent focus-visible:bg-sidebar-accent",l),e[17]=l,e[18]=i):i=e[18];let d;e[19]!==o||e[20]!==r?(d=r(o?"Connected":"Not connected"),e[19]=o,e[20]=r,e[21]=d):d=e[21];const u=o?"bg-success":"bg-muted-foreground/50";let c;e[22]!==u?(c=L("absolute -end-0.5 -bottom-0.5 size-2.5 rounded-full border-2 border-sidebar",u),e[22]=u,e[23]=c):c=e[23];let f;e[24]!==c?(f=w("span",{className:"relative flex size-8 shrink-0 items-center justify-center rounded-full bg-sidebar-accent text-[11px] font-medium",children:["C",n("span",{"aria-hidden":"true",className:c})]}),e[24]=c,e[25]=f):f=e[25];let p;e[26]!==a||e[27]!==o||e[28]!==r?(p=!a&&w($t,{children:[w("span",{className:"grid flex-1 text-start leading-tight",children:[n("span",{className:"truncate text-[13px] font-medium",children:r("Admin")}),n("span",{className:"truncate text-[11px] text-muted-foreground",children:r(o?"Connected":"Not connected")})]}),n("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.7,viewBox:"0 0 24 24",children:n("path",{d:"m8 9 4-4 4 4M8 15l4 4 4-4",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e[26]=a,e[27]=o,e[28]=r,e[29]=p):p=e[29];let m;e[30]!==i||e[31]!==d||e[32]!==f||e[33]!==p?(m=w(Gt,{className:i,"data-testid":"dash-app-connect",title:d,children:[f,p]}),e[30]=i,e[31]=d,e[32]=f,e[33]=p,e[34]=m):m=e[34];const h=a?"end":"start",b=a?"right":"top";let x;e[35]!==s||e[36]!==o?(x=n(Lo,{chrome:s,connected:o}),e[35]=s,e[36]=o,e[37]=x):x=e[37];let y;e[38]!==b||e[39]!==x||e[40]!==h?(y=n(Kt,{align:h,keepMounted:!0,side:b,children:x}),e[38]=b,e[39]=x,e[40]=h,e[41]=y):y=e[41];let g;return e[42]!==y||e[43]!==m?(g=w(Ut,{children:[m,y]}),e[42]=y,e[43]=m,e[44]=g):g=e[44],g},Eo=t=>{const e=k(28),{chrome:s,connected:a,current:o,groupLabel:r,groups:l,selectTab:i,tabDescription:d,tabLabel:u}=t,c=te(),{state:f}=gt(),p=f==="collapsed",m=p&&"justify-center px-0";let h;e[0]!==m?(h=L("flex items-center gap-2.5 px-1.5 py-1",m),e[0]=m,e[1]=h):h=e[1];let b;e[2]===Symbol.for("react.memo_cache_sentinel")?(b=n(zs,{className:"size-9 shrink-0 text-foreground"}),e[2]=b):b=e[2];let x;e[3]!==p||e[4]!==a||e[5]!==c?(x=!p&&w($t,{children:[w("span",{className:"grid flex-1 leading-tight",children:[n("span",{className:"truncate text-sm font-semibold text-foreground",children:"lunora"}),n("span",{className:"truncate text-[11px] text-muted-foreground",children:c("Studio")})]}),n(ct,{className:"px-1.5 text-[10px] tracking-wider uppercase",variant:"secondary",children:c(a?"Live":"Local")})]}),e[3]=p,e[4]=a,e[5]=c,e[6]=x):x=e[6];let y;e[7]!==h||e[8]!==x?(y=n(la,{children:w("div",{className:h,children:[b,x]})}),e[7]=h,e[8]=x,e[9]=y):y=e[9];let g;e[10]!==p||e[11]!==o||e[12]!==r||e[13]!==l||e[14]!==i||e[15]!==d||e[16]!==u?(g=p?l.map(P=>n(Ao,{current:o,group:P,groupLabel:r,selectTab:i,tabDescription:d,tabLabel:u},P.key)):l.map(P=>w(ca,{children:[n(ua,{className:"text-[11px] font-medium tracking-wider uppercase",children:r[P.key]}),n(ma,{children:n(Tt,{children:P.tabs.map(M=>n(Lt,{children:w(Yt,{className:"data-active:text-foreground dark:data-active:text-royal-amethyst data-active:shadow-[inset_2px_0_0_0_var(--royal-amethyst)]","data-tab":M,"data-testid":`dash-tab-${M}`,isActive:o===M,onClick:i,title:d[M],tooltip:d[M],children:[n(Nt,{tab:M}),n("span",{children:u[M]})]})},M))})})]},P.key)),e[10]=p,e[11]=o,e[12]=r,e[13]=l,e[14]=i,e[15]=d,e[16]=u,e[17]=g):g=e[17];let v;e[18]!==g?(v=n(da,{children:g}),e[18]=g,e[19]=v):v=e[19];let N;e[20]!==s||e[21]!==p||e[22]!==a?(N=n(ia,{children:n(Tt,{children:n(Lt,{children:n(Ro,{chrome:s,collapsed:p,connected:a})})})}),e[20]=s,e[21]=p,e[22]=a,e[23]=N):N=e[23];let S;return e[24]!==y||e[25]!==v||e[26]!==N?(S=w(oa,{collapsible:"icon",variant:"inset",children:[y,v,N]}),e[24]=y,e[25]=v,e[26]=N,e[27]=S):S=e[27],S},es=()=>{const t=k(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=w("div",{className:"flex flex-col gap-4","data-testid":"dash-pending",children:[w("div",{className:"flex items-center gap-2",children:[n(yt,{className:"h-8 w-40"}),n(yt,{className:"h-8 w-24"})]}),n(yt,{className:"h-72 w-full"})]}),t[0]=e):e=t[0],e},Io=()=>{const t=k(64),e=te(),s=Et();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a={select:Oo},t[0]=a):a=t[0];const o=ls(a);let r,l;t[1]!==o?(r=To(o),l=_o.has(r),t[1]=o,t[2]=r,t[3]=l):(r=t[2],l=t[3]);const i=l,d=fs(),u=d?.toggle;_a(u);const c=vs(),{groupLabel:f,tabDescription:p,tabLabel:m}=wa();let h;t[4]!==c?(h=Z=>({...Z,tabs:Z.tabs.filter(X=>Rt(X,c))}),t[4]=c,t[5]=h):h=t[5];const b=At.map(h).filter(Do);let x,y;t[6]!==r||t[7]!==c||t[8]!==s?(x=()=>{Rt(r,c)||Mt(s({replace:!0,to:"/home"}))},y=[r,c,s],t[6]=r,t[7]=c,t[8]=s,t[9]=x,t[10]=y):(x=t[9],y=t[10]),lt(x,y);let g;t[11]!==s?(g=Z=>{Mt(s({to:`/${Z.currentTarget.dataset.tab??""}`}))},t[11]=s,t[12]=g):g=t[12];const v=g;let N,S;t[13]!==r||t[14]!==m?(N=()=>{typeof document<"u"&&(document.title=`${m[r]} · lunora`)},S=[r,m],t[13]=r,t[14]=m,t[15]=N,t[16]=S):(N=t[15],S=t[16]),lt(N,S);const P=b.find(Z=>Z.tabs.includes(r))??At[0];let M;t[17]!==f||t[18]!==m?(M=Z=>Z.tabs.map(X=>({group:f[Z.key],label:m[X],to:`/${X}`})),t[17]=f,t[18]=m,t[19]=M):M=t[19];const T=b.flatMap(M),_=u===void 0?T:[...T,{group:e("Operations"),label:e("Toggle operation console"),run:u}],C=St(Jt),R=C!==null&&C.token!=="";let I;t[20]!==_?(I=n(Ms,{items:_}),t[20]=_,t[21]=I):I=t[21];let H;t[22]!==C||t[23]!==R||t[24]!==r||t[25]!==f||t[26]!==v||t[27]!==p||t[28]!==m||t[29]!==b?(H=n(Eo,{chrome:C,connected:R,current:r,groupLabel:f,groups:b,selectTab:v,tabDescription:p,tabLabel:m}),t[22]=C,t[23]=R,t[24]=r,t[25]=f,t[26]=v,t[27]=p,t[28]=m,t[29]=b,t[30]=H):H=t[30];const V=f[P.key],O=m[r];let B;t[31]!==V||t[32]!==O?(B=n(Pa,{domain:V,onOpenCommandPalette:Ns,page:O}),t[31]=V,t[32]=O,t[33]=B):B=t[33];let z;t[34]!==C?.rulesInstalled?(z=C?.rulesInstalled===!1&&n(Ds,{}),t[34]=C?.rulesInstalled,t[35]=z):z=t[35];const D=`dash-tab-${r}`,F=i?"flex min-w-0 flex-1 flex-col overflow-hidden":"min-w-0 flex-1 overflow-auto p-6",$=m[r];let q;t[36]!==e||t[37]!==$?(q=e("{title} failed",{title:$}),t[36]=e,t[37]=$,t[38]=q):q=t[38];const ee=m[r];let W;t[39]!==e?(W=e("Try again"),t[39]=e,t[40]=W):W=t[40];let Y;t[41]===Symbol.for("react.memo_cache_sentinel")?(Y=n(cs,{fallback:n(es,{}),children:n(is,{})}),t[41]=Y):Y=t[41];let j;t[42]!==r||t[43]!==q||t[44]!==ee||t[45]!==W?(j=n(us,{fallbackTitle:q,label:ee,retryLabel:W,children:Y},r),t[42]=r,t[43]=q,t[44]=ee,t[45]=W,t[46]=j):j=t[46];let U;t[47]!==F||t[48]!==j?(U=n("div",{className:F,children:j}),t[47]=F,t[48]=j,t[49]=U):U=t[49];let G;t[50]!==d?(G=d?.open===!0&&n(va,{focusSeq:d.focusSeq,onClose:d.close,onShownChange:d.setShown,shown:d.shown}),t[50]=d,t[51]=G):G=t[51];let K;t[52]!==D||t[53]!==U||t[54]!==G?(K=w("div",{"aria-labelledby":D,className:"flex min-w-0 flex-1 flex-col overflow-hidden","data-testid":"dash-panel",id:"dash-panel",role:"tabpanel",children:[U,G]}),t[52]=D,t[53]=U,t[54]=G,t[55]=K):K=t[55];let Q;t[56]!==B||t[57]!==z||t[58]!==K?(Q=w(ra,{className:"overflow-hidden md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm",children:[B,z,K]}),t[56]=B,t[57]=z,t[58]=K,t[59]=Q):Q=t[59];let J;return t[60]!==H||t[61]!==Q||t[62]!==I?(J=w(aa,{className:"min-h-0 flex-1","data-testid":"lunora-studio",children:[I,H,Q]}),t[60]=H,t[61]=Q,t[62]=I,t[63]=J):J=t[63],J},$o=()=>{const t=k(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n(ms,{children:n(Io,{})}),t[0]=e):e=t[0],e},Ho=t=>{const e=k(5),{initialShardKey:s,schemaEditable:a}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},e[0]=o):o=e[0];const r=ns(o),{table:l}=r,i=typeof l=="string"?l:void 0;let d;return e[1]!==s||e[2]!==i||e[3]!==a?(d=n(go,{initialShardKey:s,initialTable:i,schemaEditable:a}),e[1]=s,e[2]=i,e[3]=a,e[4]=d):d=e[4],d},Bo=()=>{const t=k(3),e=Et();let s,a;return t[0]!==e?(s=()=>{Mt(e({replace:!0,to:"/home"}))},a=[e],t[0]=e,t[1]=s,t[2]=a):(s=t[1],a=t[2]),lt(s,a),null},zo=({analyticsQuery:t,basePath:e,dataEditable:s=!1,functions:a,initialShardKey:o,openApiSpec:r,openRpcSpec:l,runAsIdentity:i=!1,schemaEditable:d=!1,scheduledCancel:u,scheduledCron:c,scheduledLoad:f})=>{const p=ts({component:$o}),m={agents:n(Ea,{initialShardKey:o}),analytics:n(Ia,{runQuery:t}),api:n($a,{functions:a,initialShardKey:o,openApiSpec:r,openRpcSpec:l}),audit:n(Xa,{initialShardKey:o}),authAudit:n(Ha,{}),authConfig:n(Ba,{}),authSessions:n(za,{}),containers:n(Da,{}),dashboards:n(mo,{initialShardKey:o}),data:n(Fa,{editable:s,initialShardKey:o}),deploymentHealth:n(Za,{}),drains:n(eo,{}),export:n(qa,{initialShardKey:o}),fanout:n(fo,{initialShardKey:o}),files:n(xo,{}),kv:n(ro,{}),flags:n(Ga,{initialShardKey:o}),reactors:n(Ka,{initialShardKey:o}),functions:w("div",{className:"flex flex-col gap-8",children:[n(Ya,{functions:a,initialShardKey:o}),n(Qa,{functions:a,runAsIdentity:i})]}),health:n(ho,{initialShardKey:o}),home:n(bs,{initialShardKey:o}),insights:n(Ta,{initialShardKey:o}),issues:n(Ja,{initialShardKey:o}),logs:n(to,{initialShardKey:o}),traces:n(wo,{initialShardKey:o}),evals:n(ko,{initialShardKey:o}),metrics:n(po,{initialShardKey:o}),migrations:n(Wa,{initialShardKey:o}),notifications:n(lo,{}),organizations:n(Va,{}),permissions:n(co,{functions:a,runAsIdentity:i,schemaEditable:d}),pitr:n(Ua,{initialShardKey:o}),mail:n(so,{}),payments:n(io,{}),queues:n(uo,{}),realtime:w("div",{className:"flex flex-col gap-8",children:[n(oo,{initialShardKey:o}),n(no,{})]}),rls:n(La,{}),schedule:n(ao,{loadCronJobs:c,scheduledCancel:u,scheduledLoad:f}),schema:n(Ho,{initialShardKey:o,schemaEditable:d}),advisorHealth:n(Aa,{}),security:n(Ra,{}),settings:n(bo,{initialShardKey:o}),sql:n(vo,{initialShardKey:o}),storageRules:n(yo,{}),users:n(Oa,{}),vectors:n(Mo,{}),workflows:n(No,{})},h=Pt({component:()=>m.home,getParentRoute:()=>p,path:"/"}),b=Xt.map(g=>Pt({component:()=>m[g],getParentRoute:()=>p,path:`/${g}`,validateSearch:ja[g]})),x=p.addChildren([h,...b]),y="window"in globalThis?ss():as({initialEntries:["/home"]});return os({...e===void 0||e==="/"?{}:{basepath:e},defaultNotFoundComponent:Bo,defaultPendingComponent:es,defaultPendingMinMs:0,defaultPendingMs:0,history:y,routeTree:x})},Vo=t=>{const e=k(18),{analyticsQuery:s,basePath:a,chrome:o,dataEditable:r,functions:l,initialShardKey:i,openApiSpec:d,openRpcSpec:u,runAsIdentity:c,schemaEditable:f,scheduledCancel:p,scheduledCron:m,scheduledLoad:h}=t;let b;e[0]!==s||e[1]!==a||e[2]!==r||e[3]!==l||e[4]!==i||e[5]!==d||e[6]!==u||e[7]!==c||e[8]!==p||e[9]!==m||e[10]!==h||e[11]!==f?(b=zo({analyticsQuery:s,basePath:a,dataEditable:r,functions:l,initialShardKey:i,openApiSpec:d,openRpcSpec:u,runAsIdentity:c,schemaEditable:f,scheduledCancel:p,scheduledCron:m,scheduledLoad:h}),e[0]=s,e[1]=a,e[2]=r,e[3]=l,e[4]=i,e[5]=d,e[6]=u,e[7]=c,e[8]=p,e[9]=m,e[10]=h,e[11]=f,e[12]=b):b=e[12];const x=b,y=o??null;let g;e[13]!==x?(g=n(rs,{router:x}),e[13]=x,e[14]=g):g=e[14];let v;return e[15]!==y||e[16]!==g?(v=n(Jt,{value:y,children:g}),e[15]=y,e[16]=g,e[17]=v):v=e[17],v},xn=t=>{const e=k(10);let s,a,o;e[0]!==t?({i18n:s,locale:a,...o}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=o):(s=e[1],a=e[2],o=e[3]);let r;e[4]!==o?(r=n(Es,{children:n(Vo,{...o})}),e[4]=o,e[5]=r):r=e[5];const l=r;if(s===void 0&&a===void 0)return l;let i;return e[6]!==s||e[7]!==a||e[8]!==l?(i=n(ys,{i18n:s,locale:a,children:l}),e[6]=s,e[7]=a,e[8]=l,e[9]=i):i=e[9],i};function Oo(t){return t.location.pathname}function Do(t){return t.tabs.length>0}export{zs as B,xn as S,Rs as T,vn as a,qs as b,Us as c,Gs as d,Ks as e,Is as u};
@@ -1,3 +0,0 @@
1
- import{a as tt}from"./chunk-K7AJEMKE.js";import{e as Be}from"./chunk-6D6Z2KXU.js";import{a as We}from"./chunk-55754F6H.js";import{b as Ve}from"./chunk-FEWMAPNI.js";import{a as D}from"./chunk-4ZEL6BYL.js";import{c as _e}from"./chunk-3TE3V2QL.js";import{f as Te}from"./chunk-BJEJVHCO.js";import{a as Ye}from"./chunk-FKVZRPV5.js";import{a as T,e as Fe}from"./chunk-WUWBZPUK.js";import{d as j,f as Ge,g as Ze,l as Qe,p as Ne,r as Xe,s as et}from"./chunk-6B7FVPW3.js";import{a as d,d as Pe,e as ot,f as it,g as ct,i as Ee}from"./chunk-YKXDMIHQ.js";var _=Pe(it(),1);var I=Pe(ot(),1);var n=Pe(ct(),1);var dt=Ge(D.studioFeatures),lt={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},mt=d(t=>{if(t===null||typeof t!="object")return lt;let e=t,s=d(a=>typeof e[a]=="boolean"?e[a]:!0,"n");return{analytics:s("analytics"),auth:s("auth"),containers:s("containers"),flags:s("flags"),kv:s("kv"),mail:s("mail"),notifications:s("notifications"),payments:s("payments"),queues:s("queues"),scheduler:s("scheduler"),storage:s("storage"),vectors:s("vectors"),workflows:s("workflows")}},"dt"),ut=d(()=>{let t=(0,_.c)(3),e=Te(),[s,a]=(0,I.useState)(lt),l,r;return t[0]!==e?(l=d(()=>{Ne((async()=>{try{a(mt(await e.query(dt,{},Ze(""))))}catch{}})())},"r"),r=[e],t[0]=e,t[1]=l,t[2]=r):(l=t[1],r=t[2]),(0,I.useEffect)(l,r),s},"ut"),pt=d(()=>{let t=(0,_.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},"mt"),ft=d(t=>{let e=(0,_.c)(24),{group:s}=t,a=j(),l=Be(),r;e[0]!==s.tab||e[1]!==l?(r=d(()=>{Ne(l({to:`/${s.tab}`}))},"a"),e[0]=s.tab,e[1]=l,e[2]=r):r=e[2];let i=r,o=s.bindings.length,c;e[3]!==s.label?(c=(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:s.label}),e[3]=s.label,e[4]=c):c=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,n.jsx)(pt,{}),e[5]=u):u=e[5];let p;e[6]!==c?(p=(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[c,u]}),e[6]=c,e[7]=p):p=e[7];let m;e[8]!==o||e[9]!==a?(m=o===1?a("1 binding"):a("{count} bindings",{count:o}),e[8]=o,e[9]=a,e[10]=m):m=e[10];let f;e[11]!==m?(f=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:m}),e[11]=m,e[12]=f):f=e[12];let h;e[13]!==o||e[14]!==s.bindings?(h=o>0&&(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.bindings.map(xt)}),e[13]=o,e[14]=s.bindings,e[15]=h):h=e[15];let g;e[16]!==p||e[17]!==f||e[18]!==h?(g=(0,n.jsxs)(Fe,{className:"flex flex-col gap-2 py-4",children:[p,f,h]}),e[16]=p,e[17]=f,e[18]=h,e[19]=g):g=e[19];let x;return e[20]!==s.testId||e[21]!==i||e[22]!==g?(x=(0,n.jsx)(T,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":s.testId,onClick:i,children:g}),e[20]=s.testId,e[21]=i,e[22]=g,e[23]=x):x=e[23],x},"ft"),at=["kv","files","vectors"],ht=d((t,e)=>[...t.filter(s=>s.tab!==e.tab),e].toSorted((s,a)=>at.indexOf(s.tab)-at.indexOf(a.tab)),"pt"),gt=d(()=>{let t=(0,_.c)(19),e=Te(),s=ut(),a=j(),l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=[],t[0]=l):l=t[0];let[r,i]=(0,I.useState)(l),o,c;if(t[1]!==e||t[2]!==s.kv||t[3]!==s.storage||t[4]!==s.vectors||t[5]!==a?(o=d(()=>{let g={cancelled:!1},x=[{enabled:s.kv,label:a("KV Namespaces"),load:d(async()=>(await e.listKvNamespaces()).map(bt),"load"),tab:"kv",testId:"home-binding-kv"},{enabled:s.storage,label:a("R2 Buckets"),load:d(()=>e.listStorageBuckets(),"load"),tab:"files",testId:"home-binding-r2"},{enabled:s.vectors,label:a("Vectorize Indexes"),load:d(async()=>(await e.listVectorIndexes()).map(yt),"load"),tab:"vectors",testId:"home-binding-vectors"}];for(let b of x)b.enabled&&Ne((async()=>{try{let v=await b.load();if(!g.cancelled){let k={bindings:v,label:b.label,tab:b.tab,testId:b.testId};i(w=>ht(w,k))}}catch{}})());return()=>{g.cancelled=!0}},"o"),c=[e,s.kv,s.storage,s.vectors,a],t[1]=e,t[2]=s.kv,t[3]=s.storage,t[4]=s.vectors,t[5]=a,t[6]=o,t[7]=c):(o=t[6],c=t[7]),(0,I.useEffect)(o,c),r.length===0)return null;let u;t[8]!==a?(u=a("Bindings"),t[8]=a,t[9]=u):u=t[9];let p;t[10]!==u?(p=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:u}),t[10]=u,t[11]=p):p=t[11];let m;t[12]!==r?(m=r.map(vt),t[12]=r,t[13]=m):m=t[13];let f;t[14]!==m?(f=(0,n.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:m}),t[14]=m,t[15]=f):f=t[15];let h;return t[16]!==p||t[17]!==f?(h=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[p,f]}),t[16]=p,t[17]=f,t[18]=h):h=t[18],h},"ht");function xt(t){return(0,n.jsx)(Ve,{variant:"secondary",children:t},t)}d(xt,"gt");function bt(t){return t.binding}d(bt,"xt");function yt(t){return t.name}d(yt,"bt");function vt(t){return(0,n.jsx)(ft,{group:t},t.tab)}d(vt,"yt");var Nt=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation \u2014 writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action \u2014 writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],_t=d(t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),"Nt"),kt=d(t=>{let e=Nt.map(s=>`- ${s.name} \u2014 ${s.summary}`).join(`
2
- `);return[`You have a Lunora MCP server connected to the deployment at ${t}.`,"It exposes this backend's functions and schema so you can inspect and operate it:",e,"",`Start by calling lunora_list_functions and lunora_list_tables to learn what exists, then lunora_get_function_schema before any run call. The full HTTP API is also documented at ${t}/_lunora/admin/openapi (that endpoint needs the same admin token the MCP server is configured with).`].join(`
3
- `)},"_t"),wt=1500,St=d(()=>{let t=(0,_.c)(40),e=j(),{url:s}=Te(),a;t[0]!==s?(a=Xe(s),t[0]=s,t[1]=a):a=t[1];let l=a,[r,i]=(0,I.useState)(null),o,c;t[2]!==r?(o=d(()=>{if(r===null)return;let $=globalThis.setTimeout(()=>{i(null)},wt);return()=>{globalThis.clearTimeout($)}},"o"),c=[r],t[2]=r,t[3]=o,t[4]=c):(o=t[3],c=t[4]),(0,I.useEffect)(o,c);let u;t[5]===Symbol.for("react.memo_cache_sentinel")?(u=d(($,O)=>{et(O)&&i($)},"u"),t[5]=u):u=t[5];let p=u,m;t[6]!==l?(m=d(()=>{p("config",_t(l))},"d"),t[6]=l,t[7]=m):m=t[7];let f=m,h;t[8]!==l?(h=d(()=>{p("prompt",kt(l))},"p"),t[8]=l,t[9]=h):h=t[9];let g=h,x;t[10]!==e?(x=e("Connect an AI agent"),t[10]=e,t[11]=x):x=t[11];let b;t[12]!==x?(b=(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:x}),t[12]=x,t[13]=b):b=t[13];let v;t[14]!==e?(v=e("Drive this deployment from an AI agent over the Model Context Protocol \u2014 it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[14]=e,t[15]=v):v=t[15];let k;t[16]!==v?(k=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:v}),t[16]=v,t[17]=k):k=t[17];let w;t[18]!==b||t[19]!==k?(w=(0,n.jsxs)("div",{className:"flex flex-col gap-1.5 p-4",children:[b,k]}),t[18]=b,t[19]=k,t[20]=w):w=t[20];let A;t[21]===Symbol.for("react.memo_cache_sentinel")?(A=(0,n.jsx)("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[21]=A):A=t[21];let y;t[22]!==r||t[23]!==e?(y=e(r==="config"?"Copied":"Copy MCP config"),t[22]=r,t[23]=e,t[24]=y):y=t[24];let S;t[25]!==f||t[26]!==y?(S=(0,n.jsx)(We,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:y}),t[25]=f,t[26]=y,t[27]=S):S=t[27];let L;t[28]!==r||t[29]!==e?(L=e(r==="prompt"?"Copied":"Copy agent prompt"),t[28]=r,t[29]=e,t[30]=L):L=t[30];let M;t[31]!==g||t[32]!==L?(M=(0,n.jsx)(We,{"data-testid":"home-connect-agent-copy-prompt",onClick:g,size:"xs",variant:"outline",children:L}),t[31]=g,t[32]=L,t[33]=M):M=t[33];let N;t[34]!==S||t[35]!==M?(N=(0,n.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[A,(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[S,M]})]}),t[34]=S,t[35]=M,t[36]=N):N=t[36];let C;return t[37]!==w||t[38]!==N?(C=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[w,N]}),t[37]=w,t[38]=N,t[39]=C):C=t[39],C},"kt"),Lt=(0,I.lazy)(()=>import("./chunk-2ABVDLD3.js")),Mt=d((t,e)=>{if(e==null)return t("cache not enabled");let s=e.hits+e.misses;return s===0?t("no cache traffic yet"):`${Math.round(e.hits/s*100).toString()}% ${t("cache hit")}`},"Ct"),He=d(t=>{if(t<1e3)return`${String(Math.round(t))}ms`;let e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},"De"),Ct=d((t,e)=>{let s=Math.max(0,Math.round((e-t)/1e3));if(s<60)return`${String(s)}s ago`;let a=Math.round(s/60);if(a<60)return`${String(a)}m ago`;let l=Math.round(a/60);return l<24?`${String(l)}h ago`:`${String(Math.round(l/24))}d ago`},"$t"),nt=d((t,e)=>{if(t===void 0||t.length===0)return[];let s=new Map;for(let a of t)s.set(a.bucketMs,(s.get(a.bucketMs)??0)+a[e]);return[...s.entries()].toSorted(([a],[l])=>a-l).map(([,a])=>a)},"We"),st=d((t,e=!0)=>{if(t.length<4)return null;let s=Math.floor(t.length/2),a=t.slice(0,s).reduce((i,o)=>i+o,0),l=t.slice(s).reduce((i,o)=>i+o,0);if(a===0)return null;let r=(l-a)/a*100;return{positive:e?r>=0:r<=0,text:`${r>=0?"+":""}${r.toFixed(1)}%`}},"Qe"),Oe=d(t=>{let e=(0,_.c)(24),{delta:s,footer:a,label:l,trend:r,unit:i,value:o}=t,c=j(),u;e[0]!==l?(u=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=u):u=e[1];let p;e[2]!==o?(p=(0,n.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:o}),e[2]=o,e[3]=p):p=e[3];let m;e[4]!==i?(m=i!==void 0&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[4]=i,e[5]=m):m=e[5];let f;e[6]!==p||e[7]!==m?(f=(0,n.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[p,m]}),e[6]=p,e[7]=m,e[8]=f):f=e[8];let h;e[9]!==r?(h=r!==void 0&&(0,n.jsx)(I.Suspense,{fallback:(0,n.jsx)("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:(0,n.jsx)(Lt,{data:r})}),e[9]=r,e[10]=h):h=e[10];let g;e[11]!==f||e[12]!==h?(g=(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[f,h]}),e[11]=f,e[12]=h,e[13]=g):g=e[13];let x;e[14]!==u||e[15]!==g?(x=(0,n.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[u,g]}),e[14]=u,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==s||e[18]!==a||e[19]!==c?(b=s==null?a!=null&&(0,n.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:a}):(0,n.jsxs)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[(0,n.jsx)("span",{className:Ee("font-semibold",s.positive?"text-success":"text-destructive"),children:s.text})," ",(0,n.jsx)("span",{className:"text-muted-foreground",children:c("vs. prev.")})]}),e[17]=s,e[18]=a,e[19]=c,e[20]=b):b=e[20];let v;return e[21]!==x||e[22]!==b?(v=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=v):v=e[23],v},"Te"),It=d(()=>{let t=(0,_.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},"At"),Ue=d(t=>{let e=(0,_.c)(7),{command:s,label:a}=t,l;e[0]!==a?(l=(0,n.jsx)("div",{className:"p-4",children:(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:a})}),e[0]=a,e[1]=l):l=e[1];let r;e[2]!==s?(r=(0,n.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:(0,n.jsx)("code",{className:"font-mono text-xs text-muted-foreground",children:s})}),e[2]=s,e[3]=r):r=e[3];let i;return e[4]!==l||e[5]!==r?(i=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0",children:[l,r]}),e[4]=l,e[5]=r,e[6]=i):i=e[6],i},"je"),rt=d(t=>{let e=(0,_.c)(18),{count:s,onView:a,testId:l,title:r}=t,i=j(),o;e[0]!==r?(o=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=o):o=e[1];let c;e[2]!==s||e[3]!==i?(c=s===null?(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:i("No data yet")}):(0,n.jsx)(Ve,{variant:s>0?"destructive":"success",children:s>0?s:i("All clear")}),e[2]=s,e[3]=i,e[4]=c):c=e[4];let u;e[5]!==o||e[6]!==c?(u=(0,n.jsxs)("div",{className:"flex items-start justify-between gap-2 p-4",children:[o,c]}),e[5]=o,e[6]=c,e[7]=u):u=e[7];let p;e[8]!==i?(p=i("View"),e[8]=i,e[9]=p):p=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=(0,n.jsx)(It,{}),e[10]=m):m=e[10];let f;e[11]!==a||e[12]!==p?(f=(0,n.jsxs)("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:a,type:"button",children:[p,m]}),e[11]=a,e[12]=p,e[13]=f):f=e[13];let h;return e[14]!==u||e[15]!==f||e[16]!==l?(h=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0","data-testid":l,children:[u,f]}),e[14]=u,e[15]=f,e[16]=l,e[17]=h):h=e[17],h},"He"),At=d(t=>{let e=(0,_.c)(7),{functions:s}=t,a=j(),l;if(e[0]!==s||e[1]!==a){let r=[...s].toSorted(Ot).slice(0,5),i;e[3]!==a?(i=a("Top functions"),e[3]=a,e[4]=i):i=e[4];let o;e[5]!==i?(o=(0,n.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i})}),e[5]=i,e[6]=o):o=e[6],l=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[o,r.length===0?(0,n.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:a("No functions called yet.")}):(0,n.jsxs)("div",{className:"divide-y divide-border",children:[(0,n.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[(0,n.jsx)("span",{children:a("Function")}),(0,n.jsx)("span",{className:"text-end",children:a("Calls")}),(0,n.jsx)("span",{className:"w-12 text-end",children:a("Avg")}),(0,n.jsx)("span",{className:"w-8 text-end",children:a("Err")})]}),r.map(Rt)]})]}),e[0]=s,e[1]=a,e[2]=l}else l=e[2];return l},"Lt"),$t=d(t=>{let e=(0,_.c)(26),{subs:s}=t,a=j(),l;e[0]!==a?(l=a("Live connections"),e[0]=a,e[1]=l):l=e[1];let r;e[2]!==l?(r=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[2]=l,e[3]=r):r=e[3];let i=s?.totalConnections??0,o;e[4]!==i?(o=i.toLocaleString(),e[4]=i,e[5]=o):o=e[5];let c;e[6]!==o?(c=(0,n.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:o}),e[6]=o,e[7]=c):c=e[7];let u;e[8]!==a?(u=a("sockets"),e[8]=a,e[9]=u):u=e[9];let p;e[10]!==u?(p=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:u}),e[10]=u,e[11]=p):p=e[11];let m;e[12]!==c||e[13]!==p?(m=(0,n.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[c,p]}),e[12]=c,e[13]=p,e[14]=m):m=e[14];let f=s?.totalSubscriptions??0,h;e[15]!==f?(h=f.toLocaleString(),e[15]=f,e[16]=h):h=e[16];let g;e[17]!==a?(g=a("active subscriptions"),e[17]=a,e[18]=g):g=e[18];let x;e[19]!==h||e[20]!==g?(x=(0,n.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[h," ",g]}),e[19]=h,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==r||e[24]!==m?(b=(0,n.jsx)(T,{"data-testid":"home-live-connections",children:(0,n.jsxs)(Fe,{className:"flex flex-col gap-2.5 py-4",children:[r,m,x]})}),e[22]=x,e[23]=r,e[24]=m,e[25]=b):b=e[25],b},"Mt"),jt=d(t=>{let e=(0,_.c)(7),{entries:s}=t,a=j(),l;if(e[0]!==s||e[1]!==a){let r=Date.now(),i;e[3]!==a?(i=a("Recent activity"),e[3]=a,e[4]=i):i=e[4];let o;e[5]!==i?(o=(0,n.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i})}),e[5]=i,e[6]=o):o=e[6],l=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[o,s.length===0?(0,n.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:a("No recent activity.")}):(0,n.jsx)("ul",{className:"divide-y divide-border",children:s.slice(0,5).map(c=>(0,n.jsxs)("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[(0,n.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),(0,n.jsxs)("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&(0,n.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),(0,n.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:Ct(c.ts,r)})]},c.seq))})]}),e[0]=s,e[1]=a,e[2]=l}else l=e[2];return l},"It"),Tt=d(t=>{let e=t.reduce((s,a)=>s+a.calls,0);return e===0?null:t.reduce((s,a)=>s+a.totalDurationMs,0)/e},"Tt"),Yt=d(t=>{let e=(0,_.c)(149),{initialShardKey:s}=t,a=j(),l=Be(),r=s??"",i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let o;e[1]!==r?(o={shardKey:r},e[1]=r,e[2]=o):o=e[2];let c=_e(D.getMetrics,i,o),u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u={},e[3]=u):u=e[3];let p;e[4]!==r?(p={shardKey:r},e[4]=r,e[5]=p):p=e[5];let m=_e(D.getFunctionStats,u,p),f,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(f={},h={shardKey:""},e[6]=f,e[7]=h):(f=e[6],h=e[7]);let g=_e(D.getSecurityAudit,f,h),x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==r?(b={shardKey:r},e[9]=r,e[10]=b):b=e[10];let v=_e(D.listSubscriptions,x,b),k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k={},e[11]=k):k=e[11];let w;e[12]!==r?(w={shardKey:r},e[12]=r,e[13]=w):w=e[13];let A=_e(D.getAuditLog,k,w),y=c.data??null,S,L,M,N,C,$,O,R,q,P,B,E,K,z,V,W,F,U;if(e[14]!==A.data||e[15]!==g.data||e[16]!==y||e[17]!==c.data||e[18]!==l||e[19]!==m.data||e[20]!==v.data||e[21]!==a){N=Array.isArray(m.data?.functions)?m.data.functions:[],O=v.data??null;let Le;e[40]!==A.data?(Le=Array.isArray(A.data?.entries)?A.data.entries:[],e[40]=A.data,e[41]=Le):Le=e[41],L=Le,C=c.data===void 0||m.data===void 0?null:tt(y,N).length,$=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Me;e[42]!==l?(Me=d(()=>{Ne(l({to:"/security"}))},"Ce"),e[42]=l,e[43]=Me):Me=e[43],U=Me;let Ce;e[44]!==l?(Ce=d(()=>{Ne(l({to:"/insights"}))},"$e"),e[44]=l,e[45]=Ce):Ce=e[45],F=Ce;let Ie=nt(y?.history,"calls"),Ae=nt(y?.history,"errors"),Je=Tt(N),$e=Math.max(0,...N.map(qt)),je;e[46]!==y||e[47]!==a?(je=y===null?void 0:Mt(a,y.cache),e[46]=y,e[47]=a,e[48]=je):je=e[48],M=je,V="flex flex-col gap-6",W="lunora-home",B="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",E="home-health";let qe=st(Ie),xe;e[49]!==a?(xe=a("Requests"),e[49]=a,e[50]=xe):xe=e[50];let Ke=y?.requests??0,be;e[51]!==Ke?(be=Ke.toLocaleString(),e[51]=Ke,e[52]=be):be=e[52],e[53]!==Ie||e[54]!==qe||e[55]!==xe||e[56]!==be?(K=(0,n.jsx)(Oe,{delta:qe,label:xe,trend:Ie,value:be}),e[53]=Ie,e[54]=qe,e[55]=xe,e[56]=be,e[57]=K):K=e[57];let ze=st(Ae,!1),ye;e[58]!==a?(ye=a("Errors"),e[58]=a,e[59]=ye):ye=e[59];let De=y?.errors??0,ve;e[60]!==De?(ve=De.toLocaleString(),e[60]=De,e[61]=ve):ve=e[61],e[62]!==Ae||e[63]!==ze||e[64]!==ye||e[65]!==ve?(z=(0,n.jsx)(Oe,{delta:ze,label:ye,trend:Ae,value:ve}),e[62]=Ae,e[63]=ze,e[64]=ye,e[65]=ve,e[66]=z):z=e[66],S=Oe,e[67]!==$e||e[68]!==a?(R=$e>0?`${a("max")} ${He($e)}`:void 0,e[67]=$e,e[68]=a,e[69]=R):R=e[69],e[70]!==a?(q=a("Avg latency"),e[70]=a,e[71]=q):q=e[71],P=Je===null?"\u2014":He(Je),e[14]=A.data,e[15]=g.data,e[16]=y,e[17]=c.data,e[18]=l,e[19]=m.data,e[20]=v.data,e[21]=a,e[22]=S,e[23]=L,e[24]=M,e[25]=N,e[26]=C,e[27]=$,e[28]=O,e[29]=R,e[30]=q,e[31]=P,e[32]=B,e[33]=E,e[34]=K,e[35]=z,e[36]=V,e[37]=W,e[38]=F,e[39]=U}else S=e[22],L=e[23],M=e[24],N=e[25],C=e[26],$=e[27],O=e[28],R=e[29],q=e[30],P=e[31],B=e[32],E=e[33],K=e[34],z=e[35],V=e[36],W=e[37],F=e[38],U=e[39];let H;e[72]!==S||e[73]!==R||e[74]!==q||e[75]!==P?(H=(0,n.jsx)(S,{footer:R,label:q,value:P}),e[72]=S,e[73]=R,e[74]=q,e[75]=P,e[76]=H):H=e[76];let J;e[77]!==a?(J=a("Database size"),e[77]=a,e[78]=J):J=e[78];let Re=y?.databaseSize??null,Y;e[79]!==Re?(Y=Qe(Re),e[79]=Re,e[80]=Y):Y=e[80];let G;e[81]!==M||e[82]!==J||e[83]!==Y?(G=(0,n.jsx)(Oe,{footer:M,label:J,value:Y}),e[81]=M,e[82]=J,e[83]=Y,e[84]=G):G=e[84];let Z;e[85]!==B||e[86]!==E||e[87]!==K||e[88]!==z||e[89]!==H||e[90]!==G?(Z=(0,n.jsxs)("div",{className:B,"data-testid":E,children:[K,z,H,G]}),e[85]=B,e[86]=E,e[87]=K,e[88]=z,e[89]=H,e[90]=G,e[91]=Z):Z=e[91];let ke;e[92]===Symbol.for("react.memo_cache_sentinel")?(ke=(0,n.jsx)(gt,{}),e[92]=ke):ke=e[92];let Q;e[93]!==N?(Q=(0,n.jsx)("div",{className:"lg:col-span-2",children:(0,n.jsx)(At,{functions:N})}),e[93]=N,e[94]=Q):Q=e[94];let X;e[95]!==O?(X=(0,n.jsx)($t,{subs:O}),e[95]=O,e[96]=X):X=e[96];let ee;e[97]!==L?(ee=(0,n.jsx)(jt,{entries:L}),e[97]=L,e[98]=ee):ee=e[98];let te;e[99]!==X||e[100]!==ee?(te=(0,n.jsxs)("div",{className:"flex flex-col gap-3",children:[X,ee]}),e[99]=X,e[100]=ee,e[101]=te):te=e[101];let ae;e[102]!==Q||e[103]!==te?(ae=(0,n.jsxs)("div",{className:"grid gap-3 lg:grid-cols-3",children:[Q,te]}),e[102]=Q,e[103]=te,e[104]=ae):ae=e[104];let ne;e[105]!==a?(ne=a("Advisors"),e[105]=a,e[106]=ne):ne=e[106];let se;e[107]!==ne?(se=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ne}),e[107]=ne,e[108]=se):se=e[108];let re;e[109]!==C||e[110]!==$||e[111]!==a||e[112]!==F||e[113]!==U?(re=$===0&&C===0?(0,n.jsx)(Ye,{description:a("No security or performance issues detected."),icon:(0,n.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),(0,n.jsx)("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:a("No issues found")}):(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,n.jsx)(rt,{count:$,onView:U,testId:"home-security",title:a("Security findings")}),(0,n.jsx)(rt,{count:C,onView:F,testId:"home-performance",title:a("Performance issues")})]}),e[109]=C,e[110]=$,e[111]=a,e[112]=F,e[113]=U,e[114]=re):re=e[114];let le;e[115]!==se||e[116]!==re?(le=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[se,re]}),e[115]=se,e[116]=re,e[117]=le):le=e[117];let oe;e[118]!==a?(oe=a("Get connected"),e[118]=a,e[119]=oe):oe=e[119];let ie;e[120]!==oe?(ie=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:oe}),e[120]=oe,e[121]=ie):ie=e[121];let ce;e[122]!==a?(ce=a("Client SDK"),e[122]=a,e[123]=ce):ce=e[123];let de;e[124]!==ce?(de=(0,n.jsx)(Ue,{command:"npm i @lunora/client",label:ce}),e[124]=ce,e[125]=de):de=e[125];let me;e[126]!==a?(me=a("React"),e[126]=a,e[127]=me):me=e[127];let ue;e[128]!==me?(ue=(0,n.jsx)(Ue,{command:"npm i @lunora/react",label:me}),e[128]=me,e[129]=ue):ue=e[129];let pe;e[130]!==a?(pe=a("CLI"),e[130]=a,e[131]=pe):pe=e[131];let fe;e[132]!==pe?(fe=(0,n.jsx)(Ue,{command:"lunora dev",label:pe}),e[132]=pe,e[133]=fe):fe=e[133];let he;e[134]!==de||e[135]!==ue||e[136]!==fe?(he=(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[de,ue,fe]}),e[134]=de,e[135]=ue,e[136]=fe,e[137]=he):he=e[137];let we;e[138]===Symbol.for("react.memo_cache_sentinel")?(we=(0,n.jsx)(St,{}),e[138]=we):we=e[138];let ge;e[139]!==ie||e[140]!==he?(ge=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[ie,he,we]}),e[139]=ie,e[140]=he,e[141]=ge):ge=e[141];let Se;return e[142]!==V||e[143]!==W||e[144]!==Z||e[145]!==ae||e[146]!==le||e[147]!==ge?(Se=(0,n.jsxs)("div",{className:V,"data-testid":W,children:[Z,ke,ae,le,ge]}),e[142]=V,e[143]=W,e[144]=Z,e[145]=ae,e[146]=le,e[147]=ge,e[148]=Se):Se=e[148],Se},"Yt");function Ot(t,e){return e.calls-t.calls}d(Ot,"Ot");function Rt(t){return(0,n.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[(0,n.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),(0,n.jsx)("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),(0,n.jsx)("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:He(t.calls>0?t.totalDurationMs/t.calls:0)}),(0,n.jsx)("span",{className:Ee("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}d(Rt,"Rt");function qt(t){return t.maxDurationMs}d(qt,"Et");export{ut as a,Yt as b};