@lunora/studio 1.0.0-alpha.243 → 1.0.0-alpha.245

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 (69) hide show
  1. package/dist/packem_chunks/queues-panel.mjs +1 -1
  2. package/dist/packem_chunks/workflows-panel.mjs +1 -1
  3. package/dist/standalone/{chunk-EF5EP4H4.js → chunk-2M6HDLZL.js} +1 -1
  4. package/dist/standalone/{chunk-5EKU6J7E.js → chunk-435IWCIW.js} +1 -1
  5. package/dist/standalone/{chunk-BDITYO6M.js → chunk-4E6W2IDP.js} +1 -1
  6. package/dist/standalone/{chunk-QA2B3HWI.js → chunk-5AAHUEQD.js} +1 -1
  7. package/dist/standalone/{chunk-5NVDRSFP.js → chunk-5MGCPNPF.js} +1 -1
  8. package/dist/standalone/{chunk-JFC25AES.js → chunk-6QPTJCQA.js} +1 -1
  9. package/dist/standalone/{chunk-LYTWR224.js → chunk-6XKPY5RJ.js} +1 -1
  10. package/dist/standalone/{chunk-FU6KXKCY.js → chunk-AAXLEHDI.js} +1 -1
  11. package/dist/standalone/{chunk-64XGCH2E.js → chunk-ATOGOQKD.js} +1 -1
  12. package/dist/standalone/{chunk-JOVONUS6.js → chunk-AVRH4ZBT.js} +1 -1
  13. package/dist/standalone/{chunk-76QJJLPM.js → chunk-AVXGLRYX.js} +1 -1
  14. package/dist/standalone/{chunk-I7XX4RBG.js → chunk-B5NQHH5M.js} +1 -1
  15. package/dist/standalone/{chunk-Z24BPRKD.js → chunk-BKGZMIF3.js} +1 -1
  16. package/dist/standalone/{chunk-TUAO4PU2.js → chunk-BLAZ5733.js} +1 -1
  17. package/dist/standalone/{chunk-5KBJZ4Y3.js → chunk-C3M6CCOV.js} +1 -1
  18. package/dist/standalone/{chunk-GI6VG5KL.js → chunk-CAHTJYC5.js} +1 -1
  19. package/dist/standalone/{chunk-JUFPH3CX.js → chunk-DEDFT62S.js} +1 -1
  20. package/dist/standalone/{chunk-OOTQQBVC.js → chunk-DKTDJOYC.js} +1 -1
  21. package/dist/standalone/{chunk-4QUB5WPV.js → chunk-EUEWGG46.js} +1 -1
  22. package/dist/standalone/{chunk-YERR37A2.js → chunk-FBPF5WYL.js} +1 -1
  23. package/dist/standalone/{chunk-YEKI5KIW.js → chunk-GMHY2XTC.js} +1 -1
  24. package/dist/standalone/{chunk-TI33XMKX.js → chunk-GUD3ZG3Z.js} +1 -1
  25. package/dist/standalone/{chunk-7JGTUSOT.js → chunk-GZT3A3DF.js} +1 -1
  26. package/dist/standalone/{chunk-ZCBZMZ7W.js → chunk-HHUH2AEG.js} +1 -1
  27. package/dist/standalone/{chunk-4MCQC7BJ.js → chunk-HMGKAEPK.js} +1 -1
  28. package/dist/standalone/chunk-HQFXXC33.js +1 -0
  29. package/dist/standalone/{chunk-PW5YXLOU.js → chunk-HW33JZQP.js} +1 -1
  30. package/dist/standalone/{chunk-UIXGA3LA.js → chunk-IVKVGV4Y.js} +1 -1
  31. package/dist/standalone/{chunk-JDBKYSJB.js → chunk-IVQFP5JU.js} +1 -1
  32. package/dist/standalone/{chunk-NJUFB27M.js → chunk-JNAZOBTV.js} +1 -1
  33. package/dist/standalone/{chunk-O7BPLDZ6.js → chunk-JSPFPDQ6.js} +1 -1
  34. package/dist/standalone/{chunk-S5JZR7QX.js → chunk-KMLJSWTP.js} +1 -1
  35. package/dist/standalone/{chunk-ZL3PYVET.js → chunk-KQQVI6ZS.js} +1 -1
  36. package/dist/standalone/{chunk-JQA7JSU6.js → chunk-KVSSLKGK.js} +1 -1
  37. package/dist/standalone/{chunk-ABI4UTMQ.js → chunk-KZ7UVPF6.js} +1 -1
  38. package/dist/standalone/{chunk-MJOIEIF4.js → chunk-LB4Y3C7N.js} +1 -1
  39. package/dist/standalone/{chunk-HJSSAZOB.js → chunk-MEV2FUUD.js} +1 -1
  40. package/dist/standalone/{chunk-KY2LM7KA.js → chunk-MLFPYQNL.js} +1 -1
  41. package/dist/standalone/{chunk-K2OCBRZU.js → chunk-N3DFLRGG.js} +1 -1
  42. package/dist/standalone/{chunk-N5WACH4X.js → chunk-NPT4MKTL.js} +1 -1
  43. package/dist/standalone/{chunk-DX62WXRQ.js → chunk-NSCZ3RJ3.js} +1 -1
  44. package/dist/standalone/{chunk-APFGNPBU.js → chunk-OD7E3QLZ.js} +1 -1
  45. package/dist/standalone/{chunk-WQJEBARW.js → chunk-OGFQ4LUG.js} +1 -1
  46. package/dist/standalone/{chunk-2HY4GAQY.js → chunk-OSOMPF2M.js} +1 -1
  47. package/dist/standalone/{chunk-V4LBYSX2.js → chunk-PQWCYQGZ.js} +1 -1
  48. package/dist/standalone/chunk-PUGHZTBL.js +15 -0
  49. package/dist/standalone/{chunk-M3EMYLKT.js → chunk-Q2G3FQMR.js} +1 -1
  50. package/dist/standalone/{chunk-EOJGY4KT.js → chunk-QROMT56V.js} +1 -1
  51. package/dist/standalone/{chunk-N4JXPUC7.js → chunk-SI6U7NIE.js} +1 -1
  52. package/dist/standalone/{chunk-X3LPHVDL.js → chunk-T6OJSDQH.js} +1 -1
  53. package/dist/standalone/chunk-TDD2TZCN.js +1 -0
  54. package/dist/standalone/{chunk-RECJHPFD.js → chunk-TESQ5ZIA.js} +1 -1
  55. package/dist/standalone/{chunk-GSP2UBRG.js → chunk-VTMPJ7GE.js} +1 -1
  56. package/dist/standalone/{chunk-RKP6Y74Y.js → chunk-WB5OMGYR.js} +2 -2
  57. package/dist/standalone/{chunk-3FRJI6NR.js → chunk-WMD6QHHD.js} +1 -1
  58. package/dist/standalone/{chunk-Q3IUNFQF.js → chunk-XIL7BLJ5.js} +1 -1
  59. package/dist/standalone/{chunk-LDQV5EKL.js → chunk-XNRRHFOY.js} +1 -1
  60. package/dist/standalone/{chunk-AD6LC5L4.js → chunk-Y5KK6IM3.js} +1 -1
  61. package/dist/standalone/{chunk-RPJEAHAZ.js → chunk-ZDPY27UY.js} +1 -1
  62. package/dist/standalone/{chunk-TIYNL2DI.js → chunk-ZIE7D6ZS.js} +1 -1
  63. package/dist/standalone/{chunk-SXGEDI37.js → chunk-ZZ24NI6P.js} +1 -1
  64. package/dist/standalone/{chunk-MPXKLN5U.js → chunk-ZZJE2GV3.js} +1 -1
  65. package/dist/standalone/studio.js +1 -1
  66. package/package.json +6 -6
  67. package/dist/standalone/chunk-KASEJ6PD.js +0 -1
  68. package/dist/standalone/chunk-MB35H5WR.js +0 -1
  69. package/dist/standalone/chunk-NPF3GY2E.js +0 -15
