@lunora/studio 1.0.0-alpha.141 → 1.0.0-alpha.142

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 (134) hide show
  1. package/dist/index.d.mts +2 -1
  2. package/dist/index.d.ts +2 -1
  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/ExportImportPanel.mjs +1 -1
  9. package/dist/packem_chunks/FileBrowser.mjs +1 -1
  10. package/dist/packem_chunks/FunctionRunner.mjs +1 -1
  11. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -1
  12. package/dist/packem_chunks/HealthPanel.mjs +1 -1
  13. package/dist/packem_chunks/InsightsPanel.mjs +1 -1
  14. package/dist/packem_chunks/LogsPanel.mjs +1 -1
  15. package/dist/packem_chunks/MailPanel.mjs +1 -1
  16. package/dist/packem_chunks/MetricsPanel.mjs +1 -1
  17. package/dist/packem_chunks/NotificationsPanel.mjs +1 -1
  18. package/dist/packem_chunks/PitrPanel.mjs +1 -1
  19. package/dist/packem_chunks/SchemaViewer.mjs +1 -1
  20. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -1
  21. package/dist/packem_chunks/SettingsPanel.mjs +1 -1
  22. package/dist/packem_chunks/SqlEditorPanel.mjs +1 -1
  23. package/dist/packem_chunks/TableEditor.mjs +1 -1
  24. package/dist/packem_chunks/agents-panel.mjs +1 -1
  25. package/dist/packem_chunks/auth-audit-panel.mjs +1 -1
  26. package/dist/packem_chunks/auth-config-panel.mjs +1 -1
  27. package/dist/packem_chunks/auth-sessions-panel.mjs +1 -1
  28. package/dist/packem_chunks/containers-panel.mjs +1 -1
  29. package/dist/packem_chunks/dashboards-panel.mjs +1 -1
  30. package/dist/packem_chunks/evals-panel.mjs +1 -1
  31. package/dist/packem_chunks/fanout-panel.mjs +1 -1
  32. package/dist/packem_chunks/flags-panel.mjs +1 -1
  33. package/dist/packem_chunks/issues-panel.mjs +1 -1
  34. package/dist/packem_chunks/kv-browser.mjs +1 -1
  35. package/dist/packem_chunks/migrations-route.mjs +1 -1
  36. package/dist/packem_chunks/organizations-panel.mjs +1 -1
  37. package/dist/packem_chunks/payments-panel.mjs +1 -1
  38. package/dist/packem_chunks/permissions-panel.mjs +1 -1
  39. package/dist/packem_chunks/queues-panel.mjs +1 -1
  40. package/dist/packem_chunks/reactors-panel.mjs +1 -1
  41. package/dist/packem_chunks/rls-panel.mjs +1 -1
  42. package/dist/packem_chunks/schedule-panel.mjs +1 -1
  43. package/dist/packem_chunks/storage-rules-panel.mjs +1 -1
  44. package/dist/packem_chunks/subscriptions-panel.mjs +1 -1
  45. package/dist/packem_chunks/sync-client-panel.mjs +1 -1
  46. package/dist/packem_chunks/traces-panel.mjs +1 -1
  47. package/dist/packem_chunks/users-panel.mjs +1 -1
  48. package/dist/packem_chunks/workflows-panel.mjs +1 -1
  49. package/dist/packem_shared/{ADMIN_FUNCTIONS-B6z7VLYt.mjs → ADMIN_FUNCTIONS-B8yyk5BX.mjs} +1 -1
  50. package/dist/packem_shared/{ApiDocsPanel-BOxViKDM.mjs → ApiDocsPanel-l4DQX1Vq.mjs} +1 -1
  51. package/dist/packem_shared/DataBrowser-C2B-HNOL.mjs +4 -0
  52. package/dist/packem_shared/{GlobalDataBrowser-BKm77TNC.mjs → GlobalDataBrowser-DK4fgb7h.mjs} +1 -1
  53. package/dist/packem_shared/{HomePanel-YG8qu2Nb.mjs → HomePanel-B869m6wb.mjs} +1 -1
  54. package/dist/packem_shared/{MigrationsPanel-CYe0ygT8.mjs → MigrationsPanel-BZJ_Rv4t.mjs} +1 -1
  55. package/dist/packem_shared/{ScheduledJobs-DN0yQoo6.mjs → ScheduledJobs-oDVEymk5.mjs} +1 -1
  56. package/dist/packem_shared/{Studio-D8OZ5P-V.mjs → Studio-5eRSjGmd.mjs} +1 -1
  57. package/dist/packem_shared/{StudioApp-VZ3I91QA.mjs → StudioApp-Bkym2DjT.mjs} +1 -1
  58. package/dist/packem_shared/{advisor-view-5mZH6453.mjs → advisor-view-DoSv436g.mjs} +1 -1
  59. package/dist/packem_shared/{error-alert-CczbAfst.mjs → error-alert-CWs6gA3I.mjs} +1 -1
  60. package/dist/packem_shared/{home-panel-BID7w6j3.mjs → home-panel-ChKczU0I.mjs} +1 -1
  61. package/dist/packem_shared/{recording-client-BEZ6tVgo.mjs → recording-client-BGyq5_JP.mjs} +1 -1
  62. package/dist/packem_shared/{studio-ByaR_3g9.mjs → studio-4odoxrh9.mjs} +1 -1
  63. package/dist/packem_shared/{table-list-sidebar-BxZm3sBJ.mjs → table-list-sidebar-T7--Fv-V.mjs} +1 -1
  64. package/dist/packem_shared/use-admin-query-C7JRlFIE.mjs +1 -0
  65. package/dist/packem_shared/{use-auth-config-gxJL0E1r.mjs → use-auth-config-o-FcIXzR.mjs} +1 -1
  66. package/dist/packem_shared/{use-sql-assistant-CFRzdA9E.mjs → use-sql-assistant-Ib7Ik6cw.mjs} +1 -1
  67. package/dist/packem_shared/wire-codec-DGcjNTbZ.mjs +1 -0
  68. package/dist/standalone/chunk-2O5QDSR2.js +1 -0
  69. package/dist/standalone/{chunk-FNGY5SUZ.js → chunk-37VWQZEF.js} +1 -1
  70. package/dist/standalone/{chunk-BX3F7MXP.js → chunk-3MNTCYQ3.js} +1 -1
  71. package/dist/standalone/{chunk-O2FV34ZD.js → chunk-45T7VWRY.js} +1 -1
  72. package/dist/standalone/{chunk-M6MCQSPI.js → chunk-4TKQNBNV.js} +1 -1
  73. package/dist/standalone/{chunk-CXNZVJ3S.js → chunk-4ZEL6BYL.js} +1 -1
  74. package/dist/standalone/{chunk-3PKWDMXA.js → chunk-6H36JL4I.js} +1 -1
  75. package/dist/standalone/{chunk-USC5APTS.js → chunk-7DNDONOI.js} +1 -1
  76. package/dist/standalone/{chunk-MIVYBFY3.js → chunk-7GHBT32T.js} +1 -1
  77. package/dist/standalone/{chunk-LC3XGRNU.js → chunk-7ZWZNTKG.js} +1 -1
  78. package/dist/standalone/{chunk-TRL7AHZK.js → chunk-A4MLWW6Q.js} +1 -1
  79. package/dist/standalone/{chunk-UKL4FSKP.js → chunk-AR46S3PP.js} +1 -1
  80. package/dist/standalone/{chunk-3ZKYTFKY.js → chunk-ATO3Y6BD.js} +1 -1
  81. package/dist/standalone/{chunk-EIKBBMM4.js → chunk-AZOLR4BN.js} +1 -1
  82. package/dist/standalone/{chunk-2AFIMJPZ.js → chunk-BAIGKYAI.js} +1 -1
  83. package/dist/standalone/{chunk-V36AL47B.js → chunk-BDZFZT2N.js} +1 -1
  84. package/dist/standalone/{chunk-MRJNT4OH.js → chunk-BMAP2J7X.js} +1 -1
  85. package/dist/standalone/{chunk-YFLOZILV.js → chunk-BNGOZSCT.js} +1 -1
  86. package/dist/standalone/{chunk-TZI3JW3Q.js → chunk-BP7MDQY5.js} +1 -1
  87. package/dist/standalone/{chunk-PAUQAU23.js → chunk-BYWVVRKM.js} +1 -1
  88. package/dist/standalone/{chunk-Q3HF6P2M.js → chunk-DRFQ3BUM.js} +1 -1
  89. package/dist/standalone/{chunk-7QMV55PO.js → chunk-F2R2UX27.js} +1 -1
  90. package/dist/standalone/{chunk-C5L4BSYY.js → chunk-GCYNOU4C.js} +1 -1
  91. package/dist/standalone/{chunk-KEZZGUYY.js → chunk-HCO5STOE.js} +1 -1
  92. package/dist/standalone/{chunk-ZOWSTFP5.js → chunk-HJOKETMZ.js} +1 -1
  93. package/dist/standalone/{chunk-2DO5EQCU.js → chunk-HS7MSYK7.js} +1 -1
  94. package/dist/standalone/{chunk-EG6XHY7N.js → chunk-HWBXHONF.js} +1 -1
  95. package/dist/standalone/{chunk-NE7AR3N3.js → chunk-HZX6KSC2.js} +1 -1
  96. package/dist/standalone/{chunk-KDWJAKFX.js → chunk-I27WXF7C.js} +1 -1
  97. package/dist/standalone/{chunk-2QSOSRNW.js → chunk-IGBQ2CPW.js} +1 -1
  98. package/dist/standalone/{chunk-LJC5BM3X.js → chunk-IMUTQDOB.js} +1 -1
  99. package/dist/standalone/{chunk-5PCGB55O.js → chunk-IXLH5YBD.js} +1 -1
  100. package/dist/standalone/{chunk-UWDFH35E.js → chunk-IXMHWLSN.js} +1 -1
  101. package/dist/standalone/{chunk-Z5APSEW7.js → chunk-JXELPXLG.js} +1 -1
  102. package/dist/standalone/{chunk-ERWZGAOA.js → chunk-KBSJO66O.js} +1 -1
  103. package/dist/standalone/chunk-L6KA7M4B.js +1 -0
  104. package/dist/standalone/{chunk-HODZXHVK.js → chunk-LELCKAUP.js} +1 -1
  105. package/dist/standalone/{chunk-JYMXJUJ2.js → chunk-LPFRXMG7.js} +1 -1
  106. package/dist/standalone/{chunk-EILTQDXX.js → chunk-NPHUYLGW.js} +1 -1
  107. package/dist/standalone/{chunk-RK3WWWTT.js → chunk-NZMUY7ZG.js} +1 -1
  108. package/dist/standalone/{chunk-ZE2Q22OK.js → chunk-O32757IN.js} +1 -1
  109. package/dist/standalone/{chunk-JHEUUNXM.js → chunk-PCOD3V5E.js} +1 -1
  110. package/dist/standalone/{chunk-UBVWMMQG.js → chunk-PNFIPQJO.js} +1 -1
  111. package/dist/standalone/{chunk-56AFJWER.js → chunk-PV2LCZ6D.js} +1 -1
  112. package/dist/standalone/chunk-QEN7S6YK.js +7 -0
  113. package/dist/standalone/{chunk-DQHYNFE4.js → chunk-QM3SGSVK.js} +1 -1
  114. package/dist/standalone/{chunk-VPPKG2IW.js → chunk-S4HBMTJ3.js} +1 -1
  115. package/dist/standalone/{chunk-S63ID2FC.js → chunk-SPP7FEDA.js} +1 -1
  116. package/dist/standalone/{chunk-WR675JUF.js → chunk-V5ITAZCZ.js} +1 -1
  117. package/dist/standalone/{chunk-JAZCU2PP.js → chunk-W7E5WYFI.js} +1 -1
  118. package/dist/standalone/{chunk-OOESPRIZ.js → chunk-WHWI6KXH.js} +1 -1
  119. package/dist/standalone/{chunk-43Y54D7O.js → chunk-WIFKQ25E.js} +1 -1
  120. package/dist/standalone/{chunk-G63MGXPG.js → chunk-WZYKLEU5.js} +1 -1
  121. package/dist/standalone/chunk-XDT5DXOI.js +11 -0
  122. package/dist/standalone/{chunk-ZB74UWVA.js → chunk-XUKH3NTP.js} +1 -1
  123. package/dist/standalone/{chunk-N6KHKQJH.js → chunk-YKUEP7AA.js} +1 -1
  124. package/dist/standalone/{chunk-QSOJFV42.js → chunk-YRNEKBFM.js} +1 -1
  125. package/dist/standalone/{chunk-YFPU55K4.js → chunk-ZNPR3SGG.js} +1 -1
  126. package/dist/standalone/studio.js +1 -1
  127. package/package.json +6 -6
  128. package/dist/packem_shared/DataBrowser-rqpuEiuQ.mjs +0 -4
  129. package/dist/packem_shared/use-admin-query-Cbj2GuHu.mjs +0 -1
  130. package/dist/packem_shared/wire-codec-Dl3VeNrd.mjs +0 -1
  131. package/dist/standalone/chunk-ECQTVV2J.js +0 -1
  132. package/dist/standalone/chunk-JBIN7W2B.js +0 -11
  133. package/dist/standalone/chunk-JJA7KHJK.js +0 -1
  134. package/dist/standalone/chunk-MVKXAIW3.js +0 -7
