@lunora/studio 1.0.0-alpha.217 → 1.0.0-alpha.218

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 (192) hide show
  1. package/dist/index.d.mts +2 -2
  2. package/dist/index.d.ts +2 -2
  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 +2 -2
  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-BImfQhyJ.mjs → ApiDocsPanel-DzvVLAev.mjs} +1 -1
  54. package/dist/packem_shared/{ApiReferencePanel-CigvHhCa.mjs → ApiReferencePanel--1Y4o_-l.mjs} +1 -1
  55. package/dist/packem_shared/{CommandPalette-CSdz9zax.mjs → CommandPalette-D7GxhPrH.mjs} +1 -1
  56. package/dist/packem_shared/DataBrowser-CKbaOtDh.mjs +4 -0
  57. package/dist/packem_shared/GlobalDataBrowser-DSexMt80.mjs +1 -0
  58. package/dist/packem_shared/{HomePanel-_BwLI4TQ.mjs → HomePanel-BkCmY0Hl.mjs} +1 -1
  59. package/dist/packem_shared/{MigrationsPanel-BPWzFdxC.mjs → MigrationsPanel-DLQRarWw.mjs} +1 -1
  60. package/dist/packem_shared/{OpenRpcReferencePanel-C6CM791D.mjs → OpenRpcReferencePanel-a_mbqw67.mjs} +1 -1
  61. package/dist/packem_shared/{ScheduledJobs-B4DPADwk.mjs → ScheduledJobs-DSqsMB51.mjs} +1 -1
  62. package/dist/packem_shared/Studio-BE_SzY44.mjs +1 -0
  63. package/dist/packem_shared/{StudioApp-fYFz6zZQ.mjs → StudioApp-kVjMop0V.mjs} +1 -1
  64. package/dist/packem_shared/{advisor-view-CPgOok_h.mjs → advisor-view-DtkbHW2O.mjs} +1 -1
  65. package/dist/packem_shared/aggregateMetrics-5zEJC6Ju.mjs +1 -0
  66. package/dist/packem_shared/auth-pager-DiDnXsfe.mjs +1 -0
  67. package/dist/packem_shared/{data-grid-DTBAKZlm.mjs → data-grid-BPu1a997.mjs} +1 -1
  68. package/dist/packem_shared/data-view-params-DhYmAkcj.mjs +1 -0
  69. package/dist/packem_shared/{error-alert-tf5zvSLV.mjs → error-alert-dQk3g8WI.mjs} +1 -1
  70. package/dist/packem_shared/{grid-features-Dm80ngyR.mjs → grid-features-ByxOklon.mjs} +1 -1
  71. package/dist/packem_shared/grid-pagination-DgzyzfBh.mjs +1 -0
  72. package/dist/packem_shared/home-panel-B_HN6YMA.mjs +3 -0
  73. package/dist/packem_shared/internal-CyDwqA67.mjs +2 -0
  74. package/dist/packem_shared/{log-line-BoObzuue.mjs → log-line-BHZD2Aj4.mjs} +1 -1
  75. package/dist/packem_shared/{recording-client-BXUIyBL4.mjs → recording-client-CjRFjhya.mjs} +1 -1
  76. package/dist/packem_shared/reference-view-vNXUVPlA.mjs +13 -0
  77. package/dist/packem_shared/{schema-diagram-CDj_69jF.mjs → schema-diagram-DADlbs2X.mjs} +1 -1
  78. package/dist/packem_shared/{sql-result-table-C5y0jwaK.mjs → sql-result-table-DS4o0GoC.mjs} +1 -1
  79. package/dist/packem_shared/{studio-OqNyRY1N.mjs → studio-BVQq3QLR.mjs} +1 -1
  80. package/dist/packem_shared/table-list-sidebar-D30qERKx.mjs +1 -0
  81. package/dist/packem_shared/{use-admin-query-BKXiqLci.mjs → use-admin-query-CR9mHt0P.mjs} +1 -1
  82. package/dist/packem_shared/{use-async-submit-BTr3w2-K.mjs → use-async-submit-LWIKsZ8r.mjs} +1 -1
  83. package/dist/packem_shared/{use-auth-config-CuM3eJZz.mjs → use-auth-config-HmTOvrWd.mjs} +1 -1
  84. package/dist/packem_shared/{use-open-trace-BCW0c9qq.mjs → use-open-trace-DdGxsEB9.mjs} +1 -1
  85. package/dist/packem_shared/{use-sql-assistant-BhIMDQHV.mjs → use-sql-assistant-D4XQ0v0R.mjs} +1 -1
  86. package/dist/standalone/{chunk-VPL4UEUQ.js → chunk-2ABVDLD3.js} +1 -1
  87. package/dist/standalone/{chunk-WMCC4HKS.js → chunk-2GX5QWJO.js} +1 -1
  88. package/dist/standalone/{chunk-ZBCR4Y7H.js → chunk-4MDN4KNZ.js} +1 -1
  89. package/dist/standalone/chunk-4QRACVKS.js +1 -0
  90. package/dist/standalone/chunk-5ICUJ4IA.js +15 -0
  91. package/dist/standalone/{chunk-FODLDLE2.js → chunk-6B7FVPW3.js} +5 -5
  92. package/dist/standalone/chunk-6DAD3RFX.js +1 -0
  93. package/dist/standalone/{chunk-2J44JAMR.js → chunk-6P2CF75M.js} +1 -1
  94. package/dist/standalone/chunk-7MUDJ77E.js +2 -0
  95. package/dist/standalone/chunk-7RC4EUCQ.js +1 -0
  96. package/dist/standalone/{chunk-JYKNN7XE.js → chunk-A2XTI2C3.js} +1 -1
  97. package/dist/standalone/{chunk-PA2VU4KN.js → chunk-AH6MS5JC.js} +1 -1
  98. package/dist/standalone/chunk-AZK27U77.js +5 -0
  99. package/dist/standalone/chunk-C4ZYEJTF.js +1 -0
  100. package/dist/standalone/{chunk-WD3PESCG.js → chunk-CP3R2ALX.js} +1 -1
  101. package/dist/standalone/chunk-CPWKS5SR.js +1 -0
  102. package/dist/standalone/{chunk-3OI7B7W6.js → chunk-CUHQANWF.js} +1 -1
  103. package/dist/standalone/chunk-CYZRKXQ7.js +1 -0
  104. package/dist/standalone/{chunk-TIUMFAN2.js → chunk-DKLSANZA.js} +1 -1
  105. package/dist/standalone/{chunk-NX2EQSOE.js → chunk-DX6246CW.js} +1 -1
  106. package/dist/standalone/{chunk-DX6FAHR2.js → chunk-DXT2DY4I.js} +1 -1
  107. package/dist/standalone/{chunk-QHRQX4KT.js → chunk-EUKWJXVS.js} +1 -1
  108. package/dist/standalone/chunk-EULTOXNM.js +1 -0
  109. package/dist/standalone/{chunk-DUKQRASV.js → chunk-FAEOVAT3.js} +1 -1
  110. package/dist/standalone/{chunk-U745VG7H.js → chunk-FBF54LE5.js} +1 -1
  111. package/dist/standalone/{chunk-A2TVIAEC.js → chunk-FKERUAF4.js} +1 -1
  112. package/dist/standalone/chunk-FRFZPB5H.js +1 -0
  113. package/dist/standalone/{chunk-E7TOMONS.js → chunk-FS4GMDIW.js} +1 -1
  114. package/dist/standalone/chunk-GIGWJPT6.js +3 -0
  115. package/dist/standalone/chunk-GIKJQCRP.js +1 -0
  116. package/dist/standalone/{chunk-EDGO46IR.js → chunk-GZTVFMUP.js} +1 -1
  117. package/dist/standalone/{chunk-NKPDRRNQ.js → chunk-HL4ZEZMY.js} +1 -1
  118. package/dist/standalone/{chunk-EHTUWA7S.js → chunk-HP3744HC.js} +1 -1
  119. package/dist/standalone/{chunk-3S77QF26.js → chunk-HSFHUX3I.js} +1 -1
  120. package/dist/standalone/{chunk-BOTGXX4H.js → chunk-IJPXZZZ5.js} +1 -1
  121. package/dist/standalone/{chunk-Y5D7BKI4.js → chunk-JKIJX6RO.js} +1 -1
  122. package/dist/standalone/{chunk-4Q6ZHR7P.js → chunk-JORZEU6W.js} +1 -1
  123. package/dist/standalone/{chunk-N3R2NFDS.js → chunk-LE6D7O3V.js} +1 -1
  124. package/dist/standalone/{chunk-RLVFEWIN.js → chunk-LOXE2EQN.js} +1 -1
  125. package/dist/standalone/{chunk-GNT6XGND.js → chunk-LRXRBN53.js} +1 -1
  126. package/dist/standalone/{chunk-GGPSI4ZR.js → chunk-MDUTVBJZ.js} +1 -1
  127. package/dist/standalone/chunk-NMPKQ7ZP.js +14 -0
  128. package/dist/standalone/{chunk-LAOVV6GJ.js → chunk-NNLGVQGS.js} +1 -1
  129. package/dist/standalone/{chunk-YHCB77HW.js → chunk-O73LCRWX.js} +1 -1
  130. package/dist/standalone/{chunk-UEZQP5EU.js → chunk-OHOQXJGW.js} +1 -1
  131. package/dist/standalone/{chunk-SO2DWPC4.js → chunk-OOPAQUOU.js} +1 -1
  132. package/dist/standalone/{chunk-OK2Q64WC.js → chunk-OTSOULJM.js} +1 -1
  133. package/dist/standalone/{chunk-BDO4YYBB.js → chunk-PY5P53RV.js} +3 -3
  134. package/dist/standalone/{chunk-LBMSRD6N.js → chunk-Q2F2DRGB.js} +1 -1
  135. package/dist/standalone/{chunk-SGBJAOTU.js → chunk-Q57WJNAA.js} +1 -1
  136. package/dist/standalone/{chunk-YIK4XEVX.js → chunk-QHXU4TU5.js} +1 -1
  137. package/dist/standalone/chunk-QKZ2JCH3.js +1 -0
  138. package/dist/standalone/{chunk-6EJUU2ZR.js → chunk-RQZETKMO.js} +1 -1
  139. package/dist/standalone/{chunk-7PKIWAFQ.js → chunk-SDHDZTLI.js} +1 -1
  140. package/dist/standalone/chunk-SDORK4S2.js +1 -0
  141. package/dist/standalone/chunk-T5TFEQQX.js +1 -0
  142. package/dist/standalone/{chunk-3F35BVE4.js → chunk-TJUJQDTM.js} +1 -1
  143. package/dist/standalone/{chunk-HRHJB4QO.js → chunk-TOWJVMCP.js} +1 -1
  144. package/dist/standalone/{chunk-F2FPKLFM.js → chunk-TZPC24PB.js} +1 -1
  145. package/dist/standalone/{chunk-4FNAK556.js → chunk-V4UHVN7O.js} +1 -1
  146. package/dist/standalone/chunk-V5N7DHTG.js +1 -0
  147. package/dist/standalone/chunk-VQTSESFP.js +1 -0
  148. package/dist/standalone/{chunk-OVBIGTEL.js → chunk-VUIMAZAE.js} +1 -1
  149. package/dist/standalone/{chunk-XUNTO4S2.js → chunk-W2RO7ETU.js} +1 -1
  150. package/dist/standalone/{chunk-R3J3OY24.js → chunk-WM4EMDVF.js} +1 -1
  151. package/dist/standalone/{chunk-IDVSCQJU.js → chunk-WQBJWQ4N.js} +1 -1
  152. package/dist/standalone/{chunk-YDIJI7T6.js → chunk-WSV2XPHL.js} +1 -1
  153. package/dist/standalone/chunk-X77OELCM.js +1 -0
  154. package/dist/standalone/{chunk-JYQA5LES.js → chunk-XJOQJUZC.js} +1 -1
  155. package/dist/standalone/{chunk-BMDPZOBN.js → chunk-Y5PCZUGU.js} +1 -1
  156. package/dist/standalone/chunk-YV6JXZJO.js +1 -0
  157. package/dist/standalone/{chunk-2DX5MROH.js → chunk-ZHM5ZHPC.js} +1 -1
  158. package/dist/standalone/{chunk-PD6WIDY6.js → chunk-ZJZNCJHY.js} +1 -1
  159. package/dist/standalone/{chunk-SYJQ3QYJ.js → chunk-ZRMO7SAI.js} +1 -1
  160. package/dist/standalone/chunk-ZU2LKNAK.js +1 -0
  161. package/dist/standalone/studio.js +1 -1
  162. package/dist/styles.css +1 -1
  163. package/package.json +6 -6
  164. package/dist/packem_shared/DataBrowser-DLRa1EYq.mjs +0 -4
  165. package/dist/packem_shared/GlobalDataBrowser-BTbqR6Wc.mjs +0 -1
  166. package/dist/packem_shared/Studio-CcWQdYrV.mjs +0 -1
  167. package/dist/packem_shared/aggregateMetrics-CY05xrYU.mjs +0 -1
  168. package/dist/packem_shared/data-view-params-qoSTqjAj.mjs +0 -1
  169. package/dist/packem_shared/home-panel-DCUKd8Uk.mjs +0 -3
  170. package/dist/packem_shared/internal-B6haJbiP.mjs +0 -2
  171. package/dist/packem_shared/reference-view-DiikOols.mjs +0 -13
  172. package/dist/packem_shared/table-list-sidebar-DHG1UJC4.mjs +0 -1
  173. package/dist/standalone/chunk-4BSUMM2O.js +0 -1
  174. package/dist/standalone/chunk-4IE4RCU2.js +0 -14
  175. package/dist/standalone/chunk-6IGGJN74.js +0 -1
  176. package/dist/standalone/chunk-75TJGBCF.js +0 -1
  177. package/dist/standalone/chunk-AFUPTCKG.js +0 -1
  178. package/dist/standalone/chunk-C3RVT4ZV.js +0 -1
  179. package/dist/standalone/chunk-EC4MB5HF.js +0 -5
  180. package/dist/standalone/chunk-ETRF5USL.js +0 -1
  181. package/dist/standalone/chunk-FR7VMBTI.js +0 -1
  182. package/dist/standalone/chunk-J54ZPBT7.js +0 -1
  183. package/dist/standalone/chunk-ORJ7WS3N.js +0 -1
  184. package/dist/standalone/chunk-RLLKECZT.js +0 -1
  185. package/dist/standalone/chunk-SI6H2NVN.js +0 -1
  186. package/dist/standalone/chunk-SUDJTC4S.js +0 -1
  187. package/dist/standalone/chunk-SYDJEFWA.js +0 -1
  188. package/dist/standalone/chunk-TFDBSYX4.js +0 -15
  189. package/dist/standalone/chunk-UEVR3CED.js +0 -2
  190. package/dist/standalone/chunk-XGJNOLY6.js +0 -1
  191. package/dist/standalone/chunk-XNHCCZZZ.js +0 -3
  192. package/dist/standalone/chunk-ZGMLIJ7Y.js +0 -1
