@lunora/studio 1.0.0-alpha.176 → 1.0.0-alpha.177

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 (64) hide show
  1. package/dist/standalone/{chunk-CWTUCGWD.js → chunk-2CXDHA24.js} +1 -1
  2. package/dist/standalone/{chunk-KSYIH3NO.js → chunk-2Y6PXGIS.js} +4 -4
  3. package/dist/standalone/{chunk-XAGNBUL3.js → chunk-2YUHEQNZ.js} +1 -1
  4. package/dist/standalone/{chunk-SPERI4DG.js → chunk-33KTQE6M.js} +1 -1
  5. package/dist/standalone/{chunk-52Y5BCFW.js → chunk-5XRNQ732.js} +1 -1
  6. package/dist/standalone/{chunk-B62IS74K.js → chunk-7AXSOHFV.js} +1 -1
  7. package/dist/standalone/{chunk-X5AXABWH.js → chunk-AIXYDNPW.js} +1 -1
  8. package/dist/standalone/{chunk-7PEQ4RPL.js → chunk-AVIMIDVJ.js} +1 -1
  9. package/dist/standalone/{chunk-TX4KHOV2.js → chunk-B3DO4BO4.js} +1 -1
  10. package/dist/standalone/{chunk-NXZGWCUN.js → chunk-B3V2AP35.js} +1 -1
  11. package/dist/standalone/{chunk-3LGVSZ4D.js → chunk-BGYP2QED.js} +1 -1
  12. package/dist/standalone/{chunk-KSRQTLE3.js → chunk-BJZAZXKM.js} +1 -1
  13. package/dist/standalone/{chunk-I4YTKLE7.js → chunk-BSTFYU5B.js} +1 -1
  14. package/dist/standalone/{chunk-CO7D5QQA.js → chunk-CBNGOAD4.js} +1 -1
  15. package/dist/standalone/{chunk-Y3G2ZPOD.js → chunk-CX5PIWVR.js} +1 -1
  16. package/dist/standalone/{chunk-L6W4QXGJ.js → chunk-D6MZSOBE.js} +1 -1
  17. package/dist/standalone/{chunk-N3MMJZQW.js → chunk-DAKCWZ4G.js} +1 -1
  18. package/dist/standalone/{chunk-CQO3Z2AB.js → chunk-DYK3ISZY.js} +1 -1
  19. package/dist/standalone/{chunk-JWJFB4ZB.js → chunk-EJEEQOLY.js} +1 -1
  20. package/dist/standalone/{chunk-V5PJJYCF.js → chunk-EQM6MBPU.js} +1 -1
  21. package/dist/standalone/{chunk-DL3DYOZA.js → chunk-F6MZ2ZMN.js} +1 -1
  22. package/dist/standalone/{chunk-F4W5DVWA.js → chunk-FK6DWL3I.js} +1 -1
  23. package/dist/standalone/{chunk-TPVTZE6M.js → chunk-GF3C2NLS.js} +1 -1
  24. package/dist/standalone/{chunk-KY7U3EOR.js → chunk-GMSHLYNP.js} +1 -1
  25. package/dist/standalone/{chunk-5JHPL7FH.js → chunk-HD6DNNBW.js} +1 -1
  26. package/dist/standalone/{chunk-E67LBUZU.js → chunk-HEYVHUP6.js} +1 -1
  27. package/dist/standalone/{chunk-JXJZMINI.js → chunk-HXZCKTSY.js} +1 -1
  28. package/dist/standalone/{chunk-VYLHUJVG.js → chunk-IGHD6IAV.js} +1 -1
  29. package/dist/standalone/{chunk-EFMYOSXQ.js → chunk-IKLD7RQP.js} +1 -1
  30. package/dist/standalone/{chunk-I3PD3ZML.js → chunk-IVDDMDBA.js} +1 -1
  31. package/dist/standalone/{chunk-SZUW2MXD.js → chunk-IXPWYPHR.js} +1 -1
  32. package/dist/standalone/{chunk-HKPAFIMB.js → chunk-J3LCGEBD.js} +1 -1
  33. package/dist/standalone/{chunk-CQ4VSTAW.js → chunk-K35G3ZK3.js} +1 -1
  34. package/dist/standalone/{chunk-D6UKRXIS.js → chunk-KIKAXEXE.js} +1 -1
  35. package/dist/standalone/{chunk-KPISDHKV.js → chunk-MJ7FX455.js} +1 -1
  36. package/dist/standalone/{chunk-OS6CZ56E.js → chunk-NFDXLXT3.js} +1 -1
  37. package/dist/standalone/{chunk-FKBX44FM.js → chunk-NOOT4TBC.js} +1 -1
  38. package/dist/standalone/{chunk-4G7WDTSC.js → chunk-OEQVPFRR.js} +1 -1
  39. package/dist/standalone/{chunk-MKRHFCPJ.js → chunk-OQCKLTIK.js} +1 -1
  40. package/dist/standalone/{chunk-F7UZBTKS.js → chunk-OQM3I5XY.js} +1 -1
  41. package/dist/standalone/{chunk-KMLTYAJF.js → chunk-OZGHJG66.js} +1 -1
  42. package/dist/standalone/chunk-PPUG6WPN.js +11 -0
  43. package/dist/standalone/{chunk-T6X7NXEE.js → chunk-Q2Y2CJVK.js} +1 -1
  44. package/dist/standalone/{chunk-KF2YSK5Z.js → chunk-QANF7PJP.js} +1 -1
  45. package/dist/standalone/{chunk-KRXDSPZ4.js → chunk-RBR23GOF.js} +1 -1
  46. package/dist/standalone/{chunk-ERLNG3BC.js → chunk-S6BSRO54.js} +1 -1
  47. package/dist/standalone/{chunk-GXVTU7FF.js → chunk-SBMI5R22.js} +1 -1
  48. package/dist/standalone/{chunk-YYR4P344.js → chunk-SERHQJBE.js} +1 -1
  49. package/dist/standalone/{chunk-4OGX6UIE.js → chunk-SJHRP5XZ.js} +1 -1
  50. package/dist/standalone/{chunk-NZDNC4KZ.js → chunk-SUPR4OQL.js} +1 -1
  51. package/dist/standalone/{chunk-IMLGMLYE.js → chunk-UB4OLVSF.js} +1 -1
  52. package/dist/standalone/{chunk-O7D7DJVB.js → chunk-URBHAYYZ.js} +1 -1
  53. package/dist/standalone/{chunk-JMXDVWZG.js → chunk-UUN54AL3.js} +1 -1
  54. package/dist/standalone/{chunk-RH2G72SL.js → chunk-VBRXTL6X.js} +1 -1
  55. package/dist/standalone/{chunk-WWHDFIP5.js → chunk-WWGF3DF5.js} +1 -1
  56. package/dist/standalone/{chunk-RQPSYNGU.js → chunk-WWYOHW3E.js} +1 -1
  57. package/dist/standalone/{chunk-XTC4KFYF.js → chunk-XHNFCVRS.js} +1 -1
  58. package/dist/standalone/{chunk-OBSMXNVJ.js → chunk-YJJNA2P5.js} +1 -1
  59. package/dist/standalone/{chunk-3UOVQ3YN.js → chunk-Z4MWXKHX.js} +1 -1
  60. package/dist/standalone/{chunk-WDYULSDM.js → chunk-ZCIDKRNF.js} +2 -2
  61. package/dist/standalone/{chunk-YKA2P52S.js → chunk-ZP7XN3FG.js} +1 -1
  62. package/dist/standalone/studio.js +1 -1
  63. package/package.json +6 -6
  64. package/dist/standalone/chunk-VWWJIICI.js +0 -11
