@lunora/studio 1.0.0-alpha.327 → 1.0.0-alpha.329

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 (62) hide show
  1. package/dist/standalone/{chunk-3G52JQDE.js → chunk-2A7MUTXH.js} +1 -1
  2. package/dist/standalone/{chunk-4WVVQII7.js → chunk-2X5KA4QQ.js} +1 -1
  3. package/dist/standalone/{chunk-C4ZPJ4KT.js → chunk-3INTX6UT.js} +1 -1
  4. package/dist/standalone/{chunk-HM6K7CGB.js → chunk-3N44IWPE.js} +1 -1
  5. package/dist/standalone/{chunk-GIE6BF2N.js → chunk-3QL4ND7D.js} +1 -1
  6. package/dist/standalone/{chunk-GAW73INZ.js → chunk-3QV7HHQG.js} +1 -1
  7. package/dist/standalone/{chunk-OCCAELSS.js → chunk-5S45W3DS.js} +1 -1
  8. package/dist/standalone/{chunk-F2632QSD.js → chunk-6NM256XN.js} +1 -1
  9. package/dist/standalone/{chunk-SWRJFAMY.js → chunk-6RZVYKOR.js} +1 -1
  10. package/dist/standalone/{chunk-L7D3XUSL.js → chunk-6W4HLFYQ.js} +1 -1
  11. package/dist/standalone/{chunk-OIX2HXFZ.js → chunk-7EX5FYKJ.js} +1 -1
  12. package/dist/standalone/{chunk-6LAOOCDD.js → chunk-7KGJZ7AR.js} +1 -1
  13. package/dist/standalone/{chunk-VA2K2MGN.js → chunk-7VIAQGP3.js} +1 -1
  14. package/dist/standalone/{chunk-LS37O7PT.js → chunk-A3V7GS5F.js} +1 -1
  15. package/dist/standalone/{chunk-G7HELO37.js → chunk-AQOISTOA.js} +1 -1
  16. package/dist/standalone/{chunk-TYDCG5RQ.js → chunk-AXODHTFK.js} +1 -1
  17. package/dist/standalone/{chunk-P32XL2PD.js → chunk-B545WZOQ.js} +1 -1
  18. package/dist/standalone/{chunk-CJXS7ZFK.js → chunk-BVCS2OKM.js} +1 -1
  19. package/dist/standalone/chunk-C36GGBU5.js +9 -0
  20. package/dist/standalone/{chunk-FZHX4SU4.js → chunk-CQQ6GJY4.js} +1 -1
  21. package/dist/standalone/{chunk-EKKX6QM5.js → chunk-CWIHIVUM.js} +1 -1
  22. package/dist/standalone/{chunk-WQSX6BFJ.js → chunk-CZKPLENB.js} +1 -1
  23. package/dist/standalone/{chunk-X7UBUDG2.js → chunk-D63COTYE.js} +1 -1
  24. package/dist/standalone/{chunk-NP3PMKD7.js → chunk-D74GLIZ3.js} +1 -1
  25. package/dist/standalone/{chunk-LCA6DK6F.js → chunk-DUEZHBXW.js} +1 -1
  26. package/dist/standalone/{chunk-4OPMHED5.js → chunk-EJGPVJWW.js} +1 -1
  27. package/dist/standalone/{chunk-OP5AKUEV.js → chunk-FOW5IME7.js} +1 -1
  28. package/dist/standalone/{chunk-HPXALQPF.js → chunk-FQZPHXRY.js} +1 -1
  29. package/dist/standalone/{chunk-NRJY6XLS.js → chunk-FZMPKYDN.js} +1 -1
  30. package/dist/standalone/{chunk-ABBJRINK.js → chunk-GKXBHP5C.js} +1 -1
  31. package/dist/standalone/{chunk-BBJAUO6Q.js → chunk-H3O25TSD.js} +1 -1
  32. package/dist/standalone/{chunk-7XM3Z7IQ.js → chunk-HIS2QOIN.js} +1 -1
  33. package/dist/standalone/{chunk-PUOC4Q55.js → chunk-I5HQKJIE.js} +1 -1
  34. package/dist/standalone/{chunk-XBPVXRYQ.js → chunk-KGHRCSAH.js} +1 -1
  35. package/dist/standalone/{chunk-OBIZNIQG.js → chunk-LPQKR3EY.js} +1 -1
  36. package/dist/standalone/{chunk-ZCC25Q2H.js → chunk-M4EGHOJK.js} +1 -1
  37. package/dist/standalone/{chunk-YUNCGMB2.js → chunk-M5NO6HJW.js} +1 -1
  38. package/dist/standalone/{chunk-EYX7T7D6.js → chunk-MBW6E2H5.js} +1 -1
  39. package/dist/standalone/{chunk-GXJA7VNB.js → chunk-O7IHOSPM.js} +1 -1
  40. package/dist/standalone/{chunk-UYLNH4SJ.js → chunk-OOEPWT7Q.js} +1 -1
  41. package/dist/standalone/{chunk-W5CE7LGU.js → chunk-P3T2TLBH.js} +1 -1
  42. package/dist/standalone/{chunk-VKQCSJMV.js → chunk-PZKQMSHC.js} +1 -1
  43. package/dist/standalone/{chunk-XUBHW2IG.js → chunk-Q3QEBLD4.js} +1 -1
  44. package/dist/standalone/{chunk-ARXLF43Z.js → chunk-Q4IPXFP3.js} +1 -1
  45. package/dist/standalone/{chunk-BKAIQ3EW.js → chunk-Q7DBKLSB.js} +1 -1
  46. package/dist/standalone/{chunk-HAAMTGU2.js → chunk-QJAHVMEQ.js} +1 -1
  47. package/dist/standalone/{chunk-BZSLOCHA.js → chunk-RSPLE3QM.js} +1 -1
  48. package/dist/standalone/{chunk-UBZRQ3Z6.js → chunk-RYIJBW4I.js} +1 -1
  49. package/dist/standalone/{chunk-XDSDUCPP.js → chunk-SAMGHROD.js} +1 -1
  50. package/dist/standalone/{chunk-JW5LYFFK.js → chunk-SCOPHATU.js} +1 -1
  51. package/dist/standalone/{chunk-KQZL4DGC.js → chunk-SLD4Y7CB.js} +1 -1
  52. package/dist/standalone/{chunk-GWN7ZBB6.js → chunk-U27WIISY.js} +1 -1
  53. package/dist/standalone/{chunk-HCM7G3LJ.js → chunk-UB6IGAMO.js} +1 -1
  54. package/dist/standalone/{chunk-PWNGXOCF.js → chunk-UBTQ3IAP.js} +1 -1
  55. package/dist/standalone/{chunk-B6ATVGZY.js → chunk-VJIYYQZP.js} +1 -1
  56. package/dist/standalone/{chunk-JLACL25R.js → chunk-VMCP3XCC.js} +1 -1
  57. package/dist/standalone/{chunk-WCTMLOQC.js → chunk-XOVK37LR.js} +1 -1
  58. package/dist/standalone/{chunk-7ULZKZQQ.js → chunk-XR4FVOPT.js} +1 -1
  59. package/dist/standalone/{chunk-J7UN5TFS.js → chunk-ZGUIX5JS.js} +1 -1
  60. package/dist/standalone/studio.js +1 -1
  61. package/package.json +5 -5
  62. package/dist/standalone/chunk-DTFIEXYN.js +0 -9
