@lunora/studio 1.0.0-alpha.354 → 1.0.0-alpha.355

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 (67) hide show
  1. package/dist/standalone/{chunk-35BGGOWV.js → chunk-2CWGRQ5L.js} +1 -1
  2. package/dist/standalone/{chunk-FST24UXA.js → chunk-2PHY5V5E.js} +1 -1
  3. package/dist/standalone/{chunk-BKH2NALB.js → chunk-3QGR4DC7.js} +1 -1
  4. package/dist/standalone/{chunk-4EDOPHLM.js → chunk-4BNWYVLP.js} +1 -1
  5. package/dist/standalone/{chunk-ZKPRORLI.js → chunk-4SJDWMH3.js} +1 -1
  6. package/dist/standalone/{chunk-BTOOJXUL.js → chunk-5IIX2STA.js} +1 -1
  7. package/dist/standalone/{chunk-V74BXQXC.js → chunk-5KD75VXP.js} +1 -1
  8. package/dist/standalone/{chunk-LYHEBMM6.js → chunk-64S3IDR2.js} +1 -1
  9. package/dist/standalone/{chunk-6GPEHYCG.js → chunk-7DMOBHYC.js} +1 -1
  10. package/dist/standalone/{chunk-TTD7BKB6.js → chunk-7W6WESSS.js} +1 -1
  11. package/dist/standalone/{chunk-QEVFVWGC.js → chunk-AMLIZFTD.js} +1 -1
  12. package/dist/standalone/{chunk-BAGJYLSU.js → chunk-AQJXOPBW.js} +1 -1
  13. package/dist/standalone/{chunk-W6ZKEW5M.js → chunk-AZRUSOAH.js} +1 -1
  14. package/dist/standalone/{chunk-22O2JDWR.js → chunk-BCIFRJ3Q.js} +1 -1
  15. package/dist/standalone/{chunk-HWTX54JM.js → chunk-CDV6T5KM.js} +1 -1
  16. package/dist/standalone/{chunk-X7GSROPX.js → chunk-CHGMDVEQ.js} +1 -1
  17. package/dist/standalone/{chunk-ACNWZIAH.js → chunk-D5LY65EX.js} +1 -1
  18. package/dist/standalone/{chunk-TBDJVYCB.js → chunk-DN3HPAOA.js} +1 -1
  19. package/dist/standalone/{chunk-DTW4E5AB.js → chunk-DUQ7KXNS.js} +1 -1
  20. package/dist/standalone/{chunk-OJG65AG4.js → chunk-E423VRTC.js} +1 -1
  21. package/dist/standalone/{chunk-453GHHZ4.js → chunk-EEPCLLGE.js} +1 -1
  22. package/dist/standalone/{chunk-2DV455PX.js → chunk-ESUUPILO.js} +1 -1
  23. package/dist/standalone/{chunk-T4VAXHRL.js → chunk-F7GMBSJP.js} +1 -1
  24. package/dist/standalone/{chunk-ZM4K2ETZ.js → chunk-FIJVZCBO.js} +1 -1
  25. package/dist/standalone/chunk-FKM35PXF.js +21 -0
  26. package/dist/standalone/{chunk-4QRVJDM4.js → chunk-FXTT2XP3.js} +1 -1
  27. package/dist/standalone/{chunk-UKKZJRJT.js → chunk-GNVWTK4S.js} +1 -1
  28. package/dist/standalone/{chunk-T2QAOXUO.js → chunk-GZX5XABE.js} +1 -1
  29. package/dist/standalone/{chunk-6DYXTEU7.js → chunk-I2PP6Q6F.js} +1 -1
  30. package/dist/standalone/{chunk-W4X4J7BU.js → chunk-ILLDX6LU.js} +1 -1
  31. package/dist/standalone/{chunk-DSTNWB4N.js → chunk-IMF6DJKL.js} +1 -1
  32. package/dist/standalone/{chunk-UCK6ITED.js → chunk-M3KSCNKR.js} +1 -1
  33. package/dist/standalone/{chunk-MKVZXGJQ.js → chunk-MQ3FFFP4.js} +1 -1
  34. package/dist/standalone/{chunk-3MQ477EE.js → chunk-N5FOHLIG.js} +1 -1
  35. package/dist/standalone/{chunk-IRCUXARN.js → chunk-NQX6SAC6.js} +1 -1
  36. package/dist/standalone/{chunk-S5S2YICJ.js → chunk-NXNUGQHB.js} +1 -1
  37. package/dist/standalone/{chunk-C6FNBKCO.js → chunk-O6XMGPGY.js} +1 -1
  38. package/dist/standalone/{chunk-YRQHFMEY.js → chunk-OGKRWT6I.js} +1 -1
  39. package/dist/standalone/{chunk-57ZNR6IA.js → chunk-OKSZWLJX.js} +1 -1
  40. package/dist/standalone/{chunk-SDTHCM5H.js → chunk-OT4KZ6Y6.js} +1 -1
  41. package/dist/standalone/{chunk-BCOOULSO.js → chunk-Q5GY7D5H.js} +1 -1
  42. package/dist/standalone/{chunk-K7FZTYAY.js → chunk-QSNQXPIX.js} +1 -1
  43. package/dist/standalone/{chunk-FNWRS4VQ.js → chunk-R5ACA3OC.js} +1 -1
  44. package/dist/standalone/{chunk-ZLSNET6H.js → chunk-R66XCM3J.js} +1 -1
  45. package/dist/standalone/{chunk-IVQKQBKK.js → chunk-RNHTOEL7.js} +1 -1
  46. package/dist/standalone/{chunk-WIYDA4XT.js → chunk-S6OBDEAQ.js} +1 -1
  47. package/dist/standalone/{chunk-6QBK3Z7A.js → chunk-SL7LF2SO.js} +1 -1
  48. package/dist/standalone/{chunk-FXGYX2V6.js → chunk-SOVH524I.js} +1 -1
  49. package/dist/standalone/{chunk-4UWYDYM5.js → chunk-SPPJFTWE.js} +1 -1
  50. package/dist/standalone/{chunk-RQDSPVVH.js → chunk-SV34MAIK.js} +1 -1
  51. package/dist/standalone/{chunk-HZCLLEWP.js → chunk-TAGWTOFD.js} +1 -1
  52. package/dist/standalone/{chunk-VHMA6YPT.js → chunk-TIQ3NI77.js} +1 -1
  53. package/dist/standalone/{chunk-4CITH2NU.js → chunk-TNII7Q2L.js} +1 -1
  54. package/dist/standalone/{chunk-ANACHJRU.js → chunk-U2YFL6EA.js} +1 -1
  55. package/dist/standalone/{chunk-Q4N3TJPV.js → chunk-UHGLZ5RV.js} +1 -1
  56. package/dist/standalone/{chunk-7EAHHRJR.js → chunk-UWAVY3IF.js} +1 -1
  57. package/dist/standalone/{chunk-S6JFSLBK.js → chunk-VO6GV6F2.js} +1 -1
  58. package/dist/standalone/{chunk-2EMNPL3B.js → chunk-VPG46PCA.js} +1 -1
  59. package/dist/standalone/{chunk-6GRI2HXU.js → chunk-XFTWGZKD.js} +1 -1
  60. package/dist/standalone/{chunk-M2RIGPGL.js → chunk-YHK5UBXI.js} +1 -1
  61. package/dist/standalone/{chunk-RHOQJNDW.js → chunk-YJYXN3WQ.js} +1 -1
  62. package/dist/standalone/{chunk-Y7SN6CTX.js → chunk-Z3NZJ4C2.js} +1 -1
  63. package/dist/standalone/{chunk-SM2IQWCJ.js → chunk-ZXUEBA56.js} +1 -1
  64. package/dist/standalone/{chunk-KNX3KB7E.js → chunk-ZZ5564FZ.js} +1 -1
  65. package/dist/standalone/studio.js +1 -1
  66. package/package.json +5 -5
  67. package/dist/standalone/chunk-OIDFWEJX.js +0 -21