@@ -1,4 +0,0 @@
1
- import{c as B}from"react/compiler-runtime";import{useLunora as dt}from"@lunora/react";import{useState as D,useEffect as Be,useMemo as Tt,useRef as Ge,useCallback as it}from"react";import{ShardInput as Mn}from"./ShardInput-C6mjgAh4.mjs";import{u as Xe}from"./use-admin-query-BKXiqLci.mjs";import{ADMIN_FUNCTIONS as pe}from"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{b as Qt}from"./browser-storage-BH1MxLZs.mjs";import{f as Ce,i as je,j as Yt,b as Ft,c as Te,d as ke,h as Ln}from"./internal-B6haJbiP.mjs";import{m as Vn,c as Xt,d as vt,G as Bn,a as jn,u as wt,b as zn,T as qn,D as Kn}from"./table-list-sidebar-DHG1UJC4.mjs";import{u as Gn}from"./use-sql-assistant-BhIMDQHV.mjs";import{d as Rt,i as Zt,e as en,a as Jn}from"./wire-codec-Bk4XZGE4.mjs";import{B as yt}from"./button-q0UYSmrn.mjs";import{I as Wn}from"./input-CXhxesPC.mjs";import{L as Mt}from"./label-DKFzyHq6.mjs";import{M as ut}from"./modal-shell-CDztwLnv.mjs";import{useT as he}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{jsx as d,jsxs as E,Fragment as Ze}from"react/jsx-runtime";import{ConfirmButton as Lt}from"./ConfirmButton-DU4p72Er.mjs";import{E as Hn}from"./empty-state-D7jEML_T.mjs";import{C as Et,a as De}from"./control-button-BOZ5K-FC.mjs";import{tableFeatures as Un,sortFn_text as Qn,sortFn_datetime as Yn,sortFn_basic as Xn,sortFn_alphanumeric as Zn,rowSortingFeature as eo,rowSelectionFeature as to,columnVisibilityFeature as no,columnSizingFeature as oo,columnResizingFeature as so,columnOrderingFeature as lo,createSortedRowModel as ro,useTable as ao,flexRender as io}from"@tanstack/react-table";import{useVirtualizer as co}from"@tanstack/react-virtual";import{C as $t}from"./checkbox-CnS9cyCz.mjs";import{c as ct}from"./utils-bhneXptQ.mjs";import{f as uo}from"./virtual-rect-D_j7aLxX.mjs";import{C as Ct,G as fo,T as mo}from"./data-grid-DTBAKZlm.mjs";import{DataFilters as go,toFilterClauses as Fe}from"./DataFilters-Cocu-WWE.mjs";import{G as po,C as bo}from"./grid-features-Dm80ngyR.mjs";import Vt from"./useDebounced-DVeQ5-oW.mjs";import{r as ho,l as xo}from"./shard-history-CaO3C4KQ.mjs";const vo=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}))}))}),wo=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},yo=(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},Bt=(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}`,Co=s=>{const e=B(111),{columns:n,onApply:o,onClose:t,shardKey:c,table:l,total:r,uniqueColumns:a}=s,i=he(),[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 A=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 O;e[25]!==i||e[26]!==l||e[27]!==r?(O=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]=O):O=e[28];let M;e[29]!==O?(M=d("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-desc",children:O}),e[29]=O,e[30]=M):M=e[30];let I;e[31]!==c||e[32]!==i?(I=c===""?i("Shard: root"):i("Shard: {shardKey} — rows in other shards are not touched.",{shardKey:c}),e[31]=c,e[32]=i,e[33]=I):I=e[33];let z;e[34]!==I?(z=d("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-shard",children:I}),e[34]=I,e[35]=z):z=e[35];let q;e[36]!==M||e[37]!==z||e[38]!==$?(q=E("div",{className:"flex flex-col gap-0.5",children:[$,M,z]}),e[36]=M,e[37]=z,e[38]=$,e[39]=q):q=e[39];let F;e[40]!==i?(F=i("Close"),e[40]=i,e[41]=F):F=e[41];let V;e[42]!==t||e[43]!==F?(V=d(yt,{"data-testid":"bulk-patch-close",onClick:t,size:"xs",variant:"ghost",children:F}),e[42]=t,e[43]=F,e[44]=V):V=e[44];let J;e[45]!==q||e[46]!==V?(J=E("div",{className:"flex items-start justify-between",children:[q,V]}),e[45]=q,e[46]=V,e[47]=J):J=e[47];let K;e[48]!==i?(K=i("Column"),e[48]=i,e[49]=K):K=e[49];let Z;e[50]!==K?(Z=d(Mt,{htmlFor:"bulk-patch-column",children:K}),e[50]=K,e[51]=Z):Z=e[51];let Y;e[52]!==i?(Y=i("Column"),e[52]=i,e[53]=Y):Y=e[53];let Q;e[54]!==n?(Q=n.map(No),e[54]=n,e[55]=Q):Q=e[55];let ne;e[56]!==m||e[57]!==Y||e[58]!==Q?(ne=d("select",{"aria-label":Y,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:Q}),e[56]=m,e[57]=Y,e[58]=Q,e[59]=ne):ne=e[59];let oe;e[60]!==i?(oe=i("Value"),e[60]=i,e[61]=oe):oe=e[61];let de;e[62]!==oe?(de=d(Mt,{htmlFor:"bulk-patch-value",children:oe}),e[62]=oe,e[63]=de):de=e[63];let ue;e[64]!==p?(ue=d(Wn,{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]=ue):ue=e[65];let me;e[66]!==Z||e[67]!==ne||e[68]!==de||e[69]!==ue?(me=E("div",{className:"flex items-center gap-2",children:[Z,ne,de,ue]}),e[66]=Z,e[67]=ne,e[68]=de,e[69]=ue,e[70]=me):me=e[70];let re;e[71]!==C?(re=C!==void 0&&d("p",{className:"text-xs text-destructive","data-testid":"bulk-patch-error",role:"alert",children:C}),e[71]=C,e[72]=re):re=e[72];let fe;e[73]!==m||e[74]!==i||e[75]!==r||e[76]!==S?(fe=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]=fe):fe=e[77];let ae;e[78]!==y||e[79]!==i||e[80]!==S?(ae=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]=ae):ae=e[81];let X;e[82]!==w||e[83]!==m||e[84]!==p?(X=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]=X):X=e[85];let be;e[86]!==i?(be=i("Cancel"),e[86]=i,e[87]=be):be=e[87];let te;e[88]!==t||e[89]!==be?(te=d(yt,{"data-testid":"bulk-patch-cancel",onClick:t,size:"xs",variant:"outline",children:be}),e[88]=t,e[89]=be,e[90]=te):te=e[90];const xe=!w;let ie;e[91]!==i||e[92]!==r?(ie=i("Set on {total} rows",{total:r.toString()}),e[91]=i,e[92]=r,e[93]=ie):ie=e[93];let ce;e[94]!==A||e[95]!==xe||e[96]!==ie?(ce=d(yt,{"data-testid":"bulk-patch-apply",disabled:xe,onClick:A,size:"xs",children:ie}),e[94]=A,e[95]=xe,e[96]=ie,e[97]=ce):ce=e[97];let W;e[98]!==te||e[99]!==ce?(W=E("div",{className:"flex justify-end gap-2",children:[te,ce]}),e[98]=te,e[99]=ce,e[100]=W):W=e[100];let G;return e[101]!==t||e[102]!==J||e[103]!==me||e[104]!==re||e[105]!==fe||e[106]!==ae||e[107]!==X||e[108]!==W||e[109]!==R?(G=E(ut,{label:R,onClose:t,panelTestId:"bulk-patch-panel",testId:"bulk-patch-overlay",variant:"dialog",children:[J,me,re,fe,ae,X,W]}),e[101]=t,e[102]=J,e[103]=me,e[104]=re,e[105]=fe,e[106]=ae,e[107]=X,e[108]=W,e[109]=R,e[110]=G):G=e[110],G};function No(s){return d("option",{value:s,children:s},s)}const jt=6,rt=100,So=s=>({paddingLeft:s*16}),ko=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},To=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},Eo=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},_o=s=>s.relation===void 0||s.relation.onDelete==="cascade"?d(To,{table:s.table}):s.isRestrict?d(ko,{table:s.table}):d(Eo,{table:s.table}),tn=s=>{const e=B(35),{depth:n,node:o}=s,t=`cascade-row-${o.table}`;let c;e[0]!==n?(c=So(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=_o(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(tn,{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},Ro=s=>{const e=s._id??s.id??s.__id__??"";return typeof e=="string"?e:typeof e=="number"?e.toString():""},$o=async(s,e,n,o)=>{try{const t=await o(s,e,n),c=t.rows.flatMap(a=>Ro(a)||[]).slice(0,rt),l=t.total??0;return{capNote:l>rt?`showing first ${rt.toString()} of ${l.toString()}`:void 0,rowCount:l,rowIds:c}}catch{return{capNote:"count unavailable",rowCount:0,rowIds:[]}}},nn=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 $o(s,n.field,e,l),m=n?.onDelete==="restrict",f=[],p=`${s}:${e}`,b=c>=jt;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 nn(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 ${jt.toString()}`;u=r===void 0?g:`${r}; ${g}`}return{capNote:u,children:f,isRestrict:m,relation:n,rowCount:a,rowIds:i,table:s}},Do=({onClose:s,onConfirm:e,readPage:n,rowId:o,schema:t,table:c})=>{const l=he(),[r,a]=D(!0),[i,m]=D(null),[f,p]=D(null);Be(()=>{let g=!1;return Ce((async()=>{try{a(!0),p(null);const x=wo(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 nn(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&&yo(i,g=>g.isRestrict).length>0,u=()=>{e(),s()};return E(ut,{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(tn,{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")})]})]})},Po=(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}},Ao=(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},Io=Un({columnOrderingFeature:lo,columnResizingFeature:so,columnSizingFeature:oo,columnVisibilityFeature:no,rowSelectionFeature:to,rowSortingFeature:eo,sortedRowModel:ro(),sortFns:{alphanumeric:Zn,basic:Xn,datetime:Yn,text:Qn}}),Oo=()=>{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(Mo,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},on=(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},Fo=s=>{const e=B(29),{changes:n,committing:o,onCommit:t,onDiscard:c}=s,l=he();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(Lo),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 Mo(s,e){return s+Object.keys(e).length}function Lo(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:je(s.oldValue)}),d("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"→"}),d("span",{className:"text-foreground",children:je(s.newValue)})]},`${s.rowId}:${s.column}`)}const zt=400,Vo=36,Bo={flex:"1 1 0%",minHeight:0,overflow:"auto",position:"relative"},jo={width:"100%"},zo=/\n$/u,qo={alignItems:"center",display:"flex",left:0,position:"absolute",top:0,width:"100%"},Ko={display:"flex",width:"100%"},qt={flex:"0 0 8.5rem",padding:"0.375rem 0.75rem"},Go="2.5rem",sn={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`}),ln=(s,e)=>({...Pt(s),left:`calc(${Go} + ${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",Jo=(s,e,n)=>e.enabled&&e.columns.has(n)?void 0:s,_t="__back__:",Wo=s=>`${_t}${s.table}.${s.column}`,Ho=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},Uo=(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}},Qo=(s,e,n)=>{if(n!==void 0&&n.type!=="any")return Uo(s,n);const o=on(s,e);return typeof e=="number"&&typeof o!="number"?void 0:{value:o}},Yo=({anchor:s,columnIds:e,columnMeta:n,editableColumn:o,rows:t,text:c})=>{const l=c.replaceAll(`\r
2
- `,`
3
- `).replace(zo,"").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:Qo(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}},rn=(s,e)=>Pe(s)??`row-${e.toString()}`,Xo=8,Zo=s=>{const e=B(17),{anchor:n,mask:o,state:t}=s,c=he();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(Xt(t.row,o)).slice(0,Xo);m=d("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 px-3 py-2",children:f.map(us)}),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},es=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"),Ce((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(Zo,{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},ts=s=>s==="asc"?" ▲":s==="desc"?" ▼":"",ns="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",Kt=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:ns,"data-testid":r,onClick:l,type:"button",children:a}),e[5]=l,e[6]=r,e[7]=i):i=e[7],i},os=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=je(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},ss=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:Vn(i,r,c)});let O;e[12]!==_||e[13]!==$?(O=d("span",{className:"text-muted-foreground italic","data-testid":_,title:"Masked (preview)",children:$}),e[12]=_,e[13]=$,e[14]=O):O=e[14],f=O;break e}if(R!==void 0&&(typeof i=="string"||typeof i=="number")&&String(i)!==""){const _=String(i),$=`${R}:${String(i)}`;let O;e[15]!==r||e[16]!==l.maskViewFor||e[17]!==l.onNavigate||e[18]!==l.onPreview||e[19]!==_||e[20]!==$||e[21]!==R?(O=d(es,{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]=O):O=e[22],f=O;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(Kt,{column:r,onExpand:o.onExpandCell,value:i}),e[25]=r,e[26]=o.onExpandCell,e[27]=i,e[28]=$):$=e[28];let O;e[29]!==_||e[30]!==$?(O=E(Ze,{children:[_,$]}),e[29]=_,e[30]=$,e[31]=O):O=e[31],f=O;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,on($,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(os,{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=Jo(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(Kt,{column:r,onExpand:o.onExpandCell,value:b}),e[63]=r,e[64]=b,e[65]=o.onExpandCell,e[66]=T):T=e[66];let A;return e[67]!==T||e[68]!==w?(A=E(Ze,{children:[w,T]}),e[67]=T,e[68]=w,e[69]=A):A=e[69],A},ls=s=>{s.preventDefault()},Gt={any:"?",array:"[]",bigint:"#",boolean:"01",bytes:"0x",id:"→",number:"#",object:"{}",storage:"◫",string:"T",union:"|"},rs=({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:ct("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:ls,onDragStart:r,onDrop:a,style:c===void 0?Pt(n.getSize()):ln(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:[io(n.column.columnDef.header,n.getContext()),ts(n.column.getIsSorted())]}),s!==void 0&&Gt[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:Gt[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:ct("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()})]})},as=s=>{const e=B(13),{table:n}=s,o=he();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:sn,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},is=s=>{const e=B(17),{row:n}=s,o=he();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=rn(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:sn,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},cs=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=he(),{attachScroll:h,scrollLeft:x,scrollToIndex:v,table:y,tableRows:C,tbodyStyle:N,viewportWidth:k,virtualRows:S}=u,w=Ge(null),[T,A]=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 O;e[1]!==y?(O=y.getVisibleLeafColumns(),e[1]=y,e[2]=O):O=e[2];const M=O.length;let I;e[3]!==T||e[4]!==M||e[5]!==o||e[6]!==y||e[7]!==C?(I=ee=>{if(!["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter"].includes(ee.key))return;ee.preventDefault();const H=T??{col:0,row:0};if(ee.key==="Enter"){const we=C[H.row],ye=y.getVisibleLeafColumns()[H.col];if(we!==void 0&&ye!==void 0){const U=Pe(we.original);U!==null&&o.editableColumn(ye.id)&&o.startEdit(U,ye.id)}A(H);return}let{col:ve,row:ge}=H;e:switch(ee.key){case"ArrowDown":{ge=Math.min(ge+1,C.length-1);break e}case"ArrowRight":{ve=Math.min(ve+1,M-1);break e}case"ArrowUp":{ge=Math.max(ge-1,0);break e}default:ve=Math.max(ve-1,0)}A({col:ve,row:ge})},e[3]=T,e[4]=M,e[5]=o,e[6]=y,e[7]=C,e[8]=I):I=e[8];const z=I;let q;e[9]!==T||e[10]!==n||e[11]!==o||e[12]!==y||e[13]!==C?(q=ee=>{const H=o.editable?ee.clipboardData.getData("text/plain"):"";if(H==="")return;ee.preventDefault();const ve=y.getVisibleLeafColumns().map(fs),ge=Yo({anchor:T??{col:0,row:0},columnIds:ve,columnMeta:n,editableColumn:o.editableColumn,rows:C.map(ms),text:H});for(const we of ge.edits)o.stage(we.rowId,we.column,we.value);$({columns:ve.join("\0"),count:ge.skipped})},e[9]=T,e[10]=n,e[11]=o,e[12]=y,e[13]=C,e[14]=q):q=e[14];const F=q;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 K,Z,Y,Q,ne,oe,de,ue,me,re,fe,ae,X,be,te,xe;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]!==z||e[30]!==F||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(gs),H=Po(ee,p,x,k),ve=Ao(y.getVisibleLeafColumns().map(ps),p),ge=U=>{const se=C[U.index],{original:Me}=se,Ae=Pe(Me),Ie=rn(Me,U.index),We={...qo,height:`${U.size.toString()}px`,transform:`translateY(${U.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(is,{row:se}),H.leadPx>0&&d("td",{"aria-hidden":"true",style:{flex:`0 0 ${H.leadPx.toString()}px`}}),se.getVisibleCells().map((Se,ze)=>{if(!H.ids.has(Se.column.id))return null;const Le=ve.get(Se.column.id),He=T!==null&&T.row===U.index&&T.col===ze?" ring-1 ring-ring ring-inset":"";return d("td",{className:ct("group/cell truncate font-mono text-muted-foreground",Le!==void 0&&"border-e border-border bg-background",He),onPointerDown:()=>{A({col:ze,row:U.index})},style:Le===void 0?Pt(Se.column.getSize()):ln(Se.column.getSize(),Le),children:Se.column.id.startsWith(_t)?d(Ho,{counts:m[Se.column.id.slice(_t.length)],rowId:Ie}):d(ss,{cell:Se,edit:o,highlight:i,mask:c,refs:b})},Se.id)}),H.tailPx>0&&d("td",{"aria-hidden":"true",style:{flex:`0 0 ${H.tailPx.toString()}px`}}),E("td",{className:"flex items-center gap-1",style:qt,children:[d("button",{className:Nt,"data-testid":`db-inspect-${Ie}`,onClick:()=>{a(Me)},type:"button",children:"Details"}),t&&E(Ze,{children:[d("button",{className:Nt,"data-testid":`db-edit-${Ie}`,disabled:Ae===null,onClick:()=>{r(Ae,Me)},type:"button",children:"Edit"}),d("button",{className:Nt,"data-testid":`db-delete-${Ie}`,disabled:Ae===null,onClick:()=>{l(Ae)},type:"button",children:"Delete"})]})]})]},se.id)};K=fo,ae="fill",e[60]!==_.columns||e[61]!==_.count||e[62]!==g||e[63]!==y?(X=_.count>0&&_.columns===y.getVisibleLeafColumns().map(bs).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]=X):X=e[64],ne="db-scroll",oe=z,de=F,ue=h,me="grid",re=Bo,fe=0,xe="w-full text-xs",Z="db-rows",Y=jo;let we;e[65]!==y?(we=d(as,{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:qt}),e[67]=ye):ye=e[67],Q=d("thead",{className:"bg-muted/50",children:E("tr",{className:"border-b border-border",style:Ko,children:[we,H.leadPx>0&&d("th",{"aria-hidden":"true",style:{flex:`0 0 ${H.leadPx.toString()}px`}}),y.getFlatHeaders().map(U=>H.ids.has(U.column.id)?d(rs,{declaredType:n?.[U.column.id]?.type,draggedRef:w,header:U,masked:c.columns.has(U.column.id),onTogglePin:f,pinnedOffset:ve.get(U.column.id),table:y},U.id):null),H.tailPx>0&&d("th",{"aria-hidden":"true",style:{flex:`0 0 ${H.tailPx.toString()}px`}}),ye]})}),be=N,te=S.map(U=>ge(U)),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]=z,e[30]=F,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]=K,e[45]=Z,e[46]=Y,e[47]=Q,e[48]=ne,e[49]=oe,e[50]=de,e[51]=ue,e[52]=me,e[53]=re,e[54]=fe,e[55]=ae,e[56]=X,e[57]=be,e[58]=te,e[59]=xe}else K=e[44],Z=e[45],Y=e[46],Q=e[47],ne=e[48],oe=e[49],de=e[50],ue=e[51],me=e[52],re=e[53],fe=e[54],ae=e[55],X=e[56],be=e[57],te=e[58],xe=e[59];let ie;e[68]!==be||e[69]!==te?(ie=d("tbody",{style:be,children:te}),e[68]=be,e[69]=te,e[70]=ie):ie=e[70];let ce;e[71]!==Z||e[72]!==Y||e[73]!==Q||e[74]!==ie||e[75]!==xe?(ce=E("table",{className:xe,"data-testid":Z,style:Y,children:[Q,ie]}),e[71]=Z,e[72]=Y,e[73]=Q,e[74]=ie,e[75]=xe,e[76]=ce):ce=e[76];let W;e[77]!==ne||e[78]!==oe||e[79]!==de||e[80]!==ue||e[81]!==me||e[82]!==re||e[83]!==fe||e[84]!==ce?(W=d("div",{"data-testid":ne,onKeyDown:oe,onPaste:de,ref:ue,role:me,style:re,tabIndex:fe,children:ce}),e[77]=ne,e[78]=oe,e[79]=de,e[80]=ue,e[81]=me,e[82]=re,e[83]=fe,e[84]=ce,e[85]=W):W=e[85];let G;return e[86]!==K||e[87]!==ae||e[88]!==X||e[89]!==W?(G=E(K,{layout:ae,children:[X,W]}),e[86]=K,e[87]=ae,e[88]=X,e[89]=W,e[90]=G):G=e[90],G},ds=(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:A=>A[T],header:l?.[T]===void 0?T:`${T} →`,id:T}));for(const T of o)w.push({accessorFn:()=>{},enableSorting:!1,header:`← ${T.table}`,id:Wo(T)});return w},[o,t,l]),a=Tt(()=>c??[],[c]),[i,m]=D({}),[f,p]=D({}),b=ao({columnResizeMode:"onChange",columns:r,data:a,defaultColumn:{minSize:80,size:200},enableColumnResizing:!0,enableRowSelection:w=>Pe(w.original)!==null,features:Io,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=co({count:u.length,estimateSize:()=>Vo,getScrollElement:()=>g.current,initialRect:{height:zt,width:0},observeElementRect:(w,T)=>uo(w,T,zt),overscan:8}),x=it(w=>{h.scrollToIndex(w)},[h]),[v,y]=D({left:0,width:0}),C=it(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 A=new ResizeObserver(T);return A.observe(w),()=>{w.removeEventListener("scroll",T),A.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 us(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:je(n),children:je(n)})]},e)}function fs(s){return s.id}function ms(s){return s.original}function gs(s){return{getSize:()=>s.getSize(),id:s.id}}function ps(s){return{getSize:()=>s.getSize(),id:s.id}}function bs(s){return s.id}const hs=s=>{const e=B(22),{onCommit:n}=s,o=he(),[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},xs=s=>{const e=B(27),{onApply:n,onCopyLink:o,onDelete:t,onSave:c,saved:l}=s,r=he(),[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(hs,{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",an=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,Jt=(s,e)=>typeof e=="boolean"?"boolean":typeof e=="number"?an.test(s)?"date":"number":e!==null&&typeof e=="object"?"json":"text",vs=(s,e,n)=>n===void 0?Jt(s,e):n.enumValues!==void 0&&n.enumValues.length>0?"enum":n.type==="boolean"?"boolean":n.type==="number"?an.test(s)?"date":"number":Jt(s,e),ws=s=>{try{const e=JSON.parse(s);return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}catch{return null}},ys=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",Cs=s=>{const e=B(23),{column:n,nullable:o,onChange:t,value:c}=s,l=he();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},Ns=s=>{const e=B(23),{column:n,nullable:o,onChange:t,options:c,value:l}=s,r=he(),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($s),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},Ss=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},ks=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"?ys(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},Ts=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},Es=s=>{const e=B(20),{column:n,onChange:o,value:t}=s,c=he();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=ct(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},_s=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=vs(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(Cs,{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(Ns,{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(Ss,{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(ks,{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(Es,{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(Ts,{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},Rs=s=>{const e=B(49),{columnMeta:n,documentText:o,onCancel:t,onDocumentTextChange:c,onSave:l,refs:r}=s,a=he();let i;e[0]!==o?(i=ws(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 A;e[15]!==a?(A=a("JSON"),e[15]=a,e[16]=A):A=e[16];let R;e[17]!==A||e[18]!==T?(R=d("button",{"aria-pressed":T,className:De,"data-testid":"db-editor-json",onClick:N,type:"button",children:A}),e[17]=A,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,K]=V;return d(_s,{column:J,meta:n?.[J],onChange:g,target:r?.[J],value:K},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 O;e[32]!==a?(O=a("Save"),e[32]=a,e[33]=O):O=e[33];let M;e[34]!==l||e[35]!==O?(M=d("button",{className:De,"data-testid":"db-editor-save",onClick:l,type:"button",children:O}),e[34]=l,e[35]=O,e[36]=M):M=e[36];let I;e[37]!==a?(I=a("Cancel"),e[37]=a,e[38]=I):I=e[38];let z;e[39]!==t||e[40]!==I?(z=d("button",{className:De,"data-testid":"db-editor-cancel",onClick:t,type:"button",children:I}),e[39]=t,e[40]=I,e[41]=z):z=e[41];let q;e[42]!==M||e[43]!==z?(q=E("div",{className:"flex items-center gap-1.5",children:[M,z]}),e[42]=M,e[43]=z,e[44]=q):q=e[44];let F;return e[45]!==_||e[46]!==$||e[47]!==q?(F=E("div",{className:"flex flex-col gap-2 border border-border bg-card p-3","data-testid":"db-editor",children:[_,$,q]}),e[45]=_,e[46]=$,e[47]=q,e[48]=F):F=e[48],F};function $s(s){return d("option",{value:s,children:s},s)}const Ds=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=he(),T=S==="table";let A;e[0]!==y||e[1]!==T?(A=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]=A):A=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 O=`size-1.5 rounded-full ${a===void 0?"bg-success":"bg-muted-foreground/50"}`;let M;e[9]!==O?(M=d("span",{"aria-hidden":"true",className:O}),e[9]=O,e[10]=M):M=e[10];let I;e[11]!==a||e[12]!==w?(I=w(a===void 0?"Live":"Live unavailable"),e[11]=a,e[12]=w,e[13]=I):I=e[13];let z;e[14]!==$||e[15]!==M||e[16]!==I?(z=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,I]}),e[14]=$,e[15]=M,e[16]=I,e[17]=z):z=e[17];let q;e[18]!==l||e[19]!==i||e[20]!==C||e[21]!==w?(q=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]=q):q=e[22];let F;e[23]!==o||e[24]!==m?(F=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]=F):F=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(Lt,{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 K;e[37]!==o||e[38]!==r||e[39]!==p||e[40]!==w||e[41]!==N||e[42]!==k?(K=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]=K):K=e[43];let Z;e[44]!==o||e[45]!==r||e[46]!==u||e[47]!==w||e[48]!==N||e[49]!==k?(Z=o&&N>0&&!r&&d(Lt,{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]=Z):Z=e[50];let Y;e[51]!==q||e[52]!==F||e[53]!==V||e[54]!==J||e[55]!==K||e[56]!==Z||e[57]!==A||e[58]!==_||e[59]!==z?(Y=E("div",{className:"flex flex-wrap items-center gap-1.5",children:[A,_,z,q,F,V,J,K,Z]}),e[51]=q,e[52]=F,e[53]=V,e[54]=J,e[55]=K,e[56]=Z,e[57]=A,e[58]=_,e[59]=z,e[60]=Y):Y=e[60];let Q;e[61]!==n||e[62]!==t||e[63]!==c||e[64]!==b||e[65]!==g||e[66]!==h?(Q=d(go,{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]=Q):Q=e[67];let ne;return e[68]!==Y||e[69]!==Q?(ne=E("div",{className:"flex flex-col gap-2","data-testid":"db-view-toggle",children:[Y,Q]}),e[68]=Y,e[69]=Q,e[70]=ne):ne=e[70],ne},Ps=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(Ds,{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(xs,{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(po,{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(Rs,{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(Fo,{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 A;e[53]!==t.writeNotice?(A=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]=A):A=e[54];let R;e[55]!==C||e[56]!==N||e[57]!==k||e[58]!==S||e[59]!==w||e[60]!==T||e[61]!==A?(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,A]}),e[55]=C,e[56]=N,e[57]=k,e[58]=S,e[59]=w,e[60]=T,e[61]=A,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(Hn,{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(mo,{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 O;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?(O=t.viewMode==="table"&&u.rows.length>0&&!g.transposed&&d(cs,{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]=O):O=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),Yt,2)}),e[88]=t.viewMode,e[89]=u,e[90]=g.maskView,e[91]=M):M=e[91];let I;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?(I=d("div",{className:"flex shrink-0 items-center border-t border-border px-4 py-2",children:d(Bn,{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]=I):I=e[102];let z;return e[103]!==R||e[104]!==_||e[105]!==$||e[106]!==O||e[107]!==M||e[108]!==I?(z=E("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"db-page",children:[R,_,$,O,M,I]}),e[103]=R,e[104]=_,e[105]=$,e[106]=O,e[107]=M,e[108]=I,e[109]=z):z=e[109],z},As="/__lunora/seed",St=200,Is=50,Os=(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},Fs=s=>Array.isArray(s)&&s.every(e=>Zt(e)),Ms=async s=>{let e;try{e=await fetch(As,{body:JSON.stringify(s),headers:{"Content-Type":"application/json"},method:"POST"})}catch(o){return{kind:"error",message:`seed request failed: ${Ft(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: ${Ft(t)}`}}return Fs(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)})`}},Ls="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",Vs="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",Bs=({columns:s,fkPools:e,onClose:n,onInsertRows:o,table:t})=>{const c=he(),[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 Ms({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=()=>{Ce(x())},y=s.filter(N=>N.pk!==!0),C=Os(s,e);return E(ut,{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}`,A=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:A})]},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:Ls,"data-testid":"gen-rows-cancel",onClick:n,type:"button",children:c("Cancel")}),d("button",{className:Vs,"data-testid":"gen-rows-generate",disabled:a||C.length>0,onClick:v,type:"button",children:c(a?"Inserting…":"Generate & insert")})]})]})},js=Te(pe.backRelationCounts),zs=(s,e,n,o)=>{const t=B(16),c=dt();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(js,{ids:y,relations:v},ke(o));x.cancelled||a(Object.fromEntries(C.relations.map(qs)))}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 Ce(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 qs(s){return[Dt(s),s.counts]}const Ks=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}},at=s=>{const e=s[0];return e===void 0?void 0:{column:e.id,direction:e.desc?"desc":"asc"}},cn=s=>s==null?"":typeof s=="object"?JSON.stringify(s):String(s),Wt=s=>s.map(e=>({column:e.column,...e.value===void 0?{}:{literal:[e.value]},operator:e.operator,value:e.value===void 0?"":cn(e.value)})),Ht=s=>s===void 0?[]:[{desc:s.direction==="desc",id:s.column}],Gs=s=>[s.column,s.operator,s.value],lt=(s,e,n,o)=>JSON.stringify([s??"",e??"",(n??[]).map(t=>Gs(t)),o===void 0?null:[o.column,o.direction]]),At=200,Js=20,Ws=Te(pe.readTablePage),Hs=Te(pe.facetColumn),kt=Te(pe.writeRow),Us=Te(pe.deleteRows),Qs=Te(pe.clearTable),Ys=Te(pe.patchRows),Xs={},It=new Set(["__doc__","__id__","_creationTime","_id","id"]),Zs=s=>{const e=s.__doc__;if(typeof e=="string"){const o=Jn(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},el=(s,e,n)=>JSON.stringify([s.__lunoraRef,n,en(e)]),tl=({filters:s,offset:e,pageSize:n,search:o,sorting:t,table:c})=>({filters:Fe(s),limit:n,offset:e,orderBy:at(t),search:o,skipCount:!0,table:c}),nl=({filters:s,search:e,table:n})=>({filters:Fe(s),limit:1,search:e,table:n}),ol=(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},sl=s=>!It.has(s),ll=`Stopped after ${At.toString()} batches — rows still match. Run it again to remove the rest.`,rl=`Stopped after ${At.toString()} batches — rows still match. Run it again to set the rest.`,Ut={resumable:!1,truncated:ll,verb:"deleted"},al={resumable:!0,truncated:rl,verb:"written"},il=({initialFilters:s,initialOrderBy:e,initialSearch:n,initialShardKey:o,onSelectTable:t,onViewChange:c,pageSize:l,resolveBackRelations:r,tableParam:a})=>{const i=dt(),[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(()=>Ht(e)),[N,k]=D(n??""),[S,w]=D(()=>Wt(s??[])),{clearFacets:T,facets:A,refetchFacets:R,toggleFacet:_}=jn(),[$,O]=D(null),[M,I]=D(null),[z,q]=D(null),F=Ge(null),V=Oo(),[J,K]=D(null),[Z,Y]=D(!1),[Q,ne]=D(a),[oe,de]=D(()=>lt(o,n,s,e)),[ue,me]=D(0),[re,fe]=D(()=>lt(o,n,s,e)),ae=a!==Q,X=lt(o,n,s,e),te=ae||!ae&&X!==oe&&X!==re;if(te){ne(a),de(X),me(j=>j+1),C(Ht(e)),k(n??"");const P=Wt(s??[]);w(P),b(o??""),T(),V.clear(),K(null),h(0),I(null),q(null),F.current=null}else X!==oe&&de(X);const xe=te?n??"":N,ie=te?o??"":p,ce=`${a??""}:${ue.toString()}`,W=Vt(xe.trim(),300,ce),G=Vt(ie.trim(),400,ce),ee=lt(G,W,Fe(S),at(y));ee!==re&&fe(ee);const H=Xe(pe.listTables,Xs,{live:!0,shardKey:G}),ve=H.data??null,ge=H.error,we=tl({filters:S,offset:g,pageSize:m,search:W,sorting:y,table:u??""}),ye=nl({filters:S,search:W,table:u??""}),U=Xe(pe.readTablePage,we,{enabled:u!==null,keepPreviousData:!1,live:!0,shardKey:G}),se=U.data??null,Me=U.error,{liveError:Ae}=U,Ie=Xe(pe.readTablePage,ye,{enabled:u!==null,live:!0,shardKey:G});Be(()=>{H.data!==void 0&&ho(G)},[H.data,G]);const We=P=>{t?.(P)},Se=(P,j)=>{t?.(P,{search:j})},ze=async(P,j)=>{try{return(await i.query(Ws,{filters:[],limit:Js,offset:0,search:j,table:P},ke(G))).rows.find(_e=>Pe(_e)===j)??null}catch{return null}},Le=(P,j,Ne,_e)=>$e=>i.query(Hs,{column:$e,filters:Fe(Ne),search:_e,table:j},ke(P)),He=P=>{_(P,u===null?null:Le(G,u,S,W))},ft=(P,j)=>{const Ne={column:P,literal:[j],operator:"eq",value:cn(j)};w(_e=>[..._e.filter($e=>$e.column!==P),Ne]),h(0)},mt=wt(Le),et=wt(R),tt=wt(c);Be(()=>{u!==null&&et.current(mt.current(G,u,S,W))},[G,u,S,W]),Be(()=>{u===null||tt.current===void 0||Q!==a||oe!==X||tt.current({filters:Fe(S),orderBy:at(y),search:W,shard:G})},[u,a,Q,oe,X,S,y,W,G]);const Ue=P=>{u!==null&&h(Math.max(0,P))},nt=(P,j)=>{K({column:j,rowId:P})},gt=()=>{K(null)},pt=async()=>{if(u!==null){I(null),Y(!0);try{for(const[P,j]of Object.entries(V.staged))await i.query(kt,{doc:j,id:P,op:"patch",table:u},ke(G)),V.drop(P,j)}catch(P){I(P.message)}K(null),U.refetch(),Y(!1)}},bt=()=>{V.clear(),K(null)},ht=ol(se,V.staged),ot=async(P,j,Ne)=>{if(u===null)return;I(null);let _e;if(P!=="delete"){let $e;try{$e=Ne===void 0||Ne.trim()===""?{}:JSON.parse(Ne)}catch(Ve){I(`Invalid JSON: ${Ve.message}`);return}try{const Ve=Rt($e);if(!Zt(Ve)){I("The document must be a JSON object.");return}_e=Ve}catch(Ve){I(`Invalid document: ${Ve.message}`);return}}try{await i.query(kt,{doc:_e,id:j??void 0,op:P,table:u},ke(G)),O(null),U.refetch()}catch($e){I($e.message)}},Qe=async(P,j,Ne)=>{if(u===null)return 0;I(null),q(null);const _e=el(P,j,G),$e=F.current?.key===_e?F.current.after:void 0,Ve=Ne.resumable?$e??"":void 0;let qe=0;try{const Ye=await Ks({args:j,maxBatches:At,openCursor:Ve,query:async Fn=>{const Ot=await i.query(P,Fn,ke(G));return qe+=Ot.count,Ot}});return F.current=Ye.cursor===void 0?null:{after:Ye.cursor,key:_e},Ye.outcome==="cap-hit"&&I(Ne.truncated),q(`${qe.toString()} ${qe===1?"row":"rows"} ${Ne.verb}.`),qe}catch(Ye){return I(`${Ye.message} (at least ${qe.toString()} rows were already ${Ne.verb})`),F.current=null,qe}finally{h(0),U.refetch()}},xt=P=>{C(P),h(0)},L=Tt(()=>u===null?[]:r?.(u)??[],[r,u]),le=ds(se,y,xt,L),Ee={filters:Fe(S),orderBy:at(y),search:W,shard:p,table:u??void 0},Re=Ie.data?.total,Oe=Re!==void 0,st=Re??(se===null?0:g+se.rows.length),dn=g>0,un=W!==""||Fe(S).length>0,fn=se!==null&&(Oe?g+se.rows.length<st:se.rows.length===m),mn=se===null||se.rows.length===0?0:g+1,gn=se===null?0:g+se.rows.length,pn=()=>{H.refetch()},bn=()=>{v("table")},hn=()=>{v("json")},xn=()=>{Ce(Qe(Us,{filters:Fe(S),search:W,table:u},Ut))},vn=()=>{Ce(Qe(Qs,{table:u},Ut))},wn=P=>{Ce(Qe(Ys,{doc:P,filters:Fe(S),search:W,table:u},al))},yn=P=>{k(P.target.value),h(0)},Cn=P=>{w(P),h(0)},Nn=()=>{I(null);const P={};for(const j of se?.columns??[])It.has(j)||(P[j]="");O({docText:JSON.stringify(P,null,2),id:""})},Sn=P=>{O(j=>j===null?j:{docText:P,id:j.id})},kn=()=>{$!==null&&Ce(ot($.id===""?"insert":"patch",$.id===""?null:$.id,$.docText))},Tn=()=>{O(null),I(null)},En=()=>{Ue(g-m)},_n=()=>{Ue(g+m)},Rn=P=>{Ue(Math.max(0,(P-1)*m))},$n=P=>{f(P),h(0)},Dn=(P,j)=>{I(null),O({docText:JSON.stringify(en(Zs(j)),null,2),id:P})},Pn=P=>{Ce(ot("delete",P))},An=async P=>{if(!(u===null||P.length===0)){I(null);try{for(const j of P)await i.query(kt,{id:j,op:"delete",table:u},ke(G));U.refetch()}catch(j){I(j.message)}}},In=P=>{Ce(An(P))},On=()=>{Ce(pt())};return{addRow:Nn,bulkDelete:xn,bulkPatch:wn,cancelCellEdit:gt,cancelEdit:Tn,changePageSize:$n,clearTable:vn,columns:se?.columns??[],committing:Z,currentView:Ee,discardStaged:bt,editableColumn:sl,editing:$,editingCell:J,facetFilter:ft,facets:A,filter:N,filters:S,goNext:_n,goPrevious:En,hasNext:fn,hasPredicate:un,hasPrevious:dn,jumpToPage:Rn,liveError:Ae,loadTables:pn,navigateToRef:Se,onBulkDeleteSelected:In,onCommitStaged:On,onFilterChange:yn,onFiltersChange:Cn,onRowDelete:Pn,onRowEdit:Dn,page:se,previewRef:ze,pageError:Me,pageSize:m,rangeEnd:gn,rangeStart:mn,queryShardKey:G,saveEdit:kn,selectedTable:u,selectTable:We,setEditorDocumentText:Sn,setShardKey:b,shardKey:p,showJson:hn,showTable:bn,stage:V.stage,stagedChanges:ht,stagedValue:V.stagedValue,startCellEdit:nt,table:le,tables:ve,tablesError:ge,toggleFacet:He,total:st,totalKnown:Oe,viewMode:x,writeError:M,writeNotice:z}},cl="lunora-studio-pinned-columns",dl=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]=Qt(cl,c),a=t??"",i=l[a];let m;e[1]!==o||e[2]!==i?(m=i===void 0?new Set((o??"").split(",").filter(ul)):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(A=>{const R=A[a]??[...f],_=R.includes(T)?R.filter($=>$!==T):[...R,T];return{...A,[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(fl)},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}=zn(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 ul(s){return s!==""}function fl(s){return!s}const ml=Te(pe.describeTable),gl=Te(pe.readTablePage),pl=Te(pe.importShard),bl=s=>{const e=s._id??s.id??s.__id__??"";return typeof e=="string"?e:typeof e=="number"?String(e):""},hl=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}},xl=s=>{const e=dt(),[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(ml,{table:C},ke(N)),{columns:S}=k;i(S);const w={},T=S.filter(A=>A.ref!==void 0&&A.type==="id"&&A.pk!==!0);for(const A of T){if(A.ref===void 0)continue;const{ref:R}=A;if(w[R]===void 0)try{const _=await e.query(gl,{filters:[],limit:Is,offset:0,search:"",table:R},ke(N));w[R]=_.rows.flatMap($=>bl($)||[])}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(pl,{rows:C.map(w=>({doc:w,table:t}))},ke(l)),S=hl(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)=>{Ce(h(C,N))},shardKey:l,table:t}},vl=()=>{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},wl=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,yl=(s,e)=>typeof e=="number"&&wl.test(s),Cl=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=je(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(yl(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=Ln(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=je(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,Yt,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=je(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},Nl=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(Cl,{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(ut,{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},Sl=50,kl=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},Tl=({onFetchTables:s,onSelect:e})=>{const n=he(),[o]=D(()=>xo()),[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,Sl))}catch(C){u.current===y&&b(C.message)}u.current===y&&f(!1)},x=v=>{Ce(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(kl,{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))})]})]})]})},El="lunora-studio-back-relations",_l=s=>new Set((s??[]).filter(e=>e.unique===!0&&e.fields.length===1).map(e=>e.fields[0]??"")),Rl={},$l=50,Dl=[],Pl=Te(pe.listTables),Al=Te(pe.readTablePage),Il=s=>{const e=B(10),{onFetchShardTables:n,onShardChange:o,schemaSwitch:t,shardKey:c}=s;let l;e[0]!==o||e[1]!==c?(l=d(Mn,{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(Tl,{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},ur=({editable:s=!1,globalTableNames:e,initialFilters:n,initialOrderBy:o,initialPins:t,initialSearch:c,initialShardKey:l,onNavigateToGlobal:r,onSelectTable:a,onViewChange:i,pageSize:m=$l,queryBar:f,schemaSwitch:p,tableParam:b})=>{const u=Xe(pe.describeTables,{},{shardKey:l??""}),g=Xe(pe.listTablesIndexes,{},{shardKey:l??""}),h=u.data?.columnsByTable??Rl,[x,v]=Qt(El,{}),y=it(L=>{const le=new Set(x[L]);return Bt(L,h).filter(Ee=>le.has(Dt(Ee)))},[x,h]),C=il({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:A,facets:R,loadTables:_,navigateToRef:$,onFiltersChange:O,page:M,pageError:I,previewRef:z,queryShardKey:q,selectedTable:F,selectTable:V,setShardKey:J,shardKey:K,stage:Z,stagedValue:Y,startCellEdit:Q,tables:ne,tablesError:oe,toggleFacet:de}=C,ue=Gn(K),me=L=>{Ce((async()=>{const Ee=await ue.suggestFilter(L,F??"");Ee!==void 0&&O(Ee.map(Re=>{const Oe=Re.value,st=typeof Oe=="string"||typeof Oe=="number"||typeof Oe=="boolean"?String(Oe):"";return{column:Re.column,operator:Re.operator,value:st}}))})())},re=F===null?[]:Bt(F,h),fe=new Set(x[F??""]),ae=[];for(const L of M?.rows??[]){const le=L._id??L.id;typeof le=="string"&&le!==""&&ae.push(le)}const X=zs(fe,re,ae,q),be=L=>{v(le=>{const Ee=F??"",Re=le[Ee]??[];return{...le,[Ee]:Re.includes(L)?Re.filter(Oe=>Oe!==L):[...Re,L]}})},te=dl({columns:k,initialPins:t,selectedTable:F}),xe=vl(),[ie,ce]=D(null),{closeExpandedCell:W,closeInspect:G,expandedCell:ee,inspecting:H,onExpandCell:ve}=xe,ge=dt(),we=Object.fromEntries((h[F??""]??[]).map(L=>[L.name,L])),ye=new Map;for(const L of h[F??""]??[])L.isStorage===!0&&ye.set(L.name,L.bucket);const U=it(async(L,le)=>ge.signedStorageUrl(L,le===void 0?{}:{bucket:le}),[ge]),se=async L=>await ge.query(Pl,{},ke(L)),Me=()=>{F!==null&&V(F)},{closeDialog:Ae,columnMeta:Ie,fkPools:We,insertBatch:Se,open:ze,openDialog:Le}=xl(Me),He=()=>{F!==null&&Le(F,K)},ft=L=>Se(L,Ae),[mt,et]=D(!1),tt=()=>{et(!0)},Ue=()=>{et(!1)},nt=(L,le)=>{if(r!==void 0&&e?.has(L)===!0){r(L,le);return}$(L,le)},gt=f?.onSaveQuery,pt=L=>{gt?.(L,S)},bt={cancelEdit:N,editable:s,editableColumn:w,editingCell:T,onExpandCell:ve,stage:Z,stagedValue:Y,startEdit:Q},ht=L=>{L!==null&&ce(L)},ot=()=>{C.onRowDelete(ie)},Qe=async(L,le,Ee)=>await ge.query(Al,{filters:[{column:le,operator:"eq",value:Ee}],limit:rt,offset:0,orderBy:[],table:L},ke(q)),xt={columns:M?.refs,maskViewFor:te.maskViewFor,onNavigate:nt,onPreview:z};return E("div",{className:"flex h-full min-w-0","data-testid":"lunora-data-browser",children:[d(qn,{header:d(Il,{onFetchShardTables:se,onShardChange:J,schemaSwitch:p,shardKey:K}),onReload:_,onSelect:V,prefix:"db",selected:F,tables:ne??Dl}),E("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[oe!==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:oe}),M===null&&I===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."})}),I!==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:I}),M!==null&&d(Ps,{assistant:ue,backRelations:{available:re,counts:X,enabled:fe,onToggle:be},browser:C,columnMeta:we,edit:bt,editable:s,onAskAiFilter:me,onInspect:xe.onInspect,onOpenBulkPatch:tt,onOpenGenerateRows:He,onRowDelete:ht,onSaveQuery:pt,page:M,preferences:te,queryBar:f,references:xt})]}),M!==null&&d(Kn,{columns:k,facets:R,mask:te.maskView,onFacetFilter:A,onToggleFacet:de}),H!==null&&M!==null&&d(Nl,{columns:M.columns,mask:te.maskView,onClose:G,onNavigate:nt,refs:M.refs,row:Xt(H,te.maskView)}),ie!==null&&F!==null&&d(Do,{onClose:()=>{ce(null)},onConfirm:ot,readPage:Qe,rowId:ie,schema:vo(h),table:F}),ee!==null&&d(bo,{bucket:ye.get(ee.column),column:ee.column,onClose:W,resolveUrl:ye.has(ee.column)?U:void 0,value:ee.value}),mt&&F!==null&&d(Co,{columns:C.columns.filter(L=>C.editableColumn(L)),onApply:C.bulkPatch,onClose:Ue,shardKey:C.queryShardKey,table:F,total:C.total,uniqueColumns:_l(g.data?.indexesByTable[F])}),ze&&F!==null&&Ie!==void 0&&d(Bs,{columns:Ie,fkPools:We,onClose:Ae,onInsertRows:ft,table:F})]})};export{ur as DataBrowser};
@@ -1 +0,0 @@
1
- import{useLunora as de}from"@lunora/react";import{useState as A,useRef as U,useEffect as H}from"react";import{b as I}from"./use-admin-query-BKXiqLci.mjs";import{useAutoRefresh as me}from"./DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";import{m as Q,G as ue,u as fe,a as ge,b as pe,T as be,D as he}from"./table-list-sidebar-DHG1UJC4.mjs";import{useT as V}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{b as xe}from"./cf-links-CBJ5SywP.mjs";import{c as W}from"react/compiler-runtime";import{c as ke,a as Ne,b as Z,e as ve,d as ye,T as we}from"./table-D0SBiDu-.mjs";import{a as Te}from"./control-button-BOZ5K-FC.mjs";import{C as q,G as Se}from"./data-grid-DTBAKZlm.mjs";import{jsx as r,jsxs as F}from"react/jsx-runtime";import{E as Ce}from"./empty-state-D7jEML_T.mjs";const Pe=(t,e)=>{const o=t._id;return typeof o=="string"||typeof o=="number"?String(o):`row-${e.toString()}`},Fe=t=>t==null?"∅":t===""?"(empty)":typeof t=="object"?JSON.stringify(t):String(t),Ee=t=>{const e=W(45),{filters:o,hasMaskedColumns:f,mask:s,maskOn:u,onChangePageSize:i,onJumpToPage:R,onNext:d,onPrevious:T,onRemoveFilter:g,onToggleMask:L,page:c,pageSize:E,pagination:S}=t,C=V(),{hasNext:z,hasPrevious:D,rangeEnd:j,rangeStart:P,total:k}=S;let N;e[0]!==f||e[1]!==u||e[2]!==L||e[3]!==C?(N=f&&r("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border px-4 py-2",children:r("button",{"aria-pressed":u,className:Te,"data-testid":"gdb-mask-toggle",onClick:L,type:"button",children:C("Mask sensitive columns")})}),e[0]=f,e[1]=u,e[2]=L,e[3]=C,e[4]=N):N=e[4];let p;e[5]!==o||e[6]!==s||e[7]!==g||e[8]!==C?(p=o.length>0&&r("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border px-4 py-2 text-xs","data-testid":"gdb-filters",children:o.map((n,m)=>{const G=Fe(Q(n.value,n.column,s));return F("span",{className:"inline-flex items-center gap-1 rounded border border-border bg-muted px-1.5 py-0.5","data-testid":"gdb-filter-chip",children:[r("span",{className:"font-medium text-foreground",children:n.column}),r("span",{className:"text-muted-foreground",children:"="}),r("span",{className:"font-mono text-foreground",children:G}),r("button",{"aria-label":C("Remove filter"),className:"ml-0.5 text-muted-foreground hover:text-foreground","data-testid":"gdb-filter-remove",onClick:()=>{g(m)},type:"button",children:"✕"})]},`${n.column}:${G}`)})}),e[5]=o,e[6]=s,e[7]=g,e[8]=C,e[9]=p):p=e[9];let a;if(e[10]!==s||e[11]!==c.columns){let n;e[13]!==s?(n=m=>F(ke,{children:[m,s.columns.has(m)&&r("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":`gdb-mask-chip-${m}`,title:"This column is masked by a mask() policy",children:"masked"})]},m),e[13]=s,e[14]=n):n=e[14],a=c.columns.map(n),e[10]=s,e[11]=c.columns,e[12]=a}else a=e[12];let b;e[15]!==a?(b=r(Ne,{children:r(Z,{children:a})}),e[15]=a,e[16]=b):b=e[16];let v;if(e[17]!==s||e[18]!==c.columns||e[19]!==c.rows){let n;e[21]!==s||e[22]!==c.columns?(n=(m,G)=>r(Z,{"data-testid":"gdb-row",children:c.columns.map(w=>r(ve,{className:"max-w-xs truncate font-mono text-xs",children:s.enabled&&s.columns.has(w)?r("span",{className:"text-muted-foreground italic","data-testid":`gdb-masked-${w}`,title:"Masked (preview)",children:r(q,{value:Q(m[w],w,s)})}):r(q,{value:m[w]})},w))},Pe(m,G)),e[21]=s,e[22]=c.columns,e[23]=n):n=e[23],v=c.rows.map(n),e[17]=s,e[18]=c.columns,e[19]=c.rows,e[20]=v}else v=e[20];let y;e[24]!==v?(y=r(ye,{children:v}),e[24]=v,e[25]=y):y=e[25];let h;e[26]!==b||e[27]!==y?(h=r(Se,{layout:"fill",children:r("div",{className:"min-h-0 flex-1 overflow-auto",children:F(we,{"data-testid":"gdb-rows",children:[b,y]})})}),e[26]=b,e[27]=y,e[28]=h):h=e[28];let x;e[29]!==z||e[30]!==D||e[31]!==i||e[32]!==R||e[33]!==d||e[34]!==T||e[35]!==E||e[36]!==j||e[37]!==P||e[38]!==k?(x=r("div",{className:"flex shrink-0 items-center border-t border-border px-4 py-2",children:r(ue,{hasNext:z,hasPrevious:D,onJumpToPage:R,onNext:d,onPageSizeChange:i,onPrevious:T,pageSize:E,prefix:"gdb",rangeEnd:j,rangeStart:P,total:k})}),e[29]=z,e[30]=D,e[31]=i,e[32]=R,e[33]=d,e[34]=T,e[35]=E,e[36]=j,e[37]=P,e[38]=k,e[39]=x):x=e[39];let M;return e[40]!==N||e[41]!==p||e[42]!==h||e[43]!==x?(M=F("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"gdb-page",children:[N,p,h,x]}),e[40]=N,e[41]=p,e[42]=h,e[43]=x,e[44]=M):M=e[44],M},Me=()=>{const t=W(8),e=V();let o;t[0]!==e?(o=e("Tables marked .global() (D1-backed, region-replicated) will appear here."),t[0]=e,t[1]=o):o=t[1];let f;t[2]===Symbol.for("react.memo_cache_sentinel")?(f=F("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M3 12h18M12 3a14 14 0 0 1 0 18 14 14 0 0 1 0-18Z"})]}),t[2]=f):f=t[2];let s;t[3]!==e?(s=e("No global tables."),t[3]=e,t[4]=s):s=t[4];let u;return t[5]!==o||t[6]!==s?(u=r("div",{className:"flex flex-1 items-center justify-center p-6",children:r(Ce,{description:o,icon:f,testId:"gdb-empty",title:s})}),t[5]=o,t[6]=s,t[7]=u):u=t[7],u},Ge=50,Oe=[],K=[],Ie=({initialTable:t,onSelectTable:e,pageSize:o=Ge,schemaSwitch:f}={})=>{const s=de(),u=V(),[i,R]=A(t??null),[d,T]=A(0),[g,L]=A(o),[c,E]=A([]),S=fe(c),{clearFacets:C,facets:z,refetchFacets:D,toggleFacet:j}=ge(),P=I(["lunora-global-tables"],()=>s.listGlobalTables()),k=P.data??null,N=P.error,p=I(["lunora-global-page",i??"",d,g,JSON.stringify(c)],()=>s.readGlobalTablePage({filters:c,limit:g,offset:d,table:i??""}),{enabled:i!==null,keepPreviousData:!1}),a=p.data??null,b=p.error,v=(l,O)=>$=>s.facetGlobalColumn({column:$,filters:O,table:l}),y=(l,O)=>{D(v(l,O))};me(()=>{P.refetch(),i!==null&&(p.refetch(),y(i,S.current))},!0);const h=U(void 0),x=l=>{R(l),h.current=l,E([]),S.current=[],C(),T(0),e?.(l)},M=l=>{j(l,i===null?null:v(i,S.current))},n=l=>{E(l),S.current=l,T(0),i!==null&&y(i,l)},m=(l,O)=>{n([...S.current.filter($=>$.column!==l),{column:l,value:O}])},G=l=>{n(S.current.filter((O,$)=>$!==l))},w=U(x);H(()=>{w.current=x}),H(()=>{if(t===void 0||t===""||h.current===t)return;h.current=t;const l=t;queueMicrotask(()=>{w.current(l)})},[t]);const B=l=>{i!==null&&T(Math.max(0,l))},{maskColumns:X,maskOn:Y,maskView:_,onToggleMask:ee}=pe({columns:a?.columns??K,selectedTable:i}),J=a?.total??0,te=d>0,re=a!==null&&d+a.rows.length<J,se=a===null||a.rows.length===0?0:d+1,le=a===null?0:d+a.rows.length,ae=()=>{P.refetch()},oe=()=>{B(d-g)},ne=()=>{B(d+g)},ie=l=>{B(Math.max(0,(l-1)*g))},ce=l=>{L(l),T(0)};return F("div",{className:"flex h-full min-w-0","data-testid":"lunora-global-data-browser",children:[r(be,{header:F("div",{className:"flex shrink-0 flex-col items-stretch gap-2 border-b border-border p-3",children:[f,r("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"gdb-cf-link",href:xe,rel:"noreferrer",target:"_blank",children:u("Open in Cloudflare")})]}),onReload:ae,onSelect:x,prefix:"gdb",selected:i,tables:k??Oe}),F("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[N!==null&&r("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"gdb-tables-error",role:"alert",children:N}),k!==null&&k.length===0&&r(Me,{}),b!==null&&r("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"gdb-page-error",role:"alert",children:b}),k!==null&&k.length>0&&a===null&&b===null&&r("div",{className:"flex flex-1 items-center justify-center p-6",children:r("p",{className:"text-sm text-muted-foreground",children:u("Select a table to browse its rows.")})}),a!==null&&r(Ee,{filters:c,hasMaskedColumns:X.size>0,mask:_,maskOn:Y,onChangePageSize:ce,onJumpToPage:ie,onNext:ne,onPrevious:oe,onRemoveFilter:G,onToggleMask:ee,page:a,pageSize:g,pagination:{hasNext:re,hasPrevious:te,rangeEnd:le,rangeStart:se,total:J}})]}),r(he,{columns:a?.columns??K,facets:z,mask:_,onFacetFilter:m,onToggleFacet:M})]})};export{Ie as GlobalDataBrowser};
@@ -1 +0,0 @@
1
- import{S as b}from"./studio-OqNyRY1N.mjs";import"./ErrorBoundary-BWNF98VF.mjs";import"./operation-console-provider-DoloEvon.mjs";import"./badge-r_5B4LHP.mjs";import"./input-CXhxesPC.mjs";import"./skeleton-DX1gfixl.mjs";import"./home-panel-DCUKd8Uk.mjs";import"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import"./StudioI18nProvider-fVsCSs5L.mjs";import"./data-view-params-qoSTqjAj.mjs";import"./internal-B6haJbiP.mjs";import"./utils-bhneXptQ.mjs";import"./CommandPalette-CSdz9zax.mjs";export{b as Studio};
@@ -1 +0,0 @@
1
- const u=t=>{let e=0,c=0,s=0,n=0,r=0,i=0,a=0;for(const{metrics:o}of t){if(o===null){r+=1;continue}n+=1,e+=o.requests,c+=o.errors,s+=o.databaseSize??0,o.cache&&(i+=o.cache.hits,a+=o.cache.hits+o.cache.misses)}return{failed:r,hitRate:a===0?null:i/a,reachable:n,totalDatabaseSize:s,totalErrors:c,totalRequests:e}},h=(t,e)=>{const c=new Set,s=[];for(const n of["",t.trim(),...e])c.has(n)||(c.add(n),s.push(n));return s},l=(t,e)=>{if(t.length===0)return 0;if(t.sort((s,n)=>s-n),e<=0)return t[0]??0;if(e>=100)return t.at(-1)??0;const c=Math.ceil(e/100*t.length)-1;return t[c]??0},f=t=>{const c=t.functions;if(!c||c.length===0)return{p90:0,p95:0};const s=1e3,n=[];for(const r of c){if(r.calls<=0)continue;const i=r.totalDurationMs/r.calls,a=Math.min(r.calls,s);for(let o=0;o<a;o+=1)n.push(i)}return n.length===0?{p90:0,p95:0}:{p90:l([...n],90),p95:l([...n],95)}},p=(t,e,c="neutral")=>{const s=e-t,n=t===0?null:s/t*100;return{delta:s,direction:c,pct:n}},g=t=>t.map(e=>({...e,avgDurationMs:e.execCount>0?e.totalDurationMs/e.execCount:0}));export{u as aggregateMetrics,p as computeDelta,f as computeLatencyPercentiles,g as enrichQueryStats,l as percentile,h as shardsToAggregate};
@@ -1 +0,0 @@
1
- const g=new Set(["contains","eq","gt","gte","lt","lte","ne"]),s=t=>{if(typeof t!="string")return;const r=t.trim();return r===""?void 0:r},p=t=>{if(t===null||typeof t!="object")return!1;const r=t;return typeof r.column=="string"&&typeof r.operator=="string"&&g.has(r.operator)},c=t=>{if(typeof t!="string"||t==="")return[];try{const r=JSON.parse(t);return Array.isArray(r)?r.filter(p):[]}catch{return[]}},f=t=>{if(typeof t!="string"||t==="")return;const r=t.lastIndexOf(":");if(r<=0)return;const o=t.slice(0,r),e=t.slice(r+1);if(!(e!=="asc"&&e!=="desc"))return{column:o,direction:e}},u=/^[\da-f]{16}$/u,h=t=>{const r={};if(typeof t.pins=="string"&&t.pins!==""){const d=t.pins.split(",").filter(l=>l!==""&&l.length<=64).slice(0,12);d.length>0&&(r.pins=d.join(","))}t.schema==="global"&&(r.schema="global");const o=s(t.table);o!==void 0&&(r.table=o);const e=s(t.shard);e!==void 0&&(r.shard=e);const a=s(t.search);a!==void 0&&(r.search=a);const i=s(t.order);i!==void 0&&f(i)!==void 0&&(r.order=i);const n=s(t.filters);return n!==void 0&&c(n).length>0&&(r.filters=n),r},b=t=>{const r=c(t.filters),o=f(t.order);return{filters:r.length>0?r:void 0,orderBy:o,search:typeof t.search=="string"&&t.search!==""?t.search:void 0,shard:typeof t.shard=="string"&&t.shard!==""?t.shard:void 0,table:typeof t.table=="string"&&t.table!==""?t.table:void 0,tier:t.schema==="global"?"global":"shard"}},v=t=>{const r=t.filters??[];return{filters:r.length>0?JSON.stringify(r):void 0,order:t.orderBy===void 0?void 0:`${t.orderBy.column}:${t.orderBy.direction}`,schema:t.tier==="global"?"global":void 0,search:t.search!==void 0&&t.search!==""?t.search:void 0,shard:t.shard!==void 0&&t.shard!==""?t.shard:void 0,table:t.table!==void 0&&t.table!==""?t.table:void 0}},y=t=>{const{version:r}=t;return typeof r=="string"&&u.test(r)?{version:r}:{}};export{h as a,v as d,b as s,y as v};
@@ -1,3 +0,0 @@
1
- import{c as $}from"react/compiler-runtime";import{useNavigate as He}from"@tanstack/react-router";import{useState as Pe,useEffect as qe,Suspense as et,lazy as tt}from"react";import{B as Ge}from"./badge-r_5B4LHP.mjs";import{C as F,a as Je}from"./card--2hKx4L2.mjs";import{E as st}from"./empty-state-D7jEML_T.mjs";import{u as ve}from"./use-admin-query-BKXiqLci.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,r as at,g as ot,l as rt}from"./internal-B6haJbiP.mjs";import{c as Ye}from"./utils-bhneXptQ.mjs";import{deriveInsights as it}from"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{useLunora as Ze}from"@lunora/react";import{jsx as l,jsxs as h}from"react/jsx-runtime";import{B as Ke}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=Ze(),[n,s]=Pe(Xe);let a,o;return t[0]!==e?(a=()=>{Ne((async()=>{try{s(dt(await e.query(ct,{},lt(""))))}catch{}})())},o=[e],t[0]=e,t[1]=a,t[2]=o):(a=t[1],o=t[2]),qe(a,o),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(),a=He();let o;e[0]!==n.tab||e[1]!==a?(o=()=>{Ne(a({to:`/${n.tab}`}))},e[0]=n.tab,e[1]=a,e[2]=o):o=e[2];const r=o,i=n.bindings.length;let c;e[3]!==n.label?(c=l("span",{className:"text-sm font-medium text-foreground",children:n.label}),e[3]=n.label,e[4]=c):c=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=l(mt,{}),e[5]=m):m=e[5];let d;e[6]!==c?(d=h("div",{className:"flex items-center justify-between",children:[c,m]}),e[6]=c,e[7]=d):d=e[7];let f;e[8]!==i||e[9]!==s?(f=i===1?s("1 binding"):s("{count} bindings",{count:i}),e[8]=i,e[9]=s,e[10]=f):f=e[10];let u;e[11]!==f?(u=l("span",{className:"text-xs text-muted-foreground",children:f}),e[11]=f,e[12]=u):u=e[12];let p;e[13]!==i||e[14]!==n.bindings?(p=i>0&&l("div",{className:"flex flex-wrap gap-1.5",children:n.bindings.map(gt)}),e[13]=i,e[14]=n.bindings,e[15]=p):p=e[15];let g;e[16]!==d||e[17]!==u||e[18]!==p?(g=h(Je,{className:"flex flex-col gap-2 py-4",children:[d,u,p]}),e[16]=d,e[17]=u,e[18]=p,e[19]=g):g=e[19];let x;return e[20]!==n.testId||e[21]!==r||e[22]!==g?(x=l(F,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":n.testId,onClick:r,children:g}),e[20]=n.testId,e[21]=r,e[22]=g,e[23]=x):x=e[23],x},ze=["kv","files","vectors"],pt=(t,e)=>[...t.filter(n=>n.tab!==e.tab),e].toSorted((n,s)=>ze.indexOf(n.tab)-ze.indexOf(s.tab)),ht=()=>{const t=$(19),e=Ze(),n=ut(),s=I();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],t[0]=a):a=t[0];const[o,r]=Pe(a);let i,c;if(t[1]!==e||t[2]!==n.kv||t[3]!==n.storage||t[4]!==n.vectors||t[5]!==s?(i=()=>{const g={cancelled:!1},x=[{enabled:n.kv,label:s("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(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};r(A=>pt(A,_))}}catch{}})());return()=>{g.cancelled=!0}},c=[e,n.kv,n.storage,n.vectors,s],t[1]=e,t[2]=n.kv,t[3]=n.storage,t[4]=n.vectors,t[5]=s,t[6]=i,t[7]=c):(i=t[6],c=t[7]),qe(i,c),o.length===0)return null;let m;t[8]!==s?(m=s("Bindings"),t[8]=s,t[9]=m):m=t[9];let d;t[10]!==m?(d=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:m}),t[10]=m,t[11]=d):d=t[11];let f;t[12]!==o?(f=o.map(yt),t[12]=o,t[13]=f):f=t[13];let u;t[14]!==f?(u=l("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:f}),t[14]=f,t[15]=u):u=t[15];let p;return t[16]!==d||t[17]!==u?(p=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[d,u]}),t[16]=d,t[17]=u,t[18]=p):p=t[18],p};function gt(t){return l(Ge,{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=$(35),e=I();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=at(),t[0]=n):n=t[0];const s=n,[a,o]=Pe(null);let r,i;t[1]!==a?(r=()=>{if(a===null)return;const L=globalThis.setTimeout(()=>{o(null)},St);return()=>{globalThis.clearTimeout(L)}},i=[a],t[1]=a,t[2]=r,t[3]=i):(r=t[2],i=t[3]),qe(r,i);let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=(L,M)=>{ot(M)&&o(L)},t[4]=c):c=t[4];const m=c;let d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{m("config",Nt(s))},t[5]=d):d=t[5];const f=d;let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{m("prompt",_t(s))},t[6]=u):u=t[6];const p=u;let g;t[7]!==e?(g=e("Connect an AI agent"),t[7]=e,t[8]=g):g=t[8];let x;t[9]!==g?(x=l("span",{className:"text-sm font-medium text-foreground",children:g}),t[9]=g,t[10]=x):x=t[10];let b;t[11]!==e?(b=e("Drive this deployment from an AI agent over the Model Context Protocol — it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[11]=e,t[12]=b):b=t[12];let v;t[13]!==b?(v=l("span",{className:"text-xs text-muted-foreground",children:b}),t[13]=b,t[14]=v):v=t[14];let _;t[15]!==x||t[16]!==v?(_=h("div",{className:"flex flex-col gap-1.5 p-4",children:[x,v]}),t[15]=x,t[16]=v,t[17]=_):_=t[17];let A;t[18]===Symbol.for("react.memo_cache_sentinel")?(A=l("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[18]=A):A=t[18];let S;t[19]!==a||t[20]!==e?(S=e(a==="config"?"Copied":"Copy MCP config"),t[19]=a,t[20]=e,t[21]=S):S=t[21];let y;t[22]!==S?(y=l(Ke,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:S}),t[22]=S,t[23]=y):y=t[23];let k;t[24]!==a||t[25]!==e?(k=e(a==="prompt"?"Copied":"Copy agent prompt"),t[24]=a,t[25]=e,t[26]=k):k=t[26];let C;t[27]!==k?(C=l(Ke,{"data-testid":"home-connect-agent-copy-prompt",onClick:p,size:"xs",variant:"outline",children:k}),t[27]=k,t[28]=C):C=t[28];let w;t[29]!==y||t[30]!==C?(w=h("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[A,h("div",{className:"flex flex-wrap gap-2",children:[y,C]})]}),t[29]=y,t[30]=C,t[31]=w):w=t[31];let N;return t[32]!==_||t[33]!==w?(N=h(F,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[_,w]}),t[32]=_,t[33]=w,t[34]=N):N=t[34],N},Ct=tt(()=>import("../packem_chunks/sparkline.mjs")),wt=(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 a=Math.round(s/60);return a<24?`${String(a)}h ago`:`${String(Math.round(a/24))}d ago`},Ve=(t,e)=>{if(t===void 0||t.length===0)return[];const n=new Map;for(const s of t)n.set(s.bucketMs,(n.get(s.bucketMs)??0)+s[e]);return[...n.entries()].toSorted(([s],[a])=>s-a).map(([,s])=>s)},We=(t,e=!0)=>{if(t.length<4)return null;const n=Math.floor(t.length/2),s=t.slice(0,n).reduce((r,i)=>r+i,0),a=t.slice(n).reduce((r,i)=>r+i,0);if(s===0)return null;const o=(a-s)/s*100;return{positive:e?o>=0:o<=0,text:`${o>=0?"+":""}${o.toFixed(1)}%`}},Te=t=>{const e=$(24),{delta:n,footer:s,label:a,trend:o,unit:r,value:i}=t,c=I();let m;e[0]!==a?(m=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[0]=a,e[1]=m):m=e[1];let d;e[2]!==i?(d=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[2]=i,e[3]=d):d=e[3];let f;e[4]!==r?(f=r!==void 0&&l("span",{className:"text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=f):f=e[5];let u;e[6]!==d||e[7]!==f?(u=h("span",{className:"flex items-baseline gap-1.5",children:[d,f]}),e[6]=d,e[7]=f,e[8]=u):u=e[8];let p;e[9]!==o?(p=o!==void 0&&l(et,{fallback:l("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:l(Ct,{data:o})}),e[9]=o,e[10]=p):p=e[10];let g;e[11]!==u||e[12]!==p?(g=h("div",{className:"flex items-center justify-between gap-3",children:[u,p]}),e[11]=u,e[12]=p,e[13]=g):g=e[13];let x;e[14]!==m||e[15]!==g?(x=h("div",{className:"flex flex-col gap-2.5 p-4",children:[m,g]}),e[14]=m,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==n||e[18]!==s||e[19]!==c?(b=n==null?s!=null&&l("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:s}):h("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[l("span",{className:Ye("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},Be=t=>{const e=$(7),{command:n,label:s}=t;let a;e[0]!==s?(a=l("div",{className:"p-4",children:l("span",{className:"text-sm font-medium text-foreground",children:s})}),e[0]=s,e[1]=a):a=e[1];let o;e[2]!==n?(o=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]=o):o=e[3];let r;return e[4]!==a||e[5]!==o?(r=h(F,{className:"justify-between gap-0 py-0",children:[a,o]}),e[4]=a,e[5]=o,e[6]=r):r=e[6],r},Qe=t=>{const e=$(18),{count:n,onView:s,testId:a,title:o}=t,r=I();let i;e[0]!==o?(i=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o}),e[0]=o,e[1]=i):i=e[1];let c;e[2]!==n||e[3]!==r?(c=n===null?l("span",{className:"text-xs text-muted-foreground",children:r("No data yet")}):l(Ge,{variant:n>0?"destructive":"success",children:n>0?n:r("All clear")}),e[2]=n,e[3]=r,e[4]=c):c=e[4];let m;e[5]!==i||e[6]!==c?(m=h("div",{className:"flex items-start justify-between gap-2 p-4",children:[i,c]}),e[5]=i,e[6]=c,e[7]=m):m=e[7];let d;e[8]!==r?(d=r("View"),e[8]=r,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=l(At,{}),e[10]=f):f=e[10];let u;e[11]!==s||e[12]!==d?(u=h("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:s,type:"button",children:[d,f]}),e[11]=s,e[12]=d,e[13]=u):u=e[13];let p;return e[14]!==m||e[15]!==u||e[16]!==a?(p=h(F,{className:"justify-between gap-0 py-0","data-testid":a,children:[m,u]}),e[14]=m,e[15]=u,e[16]=a,e[17]=p):p=e[17],p},Lt=t=>{const e=$(7),{functions:n}=t,s=I();let a;if(e[0]!==n||e[1]!==s){const o=[...n].toSorted(Ot).slice(0,5);let r;e[3]!==s?(r=s("Top functions"),e[3]=s,e[4]=r):r=e[4];let i;e[5]!==r?(i=l("div",{className:"border-b border-border px-4 py-3",children:l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r})}),e[5]=r,e[6]=i):i=e[6],a=h(F,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[i,o.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")})]}),o.map(Rt)]})]}),e[0]=n,e[1]=s,e[2]=a}else a=e[2];return a},Mt=t=>{const e=$(26),{subs:n}=t,s=I();let a;e[0]!==s?(a=s("Live connections"),e[0]=s,e[1]=a):a=e[1];let o;e[2]!==a?(o=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[2]=a,e[3]=o):o=e[3];const r=n?.totalConnections??0;let i;e[4]!==r?(i=r.toLocaleString(),e[4]=r,e[5]=i):i=e[5];let c;e[6]!==i?(c=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let m;e[8]!==s?(m=s("sockets"),e[8]=s,e[9]=m):m=e[9];let d;e[10]!==m?(d=l("span",{className:"text-xs text-muted-foreground",children:m}),e[10]=m,e[11]=d):d=e[11];let f;e[12]!==c||e[13]!==d?(f=h("span",{className:"flex items-baseline gap-1.5",children:[c,d]}),e[12]=c,e[13]=d,e[14]=f):f=e[14];const u=n?.totalSubscriptions??0;let p;e[15]!==u?(p=u.toLocaleString(),e[15]=u,e[16]=p):p=e[16];let g;e[17]!==s?(g=s("active subscriptions"),e[17]=s,e[18]=g):g=e[18];let x;e[19]!==p||e[20]!==g?(x=h("span",{className:"text-[11px] text-muted-foreground",children:[p," ",g]}),e[19]=p,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==o||e[24]!==f?(b=l(F,{"data-testid":"home-live-connections",children:h(Je,{className:"flex flex-col gap-2.5 py-4",children:[o,f,x]})}),e[22]=x,e[23]=o,e[24]=f,e[25]=b):b=e[25],b},It=t=>{const e=$(7),{entries:n}=t,s=I();let a;if(e[0]!==n||e[1]!==s){const o=Date.now();let r;e[3]!==s?(r=s("Recent activity"),e[3]=s,e[4]=r):r=e[4];let i;e[5]!==r?(i=l("div",{className:"border-b border-border px-4 py-3",children:l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r})}),e[5]=r,e[6]=i):i=e[6],a=h(F,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[i,n.length===0?l("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:s("No recent activity.")}):l("ul",{className:"divide-y divide-border",children:n.slice(0,5).map(c=>h("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[h("span",{className:"flex min-w-0 items-center gap-2",children:[l("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),h("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&h("span",{className:"text-muted-foreground",children:[" · ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),l("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:$t(c.ts,o)})]},c.seq))})]}),e[0]=n,e[1]=s,e[2]=a}else a=e[2];return a},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(),a=He(),o=n??"";let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},e[0]=r):r=e[0];let i;e[1]!==o?(i={shardKey:o},e[1]=o,e[2]=i):i=e[2];const c=ve(ye.getMetrics,r,i);let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m={},e[3]=m):m=e[3];let d;e[4]!==o?(d={shardKey:o},e[4]=o,e[5]=d):d=e[5];const f=ve(ye.getFunctionStats,m,d);let u,p;e[6]===Symbol.for("react.memo_cache_sentinel")?(u={},p={shardKey:""},e[6]=u,e[7]=p):(u=e[6],p=e[7]);const g=ve(ye.getSecurityAudit,u,p);let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==o?(b={shardKey:o},e[9]=o,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 A;e[12]!==o?(A={shardKey:o},e[12]=o,e[13]=A):A=e[13];const S=ve(ye.getAuditLog,_,A),y=c.data??null;let k,C,w,N,L,M,j,T,O,B,D,P,R,E,q,U,K,z;if(e[14]!==S.data||e[15]!==g.data||e[16]!==y||e[17]!==c.data||e[18]!==a||e[19]!==f.data||e[20]!==v.data||e[21]!==s){N=Array.isArray(f.data?.functions)?f.data.functions:[],j=v.data??null;let Ce;e[40]!==S.data?(Ce=Array.isArray(S.data?.entries)?S.data.entries:[],e[40]=S.data,e[41]=Ce):Ce=e[41],C=Ce,L=c.data===void 0||f.data===void 0?null:it(y,N).length,M=Array.isArray(g.data?.findings)?g.data.findings.length:null;let we;e[42]!==a?(we=()=>{Ne(a({to:"/security"}))},e[42]=a,e[43]=we):we=e[43],z=we;let $e;e[44]!==a?($e=()=>{Ne(a({to:"/insights"}))},e[44]=a,e[45]=$e):$e=e[45],K=$e;const Ae=Ve(y?.history,"calls"),Le=Ve(y?.history,"errors"),Ue=Tt(N),Me=Math.max(0,...N.map(Et));let Ie;e[46]!==y||e[47]!==s?(Ie=y===null?void 0:wt(s,y.cache),e[46]=y,e[47]=s,e[48]=Ie):Ie=e[48],w=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=We(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?(R=l(Te,{delta:Re,label:he,trend:Ae,value:ge}),e[53]=Ae,e[54]=Re,e[55]=he,e[56]=ge,e[57]=R):R=e[57];const Fe=We(Le,!1);let xe;e[58]!==s?(xe=s("Errors"),e[58]=s,e[59]=xe):xe=e[59];const je=y?.errors??0;let be;e[60]!==je?(be=je.toLocaleString(),e[60]=je,e[61]=be):be=e[61],e[62]!==Le||e[63]!==Fe||e[64]!==xe||e[65]!==be?(E=l(Te,{delta:Fe,label:xe,trend:Le,value:be}),e[62]=Le,e[63]=Fe,e[64]=xe,e[65]=be,e[66]=E):E=e[66],k=Te,e[67]!==Me||e[68]!==s?(T=Me>0?`${s("max")} ${De(Me)}`:void 0,e[67]=Me,e[68]=s,e[69]=T):T=e[69],e[70]!==s?(O=s("Avg latency"),e[70]=s,e[71]=O):O=e[71],B=Ue===null?"—":De(Ue),e[14]=S.data,e[15]=g.data,e[16]=y,e[17]=c.data,e[18]=a,e[19]=f.data,e[20]=v.data,e[21]=s,e[22]=k,e[23]=C,e[24]=w,e[25]=N,e[26]=L,e[27]=M,e[28]=j,e[29]=T,e[30]=O,e[31]=B,e[32]=D,e[33]=P,e[34]=R,e[35]=E,e[36]=q,e[37]=U,e[38]=K,e[39]=z}else k=e[22],C=e[23],w=e[24],N=e[25],L=e[26],M=e[27],j=e[28],T=e[29],O=e[30],B=e[31],D=e[32],P=e[33],R=e[34],E=e[35],q=e[36],U=e[37],K=e[38],z=e[39];let V;e[72]!==k||e[73]!==T||e[74]!==O||e[75]!==B?(V=l(k,{footer:T,label:O,value:B}),e[72]=k,e[73]=T,e[74]=O,e[75]=B,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=rt(Oe),e[79]=Oe,e[80]=Q):Q=e[80];let H;e[81]!==w||e[82]!==W||e[83]!==Q?(H=l(Te,{footer:w,label:W,value:Q}),e[81]=w,e[82]=W,e[83]=Q,e[84]=H):H=e[84];let G;e[85]!==D||e[86]!==P||e[87]!==R||e[88]!==E||e[89]!==V||e[90]!==H?(G=h("div",{className:D,"data-testid":P,children:[R,E,V,H]}),e[85]=D,e[86]=P,e[87]=R,e[88]=E,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]!==j?(Y=l(Mt,{subs:j}),e[95]=j,e[96]=Y):Y=e[96];let Z;e[97]!==C?(Z=l(It,{entries:C}),e[97]=C,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]!==L||e[110]!==M||e[111]!==s||e[112]!==K||e[113]!==z?(ne=M===0&&L===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(Qe,{count:M,onView:z,testId:"home-security",title:s("Security findings")}),l(Qe,{count:L,onView:K,testId:"home-performance",title:s("Performance issues")})]}),e[109]=L,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 oe;e[120]!==ae?(oe=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ae}),e[120]=ae,e[121]=oe):oe=e[121];let re;e[122]!==s?(re=s("Client SDK"),e[122]=s,e[123]=re):re=e[123];let ie;e[124]!==re?(ie=l(Be,{command:"npm i @lunora/client",label:re}),e[124]=re,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(Be,{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(Be,{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]!==oe||e[140]!==fe?(pe=h("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[oe,fe,Se]}),e[139]=oe,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:Ye("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,wt as c,ut as u};
@@ -1,2 +0,0 @@
1
- const a=(t,n,r,i,o)=>{switch(n){case"action":return t.action(r,i,o);case"mutation":return t.mutation(r,i,o);default:return t.query(r,i,o)}},f=t=>({__lunoraRef:t}),u=t=>{const n=t.trim();return n===""?{}:{shardKey:n}},d=t=>t instanceof Error?t.message:String(t),g=t=>{if(t===null||typeof t!="object"||!("code"in t))return;const{code:n}=t;return typeof n=="string"?n:void 0},l=t=>{if(t===null||typeof t!="object"||!("hint"in t))return;const{hint:n}=t;return typeof n=="string"?n:Array.isArray(n)?n.filter(r=>typeof r=="string").join(`
2
- `):void 0},y=t=>{if(t===null||typeof t!="object"||!("docsUrl"in t))return;const n=t.docsUrl;if(typeof n=="string")try{const{protocol:r}=new URL(n);return r==="http:"||r==="https:"?n:void 0}catch{return}},e=t=>{if(t==null)return"—";if(t<1024)return`${t.toString()} B`;const n=["KB","MB","GB","TB"];let r=t/1024,i=0;for(;r>=1024&&i<n.length-1;)r/=1024,i+=1;return`${r.toFixed(1)} ${n[i]??"TB"}`},s=(t,n)=>typeof n=="bigint"?n.toString():n instanceof ArrayBuffer||ArrayBuffer.isView(n)?`<bytes: ${e(n.byteLength)}>`:n,h=t=>{if(t==null)return"";switch(typeof t){case"bigint":case"boolean":case"number":return t.toString();case"string":return t;case"symbol":return t.toString();default:return t instanceof ArrayBuffer||ArrayBuffer.isView(t)?`<bytes: ${e(t.byteLength)}>`:JSON.stringify(t,s)}},c=(t,n)=>{t.catch(r=>{n?.(r)})},m=t=>{if(t!==void 0&&t!=="")return t;const n=globalThis.location;return n?.origin!==void 0&&n.origin!==""?n.origin:"http://localhost:5173"},p=t=>{const n="navigator"in globalThis?globalThis.navigator.clipboard:void 0;return n===void 0?!1:(c(n.writeText(t)),!0)},b=(t,n="")=>{if(t==null||t==="")return n;const r=new Date(t);return Number.isNaN(r.getTime())?String(t):r.toLocaleString()};export{y as a,d as b,f as c,u as d,l as e,c as f,p as g,b as h,h as i,s as j,a as k,e as l,g as m,m as r};
@@ -1,13 +0,0 @@
1
- import{c as P}from"react/compiler-runtime";import{useState as L,useEffectEvent as U,useEffect as ae,createContext as le,use as de}from"react";import{b as z,g as Y,f as ce,k as ue,c as fe,d as me}from"./internal-B6haJbiP.mjs";import{SentIcon as pe,Copy01Icon as he,Search01Icon as ge}from"@hugeicons/core-free-icons";import{HugeiconsIcon as W}from"@hugeicons/react";import{I as xe}from"./input-CXhxesPC.mjs";import{useT as J}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{B as q}from"./button-q0UYSmrn.mjs";import{jsx as i,jsxs as N,Fragment as be}from"react/jsx-runtime";import{B as ye}from"./badge-r_5B4LHP.mjs";import{ShardInput as ve}from"./ShardInput-C6mjgAh4.mjs";import{L as V}from"./label-DKFzyHq6.mjs";import{T as Ne}from"./textarea--40GKAyz.mjs";import{LunoraError as Se}from"@lunora/errors";import{useLunora as ke}from"@lunora/react";import{c as Q}from"./utils-bhneXptQ.mjs";const wt=function(t,e,s){const r=P(15);let n;r[0]===Symbol.for("react.memo_cache_sentinel")?(n={kind:"loading"},r[0]=n):n=r[0];const[o,l]=L(n);let a;r[1]!==e?(a=async()=>e(),r[1]=e,r[2]=a):a=r[2];const g=U(a);let d;r[3]!==s?(d=f=>s(f),r[3]=s,r[4]=d):d=r[4];const c=U(d);let u;r[5]!==c||r[6]!==g||r[7]!==t?(u=()=>{if(t!==void 0)return;let f=!1;return g().then(m=>(f||l(c(m)),m)).catch(m=>{f||l({kind:"error",message:z(m)})}),()=>{f=!0}},r[5]=c,r[6]=g,r[7]=t,r[8]=u):u=r[8];let h;r[9]!==t?(h=[t],r[9]=t,r[10]=h):h=r[10],ae(u,h);let p;return r[11]!==s||r[12]!==o||r[13]!==t?(p=t===void 0?o:s(t),r[11]=s,r[12]=o,r[13]=t,r[14]=p):p=r[14],p},we=t=>typeof t=="number"?"number":typeof t=="boolean"?"boolean":"string",Z=t=>{if(t.enum!==void 0&&t.enum.length>0)return t.enum;if(t.anyOf!==void 0&&t.anyOf.length>0&&t.anyOf.every(e=>e.const!==void 0))return t.anyOf.map(e=>e.const)},F=t=>t===void 0?"any":t.const!==void 0?JSON.stringify(t.const):t.enum!==void 0&&t.enum.length>0?t.enum.map(e=>JSON.stringify(e)).join(" | "):t.anyOf!==void 0&&t.anyOf.length>0?t.anyOf.map(e=>F(e)).join(" | "):t.type==="array"?`array<${F(t.items)}>`:t.type??"any",Oe=t=>{const e=Z(t);return e!==void 0?t.type??we(e[0]):F(t)},$e=t=>{const e=Z(t);return e===void 0?void 0:e.map(s=>JSON.stringify(s)).join(" | ")},Te=t=>{const e=[];t.minimum!==void 0?e.push(`${String(t.minimum)} ≤`):t.exclusiveMinimum!==void 0&&e.push(`${String(t.exclusiveMinimum)} <`);const s=e.length>0;e.push("value"),t.maximum!==void 0?e.push(`≤ ${String(t.maximum)}`):t.exclusiveMaximum!==void 0&&e.push(`< ${String(t.exclusiveMaximum)}`);const r=e.length>(s?2:1);return s||r?e.join(" "):void 0},Ee=t=>{if(t.type==="object"&&t.properties!==void 0)return t;if(t.type==="array"&&t.items?.type==="object"&&t.items.properties!==void 0)return t.items},D=t=>{if(t===void 0)return null;if(t.const!==void 0)return t.const;if(t.enum!==void 0&&t.enum.length>0)return t.enum[0];if(t.anyOf!==void 0&&t.anyOf.length>0)return D(t.anyOf[0]);switch(t.type){case"array":return[];case"boolean":return!1;case"number":return 0;case"object":{const e={};for(const[s,r]of Object.entries(t.properties??{}))e[s]=D(r);return e}case"string":return"";default:return null}},K=t=>{const e=P(7),{label:s,value:r}=t;let n;e[0]!==s?(n=i("span",{className:"text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1];let o;e[2]!==r?(o=i("span",{className:"text-foreground",children:r}),e[2]=r,e[3]=o):o=e[3];let l;return e[4]!==n||e[5]!==o?(l=N("span",{className:"inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 font-mono text-[10px]",children:[n,o]}),e[4]=n,e[5]=o,e[6]=l):l=e[6],l},Ce=t=>{const e=P(40),{name:s,required:r,schema:n}=t,o=J();let l;e[0]!==n?(l=Te(n),e[0]=n,e[1]=l):l=e[1];const a=l;let g;e[2]!==n?(g=$e(n),e[2]=n,e[3]=g):g=e[3];const d=g,c=n["x-lunora-table"],u=n.format!==void 0||a!==void 0||d!==void 0||c!==void 0;let h;e[4]!==n?(h=Ee(n),e[4]=n,e[5]=h):h=e[5];const p=h,f=r?"*":"?";let m;e[6]!==f?(m=i("span",{className:"text-muted-foreground",children:f}),e[6]=f,e[7]=m):m=e[7];let v;e[8]!==s||e[9]!==m?(v=N("span",{className:"font-mono text-foreground",children:[s,m]}),e[8]=s,e[9]=m,e[10]=v):v=e[10];let k;e[11]!==n?(k=Oe(n),e[11]=n,e[12]=k):k=e[12];let x;e[13]!==k?(x=i("span",{className:"font-mono text-muted-foreground",children:k}),e[13]=k,e[14]=x):x=e[14];let b;e[15]!==v||e[16]!==x?(b=N("div",{className:"flex items-baseline gap-2",children:[v,x]}),e[15]=v,e[16]=x,e[17]=b):b=e[17];let y;e[18]!==n.description?(y=n.description!==void 0&&i("p",{className:"max-w-prose text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=y):y=e[19];let S;e[20]!==u||e[21]!==a||e[22]!==c||e[23]!==n.format||e[24]!==o||e[25]!==d?(S=u&&N("div",{className:"flex flex-wrap gap-1",children:[n.format!==void 0&&i(K,{label:o("Format"),value:n.format}),a!==void 0&&i(K,{label:o("Range"),value:a}),d!==void 0&&i(K,{label:o("Value in"),value:d}),c!==void 0&&i(K,{label:o("relation"),value:c})]}),e[20]=u,e[21]=a,e[22]=c,e[23]=n.format,e[24]=o,e[25]=d,e[26]=S):S=e[26];let O;e[27]!==y||e[28]!==S||e[29]!==b?(O=N("div",{className:"flex flex-col gap-1 py-2",children:[b,y,S]}),e[27]=y,e[28]=S,e[29]=b,e[30]=O):O=e[30];const w=O;if(p===void 0){let $;return e[31]!==w?($=i("div",{className:"border-b border-border/50 last:border-b-0",children:w}),e[31]=w,e[32]=$):$=e[32],$}let T;e[33]!==w?(T=i("summary",{className:"cursor-pointer marker:text-muted-foreground",children:w}),e[33]=w,e[34]=T):T=e[34];let A;e[35]!==p?(A=i("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:i(ee,{schema:p})}),e[35]=p,e[36]=A):A=e[36];let E;return e[37]!==T||e[38]!==A?(E=N("details",{className:"border-b border-border/50 last:border-b-0",children:[T,A]}),e[37]=T,e[38]=A,e[39]=E):E=e[39],E},ee=t=>{const e=P(7),{schema:s}=t;let r;e[0]!==s.required?(r=new Set(s.required),e[0]=s.required,e[1]=r):r=e[1];const n=r;let o;e[2]!==s.properties?(o=Object.entries(s.properties??{}),e[2]=s.properties,e[3]=o):o=e[3];const l=o;let a;return e[4]!==n||e[5]!==l?(a=i("div",{className:"flex flex-col",children:l.map(g=>{const[d,c]=g;return i(Ce,{name:d,required:n.has(d),schema:c},d)})}),e[4]=n,e[5]=l,e[6]=a):a=e[6],a},G=t=>{const e=P(10),{schema:s,testId:r}=t;if(s?.type!=="object"||Object.keys(s.properties??{}).length===0){let l;e[0]!==s?(l=F(s),e[0]=s,e[1]=l):l=e[1];let a;return e[2]!==l||e[3]!==r?(a=i("p",{className:"font-mono text-xs text-muted-foreground","data-testid":r,children:l}),e[2]=l,e[3]=r,e[4]=a):a=e[4],a}let n;e[5]!==s?(n=i(ee,{schema:s}),e[5]=s,e[6]=n):n=e[6];let o;return e[7]!==n||e[8]!==r?(o=i("div",{className:"text-xs","data-testid":r,children:n}),e[7]=n,e[8]=r,e[9]=o):o=e[9],o},Ae=["curl","javascript","lunora"],Ie={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},Re=t=>`api.${t.replaceAll(/[/:]/g,".")}`,je=t=>{const e=D(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},Pe=(t,e,s)=>{const r=`${s}${e.httpPath}`,n=JSON.stringify(je(e),void 0,2),o=JSON.stringify(D(e.argsSchema)??{},void 0,2);switch(t){case"curl":{const l=e.method!=="GET"&&e.method!=="HEAD",a=[`curl -X ${e.method} ${JSON.stringify(r)}`];return l&&a.push(' -H "Content-Type: application/json"',` -d '${n}'`),a.join(` \\
2
- `)}case"lunora":return e.functionPath===void 0?`await fetch(${JSON.stringify(e.httpPath)}, { method: ${JSON.stringify(e.method)} });`:`import { useLunora } from "@lunora/react";
3
- import { api } from "./_generated/api";
4
-
5
- const client = useLunora();
6
- await client.${e.kind??"query"}(${Re(e.functionPath)}, ${o});`;default:{const a=e.method!=="GET"&&e.method!=="HEAD"?`{
7
- method: ${JSON.stringify(e.method)},
8
- headers: { "Content-Type": "application/json" },
9
- body: JSON.stringify(${n}),
10
- }`:`{ method: ${JSON.stringify(e.method)} }`;return`const response = await fetch(${JSON.stringify(r)}, ${a});
11
- const data = await response.json();`}}},Le=t=>{const e=P(24),{operation:s,server:r}=t,n=J(),[o,l]=L("curl");let a;e[0]!==s||e[1]!==o||e[2]!==r?(a=Pe(o,s,r),e[0]=s,e[1]=o,e[2]=r,e[3]=a):a=e[3];const g=a;let d;e[4]!==g?(d=()=>{Y(g)},e[4]=g,e[5]=d):d=e[5];const c=d;let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=y=>{l(y.currentTarget.dataset.sample)},e[6]=u):u=e[6];const h=u;let p;e[7]!==o?(p=Ae.map(y=>i("button",{"aria-selected":o===y,className:"rounded px-2 py-0.5 text-xs text-muted-foreground transition-colors hover:text-foreground aria-selected:bg-muted aria-selected:font-medium aria-selected:text-foreground","data-sample":y,"data-testid":`api-sample-${y}`,onClick:h,role:"tab",type:"button",children:Ie[y]},y)),e[7]=o,e[8]=p):p=e[8];let f;e[9]!==p?(f=i("div",{className:"flex gap-1",role:"tablist",children:p}),e[9]=p,e[10]=f):f=e[10];let m;e[11]!==n?(m=n("Copy"),e[11]=n,e[12]=m):m=e[12];let v;e[13]!==c||e[14]!==m?(v=i(q,{"data-testid":"api-sample-copy",onClick:c,size:"xs",type:"button",variant:"ghost",children:m}),e[13]=c,e[14]=m,e[15]=v):v=e[15];let k;e[16]!==f||e[17]!==v?(k=N("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[f,v]}),e[16]=f,e[17]=v,e[18]=k):k=e[18];let x;e[19]!==g?(x=i("pre",{className:"overflow-auto px-3 pb-3 font-mono text-xs","data-testid":"api-sample-source",children:g}),e[19]=g,e[20]=x):x=e[20];let b;return e[21]!==k||e[22]!==x?(b=N("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card","data-testid":"api-code-samples",children:[k,x]}),e[21]=k,e[22]=x,e[23]=b):b=e[23],b},_e={blue:"text-info",emerald:"text-success",neutral:"text-muted-foreground",orange:"text-warning",red:"text-destructive",violet:"text-royal-amethyst"},Be=t=>{switch(t.toUpperCase()){case"DELETE":return"red";case"GET":return"emerald";case"PATCH":return"orange";case"POST":return"blue";case"PUT":return"orange";default:return"neutral"}},Me=t=>{switch(t){case"action":return"violet";case"mutation":return"orange";case"query":return"emerald";default:return"neutral"}},H=t=>{const e=P(7),{kind:s,method:r,testId:n}=t;let o;e[0]!==s||e[1]!==r?(o=s??r.toUpperCase(),e[0]=s,e[1]=r,e[2]=o):o=e[2];const l=o,a=s===void 0?Be(r):Me(s),g=`${_e[a]} font-mono text-[10px] tracking-wide uppercase`;let d;return e[3]!==l||e[4]!==g||e[5]!==n?(d=i(ye,{className:g,"data-testid":n,variant:"ghost",children:l}),e[3]=l,e[4]=g,e[5]=n,e[6]=d):d=e[6],d},te=t=>t.startsWith("2")?"text-emerald-600 dark:text-emerald-400":t==="default"||t.startsWith("4")||t.startsWith("5")?"text-red-600 dark:text-red-400":"text-muted-foreground",re=t=>t.startsWith("2")?"bg-emerald-500":t==="default"||t.startsWith("4")||t.startsWith("5")?"bg-red-500":"bg-muted-foreground",Je=new Set([" ",`
12
- `,"\r"]),X=" ",De=t=>{let e="";for(const n of t)Je.has(n)||(e+=n);let s=0,r=e.length;for(;s<r&&(e[s]??"")<=X;)s+=1;for(;r>s&&(e[r-1]??"")<=X;)r-=1;return e.slice(s,r)},Ke=/^(?:[a-z][\d+.a-z-]*:)?\/\//i,Fe=(t,e)=>{const s=globalThis.location?.origin??"",r=e===""?s:e,n=De(t);if(r===""){if(Ke.test(n))throw new Error(`restDispatch: refusing to send the admin token off-origin (${n} names its own host and there is no origin to check it against)`);return n}const o=new URL(n,r);if(o.origin!==new URL(r).origin)throw new Error(`restDispatch: refusing to send the admin token off-origin (${o.origin} is not ${r})`);return o.toString()},ze=async(t,e,s,r)=>{const n=t.method!=="GET"&&t.method!=="HEAD",o=Fe(t.httpPath,s),a=await(await fetch(o,{body:n?JSON.stringify(e):void 0,headers:{...n?{"content-type":"application/json"}:{},...r===null||r===""?{}:{authorization:`Bearer ${r}`}},method:t.method})).text();try{return JSON.parse(a)}catch{return a}},We=t=>JSON.stringify(D(t.argsSchema)??{},void 0,2),se=le(null),ne=()=>{const t=de(se);if(t===null)throw new Se("INTERNAL","useOperationRun must be used within an OperationRunProvider");return t},qe=({children:t,operation:e})=>{const s=J(),r=ke(),[n,o]=L(()=>We(e)),[l,a]=L(""),[g,d]=L("idle"),[c,u]=L(void 0),[h,p]=L(null),[f,m]=L(null),v=async()=>{let b;try{b=n.trim()===""?{}:JSON.parse(n)}catch(S){d("error"),u(void 0),m(null),p(s("Invalid JSON args: {message}",{message:z(S)}));return}d("running"),p(null);const y=performance.now();try{const S=await(e.functionPath===void 0?ze(e,b,r.url,r.getAuthToken()):ue(r,e.kind,fe(e.functionPath),b,me(l)));u(S),m(Math.round(performance.now()-y)),d("success")}catch(S){u(void 0),m(Math.round(performance.now()-y)),p(z(S)),d("error")}};return i(se,{value:{argsText:n,durationMs:f,error:h,operation:e,response:c,send:()=>{ce(v())},setArgsText:o,setShardKey:a,shardKey:l,status:g},children:t})},He=()=>{const t=P(48),e=J(),{argsText:s,operation:r,send:n,setArgsText:o,setShardKey:l,shardKey:a,status:g}=ne();let d;t[0]!==o?(d=C=>{o(C.target.value)},t[0]=o,t[1]=d):d=t[1];const c=d;let u;t[2]!==n?(u=C=>{C.key==="Enter"&&(C.metaKey||C.ctrlKey)&&(C.preventDefault(),n())},t[2]=n,t[3]=u):u=t[3];const h=u,p=g==="running";let f;t[4]!==r.kind||t[5]!==r.method?(f=i(H,{kind:r.kind,method:r.method,testId:"api-try-method"}),t[4]=r.kind,t[5]=r.method,t[6]=f):f=t[6];const m=r.functionPath??r.httpPath;let v;t[7]!==m?(v=i("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:m}),t[7]=m,t[8]=v):v=t[8];const k=p?"animate-pulse":void 0;let x;t[9]!==k?(x=i(W,{className:k,icon:pe,strokeWidth:2}),t[9]=k,t[10]=x):x=t[10];let b;t[11]!==p||t[12]!==e?(b=e(p?"Sending…":"Send"),t[11]=p,t[12]=e,t[13]=b):b=t[13];let y;t[14]!==p||t[15]!==n||t[16]!==x||t[17]!==b?(y=N(q,{"data-testid":"api-try-send",disabled:p,onClick:n,size:"sm",type:"button",children:[x,b]}),t[14]=p,t[15]=n,t[16]=x,t[17]=b,t[18]=y):y=t[18];let S;t[19]!==f||t[20]!==v||t[21]!==y?(S=N("div",{className:"flex items-center gap-2 border-b border-border bg-muted px-3 py-2",children:[f,v,y]}),t[19]=f,t[20]=v,t[21]=y,t[22]=S):S=t[22];let O;t[23]!==e?(O=e("Arguments (JSON)"),t[23]=e,t[24]=O):O=t[24];let w;t[25]!==O?(w=i(V,{htmlFor:"api-try-args",children:O}),t[25]=O,t[26]=w):w=t[26];let T;t[27]!==s?(T=s.split(`
13
- `),t[27]=s,t[28]=T):T=t[28];const A=Math.min(12,Math.max(3,T.length));let E;t[29]!==s||t[30]!==c||t[31]!==h||t[32]!==A?(E=i(Ne,{className:"font-mono text-xs","data-testid":"api-try-args",id:"api-try-args",onChange:c,onKeyDown:h,rows:A,spellCheck:!1,value:s}),t[29]=s,t[30]=c,t[31]=h,t[32]=A,t[33]=E):E=t[33];let $;t[34]!==w||t[35]!==E?($=N("div",{className:"flex flex-col gap-1.5",children:[w,E]}),t[34]=w,t[35]=E,t[36]=$):$=t[36];let I;t[37]!==r.functionPath||t[38]!==l||t[39]!==a||t[40]!==e?(I=r.functionPath!==void 0&&N("div",{className:"flex flex-col gap-1.5",children:[i(V,{htmlFor:"shard-input",children:e("Shard key (optional)")}),i(ve,{id:"shard-input",onChange:l,testId:"shard-input",value:a})]}),t[37]=r.functionPath,t[38]=l,t[39]=a,t[40]=e,t[41]=I):I=t[41];let R;t[42]!==$||t[43]!==I?(R=N("div",{className:"flex flex-col gap-3 p-3",children:[$,I]}),t[42]=$,t[43]=I,t[44]=R):R=t[44];let j;return t[45]!==R||t[46]!==S?(j=N("div",{className:"overflow-hidden rounded-xl border border-border bg-card","data-testid":"api-try-it",children:[S,R]}),t[45]=R,t[46]=S,t[47]=j):j=t[47],j},Ue=t=>{const e=P(51),{operation:s}=t,r=J(),n=`api-operation-${s.operationId}`,o=s.key;let l;e[0]!==s.kind||e[1]!==s.method?(l=i(H,{kind:s.kind,method:s.method,testId:"api-operation-method"}),e[0]=s.kind,e[1]=s.method,e[2]=l):l=e[2];const a=s.functionPath??s.httpPath;let g;e[3]!==a?(g=i("code",{className:"truncate font-mono text-xs text-muted-foreground",children:a}),e[3]=a,e[4]=g):g=e[4];let d;e[5]!==l||e[6]!==g?(d=N("div",{className:"flex items-center gap-2",children:[l,g]}),e[5]=l,e[6]=g,e[7]=d):d=e[7];let c;e[8]!==s.title?(c=i("h1",{className:"text-lg font-semibold text-foreground","data-testid":"api-operation-title",children:s.title}),e[8]=s.title,e[9]=c):c=e[9];let u;e[10]!==s.description?(u=s.description!==void 0&&i("p",{className:"text-sm text-muted-foreground",children:s.description}),e[10]=s.description,e[11]=u):u=e[11];let h;e[12]!==d||e[13]!==c||e[14]!==u?(h=N("header",{className:"sticky top-0 z-10 -mx-6 -mt-6 flex flex-col gap-2 border-b border-border bg-background px-6 pt-6 pb-3",children:[d,c,u]}),e[12]=d,e[13]=c,e[14]=u,e[15]=h):h=e[15];let p;e[16]!==r?(p=r("Try it"),e[16]=r,e[17]=p):p=e[17];let f;e[18]!==p?(f=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:p}),e[18]=p,e[19]=f):f=e[19];let m;e[20]===Symbol.for("react.memo_cache_sentinel")?(m=i(He,{}),e[20]=m):m=e[20];let v;e[21]!==f?(v=N("section",{className:"flex flex-col gap-2",children:[f,m]}),e[21]=f,e[22]=v):v=e[22];let k;e[23]!==r?(k=r("Request arguments"),e[23]=r,e[24]=k):k=e[24];let x;e[25]!==k?(x=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:k}),e[25]=k,e[26]=x):x=e[26];let b;e[27]!==s.argsSchema?(b=i(G,{schema:s.argsSchema,testId:"api-operation-args"}),e[27]=s.argsSchema,e[28]=b):b=e[28];let y;e[29]!==x||e[30]!==b?(y=N("section",{className:"flex flex-col gap-2",children:[x,b]}),e[29]=x,e[30]=b,e[31]=y):y=e[31];let S;e[32]!==r?(S=r("Response body"),e[32]=r,e[33]=S):S=e[33];let O;e[34]!==S?(O=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S}),e[34]=S,e[35]=O):O=e[35];let w;if(e[36]!==s.responses||e[37]!==r){let E;e[39]!==r?(E=$=>N("div",{className:"flex flex-col gap-1.5 rounded-xl border border-border bg-card p-3",children:[N("div",{className:"flex items-center justify-between gap-2",children:[N("span",{className:`inline-flex items-center gap-1.5 font-mono text-xs font-semibold ${te($.status)}`,children:[i("span",{className:`size-1.5 rounded-full ${re($.status)}`}),$.status]}),$.schema!==void 0&&i("span",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:r("application/json")})]}),$.description!==void 0&&i("p",{className:"text-xs text-muted-foreground",children:$.description}),$.schema!==void 0&&i(G,{schema:$.schema,testId:`api-response-${$.status}`})]},$.status),e[39]=r,e[40]=E):E=e[40],w=s.responses.map(E),e[36]=s.responses,e[37]=r,e[38]=w}else w=e[38];let T;e[41]!==O||e[42]!==w?(T=N("section",{className:"flex flex-col gap-3",children:[O,w]}),e[41]=O,e[42]=w,e[43]=T):T=e[43];let A;return e[44]!==s.key||e[45]!==n||e[46]!==v||e[47]!==y||e[48]!==T||e[49]!==h?(A=N("div",{className:"flex flex-col gap-6 duration-200 animate-in fade-in-0 slide-in-from-bottom-1","data-testid":n,children:[h,v,y,T]},o),e[44]=s.key,e[45]=n,e[46]=v,e[47]=y,e[48]=T,e[49]=h,e[50]=A):A=e[50],A},Ve={boolean:"text-royal-amethyst",key:"text-sky-sapphire",number:"text-warning",plain:"",string:"text-success"},Ge=/"(?:[^"\\]|\\.)*"|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?/g,Xe=/^\s*:/,Ye=(t,e,s)=>s.startsWith('"')?Xe.test(t.slice(e))?"key":"string":s==="true"||s==="false"||s==="null"?"boolean":"number",Qe=t=>{const e=[];let s=0;for(const r of t.matchAll(Ge)){const{index:n}=r,o=r[0],l=n+o.length;n>s&&e.push({kind:"plain",start:s,text:t.slice(s,n)}),e.push({kind:Ye(t,l,o),start:n,text:o}),s=l}return s<t.length&&e.push({kind:"plain",start:s,text:t.slice(s)}),e},Ze=t=>{const e=P(4),{code:s}=t;let r;e[0]!==s?(r=Qe(s).map(et),e[0]=s,e[1]=r):r=e[1];let n;return e[2]!==r?(n=i(be,{children:r}),e[2]=r,e[3]=n):n=e[3],n};function et(t){return i("span",{className:Ve[t.kind],children:t.text},t.start)}const oe="__live__",tt=t=>t.schema===void 0?"":JSON.stringify(D(t.schema),void 0,2),rt=(t,e,s)=>s?t??"":e===void 0?"":JSON.stringify(e,void 0,2),st=t=>{const e=P(18),{active:s,running:r,showError:n}=t,o=J();if(r){let u;e[0]!==o?(u=o("Sending…"),e[0]=o,e[1]=u):u=e[1];let h;return e[2]!==u?(h=i("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-running",children:u}),e[2]=u,e[3]=h):h=e[3],h}if(s===void 0||s.body===""){let u;e[4]!==s?.live||e[5]!==o?(u=s?.live===!0?o("Send a request to see the response."):o("No example for this response."),e[4]=s?.live,e[5]=o,e[6]=u):u=e[6];let h;return e[7]!==u?(h=i("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-idle",children:u}),e[7]=u,e[8]=h):h=e[8],h}const l=n&&"text-destructive";let a;e[9]!==l?(a=Q("max-h-[28rem] overflow-auto px-3 py-3 font-mono text-xs",l),e[9]=l,e[10]=a):a=e[10];const g=n?"api-response-error":"api-response-body";let d;e[11]!==s.body||e[12]!==n?(d=n?s.body:i(Ze,{code:s.body}),e[11]=s.body,e[12]=n,e[13]=d):d=e[13];let c;return e[14]!==a||e[15]!==g||e[16]!==d?(c=i("pre",{className:a,"data-testid":g,children:d}),e[14]=a,e[15]=g,e[16]=d,e[17]=c):c=e[17],c},nt=({durationMs:t,error:e,failed:s,operation:r,ran:n,response:o,t:l})=>{const a=r.responses.map(d=>({body:tt(d),durationMs:null,id:d.status,label:d.status,live:!1,status:d.status}));return n?[{body:rt(e,o,s),durationMs:t,id:oe,label:l("Live"),live:!0,status:s?"error":"200"},...a]:a},ot=()=>{const t=P(19),e=J(),{durationMs:s,error:r,operation:n,response:o,status:l}=ne(),a=l==="running",g=l==="error",d=l==="success"||g,c=nt({durationMs:s,error:r,failed:g,operation:n,ran:d,response:o,t:e}),u=d?oe:c.find(it)?.id??c[0]?.id??"",[h,p]=L(null),f=c.find(C=>C.id===(h??u))??c[0];let m;t[0]===Symbol.for("react.memo_cache_sentinel")?(m=C=>{const{id:_}=C.currentTarget.dataset;_!==void 0&&p(_)},t[0]=m):m=t[0];const v=m,k=()=>{f!==void 0&&Y(f.body)},x=f?.live===!0?f.durationMs:null,b=f?.live===!0&&f.status==="error",y="flex min-h-0 flex-col rounded-xl border border-border bg-card",S="api-response-panel";let O;t[1]!==e?(O=e("Response"),t[1]=e,t[2]=O):O=t[2];let w;t[3]!==O?(w=i("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:O}),t[3]=O,t[4]=w):w=t[4];const T=x!==null&&i("span",{className:"font-mono text-[10px] text-muted-foreground",children:e("{ms} ms",{ms:x})}),A=f!==void 0&&f.body!==""&&i(q,{"aria-label":e("Copy"),"data-testid":"api-response-copy",onClick:k,size:"icon-xs",type:"button",variant:"ghost",children:i(W,{icon:he,strokeWidth:2})});let E;t[5]!==T||t[6]!==A?(E=N("div",{className:"flex items-center gap-2",children:[T,A]}),t[5]=T,t[6]=A,t[7]=E):E=t[7];let $;t[8]!==w||t[9]!==E?($=N("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[w,E]}),t[8]=w,t[9]=E,t[10]=$):$=t[10];const I=c.length>0&&i("div",{className:"flex gap-1 overflow-x-auto border-b border-border px-2 py-1.5",role:"tablist",children:c.map(C=>{const _=C.id===f?.id;return N("button",{"aria-selected":_,className:Q("inline-flex items-center gap-1.5 rounded px-2 py-0.5 font-mono text-xs transition-colors hover:text-foreground aria-selected:bg-muted aria-selected:font-medium",_?te(C.status):"text-muted-foreground"),"data-id":C.id,"data-testid":C.live?"api-response-tab-live":`api-response-tab-${C.status}`,onClick:v,role:"tab",type:"button",children:[i("span",{className:`size-1.5 rounded-full ${re(C.status)}`}),C.label]},C.id)})});let R;t[11]!==f||t[12]!==a||t[13]!==b?(R=i(st,{active:f,running:a,showError:b}),t[11]=f,t[12]=a,t[13]=b,t[14]=R):R=t[14];let j;return t[15]!==R||t[16]!==$||t[17]!==I?(j=N("div",{className:y,"data-testid":S,children:[$,I,R]}),t[15]=R,t[16]=$,t[17]=I,t[18]=j):j=t[18],j};function it(t){return t.status.startsWith("2")}const at=(t,e)=>{const s=e.trim().toLowerCase();return s===""?t:t.map(r=>({...r,operations:r.operations.filter(n=>`${n.summary} ${n.operationId}`.toLowerCase().includes(s))})).filter(r=>r.operations.length>0)},Ot=t=>{const e=P(53),{model:s}=t,r=J(),n=s.groups[0]?.operations[0]?.key??"",[o,l]=L(n),[a,g]=L("");let d;e[0]!==n||e[1]!==s.operationByKey||e[2]!==o?(d=s.operationByKey.get(o)??s.operationByKey.get(n),e[0]=n,e[1]=s.operationByKey,e[2]=o,e[3]=d):d=e[3];const c=d;let u,h,p,f,m,v,k,x,b,y;if(e[4]!==a||e[5]!==s.groups||e[6]!==s.server||e[7]!==c?.key||e[8]!==r){u=at(s.groups,a);let E;e[19]===Symbol.for("react.memo_cache_sentinel")?(E=M=>{const{key:B}=M.currentTarget.dataset;B!==void 0&&l(B)},e[19]=E):E=e[19];const $=E;let I;e[20]===Symbol.for("react.memo_cache_sentinel")?(I=M=>{g(M.target.value)},e[20]=I):I=e[20];const R=I;h=s.server??"",b="grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[16rem_minmax(0,1fr)_22rem]",y="api-reference",e[21]!==r?(m=r("API operations"),e[21]=r,e[22]=m):m=e[22],v="flex min-h-0 flex-col overflow-y-auto border-r border-border",k="api-reference-nav";let j;e[23]===Symbol.for("react.memo_cache_sentinel")?(j=i(W,{className:"pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-muted-foreground",icon:ge,strokeWidth:2}),e[23]=j):j=e[23];let C;e[24]!==r?(C=r("Filter operations"),e[24]=r,e[25]=C):C=e[25],e[26]!==a||e[27]!==C?(x=i("div",{className:"sticky top-0 z-10 border-b border-border bg-sidebar p-2",children:N("div",{className:"relative",children:[j,i(xe,{className:"h-7 pl-7","data-testid":"api-filter",onChange:R,placeholder:C,value:a})]})}),e[26]=a,e[27]=C,e[28]=x):x=e[28],p="flex flex-col gap-4 p-2";let _;e[29]!==c?.key||e[30]!==r?(_=M=>N("div",{className:"flex flex-col gap-1",children:[N("div",{className:"flex items-center justify-between px-2",children:[i("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:M.name||r("(root)")}),i("span",{className:"font-mono text-[10px] text-muted-foreground/70",children:M.operations.length})]}),M.operations.map(B=>{const ie=B.key===c?.key;return N("button",{"aria-current":ie?"page":void 0,className:"flex items-center justify-between gap-2 rounded-md border-l-2 border-transparent px-2 py-1 text-start text-xs text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground aria-[current=page]:border-primary aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-key":B.key,"data-testid":`api-nav-${B.operationId}`,onClick:$,type:"button",children:[i("span",{className:"truncate",children:B.summary}),i(H,{kind:B.kind,method:B.method})]},B.key)})]},M.name),e[29]=c?.key,e[30]=r,e[31]=_):_=e[31],f=u.map(_),e[4]=a,e[5]=s.groups,e[6]=s.server,e[7]=c?.key,e[8]=r,e[9]=u,e[10]=h,e[11]=p,e[12]=f,e[13]=m,e[14]=v,e[15]=k,e[16]=x,e[17]=b,e[18]=y}else u=e[9],h=e[10],p=e[11],f=e[12],m=e[13],v=e[14],k=e[15],x=e[16],b=e[17],y=e[18];let S;e[32]!==u.length||e[33]!==r?(S=u.length===0&&i("p",{className:"px-2 py-1 text-xs text-muted-foreground","data-testid":"api-nav-empty",children:r("No operations match your filter.")}),e[32]=u.length,e[33]=r,e[34]=S):S=e[34];let O;e[35]!==S||e[36]!==p||e[37]!==f?(O=N("div",{className:p,children:[f,S]}),e[35]=S,e[36]=p,e[37]=f,e[38]=O):O=e[38];let w;e[39]!==O||e[40]!==m||e[41]!==v||e[42]!==k||e[43]!==x?(w=N("nav",{"aria-label":m,className:v,"data-testid":k,children:[x,O]}),e[39]=O,e[40]=m,e[41]=v,e[42]=k,e[43]=x,e[44]=w):w=e[44];let T;e[45]!==c||e[46]!==h?(T=c===void 0?i("div",{className:"lg:col-span-2"}):N(qe,{operation:c,children:[i("div",{className:"min-w-0 overflow-y-auto p-6","data-testid":"api-reference-main",children:i(Ue,{operation:c})}),N("aside",{className:"flex min-w-0 flex-col gap-4 overflow-y-auto border-border p-4 lg:border-l","data-testid":"api-reference-aside",children:[i(Le,{operation:c,server:h}),i(ot,{})]})]},c.key),e[45]=c,e[46]=h,e[47]=T):T=e[47];let A;return e[48]!==w||e[49]!==T||e[50]!==b||e[51]!==y?(A=N("div",{className:b,"data-testid":y,children:[w,T]}),e[48]=w,e[49]=T,e[50]=b,e[51]=y,e[52]=A):A=e[52],A};export{Ot as R,wt as u};
@@ -1 +0,0 @@
1
- import{c as M}from"react/compiler-runtime";import{useT as E}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{jsxs as k,jsx as x}from"react/jsx-runtime";import{useRef as A,useEffect as W,useState as I,useMemo as q}from"react";import{f as L,b as H}from"./internal-B6haJbiP.mjs";import{u as Q}from"./use-admin-query-BKXiqLci.mjs";import{ADMIN_FUNCTIONS as K}from"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{useVirtualizer as Y}from"@tanstack/react-virtual";import{c as Z}from"./utils-bhneXptQ.mjs";import{f as X}from"./virtual-rect-D_j7aLxX.mjs";const ee=2166136261,te=16777619,j=(n,e=ee)=>{let t=e;for(let s=0;s<n.length;s+=1)t^=n.charCodeAt(s),t=Math.imul(t,te);return(t>>>0).toString(16).padStart(8,"0")},se=/([a-z\d])([A-Z])/gu,ne=/[\s_-]+/u,re=new Set(["access_token","api_key","apikey","card_number","client_secret","credit_card","cvv","passwd","password","private_key","pwd","refresh_token","secret","ssn","token"]),oe=n=>{const e=n.replaceAll(se,"$1 $2").split(ne).map(s=>s.toLowerCase()).filter(s=>s.length>0),t=new Set(e);for(let s=0;s<e.length-1;s+=1){const r=e[s],m=e[s+1];r===void 0||m===void 0||(t.add(`${r}${m}`),t.add(`${r}_${m}`))}return[...t]},V="•••",G=(n,e)=>{try{return e==="redact"?null:e==="hash"?n==null?n:j(typeof n=="bigint"?n.toString():typeof n=="string"?n:JSON.stringify(n)):V}catch{return V}},P=(n,e)=>{const t=new Map;for(const s of n)s.table===e&&t.set(s.column,s.strategy);return t},ae=n=>{for(const e of oe(n))if(re.has(e))return!0;return!1},B=(n,e)=>{const t=e.filter(r=>!n.has(r)&&ae(r));if(t.length===0)return n;const s=new Map(n);for(const r of t)s.set(r,"redact");return s},_e=(n,e,t)=>{if(!t.enabled)return n;const s=t.columns.get(e);return s===void 0?n:G(n,s)},le=(n,e)=>{if(!e.enabled||e.columns.size===0)return n;const t={...n};for(const[s,r]of e.columns)s in t&&(t[s]=G(t[s],r));return t},Fe=(n,e)=>!e.enabled||e.columns.size===0?n:n.map(t=>le(t,e)),ce=[25,50,100,250],ie=n=>{const e=M(18),{onChange:t,options:s,prefix:r,value:m}=n,u=E();let g;e[0]!==t?(g=p=>{t(Number.parseInt(p.target.value,10))},e[0]=t,e[1]=g):g=e[1];const o=g,f=`${r}-page-size`;let l;e[2]!==u?(l=u("Rows per page"),e[2]=u,e[3]=l):l=e[3];let a;e[4]!==l?(a=x("span",{children:l}),e[4]=l,e[5]=a):a=e[5];const c=`${r}-page-size`,d=`${r}-page-size`;let b;e[6]!==s?(b=s.map(ue),e[6]=s,e[7]=b):b=e[7];let h;e[8]!==o||e[9]!==c||e[10]!==d||e[11]!==b||e[12]!==m?(h=x("select",{className:"h-6 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":c,id:d,onChange:o,value:m,children:b}),e[8]=o,e[9]=c,e[10]=d,e[11]=b,e[12]=m,e[13]=h):h=e[13];let i;return e[14]!==f||e[15]!==a||e[16]!==h?(i=k("label",{className:"flex items-center gap-1.5",htmlFor:f,children:[a,h]}),e[14]=f,e[15]=a,e[16]=h,e[17]=i):i=e[17],i},de=n=>{const e=M(25),{onJump:t,page:s,pages:r,prefix:m}=n,u=E();let g;e[0]!==t||e[1]!==r?(g=v=>{const S=Number.parseInt(v,10);Number.isNaN(S)||t(Math.min(Math.max(1,S),Math.max(1,r)))},e[0]=t,e[1]=r,e[2]=g):g=e[2];const o=g;let f;e[3]!==o?(f=v=>{v.key==="Enter"&&o(v.currentTarget.value)},e[3]=o,e[4]=f):f=e[4];const l=f;let a;e[5]!==o?(a=v=>{o(v.currentTarget.value)},e[5]=o,e[6]=a):a=e[6];const c=a;let d;e[7]!==u?(d=u("Page"),e[7]=u,e[8]=d):d=e[8];let b;e[9]!==u?(b=u("Page"),e[9]=u,e[10]=b):b=e[10];const h=`${m}-page-jump`,i=Math.max(1,r);let p;e[11]!==c||e[12]!==l||e[13]!==s||e[14]!==b||e[15]!==h||e[16]!==i?(p=x("input",{"aria-label":b,className:"h-6 w-12 rounded-md border border-border bg-background px-1 text-center tabular-nums outline-none focus-visible:border-ring","data-testid":h,defaultValue:s,max:i,min:1,onBlur:c,onKeyDown:l,type:"number"},s),e[11]=c,e[12]=l,e[13]=s,e[14]=b,e[15]=h,e[16]=i,e[17]=p):p=e[17];let N;e[18]!==r||e[19]!==u?(N=u("of {pages}",{pages:r}),e[18]=r,e[19]=u,e[20]=N):N=e[20];let y;return e[21]!==d||e[22]!==p||e[23]!==N?(y=k("span",{className:"flex items-center gap-1.5 tabular-nums",children:[d,p,N]}),e[21]=d,e[22]=p,e[23]=N,e[24]=y):y=e[24],y},Te=({hasNext:n,hasPrevious:e,onJumpToPage:t,onNext:s,onPageSizeChange:r,onPrevious:m,pageSize:u,pageSizeOptions:g=ce,prefix:o,rangeEnd:f,rangeStart:l,total:a})=>{const c=E(),d="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",b=u!==void 0&&u>0?Math.max(1,Math.ceil(a/u)):1,h=u!==void 0&&u>0?Math.floor(Math.max(0,l-1)/u)+1:1;return k("div",{className:"flex w-full items-center justify-between gap-3 text-xs text-muted-foreground",children:[k("div",{className:"flex items-center gap-3",children:[u!==void 0&&r!==void 0&&x(ie,{onChange:r,options:g,prefix:o,value:u}),x("span",{className:"tabular-nums","data-testid":`${o}-page-info`,children:c("{rangeStart}-{rangeEnd} of {total}",{rangeEnd:f,rangeStart:l,total:a})})]}),k("div",{className:"flex items-center gap-3",children:[x("button",{className:d,"data-testid":`${o}-prev`,disabled:!e,onClick:m,type:"button",children:c("Previous")}),u!==void 0&&t!==void 0&&x(de,{onJump:t,page:h,pages:b,prefix:o}),x("button",{className:d,"data-testid":`${o}-next`,disabled:!n,onClick:s,type:"button",children:c("Next")})]})]})};function ue(n){return x("option",{value:n,children:n},n)}const D=n=>n==null?"∅":n===""?"(empty)":typeof n=="object"?JSON.stringify(n):String(n),fe=n=>{const e=M(32),{column:t,onFacetFilter:s,state:r}=n,m=E();let u;e[0]!==t||e[1]!==s||e[2]!==r.result?.values?(u=i=>{const p=Number(i.currentTarget.dataset.index),N=r.result?.values[p];N!==void 0&&s(t,N.value)},e[0]=t,e[1]=s,e[2]=r.result?.values,e[3]=u):u=e[3];const g=u,o=`db-facet-${t}`;let f;e[4]!==t?(f=x("span",{className:"font-medium text-foreground",children:t}),e[4]=t,e[5]=f):f=e[5];let l;e[6]!==r.loading||e[7]!==r.result||e[8]!==m?(l=r.loading&&r.result===null&&x("span",{className:"text-muted-foreground",children:m("Loading…")}),e[6]=r.loading,e[7]=r.result,e[8]=m,e[9]=l):l=e[9];let a;e[10]!==r.error?(a=r.error!==null&&x("span",{className:"text-destructive",role:"alert",children:r.error}),e[10]=r.error,e[11]=a):a=e[11];let c;e[12]!==r.result?.values?(c=r.result?.values??[],e[12]=r.result?.values,e[13]=c):c=e[13];let d;if(e[14]!==t||e[15]!==g||e[16]!==c){let i;e[18]!==t||e[19]!==g?(i=(p,N)=>k("button",{className:"flex items-center justify-between gap-2 rounded px-1 py-0.5 text-left text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground","data-index":N,"data-testid":`db-facet-value-${t}`,onClick:g,type:"button",children:[x("span",{className:"truncate",children:D(p.value)}),x("span",{className:"shrink-0 tabular-nums text-foreground/70",children:p.count})]},D(p.value)),e[18]=t,e[19]=g,e[20]=i):i=e[20],d=c.map(i),e[14]=t,e[15]=g,e[16]=c,e[17]=d}else d=e[17];let b;e[21]!==t||e[22]!==r.result||e[23]!==m?(b=r.result?.truncated===!0&&x("span",{className:"text-muted-foreground","data-testid":`db-facet-truncated-${t}`,children:m("Showing the {n} most common values.",{n:r.result.values.length})}),e[21]=t,e[22]=r.result,e[23]=m,e[24]=b):b=e[24];let h;return e[25]!==o||e[26]!==f||e[27]!==l||e[28]!==a||e[29]!==d||e[30]!==b?(h=k("section",{className:"flex flex-col gap-1","data-testid":o,children:[f,l,a,d,b]}),e[25]=o,e[26]=f,e[27]=l,e[28]=a,e[29]=d,e[30]=b,e[31]=h):h=e[31],h},Ee=n=>{const e=M(44),{columns:t,facets:s,mask:r,onFacetFilter:m,onToggleFacet:u}=n,g=E();let o;e[0]!==u?(o=w=>{const{column:C}=w.currentTarget.dataset;C!==void 0&&u(C)},e[0]=u,e[1]=o):o=e[1];const f=o;let l;e[2]!==r?(l=w=>r.enabled&&r.columns.has(w),e[2]=r,e[3]=l):l=e[3];const a=l;let c,d,b,h,i,p,N,y;if(e[4]!==t||e[5]!==s||e[6]!==a||e[7]!==g||e[8]!==f){y=Symbol.for("react.early_return_sentinel");e:{let w;e[17]!==a?(w=$=>!a($),e[17]=a,e[18]=w):w=e[18];const C=t.filter(w);let F;if(e[19]!==s||e[20]!==a?(F=Object.entries(s).filter($=>{const[J]=$;return!a(J)}),e[19]=s,e[20]=a,e[21]=F):F=e[21],c=F,C.length===0){y=null;break e}p="flex w-56 shrink-0 flex-col gap-3 overflow-auto border-l border-border p-3 text-xs",N="db-facets",h="flex flex-col gap-1.5";let T;e[22]!==g?(T=g("Facets"),e[22]=g,e[23]=T):T=e[23],e[24]!==T?(i=x("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:T}),e[24]=T,e[25]=i):i=e[25],d="flex flex-wrap gap-1";let R;e[26]!==s||e[27]!==f?(R=$=>x("button",{"aria-pressed":$ in s,className:"rounded border border-border px-1.5 py-0.5 text-muted-foreground transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-column":$,"data-testid":`db-facet-toggle-${$}`,onClick:f,type:"button",children:$},$),e[26]=s,e[27]=f,e[28]=R):R=e[28],b=C.map(R)}e[4]=t,e[5]=s,e[6]=a,e[7]=g,e[8]=f,e[9]=c,e[10]=d,e[11]=b,e[12]=h,e[13]=i,e[14]=p,e[15]=N,e[16]=y}else c=e[9],d=e[10],b=e[11],h=e[12],i=e[13],p=e[14],N=e[15],y=e[16];if(y!==Symbol.for("react.early_return_sentinel"))return y;let v;e[29]!==d||e[30]!==b?(v=x("div",{className:d,children:b}),e[29]=d,e[30]=b,e[31]=v):v=e[31];let S;e[32]!==v||e[33]!==h||e[34]!==i?(S=k("div",{className:h,children:[i,v]}),e[32]=v,e[33]=h,e[34]=i,e[35]=S):S=e[35];let _;e[36]!==m||e[37]!==c?(_=c.map(w=>{const[C,F]=w;return x(fe,{column:C,onFacetFilter:m,state:F},C)}),e[36]=m,e[37]=c,e[38]=_):_=e[38];let O;return e[39]!==S||e[40]!==_||e[41]!==p||e[42]!==N?(O=k("aside",{className:p,"data-testid":N,children:[S,_]}),e[39]=S,e[40]=_,e[41]=p,e[42]=N,e[43]=O):O=e[43],O};function me(n){const e=M(2),t=A(n);let s;return e[0]!==n?(s=()=>{t.current=n},e[0]=n,e[1]=s):s=e[1],W(s),t}const Oe=()=>{const[n,e]=I({}),t=me(n),s=A({}),r=async(o,f)=>{const l=(s.current[o]??0)+1;s.current[o]=l,e(a=>o in a?{...a,[o]:{error:null,loading:!0,result:a[o]?.result??null}}:a);try{const a=await f(o);if(s.current[o]!==l)return;e(c=>o in c?{...c,[o]:{error:null,loading:!1,result:a}}:c)}catch(a){if(s.current[o]!==l)return;e(c=>o in c?{...c,[o]:{error:H(a),loading:!1,result:null}}:c)}};return{clearFacets:()=>{e({})},facets:n,facetsRef:t,refetchFacets:o=>{for(const f of Object.keys(t.current))L(r(f,o))},toggleFacet:(o,f)=>{if(o in t.current){e(l=>Object.fromEntries(Object.entries(l).filter(([a])=>a!==o)));return}e(l=>({...l,[o]:{error:null,loading:!0,result:null}})),f!==null&&L(r(o,f))}}},be=[],ge=()=>{const n=M(1);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e={},n[0]=e):e=n[0];const{data:t}=Q(K.maskPolicies,e);return Array.isArray(t?.columns)?t.columns:be},Re=n=>{const e=M(16),{columns:t,selectedTable:s}=n,r=ge(),[m,u]=I(!0);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{u(he)},e[0]=g):g=e[0];const o=g;let f;if(e[1]!==t||e[2]!==r||e[3]!==s){const h=P(r,s??"");f=B(h,t),e[1]=t,e[2]=r,e[3]=s,e[4]=f}else f=e[4];const l=f;let a;e[5]!==m||e[6]!==r?(a=(h,i)=>({columns:B(P(r,h),i),enabled:m}),e[5]=m,e[6]=r,e[7]=a):a=e[7];const c=a;let d;e[8]!==l||e[9]!==m?(d={columns:l,enabled:m},e[8]=l,e[9]=m,e[10]=d):d=e[10];let b;return e[11]!==l||e[12]!==m||e[13]!==c||e[14]!==d?(b={maskColumns:l,maskOn:m,maskView:d,maskViewFor:c,onToggleMask:o},e[11]=l,e[12]=m,e[13]=c,e[14]=d,e[15]=b):b=e[15],b};function he(n){return!n}const z=34,U=600,pe=n=>{const e=M(21),{item:t,onSelect:s,prefix:r,selected:m,start:u}=n;let g;e[0]!==t.name||e[1]!==s?(g=()=>{s(t.name)},e[0]=t.name,e[1]=s,e[2]=g):g=e[2];const o=g,f=`translateY(${String(u)}px)`;let l;e[3]!==f?(l={insetInline:0,position:"absolute",top:0,transform:f},e[3]=f,e[4]=l):l=e[4];const a=l,c=m?"bg-accent font-medium text-accent-foreground":"text-foreground";let d;e[5]!==c?(d=Z("flex w-full items-center justify-between gap-2 rounded-md px-2 py-1.5 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent",c),e[5]=c,e[6]=d):d=e[6];const b=`${r}-table-${t.name}`;let h;e[7]!==t.name?(h=x("span",{className:"truncate",children:t.name}),e[7]=t.name,e[8]=h):h=e[8];let i;e[9]!==t.rowCount?(i=x("span",{className:"shrink-0 rounded bg-muted px-1.5 text-xs tabular-nums text-muted-foreground",children:t.rowCount}),e[9]=t.rowCount,e[10]=i):i=e[10];let p;e[11]!==o||e[12]!==m||e[13]!==d||e[14]!==b||e[15]!==h||e[16]!==i?(p=k("button",{"aria-pressed":m,className:d,"data-testid":b,onClick:o,type:"button",children:[h,i]}),e[11]=o,e[12]=m,e[13]=d,e[14]=b,e[15]=h,e[16]=i,e[17]=p):p=e[17];let N;return e[18]!==a||e[19]!==p?(N=x("li",{style:a,children:p}),e[18]=a,e[19]=p,e[20]=N):N=e[20],N},Ae=({header:n,onReload:e,onSelect:t,prefix:s,reloadLabel:r,selected:m,tables:u})=>{const g=E(),[o,f]=I(""),l=A(null),a=i=>{f(i.target.value)},c=q(()=>{const i=o.trim().toLowerCase();return i===""?u:u.filter(p=>p.name.toLowerCase().includes(i))},[o,u]),b=Y({count:c.length,estimateSize:()=>z,getScrollElement:()=>l.current,initialRect:{height:U,width:240},observeElementRect:(i,p)=>X(i,p,U),overscan:12}).getVirtualItems(),h={height:c.length*z};return k("aside",{className:"flex h-full w-60 shrink-0 flex-col border-e border-border bg-sidebar","data-testid":`${s}-table-list`,children:[n,k("div",{className:"flex h-9 shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[x("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:g("Tables")}),e!==void 0&&x("button",{"aria-label":r??g("Refresh"),className:"flex size-6 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent","data-testid":`${s}-load-tables`,onClick:e,title:r??g("Refresh"),type:"button",children:x("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:x("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"})})})]}),x("div",{className:"shrink-0 border-b border-border p-2",children:x("input",{className:"h-7 w-full rounded-md border border-border bg-background px-2 text-xs outline-none placeholder:text-muted-foreground focus-visible:border-ring","data-testid":`${s}-table-search`,onChange:a,placeholder:g("search table…"),type:"search",value:o})}),k("ul",{className:"relative flex-1 overflow-y-auto p-1.5","data-testid":`${s}-table-list-rows`,ref:l,children:[x("li",{"aria-hidden":"true",style:h}),b.map(i=>{const p=c[i.index];return p===void 0?null:x(pe,{item:p,onSelect:t,prefix:s,selected:m===p.name,start:i.start},p.name)})]})]})};export{Ee as D,Te as G,Ae as T,Oe as a,Re as b,le as c,Fe as d,_e as m,me as u};
@@ -1 +0,0 @@
1
- import{a as Ve}from"./chunk-2URQKGWU.js";import"./chunk-4JLGLPWV.js";import{a as He}from"./chunk-EA2JKR5D.js";import{a as Ke}from"./chunk-66UGPQVC.js";import"./chunk-3Q2P62UR.js";import{a as Ge}from"./chunk-PD6WIDY6.js";import{W as je}from"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as le}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as de}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as Pe}from"./chunk-R3J3OY24.js";import{a as Ue}from"./chunk-ULIQFBZU.js";import"./chunk-OK2Q64WC.js";import"./chunk-35DM4JJG.js";import{a as F}from"./chunk-4ZEL6BYL.js";import{c as Me}from"./chunk-PA2VU4KN.js";import{f as We}from"./chunk-UEZQP5EU.js";import"./chunk-FSRSK4LY.js";import"./chunk-TFDBSYX4.js";import{a as ie}from"./chunk-FKVZRPV5.js";import{a as _e,b as Be,c as ke,d as G,e as C,f as w}from"./chunk-HEAQVSNS.js";import{a as Te,e as De}from"./chunk-WUWBZPUK.js";import{d as $,f as ue,g as ce,h as me,o as he,r as ze}from"./chunk-FODLDLE2.js";import{a as h,d as Ee,e as rt,f as nt,g as ot}from"./chunk-YKXDMIHQ.js";var W=Ee(nt(),1);var A=Ee(rt(),1);var t=Ee(ot(),1);var dt=h((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),i=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),d=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:d,queuesWithoutDlq:i,showReliabilityWarning:i.length>0||d>0}},"rt"),lt=200,it=ue(F.sendQueueMessage),ut=ue(F.replayQueueMessage),ct=ue(F.clearQueueMessages),Xe=96,mt=h(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n)}catch{return"[unserializable]"}},"it"),ht=h(n=>n.length>Xe?`${n.slice(0,Xe)}\u2026`:n,"ct"),pt=h(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","ut"),gt=h((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"mt"),ft=h(n=>{let e=(0,W.c)(11),{loaded:a,queues:i}=n,d=$(),s;e[0]!==d?(s=d("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=d,e[1]=s):s=e[1];let o;e[2]!==s?(o=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let r;e[4]!==a||e[5]!==i||e[6]!==d?(r=a&&i.length===0?(0,t.jsx)(ie,{description:d("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:d("No queues defined")}):(0,t.jsx)(Te,{className:"overflow-hidden py-0",children:(0,t.jsx)(De,{className:"px-0",children:(0,t.jsxs)(_e,{"data-testid":"queues-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:d("Export")}),(0,t.jsx)(C,{children:d("Queue")}),(0,t.jsx)(C,{children:d("Mode")}),(0,t.jsx)(C,{children:d("Binding")}),(0,t.jsx)(C,{children:d("Dead-letter")})]})}),(0,t.jsx)(ke,{children:i.map(bt)})]})})}),e[4]=a,e[5]=i,e[6]=d,e[7]=r):r=e[7];let p;return e[8]!==o||e[9]!==r?(p=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[o,r]}),e[8]=o,e[9]=r,e[10]=p):p=e[10],p},"ft"),xt=h(n=>{let e=(0,W.c)(67),{message:a,onReplay:i,replayingId:d}=n,s=$(),o,r,p,c,x,N,y,l,m,f;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let j=mt(a.body);r=G,N=`queues-message-${a.id}`;let z=a.exportName??a.queue;e[19]!==z?(y=(0,t.jsx)(w,{className:"font-mono text-xs",children:z}),e[19]=z,e[20]=y):y=e[20],e[21]!==a.messageId?(l=(0,t.jsx)(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=l):l=e[22],e[23]!==a.attempts?(m=(0,t.jsx)(w,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=m):m=e[24];let T=`queues-outcome-${a.id}`,D;e[25]!==a.outcome?(D=pt(a.outcome),e[25]=a.outcome,e[26]=D):D=e[26];let I;e[27]!==a.outcome||e[28]!==T||e[29]!==D?(I=(0,t.jsx)(de,{"data-testid":T,variant:D,children:a.outcome}),e[27]=a.outcome,e[28]=T,e[29]=D,e[30]=I):I=e[30];let M;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(M=a.deadLettered&&(0,t.jsx)(de,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=M):M=e[34],e[35]!==I||e[36]!==M?(f=(0,t.jsx)(w,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[I,M]})}),e[35]=I,e[36]=M,e[37]=f):f=e[37],o=w,p="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",c=j,x=ht(j),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=o,e[10]=r,e[11]=p,e[12]=c,e[13]=x,e[14]=N,e[15]=y,e[16]=l,e[17]=m,e[18]=f}else o=e[9],r=e[10],p=e[11],c=e[12],x=e[13],N=e[14],y=e[15],l=e[16],m=e[17],f=e[18];let g;e[38]!==o||e[39]!==p||e[40]!==c||e[41]!==x?(g=(0,t.jsx)(o,{className:p,title:c,children:x}),e[38]=o,e[39]=p,e[40]=c,e[41]=x,e[42]=g):g=e[42];let q;e[43]!==a.capturedAt?(q=ze(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=q):q=e[44];let b;e[45]!==q?(b=(0,t.jsx)(w,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=b):b=e[46];let S=`queues-replay-${a.id}`,E=d!==null,Q;e[47]!==a.id||e[48]!==d||e[49]!==s?(Q=d===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=d,e[49]=s,e[50]=Q):Q=e[50];let L;e[51]!==a.id||e[52]!==i||e[53]!==S||e[54]!==E||e[55]!==Q?(L=(0,t.jsx)(w,{children:(0,t.jsx)(le,{"data-id":a.id,"data-testid":S,disabled:E,onClick:i,size:"xs",type:"button",variant:"outline",children:Q})}),e[51]=a.id,e[52]=i,e[53]=S,e[54]=E,e[55]=Q,e[56]=L):L=e[56];let _;return e[57]!==r||e[58]!==b||e[59]!==L||e[60]!==N||e[61]!==y||e[62]!==l||e[63]!==m||e[64]!==f||e[65]!==g?(_=(0,t.jsxs)(r,{"data-testid":N,children:[y,l,m,f,g,b,L]}),e[57]=r,e[58]=b,e[59]=L,e[60]=N,e[61]=y,e[62]=l,e[63]=m,e[64]=f,e[65]=g,e[66]=_):_=e[66],_},"ht"),yt=h(n=>{let e=(0,W.c)(29),{hasError:a,messages:i,onClear:d,onReplay:s,replayingId:o}=n,r=$(),p;e[0]!==r?(p=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=r,e[1]=p):p=e[1];let c;e[2]!==p?(c=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:p}),e[2]=p,e[3]=c):c=e[3];let x;e[4]!==r?(x=r("Clear the whole message log?"),e[4]=r,e[5]=x):x=e[5];let N=i.length===0,y;e[6]!==r?(y=r("Clear log"),e[6]=r,e[7]=y):y=e[7];let l;e[8]!==d||e[9]!==x||e[10]!==N||e[11]!==y?(l=(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(Ge,{confirmLabel:x,disabled:N,onConfirm:d,testId:"queues-clear",children:y})}),e[8]=d,e[9]=x,e[10]=N,e[11]=y,e[12]=l):l=e[12];let m;e[13]!==i.length||e[14]!==r?(m=i.length>0&&(0,t.jsx)(de,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:i.length})}),e[13]=i.length,e[14]=r,e[15]=m):m=e[15];let f;e[16]!==c||e[17]!==l||e[18]!==m?(f=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,l,m]}),e[16]=c,e[17]=l,e[18]=m,e[19]=f):f=e[19];let g;e[20]!==a||e[21]!==i||e[22]!==s||e[23]!==o||e[24]!==r?(g=!a&&i.length===0?(0,t.jsx)(ie,{description:r("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:r("No consumed messages yet.")}):(0,t.jsx)(Te,{className:"overflow-hidden py-0",children:(0,t.jsx)(De,{className:"px-0",children:(0,t.jsx)(Ve,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(_e,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:r("Export")}),(0,t.jsx)(C,{children:r("Message")}),(0,t.jsx)(C,{children:r("Attempts")}),(0,t.jsx)(C,{children:r("Outcome")}),(0,t.jsx)(C,{children:r("Body")}),(0,t.jsx)(C,{children:r("Captured")}),(0,t.jsx)(C,{})]})}),(0,t.jsx)(ke,{children:i.map(b=>(0,t.jsx)(xt,{message:b,onReplay:s,replayingId:o},b.id))})]})})})}),e[20]=a,e[21]=i,e[22]=s,e[23]=o,e[24]=r,e[25]=g):g=e[25];let q;return e[26]!==f||e[27]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[f,g]}),e[26]=f,e[27]=g,e[28]=q):q=e[28],q},"pt"),Nt=h(n=>{let e=(0,W.c)(20),{batchMode:a,bodyText:i,delayText:d,onBatchModeChange:s,onBodyChange:o,onDelayChange:r,onSelectExport:p,onSend:c,queues:x,selectedExportName:N,sending:y}=n,l=$(),m;e[0]!==l?(m=l("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=l,e[1]=m):m=e[1];let f;e[2]!==m?(f=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=f):f=e[3];let g;e[4]!==a||e[5]!==i||e[6]!==d||e[7]!==s||e[8]!==o||e[9]!==r||e[10]!==p||e[11]!==c||e[12]!==x||e[13]!==N||e[14]!==y||e[15]!==l?(g=x.length===0?(0,t.jsx)(ie,{description:l("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:l("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":l("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:p,value:N,children:x.map(qt)}),(0,t.jsx)(je,{"aria-label":l("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:l("Delay (s)"),type:"number",value:d}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),l("Send as batch (JSON array)")]}),(0,t.jsx)(le,{className:"ml-auto","data-testid":"queues-send-button",disabled:y||N==="",onClick:c,type:"button",children:l(y?"Sending\u2026":"Send message")})]}),(0,t.jsx)(He,{"aria-label":l("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:o,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:i})]}),e[4]=a,e[5]=i,e[6]=d,e[7]=s,e[8]=o,e[9]=r,e[10]=p,e[11]=c,e[12]=x,e[13]=N,e[14]=y,e[15]=l,e[16]=g):g=e[16];let q;return e[17]!==f||e[18]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[f,g]}),e[17]=f,e[18]=g,e[19]=q):q=e[19],q},"gt"),Ft=h(n=>{let e=(0,W.c)(59),{limit:a}=n,i=a??lt,d=We(),s=$(),[o,r]=(0,A.useState)("declared"),[p,c]=(0,A.useState)(null),x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x={},e[0]=x):x=e[0];let{data:N,error:y,errorSource:l}=Me(F.listQueues,x),m;e[1]!==i?(m={limit:i},e[1]=i,e[2]=m):m=e[2];let{data:f,error:g,errorSource:q,refetch:b}=Me(F.getQueueMessages,m),S=Array.isArray(N?.queues)?[...N.queues].toSorted(vt):[],E=f?.entries??[],{deadLetteredCount:Q,queuesWithoutDlq:L,showReliabilityWarning:_}=dt(S,E),[j,z]=(0,A.useState)(""),[T,D]=(0,A.useState)(""),[I,M]=(0,A.useState)(""),[U,Ye]=(0,A.useState)(!1),[pe,Oe]=(0,A.useState)(!1),[ge,Re]=(0,A.useState)(null),H=S.some(u=>u.exportName===j)?j:S[0]?.exportName??"",Je=o==="messages"?g:y,Ze=o==="messages"?q:l,fe=Je??p,xe=Je===null?p:Ze,K;e[3]!==b?(K=h(()=>{b()},"H"),e[3]=b,e[4]=K):K=e[4],Ke(K,o==="messages");let ye=h(async()=>{c(null);let u=H;if(u==="")return;let v=null,$e=T.trim();if($e!=="")try{v=JSON.parse($e)}catch{c(s("Body must be valid JSON."));return}let Ae,Fe=I.trim();if(Fe!==""){let P=Number(Fe);if(!Number.isFinite(P)||P<0){c(s("Delay must be a non-negative number of seconds."));return}Ae=P}if(U&&!Array.isArray(v)){c(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}Oe(!0);let st=U?{batch:v,delaySeconds:Ae,exportName:u}:{body:v,delaySeconds:Ae,exportName:u};try{await d.query(it,st,ce("")),b()}catch(P){c(me(P))}Oe(!1)},"ue"),V;e[5]!==d||e[6]!==b?(V=h(async u=>{c(null),Re(u);try{await d.query(ut,{id:u},ce("")),b()}catch(v){c(me(v))}Re(null)},"V"),e[5]=d,e[6]=b,e[7]=V):V=e[7];let Ne=V,X;e[8]!==d||e[9]!==b?(X=h(async()=>{c(null);try{await d.query(ct,{},ce("")),b()}catch(u){c(me(u))}},"Y"),e[8]=d,e[9]=b,e[10]=X):X=e[10];let be=X,Y;e[11]===Symbol.for("react.memo_cache_sentinel")?(Y=h(u=>{let v=u.currentTarget.dataset.tab;(v==="declared"||v==="messages"||v==="send")&&r(v)},"X"),e[11]=Y):Y=e[11];let et=Y,Z;e[12]===Symbol.for("react.memo_cache_sentinel")?(Z=h(u=>{z(u.currentTarget.value)},"K"),e[12]=Z):Z=e[12];let qe=Z,ee;e[13]===Symbol.for("react.memo_cache_sentinel")?(ee=h(u=>{D(u.currentTarget.value)},"Z"),e[13]=ee):ee=e[13];let ve=ee,te;e[14]===Symbol.for("react.memo_cache_sentinel")?(te=h(u=>{M(u.currentTarget.value)},"ee"),e[14]=te):te=e[14];let Se=te,ae;e[15]===Symbol.for("react.memo_cache_sentinel")?(ae=h(u=>{Ye(u.currentTarget.checked)},"te"),e[15]=ae):ae=e[15];let Ce=ae,se;e[16]!==ye?(se=h(()=>{he(ye())},"se"),e[16]=ye,e[17]=se):se=e[17];let we=se,re;e[18]!==Ne?(re=h(u=>{let{id:v}=u.currentTarget.dataset;v!==void 0&&he(Ne(v))},"ae"),e[18]=Ne,e[19]=re):re=e[19];let Ie=re,ne;e[20]!==be?(ne=h(()=>{he(be())},"re"),e[20]=be,e[21]=ne):ne=e[21];let Qe=ne,tt="flex flex-col gap-6",at="lunora-queues-panel",B;e[22]!==s||e[23]!==o?(B=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(u=>(0,t.jsx)(le,{"aria-selected":o===u,"data-tab":u,"data-testid":`queues-tab-${u}`,onClick:et,role:"tab",size:"sm",type:"button",variant:o===u?"secondary":"ghost",children:gt(u,s)},u))}),e[22]=s,e[23]=o,e[24]=B):B=e[24];let k;e[25]!==fe||e[26]!==xe?(k=fe!==null&&(0,t.jsx)(Pe,{error:xe,testId:"queues-error"}),e[25]=fe,e[26]=xe,e[27]=k):k=e[27];let Le=_&&(0,t.jsx)(Ue,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[L.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:L.map(St).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),Q>0&&(0,t.jsx)("p",{className:L.length>0?"text-muted-foreground":"font-medium",children:Q===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:Q})})]})}),O;e[28]!==S||e[29]!==N||e[30]!==o?(O=o==="declared"&&(0,t.jsx)(ft,{loaded:N!==void 0,queues:S}),e[28]=S,e[29]=N,e[30]=o,e[31]=O):O=e[31];let R;e[32]!==E||e[33]!==g||e[34]!==Qe||e[35]!==Ie||e[36]!==ge||e[37]!==o?(R=o==="messages"&&(0,t.jsx)(yt,{hasError:g!==null,messages:E,onClear:Qe,onReplay:Ie,replayingId:ge}),e[32]=E,e[33]=g,e[34]=Qe,e[35]=Ie,e[36]=ge,e[37]=o,e[38]=R):R=e[38];let J;e[39]!==U||e[40]!==T||e[41]!==I||e[42]!==Ce||e[43]!==ve||e[44]!==Se||e[45]!==qe||e[46]!==we||e[47]!==S||e[48]!==H||e[49]!==pe||e[50]!==o?(J=o==="send"&&(0,t.jsx)(Nt,{batchMode:U,bodyText:T,delayText:I,onBatchModeChange:Ce,onBodyChange:ve,onDelayChange:Se,onSelectExport:qe,onSend:we,queues:S,selectedExportName:H,sending:pe}),e[39]=U,e[40]=T,e[41]=I,e[42]=Ce,e[43]=ve,e[44]=Se,e[45]=qe,e[46]=we,e[47]=S,e[48]=H,e[49]=pe,e[50]=o,e[51]=J):J=e[51];let oe;return e[52]!==B||e[53]!==k||e[54]!==Le||e[55]!==O||e[56]!==R||e[57]!==J?(oe=(0,t.jsxs)("div",{className:tt,"data-testid":at,children:[B,k,Le,O,R,J]}),e[52]=B,e[53]=k,e[54]=Le,e[55]=O,e[56]=R,e[57]=J,e[58]=oe):oe=e[58],oe},"Ft");function bt(n){return(0,t.jsxs)(G,{"data-testid":`queues-row-${n.exportName}`,children:[(0,t.jsx)(w,{className:"font-mono text-xs",children:n.exportName}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.name}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.mode}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.binding}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.deadLetterQueue??"\u2014"})]},n.exportName)}h(bt,"xt");function qt(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}h(qt,"yt");function vt(n,e){return n.exportName.localeCompare(e.exportName)}h(vt,"bt");function St(n){return n.name}h(St,"Nt");export{Ft as default};