@@ -1 +1 @@
1
- import{a as O}from"./chunk-JQXA2OYK.js";import{a as H}from"./chunk-I23ULEUU.js";import{a as ee}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as Z}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{b as E}from"./chunk-C4ZPJ4KT.js";import{l as R}from"./chunk-DTFIEXYN.js";import"./chunk-QAQDMS6R.js";import"./chunk-WS7WNXF3.js";import{a as _}from"./chunk-RWVIV3U7.js";import{a as K,b as V,c as z,d as F,e as u,f as p}from"./chunk-HCTJKP5J.js";import{a as A,e as T}from"./chunk-2IKDEUCX.js";import{d as M,h as G,p as W,t as X}from"./chunk-5OMZCVRF.js";import{a as c,d as P,e as oe,f as re,g as ae}from"./chunk-I26MS5PJ.js";var U=P(re(),1),Y=P(oe(),1);var t=P(ae(),1);var se=P(re(),1);var Q=P(oe(),1);var h=P(ae(),1);var ie=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","X"),le=c(a=>a.toSorted((e,i)=>e.scheduledFor-i.scheduledFor),"F"),ce=c((a,e,i)=>e!==void 0?e:i===void 0?d=>a.cancelScheduledJob(d):void 0,"Y"),de=c(a=>{let e=(0,se.c)(16),{cancelJob:i,loadJobs:d}=a===void 0?{}:a,f=R(),r=M(),l=d===void 0,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-scheduled-jobs"],e[0]=o):o=e[0];let N=E(o,async()=>{let v=await(d??(()=>f.listScheduledJobs()))();return le(v)}),[x,n]=(0,Q.useState)(void 0),[s,m]=(0,Q.useState)(void 0),y,k;e[1]!==f||e[2]!==l?(y=c(()=>{if(l)return f.subscribeScheduledJobs(v=>{m(void 0),n(le(v))})},"v"),k=[l,f],e[1]=f,e[2]=l,e[3]=y,e[4]=k):(y=e[3],k=e[4]),(0,Q.useEffect)(y,k);let g;e[5]!==N?(g=c(()=>{N.refetch()},"y"),e[5]=N,e[6]=g):g=e[6],O(g,!l);let J=ce(f,i,d),b=x??N.data,j=s??N.error,I=c(async v=>{if(J!==void 0){m(void 0);try{await J(v),l||N.refetch()}catch(D){m(G(D))}}},"A"),q="flex flex-col gap-3",B="lunora-scheduled-jobs",S;e[7]!==j?(S=j!==null&&(0,h.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:j}),e[7]=j,e[8]=S):S=e[8];let L;e[9]!==b?.length||e[10]!==r?(L=b?.length===0&&(0,h.jsx)(_,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,h.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,h.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,h.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=b?.length,e[10]=r,e[11]=L):L=e[11];let $=b!==void 0&&b.length>0&&(0,h.jsx)(A,{className:"overflow-hidden py-0",children:(0,h.jsx)(T,{className:"px-0",children:(0,h.jsxs)(K,{"data-testid":"sj-table",children:[(0,h.jsx)(V,{children:(0,h.jsxs)(F,{children:[(0,h.jsx)(u,{children:r("function")}),(0,h.jsx)(u,{children:r("scheduled for")}),(0,h.jsx)(u,{children:r("pool")}),(0,h.jsx)(u,{children:r("attempts")}),(0,h.jsx)(u,{children:r("shard")}),(0,h.jsx)(u,{children:r("id")}),J!==void 0&&(0,h.jsx)(u,{"aria-label":r("Actions")})]})}),(0,h.jsx)(z,{children:b.map(v=>(0,h.jsxs)(F,{"data-testid":`sj-row-${v.id}`,children:[(0,h.jsx)(p,{className:"font-mono text-xs",children:v.workflow??v.functionPath}),(0,h.jsx)(p,{className:"text-muted-foreground tabular-nums",children:ie(v.scheduledFor)}),(0,h.jsx)(p,{className:"font-mono text-xs",children:v.pool??""}),(0,h.jsx)(p,{className:"tabular-nums",children:v.attempts??0}),(0,h.jsx)(p,{children:v.shardKey??""}),(0,h.jsx)(p,{className:"font-mono text-xs",children:v.id}),J!==void 0&&(0,h.jsx)(p,{className:"text-right",children:(0,h.jsx)(H,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{W(I(v.id))},"onConfirm"),testId:`sj-cancel-${v.id}`,children:r("Cancel")})})]},v.id))})]})})}),w;return e[12]!==$||e[13]!==S||e[14]!==L?(w=(0,h.jsxs)("div",{className:q,"data-testid":B,children:[S,L,$]}),e[12]=$,e[13]=S,e[14]=L,e[15]=w):w=e[15],w},"he");var he={kind:"idle"},me=c((a,e,i)=>i!==void 0?i:e===void 0?d=>a.runCronJob(d):void 0,"re"),ue=c(({loadCronJobs:a,runCronJob:e}={})=>{let i=R(),d=M(),[f,r]=(0,Y.useState)({}),l=E(["lunora-cron-jobs",a?"custom":"default"],()=>(a??(()=>i.getCronJobs()))()),{data:o,error:N}=l,x=me(i,a,e),n=c(async s=>{if(x!==void 0){r(m=>({...m,[s]:{kind:"running"}}));try{await x(s),r(m=>({...m,[s]:{kind:"ok"}})),l.refetch()}catch(m){r(y=>({...y,[s]:{kind:"error",message:G(m)}}))}}},"i");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),o?.length===0&&(0,t.jsx)(_,{description:d("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:d("No cron triggers.")}),o!==void 0&&o.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"cron-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:d("name")}),(0,t.jsx)(u,{children:d("schedule")}),(0,t.jsx)(u,{children:d("target")}),(0,t.jsx)(u,{children:d("shard")}),x!==void 0&&(0,t.jsx)(u,{"aria-label":d("Actions")})]})}),(0,t.jsx)(z,{children:o.map(s=>{let m=f[s.name]??he;return(0,t.jsxs)(F,{"data-testid":`cron-row-${s.name}`,children:[(0,t.jsx)(p,{children:s.name}),(0,t.jsx)(p,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,t.jsx)(p,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,t.jsx)(Z,{variant:"outline",children:d("function")}):(0,t.jsx)(Z,{variant:"secondary",children:d("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,t.jsx)(p,{children:s.shardKey??""}),x!==void 0&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[m.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:d("ran")}),m.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:m.message}),(0,t.jsx)(H,{confirmLabel:d("Run now?"),disabled:m.kind==="running",onConfirm:c(()=>{W(n(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:m.kind==="running"?d("Running\u2026"):d("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"le"),pe=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","se"),fe=c(a=>{let e=(0,U.c)(34),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadJobs:d,removeJob:f,retryJob:r}=i,l=R(),o=M(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let x;e[3]!==l||e[4]!==d?(x=c(async()=>(await(d??(()=>l.listDeadJobs()))()).toSorted(be),"h"),e[3]=l,e[4]=d,e[5]=x):x=e[5];let n=E(N,x),s=n.data,[m,y]=(0,Y.useState)(void 0),k=n.error??m,g=d===void 0,J;e[6]!==l||e[7]!==g||e[8]!==r?(J=r??(g?C=>l.retryDeadJob(C):void 0),e[6]=l,e[7]=g,e[8]=r,e[9]=J):J=e[9];let b=J,j;e[10]!==l||e[11]!==g||e[12]!==f?(j=f??(g?C=>l.removeDeadJob(C):void 0),e[10]=l,e[11]=g,e[12]=f,e[13]=j):j=e[13];let I=j,q;e[14]!==n?(q=c(()=>{n.refetch()},"$"),e[14]=n,e[15]=q):q=e[15],O(q,!0);let B;e[16]!==n?(B=c(async C=>{y(void 0);try{await C,n.refetch()}catch(ne){y(G(ne))}},"I"),e[16]=n,e[17]=B):B=e[17];let S=B,L=b!==void 0||I!==void 0,$;e[18]!==k?($=k!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:k}),e[18]=k,e[19]=$):$=e[19];let w;e[20]!==s?.length||e[21]!==o?(w=s?.length===0&&(0,t.jsx)(_,{description:o("Jobs that exhaust their retry budget are parked here instead of being dropped."),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:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:o("No dead-letter jobs.")}),e[20]=s?.length,e[21]=o,e[22]=w):w=e[22];let v;e[23]!==S||e[24]!==L||e[25]!==s||e[26]!==I||e[27]!==b||e[28]!==o?(v=s!==void 0&&s.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"dlq-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:o("function")}),(0,t.jsx)(u,{children:o("attempts")}),(0,t.jsx)(u,{children:o("last tried")}),(0,t.jsx)(u,{children:o("pool")}),(0,t.jsx)(u,{children:o("shard")}),(0,t.jsx)(u,{children:o("id")}),L&&(0,t.jsx)(u,{"aria-label":o("Actions")})]})}),(0,t.jsx)(z,{children:s.map(C=>(0,t.jsxs)(F,{"data-testid":`dlq-row-${C.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:C.workflow??C.functionPath}),(0,t.jsx)(p,{className:"tabular-nums",children:C.attempts??0}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:pe(C.scheduledFor)}),(0,t.jsx)(p,{className:"font-mono text-xs",children:C.pool??""}),(0,t.jsx)(p,{children:C.shardKey??""}),(0,t.jsx)(p,{className:"font-mono text-xs",children:C.id}),L&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[b!==void 0&&(0,t.jsx)(ee,{"data-testid":`dlq-retry-${C.id}`,onClick:c(()=>{W(S(b(C.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Retry")}),I!==void 0&&(0,t.jsx)(H,{confirmLabel:o("Drop job?"),onConfirm:c(()=>{W(S(I(C.id)))},"onConfirm"),testId:`dlq-remove-${C.id}`,children:o("Drop")})]})})]},C.id))})]})})}),e[23]=S,e[24]=L,e[25]=s,e[26]=I,e[27]=b,e[28]=o,e[29]=v):v=e[29];let D;return e[30]!==v||e[31]!==$||e[32]!==w?(D=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,w,v]}),e[30]=v,e[31]=$,e[32]=w,e[33]=D):D=e[33],D},"ne");function be(a,e){return(e.attempts??0)-(a.attempts??0)}c(be,"oe");var te=c(a=>{let e=(0,U.c)(8),{label:i,testId:d,value:f}=a,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==d||e[3]!==f?(l=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":d,children:f}),e[2]=d,e[3]=f,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o=(0,t.jsx)(A,{className:"flex-1 py-0",children:(0,t.jsxs)(T,{className:"flex flex-col gap-1 p-4",children:[r,l]})}),e[5]=r,e[6]=l,e[7]=o):o=e[7],o},"E"),ve=c(a=>{let e=(0,U.c)(25),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadStatus:d}=i,f=R(),r=M(),l=d===void 0,o;e[2]!==l?(o=["lunora-scheduler-status",l],e[2]=l,e[3]=o):o=e[3];let N;e[4]!==f||e[5]!==d?(N=c(async()=>{let j=await(d??(()=>f.schedulerStatus()))();return{...j,pools:j.pools.toSorted(xe)}},"y"),e[4]=f,e[5]=d,e[6]=N):N=e[6];let x=E(o,N),{data:n,error:s}=x,m;e[7]!==x?(m=c(()=>{x.refetch()},"d"),e[7]=x,e[8]=m):m=e[8],O(m,!0);let y;e[9]!==s?(y=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=y):y=e[10];let k;e[11]!==n||e[12]!==r?(k=n!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(te,{label:r("backlog"),testId:"pools-backlog",value:n.backlog}),(0,t.jsx)(te,{label:r("in flight"),testId:"pools-inflight",value:n.inFlight}),(0,t.jsx)(te,{label:r("pools"),testId:"pools-count",value:n.pools.length})]}),e[11]=n,e[12]=r,e[13]=k):k=e[13];let g;e[14]!==n?.pools.length||e[15]!==r?(g=n?.pools.length===0&&(0,t.jsx)(_,{description:r("Pools created with createWorkpool appear here once they have activity."),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:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:r("No workpools.")}),e[14]=n?.pools.length,e[15]=r,e[16]=g):g=e[16];let J;e[17]!==n||e[18]!==r?(J=n!==void 0&&n.pools.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"pools-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:r("pool")}),(0,t.jsx)(u,{children:r("queued")}),(0,t.jsx)(u,{children:r("in flight")}),(0,t.jsx)(u,{children:r("max concurrency")})]})}),(0,t.jsx)(z,{children:n.pools.map(ge)})]})})}),e[17]=n,e[18]=r,e[19]=J):J=e[19];let b;return e[20]!==y||e[21]!==k||e[22]!==g||e[23]!==J?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[y,k,g,J]}),e[20]=y,e[21]=k,e[22]=g,e[23]=J,e[24]=b):b=e[24],b},"ae");function xe(a,e){return e.queued-a.queued}c(xe,"ie");function ge(a){return(0,t.jsxs)(F,{"data-testid":`pools-row-${a.name}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:a.name}),(0,t.jsx)(p,{className:"tabular-nums",children:a.queued}),(0,t.jsxs)(p,{className:"tabular-nums",children:[a.inFlight," / ",a.maxConcurrency]}),(0,t.jsx)(p,{className:"tabular-nums",children:a.maxConcurrency})]},a.name)}c(ge,"de");var Ne=["jobs","dead","pools","cron"],Ve=c(a=>{let e=(0,U.c)(41),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadCronJobs:d,scheduledCancel:f,scheduledLoad:r}=i,l=M(),[o,N]=(0,Y.useState)("jobs"),x;e[2]!==l?(x=l("Cron triggers"),e[2]=l,e[3]=x):x=e[3];let n;e[4]!==l?(n=l("Dead letter"),e[4]=l,e[5]=n):n=e[5];let s;e[6]!==l?(s=l("Scheduled jobs"),e[6]=l,e[7]=s):s=e[7];let m;e[8]!==l?(m=l("Pools"),e[8]=l,e[9]=m):m=e[9];let y;e[10]!==x||e[11]!==n||e[12]!==s||e[13]!==m?(y={cron:x,dead:n,jobs:s,pools:m},e[10]=x,e[11]=n,e[12]=s,e[13]=m,e[14]=y):y=e[14];let k=y,g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=c(w=>{N(w.currentTarget.dataset.view)},"f"),e[15]=g):g=e[15];let J=g,b;e[16]!==l?(b=l("Schedule view"),e[16]=l,e[17]=b):b=e[17];let j;e[18]!==o||e[19]!==k?(j=Ne.map(w=>(0,t.jsx)(ee,{"aria-selected":o===w,"data-testid":`schedule-view-${w}`,"data-view":w,onClick:J,role:"tab",size:"sm",type:"button",variant:o===w?"default":"outline",children:k[w]},w)),e[18]=o,e[19]=k,e[20]=j):j=e[20];let I;e[21]!==b||e[22]!==j?(I=(0,t.jsx)("div",{"aria-label":b,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:j}),e[21]=b,e[22]=j,e[23]=I):I=e[23];let q;e[24]!==f||e[25]!==r||e[26]!==o?(q=o==="jobs"&&(0,t.jsx)(de,{cancelJob:f,loadJobs:r}),e[24]=f,e[25]=r,e[26]=o,e[27]=q):q=e[27];let B;e[28]!==o?(B=o==="dead"&&(0,t.jsx)(fe,{}),e[28]=o,e[29]=B):B=e[29];let S;e[30]!==o?(S=o==="pools"&&(0,t.jsx)(ve,{}),e[30]=o,e[31]=S):S=e[31];let L;e[32]!==d||e[33]!==o?(L=o==="cron"&&(0,t.jsx)(ue,{loadCronJobs:d}),e[32]=d,e[33]=o,e[34]=L):L=e[34];let $;return e[35]!==I||e[36]!==q||e[37]!==B||e[38]!==S||e[39]!==L?($=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[I,q,B,S,L]}),e[35]=I,e[36]=q,e[37]=B,e[38]=S,e[39]=L,e[40]=$):$=e[40],$},"Ie");export{Ve as SchedulePanel};
1
+ import{a as O}from"./chunk-JQXA2OYK.js";import{a as H}from"./chunk-I23ULEUU.js";import{a as ee}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as Z}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{b as E}from"./chunk-3INTX6UT.js";import{l as R}from"./chunk-C36GGBU5.js";import"./chunk-QAQDMS6R.js";import"./chunk-WS7WNXF3.js";import{a as _}from"./chunk-RWVIV3U7.js";import{a as K,b as V,c as z,d as F,e as u,f as p}from"./chunk-HCTJKP5J.js";import{a as A,e as T}from"./chunk-2IKDEUCX.js";import{d as M,h as G,p as W,t as X}from"./chunk-5OMZCVRF.js";import{a as c,d as P,e as oe,f as re,g as ae}from"./chunk-I26MS5PJ.js";var U=P(re(),1),Y=P(oe(),1);var t=P(ae(),1);var se=P(re(),1);var Q=P(oe(),1);var h=P(ae(),1);var ie=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","X"),le=c(a=>a.toSorted((e,i)=>e.scheduledFor-i.scheduledFor),"F"),ce=c((a,e,i)=>e!==void 0?e:i===void 0?d=>a.cancelScheduledJob(d):void 0,"Y"),de=c(a=>{let e=(0,se.c)(16),{cancelJob:i,loadJobs:d}=a===void 0?{}:a,f=R(),r=M(),l=d===void 0,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-scheduled-jobs"],e[0]=o):o=e[0];let N=E(o,async()=>{let v=await(d??(()=>f.listScheduledJobs()))();return le(v)}),[x,n]=(0,Q.useState)(void 0),[s,m]=(0,Q.useState)(void 0),y,k;e[1]!==f||e[2]!==l?(y=c(()=>{if(l)return f.subscribeScheduledJobs(v=>{m(void 0),n(le(v))})},"v"),k=[l,f],e[1]=f,e[2]=l,e[3]=y,e[4]=k):(y=e[3],k=e[4]),(0,Q.useEffect)(y,k);let g;e[5]!==N?(g=c(()=>{N.refetch()},"y"),e[5]=N,e[6]=g):g=e[6],O(g,!l);let J=ce(f,i,d),b=x??N.data,j=s??N.error,I=c(async v=>{if(J!==void 0){m(void 0);try{await J(v),l||N.refetch()}catch(D){m(G(D))}}},"A"),q="flex flex-col gap-3",B="lunora-scheduled-jobs",S;e[7]!==j?(S=j!==null&&(0,h.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:j}),e[7]=j,e[8]=S):S=e[8];let L;e[9]!==b?.length||e[10]!==r?(L=b?.length===0&&(0,h.jsx)(_,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,h.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,h.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,h.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=b?.length,e[10]=r,e[11]=L):L=e[11];let $=b!==void 0&&b.length>0&&(0,h.jsx)(A,{className:"overflow-hidden py-0",children:(0,h.jsx)(T,{className:"px-0",children:(0,h.jsxs)(K,{"data-testid":"sj-table",children:[(0,h.jsx)(V,{children:(0,h.jsxs)(F,{children:[(0,h.jsx)(u,{children:r("function")}),(0,h.jsx)(u,{children:r("scheduled for")}),(0,h.jsx)(u,{children:r("pool")}),(0,h.jsx)(u,{children:r("attempts")}),(0,h.jsx)(u,{children:r("shard")}),(0,h.jsx)(u,{children:r("id")}),J!==void 0&&(0,h.jsx)(u,{"aria-label":r("Actions")})]})}),(0,h.jsx)(z,{children:b.map(v=>(0,h.jsxs)(F,{"data-testid":`sj-row-${v.id}`,children:[(0,h.jsx)(p,{className:"font-mono text-xs",children:v.workflow??v.functionPath}),(0,h.jsx)(p,{className:"text-muted-foreground tabular-nums",children:ie(v.scheduledFor)}),(0,h.jsx)(p,{className:"font-mono text-xs",children:v.pool??""}),(0,h.jsx)(p,{className:"tabular-nums",children:v.attempts??0}),(0,h.jsx)(p,{children:v.shardKey??""}),(0,h.jsx)(p,{className:"font-mono text-xs",children:v.id}),J!==void 0&&(0,h.jsx)(p,{className:"text-right",children:(0,h.jsx)(H,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{W(I(v.id))},"onConfirm"),testId:`sj-cancel-${v.id}`,children:r("Cancel")})})]},v.id))})]})})}),w;return e[12]!==$||e[13]!==S||e[14]!==L?(w=(0,h.jsxs)("div",{className:q,"data-testid":B,children:[S,L,$]}),e[12]=$,e[13]=S,e[14]=L,e[15]=w):w=e[15],w},"he");var he={kind:"idle"},me=c((a,e,i)=>i!==void 0?i:e===void 0?d=>a.runCronJob(d):void 0,"re"),ue=c(({loadCronJobs:a,runCronJob:e}={})=>{let i=R(),d=M(),[f,r]=(0,Y.useState)({}),l=E(["lunora-cron-jobs",a?"custom":"default"],()=>(a??(()=>i.getCronJobs()))()),{data:o,error:N}=l,x=me(i,a,e),n=c(async s=>{if(x!==void 0){r(m=>({...m,[s]:{kind:"running"}}));try{await x(s),r(m=>({...m,[s]:{kind:"ok"}})),l.refetch()}catch(m){r(y=>({...y,[s]:{kind:"error",message:G(m)}}))}}},"i");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),o?.length===0&&(0,t.jsx)(_,{description:d("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:d("No cron triggers.")}),o!==void 0&&o.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"cron-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:d("name")}),(0,t.jsx)(u,{children:d("schedule")}),(0,t.jsx)(u,{children:d("target")}),(0,t.jsx)(u,{children:d("shard")}),x!==void 0&&(0,t.jsx)(u,{"aria-label":d("Actions")})]})}),(0,t.jsx)(z,{children:o.map(s=>{let m=f[s.name]??he;return(0,t.jsxs)(F,{"data-testid":`cron-row-${s.name}`,children:[(0,t.jsx)(p,{children:s.name}),(0,t.jsx)(p,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,t.jsx)(p,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,t.jsx)(Z,{variant:"outline",children:d("function")}):(0,t.jsx)(Z,{variant:"secondary",children:d("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,t.jsx)(p,{children:s.shardKey??""}),x!==void 0&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[m.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:d("ran")}),m.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:m.message}),(0,t.jsx)(H,{confirmLabel:d("Run now?"),disabled:m.kind==="running",onConfirm:c(()=>{W(n(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:m.kind==="running"?d("Running\u2026"):d("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"le"),pe=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","se"),fe=c(a=>{let e=(0,U.c)(34),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadJobs:d,removeJob:f,retryJob:r}=i,l=R(),o=M(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let x;e[3]!==l||e[4]!==d?(x=c(async()=>(await(d??(()=>l.listDeadJobs()))()).toSorted(be),"h"),e[3]=l,e[4]=d,e[5]=x):x=e[5];let n=E(N,x),s=n.data,[m,y]=(0,Y.useState)(void 0),k=n.error??m,g=d===void 0,J;e[6]!==l||e[7]!==g||e[8]!==r?(J=r??(g?C=>l.retryDeadJob(C):void 0),e[6]=l,e[7]=g,e[8]=r,e[9]=J):J=e[9];let b=J,j;e[10]!==l||e[11]!==g||e[12]!==f?(j=f??(g?C=>l.removeDeadJob(C):void 0),e[10]=l,e[11]=g,e[12]=f,e[13]=j):j=e[13];let I=j,q;e[14]!==n?(q=c(()=>{n.refetch()},"$"),e[14]=n,e[15]=q):q=e[15],O(q,!0);let B;e[16]!==n?(B=c(async C=>{y(void 0);try{await C,n.refetch()}catch(ne){y(G(ne))}},"I"),e[16]=n,e[17]=B):B=e[17];let S=B,L=b!==void 0||I!==void 0,$;e[18]!==k?($=k!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:k}),e[18]=k,e[19]=$):$=e[19];let w;e[20]!==s?.length||e[21]!==o?(w=s?.length===0&&(0,t.jsx)(_,{description:o("Jobs that exhaust their retry budget are parked here instead of being dropped."),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:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:o("No dead-letter jobs.")}),e[20]=s?.length,e[21]=o,e[22]=w):w=e[22];let v;e[23]!==S||e[24]!==L||e[25]!==s||e[26]!==I||e[27]!==b||e[28]!==o?(v=s!==void 0&&s.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"dlq-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:o("function")}),(0,t.jsx)(u,{children:o("attempts")}),(0,t.jsx)(u,{children:o("last tried")}),(0,t.jsx)(u,{children:o("pool")}),(0,t.jsx)(u,{children:o("shard")}),(0,t.jsx)(u,{children:o("id")}),L&&(0,t.jsx)(u,{"aria-label":o("Actions")})]})}),(0,t.jsx)(z,{children:s.map(C=>(0,t.jsxs)(F,{"data-testid":`dlq-row-${C.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:C.workflow??C.functionPath}),(0,t.jsx)(p,{className:"tabular-nums",children:C.attempts??0}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:pe(C.scheduledFor)}),(0,t.jsx)(p,{className:"font-mono text-xs",children:C.pool??""}),(0,t.jsx)(p,{children:C.shardKey??""}),(0,t.jsx)(p,{className:"font-mono text-xs",children:C.id}),L&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[b!==void 0&&(0,t.jsx)(ee,{"data-testid":`dlq-retry-${C.id}`,onClick:c(()=>{W(S(b(C.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Retry")}),I!==void 0&&(0,t.jsx)(H,{confirmLabel:o("Drop job?"),onConfirm:c(()=>{W(S(I(C.id)))},"onConfirm"),testId:`dlq-remove-${C.id}`,children:o("Drop")})]})})]},C.id))})]})})}),e[23]=S,e[24]=L,e[25]=s,e[26]=I,e[27]=b,e[28]=o,e[29]=v):v=e[29];let D;return e[30]!==v||e[31]!==$||e[32]!==w?(D=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,w,v]}),e[30]=v,e[31]=$,e[32]=w,e[33]=D):D=e[33],D},"ne");function be(a,e){return(e.attempts??0)-(a.attempts??0)}c(be,"oe");var te=c(a=>{let e=(0,U.c)(8),{label:i,testId:d,value:f}=a,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==d||e[3]!==f?(l=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":d,children:f}),e[2]=d,e[3]=f,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o=(0,t.jsx)(A,{className:"flex-1 py-0",children:(0,t.jsxs)(T,{className:"flex flex-col gap-1 p-4",children:[r,l]})}),e[5]=r,e[6]=l,e[7]=o):o=e[7],o},"E"),ve=c(a=>{let e=(0,U.c)(25),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadStatus:d}=i,f=R(),r=M(),l=d===void 0,o;e[2]!==l?(o=["lunora-scheduler-status",l],e[2]=l,e[3]=o):o=e[3];let N;e[4]!==f||e[5]!==d?(N=c(async()=>{let j=await(d??(()=>f.schedulerStatus()))();return{...j,pools:j.pools.toSorted(xe)}},"y"),e[4]=f,e[5]=d,e[6]=N):N=e[6];let x=E(o,N),{data:n,error:s}=x,m;e[7]!==x?(m=c(()=>{x.refetch()},"d"),e[7]=x,e[8]=m):m=e[8],O(m,!0);let y;e[9]!==s?(y=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=y):y=e[10];let k;e[11]!==n||e[12]!==r?(k=n!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(te,{label:r("backlog"),testId:"pools-backlog",value:n.backlog}),(0,t.jsx)(te,{label:r("in flight"),testId:"pools-inflight",value:n.inFlight}),(0,t.jsx)(te,{label:r("pools"),testId:"pools-count",value:n.pools.length})]}),e[11]=n,e[12]=r,e[13]=k):k=e[13];let g;e[14]!==n?.pools.length||e[15]!==r?(g=n?.pools.length===0&&(0,t.jsx)(_,{description:r("Pools created with createWorkpool appear here once they have activity."),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:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:r("No workpools.")}),e[14]=n?.pools.length,e[15]=r,e[16]=g):g=e[16];let J;e[17]!==n||e[18]!==r?(J=n!==void 0&&n.pools.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"pools-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:r("pool")}),(0,t.jsx)(u,{children:r("queued")}),(0,t.jsx)(u,{children:r("in flight")}),(0,t.jsx)(u,{children:r("max concurrency")})]})}),(0,t.jsx)(z,{children:n.pools.map(ge)})]})})}),e[17]=n,e[18]=r,e[19]=J):J=e[19];let b;return e[20]!==y||e[21]!==k||e[22]!==g||e[23]!==J?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[y,k,g,J]}),e[20]=y,e[21]=k,e[22]=g,e[23]=J,e[24]=b):b=e[24],b},"ae");function xe(a,e){return e.queued-a.queued}c(xe,"ie");function ge(a){return(0,t.jsxs)(F,{"data-testid":`pools-row-${a.name}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:a.name}),(0,t.jsx)(p,{className:"tabular-nums",children:a.queued}),(0,t.jsxs)(p,{className:"tabular-nums",children:[a.inFlight," / ",a.maxConcurrency]}),(0,t.jsx)(p,{className:"tabular-nums",children:a.maxConcurrency})]},a.name)}c(ge,"de");var Ne=["jobs","dead","pools","cron"],Ve=c(a=>{let e=(0,U.c)(41),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadCronJobs:d,scheduledCancel:f,scheduledLoad:r}=i,l=M(),[o,N]=(0,Y.useState)("jobs"),x;e[2]!==l?(x=l("Cron triggers"),e[2]=l,e[3]=x):x=e[3];let n;e[4]!==l?(n=l("Dead letter"),e[4]=l,e[5]=n):n=e[5];let s;e[6]!==l?(s=l("Scheduled jobs"),e[6]=l,e[7]=s):s=e[7];let m;e[8]!==l?(m=l("Pools"),e[8]=l,e[9]=m):m=e[9];let y;e[10]!==x||e[11]!==n||e[12]!==s||e[13]!==m?(y={cron:x,dead:n,jobs:s,pools:m},e[10]=x,e[11]=n,e[12]=s,e[13]=m,e[14]=y):y=e[14];let k=y,g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=c(w=>{N(w.currentTarget.dataset.view)},"f"),e[15]=g):g=e[15];let J=g,b;e[16]!==l?(b=l("Schedule view"),e[16]=l,e[17]=b):b=e[17];let j;e[18]!==o||e[19]!==k?(j=Ne.map(w=>(0,t.jsx)(ee,{"aria-selected":o===w,"data-testid":`schedule-view-${w}`,"data-view":w,onClick:J,role:"tab",size:"sm",type:"button",variant:o===w?"default":"outline",children:k[w]},w)),e[18]=o,e[19]=k,e[20]=j):j=e[20];let I;e[21]!==b||e[22]!==j?(I=(0,t.jsx)("div",{"aria-label":b,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:j}),e[21]=b,e[22]=j,e[23]=I):I=e[23];let q;e[24]!==f||e[25]!==r||e[26]!==o?(q=o==="jobs"&&(0,t.jsx)(de,{cancelJob:f,loadJobs:r}),e[24]=f,e[25]=r,e[26]=o,e[27]=q):q=e[27];let B;e[28]!==o?(B=o==="dead"&&(0,t.jsx)(fe,{}),e[28]=o,e[29]=B):B=e[29];let S;e[30]!==o?(S=o==="pools"&&(0,t.jsx)(ve,{}),e[30]=o,e[31]=S):S=e[31];let L;e[32]!==d||e[33]!==o?(L=o==="cron"&&(0,t.jsx)(ue,{loadCronJobs:d}),e[32]=d,e[33]=o,e[34]=L):L=e[34];let $;return e[35]!==I||e[36]!==q||e[37]!==B||e[38]!==S||e[39]!==L?($=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[I,q,B,S,L]}),e[35]=I,e[36]=q,e[37]=B,e[38]=S,e[39]=L,e[40]=$):$=e[40],$},"Ie");export{Ve as SchedulePanel};
@@ -1,4 +1,4 @@
1
- import{a as le}from"./chunk-2W67FQCF.js";import{a as je}from"./chunk-FPI7AMQJ.js";import{a as he}from"./chunk-37WYCOQ2.js";import{a as V}from"./chunk-SA2OGF3F.js";import{d as Ne,f as ke,g as we,k as oe}from"./chunk-GHQ2VDI2.js";import{a as Pe}from"./chunk-2EYOYWS2.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import{i as ve}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as W}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as ye}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as $e}from"./chunk-4ZEL6BYL.js";import{l as F}from"./chunk-DTFIEXYN.js";import"./chunk-QAQDMS6R.js";import{d as be}from"./chunk-WS7WNXF3.js";import{a as U}from"./chunk-RWVIV3U7.js";import{d as J,e as Se,f as se,g as ie,h as fe,m as Ie,p as Oe,s as ae}from"./chunk-5OMZCVRF.js";import{a as u,d as K,e as me,f as te,g as re,i as ue}from"./chunk-I26MS5PJ.js";var Ge=K(te(),1),xe=K(me(),1);var Y=K(te(),1);var X=K(me(),1);var R=K(re(),1);var Ve=se($e.listTables),Xe=["react","client","cli"],Ye={action:"action",mutation:"mutation",query:"query"},Ce=u(t=>{let e=t.indexOf(":");return e===-1?{file:"",fn:t}:{file:t.slice(0,e),fn:t.slice(e+1)}},"Q"),Ze=u(({file:t,fn:e,kind:a})=>`await client.${Ye[a]}(api.${t}.${e}, { /* args */ });`,"ie"),et=u(t=>{let e=`api.${t.file}.${t.fn}`;switch(t.kind){case"action":return`const { call: ${t.fn} } = useAction(${e});`;case"mutation":return`const ${t.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},"se"),tt=u(({file:t,fn:e})=>`lunora run ${t}:${e} --args '{ }'`,"oe"),rt=u(t=>["// Read rows",`const rows = await ctx.db.query("${t}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${t}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${t}">;`,`type RowId = Id<"${t}">;`].join(`
1
+ import{a as le}from"./chunk-2W67FQCF.js";import{a as je}from"./chunk-FPI7AMQJ.js";import{a as he}from"./chunk-37WYCOQ2.js";import{a as V}from"./chunk-SA2OGF3F.js";import{d as Ne,f as ke,g as we,k as oe}from"./chunk-GHQ2VDI2.js";import{a as Pe}from"./chunk-2EYOYWS2.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import{i as ve}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as W}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as ye}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as $e}from"./chunk-4ZEL6BYL.js";import{l as F}from"./chunk-C36GGBU5.js";import"./chunk-QAQDMS6R.js";import{d as be}from"./chunk-WS7WNXF3.js";import{a as U}from"./chunk-RWVIV3U7.js";import{d as J,e as Se,f as se,g as ie,h as fe,m as Ie,p as Oe,s as ae}from"./chunk-5OMZCVRF.js";import{a as u,d as K,e as me,f as te,g as re,i as ue}from"./chunk-I26MS5PJ.js";var Ge=K(te(),1),xe=K(me(),1);var Y=K(te(),1);var X=K(me(),1);var R=K(re(),1);var Ve=se($e.listTables),Xe=["react","client","cli"],Ye={action:"action",mutation:"mutation",query:"query"},Ce=u(t=>{let e=t.indexOf(":");return e===-1?{file:"",fn:t}:{file:t.slice(0,e),fn:t.slice(e+1)}},"Q"),Ze=u(({file:t,fn:e,kind:a})=>`await client.${Ye[a]}(api.${t}.${e}, { /* args */ });`,"ie"),et=u(t=>{let e=`api.${t.file}.${t.fn}`;switch(t.kind){case"action":return`const { call: ${t.fn} } = useAction(${e});`;case"mutation":return`const ${t.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},"se"),tt=u(({file:t,fn:e})=>`lunora run ${t}:${e} --args '{ }'`,"oe"),rt=u(t=>["// Read rows",`const rows = await ctx.db.query("${t}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${t}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${t}">;`,`type RowId = Id<"${t}">;`].join(`
2
2
  `),"ce"),at=u((t,e)=>{switch(t){case"cli":return tt(e);case"client":return Ze(e);default:return et(e)}},"re"),Re=u(t=>{let e=(0,Y.c)(19),{code:a,label:r,testId:n}=t,s=J(),o;e[0]!==a?(o=u(()=>{ae(a)},"c"),e[0]=a,e[1]=o):o=e[1];let i=o,c;e[2]!==r?(c=(0,R.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:r}),e[2]=r,e[3]=c):c=e[3];let m=`${n}-copy`,l;e[4]!==s?(l=s("Copy"),e[4]=s,e[5]=l):l=e[5];let p;e[6]!==i||e[7]!==m||e[8]!==l?(p=(0,R.jsx)(W,{"data-testid":m,onClick:i,size:"xs",type:"button",variant:"ghost",children:l}),e[6]=i,e[7]=m,e[8]=l,e[9]=p):p=e[9];let f;e[10]!==c||e[11]!==p?(f=(0,R.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[c,p]}),e[10]=c,e[11]=p,e[12]=f):f=e[12];let h;e[13]!==a||e[14]!==n?(h=(0,R.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":n,children:a}),e[13]=a,e[14]=n,e[15]=h):h=e[15];let g;return e[16]!==f||e[17]!==h?(g=(0,R.jsxs)("div",{className:"flex flex-col gap-1.5",children:[f,h]}),e[16]=f,e[17]=h,e[18]=g):g=e[18],g},"U"),nt=u(t=>{let e=(0,Y.c)(46),{file:a,fn:r,kind:n}=t,s=J(),[o,i]=(0,X.useState)("react"),c,m,l;if(e[0]!==a||e[1]!==r||e[2]!==n||e[3]!==s||e[4]!==o){let w={file:a,fn:r,kind:n},j;e[8]!==s?(j=s("CLI"),e[8]=s,e[9]=j):j=e[9];let O;e[10]!==s?(O=s("Client"),e[10]=s,e[11]=O):O=e[11];let S;e[12]!==s?(S=s("React"),e[12]=s,e[13]=S):S=e[13];let C;e[14]!==j||e[15]!==O||e[16]!==S?(C={cli:j,client:O,react:S},e[14]=j,e[15]=O,e[16]=S,e[17]=C):C=e[17],l=C;let A;e[18]===Symbol.for("react.memo_cache_sentinel")?(A=u(_=>{i(_.currentTarget.dataset.tab)},"B"),e[18]=A):A=e[18],c=A,m=at(o,w),e[0]=a,e[1]=r,e[2]=n,e[3]=s,e[4]=o,e[5]=c,e[6]=m,e[7]=l}else c=e[5],m=e[6],l=e[7];let p=m,f=`api.${a}.${r}`,h;e[19]!==f?(h=(0,R.jsx)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-fn-title",children:f}),e[19]=f,e[20]=h):h=e[20];let g;e[21]!==n||e[22]!==s?(g=s("Call this {kind} from your app.",{kind:n}),e[21]=n,e[22]=s,e[23]=g):g=e[23];let x;e[24]!==g?(x=(0,R.jsx)("p",{className:"text-xs text-muted-foreground",children:g}),e[24]=g,e[25]=x):x=e[25];let v;e[26]!==h||e[27]!==x?(v=(0,R.jsxs)("div",{children:[h,x]}),e[26]=h,e[27]=x,e[28]=v):v=e[28];let N;e[29]!==s?(N=s("Snippet flavour"),e[29]=s,e[30]=N):N=e[30];let y;e[31]!==c||e[32]!==o||e[33]!==l?(y=Xe.map(w=>(0,R.jsx)(W,{"aria-selected":o===w,"data-tab":w,"data-testid":`api-tab-${w}`,onClick:c,role:"tab",size:"xs",type:"button",variant:o===w?"default":"outline",children:l[w]},w)),e[31]=c,e[32]=o,e[33]=l,e[34]=y):y=e[34];let b;e[35]!==N||e[36]!==y?(b=(0,R.jsx)("div",{"aria-label":N,className:"flex gap-1.5","data-testid":"api-tabs",role:"tablist",children:y}),e[35]=N,e[36]=y,e[37]=b):b=e[37];let I=l[o],P=`api-snippet-${o}`,$;e[38]!==p||e[39]!==I||e[40]!==P?($=(0,R.jsx)(Re,{code:p,label:I,testId:P}),e[38]=p,e[39]=I,e[40]=P,e[41]=$):$=e[41];let k;return e[42]!==$||e[43]!==v||e[44]!==b?(k=(0,R.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"api-fn-doc",children:[v,b,$]}),e[42]=$,e[43]=v,e[44]=b,e[45]=k):k=e[45],k},"de"),ot=u(t=>{let e=(0,Y.c)(19),{name:a}=t,r=J(),n;e[0]!==a?(n=rt(a),e[0]=a,e[1]=n):n=e[1];let s=n,o;e[2]!==a?(o=(0,R.jsx)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-table-title",children:a}),e[2]=a,e[3]=o):o=e[3];let i;e[4]!==r?(i=r("Read and write this table through the typed data model."),e[4]=r,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,R.jsx)("p",{className:"text-xs text-muted-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let m;e[8]!==o||e[9]!==c?(m=(0,R.jsxs)("div",{children:[o,c]}),e[8]=o,e[9]=c,e[10]=m):m=e[10];let l;e[11]!==r?(l=r("Data model"),e[11]=r,e[12]=l):l=e[12];let p;e[13]!==s||e[14]!==l?(p=(0,R.jsx)(Re,{code:s,label:l,testId:"api-snippet-table"}),e[13]=s,e[14]=l,e[15]=p):p=e[15];let f;return e[16]!==m||e[17]!==p?(f=(0,R.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"api-table-doc",children:[m,p]}),e[16]=m,e[17]=p,e[18]=f):f=e[18],f},"fe"),Te=u(t=>{let e=(0,Y.c)(8),{active:a,label:r,onSelect:n,testId:s,value:o}=t,i;e[0]!==n||e[1]!==o?(i=u(()=>{n(o)},"m"),e[0]=n,e[1]=o,e[2]=i):i=e[2];let c=i,m=a?"page":void 0,l;return e[3]!==r||e[4]!==c||e[5]!==m||e[6]!==s?(l=(0,R.jsx)("button",{"aria-current":m,className:"w-full truncate rounded-md px-2 py-1 text-start font-mono text-xs text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-testid":s,onClick:c,type:"button",children:r}),e[3]=r,e[4]=c,e[5]=m,e[6]=s,e[7]=l):l=e[7],l},"G"),st=u(t=>{let e=new Map;for(let a of t){let{file:r,fn:n}=Ce(a.path),s=e.get(r)??[];s.push({fn:n,kind:a.kind,path:a.path}),e.set(r,s)}return[...e.entries()].map(([a,r])=>({file:a,items:r.toSorted((n,s)=>n.fn.localeCompare(s.fn))})).toSorted((a,r)=>a.file.localeCompare(r.file))},"pe"),Ae=u(t=>{let e=(0,Y.c)(58),{functions:a,initialShardKey:r}=t,n=J(),s=F(),[o,i]=(0,X.useState)(null),[c,m]=(0,X.useState)(null),l,p;e[0]!==s||e[1]!==r?(l=u(()=>{let _=!1;return s.query(Ve,{},ie(r??"")).then(T=>(_||i(T),T)).catch(()=>{_||i([])}),()=>{_=!0}},"o"),p=[s,r],e[0]=s,e[1]=r,e[2]=l,e[3]=p):(l=e[2],p=e[3]),(0,X.useEffect)(l,p);let f,h,g,x,v,N,y,b,I,P;if(e[4]!==a||e[5]!==c||e[6]!==n||e[7]!==o){let _=a??[],T=st(_),L=(o??[]).map(it).toSorted(lt),E;e[18]===Symbol.for("react.memo_cache_sentinel")?(E=u(M=>{m({kind:"fn",path:M})},"P"),e[18]=E):E=e[18];let D=E,Q;e[19]===Symbol.for("react.memo_cache_sentinel")?(Q=u(M=>{m({kind:"table",name:M})},"j"),e[19]=Q):Q=e[19];let Qe=Q;h=c?.kind==="fn"?_.find(M=>M.path===c.path):void 0,f=_.length>0||L.length>0,g=h===void 0?void 0:Ce(h.path),I="grid min-h-0 gap-6 md:grid-cols-[16rem_minmax(0,1fr)]",P="lunora-api-docs",e[20]!==n?(x=n("API resources"),e[20]=n,e[21]=x):x=e[21],v="flex flex-col gap-4 overflow-y-auto",N="api-rail";let ne;e[22]!==c||e[23]!==n?(ne=u(M=>(0,R.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,R.jsx)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:M.file||n("(root)")}),M.items.map(ee=>(0,R.jsx)(Te,{active:c?.kind==="fn"&&c.path===ee.path,label:ee.fn,onSelect:D,testId:`api-rail-fn-${ee.path}`,value:ee.path},ee.path))]},M.file),"q"),e[22]=c,e[23]=n,e[24]=ne):ne=e[24],y=T.map(ne),b=L.length>0&&(0,R.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,R.jsx)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Tables")}),L.map(M=>(0,R.jsx)(Te,{active:c?.kind==="table"&&c.name===M,label:M,onSelect:Qe,testId:`api-rail-table-${M}`,value:M},M))]}),e[4]=a,e[5]=c,e[6]=n,e[7]=o,e[8]=f,e[9]=h,e[10]=g,e[11]=x,e[12]=v,e[13]=N,e[14]=y,e[15]=b,e[16]=I,e[17]=P}else f=e[8],h=e[9],g=e[10],x=e[11],v=e[12],N=e[13],y=e[14],b=e[15],I=e[16],P=e[17];let $;e[25]!==f||e[26]!==n?($=!f&&(0,R.jsx)("p",{className:"px-2 text-xs text-muted-foreground","data-testid":"api-rail-empty",children:n("No functions or tables to document yet.")}),e[25]=f,e[26]=n,e[27]=$):$=e[27];let k;e[28]!==$||e[29]!==x||e[30]!==v||e[31]!==N||e[32]!==y||e[33]!==b?(k=(0,R.jsxs)("nav",{"aria-label":x,className:v,"data-testid":N,children:[y,b,$]}),e[28]=$,e[29]=x,e[30]=v,e[31]=N,e[32]=y,e[33]=b,e[34]=k):k=e[34];let w;e[35]!==c||e[36]!==n?(w=c===null&&(0,R.jsx)(U,{description:n("Select a function or table to see how to call it from your app."),testId:"api-empty",title:n("API usage snippets")}),e[35]=c,e[36]=n,e[37]=w):w=e[37];let j;e[38]!==c?.kind||e[39]!==h||e[40]!==g?(j=c?.kind==="fn"&&h!==void 0&&g!==void 0&&(0,R.jsx)(nt,{file:g.file,fn:g.fn,kind:h.kind},h.path),e[38]=c?.kind,e[39]=h,e[40]=g,e[41]=j):j=e[41];let O;e[42]!==c?.kind||e[43]!==h||e[44]!==n?(O=c?.kind==="fn"&&h===void 0&&(0,R.jsx)(U,{testId:"api-empty",title:n("API usage snippets")}),e[42]=c?.kind,e[43]=h,e[44]=n,e[45]=O):O=e[45];let S;e[46]!==c?(S=c?.kind==="table"&&(0,R.jsx)(ot,{name:c.name}),e[46]=c,e[47]=S):S=e[47];let C;e[48]!==w||e[49]!==j||e[50]!==O||e[51]!==S?(C=(0,R.jsxs)("div",{className:"min-w-0",children:[w,j,O,S]}),e[48]=w,e[49]=j,e[50]=O,e[51]=S,e[52]=C):C=e[52];let A;return e[53]!==k||e[54]!==C||e[55]!==I||e[56]!==P?(A=(0,R.jsxs)("div",{className:I,"data-testid":P,children:[k,C]}),e[53]=k,e[54]=C,e[55]=I,e[56]=P,e[57]=A):A=e[57],A},"ke");function it(t){return t.name}u(it,"ue");function lt(t,e){return t.localeCompare(e)}u(lt,"me");var De=K(te(),1);var z=K(te(),1);var q=K(me(),1);var d=K(re(),1);var dt=u(t=>typeof t=="number"?"number":typeof t=="boolean"?"boolean":"string","we"),Je=u(t=>{if(t.enum!==void 0&&t.enum.length>0)return t.enum;if(t.anyOf!==void 0&&t.anyOf.length>0&&t.anyOf.every(e=>e.const!==void 0))return t.anyOf.map(e=>e.const)},"Q"),ce=u(t=>t===void 0?"any":t.const!==void 0?JSON.stringify(t.const):t.enum!==void 0&&t.enum.length>0?t.enum.map(e=>JSON.stringify(e)).join(" | "):t.anyOf!==void 0&&t.anyOf.length>0?t.anyOf.map(e=>ce(e)).join(" | "):t.type==="array"?`array<${ce(t.items)}>`:t.type??"any","z"),ct=u(t=>{let e=Je(t);return e!==void 0?t.type??dt(e[0]):ce(t)},"ke"),pt=u(t=>{let e=Je(t);return e===void 0?void 0:e.map(a=>JSON.stringify(a)).join(" | ")},"Oe"),mt=u(t=>{let e=[];t.minimum!==void 0?e.push(`${String(t.minimum)} \u2264`):t.exclusiveMinimum!==void 0&&e.push(`${String(t.exclusiveMinimum)} <`);let a=e.length>0;e.push("value"),t.maximum!==void 0?e.push(`\u2264 ${String(t.maximum)}`):t.exclusiveMaximum!==void 0&&e.push(`< ${String(t.exclusiveMaximum)}`);let r=e.length>(a?2:1);return a||r?e.join(" "):void 0},"$e"),ut=u(t=>{if(t.type==="object"&&t.properties!==void 0)return t;if(t.type==="array"&&t.items?.type==="object"&&t.items.properties!==void 0)return t.items},"Te"),Z=u(t=>{if(t===void 0)return null;if(t.const!==void 0)return t.const;if(t.enum!==void 0&&t.enum.length>0)return t.enum[0];if(t.anyOf!==void 0&&t.anyOf.length>0)return Z(t.anyOf[0]);switch(t.type){case"array":return[];case"boolean":return!1;case"number":return 0;case"object":{let e={};for(let[a,r]of Object.entries(t.properties??{}))e[a]=Z(r);return e}case"string":return"";default:return null}},"D"),de=u(t=>{let e=(0,z.c)(7),{label:a,value:r}=t,n;e[0]!==a?(n=(0,d.jsx)("span",{className:"text-muted-foreground",children:a}),e[0]=a,e[1]=n):n=e[1];let s;e[2]!==r?(s=(0,d.jsx)("span",{className:"text-foreground",children:r}),e[2]=r,e[3]=s):s=e[3];let o;return e[4]!==n||e[5]!==s?(o=(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 font-mono text-[10px]",children:[n,s]}),e[4]=n,e[5]=s,e[6]=o):o=e[6],o},"K"),ft=u(t=>{let e=(0,z.c)(40),{name:a,required:r,schema:n}=t,s=J(),o;e[0]!==n?(o=mt(n),e[0]=n,e[1]=o):o=e[1];let i=o,c;e[2]!==n?(c=pt(n),e[2]=n,e[3]=c):c=e[3];let m=c,l=n["x-lunora-table"],p=n.format!==void 0||i!==void 0||m!==void 0||l!==void 0,f;e[4]!==n?(f=ut(n),e[4]=n,e[5]=f):f=e[5];let h=f,g=r?"*":"?",x;e[6]!==g?(x=(0,d.jsx)("span",{className:"text-muted-foreground",children:g}),e[6]=g,e[7]=x):x=e[7];let v;e[8]!==a||e[9]!==x?(v=(0,d.jsxs)("span",{className:"font-mono text-foreground",children:[a,x]}),e[8]=a,e[9]=x,e[10]=v):v=e[10];let N;e[11]!==n?(N=ct(n),e[11]=n,e[12]=N):N=e[12];let y;e[13]!==N?(y=(0,d.jsx)("span",{className:"font-mono text-muted-foreground",children:N}),e[13]=N,e[14]=y):y=e[14];let b;e[15]!==v||e[16]!==y?(b=(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[v,y]}),e[15]=v,e[16]=y,e[17]=b):b=e[17];let I;e[18]!==n.description?(I=n.description!==void 0&&(0,d.jsx)("p",{className:"max-w-prose text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=I):I=e[19];let P;e[20]!==p||e[21]!==i||e[22]!==l||e[23]!==n.format||e[24]!==s||e[25]!==m?(P=p&&(0,d.jsxs)("div",{className:"flex flex-wrap gap-1",children:[n.format!==void 0&&(0,d.jsx)(de,{label:s("Format"),value:n.format}),i!==void 0&&(0,d.jsx)(de,{label:s("Range"),value:i}),m!==void 0&&(0,d.jsx)(de,{label:s("Value in"),value:m}),l!==void 0&&(0,d.jsx)(de,{label:s("relation"),value:l})]}),e[20]=p,e[21]=i,e[22]=l,e[23]=n.format,e[24]=s,e[25]=m,e[26]=P):P=e[26];let $;e[27]!==I||e[28]!==P||e[29]!==b?($=(0,d.jsxs)("div",{className:"flex flex-col gap-1 py-2",children:[b,I,P]}),e[27]=I,e[28]=P,e[29]=b,e[30]=$):$=e[30];let k=$;if(h===void 0){let S;return e[31]!==k?(S=(0,d.jsx)("div",{className:"border-b border-border/50 last:border-b-0",children:k}),e[31]=k,e[32]=S):S=e[32],S}let w;e[33]!==k?(w=(0,d.jsx)("summary",{className:"cursor-pointer marker:text-muted-foreground",children:k}),e[33]=k,e[34]=w):w=e[34];let j;e[35]!==h?(j=(0,d.jsx)("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:(0,d.jsx)(Le,{schema:h})}),e[35]=h,e[36]=j):j=e[36];let O;return e[37]!==w||e[38]!==j?(O=(0,d.jsxs)("details",{className:"border-b border-border/50 last:border-b-0",children:[w,j]}),e[37]=w,e[38]=j,e[39]=O):O=e[39],O},"Ee"),Le=u(t=>{let e=(0,z.c)(7),{schema:a}=t,r;e[0]!==a.required?(r=new Set(a.required),e[0]=a.required,e[1]=r):r=e[1];let n=r,s;e[2]!==a.properties?(s=Object.entries(a.properties??{}),e[2]=a.properties,e[3]=s):s=e[3];let o=s,i;return e[4]!==n||e[5]!==o?(i=(0,d.jsx)("div",{className:"flex flex-col",children:o.map(c=>{let[m,l]=c;return(0,d.jsx)(ft,{name:m,required:n.has(m),schema:l},m)})}),e[4]=n,e[5]=o,e[6]=i):i=e[6],i},"Z"),_e=u(t=>{let e=(0,z.c)(10),{schema:a,testId:r}=t;if(a?.type!=="object"||Object.keys(a.properties??{}).length===0){let o;e[0]!==a?(o=ce(a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==o||e[3]!==r?(i=(0,d.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":r,children:o}),e[2]=o,e[3]=r,e[4]=i):i=e[4],i}let n;e[5]!==a?(n=(0,d.jsx)(Le,{schema:a}),e[5]=a,e[6]=n):n=e[6];let s;return e[7]!==n||e[8]!==r?(s=(0,d.jsx)("div",{className:"text-xs","data-testid":r,children:n}),e[7]=n,e[8]=r,e[9]=s):s=e[9],s},"V"),ht=["curl","javascript","lunora"],gt={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},xt=u(t=>`api.${t.replaceAll(/[/:]/g,".")}`,"je"),bt=u(t=>{let e=Z(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},"Ae"),yt=u((t,e,a)=>{let r=`${a}${e.httpPath}`,n=JSON.stringify(bt(e),void 0,2),s=JSON.stringify(Z(e.argsSchema)??{},void 0,2);switch(t){case"curl":{let o=e.method!=="GET"&&e.method!=="HEAD",i=[`curl -X ${e.method} ${JSON.stringify(r)}`];return o&&i.push(' -H "Content-Type: application/json"',` -d '${n}'`),i.join(` \\
