@lunora/studio 1.0.0-alpha.117 → 1.0.0-alpha.118

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 (58) hide show
  1. package/dist/standalone/{chunk-22664OOM.js → chunk-22LNEQ5H.js} +1 -1
  2. package/dist/standalone/{chunk-H2WBIULE.js → chunk-27IF4PXG.js} +1 -1
  3. package/dist/standalone/{chunk-CU7KGPAQ.js → chunk-2UP5EBFR.js} +1 -1
  4. package/dist/standalone/{chunk-ZIYO55T2.js → chunk-3HLSTC4J.js} +1 -1
  5. package/dist/standalone/{chunk-6UOC4ZJL.js → chunk-45MGKKVR.js} +1 -1
  6. package/dist/standalone/{chunk-R3VDUL6F.js → chunk-4PCLBPH4.js} +1 -1
  7. package/dist/standalone/{chunk-FEW2WNS7.js → chunk-4PVSXT34.js} +1 -1
  8. package/dist/standalone/{chunk-FRSTZO5P.js → chunk-4SM4AD63.js} +1 -1
  9. package/dist/standalone/{chunk-KEMHRM53.js → chunk-4ZTQORBY.js} +1 -1
  10. package/dist/standalone/{chunk-IZ6AVENL.js → chunk-5FS4HLRG.js} +1 -1
  11. package/dist/standalone/{chunk-A7WKYEQ4.js → chunk-5GFVNJR5.js} +1 -1
  12. package/dist/standalone/{chunk-W5CYX66B.js → chunk-5HICO276.js} +1 -1
  13. package/dist/standalone/{chunk-CYLI7GO3.js → chunk-5PU6Q4DG.js} +1 -1
  14. package/dist/standalone/{chunk-ZNNKKJRT.js → chunk-5QLWJ2DD.js} +1 -1
  15. package/dist/standalone/{chunk-TOZK5WX3.js → chunk-7VYPO4TI.js} +1 -1
  16. package/dist/standalone/{chunk-TNVZJKGN.js → chunk-AWYHNGHI.js} +1 -1
  17. package/dist/standalone/{chunk-H4SLAZAN.js → chunk-B3BKR5ZW.js} +1 -1
  18. package/dist/standalone/{chunk-LFEDP3Y6.js → chunk-D52S7TOI.js} +1 -1
  19. package/dist/standalone/{chunk-SLOB2B2T.js → chunk-DVHN4KWR.js} +1 -1
  20. package/dist/standalone/{chunk-7W6TQTW7.js → chunk-EG6CI6JJ.js} +1 -1
  21. package/dist/standalone/{chunk-3IXTF53Q.js → chunk-EIWJYMNM.js} +1 -1
  22. package/dist/standalone/{chunk-MDWJRPZG.js → chunk-ELJFDMV3.js} +1 -1
  23. package/dist/standalone/{chunk-VKQZAEUQ.js → chunk-FD7DEJMJ.js} +1 -1
  24. package/dist/standalone/{chunk-K5XFXW6D.js → chunk-FN5OO2OT.js} +1 -1
  25. package/dist/standalone/{chunk-TNFIYZPY.js → chunk-FQX3BSPP.js} +1 -1
  26. package/dist/standalone/{chunk-RND4232Z.js → chunk-G3NGXYJY.js} +1 -1
  27. package/dist/standalone/{chunk-SM764GPA.js → chunk-G4FZNPHS.js} +1 -1
  28. package/dist/standalone/{chunk-VTPKVALV.js → chunk-GEX7IWQL.js} +1 -1
  29. package/dist/standalone/{chunk-BBXNPD22.js → chunk-GQJOXK25.js} +1 -1
  30. package/dist/standalone/{chunk-PLI4LCPS.js → chunk-HFDJ2FL3.js} +1 -1
  31. package/dist/standalone/{chunk-CZK4GZ5C.js → chunk-HT7B3NZN.js} +1 -1
  32. package/dist/standalone/{chunk-EEIKRCWD.js → chunk-HUGJ4X52.js} +1 -1
  33. package/dist/standalone/{chunk-RUIWLLAI.js → chunk-ILRATMDS.js} +1 -1
  34. package/dist/standalone/{chunk-2WAWYLUP.js → chunk-IN2BDO6Y.js} +1 -1
  35. package/dist/standalone/{chunk-2UWKGSEA.js → chunk-L6ATKZKO.js} +1 -1
  36. package/dist/standalone/{chunk-VVB7SOO7.js → chunk-MKZV6X4G.js} +1 -1
  37. package/dist/standalone/{chunk-DEGERMXH.js → chunk-MZ6O7Z67.js} +1 -1
  38. package/dist/standalone/{chunk-F5YULDNX.js → chunk-NWXW4JWB.js} +1 -1
  39. package/dist/standalone/{chunk-JACBQWRB.js → chunk-NXHRLXOC.js} +1 -1
  40. package/dist/standalone/{chunk-WSNFV7ZW.js → chunk-O5FM6GKY.js} +1 -1
  41. package/dist/standalone/{chunk-KQ6HYQCE.js → chunk-O6N6T57Q.js} +1 -1
  42. package/dist/standalone/{chunk-2P6N5XES.js → chunk-OHYP4OEU.js} +1 -1
  43. package/dist/standalone/{chunk-DC5AAWSA.js → chunk-P4QIDUCY.js} +1 -1
  44. package/dist/standalone/{chunk-6MRGARL5.js → chunk-PRWFHSHC.js} +1 -1
  45. package/dist/standalone/{chunk-N7WIVIP2.js → chunk-PWN4NIIK.js} +1 -1
  46. package/dist/standalone/{chunk-S6UHG354.js → chunk-QBVBJKLV.js} +1 -1
  47. package/dist/standalone/{chunk-CE7WVPLK.js → chunk-QLG2EJU3.js} +1 -1
  48. package/dist/standalone/{chunk-BE76GAFE.js → chunk-TDCEPDQ3.js} +1 -1
  49. package/dist/standalone/{chunk-V2KCESII.js → chunk-W3PCX3TU.js} +1 -1
  50. package/dist/standalone/{chunk-LMAI2ESY.js → chunk-XUVD6ILO.js} +1 -1
  51. package/dist/standalone/{chunk-FKNT7GEB.js → chunk-XZACOGRP.js} +1 -1
  52. package/dist/standalone/{chunk-I4XA3BBM.js → chunk-YIEWRRZG.js} +1 -1
  53. package/dist/standalone/chunk-YTYRZTG6.js +11 -0
  54. package/dist/standalone/{chunk-J7GGD2O2.js → chunk-ZBGI3UQN.js} +1 -1
  55. package/dist/standalone/{chunk-SCXAZ74Y.js → chunk-ZYWLKW7L.js} +1 -1
  56. package/dist/standalone/studio.js +1 -1
  57. package/package.json +3 -3
  58. package/dist/standalone/chunk-22WJHOC4.js +0 -11