@@ -1,4 +1,4 @@
1
- import{a as dn,b as Ee,e as $r,f as Hr}from"./chunk-QY4V5UOY.js";import{a as Er,b as ht,c as zr,d as mn}from"./chunk-YKA2P52S.js";import{a as cn}from"./chunk-MXLAOCAN.js";import{b as an}from"./chunk-CMA4PTV7.js";import{d as Lr}from"./chunk-UYEZR3BI.js";import{a as ao,b as io,c as un,d as Vr}from"./chunk-YOB2X3FZ.js";import{a as sn}from"./chunk-CSUROWL2.js";import"./chunk-RFNGDE33.js";import"./chunk-V3CZW3JB.js";import"./chunk-MU3P2FI7.js";import{a as ln}from"./chunk-3FBLWUXD.js";import{a as Bt}from"./chunk-XZMOZFE6.js";import{a as lo}from"./chunk-IMOHEGMV.js";import{a as Or}from"./chunk-66UGPQVC.js";import{b as yr,c as to}from"./chunk-RLLKECZT.js";import"./chunk-YPRQLCKF.js";import"./chunk-GMS77BZD.js";import"./chunk-3Q2P62UR.js";import{a as so}from"./chunk-QKEJLVC5.js";import"./chunk-AWHXPIXU.js";import"./chunk-V3VJAA4D.js";import{a as ro}from"./chunk-PD6WIDY6.js";import{a as Pr}from"./chunk-2DX5MROH.js";import{a as Fr,b as Mr}from"./chunk-OGUKYRFM.js";import{c as xr,d as Sr,e as _r}from"./chunk-6D6Z2KXU.js";import{b as Rr,c as Ir,f as no}from"./chunk-OKG3HWSJ.js";import{W as Cr}from"./chunk-PLHA3OWK.js";import{b as bi}from"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as on}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import"./chunk-225VJ77I.js";import{a as Ce}from"./chunk-4ZEL6BYL.js";import{b as eo,c as dt}from"./chunk-D6UKRXIS.js";import{f as tt}from"./chunk-VWWJIICI.js";import"./chunk-FSRSK4LY.js";import"./chunk-KSYIH3NO.js";import{a as rn}from"./chunk-FKVZRPV5.js";import{a as Nr,b as kr,c as Dr,d as oo,e as Tr,f as Ar}from"./chunk-HEAQVSNS.js";import{d as ee,f as Ae,g as Oe,h as jt,m as Zn,n as nt,o as le,r as vr}from"./chunk-FODLDLE2.js";import{a as o,d as Re,e as ut,f as Ht,g as Lt,i as bt}from"./chunk-YKXDMIHQ.js";var ja=Re(Ht(),1);var Dt=Re(ut(),1);var ot=Re(Ht(),1);var j=Re(Lt(),1),$e=Re(ut(),1);var hi=2166136261,wi=16777619,xi=o((t,e=hi)=>{let n=e;for(let l=0;l<t.length;l+=1)n^=t.charCodeAt(l),n=Math.imul(n,wi);return(n>>>0).toString(16).padStart(8,"0")},"j"),Si=/([a-z\d])([A-Z])/gu,_i=/[\s_-]+/u,Ci=new Set(["access_token","api_key","apikey","card_number","client_secret","credit_card","cvv","passwd","password","private_key","pwd","refresh_token","secret","ssn","token"]),vi=o(t=>{let e=t.replaceAll(Si,"$1 $2").split(_i).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],s=e[l+1];r===void 0||s===void 0||(n.add(`${r}${s}`),n.add(`${r}_${s}`))}return[...n]},"oe"),jr="\u2022\u2022\u2022",Ur=o((t,e)=>{try{return e==="redact"?null:e==="hash"?t==null?t:xi(typeof t=="bigint"?t.toString():typeof t=="string"?t:JSON.stringify(t)):jr}catch{return jr}},"G"),Br=o((t,e)=>{let n=new Map;for(let l of t)l.table===e&&n.set(l.column,l.strategy);return n},"P"),yi=o(t=>{for(let e of vi(t))if(Ci.has(e))return!0;return!1},"ae"),Gr=o((t,e)=>{let n=e.filter(r=>!t.has(r)&&yi(r));if(n.length===0)return t;let l=new Map(t);for(let r of n)l.set(r,"redact");return l},"B"),Gt=o((t,e,n)=>{if(!n.enabled)return t;let l=n.columns.get(e);return l===void 0?t:Ur(t,l)},"_e"),gn=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]=Ur(n[l],r));return n},"le"),fn=o((t,e)=>!e.enabled||e.columns.size===0?t:t.map(n=>gn(n,e)),"Fe"),Ri=[25,50,100,250],Ii=o(t=>{let e=(0,ot.c)(18),{onChange:n,options:l,prefix:r,value:s}=t,a=ee(),u;e[0]!==n?(u=o(_=>{n(Number.parseInt(_.target.value,10))},"g"),e[0]=n,e[1]=u):u=e[1];let c=u,i=`${r}-page-size`,d;e[2]!==a?(d=a("Rows per page"),e[2]=a,e[3]=d):d=e[3];let m;e[4]!==d?(m=(0,j.jsx)("span",{children:d}),e[4]=d,e[5]=m):m=e[5];let g=`${r}-page-size`,p=`${r}-page-size`,f;e[6]!==l?(f=l.map(Mi),e[6]=l,e[7]=f):f=e[7];let h;e[8]!==c||e[9]!==g||e[10]!==p||e[11]!==f||e[12]!==s?(h=(0,j.jsx)("select",{className:"h-6 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":g,id:p,onChange:c,value:s,children:f}),e[8]=c,e[9]=g,e[10]=p,e[11]=f,e[12]=s,e[13]=h):h=e[13];let w;return e[14]!==i||e[15]!==m||e[16]!==h?(w=(0,j.jsxs)("label",{className:"flex items-center gap-1.5",htmlFor:i,children:[m,h]}),e[14]=i,e[15]=m,e[16]=h,e[17]=w):w=e[17],w},"ie"),Fi=o(t=>{let e=(0,ot.c)(25),{onJump:n,page:l,pages:r,prefix:s}=t,a=ee(),u;e[0]!==n||e[1]!==r?(u=o(v=>{let C=Number.parseInt(v,10);Number.isNaN(C)||n(Math.min(Math.max(1,C),Math.max(1,r)))},"g"),e[0]=n,e[1]=r,e[2]=u):u=e[2];let c=u,i;e[3]!==c?(i=o(v=>{v.key==="Enter"&&c(v.currentTarget.value)},"f"),e[3]=c,e[4]=i):i=e[4];let d=i,m;e[5]!==c?(m=o(v=>{c(v.currentTarget.value)},"a"),e[5]=c,e[6]=m):m=e[6];let g=m,p;e[7]!==a?(p=a("Page"),e[7]=a,e[8]=p):p=e[8];let f;e[9]!==a?(f=a("Page"),e[9]=a,e[10]=f):f=e[10];let h=`${s}-page-jump`,w=Math.max(1,r),_;e[11]!==g||e[12]!==d||e[13]!==l||e[14]!==f||e[15]!==h||e[16]!==w?(_=(0,j.jsx)("input",{"aria-label":f,className:"h-6 w-12 rounded-md border border-border bg-background px-1 text-center tabular-nums outline-none focus-visible:border-ring","data-testid":h,defaultValue:l,max:w,min:1,onBlur:g,onKeyDown:d,type:"number"},l),e[11]=g,e[12]=d,e[13]=l,e[14]=f,e[15]=h,e[16]=w,e[17]=_):_=e[17];let x;e[18]!==r||e[19]!==a?(x=a("of {pages}",{pages:r}),e[18]=r,e[19]=a,e[20]=x):x=e[20];let y;return e[21]!==p||e[22]!==_||e[23]!==x?(y=(0,j.jsxs)("span",{className:"flex items-center gap-1.5 tabular-nums",children:[p,_,x]}),e[21]=p,e[22]=_,e[23]=x,e[24]=y):y=e[24],y},"de"),pn=o(({hasNext:t,hasPrevious:e,onJumpToPage:n,onNext:l,onPageSizeChange:r,onPrevious:s,pageSize:a,pageSizeOptions:u=Ri,prefix:c,rangeEnd:i,rangeStart:d,total:m})=>{let g=ee(),p="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",f=a!==void 0&&a>0?Math.max(1,Math.ceil(m/a)):1,h=a!==void 0&&a>0?Math.floor(Math.max(0,d-1)/a)+1:1;return(0,j.jsxs)("div",{className:"flex w-full items-center justify-between gap-3 text-xs text-muted-foreground",children:[(0,j.jsxs)("div",{className:"flex items-center gap-3",children:[a!==void 0&&r!==void 0&&(0,j.jsx)(Ii,{onChange:r,options:u,prefix:c,value:a}),(0,j.jsx)("span",{className:"tabular-nums","data-testid":`${c}-page-info`,children:g("{rangeStart}-{rangeEnd} of {total}",{rangeEnd:i,rangeStart:d,total:m})})]}),(0,j.jsxs)("div",{className:"flex items-center gap-3",children:[(0,j.jsx)("button",{className:p,"data-testid":`${c}-prev`,disabled:!e,onClick:s,type:"button",children:g("Previous")}),a!==void 0&&n!==void 0&&(0,j.jsx)(Fi,{onJump:n,page:h,pages:f,prefix:c}),(0,j.jsx)("button",{className:p,"data-testid":`${c}-next`,disabled:!t,onClick:l,type:"button",children:g("Next")})]})]})},"Te");function Mi(t){return(0,j.jsx)("option",{value:t,children:t},t)}o(Mi,"ue");var qr=o(t=>t==null?"\u2205":t===""?"(empty)":typeof t=="object"?JSON.stringify(t):String(t),"D"),Pi=o(t=>{let e=(0,ot.c)(32),{column:n,onFacetFilter:l,state:r}=t,s=ee(),a;e[0]!==n||e[1]!==l||e[2]!==r.result?.values?(a=o(w=>{let _=Number(w.currentTarget.dataset.index),x=r.result?.values[_];x!==void 0&&l(n,x.value)},"u"),e[0]=n,e[1]=l,e[2]=r.result?.values,e[3]=a):a=e[3];let u=a,c=`db-facet-${n}`,i;e[4]!==n?(i=(0,j.jsx)("span",{className:"font-medium text-foreground",children:n}),e[4]=n,e[5]=i):i=e[5];let d;e[6]!==r.loading||e[7]!==r.result||e[8]!==s?(d=r.loading&&r.result===null&&(0,j.jsx)("span",{className:"text-muted-foreground",children:s("Loading\u2026")}),e[6]=r.loading,e[7]=r.result,e[8]=s,e[9]=d):d=e[9];let m;e[10]!==r.error?(m=r.error!==null&&(0,j.jsx)("span",{className:"text-destructive",role:"alert",children:r.error}),e[10]=r.error,e[11]=m):m=e[11];let g;e[12]!==r.result?.values?(g=r.result?.values??[],e[12]=r.result?.values,e[13]=g):g=e[13];let p;if(e[14]!==n||e[15]!==u||e[16]!==g){let w;e[18]!==n||e[19]!==u?(w=o((_,x)=>(0,j.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":x,"data-testid":`db-facet-value-${n}`,onClick:u,type:"button",children:[(0,j.jsx)("span",{className:"truncate",children:qr(_.value)}),(0,j.jsx)("span",{className:"shrink-0 tabular-nums text-foreground/70",children:_.count})]},qr(_.value)),"i"),e[18]=n,e[19]=u,e[20]=w):w=e[20],p=g.map(w),e[14]=n,e[15]=u,e[16]=g,e[17]=p}else p=e[17];let f;e[21]!==n||e[22]!==r.result||e[23]!==s?(f=r.result?.truncated===!0&&(0,j.jsx)("span",{className:"text-muted-foreground","data-testid":`db-facet-truncated-${n}`,children:s("Showing the {n} most common values.",{n:r.result.values.length})}),e[21]=n,e[22]=r.result,e[23]=s,e[24]=f):f=e[24];let h;return e[25]!==c||e[26]!==i||e[27]!==d||e[28]!==m||e[29]!==p||e[30]!==f?(h=(0,j.jsxs)("section",{className:"flex flex-col gap-1","data-testid":c,children:[i,d,m,p,f]}),e[25]=c,e[26]=i,e[27]=d,e[28]=m,e[29]=p,e[30]=f,e[31]=h):h=e[31],h},"fe"),bn=o(t=>{let e=(0,ot.c)(44),{columns:n,facets:l,mask:r,onFacetFilter:s,onToggleFacet:a}=t,u=ee(),c;e[0]!==a?(c=o(I=>{let{column:F}=I.currentTarget.dataset;F!==void 0&&a(F)},"o"),e[0]=a,e[1]=c):c=e[1];let i=c,d;e[2]!==r?(d=o(I=>r.enabled&&r.columns.has(I),"l"),e[2]=r,e[3]=d):d=e[3];let m=d,g,p,f,h,w,_,x,y;if(e[4]!==n||e[5]!==l||e[6]!==m||e[7]!==u||e[8]!==i){y=Symbol.for("react.early_return_sentinel");e:{let I;e[17]!==m?(I=o(k=>!m(k),"w"),e[17]=m,e[18]=I):I=e[18];let F=n.filter(I),M;if(e[19]!==l||e[20]!==m?(M=Object.entries(l).filter(k=>{let[T]=k;return!m(T)}),e[19]=l,e[20]=m,e[21]=M):M=e[21],g=M,F.length===0){y=null;break e}_="flex w-56 shrink-0 flex-col gap-3 overflow-auto border-l border-border p-3 text-xs",x="db-facets",h="flex flex-col gap-1.5";let P;e[22]!==u?(P=u("Facets"),e[22]=u,e[23]=P):P=e[23],e[24]!==P?(w=(0,j.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:P}),e[24]=P,e[25]=w):w=e[25],p="flex flex-wrap gap-1";let N;e[26]!==l||e[27]!==i?(N=o(k=>(0,j.jsx)("button",{"aria-pressed":k 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":k,"data-testid":`db-facet-toggle-${k}`,onClick:i,type:"button",children:k},k),"R"),e[26]=l,e[27]=i,e[28]=N):N=e[28],f=F.map(N)}e[4]=n,e[5]=l,e[6]=m,e[7]=u,e[8]=i,e[9]=g,e[10]=p,e[11]=f,e[12]=h,e[13]=w,e[14]=_,e[15]=x,e[16]=y}else g=e[9],p=e[10],f=e[11],h=e[12],w=e[13],_=e[14],x=e[15],y=e[16];if(y!==Symbol.for("react.early_return_sentinel"))return y;let v;e[29]!==p||e[30]!==f?(v=(0,j.jsx)("div",{className:p,children:f}),e[29]=p,e[30]=f,e[31]=v):v=e[31];let C;e[32]!==v||e[33]!==h||e[34]!==w?(C=(0,j.jsxs)("div",{className:h,children:[w,v]}),e[32]=v,e[33]=h,e[34]=w,e[35]=C):C=e[35];let R;e[36]!==s||e[37]!==g?(R=g.map(I=>{let[F,M]=I;return(0,j.jsx)(Pi,{column:F,onFacetFilter:s,state:M},F)}),e[36]=s,e[37]=g,e[38]=R):R=e[38];let S;return e[39]!==C||e[40]!==R||e[41]!==_||e[42]!==x?(S=(0,j.jsxs)("aside",{className:_,"data-testid":x,children:[C,R]}),e[39]=C,e[40]=R,e[41]=_,e[42]=x,e[43]=S):S=e[43],S},"Ee");function rt(t){let e=(0,ot.c)(2),n=(0,$e.useRef)(t),l;return e[0]!==t?(l=o(()=>{n.current=t},"s"),e[0]=t,e[1]=l):l=e[1],(0,$e.useEffect)(l),n}o(rt,"me");var hn=o(()=>{let[t,e]=(0,$e.useState)({}),n=rt(t),l=(0,$e.useRef)({}),r=o(async(s,a)=>{let u=(l.current[s]??0)+1;l.current[s]=u,e(c=>s in c?{...c,[s]:{error:null,loading:!0,result:c[s]?.result??null}}:c);try{let c=await a(s);if(l.current[s]!==u)return;e(i=>s in i?{...i,[s]:{error:null,loading:!1,result:c}}:i)}catch(c){if(l.current[s]!==u)return;e(i=>s in i?{...i,[s]:{error:jt(c),loading:!1,result:null}}:i)}},"r");return{clearFacets:o(()=>{e({})},"clearFacets"),facets:t,facetsRef:n,refetchFacets:o(s=>{for(let a of Object.keys(n.current))le(r(a,s))},"refetchFacets"),toggleFacet:o((s,a)=>{if(s in n.current){e(u=>Object.fromEntries(Object.entries(u).filter(([c])=>c!==s)));return}e(u=>({...u,[s]:{error:null,loading:!0,result:null}})),a!==null&&le(r(s,a))},"toggleFacet")}},"Oe"),Ni=[],ki=o(()=>{let t=(0,ot.c)(1),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={},t[0]=e):e=t[0];let{data:n}=dt(Ce.maskPolicies,e);return Array.isArray(n?.columns)?n.columns:Ni},"ge"),wn=o(t=>{let e=(0,ot.c)(16),{columns:n,selectedTable:l}=t,r=ki(),[s,a]=(0,$e.useState)(!0),u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=o(()=>{a(Di)},"g"),e[0]=u):u=e[0];let c=u,i;if(e[1]!==n||e[2]!==r||e[3]!==l){let h=Br(r,l??"");i=Gr(h,n),e[1]=n,e[2]=r,e[3]=l,e[4]=i}else i=e[4];let d=i,m;e[5]!==s||e[6]!==r?(m=o((h,w)=>({columns:Gr(Br(r,h),w),enabled:s}),"a"),e[5]=s,e[6]=r,e[7]=m):m=e[7];let g=m,p;e[8]!==d||e[9]!==s?(p={columns:d,enabled:s},e[8]=d,e[9]=s,e[10]=p):p=e[10];let f;return e[11]!==d||e[12]!==s||e[13]!==g||e[14]!==p?(f={maskColumns:d,maskOn:s,maskView:p,maskViewFor:g,onToggleMask:c},e[11]=d,e[12]=s,e[13]=g,e[14]=p,e[15]=f):f=e[15],f},"Re");function Di(t){return!t}o(Di,"he");var Kr=34,Jr=600,Ti=o(t=>{let e=(0,ot.c)(21),{item:n,onSelect:l,prefix:r,selected:s,start:a}=t,u;e[0]!==n.name||e[1]!==l?(u=o(()=>{l(n.name)},"g"),e[0]=n.name,e[1]=l,e[2]=u):u=e[2];let c=u,i=`translateY(${String(a)}px)`,d;e[3]!==i?(d={insetInline:0,position:"absolute",top:0,transform:i},e[3]=i,e[4]=d):d=e[4];let m=d,g=s?"bg-accent font-medium text-accent-foreground":"text-foreground",p;e[5]!==g?(p=bt("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",g),e[5]=g,e[6]=p):p=e[6];let f=`${r}-table-${n.name}`,h;e[7]!==n.name?(h=(0,j.jsx)("span",{className:"truncate",children:n.name}),e[7]=n.name,e[8]=h):h=e[8];let w;e[9]!==n.rowCount?(w=(0,j.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]!==s||e[13]!==p||e[14]!==f||e[15]!==h||e[16]!==w?(_=(0,j.jsxs)("button",{"aria-pressed":s,className:p,"data-testid":f,onClick:c,type:"button",children:[h,w]}),e[11]=c,e[12]=s,e[13]=p,e[14]=f,e[15]=h,e[16]=w,e[17]=_):_=e[17];let x;return e[18]!==m||e[19]!==_?(x=(0,j.jsx)("li",{style:m,children:_}),e[18]=m,e[19]=_,e[20]=x):x=e[20],x},"pe"),xn=o(({header:t,onReload:e,onSelect:n,prefix:l,reloadLabel:r,selected:s,tables:a})=>{let u=ee(),[c,i]=(0,$e.useState)(""),d=(0,$e.useRef)(null),m=o(h=>{i(h.target.value)},"a"),g=(0,$e.useMemo)(()=>{let h=c.trim().toLowerCase();return h===""?a:a.filter(w=>w.name.toLowerCase().includes(h))},[c,a]),p=an({count:g.length,estimateSize:o(()=>Kr,"estimateSize"),getScrollElement:o(()=>d.current,"getScrollElement"),initialRect:{height:Jr,width:240},observeElementRect:o((h,w)=>cn(h,w,Jr),"observeElementRect"),overscan:12}).getVirtualItems(),f={height:g.length*Kr};return(0,j.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,j.jsxs)("div",{className:"flex h-9 shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[(0,j.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:u("Tables")}),e!==void 0&&(0,j.jsx)("button",{"aria-label":r??u("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??u("Refresh"),type:"button",children:(0,j.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,j.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,j.jsx)("div",{className:"shrink-0 border-b border-border p-2",children:(0,j.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:m,placeholder:u("search table\u2026"),type:"search",value:c})}),(0,j.jsxs)("ul",{className:"relative flex-1 overflow-y-auto p-1.5","data-testid":`${l}-table-list-rows`,ref:d,children:[(0,j.jsx)("li",{"aria-hidden":"true",style:f}),p.map(h=>{let w=g[h.index];return w===void 0?null:(0,j.jsx)(Ti,{item:w,onSelect:n,prefix:l,selected:s===w.name,start:h.start},w.name)})]})]})},"Ae");var J=Re(Ht(),1);var D=Re(ut(),1);var b=Re(Lt(),1);var Wr=Re(ut(),1);function Ai(t){return Oi(t)||typeof t=="function"||Ei(t)}o(Ai,"isReactComponent");function Oi(t){return typeof t=="function"&&(()=>{let e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}o(Oi,"isClassComponent");function Ei(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}o(Ei,"isExoticComponent");function wt(t,e){return t==null?null:Ai(t)?Wr.default.createElement(t,e):t}o(wt,"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?.()?wt(r.aggregatedCell??n.cell,e.getContext()):l.getIsPlaceholder?.()?null:wt(n.cell,e.getContext())}return"header"in t&&t.header?wt(t.header.column.columnDef.header,t.header.getContext()):"footer"in t&&t.footer?wt(t.footer.column.columnDef.footer,t.footer.getContext()):null}o(co,"FlexRender");function Qr({update:t,notify:e,unwatched:n}){return{link:l,unlink:r,propagate:s,checkDirty:a,shallowPropagate:u};function l(i,d,m){let g=d.depsTail;if(g!==void 0&&g.dep===i)return;let p=g!==void 0?g.nextDep:d.deps;if(p!==void 0&&p.dep===i){p.version=m,d.depsTail=p;return}let f=i.subsTail;if(f!==void 0&&f.version===m&&f.sub===d)return;let h=d.depsTail=i.subsTail={version:m,dep:i,sub:d,prevDep:g,nextDep:p,prevSub:f,nextSub:void 0};p!==void 0&&(p.prevDep=h),g!==void 0?g.nextDep=h:d.deps=h,f!==void 0?f.nextSub=h:i.subs=h}function r(i,d=i.sub){let m=i.dep,g=i.prevDep,p=i.nextDep,f=i.nextSub,h=i.prevSub;return p!==void 0?p.prevDep=g:d.depsTail=g,g!==void 0?g.nextDep=p:d.deps=p,f!==void 0?f.prevSub=h:m.subsTail=h,h!==void 0?h.nextSub=f:(m.subs=f)===void 0&&n(m),p}function s(i){let d=i.nextSub,m;e:do{let g=i.sub,p=g.flags;if(p&60?p&12?p&4?!(p&48)&&c(i,g)?(g.flags=p|40,p&=1):p=0:g.flags=p&-9|32:p=0:g.flags=p|32,p&2&&e(g),p&1){let f=g.subs;if(f!==void 0){let h=(i=f).nextSub;h!==void 0&&(m={value:d,prev:m},d=h);continue}}if((i=d)!==void 0){d=i.nextSub;continue}for(;m!==void 0;)if(i=m.value,m=m.prev,i!==void 0){d=i.nextSub;continue e}break}while(!0)}function a(i,d){let m,g=0,p=!1;e:do{let f=i.dep,h=f.flags;if(d.flags&16)p=!0;else if((h&17)===17){if(t(f)){let w=f.subs;w.nextSub!==void 0&&u(w),p=!0}}else if((h&33)===33){(i.nextSub!==void 0||i.prevSub!==void 0)&&(m={value:i,prev:m}),i=f.deps,d=f,++g;continue}if(!p){let w=i.nextDep;if(w!==void 0){i=w;continue}}for(;g--;){let w=d.subs,_=w.nextSub!==void 0;if(_?(i=m.value,m=m.prev):i=w,p){if(t(d)){_&&u(w),d=i.sub;continue}p=!1}else d.flags&=-33;d=i.sub;let x=i.nextDep;if(x!==void 0){i=x;continue e}}return p}while(!0)}function u(i){do{let d=i.sub,m=d.flags;(m&48)===32&&(d.flags=m|16,(m&6)===2&&e(d))}while((i=i.nextSub)!==void 0)}function c(i,d){let m=d.depsTail;for(;m!==void 0;){if(m===i)return!0;m=m.prevDep}return!1}}o(Qr,"createReactiveSystem");function Zr(t,e,n){let l=typeof t=="object",r=l?t:void 0;return{next:(l?t.next:t)?.bind(r),error:(l?t.error:e)?.bind(r),complete:(l?t.complete:n)?.bind(r)}}o(Zr,"toObserver");var uo=[],_n=0,{link:Xr,unlink:Vi,propagate:zi,checkDirty:el,shallowPropagate:Yr}=Qr({update(t){return t._update()},notify(t){uo[mo++]=t,t.flags&=-3},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=17,Cn(t))}}),Sn=0,mo=0,Ke,go=0;function fo(t){try{++go,t()}finally{--go||po()}}o(fo,"batch");function Cn(t){let e=t.depsTail,n=e!==void 0?e.nextDep:t.deps;for(;n!==void 0;)n=Vi(n,t)}o(Cn,"purgeDeps");function po(){if(!(go>0)){for(;Sn<mo;){let t=uo[Sn];uo[Sn++]=void 0,t.notify()}Sn=0,mo=0}}o(po,"flush");function bo(t,e){let n=typeof t=="function",l=t,r={_snapshot:n?void 0:t,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?0:1,get(){return Ke!==void 0&&Xr(r,Ke,_n),r._snapshot},subscribe(s){let a=Zr(s),u={current:!1},c=$i(()=>{r.get(),u.current?a.next?.(r._snapshot):u.current=!0});return{unsubscribe:o(()=>{c.stop()},"unsubscribe")}},_update(s){let a=Ke,u=e?.compare??Object.is;if(n)Ke=r,++_n,r.depsTail=void 0;else if(s===void 0)return!1;n&&(r.flags=5);try{let c=r._snapshot,i=typeof s=="function"?s(c):s===void 0&&n?l(c):s;return c===void 0||!u(c,i)?(r._snapshot=i,!0):!1}finally{Ke=a,n&&(r.flags&=-5),Cn(r)}}};return n?(r.flags=17,r.get=function(){let s=r.flags;if(s&16||s&32&&el(r.deps,r)){if(r._update()){let a=r.subs;a!==void 0&&Yr(a)}}else s&32&&(r.flags=s&-33);return Ke!==void 0&&Xr(r,Ke,_n),r._snapshot}):r.set=function(s){if(r._update(s)){let a=r.subs;a!==void 0&&(zi(a),Yr(a),po())}},r}o(bo,"createAtom");function $i(t){let e=o(()=>{let l=Ke;Ke=n,++_n,n.depsTail=void 0,n.flags=6;try{return t()}finally{Ke=l,n.flags&=-5,Cn(n)}},"run"),n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let l=this.flags;l&16||l&32&&el(this.deps,this)?e():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Cn(this)}};return e(),n}o($i,"effect");function lt(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(let[l,r]of t)if(!e.has(l)||!Object.is(r,e.get(l)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(let l of t)if(!e.has(l))return!1;return!0}if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();let n=tl(t);if(n.length!==tl(e).length)return!1;for(let l=0;l<n.length;l++)if(!Object.prototype.hasOwnProperty.call(e,n[l])||!Object.is(t[n[l]],e[n[l]]))return!1;return!0}o(lt,"shallow");function tl(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}o(tl,"getOwnKeys");var ho=Re(ut(),1),nl=Re(bi(),1);function Hi(t,e){return t===e}o(Hi,"defaultCompare");function qt(t,e=l=>l,n){let l=n?.compare??Hi,r=(0,ho.useCallback)(a=>{let{unsubscribe:u}=t.subscribe(a);return u},[t]),s=(0,ho.useCallback)(()=>t.get(),[t]);return(0,nl.useSyncExternalStoreWithSelector)(r,s,s,e,l)}o(qt,"useSelector");function ol(t){let e=qt(t.source,t.selector,{compare:lt});return typeof t.children=="function"?t.children(e):t.children}o(ol,"Subscribe");function rl(t){let e=t;return Object.defineProperty(t,"state",{get(){return t.get()}}),"set"in t&&(e.setState=t.set.bind(t)),e}o(rl,"atomToStore");function wo(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,s)=>{let a=s?.compare??Object.is,u=!1,c,i=o(()=>{let m=r();return(!u||!a(c,m))&&(c=m,u=!0),c},"getSnapshot"),d=e(()=>(l.get(),i()),{compare:a});return{get:i,subscribe:d.subscribe.bind(d)}},"createReadonlyAtom"),createWritableAtom:o((r,s)=>e(r,{compare:s?.compare}),"createWritableAtom"),commit:o(()=>{l.set(r=>r+1)},"commit")}}o(wo,"renderPhaseReactivity");function xo(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(s=>{(!n||!e(l,s))&&r(s)}),"subscribe")}}o(xo,"createRenderPhaseSource");function ll(){return wo({createAtom:bo,batch:fo})}o(ll,"reactReactivity");function yt(t,e){return typeof t=="function"?t(e):t}o(yt,"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?$():{},l=Object.keys(t);for(let r=0;r<l.length;r++){let s=l[r];Object.defineProperty(n,s,{configurable:!0,enumerable:!0,value:ie(t[s]),writable:!0})}return n}return t}o(ie,"cloneState");function vn(t,e){let n=Object.keys(e),l=t;for(let r=0;r<n.length;r++){let s=n[r];!s.startsWith("_memo_")&&s!=="_cellsCache"&&(l[s]=e[s])}return t}o(vn,"copyInstancePropertiesWithoutMemos");function $(){return Object.create(null)}o($,"makeObjectMap");function He(t,e){return Object.prototype.hasOwnProperty.call(t,e)}o(He,"hasOwn");function Le(t,e){return n=>{(e.options.atoms?.[t]??e.baseAtoms[t]).set(l=>yt(n,l))}}o(Le,"makeStateUpdater");function sl(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(sl,"isPlainContainer");function al(t){return Reflect.ownKeys(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}o(al,"getEnumerableOwnKeys");var Li=3;function ji(t,e){return il(t,e,Li)}o(ji,"stateSlicesEqual");function il(t,e,n){if(Object.is(t,e))return!0;if(n<=0||!sl(t)||!sl(e)||(Array.isArray(t)||Array.isArray(e))&&(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length))return!1;let l=al(t),r=al(e);if(l.length!==r.length)return!1;let s=t,a=e;for(let u=0;u<l.length;u++){let c=l[u];if(!Object.prototype.propertyIsEnumerable.call(e,c)||!il(s[c],a[c],n-1))return!1}return!0}o(il,"stateSlicesEqualAtDepth");function Ve(t,e,n,l=ji){let r=`on${e.charAt(0).toUpperCase()}${e.slice(1)}Change`,s=t.options[r];s&&s(a=>{let u=yt(n,a);return l(a,u)?a:u})}o(Ve,"setStateSlice");function cl(t){return t instanceof Function}o(cl,"isFunction");function ul(t,e){let n=[],l=o(r=>{r.forEach(s=>{n.push(s);let a=e(s);a.length&&l(a)})},"recurse");return l(t),n}o(ul,"flattenBy");var Bi=o(({fn:t,memoDeps:e,onAfterCompare:n,onAfterUpdate:l,onBeforeCompare:r,onBeforeUpdate:s})=>{let a=[],u;return o(i=>{r?.();let d=e?.(i),m=!d||d.length!==a?.length;if(!m&&d){for(let g=0;g<d.length;g++)if(d[g]!==a[g]){m=!0;break}}return n?.(m),m&&(a=d,s?.(),u=t(...d??[]),l?.(u)),u},"memoizedFn")},"memo");function yn(t){let e=!1;return()=>{if(!e){e=!0;return}t()}}o(yn,"skipFirstRun");var Gi=o((t,e)=>{for(t=String(t);t.length<e;)t=" "+t;return t},"pad");function Rt({feature:t,fnName:e,objectId:n,onAfterUpdate:l,table:r,...s}){let a,u,c=0,i;function d(p,f){let h=c===0?"(1st run)":f?"(rerun #"+c+")":"(cache)";c++,console.groupCollapsed(`%c\u23F1 ${Gi(`${p.toFixed(1)} ms`,12)} %c${h}%c ${e}%c ${n?`(${e.split(".")[0]}Id: ${n})`:""}`,`font-size: .6rem; font-weight: bold; ${f?`color: hsl(
1
+ import{a as dn,b as Ee,e as $r,f as Hr}from"./chunk-QY4V5UOY.js";import{a as Er,b as ht,c as zr,d as mn}from"./chunk-ZP7XN3FG.js";import{a as cn}from"./chunk-MXLAOCAN.js";import{b as an}from"./chunk-CMA4PTV7.js";import{d as Lr}from"./chunk-UYEZR3BI.js";import{a as ao,b as io,c as un,d as Vr}from"./chunk-YOB2X3FZ.js";import{a as sn}from"./chunk-CSUROWL2.js";import"./chunk-RFNGDE33.js";import"./chunk-V3CZW3JB.js";import"./chunk-MU3P2FI7.js";import{a as ln}from"./chunk-3FBLWUXD.js";import{a as Bt}from"./chunk-XZMOZFE6.js";import{a as lo}from"./chunk-IMOHEGMV.js";import{a as Or}from"./chunk-66UGPQVC.js";import{b as yr,c as to}from"./chunk-RLLKECZT.js";import"./chunk-YPRQLCKF.js";import"./chunk-GMS77BZD.js";import"./chunk-3Q2P62UR.js";import{a as so}from"./chunk-QKEJLVC5.js";import"./chunk-AWHXPIXU.js";import"./chunk-V3VJAA4D.js";import{a as ro}from"./chunk-PD6WIDY6.js";import{a as Pr}from"./chunk-2DX5MROH.js";import{a as Fr,b as Mr}from"./chunk-OGUKYRFM.js";import{c as xr,d as Sr,e as _r}from"./chunk-6D6Z2KXU.js";import{b as Rr,c as Ir,f as no}from"./chunk-OKG3HWSJ.js";import{W as Cr}from"./chunk-PLHA3OWK.js";import{b as bi}from"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as on}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import"./chunk-225VJ77I.js";import{a as Ce}from"./chunk-4ZEL6BYL.js";import{b as eo,c as dt}from"./chunk-KIKAXEXE.js";import{f as tt}from"./chunk-PPUG6WPN.js";import"./chunk-FSRSK4LY.js";import"./chunk-2Y6PXGIS.js";import{a as rn}from"./chunk-FKVZRPV5.js";import{a as Nr,b as kr,c as Dr,d as oo,e as Tr,f as Ar}from"./chunk-HEAQVSNS.js";import{d as ee,f as Ae,g as Oe,h as jt,m as Zn,n as nt,o as le,r as vr}from"./chunk-FODLDLE2.js";import{a as o,d as Re,e as ut,f as Ht,g as Lt,i as bt}from"./chunk-YKXDMIHQ.js";var ja=Re(Ht(),1);var Dt=Re(ut(),1);var ot=Re(Ht(),1);var j=Re(Lt(),1),$e=Re(ut(),1);var hi=2166136261,wi=16777619,xi=o((t,e=hi)=>{let n=e;for(let l=0;l<t.length;l+=1)n^=t.charCodeAt(l),n=Math.imul(n,wi);return(n>>>0).toString(16).padStart(8,"0")},"j"),Si=/([a-z\d])([A-Z])/gu,_i=/[\s_-]+/u,Ci=new Set(["access_token","api_key","apikey","card_number","client_secret","credit_card","cvv","passwd","password","private_key","pwd","refresh_token","secret","ssn","token"]),vi=o(t=>{let e=t.replaceAll(Si,"$1 $2").split(_i).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],s=e[l+1];r===void 0||s===void 0||(n.add(`${r}${s}`),n.add(`${r}_${s}`))}return[...n]},"oe"),jr="\u2022\u2022\u2022",Ur=o((t,e)=>{try{return e==="redact"?null:e==="hash"?t==null?t:xi(typeof t=="bigint"?t.toString():typeof t=="string"?t:JSON.stringify(t)):jr}catch{return jr}},"G"),Br=o((t,e)=>{let n=new Map;for(let l of t)l.table===e&&n.set(l.column,l.strategy);return n},"P"),yi=o(t=>{for(let e of vi(t))if(Ci.has(e))return!0;return!1},"ae"),Gr=o((t,e)=>{let n=e.filter(r=>!t.has(r)&&yi(r));if(n.length===0)return t;let l=new Map(t);for(let r of n)l.set(r,"redact");return l},"B"),Gt=o((t,e,n)=>{if(!n.enabled)return t;let l=n.columns.get(e);return l===void 0?t:Ur(t,l)},"_e"),gn=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]=Ur(n[l],r));return n},"le"),fn=o((t,e)=>!e.enabled||e.columns.size===0?t:t.map(n=>gn(n,e)),"Fe"),Ri=[25,50,100,250],Ii=o(t=>{let e=(0,ot.c)(18),{onChange:n,options:l,prefix:r,value:s}=t,a=ee(),u;e[0]!==n?(u=o(_=>{n(Number.parseInt(_.target.value,10))},"g"),e[0]=n,e[1]=u):u=e[1];let c=u,i=`${r}-page-size`,d;e[2]!==a?(d=a("Rows per page"),e[2]=a,e[3]=d):d=e[3];let m;e[4]!==d?(m=(0,j.jsx)("span",{children:d}),e[4]=d,e[5]=m):m=e[5];let g=`${r}-page-size`,p=`${r}-page-size`,f;e[6]!==l?(f=l.map(Mi),e[6]=l,e[7]=f):f=e[7];let h;e[8]!==c||e[9]!==g||e[10]!==p||e[11]!==f||e[12]!==s?(h=(0,j.jsx)("select",{className:"h-6 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":g,id:p,onChange:c,value:s,children:f}),e[8]=c,e[9]=g,e[10]=p,e[11]=f,e[12]=s,e[13]=h):h=e[13];let w;return e[14]!==i||e[15]!==m||e[16]!==h?(w=(0,j.jsxs)("label",{className:"flex items-center gap-1.5",htmlFor:i,children:[m,h]}),e[14]=i,e[15]=m,e[16]=h,e[17]=w):w=e[17],w},"ie"),Fi=o(t=>{let e=(0,ot.c)(25),{onJump:n,page:l,pages:r,prefix:s}=t,a=ee(),u;e[0]!==n||e[1]!==r?(u=o(v=>{let C=Number.parseInt(v,10);Number.isNaN(C)||n(Math.min(Math.max(1,C),Math.max(1,r)))},"g"),e[0]=n,e[1]=r,e[2]=u):u=e[2];let c=u,i;e[3]!==c?(i=o(v=>{v.key==="Enter"&&c(v.currentTarget.value)},"f"),e[3]=c,e[4]=i):i=e[4];let d=i,m;e[5]!==c?(m=o(v=>{c(v.currentTarget.value)},"a"),e[5]=c,e[6]=m):m=e[6];let g=m,p;e[7]!==a?(p=a("Page"),e[7]=a,e[8]=p):p=e[8];let f;e[9]!==a?(f=a("Page"),e[9]=a,e[10]=f):f=e[10];let h=`${s}-page-jump`,w=Math.max(1,r),_;e[11]!==g||e[12]!==d||e[13]!==l||e[14]!==f||e[15]!==h||e[16]!==w?(_=(0,j.jsx)("input",{"aria-label":f,className:"h-6 w-12 rounded-md border border-border bg-background px-1 text-center tabular-nums outline-none focus-visible:border-ring","data-testid":h,defaultValue:l,max:w,min:1,onBlur:g,onKeyDown:d,type:"number"},l),e[11]=g,e[12]=d,e[13]=l,e[14]=f,e[15]=h,e[16]=w,e[17]=_):_=e[17];let x;e[18]!==r||e[19]!==a?(x=a("of {pages}",{pages:r}),e[18]=r,e[19]=a,e[20]=x):x=e[20];let y;return e[21]!==p||e[22]!==_||e[23]!==x?(y=(0,j.jsxs)("span",{className:"flex items-center gap-1.5 tabular-nums",children:[p,_,x]}),e[21]=p,e[22]=_,e[23]=x,e[24]=y):y=e[24],y},"de"),pn=o(({hasNext:t,hasPrevious:e,onJumpToPage:n,onNext:l,onPageSizeChange:r,onPrevious:s,pageSize:a,pageSizeOptions:u=Ri,prefix:c,rangeEnd:i,rangeStart:d,total:m})=>{let g=ee(),p="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",f=a!==void 0&&a>0?Math.max(1,Math.ceil(m/a)):1,h=a!==void 0&&a>0?Math.floor(Math.max(0,d-1)/a)+1:1;return(0,j.jsxs)("div",{className:"flex w-full items-center justify-between gap-3 text-xs text-muted-foreground",children:[(0,j.jsxs)("div",{className:"flex items-center gap-3",children:[a!==void 0&&r!==void 0&&(0,j.jsx)(Ii,{onChange:r,options:u,prefix:c,value:a}),(0,j.jsx)("span",{className:"tabular-nums","data-testid":`${c}-page-info`,children:g("{rangeStart}-{rangeEnd} of {total}",{rangeEnd:i,rangeStart:d,total:m})})]}),(0,j.jsxs)("div",{className:"flex items-center gap-3",children:[(0,j.jsx)("button",{className:p,"data-testid":`${c}-prev`,disabled:!e,onClick:s,type:"button",children:g("Previous")}),a!==void 0&&n!==void 0&&(0,j.jsx)(Fi,{onJump:n,page:h,pages:f,prefix:c}),(0,j.jsx)("button",{className:p,"data-testid":`${c}-next`,disabled:!t,onClick:l,type:"button",children:g("Next")})]})]})},"Te");function Mi(t){return(0,j.jsx)("option",{value:t,children:t},t)}o(Mi,"ue");var qr=o(t=>t==null?"\u2205":t===""?"(empty)":typeof t=="object"?JSON.stringify(t):String(t),"D"),Pi=o(t=>{let e=(0,ot.c)(32),{column:n,onFacetFilter:l,state:r}=t,s=ee(),a;e[0]!==n||e[1]!==l||e[2]!==r.result?.values?(a=o(w=>{let _=Number(w.currentTarget.dataset.index),x=r.result?.values[_];x!==void 0&&l(n,x.value)},"u"),e[0]=n,e[1]=l,e[2]=r.result?.values,e[3]=a):a=e[3];let u=a,c=`db-facet-${n}`,i;e[4]!==n?(i=(0,j.jsx)("span",{className:"font-medium text-foreground",children:n}),e[4]=n,e[5]=i):i=e[5];let d;e[6]!==r.loading||e[7]!==r.result||e[8]!==s?(d=r.loading&&r.result===null&&(0,j.jsx)("span",{className:"text-muted-foreground",children:s("Loading\u2026")}),e[6]=r.loading,e[7]=r.result,e[8]=s,e[9]=d):d=e[9];let m;e[10]!==r.error?(m=r.error!==null&&(0,j.jsx)("span",{className:"text-destructive",role:"alert",children:r.error}),e[10]=r.error,e[11]=m):m=e[11];let g;e[12]!==r.result?.values?(g=r.result?.values??[],e[12]=r.result?.values,e[13]=g):g=e[13];let p;if(e[14]!==n||e[15]!==u||e[16]!==g){let w;e[18]!==n||e[19]!==u?(w=o((_,x)=>(0,j.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":x,"data-testid":`db-facet-value-${n}`,onClick:u,type:"button",children:[(0,j.jsx)("span",{className:"truncate",children:qr(_.value)}),(0,j.jsx)("span",{className:"shrink-0 tabular-nums text-foreground/70",children:_.count})]},qr(_.value)),"i"),e[18]=n,e[19]=u,e[20]=w):w=e[20],p=g.map(w),e[14]=n,e[15]=u,e[16]=g,e[17]=p}else p=e[17];let f;e[21]!==n||e[22]!==r.result||e[23]!==s?(f=r.result?.truncated===!0&&(0,j.jsx)("span",{className:"text-muted-foreground","data-testid":`db-facet-truncated-${n}`,children:s("Showing the {n} most common values.",{n:r.result.values.length})}),e[21]=n,e[22]=r.result,e[23]=s,e[24]=f):f=e[24];let h;return e[25]!==c||e[26]!==i||e[27]!==d||e[28]!==m||e[29]!==p||e[30]!==f?(h=(0,j.jsxs)("section",{className:"flex flex-col gap-1","data-testid":c,children:[i,d,m,p,f]}),e[25]=c,e[26]=i,e[27]=d,e[28]=m,e[29]=p,e[30]=f,e[31]=h):h=e[31],h},"fe"),bn=o(t=>{let e=(0,ot.c)(44),{columns:n,facets:l,mask:r,onFacetFilter:s,onToggleFacet:a}=t,u=ee(),c;e[0]!==a?(c=o(I=>{let{column:F}=I.currentTarget.dataset;F!==void 0&&a(F)},"o"),e[0]=a,e[1]=c):c=e[1];let i=c,d;e[2]!==r?(d=o(I=>r.enabled&&r.columns.has(I),"l"),e[2]=r,e[3]=d):d=e[3];let m=d,g,p,f,h,w,_,x,y;if(e[4]!==n||e[5]!==l||e[6]!==m||e[7]!==u||e[8]!==i){y=Symbol.for("react.early_return_sentinel");e:{let I;e[17]!==m?(I=o(k=>!m(k),"w"),e[17]=m,e[18]=I):I=e[18];let F=n.filter(I),M;if(e[19]!==l||e[20]!==m?(M=Object.entries(l).filter(k=>{let[T]=k;return!m(T)}),e[19]=l,e[20]=m,e[21]=M):M=e[21],g=M,F.length===0){y=null;break e}_="flex w-56 shrink-0 flex-col gap-3 overflow-auto border-l border-border p-3 text-xs",x="db-facets",h="flex flex-col gap-1.5";let P;e[22]!==u?(P=u("Facets"),e[22]=u,e[23]=P):P=e[23],e[24]!==P?(w=(0,j.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:P}),e[24]=P,e[25]=w):w=e[25],p="flex flex-wrap gap-1";let N;e[26]!==l||e[27]!==i?(N=o(k=>(0,j.jsx)("button",{"aria-pressed":k 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":k,"data-testid":`db-facet-toggle-${k}`,onClick:i,type:"button",children:k},k),"R"),e[26]=l,e[27]=i,e[28]=N):N=e[28],f=F.map(N)}e[4]=n,e[5]=l,e[6]=m,e[7]=u,e[8]=i,e[9]=g,e[10]=p,e[11]=f,e[12]=h,e[13]=w,e[14]=_,e[15]=x,e[16]=y}else g=e[9],p=e[10],f=e[11],h=e[12],w=e[13],_=e[14],x=e[15],y=e[16];if(y!==Symbol.for("react.early_return_sentinel"))return y;let v;e[29]!==p||e[30]!==f?(v=(0,j.jsx)("div",{className:p,children:f}),e[29]=p,e[30]=f,e[31]=v):v=e[31];let C;e[32]!==v||e[33]!==h||e[34]!==w?(C=(0,j.jsxs)("div",{className:h,children:[w,v]}),e[32]=v,e[33]=h,e[34]=w,e[35]=C):C=e[35];let R;e[36]!==s||e[37]!==g?(R=g.map(I=>{let[F,M]=I;return(0,j.jsx)(Pi,{column:F,onFacetFilter:s,state:M},F)}),e[36]=s,e[37]=g,e[38]=R):R=e[38];let S;return e[39]!==C||e[40]!==R||e[41]!==_||e[42]!==x?(S=(0,j.jsxs)("aside",{className:_,"data-testid":x,children:[C,R]}),e[39]=C,e[40]=R,e[41]=_,e[42]=x,e[43]=S):S=e[43],S},"Ee");function rt(t){let e=(0,ot.c)(2),n=(0,$e.useRef)(t),l;return e[0]!==t?(l=o(()=>{n.current=t},"s"),e[0]=t,e[1]=l):l=e[1],(0,$e.useEffect)(l),n}o(rt,"me");var hn=o(()=>{let[t,e]=(0,$e.useState)({}),n=rt(t),l=(0,$e.useRef)({}),r=o(async(s,a)=>{let u=(l.current[s]??0)+1;l.current[s]=u,e(c=>s in c?{...c,[s]:{error:null,loading:!0,result:c[s]?.result??null}}:c);try{let c=await a(s);if(l.current[s]!==u)return;e(i=>s in i?{...i,[s]:{error:null,loading:!1,result:c}}:i)}catch(c){if(l.current[s]!==u)return;e(i=>s in i?{...i,[s]:{error:jt(c),loading:!1,result:null}}:i)}},"r");return{clearFacets:o(()=>{e({})},"clearFacets"),facets:t,facetsRef:n,refetchFacets:o(s=>{for(let a of Object.keys(n.current))le(r(a,s))},"refetchFacets"),toggleFacet:o((s,a)=>{if(s in n.current){e(u=>Object.fromEntries(Object.entries(u).filter(([c])=>c!==s)));return}e(u=>({...u,[s]:{error:null,loading:!0,result:null}})),a!==null&&le(r(s,a))},"toggleFacet")}},"Oe"),Ni=[],ki=o(()=>{let t=(0,ot.c)(1),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={},t[0]=e):e=t[0];let{data:n}=dt(Ce.maskPolicies,e);return Array.isArray(n?.columns)?n.columns:Ni},"ge"),wn=o(t=>{let e=(0,ot.c)(16),{columns:n,selectedTable:l}=t,r=ki(),[s,a]=(0,$e.useState)(!0),u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=o(()=>{a(Di)},"g"),e[0]=u):u=e[0];let c=u,i;if(e[1]!==n||e[2]!==r||e[3]!==l){let h=Br(r,l??"");i=Gr(h,n),e[1]=n,e[2]=r,e[3]=l,e[4]=i}else i=e[4];let d=i,m;e[5]!==s||e[6]!==r?(m=o((h,w)=>({columns:Gr(Br(r,h),w),enabled:s}),"a"),e[5]=s,e[6]=r,e[7]=m):m=e[7];let g=m,p;e[8]!==d||e[9]!==s?(p={columns:d,enabled:s},e[8]=d,e[9]=s,e[10]=p):p=e[10];let f;return e[11]!==d||e[12]!==s||e[13]!==g||e[14]!==p?(f={maskColumns:d,maskOn:s,maskView:p,maskViewFor:g,onToggleMask:c},e[11]=d,e[12]=s,e[13]=g,e[14]=p,e[15]=f):f=e[15],f},"Re");function Di(t){return!t}o(Di,"he");var Kr=34,Jr=600,Ti=o(t=>{let e=(0,ot.c)(21),{item:n,onSelect:l,prefix:r,selected:s,start:a}=t,u;e[0]!==n.name||e[1]!==l?(u=o(()=>{l(n.name)},"g"),e[0]=n.name,e[1]=l,e[2]=u):u=e[2];let c=u,i=`translateY(${String(a)}px)`,d;e[3]!==i?(d={insetInline:0,position:"absolute",top:0,transform:i},e[3]=i,e[4]=d):d=e[4];let m=d,g=s?"bg-accent font-medium text-accent-foreground":"text-foreground",p;e[5]!==g?(p=bt("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",g),e[5]=g,e[6]=p):p=e[6];let f=`${r}-table-${n.name}`,h;e[7]!==n.name?(h=(0,j.jsx)("span",{className:"truncate",children:n.name}),e[7]=n.name,e[8]=h):h=e[8];let w;e[9]!==n.rowCount?(w=(0,j.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]!==s||e[13]!==p||e[14]!==f||e[15]!==h||e[16]!==w?(_=(0,j.jsxs)("button",{"aria-pressed":s,className:p,"data-testid":f,onClick:c,type:"button",children:[h,w]}),e[11]=c,e[12]=s,e[13]=p,e[14]=f,e[15]=h,e[16]=w,e[17]=_):_=e[17];let x;return e[18]!==m||e[19]!==_?(x=(0,j.jsx)("li",{style:m,children:_}),e[18]=m,e[19]=_,e[20]=x):x=e[20],x},"pe"),xn=o(({header:t,onReload:e,onSelect:n,prefix:l,reloadLabel:r,selected:s,tables:a})=>{let u=ee(),[c,i]=(0,$e.useState)(""),d=(0,$e.useRef)(null),m=o(h=>{i(h.target.value)},"a"),g=(0,$e.useMemo)(()=>{let h=c.trim().toLowerCase();return h===""?a:a.filter(w=>w.name.toLowerCase().includes(h))},[c,a]),p=an({count:g.length,estimateSize:o(()=>Kr,"estimateSize"),getScrollElement:o(()=>d.current,"getScrollElement"),initialRect:{height:Jr,width:240},observeElementRect:o((h,w)=>cn(h,w,Jr),"observeElementRect"),overscan:12}).getVirtualItems(),f={height:g.length*Kr};return(0,j.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,j.jsxs)("div",{className:"flex h-9 shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[(0,j.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:u("Tables")}),e!==void 0&&(0,j.jsx)("button",{"aria-label":r??u("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??u("Refresh"),type:"button",children:(0,j.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,j.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,j.jsx)("div",{className:"shrink-0 border-b border-border p-2",children:(0,j.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:m,placeholder:u("search table\u2026"),type:"search",value:c})}),(0,j.jsxs)("ul",{className:"relative flex-1 overflow-y-auto p-1.5","data-testid":`${l}-table-list-rows`,ref:d,children:[(0,j.jsx)("li",{"aria-hidden":"true",style:f}),p.map(h=>{let w=g[h.index];return w===void 0?null:(0,j.jsx)(Ti,{item:w,onSelect:n,prefix:l,selected:s===w.name,start:h.start},w.name)})]})]})},"Ae");var J=Re(Ht(),1);var D=Re(ut(),1);var b=Re(Lt(),1);var Wr=Re(ut(),1);function Ai(t){return Oi(t)||typeof t=="function"||Ei(t)}o(Ai,"isReactComponent");function Oi(t){return typeof t=="function"&&(()=>{let e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}o(Oi,"isClassComponent");function Ei(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}o(Ei,"isExoticComponent");function wt(t,e){return t==null?null:Ai(t)?Wr.default.createElement(t,e):t}o(wt,"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?.()?wt(r.aggregatedCell??n.cell,e.getContext()):l.getIsPlaceholder?.()?null:wt(n.cell,e.getContext())}return"header"in t&&t.header?wt(t.header.column.columnDef.header,t.header.getContext()):"footer"in t&&t.footer?wt(t.footer.column.columnDef.footer,t.footer.getContext()):null}o(co,"FlexRender");function Qr({update:t,notify:e,unwatched:n}){return{link:l,unlink:r,propagate:s,checkDirty:a,shallowPropagate:u};function l(i,d,m){let g=d.depsTail;if(g!==void 0&&g.dep===i)return;let p=g!==void 0?g.nextDep:d.deps;if(p!==void 0&&p.dep===i){p.version=m,d.depsTail=p;return}let f=i.subsTail;if(f!==void 0&&f.version===m&&f.sub===d)return;let h=d.depsTail=i.subsTail={version:m,dep:i,sub:d,prevDep:g,nextDep:p,prevSub:f,nextSub:void 0};p!==void 0&&(p.prevDep=h),g!==void 0?g.nextDep=h:d.deps=h,f!==void 0?f.nextSub=h:i.subs=h}function r(i,d=i.sub){let m=i.dep,g=i.prevDep,p=i.nextDep,f=i.nextSub,h=i.prevSub;return p!==void 0?p.prevDep=g:d.depsTail=g,g!==void 0?g.nextDep=p:d.deps=p,f!==void 0?f.prevSub=h:m.subsTail=h,h!==void 0?h.nextSub=f:(m.subs=f)===void 0&&n(m),p}function s(i){let d=i.nextSub,m;e:do{let g=i.sub,p=g.flags;if(p&60?p&12?p&4?!(p&48)&&c(i,g)?(g.flags=p|40,p&=1):p=0:g.flags=p&-9|32:p=0:g.flags=p|32,p&2&&e(g),p&1){let f=g.subs;if(f!==void 0){let h=(i=f).nextSub;h!==void 0&&(m={value:d,prev:m},d=h);continue}}if((i=d)!==void 0){d=i.nextSub;continue}for(;m!==void 0;)if(i=m.value,m=m.prev,i!==void 0){d=i.nextSub;continue e}break}while(!0)}function a(i,d){let m,g=0,p=!1;e:do{let f=i.dep,h=f.flags;if(d.flags&16)p=!0;else if((h&17)===17){if(t(f)){let w=f.subs;w.nextSub!==void 0&&u(w),p=!0}}else if((h&33)===33){(i.nextSub!==void 0||i.prevSub!==void 0)&&(m={value:i,prev:m}),i=f.deps,d=f,++g;continue}if(!p){let w=i.nextDep;if(w!==void 0){i=w;continue}}for(;g--;){let w=d.subs,_=w.nextSub!==void 0;if(_?(i=m.value,m=m.prev):i=w,p){if(t(d)){_&&u(w),d=i.sub;continue}p=!1}else d.flags&=-33;d=i.sub;let x=i.nextDep;if(x!==void 0){i=x;continue e}}return p}while(!0)}function u(i){do{let d=i.sub,m=d.flags;(m&48)===32&&(d.flags=m|16,(m&6)===2&&e(d))}while((i=i.nextSub)!==void 0)}function c(i,d){let m=d.depsTail;for(;m!==void 0;){if(m===i)return!0;m=m.prevDep}return!1}}o(Qr,"createReactiveSystem");function Zr(t,e,n){let l=typeof t=="object",r=l?t:void 0;return{next:(l?t.next:t)?.bind(r),error:(l?t.error:e)?.bind(r),complete:(l?t.complete:n)?.bind(r)}}o(Zr,"toObserver");var uo=[],_n=0,{link:Xr,unlink:Vi,propagate:zi,checkDirty:el,shallowPropagate:Yr}=Qr({update(t){return t._update()},notify(t){uo[mo++]=t,t.flags&=-3},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=17,Cn(t))}}),Sn=0,mo=0,Ke,go=0;function fo(t){try{++go,t()}finally{--go||po()}}o(fo,"batch");function Cn(t){let e=t.depsTail,n=e!==void 0?e.nextDep:t.deps;for(;n!==void 0;)n=Vi(n,t)}o(Cn,"purgeDeps");function po(){if(!(go>0)){for(;Sn<mo;){let t=uo[Sn];uo[Sn++]=void 0,t.notify()}Sn=0,mo=0}}o(po,"flush");function bo(t,e){let n=typeof t=="function",l=t,r={_snapshot:n?void 0:t,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?0:1,get(){return Ke!==void 0&&Xr(r,Ke,_n),r._snapshot},subscribe(s){let a=Zr(s),u={current:!1},c=$i(()=>{r.get(),u.current?a.next?.(r._snapshot):u.current=!0});return{unsubscribe:o(()=>{c.stop()},"unsubscribe")}},_update(s){let a=Ke,u=e?.compare??Object.is;if(n)Ke=r,++_n,r.depsTail=void 0;else if(s===void 0)return!1;n&&(r.flags=5);try{let c=r._snapshot,i=typeof s=="function"?s(c):s===void 0&&n?l(c):s;return c===void 0||!u(c,i)?(r._snapshot=i,!0):!1}finally{Ke=a,n&&(r.flags&=-5),Cn(r)}}};return n?(r.flags=17,r.get=function(){let s=r.flags;if(s&16||s&32&&el(r.deps,r)){if(r._update()){let a=r.subs;a!==void 0&&Yr(a)}}else s&32&&(r.flags=s&-33);return Ke!==void 0&&Xr(r,Ke,_n),r._snapshot}):r.set=function(s){if(r._update(s)){let a=r.subs;a!==void 0&&(zi(a),Yr(a),po())}},r}o(bo,"createAtom");function $i(t){let e=o(()=>{let l=Ke;Ke=n,++_n,n.depsTail=void 0,n.flags=6;try{return t()}finally{Ke=l,n.flags&=-5,Cn(n)}},"run"),n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let l=this.flags;l&16||l&32&&el(this.deps,this)?e():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Cn(this)}};return e(),n}o($i,"effect");function lt(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(let[l,r]of t)if(!e.has(l)||!Object.is(r,e.get(l)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(let l of t)if(!e.has(l))return!1;return!0}if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();let n=tl(t);if(n.length!==tl(e).length)return!1;for(let l=0;l<n.length;l++)if(!Object.prototype.hasOwnProperty.call(e,n[l])||!Object.is(t[n[l]],e[n[l]]))return!1;return!0}o(lt,"shallow");function tl(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}o(tl,"getOwnKeys");var ho=Re(ut(),1),nl=Re(bi(),1);function Hi(t,e){return t===e}o(Hi,"defaultCompare");function qt(t,e=l=>l,n){let l=n?.compare??Hi,r=(0,ho.useCallback)(a=>{let{unsubscribe:u}=t.subscribe(a);return u},[t]),s=(0,ho.useCallback)(()=>t.get(),[t]);return(0,nl.useSyncExternalStoreWithSelector)(r,s,s,e,l)}o(qt,"useSelector");function ol(t){let e=qt(t.source,t.selector,{compare:lt});return typeof t.children=="function"?t.children(e):t.children}o(ol,"Subscribe");function rl(t){let e=t;return Object.defineProperty(t,"state",{get(){return t.get()}}),"set"in t&&(e.setState=t.set.bind(t)),e}o(rl,"atomToStore");function wo(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,s)=>{let a=s?.compare??Object.is,u=!1,c,i=o(()=>{let m=r();return(!u||!a(c,m))&&(c=m,u=!0),c},"getSnapshot"),d=e(()=>(l.get(),i()),{compare:a});return{get:i,subscribe:d.subscribe.bind(d)}},"createReadonlyAtom"),createWritableAtom:o((r,s)=>e(r,{compare:s?.compare}),"createWritableAtom"),commit:o(()=>{l.set(r=>r+1)},"commit")}}o(wo,"renderPhaseReactivity");function xo(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(s=>{(!n||!e(l,s))&&r(s)}),"subscribe")}}o(xo,"createRenderPhaseSource");function ll(){return wo({createAtom:bo,batch:fo})}o(ll,"reactReactivity");function yt(t,e){return typeof t=="function"?t(e):t}o(yt,"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?$():{},l=Object.keys(t);for(let r=0;r<l.length;r++){let s=l[r];Object.defineProperty(n,s,{configurable:!0,enumerable:!0,value:ie(t[s]),writable:!0})}return n}return t}o(ie,"cloneState");function vn(t,e){let n=Object.keys(e),l=t;for(let r=0;r<n.length;r++){let s=n[r];!s.startsWith("_memo_")&&s!=="_cellsCache"&&(l[s]=e[s])}return t}o(vn,"copyInstancePropertiesWithoutMemos");function $(){return Object.create(null)}o($,"makeObjectMap");function He(t,e){return Object.prototype.hasOwnProperty.call(t,e)}o(He,"hasOwn");function Le(t,e){return n=>{(e.options.atoms?.[t]??e.baseAtoms[t]).set(l=>yt(n,l))}}o(Le,"makeStateUpdater");function sl(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(sl,"isPlainContainer");function al(t){return Reflect.ownKeys(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}o(al,"getEnumerableOwnKeys");var Li=3;function ji(t,e){return il(t,e,Li)}o(ji,"stateSlicesEqual");function il(t,e,n){if(Object.is(t,e))return!0;if(n<=0||!sl(t)||!sl(e)||(Array.isArray(t)||Array.isArray(e))&&(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length))return!1;let l=al(t),r=al(e);if(l.length!==r.length)return!1;let s=t,a=e;for(let u=0;u<l.length;u++){let c=l[u];if(!Object.prototype.propertyIsEnumerable.call(e,c)||!il(s[c],a[c],n-1))return!1}return!0}o(il,"stateSlicesEqualAtDepth");function Ve(t,e,n,l=ji){let r=`on${e.charAt(0).toUpperCase()}${e.slice(1)}Change`,s=t.options[r];s&&s(a=>{let u=yt(n,a);return l(a,u)?a:u})}o(Ve,"setStateSlice");function cl(t){return t instanceof Function}o(cl,"isFunction");function ul(t,e){let n=[],l=o(r=>{r.forEach(s=>{n.push(s);let a=e(s);a.length&&l(a)})},"recurse");return l(t),n}o(ul,"flattenBy");var Bi=o(({fn:t,memoDeps:e,onAfterCompare:n,onAfterUpdate:l,onBeforeCompare:r,onBeforeUpdate:s})=>{let a=[],u;return o(i=>{r?.();let d=e?.(i),m=!d||d.length!==a?.length;if(!m&&d){for(let g=0;g<d.length;g++)if(d[g]!==a[g]){m=!0;break}}return n?.(m),m&&(a=d,s?.(),u=t(...d??[]),l?.(u)),u},"memoizedFn")},"memo");function yn(t){let e=!1;return()=>{if(!e){e=!0;return}t()}}o(yn,"skipFirstRun");var Gi=o((t,e)=>{for(t=String(t);t.length<e;)t=" "+t;return t},"pad");function Rt({feature:t,fnName:e,objectId:n,onAfterUpdate:l,table:r,...s}){let a,u,c=0,i;function d(p,f){let h=c===0?"(1st run)":f?"(rerun #"+c+")":"(cache)";c++,console.groupCollapsed(`%c\u23F1 ${Gi(`${p.toFixed(1)} ms`,12)} %c${h}%c ${e}%c ${n?`(${e.split(".")[0]}Id: ${n})`:""}`,`font-size: .6rem; font-weight: bold; ${f?`color: hsl(
2
2
  ${Math.max(0,Math.min(120-Math.log10(p)*60,120))}deg 100% 31%);`:""} `,`color: ${c<2?"#FF00FF":"#FF1493"}`,"color: #666","color: #87CEEB"),console.info({feature:t,state:r.store.state,deps:s.memoDeps?.toString()}),console.trace(),console.groupEnd()}o(d,"logTime");let m=o(()=>{if(!l)return;let{schedule:p,untrack:f}=r._reactivity;p(()=>f(()=>l()))},"onAfterUpdateHandler");return Bi({...s,...{onAfterUpdate:o(()=>{m()},"onAfterUpdate")}})}o(Rt,"tableMemo");function dl(t,e="_"){let[n,l]=t.split(e);return{fnKey:l,fnName:`${n}.${l}`,parentName:n}}o(dl,"getFunctionNameInfo");function ge(t,e,n){for(let[l,{fn:r,memoDeps:s}]of Object.entries(n)){let{fnKey:a,fnName:u}=dl(l);e[a]=s?Rt({memoDeps:s,fn:r,fnName:u,table:e,feature:t}):r}}o(ge,"assignTableAPIs");function de(t,e,n,l){for(let[r,{fn:s,memoDeps:a}]of Object.entries(l)){let{fnKey:u,fnName:c}=dl(r);if(a){let i=`_memo_${u}`;e[u]=function(...d){if(!this[i]){let m=this;this[i]=Rt({memoDeps:o(g=>a(m,g),"memoDeps"),fn:o((...g)=>s(m,...g),"fn"),fnName:c,objectId:m.id,table:n,feature:t})}return this[i](...d)}}else e[u]=function(...i){return s(this,...i)}}}o(de,"assignPrototypeAPIs");function V(t,e,n,...l){return t[e]?.(...l)??n(t,...l)}o(V,"callMemoOrStaticFn");function ml(t){return t.row.getValue(t.column.id)}o(ml,"cell_getValue");function gl(t){return t.getValue()??t.table.options.renderFallbackValue}o(gl,"cell_renderValue");function fl(t){return{table:t.table,column:t.column,row:t.row,cell:t,getValue:o(()=>t.getValue(),"getValue"),renderValue:o(()=>t.renderValue(),"renderValue")}}o(fl,"cell_getContext");var pl={assignCellPrototype:o((t,e)=>{de("coreCellsFeature",t,e,{cell_getValue:{fn:o(n=>ml(n),"fn")},cell_renderValue:{fn:o(n=>gl(n),"fn")},cell_getContext:{fn:o(n=>fl(n),"fn"),memoDeps:o(n=>[n],"memoDeps")}})},"assignCellPrototype")};function qi(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(qi,"getHeaderPrototype");function So(t,e,n){let l=qi(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 s=t._headerInstanceInitFns;for(let a=0;a<s.length;a++)s[a](r);return r}o(So,"constructHeader");function Je(){return{start:[],end:[]}}o(Je,"getDefaultColumnPinningState");function bl(t){let e=t.getAllColumns(),n=t.getAllLeafColumnsById(),{start:l}=t.atoms.columnPinning?.get()??Je(),r=[];for(let s=0;s<l.length;s++){let a=n[l[s]];a&&V(a,"getIsVisible",me)&&r.push(a)}return St(e,r,t,"start")}o(bl,"table_getStartHeaderGroups");function hl(t){let e=t.getAllColumns(),n=t.getAllLeafColumnsById(),{end:l}=t.atoms.columnPinning?.get()??Je(),r=[];for(let s=0;s<l.length;s++){let a=n[l[s]];a&&V(a,"getIsVisible",me)&&r.push(a)}return St(e,r,t,"end")}o(hl,"table_getEndHeaderGroups");function wl(t){let e=t.getAllColumns(),n=V(t,"getVisibleLeafColumns",xt),{start:l,end:r}=t.atoms.columnPinning?.get()??Je();if(l.length||r.length){let s=[...l,...r];n=n.filter(a=>!s.includes(a.id))}return St(e,n,t,"center")}o(wl,"table_getCenterHeaderGroups");function Ki(t){let{start:e}=t.atoms.columnPinning?.get()??Je(),n=t.getAllLeafColumnsById(),l=[];for(let r=0;r<e.length;r++){let s=n[e[r]];s&&l.push(s)}return l}o(Ki,"table_getStartLeafColumns");function Ji(t){let{end:e}=t.atoms.columnPinning?.get()??Je(),n=t.getAllLeafColumnsById(),l=[];for(let r=0;r<e.length;r++){let s=n[e[r]];s&&l.push(s)}return l}o(Ji,"table_getEndLeafColumns");function Ui(t){let{start:e,end:n}=t.atoms.columnPinning?.get()??Je();if(!e.length&&!n.length)return t.getAllLeafColumns();let l=[...e,...n];return t.getAllLeafColumns().filter(r=>!l.includes(r.id))}o(Ui,"table_getCenterLeafColumns");function Wi(t){return V(t,"getStartLeafColumns",Ki).filter(e=>V(e,"getIsVisible",me))}o(Wi,"table_getStartVisibleLeafColumns");function Qi(t){return V(t,"getEndLeafColumns",Ji).filter(e=>V(e,"getIsVisible",me))}o(Qi,"table_getEndVisibleLeafColumns");function Xi(t){return V(t,"getCenterLeafColumns",Ui).filter(e=>V(e,"getIsVisible",me))}o(Xi,"table_getCenterVisibleLeafColumns");function je(t,e){return e?e==="start"?V(t,"getStartVisibleLeafColumns",Wi):e==="end"?V(t,"getEndVisibleLeafColumns",Qi):V(t,"getCenterVisibleLeafColumns",Xi):V(t,"getVisibleLeafColumns",xt)}o(je,"table_getPinnedVisibleLeafColumns");function xl(){return $()}o(xl,"getDefaultColumnVisibilityState");function Co(t,e){Kt(t)&&Jt(t.table,n=>{let l=Object.assign($(),n),r=e??!V(t,"getIsVisible",me),s=t.getLeafColumns();for(let a=0;a<s.length;a++){let u=s[a];Kt(u)&&(l[u.id]=r)}return l})}o(Co,"column_toggleVisibility");function me(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",me)):(He(e,t.id)?e[t.id]:void 0)??!0}o(me,"column_getIsVisible");function Kt(t){return(t.columnDef.enableHiding??!0)&&(t.table.options.enableHiding??!0)}o(Kt,"column_getCanHide");function Sl(t){return e=>{Co(t,e.target.checked)}}o(Sl,"column_getToggleVisibilityHandler");function _o(t){let e=t.getAllCells(),n=[];for(let i=0;i<e.length;i++){let d=e[i];V(d.column,"getIsVisible",me)&&n.push(d)}let{start:l,end:r}=t.table.atoms.columnPinning?.get()??Je();if(!l.length&&!r.length)return n;let s=V(t,"getVisibleCellsByColumnId",Rn),a=[];for(let i=0;i<l.length;i++){let d=s[l[i]];d&&a.push(d)}let u=[];for(let i=0;i<r.length;i++){let d=s[r[i]];d&&u.push(d)}let c=[];for(let i=0;i<n.length;i++){let d=n[i],m=d.column.id;!l.includes(m)&&!r.includes(m)&&c.push(d)}return[...a,...c,...u]}o(_o,"row_getVisibleCells");function Rn(t){let e=$(),n=t.getAllCells();for(let l=0;l<n.length;l++){let r=n[l];V(r.column,"getIsVisible",me)&&(e[r.column.id]=r)}return e}o(Rn,"row_getVisibleCellsByColumnId");function _l(t){return t.getAllFlatColumns().filter(e=>V(e,"getIsVisible",me))}o(_l,"table_getVisibleFlatColumns");function xt(t){return t.getAllLeafColumns().filter(e=>V(e,"getIsVisible",me))}o(xt,"table_getVisibleLeafColumns");function Jt(t,e){Ve(t,"columnVisibility",e)}o(Jt,"table_setColumnVisibility");function Cl(t,e){Jt(t,e?$():Object.assign($(),ie(t.initialState.columnVisibility??{})))}o(Cl,"table_resetColumnVisibility");function vo(t,e){e=e??!yo(t);let n=$(),l=t.getAllLeafColumns();for(let r=0;r<l.length;r++){let s=l[r];n[s.id]=e||!Kt(s)}Jt(t,n)}o(vo,"table_toggleAllColumnsVisible");function yo(t){return!t.getAllLeafColumns().some(e=>!V(e,"getIsVisible",me))}o(yo,"table_getIsAllColumnsVisible");function vl(t){return t.getAllLeafColumns().some(e=>V(e,"getIsVisible",me))}o(vl,"table_getIsSomeColumnsVisible");function yl(t){return e=>{vo(t,e.target.checked)}}o(yl,"table_getToggleAllColumnsVisibilityHandler");function Rl(t,e=1){let n=e;for(let l=0;l<t.length;l++){let r=t[l];V(r,"getIsVisible",me)&&r.columns.length&&(n=Math.max(n,Rl(r.columns,e+1)))}return n}o(Rl,"getMaxHeaderDepth");function Yi(t,e){return t?`${t}_${e}`:String(e)}o(Yi,"formatHeaderGroupId");function Zi(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(Zi,"formatHeaderId");function ec(t,e){let n=0;for(let l=0;l<t.length;l++)t[l].column===e&&n++;return n}o(ec,"countPendingHeadersForColumn");function Il(t,e,n,l,r,s){let a={depth:e,id:Yi(l,e),headers:[]},u=[];for(let c=0;c<t.length;c++){if(!(c in t))continue;let i=t[c],d=u[u.length-1],m=i.column.depth===a.depth,g,p=!1;if(m&&i.column.parent?g=i.column.parent:(g=i.column,p=!0),d&&d.column===g)d.subHeaders.push(i);else{let f=So(n,g,{id:Zi(l,e,g.id,i.id),isPlaceholder:p,placeholderId:p?String(ec(u,g)):void 0,depth:e,index:u.length});f.subHeaders.push(i),u.push(f)}a.headers.push(i),i.headerGroup=a}for(let c=0;c<s.length;c++)s[c](a);r.push(a),e>0&&Il(u,e-1,n,l,r,s)}o(Il,"constructHeaderGroup");function Fl(t){for(let e=0;e<t.length;e++){let n=t[e];if(!V(n.column,"getIsVisible",me))continue;let l=0;if(n.subHeaders.length){Fl(n.subHeaders);for(let r=0;r<n.subHeaders.length;r++){let s=n.subHeaders[r];V(s.column,"getIsVisible",me)&&(l+=s.colSpan)}}else l=1;if(n.colSpan=l,n.isPlaceholder&&n.subHeaders.length===1&&n.subHeaders[0].column===n.column){let r=1,s=n.subHeaders[0];for(;s;)s.rowSpan=0,r++,s=s.subHeaders.length===1&&s.subHeaders[0].column===n.column?s.subHeaders[0]:void 0;n.rowSpan=r}else n.rowSpan=1}}o(Fl,"updateHeaderSpans");function St(t,e,n,l){let r=Rl(t),s=[],a=n._headerGroupInstanceInitFns,u=new Array(e.length);for(let c=0;c<e.length;c++)c in e&&(u[c]=So(n,e[c],{depth:r,index:c}));return Il(u,r-1,n,l,s,a),s.reverse(),Fl(s[0]?.headers??[]),s}o(St,"buildHeaderGroups");function tc(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(tc,"getColumnPrototype");function Ml(t,e,n,l){let r={...t.getDefaultColumnDef(),...e},s=r.accessorKey,a=s===void 0?void 0:String(s),u=r.id??a?.replaceAll(".","_")??(typeof r.header=="string"?r.header:void 0),c;if(r.accessorFn)c=r.accessorFn;else if(s!==void 0)if(typeof s=="string"&&s.includes(".")){let g=s.split(".");c=o(p=>{let f=p;for(let h=0;h<g.length;h++){let w=g[h];f=f?.[w]}return f},"accessorFn")}else c=o(g=>g[r.accessorKey],"accessorFn");if(!u)throw new Error;let i=tc(t),d=Object.create(i);d.accessorFn=c,d.columnDef=r,d.columns=[],d.depth=n,d.id=`${String(u)}`,d.parent=l;let m=t._columnInstanceInitFns;for(let g=0;g<m.length;g++)m[g](d);return d}o(Ml,"constructColumn");function Pl(){return[]}o(Pl,"getDefaultColumnOrderState");function Ro(t){let e=o(n=>{let l=$();for(let r=0;r<n.length;r++)l[n[r].id]=r;return l},"buildIndexes");return{all:e(je(t)),center:e(je(t,"center")),start:e(je(t,"start")),end:e(je(t,"end"))}}o(Ro,"table_getColumnIndexes");function Nl(t,e){return V(t.table,"getColumnIndexes",Ro)[e==="start"?"start":e==="end"?"end":e==="center"?"center":"all"][t.id]??-1}o(Nl,"column_getIndex");function kl(t,e){return je(t.table,e)[0]?.id===t.id}o(kl,"column_getIsFirstColumn");function Dl(t,e){let n=je(t.table,e);return n[n.length-1]?.id===t.id}o(Dl,"column_getIsLastColumn");function Io(t,e){Ve(t,"columnOrder",e)}o(Io,"table_setColumnOrder");function Tl(t,e){Io(t,e?[]:ie(t.initialState.columnOrder??[]))}o(Tl,"table_resetColumnOrder");function Ut(t){let e=t.atoms.columnOrder?.get();return n=>{let l=[];if(!e?.length)l=n;else{let r=new Map;for(let s=0;s<n.length;s++){let a=n[s];r.set(a.id,a)}for(let s=0;s<e.length;s++){let a=e[s],u=r.get(a);u&&(l.push(u),r.delete(a))}for(let s=0;s<n.length;s++){let a=n[s];r.has(a.id)&&l.push(a)}}return nc(t,l)}}o(Ut,"table_getOrderColumnsFn");function nc(t,e){let n=t.atoms.grouping?.get()??[],{groupedColumnMode:l}=t.options;if(!n.length||!l)return e;let r=e.filter(u=>!n.includes(u.id));if(l==="remove")return r;let s=new Map;for(let u=0;u<e.length;u++){let c=e[u];s.set(c.id,c)}let a=[];for(let u=0;u<n.length;u++){let c=s.get(n[u]);c&&a.push(c)}return[...a,...r]}o(nc,"orderColumns");function Al(t){return[t,...t.columns.flatMap(e=>e.getFlatColumns())]}o(Al,"column_getFlatColumns");function Ol(t){if(t.columns.length){let e=t.columns.flatMap(n=>n.getLeafColumns());return V(t.table,"getOrderColumns",Ut)(e)}return[t]}o(Ol,"column_getLeafColumns");function El(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(El,"table_getDefaultColumnDef");function Vl(t,e,n,l=0){let r=new Array(e.length);for(let s=0;s<e.length;s++){if(!(s in e))continue;let a=e[s],u=Ml(t,a,l,n),c=a;u.columns=c.columns?Vl(t,c.columns,u,l+1):[],r[s]=u}return r}o(Vl,"constructColumns");function zl(t){return Vl(t,t.options.columns)}o(zl,"table_getAllColumns");function $l(t){return t.getAllColumns().flatMap(e=>e.getFlatColumns())}o($l,"table_getAllFlatColumns");function Hl(t){let e=$(),n=t.getAllFlatColumns();for(let l=0;l<n.length;l++){let r=n[l];e[r.id]=r}return e}o(Hl,"table_getAllFlatColumnsById");function Ll(t){let e=t.getAllColumns().flatMap(n=>n.getLeafColumns());return V(t,"getOrderColumns",Ut)(e)}o(Ll,"table_getAllLeafColumns");function jl(t){let e=$(),n=t.getAllLeafColumns();for(let l=0;l<n.length;l++){let r=n[l];e[r.id]=r}return e}o(jl,"table_getAllLeafColumnsById");function Bl(t,e){return t.getAllFlatColumnsById()[e]}o(Bl,"table_getColumn");var Gl={assignColumnPrototype:o((t,e)=>{de("coreColumnsFeature",t,e,{column_getFlatColumns:{fn:o(n=>Al(n),"fn"),memoDeps:o(n=>[n.table.options.columns],"memoDeps")},column_getLeafColumns:{fn:o(n=>Ol(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=>{ge("coreColumnsFeature",t,{table_getDefaultColumnDef:{fn:o(()=>El(t),"fn"),memoDeps:o(()=>[t.options.defaultColumn],"memoDeps")},table_getAllColumns:{fn:o(()=>zl(t),"fn"),memoDeps:o(()=>[t.options.columns],"memoDeps")},table_getAllFlatColumns:{fn:o(()=>$l(t),"fn"),memoDeps:o(()=>[t.options.columns],"memoDeps")},table_getAllFlatColumnsById:{fn:o(()=>Hl(t),"fn"),memoDeps:o(()=>[t.options.columns],"memoDeps")},table_getAllLeafColumns:{fn:o(()=>Ll(t),"fn"),memoDeps:o(()=>[t.atoms.columnOrder?.get(),t.atoms.grouping?.get(),t.options.columns,t.options.groupedColumnMode],"memoDeps")},table_getAllLeafColumnsById:{fn:o(()=>jl(t),"fn"),memoDeps:o(()=>[t.getAllLeafColumns()],"memoDeps")},table_getColumn:{fn:o(e=>Bl(t,e),"fn")}})},"constructTableAPIs")};function ql(t,e){for(let n=0;n<t.subHeaders.length;n++)ql(t.subHeaders[n],e);e.push(t)}o(ql,"collectLeafHeaders");function Kl(t){let e=[];return ql(t,e),e}o(Kl,"header_getLeafHeaders");function Jl(t){return{column:t.column,header:t,table:t.column.table}}o(Jl,"header_getContext");function Ul(t){let{start:e,end:n}=t.atoms.columnPinning?.get()??Je(),l=t.getAllColumns(),r=V(t,"getVisibleLeafColumns",xt);if(!e.length&&!n.length)return St(l,r,t);let s=t.getAllLeafColumnsById(),a=[];for(let i=0;i<e.length;i++){let d=s[e[i]];d&&V(d,"getIsVisible",me)&&a.push(d)}let u=[];for(let i=0;i<n.length;i++){let d=s[n[i]];d&&V(d,"getIsVisible",me)&&u.push(d)}let c=r.filter(i=>!e.includes(i.id)&&!n.includes(i.id));return St(l,[...a,...c,...u],t)}o(Ul,"table_getHeaderGroups");function Wl(t){return[...t.getHeaderGroups()].reverse()}o(Wl,"table_getFooterGroups");function Ql(t){let e=t.getHeaderGroups(),n=[];for(let l=0;l<e.length;l++){let r=e[l].headers;for(let s=0;s<r.length;s++)n.push(r[s])}return n}o(Ql,"table_getFlatHeaders");function Xl(t){let e=t.getHeaderGroups()[0]?.headers??[],n=[];for(let l=0;l<e.length;l++){let r=e[l].getLeafHeaders();for(let s=0;s<r.length;s++)n.push(r[s])}return n}o(Xl,"table_getLeafHeaders");var Yl={assignHeaderPrototype:o((t,e)=>{de("coreHeadersFeature",t,e,{header_getLeafHeaders:{fn:o(n=>Kl(n),"fn"),memoDeps:o(n=>[n.column.table.options.columns],"memoDeps")},header_getContext:{fn:o(n=>Jl(n),"fn"),memoDeps:o(n=>[n.column.table.options.columns],"memoDeps")}})},"assignHeaderPrototype"),constructTableAPIs:o(t=>{ge("coreHeadersFeature",t,{table_getHeaderGroups:{fn:o(()=>Ul(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(()=>Wl(t),"fn"),memoDeps:o(()=>[t.getHeaderGroups()],"memoDeps")},table_getFlatHeaders:{fn:o(()=>Ql(t),"fn"),memoDeps:o(()=>[t.getHeaderGroups()],"memoDeps")},table_getLeafHeaders:{fn:o(()=>Xl(t),"fn"),memoDeps:o(()=>[t.getHeaderGroups()],"memoDeps")}})},"constructTableAPIs")};function oc(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(oc,"getRowPrototype");var Zl=o((t,e,n,l,r,s,a)=>{let u=oc(t),c=Object.create(u);c._displayIndexCache=-1,c._uniqueValuesCache=$(),c._valuesCache=$(),c.depth=r,c.id=e,c.index=l,c.original=n,c.parentId=a,c.subRows=s??[];let i=t._rowInstanceInitFns;for(let d=0;d<i.length;d++)i[d](c);return c},"constructRow");var Mo=/([0-9]+)/gm;function _t(t){let e=Object.assign((n,l,r)=>{let s=n.getValue(r),a=l.getValue(r),u=e.resolveDataValue;return u&&(s=u(s),a=u(a)),e.sort(s,a,n,l,r)},t);return e}o(_t,"constructSortFn");var Po=_t({resolveDataValue:o(t=>Fn(t).toLowerCase(),"resolveDataValue"),sort:o((t,e)=>ns(t,e),"sort")}),rc=_t({resolveDataValue:o(t=>Fn(t),"resolveDataValue"),sort:o((t,e)=>ns(t,e),"sort")}),No=_t({resolveDataValue:o(t=>Fn(t).toLowerCase(),"resolveDataValue"),sort:o((t,e)=>Do(t,e),"sort")}),lc=_t({resolveDataValue:o(t=>Fn(t),"resolveDataValue"),sort:o((t,e)=>Do(t,e),"sort")}),ko=_t({resolveDataValue:o(t=>sc(t),"resolveDataValue"),sort:o((t,e)=>t>e?1:t<e?-1:0,"sort")}),It=_t({sort:o((t,e)=>Do(t,e),"sort")});function Do(t,e){return t===e?0:t>e?1:-1}o(Do,"compareBasic");function sc(t){return t instanceof Date?t.getTime():t}o(sc,"toDateSortValue");function Fn(t){return typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?"":String(t):typeof t=="string"?t:""}o(Fn,"toString");function ns(t,e){let n=0,l=0,r=t.length,s=e.length;for(;n<r&&l<s;){let a=In(t.charCodeAt(n)),u=In(e.charCodeAt(l)),c=Fo(t,n,a),i=Fo(e,l,u);if(!a&&!u){let m=ac(t,n,c,e,l,i);if(m)return m;n=c,l=i;continue}if(a!==u)return a?1:-1;let d=ic(t,n,c,e,l,i);if(d)return d;n=c,l=i}return ts(t,n)-ts(e,l)}o(ns,"compareAlphanumeric");function In(t){return t>=48&&t<=57}o(In,"isDigit");function Fo(t,e,n){let l=e+1;for(;l<t.length&&In(t.charCodeAt(l))===n;)l++;return l}o(Fo,"findChunkEnd");function ac(t,e,n,l,r,s){let a=n-e,u=s-r,c=a<u?a:u;for(let i=0;i<c;i++){let d=t.charCodeAt(e+i),m=l.charCodeAt(r+i);if(d>m)return 1;if(m>d)return-1}return a>u?1:u>a?-1:0}o(ac,"compareStringChunks");function ic(t,e,n,l,r,s){let a=e;for(;a<n&&t.charCodeAt(a)===48;)a++;let u=r;for(;u<s&&l.charCodeAt(u)===48;)u++;let c=n-a,i=s-u;if(c===0&&i===0)return 0;if(c<=15&&i<=15){let g=es(t,a,n),p=es(l,u,s);return g>p?1:p>g?-1:0}let d=parseInt(t.slice(e,n),10),m=parseInt(l.slice(r,s),10);return d>m?1:m>d?-1:0}o(ic,"compareNumericChunks");function es(t,e,n){let l=0;for(let r=e;r<n;r++)l=l*10+t.charCodeAt(r)-48;return l}o(es,"parseSmallInt");function ts(t,e){let n=0,l=e;for(;l<t.length;)n++,l=Fo(t,l,In(t.charCodeAt(l)));return n}o(ts,"countRemainingChunks");function os(){return[]}o(os,"getDefaultCellSelectionState");function cc(t,e){Ve(t,"cellSelection",e?os():ie(t.initialState.cellSelection)??os())}o(cc,"table_resetCellSelection");function rs(t){t.atoms.cellSelection&&(t.options.autoResetAll??t.options.autoResetCellSelection??!0)&&t._reactivity.schedule(()=>cc(t))}o(rs,"table_autoResetCellSelection");function ls(t){t.atoms.expanded&&(t.options.autoResetAll??t.options.autoResetExpanded??!t.options.manualExpanding)&&t._reactivity.schedule(()=>uc(t))}o(ls,"table_autoResetExpanded");function uc(t,e){let n=t.initialState.expanded;Ve(t,"expanded",e?$():n===!0?!0:Object.assign($(),ie(n??{})))}o(uc,"table_resetExpanded");var Mn=0;function Pn(t){if(t.options.autoResetAll??t.options.autoResetPageIndex??!t.options.manualPagination){if((t.atoms.pagination?.get()?.pageIndex??Mn)===Mn)return;gc(t,!0)}}o(Pn,"table_autoResetPageIndex");function dc(t,e){Ve(t,"pagination",e)}o(dc,"table_setPagination");function mc(t,e){dc(t,n=>{let l=yt(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(mc,"table_setPageIndex");function gc(t,e){mc(t,e?Mn:t.initialState.pagination?.pageIndex??Mn)}o(gc,"table_resetPageIndex");function ss(){return[]}o(ss,"getDefaultSortingState");function Qt(t,e){Ve(t,"sorting",e)}o(Qt,"table_setSorting");function To(t,e){Qt(t,e?[]:ie(t.initialState.sorting??[]))}o(To,"table_resetSorting");function as(t){t.atoms.sorting&&(t.options.autoResetAll??t.options.autoResetSorting??!1)&&To(t)}o(as,"table_autoResetSorting");function Ao(t){let e=t.table._rowModelFns.sortFns,n=t.table.getFilteredRowModel().flatRows.slice(0,10),l,r=!1;for(let s=0;s<n.length;s++){let a=n[s].getValue(t.id);if(Object.prototype.toString.call(a)==="[object Date]"){l="datetime";break}if(typeof a=="string"&&(r=!0,a.split(Mo).length>1)){l="alphanumeric";break}}if(!l&&r&&(l="text"),l){let s=e?.[l];if(s||l==="alphanumeric"&&(s=e?.text),s)return s}return It}o(Ao,"column_getAutoSortFn");function Oo(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(Oo,"column_getAutoSortDir");function Nn(t){let e=t.table._rowModelFns.sortFns;return cl(t.columnDef.sortFn)?t.columnDef.sortFn:t.columnDef.sortFn==="auto"?Ao(t):e?.[t.columnDef.sortFn]??It}o(Nn,"column_getSortFn");function Eo(t,e,n){let l=zo(t,n&&Wt(t)),r=typeof e<"u";Qt(t.table,s=>{let a=s.findIndex(g=>g.id===t.id),u=a===-1?void 0:s[a],c=[],i,d=r?e:l==="desc",m=!!(s.length&&Wt(t)&&n);return m?u?i="toggle":i="add":u?i="toggle":i="replace",i==="toggle"&&(r||l||(i="remove")),i==="add"?(c=[...s,{id:t.id,desc:d}],c.splice(0,c.length-(t.table.options.maxMultiSortColCount??Number.MAX_SAFE_INTEGER))):i==="toggle"?c=m?s.map(g=>g.id===t.id?{...g,desc:d}:g):[{id:t.id,desc:d}]:i==="remove"?c=m?s.filter(g=>g.id!==t.id):[]:c=[{id:t.id,desc:d}],c})}o(Eo,"column_toggleSorting");function Vo(t){return t.columnDef.sortDescFirst??t.table.options.sortDescFirst??Oo(t)==="desc"?"desc":"asc"}o(Vo,"column_getFirstSortDir");function zo(t,e){let n=Vo(t),l=$o(t);return l?l!==n&&(t.table.options.enableSortingRemoval??!0)&&(!e||(t.table.options.enableMultiRemove??!0))?!1:l==="desc"?"asc":"desc":n}o(zo,"column_getNextSortingOrder");function Xt(t){return(t.columnDef.enableSorting??!0)&&(t.table.options.enableSorting??!0)&&!!t.accessorFn}o(Xt,"column_getCanSort");function Wt(t){return t.columnDef.enableMultiSort??t.table.options.enableMultiSort??!!t.accessorFn}o(Wt,"column_getCanMultiSort");function $o(t){let e=t.table.atoms.sorting?.get()?.find(n=>n.id===t.id);return e?e.desc?"desc":"asc":!1}o($o,"column_getIsSorted");function is(t){return t.table.atoms.sorting?.get()?.findIndex(e=>e.id===t.id)??-1}o(is,"column_getSortIndex");function cs(t){Qt(t.table,e=>e.length?e.filter(n=>n.id!==t.id):[])}o(cs,"column_clearSorting");function us(t){let e=Xt(t);return n=>{e&&Eo(t,void 0,Wt(t)?t.table.options.isMultiSortEvent?.(n):!1)}}o(us,"column_getToggleSortingHandler");function ds(){return t=>Rt({feature:"coreRowModelsFeature",table:t,fnName:"table.getCoreRowModel",memoDeps:o(()=>[t.options.data],"memoDeps"),fn:o(()=>fc(t,t.options.data),"fn"),onAfterUpdate:yn(()=>{ls(t),Pn(t),as(t),rs(t)})})}o(ds,"createCoreRowModel");function ms(t,e,n,l=0,r){let s=[];for(let a=0;a<n.length;a++){let u=n[a],c=Zl(t,t.getRowId(u,a,r),u,a,l,void 0,r?.id);e.flatRows.push(c),e.rowsById[c.id]=c,s.push(c),t.options.getSubRows&&(c.originalSubRows=t.options.getSubRows(u,a),c.originalSubRows?.length&&(c.subRows=ms(t,e,c.originalSubRows,l+1,c)))}return s}o(ms,"accessRows");function fc(t,e){let n={rows:[],flatRows:[],rowsById:$()};return n.rows=ms(t,n,e),n}o(fc,"_createCoreRowModel");function gs(t){return t._rowModels.coreRowModel||(t._rowModels.coreRowModel=t.options.features.coreRowModel?.(t)??ds()(t)),t._rowModels.coreRowModel()}o(gs,"table_getCoreRowModel");function fs(t){return t.getCoreRowModel()}o(fs,"table_getPreFilteredRowModel");function ps(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(ps,"table_getFilteredRowModel");function bs(t){return t.getFilteredRowModel()}o(bs,"table_getPreGroupedRowModel");function hs(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(hs,"table_getGroupedRowModel");function ws(t){return t.getGroupedRowModel()}o(ws,"table_getPreSortedRowModel");function xs(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(xs,"table_getSortedRowModel");function Ss(t){return t.getSortedRowModel()}o(Ss,"table_getPreExpandedRowModel");function _s(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(_s,"table_getExpandedRowModel");function Cs(t){return t.getExpandedRowModel()}o(Cs,"table_getPrePaginatedRowModel");function vs(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(vs,"table_getPaginatedRowModel");function ys(t){return t.getPaginatedRowModel()}o(ys,"table_getRowModel");var Rs={constructTableAPIs:o(t=>{ge("coreRowModelsFeature",t,{table_getCoreRowModel:{fn:o(()=>gs(t),"fn")},table_getPreFilteredRowModel:{fn:o(()=>fs(t),"fn")},table_getFilteredRowModel:{fn:o(()=>ps(t),"fn")},table_getPreGroupedRowModel:{fn:o(()=>bs(t),"fn")},table_getGroupedRowModel:{fn:o(()=>hs(t),"fn")},table_getPreSortedRowModel:{fn:o(()=>ws(t),"fn")},table_getSortedRowModel:{fn:o(()=>xs(t),"fn")},table_getPreExpandedRowModel:{fn:o(()=>Ss(t),"fn")},table_getExpandedRowModel:{fn:o(()=>_s(t),"fn")},table_getPrePaginatedRowModel:{fn:o(()=>Cs(t),"fn")},table_getPaginatedRowModel:{fn:o(()=>vs(t),"fn")},table_getRowModel:{fn:o(()=>ys(t),"fn")}})},"constructTableAPIs")};function pc(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(pc,"getCellPrototype");function Is(t,e,n){let l=pc(n),r=Object.create(l);r.column=t,r.id=`${e.id}_${t.id}`,r.row=e;let s=n._cellInstanceInitFns;for(let a=0;a<s.length;a++)s[a](r);return r}o(Is,"constructCell");function Fs(t){let e=t.table.getRowsInDisplayOrder(),n=t._displayIndexCache;return e[n]===t?n:-1}o(Fs,"row_getDisplayIndex");function Ms(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(Ms,"table_getRowsInDisplayOrder");function Ps(t,e){if(He(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(Ps,"row_getValue");function Ns(t,e){if(He(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(Ns,"row_getUniqueValues");function ks(t,e){return t.getValue(e)??t.table.options.renderFallbackValue}o(ks,"row_renderValue");function Ds(t){return ul(t.subRows,e=>e.subRows)}o(Ds,"row_getLeafRows");function Ts(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(Ts,"table_getMaxSubRowDepth");function As(t){if(t.parentId)return t.table.getCoreRowModel().rowsById[t.parentId]??t.table.getRow(t.parentId,!0)}o(As,"row_getParentRow");function Os(t){let e=[],n=t;for(;;){let l=n.getParentRow();if(!l)break;e.push(l),n=l}return e.reverse()}o(Os,"row_getParentRows");function Es(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 s=e[r],a=n.get(s);a||(a=Is(s,t,t.table),n.set(s,a)),l[r]=a}return l}o(Es,"row_getAllCells");function Vs(t){let e=$(),n=t.getAllCells();for(let l=0;l<n.length;l++){let r=n[l];e[r.column.id]=r}return e}o(Vs,"row_getAllCellsByColumnId");function zs(t,e,n,l){return e.options.getRowId?.(t,n,l)??(l?`${l.id}.${n}`:String(n))}o(zs,"table_getRowId");function $s(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($s,"table_getRow");var Hs={assignRowPrototype:o((t,e)=>{de("coreRowsFeature",t,e,{row_getDisplayIndex:{fn:o(n=>Fs(n),"fn")},row_getAllCellsByColumnId:{fn:o(n=>Vs(n),"fn"),memoDeps:o(n=>[n.getAllCells()],"memoDeps")},row_getAllCells:{fn:o(n=>Es(n),"fn"),memoDeps:o(n=>[n.table.getAllLeafColumns()],"memoDeps")},row_getLeafRows:{fn:o(n=>Ds(n),"fn"),memoDeps:o(n=>[n.subRows],"memoDeps")},row_getParentRow:{fn:o(n=>As(n),"fn")},row_getParentRows:{fn:o(n=>Os(n),"fn")},row_getUniqueValues:{fn:o((n,l)=>Ns(n,l),"fn")},row_getValue:{fn:o((n,l)=>Ps(n,l),"fn")},row_renderValue:{fn:o((n,l)=>ks(n,l),"fn")}})},"assignRowPrototype"),constructTableAPIs:o(t=>{ge("coreRowsFeature",t,{table_getRowsInDisplayOrder:{fn:o(()=>Ms(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)=>zs(e,t,n,l),"fn")},table_getRow:{fn:o((e,n)=>$s(t,e,n),"fn")},table_getMaxSubRowDepth:{fn:o(()=>Ts(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 s=t.baseAtoms[r];if(!s)continue;let a=l[r],u=a===void 0?t.initialState[r]:a;n(t._reactivity.untrack(()=>s.get()),u)||s.set(()=>u)}})}o(kn,"table_syncExternalStateToBaseAtoms");function Dn(t,e,n=(l,r)=>l===r){t._reactivity.batch(()=>{kn(t,e,n),t._reactivity.commit?.()})}o(Dn,"table_publishExternalState");function Ho(t){let e=ie(t.initialState);t._reactivity.batch(()=>{let l=Object.keys(e);for(let r=0;r<l.length;r++){let s=l[r];t.baseAtoms[s].set(e[s])}});let n=Object.values(t._features);for(let l=0;l<n.length;l++)n[l].resetTableInstanceData?.(t)}o(Ho,"table_reset");function Ls(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 s=t.options.mergeOptions(t.options,e),a={...Object.getOwnPropertyDescriptors(s)};return Object.defineProperties(Object.create(Object.getPrototypeOf(s)),{...a,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(Ls,"table_mergeOptions");function Yt(t,e,n){let l=Ls(t,yt(e,t.options));t.optionsStore?t.optionsStore.set(()=>l):t.options=l,n?.syncExternalState!==!1&&Dn(t,l.state??null)}o(Yt,"table_setOptions");var js={constructTableAPIs:o(t=>{ge("coreTablesFeature",t,{table_reset:{fn:o(()=>Ho(t),"fn")},table_setOptions:{fn:o(e=>Yt(t,e),"fn")}})},"constructTableAPIs")};var Bs={coreCellsFeature:pl,coreColumnsFeature:Gl,coreHeadersFeature:Yl,coreRowModelsFeature:Rs,coreRowsFeature:Hs,coreTablesFeature:js};function Gs(t,e={}){return Object.values(t).forEach(n=>{e=n.getInitialState?.(e)??e}),ie(e)}o(Gs,"getInitialTableState");function Lo(t){let e=t.features.coreReactivityFeature,{aggregationFns:n,columnMeta:l,coreRowModel:r,expandedRowModel:s,facetedMinMaxValues:a,facetedRowModel:u,facetedUniqueValues:c,filterFns:i,filterMeta:d,filteredRowModel:m,groupedRowModel:g,paginatedRowModel:p,sortFns:f,sortedRowModel:h,tableMeta:w,..._}=t.features,x={_cellInstanceInitFns:[],_columnInstanceInitFns:[],_features:{...Bs,..._},_headerGroupInstanceInitFns:[],_headerInstanceInitFns:[],_reactivity:e,_rowInstanceInitFns:[],_rowModelFns:{aggregationFns:n,filterFns:i,sortFns:f},_rowModels:{},atoms:{},baseAtoms:{}},y=Object.values(x._features),v={...y.reduce((R,S)=>Object.assign(R,S.getDefaultTableOptions?.(x)),{}),...t};if(e.wrapExternalAtoms&&v.atoms)for(let[R,S]of Object.entries(v.atoms)){let I=S,F=e.createWritableAtom(I.get(),{debugName:`externalAtom/${R}`});v.atoms[R]=F;let M=!1,P=I.subscribe(k=>{M||F.set(k)}),N=F.subscribe(k=>{M=!0,I.set(k),M=!1});e.addSubscription(P),e.addSubscription(N)}e.createOptionsStore?(x.optionsStore=e.createWritableAtom(v,{debugName:"table/optionsStore"}),Object.defineProperty(x,"options",{configurable:!0,enumerable:!0,get(){return x.optionsStore.get()},set(R){x.optionsStore.set(()=>R)}})):x.options=v,x.initialState=Gs(x._features,x.options.initialState);let C=Object.keys(x.initialState);for(let R=0;R<C.length;R++){let S=C[R];x.baseAtoms[S]=e.createWritableAtom(x.initialState[S],{debugName:`table/baseAtoms/${S}`}),x.atoms[S]=e.createReadonlyAtom(()=>{let I=x.options,F=I.atoms?.[S],M=F?F.get():x.baseAtoms[S].get();if(F)return M;let P=I.state;if(P&&He(P,S)){let N=P[S];return N===void 0?x.initialState[S]:N}return M},{debugName:`table/atoms/${S}`})}kn(x),x.store=rl(e.createReadonlyAtom(()=>{let R={};for(let S=0;S<C.length;S++){let I=C[S];R[I]=x.atoms[I].get()}return R},{compare:lt,debugName:"table/store"}));for(let R=0;R<y.length;R++){let S=y[R];S.initTableInstanceData?.(x),S.initCellInstanceData&&x._cellInstanceInitFns.push(S.initCellInstanceData.bind(S)),S.initColumnInstanceData&&x._columnInstanceInitFns.push(S.initColumnInstanceData.bind(S)),S.initHeaderGroupInstanceData&&x._headerGroupInstanceInitFns.push(S.initHeaderGroupInstanceData.bind(S)),S.initHeaderInstanceData&&x._headerInstanceInitFns.push(S.initHeaderInstanceData.bind(S)),S.initRowInstanceData&&x._rowInstanceInitFns.push(S.initRowInstanceData.bind(S)),S.constructTableAPIs?.(x)}return x}o(Lo,"constructTable");var jo={getInitialState:o(t=>({columnOrder:Pl(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({onColumnOrderChange:Le("columnOrder",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{de("columnOrderingFeature",t,e,{column_getIndex:{fn:o((n,l)=>Nl(n,l),"fn")},column_getIsFirstColumn:{fn:o((n,l)=>kl(n,l),"fn")},column_getIsLastColumn:{fn:o((n,l)=>Dl(n,l),"fn")}})},"assignColumnPrototype"),constructTableAPIs:o(t=>{ge("columnOrderingFeature",t,{table_getColumnIndexes:{fn:o(()=>Ro(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=>Io(t,e),"fn")},table_resetColumnOrder:{fn:o(e=>Tl(t,e),"fn")},table_getOrderColumnsFn:{fn:o(()=>Ut(t),"fn"),memoDeps:o(()=>[t.atoms.columnOrder?.get(),t.atoms.grouping?.get(),t.options.groupedColumnMode],"memoDeps")}})},"constructTableAPIs")};function qs(){return $()}o(qs,"getDefaultColumnSizingState");function Bo(){return{size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER}}o(Bo,"getDefaultColumnSizingColumnDef");function Ft(t){let e=Bo(),n=t.table.atoms.columnSizing?.get(),l=n&&He(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(Ft,"column_getSize");function Tn(t){let e=$(),n=$(),l=new Array(t.length),r=0;for(let a=0;a<t.length;a++){let u=t[a],c=V(u,"getSize",Ft);l[a]=c,e[u.id]=r,r+=c}let s=0;for(let a=t.length-1;a>=0;a--)n[t[a].id]=s,s+=l[a];return{starts:e,afters:n}}o(Tn,"buildColumnOffsets");function An(t){return{all:Tn(je(t)),center:Tn(je(t,"center")),start:Tn(je(t,"start")),end:Tn(je(t,"end"))}}o(An,"table_getColumnOffsets");function Ks(t){return t==="start"?"start":t==="end"?"end":t==="center"?"center":"all"}o(Ks,"toOffsetsKey");function Js(t,e){return V(t.table,"getColumnOffsets",An)[Ks(e)].starts[t.id]??0}o(Js,"column_getStart");function Us(t,e){return V(t.table,"getColumnOffsets",An)[Ks(e)].afters[t.id]??0}o(Us,"column_getAfter");function Ws(t){Mt(t.table,e=>{let n=$(),l=Object.keys(e);for(let r=0;r<l.length;r++){let s=l[r];s!==t.id&&(n[s]=e[s])}return n})}o(Ws,"column_resetSize");function Qs(t){if(!t.subHeaders.length)return Ft(t.column);let e=0;for(let n=0;n<t.subHeaders.length;n++)e+=Qs(t.subHeaders[n]);return e}o(Qs,"sumHeaderSize");function st(t){return Qs(t)}o(st,"header_getSize");function Go(t){if(t.index>0){let e=t.headerGroup?.headers[t.index-1];if(e)return V(e,"getStart",Go)+V(e,"getSize",st)}return 0}o(Go,"header_getStart");function Mt(t,e){t.options.onColumnSizingChange?.(e)}o(Mt,"table_setColumnSizing");function Xs(t,e){Mt(t,e?$():Object.assign($(),ie(t.initialState.columnSizing??{})))}o(Xs,"table_resetColumnSizing");function Ys(t){return t.getHeaderGroups()[0]?.headers.reduce((e,n)=>e+st(n),0)??0}o(Ys,"table_getTotalSize");function Zs(t){return V(t,"getStartHeaderGroups",bl)[0]?.headers.reduce((e,n)=>e+st(n),0)??0}o(Zs,"table_getStartTotalSize");function ea(t){return V(t,"getCenterHeaderGroups",wl)[0]?.headers.reduce((e,n)=>e+st(n),0)??0}o(ea,"table_getCenterTotalSize");function ta(t){return V(t,"getEndHeaderGroups",hl)[0]?.headers.reduce((e,n)=>e+st(n),0)??0}o(ta,"table_getEndTotalSize");function En(){return{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}}o(En,"getDefaultColumnResizingState");function Ko(t){return(t.columnDef.enableResizing??!0)&&(t.table.options.enableColumnResizing??!0)}o(Ko,"column_getCanResize");function na(t){return t.table.atoms.columnResizing?.get()?.isResizingColumn===t.id}o(na,"column_getIsResizing");function oa(t,e){let n=t.table.getColumn(t.column.id),l=Ko(n);return r=>{if(!l||qo(r)&&r.touches.length>1)return;let s=st(t),a=t.getLeafHeaders().map(C=>[C.column.id,Ft(C.column)]),u=qo(r)?Math.round(r.touches[0].clientX):r.clientX,c=$(),i=o((C,R)=>{if(typeof R!="number")return;let S=n.table,I=S.options.columnResizeMode==="onChange"||C==="end";S._reactivity.batch(()=>{Pt(S,F=>{let M=S.options.columnResizeDirection==="rtl"?-1:1,P=(R-(F.startOffset??0))*M,N=F.startSize??0,k=Math.max(N>0?P/N:0,-.999999);if(I){let T=F.columnSizingStart;for(let O=0;O<T.length;O++){let A=T[O],H=A[1];c[A[0]]=Math.round(Math.max(H>0?H+H*k:P/T.length,0)*100)/100}}return{...F,deltaOffset:P,deltaPercentage:k}}),I&&Mt(S,F=>Object.assign($(),F,c))})},"updateOffset"),d=null,m=!1,g,p=o(()=>{m?(m=!1,i("move",g),d=requestAnimationFrame(p)):d=null},"flushMove"),f=o(C=>{if(g=C,typeof requestAnimationFrame!="function"){i("move",C);return}if(d!==null){m=!0;return}i("move",C),d=requestAnimationFrame(p)},"onMove"),h=o(C=>{d!==null&&(cancelAnimationFrame(d),d=null,m=!1),n.table._reactivity.batch(()=>{i("end",C??g),Pt(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=>f(C.clientX),"moveHandler"),upHandler:o(C=>{w?.removeEventListener("mousemove",_.moveHandler),w?.removeEventListener("mouseup",_.upHandler),h(C.clientX)},"upHandler")},x={moveHandler:o(C=>(C.cancelable&&(C.preventDefault(),C.stopPropagation()),f(C.touches[0].clientX),!1),"moveHandler"),upHandler:o(C=>{y(),C.cancelable&&(C.preventDefault(),C.stopPropagation()),h(C.touches[0]?.clientX)},"upHandler"),cancelHandler:o(()=>{y(),h()},"cancelHandler")},y=o(()=>{w?.removeEventListener("touchmove",x.moveHandler),w?.removeEventListener("touchend",x.upHandler),w?.removeEventListener("touchcancel",x.cancelHandler)},"removeTouchEvents"),v=bc()?{passive:!1}:!1;qo(r)?(w?.addEventListener("touchmove",x.moveHandler,v),w?.addEventListener("touchend",x.upHandler,v),w?.addEventListener("touchcancel",x.cancelHandler,v)):(w?.addEventListener("mousemove",_.moveHandler,v),w?.addEventListener("mouseup",_.upHandler,v)),Pt(n.table,C=>({...C,startOffset:u,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,isResizingColumn:n.id}))}}o(oa,"header_getResizeHandler");function Pt(t,e){t.options.onColumnResizingChange?.(e)}o(Pt,"table_setColumnResizing");function ra(t,e){Pt(t,e?En():ie(t.initialState.columnResizing??En()))}o(ra,"table_resetHeaderSizeInfo");var On=null;function bc(){if(typeof On=="boolean")return On;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 On=t,On}o(bc,"passiveEventSupported");function qo(t){return t.type==="touchstart"}o(qo,"isTouchStartEvent");var Jo={getInitialState:o(t=>({columnResizing:En(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnResizingChange:Le("columnResizing",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{de("columnResizingFeature",t,e,{column_getCanResize:{fn:o(n=>Ko(n),"fn")},column_getIsResizing:{fn:o(n=>na(n),"fn")}})},"assignColumnPrototype"),assignHeaderPrototype:o((t,e)=>{de("columnResizingFeature",t,e,{header_getResizeHandler:{fn:o((n,l)=>oa(n,l),"fn")}})},"assignHeaderPrototype"),constructTableAPIs:o(t=>{ge("columnResizingFeature",t,{table_setColumnResizing:{fn:o(e=>Pt(t,e),"fn")},table_resetHeaderSizeInfo:{fn:o(e=>ra(t,e),"fn")}})},"constructTableAPIs")};var Uo={getInitialState:o(t=>({columnSizing:qs(),...t}),"getInitialState"),getDefaultColumnDef:o(()=>Bo(),"getDefaultColumnDef"),getDefaultTableOptions:o(t=>({onColumnSizingChange:Le("columnSizing",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{de("columnSizingFeature",t,e,{column_getSize:{fn:o(n=>Ft(n),"fn"),memoDeps:o(n=>[e.options.columns,e.atoms.columnSizing?.get()?.[n.id]],"memoDeps")},column_getStart:{fn:o((n,l)=>Js(n,l),"fn")},column_getAfter:{fn:o((n,l)=>Us(n,l),"fn")},column_resetSize:{fn:o(n=>Ws(n),"fn")}})},"assignColumnPrototype"),assignHeaderPrototype:o((t,e)=>{de("columnSizingFeature",t,e,{header_getSize:{fn:o(n=>st(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=>Go(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=>{ge("columnSizingFeature",t,{table_getColumnOffsets:{fn:o(()=>An(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=>Mt(t,e),"fn")},table_resetColumnSizing:{fn:o(e=>Xs(t,e),"fn")},table_getTotalSize:{fn:o(()=>Ys(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")},table_getStartTotalSize:{fn:o(()=>Zs(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")},table_getCenterTotalSize:{fn:o(()=>ea(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")},table_getEndTotalSize:{fn:o(()=>ta(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")}})},"constructTableAPIs")};var Wo={getInitialState:o(t=>({columnVisibility:xl(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({onColumnVisibilityChange:Le("columnVisibility",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{de("columnVisibilityFeature",t,e,{column_getIsVisible:{fn:o(n=>me(n),"fn"),memoDeps:o(n=>[e.options.columns,e.atoms.columnVisibility?.get(),n.columns],"memoDeps")},column_getCanHide:{fn:o(n=>Kt(n),"fn")},column_getToggleVisibilityHandler:{fn:o(n=>Sl(n),"fn")},column_toggleVisibility:{fn:o((n,l)=>Co(n,l),"fn")}})},"assignColumnPrototype"),assignRowPrototype:o((t,e)=>{de("columnVisibilityFeature",t,e,{row_getVisibleCells:{fn:o(n=>_o(n),"fn"),memoDeps:o(n=>[n.getAllCells(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get()],"memoDeps")},row_getVisibleCellsByColumnId:{fn:o(n=>Rn(n),"fn"),memoDeps:o(n=>[n.getAllCells(),e.atoms.columnVisibility?.get()],"memoDeps")}})},"assignRowPrototype"),constructTableAPIs:o(t=>{ge("columnVisibilityFeature",t,{table_getVisibleFlatColumns:{fn:o(()=>_l(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(()=>xt(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=>Jt(t,e),"fn")},table_resetColumnVisibility:{fn:o(e=>Cl(t,e),"fn")},table_toggleAllColumnsVisible:{fn:o(e=>vo(t,e),"fn")},table_getIsAllColumnsVisible:{fn:o(()=>yo(t),"fn")},table_getIsSomeColumnsVisible:{fn:o(()=>vl(t),"fn")},table_getToggleAllColumnsVisibilityHandler:{fn:o(()=>yl(t),"fn")}})},"constructTableAPIs")};function la(){return $()}o(la,"getDefaultRowSelectionState");function Ct(t,e){t.options.onRowSelectionChange?.(e)}o(Ct,"table_setRowSelection");function sa(t,e){t._lastSelectedRowId=null,Ct(t,e?$():Object.assign($(),ie(t.initialState.rowSelection??{})))}o(sa,"table_resetRowSelection");function Qo(t,e,n){t._lastSelectedRowId=null,Ct(t,l=>{if(e=typeof e<"u"?e:!V(t,"getIsAllRowsSelected",Zo),n?.deselectAll&&!e)return $();let r=Object.assign($(),l),s=t.getPreGroupedRowModel().flatRows;if(e){let a=new Map;s.forEach(u=>{Vn(u,a)&&(r[u.id]=!0)})}else s.forEach(a=>{Ue(a)&&delete r[a.id]});return r})}o(Qo,"table_toggleAllRowsSelected");function Xo(t,e,n){t._lastSelectedRowId=null,Ct(t,l=>{let r=typeof e<"u"?e:!V(t,"getIsAllPageRowsSelected",er);if(n?.deselectAll&&!r)return $();let s=Object.assign($(),l);return t.getRowModel().rows.forEach(a=>{Hn(s,a.id,r,!0,t,!0)}),s})}o(Xo,"table_toggleAllPageRowsSelected");function aa(t){return t.getCoreRowModel()}o(aa,"table_getPreSelectedRowModel");function ia(t){let e=t.getCoreRowModel();return V(t,"getIsSomeRowsSelected",Zt)?or(e,t):{rows:[],flatRows:[],rowsById:$()}}o(ia,"table_getSelectedRowModel");function ca(t){let e=t.getFilteredRowModel();return V(t,"getIsSomeRowsSelected",Zt)?or(e,t):{rows:[],flatRows:[],rowsById:$()}}o(ca,"table_getFilteredSelectedRowModel");function ua(t){let e=t.getSortedRowModel();return V(t,"getIsSomeRowsSelected",Zt)?or(e,t):{rows:[],flatRows:[],rowsById:$()}}o(ua,"table_getGroupedSelectedRowModel");function Yo(t){return Object.keys(t.atoms.rowSelection?.get()??{})}o(Yo,"table_getSelectedRowIds");function Zo(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(s=>!en(s,n)&&Vn(s,r))&&(l=!1)}return l}o(Zo,"table_getIsAllRowsSelected");function er(t){let e=t.getPaginatedRowModel().flatRows,n=t.atoms.rowSelection?.get()??{},l=new Map,r=!1;for(let s=0;s<e.length;s++){let a=e[s];if(en(a,n))!r&&Vn(a,l)&&(r=!0);else if(Vn(a,l))return!1}return r}o(er,"table_getIsAllPageRowsSelected");function Zt(t){return V(t,"getSelectedRowIds",Yo).length>0}o(Zt,"table_getIsSomeRowsSelected");function da(t){return t.getPaginatedRowModel().flatRows.filter(e=>Ue(e)).some(e=>zn(e)||V(e,"getIsSomeSelected",nr))}o(da,"table_getIsSomePageRowsSelected");function ma(t){return e=>{Qo(t,e.target.checked)}}o(ma,"table_getToggleAllRowsSelectedHandler");function ga(t){return e=>{Xo(t,e.target.checked)}}o(ga,"table_getToggleAllPageRowsSelectedHandler");function tr(t,e,n){let l=zn(t);Ct(t.table,r=>{e=typeof e<"u"?e:!l;let s=Object.assign($(),r);return Hn(s,t.id,e,(n?.selectChildren??!0)&&mt(t),t.table),!e&&n?.deselectParents&&ba(s,t),s})}o(tr,"row_toggleSelected");function zn(t){return en(t,t.table.atoms.rowSelection?.get()??{})}o(zn,"row_getIsSelected");function nr(t){return rr(t)==="some"}o(nr,"row_getIsSomeSelected");function fa(t){return rr(t)==="all"}o(fa,"row_getIsAllSubRowsSelected");function Ue(t){let e=t.table.options;return typeof e.enableRowSelection=="function"?e.enableRowSelection(t):e.enableRowSelection??!0}o(Ue,"row_getCanSelect");function $n(t){let e=t.table.options;return typeof e.enableSubRowSelection=="function"?e.enableSubRowSelection(t):e.enableSubRowSelection??!0}o($n,"row_getCanSelectSubRows");function mt(t){let e=t.table.options;return typeof e.enableMultiRowSelection=="function"?e.enableMultiRowSelection(t):e.enableMultiRowSelection??!0}o(mt,"row_getCanMultiSelect");function pa(t,e){let n=Ue(t);return l=>{if(!n)return;let r=l,s=t.table,a=r.target.checked,u=s._lastSelectedRowId;(!(s.options.enableRowRangeSelection!==!1&&u!==null&&mt(t)&&(s.options.isRowRangeSelectionEvent?.(l)??!1))||!hc(t,u,a,e))&&tr(t,a,e),s._lastSelectedRowId=t.id}}o(pa,"row_getToggleSelectedHandler");function hc(t,e,n,l){let r=l?.selectChildren??!0,s=t.table,a=s.getRowsInDisplayOrder(),u=s.getPrePaginatedRowModel().rowsById[e]??s.getCoreRowModel().rowsById[e];if(!u)return!1;let c=u.getDisplayIndex(),i=t.getDisplayIndex(),d=a[c],m=a[i];if(c<0||i<0||c>=a.length||i>=a.length||d?.id!==u.id||m?.id!==t.id||!mt(u)||!mt(t))return!1;let g=Math.min(c,i),p=Math.max(c,i);return Ct(s,f=>{let h=Object.assign($(),f);for(let w=g;w<=p;w++){let _=a[w];!Ue(_)||!mt(_)||(Hn(h,_.id,n,r,s),!n&&l?.deselectParents&&ba(h,_))}return h}),!0}o(hc,"selectRowRange");function Hn(t,e,n,l,r,s){let a=r.getRow(e,!0);n?(mt(a)||Object.keys(t).forEach(u=>delete t[u]),Ue(a)&&(t[e]=!0)):(!s||Ue(a))&&delete t[e],l&&a.subRows.length&&$n(a)&&a.subRows.forEach(u=>Hn(t,u.id,n,l,r,s))}o(Hn,"mutateRowIsSelected");function Vn(t,e){if(!Ue(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 s=n.getCoreRowModel().rowsById,a=[],u=!0,c=l;for(;c!==void 0;){let i=e.get(c);if(i!==void 0){u=i;break}a.push(c);let d=s[c]??n.getRow(c,!0);if(!$n(d)){u=!1;break}c=d.parentId}return a.forEach(i=>e.set(i,u)),u}o(Vn,"isRowSelectableInSelectAll");function ba(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(ba,"pruneAncestorRowIds");function ha(t,e,n,l){let r=[];for(let s=0;s<t.length;s++){let a=t[s],u=en(a,e);if(u&&(n.push(a),l[a.id]=a),a.subRows.length){let c=ha(a.subRows,e,n,l);if(u){let i=Object.create(Object.getPrototypeOf(a));vn(i,a),i.subRows=c,r.push(i)}}else u&&r.push(a)}return r}o(ha,"selectRowsRecursively");function or(t,e){let n=[],l=$(),r=e.atoms.rowSelection?.get()??{};return{rows:ha(t.rows,r,n,l),flatRows:n,rowsById:l}}o(or,"selectRowsFn");function en(t,e){return!!(He(e,t.id)&&e[t.id])}o(en,"isRowSelected");function rr(t){if(!t.subRows.length)return!1;let e=t.table.atoms.rowSelection?.get()??{},n=!1,l=!0,r=!1;for(let s=0;s<t.subRows.length;s++){let a=t.subRows[s];if(n&&!l)break;if(Ue(a)&&(r=!0,en(a,e)?n=!0:l=!1),a.subRows.length){let u=rr(a);u==="all"?(n=!0,r=!0):u==="some"?(n=!0,l=!1,r=!0):l=!1}}return r?l?"all":n?"some":!1:!1}o(rr,"isSubRowSelected");var lr={initTableInstanceData:o(t=>{t._lastSelectedRowId=null},"initTableInstanceData"),resetTableInstanceData:o(t=>{t._lastSelectedRowId=null},"resetTableInstanceData"),getInitialState:o(t=>({rowSelection:la(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({onRowSelectionChange:Le("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)=>{de("rowSelectionFeature",t,e,{row_toggleSelected:{fn:o((n,l,r)=>tr(n,l,r),"fn")},row_getIsSelected:{fn:o(n=>zn(n),"fn")},row_getIsSomeSelected:{fn:o(n=>nr(n),"fn"),memoDeps:o(n=>[n.subRows,n.table.atoms.rowSelection?.get(),n.table.options.enableRowSelection],"memoDeps")},row_getIsAllSubRowsSelected:{fn:o(n=>fa(n),"fn"),memoDeps:o(n=>[n.subRows,n.table.atoms.rowSelection?.get(),n.table.options.enableRowSelection],"memoDeps")},row_getCanSelect:{fn:o(n=>Ue(n),"fn")},row_getCanSelectSubRows:{fn:o(n=>$n(n),"fn")},row_getCanMultiSelect:{fn:o(n=>mt(n),"fn")},row_getToggleSelectedHandler:{fn:o((n,l)=>pa(n,l),"fn")}})},"assignRowPrototype"),constructTableAPIs:o(t=>{ge("rowSelectionFeature",t,{table_setRowSelection:{fn:o(e=>Ct(t,e),"fn")},table_resetRowSelection:{fn:o(e=>sa(t,e),"fn")},table_toggleAllRowsSelected:{fn:o((e,n)=>Qo(t,e,n),"fn")},table_toggleAllPageRowsSelected:{fn:o((e,n)=>Xo(t,e,n),"fn")},table_getPreSelectedRowModel:{fn:o(()=>aa(t),"fn")},table_getSelectedRowModel:{fn:o(()=>ia(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getCoreRowModel()],"memoDeps")},table_getFilteredSelectedRowModel:{fn:o(()=>ca(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getFilteredRowModel()],"memoDeps")},table_getGroupedSelectedRowModel:{fn:o(()=>ua(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getSortedRowModel()],"memoDeps")},table_getSelectedRowIds:{fn:o(()=>Yo(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get()],"memoDeps")},table_getIsAllRowsSelected:{fn:o(()=>Zo(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getFilteredRowModel(),t.options.enableRowSelection,t.options.enableSubRowSelection],"memoDeps")},table_getIsAllPageRowsSelected:{fn:o(()=>er(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getPaginatedRowModel(),t.options.enableRowSelection,t.options.enableSubRowSelection],"memoDeps")},table_getIsSomeRowsSelected:{fn:o(()=>Zt(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get()],"memoDeps")},table_getIsSomePageRowsSelected:{fn:o(()=>da(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getPaginatedRowModel(),t.options.enableRowSelection],"memoDeps")},table_getToggleAllRowsSelectedHandler:{fn:o(()=>ma(t),"fn")},table_getToggleAllPageRowsSelectedHandler:{fn:o(()=>ga(t),"fn")}})},"constructTableAPIs")};var sr={getInitialState(t){return{sorting:ss(),...t}},getDefaultColumnDef(){return{sortFn:"auto",sortUndefined:1}},getDefaultTableOptions(t){return{autoResetSorting:!1,onSortingChange:Le("sorting",t),isMultiSortEvent:o(e=>e.shiftKey,"isMultiSortEvent")}},assignColumnPrototype(t,e){de("rowSortingFeature",t,e,{column_getAutoSortFn:{fn:o(n=>Ao(n),"fn")},column_getAutoSortDir:{fn:o(n=>Oo(n),"fn")},column_getSortFn:{fn:o(n=>Nn(n),"fn")},column_toggleSorting:{fn:o((n,l,r)=>Eo(n,l,r),"fn")},column_getFirstSortDir:{fn:o(n=>Vo(n),"fn")},column_getNextSortingOrder:{fn:o((n,l)=>zo(n,l),"fn")},column_getCanSort:{fn:o(n=>Xt(n),"fn")},column_getCanMultiSort:{fn:o(n=>Wt(n),"fn")},column_getIsSorted:{fn:o(n=>$o(n),"fn")},column_getSortIndex:{fn:o(n=>is(n),"fn")},column_clearSorting:{fn:o(n=>cs(n),"fn")},column_getToggleSortingHandler:{fn:o(n=>us(n),"fn")}})},constructTableAPIs(t){ge("rowSortingFeature",t,{table_setSorting:{fn:o(e=>Qt(t,e),"fn")},table_resetSorting:{fn:o(e=>To(t,e),"fn")}})}};function ar(){return t=>{let e=t;return Rt({feature:"rowSortingFeature",table:e,fnName:"table.getSortedRowModel",memoDeps:o(()=>[e.atoms.sorting?.get(),e.getPreSortedRowModel()],"memoDeps"),fn:o(()=>wc(e),"fn"),onAfterUpdate:yn(()=>Pn(e))})}}o(ar,"createSortedRowModel");function wc(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 i=t.getColumn(c.id);return i?Xt(i):!1});if(!r.length)return e;let s=[];for(let c=0;c<r.length;c++){let i=r[c],d=t.getColumn(i.id);d&&s.push({id:i.id,desc:i.desc,sortUndefined:d.columnDef.sortUndefined,invertSorting:d.columnDef.invertSorting,sortFn:Nn(d)})}let a=o((c,i)=>{for(let d=0;d<s.length;d++){let m=s[d],g=m.sortUndefined,p=m.desc,f=0;if(g){let h=c.getValue(m.id),w=i.getValue(m.id),_=h===void 0,x=w===void 0;if(_&&x)continue;if(_||x){if(g==="first")return _?-1:1;if(g==="last")return _?1:-1;f=_?g:-g}}if(f===0&&(f=m.sortFn(c,i,m.id)),f!==0)return p&&(f*=-1),m.invertSorting&&(f*=-1),f}return c.index-i.index},"compareRows"),u=o(c=>{let i=c.slice();i.sort(a);let d=!1;for(let m=0;m<i.length;m++){let g=i[m];g!==c[m]&&(d=!0);let p=l.length;if(l.push(g),g.subRows.length){let f=u(g.subRows);if(f.changed){let h=Object.create(Object.getPrototypeOf(g));vn(h,g),h.subRows=f.rows,i[m]=h,l[p]=h,d=!0}}}return{rows:i,changed:d}},"sortData");return{rows:u(e.rows).rows,flatRows:l,rowsById:e.rowsById}}o(wc,"_createSortedRowModel");var gt=Re(ut(),1);var xc=typeof window>"u"?gt.useEffect:gt.useLayoutEffect;function ir(t,e){let[{table:n,rootSource:l}]=(0,gt.useState)(()=>{let c=Lo({...t,features:{coreReactivityFeature:ll(),...t.features}});return c.Subscribe=(i=>ol({...i,source:i.source??c.store})),c.FlexRender=co,{table:c,rootSource:xo(c.store,lt)}}),r=n;Yt(r,c=>({...c,...t}),{syncExternalState:!1});let s=r.options.state,a=l.get(),u=qt(l,e,{compare:lt});return xc(()=>{l.markCommitted(a),Dn(r,s??null,lt)}),(0,gt.useMemo)(()=>({...n,options:t,state:u}),[n,t,u])}o(ir,"useTable");var wa=Re(Ht(),1),xa=Re(ut(),1),Ie=Re(Lt(),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"}],_c=o(t=>{let e=t.trim(),n=Number(e);return e!==""&&Number.isFinite(n)&&String(n)===e?n:t},"K"),We=o(t=>t.filter(e=>e.column!=="").map(e=>({column:e.column,operator:e.operator,value:e.operator==="contains"?e.value:_c(e.value)})),"I"),Sa=o(t=>{let e=(0,wa.c)(44),{columns:n,filters:l,onAskAi:r,onFiltersChange:s,onSearchChange:a,search:u}=t,[c,i]=(0,xa.useState)(""),d;e[0]!==n[0]||e[1]!==l||e[2]!==s?(d=o(()=>{s([...l,{column:n[0]??"",operator:"eq",value:""}])},"N"),e[0]=n[0],e[1]=l,e[2]=s,e[3]=d):d=e[3];let m=d,g;e[4]!==l||e[5]!==s?(g=o(M=>{let P=Number(M.currentTarget.dataset.index);s(l.filter((N,k)=>k!==P))},"T"),e[4]=l,e[5]=s,e[6]=g):g=e[6];let p=g,f;e[7]!==l||e[8]!==s?(f=o(M=>{let P=Number(M.currentTarget.dataset.index),N=M.currentTarget.value;s(l.map((k,T)=>T===P?{...k,column:N}:k))},"S"),e[7]=l,e[8]=s,e[9]=f):f=e[9];let h=f,w;e[10]!==l||e[11]!==s?(w=o(M=>{let P=Number(M.currentTarget.dataset.index),N=M.currentTarget.value;s(l.map((k,T)=>T===P?{...k,operator:N}:k))},"k"),e[10]=l,e[11]=s,e[12]=w):w=e[12];let _=w,x;e[13]!==l||e[14]!==s?(x=o(M=>{let P=Number(M.currentTarget.dataset.index),N=M.currentTarget.value;s(l.map((k,T)=>T===P?{...k,value:N}:k))},"w"),e[13]=l,e[14]=s,e[15]=x):x=e[15];let y=x,v;e[16]!==a||e[17]!==u?(v=(0,Ie.jsx)("input",{"aria-label":"Search rows","data-testid":"db-filter",onChange:a,placeholder:"search table\u2026",value:u}),e[16]=a,e[17]=u,e[18]=v):v=e[18];let C;e[19]!==m?(C=(0,Ie.jsx)("button",{"data-testid":"db-add-filter",onClick:m,type:"button",children:"Add filter"}),e[19]=m,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(M=>{i(M.target.value)},"onChange"),onKeyDown:o(M=>{M.key==="Enter"&&c.trim()!==""&&(M.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 S;e[24]!==v||e[25]!==C||e[26]!==R?(S=(0,Ie.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[v,C,R]}),e[24]=v,e[25]=C,e[26]=R,e[27]=S):S=e[27];let I;if(e[28]!==h||e[29]!==_||e[30]!==y||e[31]!==n||e[32]!==l||e[33]!==p){let M;e[35]!==h||e[36]!==_||e[37]!==y||e[38]!==n||e[39]!==p?(M=o((P,N)=>(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":N,"data-testid":"db-filter-column",onChange:h,value:P.column,children:n.map(Cc)}),(0,Ie.jsx)("select",{"aria-label":"Filter operator","data-index":N,"data-testid":"db-filter-operator",onChange:_,value:P.operator,children:Sc.map(vc)}),(0,Ie.jsx)("input",{"aria-label":"Filter value","data-index":N,"data-testid":"db-filter-value",onChange:y,placeholder:"value",value:P.value}),(0,Ie.jsx)("button",{"aria-label":"Remove filter","data-index":N,"data-testid":"db-filter-remove",onClick:p,type:"button",children:"\u2715"})]},N),"t"),e[35]=h,e[36]=_,e[37]=y,e[38]=n,e[39]=p,e[40]=M):M=e[40],I=l.map(M),e[28]=h,e[29]=_,e[30]=y,e[31]=n,e[32]=l,e[33]=p,e[34]=I}else I=e[34];let F;return e[41]!==I||e[42]!==S?(F=(0,Ie.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"db-filters",children:[S,I]}),e[41]=I,e[42]=S,e[43]=F):F=e[43],F},"J");function Cc(t){return(0,Ie.jsx)("option",{value:t,children:t},t)}o(Cc,"$");function vc(t){return(0,Ie.jsx)("option",{value:t.value,children:t.label},t.value)}o(vc,"z");var yc=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,references:l.ref,table:e}))}))}),"ho"),Rc=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 s=r.references,a=`${s}\0${l.name}\0${r.field}`;if(n.has(a))continue;n.add(a);let u=e.get(s)??[];u.push({...r,table:l.name}),e.set(s,u)}return e},"xo"),Ic=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 s of r.children)l.push(s)}return n},"vo"),_a=o((t,e)=>{let n=[];for(let[l,r]of Object.entries(e))for(let s of r)s.ref===t&&n.push({column:s.name,table:l});return n.sort((l,r)=>l.table.localeCompare(r.table)||l.column.localeCompare(r.column)),n},"Bt"),gr=o(t=>`${t.table}.${t.column}`,"Dt"),Fc=o(t=>{let e=(0,J.c)(111),{columns:n,onApply:l,onClose:r,shardKey:s,table:a,total:u,uniqueColumns:c}=t,i=ee(),[d,m]=(0,D.useState)(n[0]??""),[g,p]=(0,D.useState)(""),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=o(re=>{m(re.target.value)},"f"),e[0]=f):f=e[0];let h=f,w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w=o(re=>{p(re.target.value)},"h"),e[1]=w):w=e[1];let _=w,x;e[2]!==g?(x=g.trim(),e[2]=g,e[3]=x):x=e[3];let y=x==="",v,C;if(e[4]!==y||e[5]!==i||e[6]!==g){if(!y)try{C=un(JSON.parse(g))}catch(re){v=i("Invalid JSON: {message}",{message:re.message})}e[4]=y,e[5]=i,e[6]=g,e[7]=v,e[8]=C}else v=e[7],C=e[8];let R;e[9]!==d||e[10]!==u||e[11]!==c?(R=c.has(d)&&u>1,e[9]=d,e[10]=u,e[11]=c,e[12]=R):R=e[12];let S=R,I=d!==""&&!y&&v===void 0&&!S,F;e[13]!==I||e[14]!==d||e[15]!==l||e[16]!==r||e[17]!==C?(F=o(()=>{I&&(l({[d]:C}),r())},"k"),e[13]=I,e[14]=d,e[15]=l,e[16]=r,e[17]=C,e[18]=F):F=e[18];let M=F,P;e[19]!==i?(P=i("Set a column on matching rows"),e[19]=i,e[20]=P):P=e[20];let N;e[21]!==i?(N=i("Set a column on matching rows"),e[21]=i,e[22]=N):N=e[22];let k;e[23]!==N?(k=(0,b.jsx)("h3",{className:"text-base text-foreground","data-testid":"bulk-patch-title",children:N}),e[23]=N,e[24]=k):k=e[24];let T;e[25]!==i||e[26]!==a||e[27]!==u?(T=i("Writes {total} rows of {table} through the schema-aware writer \u2014 validators and indexes apply, exactly like a mutation.",{table:a,total:u.toString()}),e[25]=i,e[26]=a,e[27]=u,e[28]=T):T=e[28];let O;e[29]!==T?(O=(0,b.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-desc",children:T}),e[29]=T,e[30]=O):O=e[30];let A;e[31]!==s||e[32]!==i?(A=s===""?i("Shard: root"):i("Shard: {shardKey} \u2014 rows in other shards are not touched.",{shardKey:s}),e[31]=s,e[32]=i,e[33]=A):A=e[33];let H;e[34]!==A?(H=(0,b.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-shard",children:A}),e[34]=A,e[35]=H):H=e[35];let K;e[36]!==O||e[37]!==H||e[38]!==k?(K=(0,b.jsxs)("div",{className:"flex flex-col gap-0.5",children:[k,O,H]}),e[36]=O,e[37]=H,e[38]=k,e[39]=K):K=e[39];let z;e[40]!==i?(z=i("Close"),e[40]=i,e[41]=z):z=e[41];let q;e[42]!==r||e[43]!==z?(q=(0,b.jsx)(on,{"data-testid":"bulk-patch-close",onClick:r,size:"xs",variant:"ghost",children:z}),e[42]=r,e[43]=z,e[44]=q):q=e[44];let Y;e[45]!==K||e[46]!==q?(Y=(0,b.jsxs)("div",{className:"flex items-start justify-between",children:[K,q]}),e[45]=K,e[46]=q,e[47]=Y):Y=e[47];let U;e[48]!==i?(U=i("Column"),e[48]=i,e[49]=U):U=e[49];let ne;e[50]!==U?(ne=(0,b.jsx)(lo,{htmlFor:"bulk-patch-column",children:U}),e[50]=U,e[51]=ne):ne=e[51];let oe;e[52]!==i?(oe=i("Column"),e[52]=i,e[53]=oe):oe=e[53];let se;e[54]!==n?(se=n.map(Mc),e[54]=n,e[55]=se):se=e[55];let ve;e[56]!==d||e[57]!==oe||e[58]!==se?(ve=(0,b.jsx)("select",{"aria-label":oe,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:h,value:d,children:se}),e[56]=d,e[57]=oe,e[58]=se,e[59]=ve):ve=e[59];let ce;e[60]!==i?(ce=i("Value"),e[60]=i,e[61]=ce):ce=e[61];let he;e[62]!==ce?(he=(0,b.jsx)(lo,{htmlFor:"bulk-patch-value",children:ce}),e[62]=ce,e[63]=he):he=e[63];let we;e[64]!==g?(we=(0,b.jsx)(Cr,{className:"flex-1 font-mono","data-testid":"bulk-patch-value",id:"bulk-patch-value",onChange:_,placeholder:"true",value:g}),e[64]=g,e[65]=we):we=e[65];let ye;e[66]!==ne||e[67]!==ve||e[68]!==he||e[69]!==we?(ye=(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[ne,ve,he,we]}),e[66]=ne,e[67]=ve,e[68]=he,e[69]=we,e[70]=ye):ye=e[70];let fe;e[71]!==v?(fe=v!==void 0&&(0,b.jsx)("p",{className:"text-xs text-destructive","data-testid":"bulk-patch-error",role:"alert",children:v}),e[71]=v,e[72]=fe):fe=e[72];let xe;e[73]!==d||e[74]!==i||e[75]!==u||e[76]!==S?(xe=S&&(0,b.jsx)("p",{className:"text-xs text-destructive","data-testid":"bulk-patch-unique",role:"alert",children:i("{column} has a unique index \u2014 the same value cannot be set on {total} rows.",{column:d,total:u.toString()})}),e[73]=d,e[74]=i,e[75]=u,e[76]=S,e[77]=xe):xe=e[77];let L;e[78]!==y||e[79]!==i||e[80]!==S?(L=y&&!S&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-hint",children:i('Enter a JSON value \u2014 for example true, 0, null, or "done".')}),e[78]=y,e[79]=i,e[80]=S,e[81]=L):L=e[81];let Z;e[82]!==I||e[83]!==d||e[84]!==g?(Z=I&&(0,b.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"bulk-patch-preview",children:`${d} = ${g.trim()}`}),e[82]=I,e[83]=d,e[84]=g,e[85]=Z):Z=e[85];let ae;e[86]!==i?(ae=i("Cancel"),e[86]=i,e[87]=ae):ae=e[87];let pe;e[88]!==r||e[89]!==ae?(pe=(0,b.jsx)(on,{"data-testid":"bulk-patch-cancel",onClick:r,size:"xs",variant:"outline",children:ae}),e[88]=r,e[89]=ae,e[90]=pe):pe=e[90];let Me=!I,Se;e[91]!==i||e[92]!==u?(Se=i("Set on {total} rows",{total:u.toString()}),e[91]=i,e[92]=u,e[93]=Se):Se=e[93];let te;e[94]!==M||e[95]!==Me||e[96]!==Se?(te=(0,b.jsx)(on,{"data-testid":"bulk-patch-apply",disabled:Me,onClick:M,size:"xs",children:Se}),e[94]=M,e[95]=Me,e[96]=Se,e[97]=te):te=e[97];let W;e[98]!==pe||e[99]!==te?(W=(0,b.jsxs)("div",{className:"flex justify-end gap-2",children:[pe,te]}),e[98]=pe,e[99]=te,e[100]=W):W=e[100];let ke;return e[101]!==r||e[102]!==Y||e[103]!==ye||e[104]!==fe||e[105]!==xe||e[106]!==L||e[107]!==Z||e[108]!==W||e[109]!==P?(ke=(0,b.jsxs)(Bt,{label:P,onClose:r,panelTestId:"bulk-patch-panel",testId:"bulk-patch-overlay",variant:"dialog",children:[Y,ye,fe,xe,L,Z,W]}),e[101]=r,e[102]=Y,e[103]=ye,e[104]=fe,e[105]=xe,e[106]=L,e[107]=Z,e[108]=W,e[109]=P,e[110]=ke):ke=e[110],ke},"wo");function Mc(t){return(0,b.jsx)("option",{value:t,children:t},t)}o(Mc,"yo");var Ca=6,jn=100,Pc=o(t=>({paddingLeft:t*16}),"Co"),Nc=o(t=>{let e=(0,J.c)(2),{table:n}=t,l=`cascade-restrict-${n}`,r;return e[0]!==l?(r=(0,b.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},"No"),kc=o(t=>{let e=(0,J.c)(2),{table:n}=t,l=`cascade-cascade-${n}`,r;return e[0]!==l?(r=(0,b.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},"So"),Dc=o(t=>{let e=(0,J.c)(2),{table:n}=t,l=`cascade-undeclared-${n}`,r;return e[0]!==l?(r=(0,b.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},"ko"),Tc=o(t=>t.relation===void 0||t.relation.onDelete==="cascade"?(0,b.jsx)(kc,{table:t.table}):t.isRestrict?(0,b.jsx)(Nc,{table:t.table}):(0,b.jsx)(Dc,{table:t.table}),"To"),ka=o(t=>{let e=(0,J.c)(35),{depth:n,node:l}=t,r=`cascade-row-${l.table}`,s;e[0]!==n?(s=Pc(n),e[0]=n,e[1]=s):s=e[1];let a;e[2]!==n?(a=n>0&&(0,b.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2514"}),e[2]=n,e[3]=a):a=e[3];let u;e[4]!==l.table?(u=(0,b.jsx)("span",{className:"font-medium text-foreground",children:l.table}),e[4]=l.table,e[5]=u):u=e[5];let c;e[6]!==l.relation||e[7]!==l.table?(c=l.relation!==void 0&&(0,b.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 i;e[9]!==l.rowCount?(i=l.rowCount.toString(),e[9]=l.rowCount,e[10]=i):i=e[10];let d;e[11]!==i?(d=(0,b.jsxs)("span",{className:"text-muted-foreground",children:["(",i," rows)"]}),e[11]=i,e[12]=d):d=e[12];let m;e[13]!==l?(m=Tc(l),e[13]=l,e[14]=m):m=e[14];let g;e[15]!==l.capNote||e[16]!==l.table?(g=l.capNote!==void 0&&(0,b.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]=g):g=e[17];let p;e[18]!==r||e[19]!==s||e[20]!==a||e[21]!==u||e[22]!==c||e[23]!==d||e[24]!==m||e[25]!==g?(p=(0,b.jsxs)("li",{className:"flex flex-wrap items-center gap-1.5 py-1 font-mono text-xs","data-testid":r,style:s,children:[a,u,c,d,m,g]}),e[18]=r,e[19]=s,e[20]=a,e[21]=u,e[22]=c,e[23]=d,e[24]=m,e[25]=g,e[26]=p):p=e[26];let f;if(e[27]!==n||e[28]!==l.children){let w;e[30]!==n?(w=o((_,x)=>(0,b.jsx)(ka,{depth:n+1,node:_},`${_.table}-${_.relation?.field??"root"}-${x.toString()}`),"h"),e[30]=n,e[31]=w):w=e[31],f=l.children.map(w),e[27]=n,e[28]=l.children,e[29]=f}else f=e[29];let h;return e[32]!==p||e[33]!==f?(h=(0,b.jsxs)(b.Fragment,{children:[p,f]}),e[32]=p,e[33]=f,e[34]=h):h=e[34],h},"tn"),Ac=o(t=>{let e=t._id??t.id??t.__id__??"";return typeof e=="string"?e:typeof e=="number"?e.toString():""},"Eo"),Oc=o(async(t,e,n,l)=>{try{let r=await l(t,e,n),s=r.rows.flatMap(u=>Ac(u)||[]).slice(0,jn),a=r.total??0;return{capNote:a>jn?`showing first ${jn.toString()} of ${a.toString()}`:void 0,rowCount:a,rowIds:s}}catch{return{capNote:"count unavailable",rowCount:0,rowIds:[]}}},"_o"),Da=o(async(t,e,n,l,r,s,a)=>{let{capNote:u,rowCount:c,rowIds:i}=n===void 0?{capNote:void 0,rowCount:1,rowIds:[e]}:await Oc(t,n.field,e,a),d=n?.onDelete==="restrict",m=[],g=`${t}:${e}`,p=s>=Ca;if(!r.has(g)&&!p){r.add(g);let h=l.get(t)??[];for(let w of h)for(let _ of i.slice(0,10)){let x=await Da(w.table,_,w,l,r,s+1,a);(x.rowCount>0||s===0)&&m.push(x)}r.delete(g)}let f=u;if(p){let h=`depth capped at ${Ca.toString()}`;f=u===void 0?h:`${u}; ${h}`}return{capNote:f,children:m,isRestrict:d,relation:n,rowCount:c,rowIds:i,table:t}},"nn"),Ec=o(({onClose:t,onConfirm:e,readPage:n,rowId:l,schema:r,table:s})=>{let a=ee(),[u,c]=(0,D.useState)(!0),[i,d]=(0,D.useState)(null),[m,g]=(0,D.useState)(null);(0,D.useEffect)(()=>{let h=!1;return le((async()=>{try{c(!0),g(null);let w=Rc(r);if(!((w.get(s)??[]).length>0)){h||(d({capNote:void 0,children:[],isRestrict:!1,relation:void 0,rowCount:1,rowIds:[l],table:s}),c(!1));return}let _=await Da(s,l,void 0,w,new Set,0,n);h||(d(_),c(!1))}catch(w){h||(g(w.message),c(!1))}})()),()=>{h=!0}},[l,s]);let p=i!==null&&Ic(i,h=>h.isRestrict).length>0,f=o(()=>{e(),t()},"f");return(0,b.jsxs)(Bt,{label:"Cascade impact preview",onClose:t,panelTestId:"cascade-panel",testId:"cascade-overlay",variant:"dialog",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between",children:[(0,b.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,b.jsx)("h3",{className:"text-base text-foreground","data-testid":"cascade-title",children:a("Cascade impact")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-desc",children:a("Delete preview \u2014 rows that would cascade or be blocked")})]}),(0,b.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground","data-testid":"cascade-close",onClick:t,type:"button",children:a("Close")})]}),u&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-loading",children:a("Loading\u2026")}),m!==null&&(0,b.jsx)("p",{className:"text-xs text-destructive","data-testid":"cascade-error",role:"alert",children:m}),!u&&i!==null&&(0,b.jsx)("ul",{className:"flex flex-col","data-testid":"cascade-tree",children:(0,b.jsx)(ka,{depth:0,node:i})}),!u&&i!==null&&i.children.length===0&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-no-impact",children:a("No related rows found.")}),p&&(0,b.jsx)("p",{className:"text-sm font-medium text-destructive","data-testid":"cascade-blocker-warning",role:"alert",children:a("Restrict relations will block this delete.")}),(0,b.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,b.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:a("Cancel")}),(0,b.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:u,onClick:f,type:"button",children:a("Delete")})]})]})},"$o"),Vc=o((t,e,n,l,r=300)=>{if(l<=0)return{ids:new Set(t.map(m=>m.id)),leadPx:0,tailPx:0};let s=n-r,a=n+l+r,u=new Set,c=0,i=0,d=0;for(let m of t){let g=m.getSize(),p=e.has(m.id),f=c+g>s&&c<a;p||f?u.add(m.id):c<s?i+=g:d+=g,c+=g}return{ids:u,leadPx:i,tailPx:d}},"Ro"),zc=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},"Do"),$c={columnOrderingFeature:jo,columnResizingFeature:Jo,columnSizingFeature:Uo,columnVisibilityFeature:Wo,rowSelectionFeature:lr,rowSortingFeature:sr,sortedRowModel:ar(),sortFns:{alphanumeric:Po,basic:It,datetime:ko,text:No}},Hc=o(()=>{let t=(0,J.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((h,w,_)=>{l(x=>({...x,[h]:{...x[h],[w]:_}}))},"t"),t[1]=r):r=t[1];let s=r,a;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=o(()=>{l({})},"l"),t[2]=a):a=t[2];let u=a,c;t[3]===Symbol.for("react.memo_cache_sentinel")?(c=o((h,w)=>{l(_=>{let x=_[h];if(x===void 0)return _;let y=Object.fromEntries(Object.entries(x).filter(v=>{let[C,R]=v;return!(C in w)||!Object.is(R,w[C])}));return Object.keys(y).length===0?Object.fromEntries(Object.entries(_).filter(v=>{let[C]=v;return C!==h})):{..._,[h]:y}})},"a"),t[3]=c):c=t[3];let i=c,d;t[4]!==n?(d=o((h,w)=>{let _=n[h];return _!==void 0&&w in _?{value:_[w]}:void 0},"m"),t[4]=n,t[5]=d):d=t[5];let m=d,g;t[6]!==n?(g=Object.values(n).reduce(jc,0),t[6]=n,t[7]=g):g=t[7];let p=g,f;return t[8]!==p||t[9]!==n||t[10]!==m?(f={clear:u,count:p,drop:i,stage:s,staged:n,stagedValue:m},t[8]=p,t[9]=n,t[10]=m,t[11]=f):f=t[11],f},"Io"),Ta=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},"on"),Lc=o(t=>{let e=(0,J.c)(29),{changes:n,committing:l,onCommit:r,onDiscard:s}=t,a=ee(),u;e[0]!==n.length||e[1]!==a?(u=a("{count} pending changes",{count:n.length}),e[0]=n.length,e[1]=a,e[2]=u):u=e[2];let c;e[3]!==u?(c=(0,b.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-warning","data-testid":"db-staged-count",children:u}),e[3]=u,e[4]=c):c=e[4];let i;e[5]!==l||e[6]!==a?(i=a(l?"Committing\u2026":"Commit"),e[5]=l,e[6]=a,e[7]=i):i=e[7];let d;e[8]!==l||e[9]!==r||e[10]!==i?(d=(0,b.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:i}),e[8]=l,e[9]=r,e[10]=i,e[11]=d):d=e[11];let m;e[12]!==a?(m=a("Discard"),e[12]=a,e[13]=m):m=e[13];let g;e[14]!==l||e[15]!==s||e[16]!==m?(g=(0,b.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:s,type:"button",children:m}),e[14]=l,e[15]=s,e[16]=m,e[17]=g):g=e[17];let p;e[18]!==c||e[19]!==d||e[20]!==g?(p=(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,d,g]}),e[18]=c,e[19]=d,e[20]=g,e[21]=p):p=e[21];let f;e[22]!==n?(f=n.map(Bc),e[22]=n,e[23]=f):f=e[23];let h;e[24]!==f?(h=(0,b.jsx)("ul",{className:"flex flex-col gap-1","data-testid":"db-staged-list",children:f}),e[24]=f,e[25]=h):h=e[25];let w;return e[26]!==p||e[27]!==h?(w=(0,b.jsxs)("div",{className:"flex flex-col gap-2 border border-warning/40 bg-warning/5 p-3","data-testid":"db-staged",children:[p,h]}),e[26]=p,e[27]=h,e[28]=w):w=e[28],w},"Po");function jc(t,e){return t+Object.keys(e).length}o(jc,"Oo");function Bc(t){return(0,b.jsxs)("li",{className:"flex flex-wrap items-center gap-2 font-mono text-xs",children:[(0,b.jsxs)("span",{className:"text-muted-foreground",children:[t.rowId,".",t.column]}),(0,b.jsx)("span",{className:"text-destructive line-through",children:nt(t.oldValue)}),(0,b.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2192"}),(0,b.jsx)("span",{className:"text-foreground",children:nt(t.newValue)})]},`${t.rowId}:${t.column}`)}o(Bc,"Fo");var va=400,Gc=36,qc={flex:"1 1 0%",minHeight:0,overflow:"auto",position:"relative"},Kc={width:"100%"},Jc=/\n$/u,Uc={alignItems:"center",display:"flex",left:0,position:"absolute",top:0,width:"100%"},Wc={display:"flex",width:"100%"},ya={flex:"0 0 8.5rem",padding:"0.375rem 0.75rem"},Qc="2.5rem",Aa={alignItems:"center",display:"flex",flex:"0 0 2.5rem",justifyContent:"center",left:0,padding:"0.375rem 0",position:"sticky",zIndex:2},fr=o(t=>({flex:"0 0 auto",overflow:"hidden",padding:"0.375rem 0.75rem",position:"relative",textOverflow:"ellipsis",whiteSpace:"nowrap",width:`${t.toString()}px`}),"At"),Oa=o((t,e)=>({...fr(t),left:`calc(${Qc} + ${e.toString()}px)`,position:"sticky",zIndex:2}),"ln"),cr="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",Xc=o((t,e,n)=>e.enabled&&e.columns.has(n)?void 0:t,"Go"),mr="__back__:",Yc=o(t=>`${mr}${t.table}.${t.column}`,"Ko"),Zc=o(t=>{let e=(0,J.c)(3),{counts:n,rowId:l}=t;if(n===void 0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,b.jsx)("span",{className:"text-muted-foreground/50",children:"\u2014"}),e[0]=a):a=e[0],a}let r=n[l]??0,s;return e[1]!==r?(s=(0,b.jsx)("span",{className:"tabular-nums",children:r}),e[1]=r,e[2]=s):s=e[2],s},"Jo"),Qe=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},"Ae"),eu=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}},"Wo"),tu=o((t,e,n)=>{if(n!==void 0&&n.type!=="any")return eu(t,n);let l=Ta(t,e);return typeof e=="number"&&typeof l!="number"?void 0:{value:l}},"Ho"),nu=o(({anchor:t,columnIds:e,columnMeta:n,editableColumn:l,rows:r,text:s})=>{let a=s.replaceAll(`\r
3
3
  `,`
4
4
  `).replace(Jc,"").split(`
@@ -1 +1 @@
1
- import{a as te}from"./chunk-EA2JKR5D.js";import{W as Z}from"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as O}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import"./chunk-225VJ77I.js";import{a as K}from"./chunk-4ZEL6BYL.js";import{c as ee}from"./chunk-D6UKRXIS.js";import{f as M}from"./chunk-VWWJIICI.js";import"./chunk-FSRSK4LY.js";import"./chunk-KSYIH3NO.js";import{a as P}from"./chunk-FKVZRPV5.js";import{a as D,b as F,c as L,d as h,e as o,f as i}from"./chunk-HEAQVSNS.js";import{a as E,e as _}from"./chunk-WUWBZPUK.js";import{d as H,f as Q,g as V,h as W,o as $}from"./chunk-FODLDLE2.js";import{a as n,d as Y,e as ne,g as le}from"./chunk-YKXDMIHQ.js";var c=Y(ne(),1);var e=Y(le(),1);var oe=["queued","running","paused","waiting","complete","errored","terminated"],ie=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=n(l=>typeof l=="object"&&l!==null&&l.code===de,"ie"),me=n(l=>{let r=l.error??l.output;if(r===void 0)return"\u2014";try{return JSON.stringify(r)}catch{return"(unserializable)"}},"de"),ue=n(({loadDetail:l,loadInstances:r,readOnly:N,runAction:j,workflowName:g})=>{let A=M(),s=H(),[p,k]=(0,c.useState)(null),[S,C]=(0,c.useState)(null),[v,z]=(0,c.useState)(""),[b,f]=(0,c.useState)(null),[J,I]=(0,c.useState)(!1),[R,U]=(0,c.useState)(null),x=l??(a=>A.getWorkflowInstance(a)),w=N?void 0:j??(r===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),T=n(async()=>{f(null),I(!1);let a=v===""?void 0:v;try{if(r===void 0){let d=await A.listWorkflowInstances({name:g,status:a});if(d.configured===!1){k(null),I(!0);return}k(d.instances);return}k(await r({name:g,status:a}))}catch(d){k(null),ce(d)?I(!0):f(W(d))}},"L");(0,c.useEffect)(()=>{C(null),$(T())},[g,v]);let q=n(async a=>{f(null);try{C(await x({id:a,name:g}))}catch(d){f(W(d))}},"K"),B=n(async(a,d)=>{if(w!==void 0){U(a),f(null);try{await w({action:d,id:a,name:g}),await T()}catch(G){f(W(G))}U(null)}},"q");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:s("Instance history")}),(0,e.jsxs)("select",{"aria-label":s("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:n(a=>{z(a.target.value)},"onChange"),value:v,children:[(0,e.jsx)("option",{value:"",children:s("All statuses")}),oe.map(a=>(0,e.jsx)("option",{value:a,children:a},a))]})]}),b!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:b}),J&&(0,e.jsx)(P,{description:s("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:s("Workflow inspection not configured")}),!J&&p!==null&&p.length===0&&(0,e.jsx)(P,{description:s("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:s("No instances")}),p!==null&&p.length>0&&(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:s("Instance id")}),(0,e.jsx)(o,{children:s("Status")}),(0,e.jsx)(o,{children:s("Created")}),(0,e.jsx)(o,{children:s("Ended")}),(0,e.jsx)(o,{"aria-label":s("Actions")})]})}),(0,e.jsx)(L,{children:p.map(a=>(0,e.jsxs)(h,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:a.id}),(0,e.jsx)(i,{className:"font-mono text-xs",children:a.status}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"}),(0,e.jsx)(i,{className:"text-right",children:(0,e.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsx)(O,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:n(()=>{$(q(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:s("Steps")}),w!==void 0&&ie.map(d=>(0,e.jsx)(O,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:R===a.id,onClick:n(()=>{$(B(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:s(d)},d))]})})]},a.id))})]})})}),S!==null&&(0,e.jsx)(E,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxs)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[s("Steps")," \xB7 ",S.id]}),(0,e.jsx)(O,{"data-testid":"workflow-instance-detail-close",onClick:n(()=>{C(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Close")})]}),S.steps.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:s("This instance has no recorded steps yet.")}):(0,e.jsxs)(D,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:s("Step")}),(0,e.jsx)(o,{children:s("Type")}),(0,e.jsx)(o,{children:s("Attempts")}),(0,e.jsx)(o,{children:s("Started")}),(0,e.jsx)(o,{children:s("Output")})]})}),(0,e.jsx)(L,{children:S.steps.map((a,d)=>(0,e.jsxs)(h,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:a.name}),(0,e.jsx)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"}),(0,e.jsx)(i,{className:"tabular-nums",children:a.attempts??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:me(a)})]},`${a.name}:${String(d)}`))})]})]})})]})},"ce"),fe=Q(K.createWorkflowInstance),he=Q(K.getWorkflowInstanceStatus),pe=n(l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"\u2014";try{return JSON.stringify(l.output)}catch{return"(unserializable)"}},"fe"),xe=n((l,r)=>l.some(N=>N.exportName===r)?r:l[0]?.exportName??"","he"),We=n(()=>{let l=M(),r=H(),{data:N,error:j}=ee(K.listWorkflows,{}),[g,A]=(0,c.useState)(""),[s,p]=(0,c.useState)(""),[k,S]=(0,c.useState)(""),[C,v]=(0,c.useState)(!1),[z,b]=(0,c.useState)(null),[f,J]=(0,c.useState)([]),[I,R]=(0,c.useState)(null),U=N!==void 0,x=Array.isArray(N?.workflows)?[...N.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],w=xe(x,g),T=x.find(t=>t.exportName===w),q=n(t=>{J(u=>{let m=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...m]})},"C"),B=n(async()=>{let t=w;if(t==="")return;let u,m=k.trim();if(m!=="")try{u=JSON.parse(m)}catch{b(r("Params must be valid JSON"));return}v(!0),b(null);try{let y=s.trim(),X=await l.query(fe,{exportName:t,id:y===""?void 0:y,params:u},V(""));q({exportName:t,id:X.id,status:X.status}),p("")}catch(y){b(W(y))}v(!1)},"L"),a=n(()=>{$(B())},"K"),d=n(async(t,u)=>{R(u);try{let m=await l.query(he,{exportName:t,id:u},V(""));q({error:m.error,exportName:t,id:m.id,output:m.output,status:m.status})}catch(m){b(W(m))}R(null)},"q"),G=n(t=>{A(t.target.value)},"r"),ae=n(t=>{p(t.target.value)},"l"),re=n(t=>{S(t.target.value)},"G"),se=n(t=>{let{export:u,id:m}=t.currentTarget.dataset;u!==void 0&&m!==void 0&&$(d(u,m))},"ee");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[j!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:j}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),U&&x.length===0?(0,e.jsx)(P,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflows-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:r("Export")}),(0,e.jsx)(o,{children:r("Name")}),(0,e.jsx)(o,{children:r("Class")}),(0,e.jsx)(o,{children:r("Binding")})]})}),(0,e.jsx)(L,{children:x.map(t=>(0,e.jsxs)(h,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),x.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Start instance")}),z!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:z}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("select",{"aria-label":r("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:G,value:w,children:x.map(t=>(0,e.jsx)("option",{value:t.exportName,children:t.exportName},t.exportName))}),(0,e.jsx)(Z,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:ae,placeholder:r("Instance id (optional)"),value:s}),(0,e.jsx)(O,{"data-testid":"workflows-start-button",disabled:C||w==="",onClick:a,children:r(C?"Starting\u2026":"Start instance")})]}),(0,e.jsx)(te,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:re,placeholder:r("Params (JSON, optional)"),value:k})]}),f.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Instances")}),(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:r("Workflow")}),(0,e.jsx)(o,{children:r("Instance id")}),(0,e.jsx)(o,{children:r("Status")}),(0,e.jsx)(o,{children:r("Output")}),(0,e.jsx)(o,{})]})}),(0,e.jsx)(L,{children:f.map(t=>(0,e.jsxs)(h,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id}),(0,e.jsx)(i,{className:"font-mono text-xs",children:t.status}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:pe(t)}),(0,e.jsx)(i,{children:(0,e.jsx)(O,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:I===t.id,onClick:se,size:"xs",variant:"outline",children:I===t.id?r("Refreshing\u2026"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),T!==void 0&&(0,e.jsx)(ue,{workflowName:T.name})]})},"Te");export{We as default};
1
+ import{a as te}from"./chunk-EA2JKR5D.js";import{W as Z}from"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as O}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import"./chunk-225VJ77I.js";import{a as K}from"./chunk-4ZEL6BYL.js";import{c as ee}from"./chunk-KIKAXEXE.js";import{f as M}from"./chunk-PPUG6WPN.js";import"./chunk-FSRSK4LY.js";import"./chunk-2Y6PXGIS.js";import{a as P}from"./chunk-FKVZRPV5.js";import{a as D,b as F,c as L,d as h,e as o,f as i}from"./chunk-HEAQVSNS.js";import{a as E,e as _}from"./chunk-WUWBZPUK.js";import{d as H,f as Q,g as V,h as W,o as $}from"./chunk-FODLDLE2.js";import{a as n,d as Y,e as ne,g as le}from"./chunk-YKXDMIHQ.js";var c=Y(ne(),1);var e=Y(le(),1);var oe=["queued","running","paused","waiting","complete","errored","terminated"],ie=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=n(l=>typeof l=="object"&&l!==null&&l.code===de,"ie"),me=n(l=>{let r=l.error??l.output;if(r===void 0)return"\u2014";try{return JSON.stringify(r)}catch{return"(unserializable)"}},"de"),ue=n(({loadDetail:l,loadInstances:r,readOnly:N,runAction:j,workflowName:g})=>{let A=M(),s=H(),[p,k]=(0,c.useState)(null),[S,C]=(0,c.useState)(null),[v,z]=(0,c.useState)(""),[b,f]=(0,c.useState)(null),[J,I]=(0,c.useState)(!1),[R,U]=(0,c.useState)(null),x=l??(a=>A.getWorkflowInstance(a)),w=N?void 0:j??(r===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),T=n(async()=>{f(null),I(!1);let a=v===""?void 0:v;try{if(r===void 0){let d=await A.listWorkflowInstances({name:g,status:a});if(d.configured===!1){k(null),I(!0);return}k(d.instances);return}k(await r({name:g,status:a}))}catch(d){k(null),ce(d)?I(!0):f(W(d))}},"L");(0,c.useEffect)(()=>{C(null),$(T())},[g,v]);let q=n(async a=>{f(null);try{C(await x({id:a,name:g}))}catch(d){f(W(d))}},"K"),B=n(async(a,d)=>{if(w!==void 0){U(a),f(null);try{await w({action:d,id:a,name:g}),await T()}catch(G){f(W(G))}U(null)}},"q");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:s("Instance history")}),(0,e.jsxs)("select",{"aria-label":s("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:n(a=>{z(a.target.value)},"onChange"),value:v,children:[(0,e.jsx)("option",{value:"",children:s("All statuses")}),oe.map(a=>(0,e.jsx)("option",{value:a,children:a},a))]})]}),b!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:b}),J&&(0,e.jsx)(P,{description:s("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:s("Workflow inspection not configured")}),!J&&p!==null&&p.length===0&&(0,e.jsx)(P,{description:s("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:s("No instances")}),p!==null&&p.length>0&&(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:s("Instance id")}),(0,e.jsx)(o,{children:s("Status")}),(0,e.jsx)(o,{children:s("Created")}),(0,e.jsx)(o,{children:s("Ended")}),(0,e.jsx)(o,{"aria-label":s("Actions")})]})}),(0,e.jsx)(L,{children:p.map(a=>(0,e.jsxs)(h,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:a.id}),(0,e.jsx)(i,{className:"font-mono text-xs",children:a.status}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"}),(0,e.jsx)(i,{className:"text-right",children:(0,e.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsx)(O,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:n(()=>{$(q(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:s("Steps")}),w!==void 0&&ie.map(d=>(0,e.jsx)(O,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:R===a.id,onClick:n(()=>{$(B(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:s(d)},d))]})})]},a.id))})]})})}),S!==null&&(0,e.jsx)(E,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxs)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[s("Steps")," \xB7 ",S.id]}),(0,e.jsx)(O,{"data-testid":"workflow-instance-detail-close",onClick:n(()=>{C(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Close")})]}),S.steps.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:s("This instance has no recorded steps yet.")}):(0,e.jsxs)(D,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:s("Step")}),(0,e.jsx)(o,{children:s("Type")}),(0,e.jsx)(o,{children:s("Attempts")}),(0,e.jsx)(o,{children:s("Started")}),(0,e.jsx)(o,{children:s("Output")})]})}),(0,e.jsx)(L,{children:S.steps.map((a,d)=>(0,e.jsxs)(h,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:a.name}),(0,e.jsx)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"}),(0,e.jsx)(i,{className:"tabular-nums",children:a.attempts??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:me(a)})]},`${a.name}:${String(d)}`))})]})]})})]})},"ce"),fe=Q(K.createWorkflowInstance),he=Q(K.getWorkflowInstanceStatus),pe=n(l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"\u2014";try{return JSON.stringify(l.output)}catch{return"(unserializable)"}},"fe"),xe=n((l,r)=>l.some(N=>N.exportName===r)?r:l[0]?.exportName??"","he"),We=n(()=>{let l=M(),r=H(),{data:N,error:j}=ee(K.listWorkflows,{}),[g,A]=(0,c.useState)(""),[s,p]=(0,c.useState)(""),[k,S]=(0,c.useState)(""),[C,v]=(0,c.useState)(!1),[z,b]=(0,c.useState)(null),[f,J]=(0,c.useState)([]),[I,R]=(0,c.useState)(null),U=N!==void 0,x=Array.isArray(N?.workflows)?[...N.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],w=xe(x,g),T=x.find(t=>t.exportName===w),q=n(t=>{J(u=>{let m=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...m]})},"C"),B=n(async()=>{let t=w;if(t==="")return;let u,m=k.trim();if(m!=="")try{u=JSON.parse(m)}catch{b(r("Params must be valid JSON"));return}v(!0),b(null);try{let y=s.trim(),X=await l.query(fe,{exportName:t,id:y===""?void 0:y,params:u},V(""));q({exportName:t,id:X.id,status:X.status}),p("")}catch(y){b(W(y))}v(!1)},"L"),a=n(()=>{$(B())},"K"),d=n(async(t,u)=>{R(u);try{let m=await l.query(he,{exportName:t,id:u},V(""));q({error:m.error,exportName:t,id:m.id,output:m.output,status:m.status})}catch(m){b(W(m))}R(null)},"q"),G=n(t=>{A(t.target.value)},"r"),ae=n(t=>{p(t.target.value)},"l"),re=n(t=>{S(t.target.value)},"G"),se=n(t=>{let{export:u,id:m}=t.currentTarget.dataset;u!==void 0&&m!==void 0&&$(d(u,m))},"ee");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[j!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:j}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),U&&x.length===0?(0,e.jsx)(P,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflows-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:r("Export")}),(0,e.jsx)(o,{children:r("Name")}),(0,e.jsx)(o,{children:r("Class")}),(0,e.jsx)(o,{children:r("Binding")})]})}),(0,e.jsx)(L,{children:x.map(t=>(0,e.jsxs)(h,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),x.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Start instance")}),z!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:z}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("select",{"aria-label":r("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:G,value:w,children:x.map(t=>(0,e.jsx)("option",{value:t.exportName,children:t.exportName},t.exportName))}),(0,e.jsx)(Z,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:ae,placeholder:r("Instance id (optional)"),value:s}),(0,e.jsx)(O,{"data-testid":"workflows-start-button",disabled:C||w==="",onClick:a,children:r(C?"Starting\u2026":"Start instance")})]}),(0,e.jsx)(te,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:re,placeholder:r("Params (JSON, optional)"),value:k})]}),f.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Instances")}),(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:r("Workflow")}),(0,e.jsx)(o,{children:r("Instance id")}),(0,e.jsx)(o,{children:r("Status")}),(0,e.jsx)(o,{children:r("Output")}),(0,e.jsx)(o,{})]})}),(0,e.jsx)(L,{children:f.map(t=>(0,e.jsxs)(h,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id}),(0,e.jsx)(i,{className:"font-mono text-xs",children:t.status}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:pe(t)}),(0,e.jsx)(i,{children:(0,e.jsx)(O,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:I===t.id,onClick:se,size:"xs",variant:"outline",children:I===t.id?r("Refreshing\u2026"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),T!==void 0&&(0,e.jsx)(ue,{workflowName:T.name})]})},"Te");export{We as default};
@@ -1 +1 @@
1
- import{a as Ve}from"./chunk-2URQKGWU.js";import"./chunk-4JLGLPWV.js";import{a as He}from"./chunk-EA2JKR5D.js";import{a as Ke}from"./chunk-66UGPQVC.js";import"./chunk-3Q2P62UR.js";import{a as Ge}from"./chunk-PD6WIDY6.js";import{W as je}from"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as le}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as de}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as Pe}from"./chunk-F7UZBTKS.js";import{a as Ue}from"./chunk-ULIQFBZU.js";import"./chunk-Y3G2ZPOD.js";import"./chunk-35DM4JJG.js";import{a as F}from"./chunk-4ZEL6BYL.js";import{c as Me}from"./chunk-D6UKRXIS.js";import{f as We}from"./chunk-VWWJIICI.js";import"./chunk-FSRSK4LY.js";import"./chunk-KSYIH3NO.js";import{a as ue}from"./chunk-FKVZRPV5.js";import{a as _e,b as Be,c as ke,d as G,e as C,f as w}from"./chunk-HEAQVSNS.js";import{a as Te,e as De}from"./chunk-WUWBZPUK.js";import{d as $,f as ie,g as ce,h as me,o as he,r as ze}from"./chunk-FODLDLE2.js";import{a as h,d as Ee,e as rt,f as nt,g as ot}from"./chunk-YKXDMIHQ.js";var W=Ee(nt(),1);var A=Ee(rt(),1);var t=Ee(ot(),1);var dt=h((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),l=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),d=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:d,queuesWithoutDlq:l,showReliabilityWarning:l.length>0||d>0}},"rt"),lt=200,ut=ie(F.sendQueueMessage),it=ie(F.replayQueueMessage),ct=ie(F.clearQueueMessages),Xe=96,mt=h(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n)}catch{return"[unserializable]"}},"it"),ht=h(n=>n.length>Xe?`${n.slice(0,Xe)}\u2026`:n,"ct"),pt=h(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","ut"),gt=h((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"mt"),ft=h(n=>{let e=(0,W.c)(11),{loaded:a,queues:l}=n,d=$(),s;e[0]!==d?(s=d("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=d,e[1]=s):s=e[1];let o;e[2]!==s?(o=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let r;e[4]!==a||e[5]!==l||e[6]!==d?(r=a&&l.length===0?(0,t.jsx)(ue,{description:d("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:d("No queues defined")}):(0,t.jsx)(Te,{className:"overflow-hidden py-0",children:(0,t.jsx)(De,{className:"px-0",children:(0,t.jsxs)(_e,{"data-testid":"queues-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:d("Export")}),(0,t.jsx)(C,{children:d("Queue")}),(0,t.jsx)(C,{children:d("Mode")}),(0,t.jsx)(C,{children:d("Binding")}),(0,t.jsx)(C,{children:d("Dead-letter")})]})}),(0,t.jsx)(ke,{children:l.map(bt)})]})})}),e[4]=a,e[5]=l,e[6]=d,e[7]=r):r=e[7];let p;return e[8]!==o||e[9]!==r?(p=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[o,r]}),e[8]=o,e[9]=r,e[10]=p):p=e[10],p},"ft"),xt=h(n=>{let e=(0,W.c)(67),{message:a,onReplay:l,replayingId:d}=n,s=$(),o,r,p,c,x,N,y,u,m,f;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let j=mt(a.body);r=G,N=`queues-message-${a.id}`;let z=a.exportName??a.queue;e[19]!==z?(y=(0,t.jsx)(w,{className:"font-mono text-xs",children:z}),e[19]=z,e[20]=y):y=e[20],e[21]!==a.messageId?(u=(0,t.jsx)(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=u):u=e[22],e[23]!==a.attempts?(m=(0,t.jsx)(w,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=m):m=e[24];let T=`queues-outcome-${a.id}`,D;e[25]!==a.outcome?(D=pt(a.outcome),e[25]=a.outcome,e[26]=D):D=e[26];let I;e[27]!==a.outcome||e[28]!==T||e[29]!==D?(I=(0,t.jsx)(de,{"data-testid":T,variant:D,children:a.outcome}),e[27]=a.outcome,e[28]=T,e[29]=D,e[30]=I):I=e[30];let M;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(M=a.deadLettered&&(0,t.jsx)(de,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=M):M=e[34],e[35]!==I||e[36]!==M?(f=(0,t.jsx)(w,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[I,M]})}),e[35]=I,e[36]=M,e[37]=f):f=e[37],o=w,p="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",c=j,x=ht(j),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=o,e[10]=r,e[11]=p,e[12]=c,e[13]=x,e[14]=N,e[15]=y,e[16]=u,e[17]=m,e[18]=f}else o=e[9],r=e[10],p=e[11],c=e[12],x=e[13],N=e[14],y=e[15],u=e[16],m=e[17],f=e[18];let g;e[38]!==o||e[39]!==p||e[40]!==c||e[41]!==x?(g=(0,t.jsx)(o,{className:p,title:c,children:x}),e[38]=o,e[39]=p,e[40]=c,e[41]=x,e[42]=g):g=e[42];let q;e[43]!==a.capturedAt?(q=ze(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=q):q=e[44];let b;e[45]!==q?(b=(0,t.jsx)(w,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=b):b=e[46];let S=`queues-replay-${a.id}`,E=d!==null,Q;e[47]!==a.id||e[48]!==d||e[49]!==s?(Q=d===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=d,e[49]=s,e[50]=Q):Q=e[50];let L;e[51]!==a.id||e[52]!==l||e[53]!==S||e[54]!==E||e[55]!==Q?(L=(0,t.jsx)(w,{children:(0,t.jsx)(le,{"data-id":a.id,"data-testid":S,disabled:E,onClick:l,size:"xs",type:"button",variant:"outline",children:Q})}),e[51]=a.id,e[52]=l,e[53]=S,e[54]=E,e[55]=Q,e[56]=L):L=e[56];let _;return e[57]!==r||e[58]!==b||e[59]!==L||e[60]!==N||e[61]!==y||e[62]!==u||e[63]!==m||e[64]!==f||e[65]!==g?(_=(0,t.jsxs)(r,{"data-testid":N,children:[y,u,m,f,g,b,L]}),e[57]=r,e[58]=b,e[59]=L,e[60]=N,e[61]=y,e[62]=u,e[63]=m,e[64]=f,e[65]=g,e[66]=_):_=e[66],_},"ht"),yt=h(n=>{let e=(0,W.c)(30),{hasError:a,messages:l,onClear:d,onReplay:s,replayingId:o}=n,r=$(),p;e[0]!==r?(p=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=r,e[1]=p):p=e[1];let c;e[2]!==p?(c=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:p}),e[2]=p,e[3]=c):c=e[3];let x;e[4]!==l.length||e[5]!==r?(x=r("Clear {count} messages?",{count:l.length}),e[4]=l.length,e[5]=r,e[6]=x):x=e[6];let N=l.length===0,y;e[7]!==r?(y=r("Clear log"),e[7]=r,e[8]=y):y=e[8];let u;e[9]!==d||e[10]!==x||e[11]!==N||e[12]!==y?(u=(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(Ge,{confirmLabel:x,disabled:N,onConfirm:d,testId:"queues-clear",children:y})}),e[9]=d,e[10]=x,e[11]=N,e[12]=y,e[13]=u):u=e[13];let m;e[14]!==l.length||e[15]!==r?(m=l.length>0&&(0,t.jsx)(de,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:l.length})}),e[14]=l.length,e[15]=r,e[16]=m):m=e[16];let f;e[17]!==c||e[18]!==u||e[19]!==m?(f=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u,m]}),e[17]=c,e[18]=u,e[19]=m,e[20]=f):f=e[20];let g;e[21]!==a||e[22]!==l||e[23]!==s||e[24]!==o||e[25]!==r?(g=!a&&l.length===0?(0,t.jsx)(ue,{description:r("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:r("No consumed messages yet.")}):(0,t.jsx)(Te,{className:"overflow-hidden py-0",children:(0,t.jsx)(De,{className:"px-0",children:(0,t.jsx)(Ve,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(_e,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:r("Export")}),(0,t.jsx)(C,{children:r("Message")}),(0,t.jsx)(C,{children:r("Attempts")}),(0,t.jsx)(C,{children:r("Outcome")}),(0,t.jsx)(C,{children:r("Body")}),(0,t.jsx)(C,{children:r("Captured")}),(0,t.jsx)(C,{})]})}),(0,t.jsx)(ke,{children:l.map(b=>(0,t.jsx)(xt,{message:b,onReplay:s,replayingId:o},b.id))})]})})})}),e[21]=a,e[22]=l,e[23]=s,e[24]=o,e[25]=r,e[26]=g):g=e[26];let q;return e[27]!==f||e[28]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[f,g]}),e[27]=f,e[28]=g,e[29]=q):q=e[29],q},"pt"),Nt=h(n=>{let e=(0,W.c)(20),{batchMode:a,bodyText:l,delayText:d,onBatchModeChange:s,onBodyChange:o,onDelayChange:r,onSelectExport:p,onSend:c,queues:x,selectedExportName:N,sending:y}=n,u=$(),m;e[0]!==u?(m=u("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=u,e[1]=m):m=e[1];let f;e[2]!==m?(f=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=f):f=e[3];let g;e[4]!==a||e[5]!==l||e[6]!==d||e[7]!==s||e[8]!==o||e[9]!==r||e[10]!==p||e[11]!==c||e[12]!==x||e[13]!==N||e[14]!==y||e[15]!==u?(g=x.length===0?(0,t.jsx)(ue,{description:u("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:u("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":u("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:p,value:N,children:x.map(qt)}),(0,t.jsx)(je,{"aria-label":u("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:u("Delay (s)"),type:"number",value:d}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),u("Send as batch (JSON array)")]}),(0,t.jsx)(le,{className:"ml-auto","data-testid":"queues-send-button",disabled:y||N==="",onClick:c,type:"button",children:u(y?"Sending\u2026":"Send message")})]}),(0,t.jsx)(He,{"aria-label":u("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:o,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:l})]}),e[4]=a,e[5]=l,e[6]=d,e[7]=s,e[8]=o,e[9]=r,e[10]=p,e[11]=c,e[12]=x,e[13]=N,e[14]=y,e[15]=u,e[16]=g):g=e[16];let q;return e[17]!==f||e[18]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[f,g]}),e[17]=f,e[18]=g,e[19]=q):q=e[19],q},"gt"),Ft=h(n=>{let e=(0,W.c)(59),{limit:a}=n,l=a??lt,d=We(),s=$(),[o,r]=(0,A.useState)("declared"),[p,c]=(0,A.useState)(null),x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x={},e[0]=x):x=e[0];let{data:N,error:y,errorSource:u}=Me(F.listQueues,x),m;e[1]!==l?(m={limit:l},e[1]=l,e[2]=m):m=e[2];let{data:f,error:g,errorSource:q,refetch:b}=Me(F.getQueueMessages,m),S=Array.isArray(N?.queues)?[...N.queues].toSorted(vt):[],E=f?.entries??[],{deadLetteredCount:Q,queuesWithoutDlq:L,showReliabilityWarning:_}=dt(S,E),[j,z]=(0,A.useState)(""),[T,D]=(0,A.useState)(""),[I,M]=(0,A.useState)(""),[U,Ye]=(0,A.useState)(!1),[pe,Oe]=(0,A.useState)(!1),[ge,Re]=(0,A.useState)(null),H=S.some(i=>i.exportName===j)?j:S[0]?.exportName??"",Je=o==="messages"?g:y,Ze=o==="messages"?q:u,fe=Je??p,xe=Je===null?p:Ze,K;e[3]!==b?(K=h(()=>{b()},"H"),e[3]=b,e[4]=K):K=e[4],Ke(K,o==="messages");let ye=h(async()=>{c(null);let i=H;if(i==="")return;let v=null,$e=T.trim();if($e!=="")try{v=JSON.parse($e)}catch{c(s("Body must be valid JSON."));return}let Ae,Fe=I.trim();if(Fe!==""){let P=Number(Fe);if(!Number.isFinite(P)||P<0){c(s("Delay must be a non-negative number of seconds."));return}Ae=P}if(U&&!Array.isArray(v)){c(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}Oe(!0);let st=U?{batch:v,delaySeconds:Ae,exportName:i}:{body:v,delaySeconds:Ae,exportName:i};try{await d.query(ut,st,ce("")),b()}catch(P){c(me(P))}Oe(!1)},"ue"),V;e[5]!==d||e[6]!==b?(V=h(async i=>{c(null),Re(i);try{await d.query(it,{id:i},ce("")),b()}catch(v){c(me(v))}Re(null)},"V"),e[5]=d,e[6]=b,e[7]=V):V=e[7];let Ne=V,X;e[8]!==d||e[9]!==b?(X=h(async()=>{c(null);try{await d.query(ct,{},ce("")),b()}catch(i){c(me(i))}},"Y"),e[8]=d,e[9]=b,e[10]=X):X=e[10];let be=X,Y;e[11]===Symbol.for("react.memo_cache_sentinel")?(Y=h(i=>{let v=i.currentTarget.dataset.tab;(v==="declared"||v==="messages"||v==="send")&&r(v)},"X"),e[11]=Y):Y=e[11];let et=Y,Z;e[12]===Symbol.for("react.memo_cache_sentinel")?(Z=h(i=>{z(i.currentTarget.value)},"K"),e[12]=Z):Z=e[12];let qe=Z,ee;e[13]===Symbol.for("react.memo_cache_sentinel")?(ee=h(i=>{D(i.currentTarget.value)},"Z"),e[13]=ee):ee=e[13];let ve=ee,te;e[14]===Symbol.for("react.memo_cache_sentinel")?(te=h(i=>{M(i.currentTarget.value)},"ee"),e[14]=te):te=e[14];let Se=te,ae;e[15]===Symbol.for("react.memo_cache_sentinel")?(ae=h(i=>{Ye(i.currentTarget.checked)},"te"),e[15]=ae):ae=e[15];let Ce=ae,se;e[16]!==ye?(se=h(()=>{he(ye())},"se"),e[16]=ye,e[17]=se):se=e[17];let we=se,re;e[18]!==Ne?(re=h(i=>{let{id:v}=i.currentTarget.dataset;v!==void 0&&he(Ne(v))},"ae"),e[18]=Ne,e[19]=re):re=e[19];let Ie=re,ne;e[20]!==be?(ne=h(()=>{he(be())},"re"),e[20]=be,e[21]=ne):ne=e[21];let Qe=ne,tt="flex flex-col gap-6",at="lunora-queues-panel",B;e[22]!==s||e[23]!==o?(B=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(i=>(0,t.jsx)(le,{"aria-selected":o===i,"data-tab":i,"data-testid":`queues-tab-${i}`,onClick:et,role:"tab",size:"sm",type:"button",variant:o===i?"secondary":"ghost",children:gt(i,s)},i))}),e[22]=s,e[23]=o,e[24]=B):B=e[24];let k;e[25]!==fe||e[26]!==xe?(k=fe!==null&&(0,t.jsx)(Pe,{error:xe,testId:"queues-error"}),e[25]=fe,e[26]=xe,e[27]=k):k=e[27];let Le=_&&(0,t.jsx)(Ue,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[L.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:L.map(St).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),Q>0&&(0,t.jsx)("p",{className:L.length>0?"text-muted-foreground":"font-medium",children:Q===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:Q})})]})}),O;e[28]!==S||e[29]!==N||e[30]!==o?(O=o==="declared"&&(0,t.jsx)(ft,{loaded:N!==void 0,queues:S}),e[28]=S,e[29]=N,e[30]=o,e[31]=O):O=e[31];let R;e[32]!==E||e[33]!==g||e[34]!==Qe||e[35]!==Ie||e[36]!==ge||e[37]!==o?(R=o==="messages"&&(0,t.jsx)(yt,{hasError:g!==null,messages:E,onClear:Qe,onReplay:Ie,replayingId:ge}),e[32]=E,e[33]=g,e[34]=Qe,e[35]=Ie,e[36]=ge,e[37]=o,e[38]=R):R=e[38];let J;e[39]!==U||e[40]!==T||e[41]!==I||e[42]!==Ce||e[43]!==ve||e[44]!==Se||e[45]!==qe||e[46]!==we||e[47]!==S||e[48]!==H||e[49]!==pe||e[50]!==o?(J=o==="send"&&(0,t.jsx)(Nt,{batchMode:U,bodyText:T,delayText:I,onBatchModeChange:Ce,onBodyChange:ve,onDelayChange:Se,onSelectExport:qe,onSend:we,queues:S,selectedExportName:H,sending:pe}),e[39]=U,e[40]=T,e[41]=I,e[42]=Ce,e[43]=ve,e[44]=Se,e[45]=qe,e[46]=we,e[47]=S,e[48]=H,e[49]=pe,e[50]=o,e[51]=J):J=e[51];let oe;return e[52]!==B||e[53]!==k||e[54]!==Le||e[55]!==O||e[56]!==R||e[57]!==J?(oe=(0,t.jsxs)("div",{className:tt,"data-testid":at,children:[B,k,Le,O,R,J]}),e[52]=B,e[53]=k,e[54]=Le,e[55]=O,e[56]=R,e[57]=J,e[58]=oe):oe=e[58],oe},"Ft");function bt(n){return(0,t.jsxs)(G,{"data-testid":`queues-row-${n.exportName}`,children:[(0,t.jsx)(w,{className:"font-mono text-xs",children:n.exportName}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.name}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.mode}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.binding}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.deadLetterQueue??"\u2014"})]},n.exportName)}h(bt,"xt");function qt(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}h(qt,"yt");function vt(n,e){return n.exportName.localeCompare(e.exportName)}h(vt,"bt");function St(n){return n.name}h(St,"Nt");export{Ft as default};
1
+ import{a as Ve}from"./chunk-2URQKGWU.js";import"./chunk-4JLGLPWV.js";import{a as He}from"./chunk-EA2JKR5D.js";import{a as Ke}from"./chunk-66UGPQVC.js";import"./chunk-3Q2P62UR.js";import{a as Ge}from"./chunk-PD6WIDY6.js";import{W as je}from"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as le}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as de}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as Pe}from"./chunk-OQM3I5XY.js";import{a as Ue}from"./chunk-ULIQFBZU.js";import"./chunk-CX5PIWVR.js";import"./chunk-35DM4JJG.js";import{a as F}from"./chunk-4ZEL6BYL.js";import{c as Me}from"./chunk-KIKAXEXE.js";import{f as We}from"./chunk-PPUG6WPN.js";import"./chunk-FSRSK4LY.js";import"./chunk-2Y6PXGIS.js";import{a as ue}from"./chunk-FKVZRPV5.js";import{a as _e,b as Be,c as ke,d as G,e as C,f as w}from"./chunk-HEAQVSNS.js";import{a as Te,e as De}from"./chunk-WUWBZPUK.js";import{d as $,f as ie,g as ce,h as me,o as he,r as ze}from"./chunk-FODLDLE2.js";import{a as h,d as Ee,e as rt,f as nt,g as ot}from"./chunk-YKXDMIHQ.js";var W=Ee(nt(),1);var A=Ee(rt(),1);var t=Ee(ot(),1);var dt=h((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),l=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),d=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:d,queuesWithoutDlq:l,showReliabilityWarning:l.length>0||d>0}},"rt"),lt=200,ut=ie(F.sendQueueMessage),it=ie(F.replayQueueMessage),ct=ie(F.clearQueueMessages),Xe=96,mt=h(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n)}catch{return"[unserializable]"}},"it"),ht=h(n=>n.length>Xe?`${n.slice(0,Xe)}\u2026`:n,"ct"),pt=h(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","ut"),gt=h((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"mt"),ft=h(n=>{let e=(0,W.c)(11),{loaded:a,queues:l}=n,d=$(),s;e[0]!==d?(s=d("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=d,e[1]=s):s=e[1];let o;e[2]!==s?(o=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let r;e[4]!==a||e[5]!==l||e[6]!==d?(r=a&&l.length===0?(0,t.jsx)(ue,{description:d("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:d("No queues defined")}):(0,t.jsx)(Te,{className:"overflow-hidden py-0",children:(0,t.jsx)(De,{className:"px-0",children:(0,t.jsxs)(_e,{"data-testid":"queues-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:d("Export")}),(0,t.jsx)(C,{children:d("Queue")}),(0,t.jsx)(C,{children:d("Mode")}),(0,t.jsx)(C,{children:d("Binding")}),(0,t.jsx)(C,{children:d("Dead-letter")})]})}),(0,t.jsx)(ke,{children:l.map(bt)})]})})}),e[4]=a,e[5]=l,e[6]=d,e[7]=r):r=e[7];let p;return e[8]!==o||e[9]!==r?(p=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[o,r]}),e[8]=o,e[9]=r,e[10]=p):p=e[10],p},"ft"),xt=h(n=>{let e=(0,W.c)(67),{message:a,onReplay:l,replayingId:d}=n,s=$(),o,r,p,c,x,N,y,u,m,f;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let j=mt(a.body);r=G,N=`queues-message-${a.id}`;let z=a.exportName??a.queue;e[19]!==z?(y=(0,t.jsx)(w,{className:"font-mono text-xs",children:z}),e[19]=z,e[20]=y):y=e[20],e[21]!==a.messageId?(u=(0,t.jsx)(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=u):u=e[22],e[23]!==a.attempts?(m=(0,t.jsx)(w,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=m):m=e[24];let T=`queues-outcome-${a.id}`,D;e[25]!==a.outcome?(D=pt(a.outcome),e[25]=a.outcome,e[26]=D):D=e[26];let I;e[27]!==a.outcome||e[28]!==T||e[29]!==D?(I=(0,t.jsx)(de,{"data-testid":T,variant:D,children:a.outcome}),e[27]=a.outcome,e[28]=T,e[29]=D,e[30]=I):I=e[30];let M;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(M=a.deadLettered&&(0,t.jsx)(de,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=M):M=e[34],e[35]!==I||e[36]!==M?(f=(0,t.jsx)(w,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[I,M]})}),e[35]=I,e[36]=M,e[37]=f):f=e[37],o=w,p="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",c=j,x=ht(j),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=o,e[10]=r,e[11]=p,e[12]=c,e[13]=x,e[14]=N,e[15]=y,e[16]=u,e[17]=m,e[18]=f}else o=e[9],r=e[10],p=e[11],c=e[12],x=e[13],N=e[14],y=e[15],u=e[16],m=e[17],f=e[18];let g;e[38]!==o||e[39]!==p||e[40]!==c||e[41]!==x?(g=(0,t.jsx)(o,{className:p,title:c,children:x}),e[38]=o,e[39]=p,e[40]=c,e[41]=x,e[42]=g):g=e[42];let q;e[43]!==a.capturedAt?(q=ze(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=q):q=e[44];let b;e[45]!==q?(b=(0,t.jsx)(w,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=b):b=e[46];let S=`queues-replay-${a.id}`,E=d!==null,Q;e[47]!==a.id||e[48]!==d||e[49]!==s?(Q=d===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=d,e[49]=s,e[50]=Q):Q=e[50];let L;e[51]!==a.id||e[52]!==l||e[53]!==S||e[54]!==E||e[55]!==Q?(L=(0,t.jsx)(w,{children:(0,t.jsx)(le,{"data-id":a.id,"data-testid":S,disabled:E,onClick:l,size:"xs",type:"button",variant:"outline",children:Q})}),e[51]=a.id,e[52]=l,e[53]=S,e[54]=E,e[55]=Q,e[56]=L):L=e[56];let _;return e[57]!==r||e[58]!==b||e[59]!==L||e[60]!==N||e[61]!==y||e[62]!==u||e[63]!==m||e[64]!==f||e[65]!==g?(_=(0,t.jsxs)(r,{"data-testid":N,children:[y,u,m,f,g,b,L]}),e[57]=r,e[58]=b,e[59]=L,e[60]=N,e[61]=y,e[62]=u,e[63]=m,e[64]=f,e[65]=g,e[66]=_):_=e[66],_},"ht"),yt=h(n=>{let e=(0,W.c)(30),{hasError:a,messages:l,onClear:d,onReplay:s,replayingId:o}=n,r=$(),p;e[0]!==r?(p=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=r,e[1]=p):p=e[1];let c;e[2]!==p?(c=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:p}),e[2]=p,e[3]=c):c=e[3];let x;e[4]!==l.length||e[5]!==r?(x=r("Clear {count} messages?",{count:l.length}),e[4]=l.length,e[5]=r,e[6]=x):x=e[6];let N=l.length===0,y;e[7]!==r?(y=r("Clear log"),e[7]=r,e[8]=y):y=e[8];let u;e[9]!==d||e[10]!==x||e[11]!==N||e[12]!==y?(u=(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(Ge,{confirmLabel:x,disabled:N,onConfirm:d,testId:"queues-clear",children:y})}),e[9]=d,e[10]=x,e[11]=N,e[12]=y,e[13]=u):u=e[13];let m;e[14]!==l.length||e[15]!==r?(m=l.length>0&&(0,t.jsx)(de,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:l.length})}),e[14]=l.length,e[15]=r,e[16]=m):m=e[16];let f;e[17]!==c||e[18]!==u||e[19]!==m?(f=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u,m]}),e[17]=c,e[18]=u,e[19]=m,e[20]=f):f=e[20];let g;e[21]!==a||e[22]!==l||e[23]!==s||e[24]!==o||e[25]!==r?(g=!a&&l.length===0?(0,t.jsx)(ue,{description:r("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:r("No consumed messages yet.")}):(0,t.jsx)(Te,{className:"overflow-hidden py-0",children:(0,t.jsx)(De,{className:"px-0",children:(0,t.jsx)(Ve,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(_e,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:r("Export")}),(0,t.jsx)(C,{children:r("Message")}),(0,t.jsx)(C,{children:r("Attempts")}),(0,t.jsx)(C,{children:r("Outcome")}),(0,t.jsx)(C,{children:r("Body")}),(0,t.jsx)(C,{children:r("Captured")}),(0,t.jsx)(C,{})]})}),(0,t.jsx)(ke,{children:l.map(b=>(0,t.jsx)(xt,{message:b,onReplay:s,replayingId:o},b.id))})]})})})}),e[21]=a,e[22]=l,e[23]=s,e[24]=o,e[25]=r,e[26]=g):g=e[26];let q;return e[27]!==f||e[28]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[f,g]}),e[27]=f,e[28]=g,e[29]=q):q=e[29],q},"pt"),Nt=h(n=>{let e=(0,W.c)(20),{batchMode:a,bodyText:l,delayText:d,onBatchModeChange:s,onBodyChange:o,onDelayChange:r,onSelectExport:p,onSend:c,queues:x,selectedExportName:N,sending:y}=n,u=$(),m;e[0]!==u?(m=u("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=u,e[1]=m):m=e[1];let f;e[2]!==m?(f=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=f):f=e[3];let g;e[4]!==a||e[5]!==l||e[6]!==d||e[7]!==s||e[8]!==o||e[9]!==r||e[10]!==p||e[11]!==c||e[12]!==x||e[13]!==N||e[14]!==y||e[15]!==u?(g=x.length===0?(0,t.jsx)(ue,{description:u("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:u("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":u("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:p,value:N,children:x.map(qt)}),(0,t.jsx)(je,{"aria-label":u("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:u("Delay (s)"),type:"number",value:d}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),u("Send as batch (JSON array)")]}),(0,t.jsx)(le,{className:"ml-auto","data-testid":"queues-send-button",disabled:y||N==="",onClick:c,type:"button",children:u(y?"Sending\u2026":"Send message")})]}),(0,t.jsx)(He,{"aria-label":u("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:o,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:l})]}),e[4]=a,e[5]=l,e[6]=d,e[7]=s,e[8]=o,e[9]=r,e[10]=p,e[11]=c,e[12]=x,e[13]=N,e[14]=y,e[15]=u,e[16]=g):g=e[16];let q;return e[17]!==f||e[18]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[f,g]}),e[17]=f,e[18]=g,e[19]=q):q=e[19],q},"gt"),Ft=h(n=>{let e=(0,W.c)(59),{limit:a}=n,l=a??lt,d=We(),s=$(),[o,r]=(0,A.useState)("declared"),[p,c]=(0,A.useState)(null),x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x={},e[0]=x):x=e[0];let{data:N,error:y,errorSource:u}=Me(F.listQueues,x),m;e[1]!==l?(m={limit:l},e[1]=l,e[2]=m):m=e[2];let{data:f,error:g,errorSource:q,refetch:b}=Me(F.getQueueMessages,m),S=Array.isArray(N?.queues)?[...N.queues].toSorted(vt):[],E=f?.entries??[],{deadLetteredCount:Q,queuesWithoutDlq:L,showReliabilityWarning:_}=dt(S,E),[j,z]=(0,A.useState)(""),[T,D]=(0,A.useState)(""),[I,M]=(0,A.useState)(""),[U,Ye]=(0,A.useState)(!1),[pe,Oe]=(0,A.useState)(!1),[ge,Re]=(0,A.useState)(null),H=S.some(i=>i.exportName===j)?j:S[0]?.exportName??"",Je=o==="messages"?g:y,Ze=o==="messages"?q:u,fe=Je??p,xe=Je===null?p:Ze,K;e[3]!==b?(K=h(()=>{b()},"H"),e[3]=b,e[4]=K):K=e[4],Ke(K,o==="messages");let ye=h(async()=>{c(null);let i=H;if(i==="")return;let v=null,$e=T.trim();if($e!=="")try{v=JSON.parse($e)}catch{c(s("Body must be valid JSON."));return}let Ae,Fe=I.trim();if(Fe!==""){let P=Number(Fe);if(!Number.isFinite(P)||P<0){c(s("Delay must be a non-negative number of seconds."));return}Ae=P}if(U&&!Array.isArray(v)){c(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}Oe(!0);let st=U?{batch:v,delaySeconds:Ae,exportName:i}:{body:v,delaySeconds:Ae,exportName:i};try{await d.query(ut,st,ce("")),b()}catch(P){c(me(P))}Oe(!1)},"ue"),V;e[5]!==d||e[6]!==b?(V=h(async i=>{c(null),Re(i);try{await d.query(it,{id:i},ce("")),b()}catch(v){c(me(v))}Re(null)},"V"),e[5]=d,e[6]=b,e[7]=V):V=e[7];let Ne=V,X;e[8]!==d||e[9]!==b?(X=h(async()=>{c(null);try{await d.query(ct,{},ce("")),b()}catch(i){c(me(i))}},"Y"),e[8]=d,e[9]=b,e[10]=X):X=e[10];let be=X,Y;e[11]===Symbol.for("react.memo_cache_sentinel")?(Y=h(i=>{let v=i.currentTarget.dataset.tab;(v==="declared"||v==="messages"||v==="send")&&r(v)},"X"),e[11]=Y):Y=e[11];let et=Y,Z;e[12]===Symbol.for("react.memo_cache_sentinel")?(Z=h(i=>{z(i.currentTarget.value)},"K"),e[12]=Z):Z=e[12];let qe=Z,ee;e[13]===Symbol.for("react.memo_cache_sentinel")?(ee=h(i=>{D(i.currentTarget.value)},"Z"),e[13]=ee):ee=e[13];let ve=ee,te;e[14]===Symbol.for("react.memo_cache_sentinel")?(te=h(i=>{M(i.currentTarget.value)},"ee"),e[14]=te):te=e[14];let Se=te,ae;e[15]===Symbol.for("react.memo_cache_sentinel")?(ae=h(i=>{Ye(i.currentTarget.checked)},"te"),e[15]=ae):ae=e[15];let Ce=ae,se;e[16]!==ye?(se=h(()=>{he(ye())},"se"),e[16]=ye,e[17]=se):se=e[17];let we=se,re;e[18]!==Ne?(re=h(i=>{let{id:v}=i.currentTarget.dataset;v!==void 0&&he(Ne(v))},"ae"),e[18]=Ne,e[19]=re):re=e[19];let Ie=re,ne;e[20]!==be?(ne=h(()=>{he(be())},"re"),e[20]=be,e[21]=ne):ne=e[21];let Qe=ne,tt="flex flex-col gap-6",at="lunora-queues-panel",B;e[22]!==s||e[23]!==o?(B=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(i=>(0,t.jsx)(le,{"aria-selected":o===i,"data-tab":i,"data-testid":`queues-tab-${i}`,onClick:et,role:"tab",size:"sm",type:"button",variant:o===i?"secondary":"ghost",children:gt(i,s)},i))}),e[22]=s,e[23]=o,e[24]=B):B=e[24];let k;e[25]!==fe||e[26]!==xe?(k=fe!==null&&(0,t.jsx)(Pe,{error:xe,testId:"queues-error"}),e[25]=fe,e[26]=xe,e[27]=k):k=e[27];let Le=_&&(0,t.jsx)(Ue,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[L.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:L.map(St).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),Q>0&&(0,t.jsx)("p",{className:L.length>0?"text-muted-foreground":"font-medium",children:Q===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:Q})})]})}),O;e[28]!==S||e[29]!==N||e[30]!==o?(O=o==="declared"&&(0,t.jsx)(ft,{loaded:N!==void 0,queues:S}),e[28]=S,e[29]=N,e[30]=o,e[31]=O):O=e[31];let R;e[32]!==E||e[33]!==g||e[34]!==Qe||e[35]!==Ie||e[36]!==ge||e[37]!==o?(R=o==="messages"&&(0,t.jsx)(yt,{hasError:g!==null,messages:E,onClear:Qe,onReplay:Ie,replayingId:ge}),e[32]=E,e[33]=g,e[34]=Qe,e[35]=Ie,e[36]=ge,e[37]=o,e[38]=R):R=e[38];let J;e[39]!==U||e[40]!==T||e[41]!==I||e[42]!==Ce||e[43]!==ve||e[44]!==Se||e[45]!==qe||e[46]!==we||e[47]!==S||e[48]!==H||e[49]!==pe||e[50]!==o?(J=o==="send"&&(0,t.jsx)(Nt,{batchMode:U,bodyText:T,delayText:I,onBatchModeChange:Ce,onBodyChange:ve,onDelayChange:Se,onSelectExport:qe,onSend:we,queues:S,selectedExportName:H,sending:pe}),e[39]=U,e[40]=T,e[41]=I,e[42]=Ce,e[43]=ve,e[44]=Se,e[45]=qe,e[46]=we,e[47]=S,e[48]=H,e[49]=pe,e[50]=o,e[51]=J):J=e[51];let oe;return e[52]!==B||e[53]!==k||e[54]!==Le||e[55]!==O||e[56]!==R||e[57]!==J?(oe=(0,t.jsxs)("div",{className:tt,"data-testid":at,children:[B,k,Le,O,R,J]}),e[52]=B,e[53]=k,e[54]=Le,e[55]=O,e[56]=R,e[57]=J,e[58]=oe):oe=e[58],oe},"Ft");function bt(n){return(0,t.jsxs)(G,{"data-testid":`queues-row-${n.exportName}`,children:[(0,t.jsx)(w,{className:"font-mono text-xs",children:n.exportName}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.name}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.mode}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.binding}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.deadLetterQueue??"\u2014"})]},n.exportName)}h(bt,"xt");function qt(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}h(qt,"yt");function vt(n,e){return n.exportName.localeCompare(e.exportName)}h(vt,"bt");function St(n){return n.name}h(St,"Nt");export{Ft as default};
@@ -1,2 +1,2 @@
1
- import{a as fe}from"./chunk-2URQKGWU.js";import"./chunk-4JLGLPWV.js";import{a as ie}from"./chunk-MU3P2FI7.js";import{a as pe}from"./chunk-66UGPQVC.js";import"./chunk-3Q2P62UR.js";import{W as de}from"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as x}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as ne}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as he}from"./chunk-F7UZBTKS.js";import"./chunk-ULIQFBZU.js";import"./chunk-Y3G2ZPOD.js";import"./chunk-35DM4JJG.js";import{a as H}from"./chunk-4ZEL6BYL.js";import{c as ue}from"./chunk-D6UKRXIS.js";import{f as le}from"./chunk-VWWJIICI.js";import"./chunk-FSRSK4LY.js";import"./chunk-KSYIH3NO.js";import{a as ce}from"./chunk-FKVZRPV5.js";import{d as oe,f as Z,g as ee,h as te,o as ae,q as me,r as re}from"./chunk-FODLDLE2.js";import{a as i,d as Y,e as ge,f as ve,g as Ne,i as se}from"./chunk-YKXDMIHQ.js";var t=Y(Ne(),1);var xe=Y(ve(),1);var N=Y(ge(),1);function ye({className:a,orientation:e="horizontal",...s}){return(0,t.jsx)(ie,{"data-slot":"separator",orientation:e,className:se("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...s})}i(ye,"ge");var we=/https?:\/\/[^\s"'<>)]+/i,be=i(a=>a===void 0?void 0:we.exec(a)?.[0],"re"),y=i(a=>a===void 0?"":Array.isArray(a)?a.join(", "):a,"N"),Ce=i(a=>{if(a!==void 0)return be(a.html)??be(a.text)},"Ne"),ke=i((a,e)=>{let s=e.trim().toLowerCase();return s===""?a:a.filter(o=>`${o.subject} ${y(o.to)} ${y(o.cc)}`.toLowerCase().includes(s))},"we"),Se=i((a,e)=>{if(a.length!==0)return a.find(s=>s.id===e)??a[0]},"ye"),Te=Z(H.clearCapturedMail),Le=Z(H.sendTestMail),je=i(a=>{let e=(0,xe.c)(38),{limit:s}=a,o=le(),p;e[0]!==s?(p={limit:s},e[0]=s,e[1]=p):p=e[1];let{data:q,error:w,errorSource:C,isLoading:g,refetch:n}=ue(H.getCapturedMail,p),[k,f]=(0,N.useState)(null),[D,S]=(0,N.useState)(null),[v,l]=(0,N.useState)("html"),[c,P]=(0,N.useState)(""),b=q?.entries??[],r=w??k,u=w===null?k:C,T;e[2]!==o||e[3]!==n?(T=i(async()=>{f(null);try{await o.query(Te,{},ee("")),S(null),n()}catch(m){f(te(m))}},"T"),e[2]=o,e[3]=n,e[4]=T):T=e[4];let R=T,L;e[5]!==o||e[6]!==n?(L=i(async()=>{f(null);try{await o.query(Le,{},ee("")),n()}catch(m){f(te(m))}},"k"),e[5]=o,e[6]=n,e[7]=L):L=e[7];let W=L,j;e[8]!==n?(j=i(()=>{n()},"L"),e[8]=n,e[9]=j):j=e[9],pe(j,!0);let M;e[10]!==R?(M=i(()=>{ae(R())},"A"),e[10]=R,e[11]=M):M=e[11];let U=M,_;e[12]!==W?(_=i(()=>{ae(W())},"E"),e[12]=W,e[13]=_):_=e[13];let G=_,z;e[14]===Symbol.for("react.memo_cache_sentinel")?(z=i(m=>{P(m.currentTarget.value)},"_"),e[14]=z):z=e[14];let J=z,$;e[15]===Symbol.for("react.memo_cache_sentinel")?($=i(m=>{let{id:h}=m.currentTarget.dataset;h!==void 0&&S(h)},"M"),e[15]=$):$=e[15];let K=$,A;e[16]===Symbol.for("react.memo_cache_sentinel")?(A=i(m=>{let h=m.currentTarget.dataset.tab;(h==="headers"||h==="html"||h==="text")&&l(h)},"j"),e[16]=A):A=e[16];let Q=A,F=ke(b,c),O=Se(F,D),d=Ce(O),I;e[17]!==d?(I=i(()=>{d!==void 0&&me(d)},"z"),e[17]=d,e[18]=I):I=e[18];let V=I,B;e[19]!==d?(B=i(()=>{d!==void 0&&"window"in globalThis&&globalThis.window.open(d,"_blank","noopener")},"F"),e[19]=d,e[20]=B):B=e[20];let X=B,E;return e[21]!==b||e[22]!==r||e[23]!==u||e[24]!==c||e[25]!==g||e[26]!==d||e[27]!==U||e[28]!==V||e[29]!==J||e[30]!==X||e[31]!==K||e[32]!==Q||e[33]!==G||e[34]!==O||e[35]!==v||e[36]!==F?(E={entries:b,error:r,errorSource:u,filter:c,isLoading:g,link:d,onClear:U,onCopyLink:V,onFilterChange:J,onOpenLink:X,onSelectMessage:K,onSelectTab:Q,onSendTest:G,selected:O,tab:v,visible:F},e[21]=b,e[22]=r,e[23]=u,e[24]=c,e[25]=g,e[26]=d,e[27]=U,e[28]=V,e[29]=J,e[30]=X,e[31]=K,e[32]=Q,e[33]=G,e[34]=O,e[35]=v,e[36]=F,e[37]=E):E=e[37],E},"Te"),Me=`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:">`,_e=i(a=>`${Me}${a}`,"Le"),Je=i(({limit:a=100})=>{let e=oe(),{entries:s,error:o,errorSource:p,filter:q,isLoading:w,link:C,onClear:g,onCopyLink:n,onFilterChange:k,onOpenLink:f,onSelectMessage:D,onSelectTab:S,onSendTest:v,selected:l,tab:c,visible:P}=je({limit:a}),b=i(r=>e(r==="html"?"HTML":r==="text"?"Plain text":"Headers"),"b");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mail-panel",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(x,{"data-testid":"mail-send-test",onClick:v,size:"sm",type:"button",variant:"outline",children:e("Send test")}),(0,t.jsx)(x,{"data-testid":"mail-clear",disabled:s.length===0,onClick:g,size:"sm",type:"button",variant:"outline",children:e("Clear inbox")}),s.length>0&&(0,t.jsx)(ne,{className:"ml-auto","data-testid":"mail-count",variant:"secondary",children:e("{count} messages",{count:s.length})})]}),o!==null&&(0,t.jsx)(he,{error:p,testId:"mail-error"}),o===null&&!w&&s.length===0&&(0,t.jsx)(ce,{description:e("Email your app sends in dev is captured here \u2014 nothing is delivered."),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)("path",{d:"M4 5h16v14H4z"}),(0,t.jsx)("path",{d:"m4 6 8 6 8-6"})]}),testId:"mail-empty",title:e("No captured email.")}),s.length>0&&(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,22rem)_1fr]","data-testid":"mail-reader",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(de,{"aria-label":e("Search messages"),"data-testid":"mail-search",onChange:k,placeholder:e("Filter messages"),type:"search",value:q}),(0,t.jsx)(fe,{className:"max-h-[32rem] rounded-xl border border-border bg-card shadow-xs","data-testid":"mail-list",children:(0,t.jsx)("ul",{className:"divide-y",children:P.map(r=>{let u=r.id===l?.id;return(0,t.jsx)("li",{children:(0,t.jsxs)("button",{className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-sm hover:bg-muted/60 ${u?"bg-muted":""}`,"data-active":u,"data-id":r.id,"data-testid":"mail-list-item",onClick:D,type:"button",children:[(0,t.jsx)("span",{className:"w-full truncate font-medium",children:r.subject||e("(no subject)")}),(0,t.jsx)("span",{className:"w-full truncate text-xs text-muted-foreground",children:y(r.to)}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:re(r.capturedAt,"\u2014")})]})},r.id)})})})]}),l!==void 0&&(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"mail-detail",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"truncate text-base font-semibold","data-testid":"mail-subject",children:l.subject||e("(no subject)")}),(0,t.jsxs)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground",children:[(0,t.jsx)("dt",{children:e("From")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:l.from??"\u2014"}),(0,t.jsx)("dt",{children:e("To")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:y(l.to)}),l.cc!==void 0&&l.cc.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("dt",{children:e("Cc")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:y(l.cc)})]}),(0,t.jsx)("dt",{children:e("Sent")}),(0,t.jsx)("dd",{className:"tabular-nums",children:re(l.capturedAt,"\u2014")})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"mail-actions",children:[(0,t.jsx)(x,{"data-testid":"mail-copy-link",disabled:C===void 0,onClick:n,size:"sm",type:"button",variant:"outline",children:e("Copy link")}),(0,t.jsx)(x,{"data-testid":"mail-open-link",disabled:C===void 0,onClick:f,size:"sm",type:"button",variant:"outline",children:e("Open in new tab")})]}),(0,t.jsx)(ye,{}),(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"mail-tabs",role:"tablist",children:["html","text","headers"].map(r=>(0,t.jsx)(x,{"aria-selected":c===r,"data-tab":r,"data-testid":`mail-tab-${r}`,onClick:S,role:"tab",size:"sm",type:"button",variant:c===r?"secondary":"ghost",children:b(r)},r))}),(0,t.jsxs)("div",{className:"min-h-[12rem]",children:[c==="html"&&(l.html===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No HTML body.")}):(0,t.jsx)("iframe",{className:"h-[24rem] w-full rounded-md border bg-white","data-testid":"mail-preview-html",sandbox:"",srcDoc:_e(l.html),title:e("Email preview")})),c==="text"&&(l.text===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No text body.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-text",children:l.text})),c==="headers"&&(l.headers===void 0||Object.keys(l.headers).length===0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No headers.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-headers",children:Object.entries(l.headers).map(([r,u])=>`${r}: ${u}`).join(`
1
+ import{a as fe}from"./chunk-2URQKGWU.js";import"./chunk-4JLGLPWV.js";import{a as ie}from"./chunk-MU3P2FI7.js";import{a as pe}from"./chunk-66UGPQVC.js";import"./chunk-3Q2P62UR.js";import{W as de}from"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as x}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as ne}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as he}from"./chunk-OQM3I5XY.js";import"./chunk-ULIQFBZU.js";import"./chunk-CX5PIWVR.js";import"./chunk-35DM4JJG.js";import{a as H}from"./chunk-4ZEL6BYL.js";import{c as ue}from"./chunk-KIKAXEXE.js";import{f as le}from"./chunk-PPUG6WPN.js";import"./chunk-FSRSK4LY.js";import"./chunk-2Y6PXGIS.js";import{a as ce}from"./chunk-FKVZRPV5.js";import{d as oe,f as Z,g as ee,h as te,o as ae,q as me,r as re}from"./chunk-FODLDLE2.js";import{a as i,d as Y,e as ge,f as ve,g as Ne,i as se}from"./chunk-YKXDMIHQ.js";var t=Y(Ne(),1);var xe=Y(ve(),1);var N=Y(ge(),1);function ye({className:a,orientation:e="horizontal",...s}){return(0,t.jsx)(ie,{"data-slot":"separator",orientation:e,className:se("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...s})}i(ye,"ge");var we=/https?:\/\/[^\s"'<>)]+/i,be=i(a=>a===void 0?void 0:we.exec(a)?.[0],"re"),y=i(a=>a===void 0?"":Array.isArray(a)?a.join(", "):a,"N"),Ce=i(a=>{if(a!==void 0)return be(a.html)??be(a.text)},"Ne"),ke=i((a,e)=>{let s=e.trim().toLowerCase();return s===""?a:a.filter(o=>`${o.subject} ${y(o.to)} ${y(o.cc)}`.toLowerCase().includes(s))},"we"),Se=i((a,e)=>{if(a.length!==0)return a.find(s=>s.id===e)??a[0]},"ye"),Te=Z(H.clearCapturedMail),Le=Z(H.sendTestMail),je=i(a=>{let e=(0,xe.c)(38),{limit:s}=a,o=le(),p;e[0]!==s?(p={limit:s},e[0]=s,e[1]=p):p=e[1];let{data:q,error:w,errorSource:C,isLoading:g,refetch:n}=ue(H.getCapturedMail,p),[k,f]=(0,N.useState)(null),[D,S]=(0,N.useState)(null),[v,l]=(0,N.useState)("html"),[c,P]=(0,N.useState)(""),b=q?.entries??[],r=w??k,u=w===null?k:C,T;e[2]!==o||e[3]!==n?(T=i(async()=>{f(null);try{await o.query(Te,{},ee("")),S(null),n()}catch(m){f(te(m))}},"T"),e[2]=o,e[3]=n,e[4]=T):T=e[4];let R=T,L;e[5]!==o||e[6]!==n?(L=i(async()=>{f(null);try{await o.query(Le,{},ee("")),n()}catch(m){f(te(m))}},"k"),e[5]=o,e[6]=n,e[7]=L):L=e[7];let W=L,j;e[8]!==n?(j=i(()=>{n()},"L"),e[8]=n,e[9]=j):j=e[9],pe(j,!0);let M;e[10]!==R?(M=i(()=>{ae(R())},"A"),e[10]=R,e[11]=M):M=e[11];let U=M,_;e[12]!==W?(_=i(()=>{ae(W())},"E"),e[12]=W,e[13]=_):_=e[13];let G=_,z;e[14]===Symbol.for("react.memo_cache_sentinel")?(z=i(m=>{P(m.currentTarget.value)},"_"),e[14]=z):z=e[14];let J=z,$;e[15]===Symbol.for("react.memo_cache_sentinel")?($=i(m=>{let{id:h}=m.currentTarget.dataset;h!==void 0&&S(h)},"M"),e[15]=$):$=e[15];let K=$,A;e[16]===Symbol.for("react.memo_cache_sentinel")?(A=i(m=>{let h=m.currentTarget.dataset.tab;(h==="headers"||h==="html"||h==="text")&&l(h)},"j"),e[16]=A):A=e[16];let Q=A,F=ke(b,c),O=Se(F,D),d=Ce(O),I;e[17]!==d?(I=i(()=>{d!==void 0&&me(d)},"z"),e[17]=d,e[18]=I):I=e[18];let V=I,B;e[19]!==d?(B=i(()=>{d!==void 0&&"window"in globalThis&&globalThis.window.open(d,"_blank","noopener")},"F"),e[19]=d,e[20]=B):B=e[20];let X=B,E;return e[21]!==b||e[22]!==r||e[23]!==u||e[24]!==c||e[25]!==g||e[26]!==d||e[27]!==U||e[28]!==V||e[29]!==J||e[30]!==X||e[31]!==K||e[32]!==Q||e[33]!==G||e[34]!==O||e[35]!==v||e[36]!==F?(E={entries:b,error:r,errorSource:u,filter:c,isLoading:g,link:d,onClear:U,onCopyLink:V,onFilterChange:J,onOpenLink:X,onSelectMessage:K,onSelectTab:Q,onSendTest:G,selected:O,tab:v,visible:F},e[21]=b,e[22]=r,e[23]=u,e[24]=c,e[25]=g,e[26]=d,e[27]=U,e[28]=V,e[29]=J,e[30]=X,e[31]=K,e[32]=Q,e[33]=G,e[34]=O,e[35]=v,e[36]=F,e[37]=E):E=e[37],E},"Te"),Me=`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:">`,_e=i(a=>`${Me}${a}`,"Le"),Je=i(({limit:a=100})=>{let e=oe(),{entries:s,error:o,errorSource:p,filter:q,isLoading:w,link:C,onClear:g,onCopyLink:n,onFilterChange:k,onOpenLink:f,onSelectMessage:D,onSelectTab:S,onSendTest:v,selected:l,tab:c,visible:P}=je({limit:a}),b=i(r=>e(r==="html"?"HTML":r==="text"?"Plain text":"Headers"),"b");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mail-panel",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(x,{"data-testid":"mail-send-test",onClick:v,size:"sm",type:"button",variant:"outline",children:e("Send test")}),(0,t.jsx)(x,{"data-testid":"mail-clear",disabled:s.length===0,onClick:g,size:"sm",type:"button",variant:"outline",children:e("Clear inbox")}),s.length>0&&(0,t.jsx)(ne,{className:"ml-auto","data-testid":"mail-count",variant:"secondary",children:e("{count} messages",{count:s.length})})]}),o!==null&&(0,t.jsx)(he,{error:p,testId:"mail-error"}),o===null&&!w&&s.length===0&&(0,t.jsx)(ce,{description:e("Email your app sends in dev is captured here \u2014 nothing is delivered."),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)("path",{d:"M4 5h16v14H4z"}),(0,t.jsx)("path",{d:"m4 6 8 6 8-6"})]}),testId:"mail-empty",title:e("No captured email.")}),s.length>0&&(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,22rem)_1fr]","data-testid":"mail-reader",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(de,{"aria-label":e("Search messages"),"data-testid":"mail-search",onChange:k,placeholder:e("Filter messages"),type:"search",value:q}),(0,t.jsx)(fe,{className:"max-h-[32rem] rounded-xl border border-border bg-card shadow-xs","data-testid":"mail-list",children:(0,t.jsx)("ul",{className:"divide-y",children:P.map(r=>{let u=r.id===l?.id;return(0,t.jsx)("li",{children:(0,t.jsxs)("button",{className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-sm hover:bg-muted/60 ${u?"bg-muted":""}`,"data-active":u,"data-id":r.id,"data-testid":"mail-list-item",onClick:D,type:"button",children:[(0,t.jsx)("span",{className:"w-full truncate font-medium",children:r.subject||e("(no subject)")}),(0,t.jsx)("span",{className:"w-full truncate text-xs text-muted-foreground",children:y(r.to)}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:re(r.capturedAt,"\u2014")})]})},r.id)})})})]}),l!==void 0&&(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"mail-detail",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"truncate text-base font-semibold","data-testid":"mail-subject",children:l.subject||e("(no subject)")}),(0,t.jsxs)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground",children:[(0,t.jsx)("dt",{children:e("From")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:l.from??"\u2014"}),(0,t.jsx)("dt",{children:e("To")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:y(l.to)}),l.cc!==void 0&&l.cc.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("dt",{children:e("Cc")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:y(l.cc)})]}),(0,t.jsx)("dt",{children:e("Sent")}),(0,t.jsx)("dd",{className:"tabular-nums",children:re(l.capturedAt,"\u2014")})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"mail-actions",children:[(0,t.jsx)(x,{"data-testid":"mail-copy-link",disabled:C===void 0,onClick:n,size:"sm",type:"button",variant:"outline",children:e("Copy link")}),(0,t.jsx)(x,{"data-testid":"mail-open-link",disabled:C===void 0,onClick:f,size:"sm",type:"button",variant:"outline",children:e("Open in new tab")})]}),(0,t.jsx)(ye,{}),(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"mail-tabs",role:"tablist",children:["html","text","headers"].map(r=>(0,t.jsx)(x,{"aria-selected":c===r,"data-tab":r,"data-testid":`mail-tab-${r}`,onClick:S,role:"tab",size:"sm",type:"button",variant:c===r?"secondary":"ghost",children:b(r)},r))}),(0,t.jsxs)("div",{className:"min-h-[12rem]",children:[c==="html"&&(l.html===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No HTML body.")}):(0,t.jsx)("iframe",{className:"h-[24rem] w-full rounded-md border bg-white","data-testid":"mail-preview-html",sandbox:"",srcDoc:_e(l.html),title:e("Email preview")})),c==="text"&&(l.text===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No text body.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-text",children:l.text})),c==="headers"&&(l.headers===void 0||Object.keys(l.headers).length===0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No headers.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-headers",children:Object.entries(l.headers).map(([r,u])=>`${r}: ${u}`).join(`
2
2
  `)}))]})]})]})]})},"We");export{Je as MailPanel};