3
3
  `)}case"lunora":return e.functionPath===void 0?`await fetch(${JSON.stringify(e.httpPath)}, { method: ${JSON.stringify(e.method)} });`:`import { useLunora } from "@lunora/react";
4
4
  import { api } from "./_generated/api";
@@ -1,4 +1,4 @@
1
- import{a as gn,b as $e,e as Vr,f as zr}from"./chunk-X472RKFD.js";import{a as Tr,b as pt,c as Er,d as fn}from"./chunk-BKAIQ3EW.js";import{a as mn}from"./chunk-S4Z7K55A.js";import{b as dn}from"./chunk-5B2RTXBS.js";import{d as $r}from"./chunk-UYEZR3BI.js";import{a as un}from"./chunk-Q6IT6ZD7.js";import{a as Le}from"./chunk-CGQMJYCW.js";import"./chunk-NQZALRU3.js";import"./chunk-OPM7ESDV.js";import"./chunk-Y3AYVFTK.js";import{a as cn}from"./chunk-7RKB5KS7.js";import{a as Ht}from"./chunk-QJLHH3ET.js";import{a as so}from"./chunk-37WYCOQ2.js";import{a as sn}from"./chunk-VASJTDMU.js";import{a as Or}from"./chunk-JQXA2OYK.js";import{b as yr,c as oo}from"./chunk-CCDX5RYT.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import{a as io}from"./chunk-IWZ7GVQO.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import{a as ao}from"./chunk-I23ULEUU.js";import{a as Mr}from"./chunk-2EYOYWS2.js";import{a as Ir,b as Fr}from"./chunk-ZKJS6EBE.js";import{b as vr,c as Rr,f as ro}from"./chunk-RGMVGZV4.js";import{c as br,d as hr,e as wr,f as it,g as on,h as xr,i as Sr}from"./chunk-OQ6I6OXT.js";import{i as _r}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{a as rn}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{a as _e}from"./chunk-4ZEL6BYL.js";import{b as no,c as ct}from"./chunk-C4ZPJ4KT.js";import{b as Zn,c as eo,d as nn,e as pr,l as nt}from"./chunk-DTFIEXYN.js";import"./chunk-QAQDMS6R.js";import"./chunk-WS7WNXF3.js";import{a as ln}from"./chunk-RWVIV3U7.js";import{a as kr,b as Pr,c as Nr,d as lo,e as Dr,f as Ar}from"./chunk-HCTJKP5J.js";import{d as oe,f as Ve,g as ze,h as $t,m as to,n as an,o as Te,p as re,t as Cr}from"./chunk-5OMZCVRF.js";import{a as o,d as Me,e as gt,f as Vt,g as zt,i as ft}from"./chunk-I26MS5PJ.js";var Os=Me(Vt(),1);var Ot=Me(gt(),1);var q=Me(Vt(),1);var D=Me(gt(),1);var Rt=Me(Vt(),1);var Y=Me(zt(),1),ot=Me(gt(),1);var mi=2166136261,gi=16777619,fi=o((t,e=mi)=>{let n=e;for(let l=0;l<t.length;l+=1)n^=t.charCodeAt(l),n=Math.imul(n,gi);return(n>>>0).toString(16).padStart(8,"0")},"I"),pi=/([a-z\d])([A-Z])/gu,bi=/[\s_-]+/u,hi=new Set(["access_token","api_key","apikey","card_number","client_secret","credit_card","cvv","passwd","password","private_key","pwd","refresh_token","secret","ssn","token"]),wi=o(t=>{let e=t.replaceAll(pi,"$1 $2").split(bi).map(l=>l.toLowerCase()).filter(l=>l.length>0),n=new Set(e);for(let l=0;l<e.length-1;l+=1){let r=e[l],a=e[l+1];r===void 0||a===void 0||(n.add(`${r}${a}`),n.add(`${r}_${a}`))}return[...n]},"le"),Hr="\u2022\u2022\u2022",Kr=o((t,e)=>{try{return e==="redact"?null:e==="hash"?t==null?t:fi(typeof t=="bigint"?t.toString():typeof t=="string"?t:JSON.stringify(t)):Hr}catch{return Hr}},"W"),Lr=o((t,e)=>{let n=new Map;for(let l of t)l.table===e&&n.set(l.column,l.strategy);return n},"j"),xi=o(t=>{for(let e of wi(t))if(hi.has(e))return!0;return!1},"ae"),jr=o((t,e)=>{let n=e.filter(r=>!t.has(r)&&xi(r));if(n.length===0)return t;let l=new Map(t);for(let r of n)l.set(r,"redact");return l},"z"),Lt=o((t,e,n)=>{if(!n.enabled)return t;let l=n.columns.get(e);return l===void 0?t:Kr(t,l)},"Ce"),pn=o((t,e)=>{if(!e.enabled||e.columns.size===0)return t;let n={...t};for(let[l,r]of e.columns)l in n&&(n[l]=Kr(n[l],r));return n},"ce"),bn=o((t,e)=>!e.enabled||e.columns.size===0?t:t.map(n=>pn(n,e)),"Fe"),Br=o(t=>t==null?"\u2205":t===""?"(empty)":Te(t),"B"),Si=o(t=>{let e=(0,Rt.c)(32),{column:n,onFacetFilter:l,state:r}=t,a=oe(),s;e[0]!==n||e[1]!==l||e[2]!==r.result?.values?(s=o(w=>{let _=Number(w.currentTarget.dataset.index),S=r.result?.values[_];S!==void 0&&l(n,S.value)},"x"),e[0]=n,e[1]=l,e[2]=r.result?.values,e[3]=s):s=e[3];let i=s,c=`db-facet-${n}`,u;e[4]!==n?(u=(0,Y.jsx)("span",{className:"font-medium text-foreground",children:n}),e[4]=n,e[5]=u):u=e[5];let d;e[6]!==r.loading||e[7]!==r.result||e[8]!==a?(d=r.loading&&r.result===null&&(0,Y.jsx)("span",{className:"text-muted-foreground",children:a("Loading\u2026")}),e[6]=r.loading,e[7]=r.result,e[8]=a,e[9]=d):d=e[9];let g;e[10]!==r.error?(g=r.error!==null&&(0,Y.jsx)("span",{className:"text-destructive",role:"alert",children:r.error}),e[10]=r.error,e[11]=g):g=e[11];let m;e[12]!==r.result?.values?(m=r.result?.values??[],e[12]=r.result?.values,e[13]=m):m=e[13];let h;if(e[14]!==n||e[15]!==i||e[16]!==m){let w;e[18]!==n||e[19]!==i?(w=o((_,S)=>(0,Y.jsxs)("button",{className:"flex items-center justify-between gap-2 rounded px-1 py-0.5 text-left text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground","data-index":S,"data-testid":`db-facet-value-${n}`,onClick:i,type:"button",children:[(0,Y.jsx)("span",{className:"truncate",children:Br(_.value)}),(0,Y.jsx)("span",{className:"shrink-0 tabular-nums text-foreground/70",children:_.count})]},Br(_.value)),"c"),e[18]=n,e[19]=i,e[20]=w):w=e[20],h=m.map(w),e[14]=n,e[15]=i,e[16]=m,e[17]=h}else h=e[17];let p;e[21]!==n||e[22]!==r.result||e[23]!==a?(p=r.result?.truncated===!0&&(0,Y.jsx)("span",{className:"text-muted-foreground","data-testid":`db-facet-truncated-${n}`,children:a("Showing the {n} most common values.",{n:r.result.values.length})}),e[21]=n,e[22]=r.result,e[23]=a,e[24]=p):p=e[24];let b;return e[25]!==c||e[26]!==u||e[27]!==d||e[28]!==g||e[29]!==h||e[30]!==p?(b=(0,Y.jsxs)("section",{className:"flex flex-col gap-1","data-testid":c,children:[u,d,g,h,p]}),e[25]=c,e[26]=u,e[27]=d,e[28]=g,e[29]=h,e[30]=p,e[31]=b):b=e[31],b},"ie"),hn=o(t=>{let e=(0,Rt.c)(44),{columns:n,facets:l,mask:r,onFacetFilter:a,onToggleFacet:s}=t,i=oe(),c;e[0]!==s?(c=o(y=>{let{column:M}=y.currentTarget.dataset;M!==void 0&&s(M)},"o"),e[0]=s,e[1]=c):c=e[1];let u=c,d;e[2]!==r?(d=o(y=>r.enabled&&r.columns.has(y),"a"),e[2]=r,e[3]=d):d=e[3];let g=d,m,h,p,b,w,_,S,v;if(e[4]!==n||e[5]!==l||e[6]!==g||e[7]!==i||e[8]!==u){v=Symbol.for("react.early_return_sentinel");e:{let y;e[17]!==g?(y=o(N=>!g(N),"y"),e[17]=g,e[18]=y):y=e[18];let M=n.filter(y),F;if(e[19]!==l||e[20]!==g?(F=Object.entries(l).filter(N=>{let[A]=N;return!g(A)}),e[19]=l,e[20]=g,e[21]=F):F=e[21],m=F,M.length===0){v=null;break e}_="flex w-56 shrink-0 flex-col gap-3 overflow-auto border-l border-border p-3 text-xs",S="db-facets",b="flex flex-col gap-1.5";let P;e[22]!==i?(P=i("Facets"),e[22]=i,e[23]=P):P=e[23],e[24]!==P?(w=(0,Y.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:P}),e[24]=P,e[25]=w):w=e[25],h="flex flex-wrap gap-1";let k;e[26]!==l||e[27]!==u?(k=o(N=>(0,Y.jsx)("button",{"aria-pressed":N in l,className:"rounded border border-border px-1.5 py-0.5 text-muted-foreground transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-column":N,"data-testid":`db-facet-toggle-${N}`,onClick:u,type:"button",children:N},N),"A"),e[26]=l,e[27]=u,e[28]=k):k=e[28],p=M.map(k)}e[4]=n,e[5]=l,e[6]=g,e[7]=i,e[8]=u,e[9]=m,e[10]=h,e[11]=p,e[12]=b,e[13]=w,e[14]=_,e[15]=S,e[16]=v}else m=e[9],h=e[10],p=e[11],b=e[12],w=e[13],_=e[14],S=e[15],v=e[16];if(v!==Symbol.for("react.early_return_sentinel"))return v;let I;e[29]!==h||e[30]!==p?(I=(0,Y.jsx)("div",{className:h,children:p}),e[29]=h,e[30]=p,e[31]=I):I=e[31];let C;e[32]!==I||e[33]!==b||e[34]!==w?(C=(0,Y.jsxs)("div",{className:b,children:[w,I]}),e[32]=I,e[33]=b,e[34]=w,e[35]=C):C=e[35];let R;e[36]!==a||e[37]!==m?(R=m.map(y=>{let[M,F]=y;return(0,Y.jsx)(Si,{column:M,onFacetFilter:a,state:F},M)}),e[36]=a,e[37]=m,e[38]=R):R=e[38];let x;return e[39]!==C||e[40]!==R||e[41]!==_||e[42]!==S?(x=(0,Y.jsxs)("aside",{className:_,"data-testid":S,children:[C,R]}),e[39]=C,e[40]=R,e[41]=_,e[42]=S,e[43]=x):x=e[43],x},"_e"),wn=o(()=>{let[t,e]=(0,ot.useState)({}),n=Le(t),l=(0,ot.useRef)({}),r=o(async(a,s)=>{let i=(l.current[a]??0)+1;l.current[a]=i,e(c=>a in c?{...c,[a]:{error:null,loading:!0,result:c[a]?.result??null}}:c);try{let c=await s(a);if(l.current[a]!==i)return;e(u=>a in u?{...u,[a]:{error:null,loading:!1,result:c}}:u)}catch(c){if(l.current[a]!==i)return;e(u=>a in u?{...u,[a]:{error:$t(c),loading:!1,result:null}}:u)}},"n");return{clearFacets:o(()=>{e({})},"clearFacets"),facets:t,facetsRef:n,refetchFacets:o(a=>{for(let s of Object.keys(n.current))re(r(s,a))},"refetchFacets"),toggleFacet:o((a,s)=>{if(a in n.current){e(i=>Object.fromEntries(Object.entries(i).filter(([c])=>c!==a)));return}e(i=>({...i,[a]:{error:null,loading:!0,result:null}})),s!==null&&re(r(a,s))},"toggleFacet")}},"Me"),_i=[],Ci=o(()=>{let t=(0,Rt.c)(1),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={},t[0]=e):e=t[0];let{data:n}=ct(_e.maskPolicies,e);return Array.isArray(n?.columns)?n.columns:_i},"de"),xn=o(t=>{let e=(0,Rt.c)(16),{columns:n,selectedTable:l}=t,r=Ci(),[a,s]=(0,ot.useState)(!0),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o(()=>{s(yi)},"g"),e[0]=i):i=e[0];let c=i,u;if(e[1]!==n||e[2]!==r||e[3]!==l){let b=Lr(r,l??"");u=jr(b,n),e[1]=n,e[2]=r,e[3]=l,e[4]=u}else u=e[4];let d=u,g;e[5]!==a||e[6]!==r?(g=o((b,w)=>({columns:jr(Lr(r,b),w),enabled:a}),"l"),e[5]=a,e[6]=r,e[7]=g):g=e[7];let m=g,h;e[8]!==d||e[9]!==a?(h={columns:d,enabled:a},e[8]=d,e[9]=a,e[10]=h):h=e[10];let p;return e[11]!==d||e[12]!==a||e[13]!==m||e[14]!==h?(p={maskColumns:d,maskOn:a,maskView:h,maskViewFor:m,onToggleMask:c},e[11]=d,e[12]=a,e[13]=m,e[14]=h,e[15]=p):p=e[15],p},"Te");function yi(t){return!t}o(yi,"fe");var Gr=34,qr=600,vi=o(t=>{let e=(0,Rt.c)(21),{item:n,onSelect:l,prefix:r,selected:a,start:s}=t,i;e[0]!==n.name||e[1]!==l?(i=o(()=>{l(n.name)},"g"),e[0]=n.name,e[1]=l,e[2]=i):i=e[2];let c=i,u=`translateY(${String(s)}px)`,d;e[3]!==u?(d={insetInline:0,position:"absolute",top:0,transform:u},e[3]=u,e[4]=d):d=e[4];let g=d,m=a?"bg-accent font-medium text-accent-foreground":"text-foreground",h;e[5]!==m?(h=ft("flex w-full items-center justify-between gap-2 rounded-md px-2 py-1.5 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent",m),e[5]=m,e[6]=h):h=e[6];let p=`${r}-table-${n.name}`,b;e[7]!==n.name?(b=(0,Y.jsx)("span",{className:"truncate",children:n.name}),e[7]=n.name,e[8]=b):b=e[8];let w;e[9]!==n.rowCount?(w=(0,Y.jsx)("span",{className:"shrink-0 rounded bg-muted px-1.5 text-xs tabular-nums text-muted-foreground",children:n.rowCount}),e[9]=n.rowCount,e[10]=w):w=e[10];let _;e[11]!==c||e[12]!==a||e[13]!==h||e[14]!==p||e[15]!==b||e[16]!==w?(_=(0,Y.jsxs)("button",{"aria-pressed":a,className:h,"data-testid":p,onClick:c,type:"button",children:[b,w]}),e[11]=c,e[12]=a,e[13]=h,e[14]=p,e[15]=b,e[16]=w,e[17]=_):_=e[17];let S;return e[18]!==g||e[19]!==_?(S=(0,Y.jsx)("li",{style:g,children:_}),e[18]=g,e[19]=_,e[20]=S):S=e[20],S},"me"),Sn=o(({header:t,onReload:e,onSelect:n,prefix:l,reloadLabel:r,selected:a,tables:s})=>{let i=oe(),[c,u]=(0,ot.useState)(""),d=(0,ot.useRef)(null),g=o(b=>{u(b.target.value)},"l"),m=(0,ot.useMemo)(()=>{let b=c.trim().toLowerCase();return b===""?s:s.filter(w=>w.name.toLowerCase().includes(b))},[c,s]),h=dn({count:m.length,estimateSize:o(()=>Gr,"estimateSize"),getScrollElement:o(()=>d.current,"getScrollElement"),initialRect:{height:qr,width:240},observeElementRect:o((b,w)=>mn(b,w,qr),"observeElementRect"),overscan:12}).getVirtualItems(),p={height:m.length*Gr};return(0,Y.jsxs)("aside",{className:"flex h-full w-60 shrink-0 flex-col border-e border-border bg-sidebar","data-testid":`${l}-table-list`,children:[t,(0,Y.jsxs)("div",{className:"flex h-9 shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[(0,Y.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:i("Tables")}),e!==void 0&&(0,Y.jsx)("button",{"aria-label":r??i("Refresh"),className:"flex size-6 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent","data-testid":`${l}-load-tables`,onClick:e,title:r??i("Refresh"),type:"button",children:(0,Y.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,Y.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})})})]}),(0,Y.jsx)("div",{className:"shrink-0 border-b border-border p-2",children:(0,Y.jsx)("input",{className:"h-7 w-full rounded-md border border-border bg-background px-2 text-xs outline-none placeholder:text-muted-foreground focus-visible:border-ring","data-testid":`${l}-table-search`,onChange:g,placeholder:i("search table\u2026"),type:"search",value:c})}),(0,Y.jsxs)("ul",{className:"relative flex-1 overflow-y-auto p-1.5","data-testid":`${l}-table-list-rows`,ref:d,children:[(0,Y.jsx)("li",{"aria-hidden":"true",style:p}),h.map(b=>{let w=m[b.index];return w===void 0?null:(0,Y.jsx)(vi,{item:w,onSelect:n,prefix:l,selected:a===w.name,start:b.start},w.name)})]})]})},"$e");var f=Me(zt(),1);var Ur=Me(gt(),1);function Ri(t){return Ii(t)||typeof t=="function"||Fi(t)}o(Ri,"isReactComponent");function Ii(t){return typeof t=="function"&&(()=>{let e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}o(Ii,"isClassComponent");function Fi(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}o(Fi,"isExoticComponent");function bt(t,e){return t==null?null:Ri(t)?Ur.default.createElement(t,e):t}o(bt,"flexRender");function co(t){if("cell"in t&&t.cell){let e=t.cell,n=e.column.columnDef,l=e,r=n;return l.getIsAggregated?.()?bt(r.aggregatedCell??n.cell,e.getContext()):l.getIsPlaceholder?.()?null:bt(n.cell,e.getContext())}return"header"in t&&t.header?bt(t.header.column.columnDef.header,t.header.getContext()):"footer"in t&&t.footer?bt(t.footer.column.columnDef.footer,t.footer.getContext()):null}o(co,"FlexRender");function Jr(t){let e=on(t.source,t.selector,{compare:it});return typeof t.children=="function"?t.children(e):t.children}o(Jr,"Subscribe");function Wr(t){let e=t;return Object.defineProperty(t,"state",{get(){return t.get()}}),"set"in t&&(e.setState=t.set.bind(t)),e}o(Wr,"atomToStore");function uo(t){let{createAtom:e,batch:n}=t,l=e(0);return{createOptionsStore:!1,wrapExternalAtoms:!1,addSubscription:o(()=>{throw new Error("Feature not supported in current reactivity implementation")},"addSubscription"),unmount:o(()=>{throw new Error("Feature not supported in current reactivity implementation")},"unmount"),schedule:t.schedule??(r=>queueMicrotask(r)),batch:n,untrack:o(r=>r(),"untrack"),createReadonlyAtom:o((r,a)=>{let s=a?.compare??Object.is,i=!1,c,u=o(()=>{let g=r();return(!i||!s(c,g))&&(c=g,i=!0),c},"getSnapshot"),d=e(()=>(l.get(),u()),{compare:s});return{get:u,subscribe:d.subscribe.bind(d)}},"createReadonlyAtom"),createWritableAtom:o((r,a)=>e(r,{compare:a?.compare}),"createWritableAtom"),commit:o(()=>{l.set(r=>r+1)},"commit")}}o(uo,"renderPhaseReactivity");function mo(t,e=Object.is){let n=!1,l;return{get:t.get,markCommitted:o(r=>{l=r,n=!0},"markCommitted"),subscribe:o(r=>t.subscribe(a=>{(!n||!e(l,a))&&r(a)}),"subscribe")}}o(mo,"createRenderPhaseSource");function Qr(){return uo({createAtom:wr,batch:hr})}o(Qr,"reactReactivity");function It(t,e){return typeof t=="function"?t(e):t}o(It,"functionalUpdate");function ie(t){if(Array.isArray(t))return t.map(ie);if(t&&typeof t=="object"){let e=Object.getPrototypeOf(t);if(e!==Object.prototype&&e!==null)return t;let n=e===null?H():{},l=Object.keys(t);for(let r=0;r<l.length;r++){let a=l[r];Object.defineProperty(n,a,{configurable:!0,enumerable:!0,value:ie(t[a]),writable:!0})}return n}return t}o(ie,"cloneState");function _n(t,e){let n=Object.keys(e),l=t;for(let r=0;r<n.length;r++){let a=n[r];!a.startsWith("_memo_")&&a!=="_cellsCache"&&(l[a]=e[a])}return t}o(_n,"copyInstancePropertiesWithoutMemos");function H(){return Object.create(null)}o(H,"makeObjectMap");function je(t,e){return Object.prototype.hasOwnProperty.call(t,e)}o(je,"hasOwn");function Be(t,e){return n=>{(e.options.atoms?.[t]??e.baseAtoms[t]).set(l=>It(n,l))}}o(Be,"makeStateUpdater");function Xr(t){if(typeof t!="object"||t===null)return!1;if(Array.isArray(t))return!0;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}o(Xr,"isPlainContainer");function Yr(t){return Reflect.ownKeys(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}o(Yr,"getEnumerableOwnKeys");var Mi=3;function ki(t,e){return Zr(t,e,Mi)}o(ki,"stateSlicesEqual");function Zr(t,e,n){if(Object.is(t,e))return!0;if(n<=0||!Xr(t)||!Xr(e)||(Array.isArray(t)||Array.isArray(e))&&(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length))return!1;let l=Yr(t),r=Yr(e);if(l.length!==r.length)return!1;let a=t,s=e;for(let i=0;i<l.length;i++){let c=l[i];if(!Object.prototype.propertyIsEnumerable.call(e,c)||!Zr(a[c],s[c],n-1))return!1}return!0}o(Zr,"stateSlicesEqualAtDepth");function He(t,e,n,l=ki){let r=`on${e.charAt(0).toUpperCase()}${e.slice(1)}Change`,a=t.options[r];a&&a(s=>{let i=It(n,s);return l(s,i)?s:i})}o(He,"setStateSlice");function el(t){return t instanceof Function}o(el,"isFunction");function tl(t,e){let n=[],l=o(r=>{r.forEach(a=>{n.push(a);let s=e(a);s.length&&l(s)})},"recurse");return l(t),n}o(tl,"flattenBy");var Pi=o(({fn:t,memoDeps:e,onAfterCompare:n,onAfterUpdate:l,onBeforeCompare:r,onBeforeUpdate:a})=>{let s=[],i;return o(u=>{r?.();let d=e?.(u),g=!d||d.length!==s?.length;if(!g&&d){for(let m=0;m<d.length;m++)if(d[m]!==s[m]){g=!0;break}}return n?.(g),g&&(s=d,a?.(),i=t(...d??[]),l?.(i)),i},"memoizedFn")},"memo");function Cn(t){let e=!1;return()=>{if(!e){e=!0;return}t()}}o(Cn,"skipFirstRun");var Ni=o((t,e)=>{for(t=String(t);t.length<e;)t=" "+t;return t},"pad");function Ft({feature:t,fnName:e,objectId:n,onAfterUpdate:l,table:r,...a}){let s,i,c=0,u;function d(h,p){let b=c===0?"(1st run)":p?"(rerun #"+c+")":"(cache)";c++,console.groupCollapsed(`%c\u23F1 ${Ni(`${h.toFixed(1)} ms`,12)} %c${b}%c ${e}%c ${n?`(${e.split(".")[0]}Id: ${n})`:""}`,`font-size: .6rem; font-weight: bold; ${p?`color: hsl(
1
+ import{a as gn,b as $e,e as Vr,f as zr}from"./chunk-X472RKFD.js";import{a as Tr,b as pt,c as Er,d as fn}from"./chunk-Q7DBKLSB.js";import{a as mn}from"./chunk-S4Z7K55A.js";import{b as dn}from"./chunk-5B2RTXBS.js";import{d as $r}from"./chunk-UYEZR3BI.js";import{a as un}from"./chunk-Q6IT6ZD7.js";import{a as Le}from"./chunk-CGQMJYCW.js";import"./chunk-NQZALRU3.js";import"./chunk-OPM7ESDV.js";import"./chunk-Y3AYVFTK.js";import{a as cn}from"./chunk-7RKB5KS7.js";import{a as Ht}from"./chunk-QJLHH3ET.js";import{a as so}from"./chunk-37WYCOQ2.js";import{a as sn}from"./chunk-VASJTDMU.js";import{a as Or}from"./chunk-JQXA2OYK.js";import{b as yr,c as oo}from"./chunk-CCDX5RYT.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import{a as io}from"./chunk-IWZ7GVQO.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import{a as ao}from"./chunk-I23ULEUU.js";import{a as Mr}from"./chunk-2EYOYWS2.js";import{a as Ir,b as Fr}from"./chunk-ZKJS6EBE.js";import{b as vr,c as Rr,f as ro}from"./chunk-RGMVGZV4.js";import{c as br,d as hr,e as wr,f as it,g as on,h as xr,i as Sr}from"./chunk-OQ6I6OXT.js";import{i as _r}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{a as rn}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{a as _e}from"./chunk-4ZEL6BYL.js";import{b as no,c as ct}from"./chunk-3INTX6UT.js";import{b as Zn,c as eo,d as nn,e as pr,l as nt}from"./chunk-C36GGBU5.js";import"./chunk-QAQDMS6R.js";import"./chunk-WS7WNXF3.js";import{a as ln}from"./chunk-RWVIV3U7.js";import{a as kr,b as Pr,c as Nr,d as lo,e as Dr,f as Ar}from"./chunk-HCTJKP5J.js";import{d as oe,f as Ve,g as ze,h as $t,m as to,n as an,o as Te,p as re,t as Cr}from"./chunk-5OMZCVRF.js";import{a as o,d as Me,e as gt,f as Vt,g as zt,i as ft}from"./chunk-I26MS5PJ.js";var Os=Me(Vt(),1);var Ot=Me(gt(),1);var q=Me(Vt(),1);var D=Me(gt(),1);var Rt=Me(Vt(),1);var Y=Me(zt(),1),ot=Me(gt(),1);var mi=2166136261,gi=16777619,fi=o((t,e=mi)=>{let n=e;for(let l=0;l<t.length;l+=1)n^=t.charCodeAt(l),n=Math.imul(n,gi);return(n>>>0).toString(16).padStart(8,"0")},"I"),pi=/([a-z\d])([A-Z])/gu,bi=/[\s_-]+/u,hi=new Set(["access_token","api_key","apikey","card_number","client_secret","credit_card","cvv","passwd","password","private_key","pwd","refresh_token","secret","ssn","token"]),wi=o(t=>{let e=t.replaceAll(pi,"$1 $2").split(bi).map(l=>l.toLowerCase()).filter(l=>l.length>0),n=new Set(e);for(let l=0;l<e.length-1;l+=1){let r=e[l],a=e[l+1];r===void 0||a===void 0||(n.add(`${r}${a}`),n.add(`${r}_${a}`))}return[...n]},"le"),Hr="\u2022\u2022\u2022",Kr=o((t,e)=>{try{return e==="redact"?null:e==="hash"?t==null?t:fi(typeof t=="bigint"?t.toString():typeof t=="string"?t:JSON.stringify(t)):Hr}catch{return Hr}},"W"),Lr=o((t,e)=>{let n=new Map;for(let l of t)l.table===e&&n.set(l.column,l.strategy);return n},"j"),xi=o(t=>{for(let e of wi(t))if(hi.has(e))return!0;return!1},"ae"),jr=o((t,e)=>{let n=e.filter(r=>!t.has(r)&&xi(r));if(n.length===0)return t;let l=new Map(t);for(let r of n)l.set(r,"redact");return l},"z"),Lt=o((t,e,n)=>{if(!n.enabled)return t;let l=n.columns.get(e);return l===void 0?t:Kr(t,l)},"Ce"),pn=o((t,e)=>{if(!e.enabled||e.columns.size===0)return t;let n={...t};for(let[l,r]of e.columns)l in n&&(n[l]=Kr(n[l],r));return n},"ce"),bn=o((t,e)=>!e.enabled||e.columns.size===0?t:t.map(n=>pn(n,e)),"Fe"),Br=o(t=>t==null?"\u2205":t===""?"(empty)":Te(t),"B"),Si=o(t=>{let e=(0,Rt.c)(32),{column:n,onFacetFilter:l,state:r}=t,a=oe(),s;e[0]!==n||e[1]!==l||e[2]!==r.result?.values?(s=o(w=>{let _=Number(w.currentTarget.dataset.index),S=r.result?.values[_];S!==void 0&&l(n,S.value)},"x"),e[0]=n,e[1]=l,e[2]=r.result?.values,e[3]=s):s=e[3];let i=s,c=`db-facet-${n}`,u;e[4]!==n?(u=(0,Y.jsx)("span",{className:"font-medium text-foreground",children:n}),e[4]=n,e[5]=u):u=e[5];let d;e[6]!==r.loading||e[7]!==r.result||e[8]!==a?(d=r.loading&&r.result===null&&(0,Y.jsx)("span",{className:"text-muted-foreground",children:a("Loading\u2026")}),e[6]=r.loading,e[7]=r.result,e[8]=a,e[9]=d):d=e[9];let g;e[10]!==r.error?(g=r.error!==null&&(0,Y.jsx)("span",{className:"text-destructive",role:"alert",children:r.error}),e[10]=r.error,e[11]=g):g=e[11];let m;e[12]!==r.result?.values?(m=r.result?.values??[],e[12]=r.result?.values,e[13]=m):m=e[13];let h;if(e[14]!==n||e[15]!==i||e[16]!==m){let w;e[18]!==n||e[19]!==i?(w=o((_,S)=>(0,Y.jsxs)("button",{className:"flex items-center justify-between gap-2 rounded px-1 py-0.5 text-left text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground","data-index":S,"data-testid":`db-facet-value-${n}`,onClick:i,type:"button",children:[(0,Y.jsx)("span",{className:"truncate",children:Br(_.value)}),(0,Y.jsx)("span",{className:"shrink-0 tabular-nums text-foreground/70",children:_.count})]},Br(_.value)),"c"),e[18]=n,e[19]=i,e[20]=w):w=e[20],h=m.map(w),e[14]=n,e[15]=i,e[16]=m,e[17]=h}else h=e[17];let p;e[21]!==n||e[22]!==r.result||e[23]!==a?(p=r.result?.truncated===!0&&(0,Y.jsx)("span",{className:"text-muted-foreground","data-testid":`db-facet-truncated-${n}`,children:a("Showing the {n} most common values.",{n:r.result.values.length})}),e[21]=n,e[22]=r.result,e[23]=a,e[24]=p):p=e[24];let b;return e[25]!==c||e[26]!==u||e[27]!==d||e[28]!==g||e[29]!==h||e[30]!==p?(b=(0,Y.jsxs)("section",{className:"flex flex-col gap-1","data-testid":c,children:[u,d,g,h,p]}),e[25]=c,e[26]=u,e[27]=d,e[28]=g,e[29]=h,e[30]=p,e[31]=b):b=e[31],b},"ie"),hn=o(t=>{let e=(0,Rt.c)(44),{columns:n,facets:l,mask:r,onFacetFilter:a,onToggleFacet:s}=t,i=oe(),c;e[0]!==s?(c=o(y=>{let{column:M}=y.currentTarget.dataset;M!==void 0&&s(M)},"o"),e[0]=s,e[1]=c):c=e[1];let u=c,d;e[2]!==r?(d=o(y=>r.enabled&&r.columns.has(y),"a"),e[2]=r,e[3]=d):d=e[3];let g=d,m,h,p,b,w,_,S,v;if(e[4]!==n||e[5]!==l||e[6]!==g||e[7]!==i||e[8]!==u){v=Symbol.for("react.early_return_sentinel");e:{let y;e[17]!==g?(y=o(N=>!g(N),"y"),e[17]=g,e[18]=y):y=e[18];let M=n.filter(y),F;if(e[19]!==l||e[20]!==g?(F=Object.entries(l).filter(N=>{let[A]=N;return!g(A)}),e[19]=l,e[20]=g,e[21]=F):F=e[21],m=F,M.length===0){v=null;break e}_="flex w-56 shrink-0 flex-col gap-3 overflow-auto border-l border-border p-3 text-xs",S="db-facets",b="flex flex-col gap-1.5";let P;e[22]!==i?(P=i("Facets"),e[22]=i,e[23]=P):P=e[23],e[24]!==P?(w=(0,Y.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:P}),e[24]=P,e[25]=w):w=e[25],h="flex flex-wrap gap-1";let k;e[26]!==l||e[27]!==u?(k=o(N=>(0,Y.jsx)("button",{"aria-pressed":N in l,className:"rounded border border-border px-1.5 py-0.5 text-muted-foreground transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-column":N,"data-testid":`db-facet-toggle-${N}`,onClick:u,type:"button",children:N},N),"A"),e[26]=l,e[27]=u,e[28]=k):k=e[28],p=M.map(k)}e[4]=n,e[5]=l,e[6]=g,e[7]=i,e[8]=u,e[9]=m,e[10]=h,e[11]=p,e[12]=b,e[13]=w,e[14]=_,e[15]=S,e[16]=v}else m=e[9],h=e[10],p=e[11],b=e[12],w=e[13],_=e[14],S=e[15],v=e[16];if(v!==Symbol.for("react.early_return_sentinel"))return v;let I;e[29]!==h||e[30]!==p?(I=(0,Y.jsx)("div",{className:h,children:p}),e[29]=h,e[30]=p,e[31]=I):I=e[31];let C;e[32]!==I||e[33]!==b||e[34]!==w?(C=(0,Y.jsxs)("div",{className:b,children:[w,I]}),e[32]=I,e[33]=b,e[34]=w,e[35]=C):C=e[35];let R;e[36]!==a||e[37]!==m?(R=m.map(y=>{let[M,F]=y;return(0,Y.jsx)(Si,{column:M,onFacetFilter:a,state:F},M)}),e[36]=a,e[37]=m,e[38]=R):R=e[38];let x;return e[39]!==C||e[40]!==R||e[41]!==_||e[42]!==S?(x=(0,Y.jsxs)("aside",{className:_,"data-testid":S,children:[C,R]}),e[39]=C,e[40]=R,e[41]=_,e[42]=S,e[43]=x):x=e[43],x},"_e"),wn=o(()=>{let[t,e]=(0,ot.useState)({}),n=Le(t),l=(0,ot.useRef)({}),r=o(async(a,s)=>{let i=(l.current[a]??0)+1;l.current[a]=i,e(c=>a in c?{...c,[a]:{error:null,loading:!0,result:c[a]?.result??null}}:c);try{let c=await s(a);if(l.current[a]!==i)return;e(u=>a in u?{...u,[a]:{error:null,loading:!1,result:c}}:u)}catch(c){if(l.current[a]!==i)return;e(u=>a in u?{...u,[a]:{error:$t(c),loading:!1,result:null}}:u)}},"n");return{clearFacets:o(()=>{e({})},"clearFacets"),facets:t,facetsRef:n,refetchFacets:o(a=>{for(let s of Object.keys(n.current))re(r(s,a))},"refetchFacets"),toggleFacet:o((a,s)=>{if(a in n.current){e(i=>Object.fromEntries(Object.entries(i).filter(([c])=>c!==a)));return}e(i=>({...i,[a]:{error:null,loading:!0,result:null}})),s!==null&&re(r(a,s))},"toggleFacet")}},"Me"),_i=[],Ci=o(()=>{let t=(0,Rt.c)(1),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={},t[0]=e):e=t[0];let{data:n}=ct(_e.maskPolicies,e);return Array.isArray(n?.columns)?n.columns:_i},"de"),xn=o(t=>{let e=(0,Rt.c)(16),{columns:n,selectedTable:l}=t,r=Ci(),[a,s]=(0,ot.useState)(!0),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o(()=>{s(yi)},"g"),e[0]=i):i=e[0];let c=i,u;if(e[1]!==n||e[2]!==r||e[3]!==l){let b=Lr(r,l??"");u=jr(b,n),e[1]=n,e[2]=r,e[3]=l,e[4]=u}else u=e[4];let d=u,g;e[5]!==a||e[6]!==r?(g=o((b,w)=>({columns:jr(Lr(r,b),w),enabled:a}),"l"),e[5]=a,e[6]=r,e[7]=g):g=e[7];let m=g,h;e[8]!==d||e[9]!==a?(h={columns:d,enabled:a},e[8]=d,e[9]=a,e[10]=h):h=e[10];let p;return e[11]!==d||e[12]!==a||e[13]!==m||e[14]!==h?(p={maskColumns:d,maskOn:a,maskView:h,maskViewFor:m,onToggleMask:c},e[11]=d,e[12]=a,e[13]=m,e[14]=h,e[15]=p):p=e[15],p},"Te");function yi(t){return!t}o(yi,"fe");var Gr=34,qr=600,vi=o(t=>{let e=(0,Rt.c)(21),{item:n,onSelect:l,prefix:r,selected:a,start:s}=t,i;e[0]!==n.name||e[1]!==l?(i=o(()=>{l(n.name)},"g"),e[0]=n.name,e[1]=l,e[2]=i):i=e[2];let c=i,u=`translateY(${String(s)}px)`,d;e[3]!==u?(d={insetInline:0,position:"absolute",top:0,transform:u},e[3]=u,e[4]=d):d=e[4];let g=d,m=a?"bg-accent font-medium text-accent-foreground":"text-foreground",h;e[5]!==m?(h=ft("flex w-full items-center justify-between gap-2 rounded-md px-2 py-1.5 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent",m),e[5]=m,e[6]=h):h=e[6];let p=`${r}-table-${n.name}`,b;e[7]!==n.name?(b=(0,Y.jsx)("span",{className:"truncate",children:n.name}),e[7]=n.name,e[8]=b):b=e[8];let w;e[9]!==n.rowCount?(w=(0,Y.jsx)("span",{className:"shrink-0 rounded bg-muted px-1.5 text-xs tabular-nums text-muted-foreground",children:n.rowCount}),e[9]=n.rowCount,e[10]=w):w=e[10];let _;e[11]!==c||e[12]!==a||e[13]!==h||e[14]!==p||e[15]!==b||e[16]!==w?(_=(0,Y.jsxs)("button",{"aria-pressed":a,className:h,"data-testid":p,onClick:c,type:"button",children:[b,w]}),e[11]=c,e[12]=a,e[13]=h,e[14]=p,e[15]=b,e[16]=w,e[17]=_):_=e[17];let S;return e[18]!==g||e[19]!==_?(S=(0,Y.jsx)("li",{style:g,children:_}),e[18]=g,e[19]=_,e[20]=S):S=e[20],S},"me"),Sn=o(({header:t,onReload:e,onSelect:n,prefix:l,reloadLabel:r,selected:a,tables:s})=>{let i=oe(),[c,u]=(0,ot.useState)(""),d=(0,ot.useRef)(null),g=o(b=>{u(b.target.value)},"l"),m=(0,ot.useMemo)(()=>{let b=c.trim().toLowerCase();return b===""?s:s.filter(w=>w.name.toLowerCase().includes(b))},[c,s]),h=dn({count:m.length,estimateSize:o(()=>Gr,"estimateSize"),getScrollElement:o(()=>d.current,"getScrollElement"),initialRect:{height:qr,width:240},observeElementRect:o((b,w)=>mn(b,w,qr),"observeElementRect"),overscan:12}).getVirtualItems(),p={height:m.length*Gr};return(0,Y.jsxs)("aside",{className:"flex h-full w-60 shrink-0 flex-col border-e border-border bg-sidebar","data-testid":`${l}-table-list`,children:[t,(0,Y.jsxs)("div",{className:"flex h-9 shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[(0,Y.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:i("Tables")}),e!==void 0&&(0,Y.jsx)("button",{"aria-label":r??i("Refresh"),className:"flex size-6 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent","data-testid":`${l}-load-tables`,onClick:e,title:r??i("Refresh"),type:"button",children:(0,Y.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,Y.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})})})]}),(0,Y.jsx)("div",{className:"shrink-0 border-b border-border p-2",children:(0,Y.jsx)("input",{className:"h-7 w-full rounded-md border border-border bg-background px-2 text-xs outline-none placeholder:text-muted-foreground focus-visible:border-ring","data-testid":`${l}-table-search`,onChange:g,placeholder:i("search table\u2026"),type:"search",value:c})}),(0,Y.jsxs)("ul",{className:"relative flex-1 overflow-y-auto p-1.5","data-testid":`${l}-table-list-rows`,ref:d,children:[(0,Y.jsx)("li",{"aria-hidden":"true",style:p}),h.map(b=>{let w=m[b.index];return w===void 0?null:(0,Y.jsx)(vi,{item:w,onSelect:n,prefix:l,selected:a===w.name,start:b.start},w.name)})]})]})},"$e");var f=Me(zt(),1);var Ur=Me(gt(),1);function Ri(t){return Ii(t)||typeof t=="function"||Fi(t)}o(Ri,"isReactComponent");function Ii(t){return typeof t=="function"&&(()=>{let e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}o(Ii,"isClassComponent");function Fi(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}o(Fi,"isExoticComponent");function bt(t,e){return t==null?null:Ri(t)?Ur.default.createElement(t,e):t}o(bt,"flexRender");function co(t){if("cell"in t&&t.cell){let e=t.cell,n=e.column.columnDef,l=e,r=n;return l.getIsAggregated?.()?bt(r.aggregatedCell??n.cell,e.getContext()):l.getIsPlaceholder?.()?null:bt(n.cell,e.getContext())}return"header"in t&&t.header?bt(t.header.column.columnDef.header,t.header.getContext()):"footer"in t&&t.footer?bt(t.footer.column.columnDef.footer,t.footer.getContext()):null}o(co,"FlexRender");function Jr(t){let e=on(t.source,t.selector,{compare:it});return typeof t.children=="function"?t.children(e):t.children}o(Jr,"Subscribe");function Wr(t){let e=t;return Object.defineProperty(t,"state",{get(){return t.get()}}),"set"in t&&(e.setState=t.set.bind(t)),e}o(Wr,"atomToStore");function uo(t){let{createAtom:e,batch:n}=t,l=e(0);return{createOptionsStore:!1,wrapExternalAtoms:!1,addSubscription:o(()=>{throw new Error("Feature not supported in current reactivity implementation")},"addSubscription"),unmount:o(()=>{throw new Error("Feature not supported in current reactivity implementation")},"unmount"),schedule:t.schedule??(r=>queueMicrotask(r)),batch:n,untrack:o(r=>r(),"untrack"),createReadonlyAtom:o((r,a)=>{let s=a?.compare??Object.is,i=!1,c,u=o(()=>{let g=r();return(!i||!s(c,g))&&(c=g,i=!0),c},"getSnapshot"),d=e(()=>(l.get(),u()),{compare:s});return{get:u,subscribe:d.subscribe.bind(d)}},"createReadonlyAtom"),createWritableAtom:o((r,a)=>e(r,{compare:a?.compare}),"createWritableAtom"),commit:o(()=>{l.set(r=>r+1)},"commit")}}o(uo,"renderPhaseReactivity");function mo(t,e=Object.is){let n=!1,l;return{get:t.get,markCommitted:o(r=>{l=r,n=!0},"markCommitted"),subscribe:o(r=>t.subscribe(a=>{(!n||!e(l,a))&&r(a)}),"subscribe")}}o(mo,"createRenderPhaseSource");function Qr(){return uo({createAtom:wr,batch:hr})}o(Qr,"reactReactivity");function It(t,e){return typeof t=="function"?t(e):t}o(It,"functionalUpdate");function ie(t){if(Array.isArray(t))return t.map(ie);if(t&&typeof t=="object"){let e=Object.getPrototypeOf(t);if(e!==Object.prototype&&e!==null)return t;let n=e===null?H():{},l=Object.keys(t);for(let r=0;r<l.length;r++){let a=l[r];Object.defineProperty(n,a,{configurable:!0,enumerable:!0,value:ie(t[a]),writable:!0})}return n}return t}o(ie,"cloneState");function _n(t,e){let n=Object.keys(e),l=t;for(let r=0;r<n.length;r++){let a=n[r];!a.startsWith("_memo_")&&a!=="_cellsCache"&&(l[a]=e[a])}return t}o(_n,"copyInstancePropertiesWithoutMemos");function H(){return Object.create(null)}o(H,"makeObjectMap");function je(t,e){return Object.prototype.hasOwnProperty.call(t,e)}o(je,"hasOwn");function Be(t,e){return n=>{(e.options.atoms?.[t]??e.baseAtoms[t]).set(l=>It(n,l))}}o(Be,"makeStateUpdater");function Xr(t){if(typeof t!="object"||t===null)return!1;if(Array.isArray(t))return!0;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}o(Xr,"isPlainContainer");function Yr(t){return Reflect.ownKeys(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}o(Yr,"getEnumerableOwnKeys");var Mi=3;function ki(t,e){return Zr(t,e,Mi)}o(ki,"stateSlicesEqual");function Zr(t,e,n){if(Object.is(t,e))return!0;if(n<=0||!Xr(t)||!Xr(e)||(Array.isArray(t)||Array.isArray(e))&&(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length))return!1;let l=Yr(t),r=Yr(e);if(l.length!==r.length)return!1;let a=t,s=e;for(let i=0;i<l.length;i++){let c=l[i];if(!Object.prototype.propertyIsEnumerable.call(e,c)||!Zr(a[c],s[c],n-1))return!1}return!0}o(Zr,"stateSlicesEqualAtDepth");function He(t,e,n,l=ki){let r=`on${e.charAt(0).toUpperCase()}${e.slice(1)}Change`,a=t.options[r];a&&a(s=>{let i=It(n,s);return l(s,i)?s:i})}o(He,"setStateSlice");function el(t){return t instanceof Function}o(el,"isFunction");function tl(t,e){let n=[],l=o(r=>{r.forEach(a=>{n.push(a);let s=e(a);s.length&&l(s)})},"recurse");return l(t),n}o(tl,"flattenBy");var Pi=o(({fn:t,memoDeps:e,onAfterCompare:n,onAfterUpdate:l,onBeforeCompare:r,onBeforeUpdate:a})=>{let s=[],i;return o(u=>{r?.();let d=e?.(u),g=!d||d.length!==s?.length;if(!g&&d){for(let m=0;m<d.length;m++)if(d[m]!==s[m]){g=!0;break}}return n?.(g),g&&(s=d,a?.(),i=t(...d??[]),l?.(i)),i},"memoizedFn")},"memo");function Cn(t){let e=!1;return()=>{if(!e){e=!0;return}t()}}o(Cn,"skipFirstRun");var Ni=o((t,e)=>{for(t=String(t);t.length<e;)t=" "+t;return t},"pad");function Ft({feature:t,fnName:e,objectId:n,onAfterUpdate:l,table:r,...a}){let s,i,c=0,u;function d(h,p){let b=c===0?"(1st run)":p?"(rerun #"+c+")":"(cache)";c++,console.groupCollapsed(`%c\u23F1 ${Ni(`${h.toFixed(1)} ms`,12)} %c${b}%c ${e}%c ${n?`(${e.split(".")[0]}Id: ${n})`:""}`,`font-size: .6rem; font-weight: bold; ${p?`color: hsl(
2
2
  ${Math.max(0,Math.min(120-Math.log10(h)*60,120))}deg 100% 31%);`:""} `,`color: ${c<2?"#FF00FF":"#FF1493"}`,"color: #666","color: #87CEEB"),console.info({feature:t,state:r.store.state,deps:a.memoDeps?.toString()}),console.trace(),console.groupEnd()}o(d,"logTime");let g=o(()=>{if(!l)return;let{schedule:h,untrack:p}=r._reactivity;h(()=>p(()=>l()))},"onAfterUpdateHandler");return Pi({...a,...{onAfterUpdate:o(()=>{g()},"onAfterUpdate")}})}o(Ft,"tableMemo");function nl(t,e="_"){let[n,l]=t.split(e);return{fnKey:l,fnName:`${n}.${l}`,parentName:n}}o(nl,"getFunctionNameInfo");function fe(t,e,n){for(let[l,{fn:r,memoDeps:a}]of Object.entries(n)){let{fnKey:s,fnName:i}=nl(l);e[s]=a?Ft({memoDeps:a,fn:r,fnName:i,table:e,feature:t}):r}}o(fe,"assignTableAPIs");function ce(t,e,n,l){for(let[r,{fn:a,memoDeps:s}]of Object.entries(l)){let{fnKey:i,fnName:c}=nl(r);if(s){let u=`_memo_${i}`;e[i]=function(...d){if(!this[u]){let g=this;this[u]=Ft({memoDeps:o(m=>s(g,m),"memoDeps"),fn:o((...m)=>a(g,...m),"fn"),fnName:c,objectId:g.id,table:n,feature:t})}return this[u](...d)}}else e[i]=function(...u){return a(this,...u)}}}o(ce,"assignPrototypeAPIs");function V(t,e,n,...l){return t[e]?.(...l)??n(t,...l)}o(V,"callMemoOrStaticFn");function ol(t){return t.row.getValue(t.column.id)}o(ol,"cell_getValue");function rl(t){return t.getValue()??t.table.options.renderFallbackValue}o(rl,"cell_renderValue");function ll(t){return{table:t.table,column:t.column,row:t.row,cell:t,getValue:o(()=>t.getValue(),"getValue"),renderValue:o(()=>t.renderValue(),"renderValue")}}o(ll,"cell_getContext");var al={assignCellPrototype:o((t,e)=>{ce("coreCellsFeature",t,e,{cell_getValue:{fn:o(n=>ol(n),"fn")},cell_renderValue:{fn:o(n=>rl(n),"fn")},cell_getContext:{fn:o(n=>ll(n),"fn"),memoDeps:o(n=>[n],"memoDeps")}})},"assignCellPrototype")};function Di(t){if(!t._headerPrototype){t._headerPrototype={table:t};let e=Object.values(t._features);for(let n=0;n<e.length;n++)e[n].assignHeaderPrototype?.(t._headerPrototype,t)}return t._headerPrototype}o(Di,"getHeaderPrototype");function go(t,e,n){let l=Di(t),r=Object.create(l);r.colSpan=0,r.column=e,r.depth=n.depth,r.headerGroup=null,r.id=n.id??e.id,r.index=n.index,r.isPlaceholder=!!n.isPlaceholder,r.placeholderId=n.placeholderId,r.rowSpan=0,r.subHeaders=[];let a=t._headerInstanceInitFns;for(let s=0;s<a.length;s++)a[s](r);return r}o(go,"constructHeader");function Qe(){return{start:[],end:[]}}o(Qe,"getDefaultColumnPinningState");function sl(t){let e=t.getAllColumns(),n=t.getAllLeafColumnsById(),{start:l}=t.atoms.columnPinning?.get()??Qe(),r=[];for(let a=0;a<l.length;a++){let s=n[l[a]];s&&V(s,"getIsVisible",ue)&&r.push(s)}return wt(e,r,t,"start")}o(sl,"table_getStartHeaderGroups");function il(t){let e=t.getAllColumns(),n=t.getAllLeafColumnsById(),{end:l}=t.atoms.columnPinning?.get()??Qe(),r=[];for(let a=0;a<l.length;a++){let s=n[l[a]];s&&V(s,"getIsVisible",ue)&&r.push(s)}return wt(e,r,t,"end")}o(il,"table_getEndHeaderGroups");function cl(t){let e=t.getAllColumns(),n=V(t,"getVisibleLeafColumns",ht),{start:l,end:r}=t.atoms.columnPinning?.get()??Qe();if(l.length||r.length){let a=[...l,...r];n=n.filter(s=>!a.includes(s.id))}return wt(e,n,t,"center")}o(cl,"table_getCenterHeaderGroups");function Ai(t){let{start:e}=t.atoms.columnPinning?.get()??Qe(),n=t.getAllLeafColumnsById(),l=[];for(let r=0;r<e.length;r++){let a=n[e[r]];a&&l.push(a)}return l}o(Ai,"table_getStartLeafColumns");function Oi(t){let{end:e}=t.atoms.columnPinning?.get()??Qe(),n=t.getAllLeafColumnsById(),l=[];for(let r=0;r<e.length;r++){let a=n[e[r]];a&&l.push(a)}return l}o(Oi,"table_getEndLeafColumns");function Ti(t){let{start:e,end:n}=t.atoms.columnPinning?.get()??Qe();if(!e.length&&!n.length)return t.getAllLeafColumns();let l=[...e,...n];return t.getAllLeafColumns().filter(r=>!l.includes(r.id))}o(Ti,"table_getCenterLeafColumns");function Ei(t){return V(t,"getStartLeafColumns",Ai).filter(e=>V(e,"getIsVisible",ue))}o(Ei,"table_getStartVisibleLeafColumns");function Vi(t){return V(t,"getEndLeafColumns",Oi).filter(e=>V(e,"getIsVisible",ue))}o(Vi,"table_getEndVisibleLeafColumns");function zi(t){return V(t,"getCenterLeafColumns",Ti).filter(e=>V(e,"getIsVisible",ue))}o(zi,"table_getCenterVisibleLeafColumns");function Ge(t,e){return e?e==="start"?V(t,"getStartVisibleLeafColumns",Ei):e==="end"?V(t,"getEndVisibleLeafColumns",Vi):V(t,"getCenterVisibleLeafColumns",zi):V(t,"getVisibleLeafColumns",ht)}o(Ge,"table_getPinnedVisibleLeafColumns");function ul(){return H()}o(ul,"getDefaultColumnVisibilityState");function po(t,e){jt(t)&&Bt(t.table,n=>{let l=Object.assign(H(),n),r=e??!V(t,"getIsVisible",ue),a=t.getLeafColumns();for(let s=0;s<a.length;s++){let i=a[s];jt(i)&&(l[i.id]=r)}return l})}o(po,"column_toggleVisibility");function ue(t){let e=t.table.atoms.columnVisibility?.get();if(!e)return!0;let n=t.columns;return n.length?n.some(l=>V(l,"getIsVisible",ue)):(je(e,t.id)?e[t.id]:void 0)??!0}o(ue,"column_getIsVisible");function jt(t){return(t.columnDef.enableHiding??!0)&&(t.table.options.enableHiding??!0)}o(jt,"column_getCanHide");function dl(t){return e=>{po(t,e.target.checked)}}o(dl,"column_getToggleVisibilityHandler");function fo(t){let e=t.getAllCells(),n=[];for(let u=0;u<e.length;u++){let d=e[u];V(d.column,"getIsVisible",ue)&&n.push(d)}let{start:l,end:r}=t.table.atoms.columnPinning?.get()??Qe();if(!l.length&&!r.length)return n;let a=V(t,"getVisibleCellsByColumnId",yn),s=[];for(let u=0;u<l.length;u++){let d=a[l[u]];d&&s.push(d)}let i=[];for(let u=0;u<r.length;u++){let d=a[r[u]];d&&i.push(d)}let c=[];for(let u=0;u<n.length;u++){let d=n[u],g=d.column.id;!l.includes(g)&&!r.includes(g)&&c.push(d)}return[...s,...c,...i]}o(fo,"row_getVisibleCells");function yn(t){let e=H(),n=t.getAllCells();for(let l=0;l<n.length;l++){let r=n[l];V(r.column,"getIsVisible",ue)&&(e[r.column.id]=r)}return e}o(yn,"row_getVisibleCellsByColumnId");function ml(t){return t.getAllFlatColumns().filter(e=>V(e,"getIsVisible",ue))}o(ml,"table_getVisibleFlatColumns");function ht(t){return t.getAllLeafColumns().filter(e=>V(e,"getIsVisible",ue))}o(ht,"table_getVisibleLeafColumns");function Bt(t,e){He(t,"columnVisibility",e)}o(Bt,"table_setColumnVisibility");function gl(t,e){Bt(t,e?H():Object.assign(H(),ie(t.initialState.columnVisibility??{})))}o(gl,"table_resetColumnVisibility");function bo(t,e){e=e??!ho(t);let n=H(),l=t.getAllLeafColumns();for(let r=0;r<l.length;r++){let a=l[r];n[a.id]=e||!jt(a)}Bt(t,n)}o(bo,"table_toggleAllColumnsVisible");function ho(t){return!t.getAllLeafColumns().some(e=>!V(e,"getIsVisible",ue))}o(ho,"table_getIsAllColumnsVisible");function fl(t){return t.getAllLeafColumns().some(e=>V(e,"getIsVisible",ue))}o(fl,"table_getIsSomeColumnsVisible");function pl(t){return e=>{bo(t,e.target.checked)}}o(pl,"table_getToggleAllColumnsVisibilityHandler");function bl(t,e=1){let n=e;for(let l=0;l<t.length;l++){let r=t[l];V(r,"getIsVisible",ue)&&r.columns.length&&(n=Math.max(n,bl(r.columns,e+1)))}return n}o(bl,"getMaxHeaderDepth");function $i(t,e){return t?`${t}_${e}`:String(e)}o($i,"formatHeaderGroupId");function Hi(t,e,n,l){let r=t??"";return e&&(r=r?`${r}_${e}`:String(e)),n&&(r=r?`${r}_${n}`:n),l&&(r=r?`${r}_${l}`:l),r}o(Hi,"formatHeaderId");function Li(t,e){let n=0;for(let l=0;l<t.length;l++)t[l].column===e&&n++;return n}o(Li,"countPendingHeadersForColumn");function hl(t,e,n,l,r,a){let s={depth:e,id:$i(l,e),headers:[]},i=[];for(let c=0;c<t.length;c++){if(!(c in t))continue;let u=t[c],d=i[i.length-1],g=u.column.depth===s.depth,m,h=!1;if(g&&u.column.parent?m=u.column.parent:(m=u.column,h=!0),d&&d.column===m)d.subHeaders.push(u);else{let p=go(n,m,{id:Hi(l,e,m.id,u.id),isPlaceholder:h,placeholderId:h?String(Li(i,m)):void 0,depth:e,index:i.length});p.subHeaders.push(u),i.push(p)}s.headers.push(u),u.headerGroup=s}for(let c=0;c<a.length;c++)a[c](s);r.push(s),e>0&&hl(i,e-1,n,l,r,a)}o(hl,"constructHeaderGroup");function wl(t){for(let e=0;e<t.length;e++){let n=t[e];if(!V(n.column,"getIsVisible",ue))continue;let l=0;if(n.subHeaders.length){wl(n.subHeaders);for(let r=0;r<n.subHeaders.length;r++){let a=n.subHeaders[r];V(a.column,"getIsVisible",ue)&&(l+=a.colSpan)}}else l=1;if(n.colSpan=l,n.isPlaceholder&&n.subHeaders.length===1&&n.subHeaders[0].column===n.column){let r=1,a=n.subHeaders[0];for(;a;)a.rowSpan=0,r++,a=a.subHeaders.length===1&&a.subHeaders[0].column===n.column?a.subHeaders[0]:void 0;n.rowSpan=r}else n.rowSpan=1}}o(wl,"updateHeaderSpans");function wt(t,e,n,l){let r=bl(t),a=[],s=n._headerGroupInstanceInitFns,i=new Array(e.length);for(let c=0;c<e.length;c++)c in e&&(i[c]=go(n,e[c],{depth:r,index:c}));return hl(i,r-1,n,l,a,s),a.reverse(),wl(a[0]?.headers??[]),a}o(wt,"buildHeaderGroups");function ji(t){if(!t._columnPrototype){t._columnPrototype={table:t};let e=Object.values(t._features);for(let n=0;n<e.length;n++)e[n].assignColumnPrototype?.(t._columnPrototype,t)}return t._columnPrototype}o(ji,"getColumnPrototype");function xl(t,e,n,l){let r={...t.getDefaultColumnDef(),...e},a=r.accessorKey,s=a===void 0?void 0:String(a),i=r.id??s?.replaceAll(".","_")??(typeof r.header=="string"?r.header:void 0),c;if(r.accessorFn)c=r.accessorFn;else if(a!==void 0)if(typeof a=="string"&&a.includes(".")){let m=a.split(".");c=o(h=>{let p=h;for(let b=0;b<m.length;b++){let w=m[b];p=p?.[w]}return p},"accessorFn")}else c=o(m=>m[r.accessorKey],"accessorFn");if(!i)throw new Error;let u=ji(t),d=Object.create(u);d.accessorFn=c,d.columnDef=r,d.columns=[],d.depth=n,d.id=`${String(i)}`,d.parent=l;let g=t._columnInstanceInitFns;for(let m=0;m<g.length;m++)g[m](d);return d}o(xl,"constructColumn");function Sl(){return[]}o(Sl,"getDefaultColumnOrderState");function wo(t){let e=o(n=>{let l=H();for(let r=0;r<n.length;r++)l[n[r].id]=r;return l},"buildIndexes");return{all:e(Ge(t)),center:e(Ge(t,"center")),start:e(Ge(t,"start")),end:e(Ge(t,"end"))}}o(wo,"table_getColumnIndexes");function _l(t,e){return V(t.table,"getColumnIndexes",wo)[e==="start"?"start":e==="end"?"end":e==="center"?"center":"all"][t.id]??-1}o(_l,"column_getIndex");function Cl(t,e){return Ge(t.table,e)[0]?.id===t.id}o(Cl,"column_getIsFirstColumn");function yl(t,e){let n=Ge(t.table,e);return n[n.length-1]?.id===t.id}o(yl,"column_getIsLastColumn");function xo(t,e){He(t,"columnOrder",e)}o(xo,"table_setColumnOrder");function vl(t,e){xo(t,e?[]:ie(t.initialState.columnOrder??[]))}o(vl,"table_resetColumnOrder");function Gt(t){let e=t.atoms.columnOrder?.get();return n=>{let l=[];if(!e?.length)l=n;else{let r=new Map;for(let a=0;a<n.length;a++){let s=n[a];r.set(s.id,s)}for(let a=0;a<e.length;a++){let s=e[a],i=r.get(s);i&&(l.push(i),r.delete(s))}for(let a=0;a<n.length;a++){let s=n[a];r.has(s.id)&&l.push(s)}}return Bi(t,l)}}o(Gt,"table_getOrderColumnsFn");function Bi(t,e){let n=t.atoms.grouping?.get()??[],{groupedColumnMode:l}=t.options;if(!n.length||!l)return e;let r=e.filter(i=>!n.includes(i.id));if(l==="remove")return r;let a=new Map;for(let i=0;i<e.length;i++){let c=e[i];a.set(c.id,c)}let s=[];for(let i=0;i<n.length;i++){let c=a.get(n[i]);c&&s.push(c)}return[...s,...r]}o(Bi,"orderColumns");function Rl(t){return[t,...t.columns.flatMap(e=>e.getFlatColumns())]}o(Rl,"column_getFlatColumns");function Il(t){if(t.columns.length){let e=t.columns.flatMap(n=>n.getLeafColumns());return V(t.table,"getOrderColumns",Gt)(e)}return[t]}o(Il,"column_getLeafColumns");function Fl(t){return{header:o(e=>{let n=e.header.column.columnDef;return n.accessorKey?n.accessorKey:n.accessorFn?n.id:null},"header"),cell:o(e=>e.renderValue()?.toString?.()??null,"cell"),...Object.values(t._features).reduce((e,n)=>Object.assign(e,n.getDefaultColumnDef?.()),{}),...t.options.defaultColumn}}o(Fl,"table_getDefaultColumnDef");function Ml(t,e,n,l=0){let r=new Array(e.length);for(let a=0;a<e.length;a++){if(!(a in e))continue;let s=e[a],i=xl(t,s,l,n),c=s;i.columns=c.columns?Ml(t,c.columns,i,l+1):[],r[a]=i}return r}o(Ml,"constructColumns");function kl(t){return Ml(t,t.options.columns)}o(kl,"table_getAllColumns");function Pl(t){return t.getAllColumns().flatMap(e=>e.getFlatColumns())}o(Pl,"table_getAllFlatColumns");function Nl(t){let e=H(),n=t.getAllFlatColumns();for(let l=0;l<n.length;l++){let r=n[l];e[r.id]=r}return e}o(Nl,"table_getAllFlatColumnsById");function Dl(t){let e=t.getAllColumns().flatMap(n=>n.getLeafColumns());return V(t,"getOrderColumns",Gt)(e)}o(Dl,"table_getAllLeafColumns");function Al(t){let e=H(),n=t.getAllLeafColumns();for(let l=0;l<n.length;l++){let r=n[l];e[r.id]=r}return e}o(Al,"table_getAllLeafColumnsById");function Ol(t,e){return t.getAllFlatColumnsById()[e]}o(Ol,"table_getColumn");var Tl={assignColumnPrototype:o((t,e)=>{ce("coreColumnsFeature",t,e,{column_getFlatColumns:{fn:o(n=>Rl(n),"fn"),memoDeps:o(n=>[n.table.options.columns],"memoDeps")},column_getLeafColumns:{fn:o(n=>Il(n),"fn"),memoDeps:o(n=>[n.table.atoms.columnOrder?.get(),n.table.atoms.grouping?.get(),n.table.options.columns,n.table.options.groupedColumnMode],"memoDeps")}})},"assignColumnPrototype"),constructTableAPIs:o(t=>{fe("coreColumnsFeature",t,{table_getDefaultColumnDef:{fn:o(()=>Fl(t),"fn"),memoDeps:o(()=>[t.options.defaultColumn],"memoDeps")},table_getAllColumns:{fn:o(()=>kl(t),"fn"),memoDeps:o(()=>[t.options.columns],"memoDeps")},table_getAllFlatColumns:{fn:o(()=>Pl(t),"fn"),memoDeps:o(()=>[t.options.columns],"memoDeps")},table_getAllFlatColumnsById:{fn:o(()=>Nl(t),"fn"),memoDeps:o(()=>[t.options.columns],"memoDeps")},table_getAllLeafColumns:{fn:o(()=>Dl(t),"fn"),memoDeps:o(()=>[t.atoms.columnOrder?.get(),t.atoms.grouping?.get(),t.options.columns,t.options.groupedColumnMode],"memoDeps")},table_getAllLeafColumnsById:{fn:o(()=>Al(t),"fn"),memoDeps:o(()=>[t.getAllLeafColumns()],"memoDeps")},table_getColumn:{fn:o(e=>Ol(t,e),"fn")}})},"constructTableAPIs")};function El(t,e){for(let n=0;n<t.subHeaders.length;n++)El(t.subHeaders[n],e);e.push(t)}o(El,"collectLeafHeaders");function Vl(t){let e=[];return El(t,e),e}o(Vl,"header_getLeafHeaders");function zl(t){return{column:t.column,header:t,table:t.column.table}}o(zl,"header_getContext");function $l(t){let{start:e,end:n}=t.atoms.columnPinning?.get()??Qe(),l=t.getAllColumns(),r=V(t,"getVisibleLeafColumns",ht);if(!e.length&&!n.length)return wt(l,r,t);let a=t.getAllLeafColumnsById(),s=[];for(let u=0;u<e.length;u++){let d=a[e[u]];d&&V(d,"getIsVisible",ue)&&s.push(d)}let i=[];for(let u=0;u<n.length;u++){let d=a[n[u]];d&&V(d,"getIsVisible",ue)&&i.push(d)}let c=r.filter(u=>!e.includes(u.id)&&!n.includes(u.id));return wt(l,[...s,...c,...i],t)}o($l,"table_getHeaderGroups");function Hl(t){return[...t.getHeaderGroups()].reverse()}o(Hl,"table_getFooterGroups");function Ll(t){let e=t.getHeaderGroups(),n=[];for(let l=0;l<e.length;l++){let r=e[l].headers;for(let a=0;a<r.length;a++)n.push(r[a])}return n}o(Ll,"table_getFlatHeaders");function jl(t){let e=t.getHeaderGroups()[0]?.headers??[],n=[];for(let l=0;l<e.length;l++){let r=e[l].getLeafHeaders();for(let a=0;a<r.length;a++)n.push(r[a])}return n}o(jl,"table_getLeafHeaders");var Bl={assignHeaderPrototype:o((t,e)=>{ce("coreHeadersFeature",t,e,{header_getLeafHeaders:{fn:o(n=>Vl(n),"fn"),memoDeps:o(n=>[n.column.table.options.columns],"memoDeps")},header_getContext:{fn:o(n=>zl(n),"fn"),memoDeps:o(n=>[n.column.table.options.columns],"memoDeps")}})},"assignHeaderPrototype"),constructTableAPIs:o(t=>{fe("coreHeadersFeature",t,{table_getHeaderGroups:{fn:o(()=>$l(t),"fn"),memoDeps:o(()=>[t.options.columns,t.atoms.columnOrder?.get(),t.atoms.grouping?.get(),t.atoms.columnPinning?.get(),t.atoms.columnVisibility?.get(),t.options.groupedColumnMode],"memoDeps")},table_getFooterGroups:{fn:o(()=>Hl(t),"fn"),memoDeps:o(()=>[t.getHeaderGroups()],"memoDeps")},table_getFlatHeaders:{fn:o(()=>Ll(t),"fn"),memoDeps:o(()=>[t.getHeaderGroups()],"memoDeps")},table_getLeafHeaders:{fn:o(()=>jl(t),"fn"),memoDeps:o(()=>[t.getHeaderGroups()],"memoDeps")}})},"constructTableAPIs")};function Gi(t){if(!t._rowPrototype){t._rowPrototype={table:t};let e=Object.values(t._features);for(let n=0;n<e.length;n++)e[n].assignRowPrototype?.(t._rowPrototype,t)}return t._rowPrototype}o(Gi,"getRowPrototype");var Gl=o((t,e,n,l,r,a,s)=>{let i=Gi(t),c=Object.create(i);c._displayIndexCache=-1,c._uniqueValuesCache=H(),c._valuesCache=H(),c.depth=r,c.id=e,c.index=l,c.original=n,c.parentId=s,c.subRows=a??[];let u=t._rowInstanceInitFns;for(let d=0;d<u.length;d++)u[d](c);return c},"constructRow");var _o=/([0-9]+)/gm;function xt(t){let e=Object.assign((n,l,r)=>{let a=n.getValue(r),s=l.getValue(r),i=e.resolveDataValue;return i&&(a=i(a),s=i(s)),e.sort(a,s,n,l,r)},t);return e}o(xt,"constructSortFn");var Co=xt({resolveDataValue:o(t=>Rn(t).toLowerCase(),"resolveDataValue"),sort:o((t,e)=>Ul(t,e),"sort")}),qi=xt({resolveDataValue:o(t=>Rn(t),"resolveDataValue"),sort:o((t,e)=>Ul(t,e),"sort")}),yo=xt({resolveDataValue:o(t=>Rn(t).toLowerCase(),"resolveDataValue"),sort:o((t,e)=>Ro(t,e),"sort")}),Ki=xt({resolveDataValue:o(t=>Rn(t),"resolveDataValue"),sort:o((t,e)=>Ro(t,e),"sort")}),vo=xt({resolveDataValue:o(t=>Ui(t),"resolveDataValue"),sort:o((t,e)=>t>e?1:t<e?-1:0,"sort")}),Mt=xt({sort:o((t,e)=>Ro(t,e),"sort")});function Ro(t,e){return t===e?0:t>e?1:-1}o(Ro,"compareBasic");function Ui(t){return t instanceof Date?t.getTime():t}o(Ui,"toDateSortValue");function Rn(t){return typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?"":String(t):typeof t=="string"?t:""}o(Rn,"toString");function Ul(t,e){let n=0,l=0,r=t.length,a=e.length;for(;n<r&&l<a;){let s=vn(t.charCodeAt(n)),i=vn(e.charCodeAt(l)),c=So(t,n,s),u=So(e,l,i);if(!s&&!i){let g=Ji(t,n,c,e,l,u);if(g)return g;n=c,l=u;continue}if(s!==i)return s?1:-1;let d=Wi(t,n,c,e,l,u);if(d)return d;n=c,l=u}return Kl(t,n)-Kl(e,l)}o(Ul,"compareAlphanumeric");function vn(t){return t>=48&&t<=57}o(vn,"isDigit");function So(t,e,n){let l=e+1;for(;l<t.length&&vn(t.charCodeAt(l))===n;)l++;return l}o(So,"findChunkEnd");function Ji(t,e,n,l,r,a){let s=n-e,i=a-r,c=s<i?s:i;for(let u=0;u<c;u++){let d=t.charCodeAt(e+u),g=l.charCodeAt(r+u);if(d>g)return 1;if(g>d)return-1}return s>i?1:i>s?-1:0}o(Ji,"compareStringChunks");function Wi(t,e,n,l,r,a){let s=e;for(;s<n&&t.charCodeAt(s)===48;)s++;let i=r;for(;i<a&&l.charCodeAt(i)===48;)i++;let c=n-s,u=a-i;if(c===0&&u===0)return 0;if(c<=15&&u<=15){let m=ql(t,s,n),h=ql(l,i,a);return m>h?1:h>m?-1:0}let d=parseInt(t.slice(e,n),10),g=parseInt(l.slice(r,a),10);return d>g?1:g>d?-1:0}o(Wi,"compareNumericChunks");function ql(t,e,n){let l=0;for(let r=e;r<n;r++)l=l*10+t.charCodeAt(r)-48;return l}o(ql,"parseSmallInt");function Kl(t,e){let n=0,l=e;for(;l<t.length;)n++,l=So(t,l,vn(t.charCodeAt(l)));return n}o(Kl,"countRemainingChunks");function Jl(){return[]}o(Jl,"getDefaultCellSelectionState");function Qi(t,e){He(t,"cellSelection",e?Jl():ie(t.initialState.cellSelection)??Jl())}o(Qi,"table_resetCellSelection");function Wl(t){t.atoms.cellSelection&&(t.options.autoResetAll??t.options.autoResetCellSelection??!0)&&t._reactivity.schedule(()=>Qi(t))}o(Wl,"table_autoResetCellSelection");function Ql(t){t.atoms.expanded&&(t.options.autoResetAll??t.options.autoResetExpanded??!t.options.manualExpanding)&&t._reactivity.schedule(()=>Xi(t))}o(Ql,"table_autoResetExpanded");function Xi(t,e){let n=t.initialState.expanded;He(t,"expanded",e?H():n===!0?!0:Object.assign(H(),ie(n??{})))}o(Xi,"table_resetExpanded");var In=0;function Fn(t){if(t.options.autoResetAll??t.options.autoResetPageIndex??!t.options.manualPagination){if((t.atoms.pagination?.get()?.pageIndex??In)===In)return;ec(t,!0)}}o(Fn,"table_autoResetPageIndex");function Yi(t,e){He(t,"pagination",e)}o(Yi,"table_setPagination");function Zi(t,e){Yi(t,n=>{let l=It(e,n.pageIndex),r=typeof t.options.pageCount>"u"||t.options.pageCount===-1?Number.MAX_SAFE_INTEGER:t.options.pageCount-1;return l=Math.max(0,Math.min(l,r)),{...n,pageIndex:l}})}o(Zi,"table_setPageIndex");function ec(t,e){Zi(t,e?In:t.initialState.pagination?.pageIndex??In)}o(ec,"table_resetPageIndex");function Xl(){return[]}o(Xl,"getDefaultSortingState");function Kt(t,e){He(t,"sorting",e)}o(Kt,"table_setSorting");function Io(t,e){Kt(t,e?[]:ie(t.initialState.sorting??[]))}o(Io,"table_resetSorting");function Yl(t){t.atoms.sorting&&(t.options.autoResetAll??t.options.autoResetSorting??!1)&&Io(t)}o(Yl,"table_autoResetSorting");function Fo(t){let e=t.table._rowModelFns.sortFns,n=t.table.getFilteredRowModel().flatRows.slice(0,10),l,r=!1;for(let a=0;a<n.length;a++){let s=n[a].getValue(t.id);if(Object.prototype.toString.call(s)==="[object Date]"){l="datetime";break}if(typeof s=="string"&&(r=!0,s.split(_o).length>1)){l="alphanumeric";break}}if(!l&&r&&(l="text"),l){let a=e?.[l];if(a||l==="alphanumeric"&&(a=e?.text),a)return a}return Mt}o(Fo,"column_getAutoSortFn");function Mo(t){let e=t.table.getFilteredRowModel().flatRows.slice(0,10);for(let n=0;n<e.length;n++){let l=e[n].getValue(t.id);if(l!=null)return typeof l=="string"?"asc":"desc"}return"desc"}o(Mo,"column_getAutoSortDir");function Mn(t){let e=t.table._rowModelFns.sortFns;return el(t.columnDef.sortFn)?t.columnDef.sortFn:t.columnDef.sortFn==="auto"?Fo(t):e?.[t.columnDef.sortFn]??Mt}o(Mn,"column_getSortFn");function ko(t,e,n){let l=No(t,n&&qt(t)),r=typeof e<"u";Kt(t.table,a=>{let s=a.findIndex(m=>m.id===t.id),i=s===-1?void 0:a[s],c=[],u,d=r?e:l==="desc",g=!!(a.length&&qt(t)&&n);return g?i?u="toggle":u="add":i?u="toggle":u="replace",u==="toggle"&&(r||l||(u="remove")),u==="add"?(c=[...a,{id:t.id,desc:d}],c.splice(0,c.length-(t.table.options.maxMultiSortColCount??Number.MAX_SAFE_INTEGER))):u==="toggle"?c=g?a.map(m=>m.id===t.id?{...m,desc:d}:m):[{id:t.id,desc:d}]:u==="remove"?c=g?a.filter(m=>m.id!==t.id):[]:c=[{id:t.id,desc:d}],c})}o(ko,"column_toggleSorting");function Po(t){return t.columnDef.sortDescFirst??t.table.options.sortDescFirst??Mo(t)==="desc"?"desc":"asc"}o(Po,"column_getFirstSortDir");function No(t,e){let n=Po(t),l=Do(t);return l?l!==n&&(t.table.options.enableSortingRemoval??!0)&&(!e||(t.table.options.enableMultiRemove??!0))?!1:l==="desc"?"asc":"desc":n}o(No,"column_getNextSortingOrder");function Ut(t){return(t.columnDef.enableSorting??!0)&&(t.table.options.enableSorting??!0)&&!!t.accessorFn}o(Ut,"column_getCanSort");function qt(t){return t.columnDef.enableMultiSort??t.table.options.enableMultiSort??!!t.accessorFn}o(qt,"column_getCanMultiSort");function Do(t){let e=t.table.atoms.sorting?.get()?.find(n=>n.id===t.id);return e?e.desc?"desc":"asc":!1}o(Do,"column_getIsSorted");function Zl(t){return t.table.atoms.sorting?.get()?.findIndex(e=>e.id===t.id)??-1}o(Zl,"column_getSortIndex");function ea(t){Kt(t.table,e=>e.length?e.filter(n=>n.id!==t.id):[])}o(ea,"column_clearSorting");function ta(t){let e=Ut(t);return n=>{e&&ko(t,void 0,qt(t)?t.table.options.isMultiSortEvent?.(n):!1)}}o(ta,"column_getToggleSortingHandler");function na(){return t=>Ft({feature:"coreRowModelsFeature",table:t,fnName:"table.getCoreRowModel",memoDeps:o(()=>[t.options.data],"memoDeps"),fn:o(()=>tc(t,t.options.data),"fn"),onAfterUpdate:Cn(()=>{Ql(t),Fn(t),Yl(t),Wl(t)})})}o(na,"createCoreRowModel");function oa(t,e,n,l=0,r){let a=[];for(let s=0;s<n.length;s++){let i=n[s],c=Gl(t,t.getRowId(i,s,r),i,s,l,void 0,r?.id);e.flatRows.push(c),e.rowsById[c.id]=c,a.push(c),t.options.getSubRows&&(c.originalSubRows=t.options.getSubRows(i,s),c.originalSubRows?.length&&(c.subRows=oa(t,e,c.originalSubRows,l+1,c)))}return a}o(oa,"accessRows");function tc(t,e){let n={rows:[],flatRows:[],rowsById:H()};return n.rows=oa(t,n,e),n}o(tc,"_createCoreRowModel");function ra(t){return t._rowModels.coreRowModel||(t._rowModels.coreRowModel=t.options.features.coreRowModel?.(t)??na()(t)),t._rowModels.coreRowModel()}o(ra,"table_getCoreRowModel");function la(t){return t.getCoreRowModel()}o(la,"table_getPreFilteredRowModel");function aa(t){return t._rowModels.filteredRowModel||(t._rowModels.filteredRowModel=t.options.features.filteredRowModel?.(t)),t.options.manualFiltering||!t._rowModels.filteredRowModel?t.getPreFilteredRowModel():t._rowModels.filteredRowModel()}o(aa,"table_getFilteredRowModel");function sa(t){return t.getFilteredRowModel()}o(sa,"table_getPreGroupedRowModel");function ia(t){return t._rowModels.groupedRowModel||(t._rowModels.groupedRowModel=t.options.features.groupedRowModel?.(t)),t.options.manualGrouping||!t._rowModels.groupedRowModel?t.getPreGroupedRowModel():t._rowModels.groupedRowModel()}o(ia,"table_getGroupedRowModel");function ca(t){return t.getGroupedRowModel()}o(ca,"table_getPreSortedRowModel");function ua(t){return t._rowModels.sortedRowModel||(t._rowModels.sortedRowModel=t.options.features.sortedRowModel?.(t)),t.options.manualSorting||!t._rowModels.sortedRowModel?t.getPreSortedRowModel():t._rowModels.sortedRowModel()}o(ua,"table_getSortedRowModel");function da(t){return t.getSortedRowModel()}o(da,"table_getPreExpandedRowModel");function ma(t){return t._rowModels.expandedRowModel||(t._rowModels.expandedRowModel=t.options.features.expandedRowModel?.(t)),t.options.manualExpanding||!t._rowModels.expandedRowModel?t.getPreExpandedRowModel():t._rowModels.expandedRowModel()}o(ma,"table_getExpandedRowModel");function ga(t){return t.getExpandedRowModel()}o(ga,"table_getPrePaginatedRowModel");function fa(t){return t._rowModels.paginatedRowModel||(t._rowModels.paginatedRowModel=t.options.features.paginatedRowModel?.(t)),t.options.manualPagination||!t._rowModels.paginatedRowModel?t.getPrePaginatedRowModel():t._rowModels.paginatedRowModel()}o(fa,"table_getPaginatedRowModel");function pa(t){return t.getPaginatedRowModel()}o(pa,"table_getRowModel");var ba={constructTableAPIs:o(t=>{fe("coreRowModelsFeature",t,{table_getCoreRowModel:{fn:o(()=>ra(t),"fn")},table_getPreFilteredRowModel:{fn:o(()=>la(t),"fn")},table_getFilteredRowModel:{fn:o(()=>aa(t),"fn")},table_getPreGroupedRowModel:{fn:o(()=>sa(t),"fn")},table_getGroupedRowModel:{fn:o(()=>ia(t),"fn")},table_getPreSortedRowModel:{fn:o(()=>ca(t),"fn")},table_getSortedRowModel:{fn:o(()=>ua(t),"fn")},table_getPreExpandedRowModel:{fn:o(()=>da(t),"fn")},table_getExpandedRowModel:{fn:o(()=>ma(t),"fn")},table_getPrePaginatedRowModel:{fn:o(()=>ga(t),"fn")},table_getPaginatedRowModel:{fn:o(()=>fa(t),"fn")},table_getRowModel:{fn:o(()=>pa(t),"fn")}})},"constructTableAPIs")};function nc(t){if(!t._cellPrototype){t._cellPrototype={table:t};let e=Object.values(t._features);for(let n=0;n<e.length;n++)e[n].assignCellPrototype?.(t._cellPrototype,t)}return t._cellPrototype}o(nc,"getCellPrototype");function ha(t,e,n){let l=nc(n),r=Object.create(l);r.column=t,r.id=`${e.id}_${t.id}`,r.row=e;let a=n._cellInstanceInitFns;for(let s=0;s<a.length;s++)a[s](r);return r}o(ha,"constructCell");function wa(t){let e=t.table.getRowsInDisplayOrder(),n=t._displayIndexCache;return e[n]===t?n:-1}o(wa,"row_getDisplayIndex");function xa(t){let e=t.getPrePaginatedRowModel().rows;if(t.options.paginateExpandedRows===!1){let n=[],l=o(r=>{r._displayIndexCache=n.length,n.push(r),r.subRows.length&&r.getIsExpanded?.()&&r.subRows.forEach(l)},"handleRow");return e.forEach(l),n}for(let n=0;n<e.length;n++)e[n]._displayIndexCache=n;return e}o(xa,"table_getRowsInDisplayOrder");function Sa(t,e){if(je(t._valuesCache,e))return t._valuesCache[e];let n=t.table.getColumn(e);if(n?.accessorFn)return t._valuesCache[e]=n.accessorFn(t.original,t.index),t._valuesCache[e]}o(Sa,"row_getValue");function _a(t,e){if(je(t._uniqueValuesCache,e))return t._uniqueValuesCache[e];let n=t.table.getColumn(e);if(n?.accessorFn)return n.columnDef.getUniqueValues?(t._uniqueValuesCache[e]=n.columnDef.getUniqueValues(t.original,t.index),t._uniqueValuesCache[e]):(t._uniqueValuesCache[e]=[t.getValue(e)],t._uniqueValuesCache[e])}o(_a,"row_getUniqueValues");function Ca(t,e){return t.getValue(e)??t.table.options.renderFallbackValue}o(Ca,"row_renderValue");function ya(t){return tl(t.subRows,e=>e.subRows)}o(ya,"row_getLeafRows");function va(t){let e=t.getCoreRowModel().flatRows,n=0;for(let l=0;l<e.length;l++)n=Math.max(n,e[l].depth);return n}o(va,"table_getMaxSubRowDepth");function Ra(t){if(t.parentId)return t.table.getCoreRowModel().rowsById[t.parentId]??t.table.getRow(t.parentId,!0)}o(Ra,"row_getParentRow");function Ia(t){let e=[],n=t;for(;;){let l=n.getParentRow();if(!l)break;e.push(l),n=l}return e.reverse()}o(Ia,"row_getParentRows");function Fa(t){let e=t.table.getAllLeafColumns(),n=t._cellsCache;n||(n=t._cellsCache=new WeakMap);let l=new Array(e.length);for(let r=0;r<e.length;r++){let a=e[r],s=n.get(a);s||(s=ha(a,t,t.table),n.set(a,s)),l[r]=s}return l}o(Fa,"row_getAllCells");function Ma(t){let e=H(),n=t.getAllCells();for(let l=0;l<n.length;l++){let r=n[l];e[r.column.id]=r}return e}o(Ma,"row_getAllCellsByColumnId");function ka(t,e,n,l){return e.options.getRowId?.(t,n,l)??(l?`${l.id}.${n}`:String(n))}o(ka,"table_getRowId");function Pa(t,e,n){let l=(n?t.getPrePaginatedRowModel():t.getRowModel()).rowsById[e];if(!l&&(l=t.getCoreRowModel().rowsById[e],!l))throw new Error;return l}o(Pa,"table_getRow");var Na={assignRowPrototype:o((t,e)=>{ce("coreRowsFeature",t,e,{row_getDisplayIndex:{fn:o(n=>wa(n),"fn")},row_getAllCellsByColumnId:{fn:o(n=>Ma(n),"fn"),memoDeps:o(n=>[n.getAllCells()],"memoDeps")},row_getAllCells:{fn:o(n=>Fa(n),"fn"),memoDeps:o(n=>[n.table.getAllLeafColumns()],"memoDeps")},row_getLeafRows:{fn:o(n=>ya(n),"fn"),memoDeps:o(n=>[n.subRows],"memoDeps")},row_getParentRow:{fn:o(n=>Ra(n),"fn")},row_getParentRows:{fn:o(n=>Ia(n),"fn")},row_getUniqueValues:{fn:o((n,l)=>_a(n,l),"fn")},row_getValue:{fn:o((n,l)=>Sa(n,l),"fn")},row_renderValue:{fn:o((n,l)=>Ca(n,l),"fn")}})},"assignRowPrototype"),constructTableAPIs:o(t=>{fe("coreRowsFeature",t,{table_getRowsInDisplayOrder:{fn:o(()=>xa(t),"fn"),memoDeps:o(()=>[t.getPrePaginatedRowModel().rows,t.options.paginateExpandedRows,t.options.paginateExpandedRows===!1?t.atoms.expanded?.get():void 0],"memoDeps")},table_getRowId:{fn:o((e,n,l)=>ka(e,t,n,l),"fn")},table_getRow:{fn:o((e,n)=>Pa(t,e,n),"fn")},table_getMaxSubRowDepth:{fn:o(()=>va(t),"fn"),memoDeps:o(()=>[t.getCoreRowModel()],"memoDeps")}})},"constructTableAPIs")};function kn(t,e,n=(l,r)=>l===r){let l=e===void 0?t.options.state:e;t._reactivity.batch(()=>{if(l)for(let r in l){let a=t.baseAtoms[r];if(!a)continue;let s=l[r],i=s===void 0?t.initialState[r]:s;n(t._reactivity.untrack(()=>a.get()),i)||a.set(()=>i)}})}o(kn,"table_syncExternalStateToBaseAtoms");function Pn(t,e,n=(l,r)=>l===r){t._reactivity.batch(()=>{kn(t,e,n),t._reactivity.commit?.()})}o(Pn,"table_publishExternalState");function Ao(t){let e=ie(t.initialState);t._reactivity.batch(()=>{let l=Object.keys(e);for(let r=0;r<l.length;r++){let a=l[r];t.baseAtoms[a].set(e[a])}});let n=Object.values(t._features);for(let l=0;l<n.length;l++)n[l].resetTableInstanceData?.(t)}o(Ao,"table_reset");function Da(t,e){let{features:n,atoms:l,initialState:r}=t.options;if(!t.options.mergeOptions)return{...t.options,...e,features:n,atoms:l,initialState:r};let a=t.options.mergeOptions(t.options,e),s={...Object.getOwnPropertyDescriptors(a)};return Object.defineProperties(Object.create(Object.getPrototypeOf(a)),{...s,features:{value:n,enumerable:!0,configurable:!0,writable:!0},atoms:{value:l,enumerable:!0,configurable:!0,writable:!0},initialState:{value:r,enumerable:!0,configurable:!0,writable:!0}})}o(Da,"table_mergeOptions");function Jt(t,e,n){let l=Da(t,It(e,t.options));t.optionsStore?t.optionsStore.set(()=>l):t.options=l,n?.syncExternalState!==!1&&Pn(t,l.state??null)}o(Jt,"table_setOptions");var Aa={constructTableAPIs:o(t=>{fe("coreTablesFeature",t,{table_reset:{fn:o(()=>Ao(t),"fn")},table_setOptions:{fn:o(e=>Jt(t,e),"fn")}})},"constructTableAPIs")};var Oa={coreCellsFeature:al,coreColumnsFeature:Tl,coreHeadersFeature:Bl,coreRowModelsFeature:ba,coreRowsFeature:Na,coreTablesFeature:Aa};function Ta(t,e={}){return Object.values(t).forEach(n=>{e=n.getInitialState?.(e)??e}),ie(e)}o(Ta,"getInitialTableState");function Oo(t){let e=t.features.coreReactivityFeature,{aggregationFns:n,columnMeta:l,coreRowModel:r,expandedRowModel:a,facetedMinMaxValues:s,facetedRowModel:i,facetedUniqueValues:c,filterFns:u,filterMeta:d,filteredRowModel:g,groupedRowModel:m,paginatedRowModel:h,sortFns:p,sortedRowModel:b,tableMeta:w,..._}=t.features,S={_cellInstanceInitFns:[],_columnInstanceInitFns:[],_features:{...Oa,..._},_headerGroupInstanceInitFns:[],_headerInstanceInitFns:[],_reactivity:e,_rowInstanceInitFns:[],_rowModelFns:{aggregationFns:n,filterFns:u,sortFns:p},_rowModels:{},atoms:{},baseAtoms:{}},v=Object.values(S._features),I={...v.reduce((R,x)=>Object.assign(R,x.getDefaultTableOptions?.(S)),{}),...t};if(e.wrapExternalAtoms&&I.atoms)for(let[R,x]of Object.entries(I.atoms)){let y=x,M=e.createWritableAtom(y.get(),{debugName:`externalAtom/${R}`});I.atoms[R]=M;let F=!1,P=y.subscribe(N=>{F||M.set(N)}),k=M.subscribe(N=>{F=!0,y.set(N),F=!1});e.addSubscription(P),e.addSubscription(k)}e.createOptionsStore?(S.optionsStore=e.createWritableAtom(I,{debugName:"table/optionsStore"}),Object.defineProperty(S,"options",{configurable:!0,enumerable:!0,get(){return S.optionsStore.get()},set(R){S.optionsStore.set(()=>R)}})):S.options=I,S.initialState=Ta(S._features,S.options.initialState);let C=Object.keys(S.initialState);for(let R=0;R<C.length;R++){let x=C[R];S.baseAtoms[x]=e.createWritableAtom(S.initialState[x],{debugName:`table/baseAtoms/${x}`}),S.atoms[x]=e.createReadonlyAtom(()=>{let y=S.options,M=y.atoms?.[x],F=M?M.get():S.baseAtoms[x].get();if(M)return F;let P=y.state;if(P&&je(P,x)){let k=P[x];return k===void 0?S.initialState[x]:k}return F},{debugName:`table/atoms/${x}`})}kn(S),S.store=Wr(e.createReadonlyAtom(()=>{let R={};for(let x=0;x<C.length;x++){let y=C[x];R[y]=S.atoms[y].get()}return R},{compare:it,debugName:"table/store"}));for(let R=0;R<v.length;R++){let x=v[R];x.initTableInstanceData?.(S),x.initCellInstanceData&&S._cellInstanceInitFns.push(x.initCellInstanceData.bind(x)),x.initColumnInstanceData&&S._columnInstanceInitFns.push(x.initColumnInstanceData.bind(x)),x.initHeaderGroupInstanceData&&S._headerGroupInstanceInitFns.push(x.initHeaderGroupInstanceData.bind(x)),x.initHeaderInstanceData&&S._headerInstanceInitFns.push(x.initHeaderInstanceData.bind(x)),x.initRowInstanceData&&S._rowInstanceInitFns.push(x.initRowInstanceData.bind(x)),x.constructTableAPIs?.(S)}return S}o(Oo,"constructTable");var To={getInitialState:o(t=>({columnOrder:Sl(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({onColumnOrderChange:Be("columnOrder",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{ce("columnOrderingFeature",t,e,{column_getIndex:{fn:o((n,l)=>_l(n,l),"fn")},column_getIsFirstColumn:{fn:o((n,l)=>Cl(n,l),"fn")},column_getIsLastColumn:{fn:o((n,l)=>yl(n,l),"fn")}})},"assignColumnPrototype"),constructTableAPIs:o(t=>{fe("columnOrderingFeature",t,{table_getColumnIndexes:{fn:o(()=>wo(t),"fn"),memoDeps:o(()=>[t.options.columns,t.atoms.columnOrder?.get(),t.atoms.columnPinning?.get(),t.atoms.columnVisibility?.get(),t.atoms.grouping?.get(),t.options.groupedColumnMode],"memoDeps")},table_setColumnOrder:{fn:o(e=>xo(t,e),"fn")},table_resetColumnOrder:{fn:o(e=>vl(t,e),"fn")},table_getOrderColumnsFn:{fn:o(()=>Gt(t),"fn"),memoDeps:o(()=>[t.atoms.columnOrder?.get(),t.atoms.grouping?.get(),t.options.groupedColumnMode],"memoDeps")}})},"constructTableAPIs")};function Ea(){return H()}o(Ea,"getDefaultColumnSizingState");function Eo(){return{size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER}}o(Eo,"getDefaultColumnSizingColumnDef");function kt(t){let e=Eo(),n=t.table.atoms.columnSizing?.get(),l=n&&je(n,t.id)?n[t.id]:void 0;return Math.min(Math.max(t.columnDef.minSize??e.minSize,l??t.columnDef.size??e.size),t.columnDef.maxSize??e.maxSize)}o(kt,"column_getSize");function Nn(t){let e=H(),n=H(),l=new Array(t.length),r=0;for(let s=0;s<t.length;s++){let i=t[s],c=V(i,"getSize",kt);l[s]=c,e[i.id]=r,r+=c}let a=0;for(let s=t.length-1;s>=0;s--)n[t[s].id]=a,a+=l[s];return{starts:e,afters:n}}o(Nn,"buildColumnOffsets");function Dn(t){return{all:Nn(Ge(t)),center:Nn(Ge(t,"center")),start:Nn(Ge(t,"start")),end:Nn(Ge(t,"end"))}}o(Dn,"table_getColumnOffsets");function Va(t){return t==="start"?"start":t==="end"?"end":t==="center"?"center":"all"}o(Va,"toOffsetsKey");function za(t,e){return V(t.table,"getColumnOffsets",Dn)[Va(e)].starts[t.id]??0}o(za,"column_getStart");function $a(t,e){return V(t.table,"getColumnOffsets",Dn)[Va(e)].afters[t.id]??0}o($a,"column_getAfter");function Ha(t){Pt(t.table,e=>{let n=H(),l=Object.keys(e);for(let r=0;r<l.length;r++){let a=l[r];a!==t.id&&(n[a]=e[a])}return n})}o(Ha,"column_resetSize");function La(t){if(!t.subHeaders.length)return kt(t.column);let e=0;for(let n=0;n<t.subHeaders.length;n++)e+=La(t.subHeaders[n]);return e}o(La,"sumHeaderSize");function rt(t){return La(t)}o(rt,"header_getSize");function Vo(t){if(t.index>0){let e=t.headerGroup?.headers[t.index-1];if(e)return V(e,"getStart",Vo)+V(e,"getSize",rt)}return 0}o(Vo,"header_getStart");function Pt(t,e){t.options.onColumnSizingChange?.(e)}o(Pt,"table_setColumnSizing");function ja(t,e){Pt(t,e?H():Object.assign(H(),ie(t.initialState.columnSizing??{})))}o(ja,"table_resetColumnSizing");function Ba(t){return t.getHeaderGroups()[0]?.headers.reduce((e,n)=>e+rt(n),0)??0}o(Ba,"table_getTotalSize");function Ga(t){return V(t,"getStartHeaderGroups",sl)[0]?.headers.reduce((e,n)=>e+rt(n),0)??0}o(Ga,"table_getStartTotalSize");function qa(t){return V(t,"getCenterHeaderGroups",cl)[0]?.headers.reduce((e,n)=>e+rt(n),0)??0}o(qa,"table_getCenterTotalSize");function Ka(t){return V(t,"getEndHeaderGroups",il)[0]?.headers.reduce((e,n)=>e+rt(n),0)??0}o(Ka,"table_getEndTotalSize");function On(){return{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}}o(On,"getDefaultColumnResizingState");function $o(t){return(t.columnDef.enableResizing??!0)&&(t.table.options.enableColumnResizing??!0)}o($o,"column_getCanResize");function Ua(t){return t.table.atoms.columnResizing?.get()?.isResizingColumn===t.id}o(Ua,"column_getIsResizing");function Ja(t,e){let n=t.table.getColumn(t.column.id),l=$o(n);return r=>{if(!l||zo(r)&&r.touches.length>1)return;let a=rt(t),s=t.getLeafHeaders().map(C=>[C.column.id,kt(C.column)]),i=zo(r)?Math.round(r.touches[0].clientX):r.clientX,c=H(),u=o((C,R)=>{if(typeof R!="number")return;let x=n.table,y=x.options.columnResizeMode==="onChange"||C==="end";x._reactivity.batch(()=>{Nt(x,M=>{let F=x.options.columnResizeDirection==="rtl"?-1:1,P=(R-(M.startOffset??0))*F,k=M.startSize??0,N=Math.max(k>0?P/k:0,-.999999);if(y){let A=M.columnSizingStart;for(let z=0;z<A.length;z++){let O=A[z],$=O[1];c[O[0]]=Math.round(Math.max($>0?$+$*N:P/A.length,0)*100)/100}}return{...M,deltaOffset:P,deltaPercentage:N}}),y&&Pt(x,M=>Object.assign(H(),M,c))})},"updateOffset"),d=null,g=!1,m,h=o(()=>{g?(g=!1,u("move",m),d=requestAnimationFrame(h)):d=null},"flushMove"),p=o(C=>{if(m=C,typeof requestAnimationFrame!="function"){u("move",C);return}if(d!==null){g=!0;return}u("move",C),d=requestAnimationFrame(h)},"onMove"),b=o(C=>{d!==null&&(cancelAnimationFrame(d),d=null,g=!1),n.table._reactivity.batch(()=>{u("end",C??m),Nt(n.table,R=>({...R,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))})},"onEnd"),w=e||(typeof document<"u"?document:null),_={moveHandler:o(C=>p(C.clientX),"moveHandler"),upHandler:o(C=>{w?.removeEventListener("mousemove",_.moveHandler),w?.removeEventListener("mouseup",_.upHandler),b(C.clientX)},"upHandler")},S={moveHandler:o(C=>(C.cancelable&&(C.preventDefault(),C.stopPropagation()),p(C.touches[0].clientX),!1),"moveHandler"),upHandler:o(C=>{v(),C.cancelable&&(C.preventDefault(),C.stopPropagation()),b(C.touches[0]?.clientX)},"upHandler"),cancelHandler:o(()=>{v(),b()},"cancelHandler")},v=o(()=>{w?.removeEventListener("touchmove",S.moveHandler),w?.removeEventListener("touchend",S.upHandler),w?.removeEventListener("touchcancel",S.cancelHandler)},"removeTouchEvents"),I=oc()?{passive:!1}:!1;zo(r)?(w?.addEventListener("touchmove",S.moveHandler,I),w?.addEventListener("touchend",S.upHandler,I),w?.addEventListener("touchcancel",S.cancelHandler,I)):(w?.addEventListener("mousemove",_.moveHandler,I),w?.addEventListener("mouseup",_.upHandler,I)),Nt(n.table,C=>({...C,startOffset:i,startSize:a,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:n.id}))}}o(Ja,"header_getResizeHandler");function Nt(t,e){t.options.onColumnResizingChange?.(e)}o(Nt,"table_setColumnResizing");function Wa(t,e){Nt(t,e?On():ie(t.initialState.columnResizing??On()))}o(Wa,"table_resetHeaderSizeInfo");var An=null;function oc(){if(typeof An=="boolean")return An;let t=!1;try{let e={get passive(){return t=!0,!1}},n=o(()=>{},"noop");window.addEventListener("test",n,e),window.removeEventListener("test",n)}catch{t=!1}return An=t,An}o(oc,"passiveEventSupported");function zo(t){return t.type==="touchstart"}o(zo,"isTouchStartEvent");var Ho={getInitialState:o(t=>({columnResizing:On(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnResizingChange:Be("columnResizing",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{ce("columnResizingFeature",t,e,{column_getCanResize:{fn:o(n=>$o(n),"fn")},column_getIsResizing:{fn:o(n=>Ua(n),"fn")}})},"assignColumnPrototype"),assignHeaderPrototype:o((t,e)=>{ce("columnResizingFeature",t,e,{header_getResizeHandler:{fn:o((n,l)=>Ja(n,l),"fn")}})},"assignHeaderPrototype"),constructTableAPIs:o(t=>{fe("columnResizingFeature",t,{table_setColumnResizing:{fn:o(e=>Nt(t,e),"fn")},table_resetHeaderSizeInfo:{fn:o(e=>Wa(t,e),"fn")}})},"constructTableAPIs")};var Lo={getInitialState:o(t=>({columnSizing:Ea(),...t}),"getInitialState"),getDefaultColumnDef:o(()=>Eo(),"getDefaultColumnDef"),getDefaultTableOptions:o(t=>({onColumnSizingChange:Be("columnSizing",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{ce("columnSizingFeature",t,e,{column_getSize:{fn:o(n=>kt(n),"fn"),memoDeps:o(n=>[e.options.columns,e.atoms.columnSizing?.get()?.[n.id]],"memoDeps")},column_getStart:{fn:o((n,l)=>za(n,l),"fn")},column_getAfter:{fn:o((n,l)=>$a(n,l),"fn")},column_resetSize:{fn:o(n=>Ha(n),"fn")}})},"assignColumnPrototype"),assignHeaderPrototype:o((t,e)=>{ce("columnSizingFeature",t,e,{header_getSize:{fn:o(n=>rt(n),"fn"),memoDeps:o(n=>[e.options.columns,n.column.columns.length>0?e.atoms.columnSizing?.get():e.atoms.columnSizing?.get()?.[n.column.id]],"memoDeps")},header_getStart:{fn:o(n=>Vo(n),"fn"),memoDeps:o(()=>[e.options.columns,e.atoms.columnSizing?.get(),e.atoms.columnOrder?.get(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get(),e.atoms.grouping?.get(),e.options.groupedColumnMode],"memoDeps")}})},"assignHeaderPrototype"),constructTableAPIs:o(t=>{fe("columnSizingFeature",t,{table_getColumnOffsets:{fn:o(()=>Dn(t),"fn"),memoDeps:o(()=>[t.options.columns,t.atoms.columnSizing?.get(),t.atoms.columnOrder?.get(),t.atoms.columnPinning?.get(),t.atoms.columnVisibility?.get(),t.atoms.grouping?.get(),t.options.groupedColumnMode],"memoDeps")},table_setColumnSizing:{fn:o(e=>Pt(t,e),"fn")},table_resetColumnSizing:{fn:o(e=>ja(t,e),"fn")},table_getTotalSize:{fn:o(()=>Ba(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")},table_getStartTotalSize:{fn:o(()=>Ga(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")},table_getCenterTotalSize:{fn:o(()=>qa(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")},table_getEndTotalSize:{fn:o(()=>Ka(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")}})},"constructTableAPIs")};var jo={getInitialState:o(t=>({columnVisibility:ul(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({onColumnVisibilityChange:Be("columnVisibility",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{ce("columnVisibilityFeature",t,e,{column_getIsVisible:{fn:o(n=>ue(n),"fn"),memoDeps:o(n=>[e.options.columns,e.atoms.columnVisibility?.get(),n.columns],"memoDeps")},column_getCanHide:{fn:o(n=>jt(n),"fn")},column_getToggleVisibilityHandler:{fn:o(n=>dl(n),"fn")},column_toggleVisibility:{fn:o((n,l)=>po(n,l),"fn")}})},"assignColumnPrototype"),assignRowPrototype:o((t,e)=>{ce("columnVisibilityFeature",t,e,{row_getVisibleCells:{fn:o(n=>fo(n),"fn"),memoDeps:o(n=>[n.getAllCells(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get()],"memoDeps")},row_getVisibleCellsByColumnId:{fn:o(n=>yn(n),"fn"),memoDeps:o(n=>[n.getAllCells(),e.atoms.columnVisibility?.get()],"memoDeps")}})},"assignRowPrototype"),constructTableAPIs:o(t=>{fe("columnVisibilityFeature",t,{table_getVisibleFlatColumns:{fn:o(()=>ml(t),"fn"),memoDeps:o(()=>[t.atoms.columnVisibility?.get(),t.atoms.columnOrder?.get(),t.atoms.grouping?.get(),t.options.columns,t.options.groupedColumnMode],"memoDeps")},table_getVisibleLeafColumns:{fn:o(()=>ht(t),"fn"),memoDeps:o(()=>[t.atoms.columnVisibility?.get(),t.atoms.columnOrder?.get(),t.atoms.grouping?.get(),t.options.columns,t.options.groupedColumnMode],"memoDeps")},table_setColumnVisibility:{fn:o(e=>Bt(t,e),"fn")},table_resetColumnVisibility:{fn:o(e=>gl(t,e),"fn")},table_toggleAllColumnsVisible:{fn:o(e=>bo(t,e),"fn")},table_getIsAllColumnsVisible:{fn:o(()=>ho(t),"fn")},table_getIsSomeColumnsVisible:{fn:o(()=>fl(t),"fn")},table_getToggleAllColumnsVisibilityHandler:{fn:o(()=>pl(t),"fn")}})},"constructTableAPIs")};function Qa(){return H()}o(Qa,"getDefaultRowSelectionState");function St(t,e){t.options.onRowSelectionChange?.(e)}o(St,"table_setRowSelection");function Xa(t,e){t._lastSelectedRowId=null,St(t,e?H():Object.assign(H(),ie(t.initialState.rowSelection??{})))}o(Xa,"table_resetRowSelection");function Bo(t,e,n){t._lastSelectedRowId=null,St(t,l=>{if(e=typeof e<"u"?e:!V(t,"getIsAllRowsSelected",Ko),n?.deselectAll&&!e)return H();let r=Object.assign(H(),l),a=t.getPreGroupedRowModel().flatRows;if(e){let s=new Map;a.forEach(i=>{Tn(i,s)&&(r[i.id]=!0)})}else a.forEach(s=>{Xe(s)&&delete r[s.id]});return r})}o(Bo,"table_toggleAllRowsSelected");function Go(t,e,n){t._lastSelectedRowId=null,St(t,l=>{let r=typeof e<"u"?e:!V(t,"getIsAllPageRowsSelected",Uo);if(n?.deselectAll&&!r)return H();let a=Object.assign(H(),l);return t.getRowModel().rows.forEach(s=>{zn(a,s.id,r,!0,t,!0)}),a})}o(Go,"table_toggleAllPageRowsSelected");function Ya(t){return t.getCoreRowModel()}o(Ya,"table_getPreSelectedRowModel");function Za(t){let e=t.getCoreRowModel();return V(t,"getIsSomeRowsSelected",Wt)?Qo(e,t):{rows:[],flatRows:[],rowsById:H()}}o(Za,"table_getSelectedRowModel");function es(t){let e=t.getFilteredRowModel();return V(t,"getIsSomeRowsSelected",Wt)?Qo(e,t):{rows:[],flatRows:[],rowsById:H()}}o(es,"table_getFilteredSelectedRowModel");function ts(t){let e=t.getSortedRowModel();return V(t,"getIsSomeRowsSelected",Wt)?Qo(e,t):{rows:[],flatRows:[],rowsById:H()}}o(ts,"table_getGroupedSelectedRowModel");function qo(t){return Object.keys(t.atoms.rowSelection?.get()??{})}o(qo,"table_getSelectedRowIds");function Ko(t){let e=t.getFilteredRowModel().flatRows,n=t.atoms.rowSelection?.get()??{},l=!!(e.length&&Object.keys(n).length);if(l){let r=new Map;e.some(a=>!Qt(a,n)&&Tn(a,r))&&(l=!1)}return l}o(Ko,"table_getIsAllRowsSelected");function Uo(t){let e=t.getPaginatedRowModel().flatRows,n=t.atoms.rowSelection?.get()??{},l=new Map,r=!1;for(let a=0;a<e.length;a++){let s=e[a];if(Qt(s,n))!r&&Tn(s,l)&&(r=!0);else if(Tn(s,l))return!1}return r}o(Uo,"table_getIsAllPageRowsSelected");function Wt(t){return V(t,"getSelectedRowIds",qo).length>0}o(Wt,"table_getIsSomeRowsSelected");function ns(t){return t.getPaginatedRowModel().flatRows.filter(e=>Xe(e)).some(e=>En(e)||V(e,"getIsSomeSelected",Wo))}o(ns,"table_getIsSomePageRowsSelected");function os(t){return e=>{Bo(t,e.target.checked)}}o(os,"table_getToggleAllRowsSelectedHandler");function rs(t){return e=>{Go(t,e.target.checked)}}o(rs,"table_getToggleAllPageRowsSelectedHandler");function Jo(t,e,n){let l=En(t);St(t.table,r=>{e=typeof e<"u"?e:!l;let a=Object.assign(H(),r);return zn(a,t.id,e,(n?.selectChildren??!0)&&ut(t),t.table),!e&&n?.deselectParents&&ss(a,t),a})}o(Jo,"row_toggleSelected");function En(t){return Qt(t,t.table.atoms.rowSelection?.get()??{})}o(En,"row_getIsSelected");function Wo(t){return Xo(t)==="some"}o(Wo,"row_getIsSomeSelected");function ls(t){return Xo(t)==="all"}o(ls,"row_getIsAllSubRowsSelected");function Xe(t){let e=t.table.options;return typeof e.enableRowSelection=="function"?e.enableRowSelection(t):e.enableRowSelection??!0}o(Xe,"row_getCanSelect");function Vn(t){let e=t.table.options;return typeof e.enableSubRowSelection=="function"?e.enableSubRowSelection(t):e.enableSubRowSelection??!0}o(Vn,"row_getCanSelectSubRows");function ut(t){let e=t.table.options;return typeof e.enableMultiRowSelection=="function"?e.enableMultiRowSelection(t):e.enableMultiRowSelection??!0}o(ut,"row_getCanMultiSelect");function as(t,e){let n=Xe(t);return l=>{if(!n)return;let r=l,a=t.table,s=r.target.checked,i=a._lastSelectedRowId;(!(a.options.enableRowRangeSelection!==!1&&i!==null&&ut(t)&&(a.options.isRowRangeSelectionEvent?.(l)??!1))||!rc(t,i,s,e))&&Jo(t,s,e),a._lastSelectedRowId=t.id}}o(as,"row_getToggleSelectedHandler");function rc(t,e,n,l){let r=l?.selectChildren??!0,a=t.table,s=a.getRowsInDisplayOrder(),i=a.getPrePaginatedRowModel().rowsById[e]??a.getCoreRowModel().rowsById[e];if(!i)return!1;let c=i.getDisplayIndex(),u=t.getDisplayIndex(),d=s[c],g=s[u];if(c<0||u<0||c>=s.length||u>=s.length||d?.id!==i.id||g?.id!==t.id||!ut(i)||!ut(t))return!1;let m=Math.min(c,u),h=Math.max(c,u);return St(a,p=>{let b=Object.assign(H(),p);for(let w=m;w<=h;w++){let _=s[w];!Xe(_)||!ut(_)||(zn(b,_.id,n,r,a),!n&&l?.deselectParents&&ss(b,_))}return b}),!0}o(rc,"selectRowRange");function zn(t,e,n,l,r,a){let s=r.getRow(e,!0);n?(ut(s)||Object.keys(t).forEach(i=>delete t[i]),Xe(s)&&(t[e]=!0)):(!a||Xe(s))&&delete t[e],l&&s.subRows.length&&Vn(s)&&s.subRows.forEach(i=>zn(t,i.id,n,l,r,a))}o(zn,"mutateRowIsSelected");function Tn(t,e){if(!Xe(t))return!1;let n=t.table;if(n.options.enableSubRowSelection===!0)return!0;let l=t.parentId;if(l===void 0)return!0;let r=e.get(l);if(r!==void 0)return r;let a=n.getCoreRowModel().rowsById,s=[],i=!0,c=l;for(;c!==void 0;){let u=e.get(c);if(u!==void 0){i=u;break}s.push(c);let d=a[c]??n.getRow(c,!0);if(!Vn(d)){i=!1;break}c=d.parentId}return s.forEach(u=>e.set(u,i)),i}o(Tn,"isRowSelectableInSelectAll");function ss(t,e){let n=e.table.getCoreRowModel().rowsById,l=e.parentId;for(;l!==void 0;)delete t[l],l=(n[l]??e.table.getRow(l,!0)).parentId}o(ss,"pruneAncestorRowIds");function is(t,e,n,l){let r=[];for(let a=0;a<t.length;a++){let s=t[a],i=Qt(s,e);if(i&&(n.push(s),l[s.id]=s),s.subRows.length){let c=is(s.subRows,e,n,l);if(i){let u=Object.create(Object.getPrototypeOf(s));_n(u,s),u.subRows=c,r.push(u)}}else i&&r.push(s)}return r}o(is,"selectRowsRecursively");function Qo(t,e){let n=[],l=H(),r=e.atoms.rowSelection?.get()??{};return{rows:is(t.rows,r,n,l),flatRows:n,rowsById:l}}o(Qo,"selectRowsFn");function Qt(t,e){return!!(je(e,t.id)&&e[t.id])}o(Qt,"isRowSelected");function Xo(t){if(!t.subRows.length)return!1;let e=t.table.atoms.rowSelection?.get()??{},n=!1,l=!0,r=!1;for(let a=0;a<t.subRows.length;a++){let s=t.subRows[a];if(n&&!l)break;if(Xe(s)&&(r=!0,Qt(s,e)?n=!0:l=!1),s.subRows.length){let i=Xo(s);i==="all"?(n=!0,r=!0):i==="some"?(n=!0,l=!1,r=!0):l=!1}}return r?l?"all":n?"some":!1:!1}o(Xo,"isSubRowSelected");var Yo={initTableInstanceData:o(t=>{t._lastSelectedRowId=null},"initTableInstanceData"),resetTableInstanceData:o(t=>{t._lastSelectedRowId=null},"resetTableInstanceData"),getInitialState:o(t=>({rowSelection:Qa(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({onRowSelectionChange:Be("rowSelection",t),enableRowSelection:!0,enableMultiRowSelection:!0,enableRowRangeSelection:!0,enableSubRowSelection:!0,isRowRangeSelectionEvent:o(e=>{let n=e;return!!(n.shiftKey||n.nativeEvent?.shiftKey)},"isRowRangeSelectionEvent")}),"getDefaultTableOptions"),assignRowPrototype:o((t,e)=>{ce("rowSelectionFeature",t,e,{row_toggleSelected:{fn:o((n,l,r)=>Jo(n,l,r),"fn")},row_getIsSelected:{fn:o(n=>En(n),"fn")},row_getIsSomeSelected:{fn:o(n=>Wo(n),"fn"),memoDeps:o(n=>[n.subRows,n.table.atoms.rowSelection?.get(),n.table.options.enableRowSelection],"memoDeps")},row_getIsAllSubRowsSelected:{fn:o(n=>ls(n),"fn"),memoDeps:o(n=>[n.subRows,n.table.atoms.rowSelection?.get(),n.table.options.enableRowSelection],"memoDeps")},row_getCanSelect:{fn:o(n=>Xe(n),"fn")},row_getCanSelectSubRows:{fn:o(n=>Vn(n),"fn")},row_getCanMultiSelect:{fn:o(n=>ut(n),"fn")},row_getToggleSelectedHandler:{fn:o((n,l)=>as(n,l),"fn")}})},"assignRowPrototype"),constructTableAPIs:o(t=>{fe("rowSelectionFeature",t,{table_setRowSelection:{fn:o(e=>St(t,e),"fn")},table_resetRowSelection:{fn:o(e=>Xa(t,e),"fn")},table_toggleAllRowsSelected:{fn:o((e,n)=>Bo(t,e,n),"fn")},table_toggleAllPageRowsSelected:{fn:o((e,n)=>Go(t,e,n),"fn")},table_getPreSelectedRowModel:{fn:o(()=>Ya(t),"fn")},table_getSelectedRowModel:{fn:o(()=>Za(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getCoreRowModel()],"memoDeps")},table_getFilteredSelectedRowModel:{fn:o(()=>es(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getFilteredRowModel()],"memoDeps")},table_getGroupedSelectedRowModel:{fn:o(()=>ts(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getSortedRowModel()],"memoDeps")},table_getSelectedRowIds:{fn:o(()=>qo(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get()],"memoDeps")},table_getIsAllRowsSelected:{fn:o(()=>Ko(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getFilteredRowModel(),t.options.enableRowSelection,t.options.enableSubRowSelection],"memoDeps")},table_getIsAllPageRowsSelected:{fn:o(()=>Uo(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getPaginatedRowModel(),t.options.enableRowSelection,t.options.enableSubRowSelection],"memoDeps")},table_getIsSomeRowsSelected:{fn:o(()=>Wt(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get()],"memoDeps")},table_getIsSomePageRowsSelected:{fn:o(()=>ns(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getPaginatedRowModel(),t.options.enableRowSelection],"memoDeps")},table_getToggleAllRowsSelectedHandler:{fn:o(()=>os(t),"fn")},table_getToggleAllPageRowsSelectedHandler:{fn:o(()=>rs(t),"fn")}})},"constructTableAPIs")};var Zo={getInitialState(t){return{sorting:Xl(),...t}},getDefaultColumnDef(){return{sortFn:"auto",sortUndefined:1}},getDefaultTableOptions(t){return{autoResetSorting:!1,onSortingChange:Be("sorting",t),isMultiSortEvent:o(e=>e.shiftKey,"isMultiSortEvent")}},assignColumnPrototype(t,e){ce("rowSortingFeature",t,e,{column_getAutoSortFn:{fn:o(n=>Fo(n),"fn")},column_getAutoSortDir:{fn:o(n=>Mo(n),"fn")},column_getSortFn:{fn:o(n=>Mn(n),"fn")},column_toggleSorting:{fn:o((n,l,r)=>ko(n,l,r),"fn")},column_getFirstSortDir:{fn:o(n=>Po(n),"fn")},column_getNextSortingOrder:{fn:o((n,l)=>No(n,l),"fn")},column_getCanSort:{fn:o(n=>Ut(n),"fn")},column_getCanMultiSort:{fn:o(n=>qt(n),"fn")},column_getIsSorted:{fn:o(n=>Do(n),"fn")},column_getSortIndex:{fn:o(n=>Zl(n),"fn")},column_clearSorting:{fn:o(n=>ea(n),"fn")},column_getToggleSortingHandler:{fn:o(n=>ta(n),"fn")}})},constructTableAPIs(t){fe("rowSortingFeature",t,{table_setSorting:{fn:o(e=>Kt(t,e),"fn")},table_resetSorting:{fn:o(e=>Io(t,e),"fn")}})}};function er(){return t=>{let e=t;return Ft({feature:"rowSortingFeature",table:e,fnName:"table.getSortedRowModel",memoDeps:o(()=>[e.atoms.sorting?.get(),e.getPreSortedRowModel()],"memoDeps"),fn:o(()=>lc(e),"fn"),onAfterUpdate:Cn(()=>Fn(e))})}}o(er,"createSortedRowModel");function lc(t){let e=t.getPreSortedRowModel(),n=t.atoms.sorting?.get();if(!e.rows.length||!n?.length)return e;let l=[],r=n.filter(c=>{let u=t.getColumn(c.id);return u?Ut(u):!1});if(!r.length)return e;let a=[];for(let c=0;c<r.length;c++){let u=r[c],d=t.getColumn(u.id);d&&a.push({id:u.id,desc:u.desc,sortUndefined:d.columnDef.sortUndefined,invertSorting:d.columnDef.invertSorting,sortFn:Mn(d)})}let s=o((c,u)=>{for(let d=0;d<a.length;d++){let g=a[d],m=g.sortUndefined,h=g.desc,p=0;if(m){let b=c.getValue(g.id),w=u.getValue(g.id),_=b===void 0,S=w===void 0;if(_&&S)continue;if(_||S){if(m==="first")return _?-1:1;if(m==="last")return _?1:-1;p=_?m:-m}}if(p===0&&(p=g.sortFn(c,u,g.id)),p!==0)return h&&(p*=-1),g.invertSorting&&(p*=-1),p}return c.index-u.index},"compareRows"),i=o(c=>{let u=c.slice();u.sort(s);let d=!1;for(let g=0;g<u.length;g++){let m=u[g];m!==c[g]&&(d=!0);let h=l.length;if(l.push(m),m.subRows.length){let p=i(m.subRows);if(p.changed){let b=Object.create(Object.getPrototypeOf(m));_n(b,m),b.subRows=p.rows,u[g]=b,l[h]=b,d=!0}}}return{rows:u,changed:d}},"sortData");return{rows:i(e.rows).rows,flatRows:l,rowsById:e.rowsById}}o(lc,"_createSortedRowModel");var dt=Me(gt(),1);var ac=typeof window>"u"?dt.useEffect:dt.useLayoutEffect;function tr(t,e){let[{table:n,rootSource:l}]=(0,dt.useState)(()=>{let c=Oo({...t,features:{coreReactivityFeature:Qr(),...t.features}});return c.Subscribe=(u=>Jr({...u,source:u.source??c.store})),c.FlexRender=co,{table:c,rootSource:mo(c.store,it)}}),r=n;Jt(r,c=>({...c,...t}),{syncExternalState:!1});let a=r.options.state,s=l.get(),i=on(l,e,{compare:it});return ac(()=>{l.markCommitted(s),Pn(r,a??null,it)}),(0,dt.useMemo)(()=>({...n,options:t,state:i}),[n,t,i])}o(tr,"useTable");var us=Me(Vt(),1),ds=Me(gt(),1),Ie=Me(zt(),1);var sc=[{label:"=",value:"eq"},{label:"\u2260",value:"ne"},{label:"<",value:"lt"},{label:"\u2264",value:"lte"},{label:">",value:"gt"},{label:"\u2265",value:"gte"},{label:"contains",value:"contains"}],ic=o(t=>{let e=t.trim(),n=Number(e);return e!==""&&Number.isFinite(n)&&String(n)===e?n:t},"$"),cc=o(t=>t.operator==="contains"?t.value==="":t.operator!=="eq"&&t.operator!=="ne"&&t.literal===void 0&&t.value.trim()==="","z"),Ye=o(t=>t.filter(e=>e.column!==""&&!cc(e)).map(e=>e.operator==="contains"?{column:e.column,operator:e.operator,value:e.value}:{column:e.column,operator:e.operator,value:e.literal===void 0?ic(e.value):e.literal[0]}),"L"),cs=o((t,e)=>({column:t.column,operator:t.operator,value:t.value,...e}),"P"),ms=o(t=>{let e=(0,us.c)(44),{columns:n,filters:l,onAskAi:r,onFiltersChange:a,onSearchChange:s,search:i}=t,[c,u]=(0,ds.useState)(""),d;e[0]!==n[0]||e[1]!==l||e[2]!==a?(d=o(()=>{a([...l,{column:n[0]??"",operator:"eq",value:""}])},"N"),e[0]=n[0],e[1]=l,e[2]=a,e[3]=d):d=e[3];let g=d,m;e[4]!==l||e[5]!==a?(m=o(F=>{let P=Number(F.currentTarget.dataset.index);a(l.filter((k,N)=>N!==P))},"T"),e[4]=l,e[5]=a,e[6]=m):m=e[6];let h=m,p;e[7]!==l||e[8]!==a?(p=o(F=>{let P=Number(F.currentTarget.dataset.index),k=F.currentTarget.value;a(l.map((N,A)=>A===P?cs(N,{column:k}):N))},"y"),e[7]=l,e[8]=a,e[9]=p):p=e[9];let b=p,w;e[10]!==l||e[11]!==a?(w=o(F=>{let P=Number(F.currentTarget.dataset.index),k=F.currentTarget.value;a(l.map((N,A)=>A===P?{...N,operator:k}:N))},"S"),e[10]=l,e[11]=a,e[12]=w):w=e[12];let _=w,S;e[13]!==l||e[14]!==a?(S=o(F=>{let P=Number(F.currentTarget.dataset.index),k=F.currentTarget.value;a(l.map((N,A)=>A===P?cs(N,{value:k}):N))},"k"),e[13]=l,e[14]=a,e[15]=S):S=e[15];let v=S,I;e[16]!==s||e[17]!==i?(I=(0,Ie.jsx)("input",{"aria-label":"Search rows","data-testid":"db-filter",onChange:s,placeholder:"search table\u2026",value:i}),e[16]=s,e[17]=i,e[18]=I):I=e[18];let C;e[19]!==g?(C=(0,Ie.jsx)("button",{"data-testid":"db-add-filter",onClick:g,type:"button",children:"Add filter"}),e[19]=g,e[20]=C):C=e[20];let R;e[21]!==c||e[22]!==r?(R=r!==void 0&&(0,Ie.jsxs)(Ie.Fragment,{children:[(0,Ie.jsx)("input",{"aria-label":"Describe a filter","data-testid":"db-ai-prompt",onChange:o(F=>{u(F.target.value)},"onChange"),onKeyDown:o(F=>{F.key==="Enter"&&c.trim()!==""&&(F.preventDefault(),r(c.trim()))},"onKeyDown"),placeholder:"describe a filter\u2026",value:c}),(0,Ie.jsx)("button",{"data-testid":"db-ai-filter",disabled:c.trim()==="",onClick:o(()=>{r(c.trim())},"onClick"),type:"button",children:"Suggest"})]}),e[21]=c,e[22]=r,e[23]=R):R=e[23];let x;e[24]!==I||e[25]!==C||e[26]!==R?(x=(0,Ie.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[I,C,R]}),e[24]=I,e[25]=C,e[26]=R,e[27]=x):x=e[27];let y;if(e[28]!==b||e[29]!==_||e[30]!==v||e[31]!==n||e[32]!==l||e[33]!==h){let F;e[35]!==b||e[36]!==_||e[37]!==v||e[38]!==n||e[39]!==h?(F=o((P,k)=>(0,Ie.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"db-filter-row",children:[(0,Ie.jsx)("select",{"aria-label":"Filter column","data-index":k,"data-testid":"db-filter-column",onChange:b,value:P.column,children:n.map(uc)}),(0,Ie.jsx)("select",{"aria-label":"Filter operator","data-index":k,"data-testid":"db-filter-operator",onChange:_,value:P.operator,children:sc.map(dc)}),(0,Ie.jsx)("input",{"aria-label":"Filter value","data-index":k,"data-testid":"db-filter-value",onChange:v,placeholder:"value",value:P.value}),(0,Ie.jsx)("button",{"aria-label":"Remove filter","data-index":k,"data-testid":"db-filter-remove",onClick:h,type:"button",children:"\u2715"})]},k),"a"),e[35]=b,e[36]=_,e[37]=v,e[38]=n,e[39]=h,e[40]=F):F=e[40],y=l.map(F),e[28]=b,e[29]=_,e[30]=v,e[31]=n,e[32]=l,e[33]=h,e[34]=y}else y=e[34];let M;return e[41]!==y||e[42]!==x?(M=(0,Ie.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"db-filters",children:[x,y]}),e[41]=y,e[42]=x,e[43]=M):M=e[43],M},"M");function uc(t){return(0,Ie.jsx)("option",{value:t,children:t},t)}o(uc,"B");function dc(t){return(0,Ie.jsx)("option",{value:t.value,children:t.label},t.value)}o(dc,"G");var mc=o(t=>({tables:Object.entries(t).map(([e,n])=>({fields:n.map(l=>l.name),indexes:[],name:e,relations:n.filter(l=>l.ref!==void 0).map(l=>({field:l.name,kind:"one",name:l.name,onDelete:l.onDelete,references:l.ref,table:e}))}))}),"_o"),gc=o(t=>{let e=new Map,n=new Set;for(let l of t.tables)for(let r of l.relations){if(r.kind!=="one"||r.onDelete==="set null")continue;let a=r.references,s=`${a}\0${l.name}\0${r.field}`;if(n.has(s))continue;n.add(s);let i=e.get(a)??[];i.push({...r,table:l.name}),e.set(a,i)}return e},"Ro"),fc=o((t,e)=>{let n=[],l=[t];for(;l.length>0;){let r=l.shift();if(r===void 0)break;e(r)&&n.push(r);for(let a of r.children)l.push(a)}return n},"$o"),gs=o((t,e)=>{let n=[];for(let[l,r]of Object.entries(e))for(let a of r)a.ref===t&&n.push({column:a.name,table:l});return n.sort((l,r)=>l.table.localeCompare(r.table)||l.column.localeCompare(r.column)),n},"Jt"),ar=o(t=>`${t.table}.${t.column}`,"It"),pc=o(t=>{let e=(0,q.c)(111),{columns:n,onApply:l,onClose:r,shardKey:a,table:s,total:i,uniqueColumns:c}=t,u=oe(),[d,g]=(0,D.useState)(n[0]??""),[m,h]=(0,D.useState)(""),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=o(be=>{g(be.target.value)},"u"),e[0]=p):p=e[0];let b=p,w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w=o(be=>{h(be.target.value)},"h"),e[1]=w):w=e[1];let _=w,S;e[2]!==m?(S=m.trim(),e[2]=m,e[3]=S):S=e[3];let v=S==="",I,C;if(e[4]!==v||e[5]!==u||e[6]!==m){if(!v)try{C=nn(JSON.parse(m))}catch(be){I=u("Invalid JSON: {message}",{message:be.message})}e[4]=v,e[5]=u,e[6]=m,e[7]=I,e[8]=C}else I=e[7],C=e[8];let R;e[9]!==d||e[10]!==i||e[11]!==c?(R=c.has(d)&&i>1,e[9]=d,e[10]=i,e[11]=c,e[12]=R):R=e[12];let x=R,y=d!==""&&!v&&I===void 0&&!x,M;e[13]!==y||e[14]!==d||e[15]!==l||e[16]!==r||e[17]!==C?(M=o(()=>{y&&(l({[d]:C}),r())},"T"),e[13]=y,e[14]=d,e[15]=l,e[16]=r,e[17]=C,e[18]=M):M=e[18];let F=M,P;e[19]!==u?(P=u("Set a column on matching rows"),e[19]=u,e[20]=P):P=e[20];let k;e[21]!==u?(k=u("Set a column on matching rows"),e[21]=u,e[22]=k):k=e[22];let N;e[23]!==k?(N=(0,f.jsx)("h3",{className:"text-base text-foreground","data-testid":"bulk-patch-title",children:k}),e[23]=k,e[24]=N):N=e[24];let A;e[25]!==u||e[26]!==s||e[27]!==i?(A=u("Writes {total} rows of {table} through the schema-aware writer \u2014 validators and indexes apply, exactly like a mutation.",{table:s,total:i.toString()}),e[25]=u,e[26]=s,e[27]=i,e[28]=A):A=e[28];let z;e[29]!==A?(z=(0,f.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-desc",children:A}),e[29]=A,e[30]=z):z=e[30];let O;e[31]!==a||e[32]!==u?(O=a===""?u("Shard: root"):u("Shard: {shardKey} \u2014 rows in other shards are not touched.",{shardKey:a}),e[31]=a,e[32]=u,e[33]=O):O=e[33];let $;e[34]!==O?($=(0,f.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-shard",children:O}),e[34]=O,e[35]=$):$=e[35];let K;e[36]!==z||e[37]!==$||e[38]!==N?(K=(0,f.jsxs)("div",{className:"flex flex-col gap-0.5",children:[N,z,$]}),e[36]=z,e[37]=$,e[38]=N,e[39]=K):K=e[39];let U;e[40]!==u?(U=u("Close"),e[40]=u,e[41]=U):U=e[41];let T;e[42]!==r||e[43]!==U?(T=(0,f.jsx)(rn,{"data-testid":"bulk-patch-close",onClick:r,size:"xs",variant:"ghost",children:U}),e[42]=r,e[43]=U,e[44]=T):T=e[44];let Q;e[45]!==K||e[46]!==T?(Q=(0,f.jsxs)("div",{className:"flex items-start justify-between",children:[K,T]}),e[45]=K,e[46]=T,e[47]=Q):Q=e[47];let J;e[48]!==u?(J=u("Column"),e[48]=u,e[49]=J):J=e[49];let Z;e[50]!==J?(Z=(0,f.jsx)(so,{htmlFor:"bulk-patch-column",children:J}),e[50]=J,e[51]=Z):Z=e[51];let ne;e[52]!==u?(ne=u("Column"),e[52]=u,e[53]=ne):ne=e[53];let te;e[54]!==n?(te=n.map(bc),e[54]=n,e[55]=te):te=e[55];let ae;e[56]!==d||e[57]!==ne||e[58]!==te?(ae=(0,f.jsx)("select",{"aria-label":ne,className:"h-8 rounded-md border border-input bg-transparent px-2 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"bulk-patch-column",id:"bulk-patch-column",onChange:b,value:d,children:te}),e[56]=d,e[57]=ne,e[58]=te,e[59]=ae):ae=e[59];let de;e[60]!==u?(de=u("Value"),e[60]=u,e[61]=de):de=e[61];let pe;e[62]!==de?(pe=(0,f.jsx)(so,{htmlFor:"bulk-patch-value",children:de}),e[62]=de,e[63]=pe):pe=e[63];let Ce;e[64]!==m?(Ce=(0,f.jsx)(_r,{className:"flex-1 font-mono","data-testid":"bulk-patch-value",id:"bulk-patch-value",onChange:_,placeholder:"true",value:m}),e[64]=m,e[65]=Ce):Ce=e[65];let xe;e[66]!==Z||e[67]!==ae||e[68]!==pe||e[69]!==Ce?(xe=(0,f.jsxs)("div",{className:"flex items-center gap-2",children:[Z,ae,pe,Ce]}),e[66]=Z,e[67]=ae,e[68]=pe,e[69]=Ce,e[70]=xe):xe=e[70];let Se;e[71]!==I?(Se=I!==void 0&&(0,f.jsx)("p",{className:"text-xs text-destructive","data-testid":"bulk-patch-error",role:"alert",children:I}),e[71]=I,e[72]=Se):Se=e[72];let ye;e[73]!==d||e[74]!==u||e[75]!==i||e[76]!==x?(ye=x&&(0,f.jsx)("p",{className:"text-xs text-destructive","data-testid":"bulk-patch-unique",role:"alert",children:u("{column} has a unique index \u2014 the same value cannot be set on {total} rows.",{column:d,total:i.toString()})}),e[73]=d,e[74]=u,e[75]=i,e[76]=x,e[77]=ye):ye=e[77];let L;e[78]!==v||e[79]!==u||e[80]!==x?(L=v&&!x&&(0,f.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-hint",children:u('Enter a JSON value \u2014 for example true, 0, null, or "done".')}),e[78]=v,e[79]=u,e[80]=x,e[81]=L):L=e[81];let X;e[82]!==y||e[83]!==d||e[84]!==m?(X=y&&(0,f.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"bulk-patch-preview",children:`${d} = ${m.trim()}`}),e[82]=y,e[83]=d,e[84]=m,e[85]=X):X=e[85];let le;e[86]!==u?(le=u("Cancel"),e[86]=u,e[87]=le):le=e[87];let Fe;e[88]!==r||e[89]!==le?(Fe=(0,f.jsx)(rn,{"data-testid":"bulk-patch-cancel",onClick:r,size:"xs",variant:"outline",children:le}),e[88]=r,e[89]=le,e[90]=Fe):Fe=e[90];let Ne=!y,se;e[91]!==u||e[92]!==i?(se=u("Set on {total} rows",{total:i.toString()}),e[91]=u,e[92]=i,e[93]=se):se=e[93];let ee;e[94]!==F||e[95]!==Ne||e[96]!==se?(ee=(0,f.jsx)(rn,{"data-testid":"bulk-patch-apply",disabled:Ne,onClick:F,size:"xs",children:se}),e[94]=F,e[95]=Ne,e[96]=se,e[97]=ee):ee=e[97];let G;e[98]!==Fe||e[99]!==ee?(G=(0,f.jsxs)("div",{className:"flex justify-end gap-2",children:[Fe,ee]}),e[98]=Fe,e[99]=ee,e[100]=G):G=e[100];let De;return e[101]!==r||e[102]!==Q||e[103]!==xe||e[104]!==Se||e[105]!==ye||e[106]!==L||e[107]!==X||e[108]!==G||e[109]!==P?(De=(0,f.jsxs)(Ht,{label:P,onClose:r,panelTestId:"bulk-patch-panel",testId:"bulk-patch-overlay",variant:"dialog",children:[Q,xe,Se,ye,L,X,G]}),e[101]=r,e[102]=Q,e[103]=xe,e[104]=Se,e[105]=ye,e[106]=L,e[107]=X,e[108]=G,e[109]=P,e[110]=De):De=e[110],De},"Do");function bc(t){return(0,f.jsx)("option",{value:t,children:t},t)}o(bc,"Ao");var fs=6,Hn=100,hc=o(t=>({paddingLeft:t*16}),"Po"),wc=o(t=>{let e=(0,q.c)(2),{table:n}=t,l=`cascade-restrict-${n}`,r;return e[0]!==l?(r=(0,f.jsx)("span",{className:"rounded bg-destructive/10 px-1 text-destructive","data-testid":l,children:"restrict \u2014 will block delete"}),e[0]=l,e[1]=r):r=e[1],r},"Io"),xc=o(t=>{let e=(0,q.c)(2),{table:n}=t,l=`cascade-cascade-${n}`,r;return e[0]!==l?(r=(0,f.jsx)("span",{className:"rounded bg-warning/10 px-1 text-warning","data-testid":l,children:"cascade"}),e[0]=l,e[1]=r):r=e[1],r},"Fo"),Sc=o(t=>{let e=(0,q.c)(2),{table:n}=t,l=`cascade-undeclared-${n}`,r;return e[0]!==l?(r=(0,f.jsx)("span",{className:"rounded bg-muted px-1 text-muted-foreground","data-testid":l,children:"references \u2014 no delete action declared"}),e[0]=l,e[1]=r):r=e[1],r},"Oo"),_c=o(t=>t.relation===void 0||t.relation.onDelete==="cascade"?(0,f.jsx)(xc,{table:t.table}):t.isRestrict?(0,f.jsx)(wc,{table:t.table}):(0,f.jsx)(Sc,{table:t.table}),"Mo"),ys=o(t=>{let e=(0,q.c)(35),{depth:n,node:l}=t,r=`cascade-row-${l.table}`,a;e[0]!==n?(a=hc(n),e[0]=n,e[1]=a):a=e[1];let s;e[2]!==n?(s=n>0&&(0,f.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2514"}),e[2]=n,e[3]=s):s=e[3];let i;e[4]!==l.table?(i=(0,f.jsx)("span",{className:"font-medium text-foreground",children:l.table}),e[4]=l.table,e[5]=i):i=e[5];let c;e[6]!==l.relation||e[7]!==l.table?(c=l.relation!==void 0&&(0,f.jsxs)("span",{className:"text-muted-foreground","data-testid":`cascade-col-${l.table}-${l.relation.field}`,children:["via ",l.relation.field]}),e[6]=l.relation,e[7]=l.table,e[8]=c):c=e[8];let u;e[9]!==l.rowCount?(u=l.rowCount.toString(),e[9]=l.rowCount,e[10]=u):u=e[10];let d;e[11]!==u?(d=(0,f.jsxs)("span",{className:"text-muted-foreground",children:["(",u," rows)"]}),e[11]=u,e[12]=d):d=e[12];let g;e[13]!==l?(g=_c(l),e[13]=l,e[14]=g):g=e[14];let m;e[15]!==l.capNote||e[16]!==l.table?(m=l.capNote!==void 0&&(0,f.jsxs)("span",{className:"italic text-muted-foreground","data-testid":`cascade-cap-${l.table}`,children:["(",l.capNote,")"]}),e[15]=l.capNote,e[16]=l.table,e[17]=m):m=e[17];let h;e[18]!==r||e[19]!==a||e[20]!==s||e[21]!==i||e[22]!==c||e[23]!==d||e[24]!==g||e[25]!==m?(h=(0,f.jsxs)("li",{className:"flex flex-wrap items-center gap-1.5 py-1 font-mono text-xs","data-testid":r,style:a,children:[s,i,c,d,g,m]}),e[18]=r,e[19]=a,e[20]=s,e[21]=i,e[22]=c,e[23]=d,e[24]=g,e[25]=m,e[26]=h):h=e[26];let p;if(e[27]!==n||e[28]!==l.children){let w;e[30]!==n?(w=o((_,S)=>(0,f.jsx)(ys,{depth:n+1,node:_},`${_.table}-${_.relation?.field??"root"}-${S.toString()}`),"h"),e[30]=n,e[31]=w):w=e[31],p=l.children.map(w),e[27]=n,e[28]=l.children,e[29]=p}else p=e[29];let b;return e[32]!==h||e[33]!==p?(b=(0,f.jsxs)(f.Fragment,{children:[h,p]}),e[32]=h,e[33]=p,e[34]=b):b=e[34],b},"an"),Cc=o(t=>{let e=t._id??t.id??t.__id__??"";return typeof e=="string"?e:typeof e=="number"?e.toString():""},"Lo"),yc=o(async(t,e,n,l)=>{try{let r=await l(t,e,n),a=r.rows.flatMap(i=>Cc(i)||[]).slice(0,Hn),s=r.total??0;return{capNote:s>Hn?`showing first ${Hn.toString()} of ${s.toString()}`:void 0,rowCount:s,rowIds:a}}catch{return{capNote:"count unavailable",rowCount:0,rowIds:[]}}},"Vo"),vs=o(async(t,e,n,l,r,a,s)=>{let{capNote:i,rowCount:c,rowIds:u}=n===void 0?{capNote:void 0,rowCount:1,rowIds:[e]}:await yc(t,n.field,e,s),d=n?.onDelete==="restrict",g=[],m=`${t}:${e}`,h=a>=fs;if(!r.has(m)&&!h){r.add(m);let b=l.get(t)??[];for(let w of b)for(let _ of u.slice(0,10)){let S=await vs(w.table,_,w,l,r,a+1,s);(S.rowCount>0||a===0)&&g.push(S)}r.delete(m)}let p=i;if(h){let b=`depth capped at ${fs.toString()}`;p=i===void 0?b:`${i}; ${b}`}return{capNote:p,children:g,isRestrict:d,relation:n,rowCount:c,rowIds:u,table:t}},"cn"),vc=o(({onClose:t,onConfirm:e,readPage:n,rowId:l,schema:r,table:a})=>{let s=oe(),[i,c]=(0,D.useState)(!0),[u,d]=(0,D.useState)(null),[g,m]=(0,D.useState)(null);(0,D.useEffect)(()=>{let b=!1;return re((async()=>{try{c(!0),m(null);let w=gc(r);if(!((w.get(a)??[]).length>0)){b||(d({capNote:void 0,children:[],isRestrict:!1,relation:void 0,rowCount:1,rowIds:[l],table:a}),c(!1));return}let _=await vs(a,l,void 0,w,new Set,0,n);b||(d(_),c(!1))}catch(w){b||(m(w.message),c(!1))}})()),()=>{b=!0}},[l,a]);let h=u!==null&&fc(u,b=>b.isRestrict).length>0,p=o(()=>{e(),t()},"u");return(0,f.jsxs)(Ht,{label:"Cascade impact preview",onClose:t,panelTestId:"cascade-panel",testId:"cascade-overlay",variant:"dialog",children:[(0,f.jsxs)("div",{className:"flex items-start justify-between",children:[(0,f.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,f.jsx)("h3",{className:"text-base text-foreground","data-testid":"cascade-title",children:s("Cascade impact")}),(0,f.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-desc",children:s("Delete preview \u2014 rows that would cascade or be blocked")})]}),(0,f.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground","data-testid":"cascade-close",onClick:t,type:"button",children:s("Close")})]}),i&&(0,f.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-loading",children:s("Loading\u2026")}),g!==null&&(0,f.jsx)("p",{className:"text-xs text-destructive","data-testid":"cascade-error",role:"alert",children:g}),!i&&u!==null&&(0,f.jsx)("ul",{className:"flex flex-col","data-testid":"cascade-tree",children:(0,f.jsx)(ys,{depth:0,node:u})}),!i&&u!==null&&u.children.length===0&&(0,f.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-no-impact",children:s("No related rows found.")}),h&&(0,f.jsx)("p",{className:"text-sm font-medium text-destructive","data-testid":"cascade-blocker-warning",role:"alert",children:s("Restrict relations will block this delete.")}),(0,f.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,f.jsx)("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:t,type:"button",children:s("Cancel")}),(0,f.jsx)("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:i,onClick:p,type:"button",children:s("Delete")})]})]})},"Bo"),Rc=o((t,e,n,l,r=300)=>{if(l<=0)return{ids:new Set(t.map(g=>g.id)),leadPx:0,tailPx:0};let a=n-r,s=n+l+r,i=new Set,c=0,u=0,d=0;for(let g of t){let m=g.getSize(),h=e.has(g.id),p=c+m>a&&c<s;h||p?i.add(g.id):c<a?u+=m:d+=m,c+=m}return{ids:i,leadPx:u,tailPx:d}},"jo"),Ic=o((t,e)=>{let n=new Map,l=0;for(let r of t)e.has(r.id)&&(n.set(r.id,l),l+=r.getSize());return n},"zo"),Fc={columnOrderingFeature:To,columnResizingFeature:Ho,columnSizingFeature:Lo,columnVisibilityFeature:jo,rowSelectionFeature:Yo,rowSortingFeature:Zo,sortedRowModel:er(),sortFns:{alphanumeric:Co,basic:Mt,datetime:vo,text:yo}},Mc=o(()=>{let t=(0,q.c)(12),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={},t[0]=e):e=t[0];let[n,l]=(0,D.useState)(e),r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=o((b,w,_)=>{l(S=>({...S,[b]:{...S[b],[w]:_}}))},"t"),t[1]=r):r=t[1];let a=r,s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=o(()=>{l({})},"l"),t[2]=s):s=t[2];let i=s,c;t[3]===Symbol.for("react.memo_cache_sentinel")?(c=o((b,w)=>{l(_=>{let S=_[b];if(S===void 0)return _;let v=Object.fromEntries(Object.entries(S).filter(I=>{let[C,R]=I;return!(C in w)||!Object.is(R,w[C])}));return Object.keys(v).length===0?Object.fromEntries(Object.entries(_).filter(I=>{let[C]=I;return C!==b})):{..._,[b]:v}})},"a"),t[3]=c):c=t[3];let u=c,d;t[4]!==n?(d=o((b,w)=>{let _=n[b];return _!==void 0&&w in _?{value:_[w]}:void 0},"f"),t[4]=n,t[5]=d):d=t[5];let g=d,m;t[6]!==n?(m=Object.values(n).reduce(Pc,0),t[6]=n,t[7]=m):m=t[7];let h=m,p;return t[8]!==h||t[9]!==n||t[10]!==g?(p={clear:i,count:h,drop:u,stage:a,staged:n,stagedValue:g},t[8]=h,t[9]=n,t[10]=g,t[11]=p):p=t[11],p},"Ko"),Rs=o((t,e)=>{if(typeof e=="number"){let n=Number(t);return t.trim()===""||Number.isNaN(n)?t:n}if(typeof e=="boolean"){if(t==="true")return!0;if(t==="false")return!1}return t},"dn"),kc=o(t=>{let e=(0,q.c)(29),{changes:n,committing:l,onCommit:r,onDiscard:a}=t,s=oe(),i;e[0]!==n.length||e[1]!==s?(i=s("{count} pending changes",{count:n.length}),e[0]=n.length,e[1]=s,e[2]=i):i=e[2];let c;e[3]!==i?(c=(0,f.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-warning","data-testid":"db-staged-count",children:i}),e[3]=i,e[4]=c):c=e[4];let u;e[5]!==l||e[6]!==s?(u=s(l?"Committing\u2026":"Commit"),e[5]=l,e[6]=s,e[7]=u):u=e[7];let d;e[8]!==l||e[9]!==r||e[10]!==u?(d=(0,f.jsx)("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:l,onClick:r,type:"button",children:u}),e[8]=l,e[9]=r,e[10]=u,e[11]=d):d=e[11];let g;e[12]!==s?(g=s("Discard"),e[12]=s,e[13]=g):g=e[13];let m;e[14]!==l||e[15]!==a||e[16]!==g?(m=(0,f.jsx)("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:l,onClick:a,type:"button",children:g}),e[14]=l,e[15]=a,e[16]=g,e[17]=m):m=e[17];let h;e[18]!==c||e[19]!==d||e[20]!==m?(h=(0,f.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,d,m]}),e[18]=c,e[19]=d,e[20]=m,e[21]=h):h=e[21];let p;e[22]!==n?(p=n.map(Nc),e[22]=n,e[23]=p):p=e[23];let b;e[24]!==p?(b=(0,f.jsx)("ul",{className:"flex flex-col gap-1","data-testid":"db-staged-list",children:p}),e[24]=p,e[25]=b):b=e[25];let w;return e[26]!==h||e[27]!==b?(w=(0,f.jsxs)("div",{className:"flex flex-col gap-2 border border-warning/40 bg-warning/5 p-3","data-testid":"db-staged",children:[h,b]}),e[26]=h,e[27]=b,e[28]=w):w=e[28],w},"Go");function Pc(t,e){return t+Object.keys(e).length}o(Pc,"Jo");function Nc(t){return(0,f.jsxs)("li",{className:"flex flex-wrap items-center gap-2 font-mono text-xs",children:[(0,f.jsxs)("span",{className:"text-muted-foreground",children:[t.rowId,".",t.column]}),(0,f.jsx)("span",{className:"text-destructive line-through",children:Te(t.oldValue)}),(0,f.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2192"}),(0,f.jsx)("span",{className:"text-foreground",children:Te(t.newValue)})]},`${t.rowId}:${t.column}`)}o(Nc,"Wo");var ps=400,Dc=36,Ac={flex:"1 1 0%",minHeight:0,overflow:"auto",position:"relative"},Oc={width:"100%"},Tc=/\n$/u,Ec={alignItems:"center",display:"flex",left:0,position:"absolute",top:0,width:"100%"},Vc={display:"flex",width:"100%"},bs={flex:"0 0 8.5rem",padding:"0.375rem 0.75rem"},zc="2.5rem",Is={alignItems:"center",display:"flex",flex:"0 0 2.5rem",justifyContent:"center",left:0,padding:"0.375rem 0",position:"sticky",zIndex:2},sr=o(t=>({flex:"0 0 auto",overflow:"hidden",padding:"0.375rem 0.75rem",position:"relative",textOverflow:"ellipsis",whiteSpace:"nowrap",width:`${t.toString()}px`}),"Ft"),Fs=o((t,e)=>({...sr(t),left:`calc(${zc} + ${e.toString()}px)`,position:"sticky",zIndex:2}),"fn"),nr="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",$c=o((t,e,n)=>e.enabled&&e.columns.has(n)?void 0:t,"ts"),lr="__back__:",Hc=o(t=>`${lr}${t.table}.${t.column}`,"ns"),Lc=o(t=>{let e=(0,q.c)(3),{counts:n,rowId:l}=t;if(n===void 0){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,f.jsx)("span",{className:"text-muted-foreground/50",children:"\u2014"}),e[0]=s):s=e[0],s}let r=n[l]??0,a;return e[1]!==r?(a=(0,f.jsx)("span",{className:"tabular-nums",children:r}),e[1]=r,e[2]=a):a=e[2],a},"os"),Ze=o(t=>{for(let e of["id","__id__","_id"]){let n=t[e];if(typeof n=="string"||typeof n=="number")return String(n)}return null},"Pe"),jc=o((t,e)=>{if(e.enumValues!==void 0&&e.enumValues.length>0)return e.enumValues.includes(t)||t===""&&e.nullable===!0?{value:t===""?null:t}:void 0;if(e.type==="boolean")return t==="true"||t==="false"?{value:t==="true"}:void 0;if(e.type==="number"){let n=Number(t);return t.trim()===""||!Number.isFinite(n)?void 0:{value:n}}return{value:t}},"ss"),Bc=o((t,e,n)=>{if(n!==void 0&&n.type!=="any")return jc(t,n);let l=Rs(t,e);return typeof e=="number"&&typeof l!="number"?void 0:{value:l}},"ls"),Gc=o(({anchor:t,columnIds:e,columnMeta:n,editableColumn:l,rows:r,text:a})=>{let s=a.replaceAll(`\r
3
3
  `,`
4
4
  `).replace(Tc,"").split(`
@@ -1 +1 @@
1
- import{b as h}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{b as A}from"./chunk-C4ZPJ4KT.js";import{l as k}from"./chunk-DTFIEXYN.js";import"./chunk-QAQDMS6R.js";import"./chunk-WS7WNXF3.js";import{a as y,e as S}from"./chunk-2IKDEUCX.js";import{d as I}from"./chunk-5OMZCVRF.js";import{a as u,d as w,f as z,g as P}from"./chunk-I26MS5PJ.js";var N=w(z(),1);var a=w(P(),1);var j=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],v=u(e=>{if(e===void 0)return"\u2014";let i=[[86400,"d"],[3600,"h"],[60,"m"]];for(let[t,d]of i)if(e>=t&&e%t===0)return`${String(e/t)}${d}`;return`${String(e)}s`},"v"),p=u(e=>{let i=(0,N.c)(8),{children:t,heading:d,testId:n}=e,l;i[0]!==d?(l=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d})}),i[0]=d,i[1]=l):l=i[1];let s;i[2]!==t?(s=(0,a.jsx)(S,{className:"p-3",children:t}),i[2]=t,i[3]=s):s=i[3];let c;return i[4]!==l||i[5]!==s||i[6]!==n?(c=(0,a.jsxs)(y,{className:"gap-0 py-0","data-testid":n,children:[l,s]}),i[4]=l,i[5]=s,i[6]=n,i[7]=c):c=i[7],c},"h"),o=u(e=>{let i=(0,N.c)(7),{label:t,value:d}=e,n;i[0]!==t?(n=(0,a.jsx)("span",{className:"text-sm",children:t}),i[0]=t,i[1]=n):n=i[1];let l;i[2]!==d?(l=(0,a.jsx)("span",{className:"text-sm text-muted-foreground tabular-nums",children:d}),i[2]=d,i[3]=l):l=i[3];let s;return i[4]!==n||i[5]!==l?(s=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[n,l]}),i[4]=n,i[5]=l,i[6]=s):s=i[6],s},"c"),M=u(()=>{let e=(0,N.c)(20),i=k(),t=I(),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-auth-config"],e[0]=d):d=e[0];let n;e[1]!==i?(n=u(()=>i.getAuthConfig(),"r"),e[1]=i,e[2]=n):n=e[2];let{data:l,error:s}=A(d,n),c;e[3]!==t?(c=u(r=>(0,a.jsx)(h,{variant:r?"success":"outline",children:t(r?"Enabled":"Disabled")}),"u"),e[3]=t,e[4]=c):c=e[4];let m=c,g;e[5]!==s?(g=s!==null&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:s}),e[5]=s,e[6]=g):g=e[6];let f;e[7]!==l||e[8]!==s||e[9]!==t?(f=s===null&&l===void 0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:t("Loading auth configuration\u2026")}),e[7]=l,e[8]=s,e[9]=t,e[10]=f):f=e[10];let x;e[11]!==l||e[12]!==s||e[13]!==m||e[14]!==t?(x=s===null&&l!==void 0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p,{heading:t("Enabled capabilities"),testId:"auth-config-capabilities",children:(0,a.jsx)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:j.map(r=>{let $=l.capabilities[r.key];return(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${r.key}`,children:[(0,a.jsx)("span",{className:"text-sm",children:t(r.label)}),m($)]},r.key)})})}),(0,a.jsx)(p,{heading:t("Plugins"),testId:"auth-config-plugins",children:l.plugins.length===0?(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:t("No plugins enabled.")}):(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:l.plugins.map(C)})}),(0,a.jsx)(p,{heading:t("Sign-in methods"),testId:"auth-config-signin",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Email & password"),value:m(l.emailAndPassword)}),(0,a.jsx)(o,{label:t("Social providers"),value:l.socialProviders.length===0?t("None"):(0,a.jsx)("span",{className:"flex flex-wrap justify-end gap-1",children:l.socialProviders.map(L)})})]})}),l.organization.enabled&&(0,a.jsx)(p,{heading:t("Organizations"),testId:"auth-config-org",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Teams"),value:m(l.organization.teams)}),(0,a.jsx)(o,{label:t("Custom roles"),value:m(l.organization.roles)})]})}),(0,a.jsx)(p,{heading:t("Session policy"),testId:"auth-config-session",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Expires in"),value:v(l.session.expiresIn)}),(0,a.jsx)(o,{label:t("Refresh after"),value:v(l.session.updateAge)}),(0,a.jsx)(o,{label:t("Fresh window"),value:v(l.session.freshAge)}),(0,a.jsx)(o,{label:t("Cookie cache"),value:m(l.session.cookieCache===!0)})]})}),(0,a.jsx)(p,{heading:t("Rate limit"),testId:"auth-config-ratelimit",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Status"),value:m(l.rateLimit.enabled)}),l.rateLimit.enabled&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o,{label:t("Max requests"),value:l.rateLimit.max??"\u2014"}),(0,a.jsx)(o,{label:t("Window"),value:v(l.rateLimit.window)})]})]})}),l.userFields.length>0&&(0,a.jsx)(p,{heading:t("Plugin user fields"),testId:"auth-config-user-fields",children:(0,a.jsx)("ul",{className:"flex flex-col gap-2",children:l.userFields.map(r=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${r.name}`,children:[(0,a.jsxs)("span",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-mono text-xs",children:r.name}),r.plugin!==void 0&&(0,a.jsx)("span",{className:"text-[11px] text-muted-foreground",children:r.plugin})]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(h,{variant:"outline",children:r.type}),r.required&&(0,a.jsx)(h,{variant:"secondary",children:t("required")}),r.unique&&(0,a.jsx)(h,{variant:"secondary",children:t("unique")})]})]},r.name))})}),(0,a.jsx)(y,{className:"gap-0 py-0",children:(0,a.jsx)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:t("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.")})})]}),e[11]=l,e[12]=s,e[13]=m,e[14]=t,e[15]=x):x=e[15];let b;return e[16]!==g||e[17]!==f||e[18]!==x?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[g,f,x]}),e[16]=g,e[17]=f,e[18]=x,e[19]=b):b=e[19],b},"O");function C(e){return(0,a.jsx)(h,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e)}u(C,"P");function L(e){return(0,a.jsx)(h,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e)}u(L,"z");export{M as default};
1
+ import{b as h}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{b as A}from"./chunk-3INTX6UT.js";import{l as k}from"./chunk-C36GGBU5.js";import"./chunk-QAQDMS6R.js";import"./chunk-WS7WNXF3.js";import{a as y,e as S}from"./chunk-2IKDEUCX.js";import{d as I}from"./chunk-5OMZCVRF.js";import{a as u,d as w,f as z,g as P}from"./chunk-I26MS5PJ.js";var N=w(z(),1);var a=w(P(),1);var j=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],v=u(e=>{if(e===void 0)return"\u2014";let i=[[86400,"d"],[3600,"h"],[60,"m"]];for(let[t,d]of i)if(e>=t&&e%t===0)return`${String(e/t)}${d}`;return`${String(e)}s`},"v"),p=u(e=>{let i=(0,N.c)(8),{children:t,heading:d,testId:n}=e,l;i[0]!==d?(l=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d})}),i[0]=d,i[1]=l):l=i[1];let s;i[2]!==t?(s=(0,a.jsx)(S,{className:"p-3",children:t}),i[2]=t,i[3]=s):s=i[3];let c;return i[4]!==l||i[5]!==s||i[6]!==n?(c=(0,a.jsxs)(y,{className:"gap-0 py-0","data-testid":n,children:[l,s]}),i[4]=l,i[5]=s,i[6]=n,i[7]=c):c=i[7],c},"h"),o=u(e=>{let i=(0,N.c)(7),{label:t,value:d}=e,n;i[0]!==t?(n=(0,a.jsx)("span",{className:"text-sm",children:t}),i[0]=t,i[1]=n):n=i[1];let l;i[2]!==d?(l=(0,a.jsx)("span",{className:"text-sm text-muted-foreground tabular-nums",children:d}),i[2]=d,i[3]=l):l=i[3];let s;return i[4]!==n||i[5]!==l?(s=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[n,l]}),i[4]=n,i[5]=l,i[6]=s):s=i[6],s},"c"),M=u(()=>{let e=(0,N.c)(20),i=k(),t=I(),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-auth-config"],e[0]=d):d=e[0];let n;e[1]!==i?(n=u(()=>i.getAuthConfig(),"r"),e[1]=i,e[2]=n):n=e[2];let{data:l,error:s}=A(d,n),c;e[3]!==t?(c=u(r=>(0,a.jsx)(h,{variant:r?"success":"outline",children:t(r?"Enabled":"Disabled")}),"u"),e[3]=t,e[4]=c):c=e[4];let m=c,g;e[5]!==s?(g=s!==null&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:s}),e[5]=s,e[6]=g):g=e[6];let f;e[7]!==l||e[8]!==s||e[9]!==t?(f=s===null&&l===void 0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:t("Loading auth configuration\u2026")}),e[7]=l,e[8]=s,e[9]=t,e[10]=f):f=e[10];let x;e[11]!==l||e[12]!==s||e[13]!==m||e[14]!==t?(x=s===null&&l!==void 0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p,{heading:t("Enabled capabilities"),testId:"auth-config-capabilities",children:(0,a.jsx)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:j.map(r=>{let $=l.capabilities[r.key];return(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${r.key}`,children:[(0,a.jsx)("span",{className:"text-sm",children:t(r.label)}),m($)]},r.key)})})}),(0,a.jsx)(p,{heading:t("Plugins"),testId:"auth-config-plugins",children:l.plugins.length===0?(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:t("No plugins enabled.")}):(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:l.plugins.map(C)})}),(0,a.jsx)(p,{heading:t("Sign-in methods"),testId:"auth-config-signin",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Email & password"),value:m(l.emailAndPassword)}),(0,a.jsx)(o,{label:t("Social providers"),value:l.socialProviders.length===0?t("None"):(0,a.jsx)("span",{className:"flex flex-wrap justify-end gap-1",children:l.socialProviders.map(L)})})]})}),l.organization.enabled&&(0,a.jsx)(p,{heading:t("Organizations"),testId:"auth-config-org",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Teams"),value:m(l.organization.teams)}),(0,a.jsx)(o,{label:t("Custom roles"),value:m(l.organization.roles)})]})}),(0,a.jsx)(p,{heading:t("Session policy"),testId:"auth-config-session",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Expires in"),value:v(l.session.expiresIn)}),(0,a.jsx)(o,{label:t("Refresh after"),value:v(l.session.updateAge)}),(0,a.jsx)(o,{label:t("Fresh window"),value:v(l.session.freshAge)}),(0,a.jsx)(o,{label:t("Cookie cache"),value:m(l.session.cookieCache===!0)})]})}),(0,a.jsx)(p,{heading:t("Rate limit"),testId:"auth-config-ratelimit",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Status"),value:m(l.rateLimit.enabled)}),l.rateLimit.enabled&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o,{label:t("Max requests"),value:l.rateLimit.max??"\u2014"}),(0,a.jsx)(o,{label:t("Window"),value:v(l.rateLimit.window)})]})]})}),l.userFields.length>0&&(0,a.jsx)(p,{heading:t("Plugin user fields"),testId:"auth-config-user-fields",children:(0,a.jsx)("ul",{className:"flex flex-col gap-2",children:l.userFields.map(r=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${r.name}`,children:[(0,a.jsxs)("span",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-mono text-xs",children:r.name}),r.plugin!==void 0&&(0,a.jsx)("span",{className:"text-[11px] text-muted-foreground",children:r.plugin})]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(h,{variant:"outline",children:r.type}),r.required&&(0,a.jsx)(h,{variant:"secondary",children:t("required")}),r.unique&&(0,a.jsx)(h,{variant:"secondary",children:t("unique")})]})]},r.name))})}),(0,a.jsx)(y,{className:"gap-0 py-0",children:(0,a.jsx)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:t("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.")})})]}),e[11]=l,e[12]=s,e[13]=m,e[14]=t,e[15]=x):x=e[15];let b;return e[16]!==g||e[17]!==f||e[18]!==x?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[g,f,x]}),e[16]=g,e[17]=f,e[18]=x,e[19]=b):b=e[19],b},"O");function C(e){return(0,a.jsx)(h,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e)}u(C,"P");function L(e){return(0,a.jsx)(h,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e)}u(L,"z");export{M as default};
@@ -1 +1 @@
1
- import{a as s}from"./chunk-C4ZPJ4KT.js";import{a as n}from"./chunk-I26MS5PJ.js";var b="__lunora_admin__:",g=new Set(["action","mutation","query"]),c=Symbol("lunora.operationSeq"),_=n(t=>{if(typeof t!="object"||t===null)return;let e=t[c];return typeof e=="number"?e:void 0},"g"),d=n((t,e)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,c,{configurable:!0,enumerable:!1,value:e,writable:!0})}catch{}},"h"),m=n(t=>{if(typeof t!="object"||t===null)return;let e=t.__lunoraRef;return typeof e=="string"&&e.startsWith(b)?e:void 0},"p"),h=n(t=>{if(typeof t!="object"||t===null)return"";let{shardKey:e}=t;return typeof e=="string"?e:""},"O"),w=n(t=>new Proxy(t,{get(e,u,y){let i=Reflect.get(e,u,y);if(typeof i!="function"||typeof u!="string"||!g.has(u))return typeof i=="function"?i.bind(e):i;let f=i;return async(...o)=>{let l=m(o[0]);if(l===void 0)return f.apply(e,o);let p=typeof o[1]=="object"&&o[1]!==null?o[1]:{},a=s.start(l,p,h(o[2]));try{let r=await f.apply(e,o);return s.settle(a,{result:r}),r}catch(r){throw s.settle(a,{error:r instanceof Error?r.message:String(r)}),d(r,a),r}}}}),"E");export{_ as a,w as b};
1
+ import{a as s}from"./chunk-3INTX6UT.js";import{a as n}from"./chunk-I26MS5PJ.js";var b="__lunora_admin__:",g=new Set(["action","mutation","query"]),c=Symbol("lunora.operationSeq"),_=n(t=>{if(typeof t!="object"||t===null)return;let e=t[c];return typeof e=="number"?e:void 0},"g"),d=n((t,e)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,c,{configurable:!0,enumerable:!1,value:e,writable:!0})}catch{}},"h"),m=n(t=>{if(typeof t!="object"||t===null)return;let e=t.__lunoraRef;return typeof e=="string"&&e.startsWith(b)?e:void 0},"p"),h=n(t=>{if(typeof t!="object"||t===null)return"";let{shardKey:e}=t;return typeof e=="string"?e:""},"O"),w=n(t=>new Proxy(t,{get(e,u,y){let i=Reflect.get(e,u,y);if(typeof i!="function"||typeof u!="string"||!g.has(u))return typeof i=="function"?i.bind(e):i;let f=i;return async(...o)=>{let l=m(o[0]);if(l===void 0)return f.apply(e,o);let p=typeof o[1]=="object"&&o[1]!==null?o[1]:{},a=s.start(l,p,h(o[2]));try{let r=await f.apply(e,o);return s.settle(a,{result:r}),r}catch(r){throw s.settle(a,{error:r instanceof Error?r.message:String(r)}),d(r,a),r}}}}),"E");export{_ as a,w as b};
@@ -1 +1 @@
1
- import{a as D}from"./chunk-D746I7ZX.js";import{b as C}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import"./chunk-55UGUCQ6.js";import{a as L}from"./chunk-4ZEL6BYL.js";import{c as $}from"./chunk-C4ZPJ4KT.js";import"./chunk-DTFIEXYN.js";import"./chunk-QAQDMS6R.js";import"./chunk-WS7WNXF3.js";import{a as I}from"./chunk-RWVIV3U7.js";import{a as T,b as k,c as A,d as g,e as c,f as l}from"./chunk-HCTJKP5J.js";import{a as b,e as S}from"./chunk-2IKDEUCX.js";import{d as w}from"./chunk-5OMZCVRF.js";import{a as f,d as y,f as _,g as j}from"./chunk-I26MS5PJ.js";var O=y(_(),1);var t=y(j(),1);var E="container:",M={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},B=f(e=>{let n=e.indexOf(":");if(n===-1)return{event:e.trim()};let r=e.slice(n+1).trim(),a=e.slice(0,n).trim();return r===""?{event:a}:{detail:r,event:a}},"B"),P=f(e=>{let n=new Map;for(let r of e){let a=r.functionPath??"";if(!a.startsWith(E))continue;let i=a.slice(E.length);if(i==="")continue;let s=JSON.stringify([i,r.instance??""]),o=n.get(s);if(o!==void 0&&o.timestamp>=r.timestamp)continue;let{detail:p,event:d}=B(r.message);n.set(s,{detail:p,event:d,exitCode:r.exitCode,instance:r.instance,level:r.level,name:i,state:M[d]??"unknown",timestamp:r.timestamp})}return[...n.values()].toSorted((r,a)=>r.name.localeCompare(a.name)||(r.instance??"").localeCompare(a.instance??""))},"D"),W={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},q=f(e=>{let{entries:n}=e??{};return Array.isArray(n)?n:[]},"P"),V=f(()=>{let e=(0,O.c)(19),n=w(),r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},a={live:!0,shardKey:""},e[0]=r,e[1]=a):(r=e[0],a=e[1]);let{data:i,error:s,liveError:o}=$(L.getLogs,r,a),p=i!==void 0,d;if(e[2]!==i||e[3]!==s||e[4]!==o||e[5]!==p||e[6]!==n){let N=P(q(i)),x;e[8]!==s?(x=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:s}),e[8]=s,e[9]=x):x=e[9];let m;e[10]!==n?(m=n("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per instance \u2014 ports and health checks aren't carried in that stream."),e[10]=n,e[11]=m):m=e[11];let u;e[12]!==m?(u=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[12]=m,e[13]=u):u=e[13];let h;e[14]!==o?(h=(0,t.jsx)(D,{message:o,prefix:"containers"}),e[14]=o,e[15]=h):h=e[15];let v;e[16]!==u||e[17]!==h?(v=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,h]}),e[16]=u,e[17]=h,e[18]=v):v=e[18],d=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[x,v,p&&N.length===0?(0,t.jsx)(I,{description:n("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:n("No container activity")}):(0,t.jsx)(b,{className:"overflow-hidden py-0",children:(0,t.jsx)(S,{className:"px-0",children:(0,t.jsxs)(T,{"data-testid":"containers-table",children:[(0,t.jsx)(k,{children:(0,t.jsxs)(g,{children:[(0,t.jsx)(c,{children:n("Container")}),(0,t.jsx)(c,{children:n("Instance")}),(0,t.jsx)(c,{children:n("State")}),(0,t.jsx)(c,{children:n("Last event")}),(0,t.jsx)(c,{children:n("Detail")}),(0,t.jsx)(c,{children:n("Exit")}),(0,t.jsx)(c,{children:n("When")})]})}),(0,t.jsx)(A,{children:N.map(F)})]})})})]}),e[2]=i,e[3]=s,e[4]=o,e[5]=p,e[6]=n,e[7]=d}else d=e[7];return d},"q");function F(e){return(0,t.jsxs)(g,{"data-testid":`containers-row-${e.name}${e.instance===void 0?"":`-${e.instance}`}`,children:[(0,t.jsx)(l,{className:"font-mono text-xs",children:e.name}),(0,t.jsx)(l,{className:"max-w-40 truncate font-mono text-xs text-muted-foreground",title:e.instance,children:e.instance??"\u2014"}),(0,t.jsx)(l,{children:(0,t.jsx)(C,{variant:W[e.state],children:e.state})}),(0,t.jsx)(l,{className:"font-mono text-xs text-muted-foreground",children:e.event}),(0,t.jsx)(l,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"\u2014"}),(0,t.jsx)(l,{className:"font-mono text-xs tabular-nums text-muted-foreground",children:e.exitCode??"\u2014"}),(0,t.jsx)(l,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()})]},`${e.name}/${e.instance??""}`)}f(F,"j");export{V as default};
1
+ import{a as D}from"./chunk-D746I7ZX.js";import{b as C}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import"./chunk-55UGUCQ6.js";import{a as L}from"./chunk-4ZEL6BYL.js";import{c as $}from"./chunk-3INTX6UT.js";import"./chunk-C36GGBU5.js";import"./chunk-QAQDMS6R.js";import"./chunk-WS7WNXF3.js";import{a as I}from"./chunk-RWVIV3U7.js";import{a as T,b as k,c as A,d as g,e as c,f as l}from"./chunk-HCTJKP5J.js";import{a as b,e as S}from"./chunk-2IKDEUCX.js";import{d as w}from"./chunk-5OMZCVRF.js";import{a as f,d as y,f as _,g as j}from"./chunk-I26MS5PJ.js";var O=y(_(),1);var t=y(j(),1);var E="container:",M={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},B=f(e=>{let n=e.indexOf(":");if(n===-1)return{event:e.trim()};let r=e.slice(n+1).trim(),a=e.slice(0,n).trim();return r===""?{event:a}:{detail:r,event:a}},"B"),P=f(e=>{let n=new Map;for(let r of e){let a=r.functionPath??"";if(!a.startsWith(E))continue;let i=a.slice(E.length);if(i==="")continue;let s=JSON.stringify([i,r.instance??""]),o=n.get(s);if(o!==void 0&&o.timestamp>=r.timestamp)continue;let{detail:p,event:d}=B(r.message);n.set(s,{detail:p,event:d,exitCode:r.exitCode,instance:r.instance,level:r.level,name:i,state:M[d]??"unknown",timestamp:r.timestamp})}return[...n.values()].toSorted((r,a)=>r.name.localeCompare(a.name)||(r.instance??"").localeCompare(a.instance??""))},"D"),W={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},q=f(e=>{let{entries:n}=e??{};return Array.isArray(n)?n:[]},"P"),V=f(()=>{let e=(0,O.c)(19),n=w(),r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},a={live:!0,shardKey:""},e[0]=r,e[1]=a):(r=e[0],a=e[1]);let{data:i,error:s,liveError:o}=$(L.getLogs,r,a),p=i!==void 0,d;if(e[2]!==i||e[3]!==s||e[4]!==o||e[5]!==p||e[6]!==n){let N=P(q(i)),x;e[8]!==s?(x=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:s}),e[8]=s,e[9]=x):x=e[9];let m;e[10]!==n?(m=n("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per instance \u2014 ports and health checks aren't carried in that stream."),e[10]=n,e[11]=m):m=e[11];let u;e[12]!==m?(u=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[12]=m,e[13]=u):u=e[13];let h;e[14]!==o?(h=(0,t.jsx)(D,{message:o,prefix:"containers"}),e[14]=o,e[15]=h):h=e[15];let v;e[16]!==u||e[17]!==h?(v=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,h]}),e[16]=u,e[17]=h,e[18]=v):v=e[18],d=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[x,v,p&&N.length===0?(0,t.jsx)(I,{description:n("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:n("No container activity")}):(0,t.jsx)(b,{className:"overflow-hidden py-0",children:(0,t.jsx)(S,{className:"px-0",children:(0,t.jsxs)(T,{"data-testid":"containers-table",children:[(0,t.jsx)(k,{children:(0,t.jsxs)(g,{children:[(0,t.jsx)(c,{children:n("Container")}),(0,t.jsx)(c,{children:n("Instance")}),(0,t.jsx)(c,{children:n("State")}),(0,t.jsx)(c,{children:n("Last event")}),(0,t.jsx)(c,{children:n("Detail")}),(0,t.jsx)(c,{children:n("Exit")}),(0,t.jsx)(c,{children:n("When")})]})}),(0,t.jsx)(A,{children:N.map(F)})]})})})]}),e[2]=i,e[3]=s,e[4]=o,e[5]=p,e[6]=n,e[7]=d}else d=e[7];return d},"q");function F(e){return(0,t.jsxs)(g,{"data-testid":`containers-row-${e.name}${e.instance===void 0?"":`-${e.instance}`}`,children:[(0,t.jsx)(l,{className:"font-mono text-xs",children:e.name}),(0,t.jsx)(l,{className:"max-w-40 truncate font-mono text-xs text-muted-foreground",title:e.instance,children:e.instance??"\u2014"}),(0,t.jsx)(l,{children:(0,t.jsx)(C,{variant:W[e.state],children:e.state})}),(0,t.jsx)(l,{className:"font-mono text-xs text-muted-foreground",children:e.event}),(0,t.jsx)(l,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"\u2014"}),(0,t.jsx)(l,{className:"font-mono text-xs tabular-nums text-muted-foreground",children:e.exitCode??"\u2014"}),(0,t.jsx)(l,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()})]},`${e.name}/${e.instance??""}`)}f(F,"j");export{V as default};