@@ -1 +1 @@
1
- import{c as G}from"react/compiler-runtime";import{useLunora as Ve}from"@lunora/react";import{useState as M}from"react";import{ConfirmButton as Ye}from"../packem_shared/ConfirmButton-DU4p72Er.mjs";import{E as Xe}from"../packem_shared/error-alert-DueSEkt-.mjs";import{A as Ke}from"../packem_shared/alert-PB5W11MM.mjs";import{B as ve}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as we}from"../packem_shared/button-q0UYSmrn.mjs";import{C as $e,a as Oe}from"../packem_shared/card-By2O8ULa.mjs";import{E as Qe}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as Ze}from"../packem_shared/input-CXhxesPC.mjs";import{S as et}from"../packem_shared/scroll-area-CXCQH7VT.mjs";import{T as ke,a as Ue,b as oe,c as _,d as Je,e as T}from"../packem_shared/table-D0SBiDu-.mjs";import{T as tt}from"../packem_shared/textarea--40GKAyz.mjs";import{u as Be}from"../packem_shared/use-admin-query-tlBof8Yg.mjs";import{useAutoRefresh as st}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";import{useT as P}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as W}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{d as _e,b as Te,c as Ae,f as Ce,h as at,j as rt}from"../packem_shared/internal-Df43vQI0.mjs";import{jsx as s,jsxs as q,Fragment as Fe}from"react/jsx-runtime";const nt=(n,e)=>{const t=new Set(n.map(a=>a.deadLetterQueue).filter(a=>typeof a=="string"&&a!=="")),i=n.filter(a=>(a.deadLetterQueue===void 0||a.deadLetterQueue==="")&&!t.has(a.name)),l=e.filter(a=>a.deadLettered).length;return{deadLetteredCount:l,queuesWithoutDlq:i,showReliabilityWarning:i.length>0||l>0}},ot=200,lt=Ae(W.sendQueueMessage),dt=Ae(W.replayQueueMessage),it=Ae(W.clearQueueMessages),Re=96,ct=n=>{if(n===void 0)return"—";try{return JSON.stringify(n,rt)}catch{return"[unserializable]"}},ut=n=>n.length>Re?`${n.slice(0,Re)}…`:n,mt=n=>n==="error"?"destructive":n==="retry"?"outline":"secondary",ft=(n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),ht=n=>{const e=G(11),{loaded:t,queues:i}=n,l=P();let a;e[0]!==l?(a=l("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]=l,e[1]=a):a=e[1];let o;e[2]!==a?(o=s("p",{className:"text-sm text-muted-foreground",children:a}),e[2]=a,e[3]=o):o=e[3];let r;e[4]!==t||e[5]!==i||e[6]!==l?(r=t&&i.length===0?s(Qe,{description:l("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:l("No queues defined")}):s($e,{className:"overflow-hidden py-0",children:s(Oe,{className:"px-0",children:q(ke,{"data-testid":"queues-table",children:[s(Ue,{children:q(oe,{children:[s(_,{children:l("Export")}),s(_,{children:l("Queue")}),s(_,{children:l("Mode")}),s(_,{children:l("Binding")}),s(_,{children:l("Dead-letter")})]})}),s(Je,{children:i.map(yt)})]})})}),e[4]=t,e[5]=i,e[6]=l,e[7]=r):r=e[7];let f;return e[8]!==o||e[9]!==r?(f=q("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[o,r]}),e[8]=o,e[9]=r,e[10]=f):f=e[10],f},pt=n=>{const e=G(67),{message:t,onReplay:i,replayingId:l}=n,a=P();let o,r,f,u,g,y,x,d,m,p;if(e[0]!==t.attempts||e[1]!==t.body||e[2]!==t.deadLettered||e[3]!==t.exportName||e[4]!==t.id||e[5]!==t.messageId||e[6]!==t.outcome||e[7]!==t.queue||e[8]!==a){const U=ct(t.body);r=oe,y=`queues-message-${t.id}`;const J=t.exportName??t.queue;e[19]!==J?(x=s(T,{className:"font-mono text-xs",children:J}),e[19]=J,e[20]=x):x=e[20],e[21]!==t.messageId?(d=s(T,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:t.messageId,children:t.messageId}),e[21]=t.messageId,e[22]=d):d=e[22],e[23]!==t.attempts?(m=s(T,{className:"font-mono text-xs tabular-nums",children:t.attempts}),e[23]=t.attempts,e[24]=m):m=e[24];const A=`queues-outcome-${t.id}`;let I;e[25]!==t.outcome?(I=mt(t.outcome),e[25]=t.outcome,e[26]=I):I=e[26];let C;e[27]!==t.outcome||e[28]!==A||e[29]!==I?(C=s(ve,{"data-testid":A,variant:I,children:t.outcome}),e[27]=t.outcome,e[28]=A,e[29]=I,e[30]=C):C=e[30];let L;e[31]!==t.deadLettered||e[32]!==t.id||e[33]!==a?(L=t.deadLettered&&s(ve,{"data-testid":`queues-dlq-${t.id}`,variant:"destructive",children:a("DLQ")}),e[31]=t.deadLettered,e[32]=t.id,e[33]=a,e[34]=L):L=e[34],e[35]!==C||e[36]!==L?(p=s(T,{children:q("span",{className:"inline-flex items-center gap-1",children:[C,L]})}),e[35]=C,e[36]=L,e[37]=p):p=e[37],o=T,f="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",u=U,g=ut(U),e[0]=t.attempts,e[1]=t.body,e[2]=t.deadLettered,e[3]=t.exportName,e[4]=t.id,e[5]=t.messageId,e[6]=t.outcome,e[7]=t.queue,e[8]=a,e[9]=o,e[10]=r,e[11]=f,e[12]=u,e[13]=g,e[14]=y,e[15]=x,e[16]=d,e[17]=m,e[18]=p}else o=e[9],r=e[10],f=e[11],u=e[12],g=e[13],y=e[14],x=e[15],d=e[16],m=e[17],p=e[18];let h;e[38]!==o||e[39]!==f||e[40]!==u||e[41]!==g?(h=s(o,{className:f,title:u,children:g}),e[38]=o,e[39]=f,e[40]=u,e[41]=g,e[42]=h):h=e[42];let N;e[43]!==t.capturedAt?(N=at(t.capturedAt,"—"),e[43]=t.capturedAt,e[44]=N):N=e[44];let b;e[45]!==N?(b=s(T,{className:"text-xs text-muted-foreground tabular-nums",children:N}),e[45]=N,e[46]=b):b=e[46];const E=`queues-replay-${t.id}`,Q=l!==null;let v;e[47]!==t.id||e[48]!==l||e[49]!==a?(v=l===t.id?a("Replaying…"):a("Replay"),e[47]=t.id,e[48]=l,e[49]=a,e[50]=v):v=e[50];let w;e[51]!==t.id||e[52]!==i||e[53]!==E||e[54]!==Q||e[55]!==v?(w=s(T,{children:s(we,{"data-id":t.id,"data-testid":E,disabled:Q,onClick:i,size:"xs",type:"button",variant:"outline",children:v})}),e[51]=t.id,e[52]=i,e[53]=E,e[54]=Q,e[55]=v,e[56]=w):w=e[56];let D;return e[57]!==r||e[58]!==b||e[59]!==w||e[60]!==y||e[61]!==x||e[62]!==d||e[63]!==m||e[64]!==p||e[65]!==h?(D=q(r,{"data-testid":y,children:[x,d,m,p,h,b,w]}),e[57]=r,e[58]=b,e[59]=w,e[60]=y,e[61]=x,e[62]=d,e[63]=m,e[64]=p,e[65]=h,e[66]=D):D=e[66],D},gt=n=>{const e=G(29),{hasError:t,messages:i,onClear:l,onReplay:a,replayingId:o}=n,r=P();let f;e[0]!==r?(f=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed — not pending depth."),e[0]=r,e[1]=f):f=e[1];let u;e[2]!==f?(u=s("p",{className:"text-sm text-muted-foreground",children:f}),e[2]=f,e[3]=u):u=e[3];let g;e[4]!==r?(g=r("Clear the whole message log?"),e[4]=r,e[5]=g):g=e[5];const y=i.length===0;let x;e[6]!==r?(x=r("Clear log"),e[6]=r,e[7]=x):x=e[7];let d;e[8]!==l||e[9]!==g||e[10]!==y||e[11]!==x?(d=s("div",{className:"ml-auto",children:s(Ye,{confirmLabel:g,disabled:y,onConfirm:l,testId:"queues-clear",children:x})}),e[8]=l,e[9]=g,e[10]=y,e[11]=x,e[12]=d):d=e[12];let m;e[13]!==i.length||e[14]!==r?(m=i.length>0&&s(ve,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:i.length})}),e[13]=i.length,e[14]=r,e[15]=m):m=e[15];let p;e[16]!==u||e[17]!==d||e[18]!==m?(p=q("div",{className:"flex flex-wrap items-center gap-2",children:[u,d,m]}),e[16]=u,e[17]=d,e[18]=m,e[19]=p):p=e[19];let h;e[20]!==t||e[21]!==i||e[22]!==a||e[23]!==o||e[24]!==r?(h=!t&&i.length===0?s(Qe,{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.")}):s($e,{className:"overflow-hidden py-0",children:s(Oe,{className:"px-0",children:s(et,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:q(ke,{"data-testid":"queues-messages-table",children:[s(Ue,{children:q(oe,{children:[s(_,{children:r("Export")}),s(_,{children:r("Message")}),s(_,{children:r("Attempts")}),s(_,{children:r("Outcome")}),s(_,{children:r("Body")}),s(_,{children:r("Captured")}),s(_,{})]})}),s(Je,{children:i.map(b=>s(pt,{message:b,onReplay:a,replayingId:o},b.id))})]})})})}),e[20]=t,e[21]=i,e[22]=a,e[23]=o,e[24]=r,e[25]=h):h=e[25];let N;return e[26]!==p||e[27]!==h?(N=q("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[p,h]}),e[26]=p,e[27]=h,e[28]=N):N=e[28],N},xt=n=>{const e=G(20),{batchMode:t,bodyText:i,delayText:l,onBatchModeChange:a,onBodyChange:o,onDelayChange:r,onSelectExport:f,onSend:u,queues:g,selectedExportName:y,sending:x}=n,d=P();let m;e[0]!==d?(m=d("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=d,e[1]=m):m=e[1];let p;e[2]!==m?(p=s("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=p):p=e[3];let h;e[4]!==t||e[5]!==i||e[6]!==l||e[7]!==a||e[8]!==o||e[9]!==r||e[10]!==f||e[11]!==u||e[12]!==g||e[13]!==y||e[14]!==x||e[15]!==d?(h=g.length===0?s(Qe,{description:d("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:d("No queues to send to")}):q(Fe,{children:[q("div",{className:"flex flex-wrap items-center gap-2",children:[s("select",{"aria-label":d("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:f,value:y,children:g.map(bt)}),s(Ze,{"aria-label":d("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:d("Delay (s)"),type:"number",value:l}),q("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[s("input",{checked:t,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:a,type:"checkbox"}),d("Send as batch (JSON array)")]}),s(we,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||y==="",onClick:u,type:"button",children:d(x?"Sending…":"Send message")})]}),s(tt,{"aria-label":d("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:o,placeholder:t?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:i})]}),e[4]=t,e[5]=i,e[6]=l,e[7]=a,e[8]=o,e[9]=r,e[10]=f,e[11]=u,e[12]=g,e[13]=y,e[14]=x,e[15]=d,e[16]=h):h=e[16];let N;return e[17]!==p||e[18]!==h?(N=q("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[p,h]}),e[17]=p,e[18]=h,e[19]=N):N=e[19],N},jt=n=>{const e=G(59),{limit:t}=n,i=t??ot,l=Ve(),a=P(),[o,r]=M("declared"),[f,u]=M(null);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={},e[0]=g):g=e[0];const{data:y,error:x,errorSource:d}=Be(W.listQueues,g);let m;e[1]!==i?(m={limit:i},e[1]=i,e[2]=m):m=e[2];const{data:p,error:h,errorSource:N,refetch:b}=Be(W.getQueueMessages,m),E=Array.isArray(y?.queues)?[...y.queues].toSorted(Nt):[],Q=p?.entries??[],{deadLetteredCount:v,queuesWithoutDlq:w,showReliabilityWarning:D}=nt(E,Q),[U,J]=M(""),[A,I]=M(""),[C,L]=M(""),[F,je]=M(!1),[le,Ie]=M(!1),[de,Le]=M(null),z=E.some(c=>c.exportName===U)?U:E[0]?.exportName??"",Me=o==="messages"?h:x,We=o==="messages"?N:d,ie=Me??f,ce=Me===null?f:We;let H;e[3]!==b?(H=()=>{b()},e[3]=b,e[4]=H):H=e[4],st(H,o==="messages");const ue=async()=>{u(null);const c=z;if(c==="")return;let S=null;const Se=A.trim();if(Se!=="")try{S=JSON.parse(Se)}catch{u(a("Body must be valid JSON."));return}let Ee;const De=C.trim();if(De!==""){const j=Number(De);if(!Number.isFinite(j)||j<0){u(a("Delay must be a non-negative number of seconds."));return}Ee=j}if(F&&!Array.isArray(S)){u(a("Batch mode needs a JSON array body — each element is enqueued as one message."));return}Ie(!0);const He=F?{batch:S,delaySeconds:Ee,exportName:c}:{body:S,delaySeconds:Ee,exportName:c};try{await l.query(lt,He,_e("")),b()}catch(j){u(Te(j))}Ie(!1)};let V;e[5]!==l||e[6]!==b?(V=async c=>{u(null),Le(c);try{await l.query(dt,{id:c},_e("")),b()}catch(S){u(Te(S))}Le(null)},e[5]=l,e[6]=b,e[7]=V):V=e[7];const me=V;let Y;e[8]!==l||e[9]!==b?(Y=async()=>{u(null);try{await l.query(it,{},_e("")),b()}catch(c){u(Te(c))}},e[8]=l,e[9]=b,e[10]=Y):Y=e[10];const fe=Y;let X;e[11]===Symbol.for("react.memo_cache_sentinel")?(X=c=>{const S=c.currentTarget.dataset.tab;(S==="declared"||S==="messages"||S==="send")&&r(S)},e[11]=X):X=e[11];const Ge=X;let K;e[12]===Symbol.for("react.memo_cache_sentinel")?(K=c=>{J(c.currentTarget.value)},e[12]=K):K=e[12];const he=K;let Z;e[13]===Symbol.for("react.memo_cache_sentinel")?(Z=c=>{I(c.currentTarget.value)},e[13]=Z):Z=e[13];const pe=Z;let ee;e[14]===Symbol.for("react.memo_cache_sentinel")?(ee=c=>{L(c.currentTarget.value)},e[14]=ee):ee=e[14];const ge=ee;let te;e[15]===Symbol.for("react.memo_cache_sentinel")?(te=c=>{je(c.currentTarget.checked)},e[15]=te):te=e[15];const xe=te;let se;e[16]!==ue?(se=()=>{Ce(ue())},e[16]=ue,e[17]=se):se=e[17];const ye=se;let ae;e[18]!==me?(ae=c=>{const{id:S}=c.currentTarget.dataset;S!==void 0&&Ce(me(S))},e[18]=me,e[19]=ae):ae=e[19];const be=ae;let re;e[20]!==fe?(re=()=>{Ce(fe())},e[20]=fe,e[21]=re):re=e[21];const Ne=re,Pe="flex flex-col gap-6",ze="lunora-queues-panel";let B;e[22]!==a||e[23]!==o?(B=s("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(c=>s(we,{"aria-selected":o===c,"data-tab":c,"data-testid":`queues-tab-${c}`,onClick:Ge,role:"tab",size:"sm",type:"button",variant:o===c?"secondary":"ghost",children:ft(c,a)},c))}),e[22]=a,e[23]=o,e[24]=B):B=e[24];let R;e[25]!==ie||e[26]!==ce?(R=ie!==null&&s(Xe,{error:ce,testId:"queues-error"}),e[25]=ie,e[26]=ce,e[27]=R):R=e[27];const qe=D&&s(Ke,{icon:s("span",{"aria-hidden":"true",className:"text-base leading-none",children:"⚠"}),testId:"queues-dlq-warning",variant:"warning",children:q("div",{className:"flex flex-col gap-1",children:[w.length>0&&q(Fe,{children:[s("p",{className:"font-medium",children:a("No dead-letter queue on {queues}.",{queues:w.map(qt).join(", ")})}),s("p",{className:"text-muted-foreground",children:a("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),v>0&&s("p",{className:w.length>0?"text-muted-foreground":"font-medium",children:v===1?a("1 message was recently dead-lettered."):a("{count} messages were recently dead-lettered.",{count:v})})]})});let $;e[28]!==E||e[29]!==y||e[30]!==o?($=o==="declared"&&s(ht,{loaded:y!==void 0,queues:E}),e[28]=E,e[29]=y,e[30]=o,e[31]=$):$=e[31];let O;e[32]!==Q||e[33]!==h||e[34]!==Ne||e[35]!==be||e[36]!==de||e[37]!==o?(O=o==="messages"&&s(gt,{hasError:h!==null,messages:Q,onClear:Ne,onReplay:be,replayingId:de}),e[32]=Q,e[33]=h,e[34]=Ne,e[35]=be,e[36]=de,e[37]=o,e[38]=O):O=e[38];let k;e[39]!==F||e[40]!==A||e[41]!==C||e[42]!==xe||e[43]!==pe||e[44]!==ge||e[45]!==he||e[46]!==ye||e[47]!==E||e[48]!==z||e[49]!==le||e[50]!==o?(k=o==="send"&&s(xt,{batchMode:F,bodyText:A,delayText:C,onBatchModeChange:xe,onBodyChange:pe,onDelayChange:ge,onSelectExport:he,onSend:ye,queues:E,selectedExportName:z,sending:le}),e[39]=F,e[40]=A,e[41]=C,e[42]=xe,e[43]=pe,e[44]=ge,e[45]=he,e[46]=ye,e[47]=E,e[48]=z,e[49]=le,e[50]=o,e[51]=k):k=e[51];let ne;return e[52]!==B||e[53]!==R||e[54]!==qe||e[55]!==$||e[56]!==O||e[57]!==k?(ne=q("div",{className:Pe,"data-testid":ze,children:[B,R,qe,$,O,k]}),e[52]=B,e[53]=R,e[54]=qe,e[55]=$,e[56]=O,e[57]=k,e[58]=ne):ne=e[58],ne};function yt(n){return q(oe,{"data-testid":`queues-row-${n.exportName}`,children:[s(T,{className:"font-mono text-xs",children:n.exportName}),s(T,{className:"font-mono text-xs text-muted-foreground",children:n.name}),s(T,{className:"font-mono text-xs text-muted-foreground",children:n.mode}),s(T,{className:"font-mono text-xs text-muted-foreground",children:n.binding}),s(T,{className:"font-mono text-xs text-muted-foreground",children:n.deadLetterQueue??"—"})]},n.exportName)}function bt(n){return s("option",{value:n.exportName,children:n.exportName},n.exportName)}function Nt(n,e){return n.exportName.localeCompare(e.exportName)}function qt(n){return n.name}export{jt as default};
1
+ import{c as G}from"react/compiler-runtime";import{useLunora as Ve}from"@lunora/react";import{useState as M}from"react";import{ConfirmButton as Ye}from"../packem_shared/ConfirmButton-DU4p72Er.mjs";import{E as Xe}from"../packem_shared/error-alert-DueSEkt-.mjs";import{A as Ke}from"../packem_shared/alert-PB5W11MM.mjs";import{B as ve}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as we}from"../packem_shared/button-q0UYSmrn.mjs";import{C as $e,a as Oe}from"../packem_shared/card-By2O8ULa.mjs";import{E as Qe}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as Ze}from"../packem_shared/input-CXhxesPC.mjs";import{S as et}from"../packem_shared/scroll-area-CXCQH7VT.mjs";import{T as ke,a as Ue,b as oe,c as _,d as Je,e as T}from"../packem_shared/table-D0SBiDu-.mjs";import{T as tt}from"../packem_shared/textarea--40GKAyz.mjs";import{u as Be}from"../packem_shared/use-admin-query-tlBof8Yg.mjs";import{useAutoRefresh as st}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";import{useT as P}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as W}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{d as _e,b as Te,c as Ae,f as Ce,h as rt,j as at}from"../packem_shared/internal-Df43vQI0.mjs";import{jsx as s,jsxs as S,Fragment as Fe}from"react/jsx-runtime";const nt=(a,e)=>{const t=new Set(a.map(r=>r.deadLetterQueue).filter(r=>typeof r=="string"&&r!=="")),i=a.filter(r=>(r.deadLetterQueue===void 0||r.deadLetterQueue==="")&&!t.has(r.name)),l=e.filter(r=>r.deadLettered).length;return{deadLetteredCount:l,queuesWithoutDlq:i,showReliabilityWarning:i.length>0||l>0}},ot=200,lt=Ae(W.sendQueueMessage),dt=Ae(W.replayQueueMessage),it=Ae(W.clearQueueMessages),Re=96,ct=a=>{if(a===void 0)return"—";try{return JSON.stringify(a,at)}catch{return"[unserializable]"}},ut=a=>a.length>Re?`${a.slice(0,Re)}…`:a,mt=a=>a==="error"?"destructive":a==="retry"?"outline":"secondary",ft=(a,e)=>e(a==="messages"?"Messages":a==="send"?"Send":"Declared"),ht=a=>{const e=G(11),{loaded:t,queues:i}=a,l=P();let r;e[0]!==l?(r=l("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]=l,e[1]=r):r=e[1];let o;e[2]!==r?(o=s("p",{className:"text-sm text-muted-foreground",children:r}),e[2]=r,e[3]=o):o=e[3];let n;e[4]!==t||e[5]!==i||e[6]!==l?(n=t&&i.length===0?s(Qe,{description:l("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:l("No queues defined")}):s($e,{className:"overflow-hidden py-0",children:s(Oe,{className:"px-0",children:S(ke,{"data-testid":"queues-table",children:[s(Ue,{children:S(oe,{children:[s(_,{children:l("Export")}),s(_,{children:l("Queue")}),s(_,{children:l("Mode")}),s(_,{children:l("Binding")}),s(_,{children:l("Dead-letter")}),s(_,{children:l("Topic")})]})}),s(Je,{children:i.map(yt)})]})})}),e[4]=t,e[5]=i,e[6]=l,e[7]=n):n=e[7];let f;return e[8]!==o||e[9]!==n?(f=S("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[o,n]}),e[8]=o,e[9]=n,e[10]=f):f=e[10],f},pt=a=>{const e=G(67),{message:t,onReplay:i,replayingId:l}=a,r=P();let o,n,f,u,g,y,x,d,m,p;if(e[0]!==t.attempts||e[1]!==t.body||e[2]!==t.deadLettered||e[3]!==t.exportName||e[4]!==t.id||e[5]!==t.messageId||e[6]!==t.outcome||e[7]!==t.queue||e[8]!==r){const U=ct(t.body);n=oe,y=`queues-message-${t.id}`;const J=t.exportName??t.queue;e[19]!==J?(x=s(T,{className:"font-mono text-xs",children:J}),e[19]=J,e[20]=x):x=e[20],e[21]!==t.messageId?(d=s(T,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:t.messageId,children:t.messageId}),e[21]=t.messageId,e[22]=d):d=e[22],e[23]!==t.attempts?(m=s(T,{className:"font-mono text-xs tabular-nums",children:t.attempts}),e[23]=t.attempts,e[24]=m):m=e[24];const A=`queues-outcome-${t.id}`;let I;e[25]!==t.outcome?(I=mt(t.outcome),e[25]=t.outcome,e[26]=I):I=e[26];let C;e[27]!==t.outcome||e[28]!==A||e[29]!==I?(C=s(ve,{"data-testid":A,variant:I,children:t.outcome}),e[27]=t.outcome,e[28]=A,e[29]=I,e[30]=C):C=e[30];let L;e[31]!==t.deadLettered||e[32]!==t.id||e[33]!==r?(L=t.deadLettered&&s(ve,{"data-testid":`queues-dlq-${t.id}`,variant:"destructive",children:r("DLQ")}),e[31]=t.deadLettered,e[32]=t.id,e[33]=r,e[34]=L):L=e[34],e[35]!==C||e[36]!==L?(p=s(T,{children:S("span",{className:"inline-flex items-center gap-1",children:[C,L]})}),e[35]=C,e[36]=L,e[37]=p):p=e[37],o=T,f="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",u=U,g=ut(U),e[0]=t.attempts,e[1]=t.body,e[2]=t.deadLettered,e[3]=t.exportName,e[4]=t.id,e[5]=t.messageId,e[6]=t.outcome,e[7]=t.queue,e[8]=r,e[9]=o,e[10]=n,e[11]=f,e[12]=u,e[13]=g,e[14]=y,e[15]=x,e[16]=d,e[17]=m,e[18]=p}else o=e[9],n=e[10],f=e[11],u=e[12],g=e[13],y=e[14],x=e[15],d=e[16],m=e[17],p=e[18];let h;e[38]!==o||e[39]!==f||e[40]!==u||e[41]!==g?(h=s(o,{className:f,title:u,children:g}),e[38]=o,e[39]=f,e[40]=u,e[41]=g,e[42]=h):h=e[42];let N;e[43]!==t.capturedAt?(N=rt(t.capturedAt,"—"),e[43]=t.capturedAt,e[44]=N):N=e[44];let b;e[45]!==N?(b=s(T,{className:"text-xs text-muted-foreground tabular-nums",children:N}),e[45]=N,e[46]=b):b=e[46];const E=`queues-replay-${t.id}`,Q=l!==null;let v;e[47]!==t.id||e[48]!==l||e[49]!==r?(v=l===t.id?r("Replaying…"):r("Replay"),e[47]=t.id,e[48]=l,e[49]=r,e[50]=v):v=e[50];let w;e[51]!==t.id||e[52]!==i||e[53]!==E||e[54]!==Q||e[55]!==v?(w=s(T,{children:s(we,{"data-id":t.id,"data-testid":E,disabled:Q,onClick:i,size:"xs",type:"button",variant:"outline",children:v})}),e[51]=t.id,e[52]=i,e[53]=E,e[54]=Q,e[55]=v,e[56]=w):w=e[56];let D;return e[57]!==n||e[58]!==b||e[59]!==w||e[60]!==y||e[61]!==x||e[62]!==d||e[63]!==m||e[64]!==p||e[65]!==h?(D=S(n,{"data-testid":y,children:[x,d,m,p,h,b,w]}),e[57]=n,e[58]=b,e[59]=w,e[60]=y,e[61]=x,e[62]=d,e[63]=m,e[64]=p,e[65]=h,e[66]=D):D=e[66],D},gt=a=>{const e=G(29),{hasError:t,messages:i,onClear:l,onReplay:r,replayingId:o}=a,n=P();let f;e[0]!==n?(f=n("Cloudflare Queues have no peek API, so this is what push consumers actually processed — not pending depth."),e[0]=n,e[1]=f):f=e[1];let u;e[2]!==f?(u=s("p",{className:"text-sm text-muted-foreground",children:f}),e[2]=f,e[3]=u):u=e[3];let g;e[4]!==n?(g=n("Clear the whole message log?"),e[4]=n,e[5]=g):g=e[5];const y=i.length===0;let x;e[6]!==n?(x=n("Clear log"),e[6]=n,e[7]=x):x=e[7];let d;e[8]!==l||e[9]!==g||e[10]!==y||e[11]!==x?(d=s("div",{className:"ml-auto",children:s(Ye,{confirmLabel:g,disabled:y,onConfirm:l,testId:"queues-clear",children:x})}),e[8]=l,e[9]=g,e[10]=y,e[11]=x,e[12]=d):d=e[12];let m;e[13]!==i.length||e[14]!==n?(m=i.length>0&&s(ve,{"data-testid":"queues-count",variant:"secondary",children:n("{count} messages",{count:i.length})}),e[13]=i.length,e[14]=n,e[15]=m):m=e[15];let p;e[16]!==u||e[17]!==d||e[18]!==m?(p=S("div",{className:"flex flex-wrap items-center gap-2",children:[u,d,m]}),e[16]=u,e[17]=d,e[18]=m,e[19]=p):p=e[19];let h;e[20]!==t||e[21]!==i||e[22]!==r||e[23]!==o||e[24]!==n?(h=!t&&i.length===0?s(Qe,{description:n("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:n("No consumed messages yet.")}):s($e,{className:"overflow-hidden py-0",children:s(Oe,{className:"px-0",children:s(et,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:S(ke,{"data-testid":"queues-messages-table",children:[s(Ue,{children:S(oe,{children:[s(_,{children:n("Export")}),s(_,{children:n("Message")}),s(_,{children:n("Attempts")}),s(_,{children:n("Outcome")}),s(_,{children:n("Body")}),s(_,{children:n("Captured")}),s(_,{})]})}),s(Je,{children:i.map(b=>s(pt,{message:b,onReplay:r,replayingId:o},b.id))})]})})})}),e[20]=t,e[21]=i,e[22]=r,e[23]=o,e[24]=n,e[25]=h):h=e[25];let N;return e[26]!==p||e[27]!==h?(N=S("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[p,h]}),e[26]=p,e[27]=h,e[28]=N):N=e[28],N},xt=a=>{const e=G(20),{batchMode:t,bodyText:i,delayText:l,onBatchModeChange:r,onBodyChange:o,onDelayChange:n,onSelectExport:f,onSend:u,queues:g,selectedExportName:y,sending:x}=a,d=P();let m;e[0]!==d?(m=d("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=d,e[1]=m):m=e[1];let p;e[2]!==m?(p=s("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=p):p=e[3];let h;e[4]!==t||e[5]!==i||e[6]!==l||e[7]!==r||e[8]!==o||e[9]!==n||e[10]!==f||e[11]!==u||e[12]!==g||e[13]!==y||e[14]!==x||e[15]!==d?(h=g.length===0?s(Qe,{description:d("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:d("No queues to send to")}):S(Fe,{children:[S("div",{className:"flex flex-wrap items-center gap-2",children:[s("select",{"aria-label":d("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:f,value:y,children:g.map(bt)}),s(Ze,{"aria-label":d("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:n,placeholder:d("Delay (s)"),type:"number",value:l}),S("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[s("input",{checked:t,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:r,type:"checkbox"}),d("Send as batch (JSON array)")]}),s(we,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||y==="",onClick:u,type:"button",children:d(x?"Sending…":"Send message")})]}),s(tt,{"aria-label":d("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:o,placeholder:t?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:i})]}),e[4]=t,e[5]=i,e[6]=l,e[7]=r,e[8]=o,e[9]=n,e[10]=f,e[11]=u,e[12]=g,e[13]=y,e[14]=x,e[15]=d,e[16]=h):h=e[16];let N;return e[17]!==p||e[18]!==h?(N=S("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[p,h]}),e[17]=p,e[18]=h,e[19]=N):N=e[19],N},jt=a=>{const e=G(59),{limit:t}=a,i=t??ot,l=Ve(),r=P(),[o,n]=M("declared"),[f,u]=M(null);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={},e[0]=g):g=e[0];const{data:y,error:x,errorSource:d}=Be(W.listQueues,g);let m;e[1]!==i?(m={limit:i},e[1]=i,e[2]=m):m=e[2];const{data:p,error:h,errorSource:N,refetch:b}=Be(W.getQueueMessages,m),E=Array.isArray(y?.queues)?[...y.queues].toSorted(Nt):[],Q=p?.entries??[],{deadLetteredCount:v,queuesWithoutDlq:w,showReliabilityWarning:D}=nt(E,Q),[U,J]=M(""),[A,I]=M(""),[C,L]=M(""),[F,je]=M(!1),[le,Ie]=M(!1),[de,Le]=M(null),z=E.some(c=>c.exportName===U)?U:E[0]?.exportName??"",Me=o==="messages"?h:x,We=o==="messages"?N:d,ie=Me??f,ce=Me===null?f:We;let H;e[3]!==b?(H=()=>{b()},e[3]=b,e[4]=H):H=e[4],st(H,o==="messages");const ue=async()=>{u(null);const c=z;if(c==="")return;let q=null;const qe=A.trim();if(qe!=="")try{q=JSON.parse(qe)}catch{u(r("Body must be valid JSON."));return}let Ee;const De=C.trim();if(De!==""){const j=Number(De);if(!Number.isFinite(j)||j<0){u(r("Delay must be a non-negative number of seconds."));return}Ee=j}if(F&&!Array.isArray(q)){u(r("Batch mode needs a JSON array body — each element is enqueued as one message."));return}Ie(!0);const He=F?{batch:q,delaySeconds:Ee,exportName:c}:{body:q,delaySeconds:Ee,exportName:c};try{await l.query(lt,He,_e("")),b()}catch(j){u(Te(j))}Ie(!1)};let V;e[5]!==l||e[6]!==b?(V=async c=>{u(null),Le(c);try{await l.query(dt,{id:c},_e("")),b()}catch(q){u(Te(q))}Le(null)},e[5]=l,e[6]=b,e[7]=V):V=e[7];const me=V;let Y;e[8]!==l||e[9]!==b?(Y=async()=>{u(null);try{await l.query(it,{},_e("")),b()}catch(c){u(Te(c))}},e[8]=l,e[9]=b,e[10]=Y):Y=e[10];const fe=Y;let X;e[11]===Symbol.for("react.memo_cache_sentinel")?(X=c=>{const q=c.currentTarget.dataset.tab;(q==="declared"||q==="messages"||q==="send")&&n(q)},e[11]=X):X=e[11];const Ge=X;let K;e[12]===Symbol.for("react.memo_cache_sentinel")?(K=c=>{J(c.currentTarget.value)},e[12]=K):K=e[12];const he=K;let Z;e[13]===Symbol.for("react.memo_cache_sentinel")?(Z=c=>{I(c.currentTarget.value)},e[13]=Z):Z=e[13];const pe=Z;let ee;e[14]===Symbol.for("react.memo_cache_sentinel")?(ee=c=>{L(c.currentTarget.value)},e[14]=ee):ee=e[14];const ge=ee;let te;e[15]===Symbol.for("react.memo_cache_sentinel")?(te=c=>{je(c.currentTarget.checked)},e[15]=te):te=e[15];const xe=te;let se;e[16]!==ue?(se=()=>{Ce(ue())},e[16]=ue,e[17]=se):se=e[17];const ye=se;let re;e[18]!==me?(re=c=>{const{id:q}=c.currentTarget.dataset;q!==void 0&&Ce(me(q))},e[18]=me,e[19]=re):re=e[19];const be=re;let ae;e[20]!==fe?(ae=()=>{Ce(fe())},e[20]=fe,e[21]=ae):ae=e[21];const Ne=ae,Pe="flex flex-col gap-6",ze="lunora-queues-panel";let B;e[22]!==r||e[23]!==o?(B=s("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(c=>s(we,{"aria-selected":o===c,"data-tab":c,"data-testid":`queues-tab-${c}`,onClick:Ge,role:"tab",size:"sm",type:"button",variant:o===c?"secondary":"ghost",children:ft(c,r)},c))}),e[22]=r,e[23]=o,e[24]=B):B=e[24];let R;e[25]!==ie||e[26]!==ce?(R=ie!==null&&s(Xe,{error:ce,testId:"queues-error"}),e[25]=ie,e[26]=ce,e[27]=R):R=e[27];const Se=D&&s(Ke,{icon:s("span",{"aria-hidden":"true",className:"text-base leading-none",children:"⚠"}),testId:"queues-dlq-warning",variant:"warning",children:S("div",{className:"flex flex-col gap-1",children:[w.length>0&&S(Fe,{children:[s("p",{className:"font-medium",children:r("No dead-letter queue on {queues}.",{queues:w.map(St).join(", ")})}),s("p",{className:"text-muted-foreground",children:r("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),v>0&&s("p",{className:w.length>0?"text-muted-foreground":"font-medium",children:v===1?r("1 message was recently dead-lettered."):r("{count} messages were recently dead-lettered.",{count:v})})]})});let $;e[28]!==E||e[29]!==y||e[30]!==o?($=o==="declared"&&s(ht,{loaded:y!==void 0,queues:E}),e[28]=E,e[29]=y,e[30]=o,e[31]=$):$=e[31];let O;e[32]!==Q||e[33]!==h||e[34]!==Ne||e[35]!==be||e[36]!==de||e[37]!==o?(O=o==="messages"&&s(gt,{hasError:h!==null,messages:Q,onClear:Ne,onReplay:be,replayingId:de}),e[32]=Q,e[33]=h,e[34]=Ne,e[35]=be,e[36]=de,e[37]=o,e[38]=O):O=e[38];let k;e[39]!==F||e[40]!==A||e[41]!==C||e[42]!==xe||e[43]!==pe||e[44]!==ge||e[45]!==he||e[46]!==ye||e[47]!==E||e[48]!==z||e[49]!==le||e[50]!==o?(k=o==="send"&&s(xt,{batchMode:F,bodyText:A,delayText:C,onBatchModeChange:xe,onBodyChange:pe,onDelayChange:ge,onSelectExport:he,onSend:ye,queues:E,selectedExportName:z,sending:le}),e[39]=F,e[40]=A,e[41]=C,e[42]=xe,e[43]=pe,e[44]=ge,e[45]=he,e[46]=ye,e[47]=E,e[48]=z,e[49]=le,e[50]=o,e[51]=k):k=e[51];let ne;return e[52]!==B||e[53]!==R||e[54]!==Se||e[55]!==$||e[56]!==O||e[57]!==k?(ne=S("div",{className:Pe,"data-testid":ze,children:[B,R,Se,$,O,k]}),e[52]=B,e[53]=R,e[54]=Se,e[55]=$,e[56]=O,e[57]=k,e[58]=ne):ne=e[58],ne};function yt(a){return S(oe,{"data-testid":`queues-row-${a.exportName}`,children:[s(T,{className:"font-mono text-xs",children:a.exportName}),s(T,{className:"font-mono text-xs text-muted-foreground",children:a.name}),s(T,{className:"font-mono text-xs text-muted-foreground",children:a.mode}),s(T,{className:"font-mono text-xs text-muted-foreground",children:a.binding}),s(T,{className:"font-mono text-xs text-muted-foreground",children:a.deadLetterQueue??"—"}),s(T,{className:"font-mono text-xs text-muted-foreground",children:a.topic??"—"})]},a.exportName)}function bt(a){return s("option",{value:a.exportName,children:a.exportName},a.exportName)}function Nt(a,e){return a.exportName.localeCompare(e.exportName)}function St(a){return a.name}export{jt as default};
@@ -1 +1 @@
1
- import{useLunora as Z}from"@lunora/react";import{useState as c,useRef as G,useEffect as se}from"react";import{B as T}from"../packem_shared/button-q0UYSmrn.mjs";import{C as L,a as j}from"../packem_shared/card-By2O8ULa.mjs";import{E as H}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as ae}from"../packem_shared/input-CXhxesPC.mjs";import{T as q,a as U,b as N,c as i,d as z,e as d}from"../packem_shared/table-D0SBiDu-.mjs";import{T as ne}from"../packem_shared/textarea--40GKAyz.mjs";import{u as oe}from"../packem_shared/use-admin-query-tlBof8Yg.mjs";import{useT as ee}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as M}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{f as E,b as W,j as te,d as Y,c as re}from"../packem_shared/internal-Df43vQI0.mjs";import{jsxs as o,jsx as t}from"react/jsx-runtime";const le=["queued","running","paused","waiting","complete","errored","terminated"],ie=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=l=>typeof l=="object"&&l!==null&&l.code===de,ue=l=>{const r=l.error??l.output;if(r===void 0)return"—";try{return JSON.stringify(r,te)}catch{return"(unserializable)"}},me=({loadDetail:l,loadInstances:r,readOnly:w,runAction:A,workflowName:g})=>{const C=Z(),a=ee(),[x,v]=c(null),[k,I]=c(null),[b,R]=c(""),[y,h]=c(null),[_,S]=c(!1),[$,F]=c(null),m=G(0),f=G(0),p=G(0),D=l??(e=>C.getWorkflowInstance(e)),O=w?void 0:A??(r===void 0?e=>C.setWorkflowInstanceStatus(e):void 0),P=async()=>{f.current+=1;const e=f.current;h(null),S(!1);const s=b===""?void 0:b;try{if(r===void 0){const u=await C.listWorkflowInstances({name:g,status:s});if(e!==f.current)return;if(u.configured===!1){v(null),S(!0);return}v(u.instances);return}const n=await r({name:g,status:s});e===f.current&&v(n)}catch(n){if(e!==f.current)return;v(null),ce(n)?S(!0):h(W(n))}};se(()=>{m.current+=1,p.current+=1,I(null),E(P())},[g,b]);const J=async e=>{p.current+=1;const s=p.current;h(null);try{const n=await D({id:e,name:g});s===p.current&&I(n)}catch(n){s===p.current&&h(W(n))}},B=()=>{p.current+=1,I(null)},K=async(e,s)=>{if(O===void 0)return;const n=m.current;F(e),h(null);try{await O({action:s,id:e,name:g}),n===m.current&&await P()}catch(u){h(W(u))}F(null)};return o("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[o("div",{className:"flex items-center justify-between gap-2",children:[t("h3",{className:"text-sm font-medium",children:a("Instance history")}),o("select",{"aria-label":a("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:e=>{R(e.target.value)},value:b,children:[t("option",{value:"",children:a("All statuses")}),le.map(e=>t("option",{value:e,children:e},e))]})]}),y!==null&&t("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:y}),_&&t(H,{description:a("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:a("Workflow inspection not configured")}),!_&&x!==null&&x.length===0&&t(H,{description:a("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:a("No instances")}),x!==null&&x.length>0&&t(L,{className:"overflow-hidden py-0",children:t(j,{className:"px-0",children:o(q,{"data-testid":"workflow-instances-table",children:[t(U,{children:o(N,{children:[t(i,{children:a("Instance id")}),t(i,{children:a("Status")}),t(i,{children:a("Created")}),t(i,{children:a("Ended")}),t(i,{"aria-label":a("Actions")})]})}),t(z,{children:x.map(e=>o(N,{"data-testid":`workflow-instance-${e.id}`,children:[t(d,{className:"font-mono text-xs",children:e.id}),t(d,{className:"font-mono text-xs",children:e.status}),t(d,{className:"text-muted-foreground tabular-nums",children:e.createdOn??"—"}),t(d,{className:"text-muted-foreground tabular-nums",children:e.endedOn??"—"}),t(d,{className:"text-right",children:o("div",{className:"flex justify-end gap-1.5",children:[t(T,{"data-testid":`workflow-instance-steps-${e.id}`,onClick:()=>{E(J(e.id))},size:"sm",type:"button",variant:"outline",children:a("Steps")}),O!==void 0&&ie.map(s=>t(T,{"data-testid":`workflow-instance-${s}-${e.id}`,disabled:$===e.id,onClick:()=>{E(K(e.id,s))},size:"sm",type:"button",variant:"ghost",children:a(s)},s))]})})]},e.id))})]})})}),k!==null&&t(L,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:o(j,{className:"flex flex-col gap-2 px-4 py-3",children:[o("div",{className:"flex items-center justify-between",children:[o("span",{className:"font-mono text-xs",children:[a("Steps")," · ",k.id]}),t(T,{"data-testid":"workflow-instance-detail-close",onClick:B,size:"xs",type:"button",variant:"ghost",children:a("Close")})]}),k.steps.length===0?t("p",{className:"text-xs text-muted-foreground",children:a("This instance has no recorded steps yet.")}):o(q,{"data-testid":"workflow-instance-steps",children:[t(U,{children:o(N,{children:[t(i,{children:a("Step")}),t(i,{children:a("Type")}),t(i,{children:a("Attempts")}),t(i,{children:a("Started")}),t(i,{children:a("Output")})]})}),t(z,{children:k.steps.map((e,s)=>o(N,{"data-testid":`workflow-step-${String(s)}`,children:[t(d,{className:"font-mono text-xs",children:e.name}),t(d,{className:"text-xs text-muted-foreground",children:e.type??"—"}),t(d,{className:"tabular-nums",children:e.attempts??"—"}),t(d,{className:"text-muted-foreground tabular-nums",children:e.start??"—"}),t(d,{className:"font-mono text-xs text-muted-foreground",children:ue(e)})]},`${e.name}:${String(s)}`))})]})]})})]})},fe=re(M.createWorkflowInstance),he=re(M.getWorkflowInstanceStatus),pe=l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"—";try{return JSON.stringify(l.output,te)}catch{return"(unserializable)"}},xe=(l,r)=>l.some(w=>w.exportName===r)?r:l[0]?.exportName??"",We=()=>{const l=Z(),r=ee(),{data:w,error:A}=oe(M.listWorkflows,{}),[g,C]=c(""),[a,x]=c(""),[v,k]=c(""),[I,b]=c(!1),[R,y]=c(null),[h,_]=c([]),[S,$]=c(null),F=w!==void 0,m=Array.isArray(w?.workflows)?[...w.workflows].toSorted((e,s)=>e.exportName.localeCompare(s.exportName)):[],f=xe(m,g),p=m.find(e=>e.exportName===f),D=e=>{_(s=>{const n=s.filter(u=>!(u.exportName===e.exportName&&u.id===e.id));return[e,...n]})},Q=async()=>{const e=f;if(e==="")return;let s;const n=v.trim();if(n!=="")try{s=JSON.parse(n)}catch{y(r("Params must be valid JSON"));return}b(!0),y(null);try{const u=a.trim(),X=await l.query(fe,{exportName:e,id:u===""?void 0:u,params:s},Y(""));D({exportName:e,id:X.id,status:X.status}),x("")}catch(u){y(W(u))}b(!1)},V=()=>{E(Q())},O=async(e,s)=>{$(s);try{const n=await l.query(he,{exportName:e,id:s},Y(""));D({error:n.error,exportName:e,id:n.id,output:n.output,status:n.status})}catch(n){y(W(n))}$(null)},P=e=>{C(e.target.value)},J=e=>{x(e.target.value)},B=e=>{k(e.target.value)},K=e=>{const{export:s,id:n}=e.currentTarget.dataset;s!==void 0&&n!==void 0&&E(O(s,n))};return o("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[A!==null&&t("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:A}),t("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.")}),F&&m.length===0?t(H,{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")}):t(L,{className:"overflow-hidden py-0",children:t(j,{className:"px-0",children:o(q,{"data-testid":"workflows-table",children:[t(U,{children:o(N,{children:[t(i,{children:r("Export")}),t(i,{children:r("Name")}),t(i,{children:r("Class")}),t(i,{children:r("Binding")})]})}),t(z,{children:m.map(e=>o(N,{"data-testid":`workflows-row-${e.exportName}`,children:[t(d,{className:"font-mono text-xs",children:e.exportName}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.name}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.className}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.binding})]},e.exportName))})]})})}),m.length>0&&o("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[t("h3",{className:"text-sm font-medium",children:r("Start instance")}),R!==null&&t("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:R}),o("div",{className:"flex flex-wrap items-center gap-2",children:[t("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:P,value:f,children:m.map(e=>t("option",{value:e.exportName,children:e.exportName},e.exportName))}),t(ae,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:J,placeholder:r("Instance id (optional)"),value:a}),t(T,{"data-testid":"workflows-start-button",disabled:I||f==="",onClick:V,children:r(I?"Starting…":"Start instance")})]}),t(ne,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:B,placeholder:r("Params (JSON, optional)"),value:v})]}),h.length>0&&o("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[t("h3",{className:"text-sm font-medium",children:r("Instances")}),t(L,{className:"overflow-hidden py-0",children:t(j,{className:"px-0",children:o(q,{"data-testid":"workflows-instances-table",children:[t(U,{children:o(N,{children:[t(i,{children:r("Workflow")}),t(i,{children:r("Instance id")}),t(i,{children:r("Status")}),t(i,{children:r("Output")}),t(i,{})]})}),t(z,{children:h.map(e=>o(N,{"data-testid":`workflows-instance-${e.id}`,children:[t(d,{className:"font-mono text-xs",children:e.exportName}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.id}),t(d,{className:"font-mono text-xs",children:e.status}),t(d,{className:"font-mono text-xs text-muted-foreground",children:pe(e)}),t(d,{children:t(T,{"data-export":e.exportName,"data-id":e.id,"data-testid":`workflows-instance-refresh-${e.id}`,disabled:S===e.id,onClick:K,size:"xs",variant:"outline",children:S===e.id?r("Refreshing…"):r("Refresh")})})]},`${e.exportName}:${e.id}`))})]})})})]}),p!==void 0&&t(me,{workflowName:p.name})]})};export{We as default};
1
+ import{useLunora as Z}from"@lunora/react";import{useState as c,useRef as G,useEffect as se}from"react";import{B as T}from"../packem_shared/button-q0UYSmrn.mjs";import{C as L,a as j}from"../packem_shared/card-By2O8ULa.mjs";import{E as H}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as ae}from"../packem_shared/input-CXhxesPC.mjs";import{T as q,a as U,b as N,c as i,d as z,e as d}from"../packem_shared/table-D0SBiDu-.mjs";import{T as ne}from"../packem_shared/textarea--40GKAyz.mjs";import{u as oe}from"../packem_shared/use-admin-query-tlBof8Yg.mjs";import{useT as ee}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as M}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{f as E,b as W,j as te,d as Y,c as re}from"../packem_shared/internal-Df43vQI0.mjs";import{jsxs as o,jsx as t}from"react/jsx-runtime";const le=["queued","running","paused","waiting","complete","errored","terminated"],ie=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=l=>typeof l=="object"&&l!==null&&l.code===de,ue=l=>{const r=l.error??l.output;if(r===void 0)return"—";try{return JSON.stringify(r,te)}catch{return"(unserializable)"}},me=({loadDetail:l,loadInstances:r,readOnly:w,runAction:A,workflowName:g})=>{const C=Z(),a=ee(),[x,v]=c(null),[k,I]=c(null),[b,R]=c(""),[y,h]=c(null),[_,S]=c(!1),[$,F]=c(null),m=G(0),f=G(0),p=G(0),D=l??(e=>C.getWorkflowInstance(e)),O=w?void 0:A??(r===void 0?e=>C.setWorkflowInstanceStatus(e):void 0),P=async()=>{f.current+=1;const e=f.current;h(null),S(!1);const s=b===""?void 0:b;try{if(r===void 0){const u=await C.listWorkflowInstances({name:g,status:s});if(e!==f.current)return;if(u.configured===!1){v(null),S(!0);return}v(u.instances);return}const n=await r({name:g,status:s});e===f.current&&v(n)}catch(n){if(e!==f.current)return;v(null),ce(n)?S(!0):h(W(n))}};se(()=>{m.current+=1,p.current+=1,I(null),E(P())},[g,b]);const J=async e=>{p.current+=1;const s=p.current;h(null);try{const n=await D({id:e,name:g});s===p.current&&I(n)}catch(n){s===p.current&&h(W(n))}},B=()=>{p.current+=1,I(null)},K=async(e,s)=>{if(O===void 0)return;const n=m.current;F(e),h(null);try{await O({action:s,id:e,name:g}),n===m.current&&await P()}catch(u){h(W(u))}F(null)};return o("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[o("div",{className:"flex items-center justify-between gap-2",children:[t("h3",{className:"text-sm font-medium",children:a("Instance history")}),o("select",{"aria-label":a("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:e=>{R(e.target.value)},value:b,children:[t("option",{value:"",children:a("All statuses")}),le.map(e=>t("option",{value:e,children:e},e))]})]}),y!==null&&t("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:y}),_&&t(H,{description:a("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:a("Workflow inspection not configured")}),!_&&x!==null&&x.length===0&&t(H,{description:a("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:a("No instances")}),x!==null&&x.length>0&&t(L,{className:"overflow-hidden py-0",children:t(j,{className:"px-0",children:o(q,{"data-testid":"workflow-instances-table",children:[t(U,{children:o(N,{children:[t(i,{children:a("Instance id")}),t(i,{children:a("Status")}),t(i,{children:a("Created")}),t(i,{children:a("Ended")}),t(i,{"aria-label":a("Actions")})]})}),t(z,{children:x.map(e=>o(N,{"data-testid":`workflow-instance-${e.id}`,children:[t(d,{className:"font-mono text-xs",children:e.id}),t(d,{className:"font-mono text-xs",children:e.status}),t(d,{className:"text-muted-foreground tabular-nums",children:e.createdOn??"—"}),t(d,{className:"text-muted-foreground tabular-nums",children:e.endedOn??"—"}),t(d,{className:"text-right",children:o("div",{className:"flex justify-end gap-1.5",children:[t(T,{"data-testid":`workflow-instance-steps-${e.id}`,onClick:()=>{E(J(e.id))},size:"sm",type:"button",variant:"outline",children:a("Steps")}),O!==void 0&&ie.map(s=>t(T,{"data-testid":`workflow-instance-${s}-${e.id}`,disabled:$===e.id,onClick:()=>{E(K(e.id,s))},size:"sm",type:"button",variant:"ghost",children:a(s)},s))]})})]},e.id))})]})})}),k!==null&&t(L,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:o(j,{className:"flex flex-col gap-2 px-4 py-3",children:[o("div",{className:"flex items-center justify-between",children:[o("span",{className:"font-mono text-xs",children:[a("Steps")," · ",k.id]}),t(T,{"data-testid":"workflow-instance-detail-close",onClick:B,size:"xs",type:"button",variant:"ghost",children:a("Close")})]}),k.steps.length===0?t("p",{className:"text-xs text-muted-foreground",children:a("This instance has no recorded steps yet.")}):o(q,{"data-testid":"workflow-instance-steps",children:[t(U,{children:o(N,{children:[t(i,{children:a("Step")}),t(i,{children:a("Type")}),t(i,{children:a("Attempts")}),t(i,{children:a("Started")}),t(i,{children:a("Output")})]})}),t(z,{children:k.steps.map((e,s)=>o(N,{"data-testid":`workflow-step-${String(s)}`,children:[t(d,{className:"font-mono text-xs",children:e.name}),t(d,{className:"text-xs text-muted-foreground",children:e.type??"—"}),t(d,{className:"tabular-nums",children:e.attempts??"—"}),t(d,{className:"text-muted-foreground tabular-nums",children:e.start??"—"}),t(d,{className:"font-mono text-xs text-muted-foreground",children:ue(e)})]},`${e.name}:${String(s)}`))})]})]})})]})},fe=re(M.createWorkflowInstance),he=re(M.getWorkflowInstanceStatus),pe=l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"—";try{return JSON.stringify(l.output,te)}catch{return"(unserializable)"}},xe=(l,r)=>l.some(w=>w.exportName===r)?r:l[0]?.exportName??"",We=()=>{const l=Z(),r=ee(),{data:w,error:A}=oe(M.listWorkflows,{}),[g,C]=c(""),[a,x]=c(""),[v,k]=c(""),[I,b]=c(!1),[R,y]=c(null),[h,_]=c([]),[S,$]=c(null),F=w!==void 0,m=Array.isArray(w?.workflows)?[...w.workflows].toSorted((e,s)=>e.exportName.localeCompare(s.exportName)):[],f=xe(m,g),p=m.find(e=>e.exportName===f),D=e=>{_(s=>{const n=s.filter(u=>!(u.exportName===e.exportName&&u.id===e.id));return[e,...n]})},Q=async()=>{const e=f;if(e==="")return;let s;const n=v.trim();if(n!=="")try{s=JSON.parse(n)}catch{y(r("Params must be valid JSON"));return}b(!0),y(null);try{const u=a.trim(),X=await l.query(fe,{exportName:e,id:u===""?void 0:u,params:s},Y(""));D({exportName:e,id:X.id,status:X.status}),x("")}catch(u){y(W(u))}b(!1)},V=()=>{E(Q())},O=async(e,s)=>{$(s);try{const n=await l.query(he,{exportName:e,id:s},Y(""));D({error:n.error,exportName:e,id:n.id,output:n.output,status:n.status})}catch(n){y(W(n))}$(null)},P=e=>{C(e.target.value)},J=e=>{x(e.target.value)},B=e=>{k(e.target.value)},K=e=>{const{export:s,id:n}=e.currentTarget.dataset;s!==void 0&&n!==void 0&&E(O(s,n))};return o("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[A!==null&&t("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:A}),t("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.")}),F&&m.length===0?t(H,{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")}):t(L,{className:"overflow-hidden py-0",children:t(j,{className:"px-0",children:o(q,{"data-testid":"workflows-table",children:[t(U,{children:o(N,{children:[t(i,{children:r("Export")}),t(i,{children:r("Name")}),t(i,{children:r("Class")})]})}),t(z,{children:m.map(e=>o(N,{"data-testid":`workflows-row-${e.exportName}`,children:[t(d,{className:"font-mono text-xs",children:e.exportName}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.name}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.className})]},e.exportName))})]})})}),m.length>0&&o("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[t("h3",{className:"text-sm font-medium",children:r("Start instance")}),R!==null&&t("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:R}),o("div",{className:"flex flex-wrap items-center gap-2",children:[t("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:P,value:f,children:m.map(e=>t("option",{value:e.exportName,children:e.exportName},e.exportName))}),t(ae,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:J,placeholder:r("Instance id (optional)"),value:a}),t(T,{"data-testid":"workflows-start-button",disabled:I||f==="",onClick:V,children:r(I?"Starting…":"Start instance")})]}),t(ne,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:B,placeholder:r("Params (JSON, optional)"),value:v})]}),h.length>0&&o("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[t("h3",{className:"text-sm font-medium",children:r("Instances")}),t(L,{className:"overflow-hidden py-0",children:t(j,{className:"px-0",children:o(q,{"data-testid":"workflows-instances-table",children:[t(U,{children:o(N,{children:[t(i,{children:r("Workflow")}),t(i,{children:r("Instance id")}),t(i,{children:r("Status")}),t(i,{children:r("Output")}),t(i,{})]})}),t(z,{children:h.map(e=>o(N,{"data-testid":`workflows-instance-${e.id}`,children:[t(d,{className:"font-mono text-xs",children:e.exportName}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.id}),t(d,{className:"font-mono text-xs",children:e.status}),t(d,{className:"font-mono text-xs text-muted-foreground",children:pe(e)}),t(d,{children:t(T,{"data-export":e.exportName,"data-id":e.id,"data-testid":`workflows-instance-refresh-${e.id}`,disabled:S===e.id,onClick:K,size:"xs",variant:"outline",children:S===e.id?r("Refreshing…"):r("Refresh")})})]},`${e.exportName}:${e.id}`))})]})})})]}),p!==void 0&&t(me,{workflowName:p.name})]})};export{We as default};
@@ -1 +1 @@
1
- import{b as me}from"./chunk-72GVG7ZA.js";import{a as $}from"./chunk-X3LPHVDL.js";import{a as ue}from"./chunk-Z5O2NQAV.js";import"./chunk-76QJJLPM.js";import"./chunk-5JDWLCSH.js";import"./chunk-EVTM6Q43.js";import{a as de}from"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{b as P}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import"./chunk-35DM4JJG.js";import{a as A}from"./chunk-4ZEL6BYL.js";import{c as ce}from"./chunk-RPJEAHAZ.js";import{f as ne,g as oe}from"./chunk-TI33XMKX.js";import"./chunk-FSRSK4LY.js";import"./chunk-NPF3GY2E.js";import{a as C}from"./chunk-N6NMLJ6R.js";import{d as D,f as I,g as Q,h as W,p as _,t as ie}from"./chunk-PTZD7RUZ.js";import{a as f,d as T,e as qe,f as ae,g as le,i as M}from"./chunk-YKXDMIHQ.js";var Y=T(ae(),1);var h=T(qe(),1);var fe=T(ae(),1);var B=T(le(),1);var Me={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive",polling:"bg-warning"},he=f(()=>{let t=(0,fe.c)(18),e=D(),a=oe(),s;e:switch(a){case"connected":{let n;t[0]!==e?(n=e("Connected"),t[0]=e,t[1]=n):n=t[1],s=n;break e}case"connecting":{let n;t[2]!==e?(n=e("Connecting\u2026"),t[2]=e,t[3]=n):n=t[3],s=n;break e}case"idle":{let n;t[4]!==e?(n=e("Idle"),t[4]=e,t[5]=n):n=t[5],s=n;break e}case"offline":{let n;t[6]!==e?(n=e("Offline"),t[6]=e,t[7]=n):n=t[7],s=n;break e}case"polling":{let n;t[8]!==e?(n=e("Polling"),t[8]=e,t[9]=n):n=t[9],s=n;break e}default:s=a}let l=Me[a],c;t[10]!==l?(c=M("size-2 rounded-full",l),t[10]=l,t[11]=c):c=t[11];let i;t[12]!==c?(i=(0,B.jsx)("span",{"aria-hidden":"true",className:c}),t[12]=c,t[13]=i):i=t[13];let o;return t[14]!==a||t[15]!==i||t[16]!==s?(o=(0,B.jsxs)("span",{"aria-live":"polite",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","data-status":a,"data-testid":"dash-connection",role:"status",children:[i,s]}),t[14]=a,t[15]=i,t[16]=s,t[17]=o):o=t[17],o},"T");var r=T(le(),1);var Ae={crit:"destructive",ok:"secondary",warn:"default"},U=f((t,e)=>e===0?"\u2014":`${(t/e*100).toFixed(1)}%`,"P"),X=f((t,e,a)=>Number.isNaN(t)?"ok":t>=a?"crit":t>=e?"warn":"ok","z"),xe=.01,ve=.05,je=f(t=>{let e=(0,Y.c)(36),{errorCount:a,logsError:s,topErrors:l,worstFunctions:c}=t,i=D(),o;e[0]!==i?(o=i("Functions by error rate"),e[0]=i,e[1]=o):o=e[1];let n;e[2]!==o?(n=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[2]=o,e[3]=n):n=e[3];let m;e[4]!==i||e[5]!==c?(m=c.length===0?(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:i("No function activity yet.")}):(0,r.jsx)("ul",{className:"divide-y divide-border",children:c.map(w=>(0,r.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2 text-xs","data-testid":"hl-fn-row",children:[(0,r.jsx)("span",{className:"truncate font-mono text-foreground",children:w.path}),(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,r.jsx)("span",{className:"tabular-nums text-muted-foreground",children:i("{count} calls",{count:w.calls.toString()})}),(0,r.jsx)(P,{variant:Ae[X(w.errors/w.calls,xe,ve)],children:U(w.errors,w.calls)})]})]},w.path))}),e[4]=i,e[5]=c,e[6]=m):m=e[6];let p;e[7]!==n||e[8]!==m?(p=(0,r.jsxs)(C,{className:"gap-0 py-0","data-testid":"hl-functions",children:[n,m]}),e[7]=n,e[8]=m,e[9]=p):p=e[9];let v;e[10]!==i?(v=i("Recent errors"),e[10]=i,e[11]=v):v=e[11];let d;e[12]!==v?(d=(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v}),e[12]=v,e[13]=d):d=e[13];let u=a>0?"destructive":"outline",g;e[14]!==a||e[15]!==u?(g=(0,r.jsx)(P,{"data-testid":"hl-error-count",variant:u,children:a}),e[14]=a,e[15]=u,e[16]=g):g=e[16];let x;e[17]!==d||e[18]!==g?(x=(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[d,g]}),e[17]=d,e[18]=g,e[19]=x):x=e[19];let S;e[20]!==s?(S=s!==null&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:s}),e[20]=s,e[21]=S):S=e[21];let E;e[22]!==s||e[23]!==i||e[24]!==l.length?(E=s===null&&l.length===0&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:i("No recent errors.")}),e[22]=s,e[23]=i,e[24]=l.length,e[25]=E):E=e[25];let q;e[26]!==l?(q=l.length>0&&(0,r.jsx)("ul",{className:"divide-y divide-border",children:l.map(Ce)}),e[26]=l,e[27]=q):q=e[27];let N;e[28]!==S||e[29]!==E||e[30]!==q||e[31]!==x?(N=(0,r.jsxs)(C,{className:"gap-0 py-0",children:[x,S,E,q]}),e[28]=S,e[29]=E,e[30]=q,e[31]=x,e[32]=N):N=e[32];let k;return e[33]!==N||e[34]!==p?(k=(0,r.jsxs)("div",{className:"grid gap-3 lg:grid-cols-2",children:[p,N]}),e[33]=N,e[34]=p,e[35]=k):k=e[35],k},"ye");function Ce(t,e){return(0,r.jsxs)("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("time",{className:"shrink-0 text-muted-foreground",children:ie(t.timestamp)}),t.functionPath!==void 0&&(0,r.jsx)("span",{className:"truncate font-mono text-foreground",children:t.functionPath})]}),(0,r.jsx)("span",{className:"text-destructive",children:t.message})]},`${t.timestamp.toString()}-${e.toString()}`)}f(Ce,"Te");var pe={completed:0,failed:2,in_progress:1},Ie=f(t=>{let e=0,a=0,s=0,l=0,c=!1,i=[];for(let{metrics:o}of t){if(o===null){l+=1;continue}s+=1,e+=o.requests,a+=o.errors,i.push(...o.history??[]),c||=o.historyTruncated===!0}return{errors:a,failed:l,history:i,historyTruncated:c,reachable:s,requests:e}},"Ae"),Te=f(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.path);if(l===void 0){e.set(s.path,{...s});continue}l.calls+=s.calls,l.errors+=s.errors,l.totalDurationMs+=s.totalDurationMs,l.scans=(l.scans??0)+(s.scans??0),l.maxDurationMs=Math.max(l.maxDurationMs,s.maxDurationMs),l.lastCalledAt=Math.max(l.lastCalledAt,s.lastCalledAt),(s.lastErrorAt??0)>(l.lastErrorAt??0)&&(l.lastErrorAt=s.lastErrorAt,l.lastErrorMessage=s.lastErrorMessage)}return[...e.values()]},"ke"),De=f(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.id);if(l===void 0){e.set(s.id,s);continue}let c=pe[s.status]-pe[l.status];(c>0||c===0&&(s.updatedAt??0)>(l.updatedAt??0))&&e.set(s.id,s)}return[...e.values()]},"Re"),Pe=I(A.getAuthMetrics),Fe=I(A.getFunctionStats),Le=I(A.getLogs),Re=I(A.getMetrics),ze=I(A.migrationStatus),Oe=5,ge=2e3,Ke=5,_e=.1,$e=.3,Be=1,He=50,Ue=f((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","Pe"),Ge=f(t=>{let e=new Map;for(let s of t??[]){let l=e.get(s.bucketMs)??{calls:0,errors:0};l.calls+=s.calls,l.errors+=s.errors,e.set(s.bucketMs,l)}let a=[...e.entries()].toSorted((s,l)=>s[0]-l[0]);return{errors:a.map(([,s])=>s.errors),requests:a.map(([,s])=>s.calls)}},"Ge"),Ve=f(t=>{let e=0,a=0;for(let l of t)l.status==="failed"?e+=1:l.status==="in_progress"&&(a+=1);let s="ok";return e>0?s="crit":a>0&&(s="warn"),{failed:e,level:s,running:a}},"Ve"),Je=f((t,e)=>t.failed>0?e("{count} failed",{count:t.failed.toString()}):t.running>0?e("{count} running",{count:t.running.toString()}):e("OK"),"Be"),be={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},Ne={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},Qe={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},We=f(t=>t.includes("crit")?"crit":t.includes("warn")?"warn":"ok","Ke"),H=f(t=>{let e=(0,Y.c)(19),{chart:a,label:s,level:l,testId:c,value:i}=t,o=be[l],n;e[0]!==o?(n=M("size-1.5 shrink-0 rounded-full",o),e[0]=o,e[1]=n):n=e[1];let m;e[2]!==n?(m=(0,r.jsx)("span",{"aria-hidden":"true",className:n}),e[2]=n,e[3]=m):m=e[3];let p;e[4]!==s||e[5]!==m?(p=(0,r.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[m,s]}),e[4]=s,e[5]=m,e[6]=p):p=e[6];let v=Ne[l],d;e[7]!==v?(d=M("truncate text-2xl font-semibold tabular-nums",v),e[7]=v,e[8]=d):d=e[8];let u;e[9]!==d||e[10]!==c||e[11]!==i?(u=(0,r.jsx)("span",{className:d,"data-testid":c,children:i}),e[9]=d,e[10]=c,e[11]=i,e[12]=u):u=e[12];let g;e[13]!==a||e[14]!==u?(g=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[u,a]}),e[13]=a,e[14]=u,e[15]=g):g=e[15];let x;return e[16]!==p||e[17]!==g?(x=(0,r.jsx)(C,{className:"gap-0 py-0",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[p,g]})}),e[16]=p,e[17]=g,e[18]=x):x=e[18],x},"U"),Xe=f(async(t,e,a)=>{let s=await Promise.all(a.map(d=>{let u=Q(d);return Promise.allSettled([t.query(Re,{},u),t.query(Fe,{},u),t.query(ze,{},u)])})),l=Q(e),c=typeof t.schedulerStatus=="function"?t.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[i,o,n]=await Promise.allSettled([t.query(Le,{},l),t.query(Pe,{},l),c]),m=s.map(([d,u,g])=>({functions:u.status==="fulfilled"?u.value.functions:[],metrics:d.status==="fulfilled"?d.value:null,migrations:g.status==="fulfilled"?g.value.migrations:[]})),p=Ie(m),v=s[0]?.[0];return{auth:o.status==="fulfilled"?o.value:null,entries:i.status==="fulfilled"?i.value.entries:[],functions:Te(m.map(d=>d.functions)),logsError:i.status==="rejected"?W(i.reason):null,metricsError:p.reachable===0&&v?.status==="rejected"?W(v.reason):null,migrations:De(m.map(d=>d.migrations)),scheduler:n.status==="fulfilled"?n.value:null,totals:p}},"$e"),Ye=f(t=>{let e=t?.history??[];return{attempts:e.map(a=>a.attempts),failures:e.map(a=>a.failures)}},"ze"),xt=f(({initialShardKey:t})=>{let e=ne(),a=D(),[s,l]=(0,h.useState)([]),[c,i]=(0,h.useState)(null),[o,n]=(0,h.useState)(null),[m,p]=(0,h.useState)(null),[v,d]=(0,h.useState)([]),[u,g]=(0,h.useState)(null),[x,S]=(0,h.useState)(null),[E,q]=(0,h.useState)([]),[N]=(0,h.useState)(de),k=(0,h.useRef)(!1),w=(0,h.useRef)(0),G=(0,h.useRef)(0),j=(0,h.useRef)(null),F=t??"",L=(0,h.useCallback)(async()=>{if(k.current)return;k.current=!0;let b=w.current,y=await Xe(e,F,me(F,N));b===w.current&&(n(y.totals),p(y.metricsError),d(y.functions),q(y.migrations),l(y.entries),i(y.logsError),g(y.auth),S(y.scheduler),k.current=!1)},[e,N,F]);(0,h.useEffect)(()=>(_(L()),()=>{w.current+=1,k.current=!1,j.current!==null&&(clearTimeout(j.current),j.current=null)}),[L]);let ye=f(()=>{let b=Date.now()-G.current;if(b>=ge){G.current=Date.now(),_(L());return}j.current===null&&(j.current=setTimeout(()=>{j.current=null,G.current=Date.now(),_(L())},ge-b))},"ue"),{data:Z,liveError:we}=ce(A.getMetrics,{},{live:!0,shardKey:F});(0,h.useEffect)(()=>{Z!==void 0&&ye()},[Z]);let ee=s.filter(b=>b.level==="error"),ke=ee.slice(0,Oe),R=Ge(o?.history),te=Ye(u),Se=v.filter(b=>b.calls>0).toSorted((b,y)=>y.errors/y.calls-b.errors/b.calls||y.calls-b.calls).slice(0,Ke),V=Ve(E),Ee=o===null||o.requests===0?0:o.errors/o.requests,J=X(Ee,xe,ve),re=u===null?"ok":X(u.failureRate,_e,$e),se=x===null?"ok":Ue(x.backlog,Be,He),z=We([J,re,se,V.level]),O,K;return z==="crit"?(O=a("Critical"),K=a("One or more service levels are breached.")):z==="warn"?(O=a("Degraded"),K=a("Some service levels need attention.")):(O=a("All systems healthy"),K=a("All service levels are within target.")),(0,r.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[(0,r.jsxs)(C,{className:"gap-0 py-0",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:M("flex size-10 shrink-0 items-center justify-center rounded-full",Qe[z]),children:(0,r.jsx)("span",{className:M("size-3 rounded-full",be[z])})}),(0,r.jsxs)("div",{className:"grid leading-tight",children:[(0,r.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:O}),(0,r.jsx)("span",{className:"text-[13px] text-muted-foreground",children:K})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Requests")}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[R.requests.length>=2&&(0,r.jsx)($,{ariaLabel:a("Requests over time"),className:"h-6 w-20 text-foreground",series:R.requests,testId:"hl-spark-requests"}),(0,r.jsx)("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:(o?.requests??0).toString()})]})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Error rate")}),(0,r.jsx)("div",{className:M("text-lg font-semibold tabular-nums",Ne[J]),"data-testid":"hl-error-rate",children:o===null?"\u2014":U(o.errors,o.requests)})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(he,{}),(0,r.jsx)(ue,{message:we,prefix:"hl"})]})]})]}),m!==null&&(0,r.jsx)("div",{className:"border-t border-border bg-destructive/5 px-4 py-2 text-sm text-destructive","data-testid":"hl-metrics-error",role:"alert",children:m}),m===null&&o?.historyTruncated===!0&&(0,r.jsx)("div",{className:"border-t border-border bg-warning/5 px-4 py-2 text-sm text-muted-foreground","data-testid":"hl-history-truncated",children:a("Showing a partial request/error history \u2014 one or more shards have more data than the trend chart can display.")})]}),(0,r.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[(0,r.jsx)(H,{chart:R.errors.length>=2?(0,r.jsx)($,{ariaLabel:a("Errors over time"),className:"h-7 w-20 text-destructive",series:R.errors,testId:"hl-spark-errors"}):void 0,label:a("Error rate"),level:J,testId:"hl-slo-errorrate",value:o===null?"\u2014":U(o.errors,o.requests)}),(0,r.jsx)(H,{chart:te.failures.length>=2?(0,r.jsx)($,{ariaLabel:a("Auth failures over time"),className:"h-7 w-20 text-destructive",series:te.failures,testId:"hl-spark-auth"}):void 0,label:a("Auth failures"),level:re,testId:"hl-slo-auth",value:u===null?"\u2014":U(u.failures,u.attempts)}),(0,r.jsx)(H,{label:a("Scheduler backlog"),level:se,testId:"hl-slo-backlog",value:x===null?"\u2014":x.backlog.toString()}),(0,r.jsx)(H,{label:a("Migrations"),level:V.level,testId:"hl-slo-migrations",value:Je(V,a)})]}),(0,r.jsx)(je,{errorCount:ee.length,logsError:c,topErrors:ke,worstFunctions:Se}),(0,r.jsxs)(C,{className:"gap-0 py-0",children:[(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Shards seen")}),(0,r.jsx)(P,{"data-testid":"hl-shard-count",variant:"outline",children:N.length})]}),N.length>0&&(0,r.jsx)("ul",{className:"flex flex-wrap gap-1.5 p-4",children:N.map(b=>(0,r.jsx)("li",{"data-testid":"hl-shard",children:(0,r.jsx)(P,{variant:"secondary",children:b})},b))})]})]})},"ut");export{xt as HealthPanel};
1
+ import{b as me}from"./chunk-72GVG7ZA.js";import{a as $}from"./chunk-T6OJSDQH.js";import{a as ue}from"./chunk-Z5O2NQAV.js";import"./chunk-AVXGLRYX.js";import"./chunk-5JDWLCSH.js";import"./chunk-EVTM6Q43.js";import{a as de}from"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{b as P}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import"./chunk-35DM4JJG.js";import{a as A}from"./chunk-4ZEL6BYL.js";import{c as ce}from"./chunk-ZDPY27UY.js";import{f as ne,g as oe}from"./chunk-GUD3ZG3Z.js";import"./chunk-FSRSK4LY.js";import"./chunk-PUGHZTBL.js";import{a as C}from"./chunk-N6NMLJ6R.js";import{d as D,f as I,g as Q,h as W,p as _,t as ie}from"./chunk-PTZD7RUZ.js";import{a as f,d as T,e as qe,f as ae,g as le,i as M}from"./chunk-YKXDMIHQ.js";var Y=T(ae(),1);var h=T(qe(),1);var fe=T(ae(),1);var B=T(le(),1);var Me={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive",polling:"bg-warning"},he=f(()=>{let t=(0,fe.c)(18),e=D(),a=oe(),s;e:switch(a){case"connected":{let n;t[0]!==e?(n=e("Connected"),t[0]=e,t[1]=n):n=t[1],s=n;break e}case"connecting":{let n;t[2]!==e?(n=e("Connecting\u2026"),t[2]=e,t[3]=n):n=t[3],s=n;break e}case"idle":{let n;t[4]!==e?(n=e("Idle"),t[4]=e,t[5]=n):n=t[5],s=n;break e}case"offline":{let n;t[6]!==e?(n=e("Offline"),t[6]=e,t[7]=n):n=t[7],s=n;break e}case"polling":{let n;t[8]!==e?(n=e("Polling"),t[8]=e,t[9]=n):n=t[9],s=n;break e}default:s=a}let l=Me[a],c;t[10]!==l?(c=M("size-2 rounded-full",l),t[10]=l,t[11]=c):c=t[11];let i;t[12]!==c?(i=(0,B.jsx)("span",{"aria-hidden":"true",className:c}),t[12]=c,t[13]=i):i=t[13];let o;return t[14]!==a||t[15]!==i||t[16]!==s?(o=(0,B.jsxs)("span",{"aria-live":"polite",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","data-status":a,"data-testid":"dash-connection",role:"status",children:[i,s]}),t[14]=a,t[15]=i,t[16]=s,t[17]=o):o=t[17],o},"T");var r=T(le(),1);var Ae={crit:"destructive",ok:"secondary",warn:"default"},U=f((t,e)=>e===0?"\u2014":`${(t/e*100).toFixed(1)}%`,"P"),X=f((t,e,a)=>Number.isNaN(t)?"ok":t>=a?"crit":t>=e?"warn":"ok","z"),xe=.01,ve=.05,je=f(t=>{let e=(0,Y.c)(36),{errorCount:a,logsError:s,topErrors:l,worstFunctions:c}=t,i=D(),o;e[0]!==i?(o=i("Functions by error rate"),e[0]=i,e[1]=o):o=e[1];let n;e[2]!==o?(n=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[2]=o,e[3]=n):n=e[3];let m;e[4]!==i||e[5]!==c?(m=c.length===0?(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:i("No function activity yet.")}):(0,r.jsx)("ul",{className:"divide-y divide-border",children:c.map(w=>(0,r.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2 text-xs","data-testid":"hl-fn-row",children:[(0,r.jsx)("span",{className:"truncate font-mono text-foreground",children:w.path}),(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,r.jsx)("span",{className:"tabular-nums text-muted-foreground",children:i("{count} calls",{count:w.calls.toString()})}),(0,r.jsx)(P,{variant:Ae[X(w.errors/w.calls,xe,ve)],children:U(w.errors,w.calls)})]})]},w.path))}),e[4]=i,e[5]=c,e[6]=m):m=e[6];let p;e[7]!==n||e[8]!==m?(p=(0,r.jsxs)(C,{className:"gap-0 py-0","data-testid":"hl-functions",children:[n,m]}),e[7]=n,e[8]=m,e[9]=p):p=e[9];let v;e[10]!==i?(v=i("Recent errors"),e[10]=i,e[11]=v):v=e[11];let d;e[12]!==v?(d=(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v}),e[12]=v,e[13]=d):d=e[13];let u=a>0?"destructive":"outline",g;e[14]!==a||e[15]!==u?(g=(0,r.jsx)(P,{"data-testid":"hl-error-count",variant:u,children:a}),e[14]=a,e[15]=u,e[16]=g):g=e[16];let x;e[17]!==d||e[18]!==g?(x=(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[d,g]}),e[17]=d,e[18]=g,e[19]=x):x=e[19];let S;e[20]!==s?(S=s!==null&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:s}),e[20]=s,e[21]=S):S=e[21];let E;e[22]!==s||e[23]!==i||e[24]!==l.length?(E=s===null&&l.length===0&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:i("No recent errors.")}),e[22]=s,e[23]=i,e[24]=l.length,e[25]=E):E=e[25];let q;e[26]!==l?(q=l.length>0&&(0,r.jsx)("ul",{className:"divide-y divide-border",children:l.map(Ce)}),e[26]=l,e[27]=q):q=e[27];let N;e[28]!==S||e[29]!==E||e[30]!==q||e[31]!==x?(N=(0,r.jsxs)(C,{className:"gap-0 py-0",children:[x,S,E,q]}),e[28]=S,e[29]=E,e[30]=q,e[31]=x,e[32]=N):N=e[32];let k;return e[33]!==N||e[34]!==p?(k=(0,r.jsxs)("div",{className:"grid gap-3 lg:grid-cols-2",children:[p,N]}),e[33]=N,e[34]=p,e[35]=k):k=e[35],k},"ye");function Ce(t,e){return(0,r.jsxs)("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("time",{className:"shrink-0 text-muted-foreground",children:ie(t.timestamp)}),t.functionPath!==void 0&&(0,r.jsx)("span",{className:"truncate font-mono text-foreground",children:t.functionPath})]}),(0,r.jsx)("span",{className:"text-destructive",children:t.message})]},`${t.timestamp.toString()}-${e.toString()}`)}f(Ce,"Te");var pe={completed:0,failed:2,in_progress:1},Ie=f(t=>{let e=0,a=0,s=0,l=0,c=!1,i=[];for(let{metrics:o}of t){if(o===null){l+=1;continue}s+=1,e+=o.requests,a+=o.errors,i.push(...o.history??[]),c||=o.historyTruncated===!0}return{errors:a,failed:l,history:i,historyTruncated:c,reachable:s,requests:e}},"Ae"),Te=f(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.path);if(l===void 0){e.set(s.path,{...s});continue}l.calls+=s.calls,l.errors+=s.errors,l.totalDurationMs+=s.totalDurationMs,l.scans=(l.scans??0)+(s.scans??0),l.maxDurationMs=Math.max(l.maxDurationMs,s.maxDurationMs),l.lastCalledAt=Math.max(l.lastCalledAt,s.lastCalledAt),(s.lastErrorAt??0)>(l.lastErrorAt??0)&&(l.lastErrorAt=s.lastErrorAt,l.lastErrorMessage=s.lastErrorMessage)}return[...e.values()]},"ke"),De=f(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.id);if(l===void 0){e.set(s.id,s);continue}let c=pe[s.status]-pe[l.status];(c>0||c===0&&(s.updatedAt??0)>(l.updatedAt??0))&&e.set(s.id,s)}return[...e.values()]},"Re"),Pe=I(A.getAuthMetrics),Fe=I(A.getFunctionStats),Le=I(A.getLogs),Re=I(A.getMetrics),ze=I(A.migrationStatus),Oe=5,ge=2e3,Ke=5,_e=.1,$e=.3,Be=1,He=50,Ue=f((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","Pe"),Ge=f(t=>{let e=new Map;for(let s of t??[]){let l=e.get(s.bucketMs)??{calls:0,errors:0};l.calls+=s.calls,l.errors+=s.errors,e.set(s.bucketMs,l)}let a=[...e.entries()].toSorted((s,l)=>s[0]-l[0]);return{errors:a.map(([,s])=>s.errors),requests:a.map(([,s])=>s.calls)}},"Ge"),Ve=f(t=>{let e=0,a=0;for(let l of t)l.status==="failed"?e+=1:l.status==="in_progress"&&(a+=1);let s="ok";return e>0?s="crit":a>0&&(s="warn"),{failed:e,level:s,running:a}},"Ve"),Je=f((t,e)=>t.failed>0?e("{count} failed",{count:t.failed.toString()}):t.running>0?e("{count} running",{count:t.running.toString()}):e("OK"),"Be"),be={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},Ne={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},Qe={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},We=f(t=>t.includes("crit")?"crit":t.includes("warn")?"warn":"ok","Ke"),H=f(t=>{let e=(0,Y.c)(19),{chart:a,label:s,level:l,testId:c,value:i}=t,o=be[l],n;e[0]!==o?(n=M("size-1.5 shrink-0 rounded-full",o),e[0]=o,e[1]=n):n=e[1];let m;e[2]!==n?(m=(0,r.jsx)("span",{"aria-hidden":"true",className:n}),e[2]=n,e[3]=m):m=e[3];let p;e[4]!==s||e[5]!==m?(p=(0,r.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[m,s]}),e[4]=s,e[5]=m,e[6]=p):p=e[6];let v=Ne[l],d;e[7]!==v?(d=M("truncate text-2xl font-semibold tabular-nums",v),e[7]=v,e[8]=d):d=e[8];let u;e[9]!==d||e[10]!==c||e[11]!==i?(u=(0,r.jsx)("span",{className:d,"data-testid":c,children:i}),e[9]=d,e[10]=c,e[11]=i,e[12]=u):u=e[12];let g;e[13]!==a||e[14]!==u?(g=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[u,a]}),e[13]=a,e[14]=u,e[15]=g):g=e[15];let x;return e[16]!==p||e[17]!==g?(x=(0,r.jsx)(C,{className:"gap-0 py-0",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[p,g]})}),e[16]=p,e[17]=g,e[18]=x):x=e[18],x},"U"),Xe=f(async(t,e,a)=>{let s=await Promise.all(a.map(d=>{let u=Q(d);return Promise.allSettled([t.query(Re,{},u),t.query(Fe,{},u),t.query(ze,{},u)])})),l=Q(e),c=typeof t.schedulerStatus=="function"?t.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[i,o,n]=await Promise.allSettled([t.query(Le,{},l),t.query(Pe,{},l),c]),m=s.map(([d,u,g])=>({functions:u.status==="fulfilled"?u.value.functions:[],metrics:d.status==="fulfilled"?d.value:null,migrations:g.status==="fulfilled"?g.value.migrations:[]})),p=Ie(m),v=s[0]?.[0];return{auth:o.status==="fulfilled"?o.value:null,entries:i.status==="fulfilled"?i.value.entries:[],functions:Te(m.map(d=>d.functions)),logsError:i.status==="rejected"?W(i.reason):null,metricsError:p.reachable===0&&v?.status==="rejected"?W(v.reason):null,migrations:De(m.map(d=>d.migrations)),scheduler:n.status==="fulfilled"?n.value:null,totals:p}},"$e"),Ye=f(t=>{let e=t?.history??[];return{attempts:e.map(a=>a.attempts),failures:e.map(a=>a.failures)}},"ze"),xt=f(({initialShardKey:t})=>{let e=ne(),a=D(),[s,l]=(0,h.useState)([]),[c,i]=(0,h.useState)(null),[o,n]=(0,h.useState)(null),[m,p]=(0,h.useState)(null),[v,d]=(0,h.useState)([]),[u,g]=(0,h.useState)(null),[x,S]=(0,h.useState)(null),[E,q]=(0,h.useState)([]),[N]=(0,h.useState)(de),k=(0,h.useRef)(!1),w=(0,h.useRef)(0),G=(0,h.useRef)(0),j=(0,h.useRef)(null),F=t??"",L=(0,h.useCallback)(async()=>{if(k.current)return;k.current=!0;let b=w.current,y=await Xe(e,F,me(F,N));b===w.current&&(n(y.totals),p(y.metricsError),d(y.functions),q(y.migrations),l(y.entries),i(y.logsError),g(y.auth),S(y.scheduler),k.current=!1)},[e,N,F]);(0,h.useEffect)(()=>(_(L()),()=>{w.current+=1,k.current=!1,j.current!==null&&(clearTimeout(j.current),j.current=null)}),[L]);let ye=f(()=>{let b=Date.now()-G.current;if(b>=ge){G.current=Date.now(),_(L());return}j.current===null&&(j.current=setTimeout(()=>{j.current=null,G.current=Date.now(),_(L())},ge-b))},"ue"),{data:Z,liveError:we}=ce(A.getMetrics,{},{live:!0,shardKey:F});(0,h.useEffect)(()=>{Z!==void 0&&ye()},[Z]);let ee=s.filter(b=>b.level==="error"),ke=ee.slice(0,Oe),R=Ge(o?.history),te=Ye(u),Se=v.filter(b=>b.calls>0).toSorted((b,y)=>y.errors/y.calls-b.errors/b.calls||y.calls-b.calls).slice(0,Ke),V=Ve(E),Ee=o===null||o.requests===0?0:o.errors/o.requests,J=X(Ee,xe,ve),re=u===null?"ok":X(u.failureRate,_e,$e),se=x===null?"ok":Ue(x.backlog,Be,He),z=We([J,re,se,V.level]),O,K;return z==="crit"?(O=a("Critical"),K=a("One or more service levels are breached.")):z==="warn"?(O=a("Degraded"),K=a("Some service levels need attention.")):(O=a("All systems healthy"),K=a("All service levels are within target.")),(0,r.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[(0,r.jsxs)(C,{className:"gap-0 py-0",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:M("flex size-10 shrink-0 items-center justify-center rounded-full",Qe[z]),children:(0,r.jsx)("span",{className:M("size-3 rounded-full",be[z])})}),(0,r.jsxs)("div",{className:"grid leading-tight",children:[(0,r.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:O}),(0,r.jsx)("span",{className:"text-[13px] text-muted-foreground",children:K})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Requests")}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[R.requests.length>=2&&(0,r.jsx)($,{ariaLabel:a("Requests over time"),className:"h-6 w-20 text-foreground",series:R.requests,testId:"hl-spark-requests"}),(0,r.jsx)("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:(o?.requests??0).toString()})]})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Error rate")}),(0,r.jsx)("div",{className:M("text-lg font-semibold tabular-nums",Ne[J]),"data-testid":"hl-error-rate",children:o===null?"\u2014":U(o.errors,o.requests)})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(he,{}),(0,r.jsx)(ue,{message:we,prefix:"hl"})]})]})]}),m!==null&&(0,r.jsx)("div",{className:"border-t border-border bg-destructive/5 px-4 py-2 text-sm text-destructive","data-testid":"hl-metrics-error",role:"alert",children:m}),m===null&&o?.historyTruncated===!0&&(0,r.jsx)("div",{className:"border-t border-border bg-warning/5 px-4 py-2 text-sm text-muted-foreground","data-testid":"hl-history-truncated",children:a("Showing a partial request/error history \u2014 one or more shards have more data than the trend chart can display.")})]}),(0,r.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[(0,r.jsx)(H,{chart:R.errors.length>=2?(0,r.jsx)($,{ariaLabel:a("Errors over time"),className:"h-7 w-20 text-destructive",series:R.errors,testId:"hl-spark-errors"}):void 0,label:a("Error rate"),level:J,testId:"hl-slo-errorrate",value:o===null?"\u2014":U(o.errors,o.requests)}),(0,r.jsx)(H,{chart:te.failures.length>=2?(0,r.jsx)($,{ariaLabel:a("Auth failures over time"),className:"h-7 w-20 text-destructive",series:te.failures,testId:"hl-spark-auth"}):void 0,label:a("Auth failures"),level:re,testId:"hl-slo-auth",value:u===null?"\u2014":U(u.failures,u.attempts)}),(0,r.jsx)(H,{label:a("Scheduler backlog"),level:se,testId:"hl-slo-backlog",value:x===null?"\u2014":x.backlog.toString()}),(0,r.jsx)(H,{label:a("Migrations"),level:V.level,testId:"hl-slo-migrations",value:Je(V,a)})]}),(0,r.jsx)(je,{errorCount:ee.length,logsError:c,topErrors:ke,worstFunctions:Se}),(0,r.jsxs)(C,{className:"gap-0 py-0",children:[(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Shards seen")}),(0,r.jsx)(P,{"data-testid":"hl-shard-count",variant:"outline",children:N.length})]}),N.length>0&&(0,r.jsx)("ul",{className:"flex flex-wrap gap-1.5 p-4",children:N.map(b=>(0,r.jsx)("li",{"data-testid":"hl-shard",children:(0,r.jsx)(P,{variant:"secondary",children:b})},b))})]})]})},"ut");export{xt as HealthPanel};
@@ -1,4 +1,4 @@
1
- import{a as fn,b as $e,e as Kr,f as Ur}from"./chunk-AANB526D.js";import{a as Br,b as bt,c as qr,d as pn}from"./chunk-OOTQQBVC.js";import{a as mn}from"./chunk-MXLAOCAN.js";import{b as dn}from"./chunk-CMA4PTV7.js";import{d as Jr}from"./chunk-UYEZR3BI.js";import{a as un}from"./chunk-CSUROWL2.js";import"./chunk-RFNGDE33.js";import"./chunk-V3CZW3JB.js";import"./chunk-MU3P2FI7.js";import{a as Le}from"./chunk-NCFRIHLB.js";import{a as mo,b as go,c as gn,d as Gr}from"./chunk-YOB2X3FZ.js";import{a as cn}from"./chunk-3FBLWUXD.js";import{a as Lt}from"./chunk-XZMOZFE6.js";import{a as co}from"./chunk-IMOHEGMV.js";import{a as an}from"./chunk-UXXDN6Z3.js";import{a as jr}from"./chunk-66UGPQVC.js";import{b as Nr,c as lo}from"./chunk-6DAD3RFX.js";import"./chunk-YPRQLCKF.js";import"./chunk-GMS77BZD.js";import"./chunk-3Q2P62UR.js";import{a as uo}from"./chunk-QKEJLVC5.js";import"./chunk-AWHXPIXU.js";import"./chunk-V3VJAA4D.js";import{a as io}from"./chunk-NFS7FTAR.js";import{a as Er}from"./chunk-EJSI4PMU.js";import{a as Ar,b as Or}from"./chunk-OGUKYRFM.js";import{c as Ir,d as Fr,e as Mr}from"./chunk-6D6Z2KXU.js";import{b as Dr,c as Tr,f as so}from"./chunk-OKG3HWSJ.js";import{W as kr}from"./chunk-PLHA3OWK.js";import{b as Mi}from"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as rn}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import"./chunk-225VJ77I.js";import{a as _e}from"./chunk-4ZEL6BYL.js";import{b as ro,c as dt}from"./chunk-RPJEAHAZ.js";import{f as ot}from"./chunk-TI33XMKX.js";import"./chunk-FSRSK4LY.js";import"./chunk-NPF3GY2E.js";import{a as ln}from"./chunk-FKVZRPV5.js";import{a as Vr,b as zr,c as $r,d as ao,e as Hr,f as Lr}from"./chunk-HEAQVSNS.js";import{d as oe,f as Ve,g as ze,h as Ht,m as oo,n as sn,o as Oe,p as re,t as Pr}from"./chunk-PTZD7RUZ.js";import{a as o,d as Ie,e as ut,f as zt,g as $t,i as pt}from"./chunk-YKXDMIHQ.js";var Qa=Ie(zt(),1);var Ot=Ie(ut(),1);var q=Ie(zt(),1);var D=Ie(ut(),1);var It=Ie(zt(),1);var Y=Ie($t(),1),rt=Ie(ut(),1);var ki=2166136261,Pi=16777619,Ni=o((t,e=ki)=>{let n=e;for(let l=0;l<t.length;l+=1)n^=t.charCodeAt(l),n=Math.imul(n,Pi);return(n>>>0).toString(16).padStart(8,"0")},"I"),Di=/([a-z\d])([A-Z])/gu,Ti=/[\s_-]+/u,Ai=new Set(["access_token","api_key","apikey","card_number","client_secret","credit_card","cvv","passwd","password","private_key","pwd","refresh_token","secret","ssn","token"]),Oi=o(t=>{let e=t.replaceAll(Di,"$1 $2").split(Ti).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]},"le"),Wr="\u2022\u2022\u2022",tl=o((t,e)=>{try{return e==="redact"?null:e==="hash"?t==null?t:Ni(typeof t=="bigint"?t.toString():typeof t=="string"?t:JSON.stringify(t)):Wr}catch{return Wr}},"W"),Qr=o((t,e)=>{let n=new Map;for(let l of t)l.table===e&&n.set(l.column,l.strategy);return n},"j"),Ei=o(t=>{for(let e of Oi(t))if(Ai.has(e))return!0;return!1},"ae"),Xr=o((t,e)=>{let n=e.filter(r=>!t.has(r)&&Ei(r));if(n.length===0)return t;let l=new Map(t);for(let r of n)l.set(r,"redact");return l},"z"),jt=o((t,e,n)=>{if(!n.enabled)return t;let l=n.columns.get(e);return l===void 0?t:tl(t,l)},"Ce"),bn=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]=tl(n[l],r));return n},"ce"),hn=o((t,e)=>!e.enabled||e.columns.size===0?t:t.map(n=>bn(n,e)),"Fe"),Yr=o(t=>t==null?"\u2205":t===""?"(empty)":Oe(t),"B"),Vi=o(t=>{let e=(0,It.c)(32),{column:n,onFacetFilter:l,state:r}=t,s=oe(),a;e[0]!==n||e[1]!==l||e[2]!==r.result?.values?(a=o(w=>{let _=Number(w.currentTarget.dataset.index),S=r.result?.values[_];S!==void 0&&l(n,S.value)},"x"),e[0]=n,e[1]=l,e[2]=r.result?.values,e[3]=a):a=e[3];let c=a,u=`db-facet-${n}`,i;e[4]!==n?(i=(0,Y.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,Y.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,Y.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 b;if(e[14]!==n||e[15]!==c||e[16]!==g){let w;e[18]!==n||e[19]!==c?(w=o((_,S)=>(0,Y.jsxs)("button",{className:"flex items-center justify-between gap-2 rounded px-1 py-0.5 text-left text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground","data-index":S,"data-testid":`db-facet-value-${n}`,onClick:c,type:"button",children:[(0,Y.jsx)("span",{className:"truncate",children:Yr(_.value)}),(0,Y.jsx)("span",{className:"shrink-0 tabular-nums text-foreground/70",children:_.count})]},Yr(_.value)),"c"),e[18]=n,e[19]=c,e[20]=w):w=e[20],b=g.map(w),e[14]=n,e[15]=c,e[16]=g,e[17]=b}else b=e[17];let f;e[21]!==n||e[22]!==r.result||e[23]!==s?(f=r.result?.truncated===!0&&(0,Y.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]!==u||e[26]!==i||e[27]!==d||e[28]!==m||e[29]!==b||e[30]!==f?(h=(0,Y.jsxs)("section",{className:"flex flex-col gap-1","data-testid":u,children:[i,d,m,b,f]}),e[25]=u,e[26]=i,e[27]=d,e[28]=m,e[29]=b,e[30]=f,e[31]=h):h=e[31],h},"ie"),wn=o(t=>{let e=(0,It.c)(44),{columns:n,facets:l,mask:r,onFacetFilter:s,onToggleFacet:a}=t,c=oe(),u;e[0]!==a?(u=o(v=>{let{column:M}=v.currentTarget.dataset;M!==void 0&&a(M)},"o"),e[0]=a,e[1]=u):u=e[1];let i=u,d;e[2]!==r?(d=o(v=>r.enabled&&r.columns.has(v),"a"),e[2]=r,e[3]=d):d=e[3];let m=d,g,b,f,h,w,_,S,y;if(e[4]!==n||e[5]!==l||e[6]!==m||e[7]!==c||e[8]!==i){y=Symbol.for("react.early_return_sentinel");e:{let v;e[17]!==m?(v=o(N=>!m(N),"y"),e[17]=m,e[18]=v):v=e[18];let M=n.filter(v),F;if(e[19]!==l||e[20]!==m?(F=Object.entries(l).filter(N=>{let[T]=N;return!m(T)}),e[19]=l,e[20]=m,e[21]=F):F=e[21],g=F,M.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",S="db-facets",h="flex flex-col gap-1.5";let P;e[22]!==c?(P=c("Facets"),e[22]=c,e[23]=P):P=e[23],e[24]!==P?(w=(0,Y.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:P}),e[24]=P,e[25]=w):w=e[25],b="flex flex-wrap gap-1";let k;e[26]!==l||e[27]!==i?(k=o(N=>(0,Y.jsx)("button",{"aria-pressed":N in l,className:"rounded border border-border px-1.5 py-0.5 text-muted-foreground transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-column":N,"data-testid":`db-facet-toggle-${N}`,onClick:i,type:"button",children:N},N),"A"),e[26]=l,e[27]=i,e[28]=k):k=e[28],f=M.map(k)}e[4]=n,e[5]=l,e[6]=m,e[7]=c,e[8]=i,e[9]=g,e[10]=b,e[11]=f,e[12]=h,e[13]=w,e[14]=_,e[15]=S,e[16]=y}else g=e[9],b=e[10],f=e[11],h=e[12],w=e[13],_=e[14],S=e[15],y=e[16];if(y!==Symbol.for("react.early_return_sentinel"))return y;let I;e[29]!==b||e[30]!==f?(I=(0,Y.jsx)("div",{className:b,children:f}),e[29]=b,e[30]=f,e[31]=I):I=e[31];let C;e[32]!==I||e[33]!==h||e[34]!==w?(C=(0,Y.jsxs)("div",{className:h,children:[w,I]}),e[32]=I,e[33]=h,e[34]=w,e[35]=C):C=e[35];let R;e[36]!==s||e[37]!==g?(R=g.map(v=>{let[M,F]=v;return(0,Y.jsx)(Vi,{column:M,onFacetFilter:s,state:F},M)}),e[36]=s,e[37]=g,e[38]=R):R=e[38];let x;return e[39]!==C||e[40]!==R||e[41]!==_||e[42]!==S?(x=(0,Y.jsxs)("aside",{className:_,"data-testid":S,children:[C,R]}),e[39]=C,e[40]=R,e[41]=_,e[42]=S,e[43]=x):x=e[43],x},"_e"),xn=o(()=>{let[t,e]=(0,rt.useState)({}),n=Le(t),l=(0,rt.useRef)({}),r=o(async(s,a)=>{let c=(l.current[s]??0)+1;l.current[s]=c,e(u=>s in u?{...u,[s]:{error:null,loading:!0,result:u[s]?.result??null}}:u);try{let u=await a(s);if(l.current[s]!==c)return;e(i=>s in i?{...i,[s]:{error:null,loading:!1,result:u}}:i)}catch(u){if(l.current[s]!==c)return;e(i=>s in i?{...i,[s]:{error:Ht(u),loading:!1,result:null}}:i)}},"n");return{clearFacets:o(()=>{e({})},"clearFacets"),facets:t,facetsRef:n,refetchFacets:o(s=>{for(let a of Object.keys(n.current))re(r(a,s))},"refetchFacets"),toggleFacet:o((s,a)=>{if(s in n.current){e(c=>Object.fromEntries(Object.entries(c).filter(([u])=>u!==s)));return}e(c=>({...c,[s]:{error:null,loading:!0,result:null}})),a!==null&&re(r(s,a))},"toggleFacet")}},"Me"),zi=[],$i=o(()=>{let t=(0,It.c)(1),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={},t[0]=e):e=t[0];let{data:n}=dt(_e.maskPolicies,e);return Array.isArray(n?.columns)?n.columns:zi},"de"),Sn=o(t=>{let e=(0,It.c)(16),{columns:n,selectedTable:l}=t,r=$i(),[s,a]=(0,rt.useState)(!0),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=o(()=>{a(Hi)},"g"),e[0]=c):c=e[0];let u=c,i;if(e[1]!==n||e[2]!==r||e[3]!==l){let h=Qr(r,l??"");i=Xr(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:Xr(Qr(r,h),w),enabled:s}),"l"),e[5]=s,e[6]=r,e[7]=m):m=e[7];let g=m,b;e[8]!==d||e[9]!==s?(b={columns:d,enabled:s},e[8]=d,e[9]=s,e[10]=b):b=e[10];let f;return e[11]!==d||e[12]!==s||e[13]!==g||e[14]!==b?(f={maskColumns:d,maskOn:s,maskView:b,maskViewFor:g,onToggleMask:u},e[11]=d,e[12]=s,e[13]=g,e[14]=b,e[15]=f):f=e[15],f},"Te");function Hi(t){return!t}o(Hi,"fe");var Zr=34,el=600,Li=o(t=>{let e=(0,It.c)(21),{item:n,onSelect:l,prefix:r,selected:s,start:a}=t,c;e[0]!==n.name||e[1]!==l?(c=o(()=>{l(n.name)},"g"),e[0]=n.name,e[1]=l,e[2]=c):c=e[2];let u=c,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",b;e[5]!==g?(b=pt("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]=b):b=e[6];let f=`${r}-table-${n.name}`,h;e[7]!==n.name?(h=(0,Y.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,Y.jsx)("span",{className:"shrink-0 rounded bg-muted px-1.5 text-xs tabular-nums text-muted-foreground",children:n.rowCount}),e[9]=n.rowCount,e[10]=w):w=e[10];let _;e[11]!==u||e[12]!==s||e[13]!==b||e[14]!==f||e[15]!==h||e[16]!==w?(_=(0,Y.jsxs)("button",{"aria-pressed":s,className:b,"data-testid":f,onClick:u,type:"button",children:[h,w]}),e[11]=u,e[12]=s,e[13]=b,e[14]=f,e[15]=h,e[16]=w,e[17]=_):_=e[17];let S;return e[18]!==m||e[19]!==_?(S=(0,Y.jsx)("li",{style:m,children:_}),e[18]=m,e[19]=_,e[20]=S):S=e[20],S},"me"),_n=o(({header:t,onReload:e,onSelect:n,prefix:l,reloadLabel:r,selected:s,tables:a})=>{let c=oe(),[u,i]=(0,rt.useState)(""),d=(0,rt.useRef)(null),m=o(h=>{i(h.target.value)},"l"),g=(0,rt.useMemo)(()=>{let h=u.trim().toLowerCase();return h===""?a:a.filter(w=>w.name.toLowerCase().includes(h))},[u,a]),b=dn({count:g.length,estimateSize:o(()=>Zr,"estimateSize"),getScrollElement:o(()=>d.current,"getScrollElement"),initialRect:{height:el,width:240},observeElementRect:o((h,w)=>mn(h,w,el),"observeElementRect"),overscan:12}).getVirtualItems(),f={height:g.length*Zr};return(0,Y.jsxs)("aside",{className:"flex h-full w-60 shrink-0 flex-col border-e border-border bg-sidebar","data-testid":`${l}-table-list`,children:[t,(0,Y.jsxs)("div",{className:"flex h-9 shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[(0,Y.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:c("Tables")}),e!==void 0&&(0,Y.jsx)("button",{"aria-label":r??c("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??c("Refresh"),type:"button",children:(0,Y.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,Y.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})})})]}),(0,Y.jsx)("div",{className:"shrink-0 border-b border-border p-2",children:(0,Y.jsx)("input",{className:"h-7 w-full rounded-md border border-border bg-background px-2 text-xs outline-none placeholder:text-muted-foreground focus-visible:border-ring","data-testid":`${l}-table-search`,onChange:m,placeholder:c("search table\u2026"),type:"search",value:u})}),(0,Y.jsxs)("ul",{className:"relative flex-1 overflow-y-auto p-1.5","data-testid":`${l}-table-list-rows`,ref:d,children:[(0,Y.jsx)("li",{"aria-hidden":"true",style:f}),b.map(h=>{let w=g[h.index];return w===void 0?null:(0,Y.jsx)(Li,{item:w,onSelect:n,prefix:l,selected:s===w.name,start:h.start},w.name)})]})]})},"$e");var p=Ie($t(),1);var nl=Ie(ut(),1);function ji(t){return Bi(t)||typeof t=="function"||Gi(t)}o(ji,"isReactComponent");function Bi(t){return typeof t=="function"&&(()=>{let e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}o(Bi,"isClassComponent");function Gi(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}o(Gi,"isExoticComponent");function ht(t,e){return t==null?null:ji(t)?nl.default.createElement(t,e):t}o(ht,"flexRender");function fo(t){if("cell"in t&&t.cell){let e=t.cell,n=e.column.columnDef,l=e,r=n;return l.getIsAggregated?.()?ht(r.aggregatedCell??n.cell,e.getContext()):l.getIsPlaceholder?.()?null:ht(n.cell,e.getContext())}return"header"in t&&t.header?ht(t.header.column.columnDef.header,t.header.getContext()):"footer"in t&&t.footer?ht(t.footer.column.columnDef.footer,t.footer.getContext()):null}o(fo,"FlexRender");function ol({update:t,notify:e,unwatched:n}){return{link:l,unlink:r,propagate:s,checkDirty:a,shallowPropagate:c};function l(i,d,m){let g=d.depsTail;if(g!==void 0&&g.dep===i)return;let b=g!==void 0?g.nextDep:d.deps;if(b!==void 0&&b.dep===i){b.version=m,d.depsTail=b;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:b,prevSub:f,nextSub:void 0};b!==void 0&&(b.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,b=i.nextDep,f=i.nextSub,h=i.prevSub;return b!==void 0?b.prevDep=g:d.depsTail=g,g!==void 0?g.nextDep=b:d.deps=b,f!==void 0?f.prevSub=h:m.subsTail=h,h!==void 0?h.nextSub=f:(m.subs=f)===void 0&&n(m),b}function s(i){let d=i.nextSub,m;e:do{let g=i.sub,b=g.flags;if(b&60?b&12?b&4?!(b&48)&&u(i,g)?(g.flags=b|40,b&=1):b=0:g.flags=b&-9|32:b=0:g.flags=b|32,b&2&&e(g),b&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,b=!1;e:do{let f=i.dep,h=f.flags;if(d.flags&16)b=!0;else if((h&17)===17){if(t(f)){let w=f.subs;w.nextSub!==void 0&&c(w),b=!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(!b){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,b){if(t(d)){_&&c(w),d=i.sub;continue}b=!1}else d.flags&=-33;d=i.sub;let S=i.nextDep;if(S!==void 0){i=S;continue e}}return b}while(!0)}function c(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 u(i,d){let m=d.depsTail;for(;m!==void 0;){if(m===i)return!0;m=m.prevDep}return!1}}o(ol,"createReactiveSystem");function sl(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(sl,"toObserver");var po=[],vn=0,{link:rl,unlink:qi,propagate:Ki,checkDirty:al,shallowPropagate:ll}=ol({update(t){return t._update()},notify(t){po[bo++]=t,t.flags&=-3},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=17,yn(t))}}),Cn=0,bo=0,Qe,ho=0;function wo(t){try{++ho,t()}finally{--ho||xo()}}o(wo,"batch");function yn(t){let e=t.depsTail,n=e!==void 0?e.nextDep:t.deps;for(;n!==void 0;)n=qi(n,t)}o(yn,"purgeDeps");function xo(){if(!(ho>0)){for(;Cn<bo;){let t=po[Cn];po[Cn++]=void 0,t.notify()}Cn=0,bo=0}}o(xo,"flush");function So(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 Qe!==void 0&&rl(r,Qe,vn),r._snapshot},subscribe(s){let a=sl(s),c={current:!1},u=Ui(()=>{r.get(),c.current?a.next?.(r._snapshot):c.current=!0});return{unsubscribe:o(()=>{u.stop()},"unsubscribe")}},_update(s){let a=Qe,c=e?.compare??Object.is;if(n)Qe=r,++vn,r.depsTail=void 0;else if(s===void 0)return!1;n&&(r.flags=5);try{let u=r._snapshot,i=typeof s=="function"?s(u):s===void 0&&n?l(u):s;return u===void 0||!c(u,i)?(r._snapshot=i,!0):!1}finally{Qe=a,n&&(r.flags&=-5),yn(r)}}};return n?(r.flags=17,r.get=function(){let s=r.flags;if(s&16||s&32&&al(r.deps,r)){if(r._update()){let a=r.subs;a!==void 0&&ll(a)}}else s&32&&(r.flags=s&-33);return Qe!==void 0&&rl(r,Qe,vn),r._snapshot}):r.set=function(s){if(r._update(s)){let a=r.subs;a!==void 0&&(Ki(a),ll(a),xo())}},r}o(So,"createAtom");function Ui(t){let e=o(()=>{let l=Qe;Qe=n,++vn,n.depsTail=void 0,n.flags=6;try{return t()}finally{Qe=l,n.flags&=-5,yn(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&&al(this.deps,this)?e():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,yn(this)}};return e(),n}o(Ui,"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=il(t);if(n.length!==il(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 il(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}o(il,"getOwnKeys");var _o=Ie(ut(),1),cl=Ie(Mi(),1);function Ji(t,e){return t===e}o(Ji,"defaultCompare");function Bt(t,e=l=>l,n){let l=n?.compare??Ji,r=(0,_o.useCallback)(a=>{let{unsubscribe:c}=t.subscribe(a);return c},[t]),s=(0,_o.useCallback)(()=>t.get(),[t]);return(0,cl.useSyncExternalStoreWithSelector)(r,s,s,e,l)}o(Bt,"useSelector");function ul(t){let e=Bt(t.source,t.selector,{compare:lt});return typeof t.children=="function"?t.children(e):t.children}o(ul,"Subscribe");function dl(t){let e=t;return Object.defineProperty(t,"state",{get(){return t.get()}}),"set"in t&&(e.setState=t.set.bind(t)),e}o(dl,"atomToStore");function Co(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,c=!1,u,i=o(()=>{let m=r();return(!c||!a(u,m))&&(u=m,c=!0),u},"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(Co,"renderPhaseReactivity");function vo(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(vo,"createRenderPhaseSource");function ml(){return Co({createAtom:So,batch:wo})}o(ml,"reactReactivity");function Ft(t,e){return typeof t=="function"?t(e):t}o(Ft,"functionalUpdate");function ie(t){if(Array.isArray(t))return t.map(ie);if(t&&typeof t=="object"){let e=Object.getPrototypeOf(t);if(e!==Object.prototype&&e!==null)return t;let n=e===null?H():{},l=Object.keys(t);for(let r=0;r<l.length;r++){let 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 Rn(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(Rn,"copyInstancePropertiesWithoutMemos");function H(){return Object.create(null)}o(H,"makeObjectMap");function je(t,e){return Object.prototype.hasOwnProperty.call(t,e)}o(je,"hasOwn");function Be(t,e){return n=>{(e.options.atoms?.[t]??e.baseAtoms[t]).set(l=>Ft(n,l))}}o(Be,"makeStateUpdater");function gl(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(gl,"isPlainContainer");function fl(t){return Reflect.ownKeys(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}o(fl,"getEnumerableOwnKeys");var Wi=3;function Qi(t,e){return pl(t,e,Wi)}o(Qi,"stateSlicesEqual");function pl(t,e,n){if(Object.is(t,e))return!0;if(n<=0||!gl(t)||!gl(e)||(Array.isArray(t)||Array.isArray(e))&&(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length))return!1;let l=fl(t),r=fl(e);if(l.length!==r.length)return!1;let s=t,a=e;for(let c=0;c<l.length;c++){let u=l[c];if(!Object.prototype.propertyIsEnumerable.call(e,u)||!pl(s[u],a[u],n-1))return!1}return!0}o(pl,"stateSlicesEqualAtDepth");function He(t,e,n,l=Qi){let r=`on${e.charAt(0).toUpperCase()}${e.slice(1)}Change`,s=t.options[r];s&&s(a=>{let c=Ft(n,a);return l(a,c)?a:c})}o(He,"setStateSlice");function bl(t){return t instanceof Function}o(bl,"isFunction");function hl(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(hl,"flattenBy");var Xi=o(({fn:t,memoDeps:e,onAfterCompare:n,onAfterUpdate:l,onBeforeCompare:r,onBeforeUpdate:s})=>{let a=[],c;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?.(),c=t(...d??[]),l?.(c)),c},"memoizedFn")},"memo");function In(t){let e=!1;return()=>{if(!e){e=!0;return}t()}}o(In,"skipFirstRun");var Yi=o((t,e)=>{for(t=String(t);t.length<e;)t=" "+t;return t},"pad");function Mt({feature:t,fnName:e,objectId:n,onAfterUpdate:l,table:r,...s}){let a,c,u=0,i;function d(b,f){let h=u===0?"(1st run)":f?"(rerun #"+u+")":"(cache)";u++,console.groupCollapsed(`%c\u23F1 ${Yi(`${b.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 fn,b as $e,e as Kr,f as Ur}from"./chunk-AANB526D.js";import{a as Br,b as bt,c as qr,d as pn}from"./chunk-DKTDJOYC.js";import{a as mn}from"./chunk-MXLAOCAN.js";import{b as dn}from"./chunk-CMA4PTV7.js";import{d as Jr}from"./chunk-UYEZR3BI.js";import{a as un}from"./chunk-CSUROWL2.js";import"./chunk-RFNGDE33.js";import"./chunk-V3CZW3JB.js";import"./chunk-MU3P2FI7.js";import{a as Le}from"./chunk-NCFRIHLB.js";import{a as mo,b as go,c as gn,d as Gr}from"./chunk-YOB2X3FZ.js";import{a as cn}from"./chunk-3FBLWUXD.js";import{a as Lt}from"./chunk-XZMOZFE6.js";import{a as co}from"./chunk-IMOHEGMV.js";import{a as an}from"./chunk-UXXDN6Z3.js";import{a as jr}from"./chunk-66UGPQVC.js";import{b as Nr,c as lo}from"./chunk-6DAD3RFX.js";import"./chunk-YPRQLCKF.js";import"./chunk-GMS77BZD.js";import"./chunk-3Q2P62UR.js";import{a as uo}from"./chunk-QKEJLVC5.js";import"./chunk-AWHXPIXU.js";import"./chunk-V3VJAA4D.js";import{a as io}from"./chunk-NFS7FTAR.js";import{a as Er}from"./chunk-EJSI4PMU.js";import{a as Ar,b as Or}from"./chunk-OGUKYRFM.js";import{c as Ir,d as Fr,e as Mr}from"./chunk-6D6Z2KXU.js";import{b as Dr,c as Tr,f as so}from"./chunk-OKG3HWSJ.js";import{W as kr}from"./chunk-PLHA3OWK.js";import{b as Mi}from"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as rn}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import"./chunk-225VJ77I.js";import{a as _e}from"./chunk-4ZEL6BYL.js";import{b as ro,c as dt}from"./chunk-ZDPY27UY.js";import{f as ot}from"./chunk-GUD3ZG3Z.js";import"./chunk-FSRSK4LY.js";import"./chunk-PUGHZTBL.js";import{a as ln}from"./chunk-FKVZRPV5.js";import{a as Vr,b as zr,c as $r,d as ao,e as Hr,f as Lr}from"./chunk-HEAQVSNS.js";import{d as oe,f as Ve,g as ze,h as Ht,m as oo,n as sn,o as Oe,p as re,t as Pr}from"./chunk-PTZD7RUZ.js";import{a as o,d as Ie,e as ut,f as zt,g as $t,i as pt}from"./chunk-YKXDMIHQ.js";var Qa=Ie(zt(),1);var Ot=Ie(ut(),1);var q=Ie(zt(),1);var D=Ie(ut(),1);var It=Ie(zt(),1);var Y=Ie($t(),1),rt=Ie(ut(),1);var ki=2166136261,Pi=16777619,Ni=o((t,e=ki)=>{let n=e;for(let l=0;l<t.length;l+=1)n^=t.charCodeAt(l),n=Math.imul(n,Pi);return(n>>>0).toString(16).padStart(8,"0")},"I"),Di=/([a-z\d])([A-Z])/gu,Ti=/[\s_-]+/u,Ai=new Set(["access_token","api_key","apikey","card_number","client_secret","credit_card","cvv","passwd","password","private_key","pwd","refresh_token","secret","ssn","token"]),Oi=o(t=>{let e=t.replaceAll(Di,"$1 $2").split(Ti).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]},"le"),Wr="\u2022\u2022\u2022",tl=o((t,e)=>{try{return e==="redact"?null:e==="hash"?t==null?t:Ni(typeof t=="bigint"?t.toString():typeof t=="string"?t:JSON.stringify(t)):Wr}catch{return Wr}},"W"),Qr=o((t,e)=>{let n=new Map;for(let l of t)l.table===e&&n.set(l.column,l.strategy);return n},"j"),Ei=o(t=>{for(let e of Oi(t))if(Ai.has(e))return!0;return!1},"ae"),Xr=o((t,e)=>{let n=e.filter(r=>!t.has(r)&&Ei(r));if(n.length===0)return t;let l=new Map(t);for(let r of n)l.set(r,"redact");return l},"z"),jt=o((t,e,n)=>{if(!n.enabled)return t;let l=n.columns.get(e);return l===void 0?t:tl(t,l)},"Ce"),bn=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]=tl(n[l],r));return n},"ce"),hn=o((t,e)=>!e.enabled||e.columns.size===0?t:t.map(n=>bn(n,e)),"Fe"),Yr=o(t=>t==null?"\u2205":t===""?"(empty)":Oe(t),"B"),Vi=o(t=>{let e=(0,It.c)(32),{column:n,onFacetFilter:l,state:r}=t,s=oe(),a;e[0]!==n||e[1]!==l||e[2]!==r.result?.values?(a=o(w=>{let _=Number(w.currentTarget.dataset.index),S=r.result?.values[_];S!==void 0&&l(n,S.value)},"x"),e[0]=n,e[1]=l,e[2]=r.result?.values,e[3]=a):a=e[3];let c=a,u=`db-facet-${n}`,i;e[4]!==n?(i=(0,Y.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,Y.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,Y.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 b;if(e[14]!==n||e[15]!==c||e[16]!==g){let w;e[18]!==n||e[19]!==c?(w=o((_,S)=>(0,Y.jsxs)("button",{className:"flex items-center justify-between gap-2 rounded px-1 py-0.5 text-left text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground","data-index":S,"data-testid":`db-facet-value-${n}`,onClick:c,type:"button",children:[(0,Y.jsx)("span",{className:"truncate",children:Yr(_.value)}),(0,Y.jsx)("span",{className:"shrink-0 tabular-nums text-foreground/70",children:_.count})]},Yr(_.value)),"c"),e[18]=n,e[19]=c,e[20]=w):w=e[20],b=g.map(w),e[14]=n,e[15]=c,e[16]=g,e[17]=b}else b=e[17];let f;e[21]!==n||e[22]!==r.result||e[23]!==s?(f=r.result?.truncated===!0&&(0,Y.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]!==u||e[26]!==i||e[27]!==d||e[28]!==m||e[29]!==b||e[30]!==f?(h=(0,Y.jsxs)("section",{className:"flex flex-col gap-1","data-testid":u,children:[i,d,m,b,f]}),e[25]=u,e[26]=i,e[27]=d,e[28]=m,e[29]=b,e[30]=f,e[31]=h):h=e[31],h},"ie"),wn=o(t=>{let e=(0,It.c)(44),{columns:n,facets:l,mask:r,onFacetFilter:s,onToggleFacet:a}=t,c=oe(),u;e[0]!==a?(u=o(v=>{let{column:M}=v.currentTarget.dataset;M!==void 0&&a(M)},"o"),e[0]=a,e[1]=u):u=e[1];let i=u,d;e[2]!==r?(d=o(v=>r.enabled&&r.columns.has(v),"a"),e[2]=r,e[3]=d):d=e[3];let m=d,g,b,f,h,w,_,S,y;if(e[4]!==n||e[5]!==l||e[6]!==m||e[7]!==c||e[8]!==i){y=Symbol.for("react.early_return_sentinel");e:{let v;e[17]!==m?(v=o(N=>!m(N),"y"),e[17]=m,e[18]=v):v=e[18];let M=n.filter(v),F;if(e[19]!==l||e[20]!==m?(F=Object.entries(l).filter(N=>{let[T]=N;return!m(T)}),e[19]=l,e[20]=m,e[21]=F):F=e[21],g=F,M.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",S="db-facets",h="flex flex-col gap-1.5";let P;e[22]!==c?(P=c("Facets"),e[22]=c,e[23]=P):P=e[23],e[24]!==P?(w=(0,Y.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:P}),e[24]=P,e[25]=w):w=e[25],b="flex flex-wrap gap-1";let k;e[26]!==l||e[27]!==i?(k=o(N=>(0,Y.jsx)("button",{"aria-pressed":N in l,className:"rounded border border-border px-1.5 py-0.5 text-muted-foreground transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-column":N,"data-testid":`db-facet-toggle-${N}`,onClick:i,type:"button",children:N},N),"A"),e[26]=l,e[27]=i,e[28]=k):k=e[28],f=M.map(k)}e[4]=n,e[5]=l,e[6]=m,e[7]=c,e[8]=i,e[9]=g,e[10]=b,e[11]=f,e[12]=h,e[13]=w,e[14]=_,e[15]=S,e[16]=y}else g=e[9],b=e[10],f=e[11],h=e[12],w=e[13],_=e[14],S=e[15],y=e[16];if(y!==Symbol.for("react.early_return_sentinel"))return y;let I;e[29]!==b||e[30]!==f?(I=(0,Y.jsx)("div",{className:b,children:f}),e[29]=b,e[30]=f,e[31]=I):I=e[31];let C;e[32]!==I||e[33]!==h||e[34]!==w?(C=(0,Y.jsxs)("div",{className:h,children:[w,I]}),e[32]=I,e[33]=h,e[34]=w,e[35]=C):C=e[35];let R;e[36]!==s||e[37]!==g?(R=g.map(v=>{let[M,F]=v;return(0,Y.jsx)(Vi,{column:M,onFacetFilter:s,state:F},M)}),e[36]=s,e[37]=g,e[38]=R):R=e[38];let x;return e[39]!==C||e[40]!==R||e[41]!==_||e[42]!==S?(x=(0,Y.jsxs)("aside",{className:_,"data-testid":S,children:[C,R]}),e[39]=C,e[40]=R,e[41]=_,e[42]=S,e[43]=x):x=e[43],x},"_e"),xn=o(()=>{let[t,e]=(0,rt.useState)({}),n=Le(t),l=(0,rt.useRef)({}),r=o(async(s,a)=>{let c=(l.current[s]??0)+1;l.current[s]=c,e(u=>s in u?{...u,[s]:{error:null,loading:!0,result:u[s]?.result??null}}:u);try{let u=await a(s);if(l.current[s]!==c)return;e(i=>s in i?{...i,[s]:{error:null,loading:!1,result:u}}:i)}catch(u){if(l.current[s]!==c)return;e(i=>s in i?{...i,[s]:{error:Ht(u),loading:!1,result:null}}:i)}},"n");return{clearFacets:o(()=>{e({})},"clearFacets"),facets:t,facetsRef:n,refetchFacets:o(s=>{for(let a of Object.keys(n.current))re(r(a,s))},"refetchFacets"),toggleFacet:o((s,a)=>{if(s in n.current){e(c=>Object.fromEntries(Object.entries(c).filter(([u])=>u!==s)));return}e(c=>({...c,[s]:{error:null,loading:!0,result:null}})),a!==null&&re(r(s,a))},"toggleFacet")}},"Me"),zi=[],$i=o(()=>{let t=(0,It.c)(1),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={},t[0]=e):e=t[0];let{data:n}=dt(_e.maskPolicies,e);return Array.isArray(n?.columns)?n.columns:zi},"de"),Sn=o(t=>{let e=(0,It.c)(16),{columns:n,selectedTable:l}=t,r=$i(),[s,a]=(0,rt.useState)(!0),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=o(()=>{a(Hi)},"g"),e[0]=c):c=e[0];let u=c,i;if(e[1]!==n||e[2]!==r||e[3]!==l){let h=Qr(r,l??"");i=Xr(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:Xr(Qr(r,h),w),enabled:s}),"l"),e[5]=s,e[6]=r,e[7]=m):m=e[7];let g=m,b;e[8]!==d||e[9]!==s?(b={columns:d,enabled:s},e[8]=d,e[9]=s,e[10]=b):b=e[10];let f;return e[11]!==d||e[12]!==s||e[13]!==g||e[14]!==b?(f={maskColumns:d,maskOn:s,maskView:b,maskViewFor:g,onToggleMask:u},e[11]=d,e[12]=s,e[13]=g,e[14]=b,e[15]=f):f=e[15],f},"Te");function Hi(t){return!t}o(Hi,"fe");var Zr=34,el=600,Li=o(t=>{let e=(0,It.c)(21),{item:n,onSelect:l,prefix:r,selected:s,start:a}=t,c;e[0]!==n.name||e[1]!==l?(c=o(()=>{l(n.name)},"g"),e[0]=n.name,e[1]=l,e[2]=c):c=e[2];let u=c,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",b;e[5]!==g?(b=pt("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]=b):b=e[6];let f=`${r}-table-${n.name}`,h;e[7]!==n.name?(h=(0,Y.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,Y.jsx)("span",{className:"shrink-0 rounded bg-muted px-1.5 text-xs tabular-nums text-muted-foreground",children:n.rowCount}),e[9]=n.rowCount,e[10]=w):w=e[10];let _;e[11]!==u||e[12]!==s||e[13]!==b||e[14]!==f||e[15]!==h||e[16]!==w?(_=(0,Y.jsxs)("button",{"aria-pressed":s,className:b,"data-testid":f,onClick:u,type:"button",children:[h,w]}),e[11]=u,e[12]=s,e[13]=b,e[14]=f,e[15]=h,e[16]=w,e[17]=_):_=e[17];let S;return e[18]!==m||e[19]!==_?(S=(0,Y.jsx)("li",{style:m,children:_}),e[18]=m,e[19]=_,e[20]=S):S=e[20],S},"me"),_n=o(({header:t,onReload:e,onSelect:n,prefix:l,reloadLabel:r,selected:s,tables:a})=>{let c=oe(),[u,i]=(0,rt.useState)(""),d=(0,rt.useRef)(null),m=o(h=>{i(h.target.value)},"l"),g=(0,rt.useMemo)(()=>{let h=u.trim().toLowerCase();return h===""?a:a.filter(w=>w.name.toLowerCase().includes(h))},[u,a]),b=dn({count:g.length,estimateSize:o(()=>Zr,"estimateSize"),getScrollElement:o(()=>d.current,"getScrollElement"),initialRect:{height:el,width:240},observeElementRect:o((h,w)=>mn(h,w,el),"observeElementRect"),overscan:12}).getVirtualItems(),f={height:g.length*Zr};return(0,Y.jsxs)("aside",{className:"flex h-full w-60 shrink-0 flex-col border-e border-border bg-sidebar","data-testid":`${l}-table-list`,children:[t,(0,Y.jsxs)("div",{className:"flex h-9 shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[(0,Y.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:c("Tables")}),e!==void 0&&(0,Y.jsx)("button",{"aria-label":r??c("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??c("Refresh"),type:"button",children:(0,Y.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,Y.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})})})]}),(0,Y.jsx)("div",{className:"shrink-0 border-b border-border p-2",children:(0,Y.jsx)("input",{className:"h-7 w-full rounded-md border border-border bg-background px-2 text-xs outline-none placeholder:text-muted-foreground focus-visible:border-ring","data-testid":`${l}-table-search`,onChange:m,placeholder:c("search table\u2026"),type:"search",value:u})}),(0,Y.jsxs)("ul",{className:"relative flex-1 overflow-y-auto p-1.5","data-testid":`${l}-table-list-rows`,ref:d,children:[(0,Y.jsx)("li",{"aria-hidden":"true",style:f}),b.map(h=>{let w=g[h.index];return w===void 0?null:(0,Y.jsx)(Li,{item:w,onSelect:n,prefix:l,selected:s===w.name,start:h.start},w.name)})]})]})},"$e");var p=Ie($t(),1);var nl=Ie(ut(),1);function ji(t){return Bi(t)||typeof t=="function"||Gi(t)}o(ji,"isReactComponent");function Bi(t){return typeof t=="function"&&(()=>{let e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}o(Bi,"isClassComponent");function Gi(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}o(Gi,"isExoticComponent");function ht(t,e){return t==null?null:ji(t)?nl.default.createElement(t,e):t}o(ht,"flexRender");function fo(t){if("cell"in t&&t.cell){let e=t.cell,n=e.column.columnDef,l=e,r=n;return l.getIsAggregated?.()?ht(r.aggregatedCell??n.cell,e.getContext()):l.getIsPlaceholder?.()?null:ht(n.cell,e.getContext())}return"header"in t&&t.header?ht(t.header.column.columnDef.header,t.header.getContext()):"footer"in t&&t.footer?ht(t.footer.column.columnDef.footer,t.footer.getContext()):null}o(fo,"FlexRender");function ol({update:t,notify:e,unwatched:n}){return{link:l,unlink:r,propagate:s,checkDirty:a,shallowPropagate:c};function l(i,d,m){let g=d.depsTail;if(g!==void 0&&g.dep===i)return;let b=g!==void 0?g.nextDep:d.deps;if(b!==void 0&&b.dep===i){b.version=m,d.depsTail=b;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:b,prevSub:f,nextSub:void 0};b!==void 0&&(b.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,b=i.nextDep,f=i.nextSub,h=i.prevSub;return b!==void 0?b.prevDep=g:d.depsTail=g,g!==void 0?g.nextDep=b:d.deps=b,f!==void 0?f.prevSub=h:m.subsTail=h,h!==void 0?h.nextSub=f:(m.subs=f)===void 0&&n(m),b}function s(i){let d=i.nextSub,m;e:do{let g=i.sub,b=g.flags;if(b&60?b&12?b&4?!(b&48)&&u(i,g)?(g.flags=b|40,b&=1):b=0:g.flags=b&-9|32:b=0:g.flags=b|32,b&2&&e(g),b&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,b=!1;e:do{let f=i.dep,h=f.flags;if(d.flags&16)b=!0;else if((h&17)===17){if(t(f)){let w=f.subs;w.nextSub!==void 0&&c(w),b=!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(!b){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,b){if(t(d)){_&&c(w),d=i.sub;continue}b=!1}else d.flags&=-33;d=i.sub;let S=i.nextDep;if(S!==void 0){i=S;continue e}}return b}while(!0)}function c(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 u(i,d){let m=d.depsTail;for(;m!==void 0;){if(m===i)return!0;m=m.prevDep}return!1}}o(ol,"createReactiveSystem");function sl(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(sl,"toObserver");var po=[],vn=0,{link:rl,unlink:qi,propagate:Ki,checkDirty:al,shallowPropagate:ll}=ol({update(t){return t._update()},notify(t){po[bo++]=t,t.flags&=-3},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=17,yn(t))}}),Cn=0,bo=0,Qe,ho=0;function wo(t){try{++ho,t()}finally{--ho||xo()}}o(wo,"batch");function yn(t){let e=t.depsTail,n=e!==void 0?e.nextDep:t.deps;for(;n!==void 0;)n=qi(n,t)}o(yn,"purgeDeps");function xo(){if(!(ho>0)){for(;Cn<bo;){let t=po[Cn];po[Cn++]=void 0,t.notify()}Cn=0,bo=0}}o(xo,"flush");function So(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 Qe!==void 0&&rl(r,Qe,vn),r._snapshot},subscribe(s){let a=sl(s),c={current:!1},u=Ui(()=>{r.get(),c.current?a.next?.(r._snapshot):c.current=!0});return{unsubscribe:o(()=>{u.stop()},"unsubscribe")}},_update(s){let a=Qe,c=e?.compare??Object.is;if(n)Qe=r,++vn,r.depsTail=void 0;else if(s===void 0)return!1;n&&(r.flags=5);try{let u=r._snapshot,i=typeof s=="function"?s(u):s===void 0&&n?l(u):s;return u===void 0||!c(u,i)?(r._snapshot=i,!0):!1}finally{Qe=a,n&&(r.flags&=-5),yn(r)}}};return n?(r.flags=17,r.get=function(){let s=r.flags;if(s&16||s&32&&al(r.deps,r)){if(r._update()){let a=r.subs;a!==void 0&&ll(a)}}else s&32&&(r.flags=s&-33);return Qe!==void 0&&rl(r,Qe,vn),r._snapshot}):r.set=function(s){if(r._update(s)){let a=r.subs;a!==void 0&&(Ki(a),ll(a),xo())}},r}o(So,"createAtom");function Ui(t){let e=o(()=>{let l=Qe;Qe=n,++vn,n.depsTail=void 0,n.flags=6;try{return t()}finally{Qe=l,n.flags&=-5,yn(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&&al(this.deps,this)?e():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,yn(this)}};return e(),n}o(Ui,"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=il(t);if(n.length!==il(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 il(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}o(il,"getOwnKeys");var _o=Ie(ut(),1),cl=Ie(Mi(),1);function Ji(t,e){return t===e}o(Ji,"defaultCompare");function Bt(t,e=l=>l,n){let l=n?.compare??Ji,r=(0,_o.useCallback)(a=>{let{unsubscribe:c}=t.subscribe(a);return c},[t]),s=(0,_o.useCallback)(()=>t.get(),[t]);return(0,cl.useSyncExternalStoreWithSelector)(r,s,s,e,l)}o(Bt,"useSelector");function ul(t){let e=Bt(t.source,t.selector,{compare:lt});return typeof t.children=="function"?t.children(e):t.children}o(ul,"Subscribe");function dl(t){let e=t;return Object.defineProperty(t,"state",{get(){return t.get()}}),"set"in t&&(e.setState=t.set.bind(t)),e}o(dl,"atomToStore");function Co(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,c=!1,u,i=o(()=>{let m=r();return(!c||!a(u,m))&&(u=m,c=!0),u},"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(Co,"renderPhaseReactivity");function vo(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(vo,"createRenderPhaseSource");function ml(){return Co({createAtom:So,batch:wo})}o(ml,"reactReactivity");function Ft(t,e){return typeof t=="function"?t(e):t}o(Ft,"functionalUpdate");function ie(t){if(Array.isArray(t))return t.map(ie);if(t&&typeof t=="object"){let e=Object.getPrototypeOf(t);if(e!==Object.prototype&&e!==null)return t;let n=e===null?H():{},l=Object.keys(t);for(let r=0;r<l.length;r++){let 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 Rn(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(Rn,"copyInstancePropertiesWithoutMemos");function H(){return Object.create(null)}o(H,"makeObjectMap");function je(t,e){return Object.prototype.hasOwnProperty.call(t,e)}o(je,"hasOwn");function Be(t,e){return n=>{(e.options.atoms?.[t]??e.baseAtoms[t]).set(l=>Ft(n,l))}}o(Be,"makeStateUpdater");function gl(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(gl,"isPlainContainer");function fl(t){return Reflect.ownKeys(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}o(fl,"getEnumerableOwnKeys");var Wi=3;function Qi(t,e){return pl(t,e,Wi)}o(Qi,"stateSlicesEqual");function pl(t,e,n){if(Object.is(t,e))return!0;if(n<=0||!gl(t)||!gl(e)||(Array.isArray(t)||Array.isArray(e))&&(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length))return!1;let l=fl(t),r=fl(e);if(l.length!==r.length)return!1;let s=t,a=e;for(let c=0;c<l.length;c++){let u=l[c];if(!Object.prototype.propertyIsEnumerable.call(e,u)||!pl(s[u],a[u],n-1))return!1}return!0}o(pl,"stateSlicesEqualAtDepth");function He(t,e,n,l=Qi){let r=`on${e.charAt(0).toUpperCase()}${e.slice(1)}Change`,s=t.options[r];s&&s(a=>{let c=Ft(n,a);return l(a,c)?a:c})}o(He,"setStateSlice");function bl(t){return t instanceof Function}o(bl,"isFunction");function hl(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(hl,"flattenBy");var Xi=o(({fn:t,memoDeps:e,onAfterCompare:n,onAfterUpdate:l,onBeforeCompare:r,onBeforeUpdate:s})=>{let a=[],c;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?.(),c=t(...d??[]),l?.(c)),c},"memoizedFn")},"memo");function In(t){let e=!1;return()=>{if(!e){e=!0;return}t()}}o(In,"skipFirstRun");var Yi=o((t,e)=>{for(t=String(t);t.length<e;)t=" "+t;return t},"pad");function Mt({feature:t,fnName:e,objectId:n,onAfterUpdate:l,table:r,...s}){let a,c,u=0,i;function d(b,f){let h=u===0?"(1st run)":f?"(rerun #"+u+")":"(cache)";u++,console.groupCollapsed(`%c\u23F1 ${Yi(`${b.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(b)*60,120))}deg 100% 31%);`:""} `,`color: ${u<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:b,untrack:f}=r._reactivity;b(()=>f(()=>l()))},"onAfterUpdateHandler");return Xi({...s,...{onAfterUpdate:o(()=>{m()},"onAfterUpdate")}})}o(Mt,"tableMemo");function wl(t,e="_"){let[n,l]=t.split(e);return{fnKey:l,fnName:`${n}.${l}`,parentName:n}}o(wl,"getFunctionNameInfo");function fe(t,e,n){for(let[l,{fn:r,memoDeps:s}]of Object.entries(n)){let{fnKey:a,fnName:c}=wl(l);e[a]=s?Mt({memoDeps:s,fn:r,fnName:c,table:e,feature:t}):r}}o(fe,"assignTableAPIs");function ce(t,e,n,l){for(let[r,{fn:s,memoDeps:a}]of Object.entries(l)){let{fnKey:c,fnName:u}=wl(r);if(a){let i=`_memo_${c}`;e[c]=function(...d){if(!this[i]){let m=this;this[i]=Mt({memoDeps:o(g=>a(m,g),"memoDeps"),fn:o((...g)=>s(m,...g),"fn"),fnName:u,objectId:m.id,table:n,feature:t})}return this[i](...d)}}else e[c]=function(...i){return s(this,...i)}}}o(ce,"assignPrototypeAPIs");function V(t,e,n,...l){return t[e]?.(...l)??n(t,...l)}o(V,"callMemoOrStaticFn");function xl(t){return t.row.getValue(t.column.id)}o(xl,"cell_getValue");function Sl(t){return t.getValue()??t.table.options.renderFallbackValue}o(Sl,"cell_renderValue");function _l(t){return{table:t.table,column:t.column,row:t.row,cell:t,getValue:o(()=>t.getValue(),"getValue"),renderValue:o(()=>t.renderValue(),"renderValue")}}o(_l,"cell_getContext");var Cl={assignCellPrototype:o((t,e)=>{ce("coreCellsFeature",t,e,{cell_getValue:{fn:o(n=>xl(n),"fn")},cell_renderValue:{fn:o(n=>Sl(n),"fn")},cell_getContext:{fn:o(n=>_l(n),"fn"),memoDeps:o(n=>[n],"memoDeps")}})},"assignCellPrototype")};function Zi(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(Zi,"getHeaderPrototype");function yo(t,e,n){let l=Zi(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(yo,"constructHeader");function Xe(){return{start:[],end:[]}}o(Xe,"getDefaultColumnPinningState");function vl(t){let e=t.getAllColumns(),n=t.getAllLeafColumnsById(),{start:l}=t.atoms.columnPinning?.get()??Xe(),r=[];for(let s=0;s<l.length;s++){let a=n[l[s]];a&&V(a,"getIsVisible",ue)&&r.push(a)}return xt(e,r,t,"start")}o(vl,"table_getStartHeaderGroups");function yl(t){let e=t.getAllColumns(),n=t.getAllLeafColumnsById(),{end:l}=t.atoms.columnPinning?.get()??Xe(),r=[];for(let s=0;s<l.length;s++){let a=n[l[s]];a&&V(a,"getIsVisible",ue)&&r.push(a)}return xt(e,r,t,"end")}o(yl,"table_getEndHeaderGroups");function Rl(t){let e=t.getAllColumns(),n=V(t,"getVisibleLeafColumns",wt),{start:l,end:r}=t.atoms.columnPinning?.get()??Xe();if(l.length||r.length){let s=[...l,...r];n=n.filter(a=>!s.includes(a.id))}return xt(e,n,t,"center")}o(Rl,"table_getCenterHeaderGroups");function ec(t){let{start:e}=t.atoms.columnPinning?.get()??Xe(),n=t.getAllLeafColumnsById(),l=[];for(let r=0;r<e.length;r++){let s=n[e[r]];s&&l.push(s)}return l}o(ec,"table_getStartLeafColumns");function tc(t){let{end:e}=t.atoms.columnPinning?.get()??Xe(),n=t.getAllLeafColumnsById(),l=[];for(let r=0;r<e.length;r++){let s=n[e[r]];s&&l.push(s)}return l}o(tc,"table_getEndLeafColumns");function nc(t){let{start:e,end:n}=t.atoms.columnPinning?.get()??Xe();if(!e.length&&!n.length)return t.getAllLeafColumns();let l=[...e,...n];return t.getAllLeafColumns().filter(r=>!l.includes(r.id))}o(nc,"table_getCenterLeafColumns");function oc(t){return V(t,"getStartLeafColumns",ec).filter(e=>V(e,"getIsVisible",ue))}o(oc,"table_getStartVisibleLeafColumns");function rc(t){return V(t,"getEndLeafColumns",tc).filter(e=>V(e,"getIsVisible",ue))}o(rc,"table_getEndVisibleLeafColumns");function lc(t){return V(t,"getCenterLeafColumns",nc).filter(e=>V(e,"getIsVisible",ue))}o(lc,"table_getCenterVisibleLeafColumns");function Ge(t,e){return e?e==="start"?V(t,"getStartVisibleLeafColumns",oc):e==="end"?V(t,"getEndVisibleLeafColumns",rc):V(t,"getCenterVisibleLeafColumns",lc):V(t,"getVisibleLeafColumns",wt)}o(Ge,"table_getPinnedVisibleLeafColumns");function Il(){return H()}o(Il,"getDefaultColumnVisibilityState");function Io(t,e){Gt(t)&&qt(t.table,n=>{let l=Object.assign(H(),n),r=e??!V(t,"getIsVisible",ue),s=t.getLeafColumns();for(let a=0;a<s.length;a++){let c=s[a];Gt(c)&&(l[c.id]=r)}return l})}o(Io,"column_toggleVisibility");function ue(t){let e=t.table.atoms.columnVisibility?.get();if(!e)return!0;let n=t.columns;return n.length?n.some(l=>V(l,"getIsVisible",ue)):(je(e,t.id)?e[t.id]:void 0)??!0}o(ue,"column_getIsVisible");function Gt(t){return(t.columnDef.enableHiding??!0)&&(t.table.options.enableHiding??!0)}o(Gt,"column_getCanHide");function Fl(t){return e=>{Io(t,e.target.checked)}}o(Fl,"column_getToggleVisibilityHandler");function Ro(t){let e=t.getAllCells(),n=[];for(let i=0;i<e.length;i++){let d=e[i];V(d.column,"getIsVisible",ue)&&n.push(d)}let{start:l,end:r}=t.table.atoms.columnPinning?.get()??Xe();if(!l.length&&!r.length)return n;let s=V(t,"getVisibleCellsByColumnId",Fn),a=[];for(let i=0;i<l.length;i++){let d=s[l[i]];d&&a.push(d)}let c=[];for(let i=0;i<r.length;i++){let d=s[r[i]];d&&c.push(d)}let u=[];for(let i=0;i<n.length;i++){let d=n[i],m=d.column.id;!l.includes(m)&&!r.includes(m)&&u.push(d)}return[...a,...u,...c]}o(Ro,"row_getVisibleCells");function Fn(t){let e=H(),n=t.getAllCells();for(let l=0;l<n.length;l++){let r=n[l];V(r.column,"getIsVisible",ue)&&(e[r.column.id]=r)}return e}o(Fn,"row_getVisibleCellsByColumnId");function Ml(t){return t.getAllFlatColumns().filter(e=>V(e,"getIsVisible",ue))}o(Ml,"table_getVisibleFlatColumns");function wt(t){return t.getAllLeafColumns().filter(e=>V(e,"getIsVisible",ue))}o(wt,"table_getVisibleLeafColumns");function qt(t,e){He(t,"columnVisibility",e)}o(qt,"table_setColumnVisibility");function kl(t,e){qt(t,e?H():Object.assign(H(),ie(t.initialState.columnVisibility??{})))}o(kl,"table_resetColumnVisibility");function Fo(t,e){e=e??!Mo(t);let n=H(),l=t.getAllLeafColumns();for(let r=0;r<l.length;r++){let s=l[r];n[s.id]=e||!Gt(s)}qt(t,n)}o(Fo,"table_toggleAllColumnsVisible");function Mo(t){return!t.getAllLeafColumns().some(e=>!V(e,"getIsVisible",ue))}o(Mo,"table_getIsAllColumnsVisible");function Pl(t){return t.getAllLeafColumns().some(e=>V(e,"getIsVisible",ue))}o(Pl,"table_getIsSomeColumnsVisible");function Nl(t){return e=>{Fo(t,e.target.checked)}}o(Nl,"table_getToggleAllColumnsVisibilityHandler");function Dl(t,e=1){let n=e;for(let l=0;l<t.length;l++){let r=t[l];V(r,"getIsVisible",ue)&&r.columns.length&&(n=Math.max(n,Dl(r.columns,e+1)))}return n}o(Dl,"getMaxHeaderDepth");function sc(t,e){return t?`${t}_${e}`:String(e)}o(sc,"formatHeaderGroupId");function ac(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(ac,"formatHeaderId");function ic(t,e){let n=0;for(let l=0;l<t.length;l++)t[l].column===e&&n++;return n}o(ic,"countPendingHeadersForColumn");function Tl(t,e,n,l,r,s){let a={depth:e,id:sc(l,e),headers:[]},c=[];for(let u=0;u<t.length;u++){if(!(u in t))continue;let i=t[u],d=c[c.length-1],m=i.column.depth===a.depth,g,b=!1;if(m&&i.column.parent?g=i.column.parent:(g=i.column,b=!0),d&&d.column===g)d.subHeaders.push(i);else{let f=yo(n,g,{id:ac(l,e,g.id,i.id),isPlaceholder:b,placeholderId:b?String(ic(c,g)):void 0,depth:e,index:c.length});f.subHeaders.push(i),c.push(f)}a.headers.push(i),i.headerGroup=a}for(let u=0;u<s.length;u++)s[u](a);r.push(a),e>0&&Tl(c,e-1,n,l,r,s)}o(Tl,"constructHeaderGroup");function Al(t){for(let e=0;e<t.length;e++){let n=t[e];if(!V(n.column,"getIsVisible",ue))continue;let l=0;if(n.subHeaders.length){Al(n.subHeaders);for(let r=0;r<n.subHeaders.length;r++){let s=n.subHeaders[r];V(s.column,"getIsVisible",ue)&&(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(Al,"updateHeaderSpans");function xt(t,e,n,l){let r=Dl(t),s=[],a=n._headerGroupInstanceInitFns,c=new Array(e.length);for(let u=0;u<e.length;u++)u in e&&(c[u]=yo(n,e[u],{depth:r,index:u}));return Tl(c,r-1,n,l,s,a),s.reverse(),Al(s[0]?.headers??[]),s}o(xt,"buildHeaderGroups");function cc(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(cc,"getColumnPrototype");function Ol(t,e,n,l){let r={...t.getDefaultColumnDef(),...e},s=r.accessorKey,a=s===void 0?void 0:String(s),c=r.id??a?.replaceAll(".","_")??(typeof r.header=="string"?r.header:void 0),u;if(r.accessorFn)u=r.accessorFn;else if(s!==void 0)if(typeof s=="string"&&s.includes(".")){let g=s.split(".");u=o(b=>{let f=b;for(let h=0;h<g.length;h++){let w=g[h];f=f?.[w]}return f},"accessorFn")}else u=o(g=>g[r.accessorKey],"accessorFn");if(!c)throw new Error;let i=cc(t),d=Object.create(i);d.accessorFn=u,d.columnDef=r,d.columns=[],d.depth=n,d.id=`${String(c)}`,d.parent=l;let m=t._columnInstanceInitFns;for(let g=0;g<m.length;g++)m[g](d);return d}o(Ol,"constructColumn");function El(){return[]}o(El,"getDefaultColumnOrderState");function ko(t){let e=o(n=>{let l=H();for(let r=0;r<n.length;r++)l[n[r].id]=r;return l},"buildIndexes");return{all:e(Ge(t)),center:e(Ge(t,"center")),start:e(Ge(t,"start")),end:e(Ge(t,"end"))}}o(ko,"table_getColumnIndexes");function Vl(t,e){return V(t.table,"getColumnIndexes",ko)[e==="start"?"start":e==="end"?"end":e==="center"?"center":"all"][t.id]??-1}o(Vl,"column_getIndex");function zl(t,e){return Ge(t.table,e)[0]?.id===t.id}o(zl,"column_getIsFirstColumn");function $l(t,e){let n=Ge(t.table,e);return n[n.length-1]?.id===t.id}o($l,"column_getIsLastColumn");function Po(t,e){He(t,"columnOrder",e)}o(Po,"table_setColumnOrder");function Hl(t,e){Po(t,e?[]:ie(t.initialState.columnOrder??[]))}o(Hl,"table_resetColumnOrder");function Kt(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],c=r.get(a);c&&(l.push(c),r.delete(a))}for(let s=0;s<n.length;s++){let a=n[s];r.has(a.id)&&l.push(a)}}return uc(t,l)}}o(Kt,"table_getOrderColumnsFn");function uc(t,e){let n=t.atoms.grouping?.get()??[],{groupedColumnMode:l}=t.options;if(!n.length||!l)return e;let r=e.filter(c=>!n.includes(c.id));if(l==="remove")return r;let s=new Map;for(let c=0;c<e.length;c++){let u=e[c];s.set(u.id,u)}let a=[];for(let c=0;c<n.length;c++){let u=s.get(n[c]);u&&a.push(u)}return[...a,...r]}o(uc,"orderColumns");function Ll(t){return[t,...t.columns.flatMap(e=>e.getFlatColumns())]}o(Ll,"column_getFlatColumns");function jl(t){if(t.columns.length){let e=t.columns.flatMap(n=>n.getLeafColumns());return V(t.table,"getOrderColumns",Kt)(e)}return[t]}o(jl,"column_getLeafColumns");function Bl(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(Bl,"table_getDefaultColumnDef");function Gl(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],c=Ol(t,a,l,n),u=a;c.columns=u.columns?Gl(t,u.columns,c,l+1):[],r[s]=c}return r}o(Gl,"constructColumns");function ql(t){return Gl(t,t.options.columns)}o(ql,"table_getAllColumns");function Kl(t){return t.getAllColumns().flatMap(e=>e.getFlatColumns())}o(Kl,"table_getAllFlatColumns");function Ul(t){let e=H(),n=t.getAllFlatColumns();for(let l=0;l<n.length;l++){let r=n[l];e[r.id]=r}return e}o(Ul,"table_getAllFlatColumnsById");function Jl(t){let e=t.getAllColumns().flatMap(n=>n.getLeafColumns());return V(t,"getOrderColumns",Kt)(e)}o(Jl,"table_getAllLeafColumns");function Wl(t){let e=H(),n=t.getAllLeafColumns();for(let l=0;l<n.length;l++){let r=n[l];e[r.id]=r}return e}o(Wl,"table_getAllLeafColumnsById");function Ql(t,e){return t.getAllFlatColumnsById()[e]}o(Ql,"table_getColumn");var Xl={assignColumnPrototype:o((t,e)=>{ce("coreColumnsFeature",t,e,{column_getFlatColumns:{fn:o(n=>Ll(n),"fn"),memoDeps:o(n=>[n.table.options.columns],"memoDeps")},column_getLeafColumns:{fn:o(n=>jl(n),"fn"),memoDeps:o(n=>[n.table.atoms.columnOrder?.get(),n.table.atoms.grouping?.get(),n.table.options.columns,n.table.options.groupedColumnMode],"memoDeps")}})},"assignColumnPrototype"),constructTableAPIs:o(t=>{fe("coreColumnsFeature",t,{table_getDefaultColumnDef:{fn:o(()=>Bl(t),"fn"),memoDeps:o(()=>[t.options.defaultColumn],"memoDeps")},table_getAllColumns:{fn:o(()=>ql(t),"fn"),memoDeps:o(()=>[t.options.columns],"memoDeps")},table_getAllFlatColumns:{fn:o(()=>Kl(t),"fn"),memoDeps:o(()=>[t.options.columns],"memoDeps")},table_getAllFlatColumnsById:{fn:o(()=>Ul(t),"fn"),memoDeps:o(()=>[t.options.columns],"memoDeps")},table_getAllLeafColumns:{fn:o(()=>Jl(t),"fn"),memoDeps:o(()=>[t.atoms.columnOrder?.get(),t.atoms.grouping?.get(),t.options.columns,t.options.groupedColumnMode],"memoDeps")},table_getAllLeafColumnsById:{fn:o(()=>Wl(t),"fn"),memoDeps:o(()=>[t.getAllLeafColumns()],"memoDeps")},table_getColumn:{fn:o(e=>Ql(t,e),"fn")}})},"constructTableAPIs")};function Yl(t,e){for(let n=0;n<t.subHeaders.length;n++)Yl(t.subHeaders[n],e);e.push(t)}o(Yl,"collectLeafHeaders");function Zl(t){let e=[];return Yl(t,e),e}o(Zl,"header_getLeafHeaders");function es(t){return{column:t.column,header:t,table:t.column.table}}o(es,"header_getContext");function ts(t){let{start:e,end:n}=t.atoms.columnPinning?.get()??Xe(),l=t.getAllColumns(),r=V(t,"getVisibleLeafColumns",wt);if(!e.length&&!n.length)return xt(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",ue)&&a.push(d)}let c=[];for(let i=0;i<n.length;i++){let d=s[n[i]];d&&V(d,"getIsVisible",ue)&&c.push(d)}let u=r.filter(i=>!e.includes(i.id)&&!n.includes(i.id));return xt(l,[...a,...u,...c],t)}o(ts,"table_getHeaderGroups");function ns(t){return[...t.getHeaderGroups()].reverse()}o(ns,"table_getFooterGroups");function os(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(os,"table_getFlatHeaders");function rs(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(rs,"table_getLeafHeaders");var ls={assignHeaderPrototype:o((t,e)=>{ce("coreHeadersFeature",t,e,{header_getLeafHeaders:{fn:o(n=>Zl(n),"fn"),memoDeps:o(n=>[n.column.table.options.columns],"memoDeps")},header_getContext:{fn:o(n=>es(n),"fn"),memoDeps:o(n=>[n.column.table.options.columns],"memoDeps")}})},"assignHeaderPrototype"),constructTableAPIs:o(t=>{fe("coreHeadersFeature",t,{table_getHeaderGroups:{fn:o(()=>ts(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(()=>ns(t),"fn"),memoDeps:o(()=>[t.getHeaderGroups()],"memoDeps")},table_getFlatHeaders:{fn:o(()=>os(t),"fn"),memoDeps:o(()=>[t.getHeaderGroups()],"memoDeps")},table_getLeafHeaders:{fn:o(()=>rs(t),"fn"),memoDeps:o(()=>[t.getHeaderGroups()],"memoDeps")}})},"constructTableAPIs")};function dc(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(dc,"getRowPrototype");var ss=o((t,e,n,l,r,s,a)=>{let c=dc(t),u=Object.create(c);u._displayIndexCache=-1,u._uniqueValuesCache=H(),u._valuesCache=H(),u.depth=r,u.id=e,u.index=l,u.original=n,u.parentId=a,u.subRows=s??[];let i=t._rowInstanceInitFns;for(let d=0;d<i.length;d++)i[d](u);return u},"constructRow");var Do=/([0-9]+)/gm;function St(t){let e=Object.assign((n,l,r)=>{let s=n.getValue(r),a=l.getValue(r),c=e.resolveDataValue;return c&&(s=c(s),a=c(a)),e.sort(s,a,n,l,r)},t);return e}o(St,"constructSortFn");var To=St({resolveDataValue:o(t=>kn(t).toLowerCase(),"resolveDataValue"),sort:o((t,e)=>cs(t,e),"sort")}),mc=St({resolveDataValue:o(t=>kn(t),"resolveDataValue"),sort:o((t,e)=>cs(t,e),"sort")}),Ao=St({resolveDataValue:o(t=>kn(t).toLowerCase(),"resolveDataValue"),sort:o((t,e)=>Eo(t,e),"sort")}),gc=St({resolveDataValue:o(t=>kn(t),"resolveDataValue"),sort:o((t,e)=>Eo(t,e),"sort")}),Oo=St({resolveDataValue:o(t=>fc(t),"resolveDataValue"),sort:o((t,e)=>t>e?1:t<e?-1:0,"sort")}),kt=St({sort:o((t,e)=>Eo(t,e),"sort")});function Eo(t,e){return t===e?0:t>e?1:-1}o(Eo,"compareBasic");function fc(t){return t instanceof Date?t.getTime():t}o(fc,"toDateSortValue");function kn(t){return typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?"":String(t):typeof t=="string"?t:""}o(kn,"toString");function cs(t,e){let n=0,l=0,r=t.length,s=e.length;for(;n<r&&l<s;){let a=Mn(t.charCodeAt(n)),c=Mn(e.charCodeAt(l)),u=No(t,n,a),i=No(e,l,c);if(!a&&!c){let m=pc(t,n,u,e,l,i);if(m)return m;n=u,l=i;continue}if(a!==c)return a?1:-1;let d=bc(t,n,u,e,l,i);if(d)return d;n=u,l=i}return is(t,n)-is(e,l)}o(cs,"compareAlphanumeric");function Mn(t){return t>=48&&t<=57}o(Mn,"isDigit");function No(t,e,n){let l=e+1;for(;l<t.length&&Mn(t.charCodeAt(l))===n;)l++;return l}o(No,"findChunkEnd");function pc(t,e,n,l,r,s){let a=n-e,c=s-r,u=a<c?a:c;for(let i=0;i<u;i++){let d=t.charCodeAt(e+i),m=l.charCodeAt(r+i);if(d>m)return 1;if(m>d)return-1}return a>c?1:c>a?-1:0}o(pc,"compareStringChunks");function bc(t,e,n,l,r,s){let a=e;for(;a<n&&t.charCodeAt(a)===48;)a++;let c=r;for(;c<s&&l.charCodeAt(c)===48;)c++;let u=n-a,i=s-c;if(u===0&&i===0)return 0;if(u<=15&&i<=15){let g=as(t,a,n),b=as(l,c,s);return g>b?1:b>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(bc,"compareNumericChunks");function as(t,e,n){let l=0;for(let r=e;r<n;r++)l=l*10+t.charCodeAt(r)-48;return l}o(as,"parseSmallInt");function is(t,e){let n=0,l=e;for(;l<t.length;)n++,l=No(t,l,Mn(t.charCodeAt(l)));return n}o(is,"countRemainingChunks");function us(){return[]}o(us,"getDefaultCellSelectionState");function hc(t,e){He(t,"cellSelection",e?us():ie(t.initialState.cellSelection)??us())}o(hc,"table_resetCellSelection");function ds(t){t.atoms.cellSelection&&(t.options.autoResetAll??t.options.autoResetCellSelection??!0)&&t._reactivity.schedule(()=>hc(t))}o(ds,"table_autoResetCellSelection");function ms(t){t.atoms.expanded&&(t.options.autoResetAll??t.options.autoResetExpanded??!t.options.manualExpanding)&&t._reactivity.schedule(()=>wc(t))}o(ms,"table_autoResetExpanded");function wc(t,e){let n=t.initialState.expanded;He(t,"expanded",e?H():n===!0?!0:Object.assign(H(),ie(n??{})))}o(wc,"table_resetExpanded");var Pn=0;function Nn(t){if(t.options.autoResetAll??t.options.autoResetPageIndex??!t.options.manualPagination){if((t.atoms.pagination?.get()?.pageIndex??Pn)===Pn)return;_c(t,!0)}}o(Nn,"table_autoResetPageIndex");function xc(t,e){He(t,"pagination",e)}o(xc,"table_setPagination");function Sc(t,e){xc(t,n=>{let l=Ft(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(Sc,"table_setPageIndex");function _c(t,e){Sc(t,e?Pn:t.initialState.pagination?.pageIndex??Pn)}o(_c,"table_resetPageIndex");function gs(){return[]}o(gs,"getDefaultSortingState");function Jt(t,e){He(t,"sorting",e)}o(Jt,"table_setSorting");function Vo(t,e){Jt(t,e?[]:ie(t.initialState.sorting??[]))}o(Vo,"table_resetSorting");function fs(t){t.atoms.sorting&&(t.options.autoResetAll??t.options.autoResetSorting??!1)&&Vo(t)}o(fs,"table_autoResetSorting");function zo(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(Do).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 kt}o(zo,"column_getAutoSortFn");function $o(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($o,"column_getAutoSortDir");function Dn(t){let e=t.table._rowModelFns.sortFns;return bl(t.columnDef.sortFn)?t.columnDef.sortFn:t.columnDef.sortFn==="auto"?zo(t):e?.[t.columnDef.sortFn]??kt}o(Dn,"column_getSortFn");function Ho(t,e,n){let l=jo(t,n&&Ut(t)),r=typeof e<"u";Jt(t.table,s=>{let a=s.findIndex(g=>g.id===t.id),c=a===-1?void 0:s[a],u=[],i,d=r?e:l==="desc",m=!!(s.length&&Ut(t)&&n);return m?c?i="toggle":i="add":c?i="toggle":i="replace",i==="toggle"&&(r||l||(i="remove")),i==="add"?(u=[...s,{id:t.id,desc:d}],u.splice(0,u.length-(t.table.options.maxMultiSortColCount??Number.MAX_SAFE_INTEGER))):i==="toggle"?u=m?s.map(g=>g.id===t.id?{...g,desc:d}:g):[{id:t.id,desc:d}]:i==="remove"?u=m?s.filter(g=>g.id!==t.id):[]:u=[{id:t.id,desc:d}],u})}o(Ho,"column_toggleSorting");function Lo(t){return t.columnDef.sortDescFirst??t.table.options.sortDescFirst??$o(t)==="desc"?"desc":"asc"}o(Lo,"column_getFirstSortDir");function jo(t,e){let n=Lo(t),l=Bo(t);return l?l!==n&&(t.table.options.enableSortingRemoval??!0)&&(!e||(t.table.options.enableMultiRemove??!0))?!1:l==="desc"?"asc":"desc":n}o(jo,"column_getNextSortingOrder");function Wt(t){return(t.columnDef.enableSorting??!0)&&(t.table.options.enableSorting??!0)&&!!t.accessorFn}o(Wt,"column_getCanSort");function Ut(t){return t.columnDef.enableMultiSort??t.table.options.enableMultiSort??!!t.accessorFn}o(Ut,"column_getCanMultiSort");function Bo(t){let e=t.table.atoms.sorting?.get()?.find(n=>n.id===t.id);return e?e.desc?"desc":"asc":!1}o(Bo,"column_getIsSorted");function ps(t){return t.table.atoms.sorting?.get()?.findIndex(e=>e.id===t.id)??-1}o(ps,"column_getSortIndex");function bs(t){Jt(t.table,e=>e.length?e.filter(n=>n.id!==t.id):[])}o(bs,"column_clearSorting");function hs(t){let e=Wt(t);return n=>{e&&Ho(t,void 0,Ut(t)?t.table.options.isMultiSortEvent?.(n):!1)}}o(hs,"column_getToggleSortingHandler");function ws(){return t=>Mt({feature:"coreRowModelsFeature",table:t,fnName:"table.getCoreRowModel",memoDeps:o(()=>[t.options.data],"memoDeps"),fn:o(()=>Cc(t,t.options.data),"fn"),onAfterUpdate:In(()=>{ms(t),Nn(t),fs(t),ds(t)})})}o(ws,"createCoreRowModel");function xs(t,e,n,l=0,r){let s=[];for(let a=0;a<n.length;a++){let c=n[a],u=ss(t,t.getRowId(c,a,r),c,a,l,void 0,r?.id);e.flatRows.push(u),e.rowsById[u.id]=u,s.push(u),t.options.getSubRows&&(u.originalSubRows=t.options.getSubRows(c,a),u.originalSubRows?.length&&(u.subRows=xs(t,e,u.originalSubRows,l+1,u)))}return s}o(xs,"accessRows");function Cc(t,e){let n={rows:[],flatRows:[],rowsById:H()};return n.rows=xs(t,n,e),n}o(Cc,"_createCoreRowModel");function Ss(t){return t._rowModels.coreRowModel||(t._rowModels.coreRowModel=t.options.features.coreRowModel?.(t)??ws()(t)),t._rowModels.coreRowModel()}o(Ss,"table_getCoreRowModel");function _s(t){return t.getCoreRowModel()}o(_s,"table_getPreFilteredRowModel");function Cs(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(Cs,"table_getFilteredRowModel");function vs(t){return t.getFilteredRowModel()}o(vs,"table_getPreGroupedRowModel");function ys(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(ys,"table_getGroupedRowModel");function Rs(t){return t.getGroupedRowModel()}o(Rs,"table_getPreSortedRowModel");function Is(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(Is,"table_getSortedRowModel");function Fs(t){return t.getSortedRowModel()}o(Fs,"table_getPreExpandedRowModel");function Ms(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(Ms,"table_getExpandedRowModel");function ks(t){return t.getExpandedRowModel()}o(ks,"table_getPrePaginatedRowModel");function Ps(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(Ps,"table_getPaginatedRowModel");function Ns(t){return t.getPaginatedRowModel()}o(Ns,"table_getRowModel");var Ds={constructTableAPIs:o(t=>{fe("coreRowModelsFeature",t,{table_getCoreRowModel:{fn:o(()=>Ss(t),"fn")},table_getPreFilteredRowModel:{fn:o(()=>_s(t),"fn")},table_getFilteredRowModel:{fn:o(()=>Cs(t),"fn")},table_getPreGroupedRowModel:{fn:o(()=>vs(t),"fn")},table_getGroupedRowModel:{fn:o(()=>ys(t),"fn")},table_getPreSortedRowModel:{fn:o(()=>Rs(t),"fn")},table_getSortedRowModel:{fn:o(()=>Is(t),"fn")},table_getPreExpandedRowModel:{fn:o(()=>Fs(t),"fn")},table_getExpandedRowModel:{fn:o(()=>Ms(t),"fn")},table_getPrePaginatedRowModel:{fn:o(()=>ks(t),"fn")},table_getPaginatedRowModel:{fn:o(()=>Ps(t),"fn")},table_getRowModel:{fn:o(()=>Ns(t),"fn")}})},"constructTableAPIs")};function vc(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(vc,"getCellPrototype");function Ts(t,e,n){let l=vc(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(Ts,"constructCell");function As(t){let e=t.table.getRowsInDisplayOrder(),n=t._displayIndexCache;return e[n]===t?n:-1}o(As,"row_getDisplayIndex");function Os(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(Os,"table_getRowsInDisplayOrder");function Es(t,e){if(je(t._valuesCache,e))return t._valuesCache[e];let n=t.table.getColumn(e);if(n?.accessorFn)return t._valuesCache[e]=n.accessorFn(t.original,t.index),t._valuesCache[e]}o(Es,"row_getValue");function Vs(t,e){if(je(t._uniqueValuesCache,e))return t._uniqueValuesCache[e];let n=t.table.getColumn(e);if(n?.accessorFn)return n.columnDef.getUniqueValues?(t._uniqueValuesCache[e]=n.columnDef.getUniqueValues(t.original,t.index),t._uniqueValuesCache[e]):(t._uniqueValuesCache[e]=[t.getValue(e)],t._uniqueValuesCache[e])}o(Vs,"row_getUniqueValues");function zs(t,e){return t.getValue(e)??t.table.options.renderFallbackValue}o(zs,"row_renderValue");function $s(t){return hl(t.subRows,e=>e.subRows)}o($s,"row_getLeafRows");function Hs(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(Hs,"table_getMaxSubRowDepth");function Ls(t){if(t.parentId)return t.table.getCoreRowModel().rowsById[t.parentId]??t.table.getRow(t.parentId,!0)}o(Ls,"row_getParentRow");function js(t){let e=[],n=t;for(;;){let l=n.getParentRow();if(!l)break;e.push(l),n=l}return e.reverse()}o(js,"row_getParentRows");function Bs(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=Ts(s,t,t.table),n.set(s,a)),l[r]=a}return l}o(Bs,"row_getAllCells");function Gs(t){let e=H(),n=t.getAllCells();for(let l=0;l<n.length;l++){let r=n[l];e[r.column.id]=r}return e}o(Gs,"row_getAllCellsByColumnId");function qs(t,e,n,l){return e.options.getRowId?.(t,n,l)??(l?`${l.id}.${n}`:String(n))}o(qs,"table_getRowId");function Ks(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(Ks,"table_getRow");var Us={assignRowPrototype:o((t,e)=>{ce("coreRowsFeature",t,e,{row_getDisplayIndex:{fn:o(n=>As(n),"fn")},row_getAllCellsByColumnId:{fn:o(n=>Gs(n),"fn"),memoDeps:o(n=>[n.getAllCells()],"memoDeps")},row_getAllCells:{fn:o(n=>Bs(n),"fn"),memoDeps:o(n=>[n.table.getAllLeafColumns()],"memoDeps")},row_getLeafRows:{fn:o(n=>$s(n),"fn"),memoDeps:o(n=>[n.subRows],"memoDeps")},row_getParentRow:{fn:o(n=>Ls(n),"fn")},row_getParentRows:{fn:o(n=>js(n),"fn")},row_getUniqueValues:{fn:o((n,l)=>Vs(n,l),"fn")},row_getValue:{fn:o((n,l)=>Es(n,l),"fn")},row_renderValue:{fn:o((n,l)=>zs(n,l),"fn")}})},"assignRowPrototype"),constructTableAPIs:o(t=>{fe("coreRowsFeature",t,{table_getRowsInDisplayOrder:{fn:o(()=>Os(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)=>qs(e,t,n,l),"fn")},table_getRow:{fn:o((e,n)=>Ks(t,e,n),"fn")},table_getMaxSubRowDepth:{fn:o(()=>Hs(t),"fn"),memoDeps:o(()=>[t.getCoreRowModel()],"memoDeps")}})},"constructTableAPIs")};function Tn(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],c=a===void 0?t.initialState[r]:a;n(t._reactivity.untrack(()=>s.get()),c)||s.set(()=>c)}})}o(Tn,"table_syncExternalStateToBaseAtoms");function An(t,e,n=(l,r)=>l===r){t._reactivity.batch(()=>{Tn(t,e,n),t._reactivity.commit?.()})}o(An,"table_publishExternalState");function Go(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(Go,"table_reset");function Js(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(Js,"table_mergeOptions");function Qt(t,e,n){let l=Js(t,Ft(e,t.options));t.optionsStore?t.optionsStore.set(()=>l):t.options=l,n?.syncExternalState!==!1&&An(t,l.state??null)}o(Qt,"table_setOptions");var Ws={constructTableAPIs:o(t=>{fe("coreTablesFeature",t,{table_reset:{fn:o(()=>Go(t),"fn")},table_setOptions:{fn:o(e=>Qt(t,e),"fn")}})},"constructTableAPIs")};var Qs={coreCellsFeature:Cl,coreColumnsFeature:Xl,coreHeadersFeature:ls,coreRowModelsFeature:Ds,coreRowsFeature:Us,coreTablesFeature:Ws};function Xs(t,e={}){return Object.values(t).forEach(n=>{e=n.getInitialState?.(e)??e}),ie(e)}o(Xs,"getInitialTableState");function qo(t){let e=t.features.coreReactivityFeature,{aggregationFns:n,columnMeta:l,coreRowModel:r,expandedRowModel:s,facetedMinMaxValues:a,facetedRowModel:c,facetedUniqueValues:u,filterFns:i,filterMeta:d,filteredRowModel:m,groupedRowModel:g,paginatedRowModel:b,sortFns:f,sortedRowModel:h,tableMeta:w,..._}=t.features,S={_cellInstanceInitFns:[],_columnInstanceInitFns:[],_features:{...Qs,..._},_headerGroupInstanceInitFns:[],_headerInstanceInitFns:[],_reactivity:e,_rowInstanceInitFns:[],_rowModelFns:{aggregationFns:n,filterFns:i,sortFns:f},_rowModels:{},atoms:{},baseAtoms:{}},y=Object.values(S._features),I={...y.reduce((R,x)=>Object.assign(R,x.getDefaultTableOptions?.(S)),{}),...t};if(e.wrapExternalAtoms&&I.atoms)for(let[R,x]of Object.entries(I.atoms)){let v=x,M=e.createWritableAtom(v.get(),{debugName:`externalAtom/${R}`});I.atoms[R]=M;let F=!1,P=v.subscribe(N=>{F||M.set(N)}),k=M.subscribe(N=>{F=!0,v.set(N),F=!1});e.addSubscription(P),e.addSubscription(k)}e.createOptionsStore?(S.optionsStore=e.createWritableAtom(I,{debugName:"table/optionsStore"}),Object.defineProperty(S,"options",{configurable:!0,enumerable:!0,get(){return S.optionsStore.get()},set(R){S.optionsStore.set(()=>R)}})):S.options=I,S.initialState=Xs(S._features,S.options.initialState);let C=Object.keys(S.initialState);for(let R=0;R<C.length;R++){let x=C[R];S.baseAtoms[x]=e.createWritableAtom(S.initialState[x],{debugName:`table/baseAtoms/${x}`}),S.atoms[x]=e.createReadonlyAtom(()=>{let v=S.options,M=v.atoms?.[x],F=M?M.get():S.baseAtoms[x].get();if(M)return F;let P=v.state;if(P&&je(P,x)){let k=P[x];return k===void 0?S.initialState[x]:k}return F},{debugName:`table/atoms/${x}`})}Tn(S),S.store=dl(e.createReadonlyAtom(()=>{let R={};for(let x=0;x<C.length;x++){let v=C[x];R[v]=S.atoms[v].get()}return R},{compare:lt,debugName:"table/store"}));for(let R=0;R<y.length;R++){let x=y[R];x.initTableInstanceData?.(S),x.initCellInstanceData&&S._cellInstanceInitFns.push(x.initCellInstanceData.bind(x)),x.initColumnInstanceData&&S._columnInstanceInitFns.push(x.initColumnInstanceData.bind(x)),x.initHeaderGroupInstanceData&&S._headerGroupInstanceInitFns.push(x.initHeaderGroupInstanceData.bind(x)),x.initHeaderInstanceData&&S._headerInstanceInitFns.push(x.initHeaderInstanceData.bind(x)),x.initRowInstanceData&&S._rowInstanceInitFns.push(x.initRowInstanceData.bind(x)),x.constructTableAPIs?.(S)}return S}o(qo,"constructTable");var Ko={getInitialState:o(t=>({columnOrder:El(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({onColumnOrderChange:Be("columnOrder",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{ce("columnOrderingFeature",t,e,{column_getIndex:{fn:o((n,l)=>Vl(n,l),"fn")},column_getIsFirstColumn:{fn:o((n,l)=>zl(n,l),"fn")},column_getIsLastColumn:{fn:o((n,l)=>$l(n,l),"fn")}})},"assignColumnPrototype"),constructTableAPIs:o(t=>{fe("columnOrderingFeature",t,{table_getColumnIndexes:{fn:o(()=>ko(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=>Po(t,e),"fn")},table_resetColumnOrder:{fn:o(e=>Hl(t,e),"fn")},table_getOrderColumnsFn:{fn:o(()=>Kt(t),"fn"),memoDeps:o(()=>[t.atoms.columnOrder?.get(),t.atoms.grouping?.get(),t.options.groupedColumnMode],"memoDeps")}})},"constructTableAPIs")};function Ys(){return H()}o(Ys,"getDefaultColumnSizingState");function Uo(){return{size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER}}o(Uo,"getDefaultColumnSizingColumnDef");function Pt(t){let e=Uo(),n=t.table.atoms.columnSizing?.get(),l=n&&je(n,t.id)?n[t.id]:void 0;return Math.min(Math.max(t.columnDef.minSize??e.minSize,l??t.columnDef.size??e.size),t.columnDef.maxSize??e.maxSize)}o(Pt,"column_getSize");function On(t){let e=H(),n=H(),l=new Array(t.length),r=0;for(let a=0;a<t.length;a++){let c=t[a],u=V(c,"getSize",Pt);l[a]=u,e[c.id]=r,r+=u}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(On,"buildColumnOffsets");function En(t){return{all:On(Ge(t)),center:On(Ge(t,"center")),start:On(Ge(t,"start")),end:On(Ge(t,"end"))}}o(En,"table_getColumnOffsets");function Zs(t){return t==="start"?"start":t==="end"?"end":t==="center"?"center":"all"}o(Zs,"toOffsetsKey");function ea(t,e){return V(t.table,"getColumnOffsets",En)[Zs(e)].starts[t.id]??0}o(ea,"column_getStart");function ta(t,e){return V(t.table,"getColumnOffsets",En)[Zs(e)].afters[t.id]??0}o(ta,"column_getAfter");function na(t){Nt(t.table,e=>{let n=H(),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(na,"column_resetSize");function oa(t){if(!t.subHeaders.length)return Pt(t.column);let e=0;for(let n=0;n<t.subHeaders.length;n++)e+=oa(t.subHeaders[n]);return e}o(oa,"sumHeaderSize");function st(t){return oa(t)}o(st,"header_getSize");function Jo(t){if(t.index>0){let e=t.headerGroup?.headers[t.index-1];if(e)return V(e,"getStart",Jo)+V(e,"getSize",st)}return 0}o(Jo,"header_getStart");function Nt(t,e){t.options.onColumnSizingChange?.(e)}o(Nt,"table_setColumnSizing");function ra(t,e){Nt(t,e?H():Object.assign(H(),ie(t.initialState.columnSizing??{})))}o(ra,"table_resetColumnSizing");function la(t){return t.getHeaderGroups()[0]?.headers.reduce((e,n)=>e+st(n),0)??0}o(la,"table_getTotalSize");function sa(t){return V(t,"getStartHeaderGroups",vl)[0]?.headers.reduce((e,n)=>e+st(n),0)??0}o(sa,"table_getStartTotalSize");function aa(t){return V(t,"getCenterHeaderGroups",Rl)[0]?.headers.reduce((e,n)=>e+st(n),0)??0}o(aa,"table_getCenterTotalSize");function ia(t){return V(t,"getEndHeaderGroups",yl)[0]?.headers.reduce((e,n)=>e+st(n),0)??0}o(ia,"table_getEndTotalSize");function zn(){return{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}}o(zn,"getDefaultColumnResizingState");function Qo(t){return(t.columnDef.enableResizing??!0)&&(t.table.options.enableColumnResizing??!0)}o(Qo,"column_getCanResize");function ca(t){return t.table.atoms.columnResizing?.get()?.isResizingColumn===t.id}o(ca,"column_getIsResizing");function ua(t,e){let n=t.table.getColumn(t.column.id),l=Qo(n);return r=>{if(!l||Wo(r)&&r.touches.length>1)return;let s=st(t),a=t.getLeafHeaders().map(C=>[C.column.id,Pt(C.column)]),c=Wo(r)?Math.round(r.touches[0].clientX):r.clientX,u=H(),i=o((C,R)=>{if(typeof R!="number")return;let x=n.table,v=x.options.columnResizeMode==="onChange"||C==="end";x._reactivity.batch(()=>{Dt(x,M=>{let F=x.options.columnResizeDirection==="rtl"?-1:1,P=(R-(M.startOffset??0))*F,k=M.startSize??0,N=Math.max(k>0?P/k:0,-.999999);if(v){let T=M.columnSizingStart;for(let z=0;z<T.length;z++){let A=T[z],$=A[1];u[A[0]]=Math.round(Math.max($>0?$+$*N:P/T.length,0)*100)/100}}return{...M,deltaOffset:P,deltaPercentage:N}}),v&&Nt(x,M=>Object.assign(H(),M,u))})},"updateOffset"),d=null,m=!1,g,b=o(()=>{m?(m=!1,i("move",g),d=requestAnimationFrame(b)):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(b)},"onMove"),h=o(C=>{d!==null&&(cancelAnimationFrame(d),d=null,m=!1),n.table._reactivity.batch(()=>{i("end",C??g),Dt(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")},S={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",S.moveHandler),w?.removeEventListener("touchend",S.upHandler),w?.removeEventListener("touchcancel",S.cancelHandler)},"removeTouchEvents"),I=yc()?{passive:!1}:!1;Wo(r)?(w?.addEventListener("touchmove",S.moveHandler,I),w?.addEventListener("touchend",S.upHandler,I),w?.addEventListener("touchcancel",S.cancelHandler,I)):(w?.addEventListener("mousemove",_.moveHandler,I),w?.addEventListener("mouseup",_.upHandler,I)),Dt(n.table,C=>({...C,startOffset:c,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,isResizingColumn:n.id}))}}o(ua,"header_getResizeHandler");function Dt(t,e){t.options.onColumnResizingChange?.(e)}o(Dt,"table_setColumnResizing");function da(t,e){Dt(t,e?zn():ie(t.initialState.columnResizing??zn()))}o(da,"table_resetHeaderSizeInfo");var Vn=null;function yc(){if(typeof Vn=="boolean")return Vn;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 Vn=t,Vn}o(yc,"passiveEventSupported");function Wo(t){return t.type==="touchstart"}o(Wo,"isTouchStartEvent");var Xo={getInitialState:o(t=>({columnResizing:zn(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnResizingChange:Be("columnResizing",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{ce("columnResizingFeature",t,e,{column_getCanResize:{fn:o(n=>Qo(n),"fn")},column_getIsResizing:{fn:o(n=>ca(n),"fn")}})},"assignColumnPrototype"),assignHeaderPrototype:o((t,e)=>{ce("columnResizingFeature",t,e,{header_getResizeHandler:{fn:o((n,l)=>ua(n,l),"fn")}})},"assignHeaderPrototype"),constructTableAPIs:o(t=>{fe("columnResizingFeature",t,{table_setColumnResizing:{fn:o(e=>Dt(t,e),"fn")},table_resetHeaderSizeInfo:{fn:o(e=>da(t,e),"fn")}})},"constructTableAPIs")};var Yo={getInitialState:o(t=>({columnSizing:Ys(),...t}),"getInitialState"),getDefaultColumnDef:o(()=>Uo(),"getDefaultColumnDef"),getDefaultTableOptions:o(t=>({onColumnSizingChange:Be("columnSizing",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{ce("columnSizingFeature",t,e,{column_getSize:{fn:o(n=>Pt(n),"fn"),memoDeps:o(n=>[e.options.columns,e.atoms.columnSizing?.get()?.[n.id]],"memoDeps")},column_getStart:{fn:o((n,l)=>ea(n,l),"fn")},column_getAfter:{fn:o((n,l)=>ta(n,l),"fn")},column_resetSize:{fn:o(n=>na(n),"fn")}})},"assignColumnPrototype"),assignHeaderPrototype:o((t,e)=>{ce("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=>Jo(n),"fn"),memoDeps:o(()=>[e.options.columns,e.atoms.columnSizing?.get(),e.atoms.columnOrder?.get(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get(),e.atoms.grouping?.get(),e.options.groupedColumnMode],"memoDeps")}})},"assignHeaderPrototype"),constructTableAPIs:o(t=>{fe("columnSizingFeature",t,{table_getColumnOffsets:{fn:o(()=>En(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=>Nt(t,e),"fn")},table_resetColumnSizing:{fn:o(e=>ra(t,e),"fn")},table_getTotalSize:{fn:o(()=>la(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")},table_getStartTotalSize:{fn:o(()=>sa(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")},table_getCenterTotalSize:{fn:o(()=>aa(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")},table_getEndTotalSize:{fn:o(()=>ia(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")}})},"constructTableAPIs")};var Zo={getInitialState:o(t=>({columnVisibility:Il(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({onColumnVisibilityChange:Be("columnVisibility",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{ce("columnVisibilityFeature",t,e,{column_getIsVisible:{fn:o(n=>ue(n),"fn"),memoDeps:o(n=>[e.options.columns,e.atoms.columnVisibility?.get(),n.columns],"memoDeps")},column_getCanHide:{fn:o(n=>Gt(n),"fn")},column_getToggleVisibilityHandler:{fn:o(n=>Fl(n),"fn")},column_toggleVisibility:{fn:o((n,l)=>Io(n,l),"fn")}})},"assignColumnPrototype"),assignRowPrototype:o((t,e)=>{ce("columnVisibilityFeature",t,e,{row_getVisibleCells:{fn:o(n=>Ro(n),"fn"),memoDeps:o(n=>[n.getAllCells(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get()],"memoDeps")},row_getVisibleCellsByColumnId:{fn:o(n=>Fn(n),"fn"),memoDeps:o(n=>[n.getAllCells(),e.atoms.columnVisibility?.get()],"memoDeps")}})},"assignRowPrototype"),constructTableAPIs:o(t=>{fe("columnVisibilityFeature",t,{table_getVisibleFlatColumns:{fn:o(()=>Ml(t),"fn"),memoDeps:o(()=>[t.atoms.columnVisibility?.get(),t.atoms.columnOrder?.get(),t.atoms.grouping?.get(),t.options.columns,t.options.groupedColumnMode],"memoDeps")},table_getVisibleLeafColumns:{fn:o(()=>wt(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=>qt(t,e),"fn")},table_resetColumnVisibility:{fn:o(e=>kl(t,e),"fn")},table_toggleAllColumnsVisible:{fn:o(e=>Fo(t,e),"fn")},table_getIsAllColumnsVisible:{fn:o(()=>Mo(t),"fn")},table_getIsSomeColumnsVisible:{fn:o(()=>Pl(t),"fn")},table_getToggleAllColumnsVisibilityHandler:{fn:o(()=>Nl(t),"fn")}})},"constructTableAPIs")};function ma(){return H()}o(ma,"getDefaultRowSelectionState");function _t(t,e){t.options.onRowSelectionChange?.(e)}o(_t,"table_setRowSelection");function ga(t,e){t._lastSelectedRowId=null,_t(t,e?H():Object.assign(H(),ie(t.initialState.rowSelection??{})))}o(ga,"table_resetRowSelection");function er(t,e,n){t._lastSelectedRowId=null,_t(t,l=>{if(e=typeof e<"u"?e:!V(t,"getIsAllRowsSelected",or),n?.deselectAll&&!e)return H();let r=Object.assign(H(),l),s=t.getPreGroupedRowModel().flatRows;if(e){let a=new Map;s.forEach(c=>{$n(c,a)&&(r[c.id]=!0)})}else s.forEach(a=>{Ye(a)&&delete r[a.id]});return r})}o(er,"table_toggleAllRowsSelected");function tr(t,e,n){t._lastSelectedRowId=null,_t(t,l=>{let r=typeof e<"u"?e:!V(t,"getIsAllPageRowsSelected",rr);if(n?.deselectAll&&!r)return H();let s=Object.assign(H(),l);return t.getRowModel().rows.forEach(a=>{jn(s,a.id,r,!0,t,!0)}),s})}o(tr,"table_toggleAllPageRowsSelected");function fa(t){return t.getCoreRowModel()}o(fa,"table_getPreSelectedRowModel");function pa(t){let e=t.getCoreRowModel();return V(t,"getIsSomeRowsSelected",Xt)?ar(e,t):{rows:[],flatRows:[],rowsById:H()}}o(pa,"table_getSelectedRowModel");function ba(t){let e=t.getFilteredRowModel();return V(t,"getIsSomeRowsSelected",Xt)?ar(e,t):{rows:[],flatRows:[],rowsById:H()}}o(ba,"table_getFilteredSelectedRowModel");function ha(t){let e=t.getSortedRowModel();return V(t,"getIsSomeRowsSelected",Xt)?ar(e,t):{rows:[],flatRows:[],rowsById:H()}}o(ha,"table_getGroupedSelectedRowModel");function nr(t){return Object.keys(t.atoms.rowSelection?.get()??{})}o(nr,"table_getSelectedRowIds");function or(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=>!Yt(s,n)&&$n(s,r))&&(l=!1)}return l}o(or,"table_getIsAllRowsSelected");function rr(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(Yt(a,n))!r&&$n(a,l)&&(r=!0);else if($n(a,l))return!1}return r}o(rr,"table_getIsAllPageRowsSelected");function Xt(t){return V(t,"getSelectedRowIds",nr).length>0}o(Xt,"table_getIsSomeRowsSelected");function wa(t){return t.getPaginatedRowModel().flatRows.filter(e=>Ye(e)).some(e=>Hn(e)||V(e,"getIsSomeSelected",sr))}o(wa,"table_getIsSomePageRowsSelected");function xa(t){return e=>{er(t,e.target.checked)}}o(xa,"table_getToggleAllRowsSelectedHandler");function Sa(t){return e=>{tr(t,e.target.checked)}}o(Sa,"table_getToggleAllPageRowsSelectedHandler");function lr(t,e,n){let l=Hn(t);_t(t.table,r=>{e=typeof e<"u"?e:!l;let s=Object.assign(H(),r);return jn(s,t.id,e,(n?.selectChildren??!0)&&mt(t),t.table),!e&&n?.deselectParents&&va(s,t),s})}o(lr,"row_toggleSelected");function Hn(t){return Yt(t,t.table.atoms.rowSelection?.get()??{})}o(Hn,"row_getIsSelected");function sr(t){return ir(t)==="some"}o(sr,"row_getIsSomeSelected");function _a(t){return ir(t)==="all"}o(_a,"row_getIsAllSubRowsSelected");function Ye(t){let e=t.table.options;return typeof e.enableRowSelection=="function"?e.enableRowSelection(t):e.enableRowSelection??!0}o(Ye,"row_getCanSelect");function Ln(t){let e=t.table.options;return typeof e.enableSubRowSelection=="function"?e.enableSubRowSelection(t):e.enableSubRowSelection??!0}o(Ln,"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 Ca(t,e){let n=Ye(t);return l=>{if(!n)return;let r=l,s=t.table,a=r.target.checked,c=s._lastSelectedRowId;(!(s.options.enableRowRangeSelection!==!1&&c!==null&&mt(t)&&(s.options.isRowRangeSelectionEvent?.(l)??!1))||!Rc(t,c,a,e))&&lr(t,a,e),s._lastSelectedRowId=t.id}}o(Ca,"row_getToggleSelectedHandler");function Rc(t,e,n,l){let r=l?.selectChildren??!0,s=t.table,a=s.getRowsInDisplayOrder(),c=s.getPrePaginatedRowModel().rowsById[e]??s.getCoreRowModel().rowsById[e];if(!c)return!1;let u=c.getDisplayIndex(),i=t.getDisplayIndex(),d=a[u],m=a[i];if(u<0||i<0||u>=a.length||i>=a.length||d?.id!==c.id||m?.id!==t.id||!mt(c)||!mt(t))return!1;let g=Math.min(u,i),b=Math.max(u,i);return _t(s,f=>{let h=Object.assign(H(),f);for(let w=g;w<=b;w++){let _=a[w];!Ye(_)||!mt(_)||(jn(h,_.id,n,r,s),!n&&l?.deselectParents&&va(h,_))}return h}),!0}o(Rc,"selectRowRange");function jn(t,e,n,l,r,s){let a=r.getRow(e,!0);n?(mt(a)||Object.keys(t).forEach(c=>delete t[c]),Ye(a)&&(t[e]=!0)):(!s||Ye(a))&&delete t[e],l&&a.subRows.length&&Ln(a)&&a.subRows.forEach(c=>jn(t,c.id,n,l,r,s))}o(jn,"mutateRowIsSelected");function $n(t,e){if(!Ye(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=[],c=!0,u=l;for(;u!==void 0;){let i=e.get(u);if(i!==void 0){c=i;break}a.push(u);let d=s[u]??n.getRow(u,!0);if(!Ln(d)){c=!1;break}u=d.parentId}return a.forEach(i=>e.set(i,c)),c}o($n,"isRowSelectableInSelectAll");function va(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(va,"pruneAncestorRowIds");function ya(t,e,n,l){let r=[];for(let s=0;s<t.length;s++){let a=t[s],c=Yt(a,e);if(c&&(n.push(a),l[a.id]=a),a.subRows.length){let u=ya(a.subRows,e,n,l);if(c){let i=Object.create(Object.getPrototypeOf(a));Rn(i,a),i.subRows=u,r.push(i)}}else c&&r.push(a)}return r}o(ya,"selectRowsRecursively");function ar(t,e){let n=[],l=H(),r=e.atoms.rowSelection?.get()??{};return{rows:ya(t.rows,r,n,l),flatRows:n,rowsById:l}}o(ar,"selectRowsFn");function Yt(t,e){return!!(je(e,t.id)&&e[t.id])}o(Yt,"isRowSelected");function ir(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(Ye(a)&&(r=!0,Yt(a,e)?n=!0:l=!1),a.subRows.length){let c=ir(a);c==="all"?(n=!0,r=!0):c==="some"?(n=!0,l=!1,r=!0):l=!1}}return r?l?"all":n?"some":!1:!1}o(ir,"isSubRowSelected");var cr={initTableInstanceData:o(t=>{t._lastSelectedRowId=null},"initTableInstanceData"),resetTableInstanceData:o(t=>{t._lastSelectedRowId=null},"resetTableInstanceData"),getInitialState:o(t=>({rowSelection:ma(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({onRowSelectionChange:Be("rowSelection",t),enableRowSelection:!0,enableMultiRowSelection:!0,enableRowRangeSelection:!0,enableSubRowSelection:!0,isRowRangeSelectionEvent:o(e=>{let n=e;return!!(n.shiftKey||n.nativeEvent?.shiftKey)},"isRowRangeSelectionEvent")}),"getDefaultTableOptions"),assignRowPrototype:o((t,e)=>{ce("rowSelectionFeature",t,e,{row_toggleSelected:{fn:o((n,l,r)=>lr(n,l,r),"fn")},row_getIsSelected:{fn:o(n=>Hn(n),"fn")},row_getIsSomeSelected:{fn:o(n=>sr(n),"fn"),memoDeps:o(n=>[n.subRows,n.table.atoms.rowSelection?.get(),n.table.options.enableRowSelection],"memoDeps")},row_getIsAllSubRowsSelected:{fn:o(n=>_a(n),"fn"),memoDeps:o(n=>[n.subRows,n.table.atoms.rowSelection?.get(),n.table.options.enableRowSelection],"memoDeps")},row_getCanSelect:{fn:o(n=>Ye(n),"fn")},row_getCanSelectSubRows:{fn:o(n=>Ln(n),"fn")},row_getCanMultiSelect:{fn:o(n=>mt(n),"fn")},row_getToggleSelectedHandler:{fn:o((n,l)=>Ca(n,l),"fn")}})},"assignRowPrototype"),constructTableAPIs:o(t=>{fe("rowSelectionFeature",t,{table_setRowSelection:{fn:o(e=>_t(t,e),"fn")},table_resetRowSelection:{fn:o(e=>ga(t,e),"fn")},table_toggleAllRowsSelected:{fn:o((e,n)=>er(t,e,n),"fn")},table_toggleAllPageRowsSelected:{fn:o((e,n)=>tr(t,e,n),"fn")},table_getPreSelectedRowModel:{fn:o(()=>fa(t),"fn")},table_getSelectedRowModel:{fn:o(()=>pa(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getCoreRowModel()],"memoDeps")},table_getFilteredSelectedRowModel:{fn:o(()=>ba(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getFilteredRowModel()],"memoDeps")},table_getGroupedSelectedRowModel:{fn:o(()=>ha(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getSortedRowModel()],"memoDeps")},table_getSelectedRowIds:{fn:o(()=>nr(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get()],"memoDeps")},table_getIsAllRowsSelected:{fn:o(()=>or(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getFilteredRowModel(),t.options.enableRowSelection,t.options.enableSubRowSelection],"memoDeps")},table_getIsAllPageRowsSelected:{fn:o(()=>rr(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getPaginatedRowModel(),t.options.enableRowSelection,t.options.enableSubRowSelection],"memoDeps")},table_getIsSomeRowsSelected:{fn:o(()=>Xt(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get()],"memoDeps")},table_getIsSomePageRowsSelected:{fn:o(()=>wa(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getPaginatedRowModel(),t.options.enableRowSelection],"memoDeps")},table_getToggleAllRowsSelectedHandler:{fn:o(()=>xa(t),"fn")},table_getToggleAllPageRowsSelectedHandler:{fn:o(()=>Sa(t),"fn")}})},"constructTableAPIs")};var ur={getInitialState(t){return{sorting:gs(),...t}},getDefaultColumnDef(){return{sortFn:"auto",sortUndefined:1}},getDefaultTableOptions(t){return{autoResetSorting:!1,onSortingChange:Be("sorting",t),isMultiSortEvent:o(e=>e.shiftKey,"isMultiSortEvent")}},assignColumnPrototype(t,e){ce("rowSortingFeature",t,e,{column_getAutoSortFn:{fn:o(n=>zo(n),"fn")},column_getAutoSortDir:{fn:o(n=>$o(n),"fn")},column_getSortFn:{fn:o(n=>Dn(n),"fn")},column_toggleSorting:{fn:o((n,l,r)=>Ho(n,l,r),"fn")},column_getFirstSortDir:{fn:o(n=>Lo(n),"fn")},column_getNextSortingOrder:{fn:o((n,l)=>jo(n,l),"fn")},column_getCanSort:{fn:o(n=>Wt(n),"fn")},column_getCanMultiSort:{fn:o(n=>Ut(n),"fn")},column_getIsSorted:{fn:o(n=>Bo(n),"fn")},column_getSortIndex:{fn:o(n=>ps(n),"fn")},column_clearSorting:{fn:o(n=>bs(n),"fn")},column_getToggleSortingHandler:{fn:o(n=>hs(n),"fn")}})},constructTableAPIs(t){fe("rowSortingFeature",t,{table_setSorting:{fn:o(e=>Jt(t,e),"fn")},table_resetSorting:{fn:o(e=>Vo(t,e),"fn")}})}};function dr(){return t=>{let e=t;return Mt({feature:"rowSortingFeature",table:e,fnName:"table.getSortedRowModel",memoDeps:o(()=>[e.atoms.sorting?.get(),e.getPreSortedRowModel()],"memoDeps"),fn:o(()=>Ic(e),"fn"),onAfterUpdate:In(()=>Nn(e))})}}o(dr,"createSortedRowModel");function Ic(t){let e=t.getPreSortedRowModel(),n=t.atoms.sorting?.get();if(!e.rows.length||!n?.length)return e;let l=[],r=n.filter(u=>{let i=t.getColumn(u.id);return i?Wt(i):!1});if(!r.length)return e;let s=[];for(let u=0;u<r.length;u++){let i=r[u],d=t.getColumn(i.id);d&&s.push({id:i.id,desc:i.desc,sortUndefined:d.columnDef.sortUndefined,invertSorting:d.columnDef.invertSorting,sortFn:Dn(d)})}let a=o((u,i)=>{for(let d=0;d<s.length;d++){let m=s[d],g=m.sortUndefined,b=m.desc,f=0;if(g){let h=u.getValue(m.id),w=i.getValue(m.id),_=h===void 0,S=w===void 0;if(_&&S)continue;if(_||S){if(g==="first")return _?-1:1;if(g==="last")return _?1:-1;f=_?g:-g}}if(f===0&&(f=m.sortFn(u,i,m.id)),f!==0)return b&&(f*=-1),m.invertSorting&&(f*=-1),f}return u.index-i.index},"compareRows"),c=o(u=>{let i=u.slice();i.sort(a);let d=!1;for(let m=0;m<i.length;m++){let g=i[m];g!==u[m]&&(d=!0);let b=l.length;if(l.push(g),g.subRows.length){let f=c(g.subRows);if(f.changed){let h=Object.create(Object.getPrototypeOf(g));Rn(h,g),h.subRows=f.rows,i[m]=h,l[b]=h,d=!0}}}return{rows:i,changed:d}},"sortData");return{rows:c(e.rows).rows,flatRows:l,rowsById:e.rowsById}}o(Ic,"_createSortedRowModel");var gt=Ie(ut(),1);var Fc=typeof window>"u"?gt.useEffect:gt.useLayoutEffect;function mr(t,e){let[{table:n,rootSource:l}]=(0,gt.useState)(()=>{let u=qo({...t,features:{coreReactivityFeature:ml(),...t.features}});return u.Subscribe=(i=>ul({...i,source:i.source??u.store})),u.FlexRender=fo,{table:u,rootSource:vo(u.store,lt)}}),r=n;Qt(r,u=>({...u,...t}),{syncExternalState:!1});let s=r.options.state,a=l.get(),c=Bt(l,e,{compare:lt});return Fc(()=>{l.markCommitted(a),An(r,s??null,lt)}),(0,gt.useMemo)(()=>({...n,options:t,state:c}),[n,t,c])}o(mr,"useTable");var Ia=Ie(zt(),1),Fa=Ie(ut(),1),Fe=Ie($t(),1);var Mc=[{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"}],kc=o(t=>{let e=t.trim(),n=Number(e);return e!==""&&Number.isFinite(n)&&String(n)===e?n:t},"$"),Pc=o(t=>t.operator==="contains"?t.value==="":t.operator!=="eq"&&t.operator!=="ne"&&t.literal===void 0&&t.value.trim()==="","z"),Ze=o(t=>t.filter(e=>e.column!==""&&!Pc(e)).map(e=>e.operator==="contains"?{column:e.column,operator:e.operator,value:e.value}:{column:e.column,operator:e.operator,value:e.literal===void 0?kc(e.value):e.literal[0]}),"L"),Ra=o((t,e)=>({column:t.column,operator:t.operator,value:t.value,...e}),"P"),Ma=o(t=>{let e=(0,Ia.c)(44),{columns:n,filters:l,onAskAi:r,onFiltersChange:s,onSearchChange:a,search:c}=t,[u,i]=(0,Fa.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(F=>{let P=Number(F.currentTarget.dataset.index);s(l.filter((k,N)=>N!==P))},"T"),e[4]=l,e[5]=s,e[6]=g):g=e[6];let b=g,f;e[7]!==l||e[8]!==s?(f=o(F=>{let P=Number(F.currentTarget.dataset.index),k=F.currentTarget.value;s(l.map((N,T)=>T===P?Ra(N,{column:k}):N))},"y"),e[7]=l,e[8]=s,e[9]=f):f=e[9];let h=f,w;e[10]!==l||e[11]!==s?(w=o(F=>{let P=Number(F.currentTarget.dataset.index),k=F.currentTarget.value;s(l.map((N,T)=>T===P?{...N,operator:k}:N))},"S"),e[10]=l,e[11]=s,e[12]=w):w=e[12];let _=w,S;e[13]!==l||e[14]!==s?(S=o(F=>{let P=Number(F.currentTarget.dataset.index),k=F.currentTarget.value;s(l.map((N,T)=>T===P?Ra(N,{value:k}):N))},"k"),e[13]=l,e[14]=s,e[15]=S):S=e[15];let y=S,I;e[16]!==a||e[17]!==c?(I=(0,Fe.jsx)("input",{"aria-label":"Search rows","data-testid":"db-filter",onChange:a,placeholder:"search table\u2026",value:c}),e[16]=a,e[17]=c,e[18]=I):I=e[18];let C;e[19]!==m?(C=(0,Fe.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]!==u||e[22]!==r?(R=r!==void 0&&(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)("input",{"aria-label":"Describe a filter","data-testid":"db-ai-prompt",onChange:o(F=>{i(F.target.value)},"onChange"),onKeyDown:o(F=>{F.key==="Enter"&&u.trim()!==""&&(F.preventDefault(),r(u.trim()))},"onKeyDown"),placeholder:"describe a filter\u2026",value:u}),(0,Fe.jsx)("button",{"data-testid":"db-ai-filter",disabled:u.trim()==="",onClick:o(()=>{r(u.trim())},"onClick"),type:"button",children:"Suggest"})]}),e[21]=u,e[22]=r,e[23]=R):R=e[23];let x;e[24]!==I||e[25]!==C||e[26]!==R?(x=(0,Fe.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[I,C,R]}),e[24]=I,e[25]=C,e[26]=R,e[27]=x):x=e[27];let v;if(e[28]!==h||e[29]!==_||e[30]!==y||e[31]!==n||e[32]!==l||e[33]!==b){let F;e[35]!==h||e[36]!==_||e[37]!==y||e[38]!==n||e[39]!==b?(F=o((P,k)=>(0,Fe.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"db-filter-row",children:[(0,Fe.jsx)("select",{"aria-label":"Filter column","data-index":k,"data-testid":"db-filter-column",onChange:h,value:P.column,children:n.map(Nc)}),(0,Fe.jsx)("select",{"aria-label":"Filter operator","data-index":k,"data-testid":"db-filter-operator",onChange:_,value:P.operator,children:Mc.map(Dc)}),(0,Fe.jsx)("input",{"aria-label":"Filter value","data-index":k,"data-testid":"db-filter-value",onChange:y,placeholder:"value",value:P.value}),(0,Fe.jsx)("button",{"aria-label":"Remove filter","data-index":k,"data-testid":"db-filter-remove",onClick:b,type:"button",children:"\u2715"})]},k),"a"),e[35]=h,e[36]=_,e[37]=y,e[38]=n,e[39]=b,e[40]=F):F=e[40],v=l.map(F),e[28]=h,e[29]=_,e[30]=y,e[31]=n,e[32]=l,e[33]=b,e[34]=v}else v=e[34];let M;return e[41]!==v||e[42]!==x?(M=(0,Fe.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"db-filters",children:[x,v]}),e[41]=v,e[42]=x,e[43]=M):M=e[43],M},"M");function Nc(t){return(0,Fe.jsx)("option",{value:t,children:t},t)}o(Nc,"B");function Dc(t){return(0,Fe.jsx)("option",{value:t.value,children:t.label},t.value)}o(Dc,"G");var Tc=o(t=>({tables:Object.entries(t).map(([e,n])=>({fields:n.map(l=>l.name),indexes:[],name:e,relations:n.filter(l=>l.ref!==void 0).map(l=>({field:l.name,kind:"one",name:l.name,onDelete:l.onDelete,references:l.ref,table:e}))}))}),"_o"),Ac=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 c=e.get(s)??[];c.push({...r,table:l.name}),e.set(s,c)}return e},"Ro"),Oc=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},"$o"),ka=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},"Jt"),hr=o(t=>`${t.table}.${t.column}`,"It"),Ec=o(t=>{let e=(0,q.c)(111),{columns:n,onApply:l,onClose:r,shardKey:s,table:a,total:c,uniqueColumns:u}=t,i=oe(),[d,m]=(0,D.useState)(n[0]??""),[g,b]=(0,D.useState)(""),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=o(be=>{m(be.target.value)},"u"),e[0]=f):f=e[0];let h=f,w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w=o(be=>{b(be.target.value)},"h"),e[1]=w):w=e[1];let _=w,S;e[2]!==g?(S=g.trim(),e[2]=g,e[3]=S):S=e[3];let y=S==="",I,C;if(e[4]!==y||e[5]!==i||e[6]!==g){if(!y)try{C=gn(JSON.parse(g))}catch(be){I=i("Invalid JSON: {message}",{message:be.message})}e[4]=y,e[5]=i,e[6]=g,e[7]=I,e[8]=C}else I=e[7],C=e[8];let R;e[9]!==d||e[10]!==c||e[11]!==u?(R=u.has(d)&&c>1,e[9]=d,e[10]=c,e[11]=u,e[12]=R):R=e[12];let x=R,v=d!==""&&!y&&I===void 0&&!x,M;e[13]!==v||e[14]!==d||e[15]!==l||e[16]!==r||e[17]!==C?(M=o(()=>{v&&(l({[d]:C}),r())},"T"),e[13]=v,e[14]=d,e[15]=l,e[16]=r,e[17]=C,e[18]=M):M=e[18];let F=M,P;e[19]!==i?(P=i("Set a column on matching rows"),e[19]=i,e[20]=P):P=e[20];let k;e[21]!==i?(k=i("Set a column on matching rows"),e[21]=i,e[22]=k):k=e[22];let N;e[23]!==k?(N=(0,p.jsx)("h3",{className:"text-base text-foreground","data-testid":"bulk-patch-title",children:k}),e[23]=k,e[24]=N):N=e[24];let T;e[25]!==i||e[26]!==a||e[27]!==c?(T=i("Writes {total} rows of {table} through the schema-aware writer \u2014 validators and indexes apply, exactly like a mutation.",{table:a,total:c.toString()}),e[25]=i,e[26]=a,e[27]=c,e[28]=T):T=e[28];let z;e[29]!==T?(z=(0,p.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-desc",children:T}),e[29]=T,e[30]=z):z=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 $;e[34]!==A?($=(0,p.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-shard",children:A}),e[34]=A,e[35]=$):$=e[35];let K;e[36]!==z||e[37]!==$||e[38]!==N?(K=(0,p.jsxs)("div",{className:"flex flex-col gap-0.5",children:[N,z,$]}),e[36]=z,e[37]=$,e[38]=N,e[39]=K):K=e[39];let U;e[40]!==i?(U=i("Close"),e[40]=i,e[41]=U):U=e[41];let O;e[42]!==r||e[43]!==U?(O=(0,p.jsx)(rn,{"data-testid":"bulk-patch-close",onClick:r,size:"xs",variant:"ghost",children:U}),e[42]=r,e[43]=U,e[44]=O):O=e[44];let Q;e[45]!==K||e[46]!==O?(Q=(0,p.jsxs)("div",{className:"flex items-start justify-between",children:[K,O]}),e[45]=K,e[46]=O,e[47]=Q):Q=e[47];let J;e[48]!==i?(J=i("Column"),e[48]=i,e[49]=J):J=e[49];let Z;e[50]!==J?(Z=(0,p.jsx)(co,{htmlFor:"bulk-patch-column",children:J}),e[50]=J,e[51]=Z):Z=e[51];let ne;e[52]!==i?(ne=i("Column"),e[52]=i,e[53]=ne):ne=e[53];let te;e[54]!==n?(te=n.map(Vc),e[54]=n,e[55]=te):te=e[55];let se;e[56]!==d||e[57]!==ne||e[58]!==te?(se=(0,p.jsx)("select",{"aria-label":ne,className:"h-8 rounded-md border border-input bg-transparent px-2 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"bulk-patch-column",id:"bulk-patch-column",onChange:h,value:d,children:te}),e[56]=d,e[57]=ne,e[58]=te,e[59]=se):se=e[59];let de;e[60]!==i?(de=i("Value"),e[60]=i,e[61]=de):de=e[61];let pe;e[62]!==de?(pe=(0,p.jsx)(co,{htmlFor:"bulk-patch-value",children:de}),e[62]=de,e[63]=pe):pe=e[63];let Ce;e[64]!==g?(Ce=(0,p.jsx)(kr,{className:"flex-1 font-mono","data-testid":"bulk-patch-value",id:"bulk-patch-value",onChange:_,placeholder:"true",value:g}),e[64]=g,e[65]=Ce):Ce=e[65];let xe;e[66]!==Z||e[67]!==se||e[68]!==pe||e[69]!==Ce?(xe=(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[Z,se,pe,Ce]}),e[66]=Z,e[67]=se,e[68]=pe,e[69]=Ce,e[70]=xe):xe=e[70];let Se;e[71]!==I?(Se=I!==void 0&&(0,p.jsx)("p",{className:"text-xs text-destructive","data-testid":"bulk-patch-error",role:"alert",children:I}),e[71]=I,e[72]=Se):Se=e[72];let ve;e[73]!==d||e[74]!==i||e[75]!==c||e[76]!==x?(ve=x&&(0,p.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:c.toString()})}),e[73]=d,e[74]=i,e[75]=c,e[76]=x,e[77]=ve):ve=e[77];let L;e[78]!==y||e[79]!==i||e[80]!==x?(L=y&&!x&&(0,p.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]=x,e[81]=L):L=e[81];let X;e[82]!==v||e[83]!==d||e[84]!==g?(X=v&&(0,p.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"bulk-patch-preview",children:`${d} = ${g.trim()}`}),e[82]=v,e[83]=d,e[84]=g,e[85]=X):X=e[85];let le;e[86]!==i?(le=i("Cancel"),e[86]=i,e[87]=le):le=e[87];let Me;e[88]!==r||e[89]!==le?(Me=(0,p.jsx)(rn,{"data-testid":"bulk-patch-cancel",onClick:r,size:"xs",variant:"outline",children:le}),e[88]=r,e[89]=le,e[90]=Me):Me=e[90];let Ne=!v,ae;e[91]!==i||e[92]!==c?(ae=i("Set on {total} rows",{total:c.toString()}),e[91]=i,e[92]=c,e[93]=ae):ae=e[93];let ee;e[94]!==F||e[95]!==Ne||e[96]!==ae?(ee=(0,p.jsx)(rn,{"data-testid":"bulk-patch-apply",disabled:Ne,onClick:F,size:"xs",children:ae}),e[94]=F,e[95]=Ne,e[96]=ae,e[97]=ee):ee=e[97];let G;e[98]!==Me||e[99]!==ee?(G=(0,p.jsxs)("div",{className:"flex justify-end gap-2",children:[Me,ee]}),e[98]=Me,e[99]=ee,e[100]=G):G=e[100];let De;return e[101]!==r||e[102]!==Q||e[103]!==xe||e[104]!==Se||e[105]!==ve||e[106]!==L||e[107]!==X||e[108]!==G||e[109]!==P?(De=(0,p.jsxs)(Lt,{label:P,onClose:r,panelTestId:"bulk-patch-panel",testId:"bulk-patch-overlay",variant:"dialog",children:[Q,xe,Se,ve,L,X,G]}),e[101]=r,e[102]=Q,e[103]=xe,e[104]=Se,e[105]=ve,e[106]=L,e[107]=X,e[108]=G,e[109]=P,e[110]=De):De=e[110],De},"Do");function Vc(t){return(0,p.jsx)("option",{value:t,children:t},t)}o(Vc,"Ao");var Pa=6,Gn=100,zc=o(t=>({paddingLeft:t*16}),"Po"),$c=o(t=>{let e=(0,q.c)(2),{table:n}=t,l=`cascade-restrict-${n}`,r;return e[0]!==l?(r=(0,p.jsx)("span",{className:"rounded bg-destructive/10 px-1 text-destructive","data-testid":l,children:"restrict \u2014 will block delete"}),e[0]=l,e[1]=r):r=e[1],r},"Io"),Hc=o(t=>{let e=(0,q.c)(2),{table:n}=t,l=`cascade-cascade-${n}`,r;return e[0]!==l?(r=(0,p.jsx)("span",{className:"rounded bg-warning/10 px-1 text-warning","data-testid":l,children:"cascade"}),e[0]=l,e[1]=r):r=e[1],r},"Fo"),Lc=o(t=>{let e=(0,q.c)(2),{table:n}=t,l=`cascade-undeclared-${n}`,r;return e[0]!==l?(r=(0,p.jsx)("span",{className:"rounded bg-muted px-1 text-muted-foreground","data-testid":l,children:"references \u2014 no delete action declared"}),e[0]=l,e[1]=r):r=e[1],r},"Oo"),jc=o(t=>t.relation===void 0||t.relation.onDelete==="cascade"?(0,p.jsx)(Hc,{table:t.table}):t.isRestrict?(0,p.jsx)($c,{table:t.table}):(0,p.jsx)(Lc,{table:t.table}),"Mo"),$a=o(t=>{let e=(0,q.c)(35),{depth:n,node:l}=t,r=`cascade-row-${l.table}`,s;e[0]!==n?(s=zc(n),e[0]=n,e[1]=s):s=e[1];let a;e[2]!==n?(a=n>0&&(0,p.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2514"}),e[2]=n,e[3]=a):a=e[3];let c;e[4]!==l.table?(c=(0,p.jsx)("span",{className:"font-medium text-foreground",children:l.table}),e[4]=l.table,e[5]=c):c=e[5];let u;e[6]!==l.relation||e[7]!==l.table?(u=l.relation!==void 0&&(0,p.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]=u):u=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,p.jsxs)("span",{className:"text-muted-foreground",children:["(",i," rows)"]}),e[11]=i,e[12]=d):d=e[12];let m;e[13]!==l?(m=jc(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,p.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 b;e[18]!==r||e[19]!==s||e[20]!==a||e[21]!==c||e[22]!==u||e[23]!==d||e[24]!==m||e[25]!==g?(b=(0,p.jsxs)("li",{className:"flex flex-wrap items-center gap-1.5 py-1 font-mono text-xs","data-testid":r,style:s,children:[a,c,u,d,m,g]}),e[18]=r,e[19]=s,e[20]=a,e[21]=c,e[22]=u,e[23]=d,e[24]=m,e[25]=g,e[26]=b):b=e[26];let f;if(e[27]!==n||e[28]!==l.children){let w;e[30]!==n?(w=o((_,S)=>(0,p.jsx)($a,{depth:n+1,node:_},`${_.table}-${_.relation?.field??"root"}-${S.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]!==b||e[33]!==f?(h=(0,p.jsxs)(p.Fragment,{children:[b,f]}),e[32]=b,e[33]=f,e[34]=h):h=e[34],h},"an"),Bc=o(t=>{let e=t._id??t.id??t.__id__??"";return typeof e=="string"?e:typeof e=="number"?e.toString():""},"Lo"),Gc=o(async(t,e,n,l)=>{try{let r=await l(t,e,n),s=r.rows.flatMap(c=>Bc(c)||[]).slice(0,Gn),a=r.total??0;return{capNote:a>Gn?`showing first ${Gn.toString()} of ${a.toString()}`:void 0,rowCount:a,rowIds:s}}catch{return{capNote:"count unavailable",rowCount:0,rowIds:[]}}},"Vo"),Ha=o(async(t,e,n,l,r,s,a)=>{let{capNote:c,rowCount:u,rowIds:i}=n===void 0?{capNote:void 0,rowCount:1,rowIds:[e]}:await Gc(t,n.field,e,a),d=n?.onDelete==="restrict",m=[],g=`${t}:${e}`,b=s>=Pa;if(!r.has(g)&&!b){r.add(g);let h=l.get(t)??[];for(let w of h)for(let _ of i.slice(0,10)){let S=await Ha(w.table,_,w,l,r,s+1,a);(S.rowCount>0||s===0)&&m.push(S)}r.delete(g)}let f=c;if(b){let h=`depth capped at ${Pa.toString()}`;f=c===void 0?h:`${c}; ${h}`}return{capNote:f,children:m,isRestrict:d,relation:n,rowCount:u,rowIds:i,table:t}},"cn"),qc=o(({onClose:t,onConfirm:e,readPage:n,rowId:l,schema:r,table:s})=>{let a=oe(),[c,u]=(0,D.useState)(!0),[i,d]=(0,D.useState)(null),[m,g]=(0,D.useState)(null);(0,D.useEffect)(()=>{let h=!1;return re((async()=>{try{u(!0),g(null);let w=Ac(r);if(!((w.get(s)??[]).length>0)){h||(d({capNote:void 0,children:[],isRestrict:!1,relation:void 0,rowCount:1,rowIds:[l],table:s}),u(!1));return}let _=await Ha(s,l,void 0,w,new Set,0,n);h||(d(_),u(!1))}catch(w){h||(g(w.message),u(!1))}})()),()=>{h=!0}},[l,s]);let b=i!==null&&Oc(i,h=>h.isRestrict).length>0,f=o(()=>{e(),t()},"u");return(0,p.jsxs)(Lt,{label:"Cascade impact preview",onClose:t,panelTestId:"cascade-panel",testId:"cascade-overlay",variant:"dialog",children:[(0,p.jsxs)("div",{className:"flex items-start justify-between",children:[(0,p.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,p.jsx)("h3",{className:"text-base text-foreground","data-testid":"cascade-title",children:a("Cascade impact")}),(0,p.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,p.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground","data-testid":"cascade-close",onClick:t,type:"button",children:a("Close")})]}),c&&(0,p.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-loading",children:a("Loading\u2026")}),m!==null&&(0,p.jsx)("p",{className:"text-xs text-destructive","data-testid":"cascade-error",role:"alert",children:m}),!c&&i!==null&&(0,p.jsx)("ul",{className:"flex flex-col","data-testid":"cascade-tree",children:(0,p.jsx)($a,{depth:0,node:i})}),!c&&i!==null&&i.children.length===0&&(0,p.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-no-impact",children:a("No related rows found.")}),b&&(0,p.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,p.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,p.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,p.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:c,onClick:f,type:"button",children:a("Delete")})]})]})},"Bo"),Kc=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,c=new Set,u=0,i=0,d=0;for(let m of t){let g=m.getSize(),b=e.has(m.id),f=u+g>s&&u<a;b||f?c.add(m.id):u<s?i+=g:d+=g,u+=g}return{ids:c,leadPx:i,tailPx:d}},"jo"),Uc=o((t,e)=>{let n=new Map,l=0;for(let r of t)e.has(r.id)&&(n.set(r.id,l),l+=r.getSize());return n},"zo"),Jc={columnOrderingFeature:Ko,columnResizingFeature:Xo,columnSizingFeature:Yo,columnVisibilityFeature:Zo,rowSelectionFeature:cr,rowSortingFeature:ur,sortedRowModel:dr(),sortFns:{alphanumeric:To,basic:kt,datetime:Oo,text:Ao}},Wc=o(()=>{let t=(0,q.c)(12),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={},t[0]=e):e=t[0];let[n,l]=(0,D.useState)(e),r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=o((h,w,_)=>{l(S=>({...S,[h]:{...S[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 c=a,u;t[3]===Symbol.for("react.memo_cache_sentinel")?(u=o((h,w)=>{l(_=>{let S=_[h];if(S===void 0)return _;let y=Object.fromEntries(Object.entries(S).filter(I=>{let[C,R]=I;return!(C in w)||!Object.is(R,w[C])}));return Object.keys(y).length===0?Object.fromEntries(Object.entries(_).filter(I=>{let[C]=I;return C!==h})):{..._,[h]:y}})},"a"),t[3]=u):u=t[3];let i=u,d;t[4]!==n?(d=o((h,w)=>{let _=n[h];return _!==void 0&&w in _?{value:_[w]}:void 0},"f"),t[4]=n,t[5]=d):d=t[5];let m=d,g;t[6]!==n?(g=Object.values(n).reduce(Xc,0),t[6]=n,t[7]=g):g=t[7];let b=g,f;return t[8]!==b||t[9]!==n||t[10]!==m?(f={clear:c,count:b,drop:i,stage:s,staged:n,stagedValue:m},t[8]=b,t[9]=n,t[10]=m,t[11]=f):f=t[11],f},"Ko"),La=o((t,e)=>{if(typeof e=="number"){let n=Number(t);return t.trim()===""||Number.isNaN(n)?t:n}if(typeof e=="boolean"){if(t==="true")return!0;if(t==="false")return!1}return t},"dn"),Qc=o(t=>{let e=(0,q.c)(29),{changes:n,committing:l,onCommit:r,onDiscard:s}=t,a=oe(),c;e[0]!==n.length||e[1]!==a?(c=a("{count} pending changes",{count:n.length}),e[0]=n.length,e[1]=a,e[2]=c):c=e[2];let u;e[3]!==c?(u=(0,p.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-warning","data-testid":"db-staged-count",children:c}),e[3]=c,e[4]=u):u=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,p.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,p.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 b;e[18]!==u||e[19]!==d||e[20]!==g?(b=(0,p.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,d,g]}),e[18]=u,e[19]=d,e[20]=g,e[21]=b):b=e[21];let f;e[22]!==n?(f=n.map(Yc),e[22]=n,e[23]=f):f=e[23];let h;e[24]!==f?(h=(0,p.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]!==b||e[27]!==h?(w=(0,p.jsxs)("div",{className:"flex flex-col gap-2 border border-warning/40 bg-warning/5 p-3","data-testid":"db-staged",children:[b,h]}),e[26]=b,e[27]=h,e[28]=w):w=e[28],w},"Go");function Xc(t,e){return t+Object.keys(e).length}o(Xc,"Jo");function Yc(t){return(0,p.jsxs)("li",{className:"flex flex-wrap items-center gap-2 font-mono text-xs",children:[(0,p.jsxs)("span",{className:"text-muted-foreground",children:[t.rowId,".",t.column]}),(0,p.jsx)("span",{className:"text-destructive line-through",children:Oe(t.oldValue)}),(0,p.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2192"}),(0,p.jsx)("span",{className:"text-foreground",children:Oe(t.newValue)})]},`${t.rowId}:${t.column}`)}o(Yc,"Wo");var Na=400,Zc=36,eu={flex:"1 1 0%",minHeight:0,overflow:"auto",position:"relative"},tu={width:"100%"},nu=/\n$/u,ou={alignItems:"center",display:"flex",left:0,position:"absolute",top:0,width:"100%"},ru={display:"flex",width:"100%"},Da={flex:"0 0 8.5rem",padding:"0.375rem 0.75rem"},lu="2.5rem",ja={alignItems:"center",display:"flex",flex:"0 0 2.5rem",justifyContent:"center",left:0,padding:"0.375rem 0",position:"sticky",zIndex:2},wr=o(t=>({flex:"0 0 auto",overflow:"hidden",padding:"0.375rem 0.75rem",position:"relative",textOverflow:"ellipsis",whiteSpace:"nowrap",width:`${t.toString()}px`}),"Ft"),Ba=o((t,e)=>({...wr(t),left:`calc(${lu} + ${e.toString()}px)`,position:"sticky",zIndex:2}),"fn"),gr="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",su=o((t,e,n)=>e.enabled&&e.columns.has(n)?void 0:t,"ts"),br="__back__:",au=o(t=>`${br}${t.table}.${t.column}`,"ns"),iu=o(t=>{let e=(0,q.c)(3),{counts:n,rowId:l}=t;if(n===void 0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,p.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,p.jsx)("span",{className:"tabular-nums",children:r}),e[1]=r,e[2]=s):s=e[2],s},"os"),et=o(t=>{for(let e of["id","__id__","_id"]){let n=t[e];if(typeof n=="string"||typeof n=="number")return String(n)}return null},"Pe"),cu=o((t,e)=>{if(e.enumValues!==void 0&&e.enumValues.length>0)return e.enumValues.includes(t)||t===""&&e.nullable===!0?{value:t===""?null:t}:void 0;if(e.type==="boolean")return t==="true"||t==="false"?{value:t==="true"}:void 0;if(e.type==="number"){let n=Number(t);return t.trim()===""||!Number.isFinite(n)?void 0:{value:n}}return{value:t}},"ss"),uu=o((t,e,n)=>{if(n!==void 0&&n.type!=="any")return cu(t,n);let l=La(t,e);return typeof e=="number"&&typeof l!="number"?void 0:{value:l}},"ls"),du=o(({anchor:t,columnIds:e,columnMeta:n,editableColumn:l,rows:r,text:s})=>{let a=s.replaceAll(`\r
3
3
  `,`
4
4
  `).replace(nu,"").split(`