@@ -1 +1 @@
1
- import{b as de}from"./chunk-W2JBKQNU.js";import{a as te,b as re,c as ne}from"./chunk-TPAZM36C.js";import"./chunk-ZHPDAJBM.js";import{b as Y}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as ae}from"./chunk-H4SLAZAN.js";import"./chunk-PZ4QDWTI.js";import"./chunk-DC5AAWSA.js";import"./chunk-F7JOSNAT.js";import{a as ee}from"./chunk-VDW32UET.js";import{c as Z}from"./chunk-2UWKGSEA.js";import"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{a as le,b as oe,c as se,d as H,e as z,f as G}from"./chunk-L4EZAHCD.js";import{a as P,e as q}from"./chunk-IYWVSMAY.js";import{d as X}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as g,d as W,f as ce,g as me}from"./chunk-R5ZTCHCE.js";var J=W(ce(),1);var t=W(me(),1);var ue={binding:"outline",secret:"destructive",var:"secondary"},pe=g((n,e)=>{if(n===void 0)return[];let u=[];return n.workerUrl!==void 0&&u.push({label:e("URL"),value:n.workerUrl}),n.environment!==void 0&&u.push({label:e("Environment"),value:n.environment}),n.deploymentId!==void 0&&u.push({label:e("Deployment"),value:n.deploymentId}),n.versionTag!==void 0&&u.push({label:e("Version"),value:n.versionTag}),u},"ce"),ie=g(n=>{let e=(0,J.c)(18),{modifier:u,name:r,label:p}=n,A=te(),x;e[0]!==r?(x=g(o=>{if(!["Escape","Tab"].includes(o.key)){if(o.shiftKey){o.preventDefault();return}o.preventDefault(),re(r,o.key)}},"b"),e[0]=r,e[1]=x):x=e[1];let i=x,c=`set-shortcut-${r}`,m;e[2]!==p?(m=(0,t.jsx)("dt",{className:"text-muted-foreground",children:p}),e[2]=p,e[3]=m):m=e[3];let h;e[4]!==u?(h=(0,t.jsx)("kbd",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:u}),e[4]=u,e[5]=h):h=e[5];let l=`set-shortcut-input-${r}`,f=A[r],s;e[6]!==p||e[7]!==i||e[8]!==l||e[9]!==f?(s=(0,t.jsx)("input",{"aria-label":p,className:"h-7 w-12 rounded-md border border-border bg-background text-center font-mono text-xs uppercase outline-none focus-visible:border-ring","data-testid":l,onKeyDown:i,readOnly:!0,value:f}),e[6]=p,e[7]=i,e[8]=l,e[9]=f,e[10]=s):s=e[10];let a;e[11]!==h||e[12]!==s?(a=(0,t.jsxs)("dd",{className:"flex items-center gap-1.5",children:[h,s]}),e[11]=h,e[12]=s,e[13]=a):a=e[13];let d;return e[14]!==c||e[15]!==m||e[16]!==a?(d=(0,t.jsxs)("div",{className:"contents","data-testid":c,children:[m,a]}),e[14]=c,e[15]=m,e[16]=a,e[17]=d):d=e[17],d},"z"),Se=g(n=>{let e=(0,J.c)(85),{initialShardKey:u}=n,r=X(),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let A=u??"",x;e[1]!==A?(x={shardKey:A},e[1]=A,e[2]=x):x=e[2];let{data:i,error:c,errorSource:m,isLoading:h}=Z(ee.getSettings,p,x),l,f,s,a,d,o,b;if(e[3]!==c||e[4]!==m||e[5]!==i?.deploy||e[6]!==i?.settings||e[7]!==r){let Q=pe(i?.deploy,r),M;e[15]!==i?.settings?(M=i?.settings??[],e[15]=i?.settings,e[16]=M):M=e[16],l=M,f="flex flex-col gap-4",s="lunora-settings";let V;e[17]!==r?(V=r("Open in Cloudflare"),e[17]=r,e[18]=V):V=e[18],e[19]!==V?(a=(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:de,rel:"noreferrer",target:"_blank",children:V})}),e[19]=V,e[20]=a):a=e[20];let $;e[21]!==r?($=r("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[21]=r,e[22]=$):$=e[22],e[23]!==$?(d=(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:$}),e[23]=$,e[24]=d):d=e[24],e[25]!==c||e[26]!==m?(o=c!==null&&(0,t.jsx)(ae,{error:m,testId:"set-error"}),e[25]=c,e[26]=m,e[27]=o):o=e[27],b=Q.length>0&&(0,t.jsxs)(P,{className:"py-0","data-testid":"set-deploy",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:r("Deployment")})}),(0,t.jsx)(q,{className:"py-3",children:(0,t.jsx)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:Q.map(he)})})]}),e[3]=c,e[4]=m,e[5]=i?.deploy,e[6]=i?.settings,e[7]=r,e[8]=l,e[9]=f,e[10]=s,e[11]=a,e[12]=d,e[13]=o,e[14]=b}else l=e[8],f=e[9],s=e[10],a=e[11],d=e[12],o=e[13],b=e[14];let y;e[28]!==r?(y=r("Keyboard shortcuts"),e[28]=r,e[29]=y):y=e[29];let v;e[30]!==y?(v=(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y}),e[30]=y,e[31]=v):v=e[31];let N;e[32]!==r?(N=r("Reset"),e[32]=r,e[33]=N):N=e[33];let k;e[34]!==N?(k=(0,t.jsx)("button",{className:"rounded px-1 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:text-foreground","data-testid":"set-shortcut-reset",onClick:ne,type:"button",children:N}),e[34]=N,e[35]=k):k=e[35];let w;e[36]!==v||e[37]!==k?(w=(0,t.jsxs)("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[v,k]}),e[36]=v,e[37]=k,e[38]=w):w=e[38];let C;e[39]!==r?(C=r("Command palette"),e[39]=r,e[40]=C):C=e[40];let S;e[41]!==C?(S=(0,t.jsx)(ie,{label:C,modifier:"\u2318/Ctrl",name:"palette"}),e[41]=C,e[42]=S):S=e[42];let T;e[43]!==r?(T=r("Operation console"),e[43]=r,e[44]=T):T=e[44];let D;e[45]!==T?(D=(0,t.jsx)(ie,{label:T,modifier:"Ctrl",name:"console"}),e[45]=T,e[46]=D):D=e[46];let _;e[47]!==S||e[48]!==D?(_=(0,t.jsxs)("dl",{className:"grid grid-cols-[10rem_minmax(0,1fr)] items-center gap-x-4 gap-y-2 text-sm",children:[S,D]}),e[47]=S,e[48]=D,e[49]=_):_=e[49];let E;e[50]!==r?(E=r("Stored in this browser. Focus a box and press a key to rebind it."),e[50]=r,e[51]=E):E=e[51];let I;e[52]!==E?(I=(0,t.jsx)("p",{className:"pt-3 text-xs text-muted-foreground",children:E}),e[52]=E,e[53]=I):I=e[53];let K;e[54]!==_||e[55]!==I?(K=(0,t.jsxs)(q,{className:"py-3",children:[_,I]}),e[54]=_,e[55]=I,e[56]=K):K=e[56];let O;e[57]!==w||e[58]!==K?(O=(0,t.jsxs)(P,{className:"py-0","data-testid":"set-preferences",children:[w,K]}),e[57]=w,e[58]=K,e[59]=O):O=e[59];let U;e[60]!==r?(U=r("Environment & bindings"),e[60]=r,e[61]=U):U=e[61];let j;e[62]!==U?(j=(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:U})}),e[62]=U,e[63]=j):j=e[63];let F;e[64]!==c||e[65]!==h||e[66]!==l.length||e[67]!==r?(F=c===null&&!h&&l.length===0&&(0,t.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:r("No environment variables or bindings.")}),e[64]=c,e[65]=h,e[66]=l.length,e[67]=r,e[68]=F):F=e[68];let L;e[69]!==l||e[70]!==r?(L=l.length>0&&(0,t.jsx)(q,{className:"px-0 py-0",children:(0,t.jsxs)(le,{"data-testid":"set-table",children:[(0,t.jsx)(oe,{children:(0,t.jsxs)(H,{children:[(0,t.jsx)(z,{children:r("name")}),(0,t.jsx)(z,{children:r("kind")}),(0,t.jsx)(z,{children:r("value")})]})}),(0,t.jsx)(se,{children:l.map(fe)})]})}),e[69]=l,e[70]=r,e[71]=L):L=e[71];let R;e[72]!==j||e[73]!==F||e[74]!==L?(R=(0,t.jsxs)(P,{className:"py-0",children:[j,F,L]}),e[72]=j,e[73]=F,e[74]=L,e[75]=R):R=e[75];let B;return e[76]!==O||e[77]!==R||e[78]!==f||e[79]!==s||e[80]!==a||e[81]!==d||e[82]!==o||e[83]!==b?(B=(0,t.jsxs)("div",{className:f,"data-testid":s,children:[a,d,o,b,O,R]}),e[76]=O,e[77]=R,e[78]=f,e[79]=s,e[80]=a,e[81]=d,e[82]=o,e[83]=b,e[84]=B):B=e[84],B},"Ce");function he(n){return(0,t.jsxs)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,t.jsx)("dt",{className:"text-muted-foreground",children:n.label}),(0,t.jsx)("dd",{className:"truncate font-mono text-xs",title:n.value,children:n.value})]},n.label)}g(he,"me");function fe(n){return(0,t.jsxs)(H,{"data-testid":"set-row",children:[(0,t.jsx)(G,{className:"font-mono text-xs font-medium",children:n.name}),(0,t.jsx)(G,{children:(0,t.jsx)(Y,{variant:ue[n.kind],children:n.bindingType??n.kind})}),(0,t.jsx)(G,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:n.value??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},n.name)}g(fe,"fe");export{Se as SettingsPanel};
1
+ import{b as de}from"./chunk-W2JBKQNU.js";import{a as te,b as re,c as ne}from"./chunk-TPAZM36C.js";import"./chunk-ZHPDAJBM.js";import{b as Y}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as ae}from"./chunk-B3BKR5ZW.js";import"./chunk-PZ4QDWTI.js";import"./chunk-P4QIDUCY.js";import"./chunk-F7JOSNAT.js";import{a as ee}from"./chunk-VDW32UET.js";import{c as Z}from"./chunk-L6ATKZKO.js";import"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import{a as le,b as oe,c as se,d as H,e as z,f as G}from"./chunk-L4EZAHCD.js";import{a as P,e as q}from"./chunk-IYWVSMAY.js";import{d as X}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as g,d as W,f as ce,g as me}from"./chunk-R5ZTCHCE.js";var J=W(ce(),1);var t=W(me(),1);var ue={binding:"outline",secret:"destructive",var:"secondary"},pe=g((n,e)=>{if(n===void 0)return[];let u=[];return n.workerUrl!==void 0&&u.push({label:e("URL"),value:n.workerUrl}),n.environment!==void 0&&u.push({label:e("Environment"),value:n.environment}),n.deploymentId!==void 0&&u.push({label:e("Deployment"),value:n.deploymentId}),n.versionTag!==void 0&&u.push({label:e("Version"),value:n.versionTag}),u},"ce"),ie=g(n=>{let e=(0,J.c)(18),{modifier:u,name:r,label:p}=n,A=te(),x;e[0]!==r?(x=g(o=>{if(!["Escape","Tab"].includes(o.key)){if(o.shiftKey){o.preventDefault();return}o.preventDefault(),re(r,o.key)}},"b"),e[0]=r,e[1]=x):x=e[1];let i=x,c=`set-shortcut-${r}`,m;e[2]!==p?(m=(0,t.jsx)("dt",{className:"text-muted-foreground",children:p}),e[2]=p,e[3]=m):m=e[3];let h;e[4]!==u?(h=(0,t.jsx)("kbd",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:u}),e[4]=u,e[5]=h):h=e[5];let l=`set-shortcut-input-${r}`,f=A[r],s;e[6]!==p||e[7]!==i||e[8]!==l||e[9]!==f?(s=(0,t.jsx)("input",{"aria-label":p,className:"h-7 w-12 rounded-md border border-border bg-background text-center font-mono text-xs uppercase outline-none focus-visible:border-ring","data-testid":l,onKeyDown:i,readOnly:!0,value:f}),e[6]=p,e[7]=i,e[8]=l,e[9]=f,e[10]=s):s=e[10];let a;e[11]!==h||e[12]!==s?(a=(0,t.jsxs)("dd",{className:"flex items-center gap-1.5",children:[h,s]}),e[11]=h,e[12]=s,e[13]=a):a=e[13];let d;return e[14]!==c||e[15]!==m||e[16]!==a?(d=(0,t.jsxs)("div",{className:"contents","data-testid":c,children:[m,a]}),e[14]=c,e[15]=m,e[16]=a,e[17]=d):d=e[17],d},"z"),Se=g(n=>{let e=(0,J.c)(85),{initialShardKey:u}=n,r=X(),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let A=u??"",x;e[1]!==A?(x={shardKey:A},e[1]=A,e[2]=x):x=e[2];let{data:i,error:c,errorSource:m,isLoading:h}=Z(ee.getSettings,p,x),l,f,s,a,d,o,b;if(e[3]!==c||e[4]!==m||e[5]!==i?.deploy||e[6]!==i?.settings||e[7]!==r){let Q=pe(i?.deploy,r),M;e[15]!==i?.settings?(M=i?.settings??[],e[15]=i?.settings,e[16]=M):M=e[16],l=M,f="flex flex-col gap-4",s="lunora-settings";let V;e[17]!==r?(V=r("Open in Cloudflare"),e[17]=r,e[18]=V):V=e[18],e[19]!==V?(a=(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:de,rel:"noreferrer",target:"_blank",children:V})}),e[19]=V,e[20]=a):a=e[20];let $;e[21]!==r?($=r("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[21]=r,e[22]=$):$=e[22],e[23]!==$?(d=(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:$}),e[23]=$,e[24]=d):d=e[24],e[25]!==c||e[26]!==m?(o=c!==null&&(0,t.jsx)(ae,{error:m,testId:"set-error"}),e[25]=c,e[26]=m,e[27]=o):o=e[27],b=Q.length>0&&(0,t.jsxs)(P,{className:"py-0","data-testid":"set-deploy",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:r("Deployment")})}),(0,t.jsx)(q,{className:"py-3",children:(0,t.jsx)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:Q.map(he)})})]}),e[3]=c,e[4]=m,e[5]=i?.deploy,e[6]=i?.settings,e[7]=r,e[8]=l,e[9]=f,e[10]=s,e[11]=a,e[12]=d,e[13]=o,e[14]=b}else l=e[8],f=e[9],s=e[10],a=e[11],d=e[12],o=e[13],b=e[14];let y;e[28]!==r?(y=r("Keyboard shortcuts"),e[28]=r,e[29]=y):y=e[29];let v;e[30]!==y?(v=(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y}),e[30]=y,e[31]=v):v=e[31];let N;e[32]!==r?(N=r("Reset"),e[32]=r,e[33]=N):N=e[33];let k;e[34]!==N?(k=(0,t.jsx)("button",{className:"rounded px-1 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:text-foreground","data-testid":"set-shortcut-reset",onClick:ne,type:"button",children:N}),e[34]=N,e[35]=k):k=e[35];let w;e[36]!==v||e[37]!==k?(w=(0,t.jsxs)("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[v,k]}),e[36]=v,e[37]=k,e[38]=w):w=e[38];let C;e[39]!==r?(C=r("Command palette"),e[39]=r,e[40]=C):C=e[40];let S;e[41]!==C?(S=(0,t.jsx)(ie,{label:C,modifier:"\u2318/Ctrl",name:"palette"}),e[41]=C,e[42]=S):S=e[42];let T;e[43]!==r?(T=r("Operation console"),e[43]=r,e[44]=T):T=e[44];let D;e[45]!==T?(D=(0,t.jsx)(ie,{label:T,modifier:"Ctrl",name:"console"}),e[45]=T,e[46]=D):D=e[46];let _;e[47]!==S||e[48]!==D?(_=(0,t.jsxs)("dl",{className:"grid grid-cols-[10rem_minmax(0,1fr)] items-center gap-x-4 gap-y-2 text-sm",children:[S,D]}),e[47]=S,e[48]=D,e[49]=_):_=e[49];let E;e[50]!==r?(E=r("Stored in this browser. Focus a box and press a key to rebind it."),e[50]=r,e[51]=E):E=e[51];let I;e[52]!==E?(I=(0,t.jsx)("p",{className:"pt-3 text-xs text-muted-foreground",children:E}),e[52]=E,e[53]=I):I=e[53];let K;e[54]!==_||e[55]!==I?(K=(0,t.jsxs)(q,{className:"py-3",children:[_,I]}),e[54]=_,e[55]=I,e[56]=K):K=e[56];let O;e[57]!==w||e[58]!==K?(O=(0,t.jsxs)(P,{className:"py-0","data-testid":"set-preferences",children:[w,K]}),e[57]=w,e[58]=K,e[59]=O):O=e[59];let U;e[60]!==r?(U=r("Environment & bindings"),e[60]=r,e[61]=U):U=e[61];let j;e[62]!==U?(j=(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:U})}),e[62]=U,e[63]=j):j=e[63];let F;e[64]!==c||e[65]!==h||e[66]!==l.length||e[67]!==r?(F=c===null&&!h&&l.length===0&&(0,t.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:r("No environment variables or bindings.")}),e[64]=c,e[65]=h,e[66]=l.length,e[67]=r,e[68]=F):F=e[68];let L;e[69]!==l||e[70]!==r?(L=l.length>0&&(0,t.jsx)(q,{className:"px-0 py-0",children:(0,t.jsxs)(le,{"data-testid":"set-table",children:[(0,t.jsx)(oe,{children:(0,t.jsxs)(H,{children:[(0,t.jsx)(z,{children:r("name")}),(0,t.jsx)(z,{children:r("kind")}),(0,t.jsx)(z,{children:r("value")})]})}),(0,t.jsx)(se,{children:l.map(fe)})]})}),e[69]=l,e[70]=r,e[71]=L):L=e[71];let R;e[72]!==j||e[73]!==F||e[74]!==L?(R=(0,t.jsxs)(P,{className:"py-0",children:[j,F,L]}),e[72]=j,e[73]=F,e[74]=L,e[75]=R):R=e[75];let B;return e[76]!==O||e[77]!==R||e[78]!==f||e[79]!==s||e[80]!==a||e[81]!==d||e[82]!==o||e[83]!==b?(B=(0,t.jsxs)("div",{className:f,"data-testid":s,children:[a,d,o,b,O,R]}),e[76]=O,e[77]=R,e[78]=f,e[79]=s,e[80]=a,e[81]=d,e[82]=o,e[83]=b,e[84]=B):B=e[84],B},"Ce");function he(n){return(0,t.jsxs)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,t.jsx)("dt",{className:"text-muted-foreground",children:n.label}),(0,t.jsx)("dd",{className:"truncate font-mono text-xs",title:n.value,children:n.value})]},n.label)}g(he,"me");function fe(n){return(0,t.jsxs)(H,{"data-testid":"set-row",children:[(0,t.jsx)(G,{className:"font-mono text-xs font-medium",children:n.name}),(0,t.jsx)(G,{children:(0,t.jsx)(Y,{variant:ue[n.kind],children:n.bindingType??n.kind})}),(0,t.jsx)(G,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:n.value??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},n.name)}g(fe,"fe");export{Se as SettingsPanel};
@@ -1 +1 @@
1
- import{a as N}from"./chunk-H4SLAZAN.js";import{a as v,b as w,c as y,d,e as c,f as i}from"./chunk-L4EZAHCD.js";import{a as x,e as b}from"./chunk-IYWVSMAY.js";import{d as h}from"./chunk-BKM6PMSO.js";import{a,d as p,e as I,g as R,i as g}from"./chunk-R5ZTCHCE.js";var $=p(I(),1);var e=p(R(),1);var A={ERROR:"error",INFO:"info",WARN:"warning"},q=a(r=>{let n=typeof r.metadata.table=="string"?r.metadata.table:void 0;return{description:`${r.detail} ${r.remediation}`,entity:n,issueType:r.title,key:r.cacheKey,level:A[r.level]}},"z"),C=["error","warning","info"],O={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},S=a((r,n)=>({error:r("Errors"),info:r("Info"),warning:r("Warnings")})[n],"$"),j=a((r,n,o)=>({error:r("{count} errors",{count:o}),info:r("{count} suggestions",{count:o}),warning:r("{count} warnings",{count:o})})[n],"k"),z=a((r,n)=>({error:r("No errors detected"),info:r("No suggestions"),warning:r("No warnings detected")})[n],"V"),F=a(r=>{let n={error:0,info:0,warning:0};for(let o of r??[])n[o.level]+=1;return n},"O"),B=a(({error:r=null,errorSource:n,rows:o,testId:l,toolbar:f})=>{let s=h(),[m,k]=(0,$.useState)("error"),T=F(o),u=(o??[]).filter(t=>t.level===m),E=a(t=>{k(t.currentTarget.dataset.level)},"h");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":l,children:[(0,e.jsx)("div",{className:"flex border-b border-border",role:"tablist",children:C.map(t=>(0,e.jsxs)("button",{"aria-selected":m===t,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":t,"data-testid":`${l}-tab-${t}`,onClick:E,role:"tab",type:"button",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[(0,e.jsx)("span",{"aria-hidden":"true",className:g("size-2 rounded-sm",O[t])}),S(s,t)]}),(0,e.jsx)("span",{className:"ps-4 text-xs text-muted-foreground",children:j(s,t,T[t])})]},t))}),f!==void 0&&(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:f}),r!==null&&(0,e.jsx)(N,{error:n??r,testId:`${l}-error`}),(0,e.jsx)(x,{className:"overflow-hidden py-0",children:(0,e.jsx)(b,{className:"px-0",children:(0,e.jsxs)(v,{children:[(0,e.jsx)(w,{children:(0,e.jsxs)(d,{children:[(0,e.jsx)(c,{children:s("Issue type")}),(0,e.jsx)(c,{children:s("Entity/item")}),(0,e.jsx)(c,{children:s("Description")})]})}),(0,e.jsx)(y,{children:u.length===0?(0,e.jsx)(d,{children:(0,e.jsxs)(i,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${l}-empty`,children:[(0,e.jsx)("span",{className:"block text-sm font-medium text-foreground",children:z(s,m)}),(0,e.jsx)("span",{className:"block text-sm",children:s("Nothing to report for this deployment.")})]})}):u.map(t=>(0,e.jsxs)(d,{children:[(0,e.jsx)(i,{className:"font-medium text-foreground",children:t.issueType}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.entity??"\u2014"}),(0,e.jsxs)(i,{className:"text-muted-foreground",children:[(0,e.jsx)("span",{children:t.description}),t.action!==void 0&&(0,e.jsx)("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:t.action})]})]},t.key))})]})})})]})},"F");export{q as a,B as b};
1
+ import{a as N}from"./chunk-B3BKR5ZW.js";import{a as v,b as w,c as y,d,e as c,f as i}from"./chunk-L4EZAHCD.js";import{a as x,e as b}from"./chunk-IYWVSMAY.js";import{d as h}from"./chunk-BKM6PMSO.js";import{a,d as p,e as I,g as R,i as g}from"./chunk-R5ZTCHCE.js";var $=p(I(),1);var e=p(R(),1);var A={ERROR:"error",INFO:"info",WARN:"warning"},q=a(r=>{let n=typeof r.metadata.table=="string"?r.metadata.table:void 0;return{description:`${r.detail} ${r.remediation}`,entity:n,issueType:r.title,key:r.cacheKey,level:A[r.level]}},"z"),C=["error","warning","info"],O={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},S=a((r,n)=>({error:r("Errors"),info:r("Info"),warning:r("Warnings")})[n],"$"),j=a((r,n,o)=>({error:r("{count} errors",{count:o}),info:r("{count} suggestions",{count:o}),warning:r("{count} warnings",{count:o})})[n],"k"),z=a((r,n)=>({error:r("No errors detected"),info:r("No suggestions"),warning:r("No warnings detected")})[n],"V"),F=a(r=>{let n={error:0,info:0,warning:0};for(let o of r??[])n[o.level]+=1;return n},"O"),B=a(({error:r=null,errorSource:n,rows:o,testId:l,toolbar:f})=>{let s=h(),[m,k]=(0,$.useState)("error"),T=F(o),u=(o??[]).filter(t=>t.level===m),E=a(t=>{k(t.currentTarget.dataset.level)},"h");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":l,children:[(0,e.jsx)("div",{className:"flex border-b border-border",role:"tablist",children:C.map(t=>(0,e.jsxs)("button",{"aria-selected":m===t,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":t,"data-testid":`${l}-tab-${t}`,onClick:E,role:"tab",type:"button",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[(0,e.jsx)("span",{"aria-hidden":"true",className:g("size-2 rounded-sm",O[t])}),S(s,t)]}),(0,e.jsx)("span",{className:"ps-4 text-xs text-muted-foreground",children:j(s,t,T[t])})]},t))}),f!==void 0&&(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:f}),r!==null&&(0,e.jsx)(N,{error:n??r,testId:`${l}-error`}),(0,e.jsx)(x,{className:"overflow-hidden py-0",children:(0,e.jsx)(b,{className:"px-0",children:(0,e.jsxs)(v,{children:[(0,e.jsx)(w,{children:(0,e.jsxs)(d,{children:[(0,e.jsx)(c,{children:s("Issue type")}),(0,e.jsx)(c,{children:s("Entity/item")}),(0,e.jsx)(c,{children:s("Description")})]})}),(0,e.jsx)(y,{children:u.length===0?(0,e.jsx)(d,{children:(0,e.jsxs)(i,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${l}-empty`,children:[(0,e.jsx)("span",{className:"block text-sm font-medium text-foreground",children:z(s,m)}),(0,e.jsx)("span",{className:"block text-sm",children:s("Nothing to report for this deployment.")})]})}):u.map(t=>(0,e.jsxs)(d,{children:[(0,e.jsx)(i,{className:"font-medium text-foreground",children:t.issueType}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.entity??"\u2014"}),(0,e.jsxs)(i,{className:"text-muted-foreground",children:[(0,e.jsx)("span",{children:t.description}),t.action!==void 0&&(0,e.jsx)("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:t.action})]})]},t.key))})]})})})]})},"F");export{q as a,B as b};
@@ -1 +1 @@
1
- import{b as P}from"./chunk-KEMHRM53.js";import{c as K,d as X,e as z,f as L,h as B,i as E,j as G,k as q,l as A,m as O,n as W,o as $,p as D}from"./chunk-XL2OT5WB.js";import{a as F,b as H,c as I,d as S,e as J,f as M}from"./chunk-L4EZAHCD.js";import{d as C,m as j}from"./chunk-BKM6PMSO.js";import{a as f,d as T,f as U,g as V}from"./chunk-R5ZTCHCE.js";var N=T(U(),1);var t=T(V(),1);var _=50,R={value:{colors:{dark:["var(--chart-1)"],light:["var(--chart-1)"]},label:"value"}},Q=f(r=>{let a=r.columns.find(e=>r.rows.length>0&&r.rows.every(n=>typeof n[e]=="number"))??null;return{label:r.columns.find(e=>e!==a)??null,value:a}},"D"),Y=f(r=>{let a=(0,N.c)(3),{data:e,kind:n}=r,l;return a[0]!==e||a[1]!==n?(l=(0,t.jsx)(G,{className:"h-full w-full",config:R,children:n==="area"?(0,t.jsxs)(E,{data:e,children:[(0,t.jsx)(K,{vertical:!1}),(0,t.jsx)(L,{axisLine:!1,dataKey:"label",tickLine:!1}),(0,t.jsx)(A,{content:(0,t.jsx)(q,{})}),(0,t.jsx)(z,{dataKey:"value",fill:"var(--color-value-0)",fillOpacity:.2,stroke:"var(--color-value-0)",type:"monotone"})]}):(0,t.jsxs)(B,{data:e,children:[(0,t.jsx)(K,{vertical:!1}),(0,t.jsx)(L,{axisLine:!1,dataKey:"label",tickLine:!1}),(0,t.jsx)(A,{content:(0,t.jsx)(q,{})}),(0,t.jsx)(X,{dataKey:"value",dot:!1,stroke:"var(--color-value-0)",strokeWidth:2,type:"monotone"})]})}),a[0]=e,a[1]=n,a[2]=l):l=a[2],l},"J"),na=f(r=>{let a=(0,N.c)(21),{axes:e,kind:n,result:l}=r,u=C(),o;a[0]!==l?(o=Q(l),a[0]=l,a[1]=o):o=a[1];let d=o,m;a[2]!==l.columns?(m=new Set(l.columns),a[2]=l.columns,a[3]=m):m=a[3];let s=m,c=e!==void 0&&s.has(e.x)?e.x:d.label,p;a[4]!==e?.y||a[5]!==s?(p=e?.y.find(i=>s.has(i)),a[4]=e?.y,a[5]=s,a[6]=p):p=a[6];let x=p,y=x??d.value,b;a[7]!==c||a[8]!==l.rows||a[9]!==y?(b=y===null?[]:l.rows.slice(0,_).map((i,w)=>({label:c===null?`#${(w+1).toString()}`:j(i[c]),value:Number(i[y])||0})),a[7]=c,a[8]=l.rows,a[9]=y,a[10]=b):b=a[10];let k=b;if(y===null){let i;a[11]!==u?(i=u("No numeric column to chart."),a[11]=u,a[12]=i):i=a[12];let w;return a[13]!==i?(w=(0,t.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-chart-empty",children:i}),a[13]=i,a[14]=w):w=a[14],w}let h=n??(e!==void 0&&x!==void 0?e.kind:"bar"),v;a[15]!==k||a[16]!==h?(v=h==="bar"?(0,t.jsxs)(O,{className:"h-full w-full",config:R,data:k,children:[(0,t.jsx)($,{dataKey:"label"}),(0,t.jsx)(W,{dataKey:"value"}),(0,t.jsx)(D,{})]}):(0,t.jsx)(Y,{data:k,kind:h}),a[15]=k,a[16]=h,a[17]=v):v=a[17];let g;return a[18]!==h||a[19]!==v?(g=(0,t.jsx)("div",{className:"h-80 w-full p-3","data-chart-kind":h,"data-testid":"sql-chart",children:v}),a[18]=h,a[19]=v,a[20]=g):g=a[20],g},"oe"),oa=f(r=>{let a=(0,N.c)(19),{result:e}=r,n=C();if(e.columns.length===0){let s;a[0]!==e.rowCount||a[1]!==n?(s=n("{count} rows",{count:e.rowCount}),a[0]=e.rowCount,a[1]=n,a[2]=s):s=a[2];let c;return a[3]!==s?(c=(0,t.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:s}),a[3]=s,a[4]=c):c=a[4],c}let l;a[5]!==e.columns?(l=e.columns.map(Z),a[5]=e.columns,a[6]=l):l=a[6];let u;a[7]!==l?(u=(0,t.jsx)(H,{className:"sticky top-0 z-10 bg-muted",children:(0,t.jsx)(S,{children:l})}),a[7]=l,a[8]=u):u=a[8];let o;if(a[9]!==e.columns||a[10]!==e.rows){let s;a[12]!==e.columns?(s=f((c,p)=>(0,t.jsx)(S,{"data-testid":"sql-row",children:e.columns.map(x=>(0,t.jsx)(M,{className:"max-w-md truncate font-mono text-xs",children:(0,t.jsx)(P,{value:c[x]})},x))},p),"s"),a[12]=e.columns,a[13]=s):s=a[13],o=e.rows.map(s),a[9]=e.columns,a[10]=e.rows,a[11]=o}else o=a[11];let d;a[14]!==o?(d=(0,t.jsx)(I,{children:o}),a[14]=o,a[15]=d):d=a[15];let m;return a[16]!==u||a[17]!==d?(m=(0,t.jsxs)(F,{"data-testid":"sql-rows",children:[u,d]}),a[16]=u,a[17]=d,a[18]=m):m=a[18],m},"ne");function Z(r){return(0,t.jsx)(J,{children:r},r)}f(Z,"P");export{na as a,oa as b};
1
+ import{b as P}from"./chunk-4ZTQORBY.js";import{c as K,d as X,e as z,f as L,h as B,i as E,j as G,k as q,l as A,m as O,n as W,o as $,p as D}from"./chunk-XL2OT5WB.js";import{a as F,b as H,c as I,d as S,e as J,f as M}from"./chunk-L4EZAHCD.js";import{d as C,m as j}from"./chunk-BKM6PMSO.js";import{a as f,d as T,f as U,g as V}from"./chunk-R5ZTCHCE.js";var N=T(U(),1);var t=T(V(),1);var _=50,R={value:{colors:{dark:["var(--chart-1)"],light:["var(--chart-1)"]},label:"value"}},Q=f(r=>{let a=r.columns.find(e=>r.rows.length>0&&r.rows.every(n=>typeof n[e]=="number"))??null;return{label:r.columns.find(e=>e!==a)??null,value:a}},"D"),Y=f(r=>{let a=(0,N.c)(3),{data:e,kind:n}=r,l;return a[0]!==e||a[1]!==n?(l=(0,t.jsx)(G,{className:"h-full w-full",config:R,children:n==="area"?(0,t.jsxs)(E,{data:e,children:[(0,t.jsx)(K,{vertical:!1}),(0,t.jsx)(L,{axisLine:!1,dataKey:"label",tickLine:!1}),(0,t.jsx)(A,{content:(0,t.jsx)(q,{})}),(0,t.jsx)(z,{dataKey:"value",fill:"var(--color-value-0)",fillOpacity:.2,stroke:"var(--color-value-0)",type:"monotone"})]}):(0,t.jsxs)(B,{data:e,children:[(0,t.jsx)(K,{vertical:!1}),(0,t.jsx)(L,{axisLine:!1,dataKey:"label",tickLine:!1}),(0,t.jsx)(A,{content:(0,t.jsx)(q,{})}),(0,t.jsx)(X,{dataKey:"value",dot:!1,stroke:"var(--color-value-0)",strokeWidth:2,type:"monotone"})]})}),a[0]=e,a[1]=n,a[2]=l):l=a[2],l},"J"),na=f(r=>{let a=(0,N.c)(21),{axes:e,kind:n,result:l}=r,u=C(),o;a[0]!==l?(o=Q(l),a[0]=l,a[1]=o):o=a[1];let d=o,m;a[2]!==l.columns?(m=new Set(l.columns),a[2]=l.columns,a[3]=m):m=a[3];let s=m,c=e!==void 0&&s.has(e.x)?e.x:d.label,p;a[4]!==e?.y||a[5]!==s?(p=e?.y.find(i=>s.has(i)),a[4]=e?.y,a[5]=s,a[6]=p):p=a[6];let x=p,y=x??d.value,b;a[7]!==c||a[8]!==l.rows||a[9]!==y?(b=y===null?[]:l.rows.slice(0,_).map((i,w)=>({label:c===null?`#${(w+1).toString()}`:j(i[c]),value:Number(i[y])||0})),a[7]=c,a[8]=l.rows,a[9]=y,a[10]=b):b=a[10];let k=b;if(y===null){let i;a[11]!==u?(i=u("No numeric column to chart."),a[11]=u,a[12]=i):i=a[12];let w;return a[13]!==i?(w=(0,t.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-chart-empty",children:i}),a[13]=i,a[14]=w):w=a[14],w}let h=n??(e!==void 0&&x!==void 0?e.kind:"bar"),v;a[15]!==k||a[16]!==h?(v=h==="bar"?(0,t.jsxs)(O,{className:"h-full w-full",config:R,data:k,children:[(0,t.jsx)($,{dataKey:"label"}),(0,t.jsx)(W,{dataKey:"value"}),(0,t.jsx)(D,{})]}):(0,t.jsx)(Y,{data:k,kind:h}),a[15]=k,a[16]=h,a[17]=v):v=a[17];let g;return a[18]!==h||a[19]!==v?(g=(0,t.jsx)("div",{className:"h-80 w-full p-3","data-chart-kind":h,"data-testid":"sql-chart",children:v}),a[18]=h,a[19]=v,a[20]=g):g=a[20],g},"oe"),oa=f(r=>{let a=(0,N.c)(19),{result:e}=r,n=C();if(e.columns.length===0){let s;a[0]!==e.rowCount||a[1]!==n?(s=n("{count} rows",{count:e.rowCount}),a[0]=e.rowCount,a[1]=n,a[2]=s):s=a[2];let c;return a[3]!==s?(c=(0,t.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:s}),a[3]=s,a[4]=c):c=a[4],c}let l;a[5]!==e.columns?(l=e.columns.map(Z),a[5]=e.columns,a[6]=l):l=a[6];let u;a[7]!==l?(u=(0,t.jsx)(H,{className:"sticky top-0 z-10 bg-muted",children:(0,t.jsx)(S,{children:l})}),a[7]=l,a[8]=u):u=a[8];let o;if(a[9]!==e.columns||a[10]!==e.rows){let s;a[12]!==e.columns?(s=f((c,p)=>(0,t.jsx)(S,{"data-testid":"sql-row",children:e.columns.map(x=>(0,t.jsx)(M,{className:"max-w-md truncate font-mono text-xs",children:(0,t.jsx)(P,{value:c[x]})},x))},p),"s"),a[12]=e.columns,a[13]=s):s=a[13],o=e.rows.map(s),a[9]=e.columns,a[10]=e.rows,a[11]=o}else o=a[11];let d;a[14]!==o?(d=(0,t.jsx)(I,{children:o}),a[14]=o,a[15]=d):d=a[15];let m;return a[16]!==u||a[17]!==d?(m=(0,t.jsxs)(F,{"data-testid":"sql-rows",children:[u,d]}),a[16]=u,a[17]=d,a[18]=m):m=a[18],m},"ne");function Z(r){return(0,t.jsx)(J,{children:r},r)}f(Z,"P");export{na as a,oa as b};
@@ -1 +1 @@
1
- import{P as R}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as B}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as S}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as q}from"./chunk-H4SLAZAN.js";import"./chunk-PZ4QDWTI.js";import"./chunk-DC5AAWSA.js";import"./chunk-F7JOSNAT.js";import{a as U}from"./chunk-VDW32UET.js";import{c as O}from"./chunk-2UWKGSEA.js";import"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{a as D}from"./chunk-UANVABQG.js";import{a as G,b as J,c as K,d as F,e as s,f as o}from"./chunk-L4EZAHCD.js";import{a as V,e as W}from"./chunk-IYWVSMAY.js";import{d as P,s as H}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as n,d as j,e as re,f as ae,g as ie}from"./chunk-R5ZTCHCE.js";var X=j(ae(),1),M=j(re(),1);var t=j(ie(),1);var ne=n(e=>e==="ok"?"success":e==="failed"?"destructive":e==="expired"?"warning":"secondary","te"),Q=n(e=>e.endpoint??e.id,"M"),ve=n(()=>{let e=(0,X.c)(38),r=P(),[i,Y]=(0,M.useState)("all"),[l,Z]=(0,M.useState)(""),g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={},e[0]=g):g=e[0];let{data:I,error:d,errorSource:x,isLoading:_,refetch:v}=O(U.listPushSubscriptions,g),N;if(e[1]!==I?.subscriptions||e[2]!==d||e[3]!==x||e[4]!==_||e[5]!==i||e[6]!==v||e[7]!==l||e[8]!==r){let L=I?.subscriptions??[],T=l.trim().toLowerCase(),A=L.filter(a=>i!=="all"&&a.kind!==i?!1:T===""?!0:`${Q(a)} ${a.userId??""}`.toLowerCase().includes(T)),b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=n(a=>{Z(a.target.value)},"w"),e[10]=b):b=e[10];let ee=b,w;e[11]!==v?(w=n(()=>{v()},"y"),e[11]=v,e[12]=w):w=e[12];let E=w,k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=["all","web-push","fcm"],e[13]=k):k=e[13];let te=k,c;e[14]!==i||e[15]!==r?(c=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"nt-kind-filter",role:"tablist",children:te.map(a=>(0,t.jsx)(B,{"aria-selected":i===a,"data-testid":`nt-kind-${a}`,onClick:n(()=>{Y(a)},"onClick"),role:"tab",size:"sm",type:"button",variant:i===a?"secondary":"ghost",children:a==="all"?r("All"):a},a))}),e[14]=i,e[15]=r,e[16]=c):c=e[16];let m;e[17]!==r?(m=r("Filter devices"),e[17]=r,e[18]=m):m=e[18];let h;e[19]!==r?(h=r("filter endpoint, user"),e[19]=r,e[20]=h):h=e[20];let u;e[21]!==l||e[22]!==m||e[23]!==h?(u=(0,t.jsx)(R,{"aria-label":m,className:"h-8 w-56","data-testid":"nt-search",onChange:ee,placeholder:h,value:l}),e[21]=l,e[22]=m,e[23]=h,e[24]=u):u=e[24];let f;e[25]!==r?(f=r("Refresh"),e[25]=r,e[26]=f):f=e[26];let p;e[27]!==E||e[28]!==f?(p=(0,t.jsx)(B,{className:"ml-auto","data-testid":"nt-refresh",onClick:E,size:"sm",type:"button",variant:"outline",children:f}),e[27]=E,e[28]=f,e[29]=p):p=e[29];let $=L.length>0&&(0,t.jsx)(S,{"data-testid":"nt-count",variant:"secondary",children:r("{count} devices",{count:L.length})}),y;e[30]!==p||e[31]!==$||e[32]!==c||e[33]!==u?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u,p,$]}),e[30]=p,e[31]=$,e[32]=c,e[33]=u,e[34]=y):y=e[34];let C;e[35]!==d||e[36]!==x?(C=d!==null&&(0,t.jsx)(q,{error:x,testId:"nt-error"}),e[35]=d,e[36]=x,e[37]=C):C=e[37],N=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-notifications",children:[y,C,d===null&&!_&&A.length===0&&(0,t.jsx)(D,{description:r("Registered Web Push / FCM devices appear here. Configure lunora/notify.ts with defineNotify({ store }) and register a device with ctx.push.register(...)."),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:"M15 17h5l-1.4-1.4A2 2 0 0 1 18 14.2V11a6 6 0 0 0-4-5.7V5a2 2 0 1 0-4 0v.3A6 6 0 0 0 6 11v3.2a2 2 0 0 1-.6 1.4L4 17h5m6 0v1a3 3 0 1 1-6 0v-1m6 0H9"})}),testId:"nt-empty",title:r("No registered devices.")}),A.length>0&&(0,t.jsx)(V,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(G,{"data-testid":"nt-table",children:[(0,t.jsx)(J,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(s,{children:r("kind")}),(0,t.jsx)(s,{children:r("endpoint")}),(0,t.jsx)(s,{children:r("user")}),(0,t.jsx)(s,{children:r("last seen")}),(0,t.jsx)(s,{children:r("status")}),(0,t.jsx)(s,{children:r("error")})]})}),(0,t.jsx)(K,{children:A.map(a=>{let z=Q(a);return(0,t.jsxs)(F,{"data-testid":"nt-row",children:[(0,t.jsx)(o,{children:(0,t.jsx)(S,{variant:"outline",children:a.kind})}),(0,t.jsx)(o,{className:"max-w-[28ch] truncate font-mono text-xs",title:z,children:z}),(0,t.jsx)(o,{className:"max-w-[16ch] truncate font-mono text-xs",children:a.userId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(o,{className:"text-muted-foreground tabular-nums",children:H(a.lastSeenAt,"\u2014")}),(0,t.jsx)(o,{children:(0,t.jsx)(S,{"data-testid":`nt-status-${a.id}`,variant:ne(a.lastStatus),children:a.lastStatus??r("n/a")})}),(0,t.jsx)(o,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",title:a.lastError??void 0,children:a.lastError??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.id)})})]})})})]}),e[1]=I?.subscriptions,e[2]=d,e[3]=x,e[4]=_,e[5]=i,e[6]=v,e[7]=l,e[8]=r,e[9]=N}else N=e[9];return N},"ge");export{ve as default};
1
+ import{P as R}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as B}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as S}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as q}from"./chunk-B3BKR5ZW.js";import"./chunk-PZ4QDWTI.js";import"./chunk-P4QIDUCY.js";import"./chunk-F7JOSNAT.js";import{a as U}from"./chunk-VDW32UET.js";import{c as O}from"./chunk-L6ATKZKO.js";import"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import{a as D}from"./chunk-UANVABQG.js";import{a as G,b as J,c as K,d as F,e as s,f as o}from"./chunk-L4EZAHCD.js";import{a as V,e as W}from"./chunk-IYWVSMAY.js";import{d as P,s as H}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as n,d as j,e as re,f as ae,g as ie}from"./chunk-R5ZTCHCE.js";var X=j(ae(),1),M=j(re(),1);var t=j(ie(),1);var ne=n(e=>e==="ok"?"success":e==="failed"?"destructive":e==="expired"?"warning":"secondary","te"),Q=n(e=>e.endpoint??e.id,"M"),ve=n(()=>{let e=(0,X.c)(38),r=P(),[i,Y]=(0,M.useState)("all"),[l,Z]=(0,M.useState)(""),g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={},e[0]=g):g=e[0];let{data:I,error:d,errorSource:x,isLoading:_,refetch:v}=O(U.listPushSubscriptions,g),N;if(e[1]!==I?.subscriptions||e[2]!==d||e[3]!==x||e[4]!==_||e[5]!==i||e[6]!==v||e[7]!==l||e[8]!==r){let L=I?.subscriptions??[],T=l.trim().toLowerCase(),A=L.filter(a=>i!=="all"&&a.kind!==i?!1:T===""?!0:`${Q(a)} ${a.userId??""}`.toLowerCase().includes(T)),b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=n(a=>{Z(a.target.value)},"w"),e[10]=b):b=e[10];let ee=b,w;e[11]!==v?(w=n(()=>{v()},"y"),e[11]=v,e[12]=w):w=e[12];let E=w,k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=["all","web-push","fcm"],e[13]=k):k=e[13];let te=k,c;e[14]!==i||e[15]!==r?(c=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"nt-kind-filter",role:"tablist",children:te.map(a=>(0,t.jsx)(B,{"aria-selected":i===a,"data-testid":`nt-kind-${a}`,onClick:n(()=>{Y(a)},"onClick"),role:"tab",size:"sm",type:"button",variant:i===a?"secondary":"ghost",children:a==="all"?r("All"):a},a))}),e[14]=i,e[15]=r,e[16]=c):c=e[16];let m;e[17]!==r?(m=r("Filter devices"),e[17]=r,e[18]=m):m=e[18];let h;e[19]!==r?(h=r("filter endpoint, user"),e[19]=r,e[20]=h):h=e[20];let u;e[21]!==l||e[22]!==m||e[23]!==h?(u=(0,t.jsx)(R,{"aria-label":m,className:"h-8 w-56","data-testid":"nt-search",onChange:ee,placeholder:h,value:l}),e[21]=l,e[22]=m,e[23]=h,e[24]=u):u=e[24];let f;e[25]!==r?(f=r("Refresh"),e[25]=r,e[26]=f):f=e[26];let p;e[27]!==E||e[28]!==f?(p=(0,t.jsx)(B,{className:"ml-auto","data-testid":"nt-refresh",onClick:E,size:"sm",type:"button",variant:"outline",children:f}),e[27]=E,e[28]=f,e[29]=p):p=e[29];let $=L.length>0&&(0,t.jsx)(S,{"data-testid":"nt-count",variant:"secondary",children:r("{count} devices",{count:L.length})}),y;e[30]!==p||e[31]!==$||e[32]!==c||e[33]!==u?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u,p,$]}),e[30]=p,e[31]=$,e[32]=c,e[33]=u,e[34]=y):y=e[34];let C;e[35]!==d||e[36]!==x?(C=d!==null&&(0,t.jsx)(q,{error:x,testId:"nt-error"}),e[35]=d,e[36]=x,e[37]=C):C=e[37],N=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-notifications",children:[y,C,d===null&&!_&&A.length===0&&(0,t.jsx)(D,{description:r("Registered Web Push / FCM devices appear here. Configure lunora/notify.ts with defineNotify({ store }) and register a device with ctx.push.register(...)."),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:"M15 17h5l-1.4-1.4A2 2 0 0 1 18 14.2V11a6 6 0 0 0-4-5.7V5a2 2 0 1 0-4 0v.3A6 6 0 0 0 6 11v3.2a2 2 0 0 1-.6 1.4L4 17h5m6 0v1a3 3 0 1 1-6 0v-1m6 0H9"})}),testId:"nt-empty",title:r("No registered devices.")}),A.length>0&&(0,t.jsx)(V,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(G,{"data-testid":"nt-table",children:[(0,t.jsx)(J,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(s,{children:r("kind")}),(0,t.jsx)(s,{children:r("endpoint")}),(0,t.jsx)(s,{children:r("user")}),(0,t.jsx)(s,{children:r("last seen")}),(0,t.jsx)(s,{children:r("status")}),(0,t.jsx)(s,{children:r("error")})]})}),(0,t.jsx)(K,{children:A.map(a=>{let z=Q(a);return(0,t.jsxs)(F,{"data-testid":"nt-row",children:[(0,t.jsx)(o,{children:(0,t.jsx)(S,{variant:"outline",children:a.kind})}),(0,t.jsx)(o,{className:"max-w-[28ch] truncate font-mono text-xs",title:z,children:z}),(0,t.jsx)(o,{className:"max-w-[16ch] truncate font-mono text-xs",children:a.userId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(o,{className:"text-muted-foreground tabular-nums",children:H(a.lastSeenAt,"\u2014")}),(0,t.jsx)(o,{children:(0,t.jsx)(S,{"data-testid":`nt-status-${a.id}`,variant:ne(a.lastStatus),children:a.lastStatus??r("n/a")})}),(0,t.jsx)(o,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",title:a.lastError??void 0,children:a.lastError??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.id)})})]})})})]}),e[1]=I?.subscriptions,e[2]=d,e[3]=x,e[4]=_,e[5]=i,e[6]=v,e[7]=l,e[8]=r,e[9]=N}else N=e[9];return N},"ge");export{ve as default};
@@ -1 +1 @@
1
- import{b as y}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as R}from"./chunk-H4SLAZAN.js";import"./chunk-PZ4QDWTI.js";import"./chunk-DC5AAWSA.js";import"./chunk-F7JOSNAT.js";import{a as v}from"./chunk-VDW32UET.js";import{c as $}from"./chunk-2UWKGSEA.js";import"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{a as S}from"./chunk-UANVABQG.js";import{a as A,b as C,c as I,d as x,e as c,f as n}from"./chunk-L4EZAHCD.js";import{a as k,e as w}from"./chunk-IYWVSMAY.js";import{d as N}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as f,d as b,f as E,g as O}from"./chunk-R5ZTCHCE.js";var j=b(E(),1);var r=b(O(),1);var _=f((e,t)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[t],"I"),T={delete:2,list:3,read:0,write:1},B=f(e=>[...e].toSorted((t,a)=>t.bucket.localeCompare(a.bucket)||T[t.on]-T[a.on]||(t.prefix??"").localeCompare(a.prefix??"")),"O"),q=f(()=>{let e=(0,j.c)(14),t=N(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:i,errorSource:d}=$(v.storageRules,a),h=l!==void 0,m;if(e[1]!==l||e[2]!==i||e[3]!==d||e[4]!==h||e[5]!==t){let g=B(Array.isArray(l?.rules)?l.rules:[]),u;e[7]!==i||e[8]!==d?(u=i!==null&&(0,r.jsx)(R,{error:d,testId:"storage-rules-error"}),e[7]=i,e[8]=d,e[9]=u):u=e[9];let o;e[10]!==t?(o=t("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=t,e[11]=o):o=e[11];let p;e[12]!==o?(p=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:o}),e[12]=o,e[13]=p):p=e[13],m=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[u,p,h&&g.length===0?(0,r.jsx)(S,{description:t("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:t("No storage rules defined")}):(0,r.jsx)(k,{className:"overflow-hidden py-0",children:(0,r.jsx)(w,{className:"px-0",children:(0,r.jsxs)(A,{"data-testid":"storage-rules-table",children:[(0,r.jsx)(C,{children:(0,r.jsxs)(x,{children:[(0,r.jsx)(c,{children:t("Bucket")}),(0,r.jsx)(c,{children:t("Operation")}),(0,r.jsx)(c,{children:t("Key prefix")}),(0,r.jsx)(c,{children:t("Guarded by")})]})}),(0,r.jsx)(I,{children:g.map(s=>(0,r.jsxs)(x,{"data-testid":`storage-rule-${s.bucket}-${s.on}-${s.prefix??""}`,children:[(0,r.jsx)(n,{className:"font-mono text-xs",children:s.bucket}),(0,r.jsx)(n,{children:(0,r.jsx)(y,{variant:"secondary",children:_(t,s.on)})}),(0,r.jsx)(n,{className:"font-mono text-xs",children:s.prefix??(0,r.jsx)("span",{className:"text-muted-foreground",children:t("(whole bucket)")})}),(0,r.jsx)(n,{className:"font-mono text-xs text-muted-foreground",children:s.procedure})]},`${s.bucket}:${s.on}:${s.prefix??""}:${s.procedure}`))})]})})})]}),e[1]=l,e[2]=i,e[3]=d,e[4]=h,e[5]=t,e[6]=m}else m=e[6];return m},"M");export{q as default};
1
+ import{b as y}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as R}from"./chunk-B3BKR5ZW.js";import"./chunk-PZ4QDWTI.js";import"./chunk-P4QIDUCY.js";import"./chunk-F7JOSNAT.js";import{a as v}from"./chunk-VDW32UET.js";import{c as $}from"./chunk-L6ATKZKO.js";import"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import{a as S}from"./chunk-UANVABQG.js";import{a as A,b as C,c as I,d as x,e as c,f as n}from"./chunk-L4EZAHCD.js";import{a as k,e as w}from"./chunk-IYWVSMAY.js";import{d as N}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as f,d as b,f as E,g as O}from"./chunk-R5ZTCHCE.js";var j=b(E(),1);var r=b(O(),1);var _=f((e,t)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[t],"I"),T={delete:2,list:3,read:0,write:1},B=f(e=>[...e].toSorted((t,a)=>t.bucket.localeCompare(a.bucket)||T[t.on]-T[a.on]||(t.prefix??"").localeCompare(a.prefix??"")),"O"),q=f(()=>{let e=(0,j.c)(14),t=N(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:i,errorSource:d}=$(v.storageRules,a),h=l!==void 0,m;if(e[1]!==l||e[2]!==i||e[3]!==d||e[4]!==h||e[5]!==t){let g=B(Array.isArray(l?.rules)?l.rules:[]),u;e[7]!==i||e[8]!==d?(u=i!==null&&(0,r.jsx)(R,{error:d,testId:"storage-rules-error"}),e[7]=i,e[8]=d,e[9]=u):u=e[9];let o;e[10]!==t?(o=t("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=t,e[11]=o):o=e[11];let p;e[12]!==o?(p=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:o}),e[12]=o,e[13]=p):p=e[13],m=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[u,p,h&&g.length===0?(0,r.jsx)(S,{description:t("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:t("No storage rules defined")}):(0,r.jsx)(k,{className:"overflow-hidden py-0",children:(0,r.jsx)(w,{className:"px-0",children:(0,r.jsxs)(A,{"data-testid":"storage-rules-table",children:[(0,r.jsx)(C,{children:(0,r.jsxs)(x,{children:[(0,r.jsx)(c,{children:t("Bucket")}),(0,r.jsx)(c,{children:t("Operation")}),(0,r.jsx)(c,{children:t("Key prefix")}),(0,r.jsx)(c,{children:t("Guarded by")})]})}),(0,r.jsx)(I,{children:g.map(s=>(0,r.jsxs)(x,{"data-testid":`storage-rule-${s.bucket}-${s.on}-${s.prefix??""}`,children:[(0,r.jsx)(n,{className:"font-mono text-xs",children:s.bucket}),(0,r.jsx)(n,{children:(0,r.jsx)(y,{variant:"secondary",children:_(t,s.on)})}),(0,r.jsx)(n,{className:"font-mono text-xs",children:s.prefix??(0,r.jsx)("span",{className:"text-muted-foreground",children:t("(whole bucket)")})}),(0,r.jsx)(n,{className:"font-mono text-xs text-muted-foreground",children:s.procedure})]},`${s.bucket}:${s.on}:${s.prefix??""}:${s.procedure}`))})]})})})]}),e[1]=l,e[2]=i,e[3]=d,e[4]=h,e[5]=t,e[6]=m}else m=e[6];return m},"M");export{q as default};
@@ -1 +1 @@
1
- import{a as G}from"./chunk-METRMDIQ.js";import{a as x}from"./chunk-NXXGISFB.js";import{a as U}from"./chunk-6UN4V2HB.js";import{b as M}from"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import{P as O}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as h}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as w}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as E}from"./chunk-VDW32UET.js";import{f as D}from"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{d as K,e as _,f as z,h as B,o as P,s as q}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as s,d as J,e as ie,g as oe}from"./chunk-R5ZTCHCE.js";var i=J(ie(),1);var e=J(oe(),1);var de=s(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"oe"),le=s(r=>r===void 0||r.length===0?"()":`(${r.map(o=>`${o.name}${o.optional?"?":""}: ${de(o)}`).join(", ")})`,"ie"),ce=s(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"de"),ue=s(r=>{let o={};for(let a of r??[])a.optional||(o[a.name]=ce(a.kind));return JSON.stringify(o,void 0,2)},"le"),me=z(E.runAs),fe=10,pe=s(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"me"),Fe=s(({functions:r,runAsIdentity:o=!1}={})=>{let a=K(),u=D(),[H,Q]=(0,i.useState)(null),[k,V]=(0,i.useState)(null),g=r??H??[],[I,S]=(0,i.useState)(""),[m,b]=(0,i.useState)("{}"),[c,F]=(0,i.useState)(""),[f,W]=(0,i.useState)(""),[v,p]=(0,i.useState)("idle"),[X,y]=(0,i.useState)(void 0),[C,N]=(0,i.useState)(null),[$,Y]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(r!==void 0)return;let t=!1;return u.listFunctions().then(d=>(t||Q(d),d)).catch(d=>{t||V(B(d))}),()=>{t=!0}},[u,r]);let A=I===""?g[0]?.path??"":I,n=g.find(t=>t.path===A),Z=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:JSON.parse(m)}catch(l){p("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},R=c.trim()===""?{}:{shardKey:c.trim()},j=o?f.trim():"",L=s(l=>{Y(T=>[{argsText:m,at:Date.now(),id:(T[0]?.id??0)+1,kind:n.kind,path:n.path,shardKey:c,status:l},...T].slice(0,fe))},"$");p("running"),N(null);try{let l=j===""?await _(u,n.kind,d,t,R):await u.query(me,{args:t,functionPath:n.path,userId:j},R);M(c),y(l),p("success"),L("success")}catch(l){y(void 0),N(l.message),p("error"),L("error")}},"J"),ee=s(t=>{S(t.path),b(t.argsText),F(t.shardKey)},"M"),te=s(t=>{S(t.target.value)},"P"),re=s(t=>{b(t.target.value)},"z"),ae=s(t=>{W(t.target.value)},"q"),se=s(()=>{P(Z())},"H"),ne=s(()=>{b(ue(n?.args))},"V");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:k}),(0,e.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(x,{htmlFor:"function-select",children:a("Function")}),(0,e.jsx)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:A,children:g.map(t=>(0,e.jsxs)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path))}),n!==void 0&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"mr-1.5 font-medium",children:a("Signature")}),(0,e.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:le(n.args)})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)(x,{htmlFor:"args-input",children:a("Arguments")}),(0,e.jsx)(h,{"data-testid":"prefill-button",disabled:n===void 0,onClick:ne,size:"xs",type:"button",variant:"ghost",children:a("Prefill")})]}),(0,e.jsx)(G,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:m})]}),(0,e.jsx)(U,{onChange:F,testId:"shard-input",value:c}),o&&(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsx)(x,{htmlFor:"run-as-input",children:a("Run as identity (userId)")}),(0,e.jsx)(O,{"aria-label":a("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:ae,placeholder:a("Leave empty to run as admin"),value:f}),(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground",children:a("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(h,{"data-testid":"run-button",disabled:v==="running"||n===void 0,onClick:se,type:"button",children:a("Run")}),n!==void 0&&(0,e.jsx)(w,{variant:"outline",children:n.kind}),o&&f.trim()!==""&&(0,e.jsx)(w,{"data-testid":"run-as-badge",variant:"secondary",children:a("as {userId}",{userId:f.trim()})})]})]}),v==="error"&&C!==null&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:C}),v==="success"&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:pe(X)}),$.length>0&&(0,e.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:$.map((t,d)=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsx)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"})," ",(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]})," ",(0,e.jsx)("time",{className:"text-xs text-muted-foreground",children:q(t.at)})," ",(0,e.jsx)(h,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:s(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Load")})]},t.id))})]})},"Ae");export{Fe as FunctionRunner};
1
+ import{a as G}from"./chunk-METRMDIQ.js";import{a as x}from"./chunk-NXXGISFB.js";import{a as U}from"./chunk-6UN4V2HB.js";import{b as M}from"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import{P as O}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as h}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as w}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as E}from"./chunk-VDW32UET.js";import{f as D}from"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import{d as K,e as _,f as z,h as B,o as P,s as q}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as s,d as J,e as ie,g as oe}from"./chunk-R5ZTCHCE.js";var i=J(ie(),1);var e=J(oe(),1);var de=s(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"oe"),le=s(r=>r===void 0||r.length===0?"()":`(${r.map(o=>`${o.name}${o.optional?"?":""}: ${de(o)}`).join(", ")})`,"ie"),ce=s(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"de"),ue=s(r=>{let o={};for(let a of r??[])a.optional||(o[a.name]=ce(a.kind));return JSON.stringify(o,void 0,2)},"le"),me=z(E.runAs),fe=10,pe=s(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"me"),Fe=s(({functions:r,runAsIdentity:o=!1}={})=>{let a=K(),u=D(),[H,Q]=(0,i.useState)(null),[k,V]=(0,i.useState)(null),g=r??H??[],[I,S]=(0,i.useState)(""),[m,b]=(0,i.useState)("{}"),[c,F]=(0,i.useState)(""),[f,W]=(0,i.useState)(""),[v,p]=(0,i.useState)("idle"),[X,y]=(0,i.useState)(void 0),[C,N]=(0,i.useState)(null),[$,Y]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(r!==void 0)return;let t=!1;return u.listFunctions().then(d=>(t||Q(d),d)).catch(d=>{t||V(B(d))}),()=>{t=!0}},[u,r]);let A=I===""?g[0]?.path??"":I,n=g.find(t=>t.path===A),Z=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:JSON.parse(m)}catch(l){p("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},R=c.trim()===""?{}:{shardKey:c.trim()},j=o?f.trim():"",L=s(l=>{Y(T=>[{argsText:m,at:Date.now(),id:(T[0]?.id??0)+1,kind:n.kind,path:n.path,shardKey:c,status:l},...T].slice(0,fe))},"$");p("running"),N(null);try{let l=j===""?await _(u,n.kind,d,t,R):await u.query(me,{args:t,functionPath:n.path,userId:j},R);M(c),y(l),p("success"),L("success")}catch(l){y(void 0),N(l.message),p("error"),L("error")}},"J"),ee=s(t=>{S(t.path),b(t.argsText),F(t.shardKey)},"M"),te=s(t=>{S(t.target.value)},"P"),re=s(t=>{b(t.target.value)},"z"),ae=s(t=>{W(t.target.value)},"q"),se=s(()=>{P(Z())},"H"),ne=s(()=>{b(ue(n?.args))},"V");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:k}),(0,e.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(x,{htmlFor:"function-select",children:a("Function")}),(0,e.jsx)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:A,children:g.map(t=>(0,e.jsxs)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path))}),n!==void 0&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"mr-1.5 font-medium",children:a("Signature")}),(0,e.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:le(n.args)})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)(x,{htmlFor:"args-input",children:a("Arguments")}),(0,e.jsx)(h,{"data-testid":"prefill-button",disabled:n===void 0,onClick:ne,size:"xs",type:"button",variant:"ghost",children:a("Prefill")})]}),(0,e.jsx)(G,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:m})]}),(0,e.jsx)(U,{onChange:F,testId:"shard-input",value:c}),o&&(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsx)(x,{htmlFor:"run-as-input",children:a("Run as identity (userId)")}),(0,e.jsx)(O,{"aria-label":a("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:ae,placeholder:a("Leave empty to run as admin"),value:f}),(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground",children:a("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(h,{"data-testid":"run-button",disabled:v==="running"||n===void 0,onClick:se,type:"button",children:a("Run")}),n!==void 0&&(0,e.jsx)(w,{variant:"outline",children:n.kind}),o&&f.trim()!==""&&(0,e.jsx)(w,{"data-testid":"run-as-badge",variant:"secondary",children:a("as {userId}",{userId:f.trim()})})]})]}),v==="error"&&C!==null&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:C}),v==="success"&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:pe(X)}),$.length>0&&(0,e.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:$.map((t,d)=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsx)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"})," ",(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]})," ",(0,e.jsx)("time",{className:"text-xs text-muted-foreground",children:q(t.at)})," ",(0,e.jsx)(h,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:s(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Load")})]},t.id))})]})},"Ae");export{Fe as FunctionRunner};
@@ -1 +1 @@
1
- import{a as O}from"./chunk-WUW4ZHRL.js";import{a as H}from"./chunk-2EJQ7SPV.js";import{a as ee}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as Z}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{b as E}from"./chunk-2UWKGSEA.js";import{f as R}from"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{a as _}from"./chunk-UANVABQG.js";import{a as K,b as V,c as z,d as F,e as u,f as p}from"./chunk-L4EZAHCD.js";import{a as A,e as T}from"./chunk-IYWVSMAY.js";import{d as M,h as G,o as W,s as X}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as c,d as P,e as oe,f as re,g as ae}from"./chunk-R5ZTCHCE.js";var U=P(re(),1),Y=P(oe(),1);var t=P(ae(),1);var se=P(re(),1);var Q=P(oe(),1);var h=P(ae(),1);var ie=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","X"),le=c(a=>a.toSorted((e,i)=>e.scheduledFor-i.scheduledFor),"j"),ce=c((a,e,i)=>e!==void 0?e:i===void 0?d=>a.cancelScheduledJob(d):void 0,"Y"),de=c(a=>{let e=(0,se.c)(16),{cancelJob:i,loadJobs:d}=a===void 0?{}:a,f=R(),r=M(),l=d===void 0,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-scheduled-jobs"],e[0]=o):o=e[0];let N=E(o,async()=>{let g=await(d??(()=>f.listScheduledJobs()))();return le(g)}),[v,n]=(0,Q.useState)(void 0),[s,m]=(0,Q.useState)(void 0),y,k;e[1]!==f||e[2]!==l?(y=c(()=>{if(l)return f.subscribeScheduledJobs(g=>{m(void 0),n(le(g))})},"v"),k=[l,f],e[1]=f,e[2]=l,e[3]=y,e[4]=k):(y=e[3],k=e[4]),(0,Q.useEffect)(y,k);let x;e[5]!==N?(x=c(()=>{N.refetch()},"y"),e[5]=N,e[6]=x):x=e[6],O(x,!l);let C=ce(f,i,d),b=v??N.data,j=s??N.error,I=c(async g=>{if(C!==void 0){m(void 0);try{await C(g),l||N.refetch()}catch(D){m(G(D))}}},"E"),q="flex flex-col gap-3",B="lunora-scheduled-jobs",J;e[7]!==j?(J=j!==null&&(0,h.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:j}),e[7]=j,e[8]=J):J=e[8];let S;e[9]!==b?.length||e[10]!==r?(S=b?.length===0&&(0,h.jsx)(_,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,h.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,h.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,h.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=b?.length,e[10]=r,e[11]=S):S=e[11];let $=b!==void 0&&b.length>0&&(0,h.jsx)(A,{className:"overflow-hidden py-0",children:(0,h.jsx)(T,{className:"px-0",children:(0,h.jsxs)(K,{"data-testid":"sj-table",children:[(0,h.jsx)(V,{children:(0,h.jsxs)(F,{children:[(0,h.jsx)(u,{children:r("function")}),(0,h.jsx)(u,{children:r("scheduled for")}),(0,h.jsx)(u,{children:r("pool")}),(0,h.jsx)(u,{children:r("attempts")}),(0,h.jsx)(u,{children:r("shard")}),(0,h.jsx)(u,{children:r("id")}),C!==void 0&&(0,h.jsx)(u,{"aria-label":r("Actions")})]})}),(0,h.jsx)(z,{children:b.map(g=>(0,h.jsxs)(F,{"data-testid":`sj-row-${g.id}`,children:[(0,h.jsx)(p,{className:"font-mono text-xs",children:g.functionPath}),(0,h.jsx)(p,{className:"text-muted-foreground tabular-nums",children:ie(g.scheduledFor)}),(0,h.jsx)(p,{className:"font-mono text-xs",children:g.pool??""}),(0,h.jsx)(p,{className:"tabular-nums",children:g.attempts??0}),(0,h.jsx)(p,{children:g.shardKey??""}),(0,h.jsx)(p,{className:"font-mono text-xs",children:g.id}),C!==void 0&&(0,h.jsx)(p,{className:"text-right",children:(0,h.jsx)(H,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{W(I(g.id))},"onConfirm"),testId:`sj-cancel-${g.id}`,children:r("Cancel")})})]},g.id))})]})})}),w;return e[12]!==$||e[13]!==J||e[14]!==S?(w=(0,h.jsxs)("div",{className:q,"data-testid":B,children:[J,S,$]}),e[12]=$,e[13]=J,e[14]=S,e[15]=w):w=e[15],w},"he");var he={kind:"idle"},me=c((a,e,i)=>i!==void 0?i:e===void 0?d=>a.runCronJob(d):void 0,"re"),ue=c(({loadCronJobs:a,runCronJob:e}={})=>{let i=R(),d=M(),[f,r]=(0,Y.useState)({}),l=E(["lunora-cron-jobs",a?"custom":"default"],()=>(a??(()=>i.getCronJobs()))()),{data:o,error:N}=l,v=me(i,a,e),n=c(async s=>{if(v!==void 0){r(m=>({...m,[s]:{kind:"running"}}));try{await v(s),r(m=>({...m,[s]:{kind:"ok"}})),l.refetch()}catch(m){r(y=>({...y,[s]:{kind:"error",message:G(m)}}))}}},"i");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),o?.length===0&&(0,t.jsx)(_,{description:d("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:d("No cron triggers.")}),o!==void 0&&o.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"cron-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:d("name")}),(0,t.jsx)(u,{children:d("schedule")}),(0,t.jsx)(u,{children:d("target")}),(0,t.jsx)(u,{children:d("shard")}),v!==void 0&&(0,t.jsx)(u,{"aria-label":d("Actions")})]})}),(0,t.jsx)(z,{children:o.map(s=>{let m=f[s.name]??he;return(0,t.jsxs)(F,{"data-testid":`cron-row-${s.name}`,children:[(0,t.jsx)(p,{children:s.name}),(0,t.jsx)(p,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,t.jsx)(p,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,t.jsx)(Z,{variant:"outline",children:d("function")}):(0,t.jsx)(Z,{variant:"secondary",children:d("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,t.jsx)(p,{children:s.shardKey??""}),v!==void 0&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[m.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:d("ran")}),m.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:m.message}),(0,t.jsx)(H,{confirmLabel:d("Run now?"),disabled:m.kind==="running",onConfirm:c(()=>{W(n(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:m.kind==="running"?d("Running\u2026"):d("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"le"),pe=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","se"),fe=c(a=>{let e=(0,U.c)(34),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadJobs:d,removeJob:f,retryJob:r}=i,l=R(),o=M(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let v;e[3]!==l||e[4]!==d?(v=c(async()=>(await(d??(()=>l.listDeadJobs()))()).toSorted(be),"h"),e[3]=l,e[4]=d,e[5]=v):v=e[5];let n=E(N,v),s=n.data,[m,y]=(0,Y.useState)(void 0),k=n.error??m,x=d===void 0,C;e[6]!==l||e[7]!==x||e[8]!==r?(C=r??(x?L=>l.retryDeadJob(L):void 0),e[6]=l,e[7]=x,e[8]=r,e[9]=C):C=e[9];let b=C,j;e[10]!==l||e[11]!==x||e[12]!==f?(j=f??(x?L=>l.removeDeadJob(L):void 0),e[10]=l,e[11]=x,e[12]=f,e[13]=j):j=e[13];let I=j,q;e[14]!==n?(q=c(()=>{n.refetch()},"$"),e[14]=n,e[15]=q):q=e[15],O(q,!0);let B;e[16]!==n?(B=c(async L=>{y(void 0);try{await L,n.refetch()}catch(ne){y(G(ne))}},"I"),e[16]=n,e[17]=B):B=e[17];let J=B,S=b!==void 0||I!==void 0,$;e[18]!==k?($=k!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:k}),e[18]=k,e[19]=$):$=e[19];let w;e[20]!==s?.length||e[21]!==o?(w=s?.length===0&&(0,t.jsx)(_,{description:o("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:o("No dead-letter jobs.")}),e[20]=s?.length,e[21]=o,e[22]=w):w=e[22];let g;e[23]!==J||e[24]!==S||e[25]!==s||e[26]!==I||e[27]!==b||e[28]!==o?(g=s!==void 0&&s.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"dlq-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:o("function")}),(0,t.jsx)(u,{children:o("attempts")}),(0,t.jsx)(u,{children:o("last tried")}),(0,t.jsx)(u,{children:o("pool")}),(0,t.jsx)(u,{children:o("shard")}),(0,t.jsx)(u,{children:o("id")}),S&&(0,t.jsx)(u,{"aria-label":o("Actions")})]})}),(0,t.jsx)(z,{children:s.map(L=>(0,t.jsxs)(F,{"data-testid":`dlq-row-${L.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:L.functionPath}),(0,t.jsx)(p,{className:"tabular-nums",children:L.attempts??0}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:pe(L.scheduledFor)}),(0,t.jsx)(p,{className:"font-mono text-xs",children:L.pool??""}),(0,t.jsx)(p,{children:L.shardKey??""}),(0,t.jsx)(p,{className:"font-mono text-xs",children:L.id}),S&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[b!==void 0&&(0,t.jsx)(ee,{"data-testid":`dlq-retry-${L.id}`,onClick:c(()=>{W(J(b(L.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Retry")}),I!==void 0&&(0,t.jsx)(H,{confirmLabel:o("Drop job?"),onConfirm:c(()=>{W(J(I(L.id)))},"onConfirm"),testId:`dlq-remove-${L.id}`,children:o("Drop")})]})})]},L.id))})]})})}),e[23]=J,e[24]=S,e[25]=s,e[26]=I,e[27]=b,e[28]=o,e[29]=g):g=e[29];let D;return e[30]!==g||e[31]!==$||e[32]!==w?(D=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,w,g]}),e[30]=g,e[31]=$,e[32]=w,e[33]=D):D=e[33],D},"ne");function be(a,e){return(e.attempts??0)-(a.attempts??0)}c(be,"oe");var te=c(a=>{let e=(0,U.c)(8),{label:i,testId:d,value:f}=a,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==d||e[3]!==f?(l=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":d,children:f}),e[2]=d,e[3]=f,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o=(0,t.jsx)(A,{className:"flex-1 py-0",children:(0,t.jsxs)(T,{className:"flex flex-col gap-1 p-4",children:[r,l]})}),e[5]=r,e[6]=l,e[7]=o):o=e[7],o},"E"),ve=c(a=>{let e=(0,U.c)(25),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadStatus:d}=i,f=R(),r=M(),l=d===void 0,o;e[2]!==l?(o=["lunora-scheduler-status",l],e[2]=l,e[3]=o):o=e[3];let N;e[4]!==f||e[5]!==d?(N=c(async()=>{let j=await(d??(()=>f.schedulerStatus()))();return{...j,pools:j.pools.toSorted(xe)}},"y"),e[4]=f,e[5]=d,e[6]=N):N=e[6];let v=E(o,N),{data:n,error:s}=v,m;e[7]!==v?(m=c(()=>{v.refetch()},"d"),e[7]=v,e[8]=m):m=e[8],O(m,!0);let y;e[9]!==s?(y=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=y):y=e[10];let k;e[11]!==n||e[12]!==r?(k=n!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(te,{label:r("backlog"),testId:"pools-backlog",value:n.backlog}),(0,t.jsx)(te,{label:r("in flight"),testId:"pools-inflight",value:n.inFlight}),(0,t.jsx)(te,{label:r("pools"),testId:"pools-count",value:n.pools.length})]}),e[11]=n,e[12]=r,e[13]=k):k=e[13];let x;e[14]!==n?.pools.length||e[15]!==r?(x=n?.pools.length===0&&(0,t.jsx)(_,{description:r("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:r("No workpools.")}),e[14]=n?.pools.length,e[15]=r,e[16]=x):x=e[16];let C;e[17]!==n||e[18]!==r?(C=n!==void 0&&n.pools.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"pools-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:r("pool")}),(0,t.jsx)(u,{children:r("queued")}),(0,t.jsx)(u,{children:r("in flight")}),(0,t.jsx)(u,{children:r("max concurrency")})]})}),(0,t.jsx)(z,{children:n.pools.map(ge)})]})})}),e[17]=n,e[18]=r,e[19]=C):C=e[19];let b;return e[20]!==y||e[21]!==k||e[22]!==x||e[23]!==C?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[y,k,x,C]}),e[20]=y,e[21]=k,e[22]=x,e[23]=C,e[24]=b):b=e[24],b},"ae");function xe(a,e){return e.queued-a.queued}c(xe,"ie");function ge(a){return(0,t.jsxs)(F,{"data-testid":`pools-row-${a.name}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:a.name}),(0,t.jsx)(p,{className:"tabular-nums",children:a.queued}),(0,t.jsxs)(p,{className:"tabular-nums",children:[a.inFlight," / ",a.maxConcurrency]}),(0,t.jsx)(p,{className:"tabular-nums",children:a.maxConcurrency})]},a.name)}c(ge,"de");var Ne=["jobs","dead","pools","cron"],Ve=c(a=>{let e=(0,U.c)(41),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadCronJobs:d,scheduledCancel:f,scheduledLoad:r}=i,l=M(),[o,N]=(0,Y.useState)("jobs"),v;e[2]!==l?(v=l("Cron triggers"),e[2]=l,e[3]=v):v=e[3];let n;e[4]!==l?(n=l("Dead letter"),e[4]=l,e[5]=n):n=e[5];let s;e[6]!==l?(s=l("Scheduled jobs"),e[6]=l,e[7]=s):s=e[7];let m;e[8]!==l?(m=l("Pools"),e[8]=l,e[9]=m):m=e[9];let y;e[10]!==v||e[11]!==n||e[12]!==s||e[13]!==m?(y={cron:v,dead:n,jobs:s,pools:m},e[10]=v,e[11]=n,e[12]=s,e[13]=m,e[14]=y):y=e[14];let k=y,x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=c(w=>{N(w.currentTarget.dataset.view)},"f"),e[15]=x):x=e[15];let C=x,b;e[16]!==l?(b=l("Schedule view"),e[16]=l,e[17]=b):b=e[17];let j;e[18]!==o||e[19]!==k?(j=Ne.map(w=>(0,t.jsx)(ee,{"aria-selected":o===w,"data-testid":`schedule-view-${w}`,"data-view":w,onClick:C,role:"tab",size:"sm",type:"button",variant:o===w?"default":"outline",children:k[w]},w)),e[18]=o,e[19]=k,e[20]=j):j=e[20];let I;e[21]!==b||e[22]!==j?(I=(0,t.jsx)("div",{"aria-label":b,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:j}),e[21]=b,e[22]=j,e[23]=I):I=e[23];let q;e[24]!==f||e[25]!==r||e[26]!==o?(q=o==="jobs"&&(0,t.jsx)(de,{cancelJob:f,loadJobs:r}),e[24]=f,e[25]=r,e[26]=o,e[27]=q):q=e[27];let B;e[28]!==o?(B=o==="dead"&&(0,t.jsx)(fe,{}),e[28]=o,e[29]=B):B=e[29];let J;e[30]!==o?(J=o==="pools"&&(0,t.jsx)(ve,{}),e[30]=o,e[31]=J):J=e[31];let S;e[32]!==d||e[33]!==o?(S=o==="cron"&&(0,t.jsx)(ue,{loadCronJobs:d}),e[32]=d,e[33]=o,e[34]=S):S=e[34];let $;return e[35]!==I||e[36]!==q||e[37]!==B||e[38]!==J||e[39]!==S?($=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[I,q,B,J,S]}),e[35]=I,e[36]=q,e[37]=B,e[38]=J,e[39]=S,e[40]=$):$=e[40],$},"Ie");export{Ve as SchedulePanel};
1
+ import{a as O}from"./chunk-WUW4ZHRL.js";import{a as H}from"./chunk-2EJQ7SPV.js";import{a as ee}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as Z}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{b as E}from"./chunk-L6ATKZKO.js";import{f as R}from"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import{a as _}from"./chunk-UANVABQG.js";import{a as K,b as V,c as z,d as F,e as u,f as p}from"./chunk-L4EZAHCD.js";import{a as A,e as T}from"./chunk-IYWVSMAY.js";import{d as M,h as G,o as W,s as X}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as c,d as P,e as oe,f as re,g as ae}from"./chunk-R5ZTCHCE.js";var U=P(re(),1),Y=P(oe(),1);var t=P(ae(),1);var se=P(re(),1);var Q=P(oe(),1);var h=P(ae(),1);var ie=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","X"),le=c(a=>a.toSorted((e,i)=>e.scheduledFor-i.scheduledFor),"j"),ce=c((a,e,i)=>e!==void 0?e:i===void 0?d=>a.cancelScheduledJob(d):void 0,"Y"),de=c(a=>{let e=(0,se.c)(16),{cancelJob:i,loadJobs:d}=a===void 0?{}:a,f=R(),r=M(),l=d===void 0,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-scheduled-jobs"],e[0]=o):o=e[0];let N=E(o,async()=>{let g=await(d??(()=>f.listScheduledJobs()))();return le(g)}),[v,n]=(0,Q.useState)(void 0),[s,m]=(0,Q.useState)(void 0),y,k;e[1]!==f||e[2]!==l?(y=c(()=>{if(l)return f.subscribeScheduledJobs(g=>{m(void 0),n(le(g))})},"v"),k=[l,f],e[1]=f,e[2]=l,e[3]=y,e[4]=k):(y=e[3],k=e[4]),(0,Q.useEffect)(y,k);let x;e[5]!==N?(x=c(()=>{N.refetch()},"y"),e[5]=N,e[6]=x):x=e[6],O(x,!l);let C=ce(f,i,d),b=v??N.data,j=s??N.error,I=c(async g=>{if(C!==void 0){m(void 0);try{await C(g),l||N.refetch()}catch(D){m(G(D))}}},"E"),q="flex flex-col gap-3",B="lunora-scheduled-jobs",J;e[7]!==j?(J=j!==null&&(0,h.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:j}),e[7]=j,e[8]=J):J=e[8];let S;e[9]!==b?.length||e[10]!==r?(S=b?.length===0&&(0,h.jsx)(_,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,h.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,h.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,h.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=b?.length,e[10]=r,e[11]=S):S=e[11];let $=b!==void 0&&b.length>0&&(0,h.jsx)(A,{className:"overflow-hidden py-0",children:(0,h.jsx)(T,{className:"px-0",children:(0,h.jsxs)(K,{"data-testid":"sj-table",children:[(0,h.jsx)(V,{children:(0,h.jsxs)(F,{children:[(0,h.jsx)(u,{children:r("function")}),(0,h.jsx)(u,{children:r("scheduled for")}),(0,h.jsx)(u,{children:r("pool")}),(0,h.jsx)(u,{children:r("attempts")}),(0,h.jsx)(u,{children:r("shard")}),(0,h.jsx)(u,{children:r("id")}),C!==void 0&&(0,h.jsx)(u,{"aria-label":r("Actions")})]})}),(0,h.jsx)(z,{children:b.map(g=>(0,h.jsxs)(F,{"data-testid":`sj-row-${g.id}`,children:[(0,h.jsx)(p,{className:"font-mono text-xs",children:g.functionPath}),(0,h.jsx)(p,{className:"text-muted-foreground tabular-nums",children:ie(g.scheduledFor)}),(0,h.jsx)(p,{className:"font-mono text-xs",children:g.pool??""}),(0,h.jsx)(p,{className:"tabular-nums",children:g.attempts??0}),(0,h.jsx)(p,{children:g.shardKey??""}),(0,h.jsx)(p,{className:"font-mono text-xs",children:g.id}),C!==void 0&&(0,h.jsx)(p,{className:"text-right",children:(0,h.jsx)(H,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{W(I(g.id))},"onConfirm"),testId:`sj-cancel-${g.id}`,children:r("Cancel")})})]},g.id))})]})})}),w;return e[12]!==$||e[13]!==J||e[14]!==S?(w=(0,h.jsxs)("div",{className:q,"data-testid":B,children:[J,S,$]}),e[12]=$,e[13]=J,e[14]=S,e[15]=w):w=e[15],w},"he");var he={kind:"idle"},me=c((a,e,i)=>i!==void 0?i:e===void 0?d=>a.runCronJob(d):void 0,"re"),ue=c(({loadCronJobs:a,runCronJob:e}={})=>{let i=R(),d=M(),[f,r]=(0,Y.useState)({}),l=E(["lunora-cron-jobs",a?"custom":"default"],()=>(a??(()=>i.getCronJobs()))()),{data:o,error:N}=l,v=me(i,a,e),n=c(async s=>{if(v!==void 0){r(m=>({...m,[s]:{kind:"running"}}));try{await v(s),r(m=>({...m,[s]:{kind:"ok"}})),l.refetch()}catch(m){r(y=>({...y,[s]:{kind:"error",message:G(m)}}))}}},"i");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),o?.length===0&&(0,t.jsx)(_,{description:d("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:d("No cron triggers.")}),o!==void 0&&o.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"cron-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:d("name")}),(0,t.jsx)(u,{children:d("schedule")}),(0,t.jsx)(u,{children:d("target")}),(0,t.jsx)(u,{children:d("shard")}),v!==void 0&&(0,t.jsx)(u,{"aria-label":d("Actions")})]})}),(0,t.jsx)(z,{children:o.map(s=>{let m=f[s.name]??he;return(0,t.jsxs)(F,{"data-testid":`cron-row-${s.name}`,children:[(0,t.jsx)(p,{children:s.name}),(0,t.jsx)(p,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,t.jsx)(p,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,t.jsx)(Z,{variant:"outline",children:d("function")}):(0,t.jsx)(Z,{variant:"secondary",children:d("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,t.jsx)(p,{children:s.shardKey??""}),v!==void 0&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[m.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:d("ran")}),m.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:m.message}),(0,t.jsx)(H,{confirmLabel:d("Run now?"),disabled:m.kind==="running",onConfirm:c(()=>{W(n(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:m.kind==="running"?d("Running\u2026"):d("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"le"),pe=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","se"),fe=c(a=>{let e=(0,U.c)(34),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadJobs:d,removeJob:f,retryJob:r}=i,l=R(),o=M(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let v;e[3]!==l||e[4]!==d?(v=c(async()=>(await(d??(()=>l.listDeadJobs()))()).toSorted(be),"h"),e[3]=l,e[4]=d,e[5]=v):v=e[5];let n=E(N,v),s=n.data,[m,y]=(0,Y.useState)(void 0),k=n.error??m,x=d===void 0,C;e[6]!==l||e[7]!==x||e[8]!==r?(C=r??(x?L=>l.retryDeadJob(L):void 0),e[6]=l,e[7]=x,e[8]=r,e[9]=C):C=e[9];let b=C,j;e[10]!==l||e[11]!==x||e[12]!==f?(j=f??(x?L=>l.removeDeadJob(L):void 0),e[10]=l,e[11]=x,e[12]=f,e[13]=j):j=e[13];let I=j,q;e[14]!==n?(q=c(()=>{n.refetch()},"$"),e[14]=n,e[15]=q):q=e[15],O(q,!0);let B;e[16]!==n?(B=c(async L=>{y(void 0);try{await L,n.refetch()}catch(ne){y(G(ne))}},"I"),e[16]=n,e[17]=B):B=e[17];let J=B,S=b!==void 0||I!==void 0,$;e[18]!==k?($=k!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:k}),e[18]=k,e[19]=$):$=e[19];let w;e[20]!==s?.length||e[21]!==o?(w=s?.length===0&&(0,t.jsx)(_,{description:o("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:o("No dead-letter jobs.")}),e[20]=s?.length,e[21]=o,e[22]=w):w=e[22];let g;e[23]!==J||e[24]!==S||e[25]!==s||e[26]!==I||e[27]!==b||e[28]!==o?(g=s!==void 0&&s.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"dlq-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:o("function")}),(0,t.jsx)(u,{children:o("attempts")}),(0,t.jsx)(u,{children:o("last tried")}),(0,t.jsx)(u,{children:o("pool")}),(0,t.jsx)(u,{children:o("shard")}),(0,t.jsx)(u,{children:o("id")}),S&&(0,t.jsx)(u,{"aria-label":o("Actions")})]})}),(0,t.jsx)(z,{children:s.map(L=>(0,t.jsxs)(F,{"data-testid":`dlq-row-${L.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:L.functionPath}),(0,t.jsx)(p,{className:"tabular-nums",children:L.attempts??0}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:pe(L.scheduledFor)}),(0,t.jsx)(p,{className:"font-mono text-xs",children:L.pool??""}),(0,t.jsx)(p,{children:L.shardKey??""}),(0,t.jsx)(p,{className:"font-mono text-xs",children:L.id}),S&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[b!==void 0&&(0,t.jsx)(ee,{"data-testid":`dlq-retry-${L.id}`,onClick:c(()=>{W(J(b(L.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Retry")}),I!==void 0&&(0,t.jsx)(H,{confirmLabel:o("Drop job?"),onConfirm:c(()=>{W(J(I(L.id)))},"onConfirm"),testId:`dlq-remove-${L.id}`,children:o("Drop")})]})})]},L.id))})]})})}),e[23]=J,e[24]=S,e[25]=s,e[26]=I,e[27]=b,e[28]=o,e[29]=g):g=e[29];let D;return e[30]!==g||e[31]!==$||e[32]!==w?(D=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,w,g]}),e[30]=g,e[31]=$,e[32]=w,e[33]=D):D=e[33],D},"ne");function be(a,e){return(e.attempts??0)-(a.attempts??0)}c(be,"oe");var te=c(a=>{let e=(0,U.c)(8),{label:i,testId:d,value:f}=a,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==d||e[3]!==f?(l=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":d,children:f}),e[2]=d,e[3]=f,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o=(0,t.jsx)(A,{className:"flex-1 py-0",children:(0,t.jsxs)(T,{className:"flex flex-col gap-1 p-4",children:[r,l]})}),e[5]=r,e[6]=l,e[7]=o):o=e[7],o},"E"),ve=c(a=>{let e=(0,U.c)(25),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadStatus:d}=i,f=R(),r=M(),l=d===void 0,o;e[2]!==l?(o=["lunora-scheduler-status",l],e[2]=l,e[3]=o):o=e[3];let N;e[4]!==f||e[5]!==d?(N=c(async()=>{let j=await(d??(()=>f.schedulerStatus()))();return{...j,pools:j.pools.toSorted(xe)}},"y"),e[4]=f,e[5]=d,e[6]=N):N=e[6];let v=E(o,N),{data:n,error:s}=v,m;e[7]!==v?(m=c(()=>{v.refetch()},"d"),e[7]=v,e[8]=m):m=e[8],O(m,!0);let y;e[9]!==s?(y=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=y):y=e[10];let k;e[11]!==n||e[12]!==r?(k=n!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(te,{label:r("backlog"),testId:"pools-backlog",value:n.backlog}),(0,t.jsx)(te,{label:r("in flight"),testId:"pools-inflight",value:n.inFlight}),(0,t.jsx)(te,{label:r("pools"),testId:"pools-count",value:n.pools.length})]}),e[11]=n,e[12]=r,e[13]=k):k=e[13];let x;e[14]!==n?.pools.length||e[15]!==r?(x=n?.pools.length===0&&(0,t.jsx)(_,{description:r("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:r("No workpools.")}),e[14]=n?.pools.length,e[15]=r,e[16]=x):x=e[16];let C;e[17]!==n||e[18]!==r?(C=n!==void 0&&n.pools.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"pools-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:r("pool")}),(0,t.jsx)(u,{children:r("queued")}),(0,t.jsx)(u,{children:r("in flight")}),(0,t.jsx)(u,{children:r("max concurrency")})]})}),(0,t.jsx)(z,{children:n.pools.map(ge)})]})})}),e[17]=n,e[18]=r,e[19]=C):C=e[19];let b;return e[20]!==y||e[21]!==k||e[22]!==x||e[23]!==C?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[y,k,x,C]}),e[20]=y,e[21]=k,e[22]=x,e[23]=C,e[24]=b):b=e[24],b},"ae");function xe(a,e){return e.queued-a.queued}c(xe,"ie");function ge(a){return(0,t.jsxs)(F,{"data-testid":`pools-row-${a.name}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:a.name}),(0,t.jsx)(p,{className:"tabular-nums",children:a.queued}),(0,t.jsxs)(p,{className:"tabular-nums",children:[a.inFlight," / ",a.maxConcurrency]}),(0,t.jsx)(p,{className:"tabular-nums",children:a.maxConcurrency})]},a.name)}c(ge,"de");var Ne=["jobs","dead","pools","cron"],Ve=c(a=>{let e=(0,U.c)(41),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadCronJobs:d,scheduledCancel:f,scheduledLoad:r}=i,l=M(),[o,N]=(0,Y.useState)("jobs"),v;e[2]!==l?(v=l("Cron triggers"),e[2]=l,e[3]=v):v=e[3];let n;e[4]!==l?(n=l("Dead letter"),e[4]=l,e[5]=n):n=e[5];let s;e[6]!==l?(s=l("Scheduled jobs"),e[6]=l,e[7]=s):s=e[7];let m;e[8]!==l?(m=l("Pools"),e[8]=l,e[9]=m):m=e[9];let y;e[10]!==v||e[11]!==n||e[12]!==s||e[13]!==m?(y={cron:v,dead:n,jobs:s,pools:m},e[10]=v,e[11]=n,e[12]=s,e[13]=m,e[14]=y):y=e[14];let k=y,x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=c(w=>{N(w.currentTarget.dataset.view)},"f"),e[15]=x):x=e[15];let C=x,b;e[16]!==l?(b=l("Schedule view"),e[16]=l,e[17]=b):b=e[17];let j;e[18]!==o||e[19]!==k?(j=Ne.map(w=>(0,t.jsx)(ee,{"aria-selected":o===w,"data-testid":`schedule-view-${w}`,"data-view":w,onClick:C,role:"tab",size:"sm",type:"button",variant:o===w?"default":"outline",children:k[w]},w)),e[18]=o,e[19]=k,e[20]=j):j=e[20];let I;e[21]!==b||e[22]!==j?(I=(0,t.jsx)("div",{"aria-label":b,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:j}),e[21]=b,e[22]=j,e[23]=I):I=e[23];let q;e[24]!==f||e[25]!==r||e[26]!==o?(q=o==="jobs"&&(0,t.jsx)(de,{cancelJob:f,loadJobs:r}),e[24]=f,e[25]=r,e[26]=o,e[27]=q):q=e[27];let B;e[28]!==o?(B=o==="dead"&&(0,t.jsx)(fe,{}),e[28]=o,e[29]=B):B=e[29];let J;e[30]!==o?(J=o==="pools"&&(0,t.jsx)(ve,{}),e[30]=o,e[31]=J):J=e[31];let S;e[32]!==d||e[33]!==o?(S=o==="cron"&&(0,t.jsx)(ue,{loadCronJobs:d}),e[32]=d,e[33]=o,e[34]=S):S=e[34];let $;return e[35]!==I||e[36]!==q||e[37]!==B||e[38]!==J||e[39]!==S?($=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[I,q,B,J,S]}),e[35]=I,e[36]=q,e[37]=B,e[38]=J,e[39]=S,e[40]=$):$=e[40],$},"Ie");export{Ve as SchedulePanel};
@@ -1 +1 @@
1
- import{a as yt}from"./chunk-METRMDIQ.js";import{b as Nt}from"./chunk-6MRGARL5.js";import{a as St}from"./chunk-5JLIP2HH.js";import{a as ne}from"./chunk-MG7VPUFA.js";import{a as zt}from"./chunk-NXXGISFB.js";import{a as Ct}from"./chunk-WUW4ZHRL.js";import{P as Z}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as L}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import"./chunk-7PIHTTND.js";import{b as ue}from"./chunk-2UWKGSEA.js";import{f as re}from"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{a as ce}from"./chunk-UANVABQG.js";import{a as ft,b as pt,c as vt,d as Ze,e as se,f as me}from"./chunk-L4EZAHCD.js";import{a as ht,e as bt}from"./chunk-IYWVSMAY.js";import{d as q,h as xt,m as S,o as wt,s as kt}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as c,d as gt,e as Rt,f as $t,g as Ft}from"./chunk-R5ZTCHCE.js";var U=gt($t(),1);var j=gt(Rt(),1);var a=gt(Ft(),1);var Ot=c(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"Dt"),Et=c(t=>{let e=Ot(t),r={};for(let[d,h]of Object.entries(e)){if(!Array.isArray(h)||h.some(i=>typeof i!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);r[d]=h}return r},"Mt"),Tt=c(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"St"),X=c(t=>{let e=(0,U.c)(6),{children:r,htmlFor:d,label:h}=t,i;e[0]!==d||e[1]!==h?(i=(0,a.jsx)(zt,{htmlFor:d,children:h}),e[0]=d,e[1]=h,e[2]=i):i=e[2];let o;return e[3]!==r||e[4]!==i?(o=(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[i,r]}),e[3]=r,e[4]=i,e[5]=o):o=e[5],o},"G"),de=c(({busy:t,canSubmit:e,children:r,destructive:d=!1,error:h,onClose:i,onSubmit:o,submitLabel:l,testId:n,title:s})=>{let m=q();return(0,a.jsxs)(St,{label:s,onClose:i,panelTestId:`${n}-panel`,testId:`${n}-overlay`,variant:"dialog",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:s}),r,h!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":`${n}-error`,role:"alert",children:h}),(0,a.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,a.jsx)(L,{"data-testid":`${n}-cancel`,onClick:i,size:"sm",type:"button",variant:"outline",children:m("Cancel")}),(0,a.jsx)(L,{"data-testid":`${n}-submit`,disabled:t||!e,onClick:o,size:"sm",type:"button",variant:d?"destructive":"default",children:t?m("Saving\u2026"):l})]})]})},"ae"),Dt=c(t=>{let e=(0,U.c)(79),{mode:r,onClose:d,onDone:h,org:i}=t,o=re(),l=q(),{busy:n,error:s,run:m}=ne(),b;e[0]!==i?(b=i?S(i.name):"",e[0]=i,e[1]=b):b=e[1];let[u,g]=(0,j.useState)(b),p;e[2]!==i?(p=i?S(i.slug):"",e[2]=i,e[3]=p):p=e[3];let[f,y]=(0,j.useState)(p),k;e[4]!==i?(k=i?S(i.logo):"",e[4]=i,e[5]=k):k=e[5];let[v,I]=(0,j.useState)(k),[C,z]=(0,j.useState)(""),x;e[6]!==r||e[7]!==i?.metadata?(x=r==="edit"?Tt(i?.metadata):"",e[6]=r,e[7]=i?.metadata,e[8]=x):x=e[8];let[w,N]=(0,j.useState)(x),O;e[9]!==o||e[10]!==v||e[11]!==w||e[12]!==r||e[13]!==u||e[14]!==d||e[15]!==h||e[16]!==i?.id||e[17]!==C||e[18]!==m||e[19]!==f?(O=c(()=>{m(async()=>{let F=w.trim()===""?void 0:Ot(w);r==="create"?await o.createAuthOrganization({logo:v.trim()===""?void 0:v.trim(),metadata:F,name:u.trim(),ownerId:C.trim()===""?void 0:C.trim(),slug:f.trim()===""?void 0:f.trim()}):await o.updateAuthOrganization({logo:v.trim()===""?void 0:v.trim(),metadata:F,name:u.trim()===""?void 0:u.trim(),organizationId:S(i?.id),slug:f.trim()===""?void 0:f.trim()}),h(),d()})},"_"),e[9]=o,e[10]=v,e[11]=w,e[12]=r,e[13]=u,e[14]=d,e[15]=h,e[16]=i?.id,e[17]=C,e[18]=m,e[19]=f,e[20]=O):O=e[20];let A=O,D;e[21]!==r||e[22]!==u?(D=u.trim()!==""||r==="edit",e[21]=r,e[22]=u,e[23]=D):D=e[23];let T;e[24]!==r||e[25]!==l?(T=l(r==="create"?"Create":"Save"),e[24]=r,e[25]=l,e[26]=T):T=e[26];let M;e[27]!==r||e[28]!==l?(M=l(r==="create"?"New organization":"Edit organization"),e[27]=r,e[28]=l,e[29]=M):M=e[29];let P;e[30]!==l?(P=l("name"),e[30]=l,e[31]=P):P=e[31];let Q;e[32]===Symbol.for("react.memo_cache_sentinel")?(Q=c(F=>{g(F.target.value)},"q"),e[32]=Q):Q=e[32];let B;e[33]!==u?(B=(0,a.jsx)(Z,{"data-testid":"org-form-name",id:"org-form-name",onChange:Q,value:u}),e[33]=u,e[34]=B):B=e[34];let E;e[35]!==B||e[36]!==P?(E=(0,a.jsx)(X,{htmlFor:"org-form-name",label:P,children:B}),e[35]=B,e[36]=P,e[37]=E):E=e[37];let J;e[38]!==l?(J=l("Slug (optional \u2014 derived from name)"),e[38]=l,e[39]=J):J=e[39];let Y;e[40]===Symbol.for("react.memo_cache_sentinel")?(Y=c(F=>{y(F.target.value)},"K"),e[40]=Y):Y=e[40];let R;e[41]!==f?(R=(0,a.jsx)(Z,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:Y,value:f}),e[41]=f,e[42]=R):R=e[42];let $;e[43]!==J||e[44]!==R?($=(0,a.jsx)(X,{htmlFor:"org-form-slug",label:J,children:R}),e[43]=J,e[44]=R,e[45]=$):$=e[45];let K;e[46]!==l?(K=l("Logo URL (optional)"),e[46]=l,e[47]=K):K=e[47];let ie;e[48]===Symbol.for("react.memo_cache_sentinel")?(ie=c(F=>{I(F.target.value)},"ne"),e[48]=ie):ie=e[48];let H;e[49]!==v?(H=(0,a.jsx)(Z,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:ie,value:v}),e[49]=v,e[50]=H):H=e[50];let ee;e[51]!==K||e[52]!==H?(ee=(0,a.jsx)(X,{htmlFor:"org-form-logo",label:K,children:H}),e[51]=K,e[52]=H,e[53]=ee):ee=e[53];let W;e[54]!==r||e[55]!==C||e[56]!==l?(W=r==="create"&&(0,a.jsx)(X,{htmlFor:"org-form-owner",label:l("Owner user id (optional)"),children:(0,a.jsx)(Z,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:c(F=>{z(F.target.value)},"onChange"),value:C})}),e[54]=r,e[55]=C,e[56]=l,e[57]=W):W=e[57];let te;e[58]!==l?(te=l("Metadata (JSON, optional)"),e[58]=l,e[59]=te):te=e[59];let oe;e[60]===Symbol.for("react.memo_cache_sentinel")?(oe=c(F=>{N(F.target.value)},"le"),e[60]=oe):oe=e[60];let V;e[61]!==w?(V=(0,a.jsx)(yt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:oe,value:w}),e[61]=w,e[62]=V):V=e[62];let _;e[63]!==te||e[64]!==V?(_=(0,a.jsx)(X,{htmlFor:"org-form-metadata",label:te,children:V}),e[63]=te,e[64]=V,e[65]=_):_=e[65];let ae;return e[66]!==n||e[67]!==s||e[68]!==d||e[69]!==A||e[70]!==E||e[71]!==$||e[72]!==ee||e[73]!==W||e[74]!==_||e[75]!==D||e[76]!==T||e[77]!==M?(ae=(0,a.jsxs)(de,{busy:n,canSubmit:D,error:s,onClose:d,onSubmit:A,submitLabel:T,testId:"org-form",title:M,children:[E,$,ee,W,_]}),e[66]=n,e[67]=s,e[68]=d,e[69]=A,e[70]=E,e[71]=$,e[72]=ee,e[73]=W,e[74]=_,e[75]=D,e[76]=T,e[77]=M,e[78]=ae):ae=e[78],ae},"ht"),Lt=c(t=>{let e=(0,U.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),[m,b]=(0,j.useState)(""),[u,g]=(0,j.useState)(""),p;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==h||e[4]!==u||e[5]!==s||e[6]!==m?(p=c(()=>{s(async()=>{await i.addAuthOrgMember({organizationId:h,role:u.trim()===""?void 0:u.trim(),userId:m.trim()}),d(),r()})},"b"),e[0]=i,e[1]=r,e[2]=d,e[3]=h,e[4]=u,e[5]=s,e[6]=m,e[7]=p):p=e[7];let f=p,y;e[8]!==m?(y=m.trim(),e[8]=m,e[9]=y):y=e[9];let k=y!=="",v;e[10]!==o?(v=o("Add member"),e[10]=o,e[11]=v):v=e[11];let I;e[12]!==o?(I=o("Add member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("User id"),e[14]=o,e[15]=C):C=e[15];let z;e[16]===Symbol.for("react.memo_cache_sentinel")?(z=c(M=>{b(M.target.value)},"w"),e[16]=z):z=e[16];let x;e[17]!==m?(x=(0,a.jsx)(Z,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:z,value:m}),e[17]=m,e[18]=x):x=e[18];let w;e[19]!==C||e[20]!==x?(w=(0,a.jsx)(X,{htmlFor:"org-add-member-user",label:C,children:x}),e[19]=C,e[20]=x,e[21]=w):w=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=c(M=>{g(M.target.value)},"_"),e[24]=O):O=e[24];let A;e[25]!==u?(A=(0,a.jsx)(Z,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:O,value:u}),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,a.jsx)(X,{htmlFor:"org-add-member-role",label:N,children:A}),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==f||e[34]!==D||e[35]!==k||e[36]!==v||e[37]!==I||e[38]!==w?(T=(0,a.jsxs)(de,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:f,submitLabel:v,testId:"org-add-member",title:I,children:[w,D]}),e[30]=l,e[31]=n,e[32]=r,e[33]=f,e[34]=D,e[35]=k,e[36]=v,e[37]=I,e[38]=w,e[39]=T):T=e[39],T},"Rt"),jt=c(t=>{let e=(0,U.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),[m,b]=(0,j.useState)(""),[u,g]=(0,j.useState)(""),p;e[0]!==i||e[1]!==m||e[2]!==r||e[3]!==d||e[4]!==h||e[5]!==u||e[6]!==s?(p=c(()=>{s(async()=>{await i.inviteAuthOrgMember({email:m.trim(),organizationId:h,role:u.trim()===""?void 0:u.trim()}),d(),r()})},"b"),e[0]=i,e[1]=m,e[2]=r,e[3]=d,e[4]=h,e[5]=u,e[6]=s,e[7]=p):p=e[7];let f=p,y;e[8]!==m?(y=m.trim(),e[8]=m,e[9]=y):y=e[9];let k=y!=="",v;e[10]!==o?(v=o("Send invitation"),e[10]=o,e[11]=v):v=e[11];let I;e[12]!==o?(I=o("Invite member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("email"),e[14]=o,e[15]=C):C=e[15];let z;e[16]===Symbol.for("react.memo_cache_sentinel")?(z=c(M=>{b(M.target.value)},"w"),e[16]=z):z=e[16];let x;e[17]!==m?(x=(0,a.jsx)(Z,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:z,type:"email",value:m}),e[17]=m,e[18]=x):x=e[18];let w;e[19]!==C||e[20]!==x?(w=(0,a.jsx)(X,{htmlFor:"org-invite-member-email",label:C,children:x}),e[19]=C,e[20]=x,e[21]=w):w=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=c(M=>{g(M.target.value)},"_"),e[24]=O):O=e[24];let A;e[25]!==u?(A=(0,a.jsx)(Z,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:O,value:u}),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,a.jsx)(X,{htmlFor:"org-invite-member-role",label:N,children:A}),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==f||e[34]!==D||e[35]!==k||e[36]!==v||e[37]!==I||e[38]!==w?(T=(0,a.jsxs)(de,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:f,submitLabel:v,testId:"org-invite-member",title:I,children:[w,D]}),e[30]=l,e[31]=n,e[32]=r,e[33]=f,e[34]=D,e[35]=k,e[36]=v,e[37]=I,e[38]=w,e[39]=T):T=e[39],T},"Ft"),Pt=c(t=>{let e=(0,U.c)(32),{member:r,onClose:d,onDone:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),m;e[0]!==r.role?(m=c(()=>S(r.role),"m"),e[0]=r.role,e[1]=m):m=e[1];let[b,u]=(0,j.useState)(m),g;e[2]!==i||e[3]!==r.id||e[4]!==d||e[5]!==h||e[6]!==b||e[7]!==s?(g=c(()=>{s(async()=>{await i.setAuthOrgMemberRole({memberId:S(r.id),role:b.trim()}),h(),d()})},"f"),e[2]=i,e[3]=r.id,e[4]=d,e[5]=h,e[6]=b,e[7]=s,e[8]=g):g=e[8];let p=g,f;e[9]!==b?(f=b.trim(),e[9]=b,e[10]=f):f=e[10];let y=f!=="",k;e[11]!==o?(k=o("Save"),e[11]=o,e[12]=k):k=e[12];let v;e[13]!==o?(v=o("Change member role"),e[13]=o,e[14]=v):v=e[14];let I;e[15]!==o?(I=o("Role"),e[15]=o,e[16]=I):I=e[16];let C;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=c(N=>{u(N.target.value)},"y"),e[17]=C):C=e[17];let z;e[18]!==b?(z=(0,a.jsx)(Z,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:C,value:b}),e[18]=b,e[19]=z):z=e[19];let x;e[20]!==I||e[21]!==z?(x=(0,a.jsx)(X,{htmlFor:"org-member-role-value",label:I,children:z}),e[20]=I,e[21]=z,e[22]=x):x=e[22];let w;return e[23]!==l||e[24]!==n||e[25]!==d||e[26]!==p||e[27]!==x||e[28]!==y||e[29]!==k||e[30]!==v?(w=(0,a.jsx)(de,{busy:l,canSubmit:y,error:n,onClose:d,onSubmit:p,submitLabel:k,testId:"org-member-role",title:v,children:x}),e[23]=l,e[24]=n,e[25]=d,e[26]=p,e[27]=x,e[28]=y,e[29]=k,e[30]=v,e[31]=w):w=e[31],w},"Et"),At=c(t=>{let e=(0,U.c)(36),{mode:r,onClose:d,onDone:h,organizationId:i,team:o}=t,l=re(),n=q(),{busy:s,error:m,run:b}=ne(),u;e[0]!==o?(u=o?S(o.name):"",e[0]=o,e[1]=u):u=e[1];let[g,p]=(0,j.useState)(u),f;e[2]!==l||e[3]!==r||e[4]!==g||e[5]!==d||e[6]!==h||e[7]!==i||e[8]!==b||e[9]!==o?.id?(f=c(()=>{b(async()=>{await(r==="create"?l.createAuthOrgTeam({name:g.trim(),organizationId:i}):l.updateAuthOrgTeam({name:g.trim(),teamId:S(o?.id)})),h(),d()})},"h"),e[2]=l,e[3]=r,e[4]=g,e[5]=d,e[6]=h,e[7]=i,e[8]=b,e[9]=o?.id,e[10]=f):f=e[10];let y=f,k;e[11]!==g?(k=g.trim(),e[11]=g,e[12]=k):k=e[12];let v=k!=="",I;e[13]!==r||e[14]!==n?(I=n(r==="create"?"Create":"Save"),e[13]=r,e[14]=n,e[15]=I):I=e[15];let C;e[16]!==r||e[17]!==n?(C=n(r==="create"?"New team":"Rename team"),e[16]=r,e[17]=n,e[18]=C):C=e[18];let z;e[19]!==n?(z=n("name"),e[19]=n,e[20]=z):z=e[20];let x;e[21]===Symbol.for("react.memo_cache_sentinel")?(x=c(A=>{p(A.target.value)},"x"),e[21]=x):x=e[21];let w;e[22]!==g?(w=(0,a.jsx)(Z,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:x,value:g}),e[22]=g,e[23]=w):w=e[23];let N;e[24]!==z||e[25]!==w?(N=(0,a.jsx)(X,{htmlFor:"org-team-form-name",label:z,children:w}),e[24]=z,e[25]=w,e[26]=N):N=e[26];let O;return e[27]!==s||e[28]!==m||e[29]!==d||e[30]!==y||e[31]!==N||e[32]!==v||e[33]!==I||e[34]!==C?(O=(0,a.jsx)(de,{busy:s,canSubmit:v,error:m,onClose:d,onSubmit:y,submitLabel:I,testId:"org-team-form",title:C,children:N}),e[27]=s,e[28]=m,e[29]=d,e[30]=y,e[31]=N,e[32]=v,e[33]=I,e[34]=C,e[35]=O):O=e[35],O},"bt"),Bt=c(t=>{let e=(0,U.c)(30),{onClose:r,onDone:d,teamId:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),[m,b]=(0,j.useState)(""),u;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==s||e[4]!==h||e[5]!==m?(u=c(()=>{s(async()=>{await i.addAuthOrgTeamMember({teamId:h,userId:m.trim()}),d(),r()})},"c"),e[0]=i,e[1]=r,e[2]=d,e[3]=s,e[4]=h,e[5]=m,e[6]=u):u=e[6];let g=u,p;e[7]!==m?(p=m.trim(),e[7]=m,e[8]=p):p=e[8];let f=p!=="",y;e[9]!==o?(y=o("Add member"),e[9]=o,e[10]=y):y=e[10];let k;e[11]!==o?(k=o("Add team member"),e[11]=o,e[12]=k):k=e[12];let v;e[13]!==o?(v=o("User id"),e[13]=o,e[14]=v):v=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=c(w=>{b(w.target.value)},"C"),e[15]=I):I=e[15];let C;e[16]!==m?(C=(0,a.jsx)(Z,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:m}),e[16]=m,e[17]=C):C=e[17];let z;e[18]!==v||e[19]!==C?(z=(0,a.jsx)(X,{htmlFor:"org-team-add-member-user",label:v,children:C}),e[18]=v,e[19]=C,e[20]=z):z=e[20];let x;return e[21]!==l||e[22]!==n||e[23]!==r||e[24]!==g||e[25]!==f||e[26]!==y||e[27]!==k||e[28]!==z?(x=(0,a.jsx)(de,{busy:l,canSubmit:f,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-team-add-member",title:k,children:z}),e[21]=l,e[22]=n,e[23]=r,e[24]=g,e[25]=f,e[26]=y,e[27]=k,e[28]=z,e[29]=x):x=e[29],x},"jt"),_t=c(t=>{let e=(0,U.c)(47),{mode:r,onClose:d,onDone:h,organizationId:i,role:o}=t,l=re(),n=q(),{busy:s,error:m,run:b}=ne(),u;e[0]!==o?(u=o?S(o.role):"",e[0]=o,e[1]=u):u=e[1];let[g,p]=(0,j.useState)(u),f;e[2]!==r||e[3]!==o?.permission?(f=r==="edit"?Tt(o?.permission):"",e[2]=r,e[3]=o?.permission,e[4]=f):f=e[4];let[y,k]=(0,j.useState)(f),v;e[5]!==l||e[6]!==r||e[7]!==g||e[8]!==d||e[9]!==h||e[10]!==i||e[11]!==y||e[12]!==o?.id||e[13]!==b?(v=c(()=>{b(async()=>{let M=Et(y);await(r==="create"?l.createAuthOrgRole({organizationId:i,permission:M,role:g.trim()}):l.updateAuthOrgRole({permission:M,roleId:S(o?.id)})),h(),d()})},"p"),e[5]=l,e[6]=r,e[7]=g,e[8]=d,e[9]=h,e[10]=i,e[11]=y,e[12]=o?.id,e[13]=b,e[14]=v):v=e[14];let I=v,C;e[15]!==r||e[16]!==g||e[17]!==y?(C=y.trim()!==""&&(r==="edit"||g.trim()!==""),e[15]=r,e[16]=g,e[17]=y,e[18]=C):C=e[18];let z;e[19]!==r||e[20]!==n?(z=n(r==="create"?"Create":"Save"),e[19]=r,e[20]=n,e[21]=z):z=e[21];let x;e[22]!==r||e[23]!==n?(x=n(r==="create"?"New role":"Edit role"),e[22]=r,e[23]=n,e[24]=x):x=e[24];let w;e[25]!==r||e[26]!==g||e[27]!==n?(w=r==="create"&&(0,a.jsx)(X,{htmlFor:"org-role-form-name",label:n("Role name"),children:(0,a.jsx)(Z,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:c(M=>{p(M.target.value)},"onChange"),value:g})}),e[25]=r,e[26]=g,e[27]=n,e[28]=w):w=e[28];let N;e[29]!==n?(N=n('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=n,e[30]=N):N=e[30];let O;e[31]===Symbol.for("react.memo_cache_sentinel")?(O=c(M=>{k(M.target.value)},"_"),e[31]=O):O=e[31];let A;e[32]!==y?(A=(0,a.jsx)(yt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:O,value:y}),e[32]=y,e[33]=A):A=e[33];let D;e[34]!==A||e[35]!==N?(D=(0,a.jsx)(X,{htmlFor:"org-role-form-permission",label:N,children:A}),e[34]=A,e[35]=N,e[36]=D):D=e[36];let T;return e[37]!==s||e[38]!==m||e[39]!==d||e[40]!==I||e[41]!==D||e[42]!==C||e[43]!==z||e[44]!==x||e[45]!==w?(T=(0,a.jsxs)(de,{busy:s,canSubmit:C,error:m,onClose:d,onSubmit:I,submitLabel:z,testId:"org-role-form",title:x,children:[w,D]}),e[37]=s,e[38]=m,e[39]=d,e[40]=I,e[41]=D,e[42]=C,e[43]=z,e[44]=x,e[45]=w,e[46]=T):T=e[46],T},"pt"),Mt=c(t=>{let e=(0,U.c)(18),{action:r,message:d,onClose:h,onDone:i,testId:o,title:l}=t,n=q(),{busy:s,error:m,run:b}=ne(),u;e[0]!==r||e[1]!==h||e[2]!==i||e[3]!==b?(u=c(()=>{b(async()=>{await r(),i(),h()})},"c"),e[0]=r,e[1]=h,e[2]=i,e[3]=b,e[4]=u):u=e[4];let g=u,p;e[5]!==n?(p=n("Delete"),e[5]=n,e[6]=p):p=e[6];let f;e[7]!==d?(f=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:d}),e[7]=d,e[8]=f):f=e[8];let y;return e[9]!==s||e[10]!==m||e[11]!==h||e[12]!==g||e[13]!==p||e[14]!==f||e[15]!==o||e[16]!==l?(y=(0,a.jsx)(de,{busy:s,canSubmit:!0,destructive:!0,error:m,onClose:h,onSubmit:g,submitLabel:p,testId:o,title:l,children:f}),e[9]=s,e[10]=m,e[11]=h,e[12]=g,e[13]=p,e[14]=f,e[15]=o,e[16]=l,e[17]=y):y=e[17],y},"zt"),Ge=c(t=>{let e=(0,U.c)(13),{action:r,children:d,heading:h,testId:i}=t,o;e[0]!==h?(o=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[0]=h,e[1]=o):o=e[1];let l;e[2]!==r?(l=r!==void 0&&(0,a.jsx)("div",{className:"flex items-center gap-2",children:r}),e[2]=r,e[3]=l):l=e[3];let n;e[4]!==o||e[5]!==l?(n=(0,a.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o,l]}),e[4]=o,e[5]=l,e[6]=n):n=e[6];let s;e[7]!==d?(s=(0,a.jsx)(bt,{className:"px-0",children:d}),e[7]=d,e[8]=s):s=e[8];let m;return e[9]!==n||e[10]!==s||e[11]!==i?(m=(0,a.jsxs)(ht,{className:"overflow-hidden py-0","data-testid":i,children:[n,s]}),e[9]=n,e[10]=s,e[11]=i,e[12]=m):m=e[12],m},"Ve"),He=c(t=>{let e=(0,U.c)(23),{columns:r,rowActions:d,rowPrefix:h,rows:i}=t,o=q(),l;e[0]!==r?(l=r.map(Jt),e[0]=r,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("Actions"),e[2]=o,e[3]=n):n=e[3];let s;e[4]!==n?(s=(0,a.jsx)(se,{"aria-label":n}),e[4]=n,e[5]=s):s=e[5];let m;e[6]!==l||e[7]!==s?(m=(0,a.jsx)(pt,{children:(0,a.jsxs)(Ze,{children:[l,s]})}),e[6]=l,e[7]=s,e[8]=m):m=e[8];let b;if(e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i){let p;e[14]!==r||e[15]!==d||e[16]!==h?(p=c((f,y)=>{let k=S(f.id),v=k===""?`index-${y.toString()}`:k;return(0,a.jsxs)(Ze,{"data-testid":`${h}-${v}`,children:[r.map(I=>(0,a.jsx)(me,{className:I.className,children:I.render(f)},I.head)),(0,a.jsx)(me,{children:(0,a.jsx)("div",{className:"flex justify-end gap-1",children:d(f)})})]},v)},"b"),e[14]=r,e[15]=d,e[16]=h,e[17]=p):p=e[17],b=i.map(p),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=b}else b=e[13];let u;e[18]!==b?(u=(0,a.jsx)(vt,{children:b}),e[18]=b,e[19]=u):u=e[19];let g;return e[20]!==m||e[21]!==u?(g=(0,a.jsxs)(ft,{children:[m,u]}),e[20]=m,e[21]=u,e[22]=g):g=e[22],g},"We");function Jt(t){return(0,a.jsx)(se,{children:t.head},t.head)}c(Jt,"Lt");var Ut=c(t=>{let e=(0,U.c)(30),{actionBusy:r,onRemoveMember:d,memberColumns:h,members:i,onDialog:o}=t,l=q(),n;e[0]!==o?(n=c(()=>{o({kind:"add-member"})},"r"),e[0]=o,e[1]=n):n=e[1];let s;e[2]!==l?(s=l("Add member"),e[2]=l,e[3]=s):s=e[3];let m;e[4]!==n||e[5]!==s?(m=(0,a.jsx)(L,{"data-testid":"org-open-add-member",onClick:n,size:"xs",type:"button",variant:"outline",children:s}),e[4]=n,e[5]=s,e[6]=m):m=e[6];let b;e[7]!==o?(b=c(()=>{o({kind:"invite-member"})},"g"),e[7]=o,e[8]=b):b=e[8];let u;e[9]!==l?(u=l("Invite member"),e[9]=l,e[10]=u):u=e[10];let g;e[11]!==b||e[12]!==u?(g=(0,a.jsx)(L,{"data-testid":"org-open-invite-member",onClick:b,size:"xs",type:"button",variant:"outline",children:u}),e[11]=b,e[12]=u,e[13]=g):g=e[13];let p;e[14]!==m||e[15]!==g?(p=(0,a.jsxs)(a.Fragment,{children:[m,g]}),e[14]=m,e[15]=g,e[16]=p):p=e[16];let f;e[17]!==l?(f=l("Members"),e[17]=l,e[18]=f):f=e[18];let y;e[19]!==r||e[20]!==h||e[21]!==i||e[22]!==o||e[23]!==d||e[24]!==l?(y=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-members-empty",title:l("No members.")})}):(0,a.jsx)(He,{columns:h,rowActions:c(v=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{"data-testid":`org-member-role-${S(v.id)}`,onClick:c(()=>{o({kind:"member-role",member:v})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Change role")}),(0,a.jsx)(L,{"data-testid":`org-remove-member-${S(v.id)}`,disabled:r,onClick:c(()=>{d(S(v.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Remove")})]}),"rowActions"),rowPrefix:"org-member",rows:i}),e[19]=r,e[20]=h,e[21]=i,e[22]=o,e[23]=d,e[24]=l,e[25]=y):y=e[25];let k;return e[26]!==p||e[27]!==f||e[28]!==y?(k=(0,a.jsx)(Ge,{action:p,heading:f,testId:"org-members",children:y}),e[26]=p,e[27]=f,e[28]=y,e[29]=k):k=e[29],k},"Pt"),qt=c(t=>{let e=(0,U.c)(21),{onConfirmDeleteTeam:r,onDialog:d,onSelectTeam:h,selectedTeam:i,teamColumns:o,teams:l}=t,n=q(),s;e[0]!==d?(s=c(()=>{d({kind:"team-create"})},"a"),e[0]=d,e[1]=s):s=e[1];let m;e[2]!==n?(m=n("New team"),e[2]=n,e[3]=m):m=e[3];let b;e[4]!==s||e[5]!==m?(b=(0,a.jsx)(L,{"data-testid":"org-open-create-team",onClick:s,size:"xs",type:"button",variant:"outline",children:m}),e[4]=s,e[5]=m,e[6]=b):b=e[6];let u;e[7]!==n?(u=n("Teams"),e[7]=n,e[8]=u):u=e[8];let g;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==n||e[14]!==o||e[15]!==l?(g=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-teams-empty",title:n("No teams.")})}):(0,a.jsx)(He,{columns:o,rowActions:c(f=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{"aria-pressed":i===S(f.id),"data-testid":`org-team-select-${S(f.id)}`,onClick:c(()=>{h(S(f.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Members")}),(0,a.jsx)(L,{"data-testid":`org-team-rename-${S(f.id)}`,onClick:c(()=>{d({kind:"team-rename",team:f})},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Rename")}),(0,a.jsx)(L,{"data-testid":`org-team-delete-${S(f.id)}`,onClick:c(()=>{r(f)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})]}),"rowActions"),rowPrefix:"org-team",rows:l}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=n,e[14]=o,e[15]=l,e[16]=g):g=e[16];let p;return e[17]!==b||e[18]!==u||e[19]!==g?(p=(0,a.jsx)(Ge,{action:b,heading:u,testId:"org-teams",children:g}),e[17]=b,e[18]=u,e[19]=g,e[20]=p):p=e[20],p},"Bt"),Kt=c(t=>{let e=(0,U.c)(20),{actionBusy:r,onRemoveTeamMember:d,onDialog:h,selectedTeam:i,teamMemberColumns:o,teamMembers:l}=t,n=q(),s;e[0]!==h||e[1]!==i?(s=c(()=>{h({kind:"team-add-member",teamId:i})},"a"),e[0]=h,e[1]=i,e[2]=s):s=e[2];let m;e[3]!==n?(m=n("Add member"),e[3]=n,e[4]=m):m=e[4];let b;e[5]!==s||e[6]!==m?(b=(0,a.jsx)(L,{"data-testid":"org-open-add-team-member",onClick:s,size:"xs",type:"button",variant:"outline",children:m}),e[5]=s,e[6]=m,e[7]=b):b=e[7];let u;e[8]!==n?(u=n("Team members"),e[8]=n,e[9]=u):u=e[9];let g;e[10]!==r||e[11]!==d||e[12]!==n||e[13]!==o||e[14]!==l?(g=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-team-members-empty",title:n("No team members.")})}):(0,a.jsx)(He,{columns:o,rowActions:c(f=>(0,a.jsx)(L,{"data-testid":`org-team-remove-member-${S(f.id)}`,disabled:r,onClick:c(()=>{d(S(f.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Remove")}),"rowActions"),rowPrefix:"org-team-member",rows:l}),e[10]=r,e[11]=d,e[12]=n,e[13]=o,e[14]=l,e[15]=g):g=e[15];let p;return e[16]!==b||e[17]!==u||e[18]!==g?(p=(0,a.jsx)(Ge,{action:b,heading:u,testId:"org-team-members",children:g}),e[16]=b,e[17]=u,e[18]=g,e[19]=p):p=e[19],p},"Qt"),Qt=c(t=>{let e=(0,U.c)(19),{onConfirmDeleteRole:r,onDialog:d,roleColumns:h,roles:i}=t,o=q(),l;e[0]!==d?(l=c(()=>{d({kind:"role-create"})},"o"),e[0]=d,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("New role"),e[2]=o,e[3]=n):n=e[3];let s;e[4]!==l||e[5]!==n?(s=(0,a.jsx)(L,{"data-testid":"org-open-create-role",onClick:l,size:"xs",type:"button",variant:"outline",children:n}),e[4]=l,e[5]=n,e[6]=s):s=e[6];let m;e[7]!==o?(m=o("Roles"),e[7]=o,e[8]=m):m=e[8];let b;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==o?(b=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-roles-empty",title:o("No custom roles.")})}):(0,a.jsx)(He,{columns:h,rowActions:c(g=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{"data-testid":`org-role-edit-${S(g.id)}`,onClick:c(()=>{d({kind:"role-edit",role:g})},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Edit")}),(0,a.jsx)(L,{"data-testid":`org-role-delete-${S(g.id)}`,onClick:c(()=>{r(S(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Delete")})]}),"rowActions"),rowPrefix:"org-role",rows:i}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=o,e[14]=b):b=e[14];let u;return e[15]!==s||e[16]!==m||e[17]!==b?(u=(0,a.jsx)(Ge,{action:s,heading:m,testId:"org-roles",children:b}),e[15]=s,e[16]=m,e[17]=b,e[18]=u):u=e[18],u},"Jt"),Xt=c(t=>{let e=(0,U.c)(199),{organizationId:r,rolesEnabled:d,teamsEnabled:h}=t,i=re(),o=q(),[l,n]=(0,j.useState)(null),[s,m]=(0,j.useState)(null),[b,u]=(0,j.useState)(!1),[g,p]=(0,j.useState)(null),f;e[0]!==r?(f=["lunora-auth-org-members",r],e[0]=r,e[1]=f):f=e[1];let y;e[2]!==i||e[3]!==r?(y=c(()=>i.listAuthOrgMembers({limit:200,organizationId:r}),"v"),e[2]=i,e[3]=r,e[4]=y):y=e[4];let k=ue(f,y),v;e[5]!==r?(v=["lunora-auth-org-invitations",r],e[5]=r,e[6]=v):v=e[6];let I;e[7]!==i||e[8]!==r?(I=c(()=>i.listAuthOrgInvitations({limit:200,organizationId:r}),"C"),e[7]=i,e[8]=r,e[9]=I):I=e[9];let C=ue(v,I),z;e[10]!==r?(z=["lunora-auth-org-teams",r],e[10]=r,e[11]=z):z=e[11];let x;e[12]!==i||e[13]!==r?(x=c(()=>i.listAuthOrgTeams({limit:200,organizationId:r}),"x"),e[12]=i,e[13]=r,e[14]=x):x=e[14];let w;e[15]!==h?(w={enabled:h},e[15]=h,e[16]=w):w=e[16];let N=ue(z,x,w),O;e[17]!==r?(O=["lunora-auth-org-roles",r],e[17]=r,e[18]=O):O=e[18];let A;e[19]!==i||e[20]!==r?(A=c(()=>i.listAuthOrgRoles({limit:200,organizationId:r}),"N"),e[19]=i,e[20]=r,e[21]=A):A=e[21];let D;e[22]!==d?(D={enabled:d},e[22]=d,e[23]=D):D=e[23];let T=ue(O,A,D),M;e[24]!==s?(M=["lunora-auth-org-team-members",s],e[24]=s,e[25]=M):M=e[25];let P;e[26]!==i||e[27]!==s?(P=c(()=>i.listAuthOrgTeamMembers({limit:200,teamId:s??""}),"P"),e[26]=i,e[27]=s,e[28]=P):P=e[28];let Q=s!==null,B;e[29]!==Q?(B={enabled:Q},e[29]=Q,e[30]=B):B=e[30];let E=ue(M,P,B),J;e[31]!==k.data?.rows?(J=k.data?.rows??[],e[31]=k.data?.rows,e[32]=J):J=e[32];let Y=J,R;e[33]!==C.data?.rows?(R=C.data?.rows??[],e[33]=C.data?.rows,e[34]=R):R=e[34];let $=R,K;e[35]!==N.data?.rows?(K=N.data?.rows??[],e[35]=N.data?.rows,e[36]=K):K=e[36];let ie=K,H;e[37]!==T.data?.rows?(H=T.data?.rows??[],e[37]=T.data?.rows,e[38]=H):H=e[38];let ee=H,W;e[39]!==s||e[40]!==E?(W=s===null?[]:E.data?.rows??[],e[39]=s,e[40]=E,e[41]=W):W=e[41];let te=W,oe=k.error??C.error??N.error??T.error??E.error,V;e[42]!==C||e[43]!==k||e[44]!==d||e[45]!==T||e[46]!==s||e[47]!==E||e[48]!==h||e[49]!==N?(V=c(()=>{k.refetch(),C.refetch(),h&&N.refetch(),d&&T.refetch(),s!==null&&E.refetch()},"Z"),e[42]=C,e[43]=k,e[44]=d,e[45]=T,e[46]=s,e[47]=E,e[48]=h,e[49]=N,e[50]=V):V=e[50];let _=V;Ct(_,!0);let ae;e[51]===Symbol.for("react.memo_cache_sentinel")?(ae=c(()=>{n(null)},"ie"),e[51]=ae):ae=e[51];let F=ae,We;e[52]!==_?(We=c(G=>{wt((async()=>{u(!0),p(null);try{await G(),_(),u(!1)}catch(nt){p(xt(nt)),u(!1)}})())},"Xe"),e[52]=_,e[53]=We):We=e[53];let le=We,Ve;e[54]!==i||e[55]!==o?(Ve=c(G=>{let nt=S(G.id);n({action:c(async()=>{await i.removeAuthOrgTeam({teamId:nt}),m(It=>It===nt?null:It)},"action"),kind:"confirm",message:o("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:o("Delete team")})},"Ye"),e[54]=i,e[55]=o,e[56]=Ve):Ve=e[56];let it=Ve,ge;e[57]!==o?(ge=o("userId"),e[57]=o,e[58]=ge):ge=e[58];let he;e[59]!==ge?(he={head:ge,render:Yt},e[59]=ge,e[60]=he):he=e[60];let be;e[61]!==o?(be=o("role"),e[61]=o,e[62]=be):be=e[62];let fe;e[63]!==be?(fe={head:be,render:Zt},e[63]=be,e[64]=fe):fe=e[64];let et;e[65]!==he||e[66]!==fe?(et=[he,fe],e[65]=he,e[66]=fe,e[67]=et):et=e[67];let st=et,pe;e[68]!==o?(pe=o("email"),e[68]=o,e[69]=pe):pe=e[69];let ve;e[70]!==pe?(ve={head:pe,render:Gt},e[70]=pe,e[71]=ve):ve=e[71];let ye;e[72]!==o?(ye=o("role"),e[72]=o,e[73]=ye):ye=e[73];let Ce;e[74]!==ye?(Ce={head:ye,render:Ht},e[74]=ye,e[75]=Ce):Ce=e[75];let Ie;e[76]!==o?(Ie=o("status"),e[76]=o,e[77]=Ie):Ie=e[77];let xe;e[78]!==Ie?(xe={head:Ie,render:Wt},e[78]=Ie,e[79]=xe):xe=e[79];let tt;e[80]!==ve||e[81]!==Ce||e[82]!==xe?(tt=[ve,Ce,xe],e[80]=ve,e[81]=Ce,e[82]=xe,e[83]=tt):tt=e[83];let mt=tt,we;e[84]!==o?(we=o("id"),e[84]=o,e[85]=we):we=e[85];let ke;e[86]!==we?(ke={className:"font-mono text-xs",head:we,render:Vt},e[86]=we,e[87]=ke):ke=e[87];let ze;e[88]!==o?(ze=o("name"),e[88]=o,e[89]=ze):ze=e[89];let Ne;e[90]!==ze?(Ne={head:ze,render:er},e[90]=ze,e[91]=Ne):Ne=e[91];let rt;e[92]!==ke||e[93]!==Ne?(rt=[ke,Ne],e[92]=ke,e[93]=Ne,e[94]=rt):rt=e[94];let dt=rt,Se;e[95]!==o?(Se=o("userId"),e[95]=o,e[96]=Se):Se=e[96];let ot;e[97]!==Se?(ot=[{head:Se,render:tr}],e[97]=Se,e[98]=ot):ot=e[98];let ct=ot,De;e[99]!==o?(De=o("role"),e[99]=o,e[100]=De):De=e[100];let Ae;e[101]!==De?(Ae={head:De,render:rr},e[101]=De,e[102]=Ae):Ae=e[102];let _e;e[103]!==o?(_e=o("Permission"),e[103]=o,e[104]=_e):_e=e[104];let Oe;e[105]!==_e?(Oe={className:"font-mono text-xs whitespace-pre-wrap",head:_e,render:or},e[105]=_e,e[106]=Oe):Oe=e[106];let at;e[107]!==Ae||e[108]!==Oe?(at=[Ae,Oe],e[107]=Ae,e[108]=Oe,e[109]=at):at=e[109];let ut=at,Te;e[110]!==oe?(Te=oe!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:oe}),e[110]=oe,e[111]=Te):Te=e[111];let Me;e[112]!==g?(Me=g!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:g}),e[112]=g,e[113]=Me):Me=e[113];let Re;e[114]!==i||e[115]!==le?(Re=c(G=>{le(()=>i.removeAuthOrgMember({memberId:G}))},"Te"),e[114]=i,e[115]=le,e[116]=Re):Re=e[116];let $e;e[117]!==b||e[118]!==st||e[119]!==Y||e[120]!==Re?($e=(0,a.jsx)(Ut,{actionBusy:b,memberColumns:st,members:Y,onDialog:n,onRemoveMember:Re}),e[117]=b,e[118]=st,e[119]=Y,e[120]=Re,e[121]=$e):$e=e[121];let Fe;e[122]!==b||e[123]!==i||e[124]!==mt||e[125]!==$||e[126]!==le||e[127]!==o?(Fe=$.length>0&&(0,a.jsx)(Ge,{heading:o("Invitations"),testId:"org-invitations",children:(0,a.jsx)(He,{columns:mt,rowActions:c(G=>(0,a.jsx)(L,{"data-testid":`org-cancel-invitation-${S(G.id)}`,disabled:b,onClick:c(()=>{le(()=>i.cancelAuthOrgInvitation({invitationId:S(G.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Cancel")}),"rowActions"),rowPrefix:"org-invitation",rows:$})}),e[122]=b,e[123]=i,e[124]=mt,e[125]=$,e[126]=le,e[127]=o,e[128]=Fe):Fe=e[128];let Ee;e[129]!==it||e[130]!==s||e[131]!==dt||e[132]!==ie||e[133]!==h?(Ee=h&&(0,a.jsx)(qt,{onConfirmDeleteTeam:it,onDialog:n,onSelectTeam:m,selectedTeam:s,teamColumns:dt,teams:ie}),e[129]=it,e[130]=s,e[131]=dt,e[132]=ie,e[133]=h,e[134]=Ee):Ee=e[134];let Le;e[135]!==b||e[136]!==i||e[137]!==le||e[138]!==s||e[139]!==ct||e[140]!==te||e[141]!==h?(Le=h&&s!==null&&(0,a.jsx)(Kt,{actionBusy:b,onDialog:n,onRemoveTeamMember:c(G=>{le(()=>i.removeAuthOrgTeamMember({teamMemberId:G}))},"onRemoveTeamMember"),selectedTeam:s,teamMemberColumns:ct,teamMembers:te}),e[135]=b,e[136]=i,e[137]=le,e[138]=s,e[139]=ct,e[140]=te,e[141]=h,e[142]=Le):Le=e[142];let je;e[143]!==i||e[144]!==ut||e[145]!==ee||e[146]!==d||e[147]!==o?(je=d&&(0,a.jsx)(Qt,{onConfirmDeleteRole:c(G=>{n({action:c(()=>i.deleteAuthOrgRole({roleId:G}),"action"),kind:"confirm",message:o("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:o("Delete role")})},"onConfirmDeleteRole"),onDialog:n,roleColumns:ut,roles:ee}),e[143]=i,e[144]=ut,e[145]=ee,e[146]=d,e[147]=o,e[148]=je):je=e[148];let Pe;e[149]!==l?.kind||e[150]!==r||e[151]!==_?(Pe=l?.kind==="add-member"&&(0,a.jsx)(Lt,{onClose:F,onDone:_,organizationId:r}),e[149]=l?.kind,e[150]=r,e[151]=_,e[152]=Pe):Pe=e[152];let Be;e[153]!==l?.kind||e[154]!==r||e[155]!==_?(Be=l?.kind==="invite-member"&&(0,a.jsx)(jt,{onClose:F,onDone:_,organizationId:r}),e[153]=l?.kind,e[154]=r,e[155]=_,e[156]=Be):Be=e[156];let Je;e[157]!==l||e[158]!==_?(Je=l?.kind==="member-role"&&(0,a.jsx)(Pt,{member:l.member,onClose:F,onDone:_}),e[157]=l,e[158]=_,e[159]=Je):Je=e[159];let Ue;e[160]!==l?.kind||e[161]!==r||e[162]!==_?(Ue=l?.kind==="team-create"&&(0,a.jsx)(At,{mode:"create",onClose:F,onDone:_,organizationId:r}),e[160]=l?.kind,e[161]=r,e[162]=_,e[163]=Ue):Ue=e[163];let qe;e[164]!==l||e[165]!==r||e[166]!==_?(qe=l?.kind==="team-rename"&&(0,a.jsx)(At,{mode:"edit",onClose:F,onDone:_,organizationId:r,team:l.team}),e[164]=l,e[165]=r,e[166]=_,e[167]=qe):qe=e[167];let Ke;e[168]!==l||e[169]!==_?(Ke=l?.kind==="team-add-member"&&(0,a.jsx)(Bt,{onClose:F,onDone:_,teamId:l.teamId}),e[168]=l,e[169]=_,e[170]=Ke):Ke=e[170];let Qe;e[171]!==l?.kind||e[172]!==r||e[173]!==_?(Qe=l?.kind==="role-create"&&(0,a.jsx)(_t,{mode:"create",onClose:F,onDone:_,organizationId:r}),e[171]=l?.kind,e[172]=r,e[173]=_,e[174]=Qe):Qe=e[174];let Xe;e[175]!==l||e[176]!==r||e[177]!==_?(Xe=l?.kind==="role-edit"&&(0,a.jsx)(_t,{mode:"edit",onClose:F,onDone:_,organizationId:r,role:l.role}),e[175]=l,e[176]=r,e[177]=_,e[178]=Xe):Xe=e[178];let Ye;e[179]!==l||e[180]!==_?(Ye=l?.kind==="confirm"&&(0,a.jsx)(Mt,{action:l.action,message:l.message,onClose:F,onDone:_,testId:l.testId,title:l.title}),e[179]=l,e[180]=_,e[181]=Ye):Ye=e[181];let lt;return e[182]!==Te||e[183]!==Me||e[184]!==$e||e[185]!==Fe||e[186]!==Ee||e[187]!==Le||e[188]!==je||e[189]!==Pe||e[190]!==Be||e[191]!==Je||e[192]!==Ue||e[193]!==qe||e[194]!==Ke||e[195]!==Qe||e[196]!==Xe||e[197]!==Ye?(lt=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[Te,Me,$e,Fe,Ee,Le,je,Pe,Be,Je,Ue,qe,Ke,Qe,Xe,Ye]}),e[182]=Te,e[183]=Me,e[184]=$e,e[185]=Fe,e[186]=Ee,e[187]=Le,e[188]=je,e[189]=Pe,e[190]=Be,e[191]=Je,e[192]=Ue,e[193]=qe,e[194]=Ke,e[195]=Qe,e[196]=Xe,e[197]=Ye,e[198]=lt):lt=e[198],lt},"Ut");function Yt(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:S(t.userId)})}c(Yt,"Ht");function Zt(t){return S(t.role)}c(Zt,"qt");function Gt(t){return S(t.email)}c(Gt,"Gt");function Ht(t){return S(t.role)}c(Ht,"Kt");function Wt(t){return S(t.status)}c(Wt,"Vt");function Vt(t){return S(t.id)}c(Vt,"Wt");function er(t){return S(t.name)}c(er,"Xt");function tr(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:S(t.userId)})}c(tr,"Yt");function rr(t){return S(t.role)}c(rr,"Zt");function or(t){return S(t.permission)}c(or,"el");var yr=c(()=>{let t=(0,U.c)(62),e=re(),r=q(),{config:d,ready:h}=Nt(),i=d.capabilities.organization,[o,l]=(0,j.useState)(null),[n,s]=(0,j.useState)(null),m;t[0]===Symbol.for("react.memo_cache_sentinel")?(m=["lunora-auth-orgs"],t[0]=m):m=t[0];let b;t[1]!==e?(b=c(()=>e.listAuthOrganizations({limit:100}),"g"),t[1]=e,t[2]=b):b=t[2];let u;t[3]!==i?(u={enabled:i},t[3]=i,t[4]=u):u=t[4];let g=ue(m,b,u),p=g.data?.rows??null,f;t[5]!==g?(f=c(()=>{g.refetch()},"h"),t[5]=g,t[6]=f):f=t[6],Ct(f,i);let y;t[7]===Symbol.for("react.memo_cache_sentinel")?(y=c(()=>{s(null)},"v"),t[7]=y):y=t[7];let k=y,v;t[8]!==g?(v=c(()=>{g.refetch()},"p"),t[8]=g,t[9]=v):v=t[9];let I=v,C;t[10]===Symbol.for("react.memo_cache_sentinel")?(C=c(R=>{l(R)},"y"),t[10]=C):C=t[10];let z=C;if(h&&!i){let R;t[11]!==r?(R=r("Enable the organization() plugin in your auth config to manage organizations here."),t[11]=r,t[12]=R):R=t[12];let $;t[13]!==r?($=r("Organizations are not enabled."),t[13]=r,t[14]=$):$=t[14];let K;return t[15]!==R||t[16]!==$?(K=(0,a.jsx)(ce,{description:R,testId:"org-disabled",title:$}),t[15]=R,t[16]=$,t[17]=K):K=t[17],K}let x;t[18]!==r?(x=r("Organizations"),t[18]=r,t[19]=x):x=t[19];let w;t[20]!==x?(w=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:x}),t[20]=x,t[21]=w):w=t[21];let N;t[22]===Symbol.for("react.memo_cache_sentinel")?(N=c(()=>{s({kind:"create"})},"D"),t[22]=N):N=t[22];let O;t[23]!==r?(O=r("New organization"),t[23]=r,t[24]=O):O=t[24];let A;t[25]!==O?(A=(0,a.jsx)(L,{"data-testid":"org-new",onClick:N,size:"sm",type:"button",children:O}),t[25]=O,t[26]=A):A=t[26];let D;t[27]!==A||t[28]!==w?(D=(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[w,A]}),t[27]=A,t[28]=w,t[29]=D):D=t[29];let T;t[30]!==g.error?(T=g.error!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error}),t[30]=g.error,t[31]=T):T=t[31];let M;t[32]!==p||t[33]!==r?(M=p!==null&&p.length===0&&(0,a.jsx)(ce,{testId:"org-empty",title:r("No organizations.")}),t[32]=p,t[33]=r,t[34]=M):M=t[34];let P;t[35]!==p||t[36]!==o||t[37]!==r?(P=p!==null&&p.length>0&&(0,a.jsx)(ht,{className:"overflow-hidden py-0",children:(0,a.jsx)(bt,{className:"px-0",children:(0,a.jsxs)(ft,{"data-testid":"org-table",children:[(0,a.jsx)(pt,{children:(0,a.jsxs)(Ze,{children:[(0,a.jsx)(se,{children:r("id")}),(0,a.jsx)(se,{children:r("name")}),(0,a.jsx)(se,{children:r("slug")}),(0,a.jsx)(se,{children:r("created")}),(0,a.jsx)(se,{"aria-label":r("Actions")})]})}),(0,a.jsx)(vt,{children:p.map(R=>{let $=S(R.id);return(0,a.jsxs)(Ze,{"data-testid":`org-row-${$}`,children:[(0,a.jsx)(me,{className:"font-mono text-xs",children:$}),(0,a.jsx)(me,{children:S(R.name)}),(0,a.jsx)(me,{children:S(R.slug)}),(0,a.jsx)(me,{className:"text-muted-foreground tabular-nums",children:kt(R.createdAt)}),(0,a.jsx)(me,{children:(0,a.jsxs)("div",{className:"flex justify-end gap-1",children:[(0,a.jsx)(L,{"aria-pressed":o===$,"data-testid":`org-select-${$}`,onClick:c(()=>{z($)},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Manage")}),(0,a.jsx)(L,{"data-testid":`org-edit-${$}`,onClick:c(()=>{s({kind:"edit",org:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Edit")}),(0,a.jsx)(L,{"data-testid":`org-delete-${$}`,onClick:c(()=>{s({kind:"delete",org:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Delete")})]})})]},$)})})]})})}),t[35]=p,t[36]=o,t[37]=r,t[38]=P):P=t[38];let Q;t[39]!==d.organization||t[40]!==o?(Q=o!==null&&(0,a.jsx)(Xt,{organizationId:o,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams}),t[39]=d.organization,t[40]=o,t[41]=Q):Q=t[41];let B;t[42]!==n?.kind||t[43]!==I?(B=n?.kind==="create"&&(0,a.jsx)(Dt,{mode:"create",onClose:k,onDone:I}),t[42]=n?.kind,t[43]=I,t[44]=B):B=t[44];let E;t[45]!==n||t[46]!==I?(E=n?.kind==="edit"&&(0,a.jsx)(Dt,{mode:"edit",onClose:k,onDone:I,org:n.org}),t[45]=n,t[46]=I,t[47]=E):E=t[47];let J;t[48]!==e||t[49]!==n||t[50]!==I||t[51]!==r?(J=n?.kind==="delete"&&(0,a.jsx)(Mt,{action:c(async()=>{let R=S(n.org.id);await e.deleteAuthOrganization({organizationId:R}),l($=>$===R?null:$)},"action"),message:r("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:k,onDone:I,testId:"org-delete",title:r("Delete organization")}),t[48]=e,t[49]=n,t[50]=I,t[51]=r,t[52]=J):J=t[52];let Y;return t[53]!==D||t[54]!==T||t[55]!==M||t[56]!==P||t[57]!==Q||t[58]!==B||t[59]!==E||t[60]!==J?(Y=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[D,T,M,P,Q,B,E,J]}),t[53]=D,t[54]=T,t[55]=M,t[56]=P,t[57]=Q,t[58]=B,t[59]=E,t[60]=J,t[61]=Y):Y=t[61],Y},"yl");export{yr as default};
1
+ import{a as yt}from"./chunk-METRMDIQ.js";import{b as Nt}from"./chunk-PRWFHSHC.js";import{a as St}from"./chunk-5JLIP2HH.js";import{a as ne}from"./chunk-MG7VPUFA.js";import{a as zt}from"./chunk-NXXGISFB.js";import{a as Ct}from"./chunk-WUW4ZHRL.js";import{P as Z}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as L}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import"./chunk-7PIHTTND.js";import{b as ue}from"./chunk-L6ATKZKO.js";import{f as re}from"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import{a as ce}from"./chunk-UANVABQG.js";import{a as ft,b as pt,c as vt,d as Ze,e as se,f as me}from"./chunk-L4EZAHCD.js";import{a as ht,e as bt}from"./chunk-IYWVSMAY.js";import{d as q,h as xt,m as S,o as wt,s as kt}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as c,d as gt,e as Rt,f as $t,g as Ft}from"./chunk-R5ZTCHCE.js";var U=gt($t(),1);var j=gt(Rt(),1);var a=gt(Ft(),1);var Ot=c(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"Dt"),Et=c(t=>{let e=Ot(t),r={};for(let[d,h]of Object.entries(e)){if(!Array.isArray(h)||h.some(i=>typeof i!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);r[d]=h}return r},"Mt"),Tt=c(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"St"),X=c(t=>{let e=(0,U.c)(6),{children:r,htmlFor:d,label:h}=t,i;e[0]!==d||e[1]!==h?(i=(0,a.jsx)(zt,{htmlFor:d,children:h}),e[0]=d,e[1]=h,e[2]=i):i=e[2];let o;return e[3]!==r||e[4]!==i?(o=(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[i,r]}),e[3]=r,e[4]=i,e[5]=o):o=e[5],o},"G"),de=c(({busy:t,canSubmit:e,children:r,destructive:d=!1,error:h,onClose:i,onSubmit:o,submitLabel:l,testId:n,title:s})=>{let m=q();return(0,a.jsxs)(St,{label:s,onClose:i,panelTestId:`${n}-panel`,testId:`${n}-overlay`,variant:"dialog",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:s}),r,h!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":`${n}-error`,role:"alert",children:h}),(0,a.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,a.jsx)(L,{"data-testid":`${n}-cancel`,onClick:i,size:"sm",type:"button",variant:"outline",children:m("Cancel")}),(0,a.jsx)(L,{"data-testid":`${n}-submit`,disabled:t||!e,onClick:o,size:"sm",type:"button",variant:d?"destructive":"default",children:t?m("Saving\u2026"):l})]})]})},"ae"),Dt=c(t=>{let e=(0,U.c)(79),{mode:r,onClose:d,onDone:h,org:i}=t,o=re(),l=q(),{busy:n,error:s,run:m}=ne(),b;e[0]!==i?(b=i?S(i.name):"",e[0]=i,e[1]=b):b=e[1];let[u,g]=(0,j.useState)(b),p;e[2]!==i?(p=i?S(i.slug):"",e[2]=i,e[3]=p):p=e[3];let[f,y]=(0,j.useState)(p),k;e[4]!==i?(k=i?S(i.logo):"",e[4]=i,e[5]=k):k=e[5];let[v,I]=(0,j.useState)(k),[C,z]=(0,j.useState)(""),x;e[6]!==r||e[7]!==i?.metadata?(x=r==="edit"?Tt(i?.metadata):"",e[6]=r,e[7]=i?.metadata,e[8]=x):x=e[8];let[w,N]=(0,j.useState)(x),O;e[9]!==o||e[10]!==v||e[11]!==w||e[12]!==r||e[13]!==u||e[14]!==d||e[15]!==h||e[16]!==i?.id||e[17]!==C||e[18]!==m||e[19]!==f?(O=c(()=>{m(async()=>{let F=w.trim()===""?void 0:Ot(w);r==="create"?await o.createAuthOrganization({logo:v.trim()===""?void 0:v.trim(),metadata:F,name:u.trim(),ownerId:C.trim()===""?void 0:C.trim(),slug:f.trim()===""?void 0:f.trim()}):await o.updateAuthOrganization({logo:v.trim()===""?void 0:v.trim(),metadata:F,name:u.trim()===""?void 0:u.trim(),organizationId:S(i?.id),slug:f.trim()===""?void 0:f.trim()}),h(),d()})},"_"),e[9]=o,e[10]=v,e[11]=w,e[12]=r,e[13]=u,e[14]=d,e[15]=h,e[16]=i?.id,e[17]=C,e[18]=m,e[19]=f,e[20]=O):O=e[20];let A=O,D;e[21]!==r||e[22]!==u?(D=u.trim()!==""||r==="edit",e[21]=r,e[22]=u,e[23]=D):D=e[23];let T;e[24]!==r||e[25]!==l?(T=l(r==="create"?"Create":"Save"),e[24]=r,e[25]=l,e[26]=T):T=e[26];let M;e[27]!==r||e[28]!==l?(M=l(r==="create"?"New organization":"Edit organization"),e[27]=r,e[28]=l,e[29]=M):M=e[29];let P;e[30]!==l?(P=l("name"),e[30]=l,e[31]=P):P=e[31];let Q;e[32]===Symbol.for("react.memo_cache_sentinel")?(Q=c(F=>{g(F.target.value)},"q"),e[32]=Q):Q=e[32];let B;e[33]!==u?(B=(0,a.jsx)(Z,{"data-testid":"org-form-name",id:"org-form-name",onChange:Q,value:u}),e[33]=u,e[34]=B):B=e[34];let E;e[35]!==B||e[36]!==P?(E=(0,a.jsx)(X,{htmlFor:"org-form-name",label:P,children:B}),e[35]=B,e[36]=P,e[37]=E):E=e[37];let J;e[38]!==l?(J=l("Slug (optional \u2014 derived from name)"),e[38]=l,e[39]=J):J=e[39];let Y;e[40]===Symbol.for("react.memo_cache_sentinel")?(Y=c(F=>{y(F.target.value)},"K"),e[40]=Y):Y=e[40];let R;e[41]!==f?(R=(0,a.jsx)(Z,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:Y,value:f}),e[41]=f,e[42]=R):R=e[42];let $;e[43]!==J||e[44]!==R?($=(0,a.jsx)(X,{htmlFor:"org-form-slug",label:J,children:R}),e[43]=J,e[44]=R,e[45]=$):$=e[45];let K;e[46]!==l?(K=l("Logo URL (optional)"),e[46]=l,e[47]=K):K=e[47];let ie;e[48]===Symbol.for("react.memo_cache_sentinel")?(ie=c(F=>{I(F.target.value)},"ne"),e[48]=ie):ie=e[48];let H;e[49]!==v?(H=(0,a.jsx)(Z,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:ie,value:v}),e[49]=v,e[50]=H):H=e[50];let ee;e[51]!==K||e[52]!==H?(ee=(0,a.jsx)(X,{htmlFor:"org-form-logo",label:K,children:H}),e[51]=K,e[52]=H,e[53]=ee):ee=e[53];let W;e[54]!==r||e[55]!==C||e[56]!==l?(W=r==="create"&&(0,a.jsx)(X,{htmlFor:"org-form-owner",label:l("Owner user id (optional)"),children:(0,a.jsx)(Z,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:c(F=>{z(F.target.value)},"onChange"),value:C})}),e[54]=r,e[55]=C,e[56]=l,e[57]=W):W=e[57];let te;e[58]!==l?(te=l("Metadata (JSON, optional)"),e[58]=l,e[59]=te):te=e[59];let oe;e[60]===Symbol.for("react.memo_cache_sentinel")?(oe=c(F=>{N(F.target.value)},"le"),e[60]=oe):oe=e[60];let V;e[61]!==w?(V=(0,a.jsx)(yt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:oe,value:w}),e[61]=w,e[62]=V):V=e[62];let _;e[63]!==te||e[64]!==V?(_=(0,a.jsx)(X,{htmlFor:"org-form-metadata",label:te,children:V}),e[63]=te,e[64]=V,e[65]=_):_=e[65];let ae;return e[66]!==n||e[67]!==s||e[68]!==d||e[69]!==A||e[70]!==E||e[71]!==$||e[72]!==ee||e[73]!==W||e[74]!==_||e[75]!==D||e[76]!==T||e[77]!==M?(ae=(0,a.jsxs)(de,{busy:n,canSubmit:D,error:s,onClose:d,onSubmit:A,submitLabel:T,testId:"org-form",title:M,children:[E,$,ee,W,_]}),e[66]=n,e[67]=s,e[68]=d,e[69]=A,e[70]=E,e[71]=$,e[72]=ee,e[73]=W,e[74]=_,e[75]=D,e[76]=T,e[77]=M,e[78]=ae):ae=e[78],ae},"ht"),Lt=c(t=>{let e=(0,U.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),[m,b]=(0,j.useState)(""),[u,g]=(0,j.useState)(""),p;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==h||e[4]!==u||e[5]!==s||e[6]!==m?(p=c(()=>{s(async()=>{await i.addAuthOrgMember({organizationId:h,role:u.trim()===""?void 0:u.trim(),userId:m.trim()}),d(),r()})},"b"),e[0]=i,e[1]=r,e[2]=d,e[3]=h,e[4]=u,e[5]=s,e[6]=m,e[7]=p):p=e[7];let f=p,y;e[8]!==m?(y=m.trim(),e[8]=m,e[9]=y):y=e[9];let k=y!=="",v;e[10]!==o?(v=o("Add member"),e[10]=o,e[11]=v):v=e[11];let I;e[12]!==o?(I=o("Add member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("User id"),e[14]=o,e[15]=C):C=e[15];let z;e[16]===Symbol.for("react.memo_cache_sentinel")?(z=c(M=>{b(M.target.value)},"w"),e[16]=z):z=e[16];let x;e[17]!==m?(x=(0,a.jsx)(Z,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:z,value:m}),e[17]=m,e[18]=x):x=e[18];let w;e[19]!==C||e[20]!==x?(w=(0,a.jsx)(X,{htmlFor:"org-add-member-user",label:C,children:x}),e[19]=C,e[20]=x,e[21]=w):w=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=c(M=>{g(M.target.value)},"_"),e[24]=O):O=e[24];let A;e[25]!==u?(A=(0,a.jsx)(Z,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:O,value:u}),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,a.jsx)(X,{htmlFor:"org-add-member-role",label:N,children:A}),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==f||e[34]!==D||e[35]!==k||e[36]!==v||e[37]!==I||e[38]!==w?(T=(0,a.jsxs)(de,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:f,submitLabel:v,testId:"org-add-member",title:I,children:[w,D]}),e[30]=l,e[31]=n,e[32]=r,e[33]=f,e[34]=D,e[35]=k,e[36]=v,e[37]=I,e[38]=w,e[39]=T):T=e[39],T},"Rt"),jt=c(t=>{let e=(0,U.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),[m,b]=(0,j.useState)(""),[u,g]=(0,j.useState)(""),p;e[0]!==i||e[1]!==m||e[2]!==r||e[3]!==d||e[4]!==h||e[5]!==u||e[6]!==s?(p=c(()=>{s(async()=>{await i.inviteAuthOrgMember({email:m.trim(),organizationId:h,role:u.trim()===""?void 0:u.trim()}),d(),r()})},"b"),e[0]=i,e[1]=m,e[2]=r,e[3]=d,e[4]=h,e[5]=u,e[6]=s,e[7]=p):p=e[7];let f=p,y;e[8]!==m?(y=m.trim(),e[8]=m,e[9]=y):y=e[9];let k=y!=="",v;e[10]!==o?(v=o("Send invitation"),e[10]=o,e[11]=v):v=e[11];let I;e[12]!==o?(I=o("Invite member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("email"),e[14]=o,e[15]=C):C=e[15];let z;e[16]===Symbol.for("react.memo_cache_sentinel")?(z=c(M=>{b(M.target.value)},"w"),e[16]=z):z=e[16];let x;e[17]!==m?(x=(0,a.jsx)(Z,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:z,type:"email",value:m}),e[17]=m,e[18]=x):x=e[18];let w;e[19]!==C||e[20]!==x?(w=(0,a.jsx)(X,{htmlFor:"org-invite-member-email",label:C,children:x}),e[19]=C,e[20]=x,e[21]=w):w=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=c(M=>{g(M.target.value)},"_"),e[24]=O):O=e[24];let A;e[25]!==u?(A=(0,a.jsx)(Z,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:O,value:u}),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,a.jsx)(X,{htmlFor:"org-invite-member-role",label:N,children:A}),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==f||e[34]!==D||e[35]!==k||e[36]!==v||e[37]!==I||e[38]!==w?(T=(0,a.jsxs)(de,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:f,submitLabel:v,testId:"org-invite-member",title:I,children:[w,D]}),e[30]=l,e[31]=n,e[32]=r,e[33]=f,e[34]=D,e[35]=k,e[36]=v,e[37]=I,e[38]=w,e[39]=T):T=e[39],T},"Ft"),Pt=c(t=>{let e=(0,U.c)(32),{member:r,onClose:d,onDone:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),m;e[0]!==r.role?(m=c(()=>S(r.role),"m"),e[0]=r.role,e[1]=m):m=e[1];let[b,u]=(0,j.useState)(m),g;e[2]!==i||e[3]!==r.id||e[4]!==d||e[5]!==h||e[6]!==b||e[7]!==s?(g=c(()=>{s(async()=>{await i.setAuthOrgMemberRole({memberId:S(r.id),role:b.trim()}),h(),d()})},"f"),e[2]=i,e[3]=r.id,e[4]=d,e[5]=h,e[6]=b,e[7]=s,e[8]=g):g=e[8];let p=g,f;e[9]!==b?(f=b.trim(),e[9]=b,e[10]=f):f=e[10];let y=f!=="",k;e[11]!==o?(k=o("Save"),e[11]=o,e[12]=k):k=e[12];let v;e[13]!==o?(v=o("Change member role"),e[13]=o,e[14]=v):v=e[14];let I;e[15]!==o?(I=o("Role"),e[15]=o,e[16]=I):I=e[16];let C;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=c(N=>{u(N.target.value)},"y"),e[17]=C):C=e[17];let z;e[18]!==b?(z=(0,a.jsx)(Z,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:C,value:b}),e[18]=b,e[19]=z):z=e[19];let x;e[20]!==I||e[21]!==z?(x=(0,a.jsx)(X,{htmlFor:"org-member-role-value",label:I,children:z}),e[20]=I,e[21]=z,e[22]=x):x=e[22];let w;return e[23]!==l||e[24]!==n||e[25]!==d||e[26]!==p||e[27]!==x||e[28]!==y||e[29]!==k||e[30]!==v?(w=(0,a.jsx)(de,{busy:l,canSubmit:y,error:n,onClose:d,onSubmit:p,submitLabel:k,testId:"org-member-role",title:v,children:x}),e[23]=l,e[24]=n,e[25]=d,e[26]=p,e[27]=x,e[28]=y,e[29]=k,e[30]=v,e[31]=w):w=e[31],w},"Et"),At=c(t=>{let e=(0,U.c)(36),{mode:r,onClose:d,onDone:h,organizationId:i,team:o}=t,l=re(),n=q(),{busy:s,error:m,run:b}=ne(),u;e[0]!==o?(u=o?S(o.name):"",e[0]=o,e[1]=u):u=e[1];let[g,p]=(0,j.useState)(u),f;e[2]!==l||e[3]!==r||e[4]!==g||e[5]!==d||e[6]!==h||e[7]!==i||e[8]!==b||e[9]!==o?.id?(f=c(()=>{b(async()=>{await(r==="create"?l.createAuthOrgTeam({name:g.trim(),organizationId:i}):l.updateAuthOrgTeam({name:g.trim(),teamId:S(o?.id)})),h(),d()})},"h"),e[2]=l,e[3]=r,e[4]=g,e[5]=d,e[6]=h,e[7]=i,e[8]=b,e[9]=o?.id,e[10]=f):f=e[10];let y=f,k;e[11]!==g?(k=g.trim(),e[11]=g,e[12]=k):k=e[12];let v=k!=="",I;e[13]!==r||e[14]!==n?(I=n(r==="create"?"Create":"Save"),e[13]=r,e[14]=n,e[15]=I):I=e[15];let C;e[16]!==r||e[17]!==n?(C=n(r==="create"?"New team":"Rename team"),e[16]=r,e[17]=n,e[18]=C):C=e[18];let z;e[19]!==n?(z=n("name"),e[19]=n,e[20]=z):z=e[20];let x;e[21]===Symbol.for("react.memo_cache_sentinel")?(x=c(A=>{p(A.target.value)},"x"),e[21]=x):x=e[21];let w;e[22]!==g?(w=(0,a.jsx)(Z,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:x,value:g}),e[22]=g,e[23]=w):w=e[23];let N;e[24]!==z||e[25]!==w?(N=(0,a.jsx)(X,{htmlFor:"org-team-form-name",label:z,children:w}),e[24]=z,e[25]=w,e[26]=N):N=e[26];let O;return e[27]!==s||e[28]!==m||e[29]!==d||e[30]!==y||e[31]!==N||e[32]!==v||e[33]!==I||e[34]!==C?(O=(0,a.jsx)(de,{busy:s,canSubmit:v,error:m,onClose:d,onSubmit:y,submitLabel:I,testId:"org-team-form",title:C,children:N}),e[27]=s,e[28]=m,e[29]=d,e[30]=y,e[31]=N,e[32]=v,e[33]=I,e[34]=C,e[35]=O):O=e[35],O},"bt"),Bt=c(t=>{let e=(0,U.c)(30),{onClose:r,onDone:d,teamId:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),[m,b]=(0,j.useState)(""),u;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==s||e[4]!==h||e[5]!==m?(u=c(()=>{s(async()=>{await i.addAuthOrgTeamMember({teamId:h,userId:m.trim()}),d(),r()})},"c"),e[0]=i,e[1]=r,e[2]=d,e[3]=s,e[4]=h,e[5]=m,e[6]=u):u=e[6];let g=u,p;e[7]!==m?(p=m.trim(),e[7]=m,e[8]=p):p=e[8];let f=p!=="",y;e[9]!==o?(y=o("Add member"),e[9]=o,e[10]=y):y=e[10];let k;e[11]!==o?(k=o("Add team member"),e[11]=o,e[12]=k):k=e[12];let v;e[13]!==o?(v=o("User id"),e[13]=o,e[14]=v):v=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=c(w=>{b(w.target.value)},"C"),e[15]=I):I=e[15];let C;e[16]!==m?(C=(0,a.jsx)(Z,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:m}),e[16]=m,e[17]=C):C=e[17];let z;e[18]!==v||e[19]!==C?(z=(0,a.jsx)(X,{htmlFor:"org-team-add-member-user",label:v,children:C}),e[18]=v,e[19]=C,e[20]=z):z=e[20];let x;return e[21]!==l||e[22]!==n||e[23]!==r||e[24]!==g||e[25]!==f||e[26]!==y||e[27]!==k||e[28]!==z?(x=(0,a.jsx)(de,{busy:l,canSubmit:f,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-team-add-member",title:k,children:z}),e[21]=l,e[22]=n,e[23]=r,e[24]=g,e[25]=f,e[26]=y,e[27]=k,e[28]=z,e[29]=x):x=e[29],x},"jt"),_t=c(t=>{let e=(0,U.c)(47),{mode:r,onClose:d,onDone:h,organizationId:i,role:o}=t,l=re(),n=q(),{busy:s,error:m,run:b}=ne(),u;e[0]!==o?(u=o?S(o.role):"",e[0]=o,e[1]=u):u=e[1];let[g,p]=(0,j.useState)(u),f;e[2]!==r||e[3]!==o?.permission?(f=r==="edit"?Tt(o?.permission):"",e[2]=r,e[3]=o?.permission,e[4]=f):f=e[4];let[y,k]=(0,j.useState)(f),v;e[5]!==l||e[6]!==r||e[7]!==g||e[8]!==d||e[9]!==h||e[10]!==i||e[11]!==y||e[12]!==o?.id||e[13]!==b?(v=c(()=>{b(async()=>{let M=Et(y);await(r==="create"?l.createAuthOrgRole({organizationId:i,permission:M,role:g.trim()}):l.updateAuthOrgRole({permission:M,roleId:S(o?.id)})),h(),d()})},"p"),e[5]=l,e[6]=r,e[7]=g,e[8]=d,e[9]=h,e[10]=i,e[11]=y,e[12]=o?.id,e[13]=b,e[14]=v):v=e[14];let I=v,C;e[15]!==r||e[16]!==g||e[17]!==y?(C=y.trim()!==""&&(r==="edit"||g.trim()!==""),e[15]=r,e[16]=g,e[17]=y,e[18]=C):C=e[18];let z;e[19]!==r||e[20]!==n?(z=n(r==="create"?"Create":"Save"),e[19]=r,e[20]=n,e[21]=z):z=e[21];let x;e[22]!==r||e[23]!==n?(x=n(r==="create"?"New role":"Edit role"),e[22]=r,e[23]=n,e[24]=x):x=e[24];let w;e[25]!==r||e[26]!==g||e[27]!==n?(w=r==="create"&&(0,a.jsx)(X,{htmlFor:"org-role-form-name",label:n("Role name"),children:(0,a.jsx)(Z,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:c(M=>{p(M.target.value)},"onChange"),value:g})}),e[25]=r,e[26]=g,e[27]=n,e[28]=w):w=e[28];let N;e[29]!==n?(N=n('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=n,e[30]=N):N=e[30];let O;e[31]===Symbol.for("react.memo_cache_sentinel")?(O=c(M=>{k(M.target.value)},"_"),e[31]=O):O=e[31];let A;e[32]!==y?(A=(0,a.jsx)(yt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:O,value:y}),e[32]=y,e[33]=A):A=e[33];let D;e[34]!==A||e[35]!==N?(D=(0,a.jsx)(X,{htmlFor:"org-role-form-permission",label:N,children:A}),e[34]=A,e[35]=N,e[36]=D):D=e[36];let T;return e[37]!==s||e[38]!==m||e[39]!==d||e[40]!==I||e[41]!==D||e[42]!==C||e[43]!==z||e[44]!==x||e[45]!==w?(T=(0,a.jsxs)(de,{busy:s,canSubmit:C,error:m,onClose:d,onSubmit:I,submitLabel:z,testId:"org-role-form",title:x,children:[w,D]}),e[37]=s,e[38]=m,e[39]=d,e[40]=I,e[41]=D,e[42]=C,e[43]=z,e[44]=x,e[45]=w,e[46]=T):T=e[46],T},"pt"),Mt=c(t=>{let e=(0,U.c)(18),{action:r,message:d,onClose:h,onDone:i,testId:o,title:l}=t,n=q(),{busy:s,error:m,run:b}=ne(),u;e[0]!==r||e[1]!==h||e[2]!==i||e[3]!==b?(u=c(()=>{b(async()=>{await r(),i(),h()})},"c"),e[0]=r,e[1]=h,e[2]=i,e[3]=b,e[4]=u):u=e[4];let g=u,p;e[5]!==n?(p=n("Delete"),e[5]=n,e[6]=p):p=e[6];let f;e[7]!==d?(f=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:d}),e[7]=d,e[8]=f):f=e[8];let y;return e[9]!==s||e[10]!==m||e[11]!==h||e[12]!==g||e[13]!==p||e[14]!==f||e[15]!==o||e[16]!==l?(y=(0,a.jsx)(de,{busy:s,canSubmit:!0,destructive:!0,error:m,onClose:h,onSubmit:g,submitLabel:p,testId:o,title:l,children:f}),e[9]=s,e[10]=m,e[11]=h,e[12]=g,e[13]=p,e[14]=f,e[15]=o,e[16]=l,e[17]=y):y=e[17],y},"zt"),Ge=c(t=>{let e=(0,U.c)(13),{action:r,children:d,heading:h,testId:i}=t,o;e[0]!==h?(o=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[0]=h,e[1]=o):o=e[1];let l;e[2]!==r?(l=r!==void 0&&(0,a.jsx)("div",{className:"flex items-center gap-2",children:r}),e[2]=r,e[3]=l):l=e[3];let n;e[4]!==o||e[5]!==l?(n=(0,a.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o,l]}),e[4]=o,e[5]=l,e[6]=n):n=e[6];let s;e[7]!==d?(s=(0,a.jsx)(bt,{className:"px-0",children:d}),e[7]=d,e[8]=s):s=e[8];let m;return e[9]!==n||e[10]!==s||e[11]!==i?(m=(0,a.jsxs)(ht,{className:"overflow-hidden py-0","data-testid":i,children:[n,s]}),e[9]=n,e[10]=s,e[11]=i,e[12]=m):m=e[12],m},"Ve"),He=c(t=>{let e=(0,U.c)(23),{columns:r,rowActions:d,rowPrefix:h,rows:i}=t,o=q(),l;e[0]!==r?(l=r.map(Jt),e[0]=r,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("Actions"),e[2]=o,e[3]=n):n=e[3];let s;e[4]!==n?(s=(0,a.jsx)(se,{"aria-label":n}),e[4]=n,e[5]=s):s=e[5];let m;e[6]!==l||e[7]!==s?(m=(0,a.jsx)(pt,{children:(0,a.jsxs)(Ze,{children:[l,s]})}),e[6]=l,e[7]=s,e[8]=m):m=e[8];let b;if(e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i){let p;e[14]!==r||e[15]!==d||e[16]!==h?(p=c((f,y)=>{let k=S(f.id),v=k===""?`index-${y.toString()}`:k;return(0,a.jsxs)(Ze,{"data-testid":`${h}-${v}`,children:[r.map(I=>(0,a.jsx)(me,{className:I.className,children:I.render(f)},I.head)),(0,a.jsx)(me,{children:(0,a.jsx)("div",{className:"flex justify-end gap-1",children:d(f)})})]},v)},"b"),e[14]=r,e[15]=d,e[16]=h,e[17]=p):p=e[17],b=i.map(p),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=b}else b=e[13];let u;e[18]!==b?(u=(0,a.jsx)(vt,{children:b}),e[18]=b,e[19]=u):u=e[19];let g;return e[20]!==m||e[21]!==u?(g=(0,a.jsxs)(ft,{children:[m,u]}),e[20]=m,e[21]=u,e[22]=g):g=e[22],g},"We");function Jt(t){return(0,a.jsx)(se,{children:t.head},t.head)}c(Jt,"Lt");var Ut=c(t=>{let e=(0,U.c)(30),{actionBusy:r,onRemoveMember:d,memberColumns:h,members:i,onDialog:o}=t,l=q(),n;e[0]!==o?(n=c(()=>{o({kind:"add-member"})},"r"),e[0]=o,e[1]=n):n=e[1];let s;e[2]!==l?(s=l("Add member"),e[2]=l,e[3]=s):s=e[3];let m;e[4]!==n||e[5]!==s?(m=(0,a.jsx)(L,{"data-testid":"org-open-add-member",onClick:n,size:"xs",type:"button",variant:"outline",children:s}),e[4]=n,e[5]=s,e[6]=m):m=e[6];let b;e[7]!==o?(b=c(()=>{o({kind:"invite-member"})},"g"),e[7]=o,e[8]=b):b=e[8];let u;e[9]!==l?(u=l("Invite member"),e[9]=l,e[10]=u):u=e[10];let g;e[11]!==b||e[12]!==u?(g=(0,a.jsx)(L,{"data-testid":"org-open-invite-member",onClick:b,size:"xs",type:"button",variant:"outline",children:u}),e[11]=b,e[12]=u,e[13]=g):g=e[13];let p;e[14]!==m||e[15]!==g?(p=(0,a.jsxs)(a.Fragment,{children:[m,g]}),e[14]=m,e[15]=g,e[16]=p):p=e[16];let f;e[17]!==l?(f=l("Members"),e[17]=l,e[18]=f):f=e[18];let y;e[19]!==r||e[20]!==h||e[21]!==i||e[22]!==o||e[23]!==d||e[24]!==l?(y=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-members-empty",title:l("No members.")})}):(0,a.jsx)(He,{columns:h,rowActions:c(v=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{"data-testid":`org-member-role-${S(v.id)}`,onClick:c(()=>{o({kind:"member-role",member:v})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Change role")}),(0,a.jsx)(L,{"data-testid":`org-remove-member-${S(v.id)}`,disabled:r,onClick:c(()=>{d(S(v.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Remove")})]}),"rowActions"),rowPrefix:"org-member",rows:i}),e[19]=r,e[20]=h,e[21]=i,e[22]=o,e[23]=d,e[24]=l,e[25]=y):y=e[25];let k;return e[26]!==p||e[27]!==f||e[28]!==y?(k=(0,a.jsx)(Ge,{action:p,heading:f,testId:"org-members",children:y}),e[26]=p,e[27]=f,e[28]=y,e[29]=k):k=e[29],k},"Pt"),qt=c(t=>{let e=(0,U.c)(21),{onConfirmDeleteTeam:r,onDialog:d,onSelectTeam:h,selectedTeam:i,teamColumns:o,teams:l}=t,n=q(),s;e[0]!==d?(s=c(()=>{d({kind:"team-create"})},"a"),e[0]=d,e[1]=s):s=e[1];let m;e[2]!==n?(m=n("New team"),e[2]=n,e[3]=m):m=e[3];let b;e[4]!==s||e[5]!==m?(b=(0,a.jsx)(L,{"data-testid":"org-open-create-team",onClick:s,size:"xs",type:"button",variant:"outline",children:m}),e[4]=s,e[5]=m,e[6]=b):b=e[6];let u;e[7]!==n?(u=n("Teams"),e[7]=n,e[8]=u):u=e[8];let g;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==n||e[14]!==o||e[15]!==l?(g=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-teams-empty",title:n("No teams.")})}):(0,a.jsx)(He,{columns:o,rowActions:c(f=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{"aria-pressed":i===S(f.id),"data-testid":`org-team-select-${S(f.id)}`,onClick:c(()=>{h(S(f.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Members")}),(0,a.jsx)(L,{"data-testid":`org-team-rename-${S(f.id)}`,onClick:c(()=>{d({kind:"team-rename",team:f})},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Rename")}),(0,a.jsx)(L,{"data-testid":`org-team-delete-${S(f.id)}`,onClick:c(()=>{r(f)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})]}),"rowActions"),rowPrefix:"org-team",rows:l}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=n,e[14]=o,e[15]=l,e[16]=g):g=e[16];let p;return e[17]!==b||e[18]!==u||e[19]!==g?(p=(0,a.jsx)(Ge,{action:b,heading:u,testId:"org-teams",children:g}),e[17]=b,e[18]=u,e[19]=g,e[20]=p):p=e[20],p},"Bt"),Kt=c(t=>{let e=(0,U.c)(20),{actionBusy:r,onRemoveTeamMember:d,onDialog:h,selectedTeam:i,teamMemberColumns:o,teamMembers:l}=t,n=q(),s;e[0]!==h||e[1]!==i?(s=c(()=>{h({kind:"team-add-member",teamId:i})},"a"),e[0]=h,e[1]=i,e[2]=s):s=e[2];let m;e[3]!==n?(m=n("Add member"),e[3]=n,e[4]=m):m=e[4];let b;e[5]!==s||e[6]!==m?(b=(0,a.jsx)(L,{"data-testid":"org-open-add-team-member",onClick:s,size:"xs",type:"button",variant:"outline",children:m}),e[5]=s,e[6]=m,e[7]=b):b=e[7];let u;e[8]!==n?(u=n("Team members"),e[8]=n,e[9]=u):u=e[9];let g;e[10]!==r||e[11]!==d||e[12]!==n||e[13]!==o||e[14]!==l?(g=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-team-members-empty",title:n("No team members.")})}):(0,a.jsx)(He,{columns:o,rowActions:c(f=>(0,a.jsx)(L,{"data-testid":`org-team-remove-member-${S(f.id)}`,disabled:r,onClick:c(()=>{d(S(f.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Remove")}),"rowActions"),rowPrefix:"org-team-member",rows:l}),e[10]=r,e[11]=d,e[12]=n,e[13]=o,e[14]=l,e[15]=g):g=e[15];let p;return e[16]!==b||e[17]!==u||e[18]!==g?(p=(0,a.jsx)(Ge,{action:b,heading:u,testId:"org-team-members",children:g}),e[16]=b,e[17]=u,e[18]=g,e[19]=p):p=e[19],p},"Qt"),Qt=c(t=>{let e=(0,U.c)(19),{onConfirmDeleteRole:r,onDialog:d,roleColumns:h,roles:i}=t,o=q(),l;e[0]!==d?(l=c(()=>{d({kind:"role-create"})},"o"),e[0]=d,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("New role"),e[2]=o,e[3]=n):n=e[3];let s;e[4]!==l||e[5]!==n?(s=(0,a.jsx)(L,{"data-testid":"org-open-create-role",onClick:l,size:"xs",type:"button",variant:"outline",children:n}),e[4]=l,e[5]=n,e[6]=s):s=e[6];let m;e[7]!==o?(m=o("Roles"),e[7]=o,e[8]=m):m=e[8];let b;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==o?(b=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-roles-empty",title:o("No custom roles.")})}):(0,a.jsx)(He,{columns:h,rowActions:c(g=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{"data-testid":`org-role-edit-${S(g.id)}`,onClick:c(()=>{d({kind:"role-edit",role:g})},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Edit")}),(0,a.jsx)(L,{"data-testid":`org-role-delete-${S(g.id)}`,onClick:c(()=>{r(S(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Delete")})]}),"rowActions"),rowPrefix:"org-role",rows:i}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=o,e[14]=b):b=e[14];let u;return e[15]!==s||e[16]!==m||e[17]!==b?(u=(0,a.jsx)(Ge,{action:s,heading:m,testId:"org-roles",children:b}),e[15]=s,e[16]=m,e[17]=b,e[18]=u):u=e[18],u},"Jt"),Xt=c(t=>{let e=(0,U.c)(199),{organizationId:r,rolesEnabled:d,teamsEnabled:h}=t,i=re(),o=q(),[l,n]=(0,j.useState)(null),[s,m]=(0,j.useState)(null),[b,u]=(0,j.useState)(!1),[g,p]=(0,j.useState)(null),f;e[0]!==r?(f=["lunora-auth-org-members",r],e[0]=r,e[1]=f):f=e[1];let y;e[2]!==i||e[3]!==r?(y=c(()=>i.listAuthOrgMembers({limit:200,organizationId:r}),"v"),e[2]=i,e[3]=r,e[4]=y):y=e[4];let k=ue(f,y),v;e[5]!==r?(v=["lunora-auth-org-invitations",r],e[5]=r,e[6]=v):v=e[6];let I;e[7]!==i||e[8]!==r?(I=c(()=>i.listAuthOrgInvitations({limit:200,organizationId:r}),"C"),e[7]=i,e[8]=r,e[9]=I):I=e[9];let C=ue(v,I),z;e[10]!==r?(z=["lunora-auth-org-teams",r],e[10]=r,e[11]=z):z=e[11];let x;e[12]!==i||e[13]!==r?(x=c(()=>i.listAuthOrgTeams({limit:200,organizationId:r}),"x"),e[12]=i,e[13]=r,e[14]=x):x=e[14];let w;e[15]!==h?(w={enabled:h},e[15]=h,e[16]=w):w=e[16];let N=ue(z,x,w),O;e[17]!==r?(O=["lunora-auth-org-roles",r],e[17]=r,e[18]=O):O=e[18];let A;e[19]!==i||e[20]!==r?(A=c(()=>i.listAuthOrgRoles({limit:200,organizationId:r}),"N"),e[19]=i,e[20]=r,e[21]=A):A=e[21];let D;e[22]!==d?(D={enabled:d},e[22]=d,e[23]=D):D=e[23];let T=ue(O,A,D),M;e[24]!==s?(M=["lunora-auth-org-team-members",s],e[24]=s,e[25]=M):M=e[25];let P;e[26]!==i||e[27]!==s?(P=c(()=>i.listAuthOrgTeamMembers({limit:200,teamId:s??""}),"P"),e[26]=i,e[27]=s,e[28]=P):P=e[28];let Q=s!==null,B;e[29]!==Q?(B={enabled:Q},e[29]=Q,e[30]=B):B=e[30];let E=ue(M,P,B),J;e[31]!==k.data?.rows?(J=k.data?.rows??[],e[31]=k.data?.rows,e[32]=J):J=e[32];let Y=J,R;e[33]!==C.data?.rows?(R=C.data?.rows??[],e[33]=C.data?.rows,e[34]=R):R=e[34];let $=R,K;e[35]!==N.data?.rows?(K=N.data?.rows??[],e[35]=N.data?.rows,e[36]=K):K=e[36];let ie=K,H;e[37]!==T.data?.rows?(H=T.data?.rows??[],e[37]=T.data?.rows,e[38]=H):H=e[38];let ee=H,W;e[39]!==s||e[40]!==E?(W=s===null?[]:E.data?.rows??[],e[39]=s,e[40]=E,e[41]=W):W=e[41];let te=W,oe=k.error??C.error??N.error??T.error??E.error,V;e[42]!==C||e[43]!==k||e[44]!==d||e[45]!==T||e[46]!==s||e[47]!==E||e[48]!==h||e[49]!==N?(V=c(()=>{k.refetch(),C.refetch(),h&&N.refetch(),d&&T.refetch(),s!==null&&E.refetch()},"Z"),e[42]=C,e[43]=k,e[44]=d,e[45]=T,e[46]=s,e[47]=E,e[48]=h,e[49]=N,e[50]=V):V=e[50];let _=V;Ct(_,!0);let ae;e[51]===Symbol.for("react.memo_cache_sentinel")?(ae=c(()=>{n(null)},"ie"),e[51]=ae):ae=e[51];let F=ae,We;e[52]!==_?(We=c(G=>{wt((async()=>{u(!0),p(null);try{await G(),_(),u(!1)}catch(nt){p(xt(nt)),u(!1)}})())},"Xe"),e[52]=_,e[53]=We):We=e[53];let le=We,Ve;e[54]!==i||e[55]!==o?(Ve=c(G=>{let nt=S(G.id);n({action:c(async()=>{await i.removeAuthOrgTeam({teamId:nt}),m(It=>It===nt?null:It)},"action"),kind:"confirm",message:o("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:o("Delete team")})},"Ye"),e[54]=i,e[55]=o,e[56]=Ve):Ve=e[56];let it=Ve,ge;e[57]!==o?(ge=o("userId"),e[57]=o,e[58]=ge):ge=e[58];let he;e[59]!==ge?(he={head:ge,render:Yt},e[59]=ge,e[60]=he):he=e[60];let be;e[61]!==o?(be=o("role"),e[61]=o,e[62]=be):be=e[62];let fe;e[63]!==be?(fe={head:be,render:Zt},e[63]=be,e[64]=fe):fe=e[64];let et;e[65]!==he||e[66]!==fe?(et=[he,fe],e[65]=he,e[66]=fe,e[67]=et):et=e[67];let st=et,pe;e[68]!==o?(pe=o("email"),e[68]=o,e[69]=pe):pe=e[69];let ve;e[70]!==pe?(ve={head:pe,render:Gt},e[70]=pe,e[71]=ve):ve=e[71];let ye;e[72]!==o?(ye=o("role"),e[72]=o,e[73]=ye):ye=e[73];let Ce;e[74]!==ye?(Ce={head:ye,render:Ht},e[74]=ye,e[75]=Ce):Ce=e[75];let Ie;e[76]!==o?(Ie=o("status"),e[76]=o,e[77]=Ie):Ie=e[77];let xe;e[78]!==Ie?(xe={head:Ie,render:Wt},e[78]=Ie,e[79]=xe):xe=e[79];let tt;e[80]!==ve||e[81]!==Ce||e[82]!==xe?(tt=[ve,Ce,xe],e[80]=ve,e[81]=Ce,e[82]=xe,e[83]=tt):tt=e[83];let mt=tt,we;e[84]!==o?(we=o("id"),e[84]=o,e[85]=we):we=e[85];let ke;e[86]!==we?(ke={className:"font-mono text-xs",head:we,render:Vt},e[86]=we,e[87]=ke):ke=e[87];let ze;e[88]!==o?(ze=o("name"),e[88]=o,e[89]=ze):ze=e[89];let Ne;e[90]!==ze?(Ne={head:ze,render:er},e[90]=ze,e[91]=Ne):Ne=e[91];let rt;e[92]!==ke||e[93]!==Ne?(rt=[ke,Ne],e[92]=ke,e[93]=Ne,e[94]=rt):rt=e[94];let dt=rt,Se;e[95]!==o?(Se=o("userId"),e[95]=o,e[96]=Se):Se=e[96];let ot;e[97]!==Se?(ot=[{head:Se,render:tr}],e[97]=Se,e[98]=ot):ot=e[98];let ct=ot,De;e[99]!==o?(De=o("role"),e[99]=o,e[100]=De):De=e[100];let Ae;e[101]!==De?(Ae={head:De,render:rr},e[101]=De,e[102]=Ae):Ae=e[102];let _e;e[103]!==o?(_e=o("Permission"),e[103]=o,e[104]=_e):_e=e[104];let Oe;e[105]!==_e?(Oe={className:"font-mono text-xs whitespace-pre-wrap",head:_e,render:or},e[105]=_e,e[106]=Oe):Oe=e[106];let at;e[107]!==Ae||e[108]!==Oe?(at=[Ae,Oe],e[107]=Ae,e[108]=Oe,e[109]=at):at=e[109];let ut=at,Te;e[110]!==oe?(Te=oe!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:oe}),e[110]=oe,e[111]=Te):Te=e[111];let Me;e[112]!==g?(Me=g!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:g}),e[112]=g,e[113]=Me):Me=e[113];let Re;e[114]!==i||e[115]!==le?(Re=c(G=>{le(()=>i.removeAuthOrgMember({memberId:G}))},"Te"),e[114]=i,e[115]=le,e[116]=Re):Re=e[116];let $e;e[117]!==b||e[118]!==st||e[119]!==Y||e[120]!==Re?($e=(0,a.jsx)(Ut,{actionBusy:b,memberColumns:st,members:Y,onDialog:n,onRemoveMember:Re}),e[117]=b,e[118]=st,e[119]=Y,e[120]=Re,e[121]=$e):$e=e[121];let Fe;e[122]!==b||e[123]!==i||e[124]!==mt||e[125]!==$||e[126]!==le||e[127]!==o?(Fe=$.length>0&&(0,a.jsx)(Ge,{heading:o("Invitations"),testId:"org-invitations",children:(0,a.jsx)(He,{columns:mt,rowActions:c(G=>(0,a.jsx)(L,{"data-testid":`org-cancel-invitation-${S(G.id)}`,disabled:b,onClick:c(()=>{le(()=>i.cancelAuthOrgInvitation({invitationId:S(G.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Cancel")}),"rowActions"),rowPrefix:"org-invitation",rows:$})}),e[122]=b,e[123]=i,e[124]=mt,e[125]=$,e[126]=le,e[127]=o,e[128]=Fe):Fe=e[128];let Ee;e[129]!==it||e[130]!==s||e[131]!==dt||e[132]!==ie||e[133]!==h?(Ee=h&&(0,a.jsx)(qt,{onConfirmDeleteTeam:it,onDialog:n,onSelectTeam:m,selectedTeam:s,teamColumns:dt,teams:ie}),e[129]=it,e[130]=s,e[131]=dt,e[132]=ie,e[133]=h,e[134]=Ee):Ee=e[134];let Le;e[135]!==b||e[136]!==i||e[137]!==le||e[138]!==s||e[139]!==ct||e[140]!==te||e[141]!==h?(Le=h&&s!==null&&(0,a.jsx)(Kt,{actionBusy:b,onDialog:n,onRemoveTeamMember:c(G=>{le(()=>i.removeAuthOrgTeamMember({teamMemberId:G}))},"onRemoveTeamMember"),selectedTeam:s,teamMemberColumns:ct,teamMembers:te}),e[135]=b,e[136]=i,e[137]=le,e[138]=s,e[139]=ct,e[140]=te,e[141]=h,e[142]=Le):Le=e[142];let je;e[143]!==i||e[144]!==ut||e[145]!==ee||e[146]!==d||e[147]!==o?(je=d&&(0,a.jsx)(Qt,{onConfirmDeleteRole:c(G=>{n({action:c(()=>i.deleteAuthOrgRole({roleId:G}),"action"),kind:"confirm",message:o("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:o("Delete role")})},"onConfirmDeleteRole"),onDialog:n,roleColumns:ut,roles:ee}),e[143]=i,e[144]=ut,e[145]=ee,e[146]=d,e[147]=o,e[148]=je):je=e[148];let Pe;e[149]!==l?.kind||e[150]!==r||e[151]!==_?(Pe=l?.kind==="add-member"&&(0,a.jsx)(Lt,{onClose:F,onDone:_,organizationId:r}),e[149]=l?.kind,e[150]=r,e[151]=_,e[152]=Pe):Pe=e[152];let Be;e[153]!==l?.kind||e[154]!==r||e[155]!==_?(Be=l?.kind==="invite-member"&&(0,a.jsx)(jt,{onClose:F,onDone:_,organizationId:r}),e[153]=l?.kind,e[154]=r,e[155]=_,e[156]=Be):Be=e[156];let Je;e[157]!==l||e[158]!==_?(Je=l?.kind==="member-role"&&(0,a.jsx)(Pt,{member:l.member,onClose:F,onDone:_}),e[157]=l,e[158]=_,e[159]=Je):Je=e[159];let Ue;e[160]!==l?.kind||e[161]!==r||e[162]!==_?(Ue=l?.kind==="team-create"&&(0,a.jsx)(At,{mode:"create",onClose:F,onDone:_,organizationId:r}),e[160]=l?.kind,e[161]=r,e[162]=_,e[163]=Ue):Ue=e[163];let qe;e[164]!==l||e[165]!==r||e[166]!==_?(qe=l?.kind==="team-rename"&&(0,a.jsx)(At,{mode:"edit",onClose:F,onDone:_,organizationId:r,team:l.team}),e[164]=l,e[165]=r,e[166]=_,e[167]=qe):qe=e[167];let Ke;e[168]!==l||e[169]!==_?(Ke=l?.kind==="team-add-member"&&(0,a.jsx)(Bt,{onClose:F,onDone:_,teamId:l.teamId}),e[168]=l,e[169]=_,e[170]=Ke):Ke=e[170];let Qe;e[171]!==l?.kind||e[172]!==r||e[173]!==_?(Qe=l?.kind==="role-create"&&(0,a.jsx)(_t,{mode:"create",onClose:F,onDone:_,organizationId:r}),e[171]=l?.kind,e[172]=r,e[173]=_,e[174]=Qe):Qe=e[174];let Xe;e[175]!==l||e[176]!==r||e[177]!==_?(Xe=l?.kind==="role-edit"&&(0,a.jsx)(_t,{mode:"edit",onClose:F,onDone:_,organizationId:r,role:l.role}),e[175]=l,e[176]=r,e[177]=_,e[178]=Xe):Xe=e[178];let Ye;e[179]!==l||e[180]!==_?(Ye=l?.kind==="confirm"&&(0,a.jsx)(Mt,{action:l.action,message:l.message,onClose:F,onDone:_,testId:l.testId,title:l.title}),e[179]=l,e[180]=_,e[181]=Ye):Ye=e[181];let lt;return e[182]!==Te||e[183]!==Me||e[184]!==$e||e[185]!==Fe||e[186]!==Ee||e[187]!==Le||e[188]!==je||e[189]!==Pe||e[190]!==Be||e[191]!==Je||e[192]!==Ue||e[193]!==qe||e[194]!==Ke||e[195]!==Qe||e[196]!==Xe||e[197]!==Ye?(lt=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[Te,Me,$e,Fe,Ee,Le,je,Pe,Be,Je,Ue,qe,Ke,Qe,Xe,Ye]}),e[182]=Te,e[183]=Me,e[184]=$e,e[185]=Fe,e[186]=Ee,e[187]=Le,e[188]=je,e[189]=Pe,e[190]=Be,e[191]=Je,e[192]=Ue,e[193]=qe,e[194]=Ke,e[195]=Qe,e[196]=Xe,e[197]=Ye,e[198]=lt):lt=e[198],lt},"Ut");function Yt(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:S(t.userId)})}c(Yt,"Ht");function Zt(t){return S(t.role)}c(Zt,"qt");function Gt(t){return S(t.email)}c(Gt,"Gt");function Ht(t){return S(t.role)}c(Ht,"Kt");function Wt(t){return S(t.status)}c(Wt,"Vt");function Vt(t){return S(t.id)}c(Vt,"Wt");function er(t){return S(t.name)}c(er,"Xt");function tr(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:S(t.userId)})}c(tr,"Yt");function rr(t){return S(t.role)}c(rr,"Zt");function or(t){return S(t.permission)}c(or,"el");var yr=c(()=>{let t=(0,U.c)(62),e=re(),r=q(),{config:d,ready:h}=Nt(),i=d.capabilities.organization,[o,l]=(0,j.useState)(null),[n,s]=(0,j.useState)(null),m;t[0]===Symbol.for("react.memo_cache_sentinel")?(m=["lunora-auth-orgs"],t[0]=m):m=t[0];let b;t[1]!==e?(b=c(()=>e.listAuthOrganizations({limit:100}),"g"),t[1]=e,t[2]=b):b=t[2];let u;t[3]!==i?(u={enabled:i},t[3]=i,t[4]=u):u=t[4];let g=ue(m,b,u),p=g.data?.rows??null,f;t[5]!==g?(f=c(()=>{g.refetch()},"h"),t[5]=g,t[6]=f):f=t[6],Ct(f,i);let y;t[7]===Symbol.for("react.memo_cache_sentinel")?(y=c(()=>{s(null)},"v"),t[7]=y):y=t[7];let k=y,v;t[8]!==g?(v=c(()=>{g.refetch()},"p"),t[8]=g,t[9]=v):v=t[9];let I=v,C;t[10]===Symbol.for("react.memo_cache_sentinel")?(C=c(R=>{l(R)},"y"),t[10]=C):C=t[10];let z=C;if(h&&!i){let R;t[11]!==r?(R=r("Enable the organization() plugin in your auth config to manage organizations here."),t[11]=r,t[12]=R):R=t[12];let $;t[13]!==r?($=r("Organizations are not enabled."),t[13]=r,t[14]=$):$=t[14];let K;return t[15]!==R||t[16]!==$?(K=(0,a.jsx)(ce,{description:R,testId:"org-disabled",title:$}),t[15]=R,t[16]=$,t[17]=K):K=t[17],K}let x;t[18]!==r?(x=r("Organizations"),t[18]=r,t[19]=x):x=t[19];let w;t[20]!==x?(w=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:x}),t[20]=x,t[21]=w):w=t[21];let N;t[22]===Symbol.for("react.memo_cache_sentinel")?(N=c(()=>{s({kind:"create"})},"D"),t[22]=N):N=t[22];let O;t[23]!==r?(O=r("New organization"),t[23]=r,t[24]=O):O=t[24];let A;t[25]!==O?(A=(0,a.jsx)(L,{"data-testid":"org-new",onClick:N,size:"sm",type:"button",children:O}),t[25]=O,t[26]=A):A=t[26];let D;t[27]!==A||t[28]!==w?(D=(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[w,A]}),t[27]=A,t[28]=w,t[29]=D):D=t[29];let T;t[30]!==g.error?(T=g.error!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error}),t[30]=g.error,t[31]=T):T=t[31];let M;t[32]!==p||t[33]!==r?(M=p!==null&&p.length===0&&(0,a.jsx)(ce,{testId:"org-empty",title:r("No organizations.")}),t[32]=p,t[33]=r,t[34]=M):M=t[34];let P;t[35]!==p||t[36]!==o||t[37]!==r?(P=p!==null&&p.length>0&&(0,a.jsx)(ht,{className:"overflow-hidden py-0",children:(0,a.jsx)(bt,{className:"px-0",children:(0,a.jsxs)(ft,{"data-testid":"org-table",children:[(0,a.jsx)(pt,{children:(0,a.jsxs)(Ze,{children:[(0,a.jsx)(se,{children:r("id")}),(0,a.jsx)(se,{children:r("name")}),(0,a.jsx)(se,{children:r("slug")}),(0,a.jsx)(se,{children:r("created")}),(0,a.jsx)(se,{"aria-label":r("Actions")})]})}),(0,a.jsx)(vt,{children:p.map(R=>{let $=S(R.id);return(0,a.jsxs)(Ze,{"data-testid":`org-row-${$}`,children:[(0,a.jsx)(me,{className:"font-mono text-xs",children:$}),(0,a.jsx)(me,{children:S(R.name)}),(0,a.jsx)(me,{children:S(R.slug)}),(0,a.jsx)(me,{className:"text-muted-foreground tabular-nums",children:kt(R.createdAt)}),(0,a.jsx)(me,{children:(0,a.jsxs)("div",{className:"flex justify-end gap-1",children:[(0,a.jsx)(L,{"aria-pressed":o===$,"data-testid":`org-select-${$}`,onClick:c(()=>{z($)},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Manage")}),(0,a.jsx)(L,{"data-testid":`org-edit-${$}`,onClick:c(()=>{s({kind:"edit",org:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Edit")}),(0,a.jsx)(L,{"data-testid":`org-delete-${$}`,onClick:c(()=>{s({kind:"delete",org:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Delete")})]})})]},$)})})]})})}),t[35]=p,t[36]=o,t[37]=r,t[38]=P):P=t[38];let Q;t[39]!==d.organization||t[40]!==o?(Q=o!==null&&(0,a.jsx)(Xt,{organizationId:o,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams}),t[39]=d.organization,t[40]=o,t[41]=Q):Q=t[41];let B;t[42]!==n?.kind||t[43]!==I?(B=n?.kind==="create"&&(0,a.jsx)(Dt,{mode:"create",onClose:k,onDone:I}),t[42]=n?.kind,t[43]=I,t[44]=B):B=t[44];let E;t[45]!==n||t[46]!==I?(E=n?.kind==="edit"&&(0,a.jsx)(Dt,{mode:"edit",onClose:k,onDone:I,org:n.org}),t[45]=n,t[46]=I,t[47]=E):E=t[47];let J;t[48]!==e||t[49]!==n||t[50]!==I||t[51]!==r?(J=n?.kind==="delete"&&(0,a.jsx)(Mt,{action:c(async()=>{let R=S(n.org.id);await e.deleteAuthOrganization({organizationId:R}),l($=>$===R?null:$)},"action"),message:r("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:k,onDone:I,testId:"org-delete",title:r("Delete organization")}),t[48]=e,t[49]=n,t[50]=I,t[51]=r,t[52]=J):J=t[52];let Y;return t[53]!==D||t[54]!==T||t[55]!==M||t[56]!==P||t[57]!==Q||t[58]!==B||t[59]!==E||t[60]!==J?(Y=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[D,T,M,P,Q,B,E,J]}),t[53]=D,t[54]=T,t[55]=M,t[56]=P,t[57]=Q,t[58]=B,t[59]=E,t[60]=J,t[61]=Y):Y=t[61],Y},"yl");export{yr as default};
@@ -1 +1 @@
1
- import{a as x}from"./chunk-VDW32UET.js";import{c as S}from"./chunk-2UWKGSEA.js";import{f as q}from"./chunk-22WJHOC4.js";import{d as _,f as g,g as y,m as C}from"./chunk-BKM6PMSO.js";import{a as u,d as w,e as L,f as T,g as F}from"./chunk-R5ZTCHCE.js";var v=w(L(),1);var j={},A=g(x.aiGenerateSql),I=g(x.aiTableFilter),O=g(x.aiChartConfig),R=u(s=>{let e=q(),[i,d]=(0,v.useState)({}),[n,r]=(0,v.useState)({}),a=S(x.aiAvailable,j,{shardKey:s}),[f,l]=(0,v.useState)(!1),b=f||a.data?.available===!1,p=u(t=>{d(o=>({...o,[t]:!0})),r(o=>({...o,[t]:void 0}))},"i"),h=u((t,o)=>{d(c=>({...c,[t]:!1})),o!==void 0&&r(c=>({...c,[t]:o})),o==="no-ai-binding"&&l(!0)},"a");return{generate:u(async(t,o)=>{p("sql");try{let{result:c}=await e.query(A,{failedError:o?.error,failedSql:o?.sql,prompt:t},y(s));return h("sql",c.degraded?c.reason:void 0),c.degraded?void 0:c.sql}catch{h("sql","ai-error");return}},"generate"),inferChart:u(async t=>{p("chart");try{let{result:o}=await e.query(O,t,y(s));return h("chart",o.degraded?o.reason:void 0),o.degraded?void 0:o.chart}catch{h("chart","ai-error");return}},"inferChart"),pending:u(t=>i[t]===!0,"pending"),reason:u(t=>n[t],"reason"),suggestFilter:u(async(t,o)=>{p("filter");try{let{result:c}=await e.query(I,{prompt:t,table:o},y(s));return h("filter",c.degraded?c.reason:void 0),c.degraded?void 0:c.clauses}catch{h("filter","ai-error");return}},"suggestFilter"),unavailable:b}},"w");var N=w(T(),1);var m=w(F(),1);var G=u((s,e)=>{if(e==="")return[{match:!1,offset:0,text:s}];let i=[],d=s.toLowerCase(),n=e.toLowerCase(),r=0;for(let a=d.indexOf(n);a!==-1;a=d.indexOf(n,r))a>r&&i.push({match:!1,offset:r,text:s.slice(r,a)}),i.push({match:!0,offset:a,text:s.slice(a,a+e.length)}),r=a+e.length;return r<s.length&&i.push({match:!1,offset:r,text:s.slice(r)}),i},"N"),U=u(s=>{let e=(0,N.c)(9),{highlight:i,value:d}=s;if(d==null){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=(0,m.jsx)("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=l):l=e[0],l}let n,r,a;if(e[1]!==i||e[2]!==d){a=Symbol.for("react.early_return_sentinel");e:{let l=C(d);if(i===void 0||i===""){a=(0,m.jsx)("span",{title:l,children:l});break e}n=l,r=G(l,i).map(z)}e[1]=i,e[2]=d,e[3]=n,e[4]=r,e[5]=a}else n=e[3],r=e[4],a=e[5];if(a!==Symbol.for("react.early_return_sentinel"))return a;let f;return e[6]!==n||e[7]!==r?(f=(0,m.jsx)("span",{title:n,children:r}),e[6]=n,e[7]=r,e[8]=f):f=e[8],f},"v"),Q=u(s=>{let e=(0,N.c)(22),{columns:i,rows:d}=s,n=_(),r;e[0]!==n?(r=n("Field"),e[0]=n,e[1]=r):r=e[1];let a;e[2]!==r?(a=(0,m.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:r}),e[2]=r,e[3]=a):a=e[3];let f;if(e[4]!==d||e[5]!==n){let t;e[7]!==n?(t=u((o,c)=>(0,m.jsx)("th",{className:"border-b border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase tabular-nums text-muted-foreground",children:n("Row {n}",{n:c+1})},c),"c"),e[7]=n,e[8]=t):t=e[8],f=d.map(t),e[4]=d,e[5]=n,e[6]=f}else f=e[6];let l;e[9]!==a||e[10]!==f?(l=(0,m.jsx)("thead",{className:"sticky top-0 z-10 bg-muted",children:(0,m.jsxs)("tr",{children:[a,f]})}),e[9]=a,e[10]=f,e[11]=l):l=e[11];let b;if(e[12]!==i||e[13]!==d){let t;e[15]!==d?(t=u(o=>(0,m.jsxs)("tr",{className:"hover:bg-muted/40",children:[(0,m.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:o}),d.map((c,k)=>(0,m.jsx)("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:(0,m.jsx)(U,{value:c[o]})},k))]},o),"c"),e[15]=d,e[16]=t):t=e[16],b=i.map(t),e[12]=i,e[13]=d,e[14]=b}else b=e[14];let p;e[17]!==b?(p=(0,m.jsx)("tbody",{children:b}),e[17]=b,e[18]=p):p=e[18];let h;return e[19]!==l||e[20]!==p?(h=(0,m.jsx)("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:(0,m.jsxs)("table",{className:"border-collapse text-xs",children:[l,p]})}),e[19]=l,e[20]=p,e[21]=h):h=e[21],h},"T"),V=u(({children:s,layout:e="card",testId:i})=>(0,m.jsx)("div",{className:e==="fill"?"flex min-h-0 flex-1 flex-col overflow-hidden border-t border-border":"overflow-x-auto border border-border bg-card","data-testid":i,children:s}),"j");function z(s){return(0,m.jsx)("mark",{className:s.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:s.text},s.offset)}u(z,"_");export{R as a,U as b,Q as c,V as d};
1
+ import{a as x}from"./chunk-VDW32UET.js";import{c as S}from"./chunk-L6ATKZKO.js";import{f as q}from"./chunk-YTYRZTG6.js";import{d as _,f as g,g as y,m as C}from"./chunk-BKM6PMSO.js";import{a as u,d as w,e as L,f as T,g as F}from"./chunk-R5ZTCHCE.js";var v=w(L(),1);var j={},A=g(x.aiGenerateSql),I=g(x.aiTableFilter),O=g(x.aiChartConfig),R=u(s=>{let e=q(),[i,d]=(0,v.useState)({}),[n,r]=(0,v.useState)({}),a=S(x.aiAvailable,j,{shardKey:s}),[f,l]=(0,v.useState)(!1),b=f||a.data?.available===!1,p=u(t=>{d(o=>({...o,[t]:!0})),r(o=>({...o,[t]:void 0}))},"i"),h=u((t,o)=>{d(c=>({...c,[t]:!1})),o!==void 0&&r(c=>({...c,[t]:o})),o==="no-ai-binding"&&l(!0)},"a");return{generate:u(async(t,o)=>{p("sql");try{let{result:c}=await e.query(A,{failedError:o?.error,failedSql:o?.sql,prompt:t},y(s));return h("sql",c.degraded?c.reason:void 0),c.degraded?void 0:c.sql}catch{h("sql","ai-error");return}},"generate"),inferChart:u(async t=>{p("chart");try{let{result:o}=await e.query(O,t,y(s));return h("chart",o.degraded?o.reason:void 0),o.degraded?void 0:o.chart}catch{h("chart","ai-error");return}},"inferChart"),pending:u(t=>i[t]===!0,"pending"),reason:u(t=>n[t],"reason"),suggestFilter:u(async(t,o)=>{p("filter");try{let{result:c}=await e.query(I,{prompt:t,table:o},y(s));return h("filter",c.degraded?c.reason:void 0),c.degraded?void 0:c.clauses}catch{h("filter","ai-error");return}},"suggestFilter"),unavailable:b}},"w");var N=w(T(),1);var m=w(F(),1);var G=u((s,e)=>{if(e==="")return[{match:!1,offset:0,text:s}];let i=[],d=s.toLowerCase(),n=e.toLowerCase(),r=0;for(let a=d.indexOf(n);a!==-1;a=d.indexOf(n,r))a>r&&i.push({match:!1,offset:r,text:s.slice(r,a)}),i.push({match:!0,offset:a,text:s.slice(a,a+e.length)}),r=a+e.length;return r<s.length&&i.push({match:!1,offset:r,text:s.slice(r)}),i},"N"),U=u(s=>{let e=(0,N.c)(9),{highlight:i,value:d}=s;if(d==null){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=(0,m.jsx)("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=l):l=e[0],l}let n,r,a;if(e[1]!==i||e[2]!==d){a=Symbol.for("react.early_return_sentinel");e:{let l=C(d);if(i===void 0||i===""){a=(0,m.jsx)("span",{title:l,children:l});break e}n=l,r=G(l,i).map(z)}e[1]=i,e[2]=d,e[3]=n,e[4]=r,e[5]=a}else n=e[3],r=e[4],a=e[5];if(a!==Symbol.for("react.early_return_sentinel"))return a;let f;return e[6]!==n||e[7]!==r?(f=(0,m.jsx)("span",{title:n,children:r}),e[6]=n,e[7]=r,e[8]=f):f=e[8],f},"v"),Q=u(s=>{let e=(0,N.c)(22),{columns:i,rows:d}=s,n=_(),r;e[0]!==n?(r=n("Field"),e[0]=n,e[1]=r):r=e[1];let a;e[2]!==r?(a=(0,m.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:r}),e[2]=r,e[3]=a):a=e[3];let f;if(e[4]!==d||e[5]!==n){let t;e[7]!==n?(t=u((o,c)=>(0,m.jsx)("th",{className:"border-b border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase tabular-nums text-muted-foreground",children:n("Row {n}",{n:c+1})},c),"c"),e[7]=n,e[8]=t):t=e[8],f=d.map(t),e[4]=d,e[5]=n,e[6]=f}else f=e[6];let l;e[9]!==a||e[10]!==f?(l=(0,m.jsx)("thead",{className:"sticky top-0 z-10 bg-muted",children:(0,m.jsxs)("tr",{children:[a,f]})}),e[9]=a,e[10]=f,e[11]=l):l=e[11];let b;if(e[12]!==i||e[13]!==d){let t;e[15]!==d?(t=u(o=>(0,m.jsxs)("tr",{className:"hover:bg-muted/40",children:[(0,m.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:o}),d.map((c,k)=>(0,m.jsx)("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:(0,m.jsx)(U,{value:c[o]})},k))]},o),"c"),e[15]=d,e[16]=t):t=e[16],b=i.map(t),e[12]=i,e[13]=d,e[14]=b}else b=e[14];let p;e[17]!==b?(p=(0,m.jsx)("tbody",{children:b}),e[17]=b,e[18]=p):p=e[18];let h;return e[19]!==l||e[20]!==p?(h=(0,m.jsx)("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:(0,m.jsxs)("table",{className:"border-collapse text-xs",children:[l,p]})}),e[19]=l,e[20]=p,e[21]=h):h=e[21],h},"T"),V=u(({children:s,layout:e="card",testId:i})=>(0,m.jsx)("div",{className:e==="fill"?"flex min-h-0 flex-1 flex-col overflow-hidden border-t border-border":"overflow-x-auto border border-border bg-card","data-testid":i,children:s}),"j");function z(s){return(0,m.jsx)("mark",{className:s.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:s.text},s.offset)}u(z,"_");export{R as a,U as b,Q as c,V as d};
@@ -1,4 +1,4 @@
1
- import{a as Ce}from"./chunk-METRMDIQ.js";import{a as he}from"./chunk-NXXGISFB.js";import{d as Ne,f as ke,g as we,k as oe}from"./chunk-DKSLOJDQ.js";import{a as V}from"./chunk-MCLM2QJI.js";import{a as Oe}from"./chunk-6UN4V2HB.js";import"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import{P as ye}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as D}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as ve}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as Ie}from"./chunk-VDW32UET.js";import{f as H}from"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{a as F}from"./chunk-UANVABQG.js";import{d as E,e as Se,f as se,g as ie,h as le,o as $e,q as ae}from"./chunk-BKM6PMSO.js";import{c as be}from"./chunk-VYW2PAWC.js";import{a as u,d as J,e as ue,f as te,g as re,i as fe}from"./chunk-R5ZTCHCE.js";var He=J(te(),1),xe=J(ue(),1);var Y=J(te(),1);var X=J(ue(),1);var A=J(re(),1);var Ge=se(Ie.listTables),Qe=["react","client","cli"],Ve={action:"action",mutation:"mutation",query:"query"},_e=u(t=>{let e=t.indexOf(":");return e===-1?{file:"",fn:t}:{file:t.slice(0,e),fn:t.slice(e+1)}},"Q"),Xe=u(({file:t,fn:e,kind:a})=>`await client.${Ve[a]}(api.${t}.${e}, { /* args */ });`,"ie"),Ye=u(t=>{let e=`api.${t.file}.${t.fn}`;switch(t.kind){case"action":return`const { call: ${t.fn} } = useAction(${e});`;case"mutation":return`const ${t.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},"se"),Ze=u(({file:t,fn:e})=>`lunora run ${t}:${e} --args '{ }'`,"oe"),et=u(t=>["// Read rows",`const rows = await ctx.db.query("${t}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${t}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${t}">;`,`type RowId = Id<"${t}">;`].join(`
1
+ import{a as Ce}from"./chunk-METRMDIQ.js";import{a as he}from"./chunk-NXXGISFB.js";import{d as Ne,f as ke,g as we,k as oe}from"./chunk-DKSLOJDQ.js";import{a as V}from"./chunk-MCLM2QJI.js";import{a as Oe}from"./chunk-6UN4V2HB.js";import"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import{P as ye}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as D}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as ve}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as Ie}from"./chunk-VDW32UET.js";import{f as H}from"./chunk-YTYRZTG6.js";import"./chunk-RCZTUWG3.js";import{a as F}from"./chunk-UANVABQG.js";import{d as E,e as Se,f as se,g as ie,h as le,o as $e,q as ae}from"./chunk-BKM6PMSO.js";import{c as be}from"./chunk-VYW2PAWC.js";import{a as u,d as J,e as ue,f as te,g as re,i as fe}from"./chunk-R5ZTCHCE.js";var He=J(te(),1),xe=J(ue(),1);var Y=J(te(),1);var X=J(ue(),1);var A=J(re(),1);var Ge=se(Ie.listTables),Qe=["react","client","cli"],Ve={action:"action",mutation:"mutation",query:"query"},_e=u(t=>{let e=t.indexOf(":");return e===-1?{file:"",fn:t}:{file:t.slice(0,e),fn:t.slice(e+1)}},"Q"),Xe=u(({file:t,fn:e,kind:a})=>`await client.${Ve[a]}(api.${t}.${e}, { /* args */ });`,"ie"),Ye=u(t=>{let e=`api.${t.file}.${t.fn}`;switch(t.kind){case"action":return`const { call: ${t.fn} } = useAction(${e});`;case"mutation":return`const ${t.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},"se"),Ze=u(({file:t,fn:e})=>`lunora run ${t}:${e} --args '{ }'`,"oe"),et=u(t=>["// Read rows",`const rows = await ctx.db.query("${t}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${t}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${t}">;`,`type RowId = Id<"${t}">;`].join(`
2
2
  `),"ce"),tt=u((t,e)=>{switch(t){case"cli":return Ze(e);case"client":return Xe(e);default:return Ye(e)}},"re"),je=u(t=>{let e=(0,Y.c)(19),{code:a,label:r,testId:n}=t,s=E(),o;e[0]!==a?(o=u(()=>{ae(a)},"c"),e[0]=a,e[1]=o):o=e[1];let i=o,d;e[2]!==r?(d=(0,A.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:r}),e[2]=r,e[3]=d):d=e[3];let m=`${n}-copy`,l;e[4]!==s?(l=s("Copy"),e[4]=s,e[5]=l):l=e[5];let c;e[6]!==i||e[7]!==m||e[8]!==l?(c=(0,A.jsx)(D,{"data-testid":m,onClick:i,size:"xs",type:"button",variant:"ghost",children:l}),e[6]=i,e[7]=m,e[8]=l,e[9]=c):c=e[9];let f;e[10]!==d||e[11]!==c?(f=(0,A.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[d,c]}),e[10]=d,e[11]=c,e[12]=f):f=e[12];let h;e[13]!==a||e[14]!==n?(h=(0,A.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":n,children:a}),e[13]=a,e[14]=n,e[15]=h):h=e[15];let g;return e[16]!==f||e[17]!==h?(g=(0,A.jsxs)("div",{className:"flex flex-col gap-1.5",children:[f,h]}),e[16]=f,e[17]=h,e[18]=g):g=e[18],g},"U"),rt=u(t=>{let e=(0,Y.c)(46),{file:a,fn:r,kind:n}=t,s=E(),[o,i]=(0,X.useState)("react"),d,m,l;if(e[0]!==a||e[1]!==r||e[2]!==n||e[3]!==s||e[4]!==o){let S={file:a,fn:r,kind:n},P;e[8]!==s?(P=s("CLI"),e[8]=s,e[9]=P):P=e[9];let I;e[10]!==s?(I=s("Client"),e[10]=s,e[11]=I):I=e[11];let $;e[12]!==s?($=s("React"),e[12]=s,e[13]=$):$=e[13];let j;e[14]!==P||e[15]!==I||e[16]!==$?(j={cli:P,client:I,react:$},e[14]=P,e[15]=I,e[16]=$,e[17]=j):j=e[17],l=j;let T;e[18]===Symbol.for("react.memo_cache_sentinel")?(T=u(R=>{i(R.currentTarget.dataset.tab)},"B"),e[18]=T):T=e[18],d=T,m=tt(o,S),e[0]=a,e[1]=r,e[2]=n,e[3]=s,e[4]=o,e[5]=d,e[6]=m,e[7]=l}else d=e[5],m=e[6],l=e[7];let c=m,f=`api.${a}.${r}`,h;e[19]!==f?(h=(0,A.jsx)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-fn-title",children:f}),e[19]=f,e[20]=h):h=e[20];let g;e[21]!==n||e[22]!==s?(g=s("Call this {kind} from your app.",{kind:n}),e[21]=n,e[22]=s,e[23]=g):g=e[23];let b;e[24]!==g?(b=(0,A.jsx)("p",{className:"text-xs text-muted-foreground",children:g}),e[24]=g,e[25]=b):b=e[25];let y;e[26]!==h||e[27]!==b?(y=(0,A.jsxs)("div",{children:[h,b]}),e[26]=h,e[27]=b,e[28]=y):y=e[28];let N;e[29]!==s?(N=s("Snippet flavour"),e[29]=s,e[30]=N):N=e[30];let v;e[31]!==d||e[32]!==o||e[33]!==l?(v=Qe.map(S=>(0,A.jsx)(D,{"aria-selected":o===S,"data-tab":S,"data-testid":`api-tab-${S}`,onClick:d,role:"tab",size:"xs",type:"button",variant:o===S?"default":"outline",children:l[S]},S)),e[31]=d,e[32]=o,e[33]=l,e[34]=v):v=e[34];let x;e[35]!==N||e[36]!==v?(x=(0,A.jsx)("div",{"aria-label":N,className:"flex gap-1.5","data-testid":"api-tabs",role:"tablist",children:v}),e[35]=N,e[36]=v,e[37]=x):x=e[37];let k=l[o],O=`api-snippet-${o}`,C;e[38]!==c||e[39]!==k||e[40]!==O?(C=(0,A.jsx)(je,{code:c,label:k,testId:O}),e[38]=c,e[39]=k,e[40]=O,e[41]=C):C=e[41];let w;return e[42]!==C||e[43]!==y||e[44]!==x?(w=(0,A.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"api-fn-doc",children:[y,x,C]}),e[42]=C,e[43]=y,e[44]=x,e[45]=w):w=e[45],w},"de"),at=u(t=>{let e=(0,Y.c)(19),{name:a}=t,r=E(),n;e[0]!==a?(n=et(a),e[0]=a,e[1]=n):n=e[1];let s=n,o;e[2]!==a?(o=(0,A.jsx)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-table-title",children:a}),e[2]=a,e[3]=o):o=e[3];let i;e[4]!==r?(i=r("Read and write this table through the typed data model."),e[4]=r,e[5]=i):i=e[5];let d;e[6]!==i?(d=(0,A.jsx)("p",{className:"text-xs text-muted-foreground",children:i}),e[6]=i,e[7]=d):d=e[7];let m;e[8]!==o||e[9]!==d?(m=(0,A.jsxs)("div",{children:[o,d]}),e[8]=o,e[9]=d,e[10]=m):m=e[10];let l;e[11]!==r?(l=r("Data model"),e[11]=r,e[12]=l):l=e[12];let c;e[13]!==s||e[14]!==l?(c=(0,A.jsx)(je,{code:s,label:l,testId:"api-snippet-table"}),e[13]=s,e[14]=l,e[15]=c):c=e[15];let f;return e[16]!==m||e[17]!==c?(f=(0,A.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"api-table-doc",children:[m,c]}),e[16]=m,e[17]=c,e[18]=f):f=e[18],f},"fe"),Pe=u(t=>{let e=(0,Y.c)(8),{active:a,label:r,onSelect:n,testId:s,value:o}=t,i;e[0]!==n||e[1]!==o?(i=u(()=>{n(o)},"m"),e[0]=n,e[1]=o,e[2]=i):i=e[2];let d=i,m=a?"page":void 0,l;return e[3]!==r||e[4]!==d||e[5]!==m||e[6]!==s?(l=(0,A.jsx)("button",{"aria-current":m,className:"w-full truncate rounded-md px-2 py-1 text-start font-mono text-xs text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-testid":s,onClick:d,type:"button",children:r}),e[3]=r,e[4]=d,e[5]=m,e[6]=s,e[7]=l):l=e[7],l},"G"),nt=u(t=>{let e=new Map;for(let a of t){let{file:r,fn:n}=_e(a.path),s=e.get(r)??[];s.push({fn:n,kind:a.kind,path:a.path}),e.set(r,s)}return[...e.entries()].map(([a,r])=>({file:a,items:r.toSorted((n,s)=>n.fn.localeCompare(s.fn))})).toSorted((a,r)=>a.file.localeCompare(r.file))},"pe"),Ae=u(t=>{let e=(0,Y.c)(58),{functions:a,initialShardKey:r}=t,n=E(),s=H(),[o,i]=(0,X.useState)(null),[d,m]=(0,X.useState)(null),l,c;e[0]!==s||e[1]!==r?(l=u(()=>{let R=!1;return s.query(Ge,{},ie(r??"")).then(_=>(R||i(_),_)).catch(()=>{R||i([])}),()=>{R=!0}},"o"),c=[s,r],e[0]=s,e[1]=r,e[2]=l,e[3]=c):(l=e[2],c=e[3]),(0,X.useEffect)(l,c);let f,h,g,b,y,N,v,x,k,O;if(e[4]!==a||e[5]!==d||e[6]!==n||e[7]!==o){let R=a??[],_=nt(R),q=(o??[]).map(ot).toSorted(st),M;e[18]===Symbol.for("react.memo_cache_sentinel")?(M=u(B=>{m({kind:"fn",path:B})},"P"),e[18]=M):M=e[18];let W=M,Q;e[19]===Symbol.for("react.memo_cache_sentinel")?(Q=u(B=>{m({kind:"table",name:B})},"j"),e[19]=Q):Q=e[19];let Ue=Q;h=d?.kind==="fn"?R.find(B=>B.path===d.path):void 0,f=R.length>0||q.length>0,g=h===void 0?void 0:_e(h.path),k="grid min-h-0 gap-6 md:grid-cols-[16rem_minmax(0,1fr)]",O="lunora-api-docs",e[20]!==n?(b=n("API resources"),e[20]=n,e[21]=b):b=e[21],y="flex flex-col gap-4 overflow-y-auto",N="api-rail";let ne;e[22]!==d||e[23]!==n?(ne=u(B=>(0,A.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,A.jsx)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:B.file||n("(root)")}),B.items.map(ee=>(0,A.jsx)(Pe,{active:d?.kind==="fn"&&d.path===ee.path,label:ee.fn,onSelect:W,testId:`api-rail-fn-${ee.path}`,value:ee.path},ee.path))]},B.file),"q"),e[22]=d,e[23]=n,e[24]=ne):ne=e[24],v=_.map(ne),x=q.length>0&&(0,A.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,A.jsx)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Tables")}),q.map(B=>(0,A.jsx)(Pe,{active:d?.kind==="table"&&d.name===B,label:B,onSelect:Ue,testId:`api-rail-table-${B}`,value:B},B))]}),e[4]=a,e[5]=d,e[6]=n,e[7]=o,e[8]=f,e[9]=h,e[10]=g,e[11]=b,e[12]=y,e[13]=N,e[14]=v,e[15]=x,e[16]=k,e[17]=O}else f=e[8],h=e[9],g=e[10],b=e[11],y=e[12],N=e[13],v=e[14],x=e[15],k=e[16],O=e[17];let C;e[25]!==f||e[26]!==n?(C=!f&&(0,A.jsx)("p",{className:"px-2 text-xs text-muted-foreground","data-testid":"api-rail-empty",children:n("No functions or tables to document yet.")}),e[25]=f,e[26]=n,e[27]=C):C=e[27];let w;e[28]!==C||e[29]!==b||e[30]!==y||e[31]!==N||e[32]!==v||e[33]!==x?(w=(0,A.jsxs)("nav",{"aria-label":b,className:y,"data-testid":N,children:[v,x,C]}),e[28]=C,e[29]=b,e[30]=y,e[31]=N,e[32]=v,e[33]=x,e[34]=w):w=e[34];let S;e[35]!==d||e[36]!==n?(S=d===null&&(0,A.jsx)(F,{description:n("Select a function or table to see how to call it from your app."),testId:"api-empty",title:n("API usage snippets")}),e[35]=d,e[36]=n,e[37]=S):S=e[37];let P;e[38]!==d?.kind||e[39]!==h||e[40]!==g?(P=d?.kind==="fn"&&h!==void 0&&g!==void 0&&(0,A.jsx)(rt,{file:g.file,fn:g.fn,kind:h.kind},h.path),e[38]=d?.kind,e[39]=h,e[40]=g,e[41]=P):P=e[41];let I;e[42]!==d?.kind||e[43]!==h||e[44]!==n?(I=d?.kind==="fn"&&h===void 0&&(0,A.jsx)(F,{testId:"api-empty",title:n("API usage snippets")}),e[42]=d?.kind,e[43]=h,e[44]=n,e[45]=I):I=e[45];let $;e[46]!==d?($=d?.kind==="table"&&(0,A.jsx)(at,{name:d.name}),e[46]=d,e[47]=$):$=e[47];let j;e[48]!==S||e[49]!==P||e[50]!==I||e[51]!==$?(j=(0,A.jsxs)("div",{className:"min-w-0",children:[S,P,I,$]}),e[48]=S,e[49]=P,e[50]=I,e[51]=$,e[52]=j):j=e[52];let T;return e[53]!==w||e[54]!==j||e[55]!==k||e[56]!==O?(T=(0,A.jsxs)("div",{className:k,"data-testid":O,children:[w,j]}),e[53]=w,e[54]=j,e[55]=k,e[56]=O,e[57]=T):T=e[57],T},"ke");function ot(t){return t.name}u(ot,"ue");function st(t,e){return t.localeCompare(e)}u(st,"me");var Je=J(te(),1);var L=J(te(),1),K=J(ue(),1);var p=J(re(),1);var pe=u(function(t,e,a){let r=(0,L.c)(10),n;r[0]===Symbol.for("react.memo_cache_sentinel")?(n={kind:"loading"},r[0]=n):n=r[0];let[s,o]=(0,K.useState)(n),i,d;r[1]!==a||r[2]!==e||r[3]!==t?(i=u(()=>{if(t!==void 0)return;let l=!1;return e().then(c=>(l||o(a(c)),c)).catch(c=>{l||o({kind:"error",message:le(c)})}),()=>{l=!0}},"a"),d=[a,e,t],r[1]=a,r[2]=e,r[3]=t,r[4]=i,r[5]=d):(i=r[4],d=r[5]),(0,K.useEffect)(i,d);let m;return r[6]!==a||r[7]!==s||r[8]!==t?(m=t===void 0?s:a(t),r[6]=a,r[7]=s,r[8]=t,r[9]=m):m=r[9],m},"xt"),it=u(t=>typeof t=="number"?"number":typeof t=="boolean"?"boolean":"string","ke"),Re=u(t=>{if(t.enum!==void 0&&t.enum.length>0)return t.enum;if(t.anyOf!==void 0&&t.anyOf.length>0&&t.anyOf.every(e=>e.const!==void 0))return t.anyOf.map(e=>e.const)},"Q"),ce=u(t=>t===void 0?"any":t.const!==void 0?JSON.stringify(t.const):t.enum!==void 0&&t.enum.length>0?t.enum.map(e=>JSON.stringify(e)).join(" | "):t.anyOf!==void 0&&t.anyOf.length>0?t.anyOf.map(e=>ce(e)).join(" | "):t.type==="array"?`array<${ce(t.items)}>`:t.type??"any","F"),lt=u(t=>{let e=Re(t);return e!==void 0?t.type??it(e[0]):ce(t)},"Se"),dt=u(t=>{let e=Re(t);return e===void 0?void 0:e.map(a=>JSON.stringify(a)).join(" | ")},"we"),ct=u(t=>{let e=[];t.minimum!==void 0?e.push(`${String(t.minimum)} \u2264`):t.exclusiveMinimum!==void 0&&e.push(`${String(t.exclusiveMinimum)} <`);let a=e.length>0;e.push("value"),t.maximum!==void 0?e.push(`\u2264 ${String(t.maximum)}`):t.exclusiveMaximum!==void 0&&e.push(`< ${String(t.exclusiveMaximum)}`);let r=e.length>(a?2:1);return a||r?e.join(" "):void 0},"Oe"),pt=u(t=>{if(t.type==="object"&&t.properties!==void 0)return t;if(t.type==="array"&&t.items?.type==="object"&&t.items.properties!==void 0)return t.items},"$e"),Z=u(t=>{if(t===void 0)return null;if(t.const!==void 0)return t.const;if(t.enum!==void 0&&t.enum.length>0)return t.enum[0];if(t.anyOf!==void 0&&t.anyOf.length>0)return Z(t.anyOf[0]);switch(t.type){case"array":return[];case"boolean":return!1;case"number":return 0;case"object":{let e={};for(let[a,r]of Object.entries(t.properties??{}))e[a]=Z(r);return e}case"string":return"";default:return null}},"M"),de=u(t=>{let e=(0,L.c)(7),{label:a,value:r}=t,n;e[0]!==a?(n=(0,p.jsx)("span",{className:"text-muted-foreground",children:a}),e[0]=a,e[1]=n):n=e[1];let s;e[2]!==r?(s=(0,p.jsx)("span",{className:"text-foreground",children:r}),e[2]=r,e[3]=s):s=e[3];let o;return e[4]!==n||e[5]!==s?(o=(0,p.jsxs)("span",{className:"inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 font-mono text-[10px]",children:[n,s]}),e[4]=n,e[5]=s,e[6]=o):o=e[6],o},"D"),mt=u(t=>{let e=(0,L.c)(40),{name:a,required:r,schema:n}=t,s=E(),o;e[0]!==n?(o=ct(n),e[0]=n,e[1]=o):o=e[1];let i=o,d;e[2]!==n?(d=dt(n),e[2]=n,e[3]=d):d=e[3];let m=d,l=n["x-lunora-table"],c=n.format!==void 0||i!==void 0||m!==void 0||l!==void 0,f;e[4]!==n?(f=pt(n),e[4]=n,e[5]=f):f=e[5];let h=f,g=r?"*":"?",b;e[6]!==g?(b=(0,p.jsx)("span",{className:"text-muted-foreground",children:g}),e[6]=g,e[7]=b):b=e[7];let y;e[8]!==a||e[9]!==b?(y=(0,p.jsxs)("span",{className:"font-mono text-foreground",children:[a,b]}),e[8]=a,e[9]=b,e[10]=y):y=e[10];let N;e[11]!==n?(N=lt(n),e[11]=n,e[12]=N):N=e[12];let v;e[13]!==N?(v=(0,p.jsx)("span",{className:"font-mono text-muted-foreground",children:N}),e[13]=N,e[14]=v):v=e[14];let x;e[15]!==y||e[16]!==v?(x=(0,p.jsxs)("div",{className:"flex items-baseline gap-2",children:[y,v]}),e[15]=y,e[16]=v,e[17]=x):x=e[17];let k;e[18]!==n.description?(k=n.description!==void 0&&(0,p.jsx)("p",{className:"max-w-prose text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=k):k=e[19];let O;e[20]!==c||e[21]!==i||e[22]!==l||e[23]!==n.format||e[24]!==s||e[25]!==m?(O=c&&(0,p.jsxs)("div",{className:"flex flex-wrap gap-1",children:[n.format!==void 0&&(0,p.jsx)(de,{label:s("Format"),value:n.format}),i!==void 0&&(0,p.jsx)(de,{label:s("Range"),value:i}),m!==void 0&&(0,p.jsx)(de,{label:s("Value in"),value:m}),l!==void 0&&(0,p.jsx)(de,{label:s("relation"),value:l})]}),e[20]=c,e[21]=i,e[22]=l,e[23]=n.format,e[24]=s,e[25]=m,e[26]=O):O=e[26];let C;e[27]!==k||e[28]!==O||e[29]!==x?(C=(0,p.jsxs)("div",{className:"flex flex-col gap-1 py-2",children:[x,k,O]}),e[27]=k,e[28]=O,e[29]=x,e[30]=C):C=e[30];let w=C;if(h===void 0){let $;return e[31]!==w?($=(0,p.jsx)("div",{className:"border-b border-border/50 last:border-b-0",children:w}),e[31]=w,e[32]=$):$=e[32],$}let S;e[33]!==w?(S=(0,p.jsx)("summary",{className:"cursor-pointer marker:text-muted-foreground",children:w}),e[33]=w,e[34]=S):S=e[34];let P;e[35]!==h?(P=(0,p.jsx)("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:(0,p.jsx)(Me,{schema:h})}),e[35]=h,e[36]=P):P=e[36];let I;return e[37]!==S||e[38]!==P?(I=(0,p.jsxs)("details",{className:"border-b border-border/50 last:border-b-0",children:[S,P]}),e[37]=S,e[38]=P,e[39]=I):I=e[39],I},"Te"),Me=u(t=>{let e=(0,L.c)(7),{schema:a}=t,r;e[0]!==a.required?(r=new Set(a.required),e[0]=a.required,e[1]=r):r=e[1];let n=r,s;e[2]!==a.properties?(s=Object.entries(a.properties??{}),e[2]=a.properties,e[3]=s):s=e[3];let o=s,i;return e[4]!==n||e[5]!==o?(i=(0,p.jsx)("div",{className:"flex flex-col",children:o.map(d=>{let[m,l]=d;return(0,p.jsx)(mt,{name:m,required:n.has(m),schema:l},m)})}),e[4]=n,e[5]=o,e[6]=i):i=e[6],i},"Y"),Te=u(t=>{let e=(0,L.c)(10),{schema:a,testId:r}=t;if(a?.type!=="object"||Object.keys(a.properties??{}).length===0){let o;e[0]!==a?(o=ce(a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==o||e[3]!==r?(i=(0,p.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":r,children:o}),e[2]=o,e[3]=r,e[4]=i):i=e[4],i}let n;e[5]!==a?(n=(0,p.jsx)(Me,{schema:a}),e[5]=a,e[6]=n):n=e[6];let s;return e[7]!==n||e[8]!==r?(s=(0,p.jsx)("div",{className:"text-xs","data-testid":r,children:n}),e[7]=n,e[8]=r,e[9]=s):s=e[9],s},"U"),ut=["curl","javascript","lunora"],ft={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},ht=u(t=>`api.${t.replaceAll(/[/:]/g,".")}`,"Ee"),gt=u(t=>{let e=Z(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},"Pe"),xt=u((t,e,a)=>{let r=`${a}${e.httpPath}`,n=JSON.stringify(gt(e),void 0,2),s=JSON.stringify(Z(e.argsSchema)??{},void 0,2);switch(t){case"curl":{let o=e.method!=="GET"&&e.method!=="HEAD",i=[`curl -X ${e.method} ${JSON.stringify(r)}`];return o&&i.push(' -H "Content-Type: application/json"',` -d '${n}'`),i.join(` \\
3
3
  `)}case"lunora":return e.functionPath===void 0?`await fetch(${JSON.stringify(e.httpPath)}, { method: ${JSON.stringify(e.method)} });`:`import { useLunora } from "@lunora/react";
4
4
  import { api } from "./_generated/api";