@@ -1 +1 @@
1
- import{a as Ke}from"./chunk-VVOVVU53.js";import{a as Qe,b as Me}from"./chunk-UWDFH35E.js";import{a as Ye}from"./chunk-NBC6NJFJ.js";import{a as Ve}from"./chunk-XZMOZFE6.js";import{a as D}from"./chunk-IMOHEGMV.js";import{a as Je}from"./chunk-66UGPQVC.js";import{a as Ge}from"./chunk-QKEJLVC5.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import{P as L}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as z}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as P}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{b as Ze}from"./chunk-ECQTVV2J.js";import{f as O}from"./chunk-JBIN7W2B.js";import"./chunk-FSRSK4LY.js";import{a as We}from"./chunk-FKVZRPV5.js";import{a as Ue,b as $e,c as _e,d as q,e as U,f as $}from"./chunk-HEAQVSNS.js";import{a as we,e as Ce}from"./chunk-WUWBZPUK.js";import{d as H,h as je,m as Ae,o as ze,r as Ie}from"./chunk-Y4Q25F6X.js";import"./chunk-T2IE5GKA.js";import{a as r,d as qe,e as et,f as tt,g as at}from"./chunk-YKXDMIHQ.js";var k=qe(et(),1);var W=qe(tt(),1);var t=qe(at(),1);Qe.capabilities;var st=r(()=>{let u=(0,W.c)(3),{config:e,ready:l}=Me(),s;return u[0]!==e.capabilities||u[1]!==l?(s={capabilities:e.capabilities,ready:l},u[0]=e.capabilities,u[1]=l,u[2]=s):s=u[2],s},"tt"),lt={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},rt=r((u,e)=>u.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:u.type!=="number"||!Number.isNaN(Number(e.trim())),"lt"),it=r((u,e)=>{if(u.type==="boolean")return e===!0?{value:!0}:u.required?{value:!1}:void 0;let l=typeof e=="string"?e.trim():"";if(l!==""){if(u.type==="number"){let s=Number(l);return Number.isNaN(s)?void 0:{value:s}}return{value:l}}},"at"),nt=r(u=>{let e=(0,W.c)(105),{onClose:l,onCreated:s}=u,c=O(),a=H(),{config:o}=Me(),{busy:i,error:n,run:m}=Ye(),[w,S]=(0,k.useState)(""),[x,C]=(0,k.useState)(""),[y,I]=(0,k.useState)(""),[h,g]=(0,k.useState)(""),b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];let[f,d]=(0,k.useState)(b),A;e[1]===Symbol.for("react.memo_cache_sentinel")?(A=r(p=>{S(p.target.value)},"C"),e[1]=A):A=e[1];let v=A,F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=r(p=>{C(p.target.value)},"I"),e[2]=F):F=e[2];let T=F,R;e[3]===Symbol.for("react.memo_cache_sentinel")?(R=r(p=>{I(p.target.value)},"T"),e[3]=R):R=e[3];let Le=R,Z;e[4]===Symbol.for("react.memo_cache_sentinel")?(Z=r(p=>{g(p.target.value)},"q"),e[4]=Z):Z=e[4];let Pe=Z,J;e[5]===Symbol.for("react.memo_cache_sentinel")?(J=r((p,_)=>{d(V=>({...V,[p]:_}))},"Y"),e[5]=J):J=e[5];let Re=J,Q;e[6]!==f?(Q=r(p=>f[p.name]??(p.type==="boolean"?!1:""),"G"),e[6]=f,e[7]=Q):Q=e[7];let B=Q,Y;if(e[8]!==o.userFields||e[9]!==B){let p;e[11]!==B?(p=r(_=>!_.required||rt(_,B(_)),"f"),e[11]=B,e[12]=p):p=e[12],Y=o.userFields.every(p),e[8]=o.userFields,e[9]=B,e[10]=Y}else Y=e[10];let Fe=Y,G;e[13]!==i||e[14]!==w||e[15]!==x||e[16]!==Fe?(G=!i&&w.trim()!==""&&x.trim()!==""&&Fe,e[13]=i,e[14]=w,e[15]=x,e[16]=Fe,e[17]=G):G=e[17];let De=G,K;e[18]!==o.userFields||e[19]!==B?(K=r(()=>{let p={};for(let _ of o.userFields){let V=it(_,B(_));V!==void 0&&(p[_.name]=V.value)}return Object.keys(p).length===0?void 0:p},"W"),e[18]=o.userFields,e[19]=B,e[20]=K):K=e[20];let Se=K,X;e[21]!==Se||e[22]!==c||e[23]!==w||e[24]!==x||e[25]!==l||e[26]!==s||e[27]!==y||e[28]!==h||e[29]!==m?(X=r(()=>{m(async()=>{await c.createAuthUser({data:Se(),email:w.trim(),name:x.trim(),password:y===""?void 0:y,role:h.trim()===""?void 0:h.trim()}),s(),l()})},"J"),e[21]=Se,e[22]=c,e[23]=w,e[24]=x,e[25]=l,e[26]=s,e[27]=y,e[28]=h,e[29]=m,e[30]=X):X=e[30];let N=X,j;e[31]!==a?(j=a("Create user"),e[31]=a,e[32]=j):j=e[32];let E;e[33]!==a?(E=a("Create user"),e[33]=a,e[34]=E):E=e[34];let M;e[35]!==E?(M=(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:E}),e[35]=E,e[36]=M):M=e[36];let ee;e[37]!==a?(ee=a("email"),e[37]=a,e[38]=ee):ee=e[38];let te;e[39]!==ee?(te=(0,t.jsx)(D,{htmlFor:"uc-email",children:ee}),e[39]=ee,e[40]=te):te=e[40];let ae;e[41]!==w?(ae=(0,t.jsx)(L,{"data-testid":"uc-email",id:"uc-email",onChange:v,type:"email",value:w}),e[41]=w,e[42]=ae):ae=e[42];let se;e[43]!==te||e[44]!==ae?(se=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[te,ae]}),e[43]=te,e[44]=ae,e[45]=se):se=e[45];let le;e[46]!==a?(le=a("name"),e[46]=a,e[47]=le):le=e[47];let re;e[48]!==le?(re=(0,t.jsx)(D,{htmlFor:"uc-name",children:le}),e[48]=le,e[49]=re):re=e[49];let ie;e[50]!==x?(ie=(0,t.jsx)(L,{"data-testid":"uc-name",id:"uc-name",onChange:T,value:x}),e[50]=x,e[51]=ie):ie=e[51];let ne;e[52]!==re||e[53]!==ie?(ne=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[re,ie]}),e[52]=re,e[53]=ie,e[54]=ne):ne=e[54];let de;e[55]!==a?(de=a("Password (optional)"),e[55]=a,e[56]=de):de=e[56];let oe;e[57]!==de?(oe=(0,t.jsx)(D,{htmlFor:"uc-password",children:de}),e[57]=de,e[58]=oe):oe=e[58];let ce;e[59]!==y?(ce=(0,t.jsx)(L,{"data-testid":"uc-password",id:"uc-password",onChange:Le,type:"password",value:y}),e[59]=y,e[60]=ce):ce=e[60];let ue;e[61]!==oe||e[62]!==ce?(ue=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[oe,ce]}),e[61]=oe,e[62]=ce,e[63]=ue):ue=e[63];let me;e[64]!==a?(me=a("Role (optional)"),e[64]=a,e[65]=me):me=e[65];let he;e[66]!==me?(he=(0,t.jsx)(D,{htmlFor:"uc-role",children:me}),e[66]=me,e[67]=he):he=e[67];let pe;e[68]!==h?(pe=(0,t.jsx)(L,{"data-testid":"uc-role",id:"uc-role",onChange:Pe,value:h}),e[68]=h,e[69]=pe):pe=e[69];let fe;e[70]!==he||e[71]!==pe?(fe=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[he,pe]}),e[70]=he,e[71]=pe,e[72]=fe):fe=e[72];let be;e[73]!==o.userFields||e[74]!==B||e[75]!==a?(be=o.userFields.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Plugin fields")}),o.userFields.map(p=>{let _=`uc-field-${p.name}`,V=p.required?"":` (${a("optional")})`;if(p.type==="boolean"){let Ee=B(p)===!0;return(0,t.jsxs)("label",{className:"flex items-center gap-2",htmlFor:_,children:[(0,t.jsx)(Ke,{checked:Ee,"data-testid":_,id:_,onCheckedChange:r(Xe=>{Re(p.name,Xe)},"onCheckedChange")}),(0,t.jsxs)("span",{className:"text-sm",children:[p.name,V]})]},p.name)}let He=B(p);return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)(D,{htmlFor:_,children:[p.name,V]}),(0,t.jsx)(L,{"data-testid":_,id:_,onChange:r(Ee=>{Re(p.name,Ee.target.value)},"onChange"),type:lt[p.type],value:typeof He=="string"?He:""})]},p.name)})]}),e[73]=o.userFields,e[74]=B,e[75]=a,e[76]=be):be=e[76];let ve;e[77]!==n?(ve=n!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:n}),e[77]=n,e[78]=ve):ve=e[78];let xe;e[79]!==a?(xe=a("Cancel"),e[79]=a,e[80]=xe):xe=e[80];let ye;e[81]!==l||e[82]!==xe?(ye=(0,t.jsx)(z,{"data-testid":"uc-cancel",onClick:l,size:"sm",type:"button",variant:"outline",children:xe}),e[81]=l,e[82]=xe,e[83]=ye):ye=e[83];let Te=!De,ge;e[84]!==i||e[85]!==a?(ge=a(i?"Creating\u2026":"Create"),e[84]=i,e[85]=a,e[86]=ge):ge=e[86];let Ne;e[87]!==N||e[88]!==Te||e[89]!==ge?(Ne=(0,t.jsx)(z,{"data-testid":"uc-submit",disabled:Te,onClick:N,size:"sm",type:"button",children:ge}),e[87]=N,e[88]=Te,e[89]=ge,e[90]=Ne):Ne=e[90];let ke;e[91]!==ye||e[92]!==Ne?(ke=(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[ye,Ne]}),e[91]=ye,e[92]=Ne,e[93]=ke):ke=e[93];let Be;return e[94]!==l||e[95]!==j||e[96]!==M||e[97]!==se||e[98]!==ne||e[99]!==ue||e[100]!==fe||e[101]!==be||e[102]!==ve||e[103]!==ke?(Be=(0,t.jsxs)(Ve,{label:j,onClose:l,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[M,se,ne,ue,fe,be,ve,ke]}),e[94]=l,e[95]=j,e[96]=M,e[97]=se,e[98]=ne,e[99]=ue,e[100]=fe,e[101]=be,e[102]=ve,e[103]=ke,e[104]=Be):Be=e[104],Be},"nt"),Oe=r(u=>{let e=(0,W.c)(2),{children:l}=u,s;return e[0]!==l?(s=(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=s):s=e[1],s},"Oe"),dt=r(u=>{let e=(0,W.c)(29),{busy:l,runAction:s,userId:c,version:a}=u,o=O(),i=H(),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),x;e[0]!==o||e[1]!==c?(x=r(()=>{ze((async()=>{S(null);try{let v=await o.listAuthSessions({limit:50,userId:c});m(v.rows)}catch(v){let F=v;m(null),S(je(F))}})())},"x"),e[0]=o,e[1]=c,e[2]=x):x=e[2];let C;e[3]!==o||e[4]!==c||e[5]!==a?(C=[o,c,a],e[3]=o,e[4]=c,e[5]=a,e[6]=C):C=e[6],(0,k.useEffect)(x,C);let y;e[7]!==o||e[8]!==s?(y=r(v=>{s(()=>o.revokeAuthSession({sessionId:v}))},"y"),e[7]=o,e[8]=s,e[9]=y):y=e[9];let I=y,h;e[10]!==i?(h=i("Sessions"),e[10]=i,e[11]=h):h=e[11];let g;e[12]!==h?(g=(0,t.jsx)(Oe,{children:h}),e[12]=h,e[13]=g):g=e[13];let b;e[14]!==w?(b=w!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:w}),e[14]=w,e[15]=b):b=e[15];let f;e[16]!==n||e[17]!==i?(f=n!==null&&n.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:i("No active sessions.")}),e[16]=n,e[17]=i,e[18]=f):f=e[18];let d;e[19]!==l||e[20]!==I||e[21]!==n||e[22]!==i?(d=n!==null&&n.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-sessions-table",children:[(0,t.jsx)($e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:i("expires")}),(0,t.jsx)(U,{children:i("ip")}),(0,t.jsx)(U,{children:i("user agent")}),(0,t.jsx)(U,{"aria-label":i("Actions")})]})}),(0,t.jsx)(_e,{children:n.map(v=>(0,t.jsxs)(q,{"data-testid":`ud-session-${v.id}`,children:[(0,t.jsx)($,{className:"text-muted-foreground tabular-nums",children:Ie(v.expiresAt)}),(0,t.jsx)($,{children:v.ipAddress??""}),(0,t.jsx)($,{className:"max-w-40 truncate",children:v.userAgent??""}),(0,t.jsx)($,{children:(0,t.jsx)(z,{"data-testid":`ud-revoke-${v.id}`,disabled:l,onClick:r(()=>{I(v.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Revoke")})})]},v.id))})]})})}),e[19]=l,e[20]=I,e[21]=n,e[22]=i,e[23]=d):d=e[23];let A;return e[24]!==g||e[25]!==b||e[26]!==f||e[27]!==d?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[g,b,f,d]}),e[24]=g,e[25]=b,e[26]=f,e[27]=d,e[28]=A):A=e[28],A},"rt"),ot=r(u=>{let e=(0,W.c)(30),{busy:l,runAction:s,userId:c,version:a}=u,o=O(),i=H(),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),x;e[0]!==o||e[1]!==c?(x=r(()=>{ze((async()=>{S(null);try{m(await o.listAuthAccounts({userId:c}))}catch(v){let F=v;m(null),S(je(F))}})())},"x"),e[0]=o,e[1]=c,e[2]=x):x=e[2];let C;e[3]!==o||e[4]!==c||e[5]!==a?(C=[o,c,a],e[3]=o,e[4]=c,e[5]=a,e[6]=C):C=e[6],(0,k.useEffect)(x,C);let y;e[7]!==o||e[8]!==s||e[9]!==c?(y=r(v=>{s(()=>o.unlinkAuthAccount({accountId:v,userId:c}))},"y"),e[7]=o,e[8]=s,e[9]=c,e[10]=y):y=e[10];let I=y,h;e[11]!==i?(h=i("Linked accounts"),e[11]=i,e[12]=h):h=e[12];let g;e[13]!==h?(g=(0,t.jsx)(Oe,{children:h}),e[13]=h,e[14]=g):g=e[14];let b;e[15]!==w?(b=w!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:w}),e[15]=w,e[16]=b):b=e[16];let f;e[17]!==n||e[18]!==i?(f=n!==null&&n.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i("No linked accounts.")}),e[17]=n,e[18]=i,e[19]=f):f=e[19];let d;e[20]!==n||e[21]!==l||e[22]!==I||e[23]!==i?(d=n!==null&&n.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-accounts-table",children:[(0,t.jsx)($e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:i("provider")}),(0,t.jsx)(U,{children:i("created")}),(0,t.jsx)(U,{"aria-label":i("Actions")})]})}),(0,t.jsx)(_e,{children:n.map(v=>{let F=Ae(v.id);return(0,t.jsxs)(q,{"data-testid":`ud-account-${F}`,children:[(0,t.jsx)($,{children:Ae(v.providerId)}),(0,t.jsx)($,{className:"text-muted-foreground tabular-nums",children:Ie(v.createdAt)}),(0,t.jsx)($,{children:(0,t.jsx)(z,{"data-testid":`ud-unlink-${F}`,disabled:l,onClick:r(()=>{I(F)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Unlink")})})]},F)})})]})})}),e[20]=n,e[21]=l,e[22]=I,e[23]=i,e[24]=d):d=e[24];let A;return e[25]!==g||e[26]!==b||e[27]!==f||e[28]!==d?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[g,b,f,d]}),e[25]=g,e[26]=b,e[27]=f,e[28]=d,e[29]=A):A=e[29],A},"it"),ct=r(u=>{let e=(0,W.c)(40),{busy:l,capabilities:s,runAction:c,userId:a,version:o}=u,i=O(),n=H(),[m,w]=(0,k.useState)(null),S;e[0]!==s.passkey||e[1]!==i||e[2]!==a?(S=r(()=>{s.passkey&&ze((async()=>{try{w(await i.listAuthPasskeys({userId:a}))}catch{w(null)}})())},"S"),e[0]=s.passkey,e[1]=i,e[2]=a,e[3]=S):S=e[3];let x;e[4]!==s.passkey||e[5]!==i||e[6]!==a||e[7]!==o?(x=[s.passkey,i,a,o],e[4]=s.passkey,e[5]=i,e[6]=a,e[7]=o,e[8]=x):x=e[8],(0,k.useEffect)(S,x);let C;e[9]!==i||e[10]!==c||e[11]!==a?(C=r(()=>{c(()=>i.disableAuthTwoFactor({userId:a}))},"w"),e[9]=i,e[10]=c,e[11]=a,e[12]=C):C=e[12];let y=C,I;e[13]!==i||e[14]!==c?(I=r(F=>{c(()=>i.deleteAuthPasskey({passkeyId:F}))},"A"),e[13]=i,e[14]=c,e[15]=I):I=e[15];let h=I,g;e[16]!==n?(g=n("Security"),e[16]=n,e[17]=g):g=e[17];let b;e[18]!==g?(b=(0,t.jsx)(Oe,{children:g}),e[18]=g,e[19]=b):b=e[19];let f;e[20]!==l||e[21]!==s.twoFactor||e[22]!==y||e[23]!==n?(f=s.twoFactor&&(0,t.jsx)(z,{"data-testid":"ud-disable-2fa",disabled:l,onClick:y,size:"sm",type:"button",variant:"outline",children:n("Disable two-factor")}),e[20]=l,e[21]=s.twoFactor,e[22]=y,e[23]=n,e[24]=f):f=e[24];let d;e[25]!==s.passkey||e[26]!==m||e[27]!==n?(d=s.passkey&&m!==null&&m.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n("No passkeys.")}),e[25]=s.passkey,e[26]=m,e[27]=n,e[28]=d):d=e[28];let A;e[29]!==l||e[30]!==s.passkey||e[31]!==h||e[32]!==m||e[33]!==n?(A=s.passkey&&m!==null&&m.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-passkeys-table",children:[(0,t.jsx)($e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:n("name")}),(0,t.jsx)(U,{children:n("created")}),(0,t.jsx)(U,{"aria-label":n("Actions")})]})}),(0,t.jsx)(_e,{children:m.map(F=>{let T=Ae(F.id);return(0,t.jsxs)(q,{"data-testid":`ud-passkey-${T}`,children:[(0,t.jsx)($,{children:Ae(F.name)||T}),(0,t.jsx)($,{className:"text-muted-foreground tabular-nums",children:Ie(F.createdAt)}),(0,t.jsx)($,{children:(0,t.jsx)(z,{"data-testid":`ud-delete-passkey-${T}`,disabled:l,onClick:r(()=>{h(T)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})})]},T)})})]})})}),e[29]=l,e[30]=s.passkey,e[31]=h,e[32]=m,e[33]=n,e[34]=A):A=e[34];let v;return e[35]!==b||e[36]!==f||e[37]!==d||e[38]!==A?(v=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[b,f,d,A]}),e[35]=b,e[36]=f,e[37]=d,e[38]=A,e[39]=v):v=e[39],v},"ot"),ut=/(?:at|expires)$/iu,mt=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),ht=r((u,e)=>typeof e=="number"&&ut.test(u)?Ie(e):Ae(e),"ut"),pt=r(({capabilities:u,onChanged:e,onClose:l,user:s})=>{let c=O(),a=H(),o=s.banned===!0,[i,n]=(0,k.useState)(null),[m,w]=(0,k.useState)(!1),[S,x]=(0,k.useState)(0),[C,y]=(0,k.useState)(typeof s.role=="string"?s.role:""),[I,h]=(0,k.useState)(""),[g,b]=(0,k.useState)(""),[f,d]=(0,k.useState)(""),[A,v]=(0,k.useState)(null),[F,T]=(0,k.useState)(!1),R=r((N,j)=>{ze((async()=>{w(!0),n(null);try{let E=await N();j?.refresh!==!1&&(x(M=>M+1),e()),j?.onResult?.(E)}catch(E){n(je(E))}w(!1)})())},"T"),Le=r(N=>{y(N.target.value)},"ze"),Z=r(N=>{h(N.target.value)},"q"),Pe=r(N=>{b(N.target.value)},"Be"),J=r(N=>{d(N.target.value)},"Y"),Re=r(()=>{let N=C.trim();N!==""&&R(async()=>{await c.setAuthUserRole({role:N,userId:s.id})})},"Ue"),Q=r(()=>{let N=Number.parseInt(g,10),j=Number.isFinite(N)&&N>0?N*86400:void 0;R(async()=>{await c.banAuthUser({expiresInSeconds:j,reason:I.trim()===""?void 0:I.trim(),userId:s.id})})},"G"),B=r(()=>{R(async()=>{await c.unbanAuthUser({userId:s.id})})},"E"),Y=r(()=>{R(async()=>{await c.setAuthUserPassword({newPassword:f,userId:s.id}),d("")})},"Q"),Fe=r(()=>{R(()=>c.impersonateAuthUser({userId:s.id}),{onResult:r(N=>{v(N.token)},"onResult"),refresh:!1})},"we"),G=r(()=>{R(async()=>{await c.revokeAuthUserSessions({userId:s.id})})},"Z"),De=r(()=>{R(async()=>{await c.removeAuthUser({userId:s.id}),l()})},"$e"),K=r(()=>{T(!0)},"W"),Se=r(()=>{T(!1)},"Ce"),X=Object.entries(s).filter(([N])=>!mt.has(N));return(0,t.jsxs)(Ve,{label:a("User details"),onClose:l,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:s.name??s.email??s.id}),(0,t.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:s.id}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof s.role=="string"&&s.role!==""&&(0,t.jsx)(P,{variant:"secondary",children:s.role}),o?(0,t.jsx)(P,{variant:"destructive",children:a("Banned")}):(0,t.jsx)(P,{variant:"outline",children:a("Active")}),s.emailVerified===!0?(0,t.jsx)(P,{variant:"secondary",children:a("verified")}):(0,t.jsx)(P,{variant:"outline",children:a("unverified")})]})]}),(0,t.jsx)(z,{"data-testid":"ud-close",onClick:l,size:"sm",type:"button",variant:"ghost",children:a("Close")})]}),i!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:i}),u.admin&&(0,t.jsxs)(we,{className:"gap-0 py-0",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Actions")})}),(0,t.jsxs)(Ce,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-role",children:a("Role")}),(0,t.jsx)(L,{"data-testid":"ud-role-input",id:"ud-role",onChange:Le,value:C})]}),(0,t.jsx)(z,{"data-testid":"ud-set-role",disabled:m||C.trim()==="",onClick:Re,size:"sm",type:"button",variant:"outline",children:a("Set role")})]}),o?(0,t.jsx)(z,{"data-testid":"ud-unban",disabled:m,onClick:B,size:"sm",type:"button",variant:"outline",children:a("Unban")}):(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-ban-reason",children:a("Ban reason (optional)")}),(0,t.jsx)(L,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:Z,value:I})]}),(0,t.jsxs)("div",{className:"flex w-24 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-ban-days",children:a("Days")}),(0,t.jsx)(L,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:Pe,type:"number",value:g})]}),(0,t.jsx)(z,{"data-testid":"ud-ban",disabled:m,onClick:Q,size:"sm",type:"button",variant:"destructive",children:a("Ban user")})]}),(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-password",children:a("New password")}),(0,t.jsx)(L,{"data-testid":"ud-password",id:"ud-password",onChange:J,type:"password",value:f})]}),(0,t.jsx)(z,{"data-testid":"ud-set-password",disabled:m||f==="",onClick:Y,size:"sm",type:"button",variant:"outline",children:a("Set password")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(z,{"data-testid":"ud-impersonate",disabled:m,onClick:Fe,size:"sm",type:"button",variant:"outline",children:a("Impersonate")}),(0,t.jsx)(z,{"data-testid":"ud-revoke-all",disabled:m,onClick:G,size:"sm",type:"button",variant:"outline",children:a("Revoke all sessions")}),F?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(z,{"data-testid":"ud-delete-confirm",disabled:m,onClick:De,size:"sm",type:"button",variant:"destructive",children:a("Confirm delete")}),(0,t.jsx)(z,{"data-testid":"ud-delete-cancel",onClick:Se,size:"sm",type:"button",variant:"ghost",children:a("Cancel")})]}):(0,t.jsx)(z,{"data-testid":"ud-delete",disabled:m,onClick:K,size:"sm",type:"button",variant:"destructive",children:a("Delete user")})]}),A!==null&&(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsx)(D,{htmlFor:"ud-token",children:a("Impersonation token")}),(0,t.jsx)(L,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:A})]})]})]}),(0,t.jsx)(dt,{busy:m,runAction:R,userId:s.id,version:S}),u.accounts&&(0,t.jsx)(ot,{busy:m,runAction:R,userId:s.id,version:S}),(u.twoFactor||u.passkey)&&(0,t.jsx)(ct,{busy:m,capabilities:u,runAction:R,userId:s.id,version:S}),(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Fields")}),(0,t.jsx)("dl",{className:"flex flex-col",children:X.map(([N,j])=>(0,t.jsxs)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsx)("dt",{className:"text-xs font-semibold text-muted-foreground",children:N}),(0,t.jsx)("dd",{className:"m-0 font-mono text-xs break-words",children:ht(N,j)})]},N))})]})]})},"mt"),ft=50,Rt=r(({pageSize:u=ft}={})=>{let e=O(),l=H(),[s,c]=(0,k.useState)(""),[a,o]=(0,k.useState)(""),i=Ge(s),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(!1),{capabilities:x}=st(),C=i.trim(),y=a.trim(),I=Ze(["lunora-auth-users",C,y,u],()=>e.listAuthUsers({filterField:y===""?void 0:"role",filterValue:y===""?void 0:y,limit:u,search:C===""?void 0:C}),{keepPreviousData:!0}),h=I.data?.rows??null,g=I.error,b=r(()=>{I.refetch()},"b");Je(()=>{I.refetch()},!0);let f=n===null?null:h?.find(d=>d.id===n)??null;return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(L,{"aria-label":l("Search users"),className:"w-56","data-testid":"us-search",onChange:r(d=>{c(d.target.value)},"onChange"),placeholder:l("Search by email or name\u2026"),value:s}),(0,t.jsx)(L,{"aria-label":l("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:r(d=>{o(d.target.value)},"onChange"),placeholder:l("Filter by role"),value:a}),(0,t.jsx)(z,{"data-testid":"us-new",onClick:r(()=>{S(!0)},"onClick"),size:"sm",type:"button",children:l("New user")})]}),g!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:g}),h!==null&&h.length===0&&(0,t.jsx)(We,{description:l("Users who sign up to your app will appear here."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"})}),testId:"us-empty",title:l("No users.")}),h!==null&&h.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"us-table",children:[(0,t.jsx)($e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:l("id")}),(0,t.jsx)(U,{children:l("email")}),(0,t.jsx)(U,{children:l("name")}),(0,t.jsx)(U,{children:l("role")}),(0,t.jsx)(U,{children:l("status")}),(0,t.jsx)(U,{children:l("verified")}),(0,t.jsx)(U,{children:l("created")}),(0,t.jsx)(U,{"aria-label":l("Actions")})]})}),(0,t.jsx)(_e,{children:h.map(d=>(0,t.jsxs)(q,{"data-testid":`us-row-${d.id}`,children:[(0,t.jsx)($,{className:"font-mono text-xs",children:d.id}),(0,t.jsx)($,{children:d.email??""}),(0,t.jsx)($,{children:d.name??""}),(0,t.jsx)($,{children:typeof d.role=="string"&&d.role!==""?(0,t.jsx)(P,{variant:"secondary",children:d.role}):""}),(0,t.jsx)($,{children:d.banned===!0?(0,t.jsx)(P,{variant:"destructive",children:l("Banned")}):(0,t.jsx)(P,{variant:"success",children:l("Active")})}),(0,t.jsx)($,{children:d.emailVerified===!0?(0,t.jsx)(P,{variant:"success",children:l("yes")}):(0,t.jsx)(P,{variant:"outline",children:l("no")})}),(0,t.jsx)($,{className:"text-muted-foreground tabular-nums",children:Ie(d.createdAt)}),(0,t.jsx)($,{children:(0,t.jsx)(z,{"data-testid":`us-manage-${d.id}`,onClick:r(()=>{m(d.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Manage")})})]},d.id))})]})})}),f!==null&&(0,t.jsx)(pt,{capabilities:x,onChanged:b,onClose:r(()=>{m(null)},"onClose"),user:f}),w&&(0,t.jsx)(nt,{onClose:r(()=>{S(!1)},"onClose"),onCreated:b})]})},"Et");export{Rt as UsersPanel};
1
+ import{a as Ke}from"./chunk-VVOVVU53.js";import{a as Qe,b as Me}from"./chunk-IXMHWLSN.js";import{a as Ye}from"./chunk-NBC6NJFJ.js";import{a as Ve}from"./chunk-XZMOZFE6.js";import{a as D}from"./chunk-IMOHEGMV.js";import{a as Je}from"./chunk-66UGPQVC.js";import{a as Ge}from"./chunk-QKEJLVC5.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import{P as L}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as z}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as P}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{b as Ze}from"./chunk-L6KA7M4B.js";import{f as O}from"./chunk-XDT5DXOI.js";import"./chunk-FSRSK4LY.js";import{a as We}from"./chunk-FKVZRPV5.js";import{a as Ue,b as $e,c as _e,d as q,e as U,f as $}from"./chunk-HEAQVSNS.js";import{a as we,e as Ce}from"./chunk-WUWBZPUK.js";import{d as H,h as je,m as Ae,o as ze,r as Ie}from"./chunk-Y4Q25F6X.js";import"./chunk-T2IE5GKA.js";import{a as r,d as qe,e as et,f as tt,g as at}from"./chunk-YKXDMIHQ.js";var k=qe(et(),1);var W=qe(tt(),1);var t=qe(at(),1);Qe.capabilities;var st=r(()=>{let u=(0,W.c)(3),{config:e,ready:l}=Me(),s;return u[0]!==e.capabilities||u[1]!==l?(s={capabilities:e.capabilities,ready:l},u[0]=e.capabilities,u[1]=l,u[2]=s):s=u[2],s},"tt"),lt={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},rt=r((u,e)=>u.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:u.type!=="number"||!Number.isNaN(Number(e.trim())),"lt"),it=r((u,e)=>{if(u.type==="boolean")return e===!0?{value:!0}:u.required?{value:!1}:void 0;let l=typeof e=="string"?e.trim():"";if(l!==""){if(u.type==="number"){let s=Number(l);return Number.isNaN(s)?void 0:{value:s}}return{value:l}}},"at"),nt=r(u=>{let e=(0,W.c)(105),{onClose:l,onCreated:s}=u,c=O(),a=H(),{config:o}=Me(),{busy:i,error:n,run:m}=Ye(),[w,S]=(0,k.useState)(""),[x,C]=(0,k.useState)(""),[y,I]=(0,k.useState)(""),[h,g]=(0,k.useState)(""),b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];let[f,d]=(0,k.useState)(b),A;e[1]===Symbol.for("react.memo_cache_sentinel")?(A=r(p=>{S(p.target.value)},"C"),e[1]=A):A=e[1];let v=A,F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=r(p=>{C(p.target.value)},"I"),e[2]=F):F=e[2];let T=F,R;e[3]===Symbol.for("react.memo_cache_sentinel")?(R=r(p=>{I(p.target.value)},"T"),e[3]=R):R=e[3];let Le=R,Z;e[4]===Symbol.for("react.memo_cache_sentinel")?(Z=r(p=>{g(p.target.value)},"q"),e[4]=Z):Z=e[4];let Pe=Z,J;e[5]===Symbol.for("react.memo_cache_sentinel")?(J=r((p,_)=>{d(V=>({...V,[p]:_}))},"Y"),e[5]=J):J=e[5];let Re=J,Q;e[6]!==f?(Q=r(p=>f[p.name]??(p.type==="boolean"?!1:""),"G"),e[6]=f,e[7]=Q):Q=e[7];let B=Q,Y;if(e[8]!==o.userFields||e[9]!==B){let p;e[11]!==B?(p=r(_=>!_.required||rt(_,B(_)),"f"),e[11]=B,e[12]=p):p=e[12],Y=o.userFields.every(p),e[8]=o.userFields,e[9]=B,e[10]=Y}else Y=e[10];let Fe=Y,G;e[13]!==i||e[14]!==w||e[15]!==x||e[16]!==Fe?(G=!i&&w.trim()!==""&&x.trim()!==""&&Fe,e[13]=i,e[14]=w,e[15]=x,e[16]=Fe,e[17]=G):G=e[17];let De=G,K;e[18]!==o.userFields||e[19]!==B?(K=r(()=>{let p={};for(let _ of o.userFields){let V=it(_,B(_));V!==void 0&&(p[_.name]=V.value)}return Object.keys(p).length===0?void 0:p},"W"),e[18]=o.userFields,e[19]=B,e[20]=K):K=e[20];let Se=K,X;e[21]!==Se||e[22]!==c||e[23]!==w||e[24]!==x||e[25]!==l||e[26]!==s||e[27]!==y||e[28]!==h||e[29]!==m?(X=r(()=>{m(async()=>{await c.createAuthUser({data:Se(),email:w.trim(),name:x.trim(),password:y===""?void 0:y,role:h.trim()===""?void 0:h.trim()}),s(),l()})},"J"),e[21]=Se,e[22]=c,e[23]=w,e[24]=x,e[25]=l,e[26]=s,e[27]=y,e[28]=h,e[29]=m,e[30]=X):X=e[30];let N=X,j;e[31]!==a?(j=a("Create user"),e[31]=a,e[32]=j):j=e[32];let E;e[33]!==a?(E=a("Create user"),e[33]=a,e[34]=E):E=e[34];let M;e[35]!==E?(M=(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:E}),e[35]=E,e[36]=M):M=e[36];let ee;e[37]!==a?(ee=a("email"),e[37]=a,e[38]=ee):ee=e[38];let te;e[39]!==ee?(te=(0,t.jsx)(D,{htmlFor:"uc-email",children:ee}),e[39]=ee,e[40]=te):te=e[40];let ae;e[41]!==w?(ae=(0,t.jsx)(L,{"data-testid":"uc-email",id:"uc-email",onChange:v,type:"email",value:w}),e[41]=w,e[42]=ae):ae=e[42];let se;e[43]!==te||e[44]!==ae?(se=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[te,ae]}),e[43]=te,e[44]=ae,e[45]=se):se=e[45];let le;e[46]!==a?(le=a("name"),e[46]=a,e[47]=le):le=e[47];let re;e[48]!==le?(re=(0,t.jsx)(D,{htmlFor:"uc-name",children:le}),e[48]=le,e[49]=re):re=e[49];let ie;e[50]!==x?(ie=(0,t.jsx)(L,{"data-testid":"uc-name",id:"uc-name",onChange:T,value:x}),e[50]=x,e[51]=ie):ie=e[51];let ne;e[52]!==re||e[53]!==ie?(ne=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[re,ie]}),e[52]=re,e[53]=ie,e[54]=ne):ne=e[54];let de;e[55]!==a?(de=a("Password (optional)"),e[55]=a,e[56]=de):de=e[56];let oe;e[57]!==de?(oe=(0,t.jsx)(D,{htmlFor:"uc-password",children:de}),e[57]=de,e[58]=oe):oe=e[58];let ce;e[59]!==y?(ce=(0,t.jsx)(L,{"data-testid":"uc-password",id:"uc-password",onChange:Le,type:"password",value:y}),e[59]=y,e[60]=ce):ce=e[60];let ue;e[61]!==oe||e[62]!==ce?(ue=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[oe,ce]}),e[61]=oe,e[62]=ce,e[63]=ue):ue=e[63];let me;e[64]!==a?(me=a("Role (optional)"),e[64]=a,e[65]=me):me=e[65];let he;e[66]!==me?(he=(0,t.jsx)(D,{htmlFor:"uc-role",children:me}),e[66]=me,e[67]=he):he=e[67];let pe;e[68]!==h?(pe=(0,t.jsx)(L,{"data-testid":"uc-role",id:"uc-role",onChange:Pe,value:h}),e[68]=h,e[69]=pe):pe=e[69];let fe;e[70]!==he||e[71]!==pe?(fe=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[he,pe]}),e[70]=he,e[71]=pe,e[72]=fe):fe=e[72];let be;e[73]!==o.userFields||e[74]!==B||e[75]!==a?(be=o.userFields.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Plugin fields")}),o.userFields.map(p=>{let _=`uc-field-${p.name}`,V=p.required?"":` (${a("optional")})`;if(p.type==="boolean"){let Ee=B(p)===!0;return(0,t.jsxs)("label",{className:"flex items-center gap-2",htmlFor:_,children:[(0,t.jsx)(Ke,{checked:Ee,"data-testid":_,id:_,onCheckedChange:r(Xe=>{Re(p.name,Xe)},"onCheckedChange")}),(0,t.jsxs)("span",{className:"text-sm",children:[p.name,V]})]},p.name)}let He=B(p);return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)(D,{htmlFor:_,children:[p.name,V]}),(0,t.jsx)(L,{"data-testid":_,id:_,onChange:r(Ee=>{Re(p.name,Ee.target.value)},"onChange"),type:lt[p.type],value:typeof He=="string"?He:""})]},p.name)})]}),e[73]=o.userFields,e[74]=B,e[75]=a,e[76]=be):be=e[76];let ve;e[77]!==n?(ve=n!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:n}),e[77]=n,e[78]=ve):ve=e[78];let xe;e[79]!==a?(xe=a("Cancel"),e[79]=a,e[80]=xe):xe=e[80];let ye;e[81]!==l||e[82]!==xe?(ye=(0,t.jsx)(z,{"data-testid":"uc-cancel",onClick:l,size:"sm",type:"button",variant:"outline",children:xe}),e[81]=l,e[82]=xe,e[83]=ye):ye=e[83];let Te=!De,ge;e[84]!==i||e[85]!==a?(ge=a(i?"Creating\u2026":"Create"),e[84]=i,e[85]=a,e[86]=ge):ge=e[86];let Ne;e[87]!==N||e[88]!==Te||e[89]!==ge?(Ne=(0,t.jsx)(z,{"data-testid":"uc-submit",disabled:Te,onClick:N,size:"sm",type:"button",children:ge}),e[87]=N,e[88]=Te,e[89]=ge,e[90]=Ne):Ne=e[90];let ke;e[91]!==ye||e[92]!==Ne?(ke=(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[ye,Ne]}),e[91]=ye,e[92]=Ne,e[93]=ke):ke=e[93];let Be;return e[94]!==l||e[95]!==j||e[96]!==M||e[97]!==se||e[98]!==ne||e[99]!==ue||e[100]!==fe||e[101]!==be||e[102]!==ve||e[103]!==ke?(Be=(0,t.jsxs)(Ve,{label:j,onClose:l,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[M,se,ne,ue,fe,be,ve,ke]}),e[94]=l,e[95]=j,e[96]=M,e[97]=se,e[98]=ne,e[99]=ue,e[100]=fe,e[101]=be,e[102]=ve,e[103]=ke,e[104]=Be):Be=e[104],Be},"nt"),Oe=r(u=>{let e=(0,W.c)(2),{children:l}=u,s;return e[0]!==l?(s=(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=s):s=e[1],s},"Oe"),dt=r(u=>{let e=(0,W.c)(29),{busy:l,runAction:s,userId:c,version:a}=u,o=O(),i=H(),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),x;e[0]!==o||e[1]!==c?(x=r(()=>{ze((async()=>{S(null);try{let v=await o.listAuthSessions({limit:50,userId:c});m(v.rows)}catch(v){let F=v;m(null),S(je(F))}})())},"x"),e[0]=o,e[1]=c,e[2]=x):x=e[2];let C;e[3]!==o||e[4]!==c||e[5]!==a?(C=[o,c,a],e[3]=o,e[4]=c,e[5]=a,e[6]=C):C=e[6],(0,k.useEffect)(x,C);let y;e[7]!==o||e[8]!==s?(y=r(v=>{s(()=>o.revokeAuthSession({sessionId:v}))},"y"),e[7]=o,e[8]=s,e[9]=y):y=e[9];let I=y,h;e[10]!==i?(h=i("Sessions"),e[10]=i,e[11]=h):h=e[11];let g;e[12]!==h?(g=(0,t.jsx)(Oe,{children:h}),e[12]=h,e[13]=g):g=e[13];let b;e[14]!==w?(b=w!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:w}),e[14]=w,e[15]=b):b=e[15];let f;e[16]!==n||e[17]!==i?(f=n!==null&&n.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:i("No active sessions.")}),e[16]=n,e[17]=i,e[18]=f):f=e[18];let d;e[19]!==l||e[20]!==I||e[21]!==n||e[22]!==i?(d=n!==null&&n.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-sessions-table",children:[(0,t.jsx)($e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:i("expires")}),(0,t.jsx)(U,{children:i("ip")}),(0,t.jsx)(U,{children:i("user agent")}),(0,t.jsx)(U,{"aria-label":i("Actions")})]})}),(0,t.jsx)(_e,{children:n.map(v=>(0,t.jsxs)(q,{"data-testid":`ud-session-${v.id}`,children:[(0,t.jsx)($,{className:"text-muted-foreground tabular-nums",children:Ie(v.expiresAt)}),(0,t.jsx)($,{children:v.ipAddress??""}),(0,t.jsx)($,{className:"max-w-40 truncate",children:v.userAgent??""}),(0,t.jsx)($,{children:(0,t.jsx)(z,{"data-testid":`ud-revoke-${v.id}`,disabled:l,onClick:r(()=>{I(v.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Revoke")})})]},v.id))})]})})}),e[19]=l,e[20]=I,e[21]=n,e[22]=i,e[23]=d):d=e[23];let A;return e[24]!==g||e[25]!==b||e[26]!==f||e[27]!==d?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[g,b,f,d]}),e[24]=g,e[25]=b,e[26]=f,e[27]=d,e[28]=A):A=e[28],A},"rt"),ot=r(u=>{let e=(0,W.c)(30),{busy:l,runAction:s,userId:c,version:a}=u,o=O(),i=H(),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),x;e[0]!==o||e[1]!==c?(x=r(()=>{ze((async()=>{S(null);try{m(await o.listAuthAccounts({userId:c}))}catch(v){let F=v;m(null),S(je(F))}})())},"x"),e[0]=o,e[1]=c,e[2]=x):x=e[2];let C;e[3]!==o||e[4]!==c||e[5]!==a?(C=[o,c,a],e[3]=o,e[4]=c,e[5]=a,e[6]=C):C=e[6],(0,k.useEffect)(x,C);let y;e[7]!==o||e[8]!==s||e[9]!==c?(y=r(v=>{s(()=>o.unlinkAuthAccount({accountId:v,userId:c}))},"y"),e[7]=o,e[8]=s,e[9]=c,e[10]=y):y=e[10];let I=y,h;e[11]!==i?(h=i("Linked accounts"),e[11]=i,e[12]=h):h=e[12];let g;e[13]!==h?(g=(0,t.jsx)(Oe,{children:h}),e[13]=h,e[14]=g):g=e[14];let b;e[15]!==w?(b=w!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:w}),e[15]=w,e[16]=b):b=e[16];let f;e[17]!==n||e[18]!==i?(f=n!==null&&n.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i("No linked accounts.")}),e[17]=n,e[18]=i,e[19]=f):f=e[19];let d;e[20]!==n||e[21]!==l||e[22]!==I||e[23]!==i?(d=n!==null&&n.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-accounts-table",children:[(0,t.jsx)($e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:i("provider")}),(0,t.jsx)(U,{children:i("created")}),(0,t.jsx)(U,{"aria-label":i("Actions")})]})}),(0,t.jsx)(_e,{children:n.map(v=>{let F=Ae(v.id);return(0,t.jsxs)(q,{"data-testid":`ud-account-${F}`,children:[(0,t.jsx)($,{children:Ae(v.providerId)}),(0,t.jsx)($,{className:"text-muted-foreground tabular-nums",children:Ie(v.createdAt)}),(0,t.jsx)($,{children:(0,t.jsx)(z,{"data-testid":`ud-unlink-${F}`,disabled:l,onClick:r(()=>{I(F)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Unlink")})})]},F)})})]})})}),e[20]=n,e[21]=l,e[22]=I,e[23]=i,e[24]=d):d=e[24];let A;return e[25]!==g||e[26]!==b||e[27]!==f||e[28]!==d?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[g,b,f,d]}),e[25]=g,e[26]=b,e[27]=f,e[28]=d,e[29]=A):A=e[29],A},"it"),ct=r(u=>{let e=(0,W.c)(40),{busy:l,capabilities:s,runAction:c,userId:a,version:o}=u,i=O(),n=H(),[m,w]=(0,k.useState)(null),S;e[0]!==s.passkey||e[1]!==i||e[2]!==a?(S=r(()=>{s.passkey&&ze((async()=>{try{w(await i.listAuthPasskeys({userId:a}))}catch{w(null)}})())},"S"),e[0]=s.passkey,e[1]=i,e[2]=a,e[3]=S):S=e[3];let x;e[4]!==s.passkey||e[5]!==i||e[6]!==a||e[7]!==o?(x=[s.passkey,i,a,o],e[4]=s.passkey,e[5]=i,e[6]=a,e[7]=o,e[8]=x):x=e[8],(0,k.useEffect)(S,x);let C;e[9]!==i||e[10]!==c||e[11]!==a?(C=r(()=>{c(()=>i.disableAuthTwoFactor({userId:a}))},"w"),e[9]=i,e[10]=c,e[11]=a,e[12]=C):C=e[12];let y=C,I;e[13]!==i||e[14]!==c?(I=r(F=>{c(()=>i.deleteAuthPasskey({passkeyId:F}))},"A"),e[13]=i,e[14]=c,e[15]=I):I=e[15];let h=I,g;e[16]!==n?(g=n("Security"),e[16]=n,e[17]=g):g=e[17];let b;e[18]!==g?(b=(0,t.jsx)(Oe,{children:g}),e[18]=g,e[19]=b):b=e[19];let f;e[20]!==l||e[21]!==s.twoFactor||e[22]!==y||e[23]!==n?(f=s.twoFactor&&(0,t.jsx)(z,{"data-testid":"ud-disable-2fa",disabled:l,onClick:y,size:"sm",type:"button",variant:"outline",children:n("Disable two-factor")}),e[20]=l,e[21]=s.twoFactor,e[22]=y,e[23]=n,e[24]=f):f=e[24];let d;e[25]!==s.passkey||e[26]!==m||e[27]!==n?(d=s.passkey&&m!==null&&m.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n("No passkeys.")}),e[25]=s.passkey,e[26]=m,e[27]=n,e[28]=d):d=e[28];let A;e[29]!==l||e[30]!==s.passkey||e[31]!==h||e[32]!==m||e[33]!==n?(A=s.passkey&&m!==null&&m.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-passkeys-table",children:[(0,t.jsx)($e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:n("name")}),(0,t.jsx)(U,{children:n("created")}),(0,t.jsx)(U,{"aria-label":n("Actions")})]})}),(0,t.jsx)(_e,{children:m.map(F=>{let T=Ae(F.id);return(0,t.jsxs)(q,{"data-testid":`ud-passkey-${T}`,children:[(0,t.jsx)($,{children:Ae(F.name)||T}),(0,t.jsx)($,{className:"text-muted-foreground tabular-nums",children:Ie(F.createdAt)}),(0,t.jsx)($,{children:(0,t.jsx)(z,{"data-testid":`ud-delete-passkey-${T}`,disabled:l,onClick:r(()=>{h(T)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})})]},T)})})]})})}),e[29]=l,e[30]=s.passkey,e[31]=h,e[32]=m,e[33]=n,e[34]=A):A=e[34];let v;return e[35]!==b||e[36]!==f||e[37]!==d||e[38]!==A?(v=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[b,f,d,A]}),e[35]=b,e[36]=f,e[37]=d,e[38]=A,e[39]=v):v=e[39],v},"ot"),ut=/(?:at|expires)$/iu,mt=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),ht=r((u,e)=>typeof e=="number"&&ut.test(u)?Ie(e):Ae(e),"ut"),pt=r(({capabilities:u,onChanged:e,onClose:l,user:s})=>{let c=O(),a=H(),o=s.banned===!0,[i,n]=(0,k.useState)(null),[m,w]=(0,k.useState)(!1),[S,x]=(0,k.useState)(0),[C,y]=(0,k.useState)(typeof s.role=="string"?s.role:""),[I,h]=(0,k.useState)(""),[g,b]=(0,k.useState)(""),[f,d]=(0,k.useState)(""),[A,v]=(0,k.useState)(null),[F,T]=(0,k.useState)(!1),R=r((N,j)=>{ze((async()=>{w(!0),n(null);try{let E=await N();j?.refresh!==!1&&(x(M=>M+1),e()),j?.onResult?.(E)}catch(E){n(je(E))}w(!1)})())},"T"),Le=r(N=>{y(N.target.value)},"ze"),Z=r(N=>{h(N.target.value)},"q"),Pe=r(N=>{b(N.target.value)},"Be"),J=r(N=>{d(N.target.value)},"Y"),Re=r(()=>{let N=C.trim();N!==""&&R(async()=>{await c.setAuthUserRole({role:N,userId:s.id})})},"Ue"),Q=r(()=>{let N=Number.parseInt(g,10),j=Number.isFinite(N)&&N>0?N*86400:void 0;R(async()=>{await c.banAuthUser({expiresInSeconds:j,reason:I.trim()===""?void 0:I.trim(),userId:s.id})})},"G"),B=r(()=>{R(async()=>{await c.unbanAuthUser({userId:s.id})})},"E"),Y=r(()=>{R(async()=>{await c.setAuthUserPassword({newPassword:f,userId:s.id}),d("")})},"Q"),Fe=r(()=>{R(()=>c.impersonateAuthUser({userId:s.id}),{onResult:r(N=>{v(N.token)},"onResult"),refresh:!1})},"we"),G=r(()=>{R(async()=>{await c.revokeAuthUserSessions({userId:s.id})})},"Z"),De=r(()=>{R(async()=>{await c.removeAuthUser({userId:s.id}),l()})},"$e"),K=r(()=>{T(!0)},"W"),Se=r(()=>{T(!1)},"Ce"),X=Object.entries(s).filter(([N])=>!mt.has(N));return(0,t.jsxs)(Ve,{label:a("User details"),onClose:l,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:s.name??s.email??s.id}),(0,t.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:s.id}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof s.role=="string"&&s.role!==""&&(0,t.jsx)(P,{variant:"secondary",children:s.role}),o?(0,t.jsx)(P,{variant:"destructive",children:a("Banned")}):(0,t.jsx)(P,{variant:"outline",children:a("Active")}),s.emailVerified===!0?(0,t.jsx)(P,{variant:"secondary",children:a("verified")}):(0,t.jsx)(P,{variant:"outline",children:a("unverified")})]})]}),(0,t.jsx)(z,{"data-testid":"ud-close",onClick:l,size:"sm",type:"button",variant:"ghost",children:a("Close")})]}),i!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:i}),u.admin&&(0,t.jsxs)(we,{className:"gap-0 py-0",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Actions")})}),(0,t.jsxs)(Ce,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-role",children:a("Role")}),(0,t.jsx)(L,{"data-testid":"ud-role-input",id:"ud-role",onChange:Le,value:C})]}),(0,t.jsx)(z,{"data-testid":"ud-set-role",disabled:m||C.trim()==="",onClick:Re,size:"sm",type:"button",variant:"outline",children:a("Set role")})]}),o?(0,t.jsx)(z,{"data-testid":"ud-unban",disabled:m,onClick:B,size:"sm",type:"button",variant:"outline",children:a("Unban")}):(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-ban-reason",children:a("Ban reason (optional)")}),(0,t.jsx)(L,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:Z,value:I})]}),(0,t.jsxs)("div",{className:"flex w-24 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-ban-days",children:a("Days")}),(0,t.jsx)(L,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:Pe,type:"number",value:g})]}),(0,t.jsx)(z,{"data-testid":"ud-ban",disabled:m,onClick:Q,size:"sm",type:"button",variant:"destructive",children:a("Ban user")})]}),(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-password",children:a("New password")}),(0,t.jsx)(L,{"data-testid":"ud-password",id:"ud-password",onChange:J,type:"password",value:f})]}),(0,t.jsx)(z,{"data-testid":"ud-set-password",disabled:m||f==="",onClick:Y,size:"sm",type:"button",variant:"outline",children:a("Set password")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(z,{"data-testid":"ud-impersonate",disabled:m,onClick:Fe,size:"sm",type:"button",variant:"outline",children:a("Impersonate")}),(0,t.jsx)(z,{"data-testid":"ud-revoke-all",disabled:m,onClick:G,size:"sm",type:"button",variant:"outline",children:a("Revoke all sessions")}),F?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(z,{"data-testid":"ud-delete-confirm",disabled:m,onClick:De,size:"sm",type:"button",variant:"destructive",children:a("Confirm delete")}),(0,t.jsx)(z,{"data-testid":"ud-delete-cancel",onClick:Se,size:"sm",type:"button",variant:"ghost",children:a("Cancel")})]}):(0,t.jsx)(z,{"data-testid":"ud-delete",disabled:m,onClick:K,size:"sm",type:"button",variant:"destructive",children:a("Delete user")})]}),A!==null&&(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsx)(D,{htmlFor:"ud-token",children:a("Impersonation token")}),(0,t.jsx)(L,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:A})]})]})]}),(0,t.jsx)(dt,{busy:m,runAction:R,userId:s.id,version:S}),u.accounts&&(0,t.jsx)(ot,{busy:m,runAction:R,userId:s.id,version:S}),(u.twoFactor||u.passkey)&&(0,t.jsx)(ct,{busy:m,capabilities:u,runAction:R,userId:s.id,version:S}),(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Fields")}),(0,t.jsx)("dl",{className:"flex flex-col",children:X.map(([N,j])=>(0,t.jsxs)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsx)("dt",{className:"text-xs font-semibold text-muted-foreground",children:N}),(0,t.jsx)("dd",{className:"m-0 font-mono text-xs break-words",children:ht(N,j)})]},N))})]})]})},"mt"),ft=50,Rt=r(({pageSize:u=ft}={})=>{let e=O(),l=H(),[s,c]=(0,k.useState)(""),[a,o]=(0,k.useState)(""),i=Ge(s),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(!1),{capabilities:x}=st(),C=i.trim(),y=a.trim(),I=Ze(["lunora-auth-users",C,y,u],()=>e.listAuthUsers({filterField:y===""?void 0:"role",filterValue:y===""?void 0:y,limit:u,search:C===""?void 0:C}),{keepPreviousData:!0}),h=I.data?.rows??null,g=I.error,b=r(()=>{I.refetch()},"b");Je(()=>{I.refetch()},!0);let f=n===null?null:h?.find(d=>d.id===n)??null;return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(L,{"aria-label":l("Search users"),className:"w-56","data-testid":"us-search",onChange:r(d=>{c(d.target.value)},"onChange"),placeholder:l("Search by email or name\u2026"),value:s}),(0,t.jsx)(L,{"aria-label":l("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:r(d=>{o(d.target.value)},"onChange"),placeholder:l("Filter by role"),value:a}),(0,t.jsx)(z,{"data-testid":"us-new",onClick:r(()=>{S(!0)},"onClick"),size:"sm",type:"button",children:l("New user")})]}),g!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:g}),h!==null&&h.length===0&&(0,t.jsx)(We,{description:l("Users who sign up to your app will appear here."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"})}),testId:"us-empty",title:l("No users.")}),h!==null&&h.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"us-table",children:[(0,t.jsx)($e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:l("id")}),(0,t.jsx)(U,{children:l("email")}),(0,t.jsx)(U,{children:l("name")}),(0,t.jsx)(U,{children:l("role")}),(0,t.jsx)(U,{children:l("status")}),(0,t.jsx)(U,{children:l("verified")}),(0,t.jsx)(U,{children:l("created")}),(0,t.jsx)(U,{"aria-label":l("Actions")})]})}),(0,t.jsx)(_e,{children:h.map(d=>(0,t.jsxs)(q,{"data-testid":`us-row-${d.id}`,children:[(0,t.jsx)($,{className:"font-mono text-xs",children:d.id}),(0,t.jsx)($,{children:d.email??""}),(0,t.jsx)($,{children:d.name??""}),(0,t.jsx)($,{children:typeof d.role=="string"&&d.role!==""?(0,t.jsx)(P,{variant:"secondary",children:d.role}):""}),(0,t.jsx)($,{children:d.banned===!0?(0,t.jsx)(P,{variant:"destructive",children:l("Banned")}):(0,t.jsx)(P,{variant:"success",children:l("Active")})}),(0,t.jsx)($,{children:d.emailVerified===!0?(0,t.jsx)(P,{variant:"success",children:l("yes")}):(0,t.jsx)(P,{variant:"outline",children:l("no")})}),(0,t.jsx)($,{className:"text-muted-foreground tabular-nums",children:Ie(d.createdAt)}),(0,t.jsx)($,{children:(0,t.jsx)(z,{"data-testid":`us-manage-${d.id}`,onClick:r(()=>{m(d.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Manage")})})]},d.id))})]})})}),f!==null&&(0,t.jsx)(pt,{capabilities:x,onChanged:b,onClose:r(()=>{m(null)},"onClose"),user:f}),w&&(0,t.jsx)(nt,{onClose:r(()=>{S(!1)},"onClose"),onCreated:b})]})},"Et");export{Rt as UsersPanel};
@@ -1 +1 @@
1
- import{a as G}from"./chunk-EA2JKR5D.js";import{a as x}from"./chunk-IMOHEGMV.js";import{a as U}from"./chunk-IFLTA2OD.js";import{b as M}from"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import{P as O}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as h}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as w}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as E}from"./chunk-CXNZVJ3S.js";import{f as D}from"./chunk-JBIN7W2B.js";import"./chunk-FSRSK4LY.js";import{d as K,e as _,f as z,h as B,o as P,r as q}from"./chunk-Y4Q25F6X.js";import"./chunk-T2IE5GKA.js";import{a as s,d as J,e as ie,g as oe}from"./chunk-YKXDMIHQ.js";var i=J(ie(),1);var e=J(oe(),1);var de=s(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"oe"),le=s(r=>r===void 0||r.length===0?"()":`(${r.map(o=>`${o.name}${o.optional?"?":""}: ${de(o)}`).join(", ")})`,"ie"),ce=s(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"de"),ue=s(r=>{let o={};for(let a of r??[])a.optional||(o[a.name]=ce(a.kind));return JSON.stringify(o,void 0,2)},"le"),me=z(E.runAs),fe=10,pe=s(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"me"),Fe=s(({functions:r,runAsIdentity:o=!1}={})=>{let a=K(),u=D(),[H,Q]=(0,i.useState)(null),[k,V]=(0,i.useState)(null),g=r??H??[],[I,S]=(0,i.useState)(""),[m,b]=(0,i.useState)("{}"),[c,F]=(0,i.useState)(""),[f,W]=(0,i.useState)(""),[v,p]=(0,i.useState)("idle"),[X,y]=(0,i.useState)(void 0),[C,N]=(0,i.useState)(null),[$,Y]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(r!==void 0)return;let t=!1;return u.listFunctions().then(d=>(t||Q(d),d)).catch(d=>{t||V(B(d))}),()=>{t=!0}},[u,r]);let A=I===""?g[0]?.path??"":I,n=g.find(t=>t.path===A),Z=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:JSON.parse(m)}catch(l){p("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},R=c.trim()===""?{}:{shardKey:c.trim()},j=o?f.trim():"",L=s(l=>{Y(T=>[{argsText:m,at:Date.now(),id:(T[0]?.id??0)+1,kind:n.kind,path:n.path,shardKey:c,status:l},...T].slice(0,fe))},"$");p("running"),N(null);try{let l=j===""?await _(u,n.kind,d,t,R):await u.query(me,{args:t,functionPath:n.path,userId:j},R);M(c),y(l),p("success"),L("success")}catch(l){y(void 0),N(l.message),p("error"),L("error")}},"J"),ee=s(t=>{S(t.path),b(t.argsText),F(t.shardKey)},"M"),te=s(t=>{S(t.target.value)},"P"),re=s(t=>{b(t.target.value)},"z"),ae=s(t=>{W(t.target.value)},"q"),se=s(()=>{P(Z())},"H"),ne=s(()=>{b(ue(n?.args))},"V");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:k}),(0,e.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(x,{htmlFor:"function-select",children:a("Function")}),(0,e.jsx)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:A,children:g.map(t=>(0,e.jsxs)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path))}),n!==void 0&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"mr-1.5 font-medium",children:a("Signature")}),(0,e.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:le(n.args)})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)(x,{htmlFor:"args-input",children:a("Arguments")}),(0,e.jsx)(h,{"data-testid":"prefill-button",disabled:n===void 0,onClick:ne,size:"xs",type:"button",variant:"ghost",children:a("Prefill")})]}),(0,e.jsx)(G,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:m})]}),(0,e.jsx)(U,{onChange:F,testId:"shard-input",value:c}),o&&(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsx)(x,{htmlFor:"run-as-input",children:a("Run as identity (userId)")}),(0,e.jsx)(O,{"aria-label":a("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:ae,placeholder:a("Leave empty to run as admin"),value:f}),(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground",children:a("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(h,{"data-testid":"run-button",disabled:v==="running"||n===void 0,onClick:se,type:"button",children:a("Run")}),n!==void 0&&(0,e.jsx)(w,{variant:"outline",children:n.kind}),o&&f.trim()!==""&&(0,e.jsx)(w,{"data-testid":"run-as-badge",variant:"secondary",children:a("as {userId}",{userId:f.trim()})})]})]}),v==="error"&&C!==null&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:C}),v==="success"&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:pe(X)}),$.length>0&&(0,e.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:$.map((t,d)=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsx)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"})," ",(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]})," ",(0,e.jsx)("time",{className:"text-xs text-muted-foreground",children:q(t.at)})," ",(0,e.jsx)(h,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:s(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Load")})]},t.id))})]})},"Ae");export{Fe as FunctionRunner};
1
+ import{a as G}from"./chunk-EA2JKR5D.js";import{a as x}from"./chunk-IMOHEGMV.js";import{a as U}from"./chunk-IFLTA2OD.js";import{b as M}from"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import{P as O}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as h}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as w}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as E}from"./chunk-4ZEL6BYL.js";import{f as D}from"./chunk-XDT5DXOI.js";import"./chunk-FSRSK4LY.js";import{d as K,e as _,f as z,h as B,o as P,r as q}from"./chunk-Y4Q25F6X.js";import"./chunk-T2IE5GKA.js";import{a as s,d as J,e as ie,g as oe}from"./chunk-YKXDMIHQ.js";var i=J(ie(),1);var e=J(oe(),1);var de=s(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"oe"),le=s(r=>r===void 0||r.length===0?"()":`(${r.map(o=>`${o.name}${o.optional?"?":""}: ${de(o)}`).join(", ")})`,"ie"),ce=s(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"de"),ue=s(r=>{let o={};for(let a of r??[])a.optional||(o[a.name]=ce(a.kind));return JSON.stringify(o,void 0,2)},"le"),me=z(E.runAs),fe=10,pe=s(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"me"),Fe=s(({functions:r,runAsIdentity:o=!1}={})=>{let a=K(),u=D(),[H,Q]=(0,i.useState)(null),[k,V]=(0,i.useState)(null),g=r??H??[],[I,S]=(0,i.useState)(""),[m,b]=(0,i.useState)("{}"),[c,F]=(0,i.useState)(""),[f,W]=(0,i.useState)(""),[v,p]=(0,i.useState)("idle"),[X,y]=(0,i.useState)(void 0),[C,N]=(0,i.useState)(null),[$,Y]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(r!==void 0)return;let t=!1;return u.listFunctions().then(d=>(t||Q(d),d)).catch(d=>{t||V(B(d))}),()=>{t=!0}},[u,r]);let A=I===""?g[0]?.path??"":I,n=g.find(t=>t.path===A),Z=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:JSON.parse(m)}catch(l){p("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},R=c.trim()===""?{}:{shardKey:c.trim()},j=o?f.trim():"",L=s(l=>{Y(T=>[{argsText:m,at:Date.now(),id:(T[0]?.id??0)+1,kind:n.kind,path:n.path,shardKey:c,status:l},...T].slice(0,fe))},"$");p("running"),N(null);try{let l=j===""?await _(u,n.kind,d,t,R):await u.query(me,{args:t,functionPath:n.path,userId:j},R);M(c),y(l),p("success"),L("success")}catch(l){y(void 0),N(l.message),p("error"),L("error")}},"J"),ee=s(t=>{S(t.path),b(t.argsText),F(t.shardKey)},"M"),te=s(t=>{S(t.target.value)},"P"),re=s(t=>{b(t.target.value)},"z"),ae=s(t=>{W(t.target.value)},"q"),se=s(()=>{P(Z())},"H"),ne=s(()=>{b(ue(n?.args))},"V");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:k}),(0,e.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(x,{htmlFor:"function-select",children:a("Function")}),(0,e.jsx)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:A,children:g.map(t=>(0,e.jsxs)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path))}),n!==void 0&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"mr-1.5 font-medium",children:a("Signature")}),(0,e.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:le(n.args)})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)(x,{htmlFor:"args-input",children:a("Arguments")}),(0,e.jsx)(h,{"data-testid":"prefill-button",disabled:n===void 0,onClick:ne,size:"xs",type:"button",variant:"ghost",children:a("Prefill")})]}),(0,e.jsx)(G,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:m})]}),(0,e.jsx)(U,{onChange:F,testId:"shard-input",value:c}),o&&(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsx)(x,{htmlFor:"run-as-input",children:a("Run as identity (userId)")}),(0,e.jsx)(O,{"aria-label":a("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:ae,placeholder:a("Leave empty to run as admin"),value:f}),(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground",children:a("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(h,{"data-testid":"run-button",disabled:v==="running"||n===void 0,onClick:se,type:"button",children:a("Run")}),n!==void 0&&(0,e.jsx)(w,{variant:"outline",children:n.kind}),o&&f.trim()!==""&&(0,e.jsx)(w,{"data-testid":"run-as-badge",variant:"secondary",children:a("as {userId}",{userId:f.trim()})})]})]}),v==="error"&&C!==null&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:C}),v==="success"&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:pe(X)}),$.length>0&&(0,e.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:$.map((t,d)=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsx)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"})," ",(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]})," ",(0,e.jsx)("time",{className:"text-xs text-muted-foreground",children:q(t.at)})," ",(0,e.jsx)(h,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:s(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Load")})]},t.id))})]})},"Ae");export{Fe as FunctionRunner};
@@ -1 +1 @@
1
- import{a as q}from"./chunk-PKCC4J5W.js";import{a as k}from"./chunk-DEJLINCJ.js";import"./chunk-4GTO7FL5.js";import"./chunk-XSLMHPP2.js";import"./chunk-5JDWLCSH.js";import"./chunk-PYT4RZJH.js";import{a as A}from"./chunk-S3CRZLGS.js";import{a as $}from"./chunk-IFLTA2OD.js";import"./chunk-OGUKYRFM.js";import"./chunk-JVUZEYKQ.js";import"./chunk-OKG3HWSJ.js";import"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import"./chunk-5GFSKIB2.js";import{b as K}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as F}from"./chunk-JAZCU2PP.js";import"./chunk-ULIQFBZU.js";import"./chunk-OOESPRIZ.js";import"./chunk-35DM4JJG.js";import{a as T}from"./chunk-CXNZVJ3S.js";import{c as S}from"./chunk-ECQTVV2J.js";import"./chunk-JBIN7W2B.js";import"./chunk-FSRSK4LY.js";import{a as O}from"./chunk-FKVZRPV5.js";import{a as j,e as w}from"./chunk-WUWBZPUK.js";import{d as I,r as E}from"./chunk-Y4Q25F6X.js";import"./chunk-T2IE5GKA.js";import{a as p,d as C,f as D,g as H}from"./chunk-YKXDMIHQ.js";var M=C(D(),1);var m=C(H(),1);var L=p(s=>s.length===0?void 0:{max:Math.max(...s),mean:s.reduce((e,t)=>e+t,0)/s.length,min:Math.min(...s)},"F"),B=/^gen_ai\.evaluation\.(.+)\.score$/u,P=p(s=>{let e=[];for(let t of s)for(let n of t.spans)for(let[a,l]of Object.entries(n.attributes??{})){let o=B.exec(a);if(!o||typeof l!="number")continue;let i=o[1],c=n.attributes?.[`gen_ai.evaluation.${i}.label`];e.push({...typeof c=="string"?{label:c}:{},name:i,score:l,spanName:n.name,startTs:t.startTs+n.offsetMs,traceId:t.traceId})}return e.toSorted((t,n)=>n.startTs-t.startTs)},"q"),Q=p(s=>{let e=[];for(let t of s?.series??[]){let n=B.exec(t.name);n&&e.push({name:n[1],points:t.points})}return e},"D"),R=p((s,e)=>{let t=new Set([...s.map(a=>a.name),...e.map(a=>a.name)]),n=[];for(let a of t){let l=s.filter(r=>r.name===a),o=e.find(r=>r.name===a)?.points??[],i=o.at(-1)?.last??l[0]?.score,c=o.length>0?{max:Math.max(...o.map(r=>r.max)),mean:o.reduce((r,d)=>r+d.sum,0)/o.reduce((r,d)=>r+d.count,0),min:Math.min(...o.map(r=>r.min))}:L(l.map(r=>r.score));n.push({...i===void 0?{}:{latest:i},...c,name:a,points:o,runs:l})}return n.toSorted((a,l)=>a.name.localeCompare(l.name))},"H"),U=p(s=>Array.isArray(s?.traces)?s.traces:[],"L"),N=p(s=>s===void 0?"\u2014":s.toFixed(2),"y"),z=p(s=>{let e=(0,M.c)(34),{card:t,onOpenTrace:n}=s,a=I(),l;e[0]!==t.name?(l=(0,m.jsx)("h3",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"ev-name",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let o;e[2]!==t.latest?(o=N(t.latest),e[2]=t.latest,e[3]=o):o=e[3];let i;e[4]!==o?(i=(0,m.jsx)("span",{className:"font-mono text-lg text-foreground","data-testid":"ev-latest",children:o}),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==l||e[7]!==i?(c=(0,m.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=c):c=e[8];let r;e[9]!==t.max||e[10]!==t.mean||e[11]!==t.min||e[12]!==a?(r=a("min {min} \xB7 mean {mean} \xB7 max {max}",{max:N(t.max),mean:N(t.mean),min:N(t.min)}),e[9]=t.max,e[10]=t.mean,e[11]=t.min,e[12]=a,e[13]=r):r=e[13];let d;e[14]!==r?(d=(0,m.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"ev-summary",children:r}),e[14]=r,e[15]=d):d=e[15];let u;e[16]!==t.name||e[17]!==t.points||e[18]!==a?(u=t.points.length>1?(0,m.jsx)(q,{ariaLabel:a("Score trend for {name}",{name:t.name}),className:"h-10 w-full",series:t.points.map(G),testId:"ev-trend"}):(0,m.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ev-no-trend",children:a("No durable history yet \u2014 pass ctx.metrics to recordEvaluation to chart a trend.")}),e[16]=t.name,e[17]=t.points,e[18]=a,e[19]=u):u=e[19];let h;if(e[20]!==t.runs||e[21]!==n||e[22]!==a){let v;e[24]!==n||e[25]!==a?(v=p(f=>(0,m.jsxs)("div",{className:"flex items-center justify-between gap-2 font-mono text-xs","data-testid":"ev-run",children:[(0,m.jsxs)("span",{className:"truncate text-muted-foreground",children:[E(f.startTs)," \xB7 ",f.spanName]}),(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[f.label===void 0?null:(0,m.jsx)(K,{variant:"outline",children:f.label}),(0,m.jsx)("span",{className:"text-foreground",children:N(f.score)}),n===void 0?null:(0,m.jsx)("button",{className:"text-muted-foreground underline-offset-2 hover:underline",onClick:p(()=>{n(f.traceId)},"onClick"),title:a("Open the trace {trace}",{trace:f.traceId}),type:"button",children:f.traceId.slice(0,8)})]})]},`${f.traceId}:${f.spanName}`),"x"),e[24]=n,e[25]=a,e[26]=v):v=e[26],h=t.runs.slice(0,5).map(v),e[20]=t.runs,e[21]=n,e[22]=a,e[23]=h}else h=e[23];let x;e[27]!==h?(x=(0,m.jsx)("div",{className:"flex flex-col gap-1",children:h}),e[27]=h,e[28]=x):x=e[28];let g;return e[29]!==c||e[30]!==d||e[31]!==u||e[32]!==x?(g=(0,m.jsx)(j,{"data-testid":"ev-card",children:(0,m.jsxs)(w,{className:"flex flex-col gap-3 p-4",children:[c,d,u,x]})}),e[29]=c,e[30]=d,e[31]=u,e[32]=x,e[33]=g):g=e[33],g},"P"),oe=p(s=>{let e=(0,M.c)(19),{initialShardKey:t}=s,n=I(),{queryShardKey:a,setShardKey:l,shardKey:o}=A(t),i=k(a),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let r;e[1]!==a?(r={live:!0,shardKey:a},e[1]=a,e[2]=r):r=e[2];let{data:d,error:u}=S(T.getTraces,c,r),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let x;e[4]!==a?(x={live:!0,shardKey:a},e[4]=a,e[5]=x):x=e[5];let{data:g}=S(T.getMetricHistory,h,x),v;if(e[6]!==d||e[7]!==u||e[8]!==g||e[9]!==i||e[10]!==l||e[11]!==o||e[12]!==n){let f=R(P(U(d)),Q(g)),y;e[14]!==l||e[15]!==o?(y=(0,m.jsx)($,{onChange:l,testId:"ev-shard-input",value:o}),e[14]=l,e[15]=o,e[16]=y):y=e[16];let b;e[17]!==u?(b=u===null?null:(0,m.jsx)(F,{error:u,testId:"ev-error"}),e[17]=u,e[18]=b):b=e[18],v=(0,m.jsxs)("section",{className:"flex flex-col gap-4","data-testid":"ev-panel",children:[y,b,f.length===0?(0,m.jsx)(O,{description:n("Call recordEvaluation from a graded run and its score shows up here."),testId:"ev-empty",title:n("No evals recorded")}):(0,m.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:f.map(_=>(0,m.jsx)(z,{card:_,onOpenTrace:i},_.name))})]}),e[6]=d,e[7]=u,e[8]=g,e[9]=i,e[10]=l,e[11]=o,e[12]=n,e[13]=v}else v=e[13];return v},"re");function G(s){return s.last}p(G,"Q");export{oe as default};
1
+ import{a as q}from"./chunk-PKCC4J5W.js";import{a as k}from"./chunk-DEJLINCJ.js";import"./chunk-4GTO7FL5.js";import"./chunk-XSLMHPP2.js";import"./chunk-5JDWLCSH.js";import"./chunk-PYT4RZJH.js";import{a as A}from"./chunk-S3CRZLGS.js";import{a as $}from"./chunk-IFLTA2OD.js";import"./chunk-OGUKYRFM.js";import"./chunk-JVUZEYKQ.js";import"./chunk-OKG3HWSJ.js";import"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import"./chunk-5GFSKIB2.js";import{b as K}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as F}from"./chunk-W7E5WYFI.js";import"./chunk-ULIQFBZU.js";import"./chunk-WHWI6KXH.js";import"./chunk-35DM4JJG.js";import{a as T}from"./chunk-4ZEL6BYL.js";import{c as S}from"./chunk-L6KA7M4B.js";import"./chunk-XDT5DXOI.js";import"./chunk-FSRSK4LY.js";import{a as O}from"./chunk-FKVZRPV5.js";import{a as j,e as w}from"./chunk-WUWBZPUK.js";import{d as I,r as E}from"./chunk-Y4Q25F6X.js";import"./chunk-T2IE5GKA.js";import{a as p,d as C,f as D,g as H}from"./chunk-YKXDMIHQ.js";var M=C(D(),1);var m=C(H(),1);var L=p(s=>s.length===0?void 0:{max:Math.max(...s),mean:s.reduce((e,t)=>e+t,0)/s.length,min:Math.min(...s)},"F"),B=/^gen_ai\.evaluation\.(.+)\.score$/u,P=p(s=>{let e=[];for(let t of s)for(let n of t.spans)for(let[a,l]of Object.entries(n.attributes??{})){let o=B.exec(a);if(!o||typeof l!="number")continue;let i=o[1],c=n.attributes?.[`gen_ai.evaluation.${i}.label`];e.push({...typeof c=="string"?{label:c}:{},name:i,score:l,spanName:n.name,startTs:t.startTs+n.offsetMs,traceId:t.traceId})}return e.toSorted((t,n)=>n.startTs-t.startTs)},"q"),Q=p(s=>{let e=[];for(let t of s?.series??[]){let n=B.exec(t.name);n&&e.push({name:n[1],points:t.points})}return e},"D"),R=p((s,e)=>{let t=new Set([...s.map(a=>a.name),...e.map(a=>a.name)]),n=[];for(let a of t){let l=s.filter(r=>r.name===a),o=e.find(r=>r.name===a)?.points??[],i=o.at(-1)?.last??l[0]?.score,c=o.length>0?{max:Math.max(...o.map(r=>r.max)),mean:o.reduce((r,d)=>r+d.sum,0)/o.reduce((r,d)=>r+d.count,0),min:Math.min(...o.map(r=>r.min))}:L(l.map(r=>r.score));n.push({...i===void 0?{}:{latest:i},...c,name:a,points:o,runs:l})}return n.toSorted((a,l)=>a.name.localeCompare(l.name))},"H"),U=p(s=>Array.isArray(s?.traces)?s.traces:[],"L"),N=p(s=>s===void 0?"\u2014":s.toFixed(2),"y"),z=p(s=>{let e=(0,M.c)(34),{card:t,onOpenTrace:n}=s,a=I(),l;e[0]!==t.name?(l=(0,m.jsx)("h3",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"ev-name",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let o;e[2]!==t.latest?(o=N(t.latest),e[2]=t.latest,e[3]=o):o=e[3];let i;e[4]!==o?(i=(0,m.jsx)("span",{className:"font-mono text-lg text-foreground","data-testid":"ev-latest",children:o}),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==l||e[7]!==i?(c=(0,m.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=c):c=e[8];let r;e[9]!==t.max||e[10]!==t.mean||e[11]!==t.min||e[12]!==a?(r=a("min {min} \xB7 mean {mean} \xB7 max {max}",{max:N(t.max),mean:N(t.mean),min:N(t.min)}),e[9]=t.max,e[10]=t.mean,e[11]=t.min,e[12]=a,e[13]=r):r=e[13];let d;e[14]!==r?(d=(0,m.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"ev-summary",children:r}),e[14]=r,e[15]=d):d=e[15];let u;e[16]!==t.name||e[17]!==t.points||e[18]!==a?(u=t.points.length>1?(0,m.jsx)(q,{ariaLabel:a("Score trend for {name}",{name:t.name}),className:"h-10 w-full",series:t.points.map(G),testId:"ev-trend"}):(0,m.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ev-no-trend",children:a("No durable history yet \u2014 pass ctx.metrics to recordEvaluation to chart a trend.")}),e[16]=t.name,e[17]=t.points,e[18]=a,e[19]=u):u=e[19];let h;if(e[20]!==t.runs||e[21]!==n||e[22]!==a){let v;e[24]!==n||e[25]!==a?(v=p(f=>(0,m.jsxs)("div",{className:"flex items-center justify-between gap-2 font-mono text-xs","data-testid":"ev-run",children:[(0,m.jsxs)("span",{className:"truncate text-muted-foreground",children:[E(f.startTs)," \xB7 ",f.spanName]}),(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[f.label===void 0?null:(0,m.jsx)(K,{variant:"outline",children:f.label}),(0,m.jsx)("span",{className:"text-foreground",children:N(f.score)}),n===void 0?null:(0,m.jsx)("button",{className:"text-muted-foreground underline-offset-2 hover:underline",onClick:p(()=>{n(f.traceId)},"onClick"),title:a("Open the trace {trace}",{trace:f.traceId}),type:"button",children:f.traceId.slice(0,8)})]})]},`${f.traceId}:${f.spanName}`),"x"),e[24]=n,e[25]=a,e[26]=v):v=e[26],h=t.runs.slice(0,5).map(v),e[20]=t.runs,e[21]=n,e[22]=a,e[23]=h}else h=e[23];let x;e[27]!==h?(x=(0,m.jsx)("div",{className:"flex flex-col gap-1",children:h}),e[27]=h,e[28]=x):x=e[28];let g;return e[29]!==c||e[30]!==d||e[31]!==u||e[32]!==x?(g=(0,m.jsx)(j,{"data-testid":"ev-card",children:(0,m.jsxs)(w,{className:"flex flex-col gap-3 p-4",children:[c,d,u,x]})}),e[29]=c,e[30]=d,e[31]=u,e[32]=x,e[33]=g):g=e[33],g},"P"),oe=p(s=>{let e=(0,M.c)(19),{initialShardKey:t}=s,n=I(),{queryShardKey:a,setShardKey:l,shardKey:o}=A(t),i=k(a),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let r;e[1]!==a?(r={live:!0,shardKey:a},e[1]=a,e[2]=r):r=e[2];let{data:d,error:u}=S(T.getTraces,c,r),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let x;e[4]!==a?(x={live:!0,shardKey:a},e[4]=a,e[5]=x):x=e[5];let{data:g}=S(T.getMetricHistory,h,x),v;if(e[6]!==d||e[7]!==u||e[8]!==g||e[9]!==i||e[10]!==l||e[11]!==o||e[12]!==n){let f=R(P(U(d)),Q(g)),y;e[14]!==l||e[15]!==o?(y=(0,m.jsx)($,{onChange:l,testId:"ev-shard-input",value:o}),e[14]=l,e[15]=o,e[16]=y):y=e[16];let b;e[17]!==u?(b=u===null?null:(0,m.jsx)(F,{error:u,testId:"ev-error"}),e[17]=u,e[18]=b):b=e[18],v=(0,m.jsxs)("section",{className:"flex flex-col gap-4","data-testid":"ev-panel",children:[y,b,f.length===0?(0,m.jsx)(O,{description:n("Call recordEvaluation from a graded run and its score shows up here."),testId:"ev-empty",title:n("No evals recorded")}):(0,m.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:f.map(_=>(0,m.jsx)(z,{card:_,onOpenTrace:i},_.name))})]}),e[6]=d,e[7]=u,e[8]=g,e[9]=i,e[10]=l,e[11]=o,e[12]=n,e[13]=v}else v=e[13];return v},"re");function G(s){return s.last}p(G,"Q");export{oe as default};
@@ -1,4 +1,4 @@
1
- import{a as Yi,b as Ve,c as Ri,d as Je,e as Zi,f as xi,k as ji}from"./chunk-V36AL47B.js";import"./chunk-Q4CAKBWN.js";import"./chunk-FNGY5SUZ.js";import"./chunk-RLLKECZT.js";import"./chunk-7RIRJD2P.js";import"./chunk-C3TOZ4LG.js";import"./chunk-D27D4UUI.js";import{a as Ci}from"./chunk-QKEJLVC5.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import"./chunk-5WJXVZMZ.js";import"./chunk-PYT4RZJH.js";import"./chunk-K7AJEMKE.js";import"./chunk-JVUZEYKQ.js";import{a as Le}from"./chunk-OKG3HWSJ.js";import{P as Xi}from"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import{a as zd}from"./chunk-4L4WTGN5.js";import{a as Gi}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{b as Ke}from"./chunk-OOESPRIZ.js";import"./chunk-35DM4JJG.js";import"./chunk-CXNZVJ3S.js";import"./chunk-ECQTVV2J.js";import{a as Hi,e as qi}from"./chunk-JBIN7W2B.js";import"./chunk-FSRSK4LY.js";import"./chunk-FKVZRPV5.js";import"./chunk-WUWBZPUK.js";import{a as Qi,d as je,p as pi}from"./chunk-Y4Q25F6X.js";import{c as _i}from"./chunk-T2IE5GKA.js";import{a as c,b as vn,d as fu,e as Ni,f as Ad,g as Bi,i as xe}from"./chunk-YKXDMIHQ.js";var ri=vn(w=>{"use strict";function $e(l,t){var a=l.length;l.push(t);l:for(;0<a;){var u=a-1>>>1,n=l[u];if(0<dn(n,t))l[u]=t,l[a]=n,a=u;else break l}}c($e,"push");function wl(l){return l.length===0?null:l[0]}c(wl,"peek");function hn(l){if(l.length===0)return null;var t=l[0],a=l.pop();if(a!==t){l[0]=a;l:for(var u=0,n=l.length,e=n>>>1;u<e;){var f=2*(u+1)-1,i=l[f],m=f+1,y=l[m];if(0>dn(i,a))m<n&&0>dn(y,i)?(l[u]=y,l[m]=a,u=m):(l[u]=i,l[f]=a,u=f);else if(m<n&&0>dn(y,a))l[u]=y,l[m]=a,u=m;else break l}}return t}c(hn,"pop");function dn(l,t){var a=l.sortIndex-t.sortIndex;return a!==0?a:l.id-t.id}c(dn,"compare");w.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(Vi=performance,w.unstable_now=function(){return Vi.now()}):(We=Date,Li=We.now(),w.unstable_now=function(){return We.now()-Li});var Vi,We,Li,tt=[],Et=[],Td=1,Ql=null,Sl=3,ke=!1,iu=!1,mu=!1,re=!1,Wi=typeof setTimeout=="function"?setTimeout:null,wi=typeof clearTimeout=="function"?clearTimeout:null,Ki=typeof setImmediate<"u"?setImmediate:null;function yn(l){for(var t=wl(Et);t!==null;){if(t.callback===null)hn(Et);else if(t.startTime<=l)hn(Et),t.sortIndex=t.expirationTime,$e(tt,t);else break;t=wl(Et)}}c(yn,"advanceTimers");function Ie(l){if(mu=!1,yn(l),!iu)if(wl(tt)!==null)iu=!0,ga||(ga=!0,oa());else{var t=wl(Et);t!==null&&Pe(Ie,t.startTime-l)}}c(Ie,"handleTimeout");var ga=!1,vu=-1,Fi=5,$i=-1;function ki(){return re?!0:!(w.unstable_now()-$i<Fi)}c(ki,"shouldYieldToHost");function we(){if(re=!1,ga){var l=w.unstable_now();$i=l;var t=!0;try{l:{iu=!1,mu&&(mu=!1,wi(vu),vu=-1),ke=!0;var a=Sl;try{t:{for(yn(l),Ql=wl(tt);Ql!==null&&!(Ql.expirationTime>l&&ki());){var u=Ql.callback;if(typeof u=="function"){Ql.callback=null,Sl=Ql.priorityLevel;var n=u(Ql.expirationTime<=l);if(l=w.unstable_now(),typeof n=="function"){Ql.callback=n,yn(l),t=!0;break t}Ql===wl(tt)&&hn(tt),yn(l)}else hn(tt);Ql=wl(tt)}if(Ql!==null)t=!0;else{var e=wl(Et);e!==null&&Pe(Ie,e.startTime-l),t=!1}}break l}finally{Ql=null,Sl=a,ke=!1}t=void 0}}finally{t?oa():ga=!1}}}c(we,"performWorkUntilDeadline");var oa;typeof Ki=="function"?oa=c(function(){Ki(we)},"schedulePerformWorkUntilDeadline"):typeof MessageChannel<"u"?(Fe=new MessageChannel,Ji=Fe.port2,Fe.port1.onmessage=we,oa=c(function(){Ji.postMessage(null)},"schedulePerformWorkUntilDeadline")):oa=c(function(){Wi(we,0)},"schedulePerformWorkUntilDeadline");var Fe,Ji;function Pe(l,t){vu=Wi(function(){l(w.unstable_now())},t)}c(Pe,"requestHostTimeout");w.unstable_IdlePriority=5;w.unstable_ImmediatePriority=1;w.unstable_LowPriority=4;w.unstable_NormalPriority=3;w.unstable_Profiling=null;w.unstable_UserBlockingPriority=2;w.unstable_cancelCallback=function(l){l.callback=null};w.unstable_forceFrameRate=function(l){0>l||125<l?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Fi=0<l?Math.floor(1e3/l):5};w.unstable_getCurrentPriorityLevel=function(){return Sl};w.unstable_next=function(l){switch(Sl){case 1:case 2:case 3:var t=3;break;default:t=Sl}var a=Sl;Sl=t;try{return l()}finally{Sl=a}};w.unstable_requestPaint=function(){re=!0};w.unstable_runWithPriority=function(l,t){switch(l){case 1:case 2:case 3:case 4:case 5:break;default:l=3}var a=Sl;Sl=l;try{return t()}finally{Sl=a}};w.unstable_scheduleCallback=function(l,t,a){var u=w.unstable_now();switch(typeof a=="object"&&a!==null?(a=a.delay,a=typeof a=="number"&&0<a?u+a:u):a=u,l){case 1:var n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=a+n,l={id:Td++,callback:t,priorityLevel:l,startTime:a,expirationTime:n,sortIndex:-1},a>u?(l.sortIndex=a,$e(Et,l),wl(tt)===null&&l===wl(Et)&&(mu?(wi(vu),vu=-1):mu=!0,Pe(Ie,a-u))):(l.sortIndex=n,$e(tt,l),iu||ke||(iu=!0,ga||(ga=!0,oa()))),l};w.unstable_shouldYield=ki;w.unstable_wrapCallback=function(l){var t=Sl;return function(){var a=Sl;Sl=t;try{return l.apply(this,arguments)}finally{Sl=a}}}});var Pi=vn((e2,Ii)=>{"use strict";Ii.exports=ri()});var dd=vn(Re=>{"use strict";var el=Pi(),U1=Ni(),Ed=zd();function z(l){var t="https://react.dev/errors/"+l;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+l+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}c(z,"formatProdErrorMessage");function D1(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}c(D1,"isValidContainer");function ku(l){var t=l,a=l;if(l.alternate)for(;t.return;)t=t.return;else{l=t;do t=l,(t.flags&4098)!==0&&(a=t.return),l=t.return;while(l)}return t.tag===3?a:null}c(ku,"getNearestMountedFiber");function _1(l){if(l.tag===13){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}c(_1,"getSuspenseInstanceFromFiber");function N1(l){if(l.tag===31){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}c(N1,"getActivityInstanceFromFiber");function l0(l){if(ku(l)!==l)throw Error(z(188))}c(l0,"assertIsMounted");function Md(l){var t=l.alternate;if(!t){if(t=ku(l),t===null)throw Error(z(188));return t!==l?null:l}for(var a=l,u=t;;){var n=a.return;if(n===null)break;var e=n.alternate;if(e===null){if(u=n.return,u!==null){a=u;continue}break}if(n.child===e.child){for(e=n.child;e;){if(e===a)return l0(n),l;if(e===u)return l0(n),t;e=e.sibling}throw Error(z(188))}if(a.return!==u.return)a=n,u=e;else{for(var f=!1,i=n.child;i;){if(i===a){f=!0,a=n,u=e;break}if(i===u){f=!0,u=n,a=e;break}i=i.sibling}if(!f){for(i=e.child;i;){if(i===a){f=!0,a=e,u=n;break}if(i===u){f=!0,u=e,a=n;break}i=i.sibling}if(!f)throw Error(z(189))}}if(a.alternate!==u)throw Error(z(190))}if(a.tag!==3)throw Error(z(188));return a.stateNode.current===a?l:t}c(Md,"findCurrentFiberUsingSlowPath");function H1(l){var t=l.tag;if(t===5||t===26||t===27||t===6)return l;for(l=l.child;l!==null;){if(t=H1(l),t!==null)return t;l=l.sibling}return null}c(H1,"findCurrentHostFiberImpl");var W=Object.assign,Od=Symbol.for("react.element"),Sn=Symbol.for("react.transitional.element"),su=Symbol.for("react.portal"),Ea=Symbol.for("react.fragment"),B1=Symbol.for("react.strict_mode"),Qc=Symbol.for("react.profiler"),q1=Symbol.for("react.consumer"),mt=Symbol.for("react.context"),Hf=Symbol.for("react.forward_ref"),Xc=Symbol.for("react.suspense"),Gc=Symbol.for("react.suspense_list"),Bf=Symbol.for("react.memo"),Mt=Symbol.for("react.lazy"),pc=Symbol.for("react.activity"),Ud=Symbol.for("react.memo_cache_sentinel"),t0=Symbol.iterator;function du(l){return l===null||typeof l!="object"?null:(l=t0&&l[t0]||l["@@iterator"],typeof l=="function"?l:null)}c(du,"getIteratorFn");var Dd=Symbol.for("react.client.reference");function Cc(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===Dd?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case Ea:return"Fragment";case Qc:return"Profiler";case B1:return"StrictMode";case Xc:return"Suspense";case Gc:return"SuspenseList";case pc:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case su:return"Portal";case mt:return l.displayName||"Context";case q1:return(l._context.displayName||"Context")+".Consumer";case Hf:var t=l.render;return l=l.displayName,l||(l=t.displayName||t.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case Bf:return t=l.displayName||null,t!==null?t:Cc(l.type)||"Memo";case Mt:t=l._payload,l=l._init;try{return Cc(l(t))}catch{}}return null}c(Cc,"getComponentNameFromType");var zu=Array.isArray,_=U1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,p=Ed.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,la={pending:!1,data:null,method:null,action:null},Rc=[],Ma=-1;function Il(l){return{current:l}}c(Il,"createCursor");function il(l){0>Ma||(l.current=Rc[Ma],Rc[Ma]=null,Ma--)}c(il,"pop");function L(l,t){Ma++,Rc[Ma]=l.current,l.current=t}c(L,"push");var rl=Il(null),pu=Il(null),Xt=Il(null),wn=Il(null);function Fn(l,t){switch(L(Xt,t),L(pu,l),L(rl,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?i1(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=i1(t),l=rv(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}il(rl),L(rl,l)}c(Fn,"pushHostContainer");function ja(){il(rl),il(pu),il(Xt)}c(ja,"popHostContainer");function Zc(l){l.memoizedState!==null&&L(wn,l);var t=rl.current,a=rv(t,l.type);t!==a&&(L(pu,l),L(rl,a))}c(Zc,"pushHostContext");function $n(l){pu.current===l&&(il(rl),il(pu)),wn.current===l&&(il(wn),wu._currentValue=la)}c($n,"popHostContext");var lc,a0;function kt(l){if(lc===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);lc=t&&t[1]||"",a0=-1<a.stack.indexOf(`
1
+ import{a as Yi,b as Ve,c as Ri,d as Je,e as Zi,f as xi,k as ji}from"./chunk-BDZFZT2N.js";import"./chunk-Q4CAKBWN.js";import"./chunk-37VWQZEF.js";import"./chunk-RLLKECZT.js";import"./chunk-7RIRJD2P.js";import"./chunk-C3TOZ4LG.js";import"./chunk-D27D4UUI.js";import{a as Ci}from"./chunk-QKEJLVC5.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import"./chunk-5WJXVZMZ.js";import"./chunk-PYT4RZJH.js";import"./chunk-K7AJEMKE.js";import"./chunk-JVUZEYKQ.js";import{a as Le}from"./chunk-OKG3HWSJ.js";import{P as Xi}from"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import{a as zd}from"./chunk-4L4WTGN5.js";import{a as Gi}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{b as Ke}from"./chunk-WHWI6KXH.js";import"./chunk-35DM4JJG.js";import"./chunk-4ZEL6BYL.js";import"./chunk-L6KA7M4B.js";import{a as Hi,e as qi}from"./chunk-XDT5DXOI.js";import"./chunk-FSRSK4LY.js";import"./chunk-FKVZRPV5.js";import"./chunk-WUWBZPUK.js";import{a as Qi,d as je,p as pi}from"./chunk-Y4Q25F6X.js";import{c as _i}from"./chunk-T2IE5GKA.js";import{a as c,b as vn,d as fu,e as Ni,f as Ad,g as Bi,i as xe}from"./chunk-YKXDMIHQ.js";var ri=vn(w=>{"use strict";function $e(l,t){var a=l.length;l.push(t);l:for(;0<a;){var u=a-1>>>1,n=l[u];if(0<dn(n,t))l[u]=t,l[a]=n,a=u;else break l}}c($e,"push");function wl(l){return l.length===0?null:l[0]}c(wl,"peek");function hn(l){if(l.length===0)return null;var t=l[0],a=l.pop();if(a!==t){l[0]=a;l:for(var u=0,n=l.length,e=n>>>1;u<e;){var f=2*(u+1)-1,i=l[f],m=f+1,y=l[m];if(0>dn(i,a))m<n&&0>dn(y,i)?(l[u]=y,l[m]=a,u=m):(l[u]=i,l[f]=a,u=f);else if(m<n&&0>dn(y,a))l[u]=y,l[m]=a,u=m;else break l}}return t}c(hn,"pop");function dn(l,t){var a=l.sortIndex-t.sortIndex;return a!==0?a:l.id-t.id}c(dn,"compare");w.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(Vi=performance,w.unstable_now=function(){return Vi.now()}):(We=Date,Li=We.now(),w.unstable_now=function(){return We.now()-Li});var Vi,We,Li,tt=[],Et=[],Td=1,Ql=null,Sl=3,ke=!1,iu=!1,mu=!1,re=!1,Wi=typeof setTimeout=="function"?setTimeout:null,wi=typeof clearTimeout=="function"?clearTimeout:null,Ki=typeof setImmediate<"u"?setImmediate:null;function yn(l){for(var t=wl(Et);t!==null;){if(t.callback===null)hn(Et);else if(t.startTime<=l)hn(Et),t.sortIndex=t.expirationTime,$e(tt,t);else break;t=wl(Et)}}c(yn,"advanceTimers");function Ie(l){if(mu=!1,yn(l),!iu)if(wl(tt)!==null)iu=!0,ga||(ga=!0,oa());else{var t=wl(Et);t!==null&&Pe(Ie,t.startTime-l)}}c(Ie,"handleTimeout");var ga=!1,vu=-1,Fi=5,$i=-1;function ki(){return re?!0:!(w.unstable_now()-$i<Fi)}c(ki,"shouldYieldToHost");function we(){if(re=!1,ga){var l=w.unstable_now();$i=l;var t=!0;try{l:{iu=!1,mu&&(mu=!1,wi(vu),vu=-1),ke=!0;var a=Sl;try{t:{for(yn(l),Ql=wl(tt);Ql!==null&&!(Ql.expirationTime>l&&ki());){var u=Ql.callback;if(typeof u=="function"){Ql.callback=null,Sl=Ql.priorityLevel;var n=u(Ql.expirationTime<=l);if(l=w.unstable_now(),typeof n=="function"){Ql.callback=n,yn(l),t=!0;break t}Ql===wl(tt)&&hn(tt),yn(l)}else hn(tt);Ql=wl(tt)}if(Ql!==null)t=!0;else{var e=wl(Et);e!==null&&Pe(Ie,e.startTime-l),t=!1}}break l}finally{Ql=null,Sl=a,ke=!1}t=void 0}}finally{t?oa():ga=!1}}}c(we,"performWorkUntilDeadline");var oa;typeof Ki=="function"?oa=c(function(){Ki(we)},"schedulePerformWorkUntilDeadline"):typeof MessageChannel<"u"?(Fe=new MessageChannel,Ji=Fe.port2,Fe.port1.onmessage=we,oa=c(function(){Ji.postMessage(null)},"schedulePerformWorkUntilDeadline")):oa=c(function(){Wi(we,0)},"schedulePerformWorkUntilDeadline");var Fe,Ji;function Pe(l,t){vu=Wi(function(){l(w.unstable_now())},t)}c(Pe,"requestHostTimeout");w.unstable_IdlePriority=5;w.unstable_ImmediatePriority=1;w.unstable_LowPriority=4;w.unstable_NormalPriority=3;w.unstable_Profiling=null;w.unstable_UserBlockingPriority=2;w.unstable_cancelCallback=function(l){l.callback=null};w.unstable_forceFrameRate=function(l){0>l||125<l?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Fi=0<l?Math.floor(1e3/l):5};w.unstable_getCurrentPriorityLevel=function(){return Sl};w.unstable_next=function(l){switch(Sl){case 1:case 2:case 3:var t=3;break;default:t=Sl}var a=Sl;Sl=t;try{return l()}finally{Sl=a}};w.unstable_requestPaint=function(){re=!0};w.unstable_runWithPriority=function(l,t){switch(l){case 1:case 2:case 3:case 4:case 5:break;default:l=3}var a=Sl;Sl=l;try{return t()}finally{Sl=a}};w.unstable_scheduleCallback=function(l,t,a){var u=w.unstable_now();switch(typeof a=="object"&&a!==null?(a=a.delay,a=typeof a=="number"&&0<a?u+a:u):a=u,l){case 1:var n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=a+n,l={id:Td++,callback:t,priorityLevel:l,startTime:a,expirationTime:n,sortIndex:-1},a>u?(l.sortIndex=a,$e(Et,l),wl(tt)===null&&l===wl(Et)&&(mu?(wi(vu),vu=-1):mu=!0,Pe(Ie,a-u))):(l.sortIndex=n,$e(tt,l),iu||ke||(iu=!0,ga||(ga=!0,oa()))),l};w.unstable_shouldYield=ki;w.unstable_wrapCallback=function(l){var t=Sl;return function(){var a=Sl;Sl=t;try{return l.apply(this,arguments)}finally{Sl=a}}}});var Pi=vn((e2,Ii)=>{"use strict";Ii.exports=ri()});var dd=vn(Re=>{"use strict";var el=Pi(),U1=Ni(),Ed=zd();function z(l){var t="https://react.dev/errors/"+l;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+l+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}c(z,"formatProdErrorMessage");function D1(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}c(D1,"isValidContainer");function ku(l){var t=l,a=l;if(l.alternate)for(;t.return;)t=t.return;else{l=t;do t=l,(t.flags&4098)!==0&&(a=t.return),l=t.return;while(l)}return t.tag===3?a:null}c(ku,"getNearestMountedFiber");function _1(l){if(l.tag===13){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}c(_1,"getSuspenseInstanceFromFiber");function N1(l){if(l.tag===31){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}c(N1,"getActivityInstanceFromFiber");function l0(l){if(ku(l)!==l)throw Error(z(188))}c(l0,"assertIsMounted");function Md(l){var t=l.alternate;if(!t){if(t=ku(l),t===null)throw Error(z(188));return t!==l?null:l}for(var a=l,u=t;;){var n=a.return;if(n===null)break;var e=n.alternate;if(e===null){if(u=n.return,u!==null){a=u;continue}break}if(n.child===e.child){for(e=n.child;e;){if(e===a)return l0(n),l;if(e===u)return l0(n),t;e=e.sibling}throw Error(z(188))}if(a.return!==u.return)a=n,u=e;else{for(var f=!1,i=n.child;i;){if(i===a){f=!0,a=n,u=e;break}if(i===u){f=!0,u=n,a=e;break}i=i.sibling}if(!f){for(i=e.child;i;){if(i===a){f=!0,a=e,u=n;break}if(i===u){f=!0,u=e,a=n;break}i=i.sibling}if(!f)throw Error(z(189))}}if(a.alternate!==u)throw Error(z(190))}if(a.tag!==3)throw Error(z(188));return a.stateNode.current===a?l:t}c(Md,"findCurrentFiberUsingSlowPath");function H1(l){var t=l.tag;if(t===5||t===26||t===27||t===6)return l;for(l=l.child;l!==null;){if(t=H1(l),t!==null)return t;l=l.sibling}return null}c(H1,"findCurrentHostFiberImpl");var W=Object.assign,Od=Symbol.for("react.element"),Sn=Symbol.for("react.transitional.element"),su=Symbol.for("react.portal"),Ea=Symbol.for("react.fragment"),B1=Symbol.for("react.strict_mode"),Qc=Symbol.for("react.profiler"),q1=Symbol.for("react.consumer"),mt=Symbol.for("react.context"),Hf=Symbol.for("react.forward_ref"),Xc=Symbol.for("react.suspense"),Gc=Symbol.for("react.suspense_list"),Bf=Symbol.for("react.memo"),Mt=Symbol.for("react.lazy"),pc=Symbol.for("react.activity"),Ud=Symbol.for("react.memo_cache_sentinel"),t0=Symbol.iterator;function du(l){return l===null||typeof l!="object"?null:(l=t0&&l[t0]||l["@@iterator"],typeof l=="function"?l:null)}c(du,"getIteratorFn");var Dd=Symbol.for("react.client.reference");function Cc(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===Dd?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case Ea:return"Fragment";case Qc:return"Profiler";case B1:return"StrictMode";case Xc:return"Suspense";case Gc:return"SuspenseList";case pc:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case su:return"Portal";case mt:return l.displayName||"Context";case q1:return(l._context.displayName||"Context")+".Consumer";case Hf:var t=l.render;return l=l.displayName,l||(l=t.displayName||t.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case Bf:return t=l.displayName||null,t!==null?t:Cc(l.type)||"Memo";case Mt:t=l._payload,l=l._init;try{return Cc(l(t))}catch{}}return null}c(Cc,"getComponentNameFromType");var zu=Array.isArray,_=U1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,p=Ed.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,la={pending:!1,data:null,method:null,action:null},Rc=[],Ma=-1;function Il(l){return{current:l}}c(Il,"createCursor");function il(l){0>Ma||(l.current=Rc[Ma],Rc[Ma]=null,Ma--)}c(il,"pop");function L(l,t){Ma++,Rc[Ma]=l.current,l.current=t}c(L,"push");var rl=Il(null),pu=Il(null),Xt=Il(null),wn=Il(null);function Fn(l,t){switch(L(Xt,t),L(pu,l),L(rl,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?i1(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=i1(t),l=rv(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}il(rl),L(rl,l)}c(Fn,"pushHostContainer");function ja(){il(rl),il(pu),il(Xt)}c(ja,"popHostContainer");function Zc(l){l.memoizedState!==null&&L(wn,l);var t=rl.current,a=rv(t,l.type);t!==a&&(L(pu,l),L(rl,a))}c(Zc,"pushHostContext");function $n(l){pu.current===l&&(il(rl),il(pu)),wn.current===l&&(il(wn),wu._currentValue=la)}c($n,"popHostContext");var lc,a0;function kt(l){if(lc===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);lc=t&&t[1]||"",a0=-1<a.stack.indexOf(`
2
2
  at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
3
3
  `+lc+l+a0}c(kt,"describeBuiltInComponentFrame");var tc=!1;function ac(l,t){if(!l||tc)return"";tc=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:c(function(){try{if(t){var b=c(function(){throw Error()},"Fake");if(Object.defineProperty(b.prototype,"props",{set:c(function(){throw Error()},"set")}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(b,[])}catch(o){var S=o}Reflect.construct(l,[],b)}else{try{b.call()}catch(o){S=o}l.call(b.prototype)}}else{try{throw Error()}catch(o){S=o}(b=l())&&typeof b.catch=="function"&&b.catch(function(){})}}catch(o){if(o&&S&&typeof o.stack=="string")return[o.stack,S.stack]}return[null,null]},"DetermineComponentFrameRoot")};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var e=u.DetermineComponentFrameRoot(),f=e[0],i=e[1];if(f&&i){var m=f.split(`
4
4
  `),y=i.split(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/studio",
3
- "version": "1.0.0-alpha.141",
3
+ "version": "1.0.0-alpha.142",
4
4
  "description": "The Lunora Studio: a local admin UI for your schema, data, logs, and advisors",
5
5
  "keywords": [
6
6
  "admin-ui",
@@ -58,11 +58,11 @@
58
58
  "@hugeicons/react": "^1.1.9",
59
59
  "@lingui/core": "^6.6.0",
60
60
  "@lingui/message-utils": "^6.6.0",
61
- "@lunora/advisor": "1.0.0-alpha.101",
62
- "@lunora/bindings": "1.0.0-alpha.43",
63
- "@lunora/client": "1.0.0-alpha.67",
64
- "@lunora/errors": "1.0.0-alpha.26",
65
- "@lunora/react": "1.0.0-alpha.72",
61
+ "@lunora/advisor": "1.0.0-alpha.102",
62
+ "@lunora/bindings": "1.0.0-alpha.44",
63
+ "@lunora/client": "1.0.0-alpha.68",
64
+ "@lunora/errors": "1.0.0-alpha.27",
65
+ "@lunora/react": "1.0.0-alpha.73",
66
66
  "@tanstack/react-query": "^5.101.4",
67
67
  "@tanstack/react-router": "^1.170.25",
68
68
  "@tanstack/react-table": "^8.21.3",
@@ -1,4 +0,0 @@
1
- import{c as L}from"react/compiler-runtime";import{useLunora as lt}from"@lunora/react";import{useState as $,useEffect as Fe,useMemo as ht,useRef as Qe,useCallback as ot}from"react";import{ShardInput as xn}from"./ShardInput-C6mjgAh4.mjs";import{u as et}from"./use-admin-query-Cbj2GuHu.mjs";import{ADMIN_FUNCTIONS as te}from"./ADMIN_FUNCTIONS-B6z7VLYt.mjs";import{b as Ft}from"./browser-storage-BH1MxLZs.mjs";import{f as ie,h as Be,j as vn,c as Se,d as he,i as wn}from"./internal-CwaF9YNk.mjs";import{m as yn,c as Lt,d as ut,G as Cn,a as Sn,u as ft,b as Nn,T as kn,D as Tn}from"./table-list-sidebar-BxZm3sBJ.mjs";import{u as En}from"./use-sql-assistant-CFRzdA9E.mjs";import{M as wt}from"./modal-shell-CDztwLnv.mjs";import{useT as ne}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{jsxs as T,jsx as u,Fragment as Ue}from"react/jsx-runtime";import{ConfirmButton as kt}from"./ConfirmButton-DU4p72Er.mjs";import{E as _n}from"./empty-state-D7jEML_T.mjs";import{C as xt,a as Me}from"./control-button-BOZ5K-FC.mjs";import{useReactTable as Rn,getSortedRowModel as $n,getCoreRowModel as Dn,flexRender as In}from"@tanstack/react-table";import{useVirtualizer as Mn}from"@tanstack/react-virtual";import{C as yt}from"./checkbox-CnS9cyCz.mjs";import{c as st}from"./utils-bhneXptQ.mjs";import{f as An}from"./virtual-rect-D_j7aLxX.mjs";import{C as mt,G as Pn,T as On}from"./data-grid-BqNXJ9PF.mjs";import{DataFilters as Fn,toFilterClauses as Ve}from"./DataFilters-3nbW0uax.mjs";import{G as Ln,C as Vn}from"./grid-features-D8w5isjt.mjs";import{e as Bn,a as zn,i as jn,d as Gn}from"./wire-codec-Dl3VeNrd.mjs";import Tt from"./useDebounced-DVeQ5-oW.mjs";import{r as qn,l as Jn}from"./shard-history-CaO3C4KQ.mjs";const Kn=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,references:o.ref,table:e}))}))}),Wn=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 i=t.references,l=`${i}\0${o.name}\0${t.field}`;if(n.has(l))continue;n.add(l);const r=e.get(i)??[];r.push({...t,table:o.name}),e.set(i,r)}return e},Hn=(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 i of t.children)o.push(i)}return n},Et=(s,e)=>{const n=[];for(const[o,t]of Object.entries(e))for(const i of t)i.ref===s&&n.push({column:i.name,table:o});return n.sort((o,t)=>o.table.localeCompare(t.table)||o.column.localeCompare(t.column)),n},Ct=s=>`${s.table}.${s.column}`,_t=6,tt=100,Un=s=>({paddingLeft:s*16}),Qn=s=>{const e=L(2),{table:n}=s,o=`cascade-restrict-${n}`;let t;return e[0]!==o?(t=u("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},Yn=s=>{const e=L(2),{table:n}=s,o=`cascade-cascade-${n}`;let t;return e[0]!==o?(t=u("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},Xn=s=>{const e=L(2),{table:n}=s,o=`cascade-undeclared-${n}`;let t;return e[0]!==o?(t=u("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},Zn=s=>s.relation===void 0||s.relation.onDelete==="cascade"?u(Yn,{table:s.table}):s.isRestrict?u(Qn,{table:s.table}):u(Xn,{table:s.table}),Vt=s=>{const e=L(35),{depth:n,node:o}=s,t=`cascade-row-${o.table}`;let i;e[0]!==n?(i=Un(n),e[0]=n,e[1]=i):i=e[1];let l;e[2]!==n?(l=n>0&&u("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=u("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&&T("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 c;e[9]!==o.rowCount?(c=o.rowCount.toString(),e[9]=o.rowCount,e[10]=c):c=e[10];let g;e[11]!==c?(g=T("span",{className:"text-muted-foreground",children:["(",c," rows)"]}),e[11]=c,e[12]=g):g=e[12];let f;e[13]!==o?(f=Zn(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&&T("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 m;e[18]!==t||e[19]!==i||e[20]!==l||e[21]!==r||e[22]!==a||e[23]!==g||e[24]!==f||e[25]!==p?(m=T("li",{className:"flex flex-wrap items-center gap-1.5 py-1 font-mono text-xs","data-testid":t,style:i,children:[l,r,a,g,f,p]}),e[18]=t,e[19]=i,e[20]=l,e[21]=r,e[22]=a,e[23]=g,e[24]=f,e[25]=p,e[26]=m):m=e[26];let d;if(e[27]!==n||e[28]!==o.children){let h;e[30]!==n?(h=(v,x)=>u(Vt,{depth:n+1,node:v},`${v.table}-${v.relation?.field??"root"}-${x.toString()}`),e[30]=n,e[31]=h):h=e[31],d=o.children.map(h),e[27]=n,e[28]=o.children,e[29]=d}else d=e[29];let b;return e[32]!==m||e[33]!==d?(b=T(Ue,{children:[m,d]}),e[32]=m,e[33]=d,e[34]=b):b=e[34],b},eo=s=>{const e=s._id??s.id??s.__id__??"";return typeof e=="string"?e:typeof e=="number"?e.toString():""},to=async(s,e,n,o)=>{try{const t=await o(s,e,n),i=t.rows.flatMap(a=>eo(a)||[]).slice(0,tt),l=t.total??0;return{capNote:l>tt?`showing first ${tt.toString()} of ${l.toString()}`:void 0,rowCount:l,rowIds:i}}catch{return{capNote:"count unavailable",rowCount:0,rowIds:[]}}},Bt=async(s,e,n,o,t,i,l)=>{const{capNote:r,rowCount:a,rowIds:c}=n===void 0?{capNote:void 0,rowCount:1,rowIds:[e]}:await to(s,n.field,e,l),g=n?.onDelete==="restrict",f=[],p=`${s}:${e}`,m=i>=_t;if(!t.has(p)&&!m){t.add(p);const b=o.get(s)??[];for(const h of b)for(const v of c.slice(0,10)){const x=await Bt(h.table,v,h,o,t,i+1,l);(x.rowCount>0||i===0)&&f.push(x)}t.delete(p)}let d=r;if(m){const b=`depth capped at ${_t.toString()}`;d=r===void 0?b:`${r}; ${b}`}return{capNote:d,children:f,isRestrict:g,relation:n,rowCount:a,rowIds:c,table:s}},no=({onClose:s,onConfirm:e,readPage:n,rowId:o,schema:t,table:i})=>{const l=ne(),[r,a]=$(!0),[c,g]=$(null),[f,p]=$(null);Fe(()=>{let b=!1;return ie((async()=>{try{a(!0),p(null);const v=Wn(t);if(!((v.get(i)??[]).length>0)){b||(g({capNote:void 0,children:[],isRestrict:!1,relation:void 0,rowCount:1,rowIds:[o],table:i}),a(!1));return}const w=await Bt(i,o,void 0,v,new Set,0,n);b||(g(w),a(!1))}catch(v){b||(p(v.message),a(!1))}})()),()=>{b=!0}},[o,i]);const m=c!==null&&Hn(c,b=>b.isRestrict).length>0,d=()=>{e(),s()};return T(wt,{label:"Cascade impact preview",onClose:s,panelTestId:"cascade-panel",testId:"cascade-overlay",variant:"dialog",children:[T("div",{className:"flex items-start justify-between",children:[T("div",{className:"flex flex-col gap-0.5",children:[u("h3",{className:"text-base text-foreground","data-testid":"cascade-title",children:l("Cascade impact")}),u("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-desc",children:l("Delete preview — rows that would cascade or be blocked")})]}),u("button",{className:"text-xs text-muted-foreground hover:text-foreground","data-testid":"cascade-close",onClick:s,type:"button",children:l("Close")})]}),r&&u("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-loading",children:l("Loading…")}),f!==null&&u("p",{className:"text-xs text-destructive","data-testid":"cascade-error",role:"alert",children:f}),!r&&c!==null&&u("ul",{className:"flex flex-col","data-testid":"cascade-tree",children:u(Vt,{depth:0,node:c})}),!r&&c!==null&&c.children.length===0&&u("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-no-impact",children:l("No related rows found.")}),m&&u("p",{className:"text-sm font-medium text-destructive","data-testid":"cascade-blocker-warning",role:"alert",children:l("Restrict relations will block this delete.")}),T("div",{className:"flex justify-end gap-2",children:[u("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")}),u("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:d,type:"button",children:l("Delete")})]})]})},oo=(s,e,n,o,t=300)=>{if(o<=0)return{ids:new Set(s.map(f=>f.id)),leadPx:0,tailPx:0};const i=n-t,l=n+o+t,r=new Set;let a=0,c=0,g=0;for(const f of s){const p=f.getSize(),m=e.has(f.id),d=a+p>i&&a<l;m||d?r.add(f.id):a<i?c+=p:g+=p,a+=p}return{ids:r,leadPx:c,tailPx:g}},so=(s,e)=>{const n=new Map;let o=0;for(const t of s)e.has(t.id)&&(n.set(t.id,o),o+=t.getSize());return n},lo=()=>{const s=L(11);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={},s[0]=e):e=s[0];const[n,o]=$(e);let t;s[1]===Symbol.for("react.memo_cache_sentinel")?(t=(m,d,b)=>{o(h=>({...h,[m]:{...h[m],[d]:b}}))},s[1]=t):t=s[1];const i=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]!==n?(a=(m,d)=>{const b=n[m];return b!==void 0&&d in b?{value:b[d]}:void 0},s[3]=n,s[4]=a):a=s[4];const c=a;let g;s[5]!==n?(g=Object.values(n).reduce(ao,0),s[5]=n,s[6]=g):g=s[6];const f=g;let p;return s[7]!==f||s[8]!==n||s[9]!==c?(p={clear:r,count:f,stage:i,staged:n,stagedValue:c},s[7]=f,s[8]=n,s[9]=c,s[10]=p):p=s[10],p},zt=(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},ro=s=>{const e=L(29),{changes:n,committing:o,onCommit:t,onDiscard:i}=s,l=ne();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=u("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 c;e[5]!==o||e[6]!==l?(c=l(o?"Committing…":"Commit"),e[5]=o,e[6]=l,e[7]=c):c=e[7];let g;e[8]!==o||e[9]!==t||e[10]!==c?(g=u("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:c}),e[8]=o,e[9]=t,e[10]=c,e[11]=g):g=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]!==i||e[16]!==f?(p=u("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:i,type:"button",children:f}),e[14]=o,e[15]=i,e[16]=f,e[17]=p):p=e[17];let m;e[18]!==a||e[19]!==g||e[20]!==p?(m=T("div",{className:"flex flex-wrap items-center gap-2",children:[a,g,p]}),e[18]=a,e[19]=g,e[20]=p,e[21]=m):m=e[21];let d;e[22]!==n?(d=n.map(io),e[22]=n,e[23]=d):d=e[23];let b;e[24]!==d?(b=u("ul",{className:"flex flex-col gap-1","data-testid":"db-staged-list",children:d}),e[24]=d,e[25]=b):b=e[25];let h;return e[26]!==m||e[27]!==b?(h=T("div",{className:"flex flex-col gap-2 border border-warning/40 bg-warning/5 p-3","data-testid":"db-staged",children:[m,b]}),e[26]=m,e[27]=b,e[28]=h):h=e[28],h};function ao(s,e){return s+Object.keys(e).length}function io(s){return T("li",{className:"flex flex-wrap items-center gap-2 font-mono text-xs",children:[T("span",{className:"text-muted-foreground",children:[s.rowId,".",s.column]}),u("span",{className:"text-destructive line-through",children:Be(s.oldValue)}),u("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"→"}),u("span",{className:"text-foreground",children:Be(s.newValue)})]},`${s.rowId}:${s.column}`)}const Rt=400,co=36,uo={flex:"1 1 0%",minHeight:0,overflow:"auto",position:"relative"},fo={width:"100%"},mo=/\n$/u,go={alignItems:"center",display:"flex",left:0,position:"absolute",top:0,width:"100%"},po={display:"flex",width:"100%"},$t={flex:"0 0 8.5rem",padding:"0.375rem 0.75rem"},bo="2.5rem",jt={alignItems:"center",display:"flex",flex:"0 0 2.5rem",justifyContent:"center",left:0,padding:"0.375rem 0",position:"sticky",zIndex:2},St=s=>({flex:"0 0 auto",overflow:"hidden",padding:"0.375rem 0.75rem",position:"relative",textOverflow:"ellipsis",whiteSpace:"nowrap",width:`${s.toString()}px`}),Gt=(s,e)=>({...St(s),left:`calc(${bo} + ${e.toString()}px)`,position:"sticky",zIndex:2}),gt="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",ho=(s,e,n)=>e.enabled&&e.columns.has(n)?void 0:s,vt="__back__:",xo=s=>`${vt}${s.table}.${s.column}`,vo=s=>{const e=L(3),{counts:n,rowId:o}=s;if(n===void 0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=u("span",{className:"text-muted-foreground/50",children:"—"}),e[0]=l):l=e[0],l}const t=n[o]??0;let i;return e[1]!==t?(i=u("span",{className:"tabular-nums",children:t}),e[1]=t,e[2]=i):i=e[2],i},_e=s=>{for(const e of["id","__id__","_id"]){const n=s[e];if(typeof n=="string"||typeof n=="number")return String(n)}return null},wo=(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}},yo=(s,e,n)=>{if(n!==void 0&&n.type!=="any")return wo(s,n);const o=zt(s,e);return typeof e=="number"&&typeof o!="number"?void 0:{value:o}},Co=({anchor:s,columnIds:e,columnMeta:n,editableColumn:o,rows:t,text:i})=>{const l=i.replaceAll(`\r
2
- `,`
3
- `).replace(mo,"").split(`
4
- `),r=[];let a=0;for(const[c,g]of l.entries()){const f=t[s.row+c],p=f===void 0?null:_e(f),m=g.split(" ");if(f===void 0||p===null){a+=m.length;continue}for(const[d,b]of m.entries()){const h=e[s.col+d],v=h===void 0||!o(h)?void 0:yo(b,f[h],n?.[h]);h===void 0||v===void 0?a+=1:r.push({column:h,rowId:p,value:v.value})}}return{edits:r,skipped:a}},qt=(s,e)=>_e(s)??`row-${e.toString()}`,So=8,No=s=>{const e=L(17),{anchor:n,mask:o,state:t}=s,i=ne();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 g;e[3]!==i?(g=i("Loading…"),e[3]=i,e[4]=g):g=e[4];let f;e[5]!==g?(f=u("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:g}),e[5]=g,e[6]=f):f=e[6],a=f}else if(t.row===null){let g;e[7]!==i?(g=i("No matching row."),e[7]=i,e[8]=g):g=e[8];let f;e[9]!==g?(f=u("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:g}),e[9]=g,e[10]=f):f=e[10],a=f}else{let g;if(e[11]!==o||e[12]!==t.row){const f=Object.entries(Lt(t.row,o)).slice(0,So);g=u("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 px-3 py-2",children:f.map(Oo)}),e[11]=o,e[12]=t.row,e[13]=g}else g=e[13];a=g}let c;return e[14]!==a||e[15]!==r?(c=u("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]=c):c=e[16],c},ko=s=>{const e=L(24),{column:n,id:o,maskViewFor:t,onNavigate:i,onPreview:l,target:r}=s,[a,c]=$(null),[g,f]=$("idle");let p;e[0]!==o||e[1]!==i||e[2]!==r?(p=()=>{i(r,o)},e[0]=o,e[1]=i,e[2]=r,e[3]=p):p=e[3];const m=p;let d;e[4]!==o||e[5]!==l||e[6]!==g||e[7]!==r?(d=S=>{const C=S.currentTarget.getBoundingClientRect();if(c({left:C.left,top:C.bottom+4}),g!=="idle")return;f("loading"),ie((async()=>{try{f({row:await l(r,o)})}catch{f({row:null})}})())},e[4]=o,e[5]=l,e[6]=g,e[7]=r,e[8]=d):d=e[8];const b=d;let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{c(null)},e[9]=h):h=e[9];const v=h,x=`db-ref-${n}`,w=`Open ${r} ${o}`;let y;e[10]!==o||e[11]!==m||e[12]!==b||e[13]!==x||e[14]!==w?(y=T("button",{"data-testid":x,onBlur:v,onClick:m,onFocus:b,onMouseEnter:b,onMouseLeave:v,title:w,type:"button",children:[o," ↗"]}),e[10]=o,e[11]=m,e[12]=b,e[13]=x,e[14]=w,e[15]=y):y=e[15];let N;e[16]!==a||e[17]!==t||e[18]!==g||e[19]!==r?(N=a!==null&&g!=="idle"&&u(No,{anchor:a,mask:t(r,g==="loading"||g.row===null?[]:Object.keys(g.row)),state:g}),e[16]=a,e[17]=t,e[18]=g,e[19]=r,e[20]=N):N=e[20];let E;return e[21]!==y||e[22]!==N?(E=T(Ue,{children:[y,N]}),e[21]=y,e[22]=N,e[23]=E):E=e[23],E},To=s=>s==="asc"?" ▲":s==="desc"?" ▼":"",Eo="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",Dt=s=>{const e=L(8),{column:n,onExpand:o,value:t}=s;let i;e[0]!==n||e[1]!==o||e[2]!==t?(i=()=>{o(n,t)},e[0]=n,e[1]=o,e[2]=t,e[3]=i):i=e[3];const l=i,r=`db-expand-${n}`;let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=u("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:u("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 c;return e[5]!==l||e[6]!==r?(c=u("button",{"aria-label":"Expand cell",className:Eo,"data-testid":r,onClick:l,type:"button",children:a}),e[5]=l,e[6]=r,e[7]=c):c=e[7],c},_o=s=>{const e=L(15),{column:n,initial:o,onCancel:t,onCommit:i,recordId:l}=s,r=Qe(null);let a,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{r.current?.select()},c=[],e[0]=a,e[1]=c):(a=e[0],c=e[1]),Fe(a,c);let g;e[2]!==t||e[3]!==i?(g=v=>{v.key==="Enter"?(v.preventDefault(),i(v.currentTarget.value)):v.key==="Escape"&&(v.preventDefault(),t())},e[2]=t,e[3]=i,e[4]=g):g=e[4];const f=g;let p;e[5]!==i?(p=v=>{i(v.currentTarget.value)},e[5]=i,e[6]=p):p=e[6];const m=p,d=`db-cell-input-${l}-${n}`;let b;e[7]!==o?(b=Be(o),e[7]=o,e[8]=b):b=e[8];let h;return e[9]!==n||e[10]!==m||e[11]!==f||e[12]!==d||e[13]!==b?(h=u("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":d,defaultValue:b,onBlur:m,onKeyDown:f,ref:r}),e[9]=n,e[10]=m,e[11]=f,e[12]=d,e[13]=b,e[14]=h):h=e[14],h},Ro=s=>{const e=L(70),{cell:n,edit:o,highlight:t,mask:i,refs:l}=s,r=n.column.id;let a,c,g,f;if(e[0]!==n||e[1]!==r||e[2]!==o||e[3]!==i||e[4]!==l.columns||e[5]!==l.maskViewFor||e[6]!==l.onNavigate||e[7]!==l.onPreview){f=Symbol.for("react.early_return_sentinel");e:{c=n.getValue(),a=_e(n.row.original);const D=l.columns?.[r];if(i.enabled&&i.columns.has(r)){const _=`db-masked-${r}`,I=u(mt,{value:yn(c,r,i)});let R;e[12]!==_||e[13]!==I?(R=u("span",{className:"text-muted-foreground italic","data-testid":_,title:"Masked (preview)",children:I}),e[12]=_,e[13]=I,e[14]=R):R=e[14],f=R;break e}if(D!==void 0&&(typeof c=="string"||typeof c=="number")&&String(c)!==""){const _=String(c),I=`${D}:${String(c)}`;let R;e[15]!==r||e[16]!==l.maskViewFor||e[17]!==l.onNavigate||e[18]!==l.onPreview||e[19]!==_||e[20]!==I||e[21]!==D?(R=u(ko,{column:r,id:_,maskViewFor:l.maskViewFor,onNavigate:l.onNavigate,onPreview:l.onPreview,target:D},I),e[15]=r,e[16]=l.maskViewFor,e[17]=l.onNavigate,e[18]=l.onPreview,e[19]=_,e[20]=I,e[21]=D,e[22]=R):R=e[22],f=R;break e}if(a===null){let _;e[23]!==c?(_=u(mt,{value:c}),e[23]=c,e[24]=_):_=e[24];let I;e[25]!==r||e[26]!==o.onExpandCell||e[27]!==c?(I=u(Dt,{column:r,onExpand:o.onExpandCell,value:c}),e[25]=r,e[26]=o.onExpandCell,e[27]=c,e[28]=I):I=e[28];let R;e[29]!==_||e[30]!==I?(R=T(Ue,{children:[_,I]}),e[29]=_,e[30]=I,e[31]=R):R=e[31],f=R;break e}g=o.stagedValue(a,r)}e[0]=n,e[1]=r,e[2]=o,e[3]=i,e[4]=l.columns,e[5]=l.maskViewFor,e[6]=l.onNavigate,e[7]=l.onPreview,e[8]=a,e[9]=c,e[10]=g,e[11]=f}else a=e[8],c=e[9],g=e[10],f=e[11];if(f!==Symbol.for("react.early_return_sentinel"))return f;const p=g,m=p===void 0?c:p.value;let d;e[32]!==r||e[33]!==o?(d=o.editable&&o.editableColumn(r),e[32]=r,e[33]=o,e[34]=d):d=e[34];const b=d;if(o.editingCell!==null&&o.editingCell.rowId===a&&o.editingCell.column===r){let D;e[35]!==r||e[36]!==o||e[37]!==a||e[38]!==c?(D=I=>{o.stage(a,r,zt(I,c)),o.cancelEdit()},e[35]=r,e[36]=o,e[37]=a,e[38]=c,e[39]=D):D=e[39];let _;return e[40]!==r||e[41]!==m||e[42]!==o.cancelEdit||e[43]!==a||e[44]!==D?(_=u(_o,{column:r,initial:m,onCancel:o.cancelEdit,onCommit:D,recordId:a}),e[40]=r,e[41]=m,e[42]=o.cancelEdit,e[43]=a,e[44]=D,e[45]=_):_=e[45],_}let v;p!==void 0?v="rounded bg-warning/15 px-1":b&&(v="cursor-text");let x;e[46]!==b||e[47]!==r||e[48]!==o||e[49]!==a?(x=b?()=>{o.startEdit(a,r)}:void 0,e[46]=b,e[47]=r,e[48]=o,e[49]=a,e[50]=x):x=e[50];const w=x,y=v,N=`db-cell-${a}-${r}`;let E;e[51]!==r||e[52]!==t||e[53]!==i?(E=ho(t,i,r),e[51]=r,e[52]=t,e[53]=i,e[54]=E):E=e[54];let S;e[55]!==m||e[56]!==E?(S=u(mt,{highlight:E,value:m}),e[55]=m,e[56]=E,e[57]=S):S=e[57];let C;e[58]!==v||e[59]!==w||e[60]!==N||e[61]!==S?(C=u("span",{className:y,"data-testid":N,onDoubleClick:w,children:S}),e[58]=v,e[59]=w,e[60]=N,e[61]=S,e[62]=C):C=e[62];let k;e[63]!==r||e[64]!==m||e[65]!==o.onExpandCell?(k=u(Dt,{column:r,onExpand:o.onExpandCell,value:m}),e[63]=r,e[64]=m,e[65]=o.onExpandCell,e[66]=k):k=e[66];let A;return e[67]!==k||e[68]!==C?(A=T(Ue,{children:[C,k]}),e[67]=k,e[68]=C,e[69]=A):A=e[69],A},$o=s=>{s.preventDefault()},It={any:"?",array:"[]",bigint:"#",boolean:"01",bytes:"0x",id:"→",number:"#",object:"{}",storage:"◫",string:"T",union:"|"},Do=({declaredType:s,draggedRef:e,header:n,masked:o=!1,onTogglePin:t,pinnedOffset:i,table:l})=>{const r=()=>{e.current=n.column.id},a=()=>{const c=e.current,g=n.column.id;if(e.current=null,c===null||c===g)return;const f=l.getState().columnOrder,m=(f.length>0?f:l.getAllLeafColumns().map(b=>b.id)).filter(b=>b!==c),d=m.indexOf(g);m.splice(d===-1?m.length:d,0,c),l.setColumnOrder(m)};return T("th",{className:st("group/head text-start text-xs font-medium text-muted-foreground",i!==void 0&&"border-e border-border bg-muted"),draggable:!0,onDragOver:$o,onDragStart:r,onDrop:a,style:i===void 0?St(n.getSize()):Gt(n.getSize(),i),children:[T("button",{className:"inline-flex max-w-full cursor-grab items-center gap-1 truncate outline-none hover:text-foreground","data-testid":`db-sort-${n.column.id}`,onClick:n.column.getToggleSortingHandler(),type:"button",children:[In(n.column.columnDef.header,n.getContext()),To(n.column.getIsSorted())]}),s!==void 0&&It[s]!==void 0&&u("span",{className:"ms-1 font-mono text-[0.625rem] text-muted-foreground/70","data-testid":`db-type-${n.column.id}`,title:s,children:It[s]}),o&&u("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"}),u("button",{"aria-label":i===void 0?`Pin ${n.column.id}`:`Unpin ${n.column.id}`,"aria-pressed":i!==void 0,className:st("ms-1 rounded-sm px-1 text-[0.625rem] outline-none transition-opacity hover:bg-accent focus-visible:bg-accent",i===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:"📌"}),u("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()})]})},Io=s=>{const e=L(13),{table:n}=s,o=ne();let t;e[0]!==n?(t=g=>{n.toggleAllRowsSelected(g)},e[0]=n,e[1]=t):t=e[1];const i=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 c;return e[8]!==i||e[9]!==l||e[10]!==r||e[11]!==a?(c=u("th",{className:"bg-muted",style:jt,children:u(yt,{"aria-label":l,checked:r,"data-testid":"db-select-all",indeterminate:a,onCheckedChange:i})}),e[8]=i,e[9]=l,e[10]=r,e[11]=a,e[12]=c):c=e[12],c},Mo=s=>{const e=L(17),{row:n}=s,o=ne();let t;e[0]!==n.original?(t=_e(n.original),e[0]=n.original,e[1]=t):t=e[1];const i=t;let l;e[2]!==n?(l=d=>{n.toggleSelected(d)},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 c;e[6]!==n?(c=n.getIsSelected(),e[6]=n,e[7]=c):c=e[7];let g;e[8]!==n.index||e[9]!==n.original?(g=qt(n.original,n.index),e[8]=n.index,e[9]=n.original,e[10]=g):g=e[10];const f=`db-select-${g}`,p=i===null;let m;return e[11]!==r||e[12]!==a||e[13]!==c||e[14]!==f||e[15]!==p?(m=u("td",{className:"bg-background",style:jt,children:u(yt,{"aria-label":a,checked:c,"data-testid":f,disabled:p,onCheckedChange:r})}),e[11]=r,e[12]=a,e[13]=c,e[14]=f,e[15]=p,e[16]=m):m=e[16],m},Ao=s=>{const e=L(91),{columnMeta:n,edit:o,editable:t,mask:i,onDelete:l,onEdit:r,onInspect:a,highlight:c,backRelationCounts:g,onTogglePin:f,pinnedColumns:p,refs:m,tableModel:d}=s,b=ne(),{attachScroll:h,scrollLeft:v,scrollToIndex:x,table:w,tableRows:y,tbodyStyle:N,viewportWidth:E,virtualRows:S}=d,C=Qe(null),[k,A]=$(null);let D;e[0]===Symbol.for("react.memo_cache_sentinel")?(D={columns:"",count:0},e[0]=D):D=e[0];const[_,I]=$(D);let R;e[1]!==w?(R=w.getVisibleLeafColumns(),e[1]=w,e[2]=R):R=e[2];const z=R.length;let F;e[3]!==k||e[4]!==z||e[5]!==o||e[6]!==w||e[7]!==y?(F=le=>{if(!["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter"].includes(le.key))return;le.preventDefault();const K=k??{col:0,row:0};if(le.key==="Enter"){const B=y[K.row],pe=w.getVisibleLeafColumns()[K.col];if(B!==void 0&&pe!==void 0){const W=_e(B.original);W!==null&&o.editableColumn(pe.id)&&o.startEdit(W,pe.id)}A(K);return}let{col:Z,row:Q}=K;e:switch(le.key){case"ArrowDown":{Q=Math.min(Q+1,y.length-1);break e}case"ArrowRight":{Z=Math.min(Z+1,z-1);break e}case"ArrowUp":{Q=Math.max(Q-1,0);break e}default:Z=Math.max(Z-1,0)}A({col:Z,row:Q})},e[3]=k,e[4]=z,e[5]=o,e[6]=w,e[7]=y,e[8]=F):F=e[8];const j=F;let P;e[9]!==k||e[10]!==n||e[11]!==o||e[12]!==w||e[13]!==y?(P=le=>{const K=o.editable?le.clipboardData.getData("text/plain"):"";if(K==="")return;le.preventDefault();const Z=w.getVisibleLeafColumns().map(Fo),Q=Co({anchor:k??{col:0,row:0},columnIds:Z,columnMeta:n,editableColumn:o.editableColumn,rows:y.map(Lo),text:K});for(const B of Q.edits)o.stage(B.rowId,B.column,B.value);I({columns:Z.join("\0"),count:Q.skipped})},e[9]=k,e[10]=n,e[11]=o,e[12]=w,e[13]=y,e[14]=P):P=e[14];const J=P;let H,q;e[15]!==k||e[16]!==x?(H=()=>{k!==null&&x(k.row)},q=[k,x],e[15]=k,e[16]=x,e[17]=H,e[18]=q):(H=e[17],q=e[18]),Fe(H,q);let X,Ne,re,xe,ve,ke,ce,Te,de,ee,Ee,ue,fe,oe,me,U;if(e[19]!==k||e[20]!==h||e[21]!==g||e[22]!==n||e[23]!==o||e[24]!==t||e[25]!==c||e[26]!==i||e[27]!==l||e[28]!==r||e[29]!==j||e[30]!==J||e[31]!==a||e[32]!==f||e[33]!==_.columns||e[34]!==_.count||e[35]!==p||e[36]!==m||e[37]!==v||e[38]!==b||e[39]!==w||e[40]!==y||e[41]!==N||e[42]!==E||e[43]!==S){const le=w.getVisibleLeafColumns().map(Vo),K=oo(le,p,v,E),Z=so(w.getVisibleLeafColumns().map(Bo),p),Q=W=>{const Ae=y[W.index],{original:Re}=Ae,$e=_e(Re),Pe=qt(Re,W.index),ze={...go,height:`${W.size.toString()}px`,transform:`translateY(${W.start.toString()}px)`};return T("tr",{className:"border-b border-border text-xs transition-colors hover:bg-muted/50","data-testid":"db-row",style:ze,children:[u(Mo,{row:Ae}),K.leadPx>0&&u("td",{"aria-hidden":"true",style:{flex:`0 0 ${K.leadPx.toString()}px`}}),Ae.getVisibleCells().map((be,je)=>{if(!K.ids.has(be.column.id))return null;const Le=Z.get(be.column.id),Ke=k!==null&&k.row===W.index&&k.col===je?" ring-1 ring-ring ring-inset":"";return u("td",{className:st("group/cell truncate font-mono text-muted-foreground",Le!==void 0&&"border-e border-border bg-background",Ke),onPointerDown:()=>{A({col:je,row:W.index})},style:Le===void 0?St(be.column.getSize()):Gt(be.column.getSize(),Le),children:be.column.id.startsWith(vt)?u(vo,{counts:g[be.column.id.slice(vt.length)],rowId:Pe}):u(Ro,{cell:be,edit:o,highlight:c,mask:i,refs:m})},be.id)}),K.tailPx>0&&u("td",{"aria-hidden":"true",style:{flex:`0 0 ${K.tailPx.toString()}px`}}),T("td",{className:"flex items-center gap-1",style:$t,children:[u("button",{className:gt,"data-testid":`db-inspect-${Pe}`,onClick:()=>{a(Re)},type:"button",children:"Details"}),t&&T(Ue,{children:[u("button",{className:gt,"data-testid":`db-edit-${Pe}`,disabled:$e===null,onClick:()=>{r($e,Re)},type:"button",children:"Edit"}),u("button",{className:gt,"data-testid":`db-delete-${Pe}`,disabled:$e===null,onClick:()=>{l($e)},type:"button",children:"Delete"})]})]})]},Ae.id)};X=Pn,ue="fill",e[60]!==_.columns||e[61]!==_.count||e[62]!==b||e[63]!==w?(fe=_.count>0&&_.columns===w.getVisibleLeafColumns().map(zo).join("\0")&&u("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:b("{count} pasted cells were skipped",{count:_.count})}),e[60]=_.columns,e[61]=_.count,e[62]=b,e[63]=w,e[64]=fe):fe=e[64],ve="db-scroll",ke=j,ce=J,Te=h,de="grid",ee=uo,Ee=0,U="w-full text-xs",Ne="db-rows",re=fo;let B;e[65]!==w?(B=u(Io,{table:w}),e[65]=w,e[66]=B):B=e[66];let pe;e[67]===Symbol.for("react.memo_cache_sentinel")?(pe=u("th",{"aria-label":"Row actions",style:$t}),e[67]=pe):pe=e[67],xe=u("thead",{className:"bg-muted/50",children:T("tr",{className:"border-b border-border",style:po,children:[B,K.leadPx>0&&u("th",{"aria-hidden":"true",style:{flex:`0 0 ${K.leadPx.toString()}px`}}),w.getFlatHeaders().map(W=>K.ids.has(W.column.id)?u(Do,{declaredType:n?.[W.column.id]?.type,draggedRef:C,header:W,masked:i.columns.has(W.column.id),onTogglePin:f,pinnedOffset:Z.get(W.column.id),table:w},W.id):null),K.tailPx>0&&u("th",{"aria-hidden":"true",style:{flex:`0 0 ${K.tailPx.toString()}px`}}),pe]})}),oe=N,me=S.map(W=>Q(W)),e[19]=k,e[20]=h,e[21]=g,e[22]=n,e[23]=o,e[24]=t,e[25]=c,e[26]=i,e[27]=l,e[28]=r,e[29]=j,e[30]=J,e[31]=a,e[32]=f,e[33]=_.columns,e[34]=_.count,e[35]=p,e[36]=m,e[37]=v,e[38]=b,e[39]=w,e[40]=y,e[41]=N,e[42]=E,e[43]=S,e[44]=X,e[45]=Ne,e[46]=re,e[47]=xe,e[48]=ve,e[49]=ke,e[50]=ce,e[51]=Te,e[52]=de,e[53]=ee,e[54]=Ee,e[55]=ue,e[56]=fe,e[57]=oe,e[58]=me,e[59]=U}else X=e[44],Ne=e[45],re=e[46],xe=e[47],ve=e[48],ke=e[49],ce=e[50],Te=e[51],de=e[52],ee=e[53],Ee=e[54],ue=e[55],fe=e[56],oe=e[57],me=e[58],U=e[59];let G;e[68]!==oe||e[69]!==me?(G=u("tbody",{style:oe,children:me}),e[68]=oe,e[69]=me,e[70]=G):G=e[70];let we;e[71]!==Ne||e[72]!==re||e[73]!==xe||e[74]!==G||e[75]!==U?(we=T("table",{className:U,"data-testid":Ne,style:re,children:[xe,G]}),e[71]=Ne,e[72]=re,e[73]=xe,e[74]=G,e[75]=U,e[76]=we):we=e[76];let se;e[77]!==ve||e[78]!==ke||e[79]!==ce||e[80]!==Te||e[81]!==de||e[82]!==ee||e[83]!==Ee||e[84]!==we?(se=u("div",{"data-testid":ve,onKeyDown:ke,onPaste:ce,ref:Te,role:de,style:ee,tabIndex:Ee,children:we}),e[77]=ve,e[78]=ke,e[79]=ce,e[80]=Te,e[81]=de,e[82]=ee,e[83]=Ee,e[84]=we,e[85]=se):se=e[85];let ge;return e[86]!==X||e[87]!==ue||e[88]!==fe||e[89]!==se?(ge=T(X,{layout:ue,children:[fe,se]}),e[86]=X,e[87]=ue,e[88]=fe,e[89]=se,e[90]=ge):ge=e[90],ge},Po=(s,e,n,o=[])=>{const t=s?.columns,i=s?.rows,l=s?.refs,r=ht(()=>{if(t===void 0)return[];const C=t.map(k=>({accessorFn:A=>A[k],header:l?.[k]===void 0?k:`${k} →`,id:k}));for(const k of o)C.push({accessorFn:()=>{},enableSorting:!1,header:`← ${k.table}`,id:xo(k)});return C},[o,t,l]),a=ht(()=>i??[],[i]),[c,g]=$({}),[f,p]=$({}),m=Rn({columnResizeMode:"onChange",columns:r,data:a,defaultColumn:{minSize:80,size:200},enableColumnResizing:!0,enableRowSelection:C=>_e(C.original)!==null,getCoreRowModel:Dn(),getRowId:(C,k)=>_e(C)??`row-${k.toString()}`,getSortedRowModel:$n(),manualSorting:!0,onColumnVisibilityChange:p,onRowSelectionChange:g,onSortingChange:n,state:{columnVisibility:f,rowSelection:c,sorting:e}}),d=m.getRowModel().rows,b=Qe(null),h=Mn({count:d.length,estimateSize:()=>co,getScrollElement:()=>b.current,initialRect:{height:Rt,width:0},observeElementRect:(C,k)=>An(C,k,Rt),overscan:8}),v=ot(C=>{h.scrollToIndex(C)},[h]),[x,w]=$({left:0,width:0}),y=ot(C=>{if(b.current=C,C===null)return;const k=()=>{w(D=>D.left===C.scrollLeft&&D.width===C.clientWidth?D:{left:C.scrollLeft,width:C.clientWidth})};C.addEventListener("scroll",k,{passive:!0});const A=new ResizeObserver(k);return A.observe(C),()=>{C.removeEventListener("scroll",k),A.disconnect(),b.current=null}},[]),N=h.getVirtualItems(),S={display:"block",height:`${h.getTotalSize().toString()}px`,position:"relative"};return{attachScroll:y,scrollLeft:x.left,scrollToIndex:v,table:m,tableRows:d,tbodyStyle:S,viewportWidth:x.width,virtualRows:N}};function Oo(s){const[e,n]=s;return T("div",{className:"contents",children:[u("dt",{className:"truncate font-mono text-[11px] text-muted-foreground",children:e}),u("dd",{className:"truncate font-mono text-[11px] text-foreground",title:Be(n),children:Be(n)})]},e)}function Fo(s){return s.id}function Lo(s){return s.original}function Vo(s){return{getSize:()=>s.getSize(),id:s.id}}function Bo(s){return{getSize:()=>s.getSize(),id:s.id}}function zo(s){return s.id}const jo=s=>{const e=L(22),{onCommit:n}=s,o=ne(),[t,i]=$(""),l=Qe(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]),Fe(r,a);let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=w=>{i(w.target.value)},e[2]=c):c=e[2];const g=c;let f;e[3]!==t||e[4]!==n?(f=()=>{const w=t.trim();w!==""&&n(w)},e[3]=t,e[4]=n,e[5]=f):f=e[5];const p=f;let m;e[6]!==o?(m=o("Query name"),e[6]=o,e[7]=m):m=e[7];let d;e[8]!==o?(d=o("Query name"),e[8]=o,e[9]=d):d=e[9];let b;e[10]!==t||e[11]!==m||e[12]!==d?(b=u("input",{"aria-label":m,className:"h-7 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"db-save-query-name",onChange:g,placeholder:d,ref:l,value:t}),e[10]=t,e[11]=m,e[12]=d,e[13]=b):b=e[13];let h;e[14]!==o?(h=o("Save"),e[14]=o,e[15]=h):h=e[15];let v;e[16]!==p||e[17]!==h?(v=u("button",{className:xt,"data-testid":"db-save-query-confirm",onClick:p,type:"button",children:h}),e[16]=p,e[17]=h,e[18]=v):v=e[18];let x;return e[19]!==b||e[20]!==v?(x=T("span",{className:"inline-flex items-center gap-1",children:[b,v]}),e[19]=b,e[20]=v,e[21]=x):x=e[21],x},Go=s=>{const e=L(27),{onApply:n,onCopyLink:o,onDelete:t,onSave:i,saved:l}=s,r=ne(),[a,c]=$(!1);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{c(!0)},e[0]=g):g=e[0];const f=g;let p;e[1]!==i?(p=S=>{i(S),c(!1)},e[1]=i,e[2]=p):p=e[2];const m=p;let d;e[3]!==n||e[4]!==l?(d=S=>{const C=l[Number(S.currentTarget.dataset.index)];C!==void 0&&n(C)},e[3]=n,e[4]=l,e[5]=d):d=e[5];const b=d;let h;e[6]!==t||e[7]!==l?(h=S=>{const C=l[Number(S.currentTarget.dataset.index)];C!==void 0&&t(C.name)},e[6]=t,e[7]=l,e[8]=h):h=e[8];const v=h;let x;e[9]!==r?(x=r("Copy link"),e[9]=r,e[10]=x):x=e[10];let w;e[11]!==o||e[12]!==x?(w=u("button",{className:xt,"data-testid":"db-copy-link",onClick:o,type:"button",children:x}),e[11]=o,e[12]=x,e[13]=w):w=e[13];let y;e[14]!==m||e[15]!==a||e[16]!==r?(y=a?u(jo,{onCommit:m}):u("button",{className:xt,"data-testid":"db-save-query",onClick:f,type:"button",children:r("Save query")}),e[14]=m,e[15]=a,e[16]=r,e[17]=y):y=e[17];let N;e[18]!==b||e[19]!==v||e[20]!==l||e[21]!==r?(N=l.length>0&&T("div",{className:"flex flex-wrap items-center gap-1","data-testid":"db-saved-queries",children:[u("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:r("Saved")}),l.map((S,C)=>T("span",{className:"inline-flex items-center overflow-hidden rounded-md border border-border",children:[u("button",{className:"px-2 py-0.5 text-xs text-foreground transition-colors hover:bg-accent","data-index":C,"data-testid":`db-saved-query-${S.name}`,onClick:b,type:"button",children:S.name}),u("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":C,"data-testid":`db-saved-query-delete-${S.name}`,onClick:v,type:"button",children:"✕"})]},S.name))]}),e[18]=b,e[19]=v,e[20]=l,e[21]=r,e[22]=N):N=e[22];let E;return e[23]!==w||e[24]!==y||e[25]!==N?(E=T("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"db-query-bar",children:[w,y,N]}),e[23]=w,e[24]=y,e[25]=N,e[26]=E):E=e[26],E},Je="w-full rounded-md border border-border bg-background px-2 py-1 font-mono text-xs outline-none focus-visible:border-ring",Jt=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,Mt=(s,e)=>typeof e=="boolean"?"boolean":typeof e=="number"?Jt.test(s)?"date":"number":e!==null&&typeof e=="object"?"json":"text",qo=(s,e,n)=>n===void 0?Mt(s,e):n.enumValues!==void 0&&n.enumValues.length>0?"enum":n.type==="boolean"?"boolean":n.type==="number"?Jt.test(s)?"date":"number":Mt(s,e),Jo=s=>{try{const e=JSON.parse(s);return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}catch{return null}},Ko=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())}`},qe="\0clear",Wo=s=>{const e=L(23),{column:n,nullable:o,onChange:t,value:i}=s,l=ne();let r;e[0]!==n||e[1]!==t?(r=x=>{t(n,x)},e[0]=n,e[1]=t,e[2]=r):r=e[2];const a=r;let c;e[3]!==n||e[4]!==t?(c=x=>{t(n,x.target.value===qe?null:x.target.value==="true")},e[3]=n,e[4]=t,e[5]=c):c=e[5];const g=c;if(!o&&i!==null){const x=i===!0,w=`db-field-${n}`;let y;return e[6]!==n||e[7]!==a||e[8]!==x||e[9]!==w?(y=u(yt,{"aria-label":n,checked:x,"data-testid":w,onCheckedChange:a}),e[6]=n,e[7]=a,e[8]=x,e[9]=w,e[10]=y):y=e[10],y}const f=`db-field-${n}`,p=i===!0||i===!1?String(i):qe;let m;e[11]!==l?(m=l("(none)"),e[11]=l,e[12]=m):m=e[12];let d;e[13]!==m?(d=u("option",{value:qe,children:m}),e[13]=m,e[14]=d):d=e[14];let b,h;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=u("option",{value:"true",children:"true"}),h=u("option",{value:"false",children:"false"}),e[15]=b,e[16]=h):(b=e[15],h=e[16]);let v;return e[17]!==n||e[18]!==g||e[19]!==f||e[20]!==p||e[21]!==d?(v=T("select",{"aria-label":n,className:Je,"data-testid":f,onChange:g,value:p,children:[d,b,h]}),e[17]=n,e[18]=g,e[19]=f,e[20]=p,e[21]=d,e[22]=v):v=e[22],v},Ho=s=>{const e=L(23),{column:n,nullable:o,onChange:t,options:i,value:l}=s,r=ne(),a=typeof l=="string"?l:null;let c;e[0]!==i||e[1]!==a?(c=a!==null&&!i.includes(a),e[0]=i,e[1]=a,e[2]=c):c=e[2];const g=c;let f;e[3]!==n||e[4]!==t?(f=w=>{t(n,w.target.value===qe?null:w.target.value)},e[3]=n,e[4]=t,e[5]=f):f=e[5];const p=f,m=`db-field-${n}`,d=a??qe;let b;e[6]!==o||e[7]!==a||e[8]!==r?(b=(o||a===null)&&u("option",{value:qe,children:r("(none)")}),e[6]=o,e[7]=a,e[8]=r,e[9]=b):b=e[9];let h;e[10]!==a||e[11]!==g?(h=g&&u("option",{value:a,children:a}),e[10]=a,e[11]=g,e[12]=h):h=e[12];let v;e[13]!==i?(v=i.map(ts),e[13]=i,e[14]=v):v=e[14];let x;return e[15]!==n||e[16]!==p||e[17]!==m||e[18]!==d||e[19]!==b||e[20]!==h||e[21]!==v?(x=T("select",{"aria-label":n,className:Je,"data-testid":m,onChange:p,value:d,children:[b,h,v]}),e[15]=n,e[16]=p,e[17]=m,e[18]=d,e[19]=b,e[20]=h,e[21]=v,e[22]=x):x=e[22],x},Uo=s=>{const e=L(8),{column:n,onChange:o,value:t}=s;let i;e[0]!==n||e[1]!==o?(i=g=>{const f=Number(g.target.value);g.target.value!==""&&!Number.isNaN(f)&&o(n,f)},e[0]=n,e[1]=o,e[2]=i):i=e[2];const l=i,r=`db-field-${n}`,a=typeof t=="number"?t:"";let c;return e[3]!==n||e[4]!==l||e[5]!==r||e[6]!==a?(c=u("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]=c):c=e[7],c},Qo=s=>{const e=L(10),{column:n,onChange:o,value:t}=s;let i;e[0]!==n||e[1]!==o?(i=g=>{const f=new Date(g.target.value).getTime();Number.isNaN(f)||o(n,f)},e[0]=n,e[1]=o,e[2]=i):i=e[2];const l=i,r=`db-field-${n}`;let a;e[3]!==t?(a=typeof t=="number"?Ko(t):"",e[3]=t,e[4]=a):a=e[4];let c;return e[5]!==n||e[6]!==l||e[7]!==r||e[8]!==a?(c=u("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]=c):c=e[9],c},Yo=s=>{const e=L(8),{column:n,onChange:o,value:t}=s;let i;e[0]!==n||e[1]!==o?(i=g=>{o(n,g.target.value)},e[0]=n,e[1]=o,e[2]=i):i=e[2];const l=i,r=`db-field-${n}`,a=typeof t=="string"?t:"";let c;return e[3]!==n||e[4]!==l||e[5]!==r||e[6]!==a?(c=u("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]=c):c=e[7],c},Xo=s=>{const e=L(20),{column:n,onChange:o,value:t}=s,i=ne();let l;e[0]!==t?(l=()=>JSON.stringify(t,null,2),e[0]=t,e[1]=l):l=e[1];const[r,a]=$(l),[c,g]=$(!1);let f;e[2]!==n||e[3]!==o?(f=w=>{const y=w.target.value;a(y);try{o(n,JSON.parse(y)),g(!1)}catch{g(!0)}},e[2]=n,e[3]=o,e[4]=f):f=e[4];const p=f,m=c&&"border-destructive";let d;e[5]!==m?(d=st(Je,"min-h-16",m),e[5]=m,e[6]=d):d=e[6];const b=`db-field-${n}`;let h;e[7]!==n||e[8]!==p||e[9]!==d||e[10]!==b||e[11]!==r?(h=u("textarea",{"aria-label":n,className:d,"data-testid":b,onChange:p,value:r}),e[7]=n,e[8]=p,e[9]=d,e[10]=b,e[11]=r,e[12]=h):h=e[12];let v;e[13]!==n||e[14]!==c||e[15]!==i?(v=c&&u("span",{className:"text-xs text-destructive","data-testid":`db-field-error-${n}`,children:i("Invalid JSON")}),e[13]=n,e[14]=c,e[15]=i,e[16]=v):v=e[16];let x;return e[17]!==h||e[18]!==v?(x=T("div",{className:"flex flex-col gap-1",children:[h,v]}),e[17]=h,e[18]=v,e[19]=x):x=e[19],x},Zo=s=>{const e=L(56),{column:n,meta:o,onChange:t,target:i,value:l}=s;let r;e[0]!==n||e[1]!==o||e[2]!==l?(r=qo(n,l,o),e[0]=n,e[1]=o,e[2]=l,e[3]=r):r=e[3];const a=r,c=`db-field-${n}`;let g;e[4]!==n?(g=u("span",{className:"font-mono",children:n}),e[4]=n,e[5]=g):g=e[5];let f;e[6]!==n||e[7]!==o?(f=o!==void 0&&u("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]!==i?(p=i!==void 0&&T("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide uppercase",children:["→ ",i]}),e[9]=i,e[10]=p):p=e[10];let m;e[11]!==g||e[12]!==f||e[13]!==p?(m=T("span",{className:"flex items-center gap-1.5 font-medium text-muted-foreground",children:[g,f,p]}),e[11]=g,e[12]=f,e[13]=p,e[14]=m):m=e[14];let d;e[15]!==n||e[16]!==a||e[17]!==o?.nullable||e[18]!==t||e[19]!==l?(d=a==="boolean"&&u(Wo,{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]=d):d=e[20];let b;e[21]!==n||e[22]!==a||e[23]!==o||e[24]!==t||e[25]!==l?(b=a==="enum"&&o?.enumValues!==void 0&&u(Ho,{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]=b):b=e[26];let h;e[27]!==n||e[28]!==a||e[29]!==t||e[30]!==l?(h=a==="number"&&u(Uo,{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 v;e[32]!==n||e[33]!==a||e[34]!==t||e[35]!==l?(v=a==="date"&&u(Qo,{column:n,onChange:t,value:l}),e[32]=n,e[33]=a,e[34]=t,e[35]=l,e[36]=v):v=e[36];let x;e[37]!==n||e[38]!==a||e[39]!==t||e[40]!==l?(x=a==="json"&&u(Xo,{column:n,onChange:t,value:l}),e[37]=n,e[38]=a,e[39]=t,e[40]=l,e[41]=x):x=e[41];let w;e[42]!==n||e[43]!==a||e[44]!==t||e[45]!==l?(w=a==="text"&&u(Yo,{column:n,onChange:t,value:l}),e[42]=n,e[43]=a,e[44]=t,e[45]=l,e[46]=w):w=e[46];let y;return e[47]!==v||e[48]!==x||e[49]!==w||e[50]!==c||e[51]!==m||e[52]!==d||e[53]!==b||e[54]!==h?(y=T("label",{className:"flex flex-col gap-1 text-xs",htmlFor:c,children:[m,d,b,h,v,x,w]}),e[47]=v,e[48]=x,e[49]=w,e[50]=c,e[51]=m,e[52]=d,e[53]=b,e[54]=h,e[55]=y):y=e[55],y},es=s=>{const e=L(49),{columnMeta:n,documentText:o,onCancel:t,onDocumentTextChange:i,onSave:l,refs:r}=s,a=ne();let c;e[0]!==o?(c=Jo(o),e[0]=o,e[1]=c):c=e[1];const g=c,[f,p]=$(!1),m=!f&&g!==null;let d;e[2]!==g||e[3]!==i?(d=(H,q)=>{i(JSON.stringify({...g,[H]:q},null,2))},e[2]=g,e[3]=i,e[4]=d):d=e[4];const b=d;let h;e[5]!==i?(h=H=>{i(H.target.value)},e[5]=i,e[6]=h):h=e[6];const v=h;let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{p(!1)},e[7]=x):x=e[7];const w=x;let y;e[8]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{p(!0)},e[8]=y):y=e[8];const N=y,E=g===null;let S;e[9]!==a?(S=a("Form"),e[9]=a,e[10]=S):S=e[10];let C;e[11]!==m||e[12]!==E||e[13]!==S?(C=u("button",{"aria-pressed":m,className:Me,"data-testid":"db-editor-form",disabled:E,onClick:w,type:"button",children:S}),e[11]=m,e[12]=E,e[13]=S,e[14]=C):C=e[14];const k=!m;let A;e[15]!==a?(A=a("JSON"),e[15]=a,e[16]=A):A=e[16];let D;e[17]!==A||e[18]!==k?(D=u("button",{"aria-pressed":k,className:Me,"data-testid":"db-editor-json",onClick:N,type:"button",children:A}),e[17]=A,e[18]=k,e[19]=D):D=e[19];let _;e[20]!==D||e[21]!==C?(_=T("div",{className:"flex items-center gap-1.5",children:[C,D]}),e[20]=D,e[21]=C,e[22]=_):_=e[22];let I;e[23]!==n||e[24]!==o||e[25]!==g||e[26]!==b||e[27]!==v||e[28]!==r||e[29]!==m||e[30]!==a?(I=m?u("div",{className:"flex flex-col gap-3","data-testid":"db-editor-fields",children:Object.entries(g).map(H=>{const[q,X]=H;return u(Zo,{column:q,meta:n?.[q],onChange:b,target:r?.[q],value:X},q)})}):u("textarea",{"aria-label":a("Row document JSON"),className:"min-h-28 w-full rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"db-editor-doc",onChange:v,value:o}),e[23]=n,e[24]=o,e[25]=g,e[26]=b,e[27]=v,e[28]=r,e[29]=m,e[30]=a,e[31]=I):I=e[31];let R;e[32]!==a?(R=a("Save"),e[32]=a,e[33]=R):R=e[33];let z;e[34]!==l||e[35]!==R?(z=u("button",{className:Me,"data-testid":"db-editor-save",onClick:l,type:"button",children:R}),e[34]=l,e[35]=R,e[36]=z):z=e[36];let F;e[37]!==a?(F=a("Cancel"),e[37]=a,e[38]=F):F=e[38];let j;e[39]!==t||e[40]!==F?(j=u("button",{className:Me,"data-testid":"db-editor-cancel",onClick:t,type:"button",children:F}),e[39]=t,e[40]=F,e[41]=j):j=e[41];let P;e[42]!==z||e[43]!==j?(P=T("div",{className:"flex items-center gap-1.5",children:[z,j]}),e[42]=z,e[43]=j,e[44]=P):P=e[44];let J;return e[45]!==_||e[46]!==I||e[47]!==P?(J=T("div",{className:"flex flex-col gap-2 border border-border bg-card p-3","data-testid":"db-editor",children:[_,I,P]}),e[45]=_,e[46]=I,e[47]=P,e[48]=J):J=e[48],J};function ts(s){return u("option",{value:s,children:s},s)}const ns=s=>{const e=L(61),{columns:n,editable:o,filter:t,filters:i,hasMaskedColumns:l,liveError:r,maskOn:a,onAddRow:c,onBulkDelete:g,onAskAiFilter:f,onClearTable:p,onFilterChange:m,onFiltersChange:d,onGenerateRows:b,onShowJson:h,onShowTable:v,onToggleMask:x,total:w,viewMode:y}=s,N=ne(),E=y==="table";let S;e[0]!==v||e[1]!==E?(S=u("button",{"aria-pressed":E,className:Me,"data-testid":"db-view-table",onClick:v,type:"button",children:"Table"}),e[0]=v,e[1]=E,e[2]=S):S=e[2];const C=y==="json";let k;e[3]!==h||e[4]!==C?(k=u("button",{"aria-pressed":C,className:Me,"data-testid":"db-view-json",onClick:h,type:"button",children:"JSON"}),e[3]=h,e[4]=C,e[5]=k):k=e[5];let A;e[6]!==r||e[7]!==N?(A=r===void 0?N("Live — changes stream in automatically"):N("Live unavailable: {liveError}",{liveError:r}),e[6]=r,e[7]=N,e[8]=A):A=e[8];const D=`size-1.5 rounded-full ${r===void 0?"bg-success":"bg-muted-foreground/50"}`;let _;e[9]!==D?(_=u("span",{"aria-hidden":"true",className:D}),e[9]=D,e[10]=_):_=e[10];let I;e[11]!==r||e[12]!==N?(I=N(r===void 0?"Live":"Live unavailable"),e[11]=r,e[12]=N,e[13]=I):I=e[13];let R;e[14]!==A||e[15]!==_||e[16]!==I?(R=T("span",{className:"inline-flex items-center gap-1.5 px-1 text-xs font-medium text-muted-foreground","data-testid":"db-live-indicator",role:"status",title:A,children:[_,I]}),e[14]=A,e[15]=_,e[16]=I,e[17]=R):R=e[17];let z;e[18]!==l||e[19]!==a||e[20]!==x||e[21]!==N?(z=l&&u("button",{"aria-pressed":a,className:Me,"data-testid":"db-mask-toggle",onClick:x,type:"button",children:N("Mask sensitive columns")}),e[18]=l,e[19]=a,e[20]=x,e[21]=N,e[22]=z):z=e[22];let F;e[23]!==o||e[24]!==c?(F=o&&u("button",{className:Me,"data-testid":"db-add-row",onClick:c,type:"button",children:"Add row"}),e[23]=o,e[24]=c,e[25]=F):F=e[25];let j;e[26]!==o||e[27]!==b||e[28]!==N?(j=o&&u("button",{className:Me,"data-testid":"db-generate-rows",onClick:b,type:"button",children:N("Generate rows")}),e[26]=o,e[27]=b,e[28]=N,e[29]=j):j=e[29];let P;e[30]!==o||e[31]!==t||e[32]!==i||e[33]!==g||e[34]!==w?(P=o&&w>0&&(t!==""||i.length>0)&&u(kt,{confirmLabel:`Delete ${w.toString()} matching?`,onConfirm:g,testId:"db-bulk-delete",children:`Delete ${w.toString()} matching`}),e[30]=o,e[31]=t,e[32]=i,e[33]=g,e[34]=w,e[35]=P):P=e[35];let J;e[36]!==o||e[37]!==t||e[38]!==i||e[39]!==p||e[40]!==w?(J=o&&w>0&&t===""&&i.length===0&&u(kt,{confirmLabel:`Clear all ${w.toString()} rows?`,onConfirm:p,testId:"db-clear-table",children:`Clear table (${w.toString()})`}),e[36]=o,e[37]=t,e[38]=i,e[39]=p,e[40]=w,e[41]=J):J=e[41];let H;e[42]!==z||e[43]!==F||e[44]!==j||e[45]!==P||e[46]!==J||e[47]!==S||e[48]!==k||e[49]!==R?(H=T("div",{className:"flex flex-wrap items-center gap-1.5",children:[S,k,R,z,F,j,P,J]}),e[42]=z,e[43]=F,e[44]=j,e[45]=P,e[46]=J,e[47]=S,e[48]=k,e[49]=R,e[50]=H):H=e[50];let q;e[51]!==n||e[52]!==t||e[53]!==i||e[54]!==f||e[55]!==m||e[56]!==d?(q=u(Fn,{columns:n,filters:i,onAskAi:f,onFiltersChange:d,onSearchChange:m,search:t}),e[51]=n,e[52]=t,e[53]=i,e[54]=f,e[55]=m,e[56]=d,e[57]=q):q=e[57];let X;return e[58]!==H||e[59]!==q?(X=T("div",{className:"flex flex-col gap-2","data-testid":"db-view-toggle",children:[H,q]}),e[58]=H,e[59]=q,e[60]=X):X=e[60],X},os=s=>{const e=L(104),{assistant:n,backRelations:o,browser:t,columnMeta:i,edit:l,editable:r,onAskAiFilter:a,onInspect:c,onOpenGenerateRows:g,onRowDelete:f,onSaveQuery:p,page:m,preferences:d,queryBar:b,references:h}=s,v=d.maskColumns.size>0,x=n.unavailable?void 0:a;let w;e[0]!==t.addRow||e[1]!==t.bulkDelete||e[2]!==t.clearTable||e[3]!==t.columns||e[4]!==t.filter||e[5]!==t.filters||e[6]!==t.liveError||e[7]!==t.onFilterChange||e[8]!==t.onFiltersChange||e[9]!==t.showJson||e[10]!==t.showTable||e[11]!==t.total||e[12]!==t.viewMode||e[13]!==r||e[14]!==g||e[15]!==d.maskOn||e[16]!==d.onToggleMask||e[17]!==v||e[18]!==x?(w=u(ns,{columns:t.columns,editable:r,filter:t.filter,filters:t.filters,hasMaskedColumns:v,liveError:t.liveError,maskOn:d.maskOn,onAddRow:t.addRow,onAskAiFilter:x,onBulkDelete:t.bulkDelete,onClearTable:t.clearTable,onFilterChange:t.onFilterChange,onFiltersChange:t.onFiltersChange,onGenerateRows:g,onShowJson:t.showJson,onShowTable:t.showTable,onToggleMask:d.onToggleMask,total:t.total,viewMode:t.viewMode}),e[0]=t.addRow,e[1]=t.bulkDelete,e[2]=t.clearTable,e[3]=t.columns,e[4]=t.filter,e[5]=t.filters,e[6]=t.liveError,e[7]=t.onFilterChange,e[8]=t.onFiltersChange,e[9]=t.showJson,e[10]=t.showTable,e[11]=t.total,e[12]=t.viewMode,e[13]=r,e[14]=g,e[15]=d.maskOn,e[16]=d.onToggleMask,e[17]=v,e[18]=x,e[19]=w):w=e[19];let y;e[20]!==p||e[21]!==b?(y=b!==void 0&&u(Go,{onApply:b.onApplyQuery,onCopyLink:b.onCopyLink,onDelete:b.onDeleteQuery,onSave:p,saved:b.saved}),e[20]=p,e[21]=b,e[22]=y):y=e[22];let N;e[23]!==o||e[24]!==t.onBulkDeleteSelected||e[25]!==t.selectedTable||e[26]!==t.table||e[27]!==t.viewMode||e[28]!==r||e[29]!==m||e[30]!==d.maskView||e[31]!==d.onToggleTranspose||e[32]!==d.transposed?(N=t.viewMode==="table"&&m.rows.length>0&&u(Ln,{backRelations:o.available,columns:m.columns,editable:r,enabledBackRelations:o.enabled,name:t.selectedTable??"export",onBulkDelete:t.onBulkDeleteSelected,onToggleBackRelation:o.onToggle,onToggleTranspose:d.onToggleTranspose,rows:ut(m.rows,d.maskView),table:t.table.table,transposed:d.transposed}),e[23]=o,e[24]=t.onBulkDeleteSelected,e[25]=t.selectedTable,e[26]=t.table,e[27]=t.viewMode,e[28]=r,e[29]=m,e[30]=d.maskView,e[31]=d.onToggleTranspose,e[32]=d.transposed,e[33]=N):N=e[33];let E;e[34]!==t.cancelEdit||e[35]!==t.editing||e[36]!==t.saveEdit||e[37]!==t.setEditorDocumentText||e[38]!==i||e[39]!==r||e[40]!==m?(E=r&&t.editing!==null&&u(es,{columnMeta:i,documentText:t.editing.docText,onCancel:t.cancelEdit,onDocumentTextChange:t.setEditorDocumentText,onSave:t.saveEdit,refs:m.refs}),e[34]=t.cancelEdit,e[35]=t.editing,e[36]=t.saveEdit,e[37]=t.setEditorDocumentText,e[38]=i,e[39]=r,e[40]=m,e[41]=E):E=e[41];let S;e[42]!==t.committing||e[43]!==t.discardStaged||e[44]!==t.onCommitStaged||e[45]!==t.stagedChanges||e[46]!==r?(S=r&&t.stagedChanges.length>0&&u(ro,{changes:t.stagedChanges,committing:t.committing,onCommit:t.onCommitStaged,onDiscard:t.discardStaged}),e[42]=t.committing,e[43]=t.discardStaged,e[44]=t.onCommitStaged,e[45]=t.stagedChanges,e[46]=r,e[47]=S):S=e[47];let C;e[48]!==t.writeError?(C=t.writeError!==null&&u("p",{className:"text-sm text-destructive","data-testid":"db-write-error",role:"alert",children:t.writeError}),e[48]=t.writeError,e[49]=C):C=e[49];let k;e[50]!==w||e[51]!==y||e[52]!==N||e[53]!==E||e[54]!==S||e[55]!==C?(k=T("div",{className:"flex shrink-0 flex-col gap-2 border-b border-border px-4 py-3",children:[w,y,N,E,S,C]}),e[50]=w,e[51]=y,e[52]=N,e[53]=E,e[54]=S,e[55]=C,e[56]=k):k=e[56];let A;e[57]!==t.viewMode||e[58]!==m?(A=t.viewMode==="table"&&m.rows.length===0&&u("div",{className:"flex flex-1 items-center justify-center p-6",children:u(_n,{description:"Rows you insert into this table will show up here.",icon:u("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:u("path",{d:"M4 5h16v14H4V5Zm0 5h16M10 10v9M4 14.5h16"})}),testId:"db-empty-rows",title:"This table is empty."})}),e[57]=t.viewMode,e[58]=m,e[59]=A):A=e[59];let D;e[60]!==t.viewMode||e[61]!==m||e[62]!==d.maskView||e[63]!==d.transposed?(D=t.viewMode==="table"&&m.rows.length>0&&d.transposed&&u(On,{columns:m.columns,rows:ut(m.rows,d.maskView)}),e[60]=t.viewMode,e[61]=m,e[62]=d.maskView,e[63]=d.transposed,e[64]=D):D=e[64];let _;e[65]!==o||e[66]!==t.filter||e[67]!==t.onRowEdit||e[68]!==t.table||e[69]!==t.viewMode||e[70]!==i||e[71]!==l||e[72]!==r||e[73]!==c||e[74]!==f||e[75]!==m||e[76]!==d.maskView||e[77]!==d.onTogglePin||e[78]!==d.pinnedColumns||e[79]!==d.transposed||e[80]!==h?(_=t.viewMode==="table"&&m.rows.length>0&&!d.transposed&&u(Ao,{backRelationCounts:o.counts,columnMeta:i,edit:l,editable:r,highlight:t.filter,mask:d.maskView,onDelete:f,onEdit:t.onRowEdit,onInspect:c,onTogglePin:d.onTogglePin,pinnedColumns:d.pinnedColumns,refs:h,tableModel:t.table}),e[65]=o,e[66]=t.filter,e[67]=t.onRowEdit,e[68]=t.table,e[69]=t.viewMode,e[70]=i,e[71]=l,e[72]=r,e[73]=c,e[74]=f,e[75]=m,e[76]=d.maskView,e[77]=d.onTogglePin,e[78]=d.pinnedColumns,e[79]=d.transposed,e[80]=h,e[81]=_):_=e[81];let I;e[82]!==t.viewMode||e[83]!==m||e[84]!==d.maskView?(I=t.viewMode==="json"&&u("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(ut(m.rows,d.maskView),vn,2)}),e[82]=t.viewMode,e[83]=m,e[84]=d.maskView,e[85]=I):I=e[85];let R;e[86]!==t.changePageSize||e[87]!==t.goNext||e[88]!==t.goPrevious||e[89]!==t.hasNext||e[90]!==t.hasPrevious||e[91]!==t.jumpToPage||e[92]!==t.pageSize||e[93]!==t.rangeEnd||e[94]!==t.rangeStart||e[95]!==t.total?(R=u("div",{className:"flex shrink-0 items-center border-t border-border px-4 py-2",children:u(Cn,{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[86]=t.changePageSize,e[87]=t.goNext,e[88]=t.goPrevious,e[89]=t.hasNext,e[90]=t.hasPrevious,e[91]=t.jumpToPage,e[92]=t.pageSize,e[93]=t.rangeEnd,e[94]=t.rangeStart,e[95]=t.total,e[96]=R):R=e[96];let z;return e[97]!==A||e[98]!==D||e[99]!==_||e[100]!==I||e[101]!==R||e[102]!==k?(z=T("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"db-page",children:[k,A,D,_,I,R]}),e[97]=A,e[98]=D,e[99]=_,e[100]=I,e[101]=R,e[102]=k,e[103]=z):z=e[103],z},ss="/__lunora/seed",pt=200,ls=50,rs=(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},as=async s=>{const e=await fetch(ss,{body:JSON.stringify(s),headers:{"Content-Type":"application/json"},method:"POST"}),n=await e.json();return e.ok&&n.rows!==void 0?{kind:"ok",rows:n.rows}:{kind:"error",message:n.error??`seed request failed (${String(e.status)})`}},is="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",cs="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",ds=({columns:s,fkPools:e,onClose:n,onInsertRows:o,table:t})=>{const i=ne(),[l,r]=$(10),[a,c]=$(!1),[g,f]=$(void 0),[p,m]=$(void 0),[d,b]=$(0),h=y=>{const N=Number(y.target.value);!Number.isNaN(N)&&N>=1&&r(Math.min(N,pt))},v=async()=>{f(void 0),m(void 0),b(0),c(!0);try{const y=await as({count:l,existingIds:e,seed:Date.now(),table:t});if(y.kind==="error"){f(y.message);return}const{rows:N}=y;if(N.length===0){f(i("No rows generated — all columns were skipped."));return}const E=await o(N);if(E.error!==void 0){f(E.error);return}m(E.inserted),b(E.conflicts);const S=rs(s,e);S.length>0&&f(i("Inserted {count} rows. Skipped FK columns: {cols}",{cols:S.join(", "),count:E.inserted.toString()}))}finally{c(!1)}},x=()=>{ie(v())},w=s.filter(y=>y.pk!==!0);return T(wt,{label:i("Generate dummy rows"),onClose:n,panelTestId:"gen-rows-panel",testId:"gen-rows-overlay",variant:"dialog",children:[T("div",{className:"flex items-start justify-between",children:[T("div",{className:"flex flex-col gap-0.5",children:[u("h3",{className:"text-base text-foreground","data-testid":"gen-rows-title",children:i("Generate dummy rows")}),u("p",{className:"text-xs text-muted-foreground","data-testid":"gen-rows-desc",children:i("Seed {table} with Faker-generated rows. Existing rows are not affected.",{table:t})})]}),u("button",{className:"text-xs text-muted-foreground hover:text-foreground","data-testid":"gen-rows-close",onClick:n,type:"button",children:i("Close")})]}),T("div",{className:"flex items-center gap-2",children:[u("label",{className:"text-xs font-medium text-foreground",htmlFor:"gen-rows-count",children:i("Row count")}),u("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:pt,min:1,onChange:h,type:"number",value:l}),u("span",{className:"text-xs text-muted-foreground",children:i("(max {max})",{max:pt.toString()})})]}),w.length>0&&T("div",{className:"flex flex-col gap-1",children:[u("p",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:i("Columns to seed")}),u("ul",{className:"flex flex-col gap-0.5","data-testid":"gen-rows-columns",children:w.map(y=>{const N=y.ref!==void 0&&y.type==="id",E=N&&(e[y.ref??""]??[]).length===0,S=E?"rounded bg-destructive/10 px-1 text-destructive":"rounded bg-muted px-1 text-muted-foreground",C=E?`gen-rows-fk-empty-${y.name}`:`gen-rows-fk-ok-${y.name}`,k=E?i("FK: no rows in {ref} — will skip",{ref:y.ref??""}):i("→ {ref}",{ref:y.ref??""});return T("li",{className:"flex items-center gap-1.5 font-mono text-xs",children:[u("span",{className:"text-foreground",children:y.name}),T("span",{className:"text-muted-foreground",children:["(",y.type,")"]}),y.optional&&u("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide uppercase",children:"optional"}),N&&u("span",{className:S,"data-testid":C,children:k})]},y.name)})})]}),g!==void 0&&u("p",{className:"text-xs text-destructive","data-testid":"gen-rows-error",role:"alert",children:g}),p!==void 0&&g===void 0&&u("p",{className:"text-xs text-success","data-testid":"gen-rows-success",children:d>0?i("Inserted {inserted} of {total} rows — {conflicts} skipped as id conflicts.",{conflicts:d.toString(),inserted:p.toString(),total:(p+d).toString()}):i("Inserted {count} rows successfully.",{count:p.toString()})}),T("div",{className:"flex justify-end gap-2",children:[u("button",{className:is,"data-testid":"gen-rows-cancel",onClick:n,type:"button",children:i("Cancel")}),u("button",{className:cs,"data-testid":"gen-rows-generate",disabled:a,onClick:x,type:"button",children:i(a?"Inserting…":"Generate & insert")})]})]})},us=Se(te.backRelationCounts),fs=(s,e,n,o)=>{const t=L(16),i=lt();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l={},t[0]=l):l=t[0];const[r,a]=$(l);let c;if(t[1]!==s||t[2]!==e){let v;t[4]!==s?(v=x=>s.has(Ct(x)),t[4]=s,t[5]=v):v=t[5],c=e.filter(v),t[1]=s,t[2]=e,t[3]=c}else c=t[3];const g=c;let f;t[6]!==n||t[7]!==g?(f=JSON.stringify([g,n]),t[6]=n,t[7]=g,t[8]=f):f=t[8];const p=f;let m;t[9]!==i||t[10]!==o||t[11]!==p?(m=async v=>{const[x,w]=JSON.parse(p);if(x.length===0||w.length===0){v.cancelled||a({});return}try{const y=await i.query(us,{ids:w,relations:x},he(o));v.cancelled||a(Object.fromEntries(y.relations.map(ms)))}catch{}},t[9]=i,t[10]=o,t[11]=p,t[12]=m):m=t[12];const d=m;let b,h;return t[13]!==d?(b=()=>{const v={cancelled:!1};return ie(d(v)),()=>{v.cancelled=!0}},h=[d],t[13]=d,t[14]=b,t[15]=h):(b=t[14],h=t[15]),Fe(b,h),r};function ms(s){return[Ct(s),s.counts]}const nt=s=>{const e=s[0];return e===void 0?void 0:{column:e.id,direction:e.desc?"desc":"asc"}},Kt=s=>s==null?"":typeof s=="object"?JSON.stringify(s):String(s),At=s=>s.map(e=>({column:e.column,operator:e.operator,value:e.value===void 0?"":Kt(e.value)})),Pt=s=>s===void 0?[]:[{desc:s.direction==="desc",id:s.column}],gs=s=>[s.column,s.operator,s.value],Ze=(s,e,n,o)=>JSON.stringify([s??"",e??"",(n??[]).map(t=>gs(t)),o===void 0?null:[o.column,o.direction]]),Ot=200,ps=20,bs=Se(te.readTablePage),hs=Se(te.facetColumn),bt=Se(te.writeRow),xs=Se(te.deleteRows),vs=Se(te.clearTable),ws={},Nt=new Set(["__doc__","__id__","_creationTime","_id","id"]),ys=s=>{const e=s.__doc__;if(typeof e=="string"){const o=Gn(e);if(o!==void 0)return o}const n={};for(const[o,t]of Object.entries(s))Nt.has(o)||(n[o]=t);return n},Cs=({filters:s,offset:e,pageSize:n,search:o,sorting:t,table:i})=>({filters:Ve(s),limit:n,offset:e,orderBy:nt(t),search:o,skipCount:!0,table:i}),Ss=({filters:s,search:e,table:n})=>({filters:Ve(s),limit:1,search:e,table:n}),Ns=(s,e)=>{const n=new Map;for(const t of s?.rows??[]){const i=_e(t);i!==null&&n.set(i,t)}const o=[];for(const[t,i]of Object.entries(e))for(const[l,r]of Object.entries(i))o.push({column:l,newValue:r,oldValue:n.get(t)?.[l],rowId:t});return o},ks=s=>!Nt.has(s),Ts=({initialFilters:s,initialOrderBy:e,initialSearch:n,initialShardKey:o,onSelectTable:t,onViewChange:i,pageSize:l,resolveBackRelations:r,tableParam:a})=>{const c=lt(),[g,f]=$(l),[p,m]=$(o??""),d=a===void 0||a===""?null:a,[b,h]=$(0),[v,x]=$("table"),[w,y]=$(()=>Pt(e)),[N,E]=$(n??""),[S,C]=$(()=>At(s??[])),{clearFacets:k,facets:A,refetchFacets:D,toggleFacet:_}=Sn(),[I,R]=$(null),[z,F]=$(null),j=lo(),[P,J]=$(null),[H,q]=$(!1),[X,Ne]=$(a),[re,xe]=$(()=>Ze(o,n,s,e)),[ve,ke]=$(0),[ce,Te]=$(()=>Ze(o,n,s,e)),de=a!==X,ee=Ze(o,n,s,e),ue=de||!de&&ee!==re&&ee!==ce;if(ue){Ne(a),xe(ee),ke(V=>V+1),y(Pt(e)),E(n??"");const M=At(s??[]);C(M),m(o??""),k(),j.clear(),J(null),h(0)}else ee!==re&&xe(ee);const fe=ue?n??"":N,oe=ue?o??"":p,me=`${a??""}:${ve.toString()}`,U=Tt(fe.trim(),300,me),G=Tt(oe.trim(),400,me),we=Ze(G,U,Ve(S),nt(w));we!==ce&&Te(we);const se=et(te.listTables,ws,{live:!0,shardKey:G}),ge=se.data??null,le=se.error,K=Cs({filters:S,offset:b,pageSize:g,search:U,sorting:w,table:d??""}),Z=Ss({filters:S,search:U,table:d??""}),Q=et(te.readTablePage,K,{enabled:d!==null,keepPreviousData:!1,live:!0,shardKey:G}),B=Q.data??null,pe=Q.error,{liveError:W}=Q,Ae=et(te.readTablePage,Z,{enabled:d!==null,live:!0,shardKey:G});Fe(()=>{se.data!==void 0&&qn(G)},[se.data,G]);const Re=M=>{t?.(M)},$e=(M,V)=>{t?.(M,{search:V})},Pe=async(M,V)=>{try{return(await c.query(bs,{filters:[],limit:ps,offset:0,search:V,table:M},he(G))).rows.find(Ce=>_e(Ce)===V)??null}catch{return null}},ze=(M,V,ae,Ce)=>Ie=>c.query(hs,{column:Ie,filters:Ve(ae),search:Ce,table:V},he(M)),be=M=>{_(M,d===null?null:ze(G,d,S,U))},je=(M,V)=>{const ae=Kt(V);C(Ce=>[...Ce.filter(Ie=>Ie.column!==M),{column:M,operator:"eq",value:ae}]),h(0)},Le=ft(ze),Ke=ft(D),We=ft(i);Fe(()=>{d!==null&&Ke.current(Le.current(G,d,S,U))},[G,d,S,U]),Fe(()=>{d===null||We.current===void 0||X!==a||re!==ee||We.current({filters:Ve(S),orderBy:nt(w),search:U,shard:G})},[d,a,X,re,ee,S,w,U,G]);const He=M=>{d!==null&&h(Math.max(0,M))},rt=(M,V)=>{J({column:V,rowId:M})},at=()=>{J(null)},it=async()=>{if(d!==null){F(null),q(!0);try{for(const[M,V]of Object.entries(j.staged))await c.query(bt,{doc:V,id:M,op:"patch",table:d},he(G));j.clear(),J(null),Q.refetch()}catch(M){F(M.message)}q(!1)}},ct=()=>{j.clear(),J(null)},dt=Ns(B,j.staged),Ye=async(M,V,ae)=>{if(d===null)return;F(null);let Ce;if(M!=="delete"){let Ie;try{Ie=ae===void 0||ae.trim()===""?{}:JSON.parse(ae)}catch(Ge){F(`Invalid JSON: ${Ge.message}`);return}try{const Ge=zn(Ie);if(!jn(Ge)){F("The document must be a JSON object.");return}Ce=Ge}catch(Ge){F(`Invalid document: ${Ge.message}`);return}}try{await c.query(bt,{doc:Ce,id:V??void 0,op:M,table:d},he(G)),R(null),Q.refetch()}catch(Ie){F(Ie.message)}},O=async(M,V)=>{if(d!==null){F(null);try{let ae="cap-hit";for(let Ce=0;Ce<Ot;Ce+=1)if(!(await c.query(M,V,he(G))).hasMore){ae="completed";break}h(0),Q.refetch(),ae==="cap-hit"&&F(`Stopped after ${Ot.toString()} batches — rows still match this delete. Run it again to remove the rest.`)}catch(ae){F(ae.message)}}},Y=M=>{y(M),h(0)},ye=ht(()=>d===null?[]:r?.(d)??[],[r,d]),De=Po(B,w,Y,ye),Oe={filters:Ve(S),orderBy:nt(w),search:U,shard:p,table:d??void 0},Xe=Ae.data?.total??(B===null?0:b+B.rows.length),Wt=b>0,Ht=B!==null&&b+B.rows.length<Xe,Ut=B===null||B.rows.length===0?0:b+1,Qt=B===null?0:b+B.rows.length,Yt=()=>{se.refetch()},Xt=()=>{x("table")},Zt=()=>{x("json")},en=()=>{ie(O(xs,{filters:Ve(S),search:U,table:d}))},tn=()=>{ie(O(vs,{table:d}))},nn=M=>{E(M.target.value),h(0)},on=M=>{C(M),h(0)},sn=()=>{F(null);const M={};for(const V of B?.columns??[])Nt.has(V)||(M[V]="");R({docText:JSON.stringify(M,null,2),id:""})},ln=M=>{R(V=>V===null?V:{docText:M,id:V.id})},rn=()=>{I!==null&&ie(Ye(I.id===""?"insert":"patch",I.id===""?null:I.id,I.docText))},an=()=>{R(null),F(null)},cn=()=>{He(b-g)},dn=()=>{He(b+g)},un=M=>{He(Math.max(0,(M-1)*g))},fn=M=>{f(M),h(0)},mn=(M,V)=>{F(null),R({docText:JSON.stringify(Bn(ys(V)),null,2),id:M})},gn=M=>{ie(Ye("delete",M))},pn=async M=>{if(!(d===null||M.length===0)){F(null);try{for(const V of M)await c.query(bt,{id:V,op:"delete",table:d},he(G));Q.refetch()}catch(V){F(V.message)}}},bn=M=>{ie(pn(M))},hn=()=>{ie(it())};return{addRow:sn,bulkDelete:en,cancelCellEdit:at,cancelEdit:an,changePageSize:fn,clearTable:tn,columns:B?.columns??[],committing:H,currentView:Oe,discardStaged:ct,editableColumn:ks,editing:I,editingCell:P,facetFilter:je,facets:A,filter:N,filters:S,goNext:dn,goPrevious:cn,hasNext:Ht,hasPrevious:Wt,jumpToPage:un,liveError:W,loadTables:Yt,navigateToRef:$e,onBulkDeleteSelected:bn,onCommitStaged:hn,onFilterChange:nn,onFiltersChange:on,onRowDelete:gn,onRowEdit:mn,page:B,previewRef:Pe,pageError:pe,pageSize:g,rangeEnd:Qt,rangeStart:Ut,queryShardKey:G,saveEdit:rn,selectedTable:d,selectTable:Re,setEditorDocumentText:ln,setShardKey:m,shardKey:p,showJson:Zt,showTable:Xt,stage:j.stage,stagedChanges:dt,stagedValue:j.stagedValue,startCellEdit:rt,table:De,tables:ge,tablesError:le,toggleFacet:be,total:Xe,viewMode:v,writeError:z}},Es="lunora-studio-pinned-columns",_s=s=>{const e=L(21),{columns:n,initialPins:o,selectedTable:t}=s;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];const[l,r]=Ft(Es,i),a=t??"",c=l[a];let g;e[1]!==o||e[2]!==c?(g=c===void 0?new Set((o??"").split(",").filter(Rs)):new Set(c),e[1]=o,e[2]=c,e[3]=g):g=e[3];const f=g;let p;e[4]!==a||e[5]!==f||e[6]!==r?(p=k=>{r(A=>{const D=A[a]??[...f],_=D.includes(k)?D.filter(I=>I!==k):[...D,k];return{...A,[a]:_}})},e[4]=a,e[5]=f,e[6]=r,e[7]=p):p=e[7];const m=p,[d,b]=$(!1);let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{b($s)},e[8]=h):h=e[8];const v=h;let x;e[9]!==n||e[10]!==t?(x={columns:n,selectedTable:t},e[9]=n,e[10]=t,e[11]=x):x=e[11];const{maskColumns:w,maskOn:y,maskView:N,maskViewFor:E,onToggleMask:S}=Nn(x);let C;return e[12]!==w||e[13]!==y||e[14]!==N||e[15]!==E||e[16]!==S||e[17]!==m||e[18]!==f||e[19]!==d?(C={maskColumns:w,maskOn:y,maskView:N,maskViewFor:E,onToggleMask:S,onTogglePin:m,onToggleTranspose:v,pinnedColumns:f,transposed:d},e[12]=w,e[13]=y,e[14]=N,e[15]=E,e[16]=S,e[17]=m,e[18]=f,e[19]=d,e[20]=C):C=e[20],C};function Rs(s){return s!==""}function $s(s){return!s}const Ds=Se(te.describeTable),Is=Se(te.readTablePage),Ms=Se(te.importShard),As=s=>{const e=s._id??s.id??s.__id__??"";return typeof e=="string"?e:typeof e=="number"?String(e):""},Ps=s=>{const e=Object.values(s.inserted).reduce((a,c)=>a+c,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,i=o===1?"error":"errors",l=o>0?` (+${o.toString()} more ${i})`:"",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}},Os=s=>{const e=lt(),[n,o]=$(!1),[t,i]=$(void 0),[l,r]=$(void 0),[a,c]=$(void 0),[g,f]=$({}),[p,m]=$(!1),[d,b]=$(void 0),h=async(y,N)=>{o(!0),i(y),r(N),c(void 0),f({}),b(void 0),m(!0);try{const E=await e.query(Ds,{table:y},he(N)),{columns:S}=E;c(S);const C={},k=S.filter(A=>A.ref!==void 0&&A.type==="id"&&A.pk!==!0);for(const A of k){if(A.ref===void 0)continue;const{ref:D}=A;if(C[D]===void 0)try{const _=await e.query(Is,{filters:[],limit:ls,offset:0,search:"",table:D},he(N));C[D]=_.rows.flatMap(I=>As(I)||[])}catch{C[D]=[]}}f(C)}catch(E){b(E.message)}m(!1)};return{closeDialog:()=>{o(!1),i(void 0),r(void 0),c(void 0),f({}),b(void 0)},columnMeta:a,error:d,fkPools:g,insertBatch:async(y,N)=>{if(t===void 0||l===void 0)return{conflicts:0,error:"No table selected.",inserted:0};try{const E=await e.query(Ms,{rows:y.map(C=>({doc:C,table:t}))},he(l)),S=Ps(E);return S.error!==void 0||(N(),s()),S}catch(E){return{conflicts:0,error:E.message,inserted:0}}},loading:p,open:n,openDialog:(y,N)=>{ie(h(y,N))},shardKey:l,table:t}},Fs=()=>{const s=L(6),[e,n]=$(null);let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{n(null)},s[0]=o):o=s[0];const t=o,[i,l]=$(null);let r;s[1]===Symbol.for("react.memo_cache_sentinel")?(r=(p,m)=>{l({column:p,value:m})},s[1]=r):r=s[1];const a=r;let c;s[2]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{l(null)},s[2]=c):c=s[2];const g=c;let f;return s[3]!==i||s[4]!==e?(f={closeExpandedCell:g,closeInspect:t,expandedCell:i,inspecting:e,onExpandCell:a,onInspect:n},s[3]=i,s[4]=e,s[5]=f):f=s[5],f},Ls=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,Vs=(s,e)=>typeof e=="number"&&Ls.test(s),Bs=s=>{const e=L(31),{column:n,masked:o,onNavigate:t,target:i,value:l}=s;let r;e[0]!==t||e[1]!==i||e[2]!==l?(r=()=>{i!==void 0&&t(i,String(l))},e[0]=t,e[1]=i,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=u("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=Be(l),e[5]=l,e[6]=p):p=e[6];let m;return e[7]!==f||e[8]!==p?(m=u("span",{className:"italic text-muted-foreground","data-testid":f,title:"Masked (preview)",children:p}),e[7]=f,e[8]=p,e[9]=m):m=e[9],m}if(i!==void 0&&(typeof l=="string"||typeof l=="number")&&String(l)!==""){const f=`rd-ref-${n}`,p=`Open ${i} ${String(l)}`,m=String(l);let d;return e[10]!==a||e[11]!==f||e[12]!==p||e[13]!==m?(d=T("button",{"data-testid":f,onClick:a,title:p,type:"button",children:[m," ↗"]}),e[10]=a,e[11]=f,e[12]=p,e[13]=m,e[14]=d):d=e[14],d}if(Vs(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 m;e[17]!==l?(m=wn(l),e[17]=l,e[18]=m):m=e[18];let d;return e[19]!==f||e[20]!==p||e[21]!==m?(d=u("span",{"data-testid":f,title:p,children:m}),e[19]=f,e[20]=p,e[21]=m,e[22]=d):d=e[22],d}if(typeof l=="object"){let f;e[23]!==l?(f=JSON.stringify(l,null,2),e[23]=l,e[24]=f):f=e[24];let p;return e[25]!==f?(p=u("pre",{className:"m-0 overflow-auto rounded-md bg-muted/50 p-2 text-xs",children:f}),e[25]=f,e[26]=p):p=e[26],p}let c;e[27]!==l?(c=Be(l),e[27]=l,e[28]=c):c=e[28];let g;return e[29]!==c?(g=u("span",{children:c}),e[29]=c,e[30]=g):g=e[30],g},zs=s=>{const e=L(23),{columns:n,mask:o,onClose:t,onNavigate:i,refs:l,row:r}=s;let a;e[0]!==t||e[1]!==i?(a=(b,h)=>{i(b,h),t()},e[0]=t,e[1]=i,e[2]=a):a=e[2];const c=a;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=u("h3",{className:"m-0 text-base text-foreground",children:"Row detail"}),e[3]=g):g=e[3];let f;e[4]!==t?(f=T("div",{className:"mb-3 flex items-center justify-between",children:[g,u("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]!==c||e[9]!==l||e[10]!==r){let b;e[12]!==o||e[13]!==c||e[14]!==l||e[15]!==r?(b=h=>T("div",{className:"border-t border-border py-2 first:border-t-0","data-testid":`rd-field-${h}`,children:[u("dt",{className:"mb-0.5 text-xs font-semibold text-muted-foreground",children:h}),u("dd",{className:"m-0",children:u(Bs,{column:h,masked:o.enabled&&o.columns.has(h),onNavigate:c,target:l?.[h],value:r[h]})})]},h),e[12]=o,e[13]=c,e[14]=l,e[15]=r,e[16]=b):b=e[16],p=n.map(b),e[6]=n,e[7]=o,e[8]=c,e[9]=l,e[10]=r,e[11]=p}else p=e[11];let m;e[17]!==p?(m=u("dl",{"data-testid":"rd-fields",children:p}),e[17]=p,e[18]=m):m=e[18];let d;return e[19]!==t||e[20]!==f||e[21]!==m?(d=T(wt,{label:"Row detail",onClose:t,panelTestId:"rd-panel",testId:"rd-overlay",variant:"drawer",children:[f,m]}),e[19]=t,e[20]=f,e[21]=m,e[22]=d):d=e[22],d},js=50,Gs=s=>{const e=L(8),{active:n,onPick:o,shard:t}=s;let i;e[0]!==o||e[1]!==t?(i=()=>{o(t)},e[0]=o,e[1]=t,e[2]=i):i=e[2];const l=i,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 c;return e[3]!==l||e[4]!==t||e[5]!==r||e[6]!==a?(c=u("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]=c):c=e[7],c},qs=({onFetchTables:s,onSelect:e})=>{const n=ne(),[o]=$(()=>Jn()),[t,i]=$(!1),[l,r]=$(void 0),[a,c]=$(void 0),[g,f]=$(!1),[p,m]=$(void 0),d=Qe(0),b=()=>{i(x=>!x)},h=async x=>{e(x),r(x),c(void 0),m(void 0),f(!0),d.current+=1;const w=d.current;try{const y=await s(x);d.current===w&&c(y?.slice(0,js))}catch(y){d.current===w&&m(y.message)}d.current===w&&f(!1)},v=x=>{ie(h(x))};return o.length===0?null:T("div",{"data-testid":"shard-explorer",children:[T("button",{"aria-controls":"shard-explorer-panel","aria-expanded":t,className:"inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"shard-explorer-toggle",onClick:b,type:"button",children:[n("Shards seen"),u("span",{"aria-hidden":"true",className:`ml-0.5 transition-transform ${t?"rotate-180":""}`,children:"▾"})]}),t&&T("div",{className:"mt-1 flex flex-col gap-1 rounded-md border border-border bg-popover p-2","data-testid":"shard-explorer-panel",id:"shard-explorer-panel",children:[u("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-hint",children:n("Recently visited shards — click to switch")}),u("ul",{className:"flex flex-col gap-0.5","data-testid":"shard-explorer-list",children:o.map(x=>u("li",{children:u(Gs,{active:l===x,onPick:v,shard:x})},x))}),l!==void 0&&T("div",{className:"mt-1 border-t border-border pt-1","data-testid":"shard-explorer-summary",children:[u("p",{className:"mb-1 text-xs font-medium text-foreground","data-testid":"shard-explorer-summary-title",children:n("{shard} tables",{shard:l})}),g&&u("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-loading",children:n("Loading…")}),p!==void 0&&u("p",{className:"text-xs text-destructive","data-testid":"shard-explorer-error",role:"alert",children:p}),!g&&p===void 0&&a?.length===0&&u("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-empty",children:n("No tables in this shard.")}),!g&&p===void 0&&a!==void 0&&a.length>0&&u("ul",{className:"flex flex-col gap-0.5","data-testid":"shard-explorer-tables",children:a.map(x=>T("li",{className:"flex items-center justify-between text-xs",children:[u("span",{"data-testid":`shard-explorer-table-${x.name}`,children:x.name}),u("span",{className:"text-muted-foreground","data-testid":`shard-explorer-rowcount-${x.name}`,children:x.rowCount})]},x.name))})]})]})]})},Js="lunora-studio-back-relations",Ks={},Ws=50,Hs=[],Us=Se(te.listTables),Qs=Se(te.readTablePage),Ys=s=>{const e=L(10),{onFetchShardTables:n,onShardChange:o,schemaSwitch:t,shardKey:i}=s;let l;e[0]!==o||e[1]!==i?(l=u(xn,{onChange:o,testId:"db-shard-input",value:i}),e[0]=o,e[1]=i,e[2]=l):l=e[2];let r;e[3]!==n||e[4]!==o?(r=u(qs,{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=T("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},kl=({editable:s=!1,globalTableNames:e,initialFilters:n,initialOrderBy:o,initialPins:t,initialSearch:i,initialShardKey:l,onNavigateToGlobal:r,onSelectTable:a,onViewChange:c,pageSize:g=Ws,queryBar:f,schemaSwitch:p,tableParam:m})=>{const b=et(te.describeTables,{},{shardKey:l??""}).data?.columnsByTable??Ks,[h,v]=Ft(Js,{}),x=ot(O=>{const Y=new Set(h[O]);return Et(O,b).filter(ye=>Y.has(Ct(ye)))},[h,b]),w=Ts({initialFilters:n,initialOrderBy:o,initialSearch:i,initialShardKey:l,onSelectTable:a,onViewChange:c,pageSize:g,resolveBackRelations:x,tableParam:m}),{cancelCellEdit:y,columns:N,currentView:E,editableColumn:S,editingCell:C,facetFilter:k,facets:A,loadTables:D,navigateToRef:_,onFiltersChange:I,page:R,pageError:z,previewRef:F,queryShardKey:j,selectedTable:P,selectTable:J,setShardKey:H,shardKey:q,stage:X,stagedValue:Ne,startCellEdit:re,tables:xe,tablesError:ve,toggleFacet:ke}=w,ce=En(q),Te=O=>{ie((async()=>{const ye=await ce.suggestFilter(O,P??"");ye!==void 0&&I(ye.map(De=>{const Oe=De.value,Xe=typeof Oe=="string"||typeof Oe=="number"||typeof Oe=="boolean"?String(Oe):"";return{column:De.column,operator:De.operator,value:Xe}}))})())},de=P===null?[]:Et(P,b),ee=new Set(h[P??""]),Ee=[];for(const O of R?.rows??[]){const Y=O._id??O.id;typeof Y=="string"&&Y!==""&&Ee.push(Y)}const ue=fs(ee,de,Ee,j),fe=O=>{v(Y=>{const ye=P??"",De=Y[ye]??[];return{...Y,[ye]:De.includes(O)?De.filter(Oe=>Oe!==O):[...De,O]}})},oe=_s({columns:N,initialPins:t,selectedTable:P}),me=Fs(),[U,G]=$(null),{closeExpandedCell:we,closeInspect:se,expandedCell:ge,inspecting:le,onExpandCell:K}=me,Z=lt(),Q=Object.fromEntries((b[P??""]??[]).map(O=>[O.name,O])),B=new Map;for(const O of b[P??""]??[])O.isStorage===!0&&B.set(O.name,O.bucket);const pe=ot(async(O,Y)=>Z.signedStorageUrl(O,Y===void 0?{}:{bucket:Y}),[Z]),W=async O=>await Z.query(Us,{},he(O)),Ae=()=>{P!==null&&J(P)},{closeDialog:Re,columnMeta:$e,fkPools:Pe,insertBatch:ze,open:be,openDialog:je}=Os(Ae),Le=()=>{P!==null&&je(P,q)},Ke=O=>ze(O,Re),We=(O,Y)=>{if(r!==void 0&&e?.has(O)===!0){r(O,Y);return}_(O,Y)},He=f?.onSaveQuery,rt=O=>{He?.(O,E)},at={cancelEdit:y,editable:s,editableColumn:S,editingCell:C,onExpandCell:K,stage:X,stagedValue:Ne,startEdit:re},it=O=>{O!==null&&G(O)},ct=()=>{w.onRowDelete(U)},dt=async(O,Y,ye)=>await Z.query(Qs,{filters:[{column:Y,operator:"eq",value:ye}],limit:tt,offset:0,orderBy:[],table:O},he(j)),Ye={columns:R?.refs,maskViewFor:oe.maskViewFor,onNavigate:We,onPreview:F};return T("div",{className:"flex h-full min-w-0","data-testid":"lunora-data-browser",children:[u(kn,{header:u(Ys,{onFetchShardTables:W,onShardChange:H,schemaSwitch:p,shardKey:q}),onReload:D,onSelect:J,prefix:"db",selected:P,tables:xe??Hs}),T("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[ve!==null&&u("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"db-tables-error",role:"alert",children:ve}),R===null&&z===null&&u("div",{className:"flex flex-1 items-center justify-center p-6",children:u("p",{className:"text-sm text-muted-foreground",children:"Select a table to browse its rows."})}),z!==null&&u("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"db-page-error",role:"alert",children:z}),R!==null&&u(os,{assistant:ce,backRelations:{available:de,counts:ue,enabled:ee,onToggle:fe},browser:w,columnMeta:Q,edit:at,editable:s,onAskAiFilter:Te,onInspect:me.onInspect,onOpenGenerateRows:Le,onRowDelete:it,onSaveQuery:rt,page:R,preferences:oe,queryBar:f,references:Ye})]}),R!==null&&u(Tn,{columns:N,facets:A,mask:oe.maskView,onFacetFilter:k,onToggleFacet:ke}),le!==null&&R!==null&&u(zs,{columns:R.columns,mask:oe.maskView,onClose:se,onNavigate:We,refs:R.refs,row:Lt(le,oe.maskView)}),U!==null&&P!==null&&u(no,{onClose:()=>{G(null)},onConfirm:ct,readPage:dt,rowId:U,schema:Kn(b),table:P}),ge!==null&&u(Vn,{bucket:B.get(ge.column),column:ge.column,onClose:we,resolveUrl:B.has(ge.column)?pe:void 0,value:ge.value}),be&&P!==null&&$e!==void 0&&u(ds,{columns:$e,fkPools:Pe,onClose:Re,onInsertRows:Ke,table:P})]})};export{kl as DataBrowser};
@@ -1 +0,0 @@
1
- import{c as Q}from"react/compiler-runtime";import{useLunora as A}from"@lunora/react";import{useQueryClient as g,useQuery as R,keepPreviousData as _}from"@tanstack/react-query";import{useState as M,useEffect as P}from"react";import{c as b,d as v,f as I,b as T}from"./internal-CwaF9YNk.mjs";const S=300,l=e=>typeof e=="string"?e===""?void 0:e:typeof e=="number"||typeof e=="boolean"?String(e):void 0,d=e=>e.filter(t=>t!==void 0).join(" "),K={deleteRows:e=>d([l(e.table),Array.isArray(e.ids)?`${String(e.ids.length)} rows`:void 0]),facetColumn:e=>d([l(e.table),l(e.column)]),lintSql:()=>"sql",readTablePage:e=>d([l(e.table),Array.isArray(e.filters)&&e.filters.length>0?`${String(e.filters.length)} filters`:void 0,typeof e.search=="string"&&e.search!==""?"search":void 0,typeof e.limit=="number"?`limit ${String(e.limit)}`:void 0]),runMigration:e=>d([l(e.id),l(e.direction),e.dryRun===!0?"dry-run":void 0]),runSql:e=>typeof e.sql=="string"?`${String(e.sql.length)} chars`:"",schemaVersion:e=>typeof e.hash=="string"?e.hash.slice(0,8):"",writeRow:e=>d([l(e.table),"1 row"])},q="__lunora_admin__:",j=(e,t)=>{const r=e.startsWith(q)?e.slice(q.length):e,s=K[r];if(s!==void 0)return s(t);const i=Object.keys(t);return i.length===0?"":i.join(", ")},x=e=>{if(Array.isArray(e))return e.length;if(!(typeof e!="object"||e===null)){for(const t of Object.values(e))if(Array.isArray(t))return t.length}};class C{entries=[];listeners=new Set;nextSeq=1;getSnapshot=()=>this.entries;subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});start(t,r,s){return this.append(t,r,s,"call","pending")}startSubscription(t,r,s){return this.append(t,r,s,"subscription","live")}recordPush(t){if(this.listeners.size===0){const r=this.entries.find(s=>s.seq===t);r!==void 0&&(r.pushes=(r.pushes??0)+1);return}this.patch(t,r=>({...r,pushes:(r.pushes??0)+1}))}failSubscription(t,r){this.patch(t,s=>({...s,error:r,status:"error"}))}endSubscription(t){this.patch(t,r=>r.status==="error"?r:{...r,durationMs:Date.now()-r.startedAt,status:"closed"})}lastErrorSeq(){return this.entries.findLast(t=>t.status==="error")?.seq}settle(t,r){this.patch(t,s=>({...s,durationMs:Date.now()-s.startedAt,...r.error===void 0?{resultCount:x(r.result),status:"ok"}:{error:r.error,status:"error"}}))}clear(){this.entries=[],this.emit()}append(t,r,s,i,n){const u=this.nextSeq;this.nextSeq+=1;const c={functionPath:t,kind:i,seq:u,shardKey:s,startedAt:Date.now(),status:n,summary:j(t,r),...i==="subscription"?{pushes:0}:{}},o=[...this.entries,c];return this.entries=o.length>S?o.slice(o.length-S):o,this.emit(),u}patch(t,r){const s=this.entries.findIndex(i=>i.seq===t);s!==-1&&(this.entries=this.entries.with(s,r(this.entries[s])),this.emit())}emit(){for(const t of this.listeners)t()}}const f=new C,w=(e,t,r)=>["lunora-admin",e,t,r.trim()],E=(e,t)=>[...e,t];function F(e,t,r={}){const s=A(),{enabled:i=!0,keepPreviousData:n=!1,staleTime:u=0}=r,c=E(e,s.clientIdentifier()),a=R({enabled:i,queryFn:t,placeholderData:n?_:void 0,queryKey:c,staleTime:u});return{data:a.data,error:a.error?T(a.error):a.error,errorSource:a.error??void 0,isLoading:a.isLoading,liveError:void 0,refetch:()=>{I(a.refetch())}}}function J(e,t,r={}){const s=A(),i=g(),{enabled:n=!0,keepPreviousData:u=!1,live:c=!1,shardKey:o="",staleTime:a}=r,p=w(e,t,o),D=F(p,()=>s.query(b(e),t,v(o)),{enabled:n,keepPreviousData:u,staleTime:a??(c?Number.POSITIVE_INFINITY:0)}),[k,y]=M(void 0),L=JSON.stringify(p);return P(()=>{if(!n||!c)return;y(void 0);const m=f.startSubscription(e,t,o),O=s.subscribe(b(e),t,h=>{f.recordPush(m),y(void 0),i.setQueryData(E(p,s.clientIdentifier()),h)},{...v(o),onError:h=>{f.failSubscription(m,h.message),y(h.message)}});return()=>{f.endSubscription(m),O()}},[L,n,c]),{...D,liveError:n&&c?k:void 0}}const U=()=>{const e=Q(2),t=g();let r;return e[0]!==t?(r=(s,i,n)=>{const u=i===void 0?["lunora-admin",s]:w(s,i,n??"");I(t.invalidateQueries({queryKey:u}))},e[0]=t,e[1]=r):r=e[1],r};export{U as a,F as b,f as o,J as u};
@@ -1 +0,0 @@
1
- const g=e=>{let t="";for(let o=0;o<e.length;o+=32768)t+=String.fromCharCode(...e.subarray(o,o+32768));return btoa(t)},p=e=>{const t=atob(e),a=new Uint8Array(t.length);for(let o=0;o<t.length;o+=1)a[o]=t.codePointAt(o)??0;return a},i="$lunora.wire$";const A="__proto__",m={BigInt64Array,BigUint64Array,Float32Array,Float64Array,Int8Array,Int16Array,Int32Array,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array},w={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},E=e=>{if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype},u=(e,t=0)=>{if(t>64)throw new RangeError("wire-codec: value nesting exceeds the 64-level limit");if(e===void 0)return[i,"undefined"];if(e===null)return null;const a=typeof e;if(a==="bigint")return[i,"bigint",e.toString()];if(a==="number"){const r=e;return Number.isNaN(r)?[i,"nan"]:r===1/0?[i,"inf"]:r===-1/0?[i,"-inf"]:r}if(a!=="object")return e;if(e instanceof Date)return[i,"date",u(e.getTime(),t+1)];if(e instanceof Error){const r=e,n={};for(const y of Object.keys(r))r[y]!==void 0&&(n[y]=u(r[y],t+1));const c=[i,"error",r.name,r.message,n];return r.cause!==void 0&&c.push(u(r.cause,t+1)),c}if(e instanceof URL)return[i,"url",e.href];if(e instanceof Map)return[i,"map",[...e.entries()].map(([r,n])=>[u(r,t+1),u(n,t+1)])];if(e instanceof Set)return[i,"set",[...e].map(r=>u(r,t+1))];if(e instanceof ArrayBuffer)return[i,"bytes",g(new Uint8Array(e)),"ArrayBuffer"];if(ArrayBuffer.isView(e)){const r=e,n=r.constructor.name,c=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);return n==="Uint8Array"?[i,"bytes",g(c)]:[i,"bytes",g(c),n]}if(Array.isArray(e)){const r=e.map(n=>u(n,t+1));return r.length>0&&r[0]===i?[i,"arr",r]:r}if(!E(e)){const r=e.constructor?.name??"value";throw new TypeError(`wire-codec: cannot encode a ${r} over the Lunora wire — only plain objects, arrays, and the supported built-ins (Date, Error, URL, Map, Set, ArrayBuffer/typed arrays, bigint) round-trip`)}const o=e,s={};for(const r of Object.keys(o)){const n=o[r];if(n===void 0)continue;const c=u(n,t+1);r===A?Object.defineProperty(s,r,{configurable:!0,enumerable:!0,value:c,writable:!0}):s[r]=c}return s},f=(e,t=0)=>{if(t>64)throw new RangeError("wire-codec: value nesting exceeds the 64-level limit");if(e===null||typeof e!="object")return e;if(Array.isArray(e)){if(e[0]===i)switch(e[1]){case"-inf":return-1/0;case"arr":return e[2].map(r=>f(r,t+1));case"bigint":{const r=e[2];if(typeof r!="string"||r.length>1024||!/^-?\d+$/.test(r))throw new RangeError("wire-codec: invalid or over-long bigint (max 1024 digits)");return BigInt(r)}case"date":return new Date(f(e[2],t+1));case"map":return new Map(e[2].map(([r,n])=>[f(r,t+1),f(n,t+1)]));case"set":return new Set(e[2].map(r=>f(r,t+1)));case"url":return new URL(e[2]);case"error":{const r=e[2],n=e[3],c=(Object.hasOwn(w,r)?w[r]:void 0)??Error,y=new c(n);y.name!==r&&Object.defineProperty(y,"name",{configurable:!0,value:r,writable:!0});const d=f(e[4],t+1);for(const b of Object.keys(d))b===A?Object.defineProperty(y,b,{configurable:!0,enumerable:!0,value:d[b],writable:!0}):y[b]=d[b];return e.length>5&&Object.defineProperty(y,"cause",{configurable:!0,value:f(e[5],t+1),writable:!0}),y}case"bytes":{const r=p(e[2]),n=e[3]??"Uint8Array";if(n==="ArrayBuffer")return r.buffer.byteLength===r.byteLength?r.buffer:r.slice().buffer;const c=Object.hasOwn(m,n)?m[n]:void 0;return c?new c(r.slice().buffer):r}case"inf":return 1/0;case"nan":return Number.NaN;case"undefined":return;default:return e.map(r=>f(r,t+1))}return e.map(s=>f(s,t+1))}const a=e,o={};for(const s of Object.keys(a)){const r=f(a[s],t+1);s===A?Object.defineProperty(o,s,{configurable:!0,enumerable:!0,value:r,writable:!0}):o[s]=r}return o},l=e=>{try{const t=f(JSON.parse(e));return E(t)?t:void 0}catch{return}};export{f as a,l as d,u as e,E as i};
@@ -1 +0,0 @@
1
- import{b as P,c as v,d as I,f as g}from"./chunk-JBIN7W2B.js";import{f as S,g as q,h as k,o as w}from"./chunk-Y4Q25F6X.js";import{a as i,d as D,e as N,f as R}from"./chunk-YKXDMIHQ.js";var _=D(R(),1);var p=D(N(),1);var T=300,d=i(t=>typeof t=="string"?t===""?void 0:t:typeof t=="number"||typeof t=="boolean"?String(t):void 0,"l"),c=i(t=>t.filter(e=>e!==void 0).join(" "),"d"),$={deleteRows:i(t=>c([d(t.table),Array.isArray(t.ids)?`${String(t.ids.length)} rows`:void 0]),"deleteRows"),facetColumn:i(t=>c([d(t.table),d(t.column)]),"facetColumn"),lintSql:i(()=>"sql","lintSql"),readTablePage:i(t=>c([d(t.table),Array.isArray(t.filters)&&t.filters.length>0?`${String(t.filters.length)} filters`:void 0,typeof t.search=="string"&&t.search!==""?"search":void 0,typeof t.limit=="number"?`limit ${String(t.limit)}`:void 0]),"readTablePage"),runMigration:i(t=>c([d(t.id),d(t.direction),t.dryRun===!0?"dry-run":void 0]),"runMigration"),runSql:i(t=>typeof t.sql=="string"?`${String(t.sql.length)} chars`:"","runSql"),schemaVersion:i(t=>typeof t.hash=="string"?t.hash.slice(0,8):"","schemaVersion"),writeRow:i(t=>c([d(t.table),"1 row"]),"writeRow")},E="__lunora_admin__:",F=i((t,e)=>{let r=t.startsWith(E)?t.slice(E.length):t,s=$[r];if(s!==void 0)return s(e);let o=Object.keys(e);return o.length===0?"":o.join(", ")},"j"),C=i(t=>{if(Array.isArray(t))return t.length;if(!(typeof t!="object"||t===null)){for(let e of Object.values(t))if(Array.isArray(e))return e.length}},"x"),A=class{static{i(this,"C")}entries=[];listeners=new Set;nextSeq=1;getSnapshot=i(()=>this.entries,"getSnapshot");subscribe=i(e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}),"subscribe");start(e,r,s){return this.append(e,r,s,"call","pending")}startSubscription(e,r,s){return this.append(e,r,s,"subscription","live")}recordPush(e){if(this.listeners.size===0){let r=this.entries.find(s=>s.seq===e);r!==void 0&&(r.pushes=(r.pushes??0)+1);return}this.patch(e,r=>({...r,pushes:(r.pushes??0)+1}))}failSubscription(e,r){this.patch(e,s=>({...s,error:r,status:"error"}))}endSubscription(e){this.patch(e,r=>r.status==="error"?r:{...r,durationMs:Date.now()-r.startedAt,status:"closed"})}lastErrorSeq(){return this.entries.findLast(e=>e.status==="error")?.seq}settle(e,r){this.patch(e,s=>({...s,durationMs:Date.now()-s.startedAt,...r.error===void 0?{resultCount:C(r.result),status:"ok"}:{error:r.error,status:"error"}}))}clear(){this.entries=[],this.emit()}append(e,r,s,o,a){let u=this.nextSeq;this.nextSeq+=1;let l={functionPath:e,kind:o,seq:u,shardKey:s,startedAt:Date.now(),status:a,summary:F(e,r),...o==="subscription"?{pushes:0}:{}},n=[...this.entries,l];return this.entries=n.length>T?n.slice(n.length-T):n,this.emit(),u}patch(e,r){let s=this.entries.findIndex(o=>o.seq===e);s!==-1&&(this.entries=this.entries.with(s,r(this.entries[s])),this.emit())}emit(){for(let e of this.listeners)e()}},f=new A,j=i((t,e,r)=>["lunora-admin",t,e,r.trim()],"w"),x=i((t,e)=>[...t,e],"E");function J(t,e,r={}){let s=g(),{enabled:o=!0,keepPreviousData:a=!1,staleTime:u=0}=r,l=x(t,s.clientIdentifier()),n=I({enabled:o,queryFn:e,placeholderData:a?P:void 0,queryKey:l,staleTime:u});return{data:n.data,error:n.error?k(n.error):n.error,errorSource:n.error??void 0,isLoading:n.isLoading,liveError:void 0,refetch:i(()=>{w(n.refetch())},"refetch")}}i(J,"F");function W(t,e,r={}){let s=g(),o=v(),{enabled:a=!0,keepPreviousData:u=!1,live:l=!1,shardKey:n="",staleTime:K}=r,m=j(t,e,n),L=J(m,()=>s.query(S(t),e,q(n)),{enabled:a,keepPreviousData:u,staleTime:K??(l?Number.POSITIVE_INFINITY:0)}),[O,y]=(0,p.useState)(void 0),Q=JSON.stringify(m);return(0,p.useEffect)(()=>{if(!a||!l)return;y(void 0);let b=f.startSubscription(t,e,n),M=s.subscribe(S(t),e,h=>{f.recordPush(b),y(void 0),o.setQueryData(x(m,s.clientIdentifier()),h)},{...q(n),onError:i(h=>{f.failSubscription(b,h.message),y(h.message)},"onError")});return()=>{f.endSubscription(b),M()}},[Q,a,l]),{...L,liveError:a&&l?O:void 0}}i(W,"J");var Y=i(()=>{let t=(0,_.c)(2),e=v(),r;return t[0]!==e?(r=i((s,o,a)=>{let u=o===void 0?["lunora-admin",s]:j(s,o,a??"");w(e.invalidateQueries({queryKey:u}))},"r"),t[0]=e,t[1]=r):r=t[1],r},"U");export{f as a,J as b,W as c,Y as d};