@@ -1 +1 @@
1
- import{a as q}from"./chunk-453GHHZ4.js";import"./chunk-BTOOJXUL.js";import{a as k}from"./chunk-TRZTGE4R.js";import"./chunk-IH2CJZF2.js";import"./chunk-SYGCASPT.js";import"./chunk-ZGSL4DPP.js";import{a as A}from"./chunk-5DNGK3NT.js";import{a as $}from"./chunk-KYONGQQ4.js";import"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import"./chunk-LUHXNZI4.js";import"./chunk-ZTOREMGH.js";import"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import"./chunk-ZBON5T5A.js";import{b as K}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as F}from"./chunk-DSTNWB4N.js";import"./chunk-OSJ7HV7B.js";import"./chunk-6QBK3Z7A.js";import"./chunk-E26OT26O.js";import{a as T}from"./chunk-6UTZXEW3.js";import{c as S}from"./chunk-ZKPRORLI.js";import"./chunk-OIDFWEJX.js";import"./chunk-WZTY3ZYI.js";import{a as O}from"./chunk-3Y5K3IQO.js";import{a as j,e as w}from"./chunk-MD67S53Z.js";import{f as I,w as E}from"./chunk-LPINY2IJ.js";import{a as p,d as C,f as D,g as H}from"./chunk-OXFKZ4BM.js";var M=C(D(),1);var m=C(H(),1);var L=p(s=>s.length===0?void 0:{max:Math.max(...s),mean:s.reduce((e,t)=>e+t,0)/s.length,min:Math.min(...s)},"F"),B=/^gen_ai\.evaluation\.(.+)\.score$/u,P=p(s=>{let e=[];for(let t of s)for(let n of t.spans)for(let[a,l]of Object.entries(n.attributes??{})){let o=B.exec(a);if(!o||typeof l!="number")continue;let i=o[1],c=n.attributes?.[`gen_ai.evaluation.${i}.label`];e.push({...typeof c=="string"?{label:c}:{},name:i,score:l,spanName:n.name,startTs:t.startTs+n.offsetMs,traceId:t.traceId})}return e.toSorted((t,n)=>n.startTs-t.startTs)},"q"),Q=p(s=>{let e=[];for(let t of s?.series??[]){let n=B.exec(t.name);n&&e.push({name:n[1],points:t.points})}return e},"D"),R=p((s,e)=>{let t=new Set([...s.map(a=>a.name),...e.map(a=>a.name)]),n=[];for(let a of t){let l=s.filter(r=>r.name===a),o=e.find(r=>r.name===a)?.points??[],i=o.at(-1)?.last??l[0]?.score,c=o.length>0?{max:Math.max(...o.map(r=>r.max)),mean:o.reduce((r,d)=>r+d.sum,0)/o.reduce((r,d)=>r+d.count,0),min:Math.min(...o.map(r=>r.min))}:L(l.map(r=>r.score));n.push({...i===void 0?{}:{latest:i},...c,name:a,points:o,runs:l})}return n.toSorted((a,l)=>a.name.localeCompare(l.name))},"H"),U=p(s=>Array.isArray(s?.traces)?s.traces:[],"L"),N=p(s=>s===void 0?"\u2014":s.toFixed(2),"y"),z=p(s=>{let e=(0,M.c)(34),{card:t,onOpenTrace:n}=s,a=I(),l;e[0]!==t.name?(l=(0,m.jsx)("h3",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"ev-name",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let o;e[2]!==t.latest?(o=N(t.latest),e[2]=t.latest,e[3]=o):o=e[3];let i;e[4]!==o?(i=(0,m.jsx)("span",{className:"font-mono text-lg text-foreground","data-testid":"ev-latest",children:o}),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==l||e[7]!==i?(c=(0,m.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=c):c=e[8];let r;e[9]!==t.max||e[10]!==t.mean||e[11]!==t.min||e[12]!==a?(r=a("min {min} \xB7 mean {mean} \xB7 max {max}",{max:N(t.max),mean:N(t.mean),min:N(t.min)}),e[9]=t.max,e[10]=t.mean,e[11]=t.min,e[12]=a,e[13]=r):r=e[13];let d;e[14]!==r?(d=(0,m.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"ev-summary",children:r}),e[14]=r,e[15]=d):d=e[15];let u;e[16]!==t.name||e[17]!==t.points||e[18]!==a?(u=t.points.length>1?(0,m.jsx)(q,{ariaLabel:a("Score trend for {name}",{name:t.name}),className:"h-10 w-full",series:t.points.map(G),testId:"ev-trend"}):(0,m.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ev-no-trend",children:a("No durable history yet \u2014 pass ctx.metrics to recordEvaluation to chart a trend.")}),e[16]=t.name,e[17]=t.points,e[18]=a,e[19]=u):u=e[19];let h;if(e[20]!==t.runs||e[21]!==n||e[22]!==a){let v;e[24]!==n||e[25]!==a?(v=p(f=>(0,m.jsxs)("div",{className:"flex items-center justify-between gap-2 font-mono text-xs","data-testid":"ev-run",children:[(0,m.jsxs)("span",{className:"truncate text-muted-foreground",children:[E(f.startTs)," \xB7 ",f.spanName]}),(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[f.label===void 0?null:(0,m.jsx)(K,{variant:"outline",children:f.label}),(0,m.jsx)("span",{className:"text-foreground",children:N(f.score)}),n===void 0?null:(0,m.jsx)("button",{className:"text-muted-foreground underline-offset-2 hover:underline",onClick:p(()=>{n(f.traceId)},"onClick"),title:a("Open the trace {trace}",{trace:f.traceId}),type:"button",children:f.traceId.slice(0,8)})]})]},`${f.traceId}:${f.spanName}`),"x"),e[24]=n,e[25]=a,e[26]=v):v=e[26],h=t.runs.slice(0,5).map(v),e[20]=t.runs,e[21]=n,e[22]=a,e[23]=h}else h=e[23];let x;e[27]!==h?(x=(0,m.jsx)("div",{className:"flex flex-col gap-1",children:h}),e[27]=h,e[28]=x):x=e[28];let g;return e[29]!==c||e[30]!==d||e[31]!==u||e[32]!==x?(g=(0,m.jsx)(j,{"data-testid":"ev-card",children:(0,m.jsxs)(w,{className:"flex flex-col gap-3 p-4",children:[c,d,u,x]})}),e[29]=c,e[30]=d,e[31]=u,e[32]=x,e[33]=g):g=e[33],g},"P"),oe=p(s=>{let e=(0,M.c)(19),{initialShardKey:t}=s,n=I(),{queryShardKey:a,setShardKey:l,shardKey:o}=A(t),i=k(a),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let r;e[1]!==a?(r={live:!0,shardKey:a},e[1]=a,e[2]=r):r=e[2];let{data:d,error:u}=S(T.getTraces,c,r),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let x;e[4]!==a?(x={live:!0,shardKey:a},e[4]=a,e[5]=x):x=e[5];let{data:g}=S(T.getMetricHistory,h,x),v;if(e[6]!==d||e[7]!==u||e[8]!==g||e[9]!==i||e[10]!==l||e[11]!==o||e[12]!==n){let f=R(P(U(d)),Q(g)),y;e[14]!==l||e[15]!==o?(y=(0,m.jsx)($,{onChange:l,testId:"ev-shard-input",value:o}),e[14]=l,e[15]=o,e[16]=y):y=e[16];let b;e[17]!==u?(b=u===null?null:(0,m.jsx)(F,{error:u,testId:"ev-error"}),e[17]=u,e[18]=b):b=e[18],v=(0,m.jsxs)("section",{className:"flex flex-col gap-4","data-testid":"ev-panel",children:[y,b,f.length===0?(0,m.jsx)(O,{description:n("Call recordEvaluation from a graded run and its score shows up here."),testId:"ev-empty",title:n("No evals recorded")}):(0,m.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:f.map(_=>(0,m.jsx)(z,{card:_,onOpenTrace:i},_.name))})]}),e[6]=d,e[7]=u,e[8]=g,e[9]=i,e[10]=l,e[11]=o,e[12]=n,e[13]=v}else v=e[13];return v},"re");function G(s){return s.last}p(G,"Q");export{oe as default};
1
+ import{a as q}from"./chunk-EEPCLLGE.js";import"./chunk-5IIX2STA.js";import{a as k}from"./chunk-TRZTGE4R.js";import"./chunk-IH2CJZF2.js";import"./chunk-SYGCASPT.js";import"./chunk-ZGSL4DPP.js";import{a as A}from"./chunk-5DNGK3NT.js";import{a as $}from"./chunk-KYONGQQ4.js";import"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import"./chunk-LUHXNZI4.js";import"./chunk-ZTOREMGH.js";import"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import"./chunk-ZBON5T5A.js";import{b as K}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as F}from"./chunk-IMF6DJKL.js";import"./chunk-OSJ7HV7B.js";import"./chunk-SL7LF2SO.js";import"./chunk-E26OT26O.js";import{a as T}from"./chunk-6UTZXEW3.js";import{c as S}from"./chunk-4SJDWMH3.js";import"./chunk-FKM35PXF.js";import"./chunk-WZTY3ZYI.js";import{a as O}from"./chunk-3Y5K3IQO.js";import{a as j,e as w}from"./chunk-MD67S53Z.js";import{f as I,w as E}from"./chunk-LPINY2IJ.js";import{a as p,d as C,f as D,g as H}from"./chunk-OXFKZ4BM.js";var M=C(D(),1);var m=C(H(),1);var L=p(s=>s.length===0?void 0:{max:Math.max(...s),mean:s.reduce((e,t)=>e+t,0)/s.length,min:Math.min(...s)},"F"),B=/^gen_ai\.evaluation\.(.+)\.score$/u,P=p(s=>{let e=[];for(let t of s)for(let n of t.spans)for(let[a,l]of Object.entries(n.attributes??{})){let o=B.exec(a);if(!o||typeof l!="number")continue;let i=o[1],c=n.attributes?.[`gen_ai.evaluation.${i}.label`];e.push({...typeof c=="string"?{label:c}:{},name:i,score:l,spanName:n.name,startTs:t.startTs+n.offsetMs,traceId:t.traceId})}return e.toSorted((t,n)=>n.startTs-t.startTs)},"q"),Q=p(s=>{let e=[];for(let t of s?.series??[]){let n=B.exec(t.name);n&&e.push({name:n[1],points:t.points})}return e},"D"),R=p((s,e)=>{let t=new Set([...s.map(a=>a.name),...e.map(a=>a.name)]),n=[];for(let a of t){let l=s.filter(r=>r.name===a),o=e.find(r=>r.name===a)?.points??[],i=o.at(-1)?.last??l[0]?.score,c=o.length>0?{max:Math.max(...o.map(r=>r.max)),mean:o.reduce((r,d)=>r+d.sum,0)/o.reduce((r,d)=>r+d.count,0),min:Math.min(...o.map(r=>r.min))}:L(l.map(r=>r.score));n.push({...i===void 0?{}:{latest:i},...c,name:a,points:o,runs:l})}return n.toSorted((a,l)=>a.name.localeCompare(l.name))},"H"),U=p(s=>Array.isArray(s?.traces)?s.traces:[],"L"),N=p(s=>s===void 0?"\u2014":s.toFixed(2),"y"),z=p(s=>{let e=(0,M.c)(34),{card:t,onOpenTrace:n}=s,a=I(),l;e[0]!==t.name?(l=(0,m.jsx)("h3",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"ev-name",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let o;e[2]!==t.latest?(o=N(t.latest),e[2]=t.latest,e[3]=o):o=e[3];let i;e[4]!==o?(i=(0,m.jsx)("span",{className:"font-mono text-lg text-foreground","data-testid":"ev-latest",children:o}),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==l||e[7]!==i?(c=(0,m.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=c):c=e[8];let r;e[9]!==t.max||e[10]!==t.mean||e[11]!==t.min||e[12]!==a?(r=a("min {min} \xB7 mean {mean} \xB7 max {max}",{max:N(t.max),mean:N(t.mean),min:N(t.min)}),e[9]=t.max,e[10]=t.mean,e[11]=t.min,e[12]=a,e[13]=r):r=e[13];let d;e[14]!==r?(d=(0,m.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"ev-summary",children:r}),e[14]=r,e[15]=d):d=e[15];let u;e[16]!==t.name||e[17]!==t.points||e[18]!==a?(u=t.points.length>1?(0,m.jsx)(q,{ariaLabel:a("Score trend for {name}",{name:t.name}),className:"h-10 w-full",series:t.points.map(G),testId:"ev-trend"}):(0,m.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ev-no-trend",children:a("No durable history yet \u2014 pass ctx.metrics to recordEvaluation to chart a trend.")}),e[16]=t.name,e[17]=t.points,e[18]=a,e[19]=u):u=e[19];let h;if(e[20]!==t.runs||e[21]!==n||e[22]!==a){let v;e[24]!==n||e[25]!==a?(v=p(f=>(0,m.jsxs)("div",{className:"flex items-center justify-between gap-2 font-mono text-xs","data-testid":"ev-run",children:[(0,m.jsxs)("span",{className:"truncate text-muted-foreground",children:[E(f.startTs)," \xB7 ",f.spanName]}),(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[f.label===void 0?null:(0,m.jsx)(K,{variant:"outline",children:f.label}),(0,m.jsx)("span",{className:"text-foreground",children:N(f.score)}),n===void 0?null:(0,m.jsx)("button",{className:"text-muted-foreground underline-offset-2 hover:underline",onClick:p(()=>{n(f.traceId)},"onClick"),title:a("Open the trace {trace}",{trace:f.traceId}),type:"button",children:f.traceId.slice(0,8)})]})]},`${f.traceId}:${f.spanName}`),"x"),e[24]=n,e[25]=a,e[26]=v):v=e[26],h=t.runs.slice(0,5).map(v),e[20]=t.runs,e[21]=n,e[22]=a,e[23]=h}else h=e[23];let x;e[27]!==h?(x=(0,m.jsx)("div",{className:"flex flex-col gap-1",children:h}),e[27]=h,e[28]=x):x=e[28];let g;return e[29]!==c||e[30]!==d||e[31]!==u||e[32]!==x?(g=(0,m.jsx)(j,{"data-testid":"ev-card",children:(0,m.jsxs)(w,{className:"flex flex-col gap-3 p-4",children:[c,d,u,x]})}),e[29]=c,e[30]=d,e[31]=u,e[32]=x,e[33]=g):g=e[33],g},"P"),oe=p(s=>{let e=(0,M.c)(19),{initialShardKey:t}=s,n=I(),{queryShardKey:a,setShardKey:l,shardKey:o}=A(t),i=k(a),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let r;e[1]!==a?(r={live:!0,shardKey:a},e[1]=a,e[2]=r):r=e[2];let{data:d,error:u}=S(T.getTraces,c,r),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let x;e[4]!==a?(x={live:!0,shardKey:a},e[4]=a,e[5]=x):x=e[5];let{data:g}=S(T.getMetricHistory,h,x),v;if(e[6]!==d||e[7]!==u||e[8]!==g||e[9]!==i||e[10]!==l||e[11]!==o||e[12]!==n){let f=R(P(U(d)),Q(g)),y;e[14]!==l||e[15]!==o?(y=(0,m.jsx)($,{onChange:l,testId:"ev-shard-input",value:o}),e[14]=l,e[15]=o,e[16]=y):y=e[16];let b;e[17]!==u?(b=u===null?null:(0,m.jsx)(F,{error:u,testId:"ev-error"}),e[17]=u,e[18]=b):b=e[18],v=(0,m.jsxs)("section",{className:"flex flex-col gap-4","data-testid":"ev-panel",children:[y,b,f.length===0?(0,m.jsx)(O,{description:n("Call recordEvaluation from a graded run and its score shows up here."),testId:"ev-empty",title:n("No evals recorded")}):(0,m.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:f.map(_=>(0,m.jsx)(z,{card:_,onOpenTrace:i},_.name))})]}),e[6]=d,e[7]=u,e[8]=g,e[9]=i,e[10]=l,e[11]=o,e[12]=n,e[13]=v}else v=e[13];return v},"re");function G(s){return s.last}p(G,"Q");export{oe as default};
@@ -1 +1 @@
1
- import{a as Ze}from"./chunk-YJWR6ZWC.js";import{a as qe}from"./chunk-DTW4E5AB.js";import{a as Ke}from"./chunk-4IEMXFUB.js";import{a as He}from"./chunk-NMVFSJM7.js";import{a as L}from"./chunk-OUFWXYEF.js";import{a as Je}from"./chunk-LKCO3E2B.js";import"./chunk-HKPDPKXD.js";import{a as We}from"./chunk-W4X4J7BU.js";import{a as Xe}from"./chunk-6QEXGYWH.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import{i as T}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as _}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as D}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{b as De}from"./chunk-ZKPRORLI.js";import{p as Z}from"./chunk-OIDFWEJX.js";import"./chunk-WZTY3ZYI.js";import{a as Ve}from"./chunk-3Y5K3IQO.js";import{a as ze,b as _e,c as Pe,d as q,e as U,f as z}from"./chunk-CW57Q264.js";import{a as J,e as K}from"./chunk-MD67S53Z.js";import{f as Q,j as Ee,r as Ue,s as X,u as Qe,w as te}from"./chunk-LPINY2IJ.js";import{a as s,d as Me,e as at,f as lt,g as nt}from"./chunk-OXFKZ4BM.js";var C=Me(at(),1);var W=Me(lt(),1);var t=Me(nt(),1);var it=s(()=>{let h=(0,W.c)(3),{config:e,ready:n}=qe(),l;return h[0]!==e.capabilities||h[1]!==n?(l={capabilities:e.capabilities,ready:n},h[0]=e.capabilities,h[1]=n,h[2]=l):l=h[2],l},"nt"),st=s((h,e)=>typeof h.acceptedAt=="number"?"spent":typeof h.expiresAt=="number"&&h.expiresAt<=e?"expired":"pending","lt"),et=500,rt=s((h,e)=>{if(!URL.canParse(h.trim()))return null;let n=new URL(h.trim());return n.searchParams.set("email",e.email),n.searchParams.set("invite",e.token),n.toString()},"at"),dt=s(h=>{let e=(0,W.c)(34),{issued:n,onSignUpPageChange:l,signUpPage:o}=h,a=Q(),[p,i]=(0,C.useState)(null),u;e[0]!==n||e[1]!==o?(u=rt(o,n),e[0]=n,e[1]=o,e[2]=u):u=e[2];let c=u,y;e[3]!==c?(y=s(()=>{let $="navigator"in globalThis?globalThis.navigator.clipboard:void 0;c===null||$===void 0||X($.writeText(c).then(()=>(i(c),!0)))},"y"),e[3]=c,e[4]=y):y=e[4];let w=y,g;e[5]!==a?(g=a("Send this link to the invitee. It is shown once and cannot be recovered."),e[5]=a,e[6]=g):g=e[6];let I;e[7]!==g?(I=(0,t.jsx)("p",{className:"text-sm",children:g}),e[7]=g,e[8]=I):I=e[8];let k=c===null,v;e[9]!==a?(v=a("Your app's sign-up page"),e[9]=a,e[10]=v):v=e[10];let d;e[11]!==l?(d=s($=>{l($.target.value)},"r"),e[11]=l,e[12]=d):d=e[12];let m;e[13]!==o||e[14]!==k||e[15]!==v||e[16]!==d?(m=(0,t.jsx)(T,{"aria-invalid":k,"aria-label":v,"data-testid":"sign-up-invitation-page",onChange:d,value:o}),e[13]=o,e[14]=k,e[15]=v,e[16]=d,e[17]=m):m=e[17];let b=c??"",x;e[18]!==b?(x=(0,t.jsx)(T,{"data-testid":"sign-up-invitation-link",readOnly:!0,value:b}),e[18]=b,e[19]=x):x=e[19];let N;e[20]!==p||e[21]!==c||e[22]!==a?(N=a(p!==null&&p===c?"Copied":"Copy"),e[20]=p,e[21]=c,e[22]=a,e[23]=N):N=e[23];let f;e[24]!==w||e[25]!==N?(f=(0,t.jsx)(_,{"data-testid":"sign-up-invitation-copy",onClick:w,type:"button",children:N}),e[24]=w,e[25]=N,e[26]=f):f=e[26];let r;e[27]!==x||e[28]!==f?(r=(0,t.jsxs)("div",{className:"flex gap-2",children:[x,f]}),e[27]=x,e[28]=f,e[29]=r):r=e[29];let A;return e[30]!==r||e[31]!==I||e[32]!==m?(A=(0,t.jsx)(J,{children:(0,t.jsxs)(K,{className:"flex flex-col gap-2 p-4",children:[I,m,r]})}),e[30]=r,e[31]=I,e[32]=m,e[33]=A):A=e[33],A},"it"),ot=s(()=>{let h=Z(),e=Q(),[n,l]=(0,C.useState)(""),[o,a]=(0,C.useState)(null),[p,i]=(0,C.useState)(null),[u,c]=(0,C.useState)(()=>`${Qe(h.url)}/sign-up`),y=De(["lunora-auth-sign-up-invitations",et],()=>h.listAuthSignUpInvitations({limit:et})),w=y.data?.rows??null,g=y.data?.total??0,I=s(()=>{let v=n.trim();v!==""&&(a(null),X((async()=>{try{let d=await h.createAuthSignUpInvitation({email:v}),m=typeof d.token=="string"?d.token:void 0;i(m===void 0?null:{email:v,token:m}),l(""),y.refetch()}catch(d){a(d instanceof Error?d.message:String(d))}})()))},"w"),k=s(v=>{a(null),X((async()=>{try{await h.revokeAuthSignUpInvitation({email:v}),y.refetch()}catch(d){a(d instanceof Error?d.message:String(d))}})())},"k");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"sign-up-invitations",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-base font-medium",children:e("Sign-up invitations")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("Only invited addresses can create an account. Nothing is emailed \u2014 send the invitee the one-time link yourself.")})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(T,{"aria-label":e("Email address to invite"),"data-testid":"sign-up-invitation-email",onChange:s(v=>{l(v.target.value)},"onChange"),placeholder:e("ada@example.com"),type:"email",value:n}),(0,t.jsx)(_,{"data-testid":"sign-up-invitation-submit",onClick:I,type:"button",children:e("Invite")})]}),p!==null&&(0,t.jsx)(dt,{issued:p,onSignUpPageChange:c,signUpPage:u},p.token),(o??y.error)!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sign-up-invitations-error",role:"alert",children:o??y.error}),w!==null&&w.length===0&&(0,t.jsx)(Ve,{testId:"sign-up-invitations-empty",title:e("Nobody has been invited yet.")}),w!==null&&g>w.length&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sign-up-invitations-truncated",children:e("Showing the most recent invitations. Query the signUpInvitation table directly to see the rest.")}),w!==null&&w.length>0&&(0,t.jsx)(J,{children:(0,t.jsx)(K,{className:"p-0",children:(0,t.jsxs)(ze,{children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:e("Email")}),(0,t.jsx)(U,{children:e("Status")}),(0,t.jsx)(U,{children:e("Expires")}),(0,t.jsx)(U,{children:e("Invited by")}),(0,t.jsx)(U,{})]})}),(0,t.jsx)(Pe,{children:w.map(v=>{let d=st(v,Date.now()),m=v.email??"";return(0,t.jsxs)(q,{"data-testid":`sign-up-invitation-${m}`,children:[(0,t.jsx)(z,{children:m}),(0,t.jsxs)(z,{"data-testid":`sign-up-invitation-status-${m}`,children:[d==="spent"&&e("Accepted"),d==="expired"&&e("Expired"),d==="pending"&&e("Pending")]}),(0,t.jsx)(z,{children:typeof v.expiresAt=="number"?te(v.expiresAt):"\u2014"}),(0,t.jsx)(z,{children:v.invitedBy??"\u2014"}),(0,t.jsx)(z,{className:"text-right",children:(0,t.jsx)(_,{onClick:s(()=>{k(m)},"onClick"),type:"button",variant:"ghost",children:e("Revoke")})})]},v.id)})})]})})})]})},"rt"),ct={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},ut=s((h,e)=>h.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:h.type!=="number"||!Number.isNaN(Number(e.trim())),"dt"),mt=s((h,e)=>{if(h.type==="boolean")return e===!0?{value:!0}:h.required?{value:!1}:void 0;let n=typeof e=="string"?e.trim():"";if(n!==""){if(h.type==="number"){let l=Number(n);return Number.isNaN(l)?void 0:{value:l}}return{value:n}}},"ct"),ht=s(h=>{let e=(0,W.c)(105),{onClose:n,onCreated:l}=h,o=Z(),a=Q(),{config:p}=qe(),{busy:i,error:u,run:c}=Ke(),[y,w]=(0,C.useState)(""),[g,I]=(0,C.useState)(""),[k,v]=(0,C.useState)(""),[d,m]=(0,C.useState)(""),b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];let[x,N]=(0,C.useState)(b),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=s(S=>{w(S.target.value)},"p"),e[1]=f):f=e[1];let r=f,A;e[2]===Symbol.for("react.memo_cache_sentinel")?(A=s(S=>{I(S.target.value)},"S"),e[2]=A):A=e[2];let $=A,j;e[3]===Symbol.for("react.memo_cache_sentinel")?(j=s(S=>{v(S.target.value)},"z"),e[3]=j):j=e[3];let H=j,M;e[4]===Symbol.for("react.memo_cache_sentinel")?(M=s(S=>{m(S.target.value)},"M"),e[4]=M):M=e[4];let Y=M,B;e[5]===Symbol.for("react.memo_cache_sentinel")?(B=s((S,R)=>{N(ee=>({...ee,[S]:R}))},"L"),e[5]=B):B=e[5];let V=B,G;e[6]!==x?(G=s(S=>x[S.name]??(S.type==="boolean"?!1:""),"Y"),e[6]=x,e[7]=G):G=e[7];let P=G,O;if(e[8]!==p.userFields||e[9]!==P){let S;e[11]!==P?(S=s(R=>!R.required||ut(R,P(R)),"A"),e[11]=P,e[12]=S):S=e[12],O=p.userFields.every(S),e[8]=p.userFields,e[9]=P,e[10]=O}else O=e[10];let F=O,E;e[13]!==i||e[14]!==y||e[15]!==g||e[16]!==F?(E=!i&&y.trim()!==""&&g.trim()!==""&&F,e[13]=i,e[14]=y,e[15]=g,e[16]=F,e[17]=E):E=e[17];let $e=E,ae;e[18]!==p.userFields||e[19]!==P?(ae=s(()=>{let S={};for(let R of p.userFields){let ee=mt(R,P(R));ee!==void 0&&(S[R.name]=ee.value)}return Object.keys(S).length===0?void 0:S},"te"),e[18]=p.userFields,e[19]=P,e[20]=ae):ae=e[20];let je=ae,Re;e[21]!==je||e[22]!==o||e[23]!==y||e[24]!==g||e[25]!==n||e[26]!==l||e[27]!==k||e[28]!==d||e[29]!==c?(Re=s(()=>{c(async()=>{await o.createAuthUser({data:je(),email:y.trim(),name:g.trim(),password:k===""?void 0:k,role:d.trim()===""?void 0:d.trim()}),l(),n()})},"De"),e[21]=je,e[22]=o,e[23]=y,e[24]=g,e[25]=n,e[26]=l,e[27]=k,e[28]=d,e[29]=c,e[30]=Re):Re=e[30];let Be=Re,le;e[31]!==a?(le=a("Create user"),e[31]=a,e[32]=le):le=e[32];let ne;e[33]!==a?(ne=a("Create user"),e[33]=a,e[34]=ne):ne=e[34];let ie;e[35]!==ne?(ie=(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:ne}),e[35]=ne,e[36]=ie):ie=e[36];let se;e[37]!==a?(se=a("email"),e[37]=a,e[38]=se):se=e[38];let re;e[39]!==se?(re=(0,t.jsx)(L,{htmlFor:"uc-email",children:se}),e[39]=se,e[40]=re):re=e[40];let de;e[41]!==y?(de=(0,t.jsx)(T,{"data-testid":"uc-email",id:"uc-email",onChange:r,type:"email",value:y}),e[41]=y,e[42]=de):de=e[42];let oe;e[43]!==re||e[44]!==de?(oe=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[re,de]}),e[43]=re,e[44]=de,e[45]=oe):oe=e[45];let ce;e[46]!==a?(ce=a("name"),e[46]=a,e[47]=ce):ce=e[47];let ue;e[48]!==ce?(ue=(0,t.jsx)(L,{htmlFor:"uc-name",children:ce}),e[48]=ce,e[49]=ue):ue=e[49];let me;e[50]!==g?(me=(0,t.jsx)(T,{"data-testid":"uc-name",id:"uc-name",onChange:$,value:g}),e[50]=g,e[51]=me):me=e[51];let he;e[52]!==ue||e[53]!==me?(he=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[ue,me]}),e[52]=ue,e[53]=me,e[54]=he):he=e[54];let pe;e[55]!==a?(pe=a("Password (optional)"),e[55]=a,e[56]=pe):pe=e[56];let fe;e[57]!==pe?(fe=(0,t.jsx)(L,{htmlFor:"uc-password",children:pe}),e[57]=pe,e[58]=fe):fe=e[58];let ve;e[59]!==k?(ve=(0,t.jsx)(T,{"data-testid":"uc-password",id:"uc-password",onChange:H,type:"password",value:k}),e[59]=k,e[60]=ve):ve=e[60];let ge;e[61]!==fe||e[62]!==ve?(ge=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[fe,ve]}),e[61]=fe,e[62]=ve,e[63]=ge):ge=e[63];let be;e[64]!==a?(be=a("Role (optional)"),e[64]=a,e[65]=be):be=e[65];let xe;e[66]!==be?(xe=(0,t.jsx)(L,{htmlFor:"uc-role",children:be}),e[66]=be,e[67]=xe):xe=e[67];let ye;e[68]!==d?(ye=(0,t.jsx)(T,{"data-testid":"uc-role",id:"uc-role",onChange:Y,value:d}),e[68]=d,e[69]=ye):ye=e[69];let Ne;e[70]!==xe||e[71]!==ye?(Ne=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[xe,ye]}),e[70]=xe,e[71]=ye,e[72]=Ne):Ne=e[72];let ke;e[73]!==p.userFields||e[74]!==P||e[75]!==a?(ke=p.userFields.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Plugin fields")}),p.userFields.map(S=>{let R=`uc-field-${S.name}`,ee=S.required?"":` (${a("optional")})`;if(S.type==="boolean"){let Le=P(S)===!0;return(0,t.jsxs)("label",{className:"flex items-center gap-2",htmlFor:R,children:[(0,t.jsx)(Ze,{checked:Le,"data-testid":R,id:R,onCheckedChange:s(tt=>{V(S.name,tt)},"onCheckedChange")}),(0,t.jsxs)("span",{className:"text-sm",children:[S.name,ee]})]},S.name)}let Ge=P(S);return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)(L,{htmlFor:R,children:[S.name,ee]}),(0,t.jsx)(T,{"data-testid":R,id:R,onChange:s(Le=>{V(S.name,Le.target.value)},"onChange"),type:ct[S.type],value:typeof Ge=="string"?Ge:""})]},S.name)})]}),e[73]=p.userFields,e[74]=P,e[75]=a,e[76]=ke):ke=e[76];let we;e[77]!==u?(we=u!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:u}),e[77]=u,e[78]=we):we=e[78];let Ce;e[79]!==a?(Ce=a("Cancel"),e[79]=a,e[80]=Ce):Ce=e[80];let Ie;e[81]!==n||e[82]!==Ce?(Ie=(0,t.jsx)(_,{"data-testid":"uc-cancel",onClick:n,size:"sm",type:"button",variant:"outline",children:Ce}),e[81]=n,e[82]=Ce,e[83]=Ie):Ie=e[83];let Oe=!$e,Se;e[84]!==i||e[85]!==a?(Se=a(i?"Creating\u2026":"Create"),e[84]=i,e[85]=a,e[86]=Se):Se=e[86];let Ae;e[87]!==Be||e[88]!==Oe||e[89]!==Se?(Ae=(0,t.jsx)(_,{"data-testid":"uc-submit",disabled:Oe,onClick:Be,size:"sm",type:"button",children:Se}),e[87]=Be,e[88]=Oe,e[89]=Se,e[90]=Ae):Ae=e[90];let Fe;e[91]!==Ie||e[92]!==Ae?(Fe=(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[Ie,Ae]}),e[91]=Ie,e[92]=Ae,e[93]=Fe):Fe=e[93];let Te;return e[94]!==n||e[95]!==le||e[96]!==ie||e[97]!==oe||e[98]!==he||e[99]!==ge||e[100]!==Ne||e[101]!==ke||e[102]!==we||e[103]!==Fe?(Te=(0,t.jsxs)(He,{label:le,onClose:n,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[ie,oe,he,ge,Ne,ke,we,Fe]}),e[94]=n,e[95]=le,e[96]=ie,e[97]=oe,e[98]=he,e[99]=ge,e[100]=Ne,e[101]=ke,e[102]=we,e[103]=Fe,e[104]=Te):Te=e[104],Te},"ut"),Ye=s(h=>{let e=(0,W.c)(2),{children:n}=h,l;return e[0]!==n?(l=(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n}),e[0]=n,e[1]=l):l=e[1],l},"_e"),pt=s(h=>{let e=(0,W.c)(29),{busy:n,runAction:l,userId:o,version:a}=h,p=Z(),i=Q(),[u,c]=(0,C.useState)(null),[y,w]=(0,C.useState)(null),g;e[0]!==p||e[1]!==o?(g=s(()=>{X((async()=>{w(null);try{let r=await p.listAuthSessions({limit:50,userId:o});c(r.rows)}catch(r){let A=r;c(null),w(Ee(A))}})())},"g"),e[0]=p,e[1]=o,e[2]=g):g=e[2];let I;e[3]!==p||e[4]!==o||e[5]!==a?(I=[p,o,a],e[3]=p,e[4]=o,e[5]=a,e[6]=I):I=e[6],(0,C.useEffect)(g,I);let k;e[7]!==p||e[8]!==l?(k=s(r=>{l(()=>p.revokeAuthSession({sessionId:r}))},"k"),e[7]=p,e[8]=l,e[9]=k):k=e[9];let v=k,d;e[10]!==i?(d=i("Sessions"),e[10]=i,e[11]=d):d=e[11];let m;e[12]!==d?(m=(0,t.jsx)(Ye,{children:d}),e[12]=d,e[13]=m):m=e[13];let b;e[14]!==y?(b=y!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:y}),e[14]=y,e[15]=b):b=e[15];let x;e[16]!==u||e[17]!==i?(x=u!==null&&u.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:i("No active sessions.")}),e[16]=u,e[17]=i,e[18]=x):x=e[18];let N;e[19]!==n||e[20]!==v||e[21]!==u||e[22]!==i?(N=u!==null&&u.length>0&&(0,t.jsx)(J,{className:"overflow-hidden py-0",children:(0,t.jsx)(K,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"ud-sessions-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:i("expires")}),(0,t.jsx)(U,{children:i("ip")}),(0,t.jsx)(U,{children:i("user agent")}),(0,t.jsx)(U,{"aria-label":i("Actions")})]})}),(0,t.jsx)(Pe,{children:u.map(r=>(0,t.jsxs)(q,{"data-testid":`ud-session-${r.id}`,children:[(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:te(r.expiresAt)}),(0,t.jsx)(z,{children:r.ipAddress??""}),(0,t.jsx)(z,{className:"max-w-40 truncate",children:r.userAgent??""}),(0,t.jsx)(z,{children:(0,t.jsx)(_,{"data-testid":`ud-revoke-${r.id}`,disabled:n,onClick:s(()=>{v(r.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Revoke")})})]},r.id))})]})})}),e[19]=n,e[20]=v,e[21]=u,e[22]=i,e[23]=N):N=e[23];let f;return e[24]!==m||e[25]!==b||e[26]!==x||e[27]!==N?(f=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[m,b,x,N]}),e[24]=m,e[25]=b,e[26]=x,e[27]=N,e[28]=f):f=e[28],f},"mt"),ft=s(h=>{let e=(0,W.c)(30),{busy:n,runAction:l,userId:o,version:a}=h,p=Z(),i=Q(),[u,c]=(0,C.useState)(null),[y,w]=(0,C.useState)(null),g;e[0]!==p||e[1]!==o?(g=s(()=>{X((async()=>{w(null);try{c(await p.listAuthAccounts({userId:o}))}catch(r){let A=r;c(null),w(Ee(A))}})())},"g"),e[0]=p,e[1]=o,e[2]=g):g=e[2];let I;e[3]!==p||e[4]!==o||e[5]!==a?(I=[p,o,a],e[3]=p,e[4]=o,e[5]=a,e[6]=I):I=e[6],(0,C.useEffect)(g,I);let k;e[7]!==p||e[8]!==l||e[9]!==o?(k=s(r=>{l(()=>p.unlinkAuthAccount({accountId:r,userId:o}))},"k"),e[7]=p,e[8]=l,e[9]=o,e[10]=k):k=e[10];let v=k,d;e[11]!==i?(d=i("Linked accounts"),e[11]=i,e[12]=d):d=e[12];let m;e[13]!==d?(m=(0,t.jsx)(Ye,{children:d}),e[13]=d,e[14]=m):m=e[14];let b;e[15]!==y?(b=y!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:y}),e[15]=y,e[16]=b):b=e[16];let x;e[17]!==u||e[18]!==i?(x=u!==null&&u.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i("No linked accounts.")}),e[17]=u,e[18]=i,e[19]=x):x=e[19];let N;e[20]!==u||e[21]!==n||e[22]!==v||e[23]!==i?(N=u!==null&&u.length>0&&(0,t.jsx)(J,{className:"overflow-hidden py-0",children:(0,t.jsx)(K,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"ud-accounts-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:i("provider")}),(0,t.jsx)(U,{children:i("created")}),(0,t.jsx)(U,{"aria-label":i("Actions")})]})}),(0,t.jsx)(Pe,{children:u.map(r=>{let A=Ue(r.id);return(0,t.jsxs)(q,{"data-testid":`ud-account-${A}`,children:[(0,t.jsx)(z,{children:Ue(r.providerId)}),(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:te(r.createdAt)}),(0,t.jsx)(z,{children:(0,t.jsx)(_,{"data-testid":`ud-unlink-${A}`,disabled:n,onClick:s(()=>{v(A)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Unlink")})})]},A)})})]})})}),e[20]=u,e[21]=n,e[22]=v,e[23]=i,e[24]=N):N=e[24];let f;return e[25]!==m||e[26]!==b||e[27]!==x||e[28]!==N?(f=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[m,b,x,N]}),e[25]=m,e[26]=b,e[27]=x,e[28]=N,e[29]=f):f=e[29],f},"ht"),vt=s(h=>{let e=(0,W.c)(40),{busy:n,capabilities:l,runAction:o,userId:a,version:p}=h,i=Z(),u=Q(),[c,y]=(0,C.useState)(null),w;e[0]!==l.passkey||e[1]!==i||e[2]!==a?(w=s(()=>{l.passkey&&X((async()=>{try{y(await i.listAuthPasskeys({userId:a}))}catch{y(null)}})())},"C"),e[0]=l.passkey,e[1]=i,e[2]=a,e[3]=w):w=e[3];let g;e[4]!==l.passkey||e[5]!==i||e[6]!==a||e[7]!==p?(g=[l.passkey,i,a,p],e[4]=l.passkey,e[5]=i,e[6]=a,e[7]=p,e[8]=g):g=e[8],(0,C.useEffect)(w,g);let I;e[9]!==i||e[10]!==o||e[11]!==a?(I=s(()=>{o(()=>i.disableAuthTwoFactor({userId:a}))},"w"),e[9]=i,e[10]=o,e[11]=a,e[12]=I):I=e[12];let k=I,v;e[13]!==i||e[14]!==o?(v=s(A=>{o(()=>i.deleteAuthPasskey({passkeyId:A}))},"v"),e[13]=i,e[14]=o,e[15]=v):v=e[15];let d=v,m;e[16]!==u?(m=u("Security"),e[16]=u,e[17]=m):m=e[17];let b;e[18]!==m?(b=(0,t.jsx)(Ye,{children:m}),e[18]=m,e[19]=b):b=e[19];let x;e[20]!==n||e[21]!==l.twoFactor||e[22]!==k||e[23]!==u?(x=l.twoFactor&&(0,t.jsx)(_,{"data-testid":"ud-disable-2fa",disabled:n,onClick:k,size:"sm",type:"button",variant:"outline",children:u("Disable two-factor")}),e[20]=n,e[21]=l.twoFactor,e[22]=k,e[23]=u,e[24]=x):x=e[24];let N;e[25]!==l.passkey||e[26]!==c||e[27]!==u?(N=l.passkey&&c!==null&&c.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:u("No passkeys.")}),e[25]=l.passkey,e[26]=c,e[27]=u,e[28]=N):N=e[28];let f;e[29]!==n||e[30]!==l.passkey||e[31]!==d||e[32]!==c||e[33]!==u?(f=l.passkey&&c!==null&&c.length>0&&(0,t.jsx)(J,{className:"overflow-hidden py-0",children:(0,t.jsx)(K,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"ud-passkeys-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:u("name")}),(0,t.jsx)(U,{children:u("created")}),(0,t.jsx)(U,{"aria-label":u("Actions")})]})}),(0,t.jsx)(Pe,{children:c.map(A=>{let $=Ue(A.id);return(0,t.jsxs)(q,{"data-testid":`ud-passkey-${$}`,children:[(0,t.jsx)(z,{children:Ue(A.name)||$}),(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:te(A.createdAt)}),(0,t.jsx)(z,{children:(0,t.jsx)(_,{"data-testid":`ud-delete-passkey-${$}`,disabled:n,onClick:s(()=>{d($)},"onClick"),size:"xs",type:"button",variant:"ghost",children:u("Delete")})})]},$)})})]})})}),e[29]=n,e[30]=l.passkey,e[31]=d,e[32]=c,e[33]=u,e[34]=f):f=e[34];let r;return e[35]!==b||e[36]!==x||e[37]!==N||e[38]!==f?(r=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[b,x,N,f]}),e[35]=b,e[36]=x,e[37]=N,e[38]=f,e[39]=r):r=e[39],r},"ft"),gt=/(?:at|expires)$/iu,bt=/^[1-9]\d*$/u,xt=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),yt=s(h=>{let e=(0,W.c)(51),{busy:n,onBan:l}=h,o=Q(),[a,p]=(0,C.useState)(""),[i,u]=(0,C.useState)(""),[c,y]=(0,C.useState)(!1),w;e[0]!==i?(w=bt.test(i.trim())&&Number.isSafeInteger(Number(i.trim())*86400)?Number(i.trim()):void 0,e[0]=i,e[1]=w):w=e[1];let g=w,I=c||g!==void 0,k;e[2]!==l||e[3]!==c||e[4]!==a||e[5]!==g?(k=s(()=>{l({expiresInSeconds:c||g===void 0?void 0:g*86400,reason:a.trim()===""?void 0:a.trim()})},"k"),e[2]=l,e[3]=c,e[4]=a,e[5]=g,e[6]=k):k=e[6];let v=k,d;e[7]!==o?(d=o("Ban reason (optional)"),e[7]=o,e[8]=d):d=e[8];let m;e[9]!==d?(m=(0,t.jsx)(L,{htmlFor:"ud-ban-reason",children:d}),e[9]=d,e[10]=m):m=e[10];let b;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=s(E=>{p(E.target.value)},"b"),e[11]=b):b=e[11];let x;e[12]!==a?(x=(0,t.jsx)(T,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:b,value:a}),e[12]=a,e[13]=x):x=e[13];let N;e[14]!==m||e[15]!==x?(N=(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[m,x]}),e[14]=m,e[15]=x,e[16]=N):N=e[16];let f;e[17]!==o?(f=o("Days"),e[17]=o,e[18]=f):f=e[18];let r;e[19]!==f?(r=(0,t.jsx)(L,{htmlFor:"ud-ban-days",children:f}),e[19]=f,e[20]=r):r=e[20];let A;e[21]!==i||e[22]!==g?(A=i.trim()!==""&&g===void 0,e[21]=i,e[22]=g,e[23]=A):A=e[23];let $;e[24]===Symbol.for("react.memo_cache_sentinel")?($=s(E=>{u(E.target.value)},"T"),e[24]=$):$=e[24];let j;e[25]!==i||e[26]!==c||e[27]!==A?(j=(0,t.jsx)(T,{"aria-invalid":A,"data-testid":"ud-ban-days",disabled:c,id:"ud-ban-days",min:1,onChange:$,step:1,type:"number",value:i}),e[25]=i,e[26]=c,e[27]=A,e[28]=j):j=e[28];let H;e[29]!==j||e[30]!==r?(H=(0,t.jsxs)("div",{className:"flex w-24 flex-col gap-1",children:[r,j]}),e[29]=j,e[30]=r,e[31]=H):H=e[31];let M;e[32]===Symbol.for("react.memo_cache_sentinel")?(M=s(E=>{y(E.target.checked)},"M"),e[32]=M):M=e[32];let Y;e[33]!==c?(Y=(0,t.jsx)("input",{checked:c,className:"size-4 accent-destructive","data-testid":"ud-ban-permanent",id:"ud-ban-permanent",onChange:M,type:"checkbox"}),e[33]=c,e[34]=Y):Y=e[34];let B;e[35]!==o?(B=o("Permanent"),e[35]=o,e[36]=B):B=e[36];let V;e[37]!==Y||e[38]!==B?(V=(0,t.jsxs)(L,{className:"flex items-center gap-1.5 pb-2 text-xs font-normal",htmlFor:"ud-ban-permanent",children:[Y,B]}),e[37]=Y,e[38]=B,e[39]=V):V=e[39];let G=n||!I,P;e[40]!==o?(P=o("Ban user"),e[40]=o,e[41]=P):P=e[41];let O;e[42]!==v||e[43]!==G||e[44]!==P?(O=(0,t.jsx)(_,{"data-testid":"ud-ban",disabled:G,onClick:v,size:"sm",type:"button",variant:"destructive",children:P}),e[42]=v,e[43]=G,e[44]=P,e[45]=O):O=e[45];let F;return e[46]!==H||e[47]!==V||e[48]!==O||e[49]!==N?(F=(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[N,H,V,O]}),e[46]=H,e[47]=V,e[48]=O,e[49]=N,e[50]=F):F=e[50],F},"bt"),Nt=s((h,e)=>typeof e=="number"&&gt.test(h)?te(e):Ue(e),"xt"),kt=s(({capabilities:h,onChanged:e,onClose:n,user:l})=>{let o=Z(),a=Q(),p=l.banned===!0,[i,u]=(0,C.useState)(null),[c,y]=(0,C.useState)(!1),[w,g]=(0,C.useState)(0),[I,k]=(0,C.useState)(typeof l.role=="string"?l.role:""),[v,d]=(0,C.useState)(""),[m,b]=(0,C.useState)(null),[x,N]=(0,C.useState)(!1),f=s((F,E)=>{X((async()=>{y(!0),u(null);try{let $e=await F();E?.refresh!==!1&&(g(ae=>ae+1),e()),E?.onResult?.($e)}catch($e){u(Ee($e))}y(!1)})())},"p"),r=s(F=>{k(F.target.value)},"i"),A=s(F=>{d(F.target.value)},"S"),$=s(()=>{let F=I.trim();F!==""&&f(async()=>{await o.setAuthUserRole({role:F,userId:l.id})})},"T"),j=s(F=>{f(async()=>{await o.banAuthUser({...F,userId:l.id})})},"z"),H=s(()=>{f(async()=>{await o.unbanAuthUser({userId:l.id})})},"j"),M=s(()=>{f(async()=>{await o.setAuthUserPassword({newPassword:v,userId:l.id}),d("")})},"M"),Y=s(()=>{f(()=>o.impersonateAuthUser({userId:l.id}),{onResult:s(F=>{b(F.token)},"onResult"),refresh:!1})},"H"),B=s(()=>{f(async()=>{await o.revokeAuthUserSessions({userId:l.id})})},"L"),V=s(()=>{f(async()=>{await o.removeAuthUser({userId:l.id}),n()})},"V"),G=s(()=>{N(!0)},"Y"),P=s(()=>{N(!1)},"E"),O=Object.entries(l).filter(([F])=>!xt.has(F));return(0,t.jsxs)(He,{label:a("User details"),onClose:n,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:l.name??l.email??l.id}),(0,t.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:l.id}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof l.role=="string"&&l.role!==""&&(0,t.jsx)(D,{variant:"secondary",children:l.role}),p?(0,t.jsx)(D,{variant:"destructive",children:a("Banned")}):(0,t.jsx)(D,{variant:"outline",children:a("Active")}),l.emailVerified===!0?(0,t.jsx)(D,{variant:"secondary",children:a("verified")}):(0,t.jsx)(D,{variant:"outline",children:a("unverified")})]})]}),(0,t.jsx)(_,{"data-testid":"ud-close",onClick:n,size:"sm",type:"button",variant:"ghost",children:a("Close")})]}),i!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:i}),h.admin&&(0,t.jsxs)(J,{className:"gap-0 py-0",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Actions")})}),(0,t.jsxs)(K,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(L,{htmlFor:"ud-role",children:a("Role")}),(0,t.jsx)(T,{"data-testid":"ud-role-input",id:"ud-role",onChange:r,value:I})]}),(0,t.jsx)(_,{"data-testid":"ud-set-role",disabled:c||I.trim()==="",onClick:$,size:"sm",type:"button",variant:"outline",children:a("Set role")})]}),p?(0,t.jsx)(_,{"data-testid":"ud-unban",disabled:c,onClick:H,size:"sm",type:"button",variant:"outline",children:a("Unban")}):(0,t.jsx)(yt,{busy:c,onBan:j}),(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(L,{htmlFor:"ud-password",children:a("New password")}),(0,t.jsx)(T,{"data-testid":"ud-password",id:"ud-password",onChange:A,type:"password",value:v})]}),(0,t.jsx)(_,{"data-testid":"ud-set-password",disabled:c||v==="",onClick:M,size:"sm",type:"button",variant:"outline",children:a("Set password")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(_,{"data-testid":"ud-impersonate",disabled:c,onClick:Y,size:"sm",type:"button",variant:"outline",children:a("Impersonate")}),(0,t.jsx)(_,{"data-testid":"ud-revoke-all",disabled:c,onClick:B,size:"sm",type:"button",variant:"outline",children:a("Revoke all sessions")}),x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(_,{"data-testid":"ud-delete-confirm",disabled:c,onClick:V,size:"sm",type:"button",variant:"destructive",children:a("Confirm delete")}),(0,t.jsx)(_,{"data-testid":"ud-delete-cancel",onClick:P,size:"sm",type:"button",variant:"ghost",children:a("Cancel")})]}):(0,t.jsx)(_,{"data-testid":"ud-delete",disabled:c,onClick:G,size:"sm",type:"button",variant:"destructive",children:a("Delete user")})]}),m!==null&&(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsx)(L,{htmlFor:"ud-token",children:a("Impersonation token")}),(0,t.jsx)(T,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:m})]})]})]}),(0,t.jsx)(pt,{busy:c,runAction:f,userId:l.id,version:w}),h.accounts&&(0,t.jsx)(ft,{busy:c,runAction:f,userId:l.id,version:w}),(h.twoFactor||h.passkey)&&(0,t.jsx)(vt,{busy:c,capabilities:h,runAction:f,userId:l.id,version:w}),(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Fields")}),(0,t.jsx)("dl",{className:"flex flex-col",children:O.map(([F,E])=>(0,t.jsxs)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsx)("dt",{className:"text-xs font-semibold text-muted-foreground",children:F}),(0,t.jsx)("dd",{className:"m-0 font-mono text-xs break-words",children:Nt(F,E)})]},F))})]})]})},"yt"),wt=50,Vt=s(({pageSize:h=wt}={})=>{let e=Z(),n=Q(),[l,o]=(0,C.useState)(""),[a,p]=(0,C.useState)(""),[i,u]=(0,C.useState)(0),c=Xe(l),[y,w]=(0,C.useState)(null),[g,I]=(0,C.useState)(!1),{capabilities:k}=it(),v=c.trim(),d=a.trim(),m=De(["lunora-auth-users",v,d,h,i],()=>e.listAuthUsers({filterField:d===""?void 0:"role",filterValue:d===""?void 0:d,limit:h,offset:i,search:v===""?void 0:v}).then(r=>({...r,offset:i})),{keepPreviousData:!0}),b=m.data?.rows??null,x=m.error,N=s(()=>{m.refetch()},"N");We(()=>m.poll(),!0);let f=y===null?null:b?.find(r=>r.id===y)??null;return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(T,{"aria-label":n("Search users"),className:"w-56","data-testid":"us-search",onChange:s(r=>{o(r.target.value),u(0)},"onChange"),placeholder:n("Search by email or name\u2026"),value:l}),(0,t.jsx)(T,{"aria-label":n("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:s(r=>{p(r.target.value),u(0)},"onChange"),placeholder:n("Filter by role"),value:a}),(0,t.jsx)(_,{"data-testid":"us-new",onClick:s(()=>{I(!0)},"onClick"),size:"sm",type:"button",children:n("New user")})]}),x!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:x}),b!==null&&b.length===0&&(0,t.jsx)(Ve,{description:n("Users who sign up to your app will appear here."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"})}),testId:"us-empty",title:n("No users.")}),b!==null&&b.length>0&&(0,t.jsx)(J,{className:"overflow-hidden py-0",children:(0,t.jsx)(K,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"us-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:n("id")}),(0,t.jsx)(U,{children:n("email")}),(0,t.jsx)(U,{children:n("name")}),(0,t.jsx)(U,{children:n("role")}),(0,t.jsx)(U,{children:n("status")}),(0,t.jsx)(U,{children:n("verified")}),(0,t.jsx)(U,{children:n("created")}),(0,t.jsx)(U,{"aria-label":n("Actions")})]})}),(0,t.jsx)(Pe,{children:b.map(r=>(0,t.jsxs)(q,{"data-testid":`us-row-${r.id}`,children:[(0,t.jsx)(z,{className:"font-mono text-xs",children:r.id}),(0,t.jsx)(z,{children:r.email??""}),(0,t.jsx)(z,{children:r.name??""}),(0,t.jsx)(z,{children:typeof r.role=="string"&&r.role!==""?(0,t.jsx)(D,{variant:"secondary",children:r.role}):""}),(0,t.jsx)(z,{children:r.banned===!0?(0,t.jsx)(D,{variant:"destructive",children:n("Banned")}):(0,t.jsx)(D,{variant:"success",children:n("Active")})}),(0,t.jsx)(z,{children:r.emailVerified===!0?(0,t.jsx)(D,{variant:"success",children:n("yes")}):(0,t.jsx)(D,{variant:"outline",children:n("no")})}),(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:te(r.createdAt)}),(0,t.jsx)(z,{children:(0,t.jsx)(_,{"data-testid":`us-manage-${r.id}`,onClick:s(()=>{w(r.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Manage")})})]},r.id))})]})})}),b!==null&&(0,t.jsx)(Je,{count:b.length,offset:m.data?.offset??0,onOffsetChange:u,pageSize:h,prefix:"us",total:m.data?.total}),f!==null&&(0,t.jsx)(kt,{capabilities:k,onChanged:N,onClose:s(()=>{w(null)},"onClose"),user:f}),g&&(0,t.jsx)(ht,{onClose:s(()=>{I(!1)},"onClose"),onCreated:N}),k.inviteOnly&&(0,t.jsx)(ot,{})]})},"jt");export{Vt as UsersPanel};
1
+ import{a as Ze}from"./chunk-YJWR6ZWC.js";import{a as qe}from"./chunk-DUQ7KXNS.js";import{a as Ke}from"./chunk-4IEMXFUB.js";import{a as He}from"./chunk-NMVFSJM7.js";import{a as L}from"./chunk-OUFWXYEF.js";import{a as Je}from"./chunk-LKCO3E2B.js";import"./chunk-HKPDPKXD.js";import{a as We}from"./chunk-ILLDX6LU.js";import{a as Xe}from"./chunk-6QEXGYWH.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import{i as T}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as _}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as D}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{b as De}from"./chunk-4SJDWMH3.js";import{p as Z}from"./chunk-FKM35PXF.js";import"./chunk-WZTY3ZYI.js";import{a as Ve}from"./chunk-3Y5K3IQO.js";import{a as ze,b as _e,c as Pe,d as q,e as U,f as z}from"./chunk-CW57Q264.js";import{a as J,e as K}from"./chunk-MD67S53Z.js";import{f as Q,j as Ee,r as Ue,s as X,u as Qe,w as te}from"./chunk-LPINY2IJ.js";import{a as s,d as Me,e as at,f as lt,g as nt}from"./chunk-OXFKZ4BM.js";var C=Me(at(),1);var W=Me(lt(),1);var t=Me(nt(),1);var it=s(()=>{let h=(0,W.c)(3),{config:e,ready:n}=qe(),l;return h[0]!==e.capabilities||h[1]!==n?(l={capabilities:e.capabilities,ready:n},h[0]=e.capabilities,h[1]=n,h[2]=l):l=h[2],l},"nt"),st=s((h,e)=>typeof h.acceptedAt=="number"?"spent":typeof h.expiresAt=="number"&&h.expiresAt<=e?"expired":"pending","lt"),et=500,rt=s((h,e)=>{if(!URL.canParse(h.trim()))return null;let n=new URL(h.trim());return n.searchParams.set("email",e.email),n.searchParams.set("invite",e.token),n.toString()},"at"),dt=s(h=>{let e=(0,W.c)(34),{issued:n,onSignUpPageChange:l,signUpPage:o}=h,a=Q(),[p,i]=(0,C.useState)(null),u;e[0]!==n||e[1]!==o?(u=rt(o,n),e[0]=n,e[1]=o,e[2]=u):u=e[2];let c=u,y;e[3]!==c?(y=s(()=>{let $="navigator"in globalThis?globalThis.navigator.clipboard:void 0;c===null||$===void 0||X($.writeText(c).then(()=>(i(c),!0)))},"y"),e[3]=c,e[4]=y):y=e[4];let w=y,g;e[5]!==a?(g=a("Send this link to the invitee. It is shown once and cannot be recovered."),e[5]=a,e[6]=g):g=e[6];let I;e[7]!==g?(I=(0,t.jsx)("p",{className:"text-sm",children:g}),e[7]=g,e[8]=I):I=e[8];let k=c===null,v;e[9]!==a?(v=a("Your app's sign-up page"),e[9]=a,e[10]=v):v=e[10];let d;e[11]!==l?(d=s($=>{l($.target.value)},"r"),e[11]=l,e[12]=d):d=e[12];let m;e[13]!==o||e[14]!==k||e[15]!==v||e[16]!==d?(m=(0,t.jsx)(T,{"aria-invalid":k,"aria-label":v,"data-testid":"sign-up-invitation-page",onChange:d,value:o}),e[13]=o,e[14]=k,e[15]=v,e[16]=d,e[17]=m):m=e[17];let b=c??"",x;e[18]!==b?(x=(0,t.jsx)(T,{"data-testid":"sign-up-invitation-link",readOnly:!0,value:b}),e[18]=b,e[19]=x):x=e[19];let N;e[20]!==p||e[21]!==c||e[22]!==a?(N=a(p!==null&&p===c?"Copied":"Copy"),e[20]=p,e[21]=c,e[22]=a,e[23]=N):N=e[23];let f;e[24]!==w||e[25]!==N?(f=(0,t.jsx)(_,{"data-testid":"sign-up-invitation-copy",onClick:w,type:"button",children:N}),e[24]=w,e[25]=N,e[26]=f):f=e[26];let r;e[27]!==x||e[28]!==f?(r=(0,t.jsxs)("div",{className:"flex gap-2",children:[x,f]}),e[27]=x,e[28]=f,e[29]=r):r=e[29];let A;return e[30]!==r||e[31]!==I||e[32]!==m?(A=(0,t.jsx)(J,{children:(0,t.jsxs)(K,{className:"flex flex-col gap-2 p-4",children:[I,m,r]})}),e[30]=r,e[31]=I,e[32]=m,e[33]=A):A=e[33],A},"it"),ot=s(()=>{let h=Z(),e=Q(),[n,l]=(0,C.useState)(""),[o,a]=(0,C.useState)(null),[p,i]=(0,C.useState)(null),[u,c]=(0,C.useState)(()=>`${Qe(h.url)}/sign-up`),y=De(["lunora-auth-sign-up-invitations",et],()=>h.listAuthSignUpInvitations({limit:et})),w=y.data?.rows??null,g=y.data?.total??0,I=s(()=>{let v=n.trim();v!==""&&(a(null),X((async()=>{try{let d=await h.createAuthSignUpInvitation({email:v}),m=typeof d.token=="string"?d.token:void 0;i(m===void 0?null:{email:v,token:m}),l(""),y.refetch()}catch(d){a(d instanceof Error?d.message:String(d))}})()))},"w"),k=s(v=>{a(null),X((async()=>{try{await h.revokeAuthSignUpInvitation({email:v}),y.refetch()}catch(d){a(d instanceof Error?d.message:String(d))}})())},"k");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"sign-up-invitations",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-base font-medium",children:e("Sign-up invitations")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("Only invited addresses can create an account. Nothing is emailed \u2014 send the invitee the one-time link yourself.")})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(T,{"aria-label":e("Email address to invite"),"data-testid":"sign-up-invitation-email",onChange:s(v=>{l(v.target.value)},"onChange"),placeholder:e("ada@example.com"),type:"email",value:n}),(0,t.jsx)(_,{"data-testid":"sign-up-invitation-submit",onClick:I,type:"button",children:e("Invite")})]}),p!==null&&(0,t.jsx)(dt,{issued:p,onSignUpPageChange:c,signUpPage:u},p.token),(o??y.error)!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sign-up-invitations-error",role:"alert",children:o??y.error}),w!==null&&w.length===0&&(0,t.jsx)(Ve,{testId:"sign-up-invitations-empty",title:e("Nobody has been invited yet.")}),w!==null&&g>w.length&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sign-up-invitations-truncated",children:e("Showing the most recent invitations. Query the signUpInvitation table directly to see the rest.")}),w!==null&&w.length>0&&(0,t.jsx)(J,{children:(0,t.jsx)(K,{className:"p-0",children:(0,t.jsxs)(ze,{children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:e("Email")}),(0,t.jsx)(U,{children:e("Status")}),(0,t.jsx)(U,{children:e("Expires")}),(0,t.jsx)(U,{children:e("Invited by")}),(0,t.jsx)(U,{})]})}),(0,t.jsx)(Pe,{children:w.map(v=>{let d=st(v,Date.now()),m=v.email??"";return(0,t.jsxs)(q,{"data-testid":`sign-up-invitation-${m}`,children:[(0,t.jsx)(z,{children:m}),(0,t.jsxs)(z,{"data-testid":`sign-up-invitation-status-${m}`,children:[d==="spent"&&e("Accepted"),d==="expired"&&e("Expired"),d==="pending"&&e("Pending")]}),(0,t.jsx)(z,{children:typeof v.expiresAt=="number"?te(v.expiresAt):"\u2014"}),(0,t.jsx)(z,{children:v.invitedBy??"\u2014"}),(0,t.jsx)(z,{className:"text-right",children:(0,t.jsx)(_,{onClick:s(()=>{k(m)},"onClick"),type:"button",variant:"ghost",children:e("Revoke")})})]},v.id)})})]})})})]})},"rt"),ct={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},ut=s((h,e)=>h.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:h.type!=="number"||!Number.isNaN(Number(e.trim())),"dt"),mt=s((h,e)=>{if(h.type==="boolean")return e===!0?{value:!0}:h.required?{value:!1}:void 0;let n=typeof e=="string"?e.trim():"";if(n!==""){if(h.type==="number"){let l=Number(n);return Number.isNaN(l)?void 0:{value:l}}return{value:n}}},"ct"),ht=s(h=>{let e=(0,W.c)(105),{onClose:n,onCreated:l}=h,o=Z(),a=Q(),{config:p}=qe(),{busy:i,error:u,run:c}=Ke(),[y,w]=(0,C.useState)(""),[g,I]=(0,C.useState)(""),[k,v]=(0,C.useState)(""),[d,m]=(0,C.useState)(""),b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];let[x,N]=(0,C.useState)(b),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=s(S=>{w(S.target.value)},"p"),e[1]=f):f=e[1];let r=f,A;e[2]===Symbol.for("react.memo_cache_sentinel")?(A=s(S=>{I(S.target.value)},"S"),e[2]=A):A=e[2];let $=A,j;e[3]===Symbol.for("react.memo_cache_sentinel")?(j=s(S=>{v(S.target.value)},"z"),e[3]=j):j=e[3];let H=j,M;e[4]===Symbol.for("react.memo_cache_sentinel")?(M=s(S=>{m(S.target.value)},"M"),e[4]=M):M=e[4];let Y=M,B;e[5]===Symbol.for("react.memo_cache_sentinel")?(B=s((S,R)=>{N(ee=>({...ee,[S]:R}))},"L"),e[5]=B):B=e[5];let V=B,G;e[6]!==x?(G=s(S=>x[S.name]??(S.type==="boolean"?!1:""),"Y"),e[6]=x,e[7]=G):G=e[7];let P=G,O;if(e[8]!==p.userFields||e[9]!==P){let S;e[11]!==P?(S=s(R=>!R.required||ut(R,P(R)),"A"),e[11]=P,e[12]=S):S=e[12],O=p.userFields.every(S),e[8]=p.userFields,e[9]=P,e[10]=O}else O=e[10];let F=O,E;e[13]!==i||e[14]!==y||e[15]!==g||e[16]!==F?(E=!i&&y.trim()!==""&&g.trim()!==""&&F,e[13]=i,e[14]=y,e[15]=g,e[16]=F,e[17]=E):E=e[17];let $e=E,ae;e[18]!==p.userFields||e[19]!==P?(ae=s(()=>{let S={};for(let R of p.userFields){let ee=mt(R,P(R));ee!==void 0&&(S[R.name]=ee.value)}return Object.keys(S).length===0?void 0:S},"te"),e[18]=p.userFields,e[19]=P,e[20]=ae):ae=e[20];let je=ae,Re;e[21]!==je||e[22]!==o||e[23]!==y||e[24]!==g||e[25]!==n||e[26]!==l||e[27]!==k||e[28]!==d||e[29]!==c?(Re=s(()=>{c(async()=>{await o.createAuthUser({data:je(),email:y.trim(),name:g.trim(),password:k===""?void 0:k,role:d.trim()===""?void 0:d.trim()}),l(),n()})},"De"),e[21]=je,e[22]=o,e[23]=y,e[24]=g,e[25]=n,e[26]=l,e[27]=k,e[28]=d,e[29]=c,e[30]=Re):Re=e[30];let Be=Re,le;e[31]!==a?(le=a("Create user"),e[31]=a,e[32]=le):le=e[32];let ne;e[33]!==a?(ne=a("Create user"),e[33]=a,e[34]=ne):ne=e[34];let ie;e[35]!==ne?(ie=(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:ne}),e[35]=ne,e[36]=ie):ie=e[36];let se;e[37]!==a?(se=a("email"),e[37]=a,e[38]=se):se=e[38];let re;e[39]!==se?(re=(0,t.jsx)(L,{htmlFor:"uc-email",children:se}),e[39]=se,e[40]=re):re=e[40];let de;e[41]!==y?(de=(0,t.jsx)(T,{"data-testid":"uc-email",id:"uc-email",onChange:r,type:"email",value:y}),e[41]=y,e[42]=de):de=e[42];let oe;e[43]!==re||e[44]!==de?(oe=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[re,de]}),e[43]=re,e[44]=de,e[45]=oe):oe=e[45];let ce;e[46]!==a?(ce=a("name"),e[46]=a,e[47]=ce):ce=e[47];let ue;e[48]!==ce?(ue=(0,t.jsx)(L,{htmlFor:"uc-name",children:ce}),e[48]=ce,e[49]=ue):ue=e[49];let me;e[50]!==g?(me=(0,t.jsx)(T,{"data-testid":"uc-name",id:"uc-name",onChange:$,value:g}),e[50]=g,e[51]=me):me=e[51];let he;e[52]!==ue||e[53]!==me?(he=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[ue,me]}),e[52]=ue,e[53]=me,e[54]=he):he=e[54];let pe;e[55]!==a?(pe=a("Password (optional)"),e[55]=a,e[56]=pe):pe=e[56];let fe;e[57]!==pe?(fe=(0,t.jsx)(L,{htmlFor:"uc-password",children:pe}),e[57]=pe,e[58]=fe):fe=e[58];let ve;e[59]!==k?(ve=(0,t.jsx)(T,{"data-testid":"uc-password",id:"uc-password",onChange:H,type:"password",value:k}),e[59]=k,e[60]=ve):ve=e[60];let ge;e[61]!==fe||e[62]!==ve?(ge=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[fe,ve]}),e[61]=fe,e[62]=ve,e[63]=ge):ge=e[63];let be;e[64]!==a?(be=a("Role (optional)"),e[64]=a,e[65]=be):be=e[65];let xe;e[66]!==be?(xe=(0,t.jsx)(L,{htmlFor:"uc-role",children:be}),e[66]=be,e[67]=xe):xe=e[67];let ye;e[68]!==d?(ye=(0,t.jsx)(T,{"data-testid":"uc-role",id:"uc-role",onChange:Y,value:d}),e[68]=d,e[69]=ye):ye=e[69];let Ne;e[70]!==xe||e[71]!==ye?(Ne=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[xe,ye]}),e[70]=xe,e[71]=ye,e[72]=Ne):Ne=e[72];let ke;e[73]!==p.userFields||e[74]!==P||e[75]!==a?(ke=p.userFields.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Plugin fields")}),p.userFields.map(S=>{let R=`uc-field-${S.name}`,ee=S.required?"":` (${a("optional")})`;if(S.type==="boolean"){let Le=P(S)===!0;return(0,t.jsxs)("label",{className:"flex items-center gap-2",htmlFor:R,children:[(0,t.jsx)(Ze,{checked:Le,"data-testid":R,id:R,onCheckedChange:s(tt=>{V(S.name,tt)},"onCheckedChange")}),(0,t.jsxs)("span",{className:"text-sm",children:[S.name,ee]})]},S.name)}let Ge=P(S);return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)(L,{htmlFor:R,children:[S.name,ee]}),(0,t.jsx)(T,{"data-testid":R,id:R,onChange:s(Le=>{V(S.name,Le.target.value)},"onChange"),type:ct[S.type],value:typeof Ge=="string"?Ge:""})]},S.name)})]}),e[73]=p.userFields,e[74]=P,e[75]=a,e[76]=ke):ke=e[76];let we;e[77]!==u?(we=u!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:u}),e[77]=u,e[78]=we):we=e[78];let Ce;e[79]!==a?(Ce=a("Cancel"),e[79]=a,e[80]=Ce):Ce=e[80];let Ie;e[81]!==n||e[82]!==Ce?(Ie=(0,t.jsx)(_,{"data-testid":"uc-cancel",onClick:n,size:"sm",type:"button",variant:"outline",children:Ce}),e[81]=n,e[82]=Ce,e[83]=Ie):Ie=e[83];let Oe=!$e,Se;e[84]!==i||e[85]!==a?(Se=a(i?"Creating\u2026":"Create"),e[84]=i,e[85]=a,e[86]=Se):Se=e[86];let Ae;e[87]!==Be||e[88]!==Oe||e[89]!==Se?(Ae=(0,t.jsx)(_,{"data-testid":"uc-submit",disabled:Oe,onClick:Be,size:"sm",type:"button",children:Se}),e[87]=Be,e[88]=Oe,e[89]=Se,e[90]=Ae):Ae=e[90];let Fe;e[91]!==Ie||e[92]!==Ae?(Fe=(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[Ie,Ae]}),e[91]=Ie,e[92]=Ae,e[93]=Fe):Fe=e[93];let Te;return e[94]!==n||e[95]!==le||e[96]!==ie||e[97]!==oe||e[98]!==he||e[99]!==ge||e[100]!==Ne||e[101]!==ke||e[102]!==we||e[103]!==Fe?(Te=(0,t.jsxs)(He,{label:le,onClose:n,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[ie,oe,he,ge,Ne,ke,we,Fe]}),e[94]=n,e[95]=le,e[96]=ie,e[97]=oe,e[98]=he,e[99]=ge,e[100]=Ne,e[101]=ke,e[102]=we,e[103]=Fe,e[104]=Te):Te=e[104],Te},"ut"),Ye=s(h=>{let e=(0,W.c)(2),{children:n}=h,l;return e[0]!==n?(l=(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n}),e[0]=n,e[1]=l):l=e[1],l},"_e"),pt=s(h=>{let e=(0,W.c)(29),{busy:n,runAction:l,userId:o,version:a}=h,p=Z(),i=Q(),[u,c]=(0,C.useState)(null),[y,w]=(0,C.useState)(null),g;e[0]!==p||e[1]!==o?(g=s(()=>{X((async()=>{w(null);try{let r=await p.listAuthSessions({limit:50,userId:o});c(r.rows)}catch(r){let A=r;c(null),w(Ee(A))}})())},"g"),e[0]=p,e[1]=o,e[2]=g):g=e[2];let I;e[3]!==p||e[4]!==o||e[5]!==a?(I=[p,o,a],e[3]=p,e[4]=o,e[5]=a,e[6]=I):I=e[6],(0,C.useEffect)(g,I);let k;e[7]!==p||e[8]!==l?(k=s(r=>{l(()=>p.revokeAuthSession({sessionId:r}))},"k"),e[7]=p,e[8]=l,e[9]=k):k=e[9];let v=k,d;e[10]!==i?(d=i("Sessions"),e[10]=i,e[11]=d):d=e[11];let m;e[12]!==d?(m=(0,t.jsx)(Ye,{children:d}),e[12]=d,e[13]=m):m=e[13];let b;e[14]!==y?(b=y!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:y}),e[14]=y,e[15]=b):b=e[15];let x;e[16]!==u||e[17]!==i?(x=u!==null&&u.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:i("No active sessions.")}),e[16]=u,e[17]=i,e[18]=x):x=e[18];let N;e[19]!==n||e[20]!==v||e[21]!==u||e[22]!==i?(N=u!==null&&u.length>0&&(0,t.jsx)(J,{className:"overflow-hidden py-0",children:(0,t.jsx)(K,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"ud-sessions-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:i("expires")}),(0,t.jsx)(U,{children:i("ip")}),(0,t.jsx)(U,{children:i("user agent")}),(0,t.jsx)(U,{"aria-label":i("Actions")})]})}),(0,t.jsx)(Pe,{children:u.map(r=>(0,t.jsxs)(q,{"data-testid":`ud-session-${r.id}`,children:[(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:te(r.expiresAt)}),(0,t.jsx)(z,{children:r.ipAddress??""}),(0,t.jsx)(z,{className:"max-w-40 truncate",children:r.userAgent??""}),(0,t.jsx)(z,{children:(0,t.jsx)(_,{"data-testid":`ud-revoke-${r.id}`,disabled:n,onClick:s(()=>{v(r.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Revoke")})})]},r.id))})]})})}),e[19]=n,e[20]=v,e[21]=u,e[22]=i,e[23]=N):N=e[23];let f;return e[24]!==m||e[25]!==b||e[26]!==x||e[27]!==N?(f=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[m,b,x,N]}),e[24]=m,e[25]=b,e[26]=x,e[27]=N,e[28]=f):f=e[28],f},"mt"),ft=s(h=>{let e=(0,W.c)(30),{busy:n,runAction:l,userId:o,version:a}=h,p=Z(),i=Q(),[u,c]=(0,C.useState)(null),[y,w]=(0,C.useState)(null),g;e[0]!==p||e[1]!==o?(g=s(()=>{X((async()=>{w(null);try{c(await p.listAuthAccounts({userId:o}))}catch(r){let A=r;c(null),w(Ee(A))}})())},"g"),e[0]=p,e[1]=o,e[2]=g):g=e[2];let I;e[3]!==p||e[4]!==o||e[5]!==a?(I=[p,o,a],e[3]=p,e[4]=o,e[5]=a,e[6]=I):I=e[6],(0,C.useEffect)(g,I);let k;e[7]!==p||e[8]!==l||e[9]!==o?(k=s(r=>{l(()=>p.unlinkAuthAccount({accountId:r,userId:o}))},"k"),e[7]=p,e[8]=l,e[9]=o,e[10]=k):k=e[10];let v=k,d;e[11]!==i?(d=i("Linked accounts"),e[11]=i,e[12]=d):d=e[12];let m;e[13]!==d?(m=(0,t.jsx)(Ye,{children:d}),e[13]=d,e[14]=m):m=e[14];let b;e[15]!==y?(b=y!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:y}),e[15]=y,e[16]=b):b=e[16];let x;e[17]!==u||e[18]!==i?(x=u!==null&&u.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i("No linked accounts.")}),e[17]=u,e[18]=i,e[19]=x):x=e[19];let N;e[20]!==u||e[21]!==n||e[22]!==v||e[23]!==i?(N=u!==null&&u.length>0&&(0,t.jsx)(J,{className:"overflow-hidden py-0",children:(0,t.jsx)(K,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"ud-accounts-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:i("provider")}),(0,t.jsx)(U,{children:i("created")}),(0,t.jsx)(U,{"aria-label":i("Actions")})]})}),(0,t.jsx)(Pe,{children:u.map(r=>{let A=Ue(r.id);return(0,t.jsxs)(q,{"data-testid":`ud-account-${A}`,children:[(0,t.jsx)(z,{children:Ue(r.providerId)}),(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:te(r.createdAt)}),(0,t.jsx)(z,{children:(0,t.jsx)(_,{"data-testid":`ud-unlink-${A}`,disabled:n,onClick:s(()=>{v(A)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Unlink")})})]},A)})})]})})}),e[20]=u,e[21]=n,e[22]=v,e[23]=i,e[24]=N):N=e[24];let f;return e[25]!==m||e[26]!==b||e[27]!==x||e[28]!==N?(f=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[m,b,x,N]}),e[25]=m,e[26]=b,e[27]=x,e[28]=N,e[29]=f):f=e[29],f},"ht"),vt=s(h=>{let e=(0,W.c)(40),{busy:n,capabilities:l,runAction:o,userId:a,version:p}=h,i=Z(),u=Q(),[c,y]=(0,C.useState)(null),w;e[0]!==l.passkey||e[1]!==i||e[2]!==a?(w=s(()=>{l.passkey&&X((async()=>{try{y(await i.listAuthPasskeys({userId:a}))}catch{y(null)}})())},"C"),e[0]=l.passkey,e[1]=i,e[2]=a,e[3]=w):w=e[3];let g;e[4]!==l.passkey||e[5]!==i||e[6]!==a||e[7]!==p?(g=[l.passkey,i,a,p],e[4]=l.passkey,e[5]=i,e[6]=a,e[7]=p,e[8]=g):g=e[8],(0,C.useEffect)(w,g);let I;e[9]!==i||e[10]!==o||e[11]!==a?(I=s(()=>{o(()=>i.disableAuthTwoFactor({userId:a}))},"w"),e[9]=i,e[10]=o,e[11]=a,e[12]=I):I=e[12];let k=I,v;e[13]!==i||e[14]!==o?(v=s(A=>{o(()=>i.deleteAuthPasskey({passkeyId:A}))},"v"),e[13]=i,e[14]=o,e[15]=v):v=e[15];let d=v,m;e[16]!==u?(m=u("Security"),e[16]=u,e[17]=m):m=e[17];let b;e[18]!==m?(b=(0,t.jsx)(Ye,{children:m}),e[18]=m,e[19]=b):b=e[19];let x;e[20]!==n||e[21]!==l.twoFactor||e[22]!==k||e[23]!==u?(x=l.twoFactor&&(0,t.jsx)(_,{"data-testid":"ud-disable-2fa",disabled:n,onClick:k,size:"sm",type:"button",variant:"outline",children:u("Disable two-factor")}),e[20]=n,e[21]=l.twoFactor,e[22]=k,e[23]=u,e[24]=x):x=e[24];let N;e[25]!==l.passkey||e[26]!==c||e[27]!==u?(N=l.passkey&&c!==null&&c.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:u("No passkeys.")}),e[25]=l.passkey,e[26]=c,e[27]=u,e[28]=N):N=e[28];let f;e[29]!==n||e[30]!==l.passkey||e[31]!==d||e[32]!==c||e[33]!==u?(f=l.passkey&&c!==null&&c.length>0&&(0,t.jsx)(J,{className:"overflow-hidden py-0",children:(0,t.jsx)(K,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"ud-passkeys-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:u("name")}),(0,t.jsx)(U,{children:u("created")}),(0,t.jsx)(U,{"aria-label":u("Actions")})]})}),(0,t.jsx)(Pe,{children:c.map(A=>{let $=Ue(A.id);return(0,t.jsxs)(q,{"data-testid":`ud-passkey-${$}`,children:[(0,t.jsx)(z,{children:Ue(A.name)||$}),(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:te(A.createdAt)}),(0,t.jsx)(z,{children:(0,t.jsx)(_,{"data-testid":`ud-delete-passkey-${$}`,disabled:n,onClick:s(()=>{d($)},"onClick"),size:"xs",type:"button",variant:"ghost",children:u("Delete")})})]},$)})})]})})}),e[29]=n,e[30]=l.passkey,e[31]=d,e[32]=c,e[33]=u,e[34]=f):f=e[34];let r;return e[35]!==b||e[36]!==x||e[37]!==N||e[38]!==f?(r=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[b,x,N,f]}),e[35]=b,e[36]=x,e[37]=N,e[38]=f,e[39]=r):r=e[39],r},"ft"),gt=/(?:at|expires)$/iu,bt=/^[1-9]\d*$/u,xt=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),yt=s(h=>{let e=(0,W.c)(51),{busy:n,onBan:l}=h,o=Q(),[a,p]=(0,C.useState)(""),[i,u]=(0,C.useState)(""),[c,y]=(0,C.useState)(!1),w;e[0]!==i?(w=bt.test(i.trim())&&Number.isSafeInteger(Number(i.trim())*86400)?Number(i.trim()):void 0,e[0]=i,e[1]=w):w=e[1];let g=w,I=c||g!==void 0,k;e[2]!==l||e[3]!==c||e[4]!==a||e[5]!==g?(k=s(()=>{l({expiresInSeconds:c||g===void 0?void 0:g*86400,reason:a.trim()===""?void 0:a.trim()})},"k"),e[2]=l,e[3]=c,e[4]=a,e[5]=g,e[6]=k):k=e[6];let v=k,d;e[7]!==o?(d=o("Ban reason (optional)"),e[7]=o,e[8]=d):d=e[8];let m;e[9]!==d?(m=(0,t.jsx)(L,{htmlFor:"ud-ban-reason",children:d}),e[9]=d,e[10]=m):m=e[10];let b;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=s(E=>{p(E.target.value)},"b"),e[11]=b):b=e[11];let x;e[12]!==a?(x=(0,t.jsx)(T,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:b,value:a}),e[12]=a,e[13]=x):x=e[13];let N;e[14]!==m||e[15]!==x?(N=(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[m,x]}),e[14]=m,e[15]=x,e[16]=N):N=e[16];let f;e[17]!==o?(f=o("Days"),e[17]=o,e[18]=f):f=e[18];let r;e[19]!==f?(r=(0,t.jsx)(L,{htmlFor:"ud-ban-days",children:f}),e[19]=f,e[20]=r):r=e[20];let A;e[21]!==i||e[22]!==g?(A=i.trim()!==""&&g===void 0,e[21]=i,e[22]=g,e[23]=A):A=e[23];let $;e[24]===Symbol.for("react.memo_cache_sentinel")?($=s(E=>{u(E.target.value)},"T"),e[24]=$):$=e[24];let j;e[25]!==i||e[26]!==c||e[27]!==A?(j=(0,t.jsx)(T,{"aria-invalid":A,"data-testid":"ud-ban-days",disabled:c,id:"ud-ban-days",min:1,onChange:$,step:1,type:"number",value:i}),e[25]=i,e[26]=c,e[27]=A,e[28]=j):j=e[28];let H;e[29]!==j||e[30]!==r?(H=(0,t.jsxs)("div",{className:"flex w-24 flex-col gap-1",children:[r,j]}),e[29]=j,e[30]=r,e[31]=H):H=e[31];let M;e[32]===Symbol.for("react.memo_cache_sentinel")?(M=s(E=>{y(E.target.checked)},"M"),e[32]=M):M=e[32];let Y;e[33]!==c?(Y=(0,t.jsx)("input",{checked:c,className:"size-4 accent-destructive","data-testid":"ud-ban-permanent",id:"ud-ban-permanent",onChange:M,type:"checkbox"}),e[33]=c,e[34]=Y):Y=e[34];let B;e[35]!==o?(B=o("Permanent"),e[35]=o,e[36]=B):B=e[36];let V;e[37]!==Y||e[38]!==B?(V=(0,t.jsxs)(L,{className:"flex items-center gap-1.5 pb-2 text-xs font-normal",htmlFor:"ud-ban-permanent",children:[Y,B]}),e[37]=Y,e[38]=B,e[39]=V):V=e[39];let G=n||!I,P;e[40]!==o?(P=o("Ban user"),e[40]=o,e[41]=P):P=e[41];let O;e[42]!==v||e[43]!==G||e[44]!==P?(O=(0,t.jsx)(_,{"data-testid":"ud-ban",disabled:G,onClick:v,size:"sm",type:"button",variant:"destructive",children:P}),e[42]=v,e[43]=G,e[44]=P,e[45]=O):O=e[45];let F;return e[46]!==H||e[47]!==V||e[48]!==O||e[49]!==N?(F=(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[N,H,V,O]}),e[46]=H,e[47]=V,e[48]=O,e[49]=N,e[50]=F):F=e[50],F},"bt"),Nt=s((h,e)=>typeof e=="number"&&gt.test(h)?te(e):Ue(e),"xt"),kt=s(({capabilities:h,onChanged:e,onClose:n,user:l})=>{let o=Z(),a=Q(),p=l.banned===!0,[i,u]=(0,C.useState)(null),[c,y]=(0,C.useState)(!1),[w,g]=(0,C.useState)(0),[I,k]=(0,C.useState)(typeof l.role=="string"?l.role:""),[v,d]=(0,C.useState)(""),[m,b]=(0,C.useState)(null),[x,N]=(0,C.useState)(!1),f=s((F,E)=>{X((async()=>{y(!0),u(null);try{let $e=await F();E?.refresh!==!1&&(g(ae=>ae+1),e()),E?.onResult?.($e)}catch($e){u(Ee($e))}y(!1)})())},"p"),r=s(F=>{k(F.target.value)},"i"),A=s(F=>{d(F.target.value)},"S"),$=s(()=>{let F=I.trim();F!==""&&f(async()=>{await o.setAuthUserRole({role:F,userId:l.id})})},"T"),j=s(F=>{f(async()=>{await o.banAuthUser({...F,userId:l.id})})},"z"),H=s(()=>{f(async()=>{await o.unbanAuthUser({userId:l.id})})},"j"),M=s(()=>{f(async()=>{await o.setAuthUserPassword({newPassword:v,userId:l.id}),d("")})},"M"),Y=s(()=>{f(()=>o.impersonateAuthUser({userId:l.id}),{onResult:s(F=>{b(F.token)},"onResult"),refresh:!1})},"H"),B=s(()=>{f(async()=>{await o.revokeAuthUserSessions({userId:l.id})})},"L"),V=s(()=>{f(async()=>{await o.removeAuthUser({userId:l.id}),n()})},"V"),G=s(()=>{N(!0)},"Y"),P=s(()=>{N(!1)},"E"),O=Object.entries(l).filter(([F])=>!xt.has(F));return(0,t.jsxs)(He,{label:a("User details"),onClose:n,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:l.name??l.email??l.id}),(0,t.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:l.id}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof l.role=="string"&&l.role!==""&&(0,t.jsx)(D,{variant:"secondary",children:l.role}),p?(0,t.jsx)(D,{variant:"destructive",children:a("Banned")}):(0,t.jsx)(D,{variant:"outline",children:a("Active")}),l.emailVerified===!0?(0,t.jsx)(D,{variant:"secondary",children:a("verified")}):(0,t.jsx)(D,{variant:"outline",children:a("unverified")})]})]}),(0,t.jsx)(_,{"data-testid":"ud-close",onClick:n,size:"sm",type:"button",variant:"ghost",children:a("Close")})]}),i!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:i}),h.admin&&(0,t.jsxs)(J,{className:"gap-0 py-0",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Actions")})}),(0,t.jsxs)(K,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(L,{htmlFor:"ud-role",children:a("Role")}),(0,t.jsx)(T,{"data-testid":"ud-role-input",id:"ud-role",onChange:r,value:I})]}),(0,t.jsx)(_,{"data-testid":"ud-set-role",disabled:c||I.trim()==="",onClick:$,size:"sm",type:"button",variant:"outline",children:a("Set role")})]}),p?(0,t.jsx)(_,{"data-testid":"ud-unban",disabled:c,onClick:H,size:"sm",type:"button",variant:"outline",children:a("Unban")}):(0,t.jsx)(yt,{busy:c,onBan:j}),(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(L,{htmlFor:"ud-password",children:a("New password")}),(0,t.jsx)(T,{"data-testid":"ud-password",id:"ud-password",onChange:A,type:"password",value:v})]}),(0,t.jsx)(_,{"data-testid":"ud-set-password",disabled:c||v==="",onClick:M,size:"sm",type:"button",variant:"outline",children:a("Set password")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(_,{"data-testid":"ud-impersonate",disabled:c,onClick:Y,size:"sm",type:"button",variant:"outline",children:a("Impersonate")}),(0,t.jsx)(_,{"data-testid":"ud-revoke-all",disabled:c,onClick:B,size:"sm",type:"button",variant:"outline",children:a("Revoke all sessions")}),x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(_,{"data-testid":"ud-delete-confirm",disabled:c,onClick:V,size:"sm",type:"button",variant:"destructive",children:a("Confirm delete")}),(0,t.jsx)(_,{"data-testid":"ud-delete-cancel",onClick:P,size:"sm",type:"button",variant:"ghost",children:a("Cancel")})]}):(0,t.jsx)(_,{"data-testid":"ud-delete",disabled:c,onClick:G,size:"sm",type:"button",variant:"destructive",children:a("Delete user")})]}),m!==null&&(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsx)(L,{htmlFor:"ud-token",children:a("Impersonation token")}),(0,t.jsx)(T,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:m})]})]})]}),(0,t.jsx)(pt,{busy:c,runAction:f,userId:l.id,version:w}),h.accounts&&(0,t.jsx)(ft,{busy:c,runAction:f,userId:l.id,version:w}),(h.twoFactor||h.passkey)&&(0,t.jsx)(vt,{busy:c,capabilities:h,runAction:f,userId:l.id,version:w}),(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Fields")}),(0,t.jsx)("dl",{className:"flex flex-col",children:O.map(([F,E])=>(0,t.jsxs)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsx)("dt",{className:"text-xs font-semibold text-muted-foreground",children:F}),(0,t.jsx)("dd",{className:"m-0 font-mono text-xs break-words",children:Nt(F,E)})]},F))})]})]})},"yt"),wt=50,Vt=s(({pageSize:h=wt}={})=>{let e=Z(),n=Q(),[l,o]=(0,C.useState)(""),[a,p]=(0,C.useState)(""),[i,u]=(0,C.useState)(0),c=Xe(l),[y,w]=(0,C.useState)(null),[g,I]=(0,C.useState)(!1),{capabilities:k}=it(),v=c.trim(),d=a.trim(),m=De(["lunora-auth-users",v,d,h,i],()=>e.listAuthUsers({filterField:d===""?void 0:"role",filterValue:d===""?void 0:d,limit:h,offset:i,search:v===""?void 0:v}).then(r=>({...r,offset:i})),{keepPreviousData:!0}),b=m.data?.rows??null,x=m.error,N=s(()=>{m.refetch()},"N");We(()=>m.poll(),!0);let f=y===null?null:b?.find(r=>r.id===y)??null;return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(T,{"aria-label":n("Search users"),className:"w-56","data-testid":"us-search",onChange:s(r=>{o(r.target.value),u(0)},"onChange"),placeholder:n("Search by email or name\u2026"),value:l}),(0,t.jsx)(T,{"aria-label":n("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:s(r=>{p(r.target.value),u(0)},"onChange"),placeholder:n("Filter by role"),value:a}),(0,t.jsx)(_,{"data-testid":"us-new",onClick:s(()=>{I(!0)},"onClick"),size:"sm",type:"button",children:n("New user")})]}),x!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:x}),b!==null&&b.length===0&&(0,t.jsx)(Ve,{description:n("Users who sign up to your app will appear here."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"})}),testId:"us-empty",title:n("No users.")}),b!==null&&b.length>0&&(0,t.jsx)(J,{className:"overflow-hidden py-0",children:(0,t.jsx)(K,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"us-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:n("id")}),(0,t.jsx)(U,{children:n("email")}),(0,t.jsx)(U,{children:n("name")}),(0,t.jsx)(U,{children:n("role")}),(0,t.jsx)(U,{children:n("status")}),(0,t.jsx)(U,{children:n("verified")}),(0,t.jsx)(U,{children:n("created")}),(0,t.jsx)(U,{"aria-label":n("Actions")})]})}),(0,t.jsx)(Pe,{children:b.map(r=>(0,t.jsxs)(q,{"data-testid":`us-row-${r.id}`,children:[(0,t.jsx)(z,{className:"font-mono text-xs",children:r.id}),(0,t.jsx)(z,{children:r.email??""}),(0,t.jsx)(z,{children:r.name??""}),(0,t.jsx)(z,{children:typeof r.role=="string"&&r.role!==""?(0,t.jsx)(D,{variant:"secondary",children:r.role}):""}),(0,t.jsx)(z,{children:r.banned===!0?(0,t.jsx)(D,{variant:"destructive",children:n("Banned")}):(0,t.jsx)(D,{variant:"success",children:n("Active")})}),(0,t.jsx)(z,{children:r.emailVerified===!0?(0,t.jsx)(D,{variant:"success",children:n("yes")}):(0,t.jsx)(D,{variant:"outline",children:n("no")})}),(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:te(r.createdAt)}),(0,t.jsx)(z,{children:(0,t.jsx)(_,{"data-testid":`us-manage-${r.id}`,onClick:s(()=>{w(r.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Manage")})})]},r.id))})]})})}),b!==null&&(0,t.jsx)(Je,{count:b.length,offset:m.data?.offset??0,onOffsetChange:u,pageSize:h,prefix:"us",total:m.data?.total}),f!==null&&(0,t.jsx)(kt,{capabilities:k,onChanged:N,onClose:s(()=>{w(null)},"onClose"),user:f}),g&&(0,t.jsx)(ht,{onClose:s(()=>{I(!1)},"onClose"),onCreated:N}),k.inviteOnly&&(0,t.jsx)(ot,{})]})},"jt");export{Vt as UsersPanel};
@@ -1 +1 @@
1
- import{a as de}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as Y}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as te}from"./chunk-DSTNWB4N.js";import"./chunk-OSJ7HV7B.js";import"./chunk-6QBK3Z7A.js";import"./chunk-E26OT26O.js";import"./chunk-ZKPRORLI.js";import{k as se,l as ie,m as ae}from"./chunk-OIDFWEJX.js";import"./chunk-WZTY3ZYI.js";import{a as ee}from"./chunk-3Y5K3IQO.js";import{a as ne,b as ce,c as oe,d as re,e as O,f as S}from"./chunk-CW57Q264.js";import{b as le,f as X,w as Z}from"./chunk-LPINY2IJ.js";import{a as o,d as $,e as ve,f as me,g as pe}from"./chunk-OXFKZ4BM.js";var _=$(me(),1);var ue=$(ve(),1);var s=$(pe(),1);var ye=new Set(["cancelled","completed","expired"]),he=o(i=>ye.has(i),"fe"),fe=o(i=>i.extendedDueAt??i.dueAt,"me"),xe=o(i=>!he(i)&&i!=="ready","ve"),ge=o((i,e)=>xe(i.status)&&e.getTime()>fe(i).getTime(),"pe"),qe=o((i,e)=>ge({dueAt:new Date(i.dueAt),status:i.status,...i.extendedDueAt===void 0||i.extendedDueAt===null?{}:{extendedDueAt:new Date(i.extendedDueAt)}},new Date(e)),"ye"),Ae=["studio","privacy-requests"],De={cancelled:"outline",completed:"success",expired:"outline",failed:"destructive",grace:"secondary",processing:"warning",ready:"success",received:"info"},be=o(i=>Z(i??void 0,"\u2014"),"Ae"),Pe=o(i=>{let e=(0,_.c)(55),{asOf:u,retrying:t,row:r,onRetry:b}=i,d=X(),n,c,I;e[0]!==u||e[1]!==r?(c=qe(r,u),n=re,I=le(c&&"bg-destructive/5"),e[0]=u,e[1]=r,e[2]=n,e[3]=c,e[4]=I):(n=e[2],c=e[3],I=e[4]);let N=c?"true":"false",v;e[5]!==r.id?(v=(0,s.jsx)(S,{className:"font-mono text-xs",children:r.id}),e[5]=r.id,e[6]=v):v=e[6];let m;e[7]!==r.type||e[8]!==d?(m=r.type==="export"?d("Export"):d("Erasure"),e[7]=r.type,e[8]=d,e[9]=m):m=e[9];let E;e[10]!==m?(E=(0,s.jsx)(S,{children:(0,s.jsx)(Y,{variant:"secondary",children:m})}),e[10]=m,e[11]=E):E=e[11];let l;e[12]!==r.subjectId?(l=(0,s.jsx)(S,{className:"font-mono text-xs",children:r.subjectId}),e[12]=r.subjectId,e[13]=l):l=e[13];let T=De[r.status],P;e[14]!==r.status||e[15]!==T?(P=(0,s.jsx)(S,{children:(0,s.jsx)(Y,{variant:T,children:r.status})}),e[14]=r.status,e[15]=T,e[16]=P):P=e[16];let w;e[17]!==r.receivedAt?(w=Z(r.receivedAt),e[17]=r.receivedAt,e[18]=w):w=e[18];let R;e[19]!==w?(R=(0,s.jsx)(S,{children:w}),e[19]=w,e[20]=R):R=e[20];let p;e[21]!==r.dueAt?(p=Z(r.dueAt),e[21]=r.dueAt,e[22]=p):p=e[22];let y;e[23]!==p?(y=(0,s.jsx)(S,{children:p}),e[23]=p,e[24]=y):y=e[24];let h;e[25]!==r.extendedDueAt?(h=be(r.extendedDueAt),e[25]=r.extendedDueAt,e[26]=h):h=e[26];let f;e[27]!==h?(f=(0,s.jsx)(S,{children:h}),e[27]=h,e[28]=f):f=e[28];let x;e[29]!==c||e[30]!==d?(x=c&&(0,s.jsx)(Y,{"data-testid":"privacy-overdue",variant:"destructive",children:d("Overdue")}),e[29]=c,e[30]=d,e[31]=x):x=e[31];let g;e[32]!==x?(g=(0,s.jsx)(S,{children:x}),e[32]=x,e[33]=g):g=e[33];let q;e[34]!==b||e[35]!==t||e[36]!==r.id||e[37]!==r.status||e[38]!==d?(q=r.status==="failed"&&(0,s.jsx)(de,{disabled:t,onClick:o(()=>{b(r.id)},"onClick"),size:"xs",variant:"outline",children:d("Retry")}),e[34]=b,e[35]=t,e[36]=r.id,e[37]=r.status,e[38]=d,e[39]=q):q=e[39];let A;e[40]!==q?(A=(0,s.jsx)(S,{children:q}),e[40]=q,e[41]=A):A=e[41];let j;return e[42]!==n||e[43]!==I||e[44]!==R||e[45]!==y||e[46]!==f||e[47]!==g||e[48]!==A||e[49]!==N||e[50]!==v||e[51]!==E||e[52]!==l||e[53]!==P?(j=(0,s.jsxs)(n,{className:I,"data-overdue":N,"data-testid":"privacy-request-row",children:[v,E,l,P,R,y,f,g,A]}),e[42]=n,e[43]=I,e[44]=R,e[45]=y,e[46]=f,e[47]=g,e[48]=A,e[49]=N,e[50]=v,e[51]=E,e[52]=l,e[53]=P,e[54]=j):j=e[54],j},"ge"),we=o(i=>{let e=(0,_.c)(95),{source:u}=i,t=X(),r=se(),b=(0,ue.useId)(),d;e[0]!==b?(d=[...Ae,b],e[0]=b,e[1]=d):d=e[1];let n=d,c;e[2]!==u?(c=o(async()=>({asOf:Date.now(),requests:await u.listOpenPrivacyRequests()}),"c"),e[2]=u,e[3]=c):c=e[3];let I;e[4]!==n||e[5]!==c?(I={queryKey:n,refetchInterval:6e4,queryFn:c,staleTime:0},e[4]=n,e[5]=c,e[6]=I):I=e[6];let N=ie(I),v;e[7]!==u?(v=o(a=>u.retryPrivacyRequest(a),"u"),e[7]=u,e[8]=v):v=e[8];let m;e[9]!==r||e[10]!==n?(m=o(async()=>{await r.invalidateQueries({queryKey:n})},"f"),e[9]=r,e[10]=n,e[11]=m):m=e[11];let E;e[12]!==v||e[13]!==m?(E={mutationFn:v,onSuccess:m},e[12]=v,e[13]=m,e[14]=E):E=e[14];let l=ae(E),T;e[15]!==l?(T=o(a=>{l.mutate(a)},"N"),e[15]=l,e[16]=T):T=e[16];let P=T;if(N.isPending){let a;e[17]!==t?(a=t("Loading privacy requests\u2026"),e[17]=t,e[18]=a):a=e[18];let D;return e[19]!==a?(D=(0,s.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"privacy-requests-loading",role:"status",children:a}),e[19]=a,e[20]=D):D=e[20],D}if(N.isError){let a;return e[21]!==N.error?(a=(0,s.jsx)(te,{error:N.error,testId:"privacy-requests-error"}),e[21]=N.error,e[22]=a):a=e[22],a}let{asOf:w,requests:R}=N.data;if(R.length===0){let a;e[23]!==t?(a=t("No open privacy requests."),e[23]=t,e[24]=a):a=e[24];let D;return e[25]!==a?(D=(0,s.jsx)(ee,{testId:"privacy-requests-empty",title:a}),e[25]=a,e[26]=D):D=e[26],D}let p;e[27]!==l.error||e[28]!==l.isError?(p=l.isError&&(0,s.jsx)(te,{error:l.error,testId:"privacy-retry-error"}),e[27]=l.error,e[28]=l.isError,e[29]=p):p=e[29];let y;e[30]!==t?(y=t("ID"),e[30]=t,e[31]=y):y=e[31];let h;e[32]!==y?(h=(0,s.jsx)(O,{children:y}),e[32]=y,e[33]=h):h=e[33];let f;e[34]!==t?(f=t("Type"),e[34]=t,e[35]=f):f=e[35];let x;e[36]!==f?(x=(0,s.jsx)(O,{children:f}),e[36]=f,e[37]=x):x=e[37];let g;e[38]!==t?(g=t("Subject"),e[38]=t,e[39]=g):g=e[39];let q;e[40]!==g?(q=(0,s.jsx)(O,{children:g}),e[40]=g,e[41]=q):q=e[41];let A;e[42]!==t?(A=t("Status"),e[42]=t,e[43]=A):A=e[43];let j;e[44]!==A?(j=(0,s.jsx)(O,{children:A}),e[44]=A,e[45]=j):j=e[45];let B;e[46]!==t?(B=t("Received"),e[46]=t,e[47]=B):B=e[47];let Q;e[48]!==B?(Q=(0,s.jsx)(O,{children:B}),e[48]=B,e[49]=Q):Q=e[49];let C;e[50]!==t?(C=t("Due"),e[50]=t,e[51]=C):C=e[51];let F;e[52]!==C?(F=(0,s.jsx)(O,{children:C}),e[52]=C,e[53]=F):F=e[53];let K;e[54]!==t?(K=t("Extended due"),e[54]=t,e[55]=K):K=e[55];let k;e[56]!==K?(k=(0,s.jsx)(O,{children:K}),e[56]=K,e[57]=k):k=e[57];let z;e[58]!==t?(z=t("Overdue"),e[58]=t,e[59]=z):z=e[59];let L;e[60]!==z?(L=(0,s.jsx)(O,{children:z}),e[60]=z,e[61]=L):L=e[61];let M;e[62]!==t?(M=t("Actions"),e[62]=t,e[63]=M):M=e[63];let G;e[64]!==M?(G=(0,s.jsx)(O,{children:M}),e[64]=M,e[65]=G):G=e[65];let H;e[66]!==h||e[67]!==x||e[68]!==q||e[69]!==j||e[70]!==Q||e[71]!==F||e[72]!==k||e[73]!==L||e[74]!==G?(H=(0,s.jsx)(ce,{children:(0,s.jsxs)(re,{children:[h,x,q,j,Q,F,k,L,G]})}),e[66]=h,e[67]=x,e[68]=q,e[69]=j,e[70]=Q,e[71]=F,e[72]=k,e[73]=L,e[74]=G,e[75]=H):H=e[75];let J;if(e[76]!==w||e[77]!==P||e[78]!==R||e[79]!==l.isPending||e[80]!==l.variables){let a;e[82]!==w||e[83]!==P||e[84]!==l.isPending||e[85]!==l.variables?(a=o(D=>(0,s.jsx)(Pe,{asOf:w,onRetry:P,retrying:l.isPending&&l.variables===D.id,row:D},D.id),"l"),e[82]=w,e[83]=P,e[84]=l.isPending,e[85]=l.variables,e[86]=a):a=e[86],J=R.map(a),e[76]=w,e[77]=P,e[78]=R,e[79]=l.isPending,e[80]=l.variables,e[81]=J}else J=e[81];let U;e[87]!==J?(U=(0,s.jsx)(oe,{children:J}),e[87]=J,e[88]=U):U=e[88];let V;e[89]!==H||e[90]!==U?(V=(0,s.jsxs)(ne,{children:[H,U]}),e[89]=H,e[90]=U,e[91]=V):V=e[91];let W;return e[92]!==V||e[93]!==p?(W=(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[p,V]}),e[92]=V,e[93]=p,e[94]=W):W=e[94],W},"Te"),Qe=o(i=>{let e=(0,_.c)(11),u;e[0]!==i?(u=i===void 0?{}:i,e[0]=i,e[1]=u):u=e[1];let{source:t}=u,r=X();if(t===void 0){let d;e[2]!==r?(d=r("Pass privacyRequests to the Studio to list and retry data-subject requests."),e[2]=r,e[3]=d):d=e[3];let n;e[4]!==r?(n=r("Privacy requests not configured"),e[4]=r,e[5]=n):n=e[5];let c;return e[6]!==d||e[7]!==n?(c=(0,s.jsx)(ee,{description:d,testId:"privacy-requests-not-configured",title:n}),e[6]=d,e[7]=n,e[8]=c):c=e[8],c}let b;return e[9]!==t?(b=(0,s.jsx)(we,{source:t}),e[9]=t,e[10]=b):b=e[10],b},"Be");export{Qe as PrivacyRequestsPanel};
1
+ import{a as de}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as Y}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as te}from"./chunk-IMF6DJKL.js";import"./chunk-OSJ7HV7B.js";import"./chunk-SL7LF2SO.js";import"./chunk-E26OT26O.js";import"./chunk-4SJDWMH3.js";import{k as se,l as ie,m as ae}from"./chunk-FKM35PXF.js";import"./chunk-WZTY3ZYI.js";import{a as ee}from"./chunk-3Y5K3IQO.js";import{a as ne,b as ce,c as oe,d as re,e as O,f as S}from"./chunk-CW57Q264.js";import{b as le,f as X,w as Z}from"./chunk-LPINY2IJ.js";import{a as o,d as $,e as ve,f as me,g as pe}from"./chunk-OXFKZ4BM.js";var _=$(me(),1);var ue=$(ve(),1);var s=$(pe(),1);var ye=new Set(["cancelled","completed","expired"]),he=o(i=>ye.has(i),"fe"),fe=o(i=>i.extendedDueAt??i.dueAt,"me"),xe=o(i=>!he(i)&&i!=="ready","ve"),ge=o((i,e)=>xe(i.status)&&e.getTime()>fe(i).getTime(),"pe"),qe=o((i,e)=>ge({dueAt:new Date(i.dueAt),status:i.status,...i.extendedDueAt===void 0||i.extendedDueAt===null?{}:{extendedDueAt:new Date(i.extendedDueAt)}},new Date(e)),"ye"),Ae=["studio","privacy-requests"],De={cancelled:"outline",completed:"success",expired:"outline",failed:"destructive",grace:"secondary",processing:"warning",ready:"success",received:"info"},be=o(i=>Z(i??void 0,"\u2014"),"Ae"),Pe=o(i=>{let e=(0,_.c)(55),{asOf:u,retrying:t,row:r,onRetry:b}=i,d=X(),n,c,I;e[0]!==u||e[1]!==r?(c=qe(r,u),n=re,I=le(c&&"bg-destructive/5"),e[0]=u,e[1]=r,e[2]=n,e[3]=c,e[4]=I):(n=e[2],c=e[3],I=e[4]);let N=c?"true":"false",v;e[5]!==r.id?(v=(0,s.jsx)(S,{className:"font-mono text-xs",children:r.id}),e[5]=r.id,e[6]=v):v=e[6];let m;e[7]!==r.type||e[8]!==d?(m=r.type==="export"?d("Export"):d("Erasure"),e[7]=r.type,e[8]=d,e[9]=m):m=e[9];let E;e[10]!==m?(E=(0,s.jsx)(S,{children:(0,s.jsx)(Y,{variant:"secondary",children:m})}),e[10]=m,e[11]=E):E=e[11];let l;e[12]!==r.subjectId?(l=(0,s.jsx)(S,{className:"font-mono text-xs",children:r.subjectId}),e[12]=r.subjectId,e[13]=l):l=e[13];let T=De[r.status],P;e[14]!==r.status||e[15]!==T?(P=(0,s.jsx)(S,{children:(0,s.jsx)(Y,{variant:T,children:r.status})}),e[14]=r.status,e[15]=T,e[16]=P):P=e[16];let w;e[17]!==r.receivedAt?(w=Z(r.receivedAt),e[17]=r.receivedAt,e[18]=w):w=e[18];let R;e[19]!==w?(R=(0,s.jsx)(S,{children:w}),e[19]=w,e[20]=R):R=e[20];let p;e[21]!==r.dueAt?(p=Z(r.dueAt),e[21]=r.dueAt,e[22]=p):p=e[22];let y;e[23]!==p?(y=(0,s.jsx)(S,{children:p}),e[23]=p,e[24]=y):y=e[24];let h;e[25]!==r.extendedDueAt?(h=be(r.extendedDueAt),e[25]=r.extendedDueAt,e[26]=h):h=e[26];let f;e[27]!==h?(f=(0,s.jsx)(S,{children:h}),e[27]=h,e[28]=f):f=e[28];let x;e[29]!==c||e[30]!==d?(x=c&&(0,s.jsx)(Y,{"data-testid":"privacy-overdue",variant:"destructive",children:d("Overdue")}),e[29]=c,e[30]=d,e[31]=x):x=e[31];let g;e[32]!==x?(g=(0,s.jsx)(S,{children:x}),e[32]=x,e[33]=g):g=e[33];let q;e[34]!==b||e[35]!==t||e[36]!==r.id||e[37]!==r.status||e[38]!==d?(q=r.status==="failed"&&(0,s.jsx)(de,{disabled:t,onClick:o(()=>{b(r.id)},"onClick"),size:"xs",variant:"outline",children:d("Retry")}),e[34]=b,e[35]=t,e[36]=r.id,e[37]=r.status,e[38]=d,e[39]=q):q=e[39];let A;e[40]!==q?(A=(0,s.jsx)(S,{children:q}),e[40]=q,e[41]=A):A=e[41];let j;return e[42]!==n||e[43]!==I||e[44]!==R||e[45]!==y||e[46]!==f||e[47]!==g||e[48]!==A||e[49]!==N||e[50]!==v||e[51]!==E||e[52]!==l||e[53]!==P?(j=(0,s.jsxs)(n,{className:I,"data-overdue":N,"data-testid":"privacy-request-row",children:[v,E,l,P,R,y,f,g,A]}),e[42]=n,e[43]=I,e[44]=R,e[45]=y,e[46]=f,e[47]=g,e[48]=A,e[49]=N,e[50]=v,e[51]=E,e[52]=l,e[53]=P,e[54]=j):j=e[54],j},"ge"),we=o(i=>{let e=(0,_.c)(95),{source:u}=i,t=X(),r=se(),b=(0,ue.useId)(),d;e[0]!==b?(d=[...Ae,b],e[0]=b,e[1]=d):d=e[1];let n=d,c;e[2]!==u?(c=o(async()=>({asOf:Date.now(),requests:await u.listOpenPrivacyRequests()}),"c"),e[2]=u,e[3]=c):c=e[3];let I;e[4]!==n||e[5]!==c?(I={queryKey:n,refetchInterval:6e4,queryFn:c,staleTime:0},e[4]=n,e[5]=c,e[6]=I):I=e[6];let N=ie(I),v;e[7]!==u?(v=o(a=>u.retryPrivacyRequest(a),"u"),e[7]=u,e[8]=v):v=e[8];let m;e[9]!==r||e[10]!==n?(m=o(async()=>{await r.invalidateQueries({queryKey:n})},"f"),e[9]=r,e[10]=n,e[11]=m):m=e[11];let E;e[12]!==v||e[13]!==m?(E={mutationFn:v,onSuccess:m},e[12]=v,e[13]=m,e[14]=E):E=e[14];let l=ae(E),T;e[15]!==l?(T=o(a=>{l.mutate(a)},"N"),e[15]=l,e[16]=T):T=e[16];let P=T;if(N.isPending){let a;e[17]!==t?(a=t("Loading privacy requests\u2026"),e[17]=t,e[18]=a):a=e[18];let D;return e[19]!==a?(D=(0,s.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"privacy-requests-loading",role:"status",children:a}),e[19]=a,e[20]=D):D=e[20],D}if(N.isError){let a;return e[21]!==N.error?(a=(0,s.jsx)(te,{error:N.error,testId:"privacy-requests-error"}),e[21]=N.error,e[22]=a):a=e[22],a}let{asOf:w,requests:R}=N.data;if(R.length===0){let a;e[23]!==t?(a=t("No open privacy requests."),e[23]=t,e[24]=a):a=e[24];let D;return e[25]!==a?(D=(0,s.jsx)(ee,{testId:"privacy-requests-empty",title:a}),e[25]=a,e[26]=D):D=e[26],D}let p;e[27]!==l.error||e[28]!==l.isError?(p=l.isError&&(0,s.jsx)(te,{error:l.error,testId:"privacy-retry-error"}),e[27]=l.error,e[28]=l.isError,e[29]=p):p=e[29];let y;e[30]!==t?(y=t("ID"),e[30]=t,e[31]=y):y=e[31];let h;e[32]!==y?(h=(0,s.jsx)(O,{children:y}),e[32]=y,e[33]=h):h=e[33];let f;e[34]!==t?(f=t("Type"),e[34]=t,e[35]=f):f=e[35];let x;e[36]!==f?(x=(0,s.jsx)(O,{children:f}),e[36]=f,e[37]=x):x=e[37];let g;e[38]!==t?(g=t("Subject"),e[38]=t,e[39]=g):g=e[39];let q;e[40]!==g?(q=(0,s.jsx)(O,{children:g}),e[40]=g,e[41]=q):q=e[41];let A;e[42]!==t?(A=t("Status"),e[42]=t,e[43]=A):A=e[43];let j;e[44]!==A?(j=(0,s.jsx)(O,{children:A}),e[44]=A,e[45]=j):j=e[45];let B;e[46]!==t?(B=t("Received"),e[46]=t,e[47]=B):B=e[47];let Q;e[48]!==B?(Q=(0,s.jsx)(O,{children:B}),e[48]=B,e[49]=Q):Q=e[49];let C;e[50]!==t?(C=t("Due"),e[50]=t,e[51]=C):C=e[51];let F;e[52]!==C?(F=(0,s.jsx)(O,{children:C}),e[52]=C,e[53]=F):F=e[53];let K;e[54]!==t?(K=t("Extended due"),e[54]=t,e[55]=K):K=e[55];let k;e[56]!==K?(k=(0,s.jsx)(O,{children:K}),e[56]=K,e[57]=k):k=e[57];let z;e[58]!==t?(z=t("Overdue"),e[58]=t,e[59]=z):z=e[59];let L;e[60]!==z?(L=(0,s.jsx)(O,{children:z}),e[60]=z,e[61]=L):L=e[61];let M;e[62]!==t?(M=t("Actions"),e[62]=t,e[63]=M):M=e[63];let G;e[64]!==M?(G=(0,s.jsx)(O,{children:M}),e[64]=M,e[65]=G):G=e[65];let H;e[66]!==h||e[67]!==x||e[68]!==q||e[69]!==j||e[70]!==Q||e[71]!==F||e[72]!==k||e[73]!==L||e[74]!==G?(H=(0,s.jsx)(ce,{children:(0,s.jsxs)(re,{children:[h,x,q,j,Q,F,k,L,G]})}),e[66]=h,e[67]=x,e[68]=q,e[69]=j,e[70]=Q,e[71]=F,e[72]=k,e[73]=L,e[74]=G,e[75]=H):H=e[75];let J;if(e[76]!==w||e[77]!==P||e[78]!==R||e[79]!==l.isPending||e[80]!==l.variables){let a;e[82]!==w||e[83]!==P||e[84]!==l.isPending||e[85]!==l.variables?(a=o(D=>(0,s.jsx)(Pe,{asOf:w,onRetry:P,retrying:l.isPending&&l.variables===D.id,row:D},D.id),"l"),e[82]=w,e[83]=P,e[84]=l.isPending,e[85]=l.variables,e[86]=a):a=e[86],J=R.map(a),e[76]=w,e[77]=P,e[78]=R,e[79]=l.isPending,e[80]=l.variables,e[81]=J}else J=e[81];let U;e[87]!==J?(U=(0,s.jsx)(oe,{children:J}),e[87]=J,e[88]=U):U=e[88];let V;e[89]!==H||e[90]!==U?(V=(0,s.jsxs)(ne,{children:[H,U]}),e[89]=H,e[90]=U,e[91]=V):V=e[91];let W;return e[92]!==V||e[93]!==p?(W=(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[p,V]}),e[92]=V,e[93]=p,e[94]=W):W=e[94],W},"Te"),Qe=o(i=>{let e=(0,_.c)(11),u;e[0]!==i?(u=i===void 0?{}:i,e[0]=i,e[1]=u):u=e[1];let{source:t}=u,r=X();if(t===void 0){let d;e[2]!==r?(d=r("Pass privacyRequests to the Studio to list and retry data-subject requests."),e[2]=r,e[3]=d):d=e[3];let n;e[4]!==r?(n=r("Privacy requests not configured"),e[4]=r,e[5]=n):n=e[5];let c;return e[6]!==d||e[7]!==n?(c=(0,s.jsx)(ee,{description:d,testId:"privacy-requests-not-configured",title:n}),e[6]=d,e[7]=n,e[8]=c):c=e[8],c}let b;return e[9]!==t?(b=(0,s.jsx)(we,{source:t}),e[9]=t,e[10]=b):b=e[10],b},"Be");export{Qe as PrivacyRequestsPanel};
@@ -1,4 +1,4 @@
1
- import{a as Er,b as ft,c as zr,d as bn}from"./chunk-3MQ477EE.js";import{a as fn}from"./chunk-X74GEPSG.js";import{c as gn}from"./chunk-4SQBAPY6.js";import{d as Lr}from"./chunk-UYEZR3BI.js";import{a as pn,b as Le,f as Hr,g as $r}from"./chunk-DS7HZKZ2.js";import{a as mn}from"./chunk-7RGYCU6F.js";import{a as Ge}from"./chunk-Z5EV64KS.js";import"./chunk-CTE6RPXC.js";import"./chunk-LIGOLZND.js";import"./chunk-3GXPALXG.js";import{a as dn}from"./chunk-YJWR6ZWC.js";import{a as $t}from"./chunk-NMVFSJM7.js";import{a as co}from"./chunk-OUFWXYEF.js";import{a as un}from"./chunk-HKPDPKXD.js";import{a as cn,b as Vr}from"./chunk-W4X4J7BU.js";import{b as Rr,c as lo}from"./chunk-DX55P3KZ.js";import"./chunk-AP4PC2M4.js";import"./chunk-KRPXOSBL.js";import"./chunk-W2BCSK5S.js";import{a as uo}from"./chunk-6QEXGYWH.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import{a as io}from"./chunk-ZWDORIZY.js";import{a as Pr}from"./chunk-KYONGQQ4.js";import{a as Mr,b as kr}from"./chunk-SLIDAWNX.js";import{b as Ir,c as Fr,f as ao}from"./chunk-6M7FLLMT.js";import{c as wr,d as xr,e as Sr,f as st,g as rn,h as _r,i as Cr}from"./chunk-LUHXNZI4.js";import"./chunk-ZTOREMGH.js";import{i as vr}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as ln}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import{a as Ce}from"./chunk-6UTZXEW3.js";import{b as ro,c as it}from"./chunk-ZKPRORLI.js";import{e as to,f as no,g as on,h as hr,p as nt}from"./chunk-OIDFWEJX.js";import"./chunk-WZTY3ZYI.js";import{a as an}from"./chunk-3Y5K3IQO.js";import{a as Nr,b as Dr,c as Ar,d as so,e as Or,f as Tr}from"./chunk-CW57Q264.js";import{b as gt,f as te,h as He,i as $e,j as Ht,p as oo,q as sn,r as Ee,s as ne,w as yr}from"./chunk-LPINY2IJ.js";import{a as o,d as Me,e as mt,f as Et,g as zt}from"./chunk-OXFKZ4BM.js";var Vs=Me(Et(),1);var Ot=Me(mt(),1);var q=Me(Et(),1),D=Me(mt(),1);var Rt=Me(Et(),1);var Y=Me(zt(),1),ot=Me(mt(),1);var fi=2166136261,pi=16777619,bi=o((t,e=fi)=>{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")},"L"),hi=/([a-z\d])([A-Z])/gu,wi=/[\s_-]+/u,xi=new Set(["access_token","api_key","apikey","card_number","client_secret","credit_card","cvv","passwd","password","private_key","pwd","refresh_token","secret","ssn","token"]),Si=o(t=>{let e=t.replaceAll(hi,"$1 $2").split(wi).map(l=>l.toLowerCase()).filter(l=>l.length>0),n=new Set(e);for(let l=0;l<e.length-1;l+=1){let r=e[l],a=e[l+1];r===void 0||a===void 0||(n.add(`${r}${a}`),n.add(`${r}_${a}`))}return[...n]},"ae"),jr="\u2022\u2022\u2022",Jr=o((t,e)=>{try{return e==="redact"?null:e==="hash"?t==null?t:bi(typeof t=="bigint"?t.toString():typeof t=="string"?t:JSON.stringify(t)):jr}catch{return jr}},"U"),Br=o((t,e)=>{let n=new Map;for(let l of t)l.table===e&&n.set(l.column,l.strategy);return n},"V"),_i=o(t=>{for(let e of Si(t))if(xi.has(e))return!0;return!1},"ce"),Gr=o((t,e)=>{let n=e.filter(r=>!t.has(r)&&_i(r));if(n.length===0)return t;let l=new Map(t);for(let r of n)l.set(r,"redact");return l},"j"),Lt=o((t,e,n)=>{if(!n.enabled)return t;let l=n.columns.get(e);return l===void 0?t:Jr(t,l)},"_e"),hn=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]=Jr(n[l],r));return n},"ie"),wn=o((t,e)=>!e.enabled||e.columns.size===0?t:t.map(n=>hn(n,e)),"Me"),qr=o(t=>t==null?"\u2205":t===""?"(empty)":Ee(t),"z"),Ci=o(t=>{let e=(0,Rt.c)(32),{column:n,onFacetFilter:l,state:r}=t,a=te(),s;e[0]!==n||e[1]!==l||e[2]!==r.result?.values?(s=o(w=>{let _=Number(w.currentTarget.dataset.index),S=r.result?.values[_];S!==void 0&&l(n,S.value)},"x"),e[0]=n,e[1]=l,e[2]=r.result?.values,e[3]=s):s=e[3];let i=s,c=`db-facet-${n}`,u;e[4]!==n?(u=(0,Y.jsx)("span",{className:"font-medium text-foreground",children:n}),e[4]=n,e[5]=u):u=e[5];let d;e[6]!==r.loading||e[7]!==r.result||e[8]!==a?(d=r.loading&&r.result===null&&(0,Y.jsx)("span",{className:"text-muted-foreground",children:a("Loading\u2026")}),e[6]=r.loading,e[7]=r.result,e[8]=a,e[9]=d):d=e[9];let g;e[10]!==r.error?(g=r.error!==null&&(0,Y.jsx)("span",{className:"text-destructive",role:"alert",children:r.error}),e[10]=r.error,e[11]=g):g=e[11];let m;e[12]!==r.result?.values?(m=r.result?.values??[],e[12]=r.result?.values,e[13]=m):m=e[13];let h;if(e[14]!==n||e[15]!==i||e[16]!==m){let w;e[18]!==n||e[19]!==i?(w=o((_,S)=>(0,Y.jsxs)("button",{className:"flex items-center justify-between gap-2 rounded px-1 py-0.5 text-left text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground","data-index":S,"data-testid":`db-facet-value-${n}`,onClick:i,type:"button",children:[(0,Y.jsx)("span",{className:"truncate",children:qr(_.value)}),(0,Y.jsx)("span",{className:"shrink-0 tabular-nums text-foreground/70",children:_.count})]},qr(_.value)),"c"),e[18]=n,e[19]=i,e[20]=w):w=e[20],h=m.map(w),e[14]=n,e[15]=i,e[16]=m,e[17]=h}else h=e[17];let p;e[21]!==n||e[22]!==r.result||e[23]!==a?(p=r.result?.truncated===!0&&(0,Y.jsx)("span",{className:"text-muted-foreground","data-testid":`db-facet-truncated-${n}`,children:a("Showing the {n} most common values.",{n:r.result.values.length})}),e[21]=n,e[22]=r.result,e[23]=a,e[24]=p):p=e[24];let b;return e[25]!==c||e[26]!==u||e[27]!==d||e[28]!==g||e[29]!==h||e[30]!==p?(b=(0,Y.jsxs)("section",{className:"flex flex-col gap-1","data-testid":c,children:[u,d,g,h,p]}),e[25]=c,e[26]=u,e[27]=d,e[28]=g,e[29]=h,e[30]=p,e[31]=b):b=e[31],b},"ue"),xn=o(t=>{let e=(0,Rt.c)(44),{columns:n,facets:l,mask:r,onFacetFilter:a,onToggleFacet:s}=t,i=te(),c;e[0]!==s?(c=o(v=>{let{column:F}=v.currentTarget.dataset;F!==void 0&&s(F)},"o"),e[0]=s,e[1]=c):c=e[1];let u=c,d;e[2]!==r?(d=o(v=>r.enabled&&r.columns.has(v),"a"),e[2]=r,e[3]=d):d=e[3];let g=d,m,h,p,b,w,_,S,y;if(e[4]!==n||e[5]!==l||e[6]!==g||e[7]!==i||e[8]!==u){y=Symbol.for("react.early_return_sentinel");e:{let v;e[17]!==g?(v=o(M=>!g(M),"y"),e[17]=g,e[18]=v):v=e[18];let F=n.filter(v),N;if(e[19]!==l||e[20]!==g?(N=Object.entries(l).filter(M=>{let[O]=M;return!g(O)}),e[19]=l,e[20]=g,e[21]=N):N=e[21],m=N,F.length===0){y=null;break e}_="flex w-56 shrink-0 flex-col gap-3 overflow-auto border-l border-border p-3 text-xs",S="db-facets",b="flex flex-col gap-1.5";let k;e[22]!==i?(k=i("Facets"),e[22]=i,e[23]=k):k=e[23],e[24]!==k?(w=(0,Y.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:k}),e[24]=k,e[25]=w):w=e[25],h="flex flex-wrap gap-1";let P;e[26]!==l||e[27]!==u?(P=o(M=>(0,Y.jsx)("button",{"aria-pressed":M 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":M,"data-testid":`db-facet-toggle-${M}`,onClick:u,type:"button",children:M},M),"A"),e[26]=l,e[27]=u,e[28]=P):P=e[28],p=F.map(P)}e[4]=n,e[5]=l,e[6]=g,e[7]=i,e[8]=u,e[9]=m,e[10]=h,e[11]=p,e[12]=b,e[13]=w,e[14]=_,e[15]=S,e[16]=y}else m=e[9],h=e[10],p=e[11],b=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]!==h||e[30]!==p?(I=(0,Y.jsx)("div",{className:h,children:p}),e[29]=h,e[30]=p,e[31]=I):I=e[31];let C;e[32]!==I||e[33]!==b||e[34]!==w?(C=(0,Y.jsxs)("div",{className:b,children:[w,I]}),e[32]=I,e[33]=b,e[34]=w,e[35]=C):C=e[35];let R;e[36]!==a||e[37]!==m?(R=m.map(v=>{let[F,N]=v;return(0,Y.jsx)(Ci,{column:F,onFacetFilter:a,state:N},F)}),e[36]=a,e[37]=m,e[38]=R):R=e[38];let x;return e[39]!==C||e[40]!==R||e[41]!==_||e[42]!==S?(x=(0,Y.jsxs)("aside",{className:_,"data-testid":S,children:[C,R]}),e[39]=C,e[40]=R,e[41]=_,e[42]=S,e[43]=x):x=e[43],x},"Te"),Sn=o(()=>{let[t,e]=(0,ot.useState)({}),n=Ge(t),l=(0,ot.useRef)({}),r=o(async(a,s)=>{let i=(l.current[a]??0)+1;l.current[a]=i,e(c=>a in c?{...c,[a]:{error:null,loading:!0,result:c[a]?.result??null}}:c);try{let c=await s(a);if(l.current[a]!==i)return;e(u=>a in u?{...u,[a]:{error:null,loading:!1,result:c}}:u)}catch(c){if(l.current[a]!==i)return;throw e(u=>a in u?{...u,[a]:{error:Ht(c),loading:!1,result:null}}:u),c}},"n");return{clearFacets:o(()=>{e({})},"clearFacets"),facets:t,facetsRef:n,refetchFacets:o(a=>Vr(Object.keys(n.current).map(s=>r(s,a))),"refetchFacets"),toggleFacet:o((a,s)=>{if(a in n.current){e(i=>Object.fromEntries(Object.entries(i).filter(([c])=>c!==a)));return}e(i=>({...i,[a]:{error:null,loading:!0,result:null}})),s!==null&&ne(r(a,s))},"toggleFacet")}},"$e"),vi=[],yi=o(()=>{let t=(0,Rt.c)(1),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={},t[0]=e):e=t[0];let{data:n}=it(Ce.maskPolicies,e);return Array.isArray(n?.columns)?n.columns:vi},"fe"),_n=o(t=>{let e=(0,Rt.c)(16),{columns:n,selectedTable:l}=t,r=yi(),[a,s]=(0,ot.useState)(!0),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o(()=>{s(Ri)},"g"),e[0]=i):i=e[0];let c=i,u;if(e[1]!==n||e[2]!==r||e[3]!==l){let b=Br(r,l??"");u=Gr(b,n),e[1]=n,e[2]=r,e[3]=l,e[4]=u}else u=e[4];let d=u,g;e[5]!==a||e[6]!==r?(g=o((b,w)=>({columns:Gr(Br(r,b),w),enabled:a}),"l"),e[5]=a,e[6]=r,e[7]=g):g=e[7];let m=g,h;e[8]!==d||e[9]!==a?(h={columns:d,enabled:a},e[8]=d,e[9]=a,e[10]=h):h=e[10];let p;return e[11]!==d||e[12]!==a||e[13]!==m||e[14]!==h?(p={maskColumns:d,maskOn:a,maskView:h,maskViewFor:m,onToggleMask:c},e[11]=d,e[12]=a,e[13]=m,e[14]=h,e[15]=p):p=e[15],p},"Re");function Ri(t){return!t}o(Ri,"me");var Kr=34,Ur=600,Ii=o(t=>{let e=(0,Rt.c)(21),{item:n,onSelect:l,prefix:r,selected:a,start:s}=t,i;e[0]!==n.name||e[1]!==l?(i=o(()=>{l(n.name)},"g"),e[0]=n.name,e[1]=l,e[2]=i):i=e[2];let c=i,u=`translateY(${String(s)}px)`,d;e[3]!==u?(d={insetInline:0,position:"absolute",top:0,transform:u},e[3]=u,e[4]=d):d=e[4];let g=d,m=a?"bg-accent font-medium text-accent-foreground":"text-foreground",h;e[5]!==m?(h=gt("flex w-full items-center justify-between gap-2 rounded-md px-2 py-1.5 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent",m),e[5]=m,e[6]=h):h=e[6];let p=`${r}-table-${n.name}`,b;e[7]!==n.name?(b=(0,Y.jsx)("span",{className:"truncate",children:n.name}),e[7]=n.name,e[8]=b):b=e[8];let w;e[9]!==n.rowCount?(w=(0,Y.jsx)("span",{className:"shrink-0 rounded bg-muted px-1.5 text-xs tabular-nums text-muted-foreground",children:n.rowCount}),e[9]=n.rowCount,e[10]=w):w=e[10];let _;e[11]!==c||e[12]!==a||e[13]!==h||e[14]!==p||e[15]!==b||e[16]!==w?(_=(0,Y.jsxs)("button",{"aria-pressed":a,className:h,"data-testid":p,onClick:c,type:"button",children:[b,w]}),e[11]=c,e[12]=a,e[13]=h,e[14]=p,e[15]=b,e[16]=w,e[17]=_):_=e[17];let S;return e[18]!==g||e[19]!==_?(S=(0,Y.jsx)("li",{style:g,children:_}),e[18]=g,e[19]=_,e[20]=S):S=e[20],S},"ge"),Cn=o(({header:t,onReload:e,onSelect:n,prefix:l,reloadLabel:r,selected:a,tables:s})=>{let i=te(),[c,u]=(0,ot.useState)(""),d=(0,ot.useRef)(null),g=o(b=>{u(b.target.value)},"l"),m=(0,ot.useMemo)(()=>{let b=c.trim().toLowerCase();return b===""?s:s.filter(w=>w.name.toLowerCase().includes(b))},[c,s]),h=gn({count:m.length,estimateSize:o(()=>Kr,"estimateSize"),getScrollElement:o(()=>d.current,"getScrollElement"),initialRect:{height:Ur,width:240},observeElementRect:o((b,w)=>fn(b,w,Ur),"observeElementRect"),overscan:12}).getVirtualItems(),p={height:m.length*Kr};return(0,Y.jsxs)("aside",{className:"flex h-full w-60 shrink-0 flex-col border-e border-border bg-sidebar","data-testid":`${l}-table-list`,children:[t,(0,Y.jsxs)("div",{className:"flex h-9 shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[(0,Y.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:i("Tables")}),e!==void 0&&(0,Y.jsx)("button",{"aria-label":r??i("Refresh"),className:"flex size-6 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent","data-testid":`${l}-load-tables`,onClick:e,title:r??i("Refresh"),type:"button",children:(0,Y.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,Y.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})})})]}),(0,Y.jsx)("div",{className:"shrink-0 border-b border-border p-2",children:(0,Y.jsx)("input",{className:"h-7 w-full rounded-md border border-border bg-background px-2 text-xs outline-none placeholder:text-muted-foreground focus-visible:border-ring","data-testid":`${l}-table-search`,onChange:g,placeholder:i("search table\u2026"),type:"search",value:c})}),(0,Y.jsxs)("ul",{className:"relative flex-1 overflow-y-auto p-1.5","data-testid":`${l}-table-list-rows`,ref:d,children:[(0,Y.jsx)("li",{"aria-hidden":"true",style:p}),h.map(b=>{let w=m[b.index];return w===void 0?null:(0,Y.jsx)(Ii,{item:w,onSelect:n,prefix:l,selected:a===w.name,start:b.start},w.name)})]})]})},"Ae");var f=Me(zt(),1);var Wr=Me(mt(),1);function Fi(t){return Mi(t)||typeof t=="function"||ki(t)}o(Fi,"isReactComponent");function Mi(t){return typeof t=="function"&&(()=>{let e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}o(Mi,"isClassComponent");function ki(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}o(ki,"isExoticComponent");function pt(t,e){return t==null?null:Fi(t)?Wr.default.createElement(t,e):t}o(pt,"flexRender");function mo(t){if("cell"in t&&t.cell){let e=t.cell,n=e.column.columnDef,l=e,r=n;return l.getIsAggregated?.()?pt(r.aggregatedCell??n.cell,e.getContext()):l.getIsPlaceholder?.()?null:pt(n.cell,e.getContext())}return"header"in t&&t.header?pt(t.header.column.columnDef.header,t.header.getContext()):"footer"in t&&t.footer?pt(t.footer.column.columnDef.footer,t.footer.getContext()):null}o(mo,"FlexRender");function Qr(t){let e=rn(t.source,t.selector,{compare:st});return typeof t.children=="function"?t.children(e):t.children}o(Qr,"Subscribe");function Xr(t){let e=t;return Object.defineProperty(t,"state",{get(){return t.get()}}),"set"in t&&(e.setState=t.set.bind(t)),e}o(Xr,"atomToStore");function go(t){let{createAtom:e,batch:n}=t,l=e(0);return{createOptionsStore:!1,wrapExternalAtoms:!1,addSubscription:o(()=>{throw new Error("Feature not supported in current reactivity implementation")},"addSubscription"),unmount:o(()=>{throw new Error("Feature not supported in current reactivity implementation")},"unmount"),schedule:t.schedule??(r=>queueMicrotask(r)),batch:n,untrack:o(r=>r(),"untrack"),createReadonlyAtom:o((r,a)=>{let s=a?.compare??Object.is,i=!1,c,u=o(()=>{let g=r();return(!i||!s(c,g))&&(c=g,i=!0),c},"getSnapshot"),d=e(()=>(l.get(),u()),{compare:s});return{get:u,subscribe:d.subscribe.bind(d)}},"createReadonlyAtom"),createWritableAtom:o((r,a)=>e(r,{compare:a?.compare}),"createWritableAtom"),commit:o(()=>{l.set(r=>r+1)},"commit")}}o(go,"renderPhaseReactivity");function fo(t,e=Object.is){let n=!1,l;return{get:t.get,markCommitted:o(r=>{l=r,n=!0},"markCommitted"),subscribe:o(r=>t.subscribe(a=>{(!n||!e(l,a))&&r(a)}),"subscribe")}}o(fo,"createRenderPhaseSource");function Yr(){return go({createAtom:Sr,batch:xr})}o(Yr,"reactReactivity");function It(t,e){return typeof t=="function"?t(e):t}o(It,"functionalUpdate");function ie(t){if(Array.isArray(t))return t.map(ie);if(t&&typeof t=="object"){let e=Object.getPrototypeOf(t);if(e!==Object.prototype&&e!==null)return t;let n=e===null?$():{},l=Object.keys(t);for(let r=0;r<l.length;r++){let a=l[r];Object.defineProperty(n,a,{configurable:!0,enumerable:!0,value:ie(t[a]),writable:!0})}return n}return t}o(ie,"cloneState");function vn(t,e){let n=Object.keys(e),l=t;for(let r=0;r<n.length;r++){let a=n[r];!a.startsWith("_memo_")&&a!=="_cellsCache"&&(l[a]=e[a])}return t}o(vn,"copyInstancePropertiesWithoutMemos");function $(){return Object.create(null)}o($,"makeObjectMap");function qe(t,e){return Object.prototype.hasOwnProperty.call(t,e)}o(qe,"hasOwn");function Ke(t,e){return n=>{(e.options.atoms?.[t]??e.baseAtoms[t]).set(l=>It(n,l))}}o(Ke,"makeStateUpdater");function Zr(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(Zr,"isPlainContainer");function el(t){return Reflect.ownKeys(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}o(el,"getEnumerableOwnKeys");var Pi=3;function Ni(t,e){return tl(t,e,Pi)}o(Ni,"stateSlicesEqual");function tl(t,e,n){if(Object.is(t,e))return!0;if(n<=0||!Zr(t)||!Zr(e)||(Array.isArray(t)||Array.isArray(e))&&(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length))return!1;let l=el(t),r=el(e);if(l.length!==r.length)return!1;let a=t,s=e;for(let i=0;i<l.length;i++){let c=l[i];if(!Object.prototype.propertyIsEnumerable.call(e,c)||!tl(a[c],s[c],n-1))return!1}return!0}o(tl,"stateSlicesEqualAtDepth");function je(t,e,n,l=Ni){let r=`on${e.charAt(0).toUpperCase()}${e.slice(1)}Change`,a=t.options[r];a&&a(s=>{let i=It(n,s);return l(s,i)?s:i})}o(je,"setStateSlice");function nl(t){return t instanceof Function}o(nl,"isFunction");function ol(t,e){let n=[],l=o(r=>{r.forEach(a=>{n.push(a);let s=e(a);s.length&&l(s)})},"recurse");return l(t),n}o(ol,"flattenBy");var Di=o(({fn:t,memoDeps:e,onAfterCompare:n,onAfterUpdate:l,onBeforeCompare:r,onBeforeUpdate:a})=>{let s=[],i;return o(u=>{r?.();let d=e?.(u),g=!d||d.length!==s?.length;if(!g&&d){for(let m=0;m<d.length;m++)if(d[m]!==s[m]){g=!0;break}}return n?.(g),g&&(s=d,a?.(),i=t(...d??[]),l?.(i)),i},"memoizedFn")},"memo");function yn(t){let e=!1;return()=>{if(!e){e=!0;return}t()}}o(yn,"skipFirstRun");var Ai=o((t,e)=>{for(t=String(t);t.length<e;)t=" "+t;return t},"pad");function Ft({feature:t,fnName:e,objectId:n,onAfterUpdate:l,table:r,...a}){let s,i,c=0,u;function d(h,p){let b=c===0?"(1st run)":p?"(rerun #"+c+")":"(cache)";c++,console.groupCollapsed(`%c\u23F1 ${Ai(`${h.toFixed(1)} ms`,12)} %c${b}%c ${e}%c ${n?`(${e.split(".")[0]}Id: ${n})`:""}`,`font-size: .6rem; font-weight: bold; ${p?`color: hsl(
1
+ import{a as Er,b as ft,c as zr,d as bn}from"./chunk-N5FOHLIG.js";import{a as fn}from"./chunk-X74GEPSG.js";import{c as gn}from"./chunk-4SQBAPY6.js";import{d as Lr}from"./chunk-UYEZR3BI.js";import{a as pn,b as Le,f as Hr,g as $r}from"./chunk-DS7HZKZ2.js";import{a as mn}from"./chunk-7RGYCU6F.js";import{a as Ge}from"./chunk-Z5EV64KS.js";import"./chunk-CTE6RPXC.js";import"./chunk-LIGOLZND.js";import"./chunk-3GXPALXG.js";import{a as dn}from"./chunk-YJWR6ZWC.js";import{a as $t}from"./chunk-NMVFSJM7.js";import{a as co}from"./chunk-OUFWXYEF.js";import{a as un}from"./chunk-HKPDPKXD.js";import{a as cn,b as Vr}from"./chunk-ILLDX6LU.js";import{b as Rr,c as lo}from"./chunk-DX55P3KZ.js";import"./chunk-AP4PC2M4.js";import"./chunk-KRPXOSBL.js";import"./chunk-W2BCSK5S.js";import{a as uo}from"./chunk-6QEXGYWH.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import{a as io}from"./chunk-ZWDORIZY.js";import{a as Pr}from"./chunk-KYONGQQ4.js";import{a as Mr,b as kr}from"./chunk-SLIDAWNX.js";import{b as Ir,c as Fr,f as ao}from"./chunk-6M7FLLMT.js";import{c as wr,d as xr,e as Sr,f as st,g as rn,h as _r,i as Cr}from"./chunk-LUHXNZI4.js";import"./chunk-ZTOREMGH.js";import{i as vr}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as ln}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import{a as Ce}from"./chunk-6UTZXEW3.js";import{b as ro,c as it}from"./chunk-4SJDWMH3.js";import{e as to,f as no,g as on,h as hr,p as nt}from"./chunk-FKM35PXF.js";import"./chunk-WZTY3ZYI.js";import{a as an}from"./chunk-3Y5K3IQO.js";import{a as Nr,b as Dr,c as Ar,d as so,e as Or,f as Tr}from"./chunk-CW57Q264.js";import{b as gt,f as te,h as He,i as $e,j as Ht,p as oo,q as sn,r as Ee,s as ne,w as yr}from"./chunk-LPINY2IJ.js";import{a as o,d as Me,e as mt,f as Et,g as zt}from"./chunk-OXFKZ4BM.js";var Vs=Me(Et(),1);var Ot=Me(mt(),1);var q=Me(Et(),1),D=Me(mt(),1);var Rt=Me(Et(),1);var Y=Me(zt(),1),ot=Me(mt(),1);var fi=2166136261,pi=16777619,bi=o((t,e=fi)=>{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")},"L"),hi=/([a-z\d])([A-Z])/gu,wi=/[\s_-]+/u,xi=new Set(["access_token","api_key","apikey","card_number","client_secret","credit_card","cvv","passwd","password","private_key","pwd","refresh_token","secret","ssn","token"]),Si=o(t=>{let e=t.replaceAll(hi,"$1 $2").split(wi).map(l=>l.toLowerCase()).filter(l=>l.length>0),n=new Set(e);for(let l=0;l<e.length-1;l+=1){let r=e[l],a=e[l+1];r===void 0||a===void 0||(n.add(`${r}${a}`),n.add(`${r}_${a}`))}return[...n]},"ae"),jr="\u2022\u2022\u2022",Jr=o((t,e)=>{try{return e==="redact"?null:e==="hash"?t==null?t:bi(typeof t=="bigint"?t.toString():typeof t=="string"?t:JSON.stringify(t)):jr}catch{return jr}},"U"),Br=o((t,e)=>{let n=new Map;for(let l of t)l.table===e&&n.set(l.column,l.strategy);return n},"V"),_i=o(t=>{for(let e of Si(t))if(xi.has(e))return!0;return!1},"ce"),Gr=o((t,e)=>{let n=e.filter(r=>!t.has(r)&&_i(r));if(n.length===0)return t;let l=new Map(t);for(let r of n)l.set(r,"redact");return l},"j"),Lt=o((t,e,n)=>{if(!n.enabled)return t;let l=n.columns.get(e);return l===void 0?t:Jr(t,l)},"_e"),hn=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]=Jr(n[l],r));return n},"ie"),wn=o((t,e)=>!e.enabled||e.columns.size===0?t:t.map(n=>hn(n,e)),"Me"),qr=o(t=>t==null?"\u2205":t===""?"(empty)":Ee(t),"z"),Ci=o(t=>{let e=(0,Rt.c)(32),{column:n,onFacetFilter:l,state:r}=t,a=te(),s;e[0]!==n||e[1]!==l||e[2]!==r.result?.values?(s=o(w=>{let _=Number(w.currentTarget.dataset.index),S=r.result?.values[_];S!==void 0&&l(n,S.value)},"x"),e[0]=n,e[1]=l,e[2]=r.result?.values,e[3]=s):s=e[3];let i=s,c=`db-facet-${n}`,u;e[4]!==n?(u=(0,Y.jsx)("span",{className:"font-medium text-foreground",children:n}),e[4]=n,e[5]=u):u=e[5];let d;e[6]!==r.loading||e[7]!==r.result||e[8]!==a?(d=r.loading&&r.result===null&&(0,Y.jsx)("span",{className:"text-muted-foreground",children:a("Loading\u2026")}),e[6]=r.loading,e[7]=r.result,e[8]=a,e[9]=d):d=e[9];let g;e[10]!==r.error?(g=r.error!==null&&(0,Y.jsx)("span",{className:"text-destructive",role:"alert",children:r.error}),e[10]=r.error,e[11]=g):g=e[11];let m;e[12]!==r.result?.values?(m=r.result?.values??[],e[12]=r.result?.values,e[13]=m):m=e[13];let h;if(e[14]!==n||e[15]!==i||e[16]!==m){let w;e[18]!==n||e[19]!==i?(w=o((_,S)=>(0,Y.jsxs)("button",{className:"flex items-center justify-between gap-2 rounded px-1 py-0.5 text-left text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground","data-index":S,"data-testid":`db-facet-value-${n}`,onClick:i,type:"button",children:[(0,Y.jsx)("span",{className:"truncate",children:qr(_.value)}),(0,Y.jsx)("span",{className:"shrink-0 tabular-nums text-foreground/70",children:_.count})]},qr(_.value)),"c"),e[18]=n,e[19]=i,e[20]=w):w=e[20],h=m.map(w),e[14]=n,e[15]=i,e[16]=m,e[17]=h}else h=e[17];let p;e[21]!==n||e[22]!==r.result||e[23]!==a?(p=r.result?.truncated===!0&&(0,Y.jsx)("span",{className:"text-muted-foreground","data-testid":`db-facet-truncated-${n}`,children:a("Showing the {n} most common values.",{n:r.result.values.length})}),e[21]=n,e[22]=r.result,e[23]=a,e[24]=p):p=e[24];let b;return e[25]!==c||e[26]!==u||e[27]!==d||e[28]!==g||e[29]!==h||e[30]!==p?(b=(0,Y.jsxs)("section",{className:"flex flex-col gap-1","data-testid":c,children:[u,d,g,h,p]}),e[25]=c,e[26]=u,e[27]=d,e[28]=g,e[29]=h,e[30]=p,e[31]=b):b=e[31],b},"ue"),xn=o(t=>{let e=(0,Rt.c)(44),{columns:n,facets:l,mask:r,onFacetFilter:a,onToggleFacet:s}=t,i=te(),c;e[0]!==s?(c=o(v=>{let{column:F}=v.currentTarget.dataset;F!==void 0&&s(F)},"o"),e[0]=s,e[1]=c):c=e[1];let u=c,d;e[2]!==r?(d=o(v=>r.enabled&&r.columns.has(v),"a"),e[2]=r,e[3]=d):d=e[3];let g=d,m,h,p,b,w,_,S,y;if(e[4]!==n||e[5]!==l||e[6]!==g||e[7]!==i||e[8]!==u){y=Symbol.for("react.early_return_sentinel");e:{let v;e[17]!==g?(v=o(M=>!g(M),"y"),e[17]=g,e[18]=v):v=e[18];let F=n.filter(v),N;if(e[19]!==l||e[20]!==g?(N=Object.entries(l).filter(M=>{let[O]=M;return!g(O)}),e[19]=l,e[20]=g,e[21]=N):N=e[21],m=N,F.length===0){y=null;break e}_="flex w-56 shrink-0 flex-col gap-3 overflow-auto border-l border-border p-3 text-xs",S="db-facets",b="flex flex-col gap-1.5";let k;e[22]!==i?(k=i("Facets"),e[22]=i,e[23]=k):k=e[23],e[24]!==k?(w=(0,Y.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:k}),e[24]=k,e[25]=w):w=e[25],h="flex flex-wrap gap-1";let P;e[26]!==l||e[27]!==u?(P=o(M=>(0,Y.jsx)("button",{"aria-pressed":M 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":M,"data-testid":`db-facet-toggle-${M}`,onClick:u,type:"button",children:M},M),"A"),e[26]=l,e[27]=u,e[28]=P):P=e[28],p=F.map(P)}e[4]=n,e[5]=l,e[6]=g,e[7]=i,e[8]=u,e[9]=m,e[10]=h,e[11]=p,e[12]=b,e[13]=w,e[14]=_,e[15]=S,e[16]=y}else m=e[9],h=e[10],p=e[11],b=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]!==h||e[30]!==p?(I=(0,Y.jsx)("div",{className:h,children:p}),e[29]=h,e[30]=p,e[31]=I):I=e[31];let C;e[32]!==I||e[33]!==b||e[34]!==w?(C=(0,Y.jsxs)("div",{className:b,children:[w,I]}),e[32]=I,e[33]=b,e[34]=w,e[35]=C):C=e[35];let R;e[36]!==a||e[37]!==m?(R=m.map(v=>{let[F,N]=v;return(0,Y.jsx)(Ci,{column:F,onFacetFilter:a,state:N},F)}),e[36]=a,e[37]=m,e[38]=R):R=e[38];let x;return e[39]!==C||e[40]!==R||e[41]!==_||e[42]!==S?(x=(0,Y.jsxs)("aside",{className:_,"data-testid":S,children:[C,R]}),e[39]=C,e[40]=R,e[41]=_,e[42]=S,e[43]=x):x=e[43],x},"Te"),Sn=o(()=>{let[t,e]=(0,ot.useState)({}),n=Ge(t),l=(0,ot.useRef)({}),r=o(async(a,s)=>{let i=(l.current[a]??0)+1;l.current[a]=i,e(c=>a in c?{...c,[a]:{error:null,loading:!0,result:c[a]?.result??null}}:c);try{let c=await s(a);if(l.current[a]!==i)return;e(u=>a in u?{...u,[a]:{error:null,loading:!1,result:c}}:u)}catch(c){if(l.current[a]!==i)return;throw e(u=>a in u?{...u,[a]:{error:Ht(c),loading:!1,result:null}}:u),c}},"n");return{clearFacets:o(()=>{e({})},"clearFacets"),facets:t,facetsRef:n,refetchFacets:o(a=>Vr(Object.keys(n.current).map(s=>r(s,a))),"refetchFacets"),toggleFacet:o((a,s)=>{if(a in n.current){e(i=>Object.fromEntries(Object.entries(i).filter(([c])=>c!==a)));return}e(i=>({...i,[a]:{error:null,loading:!0,result:null}})),s!==null&&ne(r(a,s))},"toggleFacet")}},"$e"),vi=[],yi=o(()=>{let t=(0,Rt.c)(1),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={},t[0]=e):e=t[0];let{data:n}=it(Ce.maskPolicies,e);return Array.isArray(n?.columns)?n.columns:vi},"fe"),_n=o(t=>{let e=(0,Rt.c)(16),{columns:n,selectedTable:l}=t,r=yi(),[a,s]=(0,ot.useState)(!0),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o(()=>{s(Ri)},"g"),e[0]=i):i=e[0];let c=i,u;if(e[1]!==n||e[2]!==r||e[3]!==l){let b=Br(r,l??"");u=Gr(b,n),e[1]=n,e[2]=r,e[3]=l,e[4]=u}else u=e[4];let d=u,g;e[5]!==a||e[6]!==r?(g=o((b,w)=>({columns:Gr(Br(r,b),w),enabled:a}),"l"),e[5]=a,e[6]=r,e[7]=g):g=e[7];let m=g,h;e[8]!==d||e[9]!==a?(h={columns:d,enabled:a},e[8]=d,e[9]=a,e[10]=h):h=e[10];let p;return e[11]!==d||e[12]!==a||e[13]!==m||e[14]!==h?(p={maskColumns:d,maskOn:a,maskView:h,maskViewFor:m,onToggleMask:c},e[11]=d,e[12]=a,e[13]=m,e[14]=h,e[15]=p):p=e[15],p},"Re");function Ri(t){return!t}o(Ri,"me");var Kr=34,Ur=600,Ii=o(t=>{let e=(0,Rt.c)(21),{item:n,onSelect:l,prefix:r,selected:a,start:s}=t,i;e[0]!==n.name||e[1]!==l?(i=o(()=>{l(n.name)},"g"),e[0]=n.name,e[1]=l,e[2]=i):i=e[2];let c=i,u=`translateY(${String(s)}px)`,d;e[3]!==u?(d={insetInline:0,position:"absolute",top:0,transform:u},e[3]=u,e[4]=d):d=e[4];let g=d,m=a?"bg-accent font-medium text-accent-foreground":"text-foreground",h;e[5]!==m?(h=gt("flex w-full items-center justify-between gap-2 rounded-md px-2 py-1.5 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent",m),e[5]=m,e[6]=h):h=e[6];let p=`${r}-table-${n.name}`,b;e[7]!==n.name?(b=(0,Y.jsx)("span",{className:"truncate",children:n.name}),e[7]=n.name,e[8]=b):b=e[8];let w;e[9]!==n.rowCount?(w=(0,Y.jsx)("span",{className:"shrink-0 rounded bg-muted px-1.5 text-xs tabular-nums text-muted-foreground",children:n.rowCount}),e[9]=n.rowCount,e[10]=w):w=e[10];let _;e[11]!==c||e[12]!==a||e[13]!==h||e[14]!==p||e[15]!==b||e[16]!==w?(_=(0,Y.jsxs)("button",{"aria-pressed":a,className:h,"data-testid":p,onClick:c,type:"button",children:[b,w]}),e[11]=c,e[12]=a,e[13]=h,e[14]=p,e[15]=b,e[16]=w,e[17]=_):_=e[17];let S;return e[18]!==g||e[19]!==_?(S=(0,Y.jsx)("li",{style:g,children:_}),e[18]=g,e[19]=_,e[20]=S):S=e[20],S},"ge"),Cn=o(({header:t,onReload:e,onSelect:n,prefix:l,reloadLabel:r,selected:a,tables:s})=>{let i=te(),[c,u]=(0,ot.useState)(""),d=(0,ot.useRef)(null),g=o(b=>{u(b.target.value)},"l"),m=(0,ot.useMemo)(()=>{let b=c.trim().toLowerCase();return b===""?s:s.filter(w=>w.name.toLowerCase().includes(b))},[c,s]),h=gn({count:m.length,estimateSize:o(()=>Kr,"estimateSize"),getScrollElement:o(()=>d.current,"getScrollElement"),initialRect:{height:Ur,width:240},observeElementRect:o((b,w)=>fn(b,w,Ur),"observeElementRect"),overscan:12}).getVirtualItems(),p={height:m.length*Kr};return(0,Y.jsxs)("aside",{className:"flex h-full w-60 shrink-0 flex-col border-e border-border bg-sidebar","data-testid":`${l}-table-list`,children:[t,(0,Y.jsxs)("div",{className:"flex h-9 shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[(0,Y.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:i("Tables")}),e!==void 0&&(0,Y.jsx)("button",{"aria-label":r??i("Refresh"),className:"flex size-6 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent","data-testid":`${l}-load-tables`,onClick:e,title:r??i("Refresh"),type:"button",children:(0,Y.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,Y.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})})})]}),(0,Y.jsx)("div",{className:"shrink-0 border-b border-border p-2",children:(0,Y.jsx)("input",{className:"h-7 w-full rounded-md border border-border bg-background px-2 text-xs outline-none placeholder:text-muted-foreground focus-visible:border-ring","data-testid":`${l}-table-search`,onChange:g,placeholder:i("search table\u2026"),type:"search",value:c})}),(0,Y.jsxs)("ul",{className:"relative flex-1 overflow-y-auto p-1.5","data-testid":`${l}-table-list-rows`,ref:d,children:[(0,Y.jsx)("li",{"aria-hidden":"true",style:p}),h.map(b=>{let w=m[b.index];return w===void 0?null:(0,Y.jsx)(Ii,{item:w,onSelect:n,prefix:l,selected:a===w.name,start:b.start},w.name)})]})]})},"Ae");var f=Me(zt(),1);var Wr=Me(mt(),1);function Fi(t){return Mi(t)||typeof t=="function"||ki(t)}o(Fi,"isReactComponent");function Mi(t){return typeof t=="function"&&(()=>{let e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}o(Mi,"isClassComponent");function ki(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}o(ki,"isExoticComponent");function pt(t,e){return t==null?null:Fi(t)?Wr.default.createElement(t,e):t}o(pt,"flexRender");function mo(t){if("cell"in t&&t.cell){let e=t.cell,n=e.column.columnDef,l=e,r=n;return l.getIsAggregated?.()?pt(r.aggregatedCell??n.cell,e.getContext()):l.getIsPlaceholder?.()?null:pt(n.cell,e.getContext())}return"header"in t&&t.header?pt(t.header.column.columnDef.header,t.header.getContext()):"footer"in t&&t.footer?pt(t.footer.column.columnDef.footer,t.footer.getContext()):null}o(mo,"FlexRender");function Qr(t){let e=rn(t.source,t.selector,{compare:st});return typeof t.children=="function"?t.children(e):t.children}o(Qr,"Subscribe");function Xr(t){let e=t;return Object.defineProperty(t,"state",{get(){return t.get()}}),"set"in t&&(e.setState=t.set.bind(t)),e}o(Xr,"atomToStore");function go(t){let{createAtom:e,batch:n}=t,l=e(0);return{createOptionsStore:!1,wrapExternalAtoms:!1,addSubscription:o(()=>{throw new Error("Feature not supported in current reactivity implementation")},"addSubscription"),unmount:o(()=>{throw new Error("Feature not supported in current reactivity implementation")},"unmount"),schedule:t.schedule??(r=>queueMicrotask(r)),batch:n,untrack:o(r=>r(),"untrack"),createReadonlyAtom:o((r,a)=>{let s=a?.compare??Object.is,i=!1,c,u=o(()=>{let g=r();return(!i||!s(c,g))&&(c=g,i=!0),c},"getSnapshot"),d=e(()=>(l.get(),u()),{compare:s});return{get:u,subscribe:d.subscribe.bind(d)}},"createReadonlyAtom"),createWritableAtom:o((r,a)=>e(r,{compare:a?.compare}),"createWritableAtom"),commit:o(()=>{l.set(r=>r+1)},"commit")}}o(go,"renderPhaseReactivity");function fo(t,e=Object.is){let n=!1,l;return{get:t.get,markCommitted:o(r=>{l=r,n=!0},"markCommitted"),subscribe:o(r=>t.subscribe(a=>{(!n||!e(l,a))&&r(a)}),"subscribe")}}o(fo,"createRenderPhaseSource");function Yr(){return go({createAtom:Sr,batch:xr})}o(Yr,"reactReactivity");function It(t,e){return typeof t=="function"?t(e):t}o(It,"functionalUpdate");function ie(t){if(Array.isArray(t))return t.map(ie);if(t&&typeof t=="object"){let e=Object.getPrototypeOf(t);if(e!==Object.prototype&&e!==null)return t;let n=e===null?$():{},l=Object.keys(t);for(let r=0;r<l.length;r++){let a=l[r];Object.defineProperty(n,a,{configurable:!0,enumerable:!0,value:ie(t[a]),writable:!0})}return n}return t}o(ie,"cloneState");function vn(t,e){let n=Object.keys(e),l=t;for(let r=0;r<n.length;r++){let a=n[r];!a.startsWith("_memo_")&&a!=="_cellsCache"&&(l[a]=e[a])}return t}o(vn,"copyInstancePropertiesWithoutMemos");function $(){return Object.create(null)}o($,"makeObjectMap");function qe(t,e){return Object.prototype.hasOwnProperty.call(t,e)}o(qe,"hasOwn");function Ke(t,e){return n=>{(e.options.atoms?.[t]??e.baseAtoms[t]).set(l=>It(n,l))}}o(Ke,"makeStateUpdater");function Zr(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(Zr,"isPlainContainer");function el(t){return Reflect.ownKeys(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}o(el,"getEnumerableOwnKeys");var Pi=3;function Ni(t,e){return tl(t,e,Pi)}o(Ni,"stateSlicesEqual");function tl(t,e,n){if(Object.is(t,e))return!0;if(n<=0||!Zr(t)||!Zr(e)||(Array.isArray(t)||Array.isArray(e))&&(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length))return!1;let l=el(t),r=el(e);if(l.length!==r.length)return!1;let a=t,s=e;for(let i=0;i<l.length;i++){let c=l[i];if(!Object.prototype.propertyIsEnumerable.call(e,c)||!tl(a[c],s[c],n-1))return!1}return!0}o(tl,"stateSlicesEqualAtDepth");function je(t,e,n,l=Ni){let r=`on${e.charAt(0).toUpperCase()}${e.slice(1)}Change`,a=t.options[r];a&&a(s=>{let i=It(n,s);return l(s,i)?s:i})}o(je,"setStateSlice");function nl(t){return t instanceof Function}o(nl,"isFunction");function ol(t,e){let n=[],l=o(r=>{r.forEach(a=>{n.push(a);let s=e(a);s.length&&l(s)})},"recurse");return l(t),n}o(ol,"flattenBy");var Di=o(({fn:t,memoDeps:e,onAfterCompare:n,onAfterUpdate:l,onBeforeCompare:r,onBeforeUpdate:a})=>{let s=[],i;return o(u=>{r?.();let d=e?.(u),g=!d||d.length!==s?.length;if(!g&&d){for(let m=0;m<d.length;m++)if(d[m]!==s[m]){g=!0;break}}return n?.(g),g&&(s=d,a?.(),i=t(...d??[]),l?.(i)),i},"memoizedFn")},"memo");function yn(t){let e=!1;return()=>{if(!e){e=!0;return}t()}}o(yn,"skipFirstRun");var Ai=o((t,e)=>{for(t=String(t);t.length<e;)t=" "+t;return t},"pad");function Ft({feature:t,fnName:e,objectId:n,onAfterUpdate:l,table:r,...a}){let s,i,c=0,u;function d(h,p){let b=c===0?"(1st run)":p?"(rerun #"+c+")":"(cache)";c++,console.groupCollapsed(`%c\u23F1 ${Ai(`${h.toFixed(1)} ms`,12)} %c${b}%c ${e}%c ${n?`(${e.split(".")[0]}Id: ${n})`:""}`,`font-size: .6rem; font-weight: bold; ${p?`color: hsl(
2
2
  ${Math.max(0,Math.min(120-Math.log10(h)*60,120))}deg 100% 31%);`:""} `,`color: ${c<2?"#FF00FF":"#FF1493"}`,"color: #666","color: #87CEEB"),console.info({feature:t,state:r.store.state,deps:a.memoDeps?.toString()}),console.trace(),console.groupEnd()}o(d,"logTime");let g=o(()=>{if(!l)return;let{schedule:h,untrack:p}=r._reactivity;h(()=>p(()=>l()))},"onAfterUpdateHandler");return Di({...a,...{onAfterUpdate:o(()=>{g()},"onAfterUpdate")}})}o(Ft,"tableMemo");function rl(t,e="_"){let[n,l]=t.split(e);return{fnKey:l,fnName:`${n}.${l}`,parentName:n}}o(rl,"getFunctionNameInfo");function be(t,e,n){for(let[l,{fn:r,memoDeps:a}]of Object.entries(n)){let{fnKey:s,fnName:i}=rl(l);e[s]=a?Ft({memoDeps:a,fn:r,fnName:i,table:e,feature:t}):r}}o(be,"assignTableAPIs");function de(t,e,n,l){for(let[r,{fn:a,memoDeps:s}]of Object.entries(l)){let{fnKey:i,fnName:c}=rl(r);if(s){let u=`_memo_${i}`;e[i]=function(...d){if(!this[u]){let g=this;this[u]=Ft({memoDeps:o(m=>s(g,m),"memoDeps"),fn:o((...m)=>a(g,...m),"fn"),fnName:c,objectId:g.id,table:n,feature:t})}return this[u](...d)}}else e[i]=function(...u){return a(this,...u)}}}o(de,"assignPrototypeAPIs");function H(t,e,n,...l){return t[e]?.(...l)??n(t,...l)}o(H,"callMemoOrStaticFn");function ll(t){return t.row.getValue(t.column.id)}o(ll,"cell_getValue");function al(t){return t.getValue()??t.table.options.renderFallbackValue}o(al,"cell_renderValue");function sl(t){return{table:t.table,column:t.column,row:t.row,cell:t,getValue:o(()=>t.getValue(),"getValue"),renderValue:o(()=>t.renderValue(),"renderValue")}}o(sl,"cell_getContext");var il={assignCellPrototype:o((t,e)=>{de("coreCellsFeature",t,e,{cell_getValue:{fn:o(n=>ll(n),"fn")},cell_renderValue:{fn:o(n=>al(n),"fn")},cell_getContext:{fn:o(n=>sl(n),"fn"),memoDeps:o(n=>[n],"memoDeps")}})},"assignCellPrototype")};function Oi(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(Oi,"getHeaderPrototype");function po(t,e,n){let l=Oi(t),r=Object.create(l);r.colSpan=0,r.column=e,r.depth=n.depth,r.headerGroup=null,r.id=n.id??e.id,r.index=n.index,r.isPlaceholder=!!n.isPlaceholder,r.placeholderId=n.placeholderId,r.rowSpan=0,r.subHeaders=[];let a=t._headerInstanceInitFns;for(let s=0;s<a.length;s++)a[s](r);return r}o(po,"constructHeader");function Xe(){return{start:[],end:[]}}o(Xe,"getDefaultColumnPinningState");function cl(t){let e=t.getAllColumns(),n=t.getAllLeafColumnsById(),{start:l}=t.atoms.columnPinning?.get()??Xe(),r=[];for(let a=0;a<l.length;a++){let s=n[l[a]];s&&H(s,"getIsVisible",me)&&r.push(s)}return ht(e,r,t,"start")}o(cl,"table_getStartHeaderGroups");function ul(t){let e=t.getAllColumns(),n=t.getAllLeafColumnsById(),{end:l}=t.atoms.columnPinning?.get()??Xe(),r=[];for(let a=0;a<l.length;a++){let s=n[l[a]];s&&H(s,"getIsVisible",me)&&r.push(s)}return ht(e,r,t,"end")}o(ul,"table_getEndHeaderGroups");function dl(t){let e=t.getAllColumns(),n=H(t,"getVisibleLeafColumns",bt),{start:l,end:r}=t.atoms.columnPinning?.get()??Xe();if(l.length||r.length){let a=[...l,...r];n=n.filter(s=>!a.includes(s.id))}return ht(e,n,t,"center")}o(dl,"table_getCenterHeaderGroups");function Ti(t){let{start:e}=t.atoms.columnPinning?.get()??Xe(),n=t.getAllLeafColumnsById(),l=[];for(let r=0;r<e.length;r++){let a=n[e[r]];a&&l.push(a)}return l}o(Ti,"table_getStartLeafColumns");function Vi(t){let{end:e}=t.atoms.columnPinning?.get()??Xe(),n=t.getAllLeafColumnsById(),l=[];for(let r=0;r<e.length;r++){let a=n[e[r]];a&&l.push(a)}return l}o(Vi,"table_getEndLeafColumns");function Ei(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(Ei,"table_getCenterLeafColumns");function zi(t){return H(t,"getStartLeafColumns",Ti).filter(e=>H(e,"getIsVisible",me))}o(zi,"table_getStartVisibleLeafColumns");function Hi(t){return H(t,"getEndLeafColumns",Vi).filter(e=>H(e,"getIsVisible",me))}o(Hi,"table_getEndVisibleLeafColumns");function $i(t){return H(t,"getCenterLeafColumns",Ei).filter(e=>H(e,"getIsVisible",me))}o($i,"table_getCenterVisibleLeafColumns");function Ue(t,e){return e?e==="start"?H(t,"getStartVisibleLeafColumns",zi):e==="end"?H(t,"getEndVisibleLeafColumns",Hi):H(t,"getCenterVisibleLeafColumns",$i):H(t,"getVisibleLeafColumns",bt)}o(Ue,"table_getPinnedVisibleLeafColumns");function ml(){return $()}o(ml,"getDefaultColumnVisibilityState");function ho(t,e){jt(t)&&Bt(t.table,n=>{let l=Object.assign($(),n),r=e??!H(t,"getIsVisible",me),a=t.getLeafColumns();for(let s=0;s<a.length;s++){let i=a[s];jt(i)&&(l[i.id]=r)}return l})}o(ho,"column_toggleVisibility");function me(t){let e=t.table.atoms.columnVisibility?.get();if(!e)return!0;let n=t.columns;return n.length?n.some(l=>H(l,"getIsVisible",me)):(qe(e,t.id)?e[t.id]:void 0)??!0}o(me,"column_getIsVisible");function jt(t){return(t.columnDef.enableHiding??!0)&&(t.table.options.enableHiding??!0)}o(jt,"column_getCanHide");function gl(t){return e=>{ho(t,e.target.checked)}}o(gl,"column_getToggleVisibilityHandler");function bo(t){let e=t.getAllCells(),n=[];for(let u=0;u<e.length;u++){let d=e[u];H(d.column,"getIsVisible",me)&&n.push(d)}let{start:l,end:r}=t.table.atoms.columnPinning?.get()??Xe();if(!l.length&&!r.length)return n;let a=H(t,"getVisibleCellsByColumnId",Rn),s=[];for(let u=0;u<l.length;u++){let d=a[l[u]];d&&s.push(d)}let i=[];for(let u=0;u<r.length;u++){let d=a[r[u]];d&&i.push(d)}let c=[];for(let u=0;u<n.length;u++){let d=n[u],g=d.column.id;!l.includes(g)&&!r.includes(g)&&c.push(d)}return[...s,...c,...i]}o(bo,"row_getVisibleCells");function Rn(t){let e=$(),n=t.getAllCells();for(let l=0;l<n.length;l++){let r=n[l];H(r.column,"getIsVisible",me)&&(e[r.column.id]=r)}return e}o(Rn,"row_getVisibleCellsByColumnId");function fl(t){return t.getAllFlatColumns().filter(e=>H(e,"getIsVisible",me))}o(fl,"table_getVisibleFlatColumns");function bt(t){return t.getAllLeafColumns().filter(e=>H(e,"getIsVisible",me))}o(bt,"table_getVisibleLeafColumns");function Bt(t,e){je(t,"columnVisibility",e)}o(Bt,"table_setColumnVisibility");function pl(t,e){Bt(t,e?$():Object.assign($(),ie(t.initialState.columnVisibility??{})))}o(pl,"table_resetColumnVisibility");function wo(t,e){e=e??!xo(t);let n=$(),l=t.getAllLeafColumns();for(let r=0;r<l.length;r++){let a=l[r];n[a.id]=e||!jt(a)}Bt(t,n)}o(wo,"table_toggleAllColumnsVisible");function xo(t){return!t.getAllLeafColumns().some(e=>!H(e,"getIsVisible",me))}o(xo,"table_getIsAllColumnsVisible");function bl(t){return t.getAllLeafColumns().some(e=>H(e,"getIsVisible",me))}o(bl,"table_getIsSomeColumnsVisible");function hl(t){return e=>{wo(t,e.target.checked)}}o(hl,"table_getToggleAllColumnsVisibilityHandler");function wl(t,e=1){let n=e;for(let l=0;l<t.length;l++){let r=t[l];H(r,"getIsVisible",me)&&r.columns.length&&(n=Math.max(n,wl(r.columns,e+1)))}return n}o(wl,"getMaxHeaderDepth");function Li(t,e){return t?`${t}_${e}`:String(e)}o(Li,"formatHeaderGroupId");function ji(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(ji,"formatHeaderId");function Bi(t,e){let n=0;for(let l=0;l<t.length;l++)t[l].column===e&&n++;return n}o(Bi,"countPendingHeadersForColumn");function xl(t,e,n,l,r,a){let s={depth:e,id:Li(l,e),headers:[]},i=[];for(let c=0;c<t.length;c++){if(!(c in t))continue;let u=t[c],d=i[i.length-1],g=u.column.depth===s.depth,m,h=!1;if(g&&u.column.parent?m=u.column.parent:(m=u.column,h=!0),d&&d.column===m)d.subHeaders.push(u);else{let p=po(n,m,{id:ji(l,e,m.id,u.id),isPlaceholder:h,placeholderId:h?String(Bi(i,m)):void 0,depth:e,index:i.length});p.subHeaders.push(u),i.push(p)}s.headers.push(u),u.headerGroup=s}for(let c=0;c<a.length;c++)a[c](s);r.push(s),e>0&&xl(i,e-1,n,l,r,a)}o(xl,"constructHeaderGroup");function Sl(t){for(let e=0;e<t.length;e++){let n=t[e];if(!H(n.column,"getIsVisible",me))continue;let l=0;if(n.subHeaders.length){Sl(n.subHeaders);for(let r=0;r<n.subHeaders.length;r++){let a=n.subHeaders[r];H(a.column,"getIsVisible",me)&&(l+=a.colSpan)}}else l=1;if(n.colSpan=l,n.isPlaceholder&&n.subHeaders.length===1&&n.subHeaders[0].column===n.column){let r=1,a=n.subHeaders[0];for(;a;)a.rowSpan=0,r++,a=a.subHeaders.length===1&&a.subHeaders[0].column===n.column?a.subHeaders[0]:void 0;n.rowSpan=r}else n.rowSpan=1}}o(Sl,"updateHeaderSpans");function ht(t,e,n,l){let r=wl(t),a=[],s=n._headerGroupInstanceInitFns,i=new Array(e.length);for(let c=0;c<e.length;c++)c in e&&(i[c]=po(n,e[c],{depth:r,index:c}));return xl(i,r-1,n,l,a,s),a.reverse(),Sl(a[0]?.headers??[]),a}o(ht,"buildHeaderGroups");function Gi(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(Gi,"getColumnPrototype");function _l(t,e,n,l){let r={...t.getDefaultColumnDef(),...e},a=r.accessorKey,s=a===void 0?void 0:String(a),i=r.id??s?.replaceAll(".","_")??(typeof r.header=="string"?r.header:void 0),c;if(r.accessorFn)c=r.accessorFn;else if(a!==void 0)if(typeof a=="string"&&a.includes(".")){let m=a.split(".");c=o(h=>{let p=h;for(let b=0;b<m.length;b++){let w=m[b];p=p?.[w]}return p},"accessorFn")}else c=o(m=>m[r.accessorKey],"accessorFn");if(!i)throw new Error;let u=Gi(t),d=Object.create(u);d.accessorFn=c,d.columnDef=r,d.columns=[],d.depth=n,d.id=`${String(i)}`,d.parent=l;let g=t._columnInstanceInitFns;for(let m=0;m<g.length;m++)g[m](d);return d}o(_l,"constructColumn");function Cl(){return[]}o(Cl,"getDefaultColumnOrderState");function So(t){let e=o(n=>{let l=$();for(let r=0;r<n.length;r++)l[n[r].id]=r;return l},"buildIndexes");return{all:e(Ue(t)),center:e(Ue(t,"center")),start:e(Ue(t,"start")),end:e(Ue(t,"end"))}}o(So,"table_getColumnIndexes");function vl(t,e){return H(t.table,"getColumnIndexes",So)[e==="start"?"start":e==="end"?"end":e==="center"?"center":"all"][t.id]??-1}o(vl,"column_getIndex");function yl(t,e){return Ue(t.table,e)[0]?.id===t.id}o(yl,"column_getIsFirstColumn");function Rl(t,e){let n=Ue(t.table,e);return n[n.length-1]?.id===t.id}o(Rl,"column_getIsLastColumn");function _o(t,e){je(t,"columnOrder",e)}o(_o,"table_setColumnOrder");function Il(t,e){_o(t,e?[]:ie(t.initialState.columnOrder??[]))}o(Il,"table_resetColumnOrder");function Gt(t){let e=t.atoms.columnOrder?.get();return n=>{let l=[];if(!e?.length)l=n;else{let r=new Map;for(let a=0;a<n.length;a++){let s=n[a];r.set(s.id,s)}for(let a=0;a<e.length;a++){let s=e[a],i=r.get(s);i&&(l.push(i),r.delete(s))}for(let a=0;a<n.length;a++){let s=n[a];r.has(s.id)&&l.push(s)}}return qi(t,l)}}o(Gt,"table_getOrderColumnsFn");function qi(t,e){let n=t.atoms.grouping?.get()??[],{groupedColumnMode:l}=t.options;if(!n.length||!l)return e;let r=e.filter(i=>!n.includes(i.id));if(l==="remove")return r;let a=new Map;for(let i=0;i<e.length;i++){let c=e[i];a.set(c.id,c)}let s=[];for(let i=0;i<n.length;i++){let c=a.get(n[i]);c&&s.push(c)}return[...s,...r]}o(qi,"orderColumns");function Fl(t){return[t,...t.columns.flatMap(e=>e.getFlatColumns())]}o(Fl,"column_getFlatColumns");function Ml(t){if(t.columns.length){let e=t.columns.flatMap(n=>n.getLeafColumns());return H(t.table,"getOrderColumns",Gt)(e)}return[t]}o(Ml,"column_getLeafColumns");function kl(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(kl,"table_getDefaultColumnDef");function Pl(t,e,n,l=0){let r=new Array(e.length);for(let a=0;a<e.length;a++){if(!(a in e))continue;let s=e[a],i=_l(t,s,l,n),c=s;i.columns=c.columns?Pl(t,c.columns,i,l+1):[],r[a]=i}return r}o(Pl,"constructColumns");function Nl(t){return Pl(t,t.options.columns)}o(Nl,"table_getAllColumns");function Dl(t){return t.getAllColumns().flatMap(e=>e.getFlatColumns())}o(Dl,"table_getAllFlatColumns");function Al(t){let e=$(),n=t.getAllFlatColumns();for(let l=0;l<n.length;l++){let r=n[l];e[r.id]=r}return e}o(Al,"table_getAllFlatColumnsById");function Ol(t){let e=t.getAllColumns().flatMap(n=>n.getLeafColumns());return H(t,"getOrderColumns",Gt)(e)}o(Ol,"table_getAllLeafColumns");function Tl(t){let e=$(),n=t.getAllLeafColumns();for(let l=0;l<n.length;l++){let r=n[l];e[r.id]=r}return e}o(Tl,"table_getAllLeafColumnsById");function Vl(t,e){return t.getAllFlatColumnsById()[e]}o(Vl,"table_getColumn");var El={assignColumnPrototype:o((t,e)=>{de("coreColumnsFeature",t,e,{column_getFlatColumns:{fn:o(n=>Fl(n),"fn"),memoDeps:o(n=>[n.table.options.columns],"memoDeps")},column_getLeafColumns:{fn:o(n=>Ml(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=>{be("coreColumnsFeature",t,{table_getDefaultColumnDef:{fn:o(()=>kl(t),"fn"),memoDeps:o(()=>[t.options.defaultColumn],"memoDeps")},table_getAllColumns:{fn:o(()=>Nl(t),"fn"),memoDeps:o(()=>[t.options.columns],"memoDeps")},table_getAllFlatColumns:{fn:o(()=>Dl(t),"fn"),memoDeps:o(()=>[t.options.columns],"memoDeps")},table_getAllFlatColumnsById:{fn:o(()=>Al(t),"fn"),memoDeps:o(()=>[t.options.columns],"memoDeps")},table_getAllLeafColumns:{fn:o(()=>Ol(t),"fn"),memoDeps:o(()=>[t.atoms.columnOrder?.get(),t.atoms.grouping?.get(),t.options.columns,t.options.groupedColumnMode],"memoDeps")},table_getAllLeafColumnsById:{fn:o(()=>Tl(t),"fn"),memoDeps:o(()=>[t.getAllLeafColumns()],"memoDeps")},table_getColumn:{fn:o(e=>Vl(t,e),"fn")}})},"constructTableAPIs")};function zl(t,e){for(let n=0;n<t.subHeaders.length;n++)zl(t.subHeaders[n],e);e.push(t)}o(zl,"collectLeafHeaders");function Hl(t){let e=[];return zl(t,e),e}o(Hl,"header_getLeafHeaders");function $l(t){return{column:t.column,header:t,table:t.column.table}}o($l,"header_getContext");function Ll(t){let{start:e,end:n}=t.atoms.columnPinning?.get()??Xe(),l=t.getAllColumns(),r=H(t,"getVisibleLeafColumns",bt);if(!e.length&&!n.length)return ht(l,r,t);let a=t.getAllLeafColumnsById(),s=[];for(let u=0;u<e.length;u++){let d=a[e[u]];d&&H(d,"getIsVisible",me)&&s.push(d)}let i=[];for(let u=0;u<n.length;u++){let d=a[n[u]];d&&H(d,"getIsVisible",me)&&i.push(d)}let c=r.filter(u=>!e.includes(u.id)&&!n.includes(u.id));return ht(l,[...s,...c,...i],t)}o(Ll,"table_getHeaderGroups");function jl(t){return[...t.getHeaderGroups()].reverse()}o(jl,"table_getFooterGroups");function Bl(t){let e=t.getHeaderGroups(),n=[];for(let l=0;l<e.length;l++){let r=e[l].headers;for(let a=0;a<r.length;a++)n.push(r[a])}return n}o(Bl,"table_getFlatHeaders");function Gl(t){let e=t.getHeaderGroups()[0]?.headers??[],n=[];for(let l=0;l<e.length;l++){let r=e[l].getLeafHeaders();for(let a=0;a<r.length;a++)n.push(r[a])}return n}o(Gl,"table_getLeafHeaders");var ql={assignHeaderPrototype:o((t,e)=>{de("coreHeadersFeature",t,e,{header_getLeafHeaders:{fn:o(n=>Hl(n),"fn"),memoDeps:o(n=>[n.column.table.options.columns],"memoDeps")},header_getContext:{fn:o(n=>$l(n),"fn"),memoDeps:o(n=>[n.column.table.options.columns],"memoDeps")}})},"assignHeaderPrototype"),constructTableAPIs:o(t=>{be("coreHeadersFeature",t,{table_getHeaderGroups:{fn:o(()=>Ll(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(()=>jl(t),"fn"),memoDeps:o(()=>[t.getHeaderGroups()],"memoDeps")},table_getFlatHeaders:{fn:o(()=>Bl(t),"fn"),memoDeps:o(()=>[t.getHeaderGroups()],"memoDeps")},table_getLeafHeaders:{fn:o(()=>Gl(t),"fn"),memoDeps:o(()=>[t.getHeaderGroups()],"memoDeps")}})},"constructTableAPIs")};function Ki(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(Ki,"getRowPrototype");var Kl=o((t,e,n,l,r,a,s)=>{let i=Ki(t),c=Object.create(i);c._displayIndexCache=-1,c._uniqueValuesCache=$(),c._valuesCache=$(),c.depth=r,c.id=e,c.index=l,c.original=n,c.parentId=s,c.subRows=a??[];let u=t._rowInstanceInitFns;for(let d=0;d<u.length;d++)u[d](c);return c},"constructRow");var vo=/([0-9]+)/gm;function wt(t){let e=Object.assign((n,l,r)=>{let a=n.getValue(r),s=l.getValue(r),i=e.resolveDataValue;return i&&(a=i(a),s=i(s)),e.sort(a,s,n,l,r)},t);return e}o(wt,"constructSortFn");var yo=wt({resolveDataValue:o(t=>Fn(t).toLowerCase(),"resolveDataValue"),sort:o((t,e)=>Wl(t,e),"sort")}),Ui=wt({resolveDataValue:o(t=>Fn(t),"resolveDataValue"),sort:o((t,e)=>Wl(t,e),"sort")}),Ro=wt({resolveDataValue:o(t=>Fn(t).toLowerCase(),"resolveDataValue"),sort:o((t,e)=>Fo(t,e),"sort")}),Ji=wt({resolveDataValue:o(t=>Fn(t),"resolveDataValue"),sort:o((t,e)=>Fo(t,e),"sort")}),Io=wt({resolveDataValue:o(t=>Wi(t),"resolveDataValue"),sort:o((t,e)=>t>e?1:t<e?-1:0,"sort")}),Mt=wt({sort:o((t,e)=>Fo(t,e),"sort")});function Fo(t,e){return t===e?0:t>e?1:-1}o(Fo,"compareBasic");function Wi(t){return t instanceof Date?t.getTime():t}o(Wi,"toDateSortValue");function Fn(t){return typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?"":String(t):typeof t=="string"?t:""}o(Fn,"toString");function Wl(t,e){let n=0,l=0,r=t.length,a=e.length;for(;n<r&&l<a;){let s=In(t.charCodeAt(n)),i=In(e.charCodeAt(l)),c=Co(t,n,s),u=Co(e,l,i);if(!s&&!i){let g=Qi(t,n,c,e,l,u);if(g)return g;n=c,l=u;continue}if(s!==i)return s?1:-1;let d=Xi(t,n,c,e,l,u);if(d)return d;n=c,l=u}return Jl(t,n)-Jl(e,l)}o(Wl,"compareAlphanumeric");function In(t){return t>=48&&t<=57}o(In,"isDigit");function Co(t,e,n){let l=e+1;for(;l<t.length&&In(t.charCodeAt(l))===n;)l++;return l}o(Co,"findChunkEnd");function Qi(t,e,n,l,r,a){let s=n-e,i=a-r,c=s<i?s:i;for(let u=0;u<c;u++){let d=t.charCodeAt(e+u),g=l.charCodeAt(r+u);if(d>g)return 1;if(g>d)return-1}return s>i?1:i>s?-1:0}o(Qi,"compareStringChunks");function Xi(t,e,n,l,r,a){let s=e;for(;s<n&&t.charCodeAt(s)===48;)s++;let i=r;for(;i<a&&l.charCodeAt(i)===48;)i++;let c=n-s,u=a-i;if(c===0&&u===0)return 0;if(c<=15&&u<=15){let m=Ul(t,s,n),h=Ul(l,i,a);return m>h?1:h>m?-1:0}let d=parseInt(t.slice(e,n),10),g=parseInt(l.slice(r,a),10);return d>g?1:g>d?-1:0}o(Xi,"compareNumericChunks");function Ul(t,e,n){let l=0;for(let r=e;r<n;r++)l=l*10+t.charCodeAt(r)-48;return l}o(Ul,"parseSmallInt");function Jl(t,e){let n=0,l=e;for(;l<t.length;)n++,l=Co(t,l,In(t.charCodeAt(l)));return n}o(Jl,"countRemainingChunks");function Ql(){return[]}o(Ql,"getDefaultCellSelectionState");function Yi(t,e){je(t,"cellSelection",e?Ql():ie(t.initialState.cellSelection)??Ql())}o(Yi,"table_resetCellSelection");function Xl(t){t.atoms.cellSelection&&(t.options.autoResetAll??t.options.autoResetCellSelection??!0)&&t._reactivity.schedule(()=>Yi(t))}o(Xl,"table_autoResetCellSelection");function Yl(t){t.atoms.expanded&&(t.options.autoResetAll??t.options.autoResetExpanded??!t.options.manualExpanding)&&t._reactivity.schedule(()=>Zi(t))}o(Yl,"table_autoResetExpanded");function Zi(t,e){let n=t.initialState.expanded;je(t,"expanded",e?$():n===!0?!0:Object.assign($(),ie(n??{})))}o(Zi,"table_resetExpanded");var Mn=0;function kn(t){if(t.options.autoResetAll??t.options.autoResetPageIndex??!t.options.manualPagination){if((t.atoms.pagination?.get()?.pageIndex??Mn)===Mn)return;nc(t,!0)}}o(kn,"table_autoResetPageIndex");function ec(t,e){je(t,"pagination",e)}o(ec,"table_setPagination");function tc(t,e){ec(t,n=>{let l=It(e,n.pageIndex),r=typeof t.options.pageCount>"u"||t.options.pageCount===-1?Number.MAX_SAFE_INTEGER:t.options.pageCount-1;return l=Math.max(0,Math.min(l,r)),{...n,pageIndex:l}})}o(tc,"table_setPageIndex");function nc(t,e){tc(t,e?Mn:t.initialState.pagination?.pageIndex??Mn)}o(nc,"table_resetPageIndex");function Zl(){return[]}o(Zl,"getDefaultSortingState");function Kt(t,e){je(t,"sorting",e)}o(Kt,"table_setSorting");function Mo(t,e){Kt(t,e?[]:ie(t.initialState.sorting??[]))}o(Mo,"table_resetSorting");function ea(t){t.atoms.sorting&&(t.options.autoResetAll??t.options.autoResetSorting??!1)&&Mo(t)}o(ea,"table_autoResetSorting");function ko(t){let e=t.table._rowModelFns.sortFns,n=t.table.getFilteredRowModel().flatRows.slice(0,10),l,r=!1;for(let a=0;a<n.length;a++){let s=n[a].getValue(t.id);if(Object.prototype.toString.call(s)==="[object Date]"){l="datetime";break}if(typeof s=="string"&&(r=!0,s.split(vo).length>1)){l="alphanumeric";break}}if(!l&&r&&(l="text"),l){let a=e?.[l];if(a||l==="alphanumeric"&&(a=e?.text),a)return a}return Mt}o(ko,"column_getAutoSortFn");function Po(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(Po,"column_getAutoSortDir");function Pn(t){let e=t.table._rowModelFns.sortFns;return nl(t.columnDef.sortFn)?t.columnDef.sortFn:t.columnDef.sortFn==="auto"?ko(t):e?.[t.columnDef.sortFn]??Mt}o(Pn,"column_getSortFn");function No(t,e,n){let l=Ao(t,n&&qt(t)),r=typeof e<"u";Kt(t.table,a=>{let s=a.findIndex(m=>m.id===t.id),i=s===-1?void 0:a[s],c=[],u,d=r?e:l==="desc",g=!!(a.length&&qt(t)&&n);return g?i?u="toggle":u="add":i?u="toggle":u="replace",u==="toggle"&&(r||l||(u="remove")),u==="add"?(c=[...a,{id:t.id,desc:d}],c.splice(0,c.length-(t.table.options.maxMultiSortColCount??Number.MAX_SAFE_INTEGER))):u==="toggle"?c=g?a.map(m=>m.id===t.id?{...m,desc:d}:m):[{id:t.id,desc:d}]:u==="remove"?c=g?a.filter(m=>m.id!==t.id):[]:c=[{id:t.id,desc:d}],c})}o(No,"column_toggleSorting");function Do(t){return t.columnDef.sortDescFirst??t.table.options.sortDescFirst??Po(t)==="desc"?"desc":"asc"}o(Do,"column_getFirstSortDir");function Ao(t,e){let n=Do(t),l=Oo(t);return l?l!==n&&(t.table.options.enableSortingRemoval??!0)&&(!e||(t.table.options.enableMultiRemove??!0))?!1:l==="desc"?"asc":"desc":n}o(Ao,"column_getNextSortingOrder");function Ut(t){return(t.columnDef.enableSorting??!0)&&(t.table.options.enableSorting??!0)&&!!t.accessorFn}o(Ut,"column_getCanSort");function qt(t){return t.columnDef.enableMultiSort??t.table.options.enableMultiSort??!!t.accessorFn}o(qt,"column_getCanMultiSort");function Oo(t){let e=t.table.atoms.sorting?.get()?.find(n=>n.id===t.id);return e?e.desc?"desc":"asc":!1}o(Oo,"column_getIsSorted");function ta(t){return t.table.atoms.sorting?.get()?.findIndex(e=>e.id===t.id)??-1}o(ta,"column_getSortIndex");function na(t){Kt(t.table,e=>e.length?e.filter(n=>n.id!==t.id):[])}o(na,"column_clearSorting");function oa(t){let e=Ut(t);return n=>{e&&No(t,void 0,qt(t)?t.table.options.isMultiSortEvent?.(n):!1)}}o(oa,"column_getToggleSortingHandler");function ra(){return t=>Ft({feature:"coreRowModelsFeature",table:t,fnName:"table.getCoreRowModel",memoDeps:o(()=>[t.options.data],"memoDeps"),fn:o(()=>oc(t,t.options.data),"fn"),onAfterUpdate:yn(()=>{Yl(t),kn(t),ea(t),Xl(t)})})}o(ra,"createCoreRowModel");function la(t,e,n,l=0,r){let a=[];for(let s=0;s<n.length;s++){let i=n[s],c=Kl(t,t.getRowId(i,s,r),i,s,l,void 0,r?.id);e.flatRows.push(c),e.rowsById[c.id]=c,a.push(c),t.options.getSubRows&&(c.originalSubRows=t.options.getSubRows(i,s),c.originalSubRows?.length&&(c.subRows=la(t,e,c.originalSubRows,l+1,c)))}return a}o(la,"accessRows");function oc(t,e){let n={rows:[],flatRows:[],rowsById:$()};return n.rows=la(t,n,e),n}o(oc,"_createCoreRowModel");function aa(t){return t._rowModels.coreRowModel||(t._rowModels.coreRowModel=t.options.features.coreRowModel?.(t)??ra()(t)),t._rowModels.coreRowModel()}o(aa,"table_getCoreRowModel");function sa(t){return t.getCoreRowModel()}o(sa,"table_getPreFilteredRowModel");function ia(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(ia,"table_getFilteredRowModel");function ca(t){return t.getFilteredRowModel()}o(ca,"table_getPreGroupedRowModel");function ua(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(ua,"table_getGroupedRowModel");function da(t){return t.getGroupedRowModel()}o(da,"table_getPreSortedRowModel");function ma(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(ma,"table_getSortedRowModel");function ga(t){return t.getSortedRowModel()}o(ga,"table_getPreExpandedRowModel");function fa(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(fa,"table_getExpandedRowModel");function pa(t){return t.getExpandedRowModel()}o(pa,"table_getPrePaginatedRowModel");function ba(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(ba,"table_getPaginatedRowModel");function ha(t){return t.getPaginatedRowModel()}o(ha,"table_getRowModel");var wa={constructTableAPIs:o(t=>{be("coreRowModelsFeature",t,{table_getCoreRowModel:{fn:o(()=>aa(t),"fn")},table_getPreFilteredRowModel:{fn:o(()=>sa(t),"fn")},table_getFilteredRowModel:{fn:o(()=>ia(t),"fn")},table_getPreGroupedRowModel:{fn:o(()=>ca(t),"fn")},table_getGroupedRowModel:{fn:o(()=>ua(t),"fn")},table_getPreSortedRowModel:{fn:o(()=>da(t),"fn")},table_getSortedRowModel:{fn:o(()=>ma(t),"fn")},table_getPreExpandedRowModel:{fn:o(()=>ga(t),"fn")},table_getExpandedRowModel:{fn:o(()=>fa(t),"fn")},table_getPrePaginatedRowModel:{fn:o(()=>pa(t),"fn")},table_getPaginatedRowModel:{fn:o(()=>ba(t),"fn")},table_getRowModel:{fn:o(()=>ha(t),"fn")}})},"constructTableAPIs")};function rc(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(rc,"getCellPrototype");function xa(t,e,n){let l=rc(n),r=Object.create(l);r.column=t,r.id=`${e.id}_${t.id}`,r.row=e;let a=n._cellInstanceInitFns;for(let s=0;s<a.length;s++)a[s](r);return r}o(xa,"constructCell");function Sa(t){let e=t.table.getRowsInDisplayOrder(),n=t._displayIndexCache;return e[n]===t?n:-1}o(Sa,"row_getDisplayIndex");function _a(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(_a,"table_getRowsInDisplayOrder");function Ca(t,e){if(qe(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(Ca,"row_getValue");function va(t,e){if(qe(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(va,"row_getUniqueValues");function ya(t,e){return t.getValue(e)??t.table.options.renderFallbackValue}o(ya,"row_renderValue");function Ra(t){return ol(t.subRows,e=>e.subRows)}o(Ra,"row_getLeafRows");function Ia(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(Ia,"table_getMaxSubRowDepth");function Fa(t){if(t.parentId)return t.table.getCoreRowModel().rowsById[t.parentId]??t.table.getRow(t.parentId,!0)}o(Fa,"row_getParentRow");function Ma(t){let e=[],n=t;for(;;){let l=n.getParentRow();if(!l)break;e.push(l),n=l}return e.reverse()}o(Ma,"row_getParentRows");function ka(t){let e=t.table.getAllLeafColumns(),n=t._cellsCache;n||(n=t._cellsCache=new WeakMap);let l=new Array(e.length);for(let r=0;r<e.length;r++){let a=e[r],s=n.get(a);s||(s=xa(a,t,t.table),n.set(a,s)),l[r]=s}return l}o(ka,"row_getAllCells");function Pa(t){let e=$(),n=t.getAllCells();for(let l=0;l<n.length;l++){let r=n[l];e[r.column.id]=r}return e}o(Pa,"row_getAllCellsByColumnId");function Na(t,e,n,l){return e.options.getRowId?.(t,n,l)??(l?`${l.id}.${n}`:String(n))}o(Na,"table_getRowId");function Da(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(Da,"table_getRow");var Aa={assignRowPrototype:o((t,e)=>{de("coreRowsFeature",t,e,{row_getDisplayIndex:{fn:o(n=>Sa(n),"fn")},row_getAllCellsByColumnId:{fn:o(n=>Pa(n),"fn"),memoDeps:o(n=>[n.getAllCells()],"memoDeps")},row_getAllCells:{fn:o(n=>ka(n),"fn"),memoDeps:o(n=>[n.table.getAllLeafColumns()],"memoDeps")},row_getLeafRows:{fn:o(n=>Ra(n),"fn"),memoDeps:o(n=>[n.subRows],"memoDeps")},row_getParentRow:{fn:o(n=>Fa(n),"fn")},row_getParentRows:{fn:o(n=>Ma(n),"fn")},row_getUniqueValues:{fn:o((n,l)=>va(n,l),"fn")},row_getValue:{fn:o((n,l)=>Ca(n,l),"fn")},row_renderValue:{fn:o((n,l)=>ya(n,l),"fn")}})},"assignRowPrototype"),constructTableAPIs:o(t=>{be("coreRowsFeature",t,{table_getRowsInDisplayOrder:{fn:o(()=>_a(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)=>Na(e,t,n,l),"fn")},table_getRow:{fn:o((e,n)=>Da(t,e,n),"fn")},table_getMaxSubRowDepth:{fn:o(()=>Ia(t),"fn"),memoDeps:o(()=>[t.getCoreRowModel()],"memoDeps")}})},"constructTableAPIs")};function Nn(t,e,n=(l,r)=>l===r){let l=e===void 0?t.options.state:e;t._reactivity.batch(()=>{if(l)for(let r in l){let a=t.baseAtoms[r];if(!a)continue;let s=l[r],i=s===void 0?t.initialState[r]:s;n(t._reactivity.untrack(()=>a.get()),i)||a.set(()=>i)}})}o(Nn,"table_syncExternalStateToBaseAtoms");function Dn(t,e,n=(l,r)=>l===r){t._reactivity.batch(()=>{Nn(t,e,n),t._reactivity.commit?.()})}o(Dn,"table_publishExternalState");function To(t){let e=ie(t.initialState);t._reactivity.batch(()=>{let l=Object.keys(e);for(let r=0;r<l.length;r++){let a=l[r];t.baseAtoms[a].set(e[a])}});let n=Object.values(t._features);for(let l=0;l<n.length;l++)n[l].resetTableInstanceData?.(t)}o(To,"table_reset");function Oa(t,e){let{features:n,atoms:l,initialState:r}=t.options;if(!t.options.mergeOptions)return{...t.options,...e,features:n,atoms:l,initialState:r};let a=t.options.mergeOptions(t.options,e),s={...Object.getOwnPropertyDescriptors(a)};return Object.defineProperties(Object.create(Object.getPrototypeOf(a)),{...s,features:{value:n,enumerable:!0,configurable:!0,writable:!0},atoms:{value:l,enumerable:!0,configurable:!0,writable:!0},initialState:{value:r,enumerable:!0,configurable:!0,writable:!0}})}o(Oa,"table_mergeOptions");function Jt(t,e,n){let l=Oa(t,It(e,t.options));t.optionsStore?t.optionsStore.set(()=>l):t.options=l,n?.syncExternalState!==!1&&Dn(t,l.state??null)}o(Jt,"table_setOptions");var Ta={constructTableAPIs:o(t=>{be("coreTablesFeature",t,{table_reset:{fn:o(()=>To(t),"fn")},table_setOptions:{fn:o(e=>Jt(t,e),"fn")}})},"constructTableAPIs")};var Va={coreCellsFeature:il,coreColumnsFeature:El,coreHeadersFeature:ql,coreRowModelsFeature:wa,coreRowsFeature:Aa,coreTablesFeature:Ta};function Ea(t,e={}){return Object.values(t).forEach(n=>{e=n.getInitialState?.(e)??e}),ie(e)}o(Ea,"getInitialTableState");function Vo(t){let e=t.features.coreReactivityFeature,{aggregationFns:n,columnMeta:l,coreRowModel:r,expandedRowModel:a,facetedMinMaxValues:s,facetedRowModel:i,facetedUniqueValues:c,filterFns:u,filterMeta:d,filteredRowModel:g,groupedRowModel:m,paginatedRowModel:h,sortFns:p,sortedRowModel:b,tableMeta:w,..._}=t.features,S={_cellInstanceInitFns:[],_columnInstanceInitFns:[],_features:{...Va,..._},_headerGroupInstanceInitFns:[],_headerInstanceInitFns:[],_reactivity:e,_rowInstanceInitFns:[],_rowModelFns:{aggregationFns:n,filterFns:u,sortFns:p},_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,F=e.createWritableAtom(v.get(),{debugName:`externalAtom/${R}`});I.atoms[R]=F;let N=!1,k=v.subscribe(M=>{N||F.set(M)}),P=F.subscribe(M=>{N=!0,v.set(M),N=!1});e.addSubscription(k),e.addSubscription(P)}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=Ea(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,F=v.atoms?.[x],N=F?F.get():S.baseAtoms[x].get();if(F)return N;let k=v.state;if(k&&qe(k,x)){let P=k[x];return P===void 0?S.initialState[x]:P}return N},{debugName:`table/atoms/${x}`})}Nn(S),S.store=Xr(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:st,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(Vo,"constructTable");var Eo={getInitialState:o(t=>({columnOrder:Cl(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({onColumnOrderChange:Ke("columnOrder",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{de("columnOrderingFeature",t,e,{column_getIndex:{fn:o((n,l)=>vl(n,l),"fn")},column_getIsFirstColumn:{fn:o((n,l)=>yl(n,l),"fn")},column_getIsLastColumn:{fn:o((n,l)=>Rl(n,l),"fn")}})},"assignColumnPrototype"),constructTableAPIs:o(t=>{be("columnOrderingFeature",t,{table_getColumnIndexes:{fn:o(()=>So(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=>_o(t,e),"fn")},table_resetColumnOrder:{fn:o(e=>Il(t,e),"fn")},table_getOrderColumnsFn:{fn:o(()=>Gt(t),"fn"),memoDeps:o(()=>[t.atoms.columnOrder?.get(),t.atoms.grouping?.get(),t.options.groupedColumnMode],"memoDeps")}})},"constructTableAPIs")};function za(){return $()}o(za,"getDefaultColumnSizingState");function zo(){return{size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER}}o(zo,"getDefaultColumnSizingColumnDef");function kt(t){let e=zo(),n=t.table.atoms.columnSizing?.get(),l=n&&qe(n,t.id)?n[t.id]:void 0;return Math.min(Math.max(t.columnDef.minSize??e.minSize,l??t.columnDef.size??e.size),t.columnDef.maxSize??e.maxSize)}o(kt,"column_getSize");function An(t){let e=$(),n=$(),l=new Array(t.length),r=0;for(let s=0;s<t.length;s++){let i=t[s],c=H(i,"getSize",kt);l[s]=c,e[i.id]=r,r+=c}let a=0;for(let s=t.length-1;s>=0;s--)n[t[s].id]=a,a+=l[s];return{starts:e,afters:n}}o(An,"buildColumnOffsets");function On(t){return{all:An(Ue(t)),center:An(Ue(t,"center")),start:An(Ue(t,"start")),end:An(Ue(t,"end"))}}o(On,"table_getColumnOffsets");function Ha(t){return t==="start"?"start":t==="end"?"end":t==="center"?"center":"all"}o(Ha,"toOffsetsKey");function $a(t,e){return H(t.table,"getColumnOffsets",On)[Ha(e)].starts[t.id]??0}o($a,"column_getStart");function La(t,e){return H(t.table,"getColumnOffsets",On)[Ha(e)].afters[t.id]??0}o(La,"column_getAfter");function ja(t){Pt(t.table,e=>{let n=$(),l=Object.keys(e);for(let r=0;r<l.length;r++){let a=l[r];a!==t.id&&(n[a]=e[a])}return n})}o(ja,"column_resetSize");function Ba(t){if(!t.subHeaders.length)return kt(t.column);let e=0;for(let n=0;n<t.subHeaders.length;n++)e+=Ba(t.subHeaders[n]);return e}o(Ba,"sumHeaderSize");function rt(t){return Ba(t)}o(rt,"header_getSize");function Ho(t){if(t.index>0){let e=t.headerGroup?.headers[t.index-1];if(e)return H(e,"getStart",Ho)+H(e,"getSize",rt)}return 0}o(Ho,"header_getStart");function Pt(t,e){t.options.onColumnSizingChange?.(e)}o(Pt,"table_setColumnSizing");function Ga(t,e){Pt(t,e?$():Object.assign($(),ie(t.initialState.columnSizing??{})))}o(Ga,"table_resetColumnSizing");function qa(t){return t.getHeaderGroups()[0]?.headers.reduce((e,n)=>e+rt(n),0)??0}o(qa,"table_getTotalSize");function Ka(t){return H(t,"getStartHeaderGroups",cl)[0]?.headers.reduce((e,n)=>e+rt(n),0)??0}o(Ka,"table_getStartTotalSize");function Ua(t){return H(t,"getCenterHeaderGroups",dl)[0]?.headers.reduce((e,n)=>e+rt(n),0)??0}o(Ua,"table_getCenterTotalSize");function Ja(t){return H(t,"getEndHeaderGroups",ul)[0]?.headers.reduce((e,n)=>e+rt(n),0)??0}o(Ja,"table_getEndTotalSize");function Vn(){return{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}}o(Vn,"getDefaultColumnResizingState");function Lo(t){return(t.columnDef.enableResizing??!0)&&(t.table.options.enableColumnResizing??!0)}o(Lo,"column_getCanResize");function Wa(t){return t.table.atoms.columnResizing?.get()?.isResizingColumn===t.id}o(Wa,"column_getIsResizing");function Qa(t,e){let n=t.table.getColumn(t.column.id),l=Lo(n);return r=>{if(!l||$o(r)&&r.touches.length>1)return;let a=rt(t),s=t.getLeafHeaders().map(C=>[C.column.id,kt(C.column)]),i=$o(r)?Math.round(r.touches[0].clientX):r.clientX,c=$(),u=o((C,R)=>{if(typeof R!="number")return;let x=n.table,v=x.options.columnResizeMode==="onChange"||C==="end";x._reactivity.batch(()=>{Nt(x,F=>{let N=x.options.columnResizeDirection==="rtl"?-1:1,k=(R-(F.startOffset??0))*N,P=F.startSize??0,M=Math.max(P>0?k/P:0,-.999999);if(v){let O=F.columnSizingStart;for(let T=0;T<O.length;T++){let A=O[T],E=A[1];c[A[0]]=Math.round(Math.max(E>0?E+E*M:k/O.length,0)*100)/100}}return{...F,deltaOffset:k,deltaPercentage:M}}),v&&Pt(x,F=>Object.assign($(),F,c))})},"updateOffset"),d=null,g=!1,m,h=o(()=>{g?(g=!1,u("move",m),d=requestAnimationFrame(h)):d=null},"flushMove"),p=o(C=>{if(m=C,typeof requestAnimationFrame!="function"){u("move",C);return}if(d!==null){g=!0;return}u("move",C),d=requestAnimationFrame(h)},"onMove"),b=o(C=>{d!==null&&(cancelAnimationFrame(d),d=null,g=!1),n.table._reactivity.batch(()=>{u("end",C??m),Nt(n.table,R=>({...R,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))})},"onEnd"),w=e||(typeof document<"u"?document:null),_={moveHandler:o(C=>p(C.clientX),"moveHandler"),upHandler:o(C=>{w?.removeEventListener("mousemove",_.moveHandler),w?.removeEventListener("mouseup",_.upHandler),b(C.clientX)},"upHandler")},S={moveHandler:o(C=>(C.cancelable&&(C.preventDefault(),C.stopPropagation()),p(C.touches[0].clientX),!1),"moveHandler"),upHandler:o(C=>{y(),C.cancelable&&(C.preventDefault(),C.stopPropagation()),b(C.touches[0]?.clientX)},"upHandler"),cancelHandler:o(()=>{y(),b()},"cancelHandler")},y=o(()=>{w?.removeEventListener("touchmove",S.moveHandler),w?.removeEventListener("touchend",S.upHandler),w?.removeEventListener("touchcancel",S.cancelHandler)},"removeTouchEvents"),I=lc()?{passive:!1}:!1;$o(r)?(w?.addEventListener("touchmove",S.moveHandler,I),w?.addEventListener("touchend",S.upHandler,I),w?.addEventListener("touchcancel",S.cancelHandler,I)):(w?.addEventListener("mousemove",_.moveHandler,I),w?.addEventListener("mouseup",_.upHandler,I)),Nt(n.table,C=>({...C,startOffset:i,startSize:a,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:n.id}))}}o(Qa,"header_getResizeHandler");function Nt(t,e){t.options.onColumnResizingChange?.(e)}o(Nt,"table_setColumnResizing");function Xa(t,e){Nt(t,e?Vn():ie(t.initialState.columnResizing??Vn()))}o(Xa,"table_resetHeaderSizeInfo");var Tn=null;function lc(){if(typeof Tn=="boolean")return Tn;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 Tn=t,Tn}o(lc,"passiveEventSupported");function $o(t){return t.type==="touchstart"}o($o,"isTouchStartEvent");var jo={getInitialState:o(t=>({columnResizing:Vn(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnResizingChange:Ke("columnResizing",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{de("columnResizingFeature",t,e,{column_getCanResize:{fn:o(n=>Lo(n),"fn")},column_getIsResizing:{fn:o(n=>Wa(n),"fn")}})},"assignColumnPrototype"),assignHeaderPrototype:o((t,e)=>{de("columnResizingFeature",t,e,{header_getResizeHandler:{fn:o((n,l)=>Qa(n,l),"fn")}})},"assignHeaderPrototype"),constructTableAPIs:o(t=>{be("columnResizingFeature",t,{table_setColumnResizing:{fn:o(e=>Nt(t,e),"fn")},table_resetHeaderSizeInfo:{fn:o(e=>Xa(t,e),"fn")}})},"constructTableAPIs")};var Bo={getInitialState:o(t=>({columnSizing:za(),...t}),"getInitialState"),getDefaultColumnDef:o(()=>zo(),"getDefaultColumnDef"),getDefaultTableOptions:o(t=>({onColumnSizingChange:Ke("columnSizing",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{de("columnSizingFeature",t,e,{column_getSize:{fn:o(n=>kt(n),"fn"),memoDeps:o(n=>[e.options.columns,e.atoms.columnSizing?.get()?.[n.id]],"memoDeps")},column_getStart:{fn:o((n,l)=>$a(n,l),"fn")},column_getAfter:{fn:o((n,l)=>La(n,l),"fn")},column_resetSize:{fn:o(n=>ja(n),"fn")}})},"assignColumnPrototype"),assignHeaderPrototype:o((t,e)=>{de("columnSizingFeature",t,e,{header_getSize:{fn:o(n=>rt(n),"fn"),memoDeps:o(n=>[e.options.columns,n.column.columns.length>0?e.atoms.columnSizing?.get():e.atoms.columnSizing?.get()?.[n.column.id]],"memoDeps")},header_getStart:{fn:o(n=>Ho(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=>{be("columnSizingFeature",t,{table_getColumnOffsets:{fn:o(()=>On(t),"fn"),memoDeps:o(()=>[t.options.columns,t.atoms.columnSizing?.get(),t.atoms.columnOrder?.get(),t.atoms.columnPinning?.get(),t.atoms.columnVisibility?.get(),t.atoms.grouping?.get(),t.options.groupedColumnMode],"memoDeps")},table_setColumnSizing:{fn:o(e=>Pt(t,e),"fn")},table_resetColumnSizing:{fn:o(e=>Ga(t,e),"fn")},table_getTotalSize:{fn:o(()=>qa(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")},table_getStartTotalSize:{fn:o(()=>Ka(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")},table_getCenterTotalSize:{fn:o(()=>Ua(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")},table_getEndTotalSize:{fn:o(()=>Ja(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")}})},"constructTableAPIs")};var Go={getInitialState:o(t=>({columnVisibility:ml(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({onColumnVisibilityChange:Ke("columnVisibility",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{de("columnVisibilityFeature",t,e,{column_getIsVisible:{fn:o(n=>me(n),"fn"),memoDeps:o(n=>[e.options.columns,e.atoms.columnVisibility?.get(),n.columns],"memoDeps")},column_getCanHide:{fn:o(n=>jt(n),"fn")},column_getToggleVisibilityHandler:{fn:o(n=>gl(n),"fn")},column_toggleVisibility:{fn:o((n,l)=>ho(n,l),"fn")}})},"assignColumnPrototype"),assignRowPrototype:o((t,e)=>{de("columnVisibilityFeature",t,e,{row_getVisibleCells:{fn:o(n=>bo(n),"fn"),memoDeps:o(n=>[n.getAllCells(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get()],"memoDeps")},row_getVisibleCellsByColumnId:{fn:o(n=>Rn(n),"fn"),memoDeps:o(n=>[n.getAllCells(),e.atoms.columnVisibility?.get()],"memoDeps")}})},"assignRowPrototype"),constructTableAPIs:o(t=>{be("columnVisibilityFeature",t,{table_getVisibleFlatColumns:{fn:o(()=>fl(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(()=>bt(t),"fn"),memoDeps:o(()=>[t.atoms.columnVisibility?.get(),t.atoms.columnOrder?.get(),t.atoms.grouping?.get(),t.options.columns,t.options.groupedColumnMode],"memoDeps")},table_setColumnVisibility:{fn:o(e=>Bt(t,e),"fn")},table_resetColumnVisibility:{fn:o(e=>pl(t,e),"fn")},table_toggleAllColumnsVisible:{fn:o(e=>wo(t,e),"fn")},table_getIsAllColumnsVisible:{fn:o(()=>xo(t),"fn")},table_getIsSomeColumnsVisible:{fn:o(()=>bl(t),"fn")},table_getToggleAllColumnsVisibilityHandler:{fn:o(()=>hl(t),"fn")}})},"constructTableAPIs")};function Ya(){return $()}o(Ya,"getDefaultRowSelectionState");function xt(t,e){t.options.onRowSelectionChange?.(e)}o(xt,"table_setRowSelection");function Za(t,e){t._lastSelectedRowId=null,xt(t,e?$():Object.assign($(),ie(t.initialState.rowSelection??{})))}o(Za,"table_resetRowSelection");function qo(t,e,n){t._lastSelectedRowId=null,xt(t,l=>{if(e=typeof e<"u"?e:!H(t,"getIsAllRowsSelected",Jo),n?.deselectAll&&!e)return $();let r=Object.assign($(),l),a=t.getPreGroupedRowModel().flatRows;if(e){let s=new Map;a.forEach(i=>{En(i,s)&&(r[i.id]=!0)})}else a.forEach(s=>{Ye(s)&&delete r[s.id]});return r})}o(qo,"table_toggleAllRowsSelected");function Ko(t,e,n){t._lastSelectedRowId=null,xt(t,l=>{let r=typeof e<"u"?e:!H(t,"getIsAllPageRowsSelected",Wo);if(n?.deselectAll&&!r)return $();let a=Object.assign($(),l);return t.getRowModel().rows.forEach(s=>{$n(a,s.id,r,!0,t,!0)}),a})}o(Ko,"table_toggleAllPageRowsSelected");function es(t){return t.getCoreRowModel()}o(es,"table_getPreSelectedRowModel");function ts(t){let e=t.getCoreRowModel();return H(t,"getIsSomeRowsSelected",Wt)?Yo(e,t):{rows:[],flatRows:[],rowsById:$()}}o(ts,"table_getSelectedRowModel");function ns(t){let e=t.getFilteredRowModel();return H(t,"getIsSomeRowsSelected",Wt)?Yo(e,t):{rows:[],flatRows:[],rowsById:$()}}o(ns,"table_getFilteredSelectedRowModel");function os(t){let e=t.getSortedRowModel();return H(t,"getIsSomeRowsSelected",Wt)?Yo(e,t):{rows:[],flatRows:[],rowsById:$()}}o(os,"table_getGroupedSelectedRowModel");function Uo(t){return Object.keys(t.atoms.rowSelection?.get()??{})}o(Uo,"table_getSelectedRowIds");function Jo(t){let e=t.getFilteredRowModel().flatRows,n=t.atoms.rowSelection?.get()??{},l=!!(e.length&&Object.keys(n).length);if(l){let r=new Map;e.some(a=>!Qt(a,n)&&En(a,r))&&(l=!1)}return l}o(Jo,"table_getIsAllRowsSelected");function Wo(t){let e=t.getPaginatedRowModel().flatRows,n=t.atoms.rowSelection?.get()??{},l=new Map,r=!1;for(let a=0;a<e.length;a++){let s=e[a];if(Qt(s,n))!r&&En(s,l)&&(r=!0);else if(En(s,l))return!1}return r}o(Wo,"table_getIsAllPageRowsSelected");function Wt(t){return H(t,"getSelectedRowIds",Uo).length>0}o(Wt,"table_getIsSomeRowsSelected");function rs(t){return t.getPaginatedRowModel().flatRows.filter(e=>Ye(e)).some(e=>zn(e)||H(e,"getIsSomeSelected",Xo))}o(rs,"table_getIsSomePageRowsSelected");function ls(t){return e=>{qo(t,e.target.checked)}}o(ls,"table_getToggleAllRowsSelectedHandler");function as(t){return e=>{Ko(t,e.target.checked)}}o(as,"table_getToggleAllPageRowsSelectedHandler");function Qo(t,e,n){let l=zn(t);xt(t.table,r=>{e=typeof e<"u"?e:!l;let a=Object.assign($(),r);return $n(a,t.id,e,(n?.selectChildren??!0)&&ct(t),t.table),!e&&n?.deselectParents&&cs(a,t),a})}o(Qo,"row_toggleSelected");function zn(t){return Qt(t,t.table.atoms.rowSelection?.get()??{})}o(zn,"row_getIsSelected");function Xo(t){return Zo(t)==="some"}o(Xo,"row_getIsSomeSelected");function ss(t){return Zo(t)==="all"}o(ss,"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 Hn(t){let e=t.table.options;return typeof e.enableSubRowSelection=="function"?e.enableSubRowSelection(t):e.enableSubRowSelection??!0}o(Hn,"row_getCanSelectSubRows");function ct(t){let e=t.table.options;return typeof e.enableMultiRowSelection=="function"?e.enableMultiRowSelection(t):e.enableMultiRowSelection??!0}o(ct,"row_getCanMultiSelect");function is(t,e){let n=Ye(t);return l=>{if(!n)return;let r=l,a=t.table,s=r.target.checked,i=a._lastSelectedRowId;(!(a.options.enableRowRangeSelection!==!1&&i!==null&&ct(t)&&(a.options.isRowRangeSelectionEvent?.(l)??!1))||!ac(t,i,s,e))&&Qo(t,s,e),a._lastSelectedRowId=t.id}}o(is,"row_getToggleSelectedHandler");function ac(t,e,n,l){let r=l?.selectChildren??!0,a=t.table,s=a.getRowsInDisplayOrder(),i=a.getPrePaginatedRowModel().rowsById[e]??a.getCoreRowModel().rowsById[e];if(!i)return!1;let c=i.getDisplayIndex(),u=t.getDisplayIndex(),d=s[c],g=s[u];if(c<0||u<0||c>=s.length||u>=s.length||d?.id!==i.id||g?.id!==t.id||!ct(i)||!ct(t))return!1;let m=Math.min(c,u),h=Math.max(c,u);return xt(a,p=>{let b=Object.assign($(),p);for(let w=m;w<=h;w++){let _=s[w];!Ye(_)||!ct(_)||($n(b,_.id,n,r,a),!n&&l?.deselectParents&&cs(b,_))}return b}),!0}o(ac,"selectRowRange");function $n(t,e,n,l,r,a){let s=r.getRow(e,!0);n?(ct(s)||Object.keys(t).forEach(i=>delete t[i]),Ye(s)&&(t[e]=!0)):(!a||Ye(s))&&delete t[e],l&&s.subRows.length&&Hn(s)&&s.subRows.forEach(i=>$n(t,i.id,n,l,r,a))}o($n,"mutateRowIsSelected");function En(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 a=n.getCoreRowModel().rowsById,s=[],i=!0,c=l;for(;c!==void 0;){let u=e.get(c);if(u!==void 0){i=u;break}s.push(c);let d=a[c]??n.getRow(c,!0);if(!Hn(d)){i=!1;break}c=d.parentId}return s.forEach(u=>e.set(u,i)),i}o(En,"isRowSelectableInSelectAll");function cs(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(cs,"pruneAncestorRowIds");function us(t,e,n,l){let r=[];for(let a=0;a<t.length;a++){let s=t[a],i=Qt(s,e);if(i&&(n.push(s),l[s.id]=s),s.subRows.length){let c=us(s.subRows,e,n,l);if(i){let u=Object.create(Object.getPrototypeOf(s));vn(u,s),u.subRows=c,r.push(u)}}else i&&r.push(s)}return r}o(us,"selectRowsRecursively");function Yo(t,e){let n=[],l=$(),r=e.atoms.rowSelection?.get()??{};return{rows:us(t.rows,r,n,l),flatRows:n,rowsById:l}}o(Yo,"selectRowsFn");function Qt(t,e){return!!(qe(e,t.id)&&e[t.id])}o(Qt,"isRowSelected");function Zo(t){if(!t.subRows.length)return!1;let e=t.table.atoms.rowSelection?.get()??{},n=!1,l=!0,r=!1;for(let a=0;a<t.subRows.length;a++){let s=t.subRows[a];if(n&&!l)break;if(Ye(s)&&(r=!0,Qt(s,e)?n=!0:l=!1),s.subRows.length){let i=Zo(s);i==="all"?(n=!0,r=!0):i==="some"?(n=!0,l=!1,r=!0):l=!1}}return r?l?"all":n?"some":!1:!1}o(Zo,"isSubRowSelected");var er={initTableInstanceData:o(t=>{t._lastSelectedRowId=null},"initTableInstanceData"),resetTableInstanceData:o(t=>{t._lastSelectedRowId=null},"resetTableInstanceData"),getInitialState:o(t=>({rowSelection:Ya(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({onRowSelectionChange:Ke("rowSelection",t),enableRowSelection:!0,enableMultiRowSelection:!0,enableRowRangeSelection:!0,enableSubRowSelection:!0,isRowRangeSelectionEvent:o(e=>{let n=e;return!!(n.shiftKey||n.nativeEvent?.shiftKey)},"isRowRangeSelectionEvent")}),"getDefaultTableOptions"),assignRowPrototype:o((t,e)=>{de("rowSelectionFeature",t,e,{row_toggleSelected:{fn:o((n,l,r)=>Qo(n,l,r),"fn")},row_getIsSelected:{fn:o(n=>zn(n),"fn")},row_getIsSomeSelected:{fn:o(n=>Xo(n),"fn"),memoDeps:o(n=>[n.subRows,n.table.atoms.rowSelection?.get(),n.table.options.enableRowSelection],"memoDeps")},row_getIsAllSubRowsSelected:{fn:o(n=>ss(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=>Hn(n),"fn")},row_getCanMultiSelect:{fn:o(n=>ct(n),"fn")},row_getToggleSelectedHandler:{fn:o((n,l)=>is(n,l),"fn")}})},"assignRowPrototype"),constructTableAPIs:o(t=>{be("rowSelectionFeature",t,{table_setRowSelection:{fn:o(e=>xt(t,e),"fn")},table_resetRowSelection:{fn:o(e=>Za(t,e),"fn")},table_toggleAllRowsSelected:{fn:o((e,n)=>qo(t,e,n),"fn")},table_toggleAllPageRowsSelected:{fn:o((e,n)=>Ko(t,e,n),"fn")},table_getPreSelectedRowModel:{fn:o(()=>es(t),"fn")},table_getSelectedRowModel:{fn:o(()=>ts(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getCoreRowModel()],"memoDeps")},table_getFilteredSelectedRowModel:{fn:o(()=>ns(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getFilteredRowModel()],"memoDeps")},table_getGroupedSelectedRowModel:{fn:o(()=>os(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getSortedRowModel()],"memoDeps")},table_getSelectedRowIds:{fn:o(()=>Uo(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get()],"memoDeps")},table_getIsAllRowsSelected:{fn:o(()=>Jo(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getFilteredRowModel(),t.options.enableRowSelection,t.options.enableSubRowSelection],"memoDeps")},table_getIsAllPageRowsSelected:{fn:o(()=>Wo(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getPaginatedRowModel(),t.options.enableRowSelection,t.options.enableSubRowSelection],"memoDeps")},table_getIsSomeRowsSelected:{fn:o(()=>Wt(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get()],"memoDeps")},table_getIsSomePageRowsSelected:{fn:o(()=>rs(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getPaginatedRowModel(),t.options.enableRowSelection],"memoDeps")},table_getToggleAllRowsSelectedHandler:{fn:o(()=>ls(t),"fn")},table_getToggleAllPageRowsSelectedHandler:{fn:o(()=>as(t),"fn")}})},"constructTableAPIs")};var tr={getInitialState(t){return{sorting:Zl(),...t}},getDefaultColumnDef(){return{sortFn:"auto",sortUndefined:1}},getDefaultTableOptions(t){return{autoResetSorting:!1,onSortingChange:Ke("sorting",t),isMultiSortEvent:o(e=>e.shiftKey,"isMultiSortEvent")}},assignColumnPrototype(t,e){de("rowSortingFeature",t,e,{column_getAutoSortFn:{fn:o(n=>ko(n),"fn")},column_getAutoSortDir:{fn:o(n=>Po(n),"fn")},column_getSortFn:{fn:o(n=>Pn(n),"fn")},column_toggleSorting:{fn:o((n,l,r)=>No(n,l,r),"fn")},column_getFirstSortDir:{fn:o(n=>Do(n),"fn")},column_getNextSortingOrder:{fn:o((n,l)=>Ao(n,l),"fn")},column_getCanSort:{fn:o(n=>Ut(n),"fn")},column_getCanMultiSort:{fn:o(n=>qt(n),"fn")},column_getIsSorted:{fn:o(n=>Oo(n),"fn")},column_getSortIndex:{fn:o(n=>ta(n),"fn")},column_clearSorting:{fn:o(n=>na(n),"fn")},column_getToggleSortingHandler:{fn:o(n=>oa(n),"fn")}})},constructTableAPIs(t){be("rowSortingFeature",t,{table_setSorting:{fn:o(e=>Kt(t,e),"fn")},table_resetSorting:{fn:o(e=>Mo(t,e),"fn")}})}};function nr(){return t=>{let e=t;return Ft({feature:"rowSortingFeature",table:e,fnName:"table.getSortedRowModel",memoDeps:o(()=>[e.atoms.sorting?.get(),e.getPreSortedRowModel()],"memoDeps"),fn:o(()=>sc(e),"fn"),onAfterUpdate:yn(()=>kn(e))})}}o(nr,"createSortedRowModel");function sc(t){let e=t.getPreSortedRowModel(),n=t.atoms.sorting?.get();if(!e.rows.length||!n?.length)return e;let l=[],r=n.filter(c=>{let u=t.getColumn(c.id);return u?Ut(u):!1});if(!r.length)return e;let a=[];for(let c=0;c<r.length;c++){let u=r[c],d=t.getColumn(u.id);d&&a.push({id:u.id,desc:u.desc,sortUndefined:d.columnDef.sortUndefined,invertSorting:d.columnDef.invertSorting,sortFn:Pn(d)})}let s=o((c,u)=>{for(let d=0;d<a.length;d++){let g=a[d],m=g.sortUndefined,h=g.desc,p=0;if(m){let b=c.getValue(g.id),w=u.getValue(g.id),_=b===void 0,S=w===void 0;if(_&&S)continue;if(_||S){if(m==="first")return _?-1:1;if(m==="last")return _?1:-1;p=_?m:-m}}if(p===0&&(p=g.sortFn(c,u,g.id)),p!==0)return h&&(p*=-1),g.invertSorting&&(p*=-1),p}return c.index-u.index},"compareRows"),i=o(c=>{let u=c.slice();u.sort(s);let d=!1;for(let g=0;g<u.length;g++){let m=u[g];m!==c[g]&&(d=!0);let h=l.length;if(l.push(m),m.subRows.length){let p=i(m.subRows);if(p.changed){let b=Object.create(Object.getPrototypeOf(m));vn(b,m),b.subRows=p.rows,u[g]=b,l[h]=b,d=!0}}}return{rows:u,changed:d}},"sortData");return{rows:i(e.rows).rows,flatRows:l,rowsById:e.rowsById}}o(sc,"_createSortedRowModel");var ut=Me(mt(),1);var ic=typeof window>"u"?ut.useEffect:ut.useLayoutEffect;function or(t,e){let[{table:n,rootSource:l}]=(0,ut.useState)(()=>{let c=Vo({...t,features:{coreReactivityFeature:Yr(),...t.features}});return c.Subscribe=(u=>Qr({...u,source:u.source??c.store})),c.FlexRender=mo,{table:c,rootSource:fo(c.store,st)}}),r=n;Jt(r,c=>({...c,...t}),{syncExternalState:!1});let a=r.options.state,s=l.get(),i=rn(l,e,{compare:st});return ic(()=>{l.markCommitted(s),Dn(r,a??null,st)}),(0,ut.useMemo)(()=>({...n,options:t,state:i}),[n,t,i])}o(or,"useTable");var ds=Me(Et(),1),ms=Me(mt(),1);var Ie=Me(zt(),1);var cc=[{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"}],gs=o(t=>{let e=t.trim(),n=Number(e);return e!==""&&Number.isFinite(n)&&String(n)===e?n:t},"E"),uc=o(t=>{let e=t.trim();return(e.length>=2&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):void 0)??(e==="true"||e==="false"?e==="true":gs(t))},"G"),dc=o(t=>t.operator==="has"?uc(t.value):gs(t.value),"I"),mc=o(t=>t.operator==="contains"?t.value==="":t.operator!=="eq"&&t.operator!=="ne"&&t.literal===void 0&&t.value.trim()==="","J"),gc=o(t=>{if(t.pathSegments!==void 0)return t.pathSegments;let e=t.path??"";return e.trim()===""?void 0:e.split(".").map(n=>n.trim())},"L"),Ze=o(t=>t.filter(e=>e.column!==""&&!mc(e)).map(e=>{let n=gc(e),l=n===void 0?{}:{path:n};return e.operator==="contains"?{column:e.column,operator:e.operator,...l,value:e.value}:{column:e.column,operator:e.operator,...l,value:e.literal===void 0?dc(e):e.literal[0]}}),"_"),rr=o((t,e)=>({column:t.column,operator:t.operator,path:t.path,pathSegments:t.pathSegments,value:t.value,...e}),"j"),fs=o(t=>{let e=(0,ds.c)(51),{columns:n,filters:l,onAskAi:r,onFiltersChange:a,onSearchChange:s,search:i}=t,[c,u]=(0,ms.useState)(""),d=te(),g;e[0]!==n[0]||e[1]!==l||e[2]!==a?(g=o(()=>{a([...l,{column:n[0]??"",operator:"eq",value:""}])},"T"),e[0]=n[0],e[1]=l,e[2]=a,e[3]=g):g=e[3];let m=g,h;e[4]!==l||e[5]!==a?(h=o(M=>{let O=Number(M.currentTarget.dataset.index);a(l.filter((T,A)=>A!==O))},"w"),e[4]=l,e[5]=a,e[6]=h):h=e[6];let p=h,b;e[7]!==l||e[8]!==a?(b=o(M=>{let O=Number(M.currentTarget.dataset.index),T=M.currentTarget.value;a(l.map((A,E)=>E===O?rr(A,{column:T,path:void 0,pathSegments:void 0}):A))},"y"),e[7]=l,e[8]=a,e[9]=b):b=e[9];let w=b,_;e[10]!==l||e[11]!==a?(_=o(M=>{let O=Number(M.currentTarget.dataset.index),T=M.currentTarget.value;a(l.map((A,E)=>E!==O?A:T==="has"?rr(A,{operator:T}):{...A,operator:T}))},"q"),e[10]=l,e[11]=a,e[12]=_):_=e[12];let S=_,y;e[13]!==l||e[14]!==a?(y=o(M=>{let O=Number(M.currentTarget.dataset.index),T=M.currentTarget.value;a(l.map((A,E)=>E===O?{...A,path:T,pathSegments:void 0}:A))},"k"),e[13]=l,e[14]=a,e[15]=y):y=e[15];let I=y,C;e[16]!==l||e[17]!==a?(C=o(M=>{let O=Number(M.currentTarget.dataset.index),T=M.currentTarget.value;a(l.map((A,E)=>E===O?rr(A,{value:T}):A))},"A"),e[16]=l,e[17]=a,e[18]=C):C=e[18];let R=C,x;e[19]!==s||e[20]!==i?(x=(0,Ie.jsx)("input",{"aria-label":"Search rows","data-testid":"db-filter",onChange:s,placeholder:"search table\u2026",value:i}),e[19]=s,e[20]=i,e[21]=x):x=e[21];let v;e[22]!==m?(v=(0,Ie.jsx)("button",{"data-testid":"db-add-filter",onClick:m,type:"button",children:"Add filter"}),e[22]=m,e[23]=v):v=e[23];let F;e[24]!==c||e[25]!==r?(F=r!==void 0&&(0,Ie.jsxs)(Ie.Fragment,{children:[(0,Ie.jsx)("input",{"aria-label":"Describe a filter","data-testid":"db-ai-prompt",onChange:o(M=>{u(M.target.value)},"onChange"),onKeyDown:o(M=>{M.key==="Enter"&&c.trim()!==""&&(M.preventDefault(),r(c.trim()))},"onKeyDown"),placeholder:"describe a filter\u2026",value:c}),(0,Ie.jsx)("button",{"data-testid":"db-ai-filter",disabled:c.trim()==="",onClick:o(()=>{r(c.trim())},"onClick"),type:"button",children:"Suggest"})]}),e[24]=c,e[25]=r,e[26]=F):F=e[26];let N;e[27]!==x||e[28]!==v||e[29]!==F?(N=(0,Ie.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[x,v,F]}),e[27]=x,e[28]=v,e[29]=F,e[30]=N):N=e[30];let k;if(e[31]!==w||e[32]!==S||e[33]!==I||e[34]!==R||e[35]!==n||e[36]!==l||e[37]!==p||e[38]!==d){let M;e[40]!==w||e[41]!==S||e[42]!==I||e[43]!==R||e[44]!==n||e[45]!==p||e[46]!==d?(M=o((O,T)=>(0,Ie.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"db-filter-row",children:[(0,Ie.jsx)("select",{"aria-label":"Filter column","data-index":T,"data-testid":"db-filter-column",onChange:w,value:O.column,children:n.map(fc)}),(0,Ie.jsx)("select",{"aria-label":"Filter operator","data-index":T,"data-testid":"db-filter-operator",onChange:S,value:O.operator,children:[...cc,{label:d("has"),value:"has"}].map(pc)}),(0,Ie.jsx)("input",{"aria-label":d("Nested field path"),"data-index":T,"data-testid":"db-filter-path",onChange:I,placeholder:d("nested path, e.g. geo.city"),value:O.path??""}),(0,Ie.jsx)("input",{"aria-label":"Filter value","data-index":T,"data-testid":"db-filter-value",onChange:R,placeholder:O.operator==="has"?d('value ("10" in quotes matches text)'):"value",value:O.value}),(0,Ie.jsx)("button",{"aria-label":"Remove filter","data-index":T,"data-testid":"db-filter-remove",onClick:p,type:"button",children:"\u2715"})]},T),"r"),e[40]=w,e[41]=S,e[42]=I,e[43]=R,e[44]=n,e[45]=p,e[46]=d,e[47]=M):M=e[47],k=l.map(M),e[31]=w,e[32]=S,e[33]=I,e[34]=R,e[35]=n,e[36]=l,e[37]=p,e[38]=d,e[39]=k}else k=e[39];let P;return e[48]!==N||e[49]!==k?(P=(0,Ie.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"db-filters",children:[N,k]}),e[48]=N,e[49]=k,e[50]=P):P=e[50],P},"ee");function fc(t){return(0,Ie.jsx)("option",{value:t,children:t},t)}o(fc,"M");function pc(t){return(0,Ie.jsx)("option",{value:t.value,children:t.label},t.value)}o(pc,"Q");var bc=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"),hc=o(t=>{let e=new Map,n=new Set;for(let l of t.tables)for(let r of l.relations){if(r.kind!=="one"||r.onDelete==="set null")continue;let a=r.references,s=`${a}\0${l.name}\0${r.field}`;if(n.has(s))continue;n.add(s);let i=e.get(a)??[];i.push({...r,table:l.name}),e.set(a,i)}return e},"Ro"),wc=o((t,e)=>{let n=[],l=[t];for(;l.length>0;){let r=l.shift();if(r===void 0)break;e(r)&&n.push(r);for(let a of r.children)l.push(a)}return n},"$o"),ps=o((t,e)=>{let n=[];for(let[l,r]of Object.entries(e))for(let a of r)a.ref===t&&n.push({column:a.name,table:l});return n.sort((l,r)=>l.table.localeCompare(r.table)||l.column.localeCompare(r.column)),n},"Jt"),cr=o(t=>`${t.table}.${t.column}`,"Ot"),xc=o(t=>{let e=(0,q.c)(111),{columns:n,onApply:l,onClose:r,shardKey:a,table:s,total:i,uniqueColumns:c}=t,u=te(),[d,g]=(0,D.useState)(n[0]??""),[m,h]=(0,D.useState)(""),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=o(fe=>{g(fe.target.value)},"f"),e[0]=p):p=e[0];let b=p,w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w=o(fe=>{h(fe.target.value)},"h"),e[1]=w):w=e[1];let _=w,S;e[2]!==m?(S=m.trim(),e[2]=m,e[3]=S):S=e[3];let y=S==="",I,C;if(e[4]!==y||e[5]!==u||e[6]!==m){if(!y)try{C=on(JSON.parse(m))}catch(fe){I=u("Invalid JSON: {message}",{message:fe.message})}e[4]=y,e[5]=u,e[6]=m,e[7]=I,e[8]=C}else I=e[7],C=e[8];let R;e[9]!==d||e[10]!==i||e[11]!==c?(R=c.has(d)&&i>1,e[9]=d,e[10]=i,e[11]=c,e[12]=R):R=e[12];let x=R,v=d!==""&&!y&&I===void 0&&!x,F;e[13]!==v||e[14]!==d||e[15]!==l||e[16]!==r||e[17]!==C?(F=o(()=>{v&&(l({[d]:C}),r())},"T"),e[13]=v,e[14]=d,e[15]=l,e[16]=r,e[17]=C,e[18]=F):F=e[18];let N=F,k;e[19]!==u?(k=u("Set a column on matching rows"),e[19]=u,e[20]=k):k=e[20];let P;e[21]!==u?(P=u("Set a column on matching rows"),e[21]=u,e[22]=P):P=e[22];let M;e[23]!==P?(M=(0,f.jsx)("h3",{className:"text-base text-foreground","data-testid":"bulk-patch-title",children:P}),e[23]=P,e[24]=M):M=e[24];let O;e[25]!==u||e[26]!==s||e[27]!==i?(O=u("Writes {total} rows of {table} through the schema-aware writer \u2014 validators and indexes apply, exactly like a mutation.",{table:s,total:i.toString()}),e[25]=u,e[26]=s,e[27]=i,e[28]=O):O=e[28];let T;e[29]!==O?(T=(0,f.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-desc",children:O}),e[29]=O,e[30]=T):T=e[30];let A;e[31]!==a||e[32]!==u?(A=a===""?u("Shard: root"):u("Shard: {shardKey} \u2014 rows in other shards are not touched.",{shardKey:a}),e[31]=a,e[32]=u,e[33]=A):A=e[33];let E;e[34]!==A?(E=(0,f.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-shard",children:A}),e[34]=A,e[35]=E):E=e[35];let K;e[36]!==T||e[37]!==E||e[38]!==M?(K=(0,f.jsxs)("div",{className:"flex flex-col gap-0.5",children:[M,T,E]}),e[36]=T,e[37]=E,e[38]=M,e[39]=K):K=e[39];let U;e[40]!==u?(U=u("Close"),e[40]=u,e[41]=U):U=e[41];let V;e[42]!==r||e[43]!==U?(V=(0,f.jsx)(ln,{"data-testid":"bulk-patch-close",onClick:r,size:"xs",variant:"ghost",children:U}),e[42]=r,e[43]=U,e[44]=V):V=e[44];let Q;e[45]!==K||e[46]!==V?(Q=(0,f.jsxs)("div",{className:"flex items-start justify-between",children:[K,V]}),e[45]=K,e[46]=V,e[47]=Q):Q=e[47];let J;e[48]!==u?(J=u("Column"),e[48]=u,e[49]=J):J=e[49];let Z;e[50]!==J?(Z=(0,f.jsx)(co,{htmlFor:"bulk-patch-column",children:J}),e[50]=J,e[51]=Z):Z=e[51];let re;e[52]!==u?(re=u("Column"),e[52]=u,e[53]=re):re=e[53];let oe;e[54]!==n?(oe=n.map(Sc),e[54]=n,e[55]=oe):oe=e[55];let ae;e[56]!==d||e[57]!==re||e[58]!==oe?(ae=(0,f.jsx)("select",{"aria-label":re,className:"h-8 rounded-md border border-input bg-transparent px-2 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"bulk-patch-column",id:"bulk-patch-column",onChange:b,value:d,children:oe}),e[56]=d,e[57]=re,e[58]=oe,e[59]=ae):ae=e[59];let ge;e[60]!==u?(ge=u("Value"),e[60]=u,e[61]=ge):ge=e[61];let he;e[62]!==ge?(he=(0,f.jsx)(co,{htmlFor:"bulk-patch-value",children:ge}),e[62]=ge,e[63]=he):he=e[63];let ve;e[64]!==m?(ve=(0,f.jsx)(vr,{className:"flex-1 font-mono","data-testid":"bulk-patch-value",id:"bulk-patch-value",onChange:_,placeholder:"true",value:m}),e[64]=m,e[65]=ve):ve=e[65];let Se;e[66]!==Z||e[67]!==ae||e[68]!==he||e[69]!==ve?(Se=(0,f.jsxs)("div",{className:"flex items-center gap-2",children:[Z,ae,he,ve]}),e[66]=Z,e[67]=ae,e[68]=he,e[69]=ve,e[70]=Se):Se=e[70];let _e;e[71]!==I?(_e=I!==void 0&&(0,f.jsx)("p",{className:"text-xs text-destructive","data-testid":"bulk-patch-error",role:"alert",children:I}),e[71]=I,e[72]=_e):_e=e[72];let ye;e[73]!==d||e[74]!==u||e[75]!==i||e[76]!==x?(ye=x&&(0,f.jsx)("p",{className:"text-xs text-destructive","data-testid":"bulk-patch-unique",role:"alert",children:u("{column} has a unique index \u2014 the same value cannot be set on {total} rows.",{column:d,total:i.toString()})}),e[73]=d,e[74]=u,e[75]=i,e[76]=x,e[77]=ye):ye=e[77];let L;e[78]!==y||e[79]!==u||e[80]!==x?(L=y&&!x&&(0,f.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-hint",children:u('Enter a JSON value \u2014 for example true, 0, null, or "done".')}),e[78]=y,e[79]=u,e[80]=x,e[81]=L):L=e[81];let X;e[82]!==v||e[83]!==d||e[84]!==m?(X=v&&(0,f.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"bulk-patch-preview",children:`${d} = ${m.trim()}`}),e[82]=v,e[83]=d,e[84]=m,e[85]=X):X=e[85];let le;e[86]!==u?(le=u("Cancel"),e[86]=u,e[87]=le):le=e[87];let Fe;e[88]!==r||e[89]!==le?(Fe=(0,f.jsx)(ln,{"data-testid":"bulk-patch-cancel",onClick:r,size:"xs",variant:"outline",children:le}),e[88]=r,e[89]=le,e[90]=Fe):Fe=e[90];let De=!v,se;e[91]!==u||e[92]!==i?(se=u("Set on {total} rows",{total:i.toString()}),e[91]=u,e[92]=i,e[93]=se):se=e[93];let ee;e[94]!==N||e[95]!==De||e[96]!==se?(ee=(0,f.jsx)(ln,{"data-testid":"bulk-patch-apply",disabled:De,onClick:N,size:"xs",children:se}),e[94]=N,e[95]=De,e[96]=se,e[97]=ee):ee=e[97];let G;e[98]!==Fe||e[99]!==ee?(G=(0,f.jsxs)("div",{className:"flex justify-end gap-2",children:[Fe,ee]}),e[98]=Fe,e[99]=ee,e[100]=G):G=e[100];let Ae;return e[101]!==r||e[102]!==Q||e[103]!==Se||e[104]!==_e||e[105]!==ye||e[106]!==L||e[107]!==X||e[108]!==G||e[109]!==k?(Ae=(0,f.jsxs)($t,{label:k,onClose:r,panelTestId:"bulk-patch-panel",testId:"bulk-patch-overlay",variant:"dialog",children:[Q,Se,_e,ye,L,X,G]}),e[101]=r,e[102]=Q,e[103]=Se,e[104]=_e,e[105]=ye,e[106]=L,e[107]=X,e[108]=G,e[109]=k,e[110]=Ae):Ae=e[110],Ae},"Do");function Sc(t){return(0,f.jsx)("option",{value:t,children:t},t)}o(Sc,"Ao");var bs=6,jn=100,_c=o(t=>({paddingLeft:t*16}),"Po"),Cc=o(t=>{let e=(0,q.c)(2),{table:n}=t,l=`cascade-restrict-${n}`,r;return e[0]!==l?(r=(0,f.jsx)("span",{className:"rounded bg-destructive/10 px-1 text-destructive","data-testid":l,children:"restrict \u2014 will block delete"}),e[0]=l,e[1]=r):r=e[1],r},"Io"),vc=o(t=>{let e=(0,q.c)(2),{table:n}=t,l=`cascade-cascade-${n}`,r;return e[0]!==l?(r=(0,f.jsx)("span",{className:"rounded bg-warning/10 px-1 text-warning","data-testid":l,children:"cascade"}),e[0]=l,e[1]=r):r=e[1],r},"Oo"),yc=o(t=>{let e=(0,q.c)(2),{table:n}=t,l=`cascade-undeclared-${n}`,r;return e[0]!==l?(r=(0,f.jsx)("span",{className:"rounded bg-muted px-1 text-muted-foreground","data-testid":l,children:"references \u2014 no delete action declared"}),e[0]=l,e[1]=r):r=e[1],r},"Fo"),Rc=o(t=>t.relation===void 0||t.relation.onDelete==="cascade"?(0,f.jsx)(vc,{table:t.table}):t.isRestrict?(0,f.jsx)(Cc,{table:t.table}):(0,f.jsx)(yc,{table:t.table}),"Mo"),Rs=o(t=>{let e=(0,q.c)(35),{depth:n,node:l}=t,r=`cascade-row-${l.table}`,a;e[0]!==n?(a=_c(n),e[0]=n,e[1]=a):a=e[1];let s;e[2]!==n?(s=n>0&&(0,f.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2514"}),e[2]=n,e[3]=s):s=e[3];let i;e[4]!==l.table?(i=(0,f.jsx)("span",{className:"font-medium text-foreground",children:l.table}),e[4]=l.table,e[5]=i):i=e[5];let c;e[6]!==l.relation||e[7]!==l.table?(c=l.relation!==void 0&&(0,f.jsxs)("span",{className:"text-muted-foreground","data-testid":`cascade-col-${l.table}-${l.relation.field}`,children:["via ",l.relation.field]}),e[6]=l.relation,e[7]=l.table,e[8]=c):c=e[8];let u;e[9]!==l.rowCount?(u=l.rowCount.toString(),e[9]=l.rowCount,e[10]=u):u=e[10];let d;e[11]!==u?(d=(0,f.jsxs)("span",{className:"text-muted-foreground",children:["(",u," rows)"]}),e[11]=u,e[12]=d):d=e[12];let g;e[13]!==l?(g=Rc(l),e[13]=l,e[14]=g):g=e[14];let m;e[15]!==l.capNote||e[16]!==l.table?(m=l.capNote!==void 0&&(0,f.jsxs)("span",{className:"italic text-muted-foreground","data-testid":`cascade-cap-${l.table}`,children:["(",l.capNote,")"]}),e[15]=l.capNote,e[16]=l.table,e[17]=m):m=e[17];let h;e[18]!==r||e[19]!==a||e[20]!==s||e[21]!==i||e[22]!==c||e[23]!==d||e[24]!==g||e[25]!==m?(h=(0,f.jsxs)("li",{className:"flex flex-wrap items-center gap-1.5 py-1 font-mono text-xs","data-testid":r,style:a,children:[s,i,c,d,g,m]}),e[18]=r,e[19]=a,e[20]=s,e[21]=i,e[22]=c,e[23]=d,e[24]=g,e[25]=m,e[26]=h):h=e[26];let p;if(e[27]!==n||e[28]!==l.children){let w;e[30]!==n?(w=o((_,S)=>(0,f.jsx)(Rs,{depth:n+1,node:_},`${_.table}-${_.relation?.field??"root"}-${S.toString()}`),"h"),e[30]=n,e[31]=w):w=e[31],p=l.children.map(w),e[27]=n,e[28]=l.children,e[29]=p}else p=e[29];let b;return e[32]!==h||e[33]!==p?(b=(0,f.jsxs)(f.Fragment,{children:[h,p]}),e[32]=h,e[33]=p,e[34]=b):b=e[34],b},"an"),Ic=o(t=>{let e=t._id??t.id??t.__id__??"";return typeof e=="string"?e:typeof e=="number"?e.toString():""},"Vo"),Fc=o(async(t,e,n,l)=>{try{let r=await l(t,e,n),a=r.rows.flatMap(i=>Ic(i)||[]).slice(0,jn),s=r.total??0;return{capNote:s>jn?`showing first ${jn.toString()} of ${s.toString()}`:void 0,rowCount:s,rowIds:a}}catch{return{capNote:"count unavailable",rowCount:0,rowIds:[]}}},"Lo"),Is=o(async(t,e,n,l,r,a,s)=>{let{capNote:i,rowCount:c,rowIds:u}=n===void 0?{capNote:void 0,rowCount:1,rowIds:[e]}:await Fc(t,n.field,e,s),d=n?.onDelete==="restrict",g=[],m=`${t}:${e}`,h=a>=bs;if(!r.has(m)&&!h){r.add(m);let b=l.get(t)??[];for(let w of b)for(let _ of u.slice(0,10)){let S=await Is(w.table,_,w,l,r,a+1,s);(S.rowCount>0||a===0)&&g.push(S)}r.delete(m)}let p=i;if(h){let b=`depth capped at ${bs.toString()}`;p=i===void 0?b:`${i}; ${b}`}return{capNote:p,children:g,isRestrict:d,relation:n,rowCount:c,rowIds:u,table:t}},"cn"),Mc=o(({onClose:t,onConfirm:e,readPage:n,rowId:l,schema:r,table:a})=>{let s=te(),[i,c]=(0,D.useState)(!0),[u,d]=(0,D.useState)(null),[g,m]=(0,D.useState)(null);(0,D.useEffect)(()=>{let b=!1;return ne((async()=>{try{c(!0),m(null);let w=hc(r);if(!((w.get(a)??[]).length>0)){b||(d({capNote:void 0,children:[],isRestrict:!1,relation:void 0,rowCount:1,rowIds:[l],table:a}),c(!1));return}let _=await Is(a,l,void 0,w,new Set,0,n);b||(d(_),c(!1))}catch(w){b||(m(w.message),c(!1))}})()),()=>{b=!0}},[l,a]);let h=u!==null&&wc(u,b=>b.isRestrict).length>0,p=o(()=>{e(),t()},"f");return(0,f.jsxs)($t,{label:"Cascade impact preview",onClose:t,panelTestId:"cascade-panel",testId:"cascade-overlay",variant:"dialog",children:[(0,f.jsxs)("div",{className:"flex items-start justify-between",children:[(0,f.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,f.jsx)("h3",{className:"text-base text-foreground","data-testid":"cascade-title",children:s("Cascade impact")}),(0,f.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-desc",children:s("Delete preview \u2014 rows that would cascade or be blocked")})]}),(0,f.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground","data-testid":"cascade-close",onClick:t,type:"button",children:s("Close")})]}),i&&(0,f.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-loading",children:s("Loading\u2026")}),g!==null&&(0,f.jsx)("p",{className:"text-xs text-destructive","data-testid":"cascade-error",role:"alert",children:g}),!i&&u!==null&&(0,f.jsx)("ul",{className:"flex flex-col","data-testid":"cascade-tree",children:(0,f.jsx)(Rs,{depth:0,node:u})}),!i&&u!==null&&u.children.length===0&&(0,f.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-no-impact",children:s("No related rows found.")}),h&&(0,f.jsx)("p",{className:"text-sm font-medium text-destructive","data-testid":"cascade-blocker-warning",role:"alert",children:s("Restrict relations will block this delete.")}),(0,f.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,f.jsx)("button",{className:"rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"cascade-cancel",onClick:t,type:"button",children:s("Cancel")}),(0,f.jsx)("button",{className:"rounded-md bg-destructive px-3 py-1.5 text-xs font-medium text-destructive-foreground outline-none transition-colors hover:bg-destructive/90 focus-visible:bg-destructive/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"cascade-confirm",disabled:i,onClick:p,type:"button",children:s("Delete")})]})]})},"Bo"),kc=o((t,e,n,l,r=300)=>{if(l<=0)return{ids:new Set(t.map(g=>g.id)),leadPx:0,tailPx:0};let a=n-r,s=n+l+r,i=new Set,c=0,u=0,d=0;for(let g of t){let m=g.getSize(),h=e.has(g.id),p=c+m>a&&c<s;h||p?i.add(g.id):c<a?u+=m:d+=m,c+=m}return{ids:i,leadPx:u,tailPx:d}},"jo"),Pc=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"),Nc={columnOrderingFeature:Eo,columnResizingFeature:jo,columnSizingFeature:Bo,columnVisibilityFeature:Go,rowSelectionFeature:er,rowSortingFeature:tr,sortedRowModel:nr(),sortFns:{alphanumeric:yo,basic:Mt,datetime:Io,text:Ro}},Dc=o(()=>{let t=(0,q.c)(12),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={},t[0]=e):e=t[0];let[n,l]=(0,D.useState)(e),r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=o((b,w,_)=>{l(S=>({...S,[b]:{...S[b],[w]:_}}))},"t"),t[1]=r):r=t[1];let a=r,s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=o(()=>{l({})},"l"),t[2]=s):s=t[2];let i=s,c;t[3]===Symbol.for("react.memo_cache_sentinel")?(c=o((b,w)=>{l(_=>{let S=_[b];if(S===void 0)return _;let 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!==b})):{..._,[b]:y}})},"a"),t[3]=c):c=t[3];let u=c,d;t[4]!==n?(d=o((b,w)=>{let _=n[b];return _!==void 0&&w in _?{value:_[w]}:void 0},"u"),t[4]=n,t[5]=d):d=t[5];let g=d,m;t[6]!==n?(m=Object.values(n).reduce(Oc,0),t[6]=n,t[7]=m):m=t[7];let h=m,p;return t[8]!==h||t[9]!==n||t[10]!==g?(p={clear:i,count:h,drop:u,stage:a,staged:n,stagedValue:g},t[8]=h,t[9]=n,t[10]=g,t[11]=p):p=t[11],p},"Ko"),Fs=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"),Ac=o(t=>{let e=(0,q.c)(29),{changes:n,committing:l,onCommit:r,onDiscard:a}=t,s=te(),i;e[0]!==n.length||e[1]!==s?(i=s("{count} pending changes",{count:n.length}),e[0]=n.length,e[1]=s,e[2]=i):i=e[2];let c;e[3]!==i?(c=(0,f.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-warning","data-testid":"db-staged-count",children:i}),e[3]=i,e[4]=c):c=e[4];let u;e[5]!==l||e[6]!==s?(u=s(l?"Committing\u2026":"Commit"),e[5]=l,e[6]=s,e[7]=u):u=e[7];let d;e[8]!==l||e[9]!==r||e[10]!==u?(d=(0,f.jsx)("button",{className:"ms-auto rounded-md bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"db-staged-commit",disabled:l,onClick:r,type:"button",children:u}),e[8]=l,e[9]=r,e[10]=u,e[11]=d):d=e[11];let g;e[12]!==s?(g=s("Discard"),e[12]=s,e[13]=g):g=e[13];let m;e[14]!==l||e[15]!==a||e[16]!==g?(m=(0,f.jsx)("button",{className:"rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50","data-testid":"db-staged-discard",disabled:l,onClick:a,type:"button",children:g}),e[14]=l,e[15]=a,e[16]=g,e[17]=m):m=e[17];let h;e[18]!==c||e[19]!==d||e[20]!==m?(h=(0,f.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,d,m]}),e[18]=c,e[19]=d,e[20]=m,e[21]=h):h=e[21];let p;e[22]!==n?(p=n.map(Tc),e[22]=n,e[23]=p):p=e[23];let b;e[24]!==p?(b=(0,f.jsx)("ul",{className:"flex flex-col gap-1","data-testid":"db-staged-list",children:p}),e[24]=p,e[25]=b):b=e[25];let w;return e[26]!==h||e[27]!==b?(w=(0,f.jsxs)("div",{className:"flex flex-col gap-2 border border-warning/40 bg-warning/5 p-3","data-testid":"db-staged",children:[h,b]}),e[26]=h,e[27]=b,e[28]=w):w=e[28],w},"Go");function Oc(t,e){return t+Object.keys(e).length}o(Oc,"Jo");function Tc(t){return(0,f.jsxs)("li",{className:"flex flex-wrap items-center gap-2 font-mono text-xs",children:[(0,f.jsxs)("span",{className:"text-muted-foreground",children:[t.rowId,".",t.column]}),(0,f.jsx)("span",{className:"text-destructive line-through",children:Ee(t.oldValue)}),(0,f.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2192"}),(0,f.jsx)("span",{className:"text-foreground",children:Ee(t.newValue)})]},`${t.rowId}:${t.column}`)}o(Tc,"Wo");var hs=400,Vc=36,Ec={flex:"1 1 0%",minHeight:0,overflow:"auto",position:"relative"},zc={width:"100%"},Hc=/\n$/u,$c={alignItems:"center",display:"flex",left:0,position:"absolute",top:0,width:"100%"},Lc={display:"flex",width:"100%"},ws={flex:"0 0 8.5rem",padding:"0.375rem 0.75rem"},jc="2.5rem",Ms={alignItems:"center",display:"flex",flex:"0 0 2.5rem",justifyContent:"center",left:0,padding:"0.375rem 0",position:"sticky",zIndex:2},ur=o(t=>({flex:"0 0 auto",overflow:"hidden",padding:"0.375rem 0.75rem",position:"relative",textOverflow:"ellipsis",whiteSpace:"nowrap",width:`${t.toString()}px`}),"Ft"),ks=o((t,e)=>({...ur(t),left:`calc(${jc} + ${e.toString()}px)`,position:"sticky",zIndex:2}),"fn"),lr="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",Bc=o((t,e,n)=>e.enabled&&e.columns.has(n)?void 0:t,"ts"),ir="__back__:",Gc=o(t=>`${ir}${t.table}.${t.column}`,"ns"),qc=o(t=>{let e=(0,q.c)(3),{counts:n,rowId:l}=t;if(n===void 0){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,f.jsx)("span",{className:"text-muted-foreground/50",children:"\u2014"}),e[0]=s):s=e[0],s}let r=n[l]??0,a;return e[1]!==r?(a=(0,f.jsx)("span",{className:"tabular-nums",children:r}),e[1]=r,e[2]=a):a=e[2],a},"os"),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},"Ie"),Kc=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"),Uc=o((t,e,n)=>{if(n!==void 0&&n.type!=="any")return Kc(t,n);let l=Fs(t,e);return typeof e=="number"&&typeof l!="number"?void 0:{value:l}},"ls"),Jc=o(({anchor:t,columnIds:e,columnMeta:n,editableColumn:l,rows:r,text:a})=>{let s=a.replaceAll(`\r
3
3
  `,`
4
4
  `).replace(Hc,"").split(`